hono-decks 1.0.4 → 1.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono-decks",
3
- "version": "1.0.4",
3
+ "version": "1.2.0",
4
4
  "description": "Slide decks for Hono and Cloudflare Workers",
5
5
  "keywords": [
6
6
  "cloudflare-workers",
@@ -27,7 +27,8 @@
27
27
  "dist",
28
28
  "README.md",
29
29
  "README.ja.md",
30
- "skills"
30
+ "skills",
31
+ "vite-env.d.ts"
31
32
  ],
32
33
  "type": "module",
33
34
  "sideEffects": false,
@@ -55,6 +56,17 @@
55
56
  "./vite": {
56
57
  "types": "./dist/vite.d.ts",
57
58
  "import": "./dist/vite.js"
59
+ },
60
+ "./honox": {
61
+ "types": "./dist/honox.d.ts",
62
+ "import": "./dist/honox.js"
63
+ },
64
+ "./vite-env": {
65
+ "types": "./vite-env.d.ts"
66
+ },
67
+ "./adapters/hono-markdown": {
68
+ "types": "./dist/adapters/hono-markdown.d.ts",
69
+ "import": "./dist/adapters/hono-markdown.js"
58
70
  }
59
71
  },
60
72
  "publishConfig": {
@@ -71,6 +83,7 @@
71
83
  "check": "bun run typecheck && bun run test && bun run skills:validate"
72
84
  },
73
85
  "dependencies": {
86
+ "@babel/parser": "^7.29.3",
74
87
  "@mdx-js/mdx": "^3.1.1",
75
88
  "esbuild": "^0.28.1",
76
89
  "remark-directive": "^4.0.0",
@@ -8,6 +8,26 @@ Identify the package manager, application entry point, Hono environment type, bu
8
8
 
9
9
  ## Install and initialize
10
10
 
11
+ For an existing Hono + Vite app, use `npx hono-decks init --framework hono`.
12
+ For HonoX, use `npx hono-decks init --framework honox`. Both preserve package
13
+ scripts and Vite options, add virtual compilation and routing, and create a sample MDX
14
+ deck at `/slides/welcome`. Use normal `dev`/`build` without manual compile.
15
+ Hono accepts `--entry path/to/app.ts` if the conventional entry is ambiguous;
16
+ it expects a default-exported `const app = new Hono()`, and refuses conflicting
17
+ earlier routes. HonoX wraps the existing createApp options and adds a route using its public
18
+ ROUTES API. It preserves existing middleware and follows mountPath without a
19
+ physical route directory. Neither needs the Void adapter. Follow the README for supported
20
+ shapes and non-destructive fallbacks. The generic init below remains available
21
+ for manual integration and non-Vite applications.
22
+
23
+ For an existing Void app, use `npx hono-decks init --framework void` after
24
+ installing the compatible packages and Markdown peers described in the README.
25
+ Use `void-plugin-hono-jsx@^0.4.0` for its standalone compiler and client exports. Init connects the existing Vite config, creates the routing
26
+ middleware and a sample `.md` deck at `/slides/welcome`, and uses virtual modules without generated
27
+ files. Use the app's normal `dev` and `build` scripts without changes or a manual
28
+ compile. Existing `.mdx` files remain supported. Unsupported configs or existing
29
+ integration files cause a non-destructive error. The generic Hono flow follows.
30
+
11
31
  ```bash
12
32
  bun add hono hono-decks
13
33
  bunx hono-decks init
@@ -20,6 +40,14 @@ bunx hono-decks init
20
40
 
21
41
  Use the equivalent `npm`, `pnpm`, or Yarn commands when the repository does not use Bun.
22
42
 
43
+ ## Vite runtime entry
44
+
45
+ Framework init uses `virtual:hono-decks` with `/// <reference types="hono-decks/vite-env" />`.
46
+ It exports a configured `decks` kit and `createDecks(config)`. Vite dev/build keep
47
+ compiled modules in memory; do not add manual compile scripts, physical generated
48
+ imports, outDir, or ignore rules. Typechecking works before dev/build. Explicit
49
+ OGP data caches retain disk persistence. The generic CLI/file workflow follows.
50
+
23
51
  ## Configure once
24
52
 
25
53
  ```ts
@@ -116,8 +144,19 @@ export default defineConfig({
116
144
  ## Diagnose setup failures
117
145
 
118
146
  - Missing config: run `hono-decks init` or create a default-exported `hono-decks.config.ts`.
119
- - Missing generated import: run `hono-decks compile` before typechecking the application.
147
+ - Missing virtual module types: reference `hono-decks/vite-env`; a dev/build or manual compile is not required for typechecking.
148
+ - Missing generated import in the CLI/file workflow: run `hono-decks compile` before typechecking the application.
120
149
  - Deck not discovered: use `decks/<slug>/deck.mdx` or a supported single-file deck in the configured root.
121
150
  - Broken routes or assets: remove duplicated strings and use `decks.mountPath` and `decks.paths(slug)`.
122
151
  - Worker bundling Node modules: import `hono-decks/node` only from build scripts, never from Worker runtime code.
123
152
  - Lost edits after compile: move changes out of `src/generated` and into source decks or configuration.
153
+
154
+
155
+ For an existing Void app, `init --framework void --install` installs missing
156
+ Markdown dependencies using the app's package manager before creating integration
157
+ files. Use `--adapter /absolute/path/adapter.tgz` for a pre-release compiler API;
158
+ retain manual dependency installation by omitting --install. Yarn PnP is not
159
+ supported by the automatic installer. The generated Markdown sample includes a
160
+ Counter.tsx island. Markdown uses relative default imports with `island: "load"`,
161
+ `visible`, `idle`, or `media:(query)` and literal props, with no separate registry.
162
+ Arbitrary script code/JSX expressions remain unsupported; MDX stays unchanged.
@@ -56,6 +56,18 @@ Keep other bindings, assets, routes, and compatibility flags intact. Run `wrangl
56
56
 
57
57
  ## Existing Vite or HonoX application
58
58
 
59
+ Prefer `hono-decks init --framework hono` for an existing Hono + Vite app or
60
+ `hono-decks init --framework honox` for HonoX. Init connects routing and adds
61
+ automatic compilation while preserving existing settings and scripts. Use
62
+ normal `dev`/`build`; no separate compile command is needed. Its facade imports
63
+ `decks` from `virtual:hono-decks` and references `hono-decks/vite-env` types.
64
+ Vite generates code in memory and needs no output directory. HonoX's generated
65
+ file keeps route discovery in the app; `withHonoXDecks()` from `hono-decks/honox`
66
+ merges routes, preserves options, and detects static/dynamic/catch-all conflicts.
67
+ Config imports are watched, and init respects Vite's `BASE_URL` for the dev client. The CLI/manual
68
+ filesystem integration remains available. Use the manual
69
+ integration below for unsupported app shapes or an already configured app.
70
+
59
71
  Add the plugin to the existing config rather than replacing other plugins:
60
72
 
61
73
  ```ts
@@ -14,12 +14,22 @@ The base root font size is 32px. Treat that as body copy, not a value to shrink
14
14
  - cover title: `3rem` to `5rem`
15
15
  - line height: about `1.15` for headings and `1.35` to `1.5` for body text
16
16
 
17
+ ## Default appearance
18
+
19
+ Without a theme, slides use an opaque white background and dark text. Set `--hono-decks-background` and the foreground tokens together to customize the palette. The surrounding viewer has its own dark chrome; it does not set the slide colors.
20
+
21
+ The base CSS is followed by the deck's `theme.css`, then the route's `style` option. Per-slide background metadata is applied inline. Existing `.slide { background: ... }` rules continue to override the default background.
22
+
23
+ Use `px` or `rem` for content dimensions. Avoid `vw`, `vh`, and viewport media queries inside slides: those measure the browser or iframe, not the 1920 × 1080 canvas, and change the composition when the browser zooms. The same content dimensions are used for presentation and print.
24
+
17
25
  ## Start with deck-scoped CSS
18
26
 
19
27
  Create `decks/product/theme.css`:
20
28
 
21
29
  ```css
22
30
  :root {
31
+ color-scheme: dark;
32
+ --hono-decks-background: #080d1a;
23
33
  --hono-decks-color: #f7f8fb;
24
34
  --hono-decks-muted-color: #c3c8d4;
25
35
  --hono-decks-accent-color: #8bd3ff;
package/vite-env.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ /** Types for the build-only Vite integration's virtual runtime entry. */
2
+ declare module "virtual:hono-decks" {
3
+ export const decks: import("hono-decks").ConfiguredDecks;
4
+ export function createDecks<E extends import("hono").Env = any>(
5
+ config: import("hono-decks").DecksConfig<E>,
6
+ ): import("hono-decks").ConfiguredDecks<E>;
7
+ }