From 998d86a4e3adaddf8027a5fc56a375ac46d21f45 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 4 Nov 2018 16:32:41 -0500 Subject: [PATCH 1/7] expose stats.props --- src/Stats.ts | 3 +++ src/compile/index.ts | 2 +- test/stats/samples/props/_config.js | 5 +++++ test/stats/samples/props/input.html | 23 +++++++++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 test/stats/samples/props/_config.js create mode 100644 test/stats/samples/props/input.html diff --git a/src/Stats.ts b/src/Stats.ts index b2e16a805c..091975974f 100644 --- a/src/Stats.ts +++ b/src/Stats.ts @@ -103,7 +103,10 @@ export default class Stats { onupdate: !!component.templateProperties.onupdate }; + const computed = new Set(component.computations.map(c => c.key)); + return { + props: Array.from(component.expectedProperties).filter(key => !computed.has(key)), timings, warnings: this.warnings, imports, diff --git a/src/compile/index.ts b/src/compile/index.ts index e5a78379ea..59e204b816 100644 --- a/src/compile/index.ts +++ b/src/compile/index.ts @@ -82,7 +82,7 @@ export default function compile(source: string, options: CompileOptions = {}) { stats.stop('create component'); if (options.generate === false) { - return { ast, stats: stats.render(null), js: null, css: null }; + return { ast, stats: stats.render(component), js: null, css: null }; } if (options.generate === 'ssr') { diff --git a/test/stats/samples/props/_config.js b/test/stats/samples/props/_config.js new file mode 100644 index 0000000000..4ab71fc6e2 --- /dev/null +++ b/test/stats/samples/props/_config.js @@ -0,0 +1,5 @@ +export default { + test(assert, stats) { + assert.deepEqual(stats.props.sort(), ['cats', 'foo', 'name']); + } +}; \ No newline at end of file diff --git a/test/stats/samples/props/input.html b/test/stats/samples/props/input.html new file mode 100644 index 0000000000..e55b85e9ba --- /dev/null +++ b/test/stats/samples/props/input.html @@ -0,0 +1,23 @@ +

Hello {name}!

+ + + +

bar: {bar}

+ + \ No newline at end of file From daa9344cbc75e54e2a1ce0f8f2f5938fd4e6fe2f Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 4 Nov 2018 17:52:16 -0500 Subject: [PATCH 2/7] -> v2.15.2 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3419e6da1f..0035de93f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Svelte changelog +## 2.15.2 + +* Expose `stats.props` ([#1837](https://github.com/sveltejs/svelte/issues/1837)) + ## 2.15.1 * Don't throw missing store error when store is declared in component ([#1828](https://github.com/sveltejs/svelte/issues/1828)) diff --git a/package.json b/package.json index 346bd0f6fd..8c26577abf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "2.15.1", + "version": "2.15.2", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "bin": { From e4c0d8d57608bf2d9f022750084046af185f30f6 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 4 Nov 2018 19:12:26 -0500 Subject: [PATCH 3/7] dont mutate AST --- src/utils/removeNode.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/utils/removeNode.ts b/src/utils/removeNode.ts index 26095b483c..b2cf7ffacc 100644 --- a/src/utils/removeNode.ts +++ b/src/utils/removeNode.ts @@ -42,7 +42,6 @@ export function removeNode(code: MagicString, parent: Node, node: Node) { } code.remove(a, b); - list.splice(i, 1); return; } From 5cc45c1e891915c854c84bd74c0e867b6e26f7ed Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 6 Nov 2018 14:05:06 -0500 Subject: [PATCH 4/7] -> v2.15.3 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0035de93f1..811d9f4274 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Svelte changelog +## 2.15.3 + +* Don't mutate AST + ## 2.15.2 * Expose `stats.props` ([#1837](https://github.com/sveltejs/svelte/issues/1837)) diff --git a/package.json b/package.json index 8c26577abf..5b19a055ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "2.15.2", + "version": "2.15.3", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "bin": { From 28dd6a899a739d92ed3e621d19e91dc49bb8f083 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Mon, 12 Nov 2018 21:01:34 -0500 Subject: [PATCH 5/7] remove deprecated onerror option from readme --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 2335d2dd18..dac940e029 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,6 @@ The Svelte compiler optionally takes a second argument, an object of configurati | `globals` | `object`, `function` | When outputting to the `'umd'`, `'iife'` or `'eval'` formats, an object or function mapping the names of imported dependencies to the names of global variables. | `{}` | | `preserveComments` | `boolean` | Include comments in rendering. Currently, only applies to SSR rendering | `false` | | | | | -| `onerror` | `function` | Specify a callback for when Svelte encounters an error while compiling the component. Passed two arguments: the error object, and another function that is Svelte's default onerror handling. | (exception is thrown) | | `onwarn` | `function` | Specify a callback for when Svelte encounters a non-fatal warning while compiling the component. Passed two arguments: the warning object, and another function that is Svelte's default onwarn handling. | (warning is logged to console) | ### Preprocessor options From 9c3815f5681f79f23156a9b94132ee2e0d15ad30 Mon Sep 17 00:00:00 2001 From: Jonathan Greenemeier Date: Sun, 2 Dec 2018 01:51:52 -0700 Subject: [PATCH 6/7] Small update to allow class directives to work in IE11 where second argument of classList.toggle is not respected --- src/shared/dom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/dom.js b/src/shared/dom.js index 1411a7693e..d4e4700b63 100644 --- a/src/shared/dom.js +++ b/src/shared/dom.js @@ -239,5 +239,5 @@ export function addResizeListener(element, fn) { } export function toggleClass(element, name, toggle) { - element.classList.toggle(name, !!toggle); + element.classList[toggle ? 'add' : 'remove'](name); } From 09e6ae0e8e45ef9e08f99930a96a74975de63817 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 7 Dec 2018 20:31:51 -0500 Subject: [PATCH 7/7] -> v2.15.4 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 811d9f4274..e458527e75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Svelte changelog +## 2.15.4 + +* IE `classList` fix ([#1868](https://github.com/sveltejs/svelte/pull/1868)) + ## 2.15.3 * Don't mutate AST diff --git a/package.json b/package.json index 5b19a055ca..b2ff4eabe0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "2.15.3", + "version": "2.15.4", "description": "The magical disappearing UI framework", "main": "compiler/svelte.js", "bin": {