one 2.0.0-beta.139.1 → 2.0.0-beta.142.1
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/android/src/main/java/dev/onejs/onenative/OneNativeComposeNodeView.kt +4 -1
- package/dist/cjs/headless-server.cjs +1 -1
- package/dist/cjs/headless-server.native.cjs +4 -4
- package/dist/cjs/headless-server.native.js +4 -4
- package/dist/cjs/headless-server.native.js.map +1 -1
- package/dist/cjs/router/diagnoseRouteLoadFailure.cjs +49 -17
- package/dist/cjs/router/diagnoseRouteLoadFailure.native.cjs +56 -19
- package/dist/cjs/router/diagnoseRouteLoadFailure.native.js +56 -19
- package/dist/cjs/router/diagnoseRouteLoadFailure.native.js.map +1 -1
- package/dist/cjs/server/workerHandler.cjs +9 -5
- package/dist/cjs/server/workerHandler.native.cjs +19 -8
- package/dist/cjs/server/workerHandler.native.js +19 -8
- package/dist/cjs/server/workerHandler.native.js.map +1 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.cjs +8 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.cjs +8 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js +8 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/esm/headless-server.mjs +1 -1
- package/dist/esm/headless-server.mjs.map +1 -1
- package/dist/esm/headless-server.native.js +4 -4
- package/dist/esm/headless-server.native.js.map +1 -1
- package/dist/esm/router/diagnoseRouteLoadFailure.mjs +49 -17
- package/dist/esm/router/diagnoseRouteLoadFailure.mjs.map +1 -1
- package/dist/esm/router/diagnoseRouteLoadFailure.native.js +56 -19
- package/dist/esm/router/diagnoseRouteLoadFailure.native.js.map +1 -1
- package/dist/esm/server/workerHandler.mjs +9 -5
- package/dist/esm/server/workerHandler.mjs.map +1 -1
- package/dist/esm/server/workerHandler.native.js +19 -8
- package/dist/esm/server/workerHandler.native.js.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs +8 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +8 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/ios/OneNativeTabsView.swift +23 -8
- package/package.json +10 -10
- package/src/headless-server.ts +1 -1
- package/src/router/diagnoseRouteLoadFailure.ts +65 -25
- package/src/router/useViteRoutes.tsx +4 -4
- package/src/server/workerHandler.test.ts +106 -0
- package/src/server/workerHandler.ts +24 -8
- package/src/vite/plugins/fileSystemRouterPlugin.tsx +12 -1
- package/types/router/diagnoseRouteLoadFailure.d.ts +14 -5
- package/types/router/diagnoseRouteLoadFailure.d.ts.map +1 -1
- package/types/server/workerHandler.d.ts +3 -2
- package/types/server/workerHandler.d.ts.map +1 -1
- package/types/vite/plugins/fileSystemRouterPlugin.d.ts.map +1 -1
|
@@ -1320,7 +1320,10 @@ private fun RenderComposeNode(
|
|
|
1320
1320
|
) {
|
|
1321
1321
|
val props = node.renderedProps
|
|
1322
1322
|
val style = props.composeStyle
|
|
1323
|
-
|
|
1323
|
+
// dialogs draw in their own window, outside the host or parent placement
|
|
1324
|
+
val kind = node.renderedNodeKind
|
|
1325
|
+
val placement = if (kind == "alertdialog" || kind == "dialog") Modifier else outerModifier
|
|
1326
|
+
val modifier = placement.applyComposeStyle(style).applyReactSemantics(node, props)
|
|
1324
1327
|
val foregroundColor = style.foregroundColor?.let(::Color) ?: resolveColorRole(props.colorRole)
|
|
1325
1328
|
|
|
1326
1329
|
if (foregroundColor != null) {
|
|
@@ -41,7 +41,7 @@ async function createServer(options) {
|
|
|
41
41
|
oneOptions: options.oneOptions,
|
|
42
42
|
routeToBuildInfo: options.buildInfo?.routeToBuildInfo ?? {},
|
|
43
43
|
cssContentsByPath: options.buildInfo?.cssContentsByPath,
|
|
44
|
-
routeMap: options.buildInfo?.routeMap
|
|
44
|
+
routeMap: options.buildInfo?.routeMap,
|
|
45
45
|
preloads: options.buildInfo?.preloads ?? {},
|
|
46
46
|
cssPreloads: options.buildInfo?.cssPreloads ?? {}
|
|
47
47
|
};
|
|
@@ -36,7 +36,7 @@ var import_setServerGlobals = require("./server/setServerGlobals.native.js");
|
|
|
36
36
|
var import_setupBuildOptions = require("./server/setupBuildOptions.native.js");
|
|
37
37
|
var import_workerHandler2 = require("./server/workerHandler.native.js");
|
|
38
38
|
async function createServer(options) {
|
|
39
|
-
var _ref, _ref1, _ref2
|
|
39
|
+
var _ref, _ref1, _ref2;
|
|
40
40
|
var _options_buildInfo, _options_buildInfo1, _options_buildInfo2, _options_buildInfo3, _options_buildInfo4, _options_buildInfo5;
|
|
41
41
|
var manifest = options.manifest || ((_options_buildInfo = options.buildInfo) === null || _options_buildInfo === void 0 ? void 0 : _options_buildInfo.manifest);
|
|
42
42
|
if (!manifest) throw new Error("one/headless-server: manifest is required");
|
|
@@ -45,9 +45,9 @@ async function createServer(options) {
|
|
|
45
45
|
oneOptions: options.oneOptions,
|
|
46
46
|
routeToBuildInfo: (_ref = (_options_buildInfo1 = options.buildInfo) === null || _options_buildInfo1 === void 0 ? void 0 : _options_buildInfo1.routeToBuildInfo) !== null && _ref !== void 0 ? _ref : {},
|
|
47
47
|
cssContentsByPath: (_options_buildInfo2 = options.buildInfo) === null || _options_buildInfo2 === void 0 ? void 0 : _options_buildInfo2.cssContentsByPath,
|
|
48
|
-
routeMap: (
|
|
49
|
-
preloads: (
|
|
50
|
-
cssPreloads: (
|
|
48
|
+
routeMap: (_options_buildInfo3 = options.buildInfo) === null || _options_buildInfo3 === void 0 ? void 0 : _options_buildInfo3.routeMap,
|
|
49
|
+
preloads: (_ref1 = (_options_buildInfo4 = options.buildInfo) === null || _options_buildInfo4 === void 0 ? void 0 : _options_buildInfo4.preloads) !== null && _ref1 !== void 0 ? _ref1 : {},
|
|
50
|
+
cssPreloads: (_ref2 = (_options_buildInfo5 = options.buildInfo) === null || _options_buildInfo5 === void 0 ? void 0 : _options_buildInfo5.cssPreloads) !== null && _ref2 !== void 0 ? _ref2 : {}
|
|
51
51
|
};
|
|
52
52
|
(0, import_setupBuildOptions.setupBuildInfo)(buildInfo);
|
|
53
53
|
(0, import_setServerGlobals.setServerGlobals)();
|
|
@@ -36,7 +36,7 @@ var import_setServerGlobals = require("./server/setServerGlobals.native.js");
|
|
|
36
36
|
var import_setupBuildOptions = require("./server/setupBuildOptions.native.js");
|
|
37
37
|
var import_workerHandler2 = require("./server/workerHandler.native.js");
|
|
38
38
|
async function createServer(options) {
|
|
39
|
-
var _ref, _ref1, _ref2
|
|
39
|
+
var _ref, _ref1, _ref2;
|
|
40
40
|
var _options_buildInfo, _options_buildInfo1, _options_buildInfo2, _options_buildInfo3, _options_buildInfo4, _options_buildInfo5;
|
|
41
41
|
var manifest = options.manifest || ((_options_buildInfo = options.buildInfo) === null || _options_buildInfo === void 0 ? void 0 : _options_buildInfo.manifest);
|
|
42
42
|
if (!manifest) throw new Error("one/headless-server: manifest is required");
|
|
@@ -45,9 +45,9 @@ async function createServer(options) {
|
|
|
45
45
|
oneOptions: options.oneOptions,
|
|
46
46
|
routeToBuildInfo: (_ref = (_options_buildInfo1 = options.buildInfo) === null || _options_buildInfo1 === void 0 ? void 0 : _options_buildInfo1.routeToBuildInfo) !== null && _ref !== void 0 ? _ref : {},
|
|
47
47
|
cssContentsByPath: (_options_buildInfo2 = options.buildInfo) === null || _options_buildInfo2 === void 0 ? void 0 : _options_buildInfo2.cssContentsByPath,
|
|
48
|
-
routeMap: (
|
|
49
|
-
preloads: (
|
|
50
|
-
cssPreloads: (
|
|
48
|
+
routeMap: (_options_buildInfo3 = options.buildInfo) === null || _options_buildInfo3 === void 0 ? void 0 : _options_buildInfo3.routeMap,
|
|
49
|
+
preloads: (_ref1 = (_options_buildInfo4 = options.buildInfo) === null || _options_buildInfo4 === void 0 ? void 0 : _options_buildInfo4.preloads) !== null && _ref1 !== void 0 ? _ref1 : {},
|
|
50
|
+
cssPreloads: (_ref2 = (_options_buildInfo5 = options.buildInfo) === null || _options_buildInfo5 === void 0 ? void 0 : _options_buildInfo5.cssPreloads) !== null && _ref2 !== void 0 ? _ref2 : {}
|
|
51
51
|
};
|
|
52
52
|
(0, import_setupBuildOptions.setupBuildInfo)(buildInfo);
|
|
53
53
|
(0, import_setServerGlobals.setServerGlobals)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headless-server.native.js","names":[],"sources":["cjs/headless-server.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar headless_server_exports = {};\n__export(headless_server_exports, {\n compileManifest: () => import_createHandleRequest.compileManifest,\n createServer: () => createServer,\n createWorkerHandler: () => import_workerHandler.createWorkerHandler,\n getFetchStaticHtml: () => import_staticHtmlFetcher.getFetchStaticHtml,\n setFetchStaticHtml: () => import_staticHtmlFetcher.setFetchStaticHtml\n});\nmodule.exports = __toCommonJS(headless_server_exports);\nvar import_workerHandler = require(\"./server/workerHandler\");\nvar import_createHandleRequest = require(\"./createHandleRequest\");\nvar import_staticHtmlFetcher = require(\"./server/staticHtmlFetcher\");\nvar import_setServerGlobals = require(\"./server/setServerGlobals\");\nvar import_setupBuildOptions = require(\"./server/setupBuildOptions\");\nvar import_workerHandler2 = require(\"./server/workerHandler\");\nasync function createServer(options) {\n var _ref, _ref1, _ref2
|
|
1
|
+
{"version":3,"file":"headless-server.native.js","names":[],"sources":["cjs/headless-server.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar headless_server_exports = {};\n__export(headless_server_exports, {\n compileManifest: () => import_createHandleRequest.compileManifest,\n createServer: () => createServer,\n createWorkerHandler: () => import_workerHandler.createWorkerHandler,\n getFetchStaticHtml: () => import_staticHtmlFetcher.getFetchStaticHtml,\n setFetchStaticHtml: () => import_staticHtmlFetcher.setFetchStaticHtml\n});\nmodule.exports = __toCommonJS(headless_server_exports);\nvar import_workerHandler = require(\"./server/workerHandler\");\nvar import_createHandleRequest = require(\"./createHandleRequest\");\nvar import_staticHtmlFetcher = require(\"./server/staticHtmlFetcher\");\nvar import_setServerGlobals = require(\"./server/setServerGlobals\");\nvar import_setupBuildOptions = require(\"./server/setupBuildOptions\");\nvar import_workerHandler2 = require(\"./server/workerHandler\");\nasync function createServer(options) {\n var _ref, _ref1, _ref2;\n var _options_buildInfo, _options_buildInfo1, _options_buildInfo2, _options_buildInfo3, _options_buildInfo4, _options_buildInfo5;\n var manifest = options.manifest || ((_options_buildInfo = options.buildInfo) === null || _options_buildInfo === void 0 ? void 0 : _options_buildInfo.manifest);\n if (!manifest) throw new Error(\"one/headless-server: manifest is required\");\n var buildInfo = {\n manifest,\n oneOptions: options.oneOptions,\n routeToBuildInfo: (_ref = (_options_buildInfo1 = options.buildInfo) === null || _options_buildInfo1 === void 0 ? void 0 : _options_buildInfo1.routeToBuildInfo) !== null && _ref !== void 0 ? _ref : {},\n cssContentsByPath: (_options_buildInfo2 = options.buildInfo) === null || _options_buildInfo2 === void 0 ? void 0 : _options_buildInfo2.cssContentsByPath,\n routeMap: (_options_buildInfo3 = options.buildInfo) === null || _options_buildInfo3 === void 0 ? void 0 : _options_buildInfo3.routeMap,\n preloads: (_ref1 = (_options_buildInfo4 = options.buildInfo) === null || _options_buildInfo4 === void 0 ? void 0 : _options_buildInfo4.preloads) !== null && _ref1 !== void 0 ? _ref1 : {},\n cssPreloads: (_ref2 = (_options_buildInfo5 = options.buildInfo) === null || _options_buildInfo5 === void 0 ? void 0 : _options_buildInfo5.cssPreloads) !== null && _ref2 !== void 0 ? _ref2 : {}\n };\n (0, import_setupBuildOptions.setupBuildInfo)(buildInfo);\n (0, import_setServerGlobals.setServerGlobals)();\n var handler = (0, import_workerHandler2.createWorkerHandler)({\n oneOptions: options.oneOptions,\n buildInfo,\n lazyRoutes: options.routes\n });\n return {\n /** handle an incoming request — returns Response or null (unmatched) */\n fetch: handler.handleRequest,\n /** hot-swap the route table without recreating the server */\n updateRoutes(newManifest, newRoutes) {\n var newBuildInfo = {\n ...buildInfo,\n manifest: newManifest\n };\n (0, import_setupBuildOptions.setupBuildInfo)(newBuildInfo);\n handler.updateRoutes(newBuildInfo, newRoutes);\n }\n };\n}\n//# sourceMappingURL=headless-server.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,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,SAAS,KAAK,IAAI,OAAO,CAAC;EACtM,oBAAoB,sBAAsB,QAAQ,eAAe,QAAQ,wBAAwB,KAAK,IAAI,KAAK,IAAI,oBAAoB;EACvI,WAAW,sBAAsB,QAAQ,eAAe,QAAQ,wBAAwB,KAAK,IAAI,KAAK,IAAI,oBAAoB;EAC9H,WAAW,SAAS,sBAAsB,QAAQ,eAAe,QAAQ,wBAAwB,KAAK,IAAI,KAAK,IAAI,oBAAoB,cAAc,QAAQ,UAAU,KAAK,IAAI,QAAQ,CAAC;EACzL,cAAc,SAAS,sBAAsB,QAAQ,eAAe,QAAQ,wBAAwB,KAAK,IAAI,KAAK,IAAI,oBAAoB,iBAAiB,QAAQ,UAAU,KAAK,IAAI,QAAQ,CAAC;CACjM;CACA,CAAC,GAAG,yBAAyB,eAAc,CAAE,SAAS;CACtD,CAAC,GAAG,wBAAwB,iBAAgB,CAAE;CAC9C,IAAI,WAAW,GAAG,sBAAsB,oBAAmB,CAAE;EAC3D,YAAY,QAAQ;EACpB;EACA,YAAY,QAAQ;CACtB,CAAC;CACD,OAAO;;EAEL,OAAO,QAAQ;;EAEf,aAAa,aAAa,WAAW;GACnC,IAAI,eAAe;IACjB,GAAG;IACH,UAAU;GACZ;GACA,CAAC,GAAG,yBAAyB,eAAc,CAAE,YAAY;GACzD,QAAQ,aAAa,cAAc,SAAS;EAC9C;CACF;AACF"}
|
|
@@ -21,7 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var diagnoseRouteLoadFailure_exports = {};
|
|
22
22
|
__export(diagnoseRouteLoadFailure_exports, {
|
|
23
23
|
diagnoseRouteLoadFailure: () => diagnoseRouteLoadFailure,
|
|
24
|
-
|
|
24
|
+
findRouteLoadFault: () => findRouteLoadFault
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(diagnoseRouteLoadFailure_exports);
|
|
27
27
|
const MAX_MODULES = 500;
|
|
@@ -39,56 +39,88 @@ function collectImports(source, base) {
|
|
|
39
39
|
for (const m of source.matchAll(/(?:^|[\s;}])import\s*["']([^"']+)["']/g)) add(m[1]);
|
|
40
40
|
return out;
|
|
41
41
|
}
|
|
42
|
-
async function
|
|
42
|
+
async function findRouteLoadFault(entryUrl) {
|
|
43
43
|
const deadline = Date.now() + TIMEOUT_MS;
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const importers = /* @__PURE__ */ new Map();
|
|
45
|
+
const entry = new URL(entryUrl, window.location.href).href;
|
|
46
|
+
importers.set(entry, null);
|
|
47
|
+
let frontier = [entry];
|
|
48
|
+
let visited = 0;
|
|
49
|
+
while (frontier.length && visited < MAX_MODULES && Date.now() < deadline) {
|
|
50
|
+
const batch = frontier.slice(0, 32);
|
|
49
51
|
frontier = frontier.slice(batch.length);
|
|
52
|
+
visited += batch.length;
|
|
50
53
|
const results = await Promise.all(batch.map(async (url) => {
|
|
51
|
-
seen.add(url);
|
|
52
54
|
let res;
|
|
53
55
|
try {
|
|
54
56
|
res = await fetch(url);
|
|
55
57
|
} catch {
|
|
56
58
|
return {
|
|
57
59
|
url,
|
|
58
|
-
|
|
60
|
+
fault: "unreachable",
|
|
59
61
|
imports: []
|
|
60
62
|
};
|
|
61
63
|
}
|
|
64
|
+
if (res.status === 404) return {
|
|
65
|
+
url,
|
|
66
|
+
fault: "missing",
|
|
67
|
+
imports: []
|
|
68
|
+
};
|
|
62
69
|
if (!res.ok) return {
|
|
63
70
|
url,
|
|
64
|
-
|
|
71
|
+
fault: null,
|
|
65
72
|
imports: []
|
|
66
73
|
};
|
|
67
74
|
const type = res.headers.get("content-type") ?? "";
|
|
68
75
|
if (!type.includes("javascript")) return {
|
|
69
76
|
url,
|
|
70
|
-
|
|
77
|
+
fault: null,
|
|
71
78
|
imports: []
|
|
72
79
|
};
|
|
73
80
|
return {
|
|
74
81
|
url,
|
|
75
|
-
|
|
82
|
+
fault: null,
|
|
76
83
|
imports: collectImports(await res.text(), url)
|
|
77
84
|
};
|
|
78
85
|
}));
|
|
79
86
|
for (const result of results) {
|
|
80
|
-
if (result.
|
|
87
|
+
if (result.fault === "missing") {
|
|
88
|
+
const importer = importers.get(result.url) ?? null;
|
|
89
|
+
if (importer?.includes("/node_modules/")) continue;
|
|
90
|
+
return {
|
|
91
|
+
kind: "missing",
|
|
92
|
+
url: result.url,
|
|
93
|
+
importer
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (result.fault === "unreachable") {
|
|
97
|
+
const serverAnswers = await fetch(window.location.href, { method: "HEAD" }).then(() => true, () => false);
|
|
98
|
+
return serverAnswers ? {
|
|
99
|
+
kind: "blocked",
|
|
100
|
+
url: result.url
|
|
101
|
+
} : null;
|
|
102
|
+
}
|
|
81
103
|
for (const next of result.imports) {
|
|
82
|
-
if (
|
|
104
|
+
if (importers.has(next)) continue;
|
|
105
|
+
importers.set(next, result.url);
|
|
106
|
+
frontier.push(next);
|
|
83
107
|
}
|
|
84
108
|
}
|
|
85
109
|
}
|
|
86
110
|
return null;
|
|
87
111
|
}
|
|
88
112
|
async function diagnoseRouteLoadFailure(routeId, routeUrl) {
|
|
89
|
-
const
|
|
90
|
-
if (!
|
|
91
|
-
const
|
|
113
|
+
const fault = await findRouteLoadFault(routeUrl);
|
|
114
|
+
if (!fault) return null;
|
|
115
|
+
const toPath = (url) => url.replace(window.location.origin, "");
|
|
116
|
+
const path = toPath(fault.url);
|
|
117
|
+
if (fault.kind === "missing") {
|
|
118
|
+
return [
|
|
119
|
+
`Route "${routeId}" failed to load because ${path} does not exist (the dev server answered 404).`,
|
|
120
|
+
``,
|
|
121
|
+
fault.importer ? `${toPath(fault.importer)} imports it. Create the file or remove the import.` : `Create the file or remove the import.`
|
|
122
|
+
].join("\n");
|
|
123
|
+
}
|
|
92
124
|
return [
|
|
93
125
|
`Route "${routeId}" failed to load because this browser refused to fetch ${path}`,
|
|
94
126
|
``,
|
|
@@ -23,7 +23,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
23
23
|
var diagnoseRouteLoadFailure_exports = {};
|
|
24
24
|
__export(diagnoseRouteLoadFailure_exports, {
|
|
25
25
|
diagnoseRouteLoadFailure: () => diagnoseRouteLoadFailure,
|
|
26
|
-
|
|
26
|
+
findRouteLoadFault: () => findRouteLoadFault
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(diagnoseRouteLoadFailure_exports);
|
|
29
29
|
var MAX_MODULES = 500;
|
|
@@ -98,43 +98,48 @@ function collectImports(source, base) {
|
|
|
98
98
|
}
|
|
99
99
|
return out;
|
|
100
100
|
}
|
|
101
|
-
async function
|
|
101
|
+
async function findRouteLoadFault(entryUrl) {
|
|
102
102
|
var deadline = Date.now() + TIMEOUT_MS;
|
|
103
|
-
var
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
var importers = /* @__PURE__ */ new Map();
|
|
104
|
+
var entry = new URL(entryUrl, window.location.href).href;
|
|
105
|
+
importers.set(entry, null);
|
|
106
|
+
var frontier = [entry];
|
|
107
|
+
var visited = 0;
|
|
108
|
+
while (frontier.length && visited < MAX_MODULES && Date.now() < deadline) {
|
|
109
|
+
var batch = frontier.slice(0, 32);
|
|
110
110
|
frontier = frontier.slice(batch.length);
|
|
111
|
+
visited += batch.length;
|
|
111
112
|
var results = await Promise.all(batch.map(async function(url) {
|
|
112
113
|
var _res_headers_get;
|
|
113
|
-
seen.add(url);
|
|
114
114
|
var res;
|
|
115
115
|
try {
|
|
116
116
|
res = await fetch(url);
|
|
117
117
|
} catch (unused) {
|
|
118
118
|
return {
|
|
119
119
|
url,
|
|
120
|
-
|
|
120
|
+
fault: "unreachable",
|
|
121
121
|
imports: []
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
+
if (res.status === 404) return {
|
|
125
|
+
url,
|
|
126
|
+
fault: "missing",
|
|
127
|
+
imports: []
|
|
128
|
+
};
|
|
124
129
|
if (!res.ok) return {
|
|
125
130
|
url,
|
|
126
|
-
|
|
131
|
+
fault: null,
|
|
127
132
|
imports: []
|
|
128
133
|
};
|
|
129
134
|
var type = (_res_headers_get = res.headers.get("content-type")) !== null && _res_headers_get !== void 0 ? _res_headers_get : "";
|
|
130
135
|
if (!type.includes("javascript")) return {
|
|
131
136
|
url,
|
|
132
|
-
|
|
137
|
+
fault: null,
|
|
133
138
|
imports: []
|
|
134
139
|
};
|
|
135
140
|
return {
|
|
136
141
|
url,
|
|
137
|
-
|
|
142
|
+
fault: null,
|
|
138
143
|
imports: collectImports(await res.text(), url)
|
|
139
144
|
};
|
|
140
145
|
}));
|
|
@@ -142,12 +147,34 @@ async function findBlockedModule(entryUrl) {
|
|
|
142
147
|
try {
|
|
143
148
|
for (var _iterator = results[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
144
149
|
var result = _step.value;
|
|
145
|
-
if (result.
|
|
150
|
+
if (result.fault === "missing") {
|
|
151
|
+
var _importers_get;
|
|
152
|
+
var importer = (_importers_get = importers.get(result.url)) !== null && _importers_get !== void 0 ? _importers_get : null;
|
|
153
|
+
if (importer === null || importer === void 0 ? void 0 : importer.includes("/node_modules/")) continue;
|
|
154
|
+
return {
|
|
155
|
+
kind: "missing",
|
|
156
|
+
url: result.url,
|
|
157
|
+
importer
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
if (result.fault === "unreachable") {
|
|
161
|
+
var serverAnswers = await fetch(window.location.href, { method: "HEAD" }).then(function() {
|
|
162
|
+
return true;
|
|
163
|
+
}, function() {
|
|
164
|
+
return false;
|
|
165
|
+
});
|
|
166
|
+
return serverAnswers ? {
|
|
167
|
+
kind: "blocked",
|
|
168
|
+
url: result.url
|
|
169
|
+
} : null;
|
|
170
|
+
}
|
|
146
171
|
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
147
172
|
try {
|
|
148
173
|
for (var _iterator1 = result.imports[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
149
174
|
var next = _step1.value;
|
|
150
|
-
if (
|
|
175
|
+
if (importers.has(next)) continue;
|
|
176
|
+
importers.set(next, result.url);
|
|
177
|
+
frontier.push(next);
|
|
151
178
|
}
|
|
152
179
|
} catch (err) {
|
|
153
180
|
_didIteratorError1 = true;
|
|
@@ -182,9 +209,19 @@ async function findBlockedModule(entryUrl) {
|
|
|
182
209
|
return null;
|
|
183
210
|
}
|
|
184
211
|
async function diagnoseRouteLoadFailure(routeId, routeUrl) {
|
|
185
|
-
var
|
|
186
|
-
if (!
|
|
187
|
-
var
|
|
212
|
+
var fault = await findRouteLoadFault(routeUrl);
|
|
213
|
+
if (!fault) return null;
|
|
214
|
+
var toPath = function(url) {
|
|
215
|
+
return url.replace(window.location.origin, "");
|
|
216
|
+
};
|
|
217
|
+
var path = toPath(fault.url);
|
|
218
|
+
if (fault.kind === "missing") {
|
|
219
|
+
return [
|
|
220
|
+
`Route "${routeId}" failed to load because ${path} does not exist (the dev server answered 404).`,
|
|
221
|
+
``,
|
|
222
|
+
fault.importer ? `${toPath(fault.importer)} imports it. Create the file or remove the import.` : `Create the file or remove the import.`
|
|
223
|
+
].join("\n");
|
|
224
|
+
}
|
|
188
225
|
return [
|
|
189
226
|
`Route "${routeId}" failed to load because this browser refused to fetch ${path}`,
|
|
190
227
|
``,
|
|
@@ -23,7 +23,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
23
23
|
var diagnoseRouteLoadFailure_exports = {};
|
|
24
24
|
__export(diagnoseRouteLoadFailure_exports, {
|
|
25
25
|
diagnoseRouteLoadFailure: () => diagnoseRouteLoadFailure,
|
|
26
|
-
|
|
26
|
+
findRouteLoadFault: () => findRouteLoadFault
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(diagnoseRouteLoadFailure_exports);
|
|
29
29
|
var MAX_MODULES = 500;
|
|
@@ -98,43 +98,48 @@ function collectImports(source, base) {
|
|
|
98
98
|
}
|
|
99
99
|
return out;
|
|
100
100
|
}
|
|
101
|
-
async function
|
|
101
|
+
async function findRouteLoadFault(entryUrl) {
|
|
102
102
|
var deadline = Date.now() + TIMEOUT_MS;
|
|
103
|
-
var
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
var importers = /* @__PURE__ */ new Map();
|
|
104
|
+
var entry = new URL(entryUrl, window.location.href).href;
|
|
105
|
+
importers.set(entry, null);
|
|
106
|
+
var frontier = [entry];
|
|
107
|
+
var visited = 0;
|
|
108
|
+
while (frontier.length && visited < MAX_MODULES && Date.now() < deadline) {
|
|
109
|
+
var batch = frontier.slice(0, 32);
|
|
110
110
|
frontier = frontier.slice(batch.length);
|
|
111
|
+
visited += batch.length;
|
|
111
112
|
var results = await Promise.all(batch.map(async function(url) {
|
|
112
113
|
var _res_headers_get;
|
|
113
|
-
seen.add(url);
|
|
114
114
|
var res;
|
|
115
115
|
try {
|
|
116
116
|
res = await fetch(url);
|
|
117
117
|
} catch (unused) {
|
|
118
118
|
return {
|
|
119
119
|
url,
|
|
120
|
-
|
|
120
|
+
fault: "unreachable",
|
|
121
121
|
imports: []
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
+
if (res.status === 404) return {
|
|
125
|
+
url,
|
|
126
|
+
fault: "missing",
|
|
127
|
+
imports: []
|
|
128
|
+
};
|
|
124
129
|
if (!res.ok) return {
|
|
125
130
|
url,
|
|
126
|
-
|
|
131
|
+
fault: null,
|
|
127
132
|
imports: []
|
|
128
133
|
};
|
|
129
134
|
var type = (_res_headers_get = res.headers.get("content-type")) !== null && _res_headers_get !== void 0 ? _res_headers_get : "";
|
|
130
135
|
if (!type.includes("javascript")) return {
|
|
131
136
|
url,
|
|
132
|
-
|
|
137
|
+
fault: null,
|
|
133
138
|
imports: []
|
|
134
139
|
};
|
|
135
140
|
return {
|
|
136
141
|
url,
|
|
137
|
-
|
|
142
|
+
fault: null,
|
|
138
143
|
imports: collectImports(await res.text(), url)
|
|
139
144
|
};
|
|
140
145
|
}));
|
|
@@ -142,12 +147,34 @@ async function findBlockedModule(entryUrl) {
|
|
|
142
147
|
try {
|
|
143
148
|
for (var _iterator = results[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
144
149
|
var result = _step.value;
|
|
145
|
-
if (result.
|
|
150
|
+
if (result.fault === "missing") {
|
|
151
|
+
var _importers_get;
|
|
152
|
+
var importer = (_importers_get = importers.get(result.url)) !== null && _importers_get !== void 0 ? _importers_get : null;
|
|
153
|
+
if (importer === null || importer === void 0 ? void 0 : importer.includes("/node_modules/")) continue;
|
|
154
|
+
return {
|
|
155
|
+
kind: "missing",
|
|
156
|
+
url: result.url,
|
|
157
|
+
importer
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
if (result.fault === "unreachable") {
|
|
161
|
+
var serverAnswers = await fetch(window.location.href, { method: "HEAD" }).then(function() {
|
|
162
|
+
return true;
|
|
163
|
+
}, function() {
|
|
164
|
+
return false;
|
|
165
|
+
});
|
|
166
|
+
return serverAnswers ? {
|
|
167
|
+
kind: "blocked",
|
|
168
|
+
url: result.url
|
|
169
|
+
} : null;
|
|
170
|
+
}
|
|
146
171
|
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
147
172
|
try {
|
|
148
173
|
for (var _iterator1 = result.imports[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
149
174
|
var next = _step1.value;
|
|
150
|
-
if (
|
|
175
|
+
if (importers.has(next)) continue;
|
|
176
|
+
importers.set(next, result.url);
|
|
177
|
+
frontier.push(next);
|
|
151
178
|
}
|
|
152
179
|
} catch (err) {
|
|
153
180
|
_didIteratorError1 = true;
|
|
@@ -182,9 +209,19 @@ async function findBlockedModule(entryUrl) {
|
|
|
182
209
|
return null;
|
|
183
210
|
}
|
|
184
211
|
async function diagnoseRouteLoadFailure(routeId, routeUrl) {
|
|
185
|
-
var
|
|
186
|
-
if (!
|
|
187
|
-
var
|
|
212
|
+
var fault = await findRouteLoadFault(routeUrl);
|
|
213
|
+
if (!fault) return null;
|
|
214
|
+
var toPath = function(url) {
|
|
215
|
+
return url.replace(window.location.origin, "");
|
|
216
|
+
};
|
|
217
|
+
var path = toPath(fault.url);
|
|
218
|
+
if (fault.kind === "missing") {
|
|
219
|
+
return [
|
|
220
|
+
`Route "${routeId}" failed to load because ${path} does not exist (the dev server answered 404).`,
|
|
221
|
+
``,
|
|
222
|
+
fault.importer ? `${toPath(fault.importer)} imports it. Create the file or remove the import.` : `Create the file or remove the import.`
|
|
223
|
+
].join("\n");
|
|
224
|
+
}
|
|
188
225
|
return [
|
|
189
226
|
`Route "${routeId}" failed to load because this browser refused to fetch ${path}`,
|
|
190
227
|
``,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnoseRouteLoadFailure.native.js","names":[],"sources":["cjs/router/diagnoseRouteLoadFailure.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar diagnoseRouteLoadFailure_exports = {};\n__export(diagnoseRouteLoadFailure_exports, {\n diagnoseRouteLoadFailure: () => diagnoseRouteLoadFailure,\n findBlockedModule: () => findBlockedModule\n});\nmodule.exports = __toCommonJS(diagnoseRouteLoadFailure_exports);\nvar MAX_MODULES = 500;\nvar TIMEOUT_MS = 5e3;\nfunction collectImports(source, base) {\n var out = [];\n var add = function(spec) {\n if (!/^[./]|^https?:/.test(spec)) return;\n try {\n out.push(new URL(spec, base).href);\n } catch (unused) {\n }\n };\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = source.matchAll(/(?:^|[\\s;}])(?:import|export)[^'\"]{0,300}?from\\s*[\"']([^\"']+)[\"']/g)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var m = _step.value;\n add(m[1]);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = source.matchAll(/\\bimport\\s*\\(\\s*[\"']([^\"']+)[\"']\\s*\\)/g)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var m1 = _step1.value;\n add(m1[1]);\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\n var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;\n try {\n for (var _iterator2 = source.matchAll(/(?:^|[\\s;}])import\\s*[\"']([^\"']+)[\"']/g)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var m2 = _step2.value;\n add(m2[1]);\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n return out;\n}\nasync function findBlockedModule(entryUrl) {\n var deadline = Date.now() + TIMEOUT_MS;\n var seen = /* @__PURE__ */ new Set();\n var frontier = [\n new URL(entryUrl, window.location.href).href\n ];\n while (frontier.length && seen.size < MAX_MODULES && Date.now() < deadline) {\n var batch = frontier.filter(function(url) {\n return !seen.has(url);\n }).slice(0, 32);\n if (!batch.length) break;\n frontier = frontier.slice(batch.length);\n var results = await Promise.all(batch.map(async function(url) {\n var _res_headers_get;\n seen.add(url);\n var res;\n try {\n res = await fetch(url);\n } catch (unused) {\n return {\n url,\n blocked: true,\n imports: []\n };\n }\n if (!res.ok) return {\n url,\n blocked: false,\n imports: []\n };\n var type = (_res_headers_get = res.headers.get(\"content-type\")) !== null && _res_headers_get !== void 0 ? _res_headers_get : \"\";\n if (!type.includes(\"javascript\")) return {\n url,\n blocked: false,\n imports: []\n };\n return {\n url,\n blocked: false,\n imports: collectImports(await res.text(), url)\n };\n }));\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = results[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var result = _step.value;\n if (result.blocked) return result.url;\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = result.imports[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var next = _step1.value;\n if (!seen.has(next)) frontier.push(next);\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n return null;\n}\nasync function diagnoseRouteLoadFailure(routeId, routeUrl) {\n var blocked = await findBlockedModule(routeUrl);\n if (!blocked) return null;\n var path = blocked.replace(window.location.origin, \"\");\n return [\n `Route \"${routeId}\" failed to load because this browser refused to fetch ${path}`,\n ``,\n `That request never reached the dev server, so a content blocker or privacy`,\n `extension is blocking it. In dev the module URL is the source path, and a`,\n `path containing a word like \"analytics\", \"pageview\" or \"track\" matches the`,\n `tracking rules those blockers ship.`,\n ``,\n `Rename the file or the directory so its path no longer matches, or allow`,\n `${window.location.origin} in the blocker.`\n ].join(\"\\n\");\n}\n//# sourceMappingURL=diagnoseRouteLoadFailure.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,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;IACF;GACF;EACF,SAAS,KAAK;GACZ,oBAAoB;GACpB,iBAAiB;EACnB,UAAU;GACR,IAAI;IACF,IAAI,CAAC,6BAA6B,UAAU,UAAU,MAAM;KAC1D,UAAU,OAAO;IACnB;GACF,UAAU;IACR,IAAI,mBAAmB;KACrB,MAAM;IACR;GACF;EACF;CACF;CACA,OAAO;AACT;AACA,eAAe,yBAAyB,SAAS,UAAU;CACzD,IAAI,UAAU,MAAM,kBAAkB,QAAQ;CAC9C,IAAI,CAAC,SAAS,OAAO;CACrB,IAAI,OAAO,QAAQ,QAAQ,OAAO,SAAS,QAAQ,EAAE;CACrD,OAAO;EACL,UAAU,QAAQ,yDAAyD;EAC3E;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG,OAAO,SAAS,OAAO;CAC5B,CAAC,CAAC,KAAK,IAAI;AACb"}
|
|
1
|
+
{"version":3,"file":"diagnoseRouteLoadFailure.native.js","names":[],"sources":["cjs/router/diagnoseRouteLoadFailure.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar diagnoseRouteLoadFailure_exports = {};\n__export(diagnoseRouteLoadFailure_exports, {\n diagnoseRouteLoadFailure: () => diagnoseRouteLoadFailure,\n findRouteLoadFault: () => findRouteLoadFault\n});\nmodule.exports = __toCommonJS(diagnoseRouteLoadFailure_exports);\nvar MAX_MODULES = 500;\nvar TIMEOUT_MS = 5e3;\nfunction collectImports(source, base) {\n var out = [];\n var add = function(spec) {\n if (!/^[./]|^https?:/.test(spec)) return;\n try {\n out.push(new URL(spec, base).href);\n } catch (unused) {\n }\n };\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = source.matchAll(/(?:^|[\\s;}])(?:import|export)[^'\"]{0,300}?from\\s*[\"']([^\"']+)[\"']/g)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var m = _step.value;\n add(m[1]);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = source.matchAll(/\\bimport\\s*\\(\\s*[\"']([^\"']+)[\"']\\s*\\)/g)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var m1 = _step1.value;\n add(m1[1]);\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\n var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;\n try {\n for (var _iterator2 = source.matchAll(/(?:^|[\\s;}])import\\s*[\"']([^\"']+)[\"']/g)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var m2 = _step2.value;\n add(m2[1]);\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n return out;\n}\nasync function findRouteLoadFault(entryUrl) {\n var deadline = Date.now() + TIMEOUT_MS;\n var importers = /* @__PURE__ */ new Map();\n var entry = new URL(entryUrl, window.location.href).href;\n importers.set(entry, null);\n var frontier = [\n entry\n ];\n var visited = 0;\n while (frontier.length && visited < MAX_MODULES && Date.now() < deadline) {\n var batch = frontier.slice(0, 32);\n frontier = frontier.slice(batch.length);\n visited += batch.length;\n var results = await Promise.all(batch.map(async function(url) {\n var _res_headers_get;\n var res;\n try {\n res = await fetch(url);\n } catch (unused) {\n return {\n url,\n fault: \"unreachable\",\n imports: []\n };\n }\n if (res.status === 404) return {\n url,\n fault: \"missing\",\n imports: []\n };\n if (!res.ok) return {\n url,\n fault: null,\n imports: []\n };\n var type = (_res_headers_get = res.headers.get(\"content-type\")) !== null && _res_headers_get !== void 0 ? _res_headers_get : \"\";\n if (!type.includes(\"javascript\")) return {\n url,\n fault: null,\n imports: []\n };\n return {\n url,\n fault: null,\n imports: collectImports(await res.text(), url)\n };\n }));\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = results[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var result = _step.value;\n if (result.fault === \"missing\") {\n var _importers_get;\n var importer = (_importers_get = importers.get(result.url)) !== null && _importers_get !== void 0 ? _importers_get : null;\n if (importer === null || importer === void 0 ? void 0 : importer.includes(\"/node_modules/\")) continue;\n return {\n kind: \"missing\",\n url: result.url,\n importer\n };\n }\n if (result.fault === \"unreachable\") {\n var serverAnswers = await fetch(window.location.href, {\n method: \"HEAD\"\n }).then(function() {\n return true;\n }, function() {\n return false;\n });\n return serverAnswers ? {\n kind: \"blocked\",\n url: result.url\n } : null;\n }\n var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n try {\n for (var _iterator1 = result.imports[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n var next = _step1.value;\n if (importers.has(next)) continue;\n importers.set(next, result.url);\n frontier.push(next);\n }\n } catch (err) {\n _didIteratorError1 = true;\n _iteratorError1 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion1 && _iterator1.return != null) {\n _iterator1.return();\n }\n } finally {\n if (_didIteratorError1) {\n throw _iteratorError1;\n }\n }\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n return null;\n}\nasync function diagnoseRouteLoadFailure(routeId, routeUrl) {\n var fault = await findRouteLoadFault(routeUrl);\n if (!fault) return null;\n var toPath = function(url) {\n return url.replace(window.location.origin, \"\");\n };\n var path = toPath(fault.url);\n if (fault.kind === \"missing\") {\n return [\n `Route \"${routeId}\" failed to load because ${path} does not exist (the dev server answered 404).`,\n ``,\n fault.importer ? `${toPath(fault.importer)} imports it. Create the file or remove the import.` : `Create the file or remove the import.`\n ].join(\"\\n\");\n }\n return [\n `Route \"${routeId}\" failed to load because this browser refused to fetch ${path}`,\n ``,\n `That request never reached the dev server, so a content blocker or privacy`,\n `extension is blocking it. In dev the module URL is the source path, and a`,\n `path containing a word like \"analytics\", \"pageview\" or \"track\" matches the`,\n `tracking rules those blockers ship.`,\n ``,\n `Rename the file or the directory so its path no longer matches, or allow`,\n `${window.location.origin} in the blocker.`\n ].join(\"\\n\");\n}\n//# sourceMappingURL=diagnoseRouteLoadFailure.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UA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C,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,SAAS,SAAS,KAAK;EACzB,OAAO,IAAI,QAAQ,OAAO,SAAS,QAAQ,EAAE;CAC/C;CACA,IAAI,OAAO,OAAO,MAAM,GAAG;CAC3B,IAAI,MAAM,SAAS,WAAW;EAC5B,OAAO;GACL,UAAU,QAAQ,2BAA2B,KAAK;GAClD;GACA,MAAM,WAAW,GAAG,OAAO,MAAM,QAAQ,EAAE,sDAAsD;EACnG,CAAC,CAAC,KAAK,IAAI;CACb;CACA,OAAO;EACL,UAAU,QAAQ,yDAAyD;EAC3E;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG,OAAO,SAAS,OAAO;CAC5B,CAAC,CAAC,KAAK,IAAI;AACb"}
|
|
@@ -23,6 +23,7 @@ __export(workerHandler_exports, { createWorkerHandler: () => createWorkerHandler
|
|
|
23
23
|
module.exports = __toCommonJS(workerHandler_exports);
|
|
24
24
|
var import_constants = require("../constants.cjs");
|
|
25
25
|
var import_createHandleRequest = require("../createHandleRequest.cjs");
|
|
26
|
+
var import_matchers = require("../router/matchers.cjs");
|
|
26
27
|
var import_cleanUrl = require("../utils/cleanUrl.cjs");
|
|
27
28
|
var import_getRouterRootFromOneOptions = require("../utils/getRouterRootFromOneOptions.cjs");
|
|
28
29
|
var import_isResponse = require("../utils/isResponse.cjs");
|
|
@@ -88,7 +89,10 @@ function createWorkerHandler(options) {
|
|
|
88
89
|
let cur = urlPath;
|
|
89
90
|
while (cur) {
|
|
90
91
|
const parent = cur.lastIndexOf("/") > 0 ? cur.slice(0, cur.lastIndexOf("/")) : "";
|
|
91
|
-
|
|
92
|
+
const candidate = `${parent}/+not-found`;
|
|
93
|
+
if (routeMap ? routeMap[candidate] : compiledManifest.pageRoutes.some((route) => route.isNotFound && (0, import_matchers.stripGroupSegmentsFromPath)(route.page) === candidate)) {
|
|
94
|
+
return candidate;
|
|
95
|
+
}
|
|
92
96
|
if (!parent) break;
|
|
93
97
|
cur = parent;
|
|
94
98
|
}
|
|
@@ -288,7 +292,7 @@ function createWorkerHandler(options) {
|
|
|
288
292
|
}
|
|
289
293
|
if (pageResult.isEnoent) {
|
|
290
294
|
const nfPath = findNearestNotFoundPath(loaderProps?.path || "/");
|
|
291
|
-
const nfHtml = routeMap[nfPath];
|
|
295
|
+
const nfHtml = routeMap?.[nfPath];
|
|
292
296
|
if (nfHtml) {
|
|
293
297
|
const html = await readStaticHtml(nfHtml);
|
|
294
298
|
if (html) {
|
|
@@ -405,7 +409,7 @@ url: ${url}`);
|
|
|
405
409
|
const isDynamicRoute = Object.keys(route.routeKeys).length > 0;
|
|
406
410
|
const routeCleanPath = route.urlCleanPath.replace(/\?/g, "");
|
|
407
411
|
const notFoundKey = route.isNotFound ? route.page.replace(/\[([^\]]+)\]/g, ":$1") : null;
|
|
408
|
-
const htmlPath = notFoundKey ? routeMap[notFoundKey] : isDynamicRoute ? routeMap[routeCleanPath] || routeMap[url.pathname] : routeMap[url.pathname] || routeMap[routeBuildInfo?.cleanPath];
|
|
412
|
+
const htmlPath = notFoundKey ? routeMap?.[notFoundKey] : isDynamicRoute ? routeMap?.[routeCleanPath] || routeMap?.[url.pathname] : routeMap?.[url.pathname] || routeMap?.[routeBuildInfo?.cleanPath];
|
|
409
413
|
if (htmlPath) {
|
|
410
414
|
const html = await readStaticHtml(htmlPath);
|
|
411
415
|
if (html) {
|
|
@@ -417,7 +421,7 @@ url: ${url}`);
|
|
|
417
421
|
}
|
|
418
422
|
if (isDynamicRoute) {
|
|
419
423
|
const notFoundRoute = findNearestNotFoundPath(url.pathname);
|
|
420
|
-
const notFoundHtmlPath = routeMap[notFoundRoute];
|
|
424
|
+
const notFoundHtmlPath = routeMap?.[notFoundRoute];
|
|
421
425
|
if (notFoundHtmlPath) {
|
|
422
426
|
const notFoundHtml = await readStaticHtml(notFoundHtmlPath);
|
|
423
427
|
if (notFoundHtml) {
|
|
@@ -491,7 +495,7 @@ url: ${url}`);
|
|
|
491
495
|
for (const route of compiledManifest.pageRoutes) {
|
|
492
496
|
if (route.file === "") continue;
|
|
493
497
|
if (!route.compiledRegex.test(originalUrl)) continue;
|
|
494
|
-
if (route.type === "ssg" && Object.keys(route.routeKeys).length > 0 && !routeMap[originalUrl]) {
|
|
498
|
+
if (route.type === "ssg" && Object.keys(route.routeKeys).length > 0 && routeMap && !routeMap[originalUrl]) {
|
|
495
499
|
return new Response(make404LoaderJs(originalUrl, "ssg route not in routeMap"), { headers: { "Content-Type": "text/javascript" } });
|
|
496
500
|
}
|
|
497
501
|
if (route.hasLoader === false) {
|