@void/svelte 0.7.5 → 0.7.6

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.
Files changed (2) hide show
  1. package/dist/plugin.mjs +4 -20
  2. package/package.json +3 -3
package/dist/plugin.mjs CHANGED
@@ -2,7 +2,7 @@ import { svelte } from "@sveltejs/vite-plugin-svelte";
2
2
  import { existsSync, readFileSync, readdirSync } from "node:fs";
3
3
  import { normalizePath } from "vite";
4
4
  import { generateComponentManifest, resolveEffectiveLayoutChain, resolveStaticPageDataBuildOptions, scanPages } from "void/pages";
5
- import { ISLANDS_CLIENT_ENTRY_ID, ISLANDS_RENDERER_ID, computePagesNeedingClientJS, configureIslandCssServer, extractCssImports, fileHasCssImports, needsIslandClientBundle, rebuildIslandCssMap, resolveSpecifier, rewriteCssImportForVirtualModule, watchPagesForRescan } from "void/pages-islands-plugin";
5
+ import { ISLANDS_CLIENT_ENTRY_ID, ISLANDS_RENDERER_ID, computePagesNeedingClientJS, extractCssImports, needsIslandClientBundle, resolveSpecifier, rewriteCssImportForVirtualModule, watchPagesForRescan } from "void/pages-islands-plugin";
6
6
  //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
7
7
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
8
8
  function normalizeWindowsPath(input = "") {
@@ -153,13 +153,7 @@ function islandsPlugin(pagesDir) {
153
153
  const islandCssFiles = /* @__PURE__ */ new Set();
154
154
  let isDev = false;
155
155
  let viteRoot = "";
156
- const islandCssMap = /* @__PURE__ */ new Map();
157
156
  let resolvedConfig = null;
158
- /** Rebuild islandCssMap from current file contents (re-runs fileHasCssImports). */
159
- function rebuildIslandCssMap$1() {
160
- if (!pageScan) return;
161
- rebuildIslandCssMap(pageScan, pagesDir, islandCssMap, fileHasCssImports);
162
- }
163
157
  function computePagesNeedingClientJS$1() {
164
158
  if (!pageScan) return /* @__PURE__ */ new Set();
165
159
  return computePagesNeedingClientJS(pageScan, pagesDir, resolvedConfig);
@@ -173,10 +167,8 @@ function islandsPlugin(pagesDir) {
173
167
  isDev = config.command === "serve";
174
168
  },
175
169
  configureServer(server) {
176
- configureIslandCssServer(server, islandCssFiles, viteRoot, rebuildIslandCssMap$1);
177
170
  watchPagesForRescan(server, pagesDir, root, (scan) => {
178
171
  pageScan = scan;
179
- rebuildIslandCssMap$1();
180
172
  });
181
173
  },
182
174
  async buildStart() {
@@ -224,7 +216,6 @@ function islandsPlugin(pagesDir) {
224
216
  const layoutChain = resolveEffectiveLayoutChain(page, pageScan.layouts, pageScan.namedLayouts);
225
217
  for (const layout of layoutChain) islandCssFiles.add(normalizePath(resolve(pagesDir, layout.filePath)));
226
218
  }
227
- rebuildIslandCssMap$1();
228
219
  }
229
220
  },
230
221
  resolveId: {
@@ -250,7 +241,7 @@ function islandsPlugin(pagesDir) {
250
241
  const mdPlugin = resolvedConfig?.plugins?.find((p) => p.name === "void-md");
251
242
  const mdScriptIds = new Set(mdPlugin?.api?.getClientScripts?.()?.keys() ?? []);
252
243
  const needsJS = computePagesNeedingClientJS$1();
253
- return generateIslandRenderer(pageScan, pagesDir, isDev, islandCssMap, viteRoot, mdScriptIds, needsJS);
244
+ return generateIslandRenderer(pageScan, pagesDir, mdScriptIds, needsJS);
254
245
  }
255
246
  if (id === "\0" + ISLANDS_CLIENT_ENTRY_ID) {
256
247
  if (!pageScan) return "";
@@ -350,13 +341,7 @@ function generateWrapperComponent(id) {
350
341
  </div>
351
342
  `;
352
343
  }
353
- function generateIslandRenderer(scan, pagesDir, isDev, islandCssMap, viteRoot, mdScriptIds, pagesNeedingClientJS) {
354
- let cssMapCode = "";
355
- if (isDev && islandCssMap.size > 0) {
356
- const cssMapObj = {};
357
- for (const [compId, paths] of islandCssMap) cssMapObj[compId] = paths.map((p) => "/" + normalizePath(relative(viteRoot, p)) + ".css");
358
- cssMapCode = `const __cssPaths = ${JSON.stringify(cssMapObj)};`;
359
- }
344
+ function generateIslandRenderer(scan, pagesDir, mdScriptIds, pagesNeedingClientJS) {
360
345
  const mdScriptIdsCode = `const __mdClientScriptIds = new Set(${JSON.stringify([...mdScriptIds])});`;
361
346
  const needsJSCode = `const __pagesNeedingClientJS = new Set(${JSON.stringify([...pagesNeedingClientJS])});`;
362
347
  return `
@@ -365,7 +350,6 @@ import App from "@void/svelte/App.svelte";
365
350
  import { renderHeadToString, renderHtmlAttrs, renderBodyAttrs } from "void/pages-head";
366
351
 
367
352
  ${generateComponentManifest(scan, pagesDir)}
368
- ${cssMapCode}
369
353
  ${mdScriptIdsCode}
370
354
  ${needsJSCode}
371
355
 
@@ -400,7 +384,7 @@ export async function renderIslandPage(pageObj, assetTags) {
400
384
 
401
385
  return \`<!doctype html>
402
386
  <html\${htmlAttrs}>
403
- <head>\${headHtml}\${typeof __cssPaths !== "undefined" ? (__cssPaths[pageObj.component] || []).map(url => '<link rel="stylesheet" href="' + url + '">').join("\\n") : ""}\${head}\${assetTags.css}\${__pagesNeedingClientJS.has(pageObj.component) ? assetTags.preloads : ""}</head>
387
+ <head>\${headHtml}\${head}\${assetTags.css}\${__pagesNeedingClientJS.has(pageObj.component) ? assetTags.preloads : ""}</head>
404
388
  <body\${bodyAttrs}>
405
389
  <div id="app"\${__mdScriptAttr}>\${html}</div>
406
390
  \${__pagesNeedingClientJS.has(pageObj.component) ? assetTags.body : ""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@void/svelte",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/voidzero-dev/void.git",
@@ -44,12 +44,12 @@
44
44
  "svelte": "^5.55.5",
45
45
  "vite": "npm:@voidzero-dev/vite-plus-core@0.1.20",
46
46
  "vite-plus": "^0.1.20",
47
- "void": "0.7.5"
47
+ "void": "0.7.6"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "svelte": "^5.0.0",
51
51
  "vite": "npm:@voidzero-dev/vite-plus-core@0.1.20",
52
- "void": "0.7.5"
52
+ "void": "0.7.6"
53
53
  },
54
54
  "scripts": {
55
55
  "build": "vp pack",