@riebeckite/honox 0.2.0 → 0.3.0

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 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
- options.onInvalidate?.(server);
3597
- server.hot.send({ type: "full-reload" });
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 = {}, onApplicationResolved) {
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,
@@ -4314,18 +4320,14 @@ function requireApplication(application) {
4314
4320
  }
4315
4321
  function riebeckiteVite(options = {}) {
4316
4322
  const { ssg, ssrExternals, ...integration } = options;
4317
- const fallbackSiteRoot = integration.configRoot ?? integration.appRoot;
4318
- let resolvedSiteRoot;
4319
4323
  return [
4320
- ...riebeckite(integration, (application) => {
4321
- resolvedSiteRoot = application.configRoot;
4322
- }),
4324
+ ...riebeckite(integration),
4323
4325
  riebeckiteSsrExternals(
4324
4326
  [...defaultSsrExternals, ...ssrExternals ?? []],
4325
- () => {
4327
+ (viteRoot) => {
4326
4328
  if (integration.workspaceRoot) return [];
4327
- const siteRoot = resolvedSiteRoot ?? fallbackSiteRoot;
4328
- return siteRoot ? siteRiebeckiteExternals(siteRoot) : [];
4329
+ const siteRoot = integration.configRoot ?? integration.appRoot ?? viteRoot;
4330
+ return siteRiebeckiteExternals(siteRoot);
4329
4331
  }
4330
4332
  ),
4331
4333
  createRiebeckiteSsg(ssg)
@@ -4334,12 +4336,13 @@ function riebeckiteVite(options = {}) {
4334
4336
  function riebeckiteSsrExternals(externals, siteExternals = () => []) {
4335
4337
  return {
4336
4338
  name: "riebeckite-ssr-externals",
4337
- config() {
4339
+ config(userConfig) {
4340
+ const viteRoot = userConfig.root ? path13.resolve(userConfig.root) : process.cwd();
4338
4341
  return {
4339
4342
  environments: {
4340
4343
  ssr: {
4341
4344
  resolve: {
4342
- external: [...externals, ...siteExternals()]
4345
+ external: [...externals, ...siteExternals(viteRoot)]
4343
4346
  }
4344
4347
  }
4345
4348
  }
@@ -1,3 +1,7 @@
1
1
  import type { ResolvedRiebeckiteConfig } from "@riebeckite/core";
2
2
  import type { Plugin } from "vite";
3
- export declare function riebeckiteClientModule(getConfig: () => Pick<ResolvedRiebeckiteConfig, "plugins" | "spa">, ensure?: () => Promise<unknown>): Plugin;
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, onApplicationResolved?: (application: ResolvedHonoxApplication) => void): Plugin[];
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.2.0",
3
+ "version": "0.3.0",
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/dev-inspector": "0.2.0",
48
- "@riebeckite/ai": "0.2.0",
49
- "@riebeckite/node": "0.2.0",
50
- "@riebeckite/og-image": "0.2.0",
51
- "@riebeckite/plugin-color-mode": "0.2.0",
52
- "@riebeckite/runtime": "0.2.0",
53
- "@riebeckite/spa": "0.2.0",
54
- "@riebeckite/ui": "0.2.0"
47
+ "@riebeckite/ai": "0.3.0",
48
+ "@riebeckite/dev-inspector": "0.3.0",
49
+ "@riebeckite/og-image": "0.3.0",
50
+ "@riebeckite/plugin-color-mode": "0.3.0",
51
+ "@riebeckite/node": "0.3.0",
52
+ "@riebeckite/runtime": "0.3.0",
53
+ "@riebeckite/ui": "0.3.0",
54
+ "@riebeckite/spa": "0.3.0"
55
55
  },
56
56
  "peerDependencies": {
57
- "@riebeckite/core": "^0.2.0"
57
+ "@riebeckite/core": "^0.3.0"
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/core": "0.2.0",
66
- "@riebeckite/plugin-bases": "0.2.0",
67
- "@riebeckite/test": "0.2.0"
65
+ "@riebeckite/test": "0.3.0",
66
+ "@riebeckite/core": "0.3.0",
67
+ "@riebeckite/plugin-bases": "0.3.0"
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": "^20.19.0 || >=22.12.0"
96
+ "node": "^22.13.0 || ^24.0.0 || ^26.0.0"
97
97
  },
98
98
  "sideEffects": [
99
99
  "./style.css"