@patterkit/compiler 0.4.5 → 0.4.6
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/index.cjs +8 -6
- package/dist/index.js +8 -6
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -235,7 +235,11 @@ function validateConditions(input, options = {}) {
|
|
|
235
235
|
function validateInterpolation(input, options = {}) {
|
|
236
236
|
const issues = [];
|
|
237
237
|
const voiced = input.project.voiced ?? false;
|
|
238
|
-
const
|
|
238
|
+
const byLocale = /* @__PURE__ */ new Map();
|
|
239
|
+
for (const l of input.locales ?? []) {
|
|
240
|
+
const table = byLocale.get(l.locale) ?? byLocale.set(l.locale, /* @__PURE__ */ new Map()).get(l.locale);
|
|
241
|
+
for (const [id, text] of Object.entries(l.strings)) (table.get(id) ?? table.set(id, []).get(id)).push(text);
|
|
242
|
+
}
|
|
239
243
|
const defaultLocale = input.project.locales.default;
|
|
240
244
|
const { foreign, external, merged } = validationScopes(input.project, options);
|
|
241
245
|
const opaqueForeign = opaqueForeignTokens(foreign);
|
|
@@ -249,11 +253,9 @@ function validateInterpolation(input, options = {}) {
|
|
|
249
253
|
return schema.properties.get(scope)?.has(name) ?? false;
|
|
250
254
|
};
|
|
251
255
|
const checkString = (nodeId, id, voicedLine) => {
|
|
252
|
-
for (const
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
const field = `text[${t.locale}]`;
|
|
256
|
-
for (const slot of (0, import_dialect2.extractSlots)(text)) {
|
|
256
|
+
for (const [locale, table] of byLocale) {
|
|
257
|
+
const field = `text[${locale}]`;
|
|
258
|
+
for (const text of table.get(id) ?? []) for (const slot of (0, import_dialect2.extractSlots)(text)) {
|
|
257
259
|
if (voicedLine) {
|
|
258
260
|
issues.push({
|
|
259
261
|
nodeId,
|
package/dist/index.js
CHANGED
|
@@ -201,7 +201,11 @@ function validateConditions(input, options = {}) {
|
|
|
201
201
|
function validateInterpolation(input, options = {}) {
|
|
202
202
|
const issues = [];
|
|
203
203
|
const voiced = input.project.voiced ?? false;
|
|
204
|
-
const
|
|
204
|
+
const byLocale = /* @__PURE__ */ new Map();
|
|
205
|
+
for (const l of input.locales ?? []) {
|
|
206
|
+
const table = byLocale.get(l.locale) ?? byLocale.set(l.locale, /* @__PURE__ */ new Map()).get(l.locale);
|
|
207
|
+
for (const [id, text] of Object.entries(l.strings)) (table.get(id) ?? table.set(id, []).get(id)).push(text);
|
|
208
|
+
}
|
|
205
209
|
const defaultLocale = input.project.locales.default;
|
|
206
210
|
const { foreign, external, merged } = validationScopes(input.project, options);
|
|
207
211
|
const opaqueForeign = opaqueForeignTokens(foreign);
|
|
@@ -215,11 +219,9 @@ function validateInterpolation(input, options = {}) {
|
|
|
215
219
|
return schema.properties.get(scope)?.has(name) ?? false;
|
|
216
220
|
};
|
|
217
221
|
const checkString = (nodeId, id, voicedLine) => {
|
|
218
|
-
for (const
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
const field = `text[${t.locale}]`;
|
|
222
|
-
for (const slot of extractSlots(text)) {
|
|
222
|
+
for (const [locale, table] of byLocale) {
|
|
223
|
+
const field = `text[${locale}]`;
|
|
224
|
+
for (const text of table.get(id) ?? []) for (const slot of extractSlots(text)) {
|
|
223
225
|
if (voicedLine) {
|
|
224
226
|
issues.push({
|
|
225
227
|
nodeId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patterkit/compiler",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Patter compiler: compile condition/effect expressions, validate them, and export source to the runtime bundle.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patterkit/model": "0.
|
|
38
|
-
"@patterkit/core": "0.
|
|
39
|
-
"@patterkit/dialect": "0.2.
|
|
37
|
+
"@patterkit/model": "0.10.0",
|
|
38
|
+
"@patterkit/core": "0.4.0",
|
|
39
|
+
"@patterkit/dialect": "0.2.6",
|
|
40
40
|
"@wildwinter/expr": "^0.5.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|