xbintsc 0.6.10 → 0.6.13
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/expressions.d.ts +6 -0
- package/dist/src/checker/globals.js +2 -1
- package/dist/src/checker/globals.js.map +1 -1
- package/dist/src/checker/type-infer.js +1 -1
- package/dist/src/checker/type-infer.js.map +1 -1
- package/dist/src/cli/help.d.ts +1 -1
- package/dist/src/codegen/generator/calls/literals.js +4 -1
- package/dist/src/codegen/generator/calls/literals.js.map +1 -1
- package/dist/src/codegen/generator/expressions/assignment.js +3 -1
- package/dist/src/codegen/generator/expressions/assignment.js.map +1 -1
- package/dist/src/codegen/generator/expressions/operators.js +2 -6
- package/dist/src/codegen/generator/expressions/operators.js.map +1 -1
- package/dist/src/codegen/generator/expressions/primary.d.ts +9 -0
- package/dist/src/codegen/generator/expressions/primary.js +44 -7
- package/dist/src/codegen/generator/expressions/primary.js.map +1 -1
- package/dist/src/codegen/generator/state.js +3 -0
- package/dist/src/codegen/generator/state.js.map +1 -1
- package/dist/src/codegen/generator/tables.js +3 -0
- package/dist/src/codegen/generator/tables.js.map +1 -1
- package/dist/src/driver/bundler/commonjs.js +1 -1
- package/dist/src/driver/bundler/commonjs.js.map +1 -1
- package/dist/src/driver/bundler/symbols.js +6 -0
- package/dist/src/driver/bundler/symbols.js.map +1 -1
- package/dist/src/driver/compiler.js +1 -1
- package/dist/src/driver/compiler.js.map +1 -1
- package/dist/src/driver/runtime-objects.d.ts +1 -1
- package/dist/src/driver/runtime-objects.js +2 -0
- package/dist/src/driver/runtime-objects.js.map +1 -1
- package/dist/src/driver/version.d.ts +1 -1
- package/dist/src/driver/version.js +1 -1
- package/dist/src/extensions/node/crypto/index.js +12 -1
- package/dist/src/extensions/node/crypto/index.js.map +1 -1
- package/dist/src/extensions/node/index.js +2 -0
- package/dist/src/extensions/node/index.js.map +1 -1
- package/dist/src/extensions/node/readline/index.d.ts +12 -0
- package/dist/src/extensions/node/readline/index.js +27 -0
- package/dist/src/extensions/node/readline/index.js.map +1 -0
- package/dist/src/parser/declarations/functions.js +6 -0
- package/dist/src/parser/declarations/functions.js.map +1 -1
- package/dist/src/parser/literals.js +1 -1
- package/dist/src/parser/literals.js.map +1 -1
- package/dist/tests/e2e/compile-builtins.test.js +26 -0
- package/dist/tests/e2e/compile-builtins.test.js.map +1 -1
- package/dist/tests/e2e/compile-modules.test.js +22 -0
- package/dist/tests/e2e/compile-modules.test.js.map +1 -1
- package/dist/tests/e2e/compile-node.test.js +37 -1
- package/dist/tests/e2e/compile-node.test.js.map +1 -1
- package/dist/tests/e2e/crypto-random.test.d.ts +9 -0
- package/dist/tests/e2e/crypto-random.test.js +63 -0
- package/dist/tests/e2e/crypto-random.test.js.map +1 -0
- package/dist/tests/e2e/date-parse.test.js +44 -1
- package/dist/tests/e2e/date-parse.test.js.map +1 -1
- package/dist/tests/e2e/gui-browser.test.js +61 -0
- package/dist/tests/e2e/gui-browser.test.js.map +1 -1
- package/dist/tests/e2e/gui-css-coverage.test.js +40 -1
- package/dist/tests/e2e/gui-css-coverage.test.js.map +1 -1
- package/dist/tests/e2e/gui-css-features.test.js +100 -0
- package/dist/tests/e2e/gui-css-features.test.js.map +1 -1
- package/dist/tests/e2e/gui-dom.test.js +63 -0
- package/dist/tests/e2e/gui-dom.test.js.map +1 -1
- package/dist/tests/e2e/gui-errors.test.d.ts +11 -0
- package/dist/tests/e2e/gui-errors.test.js +68 -0
- package/dist/tests/e2e/gui-errors.test.js.map +1 -0
- package/dist/tests/e2e/gui-form.test.d.ts +9 -0
- package/dist/tests/e2e/gui-form.test.js +359 -0
- package/dist/tests/e2e/gui-form.test.js.map +1 -0
- package/dist/tests/e2e/gui-script-import-order.test.js +6 -1
- package/dist/tests/e2e/gui-script-import-order.test.js.map +1 -1
- package/dist/tests/e2e/gui-style.test.js +82 -0
- package/dist/tests/e2e/gui-style.test.js.map +1 -1
- package/dist/tests/e2e/gui-unsupported.test.js +4 -3
- package/dist/tests/e2e/gui-unsupported.test.js.map +1 -1
- package/dist/tests/e2e/gui-webgl2-shadow-sampler.test.js +7 -1
- package/dist/tests/e2e/gui-webgl2-shadow-sampler.test.js.map +1 -1
- package/dist/tests/e2e/harness.d.ts +4 -0
- package/dist/tests/e2e/harness.js +2 -0
- package/dist/tests/e2e/harness.js.map +1 -1
- package/dist/tests/e2e/json-parse-errors.test.d.ts +9 -0
- package/dist/tests/e2e/json-parse-errors.test.js +48 -0
- package/dist/tests/e2e/json-parse-errors.test.js.map +1 -0
- package/dist/tests/e2e/readline.test.d.ts +7 -0
- package/dist/tests/e2e/readline.test.js +73 -0
- package/dist/tests/e2e/readline.test.js.map +1 -0
- package/doc/ai/language-support.md +2 -1
- package/doc/ai/zh-CN/language-support.md +2 -1
- package/doc/gui/api.md +24 -3
- package/doc/gui/dom.md +28 -14
- package/doc/gui/input.md +74 -3
- package/doc/gui/known-issues.md +2 -1
- package/doc/gui/layout.md +5 -1
- package/doc/implemented/node/crypto.md +8 -0
- package/doc/implemented/node/fs.md +1 -1
- package/doc/implemented/node/readline.md +34 -0
- package/doc/implemented/node.md +1 -0
- package/doc/implemented/stdlib.md +10 -2
- package/doc/unimplemented/node/modules.md +2 -3
- package/doc/unimplemented/node.md +2 -2
- package/doc/zh-CN/gui/api.md +20 -3
- package/doc/zh-CN/gui/dom.md +23 -13
- package/doc/zh-CN/gui/input.md +65 -4
- package/doc/zh-CN/gui/known-issues.md +2 -1
- package/doc/zh-CN/gui/layout.md +4 -1
- package/doc/zh-CN/implemented/node/crypto.md +6 -0
- package/doc/zh-CN/implemented/node/fs.md +1 -1
- package/doc/zh-CN/implemented/node/readline.md +33 -0
- package/doc/zh-CN/implemented/node.md +1 -0
- package/doc/zh-CN/implemented/stdlib.md +10 -2
- package/doc/zh-CN/unimplemented/node/modules.md +1 -2
- package/doc/zh-CN/unimplemented/node.md +2 -2
- package/package.json +7 -7
- package/runtime/ext_gui/browser_abort.cpp +2 -2
- package/runtime/ext_gui/browser_loop.cpp +1 -0
- package/runtime/ext_gui/browser_media.cpp +1 -1
- package/runtime/ext_gui/css_match.cpp +21 -1
- package/runtime/ext_gui/css_selector.cpp +2 -2
- package/runtime/ext_gui/document.cpp +12 -0
- package/runtime/ext_gui/dom.h +41 -2
- package/runtime/ext_gui/dom_api_canvas_image.cpp +2 -1
- package/runtime/ext_gui/dom_api_document.cpp +28 -0
- package/runtime/ext_gui/dom_api_events.cpp +18 -15
- package/runtime/ext_gui/dom_api_form.cpp +567 -0
- package/runtime/ext_gui/dom_api_internal.h +48 -214
- package/runtime/ext_gui/dom_api_mutation.cpp +1 -1
- package/runtime/ext_gui/dom_api_node.cpp +28 -15
- package/runtime/ext_gui/dom_api_node_read.cpp +28 -1
- package/runtime/ext_gui/dom_api_proto.cpp +47 -0
- package/runtime/ext_gui/dom_api_webgl_methods.h +217 -0
- package/runtime/ext_gui/dom_parse.cpp +114 -1
- package/runtime/ext_gui/error_report.cpp +166 -0
- package/runtime/ext_gui/form_focus.cpp +293 -0
- package/runtime/ext_gui/form_input.cpp +448 -0
- package/runtime/ext_gui/form_internal.h +30 -0
- package/runtime/ext_gui/form_shared.cpp +126 -0
- package/runtime/ext_gui/form_state.cpp +536 -0
- package/runtime/ext_gui/form_state.h +97 -0
- package/runtime/ext_gui/gui.cpp +16 -0
- package/runtime/ext_gui/gui_engine.h +53 -4
- package/runtime/ext_gui/gui_events.cpp +67 -49
- package/runtime/ext_gui/layout.cpp +6 -0
- package/runtime/ext_gui/layout.h +4 -0
- package/runtime/ext_gui/layout_flow.cpp +23 -1
- package/runtime/ext_gui/layout_inline.cpp +46 -14
- package/runtime/ext_gui/paint.cpp +26 -1
- package/runtime/ext_gui/paint_form.cpp +389 -0
- package/runtime/ext_gui/paint_internal.h +6 -0
- package/runtime/ext_gui/script.cpp +1 -1
- package/runtime/ext_gui/style.cpp +1 -0
- package/runtime/ext_gui/style.h +13 -0
- package/runtime/ext_gui/style_print.cpp +129 -0
- package/runtime/ext_gui/style_text.cpp +79 -0
- package/runtime/ext_gui/style_ua.cpp +42 -0
- package/runtime/ext_gui/warnings.cpp +5 -7
- package/runtime/ext_gui/webgl_texture.cpp +0 -8
- package/runtime/ext_gui/window.cpp +52 -62
- package/runtime/ext_gui/window_diagnostics.cpp +58 -0
- package/runtime/ext_gui/window_emit.cpp +51 -0
- package/runtime/ext_node/crypto/crypto.c +3 -2
- package/runtime/ext_node/crypto/crypto_hash.h +13 -0
- package/runtime/ext_node/crypto/crypto_random.c +339 -0
- package/runtime/ext_node/fs/async_worker.c +1 -1
- package/runtime/ext_node/fs/fs_ops.c +1 -1
- package/runtime/ext_node/fs/parts/platform.inc +67 -0
- package/runtime/ext_node/readline/readline.c +572 -0
- package/runtime/rt.h +42 -0
- package/runtime/rt_internal.h +3 -2
- package/runtime/xt_crypto.c +132 -0
- package/runtime/xt_io/exception.inc +29 -6
- package/runtime/xt_loop.c +36 -1
- package/runtime/xt_promise.c +26 -2
- package/runtime/xt_random.c +143 -0
- package/runtime/xt_regex/matcher.inc +9 -28
- package/runtime/xt_regex/parser.inc +65 -2
- package/runtime/xt_regex/types.inc +11 -1
- package/runtime/xt_regex.h +6 -2
- package/runtime/xt_stdlib/dispatch.inc +2 -0
- package/runtime/xt_stdlib/math.inc +1 -1
- package/runtime/xt_stdlib2/date.inc +206 -6
- package/runtime/xt_stdlib2/json.inc +4 -546
- package/runtime/xt_stdlib2/json_parse.inc +347 -0
- package/runtime/xt_stdlib2/json_stringify.inc +368 -0
- package/runtime/xt_stdlib2/regexp-match.inc +6 -11
- package/runtime/xt_stdlib2.c +0 -4
- package/runtime/xt_typed_array/elements.inc +2 -6
- package/runtime/xt_url.c +0 -6
- package/runtime/xt_url_object.c +1 -1
- package/src/ast/expressions.ts +6 -0
- package/src/checker/globals.ts +2 -0
- package/src/checker/type-infer.ts +1 -1
- package/src/codegen/generator/calls/literals.ts +4 -1
- package/src/codegen/generator/expressions/assignment.ts +3 -1
- package/src/codegen/generator/expressions/operators.ts +2 -6
- package/src/codegen/generator/expressions/primary.ts +58 -6
- package/src/codegen/generator/state.ts +3 -0
- package/src/codegen/generator/tables.ts +3 -0
- package/src/driver/bundler/commonjs.ts +1 -1
- package/src/driver/bundler/symbols.ts +6 -0
- package/src/driver/compiler.ts +1 -1
- package/src/driver/runtime-objects.ts +2 -0
- package/src/driver/version.ts +1 -1
- package/src/extensions/node/crypto/index.ts +12 -1
- package/src/extensions/node/index.ts +2 -0
- package/src/extensions/node/readline/index.ts +31 -0
- package/src/parser/declarations/functions.ts +6 -0
- package/src/parser/literals.ts +1 -1
|
@@ -14,6 +14,12 @@ export function hasModifier(node: Node, kind: ModifierKind): boolean {
|
|
|
14
14
|
|
|
15
15
|
export function declarationName(node: Node): Identifier | undefined {
|
|
16
16
|
switch (node.kind) {
|
|
17
|
+
/* Destructured bindings are declared with their identifier node (see
|
|
18
|
+
* `Binder.declareBinding`), so renaming must accept a bare Identifier too;
|
|
19
|
+
* otherwise the declaration keeps its old name while references are
|
|
20
|
+
* rewritten and the merged program fails to resolve it. */
|
|
21
|
+
case SyntaxKind.Identifier:
|
|
22
|
+
return node as Identifier;
|
|
17
23
|
case SyntaxKind.FunctionDeclaration:
|
|
18
24
|
case SyntaxKind.ClassDeclaration:
|
|
19
25
|
case SyntaxKind.EnumDeclaration:
|
package/src/driver/compiler.ts
CHANGED
|
@@ -354,7 +354,7 @@ export function build(entryPath: string, options: BuildOptions = {}): BuildResul
|
|
|
354
354
|
outputPath,
|
|
355
355
|
linkerFlags: [
|
|
356
356
|
...toolchain.linkerArgs,
|
|
357
|
-
...(process.platform === "win32" ? ["-lws2_32"] : ["-lm", "-pthread"]),
|
|
357
|
+
...(process.platform === "win32" ? ["-lws2_32", "-lbcrypt"] : ["-lm", "-pthread"]),
|
|
358
358
|
...registry.linkerFlags(),
|
|
359
359
|
...linkFeatures.flatMap((feature) => feature.linkerFlags),
|
|
360
360
|
/* A GUI program is a Windows-subsystem executable: no console window is
|
package/src/driver/version.ts
CHANGED
|
@@ -13,11 +13,22 @@ const builtins: Record<string, BuiltinFunction> = {
|
|
|
13
13
|
|
|
14
14
|
const exports: ModuleExports = {
|
|
15
15
|
createHash: { symbol: "xt_crypto_create_hash" },
|
|
16
|
+
randomBytes: { symbol: "xt_crypto_random_bytes" },
|
|
17
|
+
randomUUID: { symbol: "xt_crypto_random_uuid" },
|
|
18
|
+
randomInt: { symbol: "xt_crypto_random_int" },
|
|
19
|
+
randomFillSync: { symbol: "xt_crypto_random_fill_sync" },
|
|
20
|
+
randomFill: { symbol: "xt_crypto_random_fill" },
|
|
21
|
+
pbkdf2Sync: { symbol: "xt_crypto_pbkdf2_sync" },
|
|
22
|
+
pbkdf2: { symbol: "xt_crypto_pbkdf2" },
|
|
23
|
+
webcrypto: { symbol: "xt_crypto_webcrypto", valueSymbol: "xt_crypto_webcrypto" },
|
|
16
24
|
};
|
|
17
25
|
|
|
18
26
|
export const cryptoModule: NodeModule = {
|
|
19
27
|
name: "crypto",
|
|
20
|
-
runtimeSources: () => [
|
|
28
|
+
runtimeSources: () => [
|
|
29
|
+
resolveFrom(import.meta.url, "../../../../runtime/ext_node/crypto/crypto.c"),
|
|
30
|
+
resolveFrom(import.meta.url, "../../../../runtime/ext_node/crypto/crypto_random.c"),
|
|
31
|
+
],
|
|
21
32
|
builtins: () => builtins,
|
|
22
33
|
exports: () => exports,
|
|
23
34
|
};
|
|
@@ -33,6 +33,7 @@ import { utilModule } from "./util/index.js";
|
|
|
33
33
|
import { querystringModule } from "./querystring/index.js";
|
|
34
34
|
import { assertModule } from "./assert/index.js";
|
|
35
35
|
import { testModule } from "./test/index.js";
|
|
36
|
+
import { readlineModule } from "./readline/index.js";
|
|
36
37
|
|
|
37
38
|
/** Every Node module the extension currently provides. */
|
|
38
39
|
const modules: readonly NodeModule[] = [
|
|
@@ -57,6 +58,7 @@ const modules: readonly NodeModule[] = [
|
|
|
57
58
|
querystringModule,
|
|
58
59
|
assertModule,
|
|
59
60
|
testModule,
|
|
61
|
+
readlineModule,
|
|
60
62
|
];
|
|
61
63
|
|
|
62
64
|
export const nodeExtension: Extension = {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node's `readline` module.
|
|
3
|
+
*
|
|
4
|
+
* `createInterface` (and the `Interface` constructor) return a line reader over
|
|
5
|
+
* standard input. The implementation offloads the blocking stdin read to the
|
|
6
|
+
* runtime's async I/O pool, so `question` and `on("line")` do not block timers
|
|
7
|
+
* or the event loop; it lives in
|
|
8
|
+
* `runtime/ext_node/readline/readline.c`. The cursor helpers write the same
|
|
9
|
+
* ANSI sequences Node emits.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { NodeModule } from "../module.js";
|
|
13
|
+
import { resolveFrom } from "../module.js";
|
|
14
|
+
import type { ModuleExports } from "../../registry.js";
|
|
15
|
+
|
|
16
|
+
const exports: ModuleExports = {
|
|
17
|
+
createInterface: { symbol: "xt_readline_create_interface" },
|
|
18
|
+
Interface: { symbol: "xt_readline_interface_ctor", isConstructor: true },
|
|
19
|
+
cursorTo: { symbol: "xt_readline_cursor_to" },
|
|
20
|
+
moveCursor: { symbol: "xt_readline_move_cursor" },
|
|
21
|
+
clearLine: { symbol: "xt_readline_clear_line" },
|
|
22
|
+
clearScreenDown: { symbol: "xt_readline_clear_screen_down" },
|
|
23
|
+
emitKeypressEvents: { symbol: "xt_readline_emit_keypress_events" },
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const readlineModule: NodeModule = {
|
|
27
|
+
name: "readline",
|
|
28
|
+
runtimeSources: () => [resolveFrom(import.meta.url, "../../../../runtime/ext_node/readline/readline.c")],
|
|
29
|
+
builtins: () => ({}),
|
|
30
|
+
exports: () => exports,
|
|
31
|
+
};
|
|
@@ -227,6 +227,12 @@ export const declarationFunctionMethods: DeclarationFunctionMethods = {
|
|
|
227
227
|
name = this.parseBindingName();
|
|
228
228
|
} else {
|
|
229
229
|
name = first;
|
|
230
|
+
/* `{ a }` reads the key `a`; record it in a separate node so a later
|
|
231
|
+
* rename of the binding does not change which property is read. */
|
|
232
|
+
propertyName =
|
|
233
|
+
first.kind === SyntaxKind.Identifier
|
|
234
|
+
? { kind: SyntaxKind.Identifier, text: first.text, escaped: first.escaped, start: first.start, end: first.end }
|
|
235
|
+
: first;
|
|
230
236
|
}
|
|
231
237
|
} else {
|
|
232
238
|
// Array element, or a nested pattern used as an object value.
|
package/src/parser/literals.ts
CHANGED
|
@@ -144,7 +144,7 @@ export const literalMethods: LiteralMethods = {
|
|
|
144
144
|
initializer = this.parseAssignmentExpression();
|
|
145
145
|
end = initializer.end;
|
|
146
146
|
}
|
|
147
|
-
const shorthand: ShorthandPropertyAssignment = { kind: SyntaxKind.ShorthandPropertyAssignment, name, initializer, start, end };
|
|
147
|
+
const shorthand: ShorthandPropertyAssignment = { kind: SyntaxKind.ShorthandPropertyAssignment, name, propertyName: name.text, initializer, start, end };
|
|
148
148
|
properties.push(shorthand);
|
|
149
149
|
} else {
|
|
150
150
|
this.error(DiagnosticCode.UnexpectedToken, "Invalid object literal member");
|