Vite + Svelte
13 | 14 |19 | Check out SvelteKit, the official Svelte app framework powered by Vite! 20 |
21 | 22 |23 | Click on the Vite and Svelte logos to learn more 24 |
25 |├── .editorconfig ├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ └── ci.yml ├── .gitignore ├── .vscode ├── extensions.json └── settings.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── RELEASE.md ├── TODO.md ├── _svelte.config.cjs ├── e2e ├── README.md ├── init-svelte-4.sh ├── init-svelte.sh ├── svelte-3 │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── public │ │ ├── favicon.png │ │ ├── global.css │ │ └── index.html │ ├── rollup.config.js │ ├── scripts │ │ └── setupTypeScript.js │ ├── src │ │ ├── App.svelte │ │ ├── Comp.svelte │ │ ├── main.js │ │ └── test │ │ │ └── Comp.spec.js │ └── svelte.config.js ├── svelte-4 │ ├── .gitignore │ ├── .npmrc │ ├── .vscode │ │ └── extensions.json │ ├── README.md │ ├── index.html │ ├── jsconfig.json │ ├── package-lock.json │ ├── package.json │ ├── public │ │ └── vite.svg │ ├── src │ │ ├── App.svelte │ │ ├── app.css │ │ ├── assets │ │ │ └── svelte.svg │ │ ├── lib │ │ │ └── Counter.svelte │ │ ├── main.js │ │ ├── test │ │ │ └── Comp.spec.js │ │ └── vite-env.d.ts │ ├── svelte.config.js │ └── vite.config.js ├── svelte-5 │ ├── .npmrc │ ├── package.json │ ├── src │ │ ├── legacy.svelte │ │ ├── legacy.test.js │ │ ├── modern.svelte │ │ ├── modern.test.js │ │ ├── module.svelte.js │ │ └── module.test.js │ └── svelte.config.js └── sveltekit │ ├── .babelrc │ ├── .gitignore │ ├── .npmrc │ ├── README.md │ ├── jest.config.json │ ├── package.json │ ├── src │ ├── app.d.ts │ ├── app.html │ ├── lib │ │ └── images │ │ │ ├── github.svg │ │ │ ├── svelte-logo.svg │ │ │ ├── svelte-welcome.png │ │ │ └── svelte-welcome.webp │ └── routes │ │ ├── +layout.svelte │ │ ├── +page.svelte │ │ ├── +page.ts │ │ ├── Counter.svelte │ │ ├── Header.svelte │ │ ├── about │ │ ├── +page.svelte │ │ └── +page.ts │ │ ├── index-dom.spec.ts │ │ ├── styles.css │ │ └── sverdle │ │ ├── +page.server.ts │ │ ├── +page.svelte │ │ ├── game.ts │ │ ├── how-to-play │ │ ├── +page.svelte │ │ └── +page.ts │ │ ├── reduced-motion.ts │ │ └── words.server.ts │ ├── static │ ├── favicon.png │ └── robots.txt │ ├── svelte.config.js │ ├── tsconfig.json │ ├── tsconfig.spec.json │ └── vite.config.ts ├── jest.config.js ├── package.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── rollup.config.cjs ├── src ├── __tests__ │ ├── fixtures │ │ ├── BasicComp.svelte │ │ ├── SassComp.svelte │ │ ├── TypescriptComp.svelte │ │ ├── svelte.config.cjs │ │ └── sveltekit.config.js │ ├── transformer.test.cjs │ └── transformer.test.js ├── preprocess.js ├── svelteconfig.js ├── transformer.js └── utils.js └── svelte.config.cjs /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | 10 | [*.md] 11 | max_line_length = off 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.{js,ts} text eol=lf 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "npm" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | 9 | jobs: 10 | Tests: 11 | runs-on: ${{ matrix.os }} 12 | strategy: 13 | matrix: 14 | node-version: [18, 20, 22] 15 | os: [ubuntu-latest, windows-latest, macOS-latest] 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: pnpm/action-setup@v4 20 | - uses: actions/setup-node@v4 21 | with: 22 | node-version: ${{ matrix.node-version }} 23 | cache: pnpm 24 | 25 | - run: pnpm install 26 | 27 | - run: pnpm test 28 | env: 29 | CI: true 30 | 31 | - run: pnpm run e2e 32 | env: 33 | CI: true 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | dist 4 | .opt-in 5 | .opt-out 6 | .DS_Store 7 | .eslintcache 8 | .idea 9 | yarn-error.log 10 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "editorconfig.editorconfig", 4 | "standard.vscode-standard", 5 | "svelte.svelte-vscode" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "standard.autoFixOnSave": true, 3 | 4 | // SVELTE 5 | "[svelte]": { 6 | "editor.defaultFormatter": "svelte.svelte-vscode" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 4 | 5 | ## [5.0.0](https://github.com/svelteness/svelte-jester/compare/v5.1.0...v5.0.0) (2024-06-14) 6 | 7 | ## [5.1.0](https://github.com/svelteness/svelte-jester/compare/v3.0.0...v5.1.0) (2024-06-14) 8 | 9 | 10 | ### Features 11 | 12 | * add $state rune to globals ([586a6d8](https://github.com/svelteness/svelte-jester/commit/586a6d84948cfb43ffd76264bcb4310a580f7d6f)) 13 | * add coverage ([e6679d0](https://github.com/svelteness/svelte-jester/commit/e6679d0931fe7102a4f9f8c5a8917bdae27e7dcc)) 14 | * add e2e test for svelte 4 ([80941b6](https://github.com/svelteness/svelte-jester/commit/80941b64e4a3ac9dfb6d49612e879660936929fe)) 15 | * add jest-dom ([5f1d5f5](https://github.com/svelteness/svelte-jester/commit/5f1d5f53eb2a34ae21d8f3a367ae0973568f9d48)) 16 | * add RELEASE documentation ([c69d0e9](https://github.com/svelteness/svelte-jester/commit/c69d0e9dc3c7069005c539892ccd2f9e4abed049)) 17 | * add svelte4 test project ([d9f4f2c](https://github.com/svelteness/svelte-jester/commit/d9f4f2cc0977f893d0ec0775b6628158c48325a6)) 18 | * add test case ([109a0b4](https://github.com/svelteness/svelte-jester/commit/109a0b414cdefa642be89db3ea111ef58fc695fc)) 19 | * add test dependencies ([08f2821](https://github.com/svelteness/svelte-jester/commit/08f282150c654cc4f099f421cf161e4fbd4245ce)) 20 | * add test dependencies, setup and scripts ([71076e5](https://github.com/svelteness/svelte-jester/commit/71076e559d18e5ee2a8fd1c7e55cf263d4cea06d)) 21 | * enable import ([f9a947d](https://github.com/svelteness/svelte-jester/commit/f9a947d18255ef4cbe36239e936f705908d32cc2)) 22 | * lock version to 3 ([c9839cd](https://github.com/svelteness/svelte-jester/commit/c9839cde1572480385026b975564a0fc137c1d0b)) 23 | * rename svelte test folder to svelte-3 ([25709ca](https://github.com/svelteness/svelte-jester/commit/25709ca9553b6ef61e3bd4457d5c1772ca0bf2ad)) 24 | * replace cross-env with pnpm shell emulation ([25afa84](https://github.com/svelteness/svelte-jester/commit/25afa847d1d9fb1dd8554fde64a1196f099db634)) 25 | * run e2e tests during validation ([9a1cb23](https://github.com/svelteness/svelte-jester/commit/9a1cb2366211e3f8a006029dcf1aa5cb95c133ca)) 26 | * set version to 5.0.0 ([44d54c0](https://github.com/svelteness/svelte-jester/commit/44d54c07985ab7707e7d4528ad83694e44757732)) 27 | * **svelte5:** add support for Svelte 5 modules ([ed57c66](https://github.com/svelteness/svelte-jester/commit/ed57c66bb5d7cdeff838ef08a91c730b528e7dfd)) 28 | * test only supported engines ([3f77257](https://github.com/svelteness/svelte-jester/commit/3f77257ccd4fcc73aa6c760d66f38a6bbbe825f8)) 29 | 30 | 31 | ### Bug Fixes 32 | 33 | * add npmrc with shell emulation for all e2e folders ([fc3f525](https://github.com/svelteness/svelte-jester/commit/fc3f525768d92b1e8d13b0182ed90bccdf91d35b)) 34 | * add option no-cache ([1248b36](https://github.com/svelteness/svelte-jester/commit/1248b3678118251ff03f46331bc994162d2e3966)) 35 | * bring back cross-env ([759d4cb](https://github.com/svelteness/svelte-jester/commit/759d4cb888edf958dc7be7603ed6700cd891898e)) 36 | * enable tests ([8356e0f](https://github.com/svelteness/svelte-jester/commit/8356e0fe6b254919e52c287ecb7d8900f89d11fb)) 37 | * fix merge lockfile ([17caa9a](https://github.com/svelteness/svelte-jester/commit/17caa9a6bff3d2ea8034facf435fa8c483bc9d50)) 38 | * formatting ([d28dfb8](https://github.com/svelteness/svelte-jester/commit/d28dfb881cb29d8591c748be85a4fdacb8adf152)) 39 | * let tests complete on node 16 - 22 ([a9b21e1](https://github.com/svelteness/svelte-jester/commit/a9b21e12d97e5a11d0c0085d82345a9cb8e7b6ef)) 40 | * pass linter ([2f89077](https://github.com/svelteness/svelte-jester/commit/2f89077f2748a499714f01e2d797df17b4f6419e)) 41 | * pnpm handles argument passing ([0b2dd99](https://github.com/svelteness/svelte-jester/commit/0b2dd99b82bf5cebd58b1da2054d6734568083a3)) 42 | * reduce visibility of const ([250441a](https://github.com/svelteness/svelte-jester/commit/250441a429a2feb13f339a55394263e1542a889a)) 43 | * remove missing vite logo ([b7a54cb](https://github.com/svelteness/svelte-jester/commit/b7a54cbc4b467982ddc0633b893c790ee6be70c6)) 44 | * remove obsolete step ([01c82c7](https://github.com/svelteness/svelte-jester/commit/01c82c712ba44e9180a159d5b6a444a4bb248894)) 45 | * remove unused npmrc ([cea907d](https://github.com/svelteness/svelte-jester/commit/cea907d016f2662d7b54a1956c882d0b90d77a28)) 46 | * rewrite url as suggested by npm ([ec050b6](https://github.com/svelteness/svelte-jester/commit/ec050b65fd23f89323703b5660c99854cabfc34a)) 47 | * use different matcher to pass linter ([df6d2a3](https://github.com/svelteness/svelte-jester/commit/df6d2a3515ef5d9595eeab04ffd6a49c42234f62)) 48 | 49 | ## [3.0.0](https://github.com/svelteness/svelte-jester/compare/v2.3.1...v3.0.0) (2023-07-24) 50 | 51 | 52 | ### Features 53 | 54 | * add jest globals to standard ([be8c23d](https://github.com/svelteness/svelte-jester/commit/be8c23dcc8466c07dfcc2c82f568169fca13c819)) 55 | * allow svelteVersion to be injected for tests ([5b12cc0](https://github.com/svelteness/svelte-jester/commit/5b12cc0d12d8758e4c49050510c26e7e27ca4852)) 56 | * disallow calling ESM mode from processSync ([d6a381e](https://github.com/svelteness/svelte-jester/commit/d6a381e512415540c5ebd3df7c392a881603dbdd)) 57 | * document option svelteVersion ([210591a](https://github.com/svelteness/svelte-jester/commit/210591a4a3c7aa6a4a2f2a108199359ab608c7ae)) 58 | * extract functions into utils ([ea8b0c3](https://github.com/svelteness/svelte-jester/commit/ea8b0c32757f6b9710535c188bb32752abb45490)) 59 | * remove * import for treeshaking ([d079756](https://github.com/svelteness/svelte-jester/commit/d079756fa8259837d380755628739c63965c2f6d)) 60 | * remove globals ([15c5f5c](https://github.com/svelteness/svelte-jester/commit/15c5f5c06a9bc4113731670542a18cfaac677d34)) 61 | * remove restriction on Svelte3 ([3051249](https://github.com/svelteness/svelte-jester/commit/3051249d16d6ad56f3483ee9ec9a852567348096)) 62 | * run dependabot only on root package.json ([6abfb88](https://github.com/svelteness/svelte-jester/commit/6abfb88bef3945078b5819ed55f624a839e2f8ae)) 63 | * split release script into pre phase ([96edf43](https://github.com/svelteness/svelte-jester/commit/96edf4319b5f74ca3f1222cde67c9b9741a10bdd)) 64 | * split test call to not use NODE_OPTIONS for CJS ([7493725](https://github.com/svelteness/svelte-jester/commit/749372558562f3ad7f9599889deca0868f5f9dd2)) 65 | * upgrade e2e packages ([1372d0f](https://github.com/svelteness/svelte-jester/commit/1372d0f8033114187987f9a1242561902b64a754)) 66 | * upgrade e2e packages ([5d4d08c](https://github.com/svelteness/svelte-jester/commit/5d4d08c5371463acaa836bbe1761809c66143a53)) 67 | * upgrade svelte to v4 ([227785e](https://github.com/svelteness/svelte-jester/commit/227785e113a96f7da8a1ef47c56c603eb51b814b)) 68 | 69 | 70 | ### Bug Fixes 71 | 72 | * add jest globals ([a047c45](https://github.com/svelteness/svelte-jester/commit/a047c451dcc2262077cfab4b3cd162f4ee7bdce2)) 73 | * add missing jest import ([c88841d](https://github.com/svelteness/svelte-jester/commit/c88841d0ef019faf756e9b84966fcba19761de34)) 74 | * add missing jest-environment ([66bad7b](https://github.com/svelteness/svelte-jester/commit/66bad7b505787c6affee13de88a78b763ac1db50)) 75 | * add missing words to comment ([801162e](https://github.com/svelteness/svelte-jester/commit/801162e36537d9f132cccc33b182d0ff3fe0cac8)) 76 | * enable validation for standardjs ([a028920](https://github.com/svelteness/svelte-jester/commit/a0289205b1a5e32aacc60f64c38461d7837cf7f7)) 77 | * migrate deprecated tsconfig object ([875f27f](https://github.com/svelteness/svelte-jester/commit/875f27f9a033d1db9d8b488e9b36087e79bf1fb9)) 78 | * remove duplicate line ([5cf2ca6](https://github.com/svelteness/svelte-jester/commit/5cf2ca695aa13302022063caa8dc408c54717dc6)) 79 | * rename constant ([9243034](https://github.com/svelteness/svelte-jester/commit/92430340e32c1095ab2bf77f697f0bfe753e7732)) 80 | * revert change from last PR breaking windows ([a4f1341](https://github.com/svelteness/svelte-jester/commit/a4f13418820b7b129c3905937728f1e4fce197f2)) 81 | * use real svelte version as default ([847933e](https://github.com/svelteness/svelte-jester/commit/847933eecca579147b4972b517ad926d2d913715)) 82 | * use same relative path ([6004a96](https://github.com/svelteness/svelte-jester/commit/6004a968087565979ad73eadf85d6b56dc9a30bf)) 83 | 84 | ### [2.3.2](https://github.com/mihar-22/svelte-jester/compare/v2.3.1...v2.3.2) (2022-02-16) 85 | 86 | ### [2.3.1](https://github.com/mihar-22/svelte-jester/compare/v2.3.0...v2.3.1) (2022-02-01) 87 | 88 | 89 | ### Bug Fixes 90 | 91 | * drop min node version to `14` for `node-sass` ([aa4508d](https://github.com/mihar-22/svelte-jester/commit/aa4508dd9dcfb68c99c492239c6400bcbab69e5e)) 92 | 93 | ## [2.3.0](https://github.com/mihar-22/svelte-jester/compare/v2.2.0...v2.3.0) (2022-02-01) 94 | 95 | 96 | ### Features 97 | 98 | * bump min node version to `16` ([9172250](https://github.com/mihar-22/svelte-jester/commit/917225044ffe0d534da6c60b4650df3b50163ced)) 99 | 100 | ## [2.2.0](https://github.com/mihar-22/svelte-jester/compare/v2.1.5...v2.2.0) (2022-02-01) 101 | 102 | 103 | ### Features 104 | 105 | * bump min node version to `14` ([526d3ed](https://github.com/mihar-22/svelte-jester/commit/526d3edffd1a55f66faf21a7b7f3f31426ba195d)) 106 | 107 | 108 | ### Bug Fixes 109 | 110 | * [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received an instance of URL ([1384839](https://github.com/mihar-22/svelte-jester/commit/1384839dac8bb87d2a62ef903b4a7587683ef35e)) 111 | 112 | ### [2.1.5](https://github.com/mihar-22/svelte-jester/compare/v2.1.4...v2.1.5) (2021-09-22) 113 | 114 | 115 | ### Bug Fixes 116 | 117 | * add preprocess to published files array ([#84](https://github.com/mihar-22/svelte-jester/issues/84)) ([4a10e92](https://github.com/mihar-22/svelte-jester/commit/4a10e923e688727b3a415daa8595e7a03b8f681b)) 118 | * allow installation on Node 12 ([7093aee](https://github.com/mihar-22/svelte-jester/commit/7093aeed66dc36d6d61cd15b50a49ee54b6ffcc8)) 119 | 120 | ### [2.1.4](https://github.com/mihar-22/svelte-jester/compare/v2.1.3...v2.1.4) (2021-09-21) 121 | 122 | 123 | ### Bug Fixes 124 | 125 | * add back Node 12 support ([#83](https://github.com/mihar-22/svelte-jester/issues/83)) ([e5de1c6](https://github.com/mihar-22/svelte-jester/commit/e5de1c6c6c2e82b0dffb3fc1892abdaa3dc7d414)) 126 | * unpin svelte-preprocess ([#82](https://github.com/mihar-22/svelte-jester/issues/82)) ([a48d909](https://github.com/mihar-22/svelte-jester/commit/a48d90913993eb271ac40ee009110d48e39255ba)) 127 | 128 | ### [2.1.3](https://github.com/mihar-22/svelte-jester/compare/v2.1.2...v2.1.3) (2021-09-19) 129 | 130 | 131 | ### Bug Fixes 132 | 133 | * invalid transformer export ([#75](https://github.com/mihar-22/svelte-jester/issues/75)) ([4729f0b](https://github.com/mihar-22/svelte-jester/commit/4729f0b65cd0f6d3140551a969a564913ffb9972)) 134 | * surface frame on failed Svelte compilation ([a747d96](https://github.com/mihar-22/svelte-jester/commit/a747d9665e180f4365bead8a93b9596d217692e1)) 135 | 136 | ### [2.1.2](https://github.com/mihar-22/svelte-jester/compare/v2.1.1...v2.1.2) (2021-09-12) 137 | 138 | 139 | ### Bug Fixes 140 | 141 | * add back process method for CJS support ([#71](https://github.com/mihar-22/svelte-jester/issues/71)) ([6ee7c5c](https://github.com/mihar-22/svelte-jester/commit/6ee7c5c6c15c5f92cf59ee1acaacbf94a3450a05)) 142 | 143 | ### [2.1.1](https://github.com/mihar-22/svelte-jester/compare/v2.1.0...v2.1.1) (2021-08-31) 144 | 145 | 146 | ### Bug Fixes 147 | 148 | * file paths in `package.json` pointing to `src` instead of `dist` ([#69](https://github.com/mihar-22/svelte-jester/issues/69)) ([b6f2cbb](https://github.com/mihar-22/svelte-jester/commit/b6f2cbb77e2c1f9976045d841cca2781795b9117)) 149 | 150 | ## [2.1.0](https://github.com/mihar-22/svelte-jester/compare/v2.0.1...v2.1.0) (2021-08-27) 151 | 152 | 153 | ### Features 154 | 155 | * build CJS and ESM versions of the library ([#68](https://github.com/mihar-22/svelte-jester/issues/68)) ([d93f2dc](https://github.com/mihar-22/svelte-jester/commit/d93f2dc155820ff0b2843143037d23c2934fc55d)) 156 | 157 | ### [2.0.1](https://github.com/mihar-22/svelte-jester/compare/v2.0.0...v2.0.1) (2021-08-05) 158 | 159 | 160 | ### Bug Fixes 161 | 162 | * module not found error ([#60](https://github.com/mihar-22/svelte-jester/issues/60)) ([3748f49](https://github.com/mihar-22/svelte-jester/commit/3748f49949fd8bdf8edf25bb7d7d0a72a27f2950)), closes [#59](https://github.com/mihar-22/svelte-jester/issues/59) 163 | 164 | ## [2.0.0](https://github.com/mihar-22/svelte-jester/compare/v1.8.2...v2.0.0) (2021-08-04) 165 | 166 | 167 | ### ⚠ BREAKING CHANGES 168 | 169 | * async transformers are only supported in Jest `>=27`. 170 | 171 | ### Features 172 | 173 | * avoid creating new node processes by leveraging processAsync ([#57](https://github.com/mihar-22/svelte-jester/issues/57)) ([92760dd](https://github.com/mihar-22/svelte-jester/commit/92760dd821e7685d67ed3d0f0ebff84484db4361)) 174 | 175 | ### [1.8.2](https://github.com/mihar-22/svelte-jester/compare/v1.8.1...v1.8.2) (2021-08-04) 176 | 177 | 178 | ### Bug Fixes 179 | 180 | * actually revert async changes -_- ([64c3d4d](https://github.com/mihar-22/svelte-jester/commit/64c3d4dc5a0a9f1f18868ef139686cf10bf70022)) 181 | 182 | ### [1.8.1](https://github.com/mihar-22/svelte-jester/compare/v1.8.0...v1.8.1) (2021-08-04) 183 | 184 | 185 | ### Bug Fixes 186 | 187 | * revert "Avoid creating new node processes by leveraging processAsync ([#57](https://github.com/mihar-22/svelte-jester/issues/57))" ([#58](https://github.com/mihar-22/svelte-jester/issues/58)) ([3a3e500](https://github.com/mihar-22/svelte-jester/commit/3a3e500a4815264c8cb6b8c1a4d7415fa2f0fe4a)) 188 | 189 | ## [1.8.0](https://github.com/mihar-22/svelte-jester/compare/v1.7.0...v1.8.0) (2021-08-04) 190 | 191 | 192 | ### Features 193 | 194 | * avoid creating new node processes by leveraging processAsync ([#57](https://github.com/mihar-22/svelte-jester/issues/57)) ([d5be238](https://github.com/mihar-22/svelte-jester/commit/d5be238e2ecbaca615947859339a7e5f76eb5abc)) 195 | * provide option to show console.logs from preprocessors ([#53](https://github.com/mihar-22/svelte-jester/issues/53)) ([173620a](https://github.com/mihar-22/svelte-jester/commit/173620a7312af994a626d62597ae3971c978bd4f)) 196 | 197 | ## [1.7.0](https://github.com/mihar-22/svelte-jester/compare/v1.6.0...v1.7.0) (2021-06-01) 198 | 199 | 200 | ### Features 201 | 202 | * hide console log in preprocess ([#50](https://github.com/mihar-22/svelte-jester/issues/50)) ([91d3cc6](https://github.com/mihar-22/svelte-jester/commit/91d3cc6ab6c44771117513175a6c24eb22470a83)) 203 | * support Windows ([#49](https://github.com/mihar-22/svelte-jester/issues/49)) ([48a7506](https://github.com/mihar-22/svelte-jester/commit/48a75061f7ebcaae1d30c514f8775725047d82a8)) 204 | 205 | ## [1.6.0](https://github.com/mihar-22/svelte-jester/compare/v1.5.0...v1.6.0) (2021-05-25) 206 | 207 | 208 | ### Features 209 | 210 | * initial SvelteKit support ([#46](https://github.com/mihar-22/svelte-jester/issues/46)) ([0c008d7](https://github.com/mihar-22/svelte-jester/commit/0c008d7e56e03da7d402406655a9edd80dc719cb)) 211 | 212 | ## [1.5.0](https://github.com/mihar-22/svelte-jester/compare/v1.4.0...v1.5.0) (2021-04-22) 213 | 214 | 215 | ### Features 216 | 217 | * all process env variables are passed down to child transform process ([#40](https://github.com/mihar-22/svelte-jester/issues/40)) ([beecf48](https://github.com/mihar-22/svelte-jester/commit/beecf48f2677d5a294f851841896dd0e5779d078)) 218 | 219 | ## [1.4.0](https://github.com/mihar-22/svelte-jester/compare/v1.3.2...v1.4.0) (2021-04-12) 220 | 221 | 222 | ### Features 223 | 224 | * allow svelte.config.cjs ([#37](https://github.com/mihar-22/svelte-jester/issues/37)) ([9e259c4](https://github.com/mihar-22/svelte-jester/commit/9e259c4b4d254ee163c67995cacf224e64c229d3)), closes [#35](https://github.com/mihar-22/svelte-jester/issues/35) 225 | 226 | ### [1.3.2](https://github.com/mihar-22/svelte-jester/compare/v1.3.1...v1.3.2) (2021-03-24) 227 | 228 | 229 | ### Bug Fixes 230 | 231 | * use RawSourceMap for sourcemap ([b056107](https://github.com/mihar-22/svelte-jester/commit/b05610769b575c236e66c26e9f480cbb6e2c3ee8)) 232 | 233 | ### [1.3.1](https://github.com/mihar-22/svelte-jester/compare/v1.3.0...v1.3.1) (2021-03-19) 234 | 235 | 236 | ### Bug Fixes 237 | 238 | * incorrect coverage lines ([fd629b7](https://github.com/mihar-22/svelte-jester/commit/fd629b73b667f0926873a27b1be59151b4a784e0)), closes [#28](https://github.com/mihar-22/svelte-jester/issues/28) 239 | 240 | ## [1.3.0](https://github.com/mihar-22/svelte-jester/compare/v1.2.0...v1.3.0) (2020-12-10) 241 | 242 | 243 | ### Features 244 | 245 | * allow user to specify `svelte.config` path ([540e986](https://github.com/mihar-22/svelte-jester/commit/540e986bf5bb0bf40eea72056cc5aea62e09f233)) 246 | 247 | ## [1.2.0](https://github.com/mihar-22/svelte-jester/compare/v1.1.5...v1.2.0) (2020-12-09) 248 | 249 | 250 | ### Features 251 | 252 | * adds maxBuffer option that sets buffer limit for preprocess ([bd80185](https://github.com/mihar-22/svelte-jester/commit/bd80185d90d09b80989fb6e9af421754c0da938f)), closes [#20](https://github.com/mihar-22/svelte-jester/issues/20) 253 | 254 | ### [1.1.5](https://github.com/mihar-22/svelte-jester/compare/v1.1.4...v1.1.5) (2020-09-02) 255 | 256 | 257 | ### Bug Fixes 258 | 259 | * svelte.config.js should not be required unless preprocessing ([6b3e567](https://github.com/mihar-22/svelte-jester/commit/6b3e56788010d3d00e1fce045470e7e270dad9eb)) 260 | 261 | ### [1.1.4](https://github.com/mihar-22/svelte-jester/compare/v1.1.3...v1.1.4) (2020-09-02) 262 | 263 | 264 | ### Bug Fixes 265 | 266 | * use double quotes for windows ([e45313d](https://github.com/mihar-22/svelte-jester/commit/e45313d9680ac9ac14044f9f6d8c8babb49471d2)) 267 | 268 | ### [1.1.3](https://github.com/mihar-22/svelte-jester/compare/v1.1.2...v1.1.3) (2020-08-31) 269 | 270 | 271 | ### Bug Fixes 272 | 273 | * error when path to preprocessor contains some characters like '&' ([00e61d8](https://github.com/mihar-22/svelte-jester/commit/00e61d86aaaa764454d8774f9ec63fce01e93869)) 274 | 275 | ### [1.1.2](https://github.com/mihar-22/svelte-jester/compare/v1.1.1...v1.1.2) (2020-08-16) 276 | 277 | ### [1.1.1](https://github.com/mihar-22/svelte-jester/compare/v1.1.0...v1.1.1) (2020-08-15) 278 | 279 | 280 | ### Bug Fixes 281 | 282 | * add svelteconfig.js to files pattern ([a0f57b3](https://github.com/mihar-22/svelte-jester/commit/a0f57b30362dbe53fa5480020cd17e14dcd6011a)) 283 | 284 | ## [1.1.0](https://github.com/mihar-22/svelte-jester/compare/v1.0.6...v1.1.0) (2020-08-15) 285 | 286 | 287 | ### Features 288 | 289 | * rootMode option ([531e7d7](https://github.com/mihar-22/svelte-jester/commit/531e7d7ca40a27e82a5bd66f3a8256d3a4325fae)) 290 | 291 | ### [1.0.6](https://github.com/mihar-22/svelte-jester/compare/v1.0.5...v1.0.6) (2020-05-18) 292 | 293 | 294 | ### Bug Fixes 295 | 296 | * raise unhandled rejection on child process as uncaught exception ([ae64409](https://github.com/mihar-22/svelte-jester/commit/ae644094bcee93e17ecf3e02f38f29f485ea78c1)), closes [#5](https://github.com/mihar-22/svelte-jester/issues/5) 297 | 298 | ### [1.0.5](https://github.com/mihar-22/svelte-jester/compare/v1.0.4...v1.0.5) (2020-03-05) 299 | 300 | ### [1.0.4](https://github.com/mihar-22/svelte-jester/compare/v1.0.3...v1.0.4) (2020-02-14) 301 | 302 | 303 | ### Bug Fixes 304 | 305 | * replace sync-rpc due to leaving open handles in jest@25 ([9024ca9](https://github.com/mihar-22/svelte-jester/commit/9024ca93d639c3d7fff863af88d60f2cc8b0b5a4)) 306 | 307 | ### [1.0.3](https://github.com/mihar-22/svelte-jester/compare/v1.0.2...v1.0.3) (2019-12-05) 308 | 309 | 310 | ### Bug Fixes 311 | 312 | * cosmiconfig was loading config from pkg if svelte key was defined ([8783131](https://github.com/mihar-22/svelte-jester/commit/8783131a538b6c5263f2069b00d252f44d7acc0e)) 313 | 314 | ### [1.0.2](https://github.com/mihar-22/svelte-jester/compare/v1.0.1...v1.0.2) (2019-12-05) 315 | 316 | ### 1.0.1 (2019-12-05) 317 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Rahim Alwer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
5 | Simply precompiles Svelte components before importing them into Jest tests. 6 |
7 | 8 |9 | This version requires Jest >= 27 and defaults to ESM, which is required with Svelte 4+. If you're using Svelte 3 and want to use CJS, you need to specify the full path for the jest transformer in your jest config. 10 |
11 | 12 | [![version][version-badge]][package] 13 | [![MIT License][license-badge]][license] 14 | 15 |19 | Check out SvelteKit, the official Svelte app framework powered by Vite! 20 |
21 | 22 |23 | Click on the Vite and Svelte logos to learn more 24 |
25 |hello {name}
11 | {/if} 12 | -------------------------------------------------------------------------------- /e2e/svelte-5/src/legacy.test.js: -------------------------------------------------------------------------------- 1 | import { mount, unmount, tick } from 'svelte' 2 | 3 | import Subject from './legacy.svelte' 4 | 5 | let component 6 | 7 | afterEach(() => { 8 | unmount(component) 9 | component = undefined 10 | }) 11 | 12 | test('render', () => { 13 | component = mount(Subject, { 14 | target: document.body, 15 | props: { name: 'alice' } 16 | }) 17 | 18 | const button = document.querySelector('button') 19 | 20 | expect(button).toHaveRole('button') 21 | }) 22 | 23 | test('interaction', async () => { 24 | component = mount(Subject, { 25 | target: document.body, 26 | props: { name: 'alice' } 27 | }) 28 | 29 | const button = document.querySelector('button') 30 | 31 | button.click() 32 | await tick() 33 | 34 | const message = document.querySelector('p') 35 | 36 | expect(message.textContent).toMatch(/hello alice/iu) 37 | }) 38 | -------------------------------------------------------------------------------- /e2e/svelte-5/src/modern.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | {#if showGreeting} 10 |hello {name}
11 | {/if} 12 | -------------------------------------------------------------------------------- /e2e/svelte-5/src/modern.test.js: -------------------------------------------------------------------------------- 1 | import { mount, unmount, tick } from 'svelte' 2 | 3 | import Subject from './modern.svelte' 4 | 5 | let component 6 | 7 | afterEach(() => { 8 | unmount(component) 9 | component = undefined 10 | }) 11 | 12 | test('render', () => { 13 | component = mount(Subject, { 14 | target: document.body, 15 | props: { name: 'alice' } 16 | }) 17 | 18 | const button = document.querySelector('button') 19 | 20 | expect(button).toHaveRole('button') 21 | }) 22 | 23 | test('interaction', async () => { 24 | component = mount(Subject, { 25 | target: document.body, 26 | props: { name: 'alice' } 27 | }) 28 | 29 | const button = document.querySelector('button') 30 | 31 | button.click() 32 | await tick() 33 | 34 | const message = document.querySelector('p') 35 | 36 | expect(message.textContent).toMatch(/hello alice/iu) 37 | }) 38 | -------------------------------------------------------------------------------- /e2e/svelte-5/src/module.svelte.js: -------------------------------------------------------------------------------- 1 | export const createCounter = () => { 2 | let count = $state(0) 3 | 4 | return { 5 | get count () { 6 | return count 7 | }, 8 | 9 | increment () { 10 | count = count + 1 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /e2e/svelte-5/src/module.test.js: -------------------------------------------------------------------------------- 1 | import { test } from '@jest/globals' 2 | 3 | import * as Subject from './module.svelte.js' 4 | 5 | test('get current count', () => { 6 | const subject = Subject.createCounter() 7 | const result = subject.count 8 | 9 | expect(result).toBe(0) 10 | }) 11 | 12 | test('increment', () => { 13 | const subject = Subject.createCounter() 14 | 15 | subject.increment() 16 | const result = subject.count 17 | 18 | expect(result).toBe(1) 19 | }) 20 | -------------------------------------------------------------------------------- /e2e/svelte-5/svelte.config.js: -------------------------------------------------------------------------------- 1 | export default {} 2 | -------------------------------------------------------------------------------- /e2e/sveltekit/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "@babel/preset-env", 5 | { 6 | "targets": { 7 | "node": "current" 8 | } 9 | } 10 | ] 11 | ] 12 | } -------------------------------------------------------------------------------- /e2e/sveltekit/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | .vercel 10 | .output 11 | vite.config.js.timestamp-* 12 | vite.config.ts.timestamp-* 13 | -------------------------------------------------------------------------------- /e2e/sveltekit/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | resolution-mode=highest 3 | shell-emulator=true 4 | -------------------------------------------------------------------------------- /e2e/sveltekit/README.md: -------------------------------------------------------------------------------- 1 | # create-svelte 2 | 3 | Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). 4 | 5 | ## Creating a project 6 | 7 | If you're seeing this, you've probably already done this step. Congrats! 8 | 9 | ```bash 10 | # create a new project in the current directory 11 | npm create svelte@latest 12 | 13 | # create a new project in my-app 14 | npm create svelte@latest my-app 15 | ``` 16 | 17 | ## Developing 18 | 19 | Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: 20 | 21 | ```bash 22 | npm run dev 23 | 24 | # or start the server and open the app in a new browser tab 25 | npm run dev -- --open 26 | ``` 27 | 28 | ## Building 29 | 30 | To create a production version of your app: 31 | 32 | ```bash 33 | npm run build 34 | ``` 35 | 36 | You can preview the production build with `npm run preview`. 37 | 38 | > To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. 39 | -------------------------------------------------------------------------------- /e2e/sveltekit/jest.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "transform": { 3 | "^.+\\.js$": "babel-jest", 4 | "^.+\\.svelte$": [ 5 | "svelte-jester", 6 | { 7 | "preprocess": true 8 | } 9 | ], 10 | "^.+\\.ts$": ["ts-jest", { 11 | "tsconfig": "tsconfig.spec.json", 12 | "useESM": true 13 | }] 14 | }, 15 | "moduleNameMapper": { 16 | "^\\$lib(.*)$": "10 | This is a SvelteKit app. You can make your own by typing the 11 | following into your command line and following the prompts: 12 |
13 | 14 |npm create svelte@latest15 | 16 |
17 | The page you're looking at is purely static HTML, with no client-side interactivity needed. 18 | Because of that, we don't need to load any JavaScript. Try viewing the page's source, or opening 19 | the devtools network panel and reloading. 20 |
21 | 22 |23 | The Sverdle page illustrates SvelteKit's data loading and form handling. Try 24 | using it with JavaScript disabled! 25 |
26 |10 | Sverdle is a clone of Wordle, the 11 | word guessing game. To play, enter a five-letter English word. For example: 12 |
13 | 14 |23 | The y is in the right place. r and 24 | t 25 | are the right letters, but in the wrong place. The other letters are wrong, and can be discarded. 26 | Let's make another guess: 27 |
28 | 29 |This time we guessed right! You have six guesses to get the word.
38 | 39 |
40 | Unlike the original Wordle, Sverdle runs on the server instead of in the browser, making it
41 | impossible to cheat. It uses <form>
and cookies to submit data, meaning you can
42 | even play with JavaScript disabled!
43 |