From 59c72cefc689e2f69ef9a424a94d9f76db8dd1e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Biro=C5=A1?= Date: Wed, 12 Apr 2023 00:10:37 +0200 Subject: [PATCH] Fix #21916 - using uuid library instead of uuid-browser The library uuid-browser doesn't support esm, so the start with webpack fails. --- code/addons/actions/package.json | 3 ++- code/addons/actions/src/runtime/action.ts | 2 +- code/addons/actions/src/typings.d.ts | 2 -- code/lib/builder-vite/src/optimizeDeps.ts | 1 - code/yarn.lock | 26 ++++++++++++++++------- 5 files changed, 21 insertions(+), 13 deletions(-) delete mode 100644 code/addons/actions/src/typings.d.ts diff --git a/code/addons/actions/package.json b/code/addons/actions/package.json index bf78bb7e60eb..7a5a2ce26c74 100644 --- a/code/addons/actions/package.json +++ b/code/addons/actions/package.json @@ -95,10 +95,11 @@ "react-inspector": "^6.0.0", "telejson": "^7.0.3", "ts-dedent": "^2.0.0", - "uuid-browser": "^3.1.0" + "uuid": "^9.0.0" }, "devDependencies": { "@types/lodash": "^4.14.167", + "@types/uuid": "^9.0.1", "typescript": "~4.9.3" }, "peerDependencies": { diff --git a/code/addons/actions/src/runtime/action.ts b/code/addons/actions/src/runtime/action.ts index 3a0fc25e9cd2..b17647949b86 100644 --- a/code/addons/actions/src/runtime/action.ts +++ b/code/addons/actions/src/runtime/action.ts @@ -1,4 +1,4 @@ -import uuidv4 from 'uuid-browser/v4'; +import { v4 as uuidv4 } from 'uuid'; import { addons } from '@storybook/preview-api'; import { EVENT_ID } from '../constants'; import type { ActionDisplay, ActionOptions, HandlerFunction } from '../models'; diff --git a/code/addons/actions/src/typings.d.ts b/code/addons/actions/src/typings.d.ts deleted file mode 100644 index 331fb83df5f4..000000000000 --- a/code/addons/actions/src/typings.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// TODO: following packages need definition files or a TS migration -declare module 'uuid-browser/v4'; diff --git a/code/lib/builder-vite/src/optimizeDeps.ts b/code/lib/builder-vite/src/optimizeDeps.ts index 644d8e9c0aff..20fe4259ef37 100644 --- a/code/lib/builder-vite/src/optimizeDeps.ts +++ b/code/lib/builder-vite/src/optimizeDeps.ts @@ -117,7 +117,6 @@ const INCLUDE_CANDIDATES = [ 'ts-dedent', 'unfetch', 'util-deprecate', - 'uuid-browser/v4', 'vue', 'warning', ]; diff --git a/code/yarn.lock b/code/yarn.lock index 889cc1f80e2b..12229c47ec18 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5115,6 +5115,7 @@ __metadata: "@storybook/theming": 7.1.0-alpha.1 "@storybook/types": 7.1.0-alpha.1 "@types/lodash": ^4.14.167 + "@types/uuid": ^9.0.1 dequal: ^2.0.2 lodash: ^4.17.21 polished: ^4.2.2 @@ -5123,7 +5124,7 @@ __metadata: telejson: ^7.0.3 ts-dedent: ^2.0.0 typescript: ~4.9.3 - uuid-browser: ^3.1.0 + uuid: ^9.0.0 peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 @@ -8932,6 +8933,13 @@ __metadata: languageName: node linkType: hard +"@types/uuid@npm:^9.0.1": + version: 9.0.1 + resolution: "@types/uuid@npm:9.0.1" + checksum: 234e14e053504a98532bb5d1490c8d649fe24ae04a94ba042b09b380a900094df1032aa7c3864b74b7a85a0a5e97530b2d1340048ed9d07855140cb99b2cefc8 + languageName: node + linkType: hard + "@types/webpack-dev-middleware@npm:^5.3.0": version: 5.3.0 resolution: "@types/webpack-dev-middleware@npm:5.3.0" @@ -30146,13 +30154,6 @@ __metadata: languageName: node linkType: hard -"uuid-browser@npm:^3.1.0": - version: 3.1.0 - resolution: "uuid-browser@npm:3.1.0" - checksum: bfb6bcc8cc75c1adf776370c4f86d00ee5682f7315c8bccb99938e53dafae189ef6a4dc125e67abd2a2cdfaad6020690fe4cb67dbd5b39f32d3ba75fb713d807 - languageName: node - linkType: hard - "uuid@npm:8.3.2, uuid@npm:^8.0.0, uuid@npm:^8.3.2": version: 8.3.2 resolution: "uuid@npm:8.3.2" @@ -30162,6 +30163,15 @@ __metadata: languageName: node linkType: hard +"uuid@npm:^9.0.0": + version: 9.0.0 + resolution: "uuid@npm:9.0.0" + bin: + uuid: dist/bin/uuid + checksum: 8867e438990d1d33ac61093e2e4e3477a2148b844e4fa9e3c2360fa4399292429c4b6ec64537eb1659c97b2d10db349c673ad58b50e2824a11e0d3630de3c056 + languageName: node + linkType: hard + "uvu@npm:^0.5.0": version: 0.5.6 resolution: "uvu@npm:0.5.6"