@depup/webpack-sources 3.3.4-depup.0 → 3.6.0-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.
Files changed (53) hide show
  1. package/README.md +2 -2
  2. package/changes.json +1 -1
  3. package/lib/CachedSource.js +257 -63
  4. package/lib/CompatSource.js +42 -1
  5. package/lib/ConcatSource.js +100 -28
  6. package/lib/OriginalSource.js +111 -45
  7. package/lib/PrefixSource.js +60 -11
  8. package/lib/RawSource.js +85 -29
  9. package/lib/ReplaceSource.js +269 -73
  10. package/lib/SizeOnlySource.js +10 -1
  11. package/lib/Source.js +39 -0
  12. package/lib/SourceMapSource.js +92 -10
  13. package/lib/helpers/createMappingsSerializer.js +307 -54
  14. package/lib/helpers/getFromStreamChunks.js +165 -73
  15. package/lib/helpers/getGeneratedSourceInfo.js +7 -4
  16. package/lib/helpers/readMappings.js +6 -3
  17. package/lib/helpers/scopes.js +438 -0
  18. package/lib/helpers/splitIntoLines.js +10 -9
  19. package/lib/helpers/splitIntoPotentialTokens.js +99 -26
  20. package/lib/helpers/streamAndGetSourceAndMap.js +61 -22
  21. package/lib/helpers/streamChunks.js +3 -2
  22. package/lib/helpers/streamChunksOfCombinedSourceMap.js +7 -3
  23. package/lib/helpers/streamChunksOfRawSource.js +23 -15
  24. package/lib/helpers/streamChunksOfSourceMap.js +50 -42
  25. package/lib/index.js +3 -0
  26. package/package.json +34 -23
  27. package/types/CachedSource.d.ts +192 -0
  28. package/types/CompatSource.d.ts +87 -0
  29. package/types/ConcatSource.d.ts +75 -0
  30. package/types/OriginalSource.d.ts +87 -0
  31. package/types/PrefixSource.d.ts +59 -0
  32. package/types/RawSource.d.ts +75 -0
  33. package/types/ReplaceSource.d.ts +107 -0
  34. package/types/SizeOnlySource.d.ts +24 -0
  35. package/types/Source.d.ts +189 -0
  36. package/types/SourceMapSource.d.ts +136 -0
  37. package/types/helpers/createMappingsSerializer.d.ts +60 -0
  38. package/types/helpers/getFromStreamChunks.d.ts +16 -0
  39. package/types/helpers/getGeneratedSourceInfo.d.ts +31 -0
  40. package/types/helpers/getName.d.ts +15 -0
  41. package/types/helpers/getSource.d.ts +15 -0
  42. package/types/helpers/readMappings.d.ts +19 -0
  43. package/types/helpers/scopes.d.ts +119 -0
  44. package/types/helpers/splitIntoLines.d.ts +6 -0
  45. package/types/helpers/splitIntoPotentialTokens.d.ts +37 -0
  46. package/types/helpers/streamAndGetSourceAndMap.d.ts +39 -0
  47. package/types/helpers/streamChunks.d.ts +56 -0
  48. package/types/helpers/streamChunksOfCombinedSourceMap.d.ts +42 -0
  49. package/types/helpers/streamChunksOfRawSource.d.ts +16 -0
  50. package/types/helpers/streamChunksOfSourceMap.d.ts +19 -0
  51. package/types/helpers/stringBufferUtils.d.ts +55 -0
  52. package/types/index.d.ts +50 -0
  53. package/types.d.ts +42 -439
@@ -0,0 +1,192 @@
1
+ export = CachedSource;
2
+ /**
3
+ * @typedef {object} CachedData
4
+ * @property {boolean=} source source
5
+ * @property {Buffer} buffer buffer
6
+ * @property {number=} size size
7
+ * @property {BufferedMaps} maps maps
8
+ * @property {(string | Buffer)[]=} hash hash
9
+ */
10
+ declare class CachedSource extends Source {
11
+ /**
12
+ * @param {Source | (() => Source)} source source
13
+ * @param {CachedData=} cachedData cached data
14
+ */
15
+ constructor(
16
+ source: Source | (() => Source),
17
+ cachedData?: CachedData | undefined,
18
+ );
19
+ /**
20
+ * @type {Source | (() => Source)}
21
+ */
22
+ _source: Source | (() => Source);
23
+ /**
24
+ * @type {undefined | string}
25
+ */
26
+ _cachedSource: undefined | string;
27
+ /**
28
+ * @type {boolean | undefined}
29
+ */
30
+ _cachedSourceType: boolean | undefined;
31
+ /**
32
+ * @type {Buffer | undefined}
33
+ */
34
+ _cachedBuffer: Buffer | undefined;
35
+ /**
36
+ * @type {number | undefined}
37
+ */
38
+ _cachedSize: number | undefined;
39
+ /**
40
+ * @type {BufferedMaps | undefined}
41
+ */
42
+ _cachedMaps: BufferedMaps | undefined;
43
+ /**
44
+ * @type {(string | Buffer)[] | undefined}
45
+ */
46
+ _cachedHashUpdate: (string | Buffer)[] | undefined;
47
+ /**
48
+ * The map cache, created on first use: a source nobody asks a map of holds
49
+ * none, since V8 allocates a Map's hash table whether or not it is filled.
50
+ * @returns {BufferedMaps} map cache
51
+ */
52
+ _getOrCreateCachedMaps(): BufferedMaps;
53
+ /**
54
+ * @returns {CachedData} cached data
55
+ */
56
+ getCachedData(): CachedData;
57
+ originalLazy(): Source | (() => Source);
58
+ original(): Source;
59
+ /**
60
+ * @param {BufferEntry} cacheEntry cache entry
61
+ * @returns {null | RawSourceMap} raw source map
62
+ */
63
+ _getMapFromCacheEntry(cacheEntry: BufferEntry): null | RawSourceMap;
64
+ /**
65
+ * @returns {undefined | string} cached source
66
+ */
67
+ _getCachedSource(): undefined | string;
68
+ _cachedBuffers: Buffer<ArrayBufferLike>[] | undefined;
69
+ /**
70
+ * @param {Options} options options
71
+ * @param {OnChunk} onChunk called for each chunk of code
72
+ * @param {OnSource} onSource called for each source
73
+ * @param {OnName} onName called for each name
74
+ * @returns {GeneratedSourceInfo} generated source info
75
+ */
76
+ streamChunks(
77
+ options: Options,
78
+ onChunk: OnChunk,
79
+ onSource: OnSource,
80
+ onName: OnName,
81
+ ): GeneratedSourceInfo;
82
+ }
83
+ declare namespace CachedSource {
84
+ export {
85
+ ClearCacheOptions,
86
+ HashLike,
87
+ MapOptions,
88
+ RawSourceMap,
89
+ SourceAndMap,
90
+ SourceValue,
91
+ GeneratedSourceInfo,
92
+ OnChunk,
93
+ OnName,
94
+ OnSource,
95
+ Options,
96
+ ScopeBindings,
97
+ BufferedMap,
98
+ ScopesReplay,
99
+ BufferEntry,
100
+ BufferedMaps,
101
+ CachedData,
102
+ };
103
+ }
104
+ import Source = require("./Source");
105
+ type ClearCacheOptions = import("./Source").ClearCacheOptions;
106
+ type HashLike = import("./Source").HashLike;
107
+ type MapOptions = import("./Source").MapOptions;
108
+ type RawSourceMap = import("./Source").RawSourceMap;
109
+ type SourceAndMap = import("./Source").SourceAndMap;
110
+ type SourceValue = import("./Source").SourceValue;
111
+ type GeneratedSourceInfo =
112
+ import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo;
113
+ type OnChunk = import("./helpers/streamChunks").OnChunk;
114
+ type OnName = import("./helpers/streamChunks").OnName;
115
+ type OnSource = import("./helpers/streamChunks").OnSource;
116
+ type Options = import("./helpers/streamChunks").Options;
117
+ type ScopeBindings = import("./helpers/streamChunks").ScopeBindings;
118
+ type BufferedMap = {
119
+ /**
120
+ * version
121
+ */
122
+ version: number;
123
+ /**
124
+ * sources
125
+ */
126
+ sources: string[];
127
+ /**
128
+ * name
129
+ */
130
+ names: string[];
131
+ /**
132
+ * source root
133
+ */
134
+ sourceRoot?: string | undefined;
135
+ /**
136
+ * sources content
137
+ */
138
+ sourcesContent?: (Buffer | "")[] | undefined;
139
+ /**
140
+ * mappings
141
+ */
142
+ mappings?: Buffer | undefined;
143
+ /**
144
+ * file
145
+ */
146
+ file: string;
147
+ };
148
+ /**
149
+ * What replaying an entry streamed for a `scopes` request needs besides its
150
+ * map. The map only keeps the encoded `scopes` field, so `bindings` holds, by
151
+ * source index, the bindings each source reported. The field also appended
152
+ * names to the map, and `names` counts the ones the stream itself reported,
153
+ * so a replay reports the same names a fresh stream would.
154
+ */
155
+ type ScopesReplay = {
156
+ /**
157
+ * bindings by source index
158
+ */
159
+ bindings: (ScopeBindings | undefined)[];
160
+ /**
161
+ * number of names the stream reported
162
+ */
163
+ names: number;
164
+ };
165
+ type BufferEntry = {
166
+ map?: null | RawSourceMap;
167
+ bufferedMap?: null | BufferedMap;
168
+ scopes?: ScopesReplay;
169
+ };
170
+ type BufferedMaps = Map<string, BufferEntry>;
171
+ type CachedData = {
172
+ /**
173
+ * source
174
+ */
175
+ source?: boolean | undefined;
176
+ /**
177
+ * buffer
178
+ */
179
+ buffer: Buffer;
180
+ /**
181
+ * size
182
+ */
183
+ size?: number | undefined;
184
+ /**
185
+ * maps
186
+ */
187
+ maps: BufferedMaps;
188
+ /**
189
+ * hash
190
+ */
191
+ hash?: (string | Buffer)[] | undefined;
192
+ };
@@ -0,0 +1,87 @@
1
+ export = CompatSource;
2
+ /** @typedef {import("./Source").ClearCacheOptions} ClearCacheOptions */
3
+ /** @typedef {import("./Source").HashLike} HashLike */
4
+ /** @typedef {import("./Source").MapOptions} MapOptions */
5
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
6
+ /** @typedef {import("./Source").SourceAndMap} SourceAndMap */
7
+ /** @typedef {import("./Source").SourceValue} SourceValue */
8
+ /**
9
+ * @typedef {object} SourceLike
10
+ * @property {() => SourceValue} source source
11
+ * @property {(() => Buffer)=} buffer buffer
12
+ * @property {(() => Buffer[])=} buffers buffers
13
+ * @property {(() => number)=} size size
14
+ * @property {((options?: MapOptions) => RawSourceMap | null)=} map map
15
+ * @property {((options?: MapOptions) => SourceAndMap)=} sourceAndMap source and map
16
+ * @property {((hash: HashLike) => void)=} updateHash hash updater
17
+ * @property {((options?: ClearCacheOptions, visited?: WeakSet<Source>) => void)=} clearCache clear cache
18
+ */
19
+ declare class CompatSource extends Source {
20
+ /**
21
+ * @param {SourceLike} sourceLike source like
22
+ * @returns {Source} source
23
+ */
24
+ static from(sourceLike: SourceLike): Source;
25
+ /**
26
+ * @param {SourceLike} sourceLike source like
27
+ */
28
+ constructor(sourceLike: SourceLike);
29
+ /**
30
+ * @type {SourceLike}
31
+ */
32
+ _sourceLike: SourceLike;
33
+ }
34
+ declare namespace CompatSource {
35
+ export {
36
+ ClearCacheOptions,
37
+ HashLike,
38
+ MapOptions,
39
+ RawSourceMap,
40
+ SourceAndMap,
41
+ SourceValue,
42
+ SourceLike,
43
+ };
44
+ }
45
+ import Source = require("./Source");
46
+ type ClearCacheOptions = import("./Source").ClearCacheOptions;
47
+ type HashLike = import("./Source").HashLike;
48
+ type MapOptions = import("./Source").MapOptions;
49
+ type RawSourceMap = import("./Source").RawSourceMap;
50
+ type SourceAndMap = import("./Source").SourceAndMap;
51
+ type SourceValue = import("./Source").SourceValue;
52
+ type SourceLike = {
53
+ /**
54
+ * source
55
+ */
56
+ source: () => SourceValue;
57
+ /**
58
+ * buffer
59
+ */
60
+ buffer?: (() => Buffer) | undefined;
61
+ /**
62
+ * buffers
63
+ */
64
+ buffers?: (() => Buffer[]) | undefined;
65
+ /**
66
+ * size
67
+ */
68
+ size?: (() => number) | undefined;
69
+ /**
70
+ * map
71
+ */
72
+ map?: ((options?: MapOptions) => RawSourceMap | null) | undefined;
73
+ /**
74
+ * source and map
75
+ */
76
+ sourceAndMap?: ((options?: MapOptions) => SourceAndMap) | undefined;
77
+ /**
78
+ * hash updater
79
+ */
80
+ updateHash?: ((hash: HashLike) => void) | undefined;
81
+ /**
82
+ * clear cache
83
+ */
84
+ clearCache?:
85
+ | ((options?: ClearCacheOptions, visited?: WeakSet<Source>) => void)
86
+ | undefined;
87
+ };
@@ -0,0 +1,75 @@
1
+ export = ConcatSource;
2
+ declare class ConcatSource extends Source {
3
+ /**
4
+ * @param {Child[]} args children
5
+ */
6
+ constructor(...args: Child[]);
7
+ /**
8
+ * @type {Child[]}
9
+ */
10
+ _children: Child[];
11
+ /**
12
+ * @type {boolean}
13
+ */
14
+ _isOptimized: boolean;
15
+ /**
16
+ * @returns {Source[]} children
17
+ */
18
+ getChildren(): Source[];
19
+ /**
20
+ * @param {Child} item item
21
+ * @returns {void}
22
+ */
23
+ add(item: Child): void;
24
+ /**
25
+ * @param {Child[]} items items
26
+ * @returns {void}
27
+ */
28
+ addAllSkipOptimizing(items: Child[]): void;
29
+ /**
30
+ * @param {Options} options options
31
+ * @param {OnChunk} onChunk called for each chunk of code
32
+ * @param {OnSource} onSource called for each source
33
+ * @param {OnName} onName called for each name
34
+ * @returns {GeneratedSourceInfo} generated source info
35
+ */
36
+ streamChunks(
37
+ options: Options,
38
+ onChunk: OnChunk,
39
+ onSource: OnSource,
40
+ onName: OnName,
41
+ ): GeneratedSourceInfo;
42
+ _optimize(): void;
43
+ }
44
+ declare namespace ConcatSource {
45
+ export {
46
+ SourceLike,
47
+ ClearCacheOptions,
48
+ HashLike,
49
+ MapOptions,
50
+ RawSourceMap,
51
+ SourceAndMap,
52
+ SourceValue,
53
+ GeneratedSourceInfo,
54
+ OnChunk,
55
+ OnName,
56
+ OnSource,
57
+ Options,
58
+ Child,
59
+ };
60
+ }
61
+ import Source = require("./Source");
62
+ type SourceLike = import("./CompatSource").SourceLike;
63
+ type ClearCacheOptions = import("./Source").ClearCacheOptions;
64
+ type HashLike = import("./Source").HashLike;
65
+ type MapOptions = import("./Source").MapOptions;
66
+ type RawSourceMap = import("./Source").RawSourceMap;
67
+ type SourceAndMap = import("./Source").SourceAndMap;
68
+ type SourceValue = import("./Source").SourceValue;
69
+ type GeneratedSourceInfo =
70
+ import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo;
71
+ type OnChunk = import("./helpers/streamChunks").OnChunk;
72
+ type OnName = import("./helpers/streamChunks").OnName;
73
+ type OnSource = import("./helpers/streamChunks").OnSource;
74
+ type Options = import("./helpers/streamChunks").Options;
75
+ type Child = string | Source | SourceLike;
@@ -0,0 +1,87 @@
1
+ export = OriginalSource;
2
+ /** @typedef {import("./Source").ClearCacheOptions} ClearCacheOptions */
3
+ /** @typedef {import("./Source").HashLike} HashLike */
4
+ /** @typedef {import("./Source").MapOptions} MapOptions */
5
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
6
+ /** @typedef {import("./Source").SourceAndMap} SourceAndMap */
7
+ /** @typedef {import("./Source").SourceValue} SourceValue */
8
+ /** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
9
+ /** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */
10
+ /** @typedef {import("./helpers/streamChunks").OnName} OnName */
11
+ /** @typedef {import("./helpers/streamChunks").OnSource} OnSource */
12
+ /** @typedef {import("./helpers/streamChunks").Options} Options */
13
+ /** @typedef {import("./helpers/streamChunks").ScopeBindings} ScopeBindings */
14
+ declare class OriginalSource extends Source {
15
+ /**
16
+ * @param {string | Buffer} value value
17
+ * @param {string} name name
18
+ * @param {ScopeBindings=} scopeBindings what each name this source declares
19
+ * evaluates to in the generated code, for the map's `scopes` field
20
+ */
21
+ constructor(
22
+ value: string | Buffer,
23
+ name: string,
24
+ scopeBindings?: ScopeBindings | undefined,
25
+ );
26
+ /**
27
+ * @type {undefined | string}
28
+ */
29
+ _value: undefined | string;
30
+ /**
31
+ * @type {undefined | Buffer}
32
+ */
33
+ _valueAsBuffer: undefined | Buffer;
34
+ /**
35
+ * @type {string}
36
+ */
37
+ _name: string;
38
+ /**
39
+ * @type {undefined | ScopeBindings}
40
+ */
41
+ _scopeBindings: undefined | ScopeBindings;
42
+ getName(): string;
43
+ _cachedSize: number | undefined;
44
+ /**
45
+ * @param {Options} options options
46
+ * @param {OnChunk} onChunk called for each chunk of code
47
+ * @param {OnSource} onSource called for each source
48
+ * @param {OnName} _onName called for each name
49
+ * @returns {GeneratedSourceInfo} generated source info
50
+ */
51
+ streamChunks(
52
+ options: Options,
53
+ onChunk: OnChunk,
54
+ onSource: OnSource,
55
+ _onName: OnName,
56
+ ): GeneratedSourceInfo;
57
+ }
58
+ declare namespace OriginalSource {
59
+ export {
60
+ ClearCacheOptions,
61
+ HashLike,
62
+ MapOptions,
63
+ RawSourceMap,
64
+ SourceAndMap,
65
+ SourceValue,
66
+ GeneratedSourceInfo,
67
+ OnChunk,
68
+ OnName,
69
+ OnSource,
70
+ Options,
71
+ ScopeBindings,
72
+ };
73
+ }
74
+ import Source = require("./Source");
75
+ type ClearCacheOptions = import("./Source").ClearCacheOptions;
76
+ type HashLike = import("./Source").HashLike;
77
+ type MapOptions = import("./Source").MapOptions;
78
+ type RawSourceMap = import("./Source").RawSourceMap;
79
+ type SourceAndMap = import("./Source").SourceAndMap;
80
+ type SourceValue = import("./Source").SourceValue;
81
+ type GeneratedSourceInfo =
82
+ import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo;
83
+ type OnChunk = import("./helpers/streamChunks").OnChunk;
84
+ type OnName = import("./helpers/streamChunks").OnName;
85
+ type OnSource = import("./helpers/streamChunks").OnSource;
86
+ type Options = import("./helpers/streamChunks").Options;
87
+ type ScopeBindings = import("./helpers/streamChunks").ScopeBindings;
@@ -0,0 +1,59 @@
1
+ export = PrefixSource;
2
+ declare class PrefixSource extends Source {
3
+ /**
4
+ * @param {string} prefix prefix
5
+ * @param {string | Buffer | Source} source source
6
+ */
7
+ constructor(prefix: string, source: string | Buffer | Source);
8
+ /**
9
+ * @type {string}
10
+ */
11
+ _prefix: string;
12
+ /**
13
+ * @type {Source}
14
+ */
15
+ _source: Source;
16
+ getPrefix(): string;
17
+ original(): Source;
18
+ /**
19
+ * @param {Options} options options
20
+ * @param {OnChunk} onChunk called for each chunk of code
21
+ * @param {OnSource} onSource called for each source
22
+ * @param {OnName} onName called for each name
23
+ * @returns {GeneratedSourceInfo} generated source info
24
+ */
25
+ streamChunks(
26
+ options: Options,
27
+ onChunk: OnChunk,
28
+ onSource: OnSource,
29
+ onName: OnName,
30
+ ): GeneratedSourceInfo;
31
+ }
32
+ declare namespace PrefixSource {
33
+ export {
34
+ ClearCacheOptions,
35
+ HashLike,
36
+ MapOptions,
37
+ RawSourceMap,
38
+ SourceAndMap,
39
+ SourceValue,
40
+ GeneratedSourceInfo,
41
+ OnChunk,
42
+ OnName,
43
+ OnSource,
44
+ Options,
45
+ };
46
+ }
47
+ import Source = require("./Source");
48
+ type ClearCacheOptions = import("./Source").ClearCacheOptions;
49
+ type HashLike = import("./Source").HashLike;
50
+ type MapOptions = import("./Source").MapOptions;
51
+ type RawSourceMap = import("./Source").RawSourceMap;
52
+ type SourceAndMap = import("./Source").SourceAndMap;
53
+ type SourceValue = import("./Source").SourceValue;
54
+ type GeneratedSourceInfo =
55
+ import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo;
56
+ type OnChunk = import("./helpers/streamChunks").OnChunk;
57
+ type OnName = import("./helpers/streamChunks").OnName;
58
+ type OnSource = import("./helpers/streamChunks").OnSource;
59
+ type Options = import("./helpers/streamChunks").Options;
@@ -0,0 +1,75 @@
1
+ export = RawSource;
2
+ /** @typedef {import("./Source").ClearCacheOptions} ClearCacheOptions */
3
+ /** @typedef {import("./Source").HashLike} HashLike */
4
+ /** @typedef {import("./Source").MapOptions} MapOptions */
5
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
6
+ /** @typedef {import("./Source").SourceValue} SourceValue */
7
+ /** @typedef {import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
8
+ /** @typedef {import("./helpers/streamChunks").OnChunk} OnChunk */
9
+ /** @typedef {import("./helpers/streamChunks").OnName} OnName */
10
+ /** @typedef {import("./helpers/streamChunks").OnSource} OnSource */
11
+ /** @typedef {import("./helpers/streamChunks").Options} Options */
12
+ declare class RawSource extends Source {
13
+ /**
14
+ * @param {string | Buffer} value value
15
+ * @param {boolean=} convertToString convert to string
16
+ */
17
+ constructor(value: string | Buffer, convertToString?: boolean | undefined);
18
+ /**
19
+ * @type {boolean}
20
+ */
21
+ _valueIsBuffer: boolean;
22
+ /**
23
+ * @type {undefined | string | Buffer}
24
+ */
25
+ _value: undefined | string | Buffer;
26
+ /**
27
+ * @type {undefined | Buffer}
28
+ */
29
+ _valueAsBuffer: undefined | Buffer;
30
+ /**
31
+ * @type {undefined | string}
32
+ */
33
+ _valueAsString: undefined | string;
34
+ isBuffer(): boolean;
35
+ _cachedSize: number | undefined;
36
+ /**
37
+ * @param {Options} options options
38
+ * @param {OnChunk} onChunk called for each chunk of code
39
+ * @param {OnSource} onSource called for each source
40
+ * @param {OnName} onName called for each name
41
+ * @returns {GeneratedSourceInfo} generated source info
42
+ */
43
+ streamChunks(
44
+ options: Options,
45
+ onChunk: OnChunk,
46
+ onSource: OnSource,
47
+ onName: OnName,
48
+ ): GeneratedSourceInfo;
49
+ }
50
+ declare namespace RawSource {
51
+ export {
52
+ ClearCacheOptions,
53
+ HashLike,
54
+ MapOptions,
55
+ RawSourceMap,
56
+ SourceValue,
57
+ GeneratedSourceInfo,
58
+ OnChunk,
59
+ OnName,
60
+ OnSource,
61
+ Options,
62
+ };
63
+ }
64
+ import Source = require("./Source");
65
+ type ClearCacheOptions = import("./Source").ClearCacheOptions;
66
+ type HashLike = import("./Source").HashLike;
67
+ type MapOptions = import("./Source").MapOptions;
68
+ type RawSourceMap = import("./Source").RawSourceMap;
69
+ type SourceValue = import("./Source").SourceValue;
70
+ type GeneratedSourceInfo =
71
+ import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo;
72
+ type OnChunk = import("./helpers/streamChunks").OnChunk;
73
+ type OnName = import("./helpers/streamChunks").OnName;
74
+ type OnSource = import("./helpers/streamChunks").OnSource;
75
+ type Options = import("./helpers/streamChunks").Options;
@@ -0,0 +1,107 @@
1
+ export = ReplaceSource;
2
+ declare class ReplaceSource extends Source {
3
+ /**
4
+ * @param {Source} source source
5
+ * @param {string=} name name
6
+ */
7
+ constructor(source: Source, name?: string | undefined);
8
+ /**
9
+ * @type {Source}
10
+ */
11
+ _source: Source;
12
+ /**
13
+ * @type {string | undefined}
14
+ */
15
+ _name: string | undefined;
16
+ /** @type {Replacement[]} */
17
+ _replacements: Replacement[];
18
+ /**
19
+ * @type {boolean}
20
+ */
21
+ _isSorted: boolean;
22
+ getName(): string | undefined;
23
+ getReplacements(): Replacement[];
24
+ /**
25
+ * @param {number} start start
26
+ * @param {number} end end
27
+ * @param {string} newValue new value
28
+ * @param {string=} name name
29
+ * @returns {void}
30
+ */
31
+ replace(
32
+ start: number,
33
+ end: number,
34
+ newValue: string,
35
+ name?: string | undefined,
36
+ ): void;
37
+ /**
38
+ * @param {number} pos pos
39
+ * @param {string} newValue new value
40
+ * @param {string=} name name
41
+ * @returns {void}
42
+ */
43
+ insert(pos: number, newValue: string, name?: string | undefined): void;
44
+ original(): Source;
45
+ _sortReplacements(): void;
46
+ /**
47
+ * @param {Options} options options
48
+ * @param {OnChunk} onChunk called for each chunk of code
49
+ * @param {OnSource} onSource called for each source
50
+ * @param {OnName} onName called for each name
51
+ * @returns {GeneratedSourceInfo} generated source info
52
+ */
53
+ streamChunks(
54
+ options: Options,
55
+ onChunk: OnChunk,
56
+ onSource: OnSource,
57
+ onName: OnName,
58
+ ): GeneratedSourceInfo;
59
+ }
60
+ declare namespace ReplaceSource {
61
+ export {
62
+ Replacement,
63
+ ClearCacheOptions,
64
+ HashLike,
65
+ MapOptions,
66
+ RawSourceMap,
67
+ SourceAndMap,
68
+ SourceValue,
69
+ GeneratedSourceInfo,
70
+ OnChunk,
71
+ OnName,
72
+ OnSource,
73
+ Options,
74
+ };
75
+ }
76
+ import Source = require("./Source");
77
+ declare class Replacement {
78
+ /**
79
+ * @param {number} start start
80
+ * @param {number} end end
81
+ * @param {string} content content
82
+ * @param {string=} name name
83
+ */
84
+ constructor(
85
+ start: number,
86
+ end: number,
87
+ content: string,
88
+ name?: string | undefined,
89
+ );
90
+ start: number;
91
+ end: number;
92
+ content: string;
93
+ name: string | undefined;
94
+ index: number | undefined;
95
+ }
96
+ type ClearCacheOptions = import("./Source").ClearCacheOptions;
97
+ type HashLike = import("./Source").HashLike;
98
+ type MapOptions = import("./Source").MapOptions;
99
+ type RawSourceMap = import("./Source").RawSourceMap;
100
+ type SourceAndMap = import("./Source").SourceAndMap;
101
+ type SourceValue = import("./Source").SourceValue;
102
+ type GeneratedSourceInfo =
103
+ import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo;
104
+ type OnChunk = import("./helpers/streamChunks").OnChunk;
105
+ type OnName = import("./helpers/streamChunks").OnName;
106
+ type OnSource = import("./helpers/streamChunks").OnSource;
107
+ type Options = import("./helpers/streamChunks").Options;
@@ -0,0 +1,24 @@
1
+ export = SizeOnlySource;
2
+ /** @typedef {import("./Source").HashLike} HashLike */
3
+ /** @typedef {import("./Source").MapOptions} MapOptions */
4
+ /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
5
+ /** @typedef {import("./Source").SourceValue} SourceValue */
6
+ declare class SizeOnlySource extends Source {
7
+ /**
8
+ * @param {number} size size
9
+ */
10
+ constructor(size: number);
11
+ /**
12
+ * @type {number}
13
+ */
14
+ _size: number;
15
+ _error(): Error;
16
+ }
17
+ declare namespace SizeOnlySource {
18
+ export { HashLike, MapOptions, RawSourceMap, SourceValue };
19
+ }
20
+ import Source = require("./Source");
21
+ type HashLike = import("./Source").HashLike;
22
+ type MapOptions = import("./Source").MapOptions;
23
+ type RawSourceMap = import("./Source").RawSourceMap;
24
+ type SourceValue = import("./Source").SourceValue;