svelte-vitals 0.29.0 → 0.30.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 +3 -3
- package/dist/{chunk-AAUZ37EW.js → chunk-QBXO46PU.js} +62 -4
- 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-QBXO46PU.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 = "81d49a11b71a16ea1294212d43520a0137b4bd5e";
|
|
1002
|
+
var ACTION_VERSION = "0.3.5";
|
|
1003
1003
|
|
|
1004
1004
|
// src/install/index.ts
|
|
1005
1005
|
function detectPackageManagerNear(io, appDir) {
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
defineConfig,
|
|
18
18
|
selectRules,
|
|
19
19
|
applyRuleSeverities,
|
|
20
|
+
applyOverrides,
|
|
20
21
|
collectKitModuleFacts
|
|
21
22
|
} from "@svelte-vitals/core";
|
|
22
23
|
|
|
@@ -1132,7 +1133,8 @@ var CONFIG_FILENAMES = ["svelte-vitals.config.mjs", "svelte-vitals.config.js", "
|
|
|
1132
1133
|
var CATEGORIES = ["seo", "performance", "correctness", "security", "architecture"];
|
|
1133
1134
|
var TREAT_DYNAMIC_AS_VALUES = ["pass", "warn", "fail"];
|
|
1134
1135
|
var FAIL_ON_VALUES = ["critical", "warning", "info"];
|
|
1135
|
-
var KNOWN_TOP_LEVEL_KEYS = /* @__PURE__ */ new Set(["treatDynamicAs", "metaComponents", "rules", "failOn", "weights"]);
|
|
1136
|
+
var KNOWN_TOP_LEVEL_KEYS = /* @__PURE__ */ new Set(["treatDynamicAs", "metaComponents", "rules", "failOn", "weights", "overrides"]);
|
|
1137
|
+
var RULE_SETTING_VALUES = ["off", "critical", "warning", "info"];
|
|
1136
1138
|
function isPlainObject2(value) {
|
|
1137
1139
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1138
1140
|
}
|
|
@@ -1183,6 +1185,58 @@ function validateConfigFile(raw, path) {
|
|
|
1183
1185
|
}
|
|
1184
1186
|
config.rules = rules;
|
|
1185
1187
|
}
|
|
1188
|
+
if (raw.overrides !== void 0) {
|
|
1189
|
+
if (!Array.isArray(raw.overrides)) {
|
|
1190
|
+
throw new Error(`${path}: overrides must be an array of { route/files, rules } entries.`);
|
|
1191
|
+
}
|
|
1192
|
+
const isGlob = (v) => typeof v === "string" && v.length > 0;
|
|
1193
|
+
const isGlobs = (v) => isGlob(v) || Array.isArray(v) && v.length > 0 && v.every(isGlob);
|
|
1194
|
+
const overrides = [];
|
|
1195
|
+
raw.overrides.forEach((entry, i) => {
|
|
1196
|
+
if (!isPlainObject2(entry)) {
|
|
1197
|
+
throw new Error(`${path}: overrides[${i}] must be an object with 'route' and/or 'files', and 'rules'.`);
|
|
1198
|
+
}
|
|
1199
|
+
if (entry.route !== void 0 && !isGlobs(entry.route)) {
|
|
1200
|
+
throw new Error(
|
|
1201
|
+
`${path}: overrides[${i}].route must be a non-empty string or a non-empty array of non-empty strings.`
|
|
1202
|
+
);
|
|
1203
|
+
}
|
|
1204
|
+
if (entry.files !== void 0 && !isGlobs(entry.files)) {
|
|
1205
|
+
throw new Error(
|
|
1206
|
+
`${path}: overrides[${i}].files must be a non-empty string or a non-empty array of non-empty strings.`
|
|
1207
|
+
);
|
|
1208
|
+
}
|
|
1209
|
+
if (entry.route === void 0 && entry.files === void 0) {
|
|
1210
|
+
throw new Error(`${path}: overrides[${i}] must set 'route' and/or 'files' to scope the override.`);
|
|
1211
|
+
}
|
|
1212
|
+
if (!isPlainObject2(entry.rules)) {
|
|
1213
|
+
throw new Error(`${path}: overrides[${i}].rules must be an object of rule-id/category \u2192 setting.`);
|
|
1214
|
+
}
|
|
1215
|
+
if (Object.keys(entry.rules).length === 0) {
|
|
1216
|
+
throw new Error(`${path}: overrides[${i}].rules must contain at least one rule id or category.`);
|
|
1217
|
+
}
|
|
1218
|
+
const nonCategoryKeys = Object.keys(entry.rules).filter((k) => !CATEGORIES.includes(k));
|
|
1219
|
+
const unknown = findUnknownRuleIds(nonCategoryKeys);
|
|
1220
|
+
if (unknown.length > 0) {
|
|
1221
|
+
throw new Error(
|
|
1222
|
+
`${path}: unknown rule id(s) or categories in overrides[${i}].rules: ${unknown.join(", ")}. Known categories: ${CATEGORIES.join(", ")}. Known rule ids: ${knownRuleIds().join(", ")}`
|
|
1223
|
+
);
|
|
1224
|
+
}
|
|
1225
|
+
for (const [key, setting] of Object.entries(entry.rules)) {
|
|
1226
|
+
if (!RULE_SETTING_VALUES.includes(setting)) {
|
|
1227
|
+
throw new Error(
|
|
1228
|
+
`${path}: overrides[${i}].rules.${key}: invalid setting '${String(setting)}'; expected ${RULE_SETTING_VALUES.join("|")}.`
|
|
1229
|
+
);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
overrides.push({
|
|
1233
|
+
...entry.route !== void 0 ? { route: entry.route } : {},
|
|
1234
|
+
...entry.files !== void 0 ? { files: entry.files } : {},
|
|
1235
|
+
rules: entry.rules
|
|
1236
|
+
});
|
|
1237
|
+
});
|
|
1238
|
+
config.overrides = overrides;
|
|
1239
|
+
}
|
|
1186
1240
|
if (raw.weights !== void 0) {
|
|
1187
1241
|
if (!isPlainObject2(raw.weights)) {
|
|
1188
1242
|
throw new Error(`${path}: weights must be an object of category \u2192 number.`);
|
|
@@ -1303,7 +1357,8 @@ async function analyzeProject(opts = {}) {
|
|
|
1303
1357
|
metaComponents: opts.metaComponents ?? file?.metaComponents ?? [],
|
|
1304
1358
|
rules: opts.rules ?? file?.rules ?? {},
|
|
1305
1359
|
failOn: opts.failOn ?? file?.failOn ?? "critical",
|
|
1306
|
-
...weights !== void 0 ? { weights } : {}
|
|
1360
|
+
...weights !== void 0 ? { weights } : {},
|
|
1361
|
+
...file?.overrides !== void 0 ? { overrides: file.overrides } : {}
|
|
1307
1362
|
});
|
|
1308
1363
|
await detectProject(rt, cwd);
|
|
1309
1364
|
const matches = routeMatcher(opts.route);
|
|
@@ -1316,8 +1371,11 @@ async function analyzeProject(opts = {}) {
|
|
|
1316
1371
|
const kitModules = opts.route ? [] : await collectKitModuleFacts(rt, cwd);
|
|
1317
1372
|
const selected = selectRules(allRules2, config);
|
|
1318
1373
|
const rules = opts.categories ? selected.filter((r) => opts.categories.includes(r.category)) : selected;
|
|
1319
|
-
const results =
|
|
1320
|
-
|
|
1374
|
+
const results = applyOverrides(
|
|
1375
|
+
applyRuleSeverities(
|
|
1376
|
+
await runRules(rules, { heads, images, headings, components, project, config, kitModules }),
|
|
1377
|
+
config
|
|
1378
|
+
),
|
|
1321
1379
|
config
|
|
1322
1380
|
);
|
|
1323
1381
|
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.30.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.27.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^24.13.3"
|