polen 0.10.0-next.20 → 0.10.0-next.21
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/build/api/builder/builder.d.ts.map +1 -1
- package/build/api/builder/builder.js +1 -2
- package/build/api/builder/builder.js.map +1 -1
- package/build/api/config/merge.js +6 -6
- package/build/api/content/scan.js +1 -1
- package/build/api/content/sidebar.js +4 -4
- package/build/api/vite/plugins/build.js +1 -1
- package/build/lib/react-router-aid/get-paths-patterns.js +1 -1
- package/package.json +1 -1
- package/src/api/builder/builder.ts +1 -2
- package/src/api/config/merge.ts +6 -6
- package/src/api/content/scan.ts +1 -1
- package/src/api/content/sidebar.ts +4 -4
- package/src/api/vite/plugins/build.ts +1 -1
- package/src/lib/react-router-aid/get-paths-patterns.ts +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../src/api/builder/builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAK1C,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,CAAC,EAAE,MAAM,CAAC,iBAAiB,CAAA;IACvC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;IACD,QAAQ,CAAC,EAAE;QACT,KAAK,CAAC,EAAE,OAAO,CAAA;KAChB,CAAA;CACF;AAED,eAAO,MAAM,KAAK,GAAU,OAAO,gBAAgB,
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../src/api/builder/builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAK1C,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,CAAC,EAAE,MAAM,CAAC,iBAAiB,CAAA;IACvC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;IACD,QAAQ,CAAC,EAAE;QACT,KAAK,CAAC,EAAE,OAAO,CAAA;KAChB,CAAA;CACF;AAED,eAAO,MAAM,KAAK,GAAU,OAAO,gBAAgB,kBAqBlD,CAAA"}
|
@@ -21,8 +21,7 @@ export const build = async (input) => {
|
|
21
21
|
}
|
22
22
|
else if (input.architecture === `ssr`) {
|
23
23
|
consola.info(`try it: node ${viteUserConfig._polen.paths.project.relative.build.root}/app.js`);
|
24
|
-
|
25
|
-
consola.info(`Then visit http://localhost:3001`);
|
24
|
+
consola.info(`Then visit http://localhost:${viteUserConfig._polen.server.port}`);
|
26
25
|
}
|
27
26
|
};
|
28
27
|
//# sourceMappingURL=builder.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../../src/api/builder/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,OAAO,MAAM,SAAS,CAAA;AAc7B,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EAAE,KAAuB,EAAE,EAAE;IACrD,MAAM,cAAc,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC;QACnD,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,SAAS,EAAE,KAAK;KACjB,CAAC,CAAA;IAEF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;IACxD,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAA;IAExB,IAAI,KAAK,CAAC,YAAY,KAAK,KAAK,EAAE,CAAC;QACjC,OA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;IAEF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;IACxD,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAA;IAExB,IAAI,KAAK,CAAC,YAAY,KAAK,KAAK,EAAE,CAAC;QACjC,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAA;QACzC,MAAM,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;QACjF,8EAA8E;QAC9E,MAAM,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;QACpF,kGAAkG;QAClG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACvB,OAAO,CAAC,IAAI,CAAC,qBAAqB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,CAAA;IACtG,CAAC;SAAM,IAAI,KAAK,CAAC,YAAY,KAAK,KAAK,EAAE,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,gBAAgB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,CAAA;QAC9F,OAAO,CAAC,IAAI,CAAC,+BAA+B,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;IAClF,CAAC;AACH,CAAC,CAAA"}
|
@@ -10,25 +10,25 @@ export const mergeInputs = (base, overrides) => {
|
|
10
10
|
}
|
11
11
|
const merged = spreadShallow(base, overrides);
|
12
12
|
// Merge schema if both have it
|
13
|
-
if (base.schema
|
13
|
+
if (base.schema ?? overrides.schema) {
|
14
14
|
merged.schema = overrides.schema ?? base.schema;
|
15
15
|
}
|
16
16
|
// Merge build config
|
17
|
-
if (base.build
|
17
|
+
if (base.build ?? overrides.build) {
|
18
18
|
merged.build = spreadShallow(base.build, overrides.build);
|
19
19
|
}
|
20
20
|
// Merge server config
|
21
|
-
if (base.server
|
21
|
+
if (base.server ?? overrides.server) {
|
22
22
|
merged.server = spreadShallow(base.server, overrides.server);
|
23
23
|
}
|
24
24
|
// Merge advanced config
|
25
|
-
if (base.advanced
|
25
|
+
if (base.advanced ?? overrides.advanced) {
|
26
26
|
merged.advanced = spreadShallow(base.advanced, overrides.advanced);
|
27
27
|
// Merge advanced.watch config
|
28
|
-
if (base.advanced?.watch
|
28
|
+
if (base.advanced?.watch ?? overrides.advanced?.watch) {
|
29
29
|
merged.advanced.watch = spreadShallow(base.advanced?.watch, overrides.advanced?.watch);
|
30
30
|
// Merge watch.also arrays
|
31
|
-
if (base.advanced?.watch?.also
|
31
|
+
if (base.advanced?.watch?.also ?? overrides.advanced?.watch?.also) {
|
32
32
|
merged.advanced.watch.also = [
|
33
33
|
...(base.advanced?.watch?.also ?? []),
|
34
34
|
...(overrides.advanced?.watch?.also ?? []),
|
@@ -52,7 +52,7 @@ export const scan = async (options) => {
|
|
52
52
|
// Update pages to have virtual root as parent if they don't have one
|
53
53
|
const pagesWithVirtualRoot = pagesWithIds.map(page => ({
|
54
54
|
...page,
|
55
|
-
parentId: page.parentId
|
55
|
+
parentId: page.parentId ?? `__virtual_root__`,
|
56
56
|
}));
|
57
57
|
tree = Tree.fromList([virtualRoot, ...pagesWithVirtualRoot]);
|
58
58
|
}
|
@@ -71,12 +71,12 @@ const buildSidebarForDirectory = (topLevelDir, pages) => {
|
|
71
71
|
pagesByParent.get(parentPath).push(page);
|
72
72
|
}
|
73
73
|
// Process top-level pages (direct children of the directory)
|
74
|
-
const topLevelPages = pagesByParent.get(topLevelDir)
|
74
|
+
const topLevelPages = pagesByParent.get(topLevelDir) ?? [];
|
75
75
|
// Sort pages by their directory order (extracted from file path)
|
76
76
|
const sortedTopLevelPages = [...topLevelPages].sort((a, b) => {
|
77
77
|
// For sections, we need to look at the directory name in the file path
|
78
|
-
const dirA = a.route.file.path.relative.dir.split(`/`).pop()
|
79
|
-
const dirB = b.route.file.path.relative.dir.split(`/`).pop()
|
78
|
+
const dirA = a.route.file.path.relative.dir.split(`/`).pop() ?? ``;
|
79
|
+
const dirB = b.route.file.path.relative.dir.split(`/`).pop() ?? ``;
|
80
80
|
// Extract order from directory names like "10_b", "20_c"
|
81
81
|
const orderMatchA = /^(\d+)[_-]/.exec(dirA);
|
82
82
|
const orderMatchB = /^(\d+)[_-]/.exec(dirB);
|
@@ -90,7 +90,7 @@ const buildSidebarForDirectory = (topLevelDir, pages) => {
|
|
90
90
|
for (const page of sortedTopLevelPages) {
|
91
91
|
const pageName = page.route.logical.path[page.route.logical.path.length - 1];
|
92
92
|
const childPath = page.route.logical.path.join(`/`);
|
93
|
-
const childPages = pagesByParent.get(childPath)
|
93
|
+
const childPages = pagesByParent.get(childPath) ?? [];
|
94
94
|
if (childPages.length > 0 || FileRouter.routeIsFromIndexFile(page.route)) {
|
95
95
|
// This is a section (has children or is an index page for a subdirectory)
|
96
96
|
const hasIndex = FileRouter.routeIsFromIndexFile(page.route);
|
@@ -150,7 +150,7 @@ const BuildManifest = (config) => {
|
|
150
150
|
const manifest = {
|
151
151
|
type: config.build.architecture === `ssr` ? `ssr` : `ssg`,
|
152
152
|
version: packageJson.version,
|
153
|
-
basePath: config.build.base
|
153
|
+
basePath: config.build.base ?? `/`,
|
154
154
|
};
|
155
155
|
// Emit the manifest as an asset
|
156
156
|
this.emitFile({
|
@@ -27,7 +27,7 @@ export const _getPathsRecurse = (routes, parentPath, collectedPaths) => {
|
|
27
27
|
if (isIndexRoute(route)) {
|
28
28
|
// Index route uses the parent's accumulated path.
|
29
29
|
// If parentPath is empty (implying root), it should be ROOT_PATH
|
30
|
-
collectedPaths.add(parentPath
|
30
|
+
collectedPaths.add(parentPath ?? ROOT_PATH);
|
31
31
|
continue;
|
32
32
|
}
|
33
33
|
// Layout-Only Route
|
package/package.json
CHANGED
@@ -35,7 +35,6 @@ export const build = async (input: BuildConfigInput) => {
|
|
35
35
|
consola.info(`try it: npx serve ${viteUserConfig._polen.paths.project.relative.build.root} -p 4000`)
|
36
36
|
} else if (input.architecture === `ssr`) {
|
37
37
|
consola.info(`try it: node ${viteUserConfig._polen.paths.project.relative.build.root}/app.js`)
|
38
|
-
|
39
|
-
consola.info(`Then visit http://localhost:3001`)
|
38
|
+
consola.info(`Then visit http://localhost:${viteUserConfig._polen.server.port}`)
|
40
39
|
}
|
41
40
|
}
|
package/src/api/config/merge.ts
CHANGED
@@ -17,33 +17,33 @@ export const mergeInputs = (
|
|
17
17
|
const merged: ConfigInput = spreadShallow(base, overrides)
|
18
18
|
|
19
19
|
// Merge schema if both have it
|
20
|
-
if (base.schema
|
20
|
+
if (base.schema ?? overrides.schema) {
|
21
21
|
merged.schema = overrides.schema ?? base.schema
|
22
22
|
}
|
23
23
|
|
24
24
|
// Merge build config
|
25
|
-
if (base.build
|
25
|
+
if (base.build ?? overrides.build) {
|
26
26
|
merged.build = spreadShallow(base.build, overrides.build)
|
27
27
|
}
|
28
28
|
|
29
29
|
// Merge server config
|
30
|
-
if (base.server
|
30
|
+
if (base.server ?? overrides.server) {
|
31
31
|
merged.server = spreadShallow(base.server, overrides.server)
|
32
32
|
}
|
33
33
|
|
34
34
|
// Merge advanced config
|
35
|
-
if (base.advanced
|
35
|
+
if (base.advanced ?? overrides.advanced) {
|
36
36
|
merged.advanced = spreadShallow(base.advanced, overrides.advanced)
|
37
37
|
|
38
38
|
// Merge advanced.watch config
|
39
|
-
if (base.advanced?.watch
|
39
|
+
if (base.advanced?.watch ?? overrides.advanced?.watch) {
|
40
40
|
merged.advanced.watch = spreadShallow(
|
41
41
|
base.advanced?.watch,
|
42
42
|
overrides.advanced?.watch,
|
43
43
|
)
|
44
44
|
|
45
45
|
// Merge watch.also arrays
|
46
|
-
if (base.advanced?.watch?.also
|
46
|
+
if (base.advanced?.watch?.also ?? overrides.advanced?.watch?.also) {
|
47
47
|
merged.advanced.watch.also = [
|
48
48
|
...(base.advanced?.watch?.also ?? []),
|
49
49
|
...(overrides.advanced?.watch?.also ?? []),
|
package/src/api/content/scan.ts
CHANGED
@@ -73,7 +73,7 @@ export const scan = async (options: {
|
|
73
73
|
// Update pages to have virtual root as parent if they don't have one
|
74
74
|
const pagesWithVirtualRoot = pagesWithIds.map(page => ({
|
75
75
|
...page,
|
76
|
-
parentId: page.parentId
|
76
|
+
parentId: page.parentId ?? `__virtual_root__`,
|
77
77
|
}))
|
78
78
|
|
79
79
|
tree = Tree.fromList([virtualRoot, ...pagesWithVirtualRoot])
|
@@ -173,13 +173,13 @@ const buildSidebarForDirectory = (topLevelDir: string, pages: Page[]): Sidebar =
|
|
173
173
|
}
|
174
174
|
|
175
175
|
// Process top-level pages (direct children of the directory)
|
176
|
-
const topLevelPages = pagesByParent.get(topLevelDir)
|
176
|
+
const topLevelPages = pagesByParent.get(topLevelDir) ?? []
|
177
177
|
|
178
178
|
// Sort pages by their directory order (extracted from file path)
|
179
179
|
const sortedTopLevelPages = [...topLevelPages].sort((a, b) => {
|
180
180
|
// For sections, we need to look at the directory name in the file path
|
181
|
-
const dirA = a.route.file.path.relative.dir.split(`/`).pop()
|
182
|
-
const dirB = b.route.file.path.relative.dir.split(`/`).pop()
|
181
|
+
const dirA = a.route.file.path.relative.dir.split(`/`).pop() ?? ``
|
182
|
+
const dirB = b.route.file.path.relative.dir.split(`/`).pop() ?? ``
|
183
183
|
|
184
184
|
// Extract order from directory names like "10_b", "20_c"
|
185
185
|
const orderMatchA = /^(\d+)[_-]/.exec(dirA)
|
@@ -197,7 +197,7 @@ const buildSidebarForDirectory = (topLevelDir: string, pages: Page[]): Sidebar =
|
|
197
197
|
for (const page of sortedTopLevelPages) {
|
198
198
|
const pageName = page.route.logical.path[page.route.logical.path.length - 1]!
|
199
199
|
const childPath = page.route.logical.path.join(`/`)
|
200
|
-
const childPages = pagesByParent.get(childPath)
|
200
|
+
const childPages = pagesByParent.get(childPath) ?? []
|
201
201
|
|
202
202
|
if (childPages.length > 0 || FileRouter.routeIsFromIndexFile(page.route)) {
|
203
203
|
// This is a section (has children or is an index page for a subdirectory)
|
@@ -162,7 +162,7 @@ const BuildManifest = (config: Config.Config): Vite.Plugin => {
|
|
162
162
|
const manifest: PolenBuildManifest = {
|
163
163
|
type: config.build.architecture === `ssr` ? `ssr` : `ssg`,
|
164
164
|
version: packageJson.version,
|
165
|
-
basePath: config.build.base
|
165
|
+
basePath: config.build.base ?? `/`,
|
166
166
|
}
|
167
167
|
|
168
168
|
// Emit the manifest as an asset
|
@@ -41,7 +41,7 @@ export const _getPathsRecurse = (
|
|
41
41
|
if (isIndexRoute(route)) {
|
42
42
|
// Index route uses the parent's accumulated path.
|
43
43
|
// If parentPath is empty (implying root), it should be ROOT_PATH
|
44
|
-
collectedPaths.add(parentPath
|
44
|
+
collectedPaths.add(parentPath ?? ROOT_PATH)
|
45
45
|
|
46
46
|
continue
|
47
47
|
}
|