warpo 2.0.0 → 2.1.0-beta-1

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/README.md CHANGED
@@ -2,38 +2,17 @@
2
2
 
3
3
  next generation assemblyscript compiler
4
4
 
5
- ## quick start
5
+ Seamlessly migrate from TypeScript to developing WebAssembly modules!
6
6
 
7
- config `tsconfig.json` like below.
7
+ ## Documents
8
8
 
9
- ```json
10
- {
11
- "extends": "warpo/tsconfig-warpo.json",
12
- "include": ["./**/*.ts"]
13
- }
14
- ```
9
+ https://wasm-ecosystem.github.io/warpo/
15
10
 
16
- write ts code in `assembly/index.ts`
17
-
18
- ```bash
19
- export function add(a: i32, b: i32): i32 {
20
- return a + b;
21
- }
22
- ```
23
-
24
- ```bash
25
- node node_modules/.bin/warpo assembly/index.ts -o build/debug.wat
26
- node node_modules/.bin/warpo assembly/index.ts -o build/release.wasm --optimizeLevel 3 --shrinkLevel 2
27
- npx warpo assembly/index.ts -o build/debug.wat # simplify with npx
28
- npx warpo -h # for more cli options
29
- ```
30
-
31
- ## language
11
+ ## Acknowledgment
32
12
 
33
13
  - [Assemblyscript](https://www.assemblyscript.org/)
34
- - warpo new features: WIP
35
- - [warpo optimization](https://wasm-ecosystem.github.io/warpo/)
14
+ - [binaryen](https://github.com/WebAssembly/binaryen)
36
15
 
37
- ## developer
16
+ ## for Developer
38
17
 
39
18
  see [CONTRIBUTING](./CONTRIBUTING.md)
@@ -0,0 +1,5 @@
1
+ // Copyright (C) 2025 wasm-ecosystem
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export declare function getCreateFileDirName(): string;
5
+ export declare function onModuleResolve(callbackFnIndex: i32, rtId: i32): void;
@@ -0,0 +1,5 @@
1
+ import * as api from "./__warpo_create";
2
+ import { __collect } from "rt/itcms";
3
+
4
+ __collect(); // trigger GC to ensure the env is loaded.
5
+ export const __dirname: string = api.getCreateFileDirName();
@@ -0,0 +1,17 @@
1
+ // Copyright (C) 2025 wasm-ecosystem
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import * as api from "./__warpo_create";
5
+
6
+ export class ModuleResolve {
7
+ packageName!: string;
8
+ private packagePath: string | null = null;
9
+ setPackagePath(packagePath: string): void {
10
+ this.packagePath = packagePath;
11
+ }
12
+ }
13
+
14
+ export type Fn = (task: ModuleResolve) => void;
15
+ export function onModuleResolve(fn: Fn): void {
16
+ api.onModuleResolve(fn.index, idof<ModuleResolve>());
17
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../tsconfig-warpo.json",
3
+ "include": ["./**/*.ts"]
4
+ }
package/dist/warpo.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  import * as os from "node:os";
2
3
  import { execSync, spawn } from "node:child_process";
3
4
  import { existsSync, readFileSync } from "node:fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warpo",
3
- "version": "2.0.0",
3
+ "version": "2.1.0-beta-1",
4
4
  "description": "next generation AssemblyScript compiler with optimizations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,14 +10,19 @@
10
10
  "build:ts": "tsc -p tools/scripts/tsconfig.json",
11
11
  "build:cpp": "cmake -S . -B build && cmake --build build --parallel",
12
12
  "build": "npm run build:ts && npm run build:cpp",
13
- "test:ut": "./build/passes/warpo_passes_test && ./build/support/warpo_support_test",
14
- "test:as:snapshot": "./build/tests/frontend/warpo_frontend_test",
13
+ "test:ut": "cd build && ctest --output-on-failure",
14
+ "test:as:snapshot": "cross-env-shell ./build/tests/frontend/warpo_frontend_test",
15
15
  "test:opt:snapshot": "node tests/snapshot_diff/index.mjs",
16
16
  "test:bootstrap:debug": "./tests/bootstrap/debug.sh",
17
17
  "test:bootstrap:release": "./tests/bootstrap/release.sh",
18
- "test": "npm run test:ut && npm run test:as:snapshot && npm run test:opt:snapshot && npm run test:bootstrap:debug && npm run test:bootstrap:release",
18
+ "test:debug_symbol": "cross-env-shell ./build/tests/DebugSymbol/TestDebugSymbol",
19
+ "test:debug_symbol:update": "cross-env-shell build/tests/DebugSymbol/TestDebugSymbol --update-fixtures",
20
+ "test:driver": "node tests/driver/index.mjs",
21
+ "test": "npm run test:ut && npm run test:as:snapshot && npm run test:opt:snapshot && npm run test:driver && npm run test:debug_symbol && npm run test:bootstrap:debug && npm run test:bootstrap:release",
19
22
  "docs:dev": "vitepress dev docs",
20
- "docs:build": "vitepress build docs"
23
+ "docs:build": "vitepress build docs",
24
+ "prettier": "prettier --check .",
25
+ "prettier:fix": "prettier --write ."
21
26
  },
22
27
  "license": "Apache-2.0",
23
28
  "keywords": [
@@ -28,6 +33,7 @@
28
33
  ],
29
34
  "author": "congcong.cai@bmw.com",
30
35
  "files": [
36
+ "create",
31
37
  "dist",
32
38
  "types",
33
39
  "tsconfig-warpo.json",
@@ -35,10 +41,13 @@
35
41
  "assemblyscript/std/assembly/index.d.ts"
36
42
  ],
37
43
  "devDependencies": {
44
+ "@assemblyscript/loader": "^0.28.9",
38
45
  "@types/node": "^22.15.21",
39
46
  "assemblyscript": "^0.28.4",
40
47
  "assemblyscript-prettier": "^3.0.1",
41
- "diff": "^7.0.0",
48
+ "cross-env": "^10.1.0",
49
+ "chalk": "^5.6.2",
50
+ "diff": "^8.0.0",
42
51
  "prettier": "^3.6.2",
43
52
  "typescript": "^5.8.3",
44
53
  "vitepress": "^1.6.3"
@@ -8,3 +8,7 @@ declare namespace utf8 {
8
8
  }
9
9
  function build(s: string): ConstStr;
10
10
  }
11
+
12
+ declare module "rt/itcms" {
13
+ export function __collect(): void;
14
+ }