@blinkk/root 3.0.2 → 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.
Files changed (117) 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-4PO5HYET.js → chunk-DU7JUEDY.js} +37 -4
  10. package/dist/chunk-DU7JUEDY.js.map +7 -0
  11. package/dist/{chunk-GSR74KEI.js → chunk-JTZWI4MH.js} +279 -73
  12. package/dist/chunk-JTZWI4MH.js.map +7 -0
  13. package/dist/{chunk-WAZTR3DX.js → chunk-KW7KTYGC.js} +2 -2
  14. package/dist/chunk-KW7KTYGC.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/start.d.ts +8 -0
  25. package/dist/cli/startup/check-version.d.ts +17 -0
  26. package/dist/cli/startup/startup-tasks.d.ts +39 -0
  27. package/dist/cli.js +4 -4
  28. package/dist/cli.js.map +7 -1
  29. package/dist/core/components/Body.d.ts +23 -0
  30. package/dist/core/components/Head.d.ts +18 -0
  31. package/dist/core/components/Html.d.ts +24 -0
  32. package/dist/core/components/Script.d.ts +16 -0
  33. package/dist/core/config.d.ts +285 -0
  34. package/dist/core/core.d.ts +14 -0
  35. package/dist/core/hooks/useI18nContext.d.ts +11 -0
  36. package/dist/core/hooks/useRequestContext.d.ts +36 -0
  37. package/dist/core/hooks/useStringParams.d.ts +34 -0
  38. package/dist/core/hooks/useTranslations.d.ts +20 -0
  39. package/dist/core/hooks/useTranslationsMiddleware.d.ts +25 -0
  40. package/dist/core/pages/DevErrorPage.d.ts +9 -0
  41. package/dist/core/pages/DevNotFoundPage.d.ts +10 -0
  42. package/dist/core/pages/ErrorPage.d.ts +9 -0
  43. package/dist/core/plugin.d.ts +80 -0
  44. package/dist/core/pod.d.ts +54 -0
  45. package/dist/core/types.d.ts +228 -0
  46. package/dist/core.js +3 -3
  47. package/dist/core.js.map +7 -1
  48. package/dist/functions/functions.d.ts +1 -0
  49. package/dist/functions/server.d.ts +10 -0
  50. package/dist/functions.js +5 -5
  51. package/dist/functions.js.map +7 -1
  52. package/dist/jsx/jsx-dev-runtime.d.ts +10 -1
  53. package/dist/jsx/jsx-dev-runtime.js +2 -2
  54. package/dist/jsx/jsx-dev-runtime.js.map +7 -1
  55. package/dist/{jsx-C8cJO55i.d.ts → jsx/jsx-render.d.ts} +3 -6
  56. package/dist/jsx/jsx-runtime.d.ts +120 -1
  57. package/dist/jsx/jsx-runtime.js +2 -2
  58. package/dist/jsx/jsx-runtime.js.map +7 -1
  59. package/dist/jsx/jsx.d.ts +37 -0
  60. package/dist/{jsx-dev-runtime-DHf9jiFH.d.ts → jsx/types.d.ts} +8 -124
  61. package/dist/jsx.js +3 -3
  62. package/dist/jsx.js.map +7 -1
  63. package/dist/middleware/common.d.ts +22 -0
  64. package/dist/middleware/hooks.d.ts +8 -0
  65. package/dist/middleware/middleware.d.ts +3 -0
  66. package/dist/middleware/multipart.d.ts +11 -0
  67. package/dist/middleware/redirects.d.ts +10 -0
  68. package/dist/middleware/session.d.ts +24 -0
  69. package/dist/middleware.js +2 -2
  70. package/dist/middleware.js.map +7 -1
  71. package/dist/node/element-graph.d.ts +51 -0
  72. package/dist/node/load-config.d.ts +17 -0
  73. package/dist/node/monorepo.d.ts +14 -0
  74. package/dist/node/node.d.ts +4 -0
  75. package/dist/node/pod-collector.d.ts +33 -0
  76. package/dist/node/pods-vite-plugin.d.ts +6 -0
  77. package/dist/node/vite-plugin-preact-alias.d.ts +10 -0
  78. package/dist/node/vite-plugin-prune-empty-chunks.d.ts +27 -0
  79. package/dist/node/vite-plugin-root-jsx-virtual.d.ts +16 -0
  80. package/dist/node/vite.d.ts +18 -0
  81. package/dist/node.js +2 -2
  82. package/dist/node.js.map +7 -1
  83. package/dist/render/accept-language.d.ts +8 -0
  84. package/dist/render/asset-map/asset-map.d.ts +25 -0
  85. package/dist/render/asset-map/build-asset-map.d.ts +47 -0
  86. package/dist/render/asset-map/dev-asset-map.d.ts +26 -0
  87. package/dist/render/countrie-language.d.ts +13 -0
  88. package/dist/render/html-minify.d.ts +3 -0
  89. package/dist/render/html-pretty.d.ts +3 -0
  90. package/dist/render/i18n-fallbacks.d.ts +11 -0
  91. package/dist/render/render.d.ts +91 -0
  92. package/dist/render/route-trie.d.ts +44 -0
  93. package/dist/render/router.d.ts +18 -0
  94. package/dist/render.js +9 -9
  95. package/dist/render.js.map +7 -1
  96. package/dist/utils/batch.d.ts +1 -0
  97. package/dist/utils/elements.d.ts +12 -0
  98. package/dist/utils/fsutils.d.ts +24 -0
  99. package/dist/utils/i18n.d.ts +8 -0
  100. package/dist/utils/ports.d.ts +8 -0
  101. package/dist/utils/rand.d.ts +10 -0
  102. package/dist/utils/url-path-params.d.ts +2 -0
  103. package/package.json +14 -15
  104. package/dist/chunk-4PO5HYET.js.map +0 -1
  105. package/dist/chunk-FQBA5QSG.js.map +0 -1
  106. package/dist/chunk-GSR74KEI.js.map +0 -1
  107. package/dist/chunk-JCRXBB26.js.map +0 -1
  108. package/dist/chunk-PVBPP5LN.js.map +0 -1
  109. package/dist/chunk-WAZTR3DX.js.map +0 -1
  110. package/dist/cli.d.ts +0 -60
  111. package/dist/core.d.ts +0 -214
  112. package/dist/functions.d.ts +0 -14
  113. package/dist/jsx.d.ts +0 -2
  114. package/dist/middleware.d.ts +0 -43
  115. package/dist/node.d.ts +0 -91
  116. package/dist/render.d.ts +0 -8
  117. package/dist/types-B-pJtsB4.d.ts +0 -827
package/dist/core.d.ts DELETED
@@ -1,214 +0,0 @@
1
- import { g as Route } from './types-B-pJtsB4.js';
2
- export { u as ConfigureServerHook, v as ConfigureServerOptions, C as ContentSecurityPolicyConfig, I as GetStaticContent, B as GetStaticPaths, G as GetStaticProps, E as Handler, H as HandlerContext, O as HandlerRenderFn, K as HandlerRenderOptions, L as LocaleGroup, M as MultipartFile, N as NextFunction, x as Plugin, w as PluginHooks, p as Pod, P as PodConfig, q as PodFactory, t as PostBuildOptions, a as Request, D as RequestMiddleware, b as Response, j as RootBuildConfig, R as RootConfig, l as RootHeaderConfig, i as RootI18nConfig, k as RootRedirectConfig, m as RootSecurityConfig, n as RootServerConfig, h as RootUserConfig, J as RouteModule, A as RouteParams, f as Server, Q as Sitemap, T as SitemapItem, F as StaticContentResult, X as XFrameOptionsConfig, y as configureServerPlugins, o as defineConfig, r as definePod, z as getVitePlugins } from './types-B-pJtsB4.js';
3
- import * as preact$1 from 'preact';
4
- import { FunctionalComponent, ComponentChildren } from 'preact';
5
- import 'express';
6
- import 'vite';
7
- import './jsx-C8cJO55i.js';
8
- import './jsx-dev-runtime-DHf9jiFH.js';
9
- import 'html-minifier-terser';
10
- import 'js-beautify';
11
-
12
- type BodyProps = preact.JSX.HTMLAttributes<HTMLBodyElement> & {
13
- children?: ComponentChildren;
14
- };
15
- /**
16
- * The `<Body>` component can be used to update attrs in the `<body>` tag.
17
- *
18
- * Usage:
19
- *
20
- * ```tsx
21
- * <Body className="body">
22
- * <h1>Hello world</h1>
23
- * </Body>
24
- * ```
25
- *
26
- * Output:
27
- *
28
- * ```html
29
- * <body class="body">
30
- * <h1>Hello world</h1>
31
- * </body>
32
- */
33
- declare const Body: FunctionalComponent<BodyProps>;
34
-
35
- type HeadProps = preact.JSX.HTMLAttributes<HTMLHeadElement> & {
36
- children?: ComponentChildren;
37
- };
38
- /**
39
- * The <Head> component can be used for injecting elements into the HTML head
40
- * tag from any part of a page. The <Head> can be added via any component or
41
- * sub-component and will automatically be hoisted to the `<head>` element.
42
- *
43
- * Usage:
44
- *
45
- * ```tsx
46
- * <Head>
47
- * <link rel="preconnect" href="https://fonts.googleapis.com" />
48
- * </Head>
49
- * ```
50
- */
51
- declare const Head: FunctionalComponent<HeadProps>;
52
-
53
- interface HtmlContext {
54
- htmlAttrs: preact$1.JSX.HTMLAttributes<HTMLHtmlElement>;
55
- headAttrs: preact$1.JSX.HTMLAttributes<HTMLHeadElement>;
56
- headComponents: ComponentChildren[];
57
- bodyAttrs: preact$1.JSX.HTMLAttributes<HTMLBodyElement>;
58
- scriptDeps: Array<preact$1.JSX.ScriptHTMLAttributes<HTMLScriptElement>>;
59
- }
60
- declare const HTML_CONTEXT: preact$1.Context<HtmlContext | null>;
61
- type HtmlProps = preact$1.JSX.HTMLAttributes<HTMLHtmlElement> & {
62
- children?: ComponentChildren;
63
- };
64
- /**
65
- * The `<Html>` component can be used to update attrs in the `<html>` tag.
66
- *
67
- * Usage:
68
- *
69
- * ```tsx
70
- * <Html lang="en-US">
71
- * <h1>Hello world</h1>
72
- * </Html>
73
- * ```
74
- */
75
- declare const Html: FunctionalComponent<HtmlProps>;
76
-
77
- type ScriptProps = preact.JSX.HTMLAttributes<HTMLScriptElement> & {
78
- src?: string;
79
- };
80
- /**
81
- * The <Script> component is used for rendering any custom script modules. At
82
- * the moment, the system only pre-renders and bundles files that are in the
83
- * `/bundles` folder at the root of the project.
84
- *
85
- * Usage:
86
- *
87
- * ```tsx
88
- * <Script src="/bundles/main.ts" />
89
- * ```
90
- */
91
- declare const Script: FunctionalComponent<ScriptProps>;
92
-
93
- type StringParamsContext = Record<string, string>;
94
- interface StringParamsProviderProps {
95
- value?: StringParamsContext;
96
- children?: ComponentChildren;
97
- }
98
- declare const StringParamsProvider: FunctionalComponent<StringParamsProviderProps>;
99
- /**
100
- * A hook that returns a map of string params, configured via the
101
- * `StringParamsProvider` context provider. These params are automatically
102
- * applied to the `useTranslations()` hook.
103
- *
104
- *
105
- * Usage:
106
- *
107
- * ```
108
- * export default function Page() {
109
- * return (
110
- * <StringParamsProvider value={{name: 'Alice'}}>
111
- * <SayHello />
112
- * </StringParamsProvider>
113
- * );
114
- * }
115
- *
116
- * function SayHello() {
117
- * const t = useTranslations();
118
- * return <h1>{t('Hello, {name}!')}</h1>;
119
- * }
120
- * ```
121
- *
122
- * This should render `<h1>Hello, Alice!</h1>`.
123
- */
124
- declare function useStringParams(): StringParamsContext;
125
-
126
- type TransformFn = (str: string) => string;
127
- interface TranslationMiddleware {
128
- /** Transform the string before translation lookup. */
129
- beforeTranslate?: TransformFn;
130
- /** Transform the string after translation lookup. */
131
- afterTranslate?: TransformFn;
132
- /** Transform the string before `{param}` values are replaced. */
133
- beforeReplaceParams?: TransformFn;
134
- /** Transform the string after `{param}` values are replaced. */
135
- afterReplaceParams?: TransformFn;
136
- }
137
- interface TranslationMiddlewareContext {
138
- beforeTranslateFns: TransformFn[];
139
- afterTranslateFns: TransformFn[];
140
- beforeReplaceParamsFns: TransformFn[];
141
- afterReplaceParamsFns: TransformFn[];
142
- }
143
- interface TranslationMiddlewareProviderProps {
144
- value?: TranslationMiddleware;
145
- children?: ComponentChildren;
146
- }
147
- declare const TranslationMiddlewareProvider: FunctionalComponent<TranslationMiddlewareProviderProps>;
148
- declare function useTranslationMiddleware(): TranslationMiddlewareContext;
149
-
150
- interface I18nContext {
151
- locale: string;
152
- translations: Record<string, string>;
153
- }
154
- /**
155
- * A hook that returns information about the current i18n context, including the
156
- * locale for the given route and a map of translations for that locale.
157
- */
158
- declare function useI18nContext(): I18nContext;
159
- declare function getTranslations(locale: string): Record<string, string>;
160
-
161
- interface RequestContext {
162
- /**
163
- * The current request path, e.g. `/foo/bar` (default route path) or
164
- * `/{locale}/foo/bar` (localized route path).
165
- */
166
- currentPath: string;
167
- /** The route file. */
168
- route: Route;
169
- /**
170
- * Route param values. E.g. for a route like `routes/blog/[slug].tsx`,
171
- * visiting `/blog/foo` will pass {slug: 'foo'} here.
172
- */
173
- routeParams: Record<string, string>;
174
- /** Props passed to the route's server component. */
175
- props: any;
176
- /** The current locale. */
177
- locale: string;
178
- /** Translations map for the current locale. */
179
- translations: Record<string, string>;
180
- /** CSP nonce value. */
181
- nonce?: string;
182
- }
183
- /**
184
- * A hook that returns information about the current route.
185
- *
186
- * Usage:
187
- *
188
- * ```ts
189
- * const ctx = useRequestContext();
190
- * ctx.route.src;
191
- * // => 'routes/index.tsx'
192
- * ```
193
- */
194
- declare function useRequestContext(): RequestContext;
195
-
196
- /**
197
- * A hook that returns a function that can be used to translate a string, and
198
- * optionally replace any parameterized values that are surrounded in curly
199
- * braces.
200
- *
201
- * Usage:
202
- *
203
- * ```ts
204
- * const t = useTranslations();
205
- * t('Hello {name}', {name: 'Bob'});
206
- * // => 'Bounjour Bob'
207
- * ```
208
- */
209
- declare function useTranslations(): (str: string, params?: Record<string, string | number>) => string;
210
-
211
- declare function replaceParams(urlPathFormat: string, params: Record<string, string>): string;
212
- declare function testPathHasParams(urlPath: string): boolean;
213
-
214
- export { Body, HTML_CONTEXT, Head, Html, type I18nContext, type RequestContext, Route, Script, type StringParamsContext, StringParamsProvider, TranslationMiddlewareProvider, getTranslations, replaceParams, testPathHasParams, useI18nContext, useRequestContext, useStringParams, useTranslationMiddleware, useTranslations };
@@ -1,14 +0,0 @@
1
- import * as firebase_functions_v2_https from 'firebase-functions/v2/https';
2
- import { HttpsOptions } from 'firebase-functions/v2/https';
3
-
4
- interface ProdServerOptions {
5
- rootDir?: string;
6
- mode?: 'preview' | 'production';
7
- httpsOptions?: HttpsOptions;
8
- }
9
- /**
10
- * Firebase Function that runs a Root.js server running in SSR mode.
11
- */
12
- declare function server(options?: ProdServerOptions): firebase_functions_v2_https.HttpsFunction;
13
-
14
- export { type ProdServerOptions, server };
package/dist/jsx.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export { A as AriaAttributes, b as ComponentChild, C as ComponentChildren, d as ComponentType, f as Context, D as DOMAttributes, F as Fragment, e as FunctionalComponent, H as HTMLAttributes, J as JSX, K as Key, S as SVGAttributes, g as ScriptHTMLAttributes, V as VNode, a as createContext, c as createElement, c as h, j as jsx, j as jsxs, o as options, u as useContext } from './jsx-dev-runtime-DHf9jiFH.js';
2
- export { r as renderJsxToString } from './jsx-C8cJO55i.js';
@@ -1,43 +0,0 @@
1
- import { R as RootConfig, a as Request, b as Response, N as NextFunction } from './types-B-pJtsB4.js';
2
- export { S as SESSION_COOKIE, d as SaveSessionOptions, e as Session, c as SessionMiddlewareOptions, s as sessionMiddleware } from './types-B-pJtsB4.js';
3
- import { RequestHandler } from 'express';
4
- import 'preact';
5
- import 'vite';
6
- import './jsx-C8cJO55i.js';
7
- import './jsx-dev-runtime-DHf9jiFH.js';
8
- import 'html-minifier-terser';
9
- import 'js-beautify';
10
-
11
- /**
12
- * Middleware that injects the root.js project config into the request context.
13
- */
14
- declare function rootProjectMiddleware(options: {
15
- rootConfig: RootConfig;
16
- }): (req: Request, _: Response, next: NextFunction) => void;
17
- /**
18
- * Middleware that injects HTTP headers from the `server.headers` config in
19
- * root.config.ts.
20
- */
21
- declare function headersMiddleware(options: {
22
- rootConfig: RootConfig;
23
- }): (req: Request, res: Response, next: NextFunction) => void;
24
- /**
25
- * Trailing slash middleware. Handles trailing slash redirects (preserving any
26
- * query params) using the `server.trailingSlash` config in root.config.ts.
27
- */
28
- declare function trailingSlashMiddleware(options: {
29
- rootConfig: RootConfig;
30
- }): (req: Request, res: Response, next: NextFunction) => void;
31
-
32
- /**
33
- * Middleware for parsing multipart file uploads that's compatible with the dev
34
- * server and Firebase Functions.
35
- *
36
- * Context:
37
- * https://stackoverflow.com/questions/47242340/how-to-perform-an-http-file-upload-using-express-on-cloud-functions-for-firebase
38
- */
39
- declare function multipartMiddleware(options?: {
40
- maxFileSize?: number;
41
- }): RequestHandler;
42
-
43
- export { headersMiddleware, multipartMiddleware, rootProjectMiddleware, trailingSlashMiddleware };
package/dist/node.d.ts DELETED
@@ -1,91 +0,0 @@
1
- import { P as PodConfig, R as RootConfig } from './types-B-pJtsB4.js';
2
- import { PackageInfo } from 'workspace-tools';
3
- import { ViteDevServer } from 'vite';
4
- import 'express';
5
- import 'preact';
6
- import './jsx-C8cJO55i.js';
7
- import './jsx-dev-runtime-DHf9jiFH.js';
8
- import 'html-minifier-terser';
9
- import 'js-beautify';
10
-
11
- interface ResolvedPodRoute {
12
- filePath: string;
13
- relPath: string;
14
- routePath: string;
15
- }
16
- interface ResolvedPodCollection {
17
- filePath: string;
18
- relPath: string;
19
- id: string;
20
- }
21
- interface ResolvedPod {
22
- name: string;
23
- enabled: boolean;
24
- mount: string;
25
- priority: number;
26
- routesDir?: string;
27
- elementsDirs: string[];
28
- bundlesDir?: string;
29
- collectionsDir?: string;
30
- translationsDir?: string;
31
- routeFiles: ResolvedPodRoute[];
32
- bundleFiles: string[];
33
- collectionFiles: ResolvedPodCollection[];
34
- translationFiles: Array<{
35
- locale: string;
36
- filePath: string;
37
- }>;
38
- config: PodConfig;
39
- }
40
- declare function invalidatePodCache(): void;
41
- declare function collectPods(rootConfig: RootConfig): Promise<ResolvedPod[]>;
42
-
43
- interface ConfigOptions {
44
- command: string;
45
- }
46
- declare function loadRootConfig(rootDir: string, options: ConfigOptions): Promise<RootConfig>;
47
- declare function loadRootConfigWithDeps(rootDir: string, options: ConfigOptions): Promise<{
48
- rootConfig: RootConfig;
49
- dependencies: string[];
50
- }>;
51
- /**
52
- * Compiles a root.config.ts file to root.config.js.
53
- */
54
- declare function bundleRootConfig(rootDir: string, outPath: string): Promise<void>;
55
- /**
56
- * Loads a pre-bundled config file from dist/root.config.js.
57
- */
58
- declare function loadBundledConfig(rootDir: string, options: ConfigOptions): Promise<RootConfig>;
59
-
60
- declare function loadPackageJson(filepath: string): PackageInfo | null;
61
- /**
62
- * Returns the top-level monorepo package's deps, if any.
63
- */
64
- declare function getMonorepoPackageDeps(rootDir: string): Record<string, string>;
65
- /**
66
- * Flattens package.json deps from the root project dir, taking into account any
67
- * deps from the monorepo root as well as any `workspace:` deps from within the
68
- * monorepo.
69
- */
70
- declare function flattenPackageDepsFromMonorepo(rootDir: string, options?: {
71
- ignore?: Set<string>;
72
- }): Record<string, string>;
73
-
74
- interface CreateViteServerOptions {
75
- /** Override HMR settings. */
76
- hmr?: boolean;
77
- /** The port the server will run on. */
78
- port?: number;
79
- /** List of files to include in the optimizeDeps.include config. */
80
- optimizeDeps?: string[];
81
- }
82
- /**
83
- * Returns a vite dev server.
84
- */
85
- declare function createViteServer(rootConfig: RootConfig, options?: CreateViteServerOptions): Promise<ViteDevServer>;
86
- /**
87
- * Shortcut `viteServer.ssrLoadModule()` without starting an actual dev server.
88
- */
89
- declare function viteSsrLoadModule<T = Record<string, any>>(rootConfig: RootConfig, file: string): Promise<T>;
90
-
91
- export { type ConfigOptions, type CreateViteServerOptions, type ResolvedPod, type ResolvedPodCollection, type ResolvedPodRoute, bundleRootConfig, collectPods, createViteServer, flattenPackageDepsFromMonorepo, getMonorepoPackageDeps, invalidatePodCache, loadBundledConfig, loadPackageJson, loadRootConfig, loadRootConfigWithDeps, viteSsrLoadModule };
package/dist/render.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export { U as Renderer } from './types-B-pJtsB4.js';
2
- import 'express';
3
- import 'preact';
4
- import 'vite';
5
- import './jsx-C8cJO55i.js';
6
- import './jsx-dev-runtime-DHf9jiFH.js';
7
- import 'html-minifier-terser';
8
- import 'js-beautify';