@gracile/engine 0.0.4-next.3 → 0.0.4-next.35
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/ambient.d.ts +6 -0
- package/dist/assertions.d.ts +1 -1
- package/dist/assertions.d.ts.map +1 -1
- package/dist/build/static.d.ts +11 -2
- package/dist/build/static.d.ts.map +1 -1
- package/dist/build/static.js +29 -16
- package/dist/dev/dev.d.ts +5 -2
- package/dist/dev/dev.d.ts.map +1 -1
- package/dist/dev/dev.js +14 -7
- package/dist/dev/server.d.ts +22 -2
- package/dist/dev/server.d.ts.map +1 -1
- package/dist/dev/server.js +51 -23
- package/dist/preview.d.ts +1 -1
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +3 -0
- package/dist/render/route-template.d.ts +15 -4
- package/dist/render/route-template.d.ts.map +1 -1
- package/dist/render/route-template.js +45 -15
- package/dist/render/utils.d.ts.map +1 -0
- package/dist/routes/collect.d.ts +2 -3
- package/dist/routes/collect.d.ts.map +1 -1
- package/dist/routes/collect.js +4 -1
- package/dist/routes/load-module.d.ts +5 -1
- package/dist/routes/load-module.d.ts.map +1 -1
- package/dist/routes/load-module.js +13 -4
- package/dist/routes/match.d.ts +4 -2
- package/dist/routes/match.d.ts.map +1 -1
- package/dist/routes/match.js +9 -6
- package/dist/routes/route.d.ts +7 -1
- package/dist/routes/route.d.ts.map +1 -1
- package/dist/routes/route.js +6 -1
- package/dist/server/env.d.ts +5 -0
- package/dist/server/env.d.ts.map +1 -0
- package/dist/server/env.js +6 -0
- package/dist/server/request.d.ts +21 -0
- package/dist/server/request.d.ts.map +1 -0
- package/dist/{dev → server}/request.js +59 -26
- package/dist/server/server.d.ts +4 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/server.js +25 -0
- package/dist/server/utils.d.ts +4 -0
- package/dist/server/utils.d.ts.map +1 -0
- package/dist/server/utils.js +21 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/user-config.d.ts +11 -0
- package/dist/user-config.d.ts.map +1 -1
- package/dist/user-config.js +9 -0
- package/dist/vite/build.d.ts.map +1 -1
- package/dist/vite/build.js +82 -7
- package/dist/vite/config.d.ts +2 -0
- package/dist/vite/config.d.ts.map +1 -1
- package/dist/vite/config.js +11 -1
- package/dist/vite/plugins/build-routes.d.ts +28 -0
- package/dist/vite/plugins/build-routes.d.ts.map +1 -0
- package/dist/vite/plugins/build-routes.js +98 -0
- package/dist/vite/plugins/virtual-routes.d.ts +11 -0
- package/dist/vite/plugins/virtual-routes.d.ts.map +1 -0
- package/dist/vite/plugins/virtual-routes.js +42 -0
- package/dist/vite/server.d.ts +4 -1
- package/dist/vite/server.d.ts.map +1 -1
- package/dist/vite/server.js +5 -3
- package/package.json +11 -12
- package/dist/dev/request.d.ts +0 -4
- package/dist/dev/request.d.ts.map +0 -1
- package/dist/vite/plugins/html-static-pages.d.ts +0 -13
- package/dist/vite/plugins/html-static-pages.d.ts.map +0 -1
- package/dist/vite/plugins/html-static-pages.js +0 -58
- package/dist/vite/utils.d.ts.map +0 -1
- /package/dist/{vite → render}/utils.d.ts +0 -0
- /package/dist/{vite → render}/utils.js +0 -0
package/ambient.d.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
declare module 'gracile:routes' {
|
|
4
|
+
export const routes: import('./src/routes/route.js').RoutesManifest;
|
|
5
|
+
export const routeImports: import('./src/routes/route.js').RoutesImports;
|
|
6
|
+
export const routeAssets: import('./src/routes/route.js').RoutesAssets;
|
|
7
|
+
}
|
package/dist/assertions.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type UnknownObject = Record<string, unknown>;
|
|
|
6
6
|
* Avoid this for well typed sources.
|
|
7
7
|
*/
|
|
8
8
|
export declare function isUnknownObject(input: unknown): input is UnknownObject;
|
|
9
|
-
export declare function isLitTemplate(input: unknown): input is TemplateResult<1
|
|
9
|
+
export declare function isLitTemplate(input: unknown): input is TemplateResult<1> | ServerRenderedTemplate;
|
|
10
10
|
export declare function isLitNormalTemplate(input: unknown): input is TemplateResult<1>;
|
|
11
11
|
export declare function isLitServerTemplate(input: unknown): input is ServerRenderedTemplate;
|
|
12
12
|
//# sourceMappingURL=assertions.d.ts.map
|
package/dist/assertions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../src/assertions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAE1C,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED,wBAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../src/assertions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAE1C,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED,wBAAgB,aAAa,CAC5B,KAAK,EAAE,OAAO,GACZ,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAWrD;AAED,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,OAAO,GACZ,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC,CAE5B;AAED,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,OAAO,GACZ,KAAK,IAAI,sBAAsB,CAOjC"}
|
package/dist/build/static.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import type { ViteDevServer } from 'vite';
|
|
2
|
-
export interface
|
|
2
|
+
export interface RenderedRouteDefinition {
|
|
3
3
|
absoluteId: string;
|
|
4
4
|
name: string;
|
|
5
5
|
html: string;
|
|
6
|
+
handlerAssets?: string;
|
|
7
|
+
savePrerender: boolean | null;
|
|
6
8
|
}
|
|
7
|
-
export declare function renderRoutes(vite
|
|
9
|
+
export declare function renderRoutes({ vite, serverMode, root, }: {
|
|
10
|
+
vite: ViteDevServer;
|
|
11
|
+
serverMode: boolean;
|
|
12
|
+
root?: string;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
routes: import("../routes/route.js").RoutesManifest;
|
|
15
|
+
renderedRoutes: RenderedRouteDefinition[];
|
|
16
|
+
}>;
|
|
8
17
|
//# sourceMappingURL=static.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../../src/build/static.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAM1C,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../../src/build/static.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAM1C,MAAM,WAAW,uBAAuB;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IAEb,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,aAAa,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B;AAeD,wBAAsB,YAAY,CAAC,EAClC,IAAI,EACJ,UAAU,EACV,IAAoB,GACpB,EAAE;IACF,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;;;GAmHA"}
|
package/dist/build/static.js
CHANGED
|
@@ -3,7 +3,7 @@ import path, { join } from 'node:path';
|
|
|
3
3
|
import { logger } from '@gracile/internal-utils/logger';
|
|
4
4
|
import c from 'picocolors';
|
|
5
5
|
import { renderRouteTemplate } from '../render/route-template.js';
|
|
6
|
-
import { collectRoutes
|
|
6
|
+
import { collectRoutes } from '../routes/collect.js';
|
|
7
7
|
import { loadForeignRouteObject } from '../routes/load-module.js';
|
|
8
8
|
async function streamToString(stream) {
|
|
9
9
|
const chunks = [];
|
|
@@ -17,15 +17,17 @@ async function streamToString(stream) {
|
|
|
17
17
|
}
|
|
18
18
|
return Buffer.concat(chunks).toString('utf-8');
|
|
19
19
|
}
|
|
20
|
-
export async function renderRoutes(vite, root = process.cwd()) {
|
|
20
|
+
export async function renderRoutes({ vite, serverMode, root = process.cwd(), }) {
|
|
21
21
|
logger.info(c.green('Rendering routes…'), { timestamp: true });
|
|
22
22
|
// MARK: Collect
|
|
23
|
-
await collectRoutes(root /* vite */);
|
|
24
|
-
logger.info(c.green('Rendering routes finished'), { timestamp: true });
|
|
23
|
+
const routes = await collectRoutes(root /* vite */);
|
|
25
24
|
const renderedRoutes = [];
|
|
26
25
|
// MARK: Iterate modules
|
|
27
|
-
await Promise.all([...routes].map(async ([patternString,
|
|
28
|
-
const routeModule = await loadForeignRouteObject(
|
|
26
|
+
await Promise.all([...routes].map(async ([patternString, route]) => {
|
|
27
|
+
const routeModule = await loadForeignRouteObject({
|
|
28
|
+
vite,
|
|
29
|
+
route,
|
|
30
|
+
});
|
|
29
31
|
const routeStaticPaths = routeModule.staticPaths?.();
|
|
30
32
|
// MARK: Extract data
|
|
31
33
|
await Promise.all((routeStaticPaths ?? [patternString]).map(async (staticPathOptions) => {
|
|
@@ -55,16 +57,22 @@ export async function renderRoutes(vite, root = process.cwd()) {
|
|
|
55
57
|
: 'index.html');
|
|
56
58
|
const url = new URL(pathnameWithParams, 'http://gracile-static');
|
|
57
59
|
// MARK: Render
|
|
58
|
-
const { output } = await renderRouteTemplate(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
const { output } = await renderRouteTemplate({
|
|
61
|
+
//
|
|
62
|
+
request: { url: url.href },
|
|
63
|
+
vite,
|
|
64
|
+
mode: 'build',
|
|
65
|
+
routeInfos: {
|
|
66
|
+
routeModule,
|
|
67
|
+
params,
|
|
68
|
+
foundRoute: route,
|
|
69
|
+
pathname: pathnameWithParams,
|
|
70
|
+
props,
|
|
71
|
+
},
|
|
72
|
+
root,
|
|
73
|
+
serverMode,
|
|
66
74
|
});
|
|
67
|
-
const htmlString = await streamToString(output);
|
|
75
|
+
const htmlString = output ? await streamToString(output) : '';
|
|
68
76
|
const existing = renderedRoutes.find((rendered) => rendered?.name === name);
|
|
69
77
|
if (existing)
|
|
70
78
|
throw new Error(`${c.red(`"${existing.name}" page was defined twice!`)}\n`);
|
|
@@ -75,8 +83,13 @@ export async function renderRoutes(vite, root = process.cwd()) {
|
|
|
75
83
|
absoluteId: join(root, name),
|
|
76
84
|
name,
|
|
77
85
|
html: htmlString,
|
|
86
|
+
savePrerender: route.prerender,
|
|
78
87
|
});
|
|
79
88
|
}));
|
|
80
89
|
}));
|
|
81
|
-
|
|
90
|
+
logger.info(c.green('Rendering routes finished'), { timestamp: true });
|
|
91
|
+
return {
|
|
92
|
+
routes,
|
|
93
|
+
renderedRoutes: renderedRoutes.sort((a, b) => a.absoluteId < b.absoluteId ? -1 : 1),
|
|
94
|
+
};
|
|
82
95
|
}
|
package/dist/dev/dev.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export declare function dev(options: {
|
|
2
2
|
port?: number | undefined;
|
|
3
|
-
root?: string;
|
|
3
|
+
root?: string | undefined;
|
|
4
4
|
expose?: boolean | undefined;
|
|
5
|
-
}): Promise<void
|
|
5
|
+
}): Promise<void | {
|
|
6
|
+
port: number;
|
|
7
|
+
instance: import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
|
8
|
+
}>;
|
|
6
9
|
//# sourceMappingURL=dev.d.ts.map
|
package/dist/dev/dev.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/dev/dev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/dev/dev.ts"],"names":[],"mappings":"AAYA,wBAAsB,GAAG,CAAC,OAAO,EAAE;IAClC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7B;;;GAuBA"}
|
package/dist/dev/dev.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { logger } from '@gracile/internal-utils/logger';
|
|
2
|
+
import { setCurrentWorkingDirectory } from '@gracile/internal-utils/paths';
|
|
2
3
|
import c from 'picocolors';
|
|
3
4
|
import { getConfigs } from '../vite/config.js';
|
|
4
|
-
import {
|
|
5
|
-
const DEFAULT_DEV_SERVER_PORT = 9090;
|
|
5
|
+
import { createStandaloneDevServer, DEFAULT_DEV_SERVER_PORT, DEFAULT_USER_SERVER_MODULE_ENTRYPOINT, startUserProvidedServer, } from './server.js';
|
|
6
6
|
export async function dev(options) {
|
|
7
7
|
logger.info(c.gray('\n— Development mode —\n'));
|
|
8
|
-
const
|
|
8
|
+
const root = setCurrentWorkingDirectory(options.root);
|
|
9
|
+
const { userConfigGracile } = await getConfigs(root, 'dev');
|
|
9
10
|
const port = options.port ?? userConfigGracile?.port ?? DEFAULT_DEV_SERVER_PORT;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const entrypoint = userConfigGracile?.server?.entrypoint ??
|
|
12
|
+
DEFAULT_USER_SERVER_MODULE_ENTRYPOINT;
|
|
13
|
+
if (userConfigGracile?.output === 'server') {
|
|
14
|
+
logger.info(c.gray(`\n— User provided ${c.cyan('server')} mode —\n`));
|
|
15
|
+
return startUserProvidedServer({
|
|
16
|
+
root,
|
|
17
|
+
entrypoint,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return createStandaloneDevServer({ root, port });
|
|
14
21
|
}
|
package/dist/dev/server.d.ts
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import type { Server } from 'node:http';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { type ViteDevServer } from 'vite';
|
|
3
|
+
import { type ConnectLikeAsyncMiddleware } from '../server/request.js';
|
|
4
|
+
export type CreateMiddleware = typeof createHandlers;
|
|
5
|
+
export declare function createHandlers({ root, isStandalone, }?: {
|
|
6
|
+
isStandalone?: boolean;
|
|
7
|
+
hmrPort?: number;
|
|
4
8
|
root?: string;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
vite: ViteDevServer | null;
|
|
11
|
+
handlers: ConnectLikeAsyncMiddleware[];
|
|
12
|
+
}>;
|
|
13
|
+
export declare const DEFAULT_DEV_SERVER_PORT = 9090;
|
|
14
|
+
export declare const DEV_SERVER_EXPOSED_HOST = "0.0.0.0";
|
|
15
|
+
export declare const DEV_SERVER_HOST = "127.0.0.1";
|
|
16
|
+
export declare function createStandaloneDevServer(options: {
|
|
17
|
+
port: number;
|
|
18
|
+
root: string;
|
|
5
19
|
expose?: boolean | undefined;
|
|
6
20
|
}): Promise<{
|
|
7
21
|
port: number;
|
|
8
22
|
instance: Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
|
9
23
|
}>;
|
|
24
|
+
export declare const DEFAULT_USER_SERVER_MODULE_ENTRYPOINT = "/src/server";
|
|
25
|
+
export declare function startUserProvidedServer(options: {
|
|
26
|
+
root: string;
|
|
27
|
+
entrypoint: string;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
export { printNodeHttpServerAddressInfos as printAddressInfos } from '../server/utils.js';
|
|
10
30
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/dev/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/dev/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/dev/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAMxC,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,MAAM,CAAC;AAI7D,OAAO,EACN,KAAK,0BAA0B,EAE/B,MAAM,sBAAsB,CAAC;AAG9B,MAAM,MAAM,gBAAgB,GAAG,OAAO,cAAc,CAAC;AAErD,wBAAsB,cAAc,CAAC,EACpC,IAAoB,EAGpB,YAAY,GACZ,GAAE;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACT,GAAG,OAAO,CAAC;IAChB,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,0BAA0B,EAAE,CAAC;CACvC,CAAC,CA0BD;AAED,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C,eAAO,MAAM,uBAAuB,YAAa,CAAC;AAClD,eAAO,MAAM,eAAe,cAAe,CAAC;AAE5C,wBAAsB,yBAAyB,CAAC,OAAO,EAAE;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7B;;;GA6CA;AAED,eAAO,MAAM,qCAAqC,gBAAgB,CAAC;AAEnE,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACnB,iBAYA;AAED,OAAO,EAAE,+BAA+B,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/dev/server.js
CHANGED
|
@@ -1,40 +1,55 @@
|
|
|
1
1
|
import { logger } from '@gracile/internal-utils/logger';
|
|
2
2
|
import { setCurrentWorkingDirectory } from '@gracile/internal-utils/paths';
|
|
3
|
-
import express
|
|
3
|
+
import express from 'express';
|
|
4
4
|
import c from 'picocolors';
|
|
5
|
-
import {
|
|
5
|
+
import { createViteRuntime } from 'vite';
|
|
6
|
+
import { collectRoutes } from '../routes/collect.js';
|
|
7
|
+
import { IP_EXPOSED, IP_LOCALHOST } from '../server/env.js';
|
|
8
|
+
import { createGracileMiddleware, } from '../server/request.js';
|
|
6
9
|
import { createViteServer } from '../vite/server.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
export async function createHandlers({ root = process.cwd(),
|
|
11
|
+
// hmrPort,
|
|
12
|
+
isStandalone, } = {}) {
|
|
13
|
+
if (isStandalone !== true)
|
|
14
|
+
setCurrentWorkingDirectory(root);
|
|
15
|
+
logger.info(c.green('creating handler…'), {
|
|
10
16
|
timestamp: true,
|
|
11
17
|
});
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const { vite, gracileConfig } = await createViteServer(root, 'dev');
|
|
19
|
+
const routes = await collectRoutes(root /* vite */);
|
|
20
|
+
const debugRoutes = (req, res, next) => {
|
|
21
|
+
if (req.url !== '__routes')
|
|
22
|
+
return next();
|
|
23
|
+
res.setHeader('content-type', 'application/json');
|
|
24
|
+
return res.end(JSON.stringify([...routes]));
|
|
25
|
+
};
|
|
20
26
|
vite.watcher.on('all', (event, _file) => {
|
|
21
27
|
if (['add', 'unlink'].includes(event))
|
|
22
28
|
collectRoutes(root /* , vite */).catch((e) => logger.error(String(e)));
|
|
23
29
|
});
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return { app, vite };
|
|
30
|
+
const serverMode = gracileConfig?.output === 'server';
|
|
31
|
+
const gracile = createGracileMiddleware({ vite, root, serverMode, routes });
|
|
32
|
+
return { handlers: [debugRoutes, vite.middlewares, gracile], vite };
|
|
28
33
|
}
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
export const DEFAULT_DEV_SERVER_PORT = 9090;
|
|
35
|
+
export const DEV_SERVER_EXPOSED_HOST = IP_EXPOSED;
|
|
36
|
+
export const DEV_SERVER_HOST = IP_LOCALHOST;
|
|
37
|
+
export async function createStandaloneDevServer(options) {
|
|
38
|
+
const { handlers: handler } = await createHandlers({
|
|
39
|
+
// hmrPort: options.port + 1,
|
|
40
|
+
root: options.root,
|
|
41
|
+
});
|
|
32
42
|
// NOTE: `0` will auto-alocate a random available port.
|
|
33
|
-
let resultingPort = port;
|
|
43
|
+
let resultingPort = options.port;
|
|
34
44
|
let resultingHost;
|
|
45
|
+
const expressApp = express();
|
|
46
|
+
expressApp.use(handler);
|
|
35
47
|
const instance = await new Promise((resolve) => {
|
|
36
|
-
const inst =
|
|
37
|
-
logger.info(c.green('development server started'), {
|
|
48
|
+
const inst = expressApp.listen(options.port, options.expose ? DEV_SERVER_EXPOSED_HOST : DEV_SERVER_HOST, () => {
|
|
49
|
+
logger.info(c.green('development server started'), {
|
|
50
|
+
timestamp: true,
|
|
51
|
+
});
|
|
52
|
+
logger.info(c.dim(`CWD: ${process.env['__GRACILE_PROJECT_CWD']}`));
|
|
38
53
|
resolve(inst);
|
|
39
54
|
const addressInfo = inst.address();
|
|
40
55
|
if (typeof addressInfo === 'object' && addressInfo) {
|
|
@@ -52,3 +67,16 @@ ${c.dim('┃')} Network ${options.expose ? c.cyan(`http://${resultingHost}:${re
|
|
|
52
67
|
});
|
|
53
68
|
return { port: resultingPort, instance };
|
|
54
69
|
}
|
|
70
|
+
export const DEFAULT_USER_SERVER_MODULE_ENTRYPOINT = '/src/server';
|
|
71
|
+
export async function startUserProvidedServer(options) {
|
|
72
|
+
const { vite: runtimeServer } = await createViteServer(options.root, 'dev');
|
|
73
|
+
const runtime = await createViteRuntime(runtimeServer);
|
|
74
|
+
await runtime.executeEntrypoint(options.entrypoint);
|
|
75
|
+
// return {
|
|
76
|
+
// close: async () => {
|
|
77
|
+
// await runtime.destroy();
|
|
78
|
+
// await runtimeServer.close();
|
|
79
|
+
// },
|
|
80
|
+
// };
|
|
81
|
+
}
|
|
82
|
+
export { printNodeHttpServerAddressInfos as printAddressInfos } from '../server/utils.js';
|
package/dist/preview.d.ts
CHANGED
package/dist/preview.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../src/preview.ts"],"names":[],"mappings":"AAMA,wBAAsB,OAAO,CAAC,EAC7B,IAAI,EACJ,MAAM,EACN,IAAI,GACJ,EAAE;IACF,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../src/preview.ts"],"names":[],"mappings":"AAMA,wBAAsB,OAAO,CAAC,EAC7B,IAAI,EACJ,MAAM,EACN,IAAI,GACJ,EAAE;IACF,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B,iBAmBA"}
|
package/dist/preview.js
CHANGED
|
@@ -5,5 +5,8 @@ import { vitePreview } from './vite/server.js';
|
|
|
5
5
|
export async function preview({ port, expose, root, }) {
|
|
6
6
|
logger.info(c.gray('\n— Preview mode —\n'));
|
|
7
7
|
const { userConfigGracile } = await getConfigs(root ?? process.cwd(), 'build');
|
|
8
|
+
if (userConfigGracile?.output === 'server')
|
|
9
|
+
throw new Error(c.red(`Vite preview is unnecessary when using the ${c.yellow('server mode')}.\n\n`) +
|
|
10
|
+
c.yellow(`You can use a \`preview\` script with this command:\n\n${c.white('node --env-file=.env --watch dist/server/server.js')}\n`));
|
|
8
11
|
await vitePreview(port ?? userConfigGracile?.port ?? 9797, expose);
|
|
9
12
|
}
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Readable } from 'stream';
|
|
2
2
|
import type { ViteDevServer } from 'vite';
|
|
3
3
|
import type { RouteInfos } from '../routes/match.js';
|
|
4
|
-
import type
|
|
4
|
+
import type * as R from '../routes/route.js';
|
|
5
5
|
export declare const SSR_OUTLET_MARKER = "<route-template-outlet></route-template-outlet>";
|
|
6
6
|
export declare const PAGE_ASSETS_MARKER = "<!--__GRACILE_PAGE_ASSETS__-->";
|
|
7
7
|
export declare const pageAssets: import("@lit-labs/ssr").ServerRenderedTemplate;
|
|
8
|
+
export declare const REGEX_TAG_SCRIPT: RegExp;
|
|
9
|
+
export declare const REGEX_TAG_LINK: RegExp;
|
|
8
10
|
export type HandlerInfos = {
|
|
9
11
|
data: unknown;
|
|
10
12
|
method: string;
|
|
11
13
|
};
|
|
12
|
-
export declare function renderRouteTemplate(request
|
|
13
|
-
|
|
14
|
+
export declare function renderRouteTemplate({ request, vite, mode, routeInfos, handlerInfos, routeAssets, serverMode, }: {
|
|
15
|
+
request: Request | R.StaticRequest;
|
|
16
|
+
vite?: ViteDevServer | undefined;
|
|
17
|
+
mode: 'dev' | 'build';
|
|
18
|
+
routeInfos: RouteInfos;
|
|
19
|
+
handlerInfos?: HandlerInfos | undefined;
|
|
20
|
+
routeAssets?: R.RoutesAssets | undefined;
|
|
21
|
+
root: string;
|
|
22
|
+
serverMode?: boolean | undefined;
|
|
23
|
+
}): Promise<{
|
|
24
|
+
output: null | Readable;
|
|
14
25
|
}>;
|
|
15
26
|
//# sourceMappingURL=route-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-template.d.ts","sourceRoot":"","sources":["../../src/render/route-template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"route-template.d.ts","sourceRoot":"","sources":["../../src/render/route-template.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAG1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,KAAK,CAAC,MAAM,oBAAoB,CAAC;AAa7C,eAAO,MAAM,iBAAiB,oDACoB,CAAC;AAGnD,eAAO,MAAM,kBAAkB,mCAAmC,CAAC;AAEnE,eAAO,MAAM,UAAU,gDAA6C,CAAC;AAErE,eAAO,MAAM,gBAAgB,QACkC,CAAC;AAEhE,eAAO,MAAM,cAAc,QAA2B,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D,wBAAsB,mBAAmB,CAAC,EACzC,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,WAAW,EAEX,UAAU,GACV,EAAE;IACF,OAAO,EAAE,OAAO,GAAG,CAAC,CAAC,aAAa,CAAC;IACnC,IAAI,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IACxC,WAAW,CAAC,EAAE,CAAC,CAAC,YAAY,GAAG,SAAS,CAAC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACjC,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,IAAI,GAAG,QAAQ,CAAA;CAAE,CAAC,CA8IvC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { html } from '@gracile/internal-utils/dummy-literals';
|
|
2
2
|
import { html as LitSsrHtml, render as renderLitSsr } from '@lit-labs/ssr';
|
|
3
3
|
import { collectResult } from '@lit-labs/ssr/lib/render-result.js';
|
|
4
|
-
import {
|
|
4
|
+
import { Readable } from 'stream';
|
|
5
5
|
import { isLitServerTemplate, isLitTemplate } from '../assertions.js';
|
|
6
6
|
async function* concatStreams(...readables) {
|
|
7
7
|
// eslint-disable-next-line no-restricted-syntax
|
|
@@ -18,7 +18,13 @@ export const SSR_OUTLET_MARKER = '<route-template-outlet></route-template-outlet
|
|
|
18
18
|
export const PAGE_ASSETS_MARKER = '<!--__GRACILE_PAGE_ASSETS__-->';
|
|
19
19
|
// FIXME: cannot be used with `unsafeHTML`, so must be duplicated…
|
|
20
20
|
export const pageAssets = LitSsrHtml `<!--__GRACILE_PAGE_ASSETS__-->`;
|
|
21
|
-
export
|
|
21
|
+
export const REGEX_TAG_SCRIPT = /\s?<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script\s*>\s?/gi;
|
|
22
|
+
export const REGEX_TAG_LINK = /\s?<link\b[^>]*?>\s?/gi;
|
|
23
|
+
export async function renderRouteTemplate({ request, vite, mode, routeInfos, handlerInfos, routeAssets,
|
|
24
|
+
// root,
|
|
25
|
+
serverMode, }) {
|
|
26
|
+
if (!routeInfos.routeModule.document && !routeInfos.routeModule.template)
|
|
27
|
+
return { output: null };
|
|
22
28
|
// MARK: Context
|
|
23
29
|
const context = {
|
|
24
30
|
url: new URL(request.url),
|
|
@@ -30,12 +36,12 @@ export async function renderRouteTemplate(request, vite, mode, routeInfos, handl
|
|
|
30
36
|
: routeInfos.props,
|
|
31
37
|
};
|
|
32
38
|
// MARK: Fragment
|
|
33
|
-
if (!routeInfos.routeModule.document) {
|
|
39
|
+
if (!routeInfos.routeModule.document && routeInfos.routeModule.template) {
|
|
34
40
|
const fragmentOutput = await Promise.resolve(routeInfos.routeModule.template?.(context));
|
|
35
41
|
if (isLitTemplate(fragmentOutput) === false)
|
|
36
42
|
throw Error(`Wrong template result for fragment template ${routeInfos.foundRoute.filePath}.`);
|
|
37
43
|
const fragmentRender = renderLitSsr(fragmentOutput);
|
|
38
|
-
const output =
|
|
44
|
+
const output = Readable.from(fragmentRender);
|
|
39
45
|
return { output };
|
|
40
46
|
}
|
|
41
47
|
// MARK: Document
|
|
@@ -47,36 +53,60 @@ export async function renderRouteTemplate(request, vite, mode, routeInfos, handl
|
|
|
47
53
|
throw new Error(`Incorrect document template result for ${routeInfos.foundRoute.filePath}.`);
|
|
48
54
|
const baseDocRendered = await collectResult(renderLitSsr(baseDocTemplateResult));
|
|
49
55
|
// MARK: Sibling assets
|
|
50
|
-
|
|
56
|
+
let baseDocRenderedWithAssets = baseDocRendered.replace(PAGE_ASSETS_MARKER, html `
|
|
51
57
|
<!-- PAGE ASSETS -->
|
|
52
58
|
${routeInfos.foundRoute.pageAssets.map((path) => {
|
|
53
59
|
//
|
|
54
60
|
if (/\.(js|ts)$/.test(path)) {
|
|
55
|
-
return html
|
|
61
|
+
return html `
|
|
62
|
+
<script type="module" src="/${path}"></script>
|
|
63
|
+
<!-- -->
|
|
64
|
+
`;
|
|
56
65
|
}
|
|
57
66
|
if (/\.(scss|css)$/.test(path)) {
|
|
58
|
-
return html
|
|
67
|
+
return html `
|
|
68
|
+
<link rel="stylesheet" href="/${path}" />
|
|
69
|
+
<!-- -->
|
|
70
|
+
`;
|
|
59
71
|
}
|
|
60
72
|
throw new Error('Unknown asset.');
|
|
61
73
|
})}
|
|
62
74
|
<!-- /PAGE ASSETS -->
|
|
63
75
|
`);
|
|
76
|
+
const routeAssetsString = routeAssets?.get?.(routeInfos.foundRoute.pattern.pathname);
|
|
77
|
+
if (routeAssetsString)
|
|
78
|
+
baseDocRenderedWithAssets = baseDocRenderedWithAssets
|
|
79
|
+
.replace(REGEX_TAG_SCRIPT, (s) => {
|
|
80
|
+
if (s.includes(`type="module"`))
|
|
81
|
+
return '';
|
|
82
|
+
return s;
|
|
83
|
+
})
|
|
84
|
+
.replace(REGEX_TAG_LINK, (s) => {
|
|
85
|
+
if (s.includes(`rel="stylesheet"`))
|
|
86
|
+
return '';
|
|
87
|
+
return s;
|
|
88
|
+
})
|
|
89
|
+
.replace('</head>', `${routeAssetsString}\n</head>`);
|
|
64
90
|
// MARK: Base document
|
|
65
|
-
const baseDocHtml = mode === 'dev'
|
|
91
|
+
const baseDocHtml = vite && mode === 'dev'
|
|
66
92
|
? await vite.transformIndexHtml(routeInfos.pathname, baseDocRenderedWithAssets)
|
|
67
93
|
: baseDocRenderedWithAssets;
|
|
68
94
|
const index = baseDocHtml.indexOf(SSR_OUTLET_MARKER);
|
|
69
|
-
const baseDocRenderStreamPre =
|
|
70
|
-
const baseDocRenderStreamPost =
|
|
95
|
+
const baseDocRenderStreamPre = Readable.from(baseDocHtml.substring(0, index));
|
|
96
|
+
const baseDocRenderStreamPost = Readable.from(baseDocHtml.substring(index + SSR_OUTLET_MARKER.length + 1));
|
|
71
97
|
// MARK: Page
|
|
72
|
-
|
|
73
|
-
|
|
98
|
+
// Skipped with server mode in production build
|
|
99
|
+
if ((serverMode === false && routeInfos.routeModule.template) ||
|
|
100
|
+
//
|
|
101
|
+
(serverMode && routeInfos.routeModule.template && mode !== 'build')) {
|
|
102
|
+
const routeOutput = await Promise.resolve(routeInfos.routeModule.template?.(context));
|
|
74
103
|
if (isLitTemplate(routeOutput) === false)
|
|
75
104
|
throw Error(`Wrong template result for page template ${routeInfos.foundRoute.filePath}.`);
|
|
76
|
-
const renderStream =
|
|
77
|
-
const output =
|
|
105
|
+
const renderStream = Readable.from(renderLitSsr(routeOutput));
|
|
106
|
+
const output = Readable.from(concatStreams(baseDocRenderStreamPre, renderStream, baseDocRenderStreamPost));
|
|
78
107
|
return { output };
|
|
79
108
|
}
|
|
80
|
-
|
|
109
|
+
// MARK: Just the document
|
|
110
|
+
const output = Readable.from(baseDocHtml);
|
|
81
111
|
return { output };
|
|
82
112
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/render/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,sBAAsB,EAC3B,MAAM,eAAe,CAAC;AAGvB,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,sBAAsB,mBAEvE"}
|
package/dist/routes/collect.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare
|
|
3
|
-
export declare function collectRoutes(root: string): Promise<void>;
|
|
1
|
+
import type * as R from './route.js';
|
|
2
|
+
export declare function collectRoutes(root: string): Promise<R.RoutesManifest>;
|
|
4
3
|
//# sourceMappingURL=collect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/routes/collect.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/routes/collect.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,CAAC,MAAM,YAAY,CAAC;AA2DrC,wBAAsB,aAAa,CAClC,IAAI,EAAE,MAAM,GACV,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAkF3B"}
|
package/dist/routes/collect.js
CHANGED
|
@@ -7,7 +7,6 @@ import { URLPattern } from 'urlpattern-polyfill/urlpattern';
|
|
|
7
7
|
// import type { ViteDevServer } from 'vite';
|
|
8
8
|
import { prepareSortableRoutes, routeComparator } from './comparator.js';
|
|
9
9
|
import { REGEXES } from './load-module.js';
|
|
10
|
-
export const routes = new Map();
|
|
11
10
|
function extractRoutePatterns(absoluteFilePath) {
|
|
12
11
|
const routePathname = path
|
|
13
12
|
.relative('src/routes', paths.relativeToProject(absoluteFilePath))
|
|
@@ -49,6 +48,7 @@ function extractRoutePatterns(absoluteFilePath) {
|
|
|
49
48
|
hasParams,
|
|
50
49
|
};
|
|
51
50
|
}
|
|
51
|
+
const routes = new Map();
|
|
52
52
|
export async function collectRoutes(root /* vite: ViteDevServer */) {
|
|
53
53
|
routes.clear();
|
|
54
54
|
const serverEntrypoints = await fastGlob([
|
|
@@ -94,6 +94,8 @@ export async function collectRoutes(root /* vite: ViteDevServer */) {
|
|
|
94
94
|
pattern: routeWithPatterns.pattern,
|
|
95
95
|
hasParams: routeWithPatterns.hasParams,
|
|
96
96
|
pageAssets: [],
|
|
97
|
+
// NOTE: Not implemented!
|
|
98
|
+
prerender: null,
|
|
97
99
|
});
|
|
98
100
|
});
|
|
99
101
|
serverPageClientAssets.forEach((filePath) => {
|
|
@@ -108,4 +110,5 @@ export async function collectRoutes(root /* vite: ViteDevServer */) {
|
|
|
108
110
|
route.pageAssets.push(assetPathWithExt);
|
|
109
111
|
});
|
|
110
112
|
});
|
|
113
|
+
return routes;
|
|
111
114
|
}
|
|
@@ -7,5 +7,9 @@ export declare const REGEXES: {
|
|
|
7
7
|
dynamicSplit: RegExp;
|
|
8
8
|
index: RegExp;
|
|
9
9
|
};
|
|
10
|
-
export declare function loadForeignRouteObject(vite
|
|
10
|
+
export declare function loadForeignRouteObject({ vite, route, routeImports, }: {
|
|
11
|
+
vite?: ViteDevServer | undefined;
|
|
12
|
+
route: R.Route;
|
|
13
|
+
routeImports?: R.RoutesImports | undefined;
|
|
14
|
+
}): Promise<R.RouteModule>;
|
|
11
15
|
//# sourceMappingURL=load-module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-module.d.ts","sourceRoot":"","sources":["../../src/routes/load-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,CAAC,MAAM,YAAY,CAAC;AAGhC,eAAO,MAAM,OAAO;;;;;;CASnB,CAAC;AAEF,wBAAsB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"load-module.d.ts","sourceRoot":"","sources":["../../src/routes/load-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,CAAC,MAAM,YAAY,CAAC;AAGhC,eAAO,MAAM,OAAO;;;;;;CASnB,CAAC;AAEF,wBAAsB,sBAAsB,CAAC,EAC5C,IAAI,EACJ,KAAK,EACL,YAAY,GACZ,EAAE;IACF,IAAI,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IACjC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,CAAC,aAAa,GAAG,SAAS,CAAC;CAC3C,0BA2BA"}
|
|
@@ -9,11 +9,20 @@ export const REGEXES = {
|
|
|
9
9
|
// index: /^(index\.(js|ts)|\((.*)\)\.(js|ts))$/,
|
|
10
10
|
index: /\((.*)\)/,
|
|
11
11
|
};
|
|
12
|
-
export async function loadForeignRouteObject(vite,
|
|
12
|
+
export async function loadForeignRouteObject({ vite, route, routeImports, }) {
|
|
13
13
|
// NOTE: Check and assert unknown userland module to correct RouteModule instance (in the engine's realm)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
let unknownRouteModule = null;
|
|
15
|
+
if (vite)
|
|
16
|
+
unknownRouteModule = await vite.ssrLoadModule(route.filePath);
|
|
17
|
+
else if (routeImports) {
|
|
18
|
+
const ri = routeImports.get(route.pattern.pathname);
|
|
19
|
+
if (ri)
|
|
20
|
+
unknownRouteModule = await Promise.resolve(ri());
|
|
21
|
+
}
|
|
22
|
+
if (unknownRouteModule === null)
|
|
23
|
+
throw new Error('Cannot find route module.');
|
|
24
|
+
const routeModuleFactory = unknownRouteModule['default'];
|
|
25
|
+
const errorBase = `Incorrect route module ${route.filePath}!`;
|
|
17
26
|
if (typeof routeModuleFactory !== 'function')
|
|
18
27
|
throw new Error(`${errorBase} Not a function.`);
|
|
19
28
|
const routeModule = routeModuleFactory(R.RouteModule);
|
package/dist/routes/match.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ViteDevServer } from 'vite';
|
|
2
|
-
import * as R from './route.js';
|
|
2
|
+
import type * as R from './route.js';
|
|
3
3
|
type Params = Record<string, string | undefined>;
|
|
4
4
|
export type RouteInfos = {
|
|
5
5
|
params: Params;
|
|
@@ -10,7 +10,9 @@ export type RouteInfos = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare function getRoute(options: {
|
|
12
12
|
url: string;
|
|
13
|
-
vite
|
|
13
|
+
vite?: ViteDevServer | undefined;
|
|
14
|
+
routes: R.RoutesManifest;
|
|
15
|
+
routeImports?: R.RoutesImports | undefined;
|
|
14
16
|
}): Promise<RouteInfos>;
|
|
15
17
|
export {};
|
|
16
18
|
//# sourceMappingURL=match.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../src/routes/match.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../src/routes/match.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAG1C,OAAO,KAAK,KAAK,CAAC,MAAM,YAAY,CAAC;AAErC,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAoFjD,MAAM,MAAM,UAAU,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACrC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,wBAAsB,QAAQ,CAAC,OAAO,EAAE;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IACjC,MAAM,EAAE,CAAC,CAAC,cAAc,CAAC;IACzB,YAAY,CAAC,EAAE,CAAC,CAAC,aAAa,GAAG,SAAS,CAAC;CAC3C,GAAG,OAAO,CAAC,UAAU,CAAC,CA2BtB"}
|