@powerlines/plugin-napi-rs 0.2.33 → 0.2.34
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/helpers/format-path.cjs +23 -1
- package/dist/helpers/format-path.mjs +22 -1
- package/dist/helpers/format-path.mjs.map +1 -1
- package/dist/index.cjs +105 -1
- package/dist/index.mjs +103 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.cjs +5 -1
- package/dist/types/index.mjs +3 -1
- package/dist/types/plugin.cjs +11 -0
- package/dist/types/plugin.mjs +11 -1
- package/dist/types/targets.cjs +39 -1
- package/dist/types/targets.mjs +36 -1
- package/dist/types/targets.mjs.map +1 -1
- package/dist/types/wasm.mjs +1 -1
- package/package.json +6 -6
|
@@ -1 +1,23 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _stryke_path_append = require("@stryke/path/append");
|
|
3
|
+
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
4
|
+
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
5
|
+
|
|
6
|
+
//#region src/helpers/format-path.ts
|
|
7
|
+
/**
|
|
8
|
+
* Format the given path by replacing tokens and making it relative to the project root.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This function is used to format paths in the plugin's configuration, such as the path to the crate or the output directory. It replaces tokens in the path (e.g. `{crate}`) with their corresponding values from the plugin context, and then makes the path relative to the project root.
|
|
12
|
+
*
|
|
13
|
+
* @param context - The plugin context, which contains the configuration and other information about the plugin's execution environment.
|
|
14
|
+
* @param path - The path to format or undefined, which may contain tokens to be replaced. This can be a path to a file or directory, and can include tokens such as `{crate}` that will be replaced with their corresponding values from the plugin context.
|
|
15
|
+
* @returns The formatted path, which has had tokens replaced and is relative to the project root. If the input path is undefined, this function will return undefined.
|
|
16
|
+
*/
|
|
17
|
+
function formatPath(context, path) {
|
|
18
|
+
const cwd = (0, _stryke_path_append.appendPath)(context.config.root, context.config.cwd);
|
|
19
|
+
return path ? (0, _stryke_path_file_path_fns.relativePath)(cwd, (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, powerlines_plugin_utils.replacePathTokens)(context, path), context.config.root), context.config.cwd)) : void 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.formatPath = formatPath;
|
|
@@ -1,2 +1,23 @@
|
|
|
1
|
-
import{appendPath
|
|
1
|
+
import { appendPath } from "@stryke/path/append";
|
|
2
|
+
import { relativePath } from "@stryke/path/file-path-fns";
|
|
3
|
+
import { replacePathTokens } from "powerlines/plugin-utils";
|
|
4
|
+
|
|
5
|
+
//#region src/helpers/format-path.ts
|
|
6
|
+
/**
|
|
7
|
+
* Format the given path by replacing tokens and making it relative to the project root.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This function is used to format paths in the plugin's configuration, such as the path to the crate or the output directory. It replaces tokens in the path (e.g. `{crate}`) with their corresponding values from the plugin context, and then makes the path relative to the project root.
|
|
11
|
+
*
|
|
12
|
+
* @param context - The plugin context, which contains the configuration and other information about the plugin's execution environment.
|
|
13
|
+
* @param path - The path to format or undefined, which may contain tokens to be replaced. This can be a path to a file or directory, and can include tokens such as `{crate}` that will be replaced with their corresponding values from the plugin context.
|
|
14
|
+
* @returns The formatted path, which has had tokens replaced and is relative to the project root. If the input path is undefined, this function will return undefined.
|
|
15
|
+
*/
|
|
16
|
+
function formatPath(context, path) {
|
|
17
|
+
const cwd = appendPath(context.config.root, context.config.cwd);
|
|
18
|
+
return path ? relativePath(cwd, appendPath(appendPath(replacePathTokens(context, path), context.config.root), context.config.cwd)) : void 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { formatPath };
|
|
2
23
|
//# sourceMappingURL=format-path.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-path.mjs","names":[],"sources":["../../src/helpers/format-path.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 { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { replacePathTokens } from \"powerlines/plugin-utils\";\nimport { NapiPluginContext } from \"../types\";\n\n/**\n * Format the given path by replacing tokens and making it relative to the project root.\n *\n * @remarks\n * This function is used to format paths in the plugin's configuration, such as the path to the crate or the output directory. It replaces tokens in the path (e.g. `{crate}`) with their corresponding values from the plugin context, and then makes the path relative to the project root.\n *\n * @param context - The plugin context, which contains the configuration and other information about the plugin's execution environment.\n * @param path - The path to format or undefined, which may contain tokens to be replaced. This can be a path to a file or directory, and can include tokens such as `{crate}` that will be replaced with their corresponding values from the plugin context.\n * @returns The formatted path, which has had tokens replaced and is relative to the project root. If the input path is undefined, this function will return undefined.\n */\nexport function formatPath(\n context: NapiPluginContext,\n path?: string\n): string | undefined {\n const cwd = appendPath(context.config.root, context.config.cwd);\n\n return path\n ? relativePath(\n cwd,\n appendPath(\n appendPath(replacePathTokens(context, path), context.config.root),\n context.config.cwd\n )\n )\n : undefined;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"format-path.mjs","names":[],"sources":["../../src/helpers/format-path.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 { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { replacePathTokens } from \"powerlines/plugin-utils\";\nimport { NapiPluginContext } from \"../types\";\n\n/**\n * Format the given path by replacing tokens and making it relative to the project root.\n *\n * @remarks\n * This function is used to format paths in the plugin's configuration, such as the path to the crate or the output directory. It replaces tokens in the path (e.g. `{crate}`) with their corresponding values from the plugin context, and then makes the path relative to the project root.\n *\n * @param context - The plugin context, which contains the configuration and other information about the plugin's execution environment.\n * @param path - The path to format or undefined, which may contain tokens to be replaced. This can be a path to a file or directory, and can include tokens such as `{crate}` that will be replaced with their corresponding values from the plugin context.\n * @returns The formatted path, which has had tokens replaced and is relative to the project root. If the input path is undefined, this function will return undefined.\n */\nexport function formatPath(\n context: NapiPluginContext,\n path?: string\n): string | undefined {\n const cwd = appendPath(context.config.root, context.config.cwd);\n\n return path\n ? relativePath(\n cwd,\n appendPath(\n appendPath(replacePathTokens(context, path), context.config.root),\n context.config.cwd\n )\n )\n : undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,SAAgB,WAAU,SAAA,MAAA;CACxB,MAAA,MAAS,WAAA,QAAiB,OAAA,MAAA,QAAA,OAAA,IAAA;AAC1B,QAAO,OAAA,aAAA,KAAA,WAAA,WAAA,kBAAA,SAAA,KAAA,EAAA,QAAA,OAAA,KAAA,EAAA,QAAA,OAAA,IAAA,CAAA,GAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,105 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_types_targets = require('./types/targets.cjs');
|
|
3
|
+
const require_helpers_format_path = require('./helpers/format-path.cjs');
|
|
4
|
+
let _stryke_path_append = require("@stryke/path/append");
|
|
5
|
+
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
6
|
+
let _napi_rs_cli = require("@napi-rs/cli");
|
|
7
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
8
|
+
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
9
|
+
let defu = require("defu");
|
|
10
|
+
|
|
11
|
+
//#region src/index.tsx
|
|
12
|
+
/**
|
|
13
|
+
* 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.
|
|
14
|
+
*
|
|
15
|
+
* @see https://napi.rs/docs
|
|
16
|
+
*/
|
|
17
|
+
const plugin = (options = {}) => {
|
|
18
|
+
return [{
|
|
19
|
+
name: "napi-rs",
|
|
20
|
+
config() {
|
|
21
|
+
return { napi: {
|
|
22
|
+
dts: "binding.d.ts",
|
|
23
|
+
jsBinding: "binding.js",
|
|
24
|
+
outputDir: this.config.root,
|
|
25
|
+
platform: true,
|
|
26
|
+
strip: false,
|
|
27
|
+
...options
|
|
28
|
+
} };
|
|
29
|
+
},
|
|
30
|
+
async configResolved() {
|
|
31
|
+
if (!this.config.napi.target && this.additionalArgs.target && ((0, _stryke_type_checks_is_string.isString)(this.additionalArgs.target) || Array.isArray(this.additionalArgs.target) && this.additionalArgs.target.length > 0)) this.config.napi.target = (0, _napi_rs_cli.parseTriple)(Array.isArray(this.additionalArgs.target) && this.additionalArgs.target.length > 0 ? this.additionalArgs.target[0] : String(this.additionalArgs.target));
|
|
32
|
+
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;
|
|
33
|
+
if (!this.config.napi.targets) if (this.additionalArgs.targets && ((0, _stryke_type_checks_is_string.isString)(this.additionalArgs.targets) || Array.isArray(this.additionalArgs.targets) && this.additionalArgs.targets.length > 0)) this.config.napi.targets = (0, _stryke_convert_to_array.toArray)(this.additionalArgs.targets).map((target) => (0, _napi_rs_cli.parseTriple)(target));
|
|
34
|
+
else this.config.napi.targets = require_types_targets.DEFAULT_TARGETS.map((target) => (0, _napi_rs_cli.parseTriple)(target));
|
|
35
|
+
if (!this.config.napi.profile && this.additionalArgs.profile && ((0, _stryke_type_checks_is_string.isString)(this.additionalArgs.profile) || Array.isArray(this.additionalArgs.profile) && this.additionalArgs.profile.length > 0)) this.config.napi.profile = Array.isArray(this.additionalArgs.profile) && this.additionalArgs.profile.length > 0 ? this.additionalArgs.profile[0] : String(this.additionalArgs.profile);
|
|
36
|
+
if (!this.config.napi.release && this.additionalArgs.release) this.config.napi.release = Boolean(this.additionalArgs.release);
|
|
37
|
+
if (!this.config.napi.configPath && this.additionalArgs.configPath && ((0, _stryke_type_checks_is_string.isString)(this.additionalArgs.configPath) || Array.isArray(this.additionalArgs.configPath) && this.additionalArgs.configPath.length > 0)) this.config.napi.configPath = Array.isArray(this.additionalArgs.configPath) && this.additionalArgs.configPath.length > 0 ? this.additionalArgs.configPath[0] : String(this.additionalArgs.configPath);
|
|
38
|
+
if (!this.config.napi.manifestPath && this.additionalArgs.manifestPath && ((0, _stryke_type_checks_is_string.isString)(this.additionalArgs.manifestPath) || Array.isArray(this.additionalArgs.manifestPath) && this.additionalArgs.manifestPath.length > 0)) this.config.napi.manifestPath = Array.isArray(this.additionalArgs.manifestPath) && this.additionalArgs.manifestPath.length > 0 ? this.additionalArgs.manifestPath[0] : String(this.additionalArgs.manifestPath);
|
|
39
|
+
if (!this.config.napi.npmDir && this.additionalArgs.npmDir && ((0, _stryke_type_checks_is_string.isString)(this.additionalArgs.npmDir) || Array.isArray(this.additionalArgs.npmDir) && this.additionalArgs.npmDir.length > 0)) this.config.napi.npmDir = Array.isArray(this.additionalArgs.npmDir) && this.additionalArgs.npmDir.length > 0 ? this.additionalArgs.npmDir[0] : String(this.additionalArgs.npmDir);
|
|
40
|
+
if (!this.config.napi.packageJsonPath) {
|
|
41
|
+
if (this.additionalArgs.packageJsonPath && ((0, _stryke_type_checks_is_string.isString)(this.additionalArgs.packageJsonPath) || Array.isArray(this.additionalArgs.packageJsonPath) && this.additionalArgs.packageJsonPath.length > 0)) this.config.napi.packageJsonPath = Array.isArray(this.additionalArgs.packageJsonPath) && this.additionalArgs.packageJsonPath.length > 0 ? this.additionalArgs.packageJsonPath[0] : String(this.additionalArgs.packageJsonPath);
|
|
42
|
+
if (!this.config.napi.packageJsonPath) this.config.napi.packageJsonPath = (0, _stryke_path_append.appendPath)(this.config.root, "package.json");
|
|
43
|
+
}
|
|
44
|
+
if (this.config.napi.target?.platform === "wasm") this.dependencies["@napi-rs/wasm-runtime"] = "^1.1.4";
|
|
45
|
+
let packageJson = {};
|
|
46
|
+
let originalPackageJson = {};
|
|
47
|
+
if (this.fs.existsSync(this.config.napi.packageJsonPath)) packageJson = JSON.parse(await this.fs.read(this.config.napi.packageJsonPath) || "{}");
|
|
48
|
+
originalPackageJson = { ...packageJson };
|
|
49
|
+
packageJson.napi = {
|
|
50
|
+
binaryName: this.config.napi.binaryName,
|
|
51
|
+
packageName: this.config.napi.packageName,
|
|
52
|
+
targets: this.config.napi.targets?.map((target) => target.triple),
|
|
53
|
+
npmClient: this.config.napi.npmClient,
|
|
54
|
+
constEnum: this.config.napi.constEnum,
|
|
55
|
+
dtsHeader: this.config.napi.dtsHeader,
|
|
56
|
+
dtsHeaderFile: this.config.napi.dtsHeaderFile,
|
|
57
|
+
...packageJson.napi,
|
|
58
|
+
wasm: this.config.napi.target?.platform === "wasm" ? (0, defu.defu)(packageJson.napi?.wasm ?? {}, this.config.napi.wasm ?? {}, { initialMemory: 16384 }) : void 0
|
|
59
|
+
};
|
|
60
|
+
if (JSON.stringify(packageJson) !== JSON.stringify(originalPackageJson)) await this.fs.write(this.config.napi.packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
61
|
+
},
|
|
62
|
+
async prepare() {
|
|
63
|
+
this.debug(`Preparing the N-API Rust runtime artifacts for the Powerlines project.`);
|
|
64
|
+
this.napi = new _napi_rs_cli.NapiCli();
|
|
65
|
+
if (this.config.napi.npmDir) await this.napi.createNpmDirs({
|
|
66
|
+
cwd: (0, _stryke_path_append.appendPath)(this.config.root, this.config.cwd),
|
|
67
|
+
npmDir: require_helpers_format_path.formatPath(this, this.config.napi.npmDir),
|
|
68
|
+
configPath: require_helpers_format_path.formatPath(this, this.config.napi.configPath),
|
|
69
|
+
packageJsonPath: require_helpers_format_path.formatPath(this, this.config.napi.packageJsonPath)
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
async build() {
|
|
73
|
+
this.debug(`Building the N-API Rust runtime artifacts for the Powerlines project.`);
|
|
74
|
+
const { task } = await this.napi.build({
|
|
75
|
+
cwd: (0, _stryke_path_append.appendPath)(this.config.root, this.config.cwd),
|
|
76
|
+
package: this.config.napi.packageName,
|
|
77
|
+
outputDir: require_helpers_format_path.formatPath(this, this.config.napi.outputDir),
|
|
78
|
+
configPath: require_helpers_format_path.formatPath(this, this.config.napi.configPath),
|
|
79
|
+
manifestPath: require_helpers_format_path.formatPath(this, this.config.napi.manifestPath),
|
|
80
|
+
packageJsonPath: require_helpers_format_path.formatPath(this, this.config.napi.packageJsonPath),
|
|
81
|
+
target: this.config.napi.target?.triple,
|
|
82
|
+
profile: this.config.napi.profile,
|
|
83
|
+
release: this.config.napi.release ?? this.config.mode === "production",
|
|
84
|
+
features: this.config.napi.features,
|
|
85
|
+
noDefaultFeatures: this.config.napi.noDefaultFeatures,
|
|
86
|
+
strip: this.config.napi.strip,
|
|
87
|
+
platform: this.config.napi.platform,
|
|
88
|
+
noDtsHeader: this.config.napi.noDtsHeader,
|
|
89
|
+
jsBinding: this.config.napi.jsBinding,
|
|
90
|
+
dts: this.config.napi.dts,
|
|
91
|
+
dtsCache: this.config.napi.dtsCache ?? !this.config.skipCache,
|
|
92
|
+
verbose: (0, powerlines_plugin_utils.isVerbose)(this)
|
|
93
|
+
});
|
|
94
|
+
const outputs = await task;
|
|
95
|
+
for (const output of outputs) {
|
|
96
|
+
const code = await this.fs.read(output.path);
|
|
97
|
+
if (code) await this.fs.write(output.path, code);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}];
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
exports.default = plugin;
|
|
105
|
+
exports.plugin = plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,104 @@
|
|
|
1
|
-
import{DEFAULT_TARGETS
|
|
1
|
+
import { DEFAULT_TARGETS } from "./types/targets.mjs";
|
|
2
|
+
import { formatPath } from "./helpers/format-path.mjs";
|
|
3
|
+
import { appendPath } from "@stryke/path/append";
|
|
4
|
+
import { isVerbose } from "powerlines/plugin-utils";
|
|
5
|
+
import { NapiCli, parseTriple } from "@napi-rs/cli";
|
|
6
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
7
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
8
|
+
import { defu } from "defu";
|
|
9
|
+
|
|
10
|
+
//#region src/index.tsx
|
|
11
|
+
/**
|
|
12
|
+
* 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.
|
|
13
|
+
*
|
|
14
|
+
* @see https://napi.rs/docs
|
|
15
|
+
*/
|
|
16
|
+
const plugin = (options = {}) => {
|
|
17
|
+
return [{
|
|
18
|
+
name: "napi-rs",
|
|
19
|
+
config() {
|
|
20
|
+
return { napi: {
|
|
21
|
+
dts: "binding.d.ts",
|
|
22
|
+
jsBinding: "binding.js",
|
|
23
|
+
outputDir: this.config.root,
|
|
24
|
+
platform: true,
|
|
25
|
+
strip: false,
|
|
26
|
+
...options
|
|
27
|
+
} };
|
|
28
|
+
},
|
|
29
|
+
async configResolved() {
|
|
30
|
+
if (!this.config.napi.target && this.additionalArgs.target && (isString(this.additionalArgs.target) || Array.isArray(this.additionalArgs.target) && this.additionalArgs.target.length > 0)) this.config.napi.target = parseTriple(Array.isArray(this.additionalArgs.target) && this.additionalArgs.target.length > 0 ? this.additionalArgs.target[0] : String(this.additionalArgs.target));
|
|
31
|
+
else this.config.napi.target = isString(this.config.napi.target) ? parseTriple(this.config.napi.target) : this.config.napi.target;
|
|
32
|
+
if (!this.config.napi.targets) if (this.additionalArgs.targets && (isString(this.additionalArgs.targets) || Array.isArray(this.additionalArgs.targets) && this.additionalArgs.targets.length > 0)) this.config.napi.targets = toArray(this.additionalArgs.targets).map((target) => parseTriple(target));
|
|
33
|
+
else this.config.napi.targets = DEFAULT_TARGETS.map((target) => parseTriple(target));
|
|
34
|
+
if (!this.config.napi.profile && this.additionalArgs.profile && (isString(this.additionalArgs.profile) || Array.isArray(this.additionalArgs.profile) && this.additionalArgs.profile.length > 0)) this.config.napi.profile = Array.isArray(this.additionalArgs.profile) && this.additionalArgs.profile.length > 0 ? this.additionalArgs.profile[0] : String(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 && (isString(this.additionalArgs.configPath) || Array.isArray(this.additionalArgs.configPath) && this.additionalArgs.configPath.length > 0)) this.config.napi.configPath = Array.isArray(this.additionalArgs.configPath) && this.additionalArgs.configPath.length > 0 ? this.additionalArgs.configPath[0] : String(this.additionalArgs.configPath);
|
|
37
|
+
if (!this.config.napi.manifestPath && this.additionalArgs.manifestPath && (isString(this.additionalArgs.manifestPath) || Array.isArray(this.additionalArgs.manifestPath) && this.additionalArgs.manifestPath.length > 0)) this.config.napi.manifestPath = Array.isArray(this.additionalArgs.manifestPath) && this.additionalArgs.manifestPath.length > 0 ? this.additionalArgs.manifestPath[0] : String(this.additionalArgs.manifestPath);
|
|
38
|
+
if (!this.config.napi.npmDir && this.additionalArgs.npmDir && (isString(this.additionalArgs.npmDir) || Array.isArray(this.additionalArgs.npmDir) && this.additionalArgs.npmDir.length > 0)) this.config.napi.npmDir = Array.isArray(this.additionalArgs.npmDir) && this.additionalArgs.npmDir.length > 0 ? this.additionalArgs.npmDir[0] : String(this.additionalArgs.npmDir);
|
|
39
|
+
if (!this.config.napi.packageJsonPath) {
|
|
40
|
+
if (this.additionalArgs.packageJsonPath && (isString(this.additionalArgs.packageJsonPath) || Array.isArray(this.additionalArgs.packageJsonPath) && this.additionalArgs.packageJsonPath.length > 0)) this.config.napi.packageJsonPath = Array.isArray(this.additionalArgs.packageJsonPath) && this.additionalArgs.packageJsonPath.length > 0 ? this.additionalArgs.packageJsonPath[0] : String(this.additionalArgs.packageJsonPath);
|
|
41
|
+
if (!this.config.napi.packageJsonPath) this.config.napi.packageJsonPath = appendPath(this.config.root, "package.json");
|
|
42
|
+
}
|
|
43
|
+
if (this.config.napi.target?.platform === "wasm") this.dependencies["@napi-rs/wasm-runtime"] = "^1.1.4";
|
|
44
|
+
let packageJson = {};
|
|
45
|
+
let originalPackageJson = {};
|
|
46
|
+
if (this.fs.existsSync(this.config.napi.packageJsonPath)) packageJson = JSON.parse(await this.fs.read(this.config.napi.packageJsonPath) || "{}");
|
|
47
|
+
originalPackageJson = { ...packageJson };
|
|
48
|
+
packageJson.napi = {
|
|
49
|
+
binaryName: this.config.napi.binaryName,
|
|
50
|
+
packageName: this.config.napi.packageName,
|
|
51
|
+
targets: this.config.napi.targets?.map((target) => target.triple),
|
|
52
|
+
npmClient: this.config.napi.npmClient,
|
|
53
|
+
constEnum: this.config.napi.constEnum,
|
|
54
|
+
dtsHeader: this.config.napi.dtsHeader,
|
|
55
|
+
dtsHeaderFile: this.config.napi.dtsHeaderFile,
|
|
56
|
+
...packageJson.napi,
|
|
57
|
+
wasm: this.config.napi.target?.platform === "wasm" ? defu(packageJson.napi?.wasm ?? {}, this.config.napi.wasm ?? {}, { initialMemory: 16384 }) : void 0
|
|
58
|
+
};
|
|
59
|
+
if (JSON.stringify(packageJson) !== JSON.stringify(originalPackageJson)) await this.fs.write(this.config.napi.packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
60
|
+
},
|
|
61
|
+
async prepare() {
|
|
62
|
+
this.debug(`Preparing the N-API Rust runtime artifacts for the Powerlines project.`);
|
|
63
|
+
this.napi = new NapiCli();
|
|
64
|
+
if (this.config.napi.npmDir) await this.napi.createNpmDirs({
|
|
65
|
+
cwd: appendPath(this.config.root, this.config.cwd),
|
|
66
|
+
npmDir: formatPath(this, this.config.napi.npmDir),
|
|
67
|
+
configPath: formatPath(this, this.config.napi.configPath),
|
|
68
|
+
packageJsonPath: formatPath(this, this.config.napi.packageJsonPath)
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
async build() {
|
|
72
|
+
this.debug(`Building the N-API Rust runtime artifacts for the Powerlines project.`);
|
|
73
|
+
const { task } = await this.napi.build({
|
|
74
|
+
cwd: appendPath(this.config.root, this.config.cwd),
|
|
75
|
+
package: this.config.napi.packageName,
|
|
76
|
+
outputDir: formatPath(this, this.config.napi.outputDir),
|
|
77
|
+
configPath: formatPath(this, this.config.napi.configPath),
|
|
78
|
+
manifestPath: formatPath(this, this.config.napi.manifestPath),
|
|
79
|
+
packageJsonPath: formatPath(this, this.config.napi.packageJsonPath),
|
|
80
|
+
target: this.config.napi.target?.triple,
|
|
81
|
+
profile: this.config.napi.profile,
|
|
82
|
+
release: this.config.napi.release ?? this.config.mode === "production",
|
|
83
|
+
features: this.config.napi.features,
|
|
84
|
+
noDefaultFeatures: this.config.napi.noDefaultFeatures,
|
|
85
|
+
strip: this.config.napi.strip,
|
|
86
|
+
platform: this.config.napi.platform,
|
|
87
|
+
noDtsHeader: this.config.napi.noDtsHeader,
|
|
88
|
+
jsBinding: this.config.napi.jsBinding,
|
|
89
|
+
dts: this.config.napi.dts,
|
|
90
|
+
dtsCache: this.config.napi.dtsCache ?? !this.config.skipCache,
|
|
91
|
+
verbose: isVerbose(this)
|
|
92
|
+
});
|
|
93
|
+
const outputs = await task;
|
|
94
|
+
for (const output of outputs) {
|
|
95
|
+
const code = await this.fs.read(output.path);
|
|
96
|
+
if (code) await this.fs.write(output.path, code);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
export { plugin as default, plugin };
|
|
2
104
|
//# sourceMappingURL=index.mjs.map
|
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 { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { isVerbose } from \"powerlines/plugin-utils\";\nimport { formatPath } from \"./helpers/format-path\";\nimport { DEFAULT_TARGETS } from \"./types\";\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 {\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 ...options\n }\n };\n },\n async configResolved() {\n if (\n !this.config.napi.target &&\n this.additionalArgs.target &&\n (isString(this.additionalArgs.target) ||\n (Array.isArray(this.additionalArgs.target) &&\n this.additionalArgs.target.length > 0))\n ) {\n this.config.napi.target = parseTriple(\n (Array.isArray(this.additionalArgs.target) &&\n this.additionalArgs.target.length > 0\n ? this.additionalArgs.target[0]\n : String(this.additionalArgs.target))!\n );\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.targets) {\n if (\n this.additionalArgs.targets &&\n (isString(this.additionalArgs.targets) ||\n (Array.isArray(this.additionalArgs.targets) &&\n this.additionalArgs.targets.length > 0))\n ) {\n this.config.napi.targets = toArray(this.additionalArgs.targets).map(\n (target: string) => parseTriple(target)\n );\n } else {\n this.config.napi.targets = DEFAULT_TARGETS.map(target =>\n parseTriple(target)\n );\n }\n }\n\n if (\n !this.config.napi.profile &&\n this.additionalArgs.profile &&\n (isString(this.additionalArgs.profile) ||\n (Array.isArray(this.additionalArgs.profile) &&\n this.additionalArgs.profile.length > 0))\n ) {\n this.config.napi.profile = (\n Array.isArray(this.additionalArgs.profile) &&\n this.additionalArgs.profile.length > 0\n ? this.additionalArgs.profile[0]\n : String(this.additionalArgs.profile)\n )!;\n }\n\n if (!this.config.napi.release && this.additionalArgs.release) {\n this.config.napi.release = Boolean(this.additionalArgs.release);\n }\n\n if (\n !this.config.napi.configPath &&\n this.additionalArgs.configPath &&\n (isString(this.additionalArgs.configPath) ||\n (Array.isArray(this.additionalArgs.configPath) &&\n this.additionalArgs.configPath.length > 0))\n ) {\n this.config.napi.configPath = (\n Array.isArray(this.additionalArgs.configPath) &&\n this.additionalArgs.configPath.length > 0\n ? this.additionalArgs.configPath[0]\n : String(this.additionalArgs.configPath)\n )!;\n }\n\n if (\n !this.config.napi.manifestPath &&\n this.additionalArgs.manifestPath &&\n (isString(this.additionalArgs.manifestPath) ||\n (Array.isArray(this.additionalArgs.manifestPath) &&\n this.additionalArgs.manifestPath.length > 0))\n ) {\n this.config.napi.manifestPath = (\n Array.isArray(this.additionalArgs.manifestPath) &&\n this.additionalArgs.manifestPath.length > 0\n ? this.additionalArgs.manifestPath[0]\n : String(this.additionalArgs.manifestPath)\n )!;\n }\n\n if (\n !this.config.napi.npmDir &&\n this.additionalArgs.npmDir &&\n (isString(this.additionalArgs.npmDir) ||\n (Array.isArray(this.additionalArgs.npmDir) &&\n this.additionalArgs.npmDir.length > 0))\n ) {\n this.config.napi.npmDir = (\n Array.isArray(this.additionalArgs.npmDir) &&\n this.additionalArgs.npmDir.length > 0\n ? this.additionalArgs.npmDir[0]\n : String(this.additionalArgs.npmDir)\n )!;\n }\n\n if (!this.config.napi.packageJsonPath) {\n if (\n this.additionalArgs.packageJsonPath &&\n (isString(this.additionalArgs.packageJsonPath) ||\n (Array.isArray(this.additionalArgs.packageJsonPath) &&\n this.additionalArgs.packageJsonPath.length > 0))\n ) {\n this.config.napi.packageJsonPath = (\n Array.isArray(this.additionalArgs.packageJsonPath) &&\n this.additionalArgs.packageJsonPath.length > 0\n ? this.additionalArgs.packageJsonPath[0]\n : String(this.additionalArgs.packageJsonPath)\n )!;\n }\n\n if (!this.config.napi.packageJsonPath) {\n this.config.napi.packageJsonPath = appendPath(\n this.config.root,\n \"package.json\"\n );\n }\n }\n\n if (this.config.napi.target?.platform === \"wasm\") {\n this.dependencies[\"@napi-rs/wasm-runtime\"] = \"^1.1.4\";\n }\n\n let packageJson = {} as Record<string, any>;\n let originalPackageJson = {} as Record<string, any>;\n\n if (this.fs.existsSync(this.config.napi.packageJsonPath)) {\n packageJson = JSON.parse(\n (await this.fs.read(this.config.napi.packageJsonPath)) || \"{}\"\n );\n }\n\n originalPackageJson = { ...packageJson };\n packageJson.napi = {\n binaryName: this.config.napi.binaryName,\n packageName: this.config.napi.packageName,\n targets: this.config.napi.targets?.map(target => target.triple),\n npmClient: this.config.napi.npmClient,\n constEnum: this.config.napi.constEnum,\n dtsHeader: this.config.napi.dtsHeader,\n dtsHeaderFile: this.config.napi.dtsHeaderFile,\n ...packageJson.napi,\n wasm:\n this.config.napi.target?.platform === \"wasm\"\n ? defu(\n packageJson.napi?.wasm ?? {},\n this.config.napi.wasm ?? {},\n { initialMemory: 16384 }\n )\n : undefined\n };\n\n if (\n JSON.stringify(packageJson) !== JSON.stringify(originalPackageJson)\n ) {\n await this.fs.write(\n this.config.napi.packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n }\n },\n async prepare() {\n this.debug(\n `Preparing the N-API Rust runtime artifacts for the Powerlines project.`\n );\n\n this.napi = new NapiCli();\n\n if (this.config.napi.npmDir) {\n await this.napi.createNpmDirs({\n cwd: appendPath(this.config.root, this.config.cwd),\n npmDir: formatPath(this, this.config.napi.npmDir),\n configPath: formatPath(this, this.config.napi.configPath),\n packageJsonPath: formatPath(this, this.config.napi.packageJsonPath)\n });\n }\n },\n async build() {\n this.debug(\n `Building the N-API Rust runtime artifacts for the Powerlines project.`\n );\n\n const { task } = await this.napi.build({\n cwd: appendPath(this.config.root, this.config.cwd),\n package: this.config.napi.packageName,\n outputDir: formatPath(this, this.config.napi.outputDir),\n configPath: formatPath(this, this.config.napi.configPath),\n manifestPath: formatPath(this, this.config.napi.manifestPath),\n packageJsonPath: formatPath(this, this.config.napi.packageJsonPath),\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) {\n await this.fs.write(output.path, code);\n }\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":"kZAgCA,MAAY,GAAO,EAAA,EAAA,GACV,CAAC,CACR,KAAA,UACF,QAAA,QAEE,KAAA,CACG,IAAU,eACd,UAAA,aACO,UAAa,KAAG,OAAA,KACtB,SAAA,GACK,MAAM,GACH,GAAC,EACN,CACH,EAEE,MAAM,gBAAW,CACf,CAAA,KAAS,OAAA,KAAA,QAAA,KAAA,eAAA,SAAA,EAAA,KAAA,eAAA,OAAA,EAAA,MAAA,QAAA,KAAA,eAAA,OAAA,EAAA,KAAA,eAAA,OAAA,OAAA,GACP,KAAA,OAAO,KAAA,OAAA,EAAA,MAAA,QAAA,KAAA,eAAA,OAAA,EAAA,KAAA,eAAA,OAAA,OAAA,EAAA,KAAA,eAAA,OAAA,GAAA,OAAA,KAAA,eAAA,OAAA,CAAA,CAEP,KAAI,OAAM,KAAO,OAAM,EAAA,KAAA,OAAA,KAAA,OAAA,CAAA,EAAA,KAAA,OAAA,KAAA,OAAA,CAAA,KAAA,OAAA,KAAA,OAEpB,KAAC,OAAW,KAAK,UAChB,KAAA,eAAc,UAAA,EAAA,KAAA,eAAA,QAAA,EAAA,MAAA,QAAA,KAAA,eAAA,QAAA,EAAA,KAAA,eAAA,QAAA,OAAA,GAChB,KAAE,OAAO,KAAK,QAAA,EAAA,KAAA,eAAA,QAAA,CAAA,IAAA,GAAA,EAAA,EAAA,CAAA,CAEd,KAAA,OAAA,KAAA,QAAA,EAAA,IAAA,GAAA,EAAA,EAAA,CAAA,EAGJ,CAAK,KAAC,OAAA,KAAgB,SAAC,KAAA,eAAA,UAAA,EAAA,KAAA,eAAA,QAAA,EAAA,MAAA,QAAA,KAAA,eAAA,QAAA,EAAA,KAAA,eAAA,QAAA,OAAA,KACrB,KAAG,OAAA,KAAA,QAAA,MAAA,QAAA,KA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C9B,WAAK,EAAe,KAAA,KAAY,OAAA,KAAA,WAAA,CAChC,gBAAe,EAAA,KAAe,KAAA,OAAa,KAAA,gBAAA,CAC5C,CAAC,EAGN,MAAM,OAAK,CACT,KAAK,MAAM,wEAA0C,CACrD,GAAM,CACJ,QACE,MAAM,KAAA,KAAO,MAAK,CACpB,IAAI,EAAA,KAAA,OAAA,KAAA,KAAA,OAAA,IAAA,CACJ,QAAA,KAAA,OAAA,KAAA,yDAEA,WAAG,EAAA,KAAA,KAAA,OAAA,KAAA,WAAA,CACH,aAAc,EAAM,KAAA,KAAc,OAAA,KAAA,aAAA,CAClC,gBAAO,EAAe,KAAY,KAAE,OAAA,KAAA,gBAAA,CACpC,OAAG,KAAS,OAAK,KAAA,QAAe,OAChC,QAAK,KAAM,OAAQ,KAAK,QACxB,QAAM,KAAK,OAAA,KAAe,SAAA,KAAa,OAAU,OAAC,aAClD,SAAE,KAAA,OAAA,KAAA,SACF,kBAAmB,KAAA,OAAY,KAAG,kBAClC,MAAI,KAAM,OAAQ,KAAK,MACvB,SAAS,KAAA,OAAA,KAAe,SACxB,YAAa,KAAA,OAAA,KAAe,YAC5B,UAAQ,KAAO,OAAK,KAAA,UACpB,IAAI,KAAA,OAAA,KAAA,IACJ,SAAA,KAAA,OAAA,KAAA,UAAA,CAAA,KAAA,OAAA,0BAED,CAAC,CACG,EAAW,MAAM,EACtB,IAAI,IAAK,KAAA,EAAqB,CAC5B,IAAG,EAAS,MAAK,KAAA,GAAA,KAAe,EAAO,KAAE,CACrC,GACF,MAAI,KAAK,GAAA,MAAA,EAAe,KAAO,EAAO,GAI7C,CAAC"}
|
|
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 { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { isVerbose } from \"powerlines/plugin-utils\";\nimport { formatPath } from \"./helpers/format-path\";\nimport { DEFAULT_TARGETS } from \"./types\";\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 {\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 ...options\n }\n };\n },\n async configResolved() {\n if (\n !this.config.napi.target &&\n this.additionalArgs.target &&\n (isString(this.additionalArgs.target) ||\n (Array.isArray(this.additionalArgs.target) &&\n this.additionalArgs.target.length > 0))\n ) {\n this.config.napi.target = parseTriple(\n (Array.isArray(this.additionalArgs.target) &&\n this.additionalArgs.target.length > 0\n ? this.additionalArgs.target[0]\n : String(this.additionalArgs.target))!\n );\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.targets) {\n if (\n this.additionalArgs.targets &&\n (isString(this.additionalArgs.targets) ||\n (Array.isArray(this.additionalArgs.targets) &&\n this.additionalArgs.targets.length > 0))\n ) {\n this.config.napi.targets = toArray(this.additionalArgs.targets).map(\n (target: string) => parseTriple(target)\n );\n } else {\n this.config.napi.targets = DEFAULT_TARGETS.map(target =>\n parseTriple(target)\n );\n }\n }\n\n if (\n !this.config.napi.profile &&\n this.additionalArgs.profile &&\n (isString(this.additionalArgs.profile) ||\n (Array.isArray(this.additionalArgs.profile) &&\n this.additionalArgs.profile.length > 0))\n ) {\n this.config.napi.profile = (\n Array.isArray(this.additionalArgs.profile) &&\n this.additionalArgs.profile.length > 0\n ? this.additionalArgs.profile[0]\n : String(this.additionalArgs.profile)\n )!;\n }\n\n if (!this.config.napi.release && this.additionalArgs.release) {\n this.config.napi.release = Boolean(this.additionalArgs.release);\n }\n\n if (\n !this.config.napi.configPath &&\n this.additionalArgs.configPath &&\n (isString(this.additionalArgs.configPath) ||\n (Array.isArray(this.additionalArgs.configPath) &&\n this.additionalArgs.configPath.length > 0))\n ) {\n this.config.napi.configPath = (\n Array.isArray(this.additionalArgs.configPath) &&\n this.additionalArgs.configPath.length > 0\n ? this.additionalArgs.configPath[0]\n : String(this.additionalArgs.configPath)\n )!;\n }\n\n if (\n !this.config.napi.manifestPath &&\n this.additionalArgs.manifestPath &&\n (isString(this.additionalArgs.manifestPath) ||\n (Array.isArray(this.additionalArgs.manifestPath) &&\n this.additionalArgs.manifestPath.length > 0))\n ) {\n this.config.napi.manifestPath = (\n Array.isArray(this.additionalArgs.manifestPath) &&\n this.additionalArgs.manifestPath.length > 0\n ? this.additionalArgs.manifestPath[0]\n : String(this.additionalArgs.manifestPath)\n )!;\n }\n\n if (\n !this.config.napi.npmDir &&\n this.additionalArgs.npmDir &&\n (isString(this.additionalArgs.npmDir) ||\n (Array.isArray(this.additionalArgs.npmDir) &&\n this.additionalArgs.npmDir.length > 0))\n ) {\n this.config.napi.npmDir = (\n Array.isArray(this.additionalArgs.npmDir) &&\n this.additionalArgs.npmDir.length > 0\n ? this.additionalArgs.npmDir[0]\n : String(this.additionalArgs.npmDir)\n )!;\n }\n\n if (!this.config.napi.packageJsonPath) {\n if (\n this.additionalArgs.packageJsonPath &&\n (isString(this.additionalArgs.packageJsonPath) ||\n (Array.isArray(this.additionalArgs.packageJsonPath) &&\n this.additionalArgs.packageJsonPath.length > 0))\n ) {\n this.config.napi.packageJsonPath = (\n Array.isArray(this.additionalArgs.packageJsonPath) &&\n this.additionalArgs.packageJsonPath.length > 0\n ? this.additionalArgs.packageJsonPath[0]\n : String(this.additionalArgs.packageJsonPath)\n )!;\n }\n\n if (!this.config.napi.packageJsonPath) {\n this.config.napi.packageJsonPath = appendPath(\n this.config.root,\n \"package.json\"\n );\n }\n }\n\n if (this.config.napi.target?.platform === \"wasm\") {\n this.dependencies[\"@napi-rs/wasm-runtime\"] = \"^1.1.4\";\n }\n\n let packageJson = {} as Record<string, any>;\n let originalPackageJson = {} as Record<string, any>;\n\n if (this.fs.existsSync(this.config.napi.packageJsonPath)) {\n packageJson = JSON.parse(\n (await this.fs.read(this.config.napi.packageJsonPath)) || \"{}\"\n );\n }\n\n originalPackageJson = { ...packageJson };\n packageJson.napi = {\n binaryName: this.config.napi.binaryName,\n packageName: this.config.napi.packageName,\n targets: this.config.napi.targets?.map(target => target.triple),\n npmClient: this.config.napi.npmClient,\n constEnum: this.config.napi.constEnum,\n dtsHeader: this.config.napi.dtsHeader,\n dtsHeaderFile: this.config.napi.dtsHeaderFile,\n ...packageJson.napi,\n wasm:\n this.config.napi.target?.platform === \"wasm\"\n ? defu(\n packageJson.napi?.wasm ?? {},\n this.config.napi.wasm ?? {},\n { initialMemory: 16384 }\n )\n : undefined\n };\n\n if (\n JSON.stringify(packageJson) !== JSON.stringify(originalPackageJson)\n ) {\n await this.fs.write(\n this.config.napi.packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n }\n },\n async prepare() {\n this.debug(\n `Preparing the N-API Rust runtime artifacts for the Powerlines project.`\n );\n\n this.napi = new NapiCli();\n\n if (this.config.napi.npmDir) {\n await this.napi.createNpmDirs({\n cwd: appendPath(this.config.root, this.config.cwd),\n npmDir: formatPath(this, this.config.napi.npmDir),\n configPath: formatPath(this, this.config.napi.configPath),\n packageJsonPath: formatPath(this, this.config.napi.packageJsonPath)\n });\n }\n },\n async build() {\n this.debug(\n `Building the N-API Rust runtime artifacts for the Powerlines project.`\n );\n\n const { task } = await this.napi.build({\n cwd: appendPath(this.config.root, this.config.cwd),\n package: this.config.napi.packageName,\n outputDir: formatPath(this, this.config.napi.outputDir),\n configPath: formatPath(this, this.config.napi.configPath),\n manifestPath: formatPath(this, this.config.napi.manifestPath),\n packageJsonPath: formatPath(this, this.config.napi.packageJsonPath),\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) {\n await this.fs.write(output.path, code);\n }\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;AAgCA,MAAY,UAAO,UAAA,EAAA,KAAA;AACjB,QAAO,CAAC;EACR,MAAA;EACF,SAAA;YAEE,MAAA;IACG,KAAU;IACd,WAAA;IACO,WAAa,KAAG,OAAA;IACtB,UAAA;IACK,OAAM;IACH,GAAC;IACN,EACH;;EAEE,MAAM,iBAAW;AACf,OAAA,CAAA,KAAS,OAAA,KAAA,UAAA,KAAA,eAAA,WAAA,SAAA,KAAA,eAAA,OAAA,IAAA,MAAA,QAAA,KAAA,eAAA,OAAA,IAAA,KAAA,eAAA,OAAA,SAAA,GACP,MAAA,OAAO,KAAA,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AAe,MAAY,KAAE,OAAA,KAAA,gBAAA;IACpC,QAAG,KAAS,OAAK,KAAA,QAAe;IAChC,SAAK,KAAM,OAAQ,KAAK;IACxB,SAAM,KAAK,OAAA,KAAe,WAAA,KAAa,OAAU,SAAC;IAClD,UAAE,KAAA,OAAA,KAAA;IACF,mBAAmB,KAAA,OAAY,KAAG;IAClC,OAAI,KAAM,OAAQ,KAAK;IACvB,UAAS,KAAA,OAAA,KAAe;IACxB,aAAa,KAAA,OAAA,KAAe;IAC5B,WAAQ,KAAO,OAAK,KAAA;IACpB,KAAI,KAAA,OAAA,KAAA;IACJ,UAAA,KAAA,OAAA,KAAA,YAAA,CAAA,KAAA,OAAA;;IAED,CAAC;GACF,MAAK,UAAW,MAAM;AACtB,QAAI,MAAK,UAAA,SAAqB;IAC5B,MAAG,OAAS,MAAK,KAAA,GAAA,KAAe,OAAO,KAAE;AACzC,QAAI,KACF,OAAI,KAAK,GAAA,MAAA,OAAe,MAAO,KAAO;;;EAI7C,CAAC"}
|
package/dist/types/index.cjs
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_types_targets = require('./targets.cjs');
|
|
3
|
+
|
|
4
|
+
exports.AVAILABLE_TARGETS = require_types_targets.AVAILABLE_TARGETS;
|
|
5
|
+
exports.DEFAULT_TARGETS = require_types_targets.DEFAULT_TARGETS;
|
package/dist/types/index.mjs
CHANGED
package/dist/types/plugin.cjs
CHANGED
|
@@ -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
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
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 { };
|
|
2
12
|
//# sourceMappingURL=plugin.mjs.map
|
package/dist/types/targets.cjs
CHANGED
|
@@ -1 +1,39 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
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;
|
package/dist/types/targets.mjs
CHANGED
|
@@ -1,2 +1,37 @@
|
|
|
1
|
-
|
|
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 };
|
|
2
37
|
//# sourceMappingURL=targets.mjs.map
|
|
@@ -1 +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,
|
|
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"}
|
package/dist/types/wasm.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-napi-rs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34",
|
|
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"],
|
|
@@ -137,9 +137,9 @@
|
|
|
137
137
|
"@alloy-js/markdown": "0.23.0-dev.1",
|
|
138
138
|
"@alloy-js/typescript": "0.23.0-dev.4",
|
|
139
139
|
"@napi-rs/cli": "^3.6.2",
|
|
140
|
-
"@powerlines/plugin-alloy": "^0.26.
|
|
141
|
-
"@powerlines/plugin-automd": "^0.1.
|
|
142
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
140
|
+
"@powerlines/plugin-alloy": "^0.26.77",
|
|
141
|
+
"@powerlines/plugin-automd": "^0.1.458",
|
|
142
|
+
"@powerlines/plugin-plugin": "^0.12.409",
|
|
143
143
|
"@stryke/convert": "^0.7.3",
|
|
144
144
|
"@stryke/fs": "^0.33.70",
|
|
145
145
|
"@stryke/path": "^0.28.2",
|
|
@@ -148,11 +148,11 @@
|
|
|
148
148
|
"@stryke/types": "^0.12.0",
|
|
149
149
|
"automd": "^0.4.3",
|
|
150
150
|
"defu": "^6.1.7",
|
|
151
|
-
"powerlines": "^0.46.
|
|
151
|
+
"powerlines": "^0.46.5"
|
|
152
152
|
},
|
|
153
153
|
"devDependencies": { "@types/node": "^25.6.0" },
|
|
154
154
|
"peerDependencies": { "@napi-rs/wasm-runtime": ">=1.1.4" },
|
|
155
155
|
"peerDependenciesMeta": { "@napi-rs/wasm-runtime": { "optional": true } },
|
|
156
156
|
"publishConfig": { "access": "public" },
|
|
157
|
-
"gitHead": "
|
|
157
|
+
"gitHead": "9af888c54e58a82744cc334a6b80da52429fa0ac"
|
|
158
158
|
}
|