@powerlines/unplugin 0.0.33 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/astro.d.cts.map +1 -1
- package/dist/astro.d.mts.map +1 -1
- package/dist/astro.mjs.map +1 -1
- package/dist/esbuild.d.cts +2 -4
- package/dist/esbuild.d.cts.map +1 -1
- package/dist/esbuild.d.mts +2 -4
- package/dist/esbuild.d.mts.map +1 -1
- package/dist/esbuild.mjs.map +1 -1
- package/dist/farm.d.cts +2 -4
- package/dist/farm.d.cts.map +1 -1
- package/dist/farm.d.mts +2 -4
- package/dist/farm.d.mts.map +1 -1
- package/dist/farm.mjs.map +1 -1
- package/dist/index.d.cts +8 -16
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +8 -16
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/next.d.cts.map +1 -1
- package/dist/next.d.mts.map +1 -1
- package/dist/next.mjs.map +1 -1
- package/dist/nuxt.d.cts +1 -2
- package/dist/nuxt.d.cts.map +1 -1
- package/dist/nuxt.d.mts +1 -2
- package/dist/nuxt.d.mts.map +1 -1
- package/dist/nuxt.mjs.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/rolldown.d.cts +2 -4
- package/dist/rolldown.d.cts.map +1 -1
- package/dist/rolldown.d.mts +2 -4
- package/dist/rolldown.d.mts.map +1 -1
- package/dist/rolldown.mjs.map +1 -1
- package/dist/rollup.d.cts +1 -2
- package/dist/rollup.d.cts.map +1 -1
- package/dist/rollup.d.mts +1 -2
- package/dist/rollup.d.mts.map +1 -1
- package/dist/rollup.mjs.map +1 -1
- package/dist/rspack.d.cts +2 -4
- package/dist/rspack.d.cts.map +1 -1
- package/dist/rspack.d.mts +2 -4
- package/dist/rspack.d.mts.map +1 -1
- package/dist/rspack.mjs.map +1 -1
- package/dist/tsdown.d.cts.map +1 -1
- package/dist/tsdown.d.mts.map +1 -1
- package/dist/tsdown.mjs.map +1 -1
- package/dist/tsup.d.cts.map +1 -1
- package/dist/tsup.d.mts.map +1 -1
- package/dist/tsup.mjs.map +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/unloader.d.cts +2 -4
- package/dist/unloader.d.cts.map +1 -1
- package/dist/unloader.d.mts +2 -4
- package/dist/unloader.d.mts.map +1 -1
- package/dist/unloader.mjs.map +1 -1
- package/dist/unplugin.d.cts.map +1 -1
- package/dist/unplugin.d.mts.map +1 -1
- package/dist/unplugin.mjs.map +1 -1
- package/dist/vite.d.cts +2 -4
- package/dist/vite.d.cts.map +1 -1
- package/dist/vite.d.mts +2 -4
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs.map +1 -1
- package/dist/webpack.d.cts +2 -4
- package/dist/webpack.d.cts.map +1 -1
- package/dist/webpack.d.mts +2 -4
- package/dist/webpack.d.mts.map +1 -1
- package/dist/webpack.mjs.map +1 -1
- package/package.json +5 -5
package/dist/astro.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astro.d.cts","names":[],"sources":["../src/astro.ts"],"mappings":";;;;;AAyCA
|
|
1
|
+
{"version":3,"file":"astro.d.cts","names":[],"sources":["../src/astro.ts"],"mappings":";;;;;AAyCA;;;;;;;;AAAqE;;;;;;;;;;iBAArD,UAAA,CAAW,OAAA,EAAS,eAAA,GAAkB,eAAe"}
|
package/dist/astro.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astro.d.mts","names":[],"sources":["../src/astro.ts"],"mappings":";;;;;AAyCA
|
|
1
|
+
{"version":3,"file":"astro.d.mts","names":[],"sources":["../src/astro.ts"],"mappings":";;;;;AAyCA;;;;;;;;AAAqE;;;;;;;;;;iBAArD,UAAA,CAAW,OAAA,EAAS,eAAA,GAAkB,eAAe"}
|
package/dist/astro.mjs.map
CHANGED
|
@@ -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;
|
|
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,CAAC,GAAIA,OAAK,CAAC;EAGpD;CACF;AACF"}
|
package/dist/esbuild.d.cts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.cjs";
|
|
2
2
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
|
|
3
|
-
import * as _$_powerlines_core0 from "@powerlines/core";
|
|
4
3
|
import { ExecutionContext, ResolvedEntryTypeDefinition, UnresolvedContext } from "@powerlines/core";
|
|
5
4
|
import { DeepPartial } from "@stryke/types/base";
|
|
6
|
-
import * as _$esbuild from "esbuild";
|
|
7
5
|
import { BuildOptions } from "esbuild";
|
|
8
6
|
|
|
9
7
|
//#region src/esbuild.d.ts
|
|
@@ -46,7 +44,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
46
44
|
* @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.
|
|
47
45
|
* @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.
|
|
48
46
|
*/
|
|
49
|
-
declare function createEsbuildFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<
|
|
47
|
+
declare function createEsbuildFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
50
48
|
/**
|
|
51
49
|
* An ESBuild plugin that will invoke the Powerlines API hooks during the build process.
|
|
52
50
|
*
|
|
@@ -63,7 +61,7 @@ declare function createEsbuildFactory<TContext extends ExecutionContext>(options
|
|
|
63
61
|
*
|
|
64
62
|
* ```
|
|
65
63
|
*/
|
|
66
|
-
declare const plugin: (options?: UnpluginExecutionOptions | undefined) =>
|
|
64
|
+
declare const plugin: (options?: UnpluginExecutionOptions | undefined) => import("esbuild").Plugin;
|
|
67
65
|
//#endregion
|
|
68
66
|
export { DEFAULT_OPTIONS, createEsbuildFactory, plugin as default, resolveEntry, resolveOptions };
|
|
69
67
|
//# sourceMappingURL=esbuild.d.cts.map
|
package/dist/esbuild.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild.d.cts","names":[],"sources":["../src/esbuild.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"esbuild.d.cts","names":[],"sources":["../src/esbuild.ts"],"mappings":";;;;;;;cAyCa,eAAA,EAAiB,OAAO,CAAC,YAAA;;;AAAtC;;;;AAAkD;iBAqBlC,YAAA,kBAA8B,iBAAA,CAAA,CAC5C,OAAA,EAAS,QAAA,EACT,WAAA,GAAa,2BAAA,gBACZ,YAAA;;;;;;;;iBAuBa,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,EACT,QAAA,GAAU,WAAA,CAAY,YAAA,IACrB,YAAA;;;;;;;;;AA1BY;AAuBf;;;;;;;;;;;;;iBAgHgB,oBAAA,kBAAsC,gBAAA,CAAA,CACpD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;AA/GpD;AA6Gf;;;;;;;;;;cAqDM,MAAA,GAAM,OAAA,GAA8C,wBAA9C,mCAAA,MAAA"}
|
package/dist/esbuild.d.mts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
|
|
2
2
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
|
|
3
|
-
import * as _$_powerlines_core0 from "@powerlines/core";
|
|
4
3
|
import { ExecutionContext, ResolvedEntryTypeDefinition, UnresolvedContext } from "@powerlines/core";
|
|
5
4
|
import { DeepPartial } from "@stryke/types/base";
|
|
6
|
-
import * as _$esbuild from "esbuild";
|
|
7
5
|
import { BuildOptions } from "esbuild";
|
|
8
6
|
|
|
9
7
|
//#region src/esbuild.d.ts
|
|
@@ -46,7 +44,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
46
44
|
* @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.
|
|
47
45
|
* @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.
|
|
48
46
|
*/
|
|
49
|
-
declare function createEsbuildFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<
|
|
47
|
+
declare function createEsbuildFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
50
48
|
/**
|
|
51
49
|
* An ESBuild plugin that will invoke the Powerlines API hooks during the build process.
|
|
52
50
|
*
|
|
@@ -63,7 +61,7 @@ declare function createEsbuildFactory<TContext extends ExecutionContext>(options
|
|
|
63
61
|
*
|
|
64
62
|
* ```
|
|
65
63
|
*/
|
|
66
|
-
declare const plugin: (options?: UnpluginExecutionOptions | undefined) =>
|
|
64
|
+
declare const plugin: (options?: UnpluginExecutionOptions | undefined) => import("esbuild").Plugin;
|
|
67
65
|
//#endregion
|
|
68
66
|
export { DEFAULT_OPTIONS, createEsbuildFactory, plugin as default, resolveEntry, resolveOptions };
|
|
69
67
|
//# sourceMappingURL=esbuild.d.mts.map
|
package/dist/esbuild.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild.d.mts","names":[],"sources":["../src/esbuild.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"esbuild.d.mts","names":[],"sources":["../src/esbuild.ts"],"mappings":";;;;;;;cAyCa,eAAA,EAAiB,OAAO,CAAC,YAAA;;;AAAtC;;;;AAAkD;iBAqBlC,YAAA,kBAA8B,iBAAA,CAAA,CAC5C,OAAA,EAAS,QAAA,EACT,WAAA,GAAa,2BAAA,gBACZ,YAAA;;;;;;;;iBAuBa,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,EACT,QAAA,GAAU,WAAA,CAAY,YAAA,IACrB,YAAA;;;;;;;;;AA1BY;AAuBf;;;;;;;;;;;;;iBAgHgB,oBAAA,kBAAsC,gBAAA,CAAA,CACpD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;AA/GpD;AA6Gf;;;;;;;;;;cAqDM,MAAA,GAAM,OAAA,GAA8C,wBAA9C,mCAAA,MAAA"}
|
package/dist/esbuild.mjs.map
CHANGED
|
@@ -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 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,WAAs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QAAQ,OAAO,QAAQ;EACnC,YAAY,QAAQ,OAAO,QAAQ;EACnC,QAAQ,QAAQ,OAAO;EACvB,mBAAmB,QAAQ,OAAO,QAAQ;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"}
|
|
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;AACZ;;;;;;;;AASA,SAAgB,aACd,SACA,cAAwD,CAAC,GAC5B;CAC7B,OAAO,YAAY,QAChB,KAAK,UAAU;EACd,IAAI,SAAS,KAAK,GAChB,IAAI,iBAAiB,YAAY,OAAO,QAAQ,OAAO,IAAI,CAAC,KAC1D,YAAY,OAAO,QAAQ,OAAO,IAAI;OAExC,IAAI,MAAM,UAAU,mBAAmB,SAAS,KAAK,KAAK,MAAM;EAGlE,OAAO;CACT,GACA,CAAC,CACH;AACF;;;;;;;;AASA,SAAgB,eACd,SACA,WAAsC,CAAC,GACzB;CACd,IAAI,QAAQ,OAAO,UAAU,OAAO,KAAK,QAAQ,OAAO,MAAM,EAAE,SAAS,GACvE,QAAQ,GAAG,UACT,UACE,QAAQ,OAAO,KACf,QAAQ,OAAO,MACf,QAAQ,eACR,gBACF,GACA,OAAO,QAAQ,QAAQ,OAAO,MAAM,EACjC,KAAK,CAAC,KAAK,WAAW;EACrB,IAAI,OACF,IAAI,MAAM,QAAQ,KAAK,GACrB;OAAI,UAAU,GAAG,MAAM,KACrB;QAAI,MAAM,WAAW,GACnB,OAAO;SAChB,UAAU,GAAG,EAAE,SAAS,MAAM,GAAG;WAC/B,UAAU,GAAG,EAAE,OAAO,IAAI;SACd,IAAI,MAAM,SAAS,GACxB,OAAO;SAChB,MAAM,OAAO,MAAM,QA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;CACnC,GACA,eACF;AACF;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,qBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAU,IAAG,aAC/D,SAAS;EACP,GAAI;EACJ,SAAS;GACP,SAAQ,SAAQ;IACd,SAAS,CAAC;IAEV,MAAM,SAAS,eAAe,SAAS,OAAO;IAC9C,KAAK,MAAM,OAAO,QAChB,IACE,YAAY,KAAK,IAA0B,KAC3C,CAAC,YAAY,OAAO,IAA0B,GAE9C,KAAK,OAA6B,OAChC;GAIR;GACA,OAAO,OAAO,UAAuB;IACnC,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;IAE1D,OAAO,SAAS,QAAQ,SACtB,iBACA,EAAE,YAAY,GACd,KACF;GACF;EACF;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;;AAkBA,MAAM,SAAS,oBAAoB,qBAAqB,CAAC"}
|
package/dist/farm.d.cts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.cjs";
|
|
2
2
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
|
|
3
|
-
import * as _$_powerlines_core0 from "@powerlines/core";
|
|
4
3
|
import { ExecutionContext } from "@powerlines/core";
|
|
5
|
-
import * as _$_farmfe_core0 from "@farmfe/core";
|
|
6
4
|
|
|
7
5
|
//#region src/farm.d.ts
|
|
8
6
|
/**
|
|
@@ -27,7 +25,7 @@ import * as _$_farmfe_core0 from "@farmfe/core";
|
|
|
27
25
|
* @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.
|
|
28
26
|
* @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.
|
|
29
27
|
*/
|
|
30
|
-
declare function createFarmFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<
|
|
28
|
+
declare function createFarmFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
31
29
|
/**
|
|
32
30
|
* A Farm plugin that will invoke the Powerlines API hooks during the build process.
|
|
33
31
|
*
|
|
@@ -45,7 +43,7 @@ declare function createFarmFactory<TContext extends ExecutionContext>(options?:
|
|
|
45
43
|
*
|
|
46
44
|
* ```
|
|
47
45
|
*/
|
|
48
|
-
declare const farm: (options?: UnpluginExecutionOptions | undefined) =>
|
|
46
|
+
declare const farm: (options?: UnpluginExecutionOptions | undefined) => import("@farmfe/core").JsPlugin;
|
|
49
47
|
//#endregion
|
|
50
48
|
export { createFarmFactory, farm as default };
|
|
51
49
|
//# sourceMappingURL=farm.d.cts.map
|
package/dist/farm.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"farm.d.cts","names":[],"sources":["../src/farm.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"farm.d.cts","names":[],"sources":["../src/farm.ts"],"mappings":";;;;;;;;AAgDA;;;;;;;;;;;;;;;;;;;iBAAgB,iBAAA,kBAAmC,gBAAA,CAAA,CACjD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;AAAA;AAKlE;;;;;;;;AAmBiD;;;;cAA5C,IAAA,GAAI,OAAA,GAAwC,wBAAxC,wCAAA,QAAA"}
|
package/dist/farm.d.mts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
|
|
2
2
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
|
|
3
|
-
import * as _$_powerlines_core0 from "@powerlines/core";
|
|
4
3
|
import { ExecutionContext } from "@powerlines/core";
|
|
5
|
-
import * as _$_farmfe_core0 from "@farmfe/core";
|
|
6
4
|
|
|
7
5
|
//#region src/farm.d.ts
|
|
8
6
|
/**
|
|
@@ -27,7 +25,7 @@ import * as _$_farmfe_core0 from "@farmfe/core";
|
|
|
27
25
|
* @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.
|
|
28
26
|
* @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.
|
|
29
27
|
*/
|
|
30
|
-
declare function createFarmFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<
|
|
28
|
+
declare function createFarmFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
31
29
|
/**
|
|
32
30
|
* A Farm plugin that will invoke the Powerlines API hooks during the build process.
|
|
33
31
|
*
|
|
@@ -45,7 +43,7 @@ declare function createFarmFactory<TContext extends ExecutionContext>(options?:
|
|
|
45
43
|
*
|
|
46
44
|
* ```
|
|
47
45
|
*/
|
|
48
|
-
declare const farm: (options?: UnpluginExecutionOptions | undefined) =>
|
|
46
|
+
declare const farm: (options?: UnpluginExecutionOptions | undefined) => import("@farmfe/core").JsPlugin;
|
|
49
47
|
//#endregion
|
|
50
48
|
export { createFarmFactory, farm as default };
|
|
51
49
|
//# sourceMappingURL=farm.d.mts.map
|
package/dist/farm.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"farm.d.mts","names":[],"sources":["../src/farm.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"farm.d.mts","names":[],"sources":["../src/farm.ts"],"mappings":";;;;;;;;AAgDA;;;;;;;;;;;;;;;;;;;iBAAgB,iBAAA,kBAAmC,gBAAA,CAAA,CACjD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;AAAA;AAKlE;;;;;;;;AAmBiD;;;;cAA5C,IAAA,GAAI,OAAA,GAAwC,wBAAxC,wCAAA,QAAA"}
|
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,
|
|
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,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAO,IAAG,aAC5D,SAAS,QAAqC,CAChD;AACF;;;;;;;;;;;;;;;;;;AAmBA,MAAM,OAAO,iBAAiB,kBAAkB,CAAC"}
|
package/dist/index.d.cts
CHANGED
|
@@ -4,14 +4,6 @@ import { UnpluginFactoryDecorator, UnpluginFactoryOptions, createUnpluginFactory
|
|
|
4
4
|
import withPlugin$1 from "./next.cjs";
|
|
5
5
|
import plugin from "./tsdown.cjs";
|
|
6
6
|
import withPlugin$2 from "./tsup.cjs";
|
|
7
|
-
import * as _$_powerlines_core0 from "@powerlines/core";
|
|
8
|
-
import * as _$unplugin from "unplugin";
|
|
9
|
-
import * as _$_farmfe_core0 from "@farmfe/core";
|
|
10
|
-
import * as _$_nuxt_schema0 from "@nuxt/schema";
|
|
11
|
-
import * as _$rolldown from "rolldown";
|
|
12
|
-
import * as _$rollup from "rollup";
|
|
13
|
-
import * as _$unloader from "unloader";
|
|
14
|
-
import * as _$vite from "vite";
|
|
15
7
|
export * from "@powerlines/core/types/unplugin";
|
|
16
8
|
export * from "@powerlines/core/lib/unplugin";
|
|
17
9
|
|
|
@@ -21,17 +13,17 @@ declare namespace index_d_exports {
|
|
|
21
13
|
}
|
|
22
14
|
declare const plugins: {
|
|
23
15
|
astro: typeof withPlugin;
|
|
24
|
-
farm: (options?: UnpluginExecutionOptions | undefined) =>
|
|
16
|
+
farm: (options?: UnpluginExecutionOptions | undefined) => import("@farmfe/core").JsPlugin;
|
|
25
17
|
next: typeof withPlugin$1;
|
|
26
|
-
nuxt:
|
|
27
|
-
rolldown: (options?: UnpluginExecutionOptions | undefined) =>
|
|
28
|
-
rollup: (options?: UnpluginExecutionOptions | undefined) =>
|
|
29
|
-
rspack: (options?: UnpluginExecutionOptions | undefined) =>
|
|
18
|
+
nuxt: import("@nuxt/schema").NuxtModule<import("@powerlines/core").UserConfig, import("@powerlines/core").UserConfig, false>;
|
|
19
|
+
rolldown: (options?: UnpluginExecutionOptions | undefined) => import("rolldown").Plugin<any> | import("rolldown").Plugin<any>[];
|
|
20
|
+
rollup: (options?: UnpluginExecutionOptions | undefined) => import("rollup").Plugin<any> | import("rollup").Plugin<any>[];
|
|
21
|
+
rspack: (options?: UnpluginExecutionOptions | undefined) => import("unplugin").RspackPluginInstance;
|
|
30
22
|
tsdown: typeof plugin;
|
|
31
23
|
tsup: typeof withPlugin$2;
|
|
32
|
-
unloader: (options?: UnpluginExecutionOptions | undefined) =>
|
|
33
|
-
vite: (options?: UnpluginExecutionOptions | undefined) =>
|
|
24
|
+
unloader: (options?: UnpluginExecutionOptions | undefined) => import("unloader").Plugin | import("unloader").Plugin[];
|
|
25
|
+
vite: (options?: UnpluginExecutionOptions | undefined) => import("vite").Plugin<any> | import("vite").Plugin<any>[];
|
|
34
26
|
};
|
|
35
27
|
//#endregion
|
|
36
|
-
export { UnpluginExecutionOptions, UnpluginExecutionOptionsBase, UnpluginFactory, UnpluginFactoryDecorator, UnpluginFactoryOptions, createUnpluginFactory, plugins as default, plugins };
|
|
28
|
+
export { type UnpluginExecutionOptions, type UnpluginExecutionOptionsBase, type UnpluginFactory, UnpluginFactoryDecorator, UnpluginFactoryOptions, createUnpluginFactory, plugins as default, plugins };
|
|
37
29
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;cAiCa,OAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -4,14 +4,6 @@ import { UnpluginFactoryDecorator, UnpluginFactoryOptions, createUnpluginFactory
|
|
|
4
4
|
import withPlugin$1 from "./next.mjs";
|
|
5
5
|
import plugin from "./tsdown.mjs";
|
|
6
6
|
import withPlugin$2 from "./tsup.mjs";
|
|
7
|
-
import * as _$unplugin from "unplugin";
|
|
8
|
-
import * as _$_powerlines_core0 from "@powerlines/core";
|
|
9
|
-
import * as _$_farmfe_core0 from "@farmfe/core";
|
|
10
|
-
import * as _$_nuxt_schema0 from "@nuxt/schema";
|
|
11
|
-
import * as _$rolldown from "rolldown";
|
|
12
|
-
import * as _$rollup from "rollup";
|
|
13
|
-
import * as _$unloader from "unloader";
|
|
14
|
-
import * as _$vite from "vite";
|
|
15
7
|
export * from "@powerlines/core/lib/unplugin";
|
|
16
8
|
export * from "@powerlines/core/types/unplugin";
|
|
17
9
|
|
|
@@ -21,17 +13,17 @@ declare namespace index_d_exports {
|
|
|
21
13
|
}
|
|
22
14
|
declare const plugins: {
|
|
23
15
|
astro: typeof withPlugin;
|
|
24
|
-
farm: (options?: UnpluginExecutionOptions | undefined) =>
|
|
16
|
+
farm: (options?: UnpluginExecutionOptions | undefined) => import("@farmfe/core").JsPlugin;
|
|
25
17
|
next: typeof withPlugin$1;
|
|
26
|
-
nuxt:
|
|
27
|
-
rolldown: (options?: UnpluginExecutionOptions | undefined) =>
|
|
28
|
-
rollup: (options?: UnpluginExecutionOptions | undefined) =>
|
|
29
|
-
rspack: (options?: UnpluginExecutionOptions | undefined) =>
|
|
18
|
+
nuxt: import("@nuxt/schema").NuxtModule<import("@powerlines/core").UserConfig, import("@powerlines/core").UserConfig, false>;
|
|
19
|
+
rolldown: (options?: UnpluginExecutionOptions | undefined) => import("rolldown").Plugin<any> | import("rolldown").Plugin<any>[];
|
|
20
|
+
rollup: (options?: UnpluginExecutionOptions | undefined) => import("rollup").Plugin<any> | import("rollup").Plugin<any>[];
|
|
21
|
+
rspack: (options?: UnpluginExecutionOptions | undefined) => import("unplugin").RspackPluginInstance;
|
|
30
22
|
tsdown: typeof plugin;
|
|
31
23
|
tsup: typeof withPlugin$2;
|
|
32
|
-
unloader: (options?: UnpluginExecutionOptions | undefined) =>
|
|
33
|
-
vite: (options?: UnpluginExecutionOptions | undefined) =>
|
|
24
|
+
unloader: (options?: UnpluginExecutionOptions | undefined) => import("unloader").Plugin | import("unloader").Plugin[];
|
|
25
|
+
vite: (options?: UnpluginExecutionOptions | undefined) => import("vite").Plugin<any> | import("vite").Plugin<any>[];
|
|
34
26
|
};
|
|
35
27
|
//#endregion
|
|
36
|
-
export { UnpluginExecutionOptions, UnpluginExecutionOptionsBase, UnpluginFactory, UnpluginFactoryDecorator, UnpluginFactoryOptions, createUnpluginFactory, plugins as default, plugins };
|
|
28
|
+
export { type UnpluginExecutionOptions, type UnpluginExecutionOptionsBase, type UnpluginFactory, UnpluginFactoryDecorator, UnpluginFactoryOptions, createUnpluginFactory, plugins as default, plugins };
|
|
37
29
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;cAiCa,OAAA"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 astro from \"./astro\";\nimport farm from \"./farm\";\nimport next from \"./next\";\nimport nuxt from \"./nuxt\";\nimport rolldown from \"./rolldown\";\nimport rollup from \"./rollup\";\nimport rspack from \"./rspack\";\nimport tsdown from \"./tsdown\";\nimport tsup from \"./tsup\";\nimport unloader from \"./unloader\";\nimport vite from \"./vite\";\n\nexport type * from \"./types\";\nexport * from \"./unplugin\";\n\nexport const plugins = {\n astro,\n farm,\n next,\n nuxt,\n rolldown,\n rollup,\n rspack,\n tsdown,\n tsup,\n unloader,\n vite\n};\n\nexport default plugins;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,UAAU;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 astro from \"./astro\";\nimport farm from \"./farm\";\nimport next from \"./next\";\nimport nuxt from \"./nuxt\";\nimport rolldown from \"./rolldown\";\nimport rollup from \"./rollup\";\nimport rspack from \"./rspack\";\nimport tsdown from \"./tsdown\";\nimport tsup from \"./tsup\";\nimport unloader from \"./unloader\";\nimport vite from \"./vite\";\n\nexport type * from \"./types\";\nexport * from \"./unplugin\";\n\nexport const plugins = {\n astro,\n farm,\n next,\n nuxt,\n rolldown,\n rollup,\n rspack,\n tsdown,\n tsup,\n unloader,\n vite\n};\n\nexport default plugins;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,UAAU;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
package/dist/next.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.cts","names":[],"sources":["../src/next.ts"],"mappings":";;;;;AAyCA
|
|
1
|
+
{"version":3,"file":"next.d.cts","names":[],"sources":["../src/next.ts"],"mappings":";;;;;AAyCA;;;;;;;;AAA2D;;;;;;;;iBAA3C,UAAA,CAAW,OAAA,EAAS,UAAA,GAAa,UAAU"}
|
package/dist/next.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.mts","names":[],"sources":["../src/next.ts"],"mappings":";;;;;AAyCA
|
|
1
|
+
{"version":3,"file":"next.d.mts","names":[],"sources":["../src/next.ts"],"mappings":";;;;;AAyCA;;;;;;;;AAA2D;;;;;;;;iBAA3C,UAAA,CAAW,OAAA,EAAS,UAAA,GAAa,UAAU"}
|
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;
|
|
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,OAAO,KAC/C;GAEF,OAAO,YAAY,CAAC;GACpB,OAAO,QAAQ,KAAKA,OAAQ,CAAC;GAE7B,OAAO;EACT;CACF;AACF"}
|
package/dist/nuxt.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { UserConfig } from "@powerlines/core";
|
|
2
|
-
import * as _$_nuxt_schema0 from "@nuxt/schema";
|
|
3
2
|
|
|
4
3
|
//#region src/nuxt.d.ts
|
|
5
4
|
/**
|
|
@@ -23,6 +22,6 @@ import * as _$_nuxt_schema0 from "@nuxt/schema";
|
|
|
23
22
|
*
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
|
-
declare const plugin:
|
|
25
|
+
declare const plugin: import("@nuxt/schema").NuxtModule<UserConfig, UserConfig, false>;
|
|
27
26
|
export = plugin;
|
|
28
27
|
//# sourceMappingURL=nuxt.d.cts.map
|
package/dist/nuxt.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.d.cts","names":[],"sources":["../src/nuxt.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"nuxt.d.cts","names":[],"sources":["../src/nuxt.ts"],"mappings":";;;;;AAmBmD;;;;;;;;AA0BvC;;;;;;;;;;;cAAN,MAAA,yBAAM,UAAA,CAAA,UAAA,EAAA,UAAA;AAAA"}
|
package/dist/nuxt.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { UserConfig } from "@powerlines/core";
|
|
2
|
-
import * as _$_nuxt_schema0 from "@nuxt/schema";
|
|
3
2
|
|
|
4
3
|
//#region src/nuxt.d.ts
|
|
5
4
|
/**
|
|
@@ -23,7 +22,7 @@ import * as _$_nuxt_schema0 from "@nuxt/schema";
|
|
|
23
22
|
*
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
|
-
declare const plugin:
|
|
25
|
+
declare const plugin: import("@nuxt/schema").NuxtModule<UserConfig, UserConfig, false>;
|
|
27
26
|
//#endregion
|
|
28
27
|
export { plugin as default };
|
|
29
28
|
//# sourceMappingURL=nuxt.d.mts.map
|
package/dist/nuxt.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.d.mts","names":[],"sources":["../src/nuxt.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"nuxt.d.mts","names":[],"sources":["../src/nuxt.ts"],"mappings":";;;;;AAmBmD;;;;;;;;AA0BvC;;;;;;;;;;;cAAN,MAAA,yBAAM,UAAA,CAAA,UAAA,EAAA,UAAA"}
|
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,
|
|
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,SACR,EACF;CACF;CACA,UAAU,CAAC;CACX,MAAM,SAAS;EACb,oBAAoBA,SAAK,OAAO,CAAC;EACjC,uBAAuBC,SAAQ,OAAO,CAAC;CACzC;AACF,CAAC"}
|
package/dist/package.cjs
CHANGED
package/dist/package.mjs
CHANGED
package/dist/rolldown.d.cts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.cjs";
|
|
2
2
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
|
|
3
|
-
import * as _$_powerlines_core0 from "@powerlines/core";
|
|
4
3
|
import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
|
|
5
|
-
import * as _$rolldown from "rolldown";
|
|
6
4
|
import { RolldownOptions } from "rolldown";
|
|
7
5
|
|
|
8
6
|
//#region src/rolldown.d.ts
|
|
@@ -43,7 +41,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
43
41
|
* @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.
|
|
44
42
|
* @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.
|
|
45
43
|
*/
|
|
46
|
-
declare function createRolldownFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<
|
|
44
|
+
declare function createRolldownFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
47
45
|
/**
|
|
48
46
|
* A Rolldown plugin that will invoke the Powerlines API hooks during the build process.
|
|
49
47
|
*
|
|
@@ -59,7 +57,7 @@ declare function createRolldownFactory<TContext extends ExecutionContext>(option
|
|
|
59
57
|
* })
|
|
60
58
|
* ```
|
|
61
59
|
*/
|
|
62
|
-
declare const plugin: (options?: UnpluginExecutionOptions | undefined) =>
|
|
60
|
+
declare const plugin: (options?: UnpluginExecutionOptions | undefined) => import("rolldown").Plugin<any> | import("rolldown").Plugin<any>[];
|
|
63
61
|
//#endregion
|
|
64
62
|
export { DEFAULT_OPTIONS, createRolldownFactory, plugin as default, resolveOptions };
|
|
65
63
|
//# sourceMappingURL=rolldown.d.cts.map
|
package/dist/rolldown.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rolldown.d.cts","names":[],"sources":["../src/rolldown.ts"],"mappings":"
|
|
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;;;;;;;;;;;;;;AAAe;AAuJlB;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,CAAA,CACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;;;;;;;;;;;cAuC7D,MAAA,GAAM,OAAA,GAAgD,wBAAhD,oCAAA,MAAA,2BAAA,MAAA"}
|
package/dist/rolldown.d.mts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
|
|
2
2
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
|
|
3
|
-
import * as _$_powerlines_core0 from "@powerlines/core";
|
|
4
3
|
import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
|
|
5
|
-
import * as _$rolldown from "rolldown";
|
|
6
4
|
import { RolldownOptions } from "rolldown";
|
|
7
5
|
|
|
8
6
|
//#region src/rolldown.d.ts
|
|
@@ -43,7 +41,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
43
41
|
* @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.
|
|
44
42
|
* @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.
|
|
45
43
|
*/
|
|
46
|
-
declare function createRolldownFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<
|
|
44
|
+
declare function createRolldownFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
47
45
|
/**
|
|
48
46
|
* A Rolldown plugin that will invoke the Powerlines API hooks during the build process.
|
|
49
47
|
*
|
|
@@ -59,7 +57,7 @@ declare function createRolldownFactory<TContext extends ExecutionContext>(option
|
|
|
59
57
|
* })
|
|
60
58
|
* ```
|
|
61
59
|
*/
|
|
62
|
-
declare const plugin: (options?: UnpluginExecutionOptions | undefined) =>
|
|
60
|
+
declare const plugin: (options?: UnpluginExecutionOptions | undefined) => import("rolldown").Plugin<any> | import("rolldown").Plugin<any>[];
|
|
63
61
|
//#endregion
|
|
64
62
|
export { DEFAULT_OPTIONS, createRolldownFactory, plugin as default, resolveOptions };
|
|
65
63
|
//# sourceMappingURL=rolldown.d.mts.map
|
package/dist/rolldown.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rolldown.d.mts","names":[],"sources":["../src/rolldown.ts"],"mappings":"
|
|
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;;;;;;;;;;;;;;AAAe;AAuJlB;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,CAAA,CACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;;;;;;;;;;;cAuC7D,MAAA,GAAM,OAAA,GAAgD,wBAAhD,oCAAA,MAAA,2BAAA,MAAA"}
|
package/dist/rolldown.mjs.map
CHANGED
|
@@ -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 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,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AO,YACnB,UAAU,QAAQ,WAAW,WAAW,GACxC;EACJ,UACE,QAAQ,OAAO,SAAS,YAAY,UAChC,UACA,QAAQ,OAAO,SAAS,YAAY,UAClC,SACA;EACR,MAAM,OAAkC,KAAgB;AACtD,OAAI,IAAI,SAAS,MAAM,CACrB,KAAI,UAAU,OACZ,SAAQ,OAAO,MAAM,IAAI,SAAS,MAAM,IAAI,GAAG;OAE/C,SAAQ,OAAO,IAAI,OAAO,IAAI,SAAS,MAAM,IAAI,GAAG;;EAI1D,QAAQ,QAAQ,OAAO,OAAO;EAC9B,QAAQ,CACN;GACE,KAAK,QAAQ,OAAO,OAAO;GAC3B,QAAQ;GACR,iBAAiB;GACjB,WAAW,QAAQ,OAAO,OAAO;GAClC,EACD;GACE,KAAK,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"}
|
|
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,M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