Merge pull request #280 from aminya/vite [skip ci]

This commit is contained in:
Amin Yahyaabadi 2024-09-04 14:29:08 -07:00 committed by GitHub
commit 57e4019423
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
47 changed files with 174 additions and 1839 deletions

View File

@ -203,7 +203,11 @@ jobs:
env: env:
RUNNER_OS_NAME: ${{ matrix.os }} RUNNER_OS_NAME: ${{ matrix.os }}
- name: Modern Integration Tests - name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Smoke Test Modern Bundle
if: ${{ !contains(github.event.head_commit.message, '[skip test]') }} if: ${{ !contains(github.event.head_commit.message, '[skip test]') }}
run: | run: |
node ./dist/modern/setup-cpp.mjs --help node ./dist/modern/setup-cpp.mjs --help
@ -215,17 +219,10 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 12 node-version: 12
- name: Smoke Test Node 12 - name: Smoke Test Legacy Bundle
run: | run: |
node ./dist/legacy/setup-cpp.js --help node ./dist/legacy/setup-cpp.js --help
node ./dist/legacy/setup-cpp.js --gcc true --cmake true
- name: Setup Node 16
uses: actions/setup-node@v4
with:
node-version: 16
- name: Smoke Test Node 16
run: |
node ./dist/modern/setup-cpp.mjs --help
Docker: Docker:
name: Docker-${{ matrix.container.image }} name: Docker-${{ matrix.container.image }}

12
babel.config.mts Normal file
View File

@ -0,0 +1,12 @@
import type { TransformOptions } from "@babel/core"
// @ts-ignore
import RemoveNodePrefix from "@upleveled/babel-plugin-remove-node-prefix"
const babelConfig: TransformOptions = {
plugins: [
RemoveNodePrefix,
],
sourceMaps: true,
sourceType: "module",
}
export default babelConfig

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/legacy/assets/hdi-Ca-ZsNp_.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -26,16 +26,15 @@
"tsconfig.json" "tsconfig.json"
], ],
"scripts": { "scripts": {
"build": "turbo build && run-p lint.root.tsc build.parcel build.vite && run-p build.babel copy.json", "build": "turbo build && run-p lint.root.tsc build.vite build.vite.legacy && run-p copy.json",
"build.parcel": "cross-env NODE_ENV=production parcel build",
"build.vite": "cross-env NODE_ENV=production vite build", "build.vite": "cross-env NODE_ENV=production vite build",
"build.babel": "babel ./dist/legacy --out-dir ./dist/legacy --plugins @upleveled/babel-plugin-remove-node-prefix --plugins @babel/plugin-transform-private-methods --compact --no-babelrc --source-maps true", "build.vite.legacy": "cross-env NODE_ENV=production TARGET=legacy vite build",
"bump": "ncu -u -x numerous,execa,prettier,@types/node,eslint,@types/eslint && pnpm update && pnpx typesync && pnpm run clean", "bump": "ncu -u -x numerous,execa,prettier,@types/node,eslint,@types/eslint && pnpm update && pnpx typesync && pnpm run clean",
"clean": "shx rm -rf ./dist ./packages/*/dist ./exe ./.parcel-cache && shx mkdir -p ./dist/legacy ./dist/modern ./dist/modern ", "clean": "shx rm -rf ./dist ./packages/*/dist ./exe ./.parcel-cache && shx mkdir -p ./dist/legacy ./dist/modern ./dist/modern ",
"copy.json": "shx cp ./src/*/*.json ./dist/legacy/ && shx cp ./dist/legacy/*.json ./dist/modern", "copy.json": "shx cp ./src/*/*.json ./dist/legacy/ && shx cp ./dist/legacy/*.json ./dist/modern",
"dev.parcel": "cross-env NODE_ENV=development parcel watch", "dev.vite": "cross-env NODE_ENV=development vite build --watch",
"dev.packages": "turbo dev", "dev.packages": "turbo dev",
"dev": "run-p dev.packages dev.parcel", "dev": "run-p dev.packages dev.vite",
"docs": "shx rm -rf packages/*/README.md && pnpm -r exec readme --path ../../dev/readme/template.md -y && pnpm -r exec ts-readme", "docs": "shx rm -rf packages/*/README.md && pnpm -r exec readme --path ../../dev/readme/template.md -y && pnpm -r exec ts-readme",
"format": "run-s lint.dprint", "format": "run-s lint.dprint",
"lint": "turbo lint && run-p --aggregate-output --continue-on-error lint.**", "lint": "turbo lint && run-p --aggregate-output --continue-on-error lint.**",
@ -60,8 +59,7 @@
"@actions/http-client": "^2.2.3", "@actions/http-client": "^2.2.3",
"@actions/io": "^1.1.3", "@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1", "@actions/tool-cache": "^2.0.1",
"@babel/cli": "^7.25.6", "@babel/core": "^7.25.2",
"@babel/plugin-transform-private-methods": "^7.25.4",
"@biomejs/biome": "^1.8.3", "@biomejs/biome": "^1.8.3",
"@iarna/toml": "^2.2.5", "@iarna/toml": "^2.2.5",
"@liuli-util/vite-plugin-node": "^0.9.0", "@liuli-util/vite-plugin-node": "^0.9.0",
@ -73,7 +71,9 @@
"@octokit/types": "^13.5.0", "@octokit/types": "^13.5.0",
"@shockpkg/archive-files": "github:aminya/archive-files#54ec59fad46aca736ac6feb6c7bb526528141b9d", "@shockpkg/archive-files": "github:aminya/archive-files#54ec59fad46aca736ac6feb6c7bb526528141b9d",
"@swc/jest": "^0.2.36", "@swc/jest": "^0.2.36",
"@types/babel__core": "~7.20.5",
"@types/cross-spawn": "^6.0.6", "@types/cross-spawn": "^6.0.6",
"@types/escape-quotes": "~1.0.0",
"@types/eslint": "^8.56.12", "@types/eslint": "^8.56.12",
"@types/iarna__toml": "~2.0.5", "@types/iarna__toml": "~2.0.5",
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
@ -112,7 +112,6 @@
"npm-run-all2": "^6.2.2", "npm-run-all2": "^6.2.2",
"numerous": "1.0.3", "numerous": "1.0.3",
"p-timeout": "^6.1.2", "p-timeout": "^6.1.2",
"parcel": "2.12.0",
"path-exists": "^5.0.0", "path-exists": "^5.0.0",
"patha": "^0.4.1", "patha": "^0.4.1",
"prettier": "3.2.2", "prettier": "3.2.2",
@ -138,7 +137,7 @@
"untildify-user": "workspace:*", "untildify-user": "workspace:*",
"util.types": "^0.0.2", "util.types": "^0.0.2",
"vite": "^5.4.3", "vite": "^5.4.3",
"vite-plugin-node": "^3.1.0", "vite-plugin-babel": "^1.2.0",
"web-streams-polyfill": "^4.0.0", "web-streams-polyfill": "^4.0.0",
"which": "^4.0.0" "which": "^4.0.0"
}, },
@ -206,27 +205,6 @@
"ninja", "ninja",
"meson" "meson"
], ],
"alias": {
"electron": false,
"patha": "patha/dist/index.node.mjs",
"admina": "admina/dist/index.mjs",
"fs/promises": "./src/utils/compat/fs/promises.ts",
"stream/promises": "./src/utils/compat/stream/promises.ts",
"stream/web": "web-streams-polyfill/dist/ponyfill.mjs",
"util/types": "util.types/index.js",
"diagnostics_channel": "diagnostics_channel/index.js"
},
"targets": {
"main": {
"context": "node",
"engines": {
"node": ">=12.x"
},
"includeNodeModules": true,
"optimize": true,
"outputFormat": "commonjs"
}
},
"pnpm": { "pnpm": {
"patchedDependencies": { "patchedDependencies": {
"@actions/http-client@2.2.3": "patches/@actions__http-client@2.2.3.patch" "@actions/http-client@2.2.3": "patches/@actions__http-client@2.2.3.patch"

View File

@ -46,6 +46,7 @@
"macos" "macos"
], ],
"devDependencies": { "devDependencies": {
"@types/escape-quotes": "~1.0.0",
"@types/memoizee": "0.4.11" "@types/memoizee": "0.4.11"
} }
} }

View File

@ -1,17 +0,0 @@
declare module "escape-quotes" {
/**
* Escape `'` with `\\`
* @param input the input string
*/
declare function escapeQuote(input: string): string
/**
* Escape the given character with the given escape character
* @param input the input string
* @param character the character to escape (e.g. `'`)
* @param escape_character the character to escape with (e.g. `\\`)
*/
declare function escapeQuote(input: string, character: string, escape_character: string): string
export = escapeQuote
}

View File

@ -50,6 +50,7 @@
"apt-key" "apt-key"
], ],
"devDependencies": { "devDependencies": {
"@types/memoizee": "0.4.11" "@types/memoizee": "0.4.11",
"@types/which": "~3.0.4"
} }
} }

View File

@ -27,9 +27,11 @@
"node-downloader-helper": "2.1.9" "node-downloader-helper": "2.1.9"
}, },
"devDependencies": { "devDependencies": {
"@types/cross-spawn": "~6.0.6",
"@types/which": "~3.0.4",
"cross-spawn": "7.0.3",
"path-exists": "5.0.0", "path-exists": "5.0.0",
"patha": "0.4.1", "patha": "0.4.1"
"cross-spawn": "7.0.3"
}, },
"engines": { "engines": {
"node": ">=12" "node": ">=12"

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
import { dirname } from "path"
import { addPath } from "envosman" import { addPath } from "envosman"
import { execaSync } from "execa" import { execaSync } from "execa"
import { pathExists } from "path-exists" import { pathExists } from "path-exists"
import { dirname } from "patha"
import which from "which" import which from "which"
import { rcOptions } from "../cli-options.js" import { rcOptions } from "../cli-options.js"
import type { InstallationInfo } from "../utils/setup/setupBin.js" import type { InstallationInfo } from "../utils/setup/setupBin.js"

View File

@ -1,6 +1,7 @@
import { join } from "path"
import { info, notice } from "ci-log" import { info, notice } from "ci-log"
import { addPath } from "envosman" import { addPath } from "envosman"
import { addExeExt, join } from "patha" import { addExeExt } from "patha"
import { installAptPack } from "setup-apt" import { installAptPack } from "setup-apt"
import { installBrewPack } from "setup-brew" import { installBrewPack } from "setup-brew"
import { setupGraphviz } from "../graphviz/graphviz.js" import { setupGraphviz } from "../graphviz/graphviz.js"

View File

@ -1,8 +1,8 @@
import path from "path" import path, { join } from "path"
import { fileURLToPath } from "url" import { fileURLToPath } from "url"
import { execaSync } from "execa" import { execaSync } from "execa"
import { chmod } from "fs/promises" import { chmod } from "fs/promises"
import { addExeExt, join } from "patha" import { addExeExt } from "patha"
import { isUbuntu } from "../../utils/env/isUbuntu.js" import { isUbuntu } from "../../utils/env/isUbuntu.js"
import { ubuntuVersion } from "../../utils/env/ubuntu_version.js" import { ubuntuVersion } from "../../utils/env/ubuntu_version.js"
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers.js" import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers.js"

View File

@ -5,7 +5,12 @@ import { saveGitHubAssetList } from "../utils/github/fetch-assets.ts"
*/ */
async function main() { async function main() {
// https://github.com/brechtsanders/winlibs_mingw/releases // https://github.com/brechtsanders/winlibs_mingw/releases
await saveGitHubAssetList("brechtsanders", "winlibs_mingw", "./src/gcc/github_brechtsanders_winlibs_mingw.json") await saveGitHubAssetList(
"brechtsanders",
"winlibs_mingw",
"./src/gcc/github_brechtsanders_winlibs_mingw.json",
(asset) => asset.endsWith(".7z"),
)
} }
main().catch((err) => { main().catch((err) => {

View File

@ -1,4 +1,4 @@
import path from "path" import path, { join } from "path"
import { fileURLToPath } from "url" import { fileURLToPath } from "url"
import { GITHUB_ACTIONS } from "ci-info" import { GITHUB_ACTIONS } from "ci-info"
import { error, info, warning } from "ci-log" import { error, info, warning } from "ci-log"
@ -6,7 +6,7 @@ import { addEnv, addPath } from "envosman"
import { type ExecaReturnValue, execa } from "execa" import { type ExecaReturnValue, execa } from "execa"
import { readdir } from "fs/promises" import { readdir } from "fs/promises"
import { pathExists } from "path-exists" import { pathExists } from "path-exists"
import { addExeExt, join } from "patha" import { addExeExt } from "patha"
import semverCoerce from "semver/functions/coerce" import semverCoerce from "semver/functions/coerce"
import semverMajor from "semver/functions/major" import semverMajor from "semver/functions/major"
import { addUpdateAlternativesToRc, installAptPack } from "setup-apt" import { addUpdateAlternativesToRc, installAptPack } from "setup-apt"
@ -41,7 +41,6 @@ async function getGccPackageInfo(version: string, platform: NodeJS.Platform, arc
: arch === "ia32" : arch === "ia32"
? "i386" ? "i386"
: arch, : arch,
filterName: (name) => name.endsWith(".7z"),
}, },
) )

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
import { join } from "path"
import { endGroup, startGroup } from "@actions/core" import { endGroup, startGroup } from "@actions/core"
import { error } from "ci-log" import { error } from "ci-log"
import pTimeout from "p-timeout" import pTimeout from "p-timeout"
import { join } from "patha"
import { setupBrew } from "setup-brew" import { setupBrew } from "setup-brew"
import { getSuccessMessage, rcOptions } from "./cli-options.js" import { getSuccessMessage, rcOptions } from "./cli-options.js"
import { type ToolName, setups } from "./tool.js" import { type ToolName, setups } from "./tool.js"

View File

@ -1,8 +1,8 @@
import path from "path" import path, { join } from "path"
import { fileURLToPath } from "url" import { fileURLToPath } from "url"
import { info } from "ci-log" import { info } from "ci-log"
import { execa } from "execa" import { execa } from "execa"
import { addExeExt, join } from "patha" import { addExeExt } from "patha"
import { installAptPack } from "setup-apt" import { installAptPack } from "setup-apt"
import { untildifyUser } from "untildify-user" import { untildifyUser } from "untildify-user"
import which from "which" import which from "which"

View File

@ -1,10 +1,10 @@
import path from "path" import path, { join } from "path"
import { fileURLToPath } from "url" import { fileURLToPath } from "url"
import * as io from "@actions/io" import * as io from "@actions/io"
import { execaSync } from "execa" import { execaSync } from "execa"
import { chmod } from "fs/promises" import { chmod } from "fs/promises"
import { isUrlOnline } from "is-url-online" import { isUrlOnline } from "is-url-online"
import { addExeExt, join } from "patha" import { addExeExt } from "patha"
import { ubuntuVersion } from "../../utils/env/ubuntu_version.js" import { ubuntuVersion } from "../../utils/env/ubuntu_version.js"
import { getSpecificVersionAndUrl } from "../../utils/setup/version.js" import { getSpecificVersionAndUrl } from "../../utils/setup/version.js"
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers.js" import { setupTmpDir, testBin } from "../../utils/tests/test-helpers.js"

View File

@ -1,11 +1,11 @@
import path, { delimiter } from "path" import path, { delimiter, join } from "path"
import { fileURLToPath } from "url" import { fileURLToPath } from "url"
import { GITHUB_ACTIONS } from "ci-info" import { GITHUB_ACTIONS } from "ci-info"
import { info, warning } from "ci-log" import { info, warning } from "ci-log"
import { addEnv } from "envosman" import { addEnv } from "envosman"
import memoize from "memoizee" import memoize from "memoizee"
import { pathExists } from "path-exists" import { pathExists } from "path-exists"
import { addExeExt, join } from "patha" import { addExeExt } from "patha"
import { addUpdateAlternativesToRc, installAptPack } from "setup-apt" import { addUpdateAlternativesToRc, installAptPack } from "setup-apt"
import { rcOptions } from "../cli-options.js" import { rcOptions } from "../cli-options.js"
import { setupGcc } from "../gcc/gcc.js" import { setupGcc } from "../gcc/gcc.js"

View File

@ -1,4 +1,4 @@
import path from "path" import path, { join } from "path"
import { fileURLToPath } from "url" import { fileURLToPath } from "url"
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
@ -6,7 +6,6 @@ import { GITHUB_ACTIONS } from "ci-info"
import { error, info, warning } from "ci-log" import { error, info, warning } from "ci-log"
import { findVcvarsall, vsversion_to_versionnumber } from "msvc-dev-cmd/lib.js" import { findVcvarsall, vsversion_to_versionnumber } from "msvc-dev-cmd/lib.js"
import { pathExists } from "path-exists" import { pathExists } from "path-exists"
import { join } from "patha"
import { setupChocoPack } from "../utils/setup/setupChocoPack.js" import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
import { setupVCVarsall } from "../vcvarsall/vcvarsall.js" import { setupVCVarsall } from "../vcvarsall/vcvarsall.js"

View File

@ -1,9 +1,9 @@
import { tmpdir } from "os" import { tmpdir } from "os"
import { dirname, join } from "path"
import { execRootSync } from "admina" import { execRootSync } from "admina"
import { error, info } from "ci-log" import { error, info } from "ci-log"
import { readFile, writeFile } from "fs/promises" import { readFile, writeFile } from "fs/promises"
import { DownloaderHelper } from "node-downloader-helper" import { DownloaderHelper } from "node-downloader-helper"
import { dirname, join } from "patha"
import { hasNala, installAptPack, qualifiedNeededAptPackage } from "setup-apt" import { hasNala, installAptPack, qualifiedNeededAptPackage } from "setup-apt"
import which from "which" import which from "which"
import { isUbuntu } from "../utils/env/isUbuntu.js" import { isUbuntu } from "../utils/env/isUbuntu.js"

View File

@ -1,10 +1,9 @@
import path from "path" import path, { join } from "path"
import { fileURLToPath } from "url" import { fileURLToPath } from "url"
import { debug } from "@actions/core" import { debug } from "@actions/core"
import { GITHUB_ACTIONS } from "ci-info" import { GITHUB_ACTIONS } from "ci-info"
import { info, warning } from "ci-log" import { info, warning } from "ci-log"
import { pathExists } from "path-exists" import { pathExists } from "path-exists"
import { join } from "patha"
import { findPyPyVersion } from "setup-python/src/find-pypy.js" import { findPyPyVersion } from "setup-python/src/find-pypy.js"
import { useCpythonVersion } from "setup-python/src/find-python.js" import { useCpythonVersion } from "setup-python/src/find-python.js"
import { IS_MAC } from "setup-python/src/utils.js" import { IS_MAC } from "setup-python/src/utils.js"

View File

@ -1,6 +1,6 @@
import assert from "assert" import assert from "assert"
import { homedir } from "os" import { homedir } from "os"
import { parse as pathParse } from "path" import { dirname, join, parse as pathParse } from "path"
import { getExecOutput } from "@actions/exec" import { getExecOutput } from "@actions/exec"
import { GITHUB_ACTIONS } from "ci-info" import { GITHUB_ACTIONS } from "ci-info"
import { info, warning } from "ci-log" import { info, warning } from "ci-log"
@ -9,7 +9,7 @@ import { execa } from "execa"
import { readdir } from "fs/promises" import { readdir } from "fs/promises"
import memoize from "memoizee" import memoize from "memoizee"
import { pathExists } from "path-exists" import { pathExists } from "path-exists"
import { addExeExt, dirname, join } from "patha" import { addExeExt } from "patha"
import { installAptPack } from "setup-apt" import { installAptPack } from "setup-apt"
import { installBrewPack } from "setup-brew" import { installBrewPack } from "setup-brew"
import which from "which" import which from "which"

View File

@ -11,7 +11,12 @@ import type { Assets } from "./load-assets.ts"
* @param prerelease Whether to include prereleases * @param prerelease Whether to include prereleases
*/ */
async function fetchGitHubAssetList(owner: string, repo: string, prerelease = false) { async function fetchGitHubAssetList(
owner: string,
repo: string,
filterAssets?: (asset: string) => boolean,
prerelease = false,
) {
const octokit = new Octokit({ const octokit = new Octokit({
auth: process.env.GITHUB_TOKEN, auth: process.env.GITHUB_TOKEN,
}) })
@ -47,7 +52,11 @@ async function fetchGitHubAssetList(owner: string, repo: string, prerelease = fa
} }
const assets_ref = assets[release.tag_name] const assets_ref = assets[release.tag_name]
for (const asset of release.assets) { for (const asset of release.assets) {
if (filterAssets !== undefined && !filterAssets(asset.name)) {
continue
}
assets_ref.push(asset.name) assets_ref.push(asset.name)
} }
} }
@ -67,8 +76,9 @@ export async function saveGitHubAssetList(
owner: string, owner: string,
repo: string, repo: string,
path: string, path: string,
filterAssets?: (asset: string) => boolean,
) { ) {
const assets = await fetchGitHubAssetList(owner, repo) const assets = await fetchGitHubAssetList(owner, repo, filterAssets, false)
const jsonStringify = JsonStringify.configure({ const jsonStringify = JsonStringify.configure({
deterministic: compareVersion, deterministic: compareVersion,

View File

@ -1,12 +1,11 @@
import { tmpdir } from "os" import { tmpdir } from "os"
import { basename } from "path" import { basename, join } from "path"
import { cacheDir, downloadTool, find } from "@actions/tool-cache" import { cacheDir, downloadTool, find } from "@actions/tool-cache"
import { GITHUB_ACTIONS } from "ci-info" import { GITHUB_ACTIONS } from "ci-info"
import { info, warning } from "ci-log" import { info, warning } from "ci-log"
import { addPath } from "envosman" import { addPath } from "envosman"
import { chmod } from "fs/promises" import { chmod } from "fs/promises"
import { pathExists } from "path-exists" import { pathExists } from "path-exists"
import { join } from "patha"
import retry from "retry-as-promised" import retry from "retry-as-promised"
import { maybeGetInput, rcOptions } from "../../cli-options.js" import { maybeGetInput, rcOptions } from "../../cli-options.js"
import { getArchiveType, getExtractFunction } from "./extract.js" import { getArchiveType, getExtractFunction } from "./extract.js"

View File

@ -1,10 +1,11 @@
import { dirname, join } from "path"
import { info } from "@actions/core" import { info } from "@actions/core"
import { addPath } from "envosman" import { addPath } from "envosman"
import { execa, execaSync } from "execa" import { execa, execaSync } from "execa"
import memoize from "memoizee" import memoize from "memoizee"
import { mkdirp } from "mkdirp" import { mkdirp } from "mkdirp"
import { pathExists } from "path-exists" import { pathExists } from "path-exists"
import { addExeExt, dirname, join } from "patha" import { addExeExt } from "patha"
import { installAptPack } from "setup-apt" import { installAptPack } from "setup-apt"
import { untildifyUser } from "untildify-user" import { untildifyUser } from "untildify-user"
import which from "which" import which from "which"

View File

@ -1,8 +1,9 @@
import { tmpdir } from "os" import { tmpdir } from "os"
import * as path from "path"
import { join } from "path"
import * as io from "@actions/io" import * as io from "@actions/io"
import spawn from "cross-spawn" import spawn from "cross-spawn"
import * as path from "patha" import { addExeExt } from "patha"
import { addExeExt, join } from "patha"
import { pathExists } from "path-exists" import { pathExists } from "path-exists"

View File

@ -1,9 +1,10 @@
import { dirname, join } from "path"
import { grantUserWriteAccess } from "admina" import { grantUserWriteAccess } from "admina"
import { info, notice } from "ci-log" import { info, notice } from "ci-log"
import { addPath } from "envosman" import { addPath } from "envosman"
import { execaSync } from "execa" import { execaSync } from "execa"
import { pathExists } from "path-exists" import { pathExists } from "path-exists"
import { addShExt, addShRelativePrefix, dirname, join } from "patha" import { addShExt, addShRelativePrefix } from "patha"
import { installAptPack } from "setup-apt" import { installAptPack } from "setup-apt"
import which from "which" import which from "which"
import { rcOptions } from "../cli-options.js" import { rcOptions } from "../cli-options.js"

View File

@ -1,21 +1,52 @@
import module from "module" import module from "module"
import { type TerserOptions, defineConfig } from "vite" import { type TerserOptions, defineConfig } from "vite"
import babel from "vite-plugin-babel"
import terserRc from "./.terserrc.mjs" import terserRc from "./.terserrc.mjs"
import babelConfig from "./babel.config.mts"
const isLegacy = process.env.TARGET === "legacy"
const viteConfig = defineConfig({ const viteConfig = defineConfig({
build: { build: {
ssr: "./src/setup-cpp.ts", ssr: "./src/setup-cpp.ts",
outDir: "./dist/modern", outDir: isLegacy ? "./dist/legacy" : "./dist/modern",
target: "node20", target: isLegacy ? "node12" : "node20",
minify: "terser", minify: "terser",
terserOptions: terserRc as TerserOptions, terserOptions: terserRc as TerserOptions,
sourcemap: true, sourcemap: true,
rollupOptions: {
output: {
format: isLegacy
? "cjs"
: "es",
},
},
},
resolve: {
alias: {
...(isLegacy
? {
"fs/promises": "./src/utils/compat/fs/promises.ts",
"stream/promises": "./src/utils/compat/stream/promises.ts",
"stream/web": "web-streams-polyfill/dist/ponyfill.mjs",
"util/types": "util.types/index.js",
diagnostics_channel: "diagnostics_channel/index.js",
}
: {}),
},
}, },
ssr: { ssr: {
target: "node", target: "node",
noExternal: true, noExternal: true,
external: module.builtinModules, external: module.builtinModules,
}, },
plugins: isLegacy
? [
babel({
babelConfig,
}),
]
: [],
}) })
export default viteConfig export default viteConfig