svelte-vitals 0.28.0 → 0.29.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/dist/bin.js +16 -8
- package/dist/{chunk-O5VMXV2Q.js → chunk-AAUZ37EW.js} +31 -9
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
readCoreVersion,
|
|
10
10
|
readPackageVersion,
|
|
11
11
|
run
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AAUZ37EW.js";
|
|
13
13
|
|
|
14
14
|
// src/bin.ts
|
|
15
15
|
import mri3 from "mri";
|
|
@@ -998,8 +998,8 @@ function readInstalledViteVersion(io) {
|
|
|
998
998
|
}
|
|
999
999
|
|
|
1000
1000
|
// src/ci/action-pin.generated.ts
|
|
1001
|
-
var ACTION_SHA = "
|
|
1002
|
-
var ACTION_VERSION = "0.3.
|
|
1001
|
+
var ACTION_SHA = "a9fe2c88981fcf02498935df079e733e1317398c";
|
|
1002
|
+
var ACTION_VERSION = "0.3.4";
|
|
1003
1003
|
|
|
1004
1004
|
// src/install/index.ts
|
|
1005
1005
|
function detectPackageManagerNear(io, appDir) {
|
|
@@ -1195,9 +1195,15 @@ async function runInstall(flags, io, prompts, version = "0.0.0") {
|
|
|
1195
1195
|
io.errorLog("svelte-vitals: no valid clients or targets selected.");
|
|
1196
1196
|
return 2;
|
|
1197
1197
|
}
|
|
1198
|
-
const
|
|
1198
|
+
const isSvelteKitApp = (dir) => {
|
|
1199
1199
|
try {
|
|
1200
|
-
|
|
1200
|
+
if (io.readFile(join4(dir, "svelte.config.js")) !== void 0 || io.readFile(join4(dir, "svelte.config.ts")) !== void 0) {
|
|
1201
|
+
return true;
|
|
1202
|
+
}
|
|
1203
|
+
const pkgRaw = io.readFile(join4(dir, "package.json"));
|
|
1204
|
+
if (pkgRaw === void 0) return false;
|
|
1205
|
+
const pkg = JSON.parse(pkgRaw);
|
|
1206
|
+
return Boolean(pkg.dependencies?.["@sveltejs/kit"] ?? pkg.devDependencies?.["@sveltejs/kit"]);
|
|
1201
1207
|
} catch {
|
|
1202
1208
|
return false;
|
|
1203
1209
|
}
|
|
@@ -1207,12 +1213,14 @@ async function runInstall(flags, io, prompts, version = "0.0.0") {
|
|
|
1207
1213
|
if (needsApp) {
|
|
1208
1214
|
if (flags.app) {
|
|
1209
1215
|
const candidate = join4(io.cwd, flags.app);
|
|
1210
|
-
if (!
|
|
1211
|
-
io.errorLog(
|
|
1216
|
+
if (!isSvelteKitApp(candidate)) {
|
|
1217
|
+
io.errorLog(
|
|
1218
|
+
`svelte-vitals: --app '${flags.app}' is not a SvelteKit app (no svelte.config.{js,ts} or @sveltejs/kit dependency there).`
|
|
1219
|
+
);
|
|
1212
1220
|
return 2;
|
|
1213
1221
|
}
|
|
1214
1222
|
appDir = candidate;
|
|
1215
|
-
} else if (!
|
|
1223
|
+
} else if (!isSvelteKitApp(io.cwd)) {
|
|
1216
1224
|
const apps = await (io.discoverApps ?? discoverApps)(io.cwd);
|
|
1217
1225
|
if (apps.length === 1) {
|
|
1218
1226
|
io.errorLog(`svelte-vitals: detected SvelteKit app at ${apps[0]}; targeting it for the Vite/config targets.`);
|
|
@@ -16,7 +16,8 @@ import {
|
|
|
16
16
|
computeHealth,
|
|
17
17
|
defineConfig,
|
|
18
18
|
selectRules,
|
|
19
|
-
applyRuleSeverities
|
|
19
|
+
applyRuleSeverities,
|
|
20
|
+
collectKitModuleFacts
|
|
20
21
|
} from "@svelte-vitals/core";
|
|
21
22
|
|
|
22
23
|
// src/runtime/node.ts
|
|
@@ -652,16 +653,36 @@ import { collectComponentFacts } from "@svelte-vitals/core";
|
|
|
652
653
|
|
|
653
654
|
// src/discover-apps.ts
|
|
654
655
|
import { existsSync } from "fs";
|
|
656
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
655
657
|
import { join as join2, dirname } from "path";
|
|
656
658
|
import { glob } from "tinyglobby";
|
|
659
|
+
var GLOB_OPTS = {
|
|
660
|
+
dot: false,
|
|
661
|
+
deep: 4,
|
|
662
|
+
ignore: ["**/node_modules/**", "**/.svelte-kit/**", "**/build/**", "**/dist/**", "**/.git/**"]
|
|
663
|
+
};
|
|
664
|
+
async function hasKitDependency(pkgJsonPath) {
|
|
665
|
+
try {
|
|
666
|
+
const pkg = JSON.parse(await readFile2(pkgJsonPath, "utf8"));
|
|
667
|
+
return Boolean(pkg.dependencies?.["@sveltejs/kit"] ?? pkg.devDependencies?.["@sveltejs/kit"]);
|
|
668
|
+
} catch {
|
|
669
|
+
return false;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
657
672
|
async function discoverApps(cwd) {
|
|
658
|
-
const configs = await
|
|
659
|
-
cwd,
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
const
|
|
673
|
+
const [configs, pkgJsons] = await Promise.all([
|
|
674
|
+
glob("**/svelte.config.{js,ts}", { cwd, ...GLOB_OPTS }),
|
|
675
|
+
glob("**/package.json", { cwd, ...GLOB_OPTS })
|
|
676
|
+
]);
|
|
677
|
+
const configDirs = configs.map(dirname);
|
|
678
|
+
const kitDepDirs = [];
|
|
679
|
+
for (const pkgJson of pkgJsons) {
|
|
680
|
+
const dir = dirname(pkgJson);
|
|
681
|
+
if (dir !== "." && await hasKitDependency(join2(cwd, pkgJson))) {
|
|
682
|
+
kitDepDirs.push(dir);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
const dirs = [.../* @__PURE__ */ new Set([...configDirs, ...kitDepDirs])].filter(
|
|
665
686
|
(d) => d !== "." && existsSync(join2(cwd, d, "src", "routes"))
|
|
666
687
|
);
|
|
667
688
|
return dirs.sort();
|
|
@@ -1292,10 +1313,11 @@ async function analyzeProject(opts = {}) {
|
|
|
1292
1313
|
const headings = collected.headings.filter((h) => matches(h.route));
|
|
1293
1314
|
const project = await collectProjectFacts(rt, cwd);
|
|
1294
1315
|
const components = opts.route ? [] : await collectComponentFacts(rt, cwd);
|
|
1316
|
+
const kitModules = opts.route ? [] : await collectKitModuleFacts(rt, cwd);
|
|
1295
1317
|
const selected = selectRules(allRules2, config);
|
|
1296
1318
|
const rules = opts.categories ? selected.filter((r) => opts.categories.includes(r.category)) : selected;
|
|
1297
1319
|
const results = applyRuleSeverities(
|
|
1298
|
-
await runRules(rules, { heads, images, headings, components, project, config }),
|
|
1320
|
+
await runRules(rules, { heads, images, headings, components, project, config, kitModules }),
|
|
1299
1321
|
config
|
|
1300
1322
|
);
|
|
1301
1323
|
return { results, config, version: readPackageVersion(), warnings };
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-vitals",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "A SvelteKit SEO checker — not a runtime Web Vitals reporter. Static analysis of your routes' head metadata.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"smol-toml": "^1.7.0",
|
|
47
47
|
"svelte": "^5.56.4",
|
|
48
48
|
"tinyglobby": "^0.2.17",
|
|
49
|
-
"@svelte-vitals/core": "0.
|
|
49
|
+
"@svelte-vitals/core": "0.26.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^24.13.3"
|