@powerlines/plugin-vite 0.14.441 → 0.14.442

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.
@@ -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 ?? context.config.mode !== "development",
54
+ minify: context.config.output.minify,
55
55
  metafile: context.config.mode === "development",
56
- sourcemap: context.config.output.sourceMap ?? context.config.mode === "development",
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 ?? void 0,
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 ?? context.config.mode !== "development",
51
+ minify: context.config.output.minify,
52
52
  metafile: context.config.mode === "development",
53
- sourcemap: context.config.output.sourceMap ?? context.config.mode === "development",
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 ?? void 0,
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:\n context.config.output.minify ?? context.config.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap:\n context.config.output.sourceMap ??\n context.config.mode === \"development\",\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: context.config.logLevel ?? undefined,\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,QACE,QAAQ,OAAO,OAAO,UAAU,QAAQ,OAAO,SAAS;GAC1D,UAAU,QAAQ,OAAO,SAAS;GAClC,WACE,QAAQ,OAAO,OAAO,aACtB,QAAQ,OAAO,SAAS;GAC1B,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,UAAU,QAAQ,OAAO,YAAY;EACrC,QAAQ,QAAQ,OAAO;EACxB,EACD,oBACD"}
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"}
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.trace(`Building the Powerlines plugin.`);
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
- await (0, vite.build)((0, defu.default)({
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
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;YA8BY,MAAA;IACR,IAAA,GAAO,iBAAA;EAAA;AAAA;AAJa;;;AAAA,cAWX,MAAA,oBAA2B,iBAAA,GAAoB,iBAAA,EAC1D,OAAA,GAAS,iBAAA,KACR,MAAA,CAAO,QAAA"}
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"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;YA8BY,MAAA;IACR,IAAA,GAAO,iBAAA;EAAA;AAAA;AAJa;;;AAAA,cAWX,MAAA,oBAA2B,iBAAA,GAAoB,iBAAA,EAC1D,OAAA,GAAS,iBAAA,KACR,MAAA,CAAO,QAAA"}
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.trace(`Building the Powerlines plugin.`);
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
- await build(defu({
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
  };
@@ -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.trace(`Building the Powerlines plugin.`);\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 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);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;AAsCA,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,kCAAkC;GAE7C,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;AAmBD,SAAM,MAjBS,KACb;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,CAGe,CAAC;;EAEtB"}
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-vite",
3
- "version": "0.14.441",
3
+ "version": "0.14.442",
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.44.11",
83
- "@powerlines/plugin-rolldown": "^0.7.444",
84
- "@powerlines/plugin-rollup": "^0.7.442",
85
- "@powerlines/plugin-esbuild": "^0.13.444",
82
+ "@powerlines/core": "^0.44.12",
83
+ "@powerlines/plugin-esbuild": "^0.13.445",
84
+ "@powerlines/plugin-rolldown": "^0.7.445",
85
+ "@powerlines/plugin-rollup": "^0.7.443",
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": "3068780d15828be90a57de9532ed00bd33187340"
92
+ "gitHead": "93fe3bf5054baa0bb1841c64fe082da56631a010"
92
93
  }