@hyperframes/inspector 0.9.31 → 0.9.32
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/server.js +10 -6
- package/dist/service.js +126 -26
- package/dist/types/inspector/src/pageServer.d.ts +1 -0
- package/package.json +3 -3
package/dist/server.js
CHANGED
|
@@ -5,6 +5,15 @@ import { createRequire } from "node:module"; const require = createRequire(impor
|
|
|
5
5
|
import { createServer } from "node:http";
|
|
6
6
|
import { readFileSync, realpathSync } from "node:fs";
|
|
7
7
|
import { pathToFileURL } from "node:url";
|
|
8
|
+
|
|
9
|
+
// src/pageServer.ts
|
|
10
|
+
function isLoopbackHost(host) {
|
|
11
|
+
if (!host) return true;
|
|
12
|
+
const name = host.replace(/:\d+$/, "").replace(/^\[|\]$/g, "").toLowerCase();
|
|
13
|
+
return name === "127.0.0.1" || name === "localhost" || name === "::1";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/server.ts
|
|
8
17
|
import { Inspector } from "./service.js";
|
|
9
18
|
var version = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
10
19
|
var MAX_BODY = 64e3;
|
|
@@ -22,11 +31,6 @@ function failureOf(error) {
|
|
|
22
31
|
if (!(error instanceof Error)) return { status: 500, message: "internal_error" };
|
|
23
32
|
return { status: message === "no-composition" ? 404 : 400, message };
|
|
24
33
|
}
|
|
25
|
-
function loopback(host) {
|
|
26
|
-
if (!host) return true;
|
|
27
|
-
const name = host.replace(/:\d+$/, "").replace(/^\[|\]$/g, "").toLowerCase();
|
|
28
|
-
return name === "127.0.0.1" || name === "localhost" || name === "::1";
|
|
29
|
-
}
|
|
30
34
|
function readBody(req) {
|
|
31
35
|
return new Promise((resolve, reject) => {
|
|
32
36
|
const chunks = [];
|
|
@@ -62,7 +66,7 @@ function createInspectorServer(project) {
|
|
|
62
66
|
const inspector = new Inspector(project);
|
|
63
67
|
const server = createServer(async (req, res) => {
|
|
64
68
|
res.setHeader("Content-Type", "application/json");
|
|
65
|
-
if (!
|
|
69
|
+
if (!isLoopbackHost(req.headers.host)) {
|
|
66
70
|
send(res, 403, "host_not_allowed");
|
|
67
71
|
return;
|
|
68
72
|
}
|
package/dist/service.js
CHANGED
|
@@ -545,7 +545,7 @@ var require_parse = __commonJS({
|
|
|
545
545
|
function isWhitespace(c) {
|
|
546
546
|
return c === 32 || c === 9 || c === 10 || c === 12 || c === 13;
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function parse18(selector) {
|
|
549
549
|
var subselects2 = [];
|
|
550
550
|
var endIndex = parseSelector(subselects2, "".concat(selector), 0);
|
|
551
551
|
if (endIndex < selector.length) {
|
|
@@ -553,7 +553,7 @@ var require_parse = __commonJS({
|
|
|
553
553
|
}
|
|
554
554
|
return subselects2;
|
|
555
555
|
}
|
|
556
|
-
exports.parse =
|
|
556
|
+
exports.parse = parse18;
|
|
557
557
|
function parseSelector(subselects2, selector, selectorIndex) {
|
|
558
558
|
var tokens2 = [];
|
|
559
559
|
function getName3(offset) {
|
|
@@ -1905,7 +1905,7 @@ var require_CSSDocumentRule = __commonJS({
|
|
|
1905
1905
|
var require_parse2 = __commonJS({
|
|
1906
1906
|
"../../node_modules/.bun/cssom@0.5.0/node_modules/cssom/lib/parse.js"(exports) {
|
|
1907
1907
|
var CSSOM = {};
|
|
1908
|
-
CSSOM.parse = function
|
|
1908
|
+
CSSOM.parse = function parse18(token) {
|
|
1909
1909
|
var i = 0;
|
|
1910
1910
|
var state = "before-selector";
|
|
1911
1911
|
var index;
|
|
@@ -8613,7 +8613,7 @@ var require_esprima2 = __commonJS({
|
|
|
8613
8613
|
var jsx_parser_1 = __webpack_require__(3);
|
|
8614
8614
|
var parser_1 = __webpack_require__(8);
|
|
8615
8615
|
var tokenizer_1 = __webpack_require__(15);
|
|
8616
|
-
function
|
|
8616
|
+
function parse18(code, options, delegate) {
|
|
8617
8617
|
var commentHandler = null;
|
|
8618
8618
|
var proxyDelegate = function(node, metadata) {
|
|
8619
8619
|
if (delegate) {
|
|
@@ -8658,17 +8658,17 @@ var require_esprima2 = __commonJS({
|
|
|
8658
8658
|
}
|
|
8659
8659
|
return ast;
|
|
8660
8660
|
}
|
|
8661
|
-
exports2.parse =
|
|
8661
|
+
exports2.parse = parse18;
|
|
8662
8662
|
function parseModule(code, options, delegate) {
|
|
8663
8663
|
var parsingOptions = options || {};
|
|
8664
8664
|
parsingOptions.sourceType = "module";
|
|
8665
|
-
return
|
|
8665
|
+
return parse18(code, parsingOptions, delegate);
|
|
8666
8666
|
}
|
|
8667
8667
|
exports2.parseModule = parseModule;
|
|
8668
8668
|
function parseScript(code, options, delegate) {
|
|
8669
8669
|
var parsingOptions = options || {};
|
|
8670
8670
|
parsingOptions.sourceType = "script";
|
|
8671
|
-
return
|
|
8671
|
+
return parse18(code, parsingOptions, delegate);
|
|
8672
8672
|
}
|
|
8673
8673
|
exports2.parseScript = parseScript;
|
|
8674
8674
|
function tokenize(code, options, delegate) {
|
|
@@ -14808,7 +14808,7 @@ var require_esprima3 = __commonJS({
|
|
|
14808
14808
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14809
14809
|
exports.parse = void 0;
|
|
14810
14810
|
var util_1 = require_util2();
|
|
14811
|
-
function
|
|
14811
|
+
function parse18(source, options) {
|
|
14812
14812
|
var comments = [];
|
|
14813
14813
|
var ast = require_esprima2().parse(source, {
|
|
14814
14814
|
loc: true,
|
|
@@ -14826,7 +14826,7 @@ var require_esprima3 = __commonJS({
|
|
|
14826
14826
|
}
|
|
14827
14827
|
return ast;
|
|
14828
14828
|
}
|
|
14829
|
-
exports.parse =
|
|
14829
|
+
exports.parse = parse18;
|
|
14830
14830
|
}
|
|
14831
14831
|
});
|
|
14832
14832
|
|
|
@@ -15970,7 +15970,7 @@ var require_parser = __commonJS({
|
|
|
15970
15970
|
var lines_1 = require_lines();
|
|
15971
15971
|
var comments_1 = require_comments();
|
|
15972
15972
|
var util = tslib_1.__importStar(require_util2());
|
|
15973
|
-
function
|
|
15973
|
+
function parse18(source, options) {
|
|
15974
15974
|
options = (0, options_1.normalize)(options);
|
|
15975
15975
|
var lines = (0, lines_1.fromString)(source, options);
|
|
15976
15976
|
var sourceWithoutTabs = lines.toString({
|
|
@@ -16042,7 +16042,7 @@ var require_parser = __commonJS({
|
|
|
16042
16042
|
(0, comments_1.attach)(comments, program.body.length ? file.program : file, lines);
|
|
16043
16043
|
return new TreeCopier(lines, tokens2).copy(file);
|
|
16044
16044
|
}
|
|
16045
|
-
exports.parse =
|
|
16045
|
+
exports.parse = parse18;
|
|
16046
16046
|
var TreeCopier = function TreeCopier2(lines, tokens2) {
|
|
16047
16047
|
(0, tiny_invariant_1.default)(this instanceof TreeCopier2);
|
|
16048
16048
|
this.lines = lines;
|
|
@@ -22279,14 +22279,14 @@ var require_lib2 = __commonJS({
|
|
|
22279
22279
|
super.checkParams(node, false, true);
|
|
22280
22280
|
this.scope.exit();
|
|
22281
22281
|
}
|
|
22282
|
-
forwardNoArrowParamsConversionAt(node,
|
|
22282
|
+
forwardNoArrowParamsConversionAt(node, parse19) {
|
|
22283
22283
|
let result;
|
|
22284
22284
|
if (this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
|
|
22285
22285
|
this.state.noArrowParamsConversionAt.push(this.state.start);
|
|
22286
|
-
result =
|
|
22286
|
+
result = parse19();
|
|
22287
22287
|
this.state.noArrowParamsConversionAt.pop();
|
|
22288
22288
|
} else {
|
|
22289
|
-
result =
|
|
22289
|
+
result = parse19();
|
|
22290
22290
|
}
|
|
22291
22291
|
return result;
|
|
22292
22292
|
}
|
|
@@ -33697,7 +33697,7 @@ var require_lib2 = __commonJS({
|
|
|
33697
33697
|
return result;
|
|
33698
33698
|
}
|
|
33699
33699
|
};
|
|
33700
|
-
function
|
|
33700
|
+
function parse18(input, options) {
|
|
33701
33701
|
var _options;
|
|
33702
33702
|
if (((_options = options) == null ? void 0 : _options.sourceType) === "unambiguous") {
|
|
33703
33703
|
options = Object.assign({}, options);
|
|
@@ -33784,7 +33784,7 @@ var require_lib2 = __commonJS({
|
|
|
33784
33784
|
}
|
|
33785
33785
|
return cls;
|
|
33786
33786
|
}
|
|
33787
|
-
exports.parse =
|
|
33787
|
+
exports.parse = parse18;
|
|
33788
33788
|
exports.parseExpression = parseExpression;
|
|
33789
33789
|
exports.tokTypes = tokTypes;
|
|
33790
33790
|
}
|
|
@@ -56808,6 +56808,38 @@ function gsapCallOffset(script, method) {
|
|
|
56808
56808
|
({ callee }) => callee.type === "MemberExpression" && !callee.computed && callee.object.type === "Identifier" && callee.object.name === "gsap" && callee.property.type === "Identifier" && callee.property.name === method
|
|
56809
56809
|
)?.start;
|
|
56810
56810
|
}
|
|
56811
|
+
var GSAP_ENTRY = /* @__PURE__ */ new Set(["to", "from", "fromTo", "timeline", "set", "registerPlugin"]);
|
|
56812
|
+
var FUNCTION_TYPES2 = /* @__PURE__ */ new Set([
|
|
56813
|
+
"FunctionDeclaration",
|
|
56814
|
+
"FunctionExpression",
|
|
56815
|
+
"ArrowFunctionExpression"
|
|
56816
|
+
]);
|
|
56817
|
+
function gsapRunsWhenScriptRuns(script) {
|
|
56818
|
+
let ast;
|
|
56819
|
+
try {
|
|
56820
|
+
ast = parse32(script.content, {
|
|
56821
|
+
ecmaVersion: "latest",
|
|
56822
|
+
sourceType: "script",
|
|
56823
|
+
allowReturnOutsideFunction: true
|
|
56824
|
+
});
|
|
56825
|
+
} catch {
|
|
56826
|
+
return false;
|
|
56827
|
+
}
|
|
56828
|
+
let early = false;
|
|
56829
|
+
ancestor(ast, {
|
|
56830
|
+
CallExpression: (node, _state, ancestors) => {
|
|
56831
|
+
const { callee } = node;
|
|
56832
|
+
if (early || callee.type !== "MemberExpression" || callee.computed || callee.object.type !== "Identifier" || callee.object.name !== "gsap" || callee.property.type !== "Identifier" || !GSAP_ENTRY.has(callee.property.name))
|
|
56833
|
+
return;
|
|
56834
|
+
early = ancestors.every((a, i) => {
|
|
56835
|
+
if (!FUNCTION_TYPES2.has(a.type)) return true;
|
|
56836
|
+
const parent = ancestors[i - 1];
|
|
56837
|
+
return parent?.type === "CallExpression" && parent.callee === a;
|
|
56838
|
+
});
|
|
56839
|
+
}
|
|
56840
|
+
});
|
|
56841
|
+
return early;
|
|
56842
|
+
}
|
|
56811
56843
|
function containingCallOffset(script, tokenOffset) {
|
|
56812
56844
|
let start;
|
|
56813
56845
|
for (const call of callsFor(script)) {
|
|
@@ -56905,7 +56937,7 @@ function climbsAboveRoot(fileDepth, path) {
|
|
|
56905
56937
|
function extractCssSelectors(css) {
|
|
56906
56938
|
const out = [];
|
|
56907
56939
|
const noComments = css.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
56908
|
-
const ruleHeader = /([^{}]+)\{/g;
|
|
56940
|
+
const ruleHeader = /(?<![^{}])([^{}]+)\{/g;
|
|
56909
56941
|
let m;
|
|
56910
56942
|
while ((m = ruleHeader.exec(noComments)) !== null) {
|
|
56911
56943
|
const header = (m[1] ?? "").trim();
|
|
@@ -56930,7 +56962,7 @@ function collectHeavyOverlayHooks(styles) {
|
|
|
56930
56962
|
const ids = /* @__PURE__ */ new Set();
|
|
56931
56963
|
for (const style of styles) {
|
|
56932
56964
|
const noComments = style.content.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
56933
|
-
const ruleWithBody = /([^{}]+)\{([^{}]*)\}/g;
|
|
56965
|
+
const ruleWithBody = /(?<![^{}])([^{}]+)\{([^{}]*)\}/g;
|
|
56934
56966
|
let m;
|
|
56935
56967
|
while ((m = ruleWithBody.exec(noComments)) !== null) {
|
|
56936
56968
|
const header = (m[1] ?? "").trim();
|
|
@@ -57164,7 +57196,7 @@ function canvasZoomInRule(header, body, matchesCanvas) {
|
|
|
57164
57196
|
function stylesheetCanvasZoomHits(styles, matchesCanvas) {
|
|
57165
57197
|
const hits = [];
|
|
57166
57198
|
for (const style of styles) {
|
|
57167
|
-
const ruleWithBody = /([^{}]+)\{([^{}]*)\}/g;
|
|
57199
|
+
const ruleWithBody = /(?<![^{}])([^{}]+)\{([^{}]*)\}/g;
|
|
57168
57200
|
const content = stripCssComments(style.content);
|
|
57169
57201
|
const allowNewHits = style.attrs.trim() === "" && !content.includes("@");
|
|
57170
57202
|
let match;
|
|
@@ -57331,7 +57363,7 @@ function stackingContextSelectors(styles) {
|
|
|
57331
57363
|
const selectors = /* @__PURE__ */ new Set();
|
|
57332
57364
|
for (const style of styles) {
|
|
57333
57365
|
const content = stripCssComments(style.content);
|
|
57334
|
-
const rule = /([^{}]+)\{([^{}]*)\}/g;
|
|
57366
|
+
const rule = /(?<![^{}])([^{}]+)\{([^{}]*)\}/g;
|
|
57335
57367
|
let match;
|
|
57336
57368
|
while ((match = rule.exec(content)) !== null) {
|
|
57337
57369
|
if (!STACKING_CONTEXT_DECLARATION.test(match[2] ?? "")) continue;
|
|
@@ -58496,10 +58528,31 @@ function styleLooksFullFrameOverlay(style) {
|
|
|
58496
58528
|
const coversFrame = cssZero(readStyleProperty(style, "inset")) || cssZero(readStyleProperty(style, "top")) && cssZero(readStyleProperty(style, "right")) && cssZero(readStyleProperty(style, "bottom")) && cssZero(readStyleProperty(style, "left"));
|
|
58497
58529
|
return coversFrame && styleHasOpaqueBackground(style);
|
|
58498
58530
|
}
|
|
58531
|
+
function styleRuleBodies(css) {
|
|
58532
|
+
const out = [];
|
|
58533
|
+
let start = 0;
|
|
58534
|
+
let close = 0;
|
|
58535
|
+
while (start < css.length) {
|
|
58536
|
+
let brace = start;
|
|
58537
|
+
while (brace < css.length && css[brace] !== "{" && css[brace] !== "}") brace++;
|
|
58538
|
+
if (brace === css.length) break;
|
|
58539
|
+
if (css[brace] === "{" && brace > start) {
|
|
58540
|
+
if (close !== -1 && close <= brace) close = css.indexOf("}", brace + 1);
|
|
58541
|
+
if (close === -1) break;
|
|
58542
|
+
if (close > brace + 1) {
|
|
58543
|
+
out.push([css.slice(start, brace), css.slice(brace + 1, close)]);
|
|
58544
|
+
start = close + 1;
|
|
58545
|
+
continue;
|
|
58546
|
+
}
|
|
58547
|
+
}
|
|
58548
|
+
start = brace + 1;
|
|
58549
|
+
}
|
|
58550
|
+
return out;
|
|
58551
|
+
}
|
|
58499
58552
|
function collectSimpleStyleRules(styles) {
|
|
58500
58553
|
const rules = /* @__PURE__ */ new Map();
|
|
58501
58554
|
for (const style of styles) {
|
|
58502
|
-
for (const [
|
|
58555
|
+
for (const [selectorList, body] of styleRuleBodies(style.content)) {
|
|
58503
58556
|
if (!selectorList || !body) continue;
|
|
58504
58557
|
for (const selector of selectorList.split(",")) {
|
|
58505
58558
|
const token = selector.trim();
|
|
@@ -58820,6 +58873,21 @@ function expressionReachesMeasurement(expression, measuring) {
|
|
|
58820
58873
|
}
|
|
58821
58874
|
return false;
|
|
58822
58875
|
}
|
|
58876
|
+
var LINE_TERMINATOR = /[\n\r\u2028\u2029]/;
|
|
58877
|
+
function matchesTemplateParts(id, parts) {
|
|
58878
|
+
const first = parts[0] ?? "";
|
|
58879
|
+
const last = parts[parts.length - 1] ?? "";
|
|
58880
|
+
if (parts.length === 1) return id === first;
|
|
58881
|
+
if (!id.startsWith(first)) return false;
|
|
58882
|
+
let at2 = first.length;
|
|
58883
|
+
for (const part of parts.slice(1, -1)) {
|
|
58884
|
+
const found = id.indexOf(part, at2);
|
|
58885
|
+
if (found === -1 || LINE_TERMINATOR.test(id.slice(at2, found))) return false;
|
|
58886
|
+
at2 = found + part.length;
|
|
58887
|
+
}
|
|
58888
|
+
const end = id.length - last.length;
|
|
58889
|
+
return end >= at2 && id.endsWith(last) && !LINE_TERMINATOR.test(id.slice(at2, end));
|
|
58890
|
+
}
|
|
58823
58891
|
function resolveScriptElementTokens(source, tags) {
|
|
58824
58892
|
const documentIds = tags.map((tag) => readAttr(tag.raw, "id")).filter((id) => id !== null);
|
|
58825
58893
|
const tokensByVar = /* @__PURE__ */ new Map();
|
|
@@ -58839,9 +58907,8 @@ function resolveScriptElementTokens(source, tags) {
|
|
|
58839
58907
|
const template = match[2] ?? "";
|
|
58840
58908
|
const staticParts = template.split(/\$\{[^}]*\}/);
|
|
58841
58909
|
if (staticParts.every((part) => part === "")) continue;
|
|
58842
|
-
const idPattern = new RegExp(`^${staticParts.map(escapeRegExp22).join(".*")}$`);
|
|
58843
58910
|
for (const id of documentIds) {
|
|
58844
|
-
if (
|
|
58911
|
+
if (matchesTemplateParts(id, staticParts)) add2(match[1] ?? "", `#${id}`);
|
|
58845
58912
|
}
|
|
58846
58913
|
}
|
|
58847
58914
|
for (const match of source.matchAll(
|
|
@@ -59229,6 +59296,28 @@ ${right.raw}`)
|
|
|
59229
59296
|
(m) => isGsapCoreSrc(m[1] ?? "")
|
|
59230
59297
|
) || /\/\*!\s*\*\s*GSAP\s+\d/.test(t) || /Missing plugin\? gsap\.registerPlugin\(\)/.test(t) || /\b_gsScope\b/.test(t)
|
|
59231
59298
|
);
|
|
59299
|
+
if (usesGsap && hasGsapScript && !hasInlineGsap && !canInheritGsapFromHost) {
|
|
59300
|
+
const classic = (s) => {
|
|
59301
|
+
const tag = `<script ${s.attrs}>`;
|
|
59302
|
+
return (readDecodedAttr(tag, "type") ?? "").toLowerCase() !== "module" && readDecodedAttr(tag, "defer") === null && readDecodedAttr(tag, "async") === null;
|
|
59303
|
+
};
|
|
59304
|
+
const firstUse = scripts.find(
|
|
59305
|
+
(s) => !/\bsrc\s*=/.test(s.attrs) && (readDecodedAttr(`<script ${s.attrs}>`, "type") ?? "").toLowerCase() !== "module" && gsapRunsWhenScriptRuns(s)
|
|
59306
|
+
);
|
|
59307
|
+
const firstGsap = scripts.find(
|
|
59308
|
+
(s) => classic(s) && isGsapCoreSrc(readAttr(`<script ${s.attrs}>`, "src") || "")
|
|
59309
|
+
);
|
|
59310
|
+
if (firstUse && (!firstGsap || firstGsap.index > firstUse.index)) {
|
|
59311
|
+
return [
|
|
59312
|
+
{
|
|
59313
|
+
code: "gsap_loaded_after_use",
|
|
59314
|
+
severity: "error",
|
|
59315
|
+
message: "A script calls gsap before the GSAP script has run, so gsap is not there yet and its timeline never registers.",
|
|
59316
|
+
fixHint: "Move the GSAP <script src> above the first script that uses gsap, without defer or async; the <head> is safest."
|
|
59317
|
+
}
|
|
59318
|
+
];
|
|
59319
|
+
}
|
|
59320
|
+
}
|
|
59232
59321
|
if (!usesGsap || hasGsapScript || hasInlineGsap || canInheritGsapFromHost) return [];
|
|
59233
59322
|
return [
|
|
59234
59323
|
{
|
|
@@ -59860,7 +59949,7 @@ ${other.raw}`)
|
|
|
59860
59949
|
const tagsByToken = indexTagsByToken(tags);
|
|
59861
59950
|
const multiDashTokens = /* @__PURE__ */ new Set();
|
|
59862
59951
|
for (const style of styles) {
|
|
59863
|
-
for (const [
|
|
59952
|
+
for (const [selectorList, body] of styleRuleBodies(style.content)) {
|
|
59864
59953
|
if (!selectorList || !body) continue;
|
|
59865
59954
|
const value = readStyleProperty(body, "stroke-dasharray");
|
|
59866
59955
|
if (!value || !isMultiComponentDasharray(value)) continue;
|
|
@@ -62069,7 +62158,7 @@ ${AUTHORED_SOURCE_END}`
|
|
|
62069
62158
|
}
|
|
62070
62159
|
|
|
62071
62160
|
// ../core/src/safePath.ts
|
|
62072
|
-
import { resolve as resolve5, sep as sep2, join as join5, dirname as dirname3, basename, relative as relative3, isAbsolute } from "node:path";
|
|
62161
|
+
import { resolve as resolve5, sep as sep2, join as join5, dirname as dirname3, basename, relative as relative3, isAbsolute, parse as parse17 } from "node:path";
|
|
62073
62162
|
import { lstatSync, mkdirSync, realpathSync as realpathSync2, statSync } from "node:fs";
|
|
62074
62163
|
function realpath(path) {
|
|
62075
62164
|
try {
|
|
@@ -62089,14 +62178,19 @@ function isMissingPath(path) {
|
|
|
62089
62178
|
);
|
|
62090
62179
|
}
|
|
62091
62180
|
}
|
|
62181
|
+
function namesAnotherNetworkRoot(base2, target) {
|
|
62182
|
+
const root = parse17(target).root;
|
|
62183
|
+
return /^[\\/]{2}/.test(root) && root.toLowerCase() !== parse17(base2).root.toLowerCase();
|
|
62184
|
+
}
|
|
62092
62185
|
function isSafePath(base2, resolved) {
|
|
62186
|
+
const target = resolve5(resolved);
|
|
62187
|
+
if (namesAnotherNetworkRoot(resolve5(base2), target)) return false;
|
|
62093
62188
|
let baseReal;
|
|
62094
62189
|
try {
|
|
62095
62190
|
baseReal = realpath(resolve5(base2));
|
|
62096
62191
|
} catch {
|
|
62097
62192
|
return false;
|
|
62098
62193
|
}
|
|
62099
|
-
const target = resolve5(resolved);
|
|
62100
62194
|
const trailing = [];
|
|
62101
62195
|
let probe = target;
|
|
62102
62196
|
for (; ; ) {
|
|
@@ -63995,6 +64089,11 @@ function closeServer(server) {
|
|
|
63995
64089
|
server.removeAllListeners("request");
|
|
63996
64090
|
return closed;
|
|
63997
64091
|
}
|
|
64092
|
+
function isLoopbackHost(host) {
|
|
64093
|
+
if (!host) return true;
|
|
64094
|
+
const name = host.replace(/:\d+$/, "").replace(/^\[|\]$/g, "").toLowerCase();
|
|
64095
|
+
return name === "127.0.0.1" || name === "localhost" || name === "::1";
|
|
64096
|
+
}
|
|
63998
64097
|
|
|
63999
64098
|
// ../core/src/cacheDir.ts
|
|
64000
64099
|
import { homedir } from "node:os";
|
|
@@ -64079,6 +64178,7 @@ var Inspector = class {
|
|
|
64079
64178
|
if (fingerprint(this.project) !== digest)
|
|
64080
64179
|
throw new Error("source_changed_during_load: retry against a stable project");
|
|
64081
64180
|
const server = createServer((req, res) => {
|
|
64181
|
+
if (!isLoopbackHost(req.headers.host)) return void res.writeHead(403).end();
|
|
64082
64182
|
try {
|
|
64083
64183
|
const path = decodeURIComponent(new URL(req.url ?? "/", "http://localhost").pathname);
|
|
64084
64184
|
if (path === "/" || path === "/index.html") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/inspector",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.32",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/heygen-com/hyperframes",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"htmlparser2": "^10.1.0",
|
|
44
44
|
"postcss": "^8.5.8",
|
|
45
45
|
"puppeteer-core": "^25.8.0",
|
|
46
|
-
"@hyperframes/
|
|
47
|
-
"@hyperframes/
|
|
46
|
+
"@hyperframes/parsers": "0.9.32",
|
|
47
|
+
"@hyperframes/core": "0.9.32"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/node": "^25.0.10",
|