@blinkk/root 3.0.1-alpha.0 → 3.0.1-alpha.1

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.
@@ -1,12 +1,12 @@
1
- import { R as RootConfig, a as Request, b as Response, N as NextFunction } from './types-BstdV3Rj.js';
2
- export { S as SESSION_COOKIE, d as SaveSessionOptions, e as Session, c as SessionMiddlewareOptions, s as sessionMiddleware } from './types-BstdV3Rj.js';
1
+ import { R as RootConfig, a as Request, b as Response, N as NextFunction } from './types-Cksf99CK.js';
2
+ export { S as SESSION_COOKIE, d as SaveSessionOptions, e as Session, c as SessionMiddlewareOptions, s as sessionMiddleware } from './types-Cksf99CK.js';
3
3
  import { RequestHandler } from 'express';
4
4
  import 'preact';
5
5
  import 'vite';
6
- import 'html-minifier-terser';
7
- import 'js-beautify';
8
6
  import './jsx-C8BaDh-4.js';
9
7
  import './jsx-dev-runtime-DUJrvx5P.js';
8
+ import 'html-minifier-terser';
9
+ import 'js-beautify';
10
10
 
11
11
  /**
12
12
  * Middleware that injects the root.js project config into the request context.
package/dist/node.d.ts CHANGED
@@ -1,12 +1,44 @@
1
- import { R as RootConfig } from './types-BstdV3Rj.js';
1
+ import { P as PodConfig, R as RootConfig } from './types-Cksf99CK.js';
2
2
  import { PackageInfo } from 'workspace-tools';
3
3
  import { ViteDevServer } from 'vite';
4
4
  import 'express';
5
5
  import 'preact';
6
- import 'html-minifier-terser';
7
- import 'js-beautify';
8
6
  import './jsx-C8BaDh-4.js';
9
7
  import './jsx-dev-runtime-DUJrvx5P.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[]>;
10
42
 
11
43
  interface ConfigOptions {
12
44
  command: string;
@@ -56,4 +88,4 @@ declare function createViteServer(rootConfig: RootConfig, options?: CreateViteSe
56
88
  */
57
89
  declare function viteSsrLoadModule<T = Record<string, any>>(rootConfig: RootConfig, file: string): Promise<T>;
58
90
 
59
- export { type ConfigOptions, type CreateViteServerOptions, bundleRootConfig, createViteServer, flattenPackageDepsFromMonorepo, getMonorepoPackageDeps, loadBundledConfig, loadPackageJson, loadRootConfig, loadRootConfigWithDeps, viteSsrLoadModule };
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/node.js CHANGED
@@ -1,20 +1,24 @@
1
1
  import {
2
2
  bundleRootConfig,
3
+ collectPods,
3
4
  createViteServer,
4
5
  flattenPackageDepsFromMonorepo,
5
6
  getMonorepoPackageDeps,
7
+ invalidatePodCache,
6
8
  loadBundledConfig,
7
9
  loadPackageJson,
8
10
  loadRootConfig,
9
11
  loadRootConfigWithDeps,
10
12
  viteSsrLoadModule
11
- } from "./chunk-EBE4O463.js";
12
- import "./chunk-6FDF3DXT.js";
13
+ } from "./chunk-PVBPP5LN.js";
14
+ import "./chunk-XSNCF7WU.js";
13
15
  export {
14
16
  bundleRootConfig,
17
+ collectPods,
15
18
  createViteServer,
16
19
  flattenPackageDepsFromMonorepo,
17
20
  getMonorepoPackageDeps,
21
+ invalidatePodCache,
18
22
  loadBundledConfig,
19
23
  loadPackageJson,
20
24
  loadRootConfig,
package/dist/render.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export { K as Renderer } from './types-BstdV3Rj.js';
1
+ export { U as Renderer } from './types-Cksf99CK.js';
2
2
  import 'express';
3
3
  import 'preact';
4
4
  import 'vite';
5
- import 'html-minifier-terser';
6
- import 'js-beautify';
7
5
  import './jsx-C8BaDh-4.js';
8
6
  import './jsx-dev-runtime-DUJrvx5P.js';
7
+ import 'html-minifier-terser';
8
+ import 'js-beautify';
package/dist/render.js CHANGED
@@ -12877,10 +12877,9 @@ function test419Country(countryCode) {
12877
12877
 
12878
12878
  // src/render/router.ts
12879
12879
  import path from "path";
12880
- var ROUTES_FILES = import.meta.glob(
12881
- ["/routes/*.ts", "/routes/**/*.ts", "/routes/*.tsx", "/routes/**/*.tsx"],
12882
- { eager: true }
12883
- );
12880
+ import { ROUTE_MODULES, POD_ROUTE_MODULES } from "virtual:root/routes";
12881
+ var ROUTES_FILES = ROUTE_MODULES;
12882
+ var POD_ROUTES = POD_ROUTE_MODULES || {};
12884
12883
  var Router = class {
12885
12884
  rootConfig;
12886
12885
  routeTrie;
@@ -12901,6 +12900,9 @@ var Router = class {
12901
12900
  const locales = this.rootConfig.i18n?.locales || [];
12902
12901
  const basePath = this.rootConfig.base || "/";
12903
12902
  const defaultLocale = this.rootConfig.i18n?.defaultLocale || "en";
12903
+ const i18nUrlFormat = toSquareBrackets(
12904
+ this.rootConfig.i18n?.urlFormat || "/[locale]/[base]/[path]"
12905
+ );
12904
12906
  const trie = new RouteTrie();
12905
12907
  Object.keys(ROUTES_FILES).forEach((modulePath) => {
12906
12908
  const src = modulePath.slice(1);
@@ -12915,9 +12917,6 @@ var Router = class {
12915
12917
  relativeRoutePath = path.join(parts.dir, parts.name);
12916
12918
  }
12917
12919
  const urlFormat = "/[base]/[path]";
12918
- const i18nUrlFormat = toSquareBrackets(
12919
- this.rootConfig.i18n?.urlFormat || "/[locale]/[base]/[path]"
12920
- );
12921
12920
  const placeholders = {
12922
12921
  base: removeSlashes(basePath),
12923
12922
  path: removeSlashes(relativeRoutePath)
@@ -12954,6 +12953,42 @@ var Router = class {
12954
12953
  });
12955
12954
  }
12956
12955
  });
12956
+ Object.keys(POD_ROUTES).forEach((key) => {
12957
+ const entry = POD_ROUTES[key];
12958
+ const routePath = entry.routePath;
12959
+ const localeRoutePath = i18nUrlFormat.includes("[locale]") ? i18nUrlFormat.replaceAll("[base]", removeSlashes(basePath)).replaceAll("[path]", removeSlashes(routePath)) : routePath;
12960
+ const normalizedLocaleRoutePath = normalizeUrlPath(localeRoutePath, {
12961
+ trailingSlash: this.rootConfig.server?.trailingSlash
12962
+ });
12963
+ trie.add(routePath, {
12964
+ src: entry.src,
12965
+ module: entry.module,
12966
+ locale: defaultLocale,
12967
+ isDefaultLocale: true,
12968
+ routePath,
12969
+ localeRoutePath: normalizedLocaleRoutePath,
12970
+ podName: entry.podName
12971
+ });
12972
+ if (i18nUrlFormat.includes("[locale]")) {
12973
+ locales.forEach((locale) => {
12974
+ const localePath = normalizedLocaleRoutePath.replace(
12975
+ "[locale]",
12976
+ locale
12977
+ );
12978
+ if (localePath !== routePath) {
12979
+ trie.add(localePath, {
12980
+ src: entry.src,
12981
+ module: entry.module,
12982
+ locale,
12983
+ isDefaultLocale: false,
12984
+ routePath,
12985
+ localeRoutePath: normalizedLocaleRoutePath,
12986
+ podName: entry.podName
12987
+ });
12988
+ }
12989
+ });
12990
+ }
12991
+ });
12957
12992
  return trie;
12958
12993
  }
12959
12994
  async getAllPathsForRoute(urlPathFormat, route) {