polen 0.11.0-next.27 → 0.11.0-next.29
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/ssg/generate.d.ts.map +1 -1
- package/build/api/builder/ssg/generate.js +77 -50
- package/build/api/builder/ssg/generate.js.map +1 -1
- package/build/api/builder/ssg/page-generator.worker.js +63 -56
- package/build/api/builder/ssg/page-generator.worker.js.map +1 -1
- package/build/api/builder/ssg/server-runner.worker.js +34 -40
- package/build/api/builder/ssg/server-runner.worker.js.map +1 -1
- package/build/api/builder/ssg/worker-messages.d.ts +11 -0
- package/build/api/builder/ssg/worker-messages.d.ts.map +1 -1
- package/build/api/builder/ssg/worker-messages.js +8 -1
- package/build/api/builder/ssg/worker-messages.js.map +1 -1
- package/build/vite/plugins/main.js +1 -1
- package/build/vite/plugins/main.js.map +1 -1
- package/build/vite/plugins/routes-manifest.d.ts.map +1 -1
- package/build/vite/plugins/routes-manifest.js +5 -2
- package/build/vite/plugins/routes-manifest.js.map +1 -1
- package/package.json +37 -42
- package/src/api/builder/ssg/generate.ts +112 -71
- package/src/api/builder/ssg/page-generator.worker.ts +111 -75
- package/src/api/builder/ssg/server-runner.worker.ts +39 -44
- package/src/api/builder/ssg/worker-messages.ts +12 -1
- package/src/vite/plugins/main.ts +1 -1
- package/src/vite/plugins/routes-manifest.ts +5 -2
@@ -5,6 +5,10 @@ declare const GenerateResultSchema: S.Struct<{
|
|
5
5
|
duration: typeof S.Number;
|
6
6
|
memoryUsed: typeof S.Number;
|
7
7
|
error: S.optional<typeof S.String>;
|
8
|
+
failures: S.optional<S.Array$<S.Struct<{
|
9
|
+
route: typeof S.String;
|
10
|
+
error: typeof S.String;
|
11
|
+
}>>>;
|
8
12
|
}>;
|
9
13
|
export type GenerateResult = S.Schema.Type<typeof GenerateResultSchema>;
|
10
14
|
declare const StartServerMessage_base: S.TaggedRequestClass<StartServerMessage, "StartServer", {
|
@@ -17,6 +21,8 @@ export declare class StartServerMessage extends StartServerMessage_base {
|
|
17
21
|
}
|
18
22
|
declare const StopServerMessage_base: S.TaggedRequestClass<StopServerMessage, "StopServer", {
|
19
23
|
readonly _tag: S.tag<"StopServer">;
|
24
|
+
} & {
|
25
|
+
port: S.optional<typeof S.Number>;
|
20
26
|
}, typeof S.Void, typeof S.Never>;
|
21
27
|
export declare class StopServerMessage extends StopServerMessage_base {
|
22
28
|
}
|
@@ -28,12 +34,17 @@ declare const GeneratePagesMessage_base: S.TaggedRequestClass<GeneratePagesMessa
|
|
28
34
|
routes: S.Array$<typeof S.String>;
|
29
35
|
serverPort: typeof S.Number;
|
30
36
|
outputDir: typeof S.String;
|
37
|
+
basePath: S.optional<typeof S.String>;
|
31
38
|
}, S.Struct<{
|
32
39
|
success: typeof S.Boolean;
|
33
40
|
processedCount: typeof S.Number;
|
34
41
|
duration: typeof S.Number;
|
35
42
|
memoryUsed: typeof S.Number;
|
36
43
|
error: S.optional<typeof S.String>;
|
44
|
+
failures: S.optional<S.Array$<S.Struct<{
|
45
|
+
route: typeof S.String;
|
46
|
+
error: typeof S.String;
|
47
|
+
}>>>;
|
37
48
|
}>, typeof S.String>;
|
38
49
|
export declare class GeneratePagesMessage extends GeneratePagesMessage_base {
|
39
50
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"worker-messages.d.ts","sourceRoot":"","sources":["../../../../src/api/builder/ssg/worker-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAA;AAYxC,QAAA,MAAM,oBAAoB
|
1
|
+
{"version":3,"file":"worker-messages.d.ts","sourceRoot":"","sources":["../../../../src/api/builder/ssg/worker-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAA;AAYxC,QAAA,MAAM,oBAAoB;;;;;;;;;;EAcxB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,oBAAoB,CAAC,CAAA;;;;;;;AAMvE,qBAAa,kBAAmB,SAAQ,uBAUvC;CAAG;;;;;;AAEJ,qBAAa,iBAAkB,SAAQ,sBAStC;CAAG;AAEJ,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,iBAAiB,CAAA;AAClE,eAAO,MAAM,aAAa,gEAAiD,CAAA;;;;;;;;;;;;;;;;;;;AAM3E,qBAAa,oBAAqB,SAAQ,yBAYzC;CAAG;AAEJ,MAAM,MAAM,WAAW,GAAG,oBAAoB,CAAA;AAC9C,eAAO,MAAM,WAAW,6BAAgC,CAAA"}
|
@@ -12,6 +12,10 @@ const GenerateResultSchema = S.Struct({
|
|
12
12
|
duration: S.Number,
|
13
13
|
memoryUsed: S.Number,
|
14
14
|
error: S.optional(S.String),
|
15
|
+
failures: S.optional(S.Array(S.Struct({
|
16
|
+
route: S.String,
|
17
|
+
error: S.String,
|
18
|
+
}))),
|
15
19
|
});
|
16
20
|
// ============================================================================
|
17
21
|
// Server Messages
|
@@ -27,7 +31,9 @@ export class StartServerMessage extends S.TaggedRequest()('StartServer', {
|
|
27
31
|
}
|
28
32
|
export class StopServerMessage extends S.TaggedRequest()('StopServer', {
|
29
33
|
failure: S.Never,
|
30
|
-
payload: {
|
34
|
+
payload: {
|
35
|
+
port: S.optional(S.Number),
|
36
|
+
},
|
31
37
|
success: S.Void,
|
32
38
|
}) {
|
33
39
|
}
|
@@ -41,6 +47,7 @@ export class GeneratePagesMessage extends S.TaggedRequest()('GeneratePages', {
|
|
41
47
|
routes: S.Array(RouteSchema),
|
42
48
|
serverPort: S.Number,
|
43
49
|
outputDir: S.String,
|
50
|
+
basePath: S.optional(S.String),
|
44
51
|
},
|
45
52
|
success: GenerateResultSchema,
|
46
53
|
}) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"worker-messages.js","sourceRoot":"","sources":["../../../../src/api/builder/ssg/worker-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,E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'@vitejs/plugin-react
|
3
|
+
import ViteReact from '@vitejs/plugin-react';
|
4
4
|
import { Path } from '@wollybeard/kit';
|
5
5
|
import Inspect from 'vite-plugin-inspect';
|
6
6
|
import { Branding } from './branding.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/vite/plugins/main.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,SAAS,MAAM,
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/vite/plugins/main.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,SAAS,MAAM,sBAAsB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,OAAO,MAAM,qBAAqB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,MAAyB,EACN,EAAE;IACrB,MAAM,OAAO,GAAsB,EAAE,CAAA;IAErC,mCAAmC;IAEnC,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC7B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAA;QAC7E,MAAM,MAAM,GAAG,OAAO,CAAC;YACrB,KAAK,EAAE,IAAI;YACX,SAAS;SACV,CAAC,CAAA;QACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACtB,CAAC;IAED,OAAO,CAAC,IAAI,CACV,SAAS,EAAE,EACX,gBAAgB,CAAC;QACf,OAAO,EAAE,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;KAC5E,CAAC,EACF,QAAQ,CAAC,MAAM,CAAC,EAChB,QAAQ,CAAC,MAAM,CAAC,EAChB,KAAK,CAAC,MAAM,CAAC,EACb,IAAI,CAAC,MAAM,CAAC,EACZ,KAAK,CAAC,MAAM,CAAC,CACd,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"routes-manifest.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/routes-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;
|
1
|
+
{"version":3,"file":"routes-manifest.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/routes-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAWtC;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,GAAG,CAAC,MAAM,CAAC,MAAM,KAAG,IAAI,CAAC,MAgF/D,CAAA"}
|
@@ -3,6 +3,7 @@ import { Vite } from '#dep/vite/index';
|
|
3
3
|
import { Catalog } from '#lib/catalog/$';
|
4
4
|
import { FileRouter } from '#lib/file-router/$';
|
5
5
|
import { SchemaDefinition } from '#lib/schema-definition/$';
|
6
|
+
import { Version } from '#lib/version/$';
|
6
7
|
import { debugPolen } from '#singletons/debug';
|
7
8
|
import * as NodeFileSystem from '@effect/platform-node/NodeFileSystem';
|
8
9
|
import consola from 'consola';
|
@@ -66,8 +67,10 @@ export const RoutesManifest = (config) => {
|
|
66
67
|
function processVersionedCatalog(catalog, routes) {
|
67
68
|
for (const schema of Catalog.Versioned.getAll(catalog)) {
|
68
69
|
const version = schema.version;
|
69
|
-
|
70
|
-
|
70
|
+
// Properly encode the version to its string representation
|
71
|
+
const versionValue = Version.encodeSync(version);
|
72
|
+
routes.push(`/reference/version/${versionValue}`);
|
73
|
+
processSchemaDefinition(schema.definition, routes, `/reference/version/${versionValue}`);
|
71
74
|
}
|
72
75
|
}
|
73
76
|
function processUnversionedCatalog(catalog, routes) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"routes-manifest.js","sourceRoot":"","sources":["../../../src/vite/plugins/routes-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,cAAc,MAAM,sCAAsC,CAAA;AACtE,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAyB,EAAe,EAAE;IACvE,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;IAEpD,OAAO;QACL,IAAI,EAAE,uBAAuB;QAC7B,KAAK,EAAE,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CAAC,MAAM,CAAC,EAAE,CAAC;gBAC5C,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,QAAQ,IAAI,SAAS,EAAE,CAAC,CAAA;YACrD,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "polen",
|
3
|
-
"version": "0.11.0-next.
|
3
|
+
"version": "0.11.0-next.29",
|
4
4
|
"type": "module",
|
5
5
|
"description": "A framework for delightful GraphQL developer portals",
|
6
6
|
"author": {
|
@@ -55,9 +55,6 @@
|
|
55
55
|
"#lib/version/version": {
|
56
56
|
"default": "./build/lib/version/$$.js"
|
57
57
|
},
|
58
|
-
"#lib/extensible-data": {
|
59
|
-
"default": "./build/lib/extensible-data/$.js"
|
60
|
-
},
|
61
58
|
"#lib/favicon": {
|
62
59
|
"default": "./build/lib/favicon/$.js"
|
63
60
|
},
|
@@ -274,27 +271,26 @@
|
|
274
271
|
"README.md"
|
275
272
|
],
|
276
273
|
"dependencies": {
|
277
|
-
"@0no-co/graphql.web": "^1.
|
278
|
-
"@effect/cli": "^0.
|
279
|
-
"@effect/platform": "^0.90.
|
280
|
-
"@effect/platform-node": "^0.
|
274
|
+
"@0no-co/graphql.web": "^1.2.0",
|
275
|
+
"@effect/cli": "^0.69.2",
|
276
|
+
"@effect/platform": "^0.90.7",
|
277
|
+
"@effect/platform-node": "^0.96.1",
|
281
278
|
"@effect/printer-ansi": "^0.45.0",
|
282
279
|
"@graphql-inspector/core": "^6.2.1",
|
283
280
|
"@graphql-tools/load": "^8.1.2",
|
284
281
|
"@hiogawa/vite-plugin-ssr-css": "^0.0.1",
|
285
|
-
"@hono/node-server": "^1.
|
286
|
-
"@mdx-js/mdx": "^3.1.
|
287
|
-
"@mdx-js/react": "^3.1.
|
288
|
-
"@mdx-js/rollup": "^3.1.
|
282
|
+
"@hono/node-server": "^1.19.1",
|
283
|
+
"@mdx-js/mdx": "^3.1.1",
|
284
|
+
"@mdx-js/react": "^3.1.1",
|
285
|
+
"@mdx-js/rollup": "^3.1.1",
|
289
286
|
"@radix-ui/react-icons": "^1.3.2",
|
290
287
|
"@radix-ui/react-slot": "^1.2.3",
|
291
288
|
"@radix-ui/themes": "^3.2.1",
|
292
|
-
"@rolldown/pluginutils": "1.0.0-beta.
|
293
|
-
"@rollup/pluginutils": "^5.
|
289
|
+
"@rolldown/pluginutils": "1.0.0-beta.36",
|
290
|
+
"@rollup/pluginutils": "^5.3.0",
|
294
291
|
"@types/jsesc": "^3.0.3",
|
295
|
-
"@vitejs/plugin-react": "^
|
296
|
-
"@
|
297
|
-
"@vltpkg/semver": "0.0.0-18",
|
292
|
+
"@vitejs/plugin-react": "^5.0.2",
|
293
|
+
"@vltpkg/semver": "0.0.0-29",
|
298
294
|
"@wollybeard/kit": "^0.41.0",
|
299
295
|
"@wollybeard/projector": "^0.3.0",
|
300
296
|
"ansis": "^4.1.0",
|
@@ -302,20 +298,20 @@
|
|
302
298
|
"codehike": "^1.0.7",
|
303
299
|
"consola": "^3.4.2",
|
304
300
|
"defu": "^6.1.4",
|
305
|
-
"effect": "^3.17.
|
301
|
+
"effect": "^3.17.13",
|
306
302
|
"embla-carousel-react": "^8.6.0",
|
307
|
-
"es-toolkit": "^1.39.
|
303
|
+
"es-toolkit": "^1.39.10",
|
308
304
|
"fuse.js": "^7.1.0",
|
309
305
|
"get-port": "^7.1.0",
|
310
306
|
"graffle": "8.0.0-next.163",
|
311
307
|
"graphql": "^16.11.0",
|
312
308
|
"gray-matter": "^4.0.3",
|
313
|
-
"hono": "^4.
|
309
|
+
"hono": "^4.9.6",
|
314
310
|
"jsesc": "^3.1.0",
|
315
311
|
"jsonc-parser": "^3.3.1",
|
316
|
-
"react": "^19.1.
|
317
|
-
"react-dom": "^19.1.
|
318
|
-
"react-router": "^7.
|
312
|
+
"react": "^19.1.1",
|
313
|
+
"react-dom": "^19.1.1",
|
314
|
+
"react-router": "^7.8.2",
|
319
315
|
"rehype-stringify": "^10.0.1",
|
320
316
|
"remark": "^15.0.1",
|
321
317
|
"remark-frontmatter": "^5.0.0",
|
@@ -324,23 +320,22 @@
|
|
324
320
|
"remark-parse": "^11.0.0",
|
325
321
|
"remark-rehype": "^11.1.2",
|
326
322
|
"resolve.imports": "^2.0.3",
|
327
|
-
"rolldown": "1.0.0-beta.
|
323
|
+
"rolldown": "1.0.0-beta.36",
|
328
324
|
"simple-git": "^3.28.0",
|
329
|
-
"source-map": "^0.7.
|
325
|
+
"source-map": "^0.7.6",
|
330
326
|
"superjson": "^2.2.2",
|
331
|
-
"tinyglobby": "^0.2.
|
327
|
+
"tinyglobby": "^0.2.15",
|
332
328
|
"tree-sitter-graphql-grammar-wasm": "^1.1.0",
|
333
|
-
"tsx": "^4.20.
|
329
|
+
"tsx": "^4.20.5",
|
334
330
|
"type-fest": "^4.41.0",
|
335
|
-
"typescript": "^5.9.2",
|
336
331
|
"unified": "^11.0.5",
|
337
|
-
"valtio": "^2.1.
|
332
|
+
"valtio": "^2.1.7",
|
338
333
|
"vfile": "^6.0.3",
|
339
334
|
"vite": "npm:rolldown-vite@^7.0.10",
|
340
|
-
"vite-plugin-inspect": "^11.3.
|
341
|
-
"web-tree-sitter": "^0.25.
|
335
|
+
"vite-plugin-inspect": "^11.3.3",
|
336
|
+
"web-tree-sitter": "^0.25.9",
|
342
337
|
"youch-core": "^0.3.3",
|
343
|
-
"zx": "8.
|
338
|
+
"zx": "8.8.1"
|
344
339
|
},
|
345
340
|
"devDependencies": {
|
346
341
|
"@actions/core": "^1.11.1",
|
@@ -348,31 +343,31 @@
|
|
348
343
|
"@actions/github": "^6.0.1",
|
349
344
|
"@actions/glob": "^0.5.0",
|
350
345
|
"@actions/io": "^1.1.3",
|
351
|
-
"@changesets/cli": "^2.29.
|
352
|
-
"@effect/vitest": "^0.25.
|
346
|
+
"@changesets/cli": "^2.29.6",
|
347
|
+
"@effect/vitest": "^0.25.1",
|
353
348
|
"@molt/command": "^0.9.0",
|
354
349
|
"@octokit/core": "^7.0.3",
|
355
350
|
"@octokit/types": "^14.1.0",
|
356
|
-
"@playwright/browser-chromium": "^1.
|
351
|
+
"@playwright/browser-chromium": "^1.55.0",
|
357
352
|
"@testing-library/react": "^16.3.0",
|
358
353
|
"@tsconfig/node-lts": "^22.0.2",
|
359
354
|
"@tsconfig/node22": "^22.0.2",
|
360
355
|
"@tsconfig/strictest": "^2.0.5",
|
361
356
|
"@types/jsdom": "^21.1.7",
|
362
|
-
"@types/node": "^24.1
|
363
|
-
"@types/react": "^19.1.
|
364
|
-
"@types/react-dom": "^19.1.
|
357
|
+
"@types/node": "^24.3.1",
|
358
|
+
"@types/react": "^19.1.12",
|
359
|
+
"@types/react-dom": "^19.1.9",
|
365
360
|
"dprint": "^0.50.1",
|
366
361
|
"dripip": "^0.10.0",
|
367
|
-
"fast-check": "^4.
|
362
|
+
"fast-check": "^4.3.0",
|
368
363
|
"fs-jetpack": "^5.1.0",
|
369
364
|
"get-port-please": "^3.2.0",
|
370
365
|
"globals": "^16.3.0",
|
371
366
|
"jsdom": "^26.1.0",
|
372
|
-
"playwright": "1.
|
367
|
+
"playwright": "1.55.0",
|
373
368
|
"publint": "^0.3.12",
|
374
|
-
"strip-ansi": "^7.1.
|
375
|
-
"typescript": "^5.
|
369
|
+
"strip-ansi": "^7.1.2",
|
370
|
+
"typescript": "^5.9.2",
|
376
371
|
"vite-tsconfig-paths": "^5.1.4",
|
377
372
|
"vitest": "^3.2.4",
|
378
373
|
"zod": "3.25.74"
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import type { Config } from '#api/config/$'
|
2
2
|
import { Routes } from '#api/routes/$'
|
3
|
-
import { debugPolen } from '#singletons/debug'
|
4
3
|
import { Worker } from '@effect/platform'
|
5
4
|
import { NodeContext, NodeWorker } from '@effect/platform-node'
|
6
5
|
import { FileSystem } from '@effect/platform/FileSystem'
|
7
6
|
import { Path } from '@wollybeard/kit'
|
8
7
|
import consola from 'consola'
|
9
|
-
import { Array, Chunk, Effect, Layer } from 'effect'
|
8
|
+
import { Array, Chunk, Duration, Effect, Either, Layer, Logger, Ref } from 'effect'
|
10
9
|
import getPort from 'get-port'
|
11
10
|
import { cpus, totalmem } from 'node:os'
|
12
11
|
import {
|
@@ -18,8 +17,6 @@ import {
|
|
18
17
|
} from './worker-messages.js'
|
19
18
|
import { createPageSpawner, createServerSpawner } from './worker-spawners.js'
|
20
19
|
|
21
|
-
const debug = debugPolen.sub(`api:ssg:generate`)
|
22
|
-
|
23
20
|
export const generate = (config: Config.Config): Effect.Effect<void, Error, FileSystem> =>
|
24
21
|
Effect.gen(function*() {
|
25
22
|
// Read routes from the manifest generated during build
|
@@ -55,14 +52,16 @@ export const generate = (config: Config.Config): Effect.Effect<void, Error, File
|
|
55
52
|
consola.info(` Distribution: ${batches.length} batches × ~${batchSize} pages each`)
|
56
53
|
consola.info(` System: ${cpuCount} CPUs, ${memoryGB.toFixed(1)}GB RAM`)
|
57
54
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
55
|
+
yield* Effect.logDebug(`SSG configuration`).pipe(
|
56
|
+
Effect.annotateLogs({
|
57
|
+
totalRoutes,
|
58
|
+
optimalWorkers,
|
59
|
+
cpuCount,
|
60
|
+
memoryGB,
|
61
|
+
batchSize,
|
62
|
+
totalBatches: batches.length,
|
63
|
+
}),
|
64
|
+
)
|
66
65
|
|
67
66
|
// Create worker spawner layers
|
68
67
|
const serverPath = config.paths.project.absolute.build.serverEntrypoint
|
@@ -76,7 +75,7 @@ export const generate = (config: Config.Config): Effect.Effect<void, Error, File
|
|
76
75
|
'api/builder/ssg/page-generator.worker' + config.paths.framework.sourceExtension,
|
77
76
|
)
|
78
77
|
|
79
|
-
|
78
|
+
yield* Effect.logDebug(`Creating worker pools with ${optimalWorkers} workers each`)
|
80
79
|
|
81
80
|
// Create and use worker pools within a scoped context
|
82
81
|
yield* Effect.scoped(
|
@@ -106,7 +105,7 @@ export const generate = (config: Config.Config): Effect.Effect<void, Error, File
|
|
106
105
|
|
107
106
|
consola.info(`\nStarting SSG infrastructure:`)
|
108
107
|
consola.info(` Launching ${optimalWorkers} Polen app instances...`)
|
109
|
-
|
108
|
+
yield* Effect.logDebug(`Finding available ports for servers`)
|
110
109
|
|
111
110
|
// Get available ports
|
112
111
|
for (let i = 0; i < optimalWorkers; i++) {
|
@@ -116,7 +115,7 @@ export const generate = (config: Config.Config): Effect.Effect<void, Error, File
|
|
116
115
|
})
|
117
116
|
serverPorts.push(port)
|
118
117
|
}
|
119
|
-
|
118
|
+
yield* Effect.logDebug(`Using ports: ${serverPorts.join(', ')}`)
|
120
119
|
|
121
120
|
// Start servers using Effect
|
122
121
|
yield* Effect.all(
|
@@ -131,13 +130,12 @@ export const generate = (config: Config.Config): Effect.Effect<void, Error, File
|
|
131
130
|
{ concurrency: 'unbounded' },
|
132
131
|
)
|
133
132
|
consola.success(` All ${optimalWorkers} app instances ready on ports: ${serverPorts.join(', ')}`)
|
134
|
-
|
133
|
+
yield* Effect.logDebug(`All servers started successfully`)
|
135
134
|
|
136
135
|
// Prepare page generation configs
|
137
136
|
// Each batch is assigned to a server in round-robin fashion
|
138
137
|
const generateConfigs = batches.map((batch, index) => {
|
139
138
|
const assignedPort = serverPorts[index % serverPorts.length]!
|
140
|
-
debug(`Batch ${index + 1}: ${batch.length} routes → server on port ${assignedPort}`)
|
141
139
|
return {
|
142
140
|
batch,
|
143
141
|
assignedPort,
|
@@ -151,79 +149,122 @@ export const generate = (config: Config.Config): Effect.Effect<void, Error, File
|
|
151
149
|
|
152
150
|
// Process batches
|
153
151
|
consola.info(`\nGenerating pages...`)
|
154
|
-
const
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
generateConfigs,
|
161
|
-
({ batch, assignedPort, index }) =>
|
152
|
+
const completedBatchesRef = yield* Ref.make(0)
|
153
|
+
const totalPagesProcessedRef = yield* Ref.make(0)
|
154
|
+
|
155
|
+
// Process batches using Effect.all with timing
|
156
|
+
const [elapsedTime, results] = yield* Effect.all(
|
157
|
+
generateConfigs.map(({ batch, assignedPort, index }) =>
|
162
158
|
pagePool
|
163
159
|
.executeEffect(
|
164
160
|
new GeneratePagesMessage({
|
165
161
|
routes: batch,
|
166
162
|
serverPort: assignedPort,
|
167
163
|
outputDir: config.paths.project.absolute.build.root,
|
164
|
+
...(config.build.base ? { basePath: config.build.base } : {}),
|
168
165
|
}),
|
169
166
|
)
|
170
167
|
.pipe(
|
171
168
|
Effect.tap((result) =>
|
172
|
-
Effect.
|
173
|
-
completedBatches
|
174
|
-
totalPagesProcessed
|
175
|
-
|
176
|
-
|
177
|
-
const pagesPerSec = elapsed > 0 ? (totalPagesProcessed / elapsed).toFixed(1) : '0'
|
169
|
+
Effect.gen(function*() {
|
170
|
+
const completedBatches = yield* Ref.updateAndGet(completedBatchesRef, n => n + 1)
|
171
|
+
const totalPagesProcessed = yield* Ref.updateAndGet(totalPagesProcessedRef, n =>
|
172
|
+
n + result.processedCount)
|
173
|
+
// Still use process.stdout.write for progress bar - this is UI, not logging
|
178
174
|
const progress = Math.floor((completedBatches / batches.length) * 100)
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
175
|
+
yield* Effect.sync(() => {
|
176
|
+
process.stdout.write(
|
177
|
+
`\r Progress: ${completedBatches}/${batches.length} batches (${progress}%) • ${totalPagesProcessed}/${totalRoutes} pages`,
|
178
|
+
)
|
179
|
+
})
|
183
180
|
})
|
184
181
|
),
|
185
|
-
Effect.
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
},
|
195
|
-
)
|
182
|
+
Effect.tapError((error) =>
|
183
|
+
Effect.logError(`Batch ${index} failed`).pipe(
|
184
|
+
Effect.annotateLogs({ error: String(error), batch }),
|
185
|
+
)
|
186
|
+
),
|
187
|
+
Effect.map((result) => ({ ...result, batchIndex: index })),
|
188
|
+
Effect.either, // Convert to Either to capture both success and failure
|
189
|
+
)
|
190
|
+
),
|
191
|
+
{ concurrency: optimalWorkers },
|
192
|
+
).pipe(Effect.timed)
|
196
193
|
|
197
|
-
|
194
|
+
// Partition results into successes and failures
|
195
|
+
const [lefts, rights] = Array.partition(results, Either.isRight)
|
196
|
+
const successfulResults = rights.map(r =>
|
197
|
+
r.right
|
198
|
+
)
|
199
|
+
const failedBatches = lefts.map(r => ({
|
200
|
+
error: r.left instanceof Error ? r.left.message : String(r.left),
|
201
|
+
}))
|
198
202
|
|
199
203
|
// Final stats using successful results
|
200
|
-
const totalTime = (
|
201
|
-
const
|
202
|
-
const
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
204
|
+
const totalTime = (Duration.toMillis(elapsedTime) / 1000).toFixed(1)
|
205
|
+
const actualPagesGenerated = yield* Ref.get(totalPagesProcessedRef)
|
206
|
+
const totalFailures = totalRoutes - actualPagesGenerated
|
207
|
+
|
208
|
+
if (successfulResults.length > 0) {
|
209
|
+
const totalMemoryMB = Array.reduce(successfulResults, 0, (sum, r) => sum + r.memoryUsed) / (1024 * 1024)
|
210
|
+
const avgTimePerBatch = Array.reduce(successfulResults, 0, (sum, r) => sum + r.duration)
|
211
|
+
/ successfulResults.length
|
212
|
+
/ 1000
|
213
|
+
|
214
|
+
if (totalFailures === 0) {
|
215
|
+
consola.success(`\n\nSSG Complete!`)
|
216
|
+
consola.info(` Generated: ${actualPagesGenerated} pages in ${totalTime}s`)
|
217
|
+
consola.info(` Performance: ${(actualPagesGenerated / parseFloat(totalTime)).toFixed(1)} pages/sec`)
|
218
|
+
consola.info(` Avg batch time: ${avgTimePerBatch.toFixed(1)}s`)
|
219
|
+
consola.info(` Peak memory: ${totalMemoryMB.toFixed(0)}MB`)
|
220
|
+
} else {
|
221
|
+
consola.warn(`\n\nSSG Completed with Errors`)
|
222
|
+
consola.info(` Generated: ${actualPagesGenerated} out of ${totalRoutes} pages`)
|
223
|
+
consola.error(` Failed: ${totalFailures} pages`)
|
224
|
+
consola.info(` Time: ${totalTime}s`)
|
225
|
+
consola.info(` Performance: ${(actualPagesGenerated / parseFloat(totalTime)).toFixed(1)} pages/sec`)
|
226
|
+
consola.info(` Avg batch time: ${avgTimePerBatch.toFixed(1)}s`)
|
227
|
+
consola.info(` Peak memory: ${totalMemoryMB.toFixed(0)}MB`)
|
228
|
+
|
229
|
+
// Log details of failures from each batch
|
230
|
+
const allFailures = successfulResults.flatMap(r => r.failures ?? [])
|
231
|
+
if (allFailures.length > 0) {
|
232
|
+
consola.error(`\n Failed routes:`)
|
233
|
+
for (const failure of allFailures.slice(0, 10)) {
|
234
|
+
consola.error(` - ${failure.route}: ${failure.error}`)
|
235
|
+
}
|
236
|
+
if (allFailures.length > 10) {
|
237
|
+
consola.error(` ... and ${allFailures.length - 10} more`)
|
238
|
+
}
|
239
|
+
}
|
240
|
+
|
241
|
+
// Fail the effect to indicate error
|
242
|
+
yield* Effect.fail(new Error(`SSG failed: ${totalFailures} pages could not be generated`))
|
243
|
+
}
|
244
|
+
} else {
|
245
|
+
consola.error(`\n\nSSG Failed Completely`)
|
246
|
+
consola.error(` No pages were generated out of ${totalRoutes} total`)
|
247
|
+
yield* Effect.fail(new Error(`SSG failed: No pages could be generated`))
|
248
|
+
}
|
249
|
+
|
250
|
+
yield* Effect.logDebug(`SSG generation complete`).pipe(
|
251
|
+
Effect.annotateLogs({
|
252
|
+
totalTime,
|
253
|
+
successfulBatches: successfulResults.length,
|
254
|
+
}),
|
255
|
+
)
|
220
256
|
}).pipe(
|
221
257
|
// Provide NodeContext for Path service used in page generator
|
222
258
|
Effect.provide(NodeContext.layer),
|
223
259
|
),
|
260
|
+
).pipe(
|
261
|
+
// After scoped resources are released
|
262
|
+
Effect.tap(() =>
|
263
|
+
Effect.sync(() => {
|
264
|
+
consola.info('\nShutting down...')
|
265
|
+
consola.success('Cleanup complete.')
|
266
|
+
})
|
267
|
+
),
|
268
|
+
Effect.tap(() => Effect.logDebug(`All resources cleaned up`)),
|
224
269
|
)
|
225
|
-
|
226
|
-
consola.info('\nShutting down...')
|
227
|
-
consola.success('Cleanup complete.')
|
228
|
-
debug(`All resources cleaned up`)
|
229
270
|
})
|