create-vuetify 2.5.1 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +63 -50
- package/package.json +2 -2
- package/template/javascript/base/eslint.config.js +3 -1
- package/template/javascript/base/package.json +1 -1
- package/template/javascript/base/src/router/index.js +3 -3
- package/template/javascript/base/vite.config.mjs +3 -3
- package/template/javascript/default/package.json +1 -1
- package/template/javascript/default/vite.config.mjs +2 -2
- package/template/javascript/essentials/src/router/index.js +3 -3
- package/template/javascript/essentials/vite.config.mjs +2 -2
- package/template/typescript/base/eslint.config.js +3 -1
- package/template/typescript/base/package.json +1 -1
- package/template/typescript/base/src/router/index.ts +3 -3
- package/template/typescript/base/vite.config.mts +3 -3
- package/template/typescript/default/vite.config.mts +1 -1
- package/template/typescript/essentials/src/router/index.ts +3 -3
- package/template/typescript/essentials/vite.config.mts +2 -2
- package/template/typescript/nuxt/modules/vuetify.ts +21 -25
- package/template/typescript/nuxt/plugins/vuetify.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { dirname as dirname3, join as join3, resolve as resolve5 } from "path";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { mkdirSync as mkdirSync2, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
2
|
+
import { dirname as dirname3, join as join3, resolve as resolve5 } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { mkdirSync as mkdirSync2, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
5
5
|
|
|
6
6
|
// src/utils/prompts.ts
|
|
7
|
-
import { join as join2, resolve as resolve3 } from "path";
|
|
8
|
-
import { existsSync as existsSync2, readdirSync } from "fs";
|
|
7
|
+
import { join as join2, resolve as resolve3 } from "node:path";
|
|
8
|
+
import { existsSync as existsSync2, readdirSync } from "node:fs";
|
|
9
9
|
|
|
10
10
|
// src/utils/presets.ts
|
|
11
11
|
var defaultContext = {
|
|
@@ -1475,13 +1475,17 @@ async function pnpmIgnored(root) {
|
|
|
1475
1475
|
const [major] = pnpmVersion.split(".").map(Number);
|
|
1476
1476
|
if (major && major >= 10) {
|
|
1477
1477
|
const detect2 = (await ve2("pnpm", ["ignored-builds"], { nodeOptions: { cwd: root } })).stdout;
|
|
1478
|
-
if (detect2.startsWith("Automatically ignored builds during installation:\n None"))
|
|
1478
|
+
if (detect2.startsWith("Automatically ignored builds during installation:\n None")) {
|
|
1479
|
+
return;
|
|
1480
|
+
}
|
|
1479
1481
|
return detect2;
|
|
1480
1482
|
}
|
|
1481
1483
|
}
|
|
1482
1484
|
async function pnpm(root) {
|
|
1483
1485
|
const detect2 = await pnpmIgnored(root);
|
|
1484
|
-
if (detect2)
|
|
1486
|
+
if (detect2) {
|
|
1487
|
+
console.warn(detect2);
|
|
1488
|
+
}
|
|
1485
1489
|
}
|
|
1486
1490
|
|
|
1487
1491
|
// src/utils/cli/preinstall/yarn.ts
|
|
@@ -1533,14 +1537,13 @@ var promptOptions = {
|
|
|
1533
1537
|
}
|
|
1534
1538
|
};
|
|
1535
1539
|
var initPrompts = async (context) => {
|
|
1536
|
-
let answers;
|
|
1537
1540
|
if (context.usePreset) {
|
|
1538
1541
|
context = {
|
|
1539
1542
|
...context,
|
|
1540
1543
|
...presets[context.usePreset]
|
|
1541
1544
|
};
|
|
1542
1545
|
}
|
|
1543
|
-
answers = await prompts([
|
|
1546
|
+
const answers = await prompts([
|
|
1544
1547
|
{
|
|
1545
1548
|
name: "projectName",
|
|
1546
1549
|
type: "text",
|
|
@@ -1684,15 +1687,15 @@ import { red as red2 } from "kolorist";
|
|
|
1684
1687
|
import minimist from "minimist";
|
|
1685
1688
|
|
|
1686
1689
|
// src/utils/renderTemplate.ts
|
|
1687
|
-
import { copyFileSync, mkdirSync, readdirSync as readdirSync2, readFileSync, statSync, writeFileSync } from "fs";
|
|
1688
|
-
import { basename as basename2, dirname as dirname2, resolve as resolve4 } from "path";
|
|
1690
|
+
import { copyFileSync, mkdirSync, readdirSync as readdirSync2, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
1691
|
+
import { basename as basename2, dirname as dirname2, resolve as resolve4 } from "node:path";
|
|
1689
1692
|
|
|
1690
1693
|
// src/utils/deepMerge.ts
|
|
1691
1694
|
var isObject = (v) => {
|
|
1692
1695
|
return v === Object(v) && v !== null && !Array.isArray(v);
|
|
1693
1696
|
};
|
|
1694
1697
|
var deepMerge = (...sources) => sources.reduce((acc, curr) => {
|
|
1695
|
-
Object.keys(curr)
|
|
1698
|
+
for (const key of Object.keys(curr)) {
|
|
1696
1699
|
if (Array.isArray(acc[key]) && Array.isArray(curr[key])) {
|
|
1697
1700
|
acc[key] = Array.from(new Set(acc[key].concat(curr[key])));
|
|
1698
1701
|
} else if (isObject(acc[key]) && isObject(curr[key])) {
|
|
@@ -1700,7 +1703,7 @@ var deepMerge = (...sources) => sources.reduce((acc, curr) => {
|
|
|
1700
1703
|
} else {
|
|
1701
1704
|
acc[key] = curr[key];
|
|
1702
1705
|
}
|
|
1703
|
-
}
|
|
1706
|
+
}
|
|
1704
1707
|
return acc;
|
|
1705
1708
|
}, {});
|
|
1706
1709
|
|
|
@@ -1710,20 +1713,27 @@ function mergePkg(source, destination) {
|
|
|
1710
1713
|
const src = JSON.parse(readFileSync(source, "utf8"));
|
|
1711
1714
|
const mergedPkg = deepMerge(target, src);
|
|
1712
1715
|
const keysToSort = ["devDependencies", "dependencies"];
|
|
1713
|
-
|
|
1716
|
+
for (const k of keysToSort) {
|
|
1714
1717
|
mergedPkg[k] = Object.keys(mergedPkg[k]).sort().reduce((a, c) => (a[c] = mergedPkg[k][c], a), {});
|
|
1715
|
-
}
|
|
1718
|
+
}
|
|
1716
1719
|
writeFileSync(destination, JSON.stringify(mergedPkg, null, 2) + "\n");
|
|
1717
1720
|
}
|
|
1718
1721
|
function renderDirectory(source, destination) {
|
|
1719
1722
|
mkdirSync(destination, { recursive: true });
|
|
1720
|
-
|
|
1723
|
+
for (const path4 of readdirSync2(source)) {
|
|
1724
|
+
renderTemplate(resolve4(source, path4), resolve4(destination, path4));
|
|
1725
|
+
}
|
|
1721
1726
|
}
|
|
1722
1727
|
function renderFile(source, destination) {
|
|
1723
1728
|
const filename = basename2(source);
|
|
1724
|
-
if (filename.startsWith("_"))
|
|
1725
|
-
|
|
1726
|
-
|
|
1729
|
+
if (filename.startsWith("_")) {
|
|
1730
|
+
destination = resolve4(dirname2(destination), filename.replace("_", "."));
|
|
1731
|
+
}
|
|
1732
|
+
if (filename === "package.json") {
|
|
1733
|
+
mergePkg(source, destination);
|
|
1734
|
+
} else {
|
|
1735
|
+
copyFileSync(source, destination);
|
|
1736
|
+
}
|
|
1727
1737
|
}
|
|
1728
1738
|
function renderTemplate(source, destination) {
|
|
1729
1739
|
if (statSync(source).isDirectory()) {
|
|
@@ -1734,15 +1744,15 @@ function renderTemplate(source, destination) {
|
|
|
1734
1744
|
}
|
|
1735
1745
|
|
|
1736
1746
|
// src/utils/nuxt/renderNuxtTemplate.ts
|
|
1737
|
-
import fs3 from "fs";
|
|
1738
|
-
import path3 from "path";
|
|
1739
|
-
import { spawnSync as spawnSync2 } from "child_process";
|
|
1747
|
+
import fs3 from "node:fs";
|
|
1748
|
+
import path3 from "node:path";
|
|
1749
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
1740
1750
|
|
|
1741
1751
|
// src/utils/nuxt/utils.ts
|
|
1742
|
-
import process2 from "process";
|
|
1743
|
-
import path from "path";
|
|
1744
|
-
import { spawnSync } from "child_process";
|
|
1745
|
-
import fs from "fs";
|
|
1752
|
+
import process2 from "node:process";
|
|
1753
|
+
import path from "node:path";
|
|
1754
|
+
import { spawnSync } from "node:child_process";
|
|
1755
|
+
import fs from "node:fs";
|
|
1746
1756
|
|
|
1747
1757
|
// node_modules/.pnpm/package-manager-detector@1.2.0/node_modules/package-manager-detector/dist/commands.mjs
|
|
1748
1758
|
function npmRun(agent) {
|
|
@@ -1874,8 +1884,9 @@ function constructCommand(value, args) {
|
|
|
1874
1884
|
// src/utils/nuxt/utils.ts
|
|
1875
1885
|
function detectPkgInfo() {
|
|
1876
1886
|
const userAgent2 = process2.env.npm_config_user_agent;
|
|
1877
|
-
if (!userAgent2)
|
|
1887
|
+
if (!userAgent2) {
|
|
1878
1888
|
return void 0;
|
|
1889
|
+
}
|
|
1879
1890
|
const pkgSpec = userAgent2.split(" ")[0];
|
|
1880
1891
|
const pkgSpecArr = pkgSpec.split("/");
|
|
1881
1892
|
return {
|
|
@@ -1886,18 +1897,19 @@ function detectPkgInfo() {
|
|
|
1886
1897
|
function addPackageObject(key, entry, pkg, sort = true) {
|
|
1887
1898
|
pkg[key] ??= {};
|
|
1888
1899
|
if (!sort) {
|
|
1889
|
-
for (const [name, value] of entry)
|
|
1900
|
+
for (const [name, value] of entry) {
|
|
1890
1901
|
pkg[key][name] = value;
|
|
1902
|
+
}
|
|
1891
1903
|
return;
|
|
1892
1904
|
}
|
|
1893
1905
|
const entries = Object.entries(pkg[key]);
|
|
1894
1906
|
pkg[key] = {};
|
|
1895
|
-
|
|
1907
|
+
for (const [name, value] of entry) {
|
|
1896
1908
|
entries.push([name, value]);
|
|
1897
|
-
}
|
|
1898
|
-
entries.sort(([a], [b]) => a.localeCompare(b))
|
|
1909
|
+
}
|
|
1910
|
+
for (const [k, v] of entries.sort(([a], [b]) => a.localeCompare(b))) {
|
|
1899
1911
|
pkg[key][k] = v;
|
|
1900
|
-
}
|
|
1912
|
+
}
|
|
1901
1913
|
}
|
|
1902
1914
|
function runCommand(pmDetection, command, args, cwd2) {
|
|
1903
1915
|
let runCommand2 = "npm";
|
|
@@ -1921,8 +1933,8 @@ function runCommand(pmDetection, command, args, cwd2) {
|
|
|
1921
1933
|
}
|
|
1922
1934
|
}
|
|
1923
1935
|
function editFile(file, callback, destination) {
|
|
1924
|
-
const content = fs.readFileSync(file, "
|
|
1925
|
-
fs.writeFileSync(destination ?? file, callback(content), "
|
|
1936
|
+
const content = fs.readFileSync(file, "utf8");
|
|
1937
|
+
fs.writeFileSync(destination ?? file, callback(content), "utf8");
|
|
1926
1938
|
}
|
|
1927
1939
|
function getPaths(rootPath, templateDir, v4) {
|
|
1928
1940
|
return v4 ? [path.join(rootPath, "app"), templateDir] : [rootPath, templateDir];
|
|
@@ -2103,12 +2115,15 @@ async function renderNuxtTemplate(ctx) {
|
|
|
2103
2115
|
const isYarn1 = pkgManager === "yarn" && pkgInfo?.version.startsWith("1.");
|
|
2104
2116
|
const customCommand = useNuxtV4Compat ? `npx nuxi@latest init -t v4-compat ${projectName}` : `npm exec nuxi init ${projectName}`;
|
|
2105
2117
|
const fullCustomCommand = customCommand.replace("@latest", () => isYarn1 ? "" : "@latest").replace(/^npm exec/, () => {
|
|
2106
|
-
if (pkgManager === "pnpm")
|
|
2118
|
+
if (pkgManager === "pnpm") {
|
|
2107
2119
|
return "pnpm dlx";
|
|
2108
|
-
|
|
2120
|
+
}
|
|
2121
|
+
if (pkgManager === "yarn" && !isYarn1) {
|
|
2109
2122
|
return "yarn dlx";
|
|
2110
|
-
|
|
2123
|
+
}
|
|
2124
|
+
if (pkgManager === "bun") {
|
|
2111
2125
|
return "bun x";
|
|
2126
|
+
}
|
|
2112
2127
|
return "npm exec";
|
|
2113
2128
|
});
|
|
2114
2129
|
const [command, ...args] = fullCustomCommand.split(" ");
|
|
@@ -2135,7 +2150,7 @@ function configurePackageJson({
|
|
|
2135
2150
|
nuxtPreset
|
|
2136
2151
|
}) {
|
|
2137
2152
|
const packageJson = path3.join(projectRoot, "package.json");
|
|
2138
|
-
const pkg = JSON.parse(fs3.readFileSync(path3.join(projectRoot, "package.json"), "
|
|
2153
|
+
const pkg = JSON.parse(fs3.readFileSync(path3.join(projectRoot, "package.json"), "utf8"));
|
|
2139
2154
|
pkg.name = projectName;
|
|
2140
2155
|
const scripts = [
|
|
2141
2156
|
["prepare", "nuxt prepare"],
|
|
@@ -2148,7 +2163,7 @@ function configurePackageJson({
|
|
|
2148
2163
|
const dependencies = [
|
|
2149
2164
|
["vuetify", versions.vuetify]
|
|
2150
2165
|
];
|
|
2151
|
-
if (dependencies.length) {
|
|
2166
|
+
if (dependencies.length > 0) {
|
|
2152
2167
|
addPackageObject("dependencies", dependencies, pkg);
|
|
2153
2168
|
}
|
|
2154
2169
|
const devDependencies = [
|
|
@@ -2165,11 +2180,11 @@ function configurePackageJson({
|
|
|
2165
2180
|
devDependencies.push(["@vuetify/loader-shared", versions["@vuetify/loader-shared"]]);
|
|
2166
2181
|
devDependencies.push(["vite-plugin-vuetify", versions["vite-plugin-vuetify"]]);
|
|
2167
2182
|
}
|
|
2168
|
-
if (devDependencies.length) {
|
|
2183
|
+
if (devDependencies.length > 0) {
|
|
2169
2184
|
addPackageObject("devDependencies", devDependencies, pkg);
|
|
2170
2185
|
}
|
|
2171
2186
|
addPackageObject("scripts", scripts, pkg, false);
|
|
2172
|
-
fs3.writeFileSync(packageJson, JSON.stringify(pkg, null, 2), "
|
|
2187
|
+
fs3.writeFileSync(packageJson, JSON.stringify(pkg, null, 2), "utf8");
|
|
2173
2188
|
}
|
|
2174
2189
|
function configureVuetify(ctx, nuxtConfig) {
|
|
2175
2190
|
const config = getDefaultExportOptions(nuxtConfig);
|
|
@@ -2302,9 +2317,9 @@ function prepareNuxtModule(ctx, nuxtConfig) {
|
|
|
2302
2317
|
}
|
|
2303
2318
|
function prepareVuetifyModule(ctx, nuxtConfig) {
|
|
2304
2319
|
const config = configureVuetify(ctx, nuxtConfig);
|
|
2305
|
-
const styles = ctx.nuxtPreset
|
|
2320
|
+
const styles = ctx.nuxtPreset === "nuxt-essentials" ? {
|
|
2306
2321
|
configFile: "assets/settings.scss"
|
|
2307
|
-
};
|
|
2322
|
+
} : true;
|
|
2308
2323
|
config.vuetify = { autoImport: true, styles };
|
|
2309
2324
|
}
|
|
2310
2325
|
function prepareProject(ctx) {
|
|
@@ -2316,7 +2331,7 @@ function prepareProject(ctx) {
|
|
|
2316
2331
|
} = ctx;
|
|
2317
2332
|
const [rootPath, templateDir] = getPaths(projectRoot, templatePath, useNuxtV4Compat);
|
|
2318
2333
|
const nuxtConfigFile = path3.join(rootPath, useNuxtV4Compat ? "../nuxt.config.ts" : "nuxt.config.ts");
|
|
2319
|
-
const nuxtConfig = parseModule(fs3.readFileSync(nuxtConfigFile, "
|
|
2334
|
+
const nuxtConfig = parseModule(fs3.readFileSync(nuxtConfigFile, "utf8"));
|
|
2320
2335
|
if (useNuxtModule) {
|
|
2321
2336
|
prepareNuxtModule(ctx, nuxtConfig);
|
|
2322
2337
|
} else {
|
|
@@ -2351,7 +2366,7 @@ function prepareProject(ctx) {
|
|
|
2351
2366
|
fs3.writeFileSync(
|
|
2352
2367
|
nuxtConfigFile,
|
|
2353
2368
|
code,
|
|
2354
|
-
"
|
|
2369
|
+
"utf8"
|
|
2355
2370
|
);
|
|
2356
2371
|
copyResources(ctx, rootPath, templateDir);
|
|
2357
2372
|
}
|
|
@@ -2361,7 +2376,7 @@ var validPresets = ["base", "custom", "default", "essentials"];
|
|
|
2361
2376
|
async function run() {
|
|
2362
2377
|
const argv = minimist(process.argv.slice(2), {
|
|
2363
2378
|
alias: {
|
|
2364
|
-
|
|
2379
|
+
typescript: ["ts"]
|
|
2365
2380
|
}
|
|
2366
2381
|
});
|
|
2367
2382
|
if (argv.preset && !validPresets.includes(argv.preset)) {
|
|
@@ -2389,8 +2404,6 @@ ${banner}
|
|
|
2389
2404
|
usePackageManager,
|
|
2390
2405
|
installDependencies: installDeps,
|
|
2391
2406
|
usePreset,
|
|
2392
|
-
useStore,
|
|
2393
|
-
useEslint,
|
|
2394
2407
|
useNuxtV4Compat,
|
|
2395
2408
|
useNuxtModule,
|
|
2396
2409
|
useNuxtSSR,
|
|
@@ -2444,9 +2457,9 @@ run().then(() => {
|
|
|
2444
2457
|
console.log("Github: https://github.com/vuetifyjs/vuetify");
|
|
2445
2458
|
console.log("Support Vuetify: https://github.com/sponsors/johnleider");
|
|
2446
2459
|
process.exit(0);
|
|
2447
|
-
}).catch((
|
|
2460
|
+
}).catch((error) => {
|
|
2448
2461
|
console.error(`
|
|
2449
|
-
${red2("\u2716")} ${
|
|
2462
|
+
${red2("\u2716")} ${error}
|
|
2450
2463
|
`);
|
|
2451
2464
|
process.exit(1);
|
|
2452
2465
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-vuetify",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"author": "Elijah Kotyluk <elijah@elijahkotyluk.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
44
44
|
"esbuild": "^0.25.1",
|
|
45
45
|
"eslint": "^9.23.0",
|
|
46
|
-
"eslint-config-vuetify": "
|
|
46
|
+
"eslint-config-vuetify": "4.0.0",
|
|
47
47
|
"nypm": "^0.6.0",
|
|
48
48
|
"release-it": "^18.1.2",
|
|
49
49
|
"typescript": "^5.8.2"
|
|
@@ -16,12 +16,12 @@ const router = createRouter({
|
|
|
16
16
|
// Workaround for https://github.com/vitejs/vite/issues/11804
|
|
17
17
|
router.onError((err, to) => {
|
|
18
18
|
if (err?.message?.includes?.('Failed to fetch dynamically imported module')) {
|
|
19
|
-
if (
|
|
19
|
+
if (localStorage.getItem('vuetify:dynamic-reload')) {
|
|
20
|
+
console.error('Dynamic import error, reloading page did not fix it', err)
|
|
21
|
+
} else {
|
|
20
22
|
console.log('Reloading page to fix dynamic import error')
|
|
21
23
|
localStorage.setItem('vuetify:dynamic-reload', 'true')
|
|
22
24
|
location.assign(to.fullPath)
|
|
23
|
-
} else {
|
|
24
|
-
console.error('Dynamic import error, reloading page did not fix it', err)
|
|
25
25
|
}
|
|
26
26
|
} else {
|
|
27
27
|
console.error(err)
|
|
@@ -28,9 +28,9 @@ export default defineConfig({
|
|
|
28
28
|
fontsource: {
|
|
29
29
|
families: [
|
|
30
30
|
{
|
|
31
|
-
name:
|
|
31
|
+
name: 'Roboto',
|
|
32
32
|
weights: [100, 300, 400, 500, 700, 900],
|
|
33
|
-
styles: [
|
|
33
|
+
styles: ['normal', 'italic'],
|
|
34
34
|
},
|
|
35
35
|
],
|
|
36
36
|
},
|
|
@@ -48,7 +48,7 @@ export default defineConfig({
|
|
|
48
48
|
define: { 'process.env': {} },
|
|
49
49
|
resolve: {
|
|
50
50
|
alias: {
|
|
51
|
-
'@': fileURLToPath(new URL('
|
|
51
|
+
'@': fileURLToPath(new URL('src', import.meta.url)),
|
|
52
52
|
},
|
|
53
53
|
extensions: [
|
|
54
54
|
'.js',
|
|
@@ -35,7 +35,7 @@ export default defineConfig({
|
|
|
35
35
|
define: { 'process.env': {} },
|
|
36
36
|
resolve: {
|
|
37
37
|
alias: {
|
|
38
|
-
'@': fileURLToPath(new URL('
|
|
38
|
+
'@': fileURLToPath(new URL('src', import.meta.url)),
|
|
39
39
|
},
|
|
40
40
|
extensions: [
|
|
41
41
|
'.js',
|
|
@@ -56,7 +56,7 @@ export default defineConfig({
|
|
|
56
56
|
api: 'modern-compiler',
|
|
57
57
|
},
|
|
58
58
|
scss: {
|
|
59
|
-
api:'modern-compiler',
|
|
59
|
+
api: 'modern-compiler',
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
},
|
|
@@ -17,12 +17,12 @@ const router = createRouter({
|
|
|
17
17
|
// Workaround for https://github.com/vitejs/vite/issues/11804
|
|
18
18
|
router.onError((err, to) => {
|
|
19
19
|
if (err?.message?.includes?.('Failed to fetch dynamically imported module')) {
|
|
20
|
-
if (
|
|
20
|
+
if (localStorage.getItem('vuetify:dynamic-reload')) {
|
|
21
|
+
console.error('Dynamic import error, reloading page did not fix it', err)
|
|
22
|
+
} else {
|
|
21
23
|
console.log('Reloading page to fix dynamic import error')
|
|
22
24
|
localStorage.setItem('vuetify:dynamic-reload', 'true')
|
|
23
25
|
location.assign(to.fullPath)
|
|
24
|
-
} else {
|
|
25
|
-
console.error('Dynamic import error, reloading page did not fix it', err)
|
|
26
26
|
}
|
|
27
27
|
} else {
|
|
28
28
|
console.error(err)
|
|
@@ -41,7 +41,7 @@ export default defineConfig({
|
|
|
41
41
|
'vue',
|
|
42
42
|
VueRouterAutoImports,
|
|
43
43
|
{
|
|
44
|
-
|
|
44
|
+
pinia: ['defineStore', 'storeToRefs'],
|
|
45
45
|
},
|
|
46
46
|
],
|
|
47
47
|
eslintrc: {
|
|
@@ -62,7 +62,7 @@ export default defineConfig({
|
|
|
62
62
|
define: { 'process.env': {} },
|
|
63
63
|
resolve: {
|
|
64
64
|
alias: {
|
|
65
|
-
'@': fileURLToPath(new URL('
|
|
65
|
+
'@': fileURLToPath(new URL('src', import.meta.url)),
|
|
66
66
|
},
|
|
67
67
|
extensions: [
|
|
68
68
|
'.js',
|
|
@@ -16,12 +16,12 @@ const router = createRouter({
|
|
|
16
16
|
// Workaround for https://github.com/vitejs/vite/issues/11804
|
|
17
17
|
router.onError((err, to) => {
|
|
18
18
|
if (err?.message?.includes?.('Failed to fetch dynamically imported module')) {
|
|
19
|
-
if (
|
|
19
|
+
if (localStorage.getItem('vuetify:dynamic-reload')) {
|
|
20
|
+
console.error('Dynamic import error, reloading page did not fix it', err)
|
|
21
|
+
} else {
|
|
20
22
|
console.log('Reloading page to fix dynamic import error')
|
|
21
23
|
localStorage.setItem('vuetify:dynamic-reload', 'true')
|
|
22
24
|
location.assign(to.fullPath)
|
|
23
|
-
} else {
|
|
24
|
-
console.error('Dynamic import error, reloading page did not fix it', err)
|
|
25
25
|
}
|
|
26
26
|
} else {
|
|
27
27
|
console.error(err)
|
|
@@ -32,9 +32,9 @@ export default defineConfig({
|
|
|
32
32
|
fontsource: {
|
|
33
33
|
families: [
|
|
34
34
|
{
|
|
35
|
-
name:
|
|
35
|
+
name: 'Roboto',
|
|
36
36
|
weights: [100, 300, 400, 500, 700, 900],
|
|
37
|
-
styles: [
|
|
37
|
+
styles: ['normal', 'italic'],
|
|
38
38
|
},
|
|
39
39
|
],
|
|
40
40
|
},
|
|
@@ -52,7 +52,7 @@ export default defineConfig({
|
|
|
52
52
|
define: { 'process.env': {} },
|
|
53
53
|
resolve: {
|
|
54
54
|
alias: {
|
|
55
|
-
'@': fileURLToPath(new URL('
|
|
55
|
+
'@': fileURLToPath(new URL('src', import.meta.url)),
|
|
56
56
|
},
|
|
57
57
|
extensions: [
|
|
58
58
|
'.js',
|
|
@@ -17,12 +17,12 @@ const router = createRouter({
|
|
|
17
17
|
// Workaround for https://github.com/vitejs/vite/issues/11804
|
|
18
18
|
router.onError((err, to) => {
|
|
19
19
|
if (err?.message?.includes?.('Failed to fetch dynamically imported module')) {
|
|
20
|
-
if (
|
|
20
|
+
if (localStorage.getItem('vuetify:dynamic-reload')) {
|
|
21
|
+
console.error('Dynamic import error, reloading page did not fix it', err)
|
|
22
|
+
} else {
|
|
21
23
|
console.log('Reloading page to fix dynamic import error')
|
|
22
24
|
localStorage.setItem('vuetify:dynamic-reload', 'true')
|
|
23
25
|
location.assign(to.fullPath)
|
|
24
|
-
} else {
|
|
25
|
-
console.error('Dynamic import error, reloading page did not fix it', err)
|
|
26
26
|
}
|
|
27
27
|
} else {
|
|
28
28
|
console.error(err)
|
|
@@ -24,7 +24,7 @@ export default defineConfig({
|
|
|
24
24
|
'vue',
|
|
25
25
|
VueRouterAutoImports,
|
|
26
26
|
{
|
|
27
|
-
|
|
27
|
+
pinia: ['defineStore', 'storeToRefs'],
|
|
28
28
|
},
|
|
29
29
|
],
|
|
30
30
|
dts: 'src/auto-imports.d.ts',
|
|
@@ -70,7 +70,7 @@ export default defineConfig({
|
|
|
70
70
|
define: { 'process.env': {} },
|
|
71
71
|
resolve: {
|
|
72
72
|
alias: {
|
|
73
|
-
'@': fileURLToPath(new URL('
|
|
73
|
+
'@': fileURLToPath(new URL('src', import.meta.url)),
|
|
74
74
|
},
|
|
75
75
|
extensions: [
|
|
76
76
|
'.js',
|
|
@@ -7,8 +7,6 @@ import { pathToFileURL } from 'node:url'
|
|
|
7
7
|
import fs from 'node:fs'
|
|
8
8
|
import fsp from 'node:fs/promises'
|
|
9
9
|
|
|
10
|
-
export type { ModuleOptions }
|
|
11
|
-
|
|
12
10
|
// WARNING: Remove the file from modules directory if you install vuetify-nuxt-module
|
|
13
11
|
export default defineNuxtModule<ModuleOptions>({
|
|
14
12
|
meta: {
|
|
@@ -51,31 +49,26 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
51
49
|
async configResolved (config) {
|
|
52
50
|
if (isObject(options.styles)) {
|
|
53
51
|
sassVariables = true
|
|
54
|
-
|
|
55
|
-
configFile = path.resolve(options.styles.configFile)
|
|
56
|
-
} else {
|
|
57
|
-
configFile = path.resolve(path.join(config.root || process.cwd(), options.styles.configFile))
|
|
58
|
-
}
|
|
52
|
+
configFile = path.isAbsolute(options.styles.configFile) ? path.resolve(options.styles.configFile) : path.resolve(path.join(config.root || process.cwd(), options.styles.configFile))
|
|
59
53
|
configFile = pathToFileURL(configFile).href
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
54
|
+
} else {
|
|
62
55
|
isNone = options.styles === 'none'
|
|
63
56
|
}
|
|
64
57
|
},
|
|
65
58
|
async resolveId (source, importer, { custom, ssr }) {
|
|
66
59
|
if (source.startsWith(PREFIX) || source.startsWith(SSR_PREFIX)) {
|
|
67
|
-
if (
|
|
60
|
+
if (/\.s[ca]ss$/.test(source)) {
|
|
68
61
|
return source
|
|
69
62
|
}
|
|
70
63
|
|
|
71
64
|
const idx = source.indexOf('?')
|
|
72
|
-
return idx
|
|
65
|
+
return idx === -1 ? source : source.slice(0, idx)
|
|
73
66
|
}
|
|
74
67
|
if (
|
|
75
68
|
source === 'vuetify/styles' || (
|
|
76
|
-
importer
|
|
77
|
-
source.endsWith('.css')
|
|
78
|
-
isSubdir(vuetifyBase, path.isAbsolute(source) ? source : importer)
|
|
69
|
+
importer
|
|
70
|
+
&& source.endsWith('.css')
|
|
71
|
+
&& isSubdir(vuetifyBase, path.isAbsolute(source) ? source : importer)
|
|
79
72
|
)
|
|
80
73
|
) {
|
|
81
74
|
if (options.styles === 'sass') {
|
|
@@ -84,8 +77,9 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
84
77
|
|
|
85
78
|
const resolution = await this.resolve(source, importer, { skipSelf: true, custom })
|
|
86
79
|
|
|
87
|
-
if (!resolution)
|
|
80
|
+
if (!resolution) {
|
|
88
81
|
return undefined
|
|
82
|
+
}
|
|
89
83
|
|
|
90
84
|
const target = await resolveCss(resolution.id)
|
|
91
85
|
if (isNone) {
|
|
@@ -93,21 +87,21 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
93
87
|
return target
|
|
94
88
|
}
|
|
95
89
|
|
|
96
|
-
return `${ssr ? SSR_PREFIX: PREFIX}${path.relative(vuetifyBase, target)}`
|
|
90
|
+
return `${ssr ? SSR_PREFIX : PREFIX}${path.relative(vuetifyBase, target)}`
|
|
97
91
|
}
|
|
98
92
|
|
|
99
93
|
return undefined
|
|
100
94
|
},
|
|
101
|
-
load (id){
|
|
95
|
+
load (id) {
|
|
102
96
|
if (sassVariables) {
|
|
103
97
|
const target = id.startsWith(PREFIX)
|
|
104
98
|
? path.resolve(vuetifyBase, id.slice(PREFIX.length))
|
|
105
|
-
: id.startsWith(SSR_PREFIX)
|
|
106
|
-
|
|
107
|
-
|
|
99
|
+
: (id.startsWith(SSR_PREFIX)
|
|
100
|
+
? path.resolve(vuetifyBase, id.slice(SSR_PREFIX.length))
|
|
101
|
+
: undefined)
|
|
108
102
|
|
|
109
103
|
if (target) {
|
|
110
|
-
const suffix =
|
|
104
|
+
const suffix = /\.scss/.test(target) ? ';\n' : '\n'
|
|
111
105
|
return {
|
|
112
106
|
code: `@use "${configFile}"${suffix}@use "${pathToFileURL(target).href}"${suffix}`,
|
|
113
107
|
map: {
|
|
@@ -132,10 +126,10 @@ function resolveCssFactory () {
|
|
|
132
126
|
try {
|
|
133
127
|
mapping = source.replace(/\.css$/, '.sass')
|
|
134
128
|
await fsp.access(mapping, fs.constants.R_OK)
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
129
|
+
} catch (error) {
|
|
130
|
+
if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT')) {
|
|
131
|
+
throw error
|
|
132
|
+
}
|
|
139
133
|
mapping = source.replace(/\.css$/, '.scss')
|
|
140
134
|
}
|
|
141
135
|
mappings.set(source, mapping)
|
|
@@ -148,3 +142,5 @@ function isSubdir (root: string, test: string) {
|
|
|
148
142
|
const relative = path.relative(root, test)
|
|
149
143
|
return relative && !relative.startsWith('..') && !path.isAbsolute(relative)
|
|
150
144
|
}
|
|
145
|
+
|
|
146
|
+
export { type Options as ModuleOptions } from '@vuetify/loader-shared'
|