sku 16.3.0-root-errorboundary-type-20260921013810 → 16.3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # sku
2
2
 
3
- ## 16.3.0-root-errorboundary-type-20260921013810
3
+ ## 16.3.0
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -8,9 +8,25 @@
8
8
 
9
9
  - Add `entrySideEffects` so apps can import isomorphic modules (such as Braid reset) before any consumer module. ([#1717](https://github.com/seek-oss/sku/pull/1717))
10
10
 
11
- ### Patch Changes
11
+ - Webpack SSR: Pass the listening server and port to `onStart` ([#1730](https://github.com/seek-oss/sku/pull/1730))
12
+
13
+ `onStart` still receives the Express app as its first argument. A new second argument carries `{ httpServer, port }`, so apps can set keep-alive timeouts and close the server on shutdown.
14
+
15
+ ```tsx
16
+ import type { Server } from 'sku';
17
+
18
+ export default (): Server => ({
19
+ renderCallback,
20
+ onStart: (app, { httpServer, port }) => {
21
+ httpServer.keepAliveTimeout = 20_000;
22
+ process.on('SIGTERM', () => {
23
+ httpServer.close(() => process.exit(0));
24
+ });
25
+ },
26
+ });
27
+ ```
12
28
 
13
- - `SkuRouteObject` now forbids `ErrorBoundary` and `errorElement` on the top-level html route, including via `lazy`. ([#1726](https://github.com/seek-oss/sku/pull/1726))
29
+ See the [Webpack SSR](https://seek-oss.github.io/sku/ssr/webpack-ssr) docs for more details.
14
30
 
15
31
  ## 16.2.0
16
32
 
@@ -1,7 +1,7 @@
1
1
  //#region package.json
2
2
  var package_default = {
3
3
  name: "sku",
4
- version: "16.2.0",
4
+ version: "16.3.0",
5
5
  description: "Front-end development toolkit, powered by Webpack, Babel, Vanilla Extract and Jest",
6
6
  types: "./dist/index.d.mts",
7
7
  bin: { "sku": "bin/bin.js" },
@@ -35,48 +35,15 @@ type JsonValue = string | number | boolean | null | Array<JsonValue | undefined>
35
35
  [key: string]: JsonValue | undefined;
36
36
  };
37
37
  /**
38
- * Child route in a `routesEntry` tree.
39
- * This type lets you set `ErrorBoundary` and `errorElement`.
40
- * This type is not a public `sku/runtime` export.
38
+ * Route object for `routesEntry`: React Router `RouteObject` plus optional
39
+ * `sites` membership. Omit `sites` ⇒ route is on every config site; present ⇒
40
+ * only those names. Sku type helper only — not a wrapped RR re-export.
41
+ * `children` are also `SkuRouteObject` so nested routes may set `sites`
42
+ * (no parent→child inheritance — each route declares membership explicitly).
41
43
  */
42
- type SkuChildRouteObject<Site extends string = string> = Omit<RouteObject, 'children'> & {
44
+ type SkuRouteObject<Site extends string = string> = Omit<RouteObject, 'children'> & {
43
45
  sites?: Site[];
44
- children?: Array<SkuChildRouteObject<Site>>;
45
- };
46
- type RouteObjectLazy = NonNullable<RouteObject['lazy']>;
47
- type RouteObjectLazyFunction = Extract<RouteObjectLazy, (...args: never[]) => unknown>;
48
- type RouteObjectLazyObject = Exclude<RouteObjectLazy, RouteObjectLazyFunction>;
49
- type SkuRootLazyResult = Omit<Awaited<ReturnType<RouteObjectLazyFunction>>, 'ErrorBoundary' | 'errorElement'> & {
50
- ErrorBoundary?: never;
51
- errorElement?: never;
52
- };
53
- /**
54
- * Root `lazy` from `RouteObject['lazy']`.
55
- * Do not set `ErrorBoundary` or `errorElement` on the result.
56
- */
57
- type SkuRootLazy = ((...args: Parameters<RouteObjectLazyFunction>) => Promise<SkuRootLazyResult>) | (Omit<RouteObjectLazyObject, 'ErrorBoundary' | 'errorElement'> & {
58
- ErrorBoundary?: never;
59
- errorElement?: never;
60
- });
61
- /**
62
- * Route object for `routesEntry`. This type is a React Router `RouteObject`
63
- * with optional `sites`.
64
- * If you do not set `sites`, the route is on all config sites.
65
- * If you set `sites`, the route is only on those site names.
66
- * This is a sku type helper. It is not a React Router re-export.
67
- * Nested routes can also set `sites`. A child does not get `sites` from a parent.
68
- * Each route must set its site list.
69
- * Do not set `ErrorBoundary` or `errorElement` on the top-level html route.
70
- * Do not set `ErrorBoundary` or `errorElement` through `lazy`.
71
- * React Router replaces the route `Component` when that route fails.
72
- * This includes the `<html>` element.
73
- * Set the boundary on a child route.
74
- */
75
- type SkuRouteObject<Site extends string = string> = Omit<SkuChildRouteObject<Site>, 'ErrorBoundary' | 'errorElement' | 'children' | 'lazy'> & {
76
- ErrorBoundary?: never;
77
- errorElement?: never;
78
- lazy?: SkuRootLazy;
79
- children?: Array<SkuChildRouteObject<Site>>;
46
+ children?: Array<SkuRouteObject<Site>>;
80
47
  };
81
48
  /**
82
49
  * Args for optional `routesEntry` `mapRoutePath`.
@@ -236,4 +203,4 @@ declare module 'express-serve-static-core' {
236
203
  }
237
204
  }
238
205
  //#endregion
239
- export { CommitDocument, CommitDocumentOptions, DocumentAssets, DocumentDestination, JsonValue, MapRoutePath, MapRoutePathArgs, RenderAssets, RenderManifest, RenderOptions, RenderResult, RenderSuccess, type SiteOf, SkuChildRouteObject, SkuClientEntry, SkuClientGetReactContext, SkuClientGetRouterContext, SkuGetLanguage, SkuGetSite, SkuMiddleware, SkuOnHydrate, SkuOnListen, SkuRouteObject, SkuServerEntry, SkuServerGetReactContext, SkuServerGetRouterContext };
206
+ export { CommitDocument, CommitDocumentOptions, DocumentAssets, DocumentDestination, JsonValue, MapRoutePath, MapRoutePathArgs, RenderAssets, RenderManifest, RenderOptions, RenderResult, RenderSuccess, type SiteOf, SkuClientEntry, SkuClientGetReactContext, SkuClientGetRouterContext, SkuGetLanguage, SkuGetSite, SkuMiddleware, SkuOnHydrate, SkuOnListen, SkuRouteObject, SkuServerEntry, SkuServerGetReactContext, SkuServerGetRouterContext };
@@ -1,6 +1,8 @@
1
1
  import { Plugin, PluginOption } from "vite";
2
2
  import { JSX, ReactNode } from "react";
3
3
  import { ChunkExtractor } from "@loadable/server";
4
+ import { Server } from "node:http";
5
+ import { Server as Server$1 } from "node:https";
4
6
  import { Express, RequestHandler } from "express";
5
7
  import { Linter } from "eslint";
6
8
  import { TestUserConfig } from "vitest/node";
@@ -27,9 +29,12 @@ interface RenderCallbackParams {
27
29
  extractor: ChunkExtractor;
28
30
  registerScript?: (script: string) => void;
29
31
  }
30
- interface Server {
32
+ interface Server$2 {
31
33
  renderCallback: (params: RenderCallbackParams, ...requestHandlerParams: Parameters<RequestHandler>) => void;
32
- onStart?: (app: Express) => void;
34
+ onStart?: (app: Express, server: {
35
+ httpServer: Server | Server$1;
36
+ port: number;
37
+ }) => void | Promise<void>;
33
38
  middleware?: RequestHandler | RequestHandler[];
34
39
  }
35
40
  interface RenderableRoute {
@@ -597,4 +602,4 @@ type SkuConfig = SkuConfigBase & (({
597
602
  bundler: 'vite';
598
603
  } & ViteSkuConfig));
599
604
  //#endregion
600
- export { Render, RenderAppProps, RenderCallbackParams, RenderableRoute, Server, SkuConfig, SkuConfigBase, SkuLanguage, SkuProvider, SkuRoute, SkuRouteObject, SkuSiteObject, TransformOutputPathFunctionParams, ViteRenderFunction, ViteSkuConfig, WebpackSkuConfig };
605
+ export { Render, RenderAppProps, RenderCallbackParams, RenderableRoute, Server$2 as Server, SkuConfig, SkuConfigBase, SkuLanguage, SkuProvider, SkuRoute, SkuRouteObject, SkuSiteObject, TransformOutputPathFunctionParams, ViteRenderFunction, ViteSkuConfig, WebpackSkuConfig };
@@ -15,11 +15,20 @@ const { values } = parseArgs({
15
15
  strict: false
16
16
  });
17
17
  const { port } = values;
18
- const startCallback = () => {
18
+ let server;
19
+ const startCallback = async () => {
19
20
  console.log("sku SSR server started on port", port);
20
- if (typeof onStart === "function") onStart(app);
21
+ if (typeof onStart !== "function") return;
22
+ try {
23
+ await onStart(app, {
24
+ httpServer: server,
25
+ port: Number(port)
26
+ });
27
+ } catch (error) {
28
+ console.error(error);
29
+ process.exit(1);
30
+ }
21
31
  };
22
- let server;
23
32
  if (__SKU_DEV_HTTPS__) {
24
33
  const pems = fs.readFileSync(".ssl/self-signed.pem");
25
34
  server = https.createServer({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sku",
3
- "version": "16.3.0-root-errorboundary-type-20260921013810",
3
+ "version": "16.3.0",
4
4
  "description": "Front-end development toolkit, powered by Webpack, Babel, Vanilla Extract and Jest",
5
5
  "types": "./dist/index.d.mts",
6
6
  "bin": {