@jk2908/solas 0.5.4 → 0.6.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.
- package/CHANGELOG.md +24 -0
- package/README.md +81 -85
- package/dist/config.d.ts +25 -0
- package/dist/config.js +152 -0
- package/dist/events.d.ts +4 -0
- package/dist/events.js +5 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +59 -37
- package/dist/internal/boundary-error.d.ts +4 -0
- package/dist/internal/boundary-error.js +8 -0
- package/dist/internal/browser-router/history.d.ts +1 -1
- package/dist/internal/browser-router/link.d.ts +1 -1
- package/dist/internal/browser-router/link.js +1 -1
- package/dist/internal/browser-router/router.d.ts +2 -2
- package/dist/internal/browser-router/router.js +5 -5
- package/dist/internal/browser-router/shared.d.ts +182 -184
- package/dist/internal/browser-router/shared.js +49 -56
- package/dist/internal/browser-router/use-router.d.ts +1 -1
- package/dist/internal/browser-router/use-search-params.js +3 -3
- package/dist/internal/build.d.ts +108 -110
- package/dist/internal/build.js +569 -581
- package/dist/internal/codegen/config.js +3 -3
- package/dist/internal/codegen/environments.js +5 -6
- package/dist/internal/codegen/format.d.ts +6 -0
- package/dist/internal/codegen/format.js +24 -0
- package/dist/internal/codegen/manifest.js +2 -2
- package/dist/internal/codegen/maps.d.ts +1 -1
- package/dist/internal/codegen/maps.js +2 -2
- package/dist/internal/codegen/types.js +4 -4
- package/dist/internal/codegen/utils.js +2 -2
- package/dist/internal/env/request-context.js +1 -1
- package/dist/internal/env/rsc.d.ts +3 -2
- package/dist/internal/env/rsc.js +26 -25
- package/dist/internal/env/ssr.js +4 -4
- package/dist/internal/http-router/router.js +8 -8
- package/dist/internal/metadata.d.ts +1 -1
- package/dist/internal/metadata.js +1 -1
- package/dist/internal/navigation/http-exception-boundary.d.ts +1 -1
- package/dist/internal/navigation/redirect-boundary.d.ts +1 -1
- package/dist/internal/navigation/redirect.js +6 -6
- package/dist/internal/postbuild.js +18 -17
- package/dist/internal/prerender.d.ts +130 -138
- package/dist/internal/prerender.js +326 -354
- package/dist/internal/public-files.js +2 -4
- package/dist/internal/render/head.js +2 -2
- package/dist/internal/resolver.js +1 -1
- package/dist/internal/server/actions.js +2 -2
- package/dist/internal/ui/error-boundary.d.ts +1 -1
- package/dist/manifest.d.ts +7 -0
- package/dist/manifest.js +85 -0
- package/dist/prerender.d.ts +1 -1
- package/dist/prerender.js +1 -1
- package/dist/solas.d.ts +2 -46
- package/dist/solas.js +6 -266
- package/dist/types.d.ts +14 -21
- package/dist/types.js +1 -1
- package/dist/utils/base-path.d.ts +12 -14
- package/dist/utils/base-path.js +75 -82
- package/dist/utils/compress.d.ts +9 -11
- package/dist/utils/compress.js +59 -64
- package/dist/utils/context.d.ts +4 -6
- package/dist/utils/context.js +17 -22
- package/dist/utils/logger.js +2 -2
- package/dist/utils/time.d.ts +2 -4
- package/dist/utils/time.js +23 -29
- package/package.json +18 -8
package/dist/internal/build.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
33
|
-
* loaded, dynamic imports are lazy-loaded via React.lazy
|
|
89
|
+
* Get the depth of a route based on slashes
|
|
34
90
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
*
|
|
49
|
-
*
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
*
|
|
78
|
-
*
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
}
|