@layerzerolabs/vm-tooling 0.0.32 → 0.0.34
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/dist/{SKAV3OJX.js → 3OZIHTYD.js} +3 -3
- package/dist/{SKAV3OJX.js.map → 3OZIHTYD.js.map} +1 -1
- package/dist/{JMREETWO.js → 7IE2YF5W.js} +37 -9
- package/dist/7IE2YF5W.js.map +1 -0
- package/dist/{TPVIFJX4.js → C43VFM42.js} +23 -26
- package/dist/C43VFM42.js.map +1 -0
- package/dist/{2TPNSECS.cjs → OSUIRC3Q.cjs} +23 -26
- package/dist/OSUIRC3Q.cjs.map +1 -0
- package/dist/{TA2DABDY.cjs → QEWFKZ5V.cjs} +11 -11
- package/dist/{TA2DABDY.cjs.map → QEWFKZ5V.cjs.map} +1 -1
- package/dist/{DIMA5OXC.cjs → V3HCYIGB.cjs} +47 -19
- package/dist/V3HCYIGB.cjs.map +1 -0
- package/dist/{W3KWDJYA.cjs → VMIVI5MG.cjs} +11 -11
- package/dist/{W3KWDJYA.cjs.map → VMIVI5MG.cjs.map} +1 -1
- package/dist/{5EKZTTNT.js → WL6VQDIS.js} +3 -3
- package/dist/{5EKZTTNT.js.map → WL6VQDIS.js.map} +1 -1
- package/dist/config/index.cjs +4 -4
- package/dist/config/index.js +1 -1
- package/dist/config/tools.cjs +2 -2
- package/dist/config/tools.d.ts.map +1 -1
- package/dist/config/tools.js +1 -1
- package/dist/core/index.cjs +7 -7
- package/dist/core/index.js +3 -3
- package/dist/core/tool-executor.cjs +4 -4
- package/dist/core/tool-executor.d.ts +3 -1
- package/dist/core/tool-executor.d.ts.map +1 -1
- package/dist/core/tool-executor.js +3 -3
- package/dist/core/version-resolver.cjs +5 -5
- package/dist/core/version-resolver.js +2 -2
- package/dist/display/index.cjs +4 -4
- package/dist/display/index.js +2 -2
- package/dist/display/version-display.cjs +4 -4
- package/dist/display/version-display.js +2 -2
- package/dist/index.cjs +24 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/types/docker.d.ts +7 -0
- package/dist/types/docker.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/tool.d.ts +1 -0
- package/dist/types/tool.d.ts.map +1 -1
- package/dist/utils/finder-utils.cjs +8 -8
- package/dist/utils/finder-utils.js +1 -1
- package/dist/utils/index.cjs +12 -12
- package/dist/utils/index.js +1 -1
- package/dist/utils/version-utils.cjs +5 -5
- package/dist/utils/version-utils.js +1 -1
- package/package.json +4 -4
- package/dist/2TPNSECS.cjs.map +0 -1
- package/dist/DIMA5OXC.cjs.map +0 -1
- package/dist/JMREETWO.js.map +0 -1
- package/dist/TPVIFJX4.js.map +0 -1
package/dist/display/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../EKUFNO5X.js';
|
|
2
|
-
export { displayToolVersionInfo, displayVersionCombinations } from '../
|
|
2
|
+
export { displayToolVersionInfo, displayVersionCombinations } from '../WL6VQDIS.js';
|
|
3
3
|
export { createUserFriendlyError, formatVersionCombination } from '../QNKHVJNZ.js';
|
|
4
|
-
import '../
|
|
4
|
+
import '../C43VFM42.js';
|
|
5
5
|
import '../BA2LAHMY.js';
|
|
6
6
|
import '../YTUEW27V.js';
|
|
7
7
|
import '../VUOMXK5T.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var VMIVI5MG_cjs = require('../VMIVI5MG.cjs');
|
|
4
4
|
require('../LBQPL6VK.cjs');
|
|
5
|
-
require('../
|
|
5
|
+
require('../OSUIRC3Q.cjs');
|
|
6
6
|
require('../3EOFF6NK.cjs');
|
|
7
7
|
require('../QSKQ7BQT.cjs');
|
|
8
8
|
require('../NX4KBEWA.cjs');
|
|
@@ -11,11 +11,11 @@ require('../NX4KBEWA.cjs');
|
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(exports, "displayToolVersionInfo", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return VMIVI5MG_cjs.displayToolVersionInfo; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "displayVersionCombinations", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return VMIVI5MG_cjs.displayVersionCombinations; }
|
|
19
19
|
});
|
|
20
20
|
//# sourceMappingURL=version-display.cjs.map
|
|
21
21
|
//# sourceMappingURL=version-display.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { displayToolVersionInfo, displayVersionCombinations } from '../
|
|
1
|
+
export { displayToolVersionInfo, displayVersionCombinations } from '../WL6VQDIS.js';
|
|
2
2
|
import '../QNKHVJNZ.js';
|
|
3
|
-
import '../
|
|
3
|
+
import '../C43VFM42.js';
|
|
4
4
|
import '../BA2LAHMY.js';
|
|
5
5
|
import '../YTUEW27V.js';
|
|
6
6
|
import '../VUOMXK5T.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('./RLUL6JFM.cjs');
|
|
4
|
-
var
|
|
4
|
+
var VMIVI5MG_cjs = require('./VMIVI5MG.cjs');
|
|
5
5
|
require('./LBQPL6VK.cjs');
|
|
6
6
|
require('./5N3Q6FCT.cjs');
|
|
7
|
-
var
|
|
8
|
-
require('./
|
|
9
|
-
var
|
|
7
|
+
var V3HCYIGB_cjs = require('./V3HCYIGB.cjs');
|
|
8
|
+
require('./QEWFKZ5V.cjs');
|
|
9
|
+
var OSUIRC3Q_cjs = require('./OSUIRC3Q.cjs');
|
|
10
10
|
require('./3EOFF6NK.cjs');
|
|
11
11
|
require('./QSKQ7BQT.cjs');
|
|
12
12
|
require('./4NINFZK7.cjs');
|
|
@@ -26,7 +26,7 @@ async function main() {
|
|
|
26
26
|
const program = new commander.Command();
|
|
27
27
|
program.name("lz-tool").description("\u{1F680} LayerZero VM tooling with intelligent version management").version("1.0.0");
|
|
28
28
|
if (process__default.default.argv.includes("--list-versions")) {
|
|
29
|
-
|
|
29
|
+
VMIVI5MG_cjs.displayVersionCombinations();
|
|
30
30
|
process__default.default.exit(0);
|
|
31
31
|
}
|
|
32
32
|
program.option("-c, --cwd <path>", "Current working directory", (input) => {
|
|
@@ -43,7 +43,18 @@ async function main() {
|
|
|
43
43
|
throw new Error("cwd must be a directory");
|
|
44
44
|
}
|
|
45
45
|
return input;
|
|
46
|
-
}).option("-d, --force-docker", "Force using Docker image instead of local installation", false).option("-e, --custom-entrypoint <entrypoint>", "Override the default Docker entrypoint for the tool").option("
|
|
46
|
+
}).option("-d, --force-docker", "Force using Docker image instead of local installation", false).option("-e, --custom-entrypoint <entrypoint>", "Override the default Docker entrypoint for the tool").option("--script <script>", 'Execute a custom script using bash -c in the Docker container (e.g., --script "npm install && npm test")').option("--env <name=value>", "Set environment variables for Docker container (e.g., --env NODE_ENV=production)", (input, previous) => {
|
|
47
|
+
const [name, ...valueParts] = input.split("=");
|
|
48
|
+
if (name === "" || valueParts.length === 0) {
|
|
49
|
+
throw new Error(`Invalid environment variable format: ${input}. Use --env NAME=VALUE`);
|
|
50
|
+
}
|
|
51
|
+
const value = valueParts.join("=");
|
|
52
|
+
previous.push({
|
|
53
|
+
name,
|
|
54
|
+
value
|
|
55
|
+
});
|
|
56
|
+
return previous;
|
|
57
|
+
}, []).option("-v, --volume <type:hostPath:containerPath[:name]>", "Volume mappings in the format type:hostPath:containerPath[:name] (e.g., host:/host/path:/container/path or isolate::/container/path:volumeName)", (input, previous) => {
|
|
47
58
|
const [type, hostPath, containerPath, name] = input.split(":");
|
|
48
59
|
if (type !== "host" && type !== "isolate") {
|
|
49
60
|
throw new Error(`Invalid volume type: ${type}`);
|
|
@@ -62,22 +73,22 @@ async function main() {
|
|
|
62
73
|
});
|
|
63
74
|
return previous;
|
|
64
75
|
}, []);
|
|
65
|
-
|
|
76
|
+
OSUIRC3Q_cjs.tools.forEach((tool) => {
|
|
66
77
|
const optionFlag = `--${tool.name}-version <version>`;
|
|
67
|
-
const defaultVersion =
|
|
68
|
-
const supportedVersions =
|
|
78
|
+
const defaultVersion = OSUIRC3Q_cjs.getToolDefaultVersion(tool.name);
|
|
79
|
+
const supportedVersions = OSUIRC3Q_cjs.getToolSupportedVersions(tool.name);
|
|
69
80
|
const description = `Specify ${tool.name} version (default: ${defaultVersion}, supported: ${supportedVersions.join(", ")})`;
|
|
70
81
|
program.option(optionFlag, description);
|
|
71
82
|
});
|
|
72
83
|
program.option("--list-versions", "Display all supported version combinations and exit");
|
|
73
84
|
program.command("version-info <tool>").description("Display detailed version information for a specific tool").action((toolName) => {
|
|
74
|
-
|
|
85
|
+
VMIVI5MG_cjs.displayToolVersionInfo(toolName);
|
|
75
86
|
});
|
|
76
|
-
|
|
87
|
+
OSUIRC3Q_cjs.tools.forEach((tool) => {
|
|
77
88
|
const toolCmd = program.command(tool.name, {
|
|
78
89
|
isDefault: false
|
|
79
90
|
}).description(`Run ${tool.name} with version checking`).allowUnknownOption().argument("[args...]", "Arguments to pass to the tool");
|
|
80
|
-
|
|
91
|
+
OSUIRC3Q_cjs.tools.forEach((toolOption) => {
|
|
81
92
|
const optionFlag = `--${toolOption.name}-version <version>`;
|
|
82
93
|
const description = `Specify ${toolOption.name} version for this execution`;
|
|
83
94
|
toolCmd.option(optionFlag, description);
|
|
@@ -92,7 +103,7 @@ async function main() {
|
|
|
92
103
|
};
|
|
93
104
|
const cwd = mergedOptions.cwd ?? process__default.default.cwd();
|
|
94
105
|
try {
|
|
95
|
-
await
|
|
106
|
+
await V3HCYIGB_cjs.executeToolCommand(tool.name, args, {
|
|
96
107
|
cwd,
|
|
97
108
|
volumes: mergedOptions.volume,
|
|
98
109
|
...mergedOptions
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["main","program","Command","name","description","version","process","argv","includes","displayVersionCombinations","exit","option","input","Error","path","isAbsolute","fs","existsSync","statSync","isDirectory","previous","type","hostPath","containerPath","split","undefined","push","tools","forEach","tool","optionFlag","defaultVersion","getToolDefaultVersion","supportedVersions","getToolSupportedVersions","join","command","action","toolName","displayToolVersionInfo","toolCmd","isDefault","allowUnknownOption","argument","toolOption","args","globalOptions","opts","commandOptions","mergedOptions","cwd","executeToolCommand","volumes","volume","error","console","message","String","parseAsync"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAWA,eAAeA,IAAAA,GAAAA;AACX,EAAA,MAAMC,OAAAA,GAAU,IAAIC,iBAAAA,EAAAA;AAEpBD,EAAAA,OAAAA,CACKE,KAAK,SAAA,CAAA,CACLC,YAAY,oEAAA,CAAA,CACZC,QAAQ,OAAA,CAAA;AAGb,EAAA,IAAIC,wBAAAA,CAAQC,IAAAA,CAAKC,QAAAA,CAAS,iBAAA,CAAA,EAAoB;AAC1CC,IAAAA,uCAAAA,EAAAA;AACAH,IAAAA,wBAAAA,CAAQI,KAAK,CAAA,CAAA;AACjB,EAAA;AAGAT,EAAAA,OAAAA,CACKU,MAAAA,CAAO,kBAAA,EAAoB,2BAAA,EAA6B,CAACC,KAAAA,KAAAA;AACtD,IAAA,IAAI,OAAOA,UAAU,QAAA,EAAU;AAC3B,MAAA,MAAM,IAAIC,MAAM,2BAAA,CAAA;AACpB,IAAA;AAEA,IAAA,IAAI,CAACC,qBAAAA,CAAKC,UAAAA,CAAWH,KAAAA,CAAAA,EAAQ;AACzB,MAAA,MAAM,IAAIC,MAAM,0CAAA,CAAA;AACpB,IAAA;AAEA,IAAA,IAAI,CAACG,mBAAAA,CAAGC,UAAAA,CAAWL,KAAAA,CAAAA,EAAQ;AACvB,MAAA,MAAM,IAAIC,MAAM,oBAAA,CAAA;AACpB,IAAA;AAEA,IAAA,IAAI,CAACG,mBAAAA,CAAGE,QAAAA,CAASN,KAAAA,CAAAA,CAAOO,aAAW,E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from 'process';\n\nimport { tools } from './config';\nimport { executeToolCommand } from './core';\nimport { displayToolVersionInfo, displayVersionCombinations } from './display';\nimport type { VolumeMapping } from './types';\nimport { getToolDefaultVersion, getToolSupportedVersions } from './utils/finder-utils';\n\nasync function main(): Promise<void> {\n const program = new Command();\n\n program\n .name('lz-tool')\n .description('🚀 LayerZero VM tooling with intelligent version management')\n .version('1.0.0');\n\n // Check for --list-versions before parsing to avoid help display\n if (process.argv.includes('--list-versions')) {\n displayVersionCombinations();\n process.exit(0);\n }\n\n // Add global options\n program\n .option('-c, --cwd <path>', 'Current working directory', (input: string) => {\n if (typeof input !== 'string') {\n throw new Error('cwd flag must be a string');\n }\n\n if (!path.isAbsolute(input)) {\n throw new Error('cwd must be an absolute path if provided');\n }\n\n if (!fs.existsSync(input)) {\n throw new Error('cwd does not exist');\n }\n\n if (!fs.statSync(input).isDirectory()) {\n throw new Error('cwd must be a directory');\n }\n\n return input;\n })\n .option(\n '-d, --force-docker',\n 'Force using Docker image instead of local installation',\n false,\n )\n .option(\n '-e, --custom-entrypoint <entrypoint>',\n 'Override the default Docker entrypoint for the tool',\n )\n .option(\n '-v, --volume <type:hostPath:containerPath[:name]>',\n 'Volume mappings in the format type:hostPath:containerPath[:name] (e.g., host:/host/path:/container/path or isolate::/container/path:volumeName)',\n (input: string, previous: VolumeMapping[]) => {\n const [type, hostPath, containerPath, name] = input.split(':');\n if (type !== 'host' && type !== 'isolate') {\n throw new Error(`Invalid volume type: ${type}`);\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (type === 'host' && (hostPath === undefined || hostPath === '')) {\n throw new Error(`Host path is required for volume type 'host'`);\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (containerPath === undefined || containerPath === '') {\n throw new Error(`Container path is required`);\n }\n previous.push({ type, hostPath, containerPath, name } satisfies VolumeMapping);\n return previous;\n },\n [],\n );\n\n // Add version options for each tool dynamically\n tools.forEach((tool) => {\n const optionFlag = `--${tool.name}-version <version>`;\n const defaultVersion = getToolDefaultVersion(tool.name);\n const supportedVersions = getToolSupportedVersions(tool.name);\n const description = `Specify ${tool.name} version (default: ${defaultVersion}, supported: ${supportedVersions.join(', ')})`;\n\n program.option(optionFlag, description);\n });\n\n // Add utility options\n program.option('--list-versions', 'Display all supported version combinations and exit');\n\n // Add version info command\n program\n .command('version-info <tool>')\n .description('Display detailed version information for a specific tool')\n .action((toolName: string) => {\n displayToolVersionInfo(toolName);\n });\n\n // Dynamically add commands for each supported tool\n tools.forEach((tool) => {\n const toolCmd = program\n .command(tool.name, { isDefault: false })\n .description(`Run ${tool.name} with version checking`)\n .allowUnknownOption()\n .argument('[args...]', 'Arguments to pass to the tool');\n\n // Add tool-specific version options to each command as well\n tools.forEach((toolOption) => {\n const optionFlag = `--${toolOption.name}-version <version>`;\n const description = `Specify ${toolOption.name} version for this execution`;\n toolCmd.option(optionFlag, description);\n });\n\n // Add custom entrypoint option to each command\n toolCmd.option(\n '-e, --custom-entrypoint <entrypoint>',\n 'Override the default Docker entrypoint for this tool',\n );\n\n toolCmd.action(async (args: string[]) => {\n // Get both global and command-specific options\n const globalOptions: { cwd?: string; forceDocker: boolean; volume: VolumeMapping[] } =\n program.opts();\n const commandOptions = toolCmd.opts();\n\n // Merge options, with command-specific taking precedence\n const mergedOptions = { ...globalOptions, ...commandOptions };\n\n const cwd = mergedOptions.cwd ?? process.cwd();\n\n try {\n await executeToolCommand(tool.name, args, {\n cwd,\n volumes: mergedOptions.volume,\n ...mergedOptions,\n });\n } catch (error) {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n });\n });\n\n await program.parseAsync();\n}\n\n// Start the program\nvoid main();\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["main","program","Command","name","description","version","process","argv","includes","displayVersionCombinations","exit","option","input","Error","path","isAbsolute","fs","existsSync","statSync","isDirectory","previous","valueParts","split","length","value","join","push","type","hostPath","containerPath","undefined","tools","forEach","tool","optionFlag","defaultVersion","getToolDefaultVersion","supportedVersions","getToolSupportedVersions","command","action","toolName","displayToolVersionInfo","toolCmd","isDefault","allowUnknownOption","argument","toolOption","args","globalOptions","opts","commandOptions","mergedOptions","cwd","executeToolCommand","volumes","volume","error","console","message","String","parseAsync"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAWA,eAAeA,IAAAA,GAAAA;AACX,EAAA,MAAMC,OAAAA,GAAU,IAAIC,iBAAAA,EAAAA;AAEpBD,EAAAA,OAAAA,CACKE,KAAK,SAAA,CAAA,CACLC,YAAY,oEAAA,CAAA,CACZC,QAAQ,OAAA,CAAA;AAGb,EAAA,IAAIC,wBAAAA,CAAQC,IAAAA,CAAKC,QAAAA,CAAS,iBAAA,CAAA,EAAoB;AAC1CC,IAAAA,uCAAAA,EAAAA;AACAH,IAAAA,wBAAAA,CAAQI,KAAK,CAAA,CAAA;AACjB,EAAA;AAGAT,EAAAA,OAAAA,CACKU,MAAAA,CAAO,kBAAA,EAAoB,2BAAA,EAA6B,CAACC,KAAAA,KAAAA;AACtD,IAAA,IAAI,OAAOA,UAAU,QAAA,EAAU;AAC3B,MAAA,MAAM,IAAIC,MAAM,2BAAA,CAAA;AACpB,IAAA;AAEA,IAAA,IAAI,CAACC,qBAAAA,CAAKC,UAAAA,CAAWH,KAAAA,CAAAA,EAAQ;AACzB,MAAA,MAAM,IAAIC,MAAM,0CAAA,CAAA;AACpB,IAAA;AAEA,IAAA,IAAI,CAACG,mBAAAA,CAAGC,UAAAA,CAAWL,KAAAA,CAAAA,EAAQ;AACvB,MAAA,MAAM,IAAIC,MAAM,oBAAA,CAAA;AACpB,IAAA;AAEA,IAAA,IAAI,CAACG,mBAAAA,CAAGE,QAAAA,CAASN,KAAAA,CAAAA,CAAOO,aAAW,EAAI;AACnC,MAAA,MAAM,IAAIN,MAAM,yBAAA,CAAA;AACpB,IAAA;AAEA,IAAA,OAAOD,KAAAA;AACX,EAAA,CAAA,EACCD,MAAAA,CACG,oBAAA,EACA,0DACA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AACJ,MAAA,CAAA,CAAA,OAASK,KAAAA,EAAO;AACZC,QAAAA,OAAAA,CAAQD,MAAMA,KAAAA,YAAiB5C,KAAAA,GAAQ4C,MAAME,OAAAA,GAAUC,MAAAA,CAAOH,KAAAA,CAAAA,CAAAA;AAC9DnD,QAAAA,wBAAAA,CAAQI,KAAK,CAAA,CAAA;AACjB,MAAA;IACJ,CAAA,CAAA;EACJ,CAAA,CAAA;AAEA,EAAA,MAAMT,QAAQ4D,UAAAA,EAAU;AAC5B;AA9Je7D,mBAAAA,CAAAA,IAAAA,EAAAA,MAAAA,CAAAA;AAiKf,KAAKA,IAAAA,EAAAA","file":"index.cjs","sourcesContent":["import { Command } from 'commander';\nimport fs from 'fs';\nimport path from 'path';\nimport process from 'process';\n\nimport { tools } from './config';\nimport { executeToolCommand } from './core';\nimport { displayToolVersionInfo, displayVersionCombinations } from './display';\nimport type { EnvironmentVariable, VolumeMapping } from './types';\nimport { getToolDefaultVersion, getToolSupportedVersions } from './utils/finder-utils';\n\nasync function main(): Promise<void> {\n const program = new Command();\n\n program\n .name('lz-tool')\n .description('🚀 LayerZero VM tooling with intelligent version management')\n .version('1.0.0');\n\n // Check for --list-versions before parsing to avoid help display\n if (process.argv.includes('--list-versions')) {\n displayVersionCombinations();\n process.exit(0);\n }\n\n // Add global options\n program\n .option('-c, --cwd <path>', 'Current working directory', (input: string) => {\n if (typeof input !== 'string') {\n throw new Error('cwd flag must be a string');\n }\n\n if (!path.isAbsolute(input)) {\n throw new Error('cwd must be an absolute path if provided');\n }\n\n if (!fs.existsSync(input)) {\n throw new Error('cwd does not exist');\n }\n\n if (!fs.statSync(input).isDirectory()) {\n throw new Error('cwd must be a directory');\n }\n\n return input;\n })\n .option(\n '-d, --force-docker',\n 'Force using Docker image instead of local installation',\n false,\n )\n .option(\n '-e, --custom-entrypoint <entrypoint>',\n 'Override the default Docker entrypoint for the tool',\n )\n .option(\n '--script <script>',\n 'Execute a custom script using bash -c in the Docker container (e.g., --script \"npm install && npm test\")',\n )\n .option(\n '--env <name=value>',\n 'Set environment variables for Docker container (e.g., --env NODE_ENV=production)',\n (input: string, previous: EnvironmentVariable[]) => {\n const [name, ...valueParts] = input.split('=');\n if (name === '' || valueParts.length === 0) {\n throw new Error(\n `Invalid environment variable format: ${input}. Use --env NAME=VALUE`,\n );\n }\n const value = valueParts.join('='); // Handle values that contain '='\n previous.push({ name, value } satisfies EnvironmentVariable);\n return previous;\n },\n [],\n )\n .option(\n '-v, --volume <type:hostPath:containerPath[:name]>',\n 'Volume mappings in the format type:hostPath:containerPath[:name] (e.g., host:/host/path:/container/path or isolate::/container/path:volumeName)',\n (input: string, previous: VolumeMapping[]) => {\n const [type, hostPath, containerPath, name] = input.split(':');\n if (type !== 'host' && type !== 'isolate') {\n throw new Error(`Invalid volume type: ${type}`);\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (type === 'host' && (hostPath === undefined || hostPath === '')) {\n throw new Error(`Host path is required for volume type 'host'`);\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (containerPath === undefined || containerPath === '') {\n throw new Error(`Container path is required`);\n }\n previous.push({ type, hostPath, containerPath, name } satisfies VolumeMapping);\n return previous;\n },\n [],\n );\n\n // Add version options for each tool dynamically\n tools.forEach((tool) => {\n const optionFlag = `--${tool.name}-version <version>`;\n const defaultVersion = getToolDefaultVersion(tool.name);\n const supportedVersions = getToolSupportedVersions(tool.name);\n const description = `Specify ${tool.name} version (default: ${defaultVersion}, supported: ${supportedVersions.join(', ')})`;\n\n program.option(optionFlag, description);\n });\n\n // Add utility options\n program.option('--list-versions', 'Display all supported version combinations and exit');\n\n // Add version info command\n program\n .command('version-info <tool>')\n .description('Display detailed version information for a specific tool')\n .action((toolName: string) => {\n displayToolVersionInfo(toolName);\n });\n\n // Dynamically add commands for each supported tool\n tools.forEach((tool) => {\n const toolCmd = program\n .command(tool.name, { isDefault: false })\n .description(`Run ${tool.name} with version checking`)\n .allowUnknownOption()\n .argument('[args...]', 'Arguments to pass to the tool');\n\n // Add tool-specific version options to each command as well\n tools.forEach((toolOption) => {\n const optionFlag = `--${toolOption.name}-version <version>`;\n const description = `Specify ${toolOption.name} version for this execution`;\n toolCmd.option(optionFlag, description);\n });\n\n // Add custom entrypoint option to each command\n toolCmd.option(\n '-e, --custom-entrypoint <entrypoint>',\n 'Override the default Docker entrypoint for this tool',\n );\n\n toolCmd.action(async (args: string[]) => {\n // Get both global and command-specific options\n const globalOptions: {\n cwd?: string;\n forceDocker: boolean;\n volume: VolumeMapping[];\n env: EnvironmentVariable[];\n script?: string;\n } = program.opts();\n const commandOptions = toolCmd.opts();\n\n // Merge options, with command-specific taking precedence\n const mergedOptions = { ...globalOptions, ...commandOptions };\n\n const cwd = mergedOptions.cwd ?? process.cwd();\n\n try {\n await executeToolCommand(tool.name, args, {\n cwd,\n volumes: mergedOptions.volume,\n ...mergedOptions,\n });\n } catch (error) {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n });\n });\n\n await program.parseAsync();\n}\n\n// Start the program\nvoid main();\n"]}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import './EKUFNO5X.js';
|
|
2
|
-
import { displayVersionCombinations, displayToolVersionInfo } from './
|
|
2
|
+
import { displayVersionCombinations, displayToolVersionInfo } from './WL6VQDIS.js';
|
|
3
3
|
import './QNKHVJNZ.js';
|
|
4
4
|
import './ZEW74YLA.js';
|
|
5
|
-
import { executeToolCommand } from './
|
|
6
|
-
import './
|
|
7
|
-
import { tools, getToolDefaultVersion, getToolSupportedVersions } from './
|
|
5
|
+
import { executeToolCommand } from './7IE2YF5W.js';
|
|
6
|
+
import './3OZIHTYD.js';
|
|
7
|
+
import { tools, getToolDefaultVersion, getToolSupportedVersions } from './C43VFM42.js';
|
|
8
8
|
import './BA2LAHMY.js';
|
|
9
9
|
import './YTUEW27V.js';
|
|
10
10
|
import './GAZMRBLT.js';
|
|
@@ -35,7 +35,18 @@ async function main() {
|
|
|
35
35
|
throw new Error("cwd must be a directory");
|
|
36
36
|
}
|
|
37
37
|
return input;
|
|
38
|
-
}).option("-d, --force-docker", "Force using Docker image instead of local installation", false).option("-e, --custom-entrypoint <entrypoint>", "Override the default Docker entrypoint for the tool").option("
|
|
38
|
+
}).option("-d, --force-docker", "Force using Docker image instead of local installation", false).option("-e, --custom-entrypoint <entrypoint>", "Override the default Docker entrypoint for the tool").option("--script <script>", 'Execute a custom script using bash -c in the Docker container (e.g., --script "npm install && npm test")').option("--env <name=value>", "Set environment variables for Docker container (e.g., --env NODE_ENV=production)", (input, previous) => {
|
|
39
|
+
const [name, ...valueParts] = input.split("=");
|
|
40
|
+
if (name === "" || valueParts.length === 0) {
|
|
41
|
+
throw new Error(`Invalid environment variable format: ${input}. Use --env NAME=VALUE`);
|
|
42
|
+
}
|
|
43
|
+
const value = valueParts.join("=");
|
|
44
|
+
previous.push({
|
|
45
|
+
name,
|
|
46
|
+
value
|
|
47
|
+
});
|
|
48
|
+
return previous;
|
|
49
|
+
}, []).option("-v, --volume <type:hostPath:containerPath[:name]>", "Volume mappings in the format type:hostPath:containerPath[:name] (e.g., host:/host/path:/container/path or isolate::/container/path:volumeName)", (input, previous) => {
|
|
39
50
|
const [type, hostPath, containerPath, name] = input.split(":");
|
|
40
51
|
if (type !== "host" && type !== "isolate") {
|
|
41
52
|
throw new Error(`Invalid volume type: ${type}`);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["main","program","Command","name","description","version","process","argv","includes","displayVersionCombinations","exit","option","input","Error","path","isAbsolute","fs","existsSync","statSync","isDirectory","previous","type","hostPath","containerPath","split","undefined","push","tools","forEach","tool","optionFlag","defaultVersion","getToolDefaultVersion","supportedVersions","getToolSupportedVersions","join","command","action","toolName","displayToolVersionInfo","toolCmd","isDefault","allowUnknownOption","argument","toolOption","args","globalOptions","opts","commandOptions","mergedOptions","cwd","executeToolCommand","volumes","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C,aAAAA,GACF7C,QAAQ8C,IAAAA,EAAI;AAChB,MAAA,MAAMC,cAAAA,GAAiBR,QAAQO,IAAAA,EAAI;AAGnC,MAAA,MAAME,aAAAA,GAAgB;QAAE,GAAGH,aAAAA;QAAe,GAAGE;AAAe,OAAA;AAE5D,MAAA,MAAME,GAAAA,GAAMD,aAAAA,CAAcC,GAAAA,IAAO5C,OAAAA,CAAQ4C,GAAAA,EAAG;AAE5C,MAAA,IAAI;AACA,QAAA,MAAMC,kBAAAA,CAAmBtB,IAAAA,CAAK1B,IAAAA,EAAM0C,IAAAA,EAAM;AACtCK,UAAAA,GAAAA;AACAE,UAAAA,OAAAA,EAASH,aAAAA,CAAcI,MAAAA;UACvB,GAAGJ;SACP,CAAA;AACJ,MAAA,CAAA,CAAA,OAASK,KAAAA,EAAO;AACZC,QAAAA,OAAAA,CAAQD,MAAMA,KAAAA,YAAiBzC,KAAAA,GAAQyC,MAAME,OAAAA,GAAUC,MAAAA,CAAOH,KAAAA,CAAAA,CAAAA;AAC9DhD,QAAAA,OAAAA,CAAQI,KAAK,CAAA,CAAA;AACjB,MAAA;IACJ,CAAA,CAAA;EACJ,CAAA,CAAA;AAEA,EAAA,MAAMT,QAAQyD,UAAAA,EAAU;AAC5B;AArIe1D,MAAAA,CAAAA,IAAAA,EAAAA,MAAAA,CAAAA;AAwIf,KAAKA,IAAAA,EAAAA","file":"index.js","sourcesContent":["import { Command } from 'commander';\nimport fs from 'fs';\nimport path from 'path';\nimport process from 'process';\n\nimport { tools } from './config';\nimport { executeToolCommand } from './core';\nimport { displayToolVersionInfo, displayVersionCombinations } from './display';\nimport type { VolumeMapping } from './types';\nimport { getToolDefaultVersion, getToolSupportedVersions } from './utils/finder-utils';\n\nasync function main(): Promise<void> {\n const program = new Command();\n\n program\n .name('lz-tool')\n .description('🚀 LayerZero VM tooling with intelligent version management')\n .version('1.0.0');\n\n // Check for --list-versions before parsing to avoid help display\n if (process.argv.includes('--list-versions')) {\n displayVersionCombinations();\n process.exit(0);\n }\n\n // Add global options\n program\n .option('-c, --cwd <path>', 'Current working directory', (input: string) => {\n if (typeof input !== 'string') {\n throw new Error('cwd flag must be a string');\n }\n\n if (!path.isAbsolute(input)) {\n throw new Error('cwd must be an absolute path if provided');\n }\n\n if (!fs.existsSync(input)) {\n throw new Error('cwd does not exist');\n }\n\n if (!fs.statSync(input).isDirectory()) {\n throw new Error('cwd must be a directory');\n }\n\n return input;\n })\n .option(\n '-d, --force-docker',\n 'Force using Docker image instead of local installation',\n false,\n )\n .option(\n '-e, --custom-entrypoint <entrypoint>',\n 'Override the default Docker entrypoint for the tool',\n )\n .option(\n '-v, --volume <type:hostPath:containerPath[:name]>',\n 'Volume mappings in the format type:hostPath:containerPath[:name] (e.g., host:/host/path:/container/path or isolate::/container/path:volumeName)',\n (input: string, previous: VolumeMapping[]) => {\n const [type, hostPath, containerPath, name] = input.split(':');\n if (type !== 'host' && type !== 'isolate') {\n throw new Error(`Invalid volume type: ${type}`);\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (type === 'host' && (hostPath === undefined || hostPath === '')) {\n throw new Error(`Host path is required for volume type 'host'`);\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (containerPath === undefined || containerPath === '') {\n throw new Error(`Container path is required`);\n }\n previous.push({ type, hostPath, containerPath, name } satisfies VolumeMapping);\n return previous;\n },\n [],\n );\n\n // Add version options for each tool dynamically\n tools.forEach((tool) => {\n const optionFlag = `--${tool.name}-version <version>`;\n const defaultVersion = getToolDefaultVersion(tool.name);\n const supportedVersions = getToolSupportedVersions(tool.name);\n const description = `Specify ${tool.name} version (default: ${defaultVersion}, supported: ${supportedVersions.join(', ')})`;\n\n program.option(optionFlag, description);\n });\n\n // Add utility options\n program.option('--list-versions', 'Display all supported version combinations and exit');\n\n // Add version info command\n program\n .command('version-info <tool>')\n .description('Display detailed version information for a specific tool')\n .action((toolName: string) => {\n displayToolVersionInfo(toolName);\n });\n\n // Dynamically add commands for each supported tool\n tools.forEach((tool) => {\n const toolCmd = program\n .command(tool.name, { isDefault: false })\n .description(`Run ${tool.name} with version checking`)\n .allowUnknownOption()\n .argument('[args...]', 'Arguments to pass to the tool');\n\n // Add tool-specific version options to each command as well\n tools.forEach((toolOption) => {\n const optionFlag = `--${toolOption.name}-version <version>`;\n const description = `Specify ${toolOption.name} version for this execution`;\n toolCmd.option(optionFlag, description);\n });\n\n // Add custom entrypoint option to each command\n toolCmd.option(\n '-e, --custom-entrypoint <entrypoint>',\n 'Override the default Docker entrypoint for this tool',\n );\n\n toolCmd.action(async (args: string[]) => {\n // Get both global and command-specific options\n const globalOptions: { cwd?: string; forceDocker: boolean; volume: VolumeMapping[] } =\n program.opts();\n const commandOptions = toolCmd.opts();\n\n // Merge options, with command-specific taking precedence\n const mergedOptions = { ...globalOptions, ...commandOptions };\n\n const cwd = mergedOptions.cwd ?? process.cwd();\n\n try {\n await executeToolCommand(tool.name, args, {\n cwd,\n volumes: mergedOptions.volume,\n ...mergedOptions,\n });\n } catch (error) {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n });\n });\n\n await program.parseAsync();\n}\n\n// Start the program\nvoid main();\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["main","program","Command","name","description","version","process","argv","includes","displayVersionCombinations","exit","option","input","Error","path","isAbsolute","fs","existsSync","statSync","isDirectory","previous","valueParts","split","length","value","join","push","type","hostPath","containerPath","undefined","tools","forEach","tool","optionFlag","defaultVersion","getToolDefaultVersion","supportedVersions","getToolSupportedVersions","command","action","toolName","displayToolVersionInfo","toolCmd","isDefault","allowUnknownOption","argument","toolOption","args","globalOptions","opts","commandOptions","mergedOptions","cwd","executeToolCommand","volumes","volume","error","console","message","String","parseAsync"],"mappings":";;;;;;;;;;;;;;;;AAWA,eAAeA,IAAAA,GAAAA;AACX,EAAA,MAAMC,OAAAA,GAAU,IAAIC,OAAAA,EAAAA;AAEpBD,EAAAA,OAAAA,CACKE,KAAK,SAA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AAAA,IAAAA,EAAAA,MAAAA,CAAAA;AAiKf,KAAKA,IAAAA,EAAAA","file":"index.js","sourcesContent":["import { Command } from 'commander';\nimport fs from 'fs';\nimport path from 'path';\nimport process from 'process';\n\nimport { tools } from './config';\nimport { executeToolCommand } from './core';\nimport { displayToolVersionInfo, displayVersionCombinations } from './display';\nimport type { EnvironmentVariable, VolumeMapping } from './types';\nimport { getToolDefaultVersion, getToolSupportedVersions } from './utils/finder-utils';\n\nasync function main(): Promise<void> {\n const program = new Command();\n\n program\n .name('lz-tool')\n .description('🚀 LayerZero VM tooling with intelligent version management')\n .version('1.0.0');\n\n // Check for --list-versions before parsing to avoid help display\n if (process.argv.includes('--list-versions')) {\n displayVersionCombinations();\n process.exit(0);\n }\n\n // Add global options\n program\n .option('-c, --cwd <path>', 'Current working directory', (input: string) => {\n if (typeof input !== 'string') {\n throw new Error('cwd flag must be a string');\n }\n\n if (!path.isAbsolute(input)) {\n throw new Error('cwd must be an absolute path if provided');\n }\n\n if (!fs.existsSync(input)) {\n throw new Error('cwd does not exist');\n }\n\n if (!fs.statSync(input).isDirectory()) {\n throw new Error('cwd must be a directory');\n }\n\n return input;\n })\n .option(\n '-d, --force-docker',\n 'Force using Docker image instead of local installation',\n false,\n )\n .option(\n '-e, --custom-entrypoint <entrypoint>',\n 'Override the default Docker entrypoint for the tool',\n )\n .option(\n '--script <script>',\n 'Execute a custom script using bash -c in the Docker container (e.g., --script \"npm install && npm test\")',\n )\n .option(\n '--env <name=value>',\n 'Set environment variables for Docker container (e.g., --env NODE_ENV=production)',\n (input: string, previous: EnvironmentVariable[]) => {\n const [name, ...valueParts] = input.split('=');\n if (name === '' || valueParts.length === 0) {\n throw new Error(\n `Invalid environment variable format: ${input}. Use --env NAME=VALUE`,\n );\n }\n const value = valueParts.join('='); // Handle values that contain '='\n previous.push({ name, value } satisfies EnvironmentVariable);\n return previous;\n },\n [],\n )\n .option(\n '-v, --volume <type:hostPath:containerPath[:name]>',\n 'Volume mappings in the format type:hostPath:containerPath[:name] (e.g., host:/host/path:/container/path or isolate::/container/path:volumeName)',\n (input: string, previous: VolumeMapping[]) => {\n const [type, hostPath, containerPath, name] = input.split(':');\n if (type !== 'host' && type !== 'isolate') {\n throw new Error(`Invalid volume type: ${type}`);\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (type === 'host' && (hostPath === undefined || hostPath === '')) {\n throw new Error(`Host path is required for volume type 'host'`);\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (containerPath === undefined || containerPath === '') {\n throw new Error(`Container path is required`);\n }\n previous.push({ type, hostPath, containerPath, name } satisfies VolumeMapping);\n return previous;\n },\n [],\n );\n\n // Add version options for each tool dynamically\n tools.forEach((tool) => {\n const optionFlag = `--${tool.name}-version <version>`;\n const defaultVersion = getToolDefaultVersion(tool.name);\n const supportedVersions = getToolSupportedVersions(tool.name);\n const description = `Specify ${tool.name} version (default: ${defaultVersion}, supported: ${supportedVersions.join(', ')})`;\n\n program.option(optionFlag, description);\n });\n\n // Add utility options\n program.option('--list-versions', 'Display all supported version combinations and exit');\n\n // Add version info command\n program\n .command('version-info <tool>')\n .description('Display detailed version information for a specific tool')\n .action((toolName: string) => {\n displayToolVersionInfo(toolName);\n });\n\n // Dynamically add commands for each supported tool\n tools.forEach((tool) => {\n const toolCmd = program\n .command(tool.name, { isDefault: false })\n .description(`Run ${tool.name} with version checking`)\n .allowUnknownOption()\n .argument('[args...]', 'Arguments to pass to the tool');\n\n // Add tool-specific version options to each command as well\n tools.forEach((toolOption) => {\n const optionFlag = `--${toolOption.name}-version <version>`;\n const description = `Specify ${toolOption.name} version for this execution`;\n toolCmd.option(optionFlag, description);\n });\n\n // Add custom entrypoint option to each command\n toolCmd.option(\n '-e, --custom-entrypoint <entrypoint>',\n 'Override the default Docker entrypoint for this tool',\n );\n\n toolCmd.action(async (args: string[]) => {\n // Get both global and command-specific options\n const globalOptions: {\n cwd?: string;\n forceDocker: boolean;\n volume: VolumeMapping[];\n env: EnvironmentVariable[];\n script?: string;\n } = program.opts();\n const commandOptions = toolCmd.opts();\n\n // Merge options, with command-specific taking precedence\n const mergedOptions = { ...globalOptions, ...commandOptions };\n\n const cwd = mergedOptions.cwd ?? process.cwd();\n\n try {\n await executeToolCommand(tool.name, args, {\n cwd,\n volumes: mergedOptions.volume,\n ...mergedOptions,\n });\n } catch (error) {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n });\n });\n\n await program.parseAsync();\n}\n\n// Start the program\nvoid main();\n"]}
|
package/dist/types/docker.d.ts
CHANGED
|
@@ -7,4 +7,11 @@ export interface VolumeMapping {
|
|
|
7
7
|
containerPath: string;
|
|
8
8
|
name?: string;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Environment variable configuration for Docker containers
|
|
12
|
+
*/
|
|
13
|
+
export interface EnvironmentVariable {
|
|
14
|
+
name: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}
|
|
10
17
|
//# sourceMappingURL=docker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../src/types/docker.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
1
|
+
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../src/types/docker.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { GetExpectedVersionParameter, Tool, ToolingImageTargetName, ToolType, Version, } from './tool';
|
|
2
2
|
export type { ToolVersionMatrix, VersionCombination, VersionResolutionResult } from './version';
|
|
3
|
-
export type { VolumeMapping } from './docker';
|
|
3
|
+
export type { EnvironmentVariable, VolumeMapping } from './docker';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EACR,2BAA2B,EAC3B,IAAI,EACJ,sBAAsB,EACtB,QAAQ,EACR,OAAO,GACV,MAAM,QAAQ,CAAC;AAGhB,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAGhG,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EACR,2BAA2B,EAC3B,IAAI,EACJ,sBAAsB,EACtB,QAAQ,EACR,OAAO,GACV,MAAM,QAAQ,CAAC;AAGhB,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAGhG,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/types/tool.d.ts
CHANGED
package/dist/types/tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/types/tool.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAC5B,OAAO,GACP,eAAe,GACf,QAAQ,GACR,KAAK,GACL,KA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2B,KAAK,OAAO,CAAC;CAClF;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB;AAGD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var OSUIRC3Q_cjs = require('../OSUIRC3Q.cjs');
|
|
4
4
|
require('../3EOFF6NK.cjs');
|
|
5
5
|
require('../QSKQ7BQT.cjs');
|
|
6
6
|
require('../NX4KBEWA.cjs');
|
|
@@ -9,31 +9,31 @@ require('../NX4KBEWA.cjs');
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "findDefaultCombination", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return OSUIRC3Q_cjs.findDefaultCombination; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "findMatrixByType", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return OSUIRC3Q_cjs.findMatrixByType; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "findToolByName", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return OSUIRC3Q_cjs.findToolByName; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "findToolsByType", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return OSUIRC3Q_cjs.findToolsByType; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "getToolDefaultVersion", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return OSUIRC3Q_cjs.getToolDefaultVersion; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "getToolSupportedVersions", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return OSUIRC3Q_cjs.getToolSupportedVersions; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "getToolType", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return OSUIRC3Q_cjs.getToolType; }
|
|
37
37
|
});
|
|
38
38
|
//# sourceMappingURL=finder-utils.cjs.map
|
|
39
39
|
//# sourceMappingURL=finder-utils.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { findDefaultCombination, findMatrixByType, findToolByName, findToolsByType, getToolDefaultVersion, getToolSupportedVersions, getToolType } from '../
|
|
1
|
+
export { findDefaultCombination, findMatrixByType, findToolByName, findToolsByType, getToolDefaultVersion, getToolSupportedVersions, getToolType } from '../C43VFM42.js';
|
|
2
2
|
import '../BA2LAHMY.js';
|
|
3
3
|
import '../YTUEW27V.js';
|
|
4
4
|
import '../VUOMXK5T.js';
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var OSUIRC3Q_cjs = require('../OSUIRC3Q.cjs');
|
|
4
4
|
require('../3EOFF6NK.cjs');
|
|
5
5
|
require('../QSKQ7BQT.cjs');
|
|
6
6
|
require('../NX4KBEWA.cjs');
|
|
@@ -9,47 +9,47 @@ require('../NX4KBEWA.cjs');
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "findDefaultCombination", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return OSUIRC3Q_cjs.findDefaultCombination; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "findMatrixByType", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return OSUIRC3Q_cjs.findMatrixByType; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "findSemVersionFromString", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return OSUIRC3Q_cjs.findSemVersionFromString; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "findToolByName", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return OSUIRC3Q_cjs.findToolByName; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "findToolsByType", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return OSUIRC3Q_cjs.findToolsByType; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "getToolDefaultVersion", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return OSUIRC3Q_cjs.getToolDefaultVersion; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "getToolSupportedVersions", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return OSUIRC3Q_cjs.getToolSupportedVersions; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "getToolType", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return OSUIRC3Q_cjs.getToolType; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "parseAnchorTomlVersion", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return OSUIRC3Q_cjs.parseAnchorTomlVersion; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "validateToolVersion", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return OSUIRC3Q_cjs.validateToolVersion; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "versionsSatisfied", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return OSUIRC3Q_cjs.versionsSatisfied; }
|
|
53
53
|
});
|
|
54
54
|
//# sourceMappingURL=index.cjs.map
|
|
55
55
|
//# sourceMappingURL=index.cjs.map
|
package/dist/utils/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { findDefaultCombination, findMatrixByType, findSemVersionFromString, findToolByName, findToolsByType, getToolDefaultVersion, getToolSupportedVersions, getToolType, parseAnchorTomlVersion, validateToolVersion, versionsSatisfied } from '../
|
|
1
|
+
export { findDefaultCombination, findMatrixByType, findSemVersionFromString, findToolByName, findToolsByType, getToolDefaultVersion, getToolSupportedVersions, getToolType, parseAnchorTomlVersion, validateToolVersion, versionsSatisfied } from '../C43VFM42.js';
|
|
2
2
|
import '../BA2LAHMY.js';
|
|
3
3
|
import '../YTUEW27V.js';
|
|
4
4
|
import '../VUOMXK5T.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var OSUIRC3Q_cjs = require('../OSUIRC3Q.cjs');
|
|
4
4
|
require('../3EOFF6NK.cjs');
|
|
5
5
|
require('../QSKQ7BQT.cjs');
|
|
6
6
|
require('../NX4KBEWA.cjs');
|
|
@@ -9,19 +9,19 @@ require('../NX4KBEWA.cjs');
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "findSemVersionFromString", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return OSUIRC3Q_cjs.findSemVersionFromString; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "parseAnchorTomlVersion", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return OSUIRC3Q_cjs.parseAnchorTomlVersion; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "validateToolVersion", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return OSUIRC3Q_cjs.validateToolVersion; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "versionsSatisfied", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return OSUIRC3Q_cjs.versionsSatisfied; }
|
|
25
25
|
});
|
|
26
26
|
//# sourceMappingURL=version-utils.cjs.map
|
|
27
27
|
//# sourceMappingURL=version-utils.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { findSemVersionFromString, parseAnchorTomlVersion, validateToolVersion, versionsSatisfied } from '../
|
|
1
|
+
export { findSemVersionFromString, parseAnchorTomlVersion, validateToolVersion, versionsSatisfied } from '../C43VFM42.js';
|
|
2
2
|
import '../BA2LAHMY.js';
|
|
3
3
|
import '../YTUEW27V.js';
|
|
4
4
|
import '../VUOMXK5T.js';
|
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dotenv": "16.4.5",
|
|
25
25
|
"semver": "^7.5.4",
|
|
26
26
|
"zx": "^8.1.3",
|
|
27
|
-
"@layerzerolabs/common-node-utils": "0.0.
|
|
27
|
+
"@layerzerolabs/common-node-utils": "0.0.34"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@aws-sdk/client-ecr": "3.879.0",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"tsup": "^8.4.0",
|
|
37
37
|
"tsx": "^4.19.3",
|
|
38
38
|
"typescript": "^5.8.2",
|
|
39
|
-
"@layerzerolabs/
|
|
40
|
-
"@layerzerolabs/
|
|
39
|
+
"@layerzerolabs/typescript-configuration": "0.0.34",
|
|
40
|
+
"@layerzerolabs/tsup-configuration": "0.0.34"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "restricted",
|
|
44
44
|
"registry": "https://registry.npmjs.org/"
|
|
45
45
|
},
|
|
46
|
-
"version": "0.0.
|
|
46
|
+
"version": "0.0.34",
|
|
47
47
|
"scripts": {
|
|
48
48
|
"prebuild": "chmod +x bin/lz-tool.cjs || true",
|
|
49
49
|
"build": "tsup",
|
package/dist/2TPNSECS.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/version-utils.ts","../src/config/tools.ts","../src/config/index.ts","../src/utils/finder-utils.ts"],"names":["versionsSatisfied","current","expected","satisfies","version","parseAnchorTomlVersion","cwd","name","projectFolder","findParentDirectoryWithFile","Error","toml","fs","readFileSync","file","test","match","exec","_","matchedName","findSemVersionFromString","input","length","validateToolVersion","toolName","supportedVersions","getToolSupportedVersions","includes","tools","toolType","fromImage","entryPoint","defaultVolumes","parseVersionCliVersionOutput","output","console","log","versionCliArguments","type","containerPath","getSecondaryVersionCheckValue","__name","AWS_ACCOUNT_ID","AWS_REGION","findToolByName","find","tool","findToolsByType","filter","getToolType","findMatrixByType","versionMatrices","matrix","findDefaultCombination","recommended","combinations","combo","isRecommended","getToolDefaultVersion","defaultCombination","defaultVersion","versions","Set","combination","add","Array","from","sort"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,SAASA,iBAAAA,CAAkBC,SAAkBC,QAAAA,EAAiB;AACjE,EAAA,OAAcC,iBAAAA,CAAAA,SAAAA,CAAUF,OAAAA,CAAQG,OAAAA,EAASF,QAAAA,CAASE,OAAO,CAAA;AAC7D;AAFgBJ,mBAAAA,CAAAA,iBAAAA,EAAAA,mBAAAA,CAAAA;AAOT,SAASK,sBAAAA,CAAuBC,KAAaC,IAAAA,EAAyB;AACzE,EAAA,MAAMC,aAAAA,GAAgBC,yCAAAA,CAA4BH,GAAAA,EAAK,aAAA,CAAA;AAEvD,EAAA,IAAIE,kBAAkB,IAAA,EAAM;AACxB,IAAA,MAAM,IAAIE,MAAM,0BAAA,CAAA;AACpB,EAAA;AAEA,EAAA,MAAMC,IAAAA,GAAOC,mBAAAA,CAAGC,YAAAA,CAAaL,aAAAA,CAAcM,MAAM,OAAA,CAAA;AAEj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AA,CAAKjB,QAAQ,CAAA;AAC7C,EAAA,IAAI,CAACuB,MAAAA,EAAQ;AACT,IAAA,MAAM,IAAI1C,KAAAA,CAAM,CAAA,uCAAA,EAA0CoC,IAAAA,CAAKjB,QAAQ,CAAA,CAAA,CAAG,CAAA;AAC9E,EAAA;AAGA,EAAA,MAAMgC,QAAAA,uBAAeC,GAAAA,EAAAA;AACrB,EAAA,KAAA,MAAWC,WAAAA,IAAeX,OAAOG,YAAAA,EAAc;AAC3C,IAAA,MAAMnD,OAAAA,GAAU2D,WAAAA,CAAYF,QAAAA,CAASrC,QAAAA,CAAAA;AACrC,IAAA,IAAIpB,OAAAA,IAAW,IAAA,IAAQA,OAAAA,CAAQkB,MAAAA,GAAS,CAAA,EAAG;AACvCuC,MAAAA,QAAAA,CAASG,IAAI5D,OAAAA,CAAAA;AACjB,IAAA;AACJ,EAAA;AAEA,EAAA,OAAO6D,KAAAA,CAAMC,IAAAA,CAAKL,QAAAA,CAAAA,CAAUM,IAAAA,EAAI;AACpC;AArBgBzC,mBAAAA,CAAAA,wBAAAA,EAAAA,0BAAAA,CAAAA","file":"2TPNSECS.cjs","sourcesContent":["import fs from 'fs';\nimport * as semver from 'semver';\n\nimport type { Version } from '../types';\nimport { findParentDirectoryWithFile } from '../utils';\nimport { getToolSupportedVersions } from './finder-utils';\n\n/**\n * Check if current version satisfies expected version using semver\n */\nexport function versionsSatisfied(current: Version, expected: Version): boolean {\n return semver.satisfies(current.version, expected.version);\n}\n\n/**\n * Parse anchor/solana version from Anchor.toml file\n */\nexport function parseAnchorTomlVersion(cwd: string, name: 'anchor' | 'solana'): Version {\n const projectFolder = findParentDirectoryWithFile(cwd, 'Anchor.toml');\n\n if (projectFolder === null) {\n throw new Error('Anchor project not found');\n }\n\n const toml = fs.readFileSync(projectFolder.file, 'utf-8');\n\n const test = /^([a-z]+)(?:_version ?= ?\")((?:[0-9]+\\.?){3})(?:\")$/gm;\n\n let match;\n while ((match = test.exec(toml))) {\n const [_, matchedName, version] = match;\n if (matchedName === name) {\n return { version };\n }\n }\n\n throw new Error(`${name} version not found in ${projectFolder.file}`);\n}\n\n/**\n * Find semantic version from string output\n */\nexport function findSemVersionFromString(input: string): Version {\n const match = input.match(/^(solana-cli|anchor-cli|aptos)\\s+(([0-9]+\\.?){3}).*?/m);\n if (match === null || match.length < 3) {\n throw new Error(`Invalid semver version: ${input}`);\n }\n\n return { version: match[2] };\n}\n\n/**\n * Validate if a tool version is in the supported versions list\n */\nexport function validateToolVersion(toolName: string, version: string): boolean {\n const supportedVersions = getToolSupportedVersions(toolName);\n return supportedVersions.includes(version);\n}\n","import type { GetExpectedVersionParameter, Tool, Version } from '../types';\nimport { parseAnchorTomlVersion } from '../utils/version-utils';\n\n/**\n * Tool configurations with individual settings (version info managed by version-matrices)\n */\nexport const tools: readonly Tool[] = [\n {\n name: 'hardhat',\n toolType: 'evm',\n fromImage: 'evm',\n entryPoint: '/usr/local/lib/node_modules/hardhat/internal/cli/bootstrap.js',\n defaultVolumes: [],\n parseVersionCliVersionOutput: (output: string): Version => {\n console.log('output', output);\n // TODO: parse the output\n return { version: '2.19.3' };\n },\n versionCliArguments: ['--version'],\n },\n {\n name: 'anchor',\n toolType: 'solana',\n fromImage: 'solana-anchor',\n defaultVolumes: [\n {\n type: 'isolate',\n containerPath: '/usr/local/cargo',\n name: 'lz-tooling-cargo-cache',\n },\n {\n type: 'isolate',\n containerPath: '/usr/local/rustup',\n name: 'lz-tooling-rustup-cache',\n },\n ],\n getSecondaryVersionCheckValue: ({ cwd }: GetExpectedVersionParameter): Version => {\n return parseAnchorTomlVersion(cwd, 'anchor');\n },\n },\n {\n name: 'solana',\n toolType: 'solana',\n fromImage: 'solana-anchor',\n defaultVolumes: [\n {\n type: 'isolate',\n containerPath: '/usr/local/cargo',\n name: 'lz-tooling-cargo-cache',\n },\n {\n type: 'isolate',\n containerPath: '/usr/local/rustup',\n name: 'lz-tooling-rustup-cache',\n },\n ],\n getSecondaryVersionCheckValue: ({ cwd }: GetExpectedVersionParameter): Version => {\n return parseAnchorTomlVersion(cwd, 'solana');\n },\n },\n {\n name: 'aptos',\n toolType: 'aptos',\n fromImage: 'aptos',\n defaultVolumes: [\n {\n type: 'isolate',\n containerPath: '/root/.move',\n name: 'lz-tooling-aptos-cache',\n },\n ],\n versionCliArguments: ['--version'],\n },\n {\n name: 'initiad',\n toolType: 'initia',\n fromImage: 'initia',\n entryPoint: 'initiad', // Explicitly set the same as name for clarity\n defaultVolumes: [\n {\n type: 'isolate',\n containerPath: '/root/.move',\n name: 'lz-tooling-initia-cache',\n },\n ],\n versionCliArguments: ['--version'],\n },\n {\n name: 'blueprint',\n toolType: 'ton',\n fromImage: 'ton',\n defaultVolumes: [],\n },\n {\n name: 'scarb',\n toolType: 'starknet',\n fromImage: 'starknet',\n defaultVolumes: [],\n },\n {\n name: 'sui',\n toolType: 'sui',\n fromImage: 'sui',\n defaultVolumes: [\n {\n type: 'isolate',\n containerPath: '/root/.move',\n name: 'lz-tooling-sui-cache',\n },\n ],\n versionCliArguments: ['--version'],\n },\n];\n","// Export configuration data\nexport { tools } from './tools';\nexport { versionMatrices } from './version-matrices';\nexport const AWS_ACCOUNT_ID = '438003944538';\nexport const AWS_REGION = 'us-east-1';\n","import { tools, versionMatrices } from '../config';\nimport type { Tool, ToolType, ToolVersionMatrix, VersionCombination } from '../types';\n\n/**\n * Find a tool configuration by name\n */\nexport function findToolByName(toolName: string): Tool | undefined {\n return tools.find((tool) => tool.name === toolName);\n}\n\n/**\n * Find all tools in a specific type\n */\nexport function findToolsByType(type: ToolType): Tool[] {\n return tools.filter((tool) => tool.toolType === type);\n}\n\n/**\n * Get the type for a specific tool\n */\nexport function getToolType(toolName: string): ToolType | undefined {\n const tool = findToolByName(toolName);\n return tool?.toolType;\n}\n\n/**\n * Find version matrix for a specific tool type\n */\nexport function findMatrixByType(type: ToolType): ToolVersionMatrix | undefined {\n return versionMatrices.find((matrix) => matrix.toolType === type);\n}\n\n/**\n * Find the default combination for a tool type\n * Returns the first combination marked as isRecommended=true, or combinations[0] if none marked\n */\nexport function findDefaultCombination(matrix: ToolVersionMatrix): VersionCombination {\n // First, try to find a recommended combination\n const recommended = matrix.combinations.find((combo) => combo.isRecommended === true);\n if (recommended) {\n return recommended;\n }\n\n // If no recommended combination, use the first one\n if (matrix.combinations.length === 0) {\n throw new Error(`No combinations found in matrix for type '${matrix.toolType}'`);\n }\n\n return matrix.combinations[0];\n}\n\n/**\n * Get default version for a specific tool from version matrix\n */\nexport function getToolDefaultVersion(toolName: string): string {\n const tool = findToolByName(toolName);\n if (!tool) {\n throw new Error(`Tool '${toolName}' not found`);\n }\n\n const matrix = findMatrixByType(tool.toolType);\n if (!matrix) {\n throw new Error(`No version matrix found for tool type '${tool.toolType}'`);\n }\n\n const defaultCombination = findDefaultCombination(matrix);\n const defaultVersion = defaultCombination.versions[toolName];\n if (defaultVersion == null || defaultVersion.length === 0) {\n throw new Error(`No default version found for tool '${toolName}' in matrix`);\n }\n\n return defaultVersion;\n}\n\n/**\n * Get supported versions for a specific tool from version matrix\n */\nexport function getToolSupportedVersions(toolName: string): string[] {\n const tool = findToolByName(toolName);\n if (!tool) {\n throw new Error(`Tool '${toolName}' not found`);\n }\n\n const matrix = findMatrixByType(tool.toolType);\n if (!matrix) {\n throw new Error(`No version matrix found for tool type '${tool.toolType}'`);\n }\n\n // Extract all unique versions for this tool from all combinations\n const versions = new Set<string>();\n for (const combination of matrix.combinations) {\n const version = combination.versions[toolName];\n if (version != null && version.length > 0) {\n versions.add(version);\n }\n }\n\n return Array.from(versions).sort();\n}\n"]}
|