@crombolo/server 0.47.0 → 0.48.1

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": "@crombolo/server",
3
- "version": "0.47.0",
3
+ "version": "0.48.1",
4
4
  "description": "Internal to crombolo, with no compatibility promise: use @crombolo/crombolo. The crombolo HTTP server: routing, configuration, media stores and background jobs.",
5
5
  "license": "MIT",
6
6
  "author": "Crombolo",
@@ -31,18 +31,18 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@crombolo/api-delivery": "0.47.0",
35
- "@crombolo/api-management": "0.47.0",
36
- "@crombolo/auth": "0.47.0",
37
- "@crombolo/backoffice-host": "0.47.0",
38
- "@crombolo/common": "0.47.0",
39
- "@crombolo/content": "0.47.0",
40
- "@crombolo/contracts": "0.47.0",
41
- "@crombolo/core": "0.47.0",
42
- "@crombolo/data": "0.47.0",
43
- "@crombolo/render": "0.47.0",
44
- "@crombolo/schema": "0.47.0",
45
- "@crombolo/transfer": "0.47.0",
34
+ "@crombolo/api-delivery": "0.48.1",
35
+ "@crombolo/api-management": "0.48.1",
36
+ "@crombolo/auth": "0.48.1",
37
+ "@crombolo/backoffice-host": "0.48.1",
38
+ "@crombolo/common": "0.48.1",
39
+ "@crombolo/content": "0.48.1",
40
+ "@crombolo/contracts": "0.48.1",
41
+ "@crombolo/core": "0.48.1",
42
+ "@crombolo/data": "0.48.1",
43
+ "@crombolo/render": "0.48.1",
44
+ "@crombolo/schema": "0.48.1",
45
+ "@crombolo/transfer": "0.48.1",
46
46
  "@logtape/logtape": "^2.3.8",
47
47
  "@opentelemetry/api": "1.10.0",
48
48
  "@opentelemetry/context-async-hooks": "3.0.0",
@@ -1,5 +1,6 @@
1
1
  /** Adapters binding the document repository to the API port and the renderer. */
2
2
  import type {
3
+ DocumentCollectionItem,
3
4
  DocumentPort,
4
5
  PortFailure,
5
6
  Principal,
@@ -7,7 +8,6 @@ import type {
7
8
  SkipTake,
8
9
  } from '@crombolo/api-management/domain'
9
10
  import {
10
- type DocumentAggregate,
11
11
  normaliseUuid,
12
12
  ObjectTypes,
13
13
  type Page,
@@ -19,8 +19,10 @@ import {
19
19
  ContentTypeRepository,
20
20
  type Db,
21
21
  DictionaryRepository,
22
+ DocumentListingRepository,
22
23
  DocumentRepository,
23
24
  type DocumentRepositoryOptions,
25
+ type DocumentSortField,
24
26
  DomainRepository,
25
27
  InvalidParentError,
26
28
  LanguageRepository,
@@ -74,6 +76,17 @@ async function toTreeItems(
74
76
  return items
75
77
  }
76
78
 
79
+ /** The list view's built-in columns, by the alias the client sends; any other is a property. */
80
+ const COLLECTION_SORTS: Record<string, DocumentSortField> = {
81
+ name: 'name',
82
+ createDate: 'createDate',
83
+ updateDate: 'updateDate',
84
+ sortOrder: 'sortOrder',
85
+ creator: 'creator',
86
+ owner: 'creator',
87
+ updater: 'updater',
88
+ }
89
+
77
90
  export function createDocumentPort(
78
91
  db: Db,
79
92
  cache: PublishedCache,
@@ -477,16 +490,53 @@ export function createDocumentPort(
477
490
  return toTreeItems(repo, await repo.nodes.byKeys(keys))
478
491
  },
479
492
 
480
- async collection(
481
- parentKey: string | null,
482
- paging: SkipTake,
483
- excludeKeys: readonly string[] = [],
484
- ): Promise<Page<DocumentAggregate>> {
485
- const page = await repo.children(parentKey, paging.skip, paging.take, excludeKeys)
486
- const items: DocumentAggregate[] = []
487
- for (const row of page.items) {
493
+ /**
494
+ * The list view (story 269): searched, sorted and paged in the database, so
495
+ * a large folder costs a page; then only the page's items are loaded.
496
+ */
497
+ async collection(parentKey, query, excludeKeys = []) {
498
+ const parent = parentKey ? await repo.nodes.byKey(parentKey) : undefined
499
+ if (parentKey && !parent) return { total: 0, items: [] }
500
+ const listing = new DocumentListingRepository(db)
501
+ const filter = query.filter?.trim()
502
+ const page = await listing.children({
503
+ parentId: parent?.id ?? -1,
504
+ names: filter ? [filter] : [],
505
+ // Anything but a built-in column is a property the list view shows (story 276).
506
+ sort: {
507
+ ...(COLLECTION_SORTS[query.orderBy ?? '']
508
+ ? { field: COLLECTION_SORTS[query.orderBy ?? ''] as DocumentSortField }
509
+ : query.orderBy
510
+ ? { property: query.orderBy }
511
+ : { field: 'sortOrder' as const }),
512
+ ascending: query.orderDirection !== 'Descending',
513
+ },
514
+ culture: query.orderCulture ?? null,
515
+ excludeKeys,
516
+ skip: query.skip,
517
+ take: query.take,
518
+ })
519
+ const found = new Map((await repo.nodes.byKeys(page.keys)).map((row) => [row.key, row]))
520
+ const rows = page.keys.flatMap((key) => found.get(key) ?? [])
521
+ const [guarded, people, counts] = await Promise.all([
522
+ repo.protectedKeys(rows),
523
+ listing.people(page.keys),
524
+ repo.nodes.childCounts(
525
+ rows.map((row) => row.id),
526
+ ObjectTypes.Document,
527
+ ),
528
+ ])
529
+ const items: DocumentCollectionItem[] = []
530
+ for (const row of rows) {
488
531
  const aggregate = await repo.load(row)
489
- if (aggregate) items.push(aggregate)
532
+ if (!aggregate) continue
533
+ items.push({
534
+ ...aggregate,
535
+ isProtected: guarded.has(row.key),
536
+ hasChildren: (counts.get(row.id) ?? 0) > 0,
537
+ creator: people.get(row.key)?.creator ?? null,
538
+ updater: people.get(row.key)?.updater ?? null,
539
+ })
490
540
  }
491
541
  return { total: page.total, items }
492
542
  },
@@ -267,12 +267,29 @@ export function createElementPort(
267
267
  }
268
268
  },
269
269
 
270
- async publish(key, cultures) {
270
+ async publish(key, cultures, schedules = []) {
271
+ const now = Date.now()
272
+ const later = (s: { publishTime: Date | null }) =>
273
+ s.publishTime !== null && s.publishTime.getTime() > now
274
+ const immediate = schedules.filter((s) => !later(s))
275
+ const scheduledOnly = schedules.length > 0 && immediate.length === 0
276
+ const publishing = immediate.some((s) => s.culture !== null)
277
+ ? immediate.flatMap((s) => (s.culture === null ? [] : [s.culture]))
278
+ : cultures
271
279
  try {
272
- const published = await repo.publish(key, cultures)
280
+ // The schedule and the publish are one change: neither lands without the other.
281
+ const published = await repo.atomically(async (tx) => {
282
+ if (schedules.length > 0)
283
+ await tx.setSchedule(
284
+ key,
285
+ schedules.map((s) => ({ ...s, publishTime: later(s) ? s.publishTime : null })),
286
+ )
287
+ if (scheduledOnly) return true
288
+ return tx.publish(key, publishing)
289
+ })
273
290
  if (!published) return notFound()
274
291
  await changed()
275
- return { ok: true as const }
292
+ return { ok: true as const, scheduledOnly }
276
293
  } catch (error) {
277
294
  return failure(error)
278
295
  }
@@ -22,6 +22,7 @@ import {
22
22
  type QueueCounts,
23
23
  queueCounts,
24
24
  RemoteTrustRepository,
25
+ searchProvidersOf,
25
26
  sql,
26
27
  UserGroupRepository,
27
28
  UserRepository,
@@ -49,6 +50,7 @@ const CHECKS = {
49
50
  routes: { id: '6f1d4a8e-0047-4c1a-9e7d-000000000007', name: 'Routes and pages' },
50
51
  settings: { id: '6f1d4a8e-0047-4c1a-9e7d-000000000008', name: 'Site settings' },
51
52
  code: { id: '6f1d4a8e-0047-4c1a-9e7d-000000000009', name: 'Installing code' },
53
+ search: { id: '6f1d4a8e-0047-4c1a-9e7d-00000000000a', name: 'Search providers' },
52
54
  } as const
53
55
 
54
56
  /** Waiting longer than this means nothing is sending: no server is running its jobs, or one is stuck. */
@@ -87,6 +89,15 @@ const GROUPS: HealthCheckGroup[] = [
87
89
  },
88
90
  ],
89
91
  },
92
+ {
93
+ name: 'Search',
94
+ checks: [
95
+ {
96
+ ...CHECKS.search,
97
+ description: 'Which search the back office and the site use, and whether each answers.',
98
+ },
99
+ ],
100
+ },
90
101
  {
91
102
  name: 'Site',
92
103
  checks: [
@@ -386,6 +397,29 @@ export function createDiagnosticsPort(options: HealthCheckOptions): DiagnosticsP
386
397
  ),
387
398
  )
388
399
  },
400
+ [CHECKS.search.id]: async () => {
401
+ const { backoffice, site } = searchProvidersOf(db)
402
+ const checked = async (
403
+ what: string,
404
+ provider: { name: string; health?(): Promise<{ ok: boolean; detail?: string }> },
405
+ ) => {
406
+ try {
407
+ const health = (await provider.health?.()) ?? { ok: true }
408
+ return health.ok
409
+ ? result('Success', `${what} uses ${provider.name}, which is answering.`)
410
+ : result(
411
+ 'Error',
412
+ `${what} uses ${provider.name}, which is not answering${health.detail ? `: ${health.detail}` : '.'}`,
413
+ )
414
+ } catch (error) {
415
+ return result(
416
+ 'Error',
417
+ `${what} uses ${provider.name}, which is not answering: ${failure(error)}`,
418
+ )
419
+ }
420
+ }
421
+ return [await checked('Back-office search', backoffice), await checked('Site search', site)]
422
+ },
389
423
  [CHECKS.code.id]: async () => {
390
424
  const results: HealthCheckResult[] = []
391
425
  const verb = RemotePermissions.InstallCode
@@ -476,6 +510,8 @@ export function createDiagnosticsPort(options: HealthCheckOptions): DiagnosticsP
476
510
  'E-mail',
477
511
  availability.available ? (availability.description ?? undefined) : 'Not configured',
478
512
  ],
513
+ ['Back-office search', searchProvidersOf(db).backoffice.name],
514
+ ['Site search', searchProvidersOf(db).site.name],
479
515
  ['Log level', config.logLevel],
480
516
  ['Telemetry', describeTelemetry(telemetryStatus())],
481
517
  ['Time zone', Intl.DateTimeFormat().resolvedOptions().timeZone],
package/src/config.ts CHANGED
@@ -3,10 +3,13 @@ import { join, resolve } from 'node:path'
3
3
  import type { DeliveryApiOptions } from '@crombolo/api-delivery'
4
4
  import type { MiddlewareChain, SiteRoute } from '@crombolo/common'
5
5
  import {
6
+ type BackofficeSearchProvider,
6
7
  DEFAULT_BACKOFFICE_PATH,
7
8
  DEFAULT_PASSWORD_CONFIGURATION,
8
9
  isValidPassword,
10
+ type SiteSearchProvider,
9
11
  } from '@crombolo/core'
12
+ import type { Db } from '@crombolo/data'
10
13
  import {
11
14
  type CacheOptions,
12
15
  DEFAULT_RENDER_TIMEOUT_MS,
@@ -138,6 +141,15 @@ export function listeningBodyLimit(config: CromboloConfig): number {
138
141
  : config.maxRequestBodyBytes
139
142
  }
140
143
 
144
+ /** Makes a search provider for a database; called once, when the database is opened. */
145
+ export type SearchProviderFactory<P> = (context: { db: Db }) => P
146
+
147
+ export interface SearchConfig {
148
+ backoffice?: SearchProviderFactory<BackofficeSearchProvider>
149
+ site?: SearchProviderFactory<SiteSearchProvider>
150
+ matchLimit?: number
151
+ }
152
+
141
153
  export interface CromboloConfig {
142
154
  port: number
143
155
  /** The largest request body the server will read, media uploads included. */
@@ -348,6 +360,13 @@ export interface CromboloConfig {
348
360
  * A site swaps in blob storage with `s3MediaStore` or `azureMediaStore`.
349
361
  */
350
362
  mediaStore: MediaStore | undefined
363
+ /**
364
+ * The search providers (story 273): backoffice search and site search, each
365
+ * a factory given the database, the database's own when unset. `matchLimit`
366
+ * caps the matches a provider outside the database gives a query that
367
+ * filters with them in SQL. docs/search.md, "Providers".
368
+ */
369
+ search: SearchConfig
351
370
  /** Where log files are written, and read by the backoffice's log viewer. */
352
371
  logsDir: string
353
372
  /** The least severe level logged: trace, debug, info, warning, error or fatal. */
@@ -828,6 +847,7 @@ export function loadConfig(
828
847
  DEFAULTS.mediaCacheMegabytes,
829
848
  ),
830
849
  mediaStore: undefined,
850
+ search: {},
831
851
  logsDir: setting('CROMBOLO_LOGS_DIR') ?? DEFAULTS.logsDir,
832
852
  logLevel: parseLogLevel(setting('CROMBOLO_LOG_LEVEL')),
833
853
  logToConsole: setting('CROMBOLO_LOG_TO_CONSOLE') !== 'false',
@@ -1066,7 +1086,7 @@ export function describeDatabase(
1066
1086
  }
1067
1087
  }
1068
1088
 
1069
- export const VERSION = '0.47.0'
1089
+ export const VERSION = '0.48.1'
1070
1090
 
1071
1091
  /** A whole number of seconds from the environment; undefined when unset or not one. */
1072
1092
  /** A positive number from a setting, else the default. */
package/src/database.ts CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  connect,
10
10
  cromboloPlan,
11
11
  type Db,
12
+ DEFAULT_MATCH_LIMIT,
12
13
  ensureBuiltInDataTypes,
13
14
  ensureSystemContentTypes,
14
15
  ensureSystemMemberTypes,
@@ -19,6 +20,7 @@ import {
19
20
  readState,
20
21
  seedContent,
21
22
  seedIdentity,
23
+ useSearchProviders,
22
24
  } from '@crombolo/data'
23
25
  import { ensureApiClient } from './api-client.ts'
24
26
  import { type CromboloConfig, runsOnLocalhost } from './config.ts'
@@ -87,9 +89,35 @@ export async function attachDatabase(
87
89
  await db.close()
88
90
  throw error
89
91
  }
92
+ useSiteSearchProviders(db, config)
90
93
  return { db, seededAdminPassword: undefined }
91
94
  }
92
95
 
96
+ /**
97
+ * Registers the site's search providers on `db` (story 273), so every reader
98
+ * of it, the indexer and the CLI among them, finds them. Without a factory,
99
+ * the database's own.
100
+ */
101
+ export function useSiteSearchProviders(db: Db, config: Pick<CromboloConfig, 'search'>): void {
102
+ const search = config.search ?? {}
103
+ const log = logger('search')
104
+ useSearchProviders(db, {
105
+ backoffice: search.backoffice?.({ db }),
106
+ site: search.site?.({ db }),
107
+ matchLimit: search.matchLimit,
108
+ onError: (error, context) =>
109
+ log.warning('The search provider {provider} failed; the item stays queued', {
110
+ provider: context.provider,
111
+ key: context.key,
112
+ error,
113
+ }),
114
+ onCapped: () =>
115
+ log.warning('A search took {limit} matches from the provider, so its total may be capped', {
116
+ limit: search.matchLimit ?? DEFAULT_MATCH_LIMIT,
117
+ }),
118
+ })
119
+ }
120
+
93
121
  /**
94
122
  * `chains` are the custom tables: the site's and the wired bundles'. Their
95
123
  * steps pending in production refuse the boot just as core's do, and a
@@ -118,6 +146,7 @@ export async function bootstrapDatabase(
118
146
  await db.close()
119
147
  throw error
120
148
  }
149
+ useSiteSearchProviders(db, config)
121
150
  return { db, seededAdminPassword: await installDatabase(db, config, chains) }
122
151
  }
123
152
 
package/src/jobs.ts CHANGED
@@ -21,6 +21,7 @@ import {
21
21
  } from '@crombolo/data'
22
22
  import type { PublishedCache } from '@crombolo/render'
23
23
  import { auditRetainedSince } from './adapters/audit.ts'
24
+ import { createElementPort } from './adapters/elements.ts'
24
25
  import type { Approvals } from './approvals.ts'
25
26
  import type { ContentDispatcher } from './content-dispatch.ts'
26
27
  import type {
@@ -122,6 +123,16 @@ export function createBackgroundJobs(options: JobsOptions): BackgroundJobs {
122
123
  nodeState: options.nodeState,
123
124
  nodeId: options.nodeId,
124
125
  })
126
+ const elementRows = new DocumentRepository(options.db, {
127
+ nodeState: options.nodeState,
128
+ nodeId: options.nodeId,
129
+ kind: 'element',
130
+ })
131
+ const elements = createElementPort(options.db, {
132
+ nodeState: options.nodeState,
133
+ nodeId: options.nodeId,
134
+ onChange: () => options.cache.invalidate(),
135
+ })
125
136
  const timers: Array<ReturnType<typeof setInterval>> = []
126
137
  const search = new SearchIndex(options.db)
127
138
  let indexing: Promise<number> | undefined
@@ -155,6 +166,17 @@ export function createBackgroundJobs(options: JobsOptions): BackgroundJobs {
155
166
  result.ok ? { ok: true } : { ok: false, reason: result.reason },
156
167
  )
157
168
  }
169
+ // Library elements: no approvals and no redirects, so the port publishes them directly.
170
+ for (const due of await elementRows.dueSchedules(now)) {
171
+ if (!(await elementRows.claimSchedule(due.id))) continue
172
+ const cultures = due.culture ? [due.culture] : null
173
+ const result =
174
+ due.action === 'Release'
175
+ ? await elements.publish(due.key, cultures)
176
+ : await elements.unpublish(due.key, cultures)
177
+ if (result.ok) (due.action === 'Release' ? run.published : run.unpublished).push(due.key)
178
+ else run.failed.push({ key: due.key, reason: result.reason })
179
+ }
158
180
  await options.approvals?.sweepScheduled(now.getTime())
159
181
  // The operations recorded, announced and refreshed what they did themselves.
160
182
  return run
package/src/remote.ts CHANGED
@@ -83,7 +83,8 @@ export interface RemoteOptions {
83
83
  * Told once a push has landed, so this node's published cache is rebuilt: the
84
84
  * import's cache instruction carries this node's id, and a node skips its own.
85
85
  */
86
- onApplied?(): void
86
+ /** After a push, an apply or a revert: awaited, so the answer comes after what it changed renders. */
87
+ onApplied?(): void | Promise<void>
87
88
  /** A new server from the supervising `crombolo start`, once it is healthy (story 241). */
88
89
  restart?: () => Promise<RestartOutcome>
89
90
  /** Installed bundles (story 241); absent where this node does not manage them. */
@@ -523,7 +524,7 @@ export function createRemote(options: RemoteOptions): Remote {
523
524
  })
524
525
  return
525
526
  }
526
- options.onApplied?.()
527
+ await options.onApplied?.()
527
528
  await jobs.update(job.id, {
528
529
  state: 'done',
529
530
  stage:
@@ -790,7 +791,7 @@ export function createRemote(options: RemoteOptions): Remote {
790
791
  'RemoteBundleApplied',
791
792
  `${result.bundle.id} as run ${result.runId}${structural ? ', with structure' : ''}; ${describeProvenance(provenance)}`,
792
793
  )
793
- options.onApplied?.()
794
+ await options.onApplied?.()
794
795
  }
795
796
  return Response.json(
796
797
  {
@@ -996,7 +997,7 @@ export function createRemote(options: RemoteOptions): Remote {
996
997
  })
997
998
  const files = await revertSections(db, config, runId)
998
999
  await audit(principal, request, 'RemoteBundleReverted', `${runId} as run ${result.runId}`)
999
- options.onApplied?.()
1000
+ await options.onApplied?.()
1000
1001
  return Response.json({
1001
1002
  runId: result.runId,
1002
1003
  reverted: runId,
package/src/server.ts CHANGED
@@ -97,7 +97,7 @@ import {
97
97
  readLedger,
98
98
  readReport,
99
99
  readUrlOptions,
100
- SiteSearch,
100
+ searchProvidersOf,
101
101
  TransferRunRepository,
102
102
  type WritesPaused,
103
103
  } from '@crombolo/data'
@@ -819,9 +819,19 @@ export async function createServer(
819
819
  authenticate,
820
820
  bundles: bundleAdmin,
821
821
  restart: serverOptions.restart,
822
- onApplied: () => {
822
+ onApplied: async () => {
823
823
  cache.invalidate()
824
824
  mediaCache.clear()
825
+ // A push or an apply may have replaced views: a new snapshot here, as an
826
+ // edit in the back office takes one, and every other node told.
827
+ const hash = await snapshots.refresh()
828
+ await appendCacheInstruction(db, {
829
+ kind: 'components',
830
+ payload: hash ? { hash } : {},
831
+ by: schema.nodeId,
832
+ }).catch((error: unknown) => {
833
+ renderLog.error('Could not announce the views a push changed: {error}', { error })
834
+ })
825
835
  },
826
836
  })
827
837
  const members = createMemberAuth(db, config, {
@@ -1109,7 +1119,7 @@ export async function createServer(
1109
1119
  mediaRules: () => new MediaAccessRepository(db).allRules(),
1110
1120
  media: createDeliveryMediaPort(db, mediaCache),
1111
1121
  security: (request, action) => deliveryMembers.handle(request, action),
1112
- search: (term, options) => new SiteSearch(db).query(term, options),
1122
+ search: (term, options) => searchProvidersOf(db).site.query(term, options),
1113
1123
  })
1114
1124
  for (const problem of deliveryApi?.problems ?? [])
1115
1125
  log.warning('Delivery API: {problem}', { problem })
@@ -4,7 +4,7 @@
4
4
  * so a page unpublished since it was indexed is never shown. docs/search.md.
5
5
  */
6
6
  import { branchAccess } from '@crombolo/core'
7
- import { type Db, PublicAccessRepository, SiteSearch } from '@crombolo/data'
7
+ import { type Db, PublicAccessRepository, searchProvidersOf } from '@crombolo/data'
8
8
  import {
9
9
  excerpt,
10
10
  type PublishedCache,
@@ -26,7 +26,7 @@ export function siteSearchFor(
26
26
  member ? { username: member.username, groups: member.roles } : undefined,
27
27
  )
28
28
  const culture = options.culture ?? (await cache.defaultCulture())
29
- const hits = await new SiteSearch(db).query(query, {
29
+ const hits = await searchProvidersOf(db).site.query(query, {
30
30
  culture: culture ?? '',
31
31
  types: options.types,
32
32
  skip: options.skip,
@@ -10,7 +10,8 @@
10
10
  * Checked at boot because the alternative is every render failing with a message
11
11
  * that names the runtime rather than the configuration that moved it.
12
12
  */
13
- import { mkdirSync } from 'node:fs'
13
+ import { existsSync, mkdirSync } from 'node:fs'
14
+ import { dirname, join, resolve } from 'node:path'
14
15
 
15
16
  export const JSX_RUNTIME = '@crombolo/crombolo/jsx-runtime'
16
17
 
@@ -28,9 +29,20 @@ export class ViewRuntimeUnreachableError extends Error {
28
29
  }
29
30
  }
30
31
 
32
+ /** Whether `dir` or a folder above it holds a node_modules. */
33
+ function insideNodeModules(dir: string): boolean {
34
+ for (let at = resolve(dir); ; at = dirname(at)) {
35
+ if (existsSync(join(at, 'node_modules'))) return true
36
+ if (dirname(at) === at) return false
37
+ }
38
+ }
39
+
31
40
  /** Throws unless a `.tsx` placed in `dir` could resolve the JSX runtime. */
32
41
  export function assertViewRuntime(dir: string): void {
33
42
  mkdirSync(dir, { recursive: true })
43
+ // With no node_modules at or above it, Bun installs a package it cannot find,
44
+ // and the resolve blocks on the registry: `crombolo status` is read-only.
45
+ if (!insideNodeModules(dir)) throw new ViewRuntimeUnreachableError(dir, 'no node_modules there')
34
46
  try {
35
47
  Bun.resolveSync(JSX_RUNTIME, dir)
36
48
  } catch (error) {