MCPcopy Create free account
hub / github.com/effect-app/libs / syncModelSource

Function syncModelSource

packages/eslint-codegen-model/src/cli.ts:383–403  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

381}
382
383function syncModelSource(source: string): string {
384 // Sync each model's Opaque ctor to the block mode (make → OpaqueShape, type → OpaqueType,
385 // else plain Opaque). Done outside codegen blocks, on the class declarations. Only for files
386 // that actually contain a model codegen block, so manual OpaqueType/Shape usage is untouched.
387 if (modelBlockRe.test(source)) {
388 const facade = facadeModelBlockRe.test(source)
389 const mode: CtorMode = staticMakeModelBlockRe.test(source)
390 ? "make"
391 : staticTypeModelBlockRe.test(source)
392 ? "type"
393 : "plain"
394 const modelNames = getExportedModelNames(source)
395 if (facade) {
396 // Only rewrite Opaque-struct models into facades; leave Class-based models
397 // as-is so a mixed file still converts the facade-able ones.
398 return syncFacade(source, getFacadeableModelNames(source), true)
399 }
400 return syncCtor(syncFacade(source, modelNames, false), modelNames, mode)
401 }
402 return source
403}
404
405function updateFile(
406 filePath: string,

Callers 2

updateFileFunction · 0.85
runFunction · 0.85

Calls 4

getExportedModelNamesFunction · 0.90
getFacadeableModelNamesFunction · 0.90
syncFacadeFunction · 0.85
syncCtorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…