@o3r/localization 11.6.0-prerelease.20 → 11.6.0-prerelease.21
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/migration.json +5 -0
- package/package.json +6 -6
- package/schematics/add-localization-key/index.d.ts.map +1 -1
- package/schematics/add-localization-key/index.js +22 -6
- package/schematics/localization-to-component/templates/__name__.translation.ts.template +1 -1
- package/schematics/ng-update/v11-6/index.d.ts +6 -0
- package/schematics/ng-update/v11-6/index.d.ts.map +1 -0
- package/schematics/ng-update/v11-6/index.js +22 -0
package/migration.json
CHANGED
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
"version": "10.0.0-alpha.0",
|
|
6
6
|
"description": "Updates of @o3r/localization to v10.0.*",
|
|
7
7
|
"factory": "./schematics/ng-update/v10-0/index#updateV10_0"
|
|
8
|
+
},
|
|
9
|
+
"migration-v11_6": {
|
|
10
|
+
"version": "11.6.0-prerelease.0",
|
|
11
|
+
"description": "Updates of @o3r/localization to v11.6.*",
|
|
12
|
+
"factory": "./schematics/ng-update/v11-6/index#updateV116"
|
|
8
13
|
}
|
|
9
14
|
}
|
|
10
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/localization",
|
|
3
|
-
"version": "11.6.0-prerelease.
|
|
3
|
+
"version": "11.6.0-prerelease.21",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@formatjs/intl-numberformat": "^8.0.2",
|
|
45
45
|
"@ngrx/store": "~18.0.0",
|
|
46
46
|
"@ngx-translate/core": "~15.0.0",
|
|
47
|
-
"@o3r/core": "^11.6.0-prerelease.
|
|
48
|
-
"@o3r/dynamic-content": "^11.6.0-prerelease.
|
|
49
|
-
"@o3r/extractors": "^11.6.0-prerelease.
|
|
50
|
-
"@o3r/logger": "^11.6.0-prerelease.
|
|
51
|
-
"@o3r/schematics": "^11.6.0-prerelease.
|
|
47
|
+
"@o3r/core": "^11.6.0-prerelease.21",
|
|
48
|
+
"@o3r/dynamic-content": "^11.6.0-prerelease.21",
|
|
49
|
+
"@o3r/extractors": "^11.6.0-prerelease.21",
|
|
50
|
+
"@o3r/logger": "^11.6.0-prerelease.21",
|
|
51
|
+
"@o3r/schematics": "^11.6.0-prerelease.21",
|
|
52
52
|
"@schematics/angular": "~18.2.0",
|
|
53
53
|
"@yarnpkg/cli": "^4.3.1",
|
|
54
54
|
"@yarnpkg/core": "^4.1.1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/add-localization-key/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,IAAI,EAIL,MAAM,4BAA4B,CAAC;AAYpC,OAAO,KAAK,EACV,oCAAoC,EACrC,MAAM,UAAU,CAAC;AA8FlB;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,oCAAoC,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/add-localization-key/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,IAAI,EAIL,MAAM,4BAA4B,CAAC;AAYpC,OAAO,KAAK,EACV,oCAAoC,EACrC,MAAM,UAAU,CAAC;AA8FlB;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,oCAAoC,GAAG,IAAI,CAoM1F;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,yDAAgE,CAAC"}
|
|
@@ -124,12 +124,28 @@ function ngAddLocalizationKeyFn(options) {
|
|
|
124
124
|
return factory.updateInterfaceDeclaration(node, ts.getModifiers(node), node.name, node.typeParameters, node.heritageClauses, node.members.concat(factory.createPropertySignature(undefined, factory.createIdentifier(properties.keyName), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword))));
|
|
125
125
|
}
|
|
126
126
|
if (ts.isVariableDeclaration(node)
|
|
127
|
-
&& node.type
|
|
128
|
-
&& ts.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
&& node.type
|
|
128
|
+
&& ((ts.isTypeReferenceNode(node.type)
|
|
129
|
+
&& ts.isIdentifier(node.type.typeName)
|
|
130
|
+
&& node.type.typeName.escapedText.toString() === translationsVariableType)
|
|
131
|
+
|| (ts.isTypeReferenceNode(node.type)
|
|
132
|
+
&& ts.isIdentifier(node.type.typeName)
|
|
133
|
+
&& node.type.typeName.escapedText.toString() === 'Readonly'
|
|
134
|
+
&& node.type.typeArguments?.[0]
|
|
135
|
+
&& ts.isTypeReferenceNode(node.type.typeArguments[0])
|
|
136
|
+
&& ts.isIdentifier(node.type.typeArguments[0].typeName)
|
|
137
|
+
&& node.type.typeArguments[0].typeName.escapedText.toString() === translationsVariableType))
|
|
138
|
+
&& node.initializer) {
|
|
139
|
+
if (ts.isObjectLiteralExpression(node.initializer)) {
|
|
140
|
+
return factory.updateVariableDeclaration(node, node.name, node.exclamationToken, node.type, factory.updateObjectLiteralExpression(node.initializer, node.initializer.properties.concat(factory.createPropertyAssignment(factory.createIdentifier(properties.keyName), factory.createStringLiteral(properties.keyValue, true)))));
|
|
141
|
+
}
|
|
142
|
+
else if (ts.isAsExpression(node.initializer)
|
|
143
|
+
&& ts.isTypeReferenceNode(node.initializer.type)
|
|
144
|
+
&& ts.isIdentifier(node.initializer.type.typeName)
|
|
145
|
+
&& node.initializer.type.typeName.escapedText.toString() === 'const'
|
|
146
|
+
&& ts.isObjectLiteralExpression(node.initializer.expression)) {
|
|
147
|
+
return factory.updateVariableDeclaration(node, node.name, node.exclamationToken, node.type, factory.updateAsExpression(node.initializer, factory.updateObjectLiteralExpression(node.initializer.expression, node.initializer.expression.properties.concat(factory.createPropertyAssignment(factory.createIdentifier(properties.keyName), factory.createStringLiteral(properties.keyValue, true)))), node.initializer.type));
|
|
148
|
+
}
|
|
133
149
|
}
|
|
134
150
|
return ts.visitEachChild(node, visit, ctx);
|
|
135
151
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-update/v11-6/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EAEL,MAAM,4BAA4B,CAAC;AAqBpC;;GAEG;AACH,eAAO,MAAM,UAAU,4BAAsD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateV116 = void 0;
|
|
4
|
+
const schematics_1 = require("@o3r/schematics");
|
|
5
|
+
const regexp = /translations\s*:\s*(?:Readonly<)?([A-Z][\w]*)(?:>)?\s*=\s*({[^;]+})\s*(as\s*const)?\s*;/g;
|
|
6
|
+
function updateV116Fn() {
|
|
7
|
+
return (tree) => {
|
|
8
|
+
const files = (0, schematics_1.findFilesInTree)(tree.getDir(''), (filePath) => /translation\.ts$/.test(filePath));
|
|
9
|
+
files.forEach(({ content, path }) => {
|
|
10
|
+
const str = content.toString();
|
|
11
|
+
const newContent = str.replaceAll(regexp, 'translations: Readonly<$1> = $2 as const;');
|
|
12
|
+
if (newContent !== str) {
|
|
13
|
+
tree.overwrite(path, newContent);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Update of Otter configuration V11.6
|
|
20
|
+
*/
|
|
21
|
+
exports.updateV116 = (0, schematics_1.createSchematicWithMetricsIfInstalled)(updateV116Fn);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|