@powerlines/unplugin 0.0.76 → 0.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/dist/astro.cjs +0 -19
  2. package/dist/astro.d.mts +0 -2
  3. package/dist/astro.d.mts.map +1 -1
  4. package/dist/astro.mjs +1 -14
  5. package/dist/astro.mjs.map +1 -1
  6. package/dist/{_virtual/_rolldown/runtime.mjs → chunk-BUUfjzRC.mjs} +1 -9
  7. package/dist/esbuild.cjs +2 -11
  8. package/dist/esbuild.d.cts +2 -2
  9. package/dist/esbuild.d.cts.map +1 -1
  10. package/dist/esbuild.d.mts +1 -3
  11. package/dist/esbuild.d.mts.map +1 -1
  12. package/dist/esbuild.mjs +0 -8
  13. package/dist/esbuild.mjs.map +1 -1
  14. package/dist/farm.cjs +2 -21
  15. package/dist/farm.d.cts +2 -2
  16. package/dist/farm.d.cts.map +1 -1
  17. package/dist/farm.d.mts +1 -3
  18. package/dist/farm.d.mts.map +1 -1
  19. package/dist/farm.mjs +1 -14
  20. package/dist/farm.mjs.map +1 -1
  21. package/dist/index.cjs +4 -14
  22. package/dist/index.d.cts +1 -1
  23. package/dist/index.d.mts +0 -2
  24. package/dist/index.d.mts.map +1 -1
  25. package/dist/index.mjs +3 -12
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/next.cjs +1 -20
  28. package/dist/next.d.mts +0 -2
  29. package/dist/next.d.mts.map +1 -1
  30. package/dist/next.mjs +1 -14
  31. package/dist/next.mjs.map +1 -1
  32. package/dist/nuxt-DRZ7K3-X.cjs +52 -0
  33. package/dist/nuxt-Dj7SOTWN.mjs +48 -0
  34. package/dist/nuxt-Dj7SOTWN.mjs.map +1 -0
  35. package/dist/nuxt.cjs +3 -59
  36. package/dist/nuxt.d.mts +0 -2
  37. package/dist/nuxt.d.mts.map +1 -1
  38. package/dist/nuxt.mjs +3 -53
  39. package/dist/rolldown.cjs +6 -27
  40. package/dist/rolldown.d.cts +2 -2
  41. package/dist/rolldown.d.cts.map +1 -1
  42. package/dist/rolldown.d.mts +1 -3
  43. package/dist/rolldown.d.mts.map +1 -1
  44. package/dist/rolldown.mjs +1 -16
  45. package/dist/rolldown.mjs.map +1 -1
  46. package/dist/rollup.cjs +7 -29
  47. package/dist/rollup.d.cts +2 -2
  48. package/dist/rollup.d.cts.map +1 -1
  49. package/dist/rollup.d.mts +1 -3
  50. package/dist/rollup.d.mts.map +1 -1
  51. package/dist/rollup.mjs +1 -17
  52. package/dist/rollup.mjs.map +1 -1
  53. package/dist/rspack.cjs +3 -24
  54. package/dist/rspack.d.cts +2 -2
  55. package/dist/rspack.d.cts.map +1 -1
  56. package/dist/rspack.d.mts +1 -3
  57. package/dist/rspack.d.mts.map +1 -1
  58. package/dist/rspack.mjs +1 -16
  59. package/dist/rspack.mjs.map +1 -1
  60. package/dist/tsdown.cjs +3 -26
  61. package/dist/tsdown.d.mts +0 -2
  62. package/dist/tsdown.d.mts.map +1 -1
  63. package/dist/tsdown.mjs +1 -19
  64. package/dist/tsdown.mjs.map +1 -1
  65. package/dist/tsup.cjs +3 -24
  66. package/dist/tsup.d.mts +0 -2
  67. package/dist/tsup.d.mts.map +1 -1
  68. package/dist/tsup.mjs +1 -17
  69. package/dist/tsup.mjs.map +1 -1
  70. package/dist/types-CEaXoKbk.d.cts +13 -0
  71. package/dist/types-CEaXoKbk.d.cts.map +1 -0
  72. package/dist/types.cjs +0 -21
  73. package/dist/types.d.cts +2 -11
  74. package/dist/types.d.mts +0 -2
  75. package/dist/types.d.mts.map +1 -1
  76. package/dist/types.mjs +1 -16
  77. package/dist/unloader.cjs +2 -22
  78. package/dist/unloader.d.cts +2 -2
  79. package/dist/unloader.d.cts.map +1 -1
  80. package/dist/unloader.d.mts +1 -3
  81. package/dist/unloader.d.mts.map +1 -1
  82. package/dist/unloader.mjs +1 -15
  83. package/dist/unloader.mjs.map +1 -1
  84. package/dist/unplugin-WjPT9ECw.cjs +296 -0
  85. package/dist/unplugin.cjs +2 -248
  86. package/dist/unplugin.d.cts +1 -1
  87. package/dist/unplugin.d.cts.map +1 -1
  88. package/dist/unplugin.d.mts +0 -2
  89. package/dist/unplugin.d.mts.map +1 -1
  90. package/dist/unplugin.mjs +2 -13
  91. package/dist/unplugin.mjs.map +1 -1
  92. package/dist/vite.cjs +2 -11
  93. package/dist/vite.d.cts +2 -2
  94. package/dist/vite.d.cts.map +1 -1
  95. package/dist/vite.d.mts +1 -3
  96. package/dist/vite.d.mts.map +1 -1
  97. package/dist/vite.mjs +0 -8
  98. package/dist/vite.mjs.map +1 -1
  99. package/dist/webpack.cjs +3 -24
  100. package/dist/webpack.d.cts +2 -2
  101. package/dist/webpack.d.cts.map +1 -1
  102. package/dist/webpack.d.mts +1 -3
  103. package/dist/webpack.d.mts.map +1 -1
  104. package/dist/webpack.mjs +1 -16
  105. package/dist/webpack.mjs.map +1 -1
  106. package/package.json +3 -67
  107. package/dist/_virtual/_rolldown/runtime.cjs +0 -53
  108. package/dist/astro.test.cjs +0 -23
  109. package/dist/astro.test.d.cts +0 -1
  110. package/dist/astro.test.d.mts +0 -2
  111. package/dist/astro.test.mjs +0 -25
  112. package/dist/astro.test.mjs.map +0 -1
  113. package/dist/esbuild.test.cjs +0 -32
  114. package/dist/esbuild.test.d.cts +0 -1
  115. package/dist/esbuild.test.d.mts +0 -2
  116. package/dist/esbuild.test.mjs +0 -34
  117. package/dist/esbuild.test.mjs.map +0 -1
  118. package/dist/farm.test.cjs +0 -23
  119. package/dist/farm.test.d.cts +0 -1
  120. package/dist/farm.test.d.mts +0 -2
  121. package/dist/farm.test.mjs +0 -25
  122. package/dist/farm.test.mjs.map +0 -1
  123. package/dist/index.test.cjs +0 -35
  124. package/dist/index.test.d.cts +0 -1
  125. package/dist/index.test.d.mts +0 -2
  126. package/dist/index.test.mjs +0 -37
  127. package/dist/index.test.mjs.map +0 -1
  128. package/dist/next.test.cjs +0 -23
  129. package/dist/next.test.d.cts +0 -1
  130. package/dist/next.test.d.mts +0 -2
  131. package/dist/next.test.mjs +0 -25
  132. package/dist/next.test.mjs.map +0 -1
  133. package/dist/nuxt.mjs.map +0 -1
  134. package/dist/nuxt.test.cjs +0 -23
  135. package/dist/nuxt.test.d.cts +0 -1
  136. package/dist/nuxt.test.d.mts +0 -2
  137. package/dist/nuxt.test.mjs +0 -25
  138. package/dist/nuxt.test.mjs.map +0 -1
  139. package/dist/package.cjs +0 -26
  140. package/dist/package.mjs +0 -15
  141. package/dist/package.mjs.map +0 -1
  142. package/dist/rolldown.test.cjs +0 -23
  143. package/dist/rolldown.test.d.cts +0 -1
  144. package/dist/rolldown.test.d.mts +0 -2
  145. package/dist/rolldown.test.mjs +0 -25
  146. package/dist/rolldown.test.mjs.map +0 -1
  147. package/dist/rollup.test.cjs +0 -23
  148. package/dist/rollup.test.d.cts +0 -1
  149. package/dist/rollup.test.d.mts +0 -2
  150. package/dist/rollup.test.mjs +0 -25
  151. package/dist/rollup.test.mjs.map +0 -1
  152. package/dist/rspack.test.cjs +0 -23
  153. package/dist/rspack.test.d.cts +0 -1
  154. package/dist/rspack.test.d.mts +0 -2
  155. package/dist/rspack.test.mjs +0 -25
  156. package/dist/rspack.test.mjs.map +0 -1
  157. package/dist/tsdown.test.cjs +0 -23
  158. package/dist/tsdown.test.d.cts +0 -1
  159. package/dist/tsdown.test.d.mts +0 -2
  160. package/dist/tsdown.test.mjs +0 -25
  161. package/dist/tsdown.test.mjs.map +0 -1
  162. package/dist/tsup.test.cjs +0 -23
  163. package/dist/tsup.test.d.cts +0 -1
  164. package/dist/tsup.test.d.mts +0 -2
  165. package/dist/tsup.test.mjs +0 -25
  166. package/dist/tsup.test.mjs.map +0 -1
  167. package/dist/types.d.cts.map +0 -1
  168. package/dist/types.mjs.map +0 -1
  169. package/dist/types.test.cjs +0 -23
  170. package/dist/types.test.d.cts +0 -1
  171. package/dist/types.test.d.mts +0 -2
  172. package/dist/types.test.mjs +0 -25
  173. package/dist/types.test.mjs.map +0 -1
  174. package/dist/unloader.test.cjs +0 -23
  175. package/dist/unloader.test.d.cts +0 -1
  176. package/dist/unloader.test.d.mts +0 -2
  177. package/dist/unloader.test.mjs +0 -25
  178. package/dist/unloader.test.mjs.map +0 -1
  179. package/dist/unplugin.test.cjs +0 -23
  180. package/dist/unplugin.test.d.cts +0 -1
  181. package/dist/unplugin.test.d.mts +0 -2
  182. package/dist/unplugin.test.mjs +0 -25
  183. package/dist/unplugin.test.mjs.map +0 -1
  184. package/dist/vite.test.cjs +0 -26
  185. package/dist/vite.test.d.cts +0 -1
  186. package/dist/vite.test.d.mts +0 -2
  187. package/dist/vite.test.mjs +0 -28
  188. package/dist/vite.test.mjs.map +0 -1
  189. package/dist/webpack.test.cjs +0 -23
  190. package/dist/webpack.test.d.cts +0 -1
  191. package/dist/webpack.test.d.mts +0 -2
  192. package/dist/webpack.test.mjs +0 -25
  193. package/dist/webpack.test.mjs.map +0 -1
package/dist/unplugin.mjs CHANGED
@@ -1,12 +1,4 @@
1
-
2
-
3
- import __tsdown_shims_path from 'node:path'
4
- import __tsdown_shims_url from 'node:url'
5
-
6
- const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
7
- const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
8
-
9
- import { __exportAll, __reExport } from "./_virtual/_rolldown/runtime.mjs";
1
+ import { n as __reExport, t as __exportAll } from "./chunk-BUUfjzRC.mjs";
10
2
  import { replacePath } from "@stryke/path/replace";
11
3
  import { formatFolder, handleTypes, initializeTsconfig, installDependencies, isUnpluginBuilderVariant, loadParsedConfig, resolveRoot, resolveTsconfig, writeMetaFile } from "@powerlines/core";
12
4
  import { UNPLUGIN_BUILDER_VARIANTS } from "@powerlines/core/constants";
@@ -28,9 +20,6 @@ import { isSetString } from "@stryke/type-checks/is-set-string";
28
20
  export * from "@powerlines/core/lib/unplugin"
29
21
 
30
22
  //#region src/unplugin.ts
31
- var unplugin_exports = /* @__PURE__ */ __exportAll({ createUnpluginFactory: () => createUnpluginFactory });
32
- import * as import__powerlines_core_lib_unplugin from "@powerlines/core/lib/unplugin";
33
- __reExport(unplugin_exports, import__powerlines_core_lib_unplugin);
34
23
  /**
35
24
  * Creates a Powerlines unplugin factory that generates a plugin instance.
36
25
  *
@@ -243,5 +232,5 @@ function createUnpluginFactory(options, decorate = (options) => options) {
243
232
  }
244
233
 
245
234
  //#endregion
246
- export { createUnpluginFactory, unplugin_exports };
235
+ export { createUnpluginFactory };
247
236
  //# sourceMappingURL=unplugin.mjs.map
@@ -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 formatExecutionId,\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 { 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!: ExecutionContext<TContext[\"config\"], TContext[\"system\"]>;\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: formatExecutionId(\n config.config.name || root,\n \"build\",\n 0\n ),\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 (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F;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 formatExecutionId,\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 { 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!: ExecutionContext<TContext[\"config\"], TContext[\"system\"]>;\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: formatExecutionId(\n config.config.name || root,\n \"build\",\n 0\n ),\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;EACJ,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,kBACX,OAAO,OAAO,QAAQ,MACtB,SACA,CACF;KACA,aAAa;IACf;IAEA,UAAU,MAAM,2BAA2B,KACzC;KACE,GAAG;KACH,GAAG;KACH,YAAY,OAAO;IACrB,GACA,QACF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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,14 +1,5 @@
1
-
2
-
3
- import __tsdown_shims_path from 'node:path'
4
- import __tsdown_shims_url from 'node:url'
5
-
6
- const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
7
- const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
8
-
9
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
10
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
11
- const require_unplugin = require('./unplugin.cjs');
2
+ const require_unplugin = require('./unplugin-WjPT9ECw.cjs');
12
3
  const require_esbuild = require('./esbuild.cjs');
13
4
  const require_rolldown = require('./rolldown.cjs');
14
5
  let _stryke_env_environment_checks = require("@stryke/env/environment-checks");
@@ -16,7 +7,7 @@ let _stryke_path_append = require("@stryke/path/append");
16
7
  let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
17
8
  let _stryke_path_join_paths = require("@stryke/path/join-paths");
18
9
  let defu = require("defu");
19
- defu = require_runtime.__toESM(defu, 1);
10
+ defu = require_unplugin.__toESM(defu, 1);
20
11
  let unplugin = require("unplugin");
21
12
 
22
13
  //#region src/vite.ts
package/dist/vite.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { UnpluginExecutionOptions, UnpluginFactory } from "./types.cjs";
1
+ import { r as UnpluginFactory, t as UnpluginExecutionOptions } from "./types-CEaXoKbk.cjs";
2
2
  import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
3
3
  import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
4
4
  import { UserConfig as UserConfig$1 } from "vite";
@@ -34,7 +34,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
34
34
  * @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.
35
35
  * @returns A function that generates a Vite plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Vite build.
36
36
  */
37
- declare function createViteFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
37
+ declare function createViteFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig<import("@powerlines/core").UserConfig, import("@powerlines/core").ExecutionOptions>, any>>;
38
38
  /**
39
39
  * A Vite plugin that will invoke the Powerlines API hooks during the build process.
40
40
  *
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.cts","names":[],"sources":["../src/vite.ts"],"mappings":";;;;;;cAsCa,eAAA,EAAiB,OAAO,CAAC,YAAA;;;AAAtC;;;;iBAiBgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,YAAA;AAFH;;;;;;;;;;;;;;AAEa;AAuFb;;;;;;;AAzFA,iBAyFgB,iBAAA,kBAAmC,gBAAA,EACjD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;;;;;;;;;;;;cAqGtD,MAAA,GAAM,OAAA,GAAwC,wBAAxC,gCAAA,MAAA,uBAAA,MAAA"}
1
+ {"version":3,"file":"vite.d.cts","names":[],"sources":["../src/vite.ts"],"mappings":";;;;;;cAsCa,eAAA,EAAiB,OAAO,CAAC,YAAA;;;AAAtC;;;;iBAiBgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,YAAA;AAFH;;;;;;;;;;;;;;AAEa;AAuFb;;;;;;;AAzFA,iBAyFgB,iBAAA,kBAAmC,gBAAA,EACjD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA,4BAAA,UAAA,6BAAA,gBAAA;;;;;;;;;;;;;;;;;cAqGtD,MAAA,GAAM,OAAA,GAAwC,wBAAxC,gCAAA,MAAA,uBAAA,MAAA"}
package/dist/vite.d.mts CHANGED
@@ -1,5 +1,3 @@
1
- import __tsdown_shims_path from 'node:path';
2
- import __tsdown_shims_url from 'node:url';
3
1
  import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
4
2
  import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
5
3
  import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
@@ -36,7 +34,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
36
34
  * @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.
37
35
  * @returns A function that generates a Vite plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Vite build.
38
36
  */
39
- declare function createViteFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
37
+ declare function createViteFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig<import("@powerlines/core").UserConfig, import("@powerlines/core").ExecutionOptions>, any>>;
40
38
  /**
41
39
  * A Vite plugin that will invoke the Powerlines API hooks during the build process.
42
40
  *
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.mts","names":[],"sources":["../src/vite.ts"],"mappings":";;;;;;;;cAsCa,eAAA,EAAiB,OAAO,CAAC,YAAA;;;;;;;iBAiBtB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,YAAA;;;;AAnBH;;;;AAAgD;AAiBhD;;;;;;;;;;;;;;iBAyFgB,iBAAA,kBAAmC,gBAAA,EACjD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;AAFnE;;;;;;;;;;;;;;;;AAAA,cAuGa,MAAA,GAAM,OAAA,GAAwC,wBAAxC,gCAAA,MAAA,uBAAA,MAAA"}
1
+ {"version":3,"file":"vite.d.mts","names":[],"sources":["../src/vite.ts"],"mappings":";;;;;;cAsCa,eAAA,EAAiB,OAAO,CAAC,YAAA;;;AAAtC;;;;iBAiBgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,YAAA;AAFH;;;;;;;;;;;;;;AAEa;AAuFb;;;;;;;AAzFA,iBAyFgB,iBAAA,kBAAmC,gBAAA,EACjD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA,4BAAA,UAAA,6BAAA,gBAAA;;;;;;;;;;;;;;;;;cAqGtD,MAAA,GAAM,OAAA,GAAwC,wBAAxC,gCAAA,MAAA,uBAAA,MAAA"}
package/dist/vite.mjs CHANGED
@@ -1,11 +1,3 @@
1
-
2
-
3
- import __tsdown_shims_path from 'node:path'
4
- import __tsdown_shims_url from 'node:url'
5
-
6
- const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
7
- const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
8
-
9
1
  import { createUnpluginFactory } from "./unplugin.mjs";
10
2
  import { resolveOptions as resolveOptions$1 } from "./esbuild.mjs";
11
3
  import { resolveOptions as resolveOptions$2 } from "./rolldown.mjs";
package/dist/vite.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.mjs","names":["resolveEsbuildOptions","resolveRolldownOptions"],"sources":["../src/vite.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 { isDevelopmentMode, isTestMode } from \"@stryke/env/environment-checks\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { createVitePlugin } from \"unplugin\";\nimport { ESBuildOptions, UserConfig } from \"vite\";\nimport { resolveOptions as resolveEsbuildOptions } from \"./esbuild\";\nimport { resolveOptions as resolveRolldownOptions } from \"./rolldown\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\nexport const DEFAULT_OPTIONS: Partial<UserConfig> = {\n resolve: {\n extensions: [\".mjs\", \".js\", \".mts\", \".ts\", \".jsx\", \".tsx\", \".json\"]\n },\n json: {\n stringify: true\n },\n logLevel: \"silent\",\n clearScreen: true\n};\n\n/**\n * Resolves the options for [vite](https://vitejs.dev/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): UserConfig {\n return defu(\n {\n define: context.config.define,\n root: appendPath(context.config.root, context.config.cwd),\n platform: context.config.platform,\n mode:\n context.config.mode === \"development\" ? \"development\" : \"production\",\n cacheDir: joinPaths(context.cachePath, \"vite\"),\n build: {\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap,\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 tsconfigRaw: context.tsconfig.tsconfigJson\n },\n resolve: {\n alias: 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 dedupe: context.config.resolve.dedupe,\n mainFields: context.config.resolve.mainFields,\n conditions: context.config.resolve.conditions,\n extensions: context.config.resolve.extensions\n },\n esbuild: resolveEsbuildOptions(context) as ESBuildOptions,\n optimizeDeps: {\n extensions: context.config.resolve.extensions,\n rolldownOptions: resolveRolldownOptions(context),\n esbuildOptions: resolveEsbuildOptions(context)\n },\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"info\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"error\",\n clearScreen: true,\n envDir: context.config.root\n } as UserConfig,\n DEFAULT_OPTIONS\n );\n}\n\n/**\n * Creates a Vite plugin factory that generates a plugin instance.\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-api\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { createViteFactory } from \"@powerlines/unplugin/vite\";\n *\n * const powerlinesPlugin = createViteFactory({ 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 Vite plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Vite build.\n */\nexport function createViteFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"vite\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n vite: {\n sharedDuringBuild: true,\n\n async hotUpdate(opts) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:hotUpdate\",\n { environment },\n opts\n );\n },\n async config(config, env) {\n unplugin.context.config.mode = isDevelopmentMode(env.mode)\n ? \"development\"\n : isTestMode(env.mode)\n ? \"test\"\n : \"production\";\n\n const environment = await unplugin.context.getEnvironment();\n const result = await unplugin.context.callHook(\n \"vite:config\",\n { environment },\n config,\n env\n );\n\n return defu(\n resolveOptions(unplugin.context),\n result?.build ?? {},\n config\n ) as Omit<UserConfig, \"plugins\">;\n },\n async configResolved(_config) {\n const environment = await unplugin.context.getEnvironment();\n\n await unplugin.context.callHook(\"configResolved\", { environment });\n },\n async configureServer(server) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:configureServer\",\n { environment },\n server\n );\n },\n async configurePreviewServer(server) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:configurePreviewServer\",\n { environment },\n server\n );\n },\n async transformIndexHtml(html, ctx) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:transformIndexHtml\",\n { environment },\n html,\n ctx\n );\n },\n async handleHotUpdate(ctx) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:handleHotUpdate\",\n { environment },\n ctx\n );\n }\n }\n })\n );\n}\n\n/**\n * A Vite plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-api\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import powerlines from \"@powerlines/unplugin/vite\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const plugin = createVitePlugin(createViteFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA,MAAa,kBAAuC;CAClD,SAAS,EACP,YAAY;EAAC;EAAQ;EAAO;EAAQ;EAAO;EAAQ;EAAQ;CAAO,EACpE;CACA,MAAM,EACJ,WAAW,KACb;CACA,UAAU;CACV,aAAa;AACf;;;;;;;AAQA,SAAgB,eACd,SACY;CACZ,OAAO,KACL;EACE,QAAQ,QAAQ,OAAO;EACvB,MAAM,WAAW,QAAQ,OAAO,MAAM,QAAQ,OAAO,GAAG;EACxD,UAAU,QAAQ,OAAO;EACzB,MACE,QAAQ,OAAO,SAAS,gBAAgB,gBAAgB;EAC1D,UAAU,UAAU,QAAQ,WAAW,MAAM;EAC7C,OAAO;GAC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,SACtB,kBACA,EAAE,YAAY,GACd,IACF;GACF;GACA,MAAM,OAAO,QAAQ,KAAK;IACxB,SAAS,QAAQ,OAAO,OAAO,kBAAkB,IAAI,IAAI,IACrD,gBACA,WAAW,IAAI,IAAI,IACjB,SACA;IAEN,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;IAC1D,MAAM,SAAS,MAAM,SAAS,QAAQ,SACpC,eACA,EAAE,YAAY,GACd,QACA,GACF;IAEA,OAAO,KACL,eAAe,SAAS,OAAO,GAC/B,QAAQ,SAAS,CAAC,GAClB,MACF;GACF;GACA,MAAM,eAAe,SAAS;IAC5B,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;IAE1D,MAAM,SAAS,QAAQ,SAAS,kBAAkB,EAAE,YAAY,CAAC;GACnE;GACA,MAAM,gBAAgB,QAAQ;IAC5B,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;IAE1D,OAAO,SAAS,QAAQ,SACtB,wBACA,EAAE,YAAY,GACd,MACF;GACF;GACA,MAAM,uBAAuB,QAAQ;IACnC,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;IAE1D,OAAO,SAAS,QAAQ,SACtB,+BACA,EAAE,YAAY,GACd,MACF;GACF;GACA,MAAM,mBAAmB,MAAM,KAAK;IAClC,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;IAE1D,OAAO,SAAS,QAAQ,SACtB,2BACA,EAAE,YAAY,GACd,MACA,GACF;GACF;GACA,MAAM,gBAAgB,KAAK;IACzB,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;IAE1D,OAAO,SAAS,QAAQ,SACtB,wBACA,EAAE,YAAY,GACd,GACF;GACF;EACF;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;;AAkBA,MAAa,SAAS,iBAAiB,kBAAkB,CAAC"}
1
+ {"version":3,"file":"vite.mjs","names":["resolveEsbuildOptions","resolveRolldownOptions"],"sources":["../src/vite.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 { isDevelopmentMode, isTestMode } from \"@stryke/env/environment-checks\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { createVitePlugin } from \"unplugin\";\nimport { ESBuildOptions, UserConfig } from \"vite\";\nimport { resolveOptions as resolveEsbuildOptions } from \"./esbuild\";\nimport { resolveOptions as resolveRolldownOptions } from \"./rolldown\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\nexport const DEFAULT_OPTIONS: Partial<UserConfig> = {\n resolve: {\n extensions: [\".mjs\", \".js\", \".mts\", \".ts\", \".jsx\", \".tsx\", \".json\"]\n },\n json: {\n stringify: true\n },\n logLevel: \"silent\",\n clearScreen: true\n};\n\n/**\n * Resolves the options for [vite](https://vitejs.dev/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): UserConfig {\n return defu(\n {\n define: context.config.define,\n root: appendPath(context.config.root, context.config.cwd),\n platform: context.config.platform,\n mode:\n context.config.mode === \"development\" ? \"development\" : \"production\",\n cacheDir: joinPaths(context.cachePath, \"vite\"),\n build: {\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap,\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 tsconfigRaw: context.tsconfig.tsconfigJson\n },\n resolve: {\n alias: 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 dedupe: context.config.resolve.dedupe,\n mainFields: context.config.resolve.mainFields,\n conditions: context.config.resolve.conditions,\n extensions: context.config.resolve.extensions\n },\n esbuild: resolveEsbuildOptions(context) as ESBuildOptions,\n optimizeDeps: {\n extensions: context.config.resolve.extensions,\n rolldownOptions: resolveRolldownOptions(context),\n esbuildOptions: resolveEsbuildOptions(context)\n },\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"info\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"error\",\n clearScreen: true,\n envDir: context.config.root\n } as UserConfig,\n DEFAULT_OPTIONS\n );\n}\n\n/**\n * Creates a Vite plugin factory that generates a plugin instance.\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-api\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { createViteFactory } from \"@powerlines/unplugin/vite\";\n *\n * const powerlinesPlugin = createViteFactory({ 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 Vite plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Vite build.\n */\nexport function createViteFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"vite\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n vite: {\n sharedDuringBuild: true,\n\n async hotUpdate(opts) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:hotUpdate\",\n { environment },\n opts\n );\n },\n async config(config, env) {\n unplugin.context.config.mode = isDevelopmentMode(env.mode)\n ? \"development\"\n : isTestMode(env.mode)\n ? \"test\"\n : \"production\";\n\n const environment = await unplugin.context.getEnvironment();\n const result = await unplugin.context.callHook(\n \"vite:config\",\n { environment },\n config,\n env\n );\n\n return defu(\n resolveOptions(unplugin.context),\n result?.build ?? {},\n config\n ) as Omit<UserConfig, \"plugins\">;\n },\n async configResolved(_config) {\n const environment = await unplugin.context.getEnvironment();\n\n await unplugin.context.callHook(\"configResolved\", { environment });\n },\n async configureServer(server) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:configureServer\",\n { environment },\n server\n );\n },\n async configurePreviewServer(server) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:configurePreviewServer\",\n { environment },\n server\n );\n },\n async transformIndexHtml(html, ctx) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:transformIndexHtml\",\n { environment },\n html,\n ctx\n );\n },\n async handleHotUpdate(ctx) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:handleHotUpdate\",\n { environment },\n ctx\n );\n }\n }\n })\n );\n}\n\n/**\n * A Vite plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-api\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import powerlines from \"@powerlines/unplugin/vite\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\n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F;GACF;GACA,MAAM,mBAAmB,MAAM,KAAK;IAClC,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;IAE1D,OAAO,SAAS,QAAQ,SACtB,2BACA,EAAE,YAAY,GACd,MACA,GACF;GACF;GACA,MAAM,gBAAgB,KAAK;IACzB,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;IAE1D,OAAO,SAAS,QAAQ,SACtB,wBACA,EAAE,YAAY,GACd,GACF;GACF;EACF;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;;AAkBA,MAAa,SAAS,iBAAiB,kBAAkB,CAAC"}
package/dist/webpack.cjs CHANGED
@@ -1,26 +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
-
9
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
10
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
11
- const require_unplugin = require('./unplugin.cjs');
2
+ const require_unplugin = require('./unplugin-WjPT9ECw.cjs');
12
3
  let _stryke_path_join_paths = require("@stryke/path/join-paths");
13
4
  let defu = require("defu");
14
- defu = require_runtime.__toESM(defu, 1);
5
+ defu = require_unplugin.__toESM(defu, 1);
15
6
  let unplugin = require("unplugin");
16
7
 
17
8
  //#region src/webpack.ts
18
- var webpack_exports = /* @__PURE__ */ require_runtime.__exportAll({
19
- createWebpackFactory: () => createWebpackFactory,
20
- default: () => plugin,
21
- plugin: () => plugin,
22
- resolveOptions: () => resolveOptions
23
- });
24
9
  /**
25
10
  * Resolves the options for [webpack](https://webpack.js.org/).
26
11
  *
@@ -105,10 +90,4 @@ const plugin = (0, unplugin.createWebpackPlugin)(createWebpackFactory());
105
90
  exports.createWebpackFactory = createWebpackFactory;
106
91
  exports.default = plugin;
107
92
  exports.plugin = plugin;
108
- exports.resolveOptions = resolveOptions;
109
- Object.defineProperty(exports, 'webpack_exports', {
110
- enumerable: true,
111
- get: function () {
112
- return webpack_exports;
113
- }
114
- });
93
+ exports.resolveOptions = resolveOptions;
@@ -1,4 +1,4 @@
1
- import { UnpluginExecutionOptions, UnpluginFactory } from "./types.cjs";
1
+ import { r as UnpluginFactory, t as UnpluginExecutionOptions } from "./types-CEaXoKbk.cjs";
2
2
  import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
3
3
  import { Context, ExecutionContext } from "@powerlines/core";
4
4
  import { DeepPartial } from "@stryke/types/base";
@@ -34,7 +34,7 @@ declare function resolveOptions(context: Context): DeepPartial<WebpackOptionsNor
34
34
  * @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.
35
35
  * @returns A function that generates a Webpack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Webpack build.
36
36
  */
37
- declare function createWebpackFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
37
+ declare function createWebpackFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig<import("@powerlines/core").UserConfig, import("@powerlines/core").ExecutionOptions>, any>>;
38
38
  /**
39
39
  * An Webpack plugin that will invoke the Powerlines API hooks during the build process.
40
40
  *
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.d.cts","names":[],"sources":["../src/webpack.ts"],"mappings":";;;;;;;;;;AAqCA;;;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,GACR,WAAA,CAAY,wBAAA;;;;;;;;;;AAAwB;AAiEvC;;;;;;;;;;;;iBAAgB,oBAAA,kBAAsC,gBAAA,EACpD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;;;;;;;AAAA;AAgCnE;;;cAAa,MAAA,GAAM,OAAA,GAA8C,wBAA9C,mCAAA,qBAAA"}
1
+ {"version":3,"file":"webpack.d.cts","names":[],"sources":["../src/webpack.ts"],"mappings":";;;;;;;;;;AAqCA;;;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,GACR,WAAA,CAAY,wBAAA;;;;;;;;;;AAAwB;AAiEvC;;;;;;;;;;;;iBAAgB,oBAAA,kBAAsC,gBAAA,EACpD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA,4BAAA,UAAA,6BAAA,gBAAA;;;;;;;;;;;;;;AAAA;AAgCnE;cAAa,MAAA,GAAM,OAAA,GAA8C,wBAA9C,mCAAA,qBAAA"}
@@ -1,5 +1,3 @@
1
- import __tsdown_shims_path from 'node:path';
2
- import __tsdown_shims_url from 'node:url';
3
1
  import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
4
2
  import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
5
3
  import { Context, ExecutionContext } from "@powerlines/core";
@@ -36,7 +34,7 @@ declare function resolveOptions(context: Context): DeepPartial<WebpackOptionsNor
36
34
  * @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.
37
35
  * @returns A function that generates a Webpack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Webpack build.
38
36
  */
39
- declare function createWebpackFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
37
+ declare function createWebpackFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig<import("@powerlines/core").UserConfig, import("@powerlines/core").ExecutionOptions>, any>>;
40
38
  /**
41
39
  * An Webpack plugin that will invoke the Powerlines API hooks during the build process.
42
40
  *
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.d.mts","names":[],"sources":["../src/webpack.ts"],"mappings":";;;;;;;;;;;;;;;iBAqCgB,cAAA,CACd,OAAA,EAAS,OAAA,GACR,WAAA,CAAY,wBAAA;;;;;AAFf;;;;;;;;;;;;;AAEuC;AAiEvC;;;;iBAAgB,oBAAA,kBAAsC,gBAAA,EACpD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA;;;;;;;;;;;;;;;;cAgCtD,MAAA,GAAM,OAAA,GAA8C,wBAA9C,mCAAA,qBAAA"}
1
+ {"version":3,"file":"webpack.d.mts","names":[],"sources":["../src/webpack.ts"],"mappings":";;;;;;;;;;AAqCA;;;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,GACR,WAAA,CAAY,wBAAA;;;;;;;;;;AAAwB;AAiEvC;;;;;;;;;;;;iBAAgB,oBAAA,kBAAsC,gBAAA,EACpD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA,4BAAA,UAAA,6BAAA,gBAAA;;;;;;;;;;;;;;AAAA;AAgCnE;cAAa,MAAA,GAAM,OAAA,GAA8C,wBAA9C,mCAAA,qBAAA"}
package/dist/webpack.mjs CHANGED
@@ -1,24 +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
-
9
- import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
10
1
  import { createUnpluginFactory } from "./unplugin.mjs";
11
2
  import { joinPaths } from "@stryke/path/join-paths";
12
3
  import defu from "defu";
13
4
  import { createWebpackPlugin } from "unplugin";
14
5
 
15
6
  //#region src/webpack.ts
16
- var webpack_exports = /* @__PURE__ */ __exportAll({
17
- createWebpackFactory: () => createWebpackFactory,
18
- default: () => plugin,
19
- plugin: () => plugin,
20
- resolveOptions: () => resolveOptions
21
- });
22
7
  /**
23
8
  * Resolves the options for [webpack](https://webpack.js.org/).
24
9
  *
@@ -100,5 +85,5 @@ function createWebpackFactory(options = {}, decorate = (options) => options) {
100
85
  const plugin = createWebpackPlugin(createWebpackFactory());
101
86
 
102
87
  //#endregion
103
- export { createWebpackFactory, plugin as default, plugin, resolveOptions, webpack_exports };
88
+ export { createWebpackFactory, plugin as default, plugin, resolveOptions };
104
89
  //# sourceMappingURL=webpack.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.mjs","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Context, ExecutionContext } from \"@powerlines/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { DeepPartial } from \"@stryke/types/base\";\nimport defu from \"defu\";\nimport { createWebpackPlugin, WebpackCompiler } from \"unplugin\";\nimport { WebpackOptionsNormalized } from \"webpack\";\nimport { UnpluginOptions } from \"./types\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Resolves the options for [webpack](https://webpack.js.org/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(\n context: Context\n): DeepPartial<WebpackOptionsNormalized> {\n return {\n output: {\n path: context.config.output.path\n },\n name: context.config.name,\n resolve: {\n alias: context.alias\n },\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 cache: {\n type: \"filesystem\" as const,\n cacheDirectory: joinPaths(context.cachePath, \"webpack\", \"cache\")\n },\n recordsInputPath: joinPaths(\n context.cachePath,\n \"webpack\",\n \".webpack-records.json\"\n ),\n recordsOutputPath: joinPaths(\n context.cachePath,\n \"webpack\",\n \".webpack-records.json\"\n ),\n context: joinPaths(context.config.cwd, context.config.root),\n devtool: context.config.output.sourceMap ? \"source-map\" : false,\n optimization: {\n minimize: context.config.output.minify\n }\n };\n}\n\n/**\n * Creates a Webpack plugin factory that generates a plugin instance.\n *\n * @see https://webpack.js.org/api/plugins/\n *\n * @example\n * ```ts\n * // webpack.config.ts\n * import { createWebpackFactory } from \"@powerlines/unplugin/webpack\";\n *\n * const powerlinesPlugin = createWebpackFactory({ 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 Webpack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Webpack build.\n */\nexport function createWebpackFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"webpack\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n webpack(compiler: WebpackCompiler) {\n compiler.hooks.beforeRun.tap(\"PowerlinesWebpackPlugin\", compiler => {\n compiler.options = defu(\n resolveOptions(unplugin.context),\n compiler.options\n ) as WebpackOptionsNormalized;\n });\n }\n })\n );\n}\n\n/**\n * An Webpack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://webpack.js.org/contribute/writing-a-plugin/#basic-plugin-architecture\n *\n * @example\n * ```js\n * // webpack.config.js\n * import powerlines from \"@powerlines/unplugin/webpack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const plugin = createWebpackPlugin(createWebpackFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,eACd,SACuC;CACvC,OAAO;EACL,QAAQ,EACN,MAAM,QAAQ,OAAO,OAAO,KAC9B;EACA,MAAM,QAAQ,OAAO;EACrB,SAAS,EACP,OAAO,QAAQ,MACjB;EACA,MACE,QAAQ,OAAO,aAAa,SACxB;GACE,WAAW;GACX,YAAY;GACZ,QAAQ;EACV,IACA;EACN,MACE,QAAQ,OAAO,SAAS,gBACnB,gBACA;EACP,OAAO;GACL,MAAM;GACN,gBAAgB,UAAU,QAAQ,WAAW,WAAW,OAAO;EACjE;EACA,kBAAkB,UAChB,QAAQ,WACR,WACA,uBACF;EACA,mBAAmB,UACjB,QAAQ,WACR,WACA,uBACF;EACA,SAAS,UAAU,QAAQ,OAAO,KAAK,QAAQ,OAAO,IAAI;EAC1D,SAAS,QAAQ,OAAO,OAAO,YAAY,eAAe;EAC1D,cAAc,EACZ,UAAU,QAAQ,OAAO,OAAO,OAClC;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,qBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAU,IAAG,aAC/D,SAAS;EACP,GAAI;EACJ,QAAQ,UAA2B;GACjC,SAAS,MAAM,UAAU,IAAI,4BAA2B,aAAY;IAClE,SAAS,UAAU,KACjB,eAAe,SAAS,OAAO,GAC/B,SAAS,OACX;GACF,CAAC;EACH;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;AAiBA,MAAa,SAAS,oBAAoB,qBAAqB,CAAC"}
1
+ {"version":3,"file":"webpack.mjs","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Context, ExecutionContext } from \"@powerlines/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { DeepPartial } from \"@stryke/types/base\";\nimport defu from \"defu\";\nimport { createWebpackPlugin, WebpackCompiler } from \"unplugin\";\nimport { WebpackOptionsNormalized } from \"webpack\";\nimport { UnpluginOptions } from \"./types\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Resolves the options for [webpack](https://webpack.js.org/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(\n context: Context\n): DeepPartial<WebpackOptionsNormalized> {\n return {\n output: {\n path: context.config.output.path\n },\n name: context.config.name,\n resolve: {\n alias: context.alias\n },\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 cache: {\n type: \"filesystem\" as const,\n cacheDirectory: joinPaths(context.cachePath, \"webpack\", \"cache\")\n },\n recordsInputPath: joinPaths(\n context.cachePath,\n \"webpack\",\n \".webpack-records.json\"\n ),\n recordsOutputPath: joinPaths(\n context.cachePath,\n \"webpack\",\n \".webpack-records.json\"\n ),\n context: joinPaths(context.config.cwd, context.config.root),\n devtool: context.config.output.sourceMap ? \"source-map\" : false,\n optimization: {\n minimize: context.config.output.minify\n }\n };\n}\n\n/**\n * Creates a Webpack plugin factory that generates a plugin instance.\n *\n * @see https://webpack.js.org/api/plugins/\n *\n * @example\n * ```ts\n * // webpack.config.ts\n * import { createWebpackFactory } from \"@powerlines/unplugin/webpack\";\n *\n * const powerlinesPlugin = createWebpackFactory({ 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 Webpack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Webpack build.\n */\nexport function createWebpackFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"webpack\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n webpack(compiler: WebpackCompiler) {\n compiler.hooks.beforeRun.tap(\"PowerlinesWebpackPlugin\", compiler => {\n compiler.options = defu(\n resolveOptions(unplugin.context),\n compiler.options\n ) as WebpackOptionsNormalized;\n });\n }\n })\n );\n}\n\n/**\n * An Webpack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://webpack.js.org/contribute/writing-a-plugin/#basic-plugin-architecture\n *\n * @example\n * ```js\n * // webpack.config.js\n * import powerlines from \"@powerlines/unplugin/webpack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const plugin = createWebpackPlugin(createWebpackFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AAqCA,SAAgB,eACd,SACuC;CACvC,OAAO;EACL,QAAQ,EACN,MAAM,QAAQ,OAAO,OAAO,KAC9B;EACA,MAAM,QAAQ,OAAO;EACrB,SAAS,EACP,OAAO,QAAQ,MACjB;EACA,MACE,QAAQ,OAAO,aAAa,SACxB;GACE,WAAW;GACX,YAAY;GACZ,QAAQ;EACV,IACA;EACN,MACE,QAAQ,OAAO,SAAS,gBACnB,gBACA;EACP,OAAO;GACL,MAAM;GACN,gBAAgB,UAAU,QAAQ,WAAW,WAAW,OAAO;EACjE;EACA,kBAAkB,UAChB,QAAQ,WACR,WACA,uBACF;EACA,mBAAmB,UACjB,QAAQ,WACR,WACA,uBACF;EACA,SAAS,UAAU,QAAQ,OAAO,KAAK,QAAQ,OAAO,IAAI;EAC1D,SAAS,QAAQ,OAAO,OAAO,YAAY,eAAe;EAC1D,cAAc,EACZ,UAAU,QAAQ,OAAO,OAAO,OAClC;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,qBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAU,IAAG,aAC/D,SAAS;EACP,GAAI;EACJ,QAAQ,UAA2B;GACjC,SAAS,MAAM,UAAU,IAAI,4BAA2B,aAAY;IAClE,SAAS,UAAU,KACjB,eAAe,SAAS,OAAO,GAC/B,SAAS,OACX;GACF,CAAC;EACH;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;AAiBA,MAAa,SAAS,oBAAoB,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/unplugin",
3
- "version": "0.0.76",
3
+ "version": "0.0.77",
4
4
  "private": false,
5
5
  "description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
6
6
  "keywords": [
@@ -59,108 +59,44 @@
59
59
  "exports": {
60
60
  ".": { "import": "./dist/index.mjs", "require": "./dist/index.cjs" },
61
61
  "./astro": { "import": "./dist/astro.mjs", "require": "./dist/astro.cjs" },
62
- "./astro.test": {
63
- "import": "./dist/astro.test.mjs",
64
- "require": "./dist/astro.test.cjs"
65
- },
66
62
  "./esbuild": {
67
63
  "import": "./dist/esbuild.mjs",
68
64
  "require": "./dist/esbuild.cjs"
69
65
  },
70
- "./esbuild.test": {
71
- "import": "./dist/esbuild.test.mjs",
72
- "require": "./dist/esbuild.test.cjs"
73
- },
74
66
  "./farm": { "import": "./dist/farm.mjs", "require": "./dist/farm.cjs" },
75
- "./farm.test": {
76
- "import": "./dist/farm.test.mjs",
77
- "require": "./dist/farm.test.cjs"
78
- },
79
- "./index.test": {
80
- "import": "./dist/index.test.mjs",
81
- "require": "./dist/index.test.cjs"
82
- },
83
67
  "./next": { "import": "./dist/next.mjs", "require": "./dist/next.cjs" },
84
- "./next.test": {
85
- "import": "./dist/next.test.mjs",
86
- "require": "./dist/next.test.cjs"
87
- },
88
68
  "./nuxt": { "import": "./dist/nuxt.mjs", "require": "./dist/nuxt.cjs" },
89
- "./nuxt.test": {
90
- "import": "./dist/nuxt.test.mjs",
91
- "require": "./dist/nuxt.test.cjs"
92
- },
93
69
  "./rolldown": {
94
70
  "import": "./dist/rolldown.mjs",
95
71
  "require": "./dist/rolldown.cjs"
96
72
  },
97
- "./rolldown.test": {
98
- "import": "./dist/rolldown.test.mjs",
99
- "require": "./dist/rolldown.test.cjs"
100
- },
101
73
  "./rollup": {
102
74
  "import": "./dist/rollup.mjs",
103
75
  "require": "./dist/rollup.cjs"
104
76
  },
105
- "./rollup.test": {
106
- "import": "./dist/rollup.test.mjs",
107
- "require": "./dist/rollup.test.cjs"
108
- },
109
77
  "./rspack": {
110
78
  "import": "./dist/rspack.mjs",
111
79
  "require": "./dist/rspack.cjs"
112
80
  },
113
- "./rspack.test": {
114
- "import": "./dist/rspack.test.mjs",
115
- "require": "./dist/rspack.test.cjs"
116
- },
117
81
  "./tsdown": {
118
82
  "import": "./dist/tsdown.mjs",
119
83
  "require": "./dist/tsdown.cjs"
120
84
  },
121
- "./tsdown.test": {
122
- "import": "./dist/tsdown.test.mjs",
123
- "require": "./dist/tsdown.test.cjs"
124
- },
125
85
  "./tsup": { "import": "./dist/tsup.mjs", "require": "./dist/tsup.cjs" },
126
- "./tsup.test": {
127
- "import": "./dist/tsup.test.mjs",
128
- "require": "./dist/tsup.test.cjs"
129
- },
130
86
  "./types": { "import": "./dist/types.mjs", "require": "./dist/types.cjs" },
131
- "./types.test": {
132
- "import": "./dist/types.test.mjs",
133
- "require": "./dist/types.test.cjs"
134
- },
135
87
  "./unloader": {
136
88
  "import": "./dist/unloader.mjs",
137
89
  "require": "./dist/unloader.cjs"
138
90
  },
139
- "./unloader.test": {
140
- "import": "./dist/unloader.test.mjs",
141
- "require": "./dist/unloader.test.cjs"
142
- },
143
91
  "./unplugin": {
144
92
  "import": "./dist/unplugin.mjs",
145
93
  "require": "./dist/unplugin.cjs"
146
94
  },
147
- "./unplugin.test": {
148
- "import": "./dist/unplugin.test.mjs",
149
- "require": "./dist/unplugin.test.cjs"
150
- },
151
95
  "./vite": { "import": "./dist/vite.mjs", "require": "./dist/vite.cjs" },
152
- "./vite.test": {
153
- "import": "./dist/vite.test.mjs",
154
- "require": "./dist/vite.test.cjs"
155
- },
156
96
  "./webpack": {
157
97
  "import": "./dist/webpack.mjs",
158
98
  "require": "./dist/webpack.cjs"
159
99
  },
160
- "./webpack.test": {
161
- "import": "./dist/webpack.test.mjs",
162
- "require": "./dist/webpack.test.cjs"
163
- },
164
100
  "./package.json": "./package.json"
165
101
  },
166
102
  "main": "./dist/index.cjs",
@@ -169,7 +105,7 @@
169
105
  "typings": "dist/index.d.mts",
170
106
  "files": ["dist"],
171
107
  "dependencies": {
172
- "@powerlines/core": "^0.48.28",
108
+ "@powerlines/core": "^0.48.29",
173
109
  "@rollup/plugin-alias": "^6.0.0",
174
110
  "@rollup/plugin-inject": "^5.0.5",
175
111
  "@rollup/plugin-node-resolve": "^16.0.3",
@@ -231,5 +167,5 @@
231
167
  "webpack": { "optional": true }
232
168
  },
233
169
  "publishConfig": { "access": "public" },
234
- "gitHead": "0b8ebdde5e6e57b8a983e447e0fbb94469a5bd1a"
170
+ "gitHead": "a673a3bb6463e3e010ae5edbb63891961751b4d5"
235
171
  }
@@ -1,53 +0,0 @@
1
-
2
-
3
- import __tsdown_shims_path from 'node:path'
4
- import __tsdown_shims_url from 'node:url'
5
-
6
- const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
7
- const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
8
-
9
- //#region \0rolldown/runtime.js
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __exportAll = (all, no_symbols) => {
17
- let target = {};
18
- for (var name in all) {
19
- __defProp(target, name, {
20
- get: all[name],
21
- enumerable: true
22
- });
23
- }
24
- if (!no_symbols) {
25
- __defProp(target, Symbol.toStringTag, { value: "Module" });
26
- }
27
- return target;
28
- };
29
- var __copyProps = (to, from, except, desc) => {
30
- if (from && typeof from === "object" || typeof from === "function") {
31
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
32
- key = keys[i];
33
- if (!__hasOwnProp.call(to, key) && key !== except) {
34
- __defProp(to, key, {
35
- get: ((k) => from[k]).bind(null, key),
36
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
37
- });
38
- }
39
- }
40
- }
41
- return to;
42
- };
43
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
44
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
45
- value: mod,
46
- enumerable: true
47
- }) : target, mod));
48
-
49
- //#endregion
50
-
51
- exports.__exportAll = __exportAll;
52
- exports.__reExport = __reExport;
53
- exports.__toESM = __toESM;