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

Function withSettingsFile

ark/aot/settings.ts:125–159  ·  view source on GitHub ↗
(
	opts: opts | undefined
)

Source from the content-addressed store, hash-verified

123
124// what the call sets over what ark.json does, before any preset
125export const withSettingsFile = <opts extends PrecompilePluginOptions>(
126 opts: opts | undefined
127): opts => {
128 const set = definedOf(opts ?? ({} as opts))
129 validate(validators.PrecompileOptions as never, set)
130 const cwd = set.cwd ?? process.cwd()
131 const path = settingsFileOf(cwd)
132 const file = path ? readSettingsFile(path) : {}
133 const members = file.members && { ...file.members, ...set.members }
134 const dependencies = file.dependencies && {
135 ...file.dependencies,
136 ...set.dependencies
137 }
138 const strategies = file.strategies && {
139 ...file.strategies,
140 ...set.strategies
141 }
142 // a key names its module from cwd, so one a call sets again is one key
143 const realCwd = realPathOf(cwd)
144 const schemas = (file.schemas || set.schemas) && {
145 ...(file.schemas &&
146 normalizedSchemas(file.schemas, dirname(path!), realCwd)),
147 ...(set.schemas && normalizedSchemas(set.schemas, undefined, realCwd))
148 }
149 const result = {
150 ...file,
151 ...set,
152 ...(members && { members }),
153 ...(dependencies && { dependencies }),
154 ...(strategies && { strategies }),
155 ...(schemas && { schemas })
156 }
157 checkDependencies(result.dependencies, cwd)
158 return result
159}
160
161// a package the program can't import would never be read
162const checkDependencies = (

Callers 15

checkFunction · 0.90
turbopack.tsFile · 0.90
createTrackedPrecompilerFunction · 0.90
keptAcrossFunction · 0.90
checkFunction · 0.90
unplugin.tsFile · 0.90
applySettingsFunction · 0.90
checkSettingsFunction · 0.90
registerFunction · 0.90
precompileFunction · 0.90
readProjectWithFunction · 0.90
declareFunction · 0.90

Calls 7

definedOfFunction · 0.90
realPathOfFunction · 0.90
normalizedSchemasFunction · 0.90
settingsFileOfFunction · 0.85
readSettingsFileFunction · 0.85
checkDependenciesFunction · 0.85
validateFunction · 0.70

Tested by 1

readFunction · 0.72