@mirascript/napi 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.
@@ -0,0 +1,2 @@
1
+ export declare const compile: (this: void, script: string | Uint8Array, config: object) => Promise<import("./type.js").CompileResult>, compileSync: (this: void, script: string | Uint8Array, config: object) => import("./type.js").CompileResult;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAQ,OAAO,2GAAE,WAAW,gGAAQ,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import mod from './loader.cjs';
2
+ export const { compile, compileSync } = mod;
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cAAc,CAAC;AAE/B,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC"}
Binary file
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ module.exports = require('#lib');
3
+ //# sourceMappingURL=loader.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.cjs","sourceRoot":"","sources":["../src/loader.cts"],"names":[],"mappings":";AAEA,iBAAS,OAAO,CAAC,MAAM,CAAoB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type type = require('./type');
2
+ declare const _default: type.NapiModule;
3
+ export = _default;
4
+ //# sourceMappingURL=loader.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.cts","sourceRoot":"","sources":["../src/loader.cts"],"names":[],"mappings":"AAAA,YAAY,IAAI,GAAG,QAAQ,QAAQ,CAAC,CAAC;wBAET,IAAI,CAAC,UAAU;AAA3C,kBAA4C"}
package/dist/type.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ /** NAPI 模块 */
2
+ export interface NapiModule {
3
+ /** 编译 Mira 脚本 */
4
+ compile(this: void, script: string | Uint8Array, config: object): Promise<CompileResult>;
5
+ /** 编译 Mira 脚本 */
6
+ compileSync(this: void, script: string | Uint8Array, config: object): CompileResult;
7
+ }
8
+ /** 编译结果 */
9
+ export interface CompileResult {
10
+ /** 编译后的代码块 */
11
+ chunk: Uint8Array;
12
+ /** 编译期间的诊断信息 */
13
+ diagnostics: Uint32Array;
14
+ }
15
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,MAAM,WAAW,UAAU;IACvB,iBAAiB;IACjB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACzF,iBAAiB;IACjB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;CACvF;AAED,WAAW;AACX,MAAM,WAAW,aAAa;IAC1B,cAAc;IACd,KAAK,EAAE,UAAU,CAAC;IAClB,gBAAgB;IAChB,WAAW,EAAE,WAAW,CAAC;CAC5B"}
package/dist/type.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@mirascript/napi",
3
+ "type": "module",
4
+ "version": "0.1.0",
5
+ "description": "MiraScript compiler for Node.JS",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": "./dist/index.js",
9
+ "imports": {
10
+ "#lib": "./dist/index.node"
11
+ },
12
+ "devDependencies": {
13
+ "cargo-cp-artifact": "^0.1.9",
14
+ "nodemon": "^3.1.10"
15
+ },
16
+ "scripts": {
17
+ "napi": "cargo-cp-artifact -ac napi dist/index.node -- cargo build -p napi --message-format=json-render-diagnostics",
18
+ "watch": "nodemon -e rs,js,ts --watch ../../crates/napi --watch ../../crates/core --watch ./src --exec 'pnpm build:dev'",
19
+ "build:dev": "pnpm napi --dev && tsc",
20
+ "build": "pnpm napi --release && tsc",
21
+ "clean": "rimraf dist lib"
22
+ }
23
+ }
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ import mod from './loader.cjs';
2
+
3
+ export const { compile, compileSync } = mod;
package/src/loader.cts ADDED
@@ -0,0 +1,3 @@
1
+ import type type = require('./type');
2
+
3
+ export = require('#lib') as type.NapiModule;
package/src/type.ts ADDED
@@ -0,0 +1,15 @@
1
+ /** NAPI 模块 */
2
+ export interface NapiModule {
3
+ /** 编译 Mira 脚本 */
4
+ compile(this: void, script: string | Uint8Array, config: object): Promise<CompileResult>;
5
+ /** 编译 Mira 脚本 */
6
+ compileSync(this: void, script: string | Uint8Array, config: object): CompileResult;
7
+ }
8
+
9
+ /** 编译结果 */
10
+ export interface CompileResult {
11
+ /** 编译后的代码块 */
12
+ chunk: Uint8Array;
13
+ /** 编译期间的诊断信息 */
14
+ diagnostics: Uint32Array;
15
+ }