diff --git a/code/addons/interactions/package.json b/code/addons/interactions/package.json index 3657895794d1..9e272a673991 100644 --- a/code/addons/interactions/package.json +++ b/code/addons/interactions/package.json @@ -89,7 +89,7 @@ "devDependencies": { "@storybook/jest": "^0.0.10", "@storybook/testing-library": "0.0.14-next.0", - "@types/node": "^16.0.0 || ^18.0.0", + "@types/node": "^16.0.0", "formik": "^2.2.9", "typescript": "^4.9.3" }, diff --git a/code/frameworks/angular/package.json b/code/frameworks/angular/package.json index e8e835007c56..32d2498be2d2 100644 --- a/code/frameworks/angular/package.json +++ b/code/frameworks/angular/package.json @@ -47,7 +47,7 @@ "@storybook/node-logger": "7.0.0-alpha.52", "@storybook/store": "7.0.0-alpha.52", "@storybook/types": "7.0.0-alpha.52", - "@types/node": "^16.0.0 || ^18.0.0", + "@types/node": "^16.0.0", "@types/react": "^16.14.34", "@types/react-dom": "^16.9.14", "@types/semver": "^7.3.4", diff --git a/code/frameworks/html-webpack5/package.json b/code/frameworks/html-webpack5/package.json index 8fec7293e724..538d3162f32a 100644 --- a/code/frameworks/html-webpack5/package.json +++ b/code/frameworks/html-webpack5/package.json @@ -54,7 +54,7 @@ "@storybook/core-common": "7.0.0-alpha.52", "@storybook/html": "7.0.0-alpha.52", "@storybook/preset-html-webpack": "7.0.0-alpha.52", - "@types/node": "^16.0.0 || ^18.0.0", + "@types/node": "^16.0.0", "global": "^4.4.0", "react": "16.14.0", "react-dom": "16.14.0" diff --git a/code/frameworks/nextjs/package.json b/code/frameworks/nextjs/package.json index 110f70a23319..3ea87a8bb663 100644 --- a/code/frameworks/nextjs/package.json +++ b/code/frameworks/nextjs/package.json @@ -65,7 +65,7 @@ "@storybook/node-logger": "7.0.0-alpha.52", "@storybook/preset-react-webpack": "7.0.0-alpha.52", "@storybook/react": "7.0.0-alpha.52", - "@types/node": "^16.0.0 || ^18.0.0", + "@types/node": "^16.0.0", "find-up": "^5.0.0", "fs-extra": "^9.0.1", "image-size": "^1.0.0", diff --git a/code/frameworks/preact-webpack5/package.json b/code/frameworks/preact-webpack5/package.json index a1568f10b917..6342edfa57c4 100644 --- a/code/frameworks/preact-webpack5/package.json +++ b/code/frameworks/preact-webpack5/package.json @@ -54,7 +54,7 @@ "@storybook/core-common": "7.0.0-alpha.52", "@storybook/preact": "7.0.0-alpha.52", "@storybook/preset-preact-webpack": "7.0.0-alpha.52", - "@types/node": "^16.0.0 || ^18.0.0", + "@types/node": "^16.0.0", "react": "16.14.0", "react-dom": "16.14.0" }, diff --git a/code/frameworks/react-vite/package.json b/code/frameworks/react-vite/package.json index cd1d2fc5f1bb..f828bcbc5238 100644 --- a/code/frameworks/react-vite/package.json +++ b/code/frameworks/react-vite/package.json @@ -67,7 +67,7 @@ "vite": "^3.1.3" }, "devDependencies": { - "@types/node": "^16.0.0 || ^18.0.0", + "@types/node": "^16.0.0", "typescript": "^4.9.3", "vite": "^3.1.3" }, diff --git a/code/frameworks/react-webpack5/package.json b/code/frameworks/react-webpack5/package.json index eece030e924d..d4a8f42d0d07 100644 --- a/code/frameworks/react-webpack5/package.json +++ b/code/frameworks/react-webpack5/package.json @@ -54,7 +54,7 @@ "@storybook/builder-webpack5": "7.0.0-alpha.52", "@storybook/preset-react-webpack": "7.0.0-alpha.52", "@storybook/react": "7.0.0-alpha.52", - "@types/node": "^16.0.0 || ^18.0.0" + "@types/node": "^16.0.0" }, "devDependencies": { "jest-specific-snapshot": "^6.0.0", diff --git a/code/frameworks/server-webpack5/package.json b/code/frameworks/server-webpack5/package.json index 3915169aa641..2818fc34c1a3 100644 --- a/code/frameworks/server-webpack5/package.json +++ b/code/frameworks/server-webpack5/package.json @@ -54,7 +54,7 @@ "@storybook/core-common": "7.0.0-alpha.52", "@storybook/preset-server-webpack": "7.0.0-alpha.52", "@storybook/server": "7.0.0-alpha.52", - "@types/node": "^16.0.0 || ^18.0.0", + "@types/node": "^16.0.0", "react": "16.14.0", "react-dom": "16.14.0" }, diff --git a/code/frameworks/svelte-vite/package.json b/code/frameworks/svelte-vite/package.json index a4134222a971..d90dc53c5dbf 100644 --- a/code/frameworks/svelte-vite/package.json +++ b/code/frameworks/svelte-vite/package.json @@ -67,7 +67,7 @@ "vite": "^3.1.3" }, "devDependencies": { - "@types/node": "^16.0.0 || ^18.0.0", + "@types/node": "^16.0.0", "typescript": "^4.9.3", "vite": "^3.1.3" }, diff --git a/code/frameworks/vue-webpack5/package.json b/code/frameworks/vue-webpack5/package.json index 11c51707f26a..f638d17edd66 100644 --- a/code/frameworks/vue-webpack5/package.json +++ b/code/frameworks/vue-webpack5/package.json @@ -54,7 +54,7 @@ "@storybook/core-common": "7.0.0-alpha.52", "@storybook/preset-vue-webpack": "7.0.0-alpha.52", "@storybook/vue": "7.0.0-alpha.52", - "@types/node": "^16.0.0 || ^18.0.0", + "@types/node": "^16.0.0", "react": "16.14.0", "react-dom": "16.14.0" }, diff --git a/code/frameworks/vue3-vite/package.json b/code/frameworks/vue3-vite/package.json index 4a79a609cd62..ac53438f83a4 100644 --- a/code/frameworks/vue3-vite/package.json +++ b/code/frameworks/vue3-vite/package.json @@ -65,7 +65,7 @@ "vue-docgen-api": "^4.40.0" }, "devDependencies": { - "@types/node": "^16.0.0 || ^18.0.0", + "@types/node": "^16.0.0", "typescript": "^4.9.3", "vite": "^3.1.3" }, diff --git a/code/frameworks/vue3-webpack5/package.json b/code/frameworks/vue3-webpack5/package.json index 0d75336f71dc..142183db5562 100644 --- a/code/frameworks/vue3-webpack5/package.json +++ b/code/frameworks/vue3-webpack5/package.json @@ -54,7 +54,7 @@ "@storybook/core-common": "7.0.0-alpha.52", "@storybook/preset-vue3-webpack": "7.0.0-alpha.52", "@storybook/vue3": "7.0.0-alpha.52", - "@types/node": "^16.0.0 || ^18.0.0", + "@types/node": "^16.0.0", "react": "16.14.0", "react-dom": "16.14.0" }, diff --git a/code/frameworks/web-components-vite/package.json b/code/frameworks/web-components-vite/package.json index 131a40e68959..be6eecd96ba4 100644 --- a/code/frameworks/web-components-vite/package.json +++ b/code/frameworks/web-components-vite/package.json @@ -64,7 +64,7 @@ "vite": "3" }, "devDependencies": { - "@types/node": "^16.0.0 || ^18.0.0", + "@types/node": "^16.0.0", "typescript": "^4.9.3", "vite": "^3.1.0" }, diff --git a/code/frameworks/web-components-webpack5/package.json b/code/frameworks/web-components-webpack5/package.json index b8c4565b4534..b3c46b7b2690 100644 --- a/code/frameworks/web-components-webpack5/package.json +++ b/code/frameworks/web-components-webpack5/package.json @@ -57,7 +57,7 @@ "@storybook/core-common": "7.0.0-alpha.52", "@storybook/preset-web-components-webpack": "7.0.0-alpha.52", "@storybook/web-components": "7.0.0-alpha.52", - "@types/node": "^16.0.0 || ^18.0.0", + "@types/node": "^16.0.0", "react": "16.14.0", "react-dom": "16.14.0" }, diff --git a/code/lib/api/package.json b/code/lib/api/package.json index da3d208a2ba8..45177466b690 100644 --- a/code/lib/api/package.json +++ b/code/lib/api/package.json @@ -24,11 +24,6 @@ "import": "./dist/index.mjs", "types": "./dist/index.d.ts" }, - "./shortcut": { - "require": "./dist/shortcut.js", - "import": "./dist/shortcut.mjs", - "types": "./dist/shortcut.d.ts" - }, "./package.json": "./package.json" }, "main": "dist/index.js", @@ -79,8 +74,7 @@ }, "bundler": { "entries": [ - "./src/index.tsx", - "./src/shortcut.ts" + "./src/index.tsx" ] }, "gitHead": "d2494e3f51ce0f55bcb1ef693a6477c669fbe666" diff --git a/code/lib/api/shortcut.d.ts b/code/lib/api/shortcut.d.ts deleted file mode 100644 index 26c2671b9af5..000000000000 --- a/code/lib/api/shortcut.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export type KeyCollection = string[]; - -export function shortcutToHumanString(shortcut: KeyCollection): string; -export function eventToShortcut(e: KeyboardEvent): KeyCollection | null; -export function shortcutMatchesShortcut( - inputShortcut: KeyCollection, - shortcut: KeyCollection -): boolean; diff --git a/code/lib/api/shortcut.js b/code/lib/api/shortcut.js deleted file mode 100644 index 9fb9988699cd..000000000000 --- a/code/lib/api/shortcut.js +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/shortcut'; diff --git a/code/lib/api/src/index.tsx b/code/lib/api/src/index.tsx index ff0e9cee8388..380bd9085972 100644 --- a/code/lib/api/src/index.tsx +++ b/code/lib/api/src/index.tsx @@ -64,6 +64,7 @@ import * as url from './modules/url'; import * as version from './modules/versions'; // eslint-disable-next-line import/no-cycle import * as globals from './modules/globals'; +import { eventToShortcut, shortcutMatchesShortcut, shortcutToHumanString } from './lib/shortcut'; const { ActiveTabs } = layout; @@ -480,3 +481,5 @@ export function useArgTypes(): API_ArgTypes { const current = useCurrentStory(); return (current?.type === 'story' && current.argTypes) || {}; } + +export { eventToShortcut, shortcutToHumanString, shortcutMatchesShortcut }; diff --git a/code/lib/builder-manager/src/index.ts b/code/lib/builder-manager/src/index.ts index 84eac54e7937..cda53d1161d3 100644 --- a/code/lib/builder-manager/src/index.ts +++ b/code/lib/builder-manager/src/index.ts @@ -125,8 +125,8 @@ const starter: StarterFunction = async function* starterGeneratorFn({ const coreDirOrigin = join(dirname(require.resolve('@storybook/manager/package.json')), 'dist'); - router.use(`/sb-addons`, express.static(addonsDir)); - router.use(`/sb-manager`, express.static(coreDirOrigin)); + router.use(`/sb-addons`, express.static(addonsDir, { immutable: true, maxAge: '5m' })); + router.use(`/sb-manager`, express.static(coreDirOrigin, { immutable: true, maxAge: '5m' })); const { cssFiles, jsFiles } = await readOrderedFiles(addonsDir, compilation?.outputFiles); diff --git a/code/lib/builder-manager/src/utils/template.ts b/code/lib/builder-manager/src/utils/template.ts index 4e0210f9509a..48d402a9328d 100644 --- a/code/lib/builder-manager/src/utils/template.ts +++ b/code/lib/builder-manager/src/utils/template.ts @@ -57,7 +57,7 @@ export const renderHTML = async ( refs: Promise>, logLevel: Promise, docsOptions: Promise, - { versionCheck, releaseNotesData, docsMode, previewUrl, serverChannelUrl }: Options + { versionCheck, releaseNotesData, previewUrl, serverChannelUrl, configType }: Options ) => { const customHeadRef = await customHead; const titleRef = await title; @@ -71,6 +71,7 @@ export const renderHTML = async ( REFS: JSON.stringify(await refs, null, 2), LOGLEVEL: JSON.stringify(await logLevel, null, 2), DOCS_OPTIONS: JSON.stringify(await docsOptions, null, 2), + CONFIG_TYPE: JSON.stringify(await configType, null, 2), // These two need to be double stringified because the UI expects a string VERSIONCHECK: JSON.stringify(JSON.stringify(versionCheck), null, 2), RELEASE_NOTES_DATA: JSON.stringify(JSON.stringify(releaseNotesData), null, 2), diff --git a/code/lib/builder-manager/templates/template.ejs b/code/lib/builder-manager/templates/template.ejs index d513ace5dd3f..2fd986bf3c4b 100644 --- a/code/lib/builder-manager/templates/template.ejs +++ b/code/lib/builder-manager/templates/template.ejs @@ -8,6 +8,8 @@ + + <% if (typeof head !== 'undefined') { %> <%- head %> <% } %>