svelte-intlayer 9.3.2 → 9.4.0-canary.0
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/README.md +1 -1
- package/dist/client/useDictionaryDynamic.js +11 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -327,4 +327,4 @@ Contribute on [GitHub](https://github.com/aymericzip/intlayer), [GitLab](https:/
|
|
|
327
327
|
|
|
328
328
|
If you like Intlayer, give us a ⭐ on GitHub. It helps others discover the project! [See why GitHub Stars matter](https://github.com/aymericzip/intlayer/blob/main/CONTRIBUTING.md#why-github-stars-matter-).
|
|
329
329
|
|
|
330
|
-
[](https://star-history.dera.page/#aymericzip/intlayer&Date)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isQualifiedDynamicLoaderMap, resolveProviderVariant, resolveQualifiedDynamicContentAsync, } from '@intlayer/core/dictionaryManipulator';
|
|
1
|
+
import { getPreloadedDictionary, isQualifiedDynamicLoaderMap, resolveProviderVariant, resolveQualifiedDynamicContentAsync, } from '@intlayer/core/dictionaryManipulator';
|
|
2
2
|
import { derived } from 'svelte/store';
|
|
3
3
|
import { getDictionary } from '../getDictionary';
|
|
4
4
|
import { getIntlayerContext } from './intlayerContext';
|
|
@@ -71,6 +71,16 @@ export function useDictionaryDynamic(dictionaryPromise, key, localeOrSelector) {
|
|
|
71
71
|
: localeOrSelector;
|
|
72
72
|
const localeStore = derived(intlayerStore, ($store) => explicitLocale ?? context?.locale ?? $store.locale);
|
|
73
73
|
return derived(localeStore, ($locale, set) => {
|
|
74
|
+
// A build-tool plugin may have resolved this locale's dictionary while
|
|
75
|
+
// the entry point evaluated. Publishing it synchronously lets the store
|
|
76
|
+
// open on real content — otherwise every dynamic dictionary starts on
|
|
77
|
+
// `loadingProxy()` and flips a microtask later, one placeholder frame
|
|
78
|
+
// each, even when nothing has to be fetched.
|
|
79
|
+
const preloadedDictionary = getPreloadedDictionary(dictionaryPromise, $locale);
|
|
80
|
+
if (preloadedDictionary) {
|
|
81
|
+
set(withState(getDictionary(preloadedDictionary, $locale)));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
74
84
|
// Set loading state immediately with proxy
|
|
75
85
|
set(loadingProxy());
|
|
76
86
|
let isCancelled = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-intlayer",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.0-canary.0",
|
|
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": "9.
|
|
86
|
-
"@intlayer/config": "9.
|
|
87
|
-
"@intlayer/core": "9.
|
|
88
|
-
"@intlayer/editor": "9.
|
|
89
|
-
"@intlayer/types": "9.
|
|
85
|
+
"@intlayer/api": "9.4.0-canary.0",
|
|
86
|
+
"@intlayer/config": "9.4.0-canary.0",
|
|
87
|
+
"@intlayer/core": "9.4.0-canary.0",
|
|
88
|
+
"@intlayer/editor": "9.4.0-canary.0",
|
|
89
|
+
"@intlayer/types": "9.4.0-canary.0"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@sveltejs/adapter-auto": "7.0.1",
|
|
@@ -101,14 +101,14 @@
|
|
|
101
101
|
"svelte-check": "4.7.5",
|
|
102
102
|
"tsdown": "0.22.14",
|
|
103
103
|
"typescript": "5.9.3",
|
|
104
|
-
"vite": "8.2.
|
|
105
|
-
"vitest": "4.1.
|
|
104
|
+
"vite": "8.2.2",
|
|
105
|
+
"vitest": "4.1.11"
|
|
106
106
|
},
|
|
107
107
|
"peerDependencies": {
|
|
108
108
|
"svelte": ">=5.0.0"
|
|
109
109
|
},
|
|
110
110
|
"optionalDependencies": {
|
|
111
|
-
"@intlayer/analytics": "9.
|
|
111
|
+
"@intlayer/analytics": "9.4.0-canary.0"
|
|
112
112
|
},
|
|
113
113
|
"engines": {
|
|
114
114
|
"node": ">=14.18"
|