vike-lite 1.0.18 → 1.0.19

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.
@@ -1,2 +1,2 @@
1
- import { n as store, t as setVikeState } from "../store-CU7IkMCz.mjs";
1
+ import { n as store, t as setVikeState } from "../store-CfUB1COP.mjs";
2
2
  export { setVikeState, store };
package/dist/server.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as matchRoute } from "./matchRoute-BONrLRYy.mjs";
2
- import { n as store } from "./store-CU7IkMCz.mjs";
2
+ import { n as store } from "./store-CfUB1COP.mjs";
3
3
  //#region src/utils/serializeContext.ts
4
4
  const ESCAPE_LOOKUP = {
5
5
  "&": String.raw`\u0026`,
@@ -34,12 +34,15 @@ function getAssets(pageModuleId) {
34
34
  };
35
35
  const cssFiles = /* @__PURE__ */ new Set();
36
36
  const jsFiles = /* @__PURE__ */ new Set();
37
+ const visitedKeys = /* @__PURE__ */ new Set();
37
38
  const { manifest } = store;
38
39
  function getVirtualEntryClientKey() {
39
40
  for (const key in manifest) if (manifest[key].isEntry) return key;
40
41
  throw new Error("entry-client not found in manifest");
41
42
  }
42
43
  function collectAssets(key) {
44
+ if (visitedKeys.has(key)) return;
45
+ visitedKeys.add(key);
43
46
  const chunk = manifest[key];
44
47
  if (!chunk) throw new Error(`Asset not found in manifest for key: ${key}`);
45
48
  jsFiles.add(chunk.file);
@@ -52,7 +55,7 @@ function getAssets(pageModuleId) {
52
55
  return {
53
56
  cssLinks: [...cssFiles].map((href) => `<link rel="stylesheet" href="/${href}">`).join(""),
54
57
  jsPreloads: [...jsFiles].map((href) => `<link rel="modulepreload" href="/${href}">`).join(""),
55
- entryClient: "/" + manifest[virtualEntryClientKey].file
58
+ entryClient: `/${manifest[virtualEntryClientKey].file}`
56
59
  };
57
60
  }
58
61
  async function buildPageContext(urlPathname, urlOriginal, isJsonRequest) {
@@ -1,21 +1,20 @@
1
1
  //#region src/server/store.ts
2
2
  const STORE_KEY = "_vike_lite";
3
- const g = globalThis;
4
- if (!g[STORE_KEY]) g[STORE_KEY] = {
3
+ if (!Object.hasOwn(globalThis, STORE_KEY)) globalThis[STORE_KEY] = {
5
4
  routes: [],
6
5
  errorRoute: null,
7
6
  config: null,
8
7
  manifest: void 0
9
8
  };
10
9
  const store = new Proxy({}, {
11
- get: (_, prop) => g[STORE_KEY][prop],
10
+ get: (_, prop) => globalThis[STORE_KEY][prop],
12
11
  set: (_, prop, value) => {
13
- g[STORE_KEY][prop] = value;
12
+ globalThis[STORE_KEY][prop] = value;
14
13
  return true;
15
14
  }
16
15
  });
17
16
  function setVikeState(newState) {
18
- Object.assign(g[STORE_KEY], newState);
17
+ Object.assign(globalThis[STORE_KEY], newState);
19
18
  }
20
19
  //#endregion
21
20
  export { store as n, setVikeState as t };
package/dist/vite.mjs CHANGED
@@ -68,10 +68,10 @@ async function injectFOUCStyles(server, html) {
68
68
  try {
69
69
  const result = await clientEnv.transformRequest(url);
70
70
  if (result?.code) styles.add(result.code);
71
- } catch (e) {}
71
+ } catch {}
72
72
  }
73
73
  if (styles.size === 0) return html;
74
- const cssContent = Array.from(styles).join("");
74
+ const cssContent = [...styles].join("");
75
75
  const headEndIndex = html.lastIndexOf("</head>");
76
76
  if (headEndIndex === -1) return html;
77
77
  return `${html.slice(0, headEndIndex)}<style type="text/css" data-vite-dev-fouc>${cssContent}</style>${html.slice(headEndIndex)}`;
@@ -175,8 +175,8 @@ function routerPlugin({ pagesDir = "pages", serverEntry = "server/index.ts", api
175
175
  }
176
176
  if (id === resolvedVirtualEntryClientId) return `import { routes, errorRoute } from '${virtualModuleId}';
177
177
  import { onRenderClient } from '${virtualAdapterId}';
178
- const { default: render } = await onRenderClient();
179
- render({ routes, errorRoute });`;
178
+ const render = await onRenderClient();
179
+ await render({ routes, errorRoute });`;
180
180
  if (id === resolvedVirtualSetupId) return `
181
181
  import { routes, errorRoute, config } from '${virtualModuleId}';
182
182
  import { setVikeState } from 'vike-lite/__internal/server';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike-lite",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.mjs",
@@ -43,10 +43,10 @@
43
43
  "od": "yarn outdated"
44
44
  },
45
45
  "devDependencies": {
46
- "@types/node": "^26.0.0",
46
+ "@types/node": "^26.0.1",
47
47
  "@yarnpkg/sdks": "^3.3.0",
48
- "eslint": "^10.5.0",
49
- "eslint-plugin-unicorn": "^68.0.0",
48
+ "eslint": "^10.6.0",
49
+ "eslint-plugin-unicorn": "^69.0.0",
50
50
  "tsdown": "^0.22.3",
51
51
  "typescript": "^6.0.3",
52
52
  "typescript-eslint": "^8.62.0",