rollup-plugin-css-bundle
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,5 +5,5 @@ 'use strict'; | ||
var rollupPluginutils = require('rollup-pluginutils'); | ||
require('postcss'); | ||
var fs = _interopDefault(require('fs')); | ||
var fs = _interopDefault(require('fs-extra')); | ||
var path = _interopDefault(require('path')); | ||
var utils = _interopDefault(require('rollup-pluginutils')); | ||
@@ -16,6 +16,7 @@ var index = (opts) => { | ||
const options = Object.assign({ | ||
include: ['**/*.css'] | ||
include: ['**/*.css'], | ||
transform: code => code | ||
}, opts); | ||
const filter = rollupPluginutils.createFilter(options.include, options.exclude); | ||
const filter = utils.createFilter(options.include, options.exclude); | ||
@@ -30,5 +31,5 @@ return { | ||
transform(code, id) { | ||
async transform(code, id) { | ||
if (!filter(id)) return; | ||
styles[id] = code; | ||
styles[id] = await options.transform(code); | ||
return ''; | ||
@@ -46,4 +47,10 @@ }, | ||
onwrite(opts) { | ||
let dest = options.file || opts.file.replace(/\.js$/, '.css'); | ||
fs.writeFile(dest, bundles[opts.file]); | ||
fs.outputFile( | ||
options.output || | ||
path.join( | ||
path.dirname(opts.file), | ||
path.basename(opts.file, path.extname(opts.file)) + '.css' | ||
), | ||
bundles[opts.file] | ||
); | ||
} | ||
@@ -50,0 +57,0 @@ } |
{ | ||
"dependencies": { | ||
"postcss": "^6.0.21", | ||
"fs-extra": "^5.0.0", | ||
"rollup-pluginutils": "^2.0.1" | ||
}, | ||
"name": "rollup-plugin-css-bundle", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "dist/index.js", | ||
@@ -21,5 +21,5 @@ "module": "src/index.js", | ||
"scripts": { | ||
"build": "rollup -i src/index.js -o dist/index.js -f cjs", | ||
"watch": "rollup -w -i src/index.js -o dist/index.js -f cjs" | ||
"build": "rollup -c", | ||
"watch": "rollup -w -c" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
import { createFilter } from 'rollup-pluginutils'; | ||
import postcss from 'postcss'; | ||
import fs from 'fs'; | ||
import fs from 'fs-extra'; | ||
import path from 'path'; | ||
import utils from 'rollup-pluginutils'; | ||
@@ -11,6 +11,7 @@ export default (opts) => { | ||
const options = Object.assign({ | ||
include: ['**/*.css'] | ||
include: ['**/*.css'], | ||
transform: code => code | ||
}, opts); | ||
const filter = createFilter(options.include, options.exclude); | ||
const filter = utils.createFilter(options.include, options.exclude); | ||
@@ -25,5 +26,5 @@ return { | ||
transform(code, id) { | ||
async transform(code, id) { | ||
if (!filter(id)) return; | ||
styles[id] = code; | ||
styles[id] = await options.transform(code); | ||
return ''; | ||
@@ -41,6 +42,12 @@ }, | ||
onwrite(opts) { | ||
let dest = options.file || opts.file.replace(/\.js$/, '.css'); | ||
fs.writeFile(dest, bundles[opts.file]); | ||
fs.outputFile( | ||
options.output || | ||
path.join( | ||
path.dirname(opts.file), | ||
path.basename(opts.file, path.extname(opts.file)) + '.css' | ||
), | ||
bundles[opts.file] | ||
); | ||
} | ||
} | ||
} |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
3905
84
+ Addedfs-extra@^5.0.0
+ Addedfs-extra@5.0.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedjsonfile@4.0.0(transitive)
+ Addeduniversalify@0.1.2(transitive)
- Removedpostcss@^6.0.21
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedpostcss@6.0.23(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsupports-color@5.5.0(transitive)