From b54f7ab1face063a6d338f2c490c6ea65d15c125 Mon Sep 17 00:00:00 2001 From: hypercross Date: Wed, 8 Jul 2026 11:48:25 +0800 Subject: [PATCH] chore: add uuid dependency --- package-lock.json | 30 ++++++++++++++++++++++++++---- package.json | 2 ++ src/components/md-deck/index.tsx | 3 ++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index cc5b115..2b1f43a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,6 +29,7 @@ "solid-js": "^1.9.3", "three": "^0.183.2", "three-3mf-exporter": "^45.1.0", + "uuid": "^14.0.1", "ws": "^8.21.0", "yarn-spinner-loader": "^0.1.0", "zod": "^4.4.3" @@ -47,6 +48,7 @@ "@types/jest": "^30.0.0", "@types/js-yaml": "^4.0.9", "@types/node": "^22.19.13", + "@types/uuid": "^10.0.0", "@types/ws": "^8.18.1", "husky": "^9.1.7", "jest": "^29.7.0", @@ -3389,6 +3391,13 @@ "license": "MIT", "optional": true }, + "node_modules/@types/uuid": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/webxr": { "version": "0.5.24", "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.24.tgz", @@ -8514,6 +8523,19 @@ "node": ">= 20" } }, + "node_modules/mermaid/node_modules/uuid": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.1.tgz", + "integrity": "sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/esm/bin/uuid" + } + }, "node_modules/meshoptimizer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/meshoptimizer/-/meshoptimizer-1.0.1.tgz", @@ -10338,16 +10360,16 @@ "license": "MIT" }, "node_modules/uuid": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", - "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.1.tgz", + "integrity": "sha512-6ZxzVpzDXDa3bJWaHilVayA+BH/1zmxCJoVgvmqJnid/gPoKHxUrS/aC/T6LGQtNHT+XHG9fXPJB4d+IrU30Ew==", "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], "license": "MIT", "bin": { - "uuid": "dist/esm/bin/uuid" + "uuid": "dist-node/bin/uuid" } }, "node_modules/v8-compile-cache-lib": { diff --git a/package.json b/package.json index 3896d16..40e2bd1 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "solid-js": "^1.9.3", "three": "^0.183.2", "three-3mf-exporter": "^45.1.0", + "uuid": "^14.0.1", "ws": "^8.21.0", "yarn-spinner-loader": "^0.1.0", "zod": "^4.4.3" @@ -67,6 +68,7 @@ "@types/jest": "^30.0.0", "@types/js-yaml": "^4.0.9", "@types/node": "^22.19.13", + "@types/uuid": "^10.0.0", "@types/ws": "^8.18.1", "husky": "^9.1.7", "jest": "^29.7.0", diff --git a/src/components/md-deck/index.tsx b/src/components/md-deck/index.tsx index bd86b9e..32c54e9 100644 --- a/src/components/md-deck/index.tsx +++ b/src/components/md-deck/index.tsx @@ -1,6 +1,7 @@ import { customElement, noShadowDOM } from "solid-element"; import { Show, onCleanup } from "solid-js"; import { resolvePath } from "../utils/path"; +import { v4 as uuidv4 } from "uuid"; import { createDeckStore } from "./hooks/deckStore"; import { registerDeck, unregisterDeck } from "./hooks/deck-registry"; import type { CardShape } from "./types"; @@ -66,7 +67,7 @@ customElement( const store = createDeckStore(resolvedSrc); // 生成唯一 ID 并注册到全局注册表 - const deckId = `deck-${crypto.randomUUID()}`; + const deckId = `deck-${uuidv4()}`; registerDeck(deckId, store, resolvedSrc, csvPath); // 解析 size 属性(支持旧格式 "54x86" 和新格式)