@depup/webpack-sources 3.3.4-depup.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.
- package/LICENSE +21 -0
- package/README.md +25 -0
- package/changes.json +5 -0
- package/lib/CachedSource.js +419 -0
- package/lib/CompatSource.js +109 -0
- package/lib/ConcatSource.js +398 -0
- package/lib/OriginalSource.js +202 -0
- package/lib/PrefixSource.js +162 -0
- package/lib/RawSource.js +140 -0
- package/lib/ReplaceSource.js +557 -0
- package/lib/SizeOnlySource.js +71 -0
- package/lib/Source.js +89 -0
- package/lib/SourceMapSource.js +367 -0
- package/lib/helpers/createMappingsSerializer.js +225 -0
- package/lib/helpers/getFromStreamChunks.js +159 -0
- package/lib/helpers/getGeneratedSourceInfo.js +44 -0
- package/lib/helpers/getName.js +21 -0
- package/lib/helpers/getSource.js +24 -0
- package/lib/helpers/readMappings.js +120 -0
- package/lib/helpers/splitIntoLines.js +33 -0
- package/lib/helpers/splitIntoPotentialTokens.js +53 -0
- package/lib/helpers/streamAndGetSourceAndMap.js +123 -0
- package/lib/helpers/streamChunks.js +62 -0
- package/lib/helpers/streamChunksOfCombinedSourceMap.js +366 -0
- package/lib/helpers/streamChunksOfRawSource.js +54 -0
- package/lib/helpers/streamChunksOfSourceMap.js +499 -0
- package/lib/helpers/stringBufferUtils.js +117 -0
- package/lib/index.js +120 -0
- package/package.json +71 -0
- package/types.d.ts +461 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
/** @typedef {import("./CachedSource").CachedData} CachedData */
|
|
9
|
+
/** @typedef {import("./CompatSource").SourceLike} SourceLike */
|
|
10
|
+
/** @typedef {import("./ConcatSource").Child} ConcatSourceChild */
|
|
11
|
+
/** @typedef {import("./ReplaceSource").Replacement} Replacement */
|
|
12
|
+
/** @typedef {import("./Source").HashLike} HashLike */
|
|
13
|
+
/** @typedef {import("./Source").MapOptions} MapOptions */
|
|
14
|
+
/** @typedef {import("./Source").RawSourceMap} RawSourceMap */
|
|
15
|
+
/** @typedef {import("./Source").SourceAndMap} SourceAndMap */
|
|
16
|
+
/** @typedef {import("./Source").SourceValue} SourceValue */
|
|
17
|
+
/** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
|
|
18
|
+
/** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */
|
|
19
|
+
/** @typedef {import("./helpers/streamChunks").OnName} OnName */
|
|
20
|
+
/** @typedef {import("./helpers/streamChunks").OnSource} OnSource */
|
|
21
|
+
/** @typedef {import("./helpers/streamChunks").Options} StreamChunksOptions */
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @template T
|
|
25
|
+
* @param {() => T} fn memorized function
|
|
26
|
+
* @returns {() => T} new function
|
|
27
|
+
*/
|
|
28
|
+
const memoize = (fn) => {
|
|
29
|
+
let cache = false;
|
|
30
|
+
/** @type {T | undefined} */
|
|
31
|
+
let result;
|
|
32
|
+
return () => {
|
|
33
|
+
if (cache) {
|
|
34
|
+
return /** @type {T} */ (result);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
result = fn();
|
|
38
|
+
cache = true;
|
|
39
|
+
// Allow to clean up memory for fn
|
|
40
|
+
// and all dependent resources
|
|
41
|
+
/** @type {(() => T) | undefined} */
|
|
42
|
+
(fn) = undefined;
|
|
43
|
+
return /** @type {T} */ (result);
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @template A
|
|
49
|
+
* @template B
|
|
50
|
+
* @param {A} obj input a
|
|
51
|
+
* @param {B} exports input b
|
|
52
|
+
* @returns {A & B} merged
|
|
53
|
+
*/
|
|
54
|
+
const mergeExports = (obj, exports) => {
|
|
55
|
+
const descriptors = Object.getOwnPropertyDescriptors(exports);
|
|
56
|
+
for (const name of Object.keys(descriptors)) {
|
|
57
|
+
const descriptor = descriptors[name];
|
|
58
|
+
if (descriptor.get) {
|
|
59
|
+
const fn = descriptor.get;
|
|
60
|
+
Object.defineProperty(obj, name, {
|
|
61
|
+
configurable: false,
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: memoize(fn),
|
|
64
|
+
});
|
|
65
|
+
} else if (typeof descriptor.value === "object") {
|
|
66
|
+
Object.defineProperty(obj, name, {
|
|
67
|
+
configurable: false,
|
|
68
|
+
enumerable: true,
|
|
69
|
+
writable: false,
|
|
70
|
+
value: mergeExports({}, descriptor.value),
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
throw new Error(
|
|
74
|
+
"Exposed values must be either a getter or an nested object",
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return /** @type {A & B} */ (Object.freeze(obj));
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
module.exports = mergeExports(
|
|
82
|
+
{},
|
|
83
|
+
{
|
|
84
|
+
get Source() {
|
|
85
|
+
return require("./Source");
|
|
86
|
+
},
|
|
87
|
+
get RawSource() {
|
|
88
|
+
return require("./RawSource");
|
|
89
|
+
},
|
|
90
|
+
get OriginalSource() {
|
|
91
|
+
return require("./OriginalSource");
|
|
92
|
+
},
|
|
93
|
+
get SourceMapSource() {
|
|
94
|
+
return require("./SourceMapSource");
|
|
95
|
+
},
|
|
96
|
+
get CachedSource() {
|
|
97
|
+
return require("./CachedSource");
|
|
98
|
+
},
|
|
99
|
+
get ConcatSource() {
|
|
100
|
+
return require("./ConcatSource");
|
|
101
|
+
},
|
|
102
|
+
get ReplaceSource() {
|
|
103
|
+
return require("./ReplaceSource");
|
|
104
|
+
},
|
|
105
|
+
get PrefixSource() {
|
|
106
|
+
return require("./PrefixSource");
|
|
107
|
+
},
|
|
108
|
+
get SizeOnlySource() {
|
|
109
|
+
return require("./SizeOnlySource");
|
|
110
|
+
},
|
|
111
|
+
get CompatSource() {
|
|
112
|
+
return require("./CompatSource");
|
|
113
|
+
},
|
|
114
|
+
util: {
|
|
115
|
+
get stringBufferUtils() {
|
|
116
|
+
return require("./helpers/stringBufferUtils");
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
);
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@depup/webpack-sources",
|
|
3
|
+
"version": "3.3.4-depup.0",
|
|
4
|
+
"description": "[DepUp] Source code handling classes for webpack",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"depup",
|
|
7
|
+
"dependency-bumped",
|
|
8
|
+
"updated-deps",
|
|
9
|
+
"webpack-sources",
|
|
10
|
+
"webpack",
|
|
11
|
+
"source-map"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/webpack/webpack-sources#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/webpack/webpack-sources/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/webpack/webpack-sources.git"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "Tobias Koppers @sokra",
|
|
23
|
+
"main": "lib/index.js",
|
|
24
|
+
"types": "types.d.ts",
|
|
25
|
+
"files": [
|
|
26
|
+
"lib/",
|
|
27
|
+
"types.d.ts",
|
|
28
|
+
"changes.json",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"lint": "npm run lint:code && npm run lint:types && npm run lint:types-test && npm run lint:special",
|
|
33
|
+
"lint:code": "eslint --cache .",
|
|
34
|
+
"lint:special": "node node_modules/tooling/inherit-types && node node_modules/tooling/format-file-header && node node_modules/tooling/generate-types",
|
|
35
|
+
"lint:types": "tsc",
|
|
36
|
+
"lint:types-test": "tsc -p tsconfig.types.test.json",
|
|
37
|
+
"fmt": "npm run fmt:base -- --loglevel warn --write",
|
|
38
|
+
"fmt:check": "npm run fmt:base -- --check",
|
|
39
|
+
"fmt:base": "prettier --cache --ignore-unknown .",
|
|
40
|
+
"fix": "npm run fix:code && npm run fix:special",
|
|
41
|
+
"fix:code": "npm run lint:code -- --fix",
|
|
42
|
+
"fix:special": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/generate-types --write",
|
|
43
|
+
"pretest": "npm run lint",
|
|
44
|
+
"test": "jest",
|
|
45
|
+
"cover": "jest --coverage"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/jest": "^27.5.2",
|
|
49
|
+
"eslint": "^9.28.0",
|
|
50
|
+
"eslint-config-webpack": "^4.0.8",
|
|
51
|
+
"jest": "^27.5.1",
|
|
52
|
+
"prettier": "^3.5.3",
|
|
53
|
+
"prettier-2": "npm:prettier@^2",
|
|
54
|
+
"source-map": "^0.7.3",
|
|
55
|
+
"sourcemap-validator": "^2.1.0",
|
|
56
|
+
"tooling": "webpack/tooling#v1.24.4",
|
|
57
|
+
"typescript": "^5.3.3",
|
|
58
|
+
"webpack": "^5.99.9"
|
|
59
|
+
},
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": ">=10.13.0"
|
|
62
|
+
},
|
|
63
|
+
"depup": {
|
|
64
|
+
"changes": {},
|
|
65
|
+
"depsUpdated": 0,
|
|
66
|
+
"originalPackage": "webpack-sources",
|
|
67
|
+
"originalVersion": "3.3.4",
|
|
68
|
+
"processedAt": "2026-03-17T16:39:45.942Z",
|
|
69
|
+
"smokeTest": "passed"
|
|
70
|
+
}
|
|
71
|
+
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file was automatically generated.
|
|
3
|
+
* DO NOT MODIFY BY HAND.
|
|
4
|
+
* Run `yarn fix:special` to update
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Buffer } from "buffer";
|
|
8
|
+
|
|
9
|
+
declare interface BufferEntry {
|
|
10
|
+
map?: null | RawSourceMap;
|
|
11
|
+
bufferedMap?: null | BufferedMap;
|
|
12
|
+
}
|
|
13
|
+
declare interface BufferedMap {
|
|
14
|
+
/**
|
|
15
|
+
* version
|
|
16
|
+
*/
|
|
17
|
+
version: number;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* sources
|
|
21
|
+
*/
|
|
22
|
+
sources: string[];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* name
|
|
26
|
+
*/
|
|
27
|
+
names: string[];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* source root
|
|
31
|
+
*/
|
|
32
|
+
sourceRoot?: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* sources content
|
|
36
|
+
*/
|
|
37
|
+
sourcesContent?: ("" | Buffer)[];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* mappings
|
|
41
|
+
*/
|
|
42
|
+
mappings?: Buffer;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* file
|
|
46
|
+
*/
|
|
47
|
+
file: string;
|
|
48
|
+
}
|
|
49
|
+
declare interface CachedData {
|
|
50
|
+
/**
|
|
51
|
+
* source
|
|
52
|
+
*/
|
|
53
|
+
source?: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* buffer
|
|
57
|
+
*/
|
|
58
|
+
buffer: Buffer;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* size
|
|
62
|
+
*/
|
|
63
|
+
size?: number;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* maps
|
|
67
|
+
*/
|
|
68
|
+
maps: Map<string, BufferEntry>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* hash
|
|
72
|
+
*/
|
|
73
|
+
hash?: (string | Buffer)[];
|
|
74
|
+
}
|
|
75
|
+
declare class CachedSource extends Source {
|
|
76
|
+
constructor(source: Source | (() => Source), cachedData?: CachedData);
|
|
77
|
+
getCachedData(): CachedData;
|
|
78
|
+
originalLazy(): Source | (() => Source);
|
|
79
|
+
original(): Source;
|
|
80
|
+
streamChunks(
|
|
81
|
+
options: StreamChunksOptions,
|
|
82
|
+
onChunk: (
|
|
83
|
+
chunk: undefined | string,
|
|
84
|
+
generatedLine: number,
|
|
85
|
+
generatedColumn: number,
|
|
86
|
+
sourceIndex: number,
|
|
87
|
+
originalLine: number,
|
|
88
|
+
originalColumn: number,
|
|
89
|
+
nameIndex: number,
|
|
90
|
+
) => void,
|
|
91
|
+
onSource: (
|
|
92
|
+
sourceIndex: number,
|
|
93
|
+
source: null | string,
|
|
94
|
+
sourceContent?: string,
|
|
95
|
+
) => void,
|
|
96
|
+
onName: (nameIndex: number, name: string) => void,
|
|
97
|
+
): GeneratedSourceInfo;
|
|
98
|
+
}
|
|
99
|
+
declare class CompatSource extends Source {
|
|
100
|
+
constructor(sourceLike: SourceLike);
|
|
101
|
+
static from(sourceLike: SourceLike): Source;
|
|
102
|
+
}
|
|
103
|
+
declare class ConcatSource extends Source {
|
|
104
|
+
constructor(...args: ConcatSourceChild[]);
|
|
105
|
+
getChildren(): Source[];
|
|
106
|
+
add(item: ConcatSourceChild): void;
|
|
107
|
+
addAllSkipOptimizing(items: ConcatSourceChild[]): void;
|
|
108
|
+
streamChunks(
|
|
109
|
+
options: StreamChunksOptions,
|
|
110
|
+
onChunk: (
|
|
111
|
+
chunk: undefined | string,
|
|
112
|
+
generatedLine: number,
|
|
113
|
+
generatedColumn: number,
|
|
114
|
+
sourceIndex: number,
|
|
115
|
+
originalLine: number,
|
|
116
|
+
originalColumn: number,
|
|
117
|
+
nameIndex: number,
|
|
118
|
+
) => void,
|
|
119
|
+
onSource: (
|
|
120
|
+
sourceIndex: number,
|
|
121
|
+
source: null | string,
|
|
122
|
+
sourceContent?: string,
|
|
123
|
+
) => void,
|
|
124
|
+
onName: (nameIndex: number, name: string) => void,
|
|
125
|
+
): GeneratedSourceInfo;
|
|
126
|
+
}
|
|
127
|
+
type ConcatSourceChild = string | Source | SourceLike;
|
|
128
|
+
declare interface GeneratedSourceInfo {
|
|
129
|
+
/**
|
|
130
|
+
* generated line
|
|
131
|
+
*/
|
|
132
|
+
generatedLine?: number;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* generated column
|
|
136
|
+
*/
|
|
137
|
+
generatedColumn?: number;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* source
|
|
141
|
+
*/
|
|
142
|
+
source?: string;
|
|
143
|
+
}
|
|
144
|
+
declare interface HashLike {
|
|
145
|
+
/**
|
|
146
|
+
* make hash update
|
|
147
|
+
*/
|
|
148
|
+
update: (data: string | Buffer, inputEncoding?: string) => HashLike;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* get hash digest
|
|
152
|
+
*/
|
|
153
|
+
digest: (encoding?: string) => string | Buffer;
|
|
154
|
+
}
|
|
155
|
+
declare interface MapOptions {
|
|
156
|
+
/**
|
|
157
|
+
* need columns?
|
|
158
|
+
*/
|
|
159
|
+
columns?: boolean;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* is module
|
|
163
|
+
*/
|
|
164
|
+
module?: boolean;
|
|
165
|
+
}
|
|
166
|
+
declare class OriginalSource extends Source {
|
|
167
|
+
constructor(value: string | Buffer, name: string);
|
|
168
|
+
getName(): string;
|
|
169
|
+
streamChunks(
|
|
170
|
+
options: StreamChunksOptions,
|
|
171
|
+
onChunk: (
|
|
172
|
+
chunk: undefined | string,
|
|
173
|
+
generatedLine: number,
|
|
174
|
+
generatedColumn: number,
|
|
175
|
+
sourceIndex: number,
|
|
176
|
+
originalLine: number,
|
|
177
|
+
originalColumn: number,
|
|
178
|
+
nameIndex: number,
|
|
179
|
+
) => void,
|
|
180
|
+
onSource: (
|
|
181
|
+
sourceIndex: number,
|
|
182
|
+
source: null | string,
|
|
183
|
+
sourceContent?: string,
|
|
184
|
+
) => void,
|
|
185
|
+
_onName: (nameIndex: number, name: string) => void,
|
|
186
|
+
): GeneratedSourceInfo;
|
|
187
|
+
}
|
|
188
|
+
declare class PrefixSource extends Source {
|
|
189
|
+
constructor(prefix: string, source: string | Source | Buffer);
|
|
190
|
+
getPrefix(): string;
|
|
191
|
+
original(): Source;
|
|
192
|
+
streamChunks(
|
|
193
|
+
options: StreamChunksOptions,
|
|
194
|
+
onChunk: (
|
|
195
|
+
chunk: undefined | string,
|
|
196
|
+
generatedLine: number,
|
|
197
|
+
generatedColumn: number,
|
|
198
|
+
sourceIndex: number,
|
|
199
|
+
originalLine: number,
|
|
200
|
+
originalColumn: number,
|
|
201
|
+
nameIndex: number,
|
|
202
|
+
) => void,
|
|
203
|
+
onSource: (
|
|
204
|
+
sourceIndex: number,
|
|
205
|
+
source: null | string,
|
|
206
|
+
sourceContent?: string,
|
|
207
|
+
) => void,
|
|
208
|
+
onName: (nameIndex: number, name: string) => void,
|
|
209
|
+
): GeneratedSourceInfo;
|
|
210
|
+
}
|
|
211
|
+
declare class RawSource extends Source {
|
|
212
|
+
constructor(value: string | Buffer, convertToString?: boolean);
|
|
213
|
+
isBuffer(): boolean;
|
|
214
|
+
streamChunks(
|
|
215
|
+
options: StreamChunksOptions,
|
|
216
|
+
onChunk: (
|
|
217
|
+
chunk: undefined | string,
|
|
218
|
+
generatedLine: number,
|
|
219
|
+
generatedColumn: number,
|
|
220
|
+
sourceIndex: number,
|
|
221
|
+
originalLine: number,
|
|
222
|
+
originalColumn: number,
|
|
223
|
+
nameIndex: number,
|
|
224
|
+
) => void,
|
|
225
|
+
onSource: (
|
|
226
|
+
sourceIndex: number,
|
|
227
|
+
source: null | string,
|
|
228
|
+
sourceContent?: string,
|
|
229
|
+
) => void,
|
|
230
|
+
onName: (nameIndex: number, name: string) => void,
|
|
231
|
+
): GeneratedSourceInfo;
|
|
232
|
+
}
|
|
233
|
+
declare interface RawSourceMap {
|
|
234
|
+
/**
|
|
235
|
+
* version
|
|
236
|
+
*/
|
|
237
|
+
version: number;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* sources
|
|
241
|
+
*/
|
|
242
|
+
sources: string[];
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* names
|
|
246
|
+
*/
|
|
247
|
+
names: string[];
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* source root
|
|
251
|
+
*/
|
|
252
|
+
sourceRoot?: string;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* sources content
|
|
256
|
+
*/
|
|
257
|
+
sourcesContent?: string[];
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* mappings
|
|
261
|
+
*/
|
|
262
|
+
mappings: string;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* file
|
|
266
|
+
*/
|
|
267
|
+
file: string;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* debug id
|
|
271
|
+
*/
|
|
272
|
+
debugId?: string;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* ignore list
|
|
276
|
+
*/
|
|
277
|
+
ignoreList?: number[];
|
|
278
|
+
}
|
|
279
|
+
declare class ReplaceSource extends Source {
|
|
280
|
+
constructor(source: Source, name?: string);
|
|
281
|
+
getName(): undefined | string;
|
|
282
|
+
getReplacements(): Replacement[];
|
|
283
|
+
replace(start: number, end: number, newValue: string, name?: string): void;
|
|
284
|
+
insert(pos: number, newValue: string, name?: string): void;
|
|
285
|
+
original(): Source;
|
|
286
|
+
streamChunks(
|
|
287
|
+
options: StreamChunksOptions,
|
|
288
|
+
onChunk: (
|
|
289
|
+
chunk: undefined | string,
|
|
290
|
+
generatedLine: number,
|
|
291
|
+
generatedColumn: number,
|
|
292
|
+
sourceIndex: number,
|
|
293
|
+
originalLine: number,
|
|
294
|
+
originalColumn: number,
|
|
295
|
+
nameIndex: number,
|
|
296
|
+
) => void,
|
|
297
|
+
onSource: (
|
|
298
|
+
sourceIndex: number,
|
|
299
|
+
source: null | string,
|
|
300
|
+
sourceContent?: string,
|
|
301
|
+
) => void,
|
|
302
|
+
onName: (nameIndex: number, name: string) => void,
|
|
303
|
+
): GeneratedSourceInfo;
|
|
304
|
+
static Replacement: typeof Replacement;
|
|
305
|
+
}
|
|
306
|
+
declare class Replacement {
|
|
307
|
+
constructor(start: number, end: number, content: string, name?: string);
|
|
308
|
+
start: number;
|
|
309
|
+
end: number;
|
|
310
|
+
content: string;
|
|
311
|
+
name?: string;
|
|
312
|
+
index?: number;
|
|
313
|
+
}
|
|
314
|
+
declare class SizeOnlySource extends Source {
|
|
315
|
+
constructor(size: number);
|
|
316
|
+
}
|
|
317
|
+
declare class Source {
|
|
318
|
+
constructor();
|
|
319
|
+
source(): SourceValue;
|
|
320
|
+
buffer(): Buffer;
|
|
321
|
+
size(): number;
|
|
322
|
+
map(options?: MapOptions): null | RawSourceMap;
|
|
323
|
+
sourceAndMap(options?: MapOptions): SourceAndMap;
|
|
324
|
+
updateHash(hash: HashLike): void;
|
|
325
|
+
}
|
|
326
|
+
declare interface SourceAndMap {
|
|
327
|
+
/**
|
|
328
|
+
* source
|
|
329
|
+
*/
|
|
330
|
+
source: SourceValue;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* map
|
|
334
|
+
*/
|
|
335
|
+
map: null | RawSourceMap;
|
|
336
|
+
}
|
|
337
|
+
declare interface SourceLike {
|
|
338
|
+
/**
|
|
339
|
+
* source
|
|
340
|
+
*/
|
|
341
|
+
source: () => SourceValue;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* buffer
|
|
345
|
+
*/
|
|
346
|
+
buffer?: () => Buffer;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* size
|
|
350
|
+
*/
|
|
351
|
+
size?: () => number;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* map
|
|
355
|
+
*/
|
|
356
|
+
map?: (options?: MapOptions) => null | RawSourceMap;
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* source and map
|
|
360
|
+
*/
|
|
361
|
+
sourceAndMap?: (options?: MapOptions) => SourceAndMap;
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* hash updater
|
|
365
|
+
*/
|
|
366
|
+
updateHash?: (hash: HashLike) => void;
|
|
367
|
+
}
|
|
368
|
+
declare class SourceMapSource extends Source {
|
|
369
|
+
constructor(
|
|
370
|
+
value: string | Buffer,
|
|
371
|
+
name: string,
|
|
372
|
+
sourceMap?: string | RawSourceMap | Buffer,
|
|
373
|
+
originalSource?: string | Buffer,
|
|
374
|
+
innerSourceMap?: null | string | RawSourceMap | Buffer,
|
|
375
|
+
removeOriginalSource?: boolean,
|
|
376
|
+
);
|
|
377
|
+
getArgsAsBuffers(): [
|
|
378
|
+
Buffer,
|
|
379
|
+
string,
|
|
380
|
+
Buffer,
|
|
381
|
+
undefined | Buffer,
|
|
382
|
+
undefined | Buffer,
|
|
383
|
+
undefined | boolean,
|
|
384
|
+
];
|
|
385
|
+
streamChunks(
|
|
386
|
+
options: StreamChunksOptions,
|
|
387
|
+
onChunk: (
|
|
388
|
+
chunk: undefined | string,
|
|
389
|
+
generatedLine: number,
|
|
390
|
+
generatedColumn: number,
|
|
391
|
+
sourceIndex: number,
|
|
392
|
+
originalLine: number,
|
|
393
|
+
originalColumn: number,
|
|
394
|
+
nameIndex: number,
|
|
395
|
+
) => void,
|
|
396
|
+
onSource: (
|
|
397
|
+
sourceIndex: number,
|
|
398
|
+
source: null | string,
|
|
399
|
+
sourceContent?: string,
|
|
400
|
+
) => void,
|
|
401
|
+
onName: (nameIndex: number, name: string) => void,
|
|
402
|
+
): GeneratedSourceInfo;
|
|
403
|
+
}
|
|
404
|
+
type SourceValue = string | Buffer;
|
|
405
|
+
declare interface StreamChunksOptions {
|
|
406
|
+
source?: boolean;
|
|
407
|
+
finalSource?: boolean;
|
|
408
|
+
columns?: boolean;
|
|
409
|
+
}
|
|
410
|
+
declare namespace exports {
|
|
411
|
+
export namespace util {
|
|
412
|
+
export namespace stringBufferUtils {
|
|
413
|
+
export let disableDualStringBufferCaching: () => void;
|
|
414
|
+
export let enableDualStringBufferCaching: () => void;
|
|
415
|
+
export let enterStringInterningRange: () => void;
|
|
416
|
+
export let exitStringInterningRange: () => void;
|
|
417
|
+
export let internString: (str: string) => string;
|
|
418
|
+
export let isDualStringBufferCachingEnabled: () => boolean;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
export type OnChunk = (
|
|
422
|
+
chunk: undefined | string,
|
|
423
|
+
generatedLine: number,
|
|
424
|
+
generatedColumn: number,
|
|
425
|
+
sourceIndex: number,
|
|
426
|
+
originalLine: number,
|
|
427
|
+
originalColumn: number,
|
|
428
|
+
nameIndex: number,
|
|
429
|
+
) => void;
|
|
430
|
+
export type OnName = (nameIndex: number, name: string) => void;
|
|
431
|
+
export type OnSource = (
|
|
432
|
+
sourceIndex: number,
|
|
433
|
+
source: null | string,
|
|
434
|
+
sourceContent?: string,
|
|
435
|
+
) => void;
|
|
436
|
+
export {
|
|
437
|
+
Source,
|
|
438
|
+
RawSource,
|
|
439
|
+
OriginalSource,
|
|
440
|
+
SourceMapSource,
|
|
441
|
+
CachedSource,
|
|
442
|
+
ConcatSource,
|
|
443
|
+
ReplaceSource,
|
|
444
|
+
PrefixSource,
|
|
445
|
+
SizeOnlySource,
|
|
446
|
+
CompatSource,
|
|
447
|
+
CachedData,
|
|
448
|
+
SourceLike,
|
|
449
|
+
ConcatSourceChild,
|
|
450
|
+
Replacement,
|
|
451
|
+
HashLike,
|
|
452
|
+
MapOptions,
|
|
453
|
+
RawSourceMap,
|
|
454
|
+
SourceAndMap,
|
|
455
|
+
SourceValue,
|
|
456
|
+
GeneratedSourceInfo,
|
|
457
|
+
StreamChunksOptions,
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
export = exports;
|