@void/solid 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.
- package/dist/plugin.mjs +4 -20
- package/package.json +3 -3
package/dist/plugin.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import solid from "vite-plugin-solid";
|
|
|
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,
|
|
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 = "") {
|
|
@@ -157,13 +157,7 @@ function islandsPlugin(pagesDir) {
|
|
|
157
157
|
const wrapperMeta = /* @__PURE__ */ new Map();
|
|
158
158
|
let wrapperId = 0;
|
|
159
159
|
let viteRoot = "";
|
|
160
|
-
const islandCssMap = /* @__PURE__ */ new Map();
|
|
161
160
|
let resolvedConfig = null;
|
|
162
|
-
/** Rebuild islandCssMap from current file contents (re-runs fileHasCssImports). */
|
|
163
|
-
function rebuildIslandCssMap$1() {
|
|
164
|
-
if (!pageScan) return;
|
|
165
|
-
rebuildIslandCssMap(pageScan, pagesDir, islandCssMap, fileHasCssImports);
|
|
166
|
-
}
|
|
167
161
|
function computePagesNeedingClientJS$1() {
|
|
168
162
|
if (!pageScan) return /* @__PURE__ */ new Set();
|
|
169
163
|
return computePagesNeedingClientJS(pageScan, pagesDir, resolvedConfig);
|
|
@@ -177,10 +171,8 @@ function islandsPlugin(pagesDir) {
|
|
|
177
171
|
isDev = config.command === "serve";
|
|
178
172
|
},
|
|
179
173
|
configureServer(server) {
|
|
180
|
-
configureIslandCssServer(server, islandCssFiles, viteRoot, rebuildIslandCssMap$1);
|
|
181
174
|
watchPagesForRescan(server, pagesDir, root, (scan) => {
|
|
182
175
|
pageScan = scan;
|
|
183
|
-
rebuildIslandCssMap$1();
|
|
184
176
|
});
|
|
185
177
|
},
|
|
186
178
|
async buildStart() {
|
|
@@ -228,7 +220,6 @@ function islandsPlugin(pagesDir) {
|
|
|
228
220
|
const layoutChain = resolveEffectiveLayoutChain(page, pageScan.layouts, pageScan.namedLayouts);
|
|
229
221
|
for (const layout of layoutChain) islandCssFiles.add(normalizePath(resolve(pagesDir, layout.filePath)));
|
|
230
222
|
}
|
|
231
|
-
rebuildIslandCssMap$1();
|
|
232
223
|
}
|
|
233
224
|
},
|
|
234
225
|
resolveId: {
|
|
@@ -254,7 +245,7 @@ function islandsPlugin(pagesDir) {
|
|
|
254
245
|
const mdPlugin = resolvedConfig?.plugins?.find((p) => p.name === "void-md");
|
|
255
246
|
const mdScriptIds = new Set(mdPlugin?.api?.getClientScripts?.()?.keys() ?? []);
|
|
256
247
|
const needsJS = computePagesNeedingClientJS$1();
|
|
257
|
-
return generateIslandRenderer(pageScan, pagesDir,
|
|
248
|
+
return generateIslandRenderer(pageScan, pagesDir, mdScriptIds, needsJS);
|
|
258
249
|
}
|
|
259
250
|
if (id === "\0" + ISLANDS_CLIENT_ENTRY_ID) {
|
|
260
251
|
if (!pageScan) return "";
|
|
@@ -329,13 +320,7 @@ export default function _IslandWrap(props) {
|
|
|
329
320
|
}
|
|
330
321
|
`;
|
|
331
322
|
}
|
|
332
|
-
function generateIslandRenderer(scan, pagesDir,
|
|
333
|
-
let cssMapCode = "";
|
|
334
|
-
if (isDev && islandCssMap.size > 0) {
|
|
335
|
-
const cssMapObj = {};
|
|
336
|
-
for (const [compId, paths] of islandCssMap) cssMapObj[compId] = paths.map((p) => "/" + normalizePath(relative(viteRoot, p)) + ".css");
|
|
337
|
-
cssMapCode = `const __cssPaths = ${JSON.stringify(cssMapObj)};`;
|
|
338
|
-
}
|
|
323
|
+
function generateIslandRenderer(scan, pagesDir, mdScriptIds, pagesNeedingClientJS) {
|
|
339
324
|
const mdScriptIdsCode = `const __mdClientScriptIds = new Set(${JSON.stringify([...mdScriptIds])});`;
|
|
340
325
|
const needsJSCode = `const __pagesNeedingClientJS = new Set(${JSON.stringify([...pagesNeedingClientJS])});`;
|
|
341
326
|
return `
|
|
@@ -345,7 +330,6 @@ import { SharedContext, ErrorsContext, ParamsContext } from "@void/solid";
|
|
|
345
330
|
import { renderHeadToString, renderHtmlAttrs, renderBodyAttrs } from "void/pages-head";
|
|
346
331
|
|
|
347
332
|
${generateComponentManifest(scan, pagesDir)}
|
|
348
|
-
${cssMapCode}
|
|
349
333
|
${mdScriptIdsCode}
|
|
350
334
|
${needsJSCode}
|
|
351
335
|
|
|
@@ -396,7 +380,7 @@ export async function renderIslandPage(pageObj, assetTags) {
|
|
|
396
380
|
|
|
397
381
|
return \`<!doctype html>
|
|
398
382
|
<html\${htmlAttrs}>
|
|
399
|
-
<head>\${headHtml}\${
|
|
383
|
+
<head>\${headHtml}\${assetTags.css}\${__pagesNeedingClientJS.has(pageObj.component) ? assetTags.preloads : ""}\${__pagesNeedingClientJS.has(pageObj.component) ? generateHydrationScript() : ""}</head>
|
|
400
384
|
<body\${bodyAttrs}>
|
|
401
385
|
<div id="app"\${__mdScriptAttr}>\${html}</div>
|
|
402
386
|
\${__pagesNeedingClientJS.has(pageObj.component) ? assetTags.body : ""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@void/solid",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/voidzero-dev/void.git",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"solid-js": "^1.9.12",
|
|
44
44
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.20",
|
|
45
45
|
"vite-plus": "^0.1.20",
|
|
46
|
-
"void": "0.7.
|
|
46
|
+
"void": "0.7.6"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"solid-js": "^1.9.0",
|
|
50
50
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.20",
|
|
51
|
-
"void": "0.7.
|
|
51
|
+
"void": "0.7.6"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "vp pack",
|