@mirascript/mirascript 0.1.15 → 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-NT235HY3.js → chunk-LU4ZKFF6.js} +1411 -608
- 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-JVFUK7AN.js → chunk-YZGL3D7L.js} +739 -1366
- 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 +10 -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 +13 -4
- 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 +2 -4
- 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 +10 -9
- 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} +16 -200
- 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 +12 -0
- package/src/helpers/convert.ts +128 -0
- package/src/{vm → helpers}/error.ts +1 -1
- package/src/helpers/serialize.ts +71 -24
- 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 +1 -1
- package/src/vm/lib/global/sequence/find.ts +4 -3
- 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 +4 -3
- 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 +21 -20
- package/src/vm/lib/global/sequence/zip.ts +3 -3
- 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 +31 -126
- package/src/vm/types/boundary.ts +10 -13
- package/src/vm/types/context.ts +17 -24
- 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-JVFUK7AN.js.map +0 -6
- package/dist/chunk-NT235HY3.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,11 +1,11 @@
|
|
|
1
|
-
export declare const chars: ((str: import("../../index.js").VmValue | undefined) => string[]) & import("../
|
|
2
|
-
export declare const starts_with: ((str: import("../../index.js").VmValue | undefined, search: import("../../index.js").VmValue | undefined) => boolean) & import("../
|
|
3
|
-
export declare const ends_with: ((str: import("../../index.js").VmValue | undefined, search: import("../../index.js").VmValue | undefined) => boolean) & import("../
|
|
4
|
-
export declare const contains: ((str: import("../../index.js").VmValue | undefined, search: import("../../index.js").VmValue | undefined) => boolean) & import("../
|
|
5
|
-
export declare const trim_start: ((str: import("../../index.js").VmValue | undefined) => string) & import("../
|
|
6
|
-
export declare const trim_end: ((str: import("../../index.js").VmValue | undefined) => string) & import("../
|
|
7
|
-
export declare const trim: ((str: import("../../index.js").VmValue | undefined) => string) & import("../
|
|
8
|
-
export declare const replace: ((str: import("../../index.js").VmValue | undefined, search: import("../../index.js").VmValue | undefined, replacement?: import("../../index.js").VmValue | undefined) => string) & import("../
|
|
9
|
-
export declare const split: ((str: import("../../index.js").VmValue | undefined, separator?: import("../../index.js").VmValue | undefined) => string[]) & import("../
|
|
10
|
-
export declare const join: ((arr: import("../../index.js").VmValue | undefined, separator?: import("../../index.js").VmValue | undefined) => string) & import("../
|
|
1
|
+
export declare const chars: ((str: import("../../index.js").VmValue | undefined) => string[]) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
2
|
+
export declare const starts_with: ((str: import("../../index.js").VmValue | undefined, search: import("../../index.js").VmValue | undefined) => boolean) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
3
|
+
export declare const ends_with: ((str: import("../../index.js").VmValue | undefined, search: import("../../index.js").VmValue | undefined) => boolean) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
4
|
+
export declare const contains: ((str: import("../../index.js").VmValue | undefined, search: import("../../index.js").VmValue | undefined) => boolean) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
5
|
+
export declare const trim_start: ((str: import("../../index.js").VmValue | undefined) => string) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
6
|
+
export declare const trim_end: ((str: import("../../index.js").VmValue | undefined) => string) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
7
|
+
export declare const trim: ((str: import("../../index.js").VmValue | undefined) => string) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
8
|
+
export declare const replace: ((str: import("../../index.js").VmValue | undefined, search: import("../../index.js").VmValue | undefined, replacement?: import("../../index.js").VmValue | undefined) => string) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
9
|
+
export declare const split: ((str: import("../../index.js").VmValue | undefined, separator?: import("../../index.js").VmValue | undefined) => string[]) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
10
|
+
export declare const join: ((arr: import("../../index.js").VmValue | undefined, separator?: import("../../index.js").VmValue | undefined) => string) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
11
11
|
//# sourceMappingURL=string.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../../src/vm/lib/global/string.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../../src/vm/lib/global/string.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,mIAWjB,CAAC;AAEF,eAAO,MAAM,WAAW,wLAWvB,CAAC;AACF,eAAO,MAAM,SAAS,wLAWrB,CAAC;AAEF,eAAO,MAAM,QAAQ,wLAWpB,CAAC;AAEF,eAAO,MAAM,UAAU,iIAWtB,CAAC;AAEF,eAAO,MAAM,QAAQ,iIAWpB,CAAC;AAEF,eAAO,MAAM,IAAI,iIAWhB,CAAC;AAEF,eAAO,MAAM,OAAO,mPAcnB,CAAC;AAEF,eAAO,MAAM,KAAK,6LAcjB,CAAC;AAEF,eAAO,MAAM,IAAI,2LAahB,CAAC"}
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
export declare const to_timestamp: ((datetime: import("../../index.js").VmValue | undefined) =>
|
|
2
|
-
export declare const to_datetime: ((datetime: import("../../index.js").VmValue | undefined, offset: import("../../index.js").VmValue | undefined) =>
|
|
3
|
-
|
|
4
|
-
month: number;
|
|
5
|
-
day: number;
|
|
6
|
-
hour: number;
|
|
7
|
-
minute: number;
|
|
8
|
-
second: number;
|
|
9
|
-
millisecond: number;
|
|
10
|
-
dayOfWeek: number;
|
|
11
|
-
offset: number;
|
|
12
|
-
} | null) & import("../_helpers.js").VmLibOption & Record<string, unknown>;
|
|
13
|
-
export declare const to_iso8601: ((datetime: import("../../index.js").VmValue | undefined) => string | null) & import("../_helpers.js").VmLibOption & Record<string, unknown>;
|
|
1
|
+
export declare const to_timestamp: ((datetime: import("../../types/index.js").VmValue | undefined, fallback: import("../../types/index.js").VmValue | undefined) => import("../../types/index.js").VmValue | undefined) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
2
|
+
export declare const to_datetime: ((datetime: import("../../types/index.js").VmValue | undefined, offset: import("../../types/index.js").VmValue | undefined, fallback: import("../../types/index.js").VmValue | undefined) => import("../../types/index.js").VmValue | undefined) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
3
|
+
export declare const to_iso8601: ((datetime: import("../../types/index.js").VmValue | undefined, fallback: import("../../types/index.js").VmValue | undefined) => import("../../types/index.js").VmValue | undefined) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
14
4
|
//# sourceMappingURL=time.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../../src/vm/lib/global/time.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../../src/vm/lib/global/time.ts"],"names":[],"mappings":"AAkCA,eAAO,MAAM,YAAY,sPAgBxB,CAAC;AAEF,eAAO,MAAM,WAAW,kTAsCvB,CAAC;AAEF,eAAO,MAAM,UAAU,sPAgBtB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const to_string: ((data: import("../../index.js").VmValue | undefined) => string) & import("../
|
|
2
|
-
export declare const to_number: ((data: import("../../index.js").VmValue | undefined) => number) & import("../
|
|
3
|
-
export declare const to_boolean: ((data: import("../../index.js").VmValue | undefined) => boolean) & import("../
|
|
4
|
-
export declare const format: ((data: import("../../index.js").VmValue | undefined, format: import("../../index.js").VmValue | undefined) => string) & import("../
|
|
1
|
+
export declare const to_string: ((data: import("../../index.js").VmValue | undefined, fallback: import("../../index.js").VmValue | undefined) => string | number | boolean | import("../../index.js").VmRecord | import("../../index.js").VmArray | import("../../index.js").VmFunction | import("../../index.js").VmModule<Record<string, import("../../index.js").VmImmutable>> | import("../../index.js").VmExtern<object> | null) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
2
|
+
export declare const to_number: ((data: import("../../index.js").VmValue | undefined, fallback: import("../../index.js").VmValue | undefined) => string | number | boolean | import("../../index.js").VmRecord | import("../../index.js").VmArray | import("../../index.js").VmFunction | import("../../index.js").VmModule<Record<string, import("../../index.js").VmImmutable>> | import("../../index.js").VmExtern<object> | null) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
3
|
+
export declare const to_boolean: ((data: import("../../index.js").VmValue | undefined, fallback: import("../../index.js").VmValue | undefined) => string | number | boolean | import("../../index.js").VmRecord | import("../../index.js").VmArray | import("../../index.js").VmFunction | import("../../index.js").VmModule<Record<string, import("../../index.js").VmImmutable>> | import("../../index.js").VmExtern<object> | null) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
4
|
+
export declare const format: ((data: import("../../index.js").VmValue | undefined, format: import("../../index.js").VmValue | undefined) => string) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
5
5
|
//# sourceMappingURL=to-primitive.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-primitive.d.ts","sourceRoot":"","sources":["../../../../src/vm/lib/global/to-primitive.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"to-primitive.d.ts","sourceRoot":"","sources":["../../../../src/vm/lib/global/to-primitive.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,ucAerB,CAAC;AAEF,eAAO,MAAM,SAAS,ucAerB,CAAC;AAEF,eAAO,MAAM,UAAU,ucAetB,CAAC;AAEF,eAAO,MAAM,MAAM,wLAYlB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { VmExtern, VmFunction, VmAny, VmArray, VmValue, VmRecord, VmModule, VmConst, VmFunctionLike, VmFunctionOption } from '../types/index.js';
|
|
2
|
+
/** 抛出异常 */
|
|
3
|
+
export declare function throwError(message: string, recovered: VmAny | (() => VmAny)): never;
|
|
4
|
+
/** 描述参数 */
|
|
5
|
+
type ParamIndex = number | string | null;
|
|
6
|
+
/** 描述参数 */
|
|
7
|
+
export declare function describeParam(name: ParamIndex): string;
|
|
8
|
+
/** 抛出预期外类型异常 */
|
|
9
|
+
export declare function throwUnexpectedTypeError(name: ParamIndex, expected: string, value: VmAny, recovered: VmAny | (() => VmAny)): never;
|
|
10
|
+
/** 抛出预期外类型异常 */
|
|
11
|
+
export declare function throwUnconvertedTypeError(name: ParamIndex, expected: string, value: VmAny, recovered: VmAny | (() => VmAny)): never;
|
|
12
|
+
/** 重新抛出异常 */
|
|
13
|
+
export declare function rethrowError(prefix: string, error: unknown, recovered: VmAny | (() => VmAny)): never;
|
|
14
|
+
/** 标记参数为必须项 */
|
|
15
|
+
export declare function required<const T = VmValue>(name: ParamIndex, value: T | undefined, recovered: VmAny | (() => VmAny)): asserts value is T;
|
|
16
|
+
/** 标记并转换参数为数字 */
|
|
17
|
+
export declare function expectNumber(name: ParamIndex, value: VmAny): number;
|
|
18
|
+
/** 标记并转换参数为数字 */
|
|
19
|
+
export declare function expectNumberRange(name: ParamIndex, value: VmAny, min: number, max: number): number;
|
|
20
|
+
/** 标记并转换参数为整数 */
|
|
21
|
+
export declare function expectIntegerRange(name: ParamIndex, value: VmAny, min: number, max: number): number;
|
|
22
|
+
/** 标记并转换参数为整数 */
|
|
23
|
+
export declare function expectInteger(name: ParamIndex, value: VmAny): number;
|
|
24
|
+
/** 标记并转换参数为布尔值 */
|
|
25
|
+
export declare function expectBoolean(name: ParamIndex, value: VmAny): boolean;
|
|
26
|
+
/** 标记并转换参数为字符串 */
|
|
27
|
+
export declare function expectString(name: ParamIndex, value: VmAny): string;
|
|
28
|
+
/** 标记参数为数组 */
|
|
29
|
+
export declare function expectArray(name: ParamIndex, value: VmAny, recovered: VmAny | (() => VmAny)): asserts value is VmArray;
|
|
30
|
+
/** 标记参数为记录 */
|
|
31
|
+
export declare function expectRecord(name: ParamIndex, value: VmAny, recovered: VmAny | (() => VmAny)): asserts value is VmRecord;
|
|
32
|
+
/** 标记参数为数组或记录 */
|
|
33
|
+
export declare function expectArrayOrRecord(name: ParamIndex, value: VmAny, recovered: VmAny | (() => VmAny)): asserts value is VmArray | VmRecord;
|
|
34
|
+
/** 标记参数为复合类型 */
|
|
35
|
+
export declare function expectCompound(name: ParamIndex, value: VmAny, recovered: VmAny | (() => VmAny)): asserts value is VmArray | VmRecord | VmModule | VmExtern;
|
|
36
|
+
/** 标记参数为常量 */
|
|
37
|
+
export declare function expectConst(name: ParamIndex, value: VmAny, recovered: VmAny | (() => VmAny)): asserts value is VmConst;
|
|
38
|
+
/** 标记为可调用 */
|
|
39
|
+
export declare function expectCallable(name: ParamIndex, value: VmAny, recovered: VmAny | (() => VmAny)): asserts value is VmFunction | VmExtern;
|
|
40
|
+
/** Get numbers from the arguments. */
|
|
41
|
+
export declare function getNumbers(args: readonly VmAny[]): number[];
|
|
42
|
+
/** 将值转为数组长度 */
|
|
43
|
+
export declare function arrayLen(len: number | null | undefined): number;
|
|
44
|
+
/** 应用映射函数 */
|
|
45
|
+
export declare function map(data: VmConst, mapper: (value: VmConst, index: number | string | null, data: VmConst) => VmConst | undefined): VmConst;
|
|
46
|
+
/** 库函数选项 */
|
|
47
|
+
export type VmLibOption = Pick<VmFunctionOption, 'summary' | 'params' | 'paramsType' | 'returns' | 'returnsType' | 'examples'>;
|
|
48
|
+
/** 库函数 */
|
|
49
|
+
export type VmLib<T extends VmFunctionLike = VmFunctionLike> = T & VmLibOption;
|
|
50
|
+
/** 创建库函数 */
|
|
51
|
+
export declare function VmLib<T extends VmFunctionLike, P extends Record<string, unknown>>(fn: T, option: VmLibOption, properties?: P): VmLib<T> & P;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/vm/lib/helpers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,QAAQ,EACR,UAAU,EACV,KAAK,EACL,OAAO,EACP,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AE,OAAO,CAAC,EAC7E,EAAE,EAAE,CAAC,EACL,MAAM,EAAE,WAAW,EACnB,UAAU,CAAC,EAAE,CAAC,GACf,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAcd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vm/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAcvC,eAAO,MAAM,GAAG,2DAA2D,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { VmFunction, VmModule, type VmConst, type VmFunctionLike } from '../types/index.js';
|
|
2
|
-
import type { VmLib } from './
|
|
3
|
-
import * as global from './global/index.js';
|
|
2
|
+
import type { VmLib } from './helpers.js';
|
|
4
3
|
/** 原始值 */
|
|
5
|
-
type RawValue = VmLib | VmConst | VmModule;
|
|
4
|
+
export type RawValue = VmLib | VmConst | VmModule;
|
|
6
5
|
/** 包装值 */
|
|
7
6
|
type ToWrappedValue<V extends RawValue> = V extends VmFunctionLike ? VmFunction<V> : V;
|
|
7
|
+
/** 包装值 */
|
|
8
|
+
export declare function wrapEntry<const T extends RawValue>(name: string, value: T, module: string): ToWrappedValue<T>;
|
|
8
9
|
/** 创建模块 */
|
|
9
10
|
export type ToWrappedModule<T extends Record<string, RawValue>> = VmModule<{
|
|
10
11
|
[key in keyof T]: ToWrappedValue<T[key]>;
|
|
11
12
|
}>;
|
|
12
13
|
/** 创建模块 */
|
|
13
14
|
export declare function createModule<const T extends Record<string, RawValue>>(name: string, lib: T): ToWrappedModule<T>;
|
|
14
|
-
export declare const lib: typeof global;
|
|
15
15
|
export {};
|
|
16
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/vm/lib/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,OAAO,EAAE,KAAK,cAAc,EAAoB,MAAM,mBAAmB,CAAC;AAG9G,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,cAAc,CAAC;AAEvD,UAAU;AACV,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAClD,UAAU;AACV,KAAK,cAAc,CAAC,CAAC,SAAS,QAAQ,IAAI,CAAC,SAAS,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACvF,UAAU;AACV,wBAAgB,SAAS,CAAC,KAAK,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAkB7G;AAED,WAAW;AACX,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,QAAQ,CAAC;KACtE,GAAG,IAAI,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAC3C,CAAC,CAAC;AAEH,WAAW;AACX,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAM/G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/vm/lib/mod/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type VmArray, type VmConst, type VmValue } from '../../types/index.js';
|
|
2
|
+
export declare const size: ((matrix: VmValue | undefined) => [] | [number, number] | [number]) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
3
|
+
export declare const transpose: ((matrix: VmValue | undefined) => string | number | boolean | import("../../types/index.js").VmRecord | VmArray | import("../../types/function.js").VmFunction | import("../../types/module.js").VmModule<Record<string, import("../../types/index.js").VmImmutable>> | import("../../types/extern.js").VmExtern<object> | null) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
4
|
+
export declare const entrywise: ((a: VmValue | undefined, b: VmValue | undefined, f: VmValue | undefined) => VmConst) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
5
|
+
export declare const add: ((a: VmValue | undefined, b: VmValue | undefined) => VmConst) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
6
|
+
export declare const subtract: ((a: VmValue | undefined, b: VmValue | undefined) => VmConst) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
7
|
+
export declare const entrywise_multiply: ((a: VmValue | undefined, b: VmValue | undefined) => VmConst) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
8
|
+
export declare const entrywise_divide: ((a: VmValue | undefined, b: VmValue | undefined) => VmConst) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
9
|
+
export declare const multiply: ((a: VmValue | undefined, b: VmValue | undefined) => VmConst) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
10
|
+
export declare const invert: ((a: VmValue | undefined) => VmConst) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
11
|
+
export declare const zeros: ((...size: readonly (VmValue | undefined)[]) => VmArray) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
12
|
+
export declare const ones: ((...size: readonly (VmValue | undefined)[]) => VmArray) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
13
|
+
export declare const identity: ((...size: readonly (VmValue | undefined)[]) => number[][]) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
14
|
+
export declare const diagonal: ((x: VmValue | undefined, k?: VmValue | undefined) => VmConst[]) & import("../helpers.js").VmLibOption & Record<string, unknown>;
|
|
15
|
+
//# sourceMappingURL=matrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../../../../src/vm/lib/mod/matrix.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoC,KAAK,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAsClH,eAAO,MAAM,IAAI,qIAYhB,CAAC;AAEF,eAAO,MAAM,SAAS,kYA0BrB,CAAC;AA8HF,eAAO,MAAM,SAAS,uJAmBrB,CAAC;AAEF,eAAO,MAAM,GAAG,+HAaf,CAAC;AAEF,eAAO,MAAM,QAAQ,+HAapB,CAAC;AAEF,eAAO,MAAM,kBAAkB,+HAa9B,CAAC;AAEF,eAAO,MAAM,gBAAgB,+HAa5B,CAAC;AAEF,eAAO,MAAM,QAAQ,+HAiEpB,CAAC;AAEF,eAAO,MAAM,MAAM,uGAsHlB,CAAC;AAkBF,eAAO,MAAM,KAAK,0HAMhB,CAAC;AAEH,eAAO,MAAM,IAAI,0HAMf,CAAC;AAEH,eAAO,MAAM,QAAQ,6HA0BpB,CAAC;AAEF,eAAO,MAAM,QAAQ,kIA4CpB,CAAC"}
|
package/dist/vm/operations.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TypeName, VmAny, VmRecord, VmValue, VmArray, VmConst } from './types/index.js';
|
|
2
2
|
export declare const $Add: (a: VmAny, b: VmAny) => number;
|
|
3
3
|
export declare const $Sub: (a: VmAny, b: VmAny) => number;
|
|
4
4
|
export declare const $Mul: (a: VmAny, b: VmAny) => number;
|
|
@@ -18,7 +18,7 @@ export declare const $Naeq: (a: VmAny, b: VmAny) => boolean;
|
|
|
18
18
|
export declare const $Same: (a: VmAny, b: VmAny) => boolean;
|
|
19
19
|
export declare const $Nsame: (a: VmAny, b: VmAny) => boolean;
|
|
20
20
|
export declare const $In: (value: VmAny, iterable: VmAny) => boolean;
|
|
21
|
-
export declare const $Concat: (...args: string[]) => string;
|
|
21
|
+
export declare const $Concat: (...args: readonly string[]) => string;
|
|
22
22
|
export declare const $Pos: (a: VmAny) => number;
|
|
23
23
|
export declare const $Neg: (a: VmAny) => number;
|
|
24
24
|
export declare const $Not: (a: VmAny) => boolean;
|
|
@@ -31,8 +31,6 @@ export declare const $AssertInit: (value: VmAny) => asserts value is VmValue;
|
|
|
31
31
|
export declare const $Call: (func: VmValue, args: readonly VmAny[]) => VmValue;
|
|
32
32
|
export declare const $Type: (value: VmAny) => TypeName;
|
|
33
33
|
export declare const $ToBoolean: (value: VmAny) => boolean;
|
|
34
|
-
/** 将值转为字符串 */
|
|
35
|
-
export declare function $InnerToString(value: VmAny, useBraces: boolean): string;
|
|
36
34
|
export declare const $ToString: (value: VmAny) => string;
|
|
37
35
|
export declare const $ToNumber: (value: VmAny) => number;
|
|
38
36
|
export declare const $IsBoolean: (value: VmAny) => value is boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/vm/operations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/vm/operations.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAe,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AA4D1G,eAAO,MAAM,IAAI,GAAI,GAAG,KAAK,EAAE,GAAG,KAAK,KAAG,MAEzC,CAAC;AACF,eAAO,MAAM,IAAI,GAAI,GAAG,KAAK,EAAE,GAAG,KAAK,KAAG,MAEzC,CAAC;AACF,eAAO,MAAM,IAAI,GAAI,GAAG,KAAK,EAAE,GAAG,KAAK,KAAG,MAEzC,CAAC;AACF,eAAO,MAAM,IAAI,GAAI,GAAG,KAAK,EAAE,GAA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OAAO,KAAK,KAAG,KAAK,IAAI,MAGjD,CAAC;AACF,eAAO,MAAM,SAAS,GAAI,OAAO,KAAK,KAAG,KAAK,IAAI,MAGjD,CAAC;AACF,eAAO,MAAM,SAAS,GAAI,OAAO,KAAK,KAAG,KAAK,IAAI,QAGjD,CAAC;AACF,eAAO,MAAM,QAAQ,GAAI,OAAO,KAAK,KAAG,KAAK,IAAI,OAGhD,CAAC;AACF,eAAO,MAAM,aAAa,GAAI,OAAO,KAAK,KAAG,QAAQ,KAAK,IAAI,WAAW,CAAC,OAAO,CAIhF,CAAC;AACF,eAAO,MAAM,IAAI,GAAI,KAAK,KAAK,EAAE,KAAK,KAAK,KAAG,OAM7C,CAAC;AACF,eAAO,MAAM,IAAI,GAAI,KAAK,KAAK,EAAE,KAAK,KAAK,KAAG,OAY7C,CAAC;AACF,eAAO,MAAM,IAAI,GAAI,KAAK,KAAK,EAAE,KAAK,KAAK,EAAE,OAAO,KAAK,KAAG,IAO3D,CAAC;AACF,eAAO,MAAM,SAAS,GAAI,OAAO,KAAK,KAAG,QAAQ,CAAC,OAAO,GAAG,SAAS,CAMpE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,KAAK,KAAG,QAAQ,GAAG,IAwBxD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,KAAK,KAAG,QAAQ,CAAC,OAAO,GAAG,SAAS,CAiBvE,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,OAAO,KAAK,EAAE,QAAQ,KAAK,KAAG,MAIrD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { VmFunctionLike, VmFunction } from './function.js';
|
|
2
2
|
import { VmExtern } from './extern.js';
|
|
3
3
|
import type { VmAny, VmConst, VmPrimitive, VmValue } from './index.js';
|
|
4
4
|
/** 创建 Mirascript 函数在宿主语言运行的代理 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../../src/vm/types/boundary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../../src/vm/types/boundary.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAY,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGjF,iCAAiC;AACjC,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAmBhF;AAED,iCAAiC;AACjC,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAO9F;AAED,+BAA+B;AAC/B,wBAAgB,aAAa,CACzB,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,QAAQ,GAAG,IAAW,EAC/B,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,GACtE,OAAO,CA0BT;AAED,+BAA+B;AAC/B,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAiBvD"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { kVmContext } from '../../helpers/constants.js';
|
|
2
|
+
import type { lib } from '../lib/index.js';
|
|
3
|
+
import type { VmAny, VmImmutable, VmValue, VmFunctionLike, VmModule } from './index.js';
|
|
4
|
+
import { VmFunction } from './function.js';
|
|
5
|
+
/** 全局导入的标准库值 */
|
|
6
|
+
type ToLibValue<V> = V extends VmFunctionLike ? VmFunction<V> : V extends Record<string, VmImmutable | VmFunctionLike> ? ToLibModule<V> : V;
|
|
5
7
|
/** 全局导入的标准库值 */
|
|
6
|
-
type
|
|
8
|
+
type ToLibModule<V extends Record<string, VmImmutable | VmFunctionLike>> = VmModule<{
|
|
9
|
+
[key in keyof V]: ToLibValue<V[key]>;
|
|
10
|
+
}>;
|
|
7
11
|
/** 全局导入的标准库 */
|
|
8
12
|
type VmContextBase = {
|
|
9
|
-
[key in
|
|
13
|
+
[key in keyof typeof lib]: ToLibValue<(typeof lib)[key]>;
|
|
10
14
|
};
|
|
11
|
-
declare const kVmContext: unique symbol;
|
|
12
15
|
/** MiraScript 执行上下文的基础,仅包含标准库 */
|
|
13
16
|
export type VmSharedContext = VmContextBase & Record<string, VmImmutable>;
|
|
14
17
|
/** MiraScript 执行上下文 */
|
|
@@ -50,7 +53,5 @@ type CreateVmContextWithFactory = readonly [
|
|
|
50
53
|
];
|
|
51
54
|
/** 创建用于执行脚本的执行上下文 */
|
|
52
55
|
export declare function createVmContext(...args: CreateVmContextWithValues | CreateVmContextWithFactory): VmContext;
|
|
53
|
-
/** 检查是否为执行上下文 */
|
|
54
|
-
export declare function isVmContext(context: unknown): context is VmContext;
|
|
55
56
|
export {};
|
|
56
57
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/vm/types/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/vm/types/context.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAExF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE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OAAO,GAAG,SAAS,CAAC,CAAC;AACvE,eAAO,MAAM,eAAe,EAAmB,eAAe,CAAC;AAS/D,qCAAqC;AACrC,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,EAClD,QAAQ,UAAQ,GACjB,IAAI,CAaN;AAED,aAAa;AACb,eAAO,MAAM,gBAAgB,EAAE,SAiB7B,CAAC;AAsDH,eAAe;AACf,KAAK,yBAAyB,GAAG,SAAS;IACtC,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,GAAG,SAAS;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS;IACzD,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS;CACvE,CAAC;AACF,kBAAkB;AAClB,KAAK,0BAA0B,GAAG,SAAS;IACvC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS;IAC5C,UAAU,CAAC,EAAE,CAAC,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS;IACxD,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS;CACvE,CAAC;AAEF,qBAAqB;AACrB,wBAAgB,eAAe,CAAC,GAAG,IAAI,EAAE,yBAAyB,GAAG,0BAA0B,GAAG,SAAS,CAwB1G"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VmWrapper } from './wrapper.js';
|
|
2
1
|
import type { TypeName, VmAny, VmConst, VmPrimitive, VmValue } from './index.js';
|
|
2
|
+
import { VmWrapper } from './wrapper.js';
|
|
3
3
|
/** 包装 Mirascript `extern` 类型的对象 */
|
|
4
4
|
export declare class VmExtern<const T extends object = object> extends VmWrapper<T> {
|
|
5
5
|
readonly thisArg: T extends (...args: readonly never[]) => unknown ? VmExtern | null : null;
|
|
@@ -27,6 +27,4 @@ export declare class VmExtern<const T extends object = object> extends VmWrapper
|
|
|
27
27
|
/** @inheritdoc */
|
|
28
28
|
get describe(): string;
|
|
29
29
|
}
|
|
30
|
-
/** 检查值是否为 Mirascript 外部值 */
|
|
31
|
-
export declare function isVmExtern<T extends object>(value: unknown): value is VmExtern<T>;
|
|
32
30
|
//# sourceMappingURL=extern.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extern.d.ts","sourceRoot":"","sources":["../../../src/vm/types/extern.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extern.d.ts","sourceRoot":"","sources":["../../../src/vm/types/extern.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAUzC,mCAAmC;AACnC,qBAAa,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAGnE,QAAQ,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,SAAS,KAAK,EAAE,KAAK,OAAO,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI;gBAD3F,KAAK,EAAE,CAAC,EACC,OAAO,GAAE,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,SAAS,KAAK,EAAE,KAAK,OAAO,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAW;IAKtG,yCAAyC;IACzC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO;IAiBrD,kBAAkB;IAClB,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,KAAK,IAAI,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC;IAIxG,kBAAkB;IACT,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAGlC,kBAAkB;IACT,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK;IAKhC,mCAAmC;IACnC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO;IAMzC,wBAAwB;IACxB,IAAI,CAAC,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,KAAK;IAerC,kBAAkB;IACT,IAAI,IAAI,MAAM,EAAE;IAOzB,kBAAkB;IACT,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAIpC,kBAAkB;IACT,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM;IAiB7C,kBAAkB;IAClB,IAAa,IAAI,IAAI,QAAQ,CAE5B;IACD,kBAAkB;IAClB,IAAa,QAAQ,IAAI,MAAM,CAqC9B;CACJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { kVmFunction } from '../../helpers/constants.js';
|
|
1
2
|
import type { VmAny, VmValue } from './index.js';
|
|
2
|
-
declare const kVmFunction: unique symbol;
|
|
3
3
|
/**
|
|
4
4
|
* Mirascript 函数签名
|
|
5
5
|
*
|
|
@@ -35,11 +35,6 @@ export interface VmFunctionInfo {
|
|
|
35
35
|
export type VmFunctionOption = Partial<Omit<VmFunctionInfo, 'original'> & {
|
|
36
36
|
readonly injectCp: boolean;
|
|
37
37
|
}>;
|
|
38
|
-
/** 检查是否为 Mirascript 函数 */
|
|
39
|
-
export declare function isVmFunction<T extends VmFunctionLike>(value: unknown): value is VmFunction<T>;
|
|
40
|
-
/** 检查是否为 Mirascript 函数,并获取其信息 */
|
|
41
|
-
export declare function getVmFunctionInfo(value: unknown): VmFunctionInfo | undefined;
|
|
42
38
|
/** 创建 Mirascript 函数 */
|
|
43
39
|
export declare function VmFunction<T extends VmFunctionLike>(fn: T, option?: VmFunctionOption): VmFunction<T>;
|
|
44
|
-
export {};
|
|
45
40
|
//# sourceMappingURL=function.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/vm/types/function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/vm/types/function.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAA8B,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIjD;;;;GAIG;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,EAAE,aAAa,CAAC,OAAO,GAAG,SAAS,CAAC,KAAK,KAAK,GAAG,IAAI,CAAC;AAE3F,oBAAoB;AACpB,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,CAAC,WAAW,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC;AAEnH,sBAAsB;AACtB,MAAM,WAAW,cAAc;IAC3B,WAAW;IACX,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,aAAa;IACb,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,YAAY;IACZ,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY;IACZ,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,YAAY;IACZ,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,YAAY;IACZ,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY;IACZ,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY;IACZ,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,oBAAoB;IACpB,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;CACtC;AAED,wBAAwB;AACxB,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAClC,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,GAAG;IAC/B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC9B,CACJ,CAAC;AAEF,uBAAuB;AACvB,wBAAgB,UAAU,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,GAAE,gBAAqB,GAAG,UAAU,CAAC,CAAC,CAAC,CAqCxG"}
|
package/dist/vm/types/index.d.ts
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
import type { VmArray } from './array.js';
|
|
2
1
|
import type { VmExtern } from './extern.js';
|
|
3
2
|
import type { VmFunction } from './function.js';
|
|
4
3
|
import type { VmModule } from './module.js';
|
|
5
|
-
import type { VmRecord } from './record.js';
|
|
6
4
|
/** 类型名称 */
|
|
7
5
|
export type TypeName = keyof VmValueMap;
|
|
6
|
+
/** Mirascript 虚拟机内的未初始化变量 */
|
|
7
|
+
export type VmUninitialized = undefined;
|
|
8
|
+
/** Mirascript 原始值 */
|
|
9
|
+
export type VmPrimitive = null | number | string | boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Mirascript 数组
|
|
12
|
+
* 数组中的 `undefined`、`null` 及 <empty slot> 均视作 `nil`
|
|
13
|
+
*/
|
|
14
|
+
export type VmArray = ReadonlyArray<VmConst | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* Mirascript 记录
|
|
17
|
+
* 仅拥有且可枚举的字符串键视作存在
|
|
18
|
+
* 字段值 `undefined` 和 `null` 均视作 `nil`
|
|
19
|
+
*/
|
|
20
|
+
export type VmRecord = {
|
|
21
|
+
readonly [key: string]: VmConst | undefined;
|
|
22
|
+
};
|
|
23
|
+
/** Mirascript 虚拟机内的值语义值 */
|
|
24
|
+
export type VmConst = VmPrimitive | VmRecord | VmArray;
|
|
25
|
+
/** Mirascript 虚拟机内的不可变值 */
|
|
26
|
+
export type VmImmutable = VmConst | VmFunction | VmModule;
|
|
27
|
+
/** Mirascript 虚拟机内的合法值 */
|
|
28
|
+
export type VmValue = VmImmutable | VmExtern;
|
|
29
|
+
/** Mirascript 虚拟机内的值(包括未初始化变量) */
|
|
30
|
+
export type VmAny = VmValue | VmUninitialized;
|
|
8
31
|
/** 类型名称映射 */
|
|
9
32
|
export interface VmValueMap {
|
|
10
33
|
/** 空值 */
|
|
@@ -26,19 +49,10 @@ export interface VmValueMap {
|
|
|
26
49
|
/** Mirascript 模块 */
|
|
27
50
|
module: VmModule;
|
|
28
51
|
}
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export { type
|
|
32
|
-
export {
|
|
33
|
-
export { type
|
|
34
|
-
export {
|
|
35
|
-
export { type VmPrimitive, isVmPrimitive } from './primitive.js';
|
|
36
|
-
export { type VmConst, isVmConst } from './const.js';
|
|
37
|
-
export { type VmImmutable, isVmImmutable } from './immutable.js';
|
|
38
|
-
export { VmExtern, isVmExtern } from './extern.js';
|
|
39
|
-
export { VmFunction, isVmFunction, getVmFunctionInfo, type VmFunctionInfo, type VmFunctionLike, type VmFunctionOption, } from './function.js';
|
|
40
|
-
export { VmModule, isVmModule } from './module.js';
|
|
41
|
-
export { isVmWrapper } from './wrapper.js';
|
|
42
|
-
export { type VmValue, isVmValue } from './value.js';
|
|
43
|
-
export { type VmAny, type VmUninitialized, isVmAny } from './any.js';
|
|
52
|
+
export { isVmAny, isVmArray, isVmArrayLikeRecord, isVmArrayLikeRecordByEntires, isVmArrayLikeRecordByKeys, isVmCallable, isVmConst, isVmContext, isVmExtern, isVmFunction, isVmImmutable, isVmModule, isVmPrimitive, isVmRecord, isVmScript, isVmValue, isVmWrapper, getVmFunctionInfo, } from '../../helpers/types.js';
|
|
53
|
+
export { wrapToVmValue, unwrapFromVmValue } from './boundary.js';
|
|
54
|
+
export { type VmContext, type VmSharedContext, defineVmContextValue, createVmContext } from './context.js';
|
|
55
|
+
export { VmExtern } from './extern.js';
|
|
56
|
+
export { VmFunction, type VmFunctionInfo, type VmFunctionLike, type VmFunctionOption } from './function.js';
|
|
57
|
+
export { VmModule } from './module.js';
|
|
44
58
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vm/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vm/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,WAAW;AACX,MAAM,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC;AAExC,6BAA6B;AAC7B,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC;AACxC,qBAAqB;AACrB,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAC3D;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;AACzD;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG;IACnB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAC/C,CAAC;AACF,2BAA2B;AAC3B,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AACvD,2BAA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,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { TypeName, VmAny,
|
|
1
|
+
import type { TypeName, VmAny, VmImmutable } from './index.js';
|
|
2
2
|
import { VmWrapper } from './wrapper.js';
|
|
3
3
|
/** Mirascript 模块 */
|
|
4
|
-
export declare class VmModule<const T extends Record<string,
|
|
4
|
+
export declare class VmModule<const T extends Record<string, VmImmutable> = Record<string, VmImmutable>> extends VmWrapper<T> {
|
|
5
5
|
/** 模块名称 */
|
|
6
6
|
readonly name: string;
|
|
7
7
|
constructor(
|
|
@@ -22,6 +22,4 @@ export declare class VmModule<const T extends Record<string, VmValue> = Record<s
|
|
|
22
22
|
/** @inheritdoc */
|
|
23
23
|
get describe(): string;
|
|
24
24
|
}
|
|
25
|
-
/** 检查值是否为 Mirascript 模块 */
|
|
26
|
-
export declare function isVmModule<T extends Record<string, VmValue>>(value: unknown): value is VmModule<T>;
|
|
27
25
|
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/vm/types/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/vm/types/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,oBAAoB;AACpB,qBAAa,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAE7G,WAAW;IACX,QAAQ,CAAC,IAAI,EAAE,MAAM;;IADrB,WAAW;IACF,IAAI,EAAE,MAAM;IACrB,WAAW;IACX,KAAK,EAAE,CAAC;IAIZ,kBAAkB;IACT,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAGlC,kBAAkB;IACT,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK;IAIhC,kBAAkB;IACT,IAAI,IAAI,MAAM,EAAE;IAGzB,kBAAkB;IACT,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAGpC,kBAAkB;IAClB,IAAa,IAAI,IAAI,QAAQ,CAE5B;IACD,kBAAkB;IAClB,IAAa,QAAQ,IAAI,MAAM,CAE9B;CACJ"}
|
|
@@ -22,6 +22,4 @@ export declare abstract class VmWrapper<T extends object> {
|
|
|
22
22
|
/** 转为字符串 */
|
|
23
23
|
toString(useBraces: boolean): string;
|
|
24
24
|
}
|
|
25
|
-
/** 检查值是否为 MiraScript 包装器 */
|
|
26
|
-
export declare function isVmWrapper<T extends object>(value: unknown): value is VmWrapper<T>;
|
|
27
25
|
//# sourceMappingURL=wrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../src/vm/types/wrapper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../src/vm/types/wrapper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAElD;;GAEG;AACH,8BAAsB,SAAS,CAAC,CAAC,SAAS,MAAM;IAChC,QAAQ,CAAC,KAAK,EAAE,CAAC;gBAAR,KAAK,EAAE,CAAC;IAC7B,cAAc;IACd,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAClC,cAAc;IACd,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK;IAChC,WAAW;IACX,QAAQ,CAAC,IAAI,IAAI,MAAM,EAAE;IACzB,aAAa;IACb,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IACpC,WAAW;IACX,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC;IAC9B,WAAW;IACX,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC;IAChC,iCAAiC;IACjC,MAAM,IAAI,SAAS;IAGnB,YAAY;IACZ,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM;CAKvC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirascript/mirascript",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"author": "CloudPSS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "An expression based scripting language.",
|
|
@@ -20,9 +20,11 @@
|
|
|
20
20
|
"./cli": {
|
|
21
21
|
"@mirascript/dev": "./src/cli/index.ts",
|
|
22
22
|
"default": "./dist/cli/index.js"
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
24
25
|
},
|
|
25
26
|
"imports": {
|
|
27
|
+
"#package.json": "./package.json",
|
|
26
28
|
"#compiler/worker": {
|
|
27
29
|
"@mirascript/dev": "./src/compiler/worker.ts",
|
|
28
30
|
"default": "./dist/compiler/worker.js"
|
|
@@ -34,13 +36,14 @@
|
|
|
34
36
|
"commander": "^14.0.2",
|
|
35
37
|
"source-map-js": "^1.2.1",
|
|
36
38
|
"supports-color": "^10.2.2",
|
|
37
|
-
"@mirascript/bindings": "~0.1.
|
|
39
|
+
"@mirascript/bindings": "~0.1.16"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
40
42
|
"@types/node": "^24.10.1",
|
|
41
43
|
"@types/sinon": "^21.0.0",
|
|
42
44
|
"ava": "^6.4.1",
|
|
43
45
|
"c8": "^10.1.3",
|
|
46
|
+
"madge": "^8.0.0",
|
|
44
47
|
"sinon": "^21.0.0",
|
|
45
48
|
"type-fest": "^5.2.0"
|
|
46
49
|
},
|
|
@@ -49,6 +52,7 @@
|
|
|
49
52
|
"build:ts": "pnpm clean && tsc",
|
|
50
53
|
"build": "pnpm build:ts --emitDeclarationOnly && node ./esbuild.config.js",
|
|
51
54
|
"mirascript": "node --enable-source-maps ./dist/cli/index.js",
|
|
55
|
+
"deps": "madge --circular --warning ./src",
|
|
52
56
|
"clean": "rimraf dist",
|
|
53
57
|
"test": "c8 ava"
|
|
54
58
|
}
|
package/src/cli/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { readFile, stat } from 'node:fs/promises';
|
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import { InvalidArgumentError, program } from '@commander-js/extra-typings';
|
|
6
6
|
import { execute } from './execute.js';
|
|
7
|
-
import pkg from '
|
|
7
|
+
import pkg from '#package.json' with { type: 'json' };
|
|
8
8
|
import { compileSync } from '../compiler/index.js';
|
|
9
9
|
import { configCheckpoint, type VmValue } from '../vm/index.js';
|
|
10
10
|
|
|
@@ -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 });
|