xbintsc 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -7
- package/dist/src/binder/binder.d.ts +35 -1
- package/dist/src/binder/binder.js +138 -0
- package/dist/src/binder/binder.js.map +1 -1
- package/dist/src/codegen/generator/calls.d.ts +4 -0
- package/dist/src/codegen/generator/calls.js +114 -32
- package/dist/src/codegen/generator/calls.js.map +1 -1
- package/dist/src/codegen/generator/context.d.ts +2 -0
- package/dist/src/codegen/generator/context.js +36 -0
- package/dist/src/codegen/generator/context.js.map +1 -1
- package/dist/src/codegen/generator/expressions.d.ts +4 -1
- package/dist/src/codegen/generator/expressions.js +73 -2
- package/dist/src/codegen/generator/expressions.js.map +1 -1
- package/dist/src/codegen/generator/module.d.ts +5 -1
- package/dist/src/codegen/generator/module.js +107 -6
- package/dist/src/codegen/generator/module.js.map +1 -1
- package/dist/src/codegen/generator/state.d.ts +2 -0
- package/dist/src/codegen/generator/state.js +46 -0
- package/dist/src/codegen/generator/state.js.map +1 -1
- package/dist/src/codegen/generator/statements.js +9 -1
- package/dist/src/codegen/generator/statements.js.map +1 -1
- package/dist/src/codegen/generator/tables.d.ts +6 -0
- package/dist/src/codegen/generator/tables.js +40 -0
- package/dist/src/codegen/generator/tables.js.map +1 -1
- package/dist/src/driver/compiler.js +23 -7
- package/dist/src/driver/compiler.js.map +1 -1
- package/dist/src/driver/modules.d.ts +24 -0
- package/dist/src/driver/modules.js +347 -0
- package/dist/src/driver/modules.js.map +1 -0
- package/dist/src/extensions/node/fs/fs-ops.d.ts +6 -0
- package/dist/src/extensions/node/fs/fs-ops.js +18 -0
- package/dist/src/extensions/node/fs/fs-ops.js.map +1 -0
- package/dist/src/extensions/node/fs/index.d.ts +3 -1
- package/dist/src/extensions/node/fs/index.js +11 -3
- package/dist/src/extensions/node/fs/index.js.map +1 -1
- package/dist/src/extensions/node/fs/write-file.d.ts +5 -0
- package/dist/src/extensions/node/fs/write-file.js +8 -0
- package/dist/src/extensions/node/fs/write-file.js.map +1 -0
- package/dist/src/extensions/node/index.d.ts +2 -1
- package/dist/src/extensions/node/index.js +7 -3
- package/dist/src/extensions/node/index.js.map +1 -1
- package/dist/src/extensions/node/os/index.d.ts +9 -0
- package/dist/src/extensions/node/os/index.js +14 -0
- package/dist/src/extensions/node/os/index.js.map +1 -0
- package/dist/src/extensions/node/path/index.d.ts +10 -0
- package/dist/src/extensions/node/path/index.js +15 -0
- package/dist/src/extensions/node/path/index.js.map +1 -0
- package/dist/src/extensions/node/process/index.d.ts +10 -0
- package/dist/src/extensions/node/process/index.js +15 -0
- package/dist/src/extensions/node/process/index.js.map +1 -0
- package/dist/src/parser/expressions.js +3 -0
- package/dist/src/parser/expressions.js.map +1 -1
- package/dist/tests/codegen/llvm.test.js +1 -1
- package/dist/tests/codegen/llvm.test.js.map +1 -1
- package/dist/tests/e2e/compile.test.js +141 -0
- package/dist/tests/e2e/compile.test.js.map +1 -1
- package/dist/tests/extensions/registry.test.js +9 -3
- package/dist/tests/extensions/registry.test.js.map +1 -1
- package/package.json +1 -1
- package/runtime/ext_node/fs/fs_common.h +166 -0
- package/runtime/ext_node/fs/fs_ops.c +342 -0
- package/runtime/ext_node/fs/read_file.c +12 -6
- package/runtime/ext_node/fs/write_file.c +47 -0
- package/runtime/ext_node/os/os.c +165 -0
- package/runtime/ext_node/path/path.c +324 -0
- package/runtime/ext_node/process/process.c +137 -0
- package/runtime/rt.h +61 -4
- package/runtime/rt_internal.h +63 -0
- package/runtime/xt_builtins.c +47 -1
- package/runtime/xt_containers.c +95 -8
- package/runtime/xt_io.c +122 -0
- package/runtime/xt_promise.c +292 -0
- package/runtime/xt_stdlib.c +59 -5
- package/runtime/xt_stdlib2.c +1043 -0
- package/scripts/build-runtime.mjs +5 -0
- package/src/binder/binder.ts +196 -0
- package/src/codegen/generator/calls.ts +124 -33
- package/src/codegen/generator/context.ts +35 -1
- package/src/codegen/generator/expressions.ts +79 -2
- package/src/codegen/generator/module.ts +112 -6
- package/src/codegen/generator/state.ts +48 -0
- package/src/codegen/generator/statements.ts +7 -1
- package/src/codegen/generator/tables.ts +43 -0
- package/src/driver/compiler.ts +28 -7
- package/src/driver/modules.ts +377 -0
- package/src/extensions/node/fs/fs-ops.ts +20 -0
- package/src/extensions/node/fs/index.ts +11 -3
- package/src/extensions/node/fs/write-file.ts +10 -0
- package/src/extensions/node/index.ts +7 -3
- package/src/extensions/node/os/index.ts +16 -0
- package/src/extensions/node/path/index.ts +17 -0
- package/src/extensions/node/process/index.ts +17 -0
- package/src/parser/expressions.ts +3 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source-level module bundler.
|
|
3
|
+
*
|
|
4
|
+
* xbintsc does not run a linker for modules, so `import`/`export` are lowered
|
|
5
|
+
* at the driver by merging every reachable module into a single source file.
|
|
6
|
+
* Each module's top-level bindings are renamed to a globally unique name and
|
|
7
|
+
* imported names are rewritten to the (renamed) exported binding.
|
|
8
|
+
*
|
|
9
|
+
* This is intentionally simple: it supports named imports/exports, `export
|
|
10
|
+
* default` for declarations, and `export ... from`. Namespace imports and
|
|
11
|
+
* `export *` are approximated, and circular graphs are reported as an error.
|
|
12
|
+
*/
|
|
13
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
14
|
+
import { dirname, resolve } from "node:path";
|
|
15
|
+
import { ModifierKind, SyntaxKind, } from "../ast/nodes.js";
|
|
16
|
+
import { bind, SymbolKind } from "../binder/binder.js";
|
|
17
|
+
import { DiagnosticCode } from "../diagnostics/diagnostic.js";
|
|
18
|
+
import { SourceFile } from "../diagnostics/source.js";
|
|
19
|
+
import { Parser } from "../parser/parser.js";
|
|
20
|
+
const RESOLVE_SUFFIXES = ["", ".ts", ".tsx", ".mts", ".cts", "/index.ts", "/index.tsx"];
|
|
21
|
+
function resolveModule(fromDir, specifier) {
|
|
22
|
+
const base = resolve(fromDir, specifier);
|
|
23
|
+
for (const suffix of RESOLVE_SUFFIXES) {
|
|
24
|
+
const candidate = base + suffix;
|
|
25
|
+
if (existsSync(candidate) && statSync(candidate).isFile())
|
|
26
|
+
return candidate;
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
function hasModifier(node, kind) {
|
|
31
|
+
const modifiers = node.modifiers;
|
|
32
|
+
return !!modifiers && modifiers.some((modifier) => modifier.modifierKind === kind);
|
|
33
|
+
}
|
|
34
|
+
function declarationName(node) {
|
|
35
|
+
switch (node.kind) {
|
|
36
|
+
case SyntaxKind.FunctionDeclaration:
|
|
37
|
+
case SyntaxKind.ClassDeclaration:
|
|
38
|
+
case SyntaxKind.EnumDeclaration:
|
|
39
|
+
case SyntaxKind.InterfaceDeclaration:
|
|
40
|
+
case SyntaxKind.TypeAliasDeclaration:
|
|
41
|
+
case SyntaxKind.ModuleDeclaration:
|
|
42
|
+
return node.name;
|
|
43
|
+
case SyntaxKind.VariableDeclaration:
|
|
44
|
+
return node.name;
|
|
45
|
+
default:
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** Load, parse and bind the entry module and every module it imports. */
|
|
50
|
+
function loadGraph(entryPath, diagnostics) {
|
|
51
|
+
const records = new Map();
|
|
52
|
+
const order = [];
|
|
53
|
+
const visiting = new Set();
|
|
54
|
+
let counter = 0;
|
|
55
|
+
let failed = false;
|
|
56
|
+
const load = (path) => {
|
|
57
|
+
const existing = records.get(path);
|
|
58
|
+
if (existing)
|
|
59
|
+
return existing;
|
|
60
|
+
if (visiting.has(path)) {
|
|
61
|
+
diagnostics.error(DiagnosticCode.CodegenError, `Circular import detected involving '${path}'`);
|
|
62
|
+
failed = true;
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
if (!existsSync(path)) {
|
|
66
|
+
diagnostics.error(DiagnosticCode.CodegenError, `Cannot find module '${path}'`);
|
|
67
|
+
failed = true;
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
visiting.add(path);
|
|
71
|
+
const text = readFileSync(path, "utf8");
|
|
72
|
+
const file = new SourceFile(path, text);
|
|
73
|
+
const parser = new Parser(file, diagnostics);
|
|
74
|
+
const sourceFile = parser.parseSourceFile();
|
|
75
|
+
const bindResult = bind(sourceFile);
|
|
76
|
+
const record = {
|
|
77
|
+
path,
|
|
78
|
+
text,
|
|
79
|
+
sourceFile,
|
|
80
|
+
bind: bindResult,
|
|
81
|
+
prefix: `m${counter++}_`,
|
|
82
|
+
exports: new Map(),
|
|
83
|
+
originalNames: new Map(),
|
|
84
|
+
finalNames: new Map(),
|
|
85
|
+
};
|
|
86
|
+
records.set(path, record);
|
|
87
|
+
for (const statement of sourceFile.statements) {
|
|
88
|
+
const specifier = moduleSpecifierOf(statement);
|
|
89
|
+
if (!specifier)
|
|
90
|
+
continue;
|
|
91
|
+
const dependency = resolveModule(dirname(path), specifier);
|
|
92
|
+
if (!dependency) {
|
|
93
|
+
diagnostics.error(DiagnosticCode.CodegenError, `Cannot resolve module '${specifier}' from '${path}'`, statement, path);
|
|
94
|
+
failed = true;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
load(dependency);
|
|
98
|
+
}
|
|
99
|
+
visiting.delete(path);
|
|
100
|
+
order.push(record);
|
|
101
|
+
return record;
|
|
102
|
+
};
|
|
103
|
+
load(entryPath);
|
|
104
|
+
if (failed)
|
|
105
|
+
return undefined;
|
|
106
|
+
return order;
|
|
107
|
+
}
|
|
108
|
+
function moduleSpecifierOf(statement) {
|
|
109
|
+
if (statement.kind === SyntaxKind.ImportDeclaration) {
|
|
110
|
+
return statement.moduleSpecifier.value;
|
|
111
|
+
}
|
|
112
|
+
if (statement.kind === SyntaxKind.ExportDeclaration) {
|
|
113
|
+
const specifier = statement.moduleSpecifier;
|
|
114
|
+
if (specifier)
|
|
115
|
+
return specifier.value;
|
|
116
|
+
}
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
/** Rewrite a symbol's declaration and every reference to `finalName`. */
|
|
120
|
+
function renameSymbol(symbol, finalName) {
|
|
121
|
+
for (const declaration of symbol.declarations) {
|
|
122
|
+
const name = declarationName(declaration);
|
|
123
|
+
if (name)
|
|
124
|
+
name.text = finalName;
|
|
125
|
+
}
|
|
126
|
+
for (const reference of symbol.references)
|
|
127
|
+
reference.text = finalName;
|
|
128
|
+
}
|
|
129
|
+
/** Rewrite just the references of a symbol (used for imported names). */
|
|
130
|
+
function renameReferences(symbol, finalName) {
|
|
131
|
+
for (const reference of symbol.references)
|
|
132
|
+
reference.text = finalName;
|
|
133
|
+
}
|
|
134
|
+
function moduleScope(record) {
|
|
135
|
+
return record.bind.scopes.get(record.sourceFile);
|
|
136
|
+
}
|
|
137
|
+
function topLevelSymbols(record) {
|
|
138
|
+
const scope = moduleScope(record);
|
|
139
|
+
if (!scope)
|
|
140
|
+
return [];
|
|
141
|
+
return [...scope.symbols.values()];
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Merge every module's statements into a single file. Dependencies come first
|
|
145
|
+
* (post-order over the import graph), the entry module last.
|
|
146
|
+
*/
|
|
147
|
+
export function bundleModules(entryPath, diagnostics) {
|
|
148
|
+
const records = loadGraph(entryPath, diagnostics);
|
|
149
|
+
if (!records)
|
|
150
|
+
return undefined;
|
|
151
|
+
const byPath = new Map(records.map((record) => [record.path, record]));
|
|
152
|
+
const dependencyOf = (record, specifier) => {
|
|
153
|
+
const resolved = resolveModule(dirname(record.path), specifier);
|
|
154
|
+
return resolved ? byPath.get(resolved) : undefined;
|
|
155
|
+
};
|
|
156
|
+
// Phase 1: record every top-level binding and pick a unique final name.
|
|
157
|
+
for (const record of records) {
|
|
158
|
+
for (const symbol of topLevelSymbols(record)) {
|
|
159
|
+
record.originalNames.set(symbol.id, symbol.name);
|
|
160
|
+
if (symbol.kind === SymbolKind.Import)
|
|
161
|
+
continue;
|
|
162
|
+
record.finalNames.set(symbol.id, record.prefix + symbol.name);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Phase 2: collect each module's exported names.
|
|
166
|
+
for (const record of records) {
|
|
167
|
+
const scope = moduleScope(record);
|
|
168
|
+
if (!scope)
|
|
169
|
+
continue;
|
|
170
|
+
const symbolByName = scope.symbols;
|
|
171
|
+
for (const statement of record.sourceFile.statements) {
|
|
172
|
+
if (statement.kind === SyntaxKind.ExportDeclaration) {
|
|
173
|
+
const declaration = statement;
|
|
174
|
+
if (declaration.exportClause && declaration.exportClause.kind === SyntaxKind.NamedExports) {
|
|
175
|
+
for (const specifier of declaration.exportClause.elements) {
|
|
176
|
+
const localName = specifier.propertyName?.text ?? specifier.name.text;
|
|
177
|
+
const exportedName = specifier.name.text;
|
|
178
|
+
if (declaration.moduleSpecifier) {
|
|
179
|
+
const dependency = dependencyOf(record, declaration.moduleSpecifier.value);
|
|
180
|
+
const target = dependency?.exports.get(localName);
|
|
181
|
+
if (target)
|
|
182
|
+
record.exports.set(exportedName, target);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
const symbol = symbolByName.get(localName);
|
|
186
|
+
if (symbol) {
|
|
187
|
+
const finalName = record.finalNames.get(symbol.id) ?? symbol.name;
|
|
188
|
+
record.exports.set(exportedName, finalName);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else if (!declaration.exportClause && declaration.moduleSpecifier) {
|
|
194
|
+
// `export * from "..."`: copy every re-exported name.
|
|
195
|
+
const dependency = dependencyOf(record, declaration.moduleSpecifier.value);
|
|
196
|
+
if (dependency)
|
|
197
|
+
for (const [name, value] of dependency.exports)
|
|
198
|
+
record.exports.set(name, value);
|
|
199
|
+
}
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
if (statement.kind === SyntaxKind.ExportAssignment) {
|
|
203
|
+
record.exports.set("default", `${record.prefix}default`);
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (hasModifier(statement, ModifierKind.Default)) {
|
|
207
|
+
const name = declarationName(statement) ?? declarationName(statement.declaration ?? statement);
|
|
208
|
+
if (name) {
|
|
209
|
+
const symbol = symbolByName.get(name.text);
|
|
210
|
+
if (symbol)
|
|
211
|
+
record.exports.set("default", record.finalNames.get(symbol.id) ?? symbol.name);
|
|
212
|
+
}
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (hasModifier(statement, ModifierKind.Export)) {
|
|
216
|
+
const names = exportedNames(statement);
|
|
217
|
+
for (const name of names) {
|
|
218
|
+
const symbol = symbolByName.get(name);
|
|
219
|
+
if (symbol)
|
|
220
|
+
record.exports.set(name, record.finalNames.get(symbol.id) ?? symbol.name);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// Phase 3: rewrite imported names and record re-exports.
|
|
226
|
+
for (const record of records) {
|
|
227
|
+
const scope = moduleScope(record);
|
|
228
|
+
if (!scope)
|
|
229
|
+
continue;
|
|
230
|
+
for (const statement of record.sourceFile.statements) {
|
|
231
|
+
if (statement.kind !== SyntaxKind.ImportDeclaration)
|
|
232
|
+
continue;
|
|
233
|
+
const declaration = statement;
|
|
234
|
+
const dependency = dependencyOf(record, declaration.moduleSpecifier.value);
|
|
235
|
+
const clause = declaration.importClause;
|
|
236
|
+
if (!clause || !dependency)
|
|
237
|
+
continue;
|
|
238
|
+
if (clause.name) {
|
|
239
|
+
const target = dependency.exports.get("default") ?? dependency.exports.get("default");
|
|
240
|
+
const local = scope.symbols.get(clause.name.text);
|
|
241
|
+
if (target && local)
|
|
242
|
+
renameReferences(local, target);
|
|
243
|
+
}
|
|
244
|
+
const bindings = clause.namedBindings;
|
|
245
|
+
if (bindings && bindings.kind === SyntaxKind.NamedImports) {
|
|
246
|
+
for (const specifier of bindings.elements) {
|
|
247
|
+
const importedName = specifier.propertyName?.text ?? specifier.name.text;
|
|
248
|
+
const target = dependency.exports.get(importedName);
|
|
249
|
+
const local = scope.symbols.get(specifier.name.text);
|
|
250
|
+
if (target && local)
|
|
251
|
+
renameReferences(local, target);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// Phase 4: concatenate statements, dropping imports and pure export wrappers.
|
|
257
|
+
const merged = [];
|
|
258
|
+
const first = records[records.length - 1];
|
|
259
|
+
for (const record of records) {
|
|
260
|
+
for (const statement of record.sourceFile.statements) {
|
|
261
|
+
if (statement.kind === SyntaxKind.ImportDeclaration)
|
|
262
|
+
continue;
|
|
263
|
+
if (statement.kind === SyntaxKind.ExportDeclaration) {
|
|
264
|
+
const declaration = statement;
|
|
265
|
+
const inner = declaration.declaration;
|
|
266
|
+
if (inner)
|
|
267
|
+
merged.push(inner);
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
if (statement.kind === SyntaxKind.ExportAssignment) {
|
|
271
|
+
const assignment = statement;
|
|
272
|
+
merged.push(exportAssignmentToStatement(record, assignment));
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
merged.push(statement);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
// Phase 5: rename every top-level binding (declaration + references) to its
|
|
279
|
+
// unique final name, now that import references have been rewritten.
|
|
280
|
+
for (const record of records) {
|
|
281
|
+
for (const symbol of topLevelSymbols(record)) {
|
|
282
|
+
if (symbol.kind === SymbolKind.Import)
|
|
283
|
+
continue;
|
|
284
|
+
const finalName = record.finalNames.get(symbol.id);
|
|
285
|
+
if (finalName)
|
|
286
|
+
renameSymbol(symbol, finalName);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
const sourceFile = {
|
|
290
|
+
kind: SyntaxKind.SourceFile,
|
|
291
|
+
statements: merged,
|
|
292
|
+
fileName: first.path,
|
|
293
|
+
text: records.map((record) => record.text).join("\n"),
|
|
294
|
+
start: 0,
|
|
295
|
+
end: 0,
|
|
296
|
+
};
|
|
297
|
+
return { sourceFile, text: sourceFile.text, moduleCount: records.length };
|
|
298
|
+
}
|
|
299
|
+
function exportedNames(statement) {
|
|
300
|
+
const names = [];
|
|
301
|
+
if (statement.kind === SyntaxKind.VariableStatement) {
|
|
302
|
+
for (const declaration of statement.declarationList.declarations) {
|
|
303
|
+
if (declaration.name)
|
|
304
|
+
names.push(declaration.name.text);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
const name = declarationName(statement);
|
|
309
|
+
if (name)
|
|
310
|
+
names.push(name.text);
|
|
311
|
+
}
|
|
312
|
+
return names;
|
|
313
|
+
}
|
|
314
|
+
/** Turn `export default expr` into a synthetic `const` declaration. */
|
|
315
|
+
function exportAssignmentToStatement(record, assignment) {
|
|
316
|
+
const name = {
|
|
317
|
+
kind: SyntaxKind.Identifier,
|
|
318
|
+
text: `${record.prefix}default`,
|
|
319
|
+
start: assignment.start,
|
|
320
|
+
end: assignment.start,
|
|
321
|
+
};
|
|
322
|
+
record.exports.set("default", name.text);
|
|
323
|
+
const declaration = {
|
|
324
|
+
kind: SyntaxKind.VariableDeclaration,
|
|
325
|
+
name,
|
|
326
|
+
exclamation: false,
|
|
327
|
+
initializer: assignment.expression,
|
|
328
|
+
start: assignment.start,
|
|
329
|
+
end: assignment.end,
|
|
330
|
+
};
|
|
331
|
+
const list = {
|
|
332
|
+
kind: SyntaxKind.VariableDeclarationList,
|
|
333
|
+
declarationKind: "const",
|
|
334
|
+
declarations: [declaration],
|
|
335
|
+
start: assignment.start,
|
|
336
|
+
end: assignment.end,
|
|
337
|
+
};
|
|
338
|
+
const statement = {
|
|
339
|
+
kind: SyntaxKind.VariableStatement,
|
|
340
|
+
declarationList: list,
|
|
341
|
+
modifiers: [],
|
|
342
|
+
start: assignment.start,
|
|
343
|
+
end: assignment.end,
|
|
344
|
+
};
|
|
345
|
+
return statement;
|
|
346
|
+
}
|
|
347
|
+
//# sourceMappingURL=modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../../src/driver/modules.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C3B,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,GAAG,EAAE,UAAU,CAAC,GAAG;KACpB,CAAC;IACF,MAAM,SAAS,GAAsB;QACnC,IAAI,EAAE,UAAU,CAAC,iBAAiB;QAClC,eAAe,EAAE,IAAI;QACrB,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,GAAG,EAAE,UAAU,CAAC,GAAG;KACpB,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builtins for the filesystem operations in Node's `fs` module
|
|
3
|
+
* (`existsSync`, directory handling, rename/copy, `statSync`, ...).
|
|
4
|
+
*/
|
|
5
|
+
import type { BuiltinFunction } from "../../registry.js";
|
|
6
|
+
export declare const fsOpsBuiltins: Readonly<Record<string, BuiltinFunction>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builtins for the filesystem operations in Node's `fs` module
|
|
3
|
+
* (`existsSync`, directory handling, rename/copy, `statSync`, ...).
|
|
4
|
+
*/
|
|
5
|
+
export const fsOpsBuiltins = {
|
|
6
|
+
existsSync: { symbol: "xt_node_exists" },
|
|
7
|
+
readdirSync: { symbol: "xt_node_read_dir" },
|
|
8
|
+
mkdirSync: { symbol: "xt_node_mkdir" },
|
|
9
|
+
rmSync: { symbol: "xt_node_rm" },
|
|
10
|
+
unlinkSync: { symbol: "xt_node_unlink" },
|
|
11
|
+
rmdirSync: { symbol: "xt_node_rmdir" },
|
|
12
|
+
renameSync: { symbol: "xt_node_rename" },
|
|
13
|
+
copyFileSync: { symbol: "xt_node_copy_file" },
|
|
14
|
+
realpathSync: { symbol: "xt_node_realpath" },
|
|
15
|
+
statSync: { symbol: "xt_node_stat" },
|
|
16
|
+
lstatSync: { symbol: "xt_node_lstat" },
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=fs-ops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-ops.js","sourceRoot":"","sources":["../../../../../src/extensions/node/fs/fs-ops.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,CAAC,MAAM,aAAa,GAA8C;IACtE,UAAU,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE;IACxC,WAAW,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;IAC3C,SAAS,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE;IACtC,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;IAChC,UAAU,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE;IACxC,SAAS,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE;IACtC,UAAU,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE;IACxC,YAAY,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE;IAC7C,YAAY,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;IAC5C,QAAQ,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;IACpC,SAAS,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE;CACvC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Node's `fs` module:
|
|
2
|
+
* Node's `fs` module: synchronous file and directory operations backed by
|
|
3
|
+
* `runtime/ext_node/fs`. Asynchronous callbacks are not supported (xbintsc has
|
|
4
|
+
* no event loop), so only the `*Sync` API is exposed.
|
|
3
5
|
*/
|
|
4
6
|
import type { NodeModule } from "../module.js";
|
|
5
7
|
export declare const fsModule: NodeModule;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Node's `fs` module:
|
|
2
|
+
* Node's `fs` module: synchronous file and directory operations backed by
|
|
3
|
+
* `runtime/ext_node/fs`. Asynchronous callbacks are not supported (xbintsc has
|
|
4
|
+
* no event loop), so only the `*Sync` API is exposed.
|
|
3
5
|
*/
|
|
4
6
|
import { resolveFrom } from "../module.js";
|
|
5
7
|
import { readFileBuiltins } from "./read-file.js";
|
|
8
|
+
import { writeFileBuiltins } from "./write-file.js";
|
|
9
|
+
import { fsOpsBuiltins } from "./fs-ops.js";
|
|
6
10
|
export const fsModule = {
|
|
7
11
|
name: "fs",
|
|
8
|
-
runtimeSources: () => [
|
|
9
|
-
|
|
12
|
+
runtimeSources: () => [
|
|
13
|
+
resolveFrom(import.meta.url, "../../../../runtime/ext_node/fs/read_file.c"),
|
|
14
|
+
resolveFrom(import.meta.url, "../../../../runtime/ext_node/fs/write_file.c"),
|
|
15
|
+
resolveFrom(import.meta.url, "../../../../runtime/ext_node/fs/fs_ops.c"),
|
|
16
|
+
],
|
|
17
|
+
builtins: () => ({ ...readFileBuiltins, ...writeFileBuiltins, ...fsOpsBuiltins }),
|
|
10
18
|
};
|
|
11
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/extensions/node/fs/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/extensions/node/fs/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,QAAQ,GAAe;IAClC,IAAI,EAAE,IAAI;IACV,cAAc,EAAE,GAAG,EAAE,CAAC;QACpB,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,6CAA6C,CAAC;QAC3E,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,8CAA8C,CAAC;QAC5E,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,0CAA0C,CAAC;KACzE;IACD,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,gBAAgB,EAAE,GAAG,iBAAiB,EAAE,GAAG,aAAa,EAAE,CAAC;CAClF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-file.js","sourceRoot":"","sources":["../../../../../src/extensions/node/fs/write-file.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,CAAC,MAAM,iBAAiB,GAA8C;IAC1E,aAAa,EAAE,EAAE,MAAM,EAAE,oBAAoB,EAAE;IAC/C,cAAc,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE;CAClD,CAAC"}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* builtins each module implements, so `readFileSync("...")` in TypeScript
|
|
6
6
|
* resolves to the C implementation without the core compiler knowing anything
|
|
7
7
|
* about Node. Every Node module lives in its own subfolder next to this file
|
|
8
|
-
* (
|
|
8
|
+
* (`fs/`, `path/`, `os/`, `process/`), with the runtime counterpart under
|
|
9
|
+
* `runtime/ext_node/`.
|
|
9
10
|
*/
|
|
10
11
|
import type { Extension } from "../registry.js";
|
|
11
12
|
export declare const nodeExtension: Extension;
|
|
@@ -5,14 +5,18 @@
|
|
|
5
5
|
* builtins each module implements, so `readFileSync("...")` in TypeScript
|
|
6
6
|
* resolves to the C implementation without the core compiler knowing anything
|
|
7
7
|
* about Node. Every Node module lives in its own subfolder next to this file
|
|
8
|
-
* (
|
|
8
|
+
* (`fs/`, `path/`, `os/`, `process/`), with the runtime counterpart under
|
|
9
|
+
* `runtime/ext_node/`.
|
|
9
10
|
*/
|
|
10
11
|
import { fsModule } from "./fs/index.js";
|
|
12
|
+
import { pathModule } from "./path/index.js";
|
|
13
|
+
import { osModule } from "./os/index.js";
|
|
14
|
+
import { processModule } from "./process/index.js";
|
|
11
15
|
/** Every Node module the extension currently provides. */
|
|
12
|
-
const modules = [fsModule];
|
|
16
|
+
const modules = [fsModule, pathModule, osModule, processModule];
|
|
13
17
|
export const nodeExtension = {
|
|
14
18
|
name: "node",
|
|
15
|
-
description: "Node.js host APIs (fs,
|
|
19
|
+
description: "Node.js host APIs (fs, path, os, process)",
|
|
16
20
|
runtimeSources: () => modules.flatMap((module) => module.runtimeSources()),
|
|
17
21
|
builtins: () => {
|
|
18
22
|
const merged = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/extensions/node/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/extensions/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,0DAA0D;AAC1D,MAAM,OAAO,GAA0B,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;AAEvF,MAAM,CAAC,MAAM,aAAa,GAAc;IACtC,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,2CAA2C;IACxD,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;IAC1E,QAAQ,EAAE,GAAG,EAAE;QACb,MAAM,MAAM,GAAoC,EAAE,CAAC;QACnD,KAAK,MAAM,MAAM,IAAI,OAAO;YAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QACvE,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node's `os` module: host information backed by `runtime/ext_node/os`.
|
|
3
|
+
*
|
|
4
|
+
* `os` contributes no global builtins; the compiler lowers `os.<name>(...)` to
|
|
5
|
+
* `xt_os_static(<name>, argc, argv)` (see `NAMESPACE_STATICS` in
|
|
6
|
+
* `src/codegen/generator/tables.ts`). This module only links the C source.
|
|
7
|
+
*/
|
|
8
|
+
import type { NodeModule } from "../module.js";
|
|
9
|
+
export declare const osModule: NodeModule;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node's `os` module: host information backed by `runtime/ext_node/os`.
|
|
3
|
+
*
|
|
4
|
+
* `os` contributes no global builtins; the compiler lowers `os.<name>(...)` to
|
|
5
|
+
* `xt_os_static(<name>, argc, argv)` (see `NAMESPACE_STATICS` in
|
|
6
|
+
* `src/codegen/generator/tables.ts`). This module only links the C source.
|
|
7
|
+
*/
|
|
8
|
+
import { resolveFrom } from "../module.js";
|
|
9
|
+
export const osModule = {
|
|
10
|
+
name: "os",
|
|
11
|
+
runtimeSources: () => [resolveFrom(import.meta.url, "../../../../runtime/ext_node/os/os.c")],
|
|
12
|
+
builtins: () => ({}),
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/extensions/node/os/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,QAAQ,GAAe;IAClC,IAAI,EAAE,IAAI;IACV,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,sCAAsC,CAAC,CAAC;IAC5F,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node's `path` module: POSIX-style path helpers backed by
|
|
3
|
+
* `runtime/ext_node/path`.
|
|
4
|
+
*
|
|
5
|
+
* `path` contributes no global builtins; the compiler lowers `path.<name>(...)`
|
|
6
|
+
* to `xt_path_static(<name>, argc, argv)` (see `NAMESPACE_STATICS` in
|
|
7
|
+
* `src/codegen/generator/tables.ts`). This module only links the C source.
|
|
8
|
+
*/
|
|
9
|
+
import type { NodeModule } from "../module.js";
|
|
10
|
+
export declare const pathModule: NodeModule;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node's `path` module: POSIX-style path helpers backed by
|
|
3
|
+
* `runtime/ext_node/path`.
|
|
4
|
+
*
|
|
5
|
+
* `path` contributes no global builtins; the compiler lowers `path.<name>(...)`
|
|
6
|
+
* to `xt_path_static(<name>, argc, argv)` (see `NAMESPACE_STATICS` in
|
|
7
|
+
* `src/codegen/generator/tables.ts`). This module only links the C source.
|
|
8
|
+
*/
|
|
9
|
+
import { resolveFrom } from "../module.js";
|
|
10
|
+
export const pathModule = {
|
|
11
|
+
name: "path",
|
|
12
|
+
runtimeSources: () => [resolveFrom(import.meta.url, "../../../../runtime/ext_node/path/path.c")],
|
|
13
|
+
builtins: () => ({}),
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/extensions/node/path/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,UAAU,GAAe;IACpC,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,0CAA0C,CAAC,CAAC;IAChG,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node's `process` object backed by `runtime/ext_node/process`.
|
|
3
|
+
*
|
|
4
|
+
* The compiler lowers `process.<method>(...)` to
|
|
5
|
+
* `xt_process_call(<method>, argc, argv)` and `process.<property>` to
|
|
6
|
+
* `xt_process_get(<property>)` (see `NAMESPACE_STATICS` / `NAMESPACE_PROPERTIES`
|
|
7
|
+
* in `src/codegen/generator/tables.ts`). This module only links the C source.
|
|
8
|
+
*/
|
|
9
|
+
import type { NodeModule } from "../module.js";
|
|
10
|
+
export declare const processModule: NodeModule;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node's `process` object backed by `runtime/ext_node/process`.
|
|
3
|
+
*
|
|
4
|
+
* The compiler lowers `process.<method>(...)` to
|
|
5
|
+
* `xt_process_call(<method>, argc, argv)` and `process.<property>` to
|
|
6
|
+
* `xt_process_get(<property>)` (see `NAMESPACE_STATICS` / `NAMESPACE_PROPERTIES`
|
|
7
|
+
* in `src/codegen/generator/tables.ts`). This module only links the C source.
|
|
8
|
+
*/
|
|
9
|
+
import { resolveFrom } from "../module.js";
|
|
10
|
+
export const processModule = {
|
|
11
|
+
name: "process",
|
|
12
|
+
runtimeSources: () => [resolveFrom(import.meta.url, "../../../../runtime/ext_node/process/process.c")],
|
|
13
|
+
builtins: () => ({}),
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/extensions/node/process/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,aAAa,GAAe;IACvC,IAAI,EAAE,SAAS;IACf,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,gDAAgD,CAAC,CAAC;IACtG,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;CACrB,CAAC"}
|
|
@@ -317,6 +317,9 @@ export const expressionMethods = {
|
|
|
317
317
|
case TokenKind.ThisKeyword:
|
|
318
318
|
this.nextToken();
|
|
319
319
|
return { kind: SyntaxKind.ThisKeyword, start: token.start, end: token.end };
|
|
320
|
+
case TokenKind.SuperKeyword:
|
|
321
|
+
this.nextToken();
|
|
322
|
+
return { kind: SyntaxKind.Identifier, text: "super", start: token.start, end: token.end };
|
|
320
323
|
case TokenKind.OpenParen: {
|
|
321
324
|
this.nextToken();
|
|
322
325
|
const expression = this.parseExpression();
|