jax-hono 1.0.12 → 1.0.13
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.
|
@@ -334,7 +334,7 @@ function generateModelsRegistry() {
|
|
|
334
334
|
|
|
335
335
|
files.forEach((filePath) => {
|
|
336
336
|
const source = readFileSync(filePath, 'utf8')
|
|
337
|
-
const exportedModels = [...source.matchAll(/\bexport\s+const\s+([a-zA-Z_$][a-zA-Z0-9_$]*
|
|
337
|
+
const exportedModels = [...source.matchAll(/\bexport\s+const\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=\s*create(?:Loose)?Model\s*\(/g)]
|
|
338
338
|
.map((match) => match[1])
|
|
339
339
|
.sort((left, right) => left.localeCompare(right))
|
|
340
340
|
|
|
@@ -343,12 +343,19 @@ function generateModelsRegistry() {
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
const modelKey = source.match(/\bexport\s+const\s+modelKey\s*=\s*['"]([a-zA-Z_$][a-zA-Z0-9_$]*)['"]/)?.[1]
|
|
346
|
+
const fileModelName = toPascalCase(toModulePath(
|
|
347
|
+
filePath.includes(`${srcDir}/modules/`) ? 'modules' : basename(parse(filePath).dir),
|
|
348
|
+
filePath,
|
|
349
|
+
['.model'],
|
|
350
|
+
))
|
|
346
351
|
|
|
347
352
|
imports.push(`import { ${exportedModels.join(', ')} } from '${toImportPath(filePath)}'`)
|
|
348
353
|
entries.push(...exportedModels.map((name) => {
|
|
349
354
|
const key = exportedModels.length === 1 && modelKey
|
|
350
355
|
? modelKey
|
|
351
|
-
: name
|
|
356
|
+
: name === `${fileModelName}Model`
|
|
357
|
+
? fileModelName
|
|
358
|
+
: name
|
|
352
359
|
|
|
353
360
|
return ` ${key}: ${name},`
|
|
354
361
|
}))
|