@svelte-vitals/vite 0.18.0 → 0.19.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/index.d.ts +3 -1
- package/dist/index.js +17 -3
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
-
import { TreatDynamicAs, RuleSetting, Severity, Category } from '@svelte-vitals/core';
|
|
2
|
+
import { TreatDynamicAs, RuleSetting, RuleOverride, Severity, Category } from '@svelte-vitals/core';
|
|
3
3
|
|
|
4
4
|
interface SvelteVitalsOptions {
|
|
5
5
|
/** Project root (defaults to the Vite config root / cwd). */
|
|
@@ -7,6 +7,8 @@ interface SvelteVitalsOptions {
|
|
|
7
7
|
treatDynamicAs?: TreatDynamicAs;
|
|
8
8
|
metaComponents?: string[];
|
|
9
9
|
rules?: Record<string, RuleSetting>;
|
|
10
|
+
/** Route-/file-scoped rule overrides applied to build-gate results (option > config file). */
|
|
11
|
+
overrides?: RuleOverride[];
|
|
10
12
|
/** Minimum severity that fails the build (default: 'critical'). */
|
|
11
13
|
failOn?: Severity;
|
|
12
14
|
/** Per-category weights for the combined Health score shown in the JSON/console report (flag > config file > default 1 each). */
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
allRules,
|
|
17
17
|
selectRules,
|
|
18
18
|
applyRuleSeverities,
|
|
19
|
+
applyOverrides,
|
|
19
20
|
runRules,
|
|
20
21
|
computeScore,
|
|
21
22
|
summarize,
|
|
@@ -155,19 +156,32 @@ async function analyze(prerenderPagesDir, cwd, options) {
|
|
|
155
156
|
const fileConfig = loaded?.config;
|
|
156
157
|
const warnings = loaded?.warnings ?? [];
|
|
157
158
|
const weights = options.weights ?? fileConfig?.weights;
|
|
159
|
+
const overrides = options.overrides ?? fileConfig?.overrides;
|
|
158
160
|
const config = defineConfig({
|
|
159
161
|
treatDynamicAs: options.treatDynamicAs ?? fileConfig?.treatDynamicAs ?? "pass",
|
|
160
162
|
metaComponents: options.metaComponents ?? fileConfig?.metaComponents ?? [],
|
|
161
163
|
rules: options.rules ?? fileConfig?.rules ?? {},
|
|
162
164
|
failOn: options.failOn ?? fileConfig?.failOn ?? "critical",
|
|
163
|
-
...weights !== void 0 ? { weights } : {}
|
|
165
|
+
...weights !== void 0 ? { weights } : {},
|
|
166
|
+
...overrides !== void 0 ? { overrides } : {}
|
|
164
167
|
});
|
|
165
168
|
const { heads, headings, images, htmlLang } = await collectRenderedHeads(prerenderPagesDir);
|
|
166
169
|
const project = await collectRenderedProject(cwd, htmlLang);
|
|
167
170
|
const components = await collectComponentFacts(cwd);
|
|
168
171
|
const kitModules = await collectKitModuleFacts(cwd);
|
|
169
|
-
const results =
|
|
170
|
-
|
|
172
|
+
const results = applyOverrides(
|
|
173
|
+
applyRuleSeverities(
|
|
174
|
+
await runRules(selectRules(allRules, config), {
|
|
175
|
+
heads,
|
|
176
|
+
headings,
|
|
177
|
+
images,
|
|
178
|
+
project,
|
|
179
|
+
components,
|
|
180
|
+
config,
|
|
181
|
+
kitModules
|
|
182
|
+
}),
|
|
183
|
+
config
|
|
184
|
+
),
|
|
171
185
|
config
|
|
172
186
|
);
|
|
173
187
|
const { score } = computeScore(results, config);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svelte-vitals/vite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Vite/SvelteKit plugin for svelte-vitals — analyzes prerendered HTML during vite build.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"esm-env": "^1.2.2",
|
|
43
43
|
"node-html-parser": "^9.0.0",
|
|
44
44
|
"tinyglobby": "^0.2.17",
|
|
45
|
-
"@svelte-vitals/core": "0.
|
|
46
|
-
"svelte-vitals": "0.
|
|
45
|
+
"@svelte-vitals/core": "0.27.0",
|
|
46
|
+
"svelte-vitals": "0.30.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@sveltejs/kit": "^2.69.2",
|