Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-bundle-scss

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-bundle-scss - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

33

dist/index.js
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var fs = require('fs');
var path = _interopDefault(require('path'));
var compiler = _interopDefault(require('vue-template-compiler'));
var path = require('path');
var compiler = require('vue-template-compiler');
var scssBundle = require('scss-bundle');
function bundleScss({ output, exclusive = true } = {}) {
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
var compiler__default = /*#__PURE__*/_interopDefaultLegacy(compiler);
function bundleScss({ output, exclusive = true, bundlerOptions = {} } = {}) {
const files = [];
const {
project = null,
dedupeGlobs = [],
includePaths = [],
ignoreImports = [],
} = bundlerOptions;
return {

@@ -22,3 +31,3 @@ name: 'bundle-scss',

if (/\.vue$/.test(id)) {
const { styles } = compiler.parseComponent(source);
const { styles } = compiler__default['default'].parseComponent(source);
files.push(

@@ -36,12 +45,12 @@ ...styles

async generateBundle(opts) {
const outputPath = path.resolve(
opts.file ? path.dirname(opts.file) : opts.dir,
output || `${opts.file ? path.parse(opts.file).name : 'index'}.scss`,
const outputPath = path__default['default'].resolve(
opts.file ? path__default['default'].dirname(opts.file) : opts.dir,
output || `${opts.file ? path__default['default'].parse(opts.file).name : 'index'}.scss`,
);
await fs.promises.mkdir(path.dirname(outputPath), { recursive: true });
await fs.promises.mkdir(path__default['default'].dirname(outputPath), { recursive: true });
const entryContent = files.map((file) => `@import "${file.id}";`).join('\n');
await fs.promises.writeFile(outputPath, entryContent);
const registry = Object.assign({}, ...files.map((file) => ({ [file.id]: file.content })));
const bundler = new scssBundle.Bundler(registry);
const result = await bundler.bundle(outputPath);
const bundler = new scssBundle.Bundler(registry, project);
const result = await bundler.bundle(outputPath, dedupeGlobs, includePaths, ignoreImports);
await fs.promises.writeFile(outputPath, result.bundledContent);

@@ -48,0 +57,0 @@ },

@@ -6,4 +6,10 @@ import { promises as fs } from 'fs';

export default function bundleScss({ output, exclusive = true } = {}) {
export default function bundleScss({ output, exclusive = true, bundlerOptions = {} } = {}) {
const files = [];
const {
project = null,
dedupeGlobs = [],
includePaths = [],
ignoreImports = [],
} = bundlerOptions;
return {

@@ -40,4 +46,4 @@ name: 'bundle-scss',

const registry = Object.assign({}, ...files.map((file) => ({ [file.id]: file.content })));
const bundler = new Bundler(registry);
const result = await bundler.bundle(outputPath);
const bundler = new Bundler(registry, project);
const result = await bundler.bundle(outputPath, dedupeGlobs, includePaths, ignoreImports);
await fs.writeFile(outputPath, result.bundledContent);

@@ -44,0 +50,0 @@ },

{
"name": "rollup-plugin-bundle-scss",
"version": "0.1.1",
"version": "0.1.2",
"description": "Rollup .scss imports into one bundled .scss file",

@@ -40,14 +40,14 @@ "main": "dist/index.js",

"scss-bundle": "^3.1.2",
"vue-template-compiler": "^2.6.11"
"vue-template-compiler": "^2.6.12"
},
"devDependencies": {
"eslint": "^7.3.1",
"eslint": "^7.11.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-plugin-import": "^2.21.2",
"jest": "^26.1.0",
"rollup": "^2.18.0",
"eslint-plugin-import": "^2.22.1",
"jest": "^26.6.0",
"rollup": "^2.32.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-postcss": "^3.1.2",
"rollup-plugin-postcss": "^3.1.8",
"rollup-plugin-vue": "^5.1.9"
}
}

@@ -96,3 +96,13 @@ # rollup-plugin-bundle-scss

exclusive: Boolean,
// bundlerOptions will be passed into `scss-bundle` package,
// see document here https://github.com/reactway/scss-bundle
bundlerOptions: {
// If tilde import is used, `project` is required for finding `node_modules`
project: String,
dedupeGlobs: String[],
includePaths: String[],
ignoreImports: String[],
},
})
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc