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

rollup-plugin-sass

Package Overview
Dependencies
Maintainers
2
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-sass - npm Package Compare versions

Comparing version 1.2.6 to 1.2.7

3

dist/index.d.ts
import { RollupPluginSassOptions } from "./types";
import { Plugin as RollupPlugin } from 'rollup';
export default function plugin(options?: RollupPluginSassOptions): RollupPlugin;
declare const _default: (options?: RollupPluginSassOptions) => RollupPlugin;
export = _default;

@@ -24,3 +24,2 @@ "use strict";

};
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("util");

@@ -66,3 +65,2 @@ const resolve_1 = __importDefault(require("resolve"));

const { processor } = rollupOptions;
let _priority = state.priority++;
return Promise.resolve()

@@ -83,14 +81,4 @@ .then(() => !utils_1.isFunction(processor) ? inCss + '' : processor(inCss, file))

.then(([resolvedCss, restExports]) => {
const { styleMaps, styles } = state;
if (styleMaps[file]) {
styleMaps[file].content = resolvedCss;
}
else {
const mapEntry = {
id: file,
content: resolvedCss,
};
styleMaps[file] = mapEntry;
styles[_priority] = mapEntry;
}
const { styleMaps } = state;
styleMaps[file].content = resolvedCss;
const out = JSON.stringify(resolvedCss);

@@ -107,3 +95,3 @@ let defaultExport = `""`;

}, defaultIncludes = ['**/*.sass', '**/*.scss'], defaultExcludes = 'node_modules/**';
function plugin(options = {}) {
module.exports = function plugin(options = {}) {
const pluginOptions = Object.assign({

@@ -115,4 +103,3 @@ runtime: sass,

styles: [],
styleMaps: {},
priority: 0
styleMaps: {}
};

@@ -130,3 +117,3 @@ return {

}
const paths = [path_1.dirname(filePath), process.cwd()], resolvedOptions = Object.assign({}, incomingSassOptions, {
const paths = [path_1.dirname(filePath), process.cwd()], { styleMaps, styles } = pluginState, resolvedOptions = Object.assign({}, incomingSassOptions, {
file: filePath,

@@ -138,2 +125,10 @@ data: incomingSassOptions.data && `${incomingSassOptions.data}${code}`,

});
if (!styleMaps[filePath]) {
const mapEntry = {
id: filePath,
content: '',
};
styleMaps[filePath] = mapEntry;
styles.push(mapEntry);
}
return util_1.promisify(sassRuntime.render.bind(sassRuntime))(resolvedOptions)

@@ -151,5 +146,3 @@ .then(res => processRenderResponse(pluginOptions, filePath, pluginState, res.css.toString().trim())

}
const stylesToProcess = pluginState.styles.filter(Boolean), css = stylesToProcess.map(style => style.content).join(''), { output, insert } = pluginOptions;
pluginState.styles = stylesToProcess;
pluginState.priority = stylesToProcess.length;
const { styles } = pluginState, css = styles.map(style => style.content).join(''), { output, insert } = pluginOptions;
if (typeof output === 'string') {

@@ -160,3 +153,3 @@ return fs.promises.mkdir(path_1.dirname(output), { recursive: true })

else if (typeof output === 'function') {
return Promise.resolve(output(css, stylesToProcess));
return Promise.resolve(output(css, styles));
}

@@ -175,4 +168,3 @@ else if (!insert && generateOptions.file && output === true) {

};
}
exports.default = plugin;
};
//# sourceMappingURL=index.js.map

@@ -19,6 +19,6 @@ import { types } from 'sass';

}
export interface SassImporterResult {
export declare type SassImporterResult = null | {
file?: string;
contents?: string;
}
} | Error;
export declare type SassDoneFn<T extends SassImporterResult = SassImporterResult> = (result: T) => void | T;

@@ -25,0 +25,0 @@ export declare type SassImporter<T extends SassImporterResult = SassImporterResult> = (url: string, prev: string, done: SassDoneFn<T>) => void | T;

{
"name": "rollup-plugin-sass",
"version": "1.2.6",
"version": "1.2.7",
"description": "Rollup Sass files.",

@@ -62,2 +62,3 @@ "main": "dist/index.js",

"eslint": "^7.32.0",
"jsdom": "^17.0.0",
"nyc": "^15.1.0",

@@ -64,0 +65,0 @@ "rollup": "^1.32.1",

Sorry, the diff of this file is not supported yet

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