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

magic-string-ast

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

magic-string-ast - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

16

./dist/index.js

@@ -42,2 +42,4 @@ "use strict";

removeNode(node, { offset = 0 } = {}) {
if (isEmptyNodes(node))
return this;
super.remove(...getNodePos(node, offset));

@@ -47,2 +49,4 @@ return this;

moveNode(node, index, { offset = 0 } = {}) {
if (isEmptyNodes(node))
return this;
super.move(...getNodePos(node, offset), index);

@@ -52,5 +56,9 @@ return this;

sliceNode(node, { offset = 0 } = {}) {
if (isEmptyNodes(node))
return "";
return super.slice(...getNodePos(node, offset));
}
overwriteNode(node, content, { offset = 0, ...options } = {}) {
if (isEmptyNodes(node))
return this;
const _content = typeof content === "string" ? content : this.sliceNode(content);

@@ -61,2 +69,7 @@ super.overwrite(...getNodePos(node, offset), _content, options);

snipNode(node, { offset = 0 } = {}) {
if (isEmptyNodes(node))
return new import_magic_string.default("", {
// @ts-expect-error
filename: super.filename
});
return super.snip(...getNodePos(node, offset));

@@ -71,2 +84,5 @@ }

}
function isEmptyNodes(nodes) {
return Array.isArray(nodes) && nodes.length === 0;
}
// Annotate the CommonJS export names for ESM import in node:

@@ -73,0 +89,0 @@ 0 && (module.exports = {

@@ -42,2 +42,4 @@ "use strict";

removeNode(node, { offset = 0 } = {}) {
if (isEmptyNodes(node))
return this;
super.remove(...getNodePos(node, offset));

@@ -47,2 +49,4 @@ return this;

moveNode(node, index, { offset = 0 } = {}) {
if (isEmptyNodes(node))
return this;
super.move(...getNodePos(node, offset), index);

@@ -52,5 +56,9 @@ return this;

sliceNode(node, { offset = 0 } = {}) {
if (isEmptyNodes(node))
return "";
return super.slice(...getNodePos(node, offset));
}
overwriteNode(node, content, { offset = 0, ...options } = {}) {
if (isEmptyNodes(node))
return this;
const _content = typeof content === "string" ? content : this.sliceNode(content);

@@ -61,2 +69,7 @@ super.overwrite(...getNodePos(node, offset), _content, options);

snipNode(node, { offset = 0 } = {}) {
if (isEmptyNodes(node))
return new import_magic_string.default("", {
// @ts-expect-error
filename: super.filename
});
return super.snip(...getNodePos(node, offset));

@@ -71,2 +84,5 @@ }

}
function isEmptyNodes(nodes) {
return Array.isArray(nodes) && nodes.length === 0;
}
// Annotate the CommonJS export names for ESM import in node:

@@ -73,0 +89,0 @@ 0 && (module.exports = {

2

package.json
{
"name": "magic-string-ast",
"version": "0.1.1",
"version": "0.1.2",
"packageManager": "pnpm@7.29.3",

@@ -5,0 +5,0 @@ "description": "Extend magic-string for Babel AST.",

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