warpo 2.5.0-alpha-1 → 2.5.0-alpha-3
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/warpo.d.ts +1 -7
- package/dist/warpo.js +6 -79
- package/dist/warpo.js.map +1 -1
- package/dist/warpo_internal.d.ts +7 -0
- package/dist/warpo_internal.js +74 -0
- package/dist/warpo_internal.js.map +1 -0
- package/package.json +5 -5
package/dist/warpo.d.ts
CHANGED
package/dist/warpo.js
CHANGED
|
@@ -1,84 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Copyright (C) 2025 wasm-ecosystem
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
import { pathToFileURL } from "node:url";
|
|
7
4
|
import { argv as processArgv, env as processEnv, exit as processExit } from "node:process";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return JSON.parse(readFileSync(join(warpoRoot, "package.json"), "utf8")).version;
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
return "unknown";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export async function main(options) {
|
|
21
|
-
const args = options.argv;
|
|
22
|
-
// Preserve legacy behavior: direct compiler invocation when not using subcommands.
|
|
23
|
-
const first = args[0];
|
|
24
|
-
if (first !== undefined &&
|
|
25
|
-
first !== "build" &&
|
|
26
|
-
first !== "test" &&
|
|
27
|
-
first !== "-h" &&
|
|
28
|
-
first !== "--help" &&
|
|
29
|
-
first !== "--version" &&
|
|
30
|
-
first !== "-v") {
|
|
31
|
-
return await runCompiler({ argv: args, env: options.env, cwd: options.cwd });
|
|
32
|
-
}
|
|
33
|
-
let returnCode = 0;
|
|
34
|
-
const program = new Command();
|
|
35
|
-
program.name("warpo").description("compiler + tooling");
|
|
36
|
-
program.showHelpAfterError(true);
|
|
37
|
-
program.version(getVersion(), "-v, --version", "Print version");
|
|
38
|
-
program
|
|
39
|
-
.command("build")
|
|
40
|
-
.description("Build AssemblyScript project via WARPO compiler")
|
|
41
|
-
.allowUnknownOption(true)
|
|
42
|
-
.argument("[buildArgs...]", "Arguments passed through to warpo_asc")
|
|
43
|
-
.action(async () => {
|
|
44
|
-
const index = args.indexOf("build");
|
|
45
|
-
const buildArgs = index === -1 ? [] : args.slice(index + 1);
|
|
46
|
-
const cwd = options.cwd ?? process.cwd();
|
|
47
|
-
const handleConfigOption = (args) => {
|
|
48
|
-
const configPath = join(cwd, "asconfig.json");
|
|
49
|
-
const hasConfig = args.includes("--config") || args.includes("-c");
|
|
50
|
-
return !hasConfig && existsSync(configPath) ? [...args, "--config", configPath] : args;
|
|
51
|
-
};
|
|
52
|
-
const handleProjectOption = (args) => {
|
|
53
|
-
const hasProject = args.includes("--project") || args.includes("-p");
|
|
54
|
-
return !hasProject && existsSync(join(cwd, "create.ts")) ? [...args, "--project", cwd] : args;
|
|
55
|
-
};
|
|
56
|
-
returnCode = await runCompiler({
|
|
57
|
-
argv: [handleConfigOption, handleProjectOption].reduce((args, handler) => handler(args), buildArgs),
|
|
58
|
-
env: options.env,
|
|
59
|
-
cwd: options.cwd,
|
|
60
|
-
onStdout: options.onStdout,
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
program
|
|
64
|
-
.command("test")
|
|
65
|
-
.description("Run unit tests via WARPO test runner")
|
|
66
|
-
.helpOption(false)
|
|
67
|
-
.allowUnknownOption(true)
|
|
68
|
-
.argument("[testArgs...]", "Arguments passed through to the test runner")
|
|
69
|
-
.action(async () => {
|
|
70
|
-
const index = args.indexOf("test");
|
|
71
|
-
const testArgs = index === -1 ? [] : args.slice(index + 1);
|
|
72
|
-
returnCode = await runUnitTestsFromCliArgs(testArgs);
|
|
73
|
-
});
|
|
74
|
-
await program.parseAsync(args, { from: "user" });
|
|
75
|
-
return returnCode;
|
|
76
|
-
}
|
|
77
|
-
if (typeof processArgv[1] === "string" && import.meta.url === pathToFileURL(processArgv[1]).href) {
|
|
78
|
-
main({ argv: processArgv.slice(2), env: processEnv })
|
|
79
|
-
.then((code) => processExit(code))
|
|
80
|
-
.catch(() => {
|
|
81
|
-
processExit(255);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
5
|
+
import { main } from "./warpo_internal.js";
|
|
6
|
+
main({ argv: processArgv.slice(2), env: processEnv })
|
|
7
|
+
.then((code) => processExit(code))
|
|
8
|
+
.catch(() => {
|
|
9
|
+
processExit(255);
|
|
10
|
+
});
|
|
84
11
|
//# sourceMappingURL=warpo.js.map
|
package/dist/warpo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warpo.js","sourceRoot":"","sources":["../tools/warpo.ts"],"names":[],"mappings":";AAEA,oCAAoC;AACpC,sCAAsC;AAEtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"warpo.js","sourceRoot":"","sources":["../tools/warpo.ts"],"names":[],"mappings":";AAEA,oCAAoC;AACpC,sCAAsC;AAEtC,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,GAAG,IAAI,UAAU,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;KAClD,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;KACjC,KAAK,CAAC,GAAG,EAAE;IACV,WAAW,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Copyright (C) 2026 wasm-ecosystem
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
import { build as runCompiler } from "./scripts/lib.js";
|
|
7
|
+
import { runFromCliArgs as runUnitTestsFromCliArgs } from "./test_runner/cli.js";
|
|
8
|
+
const warpoRoot = join(import.meta.dirname, "..");
|
|
9
|
+
function getVersion() {
|
|
10
|
+
try {
|
|
11
|
+
return JSON.parse(readFileSync(join(warpoRoot, "package.json"), "utf8")).version;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return "unknown";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export async function main(options) {
|
|
18
|
+
const args = options.argv;
|
|
19
|
+
// Preserve legacy behavior: direct compiler invocation when not using subcommands.
|
|
20
|
+
const first = args[0];
|
|
21
|
+
if (first !== undefined &&
|
|
22
|
+
first !== "build" &&
|
|
23
|
+
first !== "test" &&
|
|
24
|
+
first !== "-h" &&
|
|
25
|
+
first !== "--help" &&
|
|
26
|
+
first !== "--version" &&
|
|
27
|
+
first !== "-v") {
|
|
28
|
+
return await runCompiler({ argv: args, env: options.env, cwd: options.cwd });
|
|
29
|
+
}
|
|
30
|
+
let returnCode = 0;
|
|
31
|
+
const program = new Command();
|
|
32
|
+
program.name("warpo").description("compiler + tooling");
|
|
33
|
+
program.showHelpAfterError(true);
|
|
34
|
+
program.version(getVersion(), "-v, --version", "Print version");
|
|
35
|
+
program
|
|
36
|
+
.command("build")
|
|
37
|
+
.description("Build AssemblyScript project via WARPO compiler")
|
|
38
|
+
.allowUnknownOption(true)
|
|
39
|
+
.argument("[buildArgs...]", "Arguments passed through to warpo_asc")
|
|
40
|
+
.action(async () => {
|
|
41
|
+
const index = args.indexOf("build");
|
|
42
|
+
const buildArgs = index === -1 ? [] : args.slice(index + 1);
|
|
43
|
+
const cwd = options.cwd ?? process.cwd();
|
|
44
|
+
const handleConfigOption = (args) => {
|
|
45
|
+
const configPath = join(cwd, "asconfig.json");
|
|
46
|
+
const hasConfig = args.includes("--config") || args.includes("-c");
|
|
47
|
+
return !hasConfig && existsSync(configPath) ? [...args, "--config", configPath] : args;
|
|
48
|
+
};
|
|
49
|
+
const handleProjectOption = (args) => {
|
|
50
|
+
const hasProject = args.includes("--project") || args.includes("-p");
|
|
51
|
+
return !hasProject && existsSync(join(cwd, "create.ts")) ? [...args, "--project", cwd] : args;
|
|
52
|
+
};
|
|
53
|
+
returnCode = await runCompiler({
|
|
54
|
+
argv: [handleConfigOption, handleProjectOption].reduce((args, handler) => handler(args), buildArgs),
|
|
55
|
+
env: options.env,
|
|
56
|
+
cwd: options.cwd,
|
|
57
|
+
onStdout: options.onStdout,
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
program
|
|
61
|
+
.command("test")
|
|
62
|
+
.description("Run unit tests via WARPO test runner")
|
|
63
|
+
.helpOption(false)
|
|
64
|
+
.allowUnknownOption(true)
|
|
65
|
+
.argument("[testArgs...]", "Arguments passed through to the test runner")
|
|
66
|
+
.action(async () => {
|
|
67
|
+
const index = args.indexOf("test");
|
|
68
|
+
const testArgs = index === -1 ? [] : args.slice(index + 1);
|
|
69
|
+
returnCode = await runUnitTestsFromCliArgs(testArgs);
|
|
70
|
+
});
|
|
71
|
+
await program.parseAsync(args, { from: "user" });
|
|
72
|
+
return returnCode;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=warpo_internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warpo_internal.js","sourceRoot":"","sources":["../tools/warpo_internal.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,k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AAG,MAAM,WAAW,CAAC;YAC7B,IAAI,EAAE,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;YACnG,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACL,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,sCAAsC,CAAC;SACnD,UAAU,CAAC,KAAK,CAAC;SACjB,kBAAkB,CAAC,IAAI,CAAC;SACxB,QAAQ,CAAC,eAAe,EAAE,6CAA6C,CAAC;SACxE,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC3D,UAAU,GAAG,MAAM,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEL,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IACjD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "warpo",
|
|
3
|
-
"version": "2.5.0-alpha-
|
|
3
|
+
"version": "2.5.0-alpha-3",
|
|
4
4
|
"description": "next generation AssemblyScript compiler with optimizations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"types"
|
|
52
52
|
],
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@assemblyscript/loader": "^0.28.9",
|
|
55
54
|
"@eslint/js": "^9.0.0",
|
|
56
55
|
"@types/fs-extra": "^11.0.4",
|
|
57
56
|
"@types/node": "^22.15.21",
|
|
@@ -60,7 +59,6 @@
|
|
|
60
59
|
"@vscode/vsce": "^3.0.0",
|
|
61
60
|
"assemblyscript": "^0.28.9",
|
|
62
61
|
"assemblyscript-prettier": "^3.0.4",
|
|
63
|
-
"chalk": "^5.6.2",
|
|
64
62
|
"cross-env": "^10.1.0",
|
|
65
63
|
"cspell": "^9.3.0",
|
|
66
64
|
"diff": "^8.0.0",
|
|
@@ -73,7 +71,7 @@
|
|
|
73
71
|
"eslint-plugin-unicorn": "^63.0.0",
|
|
74
72
|
"eslint-plugin-unused-imports": "^4.4.1",
|
|
75
73
|
"expect": "^30.2.0",
|
|
76
|
-
"
|
|
74
|
+
"mermaid": "^11.13.0",
|
|
77
75
|
"prettier": "^3.8.1",
|
|
78
76
|
"tsx": "^4.0.0",
|
|
79
77
|
"typescript": "^5.8.3",
|
|
@@ -81,12 +79,14 @@
|
|
|
81
79
|
"vitepress": "^2.0.0-alpha.15"
|
|
82
80
|
},
|
|
83
81
|
"dependencies": {
|
|
82
|
+
"@assemblyscript/loader": "^0.28.9",
|
|
84
83
|
"@vscode/debugadapter": "^1.68.0",
|
|
85
84
|
"@vscode/debugprotocol": "^1.68.0",
|
|
85
|
+
"chalk": "^5.6.2",
|
|
86
86
|
"commander": "^14.0.3",
|
|
87
87
|
"fs-extra": "^11.3.3",
|
|
88
88
|
"glob": "^13.0.0",
|
|
89
|
-
"
|
|
89
|
+
"ignore": "^7.0.5",
|
|
90
90
|
"source-map": "^0.7.6"
|
|
91
91
|
}
|
|
92
92
|
}
|