vike-lite 1.0.6 → 1.0.8

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.
@@ -0,0 +1,17 @@
1
+ import { t as RenderContext } from "../index-Ck5rzSdQ.mjs";
2
+
3
+ //#region src/server/store.d.ts
4
+ interface VikeState {
5
+ routes: any[];
6
+ errorRoute: any | null;
7
+ config: {
8
+ onRenderHtml: () => Promise<{
9
+ default: (ctx: RenderContext) => Promise<string>;
10
+ }>;
11
+ } | null;
12
+ manifest: Record<string, any> | undefined;
13
+ }
14
+ declare const store: VikeState;
15
+ declare function setVikeState(newState: Partial<VikeState>): void;
16
+ //#endregion
17
+ export { VikeState, setVikeState, store };
@@ -0,0 +1,2 @@
1
+ import { n as store, t as setVikeState } from "../store-BRWiOtOy.mjs";
2
+ export { setVikeState, store };
@@ -0,0 +1,2 @@
1
+ import { n as matchRoute, t as RenderContext } from "../index-Ck5rzSdQ.mjs";
2
+ export { RenderContext, matchRoute };
@@ -0,0 +1,2 @@
1
+ import { t as matchRoute } from "../matchRoute-BONrLRYy.mjs";
2
+ export { matchRoute };
@@ -0,0 +1,22 @@
1
+ //#region src/shared/matchRoute.d.ts
2
+ declare function matchRoute(urlPathname: string, routes: Route[]): {
3
+ route: Route;
4
+ routeParams: Record<string, string>;
5
+ } | null;
6
+ //#endregion
7
+ //#region src/shared/index.d.ts
8
+ interface RenderContext {
9
+ pageContext: any;
10
+ Page: unknown;
11
+ Head?: unknown;
12
+ Layout?: unknown;
13
+ pageTitleTag: string;
14
+ serializedContext: string;
15
+ assets: {
16
+ cssLinks: string;
17
+ jsPreloads: string;
18
+ entryClient: string;
19
+ };
20
+ }
21
+ //#endregion
22
+ export { matchRoute as n, RenderContext as t };
package/dist/server.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { t as matchRoute } from "./matchRoute-BONrLRYy.mjs";
2
+ import { n as store } from "./store-BRWiOtOy.mjs";
2
3
  //#region src/server/abort.ts
3
4
  var AbortRender = class extends Error {
4
5
  statusCode;
@@ -10,14 +11,6 @@ var AbortRender = class extends Error {
10
11
  }
11
12
  };
12
13
  //#endregion
13
- //#region src/server/store.ts
14
- const store = {
15
- routes: [],
16
- errorRoute: null,
17
- config: null,
18
- manifest: void 0
19
- };
20
- //#endregion
21
14
  //#region src/server/renderPage.tsx
22
15
  const isProd = process.env.NODE_ENV === "production";
23
16
  const virtualEntryClientId = "virtual:entry-client";
@@ -0,0 +1,12 @@
1
+ //#region src/server/store.ts
2
+ const store = {
3
+ routes: [],
4
+ errorRoute: null,
5
+ config: null,
6
+ manifest: void 0
7
+ };
8
+ function setVikeState(newState) {
9
+ Object.assign(store, newState);
10
+ }
11
+ //#endregion
12
+ export { store as n, setVikeState as t };
package/dist/vite.mjs CHANGED
@@ -86,10 +86,12 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index.ts", api
86
86
  const virtualAdapterId = "virtual:vike-lite-solid";
87
87
  const virtualEntryClientId = "virtual:entry-client";
88
88
  const virtualSetupId = "virtual:vike-lite/setup";
89
+ const virtualEntryServerId = "virtual:entry-server";
89
90
  const resolvedVirtualModuleId = "\0virtual:routes";
90
91
  const resolvedVirtualManifestId = "\0virtual:client-manifest";
91
92
  const resolvedVirtualEntryClientId = "\0virtual:entry-client";
92
93
  const resolvedVirtualSetupId = "\0virtual:vike-lite/setup";
94
+ const resolvedVirtualEntryServerId = "\0virtual:entry-server";
93
95
  return {
94
96
  name: "vike-lite",
95
97
  config() {
@@ -119,7 +121,7 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index.ts", api
119
121
  outDir: "../dist/server",
120
122
  emptyOutDir: true,
121
123
  rolldownOptions: {
122
- input: serverEntry,
124
+ input: virtualEntryServerId,
123
125
  output: {
124
126
  format: "esm",
125
127
  entryFileNames: "index.mjs",
@@ -141,6 +143,7 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index.ts", api
141
143
  if (id === virtualManifestId) return resolvedVirtualManifestId;
142
144
  if (id === virtualEntryClientId) return resolvedVirtualEntryClientId;
143
145
  if (id === virtualSetupId) return resolvedVirtualSetupId;
146
+ if (id === virtualEntryServerId) return resolvedVirtualEntryServerId;
144
147
  },
145
148
  async load(id, options) {
146
149
  if (id === resolvedVirtualModuleId) {
@@ -179,14 +182,16 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index.ts", api
179
182
  `;
180
183
  if (id === resolvedVirtualSetupId) return `
181
184
  import { routes, errorRoute, config } from '${virtualModuleId}';
182
- import { setVikeState } from 'vike-lite/__internal/store';
183
-
185
+ import { setVikeState } from 'vike-lite/__internal/server';
184
186
  let manifest;
185
187
  if (process.env.NODE_ENV === 'production') {
186
188
  manifest = (await import('${virtualManifestId}')).default;
187
189
  }
188
-
189
190
  setVikeState({ routes, errorRoute, config, manifest });
191
+ `;
192
+ if (id === resolvedVirtualEntryServerId) return `
193
+ import '${virtualSetupId}';
194
+ export { default } from '${serverEntry}';
190
195
  `;
191
196
  },
192
197
  configureServer(server) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike-lite",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.mjs",
@@ -10,19 +10,20 @@
10
10
  "types": "./dist/index.d.mts"
11
11
  },
12
12
  "./vite": {
13
- "import": "./dist/vite.mjs",
14
- "types": "./dist/vite.d.mts"
13
+ "types": "./dist/vite.d.mts",
14
+ "import": "./dist/vite.mjs"
15
15
  },
16
16
  "./server": {
17
- "import": "./dist/server.mjs",
18
- "types": "./dist/server.d.mts"
17
+ "types": "./dist/server.d.mts",
18
+ "import": "./dist/server.mjs"
19
19
  },
20
- "./shared": {
21
- "import": "./dist/shared.mjs",
22
- "types": "./dist/shared.d.mts"
20
+ "./__internal/shared": {
21
+ "types": "./dist/__internal/shared.d.mts",
22
+ "import": "./dist/__internal/shared.mjs"
23
23
  },
24
- "./__internal/store": {
25
- "import": "./dist/server/store.mjs"
24
+ "./__internal/server": {
25
+ "types": "./dist/__internal/server.d.mts",
26
+ "import": "./dist/__internal/server.mjs"
26
27
  }
27
28
  },
28
29
  "repository": {
package/dist/shared.d.mts DELETED
@@ -1,7 +0,0 @@
1
- //#region src/shared/matchRoute.d.ts
2
- declare function matchRoute(urlPathname: string, routes: Route[]): {
3
- route: Route;
4
- routeParams: Record<string, string>;
5
- } | null;
6
- //#endregion
7
- export { matchRoute };
package/dist/shared.mjs DELETED
@@ -1,2 +0,0 @@
1
- import { t as matchRoute } from "./matchRoute-BONrLRYy.mjs";
2
- export { matchRoute };