vite-plus 0.3.1 → 0.3.3
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/README.md +1 -1
- package/bin/vp +1 -1
- package/binding/index.cjs +137 -56
- package/binding/index.d.cts +52 -0
- package/dist/{agent-C5jMYVfB.js → agent-Cu6-tXIP.js} +2 -2
- package/dist/bin.js +6 -5
- package/dist/config/bin.js +2 -2
- package/dist/{constants-0IAVgpox.js → constants-C2dTOTe-.js} +2 -2
- package/dist/create/bin.js +97 -68
- package/dist/{define-config-DIE9de46.cjs → define-config-D0mevyb3.cjs} +1 -1
- package/dist/{define-config-U3_xg7i-.js → define-config-IgzmnvvV.js} +2 -2
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.js +1 -1
- package/dist/{editor-B5-lvRaU.js → editor-4sjlHmUh.js} +154 -36
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/lint-plugins-dev.d.ts +3 -0
- package/dist/lint-plugins-dev.js +2 -0
- package/dist/lint-plugins.cjs +21 -0
- package/dist/lint-plugins.d.ts +3 -0
- package/dist/lint-plugins.js +2 -0
- package/dist/migration/bin.js +7 -7
- package/dist/{oxlint-plugin-config-Drdl67Xp.js → oxlint-plugin-config-BVqEe9KY.js} +1 -1
- package/dist/oxlint-plugin.js +93 -32
- package/dist/pack-bin.js +1 -1
- package/dist/{package-BZz2Ij68.js → package-CHH8jWan.js} +1 -1
- package/dist/{prompts-CtzEgFY-.js → prompts-k14KgthC.js} +1 -1
- package/dist/{resolve-vite-config-CGks1xR7.js → resolve-vite-config-BqvS2P98.js} +2 -2
- package/dist/{resolve-vite-config-Dnmc-lBc.js → resolve-vite-config-CTOTuqTi.js} +1 -1
- package/dist/staged/bin.js +1 -1
- package/dist/toolchain.js +8 -8
- package/dist/toolchain.json +8 -8
- package/dist/{tsconfig-CUggNuJR.js → tsconfig-C3h9CVTA.js} +2 -2
- package/dist/{tsconfig-VAbm4ZzJ.js → tsconfig-euB-GmIE.js} +1 -1
- package/dist/version.js +2 -2
- package/dist/versions.js +4 -4
- package/docs/config/fmt.md +4 -2
- package/docs/config/lint.md +4 -2
- package/docs/config/staged.md +1 -2
- package/docs/guide/ci.md +28 -31
- package/docs/guide/commit-hooks.md +11 -34
- package/docs/guide/create.md +1 -2
- package/docs/guide/docker.md +20 -68
- package/docs/guide/env.md +56 -22
- package/docs/guide/fmt.md +3 -1
- package/docs/guide/global-cli.md +426 -0
- package/docs/guide/ide-integration.md +1 -2
- package/docs/guide/implode.md +14 -1
- package/docs/guide/index.md +37 -34
- package/docs/guide/install.md +18 -19
- package/docs/guide/lint.md +52 -1
- package/docs/guide/local-cli.md +123 -0
- package/docs/guide/migrate-rules.md +108 -267
- package/docs/guide/migrate.md +6 -49
- package/docs/guide/monorepo.md +2 -0
- package/docs/guide/run.md +1 -1
- package/docs/guide/troubleshooting.md +17 -8
- package/docs/guide/upgrade-project.md +61 -0
- package/docs/guide/upgrade.md +17 -62
- package/package.json +26 -17
- package/templates/generator/README.md +14 -0
- package/templates/generator/bin/index.ts +54 -5
- package/docs/guide/installer-env-vars.md +0 -252
package/binding/index.d.cts
CHANGED
|
@@ -7,6 +7,14 @@ type VoidNullable<T = void> = T | null | undefined | void;
|
|
|
7
7
|
export type BindingStringOrRegex = string | RegExp;
|
|
8
8
|
export type BindingResult<T> = { errors: BindingError[]; isBindingErrors: boolean } | T;
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Which binding artifact the generated loader actually loaded: `'native'` for
|
|
12
|
+
* a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
|
|
13
|
+
* flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
|
|
14
|
+
* can point the loader at a WASI artifact this package does not build itself.
|
|
15
|
+
*/
|
|
16
|
+
export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1';
|
|
17
|
+
|
|
10
18
|
export interface CodegenOptions {
|
|
11
19
|
/**
|
|
12
20
|
* Remove whitespace.
|
|
@@ -14,6 +22,24 @@ export interface CodegenOptions {
|
|
|
14
22
|
* @default true
|
|
15
23
|
*/
|
|
16
24
|
removeWhitespace?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Escape non-ASCII characters in string literals, untagged template literals, regular
|
|
27
|
+
* expression literals and identifier names.
|
|
28
|
+
*
|
|
29
|
+
* Uses `\uXXXX` for characters up to U+FFFF and `\u{...}` for higher code points.
|
|
30
|
+
* Regular expressions use escaped UTF-16 surrogate pairs for higher code points instead;
|
|
31
|
+
* escaping changes the observable `RegExp.prototype.source` value.
|
|
32
|
+
*
|
|
33
|
+
* Code point escapes (`\u{...}`) require ES2015 or later; this option does not provide
|
|
34
|
+
* ES5-compatible output.
|
|
35
|
+
*
|
|
36
|
+
* Non-ASCII characters are left unescaped in tagged template quasis (whose raw text is
|
|
37
|
+
* observable), JSX names and text, JSX attribute strings, hashbangs and preserved comments.
|
|
38
|
+
* JavaScript expressions inside tagged templates and JSX are escaped normally.
|
|
39
|
+
*
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
asciiOnly?: boolean;
|
|
17
43
|
/**
|
|
18
44
|
* How to handle legal comments (comments containing `@license`, `@preserve`, or starting with `//!`/`/*!`).
|
|
19
45
|
*
|
|
@@ -306,6 +332,7 @@ export interface TreeShakeOptions {
|
|
|
306
332
|
*/
|
|
307
333
|
invalidImportSideEffects?: boolean;
|
|
308
334
|
}
|
|
335
|
+
|
|
309
336
|
export interface Comment {
|
|
310
337
|
type: 'Line' | 'Block';
|
|
311
338
|
value: string;
|
|
@@ -332,6 +359,7 @@ export declare const enum Severity {
|
|
|
332
359
|
Warning = 'Warning',
|
|
333
360
|
Advice = 'Advice',
|
|
334
361
|
}
|
|
362
|
+
|
|
335
363
|
export declare class ParseResult {
|
|
336
364
|
get program(): import('@oxc-project/types').Program;
|
|
337
365
|
get module(): EcmaScriptModule;
|
|
@@ -610,6 +638,7 @@ export interface ValueSpan {
|
|
|
610
638
|
start: number;
|
|
611
639
|
end: number;
|
|
612
640
|
}
|
|
641
|
+
|
|
613
642
|
export declare class ResolverFactory {
|
|
614
643
|
constructor(options?: NapiResolveOptions | undefined | null);
|
|
615
644
|
static default(): ResolverFactory;
|
|
@@ -919,6 +948,7 @@ export interface TsconfigOptions {
|
|
|
919
948
|
*/
|
|
920
949
|
references?: 'auto';
|
|
921
950
|
}
|
|
951
|
+
|
|
922
952
|
export interface SourceMap {
|
|
923
953
|
file?: string;
|
|
924
954
|
mappings: string;
|
|
@@ -929,6 +959,7 @@ export interface SourceMap {
|
|
|
929
959
|
version: number;
|
|
930
960
|
x_google_ignoreList?: Array<number>;
|
|
931
961
|
}
|
|
962
|
+
|
|
932
963
|
export interface ArrowFunctionsOptions {
|
|
933
964
|
/**
|
|
934
965
|
* This option enables the following:
|
|
@@ -1604,6 +1635,7 @@ export interface TypeScriptOptions {
|
|
|
1604
1635
|
*/
|
|
1605
1636
|
rewriteImportExtensions?: 'rewrite' | 'remove' | boolean;
|
|
1606
1637
|
}
|
|
1638
|
+
|
|
1607
1639
|
export declare class BindingBundleEndEventData {
|
|
1608
1640
|
output: string;
|
|
1609
1641
|
duration: number;
|
|
@@ -2020,6 +2052,13 @@ export declare class TsconfigCache {
|
|
|
2020
2052
|
size(): number;
|
|
2021
2053
|
}
|
|
2022
2054
|
|
|
2055
|
+
/**
|
|
2056
|
+
* Panics on purpose. CI calls this to check that a published binding can produce a
|
|
2057
|
+
* symbolicated backtrace from its separately published debug info.
|
|
2058
|
+
* See `scripts/misc/verify-debuginfo.mjs` and internal-docs/panic-symbolication/implementation.md
|
|
2059
|
+
*/
|
|
2060
|
+
export declare function __internalForcePanic(): void;
|
|
2061
|
+
|
|
2023
2062
|
export interface AliasItem {
|
|
2024
2063
|
find: string;
|
|
2025
2064
|
replacements: Array<string | undefined | null>;
|
|
@@ -2098,6 +2137,7 @@ export interface BindingChecksOptions {
|
|
|
2098
2137
|
unresolvedEntry?: boolean;
|
|
2099
2138
|
unresolvedImport?: boolean;
|
|
2100
2139
|
filenameConflict?: boolean;
|
|
2140
|
+
moduleLevelDirective?: boolean;
|
|
2101
2141
|
commonJsVariableInEsm?: boolean;
|
|
2102
2142
|
importIsUndefined?: boolean;
|
|
2103
2143
|
emptyImportMeta?: boolean;
|
|
@@ -2180,6 +2220,7 @@ export interface BindingDevOptions {
|
|
|
2180
2220
|
onAdditionalAssets?: undefined | ((output: BindingOutputs) => void | Promise<void>);
|
|
2181
2221
|
rebuildStrategy?: BindingRebuildStrategy;
|
|
2182
2222
|
watch?: BindingDevWatchOptions;
|
|
2223
|
+
hotUpdate?: boolean;
|
|
2183
2224
|
}
|
|
2184
2225
|
|
|
2185
2226
|
export interface BindingDevtoolsOptions {
|
|
@@ -2705,6 +2746,7 @@ export interface BindingManualCodeSplittingOptions {
|
|
|
2705
2746
|
maxSize?: number;
|
|
2706
2747
|
minModuleSize?: number;
|
|
2707
2748
|
maxModuleSize?: number;
|
|
2749
|
+
internalInvalidateModuleInfoCache?: () => void;
|
|
2708
2750
|
}
|
|
2709
2751
|
|
|
2710
2752
|
export interface BindingMatchGroup {
|
|
@@ -3434,6 +3476,7 @@ export declare function startAsyncRuntime(): void;
|
|
|
3434
3476
|
export interface ViteImportGlobMeta {
|
|
3435
3477
|
isSubImportsPattern?: boolean;
|
|
3436
3478
|
}
|
|
3479
|
+
|
|
3437
3480
|
/** Error from batch import rewriting */
|
|
3438
3481
|
export interface BatchRewriteError {
|
|
3439
3482
|
/** The file path that had an error */
|
|
@@ -3456,6 +3499,8 @@ export interface BatchRewriteResult {
|
|
|
3456
3499
|
|
|
3457
3500
|
/** Configuration options passed from JavaScript to Rust. */
|
|
3458
3501
|
export interface CliOptions {
|
|
3502
|
+
/** The current JavaScript runtime (`process.execPath`). */
|
|
3503
|
+
nodeExecPath: string;
|
|
3459
3504
|
lint: (err: Error | null, arg: JsCommandContext) => Promise<JsCommandResolvedResult>;
|
|
3460
3505
|
fmt: (err: Error | null, arg: JsCommandContext) => Promise<JsCommandResolvedResult>;
|
|
3461
3506
|
vite: (err: Error | null, arg: JsCommandContext) => Promise<JsCommandResolvedResult>;
|
|
@@ -3754,6 +3799,12 @@ export interface PathAccess {
|
|
|
3754
3799
|
readDir: boolean;
|
|
3755
3800
|
}
|
|
3756
3801
|
|
|
3802
|
+
/** Remove a top-level key from a recognized Vite config object. */
|
|
3803
|
+
export declare function removeConfigKey(
|
|
3804
|
+
viteConfigPath: string,
|
|
3805
|
+
configKey: string,
|
|
3806
|
+
): MergeJsonConfigResult;
|
|
3807
|
+
|
|
3757
3808
|
/**
|
|
3758
3809
|
* Rewrite ESLint scripts: rename `eslint` → `vp lint` and strip ESLint-only flags.
|
|
3759
3810
|
*
|
|
@@ -3802,6 +3853,7 @@ export declare function rewriteEslint(scriptsJson: string): string | null;
|
|
|
3802
3853
|
export declare function rewriteImportsInDirectory(
|
|
3803
3854
|
root: string,
|
|
3804
3855
|
preserveVitestInNuxtPackages?: boolean | undefined | null,
|
|
3856
|
+
oxlintOwnerDirs?: Array<string> | undefined | null,
|
|
3805
3857
|
): BatchRewriteResult;
|
|
3806
3858
|
|
|
3807
3859
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as SETUP_VP_VERSION } from "./constants-
|
|
2
|
-
import { C as multiselect, S as log, T as select, k as isCancel } from "./prompts-
|
|
1
|
+
import { a as SETUP_VP_VERSION } from "./constants-C2dTOTe-.js";
|
|
2
|
+
import { C as multiselect, S as log, T as select, k as isCancel } from "./prompts-k14KgthC.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { styleText } from "node:util";
|
|
5
5
|
import fs from "node:fs";
|
package/dist/bin.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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-C2dTOTe-.js";
|
|
4
|
+
import { r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-BVqEe9KY.js";
|
|
5
5
|
import { t as resolveTsgolintExecutable } from "./tsgolint-path-CbDReEOx.js";
|
|
6
|
-
import { a as readNearestPackageJson } from "./package-
|
|
6
|
+
import { a as readNearestPackageJson } from "./package-CHH8jWan.js";
|
|
7
7
|
import { t as cac } from "./dist-DfmT__Aw.js";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
9
|
import path, { dirname, join, resolve } from "node:path";
|
|
@@ -1517,7 +1517,7 @@ async function applyToolInitConfigToViteConfig(command, args, projectPath = proc
|
|
|
1517
1517
|
}
|
|
1518
1518
|
if (spec.configKey === "lint" && hasTriggerFlag(args, ["--init"])) {
|
|
1519
1519
|
const lintInitConfigPath = path.join(projectPath, ".vite-plus-lint-init.oxlintrc.json");
|
|
1520
|
-
const { fixBaseUrlInTsconfig, hasBaseUrlInTsconfig } = await import("./tsconfig-
|
|
1520
|
+
const { fixBaseUrlInTsconfig, hasBaseUrlInTsconfig } = await import("./tsconfig-euB-GmIE.js");
|
|
1521
1521
|
await fixBaseUrlInTsconfig(projectPath);
|
|
1522
1522
|
const hasBaseUrl = hasBaseUrlInTsconfig(projectPath);
|
|
1523
1523
|
const initConfig = createDefaultVitePlusLintConfig({ includeTypeAwareDefaults: !hasBaseUrl });
|
|
@@ -1817,13 +1817,14 @@ else if (command === "hooks") await import("./hooks/bin.js");
|
|
|
1817
1817
|
else if (command === "--version" || command === "-V") await import("./version.js");
|
|
1818
1818
|
else if (command === "staged") await import("./staged/bin.js");
|
|
1819
1819
|
else try {
|
|
1820
|
-
const { resolveUniversalViteConfig } = await import("./resolve-vite-config-
|
|
1820
|
+
const { resolveUniversalViteConfig } = await import("./resolve-vite-config-CTOTuqTi.js");
|
|
1821
1821
|
const initInspection = inspectInitCommand(command, args.slice(1));
|
|
1822
1822
|
if (initInspection.handled && initInspection.configKey && initInspection.hasExistingConfigKey && initInspection.existingViteConfigPath) {
|
|
1823
1823
|
log(`Skipped initialization: '${accent(initInspection.configKey)}' already exists in '${accent(path.basename(initInspection.existingViteConfigPath))}'.`);
|
|
1824
1824
|
process.exit(0);
|
|
1825
1825
|
}
|
|
1826
1826
|
const exitCode = await run({
|
|
1827
|
+
nodeExecPath: process.execPath,
|
|
1827
1828
|
lint,
|
|
1828
1829
|
pack,
|
|
1829
1830
|
fmt,
|
package/dist/config/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as log, n as errorMsg } from "../terminal-MKGAuy-p.js";
|
|
2
|
-
import { i as promptGitHooks, n as defaultInteractive } from "../prompts-
|
|
3
|
-
import { o as updateExistingAgentInstructions } from "../agent-
|
|
2
|
+
import { i as promptGitHooks, n as defaultInteractive } from "../prompts-k14KgthC.js";
|
|
3
|
+
import { o as updateExistingAgentInstructions } from "../agent-Cu6-tXIP.js";
|
|
4
4
|
import { t as require_dist } from "../dist-BDYZP12R.js";
|
|
5
5
|
import { a as install, c as resolveHooksLocation, o as isGitHooksEnvDisabled, s as isHooksUserDisabled } from "../hooks-C-4gykWR.js";
|
|
6
6
|
import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
//#region package.json
|
|
3
|
-
var version = "0.3.
|
|
3
|
+
var version = "0.3.3";
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region src/utils/constants.ts
|
|
6
6
|
const VITE_PLUS_NAME = "vite-plus";
|
|
@@ -14,7 +14,7 @@ const VITE_CONFIG_FILES = [
|
|
|
14
14
|
"vite.config.cts"
|
|
15
15
|
];
|
|
16
16
|
const VITEST_VERSION = "4.1.11";
|
|
17
|
-
const SETUP_VP_VERSION = "v1.
|
|
17
|
+
const SETUP_VP_VERSION = "v1.20.0";
|
|
18
18
|
const TSDOWN_MIGRATION_SKILL_URL = "https://github.com/rolldown/tsdown/blob/main/skills/tsdown-migrate/SKILL.md";
|
|
19
19
|
const VITE_PLUS_OVERRIDE_PACKAGES = process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : {
|
|
20
20
|
vite: `npm:@voidzero-dev/vite-plus-core@${VITE_PLUS_VERSION}`,
|
package/dist/create/bin.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-CMFfr-1z.js";
|
|
2
2
|
import { t as renderCliDoc } from "../help-BmKpeOP9.js";
|
|
3
3
|
import { a as muted, i as log, o as printHeader, r as formatDuration, s as success, t as accent } from "../terminal-MKGAuy-p.js";
|
|
4
|
-
import { u as VITE_PLUS_NAME } from "../constants-
|
|
4
|
+
import { u as VITE_PLUS_NAME } from "../constants-C2dTOTe-.js";
|
|
5
5
|
import { i as readJsonFile, n as editJsonFile } from "../json-cULBl7Pi.js";
|
|
6
|
-
import { o as fetchNpmResource, r as getScopeFromPackageName, s as getNpmRegistry, t as checkNpmPackageExists } from "../package-
|
|
7
|
-
import { i as hasViteConfig, o as resolveViteConfig, r as findWorkspaceRoot, t as findViteConfig } from "../resolve-vite-config-
|
|
8
|
-
import { C as multiselect, D as text, E as spinner, O as require_picocolors, S as log$1, T as select, a as resolveGitInit, c as selectPackageManager, d as readYamlFile, h as resolveApproveBuildTargets, i as promptGitHooks, k as isCancel, m as detectGatedBuilds, n as defaultInteractive, o as runViteFmt, p as approveBuilds, r as downloadPackageManager$1, s as runViteInstall, t as cancelAndExit, u as editYamlFile, v as DependencyType, x as intro, y as PackageManager } from "../prompts-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
6
|
+
import { o as fetchNpmResource, r as getScopeFromPackageName, s as getNpmRegistry, t as checkNpmPackageExists } from "../package-CHH8jWan.js";
|
|
7
|
+
import { i as hasViteConfig, o as resolveViteConfig, r as findWorkspaceRoot, t as findViteConfig } from "../resolve-vite-config-BqvS2P98.js";
|
|
8
|
+
import { C as multiselect, D as text, E as spinner, O as require_picocolors, S as log$1, T as select, a as resolveGitInit, c as selectPackageManager, d as readYamlFile, h as resolveApproveBuildTargets, i as promptGitHooks, k as isCancel, m as detectGatedBuilds, n as defaultInteractive, o as runViteFmt, p as approveBuilds, r as downloadPackageManager$1, s as runViteInstall, t as cancelAndExit, u as editYamlFile, v as DependencyType, x as intro, y as PackageManager } from "../prompts-k14KgthC.js";
|
|
9
|
+
import { t as require_semver } from "../semver-CaDAb8vV.js";
|
|
10
|
+
import { a as selectAgentTargets, c as writeCopilotSetupWorkflow, d as templatesDir, l as displayRelative, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID } from "../agent-Cu6-tXIP.js";
|
|
11
|
+
import { F as addFrameworkShim, I as detectFramework, K as promptPrettierMigration, L as hasFrameworkShim, M as isBingoTemplate, N as updatePackageJsonWithDeps, P as updateWorkspaceConfig, Q as promptEslintMigration, S as injectCreateDefaultTemplate, V as promptTsupMigration, W as detectPrettierProject, Y as detectEslintProject, _ as installGitHooks, a as selectEditors, b as findGitRoot, c as rewriteMonorepoProject, h as setPackageManager, j as detectWorkspace$1, l as rewriteStandaloneProject, n as detectExistingEditors, o as writeEditorConfigs, s as rewriteMonorepo, x as initGitRepository, y as shouldSkipStagedMigrationForHooks, z as detectTsupProject } from "../editor-4sjlHmUh.js";
|
|
11
12
|
import { n as runCommandSilently, t as runCommand$1 } from "../command-CguLh2KL.js";
|
|
12
13
|
import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
|
|
13
14
|
import path from "node:path";
|
|
14
|
-
import { getVpDirs, parseCreateArgs, runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
|
|
15
|
+
import { getVpDirs, parseCreateArgs, removeConfigKey, runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
|
|
15
16
|
import { styleText } from "node:util";
|
|
16
17
|
import fs from "node:fs";
|
|
17
18
|
import os from "node:os";
|
|
@@ -96,6 +97,7 @@ function prependToPathToEnvs(extraPath, envs) {
|
|
|
96
97
|
}
|
|
97
98
|
//#endregion
|
|
98
99
|
//#region ../../node_modules/.pnpm/nanotar@0.3.0/node_modules/nanotar/dist/index.mjs
|
|
100
|
+
var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
|
|
99
101
|
const tarItemTypeMap = {
|
|
100
102
|
"0": "file",
|
|
101
103
|
"1": "hardLink",
|
|
@@ -263,10 +265,16 @@ function sanitizeHostForPath(host) {
|
|
|
263
265
|
* (via `.npmrc` scope mappings) don't share a cache slot. The registry
|
|
264
266
|
* guarantees `manifest.tarballUrl` is a valid URL, so any parse failure
|
|
265
267
|
* here is a real bug worth surfacing.
|
|
268
|
+
*
|
|
269
|
+
* Require a strict descendant of `cacheRoot` so sibling staging directories
|
|
270
|
+
* stay inside the cache, even if a caller skips `readOrgManifest` validation.
|
|
266
271
|
*/
|
|
267
|
-
function
|
|
272
|
+
function resolveExtractionDir(cacheRoot, manifest) {
|
|
268
273
|
const { host } = new URL(manifest.tarballUrl);
|
|
269
|
-
|
|
274
|
+
const resolvedRoot = path.resolve(cacheRoot);
|
|
275
|
+
const resolvedDir = path.resolve(resolvedRoot, sanitizeHostForPath(host), manifest.scope, "create", manifest.version);
|
|
276
|
+
if (!resolvedDir.startsWith(`${resolvedRoot}${path.sep}`)) throw new Error(`org template extraction path escapes the cache root: ${manifest.version}`);
|
|
277
|
+
return resolvedDir;
|
|
270
278
|
}
|
|
271
279
|
function parseIntegrity(integrity) {
|
|
272
280
|
const match = integrity.split(/\s+/)[0].match(/^(sha\d+)-(.+)$/);
|
|
@@ -446,7 +454,7 @@ async function cleanupStaleStagingDirs(destDir) {
|
|
|
446
454
|
* cleans up and returns the existing directory.
|
|
447
455
|
*/
|
|
448
456
|
async function ensureOrgPackageExtracted(manifest) {
|
|
449
|
-
const extractedRoot =
|
|
457
|
+
const extractedRoot = resolveExtractionDir(getCacheRoot(), manifest);
|
|
450
458
|
if (fs.existsSync(path.join(extractedRoot, "package.json"))) return extractedRoot;
|
|
451
459
|
const parent = path.dirname(extractedRoot);
|
|
452
460
|
await fs.promises.mkdir(parent, { recursive: true });
|
|
@@ -668,6 +676,7 @@ async function readOrgManifest(scope, requestedVersion) {
|
|
|
668
676
|
resolvedVersion = packument["dist-tags"]?.latest;
|
|
669
677
|
if (!resolvedVersion) return null;
|
|
670
678
|
}
|
|
679
|
+
if (import_semver.default.valid(resolvedVersion) === null) throw new OrgManifestSchemaError(`invalid version "${resolvedVersion}" (expected a semantic version)`, packageName);
|
|
671
680
|
const meta = packument.versions?.[resolvedVersion];
|
|
672
681
|
if (!meta) return null;
|
|
673
682
|
let templates = validateManifest(meta, packageName);
|
|
@@ -783,6 +792,7 @@ function discoverTemplate(templateName, templateArgs, workspaceInfo, interactive
|
|
|
783
792
|
if (isBingoTemplate(pkg)) {
|
|
784
793
|
type = TemplateType.bingo;
|
|
785
794
|
args.push("--skip-requests");
|
|
795
|
+
envs.VP_CREATE_INTERACTIVE = interactive === false ? "0" : "1";
|
|
786
796
|
}
|
|
787
797
|
return {
|
|
788
798
|
command: "node",
|
|
@@ -4466,64 +4476,6 @@ function autoFixRemoteTemplateCommand(templateInfo, workspaceInfo) {
|
|
|
4466
4476
|
}
|
|
4467
4477
|
}
|
|
4468
4478
|
//#endregion
|
|
4469
|
-
//#region src/create/templates/builtin.ts
|
|
4470
|
-
async function executeBuiltinTemplate(workspaceInfo, templateInfo, options) {
|
|
4471
|
-
assert(templateInfo.targetDir, "targetDir is required");
|
|
4472
|
-
assert(templateInfo.packageName, "packageName is required");
|
|
4473
|
-
if (templateInfo.command === BuiltinTemplate.generator) return await executeGeneratorScaffold(workspaceInfo, templateInfo, options);
|
|
4474
|
-
if (templateInfo.command === BuiltinTemplate.application) {
|
|
4475
|
-
templateInfo.command = "create-vite@latest";
|
|
4476
|
-
if (!templateInfo.interactive) templateInfo.args.push("--no-interactive");
|
|
4477
|
-
templateInfo.args.unshift(templateInfo.targetDir);
|
|
4478
|
-
} else if (templateInfo.command === BuiltinTemplate.library) {
|
|
4479
|
-
const libraryTemplateInfo = discoverTemplate(LibraryTemplateRepo, [templateInfo.targetDir], workspaceInfo);
|
|
4480
|
-
const result = await runRemoteTemplateCommand(workspaceInfo, workspaceInfo.rootDir, libraryTemplateInfo, false, options?.silent ?? false);
|
|
4481
|
-
if (result.exitCode !== 0) return { exitCode: result.exitCode };
|
|
4482
|
-
setPackageName(path.join(workspaceInfo.rootDir, templateInfo.targetDir), templateInfo.packageName);
|
|
4483
|
-
return {
|
|
4484
|
-
...result,
|
|
4485
|
-
projectDir: templateInfo.targetDir
|
|
4486
|
-
};
|
|
4487
|
-
}
|
|
4488
|
-
if (templateInfo.command.startsWith("vite:")) {
|
|
4489
|
-
if (!options?.silent) log$1.error(`Unknown builtin template "${templateInfo.command}". Run ${import_picocolors.default.yellow("vp create --list")} to see available templates.`);
|
|
4490
|
-
return { exitCode: 1 };
|
|
4491
|
-
}
|
|
4492
|
-
const result = await runRemoteTemplateCommand(workspaceInfo, workspaceInfo.rootDir, templateInfo, false, options?.silent ?? false);
|
|
4493
|
-
if (result.exitCode !== 0) return { exitCode: result.exitCode };
|
|
4494
|
-
setPackageName(path.join(workspaceInfo.rootDir, templateInfo.targetDir), templateInfo.packageName);
|
|
4495
|
-
return {
|
|
4496
|
-
...result,
|
|
4497
|
-
projectDir: templateInfo.targetDir
|
|
4498
|
-
};
|
|
4499
|
-
}
|
|
4500
|
-
//#endregion
|
|
4501
|
-
//#region src/create/templates/bundled.ts
|
|
4502
|
-
/**
|
|
4503
|
-
* Scaffold a bundled template by copying the pre-extracted directory at
|
|
4504
|
-
* `localPath` into `workspaceInfo.rootDir/targetDir`.
|
|
4505
|
-
*/
|
|
4506
|
-
async function executeBundledTemplate(workspaceInfo, templateInfo) {
|
|
4507
|
-
assert(templateInfo.localPath, "localPath is required for bundled templates");
|
|
4508
|
-
assert(templateInfo.targetDir, "targetDir is required");
|
|
4509
|
-
assert(templateInfo.packageName, "packageName is required");
|
|
4510
|
-
const destDir = path.join(workspaceInfo.rootDir, templateInfo.targetDir);
|
|
4511
|
-
try {
|
|
4512
|
-
copyDir(templateInfo.localPath, destDir);
|
|
4513
|
-
} catch (error) {
|
|
4514
|
-
if (error.code === "ENOENT") throw new Error(`bundled template directory not found: ${templateInfo.localPath}`, { cause: error });
|
|
4515
|
-
throw error;
|
|
4516
|
-
}
|
|
4517
|
-
renameFiles(destDir);
|
|
4518
|
-
try {
|
|
4519
|
-
setPackageName(destDir, templateInfo.packageName);
|
|
4520
|
-
} catch {}
|
|
4521
|
-
return {
|
|
4522
|
-
exitCode: 0,
|
|
4523
|
-
projectDir: templateInfo.targetDir
|
|
4524
|
-
};
|
|
4525
|
-
}
|
|
4526
|
-
//#endregion
|
|
4527
4479
|
//#region src/create/templates/monorepo.ts
|
|
4528
4480
|
const InitialMonorepoAppDir = "apps/website";
|
|
4529
4481
|
async function executeMonorepoTemplate(workspaceInfo, templateInfo, options) {
|
|
@@ -4593,6 +4545,7 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, options) {
|
|
|
4593
4545
|
const libraryPackageName = workspaceInfo.monorepoScope ? `${workspaceInfo.monorepoScope}/utils` : "utils";
|
|
4594
4546
|
const libraryProjectPath = path.join(fullPath, libraryDir);
|
|
4595
4547
|
setPackageName(libraryProjectPath, libraryPackageName);
|
|
4548
|
+
removeNestedLibraryToolConfig(libraryProjectPath);
|
|
4596
4549
|
rewriteMonorepoProject(libraryProjectPath, workspaceInfo.packageManager, void 0, options?.silent ?? false);
|
|
4597
4550
|
alignMonorepoTypeScriptVersion(fullPath, appProjectPath, libraryProjectPath);
|
|
4598
4551
|
return {
|
|
@@ -4601,6 +4554,22 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, options) {
|
|
|
4601
4554
|
};
|
|
4602
4555
|
}
|
|
4603
4556
|
/**
|
|
4557
|
+
* Remove the root-only lint and format options shipped by the standalone library template.
|
|
4558
|
+
*
|
|
4559
|
+
* The same remote template is also used by `vite:library`, where this config is
|
|
4560
|
+
* valid. A library created as a workspace member, however, gets its lint and
|
|
4561
|
+
* format config from the monorepo root, so retaining them here creates invalid
|
|
4562
|
+
* nested config.
|
|
4563
|
+
*/
|
|
4564
|
+
function removeNestedLibraryToolConfig(projectPath) {
|
|
4565
|
+
const configPath = path.join(projectPath, "vite.config.ts");
|
|
4566
|
+
if (!fs.existsSync(configPath)) return;
|
|
4567
|
+
for (const configKey of ["lint", "fmt"]) {
|
|
4568
|
+
const result = removeConfigKey(configPath, configKey);
|
|
4569
|
+
if (result.updated) fs.writeFileSync(configPath, result.content);
|
|
4570
|
+
}
|
|
4571
|
+
}
|
|
4572
|
+
/**
|
|
4604
4573
|
* Keep every scaffolded workspace member on the same TypeScript version.
|
|
4605
4574
|
*
|
|
4606
4575
|
* The app and library come from independently updated remote templates. If
|
|
@@ -4658,6 +4627,66 @@ function dropAliasedRuntimeDevDeps(appProjectPath, packageManager) {
|
|
|
4658
4627
|
});
|
|
4659
4628
|
}
|
|
4660
4629
|
//#endregion
|
|
4630
|
+
//#region src/create/templates/builtin.ts
|
|
4631
|
+
async function executeBuiltinTemplate(workspaceInfo, templateInfo, options) {
|
|
4632
|
+
assert(templateInfo.targetDir, "targetDir is required");
|
|
4633
|
+
assert(templateInfo.packageName, "packageName is required");
|
|
4634
|
+
if (templateInfo.command === BuiltinTemplate.generator) return await executeGeneratorScaffold(workspaceInfo, templateInfo, options);
|
|
4635
|
+
if (templateInfo.command === BuiltinTemplate.application) {
|
|
4636
|
+
templateInfo.command = "create-vite@latest";
|
|
4637
|
+
if (!templateInfo.interactive) templateInfo.args.push("--no-interactive");
|
|
4638
|
+
templateInfo.args.unshift(templateInfo.targetDir);
|
|
4639
|
+
} else if (templateInfo.command === BuiltinTemplate.library) {
|
|
4640
|
+
const libraryTemplateInfo = discoverTemplate(LibraryTemplateRepo, [templateInfo.targetDir], workspaceInfo);
|
|
4641
|
+
const result = await runRemoteTemplateCommand(workspaceInfo, workspaceInfo.rootDir, libraryTemplateInfo, false, options?.silent ?? false);
|
|
4642
|
+
if (result.exitCode !== 0) return { exitCode: result.exitCode };
|
|
4643
|
+
const fullPath = path.join(workspaceInfo.rootDir, templateInfo.targetDir);
|
|
4644
|
+
setPackageName(fullPath, templateInfo.packageName);
|
|
4645
|
+
if (workspaceInfo.isMonorepo) removeNestedLibraryToolConfig(fullPath);
|
|
4646
|
+
return {
|
|
4647
|
+
...result,
|
|
4648
|
+
projectDir: templateInfo.targetDir
|
|
4649
|
+
};
|
|
4650
|
+
}
|
|
4651
|
+
if (templateInfo.command.startsWith("vite:")) {
|
|
4652
|
+
if (!options?.silent) log$1.error(`Unknown builtin template "${templateInfo.command}". Run ${import_picocolors.default.yellow("vp create --list")} to see available templates.`);
|
|
4653
|
+
return { exitCode: 1 };
|
|
4654
|
+
}
|
|
4655
|
+
const result = await runRemoteTemplateCommand(workspaceInfo, workspaceInfo.rootDir, templateInfo, false, options?.silent ?? false);
|
|
4656
|
+
if (result.exitCode !== 0) return { exitCode: result.exitCode };
|
|
4657
|
+
setPackageName(path.join(workspaceInfo.rootDir, templateInfo.targetDir), templateInfo.packageName);
|
|
4658
|
+
return {
|
|
4659
|
+
...result,
|
|
4660
|
+
projectDir: templateInfo.targetDir
|
|
4661
|
+
};
|
|
4662
|
+
}
|
|
4663
|
+
//#endregion
|
|
4664
|
+
//#region src/create/templates/bundled.ts
|
|
4665
|
+
/**
|
|
4666
|
+
* Scaffold a bundled template by copying the pre-extracted directory at
|
|
4667
|
+
* `localPath` into `workspaceInfo.rootDir/targetDir`.
|
|
4668
|
+
*/
|
|
4669
|
+
async function executeBundledTemplate(workspaceInfo, templateInfo) {
|
|
4670
|
+
assert(templateInfo.localPath, "localPath is required for bundled templates");
|
|
4671
|
+
assert(templateInfo.targetDir, "targetDir is required");
|
|
4672
|
+
assert(templateInfo.packageName, "packageName is required");
|
|
4673
|
+
const destDir = path.join(workspaceInfo.rootDir, templateInfo.targetDir);
|
|
4674
|
+
try {
|
|
4675
|
+
copyDir(templateInfo.localPath, destDir);
|
|
4676
|
+
} catch (error) {
|
|
4677
|
+
if (error.code === "ENOENT") throw new Error(`bundled template directory not found: ${templateInfo.localPath}`, { cause: error });
|
|
4678
|
+
throw error;
|
|
4679
|
+
}
|
|
4680
|
+
renameFiles(destDir);
|
|
4681
|
+
try {
|
|
4682
|
+
setPackageName(destDir, templateInfo.packageName);
|
|
4683
|
+
} catch {}
|
|
4684
|
+
return {
|
|
4685
|
+
exitCode: 0,
|
|
4686
|
+
projectDir: templateInfo.targetDir
|
|
4687
|
+
};
|
|
4688
|
+
}
|
|
4689
|
+
//#endregion
|
|
4661
4690
|
//#region src/create/bin.ts
|
|
4662
4691
|
const listTemplatesMessage = renderCliDoc({
|
|
4663
4692
|
usage: "vp create --list",
|
|
@@ -37,7 +37,7 @@ let node_module = require("node:module");
|
|
|
37
37
|
let node_url = require("node:url");
|
|
38
38
|
let vitest_config = require("vitest/config");
|
|
39
39
|
//#region package.json
|
|
40
|
-
var version = "0.3.
|
|
40
|
+
var version = "0.3.3", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
|
|
41
41
|
var init_constants = __esmMin((() => {
|
|
42
42
|
VITE_PLUS_VERSION = process.env.VP_VERSION || version;
|
|
43
43
|
VITEST_VERSION = "4.1.11";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-
|
|
1
|
+
import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-C2dTOTe-.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { defineConfig, defineProject } from "vitest/config";
|
|
7
|
-
//#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@
|
|
7
|
+
//#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_298964156353ef75a02894ab80b3a2e6/node_modules/tsdown/esm-shims.js
|
|
8
8
|
const getFilename = () => fileURLToPath(import.meta.url);
|
|
9
9
|
const getDirname = () => path.dirname(getFilename());
|
|
10
10
|
const __dirname = /* @__PURE__ */ getDirname();
|
package/dist/define-config.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_define_config = require("./define-config-
|
|
2
|
+
const require_define_config = require("./define-config-D0mevyb3.cjs");
|
|
3
3
|
require_define_config.init_define_config();
|
|
4
4
|
exports.AUTO_INLINE_DEPS = require_define_config.AUTO_INLINE_DEPS;
|
|
5
5
|
exports.assertCoverageProviderVersionMatch = require_define_config.assertCoverageProviderVersionMatch;
|
package/dist/define-config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-
|
|
1
|
+
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-IgzmnvvV.js";
|
|
2
2
|
export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };
|