powerlines 0.40.18 → 0.40.19
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/{api-BpPToWwp.mjs → api-D-RIxwbi.mjs} +30 -27
- package/dist/api-D-RIxwbi.mjs.map +1 -0
- package/dist/{api-CMZBG3oq.cjs → api-Dspa27jK.cjs} +29 -26
- package/dist/astro.cjs +2 -2
- package/dist/astro.d.mts +1 -1
- package/dist/astro.mjs +2 -2
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.mts +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/{esbuild-DhtbXiqW.cjs → esbuild-BblRTl0L.cjs} +1 -1
- package/dist/{esbuild-Cvb9P_ZW.mjs → esbuild-xbqsWwqN.mjs} +2 -2
- package/dist/{esbuild-Cvb9P_ZW.mjs.map → esbuild-xbqsWwqN.mjs.map} +1 -1
- package/dist/esbuild.cjs +2 -2
- package/dist/esbuild.d.mts +1 -1
- package/dist/esbuild.mjs +2 -2
- package/dist/farm.cjs +1 -1
- package/dist/farm.d.mts +1 -1
- package/dist/farm.mjs +1 -1
- package/dist/{index-C1wDpmrr.d.mts → index-2JXW-b2-.d.mts} +2 -2
- package/dist/{index-C1wDpmrr.d.mts.map → index-2JXW-b2-.d.mts.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/next.cjs +2 -2
- package/dist/next.mjs +2 -2
- package/dist/nuxt.cjs +3 -3
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.mjs +3 -3
- package/dist/{plugin-Ba95Lv5d.d.cts → plugin-B9TQt-p0.d.cts} +2 -2
- package/dist/{plugin-Ba95Lv5d.d.cts.map → plugin-B9TQt-p0.d.cts.map} +1 -1
- package/dist/plugin-utils.d.mts +1 -1
- package/dist/{rolldown-CGkyfhQb.cjs → rolldown-CJwfgimU.cjs} +1 -1
- package/dist/{rolldown-msQVl4gL.mjs → rolldown-DM-vGV3t.mjs} +2 -2
- package/dist/{rolldown-msQVl4gL.mjs.map → rolldown-DM-vGV3t.mjs.map} +1 -1
- package/dist/rolldown.cjs +2 -2
- package/dist/rolldown.d.mts +1 -1
- package/dist/rolldown.mjs +2 -2
- package/dist/rollup.cjs +1 -1
- package/dist/rollup.d.mts +1 -1
- package/dist/rollup.mjs +1 -1
- package/dist/rspack.cjs +1 -1
- package/dist/rspack.d.mts +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/storage/index.d.mts +1 -1
- package/dist/tsdown.cjs +3 -3
- package/dist/tsdown.d.mts +1 -1
- package/dist/tsdown.mjs +3 -3
- package/dist/tsdown.mjs.map +1 -1
- package/dist/tsup.cjs +2 -2
- package/dist/tsup.d.mts +1 -1
- package/dist/tsup.mjs +2 -2
- package/dist/typescript/index.d.mts +1 -1
- package/dist/unloader.cjs +1 -1
- package/dist/unloader.d.mts +1 -1
- package/dist/unloader.mjs +1 -1
- package/dist/unplugin.cjs +1 -1
- package/dist/unplugin.d.cts +1 -1
- package/dist/unplugin.d.mts +1 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/{vite-CEZ8iJOi.mjs → vite-5WSLwM5t.mjs} +2 -2
- package/dist/{vite-CEZ8iJOi.mjs.map → vite-5WSLwM5t.mjs.map} +1 -1
- package/dist/{vite-kYt2G76D.cjs → vite-D-f0L5Sn.cjs} +1 -1
- package/dist/vite.cjs +2 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -2
- package/dist/{webpack-47f2tjtr.cjs → webpack-CKrlgWVq.cjs} +1 -1
- package/dist/{webpack-DBUxefMB.mjs → webpack-z0CSoK50.mjs} +2 -2
- package/dist/{webpack-DBUxefMB.mjs.map → webpack-z0CSoK50.mjs.map} +1 -1
- package/dist/webpack.cjs +2 -2
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.mjs +2 -2
- package/package.json +29 -29
- package/dist/api-BpPToWwp.mjs.map +0 -1
package/dist/rolldown.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./api-
|
|
1
|
+
import "./api-D-RIxwbi.mjs";
|
|
2
2
|
import "./tsconfig-B92heKit.mjs";
|
|
3
3
|
import "./plugin-utils-C3HnZJl1.mjs";
|
|
4
4
|
import "./plugin-E5foRD0k.mjs";
|
|
@@ -9,6 +9,6 @@ import "./utils-DoQcX7Sk.mjs";
|
|
|
9
9
|
import "./virtual-B9imjOqe.mjs";
|
|
10
10
|
import "./resolve-options-6sXFqzEA.mjs";
|
|
11
11
|
import "./resolve-options-D-RGs8j8.mjs";
|
|
12
|
-
import { n as unplugin, r as src_default, t as rolldown_default } from "./rolldown-
|
|
12
|
+
import { n as unplugin, r as src_default, t as rolldown_default } from "./rolldown-DM-vGV3t.mjs";
|
|
13
13
|
|
|
14
14
|
export { rolldown_default as default, unplugin as "module.exports", unplugin, src_default as plugin, src_default as rolldown };
|
package/dist/rollup.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
3
|
-
const require_api = require('./api-
|
|
3
|
+
const require_api = require('./api-Dspa27jK.cjs');
|
|
4
4
|
require('./tsconfig-C8M8X6U0.cjs');
|
|
5
5
|
require('./plugin-utils-Ck3cx3w6.cjs');
|
|
6
6
|
require('./plugin-CZ_PJPpQ.cjs');
|
package/dist/rollup.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Et as PluginContext, N as UserConfig, er as Plugin, j as ResolvedConfig } from "./config-CK756s0L.mjs";
|
|
2
2
|
import "./config-CiPXgwzt.mjs";
|
|
3
3
|
import "./index-C7W0kmm7.mjs";
|
|
4
|
-
import "./index-
|
|
4
|
+
import "./index-2JXW-b2-.mjs";
|
|
5
5
|
import * as rollup0 from "rollup";
|
|
6
6
|
import { RollupOptions } from "rollup";
|
|
7
7
|
|
package/dist/rollup.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createUnpluginFactory, o as createUnplugin } from "./api-
|
|
1
|
+
import { a as createUnpluginFactory, o as createUnplugin } from "./api-D-RIxwbi.mjs";
|
|
2
2
|
import "./tsconfig-B92heKit.mjs";
|
|
3
3
|
import "./plugin-utils-C3HnZJl1.mjs";
|
|
4
4
|
import "./plugin-E5foRD0k.mjs";
|
package/dist/rspack.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
3
|
-
const require_api = require('./api-
|
|
3
|
+
const require_api = require('./api-Dspa27jK.cjs');
|
|
4
4
|
require('./tsconfig-C8M8X6U0.cjs');
|
|
5
5
|
require('./plugin-utils-Ck3cx3w6.cjs');
|
|
6
6
|
require('./plugin-CZ_PJPpQ.cjs');
|
package/dist/rspack.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Et as PluginContext, N as UserConfig, er as Plugin, j as ResolvedConfig } from "./config-CK756s0L.mjs";
|
|
2
2
|
import "./config-CiPXgwzt.mjs";
|
|
3
3
|
import "./index-C7W0kmm7.mjs";
|
|
4
|
-
import "./index-
|
|
4
|
+
import "./index-2JXW-b2-.mjs";
|
|
5
5
|
import * as unplugin0 from "unplugin";
|
|
6
6
|
import { Configuration } from "@rspack/core";
|
|
7
7
|
|
package/dist/rspack.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createUnpluginFactory, o as createUnplugin } from "./api-
|
|
1
|
+
import { a as createUnpluginFactory, o as createUnplugin } from "./api-D-RIxwbi.mjs";
|
|
2
2
|
import "./tsconfig-B92heKit.mjs";
|
|
3
3
|
import "./plugin-utils-C3HnZJl1.mjs";
|
|
4
4
|
import "./plugin-E5foRD0k.mjs";
|
package/dist/storage/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Br as StorageAdapter, Hr as StoragePreset, _t as Context } from "../config-CK756s0L.mjs";
|
|
2
2
|
import "../config-CiPXgwzt.mjs";
|
|
3
3
|
import "../index-C7W0kmm7.mjs";
|
|
4
|
-
import "../index-
|
|
4
|
+
import "../index-2JXW-b2-.mjs";
|
|
5
5
|
import "../types-Bh_vLuQ0.mjs";
|
|
6
6
|
import { writeFile, writeFileSync } from "@stryke/fs/write-file";
|
|
7
7
|
import { MaybePromise } from "@stryke/types/base";
|
package/dist/tsdown.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
3
|
-
const require_api = require('./api-
|
|
3
|
+
const require_api = require('./api-Dspa27jK.cjs');
|
|
4
4
|
require('./tsconfig-C8M8X6U0.cjs');
|
|
5
5
|
const require_plugin_utils = require('./plugin-utils-Ck3cx3w6.cjs');
|
|
6
6
|
require('./plugin-CZ_PJPpQ.cjs');
|
|
@@ -11,7 +11,7 @@ require('./utils-BbDma_5Y.cjs');
|
|
|
11
11
|
require('./virtual-B1MLgqnQ.cjs');
|
|
12
12
|
require('./resolve-options-vyFhhkLp.cjs');
|
|
13
13
|
require('./resolve-options-lxQ2pm0W.cjs');
|
|
14
|
-
const require_rolldown = require('./rolldown-
|
|
14
|
+
const require_rolldown = require('./rolldown-CJwfgimU.cjs');
|
|
15
15
|
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
16
16
|
let __stryke_path_append = require("@stryke/path/append");
|
|
17
17
|
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
@@ -112,7 +112,7 @@ function resolveOptions(context) {
|
|
|
112
112
|
define: context.config.define,
|
|
113
113
|
inputOptions: { transform: { inject: context.config.inject } },
|
|
114
114
|
platform: context.config.platform,
|
|
115
|
-
dts:
|
|
115
|
+
dts: context.config.output.dts,
|
|
116
116
|
outDir: (0, __stryke_path_append.appendPath)(context.config.output.buildPath, context.workspaceConfig.workspaceRoot),
|
|
117
117
|
tsconfig: (0, __stryke_path_append.appendPath)(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
|
|
118
118
|
format: resolveFormat(context.config.output.format).filter(Boolean),
|
package/dist/tsdown.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Et as PluginContext, er as Plugin, j as ResolvedConfig } from "./config-CK756s0L.mjs";
|
|
2
2
|
import "./config-CiPXgwzt.mjs";
|
|
3
3
|
import "./index-C7W0kmm7.mjs";
|
|
4
|
-
import "./index-
|
|
4
|
+
import "./index-2JXW-b2-.mjs";
|
|
5
5
|
import { UserConfig } from "tsdown";
|
|
6
6
|
import { Format } from "@storm-software/build-tools/types";
|
|
7
7
|
import { UserConfig as UserConfig$1 } from "tsdown/config";
|
package/dist/tsdown.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as createUnplugin } from "./api-
|
|
1
|
+
import { o as createUnplugin } from "./api-D-RIxwbi.mjs";
|
|
2
2
|
import "./tsconfig-B92heKit.mjs";
|
|
3
3
|
import { r as formatPackageJson, w as getDependencyConfig } from "./plugin-utils-C3HnZJl1.mjs";
|
|
4
4
|
import "./plugin-E5foRD0k.mjs";
|
|
@@ -9,7 +9,7 @@ import "./utils-DoQcX7Sk.mjs";
|
|
|
9
9
|
import "./virtual-B9imjOqe.mjs";
|
|
10
10
|
import "./resolve-options-6sXFqzEA.mjs";
|
|
11
11
|
import "./resolve-options-D-RGs8j8.mjs";
|
|
12
|
-
import { t as rolldown_default } from "./rolldown-
|
|
12
|
+
import { t as rolldown_default } from "./rolldown-DM-vGV3t.mjs";
|
|
13
13
|
import { toArray } from "@stryke/convert/to-array";
|
|
14
14
|
import { appendPath } from "@stryke/path/append";
|
|
15
15
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
@@ -109,7 +109,7 @@ function resolveOptions(context) {
|
|
|
109
109
|
define: context.config.define,
|
|
110
110
|
inputOptions: { transform: { inject: context.config.inject } },
|
|
111
111
|
platform: context.config.platform,
|
|
112
|
-
dts:
|
|
112
|
+
dts: context.config.output.dts,
|
|
113
113
|
outDir: appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot),
|
|
114
114
|
tsconfig: appendPath(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
|
|
115
115
|
format: resolveFormat(context.config.output.format).filter(Boolean),
|
package/dist/tsdown.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.mjs","names":["DEFAULT_TSDOWN_CONFIG: Partial<BuildOptions>","rolldown"],"sources":["../../plugin-tsdown/src/helpers/resolve-options.ts","../../plugin-tsdown/src/helpers/unplugin.ts","../../plugin-tsdown/src/index.ts","../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 { Context } from \"@powerlines/core\";\nimport { getDependencyConfig } from \"@powerlines/core/plugin-utils\";\nimport { RolldownPluginResolvedConfig } from \"@powerlines/plugin-rolldown/types/plugin\";\nimport type { Format } from \"@storm-software/build-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { UserConfig as BuildOptions, Format as TsdownFormat } from \"tsdown\";\nimport { TsdownPluginResolvedConfig } from \"../types/plugin\";\n\nexport const DEFAULT_TSDOWN_CONFIG: Partial<BuildOptions> = {\n platform: \"neutral\",\n target: \"esnext\",\n fixedExtension: true,\n nodeProtocol: 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 = (context: Context, ...msgs: any[]) =>\n msgs\n .filter(Boolean)\n .join(\" \")\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(context: Context): BuildOptions {\n const { external, noExternal } = getDependencyConfig(context);\n\n return defu(\n {\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.workspaceConfig.workspaceRoot,\n context.config.root,\n \"src\",\n \"**/*.ts\"\n ),\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"src\",\n \"**/*.tsx\"\n )\n ],\n external,\n noExternal,\n alias: context.alias,\n resolve: {\n alias: context.alias\n },\n exports:\n (context.config as TsdownPluginResolvedConfig)?.tsdown &&\n (context.config as TsdownPluginResolvedConfig).tsdown?.exports\n ? defu(\n isSetObject(\n (context.config as TsdownPluginResolvedConfig).tsdown?.exports\n )\n ? (context.config as TsdownPluginResolvedConfig).tsdown?.exports\n : {},\n {\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 )\n : undefined\n },\n (context.config as TsdownPluginResolvedConfig)?.tsdown\n ? (context.config as TsdownPluginResolvedConfig)?.tsdown\n : {},\n (context.config as RolldownPluginResolvedConfig)?.rolldown\n ? {\n inputOptions: (context.config as RolldownPluginResolvedConfig)\n ?.rolldown\n }\n : {},\n {\n name: context.config.name,\n cwd: appendPath(\n context.config.root,\n context.workspaceConfig.workspaceRoot\n ),\n define: context.config.define,\n inputOptions: {\n transform: {\n inject: context.config.inject\n }\n },\n platform: context.config.platform,\n dts: true,\n outDir: appendPath(\n context.config.output.buildPath,\n context.workspaceConfig.workspaceRoot\n ),\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.workspaceConfig.workspaceRoot\n ),\n format: resolveFormat(context.config.output.format).filter(Boolean),\n mode: context.config.mode,\n treeshake: (context.config as TsdownPluginResolvedConfig)?.tsdown\n ? (context.config as TsdownPluginResolvedConfig)?.tsdown?.treeshake\n : undefined,\n minify: context.config.mode === \"production\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n debug: context.config.mode === \"development\",\n silent:\n context.config.logLevel === null ||\n context.config.mode === \"production\",\n logLevel:\n context.config.logLevel === \"trace\" ? \"debug\" : context.config.logLevel,\n customLogger: {\n level:\n context.config.logLevel === \"trace\"\n ? \"debug\"\n : context.config.logLevel,\n info: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.debug(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.debug(formatMessage(context, ...msgs))\n }\n },\n DEFAULT_TSDOWN_CONFIG\n ) as BuildOptions;\n}\n","/* -------------------------------------------------------------------\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 { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createRolldownPlugin } from \"unplugin\";\nimport { TsdownPluginContext } from \"../types/plugin\";\n\nexport function createTsdownPlugin(context: TsdownPluginContext) {\n return createRolldownPlugin(createUnplugin(context))({});\n}\n","/* -------------------------------------------------------------------\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 { Plugin } from \"@powerlines/core\";\nimport { formatPackageJson } from \"@powerlines/core/plugin-utils/format-package-json\";\nimport defu from \"defu\";\nimport { build } from \"tsdown\";\nimport { resolveOptions } from \"./helpers/resolve-options\";\nimport { createTsdownPlugin } from \"./helpers/unplugin\";\nimport {\n TsdownPluginContext,\n TsdownPluginOptions,\n TsdownPluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport type * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface Config {\n tsdown?: TsdownPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to use Tsdown to build the project.\n */\nexport const plugin = <\n TContext extends TsdownPluginContext = TsdownPluginContext\n>(\n options: TsdownPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"tsdown\",\n config() {\n this.trace(\n \"Providing default configuration for the Powerlines `tsdown` build plugin.\"\n );\n\n return {\n output: {\n format: [\"cjs\", \"esm\"]\n },\n tsdown: {\n ...options\n }\n } as Partial<TsdownPluginResolvedConfig>;\n },\n async build() {\n this.trace(\"Starting Tsdown build process...\");\n\n await build(\n defu(\n {\n config: false,\n plugins: [createTsdownPlugin(this)]\n },\n resolveOptions(this)\n )\n );\n\n await formatPackageJson(this);\n }\n };\n};\n\nexport default plugin;\n","/* -------------------------------------------------------------------\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 { RolldownOptions } from \"@powerlines/plugin-rolldown/types/build\";\nimport { resolveFromFormat } from \"@powerlines/plugin-tsdown/helpers/resolve-options\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { ModuleFormat } from \"rolldown\";\nimport type { UserConfig } from \"tsdown/config\";\nimport rolldown from \"./rolldown\";\nimport { OutputConfig, ResolveConfig } from \"./types\";\n\nexport {\n default as plugin,\n default as tsdown\n} from \"@powerlines/plugin-tsdown\";\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/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 unplugin(options: UserConfig = {}): UserConfig {\n return {\n ...options,\n entry: options.entry,\n plugins: [\n rolldown({\n name: options.name,\n root: options.cwd ?? process.cwd(),\n output: {\n outputPath: options.outDir,\n format: resolveFromFormat(\n options.format as ModuleFormat | ModuleFormat[]\n ),\n assets: toArray(options.copy)\n .map(copy => {\n if (!copy) {\n return undefined;\n }\n\n if (isSetString(copy)) {\n return copy;\n }\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\n return undefined;\n }\n\n return {\n input: copy.from,\n output: copy.to\n };\n })\n .filter(Boolean) as OutputConfig[\"assets\"]\n },\n resolve: {\n external: options.external\n ? (toArray(options.external)\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\n return undefined;\n }\n\n return external;\n })\n .filter(Boolean) as ResolveConfig[\"external\"])\n : undefined,\n noExternal: options.noExternal\n ? (toArray(options.noExternal)\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\n return undefined;\n }\n\n return noExternal;\n })\n .filter(Boolean) as ResolveConfig[\"noExternal\"])\n : undefined\n },\n rolldown: options.inputOptions as RolldownOptions,\n tsconfig: isSetString(options.tsconfig) ? options.tsconfig : undefined\n })\n ]\n };\n}\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAaA,wBAA+C;CAC1D,UAAU;CACV,QAAQ;CACR,gBAAgB;CAChB,cAAc;CACd,OAAO;CACR;;;;;;;AAQD,SAAgB,cAAc,SAA6C;AACzE,QAAO,QAAQ,QAAQ,CAAC,KAAI,WAAU;AACpC,UAAQ,QAAR;GACE,KAAK,MACH,QAAO;GACT,KAAK,OACH,QAAO;GACT,KAAK;GACL,QACE,QAAO;;GAEX;;;;;;;;AASJ,SAAgB,kBACd,SACU;AACV,QAAO,QAAQ,QAAQ,CAAC,KAAI,WAAU;AAC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OWN_CONFIG: Partial<BuildOptions>","rolldown"],"sources":["../../plugin-tsdown/src/helpers/resolve-options.ts","../../plugin-tsdown/src/helpers/unplugin.ts","../../plugin-tsdown/src/index.ts","../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 { Context } from \"@powerlines/core\";\nimport { getDependencyConfig } from \"@powerlines/core/plugin-utils\";\nimport { RolldownPluginResolvedConfig } from \"@powerlines/plugin-rolldown/types/plugin\";\nimport type { Format } from \"@storm-software/build-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { UserConfig as BuildOptions, Format as TsdownFormat } from \"tsdown\";\nimport { TsdownPluginResolvedConfig } from \"../types/plugin\";\n\nexport const DEFAULT_TSDOWN_CONFIG: Partial<BuildOptions> = {\n platform: \"neutral\",\n target: \"esnext\",\n fixedExtension: true,\n nodeProtocol: 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 = (context: Context, ...msgs: any[]) =>\n msgs\n .filter(Boolean)\n .join(\" \")\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(context: Context): BuildOptions {\n const { external, noExternal } = getDependencyConfig(context);\n\n return defu(\n {\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.workspaceConfig.workspaceRoot,\n context.config.root,\n \"src\",\n \"**/*.ts\"\n ),\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"src\",\n \"**/*.tsx\"\n )\n ],\n external,\n noExternal,\n alias: context.alias,\n resolve: {\n alias: context.alias\n },\n exports:\n (context.config as TsdownPluginResolvedConfig)?.tsdown &&\n (context.config as TsdownPluginResolvedConfig).tsdown?.exports\n ? defu(\n isSetObject(\n (context.config as TsdownPluginResolvedConfig).tsdown?.exports\n )\n ? (context.config as TsdownPluginResolvedConfig).tsdown?.exports\n : {},\n {\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 )\n : undefined\n },\n (context.config as TsdownPluginResolvedConfig)?.tsdown\n ? (context.config as TsdownPluginResolvedConfig)?.tsdown\n : {},\n (context.config as RolldownPluginResolvedConfig)?.rolldown\n ? {\n inputOptions: (context.config as RolldownPluginResolvedConfig)\n ?.rolldown\n }\n : {},\n {\n name: context.config.name,\n cwd: appendPath(\n context.config.root,\n context.workspaceConfig.workspaceRoot\n ),\n define: context.config.define,\n inputOptions: {\n transform: {\n inject: context.config.inject\n }\n },\n platform: context.config.platform,\n dts: context.config.output.dts,\n outDir: appendPath(\n context.config.output.buildPath,\n context.workspaceConfig.workspaceRoot\n ),\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.workspaceConfig.workspaceRoot\n ),\n format: resolveFormat(context.config.output.format).filter(Boolean),\n mode: context.config.mode,\n treeshake: (context.config as TsdownPluginResolvedConfig)?.tsdown\n ? (context.config as TsdownPluginResolvedConfig)?.tsdown?.treeshake\n : undefined,\n minify: context.config.mode === \"production\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n debug: context.config.mode === \"development\",\n silent:\n context.config.logLevel === null ||\n context.config.mode === \"production\",\n logLevel:\n context.config.logLevel === \"trace\" ? \"debug\" : context.config.logLevel,\n customLogger: {\n level:\n context.config.logLevel === \"trace\"\n ? \"debug\"\n : context.config.logLevel,\n info: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.debug(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.debug(formatMessage(context, ...msgs))\n }\n },\n DEFAULT_TSDOWN_CONFIG\n ) as BuildOptions;\n}\n","/* -------------------------------------------------------------------\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 { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createRolldownPlugin } from \"unplugin\";\nimport { TsdownPluginContext } from \"../types/plugin\";\n\nexport function createTsdownPlugin(context: TsdownPluginContext) {\n return createRolldownPlugin(createUnplugin(context))({});\n}\n","/* -------------------------------------------------------------------\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 { Plugin } from \"@powerlines/core\";\nimport { formatPackageJson } from \"@powerlines/core/plugin-utils/format-package-json\";\nimport defu from \"defu\";\nimport { build } from \"tsdown\";\nimport { resolveOptions } from \"./helpers/resolve-options\";\nimport { createTsdownPlugin } from \"./helpers/unplugin\";\nimport {\n TsdownPluginContext,\n TsdownPluginOptions,\n TsdownPluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport type * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface Config {\n tsdown?: TsdownPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to use Tsdown to build the project.\n */\nexport const plugin = <\n TContext extends TsdownPluginContext = TsdownPluginContext\n>(\n options: TsdownPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"tsdown\",\n config() {\n this.trace(\n \"Providing default configuration for the Powerlines `tsdown` build plugin.\"\n );\n\n return {\n output: {\n format: [\"cjs\", \"esm\"]\n },\n tsdown: {\n ...options\n }\n } as Partial<TsdownPluginResolvedConfig>;\n },\n async build() {\n this.trace(\"Starting Tsdown build process...\");\n\n await build(\n defu(\n {\n config: false,\n plugins: [createTsdownPlugin(this)]\n },\n resolveOptions(this)\n )\n );\n\n await formatPackageJson(this);\n }\n };\n};\n\nexport default plugin;\n","/* -------------------------------------------------------------------\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 { RolldownOptions } from \"@powerlines/plugin-rolldown/types/build\";\nimport { resolveFromFormat } from \"@powerlines/plugin-tsdown/helpers/resolve-options\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { ModuleFormat } from \"rolldown\";\nimport type { UserConfig } from \"tsdown/config\";\nimport rolldown from \"./rolldown\";\nimport { OutputConfig, ResolveConfig } from \"./types\";\n\nexport {\n default as plugin,\n default as tsdown\n} from \"@powerlines/plugin-tsdown\";\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/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 unplugin(options: UserConfig = {}): UserConfig {\n return {\n ...options,\n entry: options.entry,\n plugins: [\n rolldown({\n name: options.name,\n root: options.cwd ?? process.cwd(),\n output: {\n outputPath: options.outDir,\n format: resolveFromFormat(\n options.format as ModuleFormat | ModuleFormat[]\n ),\n assets: toArray(options.copy)\n .map(copy => {\n if (!copy) {\n return undefined;\n }\n\n if (isSetString(copy)) {\n return copy;\n }\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\n return undefined;\n }\n\n return {\n input: copy.from,\n output: copy.to\n };\n })\n .filter(Boolean) as OutputConfig[\"assets\"]\n },\n resolve: {\n external: options.external\n ? (toArray(options.external)\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\n return undefined;\n }\n\n return external;\n })\n .filter(Boolean) as ResolveConfig[\"external\"])\n : undefined,\n noExternal: options.noExternal\n ? (toArray(options.noExternal)\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\n return undefined;\n }\n\n return noExternal;\n })\n .filter(Boolean) as ResolveConfig[\"noExternal\"])\n : undefined\n },\n rolldown: options.inputOptions as RolldownOptions,\n tsconfig: isSetString(options.tsconfig) ? options.tsconfig : undefined\n })\n ]\n };\n}\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAaA,wBAA+C;CAC1D,UAAU;CACV,QAAQ;CACR,gBAAgB;CAChB,cAAc;CACd,OAAO;CACR;;;;;;;AAQD,SAAgB,cAAc,SAA6C;AACzE,QAAO,QAAQ,QAAQ,CAAC,KAAI,WAAU;AACpC,UAAQ,QAAR;GACE,KAAK,MACH,QAAO;GACT,KAAK,OACH,QAAO;GACT,KAAK;GACL,QACE,QAAO;;GAEX;;;;;;;;AASJ,SAAgB,kBACd,SACU;AACV,QAAO,QAAQ,QAAQ,CAAC,KAAI,WAAU;AACpC,UAAQ,QAAR;GACE,KAAK;GACL,KAAK,WACH,QAAO;GACT,KAAK,OACH,QAAO;GACT,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;GACL,QACE,QAAO;;GAEX;;AAGJ,MAAM,iBAAiB,SAAkB,GAAG,SAC1C,KACG,OAAO,QAAQ,CACf,KAAK,IAAI,CACT,QAAQ,IAAI,OAAO,MAAM,QAAQ,OAAO,KAAK,MAAM,IAAI,EAAE,GAAG,CAC5D,WAAW,SAAS,GAAG,CACvB,WAAW,SAAS,GAAG,CACvB,MAAM;;;;;;;AAQX,SAAgB,eAAe,SAAg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GACP,MAAM,QAAQ;GACd,MAAM,QAAQ,OAAO,QAAQ,KAAK;GAClC,QAAQ;IACN,YAAY,QAAQ;IACpB,QAAQ,kBACN,QAAQ,OACT;IACD,QAAQ,QAAQ,QAAQ,KAAK,CAC1B,KAAI,SAAQ;AACX,SAAI,CAAC,KACH;AAGF,SAAI,YAAY,KAAK,CACnB,QAAO;AAGT,SAAI,WAAW,KAAK,EAAE;AAEpB,cAAQ,KACN,+DACD;AAED;;AAGF,YAAO;MACL,OAAO,KAAK;MACZ,QAAQ,KAAK;MACd;MACD,CACD,OAAO,QAAQ;IACnB;GACD,SAAS;IACP,UAAU,QAAQ,WACb,QAAQ,QAAQ,SAAS,CACvB,KAAI,aAAY;AACf,SAAI,WAAW,SAAS,EAAE;AAExB,cAAQ,KACN,mEACD;AAED;;AAGF,YAAO;MACP,CACD,OAAO,QAAQ,GAClB;IACJ,YAAY,QAAQ,aACf,QAAQ,QAAQ,WAAW,CACzB,KAAI,eAAc;AACjB,SAAI,WAAW,WAAW,EAAE;AAE1B,cAAQ,KACN,qEACD;AAED;;AAGF,YAAO;MACP,CACD,OAAO,QAAQ,GAClB;IACL;GACD,UAAU,QAAQ;GAClB,UAAU,YAAY,QAAQ,SAAS,GAAG,QAAQ,WAAW;GAC9D,CAAC,CACH;EACF;;AAGH,qBAAe"}
|
package/dist/tsup.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
3
|
-
const require_api = require('./api-
|
|
3
|
+
const require_api = require('./api-Dspa27jK.cjs');
|
|
4
4
|
require('./tsconfig-C8M8X6U0.cjs');
|
|
5
5
|
require('./plugin-utils-Ck3cx3w6.cjs');
|
|
6
6
|
require('./plugin-CZ_PJPpQ.cjs');
|
|
@@ -10,7 +10,7 @@ require('./config-D86Vw7SC.cjs');
|
|
|
10
10
|
require('./utils-BbDma_5Y.cjs');
|
|
11
11
|
require('./virtual-B1MLgqnQ.cjs');
|
|
12
12
|
const require_resolve_options = require('./resolve-options-BQnTgg3V.cjs');
|
|
13
|
-
const require_esbuild = require('./esbuild-
|
|
13
|
+
const require_esbuild = require('./esbuild-BblRTl0L.cjs');
|
|
14
14
|
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
15
15
|
let __stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
16
16
|
let __stryke_path_append = require("@stryke/path/append");
|
package/dist/tsup.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Et as PluginContext, er as Plugin, j as ResolvedConfig } from "./config-CK756s0L.mjs";
|
|
2
2
|
import "./config-CiPXgwzt.mjs";
|
|
3
3
|
import "./index-C7W0kmm7.mjs";
|
|
4
|
-
import "./index-
|
|
4
|
+
import "./index-2JXW-b2-.mjs";
|
|
5
5
|
import { resolveOptions } from "@storm-software/tsup";
|
|
6
6
|
import { Options } from "tsup";
|
|
7
7
|
import { BuildOptions as BuildOptions$1 } from "@storm-software/tsup/types";
|
package/dist/tsup.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as createUnplugin } from "./api-
|
|
1
|
+
import { o as createUnplugin } from "./api-D-RIxwbi.mjs";
|
|
2
2
|
import "./tsconfig-B92heKit.mjs";
|
|
3
3
|
import "./plugin-utils-C3HnZJl1.mjs";
|
|
4
4
|
import "./plugin-E5foRD0k.mjs";
|
|
@@ -8,7 +8,7 @@ import "./config-D4Fh2gQL.mjs";
|
|
|
8
8
|
import "./utils-DoQcX7Sk.mjs";
|
|
9
9
|
import "./virtual-B9imjOqe.mjs";
|
|
10
10
|
import { n as resolveEntry } from "./resolve-options-DHL3RM8F.mjs";
|
|
11
|
-
import { t as esbuild_default } from "./esbuild-
|
|
11
|
+
import { t as esbuild_default } from "./esbuild-xbqsWwqN.mjs";
|
|
12
12
|
import { toArray } from "@stryke/convert/to-array";
|
|
13
13
|
import { omit } from "@stryke/helpers/omit";
|
|
14
14
|
import { appendPath } from "@stryke/path/append";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _t as Context, cn as ParsedTypeScriptConfig, pn as TSConfig } from "../config-CK756s0L.mjs";
|
|
2
2
|
import "../config-CiPXgwzt.mjs";
|
|
3
3
|
import "../index-C7W0kmm7.mjs";
|
|
4
|
-
import "../index-
|
|
4
|
+
import "../index-2JXW-b2-.mjs";
|
|
5
5
|
import { FileSystemHost, InMemoryFileSystemHost, Project, ProjectOptions, RuntimeDirEntry } from "ts-morph";
|
|
6
6
|
import ts from "typescript";
|
|
7
7
|
import { FilterPattern } from "@stryke/types/file";
|
package/dist/unloader.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
3
|
-
const require_api = require('./api-
|
|
3
|
+
const require_api = require('./api-Dspa27jK.cjs');
|
|
4
4
|
require('./tsconfig-C8M8X6U0.cjs');
|
|
5
5
|
require('./plugin-utils-Ck3cx3w6.cjs');
|
|
6
6
|
require('./plugin-CZ_PJPpQ.cjs');
|
package/dist/unloader.d.mts
CHANGED
package/dist/unloader.mjs
CHANGED
package/dist/unplugin.cjs
CHANGED
package/dist/unplugin.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Cr as UnpluginFactory, Nr as API, Sr as UnpluginBuilderVariant, _t as Context, wr as UnpluginOptions$1 } from "./config-vnrrSxEB.cjs";
|
|
2
|
-
import { a as createUnplugin, c as __ΩCreateUnpluginModuleResolutionFunctionsOptions, d as isUnpluginBuilderVariant, i as __ΩCreateUnpluginResolverOptions, l as createUnpluginModuleResolutionFunctions, n as CreateUnpluginResolverOptions, o as createUnpluginResolver, r as __ΩCreateUnpluginOptions, s as CreateUnpluginModuleResolutionFunctionsOptions, t as CreateUnpluginOptions, u as combineContexts } from "./plugin-
|
|
2
|
+
import { a as createUnplugin, c as __ΩCreateUnpluginModuleResolutionFunctionsOptions, d as isUnpluginBuilderVariant, i as __ΩCreateUnpluginResolverOptions, l as createUnpluginModuleResolutionFunctions, n as CreateUnpluginResolverOptions, o as createUnpluginResolver, r as __ΩCreateUnpluginOptions, s as CreateUnpluginModuleResolutionFunctionsOptions, t as CreateUnpluginOptions, u as combineContexts } from "./plugin-B9TQt-p0.cjs";
|
|
3
3
|
import { UnpluginOptions } from "unplugin";
|
|
4
4
|
|
|
5
5
|
//#region src/unplugin.d.ts
|
package/dist/unplugin.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Cr as UnpluginFactory, Nr as API, Sr as UnpluginBuilderVariant, _t as Context, wr as UnpluginOptions$1 } from "./config-CK756s0L.mjs";
|
|
2
2
|
import "./config-CiPXgwzt.mjs";
|
|
3
3
|
import "./index-C7W0kmm7.mjs";
|
|
4
|
-
import { a as createUnplugin, c as __ΩCreateUnpluginModuleResolutionFunctionsOptions, d as isUnpluginBuilderVariant, i as __ΩCreateUnpluginResolverOptions, l as createUnpluginModuleResolutionFunctions, n as CreateUnpluginResolverOptions, o as createUnpluginResolver, r as __ΩCreateUnpluginOptions, s as CreateUnpluginModuleResolutionFunctionsOptions, t as CreateUnpluginOptions, u as combineContexts } from "./index-
|
|
4
|
+
import { a as createUnplugin, c as __ΩCreateUnpluginModuleResolutionFunctionsOptions, d as isUnpluginBuilderVariant, i as __ΩCreateUnpluginResolverOptions, l as createUnpluginModuleResolutionFunctions, n as CreateUnpluginResolverOptions, o as createUnpluginResolver, r as __ΩCreateUnpluginOptions, s as CreateUnpluginModuleResolutionFunctionsOptions, t as CreateUnpluginOptions, u as combineContexts } from "./index-2JXW-b2-.mjs";
|
|
5
5
|
import { UnpluginOptions } from "unplugin";
|
|
6
6
|
|
|
7
7
|
//#region src/unplugin.d.ts
|
package/dist/unplugin.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createUnpluginFactory, c as createUnpluginModuleResolutionFunctions, l as combineContexts, o as createUnplugin, s as createUnpluginResolver, u as isUnpluginBuilderVariant } from "./api-
|
|
1
|
+
import { a as createUnpluginFactory, c as createUnpluginModuleResolutionFunctions, l as combineContexts, o as createUnplugin, s as createUnpluginResolver, u as isUnpluginBuilderVariant } from "./api-D-RIxwbi.mjs";
|
|
2
2
|
import "./tsconfig-B92heKit.mjs";
|
|
3
3
|
import "./plugin-utils-C3HnZJl1.mjs";
|
|
4
4
|
import "./plugin-E5foRD0k.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createUnpluginFactory, o as createUnplugin } from "./api-
|
|
1
|
+
import { a as createUnpluginFactory, o as createUnplugin } from "./api-D-RIxwbi.mjs";
|
|
2
2
|
import { r as resolveOptions$1 } from "./resolve-options-DHL3RM8F.mjs";
|
|
3
3
|
import { n as resolveOptions$3 } from "./resolve-options-6sXFqzEA.mjs";
|
|
4
4
|
import { t as resolveOptions$2 } from "./resolve-options-D-RGs8j8.mjs";
|
|
@@ -168,4 +168,4 @@ var vite_default = unplugin;
|
|
|
168
168
|
|
|
169
169
|
//#endregion
|
|
170
170
|
export { vite_default as n, src_default as r, unplugin as t };
|
|
171
|
-
//# sourceMappingURL=vite-
|
|
171
|
+
//# sourceMappingURL=vite-5WSLwM5t.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-CEZ8iJOi.mjs","names":["DEFAULT_VITE_CONFIG: Partial<ViteOptions>","resolveEsbuildOptions","resolveRolldownOptions","resolveRollupOptions","createVitePlugin","createViteUnplugin","createVitePlugin","plugin"],"sources":["../../plugin-vite/src/helpers/resolve-options.ts","../../plugin-vite/src/helpers/unplugin.ts","../../plugin-vite/src/index.ts","../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 { Context } from \"@powerlines/core\";\nimport { resolveOptions as resolveEsbuildOptions } from \"@powerlines/plugin-esbuild/helpers/resolve-options\";\nimport { resolveOptions as resolveRolldownOptions } from \"@powerlines/plugin-rolldown/helpers/resolve-options\";\nimport { resolveOptions as resolveRollupOptions } from \"@powerlines/plugin-rollup/helpers/resolve-options\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { ESBuildOptions } from \"vite\";\nimport { VitePluginResolvedConfig } from \"../types\";\nimport { ViteOptions } from \"../types/build\";\n\nexport const DEFAULT_VITE_CONFIG: Partial<ViteOptions> = {\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(context: Context): ViteOptions {\n return defu(\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 },\n (context.config as VitePluginResolvedConfig).vite\n ? defu(\n (context.config as VitePluginResolvedConfig).vite,\n {\n optimizeDeps:\n (context.config as VitePluginResolvedConfig).vite?.optimizeDeps ??\n {}\n },\n {\n optimizeDeps: {\n extensions: context.config.resolve.extensions\n }\n }\n )\n : {},\n {\n define: context.config.define,\n rootDir: context.fs.existsSync(joinPaths(context.config.root, \"src\"))\n ? joinPaths(context.config.root, \"src\")\n : context.config.root,\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.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n outDir: context.config.output.buildPath,\n tsconfig: context.tsconfig.tsconfigFilePath,\n tsconfigRaw: context.tsconfig.tsconfigJson\n },\n esbuild: resolveEsbuildOptions(context) as ESBuildOptions,\n optimizeDeps: {\n rolldownOptions: resolveRolldownOptions(context),\n rollupOptions: resolveRollupOptions(context),\n esbuildOptions: resolveEsbuildOptions(context)\n },\n logLevel: context.config.logLevel ?? undefined,\n envDir: context.config.root\n } as ViteOptions,\n DEFAULT_VITE_CONFIG\n ) as ViteOptions;\n}\n","/* -------------------------------------------------------------------\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 { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createVitePlugin as createViteUnplugin } from \"unplugin\";\nimport { VitePluginContext } from \"../types/plugin\";\n\nexport function createVitePlugin(context: VitePluginContext) {\n return createViteUnplugin(createUnplugin(context))({});\n}\n","/* -------------------------------------------------------------------\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, Plugin } from \"@powerlines/core\";\nimport defu from \"defu\";\nimport { build, InlineConfig } from \"vite\";\nimport { DEFAULT_VITE_CONFIG, resolveOptions } from \"./helpers/resolve-options\";\nimport { createVitePlugin } from \"./helpers/unplugin\";\nimport { UNSAFE_VitePluginContext } from \"./types/_internal\";\nimport {\n VitePluginContext,\n VitePluginOptions,\n VitePluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface Config {\n vite?: VitePluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <TContext extends VitePluginContext = VitePluginContext>(\n options: VitePluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"vite\",\n config() {\n this.trace(\n \"Providing default configuration for the Powerlines `vite` build plugin.\"\n );\n\n return {\n output: {\n format: [\"cjs\", \"esm\"]\n },\n vite: {\n ...DEFAULT_VITE_CONFIG,\n ...options\n },\n singleBuild: true\n } as Partial<VitePluginResolvedConfig>;\n },\n async build() {\n this.trace(`Building the Powerlines plugin.`);\n\n const environments = (this as unknown as UNSAFE_VitePluginContext)\n ?.$$internal?.api?.context?.environments;\n if (!environments || Object.keys(environments).length === 0) {\n throw new Error(\n `No environments found in the Powerlines context. At least one environment should have been generated - please report this issue to https://github.com/storm-software/powerlines/issues.`\n );\n }\n\n this.trace(\n `Running Vite for ${Object.keys(environments).length} environments.`\n );\n\n const config = defu(\n {\n config: false,\n entry: this.entry,\n environments: Object.fromEntries(\n Object.entries(environments).map(([name, env]) => [\n name,\n resolveOptions(env as Context)\n ])\n )\n },\n resolveOptions(this),\n {\n plugins: [createVitePlugin(this)]\n }\n );\n\n await build(config as InlineConfig);\n }\n };\n};\n\nexport default plugin;\n","/* -------------------------------------------------------------------\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 { resolveOptions } from \"@powerlines/plugin-vite/helpers/resolve-options\";\nimport {\n ViteOptions,\n VitePluginUserConfig\n} from \"@powerlines/plugin-vite/types\";\nimport { isDevelopmentMode, isTestMode } from \"@stryke/env/environment-checks\";\nimport defu from \"defu\";\nimport { createVitePlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\nexport { default as plugin, default as vite } from \"@powerlines/plugin-vite\";\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/vite\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const unplugin = createVitePlugin<Partial<VitePluginUserConfig>>(\n createUnpluginFactory(\"vite\", (api, plugin) => {\n return {\n ...plugin,\n vite: {\n sharedDuringBuild: true,\n\n async hotUpdate(options) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:hotUpdate\", { environment }, options);\n },\n async config(config, env) {\n api.context.config.mode = isDevelopmentMode(env.mode)\n ? \"development\"\n : isTestMode(env.mode)\n ? \"test\"\n : \"production\";\n\n const environment = await api.context.getEnvironment();\n const result = await api.callHook(\n \"vite:config\",\n { environment },\n config,\n env\n );\n\n return defu(\n resolveOptions(api.context),\n // Need to use `any` here to avoid excessive type complexity\n result?.build ?? {},\n config\n ) as Omit<ViteOptions, \"plugins\">;\n },\n async configResolved(_config) {\n const environment = await api.context.getEnvironment();\n\n await api.callHook(\"configResolved\", { environment });\n },\n async configureServer(server) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:configureServer\", { environment }, server);\n },\n async configurePreviewServer(server) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\n \"vite:configurePreviewServer\",\n { environment },\n server\n );\n },\n async transformIndexHtml(html, ctx) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\n \"vite:transformIndexHtml\",\n { environment },\n html,\n ctx\n );\n },\n async handleHotUpdate(ctx) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:handleHotUpdate\", { environment }, ctx);\n }\n }\n };\n })\n);\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;AA4BA,MAAaA,sBAA4C;CACvD,SAAS,EACP,YAAY;EAAC;EAAQ;EAAO;EAAQ;EAAO;EAAQ;EAAQ;EAAQ,EACpE;CACD,MAAM,EACJ,WAAW,MACZ;CACD,UAAU;CACV,aAAa;CACd;;;;;;;AAQD,SAAgB,eAAe,SAA+B;AAC5D,QAAO,KACL,EACE,SAAS;EACP,OAAO,OAAO,QAAQ,QAAQ,MAAM,CAAC,QAClC,KAAK,CAAC,IAAI,UAAU;AACnB,OAAI,CAAC,IAAI,MAAK,MAAK,EAAE,SAAS,GAAG,CAC/B,KAAI,KAAK;IACP,MAAM;IACN,aAAa;IACd,CAAC;OAEF,SAAQ,KACN,8BAA8B,GAAG,2CAClC;AAGH,UAAO;KAET,EAAE,CACH;EACD,QAAQ,QAAQ,OAAO,QAAQ;EAC/B,YAAY,QAAQ,OAAO,QAAQ;EACnC,YAAY,QAAQ,OAAO,QAAQ;EACnC,YAAY,QAAQ,OAAO,QAAQ;EACpC,EACF,EACA,QAAQ,OAAoC,OACzC,KACG,QAAQ,OAAoC,MAC7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MAAM,uBAAuB,QAAQ;IACnC,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,WAAO,IAAI,SACT,+BACA,EAAE,aAAa,EACf,OACD;;GAEH,MAAM,mBAAmB,MAAM,KAAK;IAClC,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,WAAO,IAAI,SACT,2BACA,EAAE,aAAa,EACf,MACA,IACD;;GAEH,MAAM,gBAAgB,KAAK;IACzB,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,WAAO,IAAI,SAAS,wBAAwB,EAAE,aAAa,EAAE,IAAI;;GAEpE;EACF;EACD,CACH;AAED,mBAAe"}
|
|
1
|
+
{"version":3,"file":"vite-5WSLwM5t.mjs","names":["DEFAULT_VITE_CONFIG: Partial<ViteOptions>","resolveEsbuildOptions","resolveRolldownOptions","resolveRollupOptions","createVitePlugin","createViteUnplugin","createVitePlugin","plugin"],"sources":["../../plugin-vite/src/helpers/resolve-options.ts","../../plugin-vite/src/helpers/unplugin.ts","../../plugin-vite/src/index.ts","../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 { Context } from \"@powerlines/core\";\nimport { resolveOptions as resolveEsbuildOptions } from \"@powerlines/plugin-esbuild/helpers/resolve-options\";\nimport { resolveOptions as resolveRolldownOptions } from \"@powerlines/plugin-rolldown/helpers/resolve-options\";\nimport { resolveOptions as resolveRollupOptions } from \"@powerlines/plugin-rollup/helpers/resolve-options\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { ESBuildOptions } from \"vite\";\nimport { VitePluginResolvedConfig } from \"../types\";\nimport { ViteOptions } from \"../types/build\";\n\nexport const DEFAULT_VITE_CONFIG: Partial<ViteOptions> = {\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(context: Context): ViteOptions {\n return defu(\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 },\n (context.config as VitePluginResolvedConfig).vite\n ? defu(\n (context.config as VitePluginResolvedConfig).vite,\n {\n optimizeDeps:\n (context.config as VitePluginResolvedConfig).vite?.optimizeDeps ??\n {}\n },\n {\n optimizeDeps: {\n extensions: context.config.resolve.extensions\n }\n }\n )\n : {},\n {\n define: context.config.define,\n rootDir: context.fs.existsSync(joinPaths(context.config.root, \"src\"))\n ? joinPaths(context.config.root, \"src\")\n : context.config.root,\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.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n outDir: context.config.output.buildPath,\n tsconfig: context.tsconfig.tsconfigFilePath,\n tsconfigRaw: context.tsconfig.tsconfigJson\n },\n esbuild: resolveEsbuildOptions(context) as ESBuildOptions,\n optimizeDeps: {\n rolldownOptions: resolveRolldownOptions(context),\n rollupOptions: resolveRollupOptions(context),\n esbuildOptions: resolveEsbuildOptions(context)\n },\n logLevel: context.config.logLevel ?? undefined,\n envDir: context.config.root\n } as ViteOptions,\n DEFAULT_VITE_CONFIG\n ) as ViteOptions;\n}\n","/* -------------------------------------------------------------------\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 { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createVitePlugin as createViteUnplugin } from \"unplugin\";\nimport { VitePluginContext } from \"../types/plugin\";\n\nexport function createVitePlugin(context: VitePluginContext) {\n return createViteUnplugin(createUnplugin(context))({});\n}\n","/* -------------------------------------------------------------------\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, Plugin } from \"@powerlines/core\";\nimport defu from \"defu\";\nimport { build, InlineConfig } from \"vite\";\nimport { DEFAULT_VITE_CONFIG, resolveOptions } from \"./helpers/resolve-options\";\nimport { createVitePlugin } from \"./helpers/unplugin\";\nimport { UNSAFE_VitePluginContext } from \"./types/_internal\";\nimport {\n VitePluginContext,\n VitePluginOptions,\n VitePluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface Config {\n vite?: VitePluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <TContext extends VitePluginContext = VitePluginContext>(\n options: VitePluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"vite\",\n config() {\n this.trace(\n \"Providing default configuration for the Powerlines `vite` build plugin.\"\n );\n\n return {\n output: {\n format: [\"cjs\", \"esm\"]\n },\n vite: {\n ...DEFAULT_VITE_CONFIG,\n ...options\n },\n singleBuild: true\n } as Partial<VitePluginResolvedConfig>;\n },\n async build() {\n this.trace(`Building the Powerlines plugin.`);\n\n const environments = (this as unknown as UNSAFE_VitePluginContext)\n ?.$$internal?.api?.context?.environments;\n if (!environments || Object.keys(environments).length === 0) {\n throw new Error(\n `No environments found in the Powerlines context. At least one environment should have been generated - please report this issue to https://github.com/storm-software/powerlines/issues.`\n );\n }\n\n this.trace(\n `Running Vite for ${Object.keys(environments).length} environments.`\n );\n\n const config = defu(\n {\n config: false,\n entry: this.entry,\n environments: Object.fromEntries(\n Object.entries(environments).map(([name, env]) => [\n name,\n resolveOptions(env as Context)\n ])\n )\n },\n resolveOptions(this),\n {\n plugins: [createVitePlugin(this)]\n }\n );\n\n await build(config as InlineConfig);\n }\n };\n};\n\nexport default plugin;\n","/* -------------------------------------------------------------------\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 { resolveOptions } from \"@powerlines/plugin-vite/helpers/resolve-options\";\nimport {\n ViteOptions,\n VitePluginUserConfig\n} from \"@powerlines/plugin-vite/types\";\nimport { isDevelopmentMode, isTestMode } from \"@stryke/env/environment-checks\";\nimport defu from \"defu\";\nimport { createVitePlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\nexport { default as plugin, default as vite } from \"@powerlines/plugin-vite\";\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/vite\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const unplugin = createVitePlugin<Partial<VitePluginUserConfig>>(\n createUnpluginFactory(\"vite\", (api, plugin) => {\n return {\n ...plugin,\n vite: {\n sharedDuringBuild: true,\n\n async hotUpdate(options) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:hotUpdate\", { environment }, options);\n },\n async config(config, env) {\n api.context.config.mode = isDevelopmentMode(env.mode)\n ? \"development\"\n : isTestMode(env.mode)\n ? \"test\"\n : \"production\";\n\n const environment = await api.context.getEnvironment();\n const result = await api.callHook(\n \"vite:config\",\n { environment },\n config,\n env\n );\n\n return defu(\n resolveOptions(api.context),\n // Need to use `any` here to avoid excessive type complexity\n result?.build ?? {},\n config\n ) as Omit<ViteOptions, \"plugins\">;\n },\n async configResolved(_config) {\n const environment = await api.context.getEnvironment();\n\n await api.callHook(\"configResolved\", { environment });\n },\n async configureServer(server) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:configureServer\", { environment }, server);\n },\n async configurePreviewServer(server) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\n \"vite:configurePreviewServer\",\n { environment },\n server\n );\n },\n async transformIndexHtml(html, ctx) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\n \"vite:transformIndexHtml\",\n { environment },\n html,\n ctx\n );\n },\n async handleHotUpdate(ctx) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:handleHotUpdate\", { environment }, ctx);\n }\n }\n };\n })\n);\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;AA4BA,MAAaA,sBAA4C;CACvD,SAAS,EACP,YAAY;EAAC;EAAQ;EAAO;EAAQ;EAAO;EAAQ;EAAQ;EAAQ,EACpE;CACD,MAAM,EACJ,WAAW,MACZ;CACD,UAAU;CACV,aAAa;CACd;;;;;;;AAQD,SAAgB,eAAe,SAA+B;AAC5D,QAAO,KACL,EACE,SAAS;EACP,OAAO,OAAO,QAAQ,QAAQ,MAAM,CAAC,QAClC,KAAK,CAAC,IAAI,UAAU;AACnB,OAAI,CAAC,IAAI,MAAK,MAAK,EAAE,SAAS,GAAG,CAC/B,KAAI,KAAK;IACP,MAAM;IACN,aAAa;IACd,CAAC;OAEF,SAAQ,KACN,8BAA8B,GAAG,2CAClC;AAGH,UAAO;KAET,EAAE,CACH;EACD,QAAQ,QAAQ,OAAO,QAAQ;EAC/B,YAAY,QAAQ,OAAO,QAAQ;EACnC,YAAY,QAAQ,OAAO,QAAQ;EACnC,YAAY,QAAQ,OAAO,QAAQ;EACpC,EACF,EACA,QAAQ,OAAoC,OACzC,KACG,QAAQ,OAAoC,MAC7C,EACE,cACG,QAAQ,OAAoC,MAAM,gBACnD,EAAE,EACL,EACD,EACE,cAAc,EACZ,YAAY,QAAQ,OAAO,QAAQ,YACpC,EACF,CACF,GACD,EAAE,EACN;EACE,QAAQ,QAAQ,OAAO;EACvB,SAAS,QAAQ,GAAG,WAAW,UAAU,QAAQ,OAAO,MAAM,MAAM,CAAC,GACjE,UAAU,QAAQ,OAAO,MAAM,MAAM,GACrC,QAAQ,OAAO;EACnB,UAAU,QAAQ,OAAO;EACzB,MACE,QAAQ,OAAO,SAAS,gBAAgB,gBAAgB;EAC1D,UAAU,UAAU,QAAQ,WAAW,OAAO;EAC9C,OAAO;GACL,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AAED,mBAAe"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_api = require('./api-
|
|
2
|
+
const require_api = require('./api-Dspa27jK.cjs');
|
|
3
3
|
const require_resolve_options = require('./resolve-options-BQnTgg3V.cjs');
|
|
4
4
|
const require_resolve_options$1 = require('./resolve-options-vyFhhkLp.cjs');
|
|
5
5
|
const require_resolve_options$2 = require('./resolve-options-lxQ2pm0W.cjs');
|
package/dist/vite.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./api-
|
|
2
|
+
require('./api-Dspa27jK.cjs');
|
|
3
3
|
require('./tsconfig-C8M8X6U0.cjs');
|
|
4
4
|
require('./plugin-utils-Ck3cx3w6.cjs');
|
|
5
5
|
require('./plugin-CZ_PJPpQ.cjs');
|
|
@@ -11,7 +11,7 @@ require('./virtual-B1MLgqnQ.cjs');
|
|
|
11
11
|
require('./resolve-options-BQnTgg3V.cjs');
|
|
12
12
|
require('./resolve-options-vyFhhkLp.cjs');
|
|
13
13
|
require('./resolve-options-lxQ2pm0W.cjs');
|
|
14
|
-
const require_vite = require('./vite-
|
|
14
|
+
const require_vite = require('./vite-D-f0L5Sn.cjs');
|
|
15
15
|
|
|
16
16
|
exports.default = require_vite.vite_default;
|
|
17
17
|
exports["module.exports"] = require_vite.unplugin;
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { er as Plugin } from "./config-CK756s0L.mjs";
|
|
2
2
|
import "./config-CiPXgwzt.mjs";
|
|
3
3
|
import "./index-C7W0kmm7.mjs";
|
|
4
|
-
import "./index-
|
|
4
|
+
import "./index-2JXW-b2-.mjs";
|
|
5
5
|
import { n as VitePluginOptions, r as VitePluginUserConfig, t as VitePluginContext } from "./plugin-C_8RhG5V.mjs";
|
|
6
6
|
import * as vite0 from "vite";
|
|
7
7
|
|
package/dist/vite.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./api-
|
|
1
|
+
import "./api-D-RIxwbi.mjs";
|
|
2
2
|
import "./tsconfig-B92heKit.mjs";
|
|
3
3
|
import "./plugin-utils-C3HnZJl1.mjs";
|
|
4
4
|
import "./plugin-E5foRD0k.mjs";
|
|
@@ -10,6 +10,6 @@ import "./virtual-B9imjOqe.mjs";
|
|
|
10
10
|
import "./resolve-options-DHL3RM8F.mjs";
|
|
11
11
|
import "./resolve-options-6sXFqzEA.mjs";
|
|
12
12
|
import "./resolve-options-D-RGs8j8.mjs";
|
|
13
|
-
import { n as vite_default, r as src_default, t as unplugin } from "./vite-
|
|
13
|
+
import { n as vite_default, r as src_default, t as unplugin } from "./vite-5WSLwM5t.mjs";
|
|
14
14
|
|
|
15
15
|
export { vite_default as default, unplugin as "module.exports", unplugin, src_default as plugin, src_default as vite };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_api = require('./api-
|
|
2
|
+
const require_api = require('./api-Dspa27jK.cjs');
|
|
3
3
|
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
4
4
|
let defu = require("defu");
|
|
5
5
|
defu = require_chunk.__toESM(defu);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createUnpluginFactory, o as createUnplugin } from "./api-
|
|
1
|
+
import { a as createUnpluginFactory, o as createUnplugin } from "./api-D-RIxwbi.mjs";
|
|
2
2
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
3
3
|
import defu from "defu";
|
|
4
4
|
import { createWebpackPlugin } from "unplugin";
|
|
@@ -85,4 +85,4 @@ var webpack_default = unplugin;
|
|
|
85
85
|
|
|
86
86
|
//#endregion
|
|
87
87
|
export { webpack_default as n, src_default as r, unplugin as t };
|
|
88
|
-
//# sourceMappingURL=webpack-
|
|
88
|
+
//# sourceMappingURL=webpack-z0CSoK50.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-
|
|
1
|
+
{"version":3,"file":"webpack-z0CSoK50.mjs","names":["createWebpackPlugin","createWebpackUnplugin","createWebpackPlugin"],"sources":["../../plugin-webpack/src/helpers/resolve-options.ts","../../plugin-webpack/src/helpers/unplugin.ts","../../plugin-webpack/src/index.ts","../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 } from \"@powerlines/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport type { Configuration as ExternalWebpackOptions } from \"webpack\";\nimport { WebpackPluginResolvedConfig } from \"../types\";\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(context: Context): ExternalWebpackOptions {\n return defu(\n {\n resolve: {\n alias: context.alias\n }\n },\n (context.config as WebpackPluginResolvedConfig).webpack\n ? (context.config as WebpackPluginResolvedConfig).webpack\n : {},\n {\n output: {\n path: joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.output.buildPath\n )\n },\n name: context.config.name,\n plugins:\n (context.config as WebpackPluginResolvedConfig).webpack?.plugins ?? [],\n node:\n context.config.platform === \"node\"\n ? ({\n __dirname: true,\n __filename: true,\n global: true\n } as ExternalWebpackOptions[\"node\"])\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(\n context.workspaceConfig.workspaceRoot,\n context.config.root\n ),\n noExternal: context.builtins,\n devtool: (context.config.mode !== \"development\"\n ? false\n : \"source-map\") as string | false,\n optimization: {\n minimize: context.config.mode !== \"development\"\n }\n }\n );\n}\n","/* -------------------------------------------------------------------\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 { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createWebpackPlugin as createWebpackUnplugin } from \"unplugin\";\nimport { WebpackPluginContext } from \"../types/plugin\";\n\nexport function createWebpackPlugin(context: WebpackPluginContext) {\n return createWebpackUnplugin(createUnplugin(context))({});\n}\n","/* -------------------------------------------------------------------\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 { Plugin } from \"@powerlines/core\";\nimport defu from \"defu\";\nimport build from \"webpack\";\nimport { resolveOptions } from \"./helpers/resolve-options\";\nimport { createWebpackPlugin } from \"./helpers/unplugin\";\nimport {\n WebpackPluginContext,\n WebpackPluginOptions,\n WebpackPluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface Config {\n webpack?: WebpackPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <\n TContext extends WebpackPluginContext = WebpackPluginContext\n>(\n options: WebpackPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"webpack\",\n config() {\n this.trace(\n \"Providing default configuration for the Powerlines `webpack` build plugin.\"\n );\n\n return {\n webpack: {\n ...options\n }\n } as Partial<WebpackPluginResolvedConfig>;\n },\n async build() {\n build(\n defu(\n {\n entry: this.entry.reduce(\n (ret, entry) => {\n ret[entry.output || entry.name || entry.file] = entry.file;\n\n return ret;\n },\n {} as Record<string, string>\n )\n },\n resolveOptions(this),\n {\n plugins: [createWebpackPlugin(this)]\n }\n )\n );\n }\n };\n};\n\nexport default plugin;\n","/* -------------------------------------------------------------------\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 { WebpackPluginUserConfig } from \"@powerlines/plugin-webpack/types/plugin\";\nimport { createWebpackPlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\nexport {\n default as plugin,\n default as webpack\n} from \"@powerlines/plugin-webpack\";\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/webpack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const unplugin = createWebpackPlugin<Partial<WebpackPluginUserConfig>>(\n createUnpluginFactory(\"webpack\")\n);\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,eAAe,SAA0C;AACvE,QAAO,KACL,EACE,SAAS,EACP,OAAO,QAAQ,OAChB,EACF,EACA,QAAQ,OAAuC,UAC3C,QAAQ,OAAuC,UAChD,EAAE,EACN;EACE,QAAQ,EACN,MAAM,UACJ,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,OAAO,UACvB,EACF;EACD,MAAM,QAAQ,OAAO;EACrB,SACG,QAAQ,OAAuC,SAAS,WAAW,EAAE;EACxE,MACE,QAAQ,OAAO,aAAa,SACvB;GACC,WAAW;GACX,YAAY;GACZ,QAAQ;GACT,GACD;EACN,MACE,QAAQ,OAAO,SAAS,gBACnB,gBACA;EACP,OAAO;GACL,MAAM;GACN,gBAAgB,UAAU,QAAQ,WAAW,WAAW,QAAQ;GACjE;EACD,kBAAkB,UAChB,QAAQ,WACR,WACA,wBACD;EACD,mBAAmB,UACjB,QAAQ,WACR,WACA,wBACD;EACD,SAAS,UACP,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,KAChB;EACD,YAAY,QAAQ;EACpB,SAAU,QAAQ,OAAO,SAAS,gBAC9B,QACA;EACJ,cAAc,EACZ,UAAU,QAAQ,OAAO,SAAS,eACnC;EACF,CACF;;;;;AClEH,SAAgBA,sBAAoB,SAA+B;AACjE,QAAOC,oBAAsB,eAAe,QAAQ,CAAC,CAAC,EAAE,CAAC;;;;;;;;ACkB3D,MAAa,UAGX,UAAgC,EAAE,KACb;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,QAAK,MACH,6EACD;AAED,UAAO,EACL,SAAS,EACP,GAAG,SACJ,EACF;;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