From 378b3114adf0023454a8411ecb11733fd48c64f7 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Thu, 24 Aug 2023 09:30:32 +0200 Subject: [PATCH 01/61] add type checking and fix types --- .vscode/settings.json | 5 +- package.json | 5 ++ pnpm-lock.yaml | 129 ++++++++++++++++++++++++++++++++-- src/parser/collect-stories.ts | 2 +- tsconfig.json | 4 +- 5 files changed, 136 insertions(+), 9 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 66d2c07..35c04ce 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "deepscan.enable": true -} \ No newline at end of file + "deepscan.enable": true, + "typescript.tsdk": "node_modules/typescript/lib" +} diff --git a/package.json b/package.json index eaf23fc..f3361a6 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "test": "vitest run", "chromatic": "chromatic --exit-zero-on-changes", "coverage": "vitest run --coverage", + "check": "svelte-check", "lint": "eslint --cache --cache-location=.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directives", "storybook": "storybook dev --port 6006", "start": "concurrently \"pnpm run storybook --quiet\" \"pnpm run build --watch\"", @@ -65,6 +66,8 @@ "@storybook/csf": "^0.1.1", "@storybook/eslint-config-storybook": "^3.1.2", "@storybook/jest": "^0.1.0", + "@storybook/manager-api": "^7.0.0", + "@storybook/node-logger": "^7.0.0", "@storybook/svelte": "^7.1.1", "@storybook/svelte-vite": "^7.1.1", "@storybook/test-runner": "^0.11.0", @@ -73,6 +76,7 @@ "@sveltejs/package": "^2.2.0", "@sveltejs/vite-plugin-svelte": "^2.4.2", "@tsconfig/svelte": "^5.0.0", + "@types/estree": "^1.0.1", "auto": "^10.43.0", "chromatic": "^6.19.9", "concurrently": "^8.2.0", @@ -85,6 +89,7 @@ "rimraf": "^3.0.2", "storybook": "^7.1.1", "svelte": "^4.0.0", + "svelte-check": "^3.5.0", "svelte-jester": "^2.3.2", "svelte-loader": "^3.1.7", "typescript": "^5.1.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3602d2e..84ef3b5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -55,6 +55,12 @@ devDependencies: '@storybook/jest': specifier: ^0.1.0 version: 0.1.0 + '@storybook/manager-api': + specifier: ^7.0.0 + version: 7.1.1(react-dom@18.2.0)(react@18.2.0) + '@storybook/node-logger': + specifier: ^7.0.0 + version: 7.1.1 '@storybook/svelte': specifier: ^7.1.1 version: 7.1.1(svelte@4.0.0) @@ -79,6 +85,9 @@ devDependencies: '@tsconfig/svelte': specifier: ^5.0.0 version: 5.0.0 + '@types/estree': + specifier: ^1.0.1 + version: 1.0.1 auto: specifier: ^10.43.0 version: 10.43.0(@swc/core@1.3.72)(@types/node@20.4.5)(typescript@5.1.6) @@ -115,6 +124,9 @@ devDependencies: svelte: specifier: ^4.0.0 version: 4.0.0 + svelte-check: + specifier: ^3.5.0 + version: 3.5.0(@babel/core@7.22.9)(svelte@4.0.0) svelte-jester: specifier: ^2.3.2 version: 2.3.2(jest@29.6.2)(svelte@4.0.0) @@ -4160,6 +4172,10 @@ packages: resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==} dev: true + /@types/pug@2.0.6: + resolution: {integrity: sha512-SnHmG9wN1UVmagJOnyo/qkk0Z7gejYxOYYmaAwr5u2yFYfsupN3sg10kyzN8Hep/2zbHxCnsumxOoRIRMBwKCg==} + dev: true + /@types/qs@6.9.7: resolution: {integrity: sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==} dev: true @@ -5405,8 +5421,8 @@ packages: engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} dev: true - /code-red@1.0.3: - resolution: {integrity: sha512-kVwJELqiILQyG5aeuyKFbdsI1fmQy1Cmf7dQ8eGmVuJoaRVdwey7WaMknr2ZFeVSYSKT0rExsa8EGw0aoI/1QQ==} + /code-red@1.0.4: + resolution: {integrity: sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==} dependencies: '@jridgewell/sourcemap-codec': 1.4.15 '@types/estree': 1.0.1 @@ -6258,6 +6274,10 @@ packages: resolution: {integrity: sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw==} dev: true + /es6-promise@3.3.1: + resolution: {integrity: sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==} + dev: true + /esbuild-plugin-alias@0.2.1: resolution: {integrity: sha512-jyfL/pwPqaFXyKnj8lP8iLk6Z0m099uXR45aSN8Av1XD4vhvQutxxPzgA2bTcAwQpa1zCXDcWOlhFgyP3GKqhQ==} dev: true @@ -8776,7 +8796,7 @@ packages: jest-pnp-resolver: 1.2.3(jest-resolve@29.6.2) jest-util: 29.6.2 jest-validate: 29.6.2 - resolve: 1.22.2 + resolve: 1.22.3 resolve.exports: 2.0.2 slash: 3.0.0 dev: true @@ -9492,6 +9512,13 @@ packages: hasBin: true dev: true + /magic-string@0.27.0: + resolution: {integrity: sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==} + engines: {node: '>=12'} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + /magic-string@0.30.1: resolution: {integrity: sha512-mbVKXPmS0z0G4XqFDCTllmDQ6coZzn94aMlb0o/A4HEHJCKcanlDZwYJgwnkmgD3jyWhUgj9VsPrfd972yPffA==} engines: {node: '>=12'} @@ -11266,6 +11293,15 @@ packages: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} dev: true + /sander@0.5.1: + resolution: {integrity: sha512-3lVqBir7WuKDHGrKRDn/1Ye3kwpXaDOMsiRP1wd6wpZW56gJhsbp5RqQpA6JG/P+pkXizygnr1dKR8vzWaVsfA==} + dependencies: + es6-promise: 3.3.1 + graceful-fs: 4.2.11 + mkdirp: 0.5.6 + rimraf: 2.7.1 + dev: true + /saxes@6.0.0: resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} engines: {node: '>=v12.22.7'} @@ -11445,6 +11481,16 @@ packages: resolution: {integrity: sha512-VZBmZP8WU3sMOZm1bdgTadsQbcscK0UM8oKxKVBs4XAhUo2Xxzm/OFMGBkPusxw9xL3Uy8LrzEqGqJhclsr0yA==} dev: true + /sorcery@0.11.0: + resolution: {integrity: sha512-J69LQ22xrQB1cIFJhPfgtLuI6BpWRiWu1Y3vSsIwK/eAScqJxd/+CJlUuHQRdX2C9NGFamq+KqNywGgaThwfHw==} + hasBin: true + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + buffer-crc32: 0.2.13 + minimist: 1.2.8 + sander: 0.5.1 + dev: true + /sort-object-keys@1.1.3: resolution: {integrity: sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg==} dev: true @@ -11766,6 +11812,33 @@ packages: engines: {node: '>= 0.4'} dev: true + /svelte-check@3.5.0(@babel/core@7.22.9)(svelte@4.0.0): + resolution: {integrity: sha512-KHujbn4k17xKYLmtCwv0sKKM7uiHTYcQvXnvrCcNU6a7hcszh99zFTIoiu/Sp/ewAw5aJmillJ1Cs8gKLmcX4A==} + hasBin: true + peerDependencies: + svelte: ^3.55.0 || ^4.0.0-next.0 || ^4.0.0 + dependencies: + '@jridgewell/trace-mapping': 0.3.18 + chokidar: 3.5.3 + fast-glob: 3.3.1 + import-fresh: 3.3.0 + picocolors: 1.0.0 + sade: 1.8.1 + svelte: 4.0.0 + svelte-preprocess: 5.0.4(@babel/core@7.22.9)(svelte@4.0.0)(typescript@5.1.6) + typescript: 5.1.6 + transitivePeerDependencies: + - '@babel/core' + - coffeescript + - less + - postcss + - postcss-load-config + - pug + - sass + - stylus + - sugarss + dev: true + /svelte-dev-helper@1.1.9: resolution: {integrity: sha512-oU+Xv7Dl4kRU2kdFjsoPLfJfnt5hUhsFUZtuzI3Ku/f2iAFZqBoEuXOqK3N9ngD4dxQOmN4OKWPHVi3NeAeAfQ==} dev: true @@ -11810,6 +11883,54 @@ packages: svelte-hmr: 0.14.12(svelte@4.0.0) dev: true + /svelte-preprocess@5.0.4(@babel/core@7.22.9)(svelte@4.0.0)(typescript@5.1.6): + resolution: {integrity: sha512-ABia2QegosxOGsVlsSBJvoWeXy1wUKSfF7SWJdTjLAbx/Y3SrVevvvbFNQqrSJw89+lNSsM58SipmZJ5SRi5iw==} + engines: {node: '>= 14.10.0'} + requiresBuild: true + peerDependencies: + '@babel/core': ^7.10.2 + coffeescript: ^2.5.1 + less: ^3.11.3 || ^4.0.0 + postcss: ^7 || ^8 + postcss-load-config: ^2.1.0 || ^3.0.0 || ^4.0.0 + pug: ^3.0.0 + sass: ^1.26.8 + stylus: ^0.55.0 + sugarss: ^2.0.0 || ^3.0.0 || ^4.0.0 + svelte: ^3.23.0 || ^4.0.0-next.0 || ^4.0.0 + typescript: '>=3.9.5 || ^4.0.0 || ^5.0.0' + peerDependenciesMeta: + '@babel/core': + optional: true + coffeescript: + optional: true + less: + optional: true + postcss: + optional: true + postcss-load-config: + optional: true + pug: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + typescript: + optional: true + dependencies: + '@babel/core': 7.22.9 + '@types/pug': 2.0.6 + detect-indent: 6.1.0 + magic-string: 0.27.0 + sorcery: 0.11.0 + strip-indent: 3.0.0 + svelte: 4.0.0 + typescript: 5.1.6 + dev: true + /svelte2tsx@0.6.19(svelte@4.0.0)(typescript@5.1.6): resolution: {integrity: sha512-h3b5OtcO8zyVL/RiB2zsDwCopeo/UH+887uyhgb2mjnewOFwiTxu+4IGuVwrrlyuh2onM2ktfUemNrNmQwXONQ==} peerDependencies: @@ -11832,7 +11953,7 @@ packages: acorn: 8.10.0 aria-query: 5.3.0 axobject-query: 3.2.1 - code-red: 1.0.3 + code-red: 1.0.4 css-tree: 2.3.1 estree-walker: 3.0.3 is-reference: 3.0.1 diff --git a/src/parser/collect-stories.ts b/src/parser/collect-stories.ts index 5a5e218..c69e420 100644 --- a/src/parser/collect-stories.ts +++ b/src/parser/collect-stories.ts @@ -44,7 +44,7 @@ export default (StoriesComponent, { stories = {}, allocatedIds = [] }) => { // extract all stories try { const context = new RegisterContext({ - target: createFragment() as Document | Element, + target: createFragment() as Element, props: { Stories: StoriesComponent, repositories, diff --git a/tsconfig.json b/tsconfig.json index 22e7d50..25930b8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,7 @@ "experimentalDecorators": true, "incremental": false, "isolatedModules": true, - "lib": ["esnext"], + "lib": ["esnext", "dom"], "module": "es2020", "moduleResolution": "nodenext", "noImplicitAny": false, @@ -17,4 +17,4 @@ "strict": true }, "include": ["src/**/*"] -} \ No newline at end of file +} From 8560cf5fa1ea423272db789f82c6bbcef5e72ab3 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Thu, 24 Aug 2023 09:31:27 +0200 Subject: [PATCH 02/61] pin svelte to v3 --- package.json | 4 +- pnpm-lock.yaml | 148 +++++++++++++++---------------------------------- 2 files changed, 46 insertions(+), 106 deletions(-) diff --git a/package.json b/package.json index f3361a6..604737d 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "react-dom": "^18.2.0", "rimraf": "^3.0.2", "storybook": "^7.1.1", - "svelte": "^4.0.0", + "svelte": "^3.55.0", "svelte-check": "^3.5.0", "svelte-jester": "^2.3.2", "svelte-loader": "^3.1.7", @@ -100,7 +100,7 @@ "@storybook/svelte": "^7.0.0", "@storybook/theming": "^7.0.0", "@sveltejs/vite-plugin-svelte": "^1.0.0 || ^2.0.0", - "svelte": "^3.50.0 || ^4.0.0", + "svelte": "^3.50.0", "svelte-loader": "^3.1.2", "vite": "^3.0.0 || ^4.0.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 84ef3b5..70b232b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -63,10 +63,10 @@ devDependencies: version: 7.1.1 '@storybook/svelte': specifier: ^7.1.1 - version: 7.1.1(svelte@4.0.0) + version: 7.1.1(svelte@3.55.0) '@storybook/svelte-vite': specifier: ^7.1.1 - version: 7.1.1(svelte@4.0.0)(typescript@5.1.6)(vite@4.4.3) + version: 7.1.1(svelte@3.55.0)(typescript@5.1.6)(vite@4.4.3) '@storybook/test-runner': specifier: ^0.11.0 version: 0.11.0(@types/node@20.4.5) @@ -78,10 +78,10 @@ devDependencies: version: 7.1.1 '@sveltejs/package': specifier: ^2.2.0 - version: 2.2.0(svelte@4.0.0)(typescript@5.1.6) + version: 2.2.0(svelte@3.55.0)(typescript@5.1.6) '@sveltejs/vite-plugin-svelte': specifier: ^2.4.2 - version: 2.4.2(svelte@4.0.0)(vite@4.4.3) + version: 2.4.2(svelte@3.55.0)(vite@4.4.3) '@tsconfig/svelte': specifier: ^5.0.0 version: 5.0.0 @@ -122,17 +122,17 @@ devDependencies: specifier: ^7.1.1 version: 7.1.1 svelte: - specifier: ^4.0.0 - version: 4.0.0 + specifier: ^3.55.0 + version: 3.55.0 svelte-check: specifier: ^3.5.0 - version: 3.5.0(@babel/core@7.22.9)(svelte@4.0.0) + version: 3.5.0(@babel/core@7.22.9)(svelte@3.55.0) svelte-jester: specifier: ^2.3.2 - version: 2.3.2(jest@29.6.2)(svelte@4.0.0) + version: 2.3.2(jest@29.6.2)(svelte@3.55.0) svelte-loader: specifier: ^3.1.7 - version: 3.1.7(svelte@4.0.0) + version: 3.1.7(svelte@3.55.0) typescript: specifier: ^5.1.6 version: 5.1.6 @@ -3561,7 +3561,7 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: true - /@storybook/svelte-vite@7.1.1(svelte@4.0.0)(typescript@5.1.6)(vite@4.4.3): + /@storybook/svelte-vite@7.1.1(svelte@3.55.0)(typescript@5.1.6)(vite@4.4.3): resolution: {integrity: sha512-0GyqGDUh/szuCyUZ++X93qND5w45mv83pdgtQQZlTImQcW/NZxPWB1i6B5bBxPgSkIXvaOuW8JpjC21YGFGRcg==} engines: {node: ^14.18 || >=16} peerDependencies: @@ -3570,10 +3570,10 @@ packages: dependencies: '@storybook/builder-vite': 7.1.1(typescript@5.1.6)(vite@4.4.3) '@storybook/node-logger': 7.1.1 - '@storybook/svelte': 7.1.1(svelte@4.0.0) - '@sveltejs/vite-plugin-svelte': 2.4.2(svelte@4.0.0)(vite@4.4.3) + '@storybook/svelte': 7.1.1(svelte@3.55.0) + '@sveltejs/vite-plugin-svelte': 2.4.2(svelte@3.55.0)(vite@4.4.3) magic-string: 0.30.1 - svelte: 4.0.0 + svelte: 3.55.0 sveltedoc-parser: 4.2.1 ts-dedent: 2.2.0 vite: 4.4.3(@types/node@20.4.5) @@ -3585,7 +3585,7 @@ packages: - vite-plugin-glimmerx dev: true - /@storybook/svelte@7.1.1(svelte@4.0.0): + /@storybook/svelte@7.1.1(svelte@3.55.0): resolution: {integrity: sha512-mQLmJCYGxdHWKVEeKcaB1Y+BapH6vwyPOuQ0W3Fy1Pv0k0+/UO5sxS63ps2HsCjloYndLn8drwtx11HrM/G6zw==} engines: {node: '>=16.0.0'} peerDependencies: @@ -3598,7 +3598,7 @@ packages: '@storybook/global': 5.0.0 '@storybook/preview-api': 7.1.1 '@storybook/types': 7.1.1 - svelte: 4.0.0 + svelte: 3.55.0 sveltedoc-parser: 4.2.1 type-fest: 3.13.1 transitivePeerDependencies: @@ -3708,7 +3708,7 @@ packages: file-system-cache: 2.3.0 dev: true - /@sveltejs/package@2.2.0(svelte@4.0.0)(typescript@5.1.6): + /@sveltejs/package@2.2.0(svelte@3.55.0)(typescript@5.1.6): resolution: {integrity: sha512-TXbrzsk+T5WNcSzrU41D8P32vU5guo96lVS11/R+rpLhZBH5sORh0Qp6r68Jg4O5vcdS3JLwpwcpe8VFbT/QeA==} engines: {node: ^16.14 || >=18} hasBin: true @@ -3719,13 +3719,13 @@ packages: kleur: 4.1.5 sade: 1.8.1 semver: 7.5.4 - svelte: 4.0.0 - svelte2tsx: 0.6.19(svelte@4.0.0)(typescript@5.1.6) + svelte: 3.55.0 + svelte2tsx: 0.6.19(svelte@3.55.0)(typescript@5.1.6) transitivePeerDependencies: - typescript dev: true - /@sveltejs/vite-plugin-svelte-inspector@1.0.3(@sveltejs/vite-plugin-svelte@2.4.2)(svelte@4.0.0)(vite@4.4.3): + /@sveltejs/vite-plugin-svelte-inspector@1.0.3(@sveltejs/vite-plugin-svelte@2.4.2)(svelte@3.55.0)(vite@4.4.3): resolution: {integrity: sha512-Khdl5jmmPN6SUsVuqSXatKpQTMIifoQPDanaxC84m9JxIibWvSABJyHpyys0Z+1yYrxY5TTEQm+6elh0XCMaOA==} engines: {node: ^14.18.0 || >= 16} peerDependencies: @@ -3733,28 +3733,28 @@ packages: svelte: ^3.54.0 || ^4.0.0 vite: ^4.0.0 dependencies: - '@sveltejs/vite-plugin-svelte': 2.4.2(svelte@4.0.0)(vite@4.4.3) + '@sveltejs/vite-plugin-svelte': 2.4.2(svelte@3.55.0)(vite@4.4.3) debug: 4.3.4 - svelte: 4.0.0 + svelte: 3.55.0 vite: 4.4.3(@types/node@20.4.5) transitivePeerDependencies: - supports-color dev: true - /@sveltejs/vite-plugin-svelte@2.4.2(svelte@4.0.0)(vite@4.4.3): + /@sveltejs/vite-plugin-svelte@2.4.2(svelte@3.55.0)(vite@4.4.3): resolution: {integrity: sha512-ePfcC48ftMKhkT0OFGdOyycYKnnkT6i/buzey+vHRTR/JpQvuPzzhf1PtKqCDQfJRgoPSN2vscXs6gLigx/zGw==} engines: {node: ^14.18.0 || >= 16} peerDependencies: svelte: ^3.54.0 || ^4.0.0 vite: ^4.0.0 dependencies: - '@sveltejs/vite-plugin-svelte-inspector': 1.0.3(@sveltejs/vite-plugin-svelte@2.4.2)(svelte@4.0.0)(vite@4.4.3) + '@sveltejs/vite-plugin-svelte-inspector': 1.0.3(@sveltejs/vite-plugin-svelte@2.4.2)(svelte@3.55.0)(vite@4.4.3) debug: 4.3.4 deepmerge: 4.3.1 kleur: 4.1.5 magic-string: 0.30.1 - svelte: 4.0.0 - svelte-hmr: 0.15.2(svelte@4.0.0) + svelte: 3.55.0 + svelte-hmr: 0.15.2(svelte@3.55.0) vite: 4.4.3(@types/node@20.4.5) vitefu: 0.2.4(vite@4.4.3) transitivePeerDependencies: @@ -5421,16 +5421,6 @@ packages: engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} dev: true - /code-red@1.0.4: - resolution: {integrity: sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==} - dependencies: - '@jridgewell/sourcemap-codec': 1.4.15 - '@types/estree': 1.0.1 - acorn: 8.10.0 - estree-walker: 3.0.3 - periscopic: 3.1.0 - dev: true - /collapse-white-space@1.0.6: resolution: {integrity: sha512-jEovNnrhMuqyCcjfEJA56v0Xq8SkIoPKDyaHahwo3POf4qcSXqMYuwNcOTzp74vTsR9Tn08z4MxWqAhcekogkQ==} dev: true @@ -5661,14 +5651,6 @@ packages: engines: {node: '>=8'} dev: true - /css-tree@2.3.1: - resolution: {integrity: sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==} - engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0} - dependencies: - mdn-data: 2.0.30 - source-map-js: 1.0.2 - dev: true - /css.escape@1.5.1: resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==} dev: true @@ -6841,12 +6823,6 @@ packages: engines: {node: '>=4.0'} dev: true - /estree-walker@3.0.3: - resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} - dependencies: - '@types/estree': 1.0.1 - dev: true - /esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} @@ -8027,12 +8003,6 @@ packages: resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} dev: true - /is-reference@3.0.1: - resolution: {integrity: sha512-baJJdQLiYaJdvFbJqXrcGv3WU3QCzBlUcI5QhbesIm6/xPsvmO+2CDoi/GMOFBQEQm+PXkwOPrp9KK5ozZsp2w==} - dependencies: - '@types/estree': 1.0.1 - dev: true - /is-regex@1.1.4: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} engines: {node: '>= 0.4'} @@ -9393,10 +9363,6 @@ packages: engines: {node: '>=14'} dev: true - /locate-character@3.0.0: - resolution: {integrity: sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==} - dev: true - /locate-path@2.0.0: resolution: {integrity: sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==} engines: {node: '>=4'} @@ -9619,10 +9585,6 @@ packages: resolution: {integrity: sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==} dev: true - /mdn-data@2.0.30: - resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==} - dev: true - /meant@1.0.3: resolution: {integrity: sha512-88ZRGcNxAq4EH38cQ4D85PM57pikCwS8Z99EWHODxN7KBY+UuPiqzRTtZzS8KTXO/ywSWbdjjJST2Hly/EQxLw==} dev: true @@ -10336,14 +10298,6 @@ packages: resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==} dev: true - /periscopic@3.1.0: - resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==} - dependencies: - '@types/estree': 1.0.1 - estree-walker: 3.0.3 - is-reference: 3.0.1 - dev: true - /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} dev: true @@ -11812,7 +11766,7 @@ packages: engines: {node: '>= 0.4'} dev: true - /svelte-check@3.5.0(@babel/core@7.22.9)(svelte@4.0.0): + /svelte-check@3.5.0(@babel/core@7.22.9)(svelte@3.55.0): resolution: {integrity: sha512-KHujbn4k17xKYLmtCwv0sKKM7uiHTYcQvXnvrCcNU6a7hcszh99zFTIoiu/Sp/ewAw5aJmillJ1Cs8gKLmcX4A==} hasBin: true peerDependencies: @@ -11824,8 +11778,8 @@ packages: import-fresh: 3.3.0 picocolors: 1.0.0 sade: 1.8.1 - svelte: 4.0.0 - svelte-preprocess: 5.0.4(@babel/core@7.22.9)(svelte@4.0.0)(typescript@5.1.6) + svelte: 3.55.0 + svelte-preprocess: 5.0.4(@babel/core@7.22.9)(svelte@3.55.0)(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: - '@babel/core' @@ -11843,25 +11797,25 @@ packages: resolution: {integrity: sha512-oU+Xv7Dl4kRU2kdFjsoPLfJfnt5hUhsFUZtuzI3Ku/f2iAFZqBoEuXOqK3N9ngD4dxQOmN4OKWPHVi3NeAeAfQ==} dev: true - /svelte-hmr@0.14.12(svelte@4.0.0): + /svelte-hmr@0.14.12(svelte@3.55.0): resolution: {integrity: sha512-4QSW/VvXuqVcFZ+RhxiR8/newmwOCTlbYIezvkeN6302YFRE8cXy0naamHcjz8Y9Ce3ITTZtrHrIL0AGfyo61w==} engines: {node: ^12.20 || ^14.13.1 || >= 16} peerDependencies: svelte: '>=3.19.0' dependencies: - svelte: 4.0.0 + svelte: 3.55.0 dev: true - /svelte-hmr@0.15.2(svelte@4.0.0): + /svelte-hmr@0.15.2(svelte@3.55.0): resolution: {integrity: sha512-q/bAruCvFLwvNbeE1x3n37TYFb3mTBJ6TrCq6p2CoFbSTNhDE9oAtEfpy+wmc9So8AG0Tja+X0/mJzX9tSfvIg==} engines: {node: ^12.20 || ^14.13.1 || >= 16} peerDependencies: svelte: ^3.19.0 || ^4.0.0-next.0 dependencies: - svelte: 4.0.0 + svelte: 3.55.0 dev: true - /svelte-jester@2.3.2(jest@29.6.2)(svelte@4.0.0): + /svelte-jester@2.3.2(jest@29.6.2)(svelte@3.55.0): resolution: {integrity: sha512-JtxSz4FWAaCRBXbPsh4LcDs4Ua7zdXgLC0TZvT1R56hRV0dymmNP+abw67DTPF7sQPyNxWsOKd0Sl7Q8SnP8kg==} engines: {node: '>=14'} peerDependencies: @@ -11869,21 +11823,21 @@ packages: svelte: '>= 3' dependencies: jest: 29.6.2(@types/node@20.4.5) - svelte: 4.0.0 + svelte: 3.55.0 dev: true - /svelte-loader@3.1.7(svelte@4.0.0): + /svelte-loader@3.1.7(svelte@3.55.0): resolution: {integrity: sha512-YVg5gQaUdV26uaA5SEGj1VOUX0YQicD9PezKvVlkQ2JI644silWtJZ3hkxHtXSfjnlFr0OTNoyOgeINIODdT+A==} peerDependencies: svelte: '>3.0.0' dependencies: loader-utils: 2.0.4 - svelte: 4.0.0 + svelte: 3.55.0 svelte-dev-helper: 1.1.9 - svelte-hmr: 0.14.12(svelte@4.0.0) + svelte-hmr: 0.14.12(svelte@3.55.0) dev: true - /svelte-preprocess@5.0.4(@babel/core@7.22.9)(svelte@4.0.0)(typescript@5.1.6): + /svelte-preprocess@5.0.4(@babel/core@7.22.9)(svelte@3.55.0)(typescript@5.1.6): resolution: {integrity: sha512-ABia2QegosxOGsVlsSBJvoWeXy1wUKSfF7SWJdTjLAbx/Y3SrVevvvbFNQqrSJw89+lNSsM58SipmZJ5SRi5iw==} engines: {node: '>= 14.10.0'} requiresBuild: true @@ -11927,11 +11881,11 @@ packages: magic-string: 0.27.0 sorcery: 0.11.0 strip-indent: 3.0.0 - svelte: 4.0.0 + svelte: 3.55.0 typescript: 5.1.6 dev: true - /svelte2tsx@0.6.19(svelte@4.0.0)(typescript@5.1.6): + /svelte2tsx@0.6.19(svelte@3.55.0)(typescript@5.1.6): resolution: {integrity: sha512-h3b5OtcO8zyVL/RiB2zsDwCopeo/UH+887uyhgb2mjnewOFwiTxu+4IGuVwrrlyuh2onM2ktfUemNrNmQwXONQ==} peerDependencies: svelte: ^3.55 || ^4.0.0-next.0 || ^4.0 @@ -11939,27 +11893,13 @@ packages: dependencies: dedent-js: 1.0.1 pascal-case: 3.1.2 - svelte: 4.0.0 + svelte: 3.55.0 typescript: 5.1.6 dev: true - /svelte@4.0.0: - resolution: {integrity: sha512-+yCYu3AEUu9n91dnQNGIbnVp8EmNQtuF/YImW4+FTXRHard7NMo+yTsWzggPAbj3fUEJ1FBJLkql/jkp6YB5pg==} - engines: {node: '>=16'} - dependencies: - '@ampproject/remapping': 2.2.1 - '@jridgewell/sourcemap-codec': 1.4.15 - '@jridgewell/trace-mapping': 0.3.18 - acorn: 8.10.0 - aria-query: 5.3.0 - axobject-query: 3.2.1 - code-red: 1.0.4 - css-tree: 2.3.1 - estree-walker: 3.0.3 - is-reference: 3.0.1 - locate-character: 3.0.0 - magic-string: 0.30.1 - periscopic: 3.1.0 + /svelte@3.55.0: + resolution: {integrity: sha512-uGu2FVMlOuey4JoKHKrpZFkoYyj0VLjJdz47zX5+gVK5odxHM40RVhar9/iK2YFRVxvfg9FkhfVlR0sjeIrOiA==} + engines: {node: '>= 8'} dev: true /sveltedoc-parser@4.2.1: From 893640b68d07f19de82fd6fc9ed07c1a048853f5 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Thu, 24 Aug 2023 09:35:35 +0200 Subject: [PATCH 03/61] revert type changes to work with Svelte v3 --- src/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index 141b790..dee1e19 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -1,4 +1,4 @@ -import type { SvelteComponent } from 'svelte' +import type { SvelteComponentTyped, SvelteComponent } from 'svelte'; import type { Addon_BaseMeta as BaseMeta, Addon_BaseAnnotations as BaseAnnotations, StoryContext, WebRenderer } from '@storybook/types'; @@ -54,14 +54,14 @@ interface Slots { /** * Meta. */ -export class Meta extends SvelteComponent & BaseAnnotations> { } +export class Meta extends SvelteComponentTyped & BaseAnnotations> { } /** * Story. */ -export class Story extends SvelteComponent { } +export class Story extends SvelteComponentTyped { } /** * Template. * * Allow to reuse definition between stories. */ -export class Template extends SvelteComponent { } +export class Template extends SvelteComponentTyped { } From e63c4ae6bb03a826316f63617b58bbe88eff4a8c Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Thu, 24 Aug 2023 09:44:56 +0200 Subject: [PATCH 04/61] require svelte@4, vite-plugin-svelte@2, vite@4 --- package.json | 8 +-- pnpm-lock.yaml | 148 ++++++++++++++++++++++++++++++++++--------------- src/index.d.ts | 8 +-- 3 files changed, 112 insertions(+), 52 deletions(-) diff --git a/package.json b/package.json index 604737d..2ad6ad0 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "react-dom": "^18.2.0", "rimraf": "^3.0.2", "storybook": "^7.1.1", - "svelte": "^3.55.0", + "svelte": "^4.0.0", "svelte-check": "^3.5.0", "svelte-jester": "^2.3.2", "svelte-loader": "^3.1.7", @@ -99,10 +99,10 @@ "peerDependencies": { "@storybook/svelte": "^7.0.0", "@storybook/theming": "^7.0.0", - "@sveltejs/vite-plugin-svelte": "^1.0.0 || ^2.0.0", - "svelte": "^3.50.0", + "@sveltejs/vite-plugin-svelte": "^2.0.0", + "svelte": "^4.0.0", "svelte-loader": "^3.1.2", - "vite": "^3.0.0 || ^4.0.0" + "vite": "^4.0.0" }, "peerDependenciesMeta": { "@sveltejs/vite-plugin-svelte": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 70b232b..84ef3b5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -63,10 +63,10 @@ devDependencies: version: 7.1.1 '@storybook/svelte': specifier: ^7.1.1 - version: 7.1.1(svelte@3.55.0) + version: 7.1.1(svelte@4.0.0) '@storybook/svelte-vite': specifier: ^7.1.1 - version: 7.1.1(svelte@3.55.0)(typescript@5.1.6)(vite@4.4.3) + version: 7.1.1(svelte@4.0.0)(typescript@5.1.6)(vite@4.4.3) '@storybook/test-runner': specifier: ^0.11.0 version: 0.11.0(@types/node@20.4.5) @@ -78,10 +78,10 @@ devDependencies: version: 7.1.1 '@sveltejs/package': specifier: ^2.2.0 - version: 2.2.0(svelte@3.55.0)(typescript@5.1.6) + version: 2.2.0(svelte@4.0.0)(typescript@5.1.6) '@sveltejs/vite-plugin-svelte': specifier: ^2.4.2 - version: 2.4.2(svelte@3.55.0)(vite@4.4.3) + version: 2.4.2(svelte@4.0.0)(vite@4.4.3) '@tsconfig/svelte': specifier: ^5.0.0 version: 5.0.0 @@ -122,17 +122,17 @@ devDependencies: specifier: ^7.1.1 version: 7.1.1 svelte: - specifier: ^3.55.0 - version: 3.55.0 + specifier: ^4.0.0 + version: 4.0.0 svelte-check: specifier: ^3.5.0 - version: 3.5.0(@babel/core@7.22.9)(svelte@3.55.0) + version: 3.5.0(@babel/core@7.22.9)(svelte@4.0.0) svelte-jester: specifier: ^2.3.2 - version: 2.3.2(jest@29.6.2)(svelte@3.55.0) + version: 2.3.2(jest@29.6.2)(svelte@4.0.0) svelte-loader: specifier: ^3.1.7 - version: 3.1.7(svelte@3.55.0) + version: 3.1.7(svelte@4.0.0) typescript: specifier: ^5.1.6 version: 5.1.6 @@ -3561,7 +3561,7 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: true - /@storybook/svelte-vite@7.1.1(svelte@3.55.0)(typescript@5.1.6)(vite@4.4.3): + /@storybook/svelte-vite@7.1.1(svelte@4.0.0)(typescript@5.1.6)(vite@4.4.3): resolution: {integrity: sha512-0GyqGDUh/szuCyUZ++X93qND5w45mv83pdgtQQZlTImQcW/NZxPWB1i6B5bBxPgSkIXvaOuW8JpjC21YGFGRcg==} engines: {node: ^14.18 || >=16} peerDependencies: @@ -3570,10 +3570,10 @@ packages: dependencies: '@storybook/builder-vite': 7.1.1(typescript@5.1.6)(vite@4.4.3) '@storybook/node-logger': 7.1.1 - '@storybook/svelte': 7.1.1(svelte@3.55.0) - '@sveltejs/vite-plugin-svelte': 2.4.2(svelte@3.55.0)(vite@4.4.3) + '@storybook/svelte': 7.1.1(svelte@4.0.0) + '@sveltejs/vite-plugin-svelte': 2.4.2(svelte@4.0.0)(vite@4.4.3) magic-string: 0.30.1 - svelte: 3.55.0 + svelte: 4.0.0 sveltedoc-parser: 4.2.1 ts-dedent: 2.2.0 vite: 4.4.3(@types/node@20.4.5) @@ -3585,7 +3585,7 @@ packages: - vite-plugin-glimmerx dev: true - /@storybook/svelte@7.1.1(svelte@3.55.0): + /@storybook/svelte@7.1.1(svelte@4.0.0): resolution: {integrity: sha512-mQLmJCYGxdHWKVEeKcaB1Y+BapH6vwyPOuQ0W3Fy1Pv0k0+/UO5sxS63ps2HsCjloYndLn8drwtx11HrM/G6zw==} engines: {node: '>=16.0.0'} peerDependencies: @@ -3598,7 +3598,7 @@ packages: '@storybook/global': 5.0.0 '@storybook/preview-api': 7.1.1 '@storybook/types': 7.1.1 - svelte: 3.55.0 + svelte: 4.0.0 sveltedoc-parser: 4.2.1 type-fest: 3.13.1 transitivePeerDependencies: @@ -3708,7 +3708,7 @@ packages: file-system-cache: 2.3.0 dev: true - /@sveltejs/package@2.2.0(svelte@3.55.0)(typescript@5.1.6): + /@sveltejs/package@2.2.0(svelte@4.0.0)(typescript@5.1.6): resolution: {integrity: sha512-TXbrzsk+T5WNcSzrU41D8P32vU5guo96lVS11/R+rpLhZBH5sORh0Qp6r68Jg4O5vcdS3JLwpwcpe8VFbT/QeA==} engines: {node: ^16.14 || >=18} hasBin: true @@ -3719,13 +3719,13 @@ packages: kleur: 4.1.5 sade: 1.8.1 semver: 7.5.4 - svelte: 3.55.0 - svelte2tsx: 0.6.19(svelte@3.55.0)(typescript@5.1.6) + svelte: 4.0.0 + svelte2tsx: 0.6.19(svelte@4.0.0)(typescript@5.1.6) transitivePeerDependencies: - typescript dev: true - /@sveltejs/vite-plugin-svelte-inspector@1.0.3(@sveltejs/vite-plugin-svelte@2.4.2)(svelte@3.55.0)(vite@4.4.3): + /@sveltejs/vite-plugin-svelte-inspector@1.0.3(@sveltejs/vite-plugin-svelte@2.4.2)(svelte@4.0.0)(vite@4.4.3): resolution: {integrity: sha512-Khdl5jmmPN6SUsVuqSXatKpQTMIifoQPDanaxC84m9JxIibWvSABJyHpyys0Z+1yYrxY5TTEQm+6elh0XCMaOA==} engines: {node: ^14.18.0 || >= 16} peerDependencies: @@ -3733,28 +3733,28 @@ packages: svelte: ^3.54.0 || ^4.0.0 vite: ^4.0.0 dependencies: - '@sveltejs/vite-plugin-svelte': 2.4.2(svelte@3.55.0)(vite@4.4.3) + '@sveltejs/vite-plugin-svelte': 2.4.2(svelte@4.0.0)(vite@4.4.3) debug: 4.3.4 - svelte: 3.55.0 + svelte: 4.0.0 vite: 4.4.3(@types/node@20.4.5) transitivePeerDependencies: - supports-color dev: true - /@sveltejs/vite-plugin-svelte@2.4.2(svelte@3.55.0)(vite@4.4.3): + /@sveltejs/vite-plugin-svelte@2.4.2(svelte@4.0.0)(vite@4.4.3): resolution: {integrity: sha512-ePfcC48ftMKhkT0OFGdOyycYKnnkT6i/buzey+vHRTR/JpQvuPzzhf1PtKqCDQfJRgoPSN2vscXs6gLigx/zGw==} engines: {node: ^14.18.0 || >= 16} peerDependencies: svelte: ^3.54.0 || ^4.0.0 vite: ^4.0.0 dependencies: - '@sveltejs/vite-plugin-svelte-inspector': 1.0.3(@sveltejs/vite-plugin-svelte@2.4.2)(svelte@3.55.0)(vite@4.4.3) + '@sveltejs/vite-plugin-svelte-inspector': 1.0.3(@sveltejs/vite-plugin-svelte@2.4.2)(svelte@4.0.0)(vite@4.4.3) debug: 4.3.4 deepmerge: 4.3.1 kleur: 4.1.5 magic-string: 0.30.1 - svelte: 3.55.0 - svelte-hmr: 0.15.2(svelte@3.55.0) + svelte: 4.0.0 + svelte-hmr: 0.15.2(svelte@4.0.0) vite: 4.4.3(@types/node@20.4.5) vitefu: 0.2.4(vite@4.4.3) transitivePeerDependencies: @@ -5421,6 +5421,16 @@ packages: engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} dev: true + /code-red@1.0.4: + resolution: {integrity: sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + '@types/estree': 1.0.1 + acorn: 8.10.0 + estree-walker: 3.0.3 + periscopic: 3.1.0 + dev: true + /collapse-white-space@1.0.6: resolution: {integrity: sha512-jEovNnrhMuqyCcjfEJA56v0Xq8SkIoPKDyaHahwo3POf4qcSXqMYuwNcOTzp74vTsR9Tn08z4MxWqAhcekogkQ==} dev: true @@ -5651,6 +5661,14 @@ packages: engines: {node: '>=8'} dev: true + /css-tree@2.3.1: + resolution: {integrity: sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==} + engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0} + dependencies: + mdn-data: 2.0.30 + source-map-js: 1.0.2 + dev: true + /css.escape@1.5.1: resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==} dev: true @@ -6823,6 +6841,12 @@ packages: engines: {node: '>=4.0'} dev: true + /estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + dependencies: + '@types/estree': 1.0.1 + dev: true + /esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} @@ -8003,6 +8027,12 @@ packages: resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} dev: true + /is-reference@3.0.1: + resolution: {integrity: sha512-baJJdQLiYaJdvFbJqXrcGv3WU3QCzBlUcI5QhbesIm6/xPsvmO+2CDoi/GMOFBQEQm+PXkwOPrp9KK5ozZsp2w==} + dependencies: + '@types/estree': 1.0.1 + dev: true + /is-regex@1.1.4: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} engines: {node: '>= 0.4'} @@ -9363,6 +9393,10 @@ packages: engines: {node: '>=14'} dev: true + /locate-character@3.0.0: + resolution: {integrity: sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==} + dev: true + /locate-path@2.0.0: resolution: {integrity: sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==} engines: {node: '>=4'} @@ -9585,6 +9619,10 @@ packages: resolution: {integrity: sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==} dev: true + /mdn-data@2.0.30: + resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==} + dev: true + /meant@1.0.3: resolution: {integrity: sha512-88ZRGcNxAq4EH38cQ4D85PM57pikCwS8Z99EWHODxN7KBY+UuPiqzRTtZzS8KTXO/ywSWbdjjJST2Hly/EQxLw==} dev: true @@ -10298,6 +10336,14 @@ packages: resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==} dev: true + /periscopic@3.1.0: + resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==} + dependencies: + '@types/estree': 1.0.1 + estree-walker: 3.0.3 + is-reference: 3.0.1 + dev: true + /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} dev: true @@ -11766,7 +11812,7 @@ packages: engines: {node: '>= 0.4'} dev: true - /svelte-check@3.5.0(@babel/core@7.22.9)(svelte@3.55.0): + /svelte-check@3.5.0(@babel/core@7.22.9)(svelte@4.0.0): resolution: {integrity: sha512-KHujbn4k17xKYLmtCwv0sKKM7uiHTYcQvXnvrCcNU6a7hcszh99zFTIoiu/Sp/ewAw5aJmillJ1Cs8gKLmcX4A==} hasBin: true peerDependencies: @@ -11778,8 +11824,8 @@ packages: import-fresh: 3.3.0 picocolors: 1.0.0 sade: 1.8.1 - svelte: 3.55.0 - svelte-preprocess: 5.0.4(@babel/core@7.22.9)(svelte@3.55.0)(typescript@5.1.6) + svelte: 4.0.0 + svelte-preprocess: 5.0.4(@babel/core@7.22.9)(svelte@4.0.0)(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: - '@babel/core' @@ -11797,25 +11843,25 @@ packages: resolution: {integrity: sha512-oU+Xv7Dl4kRU2kdFjsoPLfJfnt5hUhsFUZtuzI3Ku/f2iAFZqBoEuXOqK3N9ngD4dxQOmN4OKWPHVi3NeAeAfQ==} dev: true - /svelte-hmr@0.14.12(svelte@3.55.0): + /svelte-hmr@0.14.12(svelte@4.0.0): resolution: {integrity: sha512-4QSW/VvXuqVcFZ+RhxiR8/newmwOCTlbYIezvkeN6302YFRE8cXy0naamHcjz8Y9Ce3ITTZtrHrIL0AGfyo61w==} engines: {node: ^12.20 || ^14.13.1 || >= 16} peerDependencies: svelte: '>=3.19.0' dependencies: - svelte: 3.55.0 + svelte: 4.0.0 dev: true - /svelte-hmr@0.15.2(svelte@3.55.0): + /svelte-hmr@0.15.2(svelte@4.0.0): resolution: {integrity: sha512-q/bAruCvFLwvNbeE1x3n37TYFb3mTBJ6TrCq6p2CoFbSTNhDE9oAtEfpy+wmc9So8AG0Tja+X0/mJzX9tSfvIg==} engines: {node: ^12.20 || ^14.13.1 || >= 16} peerDependencies: svelte: ^3.19.0 || ^4.0.0-next.0 dependencies: - svelte: 3.55.0 + svelte: 4.0.0 dev: true - /svelte-jester@2.3.2(jest@29.6.2)(svelte@3.55.0): + /svelte-jester@2.3.2(jest@29.6.2)(svelte@4.0.0): resolution: {integrity: sha512-JtxSz4FWAaCRBXbPsh4LcDs4Ua7zdXgLC0TZvT1R56hRV0dymmNP+abw67DTPF7sQPyNxWsOKd0Sl7Q8SnP8kg==} engines: {node: '>=14'} peerDependencies: @@ -11823,21 +11869,21 @@ packages: svelte: '>= 3' dependencies: jest: 29.6.2(@types/node@20.4.5) - svelte: 3.55.0 + svelte: 4.0.0 dev: true - /svelte-loader@3.1.7(svelte@3.55.0): + /svelte-loader@3.1.7(svelte@4.0.0): resolution: {integrity: sha512-YVg5gQaUdV26uaA5SEGj1VOUX0YQicD9PezKvVlkQ2JI644silWtJZ3hkxHtXSfjnlFr0OTNoyOgeINIODdT+A==} peerDependencies: svelte: '>3.0.0' dependencies: loader-utils: 2.0.4 - svelte: 3.55.0 + svelte: 4.0.0 svelte-dev-helper: 1.1.9 - svelte-hmr: 0.14.12(svelte@3.55.0) + svelte-hmr: 0.14.12(svelte@4.0.0) dev: true - /svelte-preprocess@5.0.4(@babel/core@7.22.9)(svelte@3.55.0)(typescript@5.1.6): + /svelte-preprocess@5.0.4(@babel/core@7.22.9)(svelte@4.0.0)(typescript@5.1.6): resolution: {integrity: sha512-ABia2QegosxOGsVlsSBJvoWeXy1wUKSfF7SWJdTjLAbx/Y3SrVevvvbFNQqrSJw89+lNSsM58SipmZJ5SRi5iw==} engines: {node: '>= 14.10.0'} requiresBuild: true @@ -11881,11 +11927,11 @@ packages: magic-string: 0.27.0 sorcery: 0.11.0 strip-indent: 3.0.0 - svelte: 3.55.0 + svelte: 4.0.0 typescript: 5.1.6 dev: true - /svelte2tsx@0.6.19(svelte@3.55.0)(typescript@5.1.6): + /svelte2tsx@0.6.19(svelte@4.0.0)(typescript@5.1.6): resolution: {integrity: sha512-h3b5OtcO8zyVL/RiB2zsDwCopeo/UH+887uyhgb2mjnewOFwiTxu+4IGuVwrrlyuh2onM2ktfUemNrNmQwXONQ==} peerDependencies: svelte: ^3.55 || ^4.0.0-next.0 || ^4.0 @@ -11893,13 +11939,27 @@ packages: dependencies: dedent-js: 1.0.1 pascal-case: 3.1.2 - svelte: 3.55.0 + svelte: 4.0.0 typescript: 5.1.6 dev: true - /svelte@3.55.0: - resolution: {integrity: sha512-uGu2FVMlOuey4JoKHKrpZFkoYyj0VLjJdz47zX5+gVK5odxHM40RVhar9/iK2YFRVxvfg9FkhfVlR0sjeIrOiA==} - engines: {node: '>= 8'} + /svelte@4.0.0: + resolution: {integrity: sha512-+yCYu3AEUu9n91dnQNGIbnVp8EmNQtuF/YImW4+FTXRHard7NMo+yTsWzggPAbj3fUEJ1FBJLkql/jkp6YB5pg==} + engines: {node: '>=16'} + dependencies: + '@ampproject/remapping': 2.2.1 + '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/trace-mapping': 0.3.18 + acorn: 8.10.0 + aria-query: 5.3.0 + axobject-query: 3.2.1 + code-red: 1.0.4 + css-tree: 2.3.1 + estree-walker: 3.0.3 + is-reference: 3.0.1 + locate-character: 3.0.0 + magic-string: 0.30.1 + periscopic: 3.1.0 dev: true /sveltedoc-parser@4.2.1: diff --git a/src/index.d.ts b/src/index.d.ts index dee1e19..141b790 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -1,4 +1,4 @@ -import type { SvelteComponentTyped, SvelteComponent } from 'svelte'; +import type { SvelteComponent } from 'svelte' import type { Addon_BaseMeta as BaseMeta, Addon_BaseAnnotations as BaseAnnotations, StoryContext, WebRenderer } from '@storybook/types'; @@ -54,14 +54,14 @@ interface Slots { /** * Meta. */ -export class Meta extends SvelteComponentTyped & BaseAnnotations> { } +export class Meta extends SvelteComponent & BaseAnnotations> { } /** * Story. */ -export class Story extends SvelteComponentTyped { } +export class Story extends SvelteComponent { } /** * Template. * * Allow to reuse definition between stories. */ -export class Template extends SvelteComponentTyped { } +export class Template extends SvelteComponent { } From 88578b7ea12b732ff70e6a2fceba3f532c47314f Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Thu, 24 Aug 2023 09:56:44 +0200 Subject: [PATCH 05/61] add version dependencies section to readme --- README.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0322b43..4c3594c 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ It supports: ``` -# Getting Started +## Getting Started 1. `npm install --save-dev @storybook/addon-svelte-csf` or `yarn add --dev @storybook/addon-svelte-csf` 2. In `.storybook/main.js`, add `@storybook/addon-svelte-csf` to the addons array @@ -64,5 +64,21 @@ module.exports = { }; ``` -> **Warning** -> v3 and above of this addon requires at least Storybook v7. If you're using Storybook between v6.4.20 and v7.0.0, you should instead use v2 of this addon with `npm install --save-dev @storybook/addon-svelte-csf@^2.0.10` or `yarn add --dev @storybook/addon-svelte-csf@^2.0.10` +## Version Dependencies + +### 4.0.0 + +Version 4 of this addon requires _at least_: + +- Storybook v7 +- Svelte v4 +- Vite v4 (if using Vite) +- `@sveltejs/vite-plugin-svelte` v2 (if using Vite) + +If you're using Svelte v3 you can use version `^3.0.0` of this addon instead. + +### 3.0.0 + +Version 3 of this addon requires at least Storybook v7. + +If you're using Storybook between v6.4.20 and v7.0.0, you should instead use version `^2.0.0` of this addon. From 79082f2dd5cc2c6e4d9572fd901654d3005ab039 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 29 Aug 2023 07:24:13 +0000 Subject: [PATCH 06/61] Update CHANGELOG.md [skip ci] --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06c50bf..89740ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# v3.0.10 (Tue Aug 29 2023) + +#### 🐛 Bug Fix + +- Fix: `typeof Meta` in Svelte v3 (Pin Svelte peer dependency to v3) [#127](https://github.com/storybookjs/addon-svelte-csf/pull/127) ([@JReinhold](https://github.com/JReinhold)) + +#### Authors: 1 + +- Jeppe Reinhold ([@JReinhold](https://github.com/JReinhold)) + +--- + # v3.0.9 (Wed Aug 23 2023) #### 🐛 Bug Fix From 60e0353809dce1a5f9418eb440392d44442e2b37 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 29 Aug 2023 07:24:14 +0000 Subject: [PATCH 07/61] Bump version to: 3.0.10 [skip ci] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 604737d..2658d23 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-svelte-csf", - "version": "3.0.9", + "version": "3.0.10", "description": "Allows to write stories in Svelte syntax", "keywords": [ "storybook-addons", From 0d6a614aac2649c8dd58781140ed42c211256579 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 29 Aug 2023 08:39:32 +0000 Subject: [PATCH 08/61] Update CHANGELOG.md [skip ci] --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89740ab..2ea4300 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# v4.0.0 (Tue Aug 29 2023) + +#### 💥 Breaking Change + +- Require Svelte v4, vite-plugin-svelte v2, Vite v4 [#128](https://github.com/storybookjs/addon-svelte-csf/pull/128) ([@JReinhold](https://github.com/JReinhold)) + +#### Authors: 1 + +- Jeppe Reinhold ([@JReinhold](https://github.com/JReinhold)) + +--- + # v3.0.10 (Tue Aug 29 2023) #### 🐛 Bug Fix From c68b02cb9279b9ea8dba67eb8dbd3a1cb615896a Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 29 Aug 2023 08:39:33 +0000 Subject: [PATCH 09/61] Bump version to: 4.0.0 [skip ci] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f273958..c568d6e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-svelte-csf", - "version": "3.0.10", + "version": "4.0.0", "description": "Allows to write stories in Svelte syntax", "keywords": [ "storybook-addons", From 40335c99822ea676c5612f4d8d71b7589d98f10d Mon Sep 17 00:00:00 2001 From: j3rem1e Date: Wed, 30 Aug 2023 21:01:06 +0200 Subject: [PATCH 10/61] Fix svelte-stories-loader in Windows --- src/parser/svelte-stories-loader.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/parser/svelte-stories-loader.ts b/src/parser/svelte-stories-loader.ts index 08eb511..7b31ad0 100644 --- a/src/parser/svelte-stories-loader.ts +++ b/src/parser/svelte-stories-loader.ts @@ -1,10 +1,9 @@ -import dedent from 'dedent'; import { extractStories } from './extract-stories.js'; import { fileURLToPath } from 'url'; import { readFileSync } from 'fs'; const parser = fileURLToPath(new URL('./collect-stories.js', import.meta.url)) - .replace(/\\/g, "\\\\"); // For Windows paths; + .replace(/\\/g, '/'); // For Windows paths; // From https://github.com/sveltejs/svelte/blob/8db3e8d0297e052556f0b6dde310ef6e197b8d18/src/compiler/compile/utils/get_name_from_filename.ts // Copied because it is not exported from the compiler @@ -57,9 +56,7 @@ function transformSvelteStories(code: string) { const codeWithoutDefaultExport = code.replace('export default ', '//export default'); - // throws dedent expression is not callable. - // @ts-ignore - return dedent`${codeWithoutDefaultExport} + return `${codeWithoutDefaultExport} const { default: parser } = require('${parser}'); const __storiesMetaData = parser(${componentName}, ${JSON.stringify(storiesDef)}); export default __storiesMetaData.meta; From dbfae8d1f8dc530e84b6f91ab4fb4b24bf161c22 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Thu, 31 Aug 2023 14:32:24 +0000 Subject: [PATCH 11/61] Update CHANGELOG.md [skip ci] --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ea4300..5ded3d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# v4.0.1 (Thu Aug 31 2023) + +#### 🐛 Bug Fix + +- Fix svelte-stories-loader in Windows [#133](https://github.com/storybookjs/addon-svelte-csf/pull/133) ([@j3rem1e](https://github.com/j3rem1e)) + +#### Authors: 1 + +- Jérémie ([@j3rem1e](https://github.com/j3rem1e)) + +--- + # v4.0.0 (Tue Aug 29 2023) #### 💥 Breaking Change From 45fcc3384315db375452fce87f932fbd84b5e2b8 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Thu, 31 Aug 2023 14:32:25 +0000 Subject: [PATCH 12/61] Bump version to: 4.0.1 [skip ci] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c568d6e..fb1af53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/addon-svelte-csf", - "version": "4.0.0", + "version": "4.0.1", "description": "Allows to write stories in Svelte syntax", "keywords": [ "storybook-addons", From d3474f9b122fdaaa4944944fc1d31b80e13b11fc Mon Sep 17 00:00:00 2001 From: j3rem1e Date: Sat, 2 Sep 2023 10:00:29 +0200 Subject: [PATCH 13/61] [Bug] titlePrefix in advanced story specifiers causes the story to crash with "Didn't find 'xyz' in CSF file" --- .storybook/main.ts | 8 +++++--- src/parser/extract-stories.ts | 4 ---- src/preset/indexer.ts | 7 ++++--- stories/button.stories.svelte | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.storybook/main.ts b/.storybook/main.ts index b485723..43fb3c1 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -2,9 +2,11 @@ import type { StorybookConfig } from '@storybook/svelte-vite'; const config: StorybookConfig = { framework: '@storybook/svelte-vite', - stories: [ - '../stories/**/*.stories.svelte', - ], + stories: [{ + directory: '../stories', + files:'**/*.stories.svelte', + titlePrefix:'Demo' + }], addons: [ '../dist/preset/index.js', '@storybook/addon-essentials', diff --git a/src/parser/extract-stories.ts b/src/parser/extract-stories.ts index 9f7c57f..e72e479 100644 --- a/src/parser/extract-stories.ts +++ b/src/parser/extract-stories.ts @@ -1,13 +1,10 @@ import * as svelte from 'svelte/compiler'; import type { Node } from 'estree'; -import { storyNameFromExport, toId } from '@storybook/csf'; - import dedent from 'dedent'; import { extractId } from './extract-id.js'; interface StoryDef { - storyId: string; name: string; template: boolean; source: string; @@ -131,7 +128,6 @@ export function extractStories(component: string): StoriesDef { source = dedent`${component.substr(start, end - start)}`; } stories[isTemplate ? `tpl:${id}` : id] = { - storyId: toId(meta.id || meta.title || id, storyNameFromExport(id)), name, template: isTemplate, source, diff --git a/src/preset/indexer.ts b/src/preset/indexer.ts index 4dcdc4b..57beb16 100644 --- a/src/preset/indexer.ts +++ b/src/preset/indexer.ts @@ -3,6 +3,7 @@ import * as svelte from 'svelte/compiler'; import { extractStories } from '../parser/extract-stories.js'; import fs from 'fs-extra'; import { loadSvelteConfig } from '../config-loader.js'; +import { storyNameFromExport, toId } from '@storybook/csf'; export async function svelteIndexer(fileName, { makeTitle }) { let code = (await fs.readFile(fileName, 'utf-8')).toString(); @@ -13,13 +14,13 @@ export async function svelteIndexer(fileName, { makeTitle }) { } const defs = extractStories(code); - + const meta = { ...defs.meta, title: makeTitle(defs.meta.title) }; return { - meta: { title: makeTitle(defs.meta.title) }, + meta, stories: Object.entries(defs.stories) .filter(([id, story]) => !story.template) .map(([id, story]) => ({ - id: story.storyId, + id: toId(meta.id || meta.title || id, storyNameFromExport(id)), name: story.name, })), }; diff --git a/stories/button.stories.svelte b/stories/button.stories.svelte index bf204bd..8c5cbdc 100644 --- a/stories/button.stories.svelte +++ b/stories/button.stories.svelte @@ -9,7 +9,7 @@ } - +