@anweb/nuxt-ancore 1.9.2 → 1.9.4
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/module.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare const _default: (resources?: Record<string, any>) =>
|
|
1
|
+
declare const _default: (resources?: Record<string, any>) => {
|
|
2
2
|
t: import("i18next").TFunction<["translation", ...string[]], undefined>;
|
|
3
3
|
} | {
|
|
4
4
|
t: (key: string, options?: {}) => string;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
6
|
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import i18next from "i18next";
|
|
2
2
|
import { getJSONHash } from "../utils/index.js";
|
|
3
|
-
export default
|
|
3
|
+
export default (resources) => {
|
|
4
4
|
if (!resources) return { t: i18next.t };
|
|
5
|
-
const ns =
|
|
5
|
+
const ns = getJSONHash(resources);
|
|
6
6
|
for (const lang in resources) {
|
|
7
7
|
if (!i18next.hasResourceBundle(lang, ns)) {
|
|
8
8
|
i18next.addResourceBundle(lang, ns, resources[lang]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getJSONHash: (obj: object) =>
|
|
1
|
+
export declare const getJSONHash: (obj: object) => string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
1
|
+
import { sha256 } from "@noble/hashes/sha2";
|
|
2
|
+
import { utf8ToBytes, bytesToHex } from "@noble/hashes/utils";
|
|
3
|
+
export const getJSONHash = (obj) => {
|
|
4
|
+
const s = JSON.stringify(obj);
|
|
5
|
+
const bytes = utf8ToBytes(s);
|
|
6
|
+
const digest = sha256(bytes);
|
|
7
|
+
return bytesToHex(digest);
|
|
6
8
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anweb/nuxt-ancore",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.4",
|
|
4
4
|
"description": "AnCore Nuxt module",
|
|
5
5
|
"repository": "https://github.com/ANLTD/ancore",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,21 +32,20 @@
|
|
|
32
32
|
"release:major": "npm run prepack && changelogen --bump major --release && npm publish --access public && git push --follow-tags"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@vueuse/
|
|
35
|
+
"@noble/hashes": "^2.0.0",
|
|
36
|
+
"@nuxt/kit": "^4.1.0",
|
|
37
|
+
"@vueuse/core": "^13.9.0",
|
|
38
|
+
"@vueuse/integrations": "^13.9.0",
|
|
38
39
|
"async-validator": "^4.2.5",
|
|
39
|
-
"
|
|
40
|
-
"i18next": "^25.3.2"
|
|
40
|
+
"i18next": "^25.5.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@nuxt/devtools": "^2.6.
|
|
44
|
-
"@nuxt/module-builder": "^1.0.
|
|
45
|
-
"@nuxt/schema": "^4.0
|
|
46
|
-
"@types/crypto-js": "^4.2.2",
|
|
43
|
+
"@nuxt/devtools": "^2.6.3",
|
|
44
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
45
|
+
"@nuxt/schema": "^4.1.0",
|
|
47
46
|
"@types/node": "latest",
|
|
48
47
|
"changelogen": "^0.6.2",
|
|
49
|
-
"nuxt": "^4.0
|
|
50
|
-
"typescript": "~5.
|
|
48
|
+
"nuxt": "^4.1.0",
|
|
49
|
+
"typescript": "~5.9.2"
|
|
51
50
|
}
|
|
52
51
|
}
|