@ultimat3/render 31.34.0 → 31.36.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/render",
3
- "version": "31.34.0",
3
+ "version": "31.36.0",
4
4
  "description": "The route primitive and the five render modes: static, isr, ssr, stream, spa.",
5
5
  "keywords": [
6
6
  "ultimate",
@@ -52,12 +52,12 @@
52
52
  "test": "bun test"
53
53
  },
54
54
  "dependencies": {
55
- "@ultimat3/cache": "31.34.0",
56
- "@ultimat3/core": "31.34.0",
57
- "@ultimat3/http": "31.34.0",
58
- "@ultimat3/i18n": "31.34.0",
59
- "@ultimat3/schema": "31.34.0",
60
- "@ultimat3/seo": "31.34.0",
55
+ "@ultimat3/cache": "31.36.0",
56
+ "@ultimat3/core": "31.36.0",
57
+ "@ultimat3/http": "31.36.0",
58
+ "@ultimat3/i18n": "31.36.0",
59
+ "@ultimat3/schema": "31.36.0",
60
+ "@ultimat3/seo": "31.36.0",
61
61
  "sass": "1.107.1"
62
62
  }
63
63
  }
package/src/asset.ts CHANGED
@@ -100,14 +100,14 @@ export function asset(path: AssetPath): string {
100
100
  if (problem !== undefined) {
101
101
  throw new AssetMissingError(
102
102
  `asset(${renderCauseValue(path)}): ${problem}`,
103
- `name a file under apps/web/site/${ASSET_DIR}/ with one of: ${ASSET_EXTENSIONS.join(', ')}`,
103
+ `asset('logo.svg') // a file under apps/web/site/${ASSET_DIR}/ with one of: ${ASSET_EXTENSIONS.join(', ')}`,
104
104
  );
105
105
  }
106
106
  const resolver = holder[RESOLVER_SLOT];
107
107
  if (resolver === undefined) {
108
108
  throw new AssetMissingError(
109
109
  `asset(${renderCauseValue(path)}) ran with no site asset table installed — in a browser (an island), or in a test that never loaded the app`,
110
- 'call asset() in the page and pass the URL to the island as a prop; a unit test installs a table with setAssetResolver((path) => "/" + path)',
110
+ 'asset(path) // in the page, the URL passed to the island as a prop; a unit test installs a table with setAssetResolver((path) => "/" + path)',
111
111
  );
112
112
  }
113
113
  return resolver(path);
@@ -219,8 +219,8 @@ function unescapeName(name: string): string {
219
219
 
220
220
  /** The fix line for a stylesheet that names tokens `@ultimat3/ui/tokens` does not export. */
221
221
  const TOKEN_FIX =
222
- "@ultimat3/ui/tokens exports functions and mixins — space(4), radius(md), role('surface-raised'), " +
223
- 'text(sm) — and no $variables';
222
+ "space(4), radius(md), role('surface-raised'), text(sm) — @ultimat3/ui/tokens exports functions " +
223
+ 'and mixins and no $variables';
224
224
 
225
225
  /**
226
226
  * A leading byte-order mark or `@charset` rule: the encoding claim Sass writes at the head of any
@@ -357,7 +357,7 @@ export function compileStylesheet(file: string, source: string): CompiledStylesh
357
357
  const first = renderThrowable(error).split('\n')[0];
358
358
  throw new PrerenderFailedError(
359
359
  `${file} did not compile: ${first}`,
360
- `edit ${file}: ${TOKEN_FIX}`,
360
+ `space(4) // in ${file}: ${TOKEN_FIX}`,
361
361
  );
362
362
  }
363
363
  if (!isCssModule(file)) return { css, classes: {}, dependencies };
package/src/head.ts CHANGED
@@ -213,7 +213,7 @@ export function themeScript(options: ThemeScriptOptions = {}): HeadTag {
213
213
  throw new BudgetExceededError(
214
214
  `the inlined theme script is ${bytes}b, over its ${cap}b cap — the only script a ` +
215
215
  '0kb site/ route is allowed to ship',
216
- 'shrink the theme script, or raise maxBytes deliberately in the head config',
216
+ 'themeScript({ maxBytes: 2048 }) // raise the cap deliberately — or shrink the theme script',
217
217
  );
218
218
  }
219
219
 
@@ -10,7 +10,7 @@ import { IslandInvalidError, IslandNotHydratedError } from './errors';
10
10
  import type { IslandDirective } from './hydrate';
11
11
  import { DEFAULT_REPLAY_EVENTS } from './hydrate';
12
12
  import type { IslandSpec } from './island';
13
- import { isEmittableSpecifier, islandNeverDrained } from './island';
13
+ import { ISLAND_EXTENSION, isEmittableSpecifier, islandNeverDrained } from './island';
14
14
  import type { IslandProps } from './island-props';
15
15
  import { checkIslandProps } from './island-props';
16
16
  import type { JsxProps } from './jsx';
@@ -71,7 +71,7 @@ export function islandCollector(input: IslandCollectorInput): IslandCollector {
71
71
  throw new IslandInvalidError(
72
72
  `two islands on ${input.file} both resolve to the id ${spec.moduleId} (${claimed} and ` +
73
73
  `${entry}), so their props would be handed to whichever the browser found first`,
74
- `rename one of the modules — the id is its filename, so two islands need two names`,
74
+ `island({ src: './<another name>${ISLAND_EXTENSION}' }) // rename one of the modules — the id is its filename, so two islands need two names`,
75
75
  );
76
76
  }
77
77
  entries.set(spec.moduleId, entry);
@@ -141,7 +141,7 @@ function assertEntry(entry: string, spec: IslandSpec, file: string): void {
141
141
  throw new IslandInvalidError(
142
142
  `the resolver returned ${renderCauseValue(entry)} for the ${spec.moduleId} island in ${file}, ` +
143
143
  'which cannot be emitted as a module URL',
144
- 'fix the resolve() passed to islandCollector — it must return a plain URL path',
144
+ "resolve: (src) => '/<a plain URL path>' // the resolve() passed to islandCollector must return one",
145
145
  );
146
146
  }
147
147
 
@@ -125,7 +125,7 @@ function guardCycle(value: object, path: string, seen: Set<object>, file: string
125
125
  }
126
126
  throw new IslandPropsInvalidError(
127
127
  `${path} closes a cycle, so it can never be serialized for the browser`,
128
- `break the cycle at ${path} in ${file} — pass ids instead of linked objects`,
128
+ `{ id: value.id } // break the cycle at ${path} in ${file} — pass ids instead of linked objects`,
129
129
  );
130
130
  }
131
131
 
package/src/island.ts CHANGED
@@ -172,21 +172,21 @@ function normalizeIsland(declaration: IslandDeclaration): IslandSpec {
172
172
  if (typeof src !== 'string' || src.length === 0) {
173
173
  throw new IslandInvalidError(
174
174
  'island() was given no src, so there is no module for the browser to import',
175
- `pass src: './<name>${ISLAND_EXTENSION}' — the client entry, as a specifier, never an import`,
175
+ `island({ src: './<name>${ISLAND_EXTENSION}' }) // the client entry, as a specifier, never an import`,
176
176
  );
177
177
  }
178
178
  if (src.includes('://')) {
179
179
  throw new IslandInvalidError(
180
180
  `island src ${JSON.stringify(src)} is a remote URL, so it is outside the bundle graph and ` +
181
181
  'outside the route budget that has to count it',
182
- `vendor the module into the app and pass src: './<name>${ISLAND_EXTENSION}'`,
182
+ `island({ src: './<name>${ISLAND_EXTENSION}' }) // the module vendored into the app`,
183
183
  );
184
184
  }
185
185
  if (UNSAFE_SPECIFIER.test(src)) {
186
186
  throw new IslandInvalidError(
187
187
  `island src ${JSON.stringify(src)} contains a character that cannot appear in the ` +
188
188
  'data-x-entry attribute it is emitted into',
189
- `rename the module to a plain path and pass src: './<name>${ISLAND_EXTENSION}'`,
189
+ `island({ src: './<name>${ISLAND_EXTENSION}' }) // the module renamed to a plain path`,
190
190
  );
191
191
  }
192
192
  if (!src.endsWith(ISLAND_EXTENSION)) {
@@ -205,7 +205,7 @@ function normalizeIsland(declaration: IslandDeclaration): IslandSpec {
205
205
  if (moduleId.length === 0) {
206
206
  throw new IslandInvalidError(
207
207
  `island src ${JSON.stringify(src)} has no name left once ${ISLAND_EXTENSION} is removed`,
208
- `name the module: src: './<name>${ISLAND_EXTENSION}'`,
208
+ `island({ src: './<name>${ISLAND_EXTENSION}' }) // name the module`,
209
209
  );
210
210
  }
211
211
 
package/src/modes.ts CHANGED
@@ -80,14 +80,14 @@ export function assertModeShape(config: RouteShape): void {
80
80
  if (spec === undefined) {
81
81
  throw new RouteModeInvalidError(
82
82
  `render: ${renderCauseValue(config.render)} is not a render mode`,
83
- `use one of ${RENDER_MODES.join(' | ')}`,
83
+ `render: 'ssr' // one of ${RENDER_MODES.join(' | ')}`,
84
84
  );
85
85
  }
86
86
 
87
87
  if (!HYDRATE_STRATEGIES.includes(config.hydrate)) {
88
88
  throw new RouteModeInvalidError(
89
89
  `hydrate: ${renderCauseValue(config.hydrate)} is not a hydration strategy`,
90
- `use one of ${HYDRATE_STRATEGIES.join(' | ')}`,
90
+ `hydrate: 'never' // one of ${HYDRATE_STRATEGIES.join(' | ')}`,
91
91
  );
92
92
  }
93
93
 
@@ -97,13 +97,13 @@ export function assertModeShape(config: RouteShape): void {
97
97
  throw new RouteModeInvalidError(
98
98
  "render: 'static' cannot read per-request state, but a `policy` was declared " +
99
99
  `(${config.policy.permission} needs an actor)`,
100
- "change render to 'ssr' — per-request and gated — or drop the policy",
100
+ "render: 'ssr' // per-request and gated — or drop the policy",
101
101
  );
102
102
  }
103
103
  if (config.render === 'static' && config.revalidate !== undefined) {
104
104
  throw new RouteModeInvalidError(
105
105
  "render: 'static' is built once and never regenerates, but `revalidate` was declared",
106
- "change render to 'isr' to keep the revalidate trigger",
106
+ "render: 'isr' // keeps the revalidate trigger",
107
107
  );
108
108
  }
109
109
 
@@ -116,7 +116,7 @@ export function assertModeShape(config: RouteShape): void {
116
116
  throw new RouteModeInvalidError(
117
117
  "render: 'isr' caches one document per URL and cannot be gated, but a `policy` was " +
118
118
  `declared (${config.policy.permission} varies the answer per actor)`,
119
- "change render to 'ssr' — per-request and gated — or drop the policy",
119
+ "render: 'ssr' // per-request and gated — or drop the policy",
120
120
  );
121
121
  }
122
122
 
@@ -124,7 +124,7 @@ export function assertModeShape(config: RouteShape): void {
124
124
  if (config.render === 'isr' && !hasRevalidateTrigger(config)) {
125
125
  throw new RouteModeInvalidError(
126
126
  "render: 'isr' requires a regeneration trigger, but revalidate has neither tags nor ttl",
127
- "add revalidate: { tags: [tag.post] } or revalidate: { ttl: '5m' }",
127
+ "revalidate: { tags: [tag.post] } // or revalidate: { ttl: '5m' }",
128
128
  );
129
129
  }
130
130
  if (config.render === 'isr' && config.revalidate !== undefined) {
@@ -137,7 +137,7 @@ export function assertModeShape(config: RouteShape): void {
137
137
  if (config.cache !== undefined && config.render !== 'ssr') {
138
138
  throw new RouteModeInvalidError(
139
139
  `render: '${config.render}' decides its own cache headers, but \`cache\` was declared`,
140
- "change render to 'ssr' to declare the cache, or remove cache",
140
+ "render: 'ssr' // to declare the cache — or remove cache",
141
141
  );
142
142
  }
143
143
  // A gated page is one actor's document. A shared-cache offer on it is the tenant-leak class
@@ -148,7 +148,7 @@ export function assertModeShape(config: RouteShape): void {
148
148
  throw new RouteModeInvalidError(
149
149
  `a route gated by ${config.policy.permission} declares cache mode '${mode}', which offers ` +
150
150
  "one actor's document to a shared cache",
151
- "declare cache: 'no-store' or { mode: 'private', … }, or drop the policy",
151
+ "cache: 'no-store' // or { mode: 'private', … } — or drop the policy",
152
152
  );
153
153
  }
154
154
 
@@ -156,7 +156,7 @@ export function assertModeShape(config: RouteShape): void {
156
156
  if (config.render === 'ssr' && config.prerender !== undefined) {
157
157
  throw new RouteModeInvalidError(
158
158
  "render: 'ssr' renders per request and cannot be prerendered, but `prerender` was declared",
159
- "change render to 'isr' to prerender and regenerate, or remove prerender",
159
+ "render: 'isr' // to prerender and regenerate — or remove prerender",
160
160
  );
161
161
  }
162
162
  }
@@ -185,7 +185,7 @@ export function assertModeInvariants(config: RouteShape, ctx: ModeCheckContext):
185
185
  throw new RouteModeInvalidError(
186
186
  `${ctx.file} is in ${ctx.surface}/ and declares render: '${config.render}', ` +
187
187
  `which ${ctx.surface}/ does not allow`,
188
- `use one of ${allowed} in ${ctx.file}`,
188
+ `render: '${SURFACE_SPECS[ctx.surface].allowedModes[0] ?? 'static'}' // in ${ctx.file}: one of ${allowed}`,
189
189
  );
190
190
  }
191
191
 
@@ -206,7 +206,7 @@ export function assertModeInvariants(config: RouteShape, ctx: ModeCheckContext):
206
206
  throw new RouteModeInvalidError(
207
207
  `${ctx.file} is in site/ (0kb JS baseline) and opts into hydrate: '${config.hydrate}' ` +
208
208
  'without a JS budget',
209
- `add budget: { js: '10kb' } to ${ctx.file} — hydration on site/ is explicit and budgeted`,
209
+ `budget: { js: '10kb' } // in ${ctx.file} — hydration on site/ is explicit and budgeted`,
210
210
  );
211
211
  }
212
212
 
@@ -215,7 +215,7 @@ export function assertModeInvariants(config: RouteShape, ctx: ModeCheckContext):
215
215
  if (config.prerender !== undefined && !prerenderable) {
216
216
  throw new RouteModeInvalidError(
217
217
  `${ctx.file} declares prerender with render: '${config.render}', which is not prerenderable`,
218
- `remove prerender from ${ctx.file} or change render to 'static' | 'isr'`,
218
+ `render: 'static' // or 'isr', in ${ctx.file} — or remove prerender`,
219
219
  );
220
220
  }
221
221
  }
@@ -4,6 +4,7 @@
4
4
  * collision rule only: nothing here renders, matches or serves.
5
5
  */
6
6
 
7
+ import { renderFixShellArg } from '@ultimat3/core';
7
8
  import { RouteDuplicateError } from './errors';
8
9
  import type { RouteConfig } from './route';
9
10
  import type { Surface } from './surfaces';
@@ -87,5 +88,5 @@ export const mountCollision = (
87
88
  ): RouteDuplicateError =>
88
89
  new RouteDuplicateError(
89
90
  `${path} is claimed by both ${file} and ${mount.by}() — a route ${mount.file} mounts`,
90
- `delete ${file}: ${mount.by}() already serves ${path}, and the route table is keyed by URL`,
91
+ `rm -- ${renderFixShellArg(file, "'<the route file>'")} # ${mount.by}() already serves ${path}, and the route table is keyed by URL`,
91
92
  );
@@ -16,6 +16,10 @@ const isRecord = (value: unknown): value is Readonly<Record<string, unknown>> =>
16
16
  * Decided by `params` holding an object: a param VALUE is always a string, so `{ params: 'a' }` on a
17
17
  * route whose own dynamic segment is `[params]` stays the plain params it has always been.
18
18
  */
19
+ /** One params object to paste into a fix: `{ slug: '…' }`, each dynamic param named. */
20
+ const paramsShape = (keys: readonly string[]): string =>
21
+ `{ ${keys.map((key) => `${key}: '…'`).join(', ')} }`;
22
+
19
23
  const isEntry = (item: Readonly<Record<string, unknown>>): boolean => isRecord(item['params']);
20
24
 
21
25
  function entryOf(entry: RouteEntry, item: Readonly<Record<string, unknown>>): PrerenderEntry {
@@ -74,7 +78,7 @@ export async function enumeratePrerenderEntries(
74
78
  if (!Array.isArray(produced)) {
75
79
  throw new PrerenderFailedError(
76
80
  `prerender() for ${entry.path} returned ${typeof produced}, expected an array`,
77
- `return an array of params from prerender in ${entry.file}`,
81
+ `prerender: () => [${paramsShape(entry.pattern.keys)}] // in ${entry.file}: an array of params`,
78
82
  );
79
83
  }
80
84
 
@@ -86,7 +90,7 @@ export async function enumeratePrerenderEntries(
86
90
  throw new PrerenderFailedError(
87
91
  `prerender() for ${entry.path} returned the bare string ${renderCauseValue(item)} ` +
88
92
  `but the route has ${keys.length} dynamic params (${keys.join(', ')})`,
89
- `return objects from prerender in ${entry.file}, e.g. { ${keys.join(': …, ')}: … }`,
93
+ `prerender: () => [${paramsShape(keys)}] // in ${entry.file}: objects, one key per dynamic param`,
90
94
  );
91
95
  }
92
96
  return { params: { [only]: item } };
@@ -95,7 +99,7 @@ export async function enumeratePrerenderEntries(
95
99
  if (!isRecord(item)) {
96
100
  throw new PrerenderFailedError(
97
101
  `prerender() for ${entry.path} returned ${renderCauseValue(item)} as one of its items, which is neither a params object nor a string`,
98
- `return an array of params objects (or strings, for a one-param route) from prerender in ${entry.file}`,
102
+ `prerender: () => [${paramsShape(keys)}] // in ${entry.file}: params objects, or strings for a one-param route`,
99
103
  );
100
104
  }
101
105
  return isEntry(item) ? entryOf(entry, item) : { params: item as RouteParams };
package/src/registry.ts CHANGED
@@ -130,7 +130,7 @@ export function registerRoute<TData = RouteData>(
130
130
  throw new RouteUnnormalizedError(
131
131
  `${input.file} registered a route declaration, not a descriptor: defineRoute normalizes ` +
132
132
  '`meta` and `budget`, and the route table has no other normalizer',
133
- `wrap the declaration in ${input.file}: registerRoute({ file, config: defineRoute({ … }) })`,
133
+ `registerRoute({ file, config: defineRoute({ … }) }) // wrap the declaration in ${input.file}`,
134
134
  );
135
135
  }
136
136
 
@@ -152,7 +152,7 @@ export function registerRoute<TData = RouteData>(
152
152
  if (existing !== undefined && existing.file !== input.file) {
153
153
  throw new RouteDuplicateError(
154
154
  `${path} is claimed by both ${existing.file} and ${input.file}`,
155
- `rename or delete one of them — the route table is keyed by URL`,
155
+ `x routes --json # rename or delete one of the two files at ${path} — the route table is keyed by URL`,
156
156
  );
157
157
  }
158
158
  const claimed = mountedAt(path);
@@ -127,7 +127,7 @@ async function renderPage(
127
127
  `rendering the component in ${file} threw: ${renderThrowable(error)}`,
128
128
  // The route file is author text and `$(…)` is a legal name: screened where it enters the
129
129
  // reproduce command (security audit of plan 101 sweep 1c).
130
- `run \`bun test ${renderFixShellArg(file.replace(/\.tsx?$/, '.test.ts'), "'<the route's test file>'")}\` to reproduce, then fix ${file}`,
130
+ `bun test ${renderFixShellArg(file.replace(/\.tsx?$/, '.test.ts'), "'<the route test file>'")} # reproduces it — then fix ${file}`,
131
131
  );
132
132
  }
133
133
  }
@@ -60,7 +60,7 @@ export function assertNoPerRequestState(file: string): void {
60
60
  throw new RouteModeInvalidError(
61
61
  `${file} declares render: 'static' but rendered inside a request context ` +
62
62
  '(actor/request visible), so its output would leak per-request state',
63
- `change render to 'ssr' in ${file}, or move the request-dependent part into an island`,
63
+ `render: 'ssr' // in ${file} — or move the request-dependent part into an island`,
64
64
  );
65
65
  }
66
66
  }
@@ -94,7 +94,7 @@ export function assertPurgeableTags(file: string, tags: readonly CacheTag[] | un
94
94
  const wire = renderFixLiteral(serializeTag(owned), '<the tag>');
95
95
  throw new RouteModeInvalidError(
96
96
  `${file} declares revalidate tag ${wire}, which cannot be a CDN purge key — a key is split on whitespace and commas and capped at 1024 bytes, so every response of the route would carry one no purge can name`,
97
- `edit revalidate.tags in ${file}: replace ${wire} with a tag whose entity and id carry no whitespace or comma`,
97
+ `revalidate: { tags: [tag.post] } // in ${file}: replace ${wire} with a tag whose entity and id carry no whitespace or comma`,
98
98
  );
99
99
  }
100
100
  }
package/src/route-path.ts CHANGED
@@ -45,7 +45,7 @@ export function routePathFromFile(file: string): { surface: RouteSurface; path:
45
45
  if (located === null) {
46
46
  throw new SurfaceBoundaryError(
47
47
  `${file} is not inside a surface directory, so it has no URL and no bundle graph`,
48
- `move ${file} under site/ or app/, named page.tsx`,
48
+ `git mv -- ${shellQuote(file)} '<site or app>/<path>/page.tsx' # under site/ or app/, named page.tsx`,
49
49
  );
50
50
  }
51
51
  const surface = routeSurfaceOf(normalized, located.surface);
@@ -78,13 +78,13 @@ function routeSurfaceOf(file: string, surface: Surface): RouteSurface {
78
78
  if (surface === 'shared') {
79
79
  throw new RouteFileInvalidError(
80
80
  `${file} is under shared/, which is a leaf of helpers with no URL — a route cannot live there`,
81
- `move ${file} under site/ or app/, named page.tsx`,
81
+ `git mv -- ${shellQuote(file)} '<site or app>/<path>/page.tsx' # under site/ or app/, named page.tsx`,
82
82
  );
83
83
  }
84
84
  if (surface === 'api') {
85
85
  throw new RouteFileInvalidError(
86
86
  `${file} is under api/, which holds no route file: api/ is the actions and queries defineApi() collects`,
87
- `JSON in and out: replace ${file} with an action (x g action <name>) collected by defineApi() in api/index.ts. Another wire format (a webhook, an OAuth endpoint): delete ${file} and add a plain HTTP route to the routes array exported as runtime from apps/<app>/runtime.ts`,
87
+ `x g action '<name>' # JSON in and out: replace ${file} with an action collected by defineApi() in api/index.ts. Another wire format (a webhook, an OAuth endpoint): delete ${file} and add a plain HTTP route to the routes array exported as runtime from apps/<app>/runtime.ts`,
88
88
  );
89
89
  }
90
90
  return surface;
@@ -50,7 +50,7 @@ export function withStatus<TData extends object>(status: number, data: TData): T
50
50
  if (isRedirect(screened)) {
51
51
  throw new RouteStatusInvalidError(
52
52
  `withStatus(${String(screened)}, …) asks a page to be a redirect, and a rendered document has no Location to send`,
53
- "answer 2xx, 4xx or 5xx from load; a redirect is `redirect(location)` from '@ultimat3/http', thrown or returned by the handler",
53
+ "redirect(location) // from '@ultimat3/http', thrown or returned by the handler — a page answers 2xx, 4xx or 5xx from load",
54
54
  );
55
55
  }
56
56
  STATUSES.set(data, screened);
package/src/route.ts CHANGED
@@ -332,26 +332,26 @@ export function defineRoute<TData = RouteData>(
332
332
  if (def.offline === undefined) {
333
333
  throw new RouteOfflineMissingError(
334
334
  'defineRoute() called without an `offline` strategy',
335
- "add offline: 'precache' | 'runtime' | 'network-only' to defineRoute",
335
+ "offline: 'precache' // or 'runtime' | 'network-only', in defineRoute",
336
336
  );
337
337
  }
338
338
  if (!OFFLINE_STRATEGIES.includes(def.offline)) {
339
339
  throw new RouteOfflineMissingError(
340
340
  `offline: ${renderCauseValue(def.offline)} is not a known strategy`,
341
- `use one of ${OFFLINE_STRATEGIES.join(' | ')}`,
341
+ `offline: 'precache' // one of ${OFFLINE_STRATEGIES.join(' | ')}`,
342
342
  );
343
343
  }
344
344
  if (typeof def.meta !== 'function') {
345
345
  throw new RouteMetaMissingError(
346
346
  'defineRoute() called without a `meta` function',
347
- 'add meta: () => ({ title, description }) to defineRoute',
347
+ 'meta: () => ({ title, description }) // in defineRoute',
348
348
  );
349
349
  }
350
350
 
351
351
  if (def.load !== undefined && typeof def.load !== 'function') {
352
352
  throw new RouteLoadInvalidError(
353
353
  `load: ${renderCauseValue(def.load)} is not a function`,
354
- 'make load a function of ({ params, url }) returning the page data, or remove it',
354
+ 'load: ({ params, url }) => ({ … }) // returns the page data — or remove load',
355
355
  );
356
356
  }
357
357
 
@@ -21,7 +21,7 @@ const hasControl = (text: string): boolean => {
21
21
  const refuse = (pattern: string, param: string, value: unknown, why: string): never => {
22
22
  throw new PrerenderFailedError(
23
23
  `prerender() gave ${pattern} the ${param} ${renderCauseValue(value)}, which ${why}`,
24
- `return a value for every param of ${pattern} from prerender(), each one plain path text — slugify it (lowercase, [a-z0-9-]) where it comes from a title or a user`,
24
+ `prerender: () => [{ ${param}: '<slug>' }] // a value for every param of ${pattern}, each one plain path text — slugify it (lowercase, [a-z0-9-]) where it comes from a title or a user`,
25
25
  );
26
26
  };
27
27
 
package/src/surfaces.ts CHANGED
@@ -300,7 +300,7 @@ function classify(i: ClassifyInput): BoundaryViolation | null {
300
300
  ...base,
301
301
  rule: 'shared-is-a-leaf',
302
302
  cause: `${chainText} (shared/ is a leaf — it may not import a surface)`,
303
- fix: `move the shared part of ${i.imported} into shared/ and import it from ${i.importer}`,
303
+ fix: `x fix boundary ${renderFixShellArg(i.importer, "'<the importing file>'")} # or move the shared part of ${i.imported} into shared/ and import it from ${i.importer}`,
304
304
  };
305
305
  }
306
306
  if (from === 'app' && to === 'api' && !i.typeOnly) {
@@ -308,7 +308,7 @@ function classify(i: ClassifyInput): BoundaryViolation | null {
308
308
  ...base,
309
309
  rule: 'app-imports-api-at-runtime',
310
310
  cause: `${chainText} (app/ → api/ is types-only)`,
311
- fix: `change to \`import type\` in ${i.importer} and call the typed client instead`,
311
+ fix: `import type { … } from '<the api module>' // in ${i.importer} — and call the typed client instead`,
312
312
  };
313
313
  }
314
314
  const field = i.typeOnly ? 'mayImportTypes' : 'mayImport';
@@ -316,7 +316,7 @@ function classify(i: ClassifyInput): BoundaryViolation | null {
316
316
  ...base,
317
317
  rule: 'surface-imports-surface',
318
318
  cause: `${chainText} (${from}/ may not import ${to}/${i.typeOnly ? ', even as a type' : ''}: SURFACE_SPECS.${from}.${field} is [${spec[field].join(', ')}])`,
319
- fix: `move what ${i.importer} needs from ${i.imported} into shared/ and import it from there`,
319
+ fix: `x fix boundary ${renderFixShellArg(i.importer, "'<the importing file>'")} # or move what ${i.importer} needs from ${i.imported} into shared/ and import it from there`,
320
320
  };
321
321
  }
322
322