Skip to content

Commit

Permalink
Prepare for rollup 1.0 (#45)
Browse files Browse the repository at this point in the history
* Update ongenerate hook and use this.warn for warnings

* Update dependencies

* Requires at least rollup@0.60 to use the `warn` plugin context function
  • Loading branch information
lukastaegert committed Dec 16, 2018
1 parent 1172fca commit 02b67f4
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 448 deletions.
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function mkdirp(dir) {
}

class CssWriter {
constructor (code, map) {
constructor (code, map, warn) {
this.code = code;
this.map = {
version: 3,
Expand All @@ -83,6 +83,7 @@ class CssWriter {
names: [],
mappings: map.mappings
};
this.warn = warn;
}

write(dest, map) {
Expand All @@ -107,7 +108,7 @@ class CssWriter {
}

toString() {
console.log('[DEPRECATION] As of rollup-plugin-svelte@3, the argument to the `css` function is an object, not a string — use `css.write(file)`. Consult the documentation for more information: https://github.com/rollup/rollup-plugin-svelte'); // eslint-disable-line no-console
this.warn('[DEPRECATION] As of rollup-plugin-svelte@3, the argument to the `css` function is an object, not a string — use `css.write(file)`. Consult the documentation for more information: https://github.com/rollup/rollup-plugin-svelte');
return this.code;
}
}
Expand Down Expand Up @@ -249,7 +250,7 @@ module.exports = function svelte(options = {}) {
return compiled.js;
});
},
ongenerate() {
generateBundle() {
if (css) {
// write out CSS file. TODO would be nice if there was a
// a more idiomatic way to do this in Rollup
Expand Down Expand Up @@ -286,7 +287,7 @@ module.exports = function svelte(options = {}) {
sources,
sourcesContent,
mappings: encode(mappings)
});
}, this.warn);

css(writer);
}
Expand Down

0 comments on commit 02b67f4

Please sign in to comment.