@metamask-previews/local-node-utils 1.0.0-preview-8bfa290fb → 2.0.0-preview-97d6b86c0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/dist/{archive.d.mts → archive.d.ts} +1 -1
- package/dist/archive.d.ts.map +1 -0
- package/dist/{archive.mjs → archive.js} +2 -2
- package/dist/archive.js.map +1 -0
- package/dist/{artifact.d.cts → artifact.d.ts} +2 -2
- package/dist/artifact.d.ts.map +1 -0
- package/dist/{artifact.mjs → artifact.js} +2 -2
- package/dist/artifact.js.map +1 -0
- package/dist/{cache-directory.d.cts → cache-directory.d.ts} +1 -1
- package/dist/cache-directory.d.ts.map +1 -0
- package/dist/{cache-directory.mjs → cache-directory.js} +6 -6
- package/dist/cache-directory.js.map +1 -0
- package/dist/{cache.d.cts → cache.d.ts} +1 -1
- package/dist/cache.d.ts.map +1 -0
- package/dist/{cache.mjs → cache.js} +3 -3
- package/dist/cache.js.map +1 -0
- package/dist/{checksum.d.cts → checksum.d.ts} +1 -1
- package/dist/checksum.d.ts.map +1 -0
- package/dist/{checksum.mjs → checksum.js} +4 -4
- package/dist/checksum.js.map +1 -0
- package/dist/{cli.d.cts → cli.d.ts} +1 -1
- package/dist/cli.d.ts.map +1 -0
- package/dist/{cli.mjs → cli.js} +1 -1
- package/dist/cli.js.map +1 -0
- package/dist/{command.d.cts → command.d.ts} +1 -1
- package/dist/command.d.ts.map +1 -0
- package/dist/{command.mjs → command.js} +2 -2
- package/dist/command.js.map +1 -0
- package/dist/{download.d.cts → download.d.ts} +1 -1
- package/dist/download.d.ts.map +1 -0
- package/dist/{download.mjs → download.js} +7 -7
- package/dist/download.js.map +1 -0
- package/dist/{errors.d.cts → errors.d.ts} +1 -1
- package/dist/errors.d.ts.map +1 -0
- package/dist/{errors.mjs → errors.js} +1 -1
- package/dist/errors.js.map +1 -0
- package/dist/{executable-wrapper.d.cts → executable-wrapper.d.ts} +1 -1
- package/dist/executable-wrapper.d.ts.map +1 -0
- package/dist/{executable-wrapper.mjs → executable-wrapper.js} +4 -4
- package/dist/executable-wrapper.js.map +1 -0
- package/dist/{filesystem.d.cts → filesystem.d.ts} +1 -1
- package/dist/filesystem.d.ts.map +1 -0
- package/dist/{filesystem.mjs → filesystem.js} +3 -3
- package/dist/filesystem.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/{package-json.d.cts → package-json.d.ts} +1 -1
- package/dist/package-json.d.ts.map +1 -0
- package/dist/{package-json.mjs → package-json.js} +4 -4
- package/dist/package-json.js.map +1 -0
- package/dist/{platform.d.cts → platform.d.ts} +1 -1
- package/dist/platform.d.ts.map +1 -0
- package/dist/{platform.mjs → platform.js} +3 -3
- package/dist/platform.js.map +1 -0
- package/dist/{types.d.cts → types.d.ts} +1 -1
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +12 -16
- package/dist/archive.cjs +0 -13
- package/dist/archive.cjs.map +0 -1
- package/dist/archive.d.cts +0 -3
- package/dist/archive.d.cts.map +0 -1
- package/dist/archive.d.mts.map +0 -1
- package/dist/archive.mjs.map +0 -1
- package/dist/artifact.cjs +0 -40
- package/dist/artifact.cjs.map +0 -1
- package/dist/artifact.d.cts.map +0 -1
- package/dist/artifact.d.mts +0 -6
- package/dist/artifact.d.mts.map +0 -1
- package/dist/artifact.mjs.map +0 -1
- package/dist/cache-directory.cjs +0 -28
- package/dist/cache-directory.cjs.map +0 -1
- package/dist/cache-directory.d.cts.map +0 -1
- package/dist/cache-directory.d.mts +0 -6
- package/dist/cache-directory.d.mts.map +0 -1
- package/dist/cache-directory.mjs.map +0 -1
- package/dist/cache.cjs +0 -14
- package/dist/cache.cjs.map +0 -1
- package/dist/cache.d.cts.map +0 -1
- package/dist/cache.d.mts +0 -5
- package/dist/cache.d.mts.map +0 -1
- package/dist/cache.mjs.map +0 -1
- package/dist/checksum.cjs +0 -17
- package/dist/checksum.cjs.map +0 -1
- package/dist/checksum.d.cts.map +0 -1
- package/dist/checksum.d.mts +0 -2
- package/dist/checksum.d.mts.map +0 -1
- package/dist/checksum.mjs.map +0 -1
- package/dist/cli.cjs +0 -11
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.d.cts.map +0 -1
- package/dist/cli.d.mts +0 -2
- package/dist/cli.d.mts.map +0 -1
- package/dist/cli.mjs.map +0 -1
- package/dist/command.cjs +0 -28
- package/dist/command.cjs.map +0 -1
- package/dist/command.d.cts.map +0 -1
- package/dist/command.d.mts +0 -2
- package/dist/command.d.mts.map +0 -1
- package/dist/command.mjs.map +0 -1
- package/dist/download.cjs +0 -47
- package/dist/download.cjs.map +0 -1
- package/dist/download.d.cts.map +0 -1
- package/dist/download.d.mts +0 -3
- package/dist/download.d.mts.map +0 -1
- package/dist/download.mjs.map +0 -1
- package/dist/errors.cjs +0 -11
- package/dist/errors.cjs.map +0 -1
- package/dist/errors.d.cts.map +0 -1
- package/dist/errors.d.mts +0 -2
- package/dist/errors.d.mts.map +0 -1
- package/dist/errors.mjs.map +0 -1
- package/dist/executable-wrapper.cjs +0 -76
- package/dist/executable-wrapper.cjs.map +0 -1
- package/dist/executable-wrapper.d.cts.map +0 -1
- package/dist/executable-wrapper.d.mts +0 -9
- package/dist/executable-wrapper.d.mts.map +0 -1
- package/dist/executable-wrapper.mjs.map +0 -1
- package/dist/filesystem.cjs +0 -45
- package/dist/filesystem.cjs.map +0 -1
- package/dist/filesystem.d.cts.map +0 -1
- package/dist/filesystem.d.mts +0 -4
- package/dist/filesystem.d.mts.map +0 -1
- package/dist/filesystem.mjs.map +0 -1
- package/dist/index.cjs +0 -37
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -16
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts +0 -16
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -14
- package/dist/index.mjs.map +0 -1
- package/dist/package-json.cjs +0 -29
- package/dist/package-json.cjs.map +0 -1
- package/dist/package-json.d.cts.map +0 -1
- package/dist/package-json.d.mts +0 -6
- package/dist/package-json.d.mts.map +0 -1
- package/dist/package-json.mjs.map +0 -1
- package/dist/platform.cjs +0 -25
- package/dist/platform.cjs.map +0 -1
- package/dist/platform.d.cts.map +0 -1
- package/dist/platform.d.mts +0 -3
- package/dist/platform.d.mts.map +0 -1
- package/dist/platform.mjs.map +0 -1
- package/dist/types.cjs +0 -3
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.mts +0 -14
- package/dist/types.d.mts.map +0 -1
- package/dist/types.mjs +0 -2
- package/dist/types.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.0.0]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **BREAKING:** Drop CommonJS support ([#9536](https://github.com/MetaMask/core/pull/9536))
|
|
15
|
+
- This package is now ESM-only, but can still be used in CommonJS projects via `require(esm)` in modern Node.js versions (22+), or dynamic imports in older Node.js versions.
|
|
16
|
+
- **BREAKING:** Bump minimum Node.js version to 22 ([#9976](https://github.com/MetaMask/core/pull/9976))
|
|
17
|
+
- **BREAKING:** Bump TypeScript target to ES2022 ([#10019](https://github.com/MetaMask/core/pull/10019))
|
|
18
|
+
- This package now ships ES2022 code, requiring a compatible modern environment or bundler configuration to consume.
|
|
19
|
+
|
|
10
20
|
## [1.0.0]
|
|
11
21
|
|
|
12
22
|
### Added
|
|
@@ -16,5 +26,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
16
26
|
- Artifact config helpers, checksum verification, and downloads
|
|
17
27
|
- Archive extraction, executable wrappers, and filesystem helpers
|
|
18
28
|
|
|
19
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/local-node-utils@
|
|
29
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/local-node-utils@2.0.0...HEAD
|
|
30
|
+
[2.0.0]: https://github.com/MetaMask/core/compare/@metamask/local-node-utils@1.0.0...@metamask/local-node-utils@2.0.0
|
|
20
31
|
[1.0.0]: https://github.com/MetaMask/core/releases/tag/@metamask/local-node-utils@1.0.0
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function extractTarGzArchive(archivePath: string, destination: string): Promise<void>;
|
|
2
2
|
export declare function extractTarBz2Archive(archivePath: string, destination: string): Promise<void>;
|
|
3
|
-
//# sourceMappingURL=archive.d.
|
|
3
|
+
//# sourceMappingURL=archive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../src/archive.ts"],"names":[],"mappings":"AAEA,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { runCommand } from
|
|
1
|
+
import { runCommand } from './command.js';
|
|
2
2
|
export async function extractTarGzArchive(archivePath, destination) {
|
|
3
3
|
await runCommand('tar', ['-xzf', archivePath, '-C', destination]);
|
|
4
4
|
}
|
|
5
5
|
export async function extractTarBz2Archive(archivePath, destination) {
|
|
6
6
|
await runCommand('tar', ['-xjf', archivePath, '-C', destination]);
|
|
7
7
|
}
|
|
8
|
-
//# sourceMappingURL=archive.
|
|
8
|
+
//# sourceMappingURL=archive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive.js","sourceRoot":"","sources":["../src/archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,WAAmB,EACnB,WAAmB;IAEnB,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,WAAmB,EACnB,WAAmB;IAEnB,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import { runCommand } from './command.js';\n\nexport async function extractTarGzArchive(\n archivePath: string,\n destination: string,\n): Promise<void> {\n await runCommand('tar', ['-xzf', archivePath, '-C', destination]);\n}\n\nexport async function extractTarBz2Archive(\n archivePath: string,\n destination: string,\n): Promise<void> {\n await runCommand('tar', ['-xjf', archivePath, '-C', destination]);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ArtifactConfig, ArtifactPlatformConfig } from
|
|
1
|
+
import type { ArtifactConfig, ArtifactPlatformConfig } from './types.js';
|
|
2
2
|
export declare function mergeArtifactConfig(defaults: ArtifactConfig, override: ArtifactConfig | undefined): ArtifactConfig;
|
|
3
3
|
export declare function resolvePlatformConfig(config: ArtifactConfig, platform: string, label: string): ArtifactPlatformConfig;
|
|
4
4
|
export declare function requireCompletePlatformConfig(config: Partial<ArtifactPlatformConfig>, label: string): ArtifactPlatformConfig;
|
|
5
5
|
export declare function getCacheKey(config: ArtifactPlatformConfig): string;
|
|
6
|
-
//# sourceMappingURL=artifact.d.
|
|
6
|
+
//# sourceMappingURL=artifact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../src/artifact.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzE,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,cAAc,GAAG,SAAS,GACnC,cAAc,CAShB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,sBAAsB,CAQxB;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,OAAO,CAAC,sBAAsB,CAAC,EACvC,KAAK,EAAE,MAAM,GACZ,sBAAsB,CASxB;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAIlE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable import-x/no-nodejs-modules */
|
|
2
|
-
import { createHash } from
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
3
|
export function mergeArtifactConfig(defaults, override) {
|
|
4
4
|
if (!override) {
|
|
5
5
|
return defaults;
|
|
@@ -30,4 +30,4 @@ export function getCacheKey(config) {
|
|
|
30
30
|
.update(`${config.url}:${config.checksum}`)
|
|
31
31
|
.digest('hex');
|
|
32
32
|
}
|
|
33
|
-
//# sourceMappingURL=artifact.
|
|
33
|
+
//# sourceMappingURL=artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact.js","sourceRoot":"","sources":["../src/artifact.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,MAAM,UAAU,mBAAmB,CACjC,QAAwB,EACxB,QAAoC;IAEpC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO;QACL,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO;QAC7C,SAAS,EAAE,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE;KAC5D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,MAAsB,EACtB,QAAgB,EAChB,KAAa;IAEb,MAAM,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAE9E,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,MAAM,KAAK,sBAAsB,QAAQ,GAAG,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,MAAuC,EACvC,KAAa;IAEb,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,qCAAqC,CAAC,CAAC;IACjE,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,GAAG,EAAE,MAAM,CAAC,GAAG;KAChB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAA8B;IACxD,OAAO,UAAU,CAAC,QAAQ,CAAC;SACxB,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;SAC1C,MAAM,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC","sourcesContent":["/* eslint-disable import-x/no-nodejs-modules */\nimport { createHash } from 'node:crypto';\n\nimport type { ArtifactConfig, ArtifactPlatformConfig } from './types.js';\n\nexport function mergeArtifactConfig(\n defaults: ArtifactConfig,\n override: ArtifactConfig | undefined,\n): ArtifactConfig {\n if (!override) {\n return defaults;\n }\n\n return {\n version: override.version ?? defaults.version,\n platforms: { ...defaults.platforms, ...override.platforms },\n };\n}\n\nexport function resolvePlatformConfig(\n config: ArtifactConfig,\n platform: string,\n label: string,\n): ArtifactPlatformConfig {\n const platformConfig = config.platforms.current ?? config.platforms[platform];\n\n if (!platformConfig) {\n throw new Error(`No ${label} is configured for ${platform}.`);\n }\n\n return platformConfig;\n}\n\nexport function requireCompletePlatformConfig(\n config: Partial<ArtifactPlatformConfig>,\n label: string,\n): ArtifactPlatformConfig {\n if (!config.url || !config.checksum) {\n throw new Error(`${label} require both a URL and a checksum.`);\n }\n\n return {\n checksum: config.checksum,\n url: config.url,\n };\n}\n\nexport function getCacheKey(config: ArtifactPlatformConfig): string {\n return createHash('sha256')\n .update(`${config.url}:${config.checksum}`)\n .digest('hex');\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-directory.d.ts","sourceRoot":"","sources":["../src/cache-directory.ts"],"names":[],"mappings":"AAQA,wBAAgB,yBAAyB,CAAC,EACxC,GAAmB,EACnB,aAAyB,EACzB,QAA6B,GAC9B,GAAE;IACD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,MAAM,CAoBd"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable import-x/no-nodejs-modules, no-restricted-globals */
|
|
2
|
-
import { readFileSync } from
|
|
3
|
-
import { homedir } from
|
|
4
|
-
import { join } from
|
|
5
|
-
import { parse as parseYaml } from
|
|
6
|
-
import { isFileMissingError } from
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { parse as parseYaml } from 'yaml';
|
|
6
|
+
import { isFileMissingError } from './errors.js';
|
|
7
7
|
export function getMetamaskCacheDirectory({ cwd = process.cwd(), homeDirectory = homedir(), toolName = 'local-node-utils', } = {}) {
|
|
8
8
|
const yarnRcPath = join(cwd, '.yarnrc.yml');
|
|
9
9
|
let enableGlobalCache = false;
|
|
@@ -21,4 +21,4 @@ export function getMetamaskCacheDirectory({ cwd = process.cwd(), homeDirectory =
|
|
|
21
21
|
? join(homeDirectory, '.cache', 'metamask')
|
|
22
22
|
: join(cwd, '.metamask', 'cache');
|
|
23
23
|
}
|
|
24
|
-
//# sourceMappingURL=cache-directory.
|
|
24
|
+
//# sourceMappingURL=cache-directory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-directory.js","sourceRoot":"","sources":["../src/cache-directory.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,UAAU,yBAAyB,CAAC,EACxC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,EACnB,aAAa,GAAG,OAAO,EAAE,EACzB,QAAQ,GAAG,kBAAkB,GAC9B,GAIG,EAAE;IACJ,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;IAC5C,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAE9B,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;QACjE,iBAAiB,GAAG,YAAY,EAAE,iBAAiB,IAAI,KAAK,CAAC;IAC/D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,CAAC,IAAI,CACV,0BAA0B,UAAU,iBAAiB,QAAQ,SAAS,EACtE,KAAK,CACN,CAAC;IACJ,CAAC;IAED,OAAO,iBAAiB;QACtB,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,UAAU,CAAC;QAC3C,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC","sourcesContent":["/* eslint-disable import-x/no-nodejs-modules, no-restricted-globals */\nimport { readFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { parse as parseYaml } from 'yaml';\n\nimport { isFileMissingError } from './errors.js';\n\nexport function getMetamaskCacheDirectory({\n cwd = process.cwd(),\n homeDirectory = homedir(),\n toolName = 'local-node-utils',\n}: {\n cwd?: string;\n homeDirectory?: string;\n toolName?: string;\n} = {}): string {\n const yarnRcPath = join(cwd, '.yarnrc.yml');\n let enableGlobalCache = false;\n\n try {\n const parsedConfig = parseYaml(readFileSync(yarnRcPath, 'utf8'));\n enableGlobalCache = parsedConfig?.enableGlobalCache ?? false;\n } catch (error) {\n if (isFileMissingError(error)) {\n return join(cwd, '.metamask', 'cache');\n }\n console.warn(\n `Warning: Error reading ${yarnRcPath}, using local ${toolName} cache:`,\n error,\n );\n }\n\n return enableGlobalCache\n ? join(homeDirectory, '.cache', 'metamask')\n : join(cwd, '.metamask', 'cache');\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAIA,wBAAsB,mBAAmB,CAAC,EACxC,cAAc,EACd,SAAS,GACV,EAAE;IACD,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,IAAI,CAAC,CAKhB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable import-x/no-nodejs-modules */
|
|
2
|
-
import { rm } from
|
|
3
|
-
import { join } from
|
|
2
|
+
import { rm } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
4
|
export async function cleanInstallerCache({ cacheDirectory, namespace, }) {
|
|
5
5
|
await rm(join(cacheDirectory, namespace), {
|
|
6
6
|
force: true,
|
|
7
7
|
recursive: true,
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=cache.
|
|
10
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACxC,cAAc,EACd,SAAS,GAIV;IACC,MAAM,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE;QACxC,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable import-x/no-nodejs-modules */\nimport { rm } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nexport async function cleanInstallerCache({\n cacheDirectory,\n namespace,\n}: {\n cacheDirectory: string;\n namespace: string;\n}): Promise<void> {\n await rm(join(cacheDirectory, namespace), {\n force: true,\n recursive: true,\n });\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function verifyFileChecksum(filePath: string, expectedChecksum: string, label: string): Promise<void>;
|
|
2
|
-
//# sourceMappingURL=checksum.d.
|
|
2
|
+
//# sourceMappingURL=checksum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checksum.d.ts","sourceRoot":"","sources":["../src/checksum.ts"],"names":[],"mappings":"AAKA,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable import-x/no-nodejs-modules */
|
|
2
|
-
import { createHash } from
|
|
3
|
-
import { createReadStream } from
|
|
4
|
-
import { pipeline } from
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { createReadStream } from 'node:fs';
|
|
4
|
+
import { pipeline } from 'node:stream/promises';
|
|
5
5
|
export async function verifyFileChecksum(filePath, expectedChecksum, label) {
|
|
6
6
|
const hash = createHash('sha256');
|
|
7
7
|
await pipeline(createReadStream(filePath), hash);
|
|
@@ -10,4 +10,4 @@ export async function verifyFileChecksum(filePath, expectedChecksum, label) {
|
|
|
10
10
|
throw new Error(`${label} checksum mismatch. Expected ${expectedChecksum}, got ${checksum}.`);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
//# sourceMappingURL=checksum.
|
|
13
|
+
//# sourceMappingURL=checksum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checksum.js","sourceRoot":"","sources":["../src/checksum.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,QAAgB,EAChB,gBAAwB,EACxB,KAAa;IAEb,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEpC,IAAI,QAAQ,KAAK,gBAAgB,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,gCAAgC,gBAAgB,SAAS,QAAQ,GAAG,CAC7E,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable import-x/no-nodejs-modules */\nimport { createHash } from 'node:crypto';\nimport { createReadStream } from 'node:fs';\nimport { pipeline } from 'node:stream/promises';\n\nexport async function verifyFileChecksum(\n filePath: string,\n expectedChecksum: string,\n label: string,\n): Promise<void> {\n const hash = createHash('sha256');\n await pipeline(createReadStream(filePath), hash);\n const checksum = hash.digest('hex');\n\n if (checksum !== expectedChecksum) {\n throw new Error(\n `${label} checksum mismatch. Expected ${expectedChecksum}, got ${checksum}.`,\n );\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function readCliValue(option: string, value: string | undefined): string;
|
|
2
|
-
//# sourceMappingURL=cli.d.
|
|
2
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,MAAM,CAMR"}
|
package/dist/{cli.mjs → cli.js}
RENAMED
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAC1B,MAAc,EACd,KAAyB;IAEzB,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,oBAAoB,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["export function readCliValue(\n option: string,\n value: string | undefined,\n): string {\n if (!value || value.startsWith('--')) {\n throw new Error(`${option} requires a value.`);\n }\n\n return value;\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function runCommand(command: string, args: string[]): Promise<void>;
|
|
2
|
-
//# sourceMappingURL=command.d.
|
|
2
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAGA,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,GACb,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable import-x/no-nodejs-modules */
|
|
2
|
-
import { spawn } from
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
3
|
export async function runCommand(command, args) {
|
|
4
4
|
await new Promise((resolvePromise, rejectPromise) => {
|
|
5
5
|
const child = spawn(command, args, {
|
|
@@ -21,4 +21,4 @@ export async function runCommand(command, args) {
|
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
//# sourceMappingURL=command.
|
|
24
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAe,EACf,IAAc;IAEd,MAAM,IAAI,OAAO,CAAO,CAAC,cAAc,EAAE,aAAa,EAAE,EAAE;QACxD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE;YACjC,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC;SACpC,CAAC,CAAC;QACH,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QACjC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;YACjC,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,cAAc,EAAE,CAAC;gBACjB,OAAO;YACT,CAAC;YAED,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,UAAU,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,IAAI,MAAM,EAAE,CAAC;YAC1E,aAAa,CACX,IAAI,KAAK,CACP,GAAG,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,UAAU,KAAK,MAAM,EAAE,CACpE,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable import-x/no-nodejs-modules */\nimport { spawn } from 'node:child_process';\n\nexport async function runCommand(\n command: string,\n args: string[],\n): Promise<void> {\n await new Promise<void>((resolvePromise, rejectPromise) => {\n const child = spawn(command, args, {\n shell: false,\n stdio: ['ignore', 'ignore', 'pipe'],\n });\n let stderr = '';\n\n child.stderr.on('data', (chunk) => {\n stderr += chunk.toString();\n });\n child.on('error', rejectPromise);\n child.on('close', (code, signal) => {\n if (code === 0) {\n resolvePromise();\n return;\n }\n\n const exitStatus = signal ? `signal ${signal}` : `code ${code ?? 'null'}`;\n rejectPromise(\n new Error(\n `${command} ${args.join(' ')} failed with ${exitStatus}: ${stderr}`,\n ),\n );\n });\n });\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function downloadFileFromUrl(url: string, destination: string): Promise<void>;
|
|
2
2
|
export declare function openDownloadStream(url: URL, redirectsRemaining?: number): Promise<NodeJS.ReadableStream>;
|
|
3
|
-
//# sourceMappingURL=download.d.
|
|
3
|
+
//# sourceMappingURL=download.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../src/download.ts"],"names":[],"mappings":"AAQA,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,GAAG,EACR,kBAAkB,SAAI,GACrB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CA8ChC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable import-x/no-nodejs-modules */
|
|
2
|
-
import { createWriteStream } from
|
|
3
|
-
import { mkdir } from
|
|
4
|
-
import { request as requestHttp } from
|
|
5
|
-
import { request as requestHttps } from
|
|
6
|
-
import { dirname } from
|
|
7
|
-
import { pipeline } from
|
|
2
|
+
import { createWriteStream } from 'node:fs';
|
|
3
|
+
import { mkdir } from 'node:fs/promises';
|
|
4
|
+
import { request as requestHttp } from 'node:http';
|
|
5
|
+
import { request as requestHttps } from 'node:https';
|
|
6
|
+
import { dirname } from 'node:path';
|
|
7
|
+
import { pipeline } from 'node:stream/promises';
|
|
8
8
|
export async function downloadFileFromUrl(url, destination) {
|
|
9
9
|
await mkdir(dirname(destination), { recursive: true });
|
|
10
10
|
await pipeline(await openDownloadStream(new URL(url)), createWriteStream(destination));
|
|
@@ -39,4 +39,4 @@ export async function openDownloadStream(url, redirectsRemaining = 5) {
|
|
|
39
39
|
req.end();
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
//# sourceMappingURL=download.
|
|
42
|
+
//# sourceMappingURL=download.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.js","sourceRoot":"","sources":["../src/download.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,GAAW,EACX,WAAmB;IAEnB,MAAM,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,MAAM,QAAQ,CACZ,MAAM,kBAAkB,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,EACtC,iBAAiB,CAAC,WAAW,CAAC,CAC/B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,GAAQ,EACR,kBAAkB,GAAG,CAAC;IAEtB,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC;IAEtE,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,cAAc,EAAE,aAAa,EAAE,EAAE;QACzD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE;YACpC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,QAAQ,CAAC;YAExD,IACE,UAAU;gBACV,UAAU,IAAI,GAAG;gBACjB,UAAU,GAAG,GAAG;gBAChB,OAAO,CAAC,QAAQ,EAChB,CAAC;gBACD,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAClB,IAAI,kBAAkB,IAAI,CAAC,EAAE,CAAC;oBAC5B,aAAa,CAAC,IAAI,KAAK,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAC,CAAC;oBAClE,OAAO;gBACT,CAAC;gBAED,kBAAkB,CAChB,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,EAC9B,kBAAkB,GAAG,CAAC,CACvB;qBACE,IAAI,CAAC,cAAc,CAAC;qBACpB,KAAK,CAAC,aAAa,CAAC,CAAC;gBACxB,OAAO;YACT,CAAC;YAED,IAAI,CAAC,UAAU,IAAI,UAAU,GAAG,GAAG,IAAI,UAAU,IAAI,GAAG,EAAE,CAAC;gBACzD,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAClB,aAAa,CACX,IAAI,KAAK,CACP,cAAc,GAAG,gBAAgB,UAAU,IAAI,SAAS,IACtD,aAAa,IAAI,EACnB,EAAE,CAAC,IAAI,EAAE,CACV,CACF,CAAC;gBACF,OAAO;YACT,CAAC;YAED,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAC/B,GAAG,CAAC,GAAG,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable import-x/no-nodejs-modules */\nimport { createWriteStream } from 'node:fs';\nimport { mkdir } from 'node:fs/promises';\nimport { request as requestHttp } from 'node:http';\nimport { request as requestHttps } from 'node:https';\nimport { dirname } from 'node:path';\nimport { pipeline } from 'node:stream/promises';\n\nexport async function downloadFileFromUrl(\n url: string,\n destination: string,\n): Promise<void> {\n await mkdir(dirname(destination), { recursive: true });\n await pipeline(\n await openDownloadStream(new URL(url)),\n createWriteStream(destination),\n );\n}\n\nexport async function openDownloadStream(\n url: URL,\n redirectsRemaining = 5,\n): Promise<NodeJS.ReadableStream> {\n const request = url.protocol === 'http:' ? requestHttp : requestHttps;\n\n return await new Promise((resolvePromise, rejectPromise) => {\n const req = request(url, (response) => {\n const { headers, statusCode, statusMessage } = response;\n\n if (\n statusCode &&\n statusCode >= 300 &&\n statusCode < 400 &&\n headers.location\n ) {\n response.resume();\n if (redirectsRemaining <= 0) {\n rejectPromise(new Error(`Too many redirects downloading ${url}`));\n return;\n }\n\n openDownloadStream(\n new URL(headers.location, url),\n redirectsRemaining - 1,\n )\n .then(resolvePromise)\n .catch(rejectPromise);\n return;\n }\n\n if (!statusCode || statusCode < 200 || statusCode >= 300) {\n response.resume();\n rejectPromise(\n new Error(\n `Request to ${url} failed with ${statusCode ?? 'unknown'} ${\n statusMessage ?? ''\n }`.trim(),\n ),\n );\n return;\n }\n\n resolvePromise(response);\n });\n\n req.on('error', rejectPromise);\n req.end();\n });\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function isFileMissingError(error: unknown): boolean;
|
|
2
|
-
//# sourceMappingURL=errors.d.
|
|
2
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAO1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC;QAClD,KAA+B,CAAC,IAAI,KAAK,QAAQ,CACnD,CAAC;AACJ,CAAC","sourcesContent":["export function isFileMissingError(error: unknown): boolean {\n return (\n typeof error === 'object' &&\n error !== null &&\n Object.prototype.hasOwnProperty.call(error, 'code') &&\n (error as NodeJS.ErrnoException).code === 'ENOENT'\n );\n}\n"]}
|
|
@@ -6,4 +6,4 @@ export declare function installExecutableWrapper({ binDirectory, commandName, ex
|
|
|
6
6
|
executablePath: string;
|
|
7
7
|
pathResolution?: ExecutableWrapperPathResolution;
|
|
8
8
|
}): Promise<string>;
|
|
9
|
-
//# sourceMappingURL=executable-wrapper.d.
|
|
9
|
+
//# sourceMappingURL=executable-wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executable-wrapper.d.ts","sourceRoot":"","sources":["../src/executable-wrapper.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,+BAA+B,GAAG,UAAU,GAAG,UAAU,CAAC;AAEtE,wBAAsB,wBAAwB,CAAC,EAC7C,YAAY,EACZ,WAAW,EACX,cAAmB,EACnB,cAAc,EACd,cAA2B,GAC5B,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,+BAA+B,CAAC;CAClD,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBlB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable import-x/no-nodejs-modules */
|
|
2
|
-
import { chmod, mkdir, unlink, writeFile } from
|
|
3
|
-
import { join, relative, resolve } from
|
|
4
|
-
import { isFileMissingError } from
|
|
2
|
+
import { chmod, mkdir, unlink, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { join, relative, resolve } from 'node:path';
|
|
4
|
+
import { isFileMissingError } from './errors.js';
|
|
5
5
|
export async function installExecutableWrapper({ binDirectory, commandName, executableArgs = [], executablePath, pathResolution = 'absolute', }) {
|
|
6
6
|
const binaryPath = join(binDirectory, commandName);
|
|
7
7
|
const wrapperSource = buildExecutableWrapperSource({
|
|
@@ -69,4 +69,4 @@ if (result.signal) {
|
|
|
69
69
|
process.exit(result.status ?? 0);
|
|
70
70
|
`;
|
|
71
71
|
}
|
|
72
|
-
//# sourceMappingURL=executable-wrapper.
|
|
72
|
+
//# sourceMappingURL=executable-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executable-wrapper.js","sourceRoot":"","sources":["../src/executable-wrapper.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAIjD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,EAC7C,YAAY,EACZ,WAAW,EACX,cAAc,GAAG,EAAE,EACnB,cAAc,EACd,cAAc,GAAG,UAAU,GAO5B;IACC,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG,4BAA4B,CAAC;QACjD,YAAY;QACZ,cAAc;QACd,cAAc;QACd,cAAc;KACf,CAAC,CAAC;IAEH,MAAM,KAAK,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACvC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;IACH,MAAM,SAAS,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAC3C,MAAM,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAE/B,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,4BAA4B,CAAC,EACpC,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,GAMf;IACC,IAAI,cAAc,KAAK,UAAU,EAAE,CAAC;QAClC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QAEtE,OAAO;;;;iDAIsC,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC;yBAC9D,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;;;;;;;;;;;;;;;;CAgBtD,CAAC;IACA,CAAC;IAED,MAAM,sBAAsB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEvD,OAAO;;;yBAGgB,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC;yBACtC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;;;;;;;;;;;;;;;;CAgBtD,CAAC;AACF,CAAC","sourcesContent":["/* eslint-disable import-x/no-nodejs-modules */\nimport { chmod, mkdir, unlink, writeFile } from 'node:fs/promises';\nimport { join, relative, resolve } from 'node:path';\n\nimport { isFileMissingError } from './errors.js';\n\nexport type ExecutableWrapperPathResolution = 'absolute' | 'relative';\n\nexport async function installExecutableWrapper({\n binDirectory,\n commandName,\n executableArgs = [],\n executablePath,\n pathResolution = 'absolute',\n}: {\n binDirectory: string;\n commandName: string;\n executableArgs?: string[];\n executablePath: string;\n pathResolution?: ExecutableWrapperPathResolution;\n}): Promise<string> {\n const binaryPath = join(binDirectory, commandName);\n const wrapperSource = buildExecutableWrapperSource({\n binDirectory,\n executableArgs,\n executablePath,\n pathResolution,\n });\n\n await mkdir(binDirectory, { recursive: true });\n await unlink(binaryPath).catch((error) => {\n if (!isFileMissingError(error)) {\n throw error;\n }\n });\n await writeFile(binaryPath, wrapperSource);\n await chmod(binaryPath, 0o755);\n\n return binaryPath;\n}\n\nfunction buildExecutableWrapperSource({\n binDirectory,\n executableArgs,\n executablePath,\n pathResolution,\n}: {\n binDirectory: string;\n executableArgs: string[];\n executablePath: string;\n pathResolution: ExecutableWrapperPathResolution;\n}): string {\n if (pathResolution === 'relative') {\n const relativeExecutablePath = relative(binDirectory, executablePath);\n\n return `#!/usr/bin/env node\nconst { spawnSync } = require('node:child_process');\nconst path = require('node:path');\n\nconst executablePath = path.resolve(__dirname, ${JSON.stringify(relativeExecutablePath)});\nconst executableArgs = ${JSON.stringify(executableArgs)};\nconst result = spawnSync(executablePath, executableArgs.concat(process.argv.slice(2)), {\n stdio: 'inherit',\n});\n\nif (result.error) {\n console.error(result.error.message);\n process.exit(1);\n}\n\nif (result.signal) {\n process.kill(process.pid, result.signal);\n process.exit(1);\n}\n\nprocess.exit(result.status ?? 0);\n`;\n }\n\n const resolvedExecutablePath = resolve(executablePath);\n\n return `#!/usr/bin/env node\nconst { spawnSync } = require('node:child_process');\n\nconst executablePath = ${JSON.stringify(resolvedExecutablePath)};\nconst executableArgs = ${JSON.stringify(executableArgs)};\nconst result = spawnSync(executablePath, executableArgs.concat(process.argv.slice(2)), {\n stdio: 'inherit',\n});\n\nif (result.error) {\n console.error(result.error.message);\n process.exit(1);\n}\n\nif (result.signal) {\n process.kill(process.pid, result.signal);\n process.exit(1);\n}\n\nprocess.exit(result.status ?? 0);\n`;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function findExecutable(root: string, name: string): string | undefined;
|
|
2
2
|
export declare function isDirectory(path: string): boolean;
|
|
3
3
|
export declare function isFile(path: string): boolean;
|
|
4
|
-
//# sourceMappingURL=filesystem.d.
|
|
4
|
+
//# sourceMappingURL=filesystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../src/filesystem.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAmB7E;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMjD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAM5C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable import-x/no-nodejs-modules */
|
|
2
|
-
import { existsSync, readdirSync, statSync } from
|
|
3
|
-
import { join } from
|
|
2
|
+
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
4
|
export function findExecutable(root, name) {
|
|
5
5
|
if (!existsSync(root)) {
|
|
6
6
|
return undefined;
|
|
@@ -36,4 +36,4 @@ export function isFile(path) {
|
|
|
36
36
|
return false;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
//# sourceMappingURL=filesystem.
|
|
39
|
+
//# sourceMappingURL=filesystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../src/filesystem.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,IAAY;IACvD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACpC,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;QACjC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,MAAM,KAAK,GAAG,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAC9C,IAAI,KAAK,EAAE,CAAC;gBACV,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;aAAM,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAC1B,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAY;IACjC,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable import-x/no-nodejs-modules */\nimport { existsSync, readdirSync, statSync } from 'node:fs';\nimport { join } from 'node:path';\n\nexport function findExecutable(root: string, name: string): string | undefined {\n if (!existsSync(root)) {\n return undefined;\n }\n\n for (const entry of readdirSync(root)) {\n const entryPath = join(root, entry);\n const stat = statSync(entryPath);\n if (stat.isDirectory()) {\n const found = findExecutable(entryPath, name);\n if (found) {\n return found;\n }\n } else if (entry === name) {\n return entryPath;\n }\n }\n\n return undefined;\n}\n\nexport function isDirectory(path: string): boolean {\n try {\n return statSync(path).isDirectory();\n } catch {\n return false;\n }\n}\n\nexport function isFile(path: string): boolean {\n try {\n return statSync(path).isFile();\n } catch {\n return false;\n }\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type { ArtifactConfig, ArtifactPlatformConfig, InstallDependencies, } from './types.js';
|
|
2
|
+
export { getCacheKey, mergeArtifactConfig, requireCompletePlatformConfig, resolvePlatformConfig, } from './artifact.js';
|
|
3
|
+
export { cleanInstallerCache } from './cache.js';
|
|
4
|
+
export { getMetamaskCacheDirectory } from './cache-directory.js';
|
|
5
|
+
export { verifyFileChecksum } from './checksum.js';
|
|
6
|
+
export { readCliValue } from './cli.js';
|
|
7
|
+
export { runCommand } from './command.js';
|
|
8
|
+
export { isFileMissingError } from './errors.js';
|
|
9
|
+
export { extractTarBz2Archive, extractTarGzArchive } from './archive.js';
|
|
10
|
+
export { downloadFileFromUrl } from './download.js';
|
|
11
|
+
export { installExecutableWrapper } from './executable-wrapper.js';
|
|
12
|
+
export type { ExecutableWrapperPathResolution } from './executable-wrapper.js';
|
|
13
|
+
export { findExecutable, isDirectory, isFile } from './filesystem.js';
|
|
14
|
+
export { getPlatformKey, normalizeSystemArchitecture } from './platform.js';
|
|
15
|
+
export { readPackageJsonToolConfig } from './package-json.js';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,YAAY,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { getCacheKey, mergeArtifactConfig, requireCompletePlatformConfig, resolvePlatformConfig, } from './artifact.js';
|
|
2
|
+
export { cleanInstallerCache } from './cache.js';
|
|
3
|
+
export { getMetamaskCacheDirectory } from './cache-directory.js';
|
|
4
|
+
export { verifyFileChecksum } from './checksum.js';
|
|
5
|
+
export { readCliValue } from './cli.js';
|
|
6
|
+
export { runCommand } from './command.js';
|
|
7
|
+
export { isFileMissingError } from './errors.js';
|
|
8
|
+
export { extractTarBz2Archive, extractTarGzArchive } from './archive.js';
|
|
9
|
+
export { downloadFileFromUrl } from './download.js';
|
|
10
|
+
export { installExecutableWrapper } from './executable-wrapper.js';
|
|
11
|
+
export { findExecutable, isDirectory, isFile } from './filesystem.js';
|
|
12
|
+
export { getPlatformKey, normalizeSystemArchitecture } from './platform.js';
|
|
13
|
+
export { readPackageJsonToolConfig } from './package-json.js';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export type {\n ArtifactConfig,\n ArtifactPlatformConfig,\n InstallDependencies,\n} from './types.js';\nexport {\n getCacheKey,\n mergeArtifactConfig,\n requireCompletePlatformConfig,\n resolvePlatformConfig,\n} from './artifact.js';\nexport { cleanInstallerCache } from './cache.js';\nexport { getMetamaskCacheDirectory } from './cache-directory.js';\nexport { verifyFileChecksum } from './checksum.js';\nexport { readCliValue } from './cli.js';\nexport { runCommand } from './command.js';\nexport { isFileMissingError } from './errors.js';\nexport { extractTarBz2Archive, extractTarGzArchive } from './archive.js';\nexport { downloadFileFromUrl } from './download.js';\nexport { installExecutableWrapper } from './executable-wrapper.js';\nexport type { ExecutableWrapperPathResolution } from './executable-wrapper.js';\nexport { findExecutable, isDirectory, isFile } from './filesystem.js';\nexport { getPlatformKey, normalizeSystemArchitecture } from './platform.js';\nexport { readPackageJsonToolConfig } from './package-json.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../src/package-json.ts"],"names":[],"mappings":"AAMA,wBAAgB,yBAAyB,CAAC,EACxC,GAAmB,EACnB,eAA2C,EAC3C,UAAU,GACX,EAAE;IACD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoB1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable import-x/no-nodejs-modules, no-restricted-globals */
|
|
2
|
-
import { readFileSync } from
|
|
3
|
-
import { join } from
|
|
4
|
-
import { isFileMissingError } from
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { isFileMissingError } from './errors.js';
|
|
5
5
|
export function readPackageJsonToolConfig({ cwd = process.cwd(), packageJsonPath = join(cwd, 'package.json'), configKeys, }) {
|
|
6
6
|
let raw;
|
|
7
7
|
try {
|
|
@@ -22,4 +22,4 @@ export function readPackageJsonToolConfig({ cwd = process.cwd(), packageJsonPath
|
|
|
22
22
|
}
|
|
23
23
|
return {};
|
|
24
24
|
}
|
|
25
|
-
//# sourceMappingURL=package-json.
|
|
25
|
+
//# sourceMappingURL=package-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-json.js","sourceRoot":"","sources":["../src/package-json.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,UAAU,yBAAyB,CAAC,EACxC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,EACnB,eAAe,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,EAC3C,UAAU,GAKX;IACC,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAA4B,CAAC;IAC/D,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YACzC,OAAO,MAAiC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["/* eslint-disable import-x/no-nodejs-modules, no-restricted-globals */\nimport { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { isFileMissingError } from './errors.js';\n\nexport function readPackageJsonToolConfig({\n cwd = process.cwd(),\n packageJsonPath = join(cwd, 'package.json'),\n configKeys,\n}: {\n cwd?: string;\n packageJsonPath?: string;\n configKeys: string[];\n}): Record<string, unknown> {\n let raw: string;\n try {\n raw = readFileSync(packageJsonPath, 'utf8');\n } catch (error) {\n if (isFileMissingError(error)) {\n return {};\n }\n throw error;\n }\n\n const packageJson = JSON.parse(raw) as Record<string, unknown>;\n for (const key of configKeys) {\n const config = packageJson[key];\n if (config && typeof config === 'object') {\n return config as Record<string, unknown>;\n }\n }\n\n return {};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,wBAAgB,2BAA2B,CAAC,YAAY,SAAW,GAAG,MAAM,CAa3E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable import-x/no-nodejs-modules */
|
|
2
|
-
import { spawnSync } from
|
|
3
|
-
import { arch as osArch, platform as osPlatform } from
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { arch as osArch, platform as osPlatform } from 'node:os';
|
|
4
4
|
export function getPlatformKey() {
|
|
5
5
|
return `${osPlatform()}-${normalizeSystemArchitecture()}`;
|
|
6
6
|
}
|
|
@@ -17,4 +17,4 @@ export function normalizeSystemArchitecture(architecture = osArch()) {
|
|
|
17
17
|
}
|
|
18
18
|
return architecture;
|
|
19
19
|
}
|
|
20
|
-
//# sourceMappingURL=platform.
|
|
20
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAEjE,MAAM,UAAU,cAAc;IAC5B,OAAO,GAAG,UAAU,EAAE,IAAI,2BAA2B,EAAE,EAAE,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,YAAY,GAAG,MAAM,EAAE;IACjE,IAAI,YAAY,KAAK,KAAK,IAAI,UAAU,EAAE,KAAK,QAAQ,EAAE,CAAC;QACxD,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,wBAAwB,CAAC,EAAE;YACnE,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;YACjC,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["/* eslint-disable import-x/no-nodejs-modules */\nimport { spawnSync } from 'node:child_process';\nimport { arch as osArch, platform as osPlatform } from 'node:os';\n\nexport function getPlatformKey(): string {\n return `${osPlatform()}-${normalizeSystemArchitecture()}`;\n}\n\nexport function normalizeSystemArchitecture(architecture = osArch()): string {\n if (architecture === 'x64' && osPlatform() === 'darwin') {\n const result = spawnSync('sysctl', ['-n', 'sysctl.proc_translated'], {\n encoding: 'utf8',\n shell: false,\n stdio: ['ignore', 'pipe', 'ignore'],\n });\n if (result.stdout.trim() === '1') {\n return 'arm64';\n }\n }\n\n return architecture;\n}\n"]}
|
|
@@ -11,4 +11,4 @@ export type InstallDependencies = {
|
|
|
11
11
|
downloadFile?: (url: string, destination: string) => Promise<void>;
|
|
12
12
|
extractArchive?: (archivePath: string, destination: string) => Promise<void>;
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=types.d.
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,GAAG,SAAS,CAAC,CAAC;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9E,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type ArtifactPlatformConfig = {\n checksum: string;\n size?: number;\n url: string;\n};\n\nexport type ArtifactConfig = {\n platforms: Record<string, ArtifactPlatformConfig | undefined>;\n version?: string;\n};\n\nexport type InstallDependencies = {\n downloadFile?: (url: string, destination: string) => Promise<void>;\n extractArchive?: (archivePath: string, destination: string) => Promise<void>;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/local-node-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-preview-97d6b86c0",
|
|
4
4
|
"description": "Shared utilities for MetaMask local node runtime installers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ethereum",
|
|
@@ -18,19 +18,12 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"dist/"
|
|
20
20
|
],
|
|
21
|
+
"type": "module",
|
|
21
22
|
"sideEffects": false,
|
|
22
|
-
"main": "./dist/index.cjs",
|
|
23
|
-
"types": "./dist/index.d.cts",
|
|
24
23
|
"exports": {
|
|
25
24
|
".": {
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
"default": "./dist/index.mjs"
|
|
29
|
-
},
|
|
30
|
-
"require": {
|
|
31
|
-
"types": "./dist/index.d.cts",
|
|
32
|
-
"default": "./dist/index.cjs"
|
|
33
|
-
}
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"default": "./dist/index.js"
|
|
34
27
|
},
|
|
35
28
|
"./package.json": "./package.json"
|
|
36
29
|
},
|
|
@@ -39,9 +32,11 @@
|
|
|
39
32
|
"registry": "https://registry.npmjs.org/"
|
|
40
33
|
},
|
|
41
34
|
"scripts": {
|
|
42
|
-
"build": "
|
|
43
|
-
"build:all": "
|
|
35
|
+
"build": "tsc --project tsconfig.build.json",
|
|
36
|
+
"build:all": "tsc --build tsconfig.build.json --verbose",
|
|
37
|
+
"build:clean": "yarn build:only-clean && yarn build",
|
|
44
38
|
"build:docs": "typedoc",
|
|
39
|
+
"build:only-clean": "rimraf './dist' './tsconfig.build.tsbuildinfo'",
|
|
45
40
|
"changelog:update": "../../scripts/update-changelog.sh @metamask/local-node-utils",
|
|
46
41
|
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/local-node-utils",
|
|
47
42
|
"lint:tsconfigs": "tsx ../../scripts/lint-tsconfigs/lint-tsconfigs.mts",
|
|
@@ -59,18 +54,19 @@
|
|
|
59
54
|
},
|
|
60
55
|
"devDependencies": {
|
|
61
56
|
"@metamask/auto-changelog": "^6.1.0",
|
|
62
|
-
"@ts-bridge/cli": "^0.6.4",
|
|
63
57
|
"@types/jest": "^30.0.0",
|
|
58
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
64
59
|
"deepmerge": "^4.2.2",
|
|
65
60
|
"jest": "^30.4.2",
|
|
66
61
|
"nock": "^13.3.1",
|
|
62
|
+
"rimraf": "^5.0.5",
|
|
67
63
|
"ts-jest": "^29.4.11",
|
|
68
64
|
"tsx": "^4.20.5",
|
|
69
65
|
"typedoc": "^0.25.13",
|
|
70
66
|
"typedoc-plugin-missing-exports": "^2.0.0",
|
|
71
|
-
"typescript": "
|
|
67
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2"
|
|
72
68
|
},
|
|
73
69
|
"engines": {
|
|
74
|
-
"node": "^
|
|
70
|
+
"node": "^22.14.0 || ^24"
|
|
75
71
|
}
|
|
76
72
|
}
|