@solidjs/start 2.0.0-beta.0 → 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/CHANGELOG.md +7 -0
- package/package.json +5 -4
- package/src/config/dev-server.ts +5 -1
- package/dist/client/StartClient.d.ts +0 -7
- package/dist/client/StartClient.jsx +0 -26
- package/dist/client/index.d.ts +0 -2
- package/dist/client/index.jsx +0 -2
- package/dist/client/mount.d.ts +0 -1
- package/dist/client/mount.js +0 -1
- package/dist/client/spa/index.d.ts +0 -4
- package/dist/client/spa/index.jsx +0 -5
- package/dist/config/constants.d.ts +0 -16
- package/dist/config/constants.js +0 -16
- package/dist/config/dev-server.d.ts +0 -2
- package/dist/config/dev-server.js +0 -126
- package/dist/config/env.d.ts +0 -19
- package/dist/config/env.js +0 -81
- package/dist/config/fs-router.d.ts +0 -37
- package/dist/config/fs-router.js +0 -141
- package/dist/config/fs-routes/fs-watcher.d.ts +0 -3
- package/dist/config/fs-routes/fs-watcher.js +0 -53
- package/dist/config/fs-routes/index.d.ts +0 -7
- package/dist/config/fs-routes/index.js +0 -107
- package/dist/config/fs-routes/router.d.ts +0 -42
- package/dist/config/fs-routes/router.js +0 -148
- package/dist/config/fs-routes/tree-shake.d.ts +0 -2
- package/dist/config/fs-routes/tree-shake.js +0 -305
- package/dist/config/index.d.ts +0 -25
- package/dist/config/index.js +0 -217
- package/dist/config/lazy.d.ts +0 -3
- package/dist/config/lazy.js +0 -114
- package/dist/config/manifest.d.ts +0 -3
- package/dist/config/manifest.js +0 -109
- package/dist/config/utils.d.ts +0 -4
- package/dist/config/utils.js +0 -6
- package/dist/config/vite-utils.d.ts +0 -21
- package/dist/config/vite-utils.js +0 -85
- package/dist/directives/bubble-function-declaration.d.ts +0 -3
- package/dist/directives/bubble-function-declaration.js +0 -23
- package/dist/directives/compile.d.ts +0 -9
- package/dist/directives/compile.js +0 -40
- package/dist/directives/generate-unique-name.d.ts +0 -3
- package/dist/directives/generate-unique-name.js +0 -16
- package/dist/directives/get-descriptive-name.d.ts +0 -2
- package/dist/directives/get-descriptive-name.js +0 -37
- package/dist/directives/get-import-identifier.d.ts +0 -4
- package/dist/directives/get-import-identifier.js +0 -19
- package/dist/directives/get-root-statement-path.d.ts +0 -2
- package/dist/directives/get-root-statement-path.js +0 -12
- package/dist/directives/index.d.ts +0 -14
- package/dist/directives/index.js +0 -170
- package/dist/directives/is-statement-top-level.d.ts +0 -3
- package/dist/directives/is-statement-top-level.js +0 -9
- package/dist/directives/paths.d.ts +0 -9
- package/dist/directives/paths.js +0 -36
- package/dist/directives/plugin.d.ts +0 -21
- package/dist/directives/plugin.js +0 -302
- package/dist/directives/remove-unused-variables.d.ts +0 -3
- package/dist/directives/remove-unused-variables.js +0 -66
- package/dist/directives/types.d.ts +0 -10
- package/dist/directives/types.js +0 -1
- package/dist/directives/xxhash32.d.ts +0 -6
- package/dist/directives/xxhash32.js +0 -193
- package/dist/fns/client.d.ts +0 -3
- package/dist/fns/client.js +0 -106
- package/dist/fns/handler.d.ts +0 -5
- package/dist/fns/handler.js +0 -269
- package/dist/fns/registration.d.ts +0 -2
- package/dist/fns/registration.js +0 -12
- package/dist/fns/serialization.d.ts +0 -6
- package/dist/fns/serialization.js +0 -208
- package/dist/fns/server.d.ts +0 -7
- package/dist/fns/server.js +0 -38
- package/dist/fns/shared.d.ts +0 -17
- package/dist/fns/shared.js +0 -105
- package/dist/http/index.d.ts +0 -81
- package/dist/http/index.js +0 -129
- package/dist/index.d.ts +0 -5
- package/dist/index.jsx +0 -6
- package/dist/middleware/index.d.ts +0 -38
- package/dist/middleware/index.js +0 -59
- package/dist/router.d.ts +0 -6
- package/dist/router.jsx +0 -29
- package/dist/server/StartServer.d.ts +0 -9
- package/dist/server/StartServer.jsx +0 -34
- package/dist/server/assets/PatchVirtualDevStyles.d.ts +0 -4
- package/dist/server/assets/PatchVirtualDevStyles.jsx +0 -28
- package/dist/server/assets/index.d.ts +0 -2
- package/dist/server/assets/index.js +0 -52
- package/dist/server/assets/render.d.ts +0 -19
- package/dist/server/assets/render.jsx +0 -14
- package/dist/server/collect-styles.d.ts +0 -3
- package/dist/server/collect-styles.js +0 -57
- package/dist/server/fetchEvent.d.ts +0 -7
- package/dist/server/fetchEvent.js +0 -26
- package/dist/server/handler.d.ts +0 -64
- package/dist/server/handler.js +0 -222
- package/dist/server/index.d.ts +0 -9
- package/dist/server/index.jsx +0 -14
- package/dist/server/manifest/client-manifest.d.ts +0 -9
- package/dist/server/manifest/client-manifest.js +0 -6
- package/dist/server/manifest/dev-client-manifest.d.ts +0 -4
- package/dist/server/manifest/dev-client-manifest.js +0 -24
- package/dist/server/manifest/dev-ssr-manifest.d.ts +0 -5
- package/dist/server/manifest/dev-ssr-manifest.js +0 -23
- package/dist/server/manifest/prod-client-manifest.d.ts +0 -5
- package/dist/server/manifest/prod-client-manifest.js +0 -26
- package/dist/server/manifest/prod-ssr-manifest.d.ts +0 -6
- package/dist/server/manifest/prod-ssr-manifest.js +0 -85
- package/dist/server/manifest/ssr-manifest.d.ts +0 -4
- package/dist/server/manifest/ssr-manifest.js +0 -6
- package/dist/server/routes.d.ts +0 -23
- package/dist/server/routes.js +0 -74
- package/dist/server/spa/StartServer.d.ts +0 -9
- package/dist/server/spa/StartServer.jsx +0 -25
- package/dist/server/spa/handler.d.ts +0 -36
- package/dist/server/spa/handler.js +0 -20
- package/dist/server/spa/index.d.ts +0 -4
- package/dist/server/spa/index.jsx +0 -5
- package/dist/server/types.d.ts +0 -75
- package/dist/server/types.js +0 -1
- package/dist/server/util.d.ts +0 -2
- package/dist/server/util.js +0 -8
- package/dist/shared/ErrorBoundary.d.ts +0 -3
- package/dist/shared/ErrorBoundary.jsx +0 -36
- package/dist/shared/GET.d.ts +0 -5
- package/dist/shared/GET.js +0 -8
- package/dist/shared/HttpHeader.d.ts +0 -10
- package/dist/shared/HttpHeader.jsx +0 -38
- package/dist/shared/HttpStatusCode.d.ts +0 -9
- package/dist/shared/HttpStatusCode.js +0 -18
- package/dist/shared/clientOnly.d.ts +0 -12
- package/dist/shared/clientOnly.js +0 -27
- package/dist/shared/dev-overlay/CodeView.d.ts +0 -7
- package/dist/shared/dev-overlay/CodeView.jsx +0 -62
- package/dist/shared/dev-overlay/DevOverlayDialog.d.ts +0 -9
- package/dist/shared/dev-overlay/DevOverlayDialog.jsx +0 -226
- package/dist/shared/dev-overlay/createStackFrame.d.ts +0 -9
- package/dist/shared/dev-overlay/createStackFrame.js +0 -56
- package/dist/shared/dev-overlay/download.d.ts +0 -1
- package/dist/shared/dev-overlay/download.js +0 -6
- package/dist/shared/dev-overlay/get-source-map.d.ts +0 -2
- package/dist/shared/dev-overlay/get-source-map.js +0 -25
- package/dist/shared/dev-overlay/icons.d.ts +0 -28
- package/dist/shared/dev-overlay/icons.jsx +0 -150
- package/dist/shared/dev-overlay/index.d.ts +0 -5
- package/dist/shared/dev-overlay/index.jsx +0 -39
- package/dist/shared/dev-overlay/styles.css +0 -292
- package/dist/shared/lazy.d.ts +0 -3
- package/dist/shared/lazy.js +0 -42
- package/dist/shared/serverFunction.d.ts +0 -6
- package/dist/shared/serverFunction.js +0 -8
- package/dist/utils/debounce.d.ts +0 -4
- package/dist/utils/debounce.js +0 -10
package/dist/middleware/index.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// @refresh skip
|
|
2
|
-
import { getFetchEvent } from "../server/fetchEvent.js";
|
|
3
|
-
function wrapRequestMiddleware(onRequest) {
|
|
4
|
-
return async (h3Event) => {
|
|
5
|
-
const fetchEvent = getFetchEvent(h3Event);
|
|
6
|
-
const response = await onRequest(fetchEvent);
|
|
7
|
-
if (response)
|
|
8
|
-
return response;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
function wrapResponseMiddleware(onBeforeResponse) {
|
|
12
|
-
return async (h3Event, next) => {
|
|
13
|
-
const resp = await next();
|
|
14
|
-
const fetchEvent = getFetchEvent(h3Event);
|
|
15
|
-
const mwResponse = await onBeforeResponse(fetchEvent, {
|
|
16
|
-
body: resp,
|
|
17
|
-
});
|
|
18
|
-
if (mwResponse)
|
|
19
|
-
return mwResponse;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Creates middleware for handling requests and responses.
|
|
24
|
-
*
|
|
25
|
-
* @see https://docs.solidjs.com/solid-start/reference/server/create-middleware
|
|
26
|
-
/**
|
|
27
|
-
* Creates request/response middlewares via H3.
|
|
28
|
-
*
|
|
29
|
-
* Accepts an array of H3 {@link Middleware}
|
|
30
|
-
*
|
|
31
|
-
* @tip To run your middleware before response, `await next()` in your function block.
|
|
32
|
-
*@example
|
|
33
|
-
* const middleware = createMiddleware([
|
|
34
|
-
* async (event, next) => {
|
|
35
|
-
* const resp = await next();
|
|
36
|
-
* if (resp instanceof Response) return resp;
|
|
37
|
-
* return new Response("Not found", { status: 404 });
|
|
38
|
-
* },
|
|
39
|
-
* ]);
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
export function createMiddleware(args) {
|
|
43
|
-
if (Array.isArray(args))
|
|
44
|
-
return args;
|
|
45
|
-
const mw = [];
|
|
46
|
-
if (typeof args.onRequest === "function") {
|
|
47
|
-
mw.push(wrapRequestMiddleware(args.onRequest));
|
|
48
|
-
}
|
|
49
|
-
else if (Array.isArray(args.onRequest)) {
|
|
50
|
-
mw.push(...args.onRequest.map(wrapRequestMiddleware));
|
|
51
|
-
}
|
|
52
|
-
if (typeof args.onBeforeResponse === "function") {
|
|
53
|
-
mw.push(wrapResponseMiddleware(args.onBeforeResponse));
|
|
54
|
-
}
|
|
55
|
-
else if (Array.isArray(args.onBeforeResponse)) {
|
|
56
|
-
mw.push(...args.onBeforeResponse.map(wrapResponseMiddleware));
|
|
57
|
-
}
|
|
58
|
-
return mw;
|
|
59
|
-
}
|
package/dist/router.d.ts
DELETED
package/dist/router.jsx
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { lazy } from "solid-js";
|
|
2
|
-
import { getRequestEvent, isServer } from "solid-js/web";
|
|
3
|
-
import { pageRoutes as routeConfigs } from "./server/routes.js";
|
|
4
|
-
const components = {};
|
|
5
|
-
export function createRoutes() {
|
|
6
|
-
function createRoute(route) {
|
|
7
|
-
const component = route.$component && (components[route.$component.src] ??= lazy(route.$component.import));
|
|
8
|
-
return {
|
|
9
|
-
...route,
|
|
10
|
-
...(route.$$route ? route.$$route.require().route : undefined),
|
|
11
|
-
info: {
|
|
12
|
-
...(route.$$route ? route.$$route.require().route.info : {}),
|
|
13
|
-
filesystem: true,
|
|
14
|
-
},
|
|
15
|
-
component,
|
|
16
|
-
children: route.children ? route.children.map(createRoute) : undefined,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
const routes = routeConfigs.map(createRoute);
|
|
20
|
-
return routes;
|
|
21
|
-
}
|
|
22
|
-
let routes;
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* Read more: https://docs.solidjs.com/solid-start/reference/routing/file-routes
|
|
26
|
-
*/
|
|
27
|
-
export const FileRoutes = isServer
|
|
28
|
-
? () => getRequestEvent().routes
|
|
29
|
-
: () => routes || (routes = createRoutes());
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Component } from "solid-js";
|
|
2
|
-
import type { DocumentComponentProps } from "./types.ts";
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* Read more: https://docs.solidjs.com/solid-start/reference/server/start-server
|
|
6
|
-
*/
|
|
7
|
-
export declare function StartServer(props: {
|
|
8
|
-
document: Component<DocumentComponentProps>;
|
|
9
|
-
}): import("solid-js").JSX.Element;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Hydration, HydrationScript, NoHydration, getRequestEvent, ssr } from "solid-js/web";
|
|
2
|
-
import App from "solid-start:app";
|
|
3
|
-
import { ErrorBoundary, TopErrorBoundary } from "../shared/ErrorBoundary.jsx";
|
|
4
|
-
import { useAssets } from "./assets/index.js";
|
|
5
|
-
import PatchVirtualDevStyles from "./assets/PatchVirtualDevStyles.jsx";
|
|
6
|
-
import { getSsrManifest } from "./manifest/ssr-manifest.js";
|
|
7
|
-
const docType = ssr("<!DOCTYPE html>");
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* Read more: https://docs.solidjs.com/solid-start/reference/server/start-server
|
|
11
|
-
*/
|
|
12
|
-
export function StartServer(props) {
|
|
13
|
-
const context = getRequestEvent();
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
const nonce = context.nonce;
|
|
16
|
-
useAssets(context.assets, nonce);
|
|
17
|
-
return (<NoHydration>
|
|
18
|
-
{docType}
|
|
19
|
-
<TopErrorBoundary>
|
|
20
|
-
<props.document assets={<HydrationScript />} scripts={<>
|
|
21
|
-
<PatchVirtualDevStyles nonce={nonce}/>
|
|
22
|
-
<script type="module" nonce={nonce} async src={getSsrManifest("client").path(import.meta.env.START_CLIENT_ENTRY)}/>
|
|
23
|
-
</>}>
|
|
24
|
-
{!import.meta.env.START_ISLANDS ? (<Hydration>
|
|
25
|
-
<ErrorBoundary>
|
|
26
|
-
<App />
|
|
27
|
-
</ErrorBoundary>
|
|
28
|
-
</Hydration>) : (<ErrorBoundary>
|
|
29
|
-
<App />
|
|
30
|
-
</ErrorBoundary>)}
|
|
31
|
-
</props.document>
|
|
32
|
-
</TopErrorBoundary>
|
|
33
|
-
</NoHydration>);
|
|
34
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Patches the data-vite-dev-id attribute for style tags of virtual modules
|
|
3
|
-
*
|
|
4
|
-
* Per Vite's convention, virtual module ids are prefixed with \0 (null byte):
|
|
5
|
-
* https://vite.dev/guide/api-plugin#virtual-modules-convention
|
|
6
|
-
*
|
|
7
|
-
* However this null byte cannot be server rendered properly.
|
|
8
|
-
* Vite client runtime then fails to find style's with wrong null bytes,
|
|
9
|
-
* and instead inserts duplicate style's.
|
|
10
|
-
*
|
|
11
|
-
* This patch replaces the serializable /@id/__x00__ with the proper null byte,
|
|
12
|
-
* and has to run before Vite's client runtime:
|
|
13
|
-
* https://github.com/vitejs/vite/blob/130e7181a55c524383c63bbfb1749d0ff7185cad/packages/vite/src/client/client.ts#L529
|
|
14
|
-
*
|
|
15
|
-
* TODO: This should be solved in Vite directly!
|
|
16
|
-
*/
|
|
17
|
-
const patch = function () {
|
|
18
|
-
document.querySelectorAll("style[data-vite-dev-id]").forEach(function (el) {
|
|
19
|
-
el.setAttribute("data-vite-dev-id", el.dataset.viteDevId.replace("/@id/__x00__", "\0"));
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
const serializedPatch = `(${patch.toString()})();`;
|
|
23
|
-
const PatchVirtualDevStyles = (props) => {
|
|
24
|
-
if (!import.meta.env.PROD) {
|
|
25
|
-
return <script nonce={props.nonce} innerHTML={serializedPatch}/>;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
export default PatchVirtualDevStyles;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { onCleanup, sharedConfig } from "solid-js";
|
|
2
|
-
import { getRequestEvent, useAssets as useAssets_ } from "solid-js/web";
|
|
3
|
-
import { renderAsset } from "./render.jsx";
|
|
4
|
-
const REGISTRY = Symbol("assetRegistry");
|
|
5
|
-
const NOOP = () => "";
|
|
6
|
-
const keyAttrs = ["href", "rel", "data-vite-dev-id"];
|
|
7
|
-
const getEntity = (registry, asset) => {
|
|
8
|
-
let key = asset.tag;
|
|
9
|
-
for (const k of keyAttrs) {
|
|
10
|
-
if (!(k in asset.attrs))
|
|
11
|
-
continue;
|
|
12
|
-
key += `[${k}='${asset.attrs[k]}']`;
|
|
13
|
-
}
|
|
14
|
-
const entity = (registry[key] ??= {
|
|
15
|
-
key,
|
|
16
|
-
consumers: 0,
|
|
17
|
-
});
|
|
18
|
-
return entity;
|
|
19
|
-
};
|
|
20
|
-
export const useAssets = (assets, nonce) => {
|
|
21
|
-
if (!assets.length)
|
|
22
|
-
return;
|
|
23
|
-
const registry = (getRequestEvent().locals[REGISTRY] ??= {});
|
|
24
|
-
const ssrRequestAssets = sharedConfig.context?.assets;
|
|
25
|
-
const cssKeys = [];
|
|
26
|
-
for (const asset of assets) {
|
|
27
|
-
const entity = getEntity(registry, asset);
|
|
28
|
-
const isCSSLink = asset.tag === "link" && asset.attrs.rel === "stylesheet";
|
|
29
|
-
const isCSS = isCSSLink || asset.tag === "style";
|
|
30
|
-
if (isCSS) {
|
|
31
|
-
cssKeys.push(entity.key);
|
|
32
|
-
}
|
|
33
|
-
entity.consumers++;
|
|
34
|
-
if (entity.consumers > 1)
|
|
35
|
-
continue;
|
|
36
|
-
// Mounting logic
|
|
37
|
-
useAssets_(() => renderAsset(asset, nonce));
|
|
38
|
-
entity.ssrIdx = ssrRequestAssets.length - 1;
|
|
39
|
-
}
|
|
40
|
-
onCleanup(() => {
|
|
41
|
-
for (const key of cssKeys) {
|
|
42
|
-
const entity = registry[key];
|
|
43
|
-
entity.consumers--;
|
|
44
|
-
if (entity.consumers != 0) {
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
// Ideally this logic should be implemented directly in dom-expressions
|
|
48
|
-
ssrRequestAssets.splice(entity.ssrIdx, 1, NOOP);
|
|
49
|
-
delete registry[key];
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { JSX } from "solid-js";
|
|
2
|
-
export declare function renderAsset(asset: Asset, nonce?: string): any;
|
|
3
|
-
export type Asset = {
|
|
4
|
-
tag: "style";
|
|
5
|
-
attrs: JSX.StyleHTMLAttributes<HTMLStyleElement> & {
|
|
6
|
-
key?: string;
|
|
7
|
-
};
|
|
8
|
-
children?: JSX.Element;
|
|
9
|
-
} | {
|
|
10
|
-
tag: "script";
|
|
11
|
-
attrs: JSX.ScriptHTMLAttributes<HTMLScriptElement> & {
|
|
12
|
-
key?: string;
|
|
13
|
-
};
|
|
14
|
-
} | {
|
|
15
|
-
tag: "link";
|
|
16
|
-
attrs: JSX.LinkHTMLAttributes<HTMLLinkElement> & {
|
|
17
|
-
key?: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const assetMap = {
|
|
2
|
-
style: (props) => (<style {...props.attrs}>{props.children}</style>),
|
|
3
|
-
link: (props) => <link {...props.attrs}/>,
|
|
4
|
-
script: (props) => {
|
|
5
|
-
return props.attrs.src ? (<script {...props.attrs} id={props.key}>
|
|
6
|
-
{" "}
|
|
7
|
-
</script>) : null;
|
|
8
|
-
},
|
|
9
|
-
noscript: (props) => (<noscript {...props.attrs}>{props.children}</noscript>),
|
|
10
|
-
};
|
|
11
|
-
export function renderAsset(asset, nonce) {
|
|
12
|
-
let { tag, attrs: { key, ...attrs } = { key: undefined }, children, } = asset;
|
|
13
|
-
return assetMap[tag]({ attrs: { ...attrs, nonce }, key, children });
|
|
14
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
async function getViteModuleNode(vite, file, importer) {
|
|
3
|
-
try {
|
|
4
|
-
const res = await vite.fetchModule(file, importer);
|
|
5
|
-
if (!("id" in res))
|
|
6
|
-
return;
|
|
7
|
-
return vite.moduleGraph.getModuleById(res.id);
|
|
8
|
-
}
|
|
9
|
-
catch (err) { }
|
|
10
|
-
}
|
|
11
|
-
async function findModuleDependencies(vite, file, deps, crawledFiles = new Set(), importer) {
|
|
12
|
-
crawledFiles.add(file);
|
|
13
|
-
const module = await getViteModuleNode(vite, file, importer);
|
|
14
|
-
if (!module?.id || deps.has(module))
|
|
15
|
-
return;
|
|
16
|
-
deps.add(module);
|
|
17
|
-
if (module.url.endsWith(".css") || module.url.includes("node_modules"))
|
|
18
|
-
return;
|
|
19
|
-
if (!module.transformResult) {
|
|
20
|
-
await vite.transformRequest(module.id).catch(() => { });
|
|
21
|
-
}
|
|
22
|
-
if (!module.transformResult?.deps)
|
|
23
|
-
return;
|
|
24
|
-
// Relying on module.transformResult.deps instead of module.importedModules because:
|
|
25
|
-
// transformResult properly separates imports into deps and dynamicDeps, importedModules doesn't
|
|
26
|
-
// Style crawling has to skip dynamic imports as such modules load their styles themselves
|
|
27
|
-
for (const dep of module.transformResult.deps) {
|
|
28
|
-
if (crawledFiles.has(dep)) {
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
await findModuleDependencies(vite, dep, deps, crawledFiles, module.id);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// Vite doesn't expose these so we just copy the list for now
|
|
35
|
-
// https://github.com/vitejs/vite/blob/d6bde8b03d433778aaed62afc2be0630c8131908/packages/vite/src/node/constants.ts#L49C23-L50
|
|
36
|
-
const cssFileRegExp = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)$/;
|
|
37
|
-
// https://github.com/vitejs/vite/blob/d6bde8b03d433778aaed62afc2be0630c8131908/packages/vite/src/node/plugins/css.ts#L160
|
|
38
|
-
const cssModulesRegExp = new RegExp(`\\.module${cssFileRegExp.source}`);
|
|
39
|
-
const isCssFile = (file) => cssFileRegExp.test(file);
|
|
40
|
-
export const isCssModulesFile = (file) => cssModulesRegExp.test(file);
|
|
41
|
-
export async function findStylesInModuleGraph(vite, id) {
|
|
42
|
-
const absolute = path.resolve(process.cwd(), id);
|
|
43
|
-
const dependencies = new Set();
|
|
44
|
-
try {
|
|
45
|
-
await findModuleDependencies(vite, absolute, dependencies);
|
|
46
|
-
}
|
|
47
|
-
catch (e) {
|
|
48
|
-
console.error(e);
|
|
49
|
-
}
|
|
50
|
-
const styles = {};
|
|
51
|
-
for (const dep of dependencies) {
|
|
52
|
-
if (dep.id && isCssFile(dep.url)) {
|
|
53
|
-
styles[dep.id] = dep.url;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return styles;
|
|
57
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type EventHandler, type H3Event, type Middleware } from "h3";
|
|
2
|
-
import type { FetchEvent } from "./types.ts";
|
|
3
|
-
export declare function createFetchEvent(event: H3Event): FetchEvent;
|
|
4
|
-
export declare function getFetchEvent(h3Event: H3Event): FetchEvent;
|
|
5
|
-
export declare function mergeResponseHeaders(h3Event: H3Event, headers: Headers): void;
|
|
6
|
-
export declare const decorateHandler: <T extends EventHandler>(fn: T) => T;
|
|
7
|
-
export declare const decorateMiddleware: <T extends Middleware>(fn: T) => T;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { getRequestIP } from "h3";
|
|
2
|
-
import { provideRequestEvent } from "solid-js/web/storage";
|
|
3
|
-
const FETCH_EVENT_CONTEXT = "solidFetchEvent";
|
|
4
|
-
export function createFetchEvent(event) {
|
|
5
|
-
return {
|
|
6
|
-
request: event.req,
|
|
7
|
-
response: event.res,
|
|
8
|
-
clientAddress: getRequestIP(event),
|
|
9
|
-
locals: {},
|
|
10
|
-
nativeEvent: event,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export function getFetchEvent(h3Event) {
|
|
14
|
-
if (!h3Event.context[FETCH_EVENT_CONTEXT]) {
|
|
15
|
-
const fetchEvent = createFetchEvent(h3Event);
|
|
16
|
-
h3Event.context[FETCH_EVENT_CONTEXT] = fetchEvent;
|
|
17
|
-
}
|
|
18
|
-
return h3Event.context[FETCH_EVENT_CONTEXT];
|
|
19
|
-
}
|
|
20
|
-
export function mergeResponseHeaders(h3Event, headers) {
|
|
21
|
-
for (const [key, value] of headers.entries()) {
|
|
22
|
-
h3Event.res.headers.append(key, value);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export const decorateHandler = (fn) => (event => provideRequestEvent(getFetchEvent(event), () => fn(event)));
|
|
26
|
-
export const decorateMiddleware = (fn) => ((event, next) => provideRequestEvent(getFetchEvent(event), () => fn(event, next)));
|
package/dist/server/handler.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { type H3Event } from "h3/generic";
|
|
2
|
-
import type { JSX } from "solid-js";
|
|
3
|
-
import type { FetchEvent, HandlerOptions, PageEvent } from "./types.ts";
|
|
4
|
-
export declare function createBaseHandler(createPageEvent: (e: FetchEvent) => Promise<PageEvent>, fn: (context: PageEvent) => JSX.Element, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions | Promise<HandlerOptions>)): {
|
|
5
|
-
"~rou3": import("h3").RouterContext;
|
|
6
|
-
request(request: import("srvx").ServerRequest | URL | string, options?: RequestInit, context?: import("h3").H3EventContext): Response | Promise<Response>;
|
|
7
|
-
use(route: string, handler: import("h3").Middleware, opts?: import("h3").MiddlewareOptions): /*elided*/ any;
|
|
8
|
-
use(handler: import("h3").Middleware, opts?: import("h3").MiddlewareOptions): /*elided*/ any;
|
|
9
|
-
on(method: import("h3").HTTPMethod | Lowercase<import("h3").HTTPMethod> | "", route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
10
|
-
register(plugin: import("h3").H3Plugin): /*elided*/ any;
|
|
11
|
-
mount(base: string, input: import("srvx").FetchHandler | {
|
|
12
|
-
fetch: import("srvx").FetchHandler;
|
|
13
|
-
} | /*elided*/ any): /*elided*/ any;
|
|
14
|
-
all(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
15
|
-
get(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
16
|
-
post(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
17
|
-
put(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
18
|
-
delete(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
19
|
-
patch(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
20
|
-
head(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
21
|
-
options(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
22
|
-
connect(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
23
|
-
trace(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
24
|
-
readonly config: import("h3").H3Config;
|
|
25
|
-
"~middleware": import("h3").Middleware[];
|
|
26
|
-
"~routes": import("h3").H3Route[];
|
|
27
|
-
fetch(_request: import("srvx").ServerRequest): Response | Promise<Response>;
|
|
28
|
-
handler(event: H3Event): unknown | Promise<unknown>;
|
|
29
|
-
"~request"(request: import("srvx").ServerRequest, context?: import("h3").H3EventContext): Response | Promise<Response>;
|
|
30
|
-
"~findRoute"(_event: H3Event): import("h3").MatchedRoute<import("h3").H3Route> | void;
|
|
31
|
-
"~getMiddleware"(event: H3Event, route: import("h3").MatchedRoute<import("h3").H3Route> | undefined): import("h3").Middleware[];
|
|
32
|
-
"~addRoute"(_route: import("h3").H3Route): void;
|
|
33
|
-
};
|
|
34
|
-
export declare function createHandler(fn: (context: PageEvent) => JSX.Element, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions | Promise<HandlerOptions>)): {
|
|
35
|
-
"~rou3": import("h3").RouterContext;
|
|
36
|
-
request(request: import("srvx").ServerRequest | URL | string, options?: RequestInit, context?: import("h3").H3EventContext): Response | Promise<Response>;
|
|
37
|
-
use(route: string, handler: import("h3").Middleware, opts?: import("h3").MiddlewareOptions): /*elided*/ any;
|
|
38
|
-
use(handler: import("h3").Middleware, opts?: import("h3").MiddlewareOptions): /*elided*/ any;
|
|
39
|
-
on(method: import("h3").HTTPMethod | Lowercase<import("h3").HTTPMethod> | "", route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
40
|
-
register(plugin: import("h3").H3Plugin): /*elided*/ any;
|
|
41
|
-
mount(base: string, input: import("srvx").FetchHandler | {
|
|
42
|
-
fetch: import("srvx").FetchHandler;
|
|
43
|
-
} | /*elided*/ any): /*elided*/ any;
|
|
44
|
-
all(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
45
|
-
get(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
46
|
-
post(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
47
|
-
put(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
48
|
-
delete(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
49
|
-
patch(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
50
|
-
head(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
51
|
-
options(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
52
|
-
connect(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
53
|
-
trace(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
|
|
54
|
-
readonly config: import("h3").H3Config;
|
|
55
|
-
"~middleware": import("h3").Middleware[];
|
|
56
|
-
"~routes": import("h3").H3Route[];
|
|
57
|
-
fetch(_request: import("srvx").ServerRequest): Response | Promise<Response>;
|
|
58
|
-
handler(event: H3Event): unknown | Promise<unknown>;
|
|
59
|
-
"~request"(request: import("srvx").ServerRequest, context?: import("h3").H3EventContext): Response | Promise<Response>;
|
|
60
|
-
"~findRoute"(_event: H3Event): import("h3").MatchedRoute<import("h3").H3Route> | void;
|
|
61
|
-
"~getMiddleware"(event: H3Event, route: import("h3").MatchedRoute<import("h3").H3Route> | undefined): import("h3").Middleware[];
|
|
62
|
-
"~addRoute"(_route: import("h3").H3Route): void;
|
|
63
|
-
};
|
|
64
|
-
export declare function createPageEvent(ctx: FetchEvent): Promise<PageEvent>;
|
package/dist/server/handler.js
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import middleware from "solid-start:middleware";
|
|
2
|
-
import { defineHandler, getCookie, H3, redirect, setCookie } from "h3/generic";
|
|
3
|
-
import { sharedConfig } from "solid-js";
|
|
4
|
-
import { getRequestEvent, renderToStream, renderToString } from "solid-js/web";
|
|
5
|
-
import { createRoutes } from "../router.jsx";
|
|
6
|
-
import { decorateHandler, decorateMiddleware } from "./fetchEvent.js";
|
|
7
|
-
import { getSsrManifest } from "./manifest/ssr-manifest.js";
|
|
8
|
-
import { matchAPIRoute } from "./routes.js";
|
|
9
|
-
import { handleServerFunction } from "../fns/handler.js";
|
|
10
|
-
import { getExpectedRedirectStatus } from "./util.js";
|
|
11
|
-
const SERVER_FN_BASE = "/_server";
|
|
12
|
-
export function createBaseHandler(createPageEvent, fn, options = {}) {
|
|
13
|
-
const handler = defineHandler({
|
|
14
|
-
middleware: middleware.length ? middleware.map(decorateMiddleware) : undefined,
|
|
15
|
-
handler: decorateHandler(async (e) => {
|
|
16
|
-
const event = getRequestEvent();
|
|
17
|
-
const url = new URL(event.request.url);
|
|
18
|
-
const pathname = stripBaseUrl(url.pathname);
|
|
19
|
-
if (pathname.startsWith(SERVER_FN_BASE)) {
|
|
20
|
-
const serverFnResponse = await handleServerFunction(e);
|
|
21
|
-
if (serverFnResponse instanceof Response)
|
|
22
|
-
return produceResponseWithEventHeaders(serverFnResponse);
|
|
23
|
-
return new Response(serverFnResponse, {
|
|
24
|
-
headers: e.res.headers,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
const match = matchAPIRoute(pathname, event.request.method);
|
|
28
|
-
if (match) {
|
|
29
|
-
const mod = await match.handler.import();
|
|
30
|
-
const fn = event.request.method === "HEAD" ? mod["HEAD"] || mod["GET"] : mod[event.request.method];
|
|
31
|
-
if (typeof fn === "function") {
|
|
32
|
-
event.params = match.params || {};
|
|
33
|
-
// @ts-expect-error
|
|
34
|
-
sharedConfig.context = { event };
|
|
35
|
-
const res = await fn(event);
|
|
36
|
-
if (res !== undefined) {
|
|
37
|
-
if (res instanceof Response)
|
|
38
|
-
return produceResponseWithEventHeaders(res);
|
|
39
|
-
return res;
|
|
40
|
-
}
|
|
41
|
-
if (event.request.method !== "GET") {
|
|
42
|
-
throw new Error(`API handler for ${event.request.method} "${event.request.url}" did not return a response.`);
|
|
43
|
-
}
|
|
44
|
-
if (!match.isPage)
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const context = await createPageEvent(event);
|
|
49
|
-
const resolvedOptions = typeof options === "function" ? await options(context) : { ...options };
|
|
50
|
-
const mode = resolvedOptions.mode || "stream";
|
|
51
|
-
if (resolvedOptions.nonce)
|
|
52
|
-
context.nonce = resolvedOptions.nonce;
|
|
53
|
-
if (mode === "sync" || !import.meta.env.START_SSR) {
|
|
54
|
-
const html = renderToString(() => {
|
|
55
|
-
sharedConfig.context.event = context;
|
|
56
|
-
return fn(context);
|
|
57
|
-
}, resolvedOptions);
|
|
58
|
-
context.complete = true;
|
|
59
|
-
if (context.response && context.response.headers.get("Location")) {
|
|
60
|
-
const status = getExpectedRedirectStatus(context.response);
|
|
61
|
-
return redirect(context.response.headers.get("Location"), status);
|
|
62
|
-
}
|
|
63
|
-
event.response.headers.set("content-type", "text/html");
|
|
64
|
-
return html;
|
|
65
|
-
}
|
|
66
|
-
if (resolvedOptions.onCompleteAll) {
|
|
67
|
-
const og = resolvedOptions.onCompleteAll;
|
|
68
|
-
resolvedOptions.onCompleteAll = options => {
|
|
69
|
-
handleStreamCompleteRedirect(context)(options);
|
|
70
|
-
og(options);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
else
|
|
74
|
-
resolvedOptions.onCompleteAll = handleStreamCompleteRedirect(context);
|
|
75
|
-
if (resolvedOptions.onCompleteShell) {
|
|
76
|
-
const og = resolvedOptions.onCompleteShell;
|
|
77
|
-
resolvedOptions.onCompleteShell = options => {
|
|
78
|
-
handleShellCompleteRedirect(context, e)();
|
|
79
|
-
og(options);
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
else
|
|
83
|
-
resolvedOptions.onCompleteShell = handleShellCompleteRedirect(context, e);
|
|
84
|
-
const _stream = renderToStream(() => {
|
|
85
|
-
sharedConfig.context.event = context;
|
|
86
|
-
return fn(context);
|
|
87
|
-
}, resolvedOptions);
|
|
88
|
-
const stream = _stream; // stream has a hidden 'then' method
|
|
89
|
-
if (context.response && context.response.headers.get("Location")) {
|
|
90
|
-
const status = getExpectedRedirectStatus(context.response);
|
|
91
|
-
return redirect(context.response.headers.get("Location"), status);
|
|
92
|
-
}
|
|
93
|
-
if (mode === "async")
|
|
94
|
-
return await stream;
|
|
95
|
-
delete stream.then;
|
|
96
|
-
// using TransformStream in dev can cause solid-start-dev-server to crash
|
|
97
|
-
// when stream is cancelled
|
|
98
|
-
if (globalThis.USING_SOLID_START_DEV_SERVER)
|
|
99
|
-
return stream;
|
|
100
|
-
// returning stream directly breaks cloudflare workers
|
|
101
|
-
const { writable, readable } = new TransformStream();
|
|
102
|
-
stream.pipeTo(writable);
|
|
103
|
-
return readable;
|
|
104
|
-
}),
|
|
105
|
-
});
|
|
106
|
-
const app = new H3();
|
|
107
|
-
app.use(handler);
|
|
108
|
-
return app;
|
|
109
|
-
}
|
|
110
|
-
export function createHandler(fn, options = {}) {
|
|
111
|
-
return createBaseHandler(createPageEvent, fn, options);
|
|
112
|
-
}
|
|
113
|
-
export async function createPageEvent(ctx) {
|
|
114
|
-
ctx.response.headers.set("Content-Type", "text/html");
|
|
115
|
-
// const prevPath = ctx.request.headers.get("x-solid-referrer");
|
|
116
|
-
// const mutation = ctx.request.headers.get("x-solid-mutation") === "true";
|
|
117
|
-
const manifest = getSsrManifest(import.meta.env.SSR && import.meta.env.DEV ? "ssr" : "client");
|
|
118
|
-
// Handle Vite build.cssCodeSplit
|
|
119
|
-
// When build.cssCodeSplit is false, a single CSS file is generated with the key style.css
|
|
120
|
-
const mergedCSS = import.meta.env.PROD ? await manifest.getAssets("style.css") : [];
|
|
121
|
-
const assets = [
|
|
122
|
-
...mergedCSS,
|
|
123
|
-
...(await manifest.getAssets(import.meta.env.START_CLIENT_ENTRY)),
|
|
124
|
-
...(await manifest.getAssets(import.meta.env.START_APP_ENTRY)),
|
|
125
|
-
// ...(import.meta.env.START_ISLANDS
|
|
126
|
-
// ? (await serverManifest.inputs[serverManifest.handler]!.assets()).filter(
|
|
127
|
-
// s => (s as any).attrs.rel !== "modulepreload"
|
|
128
|
-
// )
|
|
129
|
-
// : [])
|
|
130
|
-
];
|
|
131
|
-
const pageEvent = Object.assign(ctx, {
|
|
132
|
-
assets,
|
|
133
|
-
router: {
|
|
134
|
-
submission: initFromFlash(ctx),
|
|
135
|
-
},
|
|
136
|
-
routes: createRoutes(),
|
|
137
|
-
// prevUrl: prevPath || "",
|
|
138
|
-
// mutation: mutation,
|
|
139
|
-
// $type: FETCH_EVENT,
|
|
140
|
-
complete: false,
|
|
141
|
-
$islands: new Set(),
|
|
142
|
-
});
|
|
143
|
-
return pageEvent;
|
|
144
|
-
}
|
|
145
|
-
function initFromFlash(ctx) {
|
|
146
|
-
const flash = getCookie(ctx.nativeEvent, "flash");
|
|
147
|
-
if (!flash)
|
|
148
|
-
return;
|
|
149
|
-
try {
|
|
150
|
-
const param = JSON.parse(flash);
|
|
151
|
-
if (!param || !param.result)
|
|
152
|
-
return;
|
|
153
|
-
const input = [...param.input.slice(0, -1), new Map(param.input[param.input.length - 1])];
|
|
154
|
-
const result = param.error ? new Error(param.result) : param.result;
|
|
155
|
-
return {
|
|
156
|
-
input,
|
|
157
|
-
url: param.url,
|
|
158
|
-
pending: false,
|
|
159
|
-
result: param.thrown ? undefined : result,
|
|
160
|
-
error: param.thrown ? result : undefined,
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
catch (e) {
|
|
164
|
-
console.error(e);
|
|
165
|
-
}
|
|
166
|
-
finally {
|
|
167
|
-
setCookie(ctx.nativeEvent, "flash", "", { maxAge: 0 });
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function handleShellCompleteRedirect(context, e) {
|
|
171
|
-
return () => {
|
|
172
|
-
if (context.response && context.response.headers.get("Location")) {
|
|
173
|
-
const status = getExpectedRedirectStatus(context.response);
|
|
174
|
-
e.res.status = status;
|
|
175
|
-
e.res.headers.set("Location", context.response.headers.get("Location"));
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
function handleStreamCompleteRedirect(context) {
|
|
180
|
-
return ({ write }) => {
|
|
181
|
-
context.complete = true;
|
|
182
|
-
const to = context.response && context.response.headers.get("Location");
|
|
183
|
-
to && write(`<script>window.location=${JSON.stringify(to).replace(/</g, "\\u003c")}</script>`);
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
function produceResponseWithEventHeaders(res) {
|
|
187
|
-
const event = getRequestEvent();
|
|
188
|
-
let ret = res;
|
|
189
|
-
// Response.redirect returns an immutable value, so we clone on any redirect just in case
|
|
190
|
-
if (300 <= res.status && res.status < 400) {
|
|
191
|
-
const cookies = res.headers.getSetCookie?.() ?? [];
|
|
192
|
-
const headers = new Headers();
|
|
193
|
-
res.headers.forEach((value, key) => {
|
|
194
|
-
if (key.toLowerCase() !== "set-cookie") {
|
|
195
|
-
headers.set(key, value);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
for (const cookie of cookies) {
|
|
199
|
-
headers.append("Set-Cookie", cookie);
|
|
200
|
-
}
|
|
201
|
-
ret = new Response(res.body, {
|
|
202
|
-
status: res.status,
|
|
203
|
-
statusText: res.statusText,
|
|
204
|
-
headers,
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
const eventCookies = event.response.headers.getSetCookie?.() ?? [];
|
|
208
|
-
for (const cookie of eventCookies) {
|
|
209
|
-
ret.headers.append("Set-Cookie", cookie);
|
|
210
|
-
}
|
|
211
|
-
for (const [name, value] of event.response.headers) {
|
|
212
|
-
if (name.toLowerCase() !== "set-cookie") {
|
|
213
|
-
ret.headers.set(name, value);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
return ret;
|
|
217
|
-
}
|
|
218
|
-
function stripBaseUrl(path) {
|
|
219
|
-
if (import.meta.env.BASE_URL === "/" || import.meta.env.BASE_URL === "")
|
|
220
|
-
return path;
|
|
221
|
-
return path.slice(import.meta.env.BASE_URL.length);
|
|
222
|
-
}
|