Merge branch 'master' into @feature/compile-error-mode

pull/6194/head
Simon H 5 years ago committed by GitHub
commit 0df080ef8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

5
.github/stale.yml vendored

@ -8,6 +8,7 @@ exemptLabels:
- popular
- pinned
- security
- bug
- "[Status] Maybe Later"
# Set to true to ignore issues in a project (defaults to false)
@ -31,7 +32,7 @@ limitPerRun: 30
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
pulls:
daysUntilStale: 180
daysUntilStale: 210
daysUntilClose: 25
markComment: >
This pull request has been automatically marked as stale because it has not had
@ -41,7 +42,7 @@ pulls:
This pull request has been closed as it was previously marked as stale and saw no subsequent activity.
issues:
daysUntilStale: 90
daysUntilStale: 180
daysUntilClose: 14
markComment: >
This issue has been automatically marked as stale because it has not had

@ -9,37 +9,24 @@ jobs:
node-version: [8, 10, 12, 14]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- id: npm-cache-dir
run: echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- run: npm install
- run: npm test
env:
CI: true
- uses: actions/checkout@v1
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm install
- run: npm test
env:
CI: true
Lint:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- id: npm-cache-dir
run: echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- run: 'npm i && npm run lint'
- uses: actions/checkout@v1
- uses: actions/setup-node@v2
with:
cache: npm
- run: 'npm i && npm run lint'
Unit:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
@ -47,14 +34,8 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- id: npm-cache-dir
run: echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- run: 'npm i && npm run test:unit'
- uses: actions/checkout@v1
- uses: actions/setup-node@v2
with:
cache: npm
- run: 'npm i && npm run test:unit'

@ -2,18 +2,24 @@
## Unreleased
* Expose `svelte/ssr` which exported lifecycle methods as noop ([#6416](https://github.com/sveltejs/svelte/pull/6416))
* Add `trusted` event modifier ([#6137](https://github.com/sveltejs/svelte/issues/6137))
* Add `varsReport` compiler option ([#6192](https://github.com/sveltejs/svelte/pull/6192))
* Expose `svelte/ssr` which exports lifecycle methods as no-ops ([#6416](https://github.com/sveltejs/svelte/pull/6416))
* Add `|trusted` event modifier ([#6137](https://github.com/sveltejs/svelte/issues/6137))
* Add `varsReport` compiler option to include all variables reference in the component in the `variables` report ([#6192](https://github.com/sveltejs/svelte/pull/6192))
* Throw compiler error when passing empty directive names ([#6299](https://github.com/sveltejs/svelte/issues/6299))
* Update `periscopic` to allow for export of anonymous function or class ([#3275](https://github.com/sveltejs/svelte/issues/3275))
* Throw proper error for `export default function() {}` and `export default class {}` rather than crashing the compiler ([#3275](https://github.com/sveltejs/svelte/issues/3275))
* Fix ordering of elements in keyed `{#each}` ([#6445](https://github.com/sveltejs/svelte/pull/6445))
* Fix `preserveComments` in SSR mode ([#4730](https://github.com/sveltejs/svelte/issues/4730))
* Fix compiler error when using `:where()` inside `:global()` ([#6434](https://github.com/sveltejs/svelte/issues/6434))
* Fix erroneous `unknown prop` warning when using slot on a component ([#6065](https://github.com/sveltejs/svelte/pull/6065))
* Fix :global() with pseudo element should be considered as global ([#6470](https://github.com/sveltejs/svelte/pull/6470))
* New a11y warning `a11y-mouse-events-have-key-events` which checks that `mouseover`/`mouseout` are accompanied by `focus`/`blur` event handlers ([#5938](https://github.com/sveltejs/svelte/pull/5938))
* Remove deprecated `a11y-no-onchange warning` ([#6457](https://github.com/sveltejs/svelte/issues/6457))
* Remove `a11y-media-has-caption` from `audio` elements ([#6054](https://github.com/sveltejs/svelte/issues/6054))
* Fix `:global()` with pseudo element not being seen as global ([#6470](https://github.com/sveltejs/svelte/pull/6470))
* Allow `:global()` to contain multiple selectors when it is not part of a larger selector ([#6477](https://github.com/sveltejs/svelte/issues/6477))
* Add a11y warning `a11y-mouse-events-have-key-events` which checks that `mouseover`/`mouseout` are accompanied by `focus`/`blur` event handlers ([#5938](https://github.com/sveltejs/svelte/pull/5938))
* Remove deprecated a11y warning `a11y-no-onchange warning` ([#6457](https://github.com/sveltejs/svelte/issues/6457))
* Stop checking `a11y-media-has-caption` a11y warning on `<audio>` elements ([#6054](https://github.com/sveltejs/svelte/issues/6054))
* Relax `derived` function signature ([#6178](https://github.com/sveltejs/svelte/issues/6178))
* Support `bind:group` in SSR ([#4621](https://github.com/sveltejs/svelte/pull/4621))
* Add sourcemaps to html elements ([#6427](https://github.com/sveltejs/svelte/pull/6427))
* Make `<script>` and `<style>` end tag parsing more robust ([#6511](https://github.com/sveltejs/svelte/pull/6511))
## 3.38.3

59
package-lock.json generated

@ -479,9 +479,9 @@
"dev": true
},
"acorn": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz",
"integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==",
"version": "8.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.4.1.tgz",
"integrity": "sha512-asabaBSkEKosYKMITunzX177CXxQ4Q8BSSzMTKD+FefUhipQC70gfW5SiUDhYQ3vk8G+81HqQk7Fv9OXwwn9KA==",
"dev": true
},
"acorn-globals": {
@ -947,31 +947,32 @@
}
},
"code-red": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/code-red/-/code-red-0.1.4.tgz",
"integrity": "sha512-NPiLFd1EfonYONCNXCH1oVirQMXk5oAOQ3FanRbjB4HZ09rTU/lZGKjVOOP0FKr4pccGVYE5I4CqtyU6ens2VA==",
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/code-red/-/code-red-0.2.1.tgz",
"integrity": "sha512-qn8UyXkRqHJnWkrgc5AGDjkgoqlK5BtelIykSCl89HOV/HMtVxZw2GTwD2A7uMbLgGmch4/KyJX+mcWuPpqCtg==",
"dev": true,
"requires": {
"acorn": "^7.3.1",
"is-reference": "^1.1.4",
"@types/estree": "^0.0.45",
"acorn": "^8.0.5",
"estree-walker": "^0.9.0",
"is-reference": "^2.0.0",
"periscopic": "^2.0.1",
"sourcemap-codec": "^1.4.6"
"sourcemap-codec": "^1.4.8"
},
"dependencies": {
"estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.9.0.tgz",
"integrity": "sha512-12U47o7XHUX329+x3FzNVjCx3SHEzMF0nkDv7r/HnBzX/xNTKxajBk6gyygaxrAFtLj39219oMfbtxv4KpaOiA==",
"dev": true
},
"periscopic": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/periscopic/-/periscopic-2.0.3.tgz",
"integrity": "sha512-FuCZe61mWxQOJAQFEfmt9FjzebRlcpFz8sFPbyaCKtdusPkMEbA9ey0eARnRav5zAhmXznhaQkKGFAPn7X9NUw==",
"is-reference": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-reference/-/is-reference-2.0.0.tgz",
"integrity": "sha512-kgaeJVq59jasPrhlGK/K61muTjLxMOZf4oMwI4X94nDWqkqLxDWVWrecCSP5c6OR8JF7Yul0X7h59lB1ho0epQ==",
"dev": true,
"requires": {
"estree-walker": "^2.0.2",
"is-reference": "^1.1.4"
"@types/estree": "*"
}
}
}
@ -1867,6 +1868,12 @@
"eslint-visitor-keys": "^1.3.0"
},
"dependencies": {
"acorn": {
"version": "7.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"dev": true
},
"eslint-visitor-keys": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
@ -2725,6 +2732,14 @@
"whatwg-url": "^7.0.0",
"ws": "^7.0.0",
"xml-name-validator": "^3.0.0"
},
"dependencies": {
"acorn": {
"version": "7.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"dev": true
}
}
},
"json-parse-better-errors": {
@ -3847,6 +3862,14 @@
"@types/estree": "*",
"@types/node": "*",
"acorn": "^7.1.0"
},
"dependencies": {
"acorn": {
"version": "7.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"dev": true
}
}
},
"rollup-plugin-virtual": {

@ -112,10 +112,10 @@
"@types/node": "^8.10.53",
"@typescript-eslint/eslint-plugin": "^4.9.0",
"@typescript-eslint/parser": "^4.9.0",
"acorn": "^7.4.0",
"acorn": "^8.4.1",
"agadoo": "^1.1.0",
"c8": "^5.0.1",
"code-red": "^0.1.4",
"code-red": "^0.2.1",
"codecov": "^3.5.0",
"css-tree": "^1.1.2",
"eslint": "^7.15.0",

@ -6,12 +6,17 @@ Set up the site sub-project:
git clone https://github.com/sveltejs/svelte.git
cd site
npm ci
npm run update
npm run dev
```
and navigate to [localhost:3000](http://localhost:3000).
The first time you run the site locally, it will update the list of Contributors and REPL dependencies. After this it won't run again unless you force it by running:
```bash
npm run update
```
## Running using the local copy of Svelte
By default, the REPL will fetch the most recent version of Svelte from https://unpkg.com/svelte. When running the site locally, you can also use your local copy of Svelte.
@ -25,7 +30,6 @@ npm ci
PUBLISH=1 npm run build
cd site
npm ci
npm run update
npm run dev
```

@ -24,7 +24,7 @@ All three sections — script, styles and markup — are optional.
A `<script>` block contains JavaScript that runs when a component instance is created. Variables declared (or imported) at the top level are 'visible' from the component's markup. There are four additional rules:
##### 1. `export` creates a component prop
#### 1. `export` creates a component prop
---
@ -87,7 +87,7 @@ You can use reserved words as prop names.
</script>
```
##### 2. Assignments are 'reactive'
#### 2. Assignments are 'reactive'
---
@ -109,7 +109,7 @@ Because Svelte's reactivity is based on assignments, using array methods like `.
</script>
```
##### 3. `$:` marks a statement as reactive
#### 3. `$:` marks a statement as reactive
---
@ -171,13 +171,13 @@ If a statement consists entirely of an assignment to an undeclared variable, Sve
</script>
```
##### 4. Prefix stores with `$` to access their values
#### 4. Prefix stores with `$` to access their values
---
A *store* is an object that allows reactive access to a value via a simple *store contract*. The [`svelte/store` module](docs#svelte_store) contains minimal store implementations which fulfil this contract.
Any time you have a reference to a store, you can access its value inside a component by prefixing it with the `$` character. This causes Svelte to declare the prefixed variable, and set up a store subscription that will be unsubscribed when appropriate.
Any time you have a reference to a store, you can access its value inside a component by prefixing it with the `$` character. This causes Svelte to declare the prefixed variable, subscribe to the store at component initialization and unsubscribe when appropriate.
Assignments to `$`-prefixed variables require that the variable be a writable store, and will result in a call to the store's `.set` method.
@ -321,4 +321,4 @@ In that case, the `<style>` tag will be inserted as-is into the DOM, no scoping
}
</style>
</div>
```
```

@ -136,11 +136,14 @@ An element or component can have multiple spread attributes, interspersed with r
Text can also contain JavaScript expressions:
> If you're using a regular expression (`RegExp`) [literal notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#literal_notation_and_constructor), you'll need to wrap it in parentheses.
```sv
<h1>Hello {name}!</h1>
<p>{a} + {b} = {a + b}.</p>
```
<div>{(/^[A-Za-z ]+$/).test(value) ? x : y}</div>
```
### Comments

@ -44,9 +44,9 @@ The following options can be passed to the compiler. None are required:
| `filename` | string | `null`
| `name` | string | `"Component"`
| `format` | `"esm"` or `"cjs"` | `"esm"`
| `generate` | `"dom"` or `"ssr"` | `"dom"`
| `generate` | `"dom"` or `"ssr"` or `false` | `"dom"`
| `errorMode` | `"throw"` or `"warn"` | `"throw"`
| `varsReport` | `"strict"` or `"full" or false` | `"strict"`
| `varsReport` | `"strict"` or `"full"` or `false` | `"strict"`
| `dev` | boolean | `false`
| `immutable` | boolean | `false`
| `hydratable` | boolean | `false`

@ -38,9 +38,9 @@
<div class="chart" bind:clientWidth={width} bind:clientHeight={height}>
<svg>
<!-- y axis -->
<g class="axis y-axis" transform="translate(0,{padding.top})">
<g class="axis y-axis">
{#each yTicks as tick}
<g class="tick tick-{tick}" transform="translate(0, {yScale(tick) - padding.bottom})">
<g class="tick tick-{tick}" transform="translate(0, {yScale(tick)})">
<line x2="100%"></line>
<text y="-4">{tick} {tick === 20 ? ' per 1,000 population' : ''}</text>
</g>
@ -62,7 +62,7 @@
x="{xScale(i) + 2}"
y="{yScale(point.birthrate)}"
width="{barWidth - 4}"
height="{height - padding.bottom - yScale(point.birthrate)}"
height="{yScale(0) - yScale(point.birthrate)}"
></rect>
{/each}
</g>
@ -115,4 +115,4 @@
stroke: none;
opacity: 0.65;
}
</style>
</style>

@ -1,5 +1,3 @@
<svelte:options immutable/>
<script>
import ImmutableTodo from './ImmutableTodo.svelte';
import MutableTodo from './MutableTodo.svelte';

@ -0,0 +1,19 @@
<script>
import { fly } from 'svelte/transition';
let number = 0;
</script>
<div>
The number is:
<span style="display: inline-block" in:fly={{ y: -20 }}>
{number}
</span>
</div>
<br />
<button
on:click={() => {
number += 1;
}}>
Increment
</button>

@ -0,0 +1,21 @@
<script>
import { fly } from 'svelte/transition';
let number = 0;
</script>
<div>
The number is:
{#key number}
<span style="display: inline-block" in:fly={{ y: -20 }}>
{number}
</span>
{/key}
</div>
<br />
<button
on:click={() => {
number += 1;
}}>
Increment
</button>

@ -0,0 +1,16 @@
---
title: Key blocks
---
Key blocks destroy and recreate their contents when the value of an expression changes.
```html
{#key value}
<div transition:fade>{value}</div>
{/key}
```
This is useful if you want an element to play its transition whenever a value changes instead of only when the element enters or leaves the DOM.
Wrap the `<span>` element in a key block depending on `number`. This will make the
animation play whenever you press the increment button.

@ -1851,19 +1851,6 @@
"integrity": "sha512-Se+LaxqXlVXGvmexKGPvnUIYC1jwXu1H6Pkyb3uBM5d8/NELMYCHs/4/roD7721NxrTLyv7e5nXd5/QLBO+10g==",
"dev": true
},
"cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
"integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
"dev": true,
"requires": {
"nice-try": "^1.0.4",
"path-key": "^2.0.1",
"semver": "^5.5.0",
"shebang-command": "^1.2.0",
"which": "^1.2.9"
}
},
"debug": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
@ -1950,15 +1937,6 @@
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
"dev": true
},
"error-ex": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
"integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
"dev": true,
"requires": {
"is-arrayish": "^0.2.1"
}
},
"es-abstract": {
"version": "1.18.0-next.1",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz",
@ -2139,12 +2117,6 @@
"integrity": "sha512-YSwLaGMOgSBx9roJlNLL12c+FRiw7VECphinc6mGucphc/ZxTHgdEz6gmJqH6NOzYEd/yr64hwjom5pZ+tJVpg==",
"dev": true
},
"graceful-fs": {
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
"dev": true
},
"growl": {
"version": "1.10.5",
"resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz",
@ -2178,12 +2150,6 @@
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
"dev": true
},
"hosted-git-info": {
"version": "2.8.9",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
"dev": true
},
"html-minifier": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-4.0.0.tgz",
@ -2237,12 +2203,6 @@
"integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
"dev": true
},
"is-arrayish": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
"integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
"dev": true
},
"is-buffer": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz",
@ -2396,12 +2356,6 @@
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
"dev": true
},
"json-parse-better-errors": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
"dev": true
},
"json5": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
@ -2471,18 +2425,6 @@
}
}
},
"load-json-file": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
"integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
"parse-json": "^4.0.0",
"pify": "^3.0.0",
"strip-bom": "^3.0.0"
}
},
"locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
@ -2569,12 +2511,6 @@
"resolved": "https://registry.npmjs.org/marked/-/marked-1.2.7.tgz",
"integrity": "sha512-No11hFYcXr/zkBvL6qFmAp1z6BKY3zqLMHny/JN/ey+al7qwCM2+CMBL9BOgqMxZU36fz4cCWfn2poWIf7QRXA=="
},
"memorystream": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz",
"integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=",
"dev": true
},
"merge-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
@ -2724,12 +2660,6 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"nice-try": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true
},
"no-case": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz",
@ -2852,35 +2782,6 @@
}
}
},
"normalize-package-data": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
"integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
"dev": true,
"requires": {
"hosted-git-info": "^2.1.4",
"resolve": "^1.10.0",
"semver": "2 || 3 || 4 || 5",
"validate-npm-package-license": "^3.0.1"
}
},
"npm-run-all": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz",
"integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
"chalk": "^2.4.1",
"cross-spawn": "^6.0.5",
"memorystream": "^0.3.1",
"minimatch": "^3.0.4",
"pidtree": "^0.3.0",
"read-pkg": "^3.0.0",
"shell-quote": "^1.6.1",
"string.prototype.padend": "^3.0.0"
}
},
"object-inspect": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz",
@ -3003,16 +2904,6 @@
"integrity": "sha512-QhhZ+DCCit2Coi2vmAKbq5RGTRcQUOE2+REgv8vdyu7MnYx2eZztegqtTx99TZ86GTIwqiy3+4nQTWZ2tgmdCA==",
"dev": true
},
"parse-json": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
"integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=",
"dev": true,
"requires": {
"error-ex": "^1.3.1",
"json-parse-better-errors": "^1.0.1"
}
},
"path-exists": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
@ -3025,27 +2916,12 @@
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true
},
"path-key": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
"integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
"dev": true
},
"path-parse": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
"dev": true
},
"path-type": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz",
"integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==",
"dev": true,
"requires": {
"pify": "^3.0.0"
}
},
"pg": {
"version": "7.18.2",
"resolved": "https://registry.npmjs.org/pg/-/pg-7.18.2.tgz",
@ -3120,18 +2996,6 @@
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
"dev": true
},
"pidtree": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz",
"integrity": "sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==",
"dev": true
},
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"dev": true
},
"pixelmatch": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz",
@ -3204,17 +3068,6 @@
"safe-buffer": "^5.1.0"
}
},
"read-pkg": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
"integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=",
"dev": true,
"requires": {
"load-json-file": "^4.0.0",
"normalize-package-data": "^2.3.2",
"path-type": "^3.0.0"
}
},
"readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
@ -3441,27 +3294,6 @@
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
"dev": true
},
"shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
"integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
"dev": true,
"requires": {
"shebang-regex": "^1.0.0"
}
},
"shebang-regex": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
"dev": true
},
"shell-quote": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.2.tgz",
"integrity": "sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==",
"dev": true
},
"shelljs": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz",
@ -3519,38 +3351,6 @@
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
"dev": true
},
"spdx-correct": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
"integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
"dev": true,
"requires": {
"spdx-expression-parse": "^3.0.0",
"spdx-license-ids": "^3.0.0"
}
},
"spdx-exceptions": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz",
"integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==",
"dev": true
},
"spdx-expression-parse": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
"integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
"dev": true,
"requires": {
"spdx-exceptions": "^2.1.0",
"spdx-license-ids": "^3.0.0"
}
},
"spdx-license-ids": {
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz",
"integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==",
"dev": true
},
"split2": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz",
@ -3581,17 +3381,6 @@
"strip-ansi": "^4.0.0"
}
},
"string.prototype.padend": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.1.tgz",
"integrity": "sha512-eCzTASPnoCr5Ht+Vn1YXgm8SB015hHKgEIMu9Nr9bQmLhRBxKRfmzSj/IQsxDFc8JInJDDFA0qXwK+xxI7wDkg==",
"dev": true,
"requires": {
"call-bind": "^1.0.0",
"define-properties": "^1.1.3",
"es-abstract": "^1.18.0-next.1"
}
},
"string.prototype.trimend": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz",
@ -3629,12 +3418,6 @@
"ansi-regex": "^3.0.0"
}
},
"strip-bom": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
"dev": true
},
"strip-json-comments": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
@ -3766,16 +3549,6 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"validate-npm-package-license": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
"integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
"dev": true,
"requires": {
"spdx-correct": "^3.0.0",
"spdx-expression-parse": "^3.0.0"
}
},
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",

@ -3,11 +3,11 @@
"version": "1.0.0",
"description": "Docs and examples for Svelte",
"scripts": {
"dev": "npm run copy-workers && sapper dev",
"dev": "node scripts/update.js && npm run copy-workers && sapper dev",
"copy-workers": "node scripts/copy-workers.js",
"migrate": "node-pg-migrate -r dotenv/config",
"build": "npm run copy-workers && sapper build --legacy",
"update": "node scripts/update_template.js && node scripts/get-contributors.js",
"build": "node scripts/update.js && npm run copy-workers && sapper build --legacy",
"update": "node scripts/update.js --force=true",
"start": "node __sapper__/build",
"test": "mocha -r esm test/**",
"deploy": "make deploy"
@ -50,7 +50,6 @@
"mocha": "^6.2.0",
"node-fetch": "^2.6.1",
"node-pg-migrate": "^3.22.0",
"npm-run-all": "^4.1.5",
"rollup": "^2.30.0",
"rollup-plugin-svelte": "^7.0.0",
"rollup-plugin-terser": "^7.0.0",

@ -3,8 +3,16 @@ const fs = require('fs');
const fetch = require('node-fetch');
const Jimp = require('jimp');
const force = process.env.FORCE_UPDATE === 'true';
process.chdir(__dirname);
const outputFile = `../src/routes/_contributors.js`;
if (!force && fs.existsSync(outputFile)) {
console.info(`[update/contributors] ${outputFile} exists. Skipping`);
process.exit(0);
}
const base = `https://api.github.com/repos/sveltejs/svelte/contributors`;
const { GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET } = process.env;
@ -48,7 +56,7 @@ async function main() {
const str = `[\n\t${authors.map(a => `'${a.login}'`).join(',\n\t')}\n]`;
fs.writeFileSync(`../src/routes/_contributors.js`, `export default ${str};`);
fs.writeFileSync(outputFile, `export default ${str};`);
}
main();

@ -0,0 +1,8 @@
const sh = require('shelljs');
sh.env['FORCE_UPDATE'] = process.argv.includes('--force=true');
Promise.all([
sh.exec('node ./scripts/get_contributors.js'),
sh.exec('node ./scripts/update_template.js')
]);

@ -1,7 +1,16 @@
const sh = require('shelljs');
const fs = require('fs');
const path = require('path');
sh.cd(__dirname + '/../');
const force = process.env.FORCE_UPDATE === 'true';
sh.cd(path.join(__dirname, '..'));
const outputFile = 'static/svelte-app.json';
if (!force && fs.existsSync(outputFile)) {
console.info(`[update/template] ${outputFile} exists. Skipping`);
process.exit(0);
}
// fetch svelte app
sh.rm('-rf','scripts/svelte-app');
@ -22,4 +31,4 @@ for (const path of sh.find(appPath).filter(p => fs.lstatSync(p).isFile()) ) {
files.push({ path: path.slice(appPath.length + 1), data });
}
fs.writeFileSync('static/svelte-app.json', JSON.stringify(files));
fs.writeFileSync(outputFile, JSON.stringify(files));

@ -1,6 +1,23 @@
<script context="module">
const title_replacements = {
'1_export_creates_a_component_prop': 'props',
'2_Assignments_are_reactive': 'reactive assignments',
'3_$_marks_a_statement_as_reactive': 'reactive statements ($:)',
'4_Prefix_stores_with_$_to_access_their_values': 'accessing stores ($)'
};
export async function preload() {
const sections = await this.fetch(`docs.json`).then(r => r.json());
for (const section of sections) {
for (const subsection of section.subsections) {
const { slug } = subsection;
// show abbreviated title in the table of contents
if (slug in title_replacements) {
subsection.title = title_replacements[slug];
}
}
}
return { sections };
}
</script>

@ -142,6 +142,15 @@ export default class Selector {
}
}
this.validate_global_with_multiple_selectors(component);
}
validate_global_with_multiple_selectors(component: Component) {
if (this.blocks.length === 1 && this.blocks[0].selectors.length === 1) {
// standalone :global() with multiple selectors is OK
return;
}
for (const block of this.blocks) {
for (const selector of block.selectors) {
if (selector.type === 'PseudoClassSelector' && selector.name === 'global') {
@ -536,11 +545,11 @@ function has_definite_elements(result: Map<Element, NodeExist>): boolean {
function add_to_map(from: Map<Element, NodeExist>, to: Map<Element, NodeExist>) {
from.forEach((exist, element) => {
to.set(element, higher_existance(exist, to.get(element)));
to.set(element, higher_existence(exist, to.get(element)));
});
}
function higher_existance(exist1: NodeExist | null, exist2: NodeExist | null): NodeExist {
function higher_existence(exist1: NodeExist | null, exist2: NodeExist | null): NodeExist {
if (exist1 === undefined || exist2 === undefined) return exist1 || exist2;
return exist1 > exist2 ? exist1 : exist2;
}

@ -65,7 +65,7 @@ export default class Expression {
walk(info, {
enter(node: any, parent: any, key: string) {
// don't manipulate shorthand props twice
if (key === 'value' && parent.shorthand) return;
if (key === 'key' && parent.shorthand) return;
// don't manipulate `import.meta`, `new.target`
if (node.type === 'MetaProperty') return this.skip();

@ -3,7 +3,7 @@ import Component from '../Component';
import Renderer from './Renderer';
import { CompileOptions, CssResult } from '../../interfaces';
import { walk } from 'estree-walker';
import { extract_names, Scope } from '../utils/scope';
import { extract_names, Scope } from 'periscopic';
import { invalidate } from './invalidate';
import Block from './Block';
import { ClassDeclaration, FunctionExpression, Node, Statement, ObjectExpression, Expression } from 'estree';

@ -1,5 +1,5 @@
import { nodes_match } from '../../utils/nodes_match';
import { Scope } from '../utils/scope';
import { Scope } from 'periscopic';
import { x } from 'code-red';
import { Node, Expression } from 'estree';
import Renderer from './Renderer';
@ -52,7 +52,7 @@ export function invalidate(renderer: Renderer, scope: Scope, node: Node, names:
if (is_store_value) {
return x`@set_store_value(${head.name.slice(1)}, ${node}, ${head.name}, ${extra_args})`;
}
let invalidate;
if (!main_execution_context) {
const pass_value = (

@ -19,7 +19,7 @@ import { add_event_handler } from '../shared/add_event_handlers';
import { add_action } from '../shared/add_actions';
import bind_this from '../shared/bind_this';
import { is_head } from '../shared/is_head';
import { Identifier } from 'estree';
import { Identifier, ExpressionStatement, CallExpression } from 'estree';
import EventHandler from './EventHandler';
import { extract_names } from 'periscopic';
import Action from '../../../nodes/Action';
@ -263,15 +263,23 @@ export default class ElementWrapper extends Wrapper {
}
if (parent_node) {
block.chunks.mount.push(
b`@append(${parent_node}, ${node});`
);
const append = b`@append(${parent_node}, ${node});`;
((append[0] as ExpressionStatement).expression as CallExpression).callee.loc = {
start: this.renderer.locate(this.node.start),
end: this.renderer.locate(this.node.end)
};
block.chunks.mount.push(append);
if (is_head(parent_node)) {
block.chunks.destroy.push(b`@detach(${node});`);
}
} else {
block.chunks.mount.push(b`@insert(#target, ${node}, #anchor);`);
const insert = b`@insert(#target, ${node}, #anchor);`;
((insert[0] as ExpressionStatement).expression as CallExpression).callee.loc = {
start: this.renderer.locate(this.node.start),
end: this.renderer.locate(this.node.end)
};
block.chunks.mount.push(insert);
// TODO we eventually need to consider what happens to elements
// that belong to the same outgroup as an outroing element...

@ -344,7 +344,7 @@ export default class InlineComponentWrapper extends Wrapper {
contextual_dependencies.push(object.name, property.name);
}
const params = [x`#value`];
const params: Identifier[] = [x`#value` as Identifier];
const args = [x`#value`];
if (contextual_dependencies.length > 0) {

@ -44,10 +44,19 @@ export default class TextWrapper extends Wrapper {
if (this.skip) return;
const use_space = this.use_space();
const string_literal = {
type: 'Literal',
value: this.data,
loc: {
start: this.renderer.locate(this.node.start),
end: this.renderer.locate(this.node.end)
}
};
block.add_element(
this.var,
use_space ? x`@space()` : x`@text("${this.data}")`,
parent_nodes && (use_space ? x`@claim_space(${parent_nodes})` : x`@claim_text(${parent_nodes}, "${this.data}")`),
use_space ? x`@space()` : x`@text(${string_literal})`,
parent_nodes && (use_space ? x`@claim_space(${parent_nodes})` : x`@claim_text(${parent_nodes}, ${string_literal})`),
parent_node as Identifier
);
}

@ -1,5 +1,5 @@
import { is_void } from '../../../utils/names';
import { get_attribute_value, get_class_attribute_value } from './shared/get_attribute_value';
import { get_attribute_expression, get_attribute_value, get_class_attribute_value } from './shared/get_attribute_value';
import { boolean_attributes } from './shared/boolean_attributes';
import Renderer, { RenderOptions } from '../Renderer';
import Element from '../../nodes/Element';
@ -110,7 +110,14 @@ export default function(node: Element, renderer: Renderer, options: RenderOption
}
if (name === 'group') {
// TODO server-render group bindings
const value_attribute = node.attributes.find(({ name }) => name === 'value');
if (value_attribute) {
const value = get_attribute_expression(value_attribute);
const type = node.get_static_attribute_value('type');
const bound = expression.node;
const condition = type === 'checkbox' ? x`~${bound}.indexOf(${value})`: x`${value} === ${bound}`;
renderer.add_expression(x`${condition} ? @add_attribute("checked", true, 1) : ""`);
}
} else if (contenteditable && (name === 'textContent' || name === 'innerHTML')) {
node_contents = expression.node;

@ -26,3 +26,10 @@ export function get_attribute_value(attribute: Attribute): ESTreeExpression {
})
.reduce((lhs, rhs) => x`${lhs} + ${rhs}`);
}
export function get_attribute_expression(attribute: Attribute): ESTreeExpression {
if (attribute.chunks.length === 1 && attribute.chunks[0].type === 'Expression') {
return (attribute.chunks[0] as Expression).node as ESTreeExpression;
}
return get_attribute_value(attribute);
}

@ -177,9 +177,9 @@ export class Parser {
return identifier;
}
read_until(pattern: RegExp) {
read_until(pattern: RegExp, error_message?: Parameters<Parser['error']>[0]) {
if (this.index >= this.template.length) {
this.error({
this.error(error_message || {
code: 'unexpected-eof',
message: 'Unexpected end of input'
});

@ -3,8 +3,6 @@ import { Parser } from '../index';
import { Script } from '../../interfaces';
import { Node, Program } from 'estree';
const script_closing_tag = '</script>';
function get_context(parser: Parser, attributes: any[], start: number): string {
const context = attributes.find(attribute => attribute.name === 'context');
if (!context) return 'default';
@ -30,18 +28,17 @@ function get_context(parser: Parser, attributes: any[], start: number): string {
export default function read_script(parser: Parser, start: number, attributes: Node[]): Script {
const script_start = parser.index;
const script_end = parser.template.indexOf(script_closing_tag, script_start);
if (script_end === -1) {
parser.error({
code: 'unclosed-script',
message: '<script> must have a closing tag'
});
const error_message = {
code: 'unclosed-script',
message: '<script> must have a closing tag'
};
const data = parser.read_until(/<\/script\s*>/, error_message);
if (parser.index >= parser.template.length) {
parser.error(error_message);
}
const source = parser.template.slice(0, script_start).replace(/[^\n]/g, ' ') +
parser.template.slice(script_start, script_end);
parser.index = script_end + script_closing_tag.length;
const source = parser.template.slice(0, script_start).replace(/[^\n]/g, ' ') + data;
parser.read(/<\/script\s*>/);
let ast: Program;

@ -6,7 +6,17 @@ import { Style } from '../../interfaces';
export default function read_style(parser: Parser, start: number, attributes: Node[]): Style {
const content_start = parser.index;
const styles = parser.read_until(/<\/style>/);
const error_message = {
code: 'unclosed-style',
message: '<style> must have a closing tag'
};
const styles = parser.read_until(/<\/style\s*>/, error_message);
if (parser.index >= parser.template.length) {
parser.error(error_message);
}
const content_end = parser.index;
let ast;
@ -72,7 +82,7 @@ export default function read_style(parser: Parser, start: number, attributes: No
}
});
parser.eat('</style>', true);
parser.read(/<\/style\s*>/);
const end = parser.index;
return {

@ -203,7 +203,7 @@ export interface SvelteComponentTyped<
* class ASubclassOfSvelteComponent extends SvelteComponent<{foo: string}> {}
* const component: typeof SvelteComponent = ASubclassOfSvelteComponent;
* ```
* will throw a type error, so we need to seperate the more strictly typed class.
* will throw a type error, so we need to separate the more strictly typed class.
*/
export class SvelteComponentTyped<
Props extends Record<string, any> = any,

@ -34,54 +34,54 @@ function upper_bound(low: number, high: number, key: (index: number) => number,
function init_hydrate(target: NodeEx) {
if (target.hydrate_init) return;
target.hydrate_init = true;
type NodeEx2 = NodeEx & {claim_order: number};
// We know that all children have claim_order values since the unclaimed have been detached
const children = target.childNodes as NodeListOf<NodeEx2>;
/*
/*
* Reorder claimed children optimally.
* We can reorder claimed children optimally by finding the longest subsequence of
* nodes that are already claimed in order and only moving the rest. The longest
* subsequence subsequence of nodes that are claimed in order can be found by
* computing the longest increasing subsequence of .claim_order values.
*
*
* This algorithm is optimal in generating the least amount of reorder operations
* possible.
*
*
* Proof:
* We know that, given a set of reordering operations, the nodes that do not move
* always form an increasing subsequence, since they do not move among each other
* meaning that they must be already ordered among each other. Thus, the maximal
* set of nodes that do not move form a longest increasing subsequence.
*/
// Compute longest increasing subsequence
// m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j
const m = new Int32Array(children.length + 1);
// Predecessor indices + 1
const p = new Int32Array(children.length);
m[0] = -1;
let longest = 0;
for (let i = 0; i < children.length; i++) {
const current = children[i].claim_order;
// Find the largest subsequence length such that it ends in a value less than our current value
// upper_bound returns first greater value, so we subtract one
const seqLen = upper_bound(1, longest + 1, idx => children[m[idx]].claim_order, current) - 1;
p[i] = m[seqLen] + 1;
const newLen = seqLen + 1;
// We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.
m[newLen] = i;
longest = Math.max(newLen, longest);
}
// The longest increasing subsequence of nodes (initially reversed)
const lis: NodeEx2[] = [];
// The rest of the nodes, nodes that will be moved
@ -98,10 +98,10 @@ function init_hydrate(target: NodeEx) {
toMove.push(children[last]);
}
lis.reverse();
// We sort the nodes being moved to guarantee that their insertion order matches the claim order
toMove.sort((a, b) => a.claim_order - b.claim_order);
// Finally, we move the nodes
for (let i = 0, j = 0; i < toMove.length; i++) {
while (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {
@ -115,7 +115,7 @@ function init_hydrate(target: NodeEx) {
export function append(target: NodeEx, node: NodeEx) {
if (is_hydrating) {
init_hydrate(target);
if ((target.actual_end_child === undefined) || ((target.actual_end_child !== null) && (target.actual_end_child.parentElement !== target))) {
target.actual_end_child = target.firstChild;
}
@ -132,7 +132,7 @@ export function append(target: NodeEx, node: NodeEx) {
export function insert(target: NodeEx, node: NodeEx, anchor?: NodeEx) {
if (is_hydrating && !anchor) {
append(target, node);
} else if (node.parentNode !== target || (anchor && node.nextSibling !== anchor)) {
} else if (node.parentNode !== target || node.nextSibling != anchor) {
target.insertBefore(node, anchor || null);
}
}
@ -309,12 +309,12 @@ function claim_node<R extends ChildNodeEx>(nodes: ChildNodeArray, predicate: (no
if (nodes.claim_info === undefined) {
nodes.claim_info = {last_index: 0, total_claimed: 0};
}
const resultNode = (() => {
// We first try to find an element after the previous one
for (let i = nodes.claim_info.last_index; i < nodes.length; i++) {
const node = nodes[i];
if (predicate(node)) {
processNode(node);
@ -325,13 +325,13 @@ function claim_node<R extends ChildNodeEx>(nodes: ChildNodeArray, predicate: (no
return node;
}
}
// Otherwise, we try to find one before
// We iterate in reverse so that we don't go too far back
for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {
const node = nodes[i];
if (predicate(node)) {
processNode(node);
@ -345,11 +345,11 @@ function claim_node<R extends ChildNodeEx>(nodes: ChildNodeArray, predicate: (no
return node;
}
}
// If we can't find any matching node, we create a new one
return createNode();
})();
resultNode.claim_order = nodes.claim_info.total_claimed;
nodes.claim_info.total_claimed += 1;
return resultNode;

@ -113,7 +113,7 @@ export function writable<T>(value?: T, start: StartStopNotifier<T> = noop): Writ
}
/** One or more `Readable`s. */
type Stores = Readable<any> | [Readable<any>, ...Array<Readable<any>>];
type Stores = Readable<any> | [Readable<any>, ...Array<Readable<any>>] | Array<Readable<any>>;
/** One or more values from `Readable` stores. */
type StoresValues<T> = T extends Readable<infer U> ? U :

@ -56,7 +56,7 @@ function instance($$self, $$props, $$invalidate) {
const foo_function = () => handleFoo(bar);
$$self.$$set = $$props => {
if ("bar" in $$props) $$invalidate(0, bar = $$props.bar);
if ('bar' in $$props) $$invalidate(0, bar = $$props.bar);
};
return [bar, foo_function];

@ -48,11 +48,11 @@ function link(node) {
history.pushState(null, null, event.target.href);
}
node.addEventListener("click", onClick);
node.addEventListener('click', onClick);
return {
destroy() {
node.removeEventListener("click", onClick);
node.removeEventListener('click', onClick);
}
};
}

@ -53,7 +53,7 @@ function instance($$self, $$props, $$invalidate) {
}
$$self.$$set = $$props => {
if ("open" in $$props) $$invalidate(0, open = $$props.open);
if ('open' in $$props) $$invalidate(0, open = $$props.open);
};
return [open, details_toggle_handler];

@ -47,8 +47,8 @@ function instance($$self, $$props, $$invalidate) {
}
$$self.$$set = $$props => {
if ("w" in $$props) $$invalidate(0, w = $$props.w);
if ("h" in $$props) $$invalidate(1, h = $$props.h);
if ('w' in $$props) $$invalidate(0, w = $$props.w);
if ('h' in $$props) $$invalidate(1, h = $$props.h);
};
return [w, h, div_elementresize_handler];

@ -69,7 +69,7 @@ function instance($$self, $$props, $$invalidate) {
}
$$self.$$set = $$props => {
if ("files" in $$props) $$invalidate(0, files = $$props.files);
if ('files' in $$props) $$invalidate(0, files = $$props.files);
};
return [files, input0_change_handler, input1_change_handler];

@ -95,7 +95,7 @@ const moduleContantProps = 4;
let moduleLet;
const moduleConst = 2;
let shadowedByModule;
const priv = "priv";
const priv = 'priv';
function instance($$self, $$props, $$invalidate) {
let computed;
@ -106,22 +106,22 @@ function instance($$self, $$props, $$invalidate) {
$$self.$$.on_destroy.push(() => $$unsubscribe_prop());
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots("Component", slots, []);
validate_slots('Component', slots, []);
let { prop } = $$props;
validate_store(prop, "prop");
validate_store(prop, 'prop');
$$subscribe_prop();
let { alias: realName } = $$props;
let local;
let shadowedByModule;
const writable_props = ["prop", "alias"];
const writable_props = ['prop', 'alias'];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$" && key !== "slot") console.warn(`<Component> was created with unknown prop '${key}'`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Component> was created with unknown prop '${key}'`);
});
$$self.$$set = $$props => {
if ("prop" in $$props) $$subscribe_prop($$invalidate(0, prop = $$props.prop));
if ("alias" in $$props) $$invalidate(1, realName = $$props.alias);
if ('prop' in $$props) $$subscribe_prop($$invalidate(0, prop = $$props.prop));
if ('alias' in $$props) $$invalidate(1, realName = $$props.alias);
};
$$self.$capture_state = () => ({
@ -140,11 +140,11 @@ function instance($$self, $$props, $$invalidate) {
});
$$self.$inject_state = $$props => {
if ("prop" in $$props) $$subscribe_prop($$invalidate(0, prop = $$props.prop));
if ("realName" in $$props) $$invalidate(1, realName = $$props.realName);
if ("local" in $$props) $$invalidate(3, local = $$props.local);
if ("shadowedByModule" in $$props) $$invalidate(4, shadowedByModule = $$props.shadowedByModule);
if ("computed" in $$props) computed = $$props.computed;
if ('prop' in $$props) $$subscribe_prop($$invalidate(0, prop = $$props.prop));
if ('realName' in $$props) $$invalidate(1, realName = $$props.realName);
if ('local' in $$props) $$invalidate(3, local = $$props.local);
if ('shadowedByModule' in $$props) $$invalidate(4, shadowedByModule = $$props.shadowedByModule);
if ('computed' in $$props) computed = $$props.computed;
};
if ($$props && "$$inject" in $$props) {
@ -170,11 +170,11 @@ class Component extends SvelteComponentDev {
const { ctx } = this.$$;
const props = options.props || {};
if (/*prop*/ ctx[0] === undefined && !("prop" in props)) {
if (/*prop*/ ctx[0] === undefined && !('prop' in props)) {
console.warn("<Component> was created without expected prop 'prop'");
}
if (/*realName*/ ctx[1] === undefined && !("alias" in props)) {
if (/*realName*/ ctx[1] === undefined && !('alias' in props)) {
console.warn("<Component> was created without expected prop 'alias'");
}
}

@ -49,7 +49,7 @@ function instance($$self, $$props, $$invalidate) {
let { foo = 42 } = $$props;
$$self.$$set = $$props => {
if ("foo" in $$props) $$invalidate(0, foo = $$props.foo);
if ('foo' in $$props) $$invalidate(0, foo = $$props.foo);
};
return [foo];

@ -16,8 +16,8 @@ import {
transition_out
} from "svelte/internal";
import Foo from "./Foo.svelte";
import Bar from "./Bar.svelte";
import Foo from './Foo.svelte';
import Bar from './Bar.svelte';
function create_fragment(ctx) {
let foo;

@ -13,7 +13,7 @@ import {
text
} from "svelte/internal";
import { writable } from "svelte/store";
import { writable } from 'svelte/store';
function create_fragment(ctx) {
let h1;

@ -7,7 +7,7 @@ import {
set_store_value
} from "svelte/internal";
import { count } from "./store.js";
import { count } from './store.js';
function instance($$self, $$props, $$invalidate) {
let $count;

@ -15,7 +15,7 @@ import {
text
} from "svelte/internal";
import { writable } from "svelte/store";
import { writable } from 'svelte/store';
function create_fragment(ctx) {
let h1;

@ -13,7 +13,7 @@ function instance($$self, $$props, $$invalidate) {
}
$$self.$$set = $$props => {
if ("x" in $$props) $$invalidate(0, x = $$props.x);
if ('x' in $$props) $$invalidate(0, x = $$props.x);
};
return [x, a, b];

@ -48,7 +48,7 @@ function instance($$self, $$props, $$invalidate) {
let { bar } = $$props;
$$self.$$set = $$props => {
if ("bar" in $$props) $$invalidate(0, bar = $$props.bar);
if ('bar' in $$props) $$invalidate(0, bar = $$props.bar);
};
return [bar];

@ -70,22 +70,22 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots("Component", slots, []);
validate_slots('Component', slots, []);
let { name } = $$props;
const writable_props = ["name"];
const writable_props = ['name'];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$" && key !== "slot") console.warn(`<Component> was created with unknown prop '${key}'`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Component> was created with unknown prop '${key}'`);
});
$$self.$$set = $$props => {
if ("name" in $$props) $$invalidate(0, name = $$props.name);
if ('name' in $$props) $$invalidate(0, name = $$props.name);
};
$$self.$capture_state = () => ({ name });
$$self.$inject_state = $$props => {
if ("name" in $$props) $$invalidate(0, name = $$props.name);
if ('name' in $$props) $$invalidate(0, name = $$props.name);
};
if ($$props && "$$inject" in $$props) {
@ -110,7 +110,7 @@ class Component extends SvelteComponentDev {
const { ctx } = this.$$;
const props = options.props || {};
if (/*name*/ ctx[0] === undefined && !("name" in props)) {
if (/*name*/ ctx[0] === undefined && !('name' in props)) {
console.warn("<Component> was created without expected prop 'name'");
}
}

@ -171,31 +171,31 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots("Component", slots, []);
validate_slots('Component', slots, []);
let { things } = $$props;
let { foo } = $$props;
let { bar } = $$props;
let { baz } = $$props;
const writable_props = ["things", "foo", "bar", "baz"];
const writable_props = ['things', 'foo', 'bar', 'baz'];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$" && key !== "slot") console.warn(`<Component> was created with unknown prop '${key}'`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Component> was created with unknown prop '${key}'`);
});
$$self.$$set = $$props => {
if ("things" in $$props) $$invalidate(0, things = $$props.things);
if ("foo" in $$props) $$invalidate(1, foo = $$props.foo);
if ("bar" in $$props) $$invalidate(2, bar = $$props.bar);
if ("baz" in $$props) $$invalidate(3, baz = $$props.baz);
if ('things' in $$props) $$invalidate(0, things = $$props.things);
if ('foo' in $$props) $$invalidate(1, foo = $$props.foo);
if ('bar' in $$props) $$invalidate(2, bar = $$props.bar);
if ('baz' in $$props) $$invalidate(3, baz = $$props.baz);
};
$$self.$capture_state = () => ({ things, foo, bar, baz });
$$self.$inject_state = $$props => {
if ("things" in $$props) $$invalidate(0, things = $$props.things);
if ("foo" in $$props) $$invalidate(1, foo = $$props.foo);
if ("bar" in $$props) $$invalidate(2, bar = $$props.bar);
if ("baz" in $$props) $$invalidate(3, baz = $$props.baz);
if ('things' in $$props) $$invalidate(0, things = $$props.things);
if ('foo' in $$props) $$invalidate(1, foo = $$props.foo);
if ('bar' in $$props) $$invalidate(2, bar = $$props.bar);
if ('baz' in $$props) $$invalidate(3, baz = $$props.baz);
};
if ($$props && "$$inject" in $$props) {
@ -220,19 +220,19 @@ class Component extends SvelteComponentDev {
const { ctx } = this.$$;
const props = options.props || {};
if (/*things*/ ctx[0] === undefined && !("things" in props)) {
if (/*things*/ ctx[0] === undefined && !('things' in props)) {
console.warn("<Component> was created without expected prop 'things'");
}
if (/*foo*/ ctx[1] === undefined && !("foo" in props)) {
if (/*foo*/ ctx[1] === undefined && !('foo' in props)) {
console.warn("<Component> was created without expected prop 'foo'");
}
if (/*bar*/ ctx[2] === undefined && !("bar" in props)) {
if (/*bar*/ ctx[2] === undefined && !('bar' in props)) {
console.warn("<Component> was created without expected prop 'bar'");
}
if (/*baz*/ ctx[3] === undefined && !("baz" in props)) {
if (/*baz*/ ctx[3] === undefined && !('baz' in props)) {
console.warn("<Component> was created without expected prop 'baz'");
}
}

@ -165,25 +165,25 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots("Component", slots, []);
validate_slots('Component', slots, []);
let { things } = $$props;
let { foo } = $$props;
const writable_props = ["things", "foo"];
const writable_props = ['things', 'foo'];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$" && key !== "slot") console.warn(`<Component> was created with unknown prop '${key}'`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Component> was created with unknown prop '${key}'`);
});
$$self.$$set = $$props => {
if ("things" in $$props) $$invalidate(0, things = $$props.things);
if ("foo" in $$props) $$invalidate(1, foo = $$props.foo);
if ('things' in $$props) $$invalidate(0, things = $$props.things);
if ('foo' in $$props) $$invalidate(1, foo = $$props.foo);
};
$$self.$capture_state = () => ({ things, foo });
$$self.$inject_state = $$props => {
if ("things" in $$props) $$invalidate(0, things = $$props.things);
if ("foo" in $$props) $$invalidate(1, foo = $$props.foo);
if ('things' in $$props) $$invalidate(0, things = $$props.things);
if ('foo' in $$props) $$invalidate(1, foo = $$props.foo);
};
if ($$props && "$$inject" in $$props) {
@ -208,11 +208,11 @@ class Component extends SvelteComponentDev {
const { ctx } = this.$$;
const props = options.props || {};
if (/*things*/ ctx[0] === undefined && !("things" in props)) {
if (/*things*/ ctx[0] === undefined && !('things' in props)) {
console.warn("<Component> was created without expected prop 'things'");
}
if (/*foo*/ ctx[1] === undefined && !("foo" in props)) {
if (/*foo*/ ctx[1] === undefined && !('foo' in props)) {
console.warn("<Component> was created without expected prop 'foo'");
}
}

@ -50,20 +50,20 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots("Component", slots, []);
validate_slots('Component', slots, []);
let obj = { x: 5 };
let kobzol = 5;
const writable_props = [];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$" && key !== "slot") console.warn(`<Component> was created with unknown prop '${key}'`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Component> was created with unknown prop '${key}'`);
});
$$self.$capture_state = () => ({ obj, kobzol });
$$self.$inject_state = $$props => {
if ("obj" in $$props) $$invalidate(0, obj = $$props.obj);
if ("kobzol" in $$props) $$invalidate(1, kobzol = $$props.kobzol);
if ('obj' in $$props) $$invalidate(0, obj = $$props.obj);
if ('kobzol' in $$props) $$invalidate(1, kobzol = $$props.kobzol);
};
if ($$props && "$$inject" in $$props) {

@ -137,11 +137,11 @@ function create_fragment(ctx) {
function instance($$self, $$props) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots("Component", slots, []);
validate_slots('Component', slots, []);
const writable_props = [];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$" && key !== "slot") console.warn(`<Component> was created with unknown prop '${key}'`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Component> was created with unknown prop '${key}'`);
});
return [];

@ -105,7 +105,7 @@ function instance($$self, $$props, $$invalidate) {
let { createElement } = $$props;
$$self.$$set = $$props => {
if ("createElement" in $$props) $$invalidate(0, createElement = $$props.createElement);
if ('createElement' in $$props) $$invalidate(0, createElement = $$props.createElement);
};
return [createElement];

@ -1,17 +1,17 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent, init, safe_not_equal } from "svelte/internal";
import { onMount } from "svelte";
import { onMount } from 'svelte';
function instance($$self, $$props, $$invalidate) {
let { foo = "bar" } = $$props;
let { foo = 'bar' } = $$props;
onMount(() => {
alert(JSON.stringify(data()));
});
$$self.$$set = $$props => {
if ("foo" in $$props) $$invalidate(0, foo = $$props.foo);
if ('foo' in $$props) $$invalidate(0, foo = $$props.foo);
};
return [foo];

@ -66,24 +66,24 @@ function create_fragment(ctx) {
function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots("Component", slots, []);
validate_slots('Component', slots, []);
let { foo } = $$props;
let bar;
const writable_props = ["foo"];
const writable_props = ['foo'];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$" && key !== "slot") console.warn(`<Component> was created with unknown prop '${key}'`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`<Component> was created with unknown prop '${key}'`);
});
$$self.$$set = $$props => {
if ("foo" in $$props) $$invalidate(0, foo = $$props.foo);
if ('foo' in $$props) $$invalidate(0, foo = $$props.foo);
};
$$self.$capture_state = () => ({ foo, bar });
$$self.$inject_state = $$props => {
if ("foo" in $$props) $$invalidate(0, foo = $$props.foo);
if ("bar" in $$props) $$invalidate(1, bar = $$props.bar);
if ('foo' in $$props) $$invalidate(0, foo = $$props.foo);
if ('bar' in $$props) $$invalidate(1, bar = $$props.bar);
};
if ($$props && "$$inject" in $$props) {
@ -114,7 +114,7 @@ class Component extends SvelteComponentDev {
const { ctx } = this.$$;
const props = options.props || {};
if (/*foo*/ ctx[0] === undefined && !("foo" in props)) {
if (/*foo*/ ctx[0] === undefined && !('foo' in props)) {
console.warn("<Component> was created without expected prop 'foo'");
}
}

@ -11,7 +11,7 @@ import {
transition_out
} from "svelte/internal";
import LazyLoad from "./LazyLoad.svelte";
import LazyLoad from './LazyLoad.svelte';
function create_fragment(ctx) {
let lazyload;
@ -42,7 +42,7 @@ function create_fragment(ctx) {
};
}
const func = () => import("./Foo.svelte");
const func = () => import('./Foo.svelte');
class Component extends SvelteComponent {
constructor(options) {

@ -107,11 +107,11 @@ function instance($$self, $$props, $$invalidate) {
let { e } = $$props;
$$self.$$set = $$props => {
if ("a" in $$props) $$invalidate(0, a = $$props.a);
if ("b" in $$props) $$invalidate(1, b = $$props.b);
if ("c" in $$props) $$invalidate(2, c = $$props.c);
if ("d" in $$props) $$invalidate(3, d = $$props.d);
if ("e" in $$props) $$invalidate(4, e = $$props.e);
if ('a' in $$props) $$invalidate(0, a = $$props.a);
if ('b' in $$props) $$invalidate(1, b = $$props.b);
if ('c' in $$props) $$invalidate(2, c = $$props.c);
if ('d' in $$props) $$invalidate(3, d = $$props.d);
if ('e' in $$props) $$invalidate(4, e = $$props.e);
};
return [a, b, c, d, e];

@ -154,10 +154,10 @@ function instance($$self, $$props, $$invalidate) {
let { foo } = $$props;
$$self.$$set = $$props => {
if ("comments" in $$props) $$invalidate(0, comments = $$props.comments);
if ("elapsed" in $$props) $$invalidate(1, elapsed = $$props.elapsed);
if ("time" in $$props) $$invalidate(2, time = $$props.time);
if ("foo" in $$props) $$invalidate(3, foo = $$props.foo);
if ('comments' in $$props) $$invalidate(0, comments = $$props.comments);
if ('elapsed' in $$props) $$invalidate(1, elapsed = $$props.elapsed);
if ('time' in $$props) $$invalidate(2, time = $$props.time);
if ('foo' in $$props) $$invalidate(3, foo = $$props.foo);
};
return [comments, elapsed, time, foo];

@ -130,7 +130,7 @@ function instance($$self, $$props, $$invalidate) {
let { things } = $$props;
$$self.$$set = $$props => {
if ("things" in $$props) $$invalidate(0, things = $$props.things);
if ('things' in $$props) $$invalidate(0, things = $$props.things);
};
return [things];

@ -99,7 +99,7 @@ function instance($$self, $$props, $$invalidate) {
let { things } = $$props;
$$self.$$set = $$props => {
if ("things" in $$props) $$invalidate(0, things = $$props.things);
if ('things' in $$props) $$invalidate(0, things = $$props.things);
};
return [things];

@ -89,7 +89,7 @@ function instance($$self, $$props, $$invalidate) {
let { foo } = $$props;
$$self.$$set = $$props => {
if ("foo" in $$props) $$invalidate(0, foo = $$props.foo);
if ('foo' in $$props) $$invalidate(0, foo = $$props.foo);
};
return [foo];

@ -67,7 +67,7 @@ function instance($$self, $$props, $$invalidate) {
let { foo } = $$props;
$$self.$$set = $$props => {
if ("foo" in $$props) $$invalidate(0, foo = $$props.foo);
if ('foo' in $$props) $$invalidate(0, foo = $$props.foo);
};
return [foo];

@ -45,9 +45,9 @@ function instance($$self, $$props, $$invalidate) {
let { y } = $$props;
$$self.$$set = $$props => {
if ("color" in $$props) $$invalidate(0, color = $$props.color);
if ("x" in $$props) $$invalidate(1, x = $$props.x);
if ("y" in $$props) $$invalidate(2, y = $$props.y);
if ('color' in $$props) $$invalidate(0, color = $$props.color);
if ('x' in $$props) $$invalidate(1, x = $$props.x);
if ('y' in $$props) $$invalidate(2, y = $$props.y);
};
return [color, x, y];

@ -38,7 +38,7 @@ function instance($$self, $$props, $$invalidate) {
let { data } = $$props;
$$self.$$set = $$props => {
if ("data" in $$props) $$invalidate(0, data = $$props.data);
if ('data' in $$props) $$invalidate(0, data = $$props.data);
};
return [data];

@ -38,7 +38,7 @@ function instance($$self, $$props, $$invalidate) {
let { color } = $$props;
$$self.$$set = $$props => {
if ("color" in $$props) $$invalidate(0, color = $$props.color);
if ('color' in $$props) $$invalidate(0, color = $$props.color);
};
return [color];

@ -55,9 +55,9 @@ function instance($$self, $$props, $$invalidate) {
let { value } = $$props;
$$self.$$set = $$props => {
if ("style" in $$props) $$invalidate(0, style = $$props.style);
if ("key" in $$props) $$invalidate(1, key = $$props.key);
if ("value" in $$props) $$invalidate(2, value = $$props.value);
if ('style' in $$props) $$invalidate(0, style = $$props.style);
if ('key' in $$props) $$invalidate(1, key = $$props.key);
if ('value' in $$props) $$invalidate(2, value = $$props.value);
};
return [style, key, value];

@ -30,7 +30,7 @@ function create_fragment(ctx) {
};
}
let color = "red";
let color = 'red';
class Component extends SvelteComponent {
constructor(options) {

@ -50,7 +50,7 @@ function instance($$self, $$props, $$invalidate) {
}
$$self.$$set = $$props => {
if ("files" in $$props) $$invalidate(0, files = $$props.files);
if ('files' in $$props) $$invalidate(0, files = $$props.files);
};
return [files, input_change_handler];

@ -69,7 +69,7 @@ function instance($$self, $$props, $$invalidate) {
function handleSubmit(event) {
event.preventDefault();
console.log("value", test);
console.log('value', test);
}
function input_input_handler() {

@ -61,7 +61,7 @@ function instance($$self, $$props, $$invalidate) {
}
$$self.$$set = $$props => {
if ("value" in $$props) $$invalidate(0, value = $$props.value);
if ('value' in $$props) $$invalidate(0, value = $$props.value);
};
return [value, input_change_input_handler];

@ -64,7 +64,7 @@ function create_fragment(ctx) {
}
function instance($$self, $$props, $$invalidate) {
let name = "change me";
let name = 'change me';
function onInput(event) {
$$invalidate(0, name = event.target.value);

@ -54,7 +54,7 @@ function instance($$self, $$props, $$invalidate) {
}
$$self.$$set = $$props => {
if ("foo" in $$props) $$invalidate(0, foo = $$props.foo);
if ('foo' in $$props) $$invalidate(0, foo = $$props.foo);
};
return [foo, input_change_handler];

@ -54,7 +54,7 @@ function create_fragment(ctx) {
}
function foo() {
const guard = "foo";
const guard = 'foo';
{
const guard_1 = loop_guard(100);
@ -68,7 +68,7 @@ function foo() {
function instance($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
validate_slots("Component", slots, []);
validate_slots('Component', slots, []);
let node;
{
@ -110,11 +110,11 @@ function instance($$self, $$props, $$invalidate) {
const writable_props = [];
Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$" && key !== "slot") console_1.warn(`<Component> was created with unknown prop '${key}'`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console_1.warn(`<Component> was created with unknown prop '${key}'`);
});
function div_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
node = $$value;
$$invalidate(0, node);
});
@ -123,7 +123,7 @@ function instance($$self, $$props, $$invalidate) {
$$self.$capture_state = () => ({ node, foo });
$$self.$inject_state = $$props => {
if ("node" in $$props) $$invalidate(0, node = $$props.node);
if ('node' in $$props) $$invalidate(0, node = $$props.node);
};
if ($$props && "$$inject" in $$props) {

@ -174,17 +174,17 @@ function instance($$self, $$props, $$invalidate) {
}
$$self.$$set = $$props => {
if ("buffered" in $$props) $$invalidate(0, buffered = $$props.buffered);
if ("seekable" in $$props) $$invalidate(1, seekable = $$props.seekable);
if ("played" in $$props) $$invalidate(2, played = $$props.played);
if ("currentTime" in $$props) $$invalidate(3, currentTime = $$props.currentTime);
if ("duration" in $$props) $$invalidate(4, duration = $$props.duration);
if ("paused" in $$props) $$invalidate(5, paused = $$props.paused);
if ("volume" in $$props) $$invalidate(6, volume = $$props.volume);
if ("muted" in $$props) $$invalidate(7, muted = $$props.muted);
if ("playbackRate" in $$props) $$invalidate(8, playbackRate = $$props.playbackRate);
if ("seeking" in $$props) $$invalidate(9, seeking = $$props.seeking);
if ("ended" in $$props) $$invalidate(10, ended = $$props.ended);
if ('buffered' in $$props) $$invalidate(0, buffered = $$props.buffered);
if ('seekable' in $$props) $$invalidate(1, seekable = $$props.seekable);
if ('played' in $$props) $$invalidate(2, played = $$props.played);
if ('currentTime' in $$props) $$invalidate(3, currentTime = $$props.currentTime);
if ('duration' in $$props) $$invalidate(4, duration = $$props.duration);
if ('paused' in $$props) $$invalidate(5, paused = $$props.paused);
if ('volume' in $$props) $$invalidate(6, volume = $$props.volume);
if ('muted' in $$props) $$invalidate(7, muted = $$props.muted);
if ('playbackRate' in $$props) $$invalidate(8, playbackRate = $$props.playbackRate);
if ('seeking' in $$props) $$invalidate(9, seeking = $$props.seeking);
if ('ended' in $$props) $$invalidate(10, ended = $$props.ended);
};
return [

@ -14,7 +14,7 @@ import {
transition_out
} from "svelte/internal";
import Imported from "Imported.svelte";
import Imported from 'Imported.svelte';
function create_fragment(ctx) {
let imported;

@ -29,7 +29,7 @@ function create_fragment(ctx) {
};
}
let name = "world";
let name = 'world';
class Component extends SvelteComponent {
constructor(options) {

@ -23,9 +23,9 @@ function create_fragment(ctx) {
let t1_value = /*b*/ ctx[1]?.optional + "";
let t1;
let t2;
let t3_value = /*c*/ ctx[2]["computed"] + "";
let t3_value = /*c*/ ctx[2]['computed'] + "";
let t3;
let t4_value = /*d*/ ctx[3]?.["computed_optional"] + "";
let t4_value = /*d*/ ctx[3]?.['computed_optional'] + "";
let t4;
let t5;
let t6_value = /*e*/ ctx[4]() + "";
@ -48,8 +48,8 @@ function create_fragment(ctx) {
props: {
a: /*a*/ ctx[0].normal,
b: /*b*/ ctx[1]?.optional,
c: /*c*/ ctx[2]["computed"],
d: /*d*/ ctx[3]?.["computed_optional"],
c: /*c*/ ctx[2]['computed'],
d: /*d*/ ctx[3]?.['computed_optional'],
e: /*e*/ ctx[4](),
f: /*f*/ ctx[5]?.()
}
@ -71,8 +71,8 @@ function create_fragment(ctx) {
create_component(component.$$.fragment);
attr(div, "a", div_a_value = /*a*/ ctx[0].normal);
attr(div, "b", div_b_value = /*b*/ ctx[1]?.optional);
attr(div, "c", div_c_value = /*c*/ ctx[2]["computed"]);
attr(div, "d", div_d_value = /*d*/ ctx[3]?.["computed_optional"]);
attr(div, "c", div_c_value = /*c*/ ctx[2]['computed']);
attr(div, "d", div_d_value = /*d*/ ctx[3]?.['computed_optional']);
attr(div, "e", div_e_value = /*e*/ ctx[4]());
attr(div, "f", div_f_value = /*f*/ ctx[5]?.());
},
@ -94,8 +94,8 @@ function create_fragment(ctx) {
p(ctx, [dirty]) {
if ((!current || dirty & /*a*/ 1) && t0_value !== (t0_value = /*a*/ ctx[0].normal + "")) set_data(t0, t0_value);
if ((!current || dirty & /*b*/ 2) && t1_value !== (t1_value = /*b*/ ctx[1]?.optional + "")) set_data(t1, t1_value);
if ((!current || dirty & /*c*/ 4) && t3_value !== (t3_value = /*c*/ ctx[2]["computed"] + "")) set_data(t3, t3_value);
if ((!current || dirty & /*d*/ 8) && t4_value !== (t4_value = /*d*/ ctx[3]?.["computed_optional"] + "")) set_data(t4, t4_value);
if ((!current || dirty & /*c*/ 4) && t3_value !== (t3_value = /*c*/ ctx[2]['computed'] + "")) set_data(t3, t3_value);
if ((!current || dirty & /*d*/ 8) && t4_value !== (t4_value = /*d*/ ctx[3]?.['computed_optional'] + "")) set_data(t4, t4_value);
if ((!current || dirty & /*e*/ 16) && t6_value !== (t6_value = /*e*/ ctx[4]() + "")) set_data(t6, t6_value);
if ((!current || dirty & /*f*/ 32) && t7_value !== (t7_value = /*f*/ ctx[5]?.() + "")) set_data(t7, t7_value);
@ -107,11 +107,11 @@ function create_fragment(ctx) {
attr(div, "b", div_b_value);
}
if (!current || dirty & /*c*/ 4 && div_c_value !== (div_c_value = /*c*/ ctx[2]["computed"])) {
if (!current || dirty & /*c*/ 4 && div_c_value !== (div_c_value = /*c*/ ctx[2]['computed'])) {
attr(div, "c", div_c_value);
}
if (!current || dirty & /*d*/ 8 && div_d_value !== (div_d_value = /*d*/ ctx[3]?.["computed_optional"])) {
if (!current || dirty & /*d*/ 8 && div_d_value !== (div_d_value = /*d*/ ctx[3]?.['computed_optional'])) {
attr(div, "d", div_d_value);
}
@ -126,8 +126,8 @@ function create_fragment(ctx) {
const component_changes = {};
if (dirty & /*a*/ 1) component_changes.a = /*a*/ ctx[0].normal;
if (dirty & /*b*/ 2) component_changes.b = /*b*/ ctx[1]?.optional;
if (dirty & /*c*/ 4) component_changes.c = /*c*/ ctx[2]["computed"];
if (dirty & /*d*/ 8) component_changes.d = /*d*/ ctx[3]?.["computed_optional"];
if (dirty & /*c*/ 4) component_changes.c = /*c*/ ctx[2]['computed'];
if (dirty & /*d*/ 8) component_changes.d = /*d*/ ctx[3]?.['computed_optional'];
if (dirty & /*e*/ 16) component_changes.e = /*e*/ ctx[4]();
if (dirty & /*f*/ 32) component_changes.f = /*f*/ ctx[5]?.();
component.$set(component_changes);
@ -168,12 +168,12 @@ function instance($$self, $$props, $$invalidate) {
let Component;
$$self.$$set = $$props => {
if ("a" in $$props) $$invalidate(0, a = $$props.a);
if ("b" in $$props) $$invalidate(1, b = $$props.b);
if ("c" in $$props) $$invalidate(2, c = $$props.c);
if ("d" in $$props) $$invalidate(3, d = $$props.d);
if ("e" in $$props) $$invalidate(4, e = $$props.e);
if ("f" in $$props) $$invalidate(5, f = $$props.f);
if ('a' in $$props) $$invalidate(0, a = $$props.a);
if ('b' in $$props) $$invalidate(1, b = $$props.b);
if ('c' in $$props) $$invalidate(2, c = $$props.c);
if ('d' in $$props) $$invalidate(3, d = $$props.d);
if ('e' in $$props) $$invalidate(4, e = $$props.e);
if ('f' in $$props) $$invalidate(5, f = $$props.f);
};
return [a, b, c, d, e, f, Component];

@ -13,7 +13,7 @@ import {
toggle_class
} from "svelte/internal";
import { reactiveStoreVal, unreactiveExport } from "./store";
import { reactiveStoreVal, unreactiveExport } from './store';
function create_fragment(ctx) {
let div0;
@ -159,4 +159,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -7,7 +7,7 @@ function instance($$self, $$props, $$invalidate) {
let b;
$$self.$$set = $$props => {
if ("x" in $$props) $$invalidate(0, x = $$props.x);
if ('x' in $$props) $$invalidate(0, x = $$props.x);
};
$$self.$$.update = () => {

@ -6,13 +6,13 @@ function instance($$self, $$props, $$invalidate) {
let { b = 2 } = $$props;
$$self.$$set = $$props => {
if ("a" in $$props) $$invalidate(0, a = $$props.a);
if ("b" in $$props) $$invalidate(1, b = $$props.b);
if ('a' in $$props) $$invalidate(0, a = $$props.a);
if ('b' in $$props) $$invalidate(1, b = $$props.b);
};
$$self.$$.update = () => {
if ($$self.$$.dirty & /*a, b*/ 3) {
$: console.log("max", Math.max(a, b));
$: console.log('max', Math.max(a, b));
}
};

@ -51,7 +51,7 @@ function instance($$self, $$props, $$invalidate) {
let { current } = $$props;
$$self.$$set = $$props => {
if ("current" in $$props) $$invalidate(0, current = $$props.current);
if ('current' in $$props) $$invalidate(0, current = $$props.current);
};
return [current];

@ -68,8 +68,8 @@ function instance($$self, $$props, $$invalidate) {
let { slug } = $$props;
$$self.$$set = $$props => {
if ("url" in $$props) $$invalidate(0, url = $$props.url);
if ("slug" in $$props) $$invalidate(1, slug = $$props.slug);
if ('url' in $$props) $$invalidate(0, url = $$props.url);
if ('slug' in $$props) $$invalidate(1, slug = $$props.slug);
};
return [url, slug];

@ -1,14 +1,14 @@
/* generated by Svelte vX.Y.Z */
import { create_ssr_component } from "svelte/internal";
import { onDestroy, onMount } from "svelte";
import { onDestroy, onMount } from 'svelte';
function preload(input) {
return output;
}
function foo() {
console.log("foo");
console.log('foo');
}
function swipe(node, callback) {
@ -17,11 +17,11 @@ function swipe(node, callback) {
const Component = create_ssr_component(($$result, $$props, $$bindings, slots) => {
onMount(() => {
console.log("onMount");
console.log('onMount');
});
onDestroy(() => {
console.log("onDestroy");
console.log('onDestroy');
});
return ``;

@ -23,7 +23,7 @@ function instance($$self, $$props, $$invalidate) {
let { custom } = $$props;
$$self.$$set = $$props => {
if ("custom" in $$props) $$invalidate(0, custom = $$props.custom);
if ('custom' in $$props) $$invalidate(0, custom = $$props.custom);
};
return [custom];

@ -125,8 +125,8 @@ function instance($$self, $$props, $$invalidate) {
let { y } = $$props;
$$self.$$set = $$props => {
if ("x" in $$props) $$invalidate(0, x = $$props.x);
if ("y" in $$props) $$invalidate(1, y = $$props.y);
if ('x' in $$props) $$invalidate(0, x = $$props.x);
if ('y' in $$props) $$invalidate(1, y = $$props.y);
};
return [x, y];

@ -14,7 +14,7 @@ import {
transition_out
} from "svelte/internal";
import { fade } from "svelte/transition";
import { fade } from 'svelte/transition';
function create_if_block(ctx) {
let div;
@ -103,7 +103,7 @@ function instance($$self, $$props, $$invalidate) {
let { num = 1 } = $$props;
$$self.$$set = $$props => {
if ("num" in $$props) $$invalidate(0, num = $$props.num);
if ('num' in $$props) $$invalidate(0, num = $$props.num);
};
return [num];

@ -69,14 +69,14 @@ function create_fragment(ctx) {
};
}
let world1 = "world";
let world2 = "world";
let world1 = 'world';
let world2 = 'world';
function instance($$self, $$props, $$invalidate) {
const world3 = "world";
const world3 = 'world';
function foo() {
$$invalidate(0, world3 = "svelte");
$$invalidate(0, world3 = 'svelte');
}
return [world3];

@ -12,7 +12,7 @@ import {
text
} from "svelte/internal";
import { onMount } from "svelte";
import { onMount } from 'svelte';
function create_fragment(ctx) {
let p;

@ -244,11 +244,11 @@ function instance($$self, $$props, $$invalidate) {
let { e } = $$props;
$$self.$$set = $$props => {
if ("a" in $$props) $$invalidate(0, a = $$props.a);
if ("b" in $$props) $$invalidate(1, b = $$props.b);
if ("c" in $$props) $$invalidate(2, c = $$props.c);
if ("d" in $$props) $$invalidate(3, d = $$props.d);
if ("e" in $$props) $$invalidate(4, e = $$props.e);
if ('a' in $$props) $$invalidate(0, a = $$props.a);
if ('b' in $$props) $$invalidate(1, b = $$props.b);
if ('c' in $$props) $$invalidate(2, c = $$props.c);
if ('d' in $$props) $$invalidate(3, d = $$props.d);
if ('e' in $$props) $$invalidate(4, e = $$props.e);
};
return [a, b, c, d, e];

@ -94,10 +94,10 @@ function instance($$self, $$props, $$invalidate) {
}
$$self.$$set = $$props => {
if ("currentTime" in $$props) $$invalidate(0, currentTime = $$props.currentTime);
if ("videoHeight" in $$props) $$invalidate(1, videoHeight = $$props.videoHeight);
if ("videoWidth" in $$props) $$invalidate(2, videoWidth = $$props.videoWidth);
if ("offsetWidth" in $$props) $$invalidate(3, offsetWidth = $$props.offsetWidth);
if ('currentTime' in $$props) $$invalidate(0, currentTime = $$props.currentTime);
if ('videoHeight' in $$props) $$invalidate(1, videoHeight = $$props.videoHeight);
if ('videoWidth' in $$props) $$invalidate(2, videoWidth = $$props.videoWidth);
if ('offsetWidth' in $$props) $$invalidate(3, offsetWidth = $$props.offsetWidth);
};
return [

@ -79,7 +79,7 @@ function instance($$self, $$props, $$invalidate) {
}
$$self.$$set = $$props => {
if ("y" in $$props) $$invalidate(0, y = $$props.y);
if ('y' in $$props) $$invalidate(0, y = $$props.y);
};
return [y, onwindowscroll];

@ -0,0 +1,10 @@
{
"code": "unclosed-script",
"message": "<script> must have a closing tag",
"start": {
"line": 3,
"column": 22,
"character": 32
},
"pos": 32
}

@ -0,0 +1,10 @@
{
"code": "unclosed-style",
"message": "<style> must have a closing tag",
"start": {
"line": 3,
"column": 22,
"character": 31
},
"pos": 31
}

@ -0,0 +1,10 @@
{
"code": "unclosed-style",
"message": "<style> must have a closing tag",
"start": {
"line": 3,
"column": 7,
"character": 31
},
"pos": 31
}

@ -0,0 +1,3 @@
<h1>Hello {name}!</h1>
<style>

@ -0,0 +1,10 @@
<script>
let name = 'world';
</script
>
<h1>Hello {name}!</h1>

@ -0,0 +1,150 @@
{
"html": {
"start": 51,
"end": 73,
"type": "Fragment",
"children": [
{
"start": 49,
"end": 51,
"type": "Text",
"raw": "\n\n",
"data": "\n\n"
},
{
"start": 51,
"end": 73,
"type": "Element",
"name": "h1",
"attributes": [],
"children": [
{
"start": 55,
"end": 61,
"type": "Text",
"raw": "Hello ",
"data": "Hello "
},
{
"start": 61,
"end": 67,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 62,
"end": 66,
"loc": {
"start": {
"line": 10,
"column": 11
},
"end": {
"line": 10,
"column": 15
}
},
"name": "name"
}
},
{
"start": 67,
"end": 68,
"type": "Text",
"raw": "!",
"data": "!"
}
]
}
]
},
"instance": {
"type": "Script",
"start": 0,
"end": 49,
"context": "default",
"content": {
"type": "Program",
"start": 8,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 0
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 10,
"end": 29,
"loc": {
"start": {
"line": 2,
"column": 1
},
"end": {
"line": 2,
"column": 20
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 14,
"end": 28,
"loc": {
"start": {
"line": 2,
"column": 5
},
"end": {
"line": 2,
"column": 19
}
},
"id": {
"type": "Identifier",
"start": 14,
"end": 18,
"loc": {
"start": {
"line": 2,
"column": 5
},
"end": {
"line": 2,
"column": 9
}
},
"name": "name"
},
"init": {
"type": "Literal",
"start": 21,
"end": 28,
"loc": {
"start": {
"line": 2,
"column": 12
},
"end": {
"line": 2,
"column": 19
}
},
"value": "world",
"raw": "'world'"
}
}
],
"kind": "let"
}
],
"sourceType": "module"
}
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save