@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.
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/index.node +0 -0
- package/dist/loader.cjs +3 -0
- package/dist/loader.cjs.map +1 -0
- package/dist/loader.d.cts +4 -0
- package/dist/loader.d.cts.map +1 -0
- package/dist/type.d.ts +15 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +2 -0
- package/dist/type.js.map +1 -0
- package/package.json +23 -0
- package/src/index.ts +3 -0
- package/src/loader.cts +3 -0
- package/src/type.ts +15 -0
package/dist/index.d.ts
ADDED
|
@@ -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 @@
|
|
|
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"}
|
package/dist/index.node
ADDED
|
Binary file
|
package/dist/loader.cjs
ADDED
|
@@ -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 @@
|
|
|
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
package/dist/type.js.map
ADDED
|
@@ -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
package/src/loader.cts
ADDED
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
|
+
}
|