Merge branch 'master' into feat/edge-site

pull/8873/head
Puru Vijay 3 years ago
commit 76a408567f

@ -1,5 +0,0 @@
---
'svelte': patch
---
fix: align `disclose-version` exports specification

@ -1,5 +0,0 @@
---
'svelte': patch
---
fix: check srcset when hydrating to prevent needless requests

@ -16,13 +16,9 @@ We think it'll give you a much nicer development experience — one that also sc
## Try it now
You can start a new Svelte TypeScript project using the [normal template](https://github.com/sveltejs/template) and by running `node scripts/setupTypeScript.js` before you do anything else:
You can start a new Svelte TypeScript project using Svelte's official scaffolding CLI by running `npm create svelte@latest` and following the prompts. This sets up a new SvelteKit project for you.
```bash
npx degit sveltejs/template svelte-typescript-app
cd svelte-typescript-app
node scripts/setupTypeScript.js
```
Alternatively you can run `npm create vite@latest myapp -- --template svelte-ts` to scaffold a Vite project using Svelte and TypeScript.
If you're a VS Code user, make sure you're using the (new) [official extension](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode), which replaces the popular extension by James Birtles.
Later in this blog post, we'll detail the individual steps involved in using TypeScript in an existing Svelte project.

@ -121,7 +121,18 @@ The migration script will do both automatically for you. ([#8512](https://github
## Transitions are local by default
Transitions are now local by default to prevent confusion around page navigations. To make them global, add the `|global` modifier. The migration script will do this automatically for you. ([#6686](https://github.com/sveltejs/svelte/issues/6686))
Transitions are now local by default to prevent confusion around page navigations. "local" means that a transition will not play if it's within a nested control flow block (`each/if/await/key`) and not the direct parent block but a block above it is created/destroyed. In the following example, the `slide` intro animation will only play when `success` goes from `false` to `true`, but it will _not_ play when `show` goes from `false` to `true`:
```svelte
{#if show}
...
{#if success}
<p in:slide>Success</p>
{/each}
{/if}
```
To make transitions global, add the `|global` modifier - then they will play when _any_ control flow block above is created/destroyed. The migration script will do this automatically for you. ([#6686](https://github.com/sveltejs/svelte/issues/6686))
## Default slot bindings
@ -148,6 +159,10 @@ This makes slot bindings more consistent as the behavior is undefined when for e
The order in which preprocessors are applied has changed. Now, preprocessors are executed in order, and within one group, the order is markup, script, style. Each preprocessor must also have a name. ([#8618](https://github.com/sveltejs/svelte/issues/8618))
## New eslint package
`eslint-plugin-svelte3` is deprecated. It may still work with Svelte 4 but we make no guarantees about that. We recommend switching to our new package [eslint-plugin-svelte](https://github.com/sveltejs/eslint-plugin-svelte). See [this Github post](https://github.com/sveltejs/kit/issues/10242#issuecomment-1610798405) for an instruction how to migrate. Alternatively, you can create a new project using `npm create svelte@latest`, select the eslint (and possibly TypeScript) option and then copy over the related files into your existing project.
## Other breaking changes
- the `inert` attribute is now applied to outroing elements to make them invisible to assistive technology and prevent interaction. ([#8628](https://github.com/sveltejs/svelte/pull/8628))

@ -10,3 +10,9 @@
Clicked {count}
{count === 1 ? 'time' : 'times'}
</button>
<style>
button {
width:200px;
}
</style>

@ -10,3 +10,9 @@
Clicked {count}
{count === 1 ? 'time' : 'times'}
</button>
<style>
button {
width:200px;
}
</style>

@ -10,6 +10,4 @@ You can also declare event handlers inline:
</div>
```
The quote marks are optional, but they're helpful for syntax highlighting in some environments.
> In some frameworks you may see recommendations to avoid inline event handlers for performance reasons, particularly inside loops. That advice doesn't apply to Svelte — the compiler will always do the right thing, whichever form you choose.

@ -5,8 +5,10 @@ title: Key blocks
Key blocks destroy and recreate their contents when the value of an expression changes.
```svelte
{#key value}
<div transition:fade>{value}</div>
{#key number}
<span style="display: inline-block" in:fade>
{number}
</span>
{/key}
```

@ -9,7 +9,7 @@
"build": "pnpm -r --filter=./packages/* build",
"build:sites": "pnpm -r --filter=./sites/* build",
"check": "cd packages/svelte && pnpm build && cd ../../ && pnpm -r check",
"lint": "pnpm -r lint",
"lint": "cd packages/svelte && pnpm build && cd ../../ && pnpm -r lint",
"format": "pnpm -r format",
"changeset:version": "changeset version && pnpm -r generate:version && git add --all",
"changeset:publish": "changeset publish"

@ -16,6 +16,7 @@ sites/svelte.dev/.vercel
/test/**/expected*
/test/**/_output
/test/**/shards/*.test.js
/test/hydration/samples/raw-repair/_after.html
/types
!rollup.config.js
!vitest.config.js

@ -1,5 +1,33 @@
# svelte
## 4.0.4
### Patch Changes
- fix: claim svg tags in raw mustache tags correctly ([#8910](https://github.com/sveltejs/svelte/pull/8910))
- fix: repair invalid raw html content during hydration ([#8912](https://github.com/sveltejs/svelte/pull/8912))
## 4.0.3
### Patch Changes
- fix: handle falsy srcset values ([#8901](https://github.com/sveltejs/svelte/pull/8901))
## 4.0.2
### Patch Changes
- fix: reflect all custom element prop updates back to attribute ([#8898](https://github.com/sveltejs/svelte/pull/8898))
- fix: shrink custom element baseline a bit ([#8858](https://github.com/sveltejs/svelte/pull/8858))
- fix: use non-destructive hydration for all `@html` tags ([#8880](https://github.com/sveltejs/svelte/pull/8880))
- fix: align `disclose-version` exports specification ([#8874](https://github.com/sveltejs/svelte/pull/8874))
- fix: check srcset when hydrating to prevent needless requests ([#8868](https://github.com/sveltejs/svelte/pull/8868))
## 4.0.1
### Patch Changes

@ -1,6 +1,6 @@
{
"name": "svelte",
"version": "4.0.1",
"version": "4.0.4",
"description": "Cybernetically enhanced web apps",
"type": "module",
"module": "src/runtime/index.js",
@ -74,7 +74,7 @@
"types": "types/index.d.ts",
"scripts": {
"format": "prettier . --cache --plugin-search-dir=. --write",
"check": "prettier . --cache --plugin-search-dir=. --check",
"check": "tsc --noEmit",
"test": "vitest run && echo \"manually check that there are no type errors in test/types by opening the files in there\"",
"build": "rollup -c && pnpm types",
"generate:version": "node ./scripts/generate-version.js",
@ -82,7 +82,7 @@
"posttest": "agadoo src/internal/index.js",
"prepublishOnly": "pnpm build",
"types": "node ./scripts/generate-dts.js",
"lint": "eslint \"{src,test}/**/*.{ts,js}\" --cache"
"lint": "prettier . --cache --plugin-search-dir=. --check && eslint \"{src,test}/**/*.{ts,js}\" --cache"
},
"repository": {
"type": "git",

@ -26,7 +26,7 @@ export default class RawMustacheTagWrapper extends Tag {
render(block, parent_node, _parent_nodes) {
const in_head = is_head(parent_node);
const can_use_innerhtml = !in_head && parent_node && !this.prev && !this.next;
if (can_use_innerhtml) {
if (can_use_innerhtml && !this.renderer.options.hydratable) {
/** @param {import('estree').Node} content */
const insert = (content) => b`${parent_node}.innerHTML = ${content};`[0];
const { init } = this.rename_this_method(block, (content) => insert(content));

@ -13,7 +13,9 @@ import {
start_hydrating,
end_hydrating,
get_custom_elements_slots,
insert
insert,
element,
attr
} from './dom.js';
import { transition_in } from './transitions.js';
@ -157,23 +159,29 @@ export let SvelteElement;
if (typeof HTMLElement === 'function') {
SvelteElement = class extends HTMLElement {
$$componentCtor;
$$slots;
$$component;
$$connected = false;
$$data = {};
$$reflecting = false;
/** @type {Record<string, CustomElementPropDefinition>} */
$$props_definition = {};
/** @type {Record<string, Function[]>} */
$$listeners = {};
/** @type {Map<Function, Function>} */
$$listener_unsubscribe_fns = new Map();
/** The Svelte component constructor */
$$ctor;
/** Slots */
$$s;
/** The Svelte component instance */
$$c;
/** Whether or not the custom element is connected */
$$cn = false;
/** Component props data */
$$d = {};
/** `true` if currently in the process of reflecting component props back to attributes */
$$r = false;
/** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
$$p_d = {};
/** @type {Record<string, Function[]>} Event listeners */
$$l = {};
/** @type {Map<Function, Function>} Event listener unsubscribe functions */
$$l_u = new Map();
constructor($$componentCtor, $$slots, use_shadow_dom) {
super();
this.$$componentCtor = $$componentCtor;
this.$$slots = $$slots;
this.$$ctor = $$componentCtor;
this.$$s = $$slots;
if (use_shadow_dom) {
this.attachShadow({ mode: 'open' });
}
@ -183,32 +191,32 @@ if (typeof HTMLElement === 'function') {
// We can't determine upfront if the event is a custom event or not, so we have to
// listen to both. If someone uses a custom event with the same name as a regular
// browser event, this fires twice - we can't avoid that.
this.$$listeners[type] = this.$$listeners[type] || [];
this.$$listeners[type].push(listener);
if (this.$$component) {
const unsub = this.$$component.$on(type, listener);
this.$$listener_unsubscribe_fns.set(listener, unsub);
this.$$l[type] = this.$$l[type] || [];
this.$$l[type].push(listener);
if (this.$$c) {
const unsub = this.$$c.$on(type, listener);
this.$$l_u.set(listener, unsub);
}
super.addEventListener(type, listener, options);
}
removeEventListener(type, listener, options) {
super.removeEventListener(type, listener, options);
if (this.$$component) {
const unsub = this.$$listener_unsubscribe_fns.get(listener);
if (this.$$c) {
const unsub = this.$$l_u.get(listener);
if (unsub) {
unsub();
this.$$listener_unsubscribe_fns.delete(listener);
this.$$l_u.delete(listener);
}
}
}
async connectedCallback() {
this.$$connected = true;
if (!this.$$component) {
this.$$cn = true;
if (!this.$$c) {
// We wait one tick to let possible child slot elements be created/mounted
await Promise.resolve();
if (!this.$$connected) {
if (!this.$$cn) {
return;
}
function create_slot(name) {
@ -216,9 +224,9 @@ if (typeof HTMLElement === 'function') {
let node;
const obj = {
c: function create() {
node = document.createElement('slot');
node = element('slot');
if (name !== 'default') {
node.setAttribute('name', name);
attr(node, 'name', name);
}
},
/**
@ -239,74 +247,89 @@ if (typeof HTMLElement === 'function') {
}
const $$slots = {};
const existing_slots = get_custom_elements_slots(this);
for (const name of this.$$slots) {
for (const name of this.$$s) {
if (name in existing_slots) {
$$slots[name] = [create_slot(name)];
}
}
for (const attribute of this.attributes) {
// this.$$data takes precedence over this.attributes
const name = this.$$get_prop_name(attribute.name);
if (!(name in this.$$data)) {
this.$$data[name] = get_custom_element_value(
name,
attribute.value,
this.$$props_definition,
'toProp'
);
const name = this.$$g_p(attribute.name);
if (!(name in this.$$d)) {
this.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, 'toProp');
}
}
this.$$component = new this.$$componentCtor({
this.$$c = new this.$$ctor({
target: this.shadowRoot || this,
props: {
...this.$$data,
...this.$$d,
$$slots,
$$scope: {
ctx: []
}
}
});
for (const type in this.$$listeners) {
for (const listener of this.$$listeners[type]) {
const unsub = this.$$component.$on(type, listener);
this.$$listener_unsubscribe_fns.set(listener, unsub);
// Reflect component props as attributes
const reflect_attributes = () => {
this.$$r = true;
for (const key in this.$$p_d) {
this.$$d[key] = this.$$c.$$.ctx[this.$$c.$$.props[key]];
if (this.$$p_d[key].reflect) {
const attribute_value = get_custom_element_value(
key,
this.$$d[key],
this.$$p_d,
'toAttribute'
);
if (attribute_value == null) {
this.removeAttribute(key);
} else {
this.setAttribute(this.$$p_d[key].attribute || key, attribute_value);
}
}
}
this.$$r = false;
};
this.$$c.$$.after_update.push(reflect_attributes);
reflect_attributes(); // once initially because after_update is added too late for first render
for (const type in this.$$l) {
for (const listener of this.$$l[type]) {
const unsub = this.$$c.$on(type, listener);
this.$$l_u.set(listener, unsub);
}
}
this.$$listeners = {};
this.$$l = {};
}
}
// We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
// and setting attributes through setAttribute etc, this is helpful
attributeChangedCallback(attr, _oldValue, newValue) {
if (this.$$reflecting) return;
attr = this.$$get_prop_name(attr);
this.$$data[attr] = get_custom_element_value(
attr,
newValue,
this.$$props_definition,
'toProp'
);
this.$$component?.$set({ [attr]: this.$$data[attr] });
if (this.$$r) return;
attr = this.$$g_p(attr);
this.$$d[attr] = get_custom_element_value(attr, newValue, this.$$p_d, 'toProp');
this.$$c?.$set({ [attr]: this.$$d[attr] });
}
disconnectedCallback() {
this.$$connected = false;
this.$$cn = false;
// In a microtask, because this could be a move within the DOM
Promise.resolve().then(() => {
if (!this.$$connected) {
this.$$component.$destroy();
this.$$component = undefined;
if (!this.$$cn) {
this.$$c.$destroy();
this.$$c = undefined;
}
});
}
$$get_prop_name(attribute_name) {
$$g_p(attribute_name) {
return (
Object.keys(this.$$props_definition).find(
Object.keys(this.$$p_d).find(
(key) =>
this.$$props_definition[key].attribute === attribute_name ||
(!this.$$props_definition[key].attribute && key.toLowerCase() === attribute_name)
this.$$p_d[key].attribute === attribute_name ||
(!this.$$p_d[key].attribute && key.toLowerCase() === attribute_name)
) || attribute_name
);
}
@ -371,7 +394,7 @@ export function create_custom_element(
const Class = class extends SvelteElement {
constructor() {
super(Component, slots, use_shadow_dom);
this.$$props_definition = props_definition;
this.$$p_d = props_definition;
}
static get observedAttributes() {
return Object.keys(props_definition).map((key) =>
@ -382,36 +405,19 @@ export function create_custom_element(
Object.keys(props_definition).forEach((prop) => {
Object.defineProperty(Class.prototype, prop, {
get() {
return this.$$component && prop in this.$$component
? this.$$component[prop]
: this.$$data[prop];
return this.$$c && prop in this.$$c ? this.$$c[prop] : this.$$d[prop];
},
set(value) {
value = get_custom_element_value(prop, value, props_definition);
this.$$data[prop] = value;
this.$$component?.$set({ [prop]: value });
if (props_definition[prop].reflect) {
this.$$reflecting = true;
const attribute_value = get_custom_element_value(
prop,
value,
props_definition,
'toAttribute'
);
if (attribute_value == null) {
this.removeAttribute(prop);
} else {
this.setAttribute(props_definition[prop].attribute || prop, attribute_value);
}
this.$$reflecting = false;
}
this.$$d[prop] = value;
this.$$c?.$set({ [prop]: value });
}
});
});
accessors.forEach((accessor) => {
Object.defineProperty(Class.prototype, accessor, {
get() {
return this.$$component?.[accessor];
return this.$$c?.[accessor];
}
});
});

@ -777,14 +777,14 @@ export function claim_comment(nodes, data) {
);
}
function find_comment(nodes, text, start) {
function get_comment_idx(nodes, text, start) {
for (let i = start; i < nodes.length; i += 1) {
const node = nodes[i];
if (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {
return i;
}
}
return nodes.length;
return -1;
}
/**
@ -793,11 +793,12 @@ function find_comment(nodes, text, start) {
*/
export function claim_html_tag(nodes, is_svg) {
// find html opening tag
const start_index = find_comment(nodes, 'HTML_TAG_START', 0);
const end_index = find_comment(nodes, 'HTML_TAG_END', start_index);
if (start_index === end_index) {
return new HtmlTagHydration(undefined, is_svg);
const start_index = get_comment_idx(nodes, 'HTML_TAG_START', 0);
const end_index = get_comment_idx(nodes, 'HTML_TAG_END', start_index + 1);
if (start_index === -1 || end_index === -1) {
return new HtmlTagHydration(is_svg);
}
init_claim_info(nodes);
const html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);
detach(html_tag_nodes[0]);
@ -807,7 +808,7 @@ export function claim_html_tag(nodes, is_svg) {
n.claim_order = nodes.claim_info.total_claimed;
nodes.claim_info.total_claimed += 1;
}
return new HtmlTagHydration(claimed_nodes, is_svg);
return new HtmlTagHydration(is_svg, claimed_nodes);
}
/**
@ -1048,17 +1049,13 @@ export class HtmlTag {
* @default false
*/
is_svg = false;
// parent for creating node
/** */
/** parent for creating node */
e = undefined;
// html tag nodes
/** */
/** html tag nodes */
n = undefined;
// target
/** */
/** target */
t = undefined;
// anchor
/** */
/** anchor */
a = undefined;
constructor(is_svg = false) {
this.is_svg = is_svg;
@ -1134,13 +1131,11 @@ export class HtmlTag {
}
}
/**
* @extends HtmlTag */
export class HtmlTagHydration extends HtmlTag {
// hydration claimed nodes
/** */
/** @type {Element[]} hydration claimed nodes */
l = undefined;
constructor(claimed_nodes, is_svg = false) {
constructor(is_svg = false, claimed_nodes) {
super(is_svg);
this.e = this.n = null;
this.l = claimed_nodes;

@ -90,12 +90,12 @@ function split_srcset(srcset) {
/**
* @param {HTMLSourceElement | HTMLImageElement} element_srcset
* @param {string} srcset
* @param {string | undefined | null} srcset
* @returns {boolean}
*/
export function srcset_url_equal(element_srcset, srcset) {
const element_urls = split_srcset(element_srcset.srcset);
const urls = split_srcset(srcset);
const urls = split_srcset(srcset || '');
return (
urls.length === element_urls.length &&

@ -6,5 +6,5 @@
* https://svelte.dev/docs/svelte-compiler#svelte-version
* @type {string}
*/
export const VERSION = '4.0.1';
export const VERSION = '4.0.4';
export const PUBLIC_VERSION = '4';

Binary file not shown.

@ -0,0 +1,2 @@
<p><p>invalid</p></p>
<p><p>invalid</p></p>

@ -0,0 +1,8 @@
<p><!-- HTML_TAG_START --></p>
<p>invalid</p>
<!-- HTML_TAG_END -->
<p></p>
<p><!-- HTML_TAG_START --></p>
<p>invalid</p>
<!-- HTML_TAG_END -->
<p></p>

@ -0,0 +1,5 @@
<script>
export let content;
</script>
<p>{@html content}</p>

@ -0,0 +1,7 @@
<script>
import Inner from './inner.svelte';
</script>
<Inner content="<p>invalid</p>" />
<p>{@html '<p>invalid</p>'}</p>

@ -0,0 +1,3 @@
<svg>
<circle cx="200" cy="500" r="200"></circle>
</svg>

After

Width:  |  Height:  |  Size: 58 B

@ -0,0 +1,5 @@
<svg>
<!-- HTML_TAG_START -->
<circle cx="200" cy="500" r="200"></circle>
<!-- HTML_TAG_END -->
</svg>

After

Width:  |  Height:  |  Size: 106 B

@ -0,0 +1,14 @@
export default {
snapshot(target) {
const svg = target.querySelector('svg');
return {
svg,
circle: svg.querySelector('circle')
};
},
test(assert, _, snapshot) {
assert.instanceOf(snapshot.svg, SVGElement);
assert.instanceOf(snapshot.circle, SVGElement);
}
};

@ -0,0 +1 @@
<svg>{@html '<circle cx="200" cy="500" r="200"></circle>'}</svg>

After

Width:  |  Height:  |  Size: 64 B

@ -1,4 +1,2 @@
<noscript></noscript>
<p>this is some html</p>
<p>and so is this</p>
<noscript></noscript>

@ -1,2 +1,4 @@
<!-- HTML_TAG_START -->
<p>this is some html</p>
<p>and so is this</p>
<!-- HTML_TAG_END -->

@ -1,6 +1,4 @@
export default {
skip: true, // existing nodes are blown away
props: {
raw: '<p>this is some html</p> <p>and so is this</p>'
},

@ -1 +1,5 @@
<script>
export let raw;
</script>
{@html raw}

@ -1,19 +1,20 @@
<svelte:options
customElement={{
tag: "custom-element",
props: { red: { reflect: true, type: "Boolean" } },
tag: 'custom-element',
props: { red: { reflect: true, type: 'Boolean' } }
}}
/>
<script>
import "./my-widget.svelte";
import './my-widget.svelte';
export let red;
red;
</script>
<div>hi</div>
<p>hi</p>
<my-widget red white />
<button on:click={() => (red = false)}>off</button>
<my-widget {red} white />
<style>
:host([red]) div {

@ -9,6 +9,7 @@ export default async function (target) {
const ceRoot = target.querySelector('custom-element').shadowRoot;
const div = ceRoot.querySelector('div');
const p = ceRoot.querySelector('p');
const button = ceRoot.querySelector('button');
assert.equal(getComputedStyle(div).color, 'rgb(255, 0, 0)');
assert.equal(getComputedStyle(p).color, 'rgb(255, 255, 255)');
@ -19,4 +20,11 @@ export default async function (target) {
assert.equal(getComputedStyle(innerDiv).color, 'rgb(255, 0, 0)');
assert.equal(getComputedStyle(innerP).color, 'rgb(255, 255, 255)');
button.click();
await tick();
await tick();
assert.equal(getComputedStyle(div).color, 'rgb(0, 0, 0)');
assert.equal(getComputedStyle(innerDiv).color, 'rgb(0, 0, 0)');
}

@ -0,0 +1,10 @@
export default {
html: '',
test({ assert, component, target }) {
component.show = true;
assert.equal(target.innerHTML, '<svg><circle cx="200" cy="500" r="200"></circle></svg>');
assert.instanceOf(target.querySelector('svg'), SVGElement);
assert.instanceOf(target.querySelector('circle'), SVGElement);
}
};

@ -0,0 +1,7 @@
<script>
export let show = false;
</script>
{#if show}
<svg>{@html '<circle cx="200" cy="500" r="200"></circle>'}</svg>
{/if}

@ -1,9 +1,7 @@
export default {
html: `
<svg>
<foreignObject>
<circle cx="25" cy="30" r="24" fill="#FFD166"></circle>
</foreignObject>
<foreignObject><!-- HTML_TAG_START --><circle cx="25" cy="30" r="24" fill="#FFD166"></circle><!-- HTML_TAG_END --></foreignObject>
</svg>
`,
test({ assert, target, component }) {

@ -1,7 +1,7 @@
<script>
export let width = 100
export let height = 60
$: circle = `<circle cx="${width/4}" cy="${height/2}" r="24" fill="#FFD166"/>`
export let width = 100;
export let height = 60;
$: circle = `<circle cx="${width / 4}" cy="${height / 2}" r="24" fill="#FFD166"></circle>`;
</script>
<svg>

@ -162,6 +162,7 @@ describe('utils', () => {
it('should return false if urls are different', () => {
assert.notOk(srcset_url_equal(create_element('a 1x'), 'b 1x'));
assert.notOk(srcset_url_equal(create_element('a 2x'), 'a 1x'));
assert.notOk(srcset_url_equal(create_element('a 2x'), null));
});
});
});

@ -35,6 +35,9 @@
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"typeRoots": ["./node_modules/@types"]
"typeRoots": ["./node_modules/@types"],
"paths": {
"svelte": ["./src/runtime/public.d.ts"]
}
}
}

@ -157,8 +157,8 @@ importers:
specifier: ^2.26.0
version: 2.26.0
'@sveltejs/repl':
specifier: 0.5.0-next.8
version: 0.5.0-next.8(@codemirror/lang-html@6.4.5)(@codemirror/search@6.5.0)(@lezer/common@1.0.3)(@lezer/javascript@1.4.3)(@lezer/lr@1.3.7)(@sveltejs/kit@1.21.0)(svelte@packages+svelte)
specifier: 0.5.0-next.11
version: 0.5.0-next.11(@codemirror/lang-html@6.4.5)(@codemirror/search@6.5.0)(@lezer/common@1.0.3)(@lezer/javascript@1.4.3)(@lezer/lr@1.3.7)(@sveltejs/kit@1.21.0)(svelte@packages+svelte)
cookie:
specifier: ^0.5.0
version: 0.5.0
@ -186,7 +186,7 @@ importers:
version: 1.21.0(svelte@packages+svelte)(vite@4.3.9)
'@sveltejs/site-kit':
specifier: 6.0.0-next.18
version: 6.0.0-next.18(@sveltejs/kit@1.20.5)(svelte@packages+svelte)
version: 6.0.0-next.18(@sveltejs/kit@1.21.0)(svelte@packages+svelte)
'@sveltejs/vite-plugin-svelte':
specifier: ^2.4.2
version: 2.4.2(svelte@packages+svelte)(vite@4.3.9)
@ -1321,8 +1321,8 @@ packages:
- supports-color
dev: true
/@neocodemirror/svelte@0.0.14(@codemirror/autocomplete@6.8.1)(@codemirror/commands@6.2.4)(@codemirror/language@6.8.0)(@codemirror/lint@6.3.0)(@codemirror/search@6.5.0)(@codemirror/state@6.2.1)(@codemirror/view@6.14.0):
resolution: {integrity: sha512-1kHm3IyBJJyRfItxodSbbLxBknYGKLahaiF6Vb/BcVfdwwFLLj4dvWKY78ep1YQIhDhklgBQztjRMuLn9tTTWg==}
/@neocodemirror/svelte@0.0.15(@codemirror/autocomplete@6.8.1)(@codemirror/commands@6.2.4)(@codemirror/language@6.8.0)(@codemirror/lint@6.3.0)(@codemirror/search@6.5.0)(@codemirror/state@6.2.1)(@codemirror/view@6.14.0):
resolution: {integrity: sha512-MCux+QCR40CboJu/TFwnqK7gYQ3fvtvHX8F/mk85DRH7vMoG3VDjJhqneAITX5IzohWKeP36hzcV+oHC2LYJqA==}
peerDependencies:
'@codemirror/autocomplete': ^6.7.1
'@codemirror/commands': ^6.2.4
@ -1726,33 +1726,6 @@ packages:
typescript: 5.1.3
dev: true
/@sveltejs/kit@1.20.5(svelte@packages+svelte)(vite@4.3.9):
resolution: {integrity: sha512-8rJYZ2boRlO75lwpbpB+DlSzIwmTuamXTpVlDtw4dBk86o3UaDe/+Ro4xCsV/4FtTw2U8xPHyV83edAWbQHG0w==}
engines: {node: ^16.14 || >=18}
hasBin: true
requiresBuild: true
peerDependencies:
svelte: ^3.54.0 || ^4.0.0-next.0
vite: ^4.0.0
dependencies:
'@sveltejs/vite-plugin-svelte': 2.4.2(svelte@packages+svelte)(vite@4.3.9)
'@types/cookie': 0.5.1
cookie: 0.5.0
devalue: 4.3.2
esm-env: 1.0.0
kleur: 4.1.5
magic-string: 0.30.0
mime: 3.0.0
sade: 1.8.1
set-cookie-parser: 2.6.0
sirv: 2.0.3
svelte: link:packages/svelte
undici: 5.22.1
vite: 4.3.9(@types/node@20.3.1)(sass@1.63.6)
transitivePeerDependencies:
- supports-color
dev: true
/@sveltejs/kit@1.21.0(svelte@packages+svelte)(vite@4.3.9):
resolution: {integrity: sha512-CBsYoI34SjtOQp0eG85dmVnvTR3Pjs8VgAQhO0CgQja9BIorKl808F1X8EunPhCcyek5r5lKQE1Mmbi0RuzHqA==}
engines: {node: ^16.14 || >=18}
@ -1779,8 +1752,8 @@ packages:
transitivePeerDependencies:
- supports-color
/@sveltejs/repl@0.5.0-next.8(@codemirror/lang-html@6.4.5)(@codemirror/search@6.5.0)(@lezer/common@1.0.3)(@lezer/javascript@1.4.3)(@lezer/lr@1.3.7)(@sveltejs/kit@1.21.0)(svelte@packages+svelte):
resolution: {integrity: sha512-kEEXAqukfFRIrjnO8Hur/h+bys+Krv36dR29jp4uomXDRNTI/IXHvsAL6HcBwykKH9tVm+yiJzFaPaiC9Ggx2g==}
/@sveltejs/repl@0.5.0-next.11(@codemirror/lang-html@6.4.5)(@codemirror/search@6.5.0)(@lezer/common@1.0.3)(@lezer/javascript@1.4.3)(@lezer/lr@1.3.7)(@sveltejs/kit@1.21.0)(svelte@packages+svelte):
resolution: {integrity: sha512-bZ7WmmwwujhO1b1r7hN5Lt4z/Y4J3Bfx1DHiITOLshHTPgEU9XNOdq2JzSmN4DIWhmU0T/OVZ53XyXpaR1KTWA==}
peerDependencies:
svelte: ^3.54.0 || ^4.0.0-next.0 || ^4.0.0
dependencies:
@ -1796,7 +1769,7 @@ packages:
'@codemirror/view': 6.14.0
'@jridgewell/sourcemap-codec': 1.4.15
'@lezer/highlight': 1.1.6
'@neocodemirror/svelte': 0.0.14(@codemirror/autocomplete@6.8.1)(@codemirror/commands@6.2.4)(@codemirror/language@6.8.0)(@codemirror/lint@6.3.0)(@codemirror/search@6.5.0)(@codemirror/state@6.2.1)(@codemirror/view@6.14.0)
'@neocodemirror/svelte': 0.0.15(@codemirror/autocomplete@6.8.1)(@codemirror/commands@6.2.4)(@codemirror/language@6.8.0)(@codemirror/lint@6.3.0)(@codemirror/search@6.5.0)(@codemirror/state@6.2.1)(@codemirror/view@6.14.0)
'@replit/codemirror-lang-svelte': 6.0.0(@codemirror/autocomplete@6.8.1)(@codemirror/lang-css@6.2.0)(@codemirror/lang-html@6.4.5)(@codemirror/lang-javascript@6.1.9)(@codemirror/language@6.8.0)(@codemirror/state@6.2.1)(@codemirror/view@6.14.0)(@lezer/common@1.0.3)(@lezer/highlight@1.1.6)(@lezer/javascript@1.4.3)(@lezer/lr@1.3.7)
'@rich_harris/svelte-split-pane': 1.1.1(svelte@packages+svelte)
'@rollup/browser': 3.25.3
@ -1808,7 +1781,7 @@ packages:
marked: 5.1.0
resolve.exports: 2.0.2
svelte: link:packages/svelte
svelte-json-tree: 1.0.0
svelte-json-tree: 2.1.0(svelte@packages+svelte)
transitivePeerDependencies:
- '@codemirror/lang-html'
- '@codemirror/search'
@ -1830,13 +1803,13 @@ packages:
svelte-local-storage-store: 0.4.0(svelte@packages+svelte)
dev: false
/@sveltejs/site-kit@6.0.0-next.18(@sveltejs/kit@1.20.5)(svelte@packages+svelte):
/@sveltejs/site-kit@6.0.0-next.18(@sveltejs/kit@1.21.0)(svelte@packages+svelte):
resolution: {integrity: sha512-8uWjP61UAkCqWf9UuQQWSCpyPNk4cqnGaQozjIr3sGbQnauTQDiS4K8AxqyBSyphEIrhxd68iYMEFQDQVAHjcg==}
peerDependencies:
'@sveltejs/kit': ^1.0.0
svelte: ^3.54.0 || ^4.0.0-next.1 || ^4.0.0
dependencies:
'@sveltejs/kit': 1.20.5(svelte@packages+svelte)(vite@4.3.9)
'@sveltejs/kit': 1.21.0(svelte@packages+svelte)(vite@4.3.9)
esm-env: 1.0.0
svelte: link:packages/svelte
svelte-local-storage-store: 0.5.0(svelte@packages+svelte)
@ -1945,10 +1918,6 @@ packages:
resolution: {integrity: sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==}
dev: true
/@types/node@20.3.1:
resolution: {integrity: sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg==}
dev: true
/@types/node@20.3.2:
resolution: {integrity: sha512-vOBLVQeCQfIcF/2Y7eKFTqrMnizK5lRNQ7ykML/5RuwVXVWxYkgwS7xbt4B6fKCUPgbSL5FSsjHQpaGQP/dQmw==}
@ -6031,8 +6000,12 @@ packages:
dependencies:
svelte: link:packages/svelte
/svelte-json-tree@1.0.0:
resolution: {integrity: sha512-scs1OdkC8uFpTN4MX0yKkOzZ1/EG3eP1ARC+xcFthXp2IfcwBaXgab0FqA4Am0vQwffNNB+1Gd1LFkJBlynWTA==}
/svelte-json-tree@2.1.0(svelte@packages+svelte):
resolution: {integrity: sha512-IAU//hE5bIA0SoM9AuP7xOoD9PUcMh4fio0oI52r0XJ7iNDytW7AnBdkIn1QSYLUyWzvQX3tp59JfLYfhd7lTw==}
peerDependencies:
svelte: ^4.0.0
dependencies:
svelte: link:packages/svelte
dev: false
/svelte-local-storage-store@0.4.0(svelte@packages+svelte):
@ -6503,40 +6476,6 @@ packages:
fsevents: 2.3.2
dev: true
/vite@4.3.9(@types/node@20.3.1)(sass@1.63.6):
resolution: {integrity: sha512-qsTNZjO9NoJNW7KnOrgYwczm0WctJ8m/yqYAMAK9Lxt4SoySUfS5S8ia9K7JHpa3KEeMfyF8LoJ3c5NeBJy6pg==}
engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true
peerDependencies:
'@types/node': '>= 14'
less: '*'
sass: '*'
stylus: '*'
sugarss: '*'
terser: ^5.4.0
peerDependenciesMeta:
'@types/node':
optional: true
less:
optional: true
sass:
optional: true
stylus:
optional: true
sugarss:
optional: true
terser:
optional: true
dependencies:
'@types/node': 20.3.1
esbuild: 0.17.19
postcss: 8.4.24
rollup: 3.25.1
sass: 1.63.6
optionalDependencies:
fsevents: 2.3.2
dev: true
/vite@4.3.9(@types/node@20.3.2)(sass@1.63.6):
resolution: {integrity: sha512-qsTNZjO9NoJNW7KnOrgYwczm0WctJ8m/yqYAMAK9Lxt4SoySUfS5S8ia9K7JHpa3KEeMfyF8LoJ3c5NeBJy6pg==}
engines: {node: ^14.18.0 || >=16.0.0}

@ -2,14 +2,15 @@
A local database is only required in dev mode if you want to test reading and writing saved REPLs on it. Without a local database in dev mode, the REPL will be able to load saved REPLs from the production database, but not save them.
Note also that in dev mode, the REPL will currently only work in Chrome, [as noted in the Vite documentation](https://vitejs.dev/guide/features.html#web-workers), pending support in Firefox for `import` statements in web workers.
Note also that in dev mode, the REPL requires support for [`import` statements in web workers](https://caniuse.com/mdn-javascript_operators_import_worker_support), [as noted in the Vite documentation](https://vitejs.dev/guide/features.html#web-workers). You may need to update your browser to the latest version.
If you do want to use a database, set it up on [Supabase](https://supabase.com) with the instructions [here](https://github.com/sveltejs/sites/tree/master/db) and set the corresponding environment variables.
Run the site sub-project:
Build the `svelte` package, then run the site sub-project:
```bash
pnpm install
pnpm --dir ../../packages/svelte build
pnpm dev
```

@ -1,61 +1,61 @@
{
"name": "svelte.dev",
"private": true,
"version": "1.0.0",
"description": "Docs and examples for Svelte",
"type": "module",
"scripts": {
"dev": "node scripts/update.js && pnpm run generate && vite dev",
"build": "node scripts/update.js && pnpm run generate && vite build",
"generate": "node scripts/type-gen/index.js && node scripts/generate_examples.js",
"update": "node scripts/update.js --force=true",
"preview": "vite preview",
"start": "node build",
"check": "node scripts/update.js && pnpm generate && svelte-kit sync && svelte-check",
"check:watch": "svelte-kit sync && svelte-check --watch",
"format": "pnpm run check:format -- --write",
"check:format": "prettier --check . --ignore-path .gitignore --plugin-search-dir=."
},
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.4.15",
"@supabase/supabase-js": "^2.26.0",
"@sveltejs/repl": "0.5.0-next.8",
"cookie": "^0.5.0",
"devalue": "^4.3.2",
"do-not-zip": "^1.0.0",
"flexsearch": "^0.7.31",
"flru": "^1.0.2"
},
"devDependencies": {
"@resvg/resvg-js": "^2.4.1",
"@sveltejs/adapter-vercel": "^3.0.1",
"@sveltejs/kit": "^1.21.0",
"@sveltejs/site-kit": "6.0.0-next.18",
"@sveltejs/vite-plugin-svelte": "^2.4.2",
"@types/cookie": "^0.5.1",
"@types/marked": "^5.0.0",
"@types/node": "^20.3.2",
"@types/prettier": "^2.7.3",
"degit": "^2.8.4",
"dotenv": "^16.3.1",
"jimp": "^0.22.8",
"magic-string": "^0.30.0",
"marked": "^5.1.0",
"node-fetch": "^3.3.1",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"sass": "^1.63.6",
"satori": "^0.10.1",
"satori-html": "^0.3.2",
"shelljs": "^0.8.5",
"shiki": "^0.14.3",
"shiki-twoslash": "^3.1.2",
"svelte": "workspace:*",
"svelte-check": "^3.4.4",
"svelte-preprocess": "^5.0.4",
"tiny-glob": "^0.2.9",
"typescript": "^5.1.6",
"vite": "^4.3.9",
"vite-imagetools": "^5.0.4"
}
"name": "svelte.dev",
"private": true,
"version": "1.0.0",
"description": "Docs and examples for Svelte",
"type": "module",
"scripts": {
"dev": "node scripts/update.js && pnpm run generate && vite dev",
"build": "node scripts/update.js && pnpm run generate && vite build",
"generate": "node scripts/type-gen/index.js && node scripts/generate_examples.js",
"update": "node scripts/update.js --force=true",
"preview": "vite preview",
"start": "node build",
"check": "node scripts/update.js && pnpm generate && svelte-kit sync && svelte-check",
"check:watch": "svelte-kit sync && svelte-check --watch",
"format": "pnpm run check:format -- --write",
"check:format": "prettier --check . --ignore-path .gitignore --plugin-search-dir=."
},
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.4.15",
"@supabase/supabase-js": "^2.26.0",
"@sveltejs/repl": "0.5.0-next.8",
"cookie": "^0.5.0",
"devalue": "^4.3.2",
"do-not-zip": "^1.0.0",
"flexsearch": "^0.7.31",
"flru": "^1.0.2"
},
"devDependencies": {
"@resvg/resvg-js": "^2.4.1",
"@sveltejs/adapter-vercel": "^3.0.1",
"@sveltejs/kit": "^1.21.0",
"@sveltejs/site-kit": "6.0.0-next.18",
"@sveltejs/vite-plugin-svelte": "^2.4.2",
"@types/cookie": "^0.5.1",
"@types/marked": "^5.0.0",
"@types/node": "^20.3.2",
"@types/prettier": "^2.7.3",
"degit": "^2.8.4",
"dotenv": "^16.3.1",
"jimp": "^0.22.8",
"magic-string": "^0.30.0",
"marked": "^5.1.0",
"node-fetch": "^3.3.1",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"sass": "^1.63.6",
"satori": "^0.10.1",
"satori-html": "^0.3.2",
"shelljs": "^0.8.5",
"shiki": "^0.14.3",
"shiki-twoslash": "^3.1.2",
"svelte": "workspace:*",
"svelte-check": "^3.4.4",
"svelte-preprocess": "^5.0.4",
"tiny-glob": "^0.2.9",
"typescript": "^5.1.6",
"vite": "^4.3.9",
"vite-imagetools": "^5.0.4"
}
}

@ -0,0 +1,2 @@
User-agent: *
Disallow:
Loading…
Cancel
Save