honox 0.1.54 → 0.1.56
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/client/client.d.ts +21 -20
- package/dist/client/client.js +56 -77
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +2 -3
- package/dist/client/runtime.d.ts +5 -4
- package/dist/client/runtime.js +110 -141
- package/dist/client/utils/filter.d.ts +3 -2
- package/dist/client/utils/filter.js +5 -6
- package/dist/constants.d.ts +3 -2
- package/dist/constants.js +4 -7
- package/dist/factory/factory.d.ts +8 -7
- package/dist/factory/factory.js +6 -5
- package/dist/factory/index.d.ts +2 -4
- package/dist/factory/index.js +3 -5
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -0
- package/dist/server/base.d.ts +2 -4
- package/dist/server/base.js +2 -3
- package/dist/server/components/has-islands.d.ts +7 -4
- package/dist/server/components/has-islands.js +9 -9
- package/dist/server/components/index.d.ts +4 -6
- package/dist/server/components/index.js +2 -5
- package/dist/server/components/link.d.ts +8 -7
- package/dist/server/components/link.js +34 -39
- package/dist/server/components/script.d.ts +9 -8
- package/dist/server/components/script.js +33 -37
- package/dist/server/context-storage.d.ts +5 -4
- package/dist/server/context-storage.js +5 -3
- package/dist/server/index.d.ts +7 -11
- package/dist/server/index.js +6 -4
- package/dist/server/server.d.ts +27 -30
- package/dist/server/server.js +227 -275
- package/dist/server/utils/file.d.ts +3 -2
- package/dist/server/utils/file.js +38 -66
- package/dist/server/utils/path.d.ts +3 -2
- package/dist/server/utils/path.js +5 -4
- package/dist/server/with-defaults.d.ts +8 -8
- package/dist/server/with-defaults.js +26 -40
- package/dist/types.d.ts +7 -6
- package/dist/types.js +1 -0
- package/dist/vite/client.d.ts +7 -6
- package/dist/vite/client.js +24 -30
- package/dist/vite/components/honox-island.d.ts +15 -9
- package/dist/vite/components/honox-island.js +39 -50
- package/dist/vite/components/index.d.ts +2 -2
- package/dist/vite/components/index.js +2 -3
- package/dist/vite/index.d.ts +20 -20
- package/dist/vite/index.js +37 -52
- package/dist/vite/inject-importing-islands.d.ts +6 -5
- package/dist/vite/inject-importing-islands.js +64 -91
- package/dist/vite/island-components.d.ts +11 -10
- package/dist/vite/island-components.js +128 -209
- package/dist/vite/restart-on-add-unlink.d.ts +4 -3
- package/dist/vite/restart-on-add-unlink.js +16 -15
- package/dist/vite/utils/path.d.ts +3 -2
- package/dist/vite/utils/path.js +25 -9
- package/package.json +41 -54
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Fragment, jsx } from "hono/jsx/jsx-runtime";
|
|
2
1
|
import { IMPORTING_ISLANDS_ID } from "../../constants.js";
|
|
3
2
|
import { contextStorage } from "../context-storage.js";
|
|
3
|
+
import { Fragment, jsx } from "hono/jsx/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/server/components/has-islands.tsx
|
|
4
6
|
const HasIslands = ({ children }) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
return /* @__PURE__ */ jsx(Fragment, { children: c.get(IMPORTING_ISLANDS_ID) && children });
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
HasIslands
|
|
7
|
+
const c = contextStorage.getStore();
|
|
8
|
+
if (!c) throw new Error("No context found");
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, { children: c.get(IMPORTING_ISLANDS_ID) && children });
|
|
13
10
|
};
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { HasIslands };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import 'hono/jsx';
|
|
6
|
-
import 'hono/jsx/jsx-runtime';
|
|
1
|
+
import { HasIslands } from "./has-islands.js";
|
|
2
|
+
import { Script } from "./script.js";
|
|
3
|
+
import { Link } from "./link.js";
|
|
4
|
+
export { HasIslands, Link, Script };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Manifest } from "vite";
|
|
2
|
+
import { FC } from "hono/jsx";
|
|
3
|
+
import { JSX } from "hono/jsx/jsx-runtime";
|
|
4
4
|
|
|
5
|
+
//#region src/server/components/link.d.ts
|
|
5
6
|
type Options = {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
manifest?: Manifest;
|
|
8
|
+
prod?: boolean;
|
|
8
9
|
} & JSX.IntrinsicElements['link'];
|
|
9
10
|
declare const Link: FC<Options>;
|
|
10
|
-
|
|
11
|
-
export { Link };
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Link };
|
|
@@ -1,42 +1,37 @@
|
|
|
1
|
-
import { Fragment, jsx } from "hono/jsx/jsx-runtime";
|
|
2
1
|
import { ensureTrailngSlash } from "../utils/path.js";
|
|
2
|
+
import { Fragment, jsx } from "hono/jsx/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/server/components/link.tsx
|
|
3
5
|
const Link = (options) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
return /* @__PURE__ */ jsx(Fragment, {});
|
|
34
|
-
} else {
|
|
35
|
-
return /* @__PURE__ */ jsx("link", { href, ...rest });
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return /* @__PURE__ */ jsx("link", { ...rest });
|
|
39
|
-
};
|
|
40
|
-
export {
|
|
41
|
-
Link
|
|
6
|
+
let { href, prod, manifest, ...rest } = options;
|
|
7
|
+
if (href) if (prod ?? import.meta.env.PROD) {
|
|
8
|
+
if (!manifest) {
|
|
9
|
+
const MANIFEST = import.meta.glob("/dist/.vite/manifest.json", { eager: true });
|
|
10
|
+
for (const [, manifestFile] of Object.entries(MANIFEST)) if (manifestFile["default"]) {
|
|
11
|
+
manifest = manifestFile["default"];
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
if (manifest) {
|
|
16
|
+
const assetInManifest = manifest[href.replace(/^\//, "")];
|
|
17
|
+
if (assetInManifest) {
|
|
18
|
+
if (href.startsWith("/")) return /* @__PURE__ */ jsx("link", {
|
|
19
|
+
href: `${ensureTrailngSlash(import.meta.env.BASE_URL)}${assetInManifest.file}`,
|
|
20
|
+
...rest
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ jsx("link", {
|
|
23
|
+
href: assetInManifest.file,
|
|
24
|
+
...rest
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
29
|
+
} else return /* @__PURE__ */ jsx("link", {
|
|
30
|
+
href,
|
|
31
|
+
...rest
|
|
32
|
+
});
|
|
33
|
+
return /* @__PURE__ */ jsx("link", { ...rest });
|
|
42
34
|
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { Link };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { Manifest } from
|
|
1
|
+
import { Manifest } from "vite";
|
|
2
2
|
|
|
3
|
+
//#region src/server/components/script.d.ts
|
|
3
4
|
type Options = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
src: string;
|
|
6
|
+
async?: boolean;
|
|
7
|
+
prod?: boolean;
|
|
8
|
+
manifest?: Manifest;
|
|
9
|
+
nonce?: string;
|
|
9
10
|
};
|
|
10
11
|
declare const Script: (options: Options) => any;
|
|
11
|
-
|
|
12
|
-
export { Script };
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Script };
|
|
@@ -1,40 +1,36 @@
|
|
|
1
|
-
import { Fragment, jsx } from "hono/jsx/jsx-runtime";
|
|
2
|
-
import { ensureTrailngSlash } from "../utils/path.js";
|
|
3
1
|
import { HasIslands } from "./has-islands.js";
|
|
2
|
+
import { ensureTrailngSlash } from "../utils/path.js";
|
|
3
|
+
import { Fragment, jsx } from "hono/jsx/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/server/components/script.tsx
|
|
4
6
|
const Script = (options) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return /* @__PURE__ */ jsx(Fragment, {});
|
|
34
|
-
} else {
|
|
35
|
-
return /* @__PURE__ */ jsx("script", { type: "module", async: !!options.async, src, nonce: options.nonce });
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
export {
|
|
39
|
-
Script
|
|
7
|
+
const src = options.src;
|
|
8
|
+
if (options.prod ?? import.meta.env.PROD) {
|
|
9
|
+
let manifest = options.manifest;
|
|
10
|
+
if (!manifest) {
|
|
11
|
+
const MANIFEST = import.meta.glob("/dist/.vite/manifest.json", { eager: true });
|
|
12
|
+
for (const [, manifestFile] of Object.entries(MANIFEST)) if (manifestFile["default"]) {
|
|
13
|
+
manifest = manifestFile["default"];
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (manifest) {
|
|
18
|
+
const scriptInManifest = manifest[src.replace(/^\//, "")];
|
|
19
|
+
if (scriptInManifest) return /* @__PURE__ */ jsx(HasIslands, { children: /* @__PURE__ */ jsx("script", {
|
|
20
|
+
type: "module",
|
|
21
|
+
async: !!options.async,
|
|
22
|
+
src: `${ensureTrailngSlash(import.meta.env.BASE_URL)}${scriptInManifest.file}`,
|
|
23
|
+
nonce: options.nonce
|
|
24
|
+
}) });
|
|
25
|
+
}
|
|
26
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
27
|
+
} else return /* @__PURE__ */ jsx("script", {
|
|
28
|
+
type: "module",
|
|
29
|
+
async: !!options.async,
|
|
30
|
+
src,
|
|
31
|
+
nonce: options.nonce
|
|
32
|
+
});
|
|
40
33
|
};
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { Script };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Context } from
|
|
2
|
-
import { AsyncLocalStorage } from
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
|
|
4
|
+
//#region src/server/context-storage.d.ts
|
|
4
5
|
declare const contextStorage: AsyncLocalStorage<Context<any, any, {}>>;
|
|
5
|
-
|
|
6
|
-
export { contextStorage };
|
|
6
|
+
//#endregion
|
|
7
|
+
export { contextStorage };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import '../constants.js';
|
|
9
|
-
import 'vite';
|
|
10
|
-
import 'hono/jsx';
|
|
11
|
-
import 'hono/jsx/jsx-runtime';
|
|
1
|
+
import { ServerOptions } from "./server.js";
|
|
2
|
+
import { HasIslands } from "./components/has-islands.js";
|
|
3
|
+
import { Script } from "./components/script.js";
|
|
4
|
+
import { Link } from "./components/link.js";
|
|
5
|
+
import "./components/index.js";
|
|
6
|
+
import { createApp } from "./with-defaults.js";
|
|
7
|
+
export { HasIslands, Link, Script, type ServerOptions, createApp };
|
package/dist/server/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createApp } from "./with-defaults.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { HasIslands } from "./components/has-islands.js";
|
|
3
|
+
import { Script } from "./components/script.js";
|
|
4
|
+
import { Link } from "./components/link.js";
|
|
5
|
+
import "./components/index.js";
|
|
6
|
+
|
|
7
|
+
export { HasIslands, Link, Script, createApp };
|
package/dist/server/server.d.ts
CHANGED
|
@@ -1,49 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { IMPORTING_ISLANDS_ID } from "../constants.js";
|
|
2
|
+
import { Env, ErrorHandler, Hono, MiddlewareHandler, NotFoundHandler } from "hono";
|
|
3
|
+
import { H } from "hono/types";
|
|
4
4
|
|
|
5
|
+
//#region src/server/server.d.ts
|
|
5
6
|
declare const METHODS: readonly ["GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"];
|
|
6
|
-
type HasIslandFile = {
|
|
7
|
-
[key in typeof IMPORTING_ISLANDS_ID]?: boolean;
|
|
8
|
-
};
|
|
7
|
+
type HasIslandFile = { [key in typeof IMPORTING_ISLANDS_ID]?: boolean };
|
|
9
8
|
type InnerMeta = {} & HasIslandFile;
|
|
10
9
|
type AppFile = {
|
|
11
|
-
|
|
10
|
+
default: Hono;
|
|
12
11
|
} & InnerMeta;
|
|
13
12
|
type RouteFile = {
|
|
14
|
-
|
|
15
|
-
} & {
|
|
16
|
-
[M in (typeof METHODS)[number]]?: H[];
|
|
17
|
-
} & InnerMeta;
|
|
13
|
+
default?: Function;
|
|
14
|
+
} & { [M in (typeof METHODS)[number]]?: H[] } & InnerMeta;
|
|
18
15
|
type RendererFile = {
|
|
19
|
-
|
|
16
|
+
default: MiddlewareHandler;
|
|
20
17
|
} & InnerMeta;
|
|
21
18
|
type NotFoundFile = {
|
|
22
|
-
|
|
19
|
+
default: NotFoundHandler;
|
|
23
20
|
} & InnerMeta;
|
|
24
21
|
type ErrorFile = {
|
|
25
|
-
|
|
22
|
+
default: ErrorHandler;
|
|
26
23
|
} & InnerMeta;
|
|
27
24
|
type MiddlewareFile = {
|
|
28
|
-
|
|
25
|
+
default: MiddlewareHandler[];
|
|
29
26
|
};
|
|
30
27
|
type InitFunction<E extends Env = Env> = (app: Hono<E>) => void;
|
|
31
28
|
type BaseServerOptions<E extends Env = Env> = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
ROUTES: Record<string, RouteFile | AppFile>;
|
|
30
|
+
RENDERER: Record<string, RendererFile>;
|
|
31
|
+
NOT_FOUND: Record<string, NotFoundFile>;
|
|
32
|
+
ERROR: Record<string, ErrorFile>;
|
|
33
|
+
MIDDLEWARE: Record<string, MiddlewareFile>;
|
|
34
|
+
root: string;
|
|
35
|
+
app?: Hono<E>;
|
|
36
|
+
init?: InitFunction<E>;
|
|
37
|
+
/**
|
|
38
|
+
* Appends a trailing slash to URL if the route file is an index file, e.g., `index.tsx` or `index.mdx`.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
trailingSlash?: boolean;
|
|
45
42
|
};
|
|
46
43
|
type ServerOptions<E extends Env = Env> = Partial<BaseServerOptions<E>>;
|
|
47
44
|
declare const createApp: <E extends Env>(options: BaseServerOptions<E>) => Hono<E>;
|
|
48
|
-
|
|
49
|
-
export {
|
|
45
|
+
//#endregion
|
|
46
|
+
export { ServerOptions, createApp };
|