From a725eda543c052d06a14f26a88b0fa5256950ae8 Mon Sep 17 00:00:00 2001 From: 43081j <43081j@users.noreply.github.com> Date: Mon, 6 May 2024 23:27:03 +0100 Subject: [PATCH 01/26] feat: migrate from express to connect Migrates away from express, instead using connect and the underlying node server directly. Both express and connect support the same middleware structure, which means most middleware packages work for both and have remained the same in this change. A few notes: - Express' router has been replaced by basic connect mount points (though the two are not equivalent exactly) - Express static has been replaced by sirv This trims a large sub-tree of dependencies from our packages which express was pulling in. We in fact use very little of the functionality express gives us, only really making use of the connect-style API anyway. --- code/builders/builder-manager/package.json | 2 +- code/builders/builder-manager/src/index.ts | 48 ++++++-- code/builders/builder-vite/package.json | 3 +- code/builders/builder-vite/src/index.ts | 35 ++++-- code/builders/builder-webpack5/package.json | 2 +- code/builders/builder-webpack5/src/index.ts | 22 +++- code/lib/core-server/package.json | 3 +- code/lib/core-server/src/dev-server.ts | 23 ++-- code/lib/core-server/src/utils/doTelemetry.ts | 5 +- .../src/utils/get-caching-middleware.ts | 6 +- .../src/utils/getAccessControlMiddleware.ts | 12 +- .../src/utils/getStoryIndexGenerator.ts | 5 +- code/lib/core-server/src/utils/metadata.ts | 11 +- code/lib/core-server/src/utils/router.ts | 5 - code/lib/core-server/src/utils/server-init.ts | 4 +- .../core-server/src/utils/server-statics.ts | 112 +++++++++++++----- .../src/utils/stories-json.test.ts | 14 +-- .../lib/core-server/src/utils/stories-json.ts | 18 +-- code/lib/types/package.json | 1 - code/lib/types/src/modules/core-common.ts | 10 +- code/package.json | 1 - code/yarn.lock | 79 ++++++++++-- 22 files changed, 290 insertions(+), 131 deletions(-) delete mode 100644 code/lib/core-server/src/utils/router.ts diff --git a/code/builders/builder-manager/package.json b/code/builders/builder-manager/package.json index a472f7c4f33..de3bebff0b5 100644 --- a/code/builders/builder-manager/package.json +++ b/code/builders/builder-manager/package.json @@ -54,9 +54,9 @@ "ejs": "^3.1.8", "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0", "esbuild-plugin-alias": "^0.2.1", - "express": "^4.17.3", "fs-extra": "^11.1.0", "process": "^0.11.10", + "sirv": "^2.0.4", "util": "^0.12.4" }, "devDependencies": { diff --git a/code/builders/builder-manager/src/index.ts b/code/builders/builder-manager/src/index.ts index 28e6fdd5a55..cb534642363 100644 --- a/code/builders/builder-manager/src/index.ts +++ b/code/builders/builder-manager/src/index.ts @@ -1,6 +1,6 @@ import { dirname, join, parse } from 'path'; import fs from 'fs-extra'; -import express from 'express'; +import sirv from 'sirv'; import { logger } from '@storybook/node-logger'; @@ -26,6 +26,7 @@ import { safeResolve } from './utils/safeResolve'; import { readOrderedFiles } from './utils/files'; import { buildFrameworkGlobalsFromOptions } from './utils/framework'; +const isRootPath = /^\/($|\?)/; let compilation: Compilation; let asyncIterator: ReturnType | ReturnType; @@ -124,7 +125,7 @@ export const executor = { const starter: StarterFunction = async function* starterGeneratorFn({ startTime, options, - router, + app, }) { logger.info('=> Starting manager..'); @@ -159,8 +160,33 @@ const starter: StarterFunction = async function* starterGeneratorFn({ const coreDirOrigin = join(dirname(require.resolve('@storybook/manager/package.json')), 'dist'); - router.use(`/sb-addons`, express.static(addonsDir, { immutable: true, maxAge: '5m' })); - router.use(`/sb-manager`, express.static(coreDirOrigin, { immutable: true, maxAge: '5m' })); + const serveAddons = sirv(addonsDir, { + maxAge: 300000, + dev: true, + immutable: true + }); + const serveCore = sirv(coreDirOrigin, { + maxAge: 300000, + dev: true, + immutable: true + }); + // TODO (43081j): maybe abstract this into a reusable function + app.use('/sb-addons', (req, res, next) => { + if (!req.url || req.url === '/') { + next(); + return; + } + + serveAddons(req, res, next); + }); + app.use('/sb-manager', (req, res, next) => { + if (!req.url || req.url === '/') { + next(); + return; + } + + serveCore(req, res, next); + }); const { cssFiles, jsFiles } = await readOrderedFiles(addonsDir, compilation?.outputFiles); @@ -187,15 +213,19 @@ const starter: StarterFunction = async function* starterGeneratorFn({ yield; - router.use(`/`, ({ path }, res, next) => { - if (path === '/') { - res.status(200).send(html); + app.use('/', ({ url }, res, next) => { + if (isRootPath.test(url)) { + res.statusCode = 200; + res.write(html); + res.end(); } else { next(); } }); - router.use(`/index.html`, ({ path }, res) => { - res.status(200).send(html); + app.use(`/index.html`, (req, res) => { + res.statusCode = 200; + res.write(html); + res.end(); }); return { diff --git a/code/builders/builder-vite/package.json b/code/builders/builder-vite/package.json index db351000c36..2e44fa1136c 100644 --- a/code/builders/builder-vite/package.json +++ b/code/builders/builder-vite/package.json @@ -55,14 +55,13 @@ "@types/find-cache-dir": "^3.2.1", "browser-assert": "^1.2.1", "es-module-lexer": "^1.5.0", - "express": "^4.17.3", "find-cache-dir": "^3.0.0", "fs-extra": "^11.1.0", "magic-string": "^0.30.0", + "sirv": "^2.0.4", "ts-dedent": "^2.0.0" }, "devDependencies": { - "@types/express": "^4.17.13", "@types/node": "^18.0.0", "glob": "^10.0.0", "slash": "^5.0.0", diff --git a/code/builders/builder-vite/src/index.ts b/code/builders/builder-vite/src/index.ts index 3c0b7591d2c..798ab03f147 100644 --- a/code/builders/builder-vite/src/index.ts +++ b/code/builders/builder-vite/src/index.ts @@ -1,9 +1,8 @@ // noinspection JSUnusedGlobalSymbols import * as fs from 'fs-extra'; -import type { RequestHandler } from 'express'; +import type {NextHandleFunction} from 'connect'; import type { ViteDevServer } from 'vite'; -import express from 'express'; import { dirname, join, parse } from 'path'; import { NoStatsForViteDevError } from '@storybook/core-events/server-errors'; import type { Options } from '@storybook/types'; @@ -11,6 +10,7 @@ import { transformIframeHtml } from './transform-iframe-html'; import { createViteServer } from './vite-server'; import { build as viteBuild } from './build'; import type { ViteBuilder } from './types'; +import sirv from 'sirv'; export { withoutVitePlugins } from './utils/without-vite-plugins'; export { hasVitePlugins } from './utils/has-vite-plugins'; @@ -20,16 +20,17 @@ export * from './types'; const getAbsolutePath = (input: I): I => dirname(require.resolve(join(input, 'package.json'))) as any; -function iframeMiddleware(options: Options, server: ViteDevServer): RequestHandler { +function iframeMiddleware(options: Options, server: ViteDevServer): NextHandleFunction { return async (req, res, next) => { - if (!req.url.match(/^\/iframe\.html($|\?)/)) { + if (!req.url || !req.url.match(/^\/iframe\.html($|\?)/)) { next(); return; } + const url = new URL(req.url, 'https://storybook.js.org'); // We need to handle `html-proxy` params for style tag HMR https://github.com/storybookjs/builder-vite/issues/266#issuecomment-1055677865 // e.g. /iframe.html?html-proxy&index=0.css - if (req.query['html-proxy'] !== undefined) { + if (url.searchParams.has('html-proxy')) { next(); return; } @@ -41,7 +42,9 @@ function iframeMiddleware(options: Options, server: ViteDevServer): RequestHandl const generated = await transformIframeHtml(indexHtml, options); const transformed = await server.transformIndexHtml('/iframe.html', generated); res.setHeader('Content-Type', 'text/html'); - res.status(200).send(transformed); + res.statusCode = 200; + res.write(transformed); + res.end(); }; } @@ -54,18 +57,30 @@ export async function bail(): Promise { export const start: ViteBuilder['start'] = async ({ startTime, options, - router, + app, server: devServer, }) => { server = await createViteServer(options as Options, devServer); const previewResolvedDir = getAbsolutePath('@storybook/preview'); const previewDirOrigin = join(previewResolvedDir, 'dist'); + const servePreview = sirv(previewDirOrigin, { + maxAge: 300000, + dev: true, + immutable: true + }); + + app.use('/sb-preview', (req, res, next) => { + if (!req.url || req.url === '/') { + next(); + return; + } - router.use(`/sb-preview`, express.static(previewDirOrigin, { immutable: true, maxAge: '5m' })); + servePreview(req, res, next); + }); - router.use(iframeMiddleware(options as Options, server)); - router.use(server.middlewares); + app.use(iframeMiddleware(options as Options, server)); + app.use(server.middlewares); return { bail, diff --git a/code/builders/builder-webpack5/package.json b/code/builders/builder-webpack5/package.json index 0c346841e92..4f734d96dc7 100644 --- a/code/builders/builder-webpack5/package.json +++ b/code/builders/builder-webpack5/package.json @@ -79,7 +79,6 @@ "constants-browserify": "^1.0.0", "css-loader": "^6.7.1", "es-module-lexer": "^1.5.0", - "express": "^4.17.3", "fork-ts-checker-webpack-plugin": "^8.0.0", "fs-extra": "^11.1.0", "html-webpack-plugin": "^5.5.0", @@ -87,6 +86,7 @@ "path-browserify": "^1.0.1", "process": "^0.11.10", "semver": "^7.3.7", + "sirv": "^2.0.4", "style-loader": "^3.3.1", "terser-webpack-plugin": "^5.3.1", "ts-dedent": "^2.0.0", diff --git a/code/builders/builder-webpack5/src/index.ts b/code/builders/builder-webpack5/src/index.ts index 6473f7db3c3..0c5baf8c065 100644 --- a/code/builders/builder-webpack5/src/index.ts +++ b/code/builders/builder-webpack5/src/index.ts @@ -6,7 +6,6 @@ import { logger } from '@storybook/node-logger'; import type { Builder, Options } from '@storybook/types'; import { checkWebpackVersion } from '@storybook/core-webpack'; import { dirname, join, parse } from 'path'; -import express from 'express'; import fs from 'fs-extra'; import { PREVIEW_BUILDER_PROGRESS } from '@storybook/core-events'; import { @@ -14,6 +13,7 @@ import { WebpackInvocationError, WebpackMissingStatsError, } from '@storybook/core-events/server-errors'; +import sirv from 'sirv'; import prettyTime from 'pretty-hrtime'; @@ -114,7 +114,7 @@ export const bail: WebpackBuilder['bail'] = async () => { const starter: StarterFunction = async function* starterGeneratorFn({ startTime, options, - router, + app, channel, }) { const webpackInstance = await executor.get(options); @@ -181,11 +181,23 @@ const starter: StarterFunction = async function* starterGeneratorFn({ const previewResolvedDir = getAbsolutePath('@storybook/preview'); const previewDirOrigin = join(previewResolvedDir, 'dist'); + const servePreview = sirv(previewDirOrigin, { + maxAge: 300000, + dev: true, + immutable: true + }); + + app.use('/sb-preview', (req, res, next) => { + if (!req.url || req.url === '/') { + next(); + return; + } - router.use(`/sb-preview`, express.static(previewDirOrigin, { immutable: true, maxAge: '5m' })); + servePreview(req, res, next); + }); - router.use(compilation); - router.use(webpackHotMiddleware(compiler, { log: false })); + app.use(compilation); + app.use(webpackHotMiddleware(compiler, { log: false })); const stats = await new Promise((res, rej) => { compilation?.waitUntilValid(res as any); diff --git a/code/lib/core-server/package.json b/code/lib/core-server/package.json index 9d4850f1814..6ab535ce8cb 100644 --- a/code/lib/core-server/package.json +++ b/code/lib/core-server/package.json @@ -82,9 +82,9 @@ "chalk": "^4.1.0", "cli-table3": "^0.6.1", "compression": "^1.7.4", + "connect": "^3.7.0", "detect-port": "^1.3.0", "diff": "^5.2.0", - "express": "^4.17.3", "fs-extra": "^11.1.0", "globby": "^14.0.1", "ip": "^2.0.1", @@ -94,6 +94,7 @@ "prompts": "^2.4.0", "read-pkg-up": "^7.0.1", "semver": "^7.3.7", + "sirv": "^2.0.4", "telejson": "^7.2.0", "tiny-invariant": "^1.3.1", "ts-dedent": "^2.0.0", diff --git a/code/lib/core-server/src/dev-server.ts b/code/lib/core-server/src/dev-server.ts index f8805a75a69..46351e1d2cf 100644 --- a/code/lib/core-server/src/dev-server.ts +++ b/code/lib/core-server/src/dev-server.ts @@ -1,4 +1,3 @@ -import express from 'express'; import compression from 'compression'; import invariant from 'tiny-invariant'; @@ -19,12 +18,12 @@ import { getManagerBuilder, getPreviewBuilder } from './utils/get-builders'; import type { StoryIndexGenerator } from './utils/StoryIndexGenerator'; import { getStoryIndexGenerator } from './utils/getStoryIndexGenerator'; import { doTelemetry } from './utils/doTelemetry'; -import { router } from './utils/router'; import { getAccessControlMiddleware } from './utils/getAccessControlMiddleware'; import { getCachingMiddleware } from './utils/get-caching-middleware'; +import connect, {type NextHandleFunction} from 'connect'; export async function storybookDevServer(options: Options) { - const app = express(); + const app = connect(); const [server, features, core] = await Promise.all([ getServer(app, options), @@ -40,12 +39,12 @@ export async function storybookDevServer(options: Options) { let indexError: Error | undefined; // try get index generator, if failed, send telemetry without storyCount, then rethrow the error const initializedStoryIndexGenerator: Promise = - getStoryIndexGenerator(features ?? {}, options, serverChannel).catch((err) => { + getStoryIndexGenerator(app, features ?? {}, options, serverChannel).catch((err) => { indexError = err; return undefined; }); - app.use(compression({ level: 1 })); + app.use(compression({ level: 1 }) as NextHandleFunction); if (typeof options.extendServer === 'function') { options.extendServer(server); @@ -54,9 +53,7 @@ export async function storybookDevServer(options: Options) { app.use(getAccessControlMiddleware(core?.crossOriginIsolated ?? false)); app.use(getCachingMiddleware()); - getMiddleware(options.configDir)(router); - - app.use(router); + getMiddleware(options.configDir)(app); const { port, host, initialPath } = options; invariant(port, 'expected options to have a port'); @@ -77,7 +74,7 @@ export async function storybookDevServer(options: Options) { const [previewBuilder, managerBuilder] = await Promise.all([ getPreviewBuilder(builderName, options.configDir), getManagerBuilder(), - useStatics(router, options), + useStatics(app, options), ]); if (options.debugWebpack) { @@ -87,7 +84,7 @@ export async function storybookDevServer(options: Options) { const managerResult = await managerBuilder.start({ startTime: process.hrtime(), options, - router, + app, server, channel: serverChannel, }); @@ -100,7 +97,7 @@ export async function storybookDevServer(options: Options) { .start({ startTime: process.hrtime(), options, - router, + app, server, channel: serverChannel, }) @@ -122,7 +119,7 @@ export async function storybookDevServer(options: Options) { // this is a preview route, the builder has to be started before we can serve it // this handler keeps request to that route pending until the builder is ready to serve it, preventing a 404 - router.get('/iframe.html', (req, res, next) => { + app.use('/iframe.html', (req, res, next) => { // We need to catch here or node will treat any errors thrown by `previewStarted` as // unhandled and exit (even though they are very much handled below) previewStarted.catch(() => {}).then(() => next()); @@ -142,7 +139,7 @@ export async function storybookDevServer(options: Options) { const previewResult = await previewStarted; // Now the preview has successfully started, we can count this as a 'dev' event. - doTelemetry(core, initializedStoryIndexGenerator, options); + doTelemetry(app, core, initializedStoryIndexGenerator, options); return { previewResult, managerResult, address, networkAddress }; } diff --git a/code/lib/core-server/src/utils/doTelemetry.ts b/code/lib/core-server/src/utils/doTelemetry.ts index ecb494fc45f..2c07cb83970 100644 --- a/code/lib/core-server/src/utils/doTelemetry.ts +++ b/code/lib/core-server/src/utils/doTelemetry.ts @@ -4,11 +4,12 @@ import { telemetry, getPrecedingUpgrade } from '@storybook/telemetry'; import { useStorybookMetadata } from './metadata'; import type { StoryIndexGenerator } from './StoryIndexGenerator'; import { summarizeIndex } from './summarizeIndex'; -import { router } from './router'; import { versionStatus } from './versionStatus'; import { sendTelemetryError } from '../withTelemetry'; +import type { Server } from 'connect'; export async function doTelemetry( + app: Server, core: CoreConfig, initializedStoryIndexGenerator: Promise, options: Options @@ -47,6 +48,6 @@ export async function doTelemetry( } if (!core?.disableProjectJson) { - useStorybookMetadata(router, options.configDir); + useStorybookMetadata(app, options.configDir); } } diff --git a/code/lib/core-server/src/utils/get-caching-middleware.ts b/code/lib/core-server/src/utils/get-caching-middleware.ts index d01cb3e5e92..fe7554def15 100644 --- a/code/lib/core-server/src/utils/get-caching-middleware.ts +++ b/code/lib/core-server/src/utils/get-caching-middleware.ts @@ -1,8 +1,8 @@ -import type { RequestHandler } from 'express'; +import type { NextHandleFunction } from 'connect'; -export function getCachingMiddleware(): RequestHandler { +export function getCachingMiddleware(): NextHandleFunction { return (req, res, next) => { - res.header('Cache-Control', 'no-store'); + res.setHeader('Cache-Control', 'no-store'); next(); }; } diff --git a/code/lib/core-server/src/utils/getAccessControlMiddleware.ts b/code/lib/core-server/src/utils/getAccessControlMiddleware.ts index 9eb8851e6a5..23e0caf276b 100644 --- a/code/lib/core-server/src/utils/getAccessControlMiddleware.ts +++ b/code/lib/core-server/src/utils/getAccessControlMiddleware.ts @@ -1,16 +1,16 @@ -import type { RequestHandler } from 'express'; +import type { NextHandleFunction } from 'connect'; -export function getAccessControlMiddleware(crossOriginIsolated: boolean): RequestHandler { +export function getAccessControlMiddleware(crossOriginIsolated: boolean): NextHandleFunction { return (req, res, next) => { - res.header('Access-Control-Allow-Origin', '*'); - res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); + res.setHeader('Access-Control-Allow-Origin', '*'); + res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); // These headers are required to enable SharedArrayBuffer // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer if (crossOriginIsolated) { // These headers are required to enable SharedArrayBuffer // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer - res.header('Cross-Origin-Opener-Policy', 'same-origin'); - res.header('Cross-Origin-Embedder-Policy', 'require-corp'); + res.setHeader('Cross-Origin-Opener-Policy', 'same-origin'); + res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp'); } next(); }; diff --git a/code/lib/core-server/src/utils/getStoryIndexGenerator.ts b/code/lib/core-server/src/utils/getStoryIndexGenerator.ts index f8c1bc97f61..12f9da95fce 100644 --- a/code/lib/core-server/src/utils/getStoryIndexGenerator.ts +++ b/code/lib/core-server/src/utils/getStoryIndexGenerator.ts @@ -3,9 +3,10 @@ import { normalizeStories } from '@storybook/core-common'; import { useStoriesJson } from './stories-json'; import type { ServerChannel } from './get-server-channel'; import { StoryIndexGenerator } from './StoryIndexGenerator'; -import { router } from './router'; +import type { Server } from 'connect'; export async function getStoryIndexGenerator( + app: Server, features: { argTypeTargetsV7?: boolean; }, @@ -32,7 +33,7 @@ export async function getStoryIndexGenerator( const initializedStoryIndexGenerator = generator.initialize().then(() => generator); useStoriesJson({ - router, + app, initializedStoryIndexGenerator, normalizedStories, serverChannel, diff --git a/code/lib/core-server/src/utils/metadata.ts b/code/lib/core-server/src/utils/metadata.ts index 319b001ea7b..5aedb18385b 100644 --- a/code/lib/core-server/src/utils/metadata.ts +++ b/code/lib/core-server/src/utils/metadata.ts @@ -1,5 +1,5 @@ import { writeJSON } from 'fs-extra'; -import type { Request, Response, Router } from 'express'; +import type { Server } from 'connect'; import { getStorybookMetadata } from '@storybook/telemetry'; export async function extractStorybookMetadata(outputFile: string, configDir: string) { @@ -8,10 +8,11 @@ export async function extractStorybookMetadata(outputFile: string, configDir: st await writeJSON(outputFile, storybookMetadata); } -export function useStorybookMetadata(router: Router, configDir?: string) { - router.use('/project.json', async (req: Request, res: Response) => { +export function useStorybookMetadata(app: Server, configDir?: string) { + app.use('/project.json', async (req, res) => { const storybookMetadata = await getStorybookMetadata(configDir); - res.header('Content-Type', 'application/json'); - res.send(JSON.stringify(storybookMetadata)); + res.setHeader('Content-Type', 'application/json'); + res.write(JSON.stringify(storybookMetadata)); + res.end(); }); } diff --git a/code/lib/core-server/src/utils/router.ts b/code/lib/core-server/src/utils/router.ts deleted file mode 100644 index 894388991b5..00000000000 --- a/code/lib/core-server/src/utils/router.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Router } from 'express'; - -// @ts-expect-error (Converted from ts-ignore) - -export const router: Router = new Router(); diff --git a/code/lib/core-server/src/utils/server-init.ts b/code/lib/core-server/src/utils/server-init.ts index 176c1e6bfd6..bf2c873a5d3 100644 --- a/code/lib/core-server/src/utils/server-init.ts +++ b/code/lib/core-server/src/utils/server-init.ts @@ -1,11 +1,11 @@ import { logger } from '@storybook/node-logger'; -import type { Express } from 'express'; +import type { Server } from 'connect'; import { readFile } from 'fs-extra'; import http from 'http'; import https from 'https'; export async function getServer( - app: Express, + app: Server, options: { https?: boolean; sslCert?: string; diff --git a/code/lib/core-server/src/utils/server-statics.ts b/code/lib/core-server/src/utils/server-statics.ts index 2a0b93e1ca4..9b264a5dcd9 100644 --- a/code/lib/core-server/src/utils/server-statics.ts +++ b/code/lib/core-server/src/utils/server-statics.ts @@ -2,51 +2,99 @@ import { logger } from '@storybook/node-logger'; import type { Options } from '@storybook/types'; import { getDirectoryFromWorkingDir } from '@storybook/core-common'; import chalk from 'chalk'; -import type { Router } from 'express'; -import express from 'express'; +import type {NextHandleFunction, Server} from 'connect'; import { pathExists } from 'fs-extra'; import path, { basename, isAbsolute } from 'path'; +import sirv from 'sirv'; +import type {ServerResponse} from 'http'; import { dedent } from 'ts-dedent'; -export async function useStatics(router: Router, options: Options) { +// TODO (43081j): maybe get this from somewhere? +const contentTypes: Record = { + 'css': 'text/css', + 'woff2': 'font/woff2', + 'js': 'text/javascript' +}; +const setContentTypeHeaders = (res: ServerResponse, pathname: string) => { + const base = basename(pathname); + const contentType = contentTypes[base]; + if (contentType) { + res.setHeader('Content-Type', contentType); + } +}; + +export async function useStatics(app: Server, options: Options): Promise { const staticDirs = (await options.presets.apply('staticDirs')) ?? []; const faviconPath = await options.presets.apply('favicon'); - const statics = [ + const statics: Array<{targetEndpoint: string; staticPath: string}> = []; + const userStatics = [ + `${faviconPath}:/${basename(faviconPath)}`, ...staticDirs.map((dir) => (typeof dir === 'string' ? dir : `${dir.from}:${dir.to}`)), ]; - if (statics && statics.length > 0) { - await Promise.all( - statics.map(async (dir) => { - try { - const normalizedDir = - staticDirs && !isAbsolute(dir) - ? getDirectoryFromWorkingDir({ - configDir: options.configDir, - workingDir: process.cwd(), - directory: dir, - }) - : dir; - const { staticDir, staticPath, targetEndpoint } = await parseStaticDir(normalizedDir); - - // Don't log for the internal static dir - if (!targetEndpoint.startsWith('/sb-')) { - logger.info( - chalk`=> Serving static files from {cyan ${staticDir}} at {cyan ${targetEndpoint}}` - ); - } - - router.use(targetEndpoint, express.static(staticPath, { index: false })); - } catch (e) { - if (e instanceof Error) logger.warn(e.message); - } - }) - ); + for (const dir of userStatics) { + try { + const normalizedDir = + staticDirs && !isAbsolute(dir) + ? getDirectoryFromWorkingDir({ + configDir: options.configDir, + workingDir: process.cwd(), + directory: dir, + }) + : dir; + const { staticDir, staticPath, targetEndpoint } = await parseStaticDir(normalizedDir); + + // Don't log for the internal static dir + if (!targetEndpoint.startsWith('/sb-')) { + logger.info( + chalk`=> Serving static files from {cyan ${staticDir}} at {cyan ${targetEndpoint}}` + ); + } + + statics.push({targetEndpoint, staticPath}); + } catch (e) { + if (e instanceof Error) logger.warn(e.message); + } } - router.get(`/${basename(faviconPath)}`, (req, res) => res.sendFile(faviconPath)); + const serve = sirv( + process.cwd(), + { + dev: true, + etag: true, + setHeaders: setContentTypeHeaders + } + ); + + app.use((req, res, next) => { + if (!req.url) { + return next(); + } + + const url = new URL(req.url, 'https://storybook.js.org'); + const pathname = path.normalize(url.pathname); + + // TODO (43081j): this is 'security' so you can't break out of cwd + // Probably need to do something better here + if (pathname.startsWith('..') || pathname.endsWith('/')) { + return next(); + } + + for (const {targetEndpoint, staticPath} of statics) { + if (pathname.startsWith(targetEndpoint)) { + // TODO (43081j): similar as above, this might be doable in a cleaner way + const newPath = path.relative(process.cwd(), path.resolve(staticPath, './' + pathname.slice(targetEndpoint.length))); + url.pathname = newPath; + req.url = url.href.slice(url.origin.length); + serve(req, res, next); + return; + } + } + + next(); + }); } export const parseStaticDir = async (arg: string) => { diff --git a/code/lib/core-server/src/utils/stories-json.test.ts b/code/lib/core-server/src/utils/stories-json.test.ts index a621f5443ce..9d7d6e2da03 100644 --- a/code/lib/core-server/src/utils/stories-json.test.ts +++ b/code/lib/core-server/src/utils/stories-json.test.ts @@ -1,6 +1,6 @@ import { describe, beforeEach, it, expect, vi } from 'vitest'; -import type { Router, Request, Response } from 'express'; +import type { Server } from 'connect'; import Watchpack from 'watchpack'; import path from 'path'; import debounce from 'lodash/debounce.js'; @@ -55,7 +55,7 @@ const getInitializedStoryIndexGenerator = async ( describe('useStoriesJson', () => { const use = vi.fn(); - const router: Router = { use } as any; + const app: Server = { use } as any; const send = vi.fn(); const write = vi.fn(); const response: Response = { @@ -86,7 +86,7 @@ describe('useStoriesJson', () => { const mockServerChannel = { emit: vi.fn() } as any as ServerChannel; console.time('useStoriesJson'); useStoriesJson({ - router, + app, serverChannel: mockServerChannel, workingDir, normalizedStories, @@ -255,7 +255,7 @@ describe('useStoriesJson', () => { const mockServerChannel = { emit: vi.fn() } as any as ServerChannel; useStoriesJson({ - router, + app, serverChannel: mockServerChannel, workingDir, normalizedStories, @@ -287,7 +287,7 @@ describe('useStoriesJson', () => { it('sends invalidate events', async () => { const mockServerChannel = { emit: vi.fn() } as any as ServerChannel; useStoriesJson({ - router, + app, serverChannel: mockServerChannel, workingDir, normalizedStories, @@ -316,7 +316,7 @@ describe('useStoriesJson', () => { it('only sends one invalidation when multiple event listeners are listening', async () => { const mockServerChannel = { emit: vi.fn() } as any as ServerChannel; useStoriesJson({ - router, + app, serverChannel: mockServerChannel, workingDir, normalizedStories, @@ -354,7 +354,7 @@ describe('useStoriesJson', () => { const mockServerChannel = { emit: vi.fn() } as any as ServerChannel; useStoriesJson({ - router, + app, serverChannel: mockServerChannel, workingDir, normalizedStories, diff --git a/code/lib/core-server/src/utils/stories-json.ts b/code/lib/core-server/src/utils/stories-json.ts index 074c0248cb0..ae9c72c90d1 100644 --- a/code/lib/core-server/src/utils/stories-json.ts +++ b/code/lib/core-server/src/utils/stories-json.ts @@ -1,4 +1,4 @@ -import type { Router, Request, Response } from 'express'; +import type { Server } from 'connect'; import { writeJSON } from 'fs-extra'; import type { NormalizedStoriesSpecifier, StoryIndex } from '@storybook/types'; @@ -22,13 +22,13 @@ export async function extractStoriesJson( } export function useStoriesJson({ - router, + app, initializedStoryIndexGenerator, workingDir = process.cwd(), serverChannel, normalizedStories, }: { - router: Router; + app: Server; initializedStoryIndexGenerator: Promise; serverChannel: ServerChannel; workingDir?: string; @@ -43,15 +43,17 @@ export function useStoriesJson({ maybeInvalidate(); }); - router.use('/index.json', async (req: Request, res: Response) => { + app.use('/index.json', async (req, res) => { try { const generator = await initializedStoryIndexGenerator; const index = await generator.getIndex(); - res.header('Content-Type', 'application/json'); - res.send(JSON.stringify(index)); + res.setHeader('Content-Type', 'application/json'); + res.write(JSON.stringify(index)); + res.end(); } catch (err) { - res.status(500); - res.send(err instanceof Error ? err.toString() : String(err)); + res.statusCode = 500; + res.write(err instanceof Error ? err.toString() : String(err)); + res.end(); } }); } diff --git a/code/lib/types/package.json b/code/lib/types/package.json index 58824511b29..558e0b19dce 100644 --- a/code/lib/types/package.json +++ b/code/lib/types/package.json @@ -45,7 +45,6 @@ }, "dependencies": { "@storybook/channels": "workspace:*", - "@types/express": "^4.7.0", "file-system-cache": "2.3.0" }, "devDependencies": { diff --git a/code/lib/types/src/modules/core-common.ts b/code/lib/types/src/modules/core-common.ts index c4aeeacbcf1..e5e2af12457 100644 --- a/code/lib/types/src/modules/core-common.ts +++ b/code/lib/types/src/modules/core-common.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/naming-convention */ import type { FileSystemCache } from 'file-system-cache'; import type { Options as TelejsonOptions } from 'telejson'; -import type { Router } from 'express'; -import type { Server } from 'http'; +import type { Server } from 'connect'; +import type { Server as HttpServer } from 'http'; import type { PackageJson as PackageJsonFromTypeFest } from 'type-fest'; import type { StoriesEntry, Indexer } from './indexer'; @@ -157,7 +157,7 @@ export interface LoadOptions { configDir?: string; cacheKey?: string; ignorePreview?: boolean; - extendServer?: (server: Server) => void; + extendServer?: (server: HttpServer) => void; } export interface CLIOptions { @@ -217,8 +217,8 @@ export interface Builder { start: (args: { options: Options; startTime: ReturnType; - router: Router; - server: Server; + app: Server; + server: HttpServer; channel: ServerChannel; }) => Promise= 1.4.0 < 2": +"statuses@npm:>= 1.4.0 < 2, statuses@npm:~1.5.0": version: 1.5.0 resolution: "statuses@npm:1.5.0" checksum: 10c0/e433900956357b3efd79b1c547da4d291799ac836960c016d10a98f6a810b1b5c0dcc13b5a7aa609a58239b5190e1ea176ad9221c2157d2fd1c747393e6b2940 @@ -27456,6 +27508,13 @@ __metadata: languageName: node linkType: hard +"totalist@npm:^3.0.0": + version: 3.0.1 + resolution: "totalist@npm:3.0.1" + checksum: 10c0/4bb1fadb69c3edbef91c73ebef9d25b33bbf69afe1e37ce544d5f7d13854cda15e47132f3e0dc4cafe300ddb8578c77c50a65004d8b6e97e77934a69aa924863 + languageName: node + linkType: hard + "tough-cookie@npm:^4.1.3": version: 4.1.3 resolution: "tough-cookie@npm:4.1.3" From 9b0b42aebbd41c07488a56f7cdebc76efdce0b92 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 7 May 2024 15:50:56 +0200 Subject: [PATCH 02/26] fix --- code/builders/builder-manager/src/index.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/code/builders/builder-manager/src/index.ts b/code/builders/builder-manager/src/index.ts index cb534642363..5b0dd2373ea 100644 --- a/code/builders/builder-manager/src/index.ts +++ b/code/builders/builder-manager/src/index.ts @@ -122,11 +122,7 @@ export const executor = { * * I am sorry for making you read about generators today :') */ -const starter: StarterFunction = async function* starterGeneratorFn({ - startTime, - options, - app, -}) { +const starter: StarterFunction = async function* starterGeneratorFn({ startTime, options, app }) { logger.info('=> Starting manager..'); const { @@ -163,12 +159,12 @@ const starter: StarterFunction = async function* starterGeneratorFn({ const serveAddons = sirv(addonsDir, { maxAge: 300000, dev: true, - immutable: true + immutable: true, }); const serveCore = sirv(coreDirOrigin, { maxAge: 300000, dev: true, - immutable: true + immutable: true, }); // TODO (43081j): maybe abstract this into a reusable function app.use('/sb-addons', (req, res, next) => { @@ -214,7 +210,7 @@ const starter: StarterFunction = async function* starterGeneratorFn({ yield; app.use('/', ({ url }, res, next) => { - if (isRootPath.test(url)) { + if (url && isRootPath.test(url)) { res.statusCode = 200; res.write(html); res.end(); From 81292297e8333b57086fae7cae94b6a484df84dc Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 7 May 2024 16:39:37 +0200 Subject: [PATCH 03/26] fix linting --- code/builders/builder-vite/src/index.ts | 4 +-- code/builders/builder-webpack5/src/index.ts | 2 +- code/lib/core-server/src/dev-server.ts | 2 +- .../core-server/src/utils/server-statics.ts | 34 +++++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/code/builders/builder-vite/src/index.ts b/code/builders/builder-vite/src/index.ts index 798ab03f147..5500261989d 100644 --- a/code/builders/builder-vite/src/index.ts +++ b/code/builders/builder-vite/src/index.ts @@ -1,7 +1,7 @@ // noinspection JSUnusedGlobalSymbols import * as fs from 'fs-extra'; -import type {NextHandleFunction} from 'connect'; +import type { NextHandleFunction } from 'connect'; import type { ViteDevServer } from 'vite'; import { dirname, join, parse } from 'path'; import { NoStatsForViteDevError } from '@storybook/core-events/server-errors'; @@ -67,7 +67,7 @@ export const start: ViteBuilder['start'] = async ({ const servePreview = sirv(previewDirOrigin, { maxAge: 300000, dev: true, - immutable: true + immutable: true, }); app.use('/sb-preview', (req, res, next) => { diff --git a/code/builders/builder-webpack5/src/index.ts b/code/builders/builder-webpack5/src/index.ts index 0c5baf8c065..19e6385feb1 100644 --- a/code/builders/builder-webpack5/src/index.ts +++ b/code/builders/builder-webpack5/src/index.ts @@ -184,7 +184,7 @@ const starter: StarterFunction = async function* starterGeneratorFn({ const servePreview = sirv(previewDirOrigin, { maxAge: 300000, dev: true, - immutable: true + immutable: true, }); app.use('/sb-preview', (req, res, next) => { diff --git a/code/lib/core-server/src/dev-server.ts b/code/lib/core-server/src/dev-server.ts index 46351e1d2cf..74d56058571 100644 --- a/code/lib/core-server/src/dev-server.ts +++ b/code/lib/core-server/src/dev-server.ts @@ -20,7 +20,7 @@ import { getStoryIndexGenerator } from './utils/getStoryIndexGenerator'; import { doTelemetry } from './utils/doTelemetry'; import { getAccessControlMiddleware } from './utils/getAccessControlMiddleware'; import { getCachingMiddleware } from './utils/get-caching-middleware'; -import connect, {type NextHandleFunction} from 'connect'; +import connect, { type NextHandleFunction } from 'connect'; export async function storybookDevServer(options: Options) { const app = connect(); diff --git a/code/lib/core-server/src/utils/server-statics.ts b/code/lib/core-server/src/utils/server-statics.ts index 9b264a5dcd9..bc664d13132 100644 --- a/code/lib/core-server/src/utils/server-statics.ts +++ b/code/lib/core-server/src/utils/server-statics.ts @@ -2,19 +2,19 @@ import { logger } from '@storybook/node-logger'; import type { Options } from '@storybook/types'; import { getDirectoryFromWorkingDir } from '@storybook/core-common'; import chalk from 'chalk'; -import type {NextHandleFunction, Server} from 'connect'; +import type { NextHandleFunction, Server } from 'connect'; import { pathExists } from 'fs-extra'; import path, { basename, isAbsolute } from 'path'; import sirv from 'sirv'; -import type {ServerResponse} from 'http'; +import type { ServerResponse } from 'http'; import { dedent } from 'ts-dedent'; // TODO (43081j): maybe get this from somewhere? const contentTypes: Record = { - 'css': 'text/css', - 'woff2': 'font/woff2', - 'js': 'text/javascript' + css: 'text/css', + woff2: 'font/woff2', + js: 'text/javascript', }; const setContentTypeHeaders = (res: ServerResponse, pathname: string) => { const base = basename(pathname); @@ -28,7 +28,7 @@ export async function useStatics(app: Server, options: Options): Promise { const staticDirs = (await options.presets.apply('staticDirs')) ?? []; const faviconPath = await options.presets.apply('favicon'); - const statics: Array<{targetEndpoint: string; staticPath: string}> = []; + const statics: Array<{ targetEndpoint: string; staticPath: string }> = []; const userStatics = [ `${faviconPath}:/${basename(faviconPath)}`, ...staticDirs.map((dir) => (typeof dir === 'string' ? dir : `${dir.from}:${dir.to}`)), @@ -53,20 +53,17 @@ export async function useStatics(app: Server, options: Options): Promise { ); } - statics.push({targetEndpoint, staticPath}); + statics.push({ targetEndpoint, staticPath }); } catch (e) { if (e instanceof Error) logger.warn(e.message); } } - const serve = sirv( - process.cwd(), - { - dev: true, - etag: true, - setHeaders: setContentTypeHeaders - } - ); + const serve = sirv(process.cwd(), { + dev: true, + etag: true, + setHeaders: setContentTypeHeaders, + }); app.use((req, res, next) => { if (!req.url) { @@ -82,10 +79,13 @@ export async function useStatics(app: Server, options: Options): Promise { return next(); } - for (const {targetEndpoint, staticPath} of statics) { + for (const { targetEndpoint, staticPath } of statics) { if (pathname.startsWith(targetEndpoint)) { // TODO (43081j): similar as above, this might be doable in a cleaner way - const newPath = path.relative(process.cwd(), path.resolve(staticPath, './' + pathname.slice(targetEndpoint.length))); + const newPath = path.relative( + process.cwd(), + path.resolve(staticPath, './' + pathname.slice(targetEndpoint.length)) + ); url.pathname = newPath; req.url = url.href.slice(url.origin.length); serve(req, res, next); From ffa4f0b90896b54b33f04addd13d5d901543ee2a Mon Sep 17 00:00:00 2001 From: 43081j <43081j@users.noreply.github.com> Date: Tue, 7 May 2024 21:13:41 +0100 Subject: [PATCH 04/26] test: fix stories-json test assertions --- .../src/utils/stories-json.test.ts | 20 +++++++++---------- .../lib/core-server/src/utils/stories-json.ts | 6 ++---- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/code/lib/core-server/src/utils/stories-json.test.ts b/code/lib/core-server/src/utils/stories-json.test.ts index 0700cebb11f..d2370fdcd05 100644 --- a/code/lib/core-server/src/utils/stories-json.test.ts +++ b/code/lib/core-server/src/utils/stories-json.test.ts @@ -56,23 +56,23 @@ const getInitializedStoryIndexGenerator = async ( describe('useStoriesJson', () => { const use = vi.fn(); const app: Server = { use } as any; - const send = vi.fn(); + const end = vi.fn(); const write = vi.fn(); const response: Response = { header: vi.fn(), - send, + send: vi.fn(), status: vi.fn(), setHeader: vi.fn(), flushHeaders: vi.fn(), write, flush: vi.fn(), - end: vi.fn(), + end, on: vi.fn(), } as any; beforeEach(async () => { use.mockClear(); - send.mockClear(); + end.mockClear(); write.mockClear(); vi.mocked(debounce).mockImplementation((cb) => cb as any); Watchpack.mockClear(); @@ -102,8 +102,8 @@ describe('useStoriesJson', () => { await route(request, response); console.timeEnd('route'); - expect(send).toHaveBeenCalledTimes(1); - expect(JSON.parse(send.mock.calls[0][0])).toMatchInlineSnapshot(` + expect(end).toHaveBeenCalledTimes(1); + expect(JSON.parse(end.mock.calls[0][0])).toMatchInlineSnapshot(` { "entries": { "a--metaof": { @@ -283,14 +283,14 @@ describe('useStoriesJson', () => { const route = use.mock.calls[0][1]; const firstPromise = route(request, response); - const secondResponse = { ...response, send: vi.fn(), status: vi.fn() }; + const secondResponse = { ...response, end: vi.fn(), status: vi.fn() }; const secondPromise = route(request, secondResponse); await Promise.all([firstPromise, secondPromise]); - expect(send).toHaveBeenCalledTimes(1); + expect(end).toHaveBeenCalledTimes(1); expect(response.status).not.toEqual(500); - expect(secondResponse.send).toHaveBeenCalledTimes(1); + expect(secondResponse.end).toHaveBeenCalledTimes(1); expect(secondResponse.status).not.toEqual(500); }); }); @@ -298,7 +298,7 @@ describe('useStoriesJson', () => { describe('SSE endpoint', () => { beforeEach(() => { use.mockClear(); - send.mockClear(); + end.mockClear(); }); it('sends invalidate events', async () => { diff --git a/code/lib/core-server/src/utils/stories-json.ts b/code/lib/core-server/src/utils/stories-json.ts index 4bbaaed14fb..87cef6342dc 100644 --- a/code/lib/core-server/src/utils/stories-json.ts +++ b/code/lib/core-server/src/utils/stories-json.ts @@ -61,12 +61,10 @@ export function useStoriesJson({ const generator = await initializedStoryIndexGenerator; const index = await generator.getIndex(); res.setHeader('Content-Type', 'application/json'); - res.write(JSON.stringify(index)); - res.end(); + res.end(JSON.stringify(index)); } catch (err) { res.statusCode = 500; - res.write(err instanceof Error ? err.toString() : String(err)); - res.end(); + res.end(err instanceof Error ? err.toString() : String(err)); } }); } From b92d83b7fcd68140d662382ba8538fd9a3e1441d Mon Sep 17 00:00:00 2001 From: 43081j <43081j@users.noreply.github.com> Date: Tue, 7 May 2024 21:41:27 +0100 Subject: [PATCH 05/26] fix(core-server): remove unused import --- code/lib/core-server/src/utils/server-statics.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/lib/core-server/src/utils/server-statics.ts b/code/lib/core-server/src/utils/server-statics.ts index bc664d13132..f63d88cab90 100644 --- a/code/lib/core-server/src/utils/server-statics.ts +++ b/code/lib/core-server/src/utils/server-statics.ts @@ -2,7 +2,7 @@ import { logger } from '@storybook/node-logger'; import type { Options } from '@storybook/types'; import { getDirectoryFromWorkingDir } from '@storybook/core-common'; import chalk from 'chalk'; -import type { NextHandleFunction, Server } from 'connect'; +import type { Server } from 'connect'; import { pathExists } from 'fs-extra'; import path, { basename, isAbsolute } from 'path'; import sirv from 'sirv'; From 29402760543fdb2ab469e13c8b65efea1ff04117 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Mon, 1 Jul 2024 17:04:42 +0200 Subject: [PATCH 06/26] update branch with CPC work --- code/builders/builder-vite/package.json | 1 + code/builders/builder-webpack5/src/index.ts | 2 +- code/core/package.json | 2 +- code/core/src/core-server/dev-server.ts | 2 +- .../core/src/core-server/utils/doTelemetry.ts | 2 +- .../utils/get-caching-middleware.ts | 2 +- .../utils/getAccessControlMiddleware.ts | 2 +- .../utils/getStoryIndexGenerator.ts | 2 +- code/core/src/core-server/utils/metadata.ts | 2 +- .../src/core-server/utils/server-connect.ts | 88 +++++++++++++++++++ .../core/src/core-server/utils/server-init.ts | 2 +- .../src/core-server/utils/server-statics.ts | 2 +- .../core-server/utils/stories-json.test.ts | 2 +- .../src/core-server/utils/stories-json.ts | 2 +- code/core/src/types/modules/core-common.ts | 2 +- code/yarn.lock | 43 ++++++++- 16 files changed, 142 insertions(+), 16 deletions(-) create mode 100644 code/core/src/core-server/utils/server-connect.ts diff --git a/code/builders/builder-vite/package.json b/code/builders/builder-vite/package.json index b88932fd355..cf6ebc3beed 100644 --- a/code/builders/builder-vite/package.json +++ b/code/builders/builder-vite/package.json @@ -46,6 +46,7 @@ "@storybook/csf-plugin": "workspace:*", "@types/find-cache-dir": "^3.2.1", "browser-assert": "^1.2.1", + "connect": "^3.7.0", "es-module-lexer": "^1.5.0", "find-cache-dir": "^3.0.0", "fs-extra": "^11.1.0", diff --git a/code/builders/builder-webpack5/src/index.ts b/code/builders/builder-webpack5/src/index.ts index 599484a4ff6..deb5405d1a4 100644 --- a/code/builders/builder-webpack5/src/index.ts +++ b/code/builders/builder-webpack5/src/index.ts @@ -13,7 +13,7 @@ import { WebpackCompilationError, WebpackInvocationError, WebpackMissingStatsError, -} from 'storybook/internal/core-events'; +} from 'storybook/internal/server-errors'; import sirv from 'sirv'; import prettyTime from 'pretty-hrtime'; diff --git a/code/core/package.json b/code/core/package.json index 1f6b9cc92fa..839e867f9aa 100644 --- a/code/core/package.json +++ b/code/core/package.json @@ -315,6 +315,7 @@ "cli-table3": "^0.6.1", "comment-parser": "^1.4.1", "compression": "^1.7.4", + "connect": "^3.7.0", "copy-to-clipboard": "^3.3.1", "cross-spawn": "^7.0.3", "css": "^3.0.0", @@ -328,7 +329,6 @@ "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0", "esbuild-plugin-alias": "^0.2.1", "execa": "^8.0.1", - "express": "^4.19.2", "fd-package-json": "^1.2.0", "fetch-retry": "^6.0.0", "file-system-cache": "^2.4.4", diff --git a/code/core/src/core-server/dev-server.ts b/code/core/src/core-server/dev-server.ts index 3b06865358c..a83e551b650 100644 --- a/code/core/src/core-server/dev-server.ts +++ b/code/core/src/core-server/dev-server.ts @@ -20,7 +20,7 @@ import { getStoryIndexGenerator } from './utils/getStoryIndexGenerator'; import { doTelemetry } from './utils/doTelemetry'; import { getAccessControlMiddleware } from './utils/getAccessControlMiddleware'; import { getCachingMiddleware } from './utils/get-caching-middleware'; -import connect, { type NextHandleFunction } from 'connect'; +import { type NextHandleFunction, connect } from './utils/server-connect'; export async function storybookDevServer(options: Options) { const app = connect(); diff --git a/code/core/src/core-server/utils/doTelemetry.ts b/code/core/src/core-server/utils/doTelemetry.ts index 288cfd0268c..5f14d50392b 100644 --- a/code/core/src/core-server/utils/doTelemetry.ts +++ b/code/core/src/core-server/utils/doTelemetry.ts @@ -6,7 +6,7 @@ import type { StoryIndexGenerator } from './StoryIndexGenerator'; import { summarizeIndex } from './summarizeIndex'; import { versionStatus } from './versionStatus'; import { sendTelemetryError } from '../withTelemetry'; -import type { Server } from 'connect'; +import type { Server } from './server-connect'; export async function doTelemetry( app: Server, diff --git a/code/core/src/core-server/utils/get-caching-middleware.ts b/code/core/src/core-server/utils/get-caching-middleware.ts index fe7554def15..1489117ba88 100644 --- a/code/core/src/core-server/utils/get-caching-middleware.ts +++ b/code/core/src/core-server/utils/get-caching-middleware.ts @@ -1,4 +1,4 @@ -import type { NextHandleFunction } from 'connect'; +import type { NextHandleFunction } from './server-connect'; export function getCachingMiddleware(): NextHandleFunction { return (req, res, next) => { diff --git a/code/core/src/core-server/utils/getAccessControlMiddleware.ts b/code/core/src/core-server/utils/getAccessControlMiddleware.ts index 23e0caf276b..f6d2769d693 100644 --- a/code/core/src/core-server/utils/getAccessControlMiddleware.ts +++ b/code/core/src/core-server/utils/getAccessControlMiddleware.ts @@ -1,4 +1,4 @@ -import type { NextHandleFunction } from 'connect'; +import type { NextHandleFunction } from './server-connect'; export function getAccessControlMiddleware(crossOriginIsolated: boolean): NextHandleFunction { return (req, res, next) => { diff --git a/code/core/src/core-server/utils/getStoryIndexGenerator.ts b/code/core/src/core-server/utils/getStoryIndexGenerator.ts index fd76cf00875..f67487c60ab 100644 --- a/code/core/src/core-server/utils/getStoryIndexGenerator.ts +++ b/code/core/src/core-server/utils/getStoryIndexGenerator.ts @@ -3,7 +3,7 @@ import { normalizeStories } from '@storybook/core/common'; import { useStoriesJson } from './stories-json'; import type { ServerChannel } from './get-server-channel'; import { StoryIndexGenerator } from './StoryIndexGenerator'; -import type { Server } from 'connect'; +import type { Server } from './server-connect'; export async function getStoryIndexGenerator( app: Server, diff --git a/code/core/src/core-server/utils/metadata.ts b/code/core/src/core-server/utils/metadata.ts index bad118d9920..9519ddc503f 100644 --- a/code/core/src/core-server/utils/metadata.ts +++ b/code/core/src/core-server/utils/metadata.ts @@ -1,5 +1,5 @@ import { writeJSON } from 'fs-extra'; -import type { Server } from 'connect'; +import type { Server } from './server-connect'; import { getStorybookMetadata } from '@storybook/core/telemetry'; export async function extractStorybookMetadata(outputFile: string, configDir: string) { diff --git a/code/core/src/core-server/utils/server-connect.ts b/code/core/src/core-server/utils/server-connect.ts new file mode 100644 index 00000000000..73dcb7494e0 --- /dev/null +++ b/code/core/src/core-server/utils/server-connect.ts @@ -0,0 +1,88 @@ +import * as http from 'http'; + +import connect from 'connect'; + +export { connect }; + +export type ServerHandle = HandleFunction | http.Server; + +export class IncomingMessage extends http.IncomingMessage { + originalUrl?: http.IncomingMessage['url'] | undefined; +} + +type NextFunction = (err?: any) => void; + +export type SimpleHandleFunction = (req: IncomingMessage, res: http.ServerResponse) => void; +export type NextHandleFunction = ( + req: IncomingMessage, + res: http.ServerResponse, + next: NextFunction +) => void; +export type ErrorHandleFunction = ( + err: any, + req: IncomingMessage, + res: http.ServerResponse, + next: NextFunction +) => void; +export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction; + +export interface ServerStackItem { + route: string; + handle: ServerHandle; +} + +export interface Server extends NodeJS.EventEmitter { + (req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void; + + route: string; + stack: ServerStackItem[]; + + /** + * Utilize the given middleware `handle` to the given `route`, + * defaulting to _/_. This "route" is the mount-point for the + * middleware, when given a value other than _/_ the middleware + * is only effective when that segment is present in the request's + * pathname. + * + * For example if we were to mount a function at _/admin_, it would + * be invoked on _/admin_, and _/admin/settings_, however it would + * not be invoked for _/_, or _/posts_. + */ + use(fn: NextHandleFunction): Server; + use(fn: HandleFunction): Server; + use(route: string, fn: NextHandleFunction): Server; + use(route: string, fn: HandleFunction): Server; + + /** + * Handle server requests, punting them down + * the middleware stack. + */ + handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void; + + /** + * Listen for connections. + * + * This method takes the same arguments + * as node's `http.Server#listen()`. + * + * HTTP and HTTPS: + * + * If you run your application both as HTTP + * and HTTPS you may wrap them individually, + * since your Connect "server" is really just + * a JavaScript `Function`. + * + * var connect = require('connect') + * , http = require('http') + * , https = require('https'); + * + * var app = connect(); + * + * http.createServer(app).listen(80); + * https.createServer(options, app).listen(443); + */ + listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server; + listen(port: number, hostname?: string, callback?: Function): http.Server; + listen(path: string, callback?: Function): http.Server; + listen(handle: any, listeningListener?: Function): http.Server; +} diff --git a/code/core/src/core-server/utils/server-init.ts b/code/core/src/core-server/utils/server-init.ts index 76623c44659..3b8b7d844ec 100644 --- a/code/core/src/core-server/utils/server-init.ts +++ b/code/core/src/core-server/utils/server-init.ts @@ -1,5 +1,5 @@ import { logger } from '@storybook/core/node-logger'; -import type { Server } from 'connect'; +import type { Server } from './server-connect'; import { readFile } from 'fs-extra'; import http from 'http'; import https from 'https'; diff --git a/code/core/src/core-server/utils/server-statics.ts b/code/core/src/core-server/utils/server-statics.ts index b22eacd3a1d..4f478f0633f 100644 --- a/code/core/src/core-server/utils/server-statics.ts +++ b/code/core/src/core-server/utils/server-statics.ts @@ -2,7 +2,7 @@ import { logger } from '@storybook/core/node-logger'; import type { Options } from '@storybook/core/types'; import { getDirectoryFromWorkingDir } from '@storybook/core/common'; import chalk from 'chalk'; -import type { Server } from 'connect'; +import type { Server } from './server-connect'; import { pathExists } from 'fs-extra'; import { basename, isAbsolute, normalize, posix, relative, resolve, sep, win32 } from 'node:path'; import sirv from 'sirv'; diff --git a/code/core/src/core-server/utils/stories-json.test.ts b/code/core/src/core-server/utils/stories-json.test.ts index 9f2e327ab04..0247a8ca39d 100644 --- a/code/core/src/core-server/utils/stories-json.test.ts +++ b/code/core/src/core-server/utils/stories-json.test.ts @@ -1,6 +1,6 @@ import { describe, beforeEach, it, expect, vi } from 'vitest'; -import type { Server } from 'connect'; +import type { Server } from './server-connect'; import Watchpack from 'watchpack'; import path from 'node:path'; import debounce from 'lodash/debounce.js'; diff --git a/code/core/src/core-server/utils/stories-json.ts b/code/core/src/core-server/utils/stories-json.ts index 467bba0f4d7..9c7a3efd1f3 100644 --- a/code/core/src/core-server/utils/stories-json.ts +++ b/code/core/src/core-server/utils/stories-json.ts @@ -1,4 +1,4 @@ -import type { Server } from 'connect'; +import type { Server } from './server-connect'; import { basename } from 'node:path'; import { writeJSON } from 'fs-extra'; diff --git a/code/core/src/types/modules/core-common.ts b/code/core/src/types/modules/core-common.ts index 35d1a245491..922dab66b46 100644 --- a/code/core/src/types/modules/core-common.ts +++ b/code/core/src/types/modules/core-common.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ import type { FileSystemCache } from 'file-system-cache'; import type { Options as TelejsonOptions } from 'telejson'; -import type { Server } from 'connect'; +import type { Server } from '../../core-server/utils/server-connect'; import type { Server as HttpServer } from 'http'; import type { PackageJson as PackageJsonFromTypeFest } from 'type-fest'; diff --git a/code/yarn.lock b/code/yarn.lock index 6087e5c776a..ee9a81f4b22 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5545,6 +5545,7 @@ __metadata: "@types/find-cache-dir": "npm:^3.2.1" "@types/node": "npm:^18.0.0" browser-assert: "npm:^1.2.1" + connect: "npm:^3.7.0" es-module-lexer: "npm:^1.5.0" find-cache-dir: "npm:^3.0.0" fs-extra: "npm:^11.1.0" @@ -5787,6 +5788,7 @@ __metadata: cli-table3: "npm:^0.6.1" comment-parser: "npm:^1.4.1" compression: "npm:^1.7.4" + connect: "npm:^3.7.0" copy-to-clipboard: "npm:^3.3.1" cross-spawn: "npm:^7.0.3" css: "npm:^3.0.0" @@ -5801,7 +5803,6 @@ __metadata: esbuild-plugin-alias: "npm:^0.2.1" esbuild-register: "npm:^3.5.0" execa: "npm:^8.0.1" - express: "npm:^4.19.2" fd-package-json: "npm:^1.2.0" fetch-retry: "npm:^6.0.0" file-system-cache: "npm:^2.4.4" @@ -11852,6 +11853,18 @@ __metadata: languageName: node linkType: hard +"connect@npm:^3.7.0": + version: 3.7.0 + resolution: "connect@npm:3.7.0" + dependencies: + debug: "npm:2.6.9" + finalhandler: "npm:1.1.2" + parseurl: "npm:~1.3.3" + utils-merge: "npm:1.0.1" + checksum: 10c0/f120c6116bb16a0a7d2703c0b4a0cd7ed787dc5ec91978097bf62aa967289020a9f41a9cd3c3276a7b92aaa36f382d2cd35fed7138fd466a55c8e9fdbed11ca8 + languageName: node + linkType: hard + "console-browserify@npm:^1.2.0": version: 1.2.0 resolution: "console-browserify@npm:1.2.0" @@ -14506,7 +14519,7 @@ __metadata: languageName: node linkType: hard -"express@npm:^4.17.3, express@npm:^4.19.2": +"express@npm:^4.17.3": version: 4.19.2 resolution: "express@npm:4.19.2" dependencies: @@ -14821,6 +14834,21 @@ __metadata: languageName: node linkType: hard +"finalhandler@npm:1.1.2": + version: 1.1.2 + resolution: "finalhandler@npm:1.1.2" + dependencies: + debug: "npm:2.6.9" + encodeurl: "npm:~1.0.2" + escape-html: "npm:~1.0.3" + on-finished: "npm:~2.3.0" + parseurl: "npm:~1.3.3" + statuses: "npm:~1.5.0" + unpipe: "npm:~1.0.0" + checksum: 10c0/6a96e1f5caab085628c11d9fdceb82ba608d5e426c6913d4d918409baa271037a47f28fbba73279e8ad614f0b8fa71ea791d265e408d760793829edd8c2f4584 + languageName: node + linkType: hard + "finalhandler@npm:1.2.0": version: 1.2.0 resolution: "finalhandler@npm:1.2.0" @@ -21384,6 +21412,15 @@ __metadata: languageName: node linkType: hard +"on-finished@npm:~2.3.0": + version: 2.3.0 + resolution: "on-finished@npm:2.3.0" + dependencies: + ee-first: "npm:1.1.1" + checksum: 10c0/c904f9e518b11941eb60279a3cbfaf1289bd0001f600a950255b1dede9fe3df8cd74f38483550b3bb9485165166acb5db500c3b4c4337aec2815c88c96fcc2ea + languageName: node + linkType: hard + "on-headers@npm:~1.0.2": version: 1.0.2 resolution: "on-headers@npm:1.0.2" @@ -25603,7 +25640,7 @@ __metadata: languageName: node linkType: hard -"statuses@npm:>= 1.4.0 < 2": +"statuses@npm:>= 1.4.0 < 2, statuses@npm:~1.5.0": version: 1.5.0 resolution: "statuses@npm:1.5.0" checksum: 10c0/e433900956357b3efd79b1c547da4d291799ac836960c016d10a98f6a810b1b5c0dcc13b5a7aa609a58239b5190e1ea176ad9221c2157d2fd1c747393e6b2940 From 88fbc1b229f6a369c583785b793ca9264e842468 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 4 Jul 2024 08:56:49 +0200 Subject: [PATCH 07/26] remove express types --- code/core/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/code/core/package.json b/code/core/package.json index 0ce5a8c2ac2..8a4ec79f08a 100644 --- a/code/core/package.json +++ b/code/core/package.json @@ -246,7 +246,6 @@ }, "dependencies": { "@storybook/csf": "0.1.11", - "@types/express": "^4.17.21", "@types/node": "^18.0.0", "browser-assert": "^1.2.1", "esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0 || ^0.21.0", From 841777d040b3116e06ce265de6e5f41857cd4cd5 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Fri, 27 Sep 2024 18:50:40 +0700 Subject: [PATCH 08/26] feat: migrate from express to polka Migrates from express to polka 1.x. --- code/builders/builder-vite/package.json | 2 +- code/builders/builder-vite/src/index.ts | 14 +-- code/builders/builder-webpack5/src/index.ts | 10 +- code/core/package.json | 5 +- code/core/src/core-server/dev-server.ts | 14 +-- .../core/src/core-server/utils/doTelemetry.ts | 4 +- .../utils/get-caching-middleware.ts | 4 +- .../utils/getAccessControlMiddleware.ts | 4 +- .../utils/getStoryIndexGenerator.ts | 5 +- code/core/src/core-server/utils/metadata.ts | 4 +- .../src/core-server/utils/server-connect.ts | 87 ----------------- .../core/src/core-server/utils/server-init.ts | 21 ++--- .../src/core-server/utils/server-statics.ts | 5 +- .../core-server/utils/stories-json.test.ts | 4 +- .../src/core-server/utils/stories-json.ts | 4 +- code/core/src/types/modules/core-common.ts | 4 +- code/yarn.lock | 94 +++++++++---------- 17 files changed, 86 insertions(+), 199 deletions(-) delete mode 100644 code/core/src/core-server/utils/server-connect.ts diff --git a/code/builders/builder-vite/package.json b/code/builders/builder-vite/package.json index 3c519291210..17a5a9ae5d1 100644 --- a/code/builders/builder-vite/package.json +++ b/code/builders/builder-vite/package.json @@ -46,10 +46,10 @@ "@storybook/csf-plugin": "workspace:*", "@types/find-cache-dir": "^3.2.1", "browser-assert": "^1.2.1", - "connect": "^3.7.0", "es-module-lexer": "^1.5.0", "find-cache-dir": "^3.0.0", "magic-string": "^0.30.0", + "polka": "^1.0.0-next.28", "sirv": "^2.0.4", "ts-dedent": "^2.0.0" }, diff --git a/code/builders/builder-vite/src/index.ts b/code/builders/builder-vite/src/index.ts index 56422068e2b..3aa99e43497 100644 --- a/code/builders/builder-vite/src/index.ts +++ b/code/builders/builder-vite/src/index.ts @@ -5,7 +5,7 @@ import { join, parse } from 'node:path'; import { NoStatsForViteDevError } from 'storybook/internal/server-errors'; import type { Options } from 'storybook/internal/types'; -import type { NextHandleFunction } from 'connect'; +import type Polka from 'polka'; import sirv from 'sirv'; import { corePath } from 'storybook/core-path'; import type { ViteDevServer } from 'vite'; @@ -13,13 +13,14 @@ import type { ViteDevServer } from 'vite'; import { build as viteBuild } from './build'; import { transformIframeHtml } from './transform-iframe-html'; import type { ViteBuilder } from './types'; +import { createViteServer } from './vite-server'; export { withoutVitePlugins } from './utils/without-vite-plugins'; export { hasVitePlugins } from './utils/has-vite-plugins'; export * from './types'; -function iframeMiddleware(options: Options, server: ViteDevServer): NextHandleFunction { +function iframeMiddleware(options: Options, server: ViteDevServer): Polka.Middleware { return async (req, res, next) => { if (!req.url || !req.url.match(/^\/iframe\.html($|\?)/)) { next(); @@ -68,14 +69,7 @@ export const start: ViteBuilder['start'] = async ({ immutable: true, }); - app.use('/sb-preview', (req, res, next) => { - if (!req.url || req.url === '/') { - next(); - return; - } - - servePreview(req, res, next); - }); + app.use('/sb-preview', servePreview); app.use(iframeMiddleware(options as Options, server)); app.use(server.middlewares); diff --git a/code/builders/builder-webpack5/src/index.ts b/code/builders/builder-webpack5/src/index.ts index 97843e519ac..cd7430cf768 100644 --- a/code/builders/builder-webpack5/src/index.ts +++ b/code/builders/builder-webpack5/src/index.ts @@ -187,15 +187,7 @@ const starter: StarterFunction = async function* starterGeneratorFn({ immutable: true, }); - app.use('/sb-preview', (req, res, next) => { - if (!req.url || req.url === '/') { - next(); - return; - } - - servePreview(req, res, next); - }); - + app.use('/sb-preview', servePreview); app.use(compilation); app.use(webpackHotMiddleware(compiler, { log: false })); diff --git a/code/core/package.json b/code/core/package.json index f987bce728a..2ffa60cb7f4 100644 --- a/code/core/package.json +++ b/code/core/package.json @@ -305,6 +305,7 @@ "@emotion/use-insertion-effect-with-fallbacks": "^1.0.1", "@fal-works/esbuild-plugin-global-externals": "^2.1.2", "@ndelangen/get-tarball": "^3.0.7", + "@polka/compression": "^1.0.0-next.28", "@popperjs/core": "^2.6.0", "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-scroll-area": "1.2.0-rc.7", @@ -314,7 +315,6 @@ "@storybook/icons": "^1.2.10", "@tanstack/react-virtual": "^3.3.0", "@testing-library/react": "^14.0.0", - "@types/compression": "^1.7.0", "@types/cross-spawn": "^6.0.2", "@types/detect-port": "^1.3.0", "@types/diff": "^5.0.9", @@ -346,8 +346,6 @@ "cli-table3": "^0.6.1", "commander": "^12.1.0", "comment-parser": "^1.4.1", - "compression": "^1.7.4", - "connect": "^3.7.0", "copy-to-clipboard": "^3.3.1", "cross-spawn": "^7.0.3", "css": "^3.0.0", @@ -386,6 +384,7 @@ "open": "^8.4.0", "picomatch": "^2.3.0", "polished": "^4.2.2", + "polka": "^1.0.0-next.28", "prettier": "^3.2.5", "pretty-hrtime": "^1.0.3", "prompts": "^2.4.0", diff --git a/code/core/src/core-server/dev-server.ts b/code/core/src/core-server/dev-server.ts index 2a4ab7ac262..0653ceba93d 100644 --- a/code/core/src/core-server/dev-server.ts +++ b/code/core/src/core-server/dev-server.ts @@ -1,12 +1,13 @@ +import { logConfig } from '@storybook/core/common'; import type { Options } from '@storybook/core/types'; import { logger } from '@storybook/core/node-logger'; import { MissingBuilderError } from '@storybook/core/server-errors'; -import compression from 'compression'; +import compression from '@polka/compression'; +import polka from 'polka'; import invariant from 'tiny-invariant'; -import { logConfig } from '../common'; import type { StoryIndexGenerator } from './utils/StoryIndexGenerator'; import { doTelemetry } from './utils/doTelemetry'; import { getManagerBuilder, getPreviewBuilder } from './utils/get-builders'; @@ -17,19 +18,18 @@ import { getStoryIndexGenerator } from './utils/getStoryIndexGenerator'; import { getMiddleware } from './utils/middleware'; import { openInBrowser } from './utils/open-in-browser'; import { getServerAddresses } from './utils/server-address'; -import { type NextHandleFunction, connect } from './utils/server-connect'; import { getServer } from './utils/server-init'; import { useStatics } from './utils/server-statics'; export async function storybookDevServer(options: Options) { - const app = connect(); - const [server, features, core] = await Promise.all([ - getServer(app, options), + getServer(options), options.presets.apply('features'), options.presets.apply('core'), ]); + const app = polka({ server }); + const serverChannel = await options.presets.apply( 'experimental_serverChannel', getServerChannel(server) @@ -43,7 +43,7 @@ export async function storybookDevServer(options: Options) { return undefined; }); - app.use(compression({ level: 1 }) as NextHandleFunction); + app.use(compression({ level: 1 })); if (typeof options.extendServer === 'function') { options.extendServer(server); diff --git a/code/core/src/core-server/utils/doTelemetry.ts b/code/core/src/core-server/utils/doTelemetry.ts index d7db53f9cab..0e9b48b8c8f 100644 --- a/code/core/src/core-server/utils/doTelemetry.ts +++ b/code/core/src/core-server/utils/doTelemetry.ts @@ -1,17 +1,17 @@ import { getPrecedingUpgrade, telemetry } from '@storybook/core/telemetry'; import type { CoreConfig, Options } from '@storybook/core/types'; +import type Polka from 'polka'; import invariant from 'tiny-invariant'; import { sendTelemetryError } from '../withTelemetry'; import type { StoryIndexGenerator } from './StoryIndexGenerator'; import { useStorybookMetadata } from './metadata'; -import type { Server } from './server-connect'; import { summarizeIndex } from './summarizeIndex'; import { versionStatus } from './versionStatus'; export async function doTelemetry( - app: Server, + app: Polka.Polka, core: CoreConfig, initializedStoryIndexGenerator: Promise, options: Options diff --git a/code/core/src/core-server/utils/get-caching-middleware.ts b/code/core/src/core-server/utils/get-caching-middleware.ts index 1489117ba88..dd4d5c74715 100644 --- a/code/core/src/core-server/utils/get-caching-middleware.ts +++ b/code/core/src/core-server/utils/get-caching-middleware.ts @@ -1,6 +1,6 @@ -import type { NextHandleFunction } from './server-connect'; +import type Polka from 'polka'; -export function getCachingMiddleware(): NextHandleFunction { +export function getCachingMiddleware(): Polka.Middleware { return (req, res, next) => { res.setHeader('Cache-Control', 'no-store'); next(); diff --git a/code/core/src/core-server/utils/getAccessControlMiddleware.ts b/code/core/src/core-server/utils/getAccessControlMiddleware.ts index f6d2769d693..b44046d290b 100644 --- a/code/core/src/core-server/utils/getAccessControlMiddleware.ts +++ b/code/core/src/core-server/utils/getAccessControlMiddleware.ts @@ -1,6 +1,6 @@ -import type { NextHandleFunction } from './server-connect'; +import type Polka from 'polka'; -export function getAccessControlMiddleware(crossOriginIsolated: boolean): NextHandleFunction { +export function getAccessControlMiddleware(crossOriginIsolated: boolean): Polka.Middleware { return (req, res, next) => { res.setHeader('Access-Control-Allow-Origin', '*'); res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); diff --git a/code/core/src/core-server/utils/getStoryIndexGenerator.ts b/code/core/src/core-server/utils/getStoryIndexGenerator.ts index 11555bf7306..d6b1d7d1058 100644 --- a/code/core/src/core-server/utils/getStoryIndexGenerator.ts +++ b/code/core/src/core-server/utils/getStoryIndexGenerator.ts @@ -1,13 +1,14 @@ import { normalizeStories } from '@storybook/core/common'; import type { DocsOptions, Options } from '@storybook/core/types'; +import type Polka from 'polka'; + import { StoryIndexGenerator } from './StoryIndexGenerator'; import type { ServerChannel } from './get-server-channel'; -import type { Server } from './server-connect'; import { useStoriesJson } from './stories-json'; export async function getStoryIndexGenerator( - app: Server, + app: Polka.Polka, features: { argTypeTargetsV7?: boolean; }, diff --git a/code/core/src/core-server/utils/metadata.ts b/code/core/src/core-server/utils/metadata.ts index 16cea6042aa..a9a2ebb337b 100644 --- a/code/core/src/core-server/utils/metadata.ts +++ b/code/core/src/core-server/utils/metadata.ts @@ -2,7 +2,7 @@ import { writeFile } from 'node:fs/promises'; import { getStorybookMetadata } from '@storybook/core/telemetry'; -import type { Server } from './server-connect'; +import type Polka from 'polka'; export async function extractStorybookMetadata(outputFile: string, configDir: string) { const storybookMetadata = await getStorybookMetadata(configDir); @@ -10,7 +10,7 @@ export async function extractStorybookMetadata(outputFile: string, configDir: st await writeFile(outputFile, JSON.stringify(storybookMetadata)); } -export function useStorybookMetadata(app: Server, configDir?: string) { +export function useStorybookMetadata(app: Polka.Polka, configDir?: string) { app.use('/project.json', async (req, res) => { const storybookMetadata = await getStorybookMetadata(configDir); res.setHeader('Content-Type', 'application/json'); diff --git a/code/core/src/core-server/utils/server-connect.ts b/code/core/src/core-server/utils/server-connect.ts deleted file mode 100644 index 7bb43409b65..00000000000 --- a/code/core/src/core-server/utils/server-connect.ts +++ /dev/null @@ -1,87 +0,0 @@ -import connect from 'connect'; -import * as http from 'http'; - -export { connect }; - -export type ServerHandle = HandleFunction | http.Server; - -export class IncomingMessage extends http.IncomingMessage { - originalUrl?: http.IncomingMessage['url'] | undefined; -} - -type NextFunction = (err?: any) => void; - -export type SimpleHandleFunction = (req: IncomingMessage, res: http.ServerResponse) => void; -export type NextHandleFunction = ( - req: IncomingMessage, - res: http.ServerResponse, - next: NextFunction -) => void; -export type ErrorHandleFunction = ( - err: any, - req: IncomingMessage, - res: http.ServerResponse, - next: NextFunction -) => void; -export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction; - -export interface ServerStackItem { - route: string; - handle: ServerHandle; -} - -export interface Server extends NodeJS.EventEmitter { - (req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void; - - route: string; - stack: ServerStackItem[]; - - /** - * Utilize the given middleware `handle` to the given `route`, - * defaulting to _/_. This "route" is the mount-point for the - * middleware, when given a value other than _/_ the middleware - * is only effective when that segment is present in the request's - * pathname. - * - * For example if we were to mount a function at _/admin_, it would - * be invoked on _/admin_, and _/admin/settings_, however it would - * not be invoked for _/_, or _/posts_. - */ - use(fn: NextHandleFunction): Server; - use(fn: HandleFunction): Server; - use(route: string, fn: NextHandleFunction): Server; - use(route: string, fn: HandleFunction): Server; - - /** - * Handle server requests, punting them down - * the middleware stack. - */ - handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void; - - /** - * Listen for connections. - * - * This method takes the same arguments - * as node's `http.Server#listen()`. - * - * HTTP and HTTPS: - * - * If you run your application both as HTTP - * and HTTPS you may wrap them individually, - * since your Connect "server" is really just - * a JavaScript `Function`. - * - * var connect = require('connect') - * , http = require('http') - * , https = require('https'); - * - * var app = connect(); - * - * http.createServer(app).listen(80); - * https.createServer(options, app).listen(443); - */ - listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server; - listen(port: number, hostname?: string, callback?: Function): http.Server; - listen(path: string, callback?: Function): http.Server; - listen(handle: any, listeningListener?: Function): http.Server; -} diff --git a/code/core/src/core-server/utils/server-init.ts b/code/core/src/core-server/utils/server-init.ts index 53d6b9c5e97..d06c3421e7b 100644 --- a/code/core/src/core-server/utils/server-init.ts +++ b/code/core/src/core-server/utils/server-init.ts @@ -5,19 +5,14 @@ import { logger } from '@storybook/core/node-logger'; import http from 'http'; import https from 'https'; -import type { Server } from './server-connect'; - -export async function getServer( - app: Server, - options: { - https?: boolean; - sslCert?: string; - sslKey?: string; - sslCa?: string[]; - } -) { +export async function getServer(options: { + https?: boolean; + sslCert?: string; + sslKey?: string; + sslCa?: string[]; +}) { if (!options.https) { - return http.createServer(app); + return http.createServer(); } if (!options.sslCert) { @@ -36,5 +31,5 @@ export async function getServer( key: await readFile(options.sslKey, { encoding: 'utf8' }), }; - return https.createServer(sslOptions, app); + return https.createServer(sslOptions); } diff --git a/code/core/src/core-server/utils/server-statics.ts b/code/core/src/core-server/utils/server-statics.ts index 99d4a10ee28..6d1ffd59f04 100644 --- a/code/core/src/core-server/utils/server-statics.ts +++ b/code/core/src/core-server/utils/server-statics.ts @@ -8,11 +8,10 @@ import { logger } from '@storybook/core/node-logger'; import chalk from 'chalk'; import type { ServerResponse } from 'http'; +import type Polka from 'polka'; import sirv from 'sirv'; import { dedent } from 'ts-dedent'; -import type { Server } from './server-connect'; - // TODO (43081j): maybe get this from somewhere? const contentTypes: Record = { css: 'text/css', @@ -27,7 +26,7 @@ const setContentTypeHeaders = (res: ServerResponse, pathname: string) => { } }; -export async function useStatics(app: Server, options: Options): Promise { +export async function useStatics(app: Polka.Polka, options: Options): Promise { const staticDirs = (await options.presets.apply('staticDirs')) ?? []; const faviconPath = await options.presets.apply('favicon'); diff --git a/code/core/src/core-server/utils/stories-json.test.ts b/code/core/src/core-server/utils/stories-json.test.ts index 3ca7e213df4..cc11d43ba5a 100644 --- a/code/core/src/core-server/utils/stories-json.test.ts +++ b/code/core/src/core-server/utils/stories-json.test.ts @@ -8,13 +8,13 @@ import { STORY_INDEX_INVALIDATED } from '@storybook/core/core-events'; import { debounce } from 'es-toolkit/compat'; import type { Request, Response } from 'express'; +import type Polka from 'polka'; import Watchpack from 'watchpack'; import { csfIndexer } from '../presets/common-preset'; import type { StoryIndexGeneratorOptions } from './StoryIndexGenerator'; import { StoryIndexGenerator } from './StoryIndexGenerator'; import type { ServerChannel } from './get-server-channel'; -import type { Server } from './server-connect'; import { DEBOUNCE, useStoriesJson } from './stories-json'; vi.mock('watchpack'); @@ -59,7 +59,7 @@ const getInitializedStoryIndexGenerator = async ( describe('useStoriesJson', () => { const use = vi.fn(); - const app: Server = { use } as any; + const app: Polka.Polka = { use } as any; const end = vi.fn(); const write = vi.fn(); const response: Response = { diff --git a/code/core/src/core-server/utils/stories-json.ts b/code/core/src/core-server/utils/stories-json.ts index 2d5b50ead6a..a33e12eb039 100644 --- a/code/core/src/core-server/utils/stories-json.ts +++ b/code/core/src/core-server/utils/stories-json.ts @@ -6,10 +6,10 @@ import type { NormalizedStoriesSpecifier, StoryIndex } from '@storybook/core/typ import { STORY_INDEX_INVALIDATED } from '@storybook/core/core-events'; import { debounce } from 'es-toolkit/compat'; +import type Polka from 'polka'; import type { StoryIndexGenerator } from './StoryIndexGenerator'; import type { ServerChannel } from './get-server-channel'; -import type { Server } from './server-connect'; import { watchStorySpecifiers } from './watch-story-specifiers'; import { watchConfig } from './watchConfig'; @@ -33,7 +33,7 @@ export function useStoriesJson({ serverChannel, normalizedStories, }: { - app: Server; + app: Polka.Polka; initializedStoryIndexGenerator: Promise; serverChannel: ServerChannel; workingDir?: string; diff --git a/code/core/src/types/modules/core-common.ts b/code/core/src/types/modules/core-common.ts index 3eb0a5a9d79..d5dc8baf0be 100644 --- a/code/core/src/types/modules/core-common.ts +++ b/code/core/src/types/modules/core-common.ts @@ -2,10 +2,10 @@ import type { FileSystemCache } from 'file-system-cache'; // should be node:http, but that caused the ui/manager to fail to build, might be able to switch this back once ui/manager is in the core import type { Server as HttpServer } from 'http'; +import type Polka from 'polka'; import type { Options as TelejsonOptions } from 'telejson'; import type { PackageJson as PackageJsonFromTypeFest } from 'type-fest'; -import type { Server } from '../../core-server/utils/server-connect'; import type { Indexer, StoriesEntry } from './indexer'; /** āš ļø This file contains internal WIP types they MUST NOT be exported outside this package for now! */ @@ -216,7 +216,7 @@ export interface Builder { start: (args: { options: Options; startTime: ReturnType; - app: Server; + app: Polka.Polka; server: HttpServer; channel: ServerChannel; }) => Promise= 1.4.0 < 2, statuses@npm:~1.5.0": +"statuses@npm:>= 1.4.0 < 2": version: 1.5.0 resolution: "statuses@npm:1.5.0" checksum: 10c0/e433900956357b3efd79b1c547da4d291799ac836960c016d10a98f6a810b1b5c0dcc13b5a7aa609a58239b5190e1ea176ad9221c2157d2fd1c747393e6b2940 @@ -27626,6 +27611,15 @@ __metadata: languageName: node linkType: hard +"trouter@npm:^4.0.0": + version: 4.0.0 + resolution: "trouter@npm:4.0.0" + dependencies: + regexparam: "npm:^3.0.0" + checksum: 10c0/e27326a831187c6a47a72b62212364e3f88247fa2a8723e5030e14a0002b69756fb51f97efbda2466deb05f4a78ecb83c2a1a7b343e9659cbfb3f370156f1e12 + languageName: node + linkType: hard + "try-catch@npm:^3.0.0": version: 3.0.1 resolution: "try-catch@npm:3.0.1" From 056a37c2aed4bda1e6865ec42fc1db80e20e13af Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Fri, 27 Sep 2024 19:11:43 +0700 Subject: [PATCH 09/26] fix: revert a few changes --- code/core/src/builder-manager/index.ts | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/code/core/src/builder-manager/index.ts b/code/core/src/builder-manager/index.ts index 26cafb1a117..592416521a2 100644 --- a/code/core/src/builder-manager/index.ts +++ b/code/core/src/builder-manager/index.ts @@ -172,23 +172,8 @@ const starter: StarterFunction = async function* starterGeneratorFn({ startTime, dev: true, immutable: true, }); - // TODO (43081j): maybe abstract this into a reusable function - app.use('/sb-addons', (req, res, next) => { - if (!req.url || req.url === '/') { - next(); - return; - } - - serveAddons(req, res, next); - }); - app.use('/sb-manager', (req, res, next) => { - if (!req.url || req.url === '/') { - next(); - return; - } - - serveCore(req, res, next); - }); + app.use('/sb-addons', serveAddons); + app.use('/sb-manager', serveCore); const { cssFiles, jsFiles } = await readOrderedFiles(addonsDir, compilation?.outputFiles); From cce0f14f1e2040094ce9189d419b28451b642987 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Mon, 30 Sep 2024 22:35:02 +0200 Subject: [PATCH 10/26] listen for requests, cleanup --- code/builders/builder-vite/src/index.ts | 24 +++++++-------- code/builders/builder-webpack5/src/index.ts | 20 ++++++------- code/core/src/builder-manager/index.ts | 29 ++++++++++--------- code/core/src/core-server/dev-server.ts | 25 ++++++++-------- .../utils/getStoryIndexGenerator.ts | 3 -- .../src/core-server/utils/server-statics.ts | 24 ++++++++------- .../core-server/utils/stories-json.test.ts | 5 ++-- code/core/src/types/modules/core-common.ts | 1 + 8 files changed, 64 insertions(+), 67 deletions(-) diff --git a/code/builders/builder-vite/src/index.ts b/code/builders/builder-vite/src/index.ts index 3aa99e43497..9307c07dfed 100644 --- a/code/builders/builder-vite/src/index.ts +++ b/code/builders/builder-vite/src/index.ts @@ -26,7 +26,8 @@ function iframeMiddleware(options: Options, server: ViteDevServer): Polka.Middle next(); return; } - const url = new URL(req.url, 'https://storybook.js.org'); + // the base isn't used for anything, but it's required by the URL constructor + const url = new URL(req.url, 'http://localhost:6006'); // We need to handle `html-proxy` params for style tag HMR https://github.com/storybookjs/builder-vite/issues/266#issuecomment-1055677865 // e.g. /iframe.html?html-proxy&index=0.css @@ -62,15 +63,14 @@ export const start: ViteBuilder['start'] = async ({ server = await createViteServer(options as Options, devServer); const previewResolvedDir = join(corePath, 'dist/preview'); - const previewDirOrigin = previewResolvedDir; - const servePreview = sirv(previewDirOrigin, { - maxAge: 300000, - dev: true, - immutable: true, - }); - - app.use('/sb-preview', servePreview); - + app.use( + '/sb-preview', + sirv(previewResolvedDir, { + maxAge: 300000, + dev: true, + immutable: true, + }) + ); app.use(iframeMiddleware(options as Options, server)); app.use(server.middlewares); @@ -89,10 +89,8 @@ export const build: ViteBuilder['build'] = async ({ options }) => { const viteCompilation = viteBuild(options as Options); const previewResolvedDir = join(corePath, 'dist/preview'); - const previewDirOrigin = previewResolvedDir; const previewDirTarget = join(options.outputDir || '', `sb-preview`); - - const previewFiles = cp(previewDirOrigin, previewDirTarget, { + const previewFiles = cp(previewResolvedDir, previewDirTarget, { filter: (src) => { const { ext } = parse(src); if (ext) { diff --git a/code/builders/builder-webpack5/src/index.ts b/code/builders/builder-webpack5/src/index.ts index cd7430cf768..9e2245fec19 100644 --- a/code/builders/builder-webpack5/src/index.ts +++ b/code/builders/builder-webpack5/src/index.ts @@ -180,14 +180,14 @@ const starter: StarterFunction = async function* starterGeneratorFn({ compilation = webpackDevMiddleware(compiler, middlewareOptions); const previewResolvedDir = join(corePath, 'dist/preview'); - const previewDirOrigin = previewResolvedDir; - const servePreview = sirv(previewDirOrigin, { - maxAge: 300000, - dev: true, - immutable: true, - }); - - app.use('/sb-preview', servePreview); + app.use( + '/sb-preview', + sirv(previewResolvedDir, { + maxAge: 300000, + dev: true, + immutable: true, + }) + ); app.use(compilation); app.use(webpackHotMiddleware(compiler, { log: false })); @@ -293,10 +293,8 @@ const builder: BuilderFunction = async function* builderGeneratorFn({ startTime, }); const previewResolvedDir = join(corePath, 'dist/preview'); - const previewDirOrigin = previewResolvedDir; const previewDirTarget = join(options.outputDir || '', `sb-preview`); - - const previewFiles = cp(previewDirOrigin, previewDirTarget, { + const previewFiles = cp(previewResolvedDir, previewDirTarget, { filter: (src) => { const { ext } = parse(src); if (ext) { diff --git a/code/core/src/builder-manager/index.ts b/code/core/src/builder-manager/index.ts index 592416521a2..93241012b06 100644 --- a/code/core/src/builder-manager/index.ts +++ b/code/core/src/builder-manager/index.ts @@ -162,18 +162,22 @@ const starter: StarterFunction = async function* starterGeneratorFn({ startTime, 'manager' ); - const serveAddons = sirv(addonsDir, { - maxAge: 300000, - dev: true, - immutable: true, - }); - const serveCore = sirv(coreDirOrigin, { - maxAge: 300000, - dev: true, - immutable: true, - }); - app.use('/sb-addons', serveAddons); - app.use('/sb-manager', serveCore); + app.use( + '/sb-addons', + sirv(addonsDir, { + maxAge: 300000, + dev: true, + immutable: true, + }) + ); + app.use( + '/sb-manager', + sirv(coreDirOrigin, { + maxAge: 300000, + dev: true, + immutable: true, + }) + ); const { cssFiles, jsFiles } = await readOrderedFiles(addonsDir, compilation?.outputFiles); @@ -261,7 +265,6 @@ const builder: BuilderFunction = async function* builderGeneratorFn({ startTime, // TODO: this doesn't watch, we should change this to use the esbuild watch API: https://esbuild.github.io/api/#watch compilation = await instance({ ...config, - minify: true, }); diff --git a/code/core/src/core-server/dev-server.ts b/code/core/src/core-server/dev-server.ts index 0653ceba93d..9cf13d96f95 100644 --- a/code/core/src/core-server/dev-server.ts +++ b/code/core/src/core-server/dev-server.ts @@ -22,13 +22,13 @@ import { getServer } from './utils/server-init'; import { useStatics } from './utils/server-statics'; export async function storybookDevServer(options: Options) { - const [server, features, core] = await Promise.all([ - getServer(options), - options.presets.apply('features'), - options.presets.apply('core'), - ]); - + const [server, core] = await Promise.all([getServer(options), options.presets.apply('core')]); + console.log('LOG: starting dev server'); const app = polka({ server }); + // app.use((req, res, next) => { + // console.log('LOG: ', { url: req.url, method: req.method }); + // next(); + // }); const serverChannel = await options.presets.apply( 'experimental_serverChannel', @@ -38,7 +38,7 @@ export async function storybookDevServer(options: Options) { let indexError: Error | undefined; // try get index generator, if failed, send telemetry without storyCount, then rethrow the error const initializedStoryIndexGenerator: Promise = - getStoryIndexGenerator(app, features ?? {}, options, serverChannel).catch((err) => { + getStoryIndexGenerator(app, options, serverChannel).catch((err) => { indexError = err; return undefined; }); @@ -59,11 +59,6 @@ export async function storybookDevServer(options: Options) { const proto = options.https ? 'https' : 'http'; const { address, networkAddress } = getServerAddresses(port, host, proto, initialPath); - const listening = new Promise((resolve, reject) => { - // @ts-expect-error (Following line doesn't match TypeScript signature at all šŸ¤”) - server.listen({ port, host }, (error: Error) => (error ? reject(error) : resolve())); - }); - if (!core?.builder) { throw new MissingBuilderError(); } @@ -84,6 +79,7 @@ export async function storybookDevServer(options: Options) { startTime: process.hrtime(), options, app, + router: app, // back-compatability with express-based API server, channel: serverChannel, }); @@ -99,6 +95,7 @@ export async function storybookDevServer(options: Options) { startTime: process.hrtime(), options, app, + router: app, // back-compatability with express-based API server, channel: serverChannel, }) @@ -126,7 +123,9 @@ export async function storybookDevServer(options: Options) { previewStarted.catch(() => {}).then(() => next()); }); - await Promise.all([initializedStoryIndexGenerator, listening]).then(async ([indexGenerator]) => { + app.listen(port, host); + + await Promise.all([initializedStoryIndexGenerator]).then(async ([indexGenerator]) => { if (indexGenerator && !options.ci && !options.smokeTest && options.open) { openInBrowser(host ? networkAddress : address); } diff --git a/code/core/src/core-server/utils/getStoryIndexGenerator.ts b/code/core/src/core-server/utils/getStoryIndexGenerator.ts index d6b1d7d1058..d91373d825c 100644 --- a/code/core/src/core-server/utils/getStoryIndexGenerator.ts +++ b/code/core/src/core-server/utils/getStoryIndexGenerator.ts @@ -9,9 +9,6 @@ import { useStoriesJson } from './stories-json'; export async function getStoryIndexGenerator( app: Polka.Polka, - features: { - argTypeTargetsV7?: boolean; - }, options: Options, serverChannel: ServerChannel ): Promise { diff --git a/code/core/src/core-server/utils/server-statics.ts b/code/core/src/core-server/utils/server-statics.ts index 6d1ffd59f04..aa8f4876b4c 100644 --- a/code/core/src/core-server/utils/server-statics.ts +++ b/code/core/src/core-server/utils/server-statics.ts @@ -74,7 +74,8 @@ export async function useStatics(app: Polka.Polka, options: Options): Promise { const app: Polka.Polka = { use } as any; const end = vi.fn(); const write = vi.fn(); - const response: Response = { + const response: Polka.Response = { header: vi.fn(), send: vi.fn(), status: vi.fn(), @@ -82,7 +81,7 @@ describe('useStoriesJson', () => { Watchpack.mockClear(); }); - const request: Request = { + const request: Polka.Request = { headers: { accept: 'application/json' }, } as any; diff --git a/code/core/src/types/modules/core-common.ts b/code/core/src/types/modules/core-common.ts index d5dc8baf0be..ddecfea2d89 100644 --- a/code/core/src/types/modules/core-common.ts +++ b/code/core/src/types/modules/core-common.ts @@ -217,6 +217,7 @@ export interface Builder { options: Options; startTime: ReturnType; app: Polka.Polka; + router: Polka.Polka; // back-compatability with express-based API server: HttpServer; channel: ServerChannel; }) => Promise Date: Tue, 1 Oct 2024 13:49:25 +0200 Subject: [PATCH 11/26] comment update --- code/builders/builder-vite/src/plugins/code-generator-plugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/builders/builder-vite/src/plugins/code-generator-plugin.ts b/code/builders/builder-vite/src/plugins/code-generator-plugin.ts index 77509b97cf9..79dba384406 100644 --- a/code/builders/builder-vite/src/plugins/code-generator-plugin.ts +++ b/code/builders/builder-vite/src/plugins/code-generator-plugin.ts @@ -50,7 +50,7 @@ export function codeGeneratorPlugin(options: Options): Plugin { }, config(config, { command }) { // If we are building the static distribution, add iframe.html as an entry. - // In development mode, it's not an entry - instead, we use an express middleware + // In development mode, it's not an entry - instead, we use a middleware // to serve iframe.html. The reason is that Vite's dev server (at the time of writing) // does not support virtual files as entry points. if (command === 'build') { From 4fd94e63e9cada9a98b9bd1f8869838e59a6694b Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Wed, 2 Oct 2024 09:05:25 +0200 Subject: [PATCH 12/26] remove custom content-type headers --- .../src/core-server/utils/server-statics.ts | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/code/core/src/core-server/utils/server-statics.ts b/code/core/src/core-server/utils/server-statics.ts index aa8f4876b4c..04f985901ce 100644 --- a/code/core/src/core-server/utils/server-statics.ts +++ b/code/core/src/core-server/utils/server-statics.ts @@ -7,25 +7,10 @@ import type { Options } from '@storybook/core/types'; import { logger } from '@storybook/core/node-logger'; import chalk from 'chalk'; -import type { ServerResponse } from 'http'; import type Polka from 'polka'; import sirv from 'sirv'; import { dedent } from 'ts-dedent'; -// TODO (43081j): maybe get this from somewhere? -const contentTypes: Record = { - css: 'text/css', - woff2: 'font/woff2', - js: 'text/javascript', -}; -const setContentTypeHeaders = (res: ServerResponse, pathname: string) => { - const base = basename(pathname); - const contentType = contentTypes[base]; - if (contentType) { - res.setHeader('Content-Type', contentType); - } -}; - export async function useStatics(app: Polka.Polka, options: Options): Promise { const staticDirs = (await options.presets.apply('staticDirs')) ?? []; const faviconPath = await options.presets.apply('favicon'); @@ -49,7 +34,7 @@ export async function useStatics(app: Polka.Polka, options: Options): Promise Serving static files from ${chalk.cyan(staticDir)} at ${chalk.cyan(targetEndpoint)}` ); @@ -66,7 +51,6 @@ export async function useStatics(app: Polka.Polka, options: Options): Promise { From 0cafba675b7ccb29fd2001aa07f0012024fc2959 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Wed, 2 Oct 2024 10:11:23 +0200 Subject: [PATCH 13/26] make polka a dev dep of builder-vite --- code/builders/builder-vite/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/builders/builder-vite/package.json b/code/builders/builder-vite/package.json index 3853291d891..6487f0cdb09 100644 --- a/code/builders/builder-vite/package.json +++ b/code/builders/builder-vite/package.json @@ -49,7 +49,6 @@ "es-module-lexer": "^1.5.0", "find-cache-dir": "^3.0.0", "magic-string": "^0.30.0", - "polka": "^1.0.0-next.28", "sirv": "^2.0.4", "ts-dedent": "^2.0.0" }, @@ -57,6 +56,7 @@ "@types/express": "^4.17.21", "@types/node": "^22.0.0", "glob": "^10.0.0", + "polka": "^1.0.0-next.28", "slash": "^5.0.0", "typescript": "^5.3.2", "vite": "^4.0.4" From 31ca3f76336a6ea380833fd92fc69f6f05b9130a Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Wed, 2 Oct 2024 10:15:01 +0200 Subject: [PATCH 14/26] prebundle polka, sirv --- code/builders/builder-vite/package.json | 2 +- code/builders/builder-webpack5/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/builders/builder-vite/package.json b/code/builders/builder-vite/package.json index 6487f0cdb09..da62b3d90d6 100644 --- a/code/builders/builder-vite/package.json +++ b/code/builders/builder-vite/package.json @@ -49,7 +49,6 @@ "es-module-lexer": "^1.5.0", "find-cache-dir": "^3.0.0", "magic-string": "^0.30.0", - "sirv": "^2.0.4", "ts-dedent": "^2.0.0" }, "devDependencies": { @@ -57,6 +56,7 @@ "@types/node": "^22.0.0", "glob": "^10.0.0", "polka": "^1.0.0-next.28", + "sirv": "^2.0.4", "slash": "^5.0.0", "typescript": "^5.3.2", "vite": "^4.0.4" diff --git a/code/builders/builder-webpack5/package.json b/code/builders/builder-webpack5/package.json index e9250474971..70a2b505be1 100644 --- a/code/builders/builder-webpack5/package.json +++ b/code/builders/builder-webpack5/package.json @@ -78,7 +78,6 @@ "path-browserify": "^1.0.1", "process": "^0.11.10", "semver": "^7.3.7", - "sirv": "^2.0.4", "style-loader": "^3.3.1", "terser-webpack-plugin": "^5.3.1", "ts-dedent": "^2.0.0", @@ -95,6 +94,7 @@ "@types/terser-webpack-plugin": "^5.2.0", "@types/webpack-hot-middleware": "^2.25.6", "pretty-hrtime": "^1.0.3", + "sirv": "^2.0.4", "slash": "^5.0.0", "typescript": "^5.3.2" }, From d85dc51b86688c207527d830fb5f5627c5df9b01 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Thu, 3 Oct 2024 11:15:59 +0200 Subject: [PATCH 15/26] revert to existing static serving logic --- .../src/core-server/utils/server-statics.ts | 116 +++++++----------- 1 file changed, 46 insertions(+), 70 deletions(-) diff --git a/code/core/src/core-server/utils/server-statics.ts b/code/core/src/core-server/utils/server-statics.ts index 04f985901ce..b49130ad175 100644 --- a/code/core/src/core-server/utils/server-statics.ts +++ b/code/core/src/core-server/utils/server-statics.ts @@ -1,5 +1,5 @@ import { existsSync } from 'node:fs'; -import { basename, isAbsolute, normalize, posix, relative, resolve, sep, win32 } from 'node:path'; +import { basename, isAbsolute, posix, resolve, sep, win32 } from 'node:path'; import { getDirectoryFromWorkingDir } from '@storybook/core/common'; import type { Options } from '@storybook/core/types'; @@ -15,76 +15,52 @@ export async function useStatics(app: Polka.Polka, options: Options): Promise('favicon'); - const statics: Array<{ targetEndpoint: string; staticPath: string }> = []; - const userStatics = [ - `${faviconPath}:/${basename(faviconPath)}`, - ...staticDirs.map((dir) => (typeof dir === 'string' ? dir : `${dir.from}:${dir.to}`)), - ]; - - for (const dir of userStatics) { - try { - const normalizedDir = - staticDirs && !isAbsolute(dir) - ? getDirectoryFromWorkingDir({ - configDir: options.configDir, - workingDir: process.cwd(), - directory: dir, + await Promise.all( + staticDirs + .map((dir) => (typeof dir === 'string' ? dir : `${dir.from}:${dir.to}`)) + .map(async (dir) => { + try { + const normalizedDir = + staticDirs && !isAbsolute(dir) + ? getDirectoryFromWorkingDir({ + configDir: options.configDir, + workingDir: process.cwd(), + directory: dir, + }) + : dir; + const { staticDir, staticPath, targetEndpoint } = await parseStaticDir(normalizedDir); + + // Don't log for the internal static dir + if (!targetEndpoint.startsWith('/sb-')) { + logger.info( + `=> Serving static files from ${chalk.cyan(staticDir)} at ${chalk.cyan(targetEndpoint)}` + ); + } + + app.use( + targetEndpoint, + sirv(staticPath, { + dev: true, + etag: true, + extensions: [], }) - : dir; - const { staticDir, staticPath, targetEndpoint } = await parseStaticDir(normalizedDir); - - // Don't log for the internal static dir - if (!targetEndpoint.startsWith('/sb-') && staticPath !== faviconPath) { - logger.info( - `=> Serving static files from ${chalk.cyan(staticDir)} at ${chalk.cyan(targetEndpoint)}` - ); - } - - statics.push({ targetEndpoint, staticPath }); - } catch (e) { - if (e instanceof Error) { - logger.warn(e.message); - } - } - } - - const serve = sirv(process.cwd(), { - dev: true, - etag: true, - }); - - app.use((req, res, next) => { - if (!req.url) { - return next(); - } - - // the base isn't used for anything, but it's required by the URL constructor - const url = new URL(req.url, 'http://localhost:6006'); - const pathname = normalize(url.pathname); - - // TODO (43081j): this is 'security' so you can't break out of cwd - // Probably need to do something better here - if (pathname.startsWith('..') || pathname.endsWith('/')) { - return next(); - } - - for (const { targetEndpoint, staticPath } of statics) { - if (!pathname.startsWith(targetEndpoint)) { - continue; - } - // TODO (43081j): similar as above, this might be doable in a cleaner way - const newPath = relative( - process.cwd(), - resolve(staticPath, './' + pathname.slice(targetEndpoint.length)) - ); - url.pathname = newPath; - req.url = url.href.slice(url.origin.length); - serve(req, res, next); - return; - } - - next(); - }); + ); + } catch (e) { + if (e instanceof Error) { + logger.warn(e.message); + } + } + }) + ); + + app.get( + `/${basename(faviconPath)}`, + sirv(faviconPath, { + dev: true, + etag: true, + extensions: [], + }) + ); } export const parseStaticDir = async (arg: string) => { From 8f7f8812f5913eaa39fe5fc09da484aa5897baae Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Thu, 3 Oct 2024 13:25:10 +0200 Subject: [PATCH 16/26] cleanup express dependencies --- code/builders/builder-vite/package.json | 1 - code/yarn.lock | 3 +- scripts/package.json | 2 - scripts/utils/serve.ts | 14 ------- scripts/yarn.lock | 54 +------------------------ 5 files changed, 3 insertions(+), 71 deletions(-) delete mode 100644 scripts/utils/serve.ts diff --git a/code/builders/builder-vite/package.json b/code/builders/builder-vite/package.json index da62b3d90d6..a9c982f98d4 100644 --- a/code/builders/builder-vite/package.json +++ b/code/builders/builder-vite/package.json @@ -52,7 +52,6 @@ "ts-dedent": "^2.0.0" }, "devDependencies": { - "@types/express": "^4.17.21", "@types/node": "^22.0.0", "glob": "^10.0.0", "polka": "^1.0.0-next.28", diff --git a/code/yarn.lock b/code/yarn.lock index e3ca8b48ce6..d5ec15207ec 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6089,7 +6089,6 @@ __metadata: resolution: "@storybook/builder-vite@workspace:builders/builder-vite" dependencies: "@storybook/csf-plugin": "workspace:*" - "@types/express": "npm:^4.17.21" "@types/find-cache-dir": "npm:^3.2.1" "@types/node": "npm:^22.0.0" browser-assert: "npm:^1.2.1" @@ -8104,7 +8103,7 @@ __metadata: languageName: node linkType: hard -"@types/express@npm:*, @types/express@npm:^4.17.13, @types/express@npm:^4.17.21": +"@types/express@npm:*, @types/express@npm:^4.17.13": version: 4.17.21 resolution: "@types/express@npm:4.17.21" dependencies: diff --git a/scripts/package.json b/scripts/package.json index 456ba6c0603..51c33d4b000 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -75,7 +75,6 @@ "@types/detect-port": "^1.3.5", "@types/ejs": "^3.1.5", "@types/escodegen": "^0.0.6", - "@types/express": "^4.17.21", "@types/fs-extra": "^11.0.4", "@types/http-server": "^0.12.4", "@types/jest": "^29.5.12", @@ -124,7 +123,6 @@ "eslint-plugin-react-hooks": "^4.6.2", "eslint-plugin-storybook": "^0.8.0", "execa": "^6.1.0", - "express": "^4.19.2", "fast-folder-size": "^2.2.0", "fast-glob": "^3.3.2", "find-up": "^5.0.0", diff --git a/scripts/utils/serve.ts b/scripts/utils/serve.ts deleted file mode 100644 index 98ba1da21c6..00000000000 --- a/scripts/utils/serve.ts +++ /dev/null @@ -1,14 +0,0 @@ -import express from 'express'; -import type { Server } from 'http'; -import serveStatic from 'serve-static'; - -export const serve = async (location: string, port: string): Promise => { - return new Promise((resolve) => { - const app = express(); - - app.use(serveStatic(location)); - const server = app.listen(port, () => { - resolve(server); - }); - }); -}; diff --git a/scripts/yarn.lock b/scripts/yarn.lock index 68267cf11fe..18fd280b33a 100644 --- a/scripts/yarn.lock +++ b/scripts/yarn.lock @@ -1538,7 +1538,6 @@ __metadata: "@types/detect-port": "npm:^1.3.5" "@types/ejs": "npm:^3.1.5" "@types/escodegen": "npm:^0.0.6" - "@types/express": "npm:^4.17.21" "@types/fs-extra": "npm:^11.0.4" "@types/http-server": "npm:^0.12.4" "@types/jest": "npm:^29.5.12" @@ -1588,7 +1587,6 @@ __metadata: eslint-plugin-react-hooks: "npm:^4.6.2" eslint-plugin-storybook: "npm:^0.8.0" execa: "npm:^6.1.0" - express: "npm:^4.19.2" fast-folder-size: "npm:^2.2.0" fast-glob: "npm:^3.3.2" find-up: "npm:^5.0.0" @@ -1769,16 +1767,6 @@ __metadata: languageName: node linkType: hard -"@types/body-parser@npm:*": - version: 1.19.4 - resolution: "@types/body-parser@npm:1.19.4" - dependencies: - "@types/connect": "npm:*" - "@types/node": "npm:*" - checksum: 10c0/bec2b8a97861a960ee415f7ab3c2aeb7f4d779fd364d27ddee46057897ea571735f1f854f5ee41682964315d4e3699f62427998b9c21851d773398ef535f0612 - languageName: node - linkType: hard - "@types/concat-stream@npm:^2.0.0": version: 2.0.1 resolution: "@types/concat-stream@npm:2.0.1" @@ -1852,30 +1840,6 @@ __metadata: languageName: node linkType: hard -"@types/express-serve-static-core@npm:^4.17.33": - version: 4.17.39 - resolution: "@types/express-serve-static-core@npm:4.17.39" - dependencies: - "@types/node": "npm:*" - "@types/qs": "npm:*" - "@types/range-parser": "npm:*" - "@types/send": "npm:*" - checksum: 10c0/b23b005fddd2ba3f7142ec9713f06b5582c7712cdf99c3419d3972364903b348a103c3264d9a761d6497140e3b89bd416454684c4bdeff206b4c59b86e96428a - languageName: node - linkType: hard - -"@types/express@npm:^4.17.21": - version: 4.17.21 - resolution: "@types/express@npm:4.17.21" - dependencies: - "@types/body-parser": "npm:*" - "@types/express-serve-static-core": "npm:^4.17.33" - "@types/qs": "npm:*" - "@types/serve-static": "npm:*" - checksum: 10c0/12e562c4571da50c7d239e117e688dc434db1bac8be55613294762f84fd77fbd0658ccd553c7d3ab02408f385bc93980992369dd30e2ecd2c68c358e6af8fabf - languageName: node - linkType: hard - "@types/fs-extra@npm:^11.0.4": version: 11.0.4 resolution: "@types/fs-extra@npm:11.0.4" @@ -2097,20 +2061,6 @@ __metadata: languageName: node linkType: hard -"@types/qs@npm:*": - version: 6.9.9 - resolution: "@types/qs@npm:6.9.9" - checksum: 10c0/aede2a4181a49ae8548a1354bac3f8235cb0c5aab066b10875a3e68e88a199e220f4284e7e2bb75a3c18e5d4ff6abe1a6ce0389ef31b63952cc45e0f4d885ba0 - languageName: node - linkType: hard - -"@types/range-parser@npm:*": - version: 1.2.6 - resolution: "@types/range-parser@npm:1.2.6" - checksum: 10c0/46e7fffc54cdacc8fb0cd576f8f9a6436453f0176205d6ec55434a460c7677e78e688673426d5db5e480501b2943ba08a16ececa3a354c222093551c7217fb8f - languageName: node - linkType: hard - "@types/react-dom@npm:^18.3.0": version: 18.3.0 resolution: "@types/react-dom@npm:18.3.0" @@ -2154,7 +2104,7 @@ __metadata: languageName: node linkType: hard -"@types/serve-static@npm:*, @types/serve-static@npm:^1.15.7": +"@types/serve-static@npm:^1.15.7": version: 1.15.7 resolution: "@types/serve-static@npm:1.15.7" dependencies: @@ -6015,7 +5965,7 @@ __metadata: languageName: node linkType: hard -"express@npm:4.19.2, express@npm:^4.19.2": +"express@npm:4.19.2": version: 4.19.2 resolution: "express@npm:4.19.2" dependencies: From 2b4803efdab25e8ed0f1aaf677cd6bd0b31283ce Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Thu, 3 Oct 2024 13:52:04 +0200 Subject: [PATCH 17/26] Don't expose Polka typings --- code/core/src/types/modules/core-common.ts | 32 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/code/core/src/types/modules/core-common.ts b/code/core/src/types/modules/core-common.ts index ddecfea2d89..290f632f799 100644 --- a/code/core/src/types/modules/core-common.ts +++ b/code/core/src/types/modules/core-common.ts @@ -1,8 +1,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ import type { FileSystemCache } from 'file-system-cache'; // should be node:http, but that caused the ui/manager to fail to build, might be able to switch this back once ui/manager is in the core -import type { Server as HttpServer } from 'http'; -import type Polka from 'polka'; +import type { Server as HttpServer, IncomingMessage } from 'http'; import type { Options as TelejsonOptions } from 'telejson'; import type { PackageJson as PackageJsonFromTypeFest } from 'type-fest'; @@ -211,13 +210,38 @@ export type Options = LoadOptions & CLIOptions & BuilderOptions & { build?: TestBuildConfig }; +// A minimal version of Polka's interface to avoid exposing internal implementation details +type Pattern = RegExp | string; +type Middleware = ( + req: T & IncomingMessage, + res: Response, + next: (err?: string | Error) => Promise | void +) => Promise; + +interface ServerApp { + server: HttpServer; + + use(pattern: Pattern, ...handlers: Middleware[]): this; + use(...handlers: Middleware[]): this; + + get(...handlers: Middleware[]): this; + post(...handlers: Middleware[]): this; + put(...handlers: Middleware[]): this; + patch(...handlers: Middleware[]): this; + delete(...handlers: Middleware[]): this; + head(...handlers: Middleware[]): this; + options(...handlers: Middleware[]): this; + connect(...handlers: Middleware[]): this; + trace(...handlers: Middleware[]): this; +} + export interface Builder { getConfig: (options: Options) => Promise; start: (args: { options: Options; startTime: ReturnType; - app: Polka.Polka; - router: Polka.Polka; // back-compatability with express-based API + app: ServerApp; + router: ServerApp; // back-compatability with express-based API server: HttpServer; channel: ServerChannel; }) => Promise Date: Thu, 3 Oct 2024 14:29:48 +0200 Subject: [PATCH 18/26] fix middleware types --- code/builders/builder-vite/src/index.ts | 5 ++--- .../src/core-server/utils/get-caching-middleware.ts | 4 ++-- .../core-server/utils/getAccessControlMiddleware.ts | 4 ++-- code/core/src/types/modules/core-common.ts | 11 +++++------ 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/code/builders/builder-vite/src/index.ts b/code/builders/builder-vite/src/index.ts index 9307c07dfed..fab1d8c81bf 100644 --- a/code/builders/builder-vite/src/index.ts +++ b/code/builders/builder-vite/src/index.ts @@ -3,9 +3,8 @@ import { cp, readFile } from 'node:fs/promises'; import { join, parse } from 'node:path'; import { NoStatsForViteDevError } from 'storybook/internal/server-errors'; -import type { Options } from 'storybook/internal/types'; +import type { Middleware, Options } from 'storybook/internal/types'; -import type Polka from 'polka'; import sirv from 'sirv'; import { corePath } from 'storybook/core-path'; import type { ViteDevServer } from 'vite'; @@ -20,7 +19,7 @@ export { hasVitePlugins } from './utils/has-vite-plugins'; export * from './types'; -function iframeMiddleware(options: Options, server: ViteDevServer): Polka.Middleware { +function iframeMiddleware(options: Options, server: ViteDevServer): Middleware { return async (req, res, next) => { if (!req.url || !req.url.match(/^\/iframe\.html($|\?)/)) { next(); diff --git a/code/core/src/core-server/utils/get-caching-middleware.ts b/code/core/src/core-server/utils/get-caching-middleware.ts index dd4d5c74715..88cc96c2ae7 100644 --- a/code/core/src/core-server/utils/get-caching-middleware.ts +++ b/code/core/src/core-server/utils/get-caching-middleware.ts @@ -1,6 +1,6 @@ -import type Polka from 'polka'; +import type { Middleware } from '../../types'; -export function getCachingMiddleware(): Polka.Middleware { +export function getCachingMiddleware(): Middleware { return (req, res, next) => { res.setHeader('Cache-Control', 'no-store'); next(); diff --git a/code/core/src/core-server/utils/getAccessControlMiddleware.ts b/code/core/src/core-server/utils/getAccessControlMiddleware.ts index b44046d290b..0b5c3428b84 100644 --- a/code/core/src/core-server/utils/getAccessControlMiddleware.ts +++ b/code/core/src/core-server/utils/getAccessControlMiddleware.ts @@ -1,6 +1,6 @@ -import type Polka from 'polka'; +import type { Middleware } from '../../types'; -export function getAccessControlMiddleware(crossOriginIsolated: boolean): Polka.Middleware { +export function getAccessControlMiddleware(crossOriginIsolated: boolean): Middleware { return (req, res, next) => { res.setHeader('Access-Control-Allow-Origin', '*'); res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); diff --git a/code/core/src/types/modules/core-common.ts b/code/core/src/types/modules/core-common.ts index 290f632f799..968b588054f 100644 --- a/code/core/src/types/modules/core-common.ts +++ b/code/core/src/types/modules/core-common.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ import type { FileSystemCache } from 'file-system-cache'; // should be node:http, but that caused the ui/manager to fail to build, might be able to switch this back once ui/manager is in the core -import type { Server as HttpServer, IncomingMessage } from 'http'; +import type { Server as HttpServer, IncomingMessage, ServerResponse } from 'http'; import type { Options as TelejsonOptions } from 'telejson'; import type { PackageJson as PackageJsonFromTypeFest } from 'type-fest'; @@ -211,17 +211,16 @@ export type Options = LoadOptions & BuilderOptions & { build?: TestBuildConfig }; // A minimal version of Polka's interface to avoid exposing internal implementation details -type Pattern = RegExp | string; -type Middleware = ( +export type Middleware = ( req: T & IncomingMessage, - res: Response, + res: ServerResponse, next: (err?: string | Error) => Promise | void -) => Promise; +) => Promise | void; interface ServerApp { server: HttpServer; - use(pattern: Pattern, ...handlers: Middleware[]): this; + use(pattern: RegExp | string, ...handlers: Middleware[]): this; use(...handlers: Middleware[]): this; get(...handlers: Middleware[]): this; From b563eee59979388a354e79c18d42d3eff6593fb1 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Fri, 4 Oct 2024 11:46:21 +0200 Subject: [PATCH 19/26] only expose router to builders --- code/builders/builder-vite/src/index.ts | 8 ++++---- code/builders/builder-webpack5/src/index.ts | 8 ++++---- code/core/src/builder-manager/index.ts | 14 +++++++++----- code/core/src/core-server/dev-server.ts | 3 +-- code/core/src/types/modules/core-common.ts | 3 +-- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/code/builders/builder-vite/src/index.ts b/code/builders/builder-vite/src/index.ts index fab1d8c81bf..9ab66f2771d 100644 --- a/code/builders/builder-vite/src/index.ts +++ b/code/builders/builder-vite/src/index.ts @@ -56,13 +56,13 @@ export async function bail(): Promise { export const start: ViteBuilder['start'] = async ({ startTime, options, - app, + router, server: devServer, }) => { server = await createViteServer(options as Options, devServer); const previewResolvedDir = join(corePath, 'dist/preview'); - app.use( + router.use( '/sb-preview', sirv(previewResolvedDir, { maxAge: 300000, @@ -70,8 +70,8 @@ export const start: ViteBuilder['start'] = async ({ immutable: true, }) ); - app.use(iframeMiddleware(options as Options, server)); - app.use(server.middlewares); + router.use(iframeMiddleware(options as Options, server)); + router.use(server.middlewares); return { bail, diff --git a/code/builders/builder-webpack5/src/index.ts b/code/builders/builder-webpack5/src/index.ts index 9e2245fec19..f5d973547a6 100644 --- a/code/builders/builder-webpack5/src/index.ts +++ b/code/builders/builder-webpack5/src/index.ts @@ -114,7 +114,7 @@ export const bail: WebpackBuilder['bail'] = async () => { const starter: StarterFunction = async function* starterGeneratorFn({ startTime, options, - app, + router, channel, }) { const webpackInstance = await executor.get(options); @@ -180,7 +180,7 @@ const starter: StarterFunction = async function* starterGeneratorFn({ compilation = webpackDevMiddleware(compiler, middlewareOptions); const previewResolvedDir = join(corePath, 'dist/preview'); - app.use( + router.use( '/sb-preview', sirv(previewResolvedDir, { maxAge: 300000, @@ -188,8 +188,8 @@ const starter: StarterFunction = async function* starterGeneratorFn({ immutable: true, }) ); - app.use(compilation); - app.use(webpackHotMiddleware(compiler, { log: false })); + router.use(compilation); + router.use(webpackHotMiddleware(compiler, { log: false })); const stats = await new Promise((res, rej) => { compilation?.waitUntilValid(res as any); diff --git a/code/core/src/builder-manager/index.ts b/code/core/src/builder-manager/index.ts index 93241012b06..faad0a288ac 100644 --- a/code/core/src/builder-manager/index.ts +++ b/code/core/src/builder-manager/index.ts @@ -122,7 +122,11 @@ export const executor = { * * I am sorry for making you read about generators today :') */ -const starter: StarterFunction = async function* starterGeneratorFn({ startTime, options, app }) { +const starter: StarterFunction = async function* starterGeneratorFn({ + startTime, + options, + router, +}) { if (!options.quiet) { logger.info('=> Starting manager..'); } @@ -162,7 +166,7 @@ const starter: StarterFunction = async function* starterGeneratorFn({ startTime, 'manager' ); - app.use( + router.use( '/sb-addons', sirv(addonsDir, { maxAge: 300000, @@ -170,7 +174,7 @@ const starter: StarterFunction = async function* starterGeneratorFn({ startTime, immutable: true, }) ); - app.use( + router.use( '/sb-manager', sirv(coreDirOrigin, { maxAge: 300000, @@ -204,7 +208,7 @@ const starter: StarterFunction = async function* starterGeneratorFn({ startTime, yield; - app.use('/', ({ url }, res, next) => { + router.use('/', ({ url }, res, next) => { if (url && isRootPath.test(url)) { res.statusCode = 200; res.write(html); @@ -213,7 +217,7 @@ const starter: StarterFunction = async function* starterGeneratorFn({ startTime, next(); } }); - app.use(`/index.html`, (req, res) => { + router.use(`/index.html`, (req, res) => { res.statusCode = 200; res.write(html); res.end(); diff --git a/code/core/src/core-server/dev-server.ts b/code/core/src/core-server/dev-server.ts index 9cf13d96f95..5164ee31992 100644 --- a/code/core/src/core-server/dev-server.ts +++ b/code/core/src/core-server/dev-server.ts @@ -78,8 +78,7 @@ export async function storybookDevServer(options: Options) { const managerResult = await managerBuilder.start({ startTime: process.hrtime(), options, - app, - router: app, // back-compatability with express-based API + router: app, server, channel: serverChannel, }); diff --git a/code/core/src/types/modules/core-common.ts b/code/core/src/types/modules/core-common.ts index 968b588054f..d8a5e1b5bca 100644 --- a/code/core/src/types/modules/core-common.ts +++ b/code/core/src/types/modules/core-common.ts @@ -239,8 +239,7 @@ export interface Builder { start: (args: { options: Options; startTime: ReturnType; - app: ServerApp; - router: ServerApp; // back-compatability with express-based API + router: ServerApp; server: HttpServer; channel: ServerChannel; }) => Promise Date: Mon, 7 Oct 2024 13:15:46 +0200 Subject: [PATCH 20/26] fix ServerApp types to match Polka/Trouter --- code/core/src/core-server/dev-server.ts | 3 +- .../core-server/utils/stories-json.test.ts | 2 +- code/core/src/types/modules/core-common.ts | 21 ++++++------ scripts/package.json | 1 + scripts/yarn.lock | 34 +++++++++++++++++++ 5 files changed, 48 insertions(+), 13 deletions(-) diff --git a/code/core/src/core-server/dev-server.ts b/code/core/src/core-server/dev-server.ts index 5164ee31992..f0af2ec8e1b 100644 --- a/code/core/src/core-server/dev-server.ts +++ b/code/core/src/core-server/dev-server.ts @@ -93,8 +93,7 @@ export async function storybookDevServer(options: Options) { .start({ startTime: process.hrtime(), options, - app, - router: app, // back-compatability with express-based API + router: app, server, channel: serverChannel, }) diff --git a/code/core/src/core-server/utils/stories-json.test.ts b/code/core/src/core-server/utils/stories-json.test.ts index b1cbbf169f6..4868c149b72 100644 --- a/code/core/src/core-server/utils/stories-json.test.ts +++ b/code/core/src/core-server/utils/stories-json.test.ts @@ -385,7 +385,7 @@ describe('useStoriesJson', () => { await Promise.all([firstPromise, secondPromise]); expect(end).toHaveBeenCalledTimes(1); - expect(response.status).not.toEqual(500); + expect(response.statusCode).not.toEqual(500); expect(secondResponse.end).toHaveBeenCalledTimes(1); expect(secondResponse.status).not.toEqual(500); }); diff --git a/code/core/src/types/modules/core-common.ts b/code/core/src/types/modules/core-common.ts index d8a5e1b5bca..3dd6668ef11 100644 --- a/code/core/src/types/modules/core-common.ts +++ b/code/core/src/types/modules/core-common.ts @@ -2,6 +2,7 @@ import type { FileSystemCache } from 'file-system-cache'; // should be node:http, but that caused the ui/manager to fail to build, might be able to switch this back once ui/manager is in the core import type { Server as HttpServer, IncomingMessage, ServerResponse } from 'http'; +import type { Server as NetServer } from 'net'; import type { Options as TelejsonOptions } from 'telejson'; import type { PackageJson as PackageJsonFromTypeFest } from 'type-fest'; @@ -218,20 +219,20 @@ export type Middleware = ( ) => Promise | void; interface ServerApp { - server: HttpServer; + server: NetServer; use(pattern: RegExp | string, ...handlers: Middleware[]): this; use(...handlers: Middleware[]): this; - get(...handlers: Middleware[]): this; - post(...handlers: Middleware[]): this; - put(...handlers: Middleware[]): this; - patch(...handlers: Middleware[]): this; - delete(...handlers: Middleware[]): this; - head(...handlers: Middleware[]): this; - options(...handlers: Middleware[]): this; - connect(...handlers: Middleware[]): this; - trace(...handlers: Middleware[]): this; + get(pattern: RegExp | string, ...handlers: Middleware[]): this; + post(pattern: RegExp | string, ...handlers: Middleware[]): this; + put(pattern: RegExp | string, ...handlers: Middleware[]): this; + patch(pattern: RegExp | string, ...handlers: Middleware[]): this; + delete(pattern: RegExp | string, ...handlers: Middleware[]): this; + head(pattern: RegExp | string, ...handlers: Middleware[]): this; + options(pattern: RegExp | string, ...handlers: Middleware[]): this; + connect(pattern: RegExp | string, ...handlers: Middleware[]): this; + trace(pattern: RegExp | string, ...handlers: Middleware[]): this; } export interface Builder { diff --git a/scripts/package.json b/scripts/package.json index 4ac174e8144..3424ae1c34b 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -144,6 +144,7 @@ "picocolors": "^1.1.0", "playwright": "1.46.0", "playwright-core": "1.46.0", + "polka": "^1.0.0-next.28", "prettier": "^3.3.2", "prettier-plugin-brace-style": "^0.6.2", "prettier-plugin-css-order": "^2.1.2", diff --git a/scripts/yarn.lock b/scripts/yarn.lock index 2a07e09852d..3edd98c9125 100644 --- a/scripts/yarn.lock +++ b/scripts/yarn.lock @@ -1301,6 +1301,13 @@ __metadata: languageName: node linkType: hard +"@polka/url@npm:^1.0.0-next.21": + version: 1.0.0-next.28 + resolution: "@polka/url@npm:1.0.0-next.28" + checksum: 10c0/acc5ea62597e4da2fb42dbee02749d07f102ae7d6d2c966bf7e423c79cd65d1621da305af567e6e7c232f3b565e242d1ec932cbb3dcc0db1508d02e9a2cafa2e + languageName: node + linkType: hard + "@rollup/rollup-android-arm-eabi@npm:4.21.0": version: 4.21.0 resolution: "@rollup/rollup-android-arm-eabi@npm:4.21.0" @@ -1609,6 +1616,7 @@ __metadata: picocolors: "npm:^1.1.0" playwright: "npm:1.46.0" playwright-core: "npm:1.46.0" + polka: "npm:^1.0.0-next.28" prettier: "npm:^3.3.2" prettier-plugin-brace-style: "npm:^0.6.2" prettier-plugin-css-order: "npm:^2.1.2" @@ -10918,6 +10926,16 @@ __metadata: languageName: node linkType: hard +"polka@npm:^1.0.0-next.28": + version: 1.0.0-next.28 + resolution: "polka@npm:1.0.0-next.28" + dependencies: + "@polka/url": "npm:^1.0.0-next.21" + trouter: "npm:^4.0.0" + checksum: 10c0/206bab3eb1c3c44c2fba9704d998b144ec36c4852b0b97192a1fd3953f215b739e2286852492c13dcc9faecea0f7825a76356d6eef7e02afd6a800d1dbb84ead + languageName: node + linkType: hard + "portfinder@npm:^1.0.28": version: 1.0.32 resolution: "portfinder@npm:1.0.32" @@ -11577,6 +11595,13 @@ __metadata: languageName: node linkType: hard +"regexparam@npm:^3.0.0": + version: 3.0.0 + resolution: "regexparam@npm:3.0.0" + checksum: 10c0/a6430d7b97d5a7d5518f37a850b6b73aab479029d02f46af4fa0e8e4a1d7aad05b7a0d2d10c86ded21a14d5f0fa4c68525f873a5fca2efeefcccd93c36627459 + languageName: node + linkType: hard + "remark-cli@npm:^12.0.0, remark-cli@npm:^12.0.1": version: 12.0.1 resolution: "remark-cli@npm:12.0.1" @@ -13450,6 +13475,15 @@ __metadata: languageName: node linkType: hard +"trouter@npm:^4.0.0": + version: 4.0.0 + resolution: "trouter@npm:4.0.0" + dependencies: + regexparam: "npm:^3.0.0" + checksum: 10c0/e27326a831187c6a47a72b62212364e3f88247fa2a8723e5030e14a0002b69756fb51f97efbda2466deb05f4a78ecb83c2a1a7b343e9659cbfb3f370156f1e12 + languageName: node + linkType: hard + "try-catch@npm:^3.0.0": version: 3.0.1 resolution: "try-catch@npm:3.0.1" From 0f86686cffcebcd40d955510febf5e2cfe080a71 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Mon, 7 Oct 2024 13:34:36 +0200 Subject: [PATCH 21/26] migrate event log server to polka --- scripts/event-log-collector.ts | 9 +++++---- scripts/package.json | 1 + scripts/yarn.lock | 8 ++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/event-log-collector.ts b/scripts/event-log-collector.ts index f3ad1070088..1e4a656960b 100644 --- a/scripts/event-log-collector.ts +++ b/scripts/event-log-collector.ts @@ -1,9 +1,10 @@ -import express from 'express'; +import { json } from '@polka/parse'; +import polka from 'polka'; const PORT = process.env.PORT || 6007; -const server = express(); -server.use(express.json()); +const server = polka(); +server.use(json()); const events: Record[] = []; server.post('/event-log', (req, res) => { @@ -14,7 +15,7 @@ server.post('/event-log', (req, res) => { server.get('/event-log', (_req, res) => { console.log(`Sending ${events.length} events`); - res.json(events); + res.end(JSON.stringify(events)); }); server.listen(PORT, () => { diff --git a/scripts/package.json b/scripts/package.json index 3424ae1c34b..522fa52ffc8 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -64,6 +64,7 @@ "@nx/workspace": "18.0.6", "@octokit/graphql": "^5.0.5", "@octokit/request": "^8.1.2", + "@polka/parse": "^1.0.0-next.28", "@storybook/eslint-config-storybook": "^4.0.0", "@storybook/linter-config": "^4.0.0", "@testing-library/dom": "^10.4.0", diff --git a/scripts/yarn.lock b/scripts/yarn.lock index 3edd98c9125..07e2cd5656a 100644 --- a/scripts/yarn.lock +++ b/scripts/yarn.lock @@ -1301,6 +1301,13 @@ __metadata: languageName: node linkType: hard +"@polka/parse@npm:^1.0.0-next.28": + version: 1.0.0-next.28 + resolution: "@polka/parse@npm:1.0.0-next.28" + checksum: 10c0/42c53dfdc4b39a3b516fbd4358b2472b22f36e6038e25d463afb3f133fb1d5af84d7eb4d245ab66bc5793d6414299fdd9093803e5214e560f0693f2176fc58b6 + languageName: node + linkType: hard + "@polka/url@npm:^1.0.0-next.21": version: 1.0.0-next.28 resolution: "@polka/url@npm:1.0.0-next.28" @@ -1534,6 +1541,7 @@ __metadata: "@nx/workspace": "npm:18.0.6" "@octokit/graphql": "npm:^5.0.5" "@octokit/request": "npm:^8.1.2" + "@polka/parse": "npm:^1.0.0-next.28" "@storybook/eslint-config-storybook": "npm:^4.0.0" "@storybook/linter-config": "npm:^4.0.0" "@testing-library/dom": "npm:^10.4.0" From e6e745b506ad546d66c3bb747e5c58c0085ecba4 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Mon, 7 Oct 2024 16:12:52 +0200 Subject: [PATCH 22/26] cleanup --- code/core/src/core-server/dev-server.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/code/core/src/core-server/dev-server.ts b/code/core/src/core-server/dev-server.ts index f0af2ec8e1b..9cca751704b 100644 --- a/code/core/src/core-server/dev-server.ts +++ b/code/core/src/core-server/dev-server.ts @@ -23,13 +23,8 @@ import { useStatics } from './utils/server-statics'; export async function storybookDevServer(options: Options) { const [server, core] = await Promise.all([getServer(options), options.presets.apply('core')]); - console.log('LOG: starting dev server'); const app = polka({ server }); - // app.use((req, res, next) => { - // console.log('LOG: ', { url: req.url, method: req.method }); - // next(); - // }); - + const serverChannel = await options.presets.apply( 'experimental_serverChannel', getServerChannel(server) From 49483aa7be4fd1af04049e882ad297ec274e1ace Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Mon, 7 Oct 2024 20:30:49 +0200 Subject: [PATCH 23/26] wait for server to listen --- code/core/src/core-server/dev-server.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/core/src/core-server/dev-server.ts b/code/core/src/core-server/dev-server.ts index 9cca751704b..2ee47ca8988 100644 --- a/code/core/src/core-server/dev-server.ts +++ b/code/core/src/core-server/dev-server.ts @@ -116,9 +116,12 @@ export async function storybookDevServer(options: Options) { previewStarted.catch(() => {}).then(() => next()); }); - app.listen(port, host); + const listening = new Promise((resolve, reject) => { + server.once('error', reject); + app.listen({ port, host }, resolve); + }); - await Promise.all([initializedStoryIndexGenerator]).then(async ([indexGenerator]) => { + await Promise.all([initializedStoryIndexGenerator, listening]).then(async ([indexGenerator]) => { if (indexGenerator && !options.ci && !options.smokeTest && options.open) { openInBrowser(host ? networkAddress : address); } From 9fcba90bf0ddde25586b1172f369db985f64ff05 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Mon, 7 Oct 2024 21:19:21 +0200 Subject: [PATCH 24/26] fix format --- code/core/src/core-server/dev-server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/core/src/core-server/dev-server.ts b/code/core/src/core-server/dev-server.ts index 2ee47ca8988..325d3336651 100644 --- a/code/core/src/core-server/dev-server.ts +++ b/code/core/src/core-server/dev-server.ts @@ -24,7 +24,7 @@ import { useStatics } from './utils/server-statics'; export async function storybookDevServer(options: Options) { const [server, core] = await Promise.all([getServer(options), options.presets.apply('core')]); const app = polka({ server }); - + const serverChannel = await options.presets.apply( 'experimental_serverChannel', getServerChannel(server) From 68f57245b1d19b4f5bf876ebd4caa8d866849043 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Mon, 7 Oct 2024 21:19:31 +0200 Subject: [PATCH 25/26] regenerate lock-file --- code/yarn.lock | 911 +++++++++++++++---------------------------------- 1 file changed, 281 insertions(+), 630 deletions(-) diff --git a/code/yarn.lock b/code/yarn.lock index 5d09c24f0be..2c6f7244e41 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -367,7 +367,7 @@ __metadata: languageName: node linkType: hard -"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.16.7, @babel/code-frame@npm:^7.21.4, @babel/code-frame@npm:^7.22.13, @babel/code-frame@npm:^7.23.5, @babel/code-frame@npm:^7.24.2, @babel/code-frame@npm:^7.24.7": +"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.16.7, @babel/code-frame@npm:^7.21.4, @babel/code-frame@npm:^7.22.13, @babel/code-frame@npm:^7.23.5, @babel/code-frame@npm:^7.24.7": version: 7.24.7 resolution: "@babel/code-frame@npm:7.24.7" dependencies: @@ -377,16 +377,6 @@ __metadata: languageName: node linkType: hard -"@babel/code-frame@npm:^7.24.1": - version: 7.24.2 - resolution: "@babel/code-frame@npm:7.24.2" - dependencies: - "@babel/highlight": "npm:^7.24.2" - picocolors: "npm:^1.0.0" - checksum: 10c0/d1d4cba89475ab6aab7a88242e1fd73b15ecb9f30c109b69752956434d10a26a52cbd37727c4eca104b6d45227bd1dfce39a6a6f4a14c9b2f07f871e968cf406 - languageName: node - linkType: hard - "@babel/compat-data@npm:^7.22.6, @babel/compat-data@npm:^7.23.5, @babel/compat-data@npm:^7.24.4, @babel/compat-data@npm:^7.25.2": version: 7.25.2 resolution: "@babel/compat-data@npm:7.25.2" @@ -440,30 +430,7 @@ __metadata: languageName: node linkType: hard -"@babel/core@npm:^7.12.0, @babel/core@npm:^7.12.3, @babel/core@npm:^7.13.16, @babel/core@npm:^7.18.9, @babel/core@npm:^7.20.12, @babel/core@npm:^7.23.0, @babel/core@npm:^7.23.2, @babel/core@npm:^7.24.4, @babel/core@npm:^7.3.4, @babel/core@npm:^7.7.5": - version: 7.24.4 - resolution: "@babel/core@npm:7.24.4" - dependencies: - "@ampproject/remapping": "npm:^2.2.0" - "@babel/code-frame": "npm:^7.24.2" - "@babel/generator": "npm:^7.24.4" - "@babel/helper-compilation-targets": "npm:^7.23.6" - "@babel/helper-module-transforms": "npm:^7.23.3" - "@babel/helpers": "npm:^7.24.4" - "@babel/parser": "npm:^7.24.4" - "@babel/template": "npm:^7.24.0" - "@babel/traverse": "npm:^7.24.1" - "@babel/types": "npm:^7.24.0" - convert-source-map: "npm:^2.0.0" - debug: "npm:^4.1.0" - gensync: "npm:^1.0.0-beta.2" - json5: "npm:^2.2.3" - semver: "npm:^6.3.1" - checksum: 10c0/fc136966583e64d6f84f4a676368de6ab4583aa87f867186068655b30ef67f21f8e65a88c6d446a7efd219ad7ffb9185c82e8a90183ee033f6f47b5026641e16 - languageName: node - linkType: hard - -"@babel/core@npm:^7.23.9": +"@babel/core@npm:^7.12.0, @babel/core@npm:^7.12.3, @babel/core@npm:^7.13.16, @babel/core@npm:^7.18.9, @babel/core@npm:^7.20.12, @babel/core@npm:^7.23.0, @babel/core@npm:^7.23.2, @babel/core@npm:^7.23.9, @babel/core@npm:^7.24.4, @babel/core@npm:^7.3.4, @babel/core@npm:^7.7.5": version: 7.25.2 resolution: "@babel/core@npm:7.25.2" dependencies: @@ -509,19 +476,7 @@ __metadata: languageName: node linkType: hard -"@babel/generator@npm:^7.12.11, @babel/generator@npm:^7.23.6, @babel/generator@npm:^7.24.4, @babel/generator@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/generator@npm:7.24.7" - dependencies: - "@babel/types": "npm:^7.24.7" - "@jridgewell/gen-mapping": "npm:^0.3.5" - "@jridgewell/trace-mapping": "npm:^0.3.25" - jsesc: "npm:^2.5.1" - checksum: 10c0/06b1f3350baf527a3309e50ffd7065f7aee04dd06e1e7db794ddfde7fe9d81f28df64edd587173f8f9295496a7ddb74b9a185d4bf4de7bb619e6d4ec45c8fd35 - languageName: node - linkType: hard - -"@babel/generator@npm:^7.23.0, @babel/generator@npm:^7.25.0": +"@babel/generator@npm:^7.12.11, @babel/generator@npm:^7.23.0, @babel/generator@npm:^7.23.6, @babel/generator@npm:^7.24.4, @babel/generator@npm:^7.25.0": version: 7.25.0 resolution: "@babel/generator@npm:7.25.0" dependencies: @@ -533,18 +488,6 @@ __metadata: languageName: node linkType: hard -"@babel/generator@npm:^7.24.1": - version: 7.24.4 - resolution: "@babel/generator@npm:7.24.4" - dependencies: - "@babel/types": "npm:^7.24.0" - "@jridgewell/gen-mapping": "npm:^0.3.5" - "@jridgewell/trace-mapping": "npm:^0.3.25" - jsesc: "npm:^2.5.1" - checksum: 10c0/67a1b2f7cc985aaaa11b01e8ddd4fffa4f285837bc7a209738eb8203aa34bdafeb8507ed75fd883ddbabd641a036ca0a8d984e760f28ad4a9d60bff29d0a60bb - languageName: node - linkType: hard - "@babel/helper-annotate-as-pure@npm:7.22.5": version: 7.22.5 resolution: "@babel/helper-annotate-as-pure@npm:7.22.5" @@ -563,16 +506,17 @@ __metadata: languageName: node linkType: hard -"@babel/helper-builder-binary-assignment-operator-visitor@npm:^7.22.15": - version: 7.22.15 - resolution: "@babel/helper-builder-binary-assignment-operator-visitor@npm:7.22.15" +"@babel/helper-builder-binary-assignment-operator-visitor@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-builder-binary-assignment-operator-visitor@npm:7.24.7" dependencies: - "@babel/types": "npm:^7.22.15" - checksum: 10c0/2535e3824ca6337f65786bbac98e562f71699f25532cecd196f027d7698b4967a96953d64e36567956658ad1a05ccbdc62d1ba79ee751c79f4f1d2d3ecc2e01c + "@babel/traverse": "npm:^7.24.7" + "@babel/types": "npm:^7.24.7" + checksum: 10c0/0ed84abf848c79fb1cd4c1ddac12c771d32c1904d87fc3087f33cfdeb0c2e0db4e7892b74b407d9d8d0c000044f3645a7391a781f788da8410c290bb123a1f13 languageName: node linkType: hard -"@babel/helper-compilation-targets@npm:^7.12.0, @babel/helper-compilation-targets@npm:^7.22.6, @babel/helper-compilation-targets@npm:^7.23.6, @babel/helper-compilation-targets@npm:^7.25.2": +"@babel/helper-compilation-targets@npm:^7.12.0, @babel/helper-compilation-targets@npm:^7.22.6, @babel/helper-compilation-targets@npm:^7.23.6, @babel/helper-compilation-targets@npm:^7.24.7, @babel/helper-compilation-targets@npm:^7.25.2": version: 7.25.2 resolution: "@babel/helper-compilation-targets@npm:7.25.2" dependencies: @@ -585,7 +529,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-create-class-features-plugin@npm:^7.18.6, @babel/helper-create-class-features-plugin@npm:^7.21.0, @babel/helper-create-class-features-plugin@npm:^7.24.0": +"@babel/helper-create-class-features-plugin@npm:^7.18.6, @babel/helper-create-class-features-plugin@npm:^7.21.0, @babel/helper-create-class-features-plugin@npm:^7.24.0, @babel/helper-create-class-features-plugin@npm:^7.24.7": version: 7.24.7 resolution: "@babel/helper-create-class-features-plugin@npm:7.24.7" dependencies: @@ -604,26 +548,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-create-class-features-plugin@npm:^7.24.1, @babel/helper-create-class-features-plugin@npm:^7.24.4": - version: 7.24.4 - resolution: "@babel/helper-create-class-features-plugin@npm:7.24.4" - dependencies: - "@babel/helper-annotate-as-pure": "npm:^7.22.5" - "@babel/helper-environment-visitor": "npm:^7.22.20" - "@babel/helper-function-name": "npm:^7.23.0" - "@babel/helper-member-expression-to-functions": "npm:^7.23.0" - "@babel/helper-optimise-call-expression": "npm:^7.22.5" - "@babel/helper-replace-supers": "npm:^7.24.1" - "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.22.5" - "@babel/helper-split-export-declaration": "npm:^7.22.6" - semver: "npm:^6.3.1" - peerDependencies: - "@babel/core": ^7.0.0 - checksum: 10c0/6ebb38375dcd44c79f40008c2de4d023376cf436c135439f15c9c54603c2d6a8ada39b2e07be545da684d9e40b602a0cb0d1670f3877d056deb5f0d786c4bf86 - languageName: node - linkType: hard - -"@babel/helper-create-regexp-features-plugin@npm:^7.18.6": +"@babel/helper-create-regexp-features-plugin@npm:^7.18.6, @babel/helper-create-regexp-features-plugin@npm:^7.24.7": version: 7.24.7 resolution: "@babel/helper-create-regexp-features-plugin@npm:7.24.7" dependencies: @@ -636,19 +561,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-create-regexp-features-plugin@npm:^7.22.15, @babel/helper-create-regexp-features-plugin@npm:^7.22.5": - version: 7.22.15 - resolution: "@babel/helper-create-regexp-features-plugin@npm:7.22.15" - dependencies: - "@babel/helper-annotate-as-pure": "npm:^7.22.5" - regexpu-core: "npm:^5.3.1" - semver: "npm:^6.3.1" - peerDependencies: - "@babel/core": ^7.0.0 - checksum: 10c0/8eba4c1b7b94a83e7a82df5c3e504584ff0ba6ab8710a67ecc2c434a7fb841a29c2f5c94d2de51f25446119a1df538fa90b37bd570db22ddd5e7147fe98277c6 - languageName: node - linkType: hard - "@babel/helper-define-polyfill-provider@npm:^0.5.0": version: 0.5.0 resolution: "@babel/helper-define-polyfill-provider@npm:0.5.0" @@ -707,15 +619,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-member-expression-to-functions@npm:^7.23.0": - version: 7.23.0 - resolution: "@babel/helper-member-expression-to-functions@npm:7.23.0" - dependencies: - "@babel/types": "npm:^7.23.0" - checksum: 10c0/b810daddf093ffd0802f1429052349ed9ea08ef7d0c56da34ffbcdecbdafac86f95bdea2fe30e0e0e629febc7dd41b56cb5eacc10d1a44336d37b755dac31fa4 - languageName: node - linkType: hard - "@babel/helper-member-expression-to-functions@npm:^7.24.7": version: 7.24.7 resolution: "@babel/helper-member-expression-to-functions@npm:7.24.7" @@ -736,16 +639,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-module-imports@npm:^7.24.1": - version: 7.24.3 - resolution: "@babel/helper-module-imports@npm:7.24.3" - dependencies: - "@babel/types": "npm:^7.24.0" - checksum: 10c0/052c188adcd100f5e8b6ff0c9643ddaabc58b6700d3bbbc26804141ad68375a9f97d9d173658d373d31853019e65f62610239e3295cdd58e573bdcb2fded188d - languageName: node - linkType: hard - -"@babel/helper-module-transforms@npm:^7.23.3, @babel/helper-module-transforms@npm:^7.25.2": +"@babel/helper-module-transforms@npm:^7.23.3, @babel/helper-module-transforms@npm:^7.24.7, @babel/helper-module-transforms@npm:^7.25.2": version: 7.25.2 resolution: "@babel/helper-module-transforms@npm:7.25.2" dependencies: @@ -759,15 +653,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-optimise-call-expression@npm:^7.22.5": - version: 7.22.5 - resolution: "@babel/helper-optimise-call-expression@npm:7.22.5" - dependencies: - "@babel/types": "npm:^7.22.5" - checksum: 10c0/31b41a764fc3c585196cf5b776b70cf4705c132e4ce9723f39871f215f2ddbfb2e28a62f9917610f67c8216c1080482b9b05f65dd195dae2a52cef461f2ac7b8 - languageName: node - linkType: hard - "@babel/helper-optimise-call-expression@npm:^7.24.7": version: 7.24.7 resolution: "@babel/helper-optimise-call-expression@npm:7.24.7" @@ -777,21 +662,14 @@ __metadata: languageName: node linkType: hard -"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.20.2, @babel/helper-plugin-utils@npm:^7.22.5, @babel/helper-plugin-utils@npm:^7.24.0, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": - version: 7.24.0 - resolution: "@babel/helper-plugin-utils@npm:7.24.0" - checksum: 10c0/90f41bd1b4dfe7226b1d33a4bb745844c5c63e400f9e4e8bf9103a7ceddd7d425d65333b564d9daba3cebd105985764d51b4bd4c95822b97c2e3ac1201a8a5da - languageName: node - linkType: hard - -"@babel/helper-plugin-utils@npm:^7.24.7": +"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.20.2, @babel/helper-plugin-utils@npm:^7.22.5, @babel/helper-plugin-utils@npm:^7.24.0, @babel/helper-plugin-utils@npm:^7.24.7, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": version: 7.24.7 resolution: "@babel/helper-plugin-utils@npm:7.24.7" checksum: 10c0/c3d38cd9b3520757bb4a279255cc3f956fc0ac1c193964bd0816ebd5c86e30710be8e35252227e0c9d9e0f4f56d9b5f916537f2bc588084b0988b4787a967d31 languageName: node linkType: hard -"@babel/helper-remap-async-to-generator@npm:^7.22.20": +"@babel/helper-remap-async-to-generator@npm:^7.22.20, @babel/helper-remap-async-to-generator@npm:^7.24.7": version: 7.24.7 resolution: "@babel/helper-remap-async-to-generator@npm:7.24.7" dependencies: @@ -804,19 +682,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-replace-supers@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/helper-replace-supers@npm:7.24.1" - dependencies: - "@babel/helper-environment-visitor": "npm:^7.22.20" - "@babel/helper-member-expression-to-functions": "npm:^7.23.0" - "@babel/helper-optimise-call-expression": "npm:^7.22.5" - peerDependencies: - "@babel/core": ^7.0.0 - checksum: 10c0/d39a3df7892b7c3c0e307fb229646168a9bd35e26a72080c2530729322600e8cff5f738f44a14860a2358faffa741b6a6a0d6749f113387b03ddbfa0ec10e1a0 - languageName: node - linkType: hard - "@babel/helper-replace-supers@npm:^7.24.7": version: 7.24.7 resolution: "@babel/helper-replace-supers@npm:7.24.7" @@ -830,15 +695,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-simple-access@npm:^7.22.5": - version: 7.22.5 - resolution: "@babel/helper-simple-access@npm:7.22.5" - dependencies: - "@babel/types": "npm:^7.22.5" - checksum: 10c0/f0cf81a30ba3d09a625fd50e5a9069e575c5b6719234e04ee74247057f8104beca89ed03e9217b6e9b0493434cedc18c5ecca4cea6244990836f1f893e140369 - languageName: node - linkType: hard - "@babel/helper-simple-access@npm:^7.24.7": version: 7.24.7 resolution: "@babel/helper-simple-access@npm:7.24.7" @@ -859,15 +715,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-skip-transparent-expression-wrappers@npm:^7.22.5": - version: 7.22.5 - resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.22.5" - dependencies: - "@babel/types": "npm:^7.22.5" - checksum: 10c0/ab7fa2aa709ab49bb8cd86515a1e715a3108c4bb9a616965ba76b43dc346dee66d1004ccf4d222b596b6224e43e04cbc5c3a34459501b388451f8c589fbc3691 - languageName: node - linkType: hard - "@babel/helper-split-export-declaration@npm:7.22.6": version: 7.22.6 resolution: "@babel/helper-split-export-declaration@npm:7.22.6" @@ -886,20 +733,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-string-parser@npm:^7.23.4": - version: 7.23.4 - resolution: "@babel/helper-string-parser@npm:7.23.4" - checksum: 10c0/f348d5637ad70b6b54b026d6544bd9040f78d24e7ec245a0fc42293968181f6ae9879c22d89744730d246ce8ec53588f716f102addd4df8bbc79b73ea10004ac - languageName: node - linkType: hard - -"@babel/helper-string-parser@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/helper-string-parser@npm:7.24.7" - checksum: 10c0/47840c7004e735f3dc93939c77b099bb41a64bf3dda0cae62f60e6f74a5ff80b63e9b7cf77b5ec25a324516381fc994e1f62f922533236a8e3a6af57decb5e1e - languageName: node - linkType: hard - "@babel/helper-string-parser@npm:^7.24.8": version: 7.24.8 resolution: "@babel/helper-string-parser@npm:7.24.8" @@ -914,13 +747,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.22.20": - version: 7.22.20 - resolution: "@babel/helper-validator-identifier@npm:7.22.20" - checksum: 10c0/dcad63db345fb110e032de46c3688384b0008a42a4845180ce7cd62b1a9c0507a1bed727c4d1060ed1a03ae57b4d918570259f81724aaac1a5b776056f37504e - languageName: node - linkType: hard - "@babel/helper-validator-option@npm:^7.22.15, @babel/helper-validator-option@npm:^7.23.5, @babel/helper-validator-option@npm:^7.24.8": version: 7.24.8 resolution: "@babel/helper-validator-option@npm:7.24.8" @@ -950,29 +776,6 @@ __metadata: languageName: node linkType: hard -"@babel/helpers@npm:^7.24.4": - version: 7.24.4 - resolution: "@babel/helpers@npm:7.24.4" - dependencies: - "@babel/template": "npm:^7.24.0" - "@babel/traverse": "npm:^7.24.1" - "@babel/types": "npm:^7.24.0" - checksum: 10c0/747ef62b7fe87de31a2f3c19ff337a86cbb79be2f6c18af63133b614ab5a8f6da5b06ae4b06fb0e71271cb6a27efec6f8b6c9f44c60b8a18777832dc7929e6c5 - languageName: node - linkType: hard - -"@babel/highlight@npm:^7.24.2": - version: 7.24.2 - resolution: "@babel/highlight@npm:7.24.2" - dependencies: - "@babel/helper-validator-identifier": "npm:^7.22.20" - chalk: "npm:^2.4.2" - js-tokens: "npm:^4.0.0" - picocolors: "npm:^1.0.0" - checksum: 10c0/98ce00321daedeed33a4ed9362dc089a70375ff1b3b91228b9f05e6591d387a81a8cba68886e207861b8871efa0bc997ceabdd9c90f6cce3ee1b2f7f941b42db - languageName: node - linkType: hard - "@babel/highlight@npm:^7.24.7": version: 7.24.7 resolution: "@babel/highlight@npm:7.24.7" @@ -985,16 +788,7 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.11.5, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.23.5, @babel/parser@npm:^7.23.6, @babel/parser@npm:^7.23.9, @babel/parser@npm:^7.24.0, @babel/parser@npm:^7.24.4, @babel/parser@npm:^7.24.7, @babel/parser@npm:^7.4.5, @babel/parser@npm:^7.6.0, @babel/parser@npm:^7.9.6": - version: 7.24.7 - resolution: "@babel/parser@npm:7.24.7" - bin: - parser: ./bin/babel-parser.js - checksum: 10c0/8b244756872185a1c6f14b979b3535e682ff08cb5a2a5fd97cc36c017c7ef431ba76439e95e419d43000c5b07720495b00cf29a7f0d9a483643d08802b58819b - languageName: node - linkType: hard - -"@babel/parser@npm:^7.20.5, @babel/parser@npm:^7.22.5, @babel/parser@npm:^7.25.0, @babel/parser@npm:^7.25.3": +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.11.5, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.5, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.22.5, @babel/parser@npm:^7.23.0, @babel/parser@npm:^7.23.5, @babel/parser@npm:^7.23.6, @babel/parser@npm:^7.23.9, @babel/parser@npm:^7.24.0, @babel/parser@npm:^7.24.4, @babel/parser@npm:^7.24.7, @babel/parser@npm:^7.25.0, @babel/parser@npm:^7.25.3, @babel/parser@npm:^7.4.5, @babel/parser@npm:^7.6.0, @babel/parser@npm:^7.9.6": version: 7.25.3 resolution: "@babel/parser@npm:7.25.3" dependencies: @@ -1005,15 +799,6 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.24.1": - version: 7.24.4 - resolution: "@babel/parser@npm:7.24.4" - bin: - parser: ./bin/babel-parser.js - checksum: 10c0/8381e1efead5069cb7ed2abc3a583f4a86289b2f376c75cecc69f59a8eb36df18274b1886cecf2f97a6a0dff5334b27330f58535be9b3e4e26102cc50e12eac8 - languageName: node - linkType: hard - "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:^7.24.4": version: 7.24.4 resolution: "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:7.24.4" @@ -1027,38 +812,38 @@ __metadata: linkType: hard "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:^7.23.3, @babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0 - checksum: 10c0/d4e592e6fc4878654243d2e7b51ea86471b868a8cb09de29e73b65d2b64159990c6c198fd7c9c2af2e38b1cddf70206243792853c47384a84f829dada152f605 + checksum: 10c0/a36307428ecc1a01b00cf90812335eed1575d13f211ab24fe4d0c55c28a2fcbd4135f142efabc3b277b2a8e09ee05df594a1272353f061b63829495b5dcfdb96 languageName: node linkType: hard "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:^7.23.3, @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" - "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.22.5" - "@babel/plugin-transform-optional-chaining": "npm:^7.24.1" + "@babel/helper-plugin-utils": "npm:^7.24.7" + "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.24.7" + "@babel/plugin-transform-optional-chaining": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.13.0 - checksum: 10c0/351c36e45795a7890d610ab9041a52f4078a59429f6e74c281984aa44149a10d43e82b3a8172c703c0d5679471e165d1c02b6d2e45a677958ee301b89403f202 + checksum: 10c0/aeb6e7aa363a47f815cf956ea1053c5dd8b786a17799f065c9688ba4b0051fe7565d258bbe9400bfcbfb3114cb9fda66983e10afe4d750bc70ff75403e15dd36 languageName: node linkType: hard "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@npm:^7.23.7, @babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@npm:7.24.7" dependencies: - "@babel/helper-environment-visitor": "npm:^7.22.20" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-environment-visitor": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0 - checksum: 10c0/d7dd5a59a54635a3152895dcaa68f3370bb09d1f9906c1e72232ff759159e6be48de4a598a993c986997280a2dc29922a48aaa98020f16439f3f57ad72788354 + checksum: 10c0/2b52a73e444f6adc73f927b623e53a4cf64397170dd1071268536df1b3db1e02131418c8dc91351af48837a6298212118f4a72d5407f8005cf9a732370a315b0 languageName: node linkType: hard @@ -1236,24 +1021,24 @@ __metadata: linkType: hard "@babel/plugin-syntax-import-assertions@npm:^7.23.3, @babel/plugin-syntax-import-assertions@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-syntax-import-assertions@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-syntax-import-assertions@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/72f0340d73e037f0702c61670054e0af66ece7282c5c2f4ba8de059390fee502de282defdf15959cd9f71aa18dc5c5e4e7a0fde317799a0600c6c4e0a656d82b + checksum: 10c0/b82c53e095274ee71c248551352d73441cf65b3b3fc0107258ba4e9aef7090772a425442b3ed1c396fa207d0efafde8929c87a17d3c885b3ca2021316e87e246 languageName: node linkType: hard "@babel/plugin-syntax-import-attributes@npm:^7.23.3, @babel/plugin-syntax-import-attributes@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-syntax-import-attributes@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-syntax-import-attributes@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/309634e3335777aee902552b2cf244c4a8050213cc878b3fb9d70ad8cbbff325dc46ac5e5791836ff477ea373b27832238205f6ceaff81f7ea7c4c7e8fbb13bb + checksum: 10c0/eccc54d0f03c96d0eec7a6e2fa124dadbc7298345b62ffc4238f173308c4325b5598f139695ff05a95cf78412ef6903599e4b814496612bf39aad4715a16375b languageName: node linkType: hard @@ -1378,18 +1163,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-typescript@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-syntax-typescript@npm:7.24.1" - dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" - peerDependencies: - "@babel/core": ^7.0.0-0 - checksum: 10c0/7a81e277dcfe3138847e8e5944e02a42ff3c2e864aea6f33fd9b70d1556d12b0e70f0d56cc1985d353c91bcbf8fe163e6cc17418da21129b7f7f1d8b9ac00c93 - languageName: node - linkType: hard - -"@babel/plugin-syntax-typescript@npm:^7.3.3": +"@babel/plugin-syntax-typescript@npm:^7.24.7, @babel/plugin-syntax-typescript@npm:^7.3.3": version: 7.24.7 resolution: "@babel/plugin-syntax-typescript@npm:7.24.7" dependencies: @@ -1413,13 +1187,13 @@ __metadata: linkType: hard "@babel/plugin-transform-arrow-functions@npm:^7.23.3, @babel/plugin-transform-arrow-functions@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-arrow-functions@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-arrow-functions@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/f44bfacf087dc21b422bab99f4e9344ee7b695b05c947dacae66de05c723ab9d91800be7edc1fa016185e8c819f3aca2b4a5f66d8a4d1e47d9bad80b8fa55b8e + checksum: 10c0/6ac05a54e5582f34ac6d5dc26499e227227ec1c7fa6fc8de1f3d40c275f140d3907f79bbbd49304da2d7008a5ecafb219d0b71d78ee3290ca22020d878041245 languageName: node linkType: hard @@ -1438,16 +1212,16 @@ __metadata: linkType: hard "@babel/plugin-transform-async-generator-functions@npm:^7.23.9, @babel/plugin-transform-async-generator-functions@npm:^7.24.3": - version: 7.24.3 - resolution: "@babel/plugin-transform-async-generator-functions@npm:7.24.3" + version: 7.24.7 + resolution: "@babel/plugin-transform-async-generator-functions@npm:7.24.7" dependencies: - "@babel/helper-environment-visitor": "npm:^7.22.20" - "@babel/helper-plugin-utils": "npm:^7.24.0" - "@babel/helper-remap-async-to-generator": "npm:^7.22.20" + "@babel/helper-environment-visitor": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" + "@babel/helper-remap-async-to-generator": "npm:^7.24.7" "@babel/plugin-syntax-async-generators": "npm:^7.8.4" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/55ceed059f819dcccbfe69600bfa1c055ada466bd54eda117cfdd2cf773dd85799e2f6556e4a559b076e93b9704abcca2aef9d72aad7dc8a5d3d17886052f1d3 + checksum: 10c0/6b5e33ae66dce0afce9b06d8dace6fa052528e60f7622aa6cfd3e71bd372ca5079d426e78336ca564bc0d5f37acbcda1b21f4fe656fcb642f1a93a697ab39742 languageName: node linkType: hard @@ -1465,162 +1239,162 @@ __metadata: linkType: hard "@babel/plugin-transform-async-to-generator@npm:^7.23.3, @babel/plugin-transform-async-to-generator@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-async-to-generator@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-async-to-generator@npm:7.24.7" dependencies: - "@babel/helper-module-imports": "npm:^7.24.1" - "@babel/helper-plugin-utils": "npm:^7.24.0" - "@babel/helper-remap-async-to-generator": "npm:^7.22.20" + "@babel/helper-module-imports": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" + "@babel/helper-remap-async-to-generator": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/3731ba8e83cbea1ab22905031f25b3aeb0b97c6467360a2cc685352f16e7c786417d8883bc747f5a0beff32266bdb12a05b6292e7b8b75967087200a7bc012c4 + checksum: 10c0/83c82e243898875af8457972a26ab29baf8a2078768ee9f35141eb3edff0f84b165582a2ff73e90a9e08f5922bf813dbf15a85c1213654385198f4591c0dc45d languageName: node linkType: hard "@babel/plugin-transform-block-scoped-functions@npm:^7.23.3, @babel/plugin-transform-block-scoped-functions@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-block-scoped-functions@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-block-scoped-functions@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/6fbaa85f5204f34845dfc0bebf62fdd3ac5a286241c85651e59d426001e7a1785ac501f154e093e0b8ee49e1f51e3f8b06575a5ae8d4a9406d43e4816bf18c37 + checksum: 10c0/113e86de4612ae91773ff5cb6b980f01e1da7e26ae6f6012127415d7ae144e74987bc23feb97f63ba4bc699331490ddea36eac004d76a20d5369e4cc6a7f61cd languageName: node linkType: hard "@babel/plugin-transform-block-scoping@npm:^7.23.4, @babel/plugin-transform-block-scoping@npm:^7.24.4, @babel/plugin-transform-block-scoping@npm:^7.8.3": - version: 7.24.4 - resolution: "@babel/plugin-transform-block-scoping@npm:7.24.4" + version: 7.24.7 + resolution: "@babel/plugin-transform-block-scoping@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/62f55fd1b60a115506e9553c3bf925179b1ab8a42dc31471c4e3ada20573a488b5c5e3317145da352493ef07f1d9750ce1f8a49cb3f39489ac1ab42e5ddc883d + checksum: 10c0/dcbc5e385c0ca5fb5736b1c720c90755cffe9f91d8c854f82e61e59217dd3f6c91b3633eeee4b55a89d3f59e5275d0f5b0b1b1363d4fa70c49c468b55aa87700 languageName: node linkType: hard "@babel/plugin-transform-class-properties@npm:^7.22.5, @babel/plugin-transform-class-properties@npm:^7.23.3, @babel/plugin-transform-class-properties@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-class-properties@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-class-properties@npm:7.24.7" dependencies: - "@babel/helper-create-class-features-plugin": "npm:^7.24.1" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-create-class-features-plugin": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/00dff042ac9df4ae67b5ef98b1137cc72e0a24e6d911dc200540a8cb1f00b4cff367a922aeb22da17da662079f0abcd46ee1c5f4cdf37ceebf6ff1639bb9af27 + checksum: 10c0/75018a466c7ede3d2397e158891c224ba7fca72864506ce067ddbc02fc65191d44da4d6379c996d0c7f09019e26b5c3f5f1d3a639cd98366519723886f0689d0 languageName: node linkType: hard "@babel/plugin-transform-class-static-block@npm:^7.23.4, @babel/plugin-transform-class-static-block@npm:^7.24.4": - version: 7.24.4 - resolution: "@babel/plugin-transform-class-static-block@npm:7.24.4" + version: 7.24.7 + resolution: "@babel/plugin-transform-class-static-block@npm:7.24.7" dependencies: - "@babel/helper-create-class-features-plugin": "npm:^7.24.4" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-create-class-features-plugin": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" "@babel/plugin-syntax-class-static-block": "npm:^7.14.5" peerDependencies: "@babel/core": ^7.12.0 - checksum: 10c0/19dfeaf4a2ac03695034f7211a8b5ad89103b224608ac3e91791055107c5fe4d7ebe5d9fbb31b4a91265694af78762260642eb270f4b239c175984ee4b253f80 + checksum: 10c0/b0ade39a3d09dce886f79dbd5907c3d99b48167eddb6b9bbde24a0598129654d7017e611c20494cdbea48b07ac14397cd97ea34e3754bbb2abae4e698128eccb languageName: node linkType: hard "@babel/plugin-transform-classes@npm:^7.23.8, @babel/plugin-transform-classes@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-classes@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-classes@npm:7.24.7" dependencies: - "@babel/helper-annotate-as-pure": "npm:^7.22.5" - "@babel/helper-compilation-targets": "npm:^7.23.6" - "@babel/helper-environment-visitor": "npm:^7.22.20" - "@babel/helper-function-name": "npm:^7.23.0" - "@babel/helper-plugin-utils": "npm:^7.24.0" - "@babel/helper-replace-supers": "npm:^7.24.1" - "@babel/helper-split-export-declaration": "npm:^7.22.6" + "@babel/helper-annotate-as-pure": "npm:^7.24.7" + "@babel/helper-compilation-targets": "npm:^7.24.7" + "@babel/helper-environment-visitor": "npm:^7.24.7" + "@babel/helper-function-name": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" + "@babel/helper-replace-supers": "npm:^7.24.7" + "@babel/helper-split-export-declaration": "npm:^7.24.7" globals: "npm:^11.1.0" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/586a95826be4d68056fa23d8e6c34353ce2ea59bf3ca8cf62bc784e60964d492d76e1b48760c43fd486ffb65a79d3fed9a4f91289e4f526f88c3b6acc0dfb00e + checksum: 10c0/e51dba7ce8b770d1eee929e098d5a3be3efc3e8b941e22dda7d0097dc4e7be5feabd2da7b707ac06fcac5661b31223c541941dec08ce76c1faa55544d87d06ec languageName: node linkType: hard "@babel/plugin-transform-computed-properties@npm:^7.23.3, @babel/plugin-transform-computed-properties@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-computed-properties@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-computed-properties@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" - "@babel/template": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" + "@babel/template": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/8292c508b656b7722e2c2ca0f6f31339852e3ed2b9b80f6e068a4010e961b431ca109ecd467fc906283f4b1574c1e7b1cb68d35a4dea12079d386c15ff7e0eac + checksum: 10c0/25636dbc1f605c0b8bc60aa58628a916b689473d11551c9864a855142e36742fe62d4a70400ba3b74902338e77fb3d940376c0a0ba154b6b7ec5367175233b49 languageName: node linkType: hard "@babel/plugin-transform-destructuring@npm:^7.23.3, @babel/plugin-transform-destructuring@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-destructuring@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-destructuring@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/a08e706a9274a699abc3093f38c72d4a5354eac11c44572cc9ea049915b6e03255744297069fd94fcce82380725c5d6b1b11b9a84c0081aa3aa6fc2fdab98ef6 + checksum: 10c0/929f07a807fb62230bfbf881cfcedf187ac5daf2f1b01da94a75c7a0f6f72400268cf4bcfee534479e43260af8193e42c31ee03c8b0278ba77d0036ed6709c27 languageName: node linkType: hard "@babel/plugin-transform-dotall-regex@npm:^7.23.3, @babel/plugin-transform-dotall-regex@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-dotall-regex@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-dotall-regex@npm:7.24.7" dependencies: - "@babel/helper-create-regexp-features-plugin": "npm:^7.22.15" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-create-regexp-features-plugin": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/758def705ec5a87ef910280dc2df5d2fda59dc5d4771c1725c7aed0988ae5b79e29aeb48109120301a3e1c6c03dfac84700469de06f38ca92c96834e09eadf5d + checksum: 10c0/793f14c9494972d294b7e7b97b747f47874b6d57d7804d3443c701becf5db192c9311be6a1835c07664486df1f5c60d33196c36fb7e11a53015e476b4c145b33 languageName: node linkType: hard "@babel/plugin-transform-duplicate-keys@npm:^7.23.3, @babel/plugin-transform-duplicate-keys@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-duplicate-keys@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-duplicate-keys@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/41072f57f83a6c2b15f3ee0b6779cdca105ff3d98061efe92ac02d6c7b90fdb6e7e293b8a4d5b9c690d9ae5d3ae73e6bde4596dc4d8c66526a0e5e1abc73c88c + checksum: 10c0/75ff7ec1117ac500e77bf20a144411d39c0fdd038f108eec061724123ce6d1bb8d5bd27968e466573ee70014f8be0043361cdb0ef388f8a182d1d97ad67e51b9 languageName: node linkType: hard "@babel/plugin-transform-dynamic-import@npm:^7.23.4, @babel/plugin-transform-dynamic-import@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-dynamic-import@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-dynamic-import@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" "@babel/plugin-syntax-dynamic-import": "npm:^7.8.3" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/7e2834780e9b5251ef341854043a89c91473b83c335358620ca721554877e64e416aeb3288a35f03e825c4958e07d5d00ead08c4490fadc276a21fe151d812f1 + checksum: 10c0/eeda48372efd0a5103cb22dadb13563c975bce18ae85daafbb47d57bb9665d187da9d4fe8d07ac0a6e1288afcfcb73e4e5618bf75ff63fddf9736bfbf225203b languageName: node linkType: hard "@babel/plugin-transform-exponentiation-operator@npm:^7.23.3, @babel/plugin-transform-exponentiation-operator@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-exponentiation-operator@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-exponentiation-operator@npm:7.24.7" dependencies: - "@babel/helper-builder-binary-assignment-operator-visitor": "npm:^7.22.15" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-builder-binary-assignment-operator-visitor": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/f0fc4c5a9add25fd6bf23dabe6752e9b7c0a2b2554933dddfd16601245a2ba332b647951079c782bf3b94c6330e3638b9b4e0227f469a7c1c707446ba0eba6c7 + checksum: 10c0/ace3e11c94041b88848552ba8feb39ae4d6cad3696d439ff51445bd2882d8b8775d85a26c2c0edb9b5e38c9e6013cc11b0dea89ec8f93c7d9d7ee95e3645078c languageName: node linkType: hard "@babel/plugin-transform-export-namespace-from@npm:^7.23.4, @babel/plugin-transform-export-namespace-from@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-export-namespace-from@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-export-namespace-from@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" "@babel/plugin-syntax-export-namespace-from": "npm:^7.8.3" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/510bb23b2423d5fbffef69b356e4050929c21a7627e8194b1506dd935c7d9cbbd696c9ae9d7c3bcd7e6e7b69561b0b290c2d72d446327b40fc20ce40bbca6712 + checksum: 10c0/4e144d7f1c57bc63b4899dbbbdfed0880f2daa75ea9c7251c7997f106e4b390dc362175ab7830f11358cb21f6b972ca10a43a2e56cd789065f7606b082674c0c languageName: node linkType: hard @@ -1637,171 +1411,171 @@ __metadata: linkType: hard "@babel/plugin-transform-for-of@npm:^7.23.6, @babel/plugin-transform-for-of@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-for-of@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-for-of@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" - "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.22.5" + "@babel/helper-plugin-utils": "npm:^7.24.7" + "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/e4bc92b1f334246e62d4bde079938df940794db564742034f6597f2e38bd426e11ae8c5670448e15dd6e45c462f2a9ab3fa87259bddf7c08553ffd9457fc2b2c + checksum: 10c0/77629b1173e55d07416f05ba7353caa09d2c2149da2ca26721ab812209b63689d1be45116b68eadc011c49ced59daf5320835b15245eb7ae93ae0c5e8277cfc0 languageName: node linkType: hard "@babel/plugin-transform-function-name@npm:^7.23.3, @babel/plugin-transform-function-name@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-function-name@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-function-name@npm:7.24.7" dependencies: - "@babel/helper-compilation-targets": "npm:^7.23.6" - "@babel/helper-function-name": "npm:^7.23.0" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-compilation-targets": "npm:^7.24.7" + "@babel/helper-function-name": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/65c1735ec3b5e43db9b5aebf3c16171c04b3050c92396b9e22dda0d2aaf51f43fdcf147f70a40678fd9a4ee2272a5acec4826e9c21bcf968762f4c184897ad75 + checksum: 10c0/3e9642428d6952851850d89ea9307d55946528d18973784d0e2f04a651b23bd9924dd8a2641c824b483bd4ab1223bab1d2f6a1106a939998f7ced512cb60ac5b languageName: node linkType: hard "@babel/plugin-transform-json-strings@npm:^7.23.4, @babel/plugin-transform-json-strings@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-json-strings@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-json-strings@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" "@babel/plugin-syntax-json-strings": "npm:^7.8.3" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/13d9b6a3c31ab4be853b3d49d8d1171f9bd8198562fd75da8f31e7de31398e1cfa6eb1d073bed93c9746e4f9c47a53b20f8f4c255ece3f88c90852ad3181dc2d + checksum: 10c0/17c72cd5bf3e90e722aabd333559275f3309e3fa0b9cea8c2944ab83ae01502c71a2be05da5101edc02b3fc8df15a8dbb9b861cbfcc8a52bf5e797cf01d3a40a languageName: node linkType: hard "@babel/plugin-transform-literals@npm:^7.23.3, @babel/plugin-transform-literals@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-literals@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-literals@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/a27cc7d565ee57b5a2bf136fa889c5c2f5988545ae7b3b2c83a7afe5dd37dfac80dca88b1c633c65851ce6af7d2095c04c01228657ce0198f918e64b5ccd01fa + checksum: 10c0/9f3f6f3831929cd2a977748c07addf9944d5cccb50bd3a24a58beb54f91f00d6cacd3d7831d13ffe1ad6f8aba0aefd7bca5aec65d63b77f39c62ad1f2d484a3e languageName: node linkType: hard "@babel/plugin-transform-logical-assignment-operators@npm:^7.23.4, @babel/plugin-transform-logical-assignment-operators@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-logical-assignment-operators@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-logical-assignment-operators@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" "@babel/plugin-syntax-logical-assignment-operators": "npm:^7.10.4" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/98a2e0843ddfe51443c1bfcf08ba40ad8856fd4f8e397b392a5390a54f257c8c1b9a99d8ffc0fc7e8c55cce45e2cd9c2795a4450303f48f501bcbd662de44554 + checksum: 10c0/dbe882eb9053931f2ab332c50fc7c2a10ef507d6421bd9831adbb4cb7c9f8e1e5fbac4fbd2e007f6a1bf1df1843547559434012f118084dc0bf42cda3b106272 languageName: node linkType: hard "@babel/plugin-transform-member-expression-literals@npm:^7.23.3, @babel/plugin-transform-member-expression-literals@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-member-expression-literals@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-member-expression-literals@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/2af731d02aa4c757ef80c46df42264128cbe45bfd15e1812d1a595265b690a44ad036041c406a73411733540e1c4256d8174705ae6b8cfaf757fc175613993fd + checksum: 10c0/e789ae359bdf2d20e90bedef18dfdbd965c9ebae1cee398474a0c349590fda7c8b874e1a2ceee62e47e5e6ec1730e76b0f24e502164357571854271fc12cc684 languageName: node linkType: hard "@babel/plugin-transform-modules-amd@npm:^7.13.0, @babel/plugin-transform-modules-amd@npm:^7.23.3, @babel/plugin-transform-modules-amd@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-modules-amd@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-modules-amd@npm:7.24.7" dependencies: - "@babel/helper-module-transforms": "npm:^7.23.3" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-module-transforms": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/71fd04e5e7026e6e52701214b1e9f7508ba371b757e5075fbb938a79235ed66a54ce65f89bb92b59159e9f03f01b392e6c4de6d255b948bec975a90cfd6809ef + checksum: 10c0/6df7de7fce34117ca4b2fa07949b12274c03668cbfe21481c4037b6300796d50ae40f4f170527b61b70a67f26db906747797e30dbd0d9809a441b6e220b5728f languageName: node linkType: hard "@babel/plugin-transform-modules-commonjs@npm:^7.13.8, @babel/plugin-transform-modules-commonjs@npm:^7.23.0, @babel/plugin-transform-modules-commonjs@npm:^7.23.3, @babel/plugin-transform-modules-commonjs@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-modules-commonjs@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-modules-commonjs@npm:7.24.7" dependencies: - "@babel/helper-module-transforms": "npm:^7.23.3" - "@babel/helper-plugin-utils": "npm:^7.24.0" - "@babel/helper-simple-access": "npm:^7.22.5" + "@babel/helper-module-transforms": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" + "@babel/helper-simple-access": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/efb3ea2047604a7eb44a9289311ebb29842fe6510ff8b66a77a60440448c65e1312a60dc48191ed98246bdbd163b5b6f3348a0669bcc0e3809e69c7c776b20fa + checksum: 10c0/9442292b3daf6a5076cdc3c4c32bf423bda824ccaeb0dd0dc8b3effaa1fecfcb0130ae6e647fef12a5d5ff25bcc99a0d6bfc6d24a7525345e1bcf46fcdf81752 languageName: node linkType: hard "@babel/plugin-transform-modules-systemjs@npm:^7.23.9, @babel/plugin-transform-modules-systemjs@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-modules-systemjs@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-modules-systemjs@npm:7.24.7" dependencies: - "@babel/helper-hoist-variables": "npm:^7.22.5" - "@babel/helper-module-transforms": "npm:^7.23.3" - "@babel/helper-plugin-utils": "npm:^7.24.0" - "@babel/helper-validator-identifier": "npm:^7.22.20" + "@babel/helper-hoist-variables": "npm:^7.24.7" + "@babel/helper-module-transforms": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" + "@babel/helper-validator-identifier": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/38145f8abe8a4ce2b41adabe5d65eb7bd54a139dc58e2885fec975eb5cf247bd938c1dd9f09145c46dbe57d25dd0ef7f00a020e5eb0cbe8195b2065d51e2d93d + checksum: 10c0/e2a795e0a6baafe26f4a74010622212ddd873170742d673f450e0097f8d984f6e6a95eb8ce41b05071ee9790c4be088b33801aaab3f78ee202c567634e52a331 languageName: node linkType: hard "@babel/plugin-transform-modules-umd@npm:^7.23.3, @babel/plugin-transform-modules-umd@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-modules-umd@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-modules-umd@npm:7.24.7" dependencies: - "@babel/helper-module-transforms": "npm:^7.23.3" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-module-transforms": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/14c90c58562b54e17fe4a8ded3f627f9a993648f8378ef00cb2f6c34532032b83290d2ad54c7fff4f0c2cd49091bda780f8cc28926ec4b77a6c2141105a2e699 + checksum: 10c0/7791d290121db210e4338b94b4a069a1a79e4c7a8d7638d8159a97b281851bbed3048dac87a4ae718ad963005e6c14a5d28e6db2eeb2b04e031cee92fb312f85 languageName: node linkType: hard "@babel/plugin-transform-named-capturing-groups-regex@npm:^7.22.5": - version: 7.22.5 - resolution: "@babel/plugin-transform-named-capturing-groups-regex@npm:7.22.5" + version: 7.24.7 + resolution: "@babel/plugin-transform-named-capturing-groups-regex@npm:7.24.7" dependencies: - "@babel/helper-create-regexp-features-plugin": "npm:^7.22.5" - "@babel/helper-plugin-utils": "npm:^7.22.5" + "@babel/helper-create-regexp-features-plugin": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0 - checksum: 10c0/b0b072bef303670b5a98307bc37d1ac326cb7ad40ea162b89a03c2ffc465451be7ef05be95cb81ed28bfeb29670dc98fe911f793a67bceab18b4cb4c81ef48f3 + checksum: 10c0/41a0b0f2d0886318237440aa3b489f6d0305361d8671121777d9ff89f9f6de9d0c02ce93625049061426c8994064ef64deae8b819d1b14c00374a6a2336fb5d9 languageName: node linkType: hard "@babel/plugin-transform-new-target@npm:^7.23.3, @babel/plugin-transform-new-target@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-new-target@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-new-target@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/c4cabe628163855f175a8799eb73d692b6f1dc347aae5022af0c253f80c92edb962e48ddccc98b691eff3d5d8e53c9a8f10894c33ba4cebc2e2f8f8fe554fb7a + checksum: 10c0/2540808a35e1a978e537334c43dab439cf24c93e7beb213a2e71902f6710e60e0184316643790c0a6644e7a8021e52f7ab8165e6b3e2d6651be07bdf517b67df languageName: node linkType: hard "@babel/plugin-transform-nullish-coalescing-operator@npm:^7.22.11, @babel/plugin-transform-nullish-coalescing-operator@npm:^7.23.4, @babel/plugin-transform-nullish-coalescing-operator@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-nullish-coalescing-operator@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-nullish-coalescing-operator@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" "@babel/plugin-syntax-nullish-coalescing-operator": "npm:^7.8.3" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/c8532951506fb031287280cebeef10aa714f8a7cea2b62a13c805f0e0af945ba77a7c87e4bbbe4c37fe973e0e5d5e649cfac7f0374f57efc54cdf9656362a392 + checksum: 10c0/7243c8ff734ed5ef759dd8768773c4b443c12e792727e759a1aec2c7fa2bfdd24f1ecb42e292a7b3d8bd3d7f7b861cf256a8eb4ba144fc9cc463892c303083d9 languageName: node linkType: hard "@babel/plugin-transform-numeric-separator@npm:^7.23.4, @babel/plugin-transform-numeric-separator@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-numeric-separator@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-numeric-separator@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" "@babel/plugin-syntax-numeric-separator": "npm:^7.10.4" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/15e2b83292e586fb4f5b4b4021d4821a806ca6de2b77d5ad6c4e07aa7afa23704e31b4d683dac041afc69ac51b2461b96e8c98e46311cc1faba54c73f235044f + checksum: 10c0/e18e09ca5a6342645d00ede477731aa6e8714ff357efc9d7cda5934f1703b3b6fb7d3298dce3ce3ba53e9ff1158eab8f1aadc68874cc21a6099d33a1ca457789 languageName: node linkType: hard @@ -1817,44 +1591,44 @@ __metadata: linkType: hard "@babel/plugin-transform-object-rest-spread@npm:^7.24.0, @babel/plugin-transform-object-rest-spread@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-object-rest-spread@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-object-rest-spread@npm:7.24.7" dependencies: - "@babel/helper-compilation-targets": "npm:^7.23.6" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-compilation-targets": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" "@babel/plugin-syntax-object-rest-spread": "npm:^7.8.3" - "@babel/plugin-transform-parameters": "npm:^7.24.1" + "@babel/plugin-transform-parameters": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/e301f1a66b63bafc2bce885305cc88ab30ec875b5e2c7933fb7f9cbf0d954685aa10334ffcecf147ba19d6a1d7ffab37baf4ce871849d395941c56fdb3060f73 + checksum: 10c0/9ad64bc003f583030f9da50614b485852f8edac93f8faf5d1cd855201a4852f37c5255ae4daf70dd4375bdd4874e16e39b91f680d4668ec219ba05441ce286eb languageName: node linkType: hard "@babel/plugin-transform-object-super@npm:^7.23.3, @babel/plugin-transform-object-super@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-object-super@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-object-super@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" - "@babel/helper-replace-supers": "npm:^7.24.1" + "@babel/helper-plugin-utils": "npm:^7.24.7" + "@babel/helper-replace-supers": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/d30e6b9e59a707efd7ed524fc0a8deeea046011a6990250f2e9280516683138e2d13d9c52daf41d78407bdab0378aef7478326f2a15305b773d851cb6e106157 + checksum: 10c0/770cebb4b4e1872c216b17069db9a13b87dfee747d359dc56d9fcdd66e7544f92dc6ab1861a4e7e0528196aaff2444e4f17dc84efd8eaf162d542b4ba0943869 languageName: node linkType: hard "@babel/plugin-transform-optional-catch-binding@npm:^7.23.4, @babel/plugin-transform-optional-catch-binding@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-optional-catch-binding@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-optional-catch-binding@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" "@babel/plugin-syntax-optional-catch-binding": "npm:^7.8.3" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/68408b9ef772d9aa5dccf166c86dc4d2505990ce93e03dcfc65c73fb95c2511248e009ba9ccf5b96405fb85de1c16ad8291016b1cc5689ee4becb1e3050e0ae7 + checksum: 10c0/1e2f10a018f7d03b3bde6c0b70d063df8d5dd5209861d4467726cf834f5e3d354e2276079dc226aa8e6ece35f5c9b264d64b8229a8bb232829c01e561bcfb07a languageName: node linkType: hard -"@babel/plugin-transform-optional-chaining@npm:^7.23.0, @babel/plugin-transform-optional-chaining@npm:^7.23.4, @babel/plugin-transform-optional-chaining@npm:^7.24.1": +"@babel/plugin-transform-optional-chaining@npm:^7.23.0, @babel/plugin-transform-optional-chaining@npm:^7.23.4, @babel/plugin-transform-optional-chaining@npm:^7.24.1, @babel/plugin-transform-optional-chaining@npm:^7.24.7": version: 7.24.7 resolution: "@babel/plugin-transform-optional-chaining@npm:7.24.7" dependencies: @@ -1867,7 +1641,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-parameters@npm:^7.23.3, @babel/plugin-transform-parameters@npm:^7.24.1": +"@babel/plugin-transform-parameters@npm:^7.23.3, @babel/plugin-transform-parameters@npm:^7.24.1, @babel/plugin-transform-parameters@npm:^7.24.7": version: 7.24.7 resolution: "@babel/plugin-transform-parameters@npm:7.24.7" dependencies: @@ -1879,39 +1653,39 @@ __metadata: linkType: hard "@babel/plugin-transform-private-methods@npm:^7.22.5, @babel/plugin-transform-private-methods@npm:^7.23.3, @babel/plugin-transform-private-methods@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-private-methods@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-private-methods@npm:7.24.7" dependencies: - "@babel/helper-create-class-features-plugin": "npm:^7.24.1" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-create-class-features-plugin": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/d8e18587d2a8b71a795da5e8841b0e64f1525a99ad73ea8b9caa331bc271d69646e2e1e749fd634321f3df9d126070208ddac22a27ccf070566b2efb74fecd99 + checksum: 10c0/5b7bf923b738fbe3ad6c33b260e0a7451be288edfe4ef516303fa787a1870cd87533bfbf61abb779c22ed003c2fc484dec2436fe75a48756f686c0241173d364 languageName: node linkType: hard "@babel/plugin-transform-private-property-in-object@npm:^7.23.4, @babel/plugin-transform-private-property-in-object@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-private-property-in-object@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-private-property-in-object@npm:7.24.7" dependencies: - "@babel/helper-annotate-as-pure": "npm:^7.22.5" - "@babel/helper-create-class-features-plugin": "npm:^7.24.1" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-annotate-as-pure": "npm:^7.24.7" + "@babel/helper-create-class-features-plugin": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" "@babel/plugin-syntax-private-property-in-object": "npm:^7.14.5" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/33d2b9737de7667d7a1b704eef99bfecc6736157d9ea28c2e09010d5f25e33ff841c41d89a4430c5d47f4eb3384e24770fa0ec79600e1e38d6d16e2f9333b4b5 + checksum: 10c0/c6fa7defb90b1b0ed46f24ff94ff2e77f44c1f478d1090e81712f33cf992dda5ba347016f030082a2f770138bac6f4a9c2c1565e9f767a125901c77dd9c239ba languageName: node linkType: hard "@babel/plugin-transform-property-literals@npm:^7.23.3, @babel/plugin-transform-property-literals@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-property-literals@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-property-literals@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/3bf3e01f7bb8215a8b6d0081b6f86fea23e3a4543b619e059a264ede028bc58cdfb0acb2c43271271915a74917effa547bc280ac636a9901fa9f2fb45623f87e + checksum: 10c0/52564b58f3d111dc02d241d5892a4b01512e98dfdf6ef11b0ed62f8b11b0acacccef0fc229b44114fe8d1a57a8b70780b11bdd18b807d3754a781a07d8f57433 languageName: node linkType: hard @@ -1987,25 +1761,25 @@ __metadata: linkType: hard "@babel/plugin-transform-regenerator@npm:^7.23.3, @babel/plugin-transform-regenerator@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-regenerator@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-regenerator@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" regenerator-transform: "npm:^0.15.2" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/0a333585d7c0b38d31cc549d0f3cf7c396d1d50b6588a307dc58325505ddd4f5446188bc536c4779431b396251801b3f32d6d8e87db8274bc84e8c41950737f7 + checksum: 10c0/d2dc2c788fdae9d97217e70d46ba8ca9db0035c398dc3e161552b0c437113719a75c04f201f9c91ddc8d28a1da60d0b0853f616dead98a396abb9c845c44892b languageName: node linkType: hard "@babel/plugin-transform-reserved-words@npm:^7.23.3, @babel/plugin-transform-reserved-words@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-reserved-words@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-reserved-words@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/936d6e73cafb2cbb495f6817c6f8463288dbc9ab3c44684b931ebc1ece24f0d55dfabc1a75ba1de5b48843d0fef448dcfdbecb8485e4014f8f41d0d1440c536f + checksum: 10c0/2229de2768615e7f5dc0bbc55bc121b5678fd6d2febd46c74a58e42bb894d74cd5955c805880f4e02d0e1cf94f6886270eda7fafc1be9305a1ec3b9fd1d063f5 languageName: node linkType: hard @@ -2042,119 +1816,119 @@ __metadata: linkType: hard "@babel/plugin-transform-shorthand-properties@npm:^7.23.3, @babel/plugin-transform-shorthand-properties@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-shorthand-properties@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-shorthand-properties@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/8273347621183aada3cf1f3019d8d5f29467ba13a75b72cb405bc7f23b7e05fd85f4edb1e4d9f0103153dddb61826a42dc24d466480d707f8932c1923a4c25fa + checksum: 10c0/41b155bdbb3be66618358488bf7731b3b2e8fff2de3dbfd541847720a9debfcec14db06a117abedd03c9cd786db20a79e2a86509a4f19513f6e1b610520905cf languageName: node linkType: hard "@babel/plugin-transform-spread@npm:^7.23.3, @babel/plugin-transform-spread@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-spread@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-spread@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" - "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.22.5" + "@babel/helper-plugin-utils": "npm:^7.24.7" + "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/50a0302e344546d57e5c9f4dea575f88e084352eeac4e9a3e238c41739eef2df1daf4a7ebbb3ccb7acd3447f6a5ce9938405f98bf5f5583deceb8257f5a673c9 + checksum: 10c0/facba1553035f76b0d2930d4ada89a8cd0f45b79579afd35baefbfaf12e3b86096995f4b0c402cf9ee23b3f2ea0a4460c3b1ec0c192d340962c948bb223d4e66 languageName: node linkType: hard "@babel/plugin-transform-sticky-regex@npm:^7.23.3, @babel/plugin-transform-sticky-regex@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-sticky-regex@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-sticky-regex@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/786fe2ae11ef9046b9fa95677935abe495031eebf1274ad03f2054a20adea7b9dbd00336ac0b143f7924bc562e5e09793f6e8613607674b97e067d4838ccc4a0 + checksum: 10c0/5a74ed2ed0a3ab51c3d15fcaf09d9e2fe915823535c7a4d7b019813177d559b69677090e189ec3d5d08b619483eb5ad371fbcfbbff5ace2a76ba33ee566a1109 languageName: node linkType: hard "@babel/plugin-transform-template-literals@npm:^7.23.3, @babel/plugin-transform-template-literals@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-template-literals@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-template-literals@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/f73bcda5488eb81c6e7a876498d9e6b72be32fca5a4d9db9053491a2d1300cd27b889b463fd2558f3cd5826a85ed00f61d81b234aa55cb5a0abf1b6fa1bd5026 + checksum: 10c0/3630f966257bcace122f04d3157416a09d40768c44c3a800855da81146b009187daa21859d1c3b7d13f4e19e8888e60613964b175b2275d451200fb6d8d6cfe6 languageName: node linkType: hard "@babel/plugin-transform-typeof-symbol@npm:^7.23.3, @babel/plugin-transform-typeof-symbol@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-typeof-symbol@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-typeof-symbol@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/d392f549bfd13414f59feecdf3fb286f266a3eb9107a9de818e57907bda56eed08d1f6f8e314d09bf99252df026a7fd4d5df839acd45078a777abcebaa9a8593 + checksum: 10c0/5649e7260a138681e68b296ab5931e2b1f132f287d6b4131d49b24f9dc20d62902b7e9d63c4d2decd5683b41df35ef4b9b03f58c7f9f65e4c25a6d8bbf04e9e9 languageName: node linkType: hard "@babel/plugin-transform-typescript@npm:^7.13.0, @babel/plugin-transform-typescript@npm:^7.24.1": - version: 7.24.4 - resolution: "@babel/plugin-transform-typescript@npm:7.24.4" + version: 7.24.7 + resolution: "@babel/plugin-transform-typescript@npm:7.24.7" dependencies: - "@babel/helper-annotate-as-pure": "npm:^7.22.5" - "@babel/helper-create-class-features-plugin": "npm:^7.24.4" - "@babel/helper-plugin-utils": "npm:^7.24.0" - "@babel/plugin-syntax-typescript": "npm:^7.24.1" + "@babel/helper-annotate-as-pure": "npm:^7.24.7" + "@babel/helper-create-class-features-plugin": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" + "@babel/plugin-syntax-typescript": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/fa6625046f219cdc75061025c8031ada75ef631b137f1442e3d0054ba4e63548eb12cf55e2e1f442c889aa5fdd76d0d0b7904fdf812ce4c38748446227acc798 + checksum: 10c0/e8dacdc153a4c4599014b66eb01b94e3dc933d58d4f0cc3039c1a8f432e77b9df14f34a61964e014b975bf466f3fefd8c4768b3e887d3da1be9dc942799bdfdf languageName: node linkType: hard "@babel/plugin-transform-unicode-escapes@npm:^7.23.3, @babel/plugin-transform-unicode-escapes@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-unicode-escapes@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-unicode-escapes@npm:7.24.7" dependencies: - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/67a72a1ed99639de6a93aead35b1993cb3f0eb178a8991fcef48732c38c9f0279c85bbe1e2e2477b85afea873e738ff0955a35057635ce67bc149038e2d8a28e + checksum: 10c0/8b18e2e66af33471a6971289492beff5c240e56727331db1d34c4338a6a368a82a7ed6d57ec911001b6d65643aed76531e1e7cac93265fb3fb2717f54d845e69 languageName: node linkType: hard "@babel/plugin-transform-unicode-property-regex@npm:^7.23.3, @babel/plugin-transform-unicode-property-regex@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-unicode-property-regex@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-unicode-property-regex@npm:7.24.7" dependencies: - "@babel/helper-create-regexp-features-plugin": "npm:^7.22.15" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-create-regexp-features-plugin": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/d9d9752df7d51bf9357c0bf3762fe16b8c841fca9ecf4409a16f15ccc34be06e8e71abfaee1251b7d451227e70e6b873b36f86b090efdb20f6f7de5fdb6c7a05 + checksum: 10c0/bc57656eb94584d1b74a385d378818ac2b3fca642e3f649fead8da5fb3f9de22f8461185936915dfb33d5a9104e62e7a47828331248b09d28bb2d59e9276de3e languageName: node linkType: hard "@babel/plugin-transform-unicode-regex@npm:^7.23.3, @babel/plugin-transform-unicode-regex@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-unicode-regex@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-unicode-regex@npm:7.24.7" dependencies: - "@babel/helper-create-regexp-features-plugin": "npm:^7.22.15" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-create-regexp-features-plugin": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10c0/6046ab38e5d14ed97dbb921bd79ac1d7ad9d3286da44a48930e980b16896db2df21e093563ec3c916a630dc346639bf47c5924a33902a06fe3bbb5cdc7ef5f2f + checksum: 10c0/83f72a345b751566b601dc4d07e9f2c8f1bc0e0c6f7abb56ceb3095b3c9d304de73f85f2f477a09f8cc7edd5e65afd0ff9e376cdbcbea33bc0c28f3705b38fd9 languageName: node linkType: hard "@babel/plugin-transform-unicode-sets-regex@npm:^7.23.3, @babel/plugin-transform-unicode-sets-regex@npm:^7.24.1": - version: 7.24.1 - resolution: "@babel/plugin-transform-unicode-sets-regex@npm:7.24.1" + version: 7.24.7 + resolution: "@babel/plugin-transform-unicode-sets-regex@npm:7.24.7" dependencies: - "@babel/helper-create-regexp-features-plugin": "npm:^7.22.15" - "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/helper-create-regexp-features-plugin": "npm:^7.24.7" + "@babel/helper-plugin-utils": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0 - checksum: 10c0/b6c1f6b90afeeddf97e5713f72575787fcb7179be7b4c961869bfbc66915f66540dc49da93e4369da15596bd44b896d1eb8a50f5e1fd907abd7a1a625901006b + checksum: 10c0/7457c0ee8e80a80cb6fdc1fe54ab115b52815627616ce9151be8ef292fc99d04a910ec24f11382b4f124b89374264396892b086886bd2a9c2317904d87c9b21b languageName: node linkType: hard @@ -2502,25 +2276,7 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.16.0, @babel/traverse@npm:^7.18.9, @babel/traverse@npm:^7.23.9, @babel/traverse@npm:^7.24.0, @babel/traverse@npm:^7.24.1, @babel/traverse@npm:^7.4.5": - version: 7.24.1 - resolution: "@babel/traverse@npm:7.24.1" - dependencies: - "@babel/code-frame": "npm:^7.24.1" - "@babel/generator": "npm:^7.24.1" - "@babel/helper-environment-visitor": "npm:^7.22.20" - "@babel/helper-function-name": "npm:^7.23.0" - "@babel/helper-hoist-variables": "npm:^7.22.5" - "@babel/helper-split-export-declaration": "npm:^7.22.6" - "@babel/parser": "npm:^7.24.1" - "@babel/types": "npm:^7.24.0" - debug: "npm:^4.3.1" - globals: "npm:^11.1.0" - checksum: 10c0/c087b918f6823776537ba246136c70e7ce0719fc05361ebcbfd16f4e6f2f6f1f8f4f9167f1d9b675f27d12074839605189cc9d689de20b89a85e7c140f23daab - languageName: node - linkType: hard - -"@babel/traverse@npm:^7.22.5, @babel/traverse@npm:^7.25.2": +"@babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.16.0, @babel/traverse@npm:^7.18.9, @babel/traverse@npm:^7.22.5, @babel/traverse@npm:^7.23.9, @babel/traverse@npm:^7.24.0, @babel/traverse@npm:^7.24.1, @babel/traverse@npm:^7.24.7, @babel/traverse@npm:^7.25.2, @babel/traverse@npm:^7.4.5": version: 7.25.3 resolution: "@babel/traverse@npm:7.25.3" dependencies: @@ -2535,24 +2291,6 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.24.7": - version: 7.24.7 - resolution: "@babel/traverse@npm:7.24.7" - dependencies: - "@babel/code-frame": "npm:^7.24.7" - "@babel/generator": "npm:^7.24.7" - "@babel/helper-environment-visitor": "npm:^7.24.7" - "@babel/helper-function-name": "npm:^7.24.7" - "@babel/helper-hoist-variables": "npm:^7.24.7" - "@babel/helper-split-export-declaration": "npm:^7.24.7" - "@babel/parser": "npm:^7.24.7" - "@babel/types": "npm:^7.24.7" - debug: "npm:^4.3.1" - globals: "npm:^11.1.0" - checksum: 10c0/a5135e589c3f1972b8877805f50a084a04865ccb1d68e5e1f3b94a8841b3485da4142e33413d8fd76bc0e6444531d3adf1f59f359c11ffac452b743d835068ab - languageName: node - linkType: hard - "@babel/types@npm:7.17.0": version: 7.17.0 resolution: "@babel/types@npm:7.17.0" @@ -2563,18 +2301,7 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.11.5, @babel/types@npm:^7.18.9, @babel/types@npm:^7.2.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.6, @babel/types@npm:^7.23.9, @babel/types@npm:^7.24.0, @babel/types@npm:^7.24.7, @babel/types@npm:^7.4.4, @babel/types@npm:^7.6.1, @babel/types@npm:^7.7.2, @babel/types@npm:^7.8.3, @babel/types@npm:^7.9.6": - version: 7.24.7 - resolution: "@babel/types@npm:7.24.7" - dependencies: - "@babel/helper-string-parser": "npm:^7.24.7" - "@babel/helper-validator-identifier": "npm:^7.24.7" - to-fast-properties: "npm:^2.0.0" - checksum: 10c0/d9ecbfc3eb2b05fb1e6eeea546836ac30d990f395ef3fe3f75ced777a222c3cfc4489492f72e0ce3d9a5a28860a1ce5f81e66b88cf5088909068b3ff4fab72c1 - languageName: node - linkType: hard - -"@babel/types@npm:^7.17.0, @babel/types@npm:^7.25.0, @babel/types@npm:^7.25.2": +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.11.5, @babel/types@npm:^7.17.0, @babel/types@npm:^7.18.9, @babel/types@npm:^7.2.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.4, @babel/types@npm:^7.23.6, @babel/types@npm:^7.23.9, @babel/types@npm:^7.24.0, @babel/types@npm:^7.24.7, @babel/types@npm:^7.25.0, @babel/types@npm:^7.25.2, @babel/types@npm:^7.4.4, @babel/types@npm:^7.6.1, @babel/types@npm:^7.7.2, @babel/types@npm:^7.9.6": version: 7.25.2 resolution: "@babel/types@npm:7.25.2" dependencies: @@ -2585,17 +2312,6 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.22.15, @babel/types@npm:^7.23.0": - version: 7.24.0 - resolution: "@babel/types@npm:7.24.0" - dependencies: - "@babel/helper-string-parser": "npm:^7.23.4" - "@babel/helper-validator-identifier": "npm:^7.22.20" - to-fast-properties: "npm:^2.0.0" - checksum: 10c0/777a0bb5dbe038ca4c905fdafb1cdb6bdd10fe9d63ce13eca0bd91909363cbad554a53dc1f902004b78c1dcbc742056f877f2c99eeedff647333b1fadf51235d - languageName: node - linkType: hard - "@base2/pretty-print-object@npm:1.0.1": version: 1.0.1 resolution: "@base2/pretty-print-object@npm:1.0.1" @@ -6627,7 +6343,7 @@ __metadata: languageName: unknown linkType: soft -"@storybook/icons@npm:^1.2.10": +"@storybook/icons@npm:^1.2.10, @storybook/icons@npm:^1.2.5": version: 1.2.10 resolution: "@storybook/icons@npm:1.2.10" peerDependencies: @@ -6637,16 +6353,6 @@ __metadata: languageName: node linkType: hard -"@storybook/icons@npm:^1.2.5": - version: 1.2.5 - resolution: "@storybook/icons@npm:1.2.5" - peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 - checksum: 10c0/089622af6de4ab82624d894fbe43688a0eb72f15e6bb8fc19c54fb9f9d7312ce7caf34acebcbd63319dbaef129d8547bc23a5600955d04f6034355e7d82dcfa1 - languageName: node - linkType: hard - "@storybook/instrumenter@workspace:*, @storybook/instrumenter@workspace:lib/instrumenter": version: 0.0.0-use.local resolution: "@storybook/instrumenter@workspace:lib/instrumenter" @@ -9893,16 +9599,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.0.0, acorn@npm:^8.10.0, acorn@npm:^8.11.2, acorn@npm:^8.11.3, acorn@npm:^8.4.1, acorn@npm:^8.6.0, acorn@npm:^8.7.1, acorn@npm:^8.8.2, acorn@npm:^8.9.0": - version: 8.11.3 - resolution: "acorn@npm:8.11.3" - bin: - acorn: bin/acorn - checksum: 10c0/3ff155f8812e4a746fee8ecff1f227d527c4c45655bb1fad6347c3cb58e46190598217551b1500f18542d2bbe5c87120cb6927f5a074a59166fbdd9468f0a299 - languageName: node - linkType: hard - -"acorn@npm:^8.12.1": +"acorn@npm:^8.0.0, acorn@npm:^8.10.0, acorn@npm:^8.11.2, acorn@npm:^8.11.3, acorn@npm:^8.12.1, acorn@npm:^8.4.1, acorn@npm:^8.6.0, acorn@npm:^8.7.1, acorn@npm:^8.8.2, acorn@npm:^8.9.0": version: 8.12.1 resolution: "acorn@npm:8.12.1" bin: @@ -10590,7 +10287,7 @@ __metadata: languageName: node linkType: hard -"available-typed-arrays@npm:^1.0.6, available-typed-arrays@npm:^1.0.7": +"available-typed-arrays@npm:^1.0.7": version: 1.0.7 resolution: "available-typed-arrays@npm:1.0.7" dependencies: @@ -11140,16 +10837,7 @@ __metadata: languageName: node linkType: hard -"braces@npm:^3.0.2, braces@npm:~3.0.2": - version: 3.0.2 - resolution: "braces@npm:3.0.2" - dependencies: - fill-range: "npm:^7.0.1" - checksum: 10c0/321b4d675791479293264019156ca322163f02dc06e3c4cab33bb15cd43d80b51efef69b0930cfde3acd63d126ebca24cd0544fa6f261e093a0fb41ab9dda381 - languageName: node - linkType: hard - -"braces@npm:^3.0.3": +"braces@npm:^3.0.2, braces@npm:^3.0.3, braces@npm:~3.0.2": version: 3.0.3 resolution: "braces@npm:3.0.3" dependencies: @@ -15594,15 +15282,6 @@ __metadata: languageName: node linkType: hard -"fill-range@npm:^7.0.1": - version: 7.0.1 - resolution: "fill-range@npm:7.0.1" - dependencies: - to-regex-range: "npm:^5.0.1" - checksum: 10c0/7cdad7d426ffbaadf45aeb5d15ec675bbd77f7597ad5399e3d2766987ed20bda24d5fac64b3ee79d93276f5865608bb22344a26b9b1ae6c4d00bd94bf611623f - languageName: node - linkType: hard - "fill-range@npm:^7.1.1": version: 7.1.1 resolution: "fill-range@npm:7.1.1" @@ -16822,7 +16501,7 @@ __metadata: languageName: node linkType: hard -"has-tostringtag@npm:^1.0.0, has-tostringtag@npm:^1.0.1, has-tostringtag@npm:^1.0.2": +"has-tostringtag@npm:^1.0.0, has-tostringtag@npm:^1.0.2": version: 1.0.2 resolution: "has-tostringtag@npm:1.0.2" dependencies: @@ -23431,11 +23110,11 @@ __metadata: linkType: hard "prettier@npm:*, prettier@npm:^3.1.1, prettier@npm:^3.2.5": - version: 3.2.5 - resolution: "prettier@npm:3.2.5" + version: 3.3.3 + resolution: "prettier@npm:3.3.3" bin: prettier: bin/prettier.cjs - checksum: 10c0/ea327f37a7d46f2324a34ad35292af2ad4c4c3c3355da07313339d7e554320f66f65f91e856add8530157a733c6c4a897dc41b577056be5c24c40f739f5ee8c6 + checksum: 10c0/b85828b08e7505716324e4245549b9205c0cacb25342a030ba8885aba2039a115dbcf75a0b7ca3b37bc9d101ee61fab8113fc69ca3359f2a226f1ecc07ad2e26 languageName: node linkType: hard @@ -29580,20 +29259,7 @@ __metadata: languageName: node linkType: hard -"which-typed-array@npm:^1.1.14, which-typed-array@npm:^1.1.2, which-typed-array@npm:^1.1.9": - version: 1.1.14 - resolution: "which-typed-array@npm:1.1.14" - dependencies: - available-typed-arrays: "npm:^1.0.6" - call-bind: "npm:^1.0.5" - for-each: "npm:^0.3.3" - gopd: "npm:^1.0.1" - has-tostringtag: "npm:^1.0.1" - checksum: 10c0/0960f1e77807058819451b98c51d4cd72031593e8de990b24bd3fc22e176f5eee22921d68d852297c786aec117689f0423ed20aa4fde7ce2704d680677891f56 - languageName: node - linkType: hard - -"which-typed-array@npm:^1.1.15": +"which-typed-array@npm:^1.1.14, which-typed-array@npm:^1.1.15, which-typed-array@npm:^1.1.2, which-typed-array@npm:^1.1.9": version: 1.1.15 resolution: "which-typed-array@npm:1.1.15" dependencies: @@ -29779,22 +29445,7 @@ __metadata: languageName: node linkType: hard -"ws@npm:^8.13.0, ws@npm:^8.2.3": - version: 8.16.0 - resolution: "ws@npm:8.16.0" - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ">=5.0.2" - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - checksum: 10c0/a7783bb421c648b1e622b423409cb2a58ac5839521d2f689e84bc9dc41d59379c692dd405b15a997ea1d4c0c2e5314ad707332d0c558f15232d2bc07c0b4618a - languageName: node - linkType: hard - -"ws@npm:^8.18.0": +"ws@npm:^8.13.0, ws@npm:^8.18.0, ws@npm:^8.2.3": version: 8.18.0 resolution: "ws@npm:8.18.0" peerDependencies: From 6c3a0bb1eee028f7a5fccc86194ac333a36f0280 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Mon, 7 Oct 2024 21:58:32 +0200 Subject: [PATCH 26/26] fix formatting --- code/core/src/common/js-package-manager/JsPackageManager.ts | 2 +- .../src/preview-api/modules/store/csf/portable-stories.ts | 2 +- code/e2e-tests/util.ts | 2 +- code/frameworks/angular/src/server/angular-cli-webpack.js | 2 +- code/frameworks/vue3-vite/src/preset.ts | 2 +- .../cli-storybook/src/automigrate/helpers/mainConfigFile.ts | 4 +++- .../src/automigrate/helpers/new-frameworks-utils.ts | 4 ++-- code/lib/cli-storybook/src/automigrate/index.ts | 2 +- code/lib/codemod/src/transforms/__tests__/mdx-to-csf.test.ts | 2 +- code/renderers/vue3/src/docs/extractArgTypes.ts | 2 +- 10 files changed, 13 insertions(+), 11 deletions(-) diff --git a/code/core/src/common/js-package-manager/JsPackageManager.ts b/code/core/src/common/js-package-manager/JsPackageManager.ts index cf42d73d2a2..21f870852d4 100644 --- a/code/core/src/common/js-package-manager/JsPackageManager.ts +++ b/code/core/src/common/js-package-manager/JsPackageManager.ts @@ -60,7 +60,7 @@ export abstract class JsPackageManager { /** Get the INSTALLED version of a package from the package.json file */ async getPackageVersion(packageName: string, basePath = this.cwd): Promise { const packageJSON = await this.getPackageJSON(packageName, basePath); - return packageJSON ? packageJSON.version ?? null : null; + return packageJSON ? (packageJSON.version ?? null) : null; } constructor(options?: JsPackageManagerOptions) { diff --git a/code/core/src/preview-api/modules/store/csf/portable-stories.ts b/code/core/src/preview-api/modules/store/csf/portable-stories.ts index fd50bd57c2d..2ae9143a1a5 100644 --- a/code/core/src/preview-api/modules/store/csf/portable-stories.ts +++ b/code/core/src/preview-api/modules/store/csf/portable-stories.ts @@ -126,7 +126,7 @@ export function composeStory 0 ? defaultConfig - : globalThis.defaultProjectAnnotations ?? {}, + : (globalThis.defaultProjectAnnotations ?? {}), globalThis.globalProjectAnnotations ?? {}, projectAnnotations ?? {}, ]) diff --git a/code/e2e-tests/util.ts b/code/e2e-tests/util.ts index 00122ef595d..2137386c667 100644 --- a/code/e2e-tests/util.ts +++ b/code/e2e-tests/util.ts @@ -49,7 +49,7 @@ export class SbPage { await this.page.waitForURL((url) => url.search.includes( - `path=/${viewMode ?? name === 'docs' ? 'docs' : 'story'}/${titleId}--${storyId}` + `path=/${(viewMode ?? name === 'docs') ? 'docs' : 'story'}/${titleId}--${storyId}` ) ); diff --git a/code/frameworks/angular/src/server/angular-cli-webpack.js b/code/frameworks/angular/src/server/angular-cli-webpack.js index 92ed6225d19..6be86712e5b 100644 --- a/code/frameworks/angular/src/server/angular-cli-webpack.js +++ b/code/frameworks/angular/src/server/angular-cli-webpack.js @@ -68,7 +68,7 @@ exports.getWebpackConfig = async (baseConfig, { builderOptions, builderContext } outputPath: typeof builderOptions.outputPath === 'string' ? builderOptions.outputPath - : builderOptions.outputPath?.base ?? 'noop-out', + : (builderOptions.outputPath?.base ?? 'noop-out'), // Fixed options optimization: false, diff --git a/code/frameworks/vue3-vite/src/preset.ts b/code/frameworks/vue3-vite/src/preset.ts index 574ab0a04ad..8bbaf394d44 100644 --- a/code/frameworks/vue3-vite/src/preset.ts +++ b/code/frameworks/vue3-vite/src/preset.ts @@ -22,7 +22,7 @@ export const viteFinal: StorybookConfig['viteFinal'] = async (config, options) = const framework = await options.presets.apply('framework'); const frameworkOptions: FrameworkOptions = - typeof framework === 'string' ? {} : framework.options ?? {}; + typeof framework === 'string' ? {} : (framework.options ?? {}); const docgen = resolveDocgenOptions(frameworkOptions.docgen); diff --git a/code/lib/cli-storybook/src/automigrate/helpers/mainConfigFile.ts b/code/lib/cli-storybook/src/automigrate/helpers/mainConfigFile.ts index 492a91e5ff7..57aa4bf7ce0 100644 --- a/code/lib/cli-storybook/src/automigrate/helpers/mainConfigFile.ts +++ b/code/lib/cli-storybook/src/automigrate/helpers/mainConfigFile.ts @@ -94,7 +94,9 @@ export const getBuilderPackageName = (mainConfig?: StorybookConfigRaw) => { export const getFrameworkOptions = ( mainConfig?: StorybookConfigRaw ): Record | null => { - return typeof mainConfig?.framework === 'string' ? null : mainConfig?.framework?.options ?? null; + return typeof mainConfig?.framework === 'string' + ? null + : (mainConfig?.framework?.options ?? null); }; /** diff --git a/code/lib/cli-storybook/src/automigrate/helpers/new-frameworks-utils.ts b/code/lib/cli-storybook/src/automigrate/helpers/new-frameworks-utils.ts index a4ab6ee34a4..280bb2cf503 100644 --- a/code/lib/cli-storybook/src/automigrate/helpers/new-frameworks-utils.ts +++ b/code/lib/cli-storybook/src/automigrate/helpers/new-frameworks-utils.ts @@ -77,14 +77,14 @@ export const detectBuilderInfo = async ({ const builderPackageName = getBuilderPackageName(mainConfig); const frameworkPackageName = getFrameworkPackageName(mainConfig) as string; - let builderOptions = typeof builder !== 'string' ? builder?.options ?? {} : {}; + let builderOptions = typeof builder !== 'string' ? (builder?.options ?? {}) : {}; if (builderPackageName) { builderOrFrameworkName = builderPackageName; } else if (framework) { if (Object.keys(frameworkPackages).includes(frameworkPackageName)) { builderOrFrameworkName = frameworkPackageName; - builderOptions = typeof framework === 'object' ? framework.options?.builder ?? {} : {}; + builderOptions = typeof framework === 'object' ? (framework.options?.builder ?? {}) : {}; } } diff --git a/code/lib/cli-storybook/src/automigrate/index.ts b/code/lib/cli-storybook/src/automigrate/index.ts index 5b76b917b54..9d98d97d701 100644 --- a/code/lib/cli-storybook/src/automigrate/index.ts +++ b/code/lib/cli-storybook/src/automigrate/index.ts @@ -275,7 +275,7 @@ export async function runFixes({ if (result) { const promptType: Prompt = - typeof f.promptType === 'function' ? await f.promptType(result) : f.promptType ?? 'auto'; + typeof f.promptType === 'function' ? await f.promptType(result) : (f.promptType ?? 'auto'); logger.info(`\nšŸ”Ž found a '${picocolors.cyan(f.id)}' migration:`); const message = f.prompt(result); diff --git a/code/lib/codemod/src/transforms/__tests__/mdx-to-csf.test.ts b/code/lib/codemod/src/transforms/__tests__/mdx-to-csf.test.ts index 304fb0c40b0..6d41995d3e8 100644 --- a/code/lib/codemod/src/transforms/__tests__/mdx-to-csf.test.ts +++ b/code/lib/codemod/src/transforms/__tests__/mdx-to-csf.test.ts @@ -7,7 +7,7 @@ import { dedent } from 'ts-dedent'; import jscodeshift, { nameToValidExport } from '../mdx-to-csf'; expect.addSnapshotSerializer({ - print: (val: any) => (typeof val === 'string' ? val : JSON.stringify(val, null, 2) ?? ''), + print: (val: any) => (typeof val === 'string' ? val : (JSON.stringify(val, null, 2) ?? '')), test: () => true, }); diff --git a/code/renderers/vue3/src/docs/extractArgTypes.ts b/code/renderers/vue3/src/docs/extractArgTypes.ts index 7e76c731177..f52f21c1525 100644 --- a/code/renderers/vue3/src/docs/extractArgTypes.ts +++ b/code/renderers/vue3/src/docs/extractArgTypes.ts @@ -129,7 +129,7 @@ export const extractFromVueDocgenApi = ( } } - const required = 'required' in docgenInfo ? docgenInfo.required ?? false : false; + const required = 'required' in docgenInfo ? (docgenInfo.required ?? false) : false; return { name: docgenInfo.name,