@powerlines/plugin-napi-rs 0.2.178 → 0.2.182

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.
@@ -14,9 +14,9 @@ let powerlines_plugin_utils = require("powerlines/plugin-utils");
14
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
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
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;
17
+ function formatPath(context, path, appendRoot = true) {
18
+ const root = (0, _stryke_path_append.appendPath)(context.config.root, context.config.cwd);
19
+ return path ? (0, _stryke_path_file_path_fns.relativePath)(root, (0, _stryke_path_append.appendPath)(appendRoot ? (0, _stryke_path_append.appendPath)((0, powerlines_plugin_utils.replacePathTokens)(context, path), context.config.root) : (0, powerlines_plugin_utils.replacePathTokens)(context, path), context.config.cwd)) : void 0;
20
20
  }
21
21
 
22
22
  //#endregion
@@ -10,7 +10,7 @@ import { NapiPluginContext } from "../types/plugin.cjs";
10
10
  * @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.
11
11
  * @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.
12
12
  */
13
- declare function formatPath(context: NapiPluginContext, path?: string): string | undefined;
13
+ declare function formatPath(context: NapiPluginContext, path?: string, appendRoot?: boolean): string | undefined;
14
14
  //#endregion
15
15
  export { formatPath };
16
16
  //# sourceMappingURL=format-path.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-path.d.cts","names":[],"sources":["../../src/helpers/format-path.ts"],"mappings":";;;;;AAiCA;;;;;;;iBAAgB,UAAA,CACd,OAAA,EAAS,iBAAiB,EAC1B,IAAA"}
1
+ {"version":3,"file":"format-path.d.cts","names":[],"sources":["../../src/helpers/format-path.ts"],"mappings":";;;;;AAiCA;;;;;;;iBAAgB,UAAA,CACd,OAAA,EAAS,iBAAiB,EAC1B,IAAA,WACA,UAAA"}
@@ -10,7 +10,7 @@ import { NapiPluginContext } from "../types/plugin.mjs";
10
10
  * @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.
11
11
  * @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.
12
12
  */
13
- declare function formatPath(context: NapiPluginContext, path?: string): string | undefined;
13
+ declare function formatPath(context: NapiPluginContext, path?: string, appendRoot?: boolean): string | undefined;
14
14
  //#endregion
15
15
  export { formatPath };
16
16
  //# sourceMappingURL=format-path.d.mts.map
@@ -13,9 +13,9 @@ import { replacePathTokens } from "powerlines/plugin-utils";
13
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
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
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;
16
+ function formatPath(context, path, appendRoot = true) {
17
+ const root = appendPath(context.config.root, context.config.cwd);
18
+ return path ? relativePath(root, appendPath(appendRoot ? appendPath(replacePathTokens(context, path), context.config.root) : replacePathTokens(context, path), context.config.cwd)) : void 0;
19
19
  }
20
20
 
21
21
  //#endregion
package/dist/index.cjs CHANGED
@@ -5,6 +5,8 @@ let _stryke_path_append = require("@stryke/path/append");
5
5
  let powerlines_plugin_utils = require("powerlines/plugin-utils");
6
6
  let _napi_rs_cli = require("@napi-rs/cli");
7
7
  let _stryke_convert_to_array = require("@stryke/convert/to-array");
8
+ let _stryke_path_join = require("@stryke/path/join");
9
+ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
8
10
  let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
9
11
  let defu = require("defu");
10
12
 
@@ -39,7 +41,7 @@ const plugin = (options = {}) => {
39
41
  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
42
  if (!this.config.napi.packageJsonPath) {
41
43
  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");
44
+ if (!this.config.napi.packageJsonPath) this.config.napi.packageJsonPath = (0, _stryke_path_join.joinPaths)(this.config.root, "package.json");
43
45
  }
44
46
  if (this.config.napi.target?.platform === "wasm") this.dependencies["@napi-rs/wasm-runtime"] = "^1.1.4";
45
47
  let packageJson = {};
@@ -49,7 +51,7 @@ const plugin = (options = {}) => {
49
51
  packageJson.napi = {
50
52
  binaryName: this.config.napi.binaryName,
51
53
  packageName: this.config.napi.packageName,
52
- targets: this.config.napi.targets?.map((target) => target.triple),
54
+ targets: this.config.napi.targets?.map((target) => (0, _stryke_type_checks_is_set_string.isSetString)(target) ? target : target.triple),
53
55
  npmClient: this.config.napi.npmClient,
54
56
  constEnum: this.config.napi.constEnum,
55
57
  dtsHeader: this.config.napi.dtsHeader,
@@ -76,7 +78,7 @@ const plugin = (options = {}) => {
76
78
  package: this.config.napi.packageName,
77
79
  outputDir: require_helpers_format_path.formatPath(this, this.config.napi.outputDir),
78
80
  configPath: require_helpers_format_path.formatPath(this, this.config.napi.configPath),
79
- manifestPath: require_helpers_format_path.formatPath(this, this.config.napi.manifestPath),
81
+ manifestPath: require_helpers_format_path.formatPath(this, this.config.napi.manifestPath, false),
80
82
  packageJsonPath: require_helpers_format_path.formatPath(this, this.config.napi.packageJsonPath),
81
83
  target: this.config.napi.target?.triple,
82
84
  profile: this.config.napi.profile,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;YAgCY,MAAA;IACR,IAAA,GAAO,iBAAiB;EAAA;AAAA;;;;;;cASf,MAAA,oBAA2B,iBAAA,GAAoB,iBAAA,EAC1D,OAAA,GAAS,iBAAA,KA2OJ,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;YAkCY,MAAA;IACR,IAAA,GAAO,iBAAiB;EAAA;AAAA;;;;;;cASf,MAAA,oBAA2B,iBAAA,GAAoB,iBAAA,EAC1D,OAAA,GAAS,iBAAA,KA6OJ,MAAA,CAAO,QAAA"}
package/dist/index.mjs CHANGED
@@ -4,6 +4,8 @@ import { appendPath } from "@stryke/path/append";
4
4
  import { isVerbose } from "powerlines/plugin-utils";
5
5
  import { NapiCli, parseTriple } from "@napi-rs/cli";
6
6
  import { toArray } from "@stryke/convert/to-array";
7
+ import { joinPaths } from "@stryke/path/join";
8
+ import { isSetString } from "@stryke/type-checks/is-set-string";
7
9
  import { isString } from "@stryke/type-checks/is-string";
8
10
  import { defu } from "defu";
9
11
 
@@ -38,7 +40,7 @@ const plugin = (options = {}) => {
38
40
  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
41
  if (!this.config.napi.packageJsonPath) {
40
42
  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");
43
+ if (!this.config.napi.packageJsonPath) this.config.napi.packageJsonPath = joinPaths(this.config.root, "package.json");
42
44
  }
43
45
  if (this.config.napi.target?.platform === "wasm") this.dependencies["@napi-rs/wasm-runtime"] = "^1.1.4";
44
46
  let packageJson = {};
@@ -48,7 +50,7 @@ const plugin = (options = {}) => {
48
50
  packageJson.napi = {
49
51
  binaryName: this.config.napi.binaryName,
50
52
  packageName: this.config.napi.packageName,
51
- targets: this.config.napi.targets?.map((target) => target.triple),
53
+ targets: this.config.napi.targets?.map((target) => isSetString(target) ? target : target.triple),
52
54
  npmClient: this.config.napi.npmClient,
53
55
  constEnum: this.config.napi.constEnum,
54
56
  dtsHeader: this.config.napi.dtsHeader,
@@ -75,7 +77,7 @@ const plugin = (options = {}) => {
75
77
  package: this.config.napi.packageName,
76
78
  outputDir: formatPath(this, this.config.napi.outputDir),
77
79
  configPath: formatPath(this, this.config.napi.configPath),
78
- manifestPath: formatPath(this, this.config.napi.manifestPath),
80
+ manifestPath: formatPath(this, this.config.napi.manifestPath, false),
79
81
  packageJsonPath: formatPath(this, this.config.napi.packageJsonPath),
80
82
  target: this.config.napi.target?.triple,
81
83
  profile: this.config.napi.profile,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-napi-rs",
3
- "version": "0.2.178",
3
+ "version": "0.2.182",
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",
138
138
  "@alloy-js/typescript": "^0.23.0",
139
139
  "@napi-rs/cli": "^3.7.0",
140
- "@powerlines/plugin-alloy": "0.26.221",
141
- "@powerlines/plugin-automd": "0.1.589",
142
- "@powerlines/plugin-plugin": "0.12.540",
140
+ "@powerlines/plugin-alloy": "^0.26.223",
141
+ "@powerlines/plugin-automd": "^0.1.591",
142
+ "@powerlines/plugin-plugin": "^0.12.542",
143
143
  "@stryke/convert": "^0.7.15",
144
144
  "@stryke/fs": "^0.33.85",
145
145
  "@stryke/path": "^0.29.11",
@@ -148,11 +148,11 @@
148
148
  "@stryke/types": "^0.12.12",
149
149
  "automd": "^0.4.3",
150
150
  "defu": "^6.1.7",
151
- "powerlines": "0.47.128"
151
+ "powerlines": "^0.47.130"
152
152
  },
153
153
  "devDependencies": { "@types/node": "^25.9.2" },
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": "c5d53659563ee53a4d919ab56b16cd18b0c9090b"
157
+ "gitHead": "3090a7dd06299e0448f7c76758390eba7643fc95"
158
158
  }