vite-plus 0.3.0 → 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.
- package/LICENSE +29 -29
- package/README.md +2 -2
- package/binding/index.cjs +60 -55
- package/binding/index.d.cts +125 -14
- package/dist/{agent-Wqx0MPk0.js → agent-C5jMYVfB.js} +3 -2
- package/dist/bin.js +89 -58
- package/dist/cli-parse-DHE8NrBU.js +13 -0
- package/dist/client/bundledDevClient.mjs +1 -1
- package/dist/client/client.mjs +1 -1
- package/dist/client/env.mjs +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/config/bin.js +83 -55
- package/dist/{constants-Bn-U8o4v.js → constants-0IAVgpox.js} +3 -3
- package/dist/create/bin.d.ts +13 -5
- package/dist/create/bin.js +37 -190
- package/dist/{define-config-WiVlryJ2.cjs → define-config-DIE9de46.cjs} +1 -1
- package/dist/{define-config-DWoAkNdp.d.ts → define-config-DPNEJxPz.d.ts} +5 -9
- package/dist/{define-config-GXUdVT-0.js → define-config-U3_xg7i-.js} +2 -2
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/dist-DfmT__Aw.js +619 -0
- package/dist/{editor-CC4DqODz.js → editor-B5-lvRaU.js} +68 -40
- package/dist/hooks/bin.js +9 -114
- package/dist/{hooks-DFqViZqZ.js → hooks-C-4gykWR.js} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/migration/bin.js +24 -143
- package/dist/migration/compat/worker.js +1 -1
- package/dist/module-runner.d.ts +1 -1
- package/dist/module-runner.js +1 -1
- package/dist/{oxlint-plugin-config-DX5ezKbB.js → oxlint-plugin-config-Drdl67Xp.js} +1 -1
- package/dist/oxlint-plugin.d.ts +2 -2
- package/dist/oxlint-plugin.js +1 -1
- package/dist/{pack-PvUg_xpv.d.ts → pack-BK38MLVZ.d.ts} +1 -1
- package/dist/pack-bin.d.ts +2 -3
- package/dist/pack-bin.js +5 -622
- package/dist/pack-client.d.ts +1 -1
- package/dist/pack.d.ts +2 -2
- package/dist/pack.js +1 -1
- package/dist/{package-CBe9EWPY.js → package-BZz2Ij68.js} +1 -1
- package/dist/{prompts-DF3yU-eU.js → prompts-CtzEgFY-.js} +3 -1400
- package/dist/{report-ZNR1Mk6h.js → report-CK5TnTsr.js} +1 -0
- package/dist/{resolve-vite-config-ipGb39Jo.js → resolve-vite-config-CGks1xR7.js} +3 -3
- package/dist/resolve-vite-config-Dnmc-lBc.js +2 -0
- package/dist/semver-CaDAb8vV.js +1400 -0
- package/dist/staged/bin.js +83 -218
- package/dist/sync-versions/bin.d.ts +1 -0
- package/dist/sync-versions/bin.js +3884 -0
- package/dist/sync-versions/bin.mjs +13323 -0
- package/dist/toolchain.js +9 -9
- package/dist/toolchain.json +9 -9
- package/dist/{tsconfig-LD2QhQ0O.js → tsconfig-CUggNuJR.js} +2 -2
- package/dist/{tsconfig-BVHG3DpR.js → tsconfig-VAbm4ZzJ.js} +1 -1
- package/dist/tsgolint-path.d.ts +3 -4
- package/dist/types/customEvent.d.ts +1 -1
- package/dist/types/hmrPayload.d.ts +1 -1
- package/dist/types/hot.d.ts +1 -1
- package/dist/types/import-meta.d.ts +1 -1
- package/dist/types/importGlob.d.ts +1 -1
- package/dist/types/importMeta.d.ts +1 -1
- package/dist/types/metadata.d.ts +1 -1
- package/dist/version.d.ts +2 -3
- package/dist/version.js +2 -2
- package/dist/versions.js +4 -4
- package/dist/vitest-ecosystem-BiRqcaRI.js +23 -0
- package/docs/guide/check.md +1 -0
- package/docs/guide/ci.md +42 -2
- package/docs/guide/env.md +124 -52
- package/docs/guide/ide-integration.md +14 -2
- package/docs/guide/index.md +1 -1
- package/docs/guide/install.md +3 -1
- package/docs/guide/installer-env-vars.md +10 -0
- package/docs/guide/migrate-rules.md +57 -2
- package/package.json +17 -19
- package/dist/lib-L3DWSRQp.js +0 -75
- package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
package/binding/index.d.cts
CHANGED
|
@@ -1694,6 +1694,12 @@ export declare class BindingDevEngine {
|
|
|
1694
1694
|
* actual module and its dependencies.
|
|
1695
1695
|
*/
|
|
1696
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>;
|
|
1697
1703
|
}
|
|
1698
1704
|
|
|
1699
1705
|
export declare class BindingLoadPluginContext {
|
|
@@ -2002,8 +2008,8 @@ export declare class TraceSubscriberGuard {
|
|
|
2002
2008
|
}
|
|
2003
2009
|
|
|
2004
2010
|
export declare class TsconfigCache {
|
|
2005
|
-
/** Create a new transform cache with auto tsconfig discovery enabled. */
|
|
2006
|
-
constructor(yarnPnp: boolean);
|
|
2011
|
+
/** Create a new transform cache with auto or manual tsconfig discovery enabled. */
|
|
2012
|
+
constructor(yarnPnp: boolean, pathToTsconfig?: string | undefined | null);
|
|
2007
2013
|
/**
|
|
2008
2014
|
* Clear the cache.
|
|
2009
2015
|
*
|
|
@@ -2288,9 +2294,10 @@ export interface BindingEnhancedTransformOptions {
|
|
|
2288
2294
|
/**
|
|
2289
2295
|
* Configure tsconfig handling.
|
|
2290
2296
|
* - true: Auto-discover and load the nearest tsconfig.json
|
|
2297
|
+
* - string: Use the tsconfig at the provided path
|
|
2291
2298
|
* - TsconfigRawOptions: Use the provided inline tsconfig options
|
|
2292
2299
|
*/
|
|
2293
|
-
tsconfig?: boolean | BindingTsconfigRawOptions;
|
|
2300
|
+
tsconfig?: boolean | string | BindingTsconfigRawOptions;
|
|
2294
2301
|
/** An input source map to collapse with the output source map. */
|
|
2295
2302
|
inputMap?: SourceMap;
|
|
2296
2303
|
}
|
|
@@ -2701,8 +2708,8 @@ export interface BindingManualCodeSplittingOptions {
|
|
|
2701
2708
|
}
|
|
2702
2709
|
|
|
2703
2710
|
export interface BindingMatchGroup {
|
|
2704
|
-
name: string | ((
|
|
2705
|
-
test?: string | RegExp | ((
|
|
2711
|
+
name: string | ((ids: Array<string>, ctx: BindingChunkingContext) => Array<VoidNullable<string>>);
|
|
2712
|
+
test?: string | RegExp | ((ids: Array<string>) => Uint8Array);
|
|
2706
2713
|
priority?: number;
|
|
2707
2714
|
minSize?: number;
|
|
2708
2715
|
minShareCount?: number;
|
|
@@ -2802,6 +2809,7 @@ export interface BindingOutputOptions {
|
|
|
2802
2809
|
export interface BindingOutputs {
|
|
2803
2810
|
chunks: Array<BindingOutputChunk>;
|
|
2804
2811
|
assets: Array<BindingOutputAsset>;
|
|
2812
|
+
mangleCache?: Record<string, string | false>;
|
|
2805
2813
|
}
|
|
2806
2814
|
|
|
2807
2815
|
export interface BindingOverwriteOptions {
|
|
@@ -2913,14 +2921,14 @@ export interface BindingPluginOptions {
|
|
|
2913
2921
|
renderErrorMeta?: BindingPluginHookMeta;
|
|
2914
2922
|
generateBundle?: (
|
|
2915
2923
|
ctx: BindingPluginContext,
|
|
2916
|
-
bundle:
|
|
2924
|
+
bundle: BindingResult<BindingOutputs>,
|
|
2917
2925
|
isWrite: boolean,
|
|
2918
2926
|
opts: BindingNormalizedOptions,
|
|
2919
2927
|
) => MaybePromise<VoidNullable<JsChangedOutputs>>;
|
|
2920
2928
|
generateBundleMeta?: BindingPluginHookMeta;
|
|
2921
2929
|
writeBundle?: (
|
|
2922
2930
|
ctx: BindingPluginContext,
|
|
2923
|
-
bundle:
|
|
2931
|
+
bundle: BindingResult<BindingOutputs>,
|
|
2924
2932
|
opts: BindingNormalizedOptions,
|
|
2925
2933
|
) => MaybePromise<VoidNullable<JsChangedOutputs>>;
|
|
2926
2934
|
writeBundleMeta?: BindingPluginHookMeta;
|
|
@@ -3214,6 +3222,7 @@ export interface BindingViteReporterPluginConfig {
|
|
|
3214
3222
|
|
|
3215
3223
|
export interface BindingViteResolvePluginConfig {
|
|
3216
3224
|
resolveOptions: BindingViteResolvePluginResolveOptions;
|
|
3225
|
+
tsconfig?: string;
|
|
3217
3226
|
environmentConsumer: string;
|
|
3218
3227
|
environmentName: string;
|
|
3219
3228
|
builtins: Array<BindingStringOrRegex>;
|
|
@@ -3259,6 +3268,7 @@ export interface BindingViteResolvePluginResolveOptions {
|
|
|
3259
3268
|
|
|
3260
3269
|
export interface BindingViteTransformPluginConfig {
|
|
3261
3270
|
root: string;
|
|
3271
|
+
tsconfig?: string;
|
|
3262
3272
|
include?: Array<BindingStringOrRegex>;
|
|
3263
3273
|
exclude?: Array<BindingStringOrRegex>;
|
|
3264
3274
|
jsxRefreshInclude?: Array<BindingStringOrRegex>;
|
|
@@ -3388,7 +3398,7 @@ export interface PreRenderedChunk {
|
|
|
3388
3398
|
/** Whether this chunk is a dynamic entry point. */
|
|
3389
3399
|
isDynamicEntry: boolean;
|
|
3390
3400
|
/** The id of a module that this chunk corresponds to. */
|
|
3391
|
-
facadeModuleId
|
|
3401
|
+
facadeModuleId: string | null;
|
|
3392
3402
|
/** The list of ids of modules included in this chunk. */
|
|
3393
3403
|
moduleIds: Array<string>;
|
|
3394
3404
|
/** Exported variable names from this chunk. */
|
|
@@ -3440,16 +3450,18 @@ export interface BatchRewriteResult {
|
|
|
3440
3450
|
preservedVitestFiles: Array<string>;
|
|
3441
3451
|
/** Files that had errors */
|
|
3442
3452
|
errors: Array<BatchRewriteError>;
|
|
3453
|
+
/** Pack configurations that need manual migration */
|
|
3454
|
+
warnings: Array<BatchRewriteError>;
|
|
3443
3455
|
}
|
|
3444
3456
|
|
|
3445
3457
|
/** Configuration options passed from JavaScript to Rust. */
|
|
3446
3458
|
export interface CliOptions {
|
|
3447
|
-
lint: (err: Error | null) => Promise<JsCommandResolvedResult>;
|
|
3448
|
-
fmt: (err: Error | null) => Promise<JsCommandResolvedResult>;
|
|
3449
|
-
vite: (err: Error | null) => Promise<JsCommandResolvedResult>;
|
|
3450
|
-
test: (err: Error | null) => Promise<JsCommandResolvedResult>;
|
|
3451
|
-
pack: (err: Error | null) => Promise<JsCommandResolvedResult>;
|
|
3452
|
-
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>;
|
|
3453
3465
|
cwd?: string;
|
|
3454
3466
|
/** Whether the user supplied the global `-C` option. */
|
|
3455
3467
|
explicitChdir?: boolean;
|
|
@@ -3463,6 +3475,32 @@ export interface CliOptions {
|
|
|
3463
3475
|
resolveUniversalViteConfig: (err: Error | null, arg: string) => Promise<string>;
|
|
3464
3476
|
}
|
|
3465
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
|
+
|
|
3466
3504
|
/**
|
|
3467
3505
|
* Detect the workspace root and package manager type and version
|
|
3468
3506
|
*
|
|
@@ -3569,6 +3607,17 @@ export declare function getVpDirs(): VpDirsJs;
|
|
|
3569
3607
|
*/
|
|
3570
3608
|
export declare function hasConfigKey(viteConfigPath: string, configKey: string): boolean;
|
|
3571
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
|
+
|
|
3572
3621
|
/** Result returned by JavaScript resolver functions. */
|
|
3573
3622
|
export interface JsCommandResolvedResult {
|
|
3574
3623
|
binPath: string;
|
|
@@ -3651,6 +3700,50 @@ export declare function mergeTsdownConfig(
|
|
|
3651
3700
|
tsdownConfigPath: string,
|
|
3652
3701
|
): MergeJsonConfigResult;
|
|
3653
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
|
+
|
|
3654
3747
|
/** Access modes for a path. */
|
|
3655
3748
|
export interface PathAccess {
|
|
3656
3749
|
/** Whether the path was read */
|
|
@@ -3835,6 +3928,24 @@ export interface RunCommandResult {
|
|
|
3835
3928
|
*/
|
|
3836
3929
|
export declare function shouldPrintVitePlusHeader(): boolean;
|
|
3837
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
|
+
|
|
3838
3949
|
/**
|
|
3839
3950
|
* Set the value of a top-level config key in a vite config file (upsert)
|
|
3840
3951
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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,13 +1,15 @@
|
|
|
1
1
|
import { t as renderCliDoc } from "./help-BmKpeOP9.js";
|
|
2
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-
|
|
4
|
-
import { r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-
|
|
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";
|
|
5
5
|
import { t as resolveTsgolintExecutable } from "./tsgolint-path-CbDReEOx.js";
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
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";
|
|
8
10
|
import { fileURLToPath } from "node:url";
|
|
9
11
|
import { ensureBlockingStdio, hasConfigKey, mergeJsonConfig, run } from "../binding/index.js";
|
|
10
|
-
import fs, { readFileSync } from "node:fs";
|
|
12
|
+
import fs, { existsSync, readFileSync } from "node:fs";
|
|
11
13
|
//#region src/help.ts
|
|
12
14
|
const commandHelpDocs = {
|
|
13
15
|
dev: {
|
|
@@ -934,6 +936,10 @@ const commandHelpDocs = {
|
|
|
934
936
|
label: "--fix",
|
|
935
937
|
description: "Auto-fix format and lint issues"
|
|
936
938
|
},
|
|
939
|
+
{
|
|
940
|
+
label: "--quiet",
|
|
941
|
+
description: "Disable reporting on warnings, only errors are reported"
|
|
942
|
+
},
|
|
937
943
|
{
|
|
938
944
|
label: "--no-fmt",
|
|
939
945
|
description: "Skip format check"
|
|
@@ -1093,10 +1099,6 @@ const commandHelpDocs = {
|
|
|
1093
1099
|
label: "--copy <dir>",
|
|
1094
1100
|
description: "Copy files to output dir"
|
|
1095
1101
|
},
|
|
1096
|
-
{
|
|
1097
|
-
label: "--public-dir <dir>",
|
|
1098
|
-
description: "Alias for --copy, deprecated"
|
|
1099
|
-
},
|
|
1100
1102
|
{
|
|
1101
1103
|
label: "--tsconfig <tsconfig>",
|
|
1102
1104
|
description: "Set tsconfig path"
|
|
@@ -1515,7 +1517,7 @@ async function applyToolInitConfigToViteConfig(command, args, projectPath = proc
|
|
|
1515
1517
|
}
|
|
1516
1518
|
if (spec.configKey === "lint" && hasTriggerFlag(args, ["--init"])) {
|
|
1517
1519
|
const lintInitConfigPath = path.join(projectPath, ".vite-plus-lint-init.oxlintrc.json");
|
|
1518
|
-
const { fixBaseUrlInTsconfig, hasBaseUrlInTsconfig } = await import("./tsconfig-
|
|
1520
|
+
const { fixBaseUrlInTsconfig, hasBaseUrlInTsconfig } = await import("./tsconfig-VAbm4ZzJ.js");
|
|
1519
1521
|
await fixBaseUrlInTsconfig(projectPath);
|
|
1520
1522
|
const hasBaseUrl = hasBaseUrlInTsconfig(projectPath);
|
|
1521
1523
|
const initConfig = createDefaultVitePlusLintConfig({ includeTypeAwareDefaults: !hasBaseUrl });
|
|
@@ -1618,26 +1620,49 @@ async function lint() {
|
|
|
1618
1620
|
};
|
|
1619
1621
|
}
|
|
1620
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
|
|
1621
1661
|
//#region src/resolve-pack.ts
|
|
1622
|
-
/**
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
* using Node.js module resolution. The resolved path is passed back
|
|
1627
|
-
* to the Rust core, which then executes Tsdown for running pack.
|
|
1628
|
-
*
|
|
1629
|
-
* Used for: `vite-plus pack` command
|
|
1630
|
-
*/
|
|
1631
|
-
/**
|
|
1632
|
-
* Resolves the Tsdown binary path and environment variables.
|
|
1633
|
-
*
|
|
1634
|
-
* @returns Promise containing:
|
|
1635
|
-
* - binPath: Absolute path to the Tsdown CLI entry point
|
|
1636
|
-
* - envs: Environment variables to set when executing Tsdown
|
|
1637
|
-
*
|
|
1638
|
-
* Tsdown is a tool that provides a library for building JavaScript/TypeScript libraries.
|
|
1639
|
-
*/
|
|
1640
|
-
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);
|
|
1641
1666
|
return {
|
|
1642
1667
|
binPath: join(import.meta.dirname, "pack-bin.js"),
|
|
1643
1668
|
envs: { ...DEFAULT_ENVS }
|
|
@@ -1687,35 +1712,39 @@ async function test() {
|
|
|
1687
1712
|
}
|
|
1688
1713
|
//#endregion
|
|
1689
1714
|
//#region src/resolve-vite.ts
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
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;
|
|
1713
1745
|
return {
|
|
1714
|
-
binPath
|
|
1715
|
-
envs
|
|
1716
|
-
...DEFAULT_ENVS,
|
|
1717
|
-
DEBUG_DISABLE_SOURCE_MAP: process.env.DEBUG_DISABLE_SOURCE_MAP
|
|
1718
|
-
} : { ...DEFAULT_ENVS }
|
|
1746
|
+
binPath,
|
|
1747
|
+
envs
|
|
1719
1748
|
};
|
|
1720
1749
|
}
|
|
1721
1750
|
//#endregion
|
|
@@ -1723,7 +1752,7 @@ async function vite() {
|
|
|
1723
1752
|
/**
|
|
1724
1753
|
* Unified entry point for both the local CLI (via bin/vp) and the global CLI (via Rust vp binary).
|
|
1725
1754
|
*
|
|
1726
|
-
* 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.
|
|
1727
1756
|
* All other commands are delegated to the Rust core through NAPI bindings, which
|
|
1728
1757
|
* uses JavaScript tool resolver functions to locate tool binaries.
|
|
1729
1758
|
*
|
|
@@ -1782,11 +1811,13 @@ const cliDistDir = path.dirname(fileURLToPath(import.meta.url));
|
|
|
1782
1811
|
const vitePlusPackagePath = path.dirname(cliDistDir);
|
|
1783
1812
|
if (maybePrintCommandHelp(args)) {} else if (command === "create") await import("./create/bin.js");
|
|
1784
1813
|
else if (command === "migrate") await import("./migration/bin.js");
|
|
1814
|
+
else if (command === "sync-versions") await import("./sync-versions/bin.js");
|
|
1785
1815
|
else if (command === "config") await import("./config/bin.js");
|
|
1786
1816
|
else if (command === "hooks") await import("./hooks/bin.js");
|
|
1787
1817
|
else if (command === "--version" || command === "-V") await import("./version.js");
|
|
1788
1818
|
else if (command === "staged") await import("./staged/bin.js");
|
|
1789
1819
|
else try {
|
|
1820
|
+
const { resolveUniversalViteConfig } = await import("./resolve-vite-config-Dnmc-lBc.js");
|
|
1790
1821
|
const initInspection = inspectInitCommand(command, args.slice(1));
|
|
1791
1822
|
if (initInspection.handled && initInspection.configKey && initInspection.hasExistingConfigKey && initInspection.existingViteConfigPath) {
|
|
1792
1823
|
log(`Skipped initialization: '${accent(initInspection.configKey)}' already exists in '${accent(path.basename(initInspection.existingViteConfigPath))}'.`);
|
|
@@ -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 '
|
|
1
|
+
export * from 'vite/dist/client/bundledDevClient.mjs';
|
package/dist/client/client.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from 'vite/dist/client/client.mjs';
|
package/dist/client/env.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from 'vite/dist/client/env.mjs';
|
package/dist/client.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/// <reference types="
|
|
1
|
+
/// <reference types="vite/client" />
|
package/dist/config/bin.js
CHANGED
|
@@ -1,66 +1,94 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import { o as
|
|
6
|
-
import {
|
|
7
|
-
import { join } from "node:path";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
}, {
|
|
46
|
-
title: "Environment",
|
|
47
|
-
rows: [{
|
|
48
|
-
label: "VP_GIT_HOOKS=0",
|
|
49
|
-
description: "Skip hook dispatcher installation"
|
|
50
|
-
}]
|
|
51
|
-
}]
|
|
52
|
-
});
|
|
53
|
-
printHeader();
|
|
54
|
-
log(helpMessage);
|
|
1
|
+
import { i as log, n as errorMsg } from "../terminal-MKGAuy-p.js";
|
|
2
|
+
import { i as promptGitHooks, n as defaultInteractive } from "../prompts-CtzEgFY-.js";
|
|
3
|
+
import { o as updateExistingAgentInstructions } from "../agent-C5jMYVfB.js";
|
|
4
|
+
import { t as require_dist } from "../dist-BDYZP12R.js";
|
|
5
|
+
import { a as install, c as resolveHooksLocation, o as isGitHooksEnvDisabled, s as isHooksUserDisabled } from "../hooks-C-4gykWR.js";
|
|
6
|
+
import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
|
|
7
|
+
import path, { join, relative } from "node:path";
|
|
8
|
+
import { parseConfigArgs } from "../../binding/index.js";
|
|
9
|
+
import fs, { existsSync } from "node:fs";
|
|
10
|
+
//#region src/utils/legacy-vitest-alias.ts
|
|
11
|
+
var import_dist = require_dist();
|
|
12
|
+
const LEGACY_VITEST_ALIAS = "npm:@voidzero-dev/vite-plus-test";
|
|
13
|
+
function containsLegacyVitestAlias(value, visited = /* @__PURE__ */ new Set()) {
|
|
14
|
+
if (typeof value === "string") return value === LEGACY_VITEST_ALIAS || value.startsWith(`${LEGACY_VITEST_ALIAS}@`);
|
|
15
|
+
if (value === null || typeof value !== "object" || visited.has(value)) return false;
|
|
16
|
+
visited.add(value);
|
|
17
|
+
return Object.values(value).some((entry) => containsLegacyVitestAlias(entry, visited));
|
|
18
|
+
}
|
|
19
|
+
function asRecord(value) {
|
|
20
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
21
|
+
}
|
|
22
|
+
function containsAliasInFields(config, fields) {
|
|
23
|
+
const record = asRecord(config);
|
|
24
|
+
return fields.some((field) => containsLegacyVitestAlias(record?.[field]));
|
|
25
|
+
}
|
|
26
|
+
function containsPackageAlias(config) {
|
|
27
|
+
return containsAliasInFields(config, [
|
|
28
|
+
"dependencies",
|
|
29
|
+
"devDependencies",
|
|
30
|
+
"optionalDependencies",
|
|
31
|
+
"peerDependencies",
|
|
32
|
+
"overrides",
|
|
33
|
+
"resolutions",
|
|
34
|
+
"catalog",
|
|
35
|
+
"catalogs"
|
|
36
|
+
]) || containsAliasInFields(config?.pnpm, ["overrides"]) || containsAliasInFields(config?.workspaces, ["catalog", "catalogs"]);
|
|
37
|
+
}
|
|
38
|
+
function readConfigFile(filePath) {
|
|
39
|
+
try {
|
|
40
|
+
const source = fs.readFileSync(filePath, "utf8");
|
|
41
|
+
return asRecord(path.basename(filePath) === "package.json" ? JSON.parse(source) : (0, import_dist.parse)(source));
|
|
42
|
+
} catch {
|
|
55
43
|
return;
|
|
56
44
|
}
|
|
57
|
-
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Find a package-manager setting that still aliases Vitest to the deleted
|
|
48
|
+
* `@voidzero-dev/vite-plus-test` wrapper. Check the nearest package and its
|
|
49
|
+
* workspace root, without inspecting unrelated ancestor package settings.
|
|
50
|
+
*/
|
|
51
|
+
function findLegacyVitestAliasConfig(startDir) {
|
|
52
|
+
let currentDir = path.resolve(startDir);
|
|
53
|
+
let foundPackage = false;
|
|
54
|
+
while (true) {
|
|
55
|
+
const packagePath = path.join(currentDir, "package.json");
|
|
56
|
+
const pkg = readConfigFile(packagePath);
|
|
57
|
+
const isNearestPackage = !foundPackage && fs.existsSync(packagePath);
|
|
58
|
+
if (isNearestPackage) foundPackage = true;
|
|
59
|
+
const workspacePath = path.join(currentDir, "pnpm-workspace.yaml");
|
|
60
|
+
const isWorkspaceRoot = fs.existsSync(workspacePath) || pkg !== void 0 && Object.hasOwn(pkg, "workspaces");
|
|
61
|
+
if ((isNearestPackage || isWorkspaceRoot) && containsPackageAlias(pkg)) return packagePath;
|
|
62
|
+
if (isWorkspaceRoot) {
|
|
63
|
+
if (containsAliasInFields(readConfigFile(workspacePath), [
|
|
64
|
+
"catalog",
|
|
65
|
+
"catalogs",
|
|
66
|
+
"overrides"
|
|
67
|
+
])) return workspacePath;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const parentDir = path.dirname(currentDir);
|
|
71
|
+
if (parentDir === currentDir) return;
|
|
72
|
+
currentDir = parentDir;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/config/bin.ts
|
|
77
|
+
async function main() {
|
|
78
|
+
const args = unwrapCliParseOutcome(parseConfigArgs(process.argv.slice(3)));
|
|
79
|
+
const dir = args.hooksDir;
|
|
58
80
|
const skipHooks = args.hooks === false;
|
|
59
81
|
const skipAgent = args.agent === false;
|
|
60
82
|
const interactive = defaultInteractive();
|
|
61
83
|
const lifecycleEvent = process.env.npm_lifecycle_event;
|
|
62
84
|
const isLifecycleScript = lifecycleEvent === "prepare" || lifecycleEvent === "postinstall";
|
|
63
85
|
const root = process.cwd();
|
|
86
|
+
const staleVitestAliasConfig = findLegacyVitestAliasConfig(root);
|
|
87
|
+
if (staleVitestAliasConfig) {
|
|
88
|
+
const relativeConfigPath = relative(root, staleVitestAliasConfig);
|
|
89
|
+
errorMsg(`Found a stale Vitest alias in ${relativeConfigPath} that points to the removed \`@voidzero-dev/vite-plus-test\` package. Run \`vp migrate\` to update the project before installing dependencies.`);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
64
92
|
if (!skipHooks && isGitHooksEnvDisabled()) log("skip install (git hooks disabled)");
|
|
65
93
|
else if (!skipHooks) {
|
|
66
94
|
const location = resolveHooksLocation(dir);
|