@blinkk/root 3.0.2 → 3.0.4

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.
Files changed (123) hide show
  1. package/dist/{chunk-FQBA5QSG.js → chunk-3Z5TNZEP.js} +3 -3
  2. package/dist/chunk-3Z5TNZEP.js.map +7 -0
  3. package/dist/{chunk-JCRXBB26.js → chunk-6NBKAR5Y.js} +2 -2
  4. package/dist/chunk-6NBKAR5Y.js.map +7 -0
  5. package/dist/chunk-6P3B7ZXL.js +1 -1
  6. package/dist/chunk-6P3B7ZXL.js.map +7 -1
  7. package/dist/{chunk-PVBPP5LN.js → chunk-7PSEEE6C.js} +10 -10
  8. package/dist/chunk-7PSEEE6C.js.map +7 -0
  9. package/dist/{chunk-WAZTR3DX.js → chunk-KW7KTYGC.js} +2 -2
  10. package/dist/chunk-KW7KTYGC.js.map +7 -0
  11. package/dist/{chunk-GSR74KEI.js → chunk-URG2INLL.js} +1477 -85
  12. package/dist/chunk-URG2INLL.js.map +7 -0
  13. package/dist/{chunk-4PO5HYET.js → chunk-X2C2MEJ2.js} +39 -4
  14. package/dist/chunk-X2C2MEJ2.js.map +7 -0
  15. package/dist/chunk-XSNCF7WU.js +1 -1
  16. package/dist/chunk-XSNCF7WU.js.map +7 -1
  17. package/dist/cli/build.d.ts +7 -0
  18. package/dist/cli/cli.d.ts +12 -0
  19. package/dist/cli/codegen.d.ts +5 -0
  20. package/dist/cli/create-package.d.ts +14 -0
  21. package/dist/cli/dev.d.ts +10 -0
  22. package/dist/cli/gae-deploy.d.ts +18 -0
  23. package/dist/cli/preview.d.ts +8 -0
  24. package/dist/cli/secrets.d.ts +9 -0
  25. package/dist/cli/start.d.ts +8 -0
  26. package/dist/cli/startup/check-version.d.ts +17 -0
  27. package/dist/cli/startup/startup-tasks.d.ts +39 -0
  28. package/dist/cli.js +4 -4
  29. package/dist/cli.js.map +7 -1
  30. package/dist/core/components/Body.d.ts +23 -0
  31. package/dist/core/components/Head.d.ts +18 -0
  32. package/dist/core/components/Html.d.ts +24 -0
  33. package/dist/core/components/Script.d.ts +16 -0
  34. package/dist/core/config.d.ts +285 -0
  35. package/dist/core/core.d.ts +14 -0
  36. package/dist/core/hooks/useI18nContext.d.ts +11 -0
  37. package/dist/core/hooks/useRequestContext.d.ts +36 -0
  38. package/dist/core/hooks/useStringParams.d.ts +34 -0
  39. package/dist/core/hooks/useTranslations.d.ts +20 -0
  40. package/dist/core/hooks/useTranslationsMiddleware.d.ts +25 -0
  41. package/dist/core/pages/DevErrorPage.d.ts +9 -0
  42. package/dist/core/pages/DevNotFoundPage.d.ts +10 -0
  43. package/dist/core/pages/ErrorPage.d.ts +9 -0
  44. package/dist/core/plugin.d.ts +80 -0
  45. package/dist/core/pod.d.ts +54 -0
  46. package/dist/core/types.d.ts +228 -0
  47. package/dist/core.js +3 -3
  48. package/dist/core.js.map +7 -1
  49. package/dist/functions/functions.d.ts +1 -0
  50. package/dist/functions/server.d.ts +10 -0
  51. package/dist/functions.js +5 -5
  52. package/dist/functions.js.map +7 -1
  53. package/dist/jsx/jsx-dev-runtime.d.ts +10 -1
  54. package/dist/jsx/jsx-dev-runtime.js +2 -2
  55. package/dist/jsx/jsx-dev-runtime.js.map +7 -1
  56. package/dist/{jsx-C8cJO55i.d.ts → jsx/jsx-render.d.ts} +3 -6
  57. package/dist/jsx/jsx-runtime.d.ts +120 -1
  58. package/dist/jsx/jsx-runtime.js +2 -2
  59. package/dist/jsx/jsx-runtime.js.map +7 -1
  60. package/dist/jsx/jsx.d.ts +37 -0
  61. package/dist/{jsx-dev-runtime-DHf9jiFH.d.ts → jsx/types.d.ts} +8 -124
  62. package/dist/jsx.js +3 -3
  63. package/dist/jsx.js.map +7 -1
  64. package/dist/middleware/common.d.ts +22 -0
  65. package/dist/middleware/hooks.d.ts +8 -0
  66. package/dist/middleware/middleware.d.ts +3 -0
  67. package/dist/middleware/multipart.d.ts +11 -0
  68. package/dist/middleware/redirects.d.ts +10 -0
  69. package/dist/middleware/session.d.ts +24 -0
  70. package/dist/middleware.js +2 -2
  71. package/dist/middleware.js.map +7 -1
  72. package/dist/node/element-graph.d.ts +51 -0
  73. package/dist/node/load-config.d.ts +17 -0
  74. package/dist/node/monorepo.d.ts +14 -0
  75. package/dist/node/node.d.ts +4 -0
  76. package/dist/node/pod-collector.d.ts +33 -0
  77. package/dist/node/pods-vite-plugin.d.ts +6 -0
  78. package/dist/node/vite-plugin-preact-alias.d.ts +10 -0
  79. package/dist/node/vite-plugin-prune-empty-chunks.d.ts +27 -0
  80. package/dist/node/vite-plugin-root-jsx-virtual.d.ts +16 -0
  81. package/dist/node/vite.d.ts +18 -0
  82. package/dist/node.js +2 -2
  83. package/dist/node.js.map +7 -1
  84. package/dist/render/accept-language.d.ts +8 -0
  85. package/dist/render/asset-map/asset-map.d.ts +25 -0
  86. package/dist/render/asset-map/build-asset-map.d.ts +47 -0
  87. package/dist/render/asset-map/dev-asset-map.d.ts +26 -0
  88. package/dist/render/countrie-language.d.ts +13 -0
  89. package/dist/render/html-minify.d.ts +3 -0
  90. package/dist/render/html-pretty.d.ts +3 -0
  91. package/dist/render/i18n-fallbacks.d.ts +11 -0
  92. package/dist/render/render.d.ts +91 -0
  93. package/dist/render/route-trie.d.ts +44 -0
  94. package/dist/render/router.d.ts +18 -0
  95. package/dist/render.js +9 -9
  96. package/dist/render.js.map +7 -1
  97. package/dist/secrets/env-file.d.ts +44 -0
  98. package/dist/secrets/gcloud.d.ts +28 -0
  99. package/dist/secrets/hash.d.ts +11 -0
  100. package/dist/secrets/manifest.d.ts +60 -0
  101. package/dist/secrets/secrets.d.ts +118 -0
  102. package/dist/utils/batch.d.ts +1 -0
  103. package/dist/utils/elements.d.ts +12 -0
  104. package/dist/utils/fsutils.d.ts +24 -0
  105. package/dist/utils/i18n.d.ts +8 -0
  106. package/dist/utils/ports.d.ts +8 -0
  107. package/dist/utils/rand.d.ts +10 -0
  108. package/dist/utils/url-path-params.d.ts +2 -0
  109. package/package.json +14 -15
  110. package/dist/chunk-4PO5HYET.js.map +0 -1
  111. package/dist/chunk-FQBA5QSG.js.map +0 -1
  112. package/dist/chunk-GSR74KEI.js.map +0 -1
  113. package/dist/chunk-JCRXBB26.js.map +0 -1
  114. package/dist/chunk-PVBPP5LN.js.map +0 -1
  115. package/dist/chunk-WAZTR3DX.js.map +0 -1
  116. package/dist/cli.d.ts +0 -60
  117. package/dist/core.d.ts +0 -214
  118. package/dist/functions.d.ts +0 -14
  119. package/dist/jsx.d.ts +0 -2
  120. package/dist/middleware.d.ts +0 -43
  121. package/dist/node.d.ts +0 -91
  122. package/dist/render.d.ts +0 -8
  123. package/dist/types-B-pJtsB4.d.ts +0 -827
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @module jsx
3
+ *
4
+ * Root.js server-side JSX renderer. A zero-dependency JSX runtime that
5
+ * replaces Preact for server-side rendering (SSR/SSG).
6
+ *
7
+ * ## Quick Start
8
+ *
9
+ * Configure your `tsconfig.json`:
10
+ * ```json
11
+ * {
12
+ * "compilerOptions": {
13
+ * "jsx": "react-jsx",
14
+ * "jsxImportSource": "@blinkk/root/jsx"
15
+ * }
16
+ * }
17
+ * ```
18
+ *
19
+ * Import hooks and utilities directly:
20
+ * ```ts
21
+ * import {createContext, useContext, renderJsxToString} from '@blinkk/root/jsx';
22
+ * ```
23
+ *
24
+ * ## What's included
25
+ *
26
+ * - `jsx` / `jsxs` / `Fragment` — Automatic JSX transform
27
+ * - `createElement` / `h` — Classic JSX transform
28
+ * - `createContext` / `useContext` — Context API for SSR
29
+ * - `renderJsxToString` — Render VNode trees to HTML strings
30
+ * - `options` — VNode lifecycle hook (for nonce injection, etc.)
31
+ * - Full TypeScript JSX type definitions
32
+ */
33
+ export { jsx, jsxs, Fragment, createElement, h, options, createContext, useContext, } from './jsx-runtime.js';
34
+ export type { VNode, ComponentChildren, ComponentChild, ComponentType, FunctionalComponent, Context, Key, } from './jsx-runtime.js';
35
+ export { renderJsxToString } from './jsx-render.js';
36
+ export type { HTMLAttributes, SVGAttributes, ScriptHTMLAttributes, DOMAttributes, AriaAttributes, } from './types.js';
37
+ export type { JSX } from './types.js';
@@ -5,8 +5,8 @@
5
5
  * JSX runtime. These types allow TypeScript to type-check JSX expressions
6
6
  * when `jsxImportSource` points to this module.
7
7
  */
8
-
9
- interface DOMAttributes {
8
+ import type { VNode, ComponentChildren } from './jsx-runtime.js';
9
+ export interface DOMAttributes {
10
10
  children?: ComponentChildren;
11
11
  dangerouslySetInnerHTML?: {
12
12
  __html: string;
@@ -54,7 +54,7 @@ interface DOMAttributes {
54
54
  onError?: EventHandler;
55
55
  }
56
56
  type EventHandler = string | ((...args: any[]) => void);
57
- interface AriaAttributes {
57
+ export interface AriaAttributes {
58
58
  role?: string;
59
59
  'aria-activedescendant'?: string;
60
60
  'aria-atomic'?: boolean | 'false' | 'true';
@@ -111,7 +111,7 @@ interface AriaAttributes {
111
111
  * `HTMLAttributes<HTMLElement>` pattern, but is unused at runtime since
112
112
  * this is an SSR-only renderer.
113
113
  */
114
- interface HTMLAttributes<T = HTMLElement> extends DOMAttributes, AriaAttributes {
114
+ export interface HTMLAttributes<T = HTMLElement> extends DOMAttributes, AriaAttributes {
115
115
  accept?: string;
116
116
  acceptCharset?: string;
117
117
  accessKey?: string;
@@ -259,7 +259,7 @@ interface HTMLAttributes<T = HTMLElement> extends DOMAttributes, AriaAttributes
259
259
  /**
260
260
  * SVG-specific attributes.
261
261
  */
262
- interface SVGAttributes<T = SVGElement> extends HTMLAttributes<T> {
262
+ export interface SVGAttributes<T = SVGElement> extends HTMLAttributes<T> {
263
263
  accentHeight?: number | string;
264
264
  accumulate?: 'none' | 'sum';
265
265
  additive?: 'replace' | 'sum';
@@ -366,7 +366,7 @@ interface SVGAttributes<T = SVGElement> extends HTMLAttributes<T> {
366
366
  /**
367
367
  * Script-specific HTML attributes (for the `<Script>` component).
368
368
  */
369
- interface ScriptHTMLAttributes<T = HTMLScriptElement> extends HTMLAttributes<T> {
369
+ export interface ScriptHTMLAttributes<T = HTMLScriptElement> extends HTMLAttributes<T> {
370
370
  async?: boolean;
371
371
  crossOrigin?: string;
372
372
  defer?: boolean;
@@ -377,7 +377,7 @@ interface ScriptHTMLAttributes<T = HTMLScriptElement> extends HTMLAttributes<T>
377
377
  src?: string;
378
378
  type?: string;
379
379
  }
380
- declare namespace JSX {
380
+ export declare namespace JSX {
381
381
  type Element = VNode<any>;
382
382
  interface ElementChildrenAttribute {
383
383
  children: {};
@@ -558,120 +558,4 @@ declare namespace JSX {
558
558
  view: SVGAttributes<SVGViewElement>;
559
559
  }
560
560
  }
561
-
562
- /**
563
- * @module jsx-runtime
564
- *
565
- * Server-side JSX runtime for Root.js. Replaces Preact as the JSX renderer
566
- * for server-side rendering (SSR/SSG). This module provides the automatic
567
- * JSX transform entry point (`jsxImportSource`).
568
- *
569
- * Supports:
570
- * - Automatic JSX transform (jsx, jsxs, Fragment)
571
- * - Classic JSX transform (createElement / h)
572
- * - Context API (createContext, useContext)
573
- * - Server-side renderToString
574
- */
575
- type Key = string | number | null;
576
- /**
577
- * A virtual DOM node representing an element, component, or fragment.
578
- */
579
- interface VNode<P = Record<string, unknown>> {
580
- type: string | FunctionalComponent<P> | typeof Fragment | (new (...args: any[]) => any);
581
- props: P;
582
- key: Key;
583
- }
584
- /**
585
- * Valid children types for JSX elements.
586
- */
587
- type ComponentChildren = VNode<any> | string | number | bigint | boolean | null | undefined | ComponentChildren[];
588
- type ComponentChild = ComponentChildren;
589
- /**
590
- * A function component that receives props and returns a VNode or null.
591
- */
592
- interface FunctionalComponent<P = Record<string, unknown>> {
593
- (props: P): VNode<any> | null;
594
- displayName?: string;
595
- /** @internal Marks this component as a context Provider. */
596
- _isProvider?: boolean;
597
- /** @internal Reference to the context object for Provider components. */
598
- _context?: Context<any>;
599
- }
600
- /**
601
- * Generic component type (function components only for SSR).
602
- */
603
- type ComponentType<P = Record<string, unknown>> = FunctionalComponent<P>;
604
- /**
605
- * Global options object. The `vnode` callback is invoked for every VNode
606
- * created via `jsx()`, `jsxs()`, or `createElement()`. This is used by the
607
- * renderer to inject nonce values into script/style tags.
608
- */
609
- declare const options: {
610
- vnode?: (vnode: VNode<any>) => void;
611
- };
612
- /**
613
- * Fragment component. Renders its children without a wrapper DOM element.
614
- * Used as `<>...</>` or `<Fragment>...</Fragment>` in JSX.
615
- */
616
- declare function Fragment(props: {
617
- children?: ComponentChildren;
618
- }): any;
619
- /**
620
- * Creates a VNode. Used by the automatic JSX transform for elements with
621
- * a single child or no children.
622
- */
623
- declare function jsx(type: string | FunctionalComponent<any> | typeof Fragment, props: Record<string, any>, key?: Key): VNode;
624
-
625
- /**
626
- * Creates a VNode. Compatible with the classic `React.createElement` API.
627
- *
628
- * ```ts
629
- * createElement('div', {className: 'foo'}, 'Hello', ' ', 'World');
630
- * ```
631
- */
632
- declare function createElement(type: string | FunctionalComponent<any> | typeof Fragment, props?: Record<string, any> | null, ...children: any[]): VNode;
633
-
634
- /**
635
- * A context object created by `createContext()`. Provides a `Provider`
636
- * component and can be read via `useContext()`.
637
- */
638
- interface Context<T> {
639
- /** @internal Default value for this context. */
640
- _defaultValue: T;
641
- /** @internal Stack of provided values (managed by renderToString). */
642
- _stack: T[];
643
- /** Provider component that supplies a context value to descendants. */
644
- Provider: FunctionalComponent<{
645
- value: T;
646
- children?: ComponentChildren;
647
- }>;
648
- }
649
- /**
650
- * Creates a new context with an optional default value. Returns a context
651
- * object with a `Provider` component.
652
- *
653
- * ```ts
654
- * const ThemeContext = createContext('light');
655
- *
656
- * // In a parent component:
657
- * <ThemeContext.Provider value="dark">
658
- * <App />
659
- * </ThemeContext.Provider>
660
- *
661
- * // In a child component:
662
- * const theme = useContext(ThemeContext);
663
- * ```
664
- */
665
- declare function createContext<T>(defaultValue: T): Context<T>;
666
- /**
667
- * Reads the current value of a context. Must be called during the render
668
- * of a function component that is a descendant of a matching Provider.
669
- * Returns the default value if no Provider is found.
670
- *
671
- * ```ts
672
- * const theme = useContext(ThemeContext);
673
- * ```
674
- */
675
- declare function useContext<T>(context: Context<T>): T;
676
-
677
- export { type AriaAttributes as A, type ComponentChildren as C, type DOMAttributes as D, Fragment as F, type HTMLAttributes as H, JSX as J, type Key as K, type SVGAttributes as S, type VNode as V, createContext as a, type ComponentChild as b, createElement as c, type ComponentType as d, type FunctionalComponent as e, type Context as f, type ScriptHTMLAttributes as g, jsx as j, options as o, useContext as u };
561
+ export {};
package/dist/jsx.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  renderJsxToString
3
- } from "./chunk-4PO5HYET.js";
3
+ } from "./chunk-X2C2MEJ2.js";
4
4
  import {
5
5
  Fragment,
6
6
  createContext,
@@ -8,7 +8,7 @@ import {
8
8
  jsx,
9
9
  options,
10
10
  useContext
11
- } from "./chunk-FQBA5QSG.js";
11
+ } from "./chunk-3Z5TNZEP.js";
12
12
  export {
13
13
  Fragment,
14
14
  createContext,
@@ -20,4 +20,4 @@ export {
20
20
  renderJsxToString,
21
21
  useContext
22
22
  };
23
- //# sourceMappingURL=jsx.js.map
23
+ //# sourceMappingURL=jsx.js.map
package/dist/jsx.js.map CHANGED
@@ -1 +1,7 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,22 @@
1
+ import { RootConfig } from '../core/config.js';
2
+ import { Request, Response, NextFunction } from '../core/types.js';
3
+ /**
4
+ * Middleware that injects the root.js project config into the request context.
5
+ */
6
+ export declare function rootProjectMiddleware(options: {
7
+ rootConfig: RootConfig;
8
+ }): (req: Request, _: Response, next: NextFunction) => void;
9
+ /**
10
+ * Middleware that injects HTTP headers from the `server.headers` config in
11
+ * root.config.ts.
12
+ */
13
+ export declare function headersMiddleware(options: {
14
+ rootConfig: RootConfig;
15
+ }): (req: Request, res: Response, next: NextFunction) => void;
16
+ /**
17
+ * Trailing slash middleware. Handles trailing slash redirects (preserving any
18
+ * query params) using the `server.trailingSlash` config in root.config.ts.
19
+ */
20
+ export declare function trailingSlashMiddleware(options: {
21
+ rootConfig: RootConfig;
22
+ }): (req: Request, res: Response, next: NextFunction) => void;
@@ -0,0 +1,8 @@
1
+ import { Request, Response, NextFunction } from '../core/types.js';
2
+ export declare function hooksMiddleware(): (req: Request, res: Response, next: NextFunction) => void;
3
+ export type HooksCallbackFn = (...args: any[]) => any;
4
+ export declare class Hooks {
5
+ private callbacks;
6
+ add(name: string, cb: (...args: any[]) => any): void;
7
+ trigger(name: string, ...args: any[]): void;
8
+ }
@@ -0,0 +1,3 @@
1
+ export * from './common.js';
2
+ export * from './multipart.js';
3
+ export * from './session.js';
@@ -0,0 +1,11 @@
1
+ import { RequestHandler } from 'express';
2
+ /**
3
+ * Middleware for parsing multipart file uploads that's compatible with the dev
4
+ * server and Firebase Functions.
5
+ *
6
+ * Context:
7
+ * https://stackoverflow.com/questions/47242340/how-to-perform-an-http-file-upload-using-express-on-cloud-functions-for-firebase
8
+ */
9
+ export declare function multipartMiddleware(options?: {
10
+ maxFileSize?: number;
11
+ }): RequestHandler;
@@ -0,0 +1,10 @@
1
+ import { RootRedirectConfig } from '../core/config.js';
2
+ import { NextFunction, Request, Response } from '../core/types.js';
3
+ export interface RedirectsMiddlewareOptions {
4
+ redirects: RootRedirectConfig[];
5
+ }
6
+ /**
7
+ * Middleware for handling server-side redirects from the `server.redirects`
8
+ * config in `root.config.ts`.
9
+ */
10
+ export declare function redirectsMiddleware(options: RedirectsMiddlewareOptions): (req: Request, res: Response, next: NextFunction) => void;
@@ -0,0 +1,24 @@
1
+ import { NextFunction, Request, Response } from '../core/types.js';
2
+ export declare const SESSION_COOKIE = "__session";
3
+ export interface SessionMiddlewareOptions {
4
+ maxAge?: number;
5
+ }
6
+ export interface SaveSessionOptions {
7
+ sameSite?: 'strict' | 'lax' | 'none';
8
+ }
9
+ /**
10
+ * Middleware for storing session data stored in an http cookie called
11
+ * `__session`. This cookie is compatible with Firebase Hosting:
12
+ * https://firebase.google.com/docs/hosting/manage-cache#using_cookies
13
+ */
14
+ export declare function sessionMiddleware(options?: SessionMiddlewareOptions): (req: Request, res: Response, next: NextFunction) => void;
15
+ export declare class Session {
16
+ private data;
17
+ hasChanges: boolean;
18
+ constructor(data?: Record<string, string>);
19
+ static fromCookieValue(cookieValue: string): Session;
20
+ getItem(key: string): string | null;
21
+ setItem(key: string, value: string): void;
22
+ removeItem(key: string): void;
23
+ toString(): string;
24
+ }
@@ -6,7 +6,7 @@ import {
6
6
  rootProjectMiddleware,
7
7
  sessionMiddleware,
8
8
  trailingSlashMiddleware
9
- } from "./chunk-JCRXBB26.js";
9
+ } from "./chunk-6NBKAR5Y.js";
10
10
  export {
11
11
  SESSION_COOKIE,
12
12
  Session,
@@ -16,4 +16,4 @@ export {
16
16
  sessionMiddleware,
17
17
  trailingSlashMiddleware
18
18
  };
19
- //# sourceMappingURL=middleware.js.map
19
+ //# sourceMappingURL=middleware.js.map
@@ -1 +1,7 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,51 @@
1
+ import { RootConfig } from '../core/config.js';
2
+ import type { ResolvedPod } from './pod-collector.js';
3
+ interface ElementSourceFile {
4
+ /** Full file path. */
5
+ filePath: string;
6
+ /** Path relative to the root project directory. */
7
+ relPath: string;
8
+ }
9
+ /**
10
+ * Dependency graph for element files to capture which other elements are used
11
+ * by any particular element.
12
+ */
13
+ export declare class ElementGraph {
14
+ /**
15
+ * Element tagName => sourceFile.
16
+ */
17
+ readonly sourceFiles: {
18
+ [tagName: string]: ElementSourceFile;
19
+ };
20
+ /**
21
+ * Element tagName => set of element tagName dependencies.
22
+ */
23
+ private deps;
24
+ constructor(sourceFiles: {
25
+ [tagName: string]: ElementSourceFile;
26
+ });
27
+ toJson(): {
28
+ sourceFiles: {
29
+ [tagName: string]: ElementSourceFile;
30
+ };
31
+ deps: Record<string, string[]>;
32
+ };
33
+ static fromJson(data: {
34
+ deps: any;
35
+ sourceFiles: any;
36
+ }): ElementGraph;
37
+ getDeps(tagName: string, visited?: Set<string>): string[];
38
+ /**
39
+ * Parses an element's source file for usage of other custom elements.
40
+ */
41
+ private parseDepsFromSource;
42
+ }
43
+ /**
44
+ * Returns a map of all the element file definitions in the project.
45
+ */
46
+ export declare function getElements(rootConfig: RootConfig, pods?: ResolvedPod[]): Promise<ElementGraph>;
47
+ /**
48
+ * Get all element dirs.
49
+ */
50
+ export declare function getElementsDirs(rootConfig: RootConfig, pods?: ResolvedPod[]): string[];
51
+ export {};
@@ -0,0 +1,17 @@
1
+ import { RootConfig } from '../core/config.js';
2
+ export interface ConfigOptions {
3
+ command: string;
4
+ }
5
+ export declare function loadRootConfig(rootDir: string, options: ConfigOptions): Promise<RootConfig>;
6
+ export declare function loadRootConfigWithDeps(rootDir: string, options: ConfigOptions): Promise<{
7
+ rootConfig: RootConfig;
8
+ dependencies: string[];
9
+ }>;
10
+ /**
11
+ * Compiles a root.config.ts file to root.config.js.
12
+ */
13
+ export declare function bundleRootConfig(rootDir: string, outPath: string): Promise<void>;
14
+ /**
15
+ * Loads a pre-bundled config file from dist/root.config.js.
16
+ */
17
+ export declare function loadBundledConfig(rootDir: string, options: ConfigOptions): Promise<RootConfig>;
@@ -0,0 +1,14 @@
1
+ import { PackageInfo } from 'workspace-tools';
2
+ export declare function loadPackageJson(filepath: string): PackageInfo | null;
3
+ /**
4
+ * Returns the top-level monorepo package's deps, if any.
5
+ */
6
+ export declare function getMonorepoPackageDeps(rootDir: string): Record<string, string>;
7
+ /**
8
+ * Flattens package.json deps from the root project dir, taking into account any
9
+ * deps from the monorepo root as well as any `workspace:` deps from within the
10
+ * monorepo.
11
+ */
12
+ export declare function flattenPackageDepsFromMonorepo(rootDir: string, options?: {
13
+ ignore?: Set<string>;
14
+ }): Record<string, string>;
@@ -0,0 +1,4 @@
1
+ export * from './load-config.js';
2
+ export * from './monorepo.js';
3
+ export * from './pod-collector.js';
4
+ export * from './vite.js';
@@ -0,0 +1,33 @@
1
+ import { RootConfig } from '../core/config.js';
2
+ import { PodConfig } from '../core/pod.js';
3
+ export interface ResolvedPodRoute {
4
+ filePath: string;
5
+ relPath: string;
6
+ routePath: string;
7
+ }
8
+ export interface ResolvedPodCollection {
9
+ filePath: string;
10
+ relPath: string;
11
+ id: string;
12
+ }
13
+ export interface ResolvedPod {
14
+ name: string;
15
+ enabled: boolean;
16
+ mount: string;
17
+ priority: number;
18
+ routesDir?: string;
19
+ elementsDirs: string[];
20
+ bundlesDir?: string;
21
+ collectionsDir?: string;
22
+ translationsDir?: string;
23
+ routeFiles: ResolvedPodRoute[];
24
+ bundleFiles: string[];
25
+ collectionFiles: ResolvedPodCollection[];
26
+ translationFiles: Array<{
27
+ locale: string;
28
+ filePath: string;
29
+ }>;
30
+ config: PodConfig;
31
+ }
32
+ export declare function invalidatePodCache(): void;
33
+ export declare function collectPods(rootConfig: RootConfig): Promise<ResolvedPod[]>;
@@ -0,0 +1,6 @@
1
+ import type { Plugin as VitePlugin } from 'vite';
2
+ import { RootConfig } from '../core/config.js';
3
+ export declare const VIRTUAL_ROUTES_ID = "virtual:root/routes";
4
+ export declare const VIRTUAL_SCHEMAS_ID = "virtual:root/schemas";
5
+ export declare const VIRTUAL_TRANSLATIONS_ID = "virtual:root/translations";
6
+ export declare function rootPodsVitePlugin(rootConfig: RootConfig): VitePlugin;
@@ -0,0 +1,10 @@
1
+ import type { Plugin } from 'vite';
2
+ /**
3
+ * Vite plugin that aliases `preact` imports to `@blinkk/root/jsx`.
4
+ *
5
+ * When `jsxRenderer.mode` is configured, the project uses Root's built-in JSX
6
+ * runtime instead of Preact. This plugin redirects all `preact` imports
7
+ * (including `preact/hooks`, `preact/jsx-runtime`, etc.) so that Root's
8
+ * built-in hooks and components use Root's context API rather than Preact's.
9
+ */
10
+ export declare function preactToRootJsxPlugin(): Plugin;
@@ -0,0 +1,27 @@
1
+ import type { Plugin } from 'vite';
2
+ /**
3
+ * Vite plugin that removes 0-byte JS chunks from the build output and prunes
4
+ * the import statements that reference them.
5
+ *
6
+ * Tree-shaking (via rolldown/esbuild) can reduce a module to nothing — e.g. a
7
+ * type-only `.ts` file, or an entry whose contents are entirely eliminated.
8
+ * rolldown still emits a file for every explicit input, so these surface as
9
+ * 0-byte `.js` files in the build output. Worse, a sibling chunk may keep a
10
+ * bare side-effect import (`import "./<hash>.js"`) pointing at the empty file.
11
+ * If that empty file is removed without also removing the import, the import
12
+ * 404s at runtime and breaks the entire module graph.
13
+ *
14
+ * This plugin runs in `generateBundle` (before Vite's manifest plugin) and:
15
+ * 1. Detects chunks whose generated code is empty.
16
+ * 2. Skips any that still anchor CSS or asset references, so co-located
17
+ * styles are preserved (Vite keeps an empty JS chunk to carry the CSS
18
+ * link for a style-only module).
19
+ * 3. Strips bare side-effect imports of the empty chunks from sibling chunks.
20
+ * A 0-byte module exports nothing, so it can only be imported bare.
21
+ * 4. Deletes the empty chunks from the bundle.
22
+ *
23
+ * Because it runs before the manifest is emitted, the resulting
24
+ * `manifest.json` (consumed by Root's asset map) never references the removed
25
+ * files.
26
+ */
27
+ export declare function pruneEmptyChunksPlugin(): Plugin;
@@ -0,0 +1,16 @@
1
+ import type { Plugin } from 'vite';
2
+ export interface PreactToRootJsxPluginOptions {
3
+ /** Whether Root's JSX renderer mode is enabled. */
4
+ useRootJsx?: boolean;
5
+ }
6
+ /**
7
+ * Vite plugin that aliases `preact` imports to `@blinkk/root/jsx` in the SSR
8
+ * environment only.
9
+ *
10
+ * When `jsxRenderer.mode` is configured, the project uses Root's built-in JSX
11
+ * runtime instead of Preact for server-side rendering. This plugin redirects
12
+ * `preact` imports (`preact`, `preact/hooks`, `preact/jsx-runtime`, etc.) to
13
+ * Root's JSX package, but only in the SSR environment. Client-side code (e.g.
14
+ * islands that depend on real Preact for hydration) is left untouched.
15
+ */
16
+ export declare function preactToRootJsxPlugin(options?: PreactToRootJsxPluginOptions): Plugin;
@@ -0,0 +1,18 @@
1
+ import { ViteDevServer } from 'vite';
2
+ import { RootConfig } from '../core/config.js';
3
+ export interface CreateViteServerOptions {
4
+ /** Override HMR settings. */
5
+ hmr?: boolean;
6
+ /** The port the server will run on. */
7
+ port?: number;
8
+ /** List of files to include in the optimizeDeps.include config. */
9
+ optimizeDeps?: string[];
10
+ }
11
+ /**
12
+ * Returns a vite dev server.
13
+ */
14
+ export declare function createViteServer(rootConfig: RootConfig, options?: CreateViteServerOptions): Promise<ViteDevServer>;
15
+ /**
16
+ * Shortcut `viteServer.ssrLoadModule()` without starting an actual dev server.
17
+ */
18
+ export declare function viteSsrLoadModule<T = Record<string, any>>(rootConfig: RootConfig, file: string): Promise<T>;
package/dist/node.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  loadRootConfig,
11
11
  loadRootConfigWithDeps,
12
12
  viteSsrLoadModule
13
- } from "./chunk-PVBPP5LN.js";
13
+ } from "./chunk-7PSEEE6C.js";
14
14
  import "./chunk-XSNCF7WU.js";
15
15
  export {
16
16
  bundleRootConfig,
@@ -25,4 +25,4 @@ export {
25
25
  loadRootConfigWithDeps,
26
26
  viteSsrLoadModule
27
27
  };
28
- //# sourceMappingURL=node.js.map
28
+ //# sourceMappingURL=node.js.map
package/dist/node.js.map CHANGED
@@ -1 +1,7 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ export declare const ACCEPT_LANG_RE: RegExp;
2
+ export interface AcceptLanguage {
3
+ code: string;
4
+ script?: string;
5
+ region?: string;
6
+ quality: number;
7
+ }
8
+ export declare function parseAcceptLanguage(value: string): AcceptLanguage[];
@@ -0,0 +1,25 @@
1
+ export interface Asset {
2
+ /**
3
+ * The path to the asset's src file, relative to the project root.
4
+ */
5
+ src: string;
6
+ /**
7
+ * The serving URL for the asset.
8
+ */
9
+ assetUrl: string;
10
+ /**
11
+ * Recursively walks all deps and returns a list of CSS asset URLs.
12
+ */
13
+ getCssDeps(): Promise<string[]>;
14
+ /**
15
+ * Recursively walks all deps and returns a list of JS asset URLs.
16
+ */
17
+ getJsDeps(): Promise<string[]>;
18
+ }
19
+ export interface AssetMap {
20
+ /**
21
+ * Returns the asset for a given src file. The `src` value should be a path
22
+ * relative to the project root, e.g. "routes/index.tsx".
23
+ */
24
+ get: (src: string) => Promise<Asset | null>;
25
+ }