one 1.25.12 → 1.25.15
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/cjs/cli/build.cjs +37 -186
- package/dist/cjs/cli/build.native.js +270 -423
- package/dist/cjs/cli/build.native.js.map +1 -1
- package/dist/cjs/cli/buildPage.cjs +7 -7
- package/dist/cjs/cli/buildPage.native.js +7 -7
- package/dist/cjs/cli/buildPage.native.js.map +1 -1
- package/dist/cjs/cli/buildPageWorker.cjs +1 -1
- package/dist/cjs/cli/buildPageWorker.native.js +1 -1
- package/dist/cjs/cli/buildPageWorker.native.js.map +1 -1
- package/dist/cjs/cli/serverRouteModules.cjs +47 -0
- package/dist/cjs/cli/serverRouteModules.native.js +52 -0
- package/dist/cjs/cli/serverRouteModules.native.js.map +1 -0
- package/dist/cjs/cli/workerPool.native.js.map +1 -1
- package/dist/cjs/createApp.cjs +3 -0
- package/dist/cjs/createDevHandleRequest.cjs +151 -0
- package/dist/cjs/createDevHandleRequest.native.js +194 -0
- package/dist/cjs/createDevHandleRequest.native.js.map +1 -0
- package/dist/cjs/createHandleRequest.cjs +1 -123
- package/dist/cjs/createHandleRequest.native.js +1 -163
- package/dist/cjs/createHandleRequest.native.js.map +1 -1
- package/dist/cjs/createHandleRequest.test.cjs +25 -25
- package/dist/cjs/createHandleRequest.test.native.js +25 -25
- package/dist/cjs/createHandleRequest.test.native.js.map +1 -1
- package/dist/cjs/headless-server.native.js.map +1 -1
- package/dist/cjs/headless.cjs +4 -0
- package/dist/cjs/headless.native.js +4 -0
- package/dist/cjs/headless.native.js.map +1 -1
- package/dist/cjs/layouts/Drawer.cjs +0 -2
- package/dist/cjs/layouts/Drawer.native.js.map +1 -1
- package/dist/cjs/layouts/Tabs.cjs +0 -2
- package/dist/cjs/layouts/Tabs.native.js.map +1 -1
- package/dist/cjs/router/diagnoseRouteLoadFailure.native.js.map +1 -1
- package/dist/cjs/router/useViteRoutes.cjs +9 -1
- package/dist/cjs/router/useViteRoutes.native.js +9 -1
- package/dist/cjs/router/useViteRoutes.native.js.map +1 -1
- package/dist/cjs/router/web/WebStackView.cjs +0 -2
- package/dist/cjs/router/web/WebStackView.native.js +0 -2
- package/dist/cjs/router/web/WebStackView.native.js.map +1 -1
- package/dist/cjs/serve-worker.cjs +3 -2
- package/dist/cjs/serve-worker.native.js +3 -2
- package/dist/cjs/serve-worker.native.js.map +1 -1
- package/dist/cjs/server/oneServe.cjs +23 -4
- package/dist/cjs/server/oneServe.native.js +25 -6
- package/dist/cjs/server/oneServe.native.js.map +1 -1
- package/dist/cjs/server/routeExportsFromEntry.cjs +47 -0
- package/dist/cjs/server/routeExportsFromEntry.native.js +52 -0
- package/dist/cjs/server/routeExportsFromEntry.native.js.map +1 -0
- package/dist/cjs/server/workerHandler.cjs +30 -12
- package/dist/cjs/server/workerHandler.native.js +32 -13
- package/dist/cjs/server/workerHandler.native.js.map +1 -1
- package/dist/cjs/server/workerHandler.test.cjs +43 -10
- package/dist/cjs/server/workerHandler.test.native.js +46 -10
- package/dist/cjs/server/workerHandler.test.native.js.map +1 -1
- package/dist/cjs/views/ScrollBehavior.native.js.map +1 -1
- package/dist/cjs/vite/cloudflareWranglerConfig.cjs +247 -0
- package/dist/cjs/vite/cloudflareWranglerConfig.native.js +392 -0
- package/dist/cjs/vite/cloudflareWranglerConfig.native.js.map +1 -0
- package/dist/cjs/vite/cloudflareWranglerConfig.test.cjs +116 -0
- package/dist/cjs/vite/cloudflareWranglerConfig.test.native.js +120 -0
- package/dist/cjs/vite/cloudflareWranglerConfig.test.native.js.map +1 -0
- package/dist/cjs/vite/one.cjs +4 -2
- package/dist/cjs/vite/one.native.js +8 -6
- package/dist/cjs/vite/one.native.js.map +1 -1
- package/dist/cjs/vite/plugins/SSRCSSPlugin.cjs +10 -1
- package/dist/cjs/vite/plugins/SSRCSSPlugin.native.js +52 -3
- package/dist/cjs/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/environmentGuardPlugin.cjs +1 -1
- package/dist/cjs/vite/plugins/environmentGuardPlugin.native.js +1 -1
- package/dist/cjs/vite/plugins/environmentGuardPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/environmentGuardPlugin.test.cjs +4 -0
- package/dist/cjs/vite/plugins/environmentGuardPlugin.test.native.js +4 -0
- package/dist/cjs/vite/plugins/environmentGuardPlugin.test.native.js.map +1 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.cjs +14 -5
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js +15 -5
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.test.cjs +47 -0
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.test.native.js +47 -0
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.test.native.js.map +1 -1
- package/dist/cjs/vite/plugins/virtualEntryPlugin.cjs +9 -7
- package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js +11 -7
- package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/virtualEntryPlugin.test.cjs +12 -0
- package/dist/cjs/vite/plugins/virtualEntryPlugin.test.native.js +12 -0
- package/dist/cjs/vite/plugins/virtualEntryPlugin.test.native.js.map +1 -1
- package/dist/cjs/vite/plugins/workerdDevPlugin.cjs +364 -0
- package/dist/cjs/vite/plugins/workerdDevPlugin.native.js +461 -0
- package/dist/cjs/vite/plugins/workerdDevPlugin.native.js.map +1 -0
- package/dist/cjs/vite/plugins/workerdDevPlugin.test.cjs +42 -0
- package/dist/cjs/vite/plugins/workerdDevPlugin.test.native.js +45 -0
- package/dist/cjs/vite/plugins/workerdDevPlugin.test.native.js.map +1 -0
- package/dist/cjs/vite/replaceLoader.cjs +6 -3
- package/dist/cjs/vite/replaceLoader.native.js +8 -3
- package/dist/cjs/vite/replaceLoader.native.js.map +1 -1
- package/dist/esm/cli/build.mjs +31 -180
- package/dist/esm/cli/build.mjs.map +1 -1
- package/dist/esm/cli/build.native.js +264 -417
- package/dist/esm/cli/build.native.js.map +1 -1
- package/dist/esm/cli/buildPage.mjs +7 -7
- package/dist/esm/cli/buildPage.mjs.map +1 -1
- package/dist/esm/cli/buildPage.native.js +7 -7
- package/dist/esm/cli/buildPage.native.js.map +1 -1
- package/dist/esm/cli/buildPageWorker.mjs +1 -1
- package/dist/esm/cli/buildPageWorker.mjs.map +1 -1
- package/dist/esm/cli/buildPageWorker.native.js +1 -1
- package/dist/esm/cli/buildPageWorker.native.js.map +1 -1
- package/dist/esm/cli/serverRouteModules.mjs +22 -0
- package/dist/esm/cli/serverRouteModules.mjs.map +1 -0
- package/dist/esm/cli/serverRouteModules.native.js +24 -0
- package/dist/esm/cli/serverRouteModules.native.js.map +1 -0
- package/dist/esm/cli/workerPool.mjs.map +1 -1
- package/dist/esm/cli/workerPool.native.js.map +1 -1
- package/dist/esm/createApp.mjs +4 -1
- package/dist/esm/createApp.mjs.map +1 -1
- package/dist/esm/createDevHandleRequest.mjs +126 -0
- package/dist/esm/createDevHandleRequest.mjs.map +1 -0
- package/dist/esm/createDevHandleRequest.native.js +166 -0
- package/dist/esm/createDevHandleRequest.native.js.map +1 -0
- package/dist/esm/createHandleRequest.mjs +1 -123
- package/dist/esm/createHandleRequest.mjs.map +1 -1
- package/dist/esm/createHandleRequest.native.js +1 -163
- package/dist/esm/createHandleRequest.native.js.map +1 -1
- package/dist/esm/createHandleRequest.test.mjs +1 -1
- package/dist/esm/createHandleRequest.test.native.js +1 -1
- package/dist/esm/headless-server.mjs.map +1 -1
- package/dist/esm/headless-server.native.js.map +1 -1
- package/dist/esm/headless.mjs +4 -0
- package/dist/esm/headless.mjs.map +1 -1
- package/dist/esm/headless.native.js +4 -0
- package/dist/esm/headless.native.js.map +1 -1
- package/dist/esm/layouts/Drawer.mjs +0 -2
- package/dist/esm/layouts/Drawer.mjs.map +1 -1
- package/dist/esm/layouts/Drawer.native.js.map +1 -1
- package/dist/esm/layouts/Tabs.mjs +0 -2
- package/dist/esm/layouts/Tabs.mjs.map +1 -1
- package/dist/esm/layouts/Tabs.native.js.map +1 -1
- package/dist/esm/router/diagnoseRouteLoadFailure.mjs.map +1 -1
- package/dist/esm/router/diagnoseRouteLoadFailure.native.js.map +1 -1
- package/dist/esm/router/useViteRoutes.mjs +9 -1
- package/dist/esm/router/useViteRoutes.mjs.map +1 -1
- package/dist/esm/router/useViteRoutes.native.js +9 -1
- package/dist/esm/router/useViteRoutes.native.js.map +1 -1
- package/dist/esm/router/web/WebStackView.mjs +0 -2
- package/dist/esm/router/web/WebStackView.mjs.map +1 -1
- package/dist/esm/router/web/WebStackView.native.js +0 -2
- package/dist/esm/router/web/WebStackView.native.js.map +1 -1
- package/dist/esm/serve-worker.mjs +3 -2
- package/dist/esm/serve-worker.mjs.map +1 -1
- package/dist/esm/serve-worker.native.js +3 -2
- package/dist/esm/serve-worker.native.js.map +1 -1
- package/dist/esm/server/oneServe.mjs +23 -4
- package/dist/esm/server/oneServe.mjs.map +1 -1
- package/dist/esm/server/oneServe.native.js +25 -6
- package/dist/esm/server/oneServe.native.js.map +1 -1
- package/dist/esm/server/routeExportsFromEntry.mjs +21 -0
- package/dist/esm/server/routeExportsFromEntry.mjs.map +1 -0
- package/dist/esm/server/routeExportsFromEntry.native.js +23 -0
- package/dist/esm/server/routeExportsFromEntry.native.js.map +1 -0
- package/dist/esm/server/workerHandler.mjs +30 -12
- package/dist/esm/server/workerHandler.mjs.map +1 -1
- package/dist/esm/server/workerHandler.native.js +32 -13
- package/dist/esm/server/workerHandler.native.js.map +1 -1
- package/dist/esm/server/workerHandler.test.mjs +43 -10
- package/dist/esm/server/workerHandler.test.mjs.map +1 -1
- package/dist/esm/server/workerHandler.test.native.js +46 -10
- package/dist/esm/server/workerHandler.test.native.js.map +1 -1
- package/dist/esm/views/ScrollBehavior.mjs.map +1 -1
- package/dist/esm/views/ScrollBehavior.native.js.map +1 -1
- package/dist/esm/vite/cloudflareWranglerConfig.mjs +202 -0
- package/dist/esm/vite/cloudflareWranglerConfig.mjs.map +1 -0
- package/dist/esm/vite/cloudflareWranglerConfig.native.js +344 -0
- package/dist/esm/vite/cloudflareWranglerConfig.native.js.map +1 -0
- package/dist/esm/vite/cloudflareWranglerConfig.test.mjs +117 -0
- package/dist/esm/vite/cloudflareWranglerConfig.test.mjs.map +1 -0
- package/dist/esm/vite/cloudflareWranglerConfig.test.native.js +118 -0
- package/dist/esm/vite/cloudflareWranglerConfig.test.native.js.map +1 -0
- package/dist/esm/vite/one.mjs +4 -2
- package/dist/esm/vite/one.mjs.map +1 -1
- package/dist/esm/vite/one.native.js +8 -6
- package/dist/esm/vite/one.native.js.map +1 -1
- package/dist/esm/vite/plugins/SSRCSSPlugin.mjs +10 -1
- package/dist/esm/vite/plugins/SSRCSSPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/SSRCSSPlugin.native.js +52 -3
- package/dist/esm/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/environmentGuardPlugin.mjs +1 -1
- package/dist/esm/vite/plugins/environmentGuardPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/environmentGuardPlugin.native.js +1 -1
- package/dist/esm/vite/plugins/environmentGuardPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/environmentGuardPlugin.test.mjs +4 -0
- package/dist/esm/vite/plugins/environmentGuardPlugin.test.mjs.map +1 -1
- package/dist/esm/vite/plugins/environmentGuardPlugin.test.native.js +4 -0
- package/dist/esm/vite/plugins/environmentGuardPlugin.test.native.js.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs +13 -4
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +14 -4
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.test.mjs +47 -0
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.test.mjs.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.test.native.js +47 -0
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.test.native.js.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.mjs +9 -7
- package/dist/esm/vite/plugins/virtualEntryPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.native.js +11 -7
- package/dist/esm/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.test.mjs +12 -0
- package/dist/esm/vite/plugins/virtualEntryPlugin.test.mjs.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.test.native.js +12 -0
- package/dist/esm/vite/plugins/virtualEntryPlugin.test.native.js.map +1 -1
- package/dist/esm/vite/plugins/workerdDevPlugin.mjs +336 -0
- package/dist/esm/vite/plugins/workerdDevPlugin.mjs.map +1 -0
- package/dist/esm/vite/plugins/workerdDevPlugin.native.js +430 -0
- package/dist/esm/vite/plugins/workerdDevPlugin.native.js.map +1 -0
- package/dist/esm/vite/plugins/workerdDevPlugin.test.mjs +43 -0
- package/dist/esm/vite/plugins/workerdDevPlugin.test.mjs.map +1 -0
- package/dist/esm/vite/plugins/workerdDevPlugin.test.native.js +43 -0
- package/dist/esm/vite/plugins/workerdDevPlugin.test.native.js.map +1 -0
- package/dist/esm/vite/replaceLoader.mjs +6 -3
- package/dist/esm/vite/replaceLoader.mjs.map +1 -1
- package/dist/esm/vite/replaceLoader.native.js +8 -3
- package/dist/esm/vite/replaceLoader.native.js.map +1 -1
- package/package.json +9 -9
- package/src/cli/build.ts +48 -224
- package/src/cli/buildPage.ts +9 -7
- package/src/cli/buildPageWorker.ts +1 -0
- package/src/cli/serverRouteModules.ts +33 -0
- package/src/cli/workerPool.ts +1 -0
- package/src/createApp.tsx +5 -1
- package/src/createDevHandleRequest.ts +186 -0
- package/src/createHandleRequest.test.ts +1 -1
- package/src/createHandleRequest.ts +2 -172
- package/src/headless-server.ts +0 -1
- package/src/headless.tsx +5 -0
- package/src/layouts/Drawer.web.tsx +0 -3
- package/src/layouts/Tabs.web.tsx +0 -2
- package/src/router/diagnoseRouteLoadFailure.ts +3 -1
- package/src/router/useViteRoutes.tsx +9 -1
- package/src/router/web/WebStackView.tsx +0 -3
- package/src/serve-worker.ts +6 -1
- package/src/server/oneServe.ts +40 -16
- package/src/server/routeExportsFromEntry.ts +59 -0
- package/src/server/workerHandler.test.ts +37 -9
- package/src/server/workerHandler.ts +39 -13
- package/src/views/ScrollBehavior.tsx +5 -1
- package/src/vite/cloudflareWranglerConfig.test.ts +101 -0
- package/src/vite/cloudflareWranglerConfig.ts +252 -0
- package/src/vite/one.ts +14 -1
- package/src/vite/plugins/SSRCSSPlugin.ts +17 -2
- package/src/vite/plugins/environmentGuardPlugin.test.ts +5 -0
- package/src/vite/plugins/environmentGuardPlugin.ts +2 -2
- package/src/vite/plugins/fileSystemRouterPlugin.test.ts +44 -0
- package/src/vite/plugins/fileSystemRouterPlugin.tsx +20 -8
- package/src/vite/plugins/virtualEntryPlugin.test.ts +13 -0
- package/src/vite/plugins/virtualEntryPlugin.ts +13 -9
- package/src/vite/plugins/workerdDevPlugin.test.ts +44 -0
- package/src/vite/plugins/workerdDevPlugin.ts +398 -0
- package/src/vite/replaceLoader.ts +10 -2
- package/types/cli/build.d.ts.map +1 -1
- package/types/cli/buildPage.d.ts +1 -1
- package/types/cli/buildPage.d.ts.map +1 -1
- package/types/cli/serverRouteModules.d.ts +2 -0
- package/types/cli/serverRouteModules.d.ts.map +1 -0
- package/types/cli/workerPool.d.ts +1 -0
- package/types/cli/workerPool.d.ts.map +1 -1
- package/types/createApp.d.ts.map +1 -1
- package/types/createDevHandleRequest.d.ts +10 -0
- package/types/createDevHandleRequest.d.ts.map +1 -0
- package/types/createHandleRequest.d.ts +2 -9
- package/types/createHandleRequest.d.ts.map +1 -1
- package/types/headless-server.d.ts +0 -1
- package/types/headless-server.d.ts.map +1 -1
- package/types/headless.d.ts.map +1 -1
- package/types/layouts/Drawer.web.d.ts.map +1 -1
- package/types/layouts/Tabs.web.d.ts.map +1 -1
- package/types/router/diagnoseRouteLoadFailure.d.ts.map +1 -1
- package/types/router/useViteRoutes.d.ts.map +1 -1
- package/types/router/web/WebStackView.d.ts.map +1 -1
- package/types/serve-worker.d.ts +3 -1
- package/types/serve-worker.d.ts.map +1 -1
- package/types/server/oneServe.d.ts +1 -1
- package/types/server/oneServe.d.ts.map +1 -1
- package/types/server/routeExportsFromEntry.d.ts +29 -0
- package/types/server/routeExportsFromEntry.d.ts.map +1 -0
- package/types/server/workerHandler.d.ts +2 -1
- package/types/server/workerHandler.d.ts.map +1 -1
- package/types/views/ScrollBehavior.d.ts.map +1 -1
- package/types/vite/cloudflareWranglerConfig.d.ts +21 -0
- package/types/vite/cloudflareWranglerConfig.d.ts.map +1 -0
- package/types/vite/cloudflareWranglerConfig.test.d.ts +2 -0
- package/types/vite/cloudflareWranglerConfig.test.d.ts.map +1 -0
- package/types/vite/one.d.ts.map +1 -1
- package/types/vite/plugins/SSRCSSPlugin.d.ts.map +1 -1
- package/types/vite/plugins/fileSystemRouterPlugin.d.ts.map +1 -1
- package/types/vite/plugins/virtualEntryPlugin.d.ts.map +1 -1
- package/types/vite/plugins/workerdDevPlugin.d.ts +15 -0
- package/types/vite/plugins/workerdDevPlugin.d.ts.map +1 -0
- package/types/vite/plugins/workerdDevPlugin.test.d.ts +2 -0
- package/types/vite/plugins/workerdDevPlugin.test.d.ts.map +1 -0
- package/types/vite/replaceLoader.d.ts +2 -1
- package/types/vite/replaceLoader.d.ts.map +1 -1
- package/dist/cjs/headless/devHeadlessNote.cjs +0 -34
- package/dist/cjs/headless/devHeadlessNote.native.js +0 -37
- package/dist/cjs/headless/devHeadlessNote.native.js.map +0 -1
- package/dist/esm/headless/devHeadlessNote.mjs +0 -9
- package/dist/esm/headless/devHeadlessNote.mjs.map +0 -1
- package/dist/esm/headless/devHeadlessNote.native.js +0 -9
- package/dist/esm/headless/devHeadlessNote.native.js.map +0 -1
- package/src/headless/devHeadlessNote.ts +0 -13
- package/types/headless/devHeadlessNote.d.ts +0 -2
- package/types/headless/devHeadlessNote.d.ts.map +0 -1
|
@@ -55,6 +55,7 @@ var import_getRouterRootFromOneOptions = require("../utils/getRouterRootFromOneO
|
|
|
55
55
|
var import_isRolldown = require("../utils/isRolldown.native.js");
|
|
56
56
|
var import_toAbsolute = require("../utils/toAbsolute.native.js");
|
|
57
57
|
var import_buildVercelOutputDirectory = require("../vercel/build/buildVercelOutputDirectory.native.js");
|
|
58
|
+
var import_cloudflareWranglerConfig = require("../vite/cloudflareWranglerConfig.native.js");
|
|
58
59
|
var import_getManifest = require("../vite/getManifest.native.js");
|
|
59
60
|
var import_loadConfig = require("../vite/loadConfig.native.js");
|
|
60
61
|
var import_one_server_only = require("../vite/one-server-only.native.js");
|
|
@@ -63,6 +64,7 @@ var import_checkNodeVersion = require("./checkNodeVersion.native.js");
|
|
|
63
64
|
var import_workerPool = require("./workerPool.native.js");
|
|
64
65
|
var import_generateSitemap = require("./generateSitemap.native.js");
|
|
65
66
|
var import_label_process = require("./label-process.native.js");
|
|
67
|
+
var import_serverRouteModules = require("./serverRouteModules.native.js");
|
|
66
68
|
var import_pLimit = require("../utils/pLimit.native.js");
|
|
67
69
|
var import_criticalCSSPlugin = require("../vite/plugins/criticalCSSPlugin.native.js");
|
|
68
70
|
var import_install_error_handlers = require("./install-error-handlers.native.js");
|
|
@@ -83,198 +85,10 @@ function normalizeDeploy(deploy) {
|
|
|
83
85
|
};
|
|
84
86
|
return deploy;
|
|
85
87
|
}
|
|
86
|
-
var GENERATED_CLOUDFLARE_WRANGLER_RULES = [{
|
|
87
|
-
type: "ESModule",
|
|
88
|
-
globs: ["./server/**/*.js"],
|
|
89
|
-
fallthrough: true
|
|
90
|
-
}, {
|
|
91
|
-
type: "ESModule",
|
|
92
|
-
globs: ["./api/**/*.js"],
|
|
93
|
-
fallthrough: true
|
|
94
|
-
}, {
|
|
95
|
-
type: "ESModule",
|
|
96
|
-
globs: ["./middlewares/**/*.js"],
|
|
97
|
-
fallthrough: true
|
|
98
|
-
}, {
|
|
99
|
-
type: "ESModule",
|
|
100
|
-
globs: ["./assets/**/*.js"],
|
|
101
|
-
fallthrough: true
|
|
102
|
-
}];
|
|
103
88
|
var CLOUDFLARE_DEPLOY_WRANGLER_RULES = [{
|
|
104
89
|
type: "ESModule",
|
|
105
90
|
globs: ["assets/**/*.js", "assets/**/*.mjs"]
|
|
106
91
|
}];
|
|
107
|
-
function isPlainObject(value) {
|
|
108
|
-
return !!value && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && !Array.isArray(value);
|
|
109
|
-
}
|
|
110
|
-
function mergeJsonObjects(base, overrides) {
|
|
111
|
-
var merged = {
|
|
112
|
-
...base
|
|
113
|
-
};
|
|
114
|
-
var _iteratorNormalCompletion = true,
|
|
115
|
-
_didIteratorError = false,
|
|
116
|
-
_iteratorError = void 0;
|
|
117
|
-
try {
|
|
118
|
-
for (var _iterator = Object.entries(overrides)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
119
|
-
var [key, value] = _step.value;
|
|
120
|
-
var baseValue = merged[key];
|
|
121
|
-
if (isPlainObject(baseValue) && isPlainObject(value)) {
|
|
122
|
-
merged[key] = mergeJsonObjects(baseValue, value);
|
|
123
|
-
} else {
|
|
124
|
-
merged[key] = value;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
} catch (err) {
|
|
128
|
-
_didIteratorError = true;
|
|
129
|
-
_iteratorError = err;
|
|
130
|
-
} finally {
|
|
131
|
-
try {
|
|
132
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
133
|
-
_iterator.return();
|
|
134
|
-
}
|
|
135
|
-
} finally {
|
|
136
|
-
if (_didIteratorError) {
|
|
137
|
-
throw _iteratorError;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return merged;
|
|
142
|
-
}
|
|
143
|
-
function dedupeJsonValues(values) {
|
|
144
|
-
var seen = /* @__PURE__ */new Set();
|
|
145
|
-
return values.filter(function (value) {
|
|
146
|
-
var key = JSON.stringify(value);
|
|
147
|
-
if (seen.has(key)) return false;
|
|
148
|
-
seen.add(key);
|
|
149
|
-
return true;
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
function mergeCloudflareCompatibilityFlags(flags) {
|
|
153
|
-
var userFlags = Array.isArray(flags) ? flags.filter(function (flag) {
|
|
154
|
-
return typeof flag === "string";
|
|
155
|
-
}) : [];
|
|
156
|
-
return dedupeJsonValues(["nodejs_compat", ...userFlags]);
|
|
157
|
-
}
|
|
158
|
-
function mergeCloudflareRules(rules) {
|
|
159
|
-
var userRules = Array.isArray(rules) ? rules.filter(function (rule) {
|
|
160
|
-
return isPlainObject(rule);
|
|
161
|
-
}) : [];
|
|
162
|
-
return dedupeJsonValues([...GENERATED_CLOUDFLARE_WRANGLER_RULES, ...userRules]);
|
|
163
|
-
}
|
|
164
|
-
function parseJsonc(text) {
|
|
165
|
-
var out = "";
|
|
166
|
-
var i = 0;
|
|
167
|
-
var inString = false;
|
|
168
|
-
var quote = "";
|
|
169
|
-
while (i < text.length) {
|
|
170
|
-
var ch = text[i];
|
|
171
|
-
var next = text[i + 1];
|
|
172
|
-
if (inString) {
|
|
173
|
-
if (ch === "\\") {
|
|
174
|
-
out += ch + (next !== null && next !== void 0 ? next : "");
|
|
175
|
-
i += 2;
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
if (ch === quote) inString = false;
|
|
179
|
-
out += ch;
|
|
180
|
-
i++;
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
if (ch === '"' || ch === "'") {
|
|
184
|
-
inString = true;
|
|
185
|
-
quote = ch;
|
|
186
|
-
out += ch;
|
|
187
|
-
i++;
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
if (ch === "/" && next === "/") {
|
|
191
|
-
while (i < text.length && text[i] !== "\n") i++;
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
if (ch === "/" && next === "*") {
|
|
195
|
-
i += 2;
|
|
196
|
-
while (i < text.length - 1 && !(text[i] === "*" && text[i + 1] === "/")) i++;
|
|
197
|
-
i += 2;
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
out += ch;
|
|
201
|
-
i++;
|
|
202
|
-
}
|
|
203
|
-
return JSON.parse(out.replace(/,(\s*[}\]])/g, "$1"));
|
|
204
|
-
}
|
|
205
|
-
async function loadUserWranglerConfig(root) {
|
|
206
|
-
var candidateRoots = [... /* @__PURE__ */new Set([root, process.cwd()])];
|
|
207
|
-
var _iteratorNormalCompletion = true,
|
|
208
|
-
_didIteratorError = false,
|
|
209
|
-
_iteratorError = void 0;
|
|
210
|
-
try {
|
|
211
|
-
for (var _iterator = candidateRoots[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
212
|
-
var candidateRoot = _step.value;
|
|
213
|
-
for (var _i = 0, _iter = ["wrangler.jsonc", "wrangler.json"]; _i < _iter.length; _i++) {
|
|
214
|
-
var fileName = _iter[_i];
|
|
215
|
-
var configPath = (0, import_path.join)(candidateRoot, fileName);
|
|
216
|
-
if (!(await import_fs_extra.default.pathExists(configPath))) {
|
|
217
|
-
continue;
|
|
218
|
-
}
|
|
219
|
-
var contents = await import_fs_extra.default.readFile(configPath, "utf-8");
|
|
220
|
-
var parsed = void 0;
|
|
221
|
-
try {
|
|
222
|
-
parsed = parseJsonc(contents);
|
|
223
|
-
} catch (err) {
|
|
224
|
-
throw new Error(`Failed to parse ${(0, import_path.relative)(process.cwd(), configPath)}: ${err.message}`);
|
|
225
|
-
}
|
|
226
|
-
if (!isPlainObject(parsed)) {
|
|
227
|
-
throw new Error(`Expected ${(0, import_path.relative)(process.cwd(), configPath)} to contain a top-level JSON object`);
|
|
228
|
-
}
|
|
229
|
-
return {
|
|
230
|
-
path: configPath,
|
|
231
|
-
config: parsed
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
} catch (err) {
|
|
236
|
-
_didIteratorError = true;
|
|
237
|
-
_iteratorError = err;
|
|
238
|
-
} finally {
|
|
239
|
-
try {
|
|
240
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
241
|
-
_iterator.return();
|
|
242
|
-
}
|
|
243
|
-
} finally {
|
|
244
|
-
if (_didIteratorError) {
|
|
245
|
-
throw _iteratorError;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
return null;
|
|
250
|
-
}
|
|
251
|
-
function createCloudflareWranglerConfig(projectName, userConfig) {
|
|
252
|
-
var generatedConfig = {
|
|
253
|
-
name: projectName,
|
|
254
|
-
main: "worker.js",
|
|
255
|
-
compatibility_date: "2024-12-05",
|
|
256
|
-
compatibility_flags: ["nodejs_compat"],
|
|
257
|
-
find_additional_modules: true,
|
|
258
|
-
rules: GENERATED_CLOUDFLARE_WRANGLER_RULES,
|
|
259
|
-
assets: {
|
|
260
|
-
directory: "client",
|
|
261
|
-
binding: "ASSETS",
|
|
262
|
-
run_worker_first: true
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
var mergedConfig = userConfig ? mergeJsonObjects(generatedConfig, userConfig) : generatedConfig;
|
|
266
|
-
mergedConfig.main = "worker.js";
|
|
267
|
-
mergedConfig.find_additional_modules = true;
|
|
268
|
-
mergedConfig.compatibility_flags = mergeCloudflareCompatibilityFlags(mergedConfig.compatibility_flags);
|
|
269
|
-
mergedConfig.rules = mergeCloudflareRules(mergedConfig.rules);
|
|
270
|
-
mergedConfig.assets = {
|
|
271
|
-
...(isPlainObject(mergedConfig.assets) ? mergedConfig.assets : {}),
|
|
272
|
-
directory: "client",
|
|
273
|
-
binding: "ASSETS",
|
|
274
|
-
run_worker_first: true
|
|
275
|
-
};
|
|
276
|
-
return mergedConfig;
|
|
277
|
-
}
|
|
278
92
|
function omitEmptyJsonValues(value) {
|
|
279
93
|
if (Array.isArray(value)) {
|
|
280
94
|
var items = value.map(function (item) {
|
|
@@ -284,7 +98,7 @@ function omitEmptyJsonValues(value) {
|
|
|
284
98
|
});
|
|
285
99
|
return items.length > 0 ? items : void 0;
|
|
286
100
|
}
|
|
287
|
-
if (isPlainObject(value)) {
|
|
101
|
+
if ((0, import_cloudflareWranglerConfig.isPlainObject)(value)) {
|
|
288
102
|
var entries = Object.entries(value).map(function (param) {
|
|
289
103
|
var [key, item] = param;
|
|
290
104
|
return [key, omitEmptyJsonValues(item)];
|
|
@@ -297,26 +111,17 @@ function omitEmptyJsonValues(value) {
|
|
|
297
111
|
}
|
|
298
112
|
async function finalizeCloudflareWranglerDeployConfig(configPath) {
|
|
299
113
|
var parsed = JSON.parse(await import_fs_extra.default.readFile(configPath, "utf-8"));
|
|
300
|
-
if (!isPlainObject(parsed)) {
|
|
114
|
+
if (!(0, import_cloudflareWranglerConfig.isPlainObject)(parsed)) {
|
|
301
115
|
throw new Error(`Expected ${(0, import_path.relative)(process.cwd(), configPath)} to contain a JSON object`);
|
|
302
116
|
}
|
|
303
117
|
parsed.rules = CLOUDFLARE_DEPLOY_WRANGLER_RULES;
|
|
304
118
|
var config = omitEmptyJsonValues(parsed);
|
|
305
|
-
if (!isPlainObject(config)) {
|
|
119
|
+
if (!(0, import_cloudflareWranglerConfig.isPlainObject)(config)) {
|
|
306
120
|
throw new Error(`Expected ${(0, import_path.relative)(process.cwd(), configPath)} to contain deploy config`);
|
|
307
121
|
}
|
|
308
122
|
await import_fs_extra.default.writeFile(configPath, `${JSON.stringify(config, null, 2)}
|
|
309
123
|
`);
|
|
310
124
|
}
|
|
311
|
-
async function getCloudflareProjectName(root) {
|
|
312
|
-
try {
|
|
313
|
-
var pkg = JSON.parse(await import_fs_extra.default.readFile((0, import_path.join)(root, "package.json"), "utf-8"));
|
|
314
|
-
if (pkg.name) {
|
|
315
|
-
return pkg.name.replace(/^@[^/]+\//, "");
|
|
316
|
-
}
|
|
317
|
-
} catch (unused) {}
|
|
318
|
-
return "one-app";
|
|
319
|
-
}
|
|
320
125
|
process.env.ONE_CACHE_KEY = constants.CACHE_KEY;
|
|
321
126
|
function shouldUseWorkers(oneOptions) {
|
|
322
127
|
var _oneOptions_build;
|
|
@@ -417,7 +222,7 @@ async function build(args) {
|
|
|
417
222
|
var deployConfig = normalizeDeploy((_oneOptions_web1 = oneOptions.web) === null || _oneOptions_web1 === void 0 ? void 0 : _oneOptions_web1.deploy);
|
|
418
223
|
if (!process.env.ONE_SERVER_URL && deployConfig) {
|
|
419
224
|
var _deployConfig_url;
|
|
420
|
-
var url = (_deployConfig_url = deployConfig.url) !== null && _deployConfig_url !== void 0 ? _deployConfig_url : deployConfig.target === "cloudflare" ? `https://${await getCloudflareProjectName(process.cwd())}.workers.dev` : void 0;
|
|
225
|
+
var url = (_deployConfig_url = deployConfig.url) !== null && _deployConfig_url !== void 0 ? _deployConfig_url : deployConfig.target === "cloudflare" ? `https://${await (0, import_cloudflareWranglerConfig.getCloudflareProjectName)(process.cwd())}.workers.dev` : void 0;
|
|
421
226
|
if (url) {
|
|
422
227
|
process.env.ONE_SERVER_URL = url;
|
|
423
228
|
console.info(`
|
|
@@ -673,11 +478,33 @@ async function build(args) {
|
|
|
673
478
|
try {
|
|
674
479
|
for (var _iterator1 = vxrnOutput.clientOutput[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
675
480
|
var chunk = _step1.value;
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
481
|
+
var _chunk_moduleIds;
|
|
482
|
+
if (chunk.type !== "chunk") continue;
|
|
483
|
+
var info = {
|
|
484
|
+
fileName: chunk.fileName,
|
|
485
|
+
imports: chunk.imports || []
|
|
486
|
+
};
|
|
487
|
+
var _iteratorNormalCompletion2 = true,
|
|
488
|
+
_didIteratorError2 = false,
|
|
489
|
+
_iteratorError2 = void 0;
|
|
490
|
+
try {
|
|
491
|
+
for (var _iterator2 = ((_chunk_moduleIds = chunk.moduleIds) !== null && _chunk_moduleIds !== void 0 ? _chunk_moduleIds : [])[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
492
|
+
var moduleId = _step2.value;
|
|
493
|
+
clientChunksBySource.set(moduleId, info);
|
|
494
|
+
}
|
|
495
|
+
} catch (err) {
|
|
496
|
+
_didIteratorError2 = true;
|
|
497
|
+
_iteratorError2 = err;
|
|
498
|
+
} finally {
|
|
499
|
+
try {
|
|
500
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
501
|
+
_iterator2.return();
|
|
502
|
+
}
|
|
503
|
+
} finally {
|
|
504
|
+
if (_didIteratorError2) {
|
|
505
|
+
throw _iteratorError2;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
681
508
|
}
|
|
682
509
|
}
|
|
683
510
|
} catch (err) {
|
|
@@ -694,15 +521,66 @@ async function build(args) {
|
|
|
694
521
|
}
|
|
695
522
|
}
|
|
696
523
|
}
|
|
524
|
+
var _iteratorNormalCompletion3 = true,
|
|
525
|
+
_didIteratorError3 = false,
|
|
526
|
+
_iteratorError3 = void 0;
|
|
527
|
+
try {
|
|
528
|
+
for (var _iterator3 = vxrnOutput.clientOutput[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
529
|
+
var chunk1 = _step3.value;
|
|
530
|
+
if (chunk1.type !== "chunk" || !chunk1.facadeModuleId) continue;
|
|
531
|
+
clientChunksBySource.set(chunk1.facadeModuleId, {
|
|
532
|
+
fileName: chunk1.fileName,
|
|
533
|
+
imports: chunk1.imports || []
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
} catch (err) {
|
|
537
|
+
_didIteratorError3 = true;
|
|
538
|
+
_iteratorError3 = err;
|
|
539
|
+
} finally {
|
|
540
|
+
try {
|
|
541
|
+
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
542
|
+
_iterator3.return();
|
|
543
|
+
}
|
|
544
|
+
} finally {
|
|
545
|
+
if (_didIteratorError3) {
|
|
546
|
+
throw _iteratorError3;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
var clientManifestByFile = /* @__PURE__ */new Map();
|
|
552
|
+
var _iteratorNormalCompletion4 = true,
|
|
553
|
+
_didIteratorError4 = false,
|
|
554
|
+
_iteratorError4 = void 0;
|
|
555
|
+
try {
|
|
556
|
+
for (var _iterator4 = Object.values(vxrnOutput.clientManifest)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
|
557
|
+
var entry = _step4.value;
|
|
558
|
+
if (entry.file) {
|
|
559
|
+
clientManifestByFile.set(entry.file, entry);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
} catch (err) {
|
|
563
|
+
_didIteratorError4 = true;
|
|
564
|
+
_iteratorError4 = err;
|
|
565
|
+
} finally {
|
|
566
|
+
try {
|
|
567
|
+
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
|
|
568
|
+
_iterator4.return();
|
|
569
|
+
}
|
|
570
|
+
} finally {
|
|
571
|
+
if (_didIteratorError4) {
|
|
572
|
+
throw _iteratorError4;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
697
575
|
}
|
|
698
576
|
var outputEntries = [...vxrnOutput.serverOutput.entries()];
|
|
699
577
|
var layoutServerPaths = /* @__PURE__ */new Map();
|
|
700
|
-
var
|
|
701
|
-
|
|
702
|
-
|
|
578
|
+
var _iteratorNormalCompletion5 = true,
|
|
579
|
+
_didIteratorError5 = false,
|
|
580
|
+
_iteratorError5 = void 0;
|
|
703
581
|
try {
|
|
704
|
-
for (var
|
|
705
|
-
var [, output] =
|
|
582
|
+
for (var _iterator5 = outputEntries[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
|
583
|
+
var [, output] = _step5.value;
|
|
706
584
|
if (output.type === "asset") continue;
|
|
707
585
|
var id = output.facadeModuleId || "";
|
|
708
586
|
var file = import_path.default.basename(id);
|
|
@@ -713,125 +591,125 @@ async function build(args) {
|
|
|
713
591
|
}
|
|
714
592
|
}
|
|
715
593
|
} catch (err) {
|
|
716
|
-
|
|
717
|
-
|
|
594
|
+
_didIteratorError5 = true;
|
|
595
|
+
_iteratorError5 = err;
|
|
718
596
|
} finally {
|
|
719
597
|
try {
|
|
720
|
-
if (!
|
|
721
|
-
|
|
598
|
+
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
|
|
599
|
+
_iterator5.return();
|
|
722
600
|
}
|
|
723
601
|
} finally {
|
|
724
|
-
if (
|
|
725
|
-
throw
|
|
602
|
+
if (_didIteratorError5) {
|
|
603
|
+
throw _iteratorError5;
|
|
726
604
|
}
|
|
727
605
|
}
|
|
728
606
|
}
|
|
729
607
|
var routeByPath = /* @__PURE__ */new Map();
|
|
730
|
-
var
|
|
731
|
-
|
|
732
|
-
|
|
608
|
+
var _iteratorNormalCompletion6 = true,
|
|
609
|
+
_didIteratorError6 = false,
|
|
610
|
+
_iteratorError6 = void 0;
|
|
733
611
|
try {
|
|
734
|
-
for (var
|
|
735
|
-
var route =
|
|
612
|
+
for (var _iterator6 = manifest.pageRoutes[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
|
|
613
|
+
var route = _step6.value;
|
|
736
614
|
if (route.file) {
|
|
737
615
|
var routePath = `${routerRoot}${route.file.slice(1)}`;
|
|
738
616
|
routeByPath.set(routePath, route);
|
|
739
617
|
}
|
|
740
618
|
}
|
|
741
619
|
} catch (err) {
|
|
742
|
-
|
|
743
|
-
|
|
620
|
+
_didIteratorError6 = true;
|
|
621
|
+
_iteratorError6 = err;
|
|
744
622
|
} finally {
|
|
745
623
|
try {
|
|
746
|
-
if (!
|
|
747
|
-
|
|
624
|
+
if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
|
|
625
|
+
_iterator6.return();
|
|
748
626
|
}
|
|
749
627
|
} finally {
|
|
750
|
-
if (
|
|
751
|
-
throw
|
|
628
|
+
if (_didIteratorError6) {
|
|
629
|
+
throw _iteratorError6;
|
|
752
630
|
}
|
|
753
631
|
}
|
|
754
632
|
}
|
|
755
|
-
var
|
|
756
|
-
|
|
757
|
-
|
|
633
|
+
var _iteratorNormalCompletion7 = true,
|
|
634
|
+
_didIteratorError7 = false,
|
|
635
|
+
_iteratorError7 = void 0;
|
|
758
636
|
try {
|
|
759
|
-
for (var
|
|
760
|
-
var [, output1] =
|
|
637
|
+
for (var _iterator7 = outputEntries[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
|
|
638
|
+
var [, output1] = _step7.value;
|
|
761
639
|
if (output1.type === "asset") {
|
|
762
640
|
assets.push(output1);
|
|
763
641
|
}
|
|
764
642
|
}
|
|
765
643
|
} catch (err) {
|
|
766
|
-
|
|
767
|
-
|
|
644
|
+
_didIteratorError7 = true;
|
|
645
|
+
_iteratorError7 = err;
|
|
768
646
|
} finally {
|
|
769
647
|
try {
|
|
770
|
-
if (!
|
|
771
|
-
|
|
648
|
+
if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
|
|
649
|
+
_iterator7.return();
|
|
772
650
|
}
|
|
773
651
|
} finally {
|
|
774
|
-
if (
|
|
775
|
-
throw
|
|
652
|
+
if (_didIteratorError7) {
|
|
653
|
+
throw _iteratorError7;
|
|
776
654
|
}
|
|
777
655
|
}
|
|
778
656
|
}
|
|
779
657
|
var moduleIdToServerChunk = /* @__PURE__ */new Map();
|
|
780
|
-
var
|
|
781
|
-
|
|
782
|
-
|
|
658
|
+
var _iteratorNormalCompletion8 = true,
|
|
659
|
+
_didIteratorError8 = false,
|
|
660
|
+
_iteratorError8 = void 0;
|
|
783
661
|
try {
|
|
784
|
-
for (var
|
|
785
|
-
var [, output2] =
|
|
662
|
+
for (var _iterator8 = outputEntries[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
|
|
663
|
+
var [, output2] = _step8.value;
|
|
786
664
|
if (output2.type === "asset") continue;
|
|
787
665
|
var moduleIds = output2.moduleIds || (output2.facadeModuleId ? [output2.facadeModuleId] : []);
|
|
788
|
-
var
|
|
789
|
-
|
|
790
|
-
|
|
666
|
+
var _iteratorNormalCompletion9 = true,
|
|
667
|
+
_didIteratorError9 = false,
|
|
668
|
+
_iteratorError9 = void 0;
|
|
791
669
|
try {
|
|
792
|
-
for (var
|
|
793
|
-
var
|
|
794
|
-
moduleIdToServerChunk.set(
|
|
795
|
-
if (
|
|
796
|
-
moduleIdToServerChunk.set(
|
|
670
|
+
for (var _iterator9 = moduleIds[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
|
|
671
|
+
var moduleId1 = _step9.value;
|
|
672
|
+
moduleIdToServerChunk.set(moduleId1, output2.fileName);
|
|
673
|
+
if (moduleId1.includes("?one-spa-build")) {
|
|
674
|
+
moduleIdToServerChunk.set(moduleId1.slice(0, moduleId1.indexOf("?")), output2.fileName);
|
|
797
675
|
}
|
|
798
676
|
}
|
|
799
677
|
} catch (err) {
|
|
800
|
-
|
|
801
|
-
|
|
678
|
+
_didIteratorError9 = true;
|
|
679
|
+
_iteratorError9 = err;
|
|
802
680
|
} finally {
|
|
803
681
|
try {
|
|
804
|
-
if (!
|
|
805
|
-
|
|
682
|
+
if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
|
|
683
|
+
_iterator9.return();
|
|
806
684
|
}
|
|
807
685
|
} finally {
|
|
808
|
-
if (
|
|
809
|
-
throw
|
|
686
|
+
if (_didIteratorError9) {
|
|
687
|
+
throw _iteratorError9;
|
|
810
688
|
}
|
|
811
689
|
}
|
|
812
690
|
}
|
|
813
691
|
}
|
|
814
692
|
} catch (err) {
|
|
815
|
-
|
|
816
|
-
|
|
693
|
+
_didIteratorError8 = true;
|
|
694
|
+
_iteratorError8 = err;
|
|
817
695
|
} finally {
|
|
818
696
|
try {
|
|
819
|
-
if (!
|
|
820
|
-
|
|
697
|
+
if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
|
|
698
|
+
_iterator8.return();
|
|
821
699
|
}
|
|
822
700
|
} finally {
|
|
823
|
-
if (
|
|
824
|
-
throw
|
|
701
|
+
if (_didIteratorError8) {
|
|
702
|
+
throw _iteratorError8;
|
|
825
703
|
}
|
|
826
704
|
}
|
|
827
705
|
}
|
|
828
|
-
var
|
|
829
|
-
|
|
830
|
-
|
|
706
|
+
var _iteratorNormalCompletion10 = true,
|
|
707
|
+
_didIteratorError10 = false,
|
|
708
|
+
_iteratorError10 = void 0;
|
|
831
709
|
try {
|
|
832
710
|
var _loop1 = async function () {
|
|
833
|
-
var foundRoute =
|
|
834
|
-
var _ref2, _ref12;
|
|
711
|
+
var foundRoute = _step10.value;
|
|
712
|
+
var _vxrnOutput_clientManifest_manifestKey, _ref2, _ref12, _ref22;
|
|
835
713
|
var _vxrnOutput_buildArgs, _foundRoute_layouts, _oneOptions_web3, _oneOptions_web12, _exported_generateStaticParams;
|
|
836
714
|
if (!foundRoute.file) {
|
|
837
715
|
return "continue";
|
|
@@ -854,7 +732,7 @@ async function build(args) {
|
|
|
854
732
|
}
|
|
855
733
|
var clientChunk = clientChunksBySource.get(routeModulePath);
|
|
856
734
|
var manifestKey = `${routerRoot}${foundRoute.file.slice(1)}`;
|
|
857
|
-
var clientManifestEntry = vxrnOutput.clientManifest[manifestKey];
|
|
735
|
+
var clientManifestEntry = (_vxrnOutput_clientManifest_manifestKey = vxrnOutput.clientManifest[manifestKey]) !== null && _vxrnOutput_clientManifest_manifestKey !== void 0 ? _vxrnOutput_clientManifest_manifestKey : clientChunk ? clientManifestByFile.get(clientChunk.fileName) : void 0;
|
|
858
736
|
if (!clientChunk && foundRoute.type !== "spa" && foundRoute.type !== "ssg") {
|
|
859
737
|
console.warn(`No client chunk found for route: ${routeModulePath}`);
|
|
860
738
|
return "continue";
|
|
@@ -862,41 +740,41 @@ async function build(args) {
|
|
|
862
740
|
foundRoute.loaderServerPath = serverFileName;
|
|
863
741
|
var relativeId1 = foundRoute.file.replace(/^\.\//, "/");
|
|
864
742
|
if (foundRoute.layouts) {
|
|
865
|
-
var
|
|
866
|
-
|
|
867
|
-
|
|
743
|
+
var _iteratorNormalCompletion14 = true,
|
|
744
|
+
_didIteratorError14 = false,
|
|
745
|
+
_iteratorError14 = void 0;
|
|
868
746
|
try {
|
|
869
|
-
for (var
|
|
870
|
-
var layout =
|
|
747
|
+
for (var _iterator14 = foundRoute.layouts[Symbol.iterator](), _step14; !(_iteratorNormalCompletion14 = (_step14 = _iterator14.next()).done); _iteratorNormalCompletion14 = true) {
|
|
748
|
+
var layout = _step14.value;
|
|
871
749
|
var serverPath = layoutServerPaths.get(layout.contextKey);
|
|
872
750
|
if (serverPath) {
|
|
873
751
|
layout.loaderServerPath = serverPath;
|
|
874
752
|
}
|
|
875
753
|
}
|
|
876
754
|
} catch (err) {
|
|
877
|
-
|
|
878
|
-
|
|
755
|
+
_didIteratorError14 = true;
|
|
756
|
+
_iteratorError14 = err;
|
|
879
757
|
} finally {
|
|
880
758
|
try {
|
|
881
|
-
if (!
|
|
882
|
-
|
|
759
|
+
if (!_iteratorNormalCompletion14 && _iterator14.return != null) {
|
|
760
|
+
_iterator14.return();
|
|
883
761
|
}
|
|
884
762
|
} finally {
|
|
885
|
-
if (
|
|
886
|
-
throw
|
|
763
|
+
if (_didIteratorError14) {
|
|
764
|
+
throw _iteratorError14;
|
|
887
765
|
}
|
|
888
766
|
}
|
|
889
767
|
}
|
|
890
768
|
}
|
|
891
|
-
function collectImports(
|
|
769
|
+
function collectImports(entry3) {
|
|
892
770
|
var {
|
|
893
771
|
type = "js"
|
|
894
772
|
} = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
895
773
|
var {
|
|
896
774
|
imports = [],
|
|
897
775
|
css
|
|
898
|
-
} =
|
|
899
|
-
var cacheKey = `${
|
|
776
|
+
} = entry3;
|
|
777
|
+
var cacheKey = `${entry3.file || imports.join(",")}:${type}`;
|
|
900
778
|
var cached = collectImportsCache.get(cacheKey);
|
|
901
779
|
if (cached) return cached;
|
|
902
780
|
if (collectImportsInFlight.has(cacheKey)) return [];
|
|
@@ -924,8 +802,8 @@ async function build(args) {
|
|
|
924
802
|
var found = vxrnOutput.clientManifest[clientKey2];
|
|
925
803
|
return found ? found : [];
|
|
926
804
|
})) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
927
|
-
var layoutImports = layoutEntries.flatMap(function (
|
|
928
|
-
return [
|
|
805
|
+
var layoutImports = layoutEntries.flatMap(function (entry3) {
|
|
806
|
+
return [entry3.file, ...collectImports(entry3)];
|
|
929
807
|
});
|
|
930
808
|
var routePreloads = {};
|
|
931
809
|
var rootLayoutKey = `${routerRoot}/_layout.tsx`;
|
|
@@ -934,39 +812,36 @@ async function build(args) {
|
|
|
934
812
|
routePreloads[`/${rootLayoutKey}`] = `/${rootLayoutEntry.file}`;
|
|
935
813
|
}
|
|
936
814
|
if (foundRoute.layouts) {
|
|
937
|
-
var
|
|
938
|
-
|
|
939
|
-
|
|
815
|
+
var _iteratorNormalCompletion15 = true,
|
|
816
|
+
_didIteratorError15 = false,
|
|
817
|
+
_iteratorError15 = void 0;
|
|
940
818
|
try {
|
|
941
|
-
for (var
|
|
942
|
-
var layout1 =
|
|
819
|
+
for (var _iterator15 = foundRoute.layouts[Symbol.iterator](), _step15; !(_iteratorNormalCompletion15 = (_step15 = _iterator15.next()).done); _iteratorNormalCompletion15 = true) {
|
|
820
|
+
var layout1 = _step15.value;
|
|
943
821
|
var clientKey = `${routerRoot}${layout1.contextKey.slice(1)}`;
|
|
944
|
-
var
|
|
945
|
-
if (
|
|
946
|
-
routePreloads[`/${clientKey}`] = `/${
|
|
822
|
+
var entry2 = vxrnOutput.clientManifest[clientKey];
|
|
823
|
+
if (entry2) {
|
|
824
|
+
routePreloads[`/${clientKey}`] = `/${entry2.file}`;
|
|
947
825
|
}
|
|
948
826
|
}
|
|
949
827
|
} catch (err) {
|
|
950
|
-
|
|
951
|
-
|
|
828
|
+
_didIteratorError15 = true;
|
|
829
|
+
_iteratorError15 = err;
|
|
952
830
|
} finally {
|
|
953
831
|
try {
|
|
954
|
-
if (!
|
|
955
|
-
|
|
832
|
+
if (!_iteratorNormalCompletion15 && _iterator15.return != null) {
|
|
833
|
+
_iterator15.return();
|
|
956
834
|
}
|
|
957
835
|
} finally {
|
|
958
|
-
if (
|
|
959
|
-
throw
|
|
836
|
+
if (_didIteratorError15) {
|
|
837
|
+
throw _iteratorError15;
|
|
960
838
|
}
|
|
961
839
|
}
|
|
962
840
|
}
|
|
963
841
|
}
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
routePreloads[
|
|
967
|
-
} else if (clientManifestEntry) {
|
|
968
|
-
var routeKey1 = `/${routerRoot}${foundRoute.file.slice(1)}`;
|
|
969
|
-
routePreloads[routeKey1] = `/${clientManifestEntry.file}`;
|
|
842
|
+
var routeChunkFile = (_ref12 = clientChunk === null || clientChunk === void 0 ? void 0 : clientChunk.fileName) !== null && _ref12 !== void 0 ? _ref12 : clientManifestEntry === null || clientManifestEntry === void 0 ? void 0 : clientManifestEntry.file;
|
|
843
|
+
if (routeChunkFile) {
|
|
844
|
+
routePreloads[`/${routerRoot}${foundRoute.file.slice(1)}`] = `/${routeChunkFile}`;
|
|
970
845
|
}
|
|
971
846
|
var preloadSetupFilePreloads = function () {
|
|
972
847
|
if (!oneOptions.setupFile) return [];
|
|
@@ -975,8 +850,8 @@ async function build(args) {
|
|
|
975
850
|
var needle = clientSetupFile.replace(/^\.\//, "");
|
|
976
851
|
for (var file2 in vxrnOutput.clientManifest) {
|
|
977
852
|
if (file2 === needle) {
|
|
978
|
-
var
|
|
979
|
-
return [
|
|
853
|
+
var entry3 = vxrnOutput.clientManifest[file2];
|
|
854
|
+
return [entry3.file];
|
|
980
855
|
}
|
|
981
856
|
}
|
|
982
857
|
return [];
|
|
@@ -998,13 +873,13 @@ async function build(args) {
|
|
|
998
873
|
// add the route entry js (like ./app/index.ts) - prefer direct chunk lookup
|
|
999
874
|
...(clientChunk ? [clientChunk.fileName] : clientManifestEntry ? [clientManifestEntry.file] : []),
|
|
1000
875
|
// add layout files (but not their deep imports)
|
|
1001
|
-
...layoutEntries.map(function (
|
|
1002
|
-
return
|
|
876
|
+
...layoutEntries.map(function (entry3) {
|
|
877
|
+
return entry3.file;
|
|
1003
878
|
})])].map(function (path2) {
|
|
1004
879
|
return `/${path2}`;
|
|
1005
880
|
}) : void 0;
|
|
1006
|
-
var deferredPreloads = needsSeparatedPreloads ? [... /* @__PURE__ */new Set([...entryImports, ...layoutEntries.flatMap(function (
|
|
1007
|
-
return collectImports(
|
|
881
|
+
var deferredPreloads = needsSeparatedPreloads ? [... /* @__PURE__ */new Set([...entryImports, ...layoutEntries.flatMap(function (entry3) {
|
|
882
|
+
return collectImports(entry3);
|
|
1008
883
|
})])].filter(function (path2) {
|
|
1009
884
|
return !criticalPreloads.includes(`/${path2}`);
|
|
1010
885
|
}).map(function (path2) {
|
|
@@ -1012,8 +887,8 @@ async function build(args) {
|
|
|
1012
887
|
}) : void 0;
|
|
1013
888
|
var preloads2 = needsSeparatedPreloads ? [...criticalPreloads, ...deferredPreloads] : allPreloads;
|
|
1014
889
|
var allEntries = [clientManifestEntry, ...layoutEntries].filter(Boolean);
|
|
1015
|
-
var layoutCSS = [...new Set(layoutEntries.flatMap(function (
|
|
1016
|
-
return collectImports(
|
|
890
|
+
var layoutCSS = [...new Set(layoutEntries.flatMap(function (entry3) {
|
|
891
|
+
return collectImports(entry3, {
|
|
1017
892
|
type: "css"
|
|
1018
893
|
});
|
|
1019
894
|
}).map(function (path2) {
|
|
@@ -1035,13 +910,13 @@ async function build(args) {
|
|
|
1035
910
|
// (the prod /download was loading 23 stylesheets with editor/IDE
|
|
1036
911
|
// chunks despite being a marketing route).
|
|
1037
912
|
...Object.entries(vxrnOutput.clientManifest).filter(function (param) {
|
|
1038
|
-
var [key,
|
|
913
|
+
var [key, entry3] = param;
|
|
1039
914
|
if (!key.endsWith(".css")) return false;
|
|
1040
|
-
var src =
|
|
915
|
+
var src = entry3.src;
|
|
1041
916
|
return src === "style.css";
|
|
1042
917
|
}).map(function (param) {
|
|
1043
|
-
var [,
|
|
1044
|
-
return `/${
|
|
918
|
+
var [, entry3] = param;
|
|
919
|
+
return `/${entry3.file}`;
|
|
1045
920
|
})])];
|
|
1046
921
|
var hasCriticalCSS = allCSS.some(function (p) {
|
|
1047
922
|
return criticalCSSOutputPaths.has(p);
|
|
@@ -1079,10 +954,10 @@ async function build(args) {
|
|
|
1079
954
|
var serverJsPath = import_path.posix.join(outDir, "server", serverFileName);
|
|
1080
955
|
var exported = void 0;
|
|
1081
956
|
try {
|
|
1082
|
-
exported = await
|
|
957
|
+
exported = await (0, import_serverRouteModules.getRouteExports)(vxrnOutput.serverEntry, routerRoot, foundRoute.file);
|
|
1083
958
|
} catch (err) {
|
|
1084
959
|
console.error(`Error importing page (original error)`, err);
|
|
1085
|
-
throw new Error(`Error importing page: ${
|
|
960
|
+
throw new Error(`Error importing page: ${foundRoute.file}`, {
|
|
1086
961
|
cause: err
|
|
1087
962
|
});
|
|
1088
963
|
}
|
|
@@ -1098,7 +973,7 @@ async function build(args) {
|
|
|
1098
973
|
|
|
1099
974
|
`);
|
|
1100
975
|
}
|
|
1101
|
-
var paramsList = (
|
|
976
|
+
var paramsList = (_ref22 = await ((_exported_generateStaticParams = exported.generateStaticParams) === null || _exported_generateStaticParams === void 0 ? void 0 : _exported_generateStaticParams.call(exported))) !== null && _ref22 !== void 0 ? _ref22 : [{}];
|
|
1102
977
|
console.info(`
|
|
1103
978
|
[build] page ${relativeId1} (with ${paramsList.length} routes)
|
|
1104
979
|
`);
|
|
@@ -1116,6 +991,7 @@ async function build(args) {
|
|
|
1116
991
|
console.info(` \u21A6 route ${path2}`);
|
|
1117
992
|
return workerPool.buildPage({
|
|
1118
993
|
serverEntry: vxrnOutput.serverEntry,
|
|
994
|
+
routerRoot,
|
|
1119
995
|
path: path2,
|
|
1120
996
|
relativeId: relativeId1,
|
|
1121
997
|
params,
|
|
@@ -1144,7 +1020,7 @@ async function build(args) {
|
|
|
1144
1020
|
return limit(async function () {
|
|
1145
1021
|
console.info(` \u21A6 route ${path2}`);
|
|
1146
1022
|
var built2 = await (0, import_one_server_only.runWithAsyncLocalContext)(async function () {
|
|
1147
|
-
return await (0, import_buildPage.buildPage)(vxrnOutput.serverEntry, path2, relativeId1, params, foundRoute, clientManifestEntry, staticDir, clientDir, builtMiddlewares, serverJsPath, preloads2, allCSS, layoutCSS, routePreloads, allCSSContents, criticalPreloads, deferredPreloads, useAfterLCP, useAfterLCPAggressive);
|
|
1023
|
+
return await (0, import_buildPage.buildPage)(vxrnOutput.serverEntry, routerRoot, path2, relativeId1, params, foundRoute, clientManifestEntry, staticDir, clientDir, builtMiddlewares, serverJsPath, preloads2, allCSS, layoutCSS, routePreloads, allCSSContents, criticalPreloads, deferredPreloads, useAfterLCP, useAfterLCPAggressive);
|
|
1148
1024
|
});
|
|
1149
1025
|
return {
|
|
1150
1026
|
built: built2,
|
|
@@ -1185,18 +1061,18 @@ async function build(args) {
|
|
|
1185
1061
|
}
|
|
1186
1062
|
}
|
|
1187
1063
|
};
|
|
1188
|
-
for (var
|
|
1064
|
+
for (var _iterator10 = manifest.pageRoutes[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) await _loop1();
|
|
1189
1065
|
} catch (err) {
|
|
1190
|
-
|
|
1191
|
-
|
|
1066
|
+
_didIteratorError10 = true;
|
|
1067
|
+
_iteratorError10 = err;
|
|
1192
1068
|
} finally {
|
|
1193
1069
|
try {
|
|
1194
|
-
if (!
|
|
1195
|
-
|
|
1070
|
+
if (!_iteratorNormalCompletion10 && _iterator10.return != null) {
|
|
1071
|
+
_iterator10.return();
|
|
1196
1072
|
}
|
|
1197
1073
|
} finally {
|
|
1198
|
-
if (
|
|
1199
|
-
throw
|
|
1074
|
+
if (_didIteratorError10) {
|
|
1075
|
+
throw _iteratorError10;
|
|
1200
1076
|
}
|
|
1201
1077
|
}
|
|
1202
1078
|
}
|
|
@@ -1217,12 +1093,12 @@ async function build(args) {
|
|
|
1217
1093
|
var cssPreloads = {};
|
|
1218
1094
|
var loaders = {};
|
|
1219
1095
|
var cssContentsByPath;
|
|
1220
|
-
var
|
|
1221
|
-
|
|
1222
|
-
|
|
1096
|
+
var _iteratorNormalCompletion11 = true,
|
|
1097
|
+
_didIteratorError11 = false,
|
|
1098
|
+
_iteratorError11 = void 0;
|
|
1223
1099
|
try {
|
|
1224
1100
|
var _loop2 = function () {
|
|
1225
|
-
var route2 =
|
|
1101
|
+
var route2 = _step11.value;
|
|
1226
1102
|
if (!route2.cleanPath.includes("*")) {
|
|
1227
1103
|
routeMap[route2.cleanPath] = route2.htmlPath;
|
|
1228
1104
|
}
|
|
@@ -1240,25 +1116,25 @@ async function build(args) {
|
|
|
1240
1116
|
});
|
|
1241
1117
|
}
|
|
1242
1118
|
routeToBuildInfo[route2.routeFile] = rest;
|
|
1243
|
-
var
|
|
1244
|
-
|
|
1245
|
-
|
|
1119
|
+
var _iteratorNormalCompletion14 = true,
|
|
1120
|
+
_didIteratorError14 = false,
|
|
1121
|
+
_iteratorError14 = void 0;
|
|
1246
1122
|
try {
|
|
1247
|
-
for (var
|
|
1248
|
-
var p =
|
|
1123
|
+
for (var _iterator14 = getCleanPaths([route2.path, route2.cleanPath])[Symbol.iterator](), _step14; !(_iteratorNormalCompletion14 = (_step14 = _iterator14.next()).done); _iteratorNormalCompletion14 = true) {
|
|
1124
|
+
var p = _step14.value;
|
|
1249
1125
|
pathToRoute[p] = route2.routeFile;
|
|
1250
1126
|
}
|
|
1251
1127
|
} catch (err) {
|
|
1252
|
-
|
|
1253
|
-
|
|
1128
|
+
_didIteratorError14 = true;
|
|
1129
|
+
_iteratorError14 = err;
|
|
1254
1130
|
} finally {
|
|
1255
1131
|
try {
|
|
1256
|
-
if (!
|
|
1257
|
-
|
|
1132
|
+
if (!_iteratorNormalCompletion14 && _iterator14.return != null) {
|
|
1133
|
+
_iterator14.return();
|
|
1258
1134
|
}
|
|
1259
1135
|
} finally {
|
|
1260
|
-
if (
|
|
1261
|
-
throw
|
|
1136
|
+
if (_didIteratorError14) {
|
|
1137
|
+
throw _iteratorError14;
|
|
1262
1138
|
}
|
|
1263
1139
|
}
|
|
1264
1140
|
}
|
|
@@ -1266,18 +1142,18 @@ async function build(args) {
|
|
|
1266
1142
|
cssPreloads[route2.cssPreloadPath] = true;
|
|
1267
1143
|
loaders[route2.loaderPath] = true;
|
|
1268
1144
|
};
|
|
1269
|
-
for (var
|
|
1145
|
+
for (var _iterator11 = builtRoutes[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) _loop2();
|
|
1270
1146
|
} catch (err) {
|
|
1271
|
-
|
|
1272
|
-
|
|
1147
|
+
_didIteratorError11 = true;
|
|
1148
|
+
_iteratorError11 = err;
|
|
1273
1149
|
} finally {
|
|
1274
1150
|
try {
|
|
1275
|
-
if (!
|
|
1276
|
-
|
|
1151
|
+
if (!_iteratorNormalCompletion11 && _iterator11.return != null) {
|
|
1152
|
+
_iterator11.return();
|
|
1277
1153
|
}
|
|
1278
1154
|
} finally {
|
|
1279
|
-
if (
|
|
1280
|
-
throw
|
|
1155
|
+
if (_didIteratorError11) {
|
|
1156
|
+
throw _iteratorError11;
|
|
1281
1157
|
}
|
|
1282
1158
|
}
|
|
1283
1159
|
}
|
|
@@ -1299,12 +1175,12 @@ async function build(args) {
|
|
|
1299
1175
|
return x.routeFile === route2.file;
|
|
1300
1176
|
});
|
|
1301
1177
|
if (built.middlewares) {
|
|
1302
|
-
var
|
|
1303
|
-
|
|
1304
|
-
|
|
1178
|
+
var _iteratorNormalCompletion14 = true,
|
|
1179
|
+
_didIteratorError14 = false,
|
|
1180
|
+
_iteratorError14 = void 0;
|
|
1305
1181
|
try {
|
|
1306
|
-
for (var
|
|
1307
|
-
var [index, mw] =
|
|
1182
|
+
for (var _iterator14 = built.middlewares.entries()[Symbol.iterator](), _step14; !(_iteratorNormalCompletion14 = (_step14 = _iterator14.next()).done); _iteratorNormalCompletion14 = true) {
|
|
1183
|
+
var [index, mw] = _step14.value;
|
|
1308
1184
|
var _buildInfo_middlewares;
|
|
1309
1185
|
var viaBuildInfo = buildInfo === null || buildInfo === void 0 ? void 0 : (_buildInfo_middlewares = buildInfo.middlewares) === null || _buildInfo_middlewares === void 0 ? void 0 : _buildInfo_middlewares[index];
|
|
1310
1186
|
if (viaBuildInfo) {
|
|
@@ -1317,16 +1193,16 @@ async function build(args) {
|
|
|
1317
1193
|
}
|
|
1318
1194
|
}
|
|
1319
1195
|
} catch (err) {
|
|
1320
|
-
|
|
1321
|
-
|
|
1196
|
+
_didIteratorError14 = true;
|
|
1197
|
+
_iteratorError14 = err;
|
|
1322
1198
|
} finally {
|
|
1323
1199
|
try {
|
|
1324
|
-
if (!
|
|
1325
|
-
|
|
1200
|
+
if (!_iteratorNormalCompletion14 && _iterator14.return != null) {
|
|
1201
|
+
_iterator14.return();
|
|
1326
1202
|
}
|
|
1327
1203
|
} finally {
|
|
1328
|
-
if (
|
|
1329
|
-
throw
|
|
1204
|
+
if (_didIteratorError14) {
|
|
1205
|
+
throw _iteratorError14;
|
|
1330
1206
|
}
|
|
1331
1207
|
}
|
|
1332
1208
|
}
|
|
@@ -1407,83 +1283,57 @@ async function build(args) {
|
|
|
1407
1283
|
case "cloudflare":
|
|
1408
1284
|
{
|
|
1409
1285
|
var workerSrcDir = (0, import_path.join)(options.root, outDir);
|
|
1410
|
-
var getWorkerSourceImportPath = function (
|
|
1411
|
-
var
|
|
1412
|
-
return
|
|
1286
|
+
var getWorkerSourceImportPath = function (routeFile) {
|
|
1287
|
+
var importPath2 = (0, import_vite.normalizePath)((0, import_path.relative)(workerSrcDir, (0, import_path.join)(options.root, routerRoot, routeFile)));
|
|
1288
|
+
return importPath2.startsWith(".") ? importPath2 : `./${importPath2}`;
|
|
1413
1289
|
};
|
|
1414
|
-
var pageRouteMap = [];
|
|
1415
1290
|
var apiRouteMap = [];
|
|
1416
1291
|
var middlewareRouteMap = [];
|
|
1417
|
-
var
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
try {
|
|
1421
|
-
for (var _iterator9 = Object.entries(buildInfoForWriting.routeToBuildInfo)[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
|
|
1422
|
-
var [routeFile, info] = _step9.value;
|
|
1423
|
-
if (info.serverJsPath) {
|
|
1424
|
-
var importPath = "./" + info.serverJsPath.replace(new RegExp(`^${outDir}/`), "");
|
|
1425
|
-
pageRouteMap.push(` '${routeFile}': () => import('${importPath}')`);
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
} catch (err) {
|
|
1429
|
-
_didIteratorError9 = true;
|
|
1430
|
-
_iteratorError9 = err;
|
|
1431
|
-
} finally {
|
|
1432
|
-
try {
|
|
1433
|
-
if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
|
|
1434
|
-
_iterator9.return();
|
|
1435
|
-
}
|
|
1436
|
-
} finally {
|
|
1437
|
-
if (_didIteratorError9) {
|
|
1438
|
-
throw _iteratorError9;
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
var _iteratorNormalCompletion10 = true,
|
|
1443
|
-
_didIteratorError10 = false,
|
|
1444
|
-
_iteratorError10 = void 0;
|
|
1292
|
+
var _iteratorNormalCompletion12 = true,
|
|
1293
|
+
_didIteratorError12 = false,
|
|
1294
|
+
_iteratorError12 = void 0;
|
|
1445
1295
|
try {
|
|
1446
|
-
for (var
|
|
1447
|
-
var route1 =
|
|
1296
|
+
for (var _iterator12 = buildInfoForWriting.manifest.apiRoutes[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
|
|
1297
|
+
var route1 = _step12.value;
|
|
1448
1298
|
if (route1.file) {
|
|
1449
|
-
var
|
|
1450
|
-
apiRouteMap.push(` '${route1.page}': () => import('${
|
|
1299
|
+
var importPath = getWorkerSourceImportPath(route1.file);
|
|
1300
|
+
apiRouteMap.push(` '${route1.page}': () => import('${importPath}')`);
|
|
1451
1301
|
}
|
|
1452
1302
|
}
|
|
1453
1303
|
} catch (err) {
|
|
1454
|
-
|
|
1455
|
-
|
|
1304
|
+
_didIteratorError12 = true;
|
|
1305
|
+
_iteratorError12 = err;
|
|
1456
1306
|
} finally {
|
|
1457
1307
|
try {
|
|
1458
|
-
if (!
|
|
1459
|
-
|
|
1308
|
+
if (!_iteratorNormalCompletion12 && _iterator12.return != null) {
|
|
1309
|
+
_iterator12.return();
|
|
1460
1310
|
}
|
|
1461
1311
|
} finally {
|
|
1462
|
-
if (
|
|
1463
|
-
throw
|
|
1312
|
+
if (_didIteratorError12) {
|
|
1313
|
+
throw _iteratorError12;
|
|
1464
1314
|
}
|
|
1465
1315
|
}
|
|
1466
1316
|
}
|
|
1467
|
-
var
|
|
1468
|
-
|
|
1469
|
-
|
|
1317
|
+
var _iteratorNormalCompletion13 = true,
|
|
1318
|
+
_didIteratorError13 = false,
|
|
1319
|
+
_iteratorError13 = void 0;
|
|
1470
1320
|
try {
|
|
1471
|
-
for (var
|
|
1472
|
-
var [sourceFile, builtPath] =
|
|
1473
|
-
var
|
|
1474
|
-
middlewareRouteMap.push(` '${builtPath}': () => import('${
|
|
1321
|
+
for (var _iterator13 = Object.entries(builtMiddlewares)[Symbol.iterator](), _step13; !(_iteratorNormalCompletion13 = (_step13 = _iterator13.next()).done); _iteratorNormalCompletion13 = true) {
|
|
1322
|
+
var [sourceFile, builtPath] = _step13.value;
|
|
1323
|
+
var importPath1 = getWorkerSourceImportPath(sourceFile);
|
|
1324
|
+
middlewareRouteMap.push(` '${builtPath}': () => import('${importPath1}')`);
|
|
1475
1325
|
}
|
|
1476
1326
|
} catch (err) {
|
|
1477
|
-
|
|
1478
|
-
|
|
1327
|
+
_didIteratorError13 = true;
|
|
1328
|
+
_iteratorError13 = err;
|
|
1479
1329
|
} finally {
|
|
1480
1330
|
try {
|
|
1481
|
-
if (!
|
|
1482
|
-
|
|
1331
|
+
if (!_iteratorNormalCompletion13 && _iterator13.return != null) {
|
|
1332
|
+
_iterator13.return();
|
|
1483
1333
|
}
|
|
1484
1334
|
} finally {
|
|
1485
|
-
if (
|
|
1486
|
-
throw
|
|
1335
|
+
if (_didIteratorError13) {
|
|
1336
|
+
throw _iteratorError13;
|
|
1487
1337
|
}
|
|
1488
1338
|
}
|
|
1489
1339
|
}
|
|
@@ -1503,9 +1353,6 @@ import { serve, setFetchStaticHtml } from 'one/serve-worker'
|
|
|
1503
1353
|
// Lazy import map - modules load on-demand when route is matched
|
|
1504
1354
|
const lazyRoutes = {
|
|
1505
1355
|
serverEntry: () => import('./server/_virtual_one-entry.js'),
|
|
1506
|
-
pages: {
|
|
1507
|
-
${pageRouteMap.join(",\n")}
|
|
1508
|
-
},
|
|
1509
1356
|
api: {
|
|
1510
1357
|
${apiRouteMap.join(",\n")}
|
|
1511
1358
|
},
|
|
@@ -1566,9 +1413,9 @@ export default {
|
|
|
1566
1413
|
}
|
|
1567
1414
|
`;
|
|
1568
1415
|
await import_fs_extra.default.writeFile(workerSrcPath, workerCode);
|
|
1569
|
-
var projectName = await getCloudflareProjectName(options.root);
|
|
1570
|
-
var userWranglerConfig = await loadUserWranglerConfig(options.root);
|
|
1571
|
-
var wranglerInputConfig = createCloudflareWranglerConfig(projectName, userWranglerConfig === null || userWranglerConfig === void 0 ? void 0 : userWranglerConfig.config);
|
|
1416
|
+
var projectName = await (0, import_cloudflareWranglerConfig.getCloudflareProjectName)(options.root);
|
|
1417
|
+
var userWranglerConfig = await (0, import_cloudflareWranglerConfig.loadUserWranglerConfig)(options.root);
|
|
1418
|
+
var wranglerInputConfig = (0, import_cloudflareWranglerConfig.createCloudflareWranglerConfig)(projectName, userWranglerConfig === null || userWranglerConfig === void 0 ? void 0 : userWranglerConfig.config);
|
|
1572
1419
|
wranglerInputConfig.main = (0, import_vite.normalizePath)((0, import_path.relative)((0, import_path.join)(options.root, outDir), workerSrcPath));
|
|
1573
1420
|
var wranglerInputPath = (0, import_path.join)(options.root, outDir, "_wrangler.input.jsonc");
|
|
1574
1421
|
await import_fs_extra.default.writeFile(wranglerInputPath, `${JSON.stringify(wranglerInputConfig, null, 2)}
|