@jk2908/solas 0.5.4 → 0.7.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +34 -94
  3. package/dist/config.d.ts +24 -0
  4. package/dist/config.js +143 -0
  5. package/dist/events.d.ts +4 -0
  6. package/dist/events.js +5 -0
  7. package/dist/index.d.ts +1 -2
  8. package/dist/index.js +59 -41
  9. package/dist/internal/boundary-error.d.ts +4 -0
  10. package/dist/internal/boundary-error.js +8 -0
  11. package/dist/internal/browser-router/history.d.ts +1 -1
  12. package/dist/internal/browser-router/link.d.ts +1 -1
  13. package/dist/internal/browser-router/link.js +1 -1
  14. package/dist/internal/browser-router/router.d.ts +2 -2
  15. package/dist/internal/browser-router/router.js +5 -5
  16. package/dist/internal/browser-router/shared.d.ts +182 -184
  17. package/dist/internal/browser-router/shared.js +49 -56
  18. package/dist/internal/browser-router/use-router.d.ts +1 -1
  19. package/dist/internal/browser-router/use-search-params.js +3 -3
  20. package/dist/internal/build.d.ts +108 -110
  21. package/dist/internal/build.js +569 -581
  22. package/dist/internal/codegen/config.js +4 -5
  23. package/dist/internal/codegen/environments.d.ts +1 -1
  24. package/dist/internal/codegen/environments.js +6 -9
  25. package/dist/internal/codegen/format.d.ts +6 -0
  26. package/dist/internal/codegen/format.js +24 -0
  27. package/dist/internal/codegen/manifest.js +2 -2
  28. package/dist/internal/codegen/maps.d.ts +1 -1
  29. package/dist/internal/codegen/maps.js +2 -2
  30. package/dist/internal/codegen/types.js +4 -4
  31. package/dist/internal/codegen/utils.js +2 -2
  32. package/dist/internal/env/request-context.js +1 -1
  33. package/dist/internal/env/rsc.d.ts +3 -3
  34. package/dist/internal/env/rsc.js +26 -26
  35. package/dist/internal/env/ssr.js +4 -4
  36. package/dist/internal/http-router/router.js +8 -8
  37. package/dist/internal/metadata.d.ts +1 -1
  38. package/dist/internal/metadata.js +1 -1
  39. package/dist/internal/navigation/http-exception-boundary.d.ts +1 -1
  40. package/dist/internal/navigation/redirect-boundary.d.ts +1 -1
  41. package/dist/internal/navigation/redirect.js +6 -6
  42. package/dist/internal/postbuild.js +18 -17
  43. package/dist/internal/prerender.d.ts +130 -138
  44. package/dist/internal/prerender.js +326 -354
  45. package/dist/internal/public-files.js +2 -4
  46. package/dist/internal/render/head.js +2 -2
  47. package/dist/internal/resolver.js +1 -1
  48. package/dist/internal/runtimes/runtime.d.ts +7 -21
  49. package/dist/internal/runtimes/runtime.js +24 -19
  50. package/dist/internal/server/actions.js +2 -2
  51. package/dist/internal/ui/error-boundary.d.ts +1 -1
  52. package/dist/manifest.d.ts +7 -0
  53. package/dist/manifest.js +85 -0
  54. package/dist/prerender.d.ts +1 -1
  55. package/dist/prerender.js +1 -1
  56. package/dist/solas.d.ts +2 -46
  57. package/dist/solas.js +6 -266
  58. package/dist/types.d.ts +14 -25
  59. package/dist/types.js +1 -1
  60. package/dist/utils/base-path.d.ts +12 -14
  61. package/dist/utils/base-path.js +75 -82
  62. package/dist/utils/compress.d.ts +9 -11
  63. package/dist/utils/compress.js +59 -64
  64. package/dist/utils/context.d.ts +4 -6
  65. package/dist/utils/context.js +17 -22
  66. package/dist/utils/logger.js +2 -2
  67. package/dist/utils/time.d.ts +2 -4
  68. package/dist/utils/time.js +23 -29
  69. package/package.json +18 -8
  70. package/dist/internal/runtimes/bun.d.ts +0 -9
  71. package/dist/internal/runtimes/bun.js +0 -33
  72. package/dist/internal/runtimes/create.d.ts +0 -4
  73. package/dist/internal/runtimes/create.js +0 -9
  74. package/dist/internal/runtimes/node.d.ts +0 -9
  75. package/dist/internal/runtimes/node.js +0 -31
@@ -4,123 +4,121 @@ import type { BuildContext, Endpoint, PluginConfig, Segment } from '../types.js'
4
4
  * The Finder walks the app directory, builds inheritance chains, and transforms
5
5
  * the scan result into codegen artifacts consumed by generated entry files
6
6
  */
7
- export declare namespace Build {
7
+ /**
8
+ * Raw output of the filesystem scan before any processing. Segments
9
+ * are renderable routes (pages and layout wrappers), endpoints are
10
+ * API routes with HTTP verb handlers
11
+ */
12
+ export type ScanResult = {
13
+ segments: {
14
+ dir: string;
15
+ page?: string;
16
+ layouts: (string | null)[];
17
+ shell: string;
18
+ '401s': (string | null)[];
19
+ '403s': (string | null)[];
20
+ '404s': (string | null)[];
21
+ '500s': (string | null)[];
22
+ loaders: (string | null)[];
23
+ middlewares: (string | null)[];
24
+ }[];
25
+ endpoints: {
26
+ file: string;
27
+ middlewares: (string | null)[];
28
+ }[];
29
+ };
30
+ /**
31
+ * Collected import paths keyed by entry id. Static imports are eagerly
32
+ * loaded, dynamic imports are lazy-loaded via React.lazy
33
+ */
34
+ export type Imports = {
35
+ endpoints: {
36
+ static: Map<string, string>;
37
+ };
38
+ components: {
39
+ static: Map<string, string>;
40
+ dynamic: Map<string, string>;
41
+ };
42
+ middlewares: {
43
+ static: Map<string, string>;
44
+ };
45
+ };
46
+ /**
47
+ * Maps each entry id to the ids of its shell, layouts, page, error boundaries,
48
+ * loaders, and middleware. Used by codegen to produce the import map
49
+ * that the resolver reads at runtime
50
+ */
51
+ export type Modules = Record<string, {
52
+ shellId?: string;
53
+ layoutIds?: (string | null)[];
54
+ pageId?: string;
55
+ '401Ids'?: (string | null)[];
56
+ '403Ids'?: (string | null)[];
57
+ '404Ids'?: (string | null)[];
58
+ '500Ids'?: (string | null)[];
59
+ loadingIds?: (string | null)[];
60
+ middlewareIds?: (string | null)[];
61
+ endpointId?: string;
62
+ }>;
63
+ export declare const EntryKind: {
64
+ readonly SHELL: "$S";
65
+ readonly LAYOUT: "$L";
66
+ readonly PAGE: "$P";
67
+ readonly 401: "$401";
68
+ readonly 403: "$403";
69
+ readonly 404: "$404";
70
+ readonly 500: "$500";
71
+ readonly LOADING: "$LOAD";
72
+ readonly MIDDLEWARE: "$MW";
73
+ readonly ENDPOINT: "$E";
74
+ };
75
+ /**
76
+ * Encapsulates the logic for scanning the app directory and processing the
77
+ * result into the manifest, import map, and module map
78
+ */
79
+ export declare class Finder {
80
+ #private;
81
+ readonly buildContext: BuildContext;
82
+ readonly config: PluginConfig;
83
+ constructor(buildContext: BuildContext, config: PluginConfig);
8
84
  /**
9
- * Raw output of the filesystem scan before any processing. Segments
10
- * are renderable routes (pages and layout wrappers), endpoints are
11
- * API routes with HTTP verb handlers
85
+ * Extracts dynamic parameter names from a file path
12
86
  */
13
- type ScanResult = {
14
- segments: {
15
- dir: string;
16
- page?: string;
17
- layouts: (string | null)[];
18
- shell: string;
19
- '401s': (string | null)[];
20
- '403s': (string | null)[];
21
- '404s': (string | null)[];
22
- '500s': (string | null)[];
23
- loaders: (string | null)[];
24
- middlewares: (string | null)[];
25
- }[];
26
- endpoints: {
27
- file: string;
28
- middlewares: (string | null)[];
29
- }[];
30
- };
87
+ static getParams(file: string): string[];
31
88
  /**
32
- * Collected import paths keyed by entry id. Static imports are eagerly
33
- * loaded, dynamic imports are lazy-loaded via React.lazy
89
+ * Get the depth of a route based on slashes
34
90
  */
35
- type Imports = {
36
- endpoints: {
37
- static: Map<string, string>;
38
- };
39
- components: {
40
- static: Map<string, string>;
41
- dynamic: Map<string, string>;
42
- };
43
- middlewares: {
44
- static: Map<string, string>;
45
- };
46
- };
91
+ static getDepth(route: string): number;
92
+ /**
93
+ * Convert a file path to a canonical route.
94
+ */
95
+ static toCanonicalRoute(file: string): string;
47
96
  /**
48
- * Maps each entry id to the ids of its shell, layouts, page, error boundaries,
49
- * loaders, and middleware. Used by codegen to produce the import map
50
- * that the resolver reads at runtime
97
+ * Get the import path for a file relative to the generated directory,
98
+ * with the extension stripped and backslashes normalised
51
99
  */
52
- type Modules = Record<string, {
53
- shellId?: string;
54
- layoutIds?: (string | null)[];
55
- pageId?: string;
56
- '401Ids'?: (string | null)[];
57
- '403Ids'?: (string | null)[];
58
- '404Ids'?: (string | null)[];
59
- '500Ids'?: (string | null)[];
60
- loadingIds?: (string | null)[];
61
- middlewareIds?: (string | null)[];
62
- endpointId?: string;
100
+ static getImportPath(file: string): string;
101
+ /**
102
+ * Entry point: scan the app directory then process the result
103
+ * into the manifest, import map, and module map
104
+ */
105
+ run(): Promise<{
106
+ manifest: Record<string, (Endpoint | Segment)[] | Endpoint | Segment>;
107
+ imports: Imports;
108
+ modules: Modules;
109
+ prerenderRoutes: Set<string>;
110
+ knownRoutes: Set<string>;
63
111
  }>;
64
- const EntryKind: {
65
- readonly SHELL: "$S";
66
- readonly LAYOUT: "$L";
67
- readonly PAGE: "$P";
68
- readonly 401: "$401";
69
- readonly 403: "$403";
70
- readonly 404: "$404";
71
- readonly 500: "$500";
72
- readonly LOADING: "$LOAD";
73
- readonly MIDDLEWARE: "$MW";
74
- readonly ENDPOINT: "$E";
75
- };
76
112
  /**
77
- * Encapsulates the logic for scanning the app directory and processing the
78
- * result into the manifest, import map, and module map
113
+ * Transform the raw scan result into the route manifest, import map,
114
+ * and module map for codegen, along with route sets for
115
+ * prerendering and sitemap generation
79
116
  */
80
- class Finder {
81
- #private;
82
- readonly buildContext: BuildContext;
83
- readonly config: PluginConfig;
84
- constructor(buildContext: BuildContext, config: PluginConfig);
85
- /**
86
- * Extracts dynamic parameter names from a file path
87
- */
88
- static getParams(file: string): string[];
89
- /**
90
- * Get the depth of a route based on slashes
91
- */
92
- static getDepth(route: string): number;
93
- /**
94
- * Convert a file path to a canonical route.
95
- */
96
- static toCanonicalRoute(file: string): string;
97
- /**
98
- * Get the import path for a file relative to the generated directory,
99
- * with the extension stripped and backslashes normalised
100
- */
101
- static getImportPath(file: string): string;
102
- /**
103
- * Entry point: scan the app directory then process the result
104
- * into the manifest, import map, and module map
105
- */
106
- run(): Promise<{
107
- manifest: Record<string, (Endpoint | Segment)[] | Endpoint | Segment>;
108
- imports: Imports;
109
- modules: Modules;
110
- prerenderRoutes: Set<string>;
111
- knownRoutes: Set<string>;
112
- }>;
113
- /**
114
- * Transform the raw scan result into the route manifest, import map,
115
- * and module map for codegen, along with route sets for
116
- * prerendering and sitemap generation
117
- */
118
- process(res: ScanResult): Promise<{
119
- manifest: Record<string, (Endpoint | Segment)[] | Endpoint | Segment>;
120
- imports: Imports;
121
- modules: Modules;
122
- prerenderRoutes: Set<string>;
123
- knownRoutes: Set<string>;
124
- }>;
125
- }
117
+ process(res: ScanResult): Promise<{
118
+ manifest: Record<string, (Endpoint | Segment)[] | Endpoint | Segment>;
119
+ imports: Imports;
120
+ modules: Modules;
121
+ prerenderRoutes: Set<string>;
122
+ knownRoutes: Set<string>;
123
+ }>;
126
124
  }