Merge branch 'master' of https://github.com/sveltejs/svelte
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 229 B After Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 405 B After Width: | Height: | Size: 320 B |
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 213 B After Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 333 B After Width: | Height: | Size: 256 B |
Before Width: | Height: | Size: 411 B After Width: | Height: | Size: 315 B |
Before Width: | Height: | Size: 415 B After Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 215 B |
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 303 B After Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 311 B |
Before Width: | Height: | Size: 334 B After Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 108 KiB |
@ -0,0 +1,5 @@
|
|||||||
|
export const reserved_keywords = new Set(["$$props", "$$restProps"]);
|
||||||
|
|
||||||
|
export function is_reserved_keyword(name) {
|
||||||
|
return reserved_keywords.has(name);
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
import { Pattern, Identifier, RestElement } from "estree";
|
||||||
|
import { Node } from "acorn";
|
||||||
|
|
||||||
|
export default function traverse_destructure_pattern(
|
||||||
|
node: Pattern,
|
||||||
|
callback: (node: Identifier, parent: Node, key: string | number) => void
|
||||||
|
) {
|
||||||
|
function traverse(node: Pattern, parent, key) {
|
||||||
|
switch (node.type) {
|
||||||
|
case "Identifier":
|
||||||
|
return callback(node, parent, key);
|
||||||
|
case "ArrayPattern":
|
||||||
|
for (let i = 0; i < node.elements.length; i++) {
|
||||||
|
const element = node.elements[i];
|
||||||
|
traverse(element, node.elements, i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "ObjectPattern":
|
||||||
|
for (let i = 0; i < node.properties.length; i++) {
|
||||||
|
const property = node.properties[i];
|
||||||
|
if (property.type === "Property") {
|
||||||
|
traverse(property.value, property, "value");
|
||||||
|
} else {
|
||||||
|
traverse((property as any) as RestElement, node.properties, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "RestElement":
|
||||||
|
return traverse(node.argument, node, 'argument');
|
||||||
|
case "AssignmentPattern":
|
||||||
|
return traverse(node.left, node, 'left');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
traverse(node, null, null);
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
const SQUARE_BRACKET_OPEN = "[".charCodeAt(0);
|
||||||
|
const SQUARE_BRACKET_CLOSE = "]".charCodeAt(0);
|
||||||
|
const CURLY_BRACKET_OPEN = "{".charCodeAt(0);
|
||||||
|
const CURLY_BRACKET_CLOSE = "}".charCodeAt(0);
|
||||||
|
|
||||||
|
export function is_bracket_open(code) {
|
||||||
|
return code === SQUARE_BRACKET_OPEN || code === CURLY_BRACKET_OPEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function is_bracket_close(code) {
|
||||||
|
return code === SQUARE_BRACKET_CLOSE || code === CURLY_BRACKET_CLOSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function is_bracket_pair(open, close) {
|
||||||
|
return (
|
||||||
|
(open === SQUARE_BRACKET_OPEN && close === SQUARE_BRACKET_CLOSE) ||
|
||||||
|
(open === CURLY_BRACKET_OPEN && close === CURLY_BRACKET_CLOSE)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function get_bracket_close(open) {
|
||||||
|
if (open === SQUARE_BRACKET_OPEN) {
|
||||||
|
return SQUARE_BRACKET_CLOSE;
|
||||||
|
}
|
||||||
|
if (open === CURLY_BRACKET_OPEN) {
|
||||||
|
return CURLY_BRACKET_CLOSE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
<div>Hello world</div>
|
@ -0,0 +1,2 @@
|
|||||||
|
<main>This should be thrown away</main>
|
||||||
|
<div>hello</div>
|
@ -0,0 +1 @@
|
|||||||
|
export default {};
|
@ -0,0 +1 @@
|
|||||||
|
<div>Hello world</div>
|
@ -0,0 +1 @@
|
|||||||
|
<div>Hello world</div>
|
@ -0,0 +1 @@
|
|||||||
|
<main>This should be thrown away</main>
|
@ -0,0 +1 @@
|
|||||||
|
export default {};
|
@ -0,0 +1 @@
|
|||||||
|
<div>Hello world</div>
|