@powerlines/unplugin 0.0.11 → 0.0.13

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 (49) hide show
  1. package/dist/astro.mjs.map +1 -1
  2. package/dist/esbuild.d.cts +3 -3
  3. package/dist/esbuild.d.cts.map +1 -1
  4. package/dist/esbuild.d.mts +3 -3
  5. package/dist/esbuild.d.mts.map +1 -1
  6. package/dist/esbuild.mjs.map +1 -1
  7. package/dist/farm.mjs.map +1 -1
  8. package/dist/next.mjs.map +1 -1
  9. package/dist/nuxt.mjs.map +1 -1
  10. package/dist/package.cjs +1 -1
  11. package/dist/package.mjs +1 -1
  12. package/dist/rolldown.cjs +1 -1
  13. package/dist/rolldown.d.cts +2 -2
  14. package/dist/rolldown.d.cts.map +1 -1
  15. package/dist/rolldown.d.mts +2 -2
  16. package/dist/rolldown.d.mts.map +1 -1
  17. package/dist/rolldown.mjs +1 -1
  18. package/dist/rolldown.mjs.map +1 -1
  19. package/dist/rollup.d.cts +2 -2
  20. package/dist/rollup.d.cts.map +1 -1
  21. package/dist/rollup.d.mts +2 -2
  22. package/dist/rollup.d.mts.map +1 -1
  23. package/dist/rollup.mjs.map +1 -1
  24. package/dist/rspack.d.cts +2 -2
  25. package/dist/rspack.d.cts.map +1 -1
  26. package/dist/rspack.d.mts +2 -2
  27. package/dist/rspack.d.mts.map +1 -1
  28. package/dist/rspack.mjs.map +1 -1
  29. package/dist/tsdown.d.cts +3 -3
  30. package/dist/tsdown.d.cts.map +1 -1
  31. package/dist/tsdown.d.mts +3 -3
  32. package/dist/tsdown.d.mts.map +1 -1
  33. package/dist/tsdown.mjs.map +1 -1
  34. package/dist/tsup.d.cts +3 -3
  35. package/dist/tsup.d.cts.map +1 -1
  36. package/dist/tsup.d.mts +3 -3
  37. package/dist/tsup.d.mts.map +1 -1
  38. package/dist/tsup.mjs.map +1 -1
  39. package/dist/types.d.cts +1 -1
  40. package/dist/types.d.mts +1 -1
  41. package/dist/unloader.mjs.map +1 -1
  42. package/dist/unplugin.mjs.map +1 -1
  43. package/dist/vite.d.cts +2 -2
  44. package/dist/vite.d.cts.map +1 -1
  45. package/dist/vite.d.mts +2 -2
  46. package/dist/vite.d.mts.map +1 -1
  47. package/dist/vite.mjs.map +1 -1
  48. package/dist/webpack.mjs.map +1 -1
  49. package/package.json +21 -14
@@ -1 +1 @@
1
- {"version":3,"file":"astro.mjs","names":["vite"],"sources":["../src/astro.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { AstroUserConfig } from \"astro\";\nimport vite from \"./vite\";\n\n/**\n * An Astro plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://docs.astro.build/en/guides/integrations-guide/#creating-an-integration\n *\n * @example\n * ```js\n * // astro.config.mjs\n * import { defineConfig } from \"astro/config\";\n * import powerlines from \"@powerlines/unplugin/astro\";\n *\n * export default defineConfig({\n * integrations: [powerlines({ name: \"example-app\", ... })]\n * });\n *\n * ```\n *\n * @param options - The Astro options to merge with the Powerlines configuration.\n * @returns The merged Astro configuration options.\n */\nexport function withPlugin(options: AstroUserConfig): AstroUserConfig {\n return {\n ...options,\n vite: {\n ...options.vite,\n plugins: [...(options.vite?.plugins ?? []), vite()] as NonNullable<\n AstroUserConfig[\"vite\"]\n >[\"plugins\"]\n }\n };\n}\n\nexport default withPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,WAAW,SAA2C;CACpE,OAAO;EACL,GAAG;EACH,MAAM;GACJ,GAAG,QAAQ;GACX,SAAS,CAAC,GAAI,QAAQ,MAAM,WAAW,EAAE,EAAGA,QAAM,CAAC;GAGpD;EACF"}
1
+ {"version":3,"file":"astro.mjs","names":["vite"],"sources":["../src/astro.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { AstroUserConfig } from \"astro\";\nimport vite from \"./vite\";\n\n/**\n * An Astro plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://docs.astro.build/en/guides/integrations-guide/#creating-an-integration\n *\n * @example\n * ```js\n * // astro.config.mjs\n * import { defineConfig } from \"astro/config\";\n * import powerlines from \"@powerlines/unplugin/astro\";\n *\n * export default defineConfig({\n * integrations: [powerlines({ name: \"example-app\", ... })]\n * });\n *\n * ```\n *\n * @param options - The Astro options to merge with the Powerlines configuration.\n * @returns The merged Astro configuration options.\n */\nexport function withPlugin(options: AstroUserConfig): AstroUserConfig {\n return {\n ...options,\n vite: {\n ...options.vite,\n plugins: [...(options.vite?.plugins ?? []), vite()] as NonNullable<\n AstroUserConfig[\"vite\"]\n >[\"plugins\"]\n }\n };\n}\n\nexport default withPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,WAAW,SAA2C;AACpE,QAAO;EACL,GAAG;EACH,MAAM;GACJ,GAAG,QAAQ;GACX,SAAS,CAAC,GAAI,QAAQ,MAAM,WAAW,EAAE,EAAGA,QAAM,CAAC;GAGpD;EACF"}
@@ -1,7 +1,7 @@
1
1
  import { UnpluginExecutionOptions, UnpluginFactory } from "./types.cjs";
2
2
  import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
3
3
  import * as _$_powerlines_core0 from "@powerlines/core";
4
- import { Context, ExecutionContext, ResolvedEntryTypeDefinition } from "@powerlines/core";
4
+ import { ExecutionContext, ResolvedEntryTypeDefinition, UnresolvedContext } from "@powerlines/core";
5
5
  import { DeepPartial } from "@stryke/types/base";
6
6
  import * as _$esbuild from "esbuild";
7
7
  import { BuildOptions } from "esbuild";
@@ -15,7 +15,7 @@ declare const DEFAULT_OPTIONS: Partial<BuildOptions>;
15
15
  * @param entryPoints - The entry points to resolve.
16
16
  * @returns The resolved entry options.
17
17
  */
18
- declare function resolveEntry(context: Context, entryPoints?: ResolvedEntryTypeDefinition[] | string[]): BuildOptions["entryPoints"];
18
+ declare function resolveEntry<TContext extends UnresolvedContext>(context: TContext, entryPoints?: ResolvedEntryTypeDefinition[] | string[]): BuildOptions["entryPoints"];
19
19
  /**
20
20
  * Resolves the esbuild options.
21
21
  *
@@ -23,7 +23,7 @@ declare function resolveEntry(context: Context, entryPoints?: ResolvedEntryTypeD
23
23
  * @param override - Optional esbuild options to override the resolved options.
24
24
  * @returns The resolved esbuild options.
25
25
  */
26
- declare function resolveOptions(context: Context, override?: DeepPartial<BuildOptions>): BuildOptions;
26
+ declare function resolveOptions<TContext extends UnresolvedContext>(context: TContext, override?: DeepPartial<BuildOptions>): BuildOptions;
27
27
  /**
28
28
  * Creates an ESBuild plugin factory that generates a plugin instance.
29
29
  *
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild.d.cts","names":[],"sources":["../src/esbuild.ts"],"mappings":";;;;;;;;;cAyCa,eAAA,EAAiB,OAAA,CAAQ,YAAA;;;;;AAAtC;;;iBAqBgB,YAAA,CACd,OAAA,EAAS,OAAA,EACT,WAAA,GAAa,2BAAA,gBACZ,YAAA;;AAHH;;;;;;iBA0BgB,cAAA,CACd,OAAA,EAAS,OAAA,EACT,QAAA,GAAU,WAAA,CAAY,YAAA,IACrB,YAAA;;;;;;;;;AAHH;;;;;;;;;;;;;;iBAgHgB,oBAAA,kBAAsC,gBAAA,CAAA,CACpD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;AAFnE;;;;;;;;;;;;;;cAqDM,MAAA,GAAM,OAAA,GAA8C,wBAAA,iBAA9C,SAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"esbuild.d.cts","names":[],"sources":["../src/esbuild.ts"],"mappings":";;;;;;;;;cAyCa,eAAA,EAAiB,OAAA,CAAQ,YAAA;;;;;AAAtC;;;iBAqBgB,YAAA,kBAA8B,iBAAA,CAAA,CAC5C,OAAA,EAAS,QAAA,EACT,WAAA,GAAa,2BAAA,gBACZ,YAAA;;AAHH;;;;;;iBA0BgB,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,EACT,QAAA,GAAU,WAAA,CAAY,YAAA,IACrB,YAAA;;;;;;;;;;;;AAHH;;;;;;;;;;;iBAgHgB,oBAAA,kBAAsC,gBAAA,CAAA,CACpD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;AAFnE;;;;;;;;cAqDM,MAAA,GAAM,OAAA,GAA8C,wBAAA,iBAA9C,SAAA,CAAA,MAAA"}
@@ -1,7 +1,7 @@
1
1
  import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
2
2
  import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
3
3
  import * as _$_powerlines_core0 from "@powerlines/core";
4
- import { Context, ExecutionContext, ResolvedEntryTypeDefinition } from "@powerlines/core";
4
+ import { ExecutionContext, ResolvedEntryTypeDefinition, UnresolvedContext } from "@powerlines/core";
5
5
  import { DeepPartial } from "@stryke/types/base";
6
6
  import * as _$esbuild from "esbuild";
7
7
  import { BuildOptions } from "esbuild";
@@ -15,7 +15,7 @@ declare const DEFAULT_OPTIONS: Partial<BuildOptions>;
15
15
  * @param entryPoints - The entry points to resolve.
16
16
  * @returns The resolved entry options.
17
17
  */
18
- declare function resolveEntry(context: Context, entryPoints?: ResolvedEntryTypeDefinition[] | string[]): BuildOptions["entryPoints"];
18
+ declare function resolveEntry<TContext extends UnresolvedContext>(context: TContext, entryPoints?: ResolvedEntryTypeDefinition[] | string[]): BuildOptions["entryPoints"];
19
19
  /**
20
20
  * Resolves the esbuild options.
21
21
  *
@@ -23,7 +23,7 @@ declare function resolveEntry(context: Context, entryPoints?: ResolvedEntryTypeD
23
23
  * @param override - Optional esbuild options to override the resolved options.
24
24
  * @returns The resolved esbuild options.
25
25
  */
26
- declare function resolveOptions(context: Context, override?: DeepPartial<BuildOptions>): BuildOptions;
26
+ declare function resolveOptions<TContext extends UnresolvedContext>(context: TContext, override?: DeepPartial<BuildOptions>): BuildOptions;
27
27
  /**
28
28
  * Creates an ESBuild plugin factory that generates a plugin instance.
29
29
  *
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild.d.mts","names":[],"sources":["../src/esbuild.ts"],"mappings":";;;;;;;;;cAyCa,eAAA,EAAiB,OAAA,CAAQ,YAAA;;;;;AAAtC;;;iBAqBgB,YAAA,CACd,OAAA,EAAS,OAAA,EACT,WAAA,GAAa,2BAAA,gBACZ,YAAA;;AAHH;;;;;;iBA0BgB,cAAA,CACd,OAAA,EAAS,OAAA,EACT,QAAA,GAAU,WAAA,CAAY,YAAA,IACrB,YAAA;;;;;;;;;AAHH;;;;;;;;;;;;;;iBAgHgB,oBAAA,kBAAsC,gBAAA,CAAA,CACpD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;AAFnE;;;;;;;;;;;;;;cAqDM,MAAA,GAAM,OAAA,GAA8C,wBAAA,iBAA9C,SAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"esbuild.d.mts","names":[],"sources":["../src/esbuild.ts"],"mappings":";;;;;;;;;cAyCa,eAAA,EAAiB,OAAA,CAAQ,YAAA;;;;;AAAtC;;;iBAqBgB,YAAA,kBAA8B,iBAAA,CAAA,CAC5C,OAAA,EAAS,QAAA,EACT,WAAA,GAAa,2BAAA,gBACZ,YAAA;;AAHH;;;;;;iBA0BgB,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,EACT,QAAA,GAAU,WAAA,CAAY,YAAA,IACrB,YAAA;;;;;;;;;;;;AAHH;;;;;;;;;;;iBAgHgB,oBAAA,kBAAsC,gBAAA,CAAA,CACpD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;AAFnE;;;;;;;;cAqDM,MAAA,GAAM,OAAA,GAA8C,wBAAA,iBAA9C,SAAA,CAAA,MAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild.mjs","names":[],"sources":["../src/esbuild.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n Context,\n ExecutionContext,\n ResolvedEntryTypeDefinition,\n UnpluginOptions\n} from \"@powerlines/core\";\nimport { resolveEntryOutput } from \"@powerlines/core/lib/entry\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { DeepPartial } from \"@stryke/types/base\";\nimport defu from \"defu\";\nimport type { BuildOptions, PluginBuild } from \"esbuild\";\nimport { Format } from \"esbuild\";\nimport { createEsbuildPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\nexport const DEFAULT_OPTIONS: Partial<BuildOptions> = {\n target: \"esnext\",\n platform: \"neutral\",\n format: \"esm\",\n write: true,\n minify: true,\n sourcemap: false,\n bundle: true,\n treeShaking: true,\n keepNames: true,\n splitting: true,\n logLevel: \"silent\"\n};\n\n/**\n * Resolves the entry options for esbuild.\n *\n * @param context - The build context.\n * @param entryPoints - The entry points to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveEntry(\n context: Context,\n entryPoints: ResolvedEntryTypeDefinition[] | string[] = []\n): BuildOptions[\"entryPoints\"] {\n return entryPoints.reduce(\n (ret, entry) => {\n if (isString(entry)) {\n ret[replaceExtension(replacePath(entry, context.config.root))] =\n replacePath(entry, context.config.root);\n } else {\n ret[entry.output || resolveEntryOutput(context, entry)] = entry.file;\n }\n\n return ret;\n },\n {} as Record<string, string>\n );\n}\n\n/**\n * Resolves the esbuild options.\n *\n * @param context - The build context.\n * @param override - Optional esbuild options to override the resolved options.\n * @returns The resolved esbuild options.\n */\nexport function resolveOptions(\n context: Context,\n override: DeepPartial<BuildOptions> = {}\n): BuildOptions {\n if (context.config.inject && Object.keys(context.config.inject).length > 0) {\n context.fs.writeSync(\n joinPaths(\n context.config.cwd,\n context.config.root,\n context.artifactsPath,\n \"inject-shim.js\"\n ),\n Object.entries(context.config.inject)\n .map(([key, value]) => {\n if (value) {\n if (Array.isArray(value)) {\n if (camelCase(key) !== key) {\n if (value.length === 1) {\n return `\nimport ${camelCase(key)} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n } else if (value.length > 1) {\n return `\nimport ${value[1] === \"*\" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n }\n } else if (value.length === 1) {\n return `\nimport ${key} from \"${value[0]}\";\nexport { ${key} };`;\n } else if (value.length > 1) {\n return `\nimport ${value[1] === \"*\" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from \"${value[0]}\";\nexport { ${key} };`;\n }\n } else if (camelCase(key) !== key) {\n return `\nimport ${camelCase(key)} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n } else {\n return `\nimport ${key} from \"${value}\";\nexport { ${key} };`;\n }\n }\n\n return \"\";\n })\n .join(\"\\n\")\n );\n }\n\n return defu(\n {\n alias: context.alias,\n inject:\n context.config.inject && Object.keys(context.config.inject).length > 0\n ? [\n joinPaths(\n context.config.cwd,\n context.config.root,\n context.artifactsPath,\n \"inject-shim.js\"\n )\n ]\n : undefined\n },\n override,\n {\n mainFields: context.config.resolve.mainFields,\n conditions: context.config.resolve.conditions,\n define: context.config.define,\n resolveExtensions: context.config.resolve.extensions,\n packages: context.config.resolve.skipNodeModulesBundle\n ? \"external\"\n : \"bundle\",\n format: (Array.isArray(context.config.output.format)\n ? context.config.output.format[0]\n : context.config.output.format) as Format,\n platform: context.config.platform,\n outdir: context.config.output.path,\n tsconfig: context.tsconfig.tsconfigFilePath,\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap\n },\n DEFAULT_OPTIONS\n ) as BuildOptions;\n}\n\n/**\n * Creates an ESBuild plugin factory that generates a plugin instance.\n *\n * @see https://esbuild.github.io/plugins/\n *\n * @example\n * ```ts\n * // esbuild.config.ts\n * import { createEsbuildFactory } from \"@powerlines/unplugin/esbuild\";\n *\n * const powerlinesPlugin = createEsbuildFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates an ESBuild plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your ESBuild build.\n */\nexport function createEsbuildFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"esbuild\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n esbuild: {\n config: opts => {\n opts ??= {};\n\n const result = resolveOptions(unplugin.context);\n for (const key in result) {\n if (\n isUndefined(opts[key as keyof BuildOptions]) &&\n !isUndefined(result[key as keyof BuildOptions])\n ) {\n opts[key as keyof BuildOptions] = result[\n key as keyof BuildOptions\n ] as any;\n }\n }\n },\n setup: async (build: PluginBuild) => {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"esbuild:setup\",\n { environment },\n build\n );\n }\n }\n })\n );\n}\n\n/**\n * An ESBuild plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://esbuild.github.io/plugins/\n *\n * @example\n * ```js\n * // esbuild.config.js\n * import powerlines from \"@powerlines/unplugin/esbuild\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * };\n *\n * ```\n */\nconst plugin = createEsbuildPlugin(createEsbuildFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;AAyCA,MAAa,kBAAyC;CACpD,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,WAAW;CACX,QAAQ;CACR,aAAa;C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,OAAO,OAAO,UAAuB;IACnC,MAAM,cAAc,MAAM,SAAS,QAAQ,gBAAgB;IAE3D,OAAO,SAAS,QAAQ,SACtB,iBACA,EAAE,aAAa,EACf,MACD;;GAEJ;EACF,CAAC,CACH;;;;;;;;;;;;;;;;;;AAmBH,MAAM,SAAS,oBAAoB,sBAAsB,CAAC"}
1
+ {"version":3,"file":"esbuild.mjs","names":[],"sources":["../src/esbuild.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ExecutionContext,\n ResolvedEntryTypeDefinition,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { resolveEntryOutput } from \"@powerlines/core/lib/entry\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { DeepPartial } from \"@stryke/types/base\";\nimport defu from \"defu\";\nimport type { BuildOptions, PluginBuild } from \"esbuild\";\nimport { Format } from \"esbuild\";\nimport { createEsbuildPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\nexport const DEFAULT_OPTIONS: Partial<BuildOptions> = {\n target: \"esnext\",\n platform: \"neutral\",\n format: \"esm\",\n write: true,\n minify: true,\n sourcemap: false,\n bundle: true,\n treeShaking: true,\n keepNames: true,\n splitting: true,\n logLevel: \"silent\"\n};\n\n/**\n * Resolves the entry options for esbuild.\n *\n * @param context - The build context.\n * @param entryPoints - The entry points to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveEntry<TContext extends UnresolvedContext>(\n context: TContext,\n entryPoints: ResolvedEntryTypeDefinition[] | string[] = []\n): BuildOptions[\"entryPoints\"] {\n return entryPoints.reduce(\n (ret, entry) => {\n if (isString(entry)) {\n ret[replaceExtension(replacePath(entry, context.config.root))] =\n replacePath(entry, context.config.root);\n } else {\n ret[entry.output || resolveEntryOutput(context, entry)] = entry.file;\n }\n\n return ret;\n },\n {} as Record<string, string>\n );\n}\n\n/**\n * Resolves the esbuild options.\n *\n * @param context - The build context.\n * @param override - Optional esbuild options to override the resolved options.\n * @returns The resolved esbuild options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext,\n override: DeepPartial<BuildOptions> = {}\n): BuildOptions {\n if (context.config.inject && Object.keys(context.config.inject).length > 0) {\n context.fs.writeSync(\n joinPaths(\n context.config.cwd,\n context.config.root,\n context.artifactsPath,\n \"inject-shim.js\"\n ),\n Object.entries(context.config.inject)\n .map(([key, value]) => {\n if (value) {\n if (Array.isArray(value)) {\n if (camelCase(key) !== key) {\n if (value.length === 1) {\n return `\nimport ${camelCase(key)} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n } else if (value.length > 1) {\n return `\nimport ${value[1] === \"*\" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n }\n } else if (value.length === 1) {\n return `\nimport ${key} from \"${value[0]}\";\nexport { ${key} };`;\n } else if (value.length > 1) {\n return `\nimport ${value[1] === \"*\" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from \"${value[0]}\";\nexport { ${key} };`;\n }\n } else if (camelCase(key) !== key) {\n return `\nimport ${camelCase(key)} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n } else {\n return `\nimport ${key} from \"${value}\";\nexport { ${key} };`;\n }\n }\n\n return \"\";\n })\n .join(\"\\n\")\n );\n }\n\n return defu(\n {\n alias: context.alias,\n inject:\n context.config.inject && Object.keys(context.config.inject).length > 0\n ? [\n joinPaths(\n context.config.cwd,\n context.config.root,\n context.artifactsPath,\n \"inject-shim.js\"\n )\n ]\n : undefined\n },\n override,\n {\n mainFields: context.config.resolve.mainFields,\n conditions: context.config.resolve.conditions,\n define: context.config.define,\n resolveExtensions: context.config.resolve.extensions,\n packages: context.config.resolve.skipNodeModulesBundle\n ? \"external\"\n : \"bundle\",\n format: (Array.isArray(context.config.output.format)\n ? context.config.output.format[0]\n : context.config.output.format) as Format,\n platform: context.config.platform,\n outdir: context.config.output.path,\n tsconfig: context.tsconfig.tsconfigFilePath,\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap\n },\n DEFAULT_OPTIONS\n ) as BuildOptions;\n}\n\n/**\n * Creates an ESBuild plugin factory that generates a plugin instance.\n *\n * @see https://esbuild.github.io/plugins/\n *\n * @example\n * ```ts\n * // esbuild.config.ts\n * import { createEsbuildFactory } from \"@powerlines/unplugin/esbuild\";\n *\n * const powerlinesPlugin = createEsbuildFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates an ESBuild plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your ESBuild build.\n */\nexport function createEsbuildFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"esbuild\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n esbuild: {\n config: opts => {\n opts ??= {};\n\n const result = resolveOptions(unplugin.context);\n for (const key in result) {\n if (\n isUndefined(opts[key as keyof BuildOptions]) &&\n !isUndefined(result[key as keyof BuildOptions])\n ) {\n opts[key as keyof BuildOptions] = result[\n key as keyof BuildOptions\n ] as any;\n }\n }\n },\n setup: async (build: PluginBuild) => {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"esbuild:setup\",\n { environment },\n build\n );\n }\n }\n })\n );\n}\n\n/**\n * An ESBuild plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://esbuild.github.io/plugins/\n *\n * @example\n * ```js\n * // esbuild.config.js\n * import powerlines from \"@powerlines/unplugin/esbuild\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * };\n *\n * ```\n */\nconst plugin = createEsbuildPlugin(createEsbuildFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;AAyCA,MAAa,kBAAyC;CACpD,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,WAAW;CACX,QAAQ;CACR,aAAa;CACb,WAAW;CACX,WAAW;CACX,UAAU;CACX;;;;;;;;AASD,SAAgB,aACd,SACA,cAAwD,EAAE,EAC7B;AAC7B,QAAO,YAAY,QAChB,KAAK,UAAU;AACd,MAAI,SAAS,MAAM,CACjB,KAAI,iBAAiB,YAAY,OAAO,QAAQ,OAAO,KAAK,CAAC,IAC3D,YAAY,OAAO,QAAQ,OAAO,KAAK;MAEzC,KAAI,MAAM,UAAU,mBAAmB,SAAS,MAAM,IAAI,MAAM;AAGlE,SAAO;IAET,EAAE,CACH;;;;;;;;;AAUH,SAAgB,eACd,SACA,WAAsC,EAAE,EAC1B;AACd,KAAI,QAAQ,OAAO,UAAU,OAAO,KAAK,QAAQ,OAAO,OAAO,CAAC,SAAS,EACvE,SAAQ,GAAG,UACT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;EAC1C,UAAU,QAAQ,OAAO,QAAQ,wBAC7B,aACA;EACJ,QAAS,MAAM,QAAQ,QAAQ,OAAO,OAAO,OAAO,GAChD,QAAQ,OAAO,OAAO,OAAO,KAC7B,QAAQ,OAAO,OAAO;EAC1B,UAAU,QAAQ,OAAO;EACzB,QAAQ,QAAQ,OAAO,OAAO;EAC9B,UAAU,QAAQ,SAAS;EAC3B,QAAQ,QAAQ,OAAO,OAAO;EAC9B,UAAU,QAAQ,OAAO,SAAS;EAClC,WAAW,QAAQ,OAAO,OAAO;EAClC,EACD,gBACD;;;;;;;;;;;;;;;;;;;;;;;;AAyBH,SAAgB,qBACd,UAAmD,EAAE,EACrD,YAA+C,YAAW,SAC1D;AACA,QAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;EAAW,GAAE,aAC/D,SAAS;EACP,GAAI;EACJ,SAAS;GACP,SAAQ,SAAQ;AACd,aAAS,EAAE;IAEX,MAAM,SAAS,eAAe,SAAS,QAAQ;AAC/C,SAAK,MAAM,OAAO,OAChB,KACE,YAAY,KAAK,KAA2B,IAC5C,CAAC,YAAY,OAAO,KAA2B,CAE/C,MAAK,OAA6B,OAChC;;GAKR,OAAO,OAAO,UAAuB;IACnC,MAAM,cAAc,MAAM,SAAS,QAAQ,gBAAgB;AAE3D,WAAO,SAAS,QAAQ,SACtB,iBACA,EAAE,aAAa,EACf,MACD;;GAEJ;EACF,CAAC,CACH;;;;;;;;;;;;;;;;;;AAmBH,MAAM,SAAS,oBAAoB,sBAAsB,CAAC"}
package/dist/farm.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"farm.mjs","names":[],"sources":["../src/farm.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 { ExecutionContext, UnpluginOptions } from \"@powerlines/core\";\nimport { createFarmPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Creates a Farm plugin factory that generates a plugin instance.\n *\n * @see https://farmjs.dev/plugins/writing-plugins\n *\n * @example\n * ```ts\n * // farm.config.ts\n * import { createFarmFactory } from \"@powerlines/unplugin/farm\";\n *\n * const powerlinesPlugin = createFarmFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Farm plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Farm build.\n */\nexport function createFarmFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"farm\" }, unplugin =>\n decorate(unplugin as UnpluginOptions<TContext>)\n );\n}\n\n/**\n * A Farm plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://farmjs.dev/plugins/writing-plugins\n *\n * @example\n * ```ts\n * // farm.config.ts\n * import powerlines from \"@powerlines/unplugin/farm\";\n * import { defineConfig } from \"@farmfe/core\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nconst farm = createFarmPlugin(createFarmFactory());\n\nexport default farm;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,kBACd,UAAmD,EAAE,EACrD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;EAAQ,GAAE,aAC5D,SAAS,SAAsC,CAChD;;;;;;;;;;;;;;;;;;;AAoBH,MAAM,OAAO,iBAAiB,mBAAmB,CAAC"}
1
+ {"version":3,"file":"farm.mjs","names":[],"sources":["../src/farm.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 { ExecutionContext, UnpluginOptions } from \"@powerlines/core\";\nimport { createFarmPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Creates a Farm plugin factory that generates a plugin instance.\n *\n * @see https://farmjs.dev/plugins/writing-plugins\n *\n * @example\n * ```ts\n * // farm.config.ts\n * import { createFarmFactory } from \"@powerlines/unplugin/farm\";\n *\n * const powerlinesPlugin = createFarmFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Farm plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Farm build.\n */\nexport function createFarmFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"farm\" }, unplugin =>\n decorate(unplugin as UnpluginOptions<TContext>)\n );\n}\n\n/**\n * A Farm plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://farmjs.dev/plugins/writing-plugins\n *\n * @example\n * ```ts\n * // farm.config.ts\n * import powerlines from \"@powerlines/unplugin/farm\";\n * import { defineConfig } from \"@farmfe/core\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nconst farm = createFarmPlugin(createFarmFactory());\n\nexport default farm;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,kBACd,UAAmD,EAAE,EACrD,YAA+C,YAAW,SAC1D;AACA,QAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;EAAQ,GAAE,aAC5D,SAAS,SAAsC,CAChD;;;;;;;;;;;;;;;;;;;AAoBH,MAAM,OAAO,iBAAiB,mBAAmB,CAAC"}
package/dist/next.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"next.mjs","names":["webpack"],"sources":["../src/next.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { NextConfig } from \"next\";\nimport type { WebpackConfigContext } from \"next/dist/server/config-shared\";\nimport type { Configuration } from \"webpack\";\nimport webpack from \"./webpack\";\n\n/**\n * A Next.js configuration function that integrates Powerlines into the build process.\n *\n * @see https://nextjs.org/docs/api-reference/next.config.js/introduction\n *\n * @example\n * ```js\n * // next.config.js\n * import withPowerlines from '@powerlines/unplugin/next'\n *\n * export default withPowerlines({\n * reactStrictMode: true,\n * })\n * ```\n *\n * @param options - The Next.js configuration to merge with the Powerlines configuration.\n * @returns The merged Next.js configuration.\n */\nexport function withPlugin(options: NextConfig): NextConfig {\n return {\n ...options,\n webpack(config: Configuration, context: WebpackConfigContext) {\n const result = (options.webpack?.(config, context) ||\n config) as Configuration;\n\n result.plugins ??= [];\n result.plugins.push(webpack());\n\n return result;\n }\n };\n}\n\nexport default withPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,WAAW,SAAiC;CAC1D,OAAO;EACL,GAAG;EACH,QAAQ,QAAuB,SAA+B;GAC5D,MAAM,SAAU,QAAQ,UAAU,QAAQ,QAAQ,IAChD;GAEF,OAAO,YAAY,EAAE;GACrB,OAAO,QAAQ,KAAKA,QAAS,CAAC;GAE9B,OAAO;;EAEV"}
1
+ {"version":3,"file":"next.mjs","names":["webpack"],"sources":["../src/next.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { NextConfig } from \"next\";\nimport type { WebpackConfigContext } from \"next/dist/server/config-shared\";\nimport type { Configuration } from \"webpack\";\nimport webpack from \"./webpack\";\n\n/**\n * A Next.js configuration function that integrates Powerlines into the build process.\n *\n * @see https://nextjs.org/docs/api-reference/next.config.js/introduction\n *\n * @example\n * ```js\n * // next.config.js\n * import withPowerlines from '@powerlines/unplugin/next'\n *\n * export default withPowerlines({\n * reactStrictMode: true,\n * })\n * ```\n *\n * @param options - The Next.js configuration to merge with the Powerlines configuration.\n * @returns The merged Next.js configuration.\n */\nexport function withPlugin(options: NextConfig): NextConfig {\n return {\n ...options,\n webpack(config: Configuration, context: WebpackConfigContext) {\n const result = (options.webpack?.(config, context) ||\n config) as Configuration;\n\n result.plugins ??= [];\n result.plugins.push(webpack());\n\n return result;\n }\n };\n}\n\nexport default withPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,WAAW,SAAiC;AAC1D,QAAO;EACL,GAAG;EACH,QAAQ,QAAuB,SAA+B;GAC5D,MAAM,SAAU,QAAQ,UAAU,QAAQ,QAAQ,IAChD;AAEF,UAAO,YAAY,EAAE;AACrB,UAAO,QAAQ,KAAKA,QAAS,CAAC;AAE9B,UAAO;;EAEV"}
package/dist/nuxt.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"nuxt.mjs","names":["vite","webpack"],"sources":["../src/nuxt.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 { addVitePlugin, addWebpackPlugin, defineNuxtModule } from \"@nuxt/kit\";\nimport type { UserConfig } from \"@powerlines/core\";\nimport { name, version } from \"../package.json\";\nimport vite from \"./vite\";\nimport webpack from \"./webpack\";\n\n/**\n * A Nuxt plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://nuxt.com/docs/guide/directory-structure/modules\n *\n * @example\n * ```ts\n * // nuxt.config.ts\n * import { defineNuxtConfig } from \"@nuxt/kit\";\n *\n * export default defineNuxtConfig({\n * modules: [\n * [\n * \"@powerlines/unplugin/nuxt\",\n * { name: \"example-app\", ... }\n * ],\n * ],\n * });\n *\n * ```\n */\nconst plugin = defineNuxtModule<UserConfig>({\n meta: {\n name,\n version,\n configKey: \"powerlines\",\n compatibility: {\n builder: {\n vite: \"^8.0.0\"\n }\n }\n },\n defaults: {},\n setup(options) {\n addVitePlugin(() => vite(options));\n addWebpackPlugin(() => webpack(options));\n }\n});\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,SAAS,iBAA6B;CAC1C,MAAM;EACJ;EACA;EACA,WAAW;EACX,eAAe,EACb,SAAS,EACP,MAAM,UACP,EACF;EACF;CACD,UAAU,EAAE;CACZ,MAAM,SAAS;EACb,oBAAoBA,SAAK,QAAQ,CAAC;EAClC,uBAAuBC,SAAQ,QAAQ,CAAC;;CAE3C,CAAC"}
1
+ {"version":3,"file":"nuxt.mjs","names":["vite","webpack"],"sources":["../src/nuxt.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 { addVitePlugin, addWebpackPlugin, defineNuxtModule } from \"@nuxt/kit\";\nimport type { UserConfig } from \"@powerlines/core\";\nimport { name, version } from \"../package.json\";\nimport vite from \"./vite\";\nimport webpack from \"./webpack\";\n\n/**\n * A Nuxt plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://nuxt.com/docs/guide/directory-structure/modules\n *\n * @example\n * ```ts\n * // nuxt.config.ts\n * import { defineNuxtConfig } from \"@nuxt/kit\";\n *\n * export default defineNuxtConfig({\n * modules: [\n * [\n * \"@powerlines/unplugin/nuxt\",\n * { name: \"example-app\", ... }\n * ],\n * ],\n * });\n *\n * ```\n */\nconst plugin = defineNuxtModule<UserConfig>({\n meta: {\n name,\n version,\n configKey: \"powerlines\",\n compatibility: {\n builder: {\n vite: \"^8.0.0\"\n }\n }\n },\n defaults: {},\n setup(options) {\n addVitePlugin(() => vite(options));\n addWebpackPlugin(() => webpack(options));\n }\n});\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,SAAS,iBAA6B;CAC1C,MAAM;EACJ;EACA;EACA,WAAW;EACX,eAAe,EACb,SAAS,EACP,MAAM,UACP,EACF;EACF;CACD,UAAU,EAAE;CACZ,MAAM,SAAS;AACb,sBAAoBA,SAAK,QAAQ,CAAC;AAClC,yBAAuBC,SAAQ,QAAQ,CAAC;;CAE3C,CAAC"}
package/dist/package.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  //#region package.json
3
3
  var name = "@powerlines/unplugin";
4
- var version = "0.0.11";
4
+ var version = "0.0.12";
5
5
 
6
6
  //#endregion
7
7
  Object.defineProperty(exports, 'name', {
package/dist/package.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  //#region package.json
2
2
  var name = "@powerlines/unplugin";
3
- var version = "0.0.11";
3
+ var version = "0.0.12";
4
4
 
5
5
  //#endregion
6
6
  export { name, version };
package/dist/rolldown.cjs CHANGED
@@ -133,7 +133,7 @@ function createRolldownFactory(options = {}, decorate = (options) => options) {
133
133
  ...unplugin$1,
134
134
  rolldown: { async options(options) {
135
135
  const environment = await unplugin$1.context.getEnvironment();
136
- return (0, defu.defu)(resolveOptions(environment), options, unplugin$1.context.callHook("rolldown:options", { environment }, options) ?? {});
136
+ return (0, defu.defu)(resolveOptions(environment), options, await unplugin$1.context.callHook("rolldown:options", { environment }, options) ?? {});
137
137
  } }
138
138
  }));
139
139
  }
@@ -1,7 +1,7 @@
1
1
  import { UnpluginExecutionOptions, UnpluginFactory } from "./types.cjs";
2
2
  import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
3
3
  import * as _$_powerlines_core0 from "@powerlines/core";
4
- import { Context, ExecutionContext } from "@powerlines/core";
4
+ import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
5
5
  import * as _$rolldown from "rolldown";
6
6
  import { RolldownOptions } from "rolldown";
7
7
 
@@ -20,7 +20,7 @@ declare const DEFAULT_OPTIONS: {
20
20
  * @param context - The build context.
21
21
  * @returns The resolved options.
22
22
  */
23
- declare function resolveOptions(context: Context): RolldownOptions;
23
+ declare function resolveOptions<TContext extends UnresolvedContext>(context: TContext): RolldownOptions;
24
24
  /**
25
25
  * Creates a Rolldown plugin factory that generates a plugin instance.
26
26
  *
@@ -1 +1 @@
1
- {"version":3,"file":"rolldown.d.cts","names":[],"sources":["../src/rolldown.ts"],"mappings":";;;;;;;;cA4Ca,eAAA;;;;;;;;;;;;;;iBAeG,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,eAAA;;AAAlD;;;;;;;;;AAuJA;;;;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,CAAA,CACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;;;;AAsBlE;;cAiBK,MAAA,GAAM,OAAA,GAAgD,wBAAA,iBAAhD,UAAA,CAAA,MAAA,QAAA,UAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"rolldown.d.cts","names":[],"sources":["../src/rolldown.ts"],"mappings":";;;;;;;;cA4Ca,eAAA;;;;;;;;;;;;;;iBAeG,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,eAAA;;AAFH;;;;;;;;;;;;;;;AAyJA;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,CAAA,CACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;;;;;;cAuC7D,MAAA,GAAM,OAAA,GAAgD,wBAAA,iBAAhD,UAAA,CAAA,MAAA,QAAA,UAAA,CAAA,MAAA"}
@@ -1,7 +1,7 @@
1
1
  import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
2
2
  import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
3
3
  import * as _$_powerlines_core0 from "@powerlines/core";
4
- import { Context, ExecutionContext } from "@powerlines/core";
4
+ import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
5
5
  import * as _$rolldown from "rolldown";
6
6
  import { RolldownOptions } from "rolldown";
7
7
 
@@ -20,7 +20,7 @@ declare const DEFAULT_OPTIONS: {
20
20
  * @param context - The build context.
21
21
  * @returns The resolved options.
22
22
  */
23
- declare function resolveOptions(context: Context): RolldownOptions;
23
+ declare function resolveOptions<TContext extends UnresolvedContext>(context: TContext): RolldownOptions;
24
24
  /**
25
25
  * Creates a Rolldown plugin factory that generates a plugin instance.
26
26
  *
@@ -1 +1 @@
1
- {"version":3,"file":"rolldown.d.mts","names":[],"sources":["../src/rolldown.ts"],"mappings":";;;;;;;;cA4Ca,eAAA;;;;;;;;;;;;;;iBAeG,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,eAAA;;AAAlD;;;;;;;;;AAuJA;;;;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,CAAA,CACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;;;;AAsBlE;;cAiBK,MAAA,GAAM,OAAA,GAAgD,wBAAA,iBAAhD,UAAA,CAAA,MAAA,QAAA,UAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"rolldown.d.mts","names":[],"sources":["../src/rolldown.ts"],"mappings":";;;;;;;;cA4Ca,eAAA;;;;;;;;;;;;;;iBAeG,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,eAAA;;AAFH;;;;;;;;;;;;;;;AAyJA;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,CAAA,CACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;;;;;;cAuC7D,MAAA,GAAM,OAAA,GAAgD,wBAAA,iBAAhD,UAAA,CAAA,MAAA,QAAA,UAAA,CAAA,MAAA"}
package/dist/rolldown.mjs CHANGED
@@ -127,7 +127,7 @@ function createRolldownFactory(options = {}, decorate = (options) => options) {
127
127
  ...unplugin,
128
128
  rolldown: { async options(options) {
129
129
  const environment = await unplugin.context.getEnvironment();
130
- return defu$1(resolveOptions(environment), options, unplugin.context.callHook("rolldown:options", { environment }, options) ?? {});
130
+ return defu$1(resolveOptions(environment), options, await unplugin.context.callHook("rolldown:options", { environment }, options) ?? {});
131
131
  } }
132
132
  }));
133
133
  }
@@ -1 +1 @@
1
- {"version":3,"file":"rolldown.mjs","names":["defu","alias"],"sources":["../src/rolldown.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n Context,\n ExecutionContext,\n UnpluginOptions\n} from \"@powerlines/core\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"glob\";\nimport type { InputOptions } from \"rolldown\";\nimport { RolldownOptions, RollupLog } from \"rolldown\";\nimport { viteAliasPlugin as alias } from \"rolldown/experimental\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRolldownPlugin } from \"unplugin\";\nimport { dtsBundlePlugin } from \"./rollup\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\nexport const DEFAULT_OPTIONS = {\n keepNames: true,\n treeshake: true,\n shimMissingExports: true,\n transform: {\n target: \"esnext\"\n }\n};\n\n/**\n * Resolves the options for [rolldown](https://rolldown.rs).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(context: Context): RolldownOptions {\n return defu<RolldownOptions, any>(\n {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n dtsBundlePlugin\n ],\n resolve: {\n alias: context.alias,\n mainFields: context.config.resolve.mainFields,\n conditions: context.config.resolve.conditions,\n define: context.config.define,\n extensions: context.config.resolve.extensions\n },\n transform: {\n define: context.config.define,\n inject: context.config.inject,\n typescript: {\n target: context.tsconfig.tsconfigJson?.compilerOptions?.target\n }\n },\n platform: context.config.platform,\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n cache: !context.config.skipCache\n ? joinPaths(context.cachePath, \"rolldown\")\n : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"error\",\n onLog(level: \"info\" | \"debug\" | \"warn\", log: RollupLog) {\n if (log.message?.trim()) {\n if (level === \"info\") {\n context.logger.debug(log.message?.trim() ?? \"\");\n } else {\n context.logger.log(level, log.message?.trim() ?? \"\");\n }\n }\n },\n minify: context.config.output.minify,\n output: [\n {\n dir: context.config.output.path,\n format: \"es\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n },\n {\n dir: context.config.output.path,\n format: \"cjs\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n }\n ]\n },\n DEFAULT_OPTIONS\n );\n}\n\n/**\n * Creates a Rolldown plugin factory that generates a plugin instance.\n *\n * @see https://rolldown.rs/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rolldown.config.ts\n * import { createRolldownFactory } from \"@powerlines/unplugin/rolldown\";\n *\n * const powerlinesPlugin = createRolldownFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rolldown plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rolldown build.\n */\nexport function createRolldownFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rolldown\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rolldown: {\n async options(options: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n options,\n unplugin.context.callHook(\n \"rolldown:options\",\n { environment },\n options\n ) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rolldown plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rolldown.rs/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rolldown.config.ts\n * import powerlines from \"@powerlines/unplugin/rolldown\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nconst plugin = createRolldownPlugin(createRolldownFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;AA4CA,MAAa,kBAAkB;CAC7B,WAAW;CACX,WAAW;CACX,oBAAoB;CACpB,WAAW,EACT,QAAQ,UACT;CACF;;;;;;;AAQD,SAAgB,eAAe,SAAmC;CAChE,OAAOA,OACL;EACE,OAAO,SACL,QAAQ,QAAQ,MAAM,CAAC,KAAI,UACzB,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EJ;EACF,CAAC,CACH;;;;;;;;;;;;;;;;;AAkBH,MAAM,SAAS,qBAAqB,uBAAuB,CAAC"}
1
+ {"version":3,"file":"rolldown.mjs","names":["defu","alias"],"sources":["../src/rolldown.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"glob\";\nimport type { InputOptions } from \"rolldown\";\nimport { RolldownOptions, RollupLog } from \"rolldown\";\nimport { viteAliasPlugin as alias } from \"rolldown/experimental\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRolldownPlugin } from \"unplugin\";\nimport { dtsBundlePlugin } from \"./rollup\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\nexport const DEFAULT_OPTIONS = {\n keepNames: true,\n treeshake: true,\n shimMissingExports: true,\n transform: {\n target: \"esnext\"\n }\n};\n\n/**\n * Resolves the options for [rolldown](https://rolldown.rs).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): RolldownOptions {\n return defu<RolldownOptions, any>(\n {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n dtsBundlePlugin\n ],\n resolve: {\n alias: context.alias,\n mainFields: context.config.resolve.mainFields,\n conditions: context.config.resolve.conditions,\n define: context.config.define,\n extensions: context.config.resolve.extensions\n },\n transform: {\n define: context.config.define,\n inject: context.config.inject,\n typescript: {\n target: context.tsconfig.tsconfigJson?.compilerOptions?.target\n }\n },\n platform: context.config.platform,\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n cache: !context.config.skipCache\n ? joinPaths(context.cachePath, \"rolldown\")\n : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"error\",\n onLog(level: \"info\" | \"debug\" | \"warn\", log: RollupLog) {\n if (log.message?.trim()) {\n if (level === \"info\") {\n context.logger.debug(log.message?.trim() ?? \"\");\n } else {\n context.logger.log(level, log.message?.trim() ?? \"\");\n }\n }\n },\n minify: context.config.output.minify,\n output: [\n {\n dir: context.config.output.path,\n format: \"es\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n },\n {\n dir: context.config.output.path,\n format: \"cjs\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n }\n ]\n },\n DEFAULT_OPTIONS\n );\n}\n\n/**\n * Creates a Rolldown plugin factory that generates a plugin instance.\n *\n * @see https://rolldown.rs/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rolldown.config.ts\n * import { createRolldownFactory } from \"@powerlines/unplugin/rolldown\";\n *\n * const powerlinesPlugin = createRolldownFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rolldown plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rolldown build.\n */\nexport function createRolldownFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rolldown\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rolldown: {\n async options(options: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n options,\n (await unplugin.context.callHook(\n \"rolldown:options\",\n { environment },\n options\n )) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rolldown plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rolldown.rs/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rolldown.config.ts\n * import powerlines from \"@powerlines/unplugin/rolldown\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nconst plugin = createRolldownPlugin(createRolldownFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;AA4CA,MAAa,kBAAkB;CAC7B,WAAW;CACX,WAAW;CACX,oBAAoB;CACpB,WAAW,EACT,QAAQ,UACT;CACF;;;;;;;AAQD,SAAgB,eACd,SACiB;AACjB,QAAOA,OACL;EACE,OAAO,SACL,QAAQ,QAAQ,MAAM,CAAC,KAAI,UACzB,SAAS,MAAM,GAAG,QAAQ,MAAM,KACjC,CACF,CAAC,MAAM;EACR,WAAW,WAAmB;AAC5B,OACE,QAAQ,OAAO,QAAQ,YACvB,QAAQ,QAAQ,OAAO,QAAQ,SAAS,CAAC,SAAS,OAAO,CAEzD,QAAO;AAGT,OACE,QAAQ,OAAO,QAAQ,cACvB,QAAQ,QAAQ,OAAO,QAAQ,WAAW,CAAC,SAAS,OAAO,CAE3D,QAAO;AAGT,OAAI,QAAQ,SAAS,SAAS,OAAO,CACnC,QAAO,QAAQ,OAAO,gBAAgB;AAGxC,UAAO,CAAC,QAAQ,OAAO,QAAQ;;EAEjC,SAAS;GACP,iBAAiB;IACf,OAAO;IACP,UAAU,QAAQ,SAAS;IAC5B,CAAC;GACF,QAAQ,OAAO,UACb,OAAO,KAAK,QAAQ,OAAO,OAAO,CAAC,SAAS,KAC5C,QAAQ;IACN,WAAW,QAAQ,OAAO,SAAS;IACnC,mBAAmB;IACnB,GAAI,QAAQ,OAAO,UAAU,EAAE;IAChC,CAAC;GACJ,QAAQ,OAAO,UACb,OAAO,KAAK,QAAQ,OAAO,OAAO,CAAC,SAAS,KAC5C,OAAO;IACL,WAAW,QAAQ,OAAO,SAAS;IACnC,GAAG,QAAQ,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,QAAQ,OAAO,OAAO;GAC3B,QAAQ;GACR,iBAAiB;GACjB,WAAW,QAAQ,OAAO,OAAO;GAClC,CACF;EACF,EACD,gBACD;;;;;;;;;;;;;;;;;;;;;;;;AAyBH,SAAgB,sBACd,UAAmD,EAAE,EACrD,YAA+C,YAAW,SAC1D;AACA,QAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;EAAY,GAAE,aAChE,SAAS;EACP,GAAI;EACJ,UAAU,EACR,MAAM,QAAQ,SAAuB;GACnC,MAAM,cAAc,MAAM,SAAS,QAAQ,gBAAgB;AAE3D,UAAOD,OACL,eAAe,YAAY,EAC3B,SACC,MAAM,SAAS,QAAQ,SACtB,oBACA,EAAE,aAAa,EACf,QACD,IAAK,EAAE,CACT;KAEJ;EACF,CAAC,CACH;;;;;;;;;;;;;;;;;AAkBH,MAAM,SAAS,qBAAqB,uBAAuB,CAAC"}
package/dist/rollup.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { UnpluginExecutionOptions, UnpluginFactory } from "./types.cjs";
2
2
  import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
3
3
  import * as _$_powerlines_core0 from "@powerlines/core";
4
- import { Context, ExecutionContext } from "@powerlines/core";
4
+ import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
5
5
  import { Plugin, RollupOptions } from "rollup";
6
6
 
7
7
  //#region src/rollup.d.ts
@@ -18,7 +18,7 @@ declare const dtsBundlePlugin: Plugin;
18
18
  * @param context - The build context.
19
19
  * @returns The resolved options.
20
20
  */
21
- declare function resolveOptions(context: Context): RollupOptions;
21
+ declare function resolveOptions<TContext extends UnresolvedContext>(context: TContext): RollupOptions;
22
22
  /**
23
23
  * Creates a Rollup plugin factory that generates a plugin instance.
24
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.d.cts","names":[],"sources":["../src/rollup.ts"],"mappings":";;;;;;;;;;AA+CA;;;cAAa,eAAA,EAAiB,MAAA;;AAuC9B;;;;;iBAAgB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,aAAA;;;;AAuHlD;;;;;;;;;;;;;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,CAAA,CACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;AAwCnE;;;;;;;;;;cAAa,MAAA,GAAM,OAAA,GAA4C,wBAAA,iBAA5C,MAAA,QAAA,MAAA"}
1
+ {"version":3,"file":"rollup.d.cts","names":[],"sources":["../src/rollup.ts"],"mappings":";;;;;;;;;;AA+CA;;;cAAa,eAAA,EAAiB,MAAA;;AAuC9B;;;;;iBAAgB,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,aAAA;;;;;;;;;;AAuHH;;;;;;;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,CAAA,CACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;;;AAwCnE;;;;cAAa,MAAA,GAAM,OAAA,GAA4C,wBAAA,iBAA5C,MAAA,QAAA,MAAA"}
package/dist/rollup.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
2
2
  import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
3
3
  import * as _$_powerlines_core0 from "@powerlines/core";
4
- import { Context, ExecutionContext } from "@powerlines/core";
4
+ import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
5
5
  import { Plugin, RollupOptions } from "rollup";
6
6
 
7
7
  //#region src/rollup.d.ts
@@ -18,7 +18,7 @@ declare const dtsBundlePlugin: Plugin;
18
18
  * @param context - The build context.
19
19
  * @returns The resolved options.
20
20
  */
21
- declare function resolveOptions(context: Context): RollupOptions;
21
+ declare function resolveOptions<TContext extends UnresolvedContext>(context: TContext): RollupOptions;
22
22
  /**
23
23
  * Creates a Rollup plugin factory that generates a plugin instance.
24
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.d.mts","names":[],"sources":["../src/rollup.ts"],"mappings":";;;;;;;;;;AA+CA;;;cAAa,eAAA,EAAiB,MAAA;;AAuC9B;;;;;iBAAgB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,aAAA;;;;AAuHlD;;;;;;;;;;;;;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,CAAA,CACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;AAwCnE;;;;;;;;;;cAAa,MAAA,GAAM,OAAA,GAA4C,wBAAA,iBAA5C,MAAA,QAAA,MAAA"}
1
+ {"version":3,"file":"rollup.d.mts","names":[],"sources":["../src/rollup.ts"],"mappings":";;;;;;;;;;AA+CA;;;cAAa,eAAA,EAAiB,MAAA;;AAuC9B;;;;;iBAAgB,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,aAAA;;;;;;;;;;AAuHH;;;;;;;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,CAAA,CACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;;;AAwCnE;;;;cAAa,MAAA,GAAM,OAAA,GAA4C,wBAAA,iBAA5C,MAAA,QAAA,MAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.mjs","names":["defu"],"sources":["../src/rollup.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n Context,\n ExecutionContext,\n UnpluginOptions\n} from \"@powerlines/core\";\nimport alias from \"@rollup/plugin-alias\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"node:fs\";\nimport type { InputOptions, RollupOptions } from \"rollup\";\nimport { Plugin } from \"rollup\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRollupPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.\n *\n * @remarks\n * This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.\n */\nexport const dtsBundlePlugin: Plugin = {\n name: \"powerlines:dts-bundle\",\n async generateBundle(_opts, bundle) {\n for (const [, file] of Object.entries(bundle)) {\n if (\n file.type === \"asset\" ||\n !file.isEntry ||\n file.facadeModuleId == null\n ) {\n continue;\n }\n\n // Replace various JavaScript file extensions (e.g., .js, .cjs, .mjs, .cjs.js, .mjs.js) with .d.ts for generating type definition file names.\n const dtsFileName = file.fileName.replace(\n /(?:\\.cjs|\\.mjs|\\.esm\\.js|\\.cjs\\.js|\\.mjs\\.js|\\.js)$/,\n \".d.ts\"\n );\n\n const relativeSourceDtsName = JSON.stringify(\n `./${file.facadeModuleId.replace(/\\.[cm]?[jt]sx?$/, \"\")}`\n );\n\n this.emitFile({\n type: \"asset\",\n fileName: dtsFileName,\n source: file.exports.includes(\"default\")\n ? `export * from ${relativeSourceDtsName};\\nexport { default } from ${relativeSourceDtsName};\\n`\n : `export * from ${relativeSourceDtsName};\\n`\n });\n }\n }\n};\n\n/**\n * Resolves the options for [rollup](https://rollupjs.org).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(context: Context): RollupOptions {\n return {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n dtsBundlePlugin\n ].filter(Boolean) as Plugin[],\n cache: !context.config.skipCache ? undefined : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"silent\",\n output: [\n {\n dir: context.config.output.path,\n format: \"es\",\n entryFileNames: \"[name].js\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n },\n {\n dir: context.config.output.path,\n format: \"cjs\",\n entryFileNames: \"[name].cjs\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n }\n ]\n };\n}\n\n/**\n * Creates a Rollup plugin factory that generates a plugin instance.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n * import { createRollupFactory } from \"@powerlines/unplugin/rollup\";\n *\n * const powerlinesPlugin = createRollupFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rollup plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rollup build.\n */\nexport function createRollupFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rollup\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rollup: {\n async options(opts: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n opts,\n unplugin.context.callHook(\n \"rollup:options\",\n { environment },\n opts\n ) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rollup plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rollup\";\n *\n * export default defineConfig({\n * plugins: [powerlines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B;GAE3D,OAAOA,OACL,eAAe,YAAY,EAC3B,MACA,SAAS,QAAQ,SACf,kBACA,EAAE,aAAa,EACf,KACD,IAAI,EAAE,CACR;KAEJ;EACF,CAAC,CACH;;;;;;;;;;;;;;;;;;AAmBH,MAAa,SAAS,mBAAmB,qBAAqB,CAAC"}
1
+ {"version":3,"file":"rollup.mjs","names":["defu"],"sources":["../src/rollup.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport alias from \"@rollup/plugin-alias\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"node:fs\";\nimport type { InputOptions, RollupOptions } from \"rollup\";\nimport { Plugin } from \"rollup\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRollupPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.\n *\n * @remarks\n * This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.\n */\nexport const dtsBundlePlugin: Plugin = {\n name: \"powerlines:dts-bundle\",\n async generateBundle(_opts, bundle) {\n for (const [, file] of Object.entries(bundle)) {\n if (\n file.type === \"asset\" ||\n !file.isEntry ||\n file.facadeModuleId == null\n ) {\n continue;\n }\n\n // Replace various JavaScript file extensions (e.g., .js, .cjs, .mjs, .cjs.js, .mjs.js) with .d.ts for generating type definition file names.\n const dtsFileName = file.fileName.replace(\n /(?:\\.cjs|\\.mjs|\\.esm\\.js|\\.cjs\\.js|\\.mjs\\.js|\\.js)$/,\n \".d.ts\"\n );\n\n const relativeSourceDtsName = JSON.stringify(\n `./${file.facadeModuleId.replace(/\\.[cm]?[jt]sx?$/, \"\")}`\n );\n\n this.emitFile({\n type: \"asset\",\n fileName: dtsFileName,\n source: file.exports.includes(\"default\")\n ? `export * from ${relativeSourceDtsName};\\nexport { default } from ${relativeSourceDtsName};\\n`\n : `export * from ${relativeSourceDtsName};\\n`\n });\n }\n }\n};\n\n/**\n * Resolves the options for [rollup](https://rollupjs.org).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): RollupOptions {\n return {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n dtsBundlePlugin\n ].filter(Boolean) as Plugin[],\n cache: !context.config.skipCache ? undefined : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"silent\",\n output: [\n {\n dir: context.config.output.path,\n format: \"es\",\n entryFileNames: \"[name].js\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n },\n {\n dir: context.config.output.path,\n format: \"cjs\",\n entryFileNames: \"[name].cjs\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n }\n ]\n };\n}\n\n/**\n * Creates a Rollup plugin factory that generates a plugin instance.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n * import { createRollupFactory } from \"@powerlines/unplugin/rollup\";\n *\n * const powerlinesPlugin = createRollupFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rollup plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rollup build.\n */\nexport function createRollupFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rollup\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rollup: {\n async options(opts: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n opts,\n unplugin.context.callHook(\n \"rollup:options\",\n { environment },\n opts\n ) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rollup plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rollup\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nexport const plugin = createRollupPlugin(createRollupFactory());\n\nexport { plugin as default };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+CA,MAAa,kBAA0B;CACrC,MAAM;CACN,MAAM,eAAe,OAAO,QAAQ;AAClC,OAAK,MAAM,GAAG,SAAS,OAAO,QAAQ,OAAO,EAAE;AAC7C,OACE,KAAK,SAAS,WACd,CAAC,KAAK,WACN,KAAK,kBAAkB,KAEvB;GAIF,MAAM,cAAc,KAAK,SAAS,QAChC,uDACA,QACD;GAED,MAAM,wBAAwB,KAAK,UACjC,KAAK,KAAK,eAAe,QAAQ,mBAAmB,GAAG,GACxD;AAED,QAAK,SAAS;IACZ,MAAM;IACN,UAAU;IACV,QAAQ,KAAK,QAAQ,SAAS,UAAU,GACpC,iBAAiB,sBAAsB,6BAA6B,sBAAsB,OAC1F,iBAAiB,sBAAsB;IAC5C,CAAC;;;CAGP;;;;;;;AAQD,SAAgB,eACd,SACe;AACf,QAAO;EACL,OAAO,SACL,QAAQ,QAAQ,MAAM,CAAC,KAAI,UACzB,SAAS,MAAM,GAAG,QAAQ,MAAM,KACjC,CACF,CAAC,MAAM;EACR,WAAW,WAAmB;AAC5B,OACE,QAAQ,OAAO,QAAQ,YACvB,QAAQ,QAAQ,OAAO,QAAQ,SAAS,CAAC,SAAS,OAAO,CAEzD,QAAO;AAGT,OACE,QAAQ,OAAO,Q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OAAO;GAC3B,QAAQ;GACR,gBAAgB;GAChB,iBAAiB;GACjB,WAAW,QAAQ,OAAO,OAAO;GAClC,CACF;EACF;;;;;;;;;;;;;;;;;;;;;;;;AAyBH,SAAgB,oBACd,UAAmD,EAAE,EACrD,YAA+C,YAAW,SAC1D;AACA,QAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;EAAU,GAAE,aAC9D,SAAS;EACP,GAAI;EACJ,QAAQ,EACN,MAAM,QAAQ,MAAoB;GAChC,MAAM,cAAc,MAAM,SAAS,QAAQ,gBAAgB;AAE3D,UAAOA,OACL,eAAe,YAAY,EAC3B,MACA,SAAS,QAAQ,SACf,kBACA,EAAE,aAAa,EACf,KACD,IAAI,EAAE,CACR;KAEJ;EACF,CAAC,CACH;;;;;;;;;;;;;;;;;;AAmBH,MAAa,SAAS,mBAAmB,qBAAqB,CAAC"}
package/dist/rspack.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { UnpluginExecutionOptions, UnpluginFactory } from "./types.cjs";
2
2
  import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
3
3
  import * as _$_powerlines_core0 from "@powerlines/core";
4
- import { Context, ExecutionContext } from "@powerlines/core";
4
+ import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
5
5
  import * as _$unplugin from "unplugin";
6
6
  import { RspackOptionsNormalized } from "@rspack/core";
7
7
 
@@ -12,7 +12,7 @@ import { RspackOptionsNormalized } from "@rspack/core";
12
12
  * @param context - The build context.
13
13
  * @returns The resolved options.
14
14
  */
15
- declare function resolveOptions(context: Context): Partial<RspackOptionsNormalized>;
15
+ declare function resolveOptions<TContext extends UnresolvedContext>(context: TContext): Partial<RspackOptionsNormalized>;
16
16
  /**
17
17
  * Creates a Rspack plugin factory that generates a plugin instance.
18
18
  *
@@ -1 +1 @@
1
- {"version":3,"file":"rspack.d.cts","names":[],"sources":["../src/rspack.ts"],"mappings":";;;;;;;;;;;;;AAmCA;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,GACR,OAAA,CAAQ,uBAAA;;;;;;;;;;;;;AAoEX;;;;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,CAAA,CACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;;;;;;AAiCnE;cAAa,MAAA,GAAM,OAAA,GAA4C,wBAAA,iBAA5C,UAAA,CAAA,oBAAA"}
1
+ {"version":3,"file":"rspack.d.cts","names":[],"sources":["../src/rspack.ts"],"mappings":";;;;;;;;;;;;;AAuCA;iBAAgB,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,OAAA,CAAQ,uBAAA;;;;;;;;;;;;;;;;AAoEX;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,CAAA,CACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;;;;;;;cAiCtD,MAAA,GAAM,OAAA,GAA4C,wBAAA,iBAA5C,UAAA,CAAA,oBAAA"}
package/dist/rspack.d.mts CHANGED
@@ -2,7 +2,7 @@ import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
2
2
  import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
3
3
  import * as _$unplugin from "unplugin";
4
4
  import * as _$_powerlines_core0 from "@powerlines/core";
5
- import { Context, ExecutionContext } from "@powerlines/core";
5
+ import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
6
6
  import { RspackOptionsNormalized } from "@rspack/core";
7
7
 
8
8
  //#region src/rspack.d.ts
@@ -12,7 +12,7 @@ import { RspackOptionsNormalized } from "@rspack/core";
12
12
  * @param context - The build context.
13
13
  * @returns The resolved options.
14
14
  */
15
- declare function resolveOptions(context: Context): Partial<RspackOptionsNormalized>;
15
+ declare function resolveOptions<TContext extends UnresolvedContext>(context: TContext): Partial<RspackOptionsNormalized>;
16
16
  /**
17
17
  * Creates a Rspack plugin factory that generates a plugin instance.
18
18
  *
@@ -1 +1 @@
1
- {"version":3,"file":"rspack.d.mts","names":[],"sources":["../src/rspack.ts"],"mappings":";;;;;;;;;;;;;AAmCA;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,GACR,OAAA,CAAQ,uBAAA;;;;;;;;;;;;;AAoEX;;;;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,CAAA,CACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;;;;;;AAiCnE;cAAa,MAAA,GAAM,OAAA,GAA4C,wBAAA,iBAA5C,UAAA,CAAA,oBAAA"}
1
+ {"version":3,"file":"rspack.d.mts","names":[],"sources":["../src/rspack.ts"],"mappings":";;;;;;;;;;;;;AAuCA;iBAAgB,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,OAAA,CAAQ,uBAAA;;;;;;;;;;;;;;;;AAoEX;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,CAAA,CACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;;;;;;;cAiCtD,MAAA,GAAM,OAAA,GAA4C,wBAAA,iBAA5C,UAAA,CAAA,oBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"rspack.mjs","names":[],"sources":["../src/rspack.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 { Context, ExecutionContext, UnpluginOptions } from \"@powerlines/core\";\nimport { RspackOptionsNormalized } from \"@rspack/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { createRspackPlugin, RspackCompiler } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Resolves the options for [rspack](https://rspack.rs/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(\n context: Context\n): Partial<RspackOptionsNormalized> {\n return {\n output: {\n path: context.config.output.path\n },\n name: context.config.name,\n resolve: {\n alias: context.alias\n },\n external: context.config.resolve.external,\n noExternal: [\n ...(context.config.resolve.noExternal ?? []),\n ...(context.builtins ?? [])\n ],\n skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle,\n node:\n context.config.platform === \"node\"\n ? {\n __dirname: true,\n __filename: true,\n global: true\n }\n : false,\n mode:\n context.config.mode === \"development\"\n ? (\"development\" as const)\n : (\"production\" as const),\n recordsInputPath: joinPaths(\n context.cachePath,\n \"rspack\",\n \".rspack-records.json\"\n ),\n recordsOutputPath: joinPaths(\n context.cachePath,\n \"rspack\",\n \".rspack-records.json\"\n ),\n context: joinPaths(context.config.cwd, context.config.root),\n cache: context.config.mode === \"development\",\n devtool: context.config.output.sourceMap ? \"source-map\" : false,\n optimization: {\n minimize: context.config.output.minify\n }\n } as Partial<RspackOptionsNormalized>;\n}\n\n/**\n * Creates a Rspack plugin factory that generates a plugin instance.\n *\n * @see https://rspack.dev/concepts/plugins\n *\n * @example\n * ```ts\n * // rspack.config.ts\n * import { createRspackFactory } from \"@powerlines/unplugin/rspack\";\n *\n * const powerlinesPlugin = createRspackFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rspack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rspack build.\n */\nexport function createRspackFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rspack\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rspack(compiler: RspackCompiler) {\n compiler.hooks.beforeRun.tap(\"PowerlinesRspackPlugin\", compiler => {\n compiler.options = defu(\n resolveOptions(unplugin.context),\n compiler.options\n ) as RspackOptionsNormalized;\n });\n }\n })\n );\n}\n\n/**\n * An Rspack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rspack.dev/concepts/plugins\n *\n * @example\n * ```ts\n * // rspack.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rspack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const plugin = createRspackPlugin(createRspackFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AAmCA,SAAgB,eACd,SACkC;CAClC,OAAO;EACL,QAAQ,EACN,MAAM,QAAQ,OAAO,OAAO,MAC7B;EACD,MAAM,QAAQ,OAAO;EACrB,SAAS,EACP,OAAO,QAAQ,OAChB;EACD,UAAU,QAAQ,OAAO,QAAQ;EACjC,YAAY,CACV,GAAI,QAAQ,OAAO,QAAQ,cAAc,EAAE,EAC3C,GAAI,QAAQ,YAAY,EAAE,CAC3B;EACD,uBAAuB,QAAQ,OAAO,QAAQ;EAC9C,MACE,QAAQ,OAAO,aAAa,SACxB;GACE,WAAW;GACX,YAAY;GACZ,QAAQ;GACT,GACD;EACN,MACE,QAAQ,OAAO,SAAS,gBACnB,gBACA;EACP,kBAAkB,UAChB,QAAQ,WACR,UACA,uBACD;EACD,mBAAmB,UACjB,QAAQ,WACR,UACA,uBACD;EACD,SAAS,UAAU,QAAQ,OAAO,KAAK,QAAQ,OAAO,KAAK;EAC3D,OAAO,QAAQ,OAAO,SAAS;EAC/B,SAAS,QAAQ,OAAO,OAAO,YAAY,eAAe;EAC1D,cAAc,EACZ,UAAU,QAAQ,OAAO,OAAO,QACjC;EACF;;;;;;;;;;;;;;;;;;;;;;;;AAyBH,SAAgB,oBACd,UAAmD,EAAE,EACrD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;EAAU,GAAE,aAC9D,SAAS;EACP,GAAI;EACJ,OAAO,UAA0B;GAC/B,SAAS,MAAM,UAAU,IAAI,2BAA0B,aAAY;IACjE,SAAS,UAAU,KACjB,eAAe,SAAS,QAAQ,EAChC,SAAS,QACV;KACD;;EAEL,CAAC,CACH;;;;;;;;;;;;;;;;;;AAmBH,MAAa,SAAS,mBAAmB,qBAAqB,CAAC"}
1
+ {"version":3,"file":"rspack.mjs","names":[],"sources":["../src/rspack.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 {\n ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { RspackOptionsNormalized } from \"@rspack/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { createRspackPlugin, RspackCompiler } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Resolves the options for [rspack](https://rspack.rs/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): Partial<RspackOptionsNormalized> {\n return {\n output: {\n path: context.config.output.path\n },\n name: context.config.name,\n resolve: {\n alias: context.alias\n },\n external: context.config.resolve.external,\n noExternal: [\n ...(context.config.resolve.noExternal ?? []),\n ...(context.builtins ?? [])\n ],\n skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle,\n node:\n context.config.platform === \"node\"\n ? {\n __dirname: true,\n __filename: true,\n global: true\n }\n : false,\n mode:\n context.config.mode === \"development\"\n ? (\"development\" as const)\n : (\"production\" as const),\n recordsInputPath: joinPaths(\n context.cachePath,\n \"rspack\",\n \".rspack-records.json\"\n ),\n recordsOutputPath: joinPaths(\n context.cachePath,\n \"rspack\",\n \".rspack-records.json\"\n ),\n context: joinPaths(context.config.cwd, context.config.root),\n cache: context.config.mode === \"development\",\n devtool: context.config.output.sourceMap ? \"source-map\" : false,\n optimization: {\n minimize: context.config.output.minify\n }\n } as Partial<RspackOptionsNormalized>;\n}\n\n/**\n * Creates a Rspack plugin factory that generates a plugin instance.\n *\n * @see https://rspack.dev/concepts/plugins\n *\n * @example\n * ```ts\n * // rspack.config.ts\n * import { createRspackFactory } from \"@powerlines/unplugin/rspack\";\n *\n * const powerlinesPlugin = createRspackFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rspack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rspack build.\n */\nexport function createRspackFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rspack\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rspack(compiler: RspackCompiler) {\n compiler.hooks.beforeRun.tap(\"PowerlinesRspackPlugin\", compiler => {\n compiler.options = defu(\n resolveOptions(unplugin.context),\n compiler.options\n ) as RspackOptionsNormalized;\n });\n }\n })\n );\n}\n\n/**\n * An Rspack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rspack.dev/concepts/plugins\n *\n * @example\n * ```ts\n * // rspack.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rspack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const plugin = createRspackPlugin(createRspackFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AAuCA,SAAgB,eACd,SACkC;AAClC,QAAO;EACL,QAAQ,EACN,MAAM,QAAQ,OAAO,OAAO,MAC7B;EACD,MAAM,QAAQ,OAAO;EACrB,SAAS,EACP,OAAO,QAAQ,OAChB;EACD,UAAU,QAAQ,OAAO,QAAQ;EACjC,YAAY,CACV,GAAI,QAAQ,OAAO,QAAQ,cAAc,EAAE,EAC3C,GAAI,QAAQ,YAAY,EAAE,CAC3B;EACD,uBAAuB,QAAQ,OAAO,QAAQ;EAC9C,MACE,QAAQ,OAAO,aAAa,SACxB;GACE,WAAW;GACX,YAAY;GACZ,QAAQ;GACT,GACD;EACN,MACE,QAAQ,OAAO,SAAS,gBACnB,gBACA;EACP,kBAAkB,UAChB,QAAQ,WACR,UACA,uBACD;EACD,mBAAmB,UACjB,QAAQ,WACR,UACA,uBACD;EACD,SAAS,UAAU,QAAQ,OAAO,KAAK,QAAQ,OAAO,KAAK;EAC3D,OAAO,QAAQ,OAAO,SAAS;EAC/B,SAAS,QAAQ,OAAO,OAAO,YAAY,eAAe;EAC1D,cAAc,EACZ,UAAU,QAAQ,OAAO,OAAO,QACjC;EACF;;;;;;;;;;;;;;;;;;;;;;;;AAyBH,SAAgB,oBACd,UAAmD,EAAE,EACrD,YAA+C,YAAW,SAC1D;AACA,QAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;EAAU,GAAE,aAC9D,SAAS;EACP,GAAI;EACJ,OAAO,UAA0B;AAC/B,YAAS,MAAM,UAAU,IAAI,2BAA0B,aAAY;AACjE,aAAS,UAAU,KACjB,eAAe,SAAS,QAAQ,EAChC,SAAS,QACV;KACD;;EAEL,CAAC,CACH;;;;;;;;;;;;;;;;;;AAmBH,MAAa,SAAS,mBAAmB,qBAAqB,CAAC"}
package/dist/tsdown.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Context } from "@powerlines/core";
1
+ import { UnresolvedContext } from "@powerlines/core";
2
2
  import { GetDependencyConfigResult } from "@powerlines/core/plugin-utils";
3
3
  import { Format } from "@storm-software/build-tools/types";
4
4
  import { Format as Format$1, UserConfig as UserConfig$1 } from "tsdown";
@@ -11,7 +11,7 @@ import { UserConfig as UserConfig$2 } from "tsdown/config";
11
11
  * @param context - The build context.
12
12
  * @returns The dependency configuration.
13
13
  */
14
- declare function getDependencyConfig(context: Context): GetDependencyConfigResult;
14
+ declare function getDependencyConfig<TContext extends UnresolvedContext>(context: TContext): GetDependencyConfigResult;
15
15
  declare const DEFAULT_OPTIONS: Partial<UserConfig$1>;
16
16
  /**
17
17
  * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
@@ -33,7 +33,7 @@ declare function resolveFromFormat(formats?: Format$1 | Format$1[]): Format[];
33
33
  * @param context - The build context.
34
34
  * @returns The resolved options.
35
35
  */
36
- declare function resolveOptions(context: Context): UserConfig$1;
36
+ declare function resolveOptions<TContext extends UnresolvedContext>(context: TContext): UserConfig$1;
37
37
  /**
38
38
  * A Tsdown configuration function that integrates Powerlines into the build process.
39
39
  *
@@ -1 +1 @@
1
- {"version":3,"file":"tsdown.d.cts","names":[],"sources":["../src/tsdown.ts"],"mappings":";;;;;;;;;AA2CA;;;;iBAAgB,mBAAA,CACd,OAAA,EAAS,OAAA,GACR,yBAAA;AAAA,cAqBU,eAAA,EAAiB,OAAA,CAAQ,YAAA;;;;AAAtC;;;iBAcgB,aAAA,CAAc,OAAA,GAAU,MAAA,GAAS,MAAA,KAAW,QAAA;;AAA5D;;;;;iBAoBgB,iBAAA,CACd,OAAA,GAAU,QAAA,GAAe,QAAA,KACxB,MAAA;;;;;;;iBAkCa,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,YAAA;;AApClD;;;;;;;;;;;;;;AAoCA;;;;;;;;iBAoLgB,MAAA,CAAO,OAAA,GAAS,YAAA,GAAkB,YAAA"}
1
+ {"version":3,"file":"tsdown.d.cts","names":[],"sources":["../src/tsdown.ts"],"mappings":";;;;;;;;;AA+CA;;;;iBAAgB,mBAAA,kBAAqC,iBAAA,CAAA,CACnD,OAAA,EAAS,QAAA,GACR,yBAAA;AAAA,cAqBU,eAAA,EAAiB,OAAA,CAAQ,YAAA;;;;;;;iBActB,aAAA,CAAc,OAAA,GAAU,MAAA,GAAS,MAAA,KAAW,QAAA;;;AAd5D;;;;iBAkCgB,iBAAA,CACd,OAAA,GAAU,QAAA,GAAe,QAAA,KACxB,MAAA;AAtBH;;;;;;AAAA,iBA2DgB,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,YAAA;;;;;;;;AAzCH;;;;;;;;;;;;;;AAuCA;;iBAsLgB,MAAA,CAAO,OAAA,GAAS,YAAA,GAAkB,YAAA"}
package/dist/tsdown.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Context } from "@powerlines/core";
1
+ import { UnresolvedContext } from "@powerlines/core";
2
2
  import { GetDependencyConfigResult } from "@powerlines/core/plugin-utils";
3
3
  import { Format } from "@storm-software/build-tools/types";
4
4
  import { Format as Format$1, UserConfig as UserConfig$1 } from "tsdown";
@@ -11,7 +11,7 @@ import { UserConfig as UserConfig$2 } from "tsdown/config";
11
11
  * @param context - The build context.
12
12
  * @returns The dependency configuration.
13
13
  */
14
- declare function getDependencyConfig(context: Context): GetDependencyConfigResult;
14
+ declare function getDependencyConfig<TContext extends UnresolvedContext>(context: TContext): GetDependencyConfigResult;
15
15
  declare const DEFAULT_OPTIONS: Partial<UserConfig$1>;
16
16
  /**
17
17
  * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).
@@ -33,7 +33,7 @@ declare function resolveFromFormat(formats?: Format$1 | Format$1[]): Format[];
33
33
  * @param context - The build context.
34
34
  * @returns The resolved options.
35
35
  */
36
- declare function resolveOptions(context: Context): UserConfig$1;
36
+ declare function resolveOptions<TContext extends UnresolvedContext>(context: TContext): UserConfig$1;
37
37
  /**
38
38
  * A Tsdown configuration function that integrates Powerlines into the build process.
39
39
  *
@@ -1 +1 @@
1
- {"version":3,"file":"tsdown.d.mts","names":[],"sources":["../src/tsdown.ts"],"mappings":";;;;;;;;;AA2CA;;;;iBAAgB,mBAAA,CACd,OAAA,EAAS,OAAA,GACR,yBAAA;AAAA,cAqBU,eAAA,EAAiB,OAAA,CAAQ,YAAA;;;;AAAtC;;;iBAcgB,aAAA,CAAc,OAAA,GAAU,MAAA,GAAS,MAAA,KAAW,QAAA;;AAA5D;;;;;iBAoBgB,iBAAA,CACd,OAAA,GAAU,QAAA,GAAe,QAAA,KACxB,MAAA;;;;;;;iBAkCa,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,YAAA;;AApClD;;;;;;;;;;;;;;AAoCA;;;;;;;;iBAoLgB,MAAA,CAAO,OAAA,GAAS,YAAA,GAAkB,YAAA"}
1
+ {"version":3,"file":"tsdown.d.mts","names":[],"sources":["../src/tsdown.ts"],"mappings":";;;;;;;;;AA+CA;;;;iBAAgB,mBAAA,kBAAqC,iBAAA,CAAA,CACnD,OAAA,EAAS,QAAA,GACR,yBAAA;AAAA,cAqBU,eAAA,EAAiB,OAAA,CAAQ,YAAA;;;;;;;iBActB,aAAA,CAAc,OAAA,GAAU,MAAA,GAAS,MAAA,KAAW,QAAA;;;AAd5D;;;;iBAkCgB,iBAAA,CACd,OAAA,GAAU,QAAA,GAAe,QAAA,KACxB,MAAA;AAtBH;;;;;;AAAA,iBA2DgB,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,YAAA;;;;;;;;AAzCH;;;;;;;;;;;;;;AAuCA;;iBAsLgB,MAAA,CAAO,OAAA,GAAS,YAAA,GAAkB,YAAA"}