rollup-plugin-svelte
Advanced tools
Comparing version 4.4.0 to 4.5.0
# rollup-plugin-svelte changelog | ||
## 4.5.0 | ||
* Pass `dependencies` through from preprocessors ([#40](https://github.com/rollup/rollup-plugin-svelte/issues/40)) | ||
## 4.4.0 | ||
@@ -4,0 +8,0 @@ |
25
index.js
@@ -201,5 +201,24 @@ const fs = require('fs'); | ||
return (options.preprocess ? preprocess(code, Object.assign({}, options.preprocess, { filename : id })) : Promise.resolve(code)).then(code => { | ||
const dependencies = []; | ||
let preprocessPromise; | ||
if (options.preprocess) { | ||
const preprocessOptions = {}; | ||
for (const key in options.preprocess) { | ||
preprocessOptions[key] = (...args) => { | ||
return Promise.resolve(options.preprocess[key](...args)).then(resp => { | ||
if (resp && resp.dependencies) { | ||
dependencies.push(...resp.dependencies); | ||
} | ||
return resp; | ||
}); | ||
}; | ||
} | ||
preprocessPromise = preprocess(code, Object.assign(preprocessOptions, { filename: id })).then(code => code.toString()); | ||
} else { | ||
preprocessPromise = Promise.resolve(code); | ||
} | ||
return preprocessPromise.then(code => { | ||
const compiled = compile( | ||
code.toString(), | ||
code, | ||
Object.assign({}, { | ||
@@ -229,2 +248,4 @@ onwarn: warning => { | ||
compiled.js.dependencies = dependencies; | ||
return compiled.js; | ||
@@ -231,0 +252,0 @@ }); |
{ | ||
"name": "rollup-plugin-svelte", | ||
"version": "4.4.0", | ||
"version": "4.5.0", | ||
"description": "Compile Svelte components with Rollup", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -68,2 +68,7 @@ # rollup-plugin-svelte | ||
## Preprocessing and dependencies | ||
If you are using the `preprocess` feature, then your callback responses may — in addition to the `code` and `map` values described in the Svelte compile docs — also optionally include a `dependencies` array. This should be the paths of additional files that the preprocessor result in some way depends upon. In Rollup 0.61+ in watch mode, any changes to these additional files will also trigger re-builds. | ||
## `pkg.svelte` | ||
@@ -70,0 +75,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
15999
243
105
0