@powerlines/unplugin 0.0.70 → 0.0.73
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/_virtual/_rolldown/runtime.cjs +8 -0
- package/dist/_virtual/_rolldown/runtime.mjs +8 -0
- package/dist/astro.cjs +8 -0
- package/dist/astro.d.mts +2 -0
- package/dist/astro.d.mts.map +1 -1
- package/dist/astro.mjs +8 -0
- package/dist/astro.mjs.map +1 -1
- package/dist/esbuild.cjs +8 -0
- package/dist/esbuild.d.mts +2 -0
- package/dist/esbuild.d.mts.map +1 -1
- package/dist/esbuild.mjs +8 -0
- package/dist/esbuild.mjs.map +1 -1
- package/dist/farm.cjs +8 -0
- package/dist/farm.d.mts +2 -0
- package/dist/farm.d.mts.map +1 -1
- package/dist/farm.mjs +8 -0
- package/dist/farm.mjs.map +1 -1
- package/dist/index.cjs +8 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -1
- package/dist/next.cjs +8 -0
- package/dist/next.d.mts +2 -0
- package/dist/next.d.mts.map +1 -1
- package/dist/next.mjs +8 -0
- package/dist/next.mjs.map +1 -1
- package/dist/nuxt.cjs +8 -0
- package/dist/nuxt.d.mts +2 -0
- package/dist/nuxt.d.mts.map +1 -1
- package/dist/nuxt.mjs +8 -0
- package/dist/nuxt.mjs.map +1 -1
- package/dist/package.cjs +9 -1
- package/dist/package.mjs +9 -1
- package/dist/rolldown.cjs +8 -0
- package/dist/rolldown.d.mts +2 -0
- package/dist/rolldown.d.mts.map +1 -1
- package/dist/rolldown.mjs +8 -0
- package/dist/rolldown.mjs.map +1 -1
- package/dist/rollup.cjs +8 -0
- package/dist/rollup.d.mts +2 -0
- package/dist/rollup.d.mts.map +1 -1
- package/dist/rollup.mjs +8 -0
- package/dist/rollup.mjs.map +1 -1
- package/dist/rspack.cjs +8 -0
- package/dist/rspack.d.mts +2 -0
- package/dist/rspack.d.mts.map +1 -1
- package/dist/rspack.mjs +8 -0
- package/dist/rspack.mjs.map +1 -1
- package/dist/tsdown.cjs +8 -0
- package/dist/tsdown.d.mts +2 -0
- package/dist/tsdown.d.mts.map +1 -1
- package/dist/tsdown.mjs +8 -0
- package/dist/tsdown.mjs.map +1 -1
- package/dist/tsup.cjs +8 -0
- package/dist/tsup.d.mts +2 -0
- package/dist/tsup.d.mts.map +1 -1
- package/dist/tsup.mjs +8 -0
- package/dist/tsup.mjs.map +1 -1
- package/dist/types.cjs +8 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +8 -0
- package/dist/unloader.cjs +8 -0
- package/dist/unloader.d.mts +2 -0
- package/dist/unloader.d.mts.map +1 -1
- package/dist/unloader.mjs +8 -0
- package/dist/unloader.mjs.map +1 -1
- package/dist/unplugin.cjs +8 -0
- package/dist/unplugin.d.mts +2 -0
- package/dist/unplugin.d.mts.map +1 -1
- package/dist/unplugin.mjs +8 -0
- package/dist/unplugin.mjs.map +1 -1
- package/dist/vite.cjs +8 -0
- package/dist/vite.d.mts +2 -0
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +8 -0
- package/dist/vite.mjs.map +1 -1
- package/dist/webpack.cjs +8 -0
- package/dist/webpack.d.mts +2 -0
- package/dist/webpack.d.mts.map +1 -1
- package/dist/webpack.mjs +8 -0
- package/dist/webpack.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
//#region \0rolldown/runtime.js
|
|
2
10
|
var __create = Object.create;
|
|
3
11
|
var __defProp = Object.defineProperty;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
//#region \0rolldown/runtime.js
|
|
2
10
|
var __defProp = Object.defineProperty;
|
|
3
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/dist/astro.cjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
10
|
const require_vite = require('./vite.cjs');
|
|
3
11
|
|
package/dist/astro.d.mts
CHANGED
package/dist/astro.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astro.d.mts","names":[],"sources":["../src/astro.ts"],"mappings":"
|
|
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
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import plugin from "./vite.mjs";
|
|
2
10
|
|
|
3
11
|
//#region src/astro.ts
|
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":"
|
|
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.cjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
10
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
11
|
const require_unplugin = require('./unplugin.cjs');
|
package/dist/esbuild.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
|
|
2
4
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
|
|
3
5
|
import { ExecutionContext, ResolvedEntryFileReference, UnresolvedContext } from "@powerlines/core";
|
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;;;;;;;;iBAqBtB,YAAA,kBAA8B,iBAAA,CAAA,CAC5C,OAAA,EAAS,QAAA,EACT,WAAA,GAAa,0BAAA,gBACZ,YAAA;;;AAxBH;;;;AAAkD;iBA+ClC,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
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
2
10
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
3
11
|
import defu from "defu";
|
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 ResolvedEntryFileReference,\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: ResolvedEntryFileReference[] | 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 * 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ACP,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"}
|
|
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 ResolvedEntryFileReference,\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: ResolvedEntryFileReference[] | 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,cAAuD,CAAC,GAC3B;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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ist/farm.cjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
10
|
const require_unplugin = require('./unplugin.cjs');
|
|
3
11
|
let unplugin = require("unplugin");
|
package/dist/farm.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
|
|
2
4
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
|
|
3
5
|
import { ExecutionContext } from "@powerlines/core";
|
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;;;;cAmBK,IAAA,GAAI,OAAA,GAAwC,wBAAxC,wCAAA,QAAA"}
|
package/dist/farm.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
2
10
|
import { createFarmPlugin } from "unplugin";
|
|
3
11
|
|
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":"
|
|
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.cjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
10
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
11
|
const require_unplugin = require('./unplugin.cjs');
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import withPlugin from "./astro.mjs";
|
|
2
4
|
import { UnpluginExecutionOptions, UnpluginExecutionOptionsBase, UnpluginFactory } from "./types.mjs";
|
|
3
5
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions, createUnpluginFactory } from "./unplugin.mjs";
|
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":";;;;;;;;;;;;;;;cAkCa,OAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { __exportAll, __reExport } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
10
|
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
3
11
|
import plugin from "./esbuild.mjs";
|
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 esbuild from \"./esbuild\";\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 esbuild,\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":"
|
|
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 esbuild from \"./esbuild\";\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 esbuild,\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,UAAU;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
package/dist/next.cjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
10
|
const require_webpack = require('./webpack.cjs');
|
|
3
11
|
|
package/dist/next.d.mts
CHANGED
package/dist/next.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.mts","names":[],"sources":["../src/next.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"next.d.mts","names":[],"sources":["../src/next.ts"],"mappings":";;;;;;;;;;;;;;;AAyCA;;;;;;;;iBAAgB,UAAA,CAAW,OAAA,EAAS,UAAA,GAAa,UAAU"}
|
package/dist/next.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import plugin from "./webpack.mjs";
|
|
2
10
|
|
|
3
11
|
//#region src/next.ts
|
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":"
|
|
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.cjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
const require_vite = require('./vite.cjs');
|
|
2
10
|
const require_webpack = require('./webpack.cjs');
|
|
3
11
|
const require_package = require('./package.cjs');
|
package/dist/nuxt.d.mts
CHANGED
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
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import plugin$1 from "./vite.mjs";
|
|
2
10
|
import plugin$2 from "./webpack.mjs";
|
|
3
11
|
import { name, version } from "./package.mjs";
|
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":"
|
|
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
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
9
|
+
|
|
2
10
|
//#region package.json
|
|
3
11
|
var name = "@powerlines/unplugin";
|
|
4
|
-
var version = "0.0.
|
|
12
|
+
var version = "0.0.72";
|
|
5
13
|
|
|
6
14
|
//#endregion
|
|
7
15
|
Object.defineProperty(exports, 'name', {
|
package/dist/package.mjs
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
//#region package.json
|
|
2
10
|
var name = "@powerlines/unplugin";
|
|
3
|
-
var version = "0.0.
|
|
11
|
+
var version = "0.0.72";
|
|
4
12
|
|
|
5
13
|
//#endregion
|
|
6
14
|
export { name, version };
|
package/dist/rolldown.cjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
10
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
11
|
const require_unplugin = require('./unplugin.cjs');
|
package/dist/rolldown.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
|
|
2
4
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
|
|
3
5
|
import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
|
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":";;;;;;;;cA6Ca,eAAA;;;;;;;;;;AAAb;;;;iBAegB,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,eAAA;;;;;;;AAFH;;;;;;;;;;;;;;AAEkB;AA4PlB;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,wBAAA,iBAAhD,MAAA,QAAA,MAAA"}
|
package/dist/rolldown.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
2
10
|
import { builtinModules } from "node:module";
|
|
3
11
|
import { appendPath } from "@stryke/path/append";
|
package/dist/rolldown.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rolldown.mjs","names":["defu","alias","dtsBundlePlugin"],"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 { builtinModules } from \"node:module\";\nimport type { InputOptions, Plugin } from \"rolldown\";\nimport { RolldownOptions, RollupLog } from \"rolldown\";\nimport { dts as dtsBundlePlugin } from \"rolldown-plugin-dts\";\nimport { viteAliasPlugin as alias } from \"rolldown/experimental\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRolldownPlugin } from \"unplugin\";\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 context.config.output.dts &&\n toArray(context.config.output.format).includes(\"esm\")\n ? dtsBundlePlugin({\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n )\n })\n : undefined,\n context.config.output.dts &&\n toArray(context.config.output.format).includes(\"cjs\")\n ? dtsBundlePlugin({\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n emitDtsOnly: true,\n cjsDefault: true\n })\n : undefined,\n {\n name: `powerlines:node-protocol`,\n resolveId: {\n order: \"pre\",\n filter: {\n id:\n context.config.output.nodeProtocol === \"strip\"\n ? new RegExp(\n `^node:(${builtinModules\n .filter(mod => !mod.startsWith(\"node:\"))\n .join(\"|\")})$`\n )\n : new RegExp(\n `^(${builtinModules\n .filter(mod => !mod.startsWith(\"node:\"))\n .join(\"|\")})$`\n )\n },\n handler:\n context.config.output.nodeProtocol === \"strip\"\n ? async (id: string, ...args: any[]) => {\n const resolved = await context.resolve(\n id.slice(5),\n ...args\n );\n if (resolved && !resolved.external) {\n return resolved;\n }\n\n return {\n id: id.slice(5), // \"node:\".length\n external: true,\n moduleSideEffects: false\n };\n }\n : id => {\n return {\n id: `node:${id}`,\n external: true,\n moduleSideEffects: false\n };\n }\n }\n } as Plugin\n ].filter(Boolean) as Plugin[],\n resolve: {\n alias: context.alias,\n mainFields: context.config.resolve.mainFields,\n define: context.config.define,\n extensions: context.config.resolve.extensions\n },\n transform: {\n target: context.tsconfig.tsconfigJson?.compilerOptions?.target,\n define: context.config.define,\n inject: context.config.inject\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 (\n context.config.logLevel.general !== \"trace\" &&\n level === \"warn\" &&\n log.code === \"PLUGIN_TIMINGS\"\n ) {\n return;\n }\n\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 output: [\n toArray(context.config.output.format).includes(\"esm\")\n ? {\n dir: context.config.output.path,\n format: \"es\",\n sourcemap: context.config.output.sourceMap,\n codeSplitting: true,\n exports: \"named\",\n minify: context.config.output.minify\n ? {\n compress: {\n dropDebugger:\n context.config.mode === \"production\" ? true : undefined,\n unused:\n context.config.mode === \"production\" ? true : undefined,\n treeshake: true\n },\n mangle: true\n }\n : context.config.mode === \"production\"\n ? \"dce-only\"\n : undefined\n }\n : undefined,\n toArray(context.config.output.format).includes(\"cjs\")\n ? {\n dir: context.config.output.path,\n format: \"cjs\",\n sourcemap: context.config.output.sourceMap,\n codeSplitting: true,\n exports: \"auto\",\n minify: context.config.output.minify\n ? {\n compress: {\n dropDebugger:\n context.config.mode === \"production\" ? true : undefined,\n unused:\n context.config.mode === \"production\" ? true : undefined,\n treeshake: true\n },\n mangle: true\n }\n : context.config.mode === \"production\"\n ? \"dce-only\"\n : undefined\n }\n : undefined\n ].filter(Boolean) as RolldownOptions[\"output\"]\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":";;;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkB;CAC7B,WAAW;CACX,WAAW;CACX,oBAAoB;CACpB,WAAW,EACT,QAAQ,SACV;AACF;;;;;;;AAQA,SAAgB,eACd,SACiB;CACjB,OAAOA,OACL;EACE,OAAO,SACL,QAAQ,QAAQ,KAAK,EAAE,KAAI,UACzB,SAAS,KAAK,IAAI,QAAQ,MAAM,IAClC,CACF,EAAE,KAAK;EACP,WAAW,WAAmB;GAC5B,IACE,QAAQ,OAAO,QAAQ,YACvB,QAAQ,QAAQ,OAAO,QAAQ,QAAQ,EAAE,SAAS,MAAM,GAExD,OAAO;GAGT,IACE,QAAQ,OAAO,QAAQ,cACvB,QAAQ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e;GAE1D,OAAOF,OACL,eAAe,WAAW,GAC1B,SACC,MAAM,SAAS,QAAQ,SACtB,oBACA,EAAE,YAAY,GACd,OACF,KAAM,CAAC,CACT;EACF,EACF;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;AAiBA,MAAM,SAAS,qBAAqB,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"rolldown.mjs","names":["defu","alias","dtsBundlePlugin"],"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 { builtinModules } from \"node:module\";\nimport type { InputOptions, Plugin } from \"rolldown\";\nimport { RolldownOptions, RollupLog } from \"rolldown\";\nimport { dts as dtsBundlePlugin } from \"rolldown-plugin-dts\";\nimport { viteAliasPlugin as alias } from \"rolldown/experimental\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRolldownPlugin } from \"unplugin\";\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 context.config.output.dts &&\n toArray(context.config.output.format).includes(\"esm\")\n ? dtsBundlePlugin({\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n )\n })\n : undefined,\n context.config.output.dts &&\n toArray(context.config.output.format).includes(\"cjs\")\n ? dtsBundlePlugin({\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n emitDtsOnly: true,\n cjsDefault: true\n })\n : undefined,\n {\n name: `powerlines:node-protocol`,\n resolveId: {\n order: \"pre\",\n filter: {\n id:\n context.config.output.nodeProtocol === \"strip\"\n ? new RegExp(\n `^node:(${builtinModules\n .filter(mod => !mod.startsWith(\"node:\"))\n .join(\"|\")})$`\n )\n : new RegExp(\n `^(${builtinModules\n .filter(mod => !mod.startsWith(\"node:\"))\n .join(\"|\")})$`\n )\n },\n handler:\n context.config.output.nodeProtocol === \"strip\"\n ? async (id: string, ...args: any[]) => {\n const resolved = await context.resolve(\n id.slice(5),\n ...args\n );\n if (resolved && !resolved.external) {\n return resolved;\n }\n\n return {\n id: id.slice(5), // \"node:\".length\n external: true,\n moduleSideEffects: false\n };\n }\n : id => {\n return {\n id: `node:${id}`,\n external: true,\n moduleSideEffects: false\n };\n }\n }\n } as Plugin\n ].filter(Boolean) as Plugin[],\n resolve: {\n alias: context.alias,\n mainFields: context.config.resolve.mainFields,\n define: context.config.define,\n extensions: context.config.resolve.extensions\n },\n transform: {\n target: context.tsconfig.tsconfigJson?.compilerOptions?.target,\n define: context.config.define,\n inject: context.config.inject\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 (\n context.config.logLevel.general !== \"trace\" &&\n level === \"warn\" &&\n log.code === \"PLUGIN_TIMINGS\"\n ) {\n return;\n }\n\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 output: [\n toArray(context.config.output.format).includes(\"esm\")\n ? {\n dir: context.config.output.path,\n format: \"es\",\n sourcemap: context.config.output.sourceMap,\n codeSplitting: true,\n exports: \"named\",\n minify: context.config.output.minify\n ? {\n compress: {\n dropDebugger:\n context.config.mode === \"production\" ? true : undefined,\n unused:\n context.config.mode === \"production\" ? true : undefined,\n treeshake: true\n },\n mangle: true\n }\n : context.config.mode === \"production\"\n ? \"dce-only\"\n : undefined\n }\n : undefined,\n toArray(context.config.output.format).includes(\"cjs\")\n ? {\n dir: context.config.output.path,\n format: \"cjs\",\n sourcemap: context.config.output.sourceMap,\n codeSplitting: true,\n exports: \"auto\",\n minify: context.config.output.minify\n ? {\n compress: {\n dropDebugger:\n context.config.mode === \"production\" ? true : undefined,\n unused:\n context.config.mode === \"production\" ? true : undefined,\n treeshake: true\n },\n mangle: true\n }\n : context.config.mode === \"production\"\n ? \"dce-only\"\n : undefined\n }\n : undefined\n ].filter(Boolean) as RolldownOptions[\"output\"]\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":";;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkB;CAC7B,WAAW;CACX,WAAW;CACX,oBAAoB;CACpB,WAAW,EACT,QAAQ,SACV;AACF;;;;;;;AAQA,SAAgB,eACd,SACiB;CACjB,OAAOA,OACL;EACE,OAAO,SACL,QAAQ,QAAQ,KAAK,EAAE,KAAI,UACzB,SAAS,KAAK,IAAI,QAAQ,MAAM,IAClC,CACF,EAAE,KAAK;EACP,WAAW,WAAmB;GAC5B,IACE,QAAQ,OAAO,QAAQ,YACvB,QAAQ,QAAQ,OAAO,QAAQ,QAAQ,EAAE,SAAS,MAAM,GAExD,OAAO;GAGT,IACE,QAAQ,OAAO,QAAQ,cACvB,QAAQ,QAAQ,OAAO,QAAQ,UAAU,EAAE,SAAS,MAAM,GAE1D,OAAO;GAGT,IAAI,QAAQ,SAAS,SAAS,MAAM,GAClC,OAAO,QAAQ,OAAO,gBAAgB;GAGxC,OAAO,CAAC,QAAQ,OAAO,QAAQ;EACjC;EACA,SAAS;GACP,iBAAiB;IACf,OAAO;IACP,UAAU,QAAQ,SAAS;GAC7B,CAAC;GACD,QAAQ,OAAO,UACb,OAAO,KAAK,QAAQ,OAAO,MAAM,EAAE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 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
10
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
11
|
const require_unplugin = require('./unplugin.cjs');
|
package/dist/rollup.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
1
3
|
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
|
|
2
4
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
|
|
3
5
|
import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
|
package/dist/rollup.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.d.mts","names":[],"sources":["../src/rollup.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rollup.d.mts","names":[],"sources":["../src/rollup.ts"],"mappings":";;;;;;;;;;;;;;cA+Ca,eAAA,EAAiB,MA+B7B;;;;AA/BD;;;iBAuCgB,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,aAAA;AAVF;AAQD;;;;;;;;;;;;;;AAEgB;AAuHhB;;;;;;AAjIC,iBAiIe,mBAAA,kBAAqC,gBAAA,CAAA,CACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;;;;;;;;;;;;cAwCtD,MAAA,GAAM,OAAA,GAA4C,wBAAA,iBAA5C,MAAA,QAAA,MAAA"}
|
package/dist/rollup.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import __tsdown_shims_path from 'node:path'
|
|
4
|
+
import __tsdown_shims_url from 'node:url'
|
|
5
|
+
|
|
6
|
+
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
|
1
9
|
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
2
10
|
import { defu as defu$1 } from "defu";
|
|
3
11
|
import { createRollupPlugin } from "unplugin";
|