New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-rebase

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-rebase - npm Package Compare versions

Comparing version 0.11.2 to 0.11.3

2

lib/node.commonjs.js

@@ -1,2 +0,2 @@

/*! rollup-plugin-rebase v0.11.2 by Sebastian Werner <s.werner@sebastian-software.de> */
/*! rollup-plugin-rebase v0.11.3 by Sebastian Werner <s.werner@sebastian-software.de> */
'use strict';

@@ -3,0 +3,0 @@

@@ -8,4 +8,4 @@ /*! rollup-plugin-rebase v0.6.2 by Sebastian Werner <s.werner@sebastian-software.de> */

import postcss from 'postcss';
import postcssImport from 'postcss-import';
import postcssSmartAsset from 'postcss-smart-asset';
import postcssSmartImport from 'postcss-smart-import';
import postcssSimpleUrl from 'postcss-simple-url';
import postcssSugarSS from 'sugarss';

@@ -18,5 +18,3 @@ import postcssScss from 'postcss-scss';

var writeAsync = denodeify(fs.outputFile);
const styleParser = {
".pcss": null,
var styleParser = {
".css": null,

@@ -27,4 +25,4 @@ ".sss": postcssSugarSS,

};
var postcssPlugins = [postcssSmartImport(), postcssSimpleUrl()];
const postcssPlugins = [postcssImport(), postcssSmartAsset()];

@@ -36,7 +34,9 @@ function processStyle(code, id, dest) {

to: dest,
extensions: [".pcss", ".css", ".sss", ".scss", ".sass"],
extensions: [".css", ".sss", ".scss", ".sass"],
// Always uses parser... even for scss as we like to offer "normal" CSS in deployed files.
parser
}).then(result => writeAsync(dest, result))["catch"](error => {
parser: parser
}).then(function (result) {
return writeAsync(dest, result);
})["catch"](function (error) {
console.error(error);

@@ -46,13 +46,19 @@ });

const hashType = "sha256";
const digestType = "base62";
const digestLength = 8;
var hashType = "sha256";
var digestType = "base62";
var digestLength = 8;
var externalIds = {};
var defaultExclude = ["**/*.json", "**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx", "**/*.vue"];
const externalIds = {};
const defaultExclude = ["**/*.json", "**/*.mjs", "**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx", "**/*.vue"];
function rebase() {
var options = 0 < arguments.length && arguments[0] !== undefined ? arguments[0] : {},
include = options.include,
_options$exclude = options.exclude,
exclude = _options$exclude === undefined ? defaultExclude : _options$exclude,
entry = options.entry,
outputFolder = options.outputFolder,
verbose = options.verbose,
filter = createFilter(include, exclude);
function rebase(options = {}) {
const { include, exclude = defaultExclude, entry, outputFolder, verbose } = options;
const filter = createFilter(include, exclude);

@@ -62,8 +68,7 @@ return {

isExternal(id) {
var baseName = `./${path.basename(id)}`;
isExternal: function isExternal(id) {
var baseName = "./" + path.basename(id);
return baseName in externalIds;
},
resolveId(importee) {
resolveId: function resolveId(importee) {
if (importee in externalIds) {

@@ -79,4 +84,3 @@ // This does not yet seem to work!

},
load(id) {
load: function load(id) {
if (!filter(id)) {

@@ -86,31 +90,31 @@ return null;

const input = fs.createReadStream(id);
var input = fs.createReadStream(id);
return new Promise((resolve, reject) => {
input.on("readable", () => {
var fileSource = id;
var fileContent = fs.readFileSync(fileSource);
var fileExt = path.extname(id);
var fileHash = getHashDigest(fileContent, hashType, digestType, digestLength);
return new Promise(function (resolve) {
input.on("readable", function () {
var fileSource = id,
fileContent = fs.readFileSync(fileSource),
fileExt = path.extname(id),
fileHash = getHashDigest(fileContent, hashType, digestType, digestLength),
destExt = fileExt in styleParser ? ".css" : fileExt,
destId = path.basename(id, fileExt) + "-" + fileHash + destExt,
fileDest = path.resolve(outputFolder, destId);
var destExt = fileExt in styleParser ? ".css" : fileExt;
var destId = `${path.basename(id, fileExt)}-${fileHash}${destExt}`;
var fileDest = path.resolve(outputFolder, destId);
// Mark new file location as external to prevent further processing.
externalIds[`./${destId}`] = true;
externalIds["./" + destId] = true;
var entryFolder = path.dirname(path.resolve(entry));
var relativeToRoot = path.relative(path.dirname(fileSource), entryFolder).replace(/\\/g, "/");
var entryFolder = path.dirname(path.resolve(entry)),
relativeToRoot = path.relative(path.dirname(fileSource), entryFolder).replace(/\\/g, "/"),
importId;
// Adjust destId so that it points to the root folder - from any
// depth we detected inside the original project structure.
var importId;
if (relativeToRoot.charAt(0) === ".") {
importId = `${relativeToRoot}/${destId}`;
} else if (relativeToRoot === "") {
importId = `./${destId}`;
if ("." === relativeToRoot.charAt(0)) {
importId = relativeToRoot + "/" + destId;
} else if ("" === relativeToRoot) {
importId = "./" + destId;
} else {
importId = `./${relativeToRoot}/${destId}`;
importId = "./" + relativeToRoot + "/" + destId;
}

@@ -120,18 +124,22 @@

if (verbose) {
console.log(`Processing ${fileSource} => ${fileDest}...`);
console.log("Processing " + fileSource + " => " + fileDest + "...");
}
return processStyle(fileContent, fileSource, fileDest).then(() => resolve({
code: `import _${fileHash} from "${importId}"; export default _${fileHash};`,
map: { mappings: "" }
}));
return processStyle(fileContent, fileSource, fileDest).then(function () {
return resolve({
code: "import _" + fileHash + " from \"" + importId + "\"; export default _" + fileHash + ";",
map: { mappings: "" }
});
});
} else {
if (verbose) {
console.log(`Copying ${fileSource} => ${fileDest}...`);
console.log("Copying " + fileSource + " => " + fileDest + "...");
}
return copyAsync(fileSource, fileDest).then(() => resolve({
code: `import _${fileHash} from "${importId}"; export default _${fileHash};`,
map: { mappings: "" }
}));
return copyAsync(fileSource, fileDest).then(function () {
return resolve({
code: "import _" + fileHash + " from \"" + importId + "\"; export default _" + fileHash + ";",
map: { mappings: "" }
});
});
}

@@ -138,0 +146,0 @@ });

@@ -1,2 +0,2 @@

/*! rollup-plugin-rebase v0.11.2 by Sebastian Werner <s.werner@sebastian-software.de> */
/*! rollup-plugin-rebase v0.11.3 by Sebastian Werner <s.werner@sebastian-software.de> */
import nodentRuntime from 'nodent-runtime';

@@ -3,0 +3,0 @@ import path from 'path';

{
"name": "rollup-plugin-rebase",
"version": "0.11.2",
"version": "0.11.3",
"description": "The Rollup Rebase Plugin copies static assets as required from your JavaScript code to the destination folder and adjusts the references in there to point to the new location.",

@@ -52,3 +52,3 @@ "keywords": [

"postcss-scss": "^1.0.2",
"postcss-smart-asset": "^0.3.0",
"postcss-smart-asset": "^0.4.1",
"rollup-pluginutils": "^2.0.1",

@@ -60,3 +60,3 @@ "sugarss": "^1.0.0"

"jest": "^21.2.1",
"prepublish": "^1.4.3",
"prepublish": "^1.5.0",
"readable-code": "^3.4.14",

@@ -63,0 +63,0 @@ "rimraf": "^2.6.2",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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