@powerlines/unplugin 0.0.72 → 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
package/dist/rollup.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.mjs","names":["defu"],"sources":["../src/rollup.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport alias from \"@rollup/plugin-alias\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"node:fs\";\nimport type { InputOptions, RollupOptions } from \"rollup\";\nimport { Plugin } from \"rollup\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRollupPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.\n *\n * @remarks\n * This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.\n */\nexport const dtsBundlePlugin: Plugin = {\n name: \"powerlines:dts-bundle\",\n async generateBundle(_opts, bundle) {\n for (const [, file] of Object.entries(bundle)) {\n if (\n file.type === \"asset\" ||\n !file.isEntry ||\n file.facadeModuleId == null\n ) {\n continue;\n }\n\n // Replace various JavaScript file extensions (e.g., .js, .cjs, .mjs, .cjs.js, .mjs.js) with .d.ts for generating type definition file names.\n const dtsFileName = file.fileName.replace(\n /(?:\\.cjs|\\.mjs|\\.esm\\.js|\\.cjs\\.js|\\.mjs\\.js|\\.js)$/,\n \".d.ts\"\n );\n\n const relativeSourceDtsName = JSON.stringify(\n `./${file.facadeModuleId.replace(/\\.[cm]?[jt]sx?$/, \"\")}`\n );\n\n this.emitFile({\n type: \"asset\",\n fileName: dtsFileName,\n source: file.exports.includes(\"default\")\n ? `export * from ${relativeSourceDtsName};\\nexport { default } from ${relativeSourceDtsName};\\n`\n : `export * from ${relativeSourceDtsName};\\n`\n });\n }\n }\n};\n\n/**\n * Resolves the options for [rollup](https://rollupjs.org).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): RollupOptions {\n return {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n dtsBundlePlugin\n ].filter(Boolean) as Plugin[],\n cache: !context.config.skipCache ? undefined : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"silent\",\n output: [\n {\n dir: context.config.output.path,\n format: \"es\",\n entryFileNames: \"[name].js\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n },\n {\n dir: context.config.output.path,\n format: \"cjs\",\n entryFileNames: \"[name].cjs\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n }\n ]\n };\n}\n\n/**\n * Creates a Rollup plugin factory that generates a plugin instance.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n * import { createRollupFactory } from \"@powerlines/unplugin/rollup\";\n *\n * const powerlinesPlugin = createRollupFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rollup plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rollup build.\n */\nexport function createRollupFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rollup\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rollup: {\n async options(opts: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n opts,\n unplugin.context.callHook(\n \"rollup:options\",\n { environment },\n opts\n ) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rollup plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rollup\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nexport const plugin = createRollupPlugin(createRollupFactory());\n\nexport { plugin as default };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+CA,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ACF;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;;AAkBA,MAAa,SAAS,mBAAmB,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"rollup.mjs","names":["defu"],"sources":["../src/rollup.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport alias from \"@rollup/plugin-alias\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"node:fs\";\nimport type { InputOptions, RollupOptions } from \"rollup\";\nimport { Plugin } from \"rollup\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRollupPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.\n *\n * @remarks\n * This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.\n */\nexport const dtsBundlePlugin: Plugin = {\n name: \"powerlines:dts-bundle\",\n async generateBundle(_opts, bundle) {\n for (const [, file] of Object.entries(bundle)) {\n if (\n file.type === \"asset\" ||\n !file.isEntry ||\n file.facadeModuleId == null\n ) {\n continue;\n }\n\n // Replace various JavaScript file extensions (e.g., .js, .cjs, .mjs, .cjs.js, .mjs.js) with .d.ts for generating type definition file names.\n const dtsFileName = file.fileName.replace(\n /(?:\\.cjs|\\.mjs|\\.esm\\.js|\\.cjs\\.js|\\.mjs\\.js|\\.js)$/,\n \".d.ts\"\n );\n\n const relativeSourceDtsName = JSON.stringify(\n `./${file.facadeModuleId.replace(/\\.[cm]?[jt]sx?$/, \"\")}`\n );\n\n this.emitFile({\n type: \"asset\",\n fileName: dtsFileName,\n source: file.exports.includes(\"default\")\n ? `export * from ${relativeSourceDtsName};\\nexport { default } from ${relativeSourceDtsName};\\n`\n : `export * from ${relativeSourceDtsName};\\n`\n });\n }\n }\n};\n\n/**\n * Resolves the options for [rollup](https://rollupjs.org).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): RollupOptions {\n return {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n dtsBundlePlugin\n ].filter(Boolean) as Plugin[],\n cache: !context.config.skipCache ? undefined : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"silent\",\n output: [\n {\n dir: context.config.output.path,\n format: \"es\",\n entryFileNames: \"[name].js\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n },\n {\n dir: context.config.output.path,\n format: \"cjs\",\n entryFileNames: \"[name].cjs\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n }\n ]\n };\n}\n\n/**\n * Creates a Rollup plugin factory that generates a plugin instance.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n * import { createRollupFactory } from \"@powerlines/unplugin/rollup\";\n *\n * const powerlinesPlugin = createRollupFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rollup plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rollup build.\n */\nexport function createRollupFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rollup\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rollup: {\n async options(opts: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n opts,\n unplugin.context.callHook(\n \"rollup:options\",\n { environment },\n opts\n ) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rollup plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rollup\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nexport const plugin = createRollupPlugin(createRollupFactory());\n\nexport { plugin as default };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAa,kBAA0B;CACrC,MAAM;CACN,MAAM,eAAe,OAAO,QAAQ;EAClC,KAAK,MAAM,GAAG,SAAS,OAAO,QAAQ,MAAM,GAAG;GAC7C,IACE,KAAK,SAAS,WACd,CAAC,KAAK,WACN,KAAK,kBAAkB,MAEvB;GAIF,MAAM,cAAc,KAAK,SAAS,QAChC,uDACA,OACF;GAEA,MAAM,wBAAwB,KAAK,UACjC,KAAK,KAAK,eAAe,QAAQ,mBAAmB,EAAE,GACxD;GAEA,KAAK,SAAS;IACZ,MAAM;IACN,UAAU;IACV,QAAQ,KAAK,QAAQ,SAAS,SAAS,IACnC,iBAAiB,sBAAsB,6BAA6B,sBAAsB,OAC1F,iBAAiB,sBAAsB;GAC7C,CAAC;EACH;CACF;AACF;;;;;;;AAQA,SAAgB,eACd,SACe;CACf,OAAO;EACL,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,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ACnC,CACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,oBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAS,IAAG,aAC9D,SAAS;EACP,GAAI;EACJ,QAAQ,EACN,MAAM,QAAQ,MAAoB;GAChC,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;GAE1D,OAAOA,OACL,eAAe,WAAW,GAC1B,MACA,SAAS,QAAQ,SACf,kBACA,EAAE,YAAY,GACd,IACF,KAAK,CAAC,CACR;EACF,EACF;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;;AAkBA,MAAa,SAAS,mBAAmB,oBAAoB,CAAC"}
|
package/dist/rspack.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/rspack.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/rspack.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.d.mts","names":[],"sources":["../src/rspack.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rspack.d.mts","names":[],"sources":["../src/rspack.ts"],"mappings":";;;;;;;;;;;;;;iBAuCgB,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,OAAA,CAAQ,uBAAA;;;;;AAFX;;;;;;;;;;;;;;;;AAEkC;AAoElC;iBAAgB,mBAAA,kBAAqC,gBAAA,CAAA,CACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;;;;;;;;;;;;cAiCtD,MAAA,GAAM,OAAA,GAA4C,wBAA5C,oCAAA,oBAAA"}
|
package/dist/rspack.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/rspack.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.mjs","names":[],"sources":["../src/rspack.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { RspackOptionsNormalized } from \"@rspack/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { createRspackPlugin, RspackCompiler } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Resolves the options for [rspack](https://rspack.rs/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): Partial<RspackOptionsNormalized> {\n return {\n output: {\n path: context.config.output.path\n },\n name: context.config.name,\n resolve: {\n alias: context.alias\n },\n external: context.config.resolve.external,\n noExternal: [\n ...(context.config.resolve.noExternal ?? []),\n ...(context.builtins ?? [])\n ],\n skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle,\n node:\n context.config.platform === \"node\"\n ? {\n __dirname: true,\n __filename: true,\n global: true\n }\n : false,\n mode:\n context.config.mode === \"development\"\n ? (\"development\" as const)\n : (\"production\" as const),\n recordsInputPath: joinPaths(\n context.cachePath,\n \"rspack\",\n \".rspack-records.json\"\n ),\n recordsOutputPath: joinPaths(\n context.cachePath,\n \"rspack\",\n \".rspack-records.json\"\n ),\n context: joinPaths(context.config.cwd, context.config.root),\n cache: context.config.mode === \"development\",\n devtool: context.config.output.sourceMap ? \"source-map\" : false,\n optimization: {\n minimize: context.config.output.minify\n }\n } as Partial<RspackOptionsNormalized>;\n}\n\n/**\n * Creates a Rspack plugin factory that generates a plugin instance.\n *\n * @see https://rspack.dev/concepts/plugins\n *\n * @example\n * ```ts\n * // rspack.config.ts\n * import { createRspackFactory } from \"@powerlines/unplugin/rspack\";\n *\n * const powerlinesPlugin = createRspackFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rspack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rspack build.\n */\nexport function createRspackFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rspack\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rspack(compiler: RspackCompiler) {\n compiler.hooks.beforeRun.tap(\"PowerlinesRspackPlugin\", compiler => {\n compiler.options = defu(\n resolveOptions(unplugin.context),\n compiler.options\n ) as RspackOptionsNormalized;\n });\n }\n })\n );\n}\n\n/**\n * An Rspack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rspack.dev/concepts/plugins\n *\n * @example\n * ```ts\n * // rspack.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rspack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const plugin = createRspackPlugin(createRspackFactory());\n\nexport default plugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rspack.mjs","names":[],"sources":["../src/rspack.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { RspackOptionsNormalized } from \"@rspack/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { createRspackPlugin, RspackCompiler } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Resolves the options for [rspack](https://rspack.rs/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): Partial<RspackOptionsNormalized> {\n return {\n output: {\n path: context.config.output.path\n },\n name: context.config.name,\n resolve: {\n alias: context.alias\n },\n external: context.config.resolve.external,\n noExternal: [\n ...(context.config.resolve.noExternal ?? []),\n ...(context.builtins ?? [])\n ],\n skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle,\n node:\n context.config.platform === \"node\"\n ? {\n __dirname: true,\n __filename: true,\n global: true\n }\n : false,\n mode:\n context.config.mode === \"development\"\n ? (\"development\" as const)\n : (\"production\" as const),\n recordsInputPath: joinPaths(\n context.cachePath,\n \"rspack\",\n \".rspack-records.json\"\n ),\n recordsOutputPath: joinPaths(\n context.cachePath,\n \"rspack\",\n \".rspack-records.json\"\n ),\n context: joinPaths(context.config.cwd, context.config.root),\n cache: context.config.mode === \"development\",\n devtool: context.config.output.sourceMap ? \"source-map\" : false,\n optimization: {\n minimize: context.config.output.minify\n }\n } as Partial<RspackOptionsNormalized>;\n}\n\n/**\n * Creates a Rspack plugin factory that generates a plugin instance.\n *\n * @see https://rspack.dev/concepts/plugins\n *\n * @example\n * ```ts\n * // rspack.config.ts\n * import { createRspackFactory } from \"@powerlines/unplugin/rspack\";\n *\n * const powerlinesPlugin = createRspackFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Rspack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rspack build.\n */\nexport function createRspackFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rspack\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rspack(compiler: RspackCompiler) {\n compiler.hooks.beforeRun.tap(\"PowerlinesRspackPlugin\", compiler => {\n compiler.options = defu(\n resolveOptions(unplugin.context),\n compiler.options\n ) as RspackOptionsNormalized;\n });\n }\n })\n );\n}\n\n/**\n * An Rspack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rspack.dev/concepts/plugins\n *\n * @example\n * ```ts\n * // rspack.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rspack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const plugin = createRspackPlugin(createRspackFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,eACd,SACkC;CAClC,OAAO;EACL,QAAQ,EACN,MAAM,QAAQ,OAAO,OAAO,KAC9B;EACA,MAAM,QAAQ,OAAO;EACrB,SAAS,EACP,OAAO,QAAQ,MACjB;EACA,UAAU,QAAQ,OAAO,QAAQ;EACjC,YAAY,CACV,GAAI,QAAQ,OAAO,QAAQ,cAAc,CAAC,GAC1C,GAAI,QAAQ,YAAY,CAAC,CAC3B;EACA,uBAAuB,QAAQ,OAAO,QAAQ;EAC9C,MACE,QAAQ,OAAO,aAAa,SACxB;GACE,WAAW;GACX,YAAY;GACZ,QAAQ;EACV,IACA;EACN,MACE,QAAQ,OAAO,SAAS,gBACnB,gBACA;EACP,kBAAkB,UAChB,QAAQ,WACR,UACA,sBACF;EACA,mBAAmB,UACjB,QAAQ,WACR,UACA,sBACF;EACA,SAAS,UAAU,QAAQ,OAAO,KAAK,QAAQ,OAAO,IAAI;EAC1D,OAAO,QAAQ,OAAO,SAAS;EAC/B,SAAS,QAAQ,OAAO,OAAO,YAAY,eAAe;EAC1D,cAAc,EACZ,UAAU,QAAQ,OAAO,OAAO,OAClC;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,oBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAS,IAAG,aAC9D,SAAS;EACP,GAAI;EACJ,OAAO,UAA0B;GAC/B,SAAS,MAAM,UAAU,IAAI,2BAA0B,aAAY;IACjE,SAAS,UAAU,KACjB,eAAe,SAAS,OAAO,GAC/B,SAAS,OACX;GACF,CAAC;EACH;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;;AAkBA,MAAa,SAAS,mBAAmB,oBAAoB,CAAC"}
|
package/dist/tsdown.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_rolldown = require('./rolldown.cjs');
|
package/dist/tsdown.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 { UnresolvedContext } from "@powerlines/core";
|
|
2
4
|
import { GetDependencyConfigResult } from "@powerlines/core/plugin-utils";
|
|
3
5
|
import { Format } from "@storm-software/build-tools/types";
|
package/dist/tsdown.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.d.mts","names":[],"sources":["../src/tsdown.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsdown.d.mts","names":[],"sources":["../src/tsdown.ts"],"mappings":";;;;;;;;;;;;;;;iBAgDgB,mBAAA,kBAAqC,iBAAA,CAAA,CACnD,OAAA,EAAS,QAAA,GACR,yBAAA;AAAA,cAqBU,eAAA,EAAiB,OAAO,CAAC,YAAA;;;AAvBtC;;;;iBAoCgB,aAAA,CAAc,OAAA,GAAU,MAAA,GAAS,MAAA,KAAW,QAAA;;;;;;;iBAoB5C,iBAAA,CACd,OAAA,GAAU,QAAA,GAAe,QAAA,KACxB,MAAA;;;AAxDyB;AAqB5B;;;iBAwEgB,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,YAAA;AA1E+C;AAalD;;;;;;;;;;;;;AAAwE;AAoBxE;;;;;;;;AAjCkD,iBA+PlC,MAAA,CAAO,OAAA,GAAS,YAAA,GAAkB,YAAU"}
|
package/dist/tsdown.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 "./rolldown.mjs";
|
|
2
10
|
import { appendPath } from "@stryke/path/append";
|
|
3
11
|
import { relativePath } from "@stryke/path/file-path-fns";
|
package/dist/tsdown.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.mjs","names":["_getDependencyConfig","rolldown"],"sources":["../src/tsdown.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 CopyConfig,\n ResolveConfig,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport type { GetDependencyConfigResult } from \"@powerlines/core/plugin-utils\";\nimport { getDependencyConfig as _getDependencyConfig } from \"@powerlines/core/plugin-utils\";\nimport type { Format } from \"@storm-software/build-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { globToRegex } from \"@stryke/path/glob-to-regex\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { ModuleFormat } from \"rolldown\";\nimport { UserConfig as BuildOptions, Format as TsdownFormat } from \"tsdown\";\nimport type { UserConfig } from \"tsdown/config\";\nimport rolldown from \"./rolldown\";\nimport { UnpluginExecutionOptions } from \"./types\";\n\n/**\n * Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.\n *\n * @param context - The build context.\n * @returns The dependency configuration.\n */\nexport function getDependencyConfig<TContext extends UnresolvedContext>(\n context: TContext\n): GetDependencyConfigResult {\n const { external, noExternal } = _getDependencyConfig(context);\n\n return {\n external:\n !external || external.length === 0\n ? undefined\n : external.map(ext =>\n isSetString(ext) && ext.includes(\"*\") ? globToRegex(ext) : ext\n ),\n noExternal:\n !noExternal || noExternal.length === 0\n ? undefined\n : noExternal.map(noExt =>\n isSetString(noExt) && noExt.includes(\"*\")\n ? globToRegex(noExt)\n : noExt\n )\n };\n}\n\nexport const DEFAULT_OPTIONS: Partial<BuildOptions> = {\n platform: \"neutral\",\n target: \"esnext\",\n fixedExtension: true,\n clean: false\n} as const;\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFormat(formats?: Format | Format[]): TsdownFormat[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n default:\n return \"esm\";\n }\n });\n}\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFromFormat(\n formats?: TsdownFormat | TsdownFormat[]\n): Format[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n case \"commonjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n case \"es\":\n case \"module\":\n case \"umd\":\n default:\n return \"esm\";\n }\n });\n}\n\nconst formatMessage = <TContext extends UnresolvedContext>(\n context: TContext,\n ...msgs: any[]\n) =>\n msgs\n .filter(Boolean)\n .join(\" \")\n .trim()\n .replace(new RegExp(`\\\\[${context.config.name}\\\\]`, \"g\"), \"\")\n .replaceAll(/^\\s+/g, \"\")\n .replaceAll(/\\s+$/g, \"\")\n .trim();\n\n/**\n * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): BuildOptions {\n const { external, noExternal } = getDependencyConfig(context);\n\n return defu(\n {\n name: context.config.name,\n cwd: appendPath(context.config.root, context.config.cwd),\n entry:\n context.entry.filter(entry => entry?.file).length > 0\n ? Object.fromEntries(\n context.entry\n .filter(entry => entry?.file)\n .map(entry => [\n entry.output ||\n replaceExtension(\n replacePath(\n replacePath(\n entry.file,\n joinPaths(context.config.root, \"src\")\n ),\n context.entryPath\n )\n ),\n entry.file\n ])\n )\n : [\n joinPaths(\n context.config.cwd,\n context.config.root,\n \"src\",\n \"**/*.ts\"\n ),\n joinPaths(\n context.config.cwd,\n context.config.root,\n \"src\",\n \"**/*.tsx\"\n )\n ],\n exports: {\n customExports: (exports: Record<string, any>) => {\n const result = Object.fromEntries(\n Object.entries(exports).map(([key, value]) => {\n if (isSetString(value)) {\n return [key, value];\n }\n\n const currentExport = {} as Record<string, any>;\n if (isSetString(value.require)) {\n currentExport.require = {\n types: replaceExtension(value.require, \".d.cts\", {\n fullExtension: true\n }),\n default: value.require\n };\n }\n\n if (isSetString(value.import)) {\n currentExport.import = {\n types: replaceExtension(value.import, \".d.mts\", {\n fullExtension: true\n }),\n default: value.import\n };\n }\n\n if (!isSetObject(value.default)) {\n if (isSetObject(currentExport.import)) {\n currentExport.default = currentExport.import;\n } else if (isSetObject(currentExport.require)) {\n currentExport.default = currentExport.require;\n }\n }\n\n return [key, currentExport];\n })\n );\n\n return Object.keys(result)\n .sort()\n .reduce(\n (ret, key) => {\n ret[key] = result[key];\n return ret;\n },\n {} as Record<string, any>\n );\n }\n },\n define: context.config.define,\n inputOptions: {\n transform: {\n define: context.config.define,\n inject: context.config.inject,\n typescript: {\n target: context.tsconfig.tsconfigJson?.compilerOptions?.target\n }\n }\n },\n deps: {\n neverBundle: external,\n alwaysBundle: context.config.resolve.skipNodeModulesBundle\n ? undefined\n : noExternal,\n onlyBundle: context.config.resolve.skipNodeModulesBundle\n ? noExternal\n : undefined,\n skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle\n },\n alias: context.alias,\n resolve: {\n alias: context.alias\n },\n platform: context.config.platform,\n dts: context.config.output.dts,\n outDir: relativePath(\n appendPath(context.config.root, context.config.cwd),\n context.config.output.path\n ),\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n format: resolveFormat(context.config.output.format).filter(Boolean),\n mode: context.config.mode,\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap,\n nodeProtocol: context.config.output.nodeProtocol,\n debug: context.config.mode === \"development\",\n silent:\n context.config.logLevel.general === \"silent\" ||\n context.config.mode === \"production\",\n logLevel: context.config.logLevel.general === \"trace\" ? \"debug\" : \"error\",\n customLogger: {\n level: context.config.logLevel.general === \"trace\" ? \"debug\" : \"error\",\n info: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.trace(formatMessage(context, ...msgs)),\n warn: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n warnOnce: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n error: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.error(formatMessage(context, ...msgs)),\n success: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.trace(formatMessage(context, ...msgs))\n }\n },\n DEFAULT_OPTIONS\n ) as BuildOptions;\n}\n\n/**\n * A Tsdown configuration function that integrates Powerlines into the build process.\n *\n * @see https://github.com/rolldown/tsdown\n *\n * @example\n * ```ts\n * // tsdown.config.ts\n * import withPowerlines from \"@powerlines/unplugin/tsdown\";\n *\n * export default withPowerlines({\n * entry: [\"src/index.ts\"],\n * format: [\"cjs\", \"esm\"],\n * dts: true,\n * sourcemap: true,\n * clean: true,\n * });\n *\n * ```\n *\n * @param options - The Tsdown options to merge with the Powerlines configuration.\n * @returns The merged Tsdown configuration options.\n */\nexport function plugin(options: UserConfig = {}): UserConfig {\n return {\n ...options,\n entry: options.entry,\n plugins: [\n rolldown({\n ...options,\n output: {\n path: options.outDir,\n format: resolveFromFormat(\n options.format as ModuleFormat | ModuleFormat[]\n ),\n copy: {\n path: options.outDir!,\n assets: toArray(options.copy)\n .map(copy => {\n if (!copy) {\n return undefined;\n }\n if (isSetString(copy)) {\n return copy;\n }\n if (isFunction(copy)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based copy options are not supported in Powerlines.\"\n );\n return undefined;\n }\n return {\n input: copy.from,\n output: copy.to\n };\n })\n .filter(Boolean) as CopyConfig[\"assets\"]\n }\n },\n resolve: {\n external: options.deps?.neverBundle\n ? (toArray(options.deps?.neverBundle)\n .map(external => {\n if (isFunction(external)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based external options are not supported in Powerlines.\"\n );\n return undefined;\n }\n return external;\n })\n .filter(Boolean) as ResolveConfig[\"external\"])\n : undefined,\n noExternal:\n (options.deps?.skipNodeModulesBundle && options.deps?.onlyBundle) ||\n (!options.deps?.skipNodeModulesBundle && options.deps?.alwaysBundle)\n ? (toArray(\n options.deps?.skipNodeModulesBundle\n ? options.deps?.onlyBundle\n : options.deps?.alwaysBundle\n )\n .map(noExternal => {\n if (isFunction(noExternal)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based noExternal options are not supported in Powerlines.\"\n );\n return undefined;\n }\n return noExternal;\n })\n .filter(Boolean) as ResolveConfig[\"noExternal\"])\n : undefined\n },\n tsconfig: isSetString(options.tsconfig) ? options.tsconfig : undefined\n } as UnpluginExecutionOptions)\n ]\n };\n}\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,oBACd,SAC2B;CAC3B,MAAM,EAAE,UAAU,eAAeA,sBAAqB,OAAO;CAE7D,OAAO;EACL,UACE,CAAC,YAAY,SAAS,WAAW,IAC7B,SACA,SAAS,KAAI,QACX,YAAY,GAAG,KAAK,IAAI,SAAS,GAAG,IAAI,YAAY,GAAG,IAAI,GAC7D;EACN,YACE,CAAC,cAAc,WAAW,WAAW,IACjC,SACA,WAAW,KAAI,UACb,YAAY,KAAK,KAAK,MAAM,SAAS,GAAG,IACpC,YAAY,KAAK,IACjB,KACN;CACR;AACF;AAEA,MAAa,kBAAyC;CACpD,UAAU;CACV,QAAQ;CACR,gBAAgB;CAChB,OAAO;AACT;;;;;;;AAQA,SAAgB,cAAc,SAA6C;CACzE,OAAO,QAAQ,OAAO,EAAE,KAAI,WAAU;EACpC,QAAQ,QAAR;GACE,KAAK,OACH,OAAO;GACT,KAAK,QACH,OAAO;GAET,SACE,OAAO;EACX;CACF,CAAC;AACH;;;;;;;AAQA,SAAgB,kBACd,SACU;CACV,OAAO,QAAQ,OAAO,EAAE,KAAI,WAAU;EACpC,QAAQ,QAAR;GACE,KAAK;GACL,KAAK,YACH,OAAO;GACT,KAAK,QACH,OAAO;GAKT,SACE,OAAO;EACX;CACF,CAAC;AACH;AAEA,MAAM,iBACJ,SACA,GAAG,SAEH,KACG,OAAO,OAAO,EACd,KAAK,GAAG,EACR,KAAK,EACL,QAAQ,IAAI,OAAO,MAAM,QAAQ,OAAO,KAAK,MAAM,GAAG,GAAG,EAAE,EAC3D,WAAW,SAAS,EAAE,EACtB,WAAW,SAAS,EAAE,EACtB,KAAK;;;;;;;AAQ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;MACA;KACF;KACA,OAAO;IACT,CAAC,EACA,OAAO,OAAO,IACjB;IACJ,YACG,QAAQ,MAAM,yBAAyB,QAAQ,MAAM,cACrD,CAAC,QAAQ,MAAM,yBAAyB,QAAQ,MAAM,eAClD,QACC,QAAQ,MAAM,wBACV,QAAQ,MAAM,aACd,QAAQ,MAAM,YACpB,EACG,KAAI,eAAc;KACjB,IAAI,WAAW,UAAU,GAAG;MAE1B,QAAQ,KACN,oEACF;MACA;KACF;KACA,OAAO;IACT,CAAC,EACA,OAAO,OAAO,IACjB;GACR;GACA,UAAU,YAAY,QAAQ,QAAQ,IAAI,QAAQ,WAAW;EAC/D,CAA6B,CAC/B;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"tsdown.mjs","names":["_getDependencyConfig","rolldown"],"sources":["../src/tsdown.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 CopyConfig,\n ResolveConfig,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport type { GetDependencyConfigResult } from \"@powerlines/core/plugin-utils\";\nimport { getDependencyConfig as _getDependencyConfig } from \"@powerlines/core/plugin-utils\";\nimport type { Format } from \"@storm-software/build-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { globToRegex } from \"@stryke/path/glob-to-regex\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { ModuleFormat } from \"rolldown\";\nimport { UserConfig as BuildOptions, Format as TsdownFormat } from \"tsdown\";\nimport type { UserConfig } from \"tsdown/config\";\nimport rolldown from \"./rolldown\";\nimport { UnpluginExecutionOptions } from \"./types\";\n\n/**\n * Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.\n *\n * @param context - The build context.\n * @returns The dependency configuration.\n */\nexport function getDependencyConfig<TContext extends UnresolvedContext>(\n context: TContext\n): GetDependencyConfigResult {\n const { external, noExternal } = _getDependencyConfig(context);\n\n return {\n external:\n !external || external.length === 0\n ? undefined\n : external.map(ext =>\n isSetString(ext) && ext.includes(\"*\") ? globToRegex(ext) : ext\n ),\n noExternal:\n !noExternal || noExternal.length === 0\n ? undefined\n : noExternal.map(noExt =>\n isSetString(noExt) && noExt.includes(\"*\")\n ? globToRegex(noExt)\n : noExt\n )\n };\n}\n\nexport const DEFAULT_OPTIONS: Partial<BuildOptions> = {\n platform: \"neutral\",\n target: \"esnext\",\n fixedExtension: true,\n clean: false\n} as const;\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFormat(formats?: Format | Format[]): TsdownFormat[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n default:\n return \"esm\";\n }\n });\n}\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFromFormat(\n formats?: TsdownFormat | TsdownFormat[]\n): Format[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n case \"commonjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n case \"es\":\n case \"module\":\n case \"umd\":\n default:\n return \"esm\";\n }\n });\n}\n\nconst formatMessage = <TContext extends UnresolvedContext>(\n context: TContext,\n ...msgs: any[]\n) =>\n msgs\n .filter(Boolean)\n .join(\" \")\n .trim()\n .replace(new RegExp(`\\\\[${context.config.name}\\\\]`, \"g\"), \"\")\n .replaceAll(/^\\s+/g, \"\")\n .replaceAll(/\\s+$/g, \"\")\n .trim();\n\n/**\n * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): BuildOptions {\n const { external, noExternal } = getDependencyConfig(context);\n\n return defu(\n {\n name: context.config.name,\n cwd: appendPath(context.config.root, context.config.cwd),\n entry:\n context.entry.filter(entry => entry?.file).length > 0\n ? Object.fromEntries(\n context.entry\n .filter(entry => entry?.file)\n .map(entry => [\n entry.output ||\n replaceExtension(\n replacePath(\n replacePath(\n entry.file,\n joinPaths(context.config.root, \"src\")\n ),\n context.entryPath\n )\n ),\n entry.file\n ])\n )\n : [\n joinPaths(\n context.config.cwd,\n context.config.root,\n \"src\",\n \"**/*.ts\"\n ),\n joinPaths(\n context.config.cwd,\n context.config.root,\n \"src\",\n \"**/*.tsx\"\n )\n ],\n exports: {\n customExports: (exports: Record<string, any>) => {\n const result = Object.fromEntries(\n Object.entries(exports).map(([key, value]) => {\n if (isSetString(value)) {\n return [key, value];\n }\n\n const currentExport = {} as Record<string, any>;\n if (isSetString(value.require)) {\n currentExport.require = {\n types: replaceExtension(value.require, \".d.cts\", {\n fullExtension: true\n }),\n default: value.require\n };\n }\n\n if (isSetString(value.import)) {\n currentExport.import = {\n types: replaceExtension(value.import, \".d.mts\", {\n fullExtension: true\n }),\n default: value.import\n };\n }\n\n if (!isSetObject(value.default)) {\n if (isSetObject(currentExport.import)) {\n currentExport.default = currentExport.import;\n } else if (isSetObject(currentExport.require)) {\n currentExport.default = currentExport.require;\n }\n }\n\n return [key, currentExport];\n })\n );\n\n return Object.keys(result)\n .sort()\n .reduce(\n (ret, key) => {\n ret[key] = result[key];\n return ret;\n },\n {} as Record<string, any>\n );\n }\n },\n define: context.config.define,\n inputOptions: {\n transform: {\n define: context.config.define,\n inject: context.config.inject,\n typescript: {\n target: context.tsconfig.tsconfigJson?.compilerOptions?.target\n }\n }\n },\n deps: {\n neverBundle: external,\n alwaysBundle: context.config.resolve.skipNodeModulesBundle\n ? undefined\n : noExternal,\n onlyBundle: context.config.resolve.skipNodeModulesBundle\n ? noExternal\n : undefined,\n skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle\n },\n alias: context.alias,\n resolve: {\n alias: context.alias\n },\n platform: context.config.platform,\n dts: context.config.output.dts,\n outDir: relativePath(\n appendPath(context.config.root, context.config.cwd),\n context.config.output.path\n ),\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n format: resolveFormat(context.config.output.format).filter(Boolean),\n mode: context.config.mode,\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap,\n nodeProtocol: context.config.output.nodeProtocol,\n debug: context.config.mode === \"development\",\n silent:\n context.config.logLevel.general === \"silent\" ||\n context.config.mode === \"production\",\n logLevel: context.config.logLevel.general === \"trace\" ? \"debug\" : \"error\",\n customLogger: {\n level: context.config.logLevel.general === \"trace\" ? \"debug\" : \"error\",\n info: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.trace(formatMessage(context, ...msgs)),\n warn: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n warnOnce: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n error: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.error(formatMessage(context, ...msgs)),\n success: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.trace(formatMessage(context, ...msgs))\n }\n },\n DEFAULT_OPTIONS\n ) as BuildOptions;\n}\n\n/**\n * A Tsdown configuration function that integrates Powerlines into the build process.\n *\n * @see https://github.com/rolldown/tsdown\n *\n * @example\n * ```ts\n * // tsdown.config.ts\n * import withPowerlines from \"@powerlines/unplugin/tsdown\";\n *\n * export default withPowerlines({\n * entry: [\"src/index.ts\"],\n * format: [\"cjs\", \"esm\"],\n * dts: true,\n * sourcemap: true,\n * clean: true,\n * });\n *\n * ```\n *\n * @param options - The Tsdown options to merge with the Powerlines configuration.\n * @returns The merged Tsdown configuration options.\n */\nexport function plugin(options: UserConfig = {}): UserConfig {\n return {\n ...options,\n entry: options.entry,\n plugins: [\n rolldown({\n ...options,\n output: {\n path: options.outDir,\n format: resolveFromFormat(\n options.format as ModuleFormat | ModuleFormat[]\n ),\n copy: {\n path: options.outDir!,\n assets: toArray(options.copy)\n .map(copy => {\n if (!copy) {\n return undefined;\n }\n if (isSetString(copy)) {\n return copy;\n }\n if (isFunction(copy)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based copy options are not supported in Powerlines.\"\n );\n return undefined;\n }\n return {\n input: copy.from,\n output: copy.to\n };\n })\n .filter(Boolean) as CopyConfig[\"assets\"]\n }\n },\n resolve: {\n external: options.deps?.neverBundle\n ? (toArray(options.deps?.neverBundle)\n .map(external => {\n if (isFunction(external)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based external options are not supported in Powerlines.\"\n );\n return undefined;\n }\n return external;\n })\n .filter(Boolean) as ResolveConfig[\"external\"])\n : undefined,\n noExternal:\n (options.deps?.skipNodeModulesBundle && options.deps?.onlyBundle) ||\n (!options.deps?.skipNodeModulesBundle && options.deps?.alwaysBundle)\n ? (toArray(\n options.deps?.skipNodeModulesBundle\n ? options.deps?.onlyBundle\n : options.deps?.alwaysBundle\n )\n .map(noExternal => {\n if (isFunction(noExternal)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based noExternal options are not supported in Powerlines.\"\n );\n return undefined;\n }\n return noExternal;\n })\n .filter(Boolean) as ResolveConfig[\"noExternal\"])\n : undefined\n },\n tsconfig: isSetString(options.tsconfig) ? options.tsconfig : undefined\n } as UnpluginExecutionOptions)\n ]\n };\n}\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,oBACd,SAC2B;CAC3B,MAAM,EAAE,UAAU,eAAeA,sBAAqB,OAAO;CAE7D,OAAO;EACL,UACE,CAAC,YAAY,SAAS,WAAW,IAC7B,SACA,SAAS,KAAI,QACX,YAAY,GAAG,KAAK,IAAI,SAAS,GAAG,IAAI,YAAY,GAAG,IAAI,GAC7D;EACN,YACE,CAAC,cAAc,WAAW,WAAW,IACjC,SACA,WAAW,KAAI,UACb,YAAY,KAAK,KAAK,MAAM,SAAS,GAAG,IACpC,YAAY,KAAK,IACjB,KACN;CACR;AACF;AAEA,MAAa,kBAAyC;CACpD,UAAU;CACV,QAAQ;CACR,gBAAgB;CAChB,OAAO;AACT;;;;;;;AAQA,SAAgB,cAAc,SAA6C;CACzE,OAAO,QAAQ,OAAO,EAAE,KAAI,WAAU;EACpC,QAAQ,QAAR;GACE,KAAK,OACH,OAAO;GACT,KAAK,QACH,OAAO;GAET,SACE,OAAO;EACX;CACF,CAAC;AACH;;;;;;;AAQA,SAAgB,kBACd,SACU;CACV,OAAO,QAAQ,OAAO,EAAE,KAAI,WAAU;EACpC,QAAQ,QAAR;GACE,KAAK;GACL,KAAK,YACH,OAAO;GACT,KAAK,QACH,OAAO;GAKT,SACE,OAAO;EACX;CACF,CAAC;AACH;AAEA,MAAM,iBACJ,SACA,GAAG,SAEH,KACG,OAAO,OAAO,EACd,KAAK,GAAG,EACR,KAAK,EACL,QAAQ,IAAI,OAAO,MAAM,QAAQ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AAM,cACnB,QAAQ,QAAQ,MAAM,WAAW,EAC/B,KAAI,aAAY;KACf,IAAI,WAAW,QAAQ,GAAG;MAExB,QAAQ,KACN,kEACF;MACA;KACF;KACA,OAAO;IACT,CAAC,EACA,OAAO,OAAO,IACjB;IACJ,YACG,QAAQ,MAAM,yBAAyB,QAAQ,MAAM,cACrD,CAAC,QAAQ,MAAM,yBAAyB,QAAQ,MAAM,eAClD,QACC,QAAQ,MAAM,wBACV,QAAQ,MAAM,aACd,QAAQ,MAAM,YACpB,EACG,KAAI,eAAc;KACjB,IAAI,WAAW,UAAU,GAAG;MAE1B,QAAQ,KACN,oEACF;MACA;KACF;KACA,OAAO;IACT,CAAC,EACA,OAAO,OAAO,IACjB;GACR;GACA,UAAU,YAAY,QAAQ,QAAQ,IAAI,QAAQ,WAAW;EAC/D,CAA6B,CAC/B;CACF;AACF"}
|
package/dist/tsup.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_esbuild = require('./esbuild.cjs');
|
package/dist/tsup.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 { ResolvedEntryFileReference, UnresolvedContext } from "@powerlines/core";
|
|
2
4
|
import { Entry } from "@storm-software/build-tools/types";
|
|
3
5
|
import { resolveOptions as resolveOptions$1 } from "@storm-software/tsup";
|
package/dist/tsup.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsup.d.mts","names":[],"sources":["../src/tsup.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsup.d.mts","names":[],"sources":["../src/tsup.ts"],"mappings":";;;;;;;;cAiCa,eAAA,EAAiB,OAAO,CAAC,SAAA;;;;;;;;iBAwBtB,YAAA,kBAA8B,iBAAA,CAAA,CAC5C,OAAA,EAAS,QAAA,EACT,WAAA,EAAa,0BAAA,gBACZ,KAAA;;AA3BH;;;;AAA6C;iBAyC7B,cAAA,kBAAgC,iBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,UAAA,QAAkB,gBAAA;;;;;;;;;;;;;;;;;AAhBb;AAcR;;;;;;iBAwFgB,UAAA,CAAW,OAAA,EAAS,SAAA,GAAU,SAAO"}
|
package/dist/tsup.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, { resolveEntry as resolveEntry$1 } from "./esbuild.mjs";
|
|
2
10
|
import { appendPath } from "@stryke/path/append";
|
|
3
11
|
import { relativePath } from "@stryke/path/file-path-fns";
|
package/dist/tsup.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsup.mjs","names":["resolveEsbuildEntry","esbuild"],"sources":["../src/tsup.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ResolvedEntryFileReference,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { AssetGlob, Entry } from \"@storm-software/build-tools/types\";\nimport { resolveOptions as resolveOptionsBase } from \"@storm-software/tsup\";\nimport { DEFAULT_BUILD_OPTIONS } from \"@storm-software/tsup/constants\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport defu from \"defu\";\nimport type { Options } from \"tsup\";\nimport esbuild, { resolveEntry as resolveEsbuildEntry } from \"./esbuild\";\n\nexport const DEFAULT_OPTIONS: Partial<Options> = {\n ...DEFAULT_BUILD_OPTIONS,\n target: \"esnext\",\n config: false,\n minify: true,\n sourcemap: false,\n cjsInterop: true,\n bundle: true,\n dts: true,\n shims: true,\n silent: true,\n treeshake: true,\n keepNames: true,\n splitting: true,\n banner: {}\n};\n\n/**\n * Resolves the entry options for [tsup](https://github.com/egoist/tsup).\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): Entry {\n return resolveEsbuildEntry(context, entryPoints) as Entry;\n}\n\ntype TsupEsbuildOptionsHandler = NonNullable<Options[\"esbuildOptions\"]>;\ntype TsupEsbuildOptionsArgs = Parameters<TsupEsbuildOptionsHandler>;\ntype TsupEsbuildOptions = TsupEsbuildOptionsArgs[0];\n\n/**\n * Resolves the options for [tsup](https://github.com/egoist/tsup).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): Parameters<typeof resolveOptionsBase>[0] {\n const result = defu(\n {\n entry: Object.fromEntries(\n Object.entries(resolveEntry(context, context.entry)).map(\n ([key, value]) => [key, appendPath(value, context.config.root)]\n )\n ),\n esbuildOptions: (options: TsupEsbuildOptions) => {\n options.alias = {\n ...context.alias,\n ...context.builtins.reduce(\n (ret, id) => {\n const path = context.fs.paths[id];\n if (path) {\n ret[id] = path;\n }\n\n return ret;\n },\n {} as Record<string, string>\n ),\n ...options.alias\n };\n },\n noExternal: context.builtins\n },\n {\n name: context.config.name,\n root: context.config.root,\n projectRoot: context.config.root,\n assets: context.config.output.copy\n ? (context.config.output.copy.assets as (string | AssetGlob)[])\n : undefined,\n resolveExtensions: context.config.resolve.extensions,\n outputPath: relativePath(\n appendPath(context.config.root, context.config.cwd),\n context.config.output.path\n ),\n tsconfig: context.tsconfig.tsconfigFilePath,\n dts: {\n compilerOptions: context.tsconfig.tsconfigJson.compilerOptions\n },\n format: context.config.output.format,\n mode: context.config.mode,\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap,\n silent:\n context.config.logLevel.general === \"silent\" ||\n context.config.mode === \"production\",\n verbose:\n context.config.logLevel.general === \"trace\" ||\n context.config.mode === \"development\",\n workspaceConfig: { workspaceRoot: context.config.cwd }\n },\n DEFAULT_OPTIONS\n );\n\n result.format = getUnique(toArray(result.format));\n return result as Parameters<typeof resolveOptionsBase>[0];\n}\n\n/**\n * A Tsup configuration function that integrates Powerlines into the build process.\n *\n * @see https://tsup.egoist.dev/#/config\n *\n * @example\n * ```ts\n * // tsup.config.ts\n * import withPowerlines from \"@powerlines/unplugin/tsup\";\n *\n * export default withPowerlines({\n * entry: [\"src/index.ts\"],\n * format: [\"cjs\", \"esm\"],\n * dts: true,\n * sourcemap: true,\n * clean: true,\n * });\n *\n * ```\n *\n * @param options - The Tsup options to merge with the Powerlines configuration.\n * @returns The merged Tsup configuration options.\n */\nexport function withPlugin(options: Options): Options {\n return {\n ...options,\n esbuildPlugins: [...(options.esbuildPlugins ?? []), esbuild()]\n };\n}\n\nexport default withPlugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsup.mjs","names":["resolveEsbuildEntry","esbuild"],"sources":["../src/tsup.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ResolvedEntryFileReference,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { AssetGlob, Entry } from \"@storm-software/build-tools/types\";\nimport { resolveOptions as resolveOptionsBase } from \"@storm-software/tsup\";\nimport { DEFAULT_BUILD_OPTIONS } from \"@storm-software/tsup/constants\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport defu from \"defu\";\nimport type { Options } from \"tsup\";\nimport esbuild, { resolveEntry as resolveEsbuildEntry } from \"./esbuild\";\n\nexport const DEFAULT_OPTIONS: Partial<Options> = {\n ...DEFAULT_BUILD_OPTIONS,\n target: \"esnext\",\n config: false,\n minify: true,\n sourcemap: false,\n cjsInterop: true,\n bundle: true,\n dts: true,\n shims: true,\n silent: true,\n treeshake: true,\n keepNames: true,\n splitting: true,\n banner: {}\n};\n\n/**\n * Resolves the entry options for [tsup](https://github.com/egoist/tsup).\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): Entry {\n return resolveEsbuildEntry(context, entryPoints) as Entry;\n}\n\ntype TsupEsbuildOptionsHandler = NonNullable<Options[\"esbuildOptions\"]>;\ntype TsupEsbuildOptionsArgs = Parameters<TsupEsbuildOptionsHandler>;\ntype TsupEsbuildOptions = TsupEsbuildOptionsArgs[0];\n\n/**\n * Resolves the options for [tsup](https://github.com/egoist/tsup).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): Parameters<typeof resolveOptionsBase>[0] {\n const result = defu(\n {\n entry: Object.fromEntries(\n Object.entries(resolveEntry(context, context.entry)).map(\n ([key, value]) => [key, appendPath(value, context.config.root)]\n )\n ),\n esbuildOptions: (options: TsupEsbuildOptions) => {\n options.alias = {\n ...context.alias,\n ...context.builtins.reduce(\n (ret, id) => {\n const path = context.fs.paths[id];\n if (path) {\n ret[id] = path;\n }\n\n return ret;\n },\n {} as Record<string, string>\n ),\n ...options.alias\n };\n },\n noExternal: context.builtins\n },\n {\n name: context.config.name,\n root: context.config.root,\n projectRoot: context.config.root,\n assets: context.config.output.copy\n ? (context.config.output.copy.assets as (string | AssetGlob)[])\n : undefined,\n resolveExtensions: context.config.resolve.extensions,\n outputPath: relativePath(\n appendPath(context.config.root, context.config.cwd),\n context.config.output.path\n ),\n tsconfig: context.tsconfig.tsconfigFilePath,\n dts: {\n compilerOptions: context.tsconfig.tsconfigJson.compilerOptions\n },\n format: context.config.output.format,\n mode: context.config.mode,\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap,\n silent:\n context.config.logLevel.general === \"silent\" ||\n context.config.mode === \"production\",\n verbose:\n context.config.logLevel.general === \"trace\" ||\n context.config.mode === \"development\",\n workspaceConfig: { workspaceRoot: context.config.cwd }\n },\n DEFAULT_OPTIONS\n );\n\n result.format = getUnique(toArray(result.format));\n return result as Parameters<typeof resolveOptionsBase>[0];\n}\n\n/**\n * A Tsup configuration function that integrates Powerlines into the build process.\n *\n * @see https://tsup.egoist.dev/#/config\n *\n * @example\n * ```ts\n * // tsup.config.ts\n * import withPowerlines from \"@powerlines/unplugin/tsup\";\n *\n * export default withPowerlines({\n * entry: [\"src/index.ts\"],\n * format: [\"cjs\", \"esm\"],\n * dts: true,\n * sourcemap: true,\n * clean: true,\n * });\n *\n * ```\n *\n * @param options - The Tsup options to merge with the Powerlines configuration.\n * @returns The merged Tsup configuration options.\n */\nexport function withPlugin(options: Options): Options {\n return {\n ...options,\n esbuildPlugins: [...(options.esbuildPlugins ?? []), esbuild()]\n };\n}\n\nexport default withPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,MAAa,kBAAoC;CAC/C,GAAG;CACH,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,QAAQ;CACR,KAAK;CACL,OAAO;CACP,QAAQ;CACR,WAAW;CACX,WAAW;CACX,WAAW;CACX,QAAQ,CAAC;AACX;;;;;;;;AASA,SAAgB,aACd,SACA,aACO;CACP,OAAOA,eAAoB,SAAS,WAAW;AACjD;;;;;;;AAYA,SAAgB,eACd,SAC0C;CAC1C,MAAM,SAAS,KACb;EACE,OAAO,OAAO,YACZ,OAAO,QAAQ,aAAa,SAAS,QAAQ,KAAK,CAAC,EAAE,KAClD,CAAC,KAAK,WAAW,CAAC,KAAK,WAAW,OAAO,QAAQ,OAAO,IAAI,CAAC,CAChE,CACF;EACA,iBAAiB,YAAgC;GAC/C,QAAQ,QAAQ;IACd,GAAG,QAAQ;IACX,GAAG,QAAQ,SAAS,QACjB,KAAK,OAAO;KACX,MAAM,OAAO,QAAQ,GAAG,MAAM;KAC9B,IAAI,MACF,IAAI,M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fileURLToPath(import.meta.url)
|
|
7
|
+
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
+
|
package/dist/types.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 { UnpluginContextMeta } from "unplugin";
|
|
2
4
|
import { BuildInlineConfig, ExecutionContext, ExecutionOptions, UnpluginOptions } from "@powerlines/core";
|
|
3
5
|
import { PartialKeys } from "@stryke/types/base";
|
package/dist/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;KA6BY,4BAAA,GAA+B,IAAA,CACzC,WAAA,CACE,gBAAA;AAAA,KAMQ,wBAAA,GAA2B,IAAA,CAAK,iBAAA,eAC1C,4BAAA;AAAA,KAEU,eAAA,kBAAiC,gBAAA,KAC3C,OAAA,EAAS,wBAAA,cACT,IAAA,EAAM,mBAAA,KACH,eAAA,CAAgB,QAAA"}
|
package/dist/types.mjs
CHANGED
|
@@ -1 +1,9 @@
|
|
|
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
|
export { };
|
package/dist/unloader.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/unloader.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/unloader.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unloader.d.mts","names":[],"sources":["../src/unloader.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unloader.d.mts","names":[],"sources":["../src/unloader.ts"],"mappings":";;;;;;;;;;;;;;;;;;AA8CA;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,CAAA,CACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;;;;;;;;;;cAqBtD,MAAA,GAAM,OAAA,GAAgD,wBAAhD,oCAAA,MAAA,sBAAA,MAAA"}
|
package/dist/unloader.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 { createUnloaderPlugin } from "unplugin";
|
|
3
11
|
|
package/dist/unloader.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unloader.mjs","names":[],"sources":["../src/unloader.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 { createUnloaderPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Creates a Unloader plugin factory that generates a plugin instance.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import { createUnloaderFactory } from \"@powerlines/unplugin/unloader\";\n *\n * const powerlinesPlugin = createUnloaderFactory({ 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 Unloader plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Unloader build.\n */\nexport function createUnloaderFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"unloader\" }, unplugin =>\n decorate(unplugin as UnpluginOptions<TContext>)\n );\n}\n\n/**\n * An Unloader plugin that will invoke the Powerlines API hooks during processing.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import powerlines from \"@powerlines/unplugin/unloader\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const plugin = createUnloaderPlugin(createUnloaderFactory());\n\nexport default plugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unloader.mjs","names":[],"sources":["../src/unloader.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 { createUnloaderPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Creates a Unloader plugin factory that generates a plugin instance.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import { createUnloaderFactory } from \"@powerlines/unplugin/unloader\";\n *\n * const powerlinesPlugin = createUnloaderFactory({ 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 Unloader plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Unloader build.\n */\nexport function createUnloaderFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"unloader\" }, unplugin =>\n decorate(unplugin as UnpluginOptions<TContext>)\n );\n}\n\n/**\n * An Unloader plugin that will invoke the Powerlines API hooks during processing.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import powerlines from \"@powerlines/unplugin/unloader\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const plugin = createUnloaderPlugin(createUnloaderFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,SAAgB,sBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAW,IAAG,aAChE,SAAS,QAAqC,CAChD;AACF;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS,qBAAqB,sBAAsB,CAAC"}
|
package/dist/unplugin.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.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
10
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
11
|
let _stryke_path_replace = require("@stryke/path/replace");
|
package/dist/unplugin.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 { UnpluginFactory } from "./types.mjs";
|
|
2
4
|
import { CustomLogger, ExecutionContext, Options, UnpluginBuilderVariant, UnpluginOptions } from "@powerlines/core";
|
|
3
5
|
export * from "@powerlines/core/lib/unplugin";
|
package/dist/unplugin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unplugin.d.mts","names":[],"sources":["../src/unplugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unplugin.d.mts","names":[],"sources":["../src/unplugin.ts"],"mappings":";;;;;;;;;;UAuEiB,sBAAA,SAA+B,OAAA;;;;;;;EAO9C,OAAA,EAAS,sBAAA;;AAPX;;;;EAcE,mBAAA;EAd8C;;;;;;EAsB9C,YAAA,GAAe,YAAA;AAAA;AAAA,KAGL,wBAAA,kBAA0C,gBAAA,KACpD,OAAA,EAAS,eAAA,CAAgB,QAAA,MACtB,OAAA,CAAQ,eAAA,CAAgB,QAAA;;AALA;AAG7B;;;;;;;;;;;;;;;;;;;;AAEqC;AA2BrC;;iBAAgB,qBAAA,kBACG,gBAAA,GAAmB,gBAAA,CAAA,CAEpC,OAAA,EAAS,sBAAA,EACT,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAClC,eAAA,CAAgB,QAAA"}
|
package/dist/unplugin.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 { replacePath } from "@stryke/path/replace";
|
|
3
11
|
import { formatFolder, handleTypes, initializeTsconfig, installDependencies, isUnpluginBuilderVariant, loadParsedConfig, resolveRoot, resolveTsconfig, writeMetaFile } from "@powerlines/core";
|
package/dist/unplugin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unplugin.mjs","names":[],"sources":["../src/unplugin.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 CustomLogger,\n ExecutionContext,\n Options,\n UnpluginBuilderVariant,\n UnpluginOptions\n} from \"@powerlines/core\";\nimport {\n formatFolder,\n handleTypes,\n initializeTsconfig,\n installDependencies,\n isUnpluginBuilderVariant,\n loadParsedConfig,\n resolveRoot,\n resolveTsconfig,\n writeMetaFile\n} from \"@powerlines/core\";\nimport { UNPLUGIN_BUILDER_VARIANTS } from \"@powerlines/core/constants\";\nimport { PowerlinesExecutionContext } from \"@powerlines/core/context/execution-context\";\nimport { resolvePluginConfig } from \"@powerlines/core/lib/context-helpers\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { getString } from \"@powerlines/core/lib/utilities/source-file\";\nimport {\n addVirtualPrefix,\n formatConfig,\n removeVirtualPrefix,\n VIRTUAL_MODULE_PREFIX_REGEX\n} from \"@powerlines/core/plugin-utils\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport { createDirectory } from \"@stryke/fs/helpers\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { LoadResult } from \"rolldown\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { UnpluginFactory } from \"./types\";\n\nexport * from \"@powerlines/core/lib/unplugin\";\n\n/**\n * The options required to create a Powerlines unplugin factory, which generates a plugin instance for a specific build variant and allows for optional customization of logging and framework identification.\n */\nexport interface UnpluginFactoryOptions extends Options {\n /**\n * The build variant for which to create the unplugin.\n *\n * @remarks\n * This option is required to ensure that the unplugin is built with the correct configuration and behavior for the intended build tool or framework. The variant will determine how the unplugin integrates with the build process and which hooks it will call during execution.\n */\n variant: UnpluginBuilderVariant;\n\n /**\n * An optional string prefix to use for virtual module IDs. This can be useful for ensuring that virtual modules are only processed by the plugin and not by other plugins or the bundler itself. If not provided, the default prefix `__powerlines-virtual:` will be used.\n *\n * @defaultValue \"\\\\0\"\n */\n virtualModulePrefix?: string | false;\n\n /**\n * A custom logger instance that implements the {@link CustomLogger} interface, which can be used for logging messages during the build process instead of the default Powerlines logger.\n *\n * @remarks\n * Providing a custom logger allows you to integrate Powerlines logging with your own logging system or to customize the logging behavior, such as formatting log messages differently or sending logs to an external service. If a custom logger is not provided, Powerlines will use its default logger implementation.\n */\n customLogger?: CustomLogger;\n}\n\nexport type UnpluginFactoryDecorator<TContext extends ExecutionContext> = (\n options: UnpluginOptions<TContext>\n) => Partial<UnpluginOptions<TContext>>;\n\n/**\n * Creates a Powerlines unplugin factory that generates a plugin instance.\n *\n * @remarks\n * The factory will handle loading the Powerlines configuration, resolving the plugin configuration, and executing the appropriate hooks during the build process. It also allows for optional customization of logging and framework identification through the provided options.\n *\n * @example\n * ```ts\n * import { createUnpluginFactory } from \"@powerlines/unplugin\";\n *\n * const factory = createUnpluginFactory({\n * variant: \"vite\",\n * framework: \"my-framework\",\n * orgId: \"my-org\",\n * customLogger: myCustomLogger\n * });\n *\n * const plugin = createVitePlugin(factory);\n * export default plugin;\n * ```\n *\n * @param options - The options for the unplugin factory, including the build variant and an optional custom logger.\n * @param decorate - An optional function to decorate the unplugin options.\n * @returns The unplugin factory that generates a plugin instance.\n */\nexport function createUnpluginFactory<\n TContext extends ExecutionContext = ExecutionContext\n>(\n options: UnpluginFactoryOptions,\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n): UnpluginFactory<TContext> {\n if (!isUnpluginBuilderVariant(options.variant)) {\n throw new Error(\n `Invalid unplugin builder variant: ${String(options.variant)}. Expected one of: ${UNPLUGIN_BUILDER_VARIANTS.join(\n \", \"\n )}.`\n );\n }\n\n const cwd = getWorkspaceRoot(process.cwd());\n const virtualModulePrefix = options.virtualModulePrefix ?? \"\\\\0\";\n\n return (params = {}): UnpluginOptions<TContext> => {\n let context!: PowerlinesExecutionContext<\n TContext[\"config\"],\n TContext[\"system\"]\n >;\n try {\n const framework =\n (params.framework?.name ?? options.framework?.name) || \"powerlines\";\n const orgId =\n (params.framework?.orgId ?? options.framework?.orgId) ||\n \"storm-software\";\n\n const root = resolveRoot(cwd, params.root, params.configFile);\n\n async function buildStart(this: UnpluginBuildContext): Promise<void> {\n const config = await loadParsedConfig(cwd, root, framework, orgId, {\n ...params,\n command: \"build\"\n });\n if (!config) {\n throw new Error(\"Failed to load configuration\");\n }\n\n const configs = toArray(config.config);\n if (\n params.configIndex !== undefined &&\n params.configIndex >= configs.length\n ) {\n throw new Error(\n `Invalid execution index: ${params.configIndex}. The configuration file contains ${configs.length} execution(s).`\n );\n }\n\n const _options = {\n cwd,\n root,\n ...params,\n command: \"build\",\n configFile: config.configFile!,\n executionId: uuid(),\n configIndex: 0\n };\n\n context = await PowerlinesExecutionContext.from(\n {\n ...options,\n ..._options,\n configFile: config.configFile!\n },\n _options\n );\n context.logger.info(\n `Starting ${titleCase(framework)} ${titleCase(options.variant)} plugin execution`\n );\n\n context.logger.debug({\n meta: { category: \"config\" },\n message: `Invoking ${titleCase(framework)} ${titleCase(\n options.variant\n )} plugin with the following execution parameters: \\n --- Execution Options --- \\n${formatConfig(\n params\n )}`\n });\n\n await resolvePluginConfig(context);\n\n const timer = context.timer(\"Preparation\");\n\n await executeEnvironments(context, async env => {\n env.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"pre\"\n });\n\n await initializeTsconfig(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"normal\"\n });\n\n if (env.entry.length > 0) {\n const entriesLength = isObject(env.config.input)\n ? Object.keys(env.config.input).length\n : toArray(env.config.input).length;\n env.debug(\n `The configuration provided ${entriesLength} entry point${\n entriesLength !== 1 ? \"s\" : \"\"\n }, Powerlines has found ${env.entry.length} entry file${\n env.entry.length !== 1 ? \"s\" : \"\"\n } for the ${env.config.title} project${\n env.entry.length > 0 && env.entry.length < 10\n ? `: \\n${env.entry\n .map(\n entry =>\n `- ${replacePath(entry.file, context.config.root)}${\n entry.output\n ? ` -> ${replacePath(\n entry.output,\n context.config.root\n )}`\n : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n env.warn(\n `No entry files were found for the ${\n env.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig(env);\n await installDependencies(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"post\"\n });\n\n env.trace({\n meta: {\n category: \"config\"\n },\n message: `Powerlines configuration after configResolved hook: \\n${formatConfig(\n env.config\n )}`\n });\n\n if (!env.fs.existsSync(env.cachePath)) {\n await createDirectory(env.cachePath);\n }\n\n if (!env.fs.existsSync(env.dataPath)) {\n await createDirectory(env.dataPath);\n }\n\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"pre\"\n });\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"normal\"\n });\n\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"post\"\n });\n\n if (env.config.output.types !== false) {\n await handleTypes(context, env);\n }\n\n context.debug(\"Formatting files generated during the prepare step.\");\n\n await Promise.all([\n formatFolder(env, env.builtinsPath),\n formatFolder(env, env.entryPath)\n ]);\n\n await writeMetaFile(env);\n env.persistedMeta = env.meta;\n });\n\n timer();\n }\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n opts: {\n isEntry: boolean;\n } = { isEntry: false }\n ) {\n const normalizedId = removeVirtualPrefix(id);\n const normalizedImporter = importer\n ? removeVirtualPrefix(importer)\n : undefined;\n\n let result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.resolve(normalizedId, normalizedImporter, {\n isFile: true,\n ...opts\n });\n if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n return null;\n }\n\n const load = {\n filter:\n virtualModulePrefix !== false\n ? {\n id: VIRTUAL_MODULE_PREFIX_REGEX\n }\n : undefined,\n async handler(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n const normalizedId = removeVirtualPrefix(id);\n\n let result = await context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n normalizedId\n );\n if (result) {\n return result;\n }\n\n result = await context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n normalizedId\n );\n if (result) {\n return result;\n }\n\n result = await context.load(normalizedId);\n if (result) {\n return result;\n }\n\n return context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n normalizedId\n );\n }\n } as UnpluginOptions<TContext>[\"load\"];\n\n async function transform(\n code: string,\n id: string\n ): Promise<TransformResult> {\n return context.callHook(\n \"transform\",\n {\n environment: await context.getEnvironment(),\n result: \"merge\",\n asNextParam: previousResult => getString(previousResult)\n },\n getString(code),\n id\n );\n }\n\n async function writeBundle(): Promise<void> {\n context.logger.debug(\"Finalizing Powerlines project output...\");\n\n await context.callHook(\"writeBundle\", {\n environment: await context.getEnvironment()\n });\n }\n\n context.logger.debug(\"Unplugin initialized successfully.\");\n\n const result = {\n name: `${kebabCase(framework)}:${kebabCase(options.variant)}-plugin`,\n context,\n resolveId,\n load,\n transform,\n buildStart,\n writeBundle\n } as unknown as UnpluginOptions<TContext>;\n\n return {\n ...result,\n ...decorate(result)\n };\n } catch (error) {\n if (isFunction(context?.logger?.error)) {\n context.logger.error((error as Error)?.message);\n }\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HA,SAAgB,sBAGd,SACA,YAA+C,YAAW,SAC/B;CAC3B,IAAI,CAAC,yBAAyB,QAAQ,OAAO,GAC3C,MAAM,IAAI,MACR,qCAAqC,OAAO,QAAQ,OAAO,EAAE,qBAAqB,0BAA0B,KAC1G,IACF,EAAE,EACJ;CAGF,MAAM,MAAM,iBAAiB,QAAQ,IAAI,CAAC;CAC1C,MAAM,sBAAsB,QAAQ,uBAAuB;CAE3D,QAAQ,SAAS,CAAC,MAAiC;EACjD,IAAI;EAIJ,IAAI;GACF,MAAM,aACH,OAAO,WAAW,QAAQ,QAAQ,WAAW,SAAS;GACzD,MAAM,SACH,OAAO,WAAW,SAAS,QAAQ,WAAW,UAC/C;GAEF,MAAM,OAAO,YAAY,KAAK,OAAO,MAAM,OAAO,UAAU;GAE5D,eAAe,aAAsD;IACnE,MAAM,SAAS,MAAM,iBAAiB,KAAK,MAAM,WAAW,OAAO;KACjE,GAAG;KACH,SAAS;IACX,CAAC;IACD,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,8BAA8B;IAGhD,MAAM,UAAU,QAAQ,OAAO,MAAM;IACrC,IACE,OAAO,gBAAgB,UACvB,OAAO,eAAe,QAAQ,QAE9B,MAAM,IAAI,MACR,4BAA4B,OAAO,YAAY,oCAAoC,QAAQ,OAAO,eACpG;IAGF,MAAM,WAAW;KACf;KACA;KACA,GAAG;KACH,SAAS;KACT,YAAY,OAAO;KACnB,aAAa,KAAK;KAClB,aAAa;IACf;IAEA,UAAU,MAAM,2BAA2B,KACzC;KACE,GAAG;KACH,GAAG;KACH,YAAY,OAA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AAQ;KACR,cAAa,mBAAkB,UAAU,cAAc;IACzD,GACA,UAAU,IAAI,GACd,EACF;GACF;GAEA,eAAe,cAA6B;IAC1C,QAAQ,OAAO,MAAM,yCAAyC;IAE9D,MAAM,QAAQ,SAAS,eAAe,EACpC,aAAa,MAAM,QAAQ,eAAe,EAC5C,CAAC;GACH;GAEA,QAAQ,OAAO,MAAM,oCAAoC;GAEzD,MAAM,SAAS;IACb,MAAM,GAAG,UAAU,SAAS,EAAE,GAAG,UAAU,QAAQ,OAAO,EAAE;IAC5D;IACA;IACA;IACA;IACA;IACA;GACF;GAEA,OAAO;IACL,GAAG;IACH,GAAG,SAAS,MAAM;GACpB;EACF,SAAS,OAAO;GACd,IAAI,WAAW,SAAS,QAAQ,KAAK,GACnC,QAAQ,OAAO,MAAO,OAAiB,OAAO;GAGhD,MAAM;EACR;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"unplugin.mjs","names":[],"sources":["../src/unplugin.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 CustomLogger,\n ExecutionContext,\n Options,\n UnpluginBuilderVariant,\n UnpluginOptions\n} from \"@powerlines/core\";\nimport {\n formatFolder,\n handleTypes,\n initializeTsconfig,\n installDependencies,\n isUnpluginBuilderVariant,\n loadParsedConfig,\n resolveRoot,\n resolveTsconfig,\n writeMetaFile\n} from \"@powerlines/core\";\nimport { UNPLUGIN_BUILDER_VARIANTS } from \"@powerlines/core/constants\";\nimport { PowerlinesExecutionContext } from \"@powerlines/core/context/execution-context\";\nimport { resolvePluginConfig } from \"@powerlines/core/lib/context-helpers\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { getString } from \"@powerlines/core/lib/utilities/source-file\";\nimport {\n addVirtualPrefix,\n formatConfig,\n removeVirtualPrefix,\n VIRTUAL_MODULE_PREFIX_REGEX\n} from \"@powerlines/core/plugin-utils\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport { createDirectory } from \"@stryke/fs/helpers\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { LoadResult } from \"rolldown\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { UnpluginFactory } from \"./types\";\n\nexport * from \"@powerlines/core/lib/unplugin\";\n\n/**\n * The options required to create a Powerlines unplugin factory, which generates a plugin instance for a specific build variant and allows for optional customization of logging and framework identification.\n */\nexport interface UnpluginFactoryOptions extends Options {\n /**\n * The build variant for which to create the unplugin.\n *\n * @remarks\n * This option is required to ensure that the unplugin is built with the correct configuration and behavior for the intended build tool or framework. The variant will determine how the unplugin integrates with the build process and which hooks it will call during execution.\n */\n variant: UnpluginBuilderVariant;\n\n /**\n * An optional string prefix to use for virtual module IDs. This can be useful for ensuring that virtual modules are only processed by the plugin and not by other plugins or the bundler itself. If not provided, the default prefix `__powerlines-virtual:` will be used.\n *\n * @defaultValue \"\\\\0\"\n */\n virtualModulePrefix?: string | false;\n\n /**\n * A custom logger instance that implements the {@link CustomLogger} interface, which can be used for logging messages during the build process instead of the default Powerlines logger.\n *\n * @remarks\n * Providing a custom logger allows you to integrate Powerlines logging with your own logging system or to customize the logging behavior, such as formatting log messages differently or sending logs to an external service. If a custom logger is not provided, Powerlines will use its default logger implementation.\n */\n customLogger?: CustomLogger;\n}\n\nexport type UnpluginFactoryDecorator<TContext extends ExecutionContext> = (\n options: UnpluginOptions<TContext>\n) => Partial<UnpluginOptions<TContext>>;\n\n/**\n * Creates a Powerlines unplugin factory that generates a plugin instance.\n *\n * @remarks\n * The factory will handle loading the Powerlines configuration, resolving the plugin configuration, and executing the appropriate hooks during the build process. It also allows for optional customization of logging and framework identification through the provided options.\n *\n * @example\n * ```ts\n * import { createUnpluginFactory } from \"@powerlines/unplugin\";\n *\n * const factory = createUnpluginFactory({\n * variant: \"vite\",\n * framework: \"my-framework\",\n * orgId: \"my-org\",\n * customLogger: myCustomLogger\n * });\n *\n * const plugin = createVitePlugin(factory);\n * export default plugin;\n * ```\n *\n * @param options - The options for the unplugin factory, including the build variant and an optional custom logger.\n * @param decorate - An optional function to decorate the unplugin options.\n * @returns The unplugin factory that generates a plugin instance.\n */\nexport function createUnpluginFactory<\n TContext extends ExecutionContext = ExecutionContext\n>(\n options: UnpluginFactoryOptions,\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n): UnpluginFactory<TContext> {\n if (!isUnpluginBuilderVariant(options.variant)) {\n throw new Error(\n `Invalid unplugin builder variant: ${String(options.variant)}. Expected one of: ${UNPLUGIN_BUILDER_VARIANTS.join(\n \", \"\n )}.`\n );\n }\n\n const cwd = getWorkspaceRoot(process.cwd());\n const virtualModulePrefix = options.virtualModulePrefix ?? \"\\\\0\";\n\n return (params = {}): UnpluginOptions<TContext> => {\n let context!: PowerlinesExecutionContext<\n TContext[\"config\"],\n TContext[\"system\"]\n >;\n try {\n const framework =\n (params.framework?.name ?? options.framework?.name) || \"powerlines\";\n const orgId =\n (params.framework?.orgId ?? options.framework?.orgId) ||\n \"storm-software\";\n\n const root = resolveRoot(cwd, params.root, params.configFile);\n\n async function buildStart(this: UnpluginBuildContext): Promise<void> {\n const config = await loadParsedConfig(cwd, root, framework, orgId, {\n ...params,\n command: \"build\"\n });\n if (!config) {\n throw new Error(\"Failed to load configuration\");\n }\n\n const configs = toArray(config.config);\n if (\n params.configIndex !== undefined &&\n params.configIndex >= configs.length\n ) {\n throw new Error(\n `Invalid execution index: ${params.configIndex}. The configuration file contains ${configs.length} execution(s).`\n );\n }\n\n const _options = {\n cwd,\n root,\n ...params,\n command: \"build\",\n configFile: config.configFile!,\n executionId: uuid(),\n configIndex: 0\n };\n\n context = await PowerlinesExecutionContext.from(\n {\n ...options,\n ..._options,\n configFile: config.configFile!\n },\n _options\n );\n context.logger.info(\n `Starting ${titleCase(framework)} ${titleCase(options.variant)} plugin execution`\n );\n\n context.logger.debug({\n meta: { category: \"config\" },\n message: `Invoking ${titleCase(framework)} ${titleCase(\n options.variant\n )} plugin with the following execution parameters: \\n --- Execution Options --- \\n${formatConfig(\n params\n )}`\n });\n\n await resolvePluginConfig(context);\n\n const timer = context.timer(\"Preparation\");\n\n await executeEnvironments(context, async env => {\n env.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"pre\"\n });\n\n await initializeTsconfig(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"normal\"\n });\n\n if (env.entry.length > 0) {\n const entriesLength = isObject(env.config.input)\n ? Object.keys(env.config.input).length\n : toArray(env.config.input).length;\n env.debug(\n `The configuration provided ${entriesLength} entry point${\n entriesLength !== 1 ? \"s\" : \"\"\n }, Powerlines has found ${env.entry.length} entry file${\n env.entry.length !== 1 ? \"s\" : \"\"\n } for the ${env.config.title} project${\n env.entry.length > 0 && env.entry.length < 10\n ? `: \\n${env.entry\n .map(\n entry =>\n `- ${replacePath(entry.file, context.config.root)}${\n entry.output\n ? ` -> ${replacePath(\n entry.output,\n context.config.root\n )}`\n : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n env.warn(\n `No entry files were found for the ${\n env.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig(env);\n await installDependencies(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"post\"\n });\n\n env.trace({\n meta: {\n category: \"config\"\n },\n message: `Powerlines configuration after configResolved hook: \\n${formatConfig(\n env.config\n )}`\n });\n\n if (!env.fs.existsSync(env.cachePath)) {\n await createDirectory(env.cachePath);\n }\n\n if (!env.fs.existsSync(env.dataPath)) {\n await createDirectory(env.dataPath);\n }\n\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"pre\"\n });\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"normal\"\n });\n\n await context.callHook(\"prepare\", {\n environment: env,\n order: \"post\"\n });\n\n if (env.config.output.types !== false) {\n await handleTypes(context, env);\n }\n\n context.debug(\"Formatting files generated during the prepare step.\");\n\n await Promise.all([\n formatFolder(env, env.builtinsPath),\n formatFolder(env, env.entryPath)\n ]);\n\n await writeMetaFile(env);\n env.persistedMeta = env.meta;\n });\n\n timer();\n }\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n opts: {\n isEntry: boolean;\n } = { isEntry: false }\n ) {\n const normalizedId = removeVirtualPrefix(id);\n const normalizedImporter = importer\n ? removeVirtualPrefix(importer)\n : undefined;\n\n let result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.resolve(normalizedId, normalizedImporter, {\n isFile: true,\n ...opts\n });\n if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n result = await context.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n normalizedId,\n normalizedImporter,\n opts\n );\n if (isSetString(result)) {\n return result;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id:\n result.virtual && virtualModulePrefix !== false\n ? addVirtualPrefix(result.id)\n : result.id\n };\n }\n\n return null;\n }\n\n const load = {\n filter:\n virtualModulePrefix !== false\n ? {\n id: VIRTUAL_MODULE_PREFIX_REGEX\n }\n : undefined,\n async handler(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n const normalizedId = removeVirtualPrefix(id);\n\n let result = await context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n normalizedId\n );\n if (result) {\n return result;\n }\n\n result = await context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n normalizedId\n );\n if (result) {\n return result;\n }\n\n result = await context.load(normalizedId);\n if (result) {\n return result;\n }\n\n return context.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n normalizedId\n );\n }\n } as UnpluginOptions<TContext>[\"load\"];\n\n async function transform(\n code: string,\n id: string\n ): Promise<TransformResult> {\n return context.callHook(\n \"transform\",\n {\n environment: await context.getEnvironment(),\n result: \"merge\",\n asNextParam: previousResult => getString(previousResult)\n },\n getString(code),\n id\n );\n }\n\n async function writeBundle(): Promise<void> {\n context.logger.debug(\"Finalizing Powerlines project output...\");\n\n await context.callHook(\"writeBundle\", {\n environment: await context.getEnvironment()\n });\n }\n\n context.logger.debug(\"Unplugin initialized successfully.\");\n\n const result = {\n name: `${kebabCase(framework)}:${kebabCase(options.variant)}-plugin`,\n context,\n resolveId,\n load,\n transform,\n buildStart,\n writeBundle\n } as unknown as UnpluginOptions<TContext>;\n\n return {\n ...result,\n ...decorate(result)\n };\n } catch (error) {\n if (isFunction(context?.logger?.error)) {\n context.logger.error((error as Error)?.message);\n }\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HA,SAAgB,sBAGd,SACA,YAA+C,YAAW,SAC/B;CAC3B,IAAI,CAAC,yBAAyB,QAAQ,OAAO,GAC3C,MAAM,IAAI,MACR,qCAAqC,OAAO,QAAQ,OAAO,EAAE,qBAAqB,0BAA0B,KAC1G,IACF,EAAE,EACJ;CAGF,MAAM,MAAM,iBAAiB,QAAQ,IAAI,CAAC;CAC1C,MAAM,sBAAsB,QAAQ,uBAAuB;CAE3D,QAAQ,SAAS,CAAC,MAAiC;EACjD,IAAI;EAIJ,IAAI;GACF,MAAM,aACH,OAAO,WAAW,QAAQ,QAAQ,WAAW,SAAS;GACzD,MAAM,SACH,OAAO,WAAW,SAAS,QAAQ,WAAW,UAC/C;GAEF,MAAM,OAAO,YAAY,KAAK,OAAO,MAAM,OAAO,UAAU;GAE5D,eAAe,aAAsD;IACnE,MAAM,SAAS,MAAM,iBAAiB,KAAK,MAAM,WAAW,OAAO;KACjE,GAAG;KACH,SAAS;IACX,CAAC;IACD,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,8BAA8B;IAGhD,MAAM,UAAU,QAAQ,OAAO,MAAM;IACrC,IACE,OAAO,gBAAgB,UACvB,OAAO,eAAe,QAAQ,QAE9B,MAAM,IAAI,MACR,4BAA4B,OAAO,YAAY,oCAAoC,QAAQ,OAAO,eACpG;IAGF,MAAM,WAAW;KACf;KACA;KACA,GAAG;KACH,SAAS;KACT,YAAY,OAAO;KACnB,aAAa,KAAK;KAClB,aAAa;IACf;IAEA,UAAU,MAAM,2BAA2B,K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A;KACE,aAAa,MAAM,QAAQ,eAAe;KAC1C,QAAQ;KACR,cAAa,mBAAkB,UAAU,cAAc;IACzD,GACA,UAAU,IAAI,GACd,EACF;GACF;GAEA,eAAe,cAA6B;IAC1C,QAAQ,OAAO,MAAM,yCAAyC;IAE9D,MAAM,QAAQ,SAAS,eAAe,EACpC,aAAa,MAAM,QAAQ,eAAe,EAC5C,CAAC;GACH;GAEA,QAAQ,OAAO,MAAM,oCAAoC;GAEzD,MAAM,SAAS;IACb,MAAM,GAAG,UAAU,SAAS,EAAE,GAAG,UAAU,QAAQ,OAAO,EAAE;IAC5D;IACA;IACA;IACA;IACA;IACA;GACF;GAEA,OAAO;IACL,GAAG;IACH,GAAG,SAAS,MAAM;GACpB;EACF,SAAS,OAAO;GACd,IAAI,WAAW,SAAS,QAAQ,KAAK,GACnC,QAAQ,OAAO,MAAO,OAAiB,OAAO;GAGhD,MAAM;EACR;CACF;AACF"}
|
package/dist/vite.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');
|