@o3r/localization 9.3.0-alpha.57 → 9.3.0-alpha.59

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.
@@ -1 +1 @@
1
- {"version":3,"file":"localization.generator.d.ts","sourceRoot":"","sources":["../../../builders/helpers/localization.generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAShF,4DAA4D;AAC5D,MAAM,WAAW,yBAAyB;IACxC,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;CACjC;AAED,6BAA6B;AAC7B,MAAM,WAAW,qBAAqB;IACpC,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iDAAiD;IACjD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,kCAAkC;AAClC,MAAM,WAAW,oBAAoB;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAC;CACtC;AAED,gCAAgC;AAChC,MAAM,WAAW,mBAAmB;IAClC,CAAC,IAAI,EAAE,MAAM,GAAG;QACd,IAAI,EAAE,oBAAoB,CAAC;QAC3B,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AAED,4BAA4B;AAC5B,MAAM,WAAW,kBAAkB;IACjC,CAAC,mBAAmB,EAAE,MAAM,GAAG,oBAAoB,CAAC;CACrD;AAED;;GAEG;AACH,qBAAa,qBAAqB;IAEhC,sCAAsC;IACtC,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,MAAM,CAAoB;gBAEtB,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,SAAS;IAK3D,8CAA8C;IAC9C,OAAO,CAAC,oBAAoB;IAK5B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IA4B3B;;;;;OAKG;IACH,OAAO,CAAC,qCAAqC;IAyB7C;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IA0B1B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;;OAKG;IACH,OAAO,CAAC,oCAAoC;IA4B5C;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAYnB,kDAAkD;IAC3C,uBAAuB;;;;;IAc9B;;;;;;OAMG;IACU,kBAAkB,CAAC,iBAAiB,EAAE,MAAM,EAAE,EAAE,kBAAkB,GAAE,MAAM,EAAO,EAAE,YAAY,UAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA2BnJ;;;;OAIG;IACU,+BAA+B,CAAC,sBAAsB,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA8BjH;;;;OAIG;IACU,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE;IAQzD;;;;OAIG;IACU,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE;IASzD;;;;;;;;;OASG;IACI,gBAAgB,CAAC,eAAe,EAAE,mBAAmB,EAAE,OAAO,EAAE;QACrE,mBAAmB,EAAE,OAAO,CAAC;QAC7B,eAAe,EAAE,kBAAkB,CAAC;QACpC,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,OAAO,CAAC;KACnB,GAAG,oBAAoB;CAkCzB"}
1
+ {"version":3,"file":"localization.generator.d.ts","sourceRoot":"","sources":["../../../builders/helpers/localization.generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,EAAE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AC,oBAAoB;IAI5B;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;;OAKG;IACH,OAAO,CAAC,oCAAoC;IA4B5C;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAYnB,kDAAkD;IAC3C,uBAAuB;;;;;IAc9B;;;;;;OAMG;IACU,kBAAkB,CAAC,iBAAiB,EAAE,MAAM,EAAE,EAAE,kBAAkB,GAAE,MAAM,EAAO,EAAE,YAAY,UAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA2BnJ;;;;OAIG;IACU,+BAA+B,CAAC,sBAAsB,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA8BjH;;;;OAIG;IACU,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE;IAQzD;;;;OAIG;IACU,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE;IASzD;;;;;;;;;OASG;IACI,gBAAgB,CAAC,eAAe,EAAE,mBAAmB,EAAE,OAAO,EAAE;QACrE,mBAAmB,EAAE,OAAO,CAAC;QAC7B,eAAe,EAAE,kBAAkB,CAAC;QACpC,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,OAAO,CAAC;KACnB,GAAG,oBAAoB;CAkCzB"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LocalizationExtractor = void 0;
4
4
  const extractors_1 = require("@o3r/extractors");
5
+ const schematics_1 = require("@o3r/schematics");
5
6
  const fs = require("node:fs");
6
7
  const glob = require("globby");
7
8
  const path = require("node:path");
@@ -147,7 +148,7 @@ class LocalizationExtractor {
147
148
  }
148
149
  if (typeof loc.defaultValue === 'undefined' && typeof loc.$ref === 'undefined' && !loc.dictionary) {
149
150
  this.logger.error(`${key} has no default value or $ref defined`);
150
- throw new Error(`${key} has no default value or $ref defined`);
151
+ throw new schematics_1.O3rCliError(`${key} has no default value or $ref defined`);
151
152
  }
152
153
  return res;
153
154
  }
@@ -173,7 +174,7 @@ class LocalizationExtractor {
173
174
  const tsconfigResult = ts.readConfigFile(this.tsconfigPath, ts.sys.readFile);
174
175
  if (tsconfigResult.error) {
175
176
  this.logger.error(tsconfigResult.error.messageText.toString());
176
- throw new Error(tsconfigResult.error.messageText.toString());
177
+ throw new schematics_1.O3rCliError(tsconfigResult.error.messageText.toString());
177
178
  }
178
179
  const include = [...(tsconfigResult.config.files || []), ...(tsconfigResult.config.include || [])];
179
180
  const exclude = tsconfigResult.config.exclude || [];
@@ -282,7 +283,7 @@ class LocalizationExtractor {
282
283
  }
283
284
  else {
284
285
  this.logger.error(`The key ${data.key} from ${origin} try to override the previous value (${metadata[data.key].value || 'ref ' + metadata[data.key].ref} -> ${data.value || 'ref ' + data.ref})`);
285
- throw new Error('Duplicate key');
286
+ throw new schematics_1.O3rCliError('Duplicate key');
286
287
  }
287
288
  }
288
289
  metadata[data.key] = data;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../builders/localization/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAgFrD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG;IAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,CAGvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAC1C,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC9C,cAAc,GAAE,GAAG,CAAC,MAAM,CAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA8BjE;;AAgLD,wBA0MG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../builders/localization/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAgFrD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG;IAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,CAGvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAC1C,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC9C,cAAc,GAAE,GAAG,CAAC,MAAM,CAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA8BjE;;AAgLD,wBA0MG"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTranslationsForLanguage = exports.loadTranslations = void 0;
4
4
  const architect_1 = require("@angular-devkit/architect");
5
+ const schematics_1 = require("@o3r/schematics");
5
6
  const fs = require("node:fs");
6
7
  const globby_1 = require("globby");
7
8
  const path = require("node:path");
@@ -54,7 +55,7 @@ function checkUnusedTranslation(language, defaultBundle, customTranslations, con
54
55
  .filter((key) => !dictionaryKeysPatterns.some((dictionaryKeyPattern) => key.startsWith(dictionaryKeyPattern)));
55
56
  missingMetadata.forEach((key) => context.logger[failIfMissingMetadata ? 'error' : 'warn'](`The key "${key}" from "${language}" is not part of the MetaData`));
56
57
  if (missingMetadata.length && failIfMissingMetadata) {
57
- throw new Error(`There is missing metadata for ${language}`);
58
+ throw new schematics_1.O3rCliError(`There is missing metadata for ${language}`);
58
59
  }
59
60
  }
60
61
  /**
@@ -98,7 +99,7 @@ function getTranslationsForLanguage(language, filesPerLanguage, defaultLanguageM
98
99
  if (defaultLanguage) {
99
100
  // Throw an error if we find a circular dependency
100
101
  if (dependencyPath.has(defaultLanguage)) {
101
- throw new Error(`Circular dependency found: ${[...Array.from(dependencyPath), defaultLanguage].join('->')}`);
102
+ throw new schematics_1.O3rCliError(`Circular dependency found: ${[...Array.from(dependencyPath), defaultLanguage].join('->')}`);
102
103
  }
103
104
  else {
104
105
  // Else, recursively resolve its bundle and use it as a base for the current language
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../builders/localization-extractor/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kCAAkC,EAAE,MAAM,UAAU,CAAC;AAI9D,cAAc,UAAU,CAAC;;AAEzB,wBA4LG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../builders/localization-extractor/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kCAAkC,EAAE,MAAM,UAAU,CAAC;AAI9D,cAAc,UAAU,CAAC;;AAEzB,wBA4LG"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const architect_1 = require("@angular-devkit/architect");
5
+ const schematics_1 = require("@o3r/schematics");
5
6
  const chokidar = require("chokidar");
6
7
  const fs = require("node:fs");
7
8
  const globby_1 = require("globby");
@@ -61,7 +62,7 @@ exports.default = (0, architect_1.createBuilder)(async (options, context) => {
61
62
  .filter((metadataItem) => !!metadataItem.value &&
62
63
  validations_1.validators.reduce((isInvalid, validator) => isInvalid || !validator(metadataItem.value), false));
63
64
  if (translationsWithIssue.length) {
64
- throw new Error(`The following translations are invalid: ${translationsWithIssue.map((translation) => translation.key).join(', ')}`);
65
+ throw new schematics_1.O3rCliError(`The following translations are invalid: ${translationsWithIssue.map((translation) => translation.key).join(', ')}`);
65
66
  }
66
67
  context.reportProgress(STEP_NUMBER, STEP_NUMBER, 'Generating metadata');
67
68
  // Create output folder if does not exist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/localization",
3
- "version": "9.3.0-alpha.57",
3
+ "version": "9.3.0-alpha.59",
4
4
  "description": "This module provides a runtime dynamic language/translation support and debug tools.",
5
5
  "keywords": [
6
6
  "localization",
@@ -20,11 +20,11 @@
20
20
  "@formatjs/intl-numberformat": "^8.0.2",
21
21
  "@ngrx/store": "~16.2.0",
22
22
  "@ngx-translate/core": "~15.0.0",
23
- "@o3r/core": "^9.3.0-alpha.57",
24
- "@o3r/dynamic-content": "^9.3.0-alpha.57",
25
- "@o3r/extractors": "^9.3.0-alpha.57",
26
- "@o3r/logger": "^9.3.0-alpha.57",
27
- "@o3r/schematics": "^9.3.0-alpha.57",
23
+ "@o3r/core": "^9.3.0-alpha.59",
24
+ "@o3r/dynamic-content": "^9.3.0-alpha.59",
25
+ "@o3r/extractors": "^9.3.0-alpha.59",
26
+ "@o3r/logger": "^9.3.0-alpha.59",
27
+ "@o3r/schematics": "^9.3.0-alpha.59",
28
28
  "@schematics/angular": "~16.2.0",
29
29
  "chokidar": "^3.5.2",
30
30
  "intl-messageformat": "~10.5.0",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/add-localization-key/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EAIL,MAAM,4BAA4B,CAAC;AAYpC,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,UAAU,CAAC;AA8FrE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,oCAAoC,GAAG,IAAI,CAyJxF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/add-localization-key/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EAIL,MAAM,4BAA4B,CAAC;AAapC,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,UAAU,CAAC;AA8FrE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,oCAAoC,GAAG,IAAI,CAyJxF"}
@@ -58,7 +58,7 @@ const getLocalizationInformation = (componentPath, tree) => {
58
58
  }
59
59
  }
60
60
  if (!defaultTranslationVariableName) {
61
- throw new Error(`Unable to find initialization of ${translationsVariableName} in ${componentPath}.`);
61
+ throw new schematics_2.O3rCliError(`Unable to find initialization of ${translationsVariableName} in ${componentPath}.`);
62
62
  }
63
63
  const importDeclaration = componentSourceFile.statements.find((statement) => ts.isImportDeclaration(statement)
64
64
  && ts.isStringLiteral(statement.moduleSpecifier)
@@ -67,7 +67,7 @@ const getLocalizationInformation = (componentPath, tree) => {
67
67
  && ts.isNamedImports(statement.importClause.namedBindings)
68
68
  && !!statement.importClause.namedBindings.elements.find((element) => ts.isIdentifier(element.name) && element.name.escapedText.toString() === defaultTranslationVariableName));
69
69
  if (!importDeclaration) {
70
- throw new Error(`Unable to find import declaration of ${defaultTranslationVariableName} in ${componentPath}`);
70
+ throw new schematics_2.O3rCliError(`Unable to find import declaration of ${defaultTranslationVariableName} in ${componentPath}`);
71
71
  }
72
72
  const translationsPath = node_path_1.posix.join((0, node_path_1.dirname)(componentPath), `${importDeclaration.moduleSpecifier.text}.ts`);
73
73
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/localization-to-component/index.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,IAAI,EAML,MAAM,4BAA4B,CAAC;AAoBpC,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAkClE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iCAAiC,GAAG,IAAI,CA6SlF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/localization-to-component/index.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,IAAI,EAML,MAAM,4BAA4B,CAAC;AAqBpC,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAkClE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iCAAiC,GAAG,IAAI,CA6SlF"}
@@ -16,7 +16,7 @@ const checkLocalization = (componentPath, tree, baseFileName) => {
16
16
  node_path_1.posix.join((0, node_path_1.dirname)(componentPath), `${baseFileName}.translation.ts`)
17
17
  ];
18
18
  if (files.some((file) => tree.exists(file))) {
19
- throw new Error(`Unable to add localization to this component because it already has at least one of these files: ${files.join(', ')}.`);
19
+ throw new schematics_2.O3rCliError(`Unable to add localization to this component because it already has at least one of these files: ${files.join(', ')}.`);
20
20
  }
21
21
  const componentSourceFile = ts.createSourceFile(componentPath, tree.readText(componentPath), ts.ScriptTarget.ES2020, true);
22
22
  const o3rClassDeclaration = componentSourceFile.statements.find((statement) => ts.isClassDeclaration(statement)
@@ -24,7 +24,7 @@ const checkLocalization = (componentPath, tree, baseFileName) => {
24
24
  if (o3rClassDeclaration.members.find((classElement) => ts.isPropertyDeclaration(classElement)
25
25
  && ts.isIdentifier(classElement.name)
26
26
  && localizationProperties.includes(classElement.name.escapedText.toString()))) {
27
- throw new Error(`Unable to add localization to this component because it already has at least one of these properties: ${localizationProperties.join(', ')}.`);
27
+ throw new schematics_2.O3rCliError(`Unable to add localization to this component because it already has at least one of these properties: ${localizationProperties.join(', ')}.`);
28
28
  }
29
29
  };
30
30
  /**