@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,9 +1,9 @@
1
1
  {
2
2
  "name": "AnCore",
3
3
  "configKey": "ancore",
4
- "version": "1.9.2",
4
+ "version": "1.9.4",
5
5
  "builder": {
6
- "@nuxt/module-builder": "1.0.1",
7
- "unbuild": "3.5.0"
6
+ "@nuxt/module-builder": "1.0.2",
7
+ "unbuild": "3.6.1"
8
8
  }
9
9
  }
@@ -1,6 +1,6 @@
1
- declare const _default: (resources?: Record<string, any>) => Promise<{
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 async (resources) => {
3
+ export default (resources) => {
4
4
  if (!resources) return { t: i18next.t };
5
- const ns = await getJSONHash(resources);
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) => Promise<string>;
1
+ export declare const getJSONHash: (obj: object) => string;
@@ -1,6 +1,8 @@
1
- export const getJSONHash = async (obj) => {
2
- const str = JSON.stringify(obj);
3
- const bytes = new TextEncoder().encode(str);
4
- const digest = await crypto.subtle.digest("SHA-256", bytes);
5
- return Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
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.2",
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
- "@nuxt/kit": "^4.0.1",
36
- "@vueuse/core": "^13.5.0",
37
- "@vueuse/integrations": "^13.5.0",
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
- "crypto-js": "^4.2.0",
40
- "i18next": "^25.3.2"
40
+ "i18next": "^25.5.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@nuxt/devtools": "^2.6.2",
44
- "@nuxt/module-builder": "^1.0.1",
45
- "@nuxt/schema": "^4.0.1",
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.1",
50
- "typescript": "~5.8.3"
48
+ "nuxt": "^4.1.0",
49
+ "typescript": "~5.9.2"
51
50
  }
52
51
  }