magic-string
Advanced tools
Comparing version 0.25.8 to 0.25.9
@@ -683,3 +683,3 @@ 'use strict'; | ||
var original = this.original.slice(start, end); | ||
this.storedNames[original] = true; | ||
Object.defineProperty(this.storedNames, original, { writable: true, value: true, enumerable: true }); | ||
} | ||
@@ -691,17 +691,12 @@ | ||
if (first) { | ||
if (end > first.end && first.next !== this.byStart[first.end]) { | ||
throw new Error('Cannot overwrite across a split point'); | ||
var chunk = first; | ||
while (chunk !== last) { | ||
if (chunk.next !== this.byStart[chunk.end]) { | ||
throw new Error('Cannot overwrite across a split point'); | ||
} | ||
chunk = chunk.next; | ||
chunk.edit('', false); | ||
} | ||
first.edit(content, storeName, contentOnly); | ||
if (first !== last) { | ||
var chunk = first.next; | ||
while (chunk !== last) { | ||
chunk.edit('', false); | ||
chunk = chunk.next; | ||
} | ||
chunk.edit('', false); | ||
} | ||
} else { | ||
@@ -708,0 +703,0 @@ // must be inserting at the end |
@@ -681,3 +681,3 @@ import { encode } from 'sourcemap-codec'; | ||
var original = this.original.slice(start, end); | ||
this.storedNames[original] = true; | ||
Object.defineProperty(this.storedNames, original, { writable: true, value: true, enumerable: true }); | ||
} | ||
@@ -689,17 +689,12 @@ | ||
if (first) { | ||
if (end > first.end && first.next !== this.byStart[first.end]) { | ||
throw new Error('Cannot overwrite across a split point'); | ||
var chunk = first; | ||
while (chunk !== last) { | ||
if (chunk.next !== this.byStart[chunk.end]) { | ||
throw new Error('Cannot overwrite across a split point'); | ||
} | ||
chunk = chunk.next; | ||
chunk.edit('', false); | ||
} | ||
first.edit(content, storeName, contentOnly); | ||
if (first !== last) { | ||
var chunk = first.next; | ||
while (chunk !== last) { | ||
chunk.edit('', false); | ||
chunk = chunk.next; | ||
} | ||
chunk.edit('', false); | ||
} | ||
} else { | ||
@@ -706,0 +701,0 @@ // must be inserting at the end |
@@ -741,3 +741,3 @@ (function (global, factory) { | ||
var original = this.original.slice(start, end); | ||
this.storedNames[original] = true; | ||
Object.defineProperty(this.storedNames, original, { writable: true, value: true, enumerable: true }); | ||
} | ||
@@ -749,17 +749,12 @@ | ||
if (first) { | ||
if (end > first.end && first.next !== this.byStart[first.end]) { | ||
throw new Error('Cannot overwrite across a split point'); | ||
var chunk = first; | ||
while (chunk !== last) { | ||
if (chunk.next !== this.byStart[chunk.end]) { | ||
throw new Error('Cannot overwrite across a split point'); | ||
} | ||
chunk = chunk.next; | ||
chunk.edit('', false); | ||
} | ||
first.edit(content, storeName, contentOnly); | ||
if (first !== last) { | ||
var chunk = first.next; | ||
while (chunk !== last) { | ||
chunk.edit('', false); | ||
chunk = chunk.next; | ||
} | ||
chunk.edit('', false); | ||
} | ||
} else { | ||
@@ -766,0 +761,0 @@ // must be inserting at the end |
@@ -15,15 +15,15 @@ export interface BundleOptions { | ||
*/ | ||
hires: boolean; | ||
hires?: boolean; | ||
/** | ||
* The filename where you plan to write the sourcemap. | ||
*/ | ||
file: string; | ||
file?: string; | ||
/** | ||
* The filename of the file containing the original source. | ||
*/ | ||
source: string; | ||
source?: string; | ||
/** | ||
* Whether to include the original content in the map's sourcesContent array. | ||
*/ | ||
includeContent: boolean; | ||
includeContent?: boolean; | ||
} | ||
@@ -60,3 +60,3 @@ | ||
* Returns a DataURI containing the sourcemap. Useful for doing this sort of thing: | ||
* `generateMap(options?: Partial<SourceMapOptions>): SourceMap;` | ||
* `generateMap(options?: SourceMapOptions): SourceMap;` | ||
*/ | ||
@@ -71,4 +71,4 @@ toUrl(): string; | ||
clone(): Bundle; | ||
generateMap(options?: Partial<SourceMapOptions>): SourceMap; | ||
generateDecodedMap(options?: Partial<SourceMapOptions>): DecodedSourceMap; | ||
generateMap(options?: SourceMapOptions): SourceMap; | ||
generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap; | ||
getIndentString(): string; | ||
@@ -90,9 +90,9 @@ indent(indentStr?: string): Bundle; | ||
export interface MagicStringOptions { | ||
filename: string, | ||
indentExclusionRanges: ExclusionRange | Array<ExclusionRange>; | ||
filename?: string, | ||
indentExclusionRanges?: ExclusionRange | Array<ExclusionRange>; | ||
} | ||
export interface IndentOptions { | ||
exclude: ExclusionRange | Array<ExclusionRange>; | ||
indentStart: boolean; | ||
exclude?: ExclusionRange | Array<ExclusionRange>; | ||
indentStart?: boolean; | ||
} | ||
@@ -106,3 +106,3 @@ | ||
export default class MagicString { | ||
constructor(str: string, options?: Partial<MagicStringOptions>); | ||
constructor(str: string, options?: MagicStringOptions); | ||
/** | ||
@@ -135,3 +135,3 @@ * Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is false. | ||
*/ | ||
generateMap(options?: Partial<SourceMapOptions>): SourceMap; | ||
generateMap(options?: SourceMapOptions): SourceMap; | ||
/** | ||
@@ -141,3 +141,3 @@ * Generates a sourcemap object with raw mappings in array form, rather than encoded as a string. | ||
*/ | ||
generateDecodedMap(options?: Partial<SourceMapOptions>): DecodedSourceMap; | ||
generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap; | ||
getIndentString(): string; | ||
@@ -144,0 +144,0 @@ |
{ | ||
"name": "magic-string", | ||
"version": "0.25.9", | ||
"description": "Modify strings, generate sourcemaps", | ||
"keywords": [ | ||
"string", | ||
"string manipulation", | ||
"sourcemap", | ||
"templating", | ||
"transpilation" | ||
], | ||
"repository": "https://github.com/rich-harris/magic-string", | ||
"license": "MIT", | ||
"author": "Rich Harris", | ||
"version": "0.25.8", | ||
"repository": "https://github.com/rich-harris/magic-string", | ||
"main": "dist/magic-string.cjs.js", | ||
@@ -11,3 +19,19 @@ "module": "dist/magic-string.es.js", | ||
"typings": "index.d.ts", | ||
"license": "MIT", | ||
"files": [ | ||
"dist/*", | ||
"index.d.ts", | ||
"README.md" | ||
], | ||
"scripts": { | ||
"build": "rollup -c", | ||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", | ||
"format": "prettier --single-quote --print-width 100 --use-tabs --write src/*.js src/**/*.js", | ||
"lint": "eslint src test", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "rm -rf dist && npm test", | ||
"release": "bumpp -x \"npm run changelog\" --all --commit --tag --push && npm publish", | ||
"pretest": "npm run lint && npm run build", | ||
"test": "mocha", | ||
"watch": "rollup -cw" | ||
}, | ||
"dependencies": { | ||
@@ -22,3 +46,3 @@ "sourcemap-codec": "^1.4.8" | ||
"conventional-changelog-cli": "^2.2.2", | ||
"eslint": "^8.10.0", | ||
"eslint": "^7.32.0", | ||
"mocha": "^9.2.1", | ||
@@ -29,27 +53,3 @@ "prettier": "^2.5.1", | ||
"source-map-support": "^0.5.21" | ||
}, | ||
"keywords": [ | ||
"string", | ||
"string manipulation", | ||
"sourcemap", | ||
"templating", | ||
"transpilation" | ||
], | ||
"scripts": { | ||
"test": "mocha", | ||
"pretest": "npm run lint && npm run build", | ||
"format": "prettier --single-quote --print-width 100 --use-tabs --write src/*.js src/**/*.js", | ||
"build": "rollup -c", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "rm -rf dist && npm test", | ||
"lint": "eslint src test", | ||
"watch": "rollup -cw", | ||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", | ||
"release": "bumpp -x \"npm run changelog\" --all --commit --tag --push && npm publish" | ||
}, | ||
"files": [ | ||
"dist/*", | ||
"index.d.ts", | ||
"README.md" | ||
] | ||
} | ||
} |
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
373056
3329