@svelte-vitals/vite 0.29.1 → 0.29.3
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.
|
@@ -3,6 +3,29 @@ import { parse } from "node-html-parser";
|
|
|
3
3
|
function attrValue(v) {
|
|
4
4
|
return v !== void 0 && v.trim().length > 0 ? "static" : "absent";
|
|
5
5
|
}
|
|
6
|
+
var JS_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
7
|
+
"application/ecmascript",
|
|
8
|
+
"application/javascript",
|
|
9
|
+
"application/x-ecmascript",
|
|
10
|
+
"application/x-javascript",
|
|
11
|
+
"text/ecmascript",
|
|
12
|
+
"text/javascript",
|
|
13
|
+
"text/javascript1.0",
|
|
14
|
+
"text/javascript1.1",
|
|
15
|
+
"text/javascript1.2",
|
|
16
|
+
"text/javascript1.3",
|
|
17
|
+
"text/javascript1.4",
|
|
18
|
+
"text/javascript1.5",
|
|
19
|
+
"text/jscript",
|
|
20
|
+
"text/livescript",
|
|
21
|
+
"text/x-ecmascript",
|
|
22
|
+
"text/x-javascript"
|
|
23
|
+
]);
|
|
24
|
+
function isClassicScriptType(type) {
|
|
25
|
+
if (type === void 0) return true;
|
|
26
|
+
const normalized = type.trim().toLowerCase();
|
|
27
|
+
return normalized === "" || JS_MIME_TYPES.has(normalized);
|
|
28
|
+
}
|
|
6
29
|
function parseHtmlHead(html) {
|
|
7
30
|
const root = parse(html);
|
|
8
31
|
const head = root.querySelector("head") ?? root;
|
|
@@ -72,7 +95,7 @@ function parseHtmlHead(html) {
|
|
|
72
95
|
}
|
|
73
96
|
const src = script.getAttribute("src");
|
|
74
97
|
if (src) {
|
|
75
|
-
const blocking = !script.hasAttribute("defer") && !script.hasAttribute("async")
|
|
98
|
+
const blocking = isClassicScriptType(type) && !script.hasAttribute("defer") && !script.hasAttribute("async");
|
|
76
99
|
tags.push({
|
|
77
100
|
kind: "script",
|
|
78
101
|
presence: "own",
|
package/dist/hooks/index.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
isLoopbackHost,
|
|
3
3
|
isLoopbackOrigin,
|
|
4
4
|
parseHtmlHead
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-2LDMPITM.js";
|
|
6
6
|
|
|
7
7
|
// src/plugin.ts
|
|
8
8
|
import { existsSync } from "fs";
|
|
@@ -205,14 +205,16 @@ async function resolveConfig(cwd, options) {
|
|
|
205
205
|
}
|
|
206
206
|
async function analyze(prerenderPagesDir, cwd, options, extraProjectFacts, resolved) {
|
|
207
207
|
const { config, warnings } = resolved ?? await resolveConfig(cwd, options);
|
|
208
|
-
const { heads, headings, images, htmlLang } = await
|
|
208
|
+
const [{ heads, headings, images, htmlLang }, components, sourceFiles] = await Promise.all([
|
|
209
|
+
collectRenderedHeads(prerenderPagesDir),
|
|
210
|
+
collectComponentFacts(cwd),
|
|
211
|
+
collectSourceFiles(cwd)
|
|
212
|
+
]);
|
|
209
213
|
const project = {
|
|
210
214
|
...await collectRenderedProject(cwd, htmlLang),
|
|
211
215
|
...extraProjectFacts
|
|
212
216
|
};
|
|
213
|
-
const components = await collectComponentFacts(cwd);
|
|
214
217
|
const kitModules = await collectKitModuleFacts(cwd, project.kitAliases);
|
|
215
|
-
const sourceFiles = await collectSourceFiles(cwd);
|
|
216
218
|
const selected = selectRules(allRules, config);
|
|
217
219
|
const { results: rawResults, examined } = await runRules(selected, {
|
|
218
220
|
heads,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svelte-vitals/vite",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.3",
|
|
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",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"esm-env": "^1.2.2",
|
|
43
43
|
"node-html-parser": "^9.0.1",
|
|
44
44
|
"tinyglobby": "^0.2.17",
|
|
45
|
-
"@svelte-vitals/core": "0.
|
|
46
|
-
"svelte-vitals": "0.44.
|
|
45
|
+
"@svelte-vitals/core": "0.40.1",
|
|
46
|
+
"svelte-vitals": "0.44.3"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@sveltejs/kit": "^2.70.2",
|