vite-plus 0.1.19-alpha.0 → 0.1.19-alpha.2

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.
@@ -1,9 +1,9 @@
1
- import { r as __toESM, t as __commonJSMin } from "./chunk-DsIazq42.js";
2
- import { c as VITE_PLUS_VERSION, i as BASEURL_TSCONFIG_WARNING, l as isForceOverrideMode, o as VITE_PLUS_NAME, s as VITE_PLUS_OVERRIDE_PACKAGES } from "./main-GHdRghJ-.js";
3
- import { a as require_cross_spawn, i as runCommandSilently, n as hasBaseUrlInTsconfig, r as removeDeprecatedTsconfigFalseOption, t as findTsconfigFiles } from "./tsconfig-Do47YXpz.js";
1
+ import { r as __toESM, t as __commonJSMin } from "./chunk-q7NCDQ7-.js";
2
+ import { c as VITE_PLUS_VERSION, i as BASEURL_TSCONFIG_WARNING, l as isForceOverrideMode, o as VITE_PLUS_NAME, s as VITE_PLUS_OVERRIDE_PACKAGES } from "./main-A6UrSTYb.js";
3
+ import { a as require_cross_spawn, i as runCommandSilently, n as hasBaseUrlInTsconfig, r as removeDeprecatedTsconfigFalseOption, t as findTsconfigFiles } from "./tsconfig-DQTf06oN.js";
4
4
  import { t as accent } from "./terminal-P9aw9Fib.js";
5
- import { t as require_dist } from "./dist-DPsDLqya.js";
6
- import { c as readJsonFile, n as detectPackageMetadata, o as editJsonFile, s as isJsonFile } from "./package-DhXOF9Xm.js";
5
+ import { t as require_dist } from "./dist-Dkzst9fl.js";
6
+ import { c as readJsonFile, n as detectPackageMetadata, o as editJsonFile, s as isJsonFile } from "./package-D_LD1iiI.js";
7
7
  import { n as addMigrationWarning, t as addManualStep } from "./report-DHdnkZbA.js";
8
8
  import path from "node:path";
9
9
  import { downloadPackageManager, mergeJsonConfig, mergeTsdownConfig, rewriteEslint, rewriteImportsInDirectory, rewritePrettier, rewriteScripts } from "../binding/index.js";
@@ -677,17 +677,19 @@ let it = class extends p {
677
677
  return this.options.filter((t) => t.disabled !== !0);
678
678
  }
679
679
  toggleAll() {
680
- const t = this._enabledOptions;
681
- this.value = this.value !== void 0 && this.value.length === t.length ? [] : t.map((s) => s.value);
680
+ const t = this._enabledOptions, e = this.value !== void 0 && this.value.length === t.length;
681
+ this.value = e ? [] : t.map((s) => s.value);
682
682
  }
683
683
  toggleInvert() {
684
684
  const t = this.value;
685
685
  if (!t) return;
686
- this.value = this._enabledOptions.filter((s) => !t.includes(s.value)).map((s) => s.value);
686
+ const e = this._enabledOptions.filter((s) => !t.includes(s.value));
687
+ this.value = e.map((s) => s.value);
687
688
  }
688
689
  toggleValue() {
689
690
  this.value === void 0 && (this.value = []);
690
- this.value = this.value.includes(this._value) ? this.value.filter((e) => e !== this._value) : [...this.value, this._value];
691
+ const t = this.value.includes(this._value);
692
+ this.value = t ? this.value.filter((e) => e !== this._value) : [...this.value, this._value];
691
693
  }
692
694
  constructor(t) {
693
695
  super(t, !1), this.options = t.options, this.value = [...t.initialValues ?? []];
package/dist/bin.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as DEFAULT_ENVS, i as BASEURL_TSCONFIG_WARNING, o as VITE_PLUS_NAME, u as resolve$1 } from "./main-GHdRghJ-.js";
2
- import { i as runCommandSilently, n as hasBaseUrlInTsconfig } from "./tsconfig-Do47YXpz.js";
1
+ import { a as DEFAULT_ENVS, i as BASEURL_TSCONFIG_WARNING, o as VITE_PLUS_NAME, u as resolve$1 } from "./main-A6UrSTYb.js";
2
+ import { i as runCommandSilently, n as hasBaseUrlInTsconfig } from "./tsconfig-DQTf06oN.js";
3
3
  import { n as errorMsg, o as warnMsg, r as log, t as accent } from "./terminal-P9aw9Fib.js";
4
4
  import { t as resolveUniversalViteConfig } from "./resolve-vite-config-B_w1u1j4.js";
5
5
  import path, { dirname, join } from "node:path";
@@ -410,6 +410,7 @@ if (args[0] === "help" && args[1]) {
410
410
  process.argv = process.argv.slice(0, 2).concat(args);
411
411
  }
412
412
  const command = args[0];
413
+ process.env.VP_COMMAND = command ?? "";
413
414
  if (command === "create") await import("./create/bin.js");
414
415
  else if (command === "migrate") await import("./migration/bin.js");
415
416
  else if (command === "config") await import("./config/bin.js");
@@ -6,7 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
10
  var __copyProps = (to, from, except, desc) => {
11
11
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
12
  key = keys[i];
@@ -1,5 +1,5 @@
1
1
  import { r as log } from "../terminal-P9aw9Fib.js";
2
- import { D as promptGitHooks, T as defaultInteractive, d as ensurePreCommitHook, f as hasStagedConfigInViteConfig, i as updateExistingAgentInstructions } from "../agent-SsJdhby3.js";
2
+ import { D as promptGitHooks, T as defaultInteractive, d as ensurePreCommitHook, f as hasStagedConfigInViteConfig, i as updateExistingAgentInstructions } from "../agent-Ctkv5amd.js";
3
3
  import { t as lib_default } from "../lib-BamM40b7.js";
4
4
  import { t as renderCliDoc } from "../help-BtkjXtRM.js";
5
5
  import { join } from "node:path";
@@ -1,10 +1,10 @@
1
- import { r as __toESM, t as __commonJSMin } from "../chunk-DsIazq42.js";
2
- import { a as require_cross_spawn } from "../tsconfig-Do47YXpz.js";
1
+ import { r as __toESM, t as __commonJSMin } from "../chunk-q7NCDQ7-.js";
2
+ import { a as require_cross_spawn } from "../tsconfig-DQTf06oN.js";
3
3
  import { a as success, i as muted, r as log, t as accent } from "../terminal-P9aw9Fib.js";
4
- import { A as selectPackageManager, B as log$1, D as promptGitHooks, E as downloadPackageManager$1, F as PackageManager, G as text, K as require_picocolors, L as cancel, M as displayRelative, N as templatesDir, O as runViteFmt, P as DependencyType, R as confirm, T as defaultInteractive, U as select, V as multiselect, W as spinner, a as writeAgentInstructions, b as rewriteMonorepoProject, k as runViteInstall, n as detectExistingAgentTargetPaths, p as installGitHooks, q, r as selectAgentTargetPaths, x as rewriteStandaloneProject, y as rewriteMonorepo, z as intro } from "../agent-SsJdhby3.js";
4
+ import { A as selectPackageManager, B as log$1, D as promptGitHooks, E as downloadPackageManager$1, F as PackageManager, G as text, K as require_picocolors, L as cancel, M as displayRelative, N as templatesDir, O as runViteFmt, P as DependencyType, R as confirm, T as defaultInteractive, U as select, V as multiselect, W as spinner, a as writeAgentInstructions, b as rewriteMonorepoProject, k as runViteInstall, n as detectExistingAgentTargetPaths, p as installGitHooks, q, r as selectAgentTargetPaths, x as rewriteStandaloneProject, y as rewriteMonorepo, z as intro } from "../agent-Ctkv5amd.js";
5
5
  import { t as lib_default } from "../lib-BamM40b7.js";
6
- import { c as readJsonFile, o as editJsonFile, t as checkNpmPackageExists } from "../package-DhXOF9Xm.js";
7
- import { a as detectExistingEditor, n as updatePackageJsonWithDeps, o as selectEditor, r as updateWorkspaceConfig, s as writeEditorConfigs, t as detectWorkspace$1 } from "../workspace-DC4M0yWx.js";
6
+ import { c as readJsonFile, o as editJsonFile, t as checkNpmPackageExists } from "../package-D_LD1iiI.js";
7
+ import { a as detectExistingEditor, n as updatePackageJsonWithDeps, o as selectEditor, r as updateWorkspaceConfig, s as writeEditorConfigs, t as detectWorkspace$1 } from "../workspace-BkYdJSyv.js";
8
8
  import { t as renderCliDoc } from "../help-BtkjXtRM.js";
9
9
  import path from "node:path";
10
10
  import { runCommand, vitePlusHeader } from "../../binding/index.js";
@@ -0,0 +1,21 @@
1
+ import { defineConfig } from "@voidzero-dev/vite-plus-test/config";
2
+ //#region src/define-config.ts
3
+ function defineConfig$1(config) {
4
+ return defineConfig(config);
5
+ }
6
+ const VITE_COMMANDS = new Set([
7
+ "dev",
8
+ "build",
9
+ "test",
10
+ "preview"
11
+ ]);
12
+ function lazyPlugins(cb) {
13
+ const cmd = process.env.VP_COMMAND;
14
+ if (!cmd || VITE_COMMANDS.has(cmd)) {
15
+ const result = cb();
16
+ if (result instanceof Promise) return [result];
17
+ return result;
18
+ }
19
+ }
20
+ //#endregion
21
+ export { lazyPlugins as n, defineConfig$1 as t };
@@ -27,38 +27,30 @@ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["modu
27
27
  //#endregion
28
28
  let _voidzero_dev_vite_plus_test_config = require("@voidzero-dev/vite-plus-test/config");
29
29
  //#region src/define-config.ts
30
- var define_config_exports = /* @__PURE__ */ __exportAll({ defineConfig: () => defineConfig });
30
+ var define_config_exports = /* @__PURE__ */ __exportAll({
31
+ defineConfig: () => defineConfig,
32
+ lazyPlugins: () => lazyPlugins
33
+ });
31
34
  function defineConfig(config) {
32
- if (typeof config === "object") {
33
- if (config instanceof Promise) return config.then((config) => {
34
- if (config.lazy) return config.lazy().then(({ plugins }) => (0, _voidzero_dev_vite_plus_test_config.defineConfig)({
35
- ...config,
36
- plugins: [...config.plugins || [], ...plugins || []]
37
- }));
38
- return (0, _voidzero_dev_vite_plus_test_config.defineConfig)(config);
39
- });
40
- else if (config.lazy) return config.lazy().then(({ plugins }) => (0, _voidzero_dev_vite_plus_test_config.defineConfig)({
41
- ...config,
42
- plugins: [...config.plugins || [], ...plugins || []]
43
- }));
44
- } else if (typeof config === "function") return (0, _voidzero_dev_vite_plus_test_config.defineConfig)((env) => {
45
- const c = config(env);
46
- if (c instanceof Promise) return c.then((v) => {
47
- if (v.lazy) return v.lazy().then(({ plugins }) => (0, _voidzero_dev_vite_plus_test_config.defineConfig)({
48
- ...v,
49
- plugins: [...v.plugins || [], ...plugins || []]
50
- }));
51
- return v;
52
- });
53
- if (c.lazy) return c.lazy().then(({ plugins }) => ({
54
- ...c,
55
- plugins: [...c.plugins || [], ...plugins || []]
56
- }));
57
- return c;
58
- });
59
35
  return (0, _voidzero_dev_vite_plus_test_config.defineConfig)(config);
60
36
  }
61
- var init_define_config = __esmMin((() => {}));
37
+ function lazyPlugins(cb) {
38
+ const cmd = process.env.VP_COMMAND;
39
+ if (!cmd || VITE_COMMANDS.has(cmd)) {
40
+ const result = cb();
41
+ if (result instanceof Promise) return [result];
42
+ return result;
43
+ }
44
+ }
45
+ var VITE_COMMANDS;
46
+ var init_define_config = __esmMin((() => {
47
+ VITE_COMMANDS = new Set([
48
+ "dev",
49
+ "build",
50
+ "test",
51
+ "preview"
52
+ ]);
53
+ }));
62
54
  //#endregion
63
55
  Object.defineProperty(exports, "__toCommonJS", {
64
56
  enumerable: true,
@@ -84,3 +76,9 @@ Object.defineProperty(exports, "init_define_config", {
84
76
  return init_define_config;
85
77
  }
86
78
  });
79
+ Object.defineProperty(exports, "lazyPlugins", {
80
+ enumerable: true,
81
+ get: function() {
82
+ return lazyPlugins;
83
+ }
84
+ });
@@ -1,6 +1,6 @@
1
1
  import { t as PackUserConfig } from "./pack-BcBvbQgt.js";
2
- import { ConfigEnv, Plugin } from "@voidzero-dev/vite-plus-test/config";
3
- import { UserConfig } from "@voidzero-dev/vite-plus-core";
2
+ import { ConfigEnv } from "@voidzero-dev/vite-plus-test/config";
3
+ import { PluginOption, UserConfig } from "@voidzero-dev/vite-plus-core";
4
4
  import { OxfmtConfig } from "oxfmt";
5
5
  import { OxlintConfig } from "oxlint";
6
6
 
@@ -135,9 +135,6 @@ declare module '@voidzero-dev/vite-plus-core' {
135
135
  pack?: PackUserConfig | PackUserConfig[];
136
136
  run?: RunConfig;
137
137
  staged?: StagedConfig;
138
- lazy?: () => Promise<{
139
- plugins?: Plugin[];
140
- }>;
141
138
  }
142
139
  }
143
140
  type ViteUserConfigFnObject = (env: ConfigEnv) => UserConfig;
@@ -149,5 +146,7 @@ declare function defineConfig$1(config: Promise<UserConfig>): Promise<UserConfig
149
146
  declare function defineConfig$1(config: ViteUserConfigFnObject): ViteUserConfigFnObject;
150
147
  declare function defineConfig$1(config: ViteUserConfigFnPromise): ViteUserConfigFnPromise;
151
148
  declare function defineConfig$1(config: ViteUserConfigExport): ViteUserConfigExport;
149
+ declare function lazyPlugins(cb: () => PluginOption[]): PluginOption[] | undefined;
150
+ declare function lazyPlugins(cb: () => Promise<PluginOption[]>): PluginOption[] | undefined;
152
151
  //#endregion
153
- export { defineConfig$1 as t };
152
+ export { lazyPlugins as n, defineConfig$1 as t };
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_define_config = require("./define-config-fy-hQFQv.cjs");
2
+ const require_define_config = require("./define-config-GqLoRwH9.cjs");
3
3
  require_define_config.init_define_config();
4
4
  exports.defineConfig = require_define_config.defineConfig;
5
+ exports.lazyPlugins = require_define_config.lazyPlugins;
@@ -1,2 +1,2 @@
1
- import { t as defineConfig } from "./define-config-FwLybwj-.js";
2
- export { defineConfig };
1
+ import { n as lazyPlugins, t as defineConfig } from "./define-config-hLuWEqIf.js";
2
+ export { defineConfig, lazyPlugins };
@@ -1,2 +1,2 @@
1
- import { t as defineConfig } from "./define-config-D5eQTpwK.js";
2
- export { defineConfig };
1
+ import { n as lazyPlugins, t as defineConfig } from "./define-config-B62DkkqH.js";
2
+ export { defineConfig, lazyPlugins };
@@ -0,0 +1,3 @@
1
+ import { t as require_dist } from "./dist-Dkzst9fl.js";
2
+ export default require_dist();
3
+ export {};
@@ -1,4 +1,4 @@
1
- import { n as __require, t as __commonJSMin } from "./chunk-DsIazq42.js";
1
+ import { n as __require, t as __commonJSMin } from "./chunk-q7NCDQ7-.js";
2
2
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/identity.js
3
3
  var require_identity = /* @__PURE__ */ __commonJSMin(((exports) => {
4
4
  const ALIAS = Symbol.for("yaml.alias");
package/dist/index.cjs CHANGED
@@ -1,11 +1,12 @@
1
- const require_define_config = require("./define-config-fy-hQFQv.cjs");
1
+ const require_define_config = require("./define-config-GqLoRwH9.cjs");
2
2
  //#region src/index.cts
3
3
  const vite = require("@voidzero-dev/vite-plus-core");
4
4
  const vitest = require("@voidzero-dev/vite-plus-test/config");
5
- const { defineConfig } = (require_define_config.init_define_config(), require_define_config.__toCommonJS(require_define_config.define_config_exports));
5
+ const { defineConfig, lazyPlugins } = (require_define_config.init_define_config(), require_define_config.__toCommonJS(require_define_config.define_config_exports));
6
6
  module.exports = {
7
7
  ...vite,
8
8
  ...vitest,
9
- defineConfig
9
+ defineConfig,
10
+ lazyPlugins
10
11
  };
11
12
  //#endregion
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as defineConfig } from "./define-config-FwLybwj-.js";
1
+ import { n as lazyPlugins, t as defineConfig } from "./define-config-hLuWEqIf.js";
2
2
  export * from "@voidzero-dev/vite-plus-test/config";
3
3
  export * from "@voidzero-dev/vite-plus-core";
4
- export { defineConfig };
4
+ export { defineConfig, lazyPlugins };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as defineConfig } from "./define-config-D5eQTpwK.js";
1
+ import { n as lazyPlugins, t as defineConfig } from "./define-config-B62DkkqH.js";
2
2
  export * from "@voidzero-dev/vite-plus-test/config";
3
3
  export * from "@voidzero-dev/vite-plus-core";
4
- export { defineConfig };
4
+ export { defineConfig, lazyPlugins };
@@ -30,7 +30,7 @@ const DEFAULT_ENVS = {
30
30
  * Creates a JSON scanner on the given text.
31
31
  * If ignoreTrivia is set, whitespaces or comments are ignored.
32
32
  */
33
- function createScanner$1(text, ignoreTrivia = false) {
33
+ function createScanner(text, ignoreTrivia = false) {
34
34
  const len = text.length;
35
35
  let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
36
36
  function scanHexDigits(count, exact) {
@@ -469,7 +469,7 @@ function format(documentText, range, options) {
469
469
  if (options.insertSpaces) indentValue = cachedSpaces[options.tabSize || 4] ?? repeat(cachedSpaces[1], options.tabSize || 4);
470
470
  else indentValue = " ";
471
471
  const indentType = indentValue === " " ? " " : " ";
472
- let scanner = createScanner$1(formatText, false);
472
+ let scanner = createScanner(formatText, false);
473
473
  let hasError = false;
474
474
  function newLinesAndIndent() {
475
475
  if (numberLineBreaks > 1) return repeat(eol, numberLineBreaks) + repeat(indentValue, initialIndentLevel + indentLevel);
@@ -624,7 +624,7 @@ function parse$1(text, errors = [], options = ParseOptions.DEFAULT) {
624
624
  if (Array.isArray(currentParent)) currentParent.push(value);
625
625
  else if (currentProperty !== null) currentParent[currentProperty] = value;
626
626
  }
627
- visit$1(text, {
627
+ visit(text, {
628
628
  onObjectBegin: () => {
629
629
  const object = {};
630
630
  onValue(object);
@@ -662,7 +662,7 @@ function parse$1(text, errors = [], options = ParseOptions.DEFAULT) {
662
662
  /**
663
663
  * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
664
664
  */
665
- function parseTree$1(text, errors = [], options = ParseOptions.DEFAULT) {
665
+ function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
666
666
  let currentParent = {
667
667
  type: "array",
668
668
  offset: -1,
@@ -680,7 +680,7 @@ function parseTree$1(text, errors = [], options = ParseOptions.DEFAULT) {
680
680
  currentParent.children.push(valueNode);
681
681
  return valueNode;
682
682
  }
683
- visit$1(text, {
683
+ visit(text, {
684
684
  onObjectBegin: (offset) => {
685
685
  currentParent = onValue({
686
686
  type: "object",
@@ -757,7 +757,7 @@ function parseTree$1(text, errors = [], options = ParseOptions.DEFAULT) {
757
757
  /**
758
758
  * Finds the node at the given path in a JSON DOM.
759
759
  */
760
- function findNodeAtLocation$1(root, path) {
760
+ function findNodeAtLocation(root, path) {
761
761
  if (!root) return;
762
762
  let node = root;
763
763
  for (let segment of path) if (typeof segment === "string") {
@@ -777,61 +777,10 @@ function findNodeAtLocation$1(root, path) {
777
777
  return node;
778
778
  }
779
779
  /**
780
- * Gets the JSON path of the given JSON DOM node
781
- */
782
- function getNodePath$1(node) {
783
- if (!node.parent || !node.parent.children) return [];
784
- const path = getNodePath$1(node.parent);
785
- if (node.parent.type === "property") {
786
- const key = node.parent.children[0].value;
787
- path.push(key);
788
- } else if (node.parent.type === "array") {
789
- const index = node.parent.children.indexOf(node);
790
- if (index !== -1) path.push(index);
791
- }
792
- return path;
793
- }
794
- /**
795
- * Evaluates the JavaScript object of the given JSON DOM node
796
- */
797
- function getNodeValue$1(node) {
798
- switch (node.type) {
799
- case "array": return node.children.map(getNodeValue$1);
800
- case "object":
801
- const obj = Object.create(null);
802
- for (let prop of node.children) {
803
- const valueNode = prop.children[1];
804
- if (valueNode) obj[prop.children[0].value] = getNodeValue$1(valueNode);
805
- }
806
- return obj;
807
- case "null":
808
- case "string":
809
- case "number":
810
- case "boolean": return node.value;
811
- default: return;
812
- }
813
- }
814
- function contains(node, offset, includeRightBound = false) {
815
- return offset >= node.offset && offset < node.offset + node.length || includeRightBound && offset === node.offset + node.length;
816
- }
817
- /**
818
- * Finds the most inner node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.
819
- */
820
- function findNodeAtOffset$1(node, offset, includeRightBound = false) {
821
- if (contains(node, offset, includeRightBound)) {
822
- const children = node.children;
823
- if (Array.isArray(children)) for (let i = 0; i < children.length && children[i].offset <= offset; i++) {
824
- const item = findNodeAtOffset$1(children[i], offset, includeRightBound);
825
- if (item) return item;
826
- }
827
- return node;
828
- }
829
- }
830
- /**
831
780
  * Parses the given text and invokes the visitor functions for each object, array and literal reached.
832
781
  */
833
- function visit$1(text, visitor, options = ParseOptions.DEFAULT) {
834
- const _scanner = createScanner$1(text, false);
782
+ function visit(text, visitor, options = ParseOptions.DEFAULT) {
783
+ const _scanner = createScanner(text, false);
835
784
  const _jsonPath = [];
836
785
  let suppressedCallbacks = 0;
837
786
  function toNoArgVisit(visitFunction) {
@@ -1039,12 +988,12 @@ function getNodeType(value) {
1039
988
  //#region ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js
1040
989
  function setProperty(text, originalPath, value, options) {
1041
990
  const path = originalPath.slice();
1042
- const root = parseTree$1(text, []);
991
+ const root = parseTree(text, []);
1043
992
  let parent = void 0;
1044
993
  let lastSegment = void 0;
1045
994
  while (path.length > 0) {
1046
995
  lastSegment = path.pop();
1047
- parent = findNodeAtLocation$1(root, path);
996
+ parent = findNodeAtLocation(root, path);
1048
997
  if (parent === void 0 && value !== void 0) if (typeof lastSegment === "string") value = { [lastSegment]: value };
1049
998
  else value = [value];
1050
999
  else break;
@@ -1057,7 +1006,7 @@ function setProperty(text, originalPath, value, options) {
1057
1006
  content: JSON.stringify(value)
1058
1007
  }, options);
1059
1008
  } else if (parent.type === "object" && typeof lastSegment === "string" && Array.isArray(parent.children)) {
1060
- const existing = findNodeAtLocation$1(parent, [lastSegment]);
1009
+ const existing = findNodeAtLocation(parent, [lastSegment]);
1061
1010
  if (existing !== void 0) if (value === void 0) {
1062
1011
  if (!existing.parent) throw new Error("Malformed AST");
1063
1012
  const propertyIndex = parent.children.indexOf(existing.parent);
@@ -1207,6 +1156,8 @@ function withFormatting(text, edit, options) {
1207
1156
  function applyEdit(text, edit) {
1208
1157
  return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);
1209
1158
  }
1159
+ //#endregion
1160
+ //#region ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
1210
1161
  var ScanError;
1211
1162
  (function(ScanError) {
1212
1163
  ScanError[ScanError["None"] = 0] = "None";
@@ -1,11 +1,11 @@
1
- import { r as __toESM } from "../chunk-DsIazq42.js";
2
- import { l as isForceOverrideMode } from "../main-GHdRghJ-.js";
1
+ import { r as __toESM } from "../chunk-q7NCDQ7-.js";
2
+ import { l as isForceOverrideMode } from "../main-A6UrSTYb.js";
3
3
  import { i as muted, r as log, t as accent } from "../terminal-P9aw9Fib.js";
4
- import { A as selectPackageManager, B as log$1, D as promptGitHooks, E as downloadPackageManager$1, F as PackageManager, H as outro, I as require_semver, M as displayRelative, R as confirm, T as defaultInteractive, U as select, W as spinner, _ as migratePrettierToOxfmt, a as writeAgentInstructions, c as detectEslintProject, g as migrateNodeVersionManagerFile, h as migrateEslintToOxlint, j as upgradeYarn, k as runViteInstall, l as detectNodeVersionManagerFile, m as mergeViteConfigFiles, n as detectExistingAgentTargetPaths, o as checkViteVersion, p as installGitHooks, q, r as selectAgentTargetPaths, s as checkVitestVersion, t as detectAgentConflicts, u as detectPrettierProject, v as preflightGitHooksSetup, w as cancelAndExit, x as rewriteStandaloneProject, y as rewriteMonorepo } from "../agent-SsJdhby3.js";
4
+ import { A as selectPackageManager, B as log$1, D as promptGitHooks, E as downloadPackageManager$1, F as PackageManager, H as outro, I as require_semver, M as displayRelative, R as confirm, T as defaultInteractive, U as select, W as spinner, _ as migratePrettierToOxfmt, a as writeAgentInstructions, c as detectEslintProject, g as migrateNodeVersionManagerFile, h as migrateEslintToOxlint, j as upgradeYarn, k as runViteInstall, l as detectNodeVersionManagerFile, m as mergeViteConfigFiles, n as detectExistingAgentTargetPaths, o as checkViteVersion, p as installGitHooks, q, r as selectAgentTargetPaths, s as checkVitestVersion, t as detectAgentConflicts, u as detectPrettierProject, v as preflightGitHooksSetup, w as cancelAndExit, x as rewriteStandaloneProject, y as rewriteMonorepo } from "../agent-Ctkv5amd.js";
5
5
  import { t as lib_default } from "../lib-BamM40b7.js";
6
- import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-DhXOF9Xm.js";
6
+ import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-D_LD1iiI.js";
7
7
  import { r as createMigrationReport } from "../report-DHdnkZbA.js";
8
- import { i as detectEditorConflicts, o as selectEditor, s as writeEditorConfigs, t as detectWorkspace$1 } from "../workspace-DC4M0yWx.js";
8
+ import { i as detectEditorConflicts, o as selectEditor, s as writeEditorConfigs, t as detectWorkspace$1 } from "../workspace-BkYdJSyv.js";
9
9
  import { t as renderCliDoc } from "../help-BtkjXtRM.js";
10
10
  import path from "node:path";
11
11
  import { vitePlusHeader } from "../../binding/index.js";
package/dist/pack-bin.js CHANGED
@@ -656,8 +656,8 @@ cli.command("[...files]", "Bundle files", {
656
656
  if (flags.envPrefix === void 0) flags.envPrefix = DEFAULT_ENV_PREFIXES;
657
657
  async function runBuild() {
658
658
  const viteConfig = await resolveViteConfig(process.cwd(), { traverseUp: flags.config !== false });
659
- const configFiles = [];
660
- if (viteConfig.configFile) configFiles.push(viteConfig.configFile);
659
+ const configDeps = /* @__PURE__ */ new Set();
660
+ if (viteConfig.configFile) configDeps.add(viteConfig.configFile);
661
661
  const configs = [];
662
662
  const packConfigs = Array.isArray(viteConfig.pack) ? viteConfig.pack : [viteConfig.pack ?? {}];
663
663
  for (const packConfig of packConfigs) {
@@ -666,10 +666,10 @@ cli.command("[...files]", "Bundle files", {
666
666
  ...flags
667
667
  };
668
668
  if (merged.dts) merged.plugins = [...Array.isArray(merged.plugins) ? merged.plugins : [], externalDtsTypeOnlyPlugin()];
669
- const resolvedConfig = await resolveUserConfig(merged, flags);
669
+ const resolvedConfig = await resolveUserConfig(merged, flags, configDeps);
670
670
  configs.push(...resolvedConfig);
671
671
  }
672
- await buildWithConfigs(configs, configFiles, runBuild);
672
+ await buildWithConfigs(configs, configDeps, runBuild);
673
673
  }
674
674
  await runBuild();
675
675
  });
@@ -1,4 +1,4 @@
1
- import { r as parse } from "./main-GHdRghJ-.js";
1
+ import { r as parse } from "./main-A6UrSTYb.js";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import fs from "node:fs";
@@ -1,4 +1,4 @@
1
- import { r as __toESM, t as __commonJSMin } from "../chunk-DsIazq42.js";
1
+ import { r as __toESM, t as __commonJSMin } from "../chunk-q7NCDQ7-.js";
2
2
  import { n as errorMsg, r as log } from "../terminal-P9aw9Fib.js";
3
3
  import { n as resolveViteConfig } from "../resolve-vite-config-B_w1u1j4.js";
4
4
  import { t as lib_default } from "../lib-BamM40b7.js";
@@ -6182,7 +6182,7 @@ const jsonParse = async (filename) => {
6182
6182
  const yamlParse = async (filename) => {
6183
6183
  const isPackageFile = PACKAGE_YAML_FILES.includes(path.basename(filename));
6184
6184
  try {
6185
- const [YAML, content] = await Promise.all([import("../dist-Dd3X7j8j.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)), readFile(filename)]);
6185
+ const [YAML, content] = await Promise.all([import("../dist-CXwOXAks.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)), readFile(filename)]);
6186
6186
  const yaml = YAML.parse(content);
6187
6187
  return isPackageFile ? yaml[CONFIG_NAME] : yaml;
6188
6188
  } catch (error) {
@@ -1,5 +1,5 @@
1
- import { n as __require, r as __toESM, t as __commonJSMin } from "./chunk-DsIazq42.js";
2
- import { n as modify, r as parse, t as applyEdits } from "./main-GHdRghJ-.js";
1
+ import { n as __require, r as __toESM, t as __commonJSMin } from "./chunk-q7NCDQ7-.js";
2
+ import { n as modify, r as parse, t as applyEdits } from "./main-A6UrSTYb.js";
3
3
  import path from "node:path";
4
4
  import fs from "node:fs";
5
5
  //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
package/dist/version.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./main-GHdRghJ-.js";
1
+ import "./main-A6UrSTYb.js";
2
2
  import { r as log, t as accent } from "./terminal-P9aw9Fib.js";
3
- import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-DhXOF9Xm.js";
3
+ import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-D_LD1iiI.js";
4
4
  import { t as renderCliDoc } from "./help-BtkjXtRM.js";
5
5
  import path from "node:path";
6
6
  import { vitePlusHeader } from "../binding/index.js";
package/dist/versions.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export const versions = {
2
2
  "vite": "8.0.8",
3
- "rolldown": "1.0.0-rc.15",
4
- "tsdown": "0.21.8",
3
+ "rolldown": "1.0.0-rc.16",
4
+ "tsdown": "0.21.9",
5
5
  "vitest": "4.1.4",
6
6
  "oxlint": "1.60.0",
7
7
  "oxfmt": "0.45.0",
8
- "oxlint-tsgolint": "0.21.0"
8
+ "oxlint-tsgolint": "0.21.1"
9
9
  };
@@ -1,6 +1,6 @@
1
- import { B as log, C as readYamlFile, F as PackageManager, S as editYamlFile, U as select, q } from "./agent-SsJdhby3.js";
2
- import { t as require_dist } from "./dist-DPsDLqya.js";
3
- import { c as readJsonFile, l as writeJsonFile, o as editJsonFile, r as getScopeFromPackageName } from "./package-DhXOF9Xm.js";
1
+ import { B as log, C as readYamlFile, F as PackageManager, S as editYamlFile, U as select, q } from "./agent-Ctkv5amd.js";
2
+ import { t as require_dist } from "./dist-Dkzst9fl.js";
3
+ import { c as readJsonFile, l as writeJsonFile, o as editJsonFile, r as getScopeFromPackageName } from "./package-D_LD1iiI.js";
4
4
  import path, { posix, win32 } from "node:path";
5
5
  import { detectWorkspace } from "../binding/index.js";
6
6
  import * as actualFS from "node:fs";
@@ -1270,7 +1270,8 @@ var Minimatch = class {
1270
1270
  this.pattern = pattern;
1271
1271
  this.platform = options.platform || defaultPlatform$2;
1272
1272
  this.isWindows = this.platform === "win32";
1273
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options["allowWindowsEscape"] === false;
1273
+ const awe = "allowWindowsEscape";
1274
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
1274
1275
  if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
1275
1276
  this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
1276
1277
  this.regexp = null;
@@ -3527,7 +3528,8 @@ var PathBase = class {
3527
3528
  const name = this.name;
3528
3529
  const p = this.parent;
3529
3530
  if (!p) return this.#fullpath = this.name;
3530
- return this.#fullpath = p.fullpath() + (!p.parent ? "" : this.sep) + name;
3531
+ const fp = p.fullpath() + (!p.parent ? "" : this.sep) + name;
3532
+ return this.#fullpath = fp;
3531
3533
  }
3532
3534
  /**
3533
3535
  * On platforms other than windows, this is identical to fullpath.
@@ -3545,7 +3547,8 @@ var PathBase = class {
3545
3547
  }
3546
3548
  const p = this.parent;
3547
3549
  const pfpp = p.fullpathPosix();
3548
- return this.#fullpathPosix = pfpp + (!pfpp || !p.parent ? "" : "/") + this.name;
3550
+ const fpp = pfpp + (!pfpp || !p.parent ? "" : "/") + this.name;
3551
+ return this.#fullpathPosix = fpp;
3549
3552
  }
3550
3553
  /**
3551
3554
  * Is the Path of an unknown type?
@@ -5518,10 +5521,13 @@ var Glob = class {
5518
5521
  if (opts.scurry) {
5519
5522
  this.scurry = opts.scurry;
5520
5523
  if (opts.nocase !== void 0 && opts.nocase !== opts.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
5521
- } else this.scurry = new (opts.platform === "win32" ? PathScurryWin32 : opts.platform === "darwin" ? PathScurryDarwin : opts.platform ? PathScurryPosix : PathScurry)(this.cwd, {
5522
- nocase: opts.nocase,
5523
- fs: opts.fs
5524
- });
5524
+ } else {
5525
+ const Scurry = opts.platform === "win32" ? PathScurryWin32 : opts.platform === "darwin" ? PathScurryDarwin : opts.platform ? PathScurryPosix : PathScurry;
5526
+ this.scurry = new Scurry(this.cwd, {
5527
+ nocase: opts.nocase,
5528
+ fs: opts.fs
5529
+ });
5530
+ }
5525
5531
  this.nocase = this.scurry.nocase;
5526
5532
  const nocaseMagicOnly = this.platform === "darwin" || this.platform === "win32";
5527
5533
  const mmo = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plus",
3
- "version": "0.1.19-alpha.0",
3
+ "version": "0.1.19-alpha.2",
4
4
  "description": "The Unified Toolchain for the Web",
5
5
  "homepage": "https://viteplus.dev/guide",
6
6
  "bugs": {
@@ -318,12 +318,12 @@
318
318
  }
319
319
  },
320
320
  "dependencies": {
321
- "@oxc-project/types": "=0.124.0",
321
+ "@oxc-project/types": "=0.126.0",
322
322
  "oxfmt": "=0.45.0",
323
323
  "oxlint": "=1.60.0",
324
- "oxlint-tsgolint": "=0.21.0",
325
- "@voidzero-dev/vite-plus-core": "0.1.19-alpha.0",
326
- "@voidzero-dev/vite-plus-test": "0.1.19-alpha.0"
324
+ "oxlint-tsgolint": "=0.21.1",
325
+ "@voidzero-dev/vite-plus-core": "0.1.19-alpha.2",
326
+ "@voidzero-dev/vite-plus-test": "0.1.19-alpha.2"
327
327
  },
328
328
  "devDependencies": {
329
329
  "@napi-rs/cli": "^3.6.1",
@@ -345,11 +345,11 @@
345
345
  "picocolors": "^1.1.1",
346
346
  "rolldown-plugin-dts": "^0.23.0",
347
347
  "semver": "^7.7.3",
348
- "tsdown": "^0.21.8",
348
+ "tsdown": "^0.21.9",
349
349
  "validate-npm-package-name": "^7.0.2",
350
350
  "yaml": "^2.8.1",
351
- "vite": "npm:@voidzero-dev/vite-plus-core@0.1.19-alpha.0",
352
- "@voidzero-dev/vite-plus-prompts": "0.0.0"
351
+ "@voidzero-dev/vite-plus-prompts": "0.0.0",
352
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.1.19-alpha.2"
353
353
  },
354
354
  "napi": {
355
355
  "binaryName": "vite-plus",
@@ -369,14 +369,14 @@
369
369
  "node": "^20.19.0 || >=22.12.0"
370
370
  },
371
371
  "optionalDependencies": {
372
- "@voidzero-dev/vite-plus-darwin-arm64": "0.1.19-alpha.0",
373
- "@voidzero-dev/vite-plus-darwin-x64": "0.1.19-alpha.0",
374
- "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.19-alpha.0",
375
- "@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.19-alpha.0",
376
- "@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.19-alpha.0",
377
- "@voidzero-dev/vite-plus-linux-x64-musl": "0.1.19-alpha.0",
378
- "@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.19-alpha.0",
379
- "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.19-alpha.0"
372
+ "@voidzero-dev/vite-plus-darwin-arm64": "0.1.19-alpha.2",
373
+ "@voidzero-dev/vite-plus-darwin-x64": "0.1.19-alpha.2",
374
+ "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.19-alpha.2",
375
+ "@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.19-alpha.2",
376
+ "@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.19-alpha.2",
377
+ "@voidzero-dev/vite-plus-linux-x64-musl": "0.1.19-alpha.2",
378
+ "@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.19-alpha.2",
379
+ "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.19-alpha.2"
380
380
  },
381
381
  "scripts": {
382
382
  "build": "oxnode -C dev ./build.ts",
@@ -28,4 +28,4 @@ Vite+ extends the basic Vite configuration with these additions:
28
28
  - [`test`](/config/test) for Vitest
29
29
  - [`run`](/config/run) for Vite Task
30
30
  - [`pack`](/config/pack) for tsdown
31
- - [`staged`](/config/staged) for staged-file checks
31
+ - [`staged`](/config/staged) for staged-file checks
@@ -89,6 +89,34 @@ export default defineConfig({
89
89
  });
90
90
  ```
91
91
 
92
+ ## Slow config loading caused by heavy plugins
93
+
94
+ When `vite.config.ts` imports heavy plugins at the top level, every `import` is evaluated eagerly, even for commands like `vp lint` or `vp fmt` that don't need those plugins. This can make config loading noticeably slow.
95
+
96
+ Use `lazyPlugins` to wrap plugin loading. Plugins are only loaded for commands that need them (`dev`, `build`, `test`, `preview`), and skipped for everything else:
97
+
98
+ ```ts
99
+ import { defineConfig, lazyPlugins } from 'vite-plus';
100
+ import myPlugin from 'vite-plugin-foo';
101
+
102
+ export default defineConfig({
103
+ plugins: lazyPlugins(() => [myPlugin()]),
104
+ });
105
+ ```
106
+
107
+ For heavy plugins that should be lazily imported, combine with dynamic `import()`:
108
+
109
+ ```ts
110
+ import { defineConfig, lazyPlugins } from 'vite-plus';
111
+
112
+ export default defineConfig({
113
+ plugins: lazyPlugins(async () => {
114
+ const { default: heavyPlugin } = await import('vite-plugin-heavy');
115
+ return [heavyPlugin()];
116
+ }),
117
+ });
118
+ ```
119
+
92
120
  ## Asking for Help
93
121
 
94
122
  If you are stuck, please reach out:
@@ -1,34 +0,0 @@
1
- import { defineConfig } from "@voidzero-dev/vite-plus-test/config";
2
- //#region src/define-config.ts
3
- function defineConfig$1(config) {
4
- if (typeof config === "object") {
5
- if (config instanceof Promise) return config.then((config) => {
6
- if (config.lazy) return config.lazy().then(({ plugins }) => defineConfig({
7
- ...config,
8
- plugins: [...config.plugins || [], ...plugins || []]
9
- }));
10
- return defineConfig(config);
11
- });
12
- else if (config.lazy) return config.lazy().then(({ plugins }) => defineConfig({
13
- ...config,
14
- plugins: [...config.plugins || [], ...plugins || []]
15
- }));
16
- } else if (typeof config === "function") return defineConfig((env) => {
17
- const c = config(env);
18
- if (c instanceof Promise) return c.then((v) => {
19
- if (v.lazy) return v.lazy().then(({ plugins }) => defineConfig({
20
- ...v,
21
- plugins: [...v.plugins || [], ...plugins || []]
22
- }));
23
- return v;
24
- });
25
- if (c.lazy) return c.lazy().then(({ plugins }) => ({
26
- ...c,
27
- plugins: [...c.plugins || [], ...plugins || []]
28
- }));
29
- return c;
30
- });
31
- return defineConfig(config);
32
- }
33
- //#endregion
34
- export { defineConfig$1 as t };
@@ -1,3 +0,0 @@
1
- import { t as require_dist } from "./dist-DPsDLqya.js";
2
- export default require_dist();
3
- export {};