@blinkk/root 2.5.10 → 2.5.12-alpha.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.
@@ -3,6 +3,7 @@ import { ComponentType } from 'preact';
3
3
  import { PluginOption, UserConfig, ViteDevServer } from 'vite';
4
4
  import { Options } from 'html-minifier-terser';
5
5
  import { HTMLBeautifyOptions } from 'js-beautify';
6
+ import { J as JsxRenderOptions } from './jsx-render-BCCySLjz.js';
6
7
 
7
8
  declare class Hooks {
8
9
  private callbacks;
@@ -168,6 +169,27 @@ interface RootUserConfig {
168
169
  * @see {@link https://vitejs.dev/config/} for more information.
169
170
  */
170
171
  vite?: UserConfig;
172
+ /**
173
+ * Config for the built-in JSX-to-HTML renderer.
174
+ *
175
+ * - `mode: 'pretty'` (default) — block-level elements render on their own
176
+ * line with no indentation.
177
+ * - `mode: 'minimal'` — compact output with no extra whitespace.
178
+ *
179
+ * Use `blockElements` to specify additional custom element tag names that
180
+ * should be treated as block-level in pretty mode.
181
+ *
182
+ * @example
183
+ * ```ts
184
+ * export default defineConfig({
185
+ * jsxRenderer: {
186
+ * mode: 'pretty',
187
+ * blockElements: ['my-card', 'my-section'],
188
+ * },
189
+ * });
190
+ * ```
191
+ */
192
+ jsxRenderer?: JsxRenderOptions;
171
193
  /**
172
194
  * Whether to automatically minify HTML output. This is enabled by default,
173
195
  * in order to disable, pass `minifyHtml: false` to root.config.ts.
@@ -470,8 +492,16 @@ declare class Renderer {
470
492
  * - construct alternates for localized URL paths
471
493
  */
472
494
  getSitemap(): Promise<Sitemap>;
495
+ private getJsxRenderOptions;
496
+ /**
497
+ * Renders JSX via either the `@blinkk/root/jsx` package or
498
+ * `preact-render-to-string` depending if the `jsxRenderer` config is set up
499
+ * in `root.config.ts`.
500
+ */
501
+ private renderJsx;
473
502
  private getConfiguredStyleEntries;
474
503
  private renderHtml;
504
+ private ensureNewline;
475
505
  render404(options?: {
476
506
  currentPath?: string;
477
507
  }): Promise<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkk/root",
3
- "version": "2.5.10",
3
+ "version": "2.5.12-alpha.0",
4
4
  "author": "s@blinkk.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -11,9 +11,6 @@
11
11
  "url": "git+https://github.com/blinkk/rootjs.git",
12
12
  "directory": "packages/root"
13
13
  },
14
- "publishConfig": {
15
- "provenance": true
16
- },
17
14
  "files": [
18
15
  "bin/*",
19
16
  "dist/**/*",
@@ -43,6 +40,10 @@
43
40
  "types": "./dist/functions.d.ts",
44
41
  "import": "./dist/functions.js"
45
42
  },
43
+ "./jsx": {
44
+ "types": "./dist/jsx.d.ts",
45
+ "import": "./dist/jsx.js"
46
+ },
46
47
  "./middleware": {
47
48
  "types": "./dist/middleware.d.ts",
48
49
  "import": "./dist/middleware.js"
@@ -92,6 +93,12 @@
92
93
  },
93
94
  "firebase-admin": {
94
95
  "optional": true
96
+ },
97
+ "preact": {
98
+ "optional": true
99
+ },
100
+ "preact-render-to-string": {
101
+ "optional": true
95
102
  }
96
103
  },
97
104
  "devDependencies": {