Skip to content

Commit 90ae388

Browse files
committed
OCPBUGS-109592: Bump to rspack 2.1.10
1 parent 52b1a97 commit 90ae388

3 files changed

Lines changed: 27 additions & 10 deletions

File tree

i18next.config.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { readFile } from 'node:fs/promises';
22
import jsonc from 'comment-json';
33
import { defineConfig, Plugin } from 'i18next-cli';
4+
import { consolePlugin as consolePluginMetadata } from './package.json';
5+
6+
const EXPECTED_NAMESPACE = `plugin__${consolePluginMetadata.name}`;
47

58
/**
69
* Custom JSON parser for localizing keys matching format: /%.+%/
@@ -32,14 +35,27 @@ const consoleExtensionsPlugin = (): Plugin => ({
3235
}
3336

3437
for (const { key: fullKey } of extracted) {
35-
const [ns, key] = fullKey.split('~', 2);
36-
37-
if (ns && key) {
38+
const sep = fullKey.indexOf('~');
39+
if (sep > 0 && sep < fullKey.length - 1) {
40+
const ns = fullKey.slice(0, sep);
41+
const key = fullKey.slice(sep + 1);
3842
keys.set(`${ns}:${key}`, { key, defaultValue: key, ns });
3943
} else {
4044
console.warn(`Invalid key format: ${fullKey}`);
4145
}
4246
}
47+
48+
// Validate keys have the correct namespace
49+
const mismatchedKeys = [...keys.entries()].filter(([fullKey, { ns }]) => {
50+
const fullNs = fullKey.split(':')[0];
51+
return !ns || fullNs !== EXPECTED_NAMESPACE;
52+
}).map(([fullKey]) => fullKey);
53+
if (mismatchedKeys.length > 0) {
54+
throw new Error(
55+
`Found ${mismatchedKeys.length} keys with mismatched namespace. Expected namespace: ${EXPECTED_NAMESPACE}
56+
${mismatchedKeys.map((key) => ` - ${key}`).join('\n')}`,
57+
);
58+
}
4359
},
4460
});
4561

@@ -49,10 +65,11 @@ export default defineConfig({
4965
input: 'src/**/*.{js,jsx,ts,tsx}',
5066
output: 'locales/{{language}}/{{namespace}}.json',
5167

68+
defaultValue: (key) => key.replace(/_(?:one|other)$/, ''),
5269
sort: true,
5370
keySeparator: false,
5471
nsSeparator: '~',
55-
defaultNS: 'plugin__console-plugin-template', // TODO: Change me!
72+
defaultNS: EXPECTED_NAMESPACE,
5673
},
5774
plugins: [consoleExtensionsPlugin()],
5875
});

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@
2828
"@patternfly/react-icons": "^6.6.1",
2929
"@patternfly/react-table": "^6.6.1",
3030
"@playwright/test": "~1.60.0",
31-
"@rspack/cli": "^2.1.9",
32-
"@rspack/core": "^2.1.9",
31+
"@rspack/cli": "^2.1.10",
32+
"@rspack/core": "^2.1.10",
3333
"@rspack/dev-server": "^2.2.0",
3434
"@swc/core": "^1.15.47",
3535
"@swc/jest": "^0.2.39",
3636
"@testing-library/dom": "^10.4.1",
3737
"@testing-library/jest-dom": "^7.0.1",
3838
"@testing-library/react": "^16.3.2",
39-
"@testing-library/user-event": "^14.6.3",
39+
"@testing-library/user-event": "^14.6.4",
4040
"@types/jest": "^30.0.0",
4141
"@types/node": "^22.0.0",
4242
"@types/react": "^18.3.28",
4343
"eslint": "^9.39.5",
4444
"eslint-config-prettier": "^10.1.8",
4545
"eslint-import-resolver-typescript": "^4.4.5",
4646
"eslint-plugin-import-x": "^4.17.1",
47-
"eslint-plugin-jest": "^29.16.0",
47+
"eslint-plugin-jest": "^29.16.1",
4848
"eslint-plugin-playwright": "^2.11.0",
4949
"eslint-plugin-prettier": "^5.5.6",
5050
"eslint-plugin-react": "^7.37.5",
@@ -65,7 +65,7 @@
6565
"react-router": "~7.18.1",
6666
"stylelint": "^17.14.1",
6767
"stylelint-config-standard": "^40.0.0",
68-
"ts-checker-rspack-plugin": "^1.6.0",
68+
"ts-checker-rspack-plugin": "^1.6.1",
6969
"ts-node": "^10.9.2",
7070
"typescript": "^5.9.3",
7171
"typescript-eslint": "^8.67.0"

rspack.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default defineConfig({
3737
target: '18',
3838
},
3939
},
40-
target: "es2021",
40+
target: 'es2021',
4141
},
4242
},
4343
},

0 commit comments

Comments
 (0)