@mirascript/mirascript 0.1.14 → 0.1.16
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/{chunk-Q74RKZ7O.js → chunk-LU4ZKFF6.js} +1420 -607
- package/dist/chunk-LU4ZKFF6.js.map +6 -0
- package/dist/chunk-RIT53WVY.js +1 -0
- package/dist/chunk-RLWIIOH5.js +12 -0
- package/dist/chunk-RLWIIOH5.js.map +6 -0
- package/dist/{chunk-55FKP56O.js → chunk-YZGL3D7L.js} +741 -1361
- package/dist/chunk-YZGL3D7L.js.map +6 -0
- package/dist/cli/index.js +11 -67
- package/dist/cli/index.js.map +2 -2
- package/dist/compiler/compile-fast.d.ts +1 -1
- package/dist/compiler/compile-fast.d.ts.map +1 -1
- package/dist/compiler/create-script.d.ts +10 -1
- package/dist/compiler/create-script.d.ts.map +1 -1
- package/dist/compiler/diagnostic.d.ts +1 -1
- package/dist/compiler/diagnostic.d.ts.map +1 -1
- package/dist/compiler/emit/constants.d.ts +3 -0
- package/dist/compiler/emit/constants.d.ts.map +1 -0
- package/dist/compiler/emit/consts.d.ts +6 -0
- package/dist/compiler/emit/consts.d.ts.map +1 -0
- package/dist/compiler/emit/globals.d.ts +17 -0
- package/dist/compiler/emit/globals.d.ts.map +1 -0
- package/dist/compiler/emit/index.d.ts +58 -0
- package/dist/compiler/emit/index.d.ts.map +1 -0
- package/dist/compiler/emit/sourcemap.d.ts +6 -0
- package/dist/compiler/emit/sourcemap.d.ts.map +1 -0
- package/dist/compiler/index.d.ts +3 -2
- package/dist/compiler/index.d.ts.map +1 -1
- package/dist/compiler/worker.js +1 -1
- package/dist/helpers/constants.d.ts +15 -0
- package/dist/helpers/constants.d.ts.map +1 -1
- package/dist/helpers/convert.d.ts +12 -0
- package/dist/helpers/convert.d.ts.map +1 -0
- package/dist/{vm → helpers}/error.d.ts +1 -1
- package/dist/helpers/error.d.ts.map +1 -0
- package/dist/helpers/serialize.d.ts +14 -5
- package/dist/helpers/serialize.d.ts.map +1 -1
- package/dist/helpers/types.d.ts +54 -0
- package/dist/helpers/types.d.ts.map +1 -0
- package/dist/index.js +11 -17
- package/dist/subtle.d.ts +3 -2
- package/dist/subtle.d.ts.map +1 -1
- package/dist/subtle.js +21 -15
- package/dist/vm/checkpoint.d.ts +9 -0
- package/dist/vm/checkpoint.d.ts.map +1 -0
- package/dist/vm/helpers.d.ts +4 -10
- package/dist/vm/helpers.d.ts.map +1 -1
- package/dist/vm/index.d.ts +3 -3
- package/dist/vm/index.d.ts.map +1 -1
- package/dist/vm/lib/global/bit.d.ts +7 -7
- package/dist/vm/lib/global/bit.d.ts.map +1 -1
- package/dist/vm/lib/global/debug.d.ts +2 -2
- package/dist/vm/lib/global/debug.d.ts.map +1 -1
- package/dist/vm/lib/global/index.d.ts +0 -1
- package/dist/vm/lib/global/index.d.ts.map +1 -1
- package/dist/vm/lib/global/json.d.ts +2 -2
- package/dist/vm/lib/global/json.d.ts.map +1 -1
- package/dist/vm/lib/global/math-additional.d.ts +1 -1
- package/dist/vm/lib/global/math-additional.d.ts.map +1 -1
- package/dist/vm/lib/global/math-arr.d.ts +5 -5
- package/dist/vm/lib/global/math-arr.d.ts.map +1 -1
- package/dist/vm/lib/global/math-unary.d.ts +26 -26
- package/dist/vm/lib/global/math-unary.d.ts.map +1 -1
- package/dist/vm/lib/global/math.d.ts +3 -3
- package/dist/vm/lib/global/math.d.ts.map +1 -1
- package/dist/vm/lib/global/sequence/all-any.d.ts +2 -2
- package/dist/vm/lib/global/sequence/all-any.d.ts.map +1 -1
- package/dist/vm/lib/global/sequence/entries.d.ts +5 -5
- package/dist/vm/lib/global/sequence/entries.d.ts.map +1 -1
- package/dist/vm/lib/global/sequence/find.d.ts +3 -3
- package/dist/vm/lib/global/sequence/find.d.ts.map +1 -1
- package/dist/vm/lib/global/sequence/flatten.d.ts +1 -1
- package/dist/vm/lib/global/sequence/flatten.d.ts.map +1 -1
- package/dist/vm/lib/global/sequence/len.d.ts +1 -1
- package/dist/vm/lib/global/sequence/len.d.ts.map +1 -1
- package/dist/vm/lib/global/sequence/map-filter.d.ts +3 -3
- package/dist/vm/lib/global/sequence/map-filter.d.ts.map +1 -1
- package/dist/vm/lib/global/sequence/repeat.d.ts +1 -1
- package/dist/vm/lib/global/sequence/repeat.d.ts.map +1 -1
- package/dist/vm/lib/global/sequence/reverse.d.ts +1 -1
- package/dist/vm/lib/global/sequence/reverse.d.ts.map +1 -1
- package/dist/vm/lib/global/sequence/sort.d.ts +2 -2
- package/dist/vm/lib/global/sequence/sort.d.ts.map +1 -1
- package/dist/vm/lib/global/sequence/with.d.ts +2 -2
- package/dist/vm/lib/global/sequence/with.d.ts.map +1 -1
- package/dist/vm/lib/global/sequence/zip.d.ts +1 -1
- package/dist/vm/lib/global/sequence/zip.d.ts.map +1 -1
- package/dist/vm/lib/global/string.d.ts +10 -10
- package/dist/vm/lib/global/string.d.ts.map +1 -1
- package/dist/vm/lib/global/time.d.ts +3 -13
- package/dist/vm/lib/global/time.d.ts.map +1 -1
- package/dist/vm/lib/global/to-primitive.d.ts +4 -4
- package/dist/vm/lib/global/to-primitive.d.ts.map +1 -1
- package/dist/vm/lib/helpers.d.ts +53 -0
- package/dist/vm/lib/helpers.d.ts.map +1 -0
- package/dist/vm/lib/index.d.ts +4 -0
- package/dist/vm/lib/index.d.ts.map +1 -0
- package/dist/vm/lib/{_loader.d.ts → loader.d.ts} +5 -5
- package/dist/vm/lib/loader.d.ts.map +1 -0
- package/dist/vm/lib/mod/index.d.ts +2 -0
- package/dist/vm/lib/mod/index.d.ts.map +1 -0
- package/dist/vm/lib/mod/matrix.d.ts +15 -0
- package/dist/vm/lib/mod/matrix.d.ts.map +1 -0
- package/dist/vm/operations.d.ts +4 -6
- package/dist/vm/operations.d.ts.map +1 -1
- package/dist/vm/types/boundary.d.ts +1 -1
- package/dist/vm/types/boundary.d.ts.map +1 -1
- package/dist/vm/types/context.d.ts +18 -12
- package/dist/vm/types/context.d.ts.map +1 -1
- package/dist/vm/types/extern.d.ts +1 -3
- package/dist/vm/types/extern.d.ts.map +1 -1
- package/dist/vm/types/function.d.ts +1 -6
- package/dist/vm/types/function.d.ts.map +1 -1
- package/dist/vm/types/index.d.ts +31 -17
- package/dist/vm/types/index.d.ts.map +1 -1
- package/dist/vm/types/module.d.ts +2 -4
- package/dist/vm/types/module.d.ts.map +1 -1
- package/dist/vm/types/wrapper.d.ts +0 -2
- package/dist/vm/types/wrapper.d.ts.map +1 -1
- package/package.json +7 -3
- package/src/cli/index.ts +1 -1
- package/src/compiler/compile-fast.ts +1 -2
- package/src/compiler/create-script.ts +12 -2
- package/src/compiler/diagnostic.ts +17 -8
- package/src/compiler/emit/constants.ts +2 -0
- package/src/compiler/emit/consts.ts +47 -0
- package/src/compiler/emit/globals.ts +39 -0
- package/src/compiler/{emit.ts → emit/index.ts} +18 -202
- package/src/compiler/emit/sourcemap.ts +163 -0
- package/src/compiler/index.ts +9 -9
- package/src/compiler/worker.ts +1 -1
- package/src/helpers/constants.ts +18 -1
- package/src/helpers/convert.ts +128 -0
- package/src/{vm → helpers}/error.ts +1 -1
- package/src/helpers/serialize.ts +72 -25
- package/src/helpers/types.ts +267 -0
- package/src/subtle.ts +3 -1
- package/src/vm/checkpoint.ts +42 -0
- package/src/vm/helpers.ts +9 -53
- package/src/vm/index.ts +3 -3
- package/src/vm/lib/global/bit.ts +8 -9
- package/src/vm/lib/global/debug.ts +5 -4
- package/src/vm/lib/global/index.ts +0 -1
- package/src/vm/lib/global/json.ts +2 -2
- package/src/vm/lib/global/math-additional.ts +2 -4
- package/src/vm/lib/global/math-arr.ts +1 -1
- package/src/vm/lib/global/math-unary.ts +2 -4
- package/src/vm/lib/global/math.ts +3 -4
- package/src/vm/lib/global/sequence/all-any.ts +11 -6
- package/src/vm/lib/global/sequence/entries.ts +3 -3
- package/src/vm/lib/global/sequence/find.ts +8 -7
- package/src/vm/lib/global/sequence/flatten.ts +2 -3
- package/src/vm/lib/global/sequence/len.ts +1 -1
- package/src/vm/lib/global/sequence/map-filter.ts +7 -6
- package/src/vm/lib/global/sequence/repeat.ts +2 -4
- package/src/vm/lib/global/sequence/reverse.ts +1 -1
- package/src/vm/lib/global/sequence/sort.ts +6 -5
- package/src/vm/lib/global/sequence/with.ts +22 -21
- package/src/vm/lib/global/sequence/zip.ts +4 -4
- package/src/vm/lib/global/string.ts +16 -27
- package/src/vm/lib/global/time.ts +59 -30
- package/src/vm/lib/global/to-primitive.ts +27 -18
- package/src/vm/lib/{_helpers.ts → helpers.ts} +129 -41
- package/src/vm/lib/index.ts +16 -0
- package/src/vm/lib/{_loader.ts → loader.ts} +3 -11
- package/src/vm/lib/mod/index.ts +1 -0
- package/src/vm/lib/{global/mod → mod}/matrix.ts +9 -7
- package/src/vm/operations.ts +33 -128
- package/src/vm/types/boundary.ts +10 -13
- package/src/vm/types/context.ts +36 -28
- package/src/vm/types/extern.ts +8 -15
- package/src/vm/types/function.ts +4 -19
- package/src/vm/types/index.ts +47 -25
- package/src/vm/types/module.ts +3 -7
- package/src/vm/types/wrapper.ts +1 -5
- package/dist/chunk-35JGBXRE.js +0 -1
- package/dist/chunk-55FKP56O.js.map +0 -6
- package/dist/chunk-Q74RKZ7O.js.map +0 -6
- package/dist/compiler/emit.d.ts +0 -5
- package/dist/compiler/emit.d.ts.map +0 -1
- package/dist/vm/error.d.ts.map +0 -1
- package/dist/vm/lib/_helpers.d.ts +0 -35
- package/dist/vm/lib/_helpers.d.ts.map +0 -1
- package/dist/vm/lib/_loader.d.ts.map +0 -1
- package/dist/vm/lib/global/mod/index.d.ts +0 -3
- package/dist/vm/lib/global/mod/index.d.ts.map +0 -1
- package/dist/vm/lib/global/mod/matrix.d.ts +0 -15
- package/dist/vm/lib/global/mod/matrix.d.ts.map +0 -1
- package/dist/vm/types/any.d.ts +0 -10
- package/dist/vm/types/any.d.ts.map +0 -1
- package/dist/vm/types/array.d.ts +0 -12
- package/dist/vm/types/array.d.ts.map +0 -1
- package/dist/vm/types/callable.d.ts +0 -5
- package/dist/vm/types/callable.d.ts.map +0 -1
- package/dist/vm/types/const.d.ts +0 -15
- package/dist/vm/types/const.d.ts.map +0 -1
- package/dist/vm/types/immutable.d.ts +0 -15
- package/dist/vm/types/immutable.d.ts.map +0 -1
- package/dist/vm/types/primitive.d.ts +0 -7
- package/dist/vm/types/primitive.d.ts.map +0 -1
- package/dist/vm/types/record.d.ts +0 -20
- package/dist/vm/types/record.d.ts.map +0 -1
- package/dist/vm/types/script.d.ts +0 -14
- package/dist/vm/types/script.d.ts.map +0 -1
- package/dist/vm/types/value.d.ts +0 -14
- package/dist/vm/types/value.d.ts.map +0 -1
- package/src/vm/lib/global/mod/index.ts +0 -4
- package/src/vm/types/any.ts +0 -33
- package/src/vm/types/array.ts +0 -19
- package/src/vm/types/callable.ts +0 -10
- package/src/vm/types/const.ts +0 -109
- package/src/vm/types/immutable.ts +0 -22
- package/src/vm/types/primitive.ts +0 -14
- package/src/vm/types/record.ts +0 -53
- package/src/vm/types/script.ts +0 -18
- package/src/vm/types/value.ts +0 -22
- /package/dist/{chunk-35JGBXRE.js.map → chunk-RIT53WVY.js.map} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { wrapScript } from './create-script.js';
|
|
1
|
+
import { wrapScript, type VmScript } from './create-script.js';
|
|
2
2
|
import type { TranspileOptions } from './types.js';
|
|
3
|
-
import type { VmScript } from '../vm/types/index.js';
|
|
4
3
|
import { GlobalFallback } from '../vm/helpers.js';
|
|
5
4
|
import { isFinite } from '../helpers/utils.js';
|
|
6
5
|
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import { kVmScript, VM_SCRIPT_NAME } from '../helpers/constants.js';
|
|
1
2
|
import { defineProperty } from '../helpers/utils.js';
|
|
2
3
|
import { keys, values } from '../vm/env.js';
|
|
3
|
-
import type {
|
|
4
|
+
import type { VmValue, VmContext } from '../vm/types/index.js';
|
|
4
5
|
import type { ScriptInput } from './types.js';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
/** Mirascript 脚本 */
|
|
8
|
+
export type VmScriptLike = (global?: VmContext) => VmValue;
|
|
9
|
+
|
|
10
|
+
/** Mirascript 脚本 */
|
|
11
|
+
export type VmScript = VmScriptLike & {
|
|
12
|
+
readonly [kVmScript]: true;
|
|
13
|
+
/** 原始代码 */
|
|
14
|
+
readonly source: string;
|
|
15
|
+
};
|
|
7
16
|
|
|
8
17
|
/** 生成 JS 函数 */
|
|
9
18
|
export function wrapScript(source: ScriptInput, script: VmScriptLike): VmScript {
|
|
@@ -11,6 +20,7 @@ export function wrapScript(source: ScriptInput, script: VmScriptLike): VmScript
|
|
|
11
20
|
if (kVmScript in script) {
|
|
12
21
|
return script as VmScriptLike as VmScript;
|
|
13
22
|
}
|
|
23
|
+
defineProperty(script, 'name', { value: VM_SCRIPT_NAME });
|
|
14
24
|
defineProperty(script, kVmScript, { value: true });
|
|
15
25
|
if (typeof source === 'string') {
|
|
16
26
|
defineProperty(script, 'source', { value: source, configurable: true });
|
|
@@ -183,13 +183,22 @@ function formatRange(range: IRange): string {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
/** 生成诊断消息的字符串 */
|
|
186
|
-
export function
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
186
|
+
export function formatDiagnostics(
|
|
187
|
+
diagnostics: Iterable<SourceDiagnostic>,
|
|
188
|
+
source: ScriptInput,
|
|
189
|
+
fileName: string | undefined,
|
|
190
|
+
): string[] {
|
|
191
|
+
const rangePrefix = fileName ? `${fileName}:` : '';
|
|
192
|
+
const messages: string[] = [];
|
|
193
|
+
for (const diagnostic of diagnostics) {
|
|
194
|
+
const range = formatRange(diagnostic.range);
|
|
195
|
+
const codeName = DiagnosticCode[diagnostic.code] || `Unknown(${diagnostic.code})`;
|
|
196
|
+
let message = getDiagnosticMessage(diagnostic.code);
|
|
197
|
+
for (const ref of diagnostic.references) {
|
|
198
|
+
const refRange = formatRange(ref.range);
|
|
199
|
+
message += `\n (${refRange}): ${getDiagnosticMessage(ref.code)}`;
|
|
200
|
+
}
|
|
201
|
+
messages.push(` ${codeName}(${rangePrefix}${range}): ${message}`);
|
|
193
202
|
}
|
|
194
|
-
return
|
|
203
|
+
return messages;
|
|
195
204
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { VmPrimitive } from '../../vm/index.js';
|
|
2
|
+
|
|
3
|
+
/** 将值转为 JS 字面量 */
|
|
4
|
+
export function toJsLiteral(value: VmPrimitive | undefined): string {
|
|
5
|
+
/* c8 ignore next 2 */
|
|
6
|
+
if (value === null) return 'null';
|
|
7
|
+
if (value === undefined) return 'undefined';
|
|
8
|
+
if (typeof value == 'string') {
|
|
9
|
+
return JSON.stringify(value);
|
|
10
|
+
}
|
|
11
|
+
// JSON 无法处理 NaN 等特殊数字
|
|
12
|
+
if (value === 0) {
|
|
13
|
+
if (1 / value === -Infinity) return '-0';
|
|
14
|
+
return '0';
|
|
15
|
+
}
|
|
16
|
+
return String(value satisfies number | boolean);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 解析常量 */
|
|
20
|
+
export function readConst(reader: DataView, offset: number): [value: VmPrimitive, consumed: number] {
|
|
21
|
+
const type = reader.getUint8(offset);
|
|
22
|
+
switch (type) {
|
|
23
|
+
/* c8 ignore next 2 */
|
|
24
|
+
case 0:
|
|
25
|
+
return [null, 1];
|
|
26
|
+
case 1:
|
|
27
|
+
return [true, 1];
|
|
28
|
+
case 2:
|
|
29
|
+
return [false, 1];
|
|
30
|
+
case 3: {
|
|
31
|
+
const ordinal = reader.getInt32(offset + 1, true);
|
|
32
|
+
return [ordinal, 5];
|
|
33
|
+
}
|
|
34
|
+
case 4: {
|
|
35
|
+
const num = reader.getFloat64(offset + 1, true);
|
|
36
|
+
return [num, 9];
|
|
37
|
+
}
|
|
38
|
+
case 5: {
|
|
39
|
+
const len = reader.getUint32(offset + 1, true);
|
|
40
|
+
const str = new TextDecoder().decode(new Uint8Array(reader.buffer, reader.byteOffset + offset + 5, len));
|
|
41
|
+
return [str, 5 + len];
|
|
42
|
+
}
|
|
43
|
+
/* c8 ignore next 2 */
|
|
44
|
+
default:
|
|
45
|
+
throw new Error(`Unknown constant type: ${type}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { toString } from '../../helpers/convert.js';
|
|
2
|
+
import { toJsLiteral } from './consts.js';
|
|
3
|
+
import type { Emitter } from './index.js';
|
|
4
|
+
|
|
5
|
+
/** 全局变量描述符 */
|
|
6
|
+
export type GlobalDesc = {
|
|
7
|
+
/** 变量编译后的名称 */
|
|
8
|
+
v: string;
|
|
9
|
+
/** 变量名字的字面量,是一个 JS 字符串字面量 */
|
|
10
|
+
l: string;
|
|
11
|
+
/** 变量的表达式,用于获取全局变量 */
|
|
12
|
+
e: string;
|
|
13
|
+
/** 变量的名称 */
|
|
14
|
+
n: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** 全局变量映射,key 为变量名在常量表中的索引 */
|
|
18
|
+
export type GlobalMap = Map<number, GlobalDesc>;
|
|
19
|
+
|
|
20
|
+
/** 获取全局变量映射 */
|
|
21
|
+
export function readGlobal(emitter: Emitter, constIdx: number): GlobalDesc {
|
|
22
|
+
const { globals } = emitter;
|
|
23
|
+
const cached = globals.get(constIdx);
|
|
24
|
+
if (cached) return cached;
|
|
25
|
+
const constName = emitter.constVals[constIdx]!;
|
|
26
|
+
let name, lit;
|
|
27
|
+
if (typeof constName == 'string') {
|
|
28
|
+
name = constName;
|
|
29
|
+
lit = emitter.constLits[constIdx]!;
|
|
30
|
+
} else {
|
|
31
|
+
name = toString(constName, undefined);
|
|
32
|
+
lit = toJsLiteral(name);
|
|
33
|
+
}
|
|
34
|
+
const val = `g${globals.size + 1}`;
|
|
35
|
+
const expr = `(${val} === undefined ? (${val} = global.get(${lit})) : ${val})`;
|
|
36
|
+
const desc: GlobalDesc = { v: val, l: lit, e: expr, n: name };
|
|
37
|
+
globals.set(constIdx, desc);
|
|
38
|
+
return desc;
|
|
39
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { OpCode } from '@mirascript/bindings';
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
import type {
|
|
5
|
-
import type
|
|
6
|
-
import {
|
|
2
|
+
import type { VmPrimitive } from '../../vm/index.js';
|
|
3
|
+
import type { ScriptInput, TranspileOptions } from '../types.js';
|
|
4
|
+
import type { IRange } from '../diagnostic.js';
|
|
5
|
+
import { readGlobal, type GlobalMap } from './globals.js';
|
|
6
|
+
import { readConst, toJsLiteral } from './consts.js';
|
|
7
|
+
import { createSourceMap } from './sourcemap.js';
|
|
7
8
|
|
|
8
9
|
/** 生成代码 */
|
|
9
10
|
export function emit(
|
|
@@ -18,55 +19,6 @@ export function emit(
|
|
|
18
19
|
return code;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
/** 解析常量 */
|
|
22
|
-
function readConst(reader: DataView, offset: number): [value: VmPrimitive, consumed: number] {
|
|
23
|
-
const type = reader.getUint8(offset);
|
|
24
|
-
switch (type) {
|
|
25
|
-
/* c8 ignore next 2 */
|
|
26
|
-
case 0:
|
|
27
|
-
return [null, 1];
|
|
28
|
-
case 1:
|
|
29
|
-
return [true, 1];
|
|
30
|
-
case 2:
|
|
31
|
-
return [false, 1];
|
|
32
|
-
case 3: {
|
|
33
|
-
const ordinal = reader.getInt32(offset + 1, true);
|
|
34
|
-
return [ordinal, 5];
|
|
35
|
-
}
|
|
36
|
-
case 4: {
|
|
37
|
-
const num = reader.getFloat64(offset + 1, true);
|
|
38
|
-
return [num, 9];
|
|
39
|
-
}
|
|
40
|
-
case 5: {
|
|
41
|
-
const len = reader.getUint32(offset + 1, true);
|
|
42
|
-
const str = new TextDecoder().decode(new Uint8Array(reader.buffer, reader.byteOffset + offset + 5, len));
|
|
43
|
-
return [str, 5 + len];
|
|
44
|
-
}
|
|
45
|
-
/* c8 ignore next 2 */
|
|
46
|
-
default:
|
|
47
|
-
throw new Error(`Unknown constant type: ${type}`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** 将值转为 JS */
|
|
52
|
-
function toJavascript(value: VmConst | undefined): string {
|
|
53
|
-
/* c8 ignore next 2 */
|
|
54
|
-
if (value === null) return 'null';
|
|
55
|
-
if (value === undefined) return 'undefined';
|
|
56
|
-
if (typeof value == 'object' || typeof value == 'string') {
|
|
57
|
-
return JSON.stringify(value);
|
|
58
|
-
}
|
|
59
|
-
// JSON 无法处理 NaN 等特殊数字
|
|
60
|
-
if (value === 0) {
|
|
61
|
-
if (1 / value === -Infinity) return '-0';
|
|
62
|
-
return '0';
|
|
63
|
-
}
|
|
64
|
-
return String(value);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const ORIGIN = `mira://MiraScript/`;
|
|
68
|
-
let sourceId = 1;
|
|
69
|
-
|
|
70
22
|
/** 创建数组 */
|
|
71
23
|
function createArray<T>(length: number, fn: (index: number) => T): T[] {
|
|
72
24
|
// micro bench shows that this is faster than Array.from
|
|
@@ -80,7 +32,7 @@ function createArray<T>(length: number, fn: (index: number) => T): T[] {
|
|
|
80
32
|
const SCRIPT_PREFIX = `'use strict'; return ((global = GlobalFallback()) => { try { CpEnter();`;
|
|
81
33
|
const GLOBAL_HINT = `/* globals */`;
|
|
82
34
|
/** 代码生成 */
|
|
83
|
-
class Emitter {
|
|
35
|
+
export class Emitter {
|
|
84
36
|
constructor(
|
|
85
37
|
readonly source: ScriptInput,
|
|
86
38
|
readonly chunk: Uint8Array,
|
|
@@ -106,7 +58,7 @@ class Emitter {
|
|
|
106
58
|
for (let i = 0, index = 0; i < this.constSize; index++) {
|
|
107
59
|
const [constant, size] = readConst(this.constReader, i);
|
|
108
60
|
this.constVals.push(constant);
|
|
109
|
-
this.constLits.push(
|
|
61
|
+
this.constLits.push(toJsLiteral(constant));
|
|
110
62
|
i += size;
|
|
111
63
|
}
|
|
112
64
|
}
|
|
@@ -125,24 +77,10 @@ class Emitter {
|
|
|
125
77
|
return ' '.repeat(this.identCounter + len);
|
|
126
78
|
}
|
|
127
79
|
|
|
128
|
-
readonly globals = new Map
|
|
80
|
+
readonly globals: GlobalMap = new Map();
|
|
129
81
|
/** 读取全局变量 */
|
|
130
82
|
private rg(constIdx: number, eager: boolean): string {
|
|
131
|
-
|
|
132
|
-
if (cached != null) {
|
|
133
|
-
if (eager && !cached[2]) {
|
|
134
|
-
cached[2] = true;
|
|
135
|
-
cached[3] = cached[0];
|
|
136
|
-
}
|
|
137
|
-
return cached[3];
|
|
138
|
-
}
|
|
139
|
-
const constName = this.constVals[constIdx]!;
|
|
140
|
-
const name = $ToString(constName);
|
|
141
|
-
const lit = typeof constName == 'string' ? this.constLits[constIdx]! : JSON.stringify(name);
|
|
142
|
-
const val = `g${this.globals.size + 1}`;
|
|
143
|
-
const expr = eager ? val : `(${val} === undefined ? (${val} = global.get(${lit})) : ${val})`;
|
|
144
|
-
this.globals.set(constIdx, [val, lit, eager, expr, name]);
|
|
145
|
-
return expr;
|
|
83
|
+
return readGlobal(this, constIdx).e;
|
|
146
84
|
}
|
|
147
85
|
|
|
148
86
|
readonly codeLines: string[] = [];
|
|
@@ -477,7 +415,7 @@ class Emitter {
|
|
|
477
415
|
const args = createArray(n, () => read());
|
|
478
416
|
const ns = read();
|
|
479
417
|
const spreads = createArray(ns, () => read());
|
|
480
|
-
const callTarget = opcode === OpCode.Call ? this.rg(func,
|
|
418
|
+
const callTarget = opcode === OpCode.Call ? this.rg(func, false) : this.rv(func);
|
|
481
419
|
code = `${this.wv(reg)} = $Call(${callTarget}, [${args
|
|
482
420
|
.map((a, i) => {
|
|
483
421
|
if (spreads.includes(i)) return `...$ArraySpread(${this.rv(a)})`;
|
|
@@ -582,7 +520,7 @@ class Emitter {
|
|
|
582
520
|
case OpCode.GetGlobal: {
|
|
583
521
|
reg = read();
|
|
584
522
|
const i = read();
|
|
585
|
-
code = `${this.wv(reg)} = ${this.rg(i,
|
|
523
|
+
code = `${this.wv(reg)} = ${this.rg(i, false)};`;
|
|
586
524
|
break;
|
|
587
525
|
}
|
|
588
526
|
case OpCode.GetGlobalDyn: {
|
|
@@ -655,12 +593,12 @@ class Emitter {
|
|
|
655
593
|
}
|
|
656
594
|
case OpCode.If: {
|
|
657
595
|
const cond = read();
|
|
658
|
-
code = `if ($
|
|
596
|
+
code = `if ($ToBoolean(${this.rv(cond)})) {`;
|
|
659
597
|
break;
|
|
660
598
|
}
|
|
661
599
|
case OpCode.IfNot: {
|
|
662
600
|
const cond = read();
|
|
663
|
-
code = `if (
|
|
601
|
+
code = `if (!$ToBoolean(${this.rv(cond)})) {`;
|
|
664
602
|
break;
|
|
665
603
|
}
|
|
666
604
|
case OpCode.IfInit: {
|
|
@@ -769,9 +707,8 @@ class Emitter {
|
|
|
769
707
|
this.readCode();
|
|
770
708
|
if (this.globals.size > 0) {
|
|
771
709
|
let globalsInit = '';
|
|
772
|
-
for (const
|
|
773
|
-
|
|
774
|
-
globalsInit += globalsInit ? `, ${expr}` : `var ${GLOBAL_HINT} ${expr}`;
|
|
710
|
+
for (const { v } of this.globals.values()) {
|
|
711
|
+
globalsInit += globalsInit ? `, ${v}` : `var ${GLOBAL_HINT} ${v}`;
|
|
775
712
|
}
|
|
776
713
|
this.codeLines[0] += globalsInit + ';';
|
|
777
714
|
}
|
|
@@ -780,128 +717,7 @@ class Emitter {
|
|
|
780
717
|
/** 添加源映射 */
|
|
781
718
|
addSourceMap(): void {
|
|
782
719
|
if (!this.options.sourceMap) return;
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
if (!hasSchema) {
|
|
786
|
-
if (fileName.startsWith('/')) {
|
|
787
|
-
fileName = fileName.replace(/^\/+\s*/, '');
|
|
788
|
-
}
|
|
789
|
-
if (!fileName) {
|
|
790
|
-
fileName = `${sourceId++}.${this.options.input_mode === 'Template' ? 'miratpl' : 'mira'}`;
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
const map = new SourceMapGenerator({
|
|
794
|
-
file: fileName + '.js',
|
|
795
|
-
});
|
|
796
|
-
if (typeof this.source === 'string') {
|
|
797
|
-
map.setSourceContent(fileName, this.source);
|
|
798
|
-
}
|
|
799
|
-
let hasStartMap = false;
|
|
800
|
-
for (let i = 1; i < this.sourcemaps.length; i++) {
|
|
801
|
-
const range = this.sourcemaps[i];
|
|
802
|
-
if (!range) break;
|
|
803
|
-
if (!hasStartMap && range.startLineNumber === 1 && range.startColumn === 1) {
|
|
804
|
-
hasStartMap = true;
|
|
805
|
-
}
|
|
806
|
-
map.addMapping({
|
|
807
|
-
generated: {
|
|
808
|
-
// 前两行固定为:
|
|
809
|
-
// (function anonymous($Add,$Aeq, ...
|
|
810
|
-
// ) {
|
|
811
|
-
line: i + 3,
|
|
812
|
-
column: 0,
|
|
813
|
-
},
|
|
814
|
-
original: {
|
|
815
|
-
line: range.startLineNumber,
|
|
816
|
-
column: range.startColumn - 1,
|
|
817
|
-
},
|
|
818
|
-
source: fileName,
|
|
819
|
-
});
|
|
820
|
-
}
|
|
821
|
-
if (!hasStartMap) {
|
|
822
|
-
map.addMapping({
|
|
823
|
-
generated: {
|
|
824
|
-
line: 3,
|
|
825
|
-
column: SCRIPT_PREFIX.length - 'CpEnter();'.length,
|
|
826
|
-
},
|
|
827
|
-
original: {
|
|
828
|
-
line: 1,
|
|
829
|
-
column: 0,
|
|
830
|
-
},
|
|
831
|
-
source: fileName,
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
{
|
|
835
|
-
const line0 = this.codeLines[0]!;
|
|
836
|
-
const file = `${fileName} <globals>`;
|
|
837
|
-
let globals = `global;\n`;
|
|
838
|
-
map.addMapping({
|
|
839
|
-
generated: {
|
|
840
|
-
line: 3,
|
|
841
|
-
column: line0.indexOf(`global = `),
|
|
842
|
-
},
|
|
843
|
-
original: {
|
|
844
|
-
line: 1,
|
|
845
|
-
column: 0,
|
|
846
|
-
},
|
|
847
|
-
source: file,
|
|
848
|
-
name: 'global',
|
|
849
|
-
});
|
|
850
|
-
map.addMapping({
|
|
851
|
-
generated: {
|
|
852
|
-
line: 3,
|
|
853
|
-
column: SCRIPT_PREFIX.length,
|
|
854
|
-
},
|
|
855
|
-
original: {
|
|
856
|
-
line: 1,
|
|
857
|
-
column: 7,
|
|
858
|
-
},
|
|
859
|
-
source: file,
|
|
860
|
-
name: '',
|
|
861
|
-
});
|
|
862
|
-
let i = 1;
|
|
863
|
-
let pos = line0.indexOf(GLOBAL_HINT, SCRIPT_PREFIX.length) + GLOBAL_HINT.length;
|
|
864
|
-
for (const p of this.globals.values()) {
|
|
865
|
-
i++;
|
|
866
|
-
if (pos < 0) break;
|
|
867
|
-
const val = p[0];
|
|
868
|
-
pos = line0.indexOf(val, pos);
|
|
869
|
-
if (pos < 0) break;
|
|
870
|
-
const name = p[4];
|
|
871
|
-
map.addMapping({
|
|
872
|
-
generated: {
|
|
873
|
-
line: 3,
|
|
874
|
-
column: pos,
|
|
875
|
-
},
|
|
876
|
-
original: {
|
|
877
|
-
line: i,
|
|
878
|
-
column: 0,
|
|
879
|
-
},
|
|
880
|
-
source: file,
|
|
881
|
-
name,
|
|
882
|
-
});
|
|
883
|
-
globals += `${name};\n`;
|
|
884
|
-
}
|
|
885
|
-
map.addMapping({
|
|
886
|
-
generated: {
|
|
887
|
-
line: 3,
|
|
888
|
-
column: pos,
|
|
889
|
-
},
|
|
890
|
-
original: {
|
|
891
|
-
line: i,
|
|
892
|
-
column: 0,
|
|
893
|
-
},
|
|
894
|
-
source: file,
|
|
895
|
-
name: '',
|
|
896
|
-
});
|
|
897
|
-
map.setSourceContent(file, globals);
|
|
898
|
-
}
|
|
899
|
-
const prefix = '//# ';
|
|
900
|
-
const sourceURL = hasSchema ? fileName : `${ORIGIN}${fileName}`;
|
|
901
|
-
this.codeLines.push(
|
|
902
|
-
// Prevent source map from being recognized as of this file
|
|
903
|
-
`${prefix}sourceURL=${sourceURL}.js`,
|
|
904
|
-
`${prefix}sourceMappingURL=data:application/json,${encodeURIComponent(map.toString())}`,
|
|
905
|
-
);
|
|
720
|
+
const mapLines = createSourceMap(this.source, this.sourcemaps, this.codeLines, this.globals, this.options);
|
|
721
|
+
this.codeLines.push(...mapLines);
|
|
906
722
|
}
|
|
907
723
|
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type { IRange } from '../diagnostic.js';
|
|
2
|
+
import type { ScriptInput, TranspileOptions } from '../types.js';
|
|
3
|
+
import { SourceMapGenerator } from 'source-map-js';
|
|
4
|
+
import { GLOBAL_HINT, SCRIPT_PREFIX } from './constants.js';
|
|
5
|
+
import type { GlobalMap } from './globals.js';
|
|
6
|
+
|
|
7
|
+
const ORIGIN = `mira://MiraScript/`;
|
|
8
|
+
const PREFIX = '//# ';
|
|
9
|
+
const SOURCE_URL = `${PREFIX}sourceURL`;
|
|
10
|
+
const SOURCE_MAPPING_URL = `${PREFIX}sourceMappingURL`;
|
|
11
|
+
// 前两行固定为:
|
|
12
|
+
// (function anonymous($Add,$Aeq, ...
|
|
13
|
+
// ) {
|
|
14
|
+
const SOURCE_OFFSET = 3;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Node.js Buffer 类型的简易声明,@mirascript/playground 调试环境下会直接加载此文件
|
|
18
|
+
*/
|
|
19
|
+
declare class Buffer {
|
|
20
|
+
/** @inheritdoc */
|
|
21
|
+
static from(str: string, encoding: 'utf8'): Buffer;
|
|
22
|
+
/** @inheritdoc */
|
|
23
|
+
toString(encoding: 'base64'): string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const toDataUrl: (json: string) => string =
|
|
27
|
+
typeof Buffer == 'function' && typeof Buffer.from == 'function'
|
|
28
|
+
? (s) => `data:application/json;base64,${Buffer.from(s, 'utf8').toString('base64')}`
|
|
29
|
+
: (s) => `data:application/json;charset=utf-8,${encodeURIComponent(s)}`;
|
|
30
|
+
|
|
31
|
+
/** 添加全局变量的源映射 */
|
|
32
|
+
function addGlobalMappings(globalLine: string, fileName: string, map: SourceMapGenerator, globals: GlobalMap) {
|
|
33
|
+
let globalFile = `global;\n`;
|
|
34
|
+
map.addMapping({
|
|
35
|
+
generated: {
|
|
36
|
+
line: 3,
|
|
37
|
+
column: globalLine.indexOf(`global = `),
|
|
38
|
+
},
|
|
39
|
+
original: {
|
|
40
|
+
line: 1,
|
|
41
|
+
column: 0,
|
|
42
|
+
},
|
|
43
|
+
source: fileName,
|
|
44
|
+
name: 'global',
|
|
45
|
+
});
|
|
46
|
+
map.addMapping({
|
|
47
|
+
generated: {
|
|
48
|
+
line: 3,
|
|
49
|
+
column: SCRIPT_PREFIX.length,
|
|
50
|
+
},
|
|
51
|
+
original: {
|
|
52
|
+
line: 1,
|
|
53
|
+
column: 7,
|
|
54
|
+
},
|
|
55
|
+
source: fileName,
|
|
56
|
+
name: '',
|
|
57
|
+
});
|
|
58
|
+
let i = 1;
|
|
59
|
+
let pos = globalLine.indexOf(GLOBAL_HINT, SCRIPT_PREFIX.length) + GLOBAL_HINT.length;
|
|
60
|
+
for (const p of globals.values()) {
|
|
61
|
+
i++;
|
|
62
|
+
if (pos < 0) break;
|
|
63
|
+
const { v, n } = p;
|
|
64
|
+
pos = globalLine.indexOf(v, pos);
|
|
65
|
+
if (pos < 0) break;
|
|
66
|
+
map.addMapping({
|
|
67
|
+
generated: {
|
|
68
|
+
line: 3,
|
|
69
|
+
column: pos,
|
|
70
|
+
},
|
|
71
|
+
original: {
|
|
72
|
+
line: i,
|
|
73
|
+
column: 0,
|
|
74
|
+
},
|
|
75
|
+
source: fileName,
|
|
76
|
+
name: n,
|
|
77
|
+
});
|
|
78
|
+
globalFile += `${n};\n`;
|
|
79
|
+
}
|
|
80
|
+
map.addMapping({
|
|
81
|
+
generated: {
|
|
82
|
+
line: 3,
|
|
83
|
+
column: pos,
|
|
84
|
+
},
|
|
85
|
+
original: {
|
|
86
|
+
line: i,
|
|
87
|
+
column: 0,
|
|
88
|
+
},
|
|
89
|
+
source: fileName,
|
|
90
|
+
name: '',
|
|
91
|
+
});
|
|
92
|
+
map.setSourceContent(fileName, globalFile);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let sourceId = 1;
|
|
96
|
+
/** 创建源映射 */
|
|
97
|
+
export function createSourceMap(
|
|
98
|
+
source: ScriptInput | undefined,
|
|
99
|
+
sourcemaps: readonly IRange[],
|
|
100
|
+
codeLines: readonly string[],
|
|
101
|
+
globals: GlobalMap,
|
|
102
|
+
options: TranspileOptions,
|
|
103
|
+
): [string, string] {
|
|
104
|
+
let fileName = (options.fileName ?? '').trim();
|
|
105
|
+
const hasSchema = /^\w+:/.test(fileName);
|
|
106
|
+
if (!hasSchema) {
|
|
107
|
+
if (fileName.startsWith('/')) {
|
|
108
|
+
fileName = fileName.replace(/^\/+\s*/, '');
|
|
109
|
+
}
|
|
110
|
+
if (!fileName) {
|
|
111
|
+
fileName = `${sourceId++}.${options.input_mode === 'Template' ? 'miratpl' : 'mira'}`;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const map = new SourceMapGenerator({
|
|
115
|
+
file: fileName + '.js',
|
|
116
|
+
});
|
|
117
|
+
if (typeof source === 'string') {
|
|
118
|
+
map.setSourceContent(fileName, source);
|
|
119
|
+
}
|
|
120
|
+
let hasStartMap = false;
|
|
121
|
+
for (let i = 1; i < sourcemaps.length; i++) {
|
|
122
|
+
const range = sourcemaps[i];
|
|
123
|
+
if (!range) break;
|
|
124
|
+
if (!hasStartMap && range.startLineNumber === 1 && range.startColumn === 1) {
|
|
125
|
+
hasStartMap = true;
|
|
126
|
+
}
|
|
127
|
+
map.addMapping({
|
|
128
|
+
generated: {
|
|
129
|
+
line: i + SOURCE_OFFSET,
|
|
130
|
+
column: 0,
|
|
131
|
+
},
|
|
132
|
+
original: {
|
|
133
|
+
line: range.startLineNumber,
|
|
134
|
+
column: range.startColumn - 1,
|
|
135
|
+
},
|
|
136
|
+
source: fileName,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (!hasStartMap) {
|
|
140
|
+
map.addMapping({
|
|
141
|
+
generated: {
|
|
142
|
+
line: SOURCE_OFFSET,
|
|
143
|
+
column: SCRIPT_PREFIX.length - 'CpEnter();'.length,
|
|
144
|
+
},
|
|
145
|
+
original: {
|
|
146
|
+
line: 1,
|
|
147
|
+
column: 0,
|
|
148
|
+
},
|
|
149
|
+
source: fileName,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
const globalLine = codeLines[0];
|
|
153
|
+
if (globalLine?.includes(GLOBAL_HINT)) {
|
|
154
|
+
addGlobalMappings(globalLine, `${fileName} <globals>`, map, globals);
|
|
155
|
+
}
|
|
156
|
+
const sourceURL = hasSchema ? fileName : `${ORIGIN}${fileName}`;
|
|
157
|
+
const dataUrl = toDataUrl(map.toString());
|
|
158
|
+
return [
|
|
159
|
+
// Prevent source map from being recognized as of this file
|
|
160
|
+
`${SOURCE_URL}=${sourceURL}.js`,
|
|
161
|
+
`${SOURCE_MAPPING_URL}=${dataUrl}`,
|
|
162
|
+
];
|
|
163
|
+
}
|
package/src/compiler/index.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { loadModule } from '@mirascript/bindings';
|
|
2
|
-
import type { VmScript } from '../vm/index.js';
|
|
3
2
|
import type { ScriptInput, TranspileOptions } from './types.js';
|
|
4
|
-
import { emit } from './emit.js';
|
|
5
|
-
import { createScript } from './create-script.js';
|
|
3
|
+
import { emit } from './emit/index.js';
|
|
4
|
+
import { createScript, type VmScript } from './create-script.js';
|
|
6
5
|
import { compileFast } from './compile-fast.js';
|
|
7
|
-
import { DiagnosticCode,
|
|
6
|
+
import { DiagnosticCode, formatDiagnostics, parseDiagnostics } from './diagnostic.js';
|
|
8
7
|
import { generateBytecode, generateBytecodeSync } from './generate-bytecode.js';
|
|
9
8
|
import { compileWorker } from './worker-manager.js';
|
|
10
9
|
await loadModule();
|
|
11
10
|
|
|
12
11
|
export { generateBytecode, generateBytecodeSync };
|
|
13
|
-
export
|
|
12
|
+
export * from './types.js';
|
|
13
|
+
export type { VmScript };
|
|
14
14
|
|
|
15
15
|
// 目前编译速度约 2000kB/s
|
|
16
16
|
const WORKER_MIN_LEN = typeof Worker != 'function' ? Number.MAX_VALUE : 1024;
|
|
17
17
|
|
|
18
18
|
/** 报告编译错误 */
|
|
19
|
-
function reportDiagnostic(source: ScriptInput, diagnostics: Uint32Array): never {
|
|
19
|
+
function reportDiagnostic(source: ScriptInput, diagnostics: Uint32Array, fileName: string | undefined): never {
|
|
20
20
|
const parsed = parseDiagnostics(source, diagnostics);
|
|
21
|
-
const messages = parsed.errors
|
|
21
|
+
const messages = formatDiagnostics(parsed.errors, source, fileName);
|
|
22
22
|
throw new Error(`Failed to compile:\n${messages.join('\n')}`);
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -31,7 +31,7 @@ export function emitScript(
|
|
|
31
31
|
options: TranspileOptions,
|
|
32
32
|
): VmScript {
|
|
33
33
|
if (!code) {
|
|
34
|
-
reportDiagnostic(source, diagnostics);
|
|
34
|
+
reportDiagnostic(source, diagnostics, options.fileName);
|
|
35
35
|
}
|
|
36
36
|
const sourcemaps = options.sourceMap
|
|
37
37
|
? parseDiagnostics(source, diagnostics, (c) => c === DiagnosticCode.SourceMap).sourcemaps
|
|
@@ -59,7 +59,7 @@ export async function compile(this: void, source: ScriptInput, options: Transpil
|
|
|
59
59
|
}
|
|
60
60
|
const [target, diagnostics] = await compileWorker(source, options);
|
|
61
61
|
if (target == null) {
|
|
62
|
-
reportDiagnostic(source, diagnostics);
|
|
62
|
+
reportDiagnostic(source, diagnostics, options.fileName);
|
|
63
63
|
}
|
|
64
64
|
return createScript(source, target);
|
|
65
65
|
}
|
package/src/compiler/worker.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ScriptInput, TranspileOptions } from './types.js';
|
|
2
|
-
import { emit } from './emit.js';
|
|
2
|
+
import { emit } from './emit/index.js';
|
|
3
3
|
import { generateBytecode } from './generate-bytecode.js';
|
|
4
4
|
import { DiagnosticCode, parseDiagnostics } from './diagnostic.js';
|
|
5
5
|
|