@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,56 @@
1
+ declare namespace _exports {
2
+ export {
3
+ Source,
4
+ GeneratedSourceInfo,
5
+ OnChunk,
6
+ ScopeBindings,
7
+ OnSource,
8
+ OnName,
9
+ Options,
10
+ StreamChunksFunction,
11
+ SourceMaybeWithStreamChunksFunction,
12
+ };
13
+ }
14
+ declare function _exports(
15
+ source: SourceMaybeWithStreamChunksFunction,
16
+ options: Options,
17
+ onChunk: OnChunk,
18
+ onSource: OnSource,
19
+ onName: OnName,
20
+ ): GeneratedSourceInfo;
21
+ export = _exports;
22
+ type Source = import("../Source");
23
+ type GeneratedSourceInfo =
24
+ import("./getGeneratedSourceInfo").GeneratedSourceInfo;
25
+ type OnChunk = (
26
+ chunk: string | undefined,
27
+ generatedLine: number,
28
+ generatedColumn: number,
29
+ sourceIndex: number,
30
+ originalLine: number,
31
+ originalColumn: number,
32
+ nameIndex: number,
33
+ ) => void;
34
+ type ScopeBindings = Map<string, string>;
35
+ type OnSource = (
36
+ sourceIndex: number,
37
+ source: string | null,
38
+ sourceContent: string | undefined,
39
+ scopeBindings?: ScopeBindings,
40
+ ) => void;
41
+ type OnName = (nameIndex: number, name: string) => void;
42
+ type Options = {
43
+ source?: boolean;
44
+ finalSource?: boolean;
45
+ columns?: boolean;
46
+ scopes?: boolean;
47
+ };
48
+ type StreamChunksFunction = (
49
+ options: Options,
50
+ onChunk: OnChunk,
51
+ onSource: OnSource,
52
+ onName: OnName,
53
+ ) => any;
54
+ type SourceMaybeWithStreamChunksFunction = Source & {
55
+ streamChunks?: StreamChunksFunction;
56
+ };
@@ -0,0 +1,42 @@
1
+ export = streamChunksOfCombinedSourceMap;
2
+ /** @typedef {import("../Source").RawSourceMap} RawSourceMap */
3
+ /** @typedef {import("./getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
4
+ /** @typedef {import("./streamChunks").OnChunk} onChunk */
5
+ /** @typedef {import("./streamChunks").OnName} OnName */
6
+ /** @typedef {import("./streamChunks").OnSource} OnSource */
7
+ /**
8
+ * @param {string} source source
9
+ * @param {RawSourceMap} sourceMap source map
10
+ * @param {string} innerSourceName inner source name
11
+ * @param {string} innerSource inner source
12
+ * @param {RawSourceMap} innerSourceMap inner source map
13
+ * @param {boolean | undefined} removeInnerSource do remove inner source
14
+ * @param {onChunk} onChunk on chunk
15
+ * @param {OnSource} onSource on source
16
+ * @param {OnName} onName on name
17
+ * @param {boolean} finalSource finalSource
18
+ * @param {boolean} columns columns
19
+ * @returns {GeneratedSourceInfo} generated source info
20
+ */
21
+ declare function streamChunksOfCombinedSourceMap(
22
+ source: string,
23
+ sourceMap: RawSourceMap,
24
+ innerSourceName: string,
25
+ innerSource: string,
26
+ innerSourceMap: RawSourceMap,
27
+ removeInnerSource: boolean | undefined,
28
+ onChunk: onChunk,
29
+ onSource: OnSource,
30
+ onName: OnName,
31
+ finalSource: boolean,
32
+ columns: boolean,
33
+ ): GeneratedSourceInfo;
34
+ declare namespace streamChunksOfCombinedSourceMap {
35
+ export { RawSourceMap, GeneratedSourceInfo, onChunk, OnName, OnSource };
36
+ }
37
+ type RawSourceMap = import("../Source").RawSourceMap;
38
+ type GeneratedSourceInfo =
39
+ import("./getGeneratedSourceInfo").GeneratedSourceInfo;
40
+ type onChunk = import("./streamChunks").OnChunk;
41
+ type OnName = import("./streamChunks").OnName;
42
+ type OnSource = import("./streamChunks").OnSource;
@@ -0,0 +1,16 @@
1
+ declare namespace _exports {
2
+ export { GeneratedSourceInfo, OnChunk, OnName, OnSource };
3
+ }
4
+ declare function _exports(
5
+ source: string,
6
+ onChunk: OnChunk,
7
+ onSource: OnSource,
8
+ onName: OnName,
9
+ finalSource: boolean,
10
+ ): GeneratedSourceInfo;
11
+ export = _exports;
12
+ type GeneratedSourceInfo =
13
+ import("./getGeneratedSourceInfo").GeneratedSourceInfo;
14
+ type OnChunk = import("./streamChunks").OnChunk;
15
+ type OnName = import("./streamChunks").OnName;
16
+ type OnSource = import("./streamChunks").OnSource;
@@ -0,0 +1,19 @@
1
+ declare namespace _exports {
2
+ export { RawSourceMap, GeneratedSourceInfo, OnChunk, OnName, OnSource };
3
+ }
4
+ declare function _exports(
5
+ source: string,
6
+ sourceMap: RawSourceMap,
7
+ onChunk: OnChunk,
8
+ onSource: OnSource,
9
+ onName: OnName,
10
+ finalSource: boolean,
11
+ columns: boolean,
12
+ ): GeneratedSourceInfo;
13
+ export = _exports;
14
+ type RawSourceMap = import("../Source").RawSourceMap;
15
+ type GeneratedSourceInfo =
16
+ import("./getGeneratedSourceInfo").GeneratedSourceInfo;
17
+ type OnChunk = import("./streamChunks").OnChunk;
18
+ type OnName = import("./streamChunks").OnName;
19
+ type OnSource = import("./streamChunks").OnSource;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Disables the optimization to save both string and buffer in memory. This
3
+ * may increase performance but should reduce memory usage in the Webpack
4
+ * compiler.
5
+ * @returns {void}
6
+ */
7
+ export function disableDualStringBufferCaching(): void;
8
+ /**
9
+ * Enables an optimization to save both string and buffer in memory to avoid
10
+ * repeat conversions between the two formats when they are requested. This
11
+ * is enabled by default. This option can improve performance but can consume
12
+ * additional memory since values are stored twice.
13
+ * @returns {void}
14
+ */
15
+ export function enableDualStringBufferCaching(): void;
16
+ /**
17
+ * Starts a memory optimization to avoid repeat copies of the same string in
18
+ * memory by caching a single reference to the string. This can reduce memory
19
+ * usage if the same string is repeated many times in the compiler, such as
20
+ * when Webpack layers are used with the same files.
21
+ *
22
+ * {@link exitStringInterningRange} should be called when string interning is
23
+ * no longer necessary to free up the memory used by the interned strings. If
24
+ * {@link enterStringInterningRange} has been called multiple times, then
25
+ * this method may not immediately free all the memory until
26
+ * {@link exitStringInterningRange} has been called to end all string
27
+ * interning ranges.
28
+ * @returns {void}
29
+ */
30
+ export function enterStringInterningRange(): void;
31
+ /**
32
+ * Stops the current string interning range. Once all string interning ranges
33
+ * have been exited, this method will free all the memory used by the interned
34
+ * strings. This method should be called once for each time that
35
+ * {@link enterStringInterningRange} was called.
36
+ * @returns {void}
37
+ */
38
+ export function exitStringInterningRange(): void;
39
+ /**
40
+ * Saves the string in a map to ensure that only one copy of the string exists
41
+ * in memory at a given time. This is controlled by {@link enableStringInterning}
42
+ * and {@link disableStringInterning}. Callers are expect to manage the memory
43
+ * of the interned strings by calling {@link disableStringInterning} after the
44
+ * compiler no longer needs to save the interned memory.
45
+ * @param {string} str A string to be interned.
46
+ * @returns {string} The original string or a reference to an existing string of the same value if it has already been interned.
47
+ */
48
+ export function internString(str: string): string;
49
+ /**
50
+ * @returns {boolean} Whether the optimization to cache copies of both the
51
+ * string and buffer version of source content is enabled. This is enabled by
52
+ * default to improve performance but can consume more memory since values are
53
+ * stored twice.
54
+ */
55
+ export function isDualStringBufferCachingEnabled(): boolean;
@@ -0,0 +1,50 @@
1
+ declare namespace _exports {
2
+ export {
3
+ CachedData,
4
+ SourceLike,
5
+ ConcatSourceChild,
6
+ Replacement,
7
+ HashLike,
8
+ MapOptions,
9
+ RawSourceMap,
10
+ SourceAndMap,
11
+ SourceValue,
12
+ GeneratedSourceInfo,
13
+ OnChunk,
14
+ OnName,
15
+ OnSource,
16
+ StreamChunksOptions,
17
+ };
18
+ }
19
+ declare namespace _exports {
20
+ const Source: typeof import("./Source");
21
+ const RawSource: typeof import("./RawSource");
22
+ const OriginalSource: typeof import("./OriginalSource");
23
+ const SourceMapSource: typeof import("./SourceMapSource");
24
+ const CachedSource: typeof import("./CachedSource");
25
+ const ConcatSource: typeof import("./ConcatSource");
26
+ const ReplaceSource: typeof import("./ReplaceSource");
27
+ const PrefixSource: typeof import("./PrefixSource");
28
+ const SizeOnlySource: typeof import("./SizeOnlySource");
29
+ const CompatSource: typeof import("./CompatSource");
30
+ namespace util {
31
+ const scopes: typeof import("./helpers/scopes");
32
+ const stringBufferUtils: typeof import("./helpers/stringBufferUtils");
33
+ }
34
+ }
35
+ export = _exports;
36
+ type CachedData = import("./CachedSource").CachedData;
37
+ type SourceLike = import("./CompatSource").SourceLike;
38
+ type ConcatSourceChild = import("./ConcatSource").Child;
39
+ type Replacement = import("./ReplaceSource").Replacement;
40
+ type HashLike = import("./Source").HashLike;
41
+ type MapOptions = import("./Source").MapOptions;
42
+ type RawSourceMap = import("./Source").RawSourceMap;
43
+ type SourceAndMap = import("./Source").SourceAndMap;
44
+ type SourceValue = import("./Source").SourceValue;
45
+ type GeneratedSourceInfo =
46
+ import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo;
47
+ type OnChunk = import("./helpers/streamChunks").OnChunk;
48
+ type OnName = import("./helpers/streamChunks").OnName;
49
+ type OnSource = import("./helpers/streamChunks").OnSource;
50
+ type StreamChunksOptions = import("./helpers/streamChunks").Options;