magic-string-ast
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -86,3 +86,4 @@ "use strict"; | ||
MagicString, | ||
MagicStringBase | ||
MagicStringBase, | ||
...require("magic-string") | ||
}); |
@@ -86,3 +86,4 @@ "use strict"; | ||
MagicString, | ||
MagicStringBase | ||
MagicStringBase, | ||
...require("magic-string") | ||
}); |
{ | ||
"name": "magic-string-ast", | ||
"version": "0.1.2", | ||
"packageManager": "pnpm@7.29.3", | ||
"description": "Extend magic-string for Babel AST.", | ||
"version": "0.1.3", | ||
"packageManager": "pnpm@8.6.5", | ||
"description": "Extend Babel AST for magic-string.", | ||
"license": "MIT", | ||
@@ -23,3 +23,6 @@ "homepage": "https://github.com/sxzz/magic-string-ast#readme", | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"types": { | ||
"require": "./dist/index.d.ts", | ||
"import": "./dist/index.d.mts" | ||
}, | ||
"require": "./dist/index.js", | ||
@@ -37,18 +40,18 @@ "import": "./dist/index.mjs" | ||
"devDependencies": { | ||
"@babel/types": "^7.21.3", | ||
"@sxzz/eslint-config-prettier": "^2.4.5", | ||
"@sxzz/eslint-config-ts": "^2.4.5", | ||
"@types/node": "^18.15.3", | ||
"bumpp": "^9.0.0", | ||
"eslint": "^8.36.0", | ||
"eslint-define-config": "^1.16.0", | ||
"fast-glob": "^3.2.12", | ||
"prettier": "^2.8.4", | ||
"tsup": "^6.6.3", | ||
"tsx": "^3.12.5", | ||
"typescript": "^4.9.5", | ||
"vitest": "^0.29.2" | ||
"@babel/types": "^7.22.5", | ||
"@sxzz/eslint-config-prettier": "^2.4.6", | ||
"@sxzz/eslint-config-ts": "^2.4.6", | ||
"@types/node": "^18.16.19", | ||
"bumpp": "^9.1.1", | ||
"eslint": "^8.44.0", | ||
"eslint-define-config": "^1.21.0", | ||
"fast-glob": "^3.3.0", | ||
"prettier": "^2.8.8", | ||
"tsup": "^7.1.0", | ||
"tsx": "^3.12.7", | ||
"typescript": "^5.1.6", | ||
"vitest": "^0.32.2" | ||
}, | ||
"engines": { | ||
"node": ">=14.19.0" | ||
"node": ">=16.14.0" | ||
}, | ||
@@ -55,0 +58,0 @@ "scripts": { |
@@ -5,2 +5,4 @@ # magic-string-ast [![npm](https://img.shields.io/npm/v/magic-string-ast.svg)](https://npmjs.com/package/magic-string-ast) | ||
Extend Babel AST for [magic-string](https://github.com/rich-harris/magic-string). | ||
## Install | ||
@@ -12,2 +14,22 @@ | ||
## Usage | ||
```ts | ||
import { MagicString } from 'magic-string-ast' | ||
const offset = 0 | ||
const node = { | ||
// ... | ||
// AST node from @babel/parser | ||
} | ||
const s = new MagicString('const a = 1') | ||
s.removeNode(node) | ||
s.moveNode(node, 0) | ||
console.log(s.sliceNode(node, { offset })) | ||
s.overwriteNode(node, 'const b = 2') | ||
``` | ||
For more APIs, see [magic-string](https://github.com/rich-harris/magic-string#usage). | ||
## Sponsors | ||
@@ -14,0 +36,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13641
8
246
44