xbintsc 0.5.22 → 0.5.31
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/AGENTS.md +12 -3
- package/README.md +46 -11
- package/README.zh-CN.md +32 -6
- package/dist/scripts/support-matrix.d.ts +18 -0
- package/dist/scripts/support-matrix.js +141 -0
- package/dist/scripts/support-matrix.js.map +1 -0
- package/dist/src/ast/common.d.ts +2 -2
- package/dist/src/ast/declarations.d.ts +7 -1
- package/dist/src/ast/expressions.d.ts +5 -0
- package/dist/src/ast/kinds.d.ts +2 -0
- package/dist/src/ast/kinds.js +2 -0
- package/dist/src/ast/kinds.js.map +1 -1
- package/dist/src/binder/binder.d.ts +2 -1
- package/dist/src/binder/binder.js +2 -0
- package/dist/src/binder/binder.js.map +1 -1
- package/dist/src/binder/declarations.d.ts +9 -0
- package/dist/src/binder/declarations.js +64 -0
- package/dist/src/binder/declarations.js.map +1 -1
- package/dist/src/binder/references.js +85 -3
- package/dist/src/binder/references.js.map +1 -1
- package/dist/src/binder/types.d.ts +32 -0
- package/dist/src/binder/types.js.map +1 -1
- package/dist/src/canonical.d.ts +29 -0
- package/dist/src/canonical.js +35 -0
- package/dist/src/canonical.js.map +1 -0
- package/dist/src/checker/assignability.d.ts +13 -0
- package/dist/src/checker/assignability.js +146 -0
- package/dist/src/checker/assignability.js.map +1 -0
- package/dist/src/checker/calls.d.ts +13 -0
- package/dist/src/checker/calls.js +127 -0
- package/dist/src/checker/calls.js.map +1 -0
- package/dist/src/checker/checker.d.ts +26 -0
- package/dist/src/checker/checker.js +31 -0
- package/dist/src/checker/checker.js.map +1 -0
- package/dist/src/checker/declarations.d.ts +9 -0
- package/dist/src/checker/declarations.js +15 -0
- package/dist/src/checker/declarations.js.map +1 -0
- package/dist/src/checker/flow.d.ts +21 -0
- package/dist/src/checker/flow.js +241 -0
- package/dist/src/checker/flow.js.map +1 -0
- package/dist/src/checker/globals.d.ts +9 -0
- package/dist/src/checker/globals.js +29 -0
- package/dist/src/checker/globals.js.map +1 -0
- package/dist/src/checker/source.d.ts +38 -0
- package/dist/src/checker/source.js +48 -0
- package/dist/src/checker/source.js.map +1 -0
- package/dist/src/checker/type-infer.d.ts +18 -0
- package/dist/src/checker/type-infer.js +173 -0
- package/dist/src/checker/type-infer.js.map +1 -0
- package/dist/src/checker/type-model.d.ts +73 -0
- package/dist/src/checker/type-model.js +151 -0
- package/dist/src/checker/type-model.js.map +1 -0
- package/dist/src/checker/type-system.d.ts +58 -0
- package/dist/src/checker/type-system.js +569 -0
- package/dist/src/checker/type-system.js.map +1 -0
- package/dist/src/checker/typecheck-types.d.ts +22 -0
- package/dist/src/checker/typecheck-types.js +109 -0
- package/dist/src/checker/typecheck-types.js.map +1 -0
- package/dist/src/checker/typecheck.d.ts +62 -0
- package/dist/src/checker/typecheck.js +574 -0
- package/dist/src/checker/typecheck.js.map +1 -0
- package/dist/src/checker/undefined.d.ts +14 -0
- package/dist/src/checker/undefined.js +32 -0
- package/dist/src/checker/undefined.js.map +1 -0
- package/dist/src/checker/walk.d.ts +10 -0
- package/dist/src/checker/walk.js +15 -0
- package/dist/src/checker/walk.js.map +1 -0
- package/dist/src/cli/help.d.ts +7 -0
- package/dist/src/cli/help.js +64 -0
- package/dist/src/cli/help.js.map +1 -0
- package/dist/src/cli/hints.js +13 -1
- package/dist/src/cli/hints.js.map +1 -1
- package/dist/src/cli/main.js +12 -48
- package/dist/src/cli/main.js.map +1 -1
- package/dist/src/codegen/generator/calls/access.js +8 -8
- package/dist/src/codegen/generator/calls/access.js.map +1 -1
- package/dist/src/codegen/generator/calls/invocation.js +9 -4
- package/dist/src/codegen/generator/calls/invocation.js.map +1 -1
- package/dist/src/codegen/generator/calls/super.d.ts +9 -1
- package/dist/src/codegen/generator/calls/super.js +56 -5
- package/dist/src/codegen/generator/calls/super.js.map +1 -1
- package/dist/src/codegen/generator/context.d.ts +13 -2
- package/dist/src/codegen/generator/context.js +25 -19
- package/dist/src/codegen/generator/context.js.map +1 -1
- package/dist/src/codegen/generator/debug.js +2 -1
- package/dist/src/codegen/generator/debug.js.map +1 -1
- package/dist/src/codegen/generator/expressions/primary.d.ts +4 -1
- package/dist/src/codegen/generator/expressions/primary.js +68 -8
- package/dist/src/codegen/generator/expressions/primary.js.map +1 -1
- package/dist/src/codegen/generator/generator.js +11 -1
- package/dist/src/codegen/generator/generator.js.map +1 -1
- package/dist/src/codegen/generator/module.d.ts +2 -0
- package/dist/src/codegen/generator/module.js +62 -26
- package/dist/src/codegen/generator/module.js.map +1 -1
- package/dist/src/codegen/generator/state.d.ts +11 -1
- package/dist/src/codegen/generator/state.js.map +1 -1
- package/dist/src/codegen/generator/statements/variables.js +20 -3
- package/dist/src/codegen/generator/statements/variables.js.map +1 -1
- package/dist/src/codegen/generator/tables.d.ts +2 -0
- package/dist/src/codegen/generator/tables.js +4 -0
- package/dist/src/codegen/generator/tables.js.map +1 -1
- package/dist/src/driver/build-key.d.ts +2 -0
- package/dist/src/driver/build-key.js +1 -0
- package/dist/src/driver/build-key.js.map +1 -1
- package/dist/src/driver/bundler/graph.js +5 -1
- package/dist/src/driver/bundler/graph.js.map +1 -1
- package/dist/src/driver/bundler/merge.js +16 -1
- package/dist/src/driver/bundler/merge.js.map +1 -1
- package/dist/src/driver/bundler/types.d.ts +12 -0
- package/dist/src/driver/compiler.d.ts +1 -1
- package/dist/src/driver/compiler.js +4 -0
- package/dist/src/driver/compiler.js.map +1 -1
- package/dist/src/driver/fingerprint.js +2 -1
- package/dist/src/driver/fingerprint.js.map +1 -1
- package/dist/src/driver/frontend.d.ts +8 -6
- package/dist/src/driver/frontend.js +4 -0
- package/dist/src/driver/frontend.js.map +1 -1
- package/dist/src/driver/options.d.ts +6 -0
- package/dist/src/driver/version.d.ts +1 -1
- package/dist/src/driver/version.js +1 -1
- package/dist/src/extensions/catalog.js +2 -1
- package/dist/src/extensions/catalog.js.map +1 -1
- package/dist/src/extensions/gui/html.js +20 -6
- package/dist/src/extensions/gui/html.js.map +1 -1
- package/dist/src/extensions/gui/index.js +63 -0
- package/dist/src/extensions/gui/index.js.map +1 -1
- package/dist/src/extensions/media/index.d.ts +27 -0
- package/dist/src/extensions/media/index.js +60 -0
- package/dist/src/extensions/media/index.js.map +1 -0
- package/dist/src/extensions/registry.d.ts +50 -0
- package/dist/src/extensions/registry.js +26 -0
- package/dist/src/extensions/registry.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/parser/declarations/classes.js +7 -0
- package/dist/src/parser/declarations/classes.js.map +1 -1
- package/dist/src/parser/expressions.js +14 -1
- package/dist/src/parser/expressions.js.map +1 -1
- package/dist/src/parser/literals.js +6 -2
- package/dist/src/parser/literals.js.map +1 -1
- package/dist/tests/binder/binder.test.js +29 -0
- package/dist/tests/binder/binder.test.js.map +1 -1
- package/dist/tests/canonical.test.d.ts +1 -0
- package/dist/tests/canonical.test.js +19 -0
- package/dist/tests/canonical.test.js.map +1 -0
- package/dist/tests/checker/checker.test.d.ts +1 -0
- package/dist/tests/checker/checker.test.js +245 -0
- package/dist/tests/checker/checker.test.js.map +1 -0
- package/dist/tests/cli/check.test.js +20 -0
- package/dist/tests/cli/check.test.js.map +1 -1
- package/dist/tests/cli/hints.test.js +15 -0
- package/dist/tests/cli/hints.test.js.map +1 -1
- package/dist/tests/cli/process.test.js +12 -0
- package/dist/tests/cli/process.test.js.map +1 -1
- package/dist/tests/conformance/matrix.test.d.ts +6 -0
- package/dist/tests/conformance/matrix.test.js +23 -0
- package/dist/tests/conformance/matrix.test.js.map +1 -0
- package/dist/tests/conformance/test262/manifest.d.ts +115 -0
- package/dist/tests/conformance/test262/manifest.js +257 -0
- package/dist/tests/conformance/test262/manifest.js.map +1 -0
- package/dist/tests/conformance/test262.test.d.ts +11 -0
- package/dist/tests/conformance/test262.test.js +74 -0
- package/dist/tests/conformance/test262.test.js.map +1 -0
- package/dist/tests/docs/structure.test.js +9 -11
- package/dist/tests/docs/structure.test.js.map +1 -1
- package/dist/tests/e2e/child-process.test.js +3 -2
- package/dist/tests/e2e/child-process.test.js.map +1 -1
- package/dist/tests/e2e/compile-builtins.test.js +21 -0
- package/dist/tests/e2e/compile-builtins.test.js.map +1 -1
- package/dist/tests/e2e/compile-objects-classes.test.js +54 -0
- package/dist/tests/e2e/compile-objects-classes.test.js.map +1 -1
- package/dist/tests/e2e/differential-syntax.test.d.ts +5 -0
- package/dist/tests/e2e/differential-syntax.test.js +95 -0
- package/dist/tests/e2e/differential-syntax.test.js.map +1 -0
- package/dist/tests/e2e/differential-values.test.js +15 -0
- package/dist/tests/e2e/differential-values.test.js.map +1 -1
- package/dist/tests/e2e/gui-browser.test.d.ts +13 -0
- package/dist/tests/e2e/gui-browser.test.js +163 -0
- package/dist/tests/e2e/gui-browser.test.js.map +1 -0
- package/dist/tests/e2e/gui-example-browser.test.js +2 -2
- package/dist/tests/e2e/gui-example-browser.test.js.map +1 -1
- package/dist/tests/e2e/gui-example-canvas.test.js +8 -5
- package/dist/tests/e2e/gui-example-canvas.test.js.map +1 -1
- package/dist/tests/e2e/gui-example-svg.test.js +4 -3
- package/dist/tests/e2e/gui-example-svg.test.js.map +1 -1
- package/dist/tests/e2e/gui-example.test.js +4 -3
- package/dist/tests/e2e/gui-example.test.js.map +1 -1
- package/dist/tests/e2e/gui-helpers.d.ts +3 -0
- package/dist/tests/e2e/gui-helpers.js +6 -3
- package/dist/tests/e2e/gui-helpers.js.map +1 -1
- package/dist/tests/e2e/gui-media-disabled.test.d.ts +9 -0
- package/dist/tests/e2e/gui-media-disabled.test.js +42 -0
- package/dist/tests/e2e/gui-media-disabled.test.js.map +1 -0
- package/dist/tests/e2e/gui-media.test.d.ts +6 -4
- package/dist/tests/e2e/gui-media.test.js +20 -16
- package/dist/tests/e2e/gui-media.test.js.map +1 -1
- package/dist/tests/e2e/harness.d.ts +9 -0
- package/dist/tests/e2e/harness.js +14 -2
- package/dist/tests/e2e/harness.js.map +1 -1
- package/dist/tests/e2e/native-extensions.test.js +2 -1
- package/dist/tests/e2e/native-extensions.test.js.map +1 -1
- package/dist/tests/e2e/property-descriptors.test.js +20 -0
- package/dist/tests/e2e/property-descriptors.test.js.map +1 -1
- package/dist/tests/e2e/unicode-output.test.d.ts +16 -0
- package/dist/tests/e2e/unicode-output.test.js +67 -0
- package/dist/tests/e2e/unicode-output.test.js.map +1 -0
- package/dist/tests/e2e/weak-collections.test.js +16 -2
- package/dist/tests/e2e/weak-collections.test.js.map +1 -1
- package/dist/tests/extensions/media.test.d.ts +1 -0
- package/dist/tests/extensions/media.test.js +58 -0
- package/dist/tests/extensions/media.test.js.map +1 -0
- package/dist/tests/extensions/registry.test.js +8 -0
- package/dist/tests/extensions/registry.test.js.map +1 -1
- package/dist/tests/helpers.d.ts +1 -0
- package/dist/tests/helpers.js +1 -0
- package/dist/tests/helpers.js.map +1 -1
- package/dist/tests/lexer/identifiers.test.js +12 -0
- package/dist/tests/lexer/identifiers.test.js.map +1 -1
- package/dist/tests/lexer/scanner.test.js +8 -0
- package/dist/tests/lexer/scanner.test.js.map +1 -1
- package/dist/tests/lexer/strings.test.js +30 -0
- package/dist/tests/lexer/strings.test.js.map +1 -1
- package/dist/tests/parser/declarations.test.js +20 -0
- package/dist/tests/parser/declarations.test.js.map +1 -1
- package/dist/tests/parser/expressions.test.js +36 -0
- package/dist/tests/parser/expressions.test.js.map +1 -1
- package/dist/tests/platform.d.ts +32 -0
- package/dist/tests/platform.js +40 -0
- package/dist/tests/platform.js.map +1 -0
- package/dist/tests/platform.test.d.ts +12 -0
- package/dist/tests/platform.test.js +51 -0
- package/dist/tests/platform.test.js.map +1 -0
- package/dist/tests/version.test.js +4 -4
- package/dist/tests/version.test.js.map +1 -1
- package/doc/ai/README.md +10 -4
- package/doc/ai/build-recipe.md +1 -0
- package/doc/ai/cli.md +18 -6
- package/doc/ai/contributing.md +59 -2
- package/doc/ai/extensions.md +46 -23
- package/doc/ai/language-support.md +25 -16
- package/doc/ai/troubleshooting.md +9 -0
- package/doc/ai/zh-CN/README.md +9 -4
- package/doc/ai/zh-CN/build-recipe.md +1 -0
- package/doc/ai/zh-CN/cli.md +14 -4
- package/doc/ai/zh-CN/contributing.md +49 -3
- package/doc/ai/zh-CN/extensions.md +29 -8
- package/doc/ai/zh-CN/language-support.md +23 -14
- package/doc/ai/zh-CN/troubleshooting.md +8 -0
- package/doc/gui/api.md +45 -0
- package/doc/gui/build.md +37 -21
- package/doc/gui/known-issues.md +17 -6
- package/doc/gui/media.md +26 -11
- package/doc/gui/runtime.md +18 -0
- package/doc/gui-scripts.md +7 -0
- package/doc/gui.md +43 -33
- package/doc/implemented/binder.md +2 -0
- package/doc/implemented/checker.md +117 -0
- package/doc/implemented/cli.md +13 -1
- package/doc/implemented/codegen.md +3 -2
- package/doc/implemented/driver.md +2 -2
- package/doc/implemented/operators.md +2 -1
- package/doc/implemented/parser.md +3 -2
- package/doc/implemented/pipeline.md +8 -1
- package/doc/implemented/stdlib.md +2 -1
- package/doc/implemented/tests.md +3 -1
- package/doc/implemented.md +2 -0
- package/doc/npm-package.md +417 -0
- package/doc/requirements.md +4 -1
- package/doc/support-matrix.md +83 -0
- package/doc/unimplemented/classes.md +3 -0
- package/doc/unimplemented/deviations.md +3 -2
- package/doc/unimplemented/toolchain.md +1 -1
- package/doc/unimplemented/types.md +24 -8
- package/doc/unimplemented.md +1 -1
- package/doc/zh-CN/gui/api.md +41 -0
- package/doc/zh-CN/gui/build.md +28 -16
- package/doc/zh-CN/gui/known-issues.md +13 -5
- package/doc/zh-CN/gui/media.md +21 -10
- package/doc/zh-CN/gui/runtime.md +16 -0
- package/doc/zh-CN/gui-scripts.md +5 -0
- package/doc/zh-CN/gui.md +37 -32
- package/doc/zh-CN/implemented/binder.md +2 -0
- package/doc/zh-CN/implemented/checker.md +99 -0
- package/doc/zh-CN/implemented/cli.md +12 -1
- package/doc/zh-CN/implemented/codegen.md +3 -2
- package/doc/zh-CN/implemented/driver.md +2 -2
- package/doc/zh-CN/implemented/operators.md +1 -1
- package/doc/zh-CN/implemented/parser.md +3 -2
- package/doc/zh-CN/implemented/pipeline.md +3 -1
- package/doc/zh-CN/implemented/stdlib.md +2 -1
- package/doc/zh-CN/implemented/tests.md +3 -1
- package/doc/zh-CN/implemented.md +2 -0
- package/doc/zh-CN/npm-package.md +391 -0
- package/doc/zh-CN/post/announce.md +47 -47
- package/doc/zh-CN/requirements.md +4 -1
- package/doc/zh-CN/support-matrix.md +82 -0
- package/doc/zh-CN/unimplemented/classes.md +3 -0
- package/doc/zh-CN/unimplemented/deviations.md +3 -2
- package/doc/zh-CN/unimplemented/toolchain.md +1 -1
- package/doc/zh-CN/unimplemented/types.md +16 -6
- package/doc/zh-CN/unimplemented.md +1 -1
- package/llms.txt +4 -1
- package/package.json +3 -1
- package/runtime/ext_gui/audio.cpp +316 -0
- package/runtime/ext_gui/browser.cpp +547 -0
- package/runtime/ext_gui/browser_escape.cpp +85 -0
- package/runtime/ext_gui/browser_loop.cpp +83 -0
- package/runtime/ext_gui/canvas.cpp +9 -3
- package/runtime/ext_gui/canvas_raster.cpp +19 -1
- package/runtime/ext_gui/dom_api.cpp +36 -0
- package/runtime/ext_gui/dom_api_document.cpp +96 -5
- package/runtime/ext_gui/dom_api_events.cpp +20 -0
- package/runtime/ext_gui/dom_api_internal.h +19 -0
- package/runtime/ext_gui/dom_api_proto.cpp +6 -0
- package/runtime/ext_gui/gui.cpp +90 -23
- package/runtime/ext_gui/gui_engine.h +44 -0
- package/runtime/ext_gui/gui_media.cpp +69 -2
- package/runtime/ext_gui/media.cpp +34 -488
- package/runtime/ext_gui/media.h +54 -19
- package/runtime/ext_gui/media_api.h +65 -0
- package/runtime/ext_gui/window.cpp +9 -0
- package/runtime/ext_media/media.cpp +507 -0
- package/runtime/ext_media/media_bridge.c +35 -0
- package/runtime/ext_node/path/path.c +7 -7
- package/runtime/ext_node/url/url.c +4 -2
- package/runtime/rt.h +15 -0
- package/runtime/xt_constructors.c +2 -1
- package/runtime/xt_containers/objects.inc +22 -2
- package/runtime/xt_io/exception.inc +4 -2
- package/runtime/xt_stdlib/math.inc +62 -0
- package/runtime/xt_stdlib2/date.inc +7 -1
- package/runtime/xt_stdlib2/objects.inc +14 -0
- package/scripts/build-gui.ts +6 -72
- package/scripts/build-media.ts +245 -0
- package/scripts/support-matrix.ts +167 -0
- package/src/ast/common.ts +2 -0
- package/src/ast/declarations.ts +12 -1
- package/src/ast/expressions.ts +6 -0
- package/src/ast/kinds.ts +2 -0
- package/src/binder/binder.ts +3 -0
- package/src/binder/declarations.ts +70 -0
- package/src/binder/references.ts +84 -3
- package/src/binder/types.ts +30 -0
- package/src/canonical.ts +37 -0
- package/src/checker/assignability.ts +134 -0
- package/src/checker/calls.ts +135 -0
- package/src/checker/checker.ts +47 -0
- package/src/checker/declarations.ts +26 -0
- package/src/checker/flow.ts +236 -0
- package/src/checker/globals.ts +40 -0
- package/src/checker/source.ts +53 -0
- package/src/checker/type-infer.ts +185 -0
- package/src/checker/type-model.ts +212 -0
- package/src/checker/type-system.ts +578 -0
- package/src/checker/typecheck-types.ts +112 -0
- package/src/checker/typecheck.ts +586 -0
- package/src/checker/undefined.ts +43 -0
- package/src/checker/walk.ts +16 -0
- package/src/cli/help.ts +65 -0
- package/src/cli/hints.ts +13 -1
- package/src/cli/main.ts +12 -49
- package/src/codegen/generator/calls/access.ts +8 -8
- package/src/codegen/generator/calls/invocation.ts +8 -5
- package/src/codegen/generator/calls/super.ts +67 -5
- package/src/codegen/generator/context.ts +31 -19
- package/src/codegen/generator/debug.ts +2 -1
- package/src/codegen/generator/expressions/primary.ts +84 -13
- package/src/codegen/generator/generator.ts +11 -1
- package/src/codegen/generator/module.ts +65 -24
- package/src/codegen/generator/state.ts +11 -1
- package/src/codegen/generator/statements/variables.ts +20 -3
- package/src/codegen/generator/tables.ts +5 -0
- package/src/driver/build-key.ts +3 -0
- package/src/driver/bundler/graph.ts +6 -2
- package/src/driver/bundler/merge.ts +14 -1
- package/src/driver/bundler/types.ts +13 -0
- package/src/driver/compiler.ts +5 -1
- package/src/driver/fingerprint.ts +2 -1
- package/src/driver/frontend.ts +13 -2
- package/src/driver/options.ts +6 -0
- package/src/driver/version.ts +1 -1
- package/src/extensions/catalog.ts +2 -1
- package/src/extensions/gui/html.ts +23 -10
- package/src/extensions/gui/index.ts +65 -0
- package/src/extensions/media/index.ts +67 -0
- package/src/extensions/registry.ts +72 -0
- package/src/index.ts +2 -0
- package/src/parser/declarations/classes.ts +7 -0
- package/src/parser/expressions.ts +13 -1
- package/src/parser/literals.ts +6 -2
package/doc/ai/contributing.md
CHANGED
|
@@ -37,8 +37,9 @@ created by `release.yml`, never by the hook.
|
|
|
37
37
|
| `npm run bench` | build and time the fixed benchmark suite (optionally vs Node) |
|
|
38
38
|
|
|
39
39
|
Unit tests live one directory per module under `tests/` (`lexer`, `parser`,
|
|
40
|
-
`binder`, `codegen`, `driver`, `extensions`, `cli`, `
|
|
41
|
-
tree. Edge-case tests belong next to the module they
|
|
40
|
+
`binder`, `checker`, `codegen`, `driver`, `extensions`, `cli`, `conformance`,
|
|
41
|
+
`e2e`) and mirror the source tree. Edge-case tests belong next to the module they
|
|
42
|
+
cover.
|
|
42
43
|
|
|
43
44
|
`tests/e2e/` compiles real programs and runs the resulting binaries, including a
|
|
44
45
|
**differential harness** (`tests/e2e/differential-*.test.ts`) that executes the
|
|
@@ -49,6 +50,62 @@ clang skip themselves when it is unavailable (`hasClang()` in
|
|
|
49
50
|
[tests/helpers.ts](../../tests/helpers.ts)) — do not turn that into a silent
|
|
50
51
|
pass.
|
|
51
52
|
|
|
53
|
+
`tests/conformance/` is the executable definition of the supported subset. It
|
|
54
|
+
runs unmodified test262 files from a pinned checkout (see
|
|
55
|
+
[`tests/conformance/test262/SOURCE.md`](../../tests/conformance/test262/SOURCE.md)).
|
|
56
|
+
When a feature becomes usable, copy a test262 case that exercises it and add a
|
|
57
|
+
supported entry; when you document a boundary, pin a valid test262 case that
|
|
58
|
+
xbintsc still rejects with its diagnostic code. Then run `npm run docs:matrix`
|
|
59
|
+
to regenerate [the support matrix](../../support-matrix.md); a test fails when
|
|
60
|
+
the committed table is stale.
|
|
61
|
+
|
|
62
|
+
### Keeping tests portable
|
|
63
|
+
|
|
64
|
+
The suite runs natively on Linux, macOS and Windows (x64 and arm64), so a test
|
|
65
|
+
that passes on one host must pass on all of them. Three rules cover every
|
|
66
|
+
difference the compiler intentionally has:
|
|
67
|
+
|
|
68
|
+
- **Text is LF.** `.gitattributes` checks every text file out with LF, and
|
|
69
|
+
`.editorconfig` makes editors write LF by default. Read repository files
|
|
70
|
+
through `readTextFile()` in [tests/platform.ts](../../tests/platform.ts),
|
|
71
|
+
which also normalises a stale CRLF checkout; never compare a generated
|
|
72
|
+
document against a raw `readFileSync(..., "utf8")` copy. `runProgram()`
|
|
73
|
+
normalises captured stdout/stderr too, so a CRLF from a child process cannot
|
|
74
|
+
fail a comparison; pass `raw: true` when a case pins exact bytes (the UTF-8
|
|
75
|
+
output tests do).
|
|
76
|
+
- **Paths are built, not spelled.** Use `node:path` (`join`, `resolve`,
|
|
77
|
+
`relative`) for native expectations. The compiler emits `/` in its
|
|
78
|
+
host-independent artifacts (LLVM IR, cache manifests, fingerprints and the
|
|
79
|
+
`path` module); `toPosixPath()` converts a temp directory or a
|
|
80
|
+
`fileURLToPath()` result to that form when asserting on one. On the compiler
|
|
81
|
+
side that representation lives in
|
|
82
|
+
[src/canonical.ts](../../src/canonical.ts) (`ARTIFACT_PATH_SEPARATOR`,
|
|
83
|
+
`ARTIFACT_LINE_ENDING`, `artifactPath()`), mirrored by `XT_ARTIFACT_PATH_SEPARATOR` in
|
|
84
|
+
[runtime/rt.h](../../runtime/rt.h) — do not spell `"/"` or `"\n"` in code
|
|
85
|
+
that emits an artifact.
|
|
86
|
+
- **Native output stays native.** Diagnostics print the path the driver
|
|
87
|
+
resolved, so a Windows diagnostic contains `\`; stack frames are part of the
|
|
88
|
+
emitted artifact and use the canonical `/`. Assert both structurally
|
|
89
|
+
(`toContain("helper.ts:1:")`, `includes("at inner")`) or against a
|
|
90
|
+
`node:path`-built value, never against a hardcoded `/` or `\`.
|
|
91
|
+
|
|
92
|
+
Do not normalise arbitrary program output: a backslash there can be an escape
|
|
93
|
+
sequence, JSON, or a Windows path the program printed on purpose. A genuinely
|
|
94
|
+
platform-specific feature (drive letters, `os.platform()`, timers, fonts) is
|
|
95
|
+
gated with `it.runIf(...)`/`it.skipIf(...)` so the skip is visible instead of
|
|
96
|
+
being hidden by a broad string replacement.
|
|
97
|
+
|
|
98
|
+
`tests/platform.test.ts` enforces both ends: the `.gitattributes` policy and an
|
|
99
|
+
LF working tree. If it reports CRLF on a Windows checkout, renormalise once —
|
|
100
|
+
**only in a clean checkout**, because `git checkout -- .` discards local edits:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
git stash # or commit your work first
|
|
104
|
+
git add --renormalize .
|
|
105
|
+
git checkout -- .
|
|
106
|
+
git stash pop
|
|
107
|
+
```
|
|
108
|
+
|
|
52
109
|
## Two invariants you must not break
|
|
53
110
|
|
|
54
111
|
### 1. The self-hosting fixpoint
|
package/doc/ai/extensions.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Extensions: Node modules, GUI, C++/Rust libraries
|
|
1
|
+
# Extensions: Node modules, GUI, media, C++/Rust libraries
|
|
2
2
|
|
|
3
3
|
The compiler core is platform-agnostic. Anything platform-specific — Node's
|
|
4
4
|
`fs`, an HTML/CSS renderer, your own C++ library — arrives as an **extension**
|
|
@@ -69,28 +69,51 @@ import { createWindow, run } from "gui";
|
|
|
69
69
|
|
|
70
70
|
It is a self-contained GPU-accelerated renderer (own HTML parser, CSS cascade,
|
|
71
71
|
layout and compositor) — not a system WebView. It ships as a per-platform
|
|
72
|
-
prebuilt `gui.a`/`gui.lib` because it is C++. `<img
|
|
73
|
-
|
|
74
|
-
media
|
|
75
|
-
`
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
`
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
72
|
+
prebuilt `gui.a`/`gui.lib` because it is C++. `<img>` decodes through the engine
|
|
73
|
+
itself; `<video>`/`<audio>` do **not** work with `gui` alone — they need the
|
|
74
|
+
separate [`media`](#media--videoaudio-decoding) extension. `<canvas>` is
|
|
75
|
+
supported too: `getContext("2d")` returns a context whose fills, paths,
|
|
76
|
+
gradients, text and `drawImage` are rasterised by a self-written CPU rasteriser
|
|
77
|
+
(plus line caps/joins, dashed strokes, `ellipse` and `roundRect`), and element
|
|
78
|
+
handles expose `canvas` drawing plus `width`/`height`. CSS
|
|
79
|
+
`transform`/`transform-origin` work as paint-time effects, so a box (and the
|
|
80
|
+
text, images and children in it) can be translated, scaled and rotated without
|
|
81
|
+
reflowing anything — animate it per frame from `requestAnimationFrame` or with
|
|
82
|
+
`transition: transform` (see `examples/gui/pelican-svg`). If the archive is
|
|
83
|
+
missing for your platform, the build fails with an actionable message; design
|
|
84
|
+
and roadmap live in [../gui.md](../gui.md) (overview; the engine is documented by
|
|
85
|
+
function under [`doc/gui/`](../gui/)), and the scripting surface in
|
|
86
|
+
[../gui-scripts.md](../gui-scripts.md). See
|
|
87
|
+
[../gui/canvas.md](../gui/canvas.md) for the canvas API and its limits.
|
|
88
|
+
|
|
89
|
+
Pages written for the browser also get the browser globals they reach for —
|
|
90
|
+
`window`/`self`, `document`, `navigator`, `location`, `localStorage`,
|
|
91
|
+
`requestAnimationFrame`, `matchMedia`, `getComputedStyle`, `alert`/`prompt`,
|
|
92
|
+
`escape`, the `Event` family and a Web Audio *surface* (`AudioContext` with
|
|
93
|
+
nodes, params and buffers, but no mixer) — plus a frame pump that starts at
|
|
94
|
+
`loadHTML` and re-arms only while animation-frame callbacks remain, so a page
|
|
95
|
+
that never calls `run()` still paints and then exits. WebGL, WebXR, `<video>`/
|
|
96
|
+
`<audio>` without `media`, `fetch` and streaming are **not** implemented:
|
|
97
|
+
`typeof` answers `"undefined"` so a page takes its own fallback branch. See
|
|
98
|
+
[../gui/api.md](../gui/api.md#browser-globals).
|
|
99
|
+
|
|
100
|
+
### `media` — video/audio decoding
|
|
101
|
+
|
|
102
|
+
Enable with `--ext media` **together with** `gui` (`--ext gui,media`; the
|
|
103
|
+
registry rejects `media` on its own). It links a separate FFmpeg-backed
|
|
104
|
+
`media.a`, so adding `<video>`/`<audio>` playback does not make a GUI-only
|
|
105
|
+
binary any larger.
|
|
106
|
+
|
|
107
|
+
The DOM API is the same as for any HTML media element: `play()` / `pause()` /
|
|
108
|
+
`load()`, the `paused` / `ended` / `duration` / `currentTime` / `volume` /
|
|
109
|
+
`muted` / `loop` / `autoplay` / `videoWidth` / `videoHeight` / `readyState` /
|
|
110
|
+
`src` properties, and `loadedmetadata`/`play`/`pause`/`ended`/`timeupdate`/
|
|
111
|
+
`error` events. There are no built-in controls — draw your own chrome with
|
|
112
|
+
elements and CSS (see `examples/gui/media.ts`). Video frames and audio PCM are
|
|
113
|
+
decoded on the main thread; video goes through the image texture path. Without
|
|
114
|
+
the extension, opening a media source fails and fires `error` (the element and
|
|
115
|
+
its API still exist). The archive is POSIX-only for now, so Windows reports the
|
|
116
|
+
same `error`; see [../gui/known-issues.md](../gui/known-issues.md).
|
|
94
117
|
|
|
95
118
|
## Third-party npm packages
|
|
96
119
|
|
|
@@ -47,25 +47,25 @@ Canonical detail (always current, much longer):
|
|
|
47
47
|
| Comma operator, `void` | ✅ | |
|
|
48
48
|
| `new.target` | 🚫 | parsed, then rejected with a clear `UnsupportedFeature` |
|
|
49
49
|
| `import.meta` | ✅ | `url`, `dirname`, `filename` (resolved from the executable path) |
|
|
50
|
-
| `super` |
|
|
50
|
+
| `super` | ✅ | `super()` and `super.x` resolve from the class being defined, so any inheritance depth works |
|
|
51
51
|
|
|
52
52
|
## Functions, classes, objects
|
|
53
53
|
|
|
54
54
|
| Feature | Status | Notes |
|
|
55
55
|
| --- | --- | --- |
|
|
56
|
-
| Closures (capture by reference through boxes) | ✅ | one ABI for direct and closure calls |
|
|
56
|
+
| Closures (capture by reference through boxes) | ✅ | one ABI for direct and closure calls; function *declarations* capture too, so a named function can read and update outer state |
|
|
57
57
|
| `this`, method calls, arrow lexical `this` | ✅ | arrow functions get their own `arguments`, unlike JS |
|
|
58
58
|
| `call` / `apply` / `bind`, `fn.name` / `fn.length` | ✅ | a bound closure does not track partial-argument `length` |
|
|
59
59
|
| First-class built-in methods (`arr.map` as a value) | ✅ | exposed as *unbound* method values; a detached call throws like JS |
|
|
60
60
|
| `fn.toString()` | ⚠️ | returns `function name() { [native code] }`, not the source text |
|
|
61
|
-
| Classes: fields, methods, statics, getters/setters, `extends`/`super`, `instanceof` | ✅ | |
|
|
61
|
+
| Classes: fields, methods, statics, `static { ... }` blocks, getters/setters, `extends`/`super`, `instanceof` | ✅ | a static block is compiled as a static method called at class-definition time |
|
|
62
62
|
| Constructor parameter properties `constructor(public x: T)` | ✅ | |
|
|
63
63
|
| `#private` fields / methods / statics | ⚠️ | stored under a literal `#x` key; no access enforcement; parent/child name collisions may alias |
|
|
64
64
|
| `enum` / `const enum` | ✅ | forward + reverse mapping |
|
|
65
65
|
| `private` / `protected` / `public` / `readonly` / `abstract` / `implements` | — | erased, no access control |
|
|
66
66
|
| Generators `function*`, `yield`, `yield*` | ✅ | sync and `async function*`; `for await...of` and `Symbol.asyncIterator` |
|
|
67
67
|
| `arguments` object | ✅ | implicit; arrows see their own parameters |
|
|
68
|
-
| Argument-count validation |
|
|
68
|
+
| Argument-count validation | ⚠️ | direct calls to locally visible functions / `const` arrows are checked (`TS4004`); methods, imports, spread arguments and reassigned bindings are not. `--no-check` disables |
|
|
69
69
|
|
|
70
70
|
## Async, Promises, event loop
|
|
71
71
|
|
|
@@ -80,21 +80,28 @@ Canonical detail (always current, much longer):
|
|
|
80
80
|
| Worker threads | 🚫 | workers are child processes |
|
|
81
81
|
| `async` generators | ✅ | suspend at `await` and `yield`; every `.next()` returns a promise; `for await...of` supported |
|
|
82
82
|
|
|
83
|
-
## Types:
|
|
83
|
+
## Types: structurally checked, then erased
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
The default [semantic checker](../implemented/checker.md) resolves a small
|
|
86
|
+
structural subset of TypeScript types and checks it; code generation then
|
|
87
|
+
erases all type syntax. The checker catches:
|
|
87
88
|
|
|
88
89
|
| Construct | Status |
|
|
89
90
|
| --- | --- |
|
|
90
|
-
| Type annotations,
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
| Type annotations, interfaces, type aliases, object/array/function types | ✅ parsed and structurally checked, then erased |
|
|
92
|
+
| Assignability of initializers, assignments, returns and arguments | ✅ definite mismatches only (`TS4001`); no full inference |
|
|
93
|
+
| Property existence on `const` literals / class instances / interfaces | ✅ checked by default; dynamic shapes are left alone (`TS4003`) |
|
|
94
|
+
| Calling a definitely non-callable value | ✅ (`TS4002`) |
|
|
95
|
+
| Unresolved names (`TS3002`), same-scope redeclarations (`TS3001`), call arity (`TS4004`) | ✅ checked by default; `--no-check` disables everything |
|
|
96
|
+
| Simple generics (`T`, `T[]`, explicit type arguments) | ✅ inferred at the call site |
|
|
97
|
+
| Flow narrowing (`typeof`, `!== null`, `instanceof`, truthiness) | ✅ inside `if`/`else` and conditional expressions |
|
|
98
|
+
| Generic constraints, mapped/conditional types, overloads, full inference | 🚫 resolve to `any` |
|
|
99
|
+
| Strict-null and excess-property checks | 🚫 |
|
|
100
|
+
| `as`, `satisfies`, non-null `!` | — erased assertions, not validated |
|
|
101
|
+
|
|
102
|
+
`const x: number = "hello"` is now a compile error (`TS4001`). The checker is
|
|
103
|
+
deliberately conservative: anything it cannot model is `any`, so an unsupported
|
|
104
|
+
construct can hide a bug but never reject working code.
|
|
98
105
|
|
|
99
106
|
## Standard library
|
|
100
107
|
|
|
@@ -104,7 +111,9 @@ typed arrays, `String.prototype.match`/`split`/`replace` with capture groups,
|
|
|
104
111
|
immutable array helpers (`toReversed`, `toSorted`, `toSpliced`, `with`), global
|
|
105
112
|
URI functions, first-class built-in constructors (`const A = Array; new A(...)`,
|
|
106
113
|
`A.isArray`, `x instanceof A`) and `Object.prototype`
|
|
107
|
-
(`Object.getPrototypeOf({}) === Object.prototype`).
|
|
114
|
+
(`Object.getPrototypeOf({}) === Object.prototype`). `Math` is a first-class
|
|
115
|
+
object as well as a namespace (`const cos = Math.cos`, `const { sqrt, PI } =
|
|
116
|
+
Math`), and `Object.defineProperties` installs several descriptors at once.
|
|
108
117
|
|
|
109
118
|
| Missing or different | Status |
|
|
110
119
|
| --- | --- |
|
|
@@ -118,6 +118,15 @@ The `gui` extension needs its per-platform prebuilt `gui.a`/`gui.lib`, which is
|
|
|
118
118
|
not built in a plain source checkout. Drop `--ext gui`, or build the archive as
|
|
119
119
|
described in [../gui.md](../gui.md).
|
|
120
120
|
|
|
121
|
+
### `media native library not found at …`
|
|
122
|
+
|
|
123
|
+
`<video>`/`<audio>` playback needs the optional `media` archive (`media.a`),
|
|
124
|
+
built separately with `npm run media`. Build it, or drop `--ext media`; a
|
|
125
|
+
GUI-only build still links and media elements simply fire `error`. The `media`
|
|
126
|
+
extension also requires `gui`, has no Windows archive yet, and `--ext media`
|
|
127
|
+
alone is rejected with the flags to pass. See
|
|
128
|
+
[../gui/build.md](../gui/build.md).
|
|
129
|
+
|
|
121
130
|
### `Icon file not found` / icon tools missing
|
|
122
131
|
|
|
123
132
|
`--icon`/`app.icon` paths resolve against the config file's directory. On
|
package/doc/ai/zh-CN/README.md
CHANGED
|
@@ -15,6 +15,7 @@ source.ts --词法分析--> tokens --语法分析--> AST --绑定--> 绑定后
|
|
|
15
15
|
| 页面 | 什么时候读 |
|
|
16
16
|
| --- | --- |
|
|
17
17
|
| [build-recipe.md](./build-recipe.md) | 要编译或运行一个程序,需要确切的命令形状 |
|
|
18
|
+
| [../../npm-package.md](../../npm-package.md) | 要通过 npm 在 Node 项目或 CI 中安装并构建 |
|
|
18
19
|
| [cli.md](./cli.md) | 需要完整参数表、项目配置或编程 API |
|
|
19
20
|
| [language-support.md](./language-support.md) | 必须确认某个语法/API 是否存在,或是否与 Node 一致 |
|
|
20
21
|
| [extensions.md](./extensions.md) | 需要 `fs`/`http`/…、GUI,或 C++/Rust 库 |
|
|
@@ -27,9 +28,11 @@ source.ts --词法分析--> tokens --语法分析--> AST --绑定--> 绑定后
|
|
|
27
28
|
|
|
28
29
|
1. **只有 TypeScript 的一个子集能编译。** 不支持的语法会被直接拒绝,而不是
|
|
29
30
|
近似实现。动手写大段代码之前先确认。
|
|
30
|
-
2.
|
|
31
|
-
非空断言 `!`
|
|
32
|
-
|
|
31
|
+
2. **类型先做结构化检查,然后擦除。** 类型注解、接口、泛型、`as`/`satisfies`、
|
|
32
|
+
非空断言 `!` 在运行时没有任何作用。默认检查器会解析一个小型结构化子集,
|
|
33
|
+
拒绝确定不匹配(`const x: number = "hello"`)、已知形状上的缺失属性以及
|
|
34
|
+
对不可调用值的调用(`--no-check` 可关闭)。模型叫不出名字的东西都是 `any`;
|
|
35
|
+
没有完整推断与 strict-null 模式。
|
|
33
36
|
3. **Node 兼容是可选且不完整的。** Node 内置模块由 `node` 扩展提供(`--ext node`);
|
|
34
37
|
`node_modules` 里的 npm 包在构建期解析并打包(ESM 和 CommonJS 都支持);
|
|
35
38
|
运行时没有包查找,循环依赖会被拒绝。
|
|
@@ -51,7 +54,9 @@ xbintsc doctor
|
|
|
51
54
|
```
|
|
52
55
|
|
|
53
56
|
在源码检出里,把 `xbintsc` 换成 `npx tsx src/cli/main.ts`(或
|
|
54
|
-
`npm run xbintsc --`)。发布压缩包里的二进制不需要 Node.js
|
|
57
|
+
`npm run xbintsc --`)。发布压缩包里的二进制不需要 Node.js。如果是通过 npm
|
|
58
|
+
安装的,请在命令前加 `npx`(例如 `npx xbintsc build app.ts`);见
|
|
59
|
+
[../../npm-package.md](../../npm-package.md)。
|
|
55
60
|
|
|
56
61
|
下一步:要命令就[build-recipe.md](./build-recipe.md),要写正经程序就先看
|
|
57
62
|
[language-support.md](./language-support.md)。
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
| 场景 | 调用方式 |
|
|
9
9
|
| --- | --- |
|
|
10
10
|
| 已发布的独立压缩包 | `xbintsc …`(`bin/xbintsc[.exe]` 在 `PATH` 上) |
|
|
11
|
+
| 已安装的 npm 包(Node 22+) | `npx xbintsc …`;见 [npm-package.md](../../npm-package.md) |
|
|
11
12
|
| 源码检出,已编译 | `node dist/src/cli/main.js …` |
|
|
12
13
|
| 源码检出,直接跑 TypeScript | `npx tsx src/cli/main.ts …` |
|
|
13
14
|
| 源码检出,npm 脚本 | `npm run xbintsc -- …` |
|
package/doc/ai/zh-CN/cli.md
CHANGED
|
@@ -11,13 +11,21 @@
|
|
|
11
11
|
| `xbintsc run <file.ts> [-- args]` | 编译成可执行文件并运行 | 需要(且只支持 `--emit exe`) |
|
|
12
12
|
| `xbintsc watch <file.ts>` | 源码树变化时自动重新构建(Ctrl+C 退出) | 需要 |
|
|
13
13
|
| `xbintsc emit <file.ts>` | 把 LLVM IR 打到 stdout,不写文件 | 不需要 |
|
|
14
|
-
| `xbintsc check <file.ts>` |
|
|
14
|
+
| `xbintsc check <file.ts>` | 前端检查(语法、导入、语义检查、支持的子集),不写文件 | 不需要 |
|
|
15
15
|
| `xbintsc doctor` | 报告解析到的工具链、运行时与图标工具 | 仅在探测时需要 |
|
|
16
16
|
| `xbintsc version` | 打印版本 | 不需要 |
|
|
17
17
|
| `xbintsc help` | 打印帮助文本 | 不需要 |
|
|
18
18
|
|
|
19
|
-
`check`
|
|
20
|
-
|
|
19
|
+
`check` 不是完整的类型检查器:类型注解在检查后会被擦除,所以通过 `check` 的程序仍可能在运行时出错。
|
|
20
|
+
它能发现语法错误、无法解析的导入、超出支持子集的写法,以及语义检查器的诊断:
|
|
21
|
+
未定义名(TS3002)、同作用域重复声明(TS3001)、实参个数不匹配(TS4004)、
|
|
22
|
+
已知形状上的缺失属性(TS4003)、确定的可赋值性错误(TS4001)与对不可调用值的调用(TS4002)。
|
|
23
|
+
这使它适合作为提交前或编辑器的快速门禁。`--no-check` 可以跳过语义检查部分;
|
|
24
|
+
详见[语义检查](../implemented/checker.md)。
|
|
25
|
+
|
|
26
|
+
语义检查默认对**所有**命令开启(`build`、`run`、`emit`、`watch` 与 `check`)。
|
|
27
|
+
该开关是增量缓存 key 的一部分,所以 `--no-check` 的产物不会与已检查的产物互相复用。
|
|
28
|
+
错误在 clang 运行之前报告,这正是 `xbintsc check` 在编辑器或 pre-commit 钩子里便宜的原因。
|
|
21
29
|
|
|
22
30
|
任何命令加 `--help` 都会打印帮助并返回 0。未知命令会打印错误与帮助文本,返回 1。
|
|
23
31
|
|
|
@@ -32,7 +40,7 @@
|
|
|
32
40
|
--out <dir> 输出目录(默认 build/)
|
|
33
41
|
--emit <kind> exe | obj | ir(默认 exe)
|
|
34
42
|
-O0 .. -O3 传给 clang 的优化级别(默认 -O2)
|
|
35
|
-
--ext <names> 开启内置扩展,逗号分隔(如 node,gui)
|
|
43
|
+
--ext <names> 开启内置扩展,逗号分隔(如 node,gui,media)
|
|
36
44
|
--ext-native <m> 通过 JSON 清单注册 C++/Rust 扩展(多个用逗号分隔)
|
|
37
45
|
--config <path> 使用指定项目配置,不做自动发现
|
|
38
46
|
--no-config 完全不读取项目配置
|
|
@@ -44,6 +52,8 @@
|
|
|
44
52
|
--verbose 打印进度信息
|
|
45
53
|
--time 打印各构建阶段耗时
|
|
46
54
|
--debug 生成调试信息(DWARF/CodeView)并保留帧指针
|
|
55
|
+
--check 运行语义检查(默认)
|
|
56
|
+
--no-check 跳过语义检查,只擦除类型语法
|
|
47
57
|
--lto 程序与运行时编译为 LTO bitcode,并用 lld 链接
|
|
48
58
|
--pgo-generate [dir] 构建插桩二进制,把 profile 写入 dir
|
|
49
59
|
--pgo-use [dir] 使用 --pgo-generate 收集的 profile 重新构建
|
|
@@ -33,9 +33,9 @@ npm test # 单元测试 + 端到端测试
|
|
|
33
33
|
| `npm run coverage:runtime` | C 运行时(`runtime/`)的 LLVM 覆盖率 |
|
|
34
34
|
| `npm run bench` | 构建并计时固定基准套件(可与 Node 对比) |
|
|
35
35
|
|
|
36
|
-
单元测试在 `tests/` 下按模块一个目录(`lexer`、`parser`、`binder`、`
|
|
37
|
-
`driver`、`extensions`、`cli`、`e2e
|
|
38
|
-
|
|
36
|
+
单元测试在 `tests/` 下按模块一个目录(`lexer`、`parser`、`binder`、`checker`、
|
|
37
|
+
`codegen`、`driver`、`extensions`、`cli`、`conformance`、`e2e`),与源码树镜像对应。
|
|
38
|
+
边界用例放在它覆盖的模块旁边。
|
|
39
39
|
|
|
40
40
|
`tests/e2e/` 会编译真实程序并运行产出的二进制,其中包含一个**差分测试框架**
|
|
41
41
|
(`tests/e2e/differential-*.test.ts`):把同一份源码分别交给 xbintsc 和 Node 执行,
|
|
@@ -44,6 +44,52 @@ npm test # 单元测试 + 端到端测试
|
|
|
44
44
|
([tests/helpers.ts](../../../tests/helpers.ts) 里的 `hasClang()`)——不要把这种跳过
|
|
45
45
|
变成静默通过。
|
|
46
46
|
|
|
47
|
+
`tests/conformance/` 是“支持子集”的可执行定义,运行固定版本 test262 中的原始
|
|
48
|
+
文件(见 [`tests/conformance/test262/SOURCE.md`](../../../tests/conformance/test262/SOURCE.md))。
|
|
49
|
+
功能可用时,复制一个覆盖该功能的 test262 用例并登记为受支持;记录边界时,
|
|
50
|
+
固定一个 xbintsc 仍会拒绝的合法 test262 用例及其诊断码。然后运行
|
|
51
|
+
`npm run docs:matrix` 重新生成[支持矩阵](../../support-matrix.md),提交的表格
|
|
52
|
+
过期时测试会失败。
|
|
53
|
+
|
|
54
|
+
### 保持测试跨平台
|
|
55
|
+
|
|
56
|
+
测试套件在 Linux、macOS 和 Windows(x64 与 arm64)上原生运行,因此在一个平台通过的
|
|
57
|
+
用例必须在所有平台通过。三条规则覆盖了编译器有意保留的全部差异:
|
|
58
|
+
|
|
59
|
+
- **文本统一 LF。** `.gitattributes` 保证所有文本文件以 LF 检出,
|
|
60
|
+
`.editorconfig` 让编辑器默认写入 LF。读取仓库文件一律
|
|
61
|
+
走 [tests/platform.ts](../../../tests/platform.ts) 的 `readTextFile()`——它也会
|
|
62
|
+
归一化陈旧的 CRLF 检出;不要用裸的 `readFileSync(..., "utf8")` 去比对生成文档。
|
|
63
|
+
`runProgram()` 也会归一化捕获到的 stdout/stderr,子进程带出的 CRLF 不会让比较失败;
|
|
64
|
+
需要逐字节断言的用例传 `raw: true`(UTF-8 输出测试就是这么做的)。
|
|
65
|
+
- **路径要构造,不要手写。** 原生期望值用 `node:path`(`join`、`resolve`、
|
|
66
|
+
`relative`)构造。编译器在其与宿主无关的产物(LLVM IR、缓存清单、指纹、
|
|
67
|
+
`path` 模块)里统一输出 `/`;断言这类值时用 `toPosixPath()` 把临时目录或
|
|
68
|
+
`fileURLToPath()` 的结果转成该形式。编译器侧的唯一来源是
|
|
69
|
+
[src/canonical.ts](../../../src/canonical.ts)(`ARTIFACT_PATH_SEPARATOR`、
|
|
70
|
+
`ARTIFACT_LINE_ENDING`、`artifactPath()`),运行时对应
|
|
71
|
+
[runtime/rt.h](../../../runtime/rt.h) 的 `XT_ARTIFACT_PATH_SEPARATOR`——生成产物的代码
|
|
72
|
+
不要直接写 `"/"` 或 `"\n"`。
|
|
73
|
+
- **原生输出保持原生。** 诊断按驱动解析到的路径打印,因此 Windows 上含 `\`;
|
|
74
|
+
堆栈帧属于生成产物,统一用 `/`。两者都用结构性断言
|
|
75
|
+
(`toContain("helper.ts:1:")`、`includes("at inner")`)或与 `node:path`
|
|
76
|
+
构造的值比较,不要写死 `/` 或 `\`。
|
|
77
|
+
|
|
78
|
+
不要归一化任意程序输出:其中的反斜杠可能是转义序列、JSON,或程序有意打印的 Windows
|
|
79
|
+
路径。真正与平台相关的特性(盘符、`os.platform()`、定时器、字体)用
|
|
80
|
+
`it.runIf(...)`/`it.skipIf(...)` 显式跳过,而不是用大范围字符串替换掩盖。
|
|
81
|
+
|
|
82
|
+
`tests/platform.test.ts` 同时守住两端:`.gitattributes` 策略与工作区的 LF 状态。
|
|
83
|
+
Windows 检出报告 CRLF 时,重新归一化一次——**只对干净的工作区执行**,因为
|
|
84
|
+
`git checkout -- .` 会丢弃本地改动:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
git stash # 或先提交
|
|
88
|
+
git add --renormalize .
|
|
89
|
+
git checkout -- .
|
|
90
|
+
git stash pop
|
|
91
|
+
```
|
|
92
|
+
|
|
47
93
|
## 两条不能破坏的不变量
|
|
48
94
|
|
|
49
95
|
### 1. 自举不动点
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# 扩展:Node 模块、GUI
|
|
1
|
+
# 扩展:Node 模块、GUI、媒体、C++/Rust 库
|
|
2
2
|
|
|
3
3
|
编译器核心与平台无关。任何与平台相关的东西——Node 的 `fs`、一个 HTML/CSS 渲染器、
|
|
4
4
|
你自己的 C++ 库——都以**扩展**的形式接入:它既贡献模块绑定,也贡献要一起编译/链接的
|
|
@@ -66,11 +66,9 @@ import { createWindow, run } from "gui";
|
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
它是自带渲染引擎的 GPU 加速实现(自己的 HTML 解析器、CSS 级联、布局与合成器),不是
|
|
69
|
-
系统 WebView。`<img
|
|
70
|
-
|
|
71
|
-
`
|
|
72
|
-
没有内置控件——用元素和 CSS 自绘控件(见 `examples/gui/media.ts`);视频帧与音频 PCM
|
|
73
|
-
都在主线程解码。也支持 `<canvas>`:`getContext("2d")` 返回的上下文,其填充、路径、
|
|
69
|
+
系统 WebView。`<img>` 由引擎自身解码;而 `<video>`/`<audio>` 在只启用 `gui` 时**不可用**
|
|
70
|
+
——它们需要单独的 [`media`](#media--视频音频解码) 扩展。也支持 `<canvas>`:
|
|
71
|
+
`getContext("2d")` 返回的上下文,其填充、路径、
|
|
74
72
|
渐变、文本与 `drawImage` 由自研 CPU 光栅器处理(另有线段端点/连接、虚线描边、
|
|
75
73
|
`ellipse` 与 `roundRect`),元素句柄还暴露 `width`/`height`。CSS
|
|
76
74
|
`transform`/`transform-origin` 作为绘制期效果可用,因此一个盒子(以及其中的文本、
|
|
@@ -78,10 +76,33 @@ import { createWindow, run } from "gui";
|
|
|
78
76
|
`requestAnimationFrame` 逐帧驱动,或写成 `transition: transform`(见
|
|
79
77
|
`examples/gui/pelican-svg`)。因为主体是 C++,它以各平台预编译的 `gui.a`/`gui.lib` 形式分发。如果该
|
|
80
78
|
平台的归档不存在,构建会以明确的提示失败;设计与路线图见 [../../zh-CN/gui.md](../../zh-CN/gui.md)(总览;引擎按功能拆分在 [`doc/zh-CN/gui/`](../../zh-CN/gui/) 下),
|
|
81
|
-
脚本接口见 [../../zh-CN/gui-scripts.md](../../zh-CN/gui-scripts.md)
|
|
82
|
-
Windows 唯一不支持的:Windows 的 `gui.a` 不构建 FFmpeg,媒体槽位为空操作。Canvas API
|
|
79
|
+
脚本接口见 [../../zh-CN/gui-scripts.md](../../zh-CN/gui-scripts.md)。Canvas API
|
|
83
80
|
及其限制见 [../../zh-CN/gui/canvas.md](../../zh-CN/gui/canvas.md)。
|
|
84
81
|
|
|
82
|
+
为浏览器编写的页面还能直接使用它们依赖的浏览器全局 —— `window`/`self`、`document`、
|
|
83
|
+
`navigator`、`location`、`localStorage`、`requestAnimationFrame`、`matchMedia`、
|
|
84
|
+
`getComputedStyle`、`alert`/`prompt`、`escape`、`Event` 家族,以及一层 Web Audio
|
|
85
|
+
**接口**(`AudioContext` 及其节点、参数与缓冲区,但没有混音后端)—— 另外还有帧泵:
|
|
86
|
+
它在 `loadHTML` 时启动,仅在仍有动画帧回调时重新排程,因此从不调用 `run()` 的页面
|
|
87
|
+
也能绘制并最终退出。WebGL、WebXR、未启用 `media` 时的 `<video>`/`<audio>`、`fetch`
|
|
88
|
+
与流式接口**尚未实现**:`typeof` 会回答 `"undefined"`,让页面走自己的降级分支。
|
|
89
|
+
见 [../../zh-CN/gui/api.md](../../zh-CN/gui/api.md)。
|
|
90
|
+
|
|
91
|
+
### `media` —— 视频/音频解码
|
|
92
|
+
|
|
93
|
+
用 `--ext media` **与 `gui` 一起**开启(`--ext gui,media`;注册表会拒绝单独启用
|
|
94
|
+
`media`)。它链接单独的 FFmpeg 后端 `media.a`,因此加入 `<video>`/`<audio>` 播放
|
|
95
|
+
不会让只做界面的二进制变大。
|
|
96
|
+
|
|
97
|
+
DOM API 与普通 HTML 媒体元素一致:`play()` / `pause()` / `load()`,以及
|
|
98
|
+
`paused` / `ended` / `duration` / `currentTime` / `volume` / `muted` / `loop` /
|
|
99
|
+
`autoplay` / `videoWidth` / `videoHeight` / `readyState` / `src` 属性,还有
|
|
100
|
+
`loadedmetadata`/`play`/`pause`/`ended`/`timeupdate`/`error` 事件。没有内置
|
|
101
|
+
控件——用元素和 CSS 自绘控件(见 `examples/gui/media.ts`)。视频帧与音频 PCM
|
|
102
|
+
都在主线程解码;视频走图像纹理路径。没有该扩展时,打开媒体源会失败并触发
|
|
103
|
+
`error`(元素与 API 仍然存在)。该归档目前仅支持 POSIX,因此 Windows 也只会触发
|
|
104
|
+
同样的 `error`;见 [../../zh-CN/gui/known-issues.md](../../zh-CN/gui/known-issues.md)。
|
|
105
|
+
|
|
85
106
|
## 第三方 npm 包
|
|
86
107
|
|
|
87
108
|
没有被已启用扩展认领的裸说明符,会在 `node_modules` 里查找并**作为源码**打包,
|
|
@@ -44,25 +44,25 @@ xbintsc 编译 TypeScript 的一个**实用子集**。本页用来判断你能
|
|
|
44
44
|
| 逗号运算符、`void` | ✅ | |
|
|
45
45
|
| `new.target` | 🚫 | 能解析,但会给出明确的 `UnsupportedFeature` |
|
|
46
46
|
| `import.meta` | ✅ | `url`、`dirname`、`filename`(由可执行文件路径解析) |
|
|
47
|
-
| `super` |
|
|
47
|
+
| `super` | ✅ | `super()` 与 `super.x` 由当前定义的类解析,任意继承深度都正确 |
|
|
48
48
|
|
|
49
49
|
## 函数、类与对象
|
|
50
50
|
|
|
51
51
|
| 特性 | 状态 | 说明 |
|
|
52
52
|
| --- | --- | --- |
|
|
53
|
-
| 闭包(通过 box 按引用捕获) | ✅ | 直接调用与闭包调用共用一条 ABI |
|
|
53
|
+
| 闭包(通过 box 按引用捕获) | ✅ | 直接调用与闭包调用共用一条 ABI;函数**声明**同样会捕获,因此具名函数能读写外层状态 |
|
|
54
54
|
| `this`、方法调用、箭头函数词法 `this` | ✅ | 与 JS 不同:箭头函数有自己的 `arguments` |
|
|
55
55
|
| `call`/`apply`/`bind`、`fn.name`/`fn.length` | ✅ | bind 出的闭包不跟踪部分应用后的 `length` |
|
|
56
56
|
| 一等内置方法(把 `arr.map` 当值用) | ✅ | 暴露为*未绑定*方法值;脱离接收者调用时与 JS 一样抛错 |
|
|
57
57
|
| `fn.toString()` | ⚠️ | 返回 `function name() { [native code] }`,不是源码 |
|
|
58
|
-
|
|
|
58
|
+
| 类:字段、方法、静态成员、`static { ... }` 静态块、getter/setter、`extends`/`super`、`instanceof` | ✅ | 静态块编译为一个静态方法,在类定义时调用 |
|
|
59
59
|
| 构造器参数属性 `constructor(public x: T)` | ✅ | |
|
|
60
60
|
| `#private` 字段/方法/静态成员 | ⚠️ | 以字面量 `#x` 键存储;不做访问控制;父子类同名可能互相覆盖 |
|
|
61
61
|
| `enum`/`const enum` | ✅ | 正向 + 反向映射 |
|
|
62
62
|
| `private`/`protected`/`public`/`readonly`/`abstract`/`implements` | — | 被擦除,无访问控制 |
|
|
63
63
|
| 生成器 `function*`、`yield`、`yield*` | ✅ | 同步与 `async function*`;支持 `for await...of` 与 `Symbol.asyncIterator` |
|
|
64
64
|
| `arguments` 对象 | ✅ | 隐式提供;箭头函数看到的是自己的参数 |
|
|
65
|
-
| 参数个数校验 |
|
|
65
|
+
| 参数个数校验 | ⚠️ | 对本地可见函数 / `const` 箭头函数的直接调用会检查(`TS4004`);方法、导入、展开实参与重新赋值后的绑定不检查。`--no-check` 可关闭 |
|
|
66
66
|
|
|
67
67
|
## 异步、Promise 与事件循环
|
|
68
68
|
|
|
@@ -77,20 +77,27 @@ xbintsc 编译 TypeScript 的一个**实用子集**。本页用来判断你能
|
|
|
77
77
|
| worker 线程 | 🚫 | worker 是子进程 |
|
|
78
78
|
| `async` 生成器 | ✅ | 可在 `await` 与 `yield` 处挂起;每次 `.next()` 返回 Promise;支持 `for await...of` |
|
|
79
79
|
|
|
80
|
-
##
|
|
80
|
+
## 类型:结构化检查后擦除
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
默认开启的[语义检查](../implemented/checker.md)会解析一个小型结构化 TypeScript
|
|
83
|
+
类型子集并检查;代码生成阶段仍然擦除所有类型语法。检查器覆盖:
|
|
83
84
|
|
|
84
85
|
| 构造 | 状态 |
|
|
85
86
|
| --- | --- |
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
| `
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
| 类型注解、接口、类型别名、对象/数组/函数类型 | ✅ 解析并结构化检查,然后擦除 |
|
|
88
|
+
| 初始化、赋值、返回值与实参的可赋值性 | ✅ 只报确定不匹配(`TS4001`);没有完整推断 |
|
|
89
|
+
| `const` 字面量 / 类实例 / 接口上的属性是否存在 | ✅ 默认检查;动态形状会放过(`TS4003`) |
|
|
90
|
+
| 调用确定不可调用的值 | ✅(`TS4002`) |
|
|
91
|
+
| 未定义名(`TS3002`)、同作用域重复声明(`TS3001`)、实参个数(`TS4004`) | ✅ 默认检查;`--no-check` 可全部关闭 |
|
|
92
|
+
| 简单泛型(`T`、`T[]`、显式类型实参) | ✅ 在调用处推断 |
|
|
93
|
+
| 流收窄(`typeof`、`!== null`、`instanceof`、真值判断) | ✅ 在 `if`/`else` 与条件表达式内 |
|
|
94
|
+
| 泛型约束、映射/条件类型、重载、完整推断 | 🚫 解析为 `any` |
|
|
95
|
+
| strict-null 与多余属性检查 | 🚫 |
|
|
96
|
+
| `as`、`satisfies`、非空断言 `!` | — 被擦除的断言,不做校验 |
|
|
97
|
+
|
|
98
|
+
`const x: number = "hello"` 现在会报编译错误(`TS4001`)。检查器刻意保守:
|
|
99
|
+
模型叫不出名字的东西都是 `any`,因此不支持的语法最多隐藏一个 bug,
|
|
100
|
+
绝不会拒绝能正常工作的代码。
|
|
94
101
|
|
|
95
102
|
## 标准库
|
|
96
103
|
|
|
@@ -100,6 +107,8 @@ xbintsc 编译 TypeScript 的一个**实用子集**。本页用来判断你能
|
|
|
100
107
|
(`toReversed`、`toSorted`、`toSpliced`、`with`)、全局 URI 函数、
|
|
101
108
|
一等公民内建构造器(`const A = Array; new A(...)`、`A.isArray`、`x instanceof A`)
|
|
102
109
|
与 `Object.prototype`(`Object.getPrototypeOf({}) === Object.prototype`)。
|
|
110
|
+
`Math` 既是命名空间也是一等对象(`const cos = Math.cos`、`const { sqrt, PI } = Math`),
|
|
111
|
+
`Object.defineProperties` 可一次安装多个属性描述符。
|
|
103
112
|
|
|
104
113
|
| 缺失或行为不同 | 状态 |
|
|
105
114
|
| --- | --- |
|
|
@@ -108,6 +108,14 @@ clang 自身失败。抛出的消息包含完整的 clang 命令与 stderr——
|
|
|
108
108
|
`gui` 扩展需要各平台预编译的 `gui.a`/`gui.lib`,普通源码检出并没有构建它。去掉
|
|
109
109
|
`--ext gui`,或按 [../../zh-CN/gui.md](../../zh-CN/gui.md) 构建该归档。
|
|
110
110
|
|
|
111
|
+
### `media native library not found at …`
|
|
112
|
+
|
|
113
|
+
`<video>`/`<audio>` 播放需要可选的 `media` 归档(`media.a`),用
|
|
114
|
+
`npm run media` 单独构建。构建它,或去掉 `--ext media`;仅启用 `gui` 的构建仍可
|
|
115
|
+
链接,媒体元素只会触发 `error`。`media` 扩展还依赖 `gui`,目前没有 Windows
|
|
116
|
+
归档,单独 `--ext media` 会被拒绝并提示应传的 flag。见
|
|
117
|
+
[../../zh-CN/gui/build.md](../../zh-CN/gui/build.md)。
|
|
118
|
+
|
|
111
119
|
### `Icon file not found` / 图标工具缺失
|
|
112
120
|
|
|
113
121
|
`--icon`/`app.icon` 的路径相对配置文件目录解析。Windows 上嵌入 PE 图标需要
|
package/doc/gui/api.md
CHANGED
|
@@ -34,6 +34,51 @@ launching it does not flash a console window. That also means stdout/stderr go
|
|
|
34
34
|
nowhere when it is started from Explorer; set `app.console: true` in
|
|
35
35
|
`xbintsc.config.json` to keep the console subsystem (useful while debugging).
|
|
36
36
|
|
|
37
|
+
## Browser globals
|
|
38
|
+
|
|
39
|
+
A document ported from the web rarely stops at `createWindow`. With `--ext gui`
|
|
40
|
+
the runtime also serves the small browser surface such ports touch, without the
|
|
41
|
+
program declaring any of it:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
const ctx = new AudioContext(); // also window.AudioContext
|
|
45
|
+
ctx.createGain().connect(ctx.destination);
|
|
46
|
+
document.querySelector("#start").addEventListener("click", () => {});
|
|
47
|
+
console.log(navigator.userAgent, window.innerWidth, location.href);
|
|
48
|
+
requestAnimationFrame(frame);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
| Global | Value |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `window`, `self` | the most recently opened window handle (one is opened implicitly if the program has not created one yet), so `window.innerWidth`, `window.addEventListener`, `window.setTimeout`, `window.localStorage`, `window.location`, `window.devicePixelRatio` and `window.matchMedia` all work |
|
|
54
|
+
| `document` | that window's document handle |
|
|
55
|
+
| `navigator` | `userAgent` (a desktop Chrome string ending in `xbintsc`), `platform`, `vendor`, `language(s)`, `hardwareConcurrency`, `maxTouchPoints`, `onLine`, `vibrate()` |
|
|
56
|
+
| `localStorage` | an in-memory `getItem` / `setItem` / `removeItem` / `clear` / `key` / `length` store |
|
|
57
|
+
| `AudioContext`, `webkitAudioContext` | a Web Audio graph builder (see below) |
|
|
58
|
+
| `Event`, `CustomEvent`, `ProgressEvent`, … | event constructors |
|
|
59
|
+
| `HTMLCanvasElement`, `HTMLImageElement`, `ImageBitmap`, `ImageData`, `OffscreenCanvas`, `WebGL*`, `XRWebGL*`, `Request`, `Headers`, `Response`, `ReadableStream`, `DOMParser` | `typeof` probes answer `"undefined"` (the engine has no WebGL, XR, fetch or streaming backend), which lets a page take its "unsupported" branch instead of calling a no-op stub |
|
|
60
|
+
| `requestAnimationFrame` / `cancelAnimationFrame` | queued on the window's frame list; see [Runtime integration](./runtime.md) |
|
|
61
|
+
| `alert` / `confirm` / `prompt`, `matchMedia`, `getComputedStyle`, `escape` | host implementations (Annex B `escape` encodes per UTF-16 code unit, matching `decodeURIComponent(escape(bytes))`) |
|
|
62
|
+
|
|
63
|
+
`getElementById` / `querySelector` are answered even before `loadHTML` runs: the
|
|
64
|
+
handle is *pending* and binds to the real node the first time it is used, so a
|
|
65
|
+
module that caches `document.querySelector("#id")` at import time keeps working.
|
|
66
|
+
Once the page is parsed a miss answers `undefined`, like the browser.
|
|
67
|
+
|
|
68
|
+
### Web Audio
|
|
69
|
+
|
|
70
|
+
`new AudioContext()` builds a graph but **does not mix or render audio**: there
|
|
71
|
+
is no backend behind it. What is implemented is the surface a page needs to run
|
|
72
|
+
and to read back its own state — `createGain` / `createOscillator` /
|
|
73
|
+
`createBufferSource` / `createBiquadFilter` / `createDynamicsCompressor` /
|
|
74
|
+
`createBuffer` (real `Float32Array` channels) / `decodeAudioData` (resolves with
|
|
75
|
+
an empty buffer) / `resume` / `suspend` / `close`, `AudioParam` `value` plus
|
|
76
|
+
`setValueAtTime` / `linearRampToValueAtTime` / `exponentialRampToValueAtTime` /
|
|
77
|
+
`setTargetAtTime` / `cancelScheduledValues` / `cancelAndHoldAtTime`, and node
|
|
78
|
+
`connect` (returns the destination, so chains chain) / `disconnect` / `start` /
|
|
79
|
+
`stop`. `sampleRate` is 48000, `state` `"running"`, and `currentTime` advances
|
|
80
|
+
only through the event loop.
|
|
81
|
+
|
|
37
82
|
Input handlers receive a single payload object (lifecycle handlers receive none):
|
|
38
83
|
|
|
39
84
|
```ts
|