@skyramp/mcp 0.3.2 → 0.3.4
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/build/index.js +47 -2
- package/build/playwright/PlaywrightTraceService.d.ts +8 -0
- package/build/playwright/PlaywrightTraceService.js +1 -0
- package/build/playwright/registerPlaywrightTools.js +42 -1
- package/build/prompts/enhance-assertions/sharedAssertionRules.js +19 -0
- package/build/prompts/pom-aware-code-reuse.js +17 -8
- package/build/prompts/test-maintenance/actionsInstructions.js +2 -2
- package/build/prompts/test-recommendation/analysisOutputPrompt.js +1 -4
- package/build/prompts/test-recommendation/recommendationSections.d.ts +1 -1
- package/build/prompts/test-recommendation/recommendationSections.js +5 -5
- package/build/prompts/test-recommendation/test-recommendation-prompt.js +13 -7
- package/build/prompts/testbot/testbot-prompts.d.ts +2 -12
- package/build/prompts/testbot/testbot-prompts.js +28 -16
- package/build/recommendation/discriminators.d.ts +7 -1
- package/build/recommendation/discriminators.js +16 -3
- package/build/resources/testbotResource.js +20 -4
- package/build/services/ScenarioGenerationService.js +5 -2
- package/build/services/TestExecutionService.d.ts +13 -8
- package/build/services/TestExecutionService.js +73 -26
- package/build/services/TestGenerationService.js +24 -9
- package/build/services/containerEnv.d.ts +12 -1
- package/build/services/containerEnv.js +118 -1
- package/build/tools/executeSkyrampTestTool.d.ts +9 -0
- package/build/tools/executeSkyrampTestTool.js +20 -6
- package/build/tools/execution-video-state.d.ts +21 -0
- package/build/tools/execution-video-state.js +51 -0
- package/build/tools/generate-tests/generateBatchScenarioRestTool.js +31 -11
- package/build/tools/generate-tests/planGuard.d.ts +5 -5
- package/build/tools/generate-tests/planGuard.js +5 -17
- package/build/tools/queryProxyMocksTool.js +0 -1
- package/build/tools/submitReportTool.d.ts +83 -10
- package/build/tools/submitReportTool.js +179 -29
- package/build/tools/test-management/actionsTool.js +52 -41
- package/build/tools/test-management/analyzeChangesTool.d.ts +11 -0
- package/build/tools/test-management/analyzeChangesTool.js +37 -33
- package/build/tools/test-management/analyzeTestHealthTool.js +3 -3
- package/build/tools/test-management/registerTestPlanTool.js +113 -31
- package/build/types/TestAnalysis.d.ts +7 -3
- package/build/types/TestExecution.d.ts +14 -0
- package/build/types/TestTypes.js +3 -2
- package/build/types/TestbotPromptOptions.d.ts +34 -0
- package/build/types/TestbotPromptOptions.js +1 -0
- package/build/types/TestbotReport.d.ts +10 -0
- package/build/types/TestbotReport.js +10 -1
- package/build/types/index.d.ts +2 -0
- package/build/types/index.js +1 -0
- package/build/utils/AnalysisStateManager.d.ts +36 -2
- package/build/utils/AnalysisStateManager.js +34 -13
- package/build/utils/frontendSelectors.js +0 -1
- package/build/utils/gitStaging.d.ts +5 -0
- package/build/utils/gitStaging.js +1 -1
- package/build/utils/pom-catalog.d.ts +23 -0
- package/build/utils/pom-catalog.js +30 -0
- package/build/utils/pom-scope/pom-files.d.ts +14 -0
- package/build/utils/pom-scope/pom-files.js +32 -6
- package/build/utils/pom-scope/testIdDiscovery.d.ts +40 -0
- package/build/utils/pom-scope/testIdDiscovery.js +104 -0
- package/build/utils/reportVerification.d.ts +7 -2
- package/build/utils/reportVerification.js +9 -3
- package/build/utils/scenarioDrafting.js +7 -1
- package/build/utils/skyrampMdContent.d.ts +1 -1
- package/build/utils/skyrampMdContent.js +1 -1
- package/build/utils/urlPath.d.ts +37 -0
- package/build/utils/urlPath.js +55 -0
- package/build/utils/utils.d.ts +45 -0
- package/build/utils/utils.js +50 -0
- package/build/utils/versions.d.ts +3 -3
- package/build/utils/versions.js +1 -1
- package/build/utils/workspaceAuth.d.ts +15 -15
- package/build/utils/workspaceAuth.js +32 -17
- package/build/workspace/queryParamResolution.d.ts +93 -0
- package/build/workspace/queryParamResolution.js +201 -0
- package/build/workspace/workspace.d.ts +104 -0
- package/build/workspace/workspace.js +24 -0
- package/node_modules/playwright/ThirdPartyNotices.txt +319 -266
- package/node_modules/playwright/lib/dom-analyzer/blueprint.js +154 -27
- package/node_modules/playwright/lib/dom-analyzer/crawler.js +2 -2
- package/node_modules/playwright/lib/mcp/browser/tools/pageBlueprint.js +1 -1
- package/node_modules/playwright/lib/mcp/browser/tools/sitemap.js +6 -2
- package/node_modules/playwright/lib/mcp/skyramp/loadTraceTool.js +3 -2
- package/node_modules/playwright/lib/mcp/skyramp/resultCode.js +4 -3
- package/node_modules/playwright/lib/mcp/skyramp/skyRampImport.js +15 -3
- package/node_modules/playwright/lib/mcp/skyramp/specImport.js +781 -0
- package/node_modules/playwright/lib/mcp/skyramp/traceRecordingBackend.js +14 -3
- package/node_modules/playwright/lib/mcp/test/resultCode.test.js +2 -1
- package/node_modules/playwright/lib/mcp/test/skyRampExport.js +1 -1
- package/node_modules/playwright/lib/mcp/test/skyRampExport.test.js +30 -0
- package/node_modules/playwright/lib/transform/babelBundleImpl.js +200 -199
- package/node_modules/playwright/node_modules/playwright-core/ThirdPartyNotices.txt +3 -3
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/.package-lock.json +3 -3
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/adapter/aws-lambda/handler.js +16 -25
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/adapter/bun/websocket.js +3 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/adapter/lambda-edge/handler.js +20 -4
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +16 -25
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/adapter/bun/websocket.js +3 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +20 -4
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/client/client.js +10 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/client/utils.js +1 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/helper/css/common.js +3 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/helper/css/index.js +9 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/jsx/base.js +8 -14
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/jsx/components.js +41 -21
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/jsx/context.js +131 -5
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/jsx/streaming.js +9 -7
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +1 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/cache/index.js +1 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/compress/index.js +2 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/cors/index.js +2 -5
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/etag/index.js +2 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/language/language.js +10 -32
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/method-override/index.js +5 -3
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/serve-static/index.js +2 -2
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/middleware/timing/timing.js +3 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/router/trie-router/node.js +9 -0
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/utils/body.js +12 -4
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/utils/buffer.js +2 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/utils/ipaddr.js +6 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/cjs/validator/validator.js +3 -3
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/client/client.js +10 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/client/utils.js +1 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/helper/css/common.js +3 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/helper/css/index.js +9 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/jsx/base.js +15 -15
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/jsx/components.js +42 -22
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/jsx/context.js +129 -5
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/jsx/streaming.js +10 -8
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/bearer-auth/index.js +1 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/cache/index.js +1 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/compress/index.js +2 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/cors/index.js +2 -5
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/etag/index.js +2 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/language/language.js +10 -32
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/method-override/index.js +5 -3
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/serve-static/index.js +2 -2
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/middleware/timing/timing.js +3 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/router/trie-router/node.js +9 -0
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/adapter/aws-lambda/handler.d.ts +1 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +1 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/helper/websocket/index.d.ts +1 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/jsx/base.d.ts +1 -3
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/jsx/context.d.ts +39 -0
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +2 -2
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/middleware/language/language.d.ts +18 -0
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/utils/body.d.ts +1 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/types/utils/types.d.ts +1 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/utils/body.js +12 -4
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/utils/buffer.js +2 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/utils/ipaddr.js +6 -1
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/validator/validator.js +3 -3
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/package.json +29 -22
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/package-lock.json +3 -3
- package/node_modules/playwright/node_modules/playwright-core/lib/generated/pollingRecorderSource.js +1 -1
- package/node_modules/playwright/node_modules/playwright-core/lib/server/codegen/skyramp/jsonlReader.js +5 -1
- package/node_modules/playwright/node_modules/playwright-core/lib/server/codegen/skyramp/specReader.js +781 -0
- package/node_modules/playwright/node_modules/playwright-core/lib/server/recorder/recorderApp.js +25 -6
- package/node_modules/playwright/node_modules/playwright-core/lib/server/recorder/skyramp/replayEngine.js +3 -1
- package/node_modules/playwright/node_modules/playwright-core/lib/utils.js +2 -0
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/htmlReport/index.html +253 -27
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/recorder/assets/{codeMirrorModule-D0BjbCb7.js → codeMirrorModule-DtudTj_v.js} +1 -1
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/recorder/assets/index-BpDwp16L.js +422 -0
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/recorder/index.html +1 -1
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/{codeMirrorModule-Bzd72-bG.js → codeMirrorModule-FNMuBzX1.js} +1 -1
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-Co9upU5h.js +1035 -0
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/index.DXNIQ_dx.js +2 -0
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/index.html +2 -2
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CIKB3XSv.js +5 -0
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +2 -2
- package/node_modules/playwright/node_modules/playwright-core/package.json +1 -1
- package/node_modules/playwright/node_modules/playwright-core/src/generated/pollingRecorderSource.ts +1 -1
- package/node_modules/playwright/node_modules/playwright-core/src/server/codegen/skyramp/jsonlReader.ts +4 -0
- package/node_modules/playwright/node_modules/playwright-core/src/server/codegen/skyramp/specReader.ts +1028 -0
- package/node_modules/playwright/node_modules/playwright-core/src/server/recorder/recorderApp.ts +31 -8
- package/node_modules/playwright/node_modules/playwright-core/src/server/recorder/skyramp/replayEngine.ts +1 -0
- package/node_modules/playwright/node_modules/playwright-core/src/utils.ts +1 -0
- package/node_modules/playwright/package.json +1 -1
- package/package.json +10 -6
- package/node_modules/playwright/node_modules/playwright-core/bundles/mcp/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/recorder/assets/index-lvTRGFx-.js +0 -193
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-DzxTioTK.js +0 -809
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/index.BGc30U3S.js +0 -2
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/uiMode.IaDrb29A.js +0 -5
|
@@ -61,7 +61,7 @@ This project incorporates components from the projects listed below. The origina
|
|
|
61
61
|
- graceful-fs@4.2.10 (https://github.com/isaacs/node-graceful-fs)
|
|
62
62
|
- has-symbols@1.1.0 (https://github.com/inspect-js/has-symbols)
|
|
63
63
|
- hasown@2.0.3 (https://github.com/inspect-js/hasOwn)
|
|
64
|
-
- hono@4.12.
|
|
64
|
+
- hono@4.12.30 (https://github.com/honojs/hono)
|
|
65
65
|
- http-errors@2.0.1 (https://github.com/jshttp/http-errors)
|
|
66
66
|
- https-proxy-agent@7.0.6 (https://github.com/TooTallNate/proxy-agents)
|
|
67
67
|
- iconv-lite@0.7.2 (https://github.com/pillarjs/iconv-lite)
|
|
@@ -1805,7 +1805,7 @@ SOFTWARE.
|
|
|
1805
1805
|
=========================================
|
|
1806
1806
|
END OF hasown@2.0.3 AND INFORMATION
|
|
1807
1807
|
|
|
1808
|
-
%% hono@4.12.
|
|
1808
|
+
%% hono@4.12.30 NOTICES AND INFORMATION BEGIN HERE
|
|
1809
1809
|
=========================================
|
|
1810
1810
|
MIT License
|
|
1811
1811
|
|
|
@@ -1829,7 +1829,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
1829
1829
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1830
1830
|
SOFTWARE.
|
|
1831
1831
|
=========================================
|
|
1832
|
-
END OF hono@4.12.
|
|
1832
|
+
END OF hono@4.12.30 AND INFORMATION
|
|
1833
1833
|
|
|
1834
1834
|
%% http-errors@2.0.1 NOTICES AND INFORMATION BEGIN HERE
|
|
1835
1835
|
=========================================
|
|
@@ -566,9 +566,9 @@
|
|
|
566
566
|
}
|
|
567
567
|
},
|
|
568
568
|
"node_modules/hono": {
|
|
569
|
-
"version": "4.12.
|
|
570
|
-
"resolved": "https://registry.npmjs.org/hono/-/hono-4.12.
|
|
571
|
-
"integrity": "sha512-
|
|
569
|
+
"version": "4.12.30",
|
|
570
|
+
"resolved": "https://registry.npmjs.org/hono/-/hono-4.12.30.tgz",
|
|
571
|
+
"integrity": "sha512-emn+JoJjrN9YTpRDS5it/UI2SO9BAE37T6I3d963RxcZ81G9A4pr2SZTEiiaiKbzx+NKRg5BZ89fCL7gCJCUog==",
|
|
572
572
|
"license": "MIT",
|
|
573
573
|
"engines": {
|
|
574
574
|
"node": ">=16.9.0"
|
|
@@ -109,7 +109,9 @@ var EventProcessor = class {
|
|
|
109
109
|
method
|
|
110
110
|
};
|
|
111
111
|
if (event.body) {
|
|
112
|
-
|
|
112
|
+
const body = event.isBase64Encoded ? decodeBase64(event.body) : new TextEncoder().encode(event.body);
|
|
113
|
+
requestInit.body = body;
|
|
114
|
+
headers.set("content-length", body.length.toString());
|
|
113
115
|
}
|
|
114
116
|
return new Request(url, requestInit);
|
|
115
117
|
}
|
|
@@ -207,21 +209,17 @@ var EventV1Processor = class extends EventProcessor {
|
|
|
207
209
|
getHeaders(event) {
|
|
208
210
|
const headers = new Headers();
|
|
209
211
|
this.getCookies(event, headers);
|
|
210
|
-
if (event.headers) {
|
|
211
|
-
for (const [k, v] of Object.entries(event.headers)) {
|
|
212
|
-
if (v) {
|
|
213
|
-
headers.set(k, sanitizeHeaderValue(v));
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
212
|
if (event.multiValueHeaders) {
|
|
218
213
|
for (const [k, values] of Object.entries(event.multiValueHeaders)) {
|
|
219
214
|
if (values) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
215
|
+
values.forEach((v) => headers.append(k, sanitizeHeaderValue(v)));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (event.headers) {
|
|
220
|
+
for (const [k, v] of Object.entries(event.headers)) {
|
|
221
|
+
if (v && !headers.has(k)) {
|
|
222
|
+
headers.set(k, sanitizeHeaderValue(v));
|
|
225
223
|
}
|
|
226
224
|
}
|
|
227
225
|
}
|
|
@@ -281,7 +279,7 @@ var ALBProcessor = class extends EventProcessor {
|
|
|
281
279
|
if (result.multiValueHeaders) {
|
|
282
280
|
result.multiValueHeaders["set-cookie"] = cookies;
|
|
283
281
|
} else {
|
|
284
|
-
result.headers["set-cookie"] = cookies
|
|
282
|
+
result.headers["set-cookie"] = cookies[0];
|
|
285
283
|
}
|
|
286
284
|
}
|
|
287
285
|
};
|
|
@@ -301,11 +299,7 @@ var LatticeV2Processor = class extends EventProcessor {
|
|
|
301
299
|
if (event.headers) {
|
|
302
300
|
for (const [k, values] of Object.entries(event.headers)) {
|
|
303
301
|
if (values) {
|
|
304
|
-
|
|
305
|
-
values.forEach((v) => {
|
|
306
|
-
const sanitizedValue = sanitizeHeaderValue(v);
|
|
307
|
-
return (!foundK || !foundK.includes(sanitizedValue)) && headers.append(k, sanitizedValue);
|
|
308
|
-
});
|
|
302
|
+
values.forEach((v) => headers.append(k, sanitizeHeaderValue(v)));
|
|
309
303
|
}
|
|
310
304
|
}
|
|
311
305
|
}
|
|
@@ -316,7 +310,7 @@ var LatticeV2Processor = class extends EventProcessor {
|
|
|
316
310
|
setCookiesToResult(result, cookies) {
|
|
317
311
|
result.headers = {
|
|
318
312
|
...result.headers,
|
|
319
|
-
"set-cookie": cookies
|
|
313
|
+
"set-cookie": cookies
|
|
320
314
|
};
|
|
321
315
|
}
|
|
322
316
|
};
|
|
@@ -340,7 +334,7 @@ var isProxyEventALB = (event) => {
|
|
|
340
334
|
return false;
|
|
341
335
|
};
|
|
342
336
|
var isProxyEventV2 = (event) => {
|
|
343
|
-
return Object.hasOwn(event, "rawPath");
|
|
337
|
+
return Object.hasOwn(event, "rawPath") && Object.hasOwn(event.requestContext ?? {}, "http");
|
|
344
338
|
};
|
|
345
339
|
var isLatticeEventV2 = (event) => {
|
|
346
340
|
if (event.requestContext) {
|
|
@@ -354,10 +348,7 @@ var defaultIsContentTypeBinary = (contentType) => {
|
|
|
354
348
|
);
|
|
355
349
|
};
|
|
356
350
|
var isContentEncodingBinary = (contentEncoding) => {
|
|
357
|
-
|
|
358
|
-
return false;
|
|
359
|
-
}
|
|
360
|
-
return /^(gzip|deflate|compress|br)/.test(contentEncoding);
|
|
351
|
+
return !!contentEncoding && !/^identity$/i.test(contentEncoding);
|
|
361
352
|
};
|
|
362
353
|
export {
|
|
363
354
|
ALBProcessor,
|
|
@@ -24,7 +24,9 @@ var upgradeWebSocket = defineWebSocketHelper((c, events) => {
|
|
|
24
24
|
data: {
|
|
25
25
|
events,
|
|
26
26
|
url: new URL(c.req.url),
|
|
27
|
-
protocol
|
|
27
|
+
// The first requested subprotocol, exposed via WSContext.protocol to
|
|
28
|
+
// match the deno and cloudflare adapters.
|
|
29
|
+
protocol: c.req.header("sec-websocket-protocol")?.split(",")[0]?.trim() ?? ""
|
|
28
30
|
}
|
|
29
31
|
});
|
|
30
32
|
if (upgradeResult) {
|
|
@@ -15,21 +15,31 @@ var convertHeaders = (headers) => {
|
|
|
15
15
|
var handle = (app) => {
|
|
16
16
|
return async (event, ...args) => {
|
|
17
17
|
const [context, callback] = args;
|
|
18
|
+
let callbackError = null;
|
|
19
|
+
let callbackResult;
|
|
18
20
|
const res = await app.fetch(createRequest(event), {
|
|
19
21
|
event,
|
|
20
22
|
context,
|
|
21
23
|
callback: (err, result) => {
|
|
24
|
+
if (!callbackError && !callbackResult) {
|
|
25
|
+
callbackError = err;
|
|
26
|
+
callbackResult = result;
|
|
27
|
+
}
|
|
22
28
|
callback?.(err, result);
|
|
23
29
|
},
|
|
24
30
|
config: event.Records[0].cf.config,
|
|
25
31
|
request: event.Records[0].cf.request,
|
|
26
32
|
response: event.Records[0].cf.response
|
|
27
33
|
});
|
|
28
|
-
|
|
34
|
+
if (callbackError) {
|
|
35
|
+
throw callbackError;
|
|
36
|
+
}
|
|
37
|
+
return callbackResult ?? createResult(res);
|
|
29
38
|
};
|
|
30
39
|
};
|
|
31
40
|
var createResult = async (res) => {
|
|
32
|
-
const
|
|
41
|
+
const contentEncoding = res.headers.get("content-encoding");
|
|
42
|
+
const isBase64Encoded = isContentTypeBinary(res.headers.get("content-type") || "") || !!contentEncoding && !/^identity$/i.test(contentEncoding);
|
|
33
43
|
const body = isBase64Encoded ? encodeBase64(await res.arrayBuffer()) : await res.text();
|
|
34
44
|
return {
|
|
35
45
|
status: res.status.toString(),
|
|
@@ -45,11 +55,17 @@ var createRequest = (event) => {
|
|
|
45
55
|
const url = queryString ? `${urlPath}?${queryString}` : urlPath;
|
|
46
56
|
const headers = new Headers();
|
|
47
57
|
Object.entries(event.Records[0].cf.request.headers).forEach(([k, v]) => {
|
|
48
|
-
v.forEach((header) => headers.
|
|
58
|
+
v.forEach((header) => headers.append(k, header.value));
|
|
49
59
|
});
|
|
50
60
|
const requestBody = event.Records[0].cf.request.body;
|
|
51
61
|
const method = event.Records[0].cf.request.method;
|
|
52
|
-
const
|
|
62
|
+
const rawBody = createBody(method, requestBody);
|
|
63
|
+
let body = rawBody;
|
|
64
|
+
if (rawBody !== void 0) {
|
|
65
|
+
const bytes = typeof rawBody === "string" ? new TextEncoder().encode(rawBody) : rawBody;
|
|
66
|
+
body = bytes;
|
|
67
|
+
headers.set("content-length", bytes.length.toString());
|
|
68
|
+
}
|
|
53
69
|
return new Request(url, {
|
|
54
70
|
headers,
|
|
55
71
|
method,
|
|
@@ -139,7 +139,9 @@ class EventProcessor {
|
|
|
139
139
|
method
|
|
140
140
|
};
|
|
141
141
|
if (event.body) {
|
|
142
|
-
|
|
142
|
+
const body = event.isBase64Encoded ? (0, import_encode.decodeBase64)(event.body) : new TextEncoder().encode(event.body);
|
|
143
|
+
requestInit.body = body;
|
|
144
|
+
headers.set("content-length", body.length.toString());
|
|
143
145
|
}
|
|
144
146
|
return new Request(url, requestInit);
|
|
145
147
|
}
|
|
@@ -237,21 +239,17 @@ class EventV1Processor extends EventProcessor {
|
|
|
237
239
|
getHeaders(event) {
|
|
238
240
|
const headers = new Headers();
|
|
239
241
|
this.getCookies(event, headers);
|
|
240
|
-
if (event.headers) {
|
|
241
|
-
for (const [k, v] of Object.entries(event.headers)) {
|
|
242
|
-
if (v) {
|
|
243
|
-
headers.set(k, sanitizeHeaderValue(v));
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
242
|
if (event.multiValueHeaders) {
|
|
248
243
|
for (const [k, values] of Object.entries(event.multiValueHeaders)) {
|
|
249
244
|
if (values) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
245
|
+
values.forEach((v) => headers.append(k, sanitizeHeaderValue(v)));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (event.headers) {
|
|
250
|
+
for (const [k, v] of Object.entries(event.headers)) {
|
|
251
|
+
if (v && !headers.has(k)) {
|
|
252
|
+
headers.set(k, sanitizeHeaderValue(v));
|
|
255
253
|
}
|
|
256
254
|
}
|
|
257
255
|
}
|
|
@@ -311,7 +309,7 @@ class ALBProcessor extends EventProcessor {
|
|
|
311
309
|
if (result.multiValueHeaders) {
|
|
312
310
|
result.multiValueHeaders["set-cookie"] = cookies;
|
|
313
311
|
} else {
|
|
314
|
-
result.headers["set-cookie"] = cookies
|
|
312
|
+
result.headers["set-cookie"] = cookies[0];
|
|
315
313
|
}
|
|
316
314
|
}
|
|
317
315
|
}
|
|
@@ -331,11 +329,7 @@ class LatticeV2Processor extends EventProcessor {
|
|
|
331
329
|
if (event.headers) {
|
|
332
330
|
for (const [k, values] of Object.entries(event.headers)) {
|
|
333
331
|
if (values) {
|
|
334
|
-
|
|
335
|
-
values.forEach((v) => {
|
|
336
|
-
const sanitizedValue = sanitizeHeaderValue(v);
|
|
337
|
-
return (!foundK || !foundK.includes(sanitizedValue)) && headers.append(k, sanitizedValue);
|
|
338
|
-
});
|
|
332
|
+
values.forEach((v) => headers.append(k, sanitizeHeaderValue(v)));
|
|
339
333
|
}
|
|
340
334
|
}
|
|
341
335
|
}
|
|
@@ -346,7 +340,7 @@ class LatticeV2Processor extends EventProcessor {
|
|
|
346
340
|
setCookiesToResult(result, cookies) {
|
|
347
341
|
result.headers = {
|
|
348
342
|
...result.headers,
|
|
349
|
-
"set-cookie": cookies
|
|
343
|
+
"set-cookie": cookies
|
|
350
344
|
};
|
|
351
345
|
}
|
|
352
346
|
}
|
|
@@ -370,7 +364,7 @@ const isProxyEventALB = (event) => {
|
|
|
370
364
|
return false;
|
|
371
365
|
};
|
|
372
366
|
const isProxyEventV2 = (event) => {
|
|
373
|
-
return Object.hasOwn(event, "rawPath");
|
|
367
|
+
return Object.hasOwn(event, "rawPath") && Object.hasOwn(event.requestContext ?? {}, "http");
|
|
374
368
|
};
|
|
375
369
|
const isLatticeEventV2 = (event) => {
|
|
376
370
|
if (event.requestContext) {
|
|
@@ -384,10 +378,7 @@ const defaultIsContentTypeBinary = (contentType) => {
|
|
|
384
378
|
);
|
|
385
379
|
};
|
|
386
380
|
const isContentEncodingBinary = (contentEncoding) => {
|
|
387
|
-
|
|
388
|
-
return false;
|
|
389
|
-
}
|
|
390
|
-
return /^(gzip|deflate|compress|br)/.test(contentEncoding);
|
|
381
|
+
return !!contentEncoding && !/^identity$/i.test(contentEncoding);
|
|
391
382
|
};
|
|
392
383
|
// Annotate the CommonJS export names for ESM import in node:
|
|
393
384
|
0 && (module.exports = {
|
|
@@ -48,7 +48,9 @@ const upgradeWebSocket = (0, import_websocket.defineWebSocketHelper)((c, events)
|
|
|
48
48
|
data: {
|
|
49
49
|
events,
|
|
50
50
|
url: new URL(c.req.url),
|
|
51
|
-
protocol
|
|
51
|
+
// The first requested subprotocol, exposed via WSContext.protocol to
|
|
52
|
+
// match the deno and cloudflare adapters.
|
|
53
|
+
protocol: c.req.header("sec-websocket-protocol")?.split(",")[0]?.trim() ?? ""
|
|
52
54
|
}
|
|
53
55
|
});
|
|
54
56
|
if (upgradeResult) {
|
|
@@ -48,21 +48,31 @@ const convertHeaders = (headers) => {
|
|
|
48
48
|
const handle = (app) => {
|
|
49
49
|
return async (event, ...args) => {
|
|
50
50
|
const [context, callback] = args;
|
|
51
|
+
let callbackError = null;
|
|
52
|
+
let callbackResult;
|
|
51
53
|
const res = await app.fetch(createRequest(event), {
|
|
52
54
|
event,
|
|
53
55
|
context,
|
|
54
56
|
callback: (err, result) => {
|
|
57
|
+
if (!callbackError && !callbackResult) {
|
|
58
|
+
callbackError = err;
|
|
59
|
+
callbackResult = result;
|
|
60
|
+
}
|
|
55
61
|
callback?.(err, result);
|
|
56
62
|
},
|
|
57
63
|
config: event.Records[0].cf.config,
|
|
58
64
|
request: event.Records[0].cf.request,
|
|
59
65
|
response: event.Records[0].cf.response
|
|
60
66
|
});
|
|
61
|
-
|
|
67
|
+
if (callbackError) {
|
|
68
|
+
throw callbackError;
|
|
69
|
+
}
|
|
70
|
+
return callbackResult ?? createResult(res);
|
|
62
71
|
};
|
|
63
72
|
};
|
|
64
73
|
const createResult = async (res) => {
|
|
65
|
-
const
|
|
74
|
+
const contentEncoding = res.headers.get("content-encoding");
|
|
75
|
+
const isBase64Encoded = isContentTypeBinary(res.headers.get("content-type") || "") || !!contentEncoding && !/^identity$/i.test(contentEncoding);
|
|
66
76
|
const body = isBase64Encoded ? (0, import_encode.encodeBase64)(await res.arrayBuffer()) : await res.text();
|
|
67
77
|
return {
|
|
68
78
|
status: res.status.toString(),
|
|
@@ -78,11 +88,17 @@ const createRequest = (event) => {
|
|
|
78
88
|
const url = queryString ? `${urlPath}?${queryString}` : urlPath;
|
|
79
89
|
const headers = new Headers();
|
|
80
90
|
Object.entries(event.Records[0].cf.request.headers).forEach(([k, v]) => {
|
|
81
|
-
v.forEach((header) => headers.
|
|
91
|
+
v.forEach((header) => headers.append(k, header.value));
|
|
82
92
|
});
|
|
83
93
|
const requestBody = event.Records[0].cf.request.body;
|
|
84
94
|
const method = event.Records[0].cf.request.method;
|
|
85
|
-
const
|
|
95
|
+
const rawBody = createBody(method, requestBody);
|
|
96
|
+
let body = rawBody;
|
|
97
|
+
if (rawBody !== void 0) {
|
|
98
|
+
const bytes = typeof rawBody === "string" ? new TextEncoder().encode(rawBody) : rawBody;
|
|
99
|
+
body = bytes;
|
|
100
|
+
headers.set("content-length", bytes.length.toString());
|
|
101
|
+
}
|
|
86
102
|
return new Request(url, {
|
|
87
103
|
headers,
|
|
88
104
|
method,
|
|
@@ -184,7 +184,16 @@ const hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
|
|
|
184
184
|
});
|
|
185
185
|
if (method) {
|
|
186
186
|
options ??= {};
|
|
187
|
-
const
|
|
187
|
+
const reqOptions = { ...opts.args[1] };
|
|
188
|
+
const baseHeaders = options.headers;
|
|
189
|
+
const reqHeaders = reqOptions.headers;
|
|
190
|
+
if (baseHeaders && reqHeaders) {
|
|
191
|
+
reqOptions.headers = async () => ({
|
|
192
|
+
...typeof baseHeaders === "function" ? await baseHeaders() : baseHeaders,
|
|
193
|
+
...typeof reqHeaders === "function" ? await reqHeaders() : reqHeaders
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
const args = (0, import_utils.deepMerge)(options, reqOptions);
|
|
188
197
|
return req.fetch(opts.args[0], args);
|
|
189
198
|
}
|
|
190
199
|
return req;
|
|
@@ -36,7 +36,7 @@ const mergePath = (base, path) => {
|
|
|
36
36
|
};
|
|
37
37
|
const replaceUrlParam = (urlString, params) => {
|
|
38
38
|
for (const [k, v] of Object.entries(params)) {
|
|
39
|
-
const reg = new RegExp("/:" + k + "(?:{[^/]+})?\\??");
|
|
39
|
+
const reg = new RegExp("/:" + k + "(?:{[^/]+})?\\??(?=/|$)");
|
|
40
40
|
urlString = urlString.replace(reg, v ? `/${v}` : "");
|
|
41
41
|
}
|
|
42
42
|
return urlString;
|
|
@@ -61,6 +61,7 @@ const normalizeLabel = (label) => {
|
|
|
61
61
|
return label.trim().replace(/\s+/g, "-");
|
|
62
62
|
};
|
|
63
63
|
const isValidClassName = (name) => /^-?[_a-zA-Z][_a-zA-Z0-9-]*$/.test(name);
|
|
64
|
+
const hasUnsafeSelectorChar = (name) => /[<{}]/.test(name);
|
|
64
65
|
const RESERVED_KEYFRAME_NAMES = /* @__PURE__ */ new Set([
|
|
65
66
|
"default",
|
|
66
67
|
"inherit",
|
|
@@ -198,7 +199,8 @@ const cxCommon = (args) => {
|
|
|
198
199
|
[CLASS_NAME]: "",
|
|
199
200
|
[STYLE_STRING]: "",
|
|
200
201
|
[SELECTORS]: [],
|
|
201
|
-
|
|
202
|
+
// drop names that are unsafe to emit as a selector
|
|
203
|
+
[EXTERNAL_CLASS_NAMES]: hasUnsafeSelectorChar(arg) ? [] : [arg]
|
|
202
204
|
};
|
|
203
205
|
}
|
|
204
206
|
}
|
|
@@ -29,6 +29,7 @@ module.exports = __toCommonJS(css_exports);
|
|
|
29
29
|
var import_html = require("../../helper/html");
|
|
30
30
|
var import_constants = require("../../jsx/constants");
|
|
31
31
|
var import_css = require("../../jsx/dom/css");
|
|
32
|
+
var import_html2 = require("../../utils/html");
|
|
32
33
|
var import_common = require("./common");
|
|
33
34
|
var import_common2 = require("./common");
|
|
34
35
|
const createCssContext = ({
|
|
@@ -88,7 +89,14 @@ const createCssContext = ({
|
|
|
88
89
|
}
|
|
89
90
|
return Promise.resolve((0, import_html.raw)("", [appendStyle]));
|
|
90
91
|
};
|
|
91
|
-
const
|
|
92
|
+
const rawClassName = cssClassName[import_common.CLASS_NAME];
|
|
93
|
+
let escapedClassName = rawClassName;
|
|
94
|
+
if (/[&<>'"]/.test(rawClassName)) {
|
|
95
|
+
const escapedBuffer = [""];
|
|
96
|
+
(0, import_html2.escapeToBuffer)(rawClassName, escapedBuffer);
|
|
97
|
+
escapedClassName = escapedBuffer[0];
|
|
98
|
+
}
|
|
99
|
+
const className = new String(escapedClassName);
|
|
92
100
|
Object.assign(className, cssClassName);
|
|
93
101
|
className.isEscaped = true;
|
|
94
102
|
className.callbacks = [addClassNameToContext];
|
|
@@ -125,7 +125,7 @@ class JSXNode {
|
|
|
125
125
|
key;
|
|
126
126
|
children;
|
|
127
127
|
isEscaped = true;
|
|
128
|
-
|
|
128
|
+
suspendedContext;
|
|
129
129
|
constructor(tag, props, children) {
|
|
130
130
|
if (typeof tag !== "function" && !(0, import_utils.isValidTagName)(tag)) {
|
|
131
131
|
throw new Error(`Invalid JSX tag name: ${tag}`);
|
|
@@ -143,18 +143,12 @@ class JSXNode {
|
|
|
143
143
|
return this.props.ref || null;
|
|
144
144
|
}
|
|
145
145
|
toString() {
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
context.values.push(value);
|
|
149
|
-
});
|
|
150
|
-
try {
|
|
146
|
+
const render = () => {
|
|
147
|
+
const buffer = [""];
|
|
151
148
|
this.toStringToBuffer(buffer);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
return buffer.length === 1 ? "callbacks" in buffer ? (0, import_html2.resolveCallbackSync)((0, import_html.raw)(buffer[0], buffer.callbacks)).toString() : buffer[0] : (0, import_html2.stringBufferToString)(buffer, buffer.callbacks);
|
|
149
|
+
return buffer.length === 1 ? "callbacks" in buffer ? (0, import_html2.resolveCallbackSync)((0, import_html.raw)(buffer[0], buffer.callbacks)).toString() : buffer[0] : (0, import_html2.stringBufferToString)(buffer, buffer.callbacks);
|
|
150
|
+
};
|
|
151
|
+
return this.suspendedContext ? this.suspendedContext(render) : (0, import_context.runWithRenderContext)(render);
|
|
158
152
|
}
|
|
159
153
|
toStringToBuffer(buffer) {
|
|
160
154
|
const tag = this.tag;
|
|
@@ -230,12 +224,12 @@ class JSXFunctionNode extends JSXNode {
|
|
|
230
224
|
if (import_context.globalContexts.length === 0) {
|
|
231
225
|
buffer.unshift("", res);
|
|
232
226
|
} else {
|
|
233
|
-
const
|
|
227
|
+
const suspendedContext = (0, import_context.captureRenderContext)();
|
|
234
228
|
buffer.unshift(
|
|
235
229
|
"",
|
|
236
230
|
res.then((childRes) => {
|
|
237
231
|
if (childRes instanceof JSXNode) {
|
|
238
|
-
childRes.
|
|
232
|
+
childRes.suspendedContext = suspendedContext;
|
|
239
233
|
}
|
|
240
234
|
return childRes;
|
|
241
235
|
})
|
|
@@ -34,8 +34,9 @@ const childrenToString = async (children) => {
|
|
|
34
34
|
return children.flat().map((c) => c == null || typeof c === "boolean" ? "" : c.toString());
|
|
35
35
|
} catch (e) {
|
|
36
36
|
if (e instanceof Promise) {
|
|
37
|
+
const resume = (0, import_context.captureRenderContext)();
|
|
37
38
|
await e;
|
|
38
|
-
return childrenToString(children);
|
|
39
|
+
return resume(() => childrenToString(children));
|
|
39
40
|
} else {
|
|
40
41
|
throw e;
|
|
41
42
|
}
|
|
@@ -63,51 +64,68 @@ const ErrorBoundary = async ({ children, fallback, fallbackRender, onError }) =>
|
|
|
63
64
|
children = [children];
|
|
64
65
|
}
|
|
65
66
|
const nonce = (0, import_context.useContext)(import_streaming.StreamingContext)?.scriptNonce;
|
|
66
|
-
let
|
|
67
|
-
const
|
|
67
|
+
let resume;
|
|
68
|
+
const getResume = () => resume ||= (0, import_context.captureRenderContext)();
|
|
69
|
+
let fallbackStrPromise;
|
|
70
|
+
const resolveFallbackStr = () => fallbackStrPromise ||= (async () => {
|
|
68
71
|
const awaitedFallback = await fallback;
|
|
69
72
|
if (typeof awaitedFallback === "string") {
|
|
70
|
-
|
|
73
|
+
return awaitedFallback;
|
|
71
74
|
} else {
|
|
72
|
-
|
|
73
|
-
if (typeof
|
|
74
|
-
|
|
75
|
+
const fallbackResult = await getResume()(() => awaitedFallback?.toString());
|
|
76
|
+
if (typeof fallbackResult === "string") {
|
|
77
|
+
return (0, import_html.raw)(
|
|
78
|
+
fallbackResult,
|
|
79
|
+
fallbackResult.callbacks || awaitedFallback?.callbacks
|
|
80
|
+
);
|
|
75
81
|
}
|
|
76
82
|
}
|
|
77
|
-
};
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
return
|
|
83
|
+
})();
|
|
84
|
+
const renderFallback = async (error) => {
|
|
85
|
+
const fallbackStr = await resolveFallbackStr();
|
|
86
|
+
return getResume()(async () => {
|
|
87
|
+
onError?.(error);
|
|
88
|
+
const fallbackRes = fallbackStr !== void 0 ? fallbackStr : fallbackRender && (0, import_base.jsx)(import_base.Fragment, {}, fallbackRender(error)) || "";
|
|
89
|
+
const fallbackResString = await (0, import_base.Fragment)({
|
|
90
|
+
children: fallbackRes
|
|
91
|
+
}).toString();
|
|
92
|
+
return (0, import_html.raw)(
|
|
93
|
+
fallbackResString,
|
|
94
|
+
fallbackResString.callbacks || fallbackRes.callbacks
|
|
95
|
+
);
|
|
96
|
+
});
|
|
81
97
|
};
|
|
82
98
|
let resArray = [];
|
|
83
99
|
try {
|
|
84
100
|
resArray = children.map(resolveChildEarly);
|
|
85
101
|
} catch (e) {
|
|
86
|
-
|
|
102
|
+
const resume2 = getResume();
|
|
87
103
|
if (e instanceof Promise) {
|
|
88
104
|
resArray = [
|
|
89
|
-
e.then(() => childrenToString(children)).catch((e2) =>
|
|
105
|
+
e.then(() => resume2(() => childrenToString(children))).catch((e2) => renderFallback(e2))
|
|
90
106
|
];
|
|
91
107
|
} else {
|
|
92
|
-
resArray = [
|
|
108
|
+
resArray = [await renderFallback(e)];
|
|
93
109
|
}
|
|
94
110
|
}
|
|
95
111
|
if (resArray.some((res) => res instanceof Promise)) {
|
|
96
|
-
|
|
112
|
+
getResume();
|
|
97
113
|
const index = errorBoundaryCounter++;
|
|
98
114
|
const replaceRe = RegExp(`(<template id="E:${index}"></template>.*?)(.*?)(<!--E:${index}-->)`);
|
|
99
|
-
|
|
115
|
+
let caught = false;
|
|
100
116
|
const catchCallback = async ({ error: error2, buffer }) => {
|
|
101
117
|
if (caught) {
|
|
102
118
|
return "";
|
|
103
119
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
120
|
+
caught = true;
|
|
121
|
+
const fallbackResString = await renderFallback(error2);
|
|
122
|
+
const fallbackCallbacks = fallbackResString.callbacks;
|
|
107
123
|
if (buffer) {
|
|
108
124
|
buffer[0] = buffer[0].replace(replaceRe, fallbackResString);
|
|
125
|
+
return fallbackCallbacks?.length ? (0, import_html.raw)("", fallbackCallbacks) : "";
|
|
109
126
|
}
|
|
110
|
-
return
|
|
127
|
+
return (0, import_html.raw)(
|
|
128
|
+
`<template data-hono-target="E:${index}">${fallbackResString}</template><script>
|
|
111
129
|
((d,c,n) => {
|
|
112
130
|
c=d.currentScript.previousSibling
|
|
113
131
|
d=d.getElementById('E:${index}')
|
|
@@ -115,7 +133,9 @@ if(!d)return
|
|
|
115
133
|
do{n=d.nextSibling;n.remove()}while(n.nodeType!=8||n.nodeValue!='E:${index}')
|
|
116
134
|
d.replaceWith(c.content)
|
|
117
135
|
})(document)
|
|
118
|
-
</script
|
|
136
|
+
</script>`,
|
|
137
|
+
fallbackCallbacks
|
|
138
|
+
);
|
|
119
139
|
};
|
|
120
140
|
let error;
|
|
121
141
|
const promiseAll = Promise.all(resArray).catch((e) => error = e);
|