Socket
Socket
Sign inDemoInstall

magic-string

Package Overview
Dependencies
1
Maintainers
3
Versions
114
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.24.1 to 0.25.0

5

CHANGELOG.md
# magic-string changelog
## 0.25.0
* Add `length` method ([#145](https://github.com/Rich-Harris/magic-string/pull/145))
* Fix trimming chunks with intro/outro ([#144](https://github.com/Rich-Harris/magic-string/pull/144))
## 0.24.1

@@ -4,0 +9,0 @@

21

dist/magic-string.cjs.js

@@ -127,3 +127,3 @@ 'use strict';

if (trimmed !== this.content) {
this.split(this.start + trimmed.length).edit('', false);
this.split(this.start + trimmed.length).edit('', undefined, true);
}

@@ -133,3 +133,3 @@ return true;

} else {
this.edit('', false);
this.edit('', undefined, true);

@@ -150,3 +150,3 @@ this.intro = this.intro.replace(rx, '');

this.split(this.end - trimmed.length);
this.edit('', false);
this.edit('', undefined, true);
}

@@ -156,3 +156,3 @@ return true;

} else {
this.edit('', false);
this.edit('', undefined, true);

@@ -941,2 +941,11 @@ this.outro = this.outro.replace(rx, '');

MagicString.prototype.length = function length () {
var chunk = this.firstChunk;
var length = 0;
do {
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
} while (chunk = chunk.next);
return length;
};
MagicString.prototype.trimLines = function trimLines () {

@@ -1259,2 +1268,6 @@ return this.trim('[\\r\\n]');

Bundle.prototype.length = function length () {
return this.sources.reduce(function (length, source) { return length + source.content.length(); }, this.intro.length);
};
Bundle.prototype.trimLines = function trimLines () {

@@ -1261,0 +1274,0 @@ return this.trim('[\\r\\n]');

@@ -125,3 +125,3 @@ import { encode } from 'sourcemap-codec';

if (trimmed !== this.content) {
this.split(this.start + trimmed.length).edit('', false);
this.split(this.start + trimmed.length).edit('', undefined, true);
}

@@ -131,3 +131,3 @@ return true;

} else {
this.edit('', false);
this.edit('', undefined, true);

@@ -148,3 +148,3 @@ this.intro = this.intro.replace(rx, '');

this.split(this.end - trimmed.length);
this.edit('', false);
this.edit('', undefined, true);
}

@@ -154,3 +154,3 @@ return true;

} else {
this.edit('', false);
this.edit('', undefined, true);

@@ -939,2 +939,11 @@ this.outro = this.outro.replace(rx, '');

MagicString.prototype.length = function length () {
var chunk = this.firstChunk;
var length = 0;
do {
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
} while (chunk = chunk.next);
return length;
};
MagicString.prototype.trimLines = function trimLines () {

@@ -1257,2 +1266,6 @@ return this.trim('[\\r\\n]');

Bundle.prototype.length = function length () {
return this.sources.reduce(function (length, source) { return length + source.content.length(); }, this.intro.length);
};
Bundle.prototype.trimLines = function trimLines () {

@@ -1259,0 +1272,0 @@ return this.trim('[\\r\\n]');

@@ -129,3 +129,3 @@ (function (global, factory) {

if (trimmed !== this.content) {
this.split(this.start + trimmed.length).edit('', false);
this.split(this.start + trimmed.length).edit('', undefined, true);
}

@@ -135,3 +135,3 @@ return true;

} else {
this.edit('', false);
this.edit('', undefined, true);

@@ -152,3 +152,3 @@ this.intro = this.intro.replace(rx, '');

this.split(this.end - trimmed.length);
this.edit('', false);
this.edit('', undefined, true);
}

@@ -158,3 +158,3 @@ return true;

} else {
this.edit('', false);
this.edit('', undefined, true);

@@ -999,2 +999,11 @@ this.outro = this.outro.replace(rx, '');

MagicString.prototype.length = function length () {
var chunk = this.firstChunk;
var length = 0;
do {
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
} while (chunk = chunk.next);
return length;
};
MagicString.prototype.trimLines = function trimLines () {

@@ -1317,2 +1326,6 @@ return this.trim('[\\r\\n]');

Bundle.prototype.length = function length () {
return this.sources.reduce(function (length, source) { return length + source.content.length(); }, this.intro.length);
};
Bundle.prototype.trimLines = function trimLines () {

@@ -1319,0 +1332,0 @@ return this.trim('[\\r\\n]');

@@ -52,2 +52,3 @@ export interface BundleOptions {

isEmpty(): boolean;
length(): number;
}

@@ -100,4 +101,5 @@

isEmpty(): boolean;
length(): number;
original: string;
}

2

package.json

@@ -5,3 +5,3 @@ {

"author": "Rich Harris",
"version": "0.24.1",
"version": "0.25.0",
"repository": "https://github.com/rich-harris/magic-string",

@@ -8,0 +8,0 @@ "main": "dist/magic-string.cjs.js",

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc