@powerlines/plugin-napi-rs 0.1.1 → 0.1.2
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.cjs +36 -30
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +36 -30
- package/dist/index.mjs.map +1 -1
- package/dist/types/plugin.d.cts +8 -4
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +8 -4
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/plugin.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_types_targets = require('./types/targets.cjs');
|
|
4
3
|
let _napi_rs_cli = require("@napi-rs/cli");
|
|
5
4
|
let _powerlines_plugin_alloy = require("@powerlines/plugin-alloy");
|
|
6
5
|
_powerlines_plugin_alloy = require_runtime.__toESM(_powerlines_plugin_alloy);
|
|
7
6
|
let _stryke_path_append = require("@stryke/path/append");
|
|
8
7
|
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
8
|
+
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
9
|
+
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
9
10
|
|
|
10
11
|
//#region src/index.tsx
|
|
11
12
|
/**
|
|
@@ -18,18 +19,24 @@ const plugin = (options = {}) => {
|
|
|
18
19
|
name: "napi-rs",
|
|
19
20
|
config() {
|
|
20
21
|
return { napi: {
|
|
21
|
-
targets: require_types_targets.DEFAULT_TARGETS,
|
|
22
22
|
dts: "binding.d.ts",
|
|
23
23
|
jsBinding: "binding.js",
|
|
24
24
|
outputDir: this.config.root,
|
|
25
25
|
platform: true,
|
|
26
26
|
strip: false,
|
|
27
|
+
packageJsonPath: (0, _stryke_path_append.appendPath)(this.config.root, "package.json"),
|
|
27
28
|
...options
|
|
28
29
|
} };
|
|
29
30
|
},
|
|
30
31
|
configResolved() {
|
|
31
|
-
this.config.napi.
|
|
32
|
-
|
|
32
|
+
if (!this.config.napi.target && this.additionalArgs.target) this.config.napi.target = (0, _napi_rs_cli.parseTriple)(this.additionalArgs.target);
|
|
33
|
+
else this.config.napi.target = (0, _stryke_type_checks_is_string.isString)(this.config.napi.target) ? (0, _napi_rs_cli.parseTriple)(this.config.napi.target) : this.config.napi.target;
|
|
34
|
+
if (!this.config.napi.profile && this.additionalArgs.profile) this.config.napi.profile = this.additionalArgs.profile;
|
|
35
|
+
if (!this.config.napi.release && this.additionalArgs.release) this.config.napi.release = Boolean(this.additionalArgs.release);
|
|
36
|
+
if (!this.config.napi.configPath && this.additionalArgs.configPath) this.config.napi.configPath = this.additionalArgs.configPath;
|
|
37
|
+
if (!this.config.napi.manifestPath && this.additionalArgs.manifestPath) this.config.napi.manifestPath = this.additionalArgs.manifestPath;
|
|
38
|
+
if (!this.config.napi.packageJsonPath && this.additionalArgs.packageJsonPath) this.config.napi.packageJsonPath = this.additionalArgs.packageJsonPath;
|
|
39
|
+
if (this.config.napi.target?.platform === "wasm") this.dependencies["@napi-rs/wasm-runtime"] = "^1.1.4";
|
|
33
40
|
},
|
|
34
41
|
async prepare() {
|
|
35
42
|
this.debug(`Preparing the N-API Rust runtime artifacts for the Powerlines project.`);
|
|
@@ -37,32 +44,31 @@ const plugin = (options = {}) => {
|
|
|
37
44
|
async build() {
|
|
38
45
|
this.debug(`Preparing the N-API Rust runtime artifacts for the Powerlines project.`);
|
|
39
46
|
const cwd = (0, _stryke_path_append.appendPath)(this.config.root, this.config.cwd);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}));
|
|
47
|
+
const { task } = await new _napi_rs_cli.NapiCli().build({
|
|
48
|
+
cwd,
|
|
49
|
+
package: this.config.napi.packageName,
|
|
50
|
+
outputDir: (0, _stryke_path_file_path_fns.relativePath)(cwd, (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)(this.config.napi.outputDir, this.config.root), this.config.cwd)),
|
|
51
|
+
configPath: this.config.napi.configPath ? (0, _stryke_path_file_path_fns.relativePath)(cwd, (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, powerlines_plugin_utils.replacePathTokens)(this, this.config.napi.configPath), this.config.root), this.config.cwd)) : void 0,
|
|
52
|
+
manifestPath: this.config.napi.manifestPath ? (0, _stryke_path_file_path_fns.relativePath)(cwd, (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, powerlines_plugin_utils.replacePathTokens)(this, this.config.napi.manifestPath), this.config.root), this.config.cwd)) : void 0,
|
|
53
|
+
packageJsonPath: this.config.napi.packageJsonPath ? (0, _stryke_path_file_path_fns.relativePath)(cwd, (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, powerlines_plugin_utils.replacePathTokens)(this, this.config.napi.packageJsonPath), this.config.root), this.config.cwd)) : void 0,
|
|
54
|
+
target: this.config.napi.target?.triple,
|
|
55
|
+
profile: this.config.napi.profile,
|
|
56
|
+
release: this.config.napi.release ?? this.config.mode === "production",
|
|
57
|
+
features: this.config.napi.features,
|
|
58
|
+
noDefaultFeatures: this.config.napi.noDefaultFeatures,
|
|
59
|
+
strip: this.config.napi.strip,
|
|
60
|
+
platform: this.config.napi.platform,
|
|
61
|
+
noDtsHeader: this.config.napi.noDtsHeader,
|
|
62
|
+
jsBinding: this.config.napi.jsBinding,
|
|
63
|
+
dts: this.config.napi.dts,
|
|
64
|
+
dtsCache: this.config.napi.dtsCache ?? !this.config.skipCache,
|
|
65
|
+
verbose: (0, powerlines_plugin_utils.isVerbose)(this)
|
|
66
|
+
});
|
|
67
|
+
const outputs = await task;
|
|
68
|
+
for (const output of outputs) {
|
|
69
|
+
const code = await this.fs.read(output.path);
|
|
70
|
+
if (code) await this.fs.write(output.path, code);
|
|
71
|
+
}
|
|
66
72
|
}
|
|
67
73
|
}];
|
|
68
74
|
};
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;YA8BY,MAAA;IACR,IAAA,GAAO,iBAAA;EAAA;AAAA;;;;;;cASE,MAAA,oBAA2B,iBAAA,GAAoB,iBAAA,EAC1D,OAAA,GAAS,iBAAA,KA8IJ,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;YA8BY,MAAA;IACR,IAAA,GAAO,iBAAA;EAAA;AAAA;;;;;;cASE,MAAA,oBAA2B,iBAAA,GAAoB,iBAAA,EAC1D,OAAA,GAAS,iBAAA,KA8IJ,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { DEFAULT_TARGETS } from "./types/targets.mjs";
|
|
2
1
|
import { NapiCli, parseTriple } from "@napi-rs/cli";
|
|
3
2
|
import alloy from "@powerlines/plugin-alloy";
|
|
4
3
|
import { appendPath } from "@stryke/path/append";
|
|
5
4
|
import { relativePath } from "@stryke/path/file-path-fns";
|
|
5
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
6
|
+
import { isVerbose, replacePathTokens } from "powerlines/plugin-utils";
|
|
6
7
|
|
|
7
8
|
//#region src/index.tsx
|
|
8
9
|
/**
|
|
@@ -15,18 +16,24 @@ const plugin = (options = {}) => {
|
|
|
15
16
|
name: "napi-rs",
|
|
16
17
|
config() {
|
|
17
18
|
return { napi: {
|
|
18
|
-
targets: DEFAULT_TARGETS,
|
|
19
19
|
dts: "binding.d.ts",
|
|
20
20
|
jsBinding: "binding.js",
|
|
21
21
|
outputDir: this.config.root,
|
|
22
22
|
platform: true,
|
|
23
23
|
strip: false,
|
|
24
|
+
packageJsonPath: appendPath(this.config.root, "package.json"),
|
|
24
25
|
...options
|
|
25
26
|
} };
|
|
26
27
|
},
|
|
27
28
|
configResolved() {
|
|
28
|
-
this.config.napi.
|
|
29
|
-
|
|
29
|
+
if (!this.config.napi.target && this.additionalArgs.target) this.config.napi.target = parseTriple(this.additionalArgs.target);
|
|
30
|
+
else this.config.napi.target = isString(this.config.napi.target) ? parseTriple(this.config.napi.target) : this.config.napi.target;
|
|
31
|
+
if (!this.config.napi.profile && this.additionalArgs.profile) this.config.napi.profile = this.additionalArgs.profile;
|
|
32
|
+
if (!this.config.napi.release && this.additionalArgs.release) this.config.napi.release = Boolean(this.additionalArgs.release);
|
|
33
|
+
if (!this.config.napi.configPath && this.additionalArgs.configPath) this.config.napi.configPath = this.additionalArgs.configPath;
|
|
34
|
+
if (!this.config.napi.manifestPath && this.additionalArgs.manifestPath) this.config.napi.manifestPath = this.additionalArgs.manifestPath;
|
|
35
|
+
if (!this.config.napi.packageJsonPath && this.additionalArgs.packageJsonPath) this.config.napi.packageJsonPath = this.additionalArgs.packageJsonPath;
|
|
36
|
+
if (this.config.napi.target?.platform === "wasm") this.dependencies["@napi-rs/wasm-runtime"] = "^1.1.4";
|
|
30
37
|
},
|
|
31
38
|
async prepare() {
|
|
32
39
|
this.debug(`Preparing the N-API Rust runtime artifacts for the Powerlines project.`);
|
|
@@ -34,32 +41,31 @@ const plugin = (options = {}) => {
|
|
|
34
41
|
async build() {
|
|
35
42
|
this.debug(`Preparing the N-API Rust runtime artifacts for the Powerlines project.`);
|
|
36
43
|
const cwd = appendPath(this.config.root, this.config.cwd);
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}));
|
|
44
|
+
const { task } = await new NapiCli().build({
|
|
45
|
+
cwd,
|
|
46
|
+
package: this.config.napi.packageName,
|
|
47
|
+
outputDir: relativePath(cwd, appendPath(appendPath(this.config.napi.outputDir, this.config.root), this.config.cwd)),
|
|
48
|
+
configPath: this.config.napi.configPath ? relativePath(cwd, appendPath(appendPath(replacePathTokens(this, this.config.napi.configPath), this.config.root), this.config.cwd)) : void 0,
|
|
49
|
+
manifestPath: this.config.napi.manifestPath ? relativePath(cwd, appendPath(appendPath(replacePathTokens(this, this.config.napi.manifestPath), this.config.root), this.config.cwd)) : void 0,
|
|
50
|
+
packageJsonPath: this.config.napi.packageJsonPath ? relativePath(cwd, appendPath(appendPath(replacePathTokens(this, this.config.napi.packageJsonPath), this.config.root), this.config.cwd)) : void 0,
|
|
51
|
+
target: this.config.napi.target?.triple,
|
|
52
|
+
profile: this.config.napi.profile,
|
|
53
|
+
release: this.config.napi.release ?? this.config.mode === "production",
|
|
54
|
+
features: this.config.napi.features,
|
|
55
|
+
noDefaultFeatures: this.config.napi.noDefaultFeatures,
|
|
56
|
+
strip: this.config.napi.strip,
|
|
57
|
+
platform: this.config.napi.platform,
|
|
58
|
+
noDtsHeader: this.config.napi.noDtsHeader,
|
|
59
|
+
jsBinding: this.config.napi.jsBinding,
|
|
60
|
+
dts: this.config.napi.dts,
|
|
61
|
+
dtsCache: this.config.napi.dtsCache ?? !this.config.skipCache,
|
|
62
|
+
verbose: isVerbose(this)
|
|
63
|
+
});
|
|
64
|
+
const outputs = await task;
|
|
65
|
+
for (const output of outputs) {
|
|
66
|
+
const code = await this.fs.read(output.path);
|
|
67
|
+
if (code) await this.fs.write(output.path, code);
|
|
68
|
+
}
|
|
63
69
|
}
|
|
64
70
|
}];
|
|
65
71
|
};
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +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
|
|
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 { isString } from \"@stryke/type-checks/is-string\";\nimport { Plugin } from \"powerlines\";\nimport { isVerbose, replacePathTokens } from \"powerlines/plugin-utils\";\nimport type { NapiPluginContext, NapiPluginOptions } from \"./types/plugin\";\n\nexport type * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n napi?: NapiPluginOptions;\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 = <TContext extends NapiPluginContext = NapiPluginContext>(\n options: NapiPluginOptions = {}\n) => {\n return [\n alloy(),\n {\n name: \"napi-rs\",\n config() {\n return {\n napi: {\n dts: \"binding.d.ts\",\n jsBinding: \"binding.js\",\n outputDir: this.config.root,\n platform: true,\n strip: false,\n packageJsonPath: appendPath(this.config.root, \"package.json\"),\n ...options\n }\n };\n },\n configResolved() {\n if (!this.config.napi.target && this.additionalArgs.target) {\n this.config.napi.target = parseTriple(this.additionalArgs.target);\n } else {\n this.config.napi.target = isString(this.config.napi.target)\n ? parseTriple(this.config.napi.target)\n : this.config.napi.target;\n }\n\n if (!this.config.napi.profile && this.additionalArgs.profile) {\n this.config.napi.profile = this.additionalArgs.profile;\n }\n\n if (!this.config.napi.release && this.additionalArgs.release) {\n this.config.napi.release = Boolean(this.additionalArgs.release);\n }\n\n if (!this.config.napi.configPath && this.additionalArgs.configPath) {\n this.config.napi.configPath = this.additionalArgs.configPath;\n }\n\n if (\n !this.config.napi.manifestPath &&\n this.additionalArgs.manifestPath\n ) {\n this.config.napi.manifestPath = this.additionalArgs.manifestPath;\n }\n\n if (\n !this.config.napi.packageJsonPath &&\n this.additionalArgs.packageJsonPath\n ) {\n this.config.napi.packageJsonPath =\n this.additionalArgs.packageJsonPath;\n }\n\n if (this.config.napi.target?.platform === \"wasm\") {\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\n const { task } = await cli.build({\n cwd,\n package: this.config.napi.packageName,\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(\n replacePathTokens(this, this.config.napi.configPath),\n this.config.root\n ),\n this.config.cwd\n )\n )\n : undefined,\n manifestPath: this.config.napi.manifestPath\n ? relativePath(\n cwd,\n appendPath(\n appendPath(\n replacePathTokens(this, this.config.napi.manifestPath),\n this.config.root\n ),\n this.config.cwd\n )\n )\n : undefined,\n packageJsonPath: this.config.napi.packageJsonPath\n ? relativePath(\n cwd,\n appendPath(\n appendPath(\n replacePathTokens(this, this.config.napi.packageJsonPath),\n this.config.root\n ),\n this.config.cwd\n )\n )\n : undefined,\n target: this.config.napi.target?.triple,\n profile: this.config.napi.profile,\n release:\n this.config.napi.release ?? this.config.mode === \"production\",\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 verbose: isVerbose(this)\n });\n\n const outputs = await task;\n for (const output of outputs) {\n const code = await this.fs.read(output.path);\n if (code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|
|
26
26
|
* Build for the target triple, bypassed to `cargo build --target`
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
target?: TargetTriple | Target;
|
|
29
29
|
/**
|
|
30
30
|
* Build artifacts with the specified Cargo profile
|
|
31
31
|
*/
|
|
@@ -82,6 +82,10 @@ interface NapiPluginOptions {
|
|
|
82
82
|
* Directory for all crate generated artifacts, see `cargo build --target-dir`
|
|
83
83
|
*/
|
|
84
84
|
targetDir?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Path to the package.json file to read the version and other metadata from, used for generating the JS binding file. If not specified, it will default to the package.json file in the project root.
|
|
87
|
+
*/
|
|
88
|
+
packageJsonPath?: string;
|
|
85
89
|
/**
|
|
86
90
|
* Add platform triple suffix to generated Node.js binding file, e.g. [name].linux-x64-gnu.node
|
|
87
91
|
*
|
|
@@ -128,11 +132,11 @@ interface NapiPluginOptions {
|
|
|
128
132
|
type NapiPluginUserConfig = BabelPluginUserConfig & AlloyPluginUserConfig & {
|
|
129
133
|
napi: NapiPluginOptions;
|
|
130
134
|
};
|
|
131
|
-
type NapiResolvedPluginOptions = RequiredKeys<Omit<NapiPluginOptions, "targets">, "dts" | "jsBinding" | "manifestPath" | "outputDir" | "platform"> & {
|
|
135
|
+
type NapiResolvedPluginOptions = RequiredKeys<Omit<NapiPluginOptions, "targets">, "dts" | "jsBinding" | "manifestPath" | "outputDir" | "platform" | "packageJsonPath"> & {
|
|
132
136
|
/**
|
|
133
|
-
* The resolved target
|
|
137
|
+
* The resolved target triple to build for, with additional metadata such as platform, architecture, and ABI information. These are derived from the `target` option, and are used internally by the plugin to determine how to build the N-API Rust module for the target.
|
|
134
138
|
*/
|
|
135
|
-
|
|
139
|
+
target: Target;
|
|
136
140
|
};
|
|
137
141
|
type NapiPluginResolvedConfig = BabelPluginResolvedConfig & AlloyPluginResolvedConfig & {
|
|
138
142
|
napi: NapiResolvedPluginOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;AAwCA;;;;;;UAAiB,iBAAA;EAkCC;;;EA9BhB,UAAA;EAUA;;;EALA,WAAA;EAeA;;;EAVA,
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;AAwCA;;;;;;UAAiB,iBAAA;EAkCC;;;EA9BhB,UAAA;EAUA;;;EALA,WAAA;EAeA;;;EAVA,MAAA,GAAS,YAAA,GAAe,MAAA;EAoBb;;;EAfX,OAAA;EA2CA;;;EAtCA,IAAA,GAAO,WAAA;EA0DP;;;EArDA,OAAA;EA2EA;;;EAtEA,QAAA,GAAW,KAAA;EA0FX;;;EArFA,WAAA;EAoGY;;AAGd;;;EAhGE,iBAAA;EAiGA;;;;;EA1FA,SAAA;EA2FE;;;;AAGJ;;;EArFE,GAAA;EAsFA;;;EAjFA,YAAA;EA4Fc;;;EAvFd,UAAA;EAuFA;;;EAlFA,SAAA;EAqFU;;;EAhFV,SAAA;EAiFA;;;EA5EA,eAAA;EA2EqC;;;;;EApErC,QAAA;EAyEe;;;EApEf,SAAA;EAqEmD;;;EAhEnD,WAAA;EAoEE;;;EA/DF,SAAA;EA2DwB;;;EAtDxB,WAAA;EA0DE;;;EArDF,QAAA;;;;EAKA,KAAA;;;;EAKA,YAAA;;;;EAKA,QAAA;;;;EAKA,YAAA;AAAA;AAAA,KAGU,oBAAA,GAAuB,qBAAA,GACjC,qBAAA;EACE,IAAA,EAAM,iBAAA;AAAA;AAAA,KAGE,yBAAA,GAA4B,YAAA,CACtC,IAAA,CAAK,iBAAA;;;;EAWL,MAAA,EAAQ,MAAA;AAAA;AAAA,KAGE,wBAAA,GAA2B,yBAAA,GACrC,yBAAA;EACE,IAAA,EAAM,yBAAA;AAAA;AAAA,UAGO,iBAAA,yBACS,wBAAA,GAA2B,wBAAA,UAGjD,kBAAA,CAAmB,eAAA,GACnB,kBAAA,CAAmB,eAAA"}
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -25,7 +25,7 @@ interface NapiPluginOptions {
|
|
|
25
25
|
/**
|
|
26
26
|
* Build for the target triple, bypassed to `cargo build --target`
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
target?: TargetTriple | Target;
|
|
29
29
|
/**
|
|
30
30
|
* Build artifacts with the specified Cargo profile
|
|
31
31
|
*/
|
|
@@ -82,6 +82,10 @@ interface NapiPluginOptions {
|
|
|
82
82
|
* Directory for all crate generated artifacts, see `cargo build --target-dir`
|
|
83
83
|
*/
|
|
84
84
|
targetDir?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Path to the package.json file to read the version and other metadata from, used for generating the JS binding file. If not specified, it will default to the package.json file in the project root.
|
|
87
|
+
*/
|
|
88
|
+
packageJsonPath?: string;
|
|
85
89
|
/**
|
|
86
90
|
* Add platform triple suffix to generated Node.js binding file, e.g. [name].linux-x64-gnu.node
|
|
87
91
|
*
|
|
@@ -128,11 +132,11 @@ interface NapiPluginOptions {
|
|
|
128
132
|
type NapiPluginUserConfig = BabelPluginUserConfig & AlloyPluginUserConfig & {
|
|
129
133
|
napi: NapiPluginOptions;
|
|
130
134
|
};
|
|
131
|
-
type NapiResolvedPluginOptions = RequiredKeys<Omit<NapiPluginOptions, "targets">, "dts" | "jsBinding" | "manifestPath" | "outputDir" | "platform"> & {
|
|
135
|
+
type NapiResolvedPluginOptions = RequiredKeys<Omit<NapiPluginOptions, "targets">, "dts" | "jsBinding" | "manifestPath" | "outputDir" | "platform" | "packageJsonPath"> & {
|
|
132
136
|
/**
|
|
133
|
-
* The resolved target
|
|
137
|
+
* The resolved target triple to build for, with additional metadata such as platform, architecture, and ABI information. These are derived from the `target` option, and are used internally by the plugin to determine how to build the N-API Rust module for the target.
|
|
134
138
|
*/
|
|
135
|
-
|
|
139
|
+
target: Target;
|
|
136
140
|
};
|
|
137
141
|
type NapiPluginResolvedConfig = BabelPluginResolvedConfig & AlloyPluginResolvedConfig & {
|
|
138
142
|
napi: NapiResolvedPluginOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;AAwCA;;;;;;UAAiB,iBAAA;EAkCC;;;EA9BhB,UAAA;EAUA;;;EALA,WAAA;EAeA;;;EAVA,
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;AAwCA;;;;;;UAAiB,iBAAA;EAkCC;;;EA9BhB,UAAA;EAUA;;;EALA,WAAA;EAeA;;;EAVA,MAAA,GAAS,YAAA,GAAe,MAAA;EAoBb;;;EAfX,OAAA;EA2CA;;;EAtCA,IAAA,GAAO,WAAA;EA0DP;;;EArDA,OAAA;EA2EA;;;EAtEA,QAAA,GAAW,KAAA;EA0FX;;;EArFA,WAAA;EAoGY;;AAGd;;;EAhGE,iBAAA;EAiGA;;;;;EA1FA,SAAA;EA2FE;;;;AAGJ;;;EArFE,GAAA;EAsFA;;;EAjFA,YAAA;EA4Fc;;;EAvFd,UAAA;EAuFA;;;EAlFA,SAAA;EAqFU;;;EAhFV,SAAA;EAiFA;;;EA5EA,eAAA;EA2EqC;;;;;EApErC,QAAA;EAyEe;;;EApEf,SAAA;EAqEmD;;;EAhEnD,WAAA;EAoEE;;;EA/DF,SAAA;EA2DwB;;;EAtDxB,WAAA;EA0DE;;;EArDF,QAAA;;;;EAKA,KAAA;;;;EAKA,YAAA;;;;EAKA,QAAA;;;;EAKA,YAAA;AAAA;AAAA,KAGU,oBAAA,GAAuB,qBAAA,GACjC,qBAAA;EACE,IAAA,EAAM,iBAAA;AAAA;AAAA,KAGE,yBAAA,GAA4B,YAAA,CACtC,IAAA,CAAK,iBAAA;;;;EAWL,MAAA,EAAQ,MAAA;AAAA;AAAA,KAGE,wBAAA,GAA2B,yBAAA,GACrC,yBAAA;EACE,IAAA,EAAM,yBAAA;AAAA;AAAA,UAGO,iBAAA,yBACS,wBAAA,GAA2B,wBAAA,UAGjD,kBAAA,CAAmB,eAAA,GACnB,kBAAA,CAAmB,eAAA"}
|
|
@@ -1 +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 NapiPluginOptions {\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
|
|
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 NapiPluginOptions {\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 target?: 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 * Path to the package.json file to read the version and other metadata from, used for generating the JS binding file. If not specified, it will default to the package.json file in the project root.\n */\n packageJsonPath?: 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 NapiPluginUserConfig = BabelPluginUserConfig &\n AlloyPluginUserConfig & {\n napi: NapiPluginOptions;\n };\n\nexport type NapiResolvedPluginOptions = RequiredKeys<\n Omit<NapiPluginOptions, \"targets\">,\n | \"dts\"\n | \"jsBinding\"\n | \"manifestPath\"\n | \"outputDir\"\n | \"platform\"\n | \"packageJsonPath\"\n> & {\n /**\n * The resolved target triple to build for, with additional metadata such as platform, architecture, and ABI information. These are derived from the `target` option, and are used internally by the plugin to determine how to build the N-API Rust module for the target.\n */\n target: Target;\n};\n\nexport type NapiPluginResolvedConfig = BabelPluginResolvedConfig &\n AlloyPluginResolvedConfig & {\n napi: NapiResolvedPluginOptions;\n };\n\nexport interface NapiPluginContext<\n TResolvedConfig extends NapiPluginResolvedConfig = NapiPluginResolvedConfig\n>\n extends\n BabelPluginContext<TResolvedConfig>,\n AlloyPluginContext<TResolvedConfig> {}\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-napi-rs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Powerlines plugin for integrating with N-API Rust modules.",
|
|
6
6
|
"keywords": ["napi-rs", "powerlines", "storm-software", "powerlines-plugin"],
|
|
@@ -123,9 +123,9 @@
|
|
|
123
123
|
"@alloy-js/markdown": "0.23.0-dev.1",
|
|
124
124
|
"@alloy-js/typescript": "0.23.0-dev.4",
|
|
125
125
|
"@napi-rs/cli": "^3.6.2",
|
|
126
|
-
"@powerlines/plugin-alloy": "^0.26.
|
|
127
|
-
"@powerlines/plugin-automd": "^0.1.
|
|
128
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
126
|
+
"@powerlines/plugin-alloy": "^0.26.40",
|
|
127
|
+
"@powerlines/plugin-automd": "^0.1.422",
|
|
128
|
+
"@powerlines/plugin-plugin": "^0.12.373",
|
|
129
129
|
"@stryke/fs": "^0.33.66",
|
|
130
130
|
"@stryke/path": "^0.27.4",
|
|
131
131
|
"@stryke/string-format": "^0.17.9",
|
|
@@ -133,11 +133,11 @@
|
|
|
133
133
|
"@stryke/types": "^0.11.3",
|
|
134
134
|
"automd": "^0.4.3",
|
|
135
135
|
"defu": "^6.1.7",
|
|
136
|
-
"powerlines": "^0.43.
|
|
136
|
+
"powerlines": "^0.43.21"
|
|
137
137
|
},
|
|
138
138
|
"devDependencies": { "@types/node": "^25.6.0" },
|
|
139
139
|
"peerDependencies": { "@napi-rs/wasm-runtime": ">=1.1.4" },
|
|
140
140
|
"peerDependenciesMeta": { "@napi-rs/wasm-runtime": { "optional": true } },
|
|
141
141
|
"publishConfig": { "access": "public" },
|
|
142
|
-
"gitHead": "
|
|
142
|
+
"gitHead": "3dd0c7fb5e5945e3b558163711f7eaee19f0ce01"
|
|
143
143
|
}
|