@riebeckite/honox 0.2.0 → 0.3.1
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/index.js +37 -18
- package/dist/src/client_module.d.ts +5 -1
- package/dist/src/vite_plugin.d.ts +1 -1
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -3213,6 +3213,10 @@ async function createClientModule(config, development) {
|
|
|
3213
3213
|
}
|
|
3214
3214
|
}
|
|
3215
3215
|
const hasRuntimes = runtimeEntries.size > 0;
|
|
3216
|
+
const uiConfig = {
|
|
3217
|
+
...config.ui?.locale === void 0 ? {} : { locale: config.ui.locale },
|
|
3218
|
+
...config.ui?.labels === void 0 ? {} : { labels: config.ui.labels }
|
|
3219
|
+
};
|
|
3216
3220
|
imports.push('import { ClientLifecycle } from "@riebeckite/core/client";');
|
|
3217
3221
|
if (interactiveMarkdownComponents.length > 0) {
|
|
3218
3222
|
imports.push('import { hydrateRoot } from "hono/jsx/dom/client";');
|
|
@@ -3307,6 +3311,7 @@ function createPluginRuntimeHost(root, ids) {
|
|
|
3307
3311
|
` : "";
|
|
3308
3312
|
return `${imports.join("\n")}
|
|
3309
3313
|
|
|
3314
|
+
globalThis.__riebeckiteUi = ${serializePublicClientConfig(uiConfig)};
|
|
3310
3315
|
const lifecycle = new ClientLifecycle();
|
|
3311
3316
|
${runtimeSupport}const clientModuleDevelopment = ${development ? "true" : "false"};
|
|
3312
3317
|
const conditionalInitializerLoads = new Map();
|
|
@@ -3592,9 +3597,11 @@ function riebeckiteContentWatch(options) {
|
|
|
3592
3597
|
if (timer) clearTimeout(timer);
|
|
3593
3598
|
timer = setTimeout(() => {
|
|
3594
3599
|
timer = void 0;
|
|
3595
|
-
void invalidateApplicationRuntime(server, appRoot)
|
|
3596
|
-
|
|
3597
|
-
|
|
3600
|
+
void invalidateApplicationRuntime(server, appRoot).catch(() => {
|
|
3601
|
+
}).then(() => {
|
|
3602
|
+
options.onInvalidate?.(server);
|
|
3603
|
+
server.hot.send({ type: "full-reload" });
|
|
3604
|
+
});
|
|
3598
3605
|
}, CONTENT_RELOAD_DEBOUNCE_MS);
|
|
3599
3606
|
};
|
|
3600
3607
|
server.httpServer?.once("close", () => {
|
|
@@ -3989,7 +3996,7 @@ async function hasViteConfig(directory) {
|
|
|
3989
3996
|
}
|
|
3990
3997
|
|
|
3991
3998
|
// src/vite_plugin.ts
|
|
3992
|
-
function riebeckite(options = {}
|
|
3999
|
+
function riebeckite(options = {}) {
|
|
3993
4000
|
let resolvedConfig;
|
|
3994
4001
|
let application;
|
|
3995
4002
|
let contentVitePlugins = [];
|
|
@@ -4019,7 +4026,6 @@ function riebeckite(options = {}, onApplicationResolved) {
|
|
|
4019
4026
|
}) ?? []
|
|
4020
4027
|
);
|
|
4021
4028
|
application = resolvedApplication;
|
|
4022
|
-
onApplicationResolved?.(resolvedApplication);
|
|
4023
4029
|
await writeRiebeckiteAssetEntries(resolvedConfig, {
|
|
4024
4030
|
frameworkStyles: path13.join(
|
|
4025
4031
|
applicationAppRoot,
|
|
@@ -4207,9 +4213,11 @@ function warmFirstPage(server, origin) {
|
|
|
4207
4213
|
async function waitForDevWarmup(origin, timeoutMs = 3e5) {
|
|
4208
4214
|
const deadline = performance.now() + timeoutMs;
|
|
4209
4215
|
while (performance.now() < deadline) {
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4216
|
+
for (const candidate of loopbackProbeUrls(origin)) {
|
|
4217
|
+
try {
|
|
4218
|
+
return (await fetch(candidate, { redirect: "manual" })).status;
|
|
4219
|
+
} catch {
|
|
4220
|
+
}
|
|
4213
4221
|
}
|
|
4214
4222
|
await new Promise((resolve7) => {
|
|
4215
4223
|
setTimeout(resolve7, 100).unref();
|
|
@@ -4217,6 +4225,20 @@ async function waitForDevWarmup(origin, timeoutMs = 3e5) {
|
|
|
4217
4225
|
}
|
|
4218
4226
|
return void 0;
|
|
4219
4227
|
}
|
|
4228
|
+
function loopbackProbeUrls(url) {
|
|
4229
|
+
let parsed;
|
|
4230
|
+
try {
|
|
4231
|
+
parsed = new URL(url);
|
|
4232
|
+
} catch {
|
|
4233
|
+
return [url];
|
|
4234
|
+
}
|
|
4235
|
+
if (parsed.hostname.toLowerCase() !== "localhost") return [url];
|
|
4236
|
+
const ipv4 = new URL(url);
|
|
4237
|
+
ipv4.hostname = "127.0.0.1";
|
|
4238
|
+
const ipv6 = new URL(url);
|
|
4239
|
+
ipv6.hostname = "[::1]";
|
|
4240
|
+
return [url, ipv4.href, ipv6.href];
|
|
4241
|
+
}
|
|
4220
4242
|
function contentBareImportResolver(getApplication, ensure) {
|
|
4221
4243
|
return {
|
|
4222
4244
|
name: "riebeckite-content-bare-imports",
|
|
@@ -4314,18 +4336,14 @@ function requireApplication(application) {
|
|
|
4314
4336
|
}
|
|
4315
4337
|
function riebeckiteVite(options = {}) {
|
|
4316
4338
|
const { ssg, ssrExternals, ...integration } = options;
|
|
4317
|
-
const fallbackSiteRoot = integration.configRoot ?? integration.appRoot;
|
|
4318
|
-
let resolvedSiteRoot;
|
|
4319
4339
|
return [
|
|
4320
|
-
...riebeckite(integration,
|
|
4321
|
-
resolvedSiteRoot = application.configRoot;
|
|
4322
|
-
}),
|
|
4340
|
+
...riebeckite(integration),
|
|
4323
4341
|
riebeckiteSsrExternals(
|
|
4324
4342
|
[...defaultSsrExternals, ...ssrExternals ?? []],
|
|
4325
|
-
() => {
|
|
4343
|
+
(viteRoot) => {
|
|
4326
4344
|
if (integration.workspaceRoot) return [];
|
|
4327
|
-
const siteRoot =
|
|
4328
|
-
return
|
|
4345
|
+
const siteRoot = integration.configRoot ?? integration.appRoot ?? viteRoot;
|
|
4346
|
+
return siteRiebeckiteExternals(siteRoot);
|
|
4329
4347
|
}
|
|
4330
4348
|
),
|
|
4331
4349
|
createRiebeckiteSsg(ssg)
|
|
@@ -4334,12 +4352,13 @@ function riebeckiteVite(options = {}) {
|
|
|
4334
4352
|
function riebeckiteSsrExternals(externals, siteExternals = () => []) {
|
|
4335
4353
|
return {
|
|
4336
4354
|
name: "riebeckite-ssr-externals",
|
|
4337
|
-
config() {
|
|
4355
|
+
config(userConfig) {
|
|
4356
|
+
const viteRoot = userConfig.root ? path13.resolve(userConfig.root) : process.cwd();
|
|
4338
4357
|
return {
|
|
4339
4358
|
environments: {
|
|
4340
4359
|
ssr: {
|
|
4341
4360
|
resolve: {
|
|
4342
|
-
external: [...externals, ...siteExternals()]
|
|
4361
|
+
external: [...externals, ...siteExternals(viteRoot)]
|
|
4343
4362
|
}
|
|
4344
4363
|
}
|
|
4345
4364
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { ResolvedRiebeckiteConfig } from "@riebeckite/core";
|
|
2
2
|
import type { Plugin } from "vite";
|
|
3
|
-
|
|
3
|
+
type ClientModuleConfig = Pick<ResolvedRiebeckiteConfig, "plugins" | "spa"> & {
|
|
4
|
+
ui?: ResolvedRiebeckiteConfig["ui"];
|
|
5
|
+
};
|
|
6
|
+
export declare function riebeckiteClientModule(getConfig: () => ClientModuleConfig, ensure?: () => Promise<unknown>): Plugin;
|
|
7
|
+
export {};
|
|
@@ -14,7 +14,7 @@ export type RiebeckiteViteOptions = RiebeckiteIntegrationOptions & {
|
|
|
14
14
|
/** SSG overrides. A normal site does not need them. */
|
|
15
15
|
ssg?: RiebeckiteSsgOptions;
|
|
16
16
|
};
|
|
17
|
-
export declare function riebeckite(options?: RiebeckiteViteOptions
|
|
17
|
+
export declare function riebeckite(options?: RiebeckiteViteOptions): Plugin[];
|
|
18
18
|
export declare function riebeckiteContentWarmup(enabled: boolean, getApplication: () => Promise<ResolvedHonoxApplication>): Plugin;
|
|
19
19
|
/**
|
|
20
20
|
* Higher-level helper that registers the complete Riebeckite Vite integration
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/honox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,17 +44,17 @@
|
|
|
44
44
|
"hono": "^4.13.18",
|
|
45
45
|
"honox": "0.1.62",
|
|
46
46
|
"vite": "^8.3.7",
|
|
47
|
-
"@riebeckite/
|
|
48
|
-
"@riebeckite/
|
|
49
|
-
"@riebeckite/node": "0.
|
|
50
|
-
"@riebeckite/
|
|
51
|
-
"@riebeckite/
|
|
52
|
-
"@riebeckite/runtime": "0.
|
|
53
|
-
"@riebeckite/spa": "0.
|
|
54
|
-
"@riebeckite/ui": "0.
|
|
47
|
+
"@riebeckite/ai": "0.3.1",
|
|
48
|
+
"@riebeckite/dev-inspector": "0.3.1",
|
|
49
|
+
"@riebeckite/node": "0.3.1",
|
|
50
|
+
"@riebeckite/plugin-color-mode": "0.3.1",
|
|
51
|
+
"@riebeckite/og-image": "0.3.1",
|
|
52
|
+
"@riebeckite/runtime": "0.3.1",
|
|
53
|
+
"@riebeckite/spa": "0.3.1",
|
|
54
|
+
"@riebeckite/ui": "0.3.1"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@riebeckite/core": "^0.
|
|
57
|
+
"@riebeckite/core": "^0.3.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@d2lang/d2": "^0.1.34",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"@hono/vite-build": "^1.11.1",
|
|
63
63
|
"@marp-team/marp-core": "^4.4.0",
|
|
64
64
|
"tsx": "^4.22.4",
|
|
65
|
-
"@riebeckite/
|
|
66
|
-
"@riebeckite/
|
|
67
|
-
"@riebeckite/test": "0.
|
|
65
|
+
"@riebeckite/plugin-bases": "0.3.1",
|
|
66
|
+
"@riebeckite/core": "0.3.1",
|
|
67
|
+
"@riebeckite/test": "0.3.1"
|
|
68
68
|
},
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"static-site-generator"
|
|
94
94
|
],
|
|
95
95
|
"engines": {
|
|
96
|
-
"node": "^
|
|
96
|
+
"node": "^22.13.0 || ^24.0.0 || ^26.0.0"
|
|
97
97
|
},
|
|
98
98
|
"sideEffects": [
|
|
99
99
|
"./style.css"
|