svelte-intlayer 8.7.4 → 8.7.5
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/plugins.js +23 -13
- package/package.json +6 -6
package/dist/plugins.js
CHANGED
|
@@ -301,20 +301,30 @@ export const htmlPlugin = TREE_SHAKE_HTML
|
|
|
301
301
|
return render();
|
|
302
302
|
},
|
|
303
303
|
};
|
|
304
|
+
const pluginsCache = new Map();
|
|
304
305
|
/**
|
|
305
306
|
* Get the plugins array for Svelte content transformation.
|
|
306
307
|
* This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.
|
|
307
308
|
*/
|
|
308
|
-
export const getPlugins = (locale, fallback = true) =>
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
309
|
+
export const getPlugins = (locale, fallback = true) => {
|
|
310
|
+
const currentLocale = locale ?? internationalization.defaultLocale;
|
|
311
|
+
const cacheKey = `${currentLocale}_${fallback}`;
|
|
312
|
+
if (pluginsCache.has(cacheKey)) {
|
|
313
|
+
return pluginsCache.get(cacheKey);
|
|
314
|
+
}
|
|
315
|
+
const plugins = [
|
|
316
|
+
translationPlugin(locale ?? internationalization.defaultLocale, fallback ? internationalization.defaultLocale : undefined),
|
|
317
|
+
enumerationPlugin,
|
|
318
|
+
conditionPlugin,
|
|
319
|
+
nestedPlugin(locale ?? internationalization.defaultLocale),
|
|
320
|
+
filePlugin,
|
|
321
|
+
genderPlugin,
|
|
322
|
+
intlayerNodePlugins,
|
|
323
|
+
svelteNodePlugins,
|
|
324
|
+
insertionPlugin,
|
|
325
|
+
markdownPlugin,
|
|
326
|
+
htmlPlugin,
|
|
327
|
+
];
|
|
328
|
+
pluginsCache.set(cacheKey, plugins);
|
|
329
|
+
return plugins;
|
|
330
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-intlayer",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.5",
|
|
4
4
|
"description": "Easily internationalize i18n your Svelte applications with type-safe multilingual content management.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intlayer",
|
|
@@ -82,11 +82,11 @@
|
|
|
82
82
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@intlayer/api": "8.7.
|
|
86
|
-
"@intlayer/config": "8.7.
|
|
87
|
-
"@intlayer/core": "8.7.
|
|
88
|
-
"@intlayer/editor": "8.7.
|
|
89
|
-
"@intlayer/types": "8.7.
|
|
85
|
+
"@intlayer/api": "8.7.5",
|
|
86
|
+
"@intlayer/config": "8.7.5",
|
|
87
|
+
"@intlayer/core": "8.7.5",
|
|
88
|
+
"@intlayer/editor": "8.7.5",
|
|
89
|
+
"@intlayer/types": "8.7.5"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@sveltejs/adapter-auto": "7.0.1",
|