@powerlines/plugin-napi-rs 0.2.8 → 0.2.10

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.
Files changed (42) hide show
  1. package/dist/helpers/format-path.cjs +1 -0
  2. package/dist/helpers/format-path.d.cts +16 -0
  3. package/dist/helpers/format-path.d.cts.map +1 -0
  4. package/dist/helpers/format-path.d.mts +16 -0
  5. package/dist/helpers/format-path.d.mts.map +1 -0
  6. package/dist/helpers/format-path.mjs +2 -0
  7. package/dist/helpers/format-path.mjs.map +1 -0
  8. package/dist/index.cjs +1 -0
  9. package/dist/index.d.cts +20 -0
  10. package/dist/index.d.cts.map +1 -0
  11. package/dist/index.d.mts +20 -0
  12. package/dist/index.d.mts.map +1 -0
  13. package/dist/index.mjs +2 -0
  14. package/dist/index.mjs.map +1 -0
  15. package/dist/node_modules/.pnpm/@stryke_convert@0.7.2/node_modules/@stryke/convert/dist/to-array.cjs +1 -0
  16. package/dist/node_modules/.pnpm/@stryke_convert@0.7.2/node_modules/@stryke/convert/dist/to-array.mjs +2 -0
  17. package/dist/node_modules/.pnpm/@stryke_convert@0.7.2/node_modules/@stryke/convert/dist/to-array.mjs.map +1 -0
  18. package/dist/types/index.cjs +1 -0
  19. package/dist/types/index.d.cts +4 -0
  20. package/dist/types/index.d.mts +4 -0
  21. package/dist/types/index.mjs +1 -0
  22. package/dist/types/plugin.cjs +0 -0
  23. package/dist/types/plugin.d.cts +180 -0
  24. package/dist/types/plugin.d.cts.map +1 -0
  25. package/dist/types/plugin.d.mts +180 -0
  26. package/dist/types/plugin.d.mts.map +1 -0
  27. package/dist/types/plugin.mjs +2 -0
  28. package/dist/types/plugin.mjs.map +1 -0
  29. package/dist/types/targets.cjs +1 -0
  30. package/dist/types/targets.d.cts +16 -0
  31. package/dist/types/targets.d.cts.map +1 -0
  32. package/dist/types/targets.d.mts +16 -0
  33. package/dist/types/targets.d.mts.map +1 -0
  34. package/dist/types/targets.mjs +2 -0
  35. package/dist/types/targets.mjs.map +1 -0
  36. package/dist/types/wasm.cjs +0 -0
  37. package/dist/types/wasm.d.cts +44 -0
  38. package/dist/types/wasm.d.cts.map +1 -0
  39. package/dist/types/wasm.d.mts +44 -0
  40. package/dist/types/wasm.d.mts.map +1 -0
  41. package/dist/types/wasm.mjs +1 -0
  42. package/package.json +12 -12
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@stryke/path/append`),t=require(`@stryke/path/file-path-fns`),n=require(`powerlines/plugin-utils`);function r(r,i){let a=(0,e.appendPath)(r.config.root,r.config.cwd);return i?(0,t.relativePath)(a,(0,e.appendPath)((0,e.appendPath)((0,n.replacePathTokens)(r,i),r.config.root),r.config.cwd)):void 0}exports.formatPath=r;
@@ -0,0 +1,16 @@
1
+ import { NapiPluginContext } from "../types/plugin.cjs";
2
+ //#region src/helpers/format-path.d.ts
3
+ /**
4
+ * Format the given path by replacing tokens and making it relative to the project root.
5
+ *
6
+ * @remarks
7
+ * 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.
8
+ *
9
+ * @param context - The plugin context, which contains the configuration and other information about the plugin's execution environment.
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
+ * @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
+ */
13
+ declare function formatPath(context: NapiPluginContext, path?: string): string | undefined;
14
+ //#endregion
15
+ export { formatPath };
16
+ //# sourceMappingURL=format-path.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-path.d.cts","names":[],"sources":["../../src/helpers/format-path.ts"],"mappings":";;;;;AAiCA;;;;;;;iBAAgB,UAAA,CACd,OAAA,EAAS,iBAAA,EACT,IAAA"}
@@ -0,0 +1,16 @@
1
+ import { NapiPluginContext } from "../types/plugin.mjs";
2
+ //#region src/helpers/format-path.d.ts
3
+ /**
4
+ * Format the given path by replacing tokens and making it relative to the project root.
5
+ *
6
+ * @remarks
7
+ * 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.
8
+ *
9
+ * @param context - The plugin context, which contains the configuration and other information about the plugin's execution environment.
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
+ * @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
+ */
13
+ declare function formatPath(context: NapiPluginContext, path?: string): string | undefined;
14
+ //#endregion
15
+ export { formatPath };
16
+ //# sourceMappingURL=format-path.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-path.d.mts","names":[],"sources":["../../src/helpers/format-path.ts"],"mappings":";;;;;AAiCA;;;;;;;iBAAgB,UAAA,CACd,OAAA,EAAS,iBAAA,EACT,IAAA"}
@@ -0,0 +1,2 @@
1
+ import{appendPath as e}from"@stryke/path/append";import{relativePath as t}from"@stryke/path/file-path-fns";import{replacePathTokens as n}from"powerlines/plugin-utils";function r(r,i){let a=e(r.config.root,r.config.cwd);return i?t(a,e(e(n(r,i),r.config.root),r.config.cwd)):void 0}export{r as formatPath};
2
+ //# sourceMappingURL=format-path.mjs.map
@@ -0,0 +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":"uKAiCA,SAAgB,EAAU,EAAA,EAAA,CACxB,IAAA,EAAS,EAAA,EAAiB,OAAA,KAAA,EAAA,OAAA,IAAA,CAC1B,OAAO,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA,EAAA,OAAA,KAAA,CAAA,EAAA,OAAA,IAAA,CAAA,CAAA,IAAA"}
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./types/targets.cjs`),t=require(`./helpers/format-path.cjs`),n=require(`./node_modules/.pnpm/@stryke_convert@0.7.2/node_modules/@stryke/convert/dist/to-array.cjs`);let r=require(`@stryke/path/append`),i=require(`powerlines/plugin-utils`),a=require(`@napi-rs/cli`),o=require(`@stryke/type-checks/is-string`),s=require(`defu`);const c=(c={})=>[{name:`napi-rs`,config(){return{napi:{dts:`binding.d.ts`,jsBinding:`binding.js`,outputDir:this.config.root,platform:!0,strip:!1,...c}}},async configResolved(){!this.config.napi.target&&this.additionalArgs.target&&((0,o.isString)(this.additionalArgs.target)||Array.isArray(this.additionalArgs.target)&&this.additionalArgs.target.length>0)?this.config.napi.target=(0,a.parseTriple)(Array.isArray(this.additionalArgs.target)&&this.additionalArgs.target.length>0?this.additionalArgs.target[0]:String(this.additionalArgs.target)):this.config.napi.target=(0,o.isString)(this.config.napi.target)?(0,a.parseTriple)(this.config.napi.target):this.config.napi.target,this.config.napi.targets||(this.additionalArgs.targets&&((0,o.isString)(this.additionalArgs.targets)||Array.isArray(this.additionalArgs.targets)&&this.additionalArgs.targets.length>0)?this.config.napi.targets=n.toArray(this.additionalArgs.targets).map(e=>(0,a.parseTriple)(e)):this.config.napi.targets=e.DEFAULT_TARGETS.map(e=>(0,a.parseTriple)(e))),!this.config.napi.profile&&this.additionalArgs.profile&&((0,o.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)),!this.config.napi.release&&this.additionalArgs.release&&(this.config.napi.release=!!this.additionalArgs.release),!this.config.napi.configPath&&this.additionalArgs.configPath&&((0,o.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)),!this.config.napi.manifestPath&&this.additionalArgs.manifestPath&&((0,o.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)),!this.config.napi.npmDir&&this.additionalArgs.npmDir&&((0,o.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)),this.config.napi.packageJsonPath||(this.additionalArgs.packageJsonPath&&((0,o.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)),this.config.napi.packageJsonPath||(this.config.napi.packageJsonPath=(0,r.appendPath)(this.config.root,`package.json`))),this.config.napi.target?.platform===`wasm`&&(this.dependencies[`@napi-rs/wasm-runtime`]=`^1.1.4`);let t={},i={};this.fs.existsSync(this.config.napi.packageJsonPath)&&(t=JSON.parse(await this.fs.read(this.config.napi.packageJsonPath)||`{}`)),i={...t},t.napi={binaryName:this.config.napi.binaryName,packageName:this.config.napi.packageName,targets:this.config.napi.targets?.map(e=>e.triple),npmClient:this.config.napi.npmClient,constEnum:this.config.napi.constEnum,dtsHeader:this.config.napi.dtsHeader,dtsHeaderFile:this.config.napi.dtsHeaderFile,...t.napi,wasm:this.config.napi.target?.platform===`wasm`?(0,s.defu)(t.napi?.wasm??{},this.config.napi.wasm??{},{initialMemory:16384}):void 0},JSON.stringify(t)!==JSON.stringify(i)&&await this.fs.write(this.config.napi.packageJsonPath,JSON.stringify(t,null,2))},async prepare(){this.debug(`Preparing the N-API Rust runtime artifacts for the Powerlines project.`),this.napi=new a.NapiCli,this.config.napi.npmDir&&await this.napi.createNpmDirs({cwd:(0,r.appendPath)(this.config.root,this.config.cwd),npmDir:t.formatPath(this,this.config.napi.npmDir),configPath:t.formatPath(this,this.config.napi.configPath),packageJsonPath:t.formatPath(this,this.config.napi.packageJsonPath)})},async build(){this.debug(`Building the N-API Rust runtime artifacts for the Powerlines project.`);let{task:e}=await this.napi.build({cwd:(0,r.appendPath)(this.config.root,this.config.cwd),package:this.config.napi.packageName,outputDir:t.formatPath(this,this.config.napi.outputDir),configPath:t.formatPath(this,this.config.napi.configPath),manifestPath:t.formatPath(this,this.config.napi.manifestPath),packageJsonPath:t.formatPath(this,this.config.napi.packageJsonPath),target:this.config.napi.target?.triple,profile:this.config.napi.profile,release:this.config.napi.release??this.config.mode===`production`,features:this.config.napi.features,noDefaultFeatures:this.config.napi.noDefaultFeatures,strip:this.config.napi.strip,platform:this.config.napi.platform,noDtsHeader:this.config.napi.noDtsHeader,jsBinding:this.config.napi.jsBinding,dts:this.config.napi.dts,dtsCache:this.config.napi.dtsCache??!this.config.skipCache,verbose:(0,i.isVerbose)(this)}),n=await e;for(let e of n){let t=await this.fs.read(e.path);t&&await this.fs.write(e.path,t)}}}];exports.default=c,exports.plugin=c;
@@ -0,0 +1,20 @@
1
+ import { AVAILABLE_TARGETS, DEFAULT_TARGETS, Platform, Target, TargetTriple } from "./types/targets.cjs";
2
+ import { WasmBrowserOptions, WasmOptions } from "./types/wasm.cjs";
3
+ import { NapiPluginContext, NapiPluginOptions, NapiPluginResolvedConfig, NapiPluginUserConfig, NapiResolvedPluginOptions } from "./types/plugin.cjs";
4
+ import { Plugin } from "powerlines";
5
+
6
+ //#region src/index.d.ts
7
+ declare module "powerlines" {
8
+ interface Config {
9
+ napi?: NapiPluginOptions;
10
+ }
11
+ }
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
+ declare const plugin: <TContext extends NapiPluginContext = NapiPluginContext>(options?: NapiPluginOptions) => Plugin<TContext>[];
18
+ //#endregion
19
+ export { AVAILABLE_TARGETS, DEFAULT_TARGETS, NapiPluginContext, NapiPluginOptions, NapiPluginResolvedConfig, NapiPluginUserConfig, NapiResolvedPluginOptions, Platform, Target, TargetTriple, WasmBrowserOptions, WasmOptions, plugin as default, plugin };
20
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;YAgCY,MAAA;IACR,IAAA,GAAO,iBAAA;EAAA;AAAA;;;;;;cASE,MAAA,oBAA2B,iBAAA,GAAoB,iBAAA,EAC1D,OAAA,GAAS,iBAAA,KA2OJ,MAAA,CAAO,QAAA"}
@@ -0,0 +1,20 @@
1
+ import { AVAILABLE_TARGETS, DEFAULT_TARGETS, Platform, Target, TargetTriple } from "./types/targets.mjs";
2
+ import { WasmBrowserOptions, WasmOptions } from "./types/wasm.mjs";
3
+ import { NapiPluginContext, NapiPluginOptions, NapiPluginResolvedConfig, NapiPluginUserConfig, NapiResolvedPluginOptions } from "./types/plugin.mjs";
4
+ import { Plugin } from "powerlines";
5
+
6
+ //#region src/index.d.ts
7
+ declare module "powerlines" {
8
+ interface Config {
9
+ napi?: NapiPluginOptions;
10
+ }
11
+ }
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
+ declare const plugin: <TContext extends NapiPluginContext = NapiPluginContext>(options?: NapiPluginOptions) => Plugin<TContext>[];
18
+ //#endregion
19
+ export { AVAILABLE_TARGETS, DEFAULT_TARGETS, NapiPluginContext, NapiPluginOptions, NapiPluginResolvedConfig, NapiPluginUserConfig, NapiResolvedPluginOptions, Platform, Target, TargetTriple, WasmBrowserOptions, WasmOptions, plugin as default, plugin };
20
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;YAgCY,MAAA;IACR,IAAA,GAAO,iBAAA;EAAA;AAAA;;;;;;cASE,MAAA,oBAA2B,iBAAA,GAAoB,iBAAA,EAC1D,OAAA,GAAS,iBAAA,KA2OJ,MAAA,CAAO,QAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import{DEFAULT_TARGETS as e}from"./types/targets.mjs";import{formatPath as t}from"./helpers/format-path.mjs";import{toArray as n}from"./node_modules/.pnpm/@stryke_convert@0.7.2/node_modules/@stryke/convert/dist/to-array.mjs";import{appendPath as r}from"@stryke/path/append";import{isVerbose as i}from"powerlines/plugin-utils";import{NapiCli as a,parseTriple as o}from"@napi-rs/cli";import{isString as s}from"@stryke/type-checks/is-string";import{defu as c}from"defu";const l=(l={})=>[{name:`napi-rs`,config(){return{napi:{dts:`binding.d.ts`,jsBinding:`binding.js`,outputDir:this.config.root,platform:!0,strip:!1,...l}}},async configResolved(){!this.config.napi.target&&this.additionalArgs.target&&(s(this.additionalArgs.target)||Array.isArray(this.additionalArgs.target)&&this.additionalArgs.target.length>0)?this.config.napi.target=o(Array.isArray(this.additionalArgs.target)&&this.additionalArgs.target.length>0?this.additionalArgs.target[0]:String(this.additionalArgs.target)):this.config.napi.target=s(this.config.napi.target)?o(this.config.napi.target):this.config.napi.target,this.config.napi.targets||(this.additionalArgs.targets&&(s(this.additionalArgs.targets)||Array.isArray(this.additionalArgs.targets)&&this.additionalArgs.targets.length>0)?this.config.napi.targets=n(this.additionalArgs.targets).map(e=>o(e)):this.config.napi.targets=e.map(e=>o(e))),!this.config.napi.profile&&this.additionalArgs.profile&&(s(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)),!this.config.napi.release&&this.additionalArgs.release&&(this.config.napi.release=!!this.additionalArgs.release),!this.config.napi.configPath&&this.additionalArgs.configPath&&(s(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)),!this.config.napi.manifestPath&&this.additionalArgs.manifestPath&&(s(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)),!this.config.napi.npmDir&&this.additionalArgs.npmDir&&(s(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)),this.config.napi.packageJsonPath||(this.additionalArgs.packageJsonPath&&(s(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)),this.config.napi.packageJsonPath||(this.config.napi.packageJsonPath=r(this.config.root,`package.json`))),this.config.napi.target?.platform===`wasm`&&(this.dependencies[`@napi-rs/wasm-runtime`]=`^1.1.4`);let t={},i={};this.fs.existsSync(this.config.napi.packageJsonPath)&&(t=JSON.parse(await this.fs.read(this.config.napi.packageJsonPath)||`{}`)),i={...t},t.napi={binaryName:this.config.napi.binaryName,packageName:this.config.napi.packageName,targets:this.config.napi.targets?.map(e=>e.triple),npmClient:this.config.napi.npmClient,constEnum:this.config.napi.constEnum,dtsHeader:this.config.napi.dtsHeader,dtsHeaderFile:this.config.napi.dtsHeaderFile,...t.napi,wasm:this.config.napi.target?.platform===`wasm`?c(t.napi?.wasm??{},this.config.napi.wasm??{},{initialMemory:16384}):void 0},JSON.stringify(t)!==JSON.stringify(i)&&await this.fs.write(this.config.napi.packageJsonPath,JSON.stringify(t,null,2))},async prepare(){this.debug(`Preparing the N-API Rust runtime artifacts for the Powerlines project.`),this.napi=new a,this.config.napi.npmDir&&await this.napi.createNpmDirs({cwd:r(this.config.root,this.config.cwd),npmDir:t(this,this.config.napi.npmDir),configPath:t(this,this.config.napi.configPath),packageJsonPath:t(this,this.config.napi.packageJsonPath)})},async build(){this.debug(`Building the N-API Rust runtime artifacts for the Powerlines project.`);let{task:e}=await this.napi.build({cwd:r(this.config.root,this.config.cwd),package:this.config.napi.packageName,outputDir:t(this,this.config.napi.outputDir),configPath:t(this,this.config.napi.configPath),manifestPath:t(this,this.config.napi.manifestPath),packageJsonPath:t(this,this.config.napi.packageJsonPath),target:this.config.napi.target?.triple,profile:this.config.napi.profile,release:this.config.napi.release??this.config.mode===`production`,features:this.config.napi.features,noDefaultFeatures:this.config.napi.noDefaultFeatures,strip:this.config.napi.strip,platform:this.config.napi.platform,noDtsHeader:this.config.napi.noDtsHeader,jsBinding:this.config.napi.jsBinding,dts:this.config.napi.dts,dtsCache:this.config.napi.dtsCache??!this.config.skipCache,verbose:i(this)}),n=await e;for(let e of n){let t=await this.fs.read(e.path);t&&await this.fs.write(e.path,t)}}}];export{l as default,l as plugin};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { NapiCli, parseTriple } from \"@napi-rs/cli\";\nimport { 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":"mdAgCA,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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D,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"}
@@ -0,0 +1 @@
1
+ function e(e){return e??=[],Array.isArray(e)?e:[e]}exports.toArray=e;
@@ -0,0 +1,2 @@
1
+ function e(e){return e??=[],Array.isArray(e)?e:[e]}export{e as toArray};
2
+ //# sourceMappingURL=to-array.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-array.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+convert@0.7.2/node_modules/@stryke/convert/dist/to-array.mjs"],"sourcesContent":["//#region src/to-array.ts\n/**\n* Convert `Arrayable<T>` to `Array<T>`\n*\n* @param array - The `Arrayable<T>` to convert\n* @returns An `Array<T>` containing the elements of the input\n*/\nfunction toArray(array) {\n\tarray = array ?? [];\n\treturn Array.isArray(array) ? array : [array];\n}\n\n//#endregion\nexport { toArray };\n//# sourceMappingURL=to-array.mjs.map"],"x_google_ignoreList":[0],"mappings":"AAOA,SAAS,EAAQ,EAAO,CAEvB,MADA,KAAkB,EAAC,CACZ,MAAM,QAAQ,EAAO,CAAE,EAAS,CAAA,EAAM"}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./targets.cjs`);exports.AVAILABLE_TARGETS=e.AVAILABLE_TARGETS,exports.DEFAULT_TARGETS=e.DEFAULT_TARGETS;
@@ -0,0 +1,4 @@
1
+ import { AVAILABLE_TARGETS, DEFAULT_TARGETS, Platform, Target, TargetTriple } from "./targets.cjs";
2
+ import { WasmBrowserOptions, WasmOptions } from "./wasm.cjs";
3
+ import { NapiPluginContext, NapiPluginOptions, NapiPluginResolvedConfig, NapiPluginUserConfig, NapiResolvedPluginOptions } from "./plugin.cjs";
4
+ export { AVAILABLE_TARGETS, DEFAULT_TARGETS, NapiPluginContext, NapiPluginOptions, NapiPluginResolvedConfig, NapiPluginUserConfig, NapiResolvedPluginOptions, Platform, Target, TargetTriple, WasmBrowserOptions, WasmOptions };
@@ -0,0 +1,4 @@
1
+ import { AVAILABLE_TARGETS, DEFAULT_TARGETS, Platform, Target, TargetTriple } from "./targets.mjs";
2
+ import { WasmBrowserOptions, WasmOptions } from "./wasm.mjs";
3
+ import { NapiPluginContext, NapiPluginOptions, NapiPluginResolvedConfig, NapiPluginUserConfig, NapiResolvedPluginOptions } from "./plugin.mjs";
4
+ export { AVAILABLE_TARGETS, DEFAULT_TARGETS, NapiPluginContext, NapiPluginOptions, NapiPluginResolvedConfig, NapiPluginUserConfig, NapiResolvedPluginOptions, Platform, Target, TargetTriple, WasmBrowserOptions, WasmOptions };
@@ -0,0 +1 @@
1
+ import{AVAILABLE_TARGETS as e,DEFAULT_TARGETS as t}from"./targets.mjs";export{e as AVAILABLE_TARGETS,t as DEFAULT_TARGETS};
File without changes
@@ -0,0 +1,180 @@
1
+ import { Target, TargetTriple } from "./targets.cjs";
2
+ import { WasmOptions } from "./wasm.cjs";
3
+ import { NapiCli } from "@napi-rs/cli";
4
+ import { AlloyPluginContext, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "@powerlines/plugin-alloy/types";
5
+ import { BabelPluginContext, BabelPluginResolvedConfig, BabelPluginUserConfig } from "@powerlines/plugin-babel/types";
6
+ import { RequiredKeys } from "@stryke/types/base";
7
+
8
+ //#region src/types/plugin.d.ts
9
+ /**
10
+ * The options for the N-API Rust plugin.
11
+ *
12
+ * @remarks
13
+ * 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.
14
+ *
15
+ * @see https://napi.rs/docs/cli/build#options
16
+ */
17
+ interface NapiPluginOptions {
18
+ /**
19
+ * Build only the specified binary
20
+ */
21
+ binaryName?: string;
22
+ /**
23
+ * Package name in generated JS binding file. Works only with --platform
24
+ */
25
+ packageName?: string;
26
+ /**
27
+ * Path to the build output dir, only needed when targets contains wasm32-wasi-*
28
+ *
29
+ * @remarks
30
+ * This is used by the [Artifacts command](https://napi.rs/docs/cli/artifacts). This is required because the plugin needs to copy the generated wasm file to the output dir, and the default output dir is the crate folder, which is not suitable for wasm files. Relative to the project root. If not specified, it will default to the crate folder. This is only used for wasm targets, and will be ignored for non-wasm targets.
31
+ */
32
+ buildOutputDir?: string;
33
+ /**
34
+ * Path to the folder where the npm packages are located.
35
+ *
36
+ * @remarks
37
+ * This is used by the [Artifacts command](https://napi.rs/docs/cli/artifacts)
38
+ */
39
+ npmDir?: string;
40
+ /**
41
+ * Build for the target triple, bypassed to `cargo build --target`
42
+ */
43
+ target?: TargetTriple | Target;
44
+ /**
45
+ * Specify multiple targets to build for, bypassed to `cargo build --target` with cargo-multi-target. If specified, the plugin will build for all the specified targets and generate bindings for each target. The generated binding files will have the target triple as a suffix, e.g. [name].linux-x64-gnu.node and [name].wasm32-wasi.node.
46
+ */
47
+ targets?: (TargetTriple | Target)[];
48
+ /**
49
+ * Build artifacts with the specified Cargo profile
50
+ */
51
+ profile?: string;
52
+ /**
53
+ * Wasm compilation options. If specified, the plugin will compile the N-API Rust module to WebAssembly and generate the corresponding bindings.
54
+ */
55
+ wasm?: WasmOptions;
56
+ /**
57
+ * Build in release mode
58
+ */
59
+ release?: boolean;
60
+ /**
61
+ * List of Cargo features to activate
62
+ */
63
+ features?: Array<string>;
64
+ /**
65
+ * Activate all available Cargo features
66
+ */
67
+ allFeatures?: boolean;
68
+ /**
69
+ * Do not activate the default features
70
+ *
71
+ * @defaultValue false
72
+ */
73
+ noDefaultFeatures?: boolean;
74
+ /**
75
+ * Path and filename of generated JS binding file. Only works with {@link platform} flag. Relative to {@link outputPath}.
76
+ *
77
+ * @defaultValue "binding.js"
78
+ */
79
+ jsBinding?: string;
80
+ /**
81
+ * DTS Binding File
82
+ *
83
+ * The path to the output TypeScript declaration file
84
+ *
85
+ * @defaultValue "binding.d.ts"
86
+ */
87
+ dts?: string;
88
+ /**
89
+ * The path to the Cargo.toml manifest file
90
+ */
91
+ manifestPath?: string;
92
+ /**
93
+ * Path to [NAPI-RS config file](https://napi.rs/docs/cli/napi-config)
94
+ */
95
+ configPath?: string;
96
+ /**
97
+ * Path to where all the built files would be put. Default to the crate folder if not specified. Relative to the project root.
98
+ */
99
+ outputDir?: string;
100
+ /**
101
+ * Directory for all crate generated artifacts, see `cargo build --target-dir`
102
+ */
103
+ targetDir?: string;
104
+ /**
105
+ * 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.
106
+ */
107
+ packageJsonPath?: string;
108
+ /**
109
+ * Add platform triple suffix to generated Node.js binding file, e.g. [name].linux-x64-gnu.node
110
+ *
111
+ * @defaultValue true
112
+ */
113
+ platform?: boolean;
114
+ /**
115
+ * Specify a different NPM client for usage when executing NPM actions such as publishing.
116
+ */
117
+ npmClient?: string;
118
+ /**
119
+ * Whether to generate const enum for TypeScript bindings
120
+ */
121
+ constEnum?: boolean;
122
+ /**
123
+ * Disable generation of JS binding file. Works only with --platform
124
+ */
125
+ noJsBinding?: boolean;
126
+ /**
127
+ * Custom file header for generated type def file (requires typedef feature)
128
+ */
129
+ dtsHeader?: string;
130
+ /**
131
+ * Path to the custom file header for generated type def file (requires typedef feature)
132
+ */
133
+ dtsHeaderFile?: string;
134
+ /**
135
+ * Disable default file header for generated type def file (requires typedef feature)
136
+ */
137
+ noDtsHeader?: boolean;
138
+ /**
139
+ * Enable the DTS cache
140
+ */
141
+ dtsCache?: boolean;
142
+ /**
143
+ * Strip the library to minimize file size
144
+ */
145
+ strip?: boolean;
146
+ /**
147
+ * Cross-compile for the specified target with cargo-xwin on Windows and cargo-zigbuild on other platforms
148
+ */
149
+ crossCompile?: boolean;
150
+ /**
151
+ * Use [cross-rs](https://github.com/cross-rs/cross) instead of cargo
152
+ */
153
+ useCross?: boolean;
154
+ /**
155
+ * Use \@napi-rs/cross-toolchain to cross-compile Linux arm/arm64/x64 gnu targets
156
+ */
157
+ useNapiCross?: boolean;
158
+ }
159
+ type NapiPluginUserConfig = BabelPluginUserConfig & AlloyPluginUserConfig & {
160
+ napi: NapiPluginOptions;
161
+ };
162
+ type NapiResolvedPluginOptions = Omit<RequiredKeys<NapiPluginOptions, "dts" | "jsBinding" | "manifestPath" | "outputDir" | "platform" | "packageJsonPath">, "target" | "targets"> & {
163
+ /**
164
+ * 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.
165
+ */
166
+ target: Target;
167
+ /**
168
+ * The resolved list of target triples to build for, with additional metadata such as platform, architecture, and ABI information. These are derived from the `targets` option, and are used internally by the plugin to determine how to build the N-API Rust module for each target.
169
+ */
170
+ targets: Target[];
171
+ };
172
+ type NapiPluginResolvedConfig = BabelPluginResolvedConfig & AlloyPluginResolvedConfig & {
173
+ napi: NapiResolvedPluginOptions;
174
+ };
175
+ interface NapiPluginContext<TResolvedConfig extends NapiPluginResolvedConfig = NapiPluginResolvedConfig> extends BabelPluginContext<TResolvedConfig>, AlloyPluginContext<TResolvedConfig> {
176
+ napi: NapiCli;
177
+ }
178
+ //#endregion
179
+ export { NapiPluginContext, NapiPluginOptions, NapiPluginResolvedConfig, NapiPluginUserConfig, NapiResolvedPluginOptions };
180
+ //# sourceMappingURL=plugin.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;;AAyCA;;;;;;UAAi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 import { Target, TargetTriple } from "./targets.mjs";
2
+ import { WasmOptions } from "./wasm.mjs";
3
+ import { NapiCli } from "@napi-rs/cli";
4
+ import { AlloyPluginContext, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "@powerlines/plugin-alloy/types";
5
+ import { BabelPluginContext, BabelPluginResolvedConfig, BabelPluginUserConfig } from "@powerlines/plugin-babel/types";
6
+ import { RequiredKeys } from "@stryke/types/base";
7
+
8
+ //#region src/types/plugin.d.ts
9
+ /**
10
+ * The options for the N-API Rust plugin.
11
+ *
12
+ * @remarks
13
+ * 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.
14
+ *
15
+ * @see https://napi.rs/docs/cli/build#options
16
+ */
17
+ interface NapiPluginOptions {
18
+ /**
19
+ * Build only the specified binary
20
+ */
21
+ binaryName?: string;
22
+ /**
23
+ * Package name in generated JS binding file. Works only with --platform
24
+ */
25
+ packageName?: string;
26
+ /**
27
+ * Path to the build output dir, only needed when targets contains wasm32-wasi-*
28
+ *
29
+ * @remarks
30
+ * This is used by the [Artifacts command](https://napi.rs/docs/cli/artifacts). This is required because the plugin needs to copy the generated wasm file to the output dir, and the default output dir is the crate folder, which is not suitable for wasm files. Relative to the project root. If not specified, it will default to the crate folder. This is only used for wasm targets, and will be ignored for non-wasm targets.
31
+ */
32
+ buildOutputDir?: string;
33
+ /**
34
+ * Path to the folder where the npm packages are located.
35
+ *
36
+ * @remarks
37
+ * This is used by the [Artifacts command](https://napi.rs/docs/cli/artifacts)
38
+ */
39
+ npmDir?: string;
40
+ /**
41
+ * Build for the target triple, bypassed to `cargo build --target`
42
+ */
43
+ target?: TargetTriple | Target;
44
+ /**
45
+ * Specify multiple targets to build for, bypassed to `cargo build --target` with cargo-multi-target. If specified, the plugin will build for all the specified targets and generate bindings for each target. The generated binding files will have the target triple as a suffix, e.g. [name].linux-x64-gnu.node and [name].wasm32-wasi.node.
46
+ */
47
+ targets?: (TargetTriple | Target)[];
48
+ /**
49
+ * Build artifacts with the specified Cargo profile
50
+ */
51
+ profile?: string;
52
+ /**
53
+ * Wasm compilation options. If specified, the plugin will compile the N-API Rust module to WebAssembly and generate the corresponding bindings.
54
+ */
55
+ wasm?: WasmOptions;
56
+ /**
57
+ * Build in release mode
58
+ */
59
+ release?: boolean;
60
+ /**
61
+ * List of Cargo features to activate
62
+ */
63
+ features?: Array<string>;
64
+ /**
65
+ * Activate all available Cargo features
66
+ */
67
+ allFeatures?: boolean;
68
+ /**
69
+ * Do not activate the default features
70
+ *
71
+ * @defaultValue false
72
+ */
73
+ noDefaultFeatures?: boolean;
74
+ /**
75
+ * Path and filename of generated JS binding file. Only works with {@link platform} flag. Relative to {@link outputPath}.
76
+ *
77
+ * @defaultValue "binding.js"
78
+ */
79
+ jsBinding?: string;
80
+ /**
81
+ * DTS Binding File
82
+ *
83
+ * The path to the output TypeScript declaration file
84
+ *
85
+ * @defaultValue "binding.d.ts"
86
+ */
87
+ dts?: string;
88
+ /**
89
+ * The path to the Cargo.toml manifest file
90
+ */
91
+ manifestPath?: string;
92
+ /**
93
+ * Path to [NAPI-RS config file](https://napi.rs/docs/cli/napi-config)
94
+ */
95
+ configPath?: string;
96
+ /**
97
+ * Path to where all the built files would be put. Default to the crate folder if not specified. Relative to the project root.
98
+ */
99
+ outputDir?: string;
100
+ /**
101
+ * Directory for all crate generated artifacts, see `cargo build --target-dir`
102
+ */
103
+ targetDir?: string;
104
+ /**
105
+ * 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.
106
+ */
107
+ packageJsonPath?: string;
108
+ /**
109
+ * Add platform triple suffix to generated Node.js binding file, e.g. [name].linux-x64-gnu.node
110
+ *
111
+ * @defaultValue true
112
+ */
113
+ platform?: boolean;
114
+ /**
115
+ * Specify a different NPM client for usage when executing NPM actions such as publishing.
116
+ */
117
+ npmClient?: string;
118
+ /**
119
+ * Whether to generate const enum for TypeScript bindings
120
+ */
121
+ constEnum?: boolean;
122
+ /**
123
+ * Disable generation of JS binding file. Works only with --platform
124
+ */
125
+ noJsBinding?: boolean;
126
+ /**
127
+ * Custom file header for generated type def file (requires typedef feature)
128
+ */
129
+ dtsHeader?: string;
130
+ /**
131
+ * Path to the custom file header for generated type def file (requires typedef feature)
132
+ */
133
+ dtsHeaderFile?: string;
134
+ /**
135
+ * Disable default file header for generated type def file (requires typedef feature)
136
+ */
137
+ noDtsHeader?: boolean;
138
+ /**
139
+ * Enable the DTS cache
140
+ */
141
+ dtsCache?: boolean;
142
+ /**
143
+ * Strip the library to minimize file size
144
+ */
145
+ strip?: boolean;
146
+ /**
147
+ * Cross-compile for the specified target with cargo-xwin on Windows and cargo-zigbuild on other platforms
148
+ */
149
+ crossCompile?: boolean;
150
+ /**
151
+ * Use [cross-rs](https://github.com/cross-rs/cross) instead of cargo
152
+ */
153
+ useCross?: boolean;
154
+ /**
155
+ * Use \@napi-rs/cross-toolchain to cross-compile Linux arm/arm64/x64 gnu targets
156
+ */
157
+ useNapiCross?: boolean;
158
+ }
159
+ type NapiPluginUserConfig = BabelPluginUserConfig & AlloyPluginUserConfig & {
160
+ napi: NapiPluginOptions;
161
+ };
162
+ type NapiResolvedPluginOptions = Omit<RequiredKeys<NapiPluginOptions, "dts" | "jsBinding" | "manifestPath" | "outputDir" | "platform" | "packageJsonPath">, "target" | "targets"> & {
163
+ /**
164
+ * 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.
165
+ */
166
+ target: Target;
167
+ /**
168
+ * The resolved list of target triples to build for, with additional metadata such as platform, architecture, and ABI information. These are derived from the `targets` option, and are used internally by the plugin to determine how to build the N-API Rust module for each target.
169
+ */
170
+ targets: Target[];
171
+ };
172
+ type NapiPluginResolvedConfig = BabelPluginResolvedConfig & AlloyPluginResolvedConfig & {
173
+ napi: NapiResolvedPluginOptions;
174
+ };
175
+ interface NapiPluginContext<TResolvedConfig extends NapiPluginResolvedConfig = NapiPluginResolvedConfig> extends BabelPluginContext<TResolvedConfig>, AlloyPluginContext<TResolvedConfig> {
176
+ napi: NapiCli;
177
+ }
178
+ //#endregion
179
+ export { NapiPluginContext, NapiPluginOptions, NapiPluginResolvedConfig, NapiPluginUserConfig, NapiResolvedPluginOptions };
180
+ //# sourceMappingURL=plugin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;;AAyCA;;;;;;UAAiB,iBAAA;EA6CR;;;EAzCP,UAAA;EAAA;;;EAKA,WAAA;EAqBA;;;;;;EAbA,cAAA;EA4BA;;;;;;EApBA,MAAA;EAiDA;;;EA5CA,MAAA,GAAS,YAAA,GAAe,MAAA;EAoExB;;;EA/DA,OAAA,IAAW,YAAA,GAAe,MAAA;EAqF1B;;;EAhFA,OAAA;EAoGA;;;EA/FA,IAAA,GAAO,WAAA;EAmHP;;;EA9GA,OAAA;EAwHY;AAGd;;EAtHE,QAAA,GAAW,KAAA;EAsHsB;;;EAjHjC,WAAA;EAmHyB;;;;;EA5GzB,iBAAA;EA4GyB;AAG3B;;;;EAxGE,SAAA;EAwGsC;;;;;;;EA/FtC,GAAA;EA8GA;;;EAzGA,YAAA;EA8Ge;;AAGjB;EA5GE,UAAA;;;;EAKA,SAAA;EAyGiC;;;EApGjC,SAAA;EAoGE;;;EA/FF,eAAA;EAkGe;;;;;EA3Ff,QAAA;EAgGqB;;;EA3FrB,SAAA;EA2FoB;;;EAtFpB,SAAA;EAkFmD;;;EA7EnD,WAAA;EAiFqB;;;EA5ErB,SAAA;EA6Ea;;;EAxEb,aAAA;;;;EAKA,WAAA;;;;EAKA,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,IAAA,CACtC,YAAA,CACE,iBAAA;;;;EAaF,MAAA,EAAQ,MAAA;;;;EAKR,OAAA,EAAS,MAAA;AAAA;AAAA,KAGC,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;EACrB,IAAA,EAAM,OAAA;AAAA"}
@@ -0,0 +1,2 @@
1
+ export{};
2
+ //# sourceMappingURL=plugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { NapiCli } from \"@napi-rs/cli\";\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 * Path to the build output dir, only needed when targets contains wasm32-wasi-*\n *\n * @remarks\n * This is used by the [Artifacts command](https://napi.rs/docs/cli/artifacts). This is required because the plugin needs to copy the generated wasm file to the output dir, and the default output dir is the crate folder, which is not suitable for wasm files. Relative to the project root. If not specified, it will default to the crate folder. This is only used for wasm targets, and will be ignored for non-wasm targets.\n */\n buildOutputDir?: string;\n\n /**\n * Path to the folder where the npm packages are located.\n *\n * @remarks\n * This is used by the [Artifacts command](https://napi.rs/docs/cli/artifacts)\n */\n npmDir?: string;\n\n /**\n * Build for the target triple, bypassed to `cargo build --target`\n */\n target?: TargetTriple | Target;\n\n /**\n * Specify multiple targets to build for, bypassed to `cargo build --target` with cargo-multi-target. If specified, the plugin will build for all the specified targets and generate bindings for each target. The generated binding files will have the target triple as a suffix, e.g. [name].linux-x64-gnu.node and [name].wasm32-wasi.node.\n */\n targets?: (TargetTriple | Target)[];\n\n /**\n * Build artifacts with the specified Cargo profile\n */\n profile?: string;\n\n /**\n * Wasm compilation options. If specified, the plugin will compile the N-API Rust module to WebAssembly and generate the corresponding bindings.\n */\n wasm?: WasmOptions;\n\n /**\n * Build in release mode\n */\n release?: boolean;\n\n /**\n * List of Cargo features to activate\n */\n features?: Array<string>;\n\n /**\n * Activate all available Cargo features\n */\n allFeatures?: boolean;\n\n /**\n * Do not activate the default features\n *\n * @defaultValue false\n */\n noDefaultFeatures?: boolean;\n\n /**\n * Path and filename of generated JS binding file. Only works with {@link platform} flag. Relative to {@link outputPath}.\n *\n * @defaultValue \"binding.js\"\n */\n jsBinding?: string;\n\n /**\n * DTS Binding File\n *\n * The path to the output TypeScript declaration file\n *\n * @defaultValue \"binding.d.ts\"\n */\n dts?: string;\n\n /**\n * The path to the Cargo.toml manifest file\n */\n manifestPath?: string;\n\n /**\n * Path to [NAPI-RS config file](https://napi.rs/docs/cli/napi-config)\n */\n configPath?: string;\n\n /**\n * Path to where all the built files would be put. Default to the crate folder if not specified. Relative to the project root.\n */\n outputDir?: string;\n\n /**\n * \tDirectory for all crate generated artifacts, see `cargo build --target-dir`\n */\n targetDir?: string;\n\n /**\n * 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 * Specify a different NPM client for usage when executing NPM actions such as publishing.\n */\n npmClient?: string;\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 * Path to the custom file header for generated type def file (requires typedef feature)\n */\n dtsHeaderFile?: 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 = Omit<\n RequiredKeys<\n NapiPluginOptions,\n | \"dts\"\n | \"jsBinding\"\n | \"manifestPath\"\n | \"outputDir\"\n | \"platform\"\n | \"packageJsonPath\"\n >,\n \"target\" | \"targets\"\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 /**\n * The resolved list of target triples to build for, with additional metadata such as platform, architecture, and ABI information. These are derived from the `targets` option, and are used internally by the plugin to determine how to build the N-API Rust module for each target.\n */\n targets: Target[];\n};\n\nexport type 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 napi: NapiCli;\n}\n"],"mappings":""}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=[`aarch64-apple-darwin`,`aarch64-linux-android`,`aarch64-unknown-linux-gnu`,`aarch64-unknown-linux-musl`,`aarch64-unknown-linux-ohos`,`aarch64-pc-windows-msvc`,`x86_64-apple-darwin`,`x86_64-pc-windows-msvc`,`x86_64-pc-windows-gnu`,`x86_64-unknown-linux-gnu`,`x86_64-unknown-linux-musl`,`x86_64-unknown-linux-ohos`,`x86_64-unknown-freebsd`,`i686-pc-windows-msvc`,`armv7-unknown-linux-gnueabihf`,`armv7-unknown-linux-musleabihf`,`armv7-linux-androideabi`,`universal-apple-darwin`,`loongarch64-unknown-linux-gnu`,`riscv64gc-unknown-linux-gnu`,`powerpc64le-unknown-linux-gnu`,`s390x-unknown-linux-gnu`,`wasm32-wasi-preview1-threads`,`wasm32-wasip1-threads`],t=[`x86_64-apple-darwin`,`aarch64-apple-darwin`,`x86_64-pc-windows-msvc`,`x86_64-unknown-linux-gnu`];exports.AVAILABLE_TARGETS=e,exports.DEFAULT_TARGETS=t;
@@ -0,0 +1,16 @@
1
+ //#region src/types/targets.d.ts
2
+ declare const AVAILABLE_TARGETS: readonly ["aarch64-apple-darwin", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "aarch64-unknown-linux-ohos", "aarch64-pc-windows-msvc", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-pc-windows-gnu", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-unknown-linux-ohos", "x86_64-unknown-freebsd", "i686-pc-windows-msvc", "armv7-unknown-linux-gnueabihf", "armv7-unknown-linux-musleabihf", "armv7-linux-androideabi", "universal-apple-darwin", "loongarch64-unknown-linux-gnu", "riscv64gc-unknown-linux-gnu", "powerpc64le-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-wasi-preview1-threads", "wasm32-wasip1-threads"];
3
+ type TargetTriple = (typeof AVAILABLE_TARGETS)[number];
4
+ declare const DEFAULT_TARGETS: readonly ["x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"];
5
+ type Platform = NodeJS.Platform | "wasm" | "wasi" | "openharmony";
6
+ type NodeJSArch = "arm" | "arm64" | "ia32" | "loong64" | "mips" | "mipsel" | "ppc" | "ppc64" | "riscv64" | "s390" | "s390x" | "x32" | "x64" | "universal" | "wasm32";
7
+ interface Target {
8
+ triple: string;
9
+ platformArchABI: string;
10
+ platform: Platform;
11
+ arch: NodeJSArch;
12
+ abi: string | null;
13
+ }
14
+ //#endregion
15
+ export { AVAILABLE_TARGETS, DEFAULT_TARGETS, Platform, Target, TargetTriple };
16
+ //# sourceMappingURL=targets.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"targets.d.cts","names":[],"sources":["../../src/types/targets.ts"],"mappings":";cAkBa,iBAAA;AAAA,KA2BD,YAAA,WAAuB,iBAAA;AAAA,cAEtB,eAAA;AAAA,KAOD,QAAA,GAAW,MAAA,CAAO,QAAA;AAAA,KAGzB,UAAA;AAAA,UAiBY,MAAA;EACf,MAAA;EACA,eAAA;EACA,QAAA,EAAU,QAAA;EACV,IAAA,EAAM,UAAA;EACN,GAAA;AAAA"}
@@ -0,0 +1,16 @@
1
+ //#region src/types/targets.d.ts
2
+ declare const AVAILABLE_TARGETS: readonly ["aarch64-apple-darwin", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "aarch64-unknown-linux-ohos", "aarch64-pc-windows-msvc", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-pc-windows-gnu", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-unknown-linux-ohos", "x86_64-unknown-freebsd", "i686-pc-windows-msvc", "armv7-unknown-linux-gnueabihf", "armv7-unknown-linux-musleabihf", "armv7-linux-androideabi", "universal-apple-darwin", "loongarch64-unknown-linux-gnu", "riscv64gc-unknown-linux-gnu", "powerpc64le-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-wasi-preview1-threads", "wasm32-wasip1-threads"];
3
+ type TargetTriple = (typeof AVAILABLE_TARGETS)[number];
4
+ declare const DEFAULT_TARGETS: readonly ["x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"];
5
+ type Platform = NodeJS.Platform | "wasm" | "wasi" | "openharmony";
6
+ type NodeJSArch = "arm" | "arm64" | "ia32" | "loong64" | "mips" | "mipsel" | "ppc" | "ppc64" | "riscv64" | "s390" | "s390x" | "x32" | "x64" | "universal" | "wasm32";
7
+ interface Target {
8
+ triple: string;
9
+ platformArchABI: string;
10
+ platform: Platform;
11
+ arch: NodeJSArch;
12
+ abi: string | null;
13
+ }
14
+ //#endregion
15
+ export { AVAILABLE_TARGETS, DEFAULT_TARGETS, Platform, Target, TargetTriple };
16
+ //# sourceMappingURL=targets.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"targets.d.mts","names":[],"sources":["../../src/types/targets.ts"],"mappings":";cAkBa,iBAAA;AAAA,KA2BD,YAAA,WAAuB,iBAAA;AAAA,cAEtB,eAAA;AAAA,KAOD,QAAA,GAAW,MAAA,CAAO,QAAA;AAAA,KAGzB,UAAA;AAAA,UAiBY,MAAA;EACf,MAAA;EACA,eAAA;EACA,QAAA,EAAU,QAAA;EACV,IAAA,EAAM,UAAA;EACN,GAAA;AAAA"}
@@ -0,0 +1,2 @@
1
+ const e=[`aarch64-apple-darwin`,`aarch64-linux-android`,`aarch64-unknown-linux-gnu`,`aarch64-unknown-linux-musl`,`aarch64-unknown-linux-ohos`,`aarch64-pc-windows-msvc`,`x86_64-apple-darwin`,`x86_64-pc-windows-msvc`,`x86_64-pc-windows-gnu`,`x86_64-unknown-linux-gnu`,`x86_64-unknown-linux-musl`,`x86_64-unknown-linux-ohos`,`x86_64-unknown-freebsd`,`i686-pc-windows-msvc`,`armv7-unknown-linux-gnueabihf`,`armv7-unknown-linux-musleabihf`,`armv7-linux-androideabi`,`universal-apple-darwin`,`loongarch64-unknown-linux-gnu`,`riscv64gc-unknown-linux-gnu`,`powerpc64le-unknown-linux-gnu`,`s390x-unknown-linux-gnu`,`wasm32-wasi-preview1-threads`,`wasm32-wasip1-threads`],t=[`x86_64-apple-darwin`,`aarch64-apple-darwin`,`x86_64-pc-windows-msvc`,`x86_64-unknown-linux-gnu`];export{e as AVAILABLE_TARGETS,t as DEFAULT_TARGETS};
2
+ //# sourceMappingURL=targets.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"targets.mjs","names":[],"sources":["../../src/types/targets.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const AVAILABLE_TARGETS = [\n \"aarch64-apple-darwin\",\n \"aarch64-linux-android\",\n \"aarch64-unknown-linux-gnu\",\n \"aarch64-unknown-linux-musl\",\n \"aarch64-unknown-linux-ohos\",\n \"aarch64-pc-windows-msvc\",\n \"x86_64-apple-darwin\",\n \"x86_64-pc-windows-msvc\",\n \"x86_64-pc-windows-gnu\",\n \"x86_64-unknown-linux-gnu\",\n \"x86_64-unknown-linux-musl\",\n \"x86_64-unknown-linux-ohos\",\n \"x86_64-unknown-freebsd\",\n \"i686-pc-windows-msvc\",\n \"armv7-unknown-linux-gnueabihf\",\n \"armv7-unknown-linux-musleabihf\",\n \"armv7-linux-androideabi\",\n \"universal-apple-darwin\",\n \"loongarch64-unknown-linux-gnu\",\n \"riscv64gc-unknown-linux-gnu\",\n \"powerpc64le-unknown-linux-gnu\",\n \"s390x-unknown-linux-gnu\",\n \"wasm32-wasi-preview1-threads\",\n \"wasm32-wasip1-threads\"\n] as const;\n\nexport type TargetTriple = (typeof AVAILABLE_TARGETS)[number];\n\nexport const DEFAULT_TARGETS = [\n \"x86_64-apple-darwin\",\n \"aarch64-apple-darwin\",\n \"x86_64-pc-windows-msvc\",\n \"x86_64-unknown-linux-gnu\"\n] as const;\n\nexport type Platform = NodeJS.Platform | \"wasm\" | \"wasi\" | \"openharmony\";\n\n// https://nodejs.org/api/process.html#process_process_arch\ntype NodeJSArch =\n | \"arm\"\n | \"arm64\"\n | \"ia32\"\n | \"loong64\"\n | \"mips\"\n | \"mipsel\"\n | \"ppc\"\n | \"ppc64\"\n | \"riscv64\"\n | \"s390\"\n | \"s390x\"\n | \"x32\"\n | \"x64\"\n | \"universal\"\n | \"wasm32\";\n\nexport interface Target {\n triple: string;\n platformArchABI: string;\n platform: Platform;\n arch: NodeJSArch;\n abi: string | null;\n}\n"],"mappings":"AAkBA,MAAa,EAAoB,CAAA,uBAAA,wBAAA,4BAAA,6BAAA,6BAAA,0BAAA,sBAAA,yBAAA,wBAAA,2BAAA,4BAAA,4BAAA,yBAAA,uBAAA,gCAAA,iCAAA,0BAAA,yBAAA,gCAAA,8BAAA,gCAAA,0BAAA,+BAAA,wBAAA,CACtB,EAAa,CAAA,sBAAA,uBAAA,yBAAA,2BAAA"}
File without changes
@@ -0,0 +1,44 @@
1
+ //#region src/types/wasm.d.ts
2
+ /**
3
+ * Wasm Browser compilation options
4
+ */
5
+ interface WasmBrowserOptions {
6
+ /**
7
+ * Whether to use fs module in browser
8
+ */
9
+ fs?: boolean;
10
+ /**
11
+ * Whether to initialize wasm asynchronously
12
+ */
13
+ asyncInit?: boolean;
14
+ /**
15
+ * Whether to inject `buffer` to emnapi context
16
+ */
17
+ buffer?: boolean;
18
+ /**
19
+ * Whether to emit custom events for errors in worker
20
+ */
21
+ errorEvent?: boolean;
22
+ }
23
+ /**
24
+ * Wasm compilation options
25
+ */
26
+ interface WasmOptions {
27
+ /**
28
+ * https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Memory
29
+ *
30
+ * @defaultValue 4000 pages (256MiB)
31
+ */
32
+ initialMemory?: number;
33
+ /**
34
+ * @defaultValue 65536 pages (4GiB)
35
+ */
36
+ maximumMemory?: number;
37
+ /**
38
+ * Browser wasm binding configuration
39
+ */
40
+ browser: WasmBrowserOptions;
41
+ }
42
+ //#endregion
43
+ export { WasmBrowserOptions, WasmOptions };
44
+ //# sourceMappingURL=wasm.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm.d.cts","names":[],"sources":["../../src/types/wasm.ts"],"mappings":";;AAqBA;;UAAiB,kBAAA;EAAkB;;;EAIjC,EAAA;EAeA;;;EAVA,SAAA;EAgB0B;;;EAX1B,MAAA;EAsBA;;;EAjBA,UAAA;AAAA;;;;UAMe,WAAA;;;;;;EAMf,aAAA;;;;EAKA,aAAA;;;;EAKA,OAAA,EAAS,kBAAA;AAAA"}
@@ -0,0 +1,44 @@
1
+ //#region src/types/wasm.d.ts
2
+ /**
3
+ * Wasm Browser compilation options
4
+ */
5
+ interface WasmBrowserOptions {
6
+ /**
7
+ * Whether to use fs module in browser
8
+ */
9
+ fs?: boolean;
10
+ /**
11
+ * Whether to initialize wasm asynchronously
12
+ */
13
+ asyncInit?: boolean;
14
+ /**
15
+ * Whether to inject `buffer` to emnapi context
16
+ */
17
+ buffer?: boolean;
18
+ /**
19
+ * Whether to emit custom events for errors in worker
20
+ */
21
+ errorEvent?: boolean;
22
+ }
23
+ /**
24
+ * Wasm compilation options
25
+ */
26
+ interface WasmOptions {
27
+ /**
28
+ * https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Memory
29
+ *
30
+ * @defaultValue 4000 pages (256MiB)
31
+ */
32
+ initialMemory?: number;
33
+ /**
34
+ * @defaultValue 65536 pages (4GiB)
35
+ */
36
+ maximumMemory?: number;
37
+ /**
38
+ * Browser wasm binding configuration
39
+ */
40
+ browser: WasmBrowserOptions;
41
+ }
42
+ //#endregion
43
+ export { WasmBrowserOptions, WasmOptions };
44
+ //# sourceMappingURL=wasm.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm.d.mts","names":[],"sources":["../../src/types/wasm.ts"],"mappings":";;AAqBA;;UAAiB,kBAAA;EAAkB;;;EAIjC,EAAA;EAeA;;;EAVA,SAAA;EAgB0B;;;EAX1B,MAAA;EAsBA;;;EAjBA,UAAA;AAAA;;;;UAMe,WAAA;;;;;;EAMf,aAAA;;;;EAKA,aAAA;;;;EAKA,OAAA,EAAS,kBAAA;AAAA"}
@@ -0,0 +1 @@
1
+ export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-napi-rs",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
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,22 +137,22 @@
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.51",
141
- "@powerlines/plugin-automd": "^0.1.432",
142
- "@powerlines/plugin-plugin": "^0.12.383",
143
- "@stryke/fs": "^0.33.67",
144
- "@stryke/path": "^0.27.5",
145
- "@stryke/string-format": "^0.17.10",
146
- "@stryke/type-checks": "^0.6.2",
147
- "@stryke/types": "^0.11.4",
140
+ "@powerlines/plugin-alloy": "^0.26.53",
141
+ "@powerlines/plugin-automd": "^0.1.435",
142
+ "@powerlines/plugin-plugin": "^0.12.386",
143
+ "@stryke/fs": "^0.33.69",
144
+ "@stryke/path": "^0.28.1",
145
+ "@stryke/string-format": "^0.17.12",
146
+ "@stryke/type-checks": "^0.6.4",
147
+ "@stryke/types": "^0.11.6",
148
148
  "automd": "^0.4.3",
149
149
  "defu": "^6.1.7",
150
- "powerlines": "^0.43.28"
150
+ "powerlines": "^0.43.31"
151
151
  },
152
152
  "devDependencies": { "@types/node": "^25.6.0" },
153
153
  "peerDependencies": { "@napi-rs/wasm-runtime": ">=1.1.4" },
154
154
  "peerDependenciesMeta": { "@napi-rs/wasm-runtime": { "optional": true } },
155
155
  "publishConfig": { "access": "public" },
156
- "inlinedDependencies": { "@stryke/convert": "0.7.0" },
157
- "gitHead": "efeaec793549f37c700f2e876bf6097c37375c46"
156
+ "inlinedDependencies": { "@stryke/convert": "0.7.2" },
157
+ "gitHead": "abf752430f7af954a70fd6c9805e50eba2fa666b"
158
158
  }