oxc-parser 0.47.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +35 -0
  2. package/index.js +7 -1
  3. package/package.json +10 -10
package/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export declare class MagicString {
11
11
  getUtf16ByteOffset(offset: number): number
12
12
  length(): number
13
13
  toString(): string
14
+ hasChanged(): boolean
14
15
  append(input: string): this
15
16
  appendLeft(index: number, input: string): this
16
17
  appendRight(index: number, input: string): this
@@ -20,6 +21,20 @@ export declare class MagicString {
20
21
  prependRight(index: number, input: string): this
21
22
  relocate(start: number, end: number, to: number): this
22
23
  remove(start: number, end: number): this
24
+ generateMap(options?: Partial<GenerateDecodedMapOptions>): {
25
+ toString: () => string;
26
+ toUrl: () => string;
27
+ toMap: () => {
28
+ file?: string
29
+ mappings: string
30
+ names: Array<string>
31
+ sourceRoot?: string
32
+ sources: Array<string>
33
+ sourcesContent?: Array<string>
34
+ version: number
35
+ x_google_ignoreList?: Array<number>
36
+ }
37
+ }
23
38
  }
24
39
 
25
40
  export declare class ParseResult {
@@ -121,6 +136,15 @@ export declare const enum ExportLocalNameKind {
121
136
  None = 'None'
122
137
  }
123
138
 
139
+ export interface GenerateDecodedMapOptions {
140
+ /** The filename of the file containing the original source. */
141
+ source?: string
142
+ /** Whether to include the original content in the map's `sourcesContent` array. */
143
+ includeContent: boolean
144
+ /** Whether the mapping should be high-resolution. */
145
+ hires: boolean | 'boundary'
146
+ }
147
+
124
148
  export interface ImportName {
125
149
  kind: ImportNameKind
126
150
  name?: string
@@ -192,6 +216,17 @@ export declare const enum Severity {
192
216
  Advice = 'Advice'
193
217
  }
194
218
 
219
+ export interface SourceMap {
220
+ file?: string
221
+ mappings: string
222
+ names: Array<string>
223
+ sourceRoot?: string
224
+ sources: Array<string>
225
+ sourcesContent?: Array<string>
226
+ version: number
227
+ x_google_ignoreList?: Array<number>
228
+ }
229
+
195
230
  export interface SourceMapOptions {
196
231
  includeContent?: boolean
197
232
  source?: string
package/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  const bindings = require('./bindings.js');
2
2
 
3
- module.exports.MagicString = bindings.MagicString;
4
3
  module.exports.ParseResult = bindings.ParseResult;
5
4
  module.exports.ExportExportNameKind = bindings.ExportExportNameKind;
6
5
  module.exports.ExportImportNameKind = bindings.ExportImportNameKind;
@@ -30,6 +29,13 @@ function wrap(result) {
30
29
  },
31
30
  get magicString() {
32
31
  if (!magicString) magicString = result.magicString;
32
+ magicString.generateMap = function generateMap(options) {
33
+ return {
34
+ toString: () => magicString.toSourcemapString(options),
35
+ toUrl: () => magicString.toSourcemapUrl(options),
36
+ toMap: () => magicString.toSourcemapObject(options),
37
+ };
38
+ };
33
39
  return magicString;
34
40
  },
35
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxc-parser",
3
- "version": "0.47.0",
3
+ "version": "0.48.0",
4
4
  "description": "Oxc Parser Node API",
5
5
  "keywords": [
6
6
  "Parser"
@@ -24,16 +24,16 @@
24
24
  "bindings.js"
25
25
  ],
26
26
  "dependencies": {
27
- "@oxc-project/types": "^0.47.0"
27
+ "@oxc-project/types": "^0.48.0"
28
28
  },
29
29
  "optionalDependencies": {
30
- "@oxc-parser/binding-win32-x64-msvc": "0.47.0",
31
- "@oxc-parser/binding-win32-arm64-msvc": "0.47.0",
32
- "@oxc-parser/binding-linux-x64-gnu": "0.47.0",
33
- "@oxc-parser/binding-linux-arm64-gnu": "0.47.0",
34
- "@oxc-parser/binding-linux-x64-musl": "0.47.0",
35
- "@oxc-parser/binding-linux-arm64-musl": "0.47.0",
36
- "@oxc-parser/binding-darwin-x64": "0.47.0",
37
- "@oxc-parser/binding-darwin-arm64": "0.47.0"
30
+ "@oxc-parser/binding-win32-x64-msvc": "0.48.0",
31
+ "@oxc-parser/binding-win32-arm64-msvc": "0.48.0",
32
+ "@oxc-parser/binding-linux-x64-gnu": "0.48.0",
33
+ "@oxc-parser/binding-linux-arm64-gnu": "0.48.0",
34
+ "@oxc-parser/binding-linux-x64-musl": "0.48.0",
35
+ "@oxc-parser/binding-linux-arm64-musl": "0.48.0",
36
+ "@oxc-parser/binding-darwin-x64": "0.48.0",
37
+ "@oxc-parser/binding-darwin-arm64": "0.48.0"
38
38
  }
39
39
  }