@famgia/omnify-typescript 2.0.9 → 2.0.11
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/dist/{chunk-VLDDJNHY.js → chunk-32JWBWZY.js} +4 -4
- package/dist/chunk-32JWBWZY.js.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +5 -3
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +3 -1
- package/dist/plugin.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-VLDDJNHY.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/plugin.cjs
CHANGED
|
@@ -1014,7 +1014,7 @@ import type { LocaleMap, ValidationRule } from '../common${ext}';
|
|
|
1014
1014
|
function generateRulesFiles(schemas, options = {}) {
|
|
1015
1015
|
const files = [];
|
|
1016
1016
|
const localeConfig = options.localeConfig;
|
|
1017
|
-
const locales = [...localeConfig?.locales ?? ["en"]];
|
|
1017
|
+
const locales = [...localeConfig?.locales ?? ["ja", "en"]];
|
|
1018
1018
|
const fallbackLocale = localeConfig?.fallbackLocale ?? "en";
|
|
1019
1019
|
const templates = mergeValidationTemplates(options.validationTemplates);
|
|
1020
1020
|
for (const schema of Object.values(schemas)) {
|
|
@@ -1273,7 +1273,7 @@ function getZodSchemaForType(propDef, fieldName, customTypes) {
|
|
|
1273
1273
|
function generateCompoundTypeSchemas(propName, propDef, customType, options) {
|
|
1274
1274
|
const schemas = [];
|
|
1275
1275
|
const propFields = propDef.fields;
|
|
1276
|
-
const locales = options.localeConfig?.locales ?? ["en"];
|
|
1276
|
+
const locales = options.localeConfig?.locales ?? ["ja", "en"];
|
|
1277
1277
|
const fallbackLocale = options.localeConfig?.fallbackLocale ?? "en";
|
|
1278
1278
|
if (!customType.expand) return schemas;
|
|
1279
1279
|
for (const field of customType.expand) {
|
|
@@ -1353,7 +1353,7 @@ function generateZodSchemas(schema, options) {
|
|
|
1353
1353
|
return schemas;
|
|
1354
1354
|
}
|
|
1355
1355
|
function generateDisplayNames(schema, options) {
|
|
1356
|
-
const locales = options.localeConfig?.locales ?? ["en"];
|
|
1356
|
+
const locales = options.localeConfig?.locales ?? ["ja", "en"];
|
|
1357
1357
|
const fallbackLocale = options.localeConfig?.fallbackLocale ?? "en";
|
|
1358
1358
|
const customTypes = options.customTypes;
|
|
1359
1359
|
const displayName = getMultiLocaleDisplayName2(
|
|
@@ -2420,9 +2420,11 @@ function typescriptPlugin(options) {
|
|
|
2420
2420
|
description: "Generate TypeScript model definitions",
|
|
2421
2421
|
generate: async (ctx) => {
|
|
2422
2422
|
const omnifyBaseDir = "node_modules/@omnify-base";
|
|
2423
|
+
const isMultiLocale = ctx.localeConfig?.locales && ctx.localeConfig.locales.length > 1;
|
|
2423
2424
|
const files = generateTypeScript(ctx.schemas, {
|
|
2424
2425
|
generateZodSchemas: resolved.generateZodSchemas,
|
|
2425
2426
|
localeConfig: ctx.localeConfig,
|
|
2427
|
+
multiLocale: isMultiLocale,
|
|
2426
2428
|
customTypes: ctx.customTypes,
|
|
2427
2429
|
pluginEnums: ctx.pluginEnums,
|
|
2428
2430
|
// All generated files (enums, base) go to @omnify-base - they shouldn't be edited
|