xbintsc 0.6.28 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/ast/common.d.ts +10 -0
- package/dist/src/binder/declarations.d.ts +1 -0
- package/dist/src/binder/declarations.js +37 -0
- package/dist/src/binder/declarations.js.map +1 -1
- package/dist/src/binder/references.js +12 -0
- package/dist/src/binder/references.js.map +1 -1
- package/dist/src/checker/globals.js +1 -0
- package/dist/src/checker/globals.js.map +1 -1
- package/dist/src/checker/source.js +4 -0
- package/dist/src/checker/source.js.map +1 -1
- package/dist/src/checker/type-system.d.ts +5 -0
- package/dist/src/checker/type-system.js +22 -3
- package/dist/src/checker/type-system.js.map +1 -1
- package/dist/src/cli/help.d.ts +1 -1
- package/dist/src/cli/main.js +15 -3
- package/dist/src/cli/main.js.map +1 -1
- package/dist/src/codegen/generator/calls/access.js +29 -11
- package/dist/src/codegen/generator/calls/access.js.map +1 -1
- package/dist/src/codegen/generator/calls/element-inline.d.ts +42 -0
- package/dist/src/codegen/generator/calls/element-inline.js +388 -0
- package/dist/src/codegen/generator/calls/element-inline.js.map +1 -0
- package/dist/src/codegen/generator/calls/invocation.js +95 -1
- package/dist/src/codegen/generator/calls/invocation.js.map +1 -1
- package/dist/src/codegen/generator/calls/super.js +3 -4
- package/dist/src/codegen/generator/calls/super.js.map +1 -1
- package/dist/src/codegen/generator/calls/unwrap.d.ts +18 -0
- package/dist/src/codegen/generator/calls/unwrap.js +45 -0
- package/dist/src/codegen/generator/calls/unwrap.js.map +1 -0
- package/dist/src/codegen/generator/calls.d.ts +3 -1
- package/dist/src/codegen/generator/calls.js +3 -1
- package/dist/src/codegen/generator/calls.js.map +1 -1
- package/dist/src/codegen/generator/debug.js +20 -3
- package/dist/src/codegen/generator/debug.js.map +1 -1
- package/dist/src/codegen/generator/expressions/assignment.js +24 -2
- package/dist/src/codegen/generator/expressions/assignment.js.map +1 -1
- package/dist/src/codegen/generator/expressions/global-values.d.ts +19 -0
- package/dist/src/codegen/generator/expressions/global-values.js +49 -0
- package/dist/src/codegen/generator/expressions/global-values.js.map +1 -0
- package/dist/src/codegen/generator/expressions/module-values.d.ts +6 -0
- package/dist/src/codegen/generator/expressions/module-values.js +51 -17
- package/dist/src/codegen/generator/expressions/module-values.js.map +1 -1
- package/dist/src/codegen/generator/expressions/primary.d.ts +0 -2
- package/dist/src/codegen/generator/expressions/primary.js +13 -29
- package/dist/src/codegen/generator/expressions/primary.js.map +1 -1
- package/dist/src/codegen/generator/expressions.d.ts +2 -1
- package/dist/src/codegen/generator/expressions.js +2 -1
- package/dist/src/codegen/generator/expressions.js.map +1 -1
- package/dist/src/codegen/generator/generator.js +4 -0
- package/dist/src/codegen/generator/generator.js.map +1 -1
- package/dist/src/codegen/generator/layout.d.ts +65 -0
- package/dist/src/codegen/generator/layout.js +50 -0
- package/dist/src/codegen/generator/layout.js.map +1 -0
- package/dist/src/codegen/generator/lookup-tables.d.ts +22 -0
- package/dist/src/codegen/generator/lookup-tables.js +48 -0
- package/dist/src/codegen/generator/lookup-tables.js.map +1 -0
- package/dist/src/codegen/generator/module.js +38 -7
- package/dist/src/codegen/generator/module.js.map +1 -1
- package/dist/src/codegen/generator/state.js +21 -0
- package/dist/src/codegen/generator/state.js.map +1 -1
- package/dist/src/codegen/generator/tables.d.ts +2 -6
- package/dist/src/codegen/generator/tables.js +18 -12
- package/dist/src/codegen/generator/tables.js.map +1 -1
- package/dist/src/diagnostics/diagnostic.js +1 -1
- package/dist/src/diagnostics/diagnostic.js.map +1 -1
- package/dist/src/diagnostics/source-text.d.ts +37 -9
- package/dist/src/diagnostics/source-text.js +124 -23
- package/dist/src/diagnostics/source-text.js.map +1 -1
- package/dist/src/diagnostics/source.d.ts +16 -6
- package/dist/src/diagnostics/source.js +25 -4
- package/dist/src/diagnostics/source.js.map +1 -1
- package/dist/src/driver/build-key.d.ts +14 -0
- package/dist/src/driver/build-key.js +6 -1
- package/dist/src/driver/build-key.js.map +1 -1
- package/dist/src/driver/bundler/commonjs.d.ts +9 -2
- package/dist/src/driver/bundler/commonjs.js +11 -4
- package/dist/src/driver/bundler/commonjs.js.map +1 -1
- package/dist/src/driver/bundler/concatenate.d.ts +20 -0
- package/dist/src/driver/bundler/concatenate.js +79 -8
- package/dist/src/driver/bundler/concatenate.js.map +1 -1
- package/dist/src/driver/bundler/deferred.d.ts +29 -1
- package/dist/src/driver/bundler/deferred.js +114 -5
- package/dist/src/driver/bundler/deferred.js.map +1 -1
- package/dist/src/driver/bundler/dynamic-import.d.ts +6 -0
- package/dist/src/driver/bundler/dynamic-import.js +59 -3
- package/dist/src/driver/bundler/dynamic-import.js.map +1 -1
- package/dist/src/driver/bundler/graph.d.ts +13 -0
- package/dist/src/driver/bundler/graph.js +4 -4
- package/dist/src/driver/bundler/graph.js.map +1 -1
- package/dist/src/driver/bundler/merge.js +43 -13
- package/dist/src/driver/bundler/merge.js.map +1 -1
- package/dist/src/driver/bundler/namespace-object.d.ts +11 -0
- package/dist/src/driver/bundler/namespace-object.js +32 -0
- package/dist/src/driver/bundler/namespace-object.js.map +1 -1
- package/dist/src/driver/bundler/reexport-resolution.js +11 -2
- package/dist/src/driver/bundler/reexport-resolution.js.map +1 -1
- package/dist/src/driver/bundler/symbols.d.ts +4 -0
- package/dist/src/driver/bundler/symbols.js +14 -1
- package/dist/src/driver/bundler/symbols.js.map +1 -1
- package/dist/src/driver/compiler.js +13 -3
- package/dist/src/driver/compiler.js.map +1 -1
- package/dist/src/driver/config.d.ts +1 -1
- package/dist/src/driver/frontend.js +3 -4
- package/dist/src/driver/frontend.js.map +1 -1
- package/dist/src/driver/options.d.ts +1 -4
- package/dist/src/driver/runtime-lib.d.ts +27 -0
- package/dist/src/driver/runtime-lib.js +78 -2
- package/dist/src/driver/runtime-lib.js.map +1 -1
- package/dist/src/driver/runtime-objects.d.ts +1 -1
- package/dist/src/driver/runtime-objects.js +28 -5
- package/dist/src/driver/runtime-objects.js.map +1 -1
- package/dist/src/driver/toolchain.js +28 -5
- package/dist/src/driver/toolchain.js.map +1 -1
- package/dist/src/driver/version.d.ts +1 -1
- package/dist/src/driver/version.js +1 -1
- package/dist/src/driver/version.js.map +1 -1
- package/dist/src/extensions/gui/html.js +42 -10
- package/dist/src/extensions/gui/html.js.map +1 -1
- package/dist/src/extensions/gui/index.js +48 -0
- package/dist/src/extensions/gui/index.js.map +1 -1
- package/dist/src/extensions/node/buffer/index.d.ts +5 -4
- package/dist/src/extensions/node/buffer/index.js +5 -4
- package/dist/src/extensions/node/buffer/index.js.map +1 -1
- package/dist/src/extensions/node/events/index.js +8 -1
- package/dist/src/extensions/node/events/index.js.map +1 -1
- package/dist/src/extensions/node/fs/callbacks.d.ts +9 -0
- package/dist/src/extensions/node/fs/callbacks.js +42 -0
- package/dist/src/extensions/node/fs/callbacks.js.map +1 -0
- package/dist/src/extensions/node/fs/index.d.ts +2 -3
- package/dist/src/extensions/node/fs/index.js +11 -4
- package/dist/src/extensions/node/fs/index.js.map +1 -1
- package/dist/src/extensions/node/process/index.d.ts +10 -3
- package/dist/src/extensions/node/process/index.js +30 -5
- package/dist/src/extensions/node/process/index.js.map +1 -1
- package/dist/src/extensions/registry.d.ts +27 -0
- package/dist/src/extensions/registry.js +13 -4
- package/dist/src/extensions/registry.js.map +1 -1
- package/dist/src/lexer/scanner.d.ts +7 -1
- package/dist/src/lexer/scanner.js +15 -0
- package/dist/src/lexer/scanner.js.map +1 -1
- package/dist/src/parser/context.d.ts +10 -0
- package/dist/src/parser/context.js +42 -3
- package/dist/src/parser/context.js.map +1 -1
- package/dist/src/parser/expressions.js +2 -2
- package/dist/src/parser/expressions.js.map +1 -1
- package/dist/src/parser/helpers.d.ts +8 -0
- package/dist/src/parser/helpers.js +21 -0
- package/dist/src/parser/helpers.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 +43 -0
- package/dist/tests/binder/binder.test.js.map +1 -1
- package/dist/tests/cli/main.test.js +9 -0
- package/dist/tests/cli/main.test.js.map +1 -1
- package/dist/tests/codegen/element-layout.test.d.ts +19 -0
- package/dist/tests/codegen/element-layout.test.js +80 -0
- package/dist/tests/codegen/element-layout.test.js.map +1 -0
- package/dist/tests/codegen/expressions.test.js +25 -0
- package/dist/tests/codegen/expressions.test.js.map +1 -1
- package/dist/tests/codegen/llvm.test.js +28 -0
- package/dist/tests/codegen/llvm.test.js.map +1 -1
- package/dist/tests/diagnostics/diagnostic.test.js +9 -0
- package/dist/tests/diagnostics/diagnostic.test.js.map +1 -1
- package/dist/tests/diagnostics/source-text.test.d.ts +1 -0
- package/dist/tests/diagnostics/source-text.test.js +50 -0
- package/dist/tests/diagnostics/source-text.test.js.map +1 -0
- package/dist/tests/diagnostics/source.test.js +17 -0
- package/dist/tests/diagnostics/source.test.js.map +1 -1
- package/dist/tests/driver/build-key.test.d.ts +1 -0
- package/dist/tests/driver/build-key.test.js +49 -0
- package/dist/tests/driver/build-key.test.js.map +1 -0
- package/dist/tests/driver/bundler-resolve.test.js +12 -0
- package/dist/tests/driver/bundler-resolve.test.js.map +1 -1
- package/dist/tests/driver/commonjs-prelude.test.d.ts +11 -0
- package/dist/tests/driver/commonjs-prelude.test.js +69 -0
- package/dist/tests/driver/commonjs-prelude.test.js.map +1 -0
- package/dist/tests/driver/compiler.test.js +42 -1
- package/dist/tests/driver/compiler.test.js.map +1 -1
- package/dist/tests/driver/html-deferred-cycles.test.d.ts +10 -0
- package/dist/tests/driver/html-deferred-cycles.test.js +75 -0
- package/dist/tests/driver/html-deferred-cycles.test.js.map +1 -0
- package/dist/tests/driver/namespace-type-exports.test.d.ts +9 -0
- package/dist/tests/driver/namespace-type-exports.test.js +59 -0
- package/dist/tests/driver/namespace-type-exports.test.js.map +1 -0
- package/dist/tests/driver/runtime-lib.test.js +49 -1
- package/dist/tests/driver/runtime-lib.test.js.map +1 -1
- package/dist/tests/driver/toolchain.test.js +8 -1
- package/dist/tests/driver/toolchain.test.js.map +1 -1
- package/dist/tests/driver/usage.test.js +2 -1
- package/dist/tests/driver/usage.test.js.map +1 -1
- package/dist/tests/e2e/async-await.test.js +16 -0
- package/dist/tests/e2e/async-await.test.js.map +1 -1
- package/dist/tests/e2e/compile-basics.test.js +53 -0
- package/dist/tests/e2e/compile-basics.test.js.map +1 -1
- package/dist/tests/e2e/compile-builtins.test.js +29 -0
- package/dist/tests/e2e/compile-builtins.test.js.map +1 -1
- package/dist/tests/e2e/compile-deferred-marker.test.d.ts +14 -0
- package/dist/tests/e2e/compile-deferred-marker.test.js +68 -0
- package/dist/tests/e2e/compile-deferred-marker.test.js.map +1 -0
- package/dist/tests/e2e/compile-deferred-reexport.test.d.ts +12 -0
- package/dist/tests/e2e/compile-deferred-reexport.test.js +89 -0
- package/dist/tests/e2e/compile-deferred-reexport.test.js.map +1 -0
- package/dist/tests/e2e/compile-error-module.test.d.ts +9 -0
- package/dist/tests/e2e/compile-error-module.test.js +29 -0
- package/dist/tests/e2e/compile-error-module.test.js.map +1 -0
- package/dist/tests/e2e/compile-gc-promises.test.d.ts +11 -0
- package/dist/tests/e2e/compile-gc-promises.test.js +52 -0
- package/dist/tests/e2e/compile-gc-promises.test.js.map +1 -0
- package/dist/tests/e2e/compile-modules.test.js +53 -0
- package/dist/tests/e2e/compile-modules.test.js.map +1 -1
- package/dist/tests/e2e/compile-node-fs-callbacks.test.d.ts +6 -0
- package/dist/tests/e2e/compile-node-fs-callbacks.test.js +46 -0
- package/dist/tests/e2e/compile-node-fs-callbacks.test.js.map +1 -0
- package/dist/tests/e2e/compile-node-inheritance.test.d.ts +6 -0
- package/dist/tests/e2e/compile-node-inheritance.test.js +48 -0
- package/dist/tests/e2e/compile-node-inheritance.test.js.map +1 -0
- package/dist/tests/e2e/compile-node-require.test.d.ts +9 -0
- package/dist/tests/e2e/compile-node-require.test.js +29 -0
- package/dist/tests/e2e/compile-node-require.test.js.map +1 -0
- package/dist/tests/e2e/compile-node-stats.test.d.ts +8 -0
- package/dist/tests/e2e/compile-node-stats.test.js +26 -0
- package/dist/tests/e2e/compile-node-stats.test.js.map +1 -0
- package/dist/tests/e2e/compile-objects-classes.test.js.map +1 -1
- package/dist/tests/e2e/compile-prototype-chain.test.d.ts +8 -0
- package/dist/tests/e2e/compile-prototype-chain.test.js +24 -0
- package/dist/tests/e2e/compile-prototype-chain.test.js.map +1 -0
- package/dist/tests/e2e/compile-proxy.test.d.ts +6 -0
- package/dist/tests/e2e/compile-proxy.test.js +66 -0
- package/dist/tests/e2e/compile-proxy.test.js.map +1 -0
- package/dist/tests/e2e/compile-web-globals.test.d.ts +6 -0
- package/dist/tests/e2e/compile-web-globals.test.js +94 -0
- package/dist/tests/e2e/compile-web-globals.test.js.map +1 -0
- package/dist/tests/e2e/differential-language.test.js +25 -0
- package/dist/tests/e2e/differential-language.test.js.map +1 -1
- package/dist/tests/e2e/differential-values.test.js +59 -0
- package/dist/tests/e2e/differential-values.test.js.map +1 -1
- package/dist/tests/e2e/fetch.test.js +1 -1
- package/dist/tests/e2e/gc.test.js +22 -0
- package/dist/tests/e2e/gc.test.js.map +1 -1
- package/dist/tests/e2e/gui-audio-extra.test.d.ts +12 -0
- package/dist/tests/e2e/gui-audio-extra.test.js +185 -0
- package/dist/tests/e2e/gui-audio-extra.test.js.map +1 -0
- package/dist/tests/e2e/gui-browser.test.js +35 -2
- package/dist/tests/e2e/gui-browser.test.js.map +1 -1
- package/dist/tests/e2e/gui-dom.test.js +88 -0
- package/dist/tests/e2e/gui-dom.test.js.map +1 -1
- package/dist/tests/e2e/gui-script-import-order.test.js +24 -0
- package/dist/tests/e2e/gui-script-import-order.test.js.map +1 -1
- package/dist/tests/e2e/gui-webgl-declarations.test.d.ts +13 -0
- package/dist/tests/e2e/gui-webgl-declarations.test.js +136 -0
- package/dist/tests/e2e/gui-webgl-declarations.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl-texture-units.test.d.ts +12 -0
- package/dist/tests/e2e/gui-webgl-texture-units.test.js +86 -0
- package/dist/tests/e2e/gui-webgl-texture-units.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-blit.test.js +6 -2
- package/dist/tests/e2e/gui-webgl2-blit.test.js.map +1 -1
- package/dist/tests/e2e/gui-webgl2-msaa-float.test.d.ts +12 -0
- package/dist/tests/e2e/gui-webgl2-msaa-float.test.js +157 -0
- package/dist/tests/e2e/gui-webgl2-msaa-float.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-msaa.test.d.ts +10 -0
- package/dist/tests/e2e/gui-webgl2-msaa.test.js +344 -0
- package/dist/tests/e2e/gui-webgl2-msaa.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-target-orientation.test.d.ts +15 -0
- package/dist/tests/e2e/gui-webgl2-target-orientation.test.js +287 -0
- package/dist/tests/e2e/gui-webgl2-target-orientation.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2.test.js +59 -1
- package/dist/tests/e2e/gui-webgl2.test.js.map +1 -1
- package/dist/tests/e2e/hang-watchdog.test.d.ts +10 -0
- package/dist/tests/e2e/hang-watchdog.test.js +50 -0
- package/dist/tests/e2e/hang-watchdog.test.js.map +1 -0
- package/dist/tests/e2e/json-stringify-to-json.test.d.ts +10 -0
- package/dist/tests/e2e/json-stringify-to-json.test.js +61 -0
- package/dist/tests/e2e/json-stringify-to-json.test.js.map +1 -0
- package/dist/tests/e2e/method-call-cache.test.d.ts +5 -0
- package/dist/tests/e2e/method-call-cache.test.js +65 -0
- package/dist/tests/e2e/method-call-cache.test.js.map +1 -0
- package/dist/tests/e2e/node-process.test.d.ts +7 -0
- package/dist/tests/e2e/node-process.test.js +50 -0
- package/dist/tests/e2e/node-process.test.js.map +1 -0
- package/dist/tests/e2e/performance-now.test.d.ts +9 -0
- package/dist/tests/e2e/performance-now.test.js +36 -0
- package/dist/tests/e2e/performance-now.test.js.map +1 -0
- package/dist/tests/e2e/property-ic.test.js +33 -0
- package/dist/tests/e2e/property-ic.test.js.map +1 -1
- package/dist/tests/e2e/runtime-coverage-buffer.test.js +31 -0
- package/dist/tests/e2e/runtime-coverage-buffer.test.js.map +1 -1
- package/dist/tests/e2e/shape-interning.test.d.ts +16 -0
- package/dist/tests/e2e/shape-interning.test.js +55 -0
- package/dist/tests/e2e/shape-interning.test.js.map +1 -0
- package/dist/tests/e2e/string-utf16.test.js +9 -0
- package/dist/tests/e2e/string-utf16.test.js.map +1 -1
- package/dist/tests/e2e/typed-array-views.test.js +26 -0
- package/dist/tests/e2e/typed-array-views.test.js.map +1 -1
- package/dist/tests/e2e/url-search-params.test.js +19 -0
- package/dist/tests/e2e/url-search-params.test.js.map +1 -1
- package/dist/tests/e2e/web-streams.test.js +44 -29
- package/dist/tests/e2e/web-streams.test.js.map +1 -1
- package/dist/tests/extensions/gui.test.js +16 -1
- package/dist/tests/extensions/gui.test.js.map +1 -1
- package/dist/tests/helpers.js +1 -0
- package/dist/tests/helpers.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/parser/literals.test.js +19 -0
- package/dist/tests/parser/literals.test.js.map +1 -1
- package/dist/tests/parser/statements.test.js +13 -0
- package/dist/tests/parser/statements.test.js.map +1 -1
- package/doc/ai/cli.md +1 -0
- package/doc/ai/contributing.md +8 -5
- package/doc/ai/extensions.md +12 -3
- package/doc/ai/language-support.md +2 -1
- package/doc/ai/troubleshooting.md +14 -0
- package/doc/ai/zh-CN/cli.md +1 -0
- package/doc/ai/zh-CN/contributing.md +6 -3
- package/doc/ai/zh-CN/extensions.md +10 -2
- package/doc/ai/zh-CN/language-support.md +2 -1
- package/doc/ai/zh-CN/troubleshooting.md +12 -0
- package/doc/gui/api.md +26 -4
- package/doc/gui/dom.md +8 -0
- package/doc/gui/known-issues.md +35 -6
- package/doc/gui/runtime.md +16 -1
- package/doc/gui/webgl.md +97 -26
- package/doc/gui-scripts.md +2 -1
- package/doc/gui.md +8 -5
- package/doc/implemented/binder.md +2 -1
- package/doc/implemented/checker.md +14 -0
- package/doc/implemented/codegen.md +7 -0
- package/doc/implemented/lexer.md +1 -1
- package/doc/implemented/modules.md +23 -1
- package/doc/implemented/node/buffer.md +18 -5
- package/doc/implemented/node/fs.md +22 -1
- package/doc/implemented/node/process.md +65 -5
- package/doc/implemented/node.md +7 -1
- package/doc/implemented/operators.md +3 -1
- package/doc/implemented/parser.md +3 -2
- package/doc/implemented/runtime-core.md +13 -2
- package/doc/implemented/stdlib.md +79 -4
- package/doc/implemented/typed-arrays.md +18 -2
- package/doc/unimplemented/classes.md +1 -0
- package/doc/unimplemented/modules.md +1 -0
- package/doc/unimplemented/stdlib.md +2 -1
- package/doc/xbintsc.config.schema.json +5 -0
- package/doc/zh-CN/gui/api.md +19 -5
- package/doc/zh-CN/gui/dom.md +6 -0
- package/doc/zh-CN/gui/known-issues.md +24 -5
- package/doc/zh-CN/gui/runtime.md +13 -1
- package/doc/zh-CN/gui/webgl.md +20 -7
- package/doc/zh-CN/gui-scripts.md +2 -1
- package/doc/zh-CN/gui.md +4 -1
- package/doc/zh-CN/implemented/binder.md +2 -1
- package/doc/zh-CN/implemented/checker.md +10 -0
- package/doc/zh-CN/implemented/codegen.md +7 -0
- package/doc/zh-CN/implemented/lexer.md +1 -1
- package/doc/zh-CN/implemented/modules.md +17 -1
- package/doc/zh-CN/implemented/node/buffer.md +3 -1
- package/doc/zh-CN/implemented/node/fs.md +19 -1
- package/doc/zh-CN/implemented/node/process.md +59 -5
- package/doc/zh-CN/implemented/node.md +1 -1
- package/doc/zh-CN/implemented/operators.md +2 -1
- package/doc/zh-CN/implemented/parser.md +3 -2
- package/doc/zh-CN/implemented/runtime-core.md +10 -2
- package/doc/zh-CN/implemented/stdlib.md +64 -4
- package/doc/zh-CN/implemented/typed-arrays.md +14 -2
- package/doc/zh-CN/unimplemented/classes.md +1 -0
- package/doc/zh-CN/unimplemented/modules.md +1 -0
- package/doc/zh-CN/unimplemented/stdlib.md +2 -1
- package/package.json +7 -7
- package/runtime/ext_gui/audio.cpp +39 -3
- package/runtime/ext_gui/audio_extra.cpp +353 -0
- package/runtime/ext_gui/audio_extra.h +47 -0
- package/runtime/ext_gui/audio_fft.h +76 -0
- package/runtime/ext_gui/audio_internal.h +21 -0
- package/runtime/ext_gui/audio_mixer.cpp +46 -1
- package/runtime/ext_gui/audio_mixer.h +89 -1
- package/runtime/ext_gui/audio_mixer_extra.cpp +126 -0
- package/runtime/ext_gui/audio_nodes.cpp +242 -0
- package/runtime/ext_gui/audio_nodes_internal.h +81 -0
- package/runtime/ext_gui/audio_nodes_spatial.cpp +375 -0
- package/runtime/ext_gui/browser.cpp +9 -0
- package/runtime/ext_gui/browser_screen.cpp +73 -0
- package/runtime/ext_gui/dom_api_canvas.cpp +9 -1
- package/runtime/ext_gui/dom_api_internal.h +3 -0
- package/runtime/ext_gui/dom_api_node.cpp +21 -0
- package/runtime/ext_gui/dom_api_node_read.cpp +29 -0
- package/runtime/ext_gui/dom_api_proto.cpp +3 -0
- package/runtime/ext_gui/dom_api_webgl2.cpp +16 -11
- package/runtime/ext_gui/dom_api_webgl2_msaa.cpp +64 -0
- package/runtime/ext_gui/dom_api_webgl_compressed.cpp +2 -2
- package/runtime/ext_gui/dom_api_webgl_framebuffer.cpp +68 -11
- package/runtime/ext_gui/dom_api_webgl_methods.h +3 -0
- package/runtime/ext_gui/dom_api_webgl_state.cpp +4 -2
- package/runtime/ext_gui/dom_api_webgl_texture.cpp +6 -6
- package/runtime/ext_gui/gui.cpp +6 -1
- package/runtime/ext_gui/gui_engine.h +2 -0
- package/runtime/ext_gui/gui_events.cpp +13 -8
- package/runtime/ext_gui/gui_webgl.cpp +3 -2
- package/runtime/ext_gui/style_ua.cpp +4 -0
- package/runtime/ext_gui/warnings.cpp +1 -1
- package/runtime/ext_gui/webgl.h +102 -7
- package/runtime/ext_gui/webgl_api.h +3 -2
- package/runtime/ext_gui/webgl_blit.cpp +109 -15
- package/runtime/ext_gui/webgl_blit_color.cpp +264 -0
- package/runtime/ext_gui/webgl_blit_depth.cpp +26 -8
- package/runtime/ext_gui/webgl_buffer.cpp +20 -170
- package/runtime/ext_gui/webgl_context.cpp +117 -169
- package/runtime/ext_gui/webgl_draw.cpp +116 -5
- package/runtime/ext_gui/webgl_draw_buffers.cpp +21 -6
- package/runtime/ext_gui/webgl_draw_setup.cpp +1 -0
- package/runtime/ext_gui/webgl_draw_state.h +2 -0
- package/runtime/ext_gui/webgl_feature.cpp +2 -2
- package/runtime/ext_gui/webgl_feature.h +4 -3
- package/runtime/ext_gui/webgl_framebuffer.cpp +346 -0
- package/runtime/ext_gui/webgl_glsl_rewrite.cpp +78 -47
- package/runtime/ext_gui/webgl_objects.h +16 -2
- package/runtime/ext_gui/webgl_pipeline.cpp +1 -1
- package/runtime/ext_gui/webgl_state.cpp +45 -36
- package/runtime/ext_gui/webgl_targets.cpp +440 -0
- package/runtime/ext_gui/webgl_texture.cpp +81 -25
- package/runtime/ext_gui/window.cpp +8 -0
- package/runtime/ext_node/buffer/buffer.c +5 -4
- package/runtime/ext_node/buffer/parts/byte-access.inc +115 -11
- package/runtime/ext_node/buffer/parts/prototype.inc +4 -1
- package/runtime/ext_node/events/events.c +9 -0
- package/runtime/ext_node/fs/callbacks.c +138 -0
- package/runtime/ext_node/fs/fs_ops.c +28 -15
- package/runtime/ext_node/module/module.c +18 -9
- package/runtime/ext_node/process/process.c +117 -32
- package/runtime/ext_node/process/streams.c +370 -0
- package/runtime/ext_node/process/streams.h +20 -0
- package/runtime/rt.h +63 -27
- package/runtime/rt_binary.h +44 -0
- package/runtime/rt_internal.h +61 -69
- package/runtime/rt_object.h +83 -0
- package/runtime/rt_profile.h +45 -0
- package/runtime/xt_alloc.c +154 -181
- package/runtime/xt_array_buffer.c +99 -71
- package/runtime/xt_async_io.c +3 -0
- package/runtime/xt_builtins.c +29 -24
- package/runtime/xt_constructors.c +102 -2
- package/runtime/xt_containers/access.inc +125 -12
- package/runtime/xt_containers/arrays.inc +2 -1
- package/runtime/xt_containers/cstr_cache.inc +56 -0
- package/runtime/xt_containers/function_prototypes.inc +58 -0
- package/runtime/xt_containers/method_cache.inc +121 -0
- package/runtime/xt_containers/object_keys.inc +58 -0
- package/runtime/xt_containers/objects.inc +59 -75
- package/runtime/xt_containers/shapes.inc +153 -8
- package/runtime/xt_containers.c +5 -0
- package/runtime/xt_exit.c +34 -0
- package/runtime/xt_fetch/headers.inc +1 -0
- package/runtime/xt_fetch/response.inc +28 -8
- package/runtime/xt_fetch/webapi.inc +82 -0
- package/runtime/xt_fetch.c +5 -0
- package/runtime/xt_gc_release.c +70 -0
- package/runtime/xt_gc_stack.c +83 -0
- package/runtime/xt_gc_verify.c +136 -0
- package/runtime/xt_intl.c +224 -0
- package/runtime/xt_io/console.inc +66 -0
- package/runtime/xt_io/exception.inc +66 -1
- package/runtime/xt_io/watchdog.inc +101 -0
- package/runtime/xt_io.c +1 -0
- package/runtime/xt_loop.c +23 -3
- package/runtime/xt_module_values.c +82 -0
- package/runtime/xt_pool.c +151 -0
- package/runtime/xt_profile.c +126 -0
- package/runtime/xt_proxy.c +140 -0
- package/runtime/xt_stdlib/dispatch.inc +104 -9
- package/runtime/xt_stdlib/math.inc +272 -57
- package/runtime/xt_stdlib2/date.inc +7 -1
- package/runtime/xt_stdlib2/json.inc +28 -0
- package/runtime/xt_stdlib2/json_stringify.inc +71 -55
- package/runtime/xt_stdlib2/regexp-match.inc +17 -0
- package/runtime/xt_storage/indexed_db.c +4 -1
- package/runtime/xt_structured_clone.c +2 -1
- package/runtime/xt_typed_array/construction.inc +10 -0
- package/runtime/xt_typed_array/elements.inc +43 -23
- package/runtime/xt_url.c +50 -0
- package/runtime/xt_values/constructors.inc +4 -1
- package/runtime/xt_values/strings.inc +3 -1
- package/runtime/xt_web.h +27 -0
- package/runtime/xt_web_abort.c +373 -0
- package/scripts/build-runtime.ts +8 -0
- package/src/ast/common.ts +10 -0
- package/src/binder/declarations.ts +34 -0
- package/src/binder/references.ts +12 -0
- package/src/checker/globals.ts +1 -0
- package/src/checker/source.ts +3 -0
- package/src/checker/type-system.ts +23 -3
- package/src/cli/main.ts +14 -3
- package/src/codegen/generator/calls/access.ts +28 -10
- package/src/codegen/generator/calls/element-inline.ts +433 -0
- package/src/codegen/generator/calls/invocation.ts +99 -1
- package/src/codegen/generator/calls/super.ts +5 -4
- package/src/codegen/generator/calls/unwrap.ts +47 -0
- package/src/codegen/generator/calls.ts +5 -0
- package/src/codegen/generator/debug.ts +21 -3
- package/src/codegen/generator/expressions/assignment.ts +26 -2
- package/src/codegen/generator/expressions/global-values.ts +57 -0
- package/src/codegen/generator/expressions/module-values.ts +57 -19
- package/src/codegen/generator/expressions/primary.ts +13 -36
- package/src/codegen/generator/expressions.ts +3 -0
- package/src/codegen/generator/generator.ts +4 -0
- package/src/codegen/generator/layout.ts +54 -0
- package/src/codegen/generator/lookup-tables.ts +63 -0
- package/src/codegen/generator/module.ts +38 -7
- package/src/codegen/generator/state.ts +22 -0
- package/src/codegen/generator/tables.ts +18 -12
- package/src/diagnostics/diagnostic.ts +1 -1
- package/src/diagnostics/source-text.ts +118 -22
- package/src/diagnostics/source.ts +29 -7
- package/src/driver/build-key.ts +21 -1
- package/src/driver/bundler/commonjs.ts +12 -5
- package/src/driver/bundler/concatenate.ts +96 -12
- package/src/driver/bundler/deferred.ts +122 -6
- package/src/driver/bundler/dynamic-import.ts +75 -2
- package/src/driver/bundler/graph.ts +4 -4
- package/src/driver/bundler/merge.ts +42 -9
- package/src/driver/bundler/namespace-object.ts +44 -0
- package/src/driver/bundler/reexport-resolution.ts +14 -2
- package/src/driver/bundler/symbols.ts +17 -0
- package/src/driver/compiler.ts +14 -3
- package/src/driver/config.ts +1 -1
- package/src/driver/frontend.ts +3 -4
- package/src/driver/options.ts +1 -4
- package/src/driver/runtime-lib.ts +87 -2
- package/src/driver/runtime-objects.ts +28 -5
- package/src/driver/toolchain.ts +28 -5
- package/src/driver/version.ts +1 -1
- package/src/extensions/gui/html.ts +41 -11
- package/src/extensions/gui/index.ts +50 -1
- package/src/extensions/node/buffer/index.ts +5 -4
- package/src/extensions/node/events/index.ts +8 -1
- package/src/extensions/node/fs/callbacks.ts +45 -0
- package/src/extensions/node/fs/index.ts +11 -4
- package/src/extensions/node/process/index.ts +30 -5
- package/src/extensions/registry.ts +41 -4
- package/src/lexer/scanner.ts +16 -1
- package/src/parser/context.ts +39 -3
- package/src/parser/expressions.ts +2 -2
- package/src/parser/helpers.ts +22 -0
- package/src/parser/literals.ts +6 -2
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
SyntaxKind,
|
|
11
|
+
type CallExpression,
|
|
12
|
+
type Identifier,
|
|
11
13
|
type ObjectLiteralExpression,
|
|
12
14
|
type PropertyAssignment,
|
|
13
15
|
type Statement,
|
|
@@ -16,6 +18,39 @@ import {
|
|
|
16
18
|
} from "../../ast/nodes.js";
|
|
17
19
|
import type { ModuleRecord } from "./types.js";
|
|
18
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Lower a *deferred* module's `export * as ns from "./dep"` to
|
|
23
|
+
* `const <final> = __xt_deferred_<dep>()`.
|
|
24
|
+
*
|
|
25
|
+
* The dependency's export names only exist inside its own wrapper function, so
|
|
26
|
+
* an object literal of final names would reference names that are not in scope
|
|
27
|
+
* (TS3002) or be `undefined` at run time. The wrapper returns the dependency's
|
|
28
|
+
* exports object, which is what the namespace export needs, and calling it also
|
|
29
|
+
* initialises the dependency first.
|
|
30
|
+
*/
|
|
31
|
+
export function deferredNamespaceToStatement(
|
|
32
|
+
statement: Statement,
|
|
33
|
+
finalName: string,
|
|
34
|
+
wrapperName: string,
|
|
35
|
+
): Statement {
|
|
36
|
+
const callee: Identifier = {
|
|
37
|
+
kind: SyntaxKind.Identifier,
|
|
38
|
+
text: wrapperName,
|
|
39
|
+
start: statement.start,
|
|
40
|
+
end: statement.start,
|
|
41
|
+
};
|
|
42
|
+
const initializer: CallExpression = {
|
|
43
|
+
kind: SyntaxKind.CallExpression,
|
|
44
|
+
expression: callee,
|
|
45
|
+
arguments: [],
|
|
46
|
+
typeArguments: [],
|
|
47
|
+
optional: false,
|
|
48
|
+
start: statement.start,
|
|
49
|
+
end: statement.end,
|
|
50
|
+
};
|
|
51
|
+
return variableStatement(statement, finalName, initializer);
|
|
52
|
+
}
|
|
53
|
+
|
|
19
54
|
/** Lower `import * as ns from "./mod"` to `const m0_ns = { ...exports }`. */
|
|
20
55
|
export function namespaceImportToStatement(
|
|
21
56
|
statement: Statement,
|
|
@@ -38,6 +73,15 @@ export function namespaceImportToStatement(
|
|
|
38
73
|
start: statement.start,
|
|
39
74
|
end: statement.end,
|
|
40
75
|
};
|
|
76
|
+
return variableStatement(statement, finalName, initializer);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** `const <finalName> = <initializer>` at the statement's offsets. */
|
|
80
|
+
function variableStatement(
|
|
81
|
+
statement: Statement,
|
|
82
|
+
finalName: string,
|
|
83
|
+
initializer: ObjectLiteralExpression | CallExpression,
|
|
84
|
+
): Statement {
|
|
41
85
|
const declaration: VariableDeclaration = {
|
|
42
86
|
kind: SyntaxKind.VariableDeclaration,
|
|
43
87
|
name: { kind: SyntaxKind.Identifier, text: finalName, start: statement.start, end: statement.start },
|
|
@@ -24,7 +24,8 @@ import {
|
|
|
24
24
|
type Statement,
|
|
25
25
|
} from "../../ast/nodes.js";
|
|
26
26
|
import type { ModuleRecord } from "./types.js";
|
|
27
|
-
import { namespaceImportToStatement } from "./namespace-object.js";
|
|
27
|
+
import { deferredNamespaceToStatement, namespaceImportToStatement } from "./namespace-object.js";
|
|
28
|
+
import { deferredWrapperName } from "./deferred.js";
|
|
28
29
|
|
|
29
30
|
export function resolveReexports(
|
|
30
31
|
records: ModuleRecord[],
|
|
@@ -63,6 +64,8 @@ export function resolveReexports(
|
|
|
63
64
|
}
|
|
64
65
|
} else if (!clause) {
|
|
65
66
|
for (const [name, value] of dependency.exports) {
|
|
67
|
+
// `export *` re-exports named exports only, never `default`.
|
|
68
|
+
if (name === "default") continue;
|
|
66
69
|
if (record.exports.get(name) !== value) {
|
|
67
70
|
record.exports.set(name, value);
|
|
68
71
|
changed = true;
|
|
@@ -82,9 +85,18 @@ export function resolveReexports(
|
|
|
82
85
|
const nsName = (declaration.exportClause as { name: Identifier }).name.text;
|
|
83
86
|
const dependency = dependencyOf(record, declaration.moduleSpecifier.value);
|
|
84
87
|
if (dependency) {
|
|
88
|
+
/* Both deferred: the dependency's final names live inside its
|
|
89
|
+
* wrapper, so read its exports object instead of building one. */
|
|
90
|
+
const deferred = deferredModules.has(record.path) && deferredModules.has(dependency.path);
|
|
85
91
|
namespaceStatements.set(
|
|
86
92
|
statement,
|
|
87
|
-
|
|
93
|
+
deferred
|
|
94
|
+
? deferredNamespaceToStatement(
|
|
95
|
+
statement,
|
|
96
|
+
`${record.prefix}${nsName}`,
|
|
97
|
+
deferredWrapperName(dependency),
|
|
98
|
+
)
|
|
99
|
+
: namespaceImportToStatement(statement, `${record.prefix}${nsName}`, dependency),
|
|
88
100
|
);
|
|
89
101
|
}
|
|
90
102
|
}
|
|
@@ -36,6 +36,23 @@ export function declarationName(node: Node): Identifier | undefined {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/** True when every declaration of this symbol is erased before codegen: an
|
|
40
|
+
* interface, a type alias, or an ambient `declare`. Such a symbol has no
|
|
41
|
+
* runtime slot, so a module namespace object must not reference it. */
|
|
42
|
+
export function isTypeOnlySymbol(symbol: SymbolInfo): boolean {
|
|
43
|
+
return symbol.declarations.length > 0 && symbol.declarations.every(isErasedDeclaration);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function isErasedDeclaration(node: Node): boolean {
|
|
47
|
+
if (
|
|
48
|
+
node.kind === SyntaxKind.InterfaceDeclaration ||
|
|
49
|
+
node.kind === SyntaxKind.TypeAliasDeclaration
|
|
50
|
+
) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return hasModifier(node, ModifierKind.Declare);
|
|
54
|
+
}
|
|
55
|
+
|
|
39
56
|
/** Rewrite a symbol's declaration and every reference to `finalName`. */
|
|
40
57
|
export function renameSymbol(symbol: SymbolInfo, finalName: string): void {
|
|
41
58
|
for (const declaration of symbol.declarations) {
|
package/src/driver/compiler.ts
CHANGED
|
@@ -182,10 +182,20 @@ export function build(entryPath: string, options: BuildOptions = {}): BuildResul
|
|
|
182
182
|
const storage = resolveStorage(options.storage);
|
|
183
183
|
|
|
184
184
|
const runtimeDir = findRuntimeDir();
|
|
185
|
+
/* The toolchain is part of the cache key, so it has to be resolved before
|
|
186
|
+
* the freshness check. `emit: "ir"` is front-end only and must keep working
|
|
187
|
+
* without clang, so it is the one build that does not resolve one. */
|
|
188
|
+
const toolchain: Pick<ResolvedToolchain, "clang" | "linkerArgs" | "env" | "sdkRoot"> | undefined =
|
|
189
|
+
emit === "ir"
|
|
190
|
+
? undefined
|
|
191
|
+
: options.clang
|
|
192
|
+
? { clang: options.clang, linkerArgs: [], env: {} }
|
|
193
|
+
: resolveToolchain(runner);
|
|
185
194
|
const cacheKey = buildCacheKey({
|
|
186
195
|
sourceText: parsed.cacheText,
|
|
187
196
|
emit,
|
|
188
197
|
optimize,
|
|
198
|
+
arch: process.arch,
|
|
189
199
|
registry,
|
|
190
200
|
runtimeDir,
|
|
191
201
|
icon,
|
|
@@ -197,6 +207,7 @@ export function build(entryPath: string, options: BuildOptions = {}): BuildResul
|
|
|
197
207
|
pgo,
|
|
198
208
|
pgoDir,
|
|
199
209
|
features: linkFeatures.map((feature) => feature.name),
|
|
210
|
+
...(toolchain === undefined ? {} : { toolchain }),
|
|
200
211
|
});
|
|
201
212
|
|
|
202
213
|
// A `.app` bundle is deterministic from the output path and name, so it can be
|
|
@@ -255,10 +266,10 @@ export function build(entryPath: string, options: BuildOptions = {}): BuildResul
|
|
|
255
266
|
}
|
|
256
267
|
|
|
257
268
|
// -- toolchain -----------------------------------------------------------
|
|
269
|
+
if (toolchain === undefined) {
|
|
270
|
+
throw new Error("xbintsc: internal error: no toolchain resolved for a linked build");
|
|
271
|
+
}
|
|
258
272
|
const clangStarted = Date.now();
|
|
259
|
-
const toolchain: Pick<ResolvedToolchain, "clang" | "linkerArgs" | "env" | "sdkRoot"> = options.clang
|
|
260
|
-
? { clang: options.clang, linkerArgs: [], env: {} }
|
|
261
|
-
: resolveToolchain(runner);
|
|
262
273
|
const clang = toolchain.clang;
|
|
263
274
|
if (pgo === "use") {
|
|
264
275
|
try {
|
package/src/driver/config.ts
CHANGED
|
@@ -59,7 +59,7 @@ export interface ProjectConfig {
|
|
|
59
59
|
readonly features?: readonly string[];
|
|
60
60
|
/** Optional link features to keep out even when auto-detection finds a use. */
|
|
61
61
|
readonly noFeatures?: readonly string[];
|
|
62
|
-
/**
|
|
62
|
+
/** Exact module specifiers mapped to local replacement files. */
|
|
63
63
|
readonly moduleOverrides?: Readonly<Record<string, string>>;
|
|
64
64
|
readonly force?: boolean;
|
|
65
65
|
readonly app?: AppConfig;
|
package/src/driver/frontend.ts
CHANGED
|
@@ -7,11 +7,10 @@
|
|
|
7
7
|
* `run` and `build`.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { readFileSync } from "node:fs";
|
|
11
10
|
import { resolve } from "node:path";
|
|
12
11
|
import { DiagnosticBag } from "../diagnostics/diagnostic.js";
|
|
13
12
|
import { SourceFile } from "../diagnostics/source.js";
|
|
14
|
-
import { sourceTextBytes } from "../diagnostics/source-text.js";
|
|
13
|
+
import { readSourceText, sourceTextBytes } from "../diagnostics/source-text.js";
|
|
15
14
|
import { Parser } from "../parser/parser.js";
|
|
16
15
|
import { generate } from "../codegen/llvm.js";
|
|
17
16
|
import { SyntaxKind, type SourceFileNode } from "../ast/nodes.js";
|
|
@@ -63,7 +62,7 @@ export function parseEntry(
|
|
|
63
62
|
moduleOverrides?: Readonly<Record<string, string>>,
|
|
64
63
|
): ParsedEntry {
|
|
65
64
|
const absoluteEntry = resolve(entryPath);
|
|
66
|
-
const sourceText =
|
|
65
|
+
const sourceText = readSourceText(absoluteEntry);
|
|
67
66
|
const file = new SourceFile(absoluteEntry, sourceText);
|
|
68
67
|
const parser = new Parser(file, diagnostics);
|
|
69
68
|
let sourceFile = parser.parseSourceFile();
|
|
@@ -92,7 +91,7 @@ export function compileString(
|
|
|
92
91
|
extensions?: ExtensionRegistry,
|
|
93
92
|
options: FrontendOptions = {},
|
|
94
93
|
): CompileStringResult {
|
|
95
|
-
const file = new SourceFile(fileName, source);
|
|
94
|
+
const file = new SourceFile(fileName, sourceTextBytes(source));
|
|
96
95
|
const diagnostics = new DiagnosticBag();
|
|
97
96
|
const parser = new Parser(file, diagnostics);
|
|
98
97
|
const sourceFile = parser.parseSourceFile();
|
package/src/driver/options.ts
CHANGED
|
@@ -71,10 +71,7 @@ export interface BuildOptions {
|
|
|
71
71
|
readonly features?: readonly string[];
|
|
72
72
|
/** Optional link features to keep out even when the scan detects a use. */
|
|
73
73
|
readonly noFeatures?: readonly string[];
|
|
74
|
-
/**
|
|
75
|
-
* Bare module specifiers mapped to local replacement files. A specifier in
|
|
76
|
-
* this map resolves to its file (an absolute path) before `node_modules`.
|
|
77
|
-
*/
|
|
74
|
+
/** Specifiers mapped to local replacement files, checked before `node_modules`. */
|
|
78
75
|
readonly moduleOverrides?: Readonly<Record<string, string>>;
|
|
79
76
|
}
|
|
80
77
|
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
* dependency.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import { existsSync, readdirSync } from "node:fs";
|
|
23
|
-
import { dirname, join } from "node:path";
|
|
22
|
+
import { existsSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
23
|
+
import { dirname, join, relative, sep } from "node:path";
|
|
24
|
+
import { hashParts } from "./cache.js";
|
|
24
25
|
import { findRuntimeDir, platformSlug } from "./paths.js";
|
|
25
26
|
|
|
26
27
|
/** Archive suffixes, in the order a name is probed. */
|
|
@@ -94,3 +95,87 @@ export function findRuntimeLibrary(
|
|
|
94
95
|
}
|
|
95
96
|
return undefined;
|
|
96
97
|
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
/** Name of the file recording which sources an archive was built from. */
|
|
101
|
+
export const RUNTIME_STAMP_FILE = "runtime-stamp.json";
|
|
102
|
+
|
|
103
|
+
/** Source files that make up the runtime archives (the archives' own folder is
|
|
104
|
+
* skipped: it holds the `.a`/`.lib` outputs and the stamp). */
|
|
105
|
+
function runtimeSourceFiles(runtimeDir: string): string[] {
|
|
106
|
+
const files: string[] = [];
|
|
107
|
+
const walk = (dir: string): void => {
|
|
108
|
+
let entries: string[];
|
|
109
|
+
try {
|
|
110
|
+
entries = readdirSync(dir);
|
|
111
|
+
} catch {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
for (const name of entries.sort()) {
|
|
115
|
+
const full = join(dir, name);
|
|
116
|
+
if (statSync(full).isDirectory()) {
|
|
117
|
+
if (name === "lib") continue;
|
|
118
|
+
walk(full);
|
|
119
|
+
} else if (/\.(c|h|inc)$/.test(name)) {
|
|
120
|
+
files.push(full);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
walk(runtimeDir);
|
|
125
|
+
return files;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Fingerprint of the C runtime sources an archive is compiled from.
|
|
130
|
+
*
|
|
131
|
+
* A prebuilt `core`/`ext_<name>` archive is only usable when it was built from
|
|
132
|
+
* exactly these sources: the driver compares the archive's stamp with this
|
|
133
|
+
* value and compiles from source when they differ. Without the stamp a stale
|
|
134
|
+
* archive links silently whenever every symbol it needs still exists — the
|
|
135
|
+
* program then runs the *old* runtime, which is very hard to diagnose.
|
|
136
|
+
*/
|
|
137
|
+
export function runtimeSourceFingerprint(runtimeDir: string, compilerVersion: string, flags: readonly string[]): string {
|
|
138
|
+
const parts: string[] = ["runtime-archive", compilerVersion, process.platform, process.arch, [...flags].join(" ")];
|
|
139
|
+
for (const file of runtimeSourceFiles(runtimeDir)) {
|
|
140
|
+
parts.push(relative(runtimeDir, file).split(sep).join("/"), readFileSync(file, "utf8"));
|
|
141
|
+
}
|
|
142
|
+
return hashParts(parts);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** The recorded fingerprint of the archives in `dir`, if any. */
|
|
146
|
+
export function readRuntimeStamp(dir: string): string | undefined {
|
|
147
|
+
try {
|
|
148
|
+
const parsed: unknown = JSON.parse(readFileSync(join(dir, RUNTIME_STAMP_FILE), "utf8"));
|
|
149
|
+
if (typeof parsed !== "object" || parsed === null) return undefined;
|
|
150
|
+
const fingerprint = (parsed as { fingerprint?: unknown }).fingerprint;
|
|
151
|
+
return typeof fingerprint === "string" ? fingerprint : undefined;
|
|
152
|
+
} catch {
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** Record the fingerprint next to the archives a build just produced. */
|
|
158
|
+
export function writeRuntimeStamp(dir: string, fingerprint: string, compilerVersion: string): void {
|
|
159
|
+
writeFileSync(
|
|
160
|
+
join(dir, RUNTIME_STAMP_FILE),
|
|
161
|
+
`${JSON.stringify({ compilerVersion, fingerprint }, null, "\t")}\n`,
|
|
162
|
+
"utf8",
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* A prebuilt archive, but only when it was built from the sources now on disk.
|
|
168
|
+
*
|
|
169
|
+
* Returns `undefined` for a missing archive *and* for a stale one, so the caller
|
|
170
|
+
* falls back to compiling the runtime; `stale` tells the two apart for the
|
|
171
|
+
* message.
|
|
172
|
+
*/
|
|
173
|
+
export function freshRuntimeLibrary(
|
|
174
|
+
name: string,
|
|
175
|
+
dirs: readonly string[],
|
|
176
|
+
fingerprint: string,
|
|
177
|
+
): { path?: string; stale?: string } {
|
|
178
|
+
const path = findRuntimeLibrary(name, dirs);
|
|
179
|
+
if (!path) return {};
|
|
180
|
+
return readRuntimeStamp(dirname(path)) === fingerprint ? { path } : { stale: path };
|
|
181
|
+
}
|
|
@@ -11,13 +11,14 @@ import { basename, join, resolve, sep } from "node:path";
|
|
|
11
11
|
import type { ExtensionRegistry } from "../extensions/registry.js";
|
|
12
12
|
import type { ResolvedLinkFeature } from "./link-features.js";
|
|
13
13
|
import { hashParts } from "./cache.js";
|
|
14
|
-
import {
|
|
14
|
+
import { freshRuntimeLibrary, runtimeLibDirs, runtimeSourceFingerprint } from "./runtime-lib.js";
|
|
15
15
|
import { compileC, optimizationFlags, RUNTIME_CFLAGS, sysrootFlags, type PgoMode, type Runner } from "./toolchain.js";
|
|
16
16
|
import { COMPILER_VERSION } from "./version.js";
|
|
17
17
|
|
|
18
18
|
/** Core runtime translation units (each compiled and cached independently). */
|
|
19
19
|
export const RUNTIME_SOURCES = [
|
|
20
20
|
"xt_alloc.c",
|
|
21
|
+
"xt_gc_stack.c",
|
|
21
22
|
"xt_values.c",
|
|
22
23
|
"xt_bigint.c",
|
|
23
24
|
"xt_containers.c",
|
|
@@ -31,14 +32,22 @@ export const RUNTIME_SOURCES = [
|
|
|
31
32
|
"xt_async.c",
|
|
32
33
|
"xt_loop.c",
|
|
33
34
|
"xt_async_io.c",
|
|
35
|
+
"xt_exit.c",
|
|
36
|
+
"xt_intl.c",
|
|
34
37
|
"xt_generator.c",
|
|
35
38
|
"xt_coroutine.c",
|
|
36
39
|
"xt_fetch.c",
|
|
40
|
+
"xt_web_abort.c",
|
|
41
|
+
"xt_proxy.c",
|
|
42
|
+
"xt_gc_verify.c",
|
|
37
43
|
"xt_symbol.c",
|
|
38
44
|
"xt_builtins.c",
|
|
39
45
|
"xt_constructors.c",
|
|
40
46
|
"xt_structured_clone.c",
|
|
41
47
|
"xt_performance.c",
|
|
48
|
+
"xt_profile.c",
|
|
49
|
+
"xt_pool.c",
|
|
50
|
+
"xt_gc_release.c",
|
|
42
51
|
"xt_random.c",
|
|
43
52
|
"xt_crypto.c",
|
|
44
53
|
"xt_text_codec.c",
|
|
@@ -154,7 +163,17 @@ export function ensureRuntimeObjects(options: RuntimeObjectsOptions): RuntimeObj
|
|
|
154
163
|
};
|
|
155
164
|
|
|
156
165
|
const runtimeInclude = [runtimeDir];
|
|
157
|
-
|
|
166
|
+
/* A shipped archive is only used when it was built from the sources on disk;
|
|
167
|
+
* a stale one links silently and the program runs an old runtime. */
|
|
168
|
+
const fingerprint = runtimeSourceFingerprint(runtimeDir, COMPILER_VERSION, RUNTIME_CFLAGS);
|
|
169
|
+
const staleArchives: string[] = [];
|
|
170
|
+
const prebuilt = (name: string): string | undefined => {
|
|
171
|
+
if (!preferPrebuilt) return undefined;
|
|
172
|
+
const found = freshRuntimeLibrary(name, options.runtimeLibDirs ?? runtimeLibDirs(), fingerprint);
|
|
173
|
+
if (found.stale !== undefined) staleArchives.push(found.stale);
|
|
174
|
+
return found.path;
|
|
175
|
+
};
|
|
176
|
+
const coreArchive = prebuilt("core");
|
|
158
177
|
const runtimeObjects = coreArchive
|
|
159
178
|
? [coreArchive]
|
|
160
179
|
: RUNTIME_SOURCES.map((source) => compileOne(join(runtimeDir, source), basename(source, ".c"), runtimeInclude));
|
|
@@ -167,9 +186,7 @@ export function ensureRuntimeObjects(options: RuntimeObjectsOptions): RuntimeObj
|
|
|
167
186
|
for (const extension of registry.all()) {
|
|
168
187
|
const sources = extension.runtimeSources ? extension.runtimeSources() : [];
|
|
169
188
|
if (sources.length === 0) continue;
|
|
170
|
-
const archive =
|
|
171
|
-
? findRuntimeLibrary(`ext_${extension.name}`, options.runtimeLibDirs)
|
|
172
|
-
: undefined;
|
|
189
|
+
const archive = prebuilt(`ext_${extension.name}`);
|
|
173
190
|
if (archive) {
|
|
174
191
|
extensionObjects.push(archive);
|
|
175
192
|
prebuiltArchives.push(archive);
|
|
@@ -184,6 +201,12 @@ export function ensureRuntimeObjects(options: RuntimeObjectsOptions): RuntimeObj
|
|
|
184
201
|
);
|
|
185
202
|
}
|
|
186
203
|
}
|
|
204
|
+
if (staleArchives.length > 0) {
|
|
205
|
+
/* Once per process: the archives stay stale until `npm run runtime` . */
|
|
206
|
+
process.stderr.write(
|
|
207
|
+
"xbintsc: prebuilt runtime archive is stale (the runtime sources changed); compiling the C runtime from source\n",
|
|
208
|
+
);
|
|
209
|
+
}
|
|
187
210
|
// A native archive may be shared by several manifests; link each once.
|
|
188
211
|
const featureObjects: string[] = [];
|
|
189
212
|
for (const feature of options.features ?? []) {
|
package/src/driver/toolchain.ts
CHANGED
|
@@ -34,14 +34,37 @@ export const realRunner: Runner = {
|
|
|
34
34
|
};
|
|
35
35
|
if (options.env) spawnOptions.env = Object.assign({}, process.env, options.env);
|
|
36
36
|
const result = spawnSync(command, [...args], spawnOptions);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
const stdout = result.stdout?.toString() ?? "";
|
|
38
|
+
const baseStderr = result.stderr?.toString() ?? "";
|
|
39
|
+
/* `status === null` is never success: the child either failed to start
|
|
40
|
+
* (`error`) or was terminated by a signal. Treating the signal case as 0
|
|
41
|
+
* made a killed clang look like a successful compile and let `build`
|
|
42
|
+
* record a missing/truncated artifact. */
|
|
43
|
+
if (result.error) {
|
|
44
|
+
const detail = result.error.message;
|
|
45
|
+
return {
|
|
46
|
+
status: result.status ?? 1,
|
|
47
|
+
stdout,
|
|
48
|
+
stderr: appendLine(baseStderr, detail),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (result.status === null) {
|
|
52
|
+
return {
|
|
53
|
+
status: 1,
|
|
54
|
+
stdout,
|
|
55
|
+
stderr: appendLine(baseStderr, `terminated by signal ${result.signal ?? "unknown"}`),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return { status: result.status, stdout, stderr: baseStderr };
|
|
42
59
|
},
|
|
43
60
|
};
|
|
44
61
|
|
|
62
|
+
/** Append `line` to `text` without losing an existing final newline. */
|
|
63
|
+
function appendLine(text: string, line: string): string {
|
|
64
|
+
if (text.length === 0) return line;
|
|
65
|
+
return text.endsWith("\n") ? `${text}${line}` : `${text}\n${line}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
45
68
|
export class ToolchainError extends Error {
|
|
46
69
|
readonly command: string;
|
|
47
70
|
readonly status: number;
|
package/src/driver/version.ts
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* "eager" execution point), i.e. every script is effectively `defer`red.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import { existsSync
|
|
27
|
+
import { existsSync } from "node:fs";
|
|
28
28
|
import { dirname, relative, resolve } from "node:path";
|
|
29
29
|
import {
|
|
30
30
|
ModifierKind,
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
} from "../../ast/nodes.js";
|
|
38
38
|
import { DiagnosticBag } from "../../diagnostics/diagnostic.js";
|
|
39
39
|
import { SourceFile } from "../../diagnostics/source.js";
|
|
40
|
+
import { readSourceText } from "../../diagnostics/source-text.js";
|
|
40
41
|
import { Parser } from "../../parser/parser.js";
|
|
41
42
|
import { artifactPath } from "../../canonical.js";
|
|
42
43
|
import { hashString } from "../../driver/cache.js";
|
|
@@ -81,6 +82,22 @@ function isExecutable(type: string | undefined, lang: string | undefined): boole
|
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Whether an executable `<script>` is plain JavaScript rather than TypeScript.
|
|
87
|
+
*
|
|
88
|
+
* A browser page's script is JavaScript by default; only `lang="ts"` or a
|
|
89
|
+
* TypeScript MIME type opts into type checking. Untyped scripts skip the
|
|
90
|
+
* checker's inference (see `isPlainJavaScriptNode`), which is what keeps
|
|
91
|
+
* minified bundles — `Game.foo = …` installed after the literal, a closure
|
|
92
|
+
* variable initialized to `null`, calls that rely on default parameters — from
|
|
93
|
+
* failing on heuristics that a real browser never applies.
|
|
94
|
+
*/
|
|
95
|
+
function isPlainScript(type: string | undefined, lang: string | undefined): boolean {
|
|
96
|
+
if (lang !== undefined && /^(ts|tsx|typescript)$/i.test(lang)) return false;
|
|
97
|
+
if (type === undefined) return true;
|
|
98
|
+
return !/^(text\/typescript|application\/typescript)$/i.test(type);
|
|
99
|
+
}
|
|
100
|
+
|
|
84
101
|
/** Rewrite a relative import specifier so it resolves from the HTML file. */
|
|
85
102
|
function rewriteSpecifier(htmlPath: string, scriptPath: string, specifier: string): string {
|
|
86
103
|
if (!specifier.startsWith(".")) return specifier;
|
|
@@ -274,8 +291,9 @@ export function loadHtmlAsset(path: string, source: string): AssetLoadResult {
|
|
|
274
291
|
const page = new SourceFile(path, source).text;
|
|
275
292
|
/* `file` is set for an external `<script src>`: its body keeps that file as
|
|
276
293
|
* the origin of every node, so a `.js` script stays untyped and diagnostics
|
|
277
|
-
* name the script, not the HTML page.
|
|
278
|
-
|
|
294
|
+
* name the script, not the HTML page. `untyped` marks an inline body that is
|
|
295
|
+
* JavaScript (the default) rather than `lang="ts"`. */
|
|
296
|
+
const scripts: Array<{ id: string; body: string; prelude: string[]; file?: string; untyped?: boolean }> = [];
|
|
279
297
|
const imports: string[] = [];
|
|
280
298
|
const lazyImports: string[] = [];
|
|
281
299
|
const importedText = new Set<string>();
|
|
@@ -301,12 +319,18 @@ export function loadHtmlAsset(path: string, source: string): AssetLoadResult {
|
|
|
301
319
|
bound.add(name);
|
|
302
320
|
}
|
|
303
321
|
};
|
|
304
|
-
const register = (compiled: CompiledModule, file?: string): string => {
|
|
322
|
+
const register = (compiled: CompiledModule, options?: { file?: string; untyped?: boolean }): string => {
|
|
305
323
|
/* Hash the wrapped body, prelude included: the engine keys the registry by
|
|
306
324
|
* id, so two scripts with the same statements but different deferred
|
|
307
325
|
* imports must not collapse into one entry. */
|
|
308
326
|
const id = hashString([...compiled.prelude, compiled.body].join("\n"));
|
|
309
|
-
scripts.push({
|
|
327
|
+
scripts.push({
|
|
328
|
+
id,
|
|
329
|
+
body: compiled.body,
|
|
330
|
+
prelude: compiled.prelude,
|
|
331
|
+
...(options?.file ? { file: options.file } : {}),
|
|
332
|
+
...(options?.untyped ? { untyped: true } : {}),
|
|
333
|
+
});
|
|
310
334
|
return id;
|
|
311
335
|
};
|
|
312
336
|
|
|
@@ -314,7 +338,9 @@ export function loadHtmlAsset(path: string, source: string): AssetLoadResult {
|
|
|
314
338
|
* would be dropped at runtime. Inline it (and its `@import`s) now. */
|
|
315
339
|
const styles = inlineStylesheets(path, page);
|
|
316
340
|
const html = styles.html.replace(SCRIPT_RE, (match, attributes: string, inlineBody: string) => {
|
|
317
|
-
|
|
341
|
+
const lang = attribute(attributes, "lang");
|
|
342
|
+
const type = attribute(attributes, "type");
|
|
343
|
+
if (!isExecutable(type, lang)) return match;
|
|
318
344
|
const src = attribute(attributes, "src");
|
|
319
345
|
|
|
320
346
|
if (src !== undefined && !URL_SPEC.test(src) && !src.startsWith("//")) {
|
|
@@ -322,9 +348,9 @@ export function loadHtmlAsset(path: string, source: string): AssetLoadResult {
|
|
|
322
348
|
if (!existsSync(scriptPath)) {
|
|
323
349
|
throw new Error(`gui: <script src="${src}"> not found (looked for ${scriptPath})`);
|
|
324
350
|
}
|
|
325
|
-
const compiled = compileModuleSource(path, scriptPath,
|
|
351
|
+
const compiled = compileModuleSource(path, scriptPath, readSourceText(scriptPath), scripts.length);
|
|
326
352
|
hoistImports(compiled, `<script src="${src}">`, `alias it in ${scriptPath}`);
|
|
327
|
-
const id = register(compiled, scriptPath);
|
|
353
|
+
const id = register(compiled, { file: scriptPath });
|
|
328
354
|
return `<script data-xt-id="${id}"></script>`;
|
|
329
355
|
}
|
|
330
356
|
|
|
@@ -339,7 +365,7 @@ export function loadHtmlAsset(path: string, source: string): AssetLoadResult {
|
|
|
339
365
|
* where codegen cannot link its binding (TS5001). */
|
|
340
366
|
const compiled = compileModuleSource(path, path, inlineBody, scripts.length);
|
|
341
367
|
hoistImports(compiled, "inline <script>", "alias it");
|
|
342
|
-
const id = register(compiled);
|
|
368
|
+
const id = register(compiled, { untyped: isPlainScript(type, lang) });
|
|
343
369
|
return `<script data-xt-id="${id}"></script>`;
|
|
344
370
|
});
|
|
345
371
|
|
|
@@ -348,14 +374,18 @@ export function loadHtmlAsset(path: string, source: string): AssetLoadResult {
|
|
|
348
374
|
/* Offset of the next part once joined with "\n", so a body's span in the
|
|
349
375
|
* generated module can be reported back as the file it was copied from. */
|
|
350
376
|
let offset = parts.reduce((total, part) => total + part.length + 1, 0);
|
|
351
|
-
for (const { id, body, prelude, file } of scripts) {
|
|
377
|
+
for (const { id, body, prelude, file, untyped } of scripts) {
|
|
352
378
|
const header = `function __xt_script_${id}(window: any, document: any): void {\n`;
|
|
353
379
|
const preludeText = prelude.length > 0 ? `${prelude.join("\n")}\n` : "";
|
|
354
380
|
const part =
|
|
355
381
|
`${header}${preludeText}${body}\n}\n` + `__registerScript(${JSON.stringify(id)}, __xt_script_${id});`;
|
|
382
|
+
const bodyStart = offset + header.length + preludeText.length;
|
|
356
383
|
if (file !== undefined) {
|
|
357
|
-
const bodyStart = offset + header.length + preludeText.length;
|
|
358
384
|
sourceRanges.push({ start: bodyStart, end: bodyStart + body.length, file });
|
|
385
|
+
} else if (untyped) {
|
|
386
|
+
/* An inline JavaScript body: its origin is the page itself, and the
|
|
387
|
+
* checker must treat it as untyped JavaScript, not as TypeScript. */
|
|
388
|
+
sourceRanges.push({ start: bodyStart, end: bodyStart + body.length, file: path, untyped: true });
|
|
359
389
|
}
|
|
360
390
|
parts.push(part);
|
|
361
391
|
offset += part.length + 1;
|
|
@@ -66,6 +66,12 @@ const hostTypes = [
|
|
|
66
66
|
"HTMLImageElement",
|
|
67
67
|
"HTMLVideoElement",
|
|
68
68
|
"HTMLAudioElement",
|
|
69
|
+
/* Media-source and offline-rendering types. `VideoFrame` is a real
|
|
70
|
+
* constructor value so `frame instanceof VideoFrame` is a safe `false`
|
|
71
|
+
* instead of a `TypeError`; `OfflineAudioContext` renders through the same
|
|
72
|
+
* mixer as `AudioContext`. */
|
|
73
|
+
"VideoFrame",
|
|
74
|
+
"OfflineAudioContext",
|
|
69
75
|
"HTMLElement",
|
|
70
76
|
"Element",
|
|
71
77
|
"Node",
|
|
@@ -145,7 +151,7 @@ const hostTypes = [
|
|
|
145
151
|
"GPUDeviceLostInfo",
|
|
146
152
|
] as const;
|
|
147
153
|
|
|
148
|
-
const browserGlobals: Record<string, { symbol: string; argument?: string }> = {
|
|
154
|
+
const browserGlobals: Record<string, { symbol: string; argument?: string; member?: string }> = {
|
|
149
155
|
window: { symbol: "xt_browser_window" },
|
|
150
156
|
self: { symbol: "xt_browser_window" },
|
|
151
157
|
document: { symbol: "xt_browser_document" },
|
|
@@ -154,8 +160,51 @@ const browserGlobals: Record<string, { symbol: string; argument?: string }> = {
|
|
|
154
160
|
* by the SQLite `storage` link feature, so a page reaches them through core
|
|
155
161
|
* rather than the engine's in-memory `window.localStorage` store. */
|
|
156
162
|
__THREE_DEVTOOLS__: { symbol: "xt_browser_missing" },
|
|
163
|
+
/* Half-precision typed arrays exist in very new engines only, and the
|
|
164
|
+
* runtime has no 16-bit float element type. Answering `undefined` keeps
|
|
165
|
+
* feature probes (`typeof Float16Array < "u"`) on their fallback path instead
|
|
166
|
+
* of handing back a constructor that cannot hold data. */
|
|
167
|
+
Float16Array: { symbol: "xt_browser_missing" },
|
|
157
168
|
createImageBitmap: { symbol: "xt_browser_create_image_bitmap" },
|
|
158
169
|
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Window members that a browser also exposes as bare globals.
|
|
173
|
+
*
|
|
174
|
+
* In a browser the global scope *is* the window, so `innerWidth`,
|
|
175
|
+
* `location.reload()` and `addEventListener("resize", …)` work without a
|
|
176
|
+
* `window.` prefix — pages and libraries (three.js probes `innerWidth`) rely on
|
|
177
|
+
* that. xbintsc has no global object here, so each name is declared as a member
|
|
178
|
+
* read of the window value: the read lowers to `xt_get(window, name)` and a
|
|
179
|
+
* call to `xt_call_method(window, name, …)`, which keeps getter-backed members
|
|
180
|
+
* live instead of capturing a value at startup.
|
|
181
|
+
*/
|
|
182
|
+
const windowGlobals: readonly string[] = [
|
|
183
|
+
"innerWidth",
|
|
184
|
+
"innerHeight",
|
|
185
|
+
"outerWidth",
|
|
186
|
+
"outerHeight",
|
|
187
|
+
"devicePixelRatio",
|
|
188
|
+
"location",
|
|
189
|
+
"screen",
|
|
190
|
+
"scrollX",
|
|
191
|
+
"scrollY",
|
|
192
|
+
"addEventListener",
|
|
193
|
+
"removeEventListener",
|
|
194
|
+
"dispatchEvent",
|
|
195
|
+
"setTimeout",
|
|
196
|
+
"clearTimeout",
|
|
197
|
+
"setInterval",
|
|
198
|
+
"clearInterval",
|
|
199
|
+
"queueMicrotask",
|
|
200
|
+
"focus",
|
|
201
|
+
"blur",
|
|
202
|
+
"scrollTo",
|
|
203
|
+
"scrollBy",
|
|
204
|
+
];
|
|
205
|
+
for (const member of windowGlobals) {
|
|
206
|
+
browserGlobals[member] = { symbol: "xt_browser_window", member };
|
|
207
|
+
}
|
|
159
208
|
for (const type of hostTypes) {
|
|
160
209
|
browserGlobals[type] = { symbol: "xt_browser_type", argument: type };
|
|
161
210
|
}
|