* get all contexts
* docs
* explicit return type
* allow specifying return type through generic parameter
* Update site/content/docs/03-run-time.md
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
This PR adds a new option errorMode to CompileOptions to allow continuing the compilation process when errors occured.
When set to warn, this new option will indicate to Svelte that it should log errors as warnings and continue compilation.
This allows (notably) preprocessors to compile the markup to detect vars in markup before preprocessing (in this case: script and style tags are stripped so it can produce a lot of errors).
This PR is part of a work on the svelte-preprocess side to improve the preprocessing of TypeScript files: https://github.com/sveltejs/svelte-preprocess/issues/318
- allow compiler to pass error as warnings
- enforce stops after errors during compilation (for type-checking, TS doesn't know the error method throws)
- should review Element.ts:302
- added a test case for errorMode
- added documentation
* update script end tag parsing to allow whitespace after tagname
* update style end tag parsing to allow for whitespace after tag name
* handle no closing match for script and style for eof and non-eof failures
* cleaning up script and style end tag parsing
Co-authored-by: pngwn <hello@pngwn.io>
* failing test for i6434
* use string match to simplify regexp
* more tests
* separate test suite
* test for commas inside attributes
* stricter regex pattern
* test escaped brackets and parentheses
* change latest test selector to lists
* correct failing test for escaped parentheses
* update with proposed pattern
Fixes#6137
Adding a trusted modifier to make events not be dispatchable by console/sourcecode.
Useful to prevent injected code to automatically dispatch event for preventing botting
* Implement new hydration optimization
During hydration, greedily pick nodes that exist in the original HTML that should not be detached.
Detach the rest.
* Implement optimal reordering during hydration
During hydration we track the order in which children are claimed.
Afterwards, rather than reordering them greedily one-by-one, we reorder all claimed children during the first append optimally.
The optimal reordering first finds the longest subsequence of children that have been claimed in order.
These children will not be moved.
The rest of the children are reordered to where they have to go.
This algorithm is guaranteed to be optimal in the number of reorderings.
The hydration/head-meta-hydrate-duplicate test sample has been modified slightly.
The order in which the <title> tag is being generated changed, which does not affect correctness.
* Fix issue potentially causing extra reorders
Not sorting children before executing the `insertBefore` calls in `init_hydrate` potentially caused extra `insertBefore` calls in `append`
* Simplify`init_hydrate` sorting logic
Fixes#6291Fixes#6345
Both writable and readable initialized without any arguments are already valid, but TS complains about it. This makes both allowed to be emptily initialized. It's also possible to invoke readable with one argument only.