@svelte-vitals/vite 0.55.3 → 0.55.5
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/README.md +3 -1
- package/dist/hooks/index.d.ts +24 -5
- package/dist/hooks/index.js +2 -3
- package/dist/index.d.ts +0 -2
- package/dist/index.js +70 -63
- package/dist/{loopback-DxxU70UA.js → loopback-D_07LGfE.js} +2 -4
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -30,13 +30,15 @@ export default {
|
|
|
30
30
|
- `outFile`: write the JSON report to a path.
|
|
31
31
|
- `rules` / `metaComponents` / `treatDynamicAs`: same as the CLI/core config.
|
|
32
32
|
- `weights`: per-category weight overrides for the combined Health score.
|
|
33
|
+
- `overrides`: route- and file-scoped rule overrides, same as the config file's `overrides`.
|
|
34
|
+
- `seo`: `{ indexable?: boolean }`; `indexable: false` turns off the search-result rules.
|
|
33
35
|
- `prerenderDir`: override the prerendered-pages directory (default: `output/prerendered/pages` under `kit.outDir`).
|
|
34
36
|
- `cwd`: project root (defaults to the Vite config root).
|
|
35
37
|
- `ui`: serve the live dev dashboard (default `true`); pass `false` to keep only the build-time gate.
|
|
36
38
|
|
|
37
39
|
A `svelte-vitals.config.*` and a `svelte-vitals-suppressions.json` in the project root are read automatically (explicit options win over the config file). Only source-scan suppression entries apply; route-level entries are skipped on every plugin surface (rendered route findings anchor to the built HTML) and the plugin says how many.
|
|
38
40
|
|
|
39
|
-
At build time the HTML check covers prerendered routes only; the source scan applies project-wide. Routes that are not prerendered (server-rendered, or dynamic routes without prerendered entries) have no build output, so nothing checks their rendered HTML here. A prerendered route with `ssr = false` has build output, but only the empty app shell, so the HTML check skips it too (a `+layout` with `ssr = false` skips its subtree, and
|
|
41
|
+
At build time the HTML check covers prerendered routes only; the source scan applies project-wide. Routes that are not prerendered (server-rendered, or dynamic routes without prerendered entries) have no build output, so nothing checks their rendered HTML here. A prerendered route with `ssr = false` has build output, but only the empty app shell, so the HTML check skips it too (a `+layout` with `ssr = false` skips its subtree, and the hash router every route) and prints one warning listing the skipped routes. The `svelte-vitals` CLI covers them by source analysis, and browsing them during `vite dev` gets the live dashboard a rendered reading. When the build prerenders nothing at all (an SPA served from a fallback page, say), the plugin prints one warning that route analysis was skipped and still runs and gates the source scan; `seo/html-lang`, which reads the rendered `<html>`, is skipped with it.
|
|
40
42
|
|
|
41
43
|
See [Live dashboard](https://oekazuma.github.io/svelte-vitals/guides/dev-dashboard/) and [Plugin mode](https://oekazuma.github.io/svelte-vitals/guides/plugin-mode/) for the full picture.
|
|
42
44
|
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Handle } from "@sveltejs/kit";
|
|
3
|
-
//#region src/hooks/handle.d.ts
|
|
1
|
+
import { RuleSetting } from "@svelte-vitals/core";
|
|
4
2
|
/** Options for the dev-time SvelteKit handle. A focused subset of the plugin options. */
|
|
5
3
|
interface SvelteVitalsHookOptions {
|
|
6
4
|
/** Component names treated as meta sources (design §11 layer 4). Mirrors the plugin option. */
|
|
@@ -8,12 +6,33 @@ interface SvelteVitalsHookOptions {
|
|
|
8
6
|
/** Per-rule overrides keyed by rule id, e.g. `{ 'seo/json-ld': 'off' }`. Mirrors the plugin option. */
|
|
9
7
|
rules?: Record<string, RuleSetting>;
|
|
10
8
|
}
|
|
9
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
10
|
+
/** The part of a SvelteKit 2 or 3 `RequestEvent` this handle reads. */
|
|
11
|
+
interface HandleEvent {
|
|
12
|
+
route: {
|
|
13
|
+
id: string | null;
|
|
14
|
+
};
|
|
15
|
+
url: URL;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Structural, so the package imports no SvelteKit type: `Handle` lives in a different module in
|
|
19
|
+
* each major. Generic in the event, because `resolve`'s parameter is checked contravariantly
|
|
20
|
+
* against SvelteKit's `RequestEvent`.
|
|
21
|
+
*/
|
|
22
|
+
type SvelteVitalsHandle = <E extends HandleEvent>(input: {
|
|
23
|
+
event: E;
|
|
24
|
+
resolve: (event: E, opts?: {
|
|
25
|
+
transformPageChunk?: (input: {
|
|
26
|
+
html: string;
|
|
27
|
+
done: boolean;
|
|
28
|
+
}) => MaybePromise<string | undefined>;
|
|
29
|
+
}) => MaybePromise<Response>;
|
|
30
|
+
}) => MaybePromise<Response>;
|
|
11
31
|
/**
|
|
12
32
|
* SvelteKit `handle` that analyzes each visited page's rendered HTML, in dev only,
|
|
13
33
|
* and (when the live dashboard is enabled) feeds the results in — upgrading that
|
|
14
34
|
* route's dashboard findings from static (source-only) to `measured` (real rendered
|
|
15
35
|
* HTML). Add it to `src/hooks.server.ts`, e.g. `sequence(svelteVitalsHandle())`.
|
|
16
36
|
*/
|
|
17
|
-
export declare function svelteVitalsHandle(options?: SvelteVitalsHookOptions):
|
|
18
|
-
//#endregion
|
|
37
|
+
export declare function svelteVitalsHandle(options?: SvelteVitalsHookOptions): SvelteVitalsHandle;
|
|
19
38
|
export type { SvelteVitalsHookOptions };
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as toOccurrenceMap, r as parseHtmlHead, t as isLoopbackOrigin } from "../loopback-
|
|
1
|
+
import { i as toOccurrenceMap, r as parseHtmlHead, t as isLoopbackOrigin } from "../loopback-D_07LGfE.js";
|
|
2
2
|
import { defineConfig } from "@svelte-vitals/core";
|
|
3
3
|
import { allRules, defaultProject, effectiveSeverity, formatFailedRuleWarning, isPenalized, runAnalysis, selectRules, terminalSafe } from "@svelte-vitals/core/internal";
|
|
4
4
|
import { DEV } from "esm-env";
|
|
5
|
-
|
|
5
|
+
// src/hooks/handle.ts
|
|
6
6
|
/** Stable signature of a route's penalized findings, so ingest is skipped when a repeat visit finds nothing new. */
|
|
7
7
|
function findingSignature(results, config) {
|
|
8
8
|
return results.filter((r) => isPenalized(r.detection, config.treatDynamicAs)).map((r) => `${r.id}:${effectiveSeverity(r, config)}:${r.detection.presence}:${r.detection.value}`).sort().join("|");
|
|
@@ -130,5 +130,4 @@ function svelteVitalsHandle(options = {}) {
|
|
|
130
130
|
} });
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
|
-
//#endregion
|
|
134
133
|
export { svelteVitalsHandle };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Category, Config, RuleOverride, RuleSetting, Severity, TreatDynamicAs } from "@svelte-vitals/core";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
|
-
//#region src/plugin.d.ts
|
|
4
3
|
interface SvelteVitalsOptions {
|
|
5
4
|
/** Project root (defaults to the Vite config root / cwd). */
|
|
6
5
|
cwd?: string;
|
|
@@ -31,5 +30,4 @@ interface SvelteVitalsOptions {
|
|
|
31
30
|
}
|
|
32
31
|
/** svelte-vitals Vite/SvelteKit plugin. */
|
|
33
32
|
export declare function svelteVitals(options?: SvelteVitalsOptions): Plugin | Plugin[];
|
|
34
|
-
//#endregion
|
|
35
33
|
export type { SvelteVitalsOptions };
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { i as toOccurrenceMap, n as isSameOrigin, r as parseHtmlHead, t as isLoopbackOrigin } from "./loopback-
|
|
1
|
+
import { i as toOccurrenceMap, n as isSameOrigin, r as parseHtmlHead, t as isLoopbackOrigin } from "./loopback-D_07LGfE.js";
|
|
2
2
|
import { once } from "node:events";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { access, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
5
5
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
6
6
|
import { CATEGORIES, defineConfig } from "@svelte-vitals/core";
|
|
7
|
-
import { ROBOTS_SOURCE_PATHS, SITEMAP_SOURCE_PATHS, SVELTE_CONFIG_FILES, VITE_CONFIG_FILES, addFactsDirectives, allRules, buildJsonReport, collectComponentFacts, collectKitModuleFacts, collectSourceFiles, collectSuppressions, computeScore, defaultConfig,
|
|
7
|
+
import { ROBOTS_SOURCE_PATHS, SITEMAP_SOURCE_PATHS, SVELTE_CONFIG_FILES, VITE_CONFIG_FILES, addFactsDirectives, allRules, buildJsonReport, collectComponentFacts, collectKitModuleFacts, collectSourceFiles, collectSuppressions, computeScore, defaultConfig, findMinifyDisabled, formatConsoleReport, formatFailedRuleWarning, formatJsonReportChunks, hasFailureAtOrAbove, isPlainObject, renderAppShell, resolveKitAliases, resolveKitHashRouter, resolveKitPathsBase, resolveRuleOptions, routeNeverSsr, runAnalysis, safeHref, selectRules, servesRootFile, shouldSkipRangeCheck, skippedFileWarnings, summarize, terminalSafe, unknownDirectiveIds, validateRuleSetting, withFailedRulesOff, withIndexableOff, withPackageImports, withWorkspacePackages } from "@svelte-vitals/core/internal";
|
|
8
8
|
import { CONFIG_FILENAMES, SUPPRESSIONS_FILE, analyzeProject, applySuppressions, createNodeRuntime, dropConstantListEachBlocks, findUnknownRuleIds, findWorkspacePackages, knownRuleIds, loadConfigFile, loadSuppressions, registryTag, ruleOptionsSpec } from "svelte-vitals";
|
|
9
|
-
|
|
9
|
+
// src/providers/rendered/collect.ts
|
|
10
10
|
/** Map a prerendered HTML path (relative to pages/, POSIX) to its route. */
|
|
11
11
|
function deriveRouteFromHtmlPath(relPath) {
|
|
12
12
|
let p = relPath.replace(/\\/g, "/").replace(/\.html$/, "");
|
|
@@ -89,8 +89,7 @@ async function collectRenderedHeads(prerenderPagesDir) {
|
|
|
89
89
|
htmlLang
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
//#region src/providers/rendered/project.ts
|
|
92
|
+
// src/providers/rendered/project.ts
|
|
94
93
|
async function exists(path) {
|
|
95
94
|
try {
|
|
96
95
|
await access(path);
|
|
@@ -151,13 +150,12 @@ async function collectRenderedProject(cwd, htmlLang) {
|
|
|
151
150
|
htmlLang,
|
|
152
151
|
...robotsReferencesSitemap !== void 0 ? { robotsReferencesSitemap } : {},
|
|
153
152
|
...kitPathsBase ? { kitPathsBase } : {},
|
|
154
|
-
...
|
|
153
|
+
...resolveKitHashRouter(viteConfig, svelteConfig) ? { kitHashRouter: true } : {},
|
|
155
154
|
...kitAliases ? { kitAliases } : {},
|
|
156
155
|
...componentAliases !== kitAliases ? { componentAliases } : {}
|
|
157
156
|
};
|
|
158
157
|
}
|
|
159
|
-
|
|
160
|
-
//#region src/providers/source/components.ts
|
|
158
|
+
// src/providers/source/components.ts
|
|
161
159
|
const nodeRuntime = createNodeRuntime();
|
|
162
160
|
/**
|
|
163
161
|
* Scan every `.svelte` component under `src/` for Correctness/Security/Architecture/
|
|
@@ -184,8 +182,7 @@ function collectKitModuleFacts$1(root, aliases) {
|
|
|
184
182
|
function collectSourceFiles$1(root) {
|
|
185
183
|
return collectSourceFiles(nodeRuntime, root);
|
|
186
184
|
}
|
|
187
|
-
|
|
188
|
-
//#region src/suppressions.ts
|
|
185
|
+
// src/suppressions.ts
|
|
189
186
|
/**
|
|
190
187
|
* Apply `svelte-vitals-suppressions.json` the way every plugin surface must: source-scan entries
|
|
191
188
|
* only. A route-level entry (route starting with `/`) is written by the CLI against
|
|
@@ -207,8 +204,7 @@ function applySourceSuppressions(results, entries, config) {
|
|
|
207
204
|
notices
|
|
208
205
|
};
|
|
209
206
|
}
|
|
210
|
-
|
|
211
|
-
//#region src/version.ts
|
|
207
|
+
// src/version.ts
|
|
212
208
|
/** Read this package's version from its own package.json so the report never drifts. */
|
|
213
209
|
function readPackageVersion() {
|
|
214
210
|
try {
|
|
@@ -237,8 +233,7 @@ function readCoreVersion() {
|
|
|
237
233
|
return "0.0.0";
|
|
238
234
|
}
|
|
239
235
|
}
|
|
240
|
-
|
|
241
|
-
//#region src/analyze.ts
|
|
236
|
+
// src/analyze.ts
|
|
242
237
|
/**
|
|
243
238
|
* Merge plugin options over an optional loaded config file, per-field precedence (an
|
|
244
239
|
* explicit `options` value wins, otherwise the file, otherwise the built-in default).
|
|
@@ -417,8 +412,7 @@ Scanned ${components.length} component(s) under src/ for Correctness/Security/Ar
|
|
|
417
412
|
warnings
|
|
418
413
|
};
|
|
419
414
|
}
|
|
420
|
-
|
|
421
|
-
//#region src/minify-flag.ts
|
|
415
|
+
// src/minify-flag.ts
|
|
422
416
|
/**
|
|
423
417
|
* performance/minify-disabled fact from the evaluated Vite user config (the value the plugin's
|
|
424
418
|
* `config` hook sees) — exact, so it also catches function-form/conditional configs the CLI's
|
|
@@ -449,8 +443,7 @@ async function resolveMinifyDisabled(minify, configFile, root) {
|
|
|
449
443
|
...suppressions !== void 0 ? { suppressions } : {}
|
|
450
444
|
};
|
|
451
445
|
}
|
|
452
|
-
|
|
453
|
-
//#region src/ui/snapshot.ts
|
|
446
|
+
// src/ui/snapshot.ts
|
|
454
447
|
/**
|
|
455
448
|
* `docsUrl` on an ingested (live) result flows into `/data.json` responses, which the
|
|
456
449
|
* client script renders into an <a href> without going through `renderAppShell`'s own
|
|
@@ -495,8 +488,7 @@ function buildSnapshot(store, config, meta, staticFailedRuleIds) {
|
|
|
495
488
|
meta
|
|
496
489
|
};
|
|
497
490
|
}
|
|
498
|
-
|
|
499
|
-
//#region src/ui/middleware.ts
|
|
491
|
+
// src/ui/middleware.ts
|
|
500
492
|
const SEVERITIES = /* @__PURE__ */ new Set([
|
|
501
493
|
"critical",
|
|
502
494
|
"warning",
|
|
@@ -621,8 +613,7 @@ function installUiMiddleware(server, config, version, store, coreVersion, getSta
|
|
|
621
613
|
}
|
|
622
614
|
});
|
|
623
615
|
}
|
|
624
|
-
|
|
625
|
-
//#region src/ui/store.ts
|
|
616
|
+
// src/ui/store.ts
|
|
626
617
|
/**
|
|
627
618
|
* Merge rule (design doc §2): for a route with a live result set, static results whose
|
|
628
619
|
* rule id appears in the live payload are replaced by the live ones — the handle reports
|
|
@@ -722,8 +713,7 @@ function createStore() {
|
|
|
722
713
|
}
|
|
723
714
|
};
|
|
724
715
|
}
|
|
725
|
-
|
|
726
|
-
//#region src/ui/analysis.ts
|
|
716
|
+
// src/ui/analysis.ts
|
|
727
717
|
/**
|
|
728
718
|
* Apply `svelte-vitals-suppressions.json` to the whole-project layer, same entries as the build
|
|
729
719
|
* gate (see `applySourceSuppressions`). A malformed file is a warning here, not an error: dev
|
|
@@ -822,8 +812,7 @@ function createAnalysisRunner(opts) {
|
|
|
822
812
|
}
|
|
823
813
|
};
|
|
824
814
|
}
|
|
825
|
-
|
|
826
|
-
//#region src/plugin.ts
|
|
815
|
+
// src/plugin.ts
|
|
827
816
|
const CONFIG_BASENAMES = /* @__PURE__ */ new Set([
|
|
828
817
|
"svelte.config.js",
|
|
829
818
|
"svelte.config.ts",
|
|
@@ -953,7 +942,50 @@ function svelteVitals(options = {}) {
|
|
|
953
942
|
let minify;
|
|
954
943
|
let configFile;
|
|
955
944
|
let ssrBuild = false;
|
|
945
|
+
let appBuild = false;
|
|
956
946
|
let prerenderDir = DEFAULT_PRERENDER_DIR;
|
|
947
|
+
const readPrerenderDir = (base, outDir) => {
|
|
948
|
+
const out = outDir ? resolve(base, outDir) : "";
|
|
949
|
+
if (/[\\/]output[\\/](?:server|client)$/.test(out)) prerenderDir = join(dirname(out), "prerendered/pages");
|
|
950
|
+
};
|
|
951
|
+
/** `afterPrerender`: an absent pages dir means "nothing was prerendered" rather than "not yet". */
|
|
952
|
+
const analyzeAndGate = async (afterPrerender) => {
|
|
953
|
+
const pagesDir = options.prerenderDir ? options.prerenderDir : prerenderDir;
|
|
954
|
+
const resolved = isAbsolute(pagesDir) ? pagesDir : join(root, pagesDir);
|
|
955
|
+
if (!afterPrerender && !existsSync(resolved)) return;
|
|
956
|
+
const resolvedConfig = {
|
|
957
|
+
...await resolveConfig(root, options),
|
|
958
|
+
suppressions: loadSuppressions(root)
|
|
959
|
+
};
|
|
960
|
+
let result;
|
|
961
|
+
try {
|
|
962
|
+
const viteMinifyDisabled = await resolveMinifyDisabled(minify, configFile, root);
|
|
963
|
+
result = await analyze(resolved, root, options, viteMinifyDisabled ? { viteMinifyDisabled } : void 0, resolvedConfig);
|
|
964
|
+
} catch (err) {
|
|
965
|
+
warn(`svelte-vitals: skipped — analysis failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
for (const w of result.warnings) warn(`svelte-vitals: ${w}`);
|
|
969
|
+
if (result.routeCount === 0) {
|
|
970
|
+
if (!afterPrerender) return;
|
|
971
|
+
warn(`svelte-vitals: no prerendered pages found in ${relative(root, resolved) || "."} — route analysis skipped; the source scan still ran. Prerender routes to check their HTML, or run \`npx svelte-vitals\` to check every route from source.`);
|
|
972
|
+
}
|
|
973
|
+
if (options.report !== false) {
|
|
974
|
+
if (options.report === "json") {
|
|
975
|
+
for (const chunk of result.jsonReportChunks()) {
|
|
976
|
+
if (process.stdout.destroyed) break;
|
|
977
|
+
if (!process.stdout.write(chunk)) await once(process.stdout, "drain");
|
|
978
|
+
}
|
|
979
|
+
process.stdout.write("\n");
|
|
980
|
+
} else console.log(result.consoleReport);
|
|
981
|
+
}
|
|
982
|
+
if (options.outFile) {
|
|
983
|
+
const outPath = isAbsolute(options.outFile) ? options.outFile : join(root, options.outFile);
|
|
984
|
+
await mkdir(dirname(outPath), { recursive: true });
|
|
985
|
+
await writeFile(outPath, result.jsonReportChunks());
|
|
986
|
+
}
|
|
987
|
+
if (result.failed) throw new Error(`svelte-vitals: build failed — findings at or above "${result.failOn}".`);
|
|
988
|
+
};
|
|
957
989
|
const buildPlugin = {
|
|
958
990
|
name: "svelte-vitals",
|
|
959
991
|
apply: "build",
|
|
@@ -965,45 +997,21 @@ function svelteVitals(options = {}) {
|
|
|
965
997
|
if (!options.cwd) root = config.root;
|
|
966
998
|
configFile = config.configFile;
|
|
967
999
|
ssrBuild = Boolean(config.build?.ssr);
|
|
968
|
-
|
|
969
|
-
|
|
1000
|
+
appBuild = Boolean(config.builder);
|
|
1001
|
+
readPrerenderDir(config.root ?? root, config.build?.outDir);
|
|
970
1002
|
},
|
|
971
1003
|
async closeBundle() {
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
result = await analyze(resolved, root, options, viteMinifyDisabled ? { viteMinifyDisabled } : void 0, resolvedConfig);
|
|
983
|
-
} catch (err) {
|
|
984
|
-
warn(`svelte-vitals: skipped — analysis failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
985
|
-
return;
|
|
986
|
-
}
|
|
987
|
-
for (const w of result.warnings) warn(`svelte-vitals: ${w}`);
|
|
988
|
-
if (result.routeCount === 0) {
|
|
989
|
-
if (!ssrBuild) return;
|
|
990
|
-
warn(`svelte-vitals: no prerendered pages found in ${relative(root, resolved) || "."} — route analysis skipped; the source scan still ran. Prerender routes to check their HTML, or run \`npx svelte-vitals\` to check every route from source.`);
|
|
991
|
-
}
|
|
992
|
-
if (options.report !== false) {
|
|
993
|
-
if (options.report === "json") {
|
|
994
|
-
for (const chunk of result.jsonReportChunks()) {
|
|
995
|
-
if (process.stdout.destroyed) break;
|
|
996
|
-
if (!process.stdout.write(chunk)) await once(process.stdout, "drain");
|
|
997
|
-
}
|
|
998
|
-
process.stdout.write("\n");
|
|
999
|
-
} else console.log(result.consoleReport);
|
|
1000
|
-
}
|
|
1001
|
-
if (options.outFile) {
|
|
1002
|
-
const outPath = isAbsolute(options.outFile) ? options.outFile : join(root, options.outFile);
|
|
1003
|
-
await mkdir(dirname(outPath), { recursive: true });
|
|
1004
|
-
await writeFile(outPath, result.jsonReportChunks());
|
|
1004
|
+
if (appBuild) return;
|
|
1005
|
+
await analyzeAndGate(ssrBuild);
|
|
1006
|
+
},
|
|
1007
|
+
buildApp: {
|
|
1008
|
+
order: "post",
|
|
1009
|
+
async handler(builder) {
|
|
1010
|
+
if (!appBuild) return;
|
|
1011
|
+
readPrerenderDir(root, builder.environments.ssr?.config.build.outDir);
|
|
1012
|
+
minify = builder.environments.client?.config.build.minify ?? minify;
|
|
1013
|
+
await analyzeAndGate(true);
|
|
1005
1014
|
}
|
|
1006
|
-
if (result.failed) throw new Error(`svelte-vitals: build failed — findings at or above "${result.failOn}".`);
|
|
1007
1015
|
}
|
|
1008
1016
|
};
|
|
1009
1017
|
if (options.ui === false) return buildPlugin;
|
|
@@ -1078,5 +1086,4 @@ function svelteVitals(options = {}) {
|
|
|
1078
1086
|
}
|
|
1079
1087
|
}];
|
|
1080
1088
|
}
|
|
1081
|
-
//#endregion
|
|
1082
1089
|
export { svelteVitals };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ASIDE_DEMOTING_TAGS, IDREF_ATTRS, NAMING_ATTRS, SECTIONING_TAGS, decodeFragmentId, isClassicScriptType, isSvgSrc, isTopFragment, resolveLandmark, splitTokens, stripTextDirective } from "@svelte-vitals/core/internal";
|
|
2
2
|
import { parse } from "node-html-parser";
|
|
3
|
-
|
|
3
|
+
// src/providers/rendered/parse-html.ts
|
|
4
4
|
/** The <img> is its `<picture>`'s fallback and a sibling `<source>` carries the srcset. */
|
|
5
5
|
function pictureOffersSrcset(img) {
|
|
6
6
|
const parent = img.parentNode;
|
|
@@ -202,8 +202,7 @@ function toOccurrenceMap(keys, file) {
|
|
|
202
202
|
});
|
|
203
203
|
return out;
|
|
204
204
|
}
|
|
205
|
-
|
|
206
|
-
//#region src/loopback.ts
|
|
205
|
+
// src/loopback.ts
|
|
207
206
|
/** Only the local dev server hosts the ingest endpoint, so never POST off-box. */
|
|
208
207
|
function isLoopbackOrigin(origin) {
|
|
209
208
|
try {
|
|
@@ -234,5 +233,4 @@ function isSameOrigin(origin, host, secure = false) {
|
|
|
234
233
|
function effectivePort(url) {
|
|
235
234
|
return url.port || (url.protocol === "https:" ? "443" : "80");
|
|
236
235
|
}
|
|
237
|
-
//#endregion
|
|
238
236
|
export { toOccurrenceMap as i, isSameOrigin as n, parseHtmlHead as r, isLoopbackOrigin as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svelte-vitals/vite",
|
|
3
|
-
"version": "0.55.
|
|
3
|
+
"version": "0.55.5",
|
|
4
4
|
"description": "Vite/SvelteKit plugin for svelte-vitals — analyzes prerendered HTML during vite build, plus a live dev dashboard.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"esm-env": "^1.2.2",
|
|
43
|
-
"node-html-parser": "^9.0.
|
|
43
|
+
"node-html-parser": "^9.0.7"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@svelte-vitals/core": "^0.55.
|
|
47
|
-
"@sveltejs/kit": "^2.0.0",
|
|
48
|
-
"svelte-vitals": "^0.55.
|
|
46
|
+
"@svelte-vitals/core": "^0.55.5",
|
|
47
|
+
"@sveltejs/kit": "^2.0.0 || ^3.0.0",
|
|
48
|
+
"svelte-vitals": "^0.55.5",
|
|
49
49
|
"vite": "^5.0.3 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@svelte-vitals/core": "0.55.
|
|
58
|
-
"@sveltejs/kit": "^2.70.
|
|
59
|
-
"@types/node": "^24.19.
|
|
60
|
-
"happy-dom": "^
|
|
61
|
-
"svelte": "^5.57.
|
|
62
|
-
"svelte-vitals": "0.55.
|
|
63
|
-
"vite": "^8.3.
|
|
57
|
+
"@svelte-vitals/core": "0.55.5",
|
|
58
|
+
"@sveltejs/kit": "^2.70.4",
|
|
59
|
+
"@types/node": "^24.19.2",
|
|
60
|
+
"happy-dom": "^21.0.4",
|
|
61
|
+
"svelte": "^5.57.3",
|
|
62
|
+
"svelte-vitals": "0.55.5",
|
|
63
|
+
"vite": "^8.3.6"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"build": "tsdown",
|