vite-plus 0.2.9 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/LICENSE +29 -29
  2. package/README.md +6 -5
  3. package/binding/index.cjs +63 -55
  4. package/binding/index.d.cts +218 -14
  5. package/dist/{agent-DQU8uS6P.js → agent-C5jMYVfB.js} +3 -2
  6. package/dist/bin.js +101 -60
  7. package/dist/cli-parse-DHE8NrBU.js +13 -0
  8. package/dist/client/bundledDevClient.mjs +1 -1
  9. package/dist/client/client.mjs +1 -1
  10. package/dist/client/env.mjs +1 -1
  11. package/dist/client.d.ts +1 -1
  12. package/dist/command-CLJK5jGW.js +2 -0
  13. package/dist/command-CguLh2KL.js +471 -0
  14. package/dist/config/bin.js +85 -55
  15. package/dist/{constants-CG513DRa.js → constants-0IAVgpox.js} +5 -3
  16. package/dist/create/bin.d.ts +13 -5
  17. package/dist/create/bin.js +55 -232
  18. package/dist/{define-config-DyNLA_f0.cjs → define-config-DIE9de46.cjs} +2 -2
  19. package/dist/{define-config-DWoAkNdp.d.ts → define-config-DPNEJxPz.d.ts} +5 -9
  20. package/dist/{define-config-CV4bQG_8.js → define-config-U3_xg7i-.js} +2 -2
  21. package/dist/define-config.cjs +1 -1
  22. package/dist/define-config.d.ts +1 -1
  23. package/dist/define-config.js +1 -1
  24. package/dist/dist-DfmT__Aw.js +619 -0
  25. package/dist/{editor-g4PosU99.js → editor-B5-lvRaU.js} +619 -88
  26. package/dist/{terminal-Bz-ps6rJ.js → help-BmKpeOP9.js} +1 -38
  27. package/dist/hooks/bin.js +9 -113
  28. package/dist/{hooks-pNCBWtFT.js → hooks-C-4gykWR.js} +5 -2
  29. package/dist/index.cjs +2 -2
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.js +2 -2
  32. package/dist/internal.d.ts +1 -1
  33. package/dist/internal.js +1 -1
  34. package/dist/migration/bin.js +76 -146
  35. package/dist/migration/compat/worker.js +1 -1
  36. package/dist/module-runner.d.ts +1 -1
  37. package/dist/module-runner.js +1 -1
  38. package/dist/{oxlint-plugin-config-BEZ9IUf7.js → oxlint-plugin-config-Drdl67Xp.js} +1 -1
  39. package/dist/oxlint-plugin.d.ts +2 -2
  40. package/dist/oxlint-plugin.js +1 -1
  41. package/dist/{pack-PvUg_xpv.d.ts → pack-BK38MLVZ.d.ts} +1 -1
  42. package/dist/pack-bin.d.ts +2 -3
  43. package/dist/pack-bin.js +9 -625
  44. package/dist/pack-client.d.ts +1 -1
  45. package/dist/pack.d.ts +2 -2
  46. package/dist/pack.js +1 -1
  47. package/dist/{package-B4T8RGMG.js → package-BZz2Ij68.js} +2 -2
  48. package/dist/{prompts-CHz_98bJ.js → prompts-CtzEgFY-.js} +7 -1872
  49. package/dist/{report-BS7ULx7A.js → report-CK5TnTsr.js} +2 -0
  50. package/dist/{resolve-vite-config-Dmeyeyj-.js → resolve-vite-config-CGks1xR7.js} +3 -3
  51. package/dist/resolve-vite-config-Dnmc-lBc.js +2 -0
  52. package/dist/semver-CaDAb8vV.js +1400 -0
  53. package/dist/staged/bin.js +82 -187
  54. package/dist/sync-versions/bin.d.ts +1 -0
  55. package/dist/sync-versions/bin.js +3884 -0
  56. package/dist/sync-versions/bin.mjs +13323 -0
  57. package/dist/terminal-MKGAuy-p.js +39 -0
  58. package/dist/toolchain.js +11 -11
  59. package/dist/toolchain.json +11 -11
  60. package/dist/{tsconfig-7v_BHagU.js → tsconfig-CUggNuJR.js} +5 -4
  61. package/dist/tsconfig-VAbm4ZzJ.js +2 -0
  62. package/dist/tsgolint-path.d.ts +3 -4
  63. package/dist/types/customEvent.d.ts +1 -1
  64. package/dist/types/hmrPayload.d.ts +1 -1
  65. package/dist/types/hot.d.ts +1 -1
  66. package/dist/types/import-meta.d.ts +1 -1
  67. package/dist/types/importGlob.d.ts +1 -1
  68. package/dist/types/importMeta.d.ts +1 -1
  69. package/dist/types/metadata.d.ts +1 -1
  70. package/dist/version.d.ts +2 -3
  71. package/dist/version.js +4 -3
  72. package/dist/versions.js +6 -6
  73. package/dist/vitest-ecosystem-BiRqcaRI.js +23 -0
  74. package/docs/guide/check.md +1 -0
  75. package/docs/guide/ci.md +42 -2
  76. package/docs/guide/env.md +136 -50
  77. package/docs/guide/ide-integration.md +14 -2
  78. package/docs/guide/index.md +1 -1
  79. package/docs/guide/install.md +5 -2
  80. package/docs/guide/installer-env-vars.md +51 -5
  81. package/docs/guide/migrate-rules.md +66 -2
  82. package/docs/guide/migrate.md +5 -5
  83. package/docs/guide/test.md +8 -0
  84. package/docs/guide/upgrade.md +48 -1
  85. package/package.json +34 -37
  86. package/dist/lib-L3DWSRQp.js +0 -75
  87. package/docs/_data/team.ts +0 -131
  88. package/docs/package.json +0 -30
  89. package/docs/pnpm-lock.yaml +0 -4003
  90. package/docs/pnpm-workspace.yaml +0 -13
  91. package/docs/public/checkmark.svg +0 -1
  92. package/docs/public/cta-background.jpg +0 -0
  93. package/docs/public/favicon.svg +0 -1
  94. package/docs/public/icon.svg +0 -1
  95. package/docs/public/logo.svg +0 -1
  96. package/docs/public/og.jpg +0 -0
  97. package/docs/vite.config.ts +0 -20
  98. package/dist/{json-qlK6UH0r.js → json-cULBl7Pi.js} +107 -107
@@ -174,6 +174,38 @@ export interface MangleOptionsKeepNames {
174
174
  class: boolean;
175
175
  }
176
176
 
177
+ export interface ManglePropertiesOptions {
178
+ /**
179
+ * JavaScript `RegExp` selecting property names to mangle. The source and flags are compiled
180
+ * with Rust's regex engine. Flags `i`, `m`, `s`, and `u` are supported.
181
+ */
182
+ include: RegExp;
183
+ /** JavaScript `RegExp` excluding property names selected by `include`. */
184
+ exclude?: RegExp;
185
+ /** Exact names that are neither mangled nor emitted as automatic output names. */
186
+ reserved?: Array<string>;
187
+ /**
188
+ * Mangle quoted property occurrences in addition to unquoted occurrences.
189
+ *
190
+ * @default false
191
+ */
192
+ quoted?: boolean;
193
+ /**
194
+ * Generate readable `_$name$_`-style output names.
195
+ *
196
+ * @default false
197
+ */
198
+ debug?: boolean;
199
+ /**
200
+ * Stable mappings from original names to output names. `false` reserves an original name.
201
+ * Entries that do not match `include`, or that match `exclude`, remain inert but are
202
+ * preserved in the returned `mangleCache`. String targets must be `IdentifierName` values
203
+ * other than `__proto__`, `constructor`, or `prototype`. The original name `__proto__` is
204
+ * always reserved and cannot be used as a cache key.
205
+ */
206
+ cache?: Record<string, string | false>;
207
+ }
208
+
177
209
  /**
178
210
  * Minify asynchronously.
179
211
  *
@@ -190,6 +222,12 @@ export interface MinifyOptions {
190
222
  module?: boolean;
191
223
  compress?: boolean | CompressOptions;
192
224
  mangle?: boolean | MangleOptions;
225
+ /**
226
+ * Mangle matching property names independently of identifier mangling. Properties owned by
227
+ * unminified code, imported module namespaces, globals, or host APIs must be excluded or
228
+ * reserved.
229
+ */
230
+ mangleProps?: ManglePropertiesOptions;
193
231
  codegen?: boolean | CodegenOptions;
194
232
  sourcemap?: boolean;
195
233
  }
@@ -203,6 +241,11 @@ export interface MinifyResult {
203
241
  * Only populated when `codegen.legalComments` is `"linked"` or `"external"`.
204
242
  */
205
243
  legalComments: Array<string>;
244
+ /**
245
+ * Updated property-name cache sorted by original name. Present when `mangleProps` ran on a
246
+ * parse without errors.
247
+ */
248
+ mangleCache?: Record<string, string | false>;
206
249
  }
207
250
 
208
251
  /** Minify synchronously. */
@@ -1651,6 +1694,12 @@ export declare class BindingDevEngine {
1651
1694
  * actual module and its dependencies.
1652
1695
  */
1653
1696
  compileEntry(moduleId: string, clientId: string): Promise<BindingLazyChunkOutput>;
1697
+ /**
1698
+ * Same data the plugin-context `getModuleInfo` returns, readable from the engine
1699
+ * handle at any time (no hook context needed).
1700
+ */
1701
+ getModuleInfo(moduleId: string): BindingModuleInfo | null;
1702
+ getModuleIds(): Array<string>;
1654
1703
  }
1655
1704
 
1656
1705
  export declare class BindingLoadPluginContext {
@@ -1959,8 +2008,8 @@ export declare class TraceSubscriberGuard {
1959
2008
  }
1960
2009
 
1961
2010
  export declare class TsconfigCache {
1962
- /** Create a new transform cache with auto tsconfig discovery enabled. */
1963
- constructor(yarnPnp: boolean);
2011
+ /** Create a new transform cache with auto or manual tsconfig discovery enabled. */
2012
+ constructor(yarnPnp: boolean, pathToTsconfig?: string | undefined | null);
1964
2013
  /**
1965
2014
  * Clear the cache.
1966
2015
  *
@@ -2063,6 +2112,7 @@ export interface BindingChecksOptions {
2063
2112
  ineffectiveDynamicImport?: boolean;
2064
2113
  largeBarrelModules?: boolean;
2065
2114
  sourcemapBroken?: boolean;
2115
+ namespaceConflict?: boolean;
2066
2116
  }
2067
2117
 
2068
2118
  export interface BindingChunkImportMap {
@@ -2244,9 +2294,10 @@ export interface BindingEnhancedTransformOptions {
2244
2294
  /**
2245
2295
  * Configure tsconfig handling.
2246
2296
  * - true: Auto-discover and load the nearest tsconfig.json
2297
+ * - string: Use the tsconfig at the provided path
2247
2298
  * - TsconfigRawOptions: Use the provided inline tsconfig options
2248
2299
  */
2249
- tsconfig?: boolean | BindingTsconfigRawOptions;
2300
+ tsconfig?: boolean | string | BindingTsconfigRawOptions;
2250
2301
  /** An input source map to collapse with the output source map. */
2251
2302
  inputMap?: SourceMap;
2252
2303
  }
@@ -2657,8 +2708,8 @@ export interface BindingManualCodeSplittingOptions {
2657
2708
  }
2658
2709
 
2659
2710
  export interface BindingMatchGroup {
2660
- name: string | ((id: string, ctx: BindingChunkingContext) => VoidNullable<string>);
2661
- test?: string | RegExp | ((id: string) => VoidNullable<boolean>);
2711
+ name: string | ((ids: Array<string>, ctx: BindingChunkingContext) => Array<VoidNullable<string>>);
2712
+ test?: string | RegExp | ((ids: Array<string>) => Uint8Array);
2662
2713
  priority?: number;
2663
2714
  minSize?: number;
2664
2715
  minShareCount?: number;
@@ -2682,6 +2733,22 @@ export interface BindingModuleSideEffectsRule {
2682
2733
  external?: boolean;
2683
2734
  }
2684
2735
 
2736
+ /**
2737
+ * Counters of the Rust-side tracking allocator. V8 never allocates through
2738
+ * the Rust global allocator, so these numbers exclude the JS heap and GC
2739
+ * noise completely, unlike `process.memoryUsage()`.
2740
+ */
2741
+ export interface BindingNativeMemoryStats {
2742
+ /** Bytes currently allocated and not yet freed, since process start. */
2743
+ liveBytes: number;
2744
+ /** Highest `live_bytes` seen since process start or the last reset. */
2745
+ peakBytes: number;
2746
+ /** Successful `alloc` calls since the last reset. */
2747
+ allocCount: number;
2748
+ /** Successful `realloc` calls since the last reset. */
2749
+ reallocCount: number;
2750
+ }
2751
+
2685
2752
  export interface BindingOptimization {
2686
2753
  inlineConst?: boolean | BindingInlineConstConfig;
2687
2754
  pifeForModuleWrappers?: boolean;
@@ -2742,6 +2809,7 @@ export interface BindingOutputOptions {
2742
2809
  export interface BindingOutputs {
2743
2810
  chunks: Array<BindingOutputChunk>;
2744
2811
  assets: Array<BindingOutputAsset>;
2812
+ mangleCache?: Record<string, string | false>;
2745
2813
  }
2746
2814
 
2747
2815
  export interface BindingOverwriteOptions {
@@ -2853,14 +2921,14 @@ export interface BindingPluginOptions {
2853
2921
  renderErrorMeta?: BindingPluginHookMeta;
2854
2922
  generateBundle?: (
2855
2923
  ctx: BindingPluginContext,
2856
- bundle: BindingErrorsOr<BindingOutputs>,
2924
+ bundle: BindingResult<BindingOutputs>,
2857
2925
  isWrite: boolean,
2858
2926
  opts: BindingNormalizedOptions,
2859
2927
  ) => MaybePromise<VoidNullable<JsChangedOutputs>>;
2860
2928
  generateBundleMeta?: BindingPluginHookMeta;
2861
2929
  writeBundle?: (
2862
2930
  ctx: BindingPluginContext,
2863
- bundle: BindingErrorsOr<BindingOutputs>,
2931
+ bundle: BindingResult<BindingOutputs>,
2864
2932
  opts: BindingNormalizedOptions,
2865
2933
  ) => MaybePromise<VoidNullable<JsChangedOutputs>>;
2866
2934
  writeBundleMeta?: BindingPluginHookMeta;
@@ -3154,6 +3222,7 @@ export interface BindingViteReporterPluginConfig {
3154
3222
 
3155
3223
  export interface BindingViteResolvePluginConfig {
3156
3224
  resolveOptions: BindingViteResolvePluginResolveOptions;
3225
+ tsconfig?: string;
3157
3226
  environmentConsumer: string;
3158
3227
  environmentName: string;
3159
3228
  builtins: Array<BindingStringOrRegex>;
@@ -3199,6 +3268,7 @@ export interface BindingViteResolvePluginResolveOptions {
3199
3268
 
3200
3269
  export interface BindingViteTransformPluginConfig {
3201
3270
  root: string;
3271
+ tsconfig?: string;
3202
3272
  include?: Array<BindingStringOrRegex>;
3203
3273
  exclude?: Array<BindingStringOrRegex>;
3204
3274
  jsxRefreshInclude?: Array<BindingStringOrRegex>;
@@ -3268,6 +3338,13 @@ export declare const enum FilterTokenKind {
3268
3338
  QueryValue = 'QueryValue',
3269
3339
  }
3270
3340
 
3341
+ /**
3342
+ * Returns the Rust-side allocator counters, or `None` when this binding was
3343
+ * built without the `tracking_allocator` cargo feature (the default —
3344
+ * tracking costs a few atomic operations per allocation).
3345
+ */
3346
+ export declare function getNativeMemoryStats(): BindingNativeMemoryStats | null;
3347
+
3271
3348
  export declare function initTraceSubscriber(): TraceSubscriberGuard | null;
3272
3349
 
3273
3350
  export interface JsChangedOutputs {
@@ -3321,7 +3398,7 @@ export interface PreRenderedChunk {
3321
3398
  /** Whether this chunk is a dynamic entry point. */
3322
3399
  isDynamicEntry: boolean;
3323
3400
  /** The id of a module that this chunk corresponds to. */
3324
- facadeModuleId?: string;
3401
+ facadeModuleId: string | null;
3325
3402
  /** The list of ids of modules included in this chunk. */
3326
3403
  moduleIds: Array<string>;
3327
3404
  /** Exported variable names from this chunk. */
@@ -3330,6 +3407,13 @@ export interface PreRenderedChunk {
3330
3407
 
3331
3408
  export declare function registerPlugins(id: number, plugins: Array<BindingPluginWithIndex>): void;
3332
3409
 
3410
+ /**
3411
+ * Starts a new measuring window: the peak restarts from the current live
3412
+ * bytes and the counts restart from zero. No-op when the binding was built
3413
+ * without the `tracking_allocator` cargo feature.
3414
+ */
3415
+ export declare function resetNativeMemoryStats(): void;
3416
+
3333
3417
  export declare function resolveTsconfig(
3334
3418
  filename: string,
3335
3419
  cache: TsconfigCache | undefined | null,
@@ -3366,17 +3450,21 @@ export interface BatchRewriteResult {
3366
3450
  preservedVitestFiles: Array<string>;
3367
3451
  /** Files that had errors */
3368
3452
  errors: Array<BatchRewriteError>;
3453
+ /** Pack configurations that need manual migration */
3454
+ warnings: Array<BatchRewriteError>;
3369
3455
  }
3370
3456
 
3371
3457
  /** Configuration options passed from JavaScript to Rust. */
3372
3458
  export interface CliOptions {
3373
- lint: (err: Error | null) => Promise<JsCommandResolvedResult>;
3374
- fmt: (err: Error | null) => Promise<JsCommandResolvedResult>;
3375
- vite: (err: Error | null) => Promise<JsCommandResolvedResult>;
3376
- test: (err: Error | null) => Promise<JsCommandResolvedResult>;
3377
- pack: (err: Error | null) => Promise<JsCommandResolvedResult>;
3378
- doc: (err: Error | null) => Promise<JsCommandResolvedResult>;
3459
+ lint: (err: Error | null, arg: JsCommandContext) => Promise<JsCommandResolvedResult>;
3460
+ fmt: (err: Error | null, arg: JsCommandContext) => Promise<JsCommandResolvedResult>;
3461
+ vite: (err: Error | null, arg: JsCommandContext) => Promise<JsCommandResolvedResult>;
3462
+ test: (err: Error | null, arg: JsCommandContext) => Promise<JsCommandResolvedResult>;
3463
+ pack: (err: Error | null, arg: JsCommandContext) => Promise<JsCommandResolvedResult>;
3464
+ doc: (err: Error | null, arg: JsCommandContext) => Promise<JsCommandResolvedResult>;
3379
3465
  cwd?: string;
3466
+ /** Whether the user supplied the global `-C` option. */
3467
+ explicitChdir?: boolean;
3380
3468
  /** CLI arguments (should be process.argv.slice(2) from JavaScript) */
3381
3469
  args?: Array<string>;
3382
3470
  /** Generated toolchain manifest shipped with this vite-plus package. */
@@ -3387,6 +3475,32 @@ export interface CliOptions {
3387
3475
  resolveUniversalViteConfig: (err: Error | null, arg: string) => Promise<string>;
3388
3476
  }
3389
3477
 
3478
+ export interface CliParseError {
3479
+ kind: string;
3480
+ message: string;
3481
+ }
3482
+
3483
+ export interface ConfigArgs {
3484
+ hooksDir?: string;
3485
+ hooks?: boolean;
3486
+ agent?: boolean;
3487
+ }
3488
+
3489
+ export interface CreateArgs {
3490
+ templateName?: string;
3491
+ directory?: string;
3492
+ agent?: false | string | Array<string>;
3493
+ editor?: false | string;
3494
+ git?: boolean;
3495
+ hooks?: boolean;
3496
+ packageManager?: 'pnpm' | 'npm' | 'yarn' | 'bun';
3497
+ approveBuilds?: boolean;
3498
+ verbose?: boolean;
3499
+ interactive?: boolean;
3500
+ list?: boolean;
3501
+ templateArgs: Array<string>;
3502
+ }
3503
+
3390
3504
  /**
3391
3505
  * Detect the workspace root and package manager type and version
3392
3506
  *
@@ -3475,6 +3589,14 @@ export interface DownloadPackageManagerResult {
3475
3589
  /** Re-enable blocking stdio after Node.js has initialized its lazy standard streams. */
3476
3590
  export declare function ensureBlockingStdio(): void;
3477
3591
 
3592
+ /**
3593
+ * Resolved on-disk category roots from [`vp_shared::EnvConfig`].
3594
+ *
3595
+ * JavaScript must not read `VP_HOME` / `VP_*_DIR` / `XDG_*` itself;
3596
+ * this is the JS surface of the same `EnvConfig::get().dirs` Rust uses.
3597
+ */
3598
+ export declare function getVpDirs(): VpDirsJs;
3599
+
3478
3600
  /**
3479
3601
  * Whether `config_key` is already declared as a top-level property in the
3480
3602
  * vite config's `defineConfig({...})` (or equivalent) object literal.
@@ -3485,6 +3607,17 @@ export declare function ensureBlockingStdio(): void;
3485
3607
  */
3486
3608
  export declare function hasConfigKey(viteConfigPath: string, configKey: string): boolean;
3487
3609
 
3610
+ export interface HooksArgs {
3611
+ command: 'enable' | 'disable' | 'status';
3612
+ hooksDir?: string;
3613
+ }
3614
+
3615
+ /** Execution context after command dispatch selects the working directory. */
3616
+ export interface JsCommandContext {
3617
+ cwd: string;
3618
+ args: Array<string>;
3619
+ }
3620
+
3488
3621
  /** Result returned by JavaScript resolver functions. */
3489
3622
  export interface JsCommandResolvedResult {
3490
3623
  binPath: string;
@@ -3567,6 +3700,50 @@ export declare function mergeTsdownConfig(
3567
3700
  tsdownConfigPath: string,
3568
3701
  ): MergeJsonConfigResult;
3569
3702
 
3703
+ export interface MigrateArgs {
3704
+ path?: string;
3705
+ agent?: false | string | Array<string>;
3706
+ editor?: false | string;
3707
+ hooks?: boolean;
3708
+ interactive?: boolean;
3709
+ full?: boolean;
3710
+ }
3711
+
3712
+ export declare function parseConfigArgs(argv: Array<string>): ParseConfigArgsOutcome;
3713
+
3714
+ export type ParseConfigArgsOutcome =
3715
+ | { status: 'ok'; value: ConfigArgs }
3716
+ | { status: 'exit'; code: number }
3717
+ | { status: 'error'; error: CliParseError };
3718
+
3719
+ export declare function parseCreateArgs(argv: Array<string>): ParseCreateArgsOutcome;
3720
+
3721
+ export type ParseCreateArgsOutcome =
3722
+ | { status: 'ok'; value: CreateArgs }
3723
+ | { status: 'exit'; code: number }
3724
+ | { status: 'error'; error: CliParseError };
3725
+
3726
+ export declare function parseHooksArgs(argv: Array<string>): ParseHooksArgsOutcome;
3727
+
3728
+ export type ParseHooksArgsOutcome =
3729
+ | { status: 'ok'; value: HooksArgs }
3730
+ | { status: 'exit'; code: number }
3731
+ | { status: 'error'; error: CliParseError };
3732
+
3733
+ export declare function parseMigrateArgs(argv: Array<string>): ParseMigrateArgsOutcome;
3734
+
3735
+ export type ParseMigrateArgsOutcome =
3736
+ | { status: 'ok'; value: MigrateArgs }
3737
+ | { status: 'exit'; code: number }
3738
+ | { status: 'error'; error: CliParseError };
3739
+
3740
+ export declare function parseStagedArgs(argv: Array<string>): ParseStagedArgsOutcome;
3741
+
3742
+ export type ParseStagedArgsOutcome =
3743
+ | { status: 'ok'; value: StagedArgs }
3744
+ | { status: 'exit'; code: number }
3745
+ | { status: 'error'; error: CliParseError };
3746
+
3570
3747
  /** Access modes for a path. */
3571
3748
  export interface PathAccess {
3572
3749
  /** Whether the path was read */
@@ -3751,6 +3928,24 @@ export interface RunCommandResult {
3751
3928
  */
3752
3929
  export declare function shouldPrintVitePlusHeader(): boolean;
3753
3930
 
3931
+ export interface StagedArgs {
3932
+ allowEmpty?: boolean;
3933
+ concurrent?: boolean | number;
3934
+ continueOnError?: boolean;
3935
+ cwd?: string;
3936
+ debug?: boolean;
3937
+ diff?: string;
3938
+ diffFilter?: string;
3939
+ failOnChanges?: boolean;
3940
+ hidePartiallyStaged?: boolean;
3941
+ hideUnstaged?: boolean;
3942
+ quiet?: boolean;
3943
+ relative?: boolean;
3944
+ revert?: boolean;
3945
+ stash?: boolean;
3946
+ verbose?: boolean;
3947
+ }
3948
+
3754
3949
  /**
3755
3950
  * Set the value of a top-level config key in a vite config file (upsert)
3756
3951
  *
@@ -3793,6 +3988,15 @@ export declare function upsertJsonConfig(
3793
3988
  /** Render the Vite+ header using the Rust implementation. */
3794
3989
  export declare function vitePlusHeader(): string;
3795
3990
 
3991
+ /** Resolved on-disk category roots from [`vp_shared::EnvConfig`]. */
3992
+ export interface VpDirsJs {
3993
+ bin: string;
3994
+ data: string;
3995
+ cache: string;
3996
+ config: string;
3997
+ state: string;
3998
+ }
3999
+
3796
4000
  /**
3797
4001
  * Wrap safe inline `plugins: [...]` arrays in recognized Vite config objects
3798
4002
  * with `lazyPlugins(() => [...])` and add a `lazyPlugins` import from
@@ -1,4 +1,5 @@
1
- import { A as isCancel, C as log, E as select, w as multiselect } from "./prompts-CHz_98bJ.js";
1
+ import { a as SETUP_VP_VERSION } from "./constants-0IAVgpox.js";
2
+ import { C as multiselect, S as log, T as select, k as isCancel } from "./prompts-CtzEgFY-.js";
2
3
  import path from "node:path";
3
4
  import { styleText } from "node:util";
4
5
  import fs from "node:fs";
@@ -110,7 +111,7 @@ jobs:
110
111
  with:
111
112
  persist-credentials: false
112
113
  - name: Set up Vite+
113
- uses: voidzero-dev/setup-vp@v1
114
+ uses: voidzero-dev/setup-vp@${SETUP_VP_VERSION}
114
115
  with:
115
116
  cache: true
116
117
  run-install: true
package/dist/bin.js CHANGED
@@ -1,14 +1,15 @@
1
- import { c as warnMsg, i as log, l as renderCliDoc, n as errorMsg, o as printHeader, t as accent } from "./terminal-Bz-ps6rJ.js";
2
- import { c as VITE_PLUS_NAME, i as DEFAULT_ENVS, m as resolveBundled, n as BASEURL_TSCONFIG_WARNING, p as resolve$1, r as CONFIG_METADATA_ENV, s as VITE_CONFIG_FILES } from "./constants-CG513DRa.js";
3
- import { r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-BEZ9IUf7.js";
4
- import { M as runCommandSilently } from "./prompts-CHz_98bJ.js";
5
- import { i as hasBaseUrlInTsconfig, r as fixBaseUrlInTsconfig } from "./tsconfig-7v_BHagU.js";
1
+ import { t as renderCliDoc } from "./help-BmKpeOP9.js";
2
+ import { c as warnMsg, i as log, n as errorMsg, o as printHeader, t as accent } from "./terminal-MKGAuy-p.js";
3
+ import { g as resolveBundled, h as resolve$1, i as DEFAULT_ENVS, l as VITE_CONFIG_FILES, n as BASEURL_TSCONFIG_WARNING, r as CONFIG_METADATA_ENV, u as VITE_PLUS_NAME } from "./constants-0IAVgpox.js";
4
+ import { r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-Drdl67Xp.js";
6
5
  import { t as resolveTsgolintExecutable } from "./tsgolint-path-CbDReEOx.js";
7
- import { i as resolveUniversalViteConfig } from "./resolve-vite-config-Dmeyeyj-.js";
8
- import path, { dirname, join } from "node:path";
6
+ import { a as readNearestPackageJson } from "./package-BZz2Ij68.js";
7
+ import { t as cac } from "./dist-DfmT__Aw.js";
8
+ import { createRequire } from "node:module";
9
+ import path, { dirname, join, resolve } from "node:path";
9
10
  import { fileURLToPath } from "node:url";
10
11
  import { ensureBlockingStdio, hasConfigKey, mergeJsonConfig, run } from "../binding/index.js";
11
- import fs, { readFileSync } from "node:fs";
12
+ import fs, { existsSync, readFileSync } from "node:fs";
12
13
  //#region src/help.ts
13
14
  const commandHelpDocs = {
14
15
  dev: {
@@ -935,6 +936,10 @@ const commandHelpDocs = {
935
936
  label: "--fix",
936
937
  description: "Auto-fix format and lint issues"
937
938
  },
939
+ {
940
+ label: "--quiet",
941
+ description: "Disable reporting on warnings, only errors are reported"
942
+ },
938
943
  {
939
944
  label: "--no-fmt",
940
945
  description: "Skip format check"
@@ -978,6 +983,10 @@ const commandHelpDocs = {
978
983
  {
979
984
  title: "Options",
980
985
  rows: [
986
+ {
987
+ label: "--no-config",
988
+ description: "Disable config file"
989
+ },
981
990
  {
982
991
  label: "-f, --format <format>",
983
992
  description: "Bundle format: esm, cjs, iife, umd (default: esm)"
@@ -1090,10 +1099,6 @@ const commandHelpDocs = {
1090
1099
  label: "--copy <dir>",
1091
1100
  description: "Copy files to output dir"
1092
1101
  },
1093
- {
1094
- label: "--public-dir <dir>",
1095
- description: "Alias for --copy, deprecated"
1096
- },
1097
1102
  {
1098
1103
  label: "--tsconfig <tsconfig>",
1099
1104
  description: "Set tsconfig path"
@@ -1453,6 +1458,7 @@ export default defineConfig({});
1453
1458
  return viteConfigPath;
1454
1459
  }
1455
1460
  async function vpFmt(cwd, filePath) {
1461
+ const { runCommandSilently } = await import("./command-CLJK5jGW.js");
1456
1462
  const { binPath, envs } = await fmt();
1457
1463
  const result = await runCommandSilently({
1458
1464
  command: binPath,
@@ -1511,6 +1517,7 @@ async function applyToolInitConfigToViteConfig(command, args, projectPath = proc
1511
1517
  }
1512
1518
  if (spec.configKey === "lint" && hasTriggerFlag(args, ["--init"])) {
1513
1519
  const lintInitConfigPath = path.join(projectPath, ".vite-plus-lint-init.oxlintrc.json");
1520
+ const { fixBaseUrlInTsconfig, hasBaseUrlInTsconfig } = await import("./tsconfig-VAbm4ZzJ.js");
1514
1521
  await fixBaseUrlInTsconfig(projectPath);
1515
1522
  const hasBaseUrl = hasBaseUrlInTsconfig(projectPath);
1516
1523
  const initConfig = createDefaultVitePlusLintConfig({ includeTypeAwareDefaults: !hasBaseUrl });
@@ -1613,26 +1620,49 @@ async function lint() {
1613
1620
  };
1614
1621
  }
1615
1622
  //#endregion
1623
+ //#region src/resolve-core.ts
1624
+ const CORE_PACKAGE_NAME = "@voidzero-dev/vite-plus-core";
1625
+ function checkCoreVersion(packageJsonPath, expectedVersion) {
1626
+ const pkg = JSON.parse(readFileSync(packageJsonPath, "utf8"));
1627
+ if (pkg.name !== CORE_PACKAGE_NAME || pkg.version !== expectedVersion) throw new Error(`Expected ${CORE_PACKAGE_NAME}@${expectedVersion}, but found ${pkg.name}@${pkg.version} at ${packageJsonPath}. Run \`vp migrate\` to align the Vite alias, then run \`vp install\`.`);
1628
+ }
1629
+ function checkProjectCoreVersion(cwd, corePackageJsonPath, expectedVersion) {
1630
+ const projectPackage = readNearestPackageJson(cwd);
1631
+ if (![
1632
+ "dependencies",
1633
+ "devDependencies",
1634
+ "optionalDependencies",
1635
+ "peerDependencies"
1636
+ ].some((field) => Object.hasOwn(projectPackage?.[field] ?? {}, "vite"))) return;
1637
+ const projectRequire = createRequire(join(cwd, "package.json"));
1638
+ let projectPackageJsonPath;
1639
+ try {
1640
+ projectPackageJsonPath = projectRequire.resolve("vite/package.json");
1641
+ } catch (cause) {
1642
+ if (cause.code !== "MODULE_NOT_FOUND") throw cause;
1643
+ }
1644
+ if (projectPackageJsonPath && projectPackageJsonPath !== corePackageJsonPath) checkCoreVersion(projectPackageJsonPath, expectedVersion);
1645
+ }
1646
+ /** Resolve the same core dependency as the CLI's static `vite` re-exports. */
1647
+ function resolveCore(subpath = "", cwd = process.cwd(), modulePath = import.meta.url) {
1648
+ const cliRequire = createRequire(modulePath);
1649
+ const { version: expectedVersion } = JSON.parse(readFileSync(cliRequire.resolve("vite-plus/package.json"), "utf8"));
1650
+ let corePackageJsonPath;
1651
+ try {
1652
+ corePackageJsonPath = cliRequire.resolve("vite/package.json");
1653
+ } catch (cause) {
1654
+ throw new Error("Could not resolve the bundled Vite dependency. Run `vp install`.", { cause });
1655
+ }
1656
+ checkCoreVersion(corePackageJsonPath, expectedVersion);
1657
+ checkProjectCoreVersion(cwd, corePackageJsonPath, expectedVersion);
1658
+ return cliRequire.resolve(`vite${subpath}`);
1659
+ }
1660
+ //#endregion
1616
1661
  //#region src/resolve-pack.ts
1617
- /**
1618
- * Tsdown tool resolver for the vite-plus CLI.
1619
- *
1620
- * This module exports a function that resolves the Tsdown binary path
1621
- * using Node.js module resolution. The resolved path is passed back
1622
- * to the Rust core, which then executes Tsdown for running pack.
1623
- *
1624
- * Used for: `vite-plus pack` command
1625
- */
1626
- /**
1627
- * Resolves the Tsdown binary path and environment variables.
1628
- *
1629
- * @returns Promise containing:
1630
- * - binPath: Absolute path to the Tsdown CLI entry point
1631
- * - envs: Environment variables to set when executing Tsdown
1632
- *
1633
- * Tsdown is a tool that provides a library for building JavaScript/TypeScript libraries.
1634
- */
1635
- async function pack() {
1662
+ /** Validate the target project's core alias before starting the bundled pack entry. */
1663
+ async function pack(err, { cwd }) {
1664
+ if (err) throw err;
1665
+ resolveCore("/pack", cwd);
1636
1666
  return {
1637
1667
  binPath: join(import.meta.dirname, "pack-bin.js"),
1638
1668
  envs: { ...DEFAULT_ENVS }
@@ -1682,35 +1712,39 @@ async function test() {
1682
1712
  }
1683
1713
  //#endregion
1684
1714
  //#region src/resolve-vite.ts
1685
- /**
1686
- * Vite tool resolver for the vite-plus CLI.
1687
- *
1688
- * This module exports a function that resolves the Vite binary path
1689
- * using Node.js module resolution. The resolved path is passed back
1690
- * to the Rust core, which then executes Vite with the appropriate
1691
- * command and arguments.
1692
- *
1693
- * Used for: `vite-plus build` and potentially `vite-plus dev` commands
1694
- */
1695
- /**
1696
- * Resolves the Vite binary path and environment variables.
1697
- *
1698
- * @returns Promise containing:
1699
- * - binPath: Absolute path to the Vite CLI entry point (vite.js)
1700
- * - envs: Environment variables to set when executing Vite
1701
- *
1702
- * The function first tries to resolve vite package, then falls back
1703
- * to vite package (for direct vite installations).
1704
- * It constructs the path to the CLI binary within the resolved package.
1705
- */
1706
- async function vite() {
1707
- const vitePackagePath = dirname(resolve$1("@voidzero-dev/vite-plus-core"));
1715
+ function resolveViteRoot({ cwd, args }) {
1716
+ const cli = cac();
1717
+ const command = cli.command("[root]").allowUnknownOptions();
1718
+ for (const flag of [
1719
+ "--clearScreen",
1720
+ "--cors",
1721
+ "--strictPort",
1722
+ "--force",
1723
+ "--experimentalBundle",
1724
+ "--emptyOutDir",
1725
+ "-w, --watch",
1726
+ "--app",
1727
+ "-h, --help",
1728
+ "-v, --version"
1729
+ ]) command.option(flag, "");
1730
+ const parsed = cli.parse([
1731
+ "node",
1732
+ "vite",
1733
+ ...args
1734
+ ], { run: false });
1735
+ return resolve(cwd, parsed.args[0] ?? ".");
1736
+ }
1737
+ /** Resolve the bundled CLI for dev, build, and preview from the selected project root. */
1738
+ async function vite(err, context) {
1739
+ if (err) throw err;
1740
+ const vitePackagePath = dirname(resolveCore("", resolveViteRoot(context)));
1741
+ const binPath = join(vitePackagePath, "cli.js");
1742
+ if (!existsSync(binPath)) throw new Error(`Could not find the bundled Vite CLI at ${binPath}. Run \`vp install\`.`);
1743
+ const envs = { ...DEFAULT_ENVS };
1744
+ if (process.env.DEBUG_DISABLE_SOURCE_MAP) envs.DEBUG_DISABLE_SOURCE_MAP = process.env.DEBUG_DISABLE_SOURCE_MAP;
1708
1745
  return {
1709
- binPath: join(vitePackagePath, "cli.js"),
1710
- envs: process.env.DEBUG_DISABLE_SOURCE_MAP ? {
1711
- ...DEFAULT_ENVS,
1712
- DEBUG_DISABLE_SOURCE_MAP: process.env.DEBUG_DISABLE_SOURCE_MAP
1713
- } : { ...DEFAULT_ENVS }
1746
+ binPath,
1747
+ envs
1714
1748
  };
1715
1749
  }
1716
1750
  //#endregion
@@ -1718,7 +1752,7 @@ async function vite() {
1718
1752
  /**
1719
1753
  * Unified entry point for both the local CLI (via bin/vp) and the global CLI (via Rust vp binary).
1720
1754
  *
1721
- * Global commands (create, migrate, config, hooks, staged, --version) are handled by tsdown-bundled modules.
1755
+ * Global commands (create, migrate, sync-versions, config, hooks, staged, --version) are handled by tsdown-bundled modules.
1722
1756
  * All other commands are delegated to the Rust core through NAPI bindings, which
1723
1757
  * uses JavaScript tool resolver functions to locate tool binaries.
1724
1758
  *
@@ -1735,7 +1769,11 @@ function getErrorMessage(err) {
1735
1769
  return String(err);
1736
1770
  }
1737
1771
  let args = process.argv.slice(2);
1772
+ const explicitChdirMarker = process.env.VP_EXPLICIT_CHDIR;
1773
+ let explicitChdir = explicitChdirMarker === "1";
1774
+ if (explicitChdirMarker !== void 0) delete process.env.VP_EXPLICIT_CHDIR;
1738
1775
  if (args[0]?.startsWith("-C")) {
1776
+ explicitChdir = true;
1739
1777
  const inline = args[0].length > 2;
1740
1778
  const dir = inline ? args[0].slice(args[0][2] === "=" ? 3 : 2) : args[1];
1741
1779
  if (!dir) {
@@ -1773,11 +1811,13 @@ const cliDistDir = path.dirname(fileURLToPath(import.meta.url));
1773
1811
  const vitePlusPackagePath = path.dirname(cliDistDir);
1774
1812
  if (maybePrintCommandHelp(args)) {} else if (command === "create") await import("./create/bin.js");
1775
1813
  else if (command === "migrate") await import("./migration/bin.js");
1814
+ else if (command === "sync-versions") await import("./sync-versions/bin.js");
1776
1815
  else if (command === "config") await import("./config/bin.js");
1777
1816
  else if (command === "hooks") await import("./hooks/bin.js");
1778
1817
  else if (command === "--version" || command === "-V") await import("./version.js");
1779
1818
  else if (command === "staged") await import("./staged/bin.js");
1780
1819
  else try {
1820
+ const { resolveUniversalViteConfig } = await import("./resolve-vite-config-Dnmc-lBc.js");
1781
1821
  const initInspection = inspectInitCommand(command, args.slice(1));
1782
1822
  if (initInspection.handled && initInspection.configKey && initInspection.hasExistingConfigKey && initInspection.existingViteConfigPath) {
1783
1823
  log(`Skipped initialization: '${accent(initInspection.configKey)}' already exists in '${accent(path.basename(initInspection.existingViteConfigPath))}'.`);
@@ -1793,6 +1833,7 @@ else try {
1793
1833
  toolchainManifestPath: path.join(cliDistDir, "toolchain.json"),
1794
1834
  vitePlusPackagePath,
1795
1835
  resolveUniversalViteConfig,
1836
+ explicitChdir,
1796
1837
  args: rustCliArgs
1797
1838
  });
1798
1839
  let finalExitCode = exitCode;
@@ -0,0 +1,13 @@
1
+ import { n as errorMsg, o as printHeader } from "./terminal-MKGAuy-p.js";
2
+ //#region src/utils/cli-parse.ts
3
+ function unwrapCliParseOutcome(outcome) {
4
+ if (outcome.status === "exit") process.exit(outcome.code);
5
+ if (outcome.status === "error") {
6
+ printHeader();
7
+ errorMsg(outcome.error.message.replace(/^error:\s*/, ""));
8
+ process.exit(1);
9
+ }
10
+ return outcome.value;
11
+ }
12
+ //#endregion
13
+ export { unwrapCliParseOutcome as t };
@@ -1 +1 @@
1
- export * from '@voidzero-dev/vite-plus-core/dist/client/bundledDevClient.mjs';
1
+ export * from 'vite/dist/client/bundledDevClient.mjs';