MCPcopy Create free account
hub / github.com/arktypeio/arktype / checkSettings

Function checkSettings

ark/aot/unplugin.ts:356–401  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

354 // with the bundler's options read under them
355 let changedSettings: string | undefined
356 const checkSettings = () => {
357 const cwd = settingsRead?.cwd ?? process.cwd()
358 let read: PrecompileUnpluginOptions
359 let fixed: string
360 try {
361 read = withSettingsFile(settingsRead)
362 if (JSON.stringify(read) === JSON.stringify(set))
363 return void (changedSettings = undefined)
364 const resolved = resolvePrecompileOptions(read)
365 // what Vite's config read of them
366 fixed = JSON.stringify([
367 inlinedOf(
368 resolved,
369 optedInPackagesOf(
370 resolved.cwd ?? process.cwd(),
371 resolved.dependencies
372 )
373 ),
374 resolved.allowUnsafe
375 ])
376 } catch (e) {
377 return void (changedSettings = (e as Error).message)
378 }
379 const redoes =
380 meta.framework === "rollup" ||
381 (meta.framework === "vite" &&
382 (isServing ?
383 !!server && !environment?.testing
384 : fixed === JSON.stringify([inlined, opts?.allowUnsafe])))
385 if (!redoes) {
386 changedSettings = writeWatchedSettingsMessage(
387 printablePathOf(
388 realCwd(),
389 settingsFileOf(cwd) ?? join(realCwd(), settingsFile)
390 ),
391 meta.framework
392 )
393 return
394 }
395 changedSettings = undefined
396 applySettings(settingsRead)
397 // a shared module's text may change with them where its name doesn't
398 for (const id in modules) delete modules[id]
399 if (isServing) void server!.restart()
400 else rewritesCached = true
401 }
402 const modules: Record<string, string> = {}
403 const importersById: Record<string, string> = {}
404 // Rollup and Rolldown resolve what these import relatively through it, as

Callers 1

resetFunction · 0.85

Calls 10

withSettingsFileFunction · 0.90
resolvePrecompileOptionsFunction · 0.90
optedInPackagesOfFunction · 0.90
printablePathOfFunction · 0.90
settingsFileOfFunction · 0.90
inlinedOfFunction · 0.85
realCwdFunction · 0.85
joinFunction · 0.85
applySettingsFunction · 0.85

Tested by

no test coverage detected