@loopdive/js2 0.57.0
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 +1425 -0
- package/LICENSE +189 -0
- package/README.md +451 -0
- package/dist/checker/index.d.ts +117 -0
- package/dist/checker/language-service.d.ts +39 -0
- package/dist/checker/node-capability-map.d.ts +63 -0
- package/dist/checker/type-mapper.d.ts +84 -0
- package/dist/cjs-rewrite.d.ts +19 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +363 -0
- package/dist/codegen/accessor-driver.d.ts +97 -0
- package/dist/codegen/any-helpers.d.ts +72 -0
- package/dist/codegen/array-element-typing.d.ts +46 -0
- package/dist/codegen/array-holes.d.ts +69 -0
- package/dist/codegen/array-methods.d.ts +68 -0
- package/dist/codegen/array-object-proto.d.ts +64 -0
- package/dist/codegen/array-reduce-fusion.d.ts +31 -0
- package/dist/codegen/array-to-primitive.d.ts +28 -0
- package/dist/codegen/async-cps.d.ts +239 -0
- package/dist/codegen/async-scheduler.d.ts +349 -0
- package/dist/codegen/binary-ops.d.ts +78 -0
- package/dist/codegen/binding-info.d.ts +31 -0
- package/dist/codegen/builtin-scaffold.d.ts +98 -0
- package/dist/codegen/builtin-static-globals.d.ts +8 -0
- package/dist/codegen/builtin-tags.d.ts +189 -0
- package/dist/codegen/case-convert-native.d.ts +12 -0
- package/dist/codegen/case-tables.d.ts +4 -0
- package/dist/codegen/class-bodies.d.ts +41 -0
- package/dist/codegen/class-member-keys.d.ts +33 -0
- package/dist/codegen/class-to-primitive.d.ts +39 -0
- package/dist/codegen/closed-method-dispatch.d.ts +42 -0
- package/dist/codegen/closures.d.ts +285 -0
- package/dist/codegen/coercion-engine.d.ts +154 -0
- package/dist/codegen/coercion-plan.d.ts +29 -0
- package/dist/codegen/context/bodies.d.ts +4 -0
- package/dist/codegen/context/create-context.d.ts +4 -0
- package/dist/codegen/context/errors.d.ts +39 -0
- package/dist/codegen/context/locals.d.ts +69 -0
- package/dist/codegen/context/source-pos.d.ts +5 -0
- package/dist/codegen/context/speculative.d.ts +95 -0
- package/dist/codegen/context/types.d.ts +1936 -0
- package/dist/codegen/custom-iterable.d.ts +34 -0
- package/dist/codegen/dataview-native.d.ts +51 -0
- package/dist/codegen/date-parse-native.d.ts +13 -0
- package/dist/codegen/dead-elimination.d.ts +26 -0
- package/dist/codegen/declarations.d.ts +147 -0
- package/dist/codegen/deno-api.d.ts +11 -0
- package/dist/codegen/destructuring-params.d.ts +102 -0
- package/dist/codegen/dyn-read.d.ts +26 -0
- package/dist/codegen/eval-tiering.d.ts +19 -0
- package/dist/codegen/expressions/assignment.d.ts +61 -0
- package/dist/codegen/expressions/builtins.d.ts +26 -0
- package/dist/codegen/expressions/calls-closures.d.ts +54 -0
- package/dist/codegen/expressions/calls-guards.d.ts +49 -0
- package/dist/codegen/expressions/calls-optional.d.ts +4 -0
- package/dist/codegen/expressions/calls.d.ts +83 -0
- package/dist/codegen/expressions/eval-inline.d.ts +24 -0
- package/dist/codegen/expressions/extern.d.ts +67 -0
- package/dist/codegen/expressions/fnctor-prototype.d.ts +52 -0
- package/dist/codegen/expressions/helpers.d.ts +212 -0
- package/dist/codegen/expressions/identifiers.d.ts +57 -0
- package/dist/codegen/expressions/late-imports.d.ts +81 -0
- package/dist/codegen/expressions/logical-ops.d.ts +18 -0
- package/dist/codegen/expressions/misc.d.ts +27 -0
- package/dist/codegen/expressions/new-super.d.ts +25 -0
- package/dist/codegen/expressions/promise-subclass.d.ts +38 -0
- package/dist/codegen/expressions/proto-override.d.ts +63 -0
- package/dist/codegen/expressions/unary-updates.d.ts +21 -0
- package/dist/codegen/expressions/unary.d.ts +6 -0
- package/dist/codegen/expressions.d.ts +31 -0
- package/dist/codegen/fallback-telemetry.d.ts +53 -0
- package/dist/codegen/fixups.d.ts +80 -0
- package/dist/codegen/fmod.d.ts +10 -0
- package/dist/codegen/fnctor-escape-gate.d.ts +92 -0
- package/dist/codegen/function-body.d.ts +52 -0
- package/dist/codegen/generators-native.d.ts +92 -0
- package/dist/codegen/helpers/body-references-own-this.d.ts +22 -0
- package/dist/codegen/helpers/body-uses-arguments.d.ts +12 -0
- package/dist/codegen/helpers/is-strict-function.d.ts +52 -0
- package/dist/codegen/host-import-allowlist.d.ts +140 -0
- package/dist/codegen/index.d.ts +500 -0
- package/dist/codegen/ir-tail-call.d.ts +8 -0
- package/dist/codegen/iterator-native.d.ts +44 -0
- package/dist/codegen/json-codec-native.d.ts +78 -0
- package/dist/codegen/json-runtime.d.ts +35 -0
- package/dist/codegen/json-standalone.d.ts +25 -0
- package/dist/codegen/linear-uint8-analysis.d.ts +46 -0
- package/dist/codegen/linear-uint8-arena.d.ts +7 -0
- package/dist/codegen/linear-uint8-codegen.d.ts +103 -0
- package/dist/codegen/linear-uint8-signatures.d.ts +26 -0
- package/dist/codegen/literals.d.ts +115 -0
- package/dist/codegen/map-runtime.d.ts +142 -0
- package/dist/codegen/math-helpers.d.ts +7 -0
- package/dist/codegen/member-get-dispatch.d.ts +42 -0
- package/dist/codegen/member-set-dispatch.d.ts +28 -0
- package/dist/codegen/native-proto.d.ts +98 -0
- package/dist/codegen/native-regex.d.ts +158 -0
- package/dist/codegen/native-strings.d.ts +146 -0
- package/dist/codegen/new-target.d.ts +30 -0
- package/dist/codegen/node-fs-api.d.ts +47 -0
- package/dist/codegen/number-format-native.d.ts +9 -0
- package/dist/codegen/number-ryu.d.ts +27 -0
- package/dist/codegen/object-ops.d.ts +94 -0
- package/dist/codegen/object-runtime.d.ts +171 -0
- package/dist/codegen/parse-number-native.d.ts +10 -0
- package/dist/codegen/peephole.d.ts +6 -0
- package/dist/codegen/property-access.d.ts +294 -0
- package/dist/codegen/raw-wasi-api.d.ts +13 -0
- package/dist/codegen/regex/bytecode.d.ts +140 -0
- package/dist/codegen/regex/casefold.d.ts +41 -0
- package/dist/codegen/regex/compile.d.ts +51 -0
- package/dist/codegen/regex/parse.d.ts +76 -0
- package/dist/codegen/regex/unicode.d.ts +42 -0
- package/dist/codegen/regex/vm.d.ts +24 -0
- package/dist/codegen/regexp-standalone.d.ts +350 -0
- package/dist/codegen/registry/error-types.d.ts +38 -0
- package/dist/codegen/registry/imports.d.ts +46 -0
- package/dist/codegen/registry/types.d.ts +59 -0
- package/dist/codegen/set-algebra.d.ts +17 -0
- package/dist/codegen/set-runtime.d.ts +74 -0
- package/dist/codegen/shared.d.ts +111 -0
- package/dist/codegen/stack-balance.d.ts +43 -0
- package/dist/codegen/statements/control-flow.d.ts +25 -0
- package/dist/codegen/statements/destructuring.d.ts +177 -0
- package/dist/codegen/statements/exceptions.d.ts +11 -0
- package/dist/codegen/statements/functions.d.ts +1 -0
- package/dist/codegen/statements/index.d.ts +1 -0
- package/dist/codegen/statements/loops.d.ts +7 -0
- package/dist/codegen/statements/nested-declarations.d.ts +78 -0
- package/dist/codegen/statements/shared.d.ts +38 -0
- package/dist/codegen/statements/tdz.d.ts +43 -0
- package/dist/codegen/statements/variables.d.ts +3 -0
- package/dist/codegen/statements.d.ts +9 -0
- package/dist/codegen/string-builder.d.ts +131 -0
- package/dist/codegen/string-ops.d.ts +87 -0
- package/dist/codegen/struct-accessor-closure.d.ts +36 -0
- package/dist/codegen/symbol-native.d.ts +55 -0
- package/dist/codegen/temporal-native.d.ts +8 -0
- package/dist/codegen/timsort.d.ts +2 -0
- package/dist/codegen/type-coercion.d.ts +123 -0
- package/dist/codegen/typeof-delete.d.ts +38 -0
- package/dist/codegen/uri-encoding-native.d.ts +33 -0
- package/dist/codegen/value-tags.d.ts +74 -0
- package/dist/codegen/walk-instructions.d.ts +20 -0
- package/dist/codegen/weak-collections-runtime.d.ts +16 -0
- package/dist/codegen/with-scope.d.ts +106 -0
- package/dist/codegen-linear/c-abi.d.ts +74 -0
- package/dist/codegen-linear/context.d.ts +86 -0
- package/dist/codegen-linear/index.d.ts +28 -0
- package/dist/codegen-linear/layout.d.ts +39 -0
- package/dist/codegen-linear/runtime.d.ts +161 -0
- package/dist/codegen-linear/simd.d.ts +7 -0
- package/dist/compiler/define-substitution.d.ts +27 -0
- package/dist/compiler/early-errors/assignment.d.ts +26 -0
- package/dist/compiler/early-errors/context.d.ts +17 -0
- package/dist/compiler/early-errors/duplicates.d.ts +20 -0
- package/dist/compiler/early-errors/index.d.ts +11 -0
- package/dist/compiler/early-errors/labels.d.ts +13 -0
- package/dist/compiler/early-errors/module-rules.d.ts +36 -0
- package/dist/compiler/early-errors/node-checks.d.ts +7 -0
- package/dist/compiler/early-errors/predicates.d.ts +140 -0
- package/dist/compiler/early-errors/tdz.d.ts +17 -0
- package/dist/compiler/import-manifest.d.ts +18 -0
- package/dist/compiler/output.d.ts +46 -0
- package/dist/compiler/validation.d.ts +45 -0
- package/dist/compiler.d.ts +48 -0
- package/dist/define-substitution-BcUeKC2A.js +109 -0
- package/dist/emit/binary.d.ts +50 -0
- package/dist/emit/c-header.d.ts +23 -0
- package/dist/emit/canonical-recgroup.d.ts +86 -0
- package/dist/emit/encoder.d.ts +28 -0
- package/dist/emit/object.d.ts +14 -0
- package/dist/emit/opcodes.d.ts +464 -0
- package/dist/emit/sourcemap.d.ts +33 -0
- package/dist/emit/wat.d.ts +6 -0
- package/dist/env.d.ts +46 -0
- package/dist/import-resolver.d.ts +68 -0
- package/dist/index.d.ts +486 -0
- package/dist/index.js +755 -0
- package/dist/ir/alloc-registry.d.ts +75 -0
- package/dist/ir/analysis/encoding.d.ts +38 -0
- package/dist/ir/analysis/escape.d.ts +32 -0
- package/dist/ir/analysis/lattice.d.ts +72 -0
- package/dist/ir/analysis/ownership.d.ts +31 -0
- package/dist/ir/analysis/stack-alloc.d.ts +20 -0
- package/dist/ir/backend/bytecode-emitter.d.ts +237 -0
- package/dist/ir/backend/bytecode-vm.d.ts +74 -0
- package/dist/ir/backend/emitter.d.ts +121 -0
- package/dist/ir/backend/handles.d.ts +133 -0
- package/dist/ir/backend/legality.d.ts +9 -0
- package/dist/ir/backend/linear-emitter.d.ts +41 -0
- package/dist/ir/backend/wasmgc-emitter.d.ts +43 -0
- package/dist/ir/builder.d.ts +401 -0
- package/dist/ir/from-ast.d.ts +192 -0
- package/dist/ir/index.d.ts +16 -0
- package/dist/ir/integration.d.ts +27 -0
- package/dist/ir/lower.d.ts +203 -0
- package/dist/ir/nodes.d.ts +1452 -0
- package/dist/ir/passes/alloc-discipline.d.ts +19 -0
- package/dist/ir/passes/constant-fold.d.ts +7 -0
- package/dist/ir/passes/dead-code.d.ts +18 -0
- package/dist/ir/passes/inline-small.d.ts +7 -0
- package/dist/ir/passes/monomorphize.d.ts +21 -0
- package/dist/ir/passes/simplify-cfg.d.ts +19 -0
- package/dist/ir/passes/tagged-union-types.d.ts +45 -0
- package/dist/ir/passes/tagged-unions.d.ts +22 -0
- package/dist/ir/propagate.d.ts +135 -0
- package/dist/ir/select.d.ts +81 -0
- package/dist/ir/types.d.ts +832 -0
- package/dist/ir/verify-alloc.d.ts +18 -0
- package/dist/ir/verify.d.ts +7 -0
- package/dist/link/index.d.ts +11 -0
- package/dist/link/isolation.d.ts +24 -0
- package/dist/link/linker.d.ts +37 -0
- package/dist/link/reader.d.ts +158 -0
- package/dist/link/resolver.d.ts +19 -0
- package/dist/optimize.d.ts +54 -0
- package/dist/optimize.js +262 -0
- package/dist/position-map.d.ts +64 -0
- package/dist/process-stdin-prelude.d.ts +16 -0
- package/dist/resolve.d.ts +82 -0
- package/dist/runtime/builtins.d.ts +1 -0
- package/dist/runtime-C-4q_KwU.js +164438 -0
- package/dist/runtime-containment.d.ts +6 -0
- package/dist/runtime-eval.d.ts +132 -0
- package/dist/runtime-instantiate.d.ts +16 -0
- package/dist/runtime.d.ts +128 -0
- package/dist/runtime.js +12 -0
- package/dist/shape-inference.d.ts +20 -0
- package/dist/treeshake.d.ts +17 -0
- package/dist/ts-api.d.ts +30 -0
- package/dist/wit-generator.d.ts +18 -0
- package/package.json +187 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ImportIntent } from './index.js';
|
|
2
|
+
/** Wrap an extern_class import function with DOM containment logic.
|
|
3
|
+
* Restricts DOM access to the subtree rooted at `domRoot`. */
|
|
4
|
+
export declare function wrapWithContainment(fn: Function, intent: ImportIntent & {
|
|
5
|
+
type: "extern_class";
|
|
6
|
+
}, domRoot: Element | ShadowRoot): Function;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dynamic eval host shim (#1164).
|
|
3
|
+
*
|
|
4
|
+
* Polyfill of the long-term `func.new` Wasm JIT-interface proposal: when a
|
|
5
|
+
* compiled module calls `__extern_eval(src, isDirect)` at runtime, we
|
|
6
|
+
* re-enter the js2wasm pipeline, compile the eval string to a fresh Wasm
|
|
7
|
+
* module, instantiate it via `WebAssembly.compile` + `WebAssembly.instantiate`,
|
|
8
|
+
* and return the result.
|
|
9
|
+
*
|
|
10
|
+
* ## Why not `(0, eval)(src)`?
|
|
11
|
+
*
|
|
12
|
+
* The original #1006 implementation used the host JS `eval`. Two problems:
|
|
13
|
+
*
|
|
14
|
+
* 1. **Capability leak.** `(0, eval)(src)` runs in the JS global scope and
|
|
15
|
+
* gets unrestricted access to `window`, `document`, `fetch`, `require`,
|
|
16
|
+
* the `Function` constructor (allowing further dynamic codegen), and any
|
|
17
|
+
* globally-assigned variables. The Wasm sandbox vanishes the moment we
|
|
18
|
+
* hit the host.
|
|
19
|
+
* 2. **CSP-blocked.** `script-src` without `'unsafe-eval'` blocks the host
|
|
20
|
+
* `eval` builtin. Many production deployments cannot grant that
|
|
21
|
+
* directive. Wasm compilation needs only `'wasm-unsafe-eval'` — a
|
|
22
|
+
* narrower, separately-grantable capability.
|
|
23
|
+
*
|
|
24
|
+
* ## Capability model
|
|
25
|
+
*
|
|
26
|
+
* The child Wasm module receives only the imports the host explicitly
|
|
27
|
+
* forwards in `selectiveImports`. A host that wants maximum isolation
|
|
28
|
+
* passes `{}` — the child gets a pure Wasm sandbox with no JS surface at
|
|
29
|
+
* all. A host that wants the same surface as the parent forwards the
|
|
30
|
+
* parent's `imports` object.
|
|
31
|
+
*
|
|
32
|
+
* **`__extern_eval` is itself a capability.** Hosts that do not link this
|
|
33
|
+
* import cause the parent's eval calls to trap at instantiation, rather
|
|
34
|
+
* than escaping into JS.
|
|
35
|
+
*
|
|
36
|
+
* ## Synchronous semantics
|
|
37
|
+
*
|
|
38
|
+
* `eval` in JS is synchronous — the calling code expects a value back.
|
|
39
|
+
* `WebAssembly.compile` is async, but `WebAssembly.Module(bytes)` is sync.
|
|
40
|
+
* We use the sync path to keep `__extern_eval` synchronous from the Wasm
|
|
41
|
+
* caller's perspective.
|
|
42
|
+
*
|
|
43
|
+
* ## What this does NOT do
|
|
44
|
+
*
|
|
45
|
+
* - Direct-eval scope capture (caller variables visible inside the eval
|
|
46
|
+
* string) — the child module is a fresh compilation unit; it has no
|
|
47
|
+
* visibility into the parent's locals. Tracked in #1073.
|
|
48
|
+
* - Standalone / WASI eval — see #1165 for the `func.new` native path.
|
|
49
|
+
* - Async eval — synchronous only; async strings (top-level `await`, etc.)
|
|
50
|
+
* are a separate concern.
|
|
51
|
+
*
|
|
52
|
+
* ## Long-term path
|
|
53
|
+
*
|
|
54
|
+
* When the [Wasm JIT-interface proposal](https://github.com/WebAssembly/jit-interface)
|
|
55
|
+
* ships `func.new`, eval becomes a pure-Wasm operation:
|
|
56
|
+
*
|
|
57
|
+
* 1. Compile the eval string → bytes (using js2wasm compiled to Wasm)
|
|
58
|
+
* 2. Write bytes to linear memory
|
|
59
|
+
* 3. `func.new` → `funcref`
|
|
60
|
+
* 4. Call it
|
|
61
|
+
*
|
|
62
|
+
* This shim is a direct polyfill of that flow against the JS Wasm API.
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* Options for {@link createEvalShim}.
|
|
66
|
+
*/
|
|
67
|
+
export interface EvalShimOptions {
|
|
68
|
+
/**
|
|
69
|
+
* Imports to forward to the child Wasm module. Anything listed here
|
|
70
|
+
* overrides the auto-generated defaults.
|
|
71
|
+
*
|
|
72
|
+
* By default the shim builds a fully-functional import object for the
|
|
73
|
+
* child module from the child's own declared imports (via
|
|
74
|
+
* {@link buildImports}). This gives the child access to the standard
|
|
75
|
+
* js2wasm runtime helpers (`__box_number`, `__get_undefined`, etc.) so
|
|
76
|
+
* that any expression form the compiler emits actually instantiates.
|
|
77
|
+
*
|
|
78
|
+
* To produce a *strict* sandbox with no JS surface beyond Wasm built-ins,
|
|
79
|
+
* pass `sandbox: true` (see below). To merge custom imports on top of
|
|
80
|
+
* the defaults, pass `selectiveImports: { env: { customFn: ... } }`.
|
|
81
|
+
*/
|
|
82
|
+
selectiveImports?: WebAssembly.Imports;
|
|
83
|
+
/**
|
|
84
|
+
* If `true`, do NOT auto-fill js2wasm runtime helpers — only the imports
|
|
85
|
+
* provided in `selectiveImports` (plus minimal `string_constants` /
|
|
86
|
+
* `wasm:js-string` shims) are available to the child. Function imports
|
|
87
|
+
* the child declares but the host doesn't provide become trapping stubs
|
|
88
|
+
* that throw `ReferenceError` when called.
|
|
89
|
+
*
|
|
90
|
+
* Use this for capability-restricted execution: the child cannot box
|
|
91
|
+
* numbers, allocate JS strings outside the literal pool, throw exceptions
|
|
92
|
+
* with messages, etc. Most non-trivial eval strings will fail to
|
|
93
|
+
* instantiate or throw at first runtime use of an unprovided helper.
|
|
94
|
+
*
|
|
95
|
+
* Default: `false` — auto-fill helpers for maximum compatibility.
|
|
96
|
+
*/
|
|
97
|
+
sandbox?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Optional identifier used as the "filename" for compiler diagnostics.
|
|
100
|
+
* Defaults to `__eval__.js`.
|
|
101
|
+
*/
|
|
102
|
+
filename?: string;
|
|
103
|
+
/**
|
|
104
|
+
* If provided, called with the result of every successful compileSource
|
|
105
|
+
* invocation — useful for telemetry or caching.
|
|
106
|
+
*/
|
|
107
|
+
onCompiled?: (info: {
|
|
108
|
+
src: string;
|
|
109
|
+
binarySize: number;
|
|
110
|
+
isDirect: boolean;
|
|
111
|
+
}) => void;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Build a `__extern_eval` host import for a JS-host runtime.
|
|
115
|
+
*
|
|
116
|
+
* Returns a function with the runtime signature
|
|
117
|
+
* `(src: any, isDirect: number) => any`.
|
|
118
|
+
*
|
|
119
|
+
* Per ECMA-262 §19.2.1 step 2: if the input is not a String, return it
|
|
120
|
+
* unchanged.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* const evalImport = createEvalShim({ selectiveImports: {} });
|
|
124
|
+
* const env = { ...otherImports, __extern_eval: evalImport };
|
|
125
|
+
*/
|
|
126
|
+
export declare function createEvalShim(options?: EvalShimOptions): (src: any, isDirect: number) => any;
|
|
127
|
+
/**
|
|
128
|
+
* Default eval shim — pure Wasm sandbox, no JS surface forwarded to the
|
|
129
|
+
* child module. Hosts that need a less restrictive policy should call
|
|
130
|
+
* {@link createEvalShim} directly with their chosen `selectiveImports`.
|
|
131
|
+
*/
|
|
132
|
+
export declare const defaultEvalShim: (src: any, isDirect: number) => any;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Instantiate a Wasm module, trying native wasm:js-string builtins first
|
|
2
|
+
* (Chrome 130+, Firefox 135+), falling back to the JS polyfill.
|
|
3
|
+
* Uses importedStringConstants to provide string literals as globals. */
|
|
4
|
+
export declare function instantiateWasm(binary: ArrayBuffer | ArrayBufferView, env: Record<string, Function>, stringConstants?: Record<string, WebAssembly.Global>): Promise<{
|
|
5
|
+
instance: WebAssembly.Instance;
|
|
6
|
+
nativeBuiltins: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
/** Instantiate a precompiled Wasm module from a Response/URL using streaming compilation
|
|
9
|
+
* when available, falling back to byte instantiation if needed.
|
|
10
|
+
* Shared runtime helpers stay outside the module-specific payload. */
|
|
11
|
+
export declare function instantiateWasmStreaming(source: Response | Promise<Response> | RequestInfo | URL, env: Record<string, Function>, stringConstants?: Record<string, WebAssembly.Global>): Promise<{
|
|
12
|
+
instance: WebAssembly.Instance;
|
|
13
|
+
nativeBuiltins: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
/** Compile TypeScript source and instantiate the Wasm module. */
|
|
16
|
+
export declare function compileAndInstantiate(source: string, deps?: Record<string, any>): Promise<WebAssembly.Exports>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { ImportDescriptor, ImportPolicy } from './index.js';
|
|
2
|
+
/** wasm:js-string polyfill for engines without native support (https://developer.mozilla.org/de/docs/WebAssembly/Guides/JavaScript_builtins) */
|
|
3
|
+
export declare const jsString: {
|
|
4
|
+
concat: (a: string, b: string) => string;
|
|
5
|
+
length: (s: string) => number;
|
|
6
|
+
equals: (a: string, b: string) => number;
|
|
7
|
+
substring: (s: string, start: number, end: number) => string;
|
|
8
|
+
charCodeAt: (s: string, i: number) => number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Build string constants object for the "string_constants" import namespace.
|
|
12
|
+
* Each string pool entry becomes a WebAssembly.Global keyed by the literal text.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildStringConstants(stringPool?: string[]): Record<string, WebAssembly.Global>;
|
|
15
|
+
/** Check a manifest against a policy blocklist before instantiation.
|
|
16
|
+
* Returns an array of violated import keys (empty if all clear). */
|
|
17
|
+
export declare function checkPolicy(manifest: ImportDescriptor[], policy: ImportPolicy): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Build a WASI polyfill for running WASI-compiled modules in JS environments.
|
|
20
|
+
* Routes fd_write(fd=1) to console.log, fd_write(fd=2) to console.error,
|
|
21
|
+
* and proc_exit to process.exit (Node) or throw (browser).
|
|
22
|
+
*
|
|
23
|
+
* Usage:
|
|
24
|
+
* const wasi = buildWasiPolyfill();
|
|
25
|
+
* const { instance } = await WebAssembly.instantiate(binary, {
|
|
26
|
+
* wasi_snapshot_preview1: wasi,
|
|
27
|
+
* env: wasi.envImports,
|
|
28
|
+
* });
|
|
29
|
+
* wasi.setMemory(instance.exports.memory as WebAssembly.Memory);
|
|
30
|
+
* (instance.exports._start as Function)();
|
|
31
|
+
*
|
|
32
|
+
* #1482: The polyfill now exposes `envImports.__wasi_env_get_str` for the
|
|
33
|
+
* `process.env.X` fast path under `--target wasi`, plus `environ_sizes_get`
|
|
34
|
+
* and `environ_get` shims (memory-writing) for true WASI hosts. The defaults
|
|
35
|
+
* read from Node's `process.env`; pass `{ env: {...} }` to override.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildWasiPolyfill(options?: {
|
|
38
|
+
env?: Record<string, string | undefined>;
|
|
39
|
+
}): {
|
|
40
|
+
fd_write: (fd: number, iovs: number, iovs_len: number, nwritten: number) => number;
|
|
41
|
+
fd_read: (fd: number, iovs: number, iovs_len: number, nread: number) => number;
|
|
42
|
+
proc_exit: (code: number) => void;
|
|
43
|
+
poll_oneoff: (in_ptr: number, out_ptr: number, nsubs: number, nevents_out: number) => number;
|
|
44
|
+
fd_fdstat_set_flags: (fd: number, flags: number) => number;
|
|
45
|
+
environ_sizes_get: (countPtr: number, bufSizePtr: number) => number;
|
|
46
|
+
environ_get: (envPtrsPtr: number, envBufPtr: number) => number;
|
|
47
|
+
clock_time_get: (clockid: number, precision: bigint, out_ptr: number) => number;
|
|
48
|
+
setMemory: (mem: WebAssembly.Memory) => void;
|
|
49
|
+
setStdin: (data: Uint8Array | string) => void;
|
|
50
|
+
envImports: Record<string, Function>;
|
|
51
|
+
};
|
|
52
|
+
/** Build the WebAssembly import object from a closed manifest */
|
|
53
|
+
export declare function buildImports(manifest: ImportDescriptor[], deps?: Record<string, any>, stringPool?: string[], options?: {
|
|
54
|
+
domRoot?: Element | ShadowRoot;
|
|
55
|
+
globalSandbox?: Record<string, any>;
|
|
56
|
+
}): {
|
|
57
|
+
env: Record<string, Function>;
|
|
58
|
+
"wasm:js-string": typeof jsString;
|
|
59
|
+
string_constants: Record<string, WebAssembly.Global>;
|
|
60
|
+
setExports?: (exports: Record<string, Function>) => void;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Wrap raw `instance.exports` so that any Wasm closure struct returned from
|
|
64
|
+
* a callable export becomes a JS-callable function (#1308).
|
|
65
|
+
*
|
|
66
|
+
* Without this wrapper, `exports.makeFn()` returns the raw Wasm closure
|
|
67
|
+
* struct — `typeof` reports `"object"`, the value is `[Object: null prototype] {}`,
|
|
68
|
+
* and direct invocation throws "is not a function". With the wrapper, the
|
|
69
|
+
* struct is replaced by a JS function that dispatches via the
|
|
70
|
+
* `__call_fn_N` exports the codegen emits (`__call_fn_0` for zero-arg
|
|
71
|
+
* closures, `__call_fn_1` for one-arg).
|
|
72
|
+
*
|
|
73
|
+
* Limitations / scope:
|
|
74
|
+
* - 0-arg closure returns: `wrapped()` works via `__call_fn_0`.
|
|
75
|
+
* - 1-arg closure returns: `wrapped(x)` works via `__call_fn_1`.
|
|
76
|
+
* - Variadic closures (`function(...args){...}`) are lifted as 0-arg
|
|
77
|
+
* functions whose body reads `arguments`. Without a JS-side path to
|
|
78
|
+
* populate `__extras_argv` + `__argc` before invoking, calling
|
|
79
|
+
* `wrapped(2)` falls through to `__call_fn_0` and the closure body
|
|
80
|
+
* sees an empty arguments object. Tracked as a follow-up.
|
|
81
|
+
* - Returned value from the wrapped closure that is itself a Wasm
|
|
82
|
+
* struct is NOT recursively wrapped — only direct returns from
|
|
83
|
+
* top-level exports. Recursive wrapping can be added if needed.
|
|
84
|
+
*
|
|
85
|
+
* Usage:
|
|
86
|
+
* ```ts
|
|
87
|
+
* const { instance } = await WebAssembly.instantiate(binary, imports);
|
|
88
|
+
* const exports = wrapExports(instance.exports);
|
|
89
|
+
* const negated = exports.negate(jsFn); // typeof === "function"
|
|
90
|
+
* negated(); // dispatches via __call_fn_0
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
/**
|
|
94
|
+
* (#1700) TS-level classification of a single export param or result slot
|
|
95
|
+
* surfaced via `CompileResult.exportSignatures`. The Wasm signature alone
|
|
96
|
+
* is ambiguous for TypedArray vs `number[]` — both lower to
|
|
97
|
+
* `(ref null $Vec[f64])` — so the JS-host wrapper consults this metadata
|
|
98
|
+
* to (a) copy a JS `Uint8Array` into a fresh Wasm vec before the call and
|
|
99
|
+
* (b) wrap the returned plain `Array<number>` back into a `Uint8Array`.
|
|
100
|
+
*/
|
|
101
|
+
export interface WrapExportsSignature {
|
|
102
|
+
params: ("uint8array" | "typed-array" | "other")[];
|
|
103
|
+
result: "uint8array" | "typed-array" | "other";
|
|
104
|
+
}
|
|
105
|
+
export declare function wrapExports(rawExports: WebAssembly.Exports, options?: {
|
|
106
|
+
marshal?: "copy" | false;
|
|
107
|
+
/** Per-export TS-level type metadata from `CompileResult.exportSignatures`
|
|
108
|
+
* (#1700). When provided, Uint8Array arguments are copied into a Wasm
|
|
109
|
+
* vec before the call and Uint8Array-typed returns are wrapped on the
|
|
110
|
+
* way out. Omitted ⇒ legacy behaviour (no per-call marshalling). */
|
|
111
|
+
signatures?: Record<string, WrapExportsSignature>;
|
|
112
|
+
}): Record<string, any>;
|
|
113
|
+
/** Instantiate a Wasm module, trying native wasm:js-string builtins first
|
|
114
|
+
* (Chrome 130+, Firefox 135+), falling back to the JS polyfill.
|
|
115
|
+
* Uses importedStringConstants to provide string literals as globals. */
|
|
116
|
+
export declare function instantiateWasm(binary: ArrayBuffer | ArrayBufferView, env: Record<string, Function>, stringConstants?: Record<string, WebAssembly.Global>): Promise<{
|
|
117
|
+
instance: WebAssembly.Instance;
|
|
118
|
+
nativeBuiltins: boolean;
|
|
119
|
+
}>;
|
|
120
|
+
/** Instantiate a precompiled Wasm module from a Response/URL using streaming compilation
|
|
121
|
+
* when available, falling back to byte instantiation if needed.
|
|
122
|
+
* Shared runtime helpers stay outside the module-specific payload. */
|
|
123
|
+
export declare function instantiateWasmStreaming(source: Response | Promise<Response> | RequestInfo | URL, env: Record<string, Function>, stringConstants?: Record<string, WebAssembly.Global>): Promise<{
|
|
124
|
+
instance: WebAssembly.Instance;
|
|
125
|
+
nativeBuiltins: boolean;
|
|
126
|
+
}>;
|
|
127
|
+
/** Compile TypeScript source and instantiate the Wasm module. */
|
|
128
|
+
export declare function compileAndInstantiate(source: string, deps?: Record<string, any>): Promise<WebAssembly.Exports>;
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { b, j, k, l, m, o, p, q, w } from "./runtime-C-4q_KwU.js";
|
|
2
|
+
export {
|
|
3
|
+
b as buildImports,
|
|
4
|
+
j as buildStringConstants,
|
|
5
|
+
k as buildWasiPolyfill,
|
|
6
|
+
l as checkPolicy,
|
|
7
|
+
m as compileAndInstantiate,
|
|
8
|
+
o as instantiateWasm,
|
|
9
|
+
p as instantiateWasmStreaming,
|
|
10
|
+
q as jsString,
|
|
11
|
+
w as wrapExports
|
|
12
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ts } from './ts-api.js';
|
|
2
|
+
export interface InferredShape {
|
|
3
|
+
/** Named fields set on the variable (e.g. "length") with inferred types */
|
|
4
|
+
fields: Map<string, {
|
|
5
|
+
type: "number" | "string" | "boolean" | "unknown";
|
|
6
|
+
}>;
|
|
7
|
+
/** Whether numeric indexing is used (obj[0] = x) */
|
|
8
|
+
hasNumericIndexing: boolean;
|
|
9
|
+
/** Type of values stored at numeric indices */
|
|
10
|
+
numericValueType: "number" | "string" | "unknown";
|
|
11
|
+
/** Whether the variable is used in Array.prototype.X.call(obj, ...) */
|
|
12
|
+
usedInCallApply: boolean;
|
|
13
|
+
/** Highest literal numeric index seen */
|
|
14
|
+
maxNumericIndex: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Collect shape information for module-level variables by walking the AST.
|
|
18
|
+
* Returns a map from variable name to inferred shape.
|
|
19
|
+
*/
|
|
20
|
+
export declare function collectShapes(checker: ts.TypeChecker, sourceFile: ts.SourceFile): Map<string, InferredShape>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ts } from './ts-api.js';
|
|
2
|
+
/**
|
|
3
|
+
* Perform tree-shaking: given entry exports and a set of source files,
|
|
4
|
+
* determine which top-level declarations are reachable.
|
|
5
|
+
*
|
|
6
|
+
* The algorithm is conservative — if in doubt, a declaration is kept.
|
|
7
|
+
*
|
|
8
|
+
* @param entryExports - Names of exports from the entry file to keep
|
|
9
|
+
* @param sourceFiles - All source files in the compilation
|
|
10
|
+
* @param checker - TypeScript type checker for resolving references
|
|
11
|
+
* @returns Set of reachable top-level declaration nodes
|
|
12
|
+
*/
|
|
13
|
+
export declare function treeshake(entryExports: string[], sourceFiles: ts.SourceFile[], checker: ts.TypeChecker): Set<ts.Node>;
|
|
14
|
+
/**
|
|
15
|
+
* Get the set of exported names from an entry source file.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getEntryExportNames(entryFile: ts.SourceFile): string[];
|
package/dist/ts-api.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
|
+
export { ts };
|
|
3
|
+
export declare const isTs7: boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Active runtime TypeScript backend. Same shape as `import * as ts from
|
|
6
|
+
* "typescript"` but possibly swapped to `@typescript/native-preview` under
|
|
7
|
+
* `--ts7`. Use this when you need behaviour that should follow the flag (e.g.
|
|
8
|
+
* `tsRuntime.createProgram(...)` at the compile entry point).
|
|
9
|
+
*
|
|
10
|
+
* Most call sites should keep using the static `import * as ts from
|
|
11
|
+
* "./ts-api.js"` form — that always points at typescript@5 and is safe for
|
|
12
|
+
* type-level access. Only swap to `tsRuntime` for code paths we explicitly
|
|
13
|
+
* want the flag to control.
|
|
14
|
+
*/
|
|
15
|
+
export declare const tsRuntime: typeof import("typescript");
|
|
16
|
+
/**
|
|
17
|
+
* Backend-agnostic `forEachChild` helper (#1290).
|
|
18
|
+
*
|
|
19
|
+
* `typescript@5` exposes `forEachChild` as a static function: `ts.forEachChild(node, cb)`.
|
|
20
|
+
* `@typescript/native-preview` exposes it as an instance method on every AST node:
|
|
21
|
+
* `node.forEachChild(cb)`. The two forms accept the same signature.
|
|
22
|
+
*
|
|
23
|
+
* This helper dispatches automatically: if `node` carries an instance method
|
|
24
|
+
* (TS7 native-preview), call it; otherwise fall back to the static TS5 form.
|
|
25
|
+
*
|
|
26
|
+
* All src tree modules should import this helper instead of calling
|
|
27
|
+
* `ts.forEachChild` directly so that codegen can iterate over either backend's
|
|
28
|
+
* AST without per-call-site changes.
|
|
29
|
+
*/
|
|
30
|
+
export declare function forEachChild<T>(node: ts.Node, cbNode: (node: ts.Node) => T | undefined, cbNodeArray?: (nodes: ts.NodeArray<ts.Node>) => T | undefined): T | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TypedAST } from './checker/index.js';
|
|
2
|
+
import { Import, TypeDef } from './ir/types.js';
|
|
3
|
+
export interface WitGeneratorOptions {
|
|
4
|
+
/** Package name for the WIT world (default: derived from the source filename) */
|
|
5
|
+
packageName?: string;
|
|
6
|
+
/** World name (default: "module") */
|
|
7
|
+
worldName?: string;
|
|
8
|
+
/** Compiled module imports to include in the world import surface. */
|
|
9
|
+
imports?: readonly Import[];
|
|
10
|
+
/** Compiled module type table used to render import function signatures. */
|
|
11
|
+
types?: readonly TypeDef[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generate a WIT interface definition from a TypedAST.
|
|
15
|
+
* Extracts all exported functions and referenced interfaces/type aliases,
|
|
16
|
+
* then maps them to WIT types.
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateWit(ast: TypedAST, options?: WitGeneratorOptions): string;
|
package/package.json
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@loopdive/js2",
|
|
3
|
+
"version": "0.57.0",
|
|
4
|
+
"description": "Direct AOT compilation from JavaScript and TypeScript to WebAssembly GC",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"webassembly",
|
|
7
|
+
"wasm",
|
|
8
|
+
"wasm-gc",
|
|
9
|
+
"compiler",
|
|
10
|
+
"typescript",
|
|
11
|
+
"aot",
|
|
12
|
+
"ahead-of-time",
|
|
13
|
+
"javascript"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://js2.loopdive.com",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/loopdive/js2.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/loopdive/js2/issues"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"module": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"author": "Thomas Tränkler <git@thomas.traenkler.com>",
|
|
28
|
+
"license": "Apache-2.0 WITH LLVM-exception",
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"bin": {
|
|
33
|
+
"js2": "./dist/cli.js",
|
|
34
|
+
"js2wasm": "./dist/cli.js"
|
|
35
|
+
},
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"import": "./dist/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./runtime": {
|
|
42
|
+
"types": "./dist/runtime.d.ts",
|
|
43
|
+
"import": "./dist/runtime.js"
|
|
44
|
+
},
|
|
45
|
+
"./optimize": {
|
|
46
|
+
"types": "./dist/optimize.d.ts",
|
|
47
|
+
"import": "./dist/optimize.js"
|
|
48
|
+
},
|
|
49
|
+
"./cli": "./dist/cli.js",
|
|
50
|
+
"./package.json": "./package.json"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"dist/",
|
|
54
|
+
"README.md",
|
|
55
|
+
"LICENSE",
|
|
56
|
+
"CHANGELOG.md"
|
|
57
|
+
],
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=20"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"binaryen": "^125.0.0",
|
|
63
|
+
"bun": ">=1.3.14",
|
|
64
|
+
"deno": ">=2.8.1"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"binaryen": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"bun": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"deno": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"typescript": "^5.7"
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@biomejs/biome": "^1",
|
|
82
|
+
"@bytecodealliance/componentize-js": "^0.20.0",
|
|
83
|
+
"@types/lodash": "^4.17.24",
|
|
84
|
+
"@types/lodash-es": "^4.17.12",
|
|
85
|
+
"@types/node": "^22",
|
|
86
|
+
"@typescript/native-preview": "^7.0.0-dev.20260502.1",
|
|
87
|
+
"axios": "^1.16.1",
|
|
88
|
+
"binaryen": "^125.0.0",
|
|
89
|
+
"bun": "1.3.14",
|
|
90
|
+
"deno": "2.8.1",
|
|
91
|
+
"esbuild": "^0.25.12",
|
|
92
|
+
"eslint": "^10.0.3",
|
|
93
|
+
"hono": "^4.12.16",
|
|
94
|
+
"husky": "^9.1.7",
|
|
95
|
+
"lint-staged": "^16.4.0",
|
|
96
|
+
"lodash": "^4.18.1",
|
|
97
|
+
"lodash-es": "^4.18.1",
|
|
98
|
+
"marked": "^18.0.2",
|
|
99
|
+
"monaco-editor": "^0.55.1",
|
|
100
|
+
"prettier": "^3.8.1",
|
|
101
|
+
"react": "^19.2.6",
|
|
102
|
+
"shiki": "^4.0.2",
|
|
103
|
+
"ts-morph": "^27.0.2",
|
|
104
|
+
"vite": "^6",
|
|
105
|
+
"vite-plugin-dts": "^4",
|
|
106
|
+
"vitest": "^3",
|
|
107
|
+
"wabt": "^1.0.39"
|
|
108
|
+
},
|
|
109
|
+
"lint-staged": {
|
|
110
|
+
"*.{ts,js,mjs}": [
|
|
111
|
+
"prettier --write",
|
|
112
|
+
"biome lint --diagnostic-level=error --no-errors-on-unmatched"
|
|
113
|
+
],
|
|
114
|
+
"*.json": "prettier --write"
|
|
115
|
+
},
|
|
116
|
+
"scripts": {
|
|
117
|
+
"release": "node scripts/release.mjs",
|
|
118
|
+
"new:issue-id": "node scripts/next-issue-id.mjs",
|
|
119
|
+
"worktree:provision": "bash scripts/provision-worktree-deps.sh",
|
|
120
|
+
"build": "vite build --config vite.config.lib.ts",
|
|
121
|
+
"build:playground": "vite build --config website/playground/vite.config.ts",
|
|
122
|
+
"dev": "pnpm run build:compiler-bundle && (pnpm run dashboard:watch &) && vite serve --config website/playground/vite.config.ts",
|
|
123
|
+
"test": "node node_modules/vitest/dist/cli.js run",
|
|
124
|
+
"test:watch": "node node_modules/vitest/dist/cli.js",
|
|
125
|
+
"test:ir:alloc": "IR_VERIFY_ALLOC=1 node node_modules/vitest/dist/cli.js run tests/ir/alloc-registry.test.ts tests/ir/alloc-provenance.test.ts",
|
|
126
|
+
"test:equivalence:gate": "node scripts/equivalence-gate.mjs",
|
|
127
|
+
"test:262": "bash scripts/run-test262-vitest.sh",
|
|
128
|
+
"test:262:validate-baseline": "npx tsx scripts/validate-test262-baseline.ts",
|
|
129
|
+
"baseline:fetch": "node scripts/fetch-baseline-jsonl.mjs",
|
|
130
|
+
"check:ir-fallbacks": "npx tsx scripts/check-ir-fallbacks.ts",
|
|
131
|
+
"gen:ir-adoption": "node scripts/gen-ir-adoption.mjs",
|
|
132
|
+
"check:ir-adoption": "node scripts/gen-ir-adoption.mjs --check",
|
|
133
|
+
"check:stack-balance": "npx tsx scripts/check-stack-balance.ts",
|
|
134
|
+
"census:async": "node scripts/async-call-census.mjs",
|
|
135
|
+
"check:codegen-fallbacks": "npx tsx scripts/check-codegen-fallbacks.ts",
|
|
136
|
+
"check:any-box-sites": "node scripts/check-any-box-sites.mjs",
|
|
137
|
+
"check:speculative-rollback": "node scripts/check-speculative-rollback-sites.mjs",
|
|
138
|
+
"check:coercion-sites": "node scripts/check-coercion-sites.mjs",
|
|
139
|
+
"check:test262-hard-errors": "node scripts/check-test262-hard-errors.mjs",
|
|
140
|
+
"check:issue-spec-coverage": "node scripts/check-issue-spec-coverage.mjs",
|
|
141
|
+
"check:issues": "node scripts/update-issues.mjs --check",
|
|
142
|
+
"test:diff": "npx tsx scripts/diff-test.ts",
|
|
143
|
+
"test:diff:triage": "npx tsx scripts/diff-triage.ts",
|
|
144
|
+
"test:diff:gate": "npx tsx scripts/diff-test-gate.ts",
|
|
145
|
+
"dogfood:acorn": "npx tsx tests/dogfood/acorn-harness.mjs",
|
|
146
|
+
"refresh:benchmarks": "npx tsx --experimental-wasm-stringref --experimental-wasm-custom-descriptors benchmarks/run.ts && pnpm run build:compiler-bundle && node --experimental-wasm-stringref --experimental-wasm-custom-descriptors scripts/generate-playground-benchmark-sidebar.mjs && node --experimental-wasm-stringref --experimental-wasm-custom-descriptors scripts/generate-playground-benchmark-sidebar-no-jit.mjs && pnpm run generate:size-benchmarks && node scripts/generate-browser-runtime-benchmarks.mjs",
|
|
147
|
+
"refresh:benchmarks:no-jit": "pnpm run build:compiler-bundle && node --experimental-wasm-stringref --experimental-wasm-custom-descriptors scripts/generate-playground-benchmark-sidebar-no-jit.mjs",
|
|
148
|
+
"refresh:benchmarks:wasmtime": "pnpm run build:compiler-bundle && node --experimental-wasm-stringref --experimental-wasm-custom-descriptors scripts/generate-wasmtime-hot-runtime.mjs",
|
|
149
|
+
"build:compiler-bundle": "esbuild scripts/compiler-bundle-entry.ts --bundle --platform=node --format=esm --outfile=scripts/compiler-bundle.mjs --external:typescript --external:binaryen --external:@typescript/native-preview --external:@typescript/native-preview/*",
|
|
150
|
+
"build:standalone-cli": "node scripts/build-standalone-cli.mjs",
|
|
151
|
+
"format": "prettier --write 'src/**/*.ts' 'tests/**/*.ts' 'scripts/**/*.ts'",
|
|
152
|
+
"format:check": "prettier --check 'src/**/*.ts' 'tests/**/*.ts' 'scripts/**/*.ts'",
|
|
153
|
+
"lint": "biome lint src tests scripts --diagnostic-level=error",
|
|
154
|
+
"typecheck": "tsc --noEmit",
|
|
155
|
+
"generate:editions": "npx tsx scripts/generate-editions.ts",
|
|
156
|
+
"generate:feature-badges": "node scripts/derive-feature-badges.mjs",
|
|
157
|
+
"generate:feature-badges:check": "node scripts/derive-feature-badges.mjs --check",
|
|
158
|
+
"generate:feature-examples": "npx tsx scripts/generate-feature-examples.ts",
|
|
159
|
+
"generate:size-benchmarks": "npx tsx --experimental-wasm-stringref --experimental-wasm-custom-descriptors scripts/generate-size-benchmarks.ts",
|
|
160
|
+
"generate:browser-runtime-benchmarks": "node scripts/generate-browser-runtime-benchmarks.mjs",
|
|
161
|
+
"build:planning-artifacts": "node scripts/build-planning-artifacts.mjs",
|
|
162
|
+
"dashboard": "node website/dashboard/build-data.js",
|
|
163
|
+
"dashboard:watch": "node --watch --watch-path plan/issues --watch-path plan/issues/sprints --watch-path plan/issues/done --watch-path plan/issues/ready --watch-path plan/issues/blocked website/dashboard/build-data.js",
|
|
164
|
+
"report": "npx tsx scripts/serve-report.ts",
|
|
165
|
+
"sync:conformance": "node scripts/sync-conformance-numbers.mjs",
|
|
166
|
+
"sync:conformance:check": "node scripts/sync-conformance-numbers.mjs --check",
|
|
167
|
+
"build:pages": "node scripts/run-pages-build.mjs",
|
|
168
|
+
"deploy:registry-home": "mkdir -p .registry-home && cp website/index.html .registry-home/index.html && node ../file-registry-cli/dist/bin/main.js commit .registry-home -r users/tt/projects/ts2wasm && node ../file-registry-cli/dist/bin/main.js push .registry-home -r users/tt/projects/ts2wasm --public",
|
|
169
|
+
"upload": "pnpm run build:playground && node ../file-registry-cli/dist/bin/main.js commit && node ../file-registry-cli/dist/bin/main.js push",
|
|
170
|
+
"reconcile:tasks": "node scripts/reconcile-tasklist.mjs",
|
|
171
|
+
"issues:pr-status": "node scripts/poll-merged-pr-issues.mjs --once --sync-artifacts",
|
|
172
|
+
"issues:pr-status:watch": "node scripts/poll-merged-pr-issues.mjs --sync-artifacts",
|
|
173
|
+
"symphony": "node scripts/symphony.mjs",
|
|
174
|
+
"symphony:once": "node scripts/symphony.mjs --once",
|
|
175
|
+
"symphony:dry-run": "node scripts/symphony.mjs --once --dry-run",
|
|
176
|
+
"symphony:status": "node scripts/symphony.mjs --status",
|
|
177
|
+
"symphony:control": "node scripts/symphony.mjs --control",
|
|
178
|
+
"dispatch:queue": "node scripts/dispatch-channel.mjs queue",
|
|
179
|
+
"dispatch:request-claude": "node scripts/dispatch-channel.mjs request-claude",
|
|
180
|
+
"dispatch:inbox": "node scripts/dispatch-channel.mjs inbox",
|
|
181
|
+
"claude:symphony-channel": "node scripts/claude-symphony-channel.mjs",
|
|
182
|
+
"check:issue-ids": "node scripts/check-issue-ids.mjs",
|
|
183
|
+
"check:issue-ids:staged": "node scripts/check-issue-ids.mjs --staged",
|
|
184
|
+
"check:issue-ids:against-main": "node scripts/check-issue-ids.mjs --against-main",
|
|
185
|
+
"new:issue-id:allocate": "node scripts/claim-issue.mjs --allocate"
|
|
186
|
+
}
|
|
187
|
+
}
|