fix: improve compatibility with Node 12

This commit is contained in:
Amin Yahyaabadi 2024-02-17 02:00:18 -08:00
parent 99a1254616
commit 36d895f6c6
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
25 changed files with 99 additions and 71 deletions

2
dist/actions/hdi.89f0ed6f.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/actions/hdi.89f0ed6f.js.map 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

2
dist/legacy/hdi.069dd8f5.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/legacy/hdi.069dd8f5.js.map 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

2
dist/modern/hdi.9d60a332.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/modern/hdi.9d60a332.js.map 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

View File

@ -31,7 +31,7 @@
"build": "run-s clean build.packages && run-p lint.tsc build.parcel copy.matchers",
"build.packages": "pnpm run -r build",
"build.parcel": "cross-env NODE_ENV=production parcel build && babel ./dist --out-dir dist --plugins @upleveled/babel-plugin-remove-node-prefix --compact --no-babelrc --source-maps true",
"bump": "ncu -u -x numerous,execa,prettier && pnpm update",
"bump": "ncu -u -x numerous,execa,prettier,@types/node && pnpm update",
"clean": "shx rm -rf ./dist ./exe ./packages/*/dist/ && shx mkdir -p ./dist/legacy ./dist/actions ./dist/modern ",
"copy.matchers": "run-p copy.matchers.legacy copy.matchers.actions copy.matchers.modern",
"copy.matchers.legacy": "shx cp ./src/gcc/gcc_matcher.json ./dist/legacy/ && shx cp ./src/msvc/msvc_matcher.json ./dist/legacy/ && shx cp ./src/python/python_matcher.json ./dist/legacy/ && shx cp ./src/llvm/llvm_matcher.json ./dist/legacy/",
@ -82,7 +82,7 @@
"@types/eslint": "^8.56.2",
"@types/jest": "^29.5.12",
"@types/mri": "^1.1.5",
"@types/node": "^20.11.19",
"@types/node": "^12",
"@types/prettier": "2.7.3",
"@types/semver": "^7.5.7",
"@types/which": "^3.0.3",

View File

@ -42,8 +42,8 @@ importers:
specifier: ^1.1.5
version: 1.1.5
'@types/node':
specifier: ^20.11.19
version: 20.11.19
specifier: ^12
version: 12.20.55
'@types/prettier':
specifier: 2.7.3
version: 2.7.3
@ -103,7 +103,7 @@ importers:
version: 1.5.0
jest:
specifier: ^29.7.0
version: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2)
version: 29.7.0(@types/node@12.20.55)(ts-node@10.9.2)
macos-release:
specifier: ^3.2.0
version: 3.2.0
@ -172,7 +172,7 @@ importers:
version: github.com/aminya/time-delta/69d91a41cef28e569be9a2991129f5f7d1f0d00e
ts-node:
specifier: ^10.9.2
version: 10.9.2(@swc/core@1.4.1)(@types/node@20.11.19)(typescript@5.3.3)
version: 10.9.2(@swc/core@1.4.1)(@types/node@12.20.55)(typescript@5.3.3)
ts-readme:
specifier: ^1.1.3
version: 1.1.3(typescript@5.3.3)
@ -1231,7 +1231,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@jest/types': 29.6.3
'@types/node': 20.11.19
'@types/node': 12.20.55
chalk: 4.1.2
jest-message-util: 29.7.0
jest-util: 29.7.0
@ -1252,14 +1252,14 @@ packages:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.19
'@types/node': 12.20.55
ansi-escapes: 4.3.2
chalk: 4.1.2
ci-info: 3.9.0
exit: 0.1.2
graceful-fs: 4.2.11
jest-changed-files: 29.7.0
jest-config: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2)
jest-config: 29.7.0(@types/node@12.20.55)(ts-node@10.9.2)
jest-haste-map: 29.7.0
jest-message-util: 29.7.0
jest-regex-util: 29.6.3
@ -1294,7 +1294,7 @@ packages:
dependencies:
'@jest/fake-timers': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.19
'@types/node': 12.20.55
jest-mock: 29.7.0
dev: true
@ -1321,7 +1321,7 @@ packages:
dependencies:
'@jest/types': 29.6.3
'@sinonjs/fake-timers': 10.3.0
'@types/node': 20.11.19
'@types/node': 12.20.55
jest-message-util: 29.7.0
jest-mock: 29.7.0
jest-util: 29.7.0
@ -1354,7 +1354,7 @@ packages:
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@jridgewell/trace-mapping': 0.3.22
'@types/node': 20.11.19
'@types/node': 12.20.55
chalk: 4.1.2
collect-v8-coverage: 1.0.2
exit: 0.1.2
@ -1442,7 +1442,7 @@ packages:
'@jest/schemas': 29.6.3
'@types/istanbul-lib-coverage': 2.0.6
'@types/istanbul-reports': 3.0.4
'@types/node': 20.11.19
'@types/node': 12.20.55
'@types/yargs': 17.0.32
chalk: 4.1.2
dev: true
@ -2857,7 +2857,7 @@ packages:
/@types/cross-spawn@6.0.6:
resolution: {integrity: sha512-fXRhhUkG4H3TQk5dBhQ7m/JDdSNHKwR2BBia62lhwEIq9xGiQKLxd6LymNhn47SjXhsUEPmxi+PKw2OkW4LLjA==}
dependencies:
'@types/node': 20.11.19
'@types/node': 12.20.55
dev: true
/@types/debug@4.1.12:
@ -2881,13 +2881,13 @@ packages:
resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==}
dependencies:
'@types/minimatch': 5.1.2
'@types/node': 20.11.19
'@types/node': 12.20.55
dev: true
/@types/graceful-fs@4.1.9:
resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==}
dependencies:
'@types/node': 20.11.19
'@types/node': 12.20.55
dev: true
/@types/http-cache-semantics@4.0.4:
@ -2946,10 +2946,14 @@ packages:
/@types/node-fetch@2.6.11:
resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==}
dependencies:
'@types/node': 20.11.19
'@types/node': 12.20.55
form-data: 4.0.0
dev: true
/@types/node@12.20.55:
resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==}
dev: true
/@types/node@18.19.17:
resolution: {integrity: sha512-SzyGKgwPzuWp2SHhlpXKzCX0pIOfcI4V2eF37nNBJOhwlegQ83omtVQ1XxZpDE06V/d6AQvfQdPfnw0tRC//Ng==}
requiresBuild: true
@ -2958,12 +2962,6 @@ packages:
dev: true
optional: true
/@types/node@20.11.19:
resolution: {integrity: sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==}
dependencies:
undici-types: 5.26.5
dev: true
/@types/normalize-package-data@2.4.4:
resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==}
dev: true
@ -2989,7 +2987,7 @@ packages:
/@types/tunnel@0.0.3:
resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==}
dependencies:
'@types/node': 20.11.19
'@types/node': 12.20.55
dev: true
/@types/unist@3.0.2:
@ -4347,7 +4345,7 @@ packages:
readable-stream: 3.6.2
dev: true
/create-jest@29.7.0(@types/node@20.11.19)(ts-node@10.9.2):
/create-jest@29.7.0(@types/node@12.20.55)(ts-node@10.9.2):
resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
@ -4356,7 +4354,7 @@ packages:
chalk: 4.1.2
exit: 0.1.2
graceful-fs: 4.2.11
jest-config: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2)
jest-config: 29.7.0(@types/node@12.20.55)(ts-node@10.9.2)
jest-util: 29.7.0
prompts: 2.4.2
transitivePeerDependencies:
@ -6984,7 +6982,7 @@ packages:
'@jest/expect': 29.7.0
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.19
'@types/node': 12.20.55
chalk: 4.1.2
co: 4.6.0
dedent: 1.5.1
@ -7005,7 +7003,7 @@ packages:
- supports-color
dev: true
/jest-cli@29.7.0(@types/node@20.11.19)(ts-node@10.9.2):
/jest-cli@29.7.0(@types/node@12.20.55)(ts-node@10.9.2):
resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
@ -7019,10 +7017,10 @@ packages:
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
chalk: 4.1.2
create-jest: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2)
create-jest: 29.7.0(@types/node@12.20.55)(ts-node@10.9.2)
exit: 0.1.2
import-local: 3.1.0
jest-config: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2)
jest-config: 29.7.0(@types/node@12.20.55)(ts-node@10.9.2)
jest-util: 29.7.0
jest-validate: 29.7.0
yargs: 17.7.2
@ -7033,7 +7031,7 @@ packages:
- ts-node
dev: true
/jest-config@29.7.0(@types/node@20.11.19)(ts-node@10.9.2):
/jest-config@29.7.0(@types/node@12.20.55)(ts-node@10.9.2):
resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
peerDependencies:
@ -7048,7 +7046,7 @@ packages:
'@babel/core': 7.23.9
'@jest/test-sequencer': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.19
'@types/node': 12.20.55
babel-jest: 29.7.0(@babel/core@7.23.9)
chalk: 4.1.2
ci-info: 3.9.0
@ -7068,7 +7066,7 @@ packages:
pretty-format: 29.7.0
slash: 3.0.0
strip-json-comments: 3.1.1
ts-node: 10.9.2(@swc/core@1.4.1)(@types/node@20.11.19)(typescript@5.3.3)
ts-node: 10.9.2(@swc/core@1.4.1)(@types/node@12.20.55)(typescript@5.3.3)
transitivePeerDependencies:
- babel-plugin-macros
- supports-color
@ -7109,7 +7107,7 @@ packages:
'@jest/environment': 29.7.0
'@jest/fake-timers': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.19
'@types/node': 12.20.55
jest-mock: 29.7.0
jest-util: 29.7.0
dev: true
@ -7125,7 +7123,7 @@ packages:
dependencies:
'@jest/types': 29.6.3
'@types/graceful-fs': 4.1.9
'@types/node': 20.11.19
'@types/node': 12.20.55
anymatch: 3.1.3
fb-watchman: 2.0.2
graceful-fs: 4.2.11
@ -7176,7 +7174,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@jest/types': 29.6.3
'@types/node': 20.11.19
'@types/node': 12.20.55
jest-util: 29.7.0
dev: true
@ -7231,7 +7229,7 @@ packages:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.19
'@types/node': 12.20.55
chalk: 4.1.2
emittery: 0.13.1
graceful-fs: 4.2.11
@ -7262,7 +7260,7 @@ packages:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.19
'@types/node': 12.20.55
chalk: 4.1.2
cjs-module-lexer: 1.2.3
collect-v8-coverage: 1.0.2
@ -7314,7 +7312,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@jest/types': 29.6.3
'@types/node': 20.11.19
'@types/node': 12.20.55
chalk: 4.1.2
ci-info: 3.9.0
graceful-fs: 4.2.11
@ -7339,7 +7337,7 @@ packages:
dependencies:
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.19
'@types/node': 12.20.55
ansi-escapes: 4.3.2
chalk: 4.1.2
emittery: 0.13.1
@ -7351,13 +7349,13 @@ packages:
resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@types/node': 20.11.19
'@types/node': 12.20.55
jest-util: 29.7.0
merge-stream: 2.0.0
supports-color: 8.1.1
dev: true
/jest@29.7.0(@types/node@20.11.19)(ts-node@10.9.2):
/jest@29.7.0(@types/node@12.20.55)(ts-node@10.9.2):
resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
@ -7370,7 +7368,7 @@ packages:
'@jest/core': 29.7.0(ts-node@10.9.2)
'@jest/types': 29.6.3
import-local: 3.1.0
jest-cli: 29.7.0(@types/node@20.11.19)(ts-node@10.9.2)
jest-cli: 29.7.0(@types/node@12.20.55)(ts-node@10.9.2)
transitivePeerDependencies:
- '@types/node'
- babel-plugin-macros
@ -10176,7 +10174,7 @@ packages:
typescript: 5.3.3
dev: true
/ts-node@10.9.2(@swc/core@1.4.1)(@types/node@20.11.19)(typescript@5.3.3):
/ts-node@10.9.2(@swc/core@1.4.1)(@types/node@12.20.55)(typescript@5.3.3):
resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==}
hasBin: true
peerDependencies:
@ -10196,7 +10194,7 @@ packages:
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
'@types/node': 20.11.19
'@types/node': 12.20.55
acorn: 8.11.3
acorn-walk: 8.3.2
arg: 4.1.3
@ -10403,7 +10401,9 @@ packages:
/undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
requiresBuild: true
dev: true
optional: true
/undici@5.28.3:
resolution: {integrity: sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==}

View File

@ -1,5 +1,5 @@
import { promises } from "fs"
export default promises
import * as fs from "fs"
export default fs.promises
export const {
access,
@ -26,5 +26,14 @@ export const {
unlink,
utimes,
writeFile,
rm,
} = promises
} = fs.promises
import { promisify } from "util"
export const rm =
"rm" in fs.promises
? (
fs.promises as typeof fs.promises & {
rm: (path: string, options?: fs.RmDirOptions) => Promise<void>
}
).rm
: promisify(fs.unlink)

View File

@ -1,4 +1,15 @@
import { promises } from "stream"
export default promises
/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
export const { finished, pipeline } = promises
import * as stream from "stream"
import { promisify } from "util"
export const pipeline =
"promises" in stream && "pipeline" in (stream as any).promises
? ((stream.promises as any).pipeline as Function)
: promisify(stream.pipeline)
export const finished =
"promises" in stream && "finished" in (stream as any).promises
? ((stream.promises as any).finished as Function)
: promisify(stream.finished)

View File

@ -38,6 +38,10 @@ export const ubuntuVersion = memoize(ubuntuVersion_raw, { isPromise: true })
/** Detect Ubuntu version using os.version() for Ubuntu based distros */
function detectUsingOsVersion() {
if (!("version" in os && typeof os.version === "function")) {
return null
}
// #46~22.04.1-Ubuntu SMP ...
const osVersion = os.version()
const versionSplitted = osVersion.split(".")

View File

@ -235,6 +235,9 @@ export async function isPackageInstalled(regexp: string) {
try {
// check if a package matching the regexp is installed
const { stdout } = await execa("dpkg", ["-l", regexp])
if (typeof stdout !== "string") {
return false
}
const lines = stdout.split("\n")
// check if the output contains any lines that start with "ii"
return lines.some((line) => line.startsWith("ii"))

View File

@ -17,7 +17,8 @@
"preserveSymlinks": true,
"removeComments": false,
"skipLibCheck": true,
"lib": ["ES2020", "dom"],
// target Node.js 12 https://node.green/#ES2019
"lib": ["ES2019", "dom"],
"target": "ESNext",
"allowJs": true,
"esModuleInterop": true,