diff --git a/CHANGELOG.md b/CHANGELOG.md index 66d87cccc4c8..f44e6e3dfdf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 8.1.4 + +- Angular: Revert style adjustments - [#27361](https://github.com/storybookjs/storybook/pull/27361), thanks @valentinpalkovic! +- Svelte: Support latest prerelease - [#27378](https://github.com/storybookjs/storybook/pull/27378), thanks @valentinpalkovic! +- Tags: Fix composition with older storybooks - [#27358](https://github.com/storybookjs/storybook/pull/27358), thanks @shilman! +- Vite: Fix HMR issue for Storybook preview files - [#27256](https://github.com/storybookjs/storybook/pull/27256), thanks @valentinpalkovic! + ## 8.1.3 - Angular: Support v18 - [#27237](https://github.com/storybookjs/storybook/pull/27237), thanks @valentinpalkovic! diff --git a/CHANGELOG.prerelease.md b/CHANGELOG.prerelease.md index c989504cf696..8d60a9ad49f8 100644 --- a/CHANGELOG.prerelease.md +++ b/CHANGELOG.prerelease.md @@ -1,3 +1,11 @@ +## 8.2.0-alpha.4 + +- CSF-Tools: Fix export specifier bug - [#27418](https://github.com/storybookjs/storybook/pull/27418), thanks @valentinpalkovic! +- Dependency: Upgrade tempy - [#27366](https://github.com/storybookjs/storybook/pull/27366), thanks @mnigh! +- Tags: Refine composition behavior - [#27379](https://github.com/storybookjs/storybook/pull/27379), thanks @shilman! +- Theming: Fix self-referencing type - [#27155](https://github.com/storybookjs/storybook/pull/27155), thanks @SimenB! +- Vue3: Enable new hydration mismatch compile time flag - [#27192](https://github.com/storybookjs/storybook/pull/27192), thanks @Cherry! + ## 8.2.0-alpha.3 - Addon-A11y: Fix property default assignment - [#27224](https://github.com/storybookjs/storybook/pull/27224), thanks @valentinpalkovic! diff --git a/code/lib/cli/package.json b/code/lib/cli/package.json index 888fb92b173b..91d40ba7fb20 100644 --- a/code/lib/cli/package.json +++ b/code/lib/cli/package.json @@ -89,7 +89,7 @@ "read-pkg-up": "^7.0.1", "semver": "^7.3.7", "strip-json-comments": "^3.0.1", - "tempy": "^1.0.1", + "tempy": "^3.1.0", "tiny-invariant": "^1.3.1", "ts-dedent": "^2.0.0" }, diff --git a/code/lib/cli/src/automigrate/index.ts b/code/lib/cli/src/automigrate/index.ts index 340a90f7ec38..c5353602dbaa 100644 --- a/code/lib/cli/src/automigrate/index.ts +++ b/code/lib/cli/src/automigrate/index.ts @@ -2,7 +2,6 @@ import prompts from 'prompts'; import chalk from 'chalk'; import boxen from 'boxen'; import { createWriteStream, move, remove } from 'fs-extra'; -import tempy from 'tempy'; import { join } from 'path'; import invariant from 'tiny-invariant'; import semver from 'semver'; @@ -40,8 +39,9 @@ let TEMP_LOG_FILE_PATH = ''; const originalStdOutWrite = process.stdout.write.bind(process.stdout); const originalStdErrWrite = process.stderr.write.bind(process.stdout); -const augmentLogsToFile = () => { - TEMP_LOG_FILE_PATH = tempy.file({ name: LOG_FILE_NAME }); +const augmentLogsToFile = async () => { + const { temporaryFile } = await import('tempy'); + TEMP_LOG_FILE_PATH = temporaryFile({ name: LOG_FILE_NAME }); const logStream = createWriteStream(TEMP_LOG_FILE_PATH); process.stdout.write = (d: string) => { @@ -158,7 +158,7 @@ export const automigrate = async ({ return null; } - augmentLogsToFile(); + await augmentLogsToFile(); logger.info('🔎 checking possible migrations..'); diff --git a/code/lib/cli/src/dirs.ts b/code/lib/cli/src/dirs.ts index 1f41620b4ea6..7751e6c3a641 100644 --- a/code/lib/cli/src/dirs.ts +++ b/code/lib/cli/src/dirs.ts @@ -2,7 +2,6 @@ import { dirname, join } from 'path'; import downloadTarball from '@ndelangen/get-tarball'; import getNpmTarballUrl from 'get-npm-tarball-url'; -import * as tempy from 'tempy'; import invariant from 'tiny-invariant'; import { externalFrameworks } from './project_types'; @@ -16,7 +15,8 @@ export function getCliDir() { } const resolveUsingBranchInstall = async (packageManager: JsPackageManager, request: string) => { - const tempDirectory = tempy.directory(); + const { temporaryDirectory } = await import('tempy'); + const tempDirectory = temporaryDirectory(); const name = request as keyof typeof versions; // FIXME: this might not be the right version for community packages diff --git a/code/lib/cli/src/doctor/index.ts b/code/lib/cli/src/doctor/index.ts index 2dfecaa96d17..22e47ce7d32c 100644 --- a/code/lib/cli/src/doctor/index.ts +++ b/code/lib/cli/src/doctor/index.ts @@ -1,7 +1,6 @@ import chalk from 'chalk'; import boxen from 'boxen'; import { createWriteStream, move, remove } from 'fs-extra'; -import tempy from 'tempy'; import dedent from 'ts-dedent'; import { join } from 'path'; @@ -24,8 +23,9 @@ let TEMP_LOG_FILE_PATH = ''; const originalStdOutWrite = process.stdout.write.bind(process.stdout); const originalStdErrWrite = process.stderr.write.bind(process.stdout); -const augmentLogsToFile = () => { - TEMP_LOG_FILE_PATH = tempy.file({ name: LOG_FILE_NAME }); +const augmentLogsToFile = async () => { + const { temporaryFile } = await import('tempy'); + TEMP_LOG_FILE_PATH = temporaryFile({ name: LOG_FILE_NAME }); const logStream = createWriteStream(TEMP_LOG_FILE_PATH); process.stdout.write = (d: string) => { @@ -51,7 +51,7 @@ export const doctor = async ({ configDir: userSpecifiedConfigDir, packageManager: pkgMgr, }: DoctorOptions = {}) => { - augmentLogsToFile(); + await augmentLogsToFile(); let foundIssues = false; const logDiagnostic = (title: string, message: string) => { diff --git a/code/lib/core-common/package.json b/code/lib/core-common/package.json index 0e061801147f..a783e05165f1 100644 --- a/code/lib/core-common/package.json +++ b/code/lib/core-common/package.json @@ -69,7 +69,7 @@ "pretty-hrtime": "^1.0.3", "resolve-from": "^5.0.0", "semver": "^7.3.7", - "tempy": "^1.0.1", + "tempy": "^3.1.0", "tiny-invariant": "^1.3.1", "ts-dedent": "^2.0.0", "util": "^0.12.4" diff --git a/code/lib/core-common/src/utils/cli.ts b/code/lib/core-common/src/utils/cli.ts index c4103bd59137..15b1c1ff0abc 100644 --- a/code/lib/core-common/src/utils/cli.ts +++ b/code/lib/core-common/src/utils/cli.ts @@ -1,7 +1,6 @@ import type { WriteStream } from 'fs-extra'; import { move, remove, writeFile, readFile, createWriteStream } from 'fs-extra'; import { join } from 'path'; -import tempy from 'tempy'; import { rendererPackages } from './get-storybook-info'; import type { JsPackageManager } from '../js-package-manager'; import versions from '../versions'; @@ -86,7 +85,8 @@ export const createLogStream = async ( logStream: WriteStream; }> => { const finalLogPath = join(process.cwd(), logFileName); - const temporaryLogPath = tempy.file({ name: logFileName }); + const { temporaryFile } = await import('tempy'); + const temporaryLogPath = temporaryFile({ name: logFileName }); const logStream = createWriteStream(temporaryLogPath, { encoding: 'utf8' }); diff --git a/code/lib/csf-tools/src/ConfigFile.test.ts b/code/lib/csf-tools/src/ConfigFile.test.ts index 4623b369b3cd..bc176b79825d 100644 --- a/code/lib/csf-tools/src/ConfigFile.test.ts +++ b/code/lib/csf-tools/src/ConfigFile.test.ts @@ -216,7 +216,7 @@ describe('ConfigFile', () => { ) ).toEqual([{ directory: '../src', titlePrefix: 'Demo' }]); }); - it('export specfier', () => { + it('export specifier', () => { expect( getField( ['foo'], @@ -227,6 +227,17 @@ describe('ConfigFile', () => { ) ).toEqual('bar'); }); + it('export aliased specifier', () => { + expect( + getField( + ['fooAlias'], + dedent` + const foo = 'bar'; + export { foo as fooAlias }; + ` + ) + ).toEqual('bar'); + }); }); }); diff --git a/code/lib/csf-tools/src/ConfigFile.ts b/code/lib/csf-tools/src/ConfigFile.ts index 9dfcacc889c5..9a7f68c08ef3 100644 --- a/code/lib/csf-tools/src/ConfigFile.ts +++ b/code/lib/csf-tools/src/ConfigFile.ts @@ -224,9 +224,14 @@ export class ConfigFile { } else if (node.specifiers) { // export { X }; node.specifiers.forEach((spec) => { - if (t.isExportSpecifier(spec) && t.isIdentifier(spec.exported)) { + if ( + t.isExportSpecifier(spec) && + t.isIdentifier(spec.local) && + t.isIdentifier(spec.exported) + ) { + const { name: localName } = spec.local; const { name: exportName } = spec.exported; - const decl = _findVarDeclarator(exportName, parent as t.Program) as any; + const decl = _findVarDeclarator(localName, parent as t.Program) as any; self._exports[exportName] = decl.init; self._exportDecls[exportName] = decl; } diff --git a/code/lib/manager-api/src/lib/stories.ts b/code/lib/manager-api/src/lib/stories.ts index b409754bb106..db8cc4c1efb3 100644 --- a/code/lib/manager-api/src/lib/stories.ts +++ b/code/lib/manager-api/src/lib/stories.ts @@ -153,7 +153,7 @@ export const transformStoryIndexV4toV5 = ( (acc, entry) => { acc[entry.id] = { ...entry, - tags: entry.tags ? [...entry.tags, 'dev'] : ['dev'], + tags: entry.tags ? ['dev', 'test', ...entry.tags] : ['dev'], }; return acc; diff --git a/code/lib/theming/src/emotionAugmentation.d.ts b/code/lib/theming/src/emotionAugmentation.d.ts index 1a48313f84e4..d5ceb8b427f6 100644 --- a/code/lib/theming/src/emotionAugmentation.d.ts +++ b/code/lib/theming/src/emotionAugmentation.d.ts @@ -4,6 +4,6 @@ import '@emotion/react'; declare module '@emotion/react' { - type StorybookTheme = import('./types').StorybookTheme; - export interface Theme extends StorybookTheme {} + type StorybookThemeInterface = import('./types').StorybookTheme; + export interface Theme extends StorybookThemeInterface {} } diff --git a/code/package.json b/code/package.json index cd913e8cd049..e525d887eaaf 100644 --- a/code/package.json +++ b/code/package.json @@ -298,5 +298,6 @@ "Dependency Upgrades" ] ] - } + }, + "deferredNextVersion": "8.2.0-alpha.4" } diff --git a/code/presets/vue3-webpack/src/framework-preset-vue3.ts b/code/presets/vue3-webpack/src/framework-preset-vue3.ts index df7f684be456..4db6822fe542 100644 --- a/code/presets/vue3-webpack/src/framework-preset-vue3.ts +++ b/code/presets/vue3-webpack/src/framework-preset-vue3.ts @@ -11,6 +11,7 @@ export const webpack: StorybookConfig['webpack'] = (config) => { new DefinePlugin({ __VUE_OPTIONS_API__: JSON.stringify(true), __VUE_PROD_DEVTOOLS__: JSON.stringify(true), + __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: JSON.stringify(true), }), ], module: { diff --git a/code/yarn.lock b/code/yarn.lock index 16d76a138946..062a9ad5cdb5 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5795,7 +5795,7 @@ __metadata: slash: "npm:^5.0.0" strip-ansi: "npm:^7.1.0" strip-json-comments: "npm:^3.1.1" - tempy: "npm:^1.0.1" + tempy: "npm:^3.1.0" tiny-invariant: "npm:^1.3.1" ts-dedent: "npm:^2.0.0" typescript: "npm:^5.3.2" @@ -5924,7 +5924,7 @@ __metadata: resolve-from: "npm:^5.0.0" semver: "npm:^7.3.7" slash: "npm:^5.0.0" - tempy: "npm:^1.0.1" + tempy: "npm:^3.1.0" tiny-invariant: "npm:^1.3.1" ts-dedent: "npm:^2.0.0" type-fest: "npm:~2.19" @@ -12633,10 +12633,12 @@ __metadata: languageName: node linkType: hard -"crypto-random-string@npm:^2.0.0": - version: 2.0.0 - resolution: "crypto-random-string@npm:2.0.0" - checksum: 10c0/288589b2484fe787f9e146f56c4be90b940018f17af1b152e4dde12309042ff5a2bf69e949aab8b8ac253948381529cc6f3e5a2427b73643a71ff177fa122b37 +"crypto-random-string@npm:^4.0.0": + version: 4.0.0 + resolution: "crypto-random-string@npm:4.0.0" + dependencies: + type-fest: "npm:^1.0.1" + checksum: 10c0/16e11a3c8140398f5408b7fded35a961b9423c5dac39a60cbbd08bd3f0e07d7de130e87262adea7db03ec1a7a4b7551054e0db07ee5408b012bac5400cfc07a5 languageName: node linkType: hard @@ -13121,22 +13123,6 @@ __metadata: languageName: node linkType: hard -"del@npm:^6.0.0": - version: 6.1.1 - resolution: "del@npm:6.1.1" - dependencies: - globby: "npm:^11.0.1" - graceful-fs: "npm:^4.2.4" - is-glob: "npm:^4.0.1" - is-path-cwd: "npm:^2.2.0" - is-path-inside: "npm:^3.0.2" - p-map: "npm:^4.0.0" - rimraf: "npm:^3.0.2" - slash: "npm:^3.0.0" - checksum: 10c0/8a095c5ccade42c867a60252914ae485ec90da243d735d1f63ec1e64c1cfbc2b8810ad69a29ab6326d159d4fddaa2f5bad067808c42072351ec458efff86708f - languageName: node - linkType: hard - "delay@npm:^5.0.0": version: 5.0.0 resolution: "delay@npm:5.0.0" @@ -16366,7 +16352,7 @@ __metadata: languageName: node linkType: hard -"globby@npm:^11.0.1, globby@npm:^11.1.0": +"globby@npm:^11.1.0": version: 11.1.0 resolution: "globby@npm:11.1.0" dependencies: @@ -17965,13 +17951,6 @@ __metadata: languageName: node linkType: hard -"is-path-cwd@npm:^2.2.0": - version: 2.2.0 - resolution: "is-path-cwd@npm:2.2.0" - checksum: 10c0/afce71533a427a759cd0329301c18950333d7589533c2c90205bd3fdcf7b91eb92d1940493190567a433134d2128ec9325de2fd281e05be1920fbee9edd22e0a - languageName: node - linkType: hard - "is-path-inside@npm:^3.0.2, is-path-inside@npm:^3.0.3": version: 3.0.3 resolution: "is-path-inside@npm:3.0.3" @@ -27223,10 +27202,10 @@ __metadata: languageName: node linkType: hard -"temp-dir@npm:^2.0.0": - version: 2.0.0 - resolution: "temp-dir@npm:2.0.0" - checksum: 10c0/b1df969e3f3f7903f3426861887ed76ba3b495f63f6d0c8e1ce22588679d9384d336df6064210fda14e640ed422e2a17d5c40d901f60e161c99482d723f4d309 +"temp-dir@npm:^3.0.0": + version: 3.0.0 + resolution: "temp-dir@npm:3.0.0" + checksum: 10c0/a86978a400984cd5f315b77ebf3fe53bb58c61f192278cafcb1f3fb32d584a21dc8e08b93171d7874b7cc972234d3455c467306cc1bfc4524b622e5ad3bfd671 languageName: node linkType: hard @@ -27239,16 +27218,15 @@ __metadata: languageName: node linkType: hard -"tempy@npm:^1.0.1": - version: 1.0.1 - resolution: "tempy@npm:1.0.1" +"tempy@npm:^3.1.0": + version: 3.1.0 + resolution: "tempy@npm:3.1.0" dependencies: - del: "npm:^6.0.0" - is-stream: "npm:^2.0.0" - temp-dir: "npm:^2.0.0" - type-fest: "npm:^0.16.0" - unique-string: "npm:^2.0.0" - checksum: 10c0/864a1cf1b5536dc21e84ae45dbbc3ba4dd2c7ec1674d895f99c349cf209df959a53d797ca38d0b2cf69c7684d565fde5cfc67faaa63b7208ffb21d454b957472 + is-stream: "npm:^3.0.0" + temp-dir: "npm:^3.0.0" + type-fest: "npm:^2.12.2" + unique-string: "npm:^3.0.0" + checksum: 10c0/b88e70baa8d935ba8f0e0372b59ad1a961121f098da5fb4a6e05bec98ec32a49026b553532fb75c1c102ec782fd4c6a6bde0d46cbe87013fa324451ce476fb76 languageName: node linkType: hard @@ -28214,12 +28192,12 @@ __metadata: languageName: node linkType: hard -"unique-string@npm:^2.0.0": - version: 2.0.0 - resolution: "unique-string@npm:2.0.0" +"unique-string@npm:^3.0.0": + version: 3.0.0 + resolution: "unique-string@npm:3.0.0" dependencies: - crypto-random-string: "npm:^2.0.0" - checksum: 10c0/11820db0a4ba069d174bedfa96c588fc2c96b083066fafa186851e563951d0de78181ac79c744c1ed28b51f9d82ac5b8196ff3e4560d0178046ef455d8c2244b + crypto-random-string: "npm:^4.0.0" + checksum: 10c0/b35ea034b161b2a573666ec16c93076b4b6106b8b16c2415808d747ab3a0566b5db0c4be231d4b11cfbc16d7fd915c9d8a45884bff0e2db11b799775b2e1e017 languageName: node linkType: hard diff --git a/docs/snippets/angular/tags-combo-example.ts.mdx b/docs/snippets/angular/tags-combo-example.ts.mdx index bc239f26aeff..08c93ebcaaf8 100644 --- a/docs/snippets/angular/tags-combo-example.ts.mdx +++ b/docs/snippets/angular/tags-combo-example.ts.mdx @@ -13,13 +13,13 @@ type Story = StoryObj