@vendure/dashboard 3.7.4-master-202609110210 → 3.7.4-master-202609120210

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.
@@ -20,11 +20,11 @@ export interface TranslationsPluginOptions {
20
20
  *
21
21
  * It handles 2 modes: dev and build.
22
22
  *
23
- * - The dev case is handled in the `load` function using Vite virtual
24
- * modules to compile and return translations from plugins _only_, which then get merged with the built-in
23
+ * - The `load` function serves the `virtual:plugin-translations` module in both dev and build. It
24
+ * compiles and returns translations from plugins _only_, which then get merged with the built-in
25
25
  * translations in the `loadI18nMessages` function
26
- * - The build case loads both built-in and plugin translations, merges them, and outputs the compiled
27
- * files as .js files that can be statically consumed by the built app.
26
+ * - The `generateBundle` function additionally emits the merged built-in and plugin catalogs as .js
27
+ * files under the `outputPath` directory. Nothing in the dashboard reads those files today.
28
28
  *
29
29
  * @param options
30
30
  */
@@ -14,11 +14,11 @@ const resolvedVirtualModuleId = `\0${virtualModuleId}`;
14
14
  *
15
15
  * It handles 2 modes: dev and build.
16
16
  *
17
- * - The dev case is handled in the `load` function using Vite virtual
18
- * modules to compile and return translations from plugins _only_, which then get merged with the built-in
17
+ * - The `load` function serves the `virtual:plugin-translations` module in both dev and build. It
18
+ * compiles and returns translations from plugins _only_, which then get merged with the built-in
19
19
  * translations in the `loadI18nMessages` function
20
- * - The build case loads both built-in and plugin translations, merges them, and outputs the compiled
21
- * files as .js files that can be statically consumed by the built app.
20
+ * - The `generateBundle` function additionally emits the merged built-in and plugin catalogs as .js
21
+ * files under the `outputPath` directory. Nothing in the dashboard reads those files today.
22
22
  *
23
23
  * @param options
24
24
  */
@@ -63,7 +63,19 @@ export function translationsPlugin(options) {
63
63
  ${[...mergedMessageMap.entries()]
64
64
  .map(([locale, messages]) => {
65
65
  const safeLocale = locale.replace(/-/g, '_');
66
- return `${safeLocale}: ${JSON.stringify(messages)}`;
66
+ // `@lingui/core` interpolates compiled token arrays, not ICU source
67
+ // strings. It registers a runtime compiler of its own only when
68
+ // `NODE_ENV !== 'production'`, so an uncompiled catalog here renders
69
+ // literally in a built dashboard: `Hello {name}` instead of `Hello Bob`.
70
+ const { source, errors } = createCompiledCatalog(locale, messages, {
71
+ namespace: 'json',
72
+ pseudoLocale: cachedLinguiConfig.pseudoLocale,
73
+ });
74
+ if (errors.length) {
75
+ this.error(createCompilationErrorMessage(locale, errors));
76
+ }
77
+ const { messages: compiledMessages } = JSON.parse(source);
78
+ return `${safeLocale}: ${JSON.stringify(compiledMessages)}`;
67
79
  })
68
80
  .join(',\n')}
69
81
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vendure/dashboard",
3
3
  "private": false,
4
- "version": "3.7.4-master-202609110210",
4
+ "version": "3.7.4-master-202609120210",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
@@ -140,8 +140,8 @@
140
140
  "@storybook/addon-vitest": "^10.3.1",
141
141
  "@storybook/react-vite": "^10.3.1",
142
142
  "@types/node": "^22.19.0",
143
- "@vendure/common": "^3.7.4-master-202609110210",
144
- "@vendure/core": "^3.7.4-master-202609110210",
143
+ "@vendure/common": "^3.7.4-master-202609120210",
144
+ "@vendure/core": "^3.7.4-master-202609120210",
145
145
  "@vitest/browser": "^3.2.4",
146
146
  "@vitest/coverage-v8": "^3.2.4",
147
147
  "eslint": "^9.39.0",
@@ -6,7 +6,11 @@ declare module 'virtual:dashboard-extensions' {
6
6
  export const runDashboardExtensions: () => Promise<void>;
7
7
  }
8
8
  declare module 'virtual:plugin-translations' {
9
- export default translations = Record<string, any>;
9
+ import { Messages } from '@lingui/core';
10
+
11
+ // Keyed by locale with `-` replaced by `_`, as emitted by `translationsPlugin`.
12
+ const translations: Record<string, Messages>;
13
+ export default translations;
10
14
  }
11
15
 
12
16
  declare module 'virtual:vendure-ui-config' {