@mirascript/bindings 0.1.61 → 0.1.62-alpha.7

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CloudPSS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirascript/bindings",
3
- "version": "0.1.61",
3
+ "version": "0.1.62-alpha.7",
4
4
  "author": "CloudPSS",
5
5
  "license": "MIT",
6
6
  "description": "MiraScript compiler bindings",
@@ -19,11 +19,11 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@mirascript/napi": "~0.1.61",
23
- "@mirascript/wasm": "~0.1.61"
22
+ "@mirascript/wasm": "~0.1.62-alpha.7",
23
+ "@mirascript/napi": "~0.1.62-alpha.7"
24
24
  },
25
25
  "devDependencies": {
26
- "@types/node": "^25.5.2"
26
+ "@types/node": "^25.6.0"
27
27
  },
28
28
  "scripts": {
29
29
  "watch": "pnpm build --watch",
package/dist/index.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import * as bundle from '#bundle';
2
- import * as wasm from './wasm.js';
3
- /** 字节码模块 */
4
- export type { BcModule } from '#bundle';
5
- /** 字节码模块 */
6
- export type BcModuleType = wasm.BcModuleType | bundle.BcModuleType;
7
- /** 加载模块 */
8
- export declare const loadModule: () => Promise<BcModuleType>;
9
- /** 获取已加载的模块 */
10
- export declare const getModule: () => BcModuleType;
11
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,YAAY;AACZ,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,YAAY;AACZ,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;AAoBnE,WAAW;AACX,eAAO,MAAM,UAAU,EAAE,MAAM,OAAO,CAAC,YAAY,CAAe,CAAC;AACnE,eAAe;AACf,eAAO,MAAM,SAAS,EAAE,MAAM,YAAyB,CAAC"}
package/dist/index.js DELETED
@@ -1,24 +0,0 @@
1
- import * as bundle from '#bundle';
2
- import * as wasm from './wasm.js';
3
- import { ModuleLoader } from './loader.js';
4
- const loader = new ModuleLoader(async () => {
5
- try {
6
- return await bundle.loadModule();
7
- /* c8 ignore next 5 */
8
- }
9
- catch (ex) {
10
- if (typeof process === 'undefined' || !process?.getBuiltinModule) {
11
- // eslint-disable-next-line no-console
12
- console.warn('Failed to load compiler bundle, falling back to @mirascript/wasm');
13
- }
14
- else {
15
- process.getBuiltinModule('node:util').debuglog('mirascript')('Failed to load compiler bundle, falling back to @mirascript/wasm. Error:', ex);
16
- }
17
- return await wasm.loadModule();
18
- }
19
- });
20
- /** 加载模块 */
21
- export const loadModule = loader.load;
22
- /** 获取已加载的模块 */
23
- export const getModule = loader.get;
24
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C,MAAM,MAAM,GAAG,IAAI,YAAY,CAAe,KAAK,IAAI,EAAE;IACrD,IAAI,CAAC;QACD,OAAO,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QACjC,sBAAsB;IAC1B,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;QACV,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,OAAO,EAAE,gBAAgB,EAAE,CAAC;YAC/D,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC;QACrF,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CACxD,0EAA0E,EAC1E,EAAE,CACL,CAAC;QACN,CAAC;QACD,OAAO,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,WAAW;AACX,MAAM,CAAC,MAAM,UAAU,GAAgC,MAAM,CAAC,IAAI,CAAC;AACnE,eAAe;AACf,MAAM,CAAC,MAAM,SAAS,GAAuB,MAAM,CAAC,GAAG,CAAC"}
package/dist/loader.d.ts DELETED
@@ -1,15 +0,0 @@
1
- /** 模块加载器 */
2
- export declare class ModuleLoader<T> {
3
- private readonly loader;
4
- constructor(loader: () => Promise<T>);
5
- private module;
6
- private loading;
7
- /** 加载模块 */
8
- readonly load: () => Promise<T>;
9
- /**
10
- * 获取已加载的模块
11
- * @throws {Error} 模块尚未加载
12
- */
13
- readonly get: () => T;
14
- }
15
- //# sourceMappingURL=loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,YAAY;AACZ,qBAAa,YAAY,CAAC,CAAC;IACX,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,OAAO,CAAyB;IAExC,WAAW;IACX,QAAQ,CAAC,IAAI,QAAa,OAAO,CAAC,CAAC,CAAC,CA0BlC;IACF;;;OAGG;IACH,QAAQ,CAAC,GAAG,QAAO,CAAC,CAMlB;CACL"}
package/dist/loader.js DELETED
@@ -1,44 +0,0 @@
1
- /** 模块加载器 */
2
- export class ModuleLoader {
3
- constructor(loader) {
4
- this.loader = loader;
5
- /** 加载模块 */
6
- this.load = async () => {
7
- const { module, loading, loader } = this;
8
- if (module != null)
9
- return module;
10
- if (loading != null)
11
- return loading;
12
- const l = (async () => {
13
- const mod = await loader();
14
- this.module = mod;
15
- return mod;
16
- })();
17
- // Use .then() rather than .finally() to make Node.js happy
18
- // Avoid Unhandled rejection
19
- void l.then(() => {
20
- if (this.loading === l) {
21
- this.loading = undefined;
22
- }
23
- }, () => {
24
- if (this.loading === l) {
25
- this.loading = undefined;
26
- }
27
- });
28
- this.loading = l;
29
- return l;
30
- };
31
- /**
32
- * 获取已加载的模块
33
- * @throws {Error} 模块尚未加载
34
- */
35
- this.get = () => {
36
- const { module } = this;
37
- if (module == null) {
38
- throw new Error('MiraScript compiler module is not loaded.');
39
- }
40
- return module;
41
- };
42
- }
43
- }
44
- //# sourceMappingURL=loader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mapp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DELETED
@@ -1,10 +0,0 @@
1
- import type * as BcModule from '@mirascript/napi';
2
- /** 字节码模块 */
3
- export type { BcModule };
4
- /** 字节码模块 */
5
- export type BcModuleType = typeof BcModule;
6
- /** 加载模块 */
7
- export declare const loadModule: () => Promise<BcModuleType>;
8
- /** 获取已加载的模块 */
9
- export declare const getModule: () => BcModuleType;
10
- //# sourceMappingURL=napi.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"napi.d.ts","sourceRoot":"","sources":["../src/napi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAElD,YAAY;AACZ,YAAY,EAAE,QAAQ,EAAE,CAAC;AACzB,YAAY;AACZ,MAAM,MAAM,YAAY,GAAG,OAAO,QAAQ,CAAC;AAI3C,WAAW;AACX,eAAO,MAAM,UAAU,EAAE,MAAM,OAAO,CAAC,YAAY,CAAe,CAAC;AACnE,eAAe;AACf,eAAO,MAAM,SAAS,EAAE,MAAM,YAAyB,CAAC"}
package/dist/napi.js DELETED
@@ -1,7 +0,0 @@
1
- import { ModuleLoader } from './loader.js';
2
- const loader = new ModuleLoader(async () => await import('@mirascript/napi'));
3
- /** 加载模块 */
4
- export const loadModule = loader.load;
5
- /** 获取已加载的模块 */
6
- export const getModule = loader.get;
7
- //# sourceMappingURL=napi.js.map
package/dist/napi.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"napi.js","sourceRoot":"","sources":["../src/napi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,MAAM,MAAM,GAAG,IAAI,YAAY,CAAe,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAE5F,WAAW;AACX,MAAM,CAAC,MAAM,UAAU,GAAgC,MAAM,CAAC,IAAI,CAAC;AACnE,eAAe;AACf,MAAM,CAAC,MAAM,SAAS,GAAuB,MAAM,CAAC,GAAG,CAAC"}
package/dist/wasm.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import type * as BcModule from '@mirascript/wasm';
2
- /** 字节码模块 */
3
- export type { BcModule };
4
- /** 字节码模块 */
5
- export type BcModuleType = typeof BcModule;
6
- /** 加载模块 */
7
- export declare const loadModule: () => Promise<BcModuleType>;
8
- /** 获取已加载的模块 */
9
- export declare const getModule: () => BcModuleType;
10
- //# sourceMappingURL=wasm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAElD,YAAY;AACZ,YAAY,EAAE,QAAQ,EAAE,CAAC;AACzB,YAAY;AACZ,MAAM,MAAM,YAAY,GAAG,OAAO,QAAQ,CAAC;AAQ3C,WAAW;AACX,eAAO,MAAM,UAAU,EAAE,MAAM,OAAO,CAAC,YAAY,CAAe,CAAC;AACnE,eAAe;AACf,eAAO,MAAM,SAAS,EAAE,MAAM,YAAyB,CAAC"}
package/dist/wasm.js DELETED
@@ -1,11 +0,0 @@
1
- import { ModuleLoader } from './loader.js';
2
- const loader = new ModuleLoader(async () => {
3
- const wasm = await import('@mirascript/wasm');
4
- await wasm.init();
5
- return wasm;
6
- });
7
- /** 加载模块 */
8
- export const loadModule = loader.load;
9
- /** 获取已加载的模块 */
10
- export const getModule = loader.get;
11
- //# sourceMappingURL=wasm.js.map
package/dist/wasm.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"wasm.js","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,MAAM,MAAM,GAAG,IAAI,YAAY,CAAe,KAAK,IAAI,EAAE;IACrD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAC9C,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IAClB,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC,CAAC;AAEH,WAAW;AACX,MAAM,CAAC,MAAM,UAAU,GAAgC,MAAM,CAAC,IAAI,CAAC;AACnE,eAAe;AACf,MAAM,CAAC,MAAM,SAAS,GAAuB,MAAM,CAAC,GAAG,CAAC"}