@vocab/core 1.2.4 → 1.2.5
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.
|
@@ -510,6 +510,9 @@ function serialiseObjectToType(v) {
|
|
|
510
510
|
}
|
|
511
511
|
const banner = `// This file is automatically generated by Vocab.\n// To make changes update translation.json files directly.`;
|
|
512
512
|
const serializeModuleImports = (imports, moduleName) => {
|
|
513
|
+
if (imports.size === 0) {
|
|
514
|
+
return '';
|
|
515
|
+
}
|
|
513
516
|
const importNames = Array.from(imports);
|
|
514
517
|
return `import { ${Array.from(importNames).join(', ')} } from '${moduleName}'`;
|
|
515
518
|
};
|
|
@@ -533,8 +536,8 @@ function serialiseTranslationRuntime(value, imports, loadedTranslation) {
|
|
|
533
536
|
const languagesUnionAsString = Object.keys(loadedTranslation.languages).map(l => `'${l}'`).join(' | ');
|
|
534
537
|
return `${banner}
|
|
535
538
|
|
|
536
|
-
${serializeModuleImports(imports, '@vocab/types')}
|
|
537
539
|
import { createLanguage, createTranslationFile } from '@vocab/core/runtime';
|
|
540
|
+
${serializeModuleImports(imports, '@vocab/types')}
|
|
538
541
|
|
|
539
542
|
const translations = createTranslationFile<${languagesUnionAsString}, ${serialiseObjectToType(translationsType)}>({${content}});
|
|
540
543
|
|
|
@@ -510,6 +510,9 @@ function serialiseObjectToType(v) {
|
|
|
510
510
|
}
|
|
511
511
|
const banner = `// This file is automatically generated by Vocab.\n// To make changes update translation.json files directly.`;
|
|
512
512
|
const serializeModuleImports = (imports, moduleName) => {
|
|
513
|
+
if (imports.size === 0) {
|
|
514
|
+
return '';
|
|
515
|
+
}
|
|
513
516
|
const importNames = Array.from(imports);
|
|
514
517
|
return `import { ${Array.from(importNames).join(', ')} } from '${moduleName}'`;
|
|
515
518
|
};
|
|
@@ -533,8 +536,8 @@ function serialiseTranslationRuntime(value, imports, loadedTranslation) {
|
|
|
533
536
|
const languagesUnionAsString = Object.keys(loadedTranslation.languages).map(l => `'${l}'`).join(' | ');
|
|
534
537
|
return `${banner}
|
|
535
538
|
|
|
536
|
-
${serializeModuleImports(imports, '@vocab/types')}
|
|
537
539
|
import { createLanguage, createTranslationFile } from '@vocab/core/runtime';
|
|
540
|
+
${serializeModuleImports(imports, '@vocab/types')}
|
|
538
541
|
|
|
539
542
|
const translations = createTranslationFile<${languagesUnionAsString}, ${serialiseObjectToType(translationsType)}>({${content}});
|
|
540
543
|
|
package/dist/vocab-core.esm.js
CHANGED
|
@@ -494,6 +494,9 @@ function serialiseObjectToType(v) {
|
|
|
494
494
|
}
|
|
495
495
|
const banner = `// This file is automatically generated by Vocab.\n// To make changes update translation.json files directly.`;
|
|
496
496
|
const serializeModuleImports = (imports, moduleName) => {
|
|
497
|
+
if (imports.size === 0) {
|
|
498
|
+
return '';
|
|
499
|
+
}
|
|
497
500
|
const importNames = Array.from(imports);
|
|
498
501
|
return `import { ${Array.from(importNames).join(', ')} } from '${moduleName}'`;
|
|
499
502
|
};
|
|
@@ -517,8 +520,8 @@ function serialiseTranslationRuntime(value, imports, loadedTranslation) {
|
|
|
517
520
|
const languagesUnionAsString = Object.keys(loadedTranslation.languages).map(l => `'${l}'`).join(' | ');
|
|
518
521
|
return `${banner}
|
|
519
522
|
|
|
520
|
-
${serializeModuleImports(imports, '@vocab/types')}
|
|
521
523
|
import { createLanguage, createTranslationFile } from '@vocab/core/runtime';
|
|
524
|
+
${serializeModuleImports(imports, '@vocab/types')}
|
|
522
525
|
|
|
523
526
|
const translations = createTranslationFile<${languagesUnionAsString}, ${serialiseObjectToType(translationsType)}>({${content}});
|
|
524
527
|
|