diff --git a/src/Stats.ts b/src/Stats.ts index 5efb41b41a..7653d6e303 100644 --- a/src/Stats.ts +++ b/src/Stats.ts @@ -108,6 +108,7 @@ export default class Stats { timings, warnings: this.warnings, imports, + templateReferences: component && component.expectedProperties, hooks }; } @@ -116,4 +117,4 @@ export default class Stats { this.warnings.push(warning); this.onwarn(warning); } -} \ No newline at end of file +} diff --git a/src/compile/nodes/InlineComponent.ts b/src/compile/nodes/InlineComponent.ts index 60ffbad55f..9b4b22a664 100644 --- a/src/compile/nodes/InlineComponent.ts +++ b/src/compile/nodes/InlineComponent.ts @@ -20,7 +20,10 @@ export default class InlineComponent extends Node { constructor(component: Component, parent, scope, info) { super(component, parent, scope, info); - if (info.name !== 'svelte:component') component.warn_if_undefined(info, scope); + if (info.name !== 'svelte:component') { + component.warn_if_undefined(info, scope); + component.expectedProperties.add(info.name); + } component.hasComponents = true; diff --git a/test/stats/samples/template-references/_config.js b/test/stats/samples/template-references/_config.js new file mode 100644 index 0000000000..0bc844928f --- /dev/null +++ b/test/stats/samples/template-references/_config.js @@ -0,0 +1,8 @@ +export default { + test(assert, stats) { + assert.equal(stats.templateReferences.size, 3); + assert.ok(stats.templateReferences.has('foo')); + assert.ok(stats.templateReferences.has('Bar')); + assert.ok(stats.templateReferences.has('baz')); + }, +}; diff --git a/test/stats/samples/template-references/input.html b/test/stats/samples/template-references/input.html new file mode 100644 index 0000000000..938e61b7bd --- /dev/null +++ b/test/stats/samples/template-references/input.html @@ -0,0 +1,2 @@ +{foo} +