@powerlines/plugin-napi-rs 0.0.1
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 +201 -0
- package/README.md +304 -0
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/index.cjs +72 -0
- package/dist/index.d.cts +20 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +20 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +69 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types/index.cjs +5 -0
- package/dist/types/index.d.cts +4 -0
- package/dist/types/index.d.mts +4 -0
- package/dist/types/index.mjs +3 -0
- package/dist/types/plugin.cjs +11 -0
- package/dist/types/plugin.d.cts +143 -0
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +143 -0
- package/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/plugin.mjs +12 -0
- package/dist/types/plugin.mjs.map +1 -0
- package/dist/types/targets.cjs +39 -0
- package/dist/types/targets.d.cts +16 -0
- package/dist/types/targets.d.cts.map +1 -0
- package/dist/types/targets.d.mts +16 -0
- package/dist/types/targets.d.mts.map +1 -0
- package/dist/types/targets.mjs +37 -0
- package/dist/types/targets.mjs.map +1 -0
- package/dist/types/wasm.cjs +0 -0
- package/dist/types/wasm.d.cts +44 -0
- package/dist/types/wasm.d.cts.map +1 -0
- package/dist/types/wasm.d.mts +44 -0
- package/dist/types/wasm.d.mts.map +1 -0
- package/dist/types/wasm.mjs +1 -0
- package/package.json +143 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { DEFAULT_TARGETS } from "./types/targets.mjs";
|
|
2
|
+
import { NapiCli, parseTriple } from "@napi-rs/cli";
|
|
3
|
+
import alloy from "@powerlines/plugin-alloy";
|
|
4
|
+
import { appendPath } from "@stryke/path/append";
|
|
5
|
+
import { relativePath } from "@stryke/path/file-path-fns";
|
|
6
|
+
|
|
7
|
+
//#region src/index.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A Powerlines plugin for integrating with N-API Rust modules, providing features such as automatic generation of bindings and runtime integration with N-API Rust modules.
|
|
10
|
+
*
|
|
11
|
+
* @see https://napi.rs/docs
|
|
12
|
+
*/
|
|
13
|
+
const plugin = (options = {}) => {
|
|
14
|
+
return [alloy(), {
|
|
15
|
+
name: "napi-rs",
|
|
16
|
+
config() {
|
|
17
|
+
return { napi: {
|
|
18
|
+
targets: DEFAULT_TARGETS,
|
|
19
|
+
dts: "binding.d.ts",
|
|
20
|
+
jsBinding: "binding.js",
|
|
21
|
+
outputDir: this.config.root,
|
|
22
|
+
platform: true,
|
|
23
|
+
strip: false,
|
|
24
|
+
...options
|
|
25
|
+
} };
|
|
26
|
+
},
|
|
27
|
+
configResolved() {
|
|
28
|
+
this.config.napi.targets = this.config.napi.targets?.map((target) => typeof target === "string" ? parseTriple(target) : target);
|
|
29
|
+
if (this.config.napi.targets.some((target) => target.arch === "wasm32")) this.dependencies["@napi-rs/wasm-runtime"] = "^1.1.4";
|
|
30
|
+
},
|
|
31
|
+
async prepare() {
|
|
32
|
+
this.debug(`Preparing the N-API Rust runtime artifacts for the Powerlines project.`);
|
|
33
|
+
},
|
|
34
|
+
async build() {
|
|
35
|
+
this.debug(`Preparing the N-API Rust runtime artifacts for the Powerlines project.`);
|
|
36
|
+
const cwd = appendPath(this.config.root, this.config.cwd);
|
|
37
|
+
const cli = new NapiCli();
|
|
38
|
+
await Promise.all(this.config.napi?.targets?.map(async (target) => {
|
|
39
|
+
this.debug(`Configured target: ${target.triple} (platform: ${target.platform}, arch: ${target.arch}, abi: ${target.abi})`);
|
|
40
|
+
const { task } = await cli.build({
|
|
41
|
+
cwd,
|
|
42
|
+
outputDir: relativePath(cwd, appendPath(appendPath(this.config.napi.outputDir, this.config.root), this.config.cwd)),
|
|
43
|
+
configPath: this.config.napi.configPath ? relativePath(cwd, appendPath(appendPath(this.config.napi.configPath, this.config.root), this.config.cwd)) : void 0,
|
|
44
|
+
manifestPath: this.config.napi.manifestPath ? relativePath(cwd, appendPath(appendPath(this.config.napi.manifestPath, this.config.root), this.config.cwd)) : void 0,
|
|
45
|
+
target: target.triple,
|
|
46
|
+
profile: this.config.napi.profile,
|
|
47
|
+
release: this.config.napi.release,
|
|
48
|
+
features: this.config.napi.features,
|
|
49
|
+
noDefaultFeatures: this.config.napi.noDefaultFeatures,
|
|
50
|
+
strip: this.config.napi.strip,
|
|
51
|
+
platform: this.config.napi.platform,
|
|
52
|
+
noDtsHeader: this.config.napi.noDtsHeader,
|
|
53
|
+
jsBinding: this.config.napi.jsBinding,
|
|
54
|
+
dts: this.config.napi.dts,
|
|
55
|
+
dtsCache: this.config.napi.dtsCache ?? !this.config.skipCache
|
|
56
|
+
});
|
|
57
|
+
const outputs = await task;
|
|
58
|
+
for (const output of outputs) if (output.kind !== "node") {
|
|
59
|
+
const code = await this.fs.read(output.path);
|
|
60
|
+
if (code) await this.fs.write(output.path, code);
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
}];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { plugin as default, plugin };
|
|
69
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { NapiCli, parseTriple } from \"@napi-rs/cli\";\nimport alloy from \"@powerlines/plugin-alloy\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { Plugin } from \"powerlines\";\nimport type { NapiRsPluginContext, NapiRsPluginOptions } from \"./types/plugin\";\nimport { DEFAULT_TARGETS, Target } from \"./types/targets\";\n\nexport type * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n napi?: NapiRsPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin for integrating with N-API Rust modules, providing features such as automatic generation of bindings and runtime integration with N-API Rust modules.\n *\n * @see https://napi.rs/docs\n */\nexport const plugin = <\n TContext extends NapiRsPluginContext = NapiRsPluginContext\n>(\n options: NapiRsPluginOptions = {}\n) => {\n return [\n alloy(),\n {\n name: \"napi-rs\",\n config() {\n return {\n napi: {\n targets: DEFAULT_TARGETS,\n dts: \"binding.d.ts\",\n jsBinding: \"binding.js\",\n outputDir: this.config.root,\n platform: true,\n strip: false,\n ...options\n }\n };\n },\n configResolved() {\n this.config.napi.targets = this.config.napi.targets?.map(target =>\n typeof target === \"string\" ? parseTriple(target) : target\n );\n if (\n this.config.napi.targets.some(\n (target: Target) => target.arch === \"wasm32\"\n )\n ) {\n this.dependencies[\"@napi-rs/wasm-runtime\"] = \"^1.1.4\";\n }\n },\n async prepare() {\n this.debug(\n `Preparing the N-API Rust runtime artifacts for the Powerlines project.`\n );\n },\n async build() {\n this.debug(\n `Preparing the N-API Rust runtime artifacts for the Powerlines project.`\n );\n\n const cwd = appendPath(this.config.root, this.config.cwd);\n const cli = new NapiCli();\n await Promise.all(\n this.config.napi?.targets?.map(async (target: Target) => {\n this.debug(\n `Configured target: ${target.triple} (platform: ${target.platform}, arch: ${target.arch}, abi: ${target.abi})`\n );\n\n const { task } = await cli.build({\n cwd,\n outputDir: relativePath(\n cwd,\n appendPath(\n appendPath(this.config.napi.outputDir, this.config.root),\n this.config.cwd\n )\n ),\n configPath: this.config.napi.configPath\n ? relativePath(\n cwd,\n appendPath(\n appendPath(this.config.napi.configPath, this.config.root),\n this.config.cwd\n )\n )\n : undefined,\n manifestPath: this.config.napi.manifestPath\n ? relativePath(\n cwd,\n appendPath(\n appendPath(\n this.config.napi.manifestPath,\n this.config.root\n ),\n this.config.cwd\n )\n )\n : undefined,\n target: target.triple,\n profile: this.config.napi.profile,\n release: this.config.napi.release,\n features: this.config.napi.features,\n noDefaultFeatures: this.config.napi.noDefaultFeatures,\n strip: this.config.napi.strip,\n platform: this.config.napi.platform,\n noDtsHeader: this.config.napi.noDtsHeader,\n jsBinding: this.config.napi.jsBinding,\n dts: this.config.napi.dts,\n dtsCache: this.config.napi.dtsCache ?? !this.config.skipCache\n });\n\n const outputs = await task;\n for (const output of outputs) {\n if (output.kind !== \"node\") {\n const code = await this.fs.read(output.path);\n if (code) {\n await this.fs.write(output.path, code);\n }\n }\n }\n })\n );\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AA6BA,MAAY,UAAO,UAAA,EAAA,KAAA;AACjB,QAAO,CAAC,OAAC,EAAA;EACT,MAAA;EACF,SAAA;YAEE,MAAA;IACG,SAAW;IACf,KAAA;IACO,WAAa;IACnB,WAAA,KAAA,OAAA;IACK,UAAa;IACV,OAAC;IACV,GAAA;IACQ,EACJ;;EAED,iBAAO;AACP,QAAA,OAAA,KAAA,UAAA,KAAA,OAAA,KAAA,SAAA,KAAA,WAAA,OAAA,WAAA,WAAA,YAAA,OAAA,GAAA,OAAA;AACE,OAAI,KAAG,OAAQ,KAAA,QAAA,MAAA,WAAA,OAAA,SAAA,SAAA,CACf,MAAO,aAAE,2BAAA;;EAGX,MAAM,UAAU;AACd,QAAK,MAAM,yEAAc;;EAE3B,MAAM,QAAE;AACN,QAAK,MAAC,yEAAc;GACpB,MAAM,MAAM,WAAM,KAAA,OAAA,MAAA,KAAA,OAAA,IAAA;GAClB,MAAM,MAAG,IAAA,SAAA;AACT,SAAI,QAAA,IAAA,KAAA,OAAA,MAAA,SAAA,IAAA,OAAA,WAAA;AACF,SAAC,MAAA,sBAAA,OAAA,OAAA,cAAA,OAAA,SAAA,UAAA,OAAA,KAAA,SAAA,OAAA,IAAA,GAAA;IACF,MAAA,EACD,SACM,MAAC,IAAO,MAAK;KACf;KACD,WAAA,aAAA,KAAA,WAAA,WAAA,KAAA,OAAA,KAAA,WAAA,KAAA,OAAA,KAAA,EAAA,KAAA,OAAA,IAAA,CAAA;KACC,YAAC,KAAA,OAAA,KAAA,aAAA,aAAA,KAAA,WAAA,WAAA,KAAA,OAAA,KAAA,YAAA,KAAA,OAAA,KAAA,EAAA,KAAA,OAAA,IAAA,CAAA,GAAA;KACD,cAAY,KAAK,OAAQ,KAAI,eAAA,aAAA,KAAA,WAAA,WAAA,KAAA,OAAA,KAAA,cAAA,KAAA,OAAA,KAAA,EAAA,KAAA,OAAA,IAAA,CAAA,GAAA;KAC7B,QAAG,OAAQ;KACX,SAAA,KAAA,OAAA,KAAA;KACA,SAAA,KAAA,OAAA,KAAA;KACA,UAAK,KAAA,OAAe,KAAO;KAC7B,mBAAA,KAAA,OAAA,KAAA;KACD,OAAA,KAAA,OAAA,KAAA;KACD,UAAc,KAAE,OAAA,KAAA;KACd,aAAU,KAAA,OAAA,KAAA;KACR,WAAW,KAAK,OAAK,KAAK;KAC3B,KAAA,KAAA,OAAA,KAAA;KACF,UAAA,KAAA,OAAA,KAAA,YAAA,CAAA,KAAA,OAAA;KACD,CAAA;IACE,MAAK,UAAK,MAAA;AACV,SAAG,MAAA,UAAgB,QAClB,KAAA,OAAA,SAAA,QAAA;;AAED,SAAM,KACA,OAAM,KAAI,GAAA,MAAS,OAAA,MAAA,KAAA;;KAIzB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AVAILABLE_TARGETS, DEFAULT_TARGETS, Platform, Target, TargetTriple } from "./targets.cjs";
|
|
2
|
+
import { WasmBrowserOptions, WasmOptions } from "./wasm.cjs";
|
|
3
|
+
import { NapiRsPluginContext, NapiRsPluginOptions, NapiRsPluginResolvedConfig, NapiRsPluginUserConfig, NapiRsResolvedPluginOptions } from "./plugin.cjs";
|
|
4
|
+
export { AVAILABLE_TARGETS, DEFAULT_TARGETS, NapiRsPluginContext, NapiRsPluginOptions, NapiRsPluginResolvedConfig, NapiRsPluginUserConfig, NapiRsResolvedPluginOptions, Platform, Target, TargetTriple, WasmBrowserOptions, WasmOptions };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AVAILABLE_TARGETS, DEFAULT_TARGETS, Platform, Target, TargetTriple } from "./targets.mjs";
|
|
2
|
+
import { WasmBrowserOptions, WasmOptions } from "./wasm.mjs";
|
|
3
|
+
import { NapiRsPluginContext, NapiRsPluginOptions, NapiRsPluginResolvedConfig, NapiRsPluginUserConfig, NapiRsResolvedPluginOptions } from "./plugin.mjs";
|
|
4
|
+
export { AVAILABLE_TARGETS, DEFAULT_TARGETS, NapiRsPluginContext, NapiRsPluginOptions, NapiRsPluginResolvedConfig, NapiRsPluginUserConfig, NapiRsResolvedPluginOptions, Platform, Target, TargetTriple, WasmBrowserOptions, WasmOptions };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/types/plugin.ts
|
|
3
|
+
/**
|
|
4
|
+
* The options for the N-API Rust plugin.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* These options are based on the options for the N-API Rust CLI, and are used to configure the plugin's behavior when building and generating bindings for N-API Rust modules.
|
|
8
|
+
*
|
|
9
|
+
* @see https://napi.rs/docs/cli/build#options
|
|
10
|
+
*/
|
|
11
|
+
//#endregion
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Target, TargetTriple } from "./targets.cjs";
|
|
2
|
+
import { WasmOptions } from "./wasm.cjs";
|
|
3
|
+
import { AlloyPluginContext, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "@powerlines/plugin-alloy/types";
|
|
4
|
+
import { BabelPluginContext, BabelPluginResolvedConfig, BabelPluginUserConfig } from "@powerlines/plugin-babel/types";
|
|
5
|
+
import { RequiredKeys } from "@stryke/types/base";
|
|
6
|
+
|
|
7
|
+
//#region src/types/plugin.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* The options for the N-API Rust plugin.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* These options are based on the options for the N-API Rust CLI, and are used to configure the plugin's behavior when building and generating bindings for N-API Rust modules.
|
|
13
|
+
*
|
|
14
|
+
* @see https://napi.rs/docs/cli/build#options
|
|
15
|
+
*/
|
|
16
|
+
interface NapiRsPluginOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Build only the specified binary
|
|
19
|
+
*/
|
|
20
|
+
binaryName?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Package name in generated JS binding file. Works only with --platform
|
|
23
|
+
*/
|
|
24
|
+
packageName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Build for the target triple, bypassed to `cargo build --target`
|
|
27
|
+
*/
|
|
28
|
+
targets?: (TargetTriple | Target)[];
|
|
29
|
+
/**
|
|
30
|
+
* Build artifacts with the specified Cargo profile
|
|
31
|
+
*/
|
|
32
|
+
profile?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Wasm compilation options. If specified, the plugin will compile the N-API Rust module to WebAssembly and generate the corresponding bindings.
|
|
35
|
+
*/
|
|
36
|
+
wasm?: WasmOptions;
|
|
37
|
+
/**
|
|
38
|
+
* Build in release mode
|
|
39
|
+
*/
|
|
40
|
+
release?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* List of Cargo features to activate
|
|
43
|
+
*/
|
|
44
|
+
features?: Array<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Activate all available Cargo features
|
|
47
|
+
*/
|
|
48
|
+
allFeatures?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Do not activate the default features
|
|
51
|
+
*
|
|
52
|
+
* @defaultValue false
|
|
53
|
+
*/
|
|
54
|
+
noDefaultFeatures?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Path and filename of generated JS binding file. Only works with {@link platform} flag. Relative to {@link outputPath}.
|
|
57
|
+
*
|
|
58
|
+
* @defaultValue "binding.js"
|
|
59
|
+
*/
|
|
60
|
+
jsBinding?: string;
|
|
61
|
+
/**
|
|
62
|
+
* DTS Binding File
|
|
63
|
+
*
|
|
64
|
+
* The path to the output TypeScript declaration file
|
|
65
|
+
*
|
|
66
|
+
* @defaultValue "binding.d.ts"
|
|
67
|
+
*/
|
|
68
|
+
dts?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The path to the Cargo.toml manifest file
|
|
71
|
+
*/
|
|
72
|
+
manifestPath?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Path to [NAPI-RS config file](https://napi.rs/docs/cli/napi-config)
|
|
75
|
+
*/
|
|
76
|
+
configPath?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Path to where all the built files would be put. Default to the crate folder if not specified. Relative to the project root.
|
|
79
|
+
*/
|
|
80
|
+
outputDir?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Directory for all crate generated artifacts, see `cargo build --target-dir`
|
|
83
|
+
*/
|
|
84
|
+
targetDir?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Add platform triple suffix to generated Node.js binding file, e.g. [name].linux-x64-gnu.node
|
|
87
|
+
*
|
|
88
|
+
* @defaultValue true
|
|
89
|
+
*/
|
|
90
|
+
platform?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Whether to generate const enum for TypeScript bindings
|
|
93
|
+
*/
|
|
94
|
+
constEnum?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Disable generation of JS binding file. Works only with --platform
|
|
97
|
+
*/
|
|
98
|
+
noJsBinding?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Custom file header for generated type def file (requires typedef feature)
|
|
101
|
+
*/
|
|
102
|
+
dtsHeader?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Disable default file header for generated type def file (requires typedef feature)
|
|
105
|
+
*/
|
|
106
|
+
noDtsHeader?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Enable the DTS cache
|
|
109
|
+
*/
|
|
110
|
+
dtsCache?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Strip the library to minimize file size
|
|
113
|
+
*/
|
|
114
|
+
strip?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Cross-compile for the specified target with cargo-xwin on Windows and cargo-zigbuild on other platforms
|
|
117
|
+
*/
|
|
118
|
+
crossCompile?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Use [cross-rs](https://github.com/cross-rs/cross) instead of cargo
|
|
121
|
+
*/
|
|
122
|
+
useCross?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Use \@napi-rs/cross-toolchain to cross-compile Linux arm/arm64/x64 gnu targets
|
|
125
|
+
*/
|
|
126
|
+
useNapiCross?: boolean;
|
|
127
|
+
}
|
|
128
|
+
type NapiRsPluginUserConfig = BabelPluginUserConfig & AlloyPluginUserConfig & {
|
|
129
|
+
napi: NapiRsPluginOptions;
|
|
130
|
+
};
|
|
131
|
+
type NapiRsResolvedPluginOptions = RequiredKeys<Omit<NapiRsPluginOptions, "targets">, "dts" | "jsBinding" | "manifestPath" | "outputDir" | "platform"> & {
|
|
132
|
+
/**
|
|
133
|
+
* The resolved target triples to build for, with additional metadata such as platform, architecture, and ABI information. These are derived from the `targets` option, and are used internally by the plugin to determine how to build the N-API Rust module for each target.
|
|
134
|
+
*/
|
|
135
|
+
targets: Target[];
|
|
136
|
+
};
|
|
137
|
+
type NapiRsPluginResolvedConfig = BabelPluginResolvedConfig & AlloyPluginResolvedConfig & {
|
|
138
|
+
napi: NapiRsResolvedPluginOptions;
|
|
139
|
+
};
|
|
140
|
+
interface NapiRsPluginContext<TResolvedConfig extends NapiRsPluginResolvedConfig = NapiRsPluginResolvedConfig> extends BabelPluginContext<TResolvedConfig>, AlloyPluginContext<TResolvedConfig> {}
|
|
141
|
+
//#endregion
|
|
142
|
+
export { NapiRsPluginContext, NapiRsPluginOptions, NapiRsPluginResolvedConfig, NapiRsPluginUserConfig, NapiRsResolvedPluginOptions };
|
|
143
|
+
//# sourceMappingURL=plugin.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;AAwCA;;;;;;UAAiB,mBAAA;EAkCC;;;EA9BhB,UAAA;EAUA;;;EALA,WAAA;EAeA;;;EAVA,OAAA,IAAW,YAAA,GAAe,MAAA;EAoBf;;;EAfX,OAAA;EA2CA;;;EAtCA,IAAA,GAAO,WAAA;EA0DP;;;EArDA,OAAA;EA2EA;;;EAtEA,QAAA,GAAW,KAAA;EA0FX;;;EArFA,WAAA;EA+FY;AAGd;;;;EA3FE,iBAAA;EA6FQ;;;;;EAtFR,SAAA;EAsFQ;;;AAGV;;;;EAhFE,GAAA;EAgFwC;;;EA3ExC,YAAA;EA2EwC;;;EAtExC,UAAA;EA6ES;;;EAxET,SAAA;EA2EoC;;;EAtEpC,SAAA;EAwEQ;;;;;EAjER,QAAA;EAiEQ;;;EA5DR,SAAA;EA+DkC;;;EA1DlC,WAAA;EA+DqB;;;EA1DrB,SAAA;EA2DoB;;;EAtDpB,WAAA;EAkDE;;;EA7CF,QAAA;EAiDqB;;;EA5CrB,KAAA;;;;EAKA,YAAA;;;;EAKA,QAAA;;;;EAKA,YAAA;AAAA;AAAA,KAGU,sBAAA,GAAyB,qBAAA,GACnC,qBAAA;EACE,IAAA,EAAM,mBAAA;AAAA;AAAA,KAGE,2BAAA,GAA8B,YAAA,CACxC,IAAA,CAAK,mBAAA;;;;EAML,OAAA,EAAS,MAAA;AAAA;AAAA,KAGC,0BAAA,GAA6B,yBAAA,GACvC,yBAAA;EACE,IAAA,EAAM,2BAAA;AAAA;AAAA,UAGO,mBAAA,yBACS,0BAAA,GACtB,0BAAA,UAGA,kBAAA,CAAmB,eAAA,GACnB,kBAAA,CAAmB,eAAA"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Target, TargetTriple } from "./targets.mjs";
|
|
2
|
+
import { WasmOptions } from "./wasm.mjs";
|
|
3
|
+
import { AlloyPluginContext, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "@powerlines/plugin-alloy/types";
|
|
4
|
+
import { BabelPluginContext, BabelPluginResolvedConfig, BabelPluginUserConfig } from "@powerlines/plugin-babel/types";
|
|
5
|
+
import { RequiredKeys } from "@stryke/types/base";
|
|
6
|
+
|
|
7
|
+
//#region src/types/plugin.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* The options for the N-API Rust plugin.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* These options are based on the options for the N-API Rust CLI, and are used to configure the plugin's behavior when building and generating bindings for N-API Rust modules.
|
|
13
|
+
*
|
|
14
|
+
* @see https://napi.rs/docs/cli/build#options
|
|
15
|
+
*/
|
|
16
|
+
interface NapiRsPluginOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Build only the specified binary
|
|
19
|
+
*/
|
|
20
|
+
binaryName?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Package name in generated JS binding file. Works only with --platform
|
|
23
|
+
*/
|
|
24
|
+
packageName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Build for the target triple, bypassed to `cargo build --target`
|
|
27
|
+
*/
|
|
28
|
+
targets?: (TargetTriple | Target)[];
|
|
29
|
+
/**
|
|
30
|
+
* Build artifacts with the specified Cargo profile
|
|
31
|
+
*/
|
|
32
|
+
profile?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Wasm compilation options. If specified, the plugin will compile the N-API Rust module to WebAssembly and generate the corresponding bindings.
|
|
35
|
+
*/
|
|
36
|
+
wasm?: WasmOptions;
|
|
37
|
+
/**
|
|
38
|
+
* Build in release mode
|
|
39
|
+
*/
|
|
40
|
+
release?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* List of Cargo features to activate
|
|
43
|
+
*/
|
|
44
|
+
features?: Array<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Activate all available Cargo features
|
|
47
|
+
*/
|
|
48
|
+
allFeatures?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Do not activate the default features
|
|
51
|
+
*
|
|
52
|
+
* @defaultValue false
|
|
53
|
+
*/
|
|
54
|
+
noDefaultFeatures?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Path and filename of generated JS binding file. Only works with {@link platform} flag. Relative to {@link outputPath}.
|
|
57
|
+
*
|
|
58
|
+
* @defaultValue "binding.js"
|
|
59
|
+
*/
|
|
60
|
+
jsBinding?: string;
|
|
61
|
+
/**
|
|
62
|
+
* DTS Binding File
|
|
63
|
+
*
|
|
64
|
+
* The path to the output TypeScript declaration file
|
|
65
|
+
*
|
|
66
|
+
* @defaultValue "binding.d.ts"
|
|
67
|
+
*/
|
|
68
|
+
dts?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The path to the Cargo.toml manifest file
|
|
71
|
+
*/
|
|
72
|
+
manifestPath?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Path to [NAPI-RS config file](https://napi.rs/docs/cli/napi-config)
|
|
75
|
+
*/
|
|
76
|
+
configPath?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Path to where all the built files would be put. Default to the crate folder if not specified. Relative to the project root.
|
|
79
|
+
*/
|
|
80
|
+
outputDir?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Directory for all crate generated artifacts, see `cargo build --target-dir`
|
|
83
|
+
*/
|
|
84
|
+
targetDir?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Add platform triple suffix to generated Node.js binding file, e.g. [name].linux-x64-gnu.node
|
|
87
|
+
*
|
|
88
|
+
* @defaultValue true
|
|
89
|
+
*/
|
|
90
|
+
platform?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Whether to generate const enum for TypeScript bindings
|
|
93
|
+
*/
|
|
94
|
+
constEnum?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Disable generation of JS binding file. Works only with --platform
|
|
97
|
+
*/
|
|
98
|
+
noJsBinding?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Custom file header for generated type def file (requires typedef feature)
|
|
101
|
+
*/
|
|
102
|
+
dtsHeader?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Disable default file header for generated type def file (requires typedef feature)
|
|
105
|
+
*/
|
|
106
|
+
noDtsHeader?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Enable the DTS cache
|
|
109
|
+
*/
|
|
110
|
+
dtsCache?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Strip the library to minimize file size
|
|
113
|
+
*/
|
|
114
|
+
strip?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Cross-compile for the specified target with cargo-xwin on Windows and cargo-zigbuild on other platforms
|
|
117
|
+
*/
|
|
118
|
+
crossCompile?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Use [cross-rs](https://github.com/cross-rs/cross) instead of cargo
|
|
121
|
+
*/
|
|
122
|
+
useCross?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Use \@napi-rs/cross-toolchain to cross-compile Linux arm/arm64/x64 gnu targets
|
|
125
|
+
*/
|
|
126
|
+
useNapiCross?: boolean;
|
|
127
|
+
}
|
|
128
|
+
type NapiRsPluginUserConfig = BabelPluginUserConfig & AlloyPluginUserConfig & {
|
|
129
|
+
napi: NapiRsPluginOptions;
|
|
130
|
+
};
|
|
131
|
+
type NapiRsResolvedPluginOptions = RequiredKeys<Omit<NapiRsPluginOptions, "targets">, "dts" | "jsBinding" | "manifestPath" | "outputDir" | "platform"> & {
|
|
132
|
+
/**
|
|
133
|
+
* The resolved target triples to build for, with additional metadata such as platform, architecture, and ABI information. These are derived from the `targets` option, and are used internally by the plugin to determine how to build the N-API Rust module for each target.
|
|
134
|
+
*/
|
|
135
|
+
targets: Target[];
|
|
136
|
+
};
|
|
137
|
+
type NapiRsPluginResolvedConfig = BabelPluginResolvedConfig & AlloyPluginResolvedConfig & {
|
|
138
|
+
napi: NapiRsResolvedPluginOptions;
|
|
139
|
+
};
|
|
140
|
+
interface NapiRsPluginContext<TResolvedConfig extends NapiRsPluginResolvedConfig = NapiRsPluginResolvedConfig> extends BabelPluginContext<TResolvedConfig>, AlloyPluginContext<TResolvedConfig> {}
|
|
141
|
+
//#endregion
|
|
142
|
+
export { NapiRsPluginContext, NapiRsPluginOptions, NapiRsPluginResolvedConfig, NapiRsPluginUserConfig, NapiRsResolvedPluginOptions };
|
|
143
|
+
//# sourceMappingURL=plugin.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;AAwCA;;;;;;UAAiB,mBAAA;EAkCC;;;EA9BhB,UAAA;EAUA;;;EALA,WAAA;EAeA;;;EAVA,OAAA,IAAW,YAAA,GAAe,MAAA;EAoBf;;;EAfX,OAAA;EA2CA;;;EAtCA,IAAA,GAAO,WAAA;EA0DP;;;EArDA,OAAA;EA2EA;;;EAtEA,QAAA,GAAW,KAAA;EA0FX;;;EArFA,WAAA;EA+FY;AAGd;;;;EA3FE,iBAAA;EA6FQ;;;;;EAtFR,SAAA;EAsFQ;;;AAGV;;;;EAhFE,GAAA;EAgFwC;;;EA3ExC,YAAA;EA2EwC;;;EAtExC,UAAA;EA6ES;;;EAxET,SAAA;EA2EoC;;;EAtEpC,SAAA;EAwEQ;;;;;EAjER,QAAA;EAiEQ;;;EA5DR,SAAA;EA+DkC;;;EA1DlC,WAAA;EA+DqB;;;EA1DrB,SAAA;EA2DoB;;;EAtDpB,WAAA;EAkDE;;;EA7CF,QAAA;EAiDqB;;;EA5CrB,KAAA;;;;EAKA,YAAA;;;;EAKA,QAAA;;;;EAKA,YAAA;AAAA;AAAA,KAGU,sBAAA,GAAyB,qBAAA,GACnC,qBAAA;EACE,IAAA,EAAM,mBAAA;AAAA;AAAA,KAGE,2BAAA,GAA8B,YAAA,CACxC,IAAA,CAAK,mBAAA;;;;EAML,OAAA,EAAS,MAAA;AAAA;AAAA,KAGC,0BAAA,GAA6B,yBAAA,GACvC,yBAAA;EACE,IAAA,EAAM,2BAAA;AAAA;AAAA,UAGO,mBAAA,yBACS,0BAAA,GACtB,0BAAA,UAGA,kBAAA,CAAmB,eAAA,GACnB,kBAAA,CAAmB,eAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/types/plugin.ts
|
|
2
|
+
/**
|
|
3
|
+
* The options for the N-API Rust plugin.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* These options are based on the options for the N-API Rust CLI, and are used to configure the plugin's behavior when building and generating bindings for N-API Rust modules.
|
|
7
|
+
*
|
|
8
|
+
* @see https://napi.rs/docs/cli/build#options
|
|
9
|
+
*/
|
|
10
|
+
//#endregion
|
|
11
|
+
export { };
|
|
12
|
+
//# sourceMappingURL=plugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n AlloyPluginContext,\n AlloyPluginResolvedConfig,\n AlloyPluginUserConfig\n} from \"@powerlines/plugin-alloy/types\";\nimport type {\n BabelPluginContext,\n BabelPluginResolvedConfig,\n BabelPluginUserConfig\n} from \"@powerlines/plugin-babel/types\";\nimport { RequiredKeys } from \"@stryke/types/base\";\nimport { Target, TargetTriple } from \"./targets\";\nimport { WasmOptions } from \"./wasm\";\n\n/**\n * The options for the N-API Rust plugin.\n *\n * @remarks\n * These options are based on the options for the N-API Rust CLI, and are used to configure the plugin's behavior when building and generating bindings for N-API Rust modules.\n *\n * @see https://napi.rs/docs/cli/build#options\n */\nexport interface NapiRsPluginOptions {\n /**\n * Build only the specified binary\n */\n binaryName?: string;\n\n /**\n * Package name in generated JS binding file. Works only with --platform\n */\n packageName?: string;\n\n /**\n * Build for the target triple, bypassed to `cargo build --target`\n */\n targets?: (TargetTriple | Target)[];\n\n /**\n * Build artifacts with the specified Cargo profile\n */\n profile?: string;\n\n /**\n * Wasm compilation options. If specified, the plugin will compile the N-API Rust module to WebAssembly and generate the corresponding bindings.\n */\n wasm?: WasmOptions;\n\n /**\n * Build in release mode\n */\n release?: boolean;\n\n /**\n * List of Cargo features to activate\n */\n features?: Array<string>;\n\n /**\n * Activate all available Cargo features\n */\n allFeatures?: boolean;\n\n /**\n * Do not activate the default features\n *\n * @defaultValue false\n */\n noDefaultFeatures?: boolean;\n\n /**\n * Path and filename of generated JS binding file. Only works with {@link platform} flag. Relative to {@link outputPath}.\n *\n * @defaultValue \"binding.js\"\n */\n jsBinding?: string;\n\n /**\n * DTS Binding File\n *\n * The path to the output TypeScript declaration file\n *\n * @defaultValue \"binding.d.ts\"\n */\n dts?: string;\n\n /**\n * The path to the Cargo.toml manifest file\n */\n manifestPath?: string;\n\n /**\n * Path to [NAPI-RS config file](https://napi.rs/docs/cli/napi-config)\n */\n configPath?: string;\n\n /**\n * Path to where all the built files would be put. Default to the crate folder if not specified. Relative to the project root.\n */\n outputDir?: string;\n\n /**\n * \tDirectory for all crate generated artifacts, see `cargo build --target-dir`\n */\n targetDir?: string;\n\n /**\n * Add platform triple suffix to generated Node.js binding file, e.g. [name].linux-x64-gnu.node\n *\n * @defaultValue true\n */\n platform?: boolean;\n\n /**\n * Whether to generate const enum for TypeScript bindings\n */\n constEnum?: boolean;\n\n /**\n * Disable generation of JS binding file. Works only with --platform\n */\n noJsBinding?: boolean;\n\n /**\n * Custom file header for generated type def file (requires typedef feature)\n */\n dtsHeader?: string;\n\n /**\n * Disable default file header for generated type def file (requires typedef feature)\n */\n noDtsHeader?: boolean;\n\n /**\n * Enable the DTS cache\n */\n dtsCache?: boolean;\n\n /**\n * Strip the library to minimize file size\n */\n strip?: boolean;\n\n /**\n * Cross-compile for the specified target with cargo-xwin on Windows and cargo-zigbuild on other platforms\n */\n crossCompile?: boolean;\n\n /**\n * Use [cross-rs](https://github.com/cross-rs/cross) instead of cargo\n */\n useCross?: boolean;\n\n /**\n * Use \\@napi-rs/cross-toolchain to cross-compile Linux arm/arm64/x64 gnu targets\n */\n useNapiCross?: boolean;\n}\n\nexport type NapiRsPluginUserConfig = BabelPluginUserConfig &\n AlloyPluginUserConfig & {\n napi: NapiRsPluginOptions;\n };\n\nexport type NapiRsResolvedPluginOptions = RequiredKeys<\n Omit<NapiRsPluginOptions, \"targets\">,\n \"dts\" | \"jsBinding\" | \"manifestPath\" | \"outputDir\" | \"platform\"\n> & {\n /**\n * The resolved target triples to build for, with additional metadata such as platform, architecture, and ABI information. These are derived from the `targets` option, and are used internally by the plugin to determine how to build the N-API Rust module for each target.\n */\n targets: Target[];\n};\n\nexport type NapiRsPluginResolvedConfig = BabelPluginResolvedConfig &\n AlloyPluginResolvedConfig & {\n napi: NapiRsResolvedPluginOptions;\n };\n\nexport interface NapiRsPluginContext<\n TResolvedConfig extends NapiRsPluginResolvedConfig =\n NapiRsPluginResolvedConfig\n>\n extends\n BabelPluginContext<TResolvedConfig>,\n AlloyPluginContext<TResolvedConfig> {}\n"],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
//#region src/types/targets.ts
|
|
4
|
+
const AVAILABLE_TARGETS = [
|
|
5
|
+
"aarch64-apple-darwin",
|
|
6
|
+
"aarch64-linux-android",
|
|
7
|
+
"aarch64-unknown-linux-gnu",
|
|
8
|
+
"aarch64-unknown-linux-musl",
|
|
9
|
+
"aarch64-unknown-linux-ohos",
|
|
10
|
+
"aarch64-pc-windows-msvc",
|
|
11
|
+
"x86_64-apple-darwin",
|
|
12
|
+
"x86_64-pc-windows-msvc",
|
|
13
|
+
"x86_64-pc-windows-gnu",
|
|
14
|
+
"x86_64-unknown-linux-gnu",
|
|
15
|
+
"x86_64-unknown-linux-musl",
|
|
16
|
+
"x86_64-unknown-linux-ohos",
|
|
17
|
+
"x86_64-unknown-freebsd",
|
|
18
|
+
"i686-pc-windows-msvc",
|
|
19
|
+
"armv7-unknown-linux-gnueabihf",
|
|
20
|
+
"armv7-unknown-linux-musleabihf",
|
|
21
|
+
"armv7-linux-androideabi",
|
|
22
|
+
"universal-apple-darwin",
|
|
23
|
+
"loongarch64-unknown-linux-gnu",
|
|
24
|
+
"riscv64gc-unknown-linux-gnu",
|
|
25
|
+
"powerpc64le-unknown-linux-gnu",
|
|
26
|
+
"s390x-unknown-linux-gnu",
|
|
27
|
+
"wasm32-wasi-preview1-threads",
|
|
28
|
+
"wasm32-wasip1-threads"
|
|
29
|
+
];
|
|
30
|
+
const DEFAULT_TARGETS = [
|
|
31
|
+
"x86_64-apple-darwin",
|
|
32
|
+
"aarch64-apple-darwin",
|
|
33
|
+
"x86_64-pc-windows-msvc",
|
|
34
|
+
"x86_64-unknown-linux-gnu"
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
exports.AVAILABLE_TARGETS = AVAILABLE_TARGETS;
|
|
39
|
+
exports.DEFAULT_TARGETS = DEFAULT_TARGETS;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/types/targets.d.ts
|
|
2
|
+
declare const AVAILABLE_TARGETS: readonly ["aarch64-apple-darwin", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "aarch64-unknown-linux-ohos", "aarch64-pc-windows-msvc", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-pc-windows-gnu", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-unknown-linux-ohos", "x86_64-unknown-freebsd", "i686-pc-windows-msvc", "armv7-unknown-linux-gnueabihf", "armv7-unknown-linux-musleabihf", "armv7-linux-androideabi", "universal-apple-darwin", "loongarch64-unknown-linux-gnu", "riscv64gc-unknown-linux-gnu", "powerpc64le-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-wasi-preview1-threads", "wasm32-wasip1-threads"];
|
|
3
|
+
type TargetTriple = (typeof AVAILABLE_TARGETS)[number];
|
|
4
|
+
declare const DEFAULT_TARGETS: readonly ["x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"];
|
|
5
|
+
type Platform = NodeJS.Platform | "wasm" | "wasi" | "openharmony";
|
|
6
|
+
type NodeJSArch = "arm" | "arm64" | "ia32" | "loong64" | "mips" | "mipsel" | "ppc" | "ppc64" | "riscv64" | "s390" | "s390x" | "x32" | "x64" | "universal" | "wasm32";
|
|
7
|
+
interface Target {
|
|
8
|
+
triple: string;
|
|
9
|
+
platformArchABI: string;
|
|
10
|
+
platform: Platform;
|
|
11
|
+
arch: NodeJSArch;
|
|
12
|
+
abi: string | null;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { AVAILABLE_TARGETS, DEFAULT_TARGETS, Platform, Target, TargetTriple };
|
|
16
|
+
//# sourceMappingURL=targets.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"targets.d.cts","names":[],"sources":["../../src/types/targets.ts"],"mappings":";cAkBa,iBAAA;AAAA,KA2BD,YAAA,WAAuB,iBAAA;AAAA,cAEtB,eAAA;AAAA,KAOD,QAAA,GAAW,MAAA,CAAO,QAAA;AAAA,KAGzB,UAAA;AAAA,UAiBY,MAAA;EACf,MAAA;EACA,eAAA;EACA,QAAA,EAAU,QAAA;EACV,IAAA,EAAM,UAAA;EACN,GAAA;AAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/types/targets.d.ts
|
|
2
|
+
declare const AVAILABLE_TARGETS: readonly ["aarch64-apple-darwin", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "aarch64-unknown-linux-ohos", "aarch64-pc-windows-msvc", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-pc-windows-gnu", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-unknown-linux-ohos", "x86_64-unknown-freebsd", "i686-pc-windows-msvc", "armv7-unknown-linux-gnueabihf", "armv7-unknown-linux-musleabihf", "armv7-linux-androideabi", "universal-apple-darwin", "loongarch64-unknown-linux-gnu", "riscv64gc-unknown-linux-gnu", "powerpc64le-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-wasi-preview1-threads", "wasm32-wasip1-threads"];
|
|
3
|
+
type TargetTriple = (typeof AVAILABLE_TARGETS)[number];
|
|
4
|
+
declare const DEFAULT_TARGETS: readonly ["x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"];
|
|
5
|
+
type Platform = NodeJS.Platform | "wasm" | "wasi" | "openharmony";
|
|
6
|
+
type NodeJSArch = "arm" | "arm64" | "ia32" | "loong64" | "mips" | "mipsel" | "ppc" | "ppc64" | "riscv64" | "s390" | "s390x" | "x32" | "x64" | "universal" | "wasm32";
|
|
7
|
+
interface Target {
|
|
8
|
+
triple: string;
|
|
9
|
+
platformArchABI: string;
|
|
10
|
+
platform: Platform;
|
|
11
|
+
arch: NodeJSArch;
|
|
12
|
+
abi: string | null;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { AVAILABLE_TARGETS, DEFAULT_TARGETS, Platform, Target, TargetTriple };
|
|
16
|
+
//# sourceMappingURL=targets.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"targets.d.mts","names":[],"sources":["../../src/types/targets.ts"],"mappings":";cAkBa,iBAAA;AAAA,KA2BD,YAAA,WAAuB,iBAAA;AAAA,cAEtB,eAAA;AAAA,KAOD,QAAA,GAAW,MAAA,CAAO,QAAA;AAAA,KAGzB,UAAA;AAAA,UAiBY,MAAA;EACf,MAAA;EACA,eAAA;EACA,QAAA,EAAU,QAAA;EACV,IAAA,EAAM,UAAA;EACN,GAAA;AAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region src/types/targets.ts
|
|
2
|
+
const AVAILABLE_TARGETS = [
|
|
3
|
+
"aarch64-apple-darwin",
|
|
4
|
+
"aarch64-linux-android",
|
|
5
|
+
"aarch64-unknown-linux-gnu",
|
|
6
|
+
"aarch64-unknown-linux-musl",
|
|
7
|
+
"aarch64-unknown-linux-ohos",
|
|
8
|
+
"aarch64-pc-windows-msvc",
|
|
9
|
+
"x86_64-apple-darwin",
|
|
10
|
+
"x86_64-pc-windows-msvc",
|
|
11
|
+
"x86_64-pc-windows-gnu",
|
|
12
|
+
"x86_64-unknown-linux-gnu",
|
|
13
|
+
"x86_64-unknown-linux-musl",
|
|
14
|
+
"x86_64-unknown-linux-ohos",
|
|
15
|
+
"x86_64-unknown-freebsd",
|
|
16
|
+
"i686-pc-windows-msvc",
|
|
17
|
+
"armv7-unknown-linux-gnueabihf",
|
|
18
|
+
"armv7-unknown-linux-musleabihf",
|
|
19
|
+
"armv7-linux-androideabi",
|
|
20
|
+
"universal-apple-darwin",
|
|
21
|
+
"loongarch64-unknown-linux-gnu",
|
|
22
|
+
"riscv64gc-unknown-linux-gnu",
|
|
23
|
+
"powerpc64le-unknown-linux-gnu",
|
|
24
|
+
"s390x-unknown-linux-gnu",
|
|
25
|
+
"wasm32-wasi-preview1-threads",
|
|
26
|
+
"wasm32-wasip1-threads"
|
|
27
|
+
];
|
|
28
|
+
const DEFAULT_TARGETS = [
|
|
29
|
+
"x86_64-apple-darwin",
|
|
30
|
+
"aarch64-apple-darwin",
|
|
31
|
+
"x86_64-pc-windows-msvc",
|
|
32
|
+
"x86_64-unknown-linux-gnu"
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { AVAILABLE_TARGETS, DEFAULT_TARGETS };
|
|
37
|
+
//# sourceMappingURL=targets.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"targets.mjs","names":[],"sources":["../../src/types/targets.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const AVAILABLE_TARGETS = [\n \"aarch64-apple-darwin\",\n \"aarch64-linux-android\",\n \"aarch64-unknown-linux-gnu\",\n \"aarch64-unknown-linux-musl\",\n \"aarch64-unknown-linux-ohos\",\n \"aarch64-pc-windows-msvc\",\n \"x86_64-apple-darwin\",\n \"x86_64-pc-windows-msvc\",\n \"x86_64-pc-windows-gnu\",\n \"x86_64-unknown-linux-gnu\",\n \"x86_64-unknown-linux-musl\",\n \"x86_64-unknown-linux-ohos\",\n \"x86_64-unknown-freebsd\",\n \"i686-pc-windows-msvc\",\n \"armv7-unknown-linux-gnueabihf\",\n \"armv7-unknown-linux-musleabihf\",\n \"armv7-linux-androideabi\",\n \"universal-apple-darwin\",\n \"loongarch64-unknown-linux-gnu\",\n \"riscv64gc-unknown-linux-gnu\",\n \"powerpc64le-unknown-linux-gnu\",\n \"s390x-unknown-linux-gnu\",\n \"wasm32-wasi-preview1-threads\",\n \"wasm32-wasip1-threads\"\n] as const;\n\nexport type TargetTriple = (typeof AVAILABLE_TARGETS)[number];\n\nexport const DEFAULT_TARGETS = [\n \"x86_64-apple-darwin\",\n \"aarch64-apple-darwin\",\n \"x86_64-pc-windows-msvc\",\n \"x86_64-unknown-linux-gnu\"\n] as const;\n\nexport type Platform = NodeJS.Platform | \"wasm\" | \"wasi\" | \"openharmony\";\n\n// https://nodejs.org/api/process.html#process_process_arch\ntype NodeJSArch =\n | \"arm\"\n | \"arm64\"\n | \"ia32\"\n | \"loong64\"\n | \"mips\"\n | \"mipsel\"\n | \"ppc\"\n | \"ppc64\"\n | \"riscv64\"\n | \"s390\"\n | \"s390x\"\n | \"x32\"\n | \"x64\"\n | \"universal\"\n | \"wasm32\";\n\nexport interface Target {\n triple: string;\n platformArchABI: string;\n platform: Platform;\n arch: NodeJSArch;\n abi: string | null;\n}\n"],"mappings":";AAkBA,MAAa,oBAAoB;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AACjC,MAAW,kBAAa;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/types/wasm.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Wasm Browser compilation options
|
|
4
|
+
*/
|
|
5
|
+
interface WasmBrowserOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Whether to use fs module in browser
|
|
8
|
+
*/
|
|
9
|
+
fs?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether to initialize wasm asynchronously
|
|
12
|
+
*/
|
|
13
|
+
asyncInit?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether to inject `buffer` to emnapi context
|
|
16
|
+
*/
|
|
17
|
+
buffer?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to emit custom events for errors in worker
|
|
20
|
+
*/
|
|
21
|
+
errorEvent?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Wasm compilation options
|
|
25
|
+
*/
|
|
26
|
+
interface WasmOptions {
|
|
27
|
+
/**
|
|
28
|
+
* https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Memory
|
|
29
|
+
*
|
|
30
|
+
* @defaultValue 4000 pages (256MiB)
|
|
31
|
+
*/
|
|
32
|
+
initialMemory?: number;
|
|
33
|
+
/**
|
|
34
|
+
* @defaultValue 65536 pages (4GiB)
|
|
35
|
+
*/
|
|
36
|
+
maximumMemory?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Browser wasm binding configuration
|
|
39
|
+
*/
|
|
40
|
+
browser: WasmBrowserOptions;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { WasmBrowserOptions, WasmOptions };
|
|
44
|
+
//# sourceMappingURL=wasm.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm.d.cts","names":[],"sources":["../../src/types/wasm.ts"],"mappings":";;AAqBA;;UAAiB,kBAAA;EAAkB;;;EAIjC,EAAA;EAeA;;;EAVA,SAAA;EAgB0B;;;EAX1B,MAAA;EAsBA;;;EAjBA,UAAA;AAAA;;;;UAMe,WAAA;;;;;;EAMf,aAAA;;;;EAKA,aAAA;;;;EAKA,OAAA,EAAS,kBAAA;AAAA"}
|