@mirascript/mirascript 0.1.0
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-5FQWUJIY.js +766 -0
- package/dist/chunk-5FQWUJIY.js.map +6 -0
- package/dist/chunk-BTDGMWFK.js +202 -0
- package/dist/chunk-BTDGMWFK.js.map +6 -0
- package/dist/chunk-DCXIWIW5.js +3419 -0
- package/dist/chunk-DCXIWIW5.js.map +6 -0
- package/dist/chunk-RAPJ3XLV.js +10 -0
- package/dist/chunk-RAPJ3XLV.js.map +6 -0
- package/dist/cli/execute.d.ts +4 -0
- package/dist/cli/execute.d.ts.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +191 -0
- package/dist/cli/index.js.map +6 -0
- package/dist/cli/print.d.ts +4 -0
- package/dist/cli/print.d.ts.map +1 -0
- package/dist/compiler/compile-bytecode.d.ts +12 -0
- package/dist/compiler/compile-bytecode.d.ts.map +1 -0
- package/dist/compiler/compile-fast.d.ts +7 -0
- package/dist/compiler/compile-fast.d.ts.map +1 -0
- package/dist/compiler/create-script.d.ts +7 -0
- package/dist/compiler/create-script.d.ts.map +1 -0
- package/dist/compiler/diagnostic.d.ts +56 -0
- package/dist/compiler/diagnostic.d.ts.map +1 -0
- package/dist/compiler/emit.d.ts +4 -0
- package/dist/compiler/emit.d.ts.map +1 -0
- package/dist/compiler/index.d.ts +13 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/types.d.ts +16 -0
- package/dist/compiler/types.d.ts.map +1 -0
- package/dist/compiler/worker-manager.d.ts +6 -0
- package/dist/compiler/worker-manager.d.ts.map +1 -0
- package/dist/compiler/worker.d.ts +6 -0
- package/dist/compiler/worker.d.ts.map +1 -0
- package/dist/compiler/worker.js +34 -0
- package/dist/compiler/worker.js.map +6 -0
- package/dist/helpers/constants.d.ts +3 -0
- package/dist/helpers/constants.d.ts.map +1 -0
- package/dist/helpers/serialize.d.ts +45 -0
- package/dist/helpers/serialize.d.ts.map +1 -0
- package/dist/helpers/utils.d.ts +36 -0
- package/dist/helpers/utils.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +6 -0
- package/dist/subtle.d.ts +7 -0
- package/dist/subtle.d.ts.map +1 -0
- package/dist/subtle.js +30 -0
- package/dist/subtle.js.map +6 -0
- package/dist/vm/env.d.ts +3 -0
- package/dist/vm/env.d.ts.map +1 -0
- package/dist/vm/error.d.ts +11 -0
- package/dist/vm/error.d.ts.map +1 -0
- package/dist/vm/helpers.d.ts +21 -0
- package/dist/vm/helpers.d.ts.map +1 -0
- package/dist/vm/index.d.ts +5 -0
- package/dist/vm/index.d.ts.map +1 -0
- package/dist/vm/lib/_helpers.d.ts +35 -0
- package/dist/vm/lib/_helpers.d.ts.map +1 -0
- package/dist/vm/lib/_loader.d.ts +16 -0
- package/dist/vm/lib/_loader.d.ts.map +1 -0
- package/dist/vm/lib/global/bit.d.ts +9 -0
- package/dist/vm/lib/global/bit.d.ts.map +1 -0
- package/dist/vm/lib/global/debug.d.ts +5 -0
- package/dist/vm/lib/global/debug.d.ts.map +1 -0
- package/dist/vm/lib/global/index.d.ts +10 -0
- package/dist/vm/lib/global/index.d.ts.map +1 -0
- package/dist/vm/lib/global/json.d.ts +4 -0
- package/dist/vm/lib/global/json.d.ts.map +1 -0
- package/dist/vm/lib/global/math-additional.d.ts +3 -0
- package/dist/vm/lib/global/math-additional.d.ts.map +1 -0
- package/dist/vm/lib/global/math-arr.d.ts +8 -0
- package/dist/vm/lib/global/math-arr.d.ts.map +1 -0
- package/dist/vm/lib/global/math-const.d.ts +3 -0
- package/dist/vm/lib/global/math-const.d.ts.map +1 -0
- package/dist/vm/lib/global/math-unary.d.ts +29 -0
- package/dist/vm/lib/global/math-unary.d.ts.map +1 -0
- package/dist/vm/lib/global/math.d.ts +9 -0
- package/dist/vm/lib/global/math.d.ts.map +1 -0
- package/dist/vm/lib/global/mod/index.d.ts +3 -0
- package/dist/vm/lib/global/mod/index.d.ts.map +1 -0
- package/dist/vm/lib/global/mod/matrix.d.ts +16 -0
- package/dist/vm/lib/global/mod/matrix.d.ts.map +1 -0
- package/dist/vm/lib/global/sequence/all-any.d.ts +4 -0
- package/dist/vm/lib/global/sequence/all-any.d.ts.map +1 -0
- package/dist/vm/lib/global/sequence/entries.d.ts +12 -0
- package/dist/vm/lib/global/sequence/entries.d.ts.map +1 -0
- package/dist/vm/lib/global/sequence/find.d.ts +10 -0
- package/dist/vm/lib/global/sequence/find.d.ts.map +1 -0
- package/dist/vm/lib/global/sequence/flatten.d.ts +3 -0
- package/dist/vm/lib/global/sequence/flatten.d.ts.map +1 -0
- package/dist/vm/lib/global/sequence/index.d.ts +12 -0
- package/dist/vm/lib/global/sequence/index.d.ts.map +1 -0
- package/dist/vm/lib/global/sequence/len.d.ts +3 -0
- package/dist/vm/lib/global/sequence/len.d.ts.map +1 -0
- package/dist/vm/lib/global/sequence/map-filter.d.ts +9 -0
- package/dist/vm/lib/global/sequence/map-filter.d.ts.map +1 -0
- package/dist/vm/lib/global/sequence/repeat.d.ts +4 -0
- package/dist/vm/lib/global/sequence/repeat.d.ts.map +1 -0
- package/dist/vm/lib/global/sequence/reverse.d.ts +3 -0
- package/dist/vm/lib/global/sequence/reverse.d.ts.map +1 -0
- package/dist/vm/lib/global/sequence/sort.d.ts +5 -0
- package/dist/vm/lib/global/sequence/sort.d.ts.map +1 -0
- package/dist/vm/lib/global/sequence/with.d.ts +5 -0
- package/dist/vm/lib/global/sequence/with.d.ts.map +1 -0
- package/dist/vm/lib/global/sequence/zip.d.ts +4 -0
- package/dist/vm/lib/global/sequence/zip.d.ts.map +1 -0
- package/dist/vm/lib/global/string.d.ts +12 -0
- package/dist/vm/lib/global/string.d.ts.map +1 -0
- package/dist/vm/lib/global/time.d.ts +15 -0
- package/dist/vm/lib/global/time.d.ts.map +1 -0
- package/dist/vm/lib/global/to-primitive.d.ts +6 -0
- package/dist/vm/lib/global/to-primitive.d.ts.map +1 -0
- package/dist/vm/operations.d.ts +49 -0
- package/dist/vm/operations.d.ts.map +1 -0
- package/dist/vm/types/checker.d.ts +30 -0
- package/dist/vm/types/checker.d.ts.map +1 -0
- package/dist/vm/types/context.d.ts +43 -0
- package/dist/vm/types/context.d.ts.map +1 -0
- package/dist/vm/types/extern.d.ts +32 -0
- package/dist/vm/types/extern.d.ts.map +1 -0
- package/dist/vm/types/function.d.ts +49 -0
- package/dist/vm/types/function.d.ts.map +1 -0
- package/dist/vm/types/index.d.ts +75 -0
- package/dist/vm/types/index.d.ts.map +1 -0
- package/dist/vm/types/module.d.ts +25 -0
- package/dist/vm/types/module.d.ts.map +1 -0
- package/dist/vm/types/script.d.ts +14 -0
- package/dist/vm/types/script.d.ts.map +1 -0
- package/dist/vm/types/wrapper.d.ts +25 -0
- package/dist/vm/types/wrapper.d.ts.map +1 -0
- package/package.json +55 -0
- package/src/cli/execute.ts +32 -0
- package/src/cli/index.ts +73 -0
- package/src/cli/print.ts +41 -0
- package/src/compiler/compile-bytecode.ts +65 -0
- package/src/compiler/compile-fast.ts +81 -0
- package/src/compiler/create-script.ts +34 -0
- package/src/compiler/diagnostic.ts +175 -0
- package/src/compiler/emit.ts +764 -0
- package/src/compiler/index.ts +67 -0
- package/src/compiler/types.ts +16 -0
- package/src/compiler/worker-manager.ts +60 -0
- package/src/compiler/worker.ts +37 -0
- package/src/helpers/constants.ts +3 -0
- package/src/helpers/serialize.ts +280 -0
- package/src/helpers/utils.ts +16 -0
- package/src/index.ts +3 -0
- package/src/subtle.ts +6 -0
- package/src/vm/env.ts +16 -0
- package/src/vm/error.ts +22 -0
- package/src/vm/helpers.ts +121 -0
- package/src/vm/index.ts +5 -0
- package/src/vm/lib/_helpers.ts +215 -0
- package/src/vm/lib/_loader.ts +51 -0
- package/src/vm/lib/global/bit.ts +93 -0
- package/src/vm/lib/global/debug.ts +36 -0
- package/src/vm/lib/global/index.ts +9 -0
- package/src/vm/lib/global/json.ts +45 -0
- package/src/vm/lib/global/math-additional.ts +71 -0
- package/src/vm/lib/global/math-arr.ts +62 -0
- package/src/vm/lib/global/math-const.ts +2 -0
- package/src/vm/lib/global/math-unary.ts +171 -0
- package/src/vm/lib/global/math.ts +27 -0
- package/src/vm/lib/global/mod/index.ts +4 -0
- package/src/vm/lib/global/mod/matrix.ts +579 -0
- package/src/vm/lib/global/sequence/all-any.ts +73 -0
- package/src/vm/lib/global/sequence/entries.ts +67 -0
- package/src/vm/lib/global/sequence/find.ts +49 -0
- package/src/vm/lib/global/sequence/flatten.ts +16 -0
- package/src/vm/lib/global/sequence/index.ts +11 -0
- package/src/vm/lib/global/sequence/len.ts +15 -0
- package/src/vm/lib/global/sequence/map-filter.ts +82 -0
- package/src/vm/lib/global/sequence/repeat.ts +28 -0
- package/src/vm/lib/global/sequence/reverse.ts +17 -0
- package/src/vm/lib/global/sequence/sort.ts +88 -0
- package/src/vm/lib/global/sequence/with.ts +43 -0
- package/src/vm/lib/global/sequence/zip.ts +40 -0
- package/src/vm/lib/global/string.ts +149 -0
- package/src/vm/lib/global/time.ts +73 -0
- package/src/vm/lib/global/to-primitive.ts +58 -0
- package/src/vm/operations.ts +497 -0
- package/src/vm/types/checker.ts +164 -0
- package/src/vm/types/context.ts +161 -0
- package/src/vm/types/extern.ts +166 -0
- package/src/vm/types/function.ts +136 -0
- package/src/vm/types/index.ts +124 -0
- package/src/vm/types/module.ts +40 -0
- package/src/vm/types/script.ts +18 -0
- package/src/vm/types/wrapper.ts +28 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type VmValue } from '../../../types/index.js';
|
|
2
|
+
import { VmLib } from '../../_helpers.js';
|
|
3
|
+
export declare const find: VmLib<(data: VmValue | undefined, predicate: VmValue | undefined) => {
|
|
4
|
+
0: number;
|
|
5
|
+
1: string | number | boolean | import("../../../types/index.js").VmRecord | import("../../../types/index.js").VmArray | null;
|
|
6
|
+
} | {
|
|
7
|
+
0: string;
|
|
8
|
+
1: string | number | boolean | import("../../../types/index.js").VmRecord | import("../../../types/index.js").VmArray | null;
|
|
9
|
+
} | null>;
|
|
10
|
+
//# sourceMappingURL=find.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../../src/vm/lib/global/sequence/find.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAuC,MAAM,mBAAmB,CAAC;AAE/E,eAAO,MAAM,IAAI;;;;;;SA0ChB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { VmLib } from '../../_helpers.js';
|
|
2
|
+
export declare const flatten: VmLib<(data: import("../../../index.js").VmValue | undefined, depth?: import("../../../index.js").VmValue | undefined) => (string | number | boolean | import("../../../index.js").VmRecord | import("../../../index.js").VmArray | null | undefined)[]>;
|
|
3
|
+
//# sourceMappingURL=flatten.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../../../../src/vm/lib/global/sequence/flatten.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAe,MAAM,mBAAmB,CAAC;AAEvD,eAAO,MAAM,OAAO,0PAYnB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './with.js';
|
|
2
|
+
export * from './entries.js';
|
|
3
|
+
export * from './len.js';
|
|
4
|
+
export * from './map-filter.js';
|
|
5
|
+
export * from './find.js';
|
|
6
|
+
export * from './flatten.js';
|
|
7
|
+
export * from './reverse.js';
|
|
8
|
+
export * from './zip.js';
|
|
9
|
+
export * from './all-any.js';
|
|
10
|
+
export * from './sort.js';
|
|
11
|
+
export * from './repeat.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/vm/lib/global/sequence/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"len.d.ts","sourceRoot":"","sources":["../../../../../src/vm/lib/global/sequence/len.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,mBAAmB,CAAC;AAEvD,eAAO,MAAM,GAAG,yEAYf,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type VmValue } from '../../../types/index.js';
|
|
2
|
+
import { VmLib } from '../../_helpers.js';
|
|
3
|
+
export * from './with.js';
|
|
4
|
+
export * from './entries.js';
|
|
5
|
+
export * from './len.js';
|
|
6
|
+
export declare const map: VmLib<(data: VmValue | undefined, f: VmValue | undefined) => VmValue>;
|
|
7
|
+
export declare const filter: VmLib<(data: VmValue | undefined, predicate: VmValue | undefined) => VmValue>;
|
|
8
|
+
export declare const filter_map: VmLib<(data: VmValue | undefined, f: VmValue | undefined) => VmValue>;
|
|
9
|
+
//# sourceMappingURL=map-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-filter.d.ts","sourceRoot":"","sources":["../../../../../src/vm/lib/global/sequence/map-filter.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,KAAK,EAA+C,MAAM,mBAAmB,CAAC;AAEvF,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AAkBzB,eAAO,MAAM,GAAG,uEAef,CAAC;AAEF,eAAO,MAAM,MAAM,+EAmBlB,CAAC;AAEF,eAAO,MAAM,UAAU,uEAmBtB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { VmConst } from '../../../types/index.js';
|
|
2
|
+
import { VmLib } from '../../_helpers.js';
|
|
3
|
+
export declare const repeat: VmLib<(data: import("../../../types/index.js").VmValue | undefined, times: import("../../../types/index.js").VmValue | undefined) => VmConst[]>;
|
|
4
|
+
//# sourceMappingURL=repeat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../../../../src/vm/lib/global/sequence/repeat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAmC,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE3E,eAAO,MAAM,MAAM,iJAuBlB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reverse.d.ts","sourceRoot":"","sources":["../../../../../src/vm/lib/global/sequence/reverse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,mBAAmB,CAAC;AAEvD,eAAO,MAAM,OAAO,sHAcnB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { VmConst, VmValue } from '../../../types/index.js';
|
|
2
|
+
import { VmLib } from '../../_helpers.js';
|
|
3
|
+
export declare const sort: VmLib<(data: VmValue | undefined, comparator: VmValue | undefined) => VmConst[]>;
|
|
4
|
+
export declare const sort_by: VmLib<(data: VmValue | undefined, key_fn: VmValue | undefined, comparator: VmValue | undefined) => VmConst[]>;
|
|
5
|
+
//# sourceMappingURL=sort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../../../../src/vm/lib/global/sequence/sort.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAS,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,KAAK,EAA+B,MAAM,mBAAmB,CAAC;AA2BvE,eAAO,MAAM,IAAI,kFAwBhB,CAAC;AAEF,eAAO,MAAM,OAAO,+GAgCnB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type VmConst } from '../../../types/index.js';
|
|
2
|
+
import { VmLib } from '../../_helpers.js';
|
|
3
|
+
declare const _with: VmLib<(data: import("../../../types/index.js").VmValue | undefined, ...entries: (import("../../../types/index.js").VmValue | undefined)[]) => (VmConst | undefined)[] | Record<string, VmConst | undefined>>;
|
|
4
|
+
export { _with as 'with' };
|
|
5
|
+
//# sourceMappingURL=with.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with.d.ts","sourceRoot":"","sources":["../../../../../src/vm/lib/global/sequence/with.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAmC,MAAM,mBAAmB,CAAC;AAG3E,QAAA,MAAM,KAAK,8MAmCV,CAAC;AACF,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../../../../src/vm/lib/global/sequence/zip.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,OAAO,EAAgB,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,KAAK,EAAc,MAAM,mBAAmB,CAAC;AAGtD,eAAO,MAAM,GAAG,4GAiCf,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VmLib } from '../_helpers.js';
|
|
2
|
+
export declare const chars: VmLib<(str: import("../../index.js").VmValue | undefined) => string[]>;
|
|
3
|
+
export declare const starts_with: VmLib<(str: import("../../index.js").VmValue | undefined, search: import("../../index.js").VmValue | undefined) => boolean>;
|
|
4
|
+
export declare const ends_with: VmLib<(str: import("../../index.js").VmValue | undefined, search: import("../../index.js").VmValue | undefined) => boolean>;
|
|
5
|
+
export declare const contains: VmLib<(str: import("../../index.js").VmValue | undefined, search: import("../../index.js").VmValue | undefined) => boolean>;
|
|
6
|
+
export declare const trim_start: VmLib<(str: import("../../index.js").VmValue | undefined) => string>;
|
|
7
|
+
export declare const trim_end: VmLib<(str: import("../../index.js").VmValue | undefined) => string>;
|
|
8
|
+
export declare const trim: VmLib<(str: import("../../index.js").VmValue | undefined) => string>;
|
|
9
|
+
export declare const replace: VmLib<(str: import("../../index.js").VmValue | undefined, search: import("../../index.js").VmValue | undefined, replacement?: import("../../index.js").VmValue | undefined) => string>;
|
|
10
|
+
export declare const split: VmLib<(str: import("../../index.js").VmValue | undefined, separator?: import("../../index.js").VmValue | undefined) => string[]>;
|
|
11
|
+
export declare const join: VmLib<(arr: import("../../index.js").VmValue | undefined, separator?: import("../../index.js").VmValue | undefined) => string>;
|
|
12
|
+
//# sourceMappingURL=string.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../../src/vm/lib/global/string.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE9D,eAAO,MAAM,KAAK,wEAYjB,CAAC;AAEF,eAAO,MAAM,WAAW,6HAavB,CAAC;AACF,eAAO,MAAM,SAAS,6HAarB,CAAC;AAEF,eAAO,MAAM,QAAQ,6HAapB,CAAC;AAEF,eAAO,MAAM,UAAU,sEAYtB,CAAC;AAEF,eAAO,MAAM,QAAQ,sEAYpB,CAAC;AAEF,eAAO,MAAM,IAAI,sEAYhB,CAAC;AAEF,eAAO,MAAM,OAAO,wLAanB,CAAC;AAEF,eAAO,MAAM,KAAK,kIAejB,CAAC;AAEF,eAAO,MAAM,IAAI,gIAahB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { VmLib } from '../_helpers.js';
|
|
2
|
+
export declare const to_timestamp: VmLib<(datetime: import("../../index.js").VmValue | undefined) => number>;
|
|
3
|
+
export declare const to_datetime: VmLib<(datetime: import("../../index.js").VmValue | undefined, offset: import("../../index.js").VmValue | undefined) => {
|
|
4
|
+
year: number;
|
|
5
|
+
month: number;
|
|
6
|
+
day: number;
|
|
7
|
+
hour: number;
|
|
8
|
+
minute: number;
|
|
9
|
+
second: number;
|
|
10
|
+
millisecond: number;
|
|
11
|
+
dayOfWeek: number;
|
|
12
|
+
offset: number;
|
|
13
|
+
} | null>;
|
|
14
|
+
export declare const to_iso8601: VmLib<(datetime: import("../../index.js").VmValue | undefined) => string | null>;
|
|
15
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../../src/vm/lib/global/time.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,eAAO,MAAM,YAAY,2EAqBxB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;SA8BvB,CAAC;AAEF,eAAO,MAAM,UAAU,kFAatB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { VmLib } from '../_helpers.js';
|
|
2
|
+
export declare const to_string: VmLib<(data: import("../../index.js").VmValue | undefined) => string>;
|
|
3
|
+
export declare const to_number: VmLib<(data: import("../../index.js").VmValue | undefined) => number>;
|
|
4
|
+
export declare const to_boolean: VmLib<(data: import("../../index.js").VmValue | undefined) => boolean>;
|
|
5
|
+
export declare const format: VmLib<(data: import("../../index.js").VmValue | undefined, format: import("../../index.js").VmValue | undefined) => string>;
|
|
6
|
+
//# sourceMappingURL=to-primitive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-primitive.d.ts","sourceRoot":"","sources":["../../../../src/vm/lib/global/to-primitive.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEjD,eAAO,MAAM,SAAS,uEAYrB,CAAC;AAEF,eAAO,MAAM,SAAS,uEAYrB,CAAC;AAEF,eAAO,MAAM,UAAU,wEAYtB,CAAC;AAEF,eAAO,MAAM,MAAM,6HAYlB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type TypeName, type VmAny, type VmRecord, type VmValue, type VmArray, type VmConst } from './types/index.js';
|
|
2
|
+
export declare const $Add: (a: VmAny, b: VmAny) => number;
|
|
3
|
+
export declare const $Sub: (a: VmAny, b: VmAny) => number;
|
|
4
|
+
export declare const $Mul: (a: VmAny, b: VmAny) => number;
|
|
5
|
+
export declare const $Div: (a: VmAny, b: VmAny) => number;
|
|
6
|
+
export declare const $Mod: (a: VmAny, b: VmAny) => number;
|
|
7
|
+
export declare const $Pow: (a: VmAny, b: VmAny) => number;
|
|
8
|
+
export declare const $And: (a: VmAny, b: VmAny) => boolean;
|
|
9
|
+
export declare const $Or: (a: VmAny, b: VmAny) => boolean;
|
|
10
|
+
export declare const $Gt: (a: VmAny, b: VmAny) => boolean;
|
|
11
|
+
export declare const $Gte: (a: VmAny, b: VmAny) => boolean;
|
|
12
|
+
export declare const $Lt: (a: VmAny, b: VmAny) => boolean;
|
|
13
|
+
export declare const $Lte: (a: VmAny, b: VmAny) => boolean;
|
|
14
|
+
export declare const $Eq: (a: VmAny, b: VmAny) => boolean;
|
|
15
|
+
export declare const $Neq: (a: VmAny, b: VmAny) => boolean;
|
|
16
|
+
export declare const $Aeq: (a: VmAny, b: VmAny) => boolean;
|
|
17
|
+
export declare const $Naeq: (a: VmAny, b: VmAny) => boolean;
|
|
18
|
+
export declare const $Same: (a: VmAny, b: VmAny) => boolean;
|
|
19
|
+
export declare const $Nsame: (a: VmAny, b: VmAny) => boolean;
|
|
20
|
+
export declare const $In: (value: VmAny, iterable: VmAny) => boolean;
|
|
21
|
+
export declare const $Concat: (...args: string[]) => string;
|
|
22
|
+
export declare const $Pos: (a: VmAny) => number;
|
|
23
|
+
export declare const $Neg: (a: VmAny) => number;
|
|
24
|
+
export declare const $Not: (a: VmAny) => boolean;
|
|
25
|
+
export declare const $Length: (value: VmAny) => number;
|
|
26
|
+
export declare const $Omit: (value: VmAny, omitted: ReadonlyArray<string | number>) => VmRecord;
|
|
27
|
+
export declare const $Pick: (value: VmAny, picked: ReadonlyArray<string | number>) => VmRecord;
|
|
28
|
+
export declare const $Slice: (value: VmAny, start: VmAny, end: VmAny) => VmArray;
|
|
29
|
+
export declare const $SliceExclusive: (value: VmAny, start: VmAny, end: VmAny) => VmArray;
|
|
30
|
+
export declare const $AssertInit: (value: VmAny) => asserts value is VmValue;
|
|
31
|
+
export declare const $Call: (func: VmValue, args: readonly VmAny[]) => VmValue;
|
|
32
|
+
export declare const $Type: (value: VmAny) => TypeName;
|
|
33
|
+
export declare const $ToBoolean: (value: VmAny) => boolean;
|
|
34
|
+
export declare const $ToString: (value: VmAny) => string;
|
|
35
|
+
export declare const $ToNumber: (value: VmAny) => number;
|
|
36
|
+
export declare const $IsBoolean: (value: VmAny) => value is boolean;
|
|
37
|
+
export declare const $IsNumber: (value: VmAny) => value is number;
|
|
38
|
+
export declare const $IsString: (value: VmAny) => value is string;
|
|
39
|
+
export declare const $IsRecord: (value: VmAny) => value is VmRecord;
|
|
40
|
+
export declare const $IsArray: (value: VmAny) => value is VmArray;
|
|
41
|
+
export declare const $AssertNonNil: (value: VmAny) => asserts value is NonNullable<VmValue>;
|
|
42
|
+
export declare const $Has: (obj: VmAny, key: VmAny) => boolean;
|
|
43
|
+
export declare const $Get: (obj: VmAny, key: VmAny) => VmValue;
|
|
44
|
+
export declare const $Set: (obj: VmAny, key: VmAny, value: VmAny) => void;
|
|
45
|
+
export declare const $Iterable: (value: VmAny) => Iterable<VmValue | undefined>;
|
|
46
|
+
export declare const $RecordSpread: (record: VmAny) => VmRecord | null;
|
|
47
|
+
export declare const $ArraySpread: (array: VmAny) => Iterable<VmConst | undefined>;
|
|
48
|
+
export declare const $Format: (value: VmAny, format: VmAny) => string;
|
|
49
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/vm/operations.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type VmAny, type VmConst, type VmImmutable, type VmValue } from './index.js';
|
|
2
|
+
/**
|
|
3
|
+
* 检查是否为 Mirascript 值语义值
|
|
4
|
+
*/
|
|
5
|
+
export declare function isVmConst(value: VmAny): value is VmConst;
|
|
6
|
+
/**
|
|
7
|
+
* 检查是否为 Mirascript 值语义值
|
|
8
|
+
*/
|
|
9
|
+
export declare function isVmConst(value: unknown, checkDeep: boolean): value is VmConst;
|
|
10
|
+
/**
|
|
11
|
+
* 检查是否为 Mirascript 不可变值
|
|
12
|
+
*/
|
|
13
|
+
export declare function isVmImmutable(value: VmAny): value is VmImmutable;
|
|
14
|
+
/**
|
|
15
|
+
* 检查是否为 Mirascript 不可变值
|
|
16
|
+
*/
|
|
17
|
+
export declare function isVmImmutable(value: unknown, checkDeep: boolean): value is VmImmutable;
|
|
18
|
+
/**
|
|
19
|
+
* 检查是否为 Mirascript 合法值
|
|
20
|
+
*/
|
|
21
|
+
export declare function isVmValue(value: VmAny): value is VmValue;
|
|
22
|
+
/**
|
|
23
|
+
* 检查是否为 Mirascript 合法值
|
|
24
|
+
*/
|
|
25
|
+
export declare function isVmValue(value: unknown, checkDeep: boolean): value is VmValue;
|
|
26
|
+
/**
|
|
27
|
+
* 检查是否为 Mirascript 值
|
|
28
|
+
*/
|
|
29
|
+
export declare function isVmAny(value: unknown, checkDeep: boolean): value is VmAny;
|
|
30
|
+
//# sourceMappingURL=checker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../../src/vm/types/checker.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,KAAK,KAAK,EAEV,KAAK,OAAO,EACZ,KAAK,WAAW,EAEhB,KAAK,OAAO,EACf,MAAM,YAAY,CAAC;AAiEpB;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,OAAO,CAAC;AAC1D;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAAC;AA8BhF;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,WAAW,CAAC;AAClE;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAAC;AAOxF;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,OAAO,CAAC;AAC1D;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAAC;AAShF;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAkB1E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { VmFunction, type VmAny, type VmImmutable, type VmValue, type VmFunctionLike } from './index.js';
|
|
2
|
+
import type * as global from '../lib/global/index.js';
|
|
3
|
+
/** 全局导入的标准库 */
|
|
4
|
+
type GlobalKeys = keyof typeof global;
|
|
5
|
+
/** 全局导入的标准库值 */
|
|
6
|
+
type ToGlobalValue<T extends GlobalKeys> = (typeof global)[T] extends VmFunctionLike ? VmFunction<(typeof global)[T]> : (typeof global)[T];
|
|
7
|
+
/** 全局导入的标准库 */
|
|
8
|
+
type VmContextBase = {
|
|
9
|
+
[key in GlobalKeys]: ToGlobalValue<key>;
|
|
10
|
+
};
|
|
11
|
+
declare const kVmContext: unique symbol;
|
|
12
|
+
/** MiraScript 执行上下文的基础,仅包含标准库 */
|
|
13
|
+
export type VmSharedContext = VmContextBase & Record<string, VmImmutable>;
|
|
14
|
+
/** MiraScript 执行上下文 */
|
|
15
|
+
export interface VmContext {
|
|
16
|
+
/** 内部标识符 */
|
|
17
|
+
readonly [kVmContext]: true;
|
|
18
|
+
/** 枚举所有 key,仅在 LSP 中使用 */
|
|
19
|
+
keys(): Iterable<string>;
|
|
20
|
+
/** 获取指定 key 的值 `global[key]` */
|
|
21
|
+
get(key: string): VmValue;
|
|
22
|
+
/** 查找指定 key 是否存在 `key in global` */
|
|
23
|
+
has(key: string): boolean;
|
|
24
|
+
}
|
|
25
|
+
/** MiraScript 执行上下文 */
|
|
26
|
+
export type VmContextRecord = Record<string, VmValue | undefined>;
|
|
27
|
+
export declare const VmSharedContext: VmSharedContext;
|
|
28
|
+
/** 定义在所有 MiraScript 执行上下文中共享的全局变量 */
|
|
29
|
+
export declare function defineVmContextValue(name: string, value: VmImmutable | ((...args: VmAny[]) => VmAny), override?: boolean): void;
|
|
30
|
+
/** 无后备的实现 */
|
|
31
|
+
export declare const DefaultVmContext: VmContext;
|
|
32
|
+
/** 创建用于执行脚本的执行上下文 */
|
|
33
|
+
export declare function createVmContext(...args: readonly [
|
|
34
|
+
vmValues?: VmContextRecord | null | undefined,
|
|
35
|
+
externValues?: Record<string, unknown> | null | undefined
|
|
36
|
+
] | readonly [
|
|
37
|
+
getter: (key: string) => VmValue | undefined,
|
|
38
|
+
enumerator?: (() => Iterable<string>) | null | undefined
|
|
39
|
+
]): VmContext;
|
|
40
|
+
/** 检查是否为执行上下文 */
|
|
41
|
+
export declare function isVmContext(context: unknown): context is VmContext;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/vm/types/context.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EACV,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,OAAO,EAGZ,KAAK,cAAc,EACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEtD,eAAe;AACf,KAAK,UAAU,GAAG,MAAM,OAAO,MAAM,CAAC;AACtC,gBAAgB;AAChB,KAAK,aAAa,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,cAAc,GAC9E,UAAU,CAAC,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAC9B,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACzB,eAAe;AACf,KAAK,aAAa,GAAG;KAChB,GAAG,IAAI,UAAU,GAAG,aAAa,CAAC,GAAG,CAAC;CAC1C,CAAC;AACF,QAAA,MAAM,UAAU,eAAgC,CAAC;AACjD,iCAAiC;AACjC,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAC1E,uBAAuB;AACvB,MAAM,WAAW,SAAS;IACtB,YAAY;IACZ,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC;IAC5B,0BAA0B;IAC1B,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IACzB,gCAAgC;IAChC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,oCAAoC;IACpC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC7B;AACD,uBAAuB;AACvB,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC;AAClE,eAAO,MAAM,eAAe,EAAoC,eAAe,CAAC;AAEhF,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,CAYN;AAED,aAAa;AACb,eAAO,MAAM,gBAAgB,EAAE,SAc7B,CAAC;AA8CH,qBAAqB;AACrB,wBAAgB,eAAe,CAC3B,GAAG,IAAI,EACD,SAAS;IACL,QAAQ,CAAC,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS;CAC5D,GACD,SAAS;IACL,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;CAC3D,GACR,SAAS,CAuBX;AAED,iBAAiB;AACjB,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,SAAS,CAGlE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { VmWrapper } from './wrapper.js';
|
|
2
|
+
import type { TypeName, VmAny, VmValue } from './index.js';
|
|
3
|
+
/** 包装为 Mirascript 类型 */
|
|
4
|
+
export declare function wrapToVmValue(value: unknown, caller: VmExtern | null): VmValue;
|
|
5
|
+
/** 取消 Mirascript 类型包装 */
|
|
6
|
+
export declare function unwrapFromVmValue(value: VmAny): unknown;
|
|
7
|
+
/** 包装 Mirascript `extern` 类型的对象 */
|
|
8
|
+
export declare class VmExtern<const T extends object = object> extends VmWrapper<T> {
|
|
9
|
+
readonly caller: VmExtern | null;
|
|
10
|
+
constructor(value: T, caller?: VmExtern | null);
|
|
11
|
+
/** Check if the object has a property */
|
|
12
|
+
protected access(key: string, read: boolean): boolean;
|
|
13
|
+
/** @inheritdoc */
|
|
14
|
+
has(key: string): boolean;
|
|
15
|
+
/** @inheritdoc */
|
|
16
|
+
get(key: string): VmAny;
|
|
17
|
+
/** Set a property on the object */
|
|
18
|
+
set(key: string, value: VmValue): boolean;
|
|
19
|
+
/** Call extern value */
|
|
20
|
+
call(args: readonly VmValue[]): VmAny;
|
|
21
|
+
/** @inheritdoc */
|
|
22
|
+
keys(): string[];
|
|
23
|
+
/** @inheritdoc */
|
|
24
|
+
same(other: VmAny): boolean;
|
|
25
|
+
/** @inheritdoc */
|
|
26
|
+
toString(): string;
|
|
27
|
+
/** @inheritdoc */
|
|
28
|
+
get type(): TypeName;
|
|
29
|
+
/** @inheritdoc */
|
|
30
|
+
get describe(): string;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=extern.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extern.d.ts","sourceRoot":"","sources":["../../../src/vm/types/extern.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAY,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrE,wBAAwB;AACxB,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,OAAO,CAsB9E;AAED,0BAA0B;AAC1B,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAgBvD;AAKD,mCAAmC;AACnC,qBAAa,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAGnE,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI;gBADhC,KAAK,EAAE,CAAC,EACC,MAAM,GAAE,QAAQ,GAAG,IAAW;IAK3C,yCAAyC;IACzC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO;IAiBrD,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;IAWrC,kBAAkB;IACT,IAAI,IAAI,MAAM,EAAE;IAOzB,kBAAkB;IACT,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAIpC,kBAAkB;IACT,QAAQ,IAAI,MAAM;IAY3B,kBAAkB;IAClB,IAAa,IAAI,IAAI,QAAQ,CAE5B;IACD,kBAAkB;IAClB,IAAa,QAAQ,IAAI,MAAM,CAuB9B;CACJ"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { VmAny, VmValue } from './index.js';
|
|
2
|
+
declare const kVmFunction: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* Mirascript 函数签名
|
|
5
|
+
*
|
|
6
|
+
* 虽然所有输入参数的类型均为 {@linkcode VmValue},但当参数不足时,对应的参数会被填充为 `undefined`。
|
|
7
|
+
*/
|
|
8
|
+
export type VmFunctionLike = (...args: ReadonlyArray<VmValue | undefined>) => VmAny | void;
|
|
9
|
+
/** Mirascript 函数 */
|
|
10
|
+
export type VmFunction<T extends VmFunctionLike = VmFunctionLike> = T & {
|
|
11
|
+
readonly [kVmFunction]: VmFunctionInfo;
|
|
12
|
+
};
|
|
13
|
+
/** Mirascript 函数信息 */
|
|
14
|
+
export interface VmFunctionInfo {
|
|
15
|
+
/** 完整名称 */
|
|
16
|
+
readonly fullName: string;
|
|
17
|
+
/** 是否为库函数 */
|
|
18
|
+
readonly isLib: boolean;
|
|
19
|
+
/** 文档字符串 */
|
|
20
|
+
readonly summary?: string;
|
|
21
|
+
/** 文档字符串 */
|
|
22
|
+
readonly params?: Record<string, string>;
|
|
23
|
+
/** 文档字符串 */
|
|
24
|
+
readonly paramsType?: Record<string, string>;
|
|
25
|
+
/** 文档字符串 */
|
|
26
|
+
readonly returns?: string;
|
|
27
|
+
/** 文档字符串 */
|
|
28
|
+
readonly returnsType?: string;
|
|
29
|
+
/** 文档字符串 */
|
|
30
|
+
readonly examples?: string[];
|
|
31
|
+
/** 如果添加了包装,返回原函数 */
|
|
32
|
+
readonly original?: VmFunctionLike;
|
|
33
|
+
}
|
|
34
|
+
/** Mirascript 函数创建选项 */
|
|
35
|
+
export type VmFunctionOption = Partial<Omit<VmFunctionInfo, 'original'> & {
|
|
36
|
+
readonly injectCp: boolean;
|
|
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
|
+
/** 创建 Mirascript 函数 */
|
|
43
|
+
export declare function VmFunction<T extends VmFunctionLike>(fn: T, option?: VmFunctionOption): VmFunction<T>;
|
|
44
|
+
/** 创建 Mirascript 函数在宿主语言运行的代理 */
|
|
45
|
+
export declare function toVmFunctionProxy<T extends VmFunctionLike>(fn: VmFunction<T>): T;
|
|
46
|
+
/** 解开 Mirascript 函数在宿主语言运行的代理 */
|
|
47
|
+
export declare function fromVmFunctionProxy<T extends VmFunctionLike>(fn: T): VmFunction<T> | undefined;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=function.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/vm/types/function.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGjD,QAAA,MAAM,WAAW,eAAuC,CAAC;AAGzD;;;;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,0BAA0B;AAC1B,wBAAgB,YAAY,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,CAE7F;AAED,iCAAiC;AACjC,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAG5E;AAED,uBAAuB;AACvB,wBAAgB,UAAU,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,GAAE,gBAAqB,GAAG,UAAU,CAAC,CAAC,CAAC,CAwCxG;AAED,iCAAiC;AACjC,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAqBhF;AAED,iCAAiC;AACjC,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAO9F"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { VmExtern } from './extern.js';
|
|
2
|
+
import type { VmFunction } from './function.js';
|
|
3
|
+
import { VmModule } from './module.js';
|
|
4
|
+
/** Mirascript 原始值 */
|
|
5
|
+
export type VmPrimitive = null | string | number | boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Mirascript 记录
|
|
8
|
+
* 仅拥有且可枚举的字符串键视作存在
|
|
9
|
+
* 字段值 `undefined` 和 `null` 均视作 `nil`
|
|
10
|
+
*/
|
|
11
|
+
export type VmRecord = {
|
|
12
|
+
readonly [key: string]: VmConst | undefined;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Mirascript 数组
|
|
16
|
+
* 数组中的 `undefined`、`null` 及 <empty slot> 均视作 `nil`
|
|
17
|
+
*/
|
|
18
|
+
export type VmArray = ReadonlyArray<VmConst | undefined>;
|
|
19
|
+
/** Mirascript 虚拟机内的值语义值 */
|
|
20
|
+
export type VmConst = VmPrimitive | VmRecord | VmArray;
|
|
21
|
+
/** Mirascript 虚拟机内的不可变值 */
|
|
22
|
+
export type VmImmutable = VmConst | VmFunction | VmModule;
|
|
23
|
+
/** Mirascript 虚拟机内的合法值 */
|
|
24
|
+
export type VmValue = VmImmutable | VmExtern;
|
|
25
|
+
/** Mirascript 虚拟机内的未初始化变量 */
|
|
26
|
+
export type VmUninitialized = undefined;
|
|
27
|
+
/** Mirascript 虚拟机内的值(包括未初始化变量) */
|
|
28
|
+
export type VmAny = VmValue | VmUninitialized;
|
|
29
|
+
/** 类型名称 */
|
|
30
|
+
export type TypeName = keyof VmValueMap;
|
|
31
|
+
/** 类型名称映射 */
|
|
32
|
+
export interface VmValueMap {
|
|
33
|
+
/** 空值 */
|
|
34
|
+
nil: null;
|
|
35
|
+
/** 字符串 */
|
|
36
|
+
string: string;
|
|
37
|
+
/** 数字 */
|
|
38
|
+
number: number;
|
|
39
|
+
/** 布尔值 */
|
|
40
|
+
boolean: boolean;
|
|
41
|
+
/** Mirascript 记录 */
|
|
42
|
+
record: VmRecord;
|
|
43
|
+
/** Mirascript 数组 */
|
|
44
|
+
array: VmArray;
|
|
45
|
+
/** Mirascript 函数 */
|
|
46
|
+
function: VmFunction;
|
|
47
|
+
/** 外部调用对象 */
|
|
48
|
+
extern: VmExtern;
|
|
49
|
+
/** Mirascript 模块 */
|
|
50
|
+
module: VmModule;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 检查值是否为 Mirascript 数组
|
|
54
|
+
*/
|
|
55
|
+
export declare function isVmArray(value: VmAny): value is VmArray;
|
|
56
|
+
/**
|
|
57
|
+
* 检查值是否为 Mirascript 记录
|
|
58
|
+
*/
|
|
59
|
+
export declare function isVmRecord(value: VmAny): value is VmRecord;
|
|
60
|
+
/**
|
|
61
|
+
* 检查值是否为 Mirascript 原始值
|
|
62
|
+
*/
|
|
63
|
+
export declare function isVmPrimitive(value: unknown): value is VmPrimitive;
|
|
64
|
+
export { VmExtern, wrapToVmValue, unwrapFromVmValue } from './extern.js';
|
|
65
|
+
/** 检查值是否为 Mirascript 外部值 */
|
|
66
|
+
export declare function isVmExtern(value: unknown): value is VmExtern;
|
|
67
|
+
export { VmFunction, isVmFunction, getVmFunctionInfo, type VmFunctionInfo, type VmFunctionLike, type VmFunctionOption, } from './function.js';
|
|
68
|
+
export { VmModule } from './module.js';
|
|
69
|
+
/** 检查值是否为 Mirascript 模块 */
|
|
70
|
+
export declare function isVmModule(value: unknown): value is VmModule;
|
|
71
|
+
export { type VmContext, type VmSharedContext, isVmContext, defineVmContextValue, createVmContext } from './context.js';
|
|
72
|
+
export { type VmScript, isVmScript } from './script.js';
|
|
73
|
+
export { isVmAny, isVmConst, isVmImmutable, isVmValue } from './checker.js';
|
|
74
|
+
export declare const VM_ARRAY_MAX_LENGTH: number;
|
|
75
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vm/types/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,qBAAqB;AACrB,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAC3D;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG;IACnB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAC/C,CAAC;AACF;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;AAEzD,2BAA2B;AAC3B,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEvD,2BAA2B;AAC3B,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE1D,0BAA0B;AAC1B,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE7C,6BAA6B;AAC7B,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC;AAExC,kCAAkC;AAClC,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,eAAe,CAAC;AAE9C,WAAW;AACX,MAAM,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC;AAExC,aAAa;AACb,MAAM,WAAW,UAAU;IACvB,SAAS;IACT,GAAG,EAAE,IAAI,CAAC;IACV,UAAU;IACV,MAAM,EAAE,MAAM,CAAC;IACf,SAAS;IACT,MAAM,EAAE,MAAM,CAAC;IACf,UAAU;IACV,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB;IACpB,MAAM,EAAE,QAAQ,CAAC;IACjB,oBAAoB;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,oBAAoB;IACpB,QAAQ,EAAE,UAAU,CAAC;IACrB,aAAa;IACb,MAAM,EAAE,QAAQ,CAAC;IACjB,oBAAoB;IACpB,MAAM,EAAE,QAAQ,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,OAAO,CAIxD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,QAAQ,CAM1D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAOlE;AAED,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEzE,4BAA4B;AAC5B,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D;AAED,OAAO,EACH,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,2BAA2B;AAC3B,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D;AAED,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,WAAW,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAExH,OAAO,EAAE,KAAK,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5E,eAAO,MAAM,mBAAmB,QAAc,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TypeName, VmAny, VmValue } from './index.js';
|
|
2
|
+
import { VmWrapper } from './wrapper.js';
|
|
3
|
+
/** Mirascript 模块 */
|
|
4
|
+
export declare class VmModule<const T extends Record<string, VmValue> = Record<string, VmValue>> extends VmWrapper<T> {
|
|
5
|
+
/** 模块名称 */
|
|
6
|
+
readonly name: string;
|
|
7
|
+
constructor(
|
|
8
|
+
/** 模块名称 */
|
|
9
|
+
name: string,
|
|
10
|
+
/** 模块导出 */
|
|
11
|
+
value: T);
|
|
12
|
+
/** @inheritdoc */
|
|
13
|
+
has(key: string): boolean;
|
|
14
|
+
/** @inheritdoc */
|
|
15
|
+
get(key: string): VmAny;
|
|
16
|
+
/** @inheritdoc */
|
|
17
|
+
keys(): string[];
|
|
18
|
+
/** @inheritdoc */
|
|
19
|
+
same(other: VmAny): boolean;
|
|
20
|
+
/** @inheritdoc */
|
|
21
|
+
get type(): TypeName;
|
|
22
|
+
/** @inheritdoc */
|
|
23
|
+
get describe(): string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/vm/types/module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,oBAAoB;AACpB,qBAAa,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAErG,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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { VmContext, VmValue } from './index.js';
|
|
2
|
+
declare const kVmScript: unique symbol;
|
|
3
|
+
/** Mirascript 脚本 */
|
|
4
|
+
export type VmScriptLike = (global?: VmContext) => VmValue;
|
|
5
|
+
/** Mirascript 脚本 */
|
|
6
|
+
export type VmScript = VmScriptLike & {
|
|
7
|
+
readonly [kVmScript]: true;
|
|
8
|
+
/** 原始代码 */
|
|
9
|
+
readonly source: string;
|
|
10
|
+
};
|
|
11
|
+
/** 检查是否为 Mirascript 脚本 */
|
|
12
|
+
export declare function isVmScript(value: unknown): value is VmScript;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../../src/vm/types/script.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErD,QAAA,MAAM,SAAS,eAAqC,CAAC;AAErD,oBAAoB;AACpB,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,EAAE,SAAS,KAAK,OAAO,CAAC;AAE3D,oBAAoB;AACpB,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG;IAClC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;IAC3B,WAAW;IACX,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,0BAA0B;AAC1B,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TypeName, VmAny } from './index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Mirascript 特殊值的包装器
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class VmWrapper<T extends object> {
|
|
6
|
+
readonly value: T;
|
|
7
|
+
constructor(value: T);
|
|
8
|
+
/** 检查是否包含键 */
|
|
9
|
+
abstract has(key: string): boolean;
|
|
10
|
+
/** 获取键对应的值 */
|
|
11
|
+
abstract get(key: string): VmAny;
|
|
12
|
+
/** 获取键名 */
|
|
13
|
+
abstract keys(): string[];
|
|
14
|
+
/** 与其他值比较 */
|
|
15
|
+
abstract same(other: VmAny): boolean;
|
|
16
|
+
/** 获取类型 */
|
|
17
|
+
abstract get type(): TypeName;
|
|
18
|
+
/** 获取描述 */
|
|
19
|
+
abstract get describe(): string;
|
|
20
|
+
/** Convert the object to JSON */
|
|
21
|
+
toJSON(): undefined;
|
|
22
|
+
/** 转为字符串 */
|
|
23
|
+
toString(): string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../src/vm/types/wrapper.ts"],"names":[],"mappings":"AAAA,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,IAAI,MAAM;CAGrB"}
|