From 4e87195739f2a5d9a05451b48773c8afdc680765 Mon Sep 17 00:00:00 2001 From: akiyamn Date: Sun, 24 Sep 2023 23:22:21 +1000 Subject: Initial commit (by create-cloudflare CLI) --- .../wrangler/templates/pages-dev-pipeline.ts | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 node_modules/wrangler/templates/pages-dev-pipeline.ts (limited to 'node_modules/wrangler/templates/pages-dev-pipeline.ts') diff --git a/node_modules/wrangler/templates/pages-dev-pipeline.ts b/node_modules/wrangler/templates/pages-dev-pipeline.ts new file mode 100644 index 0000000..27fa4e1 --- /dev/null +++ b/node_modules/wrangler/templates/pages-dev-pipeline.ts @@ -0,0 +1,31 @@ +// @ts-ignore entry point will get replaced +import worker from "__ENTRY_POINT__"; +// @ts-ignore entry point will get replaced +export * from "__ENTRY_POINT__"; +import { isRoutingRuleMatch } from "./pages-dev-util"; + +// @ts-ignore routes are injected +const routes = __ROUTES__; + +export default >{ + fetch(request, env, context) { + const { pathname } = new URL(request.url); + + for (const exclude of routes.exclude) { + if (isRoutingRuleMatch(pathname, exclude)) { + return env.ASSETS.fetch(request); + } + } + + for (const include of routes.include) { + if (isRoutingRuleMatch(pathname, include)) { + if (worker.fetch === undefined) { + throw new TypeError("Entry point missing `fetch` handler"); + } + return worker.fetch(request, env, context); + } + } + + return env.ASSETS.fetch(request); + }, +}; -- cgit v1.2.3