@blinkk/root 3.0.1 → 3.0.3
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/{chunk-FQBA5QSG.js → chunk-3Z5TNZEP.js} +3 -3
- package/dist/chunk-3Z5TNZEP.js.map +7 -0
- package/dist/{chunk-JCRXBB26.js → chunk-6NBKAR5Y.js} +2 -2
- package/dist/chunk-6NBKAR5Y.js.map +7 -0
- package/dist/chunk-6P3B7ZXL.js +1 -1
- package/dist/chunk-6P3B7ZXL.js.map +7 -1
- package/dist/{chunk-PVBPP5LN.js → chunk-7PSEEE6C.js} +10 -10
- package/dist/chunk-7PSEEE6C.js.map +7 -0
- package/dist/{chunk-M6WGW5VY.js → chunk-DU7JUEDY.js} +48 -6
- package/dist/chunk-DU7JUEDY.js.map +7 -0
- package/dist/{chunk-GSR74KEI.js → chunk-JTZWI4MH.js} +279 -73
- package/dist/chunk-JTZWI4MH.js.map +7 -0
- package/dist/{chunk-WAZTR3DX.js → chunk-KW7KTYGC.js} +2 -2
- package/dist/chunk-KW7KTYGC.js.map +7 -0
- package/dist/chunk-XSNCF7WU.js +1 -1
- package/dist/chunk-XSNCF7WU.js.map +7 -1
- package/dist/cli/build.d.ts +7 -0
- package/dist/cli/cli.d.ts +12 -0
- package/dist/cli/codegen.d.ts +5 -0
- package/dist/cli/create-package.d.ts +14 -0
- package/dist/cli/dev.d.ts +10 -0
- package/dist/cli/gae-deploy.d.ts +18 -0
- package/dist/cli/preview.d.ts +8 -0
- package/dist/cli/start.d.ts +8 -0
- package/dist/cli/startup/check-version.d.ts +17 -0
- package/dist/cli/startup/startup-tasks.d.ts +39 -0
- package/dist/cli.js +4 -4
- package/dist/cli.js.map +7 -1
- package/dist/core/components/Body.d.ts +23 -0
- package/dist/core/components/Head.d.ts +18 -0
- package/dist/core/components/Html.d.ts +24 -0
- package/dist/core/components/Script.d.ts +16 -0
- package/dist/core/config.d.ts +285 -0
- package/dist/core/core.d.ts +14 -0
- package/dist/core/hooks/useI18nContext.d.ts +11 -0
- package/dist/core/hooks/useRequestContext.d.ts +36 -0
- package/dist/core/hooks/useStringParams.d.ts +34 -0
- package/dist/core/hooks/useTranslations.d.ts +20 -0
- package/dist/core/hooks/useTranslationsMiddleware.d.ts +25 -0
- package/dist/core/pages/DevErrorPage.d.ts +9 -0
- package/dist/core/pages/DevNotFoundPage.d.ts +10 -0
- package/dist/core/pages/ErrorPage.d.ts +9 -0
- package/dist/core/plugin.d.ts +80 -0
- package/dist/core/pod.d.ts +54 -0
- package/dist/core/types.d.ts +228 -0
- package/dist/core.js +3 -3
- package/dist/core.js.map +7 -1
- package/dist/functions/functions.d.ts +1 -0
- package/dist/functions/server.d.ts +10 -0
- package/dist/functions.js +5 -5
- package/dist/functions.js.map +7 -1
- package/dist/jsx/jsx-dev-runtime.d.ts +10 -1
- package/dist/jsx/jsx-dev-runtime.js +2 -2
- package/dist/jsx/jsx-dev-runtime.js.map +7 -1
- package/dist/{jsx-C8BaDh-4.d.ts → jsx/jsx-render.d.ts} +3 -6
- package/dist/jsx/jsx-runtime.d.ts +120 -1
- package/dist/jsx/jsx-runtime.js +2 -2
- package/dist/jsx/jsx-runtime.js.map +7 -1
- package/dist/jsx/jsx.d.ts +37 -0
- package/dist/{jsx-dev-runtime-DUJrvx5P.d.ts → jsx/types.d.ts} +9 -125
- package/dist/jsx.js +3 -3
- package/dist/jsx.js.map +7 -1
- package/dist/middleware/common.d.ts +22 -0
- package/dist/middleware/hooks.d.ts +8 -0
- package/dist/middleware/middleware.d.ts +3 -0
- package/dist/middleware/multipart.d.ts +11 -0
- package/dist/middleware/redirects.d.ts +10 -0
- package/dist/middleware/session.d.ts +24 -0
- package/dist/middleware.js +2 -2
- package/dist/middleware.js.map +7 -1
- package/dist/node/element-graph.d.ts +51 -0
- package/dist/node/load-config.d.ts +17 -0
- package/dist/node/monorepo.d.ts +14 -0
- package/dist/node/node.d.ts +4 -0
- package/dist/node/pod-collector.d.ts +33 -0
- package/dist/node/pods-vite-plugin.d.ts +6 -0
- package/dist/node/vite-plugin-preact-alias.d.ts +10 -0
- package/dist/node/vite-plugin-prune-empty-chunks.d.ts +27 -0
- package/dist/node/vite-plugin-root-jsx-virtual.d.ts +16 -0
- package/dist/node/vite.d.ts +18 -0
- package/dist/node.js +2 -2
- package/dist/node.js.map +7 -1
- package/dist/render/accept-language.d.ts +8 -0
- package/dist/render/asset-map/asset-map.d.ts +25 -0
- package/dist/render/asset-map/build-asset-map.d.ts +47 -0
- package/dist/render/asset-map/dev-asset-map.d.ts +26 -0
- package/dist/render/countrie-language.d.ts +13 -0
- package/dist/render/html-minify.d.ts +3 -0
- package/dist/render/html-pretty.d.ts +3 -0
- package/dist/render/i18n-fallbacks.d.ts +11 -0
- package/dist/render/render.d.ts +91 -0
- package/dist/render/route-trie.d.ts +44 -0
- package/dist/render/router.d.ts +18 -0
- package/dist/render.js +9 -9
- package/dist/render.js.map +7 -1
- package/dist/utils/batch.d.ts +1 -0
- package/dist/utils/elements.d.ts +12 -0
- package/dist/utils/fsutils.d.ts +24 -0
- package/dist/utils/i18n.d.ts +8 -0
- package/dist/utils/ports.d.ts +8 -0
- package/dist/utils/rand.d.ts +10 -0
- package/dist/utils/url-path-params.d.ts +2 -0
- package/package.json +14 -15
- package/dist/chunk-FQBA5QSG.js.map +0 -1
- package/dist/chunk-GSR74KEI.js.map +0 -1
- package/dist/chunk-JCRXBB26.js.map +0 -1
- package/dist/chunk-M6WGW5VY.js.map +0 -1
- package/dist/chunk-PVBPP5LN.js.map +0 -1
- package/dist/chunk-WAZTR3DX.js.map +0 -1
- package/dist/cli.d.ts +0 -60
- package/dist/core.d.ts +0 -214
- package/dist/functions.d.ts +0 -14
- package/dist/jsx.d.ts +0 -2
- package/dist/middleware.d.ts +0 -43
- package/dist/node.d.ts +0 -91
- package/dist/render.d.ts +0 -8
- package/dist/types-Cksf99CK.d.ts +0 -827
|
@@ -1 +1,120 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module jsx-runtime
|
|
3
|
+
*
|
|
4
|
+
* Server-side JSX runtime for Root.js. Replaces Preact as the JSX renderer
|
|
5
|
+
* for server-side rendering (SSR/SSG). This module provides the automatic
|
|
6
|
+
* JSX transform entry point (`jsxImportSource`).
|
|
7
|
+
*
|
|
8
|
+
* Supports:
|
|
9
|
+
* - Automatic JSX transform (jsx, jsxs, Fragment)
|
|
10
|
+
* - Classic JSX transform (createElement / h)
|
|
11
|
+
* - Context API (createContext, useContext)
|
|
12
|
+
* - Server-side renderToString
|
|
13
|
+
*/
|
|
14
|
+
export type Key = string | number | null;
|
|
15
|
+
/**
|
|
16
|
+
* A virtual DOM node representing an element, component, or fragment.
|
|
17
|
+
*/
|
|
18
|
+
export interface VNode<P = Record<string, unknown>> {
|
|
19
|
+
type: string | FunctionalComponent<P> | typeof Fragment | (new (...args: any[]) => any);
|
|
20
|
+
props: P;
|
|
21
|
+
key: Key;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Valid children types for JSX elements.
|
|
25
|
+
*/
|
|
26
|
+
export type ComponentChildren = VNode<any> | string | number | bigint | boolean | null | undefined | ComponentChildren[];
|
|
27
|
+
export type ComponentChild = ComponentChildren;
|
|
28
|
+
/**
|
|
29
|
+
* A function component that receives props and returns a VNode or null.
|
|
30
|
+
*/
|
|
31
|
+
export interface FunctionalComponent<P = Record<string, unknown>> {
|
|
32
|
+
(props: P): VNode<any> | null;
|
|
33
|
+
displayName?: string;
|
|
34
|
+
/** @internal Marks this component as a context Provider. */
|
|
35
|
+
_isProvider?: boolean;
|
|
36
|
+
/** @internal Reference to the context object for Provider components. */
|
|
37
|
+
_context?: Context<any>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Generic component type (function components only for SSR).
|
|
41
|
+
*/
|
|
42
|
+
export type ComponentType<P = Record<string, unknown>> = FunctionalComponent<P>;
|
|
43
|
+
/**
|
|
44
|
+
* Global options object. The `vnode` callback is invoked for every VNode
|
|
45
|
+
* created via `jsx()`, `jsxs()`, or `createElement()`. This is used by the
|
|
46
|
+
* renderer to inject nonce values into script/style tags.
|
|
47
|
+
*/
|
|
48
|
+
export declare const options: {
|
|
49
|
+
vnode?: (vnode: VNode<any>) => void;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Fragment component. Renders its children without a wrapper DOM element.
|
|
53
|
+
* Used as `<>...</>` or `<Fragment>...</Fragment>` in JSX.
|
|
54
|
+
*/
|
|
55
|
+
export declare function Fragment(props: {
|
|
56
|
+
children?: ComponentChildren;
|
|
57
|
+
}): any;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a VNode. Used by the automatic JSX transform for elements with
|
|
60
|
+
* a single child or no children.
|
|
61
|
+
*/
|
|
62
|
+
export declare function jsx(type: string | FunctionalComponent<any> | typeof Fragment, props: Record<string, any>, key?: Key): VNode;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a VNode with static children. Used by the automatic JSX transform
|
|
65
|
+
* for elements with multiple children. Identical to `jsx()` for SSR since
|
|
66
|
+
* we don't need to diff children.
|
|
67
|
+
*/
|
|
68
|
+
export { jsx as jsxs };
|
|
69
|
+
/**
|
|
70
|
+
* Creates a VNode. Compatible with the classic `React.createElement` API.
|
|
71
|
+
*
|
|
72
|
+
* ```ts
|
|
73
|
+
* createElement('div', {className: 'foo'}, 'Hello', ' ', 'World');
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare function createElement(type: string | FunctionalComponent<any> | typeof Fragment, props?: Record<string, any> | null, ...children: any[]): VNode;
|
|
77
|
+
export { createElement as h };
|
|
78
|
+
/**
|
|
79
|
+
* A context object created by `createContext()`. Provides a `Provider`
|
|
80
|
+
* component and can be read via `useContext()`.
|
|
81
|
+
*/
|
|
82
|
+
export interface Context<T> {
|
|
83
|
+
/** @internal Default value for this context. */
|
|
84
|
+
_defaultValue: T;
|
|
85
|
+
/** @internal Stack of provided values (managed by renderToString). */
|
|
86
|
+
_stack: T[];
|
|
87
|
+
/** Provider component that supplies a context value to descendants. */
|
|
88
|
+
Provider: FunctionalComponent<{
|
|
89
|
+
value: T;
|
|
90
|
+
children?: ComponentChildren;
|
|
91
|
+
}>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Creates a new context with an optional default value. Returns a context
|
|
95
|
+
* object with a `Provider` component.
|
|
96
|
+
*
|
|
97
|
+
* ```ts
|
|
98
|
+
* const ThemeContext = createContext('light');
|
|
99
|
+
*
|
|
100
|
+
* // In a parent component:
|
|
101
|
+
* <ThemeContext.Provider value="dark">
|
|
102
|
+
* <App />
|
|
103
|
+
* </ThemeContext.Provider>
|
|
104
|
+
*
|
|
105
|
+
* // In a child component:
|
|
106
|
+
* const theme = useContext(ThemeContext);
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare function createContext<T>(defaultValue: T): Context<T>;
|
|
110
|
+
/**
|
|
111
|
+
* Reads the current value of a context. Must be called during the render
|
|
112
|
+
* of a function component that is a descendant of a matching Provider.
|
|
113
|
+
* Returns the default value if no Provider is found.
|
|
114
|
+
*
|
|
115
|
+
* ```ts
|
|
116
|
+
* const theme = useContext(ThemeContext);
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export declare function useContext<T>(context: Context<T>): T;
|
|
120
|
+
export type { JSX } from './types.js';
|
package/dist/jsx/jsx-runtime.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
jsx,
|
|
6
6
|
options,
|
|
7
7
|
useContext
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-3Z5TNZEP.js";
|
|
9
9
|
export {
|
|
10
10
|
Fragment,
|
|
11
11
|
createContext,
|
|
@@ -16,4 +16,4 @@ export {
|
|
|
16
16
|
options,
|
|
17
17
|
useContext
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=jsx-runtime.js.map
|
|
19
|
+
//# sourceMappingURL=jsx-runtime.js.map
|
|
@@ -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;
|
|
@@ -53,8 +53,8 @@ interface DOMAttributes {
|
|
|
53
53
|
onLoad?: EventHandler;
|
|
54
54
|
onError?: EventHandler;
|
|
55
55
|
}
|
|
56
|
-
type EventHandler = (...args: any[]) => void;
|
|
57
|
-
interface AriaAttributes {
|
|
56
|
+
type EventHandler = string | ((...args: any[]) => void);
|
|
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-
|
|
3
|
+
} from "./chunk-DU7JUEDY.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-
|
|
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
|
@@ -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,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
|
+
}
|
package/dist/middleware.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
rootProjectMiddleware,
|
|
7
7
|
sessionMiddleware,
|
|
8
8
|
trailingSlashMiddleware
|
|
9
|
-
} from "./chunk-
|
|
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
|
package/dist/middleware.js.map
CHANGED
|
@@ -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,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;
|