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

rollup-preserve-directives

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-preserve-directives - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

23

dist/cjs/index.js

@@ -27,2 +27,4 @@ Object.defineProperty(exports, '__esModule', { value: true });

const magicString = new MagicString__default.default(code);
// MagicString's `hasChanged()` is slow, so we track the change manually
let hasChanged = false;
/**

@@ -51,2 +53,3 @@ * Here we are making 3 assumptions:

magicString.remove(0, firstNewLineIndex + 1);
hasChanged = true;
}

@@ -58,2 +61,3 @@ }

try {
// rollup 2 built-in parser doesn't have `allowShebang`, we need to use the sliced code here. Hence the `magicString.toString()`
ast = this.parse(magicString.toString(), {

@@ -101,10 +105,15 @@ allowReturnOutsideFunction: true,

magicString.remove(node.start, node.end);
hasChanged = true;
}
}
}
if (!hasChanged) {
// If nothing has changed, we can avoid the expensive `toString()` and `generateMap()` calls
return null;
}
return {
code: magicString ? magicString.toString() : code,
map: magicString ? magicString.generateMap({
code: magicString.toString(),
map: magicString.generateMap({
hires: true
}) : null,
}),
meta: {

@@ -144,5 +153,9 @@ preserveDirectives: {

}
// Neither outputDirectives nor meta.shebang is present, no change is needed
if (!magicString) {
return null;
}
return {
code: magicString ? magicString.toString() : code,
map: sourcemap && magicString ? magicString.generateMap({
code: magicString.toString(),
map: sourcemap ? magicString.generateMap({
hires: true

@@ -149,0 +162,0 @@ }) : null

{
"name": "rollup-preserve-directives",
"version": "1.1.0",
"version": "1.1.1",
"description": "Rollup plugin to preserve directives",

@@ -17,8 +17,2 @@ "types": "./dist/index.d.ts",

],
"scripts": {
"build": "bunchee",
"prepublishOnly": "rm -rf dist && pnpm run build",
"test": "jest --env node",
"test:update": "jest --env node --updateSnapshot"
},
"keywords": [

@@ -55,3 +49,8 @@ "rollup",

},
"packageManager": "pnpm@7.24.3"
}
"packageManager": "pnpm@7.24.3",
"scripts": {
"build": "bunchee",
"test": "jest --env node",
"test:update": "jest --env node --updateSnapshot"
}
}

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