create-vue 3.20.0 → 3.21.0
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/bundle.js +123 -12
- package/locales/en-US.json +7 -0
- package/locales/fr-FR.json +7 -0
- package/locales/tr-TR.json +7 -0
- package/locales/zh-Hans.json +7 -0
- package/locales/zh-Hant.json +7 -0
- package/package.json +1 -1
- package/template/config/nightwatch/package.json +1 -1
- package/template/config/playwright/package.json +1 -1
- package/template/config/router/package.json +1 -1
- package/template/linting/core/js/package.json +1 -1
- package/template/linting/oxlint/{_oxlintrc.json → _oxlintrc.json.ejs} +1 -1
- package/template/linting/oxlint/eslint.config.js.data.mjs +1 -1
package/bundle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/*! create-vue v3.
|
|
2
|
+
/*! create-vue v3.21.0 | MIT */
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as fs from "node:fs";
|
|
5
5
|
import * as path$1 from "node:path";
|
|
@@ -2465,10 +2465,90 @@ function emptyRouterConfig(rootDir, needsTypeScript) {
|
|
|
2465
2465
|
replaceContent(path.resolve(srcDir, needsTypeScript ? "router/index.ts" : "router/index.js"), (content) => content.replace(`import HomeView from '../views/HomeView.vue'\n`, "").replace(/routes:\s*\[[\s\S]*?\],/, "routes: [],"));
|
|
2466
2466
|
}
|
|
2467
2467
|
|
|
2468
|
+
//#endregion
|
|
2469
|
+
//#region utils/applyVueBeta.ts
|
|
2470
|
+
const CORE_VUE_PACKAGES = [
|
|
2471
|
+
"vue",
|
|
2472
|
+
"@vue/compiler-core",
|
|
2473
|
+
"@vue/compiler-dom",
|
|
2474
|
+
"@vue/compiler-sfc",
|
|
2475
|
+
"@vue/compiler-ssr",
|
|
2476
|
+
"@vue/compiler-vapor",
|
|
2477
|
+
"@vue/reactivity",
|
|
2478
|
+
"@vue/runtime-core",
|
|
2479
|
+
"@vue/runtime-dom",
|
|
2480
|
+
"@vue/runtime-vapor",
|
|
2481
|
+
"@vue/server-renderer",
|
|
2482
|
+
"@vue/shared",
|
|
2483
|
+
"@vue/compat"
|
|
2484
|
+
];
|
|
2485
|
+
function generateOverridesMap() {
|
|
2486
|
+
return Object.fromEntries(CORE_VUE_PACKAGES.map((name) => [name, "beta"]));
|
|
2487
|
+
}
|
|
2488
|
+
/**
|
|
2489
|
+
* Apply Vue 3.6 beta overrides to the project based on the package manager.
|
|
2490
|
+
* Different package managers have different mechanisms for version overrides:
|
|
2491
|
+
* - npm/bun: uses `overrides` field in package.json
|
|
2492
|
+
* - yarn: uses `resolutions` field in package.json
|
|
2493
|
+
* - pnpm: uses `overrides` and `peerDependencyRules` in pnpm-workspace.yaml
|
|
2494
|
+
*/
|
|
2495
|
+
function applyVueBeta(root, packageManager, pkg) {
|
|
2496
|
+
const overrides = generateOverridesMap();
|
|
2497
|
+
if (packageManager === "npm" || packageManager === "bun") {
|
|
2498
|
+
pkg.overrides = {
|
|
2499
|
+
...pkg.overrides,
|
|
2500
|
+
...overrides
|
|
2501
|
+
};
|
|
2502
|
+
for (const dependencyName of CORE_VUE_PACKAGES) for (const dependencyType of [
|
|
2503
|
+
"dependencies",
|
|
2504
|
+
"devDependencies",
|
|
2505
|
+
"optionalDependencies"
|
|
2506
|
+
]) if (pkg[dependencyType]?.[dependencyName]) pkg[dependencyType][dependencyName] = overrides[dependencyName];
|
|
2507
|
+
} else if (packageManager === "yarn") pkg.resolutions = {
|
|
2508
|
+
...pkg.resolutions,
|
|
2509
|
+
...overrides
|
|
2510
|
+
};
|
|
2511
|
+
else if (packageManager === "pnpm") {
|
|
2512
|
+
const yamlContent = `overrides:
|
|
2513
|
+
${Object.entries(overrides).map(([key, value]) => ` '${key}': '${value}'`).join("\n")}
|
|
2514
|
+
|
|
2515
|
+
peerDependencyRules:
|
|
2516
|
+
allowAny:
|
|
2517
|
+
- 'vue'
|
|
2518
|
+
`;
|
|
2519
|
+
fs.writeFileSync(path$1.resolve(root, "pnpm-workspace.yaml"), yamlContent, "utf-8");
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2523
|
+
//#endregion
|
|
2524
|
+
//#region utils/packageManager.ts
|
|
2525
|
+
/**
|
|
2526
|
+
* Infers the package manager from the user agent string.
|
|
2527
|
+
* Falls back to npm if unable to detect.
|
|
2528
|
+
*/
|
|
2529
|
+
function inferPackageManager() {
|
|
2530
|
+
const userAgent = process.env.npm_config_user_agent ?? "";
|
|
2531
|
+
if (/pnpm/.test(userAgent)) return "pnpm";
|
|
2532
|
+
if (/yarn/.test(userAgent)) return "yarn";
|
|
2533
|
+
if (/bun/.test(userAgent)) return "bun";
|
|
2534
|
+
return "npm";
|
|
2535
|
+
}
|
|
2536
|
+
/**
|
|
2537
|
+
* Creates an ordered list of package managers with the preferred one first.
|
|
2538
|
+
*/
|
|
2539
|
+
function getPackageManagerOptions(preferred) {
|
|
2540
|
+
return [preferred, ...[
|
|
2541
|
+
"npm",
|
|
2542
|
+
"pnpm",
|
|
2543
|
+
"yarn",
|
|
2544
|
+
"bun"
|
|
2545
|
+
].filter((pm) => pm !== preferred)];
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2468
2548
|
//#endregion
|
|
2469
2549
|
//#region package.json
|
|
2470
2550
|
var name = "create-vue";
|
|
2471
|
-
var version = "3.
|
|
2551
|
+
var version = "3.21.0";
|
|
2472
2552
|
|
|
2473
2553
|
//#endregion
|
|
2474
2554
|
//#region index.ts
|
|
@@ -2491,7 +2571,8 @@ const FEATURE_FLAGS = [
|
|
|
2491
2571
|
"prettier",
|
|
2492
2572
|
"eslint-with-prettier",
|
|
2493
2573
|
"oxlint",
|
|
2494
|
-
"vite-beta"
|
|
2574
|
+
"vite-beta",
|
|
2575
|
+
"vue-beta"
|
|
2495
2576
|
];
|
|
2496
2577
|
const FEATURE_OPTIONS = [
|
|
2497
2578
|
{
|
|
@@ -2527,13 +2608,20 @@ const FEATURE_OPTIONS = [
|
|
|
2527
2608
|
label: language.needsPrettier.message
|
|
2528
2609
|
}
|
|
2529
2610
|
];
|
|
2530
|
-
const EXPERIMENTAL_FEATURE_OPTIONS = [
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2611
|
+
const EXPERIMENTAL_FEATURE_OPTIONS = [
|
|
2612
|
+
{
|
|
2613
|
+
value: "oxfmt",
|
|
2614
|
+
label: language.needsOxfmt.message
|
|
2615
|
+
},
|
|
2616
|
+
{
|
|
2617
|
+
value: "vite-beta",
|
|
2618
|
+
label: language.needsViteBeta.message
|
|
2619
|
+
},
|
|
2620
|
+
{
|
|
2621
|
+
value: "vue-beta",
|
|
2622
|
+
label: language.needsVueBeta.message
|
|
2623
|
+
}
|
|
2624
|
+
];
|
|
2537
2625
|
function isValidPackageName(projectName) {
|
|
2538
2626
|
return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName);
|
|
2539
2627
|
}
|
|
@@ -2607,6 +2695,8 @@ Available feature flags:
|
|
|
2607
2695
|
Add Oxfmt for code formatting.
|
|
2608
2696
|
--vite-beta
|
|
2609
2697
|
Use Vite 8 Beta instead of Vite for building the project.
|
|
2698
|
+
--vue-beta
|
|
2699
|
+
Use Vue 3.6 Beta. Requires specifying a package manager in interactive mode.
|
|
2610
2700
|
|
|
2611
2701
|
Unstable feature flags:
|
|
2612
2702
|
--tests, --with-tests
|
|
@@ -2649,6 +2739,7 @@ async function init() {
|
|
|
2649
2739
|
let targetDir = positionals[0];
|
|
2650
2740
|
const defaultProjectName = targetDir || "vue-project";
|
|
2651
2741
|
const forceOverwrite = argv.force;
|
|
2742
|
+
const inferredPackageManager = inferPackageManager();
|
|
2652
2743
|
const result = {
|
|
2653
2744
|
projectName: defaultProjectName,
|
|
2654
2745
|
shouldOverwrite: forceOverwrite,
|
|
@@ -2714,6 +2805,16 @@ async function init() {
|
|
|
2714
2805
|
options: EXPERIMENTAL_FEATURE_OPTIONS,
|
|
2715
2806
|
required: false
|
|
2716
2807
|
}));
|
|
2808
|
+
if (result.experimentFeatures.includes("vue-beta")) {
|
|
2809
|
+
const packageManagerOptions = getPackageManagerOptions(inferredPackageManager).map((pm) => ({
|
|
2810
|
+
value: pm,
|
|
2811
|
+
label: pm
|
|
2812
|
+
}));
|
|
2813
|
+
result.packageManager = await unwrapPrompt(ve({
|
|
2814
|
+
message: `${language.packageManagerSelection.message} ${(0, import_picocolors.dim)(language.packageManagerSelection.hint)}`,
|
|
2815
|
+
options: packageManagerOptions
|
|
2816
|
+
}));
|
|
2817
|
+
}
|
|
2717
2818
|
}
|
|
2718
2819
|
if (argv.bare) result.needsBareboneTemplates = true;
|
|
2719
2820
|
else if (!isFeatureFlagsUsed) result.needsBareboneTemplates = await unwrapPrompt(ye({
|
|
@@ -2730,6 +2831,7 @@ async function init() {
|
|
|
2730
2831
|
const needsPrettier = argv.prettier || argv["eslint-with-prettier"] || features.includes("prettier");
|
|
2731
2832
|
const needsOxfmt = experimentFeatures.includes("oxfmt") || argv["oxfmt"];
|
|
2732
2833
|
const needsViteBeta = experimentFeatures.includes("vite-beta") || argv["vite-beta"] || argv["rolldown-vite"];
|
|
2834
|
+
const needsVueBeta = experimentFeatures.includes("vue-beta") || argv["vue-beta"];
|
|
2733
2835
|
const { e2eFramework } = result;
|
|
2734
2836
|
const needsCypress = argv.cypress || argv.tests || e2eFramework === "cypress";
|
|
2735
2837
|
const needsCypressCT = needsCypress && !needsVitest;
|
|
@@ -2802,6 +2904,10 @@ async function init() {
|
|
|
2802
2904
|
if (needsPlaywright) render("linting/playwright");
|
|
2803
2905
|
if (needsVitest) render("linting/vitest");
|
|
2804
2906
|
render("linting/oxlint");
|
|
2907
|
+
callbacks.push(async (dataStore) => {
|
|
2908
|
+
const oxlintrcPath = path$1.resolve(root, ".oxlintrc.json");
|
|
2909
|
+
dataStore[oxlintrcPath] = { needsTypeScript };
|
|
2910
|
+
});
|
|
2805
2911
|
if (needsPrettier || needsOxfmt) render("linting/formatter");
|
|
2806
2912
|
}
|
|
2807
2913
|
if (needsOxfmt) render("formatting/oxfmt");
|
|
@@ -2849,8 +2955,13 @@ async function init() {
|
|
|
2849
2955
|
removeCSSImport(root, needsTypeScript, needsCypressCT);
|
|
2850
2956
|
if (needsRouter) emptyRouterConfig(root, needsTypeScript);
|
|
2851
2957
|
}
|
|
2852
|
-
const
|
|
2853
|
-
|
|
2958
|
+
const packageManager = result.packageManager ?? inferredPackageManager;
|
|
2959
|
+
if (needsVueBeta) {
|
|
2960
|
+
const pkgPath = path$1.resolve(root, "package.json");
|
|
2961
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
2962
|
+
applyVueBeta(root, packageManager, pkg);
|
|
2963
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
2964
|
+
}
|
|
2854
2965
|
fs.writeFileSync(path$1.resolve(root, "README.md"), generateReadme({
|
|
2855
2966
|
projectName: result.projectName ?? result.packageName ?? defaultProjectName,
|
|
2856
2967
|
packageManager,
|
package/locales/en-US.json
CHANGED
|
@@ -69,12 +69,19 @@
|
|
|
69
69
|
"needsViteBeta": {
|
|
70
70
|
"message": "Vite 8 (beta)"
|
|
71
71
|
},
|
|
72
|
+
"needsVueBeta": {
|
|
73
|
+
"message": "Vue 3.6 (beta)"
|
|
74
|
+
},
|
|
72
75
|
"needsOxfmt": {
|
|
73
76
|
"message": "Replace Prettier with Oxfmt"
|
|
74
77
|
},
|
|
75
78
|
"needsBareboneTemplates": {
|
|
76
79
|
"message": "Skip all example code and start with a blank Vue project?"
|
|
77
80
|
},
|
|
81
|
+
"packageManagerSelection": {
|
|
82
|
+
"message": "Which package manager will you use?",
|
|
83
|
+
"hint": "(Vue 3.6 beta requires version overrides that differ per package manager)"
|
|
84
|
+
},
|
|
78
85
|
"errors": {
|
|
79
86
|
"operationCancelled": "Operation cancelled"
|
|
80
87
|
},
|
package/locales/fr-FR.json
CHANGED
|
@@ -69,12 +69,19 @@
|
|
|
69
69
|
"needsViteBeta": {
|
|
70
70
|
"message": "Vite 8 (beta)"
|
|
71
71
|
},
|
|
72
|
+
"needsVueBeta": {
|
|
73
|
+
"message": "Vue 3.6 (beta)"
|
|
74
|
+
},
|
|
72
75
|
"needsOxfmt": {
|
|
73
76
|
"message": "Remplacer Prettier par Oxfmt"
|
|
74
77
|
},
|
|
75
78
|
"needsBareboneTemplates": {
|
|
76
79
|
"message": "Ignorer tout le code d'exemple et commencer avec un projet Vue vierge\u00a0?"
|
|
77
80
|
},
|
|
81
|
+
"packageManagerSelection": {
|
|
82
|
+
"message": "Quel gestionnaire de paquets allez-vous utiliser\u00a0?",
|
|
83
|
+
"hint": "(Vue 3.6 beta nécessite des surcharges de version spécifiques au gestionnaire de paquets)"
|
|
84
|
+
},
|
|
78
85
|
"errors": {
|
|
79
86
|
"operationCancelled": "Operation annulée"
|
|
80
87
|
},
|
package/locales/tr-TR.json
CHANGED
|
@@ -69,12 +69,19 @@
|
|
|
69
69
|
"needsViteBeta": {
|
|
70
70
|
"message": "Vite 8 (beta)"
|
|
71
71
|
},
|
|
72
|
+
"needsVueBeta": {
|
|
73
|
+
"message": "Vue 3.6 (beta)"
|
|
74
|
+
},
|
|
72
75
|
"needsOxfmt": {
|
|
73
76
|
"message": "Prettier'ı Oxfmt ile değiştir"
|
|
74
77
|
},
|
|
75
78
|
"needsBareboneTemplates": {
|
|
76
79
|
"message": "Tüm örnek kodları atlayıp boş bir Vue projesi ile başlansın mı?"
|
|
77
80
|
},
|
|
81
|
+
"packageManagerSelection": {
|
|
82
|
+
"message": "Hangi paket yöneticisini kullanacaksınız?",
|
|
83
|
+
"hint": "(Vue 3.6 beta, paket yöneticisine özgü sürüm geçersiz kılmaları gerektirir)"
|
|
84
|
+
},
|
|
78
85
|
"errors": {
|
|
79
86
|
"operationCancelled": "İşlem iptal edildi"
|
|
80
87
|
},
|
package/locales/zh-Hans.json
CHANGED
|
@@ -69,12 +69,19 @@
|
|
|
69
69
|
"needsViteBeta": {
|
|
70
70
|
"message": "Vite 8(测试版)"
|
|
71
71
|
},
|
|
72
|
+
"needsVueBeta": {
|
|
73
|
+
"message": "Vue 3.6(测试版)"
|
|
74
|
+
},
|
|
72
75
|
"needsOxfmt": {
|
|
73
76
|
"message": "使用 Oxfmt 替代 Prettier"
|
|
74
77
|
},
|
|
75
78
|
"needsBareboneTemplates": {
|
|
76
79
|
"message": "跳过所有示例代码,创建一个空白的 Vue 项目?"
|
|
77
80
|
},
|
|
81
|
+
"packageManagerSelection": {
|
|
82
|
+
"message": "项目将使用哪个包管理器?",
|
|
83
|
+
"hint": "(需要根据包管理器生成对应的 Vue 3.6 测试版配置)"
|
|
84
|
+
},
|
|
78
85
|
"errors": {
|
|
79
86
|
"operationCancelled": "操作取消"
|
|
80
87
|
},
|
package/locales/zh-Hant.json
CHANGED
|
@@ -69,12 +69,19 @@
|
|
|
69
69
|
"needsViteBeta": {
|
|
70
70
|
"message": "Vite 8(測試版)"
|
|
71
71
|
},
|
|
72
|
+
"needsVueBeta": {
|
|
73
|
+
"message": "Vue 3.6(測試版)"
|
|
74
|
+
},
|
|
72
75
|
"needsOxfmt": {
|
|
73
76
|
"message": "使用 Oxfmt 替代 Prettier"
|
|
74
77
|
},
|
|
75
78
|
"needsBareboneTemplates": {
|
|
76
79
|
"message": "跳過所有範例程式碼,建立一個空白的 Vue 專案?"
|
|
77
80
|
},
|
|
81
|
+
"packageManagerSelection": {
|
|
82
|
+
"message": "專案將使用哪個套件管理器?",
|
|
83
|
+
"hint": "(需要根據套件管理器生成對應的 Vue 3.6 測試版配置)"
|
|
84
|
+
},
|
|
78
85
|
"errors": {
|
|
79
86
|
"operationCancelled": "操作取消"
|
|
80
87
|
},
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ export default function getData({ oldData }) {
|
|
|
5
5
|
...oldData.configs,
|
|
6
6
|
{
|
|
7
7
|
importer: `import pluginOxlint from 'eslint-plugin-oxlint'`,
|
|
8
|
-
content: `\n ...pluginOxlint.
|
|
8
|
+
content: `\n ...pluginOxlint.buildFromOxlintConfigFile('.oxlintrc.json'),`,
|
|
9
9
|
},
|
|
10
10
|
],
|
|
11
11
|
}
|