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

rollup-plugin-preserve-directives

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-preserve-directives - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

10

dist/index.js

@@ -21,7 +21,11 @@ "use strict";

const ast = this.parse(code);
if (ast.type === "Program") {
if (ast.type === "Program" && ast.body) {
const directives = [];
let i = 0;
while (((_a = ast.body) === null || _a === void 0 ? void 0 : _a[i].type) === "ExpressionStatement") {
const node = ast.body[i];
// Nodes in body should never be falsy, but issue #5 tells us otherwise
// so just in case we filter them out here
const filteredBody = ast.body.filter(Boolean);
// .type must be defined according to the spec, but just in case..
while (((_a = filteredBody[i]) === null || _a === void 0 ? void 0 : _a.type) === "ExpressionStatement") {
const node = filteredBody[i];
if (node.directive) {

@@ -28,0 +32,0 @@ directives.push(node.directive);

{
"name": "rollup-plugin-preserve-directives",
"description": "A Rollup plugin to preserve directives like \"use client\" when preserveModules is true.",
"version": "0.1.0",
"version": "0.1.1",
"author": "Fredrik Höglund <fredrik.hoglund@gmail.com>",

@@ -28,4 +28,6 @@ "license": "MIT",

},
"dependencies": {
"magic-string": "^0.30.0"
},
"devDependencies": {
"magic-string": "^0.30.0",
"rollup": "^3.19.1",

@@ -32,0 +34,0 @@ "typescript": "^4.9.5"

@@ -32,3 +32,3 @@ # rollup-plugin-preserve-directives

If you are using a minifier like terser, make sure that is not removing this comment. In terser, you can set [`compress.directives`](https://terser.org/docs/api-reference#compress-options) to `false`.
If you are using a minifier like terser, make sure that is not removing the directive again. In terser, you can set [`compress.directives`](https://terser.org/docs/api-reference#compress-options) to `false`.

@@ -35,0 +35,0 @@ ## Disabling warnings

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