@qwik.dev/router 2.0.0-alpha.8 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/adapters/azure-swa/vite/index.cjs +3 -3
- package/lib/adapters/azure-swa/vite/index.d.ts +13 -13
- package/lib/adapters/bun-server/vite/index.cjs +3 -3
- package/lib/adapters/bun-server/vite/index.d.ts +14 -14
- package/lib/adapters/cloud-run/vite/index.cjs +3 -3
- package/lib/adapters/cloud-run/vite/index.d.ts +13 -13
- package/lib/adapters/cloudflare-pages/vite/index.cjs +3 -3
- package/lib/adapters/cloudflare-pages/vite/index.d.ts +27 -27
- package/lib/adapters/deno-server/vite/index.cjs +3 -3
- package/lib/adapters/deno-server/vite/index.d.ts +14 -14
- package/lib/adapters/netlify-edge/vite/index.cjs +3 -3
- package/lib/adapters/netlify-edge/vite/index.d.ts +44 -44
- package/lib/adapters/node-server/vite/index.cjs +3 -3
- package/lib/adapters/node-server/vite/index.d.ts +14 -14
- package/lib/adapters/shared/vite/index.cjs +10 -3
- package/lib/adapters/shared/vite/index.d.ts +114 -114
- package/lib/adapters/shared/vite/index.mjs +7 -0
- package/lib/adapters/static/vite/index.cjs +10 -3
- package/lib/adapters/static/vite/index.d.ts +10 -10
- package/lib/adapters/static/vite/index.mjs +7 -0
- package/lib/adapters/vercel-edge/vite/index.cjs +3 -3
- package/lib/adapters/vercel-edge/vite/index.d.ts +45 -45
- package/lib/index.d.ts +878 -801
- package/lib/index.qwik.cjs +127 -51
- package/lib/index.qwik.mjs +130 -54
- package/lib/middleware/aws-lambda/index.d.ts +48 -50
- package/lib/middleware/azure-swa/index.d.ts +28 -28
- package/lib/middleware/bun/index.d.ts +35 -35
- package/lib/middleware/cloudflare-pages/index.d.ts +35 -35
- package/lib/middleware/deno/index.d.ts +47 -47
- package/lib/middleware/firebase/index.d.ts +26 -26
- package/lib/middleware/netlify-edge/index.d.ts +27 -27
- package/lib/middleware/node/index.cjs +3 -3
- package/lib/middleware/node/index.d.ts +64 -66
- package/lib/middleware/request-handler/index.cjs +133 -75
- package/lib/middleware/request-handler/index.d.ts +710 -681
- package/lib/middleware/request-handler/index.mjs +129 -72
- package/lib/middleware/vercel-edge/index.d.ts +26 -26
- package/lib/service-worker.cjs +13 -263
- package/lib/service-worker.d.ts +15 -4
- package/lib/service-worker.mjs +13 -263
- package/lib/static/index.cjs +3 -3
- package/lib/static/index.d.ts +96 -98
- package/lib/static/node.cjs +3 -3
- package/lib/vite/index.cjs +199 -262
- package/lib/vite/index.d.ts +154 -154
- package/lib/vite/index.mjs +197 -260
- package/package.json +8 -8
package/lib/vite/index.cjs
CHANGED
|
@@ -14271,13 +14271,13 @@ var init_rehype_autolink_headings = __esm({
|
|
|
14271
14271
|
});
|
|
14272
14272
|
|
|
14273
14273
|
// packages/qwik-router/src/buildtime/vite/index.ts
|
|
14274
|
-
var
|
|
14275
|
-
__export(
|
|
14274
|
+
var index_exports = {};
|
|
14275
|
+
__export(index_exports, {
|
|
14276
14276
|
extendConfig: () => extendConfig,
|
|
14277
14277
|
qwikCity: () => qwikCity,
|
|
14278
14278
|
qwikRouter: () => qwikRouter
|
|
14279
14279
|
});
|
|
14280
|
-
module.exports = __toCommonJS(
|
|
14280
|
+
module.exports = __toCommonJS(index_exports);
|
|
14281
14281
|
|
|
14282
14282
|
// packages/qwik-router/src/buildtime/vite/config.ts
|
|
14283
14283
|
var import_vite = require("vite");
|
|
@@ -14296,7 +14296,7 @@ function extendConfig(baseConfigExport, serverConfigExport) {
|
|
|
14296
14296
|
}
|
|
14297
14297
|
|
|
14298
14298
|
// sw-reg:@qwik-router-sw-register-build
|
|
14299
|
-
var qwik_router_sw_register_build_default = '
|
|
14299
|
+
var qwik_router_sw_register_build_default = '"serviceWorker"in navigator?navigator.serviceWorker.register("__url").catch(r=>console.error(r)):console.log("Service worker not supported in this browser.")';
|
|
14300
14300
|
|
|
14301
14301
|
// packages/qwik-router/src/buildtime/vite/plugin.ts
|
|
14302
14302
|
var import_node_fs9 = __toESM(require("node:fs"), 1);
|
|
@@ -14306,17 +14306,11 @@ var import_vite2 = require("vite");
|
|
|
14306
14306
|
// packages/qwik-router/src/middleware/request-handler/error-handler.ts
|
|
14307
14307
|
var ServerError = class extends Error {
|
|
14308
14308
|
constructor(status, data) {
|
|
14309
|
-
super();
|
|
14309
|
+
super(typeof data === "string" ? data : void 0);
|
|
14310
14310
|
this.status = status;
|
|
14311
14311
|
this.data = data;
|
|
14312
14312
|
}
|
|
14313
14313
|
};
|
|
14314
|
-
var ErrorResponse = class extends Error {
|
|
14315
|
-
constructor(status, message) {
|
|
14316
|
-
super(message);
|
|
14317
|
-
this.status = status;
|
|
14318
|
-
}
|
|
14319
|
-
};
|
|
14320
14314
|
function getErrorHtml(status, e) {
|
|
14321
14315
|
let message = "Server Error";
|
|
14322
14316
|
if (e != null) {
|
|
@@ -14518,6 +14512,14 @@ var AbortMessage = class {
|
|
|
14518
14512
|
var RedirectMessage = class extends AbortMessage {
|
|
14519
14513
|
};
|
|
14520
14514
|
|
|
14515
|
+
// packages/qwik-router/src/middleware/request-handler/rewrite-handler.ts
|
|
14516
|
+
var RewriteMessage = class extends AbortMessage {
|
|
14517
|
+
constructor(pathname) {
|
|
14518
|
+
super();
|
|
14519
|
+
this.pathname = pathname;
|
|
14520
|
+
}
|
|
14521
|
+
};
|
|
14522
|
+
|
|
14521
14523
|
// packages/qwik-router/src/runtime/src/constants.ts
|
|
14522
14524
|
var QACTION_KEY = "qaction";
|
|
14523
14525
|
var QFN_KEY = "qfunc";
|
|
@@ -14681,8 +14683,7 @@ function createCacheControl(cacheControl) {
|
|
|
14681
14683
|
cacheControl = {
|
|
14682
14684
|
public: true,
|
|
14683
14685
|
immutable: true,
|
|
14684
|
-
maxAge: 60 * 60 * 24 * 365
|
|
14685
|
-
staleWhileRevalidate: 60 * 60 * 24 * 365
|
|
14686
|
+
maxAge: 60 * 60 * 24 * 365
|
|
14686
14687
|
};
|
|
14687
14688
|
} else if (cacheControl === "no-cache") {
|
|
14688
14689
|
cacheControl = {
|
|
@@ -14692,8 +14693,7 @@ function createCacheControl(cacheControl) {
|
|
|
14692
14693
|
if (typeof cacheControl === "number") {
|
|
14693
14694
|
cacheControl = {
|
|
14694
14695
|
maxAge: cacheControl,
|
|
14695
|
-
sMaxAge: cacheControl
|
|
14696
|
-
staleWhileRevalidate: cacheControl
|
|
14696
|
+
sMaxAge: cacheControl
|
|
14697
14697
|
};
|
|
14698
14698
|
}
|
|
14699
14699
|
if (cacheControl.immutable) {
|
|
@@ -14738,14 +14738,13 @@ import("node:async_hooks").then((module2) => {
|
|
|
14738
14738
|
err
|
|
14739
14739
|
);
|
|
14740
14740
|
});
|
|
14741
|
-
function runQwikRouter(serverRequestEv, loadedRoute, requestHandlers,
|
|
14741
|
+
function runQwikRouter(serverRequestEv, loadedRoute, requestHandlers, rebuildRouteInfo, trailingSlash = true, basePathname = "/", qwikSerializer) {
|
|
14742
14742
|
let resolve4;
|
|
14743
14743
|
const responsePromise = new Promise((r2) => resolve4 = r2);
|
|
14744
14744
|
const requestEv = createRequestEvent(
|
|
14745
14745
|
serverRequestEv,
|
|
14746
14746
|
loadedRoute,
|
|
14747
14747
|
requestHandlers,
|
|
14748
|
-
manifest,
|
|
14749
14748
|
trailingSlash,
|
|
14750
14749
|
basePathname,
|
|
14751
14750
|
qwikSerializer,
|
|
@@ -14754,49 +14753,71 @@ function runQwikRouter(serverRequestEv, loadedRoute, requestHandlers, manifest,
|
|
|
14754
14753
|
return {
|
|
14755
14754
|
response: responsePromise,
|
|
14756
14755
|
requestEv,
|
|
14757
|
-
completion: asyncStore ? asyncStore.run(requestEv, runNext, requestEv, resolve4) : runNext(requestEv, resolve4)
|
|
14756
|
+
completion: asyncStore ? asyncStore.run(requestEv, runNext, requestEv, rebuildRouteInfo, resolve4) : runNext(requestEv, rebuildRouteInfo, resolve4)
|
|
14758
14757
|
};
|
|
14759
14758
|
}
|
|
14760
|
-
async function runNext(requestEv, resolve4) {
|
|
14761
|
-
|
|
14762
|
-
|
|
14763
|
-
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
|
|
14767
|
-
|
|
14768
|
-
|
|
14769
|
-
if (
|
|
14770
|
-
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14759
|
+
async function runNext(requestEv, rebuildRouteInfo, resolve4) {
|
|
14760
|
+
let rewriteAttempt = 1;
|
|
14761
|
+
async function _runNext() {
|
|
14762
|
+
try {
|
|
14763
|
+
await requestEv.next();
|
|
14764
|
+
} catch (e) {
|
|
14765
|
+
if (e instanceof RedirectMessage) {
|
|
14766
|
+
const stream = requestEv.getWritableStream();
|
|
14767
|
+
await stream.close();
|
|
14768
|
+
} else if (e instanceof RewriteMessage) {
|
|
14769
|
+
if (rewriteAttempt > 50) {
|
|
14770
|
+
throw new Error(`Infinite rewrite loop`);
|
|
14771
|
+
}
|
|
14772
|
+
rewriteAttempt += 1;
|
|
14773
|
+
const url = new URL(requestEv.url);
|
|
14774
|
+
url.pathname = e.pathname;
|
|
14775
|
+
const { loadedRoute, requestHandlers } = await rebuildRouteInfo(url);
|
|
14776
|
+
requestEv.resetRoute(loadedRoute, requestHandlers, url);
|
|
14777
|
+
return await _runNext();
|
|
14778
|
+
} else if (e instanceof ServerError) {
|
|
14779
|
+
if (!requestEv.headersSent) {
|
|
14780
|
+
const status = e.status;
|
|
14781
|
+
const accept = requestEv.request.headers.get("Accept");
|
|
14782
|
+
if (accept && !accept.includes("text/html")) {
|
|
14783
|
+
const qwikSerializer = requestEv[RequestEvQwikSerializer];
|
|
14784
|
+
requestEv.headers.set("Content-Type", "application/qwik-json");
|
|
14785
|
+
requestEv.send(status, await qwikSerializer._serialize([e.data]));
|
|
14786
|
+
} else {
|
|
14787
|
+
const html5 = getErrorHtml(e.status, e.data);
|
|
14788
|
+
requestEv.html(status, html5);
|
|
14781
14789
|
}
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
|
|
14785
|
-
|
|
14786
|
-
|
|
14790
|
+
}
|
|
14791
|
+
} else if (!(e instanceof AbortMessage)) {
|
|
14792
|
+
if (getRequestMode(requestEv) !== "dev") {
|
|
14793
|
+
try {
|
|
14794
|
+
if (!requestEv.headersSent) {
|
|
14795
|
+
requestEv.headers.set("content-type", "text/html; charset=utf-8");
|
|
14796
|
+
requestEv.cacheControl({ noCache: true });
|
|
14797
|
+
requestEv.status(500);
|
|
14798
|
+
}
|
|
14799
|
+
const stream = requestEv.getWritableStream();
|
|
14800
|
+
if (!stream.locked) {
|
|
14801
|
+
const writer = stream.getWriter();
|
|
14802
|
+
await writer.write(encoder.encode(minimalHtmlResponse(500, "Internal Server Error")));
|
|
14803
|
+
await writer.close();
|
|
14804
|
+
}
|
|
14805
|
+
} catch {
|
|
14806
|
+
console.error("Unable to render error page");
|
|
14787
14807
|
}
|
|
14788
|
-
} catch {
|
|
14789
|
-
console.error("Unable to render error page");
|
|
14790
14808
|
}
|
|
14809
|
+
return e;
|
|
14791
14810
|
}
|
|
14792
|
-
return e;
|
|
14793
14811
|
}
|
|
14812
|
+
return void 0;
|
|
14813
|
+
}
|
|
14814
|
+
try {
|
|
14815
|
+
return await _runNext();
|
|
14794
14816
|
} finally {
|
|
14795
14817
|
if (!requestEv.isDirty()) {
|
|
14796
14818
|
resolve4(null);
|
|
14797
14819
|
}
|
|
14798
14820
|
}
|
|
14799
|
-
return void 0;
|
|
14800
14821
|
}
|
|
14801
14822
|
function getRouteMatchPathname(pathname, trailingSlash) {
|
|
14802
14823
|
if (pathname.endsWith(QDATA_JSON)) {
|
|
@@ -14822,7 +14843,8 @@ var RequestRouteName = "@routeName";
|
|
|
14822
14843
|
var RequestEvSharedActionId = "@actionId";
|
|
14823
14844
|
var RequestEvSharedActionFormData = "@actionFormData";
|
|
14824
14845
|
var RequestEvSharedNonce = "@nonce";
|
|
14825
|
-
|
|
14846
|
+
var RequestEvIsRewrite = "@rewrite";
|
|
14847
|
+
function createRequestEvent(serverRequestEv, loadedRoute, requestHandlers, trailingSlash, basePathname, qwikSerializer, resolved) {
|
|
14826
14848
|
const { request, platform, env: env2 } = serverRequestEv;
|
|
14827
14849
|
const sharedMap = /* @__PURE__ */ new Map();
|
|
14828
14850
|
const cookie = new Cookie(request.headers.get("cookie"));
|
|
@@ -14835,7 +14857,6 @@ function createRequestEvent(serverRequestEv, loadedRoute, requestHandlers, manif
|
|
|
14835
14857
|
}
|
|
14836
14858
|
sharedMap.set(IsQData, true);
|
|
14837
14859
|
}
|
|
14838
|
-
sharedMap.set("@manifest", manifest);
|
|
14839
14860
|
let routeModuleIndex = -1;
|
|
14840
14861
|
let writableStream = null;
|
|
14841
14862
|
let requestData = void 0;
|
|
@@ -14853,6 +14874,13 @@ function createRequestEvent(serverRequestEv, loadedRoute, requestHandlers, manif
|
|
|
14853
14874
|
routeModuleIndex++;
|
|
14854
14875
|
}
|
|
14855
14876
|
};
|
|
14877
|
+
const resetRoute = (_loadedRoute, _requestHandlers, _url = url) => {
|
|
14878
|
+
loadedRoute = _loadedRoute;
|
|
14879
|
+
requestHandlers = _requestHandlers;
|
|
14880
|
+
url.pathname = _url.pathname;
|
|
14881
|
+
url.search = _url.search;
|
|
14882
|
+
routeModuleIndex = -1;
|
|
14883
|
+
};
|
|
14856
14884
|
const check = () => {
|
|
14857
14885
|
if (writableStream !== null) {
|
|
14858
14886
|
throw new Error("Response already sent");
|
|
@@ -14887,11 +14915,7 @@ function createRequestEvent(serverRequestEv, loadedRoute, requestHandlers, manif
|
|
|
14887
14915
|
const writableStream2 = requestEv.getWritableStream();
|
|
14888
14916
|
statusOrResponse.body.pipeTo(writableStream2);
|
|
14889
14917
|
} else {
|
|
14890
|
-
|
|
14891
|
-
return new RedirectMessage();
|
|
14892
|
-
} else {
|
|
14893
|
-
requestEv.getWritableStream().getWriter().close();
|
|
14894
|
-
}
|
|
14918
|
+
requestEv.getWritableStream().getWriter().close();
|
|
14895
14919
|
}
|
|
14896
14920
|
}
|
|
14897
14921
|
return exit2();
|
|
@@ -14905,17 +14929,26 @@ function createRequestEvent(serverRequestEv, loadedRoute, requestHandlers, manif
|
|
|
14905
14929
|
[RequestEvLoaders]: loaders,
|
|
14906
14930
|
[RequestEvMode]: serverRequestEv.mode,
|
|
14907
14931
|
[RequestEvTrailingSlash]: trailingSlash,
|
|
14908
|
-
[RequestEvRoute]
|
|
14932
|
+
get [RequestEvRoute]() {
|
|
14933
|
+
return loadedRoute;
|
|
14934
|
+
},
|
|
14909
14935
|
[RequestEvQwikSerializer]: qwikSerializer,
|
|
14910
14936
|
cookie,
|
|
14911
14937
|
headers,
|
|
14912
14938
|
env: env2,
|
|
14913
14939
|
method: request.method,
|
|
14914
14940
|
signal: request.signal,
|
|
14915
|
-
|
|
14916
|
-
|
|
14941
|
+
originalUrl: new URL(url),
|
|
14942
|
+
get params() {
|
|
14943
|
+
return (loadedRoute == null ? void 0 : loadedRoute[1]) ?? {};
|
|
14944
|
+
},
|
|
14945
|
+
get pathname() {
|
|
14946
|
+
return url.pathname;
|
|
14947
|
+
},
|
|
14917
14948
|
platform,
|
|
14918
|
-
query
|
|
14949
|
+
get query() {
|
|
14950
|
+
return url.searchParams;
|
|
14951
|
+
},
|
|
14919
14952
|
request,
|
|
14920
14953
|
url,
|
|
14921
14954
|
basePathname,
|
|
@@ -14930,6 +14963,7 @@ function createRequestEvent(serverRequestEv, loadedRoute, requestHandlers, manif
|
|
|
14930
14963
|
return serverRequestEv.getClientConn();
|
|
14931
14964
|
},
|
|
14932
14965
|
next,
|
|
14966
|
+
resetRoute,
|
|
14933
14967
|
exit: exit2,
|
|
14934
14968
|
cacheControl: (cacheControl, target = "Cache-Control") => {
|
|
14935
14969
|
check();
|
|
@@ -14962,7 +14996,7 @@ function createRequestEvent(serverRequestEv, loadedRoute, requestHandlers, manif
|
|
|
14962
14996
|
},
|
|
14963
14997
|
error: (statusCode, message) => {
|
|
14964
14998
|
status = statusCode;
|
|
14965
|
-
return new
|
|
14999
|
+
return new ServerError(statusCode, message);
|
|
14966
15000
|
},
|
|
14967
15001
|
redirect: (statusCode, url2) => {
|
|
14968
15002
|
check();
|
|
@@ -14980,6 +15014,14 @@ function createRequestEvent(serverRequestEv, loadedRoute, requestHandlers, manif
|
|
|
14980
15014
|
exit2();
|
|
14981
15015
|
return new RedirectMessage();
|
|
14982
15016
|
},
|
|
15017
|
+
rewrite: (pathname) => {
|
|
15018
|
+
check();
|
|
15019
|
+
if (pathname.startsWith("http")) {
|
|
15020
|
+
throw new Error("Rewrite does not support absolute urls");
|
|
15021
|
+
}
|
|
15022
|
+
sharedMap.set(RequestEvIsRewrite, true);
|
|
15023
|
+
return new RewriteMessage(pathname.replace(/\/+/g, "/"));
|
|
15024
|
+
},
|
|
14983
15025
|
defer: (returnData) => {
|
|
14984
15026
|
return typeof returnData === "function" ? returnData : () => returnData;
|
|
14985
15027
|
},
|
|
@@ -15063,7 +15105,7 @@ var parseRequest = async ({ request, method, query }, sharedMap, qwikSerializer)
|
|
|
15063
15105
|
if (data) {
|
|
15064
15106
|
try {
|
|
15065
15107
|
return qwikSerializer._deserialize(decodeURIComponent(data));
|
|
15066
|
-
} catch
|
|
15108
|
+
} catch {
|
|
15067
15109
|
}
|
|
15068
15110
|
}
|
|
15069
15111
|
}
|
|
@@ -15091,7 +15133,7 @@ var formToObj = (formData) => {
|
|
|
15091
15133
|
|
|
15092
15134
|
// packages/qwik-router/src/middleware/request-handler/response-page.ts
|
|
15093
15135
|
function getQwikRouterServerData(requestEv) {
|
|
15094
|
-
const {
|
|
15136
|
+
const { params, request, status, locale, originalUrl } = requestEv;
|
|
15095
15137
|
const requestHeaders = {};
|
|
15096
15138
|
request.headers.forEach((value2, key) => requestHeaders[key] = value2);
|
|
15097
15139
|
const action = requestEv.sharedMap.get(RequestEvSharedActionId);
|
|
@@ -15099,7 +15141,7 @@ function getQwikRouterServerData(requestEv) {
|
|
|
15099
15141
|
const routeName = requestEv.sharedMap.get(RequestRouteName);
|
|
15100
15142
|
const nonce = requestEv.sharedMap.get(RequestEvSharedNonce);
|
|
15101
15143
|
const headers = requestEv.request.headers;
|
|
15102
|
-
const reconstructedUrl = new URL(
|
|
15144
|
+
const reconstructedUrl = new URL(originalUrl.pathname + originalUrl.search, originalUrl);
|
|
15103
15145
|
const host = headers.get("X-Forwarded-Host");
|
|
15104
15146
|
const protocol = headers.get("X-Forwarded-Proto");
|
|
15105
15147
|
if (host) {
|
|
@@ -15377,13 +15419,9 @@ async function pureServerFunction(ev) {
|
|
|
15377
15419
|
}
|
|
15378
15420
|
} catch (err) {
|
|
15379
15421
|
if (err instanceof ServerError) {
|
|
15380
|
-
ev.
|
|
15381
|
-
ev.send(err.status, await qwikSerializer._serialize([err.data]));
|
|
15382
|
-
return;
|
|
15422
|
+
throw ev.error(err.status, err.data);
|
|
15383
15423
|
}
|
|
15384
|
-
ev.
|
|
15385
|
-
ev.send(500, await qwikSerializer._serialize([err]));
|
|
15386
|
-
return;
|
|
15424
|
+
throw ev.error(500, "Invalid request");
|
|
15387
15425
|
}
|
|
15388
15426
|
if (isAsyncIterator(result)) {
|
|
15389
15427
|
ev.headers.set("Content-Type", "text/qwik-json-stream");
|
|
@@ -15415,18 +15453,19 @@ async function pureServerFunction(ev) {
|
|
|
15415
15453
|
}
|
|
15416
15454
|
function fixTrailingSlash(ev) {
|
|
15417
15455
|
const trailingSlash = getRequestTrailingSlash(ev);
|
|
15418
|
-
const { basePathname,
|
|
15456
|
+
const { basePathname, originalUrl, sharedMap } = ev;
|
|
15457
|
+
const { pathname, search: search2 } = originalUrl;
|
|
15419
15458
|
const isQData = sharedMap.has(IsQData);
|
|
15420
15459
|
if (!isQData && pathname !== basePathname && !pathname.endsWith(".html")) {
|
|
15421
15460
|
if (trailingSlash) {
|
|
15422
15461
|
if (!pathname.endsWith("/")) {
|
|
15423
|
-
throw ev.redirect(301 /* MovedPermanently */, pathname + "/" +
|
|
15462
|
+
throw ev.redirect(301 /* MovedPermanently */, pathname + "/" + search2);
|
|
15424
15463
|
}
|
|
15425
15464
|
} else {
|
|
15426
15465
|
if (pathname.endsWith("/")) {
|
|
15427
15466
|
throw ev.redirect(
|
|
15428
15467
|
301 /* MovedPermanently */,
|
|
15429
|
-
pathname.slice(0, pathname.length - 1) +
|
|
15468
|
+
pathname.slice(0, pathname.length - 1) + search2
|
|
15430
15469
|
);
|
|
15431
15470
|
}
|
|
15432
15471
|
}
|
|
@@ -15503,10 +15542,10 @@ async function handleRedirect(requestEv) {
|
|
|
15503
15542
|
return;
|
|
15504
15543
|
}
|
|
15505
15544
|
const status = requestEv.status();
|
|
15506
|
-
const
|
|
15507
|
-
const isRedirect = status >= 301 && status <= 308 &&
|
|
15545
|
+
const location = requestEv.headers.get("Location");
|
|
15546
|
+
const isRedirect = status >= 301 && status <= 308 && location;
|
|
15508
15547
|
if (isRedirect) {
|
|
15509
|
-
const adaptedLocation = makeQDataPath(
|
|
15548
|
+
const adaptedLocation = makeQDataPath(location);
|
|
15510
15549
|
if (adaptedLocation) {
|
|
15511
15550
|
requestEv.headers.set("Location", adaptedLocation);
|
|
15512
15551
|
requestEv.getWritableStream().close();
|
|
@@ -15527,7 +15566,7 @@ async function renderQData(requestEv) {
|
|
|
15527
15566
|
return;
|
|
15528
15567
|
}
|
|
15529
15568
|
const status = requestEv.status();
|
|
15530
|
-
const
|
|
15569
|
+
const redirectLocation = requestEv.headers.get("Location");
|
|
15531
15570
|
const trailingSlash = getRequestTrailingSlash(requestEv);
|
|
15532
15571
|
const requestHeaders = {};
|
|
15533
15572
|
requestEv.request.headers.forEach((value2, key) => requestHeaders[key] = value2);
|
|
@@ -15537,7 +15576,8 @@ async function renderQData(requestEv) {
|
|
|
15537
15576
|
action: requestEv.sharedMap.get(RequestEvSharedActionId),
|
|
15538
15577
|
status: status !== 200 ? status : 200,
|
|
15539
15578
|
href: getPathname(requestEv.url, trailingSlash),
|
|
15540
|
-
redirect:
|
|
15579
|
+
redirect: redirectLocation ?? void 0,
|
|
15580
|
+
isRewrite: requestEv.sharedMap.get(RequestEvIsRewrite)
|
|
15541
15581
|
};
|
|
15542
15582
|
const writer = requestEv.getWritableStream().getWriter();
|
|
15543
15583
|
const qwikSerializer = requestEv[RequestEvQwikSerializer];
|
|
@@ -25975,6 +26015,9 @@ async function createMdxTransformer(ctx) {
|
|
|
25975
26015
|
const addImport = `import { jsx } from '@qwik.dev/core';
|
|
25976
26016
|
`;
|
|
25977
26017
|
const newDefault = `
|
|
26018
|
+
function _missingMdxReference(id, component, place) {
|
|
26019
|
+
throw new Error("${id}: Expected " + (component ? "component" : "object") + " \`" + id + "\` to be defined: you likely forgot to import, pass, or provide it." + (place ? "\\nIt\u2019s referenced in your code at \`" + place + "\`" : ""));
|
|
26020
|
+
}
|
|
25978
26021
|
const WrappedMdxContent = () => {
|
|
25979
26022
|
const content = _createMdxContent({});
|
|
25980
26023
|
return typeof MDXLayout === 'function' ? jsx(MDXLayout, {children: content}) : content;
|
|
@@ -26189,130 +26232,6 @@ function generateServiceWorkerRegister(ctx, swRegister) {
|
|
|
26189
26232
|
}
|
|
26190
26233
|
return `export default ${JSON.stringify(swReg)};`;
|
|
26191
26234
|
}
|
|
26192
|
-
function prependManifestToServiceWorker(ctx, manifest, prefetch, swCode) {
|
|
26193
|
-
const key = `/* Qwik Service Worker */`;
|
|
26194
|
-
if (swCode.includes(key)) {
|
|
26195
|
-
return null;
|
|
26196
|
-
}
|
|
26197
|
-
const appBundles = [];
|
|
26198
|
-
const appBundlesCode = generateAppBundles(appBundles, manifest);
|
|
26199
|
-
const libraryBundlesCode = generateLibraryBundles(appBundles, manifest);
|
|
26200
|
-
const [linkBundlesCode] = generateLinkBundles(ctx, appBundles, manifest, prefetch);
|
|
26201
|
-
return [key, appBundlesCode, libraryBundlesCode, linkBundlesCode, swCode].join("\n");
|
|
26202
|
-
}
|
|
26203
|
-
function generateAppBundles(appBundles, manifest) {
|
|
26204
|
-
const sortedBundles = Object.keys(manifest.bundles).sort();
|
|
26205
|
-
for (const appBundleName of sortedBundles) {
|
|
26206
|
-
const appBundle = [appBundleName, []];
|
|
26207
|
-
appBundles.push(appBundle);
|
|
26208
|
-
const symbolHashesInBundle = [];
|
|
26209
|
-
const manifestBundle = manifest.bundles[appBundleName];
|
|
26210
|
-
const importedBundleNames = Array.isArray(manifestBundle.imports) ? manifestBundle.imports : [];
|
|
26211
|
-
const depsSet = new Set(importedBundleNames);
|
|
26212
|
-
for (const importedBundleName of importedBundleNames) {
|
|
26213
|
-
clearTransitiveDeps(depsSet, /* @__PURE__ */ new Set(), importedBundleName);
|
|
26214
|
-
}
|
|
26215
|
-
appBundle[1] = Array.from(depsSet).map((dep) => sortedBundles.indexOf(dep));
|
|
26216
|
-
if (manifestBundle.symbols) {
|
|
26217
|
-
for (const manifestBundleSymbolName of manifestBundle.symbols) {
|
|
26218
|
-
const symbol = manifest.symbols[manifestBundleSymbolName];
|
|
26219
|
-
if ((symbol == null ? void 0 : symbol.hash) && !symbolHashesInBundle.includes(symbol.hash)) {
|
|
26220
|
-
symbolHashesInBundle.push(symbol.hash);
|
|
26221
|
-
}
|
|
26222
|
-
}
|
|
26223
|
-
}
|
|
26224
|
-
if (symbolHashesInBundle.length > 0) {
|
|
26225
|
-
appBundle[2] = symbolHashesInBundle;
|
|
26226
|
-
}
|
|
26227
|
-
}
|
|
26228
|
-
function clearTransitiveDeps(deps, seen, depName) {
|
|
26229
|
-
const childBundle = manifest.bundles[depName];
|
|
26230
|
-
for (const childDepImport of childBundle.imports || []) {
|
|
26231
|
-
if (deps.has(childDepImport)) {
|
|
26232
|
-
deps.delete(childDepImport);
|
|
26233
|
-
}
|
|
26234
|
-
if (!seen.has(childDepImport)) {
|
|
26235
|
-
seen.add(childDepImport);
|
|
26236
|
-
clearTransitiveDeps(deps, seen, childDepImport);
|
|
26237
|
-
}
|
|
26238
|
-
}
|
|
26239
|
-
}
|
|
26240
|
-
return `const appBundles=${JSON.stringify(appBundles)};`;
|
|
26241
|
-
}
|
|
26242
|
-
function generateLibraryBundles(appBundles, manifest) {
|
|
26243
|
-
const libraryBundleIds = [];
|
|
26244
|
-
for (const [bundleName, bundle] of Object.entries(manifest.bundles)) {
|
|
26245
|
-
if (bundle.origins && bundle.origins.includes("@qwik-router-config")) {
|
|
26246
|
-
libraryBundleIds.push(getAppBundleIndex(appBundles, bundleName));
|
|
26247
|
-
break;
|
|
26248
|
-
}
|
|
26249
|
-
}
|
|
26250
|
-
return `const libraryBundleIds=${JSON.stringify(libraryBundleIds)};`;
|
|
26251
|
-
}
|
|
26252
|
-
function generateLinkBundles(ctx, appBundles, manifest, prefetch) {
|
|
26253
|
-
var _a, _b;
|
|
26254
|
-
const linkBundles = [];
|
|
26255
|
-
const symbolToBundle = /* @__PURE__ */ new Map();
|
|
26256
|
-
const routeToBundles = {};
|
|
26257
|
-
for (const bundleName in manifest.bundles || []) {
|
|
26258
|
-
(_a = manifest.bundles[bundleName].symbols) == null ? void 0 : _a.forEach((symbol) => {
|
|
26259
|
-
const idx = symbol.lastIndexOf("_");
|
|
26260
|
-
symbolToBundle.set(idx === -1 ? symbol : symbol.substring(idx + 1), bundleName);
|
|
26261
|
-
});
|
|
26262
|
-
}
|
|
26263
|
-
for (const r2 of ctx.routes) {
|
|
26264
|
-
const linkBundleNames = [];
|
|
26265
|
-
const addFileBundles = (filePath) => {
|
|
26266
|
-
for (const [bundleName, bundle] of Object.entries(manifest.bundles)) {
|
|
26267
|
-
if (bundle.origins) {
|
|
26268
|
-
for (const bundleOrigin of bundle.origins) {
|
|
26269
|
-
const srcPath = removeExtension(filePath);
|
|
26270
|
-
const bundleOriginPath = removeExtension(bundleOrigin);
|
|
26271
|
-
if (srcPath.endsWith(bundleOriginPath)) {
|
|
26272
|
-
if (!linkBundleNames.includes(bundleName)) {
|
|
26273
|
-
linkBundleNames.push(bundleName);
|
|
26274
|
-
}
|
|
26275
|
-
if (bundle.dynamicImports) {
|
|
26276
|
-
for (const dynamicImport of bundle.dynamicImports) {
|
|
26277
|
-
if (!linkBundleNames.includes(dynamicImport)) {
|
|
26278
|
-
linkBundleNames.push(dynamicImport);
|
|
26279
|
-
}
|
|
26280
|
-
}
|
|
26281
|
-
}
|
|
26282
|
-
}
|
|
26283
|
-
}
|
|
26284
|
-
}
|
|
26285
|
-
}
|
|
26286
|
-
};
|
|
26287
|
-
for (const layout of r2.layouts) {
|
|
26288
|
-
addFileBundles(layout.filePath);
|
|
26289
|
-
}
|
|
26290
|
-
addFileBundles(r2.filePath);
|
|
26291
|
-
if (prefetch) {
|
|
26292
|
-
const symbolsForRoute = prefetch.find((p) => p.route === r2.routeName);
|
|
26293
|
-
(_b = symbolsForRoute == null ? void 0 : symbolsForRoute.symbols) == null ? void 0 : _b.reverse().forEach((symbol) => {
|
|
26294
|
-
const bundle = symbolToBundle.get(symbol);
|
|
26295
|
-
if (bundle) {
|
|
26296
|
-
const idx = linkBundleNames.indexOf(bundle);
|
|
26297
|
-
if (idx !== -1) {
|
|
26298
|
-
linkBundleNames.splice(idx, 1);
|
|
26299
|
-
}
|
|
26300
|
-
linkBundleNames.unshift(bundle);
|
|
26301
|
-
}
|
|
26302
|
-
});
|
|
26303
|
-
}
|
|
26304
|
-
linkBundles.push(
|
|
26305
|
-
`[${r2.pattern.toString()},${JSON.stringify(
|
|
26306
|
-
linkBundleNames.map((bundleName) => getAppBundleIndex(appBundles, bundleName))
|
|
26307
|
-
)}]`
|
|
26308
|
-
);
|
|
26309
|
-
routeToBundles[r2.routeName] = linkBundleNames;
|
|
26310
|
-
}
|
|
26311
|
-
return [`const linkBundles=[${linkBundles.join(",")}];`, routeToBundles];
|
|
26312
|
-
}
|
|
26313
|
-
function getAppBundleIndex(appBundles, bundleName) {
|
|
26314
|
-
return appBundles.findIndex((b) => b[0] === bundleName);
|
|
26315
|
-
}
|
|
26316
26235
|
var SW_UNREGISTER = `
|
|
26317
26236
|
navigator.serviceWorker?.getRegistrations().then((regs) => {
|
|
26318
26237
|
for (const reg of regs) {
|
|
@@ -26543,6 +26462,16 @@ function generateCodeFrame(source, start = 0, end) {
|
|
|
26543
26462
|
}
|
|
26544
26463
|
return res.join("\n");
|
|
26545
26464
|
}
|
|
26465
|
+
function parseId(originalId) {
|
|
26466
|
+
const [pathId, query] = originalId.split("?");
|
|
26467
|
+
const queryStr = query || "";
|
|
26468
|
+
return {
|
|
26469
|
+
originalId,
|
|
26470
|
+
pathId,
|
|
26471
|
+
query: queryStr ? `?${query}` : "",
|
|
26472
|
+
params: new URLSearchParams(queryStr)
|
|
26473
|
+
};
|
|
26474
|
+
}
|
|
26546
26475
|
|
|
26547
26476
|
// packages/qwik-router/src/buildtime/vite/format-error.ts
|
|
26548
26477
|
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
@@ -26725,21 +26654,27 @@ function ssrDevMiddleware(ctx, server) {
|
|
|
26725
26654
|
if (requestHandlers.length > 0) {
|
|
26726
26655
|
const serverRequestEv = await fromNodeHttp(url, req, res, "dev");
|
|
26727
26656
|
Object.assign(serverRequestEv.platform, ctx.opts.platform);
|
|
26728
|
-
const manifest = {
|
|
26729
|
-
manifestHash: "",
|
|
26730
|
-
symbols: {},
|
|
26731
|
-
mapping: {},
|
|
26732
|
-
bundles: {},
|
|
26733
|
-
injections: [],
|
|
26734
|
-
version: "1"
|
|
26735
|
-
};
|
|
26736
26657
|
const { _deserialize, _serialize, _verifySerializable } = await server.ssrLoadModule("@qwik-serializer");
|
|
26737
26658
|
const qwikSerializer = { _deserialize, _serialize, _verifySerializable };
|
|
26659
|
+
const rebuildRouteInfo = async (url2) => {
|
|
26660
|
+
const { serverPlugins: serverPlugins2, loadedRoute: loadedRoute2 } = await resolveRoute2(routeModulePaths, url2);
|
|
26661
|
+
const requestHandlers2 = resolveRequestHandlers(
|
|
26662
|
+
serverPlugins2,
|
|
26663
|
+
loadedRoute2,
|
|
26664
|
+
req.method ?? "GET",
|
|
26665
|
+
false,
|
|
26666
|
+
renderFn
|
|
26667
|
+
);
|
|
26668
|
+
return {
|
|
26669
|
+
loadedRoute: loadedRoute2,
|
|
26670
|
+
requestHandlers: requestHandlers2
|
|
26671
|
+
};
|
|
26672
|
+
};
|
|
26738
26673
|
const { completion, requestEv } = runQwikRouter(
|
|
26739
26674
|
serverRequestEv,
|
|
26740
26675
|
loadedRoute,
|
|
26741
26676
|
requestHandlers,
|
|
26742
|
-
|
|
26677
|
+
rebuildRouteInfo,
|
|
26743
26678
|
ctx.opts.trailingSlash,
|
|
26744
26679
|
ctx.opts.basePathname,
|
|
26745
26680
|
qwikSerializer
|
|
@@ -26902,7 +26837,7 @@ function staticDistMiddleware({ config }) {
|
|
|
26902
26837
|
import_node_fs6.default.createReadStream(filePath).pipe(res);
|
|
26903
26838
|
return;
|
|
26904
26839
|
}
|
|
26905
|
-
} catch
|
|
26840
|
+
} catch {
|
|
26906
26841
|
}
|
|
26907
26842
|
}
|
|
26908
26843
|
next();
|
|
@@ -26934,7 +26869,7 @@ function formatDevSerializeError(err, routeModulePaths) {
|
|
|
26934
26869
|
if (line > -1) {
|
|
26935
26870
|
err.loc.line = line + 1;
|
|
26936
26871
|
}
|
|
26937
|
-
} catch
|
|
26872
|
+
} catch {
|
|
26938
26873
|
}
|
|
26939
26874
|
}
|
|
26940
26875
|
}
|
|
@@ -26998,29 +26933,55 @@ self.addEventListener('install', () => self.skipWaiting());
|
|
|
26998
26933
|
self.addEventListener('activate', (ev) => ev.waitUntil(self.clients.claim()));
|
|
26999
26934
|
`;
|
|
27000
26935
|
|
|
26936
|
+
// packages/qwik-router/src/buildtime/vite/get-route-imports.ts
|
|
26937
|
+
function getRouteImports(routes, manifest) {
|
|
26938
|
+
var _a, _b;
|
|
26939
|
+
const result = {};
|
|
26940
|
+
routes.forEach((route) => {
|
|
26941
|
+
const routePath = removeExtension(route.filePath);
|
|
26942
|
+
const layoutPaths = route.layouts ? route.layouts.map((layout) => removeExtension(layout.filePath)) : [];
|
|
26943
|
+
const routeAndLayoutPaths = [routePath, ...layoutPaths];
|
|
26944
|
+
const bundles = [];
|
|
26945
|
+
for (const [bundleName, bundle] of Object.entries(manifest.bundles)) {
|
|
26946
|
+
if (isBundlePartOfRoute(bundle, routeAndLayoutPaths)) {
|
|
26947
|
+
bundles.push(bundleName);
|
|
26948
|
+
}
|
|
26949
|
+
}
|
|
26950
|
+
if (bundles.length > 0) {
|
|
26951
|
+
result[route.routeName] = { dynamicImports: bundles };
|
|
26952
|
+
}
|
|
26953
|
+
});
|
|
26954
|
+
for (const bundleName of Object.keys(manifest.bundles)) {
|
|
26955
|
+
const bundle = manifest.bundles[bundleName];
|
|
26956
|
+
if ((_a = bundle.origins) == null ? void 0 : _a.some((s2) => s2.endsWith(QWIK_ROUTER_CONFIG_ID))) {
|
|
26957
|
+
result[bundleName] = {
|
|
26958
|
+
...bundle,
|
|
26959
|
+
dynamicImports: (_b = bundle.dynamicImports) == null ? void 0 : _b.filter(
|
|
26960
|
+
(d) => {
|
|
26961
|
+
var _a2;
|
|
26962
|
+
return (_a2 = manifest.bundles[d].origins) == null ? void 0 : _a2.some((s2) => s2.endsWith("menu.md"));
|
|
26963
|
+
}
|
|
26964
|
+
)
|
|
26965
|
+
};
|
|
26966
|
+
break;
|
|
26967
|
+
}
|
|
26968
|
+
}
|
|
26969
|
+
return result;
|
|
26970
|
+
}
|
|
26971
|
+
function isBundlePartOfRoute(bundle, routeAndLayoutPaths) {
|
|
26972
|
+
if (!bundle.origins) {
|
|
26973
|
+
return false;
|
|
26974
|
+
}
|
|
26975
|
+
for (const bundleOrigin of bundle.origins) {
|
|
26976
|
+
const originPath = removeExtension(bundleOrigin);
|
|
26977
|
+
return routeAndLayoutPaths.some((path3) => path3.endsWith(originPath));
|
|
26978
|
+
}
|
|
26979
|
+
}
|
|
26980
|
+
|
|
27001
26981
|
// packages/qwik-router/src/buildtime/vite/image-jsx.ts
|
|
27002
26982
|
var import_node_fs7 = __toESM(require("node:fs"), 1);
|
|
27003
26983
|
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
27004
26984
|
var import_svgo = require("svgo");
|
|
27005
|
-
|
|
27006
|
-
// packages/qwik/src/optimizer/src/versions.ts
|
|
27007
|
-
var versions = {
|
|
27008
|
-
qwik: globalThis.QWIK_VERSION
|
|
27009
|
-
};
|
|
27010
|
-
|
|
27011
|
-
// packages/qwik/src/optimizer/src/plugins/plugin.ts
|
|
27012
|
-
function parseId(originalId) {
|
|
27013
|
-
const [pathId, query] = originalId.split("?");
|
|
27014
|
-
const queryStr = query || "";
|
|
27015
|
-
return {
|
|
27016
|
-
originalId,
|
|
27017
|
-
pathId,
|
|
27018
|
-
query: queryStr ? `?${query}` : "",
|
|
27019
|
-
params: new URLSearchParams(queryStr)
|
|
27020
|
-
};
|
|
27021
|
-
}
|
|
27022
|
-
|
|
27023
|
-
// packages/qwik-router/src/buildtime/vite/image-jsx.ts
|
|
27024
26985
|
function imagePlugin(userOpts) {
|
|
27025
26986
|
const supportedExtensions = [".jpg", ".jpeg", ".png", ".webp", ".gif", ".avif", ".tiff"];
|
|
27026
26987
|
return [
|
|
@@ -27053,7 +27014,7 @@ function imagePlugin(userOpts) {
|
|
|
27053
27014
|
defaultDirectives: (url) => {
|
|
27054
27015
|
var _a;
|
|
27055
27016
|
if (url.searchParams.has("jsx")) {
|
|
27056
|
-
const { jsx:
|
|
27017
|
+
const { jsx: _2, ...params } = Object.fromEntries(url.searchParams.entries());
|
|
27057
27018
|
return new URLSearchParams({
|
|
27058
27019
|
format: "webp",
|
|
27059
27020
|
quality: "75",
|
|
@@ -27277,7 +27238,7 @@ function qwikRouterPlugin(userOpts) {
|
|
|
27277
27238
|
return updatedViteConfig;
|
|
27278
27239
|
},
|
|
27279
27240
|
async configResolved(config) {
|
|
27280
|
-
var _a, _b, _c;
|
|
27241
|
+
var _a, _b, _c, _d, _e;
|
|
27281
27242
|
Object.assign(process.env, (0, import_vite2.loadEnv)(config.mode, process.cwd(), ""));
|
|
27282
27243
|
rootDir = (0, import_node_path11.resolve)(config.root);
|
|
27283
27244
|
const target = ((_a = config.build) == null ? void 0 : _a.ssr) || config.mode === "ssr" ? "ssr" : "client";
|
|
@@ -27290,10 +27251,13 @@ function qwikRouterPlugin(userOpts) {
|
|
|
27290
27251
|
if (!qwikPlugin) {
|
|
27291
27252
|
throw new Error("Missing vite-plugin-qwik");
|
|
27292
27253
|
}
|
|
27293
|
-
|
|
27254
|
+
(_c = (_b = qwikPlugin.api).registerBundleGraphAdder) == null ? void 0 : _c.call(_b, (manifest) => {
|
|
27255
|
+
return getRouteImports(ctx.routes, manifest);
|
|
27256
|
+
});
|
|
27257
|
+
if (((_d = config.ssr) == null ? void 0 : _d.format) === "cjs") {
|
|
27294
27258
|
ssrFormat = "cjs";
|
|
27295
27259
|
}
|
|
27296
|
-
outDir = (
|
|
27260
|
+
outDir = (_e = config.build) == null ? void 0 : _e.outDir;
|
|
27297
27261
|
},
|
|
27298
27262
|
configureServer(server) {
|
|
27299
27263
|
return () => {
|
|
@@ -27435,34 +27399,7 @@ function qwikRouterPlugin(userOpts) {
|
|
|
27435
27399
|
sequential: true,
|
|
27436
27400
|
async handler() {
|
|
27437
27401
|
if ((ctx == null ? void 0 : ctx.target) === "ssr" && !(ctx == null ? void 0 : ctx.isDevServer)) {
|
|
27438
|
-
const manifest = qwikPlugin.api.getManifest();
|
|
27439
27402
|
const clientOutDir = qwikPlugin.api.getClientOutDir();
|
|
27440
|
-
if (manifest && clientOutDir) {
|
|
27441
|
-
const basePathRelDir = api.getBasePathname().replace(/^\/|\/$/, "");
|
|
27442
|
-
const clientOutBaseDir = (0, import_node_path11.join)(clientOutDir, basePathRelDir);
|
|
27443
|
-
const insightsManifest = await qwikPlugin.api.getInsightsManifest(clientOutDir);
|
|
27444
|
-
for (const swEntry of ctx.serviceWorkers) {
|
|
27445
|
-
try {
|
|
27446
|
-
const swClientDistPath = (0, import_node_path11.join)(clientOutBaseDir, swEntry.chunkFileName);
|
|
27447
|
-
const swCode = await import_node_fs9.default.promises.readFile(swClientDistPath, "utf-8");
|
|
27448
|
-
try {
|
|
27449
|
-
const swCodeUpdate = prependManifestToServiceWorker(
|
|
27450
|
-
ctx,
|
|
27451
|
-
manifest,
|
|
27452
|
-
(insightsManifest == null ? void 0 : insightsManifest.prefetch) || null,
|
|
27453
|
-
swCode
|
|
27454
|
-
);
|
|
27455
|
-
if (swCodeUpdate) {
|
|
27456
|
-
await import_node_fs9.default.promises.mkdir(clientOutDir, { recursive: true });
|
|
27457
|
-
await import_node_fs9.default.promises.writeFile(swClientDistPath, swCodeUpdate);
|
|
27458
|
-
}
|
|
27459
|
-
} catch (e2) {
|
|
27460
|
-
console.error(e2);
|
|
27461
|
-
}
|
|
27462
|
-
} catch (e) {
|
|
27463
|
-
}
|
|
27464
|
-
}
|
|
27465
|
-
}
|
|
27466
27403
|
if (outDir && clientOutDir) {
|
|
27467
27404
|
const assetsDir = qwikPlugin.api.getAssetsDir();
|
|
27468
27405
|
const { staticPathsCode, notFoundPathsCode } = await postBuild(
|