diff --git a/.eslintrc.js b/.eslintrc.js index a093de610b..66c533eb5d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,5 +10,8 @@ module.exports = { 'estree' ], 'svelte3/compiler': require('./compiler') + }, + rules: { + '@typescript-eslint/no-non-null-assertion': 'off' } }; diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7de5a35e13..05b48f2ae0 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ ### Before submitting the PR, please make sure you do the following - [ ] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs -- [ ] Prefix your PR title with `[feat]`, `[fix]`, `[chore]`, or `[docs]`. +- [ ] Prefix your PR title with `feat:`, `fix:`, `chore:`, or `docs:`. - [ ] This message body should clearly illustrate what problems it solves. - [ ] Ideally, include a test that fails without this PR but passes with it. diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 3bc3fa6b99..0000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,52 +0,0 @@ -# Configuration for probot-stale - https://github.com/probot/stale - -# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) -onlyLabels: [] - -# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable -exemptLabels: - - popular - - pinned - - security - - bug - - "[Status] Maybe Later" - -# Set to true to ignore issues in a project (defaults to false) -exemptProjects: false - -# Set to true to ignore issues in a milestone (defaults to false) -exemptMilestones: false - -# Set to true to ignore issues with an assignee (defaults to false) -exemptAssignees: false - -# Label to use when marking as stale -staleLabel: stale-bot - -# Comment to post when removing the stale label. -# unmarkComment: > -# Your comment here. - -# Limit the number of actions per hour, from 1-30. Default is 30 -limitPerRun: 30 - -# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': -pulls: - daysUntilStale: 210 - daysUntilClose: 25 - markComment: > - This pull request has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. - closeComment: > - This pull request has been closed as it was previously marked as stale and saw no subsequent activity. - -issues: - daysUntilStale: 180 - daysUntilClose: 14 - markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. - closeComment: > - This issue has been closed as it was previously marked as stale and saw no subsequent activity. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6a9fdf42f..91cd471aa2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,41 +1,77 @@ name: CI -on: [push, pull_request] +on: + push: + branches: [ master ] + pull_request: +permissions: + contents: read # to fetch code (actions/checkout) jobs: Tests: runs-on: ${{ matrix.os }} timeout-minutes: 15 strategy: matrix: - node-version: [8, 10, 12, 14] - os: [ubuntu-latest, windows-latest, macOS-latest] + include: + - node-version: 14 + os: ubuntu-latest + - node-version: 14 + os: windows-latest + - node-version: 14 + os: macOS-latest + - node-version: 16 + os: ubuntu-latest + - node-version: 18 + os: ubuntu-latest + - node-version: 20 + os: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2.2.4 + with: + version: ${{ matrix.node-version == 14 && 7 || 8 }} + - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - cache: npm - - run: npm install - - run: npm test + cache: pnpm + - run: pnpm install --frozen-lockfile + - run: node node_modules/puppeteer/install.js + - run: pnpm test:integration env: CI: true Lint: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2.2.4 + - uses: actions/setup-node@v3 with: - cache: npm - - run: 'npm i && npm run lint' + cache: pnpm + - run: 'pnpm i && pnpm lint' Unit: runs-on: ${{ matrix.os }} timeout-minutes: 10 strategy: matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] + include: + - node-version: 14 + os: ubuntu-latest + - node-version: 14 + os: windows-latest + - node-version: 14 + os: macOS-latest + - node-version: 16 + os: ubuntu-latest + - node-version: 18 + os: ubuntu-latest + - node-version: 20 + os: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2.2.4 + - uses: actions/setup-node@v3 with: - cache: npm - - run: 'npm i && npm run test:unit' + node-version: ${{ matrix.node-version }} + cache: pnpm + - run: pnpm install + - run: pnpm test:unit diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ea6e0f5a60..763fb72577 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -7,6 +7,8 @@ on: paths: - site/content/** +permissions: {} + jobs: release: name: Deploy docs @@ -25,4 +27,4 @@ jobs: repo: 'svelte' branch: 'master' docs_path: 'site/content' - token: ${{ steps.github-app.outputs.token }} \ No newline at end of file + token: ${{ steps.github-app.outputs.token }} diff --git a/.gitignore b/.gitignore index 911ff19cab..e70d995994 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .idea .DS_Store -.nyc_output .vscode node_modules *.map @@ -9,6 +8,7 @@ node_modules /compiler.*js /index.*js /ssr.*js +/action /internal /store /easing @@ -16,21 +16,9 @@ node_modules /transition /animate /scratch/ -/coverage/ -/coverage.lcov /test/*/samples/_ /yarn-error.log _actual*.* _output /types - -/site/cypress/screenshots/ -/site/__sapper__/ -/site/.env -/site/.sessions -/site/static/svelte-app.json -/site/static/contributors.jpg -/site/static/workers -/site/scripts/svelte-app -/site/scripts/community -/site/src/routes/_contributors.js +.eslintcache diff --git a/.mocharc.js b/.mocharc.js index e55f26099e..c8ae961f89 100644 --- a/.mocharc.js +++ b/.mocharc.js @@ -1,9 +1,12 @@ +const is_unit_test = process.env.UNIT_TEST; + module.exports = { - file: [ - 'test/test.ts' - ], + file: is_unit_test ? [] : ['test/test.js'], require: [ 'sucrase/register' + ], + "node-option": [ + "experimental-modules" ] }; diff --git a/.mocharc.unit.js b/.mocharc.unit.js new file mode 100644 index 0000000000..387d70e7e0 --- /dev/null +++ b/.mocharc.unit.js @@ -0,0 +1,15 @@ +module.exports = { + spec: [ + 'src/**/__test__.ts', + ], + require: [ + 'sucrase/register' + ], + recursive: true, +}; + +// add coverage options when running 'npx c8 mocha' +if (process.env.NODE_V8_COVERAGE) { + module.exports.fullTrace = true; + module.exports.require.push('source-map-support/register'); +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 362dd00152..3ad9a97b43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,308 @@ # Svelte changelog +## Unreleased (4.0) + +* **breaking** Minimum supported Node version is now Node 14 +* **breaking** Minimum supported webpack version is now webpack 5 +* **breaking** Minimum supported TypeScript version is now TypeScript 5 (it will likely work with lower versions, but we make no guarantees about that) +* **breaking** Stricter types for `createEventDispatcher` (see PR for migration instructions) ([#7224](https://github.com/sveltejs/svelte/pull/7224)) +* **breaking** Stricter types for `Action` and `ActionReturn` (see PR for migration instructions) ([#7224](https://github.com/sveltejs/svelte/pull/7224)) +* **breaking** Stricter types for `onMount` - now throws a type error when returning a function asynchronously to catch potential mistakes around callback functions (see PR for migration instructions) ([#8136](https://github.com/sveltejs/svelte/pull/8136)) +* **breaking** Overhaul and drastically improve creating custom elements with Svelte (see PR for list of changes and migration instructions) ([#8457](https://github.com/sveltejs/svelte/pull/8457)) +* **breaking** Deprecate `SvelteComponentTyped`, use `SvelteComponent` instead ([#8512](https://github.com/sveltejs/svelte/pull/8512)) +* **breaking** Error on falsy values instead of stores passed to `derived` ([#7947](https://github.com/sveltejs/svelte/pull/7947)) +* Add `a11y no-noninteractive-element-interactions` rule ([#8391](https://github.com/sveltejs/svelte/pull/8391)) +* Add `a11y-no-static-element-interactions`rule ([#8251](https://github.com/sveltejs/svelte/pull/8251)) +* Bind `null` option and input values consistently ([#8312](https://github.com/sveltejs/svelte/issues/8312)) +* Allow `$store` to be used with changing values including nullish values ([#7555](https://github.com/sveltejs/svelte/issues/7555)) + +## Unreleased (3.0) + +* Handle `width`/`height` attributes when spreading ([#6752](https://github.com/sveltejs/svelte/issues/6752)) +* Add support for resize observer bindings (`
`) ([#8022](https://github.com/sveltejs/svelte/pull/8022)) + +## 3.58.0 + +* Add `bind:innerText` for `contenteditable` elements ([#3311](https://github.com/sveltejs/svelte/issues/3311)) +* Add support for CSS `@container` queries ([#6969](https://github.com/sveltejs/svelte/issues/6969)) +* Respect `preserveComments` in DOM output ([#7182](https://github.com/sveltejs/svelte/pull/7182)) +* Allow use of `document` for `target` in typings ([#7554](https://github.com/sveltejs/svelte/pull/7554)) +* Add `a11y-interactive-supports-focus` warning ([#8392](https://github.com/sveltejs/svelte/pull/8392)) +* Fix equality check when updating dynamic text ([#5931](https://github.com/sveltejs/svelte/issues/5931)) +* Relax `a11y-no-noninteractive-element-to-interactive-role` warning ([#8402](https://github.com/sveltejs/svelte/pull/8402)) +* Properly handle microdata attributes ([#8413](https://github.com/sveltejs/svelte/issues/8413)) +* Prevent name collision when using computed destructuring variables ([#8417](https://github.com/sveltejs/svelte/issues/8417)) +* Fix escaping ` @@ -14,4 +13,4 @@ In cases like these, where the names match, we can also use a shorthand form: ``` -This applies to all bindings, not just textareas. \ No newline at end of file +This applies to all bindings, not just textareas. diff --git a/site/content/tutorial/06-bindings/06-select-bindings/text.md b/site/content/tutorial/06-bindings/06-select-bindings/text.md index b9cf2de6ec..d0104f7f1a 100644 --- a/site/content/tutorial/06-bindings/06-select-bindings/text.md +++ b/site/content/tutorial/06-bindings/06-select-bindings/text.md @@ -10,4 +10,4 @@ We can also use `bind:value` with ``: +Returning to our [earlier ice cream example](/tutorial/group-inputs), we can replace the checkboxes with a ` +
+ - + +
{/each} ``` diff --git a/site/content/tutorial/06-bindings/10-media-elements/app-a/App.svelte b/site/content/tutorial/06-bindings/10-media-elements/app-a/App.svelte index 0b3b4f0881..33d6e3f6eb 100644 --- a/site/content/tutorial/06-bindings/10-media-elements/app-a/App.svelte +++ b/site/content/tutorial/06-bindings/10-media-elements/app-a/App.svelte @@ -50,7 +50,7 @@

Caminandes: Llamigos

-

From Blender Open Projects. CC-BY

+

From Blender Studio. CC-BY