hyperframes 0.7.12 → 0.7.13
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/cli.js +23 -6
- package/dist/studio/assets/{index-D3CdlGSD.js → index-9HfU4WBf.js} +2 -2
- package/dist/studio/assets/{index-6Gsr598X.js → index-BMBWKCJX.js} +1 -1
- package/dist/studio/assets/{index-C8PxbQ6Q.js → index-CmULNmgb.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -50,7 +50,7 @@ var VERSION;
|
|
|
50
50
|
var init_version = __esm({
|
|
51
51
|
"src/version.ts"() {
|
|
52
52
|
"use strict";
|
|
53
|
-
VERSION = true ? "0.7.
|
|
53
|
+
VERSION = true ? "0.7.13" : "0.0.0-dev";
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -25406,7 +25406,23 @@ function findLeakedTextInHead(rawSource) {
|
|
|
25406
25406
|
}
|
|
25407
25407
|
return null;
|
|
25408
25408
|
}
|
|
25409
|
-
|
|
25409
|
+
function findLeakedTextBetweenHeadAndBody(rawSource) {
|
|
25410
|
+
const boundaryMatches = [...rawSource.matchAll(AFTER_HEAD_BEFORE_BODY_PATTERN)];
|
|
25411
|
+
for (const match of boundaryMatches) {
|
|
25412
|
+
const leakedText = findLeakedTextInHeadContent(match[1] ?? "");
|
|
25413
|
+
if (leakedText) return leakedText;
|
|
25414
|
+
}
|
|
25415
|
+
return null;
|
|
25416
|
+
}
|
|
25417
|
+
function findLeakedTextBeforeCompositionRoot(source, rootTag) {
|
|
25418
|
+
if (!rootTag || rootTag.name === "body") return null;
|
|
25419
|
+
const bodyOpenMatch = /<body\b[^>]*>/i.exec(source);
|
|
25420
|
+
const prefixStart = bodyOpenMatch ? bodyOpenMatch.index + bodyOpenMatch[0].length : 0;
|
|
25421
|
+
const prefixEnd = rootTag.index;
|
|
25422
|
+
if (prefixEnd <= prefixStart) return null;
|
|
25423
|
+
return findLeakedTextInHeadContent(source.slice(prefixStart, prefixEnd));
|
|
25424
|
+
}
|
|
25425
|
+
var HEAD_BLOCKS_TO_IGNORE_PATTERN, HTML_TAG_PATTERN, HEAD_CONTENT_PATTERN, AFTER_HEAD_BEFORE_BODY_PATTERN, STRAY_HEAD_CLOSE_PATTERN, MARKDOWN_CODE_FENCE_PATTERN, ORPHAN_CSS_AT_RULE_PATTERN, ORPHAN_CSS_RULE_PATTERN, coreRules;
|
|
25410
25426
|
var init_core = __esm({
|
|
25411
25427
|
"../core/src/lint/rules/core.ts"() {
|
|
25412
25428
|
"use strict";
|
|
@@ -25414,6 +25430,7 @@ var init_core = __esm({
|
|
|
25414
25430
|
HEAD_BLOCKS_TO_IGNORE_PATTERN = /<(?:style|script|template|title|noscript)\b[^>]*>[\s\S]*?<\/(?:style|script|template|title|noscript)(?:\s[^>]*)?>/gi;
|
|
25415
25431
|
HTML_TAG_PATTERN = /<[^>]+>/g;
|
|
25416
25432
|
HEAD_CONTENT_PATTERN = /<head\b[^>]*>([\s\S]*?)(?:<\/head>|<body\b|$)/gi;
|
|
25433
|
+
AFTER_HEAD_BEFORE_BODY_PATTERN = /<\/head(?:\s[^>]*)?>([\s\S]*?)(?=<body\b|$)/gi;
|
|
25417
25434
|
STRAY_HEAD_CLOSE_PATTERN = /<\/(?:style|script)(?:\s[^>]*)?>/i;
|
|
25418
25435
|
MARKDOWN_CODE_FENCE_PATTERN = /```[^\r\n`]*(?:\r?\n|$)[\s\S]*?```/i;
|
|
25419
25436
|
ORPHAN_CSS_AT_RULE_PATTERN = /(?:^|\s)@(?:container|font-face|keyframes|layer|media|page|property|scope|supports)[^{<]*\{[\s\S]*?:[\s\S]*?\}/i;
|
|
@@ -25445,15 +25462,15 @@ var init_core = __esm({
|
|
|
25445
25462
|
return findings;
|
|
25446
25463
|
},
|
|
25447
25464
|
// head_leaked_text
|
|
25448
|
-
({ source }) => {
|
|
25449
|
-
const snippet = findLeakedTextInHead(source);
|
|
25465
|
+
({ source, rootTag }) => {
|
|
25466
|
+
const snippet = findLeakedTextInHead(source) ?? findLeakedTextBetweenHeadAndBody(source) ?? findLeakedTextBeforeCompositionRoot(source, rootTag);
|
|
25450
25467
|
if (!snippet) return [];
|
|
25451
25468
|
return [
|
|
25452
25469
|
{
|
|
25453
25470
|
code: "head_leaked_text",
|
|
25454
25471
|
severity: "error",
|
|
25455
|
-
message: "Detected leaked code or CSS text
|
|
25456
|
-
fixHint: "Move CSS into a single `<style>...</style>` block and remove stray close tags, markdown fences, or code text from `<head
|
|
25472
|
+
message: "Detected leaked code or CSS text around the document `<head>` or before the composition root. Browsers render this as visible text in the video.",
|
|
25473
|
+
fixHint: "Move CSS into a single `<style>...</style>` block and remove stray close tags, markdown fences, or code text from `<head>`, the `</head>`/`<body>` boundary, or the pre-root body prefix.",
|
|
25457
25474
|
snippet: truncateSnippet(snippet)
|
|
25458
25475
|
}
|
|
25459
25476
|
];
|