@jsverse/transloco-schematics 8.0.0

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.
Files changed (80) hide show
  1. package/package.json +34 -0
  2. package/schematics-core/index.d.ts +9 -0
  3. package/schematics-core/index.js +36 -0
  4. package/schematics-core/index.js.map +1 -0
  5. package/schematics-core/utils/collections.d.ts +3 -0
  6. package/schematics-core/utils/collections.js +11 -0
  7. package/schematics-core/utils/collections.js.map +1 -0
  8. package/schematics-core/utils/file.d.ts +6 -0
  9. package/schematics-core/utils/file.js +21 -0
  10. package/schematics-core/utils/file.js.map +1 -0
  11. package/schematics-core/utils/find-module.d.ts +23 -0
  12. package/schematics-core/utils/find-module.js +112 -0
  13. package/schematics-core/utils/find-module.js.map +1 -0
  14. package/schematics-core/utils/package.d.ts +2 -0
  15. package/schematics-core/utils/package.js +15 -0
  16. package/schematics-core/utils/package.js.map +1 -0
  17. package/schematics-core/utils/schematic.d.ts +6 -0
  18. package/schematics-core/utils/schematic.js +17 -0
  19. package/schematics-core/utils/schematic.js.map +1 -0
  20. package/schematics-core/utils/translation.d.ts +20 -0
  21. package/schematics-core/utils/translation.js +83 -0
  22. package/schematics-core/utils/translation.js.map +1 -0
  23. package/schematics-core/utils/transloco.d.ts +5 -0
  24. package/schematics-core/utils/transloco.js +31 -0
  25. package/schematics-core/utils/transloco.js.map +1 -0
  26. package/schematics-core/utils/workspace.d.ts +6 -0
  27. package/schematics-core/utils/workspace.js +43 -0
  28. package/schematics-core/utils/workspace.js.map +1 -0
  29. package/src/collection.json +41 -0
  30. package/src/join/index.d.ts +3 -0
  31. package/src/join/index.js +66 -0
  32. package/src/join/index.js.map +1 -0
  33. package/src/join/schema.d.ts +23 -0
  34. package/src/join/schema.js +3 -0
  35. package/src/join/schema.js.map +1 -0
  36. package/src/join/schema.json +36 -0
  37. package/src/keys-manager/index.d.ts +5 -0
  38. package/src/keys-manager/index.js +93 -0
  39. package/src/keys-manager/index.js.map +1 -0
  40. package/src/keys-manager/schema.d.ts +19 -0
  41. package/src/keys-manager/schema.js +3 -0
  42. package/src/keys-manager/schema.js.map +1 -0
  43. package/src/keys-manager/schema.json +33 -0
  44. package/src/ng-migrate/index.d.ts +3 -0
  45. package/src/ng-migrate/index.js +14 -0
  46. package/src/ng-migrate/index.js.map +1 -0
  47. package/src/ng-migrate/ng-migrate.d.ts +5 -0
  48. package/src/ng-migrate/ng-migrate.js +105 -0
  49. package/src/ng-migrate/ng-migrate.js.map +1 -0
  50. package/src/ng-migrate/schema.d.ts +14 -0
  51. package/src/ng-migrate/schema.js +3 -0
  52. package/src/ng-migrate/schema.js.map +1 -0
  53. package/src/ng-migrate/schema.json +27 -0
  54. package/src/ngx-migrate/index.d.ts +4 -0
  55. package/src/ngx-migrate/index.js +78 -0
  56. package/src/ngx-migrate/index.js.map +1 -0
  57. package/src/ngx-migrate/migration-matchers.d.ts +15 -0
  58. package/src/ngx-migrate/migration-matchers.js +132 -0
  59. package/src/ngx-migrate/migration-matchers.js.map +1 -0
  60. package/src/ngx-migrate/schema.d.ts +6 -0
  61. package/src/ngx-migrate/schema.js +3 -0
  62. package/src/ngx-migrate/schema.js.map +1 -0
  63. package/src/ngx-migrate/schema.json +16 -0
  64. package/src/scope/index.d.ts +3 -0
  65. package/src/scope/index.js +100 -0
  66. package/src/scope/index.js.map +1 -0
  67. package/src/scope/schema.d.ts +28 -0
  68. package/src/scope/schema.js +3 -0
  69. package/src/scope/schema.js.map +1 -0
  70. package/src/scope/schema.json +84 -0
  71. package/src/scope/utils.d.ts +4 -0
  72. package/src/scope/utils.js +14 -0
  73. package/src/scope/utils.js.map +1 -0
  74. package/src/split/index.d.ts +3 -0
  75. package/src/split/index.js +50 -0
  76. package/src/split/index.js.map +1 -0
  77. package/src/split/schema.d.ts +15 -0
  78. package/src/split/schema.js +3 -0
  79. package/src/split/schema.js.map +1 -0
  80. package/src/split/schema.json +28 -0
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PIPE_IN_BINDING_REGEX = exports.PIPE_REGEX = void 0;
4
+ exports.generateMatchers = generateMatchers;
5
+ const PIPE_CONTENT_REGEX = `\\s*([^}\\r\\n]*?\\|)\\s*(translate)[^\\r\\n]*?`;
6
+ exports.PIPE_REGEX = `{{${PIPE_CONTENT_REGEX}}}`;
7
+ exports.PIPE_IN_BINDING_REGEX = `\\]=('|")${PIPE_CONTENT_REGEX}\\1`;
8
+ // TODO refactor migration to be AST based
9
+ function generateMatchers(path) {
10
+ const noSpecFiles = { ignore: `${path}spec.ts`, files: `${path}.ts` };
11
+ const [directive, pipe, pipeInBinding] = [
12
+ /(translate|\[translate(?:Params)?\])=("|')[^"']*\2/gm,
13
+ new RegExp(exports.PIPE_REGEX, 'gm'),
14
+ new RegExp(exports.PIPE_IN_BINDING_REGEX, 'gm'),
15
+ ].map((regex) => ({
16
+ files: `${path}.html`,
17
+ from: regex,
18
+ to: (match) => match.replace(/translate/g, 'transloco'),
19
+ }));
20
+ const moduleMultiImport = {
21
+ files: `${path}.ts`,
22
+ from: /import\s*{((([^,}]*,)+\s*(TranslateModule)\s*(,[^}]*)*)|(([^,{}]*,)*\s*(TranslateModule)\s*,\s*[a-zA-Z0-9]+(,[^}]*)*))\s*}\s*from\s*('|").?ngx-translate(\/[^'"]+)?('|");?/g,
23
+ to: (match) => match
24
+ .replace('TranslateModule', '')
25
+ .replace(/,\s*,/, ',')
26
+ .replace(/{\s*,/, '{')
27
+ .replace(/,\s*}/, '}')
28
+ .concat(`\nimport { TranslocoModule } from '@jsverse/transloco';`),
29
+ };
30
+ const moduleSingleImport = {
31
+ files: `${path}.ts`,
32
+ from: /import\s*{\s*(TranslateModule),?\s*}\s*from\s*('|").?ngx-translate(\/[^'"]+)?('|");?/g,
33
+ to: `import { TranslocoModule } from '@jsverse/transloco';`,
34
+ };
35
+ const modules = {
36
+ files: `${path}.ts`,
37
+ from: /(?<![a-zA-Z])TranslateModule(?![^]*from)(\.(forRoot|forChild)\(({[^}]*})*[^)]*\))?/g,
38
+ to: 'TranslocoModule',
39
+ };
40
+ const serviceMultiImport = {
41
+ files: `${path}.ts`,
42
+ from: /import\s*{((([^,}]*,)+\s*(TranslateService)\s*(,[^}]*)*)|(([^,{}]*,)*\s*(TranslateService)\s*,\s*[a-zA-Z0-9]+(,[^}]*)*))\s*}\s*from\s*('|").?ngx-translate(\/[^'"]+)?('|");?/g,
43
+ to: (match) => match
44
+ .replace('TranslateService', '')
45
+ .replace(/,\s*,/, ',')
46
+ .replace(/{\s*,/, '{')
47
+ .replace(/,\s*}/, '}')
48
+ .concat(`\nimport { TranslocoService } from '@jsverse/transloco';`),
49
+ };
50
+ const [serviceSingleImport, pipeImport] = [
51
+ /import\s*{\s*(TranslateService),?\s*}\s*from\s*('|").?ngx-translate(\/[^'"]+)?('|");?/g,
52
+ /import\s*{\s*(TranslatePipe),?\s*}\s*from\s*('|")[^'"]+('|");?/g,
53
+ ].map((regex) => ({
54
+ ...noSpecFiles,
55
+ from: regex,
56
+ to: `import { TranslocoService } from '@jsverse/transloco';`,
57
+ }));
58
+ const constructorInjection = {
59
+ ...noSpecFiles,
60
+ from: /(?:private|protected|public)\s+(.*?)\s*:\s*(?:TranslateService|TranslatePipe\s*(?:,|\)))/g,
61
+ to: (match) => match.replace(/TranslateService|TranslatePipe/g, 'TranslocoService'),
62
+ };
63
+ const serviceUsage = {
64
+ ...noSpecFiles,
65
+ from: /(?=([^]+(?:private|protected|public)\s+([^,:()]+)\s*:\s*(?:TranslocoService\s*(?:,|\)))))\1[^]*/gm,
66
+ to: (match, _, serviceName) => {
67
+ const sanitizedName = serviceName
68
+ .split('')
69
+ .map((char) => (['$', '^'].includes(char) ? `\\${char}` : char))
70
+ .join('');
71
+ const functionsMap = {
72
+ instant: 'translate',
73
+ transform: 'translate',
74
+ get: 'selectTranslate',
75
+ stream: 'selectTranslate',
76
+ use: 'setActiveLang',
77
+ set: 'setTranslation',
78
+ };
79
+ const propsMap = {
80
+ currentLang: 'getActiveLang()',
81
+ onLangChange: 'langChanges$',
82
+ };
83
+ const serviceCallRgx = ({ map, func }) => new RegExp(`(?:(?:\\s*|this\\.)${sanitizedName})(?:\\s*\\t*\\r*\\n*)*\\.(?:\\s*\\t*\\r*\\n*)*(${getTarget(map)})[\\r\\t\\n\\s]*${func ? '\\(' : '(?!\\()'}`, 'g');
84
+ const getTarget = (t) => Object.keys(t).join('|');
85
+ return [
86
+ { func: true, map: functionsMap },
87
+ { func: false, map: propsMap },
88
+ ].reduce((acc, curr) => {
89
+ return acc.replace(serviceCallRgx(curr), (str) => str.replace(new RegExp(getTarget(curr.map)), (func) => curr.map[func]));
90
+ }, match);
91
+ },
92
+ };
93
+ const specs = {
94
+ files: `${path}spec.ts`,
95
+ from: /TranslateService|TranslatePipe/g,
96
+ to: 'TranslocoService',
97
+ };
98
+ const htmlReplacements = [
99
+ {
100
+ matchers: [directive],
101
+ step: 'directives',
102
+ },
103
+ {
104
+ matchers: [pipe, pipeInBinding],
105
+ step: 'pipes',
106
+ },
107
+ ];
108
+ const tsReplacements = [
109
+ {
110
+ matchers: [modules, moduleMultiImport, moduleSingleImport],
111
+ step: 'modules',
112
+ },
113
+ {
114
+ matchers: [serviceMultiImport, serviceSingleImport, pipeImport],
115
+ step: 'service imports',
116
+ },
117
+ {
118
+ matchers: [constructorInjection],
119
+ step: 'constructor injections',
120
+ },
121
+ {
122
+ matchers: [serviceUsage],
123
+ step: 'service usage',
124
+ },
125
+ {
126
+ matchers: [specs],
127
+ step: 'specs',
128
+ },
129
+ ];
130
+ return { htmlReplacements, tsReplacements };
131
+ }
132
+ //# sourceMappingURL=migration-matchers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-matchers.js","sourceRoot":"","sources":["../../../../../libs/transloco-schematics/src/ngx-migrate/migration-matchers.ts"],"names":[],"mappings":";;;AAgBA,4CAmJC;AAnKD,MAAM,kBAAkB,GAAG,iDAAiD,CAAC;AAChE,QAAA,U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AAG,IAAI,SAAS;QACvB,IAAI,EAAE,iCAAiC;QACvC,EAAE,EAAE,kBAAkB;KACvB,CAAC;IAEF,MAAM,gBAAgB,GAAc;QAClC;YACE,QAAQ,EAAE,CAAC,SAAS,CAAC;YACrB,IAAI,EAAE,YAAY;SACnB;QACD;YACE,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC;YAC/B,IAAI,EAAE,OAAO;SACd;KACF,CAAC;IACF,MAAM,cAAc,GAAc;QAChC;YACE,QAAQ,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,CAAC;YAC1D,IAAI,EAAE,SAAS;SAChB;QACD;YACE,QAAQ,EAAE,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,UAAU,CAAC;YAC/D,IAAI,EAAE,iBAAiB;SACxB;QACD;YACE,QAAQ,EAAE,CAAC,oBAAoB,CAAC;YAChC,IAAI,EAAE,wBAAwB;SAC/B;QACD;YACE,QAAQ,EAAE,CAAC,YAAY,CAAC;YACxB,IAAI,EAAE,eAAe;SACtB;QACD;YACE,QAAQ,EAAE,CAAC,KAAK,CAAC;YACjB,IAAI,EAAE,OAAO;SACd;KACF,CAAC;IAEF,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,6 @@
1
+ export interface SchemaOptions {
2
+ /**
3
+ * The path to the source root directory.
4
+ */
5
+ path: string;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../libs/transloco-schematics/src/ngx-migrate/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "SchematicsTranslocoMigrate",
4
+ "title": "Migrate from @ngx-translate to Transloco",
5
+ "type": "object",
6
+ "properties": {
7
+ "path": {
8
+ "description": "The path to the source root directory.",
9
+ "x-prompt": "✍ Which folder will contain the translation files?",
10
+ "type": "string",
11
+ "default": "./src/app",
12
+ "alias": "p"
13
+ }
14
+ },
15
+ "required": []
16
+ }
@@ -0,0 +1,3 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { SchemaOptions } from './schema';
3
+ export default function (options: SchemaOptions): Rule;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
4
+ const node_path_1 = require("node:path");
5
+ const strings_1 = require("@angular-devkit/core/src/utils/strings");
6
+ const schematics_1 = require("@angular-devkit/schematics");
7
+ const typescript_1 = require("typescript");
8
+ const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
9
+ const util_1 = require("@schematics/angular/utility/standalone/util");
10
+ const schematics_core_1 = require("../../schematics-core");
11
+ const utils_1 = require("./utils");
12
+ function getProviderValue(options) {
13
+ const name = (0, strings_1.dasherize)(options.name);
14
+ if (!options.inlineLoader)
15
+ return `'${name}'`;
16
+ return `{ scope: '${name}', loader }`;
17
+ }
18
+ function addScopeToModule(tree, modulePath, options) {
19
+ const module = tree.read(modulePath);
20
+ const moduleSource = (0, typescript_1.createSourceFile)(modulePath, module.toString('utf-8'), typescript_1.ScriptTarget.Latest, true);
21
+ const provider = `provideTranslocoScope(${getProviderValue(options)})`;
22
+ const changes = [];
23
+ changes.push((0, ast_utils_1.addProviderToModule)(moduleSource, modulePath, provider, schematics_core_1.NAMES.LIB_NAME)[0]);
24
+ changes.push((0, ast_utils_1.addImportToModule)(moduleSource, modulePath, 'TranslocoModule', schematics_core_1.NAMES.LIB_NAME)[0]);
25
+ changes.push((0, ast_utils_1.insertImport)(moduleSource, modulePath, 'provideTranslocoScope, TranslocoModule', schematics_core_1.NAMES.LIB_NAME));
26
+ if (options.inlineLoader) {
27
+ changes.push((0, ast_utils_1.insertImport)(moduleSource, modulePath, 'loader', './transloco.loader'));
28
+ }
29
+ (0, util_1.applyChangesToFile)(tree, modulePath, changes);
30
+ }
31
+ function getTranslationFilesFromAssets(host, translationsPath) {
32
+ const langFiles = host.root.dir(translationsPath).subfiles;
33
+ return Array.from(new Set(langFiles.map((file) => file.split('.')[0])));
34
+ }
35
+ function getTranslationFiles(options, host, translationsPath) {
36
+ return (options.langs ||
37
+ (0, schematics_core_1.getGlobalConfig)().langs ||
38
+ getTranslationFilesFromAssets(host, translationsPath));
39
+ }
40
+ function addInlineLoader(tree, modulePath, name, langs) {
41
+ const loader = `export const loader = [${(0, schematics_core_1.stringifyList)((0, schematics_core_1.coerceArray)(langs))}].reduce((acc: any, lang: string) => {
42
+ acc[lang] = () => import(\`./i18n/\${lang}.json\`);
43
+ return acc;
44
+ }, {});
45
+
46
+ `;
47
+ const path = (0, node_path_1.join)((0, node_path_1.dirname)(modulePath), 'transloco.loader.ts');
48
+ tree.create(path, loader);
49
+ }
50
+ function createTranslationFiles(options, rootPath, modulePath, host) {
51
+ if (options.skipCreation) {
52
+ return (0, schematics_1.empty)();
53
+ }
54
+ const defaultPath = options.inlineLoader
55
+ ? (0, node_path_1.join)((0, node_path_1.dirname)(modulePath), 'i18n')
56
+ : (0, node_path_1.join)(rootPath, 'assets', 'i18n', (0, strings_1.dasherize)(options.name));
57
+ const translationsPath = options.translationPath
58
+ ? (0, node_path_1.join)(rootPath, options.translationPath)
59
+ : defaultPath;
60
+ return (0, schematics_core_1.createTranslateFilesFromOptions)(host, {
61
+ ...options,
62
+ translationsPath,
63
+ });
64
+ }
65
+ function extractModuleOptions({ path, project, routing, flat, commonModule, }) {
66
+ return { path, project, routing, flat, commonModule };
67
+ }
68
+ function default_1(options) {
69
+ return (host, context) => {
70
+ const project = (0, schematics_core_1.getProject)(host, options.project);
71
+ const rootPath = project?.sourceRoot ?? 'src';
72
+ const assetsPath = (0, node_path_1.join)(rootPath, 'assets', 'i18n');
73
+ options.langs = getTranslationFiles(options, host, assetsPath);
74
+ if (options.module) {
75
+ const projectPath = (0, utils_1.getProjectPath)(host, project, options);
76
+ const modulePath = (0, schematics_core_1.findModuleFromOptions)(host, options, projectPath);
77
+ if (options.inlineLoader) {
78
+ addInlineLoader(host, modulePath, options.name, options.langs);
79
+ }
80
+ if (modulePath) {
81
+ addScopeToModule(host, modulePath, options);
82
+ return (0, schematics_1.mergeWith)(createTranslationFiles(options, rootPath, modulePath, host))(host, context);
83
+ }
84
+ }
85
+ return (0, schematics_1.chain)([
86
+ (0, schematics_1.externalSchematic)('@schematics/angular', 'module', extractModuleOptions(options)),
87
+ (tree) => {
88
+ const modulePath = tree.actions.find((action) => !!action.path.match(/\.module\.ts/) &&
89
+ !action.path.match(/-routing\.module\.ts/)).path;
90
+ addScopeToModule(tree, modulePath, options);
91
+ if (options.inlineLoader) {
92
+ addInlineLoader(tree, modulePath, options.name, options.langs);
93
+ }
94
+ const translationRule = createTranslationFiles(options, rootPath, modulePath, host);
95
+ return (0, schematics_1.mergeWith)(translationRule);
96
+ },
97
+ ]);
98
+ };
99
+ }
100
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/transloco-schematics/src/scope/index.ts"],"names":[],"mappings":";;AA6IA,4BA+CC;AA5LD,yCAA0C;AAE1C,oEAAmE;AACnE,2DAQoC;AACpC,2CAA4D;AAC5D,qEAI+C;AAC/C,sEAAiF;AAGjF,2DAQ+B;AAG/B,mCAAyC;AAEzC,SAAS,gBAAgB,CAAC,OAAsB;IAC9C,MAAM,IAAI,GAAG,IAAA,mBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,OAAO,CAAC,YAAY;QAAE,OAAO,IAAI,IAAI,GAAG,CAAC;IAC9C,OAAO,aAAa,IAAI,aAAa,CAAC;AACxC,CAAC;AAED,SAAS,gBAAgB,CACvB,IAAU,EACV,UAAkB,EAClB,OAAsB;IAEtB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,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kBAAK,EAAC;YACX,IAAA,8BAAiB,EACf,qBAAqB,EACrB,QAAQ,EACR,oBAAoB,CAAC,OAAO,CAAC,CAC9B;YACD,CAAC,IAAI,EAAE,EAAE;gBACP,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAClC,CAAC,MAAM,EAAE,EAAE,CACT,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;oBACnC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAC7C,CAAC,IAAI,CAAC;gBACP,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;gBAC5C,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;oBACzB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;gBACjE,CAAC;gBACD,MAAM,eAAe,GAAG,sBAAsB,CAC5C,OAAO,EACP,QAAQ,EACR,UAAU,EACV,IAAI,CACL,CAAC;gBAEF,OAAO,IAAA,sBAAS,EAAC,eAAe,CAAC,CAAC;YACpC,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { Schema } from '@schematics/angular/module/schema';
2
+ export interface SchemaOptions extends Schema {
3
+ name: string;
4
+ /**
5
+ * The languages of the project.
6
+ */
7
+ langs: string | string[];
8
+ /**
9
+ * Skip the creation of the translation files.
10
+ */
11
+ skipCreation: boolean;
12
+ /**
13
+ * The path of the translation files.
14
+ */
15
+ translationPath: string;
16
+ /**
17
+ * Specification of the declaring module..
18
+ */
19
+ module: string;
20
+ /**
21
+ * The root project name.
22
+ */
23
+ project: string;
24
+ /**
25
+ * Should create scope with inline loader.
26
+ */
27
+ inlineLoader: boolean;
28
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../libs/transloco-schematics/src/scope/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,84 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "SchematicsTranslocoScope",
4
+ "title": "Add new transloco scope module, along with translation files.",
5
+ "type": "object",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "The scope name.",
10
+ "$default": {
11
+ "$source": "argv",
12
+ "index": 0
13
+ },
14
+ "x-prompt": "What scope name would you like?"
15
+ },
16
+ "module": {
17
+ "type": "string",
18
+ "description": "The path at which module to add scope to, relative to the workspace root."
19
+ },
20
+ "inlineLoader": {
21
+ "description": "Should create scope with inline loader.",
22
+ "type": "boolean",
23
+ "alias": "il"
24
+ },
25
+ "langs": {
26
+ "description": "The languages of the project.",
27
+ "type": "string",
28
+ "alias": "la"
29
+ },
30
+ "skipCreation": {
31
+ "type": "boolean",
32
+ "description": "Skip the translation files creation."
33
+ },
34
+ "translationPath": {
35
+ "description": "The to the translation files, relative to the project's root.",
36
+ "type": "string"
37
+ },
38
+ "lintFix": {
39
+ "type": "boolean",
40
+ "default": false,
41
+ "description": "When true, applies lint fixes after generating the module."
42
+ },
43
+
44
+ "path": {
45
+ "type": "string",
46
+ "format": "path",
47
+ "$default": {
48
+ "$source": "workingDirectory"
49
+ },
50
+ "description": "The path at which to create the NgModule, relative to the workspace root.",
51
+ "visible": false
52
+ },
53
+ "project": {
54
+ "type": "string",
55
+ "description": "The name of the project.",
56
+ "$default": {
57
+ "$source": "projectName"
58
+ }
59
+ },
60
+ "routing": {
61
+ "type": "boolean",
62
+ "description": "Create a routing module.",
63
+ "default": false
64
+ },
65
+ "routingScope": {
66
+ "enum": ["Child", "Root"],
67
+ "type": "string",
68
+ "description": "The scope for the new routing module.",
69
+ "default": "Child"
70
+ },
71
+ "flat": {
72
+ "type": "boolean",
73
+ "description": "Create the new files at the top level of the current project root. ",
74
+ "default": false
75
+ },
76
+ "commonModule": {
77
+ "type": "boolean",
78
+ "description": "The new NgModule imports \"CommonModule\". ",
79
+ "default": true,
80
+ "visible": false
81
+ }
82
+ },
83
+ "required": []
84
+ }
@@ -0,0 +1,4 @@
1
+ import { Tree } from '@angular-devkit/schematics';
2
+ import { WorkspaceProject } from '@schematics/angular/utility/workspace-models';
3
+ import { SchemaOptions } from './schema';
4
+ export declare function getProjectPath(host: Tree, project: WorkspaceProject, options: SchemaOptions): string;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProjectPath = getProjectPath;
4
+ function getProjectPath(host, project, options) {
5
+ if (project.root.at(-1) === '/') {
6
+ project.root = project.root.slice(0, project.root.length - 1);
7
+ }
8
+ if (options.path === undefined) {
9
+ const projectDirName = project.projectType === 'application' ? 'app' : 'lib';
10
+ return `${project.root ? `/${project.root}` : ''}/src/${projectDirName}`;
11
+ }
12
+ return options.path;
13
+ }
14
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../libs/transloco-schematics/src/scope/utils.ts"],"names":[],"mappings":";;AAKA,wCAiBC;AAjBD,SAAgB,cAAc,CAC5B,IAAU,EACV,OAAyB,EACzB,OAAsB;IAEtB,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;QAChC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,cAAc,GAClB,OAAO,CAAC,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QAExD,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,cAAc,EAAE,CAAC;IAC3E,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { SchemaOptions } from './schema';
3
+ export default function (options: SchemaOptions): Rule;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
4
+ const schematics_core_1 = require("../../schematics-core");
5
+ function reduceTranslations(host, dirPath, translationJson, lang, key = '') {
6
+ const dir = host.getDir(dirPath);
7
+ if (!(0, schematics_core_1.hasFiles)(dir))
8
+ return translationJson;
9
+ if ((0, schematics_core_1.hasSubdirs)(dir)) {
10
+ dir.subdirs.forEach((subDirName) => {
11
+ const subDir = dir.dir(subDirName);
12
+ const nestedKeyPath = (0, schematics_core_1.getTranslationKey)(key, subDirName);
13
+ const nestedKey = nestedKeyPath.split('.').at(-1);
14
+ const subTranslationJson = translationJson[key];
15
+ if (subTranslationJson) {
16
+ reduceTranslations(host, subDir.path, subTranslationJson, lang, nestedKey);
17
+ delete translationJson[key][nestedKey];
18
+ }
19
+ });
20
+ }
21
+ dir.subfiles
22
+ .filter((fileName) => fileName.includes(`${lang}.json`))
23
+ .forEach((fileName) => {
24
+ if (!translationJson[key]) {
25
+ return translationJson;
26
+ }
27
+ (0, schematics_core_1.writeToJson)(host, dir.path, fileName, translationJson[key]);
28
+ });
29
+ delete translationJson[key];
30
+ return translationJson;
31
+ }
32
+ function default_1(options) {
33
+ return (host) => {
34
+ const root = (0, schematics_core_1.getTranslationsRoot)(host, options);
35
+ const translatedFiles = (0, schematics_core_1.getTranslationFiles)(host, options.source);
36
+ const translationEntryPaths = (0, schematics_core_1.getTranslationEntryPaths)(host, root);
37
+ const newTranslation = {};
38
+ for (const { lang, translation } of translatedFiles) {
39
+ newTranslation[lang] = translationEntryPaths.reduce((acc, { scope, path }) => {
40
+ return reduceTranslations(host, path, translation, lang, scope);
41
+ }, translation);
42
+ }
43
+ host.getDir(root).subfiles.forEach((fileName) => {
44
+ const lang = fileName.split('.')[0];
45
+ (0, schematics_core_1.writeToJson)(host, root, fileName, newTranslation[lang]);
46
+ });
47
+ return host;
48
+ };
49
+ }
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/transloco-schematics/src/split/index.ts"],"names":[],"mappings":";;AAwDA,4BAwBC;AA9ED,2DAQ+B;AAI/B,SAAS,kBAAkB,CACzB,IAAU,EACV,OAAe,EACf,eAAe,EACf,IAAY,EACZ,GAAG,GAAG,EAAE;IAER,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjC,IAAI,CAAC,IAAA,0BAAQ,EAAC,GAAG,CAAC;QAAE,OAAO,eAAe,CAAC;IAE3C,IAAI,IAAA,4BAAU,EAAC,GAAG,CAAC,EAAE,CAAC;QACpB,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YACjC,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACnC,MAAM,aAAa,GAAG,IAAA,mCAAiB,EAAC,GAAG,EAAE,UAAU,CAAC,CAAC;YACzD,MAAM,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAClD,MAAM,kBAAkB,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;YAChD,IAAI,kBAAkB,EAAE,CAAC;gBACvB,kBAAkB,CAChB,IAAI,EACJ,MAAM,CAAC,IAAI,EACX,kBAAkB,EAClB,IAAI,EACJ,SAAS,CACV,CAAC;gBACF,OAAO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QACJ,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC9C,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACpC,IAAA,6BAAW,EAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Schema } from '@schematics/angular/module/schema';
2
+ export interface SchemaOptions extends Schema {
3
+ /**
4
+ * The folder that contain the root translation files.
5
+ */
6
+ translationPath: string;
7
+ /**
8
+ * The source directory that contain the translated files.
9
+ */
10
+ source: string;
11
+ /**
12
+ * The root project name.
13
+ */
14
+ project: string;
15
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../libs/transloco-schematics/src/split/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "SchematicsTranslocoSplit",
4
+ "title": "Split translated files between the project's translation files.",
5
+ "type": "object",
6
+ "properties": {
7
+ "translationPath": {
8
+ "type": "string",
9
+ "description": "The folder that contain the root translation files.",
10
+ "default": "src/assets/i18n",
11
+ "alias": "root"
12
+ },
13
+ "source": {
14
+ "type": "string",
15
+ "description": "The path of the source directory that contain the translated files.",
16
+ "default": "dist-i18n",
17
+ "alias": "o"
18
+ },
19
+ "project": {
20
+ "type": "string",
21
+ "description": "The root project name.",
22
+ "$default": {
23
+ "$source": "projectName"
24
+ }
25
+ }
26
+ },
27
+ "required": []
28
+ }