magic-string-ast
Advanced tools
+5
-7
| import MagicString from "magic-string"; | ||
| export * from "magic-string" | ||
| export * from "magic-string"; | ||
| //#region src/index.ts | ||
@@ -10,2 +8,3 @@ /** | ||
| var MagicStringAST = class MagicStringAST { | ||
| prototype; | ||
| s; | ||
@@ -40,3 +39,3 @@ constructor(str, options, prototype = typeof str === "string" ? MagicString : str.constructor) { | ||
| } | ||
| overwriteNode(node, content, { offset,...options } = {}) { | ||
| overwriteNode(node, content, { offset, ...options } = {}) { | ||
| if (isEmptyNodes(node)) return this; | ||
@@ -91,3 +90,3 @@ const _content = typeof content === "string" ? content : this.sliceNode(content); | ||
| let index = start; | ||
| state.nodes.filter((node) => node.start >= start && node.end <= end).sort((a, b) => a.start - b.start).forEach((node) => { | ||
| state.nodes.filter((node) => node.start >= start && node.end <= end).toSorted((a, b) => a.start - b.start).forEach((node) => { | ||
| if (node.start > index) this.remove(index, node.start); | ||
@@ -119,4 +118,3 @@ index = node.end; | ||
| } | ||
| //#endregion | ||
| export { MagicString, MagicStringAST, generateTransform }; | ||
| export { MagicString, MagicStringAST, generateTransform }; |
+26
-33
| { | ||
| "name": "magic-string-ast", | ||
| "version": "1.0.3", | ||
| "type": "module", | ||
| "version": "2.0.0", | ||
| "description": "magic-string with AST shortcut.", | ||
| "type": "module", | ||
| "author": "Kevin Deng <sxzz@sxzz.moe>", | ||
| "license": "MIT", | ||
| "funding": "https://github.com/sponsors/sxzz", | ||
| "homepage": "https://github.com/sxzz/magic-string-ast#readme", | ||
| "bugs": { | ||
| "url": "https://github.com/sxzz/magic-string-ast/issues" | ||
| }, | ||
| "repository": { | ||
@@ -15,10 +14,5 @@ "type": "git", | ||
| }, | ||
| "author": "Kevin Deng <sxzz@sxzz.moe>", | ||
| "funding": "https://github.com/sponsors/sxzz", | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "main": "./dist/index.js", | ||
| "module": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "bugs": { | ||
| "url": "https://github.com/sxzz/magic-string-ast/issues" | ||
| }, | ||
| "exports": { | ||
@@ -28,30 +22,29 @@ ".": "./dist/index.js", | ||
| }, | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "engines": { | ||
| "node": "^22.18.0 || >=24.0.0" | ||
| }, | ||
| "dependencies": { | ||
| "magic-string": "^0.30.19" | ||
| "magic-string": "^0.30.21" | ||
| }, | ||
| "devDependencies": { | ||
| "@sxzz/eslint-config": "^7.2.7", | ||
| "@sxzz/prettier-config": "^2.2.4", | ||
| "@types/node": "^24.7.0", | ||
| "bumpp": "^10.3.1", | ||
| "eslint": "^9.37.0", | ||
| "fast-glob": "^3.3.3", | ||
| "@sxzz/eslint-config": "^8.1.0", | ||
| "@sxzz/prettier-config": "^2.3.1", | ||
| "@types/node": "^25.7.0", | ||
| "@typescript/native-preview": "7.0.0-dev.20260512.1", | ||
| "bumpp": "^11.1.0", | ||
| "eslint": "^10.3.0", | ||
| "magic-string-stack": "^1.1.0", | ||
| "prettier": "^3.6.2", | ||
| "tsdown": "^0.15.6", | ||
| "tsx": "^4.20.6", | ||
| "typescript": "^5.9.3", | ||
| "vitest": "^3.2.4" | ||
| "prettier": "^3.8.3", | ||
| "tsdown": "^0.22.0", | ||
| "tsdown-preset-sxzz": "^0.6.0", | ||
| "typescript": "^6.0.3", | ||
| "vitest": "^4.1.6" | ||
| }, | ||
| "engines": { | ||
| "node": ">=20.19.0" | ||
| }, | ||
| "prettier": "@sxzz/prettier-config", | ||
| "tsdown": { | ||
| "exports": true, | ||
| "inlineOnly": [] | ||
| }, | ||
| "scripts": { | ||
@@ -62,3 +55,3 @@ "lint": "eslint .", | ||
| "test": "vitest", | ||
| "typecheck": "tsc --noEmit", | ||
| "typecheck": "tsgo --noEmit", | ||
| "format": "prettier --cache --write .", | ||
@@ -65,0 +58,0 @@ "release": "bumpp" |
181
1.12%9868
-0.8%Updated