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

magic-string

Package Overview
Dependencies
Maintainers
4
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

magic-string - npm Package Compare versions

Comparing version 0.26.1 to 0.26.2

13

package.json
{
"name": "magic-string",
"version": "0.26.1",
"version": "0.26.2",
"description": "Modify strings, generate sourcemaps",

@@ -15,5 +15,6 @@ "keywords": [

"author": "Rich Harris",
"main": "dist/magic-string.cjs.js",
"module": "dist/magic-string.es.mjs",
"jsnext:main": "dist/magic-string.es.mjs",
"main": "./dist/magic-string.cjs.js",
"module": "./dist/magic-string.es.mjs",
"jsnext:main": "./dist/magic-string.es.mjs",
"types": "./index.d.ts",
"exports": {

@@ -23,6 +24,6 @@ "./package.json": "./package.json",

"import": "./dist/magic-string.es.mjs",
"require": "./dist/magic-string.cjs.js"
"require": "./dist/magic-string.cjs.js",
"types": "./index.d.ts"
}
},
"typings": "index.d.ts",
"files": [

@@ -29,0 +30,0 @@ "dist/*",

@@ -16,3 +16,3 @@ # magic-string

Suppose you have some source code. You want to make some light modifications to it - replacing a few characters here and there, wrapping it with a header and footer, etc - and ideally you'd like to generate a source map at the end of it. You've thought about using something like [recast](https://github.com/benjamn/recast) (which allows you to generate an AST from some JavaScript, manipulate it, and reprint it with a sourcemap without losing your comments and formatting), but it seems like overkill for your needs (or maybe the source code isn't JavaScript).
Suppose you have some source code. You want to make some light modifications to it - replacing a few characters here and there, wrapping it with a header and footer, etc - and ideally you'd like to generate a [source map](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/) at the end of it. You've thought about using something like [recast](https://github.com/benjamn/recast) (which allows you to generate an AST from some JavaScript, manipulate it, and reprint it with a sourcemap without losing your comments and formatting), but it seems like overkill for your needs (or maybe the source code isn't JavaScript).

@@ -178,3 +178,3 @@ Your requirements are, frankly, rather niche. But they're requirements that I also have, and for which I made magic-string. It's a small, fast utility for manipulating strings and generating sourcemaps.

s.replace(foo, 'bar')
s.replace('foo', 'bar')
s.replace(/foo/g, 'bar')

@@ -181,0 +181,0 @@ s.replace(/(\w)(\d+)/g, (_, $1, $2) => $1.toUpperCase() + $2)

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