rollup-plugin-svelte
Advanced tools
Comparing version 7.0.0 to 7.1.0
# rollup-plugin-svelte changelog | ||
## Unreleased | ||
## 7.1.0 | ||
* Preprocessor sourcemap support ([#157](https://github.com/sveltejs/rollup-plugin-svelte/pull/157)) | ||
## 7.0.0 | ||
* New minimum version requirements ([#138](https://github.com/sveltejs/rollup-plugin-svelte/pull/138), [#142](https://github.com/sveltejs/rollup-plugin-svelte/pull/142)): | ||
* Rollup 2+ | ||
* Svelte 3.5+ (Svelte 2 is no longer supported) | ||
* Node 10+ | ||
* Breaking: Offload CSS handling to Rollup — you will now need an external plugin like `rollup-plugin-css-only` to extract your styles to `.css` files [as demonstrated in the template](https://github.com/sveltejs/template/blob/5b1135c286f7a649daa99825a077586655051649/rollup.config.js#L48) ([#147](https://github.com/sveltejs/rollup-plugin-svelte/pull/147)) | ||
* Breaking: Options to be passed directly to the Svelte compiler must now go under a `compilerOptions` key in the plugin configuration object ([#145](https://github.com/sveltejs/rollup-plugin-svelte/pull/145)) | ||
* Extend `CompileOptions` interface directly ([#126](https://github.com/sveltejs/rollup-plugin-svelte/pull/126)) | ||
* Pass relative `filename` to svelte compiler ([#131](https://github.com/sveltejs/rollup-plugin-svelte/pull/131)) | ||
* Link `sourcemap` with source correctly ([#140](https://github.com/sveltejs/rollup-plugin-svelte/pull/140)) | ||
* Respect `sourcemapExcludeSources` Rollup config ([#93](https://github.com/sveltejs/rollup-plugin-svelte/pull/93)) | ||
* Keep all sourcemaps from chunk ([#44](https://github.com/sveltejs/rollup-plugin-svelte/pull/44)) | ||
## 6.1.1 | ||
* Use `require('svelte/compiler')` rather than `require('svelte/compiler.js')` to work with new Svelte exports map | ||
## 6.1.0 | ||
* feat: allow custom Svelte compilers via new `svelte` option: ([#124](https://github.com/sveltejs/rollup-plugin-svelte/pull/124)) | ||
* fix: use native `fs.existsSync` method: ([`50e03e5`](https://github.com/sveltejs/rollup-plugin-svelte/commit/50e03e5)) | ||
* chore: Power CI via GitHub Action ([`61ead9a..23e83a4`](https://github.com/sveltejs/rollup-plugin-svelte/compare/61ead9a..23e83a4)) | ||
## 6.0.2 | ||
* Added default value to CssWriter.write map option ([#135](https://github.com/sveltejs/rollup-plugin-svelte/pull/135)) | ||
@@ -6,0 +34,0 @@ * Do not warn about missing unused css selectors if both css and emitCss are false ([#127](https://github.com/sveltejs/rollup-plugin-svelte/pull/127)) |
@@ -1,2 +0,2 @@ | ||
import { Plugin, RollupWarning, SourceMap as Mapping } from 'rollup'; | ||
import { Plugin, RollupWarning } from 'rollup'; | ||
import { PreprocessorGroup } from 'svelte/types/compiler/preprocess'; | ||
@@ -6,19 +6,5 @@ import { CompileOptions } from 'svelte/types/compiler/interfaces'; | ||
type Arrayable<T> = T | T[]; | ||
type SourceMap = Omit<Mapping, 'toString' | 'toUrl'>; | ||
type WarningHandler = (warning: RollupWarning | string) => void; | ||
declare class CssWriter { | ||
code: string; | ||
filename: string; | ||
warn: WarningHandler; | ||
map: false | SourceMap; | ||
write(file: string, map?: boolean): void; | ||
emit(name: string, source: string): string; | ||
sourcemap(file: string, sourcemap: SourceMap): void; | ||
toString(): string; | ||
} | ||
type CssEmitter = (css: CssWriter) => any; | ||
interface Options { | ||
@@ -25,0 +11,0 @@ /** One or more minimatch patterns */ |
16
index.js
@@ -10,4 +10,8 @@ const path = require('path'); | ||
const plugin_options = new Set([ | ||
'include', 'exclude', 'extensions', | ||
'preprocess', 'onwarn', 'emitCss', | ||
'emitCss', | ||
'exclude', | ||
'extensions', | ||
'include', | ||
'onwarn', | ||
'preprocess' | ||
]); | ||
@@ -26,3 +30,3 @@ | ||
for (let key in rest) { | ||
for (const key in rest) { | ||
if (plugin_options.has(key)) continue; | ||
@@ -57,3 +61,3 @@ console.warn(`${PREFIX} Unknown "${key}" option. Please use "compilerOptions" for any Svelte compiler configuration.`); | ||
let dir, pkg, name = parts.shift(); | ||
if (name[0] === '@') { | ||
if (name && name[0] === '@') { | ||
name += `/${parts.shift()}`; | ||
@@ -101,2 +105,3 @@ } | ||
const filename = path.relative(process.cwd(), id); | ||
const svelte_options = { ...compilerOptions, filename }; | ||
@@ -106,6 +111,7 @@ if (rest.preprocess) { | ||
if (processed.dependencies) dependencies.push(...processed.dependencies); | ||
if (processed.map) svelte_options.sourcemap = processed.map; | ||
code = processed.code; | ||
} | ||
const compiled = compile(code, { ...compilerOptions, filename }); | ||
const compiled = compile(code, svelte_options); | ||
@@ -112,0 +118,0 @@ (compiled.warnings || []).forEach(warning => { |
{ | ||
"version": "7.0.0", | ||
"version": "7.1.0", | ||
"name": "rollup-plugin-svelte", | ||
@@ -36,8 +36,8 @@ "description": "Compile Svelte components with Rollup", | ||
"devDependencies": { | ||
"eslint": "^6.8.0", | ||
"rollup": "^2.30.0", | ||
"eslint": "^7.14.0", | ||
"rollup": "^2.33.3", | ||
"sander": "^0.6.0", | ||
"source-map": "^0.7.3", | ||
"svelte": "^3.24.0", | ||
"uvu": "^0.3.1" | ||
"svelte": "^3.30.0", | ||
"uvu": "^0.4.1" | ||
}, | ||
@@ -44,0 +44,0 @@ "keywords": [ |
@@ -37,10 +37,2 @@ # rollup-plugin-svelte [![CI](https://github.com/sveltejs/rollup-plugin-svelte/workflows/CI/badge.svg)](https://github.com/sveltejs/rollup-plugin-svelte/actions) | ||
// By default, the client-side compiler is used. You | ||
// can also use the server-side rendering compiler | ||
generate: 'ssr', | ||
// ensure that extra attributes are added to head | ||
// elements for hydration (used with generate: 'ssr') | ||
hydratable: true, | ||
// Optionally, preprocess components with svelte.preprocess: | ||
@@ -57,6 +49,2 @@ // https://svelte.dev/docs#svelte_preprocess | ||
// You can optionally set 'customElement' to 'true' to compile | ||
// your components to custom elements (aka web elements) | ||
customElement: false, | ||
// Warnings are normally passed straight to Rollup. You can | ||
@@ -71,2 +59,18 @@ // optionally handle them here, for example to squelch | ||
handler(warning); | ||
}, | ||
// You can pass any of the Svelte compiler options | ||
compilerOptions: { | ||
// By default, the client-side compiler is used. You | ||
// can also use the server-side rendering compiler | ||
generate: 'ssr', | ||
// ensure that extra attributes are added to head | ||
// elements for hydration (used with generate: 'ssr') | ||
hydratable: true, | ||
// You can optionally set 'customElement' to 'true' to compile | ||
// your components to custom elements (aka web elements) | ||
customElement: false | ||
} | ||
@@ -73,0 +77,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
20134
126
0
153