@ilha/void 0.1.3 → 0.1.5
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/README.md +1 -1
- package/dist/{action-hKFilV-5.js → action-BRNiFP0W.js} +1 -2
- package/dist/{app-C92pEfKv.js → app-D-k4nVyl.js} +2 -3
- package/dist/client.js +4 -5
- package/dist/{context-fQy_XW7o.js → context-BzyAcQF0.js} +1 -2
- package/dist/index.js +9 -16
- package/dist/islands.js +1 -2
- package/dist/plugin.js +6 -9
- package/dist/server.js +3 -4
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Render [Void](https://void.cloud) pages, layouts, forms, and islands with [Ilha]
|
|
|
10
10
|
bun add @ilha/void
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
`ilha`, `vite`, and `void` are peer dependencies. Void needs Node.js 24.21 or newer.
|
|
13
|
+
`ilha`, `vite`, and `void` are peer dependencies. Void needs Node.js 24.21 or newer. Requires `void ^1.1.12`: upgrade with `bun add void@^1.1.12` — older Void releases lack the islands API this package builds on.
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { createActionClient } from "void/pages-client";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/action.ts
|
|
4
4
|
const client = createActionClient();
|
|
5
5
|
/** Call a page action; uses the Void Router once a regular page hydrates. */
|
|
6
6
|
const action = client.action;
|
|
7
7
|
const setActionRouter = client.setActionRouter;
|
|
8
8
|
|
|
9
|
-
//#endregion
|
|
10
9
|
export { setActionRouter as n, action as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as VoidContext } from "./context-
|
|
1
|
+
import { t as VoidContext } from "./context-BzyAcQF0.js";
|
|
2
2
|
import { atom, h } from "ilha";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/app.ts
|
|
5
5
|
const composeTree = ({ layouts, page, pageKey, props, state }) => {
|
|
6
6
|
if (!page) return null;
|
|
7
7
|
let view = h(page, {
|
|
@@ -46,5 +46,4 @@ const routeData = (pageData) => ({
|
|
|
46
46
|
shared: pageData.shared ?? {}
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
//#endregion
|
|
50
49
|
export { loadPageComponents as n, routeData as r, createPageRoot as t };
|
package/dist/client.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as setActionRouter } from "./action-
|
|
2
|
-
import { n as createPageState } from "./context-
|
|
3
|
-
import { r as routeData, t as createPageRoot } from "./app-
|
|
1
|
+
import { n as setActionRouter } from "./action-BRNiFP0W.js";
|
|
2
|
+
import { n as createPageState } from "./context-BzyAcQF0.js";
|
|
3
|
+
import { r as routeData, t as createPageRoot } from "./app-D-k4nVyl.js";
|
|
4
4
|
import { createRouterFacade, createVoidRouter, idleNavigationState } from "void/pages-client";
|
|
5
5
|
import { mount } from "ilha";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/client.ts
|
|
8
8
|
const sameParams = (a, b) => {
|
|
9
9
|
const keys = Object.keys(a);
|
|
10
10
|
return keys.length === Object.keys(b).length && keys.every((key) => a[key] === b[key]);
|
|
@@ -142,5 +142,4 @@ const startPages = async ({ components, layoutTree, ...config }) => {
|
|
|
142
142
|
return facade;
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
-
//#endregion
|
|
146
145
|
export { startPages };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext } from "ilha";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/context.ts
|
|
4
4
|
const VoidContext = createContext(null);
|
|
5
5
|
/**
|
|
6
6
|
* Freeze page state for `VoidContext.Provider`. The provider keeps its value
|
|
@@ -9,5 +9,4 @@ const VoidContext = createContext(null);
|
|
|
9
9
|
*/
|
|
10
10
|
const createPageState = (state) => Object.freeze({ ...state });
|
|
11
11
|
|
|
12
|
-
//#endregion
|
|
13
12
|
export { createPageState as n, VoidContext as t };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as setActionRouter, t as action } from "./action-
|
|
2
|
-
import { t as VoidContext } from "./context-
|
|
1
|
+
import { n as setActionRouter, t as action } from "./action-BRNiFP0W.js";
|
|
2
|
+
import { t as VoidContext } from "./context-BzyAcQF0.js";
|
|
3
3
|
import { VoidActionError, categorizeActionError, formErrorMessage, formRetryMessage, formSubmissionBlocked, getValidationErrors, idleNavigationState, interpolateRouteParams, isAbortError, isEqualFormValue, isModifiedEvent, mergeDataIntoHref, scheduleFormRetry, ssrProxy, submitAction } from "void/pages-client";
|
|
4
4
|
import { atom, batch, context, h, watch } from "ilha";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/form.ts
|
|
7
7
|
/**
|
|
8
8
|
* Submit `form` on `submit`, show its error, and block resubmits while a
|
|
9
9
|
* rate-limit retry window is open.
|
|
@@ -28,8 +28,7 @@ const Form = ({ children, form, method = "post", renderError, ...attributes }) =
|
|
|
28
28
|
}, error && renderError ? renderError(error) : message, retry ? h("p", null, retry) : null) : null, children);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
//#region src/hooks.ts
|
|
31
|
+
// src/hooks.ts
|
|
33
32
|
const readPage = (hook) => {
|
|
34
33
|
const page = context(VoidContext)();
|
|
35
34
|
if (!page) throw new Error(`${hook}: must be used inside a Void page.`);
|
|
@@ -46,8 +45,7 @@ const useNavigation = () => context(VoidContext)()?.navigation ?? idleNavigation
|
|
|
46
45
|
/** Validation errors the last page action returned. */
|
|
47
46
|
const usePageErrors = () => context(VoidContext)()?.errors ?? {};
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
//#region src/link.ts
|
|
48
|
+
// src/link.ts
|
|
51
49
|
const DEFAULT_HOVER_DELAY = 75;
|
|
52
50
|
const isStrategyList = (prefetch) => Array.isArray(prefetch);
|
|
53
51
|
const strategiesOf = ({ prefetch, reloadDocument }) => {
|
|
@@ -161,8 +159,7 @@ const Link = (props) => {
|
|
|
161
159
|
}, children);
|
|
162
160
|
};
|
|
163
161
|
|
|
164
|
-
|
|
165
|
-
//#region src/use-link.ts
|
|
162
|
+
// src/use-link.ts
|
|
166
163
|
/**
|
|
167
164
|
* Bind router navigation to a native `<a>` without rendering a component.
|
|
168
165
|
*
|
|
@@ -208,8 +205,7 @@ const useLink = () => {
|
|
|
208
205
|
};
|
|
209
206
|
};
|
|
210
207
|
|
|
211
|
-
|
|
212
|
-
//#region src/form-state.ts
|
|
208
|
+
// src/form-state.ts
|
|
213
209
|
const RECENT_SUCCESS_MS = 2e3;
|
|
214
210
|
const without = (errors, fields) => Object.fromEntries(Object.entries(errors).filter(([field]) => !fields.includes(field)));
|
|
215
211
|
/**
|
|
@@ -298,8 +294,7 @@ const formState = (defaults, globalErrors = () => ({})) => {
|
|
|
298
294
|
};
|
|
299
295
|
};
|
|
300
296
|
|
|
301
|
-
|
|
302
|
-
//#region src/use-form.ts
|
|
297
|
+
// src/use-form.ts
|
|
303
298
|
const createForm = (url, defaults, options) => {
|
|
304
299
|
const router = useRouter();
|
|
305
300
|
const pageErrors = usePageErrors();
|
|
@@ -339,8 +334,7 @@ const createForm = (url, defaults, options) => {
|
|
|
339
334
|
*/
|
|
340
335
|
const useForm = createForm;
|
|
341
336
|
|
|
342
|
-
|
|
343
|
-
//#region src/use-island-form.ts
|
|
337
|
+
// src/use-island-form.ts
|
|
344
338
|
const UNPROCESSABLE = 422;
|
|
345
339
|
/** Read an action error body: JSON when the server sent JSON, else text. */
|
|
346
340
|
const readErrorBody = async (response) => {
|
|
@@ -400,5 +394,4 @@ const useIslandForm = (defaults) => {
|
|
|
400
394
|
});
|
|
401
395
|
};
|
|
402
396
|
|
|
403
|
-
//#endregion
|
|
404
397
|
export { Form, Link, VoidContext, action, setActionRouter, useForm, useIslandForm, useLink, useNavigation, usePageErrors, useParams, useRouter, useShared };
|
package/dist/islands.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mount } from "ilha";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/islands.ts
|
|
4
4
|
/**
|
|
5
5
|
* Mount one island from its `data-island` marker. The islands client entry
|
|
6
6
|
* passes this to Void's `initIslands`, which applies the hydration strategy.
|
|
@@ -11,5 +11,4 @@ const mountIsland = (el, { default: Component }, props) => {
|
|
|
11
11
|
el.dataset.hydrated = "true";
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
//#endregion
|
|
15
14
|
export { mountIsland };
|
package/dist/plugin.js
CHANGED
|
@@ -2,9 +2,9 @@ import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { generateComponentManifest, resolveEffectiveLayoutChain, resolvePagesDir, resolveStaticPageDataBuildOptions, scanPages } from "void/pages";
|
|
4
4
|
import { normalizePath } from "vite";
|
|
5
|
-
import { ISLANDS_CLIENT_ENTRY_ID, ISLANDS_RENDERER_ID, computePagesNeedingClientJS, editIslandSource, findIslandImports, findStaticCssImports,
|
|
5
|
+
import { ISLANDS_CLIENT_ENTRY_ID, ISLANDS_RENDERER_ID, computePagesNeedingClientJS, editIslandSource, findIslandImports, findStaticCssImports, hasIslandPages, resolveSpecifier, rewriteCssImportForVirtualModule, watchPagesForRescan } from "void/pages-islands-plugin";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/plugin-islands.ts
|
|
8
8
|
const COMPONENT_EXTENSIONS = [
|
|
9
9
|
".tsx",
|
|
10
10
|
".jsx",
|
|
@@ -115,8 +115,8 @@ const islandsPlugin = (pagesDir, { root }) => {
|
|
|
115
115
|
scan = await scanPages(root, { pagesDir });
|
|
116
116
|
prescan(scan);
|
|
117
117
|
},
|
|
118
|
-
config(_, env) {
|
|
119
|
-
if (env.command === "serve" || !existsSync(pagesDir) || !
|
|
118
|
+
async config(_, env) {
|
|
119
|
+
if (env.command === "serve" || !existsSync(pagesDir) || !await hasIslandPages(root, pagesDir)) return;
|
|
120
120
|
return { build: {
|
|
121
121
|
manifest: true,
|
|
122
122
|
rollupOptions: { input: { "islands-client": ISLANDS_CLIENT_ENTRY_ID } }
|
|
@@ -182,8 +182,7 @@ const islandsPlugin = (pagesDir, { root }) => {
|
|
|
182
182
|
};
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
//#region src/plugin-pages.ts
|
|
185
|
+
// src/plugin-pages.ts
|
|
187
186
|
const RENDERER_ID = "virtual:void-pages-renderer";
|
|
188
187
|
const CLIENT_ENTRY_ID = "virtual:void-pages-client";
|
|
189
188
|
const VIRTUAL_ID_RE = /^virtual:void-pages-(?:renderer|client)$/u;
|
|
@@ -305,8 +304,7 @@ const pagesPlugin = (pagesDir, options) => {
|
|
|
305
304
|
};
|
|
306
305
|
};
|
|
307
306
|
|
|
308
|
-
|
|
309
|
-
//#region src/plugin.ts
|
|
307
|
+
// src/plugin.ts
|
|
310
308
|
const readJson = (file) => {
|
|
311
309
|
try {
|
|
312
310
|
return JSON.parse(readFileSync(file, "utf-8"));
|
|
@@ -403,5 +401,4 @@ const voidIlha = (options = {}) => {
|
|
|
403
401
|
];
|
|
404
402
|
};
|
|
405
403
|
|
|
406
|
-
//#endregion
|
|
407
404
|
export { voidIlha };
|
package/dist/server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as createPageState } from "./context-
|
|
2
|
-
import { n as loadPageComponents, r as routeData, t as createPageRoot } from "./app-
|
|
1
|
+
import { n as createPageState } from "./context-BzyAcQF0.js";
|
|
2
|
+
import { n as loadPageComponents, r as routeData, t as createPageRoot } from "./app-D-k4nVyl.js";
|
|
3
3
|
import { createSsrRouter, idleNavigationState } from "void/pages-client";
|
|
4
4
|
import { h, renderToString, unsafe } from "ilha";
|
|
5
5
|
import { renderBodyAttrs, renderHeadToString, renderHtmlAttrs } from "void/pages-head";
|
|
6
6
|
import { serializePageData } from "void/pages-server";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/server.ts
|
|
9
9
|
const escapeAttr = (value) => value.replaceAll("&", "&").replaceAll("\"", """).replaceAll("<", "<");
|
|
10
10
|
const renderDocument = ({ app, body, head, pageObj }) => {
|
|
11
11
|
const pageHead = pageObj.head ? renderHeadToString(pageObj.head) : "";
|
|
@@ -91,5 +91,4 @@ const createIsland = (Component, { hydrate, id }) => async ({ children: _childre
|
|
|
91
91
|
}, unsafe(html));
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
//#endregion
|
|
95
94
|
export { createIsland, createIslandPageRenderer, createPageRenderer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilha/void",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Ilha pages, server rendering, islands, forms, and navigation for Void",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"frontend",
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
"test": "bun test"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"ilha": "^0.16.
|
|
64
|
-
"vite": "^8.3.
|
|
65
|
-
"void": "^1.
|
|
63
|
+
"ilha": "^0.16.1",
|
|
64
|
+
"vite": "^8.3.5",
|
|
65
|
+
"void": "^1.3.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"ilha": ">=0.16.
|
|
68
|
+
"ilha": ">=0.16.1",
|
|
69
69
|
"vite": "^8.0.0",
|
|
70
|
-
"void": "^1.1.
|
|
70
|
+
"void": "^1.1.12"
|
|
71
71
|
}
|
|
72
72
|
}
|