diff --git a/code/lib/core-server/src/utils/StoryIndexGenerator.ts b/code/lib/core-server/src/utils/StoryIndexGenerator.ts index b916c8d56d56..43eb77997743 100644 --- a/code/lib/core-server/src/utils/StoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/StoryIndexGenerator.ts @@ -17,7 +17,7 @@ import { userOrAutoTitleFromSpecifier, sortStoriesV7 } from '@storybook/store'; import type { StoryIndexer, NormalizedStoriesSpecifier, DocsOptions } from '@storybook/core-common'; import { normalizeStoryPath } from '@storybook/core-common'; import { logger } from '@storybook/node-logger'; -import { getStorySortParameter } from '@storybook/csf-tools'; +import { getStorySortParameter, NoMetaError } from '@storybook/csf-tools'; import type { ComponentTitle, StoryName } from '@storybook/csf'; import { toId } from '@storybook/csf'; @@ -235,7 +235,7 @@ export class StoryIndexGenerator { } } } catch (err) { - if (err.name === 'NoMetaError') { + if (err instanceof NoMetaError) { logger.info(`💡 Skipping ${relativePath}: ${err}`); } else { logger.warn(`🚨 Extraction error on ${relativePath}: ${err}`); diff --git a/code/lib/csf-tools/package.json b/code/lib/csf-tools/package.json index 94cfe3e552e7..444ac29160ea 100644 --- a/code/lib/csf-tools/package.json +++ b/code/lib/csf-tools/package.json @@ -20,9 +20,17 @@ }, "license": "MIT", "sideEffects": false, - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", "files": [ "dist/**/*", "README.md", @@ -31,7 +39,7 @@ ], "scripts": { "check": "../../../scripts/node_modules/.bin/tsc --noEmit", - "prep": "node ../../../scripts/prepare.js" + "prep": "../../../scripts/prepare/bundle.ts" }, "dependencies": { "@babel/generator": "^7.12.11", @@ -39,7 +47,6 @@ "@babel/traverse": "^7.12.11", "@babel/types": "^7.12.11", "@storybook/csf": "0.0.2--canary.0899bb7.0", - "core-js": "^3.8.2", "fs-extra": "^9.0.1", "ts-dedent": "^2.0.0" }, @@ -51,5 +58,10 @@ "publishConfig": { "access": "public" }, + "bundler": { + "entries": [ + "./src/index.ts" + ] + }, "gitHead": "5da5b0fabd04cc5cd5771e8242a960f05d03234a" } diff --git a/code/yarn.lock b/code/yarn.lock index a04026a5835b..cd7f7c3566d3 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -8103,7 +8103,6 @@ __metadata: "@babel/types": ^7.12.11 "@storybook/csf": 0.0.2--canary.0899bb7.0 "@types/fs-extra": ^9.0.6 - core-js: ^3.8.2 fs-extra: ^9.0.1 js-yaml: ^3.14.1 ts-dedent: ^2.0.0