diff --git a/package.json b/package.json index 6cc7dc89c9..6f9b2a8f71 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte", - "version": "3.0.0-alpha20", + "version": "3.0.0-alpha21", "description": "The magical disappearing UI framework", "module": "index.mjs", "main": "index.js", diff --git a/src/compile/Component.ts b/src/compile/Component.ts index 42d3f7a449..a09955d86d 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -93,7 +93,7 @@ export default class Component { options: CompileOptions, stats: Stats ) { - this.name = this.getUniqueName(name); + this.name = name; this.stats = stats; this.ast = ast; @@ -131,6 +131,7 @@ export default class Component { this.walk_module_js(); this.walk_instance_js_pre_template(); + this.name = this.getUniqueName(name); this.fragment = new Fragment(this, ast.html); this.walk_instance_js_post_template(); diff --git a/test/runtime/index.js b/test/runtime/index.js index 98daf51c2a..f320e37d6e 100644 --- a/test/runtime/index.js +++ b/test/runtime/index.js @@ -34,7 +34,7 @@ describe("runtime", () => { require.extensions[".html"] = function(module, filename) { const options = Object.assign( - { filename, name: getName(filename), format: 'cjs', sveltePath }, + { filename, name: compileOptions.name || getName(filename), format: 'cjs', sveltePath }, compileOptions ); diff --git a/test/runtime/samples/deconflict-component-name-with-global/_config.js b/test/runtime/samples/deconflict-component-name-with-global/_config.js new file mode 100644 index 0000000000..4b8255868e --- /dev/null +++ b/test/runtime/samples/deconflict-component-name-with-global/_config.js @@ -0,0 +1,9 @@ +export default { + compileOptions: { + name: 'Set' + }, + + preserveIdentifiers: true, + + html: `

true

` +}; \ No newline at end of file diff --git a/test/runtime/samples/deconflict-component-name-with-global/main.html b/test/runtime/samples/deconflict-component-name-with-global/main.html new file mode 100644 index 0000000000..e5cc140b7a --- /dev/null +++ b/test/runtime/samples/deconflict-component-name-with-global/main.html @@ -0,0 +1,5 @@ + + +

{set.has('x')}

\ No newline at end of file diff --git a/test/runtime/samples/dev-warning-missing-data-binding/_config.js b/test/runtime/samples/dev-warning-missing-data-binding/_config.js index ffe62384a1..f23c5d5ec5 100644 --- a/test/runtime/samples/dev-warning-missing-data-binding/_config.js +++ b/test/runtime/samples/dev-warning-missing-data-binding/_config.js @@ -4,6 +4,6 @@ export default { }, warnings: [ - ` was created without expected prop 'value'` + `
was created without expected prop 'value'` ] }; diff --git a/test/runtime/samples/dev-warning-missing-data-component/_config.js b/test/runtime/samples/dev-warning-missing-data-component/_config.js index f3fc130528..a95e570988 100644 --- a/test/runtime/samples/dev-warning-missing-data-component/_config.js +++ b/test/runtime/samples/dev-warning-missing-data-component/_config.js @@ -4,6 +4,6 @@ export default { }, warnings: [ - ` was created without expected prop 'y'` + ` was created without expected prop 'y'` ] }; diff --git a/test/runtime/samples/dev-warning-missing-data/_config.js b/test/runtime/samples/dev-warning-missing-data/_config.js index 5bc6c8be1f..b929ff4741 100644 --- a/test/runtime/samples/dev-warning-missing-data/_config.js +++ b/test/runtime/samples/dev-warning-missing-data/_config.js @@ -4,7 +4,7 @@ export default { }, warnings: [ - ` was created without expected prop 'foo'`, - ` was created without expected prop 'bar'` + `
was created without expected prop 'foo'`, + `
was created without expected prop 'bar'` ] }; diff --git a/test/runtime/samples/dev-warning-readonly-computed/_config.js b/test/runtime/samples/dev-warning-readonly-computed/_config.js index e8ffbaba3c..33339071f4 100644 --- a/test/runtime/samples/dev-warning-readonly-computed/_config.js +++ b/test/runtime/samples/dev-warning-readonly-computed/_config.js @@ -12,7 +12,7 @@ export default { component.foo = 1; throw new Error( 'Expected an error' ); } catch ( err ) { - assert.equal( err.message, `: Cannot set read-only property 'foo'` ); + assert.equal( err.message, `
: Cannot set read-only property 'foo'` ); } } }; \ No newline at end of file diff --git a/test/runtime/samples/dev-warning-readonly-window-binding/_config.js b/test/runtime/samples/dev-warning-readonly-window-binding/_config.js index 751cffde79..e0b46584e4 100644 --- a/test/runtime/samples/dev-warning-readonly-window-binding/_config.js +++ b/test/runtime/samples/dev-warning-readonly-window-binding/_config.js @@ -8,7 +8,7 @@ export default { component.width = 99; throw new Error('Expected an error'); } catch (err) { - assert.equal(err.message, `: Cannot set read-only property 'width'`); + assert.equal(err.message, `
: Cannot set read-only property 'width'`); } } }; \ No newline at end of file