@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.
- package/README.md +2 -2
- package/changes.json +1 -1
- package/lib/CachedSource.js +257 -63
- package/lib/CompatSource.js +42 -1
- package/lib/ConcatSource.js +100 -28
- package/lib/OriginalSource.js +111 -45
- package/lib/PrefixSource.js +60 -11
- package/lib/RawSource.js +85 -29
- package/lib/ReplaceSource.js +269 -73
- package/lib/SizeOnlySource.js +10 -1
- package/lib/Source.js +39 -0
- package/lib/SourceMapSource.js +92 -10
- package/lib/helpers/createMappingsSerializer.js +307 -54
- package/lib/helpers/getFromStreamChunks.js +165 -73
- package/lib/helpers/getGeneratedSourceInfo.js +7 -4
- package/lib/helpers/readMappings.js +6 -3
- package/lib/helpers/scopes.js +438 -0
- package/lib/helpers/splitIntoLines.js +10 -9
- package/lib/helpers/splitIntoPotentialTokens.js +99 -26
- package/lib/helpers/streamAndGetSourceAndMap.js +61 -22
- package/lib/helpers/streamChunks.js +3 -2
- package/lib/helpers/streamChunksOfCombinedSourceMap.js +7 -3
- package/lib/helpers/streamChunksOfRawSource.js +23 -15
- package/lib/helpers/streamChunksOfSourceMap.js +50 -42
- package/lib/index.js +3 -0
- package/package.json +34 -23
- package/types/CachedSource.d.ts +192 -0
- package/types/CompatSource.d.ts +87 -0
- package/types/ConcatSource.d.ts +75 -0
- package/types/OriginalSource.d.ts +87 -0
- package/types/PrefixSource.d.ts +59 -0
- package/types/RawSource.d.ts +75 -0
- package/types/ReplaceSource.d.ts +107 -0
- package/types/SizeOnlySource.d.ts +24 -0
- package/types/Source.d.ts +189 -0
- package/types/SourceMapSource.d.ts +136 -0
- package/types/helpers/createMappingsSerializer.d.ts +60 -0
- package/types/helpers/getFromStreamChunks.d.ts +16 -0
- package/types/helpers/getGeneratedSourceInfo.d.ts +31 -0
- package/types/helpers/getName.d.ts +15 -0
- package/types/helpers/getSource.d.ts +15 -0
- package/types/helpers/readMappings.d.ts +19 -0
- package/types/helpers/scopes.d.ts +119 -0
- package/types/helpers/splitIntoLines.d.ts +6 -0
- package/types/helpers/splitIntoPotentialTokens.d.ts +37 -0
- package/types/helpers/streamAndGetSourceAndMap.d.ts +39 -0
- package/types/helpers/streamChunks.d.ts +56 -0
- package/types/helpers/streamChunksOfCombinedSourceMap.d.ts +42 -0
- package/types/helpers/streamChunksOfRawSource.d.ts +16 -0
- package/types/helpers/streamChunksOfSourceMap.d.ts +19 -0
- package/types/helpers/stringBufferUtils.d.ts +55 -0
- package/types/index.d.ts +50 -0
- package/types.d.ts +42 -439
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const { createMappingsWriter } = require("./createMappingsSerializer");
|
|
9
9
|
const streamChunks = require("./streamChunks");
|
|
10
10
|
|
|
11
11
|
/** @typedef {import("../Source").RawSourceMap} RawSourceMap */
|
|
@@ -16,6 +16,20 @@ const streamChunks = require("./streamChunks");
|
|
|
16
16
|
/** @typedef {import("./streamChunks").Options} Options */
|
|
17
17
|
/** @typedef {import("./streamChunks").SourceMaybeWithStreamChunksFunction} SourceMaybeWithStreamChunksFunction */
|
|
18
18
|
|
|
19
|
+
/** @type {typeof import("./scopes") | undefined} */
|
|
20
|
+
let scopesHelpers;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Loads the scopes helpers on first use. They are only reachable through the
|
|
24
|
+
* `scopes` option, so requiring them eagerly would put the encoder in the
|
|
25
|
+
* module graph of every caller that never asks for the field.
|
|
26
|
+
* @returns {ReturnType<typeof import("./scopes").createScopesWriter>} writer
|
|
27
|
+
*/
|
|
28
|
+
const createScopesWriter = () => {
|
|
29
|
+
if (scopesHelpers === undefined) scopesHelpers = require("./scopes");
|
|
30
|
+
return scopesHelpers.createScopesWriter();
|
|
31
|
+
};
|
|
32
|
+
|
|
19
33
|
/**
|
|
20
34
|
* @param {SourceMaybeWithStreamChunksFunction} inputSource input source
|
|
21
35
|
* @param {Options} options options
|
|
@@ -32,18 +46,26 @@ const streamAndGetSourceAndMap = (
|
|
|
32
46
|
onName,
|
|
33
47
|
) => {
|
|
34
48
|
let code = "";
|
|
35
|
-
let mappings = "";
|
|
36
49
|
/** @type {(string | null)[]} */
|
|
37
50
|
const potentialSources = [];
|
|
38
51
|
/** @type {(string | null)[]} */
|
|
39
52
|
const potentialSourcesContent = [];
|
|
40
53
|
/** @type {(string | null)[]} */
|
|
41
54
|
const potentialNames = [];
|
|
42
|
-
const
|
|
55
|
+
const mappingsWriter = createMappingsWriter({ ...options, columns: true });
|
|
56
|
+
const addMapping = mappingsWriter.add;
|
|
57
|
+
const scopesWriter =
|
|
58
|
+
options && options.scopes ? createScopesWriter() : undefined;
|
|
43
59
|
const finalSource = Boolean(options && options.finalSource);
|
|
60
|
+
// The caller may have passed `source: false` (getMap does), but this
|
|
61
|
+
// helper caches the source text, so the inner stream must produce it.
|
|
62
|
+
const innerOptions =
|
|
63
|
+
options && options.source === false
|
|
64
|
+
? { ...options, source: true }
|
|
65
|
+
: options;
|
|
44
66
|
const { generatedLine, generatedColumn, source } = streamChunks(
|
|
45
67
|
inputSource,
|
|
46
|
-
|
|
68
|
+
innerOptions,
|
|
47
69
|
(
|
|
48
70
|
chunk,
|
|
49
71
|
generatedLine,
|
|
@@ -54,7 +76,7 @@ const streamAndGetSourceAndMap = (
|
|
|
54
76
|
nameIndex,
|
|
55
77
|
) => {
|
|
56
78
|
if (chunk !== undefined) code += chunk;
|
|
57
|
-
|
|
79
|
+
addMapping(
|
|
58
80
|
generatedLine,
|
|
59
81
|
generatedColumn,
|
|
60
82
|
sourceIndex,
|
|
@@ -62,6 +84,14 @@ const streamAndGetSourceAndMap = (
|
|
|
62
84
|
originalColumn,
|
|
63
85
|
nameIndex,
|
|
64
86
|
);
|
|
87
|
+
if (scopesWriter !== undefined) {
|
|
88
|
+
scopesWriter.add(
|
|
89
|
+
generatedLine,
|
|
90
|
+
generatedColumn,
|
|
91
|
+
sourceIndex,
|
|
92
|
+
originalLine,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
65
95
|
return onChunk(
|
|
66
96
|
finalSource ? undefined : chunk,
|
|
67
97
|
generatedLine,
|
|
@@ -72,7 +102,7 @@ const streamAndGetSourceAndMap = (
|
|
|
72
102
|
nameIndex,
|
|
73
103
|
);
|
|
74
104
|
},
|
|
75
|
-
(sourceIndex, source, sourceContent) => {
|
|
105
|
+
(sourceIndex, source, sourceContent, scopeBindings) => {
|
|
76
106
|
while (potentialSources.length < sourceIndex) {
|
|
77
107
|
potentialSources.push(null);
|
|
78
108
|
}
|
|
@@ -83,7 +113,10 @@ const streamAndGetSourceAndMap = (
|
|
|
83
113
|
}
|
|
84
114
|
potentialSourcesContent[sourceIndex] = sourceContent;
|
|
85
115
|
}
|
|
86
|
-
|
|
116
|
+
if (scopesWriter !== undefined) {
|
|
117
|
+
scopesWriter.addSource(sourceIndex, scopeBindings);
|
|
118
|
+
}
|
|
119
|
+
return onSource(sourceIndex, source, sourceContent, scopeBindings);
|
|
87
120
|
},
|
|
88
121
|
(nameIndex, name) => {
|
|
89
122
|
while (potentialNames.length < nameIndex) {
|
|
@@ -94,6 +127,26 @@ const streamAndGetSourceAndMap = (
|
|
|
94
127
|
},
|
|
95
128
|
);
|
|
96
129
|
const resultSource = source !== undefined ? source : code;
|
|
130
|
+
const mappings = mappingsWriter.finish();
|
|
131
|
+
/** @type {RawSourceMap | null} */
|
|
132
|
+
let map = null;
|
|
133
|
+
if (mappings.length > 0) {
|
|
134
|
+
map = {
|
|
135
|
+
version: 3,
|
|
136
|
+
file: "x",
|
|
137
|
+
mappings,
|
|
138
|
+
// We handle broken sources as `null`, in spec this field should be string, but no information what we should do in such cases if we change type it will be breaking change
|
|
139
|
+
sources: /** @type {string[]} */ (potentialSources),
|
|
140
|
+
sourcesContent:
|
|
141
|
+
potentialSourcesContent.length > 0
|
|
142
|
+
? /** @type {string[]} */ (potentialSourcesContent)
|
|
143
|
+
: undefined,
|
|
144
|
+
names: /** @type {string[]} */ (potentialNames),
|
|
145
|
+
};
|
|
146
|
+
if (scopesWriter !== undefined) {
|
|
147
|
+
scopesWriter.finish(map, generatedLine || 0, generatedColumn || 0);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
97
150
|
|
|
98
151
|
return {
|
|
99
152
|
result: {
|
|
@@ -102,21 +155,7 @@ const streamAndGetSourceAndMap = (
|
|
|
102
155
|
source: finalSource ? resultSource : undefined,
|
|
103
156
|
},
|
|
104
157
|
source: resultSource,
|
|
105
|
-
map
|
|
106
|
-
mappings.length > 0
|
|
107
|
-
? {
|
|
108
|
-
version: 3,
|
|
109
|
-
file: "x",
|
|
110
|
-
mappings,
|
|
111
|
-
// We handle broken sources as `null`, in spec this field should be string, but no information what we should do in such cases if we change type it will be breaking change
|
|
112
|
-
sources: /** @type {string[]} */ (potentialSources),
|
|
113
|
-
sourcesContent:
|
|
114
|
-
potentialSourcesContent.length > 0
|
|
115
|
-
? /** @type {string[]} */ (potentialSourcesContent)
|
|
116
|
-
: undefined,
|
|
117
|
-
names: /** @type {string[]} */ (potentialNames),
|
|
118
|
-
}
|
|
119
|
-
: null,
|
|
158
|
+
map,
|
|
120
159
|
};
|
|
121
160
|
};
|
|
122
161
|
|
|
@@ -11,10 +11,11 @@ const streamChunksOfSourceMap = require("./streamChunksOfSourceMap");
|
|
|
11
11
|
/** @typedef {import("../Source")} Source */
|
|
12
12
|
/** @typedef {import("./getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
|
|
13
13
|
/** @typedef {(chunk: string | undefined, generatedLine: number, generatedColumn: number, sourceIndex: number, originalLine: number, originalColumn: number, nameIndex: number) => void} OnChunk */
|
|
14
|
-
/** @typedef {
|
|
14
|
+
/** @typedef {Map<string, string>} ScopeBindings */
|
|
15
|
+
/** @typedef {(sourceIndex: number, source: string | null, sourceContent: string | undefined, scopeBindings?: ScopeBindings) => void} OnSource */
|
|
15
16
|
/** @typedef {(nameIndex: number, name: string) => void} OnName */
|
|
16
17
|
|
|
17
|
-
/** @typedef {{ source?: boolean, finalSource?: boolean, columns?: boolean }} Options */
|
|
18
|
+
/** @typedef {{ source?: boolean, finalSource?: boolean, columns?: boolean, scopes?: boolean }} Options */
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* @callback StreamChunksFunction
|
|
@@ -76,7 +76,11 @@ const streamChunksOfCombinedSourceMap = (
|
|
|
76
76
|
if (line > innerSourceMapLineData.length) return -1;
|
|
77
77
|
const { mappingsData } = innerSourceMapLineData[line - 1];
|
|
78
78
|
let l = 0;
|
|
79
|
-
|
|
79
|
+
// `mappingsData.length` is always a multiple of 5 (five values pushed
|
|
80
|
+
// per mapping), so dividing is exact. Coerce the bound to an int32 so
|
|
81
|
+
// the binary-search loop stays on V8's fast small-int path instead of
|
|
82
|
+
// comparing an int against a float.
|
|
83
|
+
let r = (mappingsData.length / 5) | 0;
|
|
80
84
|
while (l < r) {
|
|
81
85
|
const m = (l + r) >> 1;
|
|
82
86
|
if (mappingsData[m * 5] <= column) {
|
|
@@ -297,7 +301,7 @@ const streamChunksOfCombinedSourceMap = (
|
|
|
297
301
|
);
|
|
298
302
|
}
|
|
299
303
|
},
|
|
300
|
-
(i, source, sourceContent) => {
|
|
304
|
+
(i, source, sourceContent, scopeBindings) => {
|
|
301
305
|
if (source === innerSourceName) {
|
|
302
306
|
outerSourceIndex = i;
|
|
303
307
|
if (innerSource !== undefined) sourceContent = innerSource;
|
|
@@ -349,7 +353,7 @@ const streamChunksOfCombinedSourceMap = (
|
|
|
349
353
|
let globalIndex = sourceMapping.get(source);
|
|
350
354
|
if (globalIndex === undefined) {
|
|
351
355
|
sourceMapping.set(source, (globalIndex = sourceMapping.size));
|
|
352
|
-
onSource(globalIndex, source, sourceContent);
|
|
356
|
+
onSource(globalIndex, source, sourceContent, scopeBindings);
|
|
353
357
|
}
|
|
354
358
|
sourceIndexMapping[i] = globalIndex;
|
|
355
359
|
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
const getGeneratedSourceInfo = require("./getGeneratedSourceInfo");
|
|
9
|
-
const splitIntoLines = require("./splitIntoLines");
|
|
10
9
|
|
|
11
10
|
/** @typedef {import("./getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
|
|
12
11
|
/** @typedef {import("./streamChunks").OnChunk} OnChunk */
|
|
@@ -19,25 +18,34 @@ const splitIntoLines = require("./splitIntoLines");
|
|
|
19
18
|
* @param {OnSource} _onSource on source
|
|
20
19
|
* @param {OnName} _onName on name
|
|
21
20
|
* @returns {GeneratedSourceInfo} source info
|
|
21
|
+
*
|
|
22
|
+
* Single-pass equivalent of `splitIntoLines(source).forEach(emit)` — emits
|
|
23
|
+
* each line via onChunk while scanning for newlines, so we never allocate
|
|
24
|
+
* the intermediate array of lines.
|
|
22
25
|
*/
|
|
23
26
|
const streamChunksOfRawSource = (source, onChunk, _onSource, _onName) => {
|
|
27
|
+
const len = source.length;
|
|
28
|
+
if (len === 0) {
|
|
29
|
+
return { generatedLine: 1, generatedColumn: 0 };
|
|
30
|
+
}
|
|
24
31
|
let line = 1;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
let i = 0;
|
|
33
|
+
while (i < len) {
|
|
34
|
+
const n = source.indexOf("\n", i);
|
|
35
|
+
if (n === -1) {
|
|
36
|
+
// Trailing partial line (no \n). Emit and return its length as the
|
|
37
|
+
// final column.
|
|
38
|
+
const lastLine = i === 0 ? source : source.slice(i);
|
|
39
|
+
onChunk(lastLine, line, 0, -1, -1, -1, -1);
|
|
40
|
+
return { generatedLine: line, generatedColumn: lastLine.length };
|
|
41
|
+
}
|
|
42
|
+
const chunk = n === i ? "\n" : source.slice(i, n + 1);
|
|
43
|
+
onChunk(chunk, line, 0, -1, -1, -1, -1);
|
|
30
44
|
line++;
|
|
45
|
+
i = n + 1;
|
|
31
46
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
generatedLine: matches.length + 1,
|
|
35
|
-
generatedColumn: 0,
|
|
36
|
-
}
|
|
37
|
-
: {
|
|
38
|
-
generatedLine: matches.length,
|
|
39
|
-
generatedColumn: /** @type {string} */ (match).length,
|
|
40
|
-
};
|
|
47
|
+
// Source ended with a newline — the next "logical" line is empty.
|
|
48
|
+
return { generatedLine: line, generatedColumn: 0 };
|
|
41
49
|
};
|
|
42
50
|
|
|
43
51
|
/**
|
|
@@ -32,7 +32,8 @@ const streamChunksOfSourceMapFull = (
|
|
|
32
32
|
onName,
|
|
33
33
|
) => {
|
|
34
34
|
const lines = splitIntoLines(source);
|
|
35
|
-
|
|
35
|
+
const linesLength = lines.length;
|
|
36
|
+
if (linesLength === 0) {
|
|
36
37
|
return {
|
|
37
38
|
generatedLine: 1,
|
|
38
39
|
generatedColumn: 0,
|
|
@@ -52,9 +53,9 @@ const streamChunksOfSourceMapFull = (
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
const lastLine = lines[
|
|
56
|
+
const lastLine = lines[linesLength - 1];
|
|
56
57
|
const lastNewLine = lastLine.endsWith("\n");
|
|
57
|
-
const finalLine = lastNewLine ?
|
|
58
|
+
const finalLine = lastNewLine ? linesLength + 1 : linesLength;
|
|
58
59
|
const finalColumn = lastNewLine ? 0 : lastLine.length;
|
|
59
60
|
|
|
60
61
|
let currentGeneratedLine = 1;
|
|
@@ -83,7 +84,7 @@ const streamChunksOfSourceMapFull = (
|
|
|
83
84
|
originalColumn,
|
|
84
85
|
nameIndex,
|
|
85
86
|
) => {
|
|
86
|
-
if (mappingActive && currentGeneratedLine <=
|
|
87
|
+
if (mappingActive && currentGeneratedLine <= linesLength) {
|
|
87
88
|
let chunk;
|
|
88
89
|
const mappingLine = currentGeneratedLine;
|
|
89
90
|
const mappingColumn = currentGeneratedColumn;
|
|
@@ -110,7 +111,7 @@ const streamChunksOfSourceMapFull = (
|
|
|
110
111
|
mappingActive = false;
|
|
111
112
|
}
|
|
112
113
|
if (generatedLine > currentGeneratedLine && currentGeneratedColumn > 0) {
|
|
113
|
-
if (currentGeneratedLine <=
|
|
114
|
+
if (currentGeneratedLine <= linesLength) {
|
|
114
115
|
const chunk = lines[currentGeneratedLine - 1].slice(
|
|
115
116
|
currentGeneratedColumn,
|
|
116
117
|
);
|
|
@@ -127,22 +128,29 @@ const streamChunksOfSourceMapFull = (
|
|
|
127
128
|
currentGeneratedLine++;
|
|
128
129
|
currentGeneratedColumn = 0;
|
|
129
130
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
131
|
+
// Emit each fully-passed generated line. Once we move past the last
|
|
132
|
+
// available line we stop emitting, but still need to advance the
|
|
133
|
+
// counter to `generatedLine` so subsequent state matches the caller.
|
|
134
|
+
while (
|
|
135
|
+
generatedLine > currentGeneratedLine &&
|
|
136
|
+
currentGeneratedLine <= linesLength
|
|
137
|
+
) {
|
|
138
|
+
onChunk(
|
|
139
|
+
lines[currentGeneratedLine - 1],
|
|
140
|
+
currentGeneratedLine,
|
|
141
|
+
0,
|
|
142
|
+
-1,
|
|
143
|
+
-1,
|
|
144
|
+
-1,
|
|
145
|
+
-1,
|
|
146
|
+
);
|
|
142
147
|
currentGeneratedLine++;
|
|
143
148
|
}
|
|
149
|
+
if (currentGeneratedLine < generatedLine) {
|
|
150
|
+
currentGeneratedLine = generatedLine;
|
|
151
|
+
}
|
|
144
152
|
if (generatedColumn > currentGeneratedColumn) {
|
|
145
|
-
if (currentGeneratedLine <=
|
|
153
|
+
if (currentGeneratedLine <= linesLength) {
|
|
146
154
|
const chunk = lines[currentGeneratedLine - 1].slice(
|
|
147
155
|
currentGeneratedColumn,
|
|
148
156
|
generatedColumn,
|
|
@@ -195,7 +203,8 @@ const streamChunksOfSourceMapLinesFull = (
|
|
|
195
203
|
_onName,
|
|
196
204
|
) => {
|
|
197
205
|
const lines = splitIntoLines(source);
|
|
198
|
-
|
|
206
|
+
const linesLength = lines.length;
|
|
207
|
+
if (linesLength === 0) {
|
|
199
208
|
return {
|
|
200
209
|
generatedLine: 1,
|
|
201
210
|
generatedColumn: 0,
|
|
@@ -232,39 +241,38 @@ const streamChunksOfSourceMapLinesFull = (
|
|
|
232
241
|
if (
|
|
233
242
|
sourceIndex < 0 ||
|
|
234
243
|
generatedLine < currentGeneratedLine ||
|
|
235
|
-
generatedLine >
|
|
244
|
+
generatedLine > linesLength
|
|
236
245
|
) {
|
|
237
246
|
return;
|
|
238
247
|
}
|
|
248
|
+
// `generatedLine <= linesLength` is guaranteed by the guard above, so
|
|
249
|
+
// every line we iterate over is in bounds — no per-iteration length
|
|
250
|
+
// check needed.
|
|
239
251
|
while (generatedLine > currentGeneratedLine) {
|
|
240
|
-
if (currentGeneratedLine <= lines.length) {
|
|
241
|
-
onChunk(
|
|
242
|
-
lines[currentGeneratedLine - 1],
|
|
243
|
-
currentGeneratedLine,
|
|
244
|
-
0,
|
|
245
|
-
-1,
|
|
246
|
-
-1,
|
|
247
|
-
-1,
|
|
248
|
-
-1,
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
currentGeneratedLine++;
|
|
252
|
-
}
|
|
253
|
-
if (generatedLine <= lines.length) {
|
|
254
252
|
onChunk(
|
|
255
|
-
lines[
|
|
256
|
-
|
|
253
|
+
lines[currentGeneratedLine - 1],
|
|
254
|
+
currentGeneratedLine,
|
|
257
255
|
0,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
256
|
+
-1,
|
|
257
|
+
-1,
|
|
258
|
+
-1,
|
|
261
259
|
-1,
|
|
262
260
|
);
|
|
263
261
|
currentGeneratedLine++;
|
|
264
262
|
}
|
|
263
|
+
onChunk(
|
|
264
|
+
lines[generatedLine - 1],
|
|
265
|
+
generatedLine,
|
|
266
|
+
0,
|
|
267
|
+
sourceIndex,
|
|
268
|
+
originalLine,
|
|
269
|
+
originalColumn,
|
|
270
|
+
-1,
|
|
271
|
+
);
|
|
272
|
+
currentGeneratedLine++;
|
|
265
273
|
};
|
|
266
274
|
readMappings(mappings, onMapping);
|
|
267
|
-
for (; currentGeneratedLine <=
|
|
275
|
+
for (; currentGeneratedLine <= linesLength; currentGeneratedLine++) {
|
|
268
276
|
onChunk(
|
|
269
277
|
lines[currentGeneratedLine - 1],
|
|
270
278
|
currentGeneratedLine,
|
|
@@ -276,10 +284,10 @@ const streamChunksOfSourceMapLinesFull = (
|
|
|
276
284
|
);
|
|
277
285
|
}
|
|
278
286
|
|
|
279
|
-
const lastLine = lines[
|
|
287
|
+
const lastLine = lines[linesLength - 1];
|
|
280
288
|
const lastNewLine = lastLine.endsWith("\n");
|
|
281
289
|
|
|
282
|
-
const finalLine = lastNewLine ?
|
|
290
|
+
const finalLine = lastNewLine ? linesLength + 1 : linesLength;
|
|
283
291
|
const finalColumn = lastNewLine ? 0 : lastLine.length;
|
|
284
292
|
|
|
285
293
|
return {
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/webpack-sources",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.6.0-depup.0",
|
|
4
|
+
"description": "Source code handling classes for webpack (with updated dependencies)",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"depup",
|
|
7
|
-
"dependency-bumped",
|
|
8
|
-
"updated-deps",
|
|
9
6
|
"webpack-sources",
|
|
7
|
+
"depup",
|
|
8
|
+
"updated-dependencies",
|
|
9
|
+
"security",
|
|
10
|
+
"latest",
|
|
11
|
+
"patched",
|
|
10
12
|
"webpack",
|
|
11
13
|
"source-map"
|
|
12
14
|
],
|
|
@@ -24,38 +26,47 @@
|
|
|
24
26
|
"types": "types.d.ts",
|
|
25
27
|
"files": [
|
|
26
28
|
"lib/",
|
|
29
|
+
"types/",
|
|
27
30
|
"types.d.ts",
|
|
28
31
|
"changes.json",
|
|
29
32
|
"README.md"
|
|
30
33
|
],
|
|
31
34
|
"scripts": {
|
|
32
|
-
"lint": "npm run lint:code && npm run lint:types && npm run lint:types-test
|
|
35
|
+
"lint": "npm run lint:code && npm run lint:types && npm run lint:types-test",
|
|
33
36
|
"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
37
|
"lint:types": "tsc",
|
|
36
38
|
"lint:types-test": "tsc -p tsconfig.types.test.json",
|
|
37
39
|
"fmt": "npm run fmt:base -- --loglevel warn --write",
|
|
38
40
|
"fmt:check": "npm run fmt:base -- --check",
|
|
39
41
|
"fmt:base": "prettier --cache --ignore-unknown .",
|
|
40
|
-
"fix": "npm run fix:code && npm run
|
|
42
|
+
"fix": "npm run fix:code && npm run build:types",
|
|
41
43
|
"fix:code": "npm run lint:code -- --fix",
|
|
42
|
-
"
|
|
44
|
+
"build:types": "del-cli types && tsc -p tsconfig.types.json && prettier --log-level warn --write types",
|
|
43
45
|
"pretest": "npm run lint",
|
|
44
|
-
"test": "
|
|
45
|
-
"
|
|
46
|
+
"test": "node --require ./test/helpers/validate-mappings.js --test --test-reporter=dot \"test/*.js\"",
|
|
47
|
+
"test:coverage": "node --require ./test/helpers/validate-mappings.js --test --experimental-test-coverage --test-coverage-include=\"lib/**\" --test-reporter=dot --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=lcov.info \"test/*.js\"",
|
|
48
|
+
"test:update-snapshots": "node --require ./test/helpers/validate-mappings.js --test --test-reporter=dot --test-update-snapshots \"test/*.js\"",
|
|
49
|
+
"test:legacy": "jest",
|
|
50
|
+
"test:legacy:coverage": "jest --coverage",
|
|
51
|
+
"benchmark": "node --max-old-space-size=4096 --hash-seed=1 --random-seed=1 --no-opt --predictable --predictable-gc-schedule --interpreted-frames-native-stack --allow-natives-syntax --expose-gc --no-concurrent-sweeping ./benchmark/run.mjs cases",
|
|
52
|
+
"benchmark:memory": "node --expose-gc --max-old-space-size=4096 ./benchmark/run.mjs memory",
|
|
53
|
+
"version": "changeset version && npm run fmt",
|
|
54
|
+
"release": "changeset publish"
|
|
46
55
|
},
|
|
47
56
|
"devDependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
57
|
+
"@changesets/cli": "^3.0.3",
|
|
58
|
+
"@changesets/get-github-info": "^1.0.1",
|
|
59
|
+
"@codspeed/core": "^5.5.0",
|
|
60
|
+
"del-cli": "^7.0.0",
|
|
61
|
+
"eslint": "^9.39.5",
|
|
62
|
+
"eslint-config-webpack": "^4.14.0",
|
|
63
|
+
"jest": "^30.5.2",
|
|
64
|
+
"prettier": "^3.9.9",
|
|
65
|
+
"source-map": "^0.8.0",
|
|
55
66
|
"sourcemap-validator": "^2.1.0",
|
|
56
|
-
"
|
|
57
|
-
"typescript": "^
|
|
58
|
-
"webpack": "^5.
|
|
67
|
+
"tinybench": "^6.0.0",
|
|
68
|
+
"typescript": "^6.0.2",
|
|
69
|
+
"webpack": "^5.107.2"
|
|
59
70
|
},
|
|
60
71
|
"engines": {
|
|
61
72
|
"node": ">=10.13.0"
|
|
@@ -64,8 +75,8 @@
|
|
|
64
75
|
"changes": {},
|
|
65
76
|
"depsUpdated": 0,
|
|
66
77
|
"originalPackage": "webpack-sources",
|
|
67
|
-
"originalVersion": "3.
|
|
68
|
-
"processedAt": "2026-
|
|
78
|
+
"originalVersion": "3.6.0",
|
|
79
|
+
"processedAt": "2026-09-27T01:03:20.180Z",
|
|
69
80
|
"smokeTest": "passed"
|
|
70
81
|
}
|
|
71
82
|
}
|