@powerlines/plugin-vite 0.14.441 → 0.14.443
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/helpers/resolve-options.cjs +4 -3
- package/dist/helpers/resolve-options.mjs +4 -3
- package/dist/helpers/resolve-options.mjs.map +1 -1
- package/dist/helpers/unplugin.cjs +4 -1
- package/dist/helpers/unplugin.mjs +4 -1
- package/dist/helpers/unplugin.mjs.map +1 -1
- package/dist/index.cjs +9 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +9 -3
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/plugin.d.cts +4 -3
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +4 -3
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +7 -6
|
@@ -51,9 +51,9 @@ function resolveOptions(context) {
|
|
|
51
51
|
mode: context.config.mode === "development" ? "development" : "production",
|
|
52
52
|
cacheDir: (0, _stryke_path_join_paths.joinPaths)(context.cachePath, "vite"),
|
|
53
53
|
build: {
|
|
54
|
-
minify: context.config.output.minify
|
|
54
|
+
minify: context.config.output.minify,
|
|
55
55
|
metafile: context.config.mode === "development",
|
|
56
|
-
sourcemap: context.config.output.sourceMap
|
|
56
|
+
sourcemap: context.config.output.sourceMap,
|
|
57
57
|
outDir: (0, _stryke_path_file_path_fns.relativePath)((0, _stryke_path_append.appendPath)(context.config.root, context.config.cwd), context.config.output.path),
|
|
58
58
|
tsconfig: (0, _stryke_path_append.appendPath)(context.tsconfig.tsconfigFilePath, context.config.cwd),
|
|
59
59
|
tsconfigRaw: context.tsconfig.tsconfigJson
|
|
@@ -64,7 +64,8 @@ function resolveOptions(context) {
|
|
|
64
64
|
rollupOptions: (0, _powerlines_plugin_rollup_helpers_resolve_options.resolveOptions)(context),
|
|
65
65
|
esbuildOptions: (0, _powerlines_plugin_esbuild_helpers_resolve_options.resolveOptions)(context)
|
|
66
66
|
},
|
|
67
|
-
logLevel: context.config.logLevel
|
|
67
|
+
logLevel: context.config.logLevel.general === "trace" ? "debug" : context.config.logLevel.general === "debug" ? "warn" : "error",
|
|
68
|
+
clearScreen: true,
|
|
68
69
|
envDir: context.config.root
|
|
69
70
|
}, DEFAULT_VITE_CONFIG);
|
|
70
71
|
}
|
|
@@ -48,9 +48,9 @@ function resolveOptions(context) {
|
|
|
48
48
|
mode: context.config.mode === "development" ? "development" : "production",
|
|
49
49
|
cacheDir: joinPaths(context.cachePath, "vite"),
|
|
50
50
|
build: {
|
|
51
|
-
minify: context.config.output.minify
|
|
51
|
+
minify: context.config.output.minify,
|
|
52
52
|
metafile: context.config.mode === "development",
|
|
53
|
-
sourcemap: context.config.output.sourceMap
|
|
53
|
+
sourcemap: context.config.output.sourceMap,
|
|
54
54
|
outDir: relativePath(appendPath(context.config.root, context.config.cwd), context.config.output.path),
|
|
55
55
|
tsconfig: appendPath(context.tsconfig.tsconfigFilePath, context.config.cwd),
|
|
56
56
|
tsconfigRaw: context.tsconfig.tsconfigJson
|
|
@@ -61,7 +61,8 @@ function resolveOptions(context) {
|
|
|
61
61
|
rollupOptions: resolveOptions$3(context),
|
|
62
62
|
esbuildOptions: resolveOptions$1(context)
|
|
63
63
|
},
|
|
64
|
-
logLevel: context.config.logLevel
|
|
64
|
+
logLevel: context.config.logLevel.general === "trace" ? "debug" : context.config.logLevel.general === "debug" ? "warn" : "error",
|
|
65
|
+
clearScreen: true,
|
|
65
66
|
envDir: context.config.root
|
|
66
67
|
}, DEFAULT_VITE_CONFIG);
|
|
67
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-options.mjs","names":["resolveEsbuildOptions","resolveRolldownOptions","resolveRollupOptions"],"sources":["../../src/helpers/resolve-options.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 { 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 { 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 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
|
|
1
|
+
{"version":3,"file":"resolve-options.mjs","names":["resolveEsbuildOptions","resolveRolldownOptions","resolveRollupOptions"],"sources":["../../src/helpers/resolve-options.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 { 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 { 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 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 esbuild: resolveEsbuildOptions(context) as ESBuildOptions,\n optimizeDeps: {\n rolldownOptions: resolveRolldownOptions(context),\n rollupOptions: resolveRollupOptions(context),\n esbuildOptions: resolveEsbuildOptions(context)\n },\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"error\",\n clearScreen: true,\n envDir: context.config.root\n } as ViteOptions,\n DEFAULT_VITE_CONFIG\n );\n}\n"],"mappings":";;;;;;;;;AA8BA,MAAa,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,MAAM,WAAW,QAAQ,OAAO,MAAM,QAAQ,OAAO,IAAI;EACzD,UAAU,QAAQ,OAAO;EACzB,MACE,QAAQ,OAAO,SAAS,gBAAgB,gBAAgB;EAC1D,UAAU,UAAU,QAAQ,WAAW,OAAO;EAC9C,OAAO;GACL,QAAQ,QAAQ,OAAO,OAAO;GAC9B,UAAU,QAAQ,OAAO,SAAS;GAClC,WAAW,QAAQ,OAAO,OAAO;GACjC,QAAQ,aACN,WAAW,QAAQ,OAAO,MAAM,QAAQ,OAAO,IAAI,EACnD,QAAQ,OAAO,OAAO,KACvB;GACD,UAAU,WACR,QAAQ,SAAS,kBACjB,QAAQ,OAAO,IAChB;GACD,aAAa,QAAQ,SAAS;GAC/B;EACD,SAASA,iBAAsB,QAAQ;EACvC,cAAc;GACZ,iBAAiBC,iBAAuB,QAAQ;GAChD,eAAeC,iBAAqB,QAAQ;GAC5C,gBAAgBF,iBAAsB,QAAQ;GAC/C;EACD,UACE,QAAQ,OAAO,SAAS,YAAY,UAChC,UACA,QAAQ,OAAO,SAAS,YAAY,UAClC,SACA;EACR,aAAa;EACb,QAAQ,QAAQ,OAAO;EACxB,EACD,oBACD"}
|
|
@@ -8,7 +8,10 @@ function createVitePlugin(context) {
|
|
|
8
8
|
return (0, unplugin.createVitePlugin)((0, _powerlines_core_lib_unplugin.createUnplugin)(context, {
|
|
9
9
|
silenceHookLogging: true,
|
|
10
10
|
name: "vite"
|
|
11
|
-
}))({
|
|
11
|
+
}))({
|
|
12
|
+
...context.options,
|
|
13
|
+
...context.initialConfig
|
|
14
|
+
});
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unplugin.mjs","names":["createViteUnplugin"],"sources":["../../src/helpers/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 { 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(\n createUnplugin(context, { silenceHookLogging: true, name: \"vite\" })\n )({});\n}\n"],"mappings":";;;;AAsBA,SAAgB,iBAAiB,SAA4B;AAC3D,QAAOA,mBACL,eAAe,SAAS;EAAE,oBAAoB;EAAM,MAAM;EAAQ,CAAC,CACpE,CAAC
|
|
1
|
+
{"version":3,"file":"unplugin.mjs","names":["createViteUnplugin"],"sources":["../../src/helpers/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 { 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(\n createUnplugin(context, { silenceHookLogging: true, name: \"vite\" })\n )({ ...context.options, ...context.initialConfig });\n}\n"],"mappings":";;;;AAsBA,SAAgB,iBAAiB,SAA4B;AAC3D,QAAOA,mBACL,eAAe,SAAS;EAAE,oBAAoB;EAAM,MAAM;EAAQ,CAAC,CACpE,CAAC;EAAE,GAAG,QAAQ;EAAS,GAAG,QAAQ;EAAe,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
|
3
3
|
const require_helpers_resolve_options = require('./helpers/resolve-options.cjs');
|
|
4
4
|
const require_helpers_unplugin = require('./helpers/unplugin.cjs');
|
|
5
5
|
require('./helpers/index.cjs');
|
|
6
|
+
let _stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
6
7
|
let defu = require("defu");
|
|
7
8
|
defu = require_runtime.__toESM(defu, 1);
|
|
8
9
|
let vite = require("vite");
|
|
@@ -26,15 +27,20 @@ const plugin = (options = {}) => {
|
|
|
26
27
|
};
|
|
27
28
|
},
|
|
28
29
|
async build() {
|
|
29
|
-
this.
|
|
30
|
+
this.debug("Starting Vite build process...");
|
|
30
31
|
const environments = this?.$$internal?.api?.context?.environments;
|
|
31
32
|
if (!environments || Object.keys(environments).length === 0) throw new Error(`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.`);
|
|
32
33
|
this.trace(`Running Vite for ${Object.keys(environments).length} environments.`);
|
|
33
|
-
|
|
34
|
+
const options = (0, defu.default)({
|
|
34
35
|
config: false,
|
|
35
36
|
entry: this.entry,
|
|
36
37
|
environments: Object.fromEntries(Object.entries(environments).map(([name, env]) => [name, require_helpers_resolve_options.resolveOptions(env)]))
|
|
37
|
-
}, require_helpers_resolve_options.resolveOptions(this), { plugins: [require_helpers_unplugin.createVitePlugin(this)] })
|
|
38
|
+
}, require_helpers_resolve_options.resolveOptions(this), { plugins: [require_helpers_unplugin.createVitePlugin(this)] });
|
|
39
|
+
this.trace({
|
|
40
|
+
meta: { category: "config" },
|
|
41
|
+
message: `Resolved Vite configuration: \n${JSON.stringify((0, _stryke_helpers_omit.omit)(options, ["plugins"]), null, 2)}`
|
|
42
|
+
});
|
|
43
|
+
await (0, vite.build)(options);
|
|
38
44
|
}
|
|
39
45
|
};
|
|
40
46
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ViteOptions, __ΩViteOptions } from "./types/build.cjs";
|
|
2
2
|
import { DEFAULT_VITE_CONFIG, resolveOptions } from "./helpers/resolve-options.cjs";
|
|
3
|
-
import { VitePluginContext, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩVitePluginContext, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig } from "./types/plugin.cjs";
|
|
3
|
+
import { VitePluginContext, VitePluginInitialConfig, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩVitePluginContext, __ΩVitePluginInitialConfig, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig } from "./types/plugin.cjs";
|
|
4
4
|
import { createVitePlugin } from "./helpers/unplugin.cjs";
|
|
5
5
|
import { Plugin } from "@powerlines/core";
|
|
6
6
|
|
|
@@ -15,5 +15,5 @@ declare module "@powerlines/core" {
|
|
|
15
15
|
*/
|
|
16
16
|
declare const plugin: <TContext extends VitePluginContext = VitePluginContext>(options?: VitePluginOptions) => Plugin<TContext>;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { DEFAULT_VITE_CONFIG, ViteOptions, VitePluginContext, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩViteOptions, __ΩVitePluginContext, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig, createVitePlugin, plugin as default, plugin, resolveOptions };
|
|
18
|
+
export { DEFAULT_VITE_CONFIG, ViteOptions, VitePluginContext, VitePluginInitialConfig, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩViteOptions, __ΩVitePluginContext, __ΩVitePluginInitialConfig, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig, createVitePlugin, plugin as default, plugin, resolveOptions };
|
|
19
19
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;YA+BY,MAAA;IACR,IAAA,GAAO,iBAAA;EAAA;AAAA;AAJa;;;AAAA,cAWX,MAAA,oBAA2B,iBAAA,GAAoB,iBAAA,EAC1D,OAAA,GAAS,iBAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ViteOptions, __ΩViteOptions } from "./types/build.mjs";
|
|
2
2
|
import { DEFAULT_VITE_CONFIG, resolveOptions } from "./helpers/resolve-options.mjs";
|
|
3
|
-
import { VitePluginContext, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩVitePluginContext, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig } from "./types/plugin.mjs";
|
|
3
|
+
import { VitePluginContext, VitePluginInitialConfig, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩVitePluginContext, __ΩVitePluginInitialConfig, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig } from "./types/plugin.mjs";
|
|
4
4
|
import { createVitePlugin } from "./helpers/unplugin.mjs";
|
|
5
5
|
import { Plugin } from "@powerlines/core";
|
|
6
6
|
|
|
@@ -15,5 +15,5 @@ declare module "@powerlines/core" {
|
|
|
15
15
|
*/
|
|
16
16
|
declare const plugin: <TContext extends VitePluginContext = VitePluginContext>(options?: VitePluginOptions) => Plugin<TContext>;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { DEFAULT_VITE_CONFIG, ViteOptions, VitePluginContext, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩViteOptions, __ΩVitePluginContext, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig, createVitePlugin, plugin as default, plugin, resolveOptions };
|
|
18
|
+
export { DEFAULT_VITE_CONFIG, ViteOptions, VitePluginContext, VitePluginInitialConfig, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩViteOptions, __ΩVitePluginContext, __ΩVitePluginInitialConfig, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig, createVitePlugin, plugin as default, plugin, resolveOptions };
|
|
19
19
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;YA+BY,MAAA;IACR,IAAA,GAAO,iBAAA;EAAA;AAAA;AAJa;;;AAAA,cAWX,MAAA,oBAA2B,iBAAA,GAAoB,iBAAA,EAC1D,OAAA,GAAS,iBAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DEFAULT_VITE_CONFIG, resolveOptions } from "./helpers/resolve-options.mjs";
|
|
2
2
|
import { createVitePlugin } from "./helpers/unplugin.mjs";
|
|
3
3
|
import "./helpers/index.mjs";
|
|
4
|
+
import { omit } from "@stryke/helpers/omit";
|
|
4
5
|
import defu from "defu";
|
|
5
6
|
import { build } from "vite";
|
|
6
7
|
|
|
@@ -23,15 +24,20 @@ const plugin = (options = {}) => {
|
|
|
23
24
|
};
|
|
24
25
|
},
|
|
25
26
|
async build() {
|
|
26
|
-
this.
|
|
27
|
+
this.debug("Starting Vite build process...");
|
|
27
28
|
const environments = this?.$$internal?.api?.context?.environments;
|
|
28
29
|
if (!environments || Object.keys(environments).length === 0) throw new Error(`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.`);
|
|
29
30
|
this.trace(`Running Vite for ${Object.keys(environments).length} environments.`);
|
|
30
|
-
|
|
31
|
+
const options = defu({
|
|
31
32
|
config: false,
|
|
32
33
|
entry: this.entry,
|
|
33
34
|
environments: Object.fromEntries(Object.entries(environments).map(([name, env]) => [name, resolveOptions(env)]))
|
|
34
|
-
}, resolveOptions(this), { plugins: [createVitePlugin(this)] })
|
|
35
|
+
}, resolveOptions(this), { plugins: [createVitePlugin(this)] });
|
|
36
|
+
this.trace({
|
|
37
|
+
meta: { category: "config" },
|
|
38
|
+
message: `Resolved Vite configuration: \n${JSON.stringify(omit(options, ["plugins"]), null, 2)}`
|
|
39
|
+
});
|
|
40
|
+
await build(options);
|
|
35
41
|
}
|
|
36
42
|
};
|
|
37
43
|
};
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Context, Plugin } from \"@powerlines/core\";\nimport defu from \"defu\";\nimport { build } from \"vite\";\nimport { DEFAULT_VITE_CONFIG, resolveOptions } from \"./helpers/resolve-options\";\nimport { createVitePlugin } from \"./helpers/unplugin\";\nimport { Unstable_VitePluginContext } from \"./types/_internal\";\nimport { VitePluginContext, VitePluginOptions } 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 };\n },\n async build() {\n this.
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Context, Plugin } from \"@powerlines/core\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport defu from \"defu\";\nimport { build } from \"vite\";\nimport { DEFAULT_VITE_CONFIG, resolveOptions } from \"./helpers/resolve-options\";\nimport { createVitePlugin } from \"./helpers/unplugin\";\nimport { Unstable_VitePluginContext } from \"./types/_internal\";\nimport { VitePluginContext, VitePluginOptions } 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 };\n },\n async build() {\n this.debug(\"Starting Vite build process...\");\n\n const environments = (this as unknown as Unstable_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 options = 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 this.trace({\n meta: {\n category: \"config\"\n },\n message: `Resolved Vite configuration: \\n${JSON.stringify(\n omit(options, [\"plugins\"]),\n null,\n 2\n )}`\n });\n\n await build(options);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;AAuCA,MAAa,UACX,UAA6B,EAAE,KACV;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,QAAK,MACH,0EACD;AAED,UAAO;IACL,QAAQ,EACN,QAAQ,CAAC,OAAO,MAAM,EACvB;IACD,MAAM;KACJ,GAAG;KACH,GAAG;KACJ;IACD,aAAa;IACd;;EAEH,MAAM,QAAQ;AACZ,QAAK,MAAM,iCAAiC;GAE5C,MAAM,eAAgB,MAClB,YAAY,KAAK,SAAS;AAC9B,OAAI,CAAC,gBAAgB,OAAO,KAAK,aAAa,CAAC,WAAW,EACxD,OAAM,IAAI,MACR,0LACD;AAGH,QAAK,MACH,oBAAoB,OAAO,KAAK,aAAa,CAAC,OAAO,gBACtD;GAED,MAAM,UAAU,KACd;IACE,QAAQ;IACR,OAAO,KAAK;IACZ,cAAc,OAAO,YACnB,OAAO,QAAQ,aAAa,CAAC,KAAK,CAAC,MAAM,SAAS,CAChD,MACA,eAAe,IAAe,CAC/B,CAAC,CACH;IACF,EACD,eAAe,KAAK,EACpB,EACE,SAAS,CAAC,iBAAiB,KAAK,CAAC,EAClC,CACF;AAED,QAAK,MAAM;IACT,MAAM,EACJ,UAAU,UACX;IACD,SAAS,kCAAkC,KAAK,UAC9C,KAAK,SAAS,CAAC,UAAU,CAAC,EAC1B,MACA,EACD;IACF,CAAC;AAEF,SAAM,MAAM,QAAQ;;EAEvB"}
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ViteOptions, __ΩViteOptions } from "./build.cjs";
|
|
2
|
-
import { VitePluginContext, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩVitePluginContext, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig } from "./plugin.cjs";
|
|
3
|
-
export { ViteOptions, VitePluginContext, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩViteOptions, __ΩVitePluginContext, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig };
|
|
2
|
+
import { VitePluginContext, VitePluginInitialConfig, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩVitePluginContext, __ΩVitePluginInitialConfig, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig } from "./plugin.cjs";
|
|
3
|
+
export { ViteOptions, VitePluginContext, VitePluginInitialConfig, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩViteOptions, __ΩVitePluginContext, __ΩVitePluginInitialConfig, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ViteOptions, __ΩViteOptions } from "./build.mjs";
|
|
2
|
-
import { VitePluginContext, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩVitePluginContext, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig } from "./plugin.mjs";
|
|
3
|
-
export { ViteOptions, VitePluginContext, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩViteOptions, __ΩVitePluginContext, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig };
|
|
2
|
+
import { VitePluginContext, VitePluginInitialConfig, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩVitePluginContext, __ΩVitePluginInitialConfig, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig } from "./plugin.mjs";
|
|
3
|
+
export { ViteOptions, VitePluginContext, VitePluginInitialConfig, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩViteOptions, __ΩVitePluginContext, __ΩVitePluginInitialConfig, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig };
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { ViteOptions } from "./build.cjs";
|
|
2
|
-
import {
|
|
2
|
+
import { InitialPluginConfig, PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
|
|
3
3
|
|
|
4
4
|
//#region src/types/plugin.d.ts
|
|
5
5
|
type VitePluginOptions = Partial<ViteOptions>;
|
|
6
6
|
interface VitePluginUserConfig extends UserConfig {
|
|
7
7
|
vite?: VitePluginOptions;
|
|
8
8
|
}
|
|
9
|
+
type VitePluginInitialConfig = InitialPluginConfig<VitePluginUserConfig>;
|
|
9
10
|
interface VitePluginResolvedConfig extends ResolvedConfig {
|
|
10
11
|
vite: ViteOptions;
|
|
11
12
|
}
|
|
12
13
|
type VitePluginContext<TResolvedConfig extends VitePluginResolvedConfig = VitePluginResolvedConfig> = PluginContext<TResolvedConfig> & {
|
|
13
14
|
dev: boolean;
|
|
14
|
-
configEnv: ConfigEnv;
|
|
15
15
|
};
|
|
16
16
|
declare type __ΩVitePluginOptions = any[];
|
|
17
17
|
declare type __ΩVitePluginUserConfig = any[];
|
|
18
|
+
declare type __ΩVitePluginInitialConfig = any[];
|
|
18
19
|
declare type __ΩVitePluginResolvedConfig = any[];
|
|
19
20
|
declare type __ΩVitePluginContext = any[];
|
|
20
21
|
//#endregion
|
|
21
|
-
export { VitePluginContext, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩVitePluginContext, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig };
|
|
22
|
+
export { VitePluginContext, VitePluginInitialConfig, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩVitePluginContext, __ΩVitePluginInitialConfig, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig };
|
|
22
23
|
//# sourceMappingURL=plugin.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;KA0BY,iBAAA,GAAoB,OAAA,CAAQ,WAAA;AAAA,UAEvB,oBAAA,SAA6B,UAAA;EAC5C,IAAA,GAAO,iBAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;KA0BY,iBAAA,GAAoB,OAAA,CAAQ,WAAA;AAAA,UAEvB,oBAAA,SAA6B,UAAA;EAC5C,IAAA,GAAO,iBAAA;AAAA;AAAA,KAGG,uBAAA,GAA0B,mBAAA,CAAoB,oBAAA;AAAA,UAEzC,wBAAA,SAAiC,cAAA;EAChD,IAAA,EAAM,WAAA;AAAA;AAAA,KAGI,iBAAA,yBACc,wBAAA,GAA2B,wBAAA,IACjD,aAAA,CAAc,eAAA;EAChB,GAAA;AAAA;AAAA"}
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { ViteOptions } from "./build.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { InitialPluginConfig, PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
|
|
3
3
|
|
|
4
4
|
//#region src/types/plugin.d.ts
|
|
5
5
|
type VitePluginOptions = Partial<ViteOptions>;
|
|
6
6
|
interface VitePluginUserConfig extends UserConfig {
|
|
7
7
|
vite?: VitePluginOptions;
|
|
8
8
|
}
|
|
9
|
+
type VitePluginInitialConfig = InitialPluginConfig<VitePluginUserConfig>;
|
|
9
10
|
interface VitePluginResolvedConfig extends ResolvedConfig {
|
|
10
11
|
vite: ViteOptions;
|
|
11
12
|
}
|
|
12
13
|
type VitePluginContext<TResolvedConfig extends VitePluginResolvedConfig = VitePluginResolvedConfig> = PluginContext<TResolvedConfig> & {
|
|
13
14
|
dev: boolean;
|
|
14
|
-
configEnv: ConfigEnv;
|
|
15
15
|
};
|
|
16
16
|
declare type __ΩVitePluginOptions = any[];
|
|
17
17
|
declare type __ΩVitePluginUserConfig = any[];
|
|
18
|
+
declare type __ΩVitePluginInitialConfig = any[];
|
|
18
19
|
declare type __ΩVitePluginResolvedConfig = any[];
|
|
19
20
|
declare type __ΩVitePluginContext = any[];
|
|
20
21
|
//#endregion
|
|
21
|
-
export { VitePluginContext, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩVitePluginContext, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig };
|
|
22
|
+
export { VitePluginContext, VitePluginInitialConfig, VitePluginOptions, VitePluginResolvedConfig, VitePluginUserConfig, __ΩVitePluginContext, __ΩVitePluginInitialConfig, __ΩVitePluginOptions, __ΩVitePluginResolvedConfig, __ΩVitePluginUserConfig };
|
|
22
23
|
//# sourceMappingURL=plugin.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;KA0BY,iBAAA,GAAoB,OAAA,CAAQ,WAAA;AAAA,UAEvB,oBAAA,SAA6B,UAAA;EAC5C,IAAA,GAAO,iBAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;KA0BY,iBAAA,GAAoB,OAAA,CAAQ,WAAA;AAAA,UAEvB,oBAAA,SAA6B,UAAA;EAC5C,IAAA,GAAO,iBAAA;AAAA;AAAA,KAGG,uBAAA,GAA0B,mBAAA,CAAoB,oBAAA;AAAA,UAEzC,wBAAA,SAAiC,cAAA;EAChD,IAAA,EAAM,WAAA;AAAA;AAAA,KAGI,iBAAA,yBACc,wBAAA,GAA2B,wBAAA,IACjD,aAAA,CAAc,eAAA;EAChB,GAAA;AAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-vite",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.443",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"keywords": ["vite", "powerlines", "storm-software", "powerlines-plugin"],
|
|
@@ -79,14 +79,15 @@
|
|
|
79
79
|
"peerDependencies": { "vite": ">=8.0.0" },
|
|
80
80
|
"peerDependenciesMeta": { "vite": { "optional": false } },
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@powerlines/core": "^0.
|
|
83
|
-
"@powerlines/plugin-
|
|
84
|
-
"@powerlines/plugin-
|
|
85
|
-
"@powerlines/plugin-
|
|
82
|
+
"@powerlines/core": "^0.45.0",
|
|
83
|
+
"@powerlines/plugin-esbuild": "^0.13.446",
|
|
84
|
+
"@powerlines/plugin-rolldown": "^0.7.446",
|
|
85
|
+
"@powerlines/plugin-rollup": "^0.7.444",
|
|
86
|
+
"@stryke/helpers": "^0.10.11",
|
|
86
87
|
"defu": "^6.1.7",
|
|
87
88
|
"unplugin": "^3.0.0"
|
|
88
89
|
},
|
|
89
90
|
"devDependencies": { "@types/node": "^25.6.0", "vite": "^8.0.10" },
|
|
90
91
|
"publishConfig": { "access": "public" },
|
|
91
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "8a559d0939f118a77d189638644589ce33e56a7e"
|
|
92
93
|
}
|