@umijs/utils 4.0.0-beta.9 → 4.0.0-canary-20240513.3

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 (194) hide show
  1. package/compiled/@ampproject/remapping/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts +70 -0
  2. package/compiled/@ampproject/remapping/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts +12 -0
  3. package/compiled/@ampproject/remapping/@jridgewell/gen-mapping/dist/types/types.d.ts +35 -0
  4. package/compiled/@ampproject/remapping/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +16 -0
  5. package/compiled/@ampproject/remapping/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +74 -0
  6. package/compiled/@ampproject/remapping/@jridgewell/trace-mapping/dist/types/types.d.ts +92 -0
  7. package/compiled/@ampproject/remapping/LICENSE +202 -0
  8. package/compiled/@ampproject/remapping/dist/types/remapping.d.ts +19 -0
  9. package/compiled/@ampproject/remapping/dist/types/source-map.d.ts +17 -0
  10. package/compiled/@ampproject/remapping/dist/types/types.d.ts +14 -0
  11. package/compiled/@ampproject/remapping/index.js +1 -0
  12. package/compiled/@ampproject/remapping/package.json +1 -0
  13. package/compiled/@clack/prompts/LICENSE +23 -0
  14. package/compiled/@clack/prompts/dist/index.d.ts +38 -0
  15. package/compiled/@clack/prompts/index.js +1 -0
  16. package/compiled/@clack/prompts/package.json +1 -0
  17. package/compiled/@hapi/joi/index.d.ts +2218 -0
  18. package/compiled/@hapi/joi/index.js +1 -0
  19. package/compiled/@hapi/joi/package.json +1 -0
  20. package/compiled/axios/index.d.ts +29 -14
  21. package/compiled/axios/index.js +1 -1
  22. package/compiled/chalk/LICENSE +1 -1
  23. package/compiled/chalk/index.js +1 -1
  24. package/compiled/chalk/package.json +1 -1
  25. package/compiled/chalk/source/index.d.ts +318 -0
  26. package/compiled/chalk/source/vendor/supports-color/index.d.ts +55 -0
  27. package/compiled/color/color-convert/conversions.d.ts +87 -87
  28. package/compiled/color/color-convert/index.d.ts +75 -60
  29. package/compiled/color/color-convert/route.d.ts +271 -271
  30. package/compiled/color/index.d.ts +118 -121
  31. package/compiled/color/index.js +1 -1
  32. package/compiled/color/package.json +1 -4
  33. package/compiled/debug/LICENSE +10 -9
  34. package/compiled/debug/index.js +1 -1
  35. package/compiled/debug/package.json +1 -1
  36. package/compiled/execa/index.d.ts +467 -445
  37. package/compiled/execa/index.js +1 -1
  38. package/compiled/fastest-levenshtein/index.js +1 -0
  39. package/compiled/fastest-levenshtein/mod.d.ts +3 -0
  40. package/compiled/fastest-levenshtein/package.json +1 -0
  41. package/compiled/filesize/LICENSE +28 -0
  42. package/compiled/filesize/filesize.d.ts +131 -0
  43. package/compiled/filesize/index.js +8 -0
  44. package/compiled/filesize/package.json +1 -0
  45. package/compiled/filesize/types/filesize.d.ts +46 -0
  46. package/compiled/fs-extra/index.d.ts +930 -253
  47. package/compiled/fs-extra/index.js +1 -1
  48. package/compiled/fs-extra/jsonfile/index.d.ts +78 -0
  49. package/compiled/fs-extra/package.json +1 -1
  50. package/compiled/glob/LICENSE +1 -7
  51. package/compiled/glob/index.d.ts +3 -1
  52. package/compiled/glob/index.js +1 -1
  53. package/compiled/glob/package.json +1 -1
  54. package/compiled/gzip-size/LICENSE +9 -0
  55. package/compiled/gzip-size/index.d.ts +103 -0
  56. package/compiled/gzip-size/index.js +1 -0
  57. package/compiled/gzip-size/package.json +1 -0
  58. package/compiled/lodash/common/array.d.ts +0 -0
  59. package/compiled/lodash/common/collection.d.ts +0 -0
  60. package/compiled/lodash/common/common.d.ts +0 -0
  61. package/compiled/lodash/common/date.d.ts +0 -0
  62. package/compiled/lodash/common/function.d.ts +0 -0
  63. package/compiled/lodash/common/lang.d.ts +0 -0
  64. package/compiled/lodash/common/math.d.ts +0 -0
  65. package/compiled/lodash/common/number.d.ts +0 -0
  66. package/compiled/lodash/common/object.d.ts +0 -0
  67. package/compiled/lodash/common/seq.d.ts +0 -0
  68. package/compiled/lodash/common/string.d.ts +0 -0
  69. package/compiled/lodash/common/util.d.ts +0 -0
  70. package/compiled/magic-string/LICENSE +7 -0
  71. package/compiled/magic-string/index.d.ts +250 -0
  72. package/compiled/magic-string/index.js +1 -0
  73. package/compiled/magic-string/package.json +1 -0
  74. package/compiled/pirates/LICENSE +21 -0
  75. package/compiled/pirates/index.d.ts +82 -0
  76. package/compiled/pirates/index.js +1 -0
  77. package/compiled/pirates/package.json +1 -0
  78. package/compiled/pkg-up/LICENSE +1 -1
  79. package/compiled/pkg-up/index.d.ts +55 -44
  80. package/compiled/pkg-up/index.js +1 -1
  81. package/compiled/pkg-up/package.json +1 -1
  82. package/compiled/portfinder/index.js +1 -1
  83. package/compiled/portfinder/lib/portfinder.d.ts +16 -1
  84. package/compiled/portfinder/package.json +1 -1
  85. package/compiled/resolve/index.js +1 -1
  86. package/compiled/semver/classes/range.d.ts +1 -1
  87. package/compiled/semver/classes/semver.d.ts +1 -1
  88. package/compiled/semver/functions/compare-build.d.ts +6 -1
  89. package/compiled/semver/functions/diff.d.ts +1 -5
  90. package/compiled/semver/functions/satisfies.d.ts +1 -1
  91. package/compiled/semver/index.d.ts +3 -0
  92. package/compiled/semver/index.js +1 -1
  93. package/compiled/semver/package.json +1 -1
  94. package/compiled/semver/ranges/gtr.d.ts +1 -1
  95. package/compiled/semver/ranges/intersects.d.ts +1 -1
  96. package/compiled/semver/ranges/ltr.d.ts +1 -1
  97. package/compiled/semver/ranges/max-satisfying.d.ts +1 -1
  98. package/compiled/semver/ranges/min-satisfying.d.ts +1 -1
  99. package/compiled/semver/ranges/outside.d.ts +1 -1
  100. package/compiled/semver/ranges/subset.d.ts +1 -5
  101. package/compiled/semver/ranges/valid.d.ts +1 -1
  102. package/compiled/strip-ansi/LICENSE +1 -1
  103. package/compiled/strip-ansi/index.d.ts +2 -4
  104. package/compiled/strip-ansi/index.js +1 -1
  105. package/compiled/strip-ansi/package.json +1 -1
  106. package/compiled/tar/LICENSE +15 -0
  107. package/compiled/tar/index.d.ts +943 -0
  108. package/compiled/tar/index.js +1 -0
  109. package/compiled/tar/minipass/index.d.ts +150 -0
  110. package/compiled/tar/package.json +1 -0
  111. package/compiled/tsconfig-paths/LICENSE +21 -0
  112. package/compiled/tsconfig-paths/index.js +1 -0
  113. package/compiled/tsconfig-paths/lib/index.d.ts +5 -0
  114. package/compiled/tsconfig-paths/package.json +1 -0
  115. package/compiled/yargs-parser/index.js +1 -1
  116. package/compiled/yargs-parser/package.json +1 -1
  117. package/compiled/zod/LICENSE +21 -0
  118. package/compiled/zod/index.d.ts +2 -0
  119. package/compiled/zod/index.js +1 -0
  120. package/compiled/zod/lib/ZodError.d.ts +159 -0
  121. package/compiled/zod/lib/__tests__/Mocker.d.ts +17 -0
  122. package/compiled/zod/lib/benchmarks/discriminatedUnion.d.ts +5 -0
  123. package/compiled/zod/lib/benchmarks/index.d.ts +1 -0
  124. package/compiled/zod/lib/benchmarks/object.d.ts +5 -0
  125. package/compiled/zod/lib/benchmarks/primitives.d.ts +5 -0
  126. package/compiled/zod/lib/benchmarks/realworld.d.ts +5 -0
  127. package/compiled/zod/lib/benchmarks/string.d.ts +5 -0
  128. package/compiled/zod/lib/benchmarks/union.d.ts +5 -0
  129. package/compiled/zod/lib/errors.d.ts +5 -0
  130. package/compiled/zod/lib/external.d.ts +6 -0
  131. package/compiled/zod/lib/helpers/enumUtil.d.ts +8 -0
  132. package/compiled/zod/lib/helpers/errorUtil.d.ts +9 -0
  133. package/compiled/zod/lib/helpers/parseUtil.d.ts +78 -0
  134. package/compiled/zod/lib/helpers/partialUtil.d.ts +8 -0
  135. package/compiled/zod/lib/helpers/typeAliases.d.ts +2 -0
  136. package/compiled/zod/lib/helpers/util.d.ts +47 -0
  137. package/compiled/zod/lib/index.d.ts +4 -0
  138. package/compiled/zod/lib/locales/en.d.ts +3 -0
  139. package/compiled/zod/lib/types.d.ts +975 -0
  140. package/compiled/zod/package.json +1 -0
  141. package/dist/BaseGenerator/BaseGenerator.d.ts +3 -3
  142. package/dist/BaseGenerator/BaseGenerator.js +78 -54
  143. package/dist/BaseGenerator/generateFile.d.ts +2 -1
  144. package/dist/BaseGenerator/generateFile.js +49 -22
  145. package/dist/Generator/Generator.d.ts +18 -14
  146. package/dist/Generator/Generator.js +97 -70
  147. package/dist/aliasUtils/getAliasValue.d.ts +4 -0
  148. package/dist/aliasUtils/getAliasValue.js +66 -0
  149. package/dist/aliasUtils/index.d.ts +2 -0
  150. package/dist/aliasUtils/index.js +32 -0
  151. package/dist/aliasUtils/parseCircleAlias.d.ts +4 -0
  152. package/dist/aliasUtils/parseCircleAlias.js +66 -0
  153. package/dist/getCorejsVersion.d.ts +1 -0
  154. package/dist/getCorejsVersion.js +35 -0
  155. package/dist/getDevBanner.d.ts +5 -0
  156. package/dist/getDevBanner.js +81 -0
  157. package/dist/getFileGitIno.d.ts +47 -0
  158. package/dist/getFileGitIno.js +130 -0
  159. package/dist/getGitInfo.d.ts +6 -0
  160. package/dist/getGitInfo.js +50 -0
  161. package/dist/importLazy.js +42 -14
  162. package/dist/index.d.ts +26 -3
  163. package/dist/index.js +185 -86
  164. package/dist/installDeps.js +69 -37
  165. package/dist/isJavaScriptFile.d.ts +1 -0
  166. package/dist/isJavaScriptFile.js +32 -0
  167. package/dist/isLocalDev.d.ts +4 -0
  168. package/dist/isLocalDev.js +36 -0
  169. package/dist/isMonorepo.d.ts +5 -0
  170. package/dist/isMonorepo.js +44 -0
  171. package/dist/isStyleFile.d.ts +5 -0
  172. package/dist/isStyleFile.js +44 -0
  173. package/dist/logger.d.ts +13 -6
  174. package/dist/logger.js +166 -25
  175. package/dist/node.d.ts +4 -0
  176. package/dist/node.js +61 -0
  177. package/dist/npmClient.d.ts +3 -2
  178. package/dist/npmClient.js +86 -40
  179. package/dist/printHelp.d.ts +2 -0
  180. package/dist/printHelp.js +64 -0
  181. package/dist/randomColor/randomColor.js +47 -16
  182. package/dist/readDirFiles.d.ts +9 -0
  183. package/dist/readDirFiles.js +62 -0
  184. package/dist/register.d.ts +1 -0
  185. package/dist/register.js +75 -38
  186. package/dist/setNoDeprecation.d.ts +1 -0
  187. package/dist/setNoDeprecation.js +31 -0
  188. package/dist/tryPaths.d.ts +1 -0
  189. package/dist/tryPaths.js +35 -0
  190. package/dist/updatePackageJSON.js +50 -19
  191. package/dist/winPath.js +33 -9
  192. package/dist/zod/isZodSchema.d.ts +2 -0
  193. package/dist/zod/isZodSchema.js +31 -0
  194. package/package.json +60 -34
@@ -0,0 +1,103 @@
1
+ import {Buffer} from 'node:buffer';
2
+ import {PassThrough as PassThroughStream} from 'node:stream';
3
+ import {ZlibOptions} from 'node:zlib';
4
+
5
+ export type Options = ZlibOptions;
6
+
7
+ export interface GzipSizeStream extends PassThroughStream {
8
+ /**
9
+ Contains the gzip size of the stream after it is finished. Since this happens asynchronously, it is recommended you use the `gzip-size` event instead.
10
+ */
11
+ gzipSize?: number;
12
+
13
+ addListener(event: 'gzip-size', listener: (size: number) => void): this;
14
+ addListener(
15
+ event: string | symbol,
16
+ listener: (...args: any[]) => void
17
+ ): this;
18
+ on(event: 'gzip-size', listener: (size: number) => void): this;
19
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
20
+ once(event: 'gzip-size', listener: (size: number) => void): this;
21
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
22
+ removeListener(event: 'gzip-size', listener: (size: number) => void): this;
23
+ removeListener(
24
+ event: string | symbol,
25
+ listener: (...args: any[]) => void
26
+ ): this;
27
+ off(event: 'gzip-size', listener: (size: number) => void): this;
28
+ off(event: string | symbol, listener: (...args: any[]) => void): this;
29
+ emit(event: 'gzip-size', size: number): boolean;
30
+ emit(event: string | symbol, ...args: any[]): boolean;
31
+ prependListener(event: 'gzip-size', listener: (size: number) => void): this;
32
+ prependListener(
33
+ event: string | symbol,
34
+ listener: (...args: any[]) => void
35
+ ): this;
36
+ prependOnceListener(
37
+ event: 'gzip-size',
38
+ listener: (size: number) => void
39
+ ): this;
40
+ prependOnceListener(
41
+ event: string | symbol,
42
+ listener: (...args: any[]) => void
43
+ ): this;
44
+ }
45
+
46
+ /**
47
+ Get the gzipped size of a string or buffer.
48
+
49
+ @returns The gzipped size of `input`.
50
+
51
+ @example
52
+ ```
53
+ import {gzipSize} from './gzip-size';
54
+
55
+ const text = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.';
56
+
57
+ console.log(text.length);
58
+ //=> 191
59
+
60
+ console.log(await gzipSize(text));
61
+ //=> 78
62
+ ```
63
+ */
64
+ export function gzipSize(input: string | Buffer, options?: Options): Promise<number>;
65
+
66
+ /**
67
+ Synchronously get the gzipped size of a string or buffer.
68
+
69
+ @returns The gzipped size of `input`.
70
+
71
+ @example
72
+ ```
73
+ import {gzipSizeSync} from './gzip-size';
74
+
75
+ const text = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.';
76
+
77
+ console.log(text.length);
78
+ //=> 191
79
+
80
+ console.log(gzipSizeSync(text));
81
+ //=> 78
82
+ ```
83
+ */
84
+ export function gzipSizeSync(input: string | Buffer, options?: Options): number;
85
+
86
+ /**
87
+ Get the gzipped size of a file.
88
+
89
+ @returns The size of the file.
90
+ */
91
+ export function gzipSizeFromFile(filePath: string, options?: Options): Promise<number>;
92
+
93
+ /**
94
+ Synchronously get the gzipped size of a file.
95
+
96
+ @returns The size of the file.
97
+ */
98
+ export function gzipSizeFromFileSync(filePath: string, options?: Options): number;
99
+
100
+ /**
101
+ @returns A stream that emits a `gzip-size` event and has a `gzipSize` property.
102
+ */
103
+ export function gzipSizeStream(options?: Options): GzipSizeStream;
@@ -0,0 +1 @@
1
+ (function(){var e={325:function(e,r,n){var i=n(781);var t=["write","end","destroy"];var o=["resume","pause"];var a=["data","close"];var u=Array.prototype.slice;e.exports=duplex;function forEach(e,r){if(e.forEach){return e.forEach(r)}for(var n=0;n<e.length;n++){r(e[n],n)}}function duplex(e,r){var n=new i;var c=false;forEach(t,proxyWriter);forEach(o,proxyReader);forEach(a,proxyStream);r.on("end",handleEnd);e.on("drain",(function(){n.emit("drain")}));e.on("error",reemit);r.on("error",reemit);n.writable=e.writable;n.readable=r.readable;return n;function proxyWriter(r){n[r]=method;function method(){return e[r].apply(e,arguments)}}function proxyReader(e){n[e]=method;function method(){n.emit(e);var i=r[e];if(i){return i.apply(r,arguments)}r.emit(e)}}function proxyStream(e){r.on(e,reemit);function reemit(){var r=u.call(arguments);r.unshift(e);n.emit.apply(n,r)}}function handleEnd(){if(c){return}c=true;var e=u.call(arguments);e.unshift("end");n.emit.apply(n,e)}function reemit(e){n.emit("error",e)}}},781:function(e){"use strict";e.exports=require("stream")}};var r={};function __nccwpck_require__(n){var i=r[n];if(i!==undefined){return i.exports}var t=r[n]={exports:{}};var o=true;try{e[n](t,t.exports,__nccwpck_require__);o=false}finally{if(o)delete r[n]}return t.exports}!function(){__nccwpck_require__.d=function(e,r){for(var n in r){if(__nccwpck_require__.o(r,n)&&!__nccwpck_require__.o(e,n)){Object.defineProperty(e,n,{enumerable:true,get:r[n]})}}}}();!function(){__nccwpck_require__.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)}}();!function(){__nccwpck_require__.r=function(e){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}}();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n={};!function(){"use strict";__nccwpck_require__.r(n);__nccwpck_require__.d(n,{gzipSize:function(){return gzipSize},gzipSizeFromFile:function(){return gzipSizeFromFile},gzipSizeFromFileSync:function(){return gzipSizeFromFileSync},gzipSizeStream:function(){return gzipSizeStream},gzipSizeSync:function(){return gzipSizeSync}});var e=require("fs");var r=require("stream");var i=require("zlib");var t=require("util");var o=__nccwpck_require__(325);const getOptions=e=>({level:9,...e});const a=(0,t.promisify)(i.gzip);async function gzipSize(e,r){if(!e){return 0}const n=await a(e,getOptions(r));return n.length}function gzipSizeSync(e,r){return i.gzipSync(e,getOptions(r)).length}function gzipSizeFromFile(r,n){return new Promise(((i,t)=>{const o=e.createReadStream(r);o.on("error",t);const a=o.pipe(gzipSizeStream(n));a.on("error",t);a.on("gzip-size",i)}))}function gzipSizeFromFileSync(r,n){return gzipSizeSync(e.readFileSync(r),n)}function gzipSizeStream(e){const n=new r.PassThrough;const t=new r.PassThrough;const a=o(n,t);let u=0;const c=i.createGzip(getOptions(e)).on("data",(e=>{u+=e.length})).on("error",(()=>{a.gzipSize=0})).on("end",(()=>{a.gzipSize=u;a.emit("gzip-size",u);t.end()}));n.pipe(c);n.pipe(t,{end:false});return a}}();module.exports=n})();
@@ -0,0 +1 @@
1
+ {"name":"gzip-size","version":"7.0.0","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ Copyright 2018 Rich Harris
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,250 @@
1
+ export interface BundleOptions {
2
+ intro?: string;
3
+ separator?: string;
4
+ }
5
+
6
+ export interface SourceMapOptions {
7
+ /**
8
+ * Whether the mapping should be high-resolution.
9
+ * Hi-res mappings map every single character, meaning (for example) your devtools will always
10
+ * be able to pinpoint the exact location of function calls and so on.
11
+ * With lo-res mappings, devtools may only be able to identify the correct
12
+ * line - but they're quicker to generate and less bulky.
13
+ * If sourcemap locations have been specified with s.addSourceMapLocation(), they will be used here.
14
+ */
15
+ hires?: boolean;
16
+ /**
17
+ * The filename where you plan to write the sourcemap.
18
+ */
19
+ file?: string;
20
+ /**
21
+ * The filename of the file containing the original source.
22
+ */
23
+ source?: string;
24
+ /**
25
+ * Whether to include the original content in the map's sourcesContent array.
26
+ */
27
+ includeContent?: boolean;
28
+ }
29
+
30
+ export type SourceMapSegment =
31
+ | [number]
32
+ | [number, number, number, number]
33
+ | [number, number, number, number, number];
34
+
35
+ export interface DecodedSourceMap {
36
+ file: string;
37
+ sources: string[];
38
+ sourcesContent: string[];
39
+ names: string[];
40
+ mappings: SourceMapSegment[][];
41
+ }
42
+
43
+ export class SourceMap {
44
+ constructor(properties: DecodedSourceMap);
45
+
46
+ version: number;
47
+ file: string;
48
+ sources: string[];
49
+ sourcesContent: string[];
50
+ names: string[];
51
+ mappings: string;
52
+
53
+ /**
54
+ * Returns the equivalent of `JSON.stringify(map)`
55
+ */
56
+ toString(): string;
57
+ /**
58
+ * Returns a DataURI containing the sourcemap. Useful for doing this sort of thing:
59
+ * `generateMap(options?: SourceMapOptions): SourceMap;`
60
+ */
61
+ toUrl(): string;
62
+ }
63
+
64
+ export class Bundle {
65
+ constructor(options?: BundleOptions);
66
+ addSource(source: MagicString | { filename?: string, content: MagicString }): Bundle;
67
+ append(str: string, options?: BundleOptions): Bundle;
68
+ clone(): Bundle;
69
+ generateMap(options?: SourceMapOptions): SourceMap;
70
+ generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap;
71
+ getIndentString(): string;
72
+ indent(indentStr?: string): Bundle;
73
+ indentExclusionRanges: ExclusionRange | Array<ExclusionRange>;
74
+ prepend(str: string): Bundle;
75
+ toString(): string;
76
+ trimLines(): Bundle;
77
+ trim(charType?: string): Bundle;
78
+ trimStart(charType?: string): Bundle;
79
+ trimEnd(charType?: string): Bundle;
80
+ isEmpty(): boolean;
81
+ length(): number;
82
+ }
83
+
84
+ export type ExclusionRange = [ number, number ];
85
+
86
+ export interface MagicStringOptions {
87
+ filename?: string,
88
+ indentExclusionRanges?: ExclusionRange | Array<ExclusionRange>;
89
+ }
90
+
91
+ export interface IndentOptions {
92
+ exclude?: ExclusionRange | Array<ExclusionRange>;
93
+ indentStart?: boolean;
94
+ }
95
+
96
+ export interface OverwriteOptions {
97
+ storeName?: boolean;
98
+ contentOnly?: boolean;
99
+ }
100
+
101
+ export interface UpdateOptions {
102
+ storeName?: boolean;
103
+ overwrite?: boolean;
104
+ }
105
+
106
+ export default class MagicString {
107
+ constructor(str: string, options?: MagicStringOptions);
108
+ /**
109
+ * Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is false.
110
+ */
111
+ addSourcemapLocation(char: number): void;
112
+ /**
113
+ * Appends the specified content to the end of the string.
114
+ */
115
+ append(content: string): MagicString;
116
+ /**
117
+ * Appends the specified content at the index in the original string.
118
+ * If a range *ending* with index is subsequently moved, the insert will be moved with it.
119
+ * See also `s.prependLeft(...)`.
120
+ */
121
+ appendLeft(index: number, content: string): MagicString;
122
+ /**
123
+ * Appends the specified content at the index in the original string.
124
+ * If a range *starting* with index is subsequently moved, the insert will be moved with it.
125
+ * See also `s.prependRight(...)`.
126
+ */
127
+ appendRight(index: number, content: string): MagicString;
128
+ /**
129
+ * Does what you'd expect.
130
+ */
131
+ clone(): MagicString;
132
+ /**
133
+ * Generates a version 3 sourcemap.
134
+ */
135
+ generateMap(options?: SourceMapOptions): SourceMap;
136
+ /**
137
+ * Generates a sourcemap object with raw mappings in array form, rather than encoded as a string.
138
+ * Useful if you need to manipulate the sourcemap further, but most of the time you will use `generateMap` instead.
139
+ */
140
+ generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap;
141
+ getIndentString(): string;
142
+
143
+ /**
144
+ * Prefixes each line of the string with prefix.
145
+ * If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character.
146
+ */
147
+ indent(options?: IndentOptions): MagicString;
148
+ /**
149
+ * Prefixes each line of the string with prefix.
150
+ * If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character.
151
+ *
152
+ * The options argument can have an exclude property, which is an array of [start, end] character ranges.
153
+ * These ranges will be excluded from the indentation - useful for (e.g.) multiline strings.
154
+ */
155
+ indent(indentStr?: string, options?: IndentOptions): MagicString;
156
+ indentExclusionRanges: ExclusionRange | Array<ExclusionRange>;
157
+
158
+ /**
159
+ * Moves the characters from `start and `end` to `index`.
160
+ */
161
+ move(start: number, end: number, index: number): MagicString;
162
+ /**
163
+ * Replaces the characters from `start` to `end` with `content`, along with the appended/prepended content in
164
+ * that range. The same restrictions as `s.remove()` apply.
165
+ *
166
+ * The fourth argument is optional. It can have a storeName property — if true, the original name will be stored
167
+ * for later inclusion in a sourcemap's names array — and a contentOnly property which determines whether only
168
+ * the content is overwritten, or anything that was appended/prepended to the range as well.
169
+ *
170
+ * It may be preferred to use `s.update(...)` instead if you wish to avoid overwriting the appended/prepended content.
171
+ */
172
+ overwrite(start: number, end: number, content: string, options?: boolean | OverwriteOptions): MagicString;
173
+ /**
174
+ * Replaces the characters from `start` to `end` with `content`. The same restrictions as `s.remove()` apply.
175
+ *
176
+ * The fourth argument is optional. It can have a storeName property — if true, the original name will be stored
177
+ * for later inclusion in a sourcemap's names array — and an overwrite property which determines whether only
178
+ * the content is overwritten, or anything that was appended/prepended to the range as well.
179
+ */
180
+ update(start: number, end: number, content: string, options?: boolean | UpdateOptions): MagicString;
181
+ /**
182
+ * Prepends the string with the specified content.
183
+ */
184
+ prepend(content: string): MagicString;
185
+ /**
186
+ * Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index
187
+ */
188
+ prependLeft(index: number, content: string): MagicString;
189
+ /**
190
+ * Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index`
191
+ */
192
+ prependRight(index: number, content: string): MagicString;
193
+ /**
194
+ * Removes the characters from `start` to `end` (of the original string, **not** the generated string).
195
+ * Removing the same content twice, or making removals that partially overlap, will cause an error.
196
+ */
197
+ remove(start: number, end: number): MagicString;
198
+ /**
199
+ * Returns the content of the generated string that corresponds to the slice between `start` and `end` of the original string.
200
+ * Throws error if the indices are for characters that were already removed.
201
+ */
202
+ slice(start: number, end: number): string;
203
+ /**
204
+ * Returns a clone of `s`, with all content before the `start` and `end` characters of the original string removed.
205
+ */
206
+ snip(start: number, end: number): MagicString;
207
+ /**
208
+ * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start and end.
209
+ */
210
+ trim(charType?: string): MagicString;
211
+ /**
212
+ * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start.
213
+ */
214
+ trimStart(charType?: string): MagicString;
215
+ /**
216
+ * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the end.
217
+ */
218
+ trimEnd(charType?: string): MagicString;
219
+ /**
220
+ * Removes empty lines from the start and end.
221
+ */
222
+ trimLines(): MagicString;
223
+ /**
224
+ * String replacement with RegExp or string.
225
+ */
226
+ replace(regex: RegExp | string, replacement: string | ((substring: string, ...args: any[]) => string)): MagicString;
227
+ /**
228
+ * Same as `s.replace`, but replace all matched strings instead of just one.
229
+ */
230
+ replaceAll(regex: RegExp | string, replacement: string | ((substring: string, ...args: any[]) => string)): MagicString;
231
+
232
+ lastChar(): string;
233
+ lastLine(): string;
234
+ /**
235
+ * Returns true if the resulting source is empty (disregarding white space).
236
+ */
237
+ isEmpty(): boolean;
238
+ length(): number;
239
+
240
+ /**
241
+ * Indicates if the string has been changed.
242
+ */
243
+ hasChanged(): boolean;
244
+
245
+ original: string;
246
+ /**
247
+ * Returns the generated string.
248
+ */
249
+ toString(): string;
250
+ }
@@ -0,0 +1 @@
1
+ (function(){var t={961:function(t,e){(function(t,n){true?n(e):0})(this,(function(t){"use strict";const e=",".charCodeAt(0);const n=";".charCodeAt(0);const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";const r=new Uint8Array(64);const s=new Uint8Array(128);for(let t=0;t<i.length;t++){const e=i.charCodeAt(t);r[t]=e;s[e]=t}const o=typeof TextDecoder!=="undefined"?new TextDecoder:typeof Buffer!=="undefined"?{decode(t){const e=Buffer.from(t.buffer,t.byteOffset,t.byteLength);return e.toString()}}:{decode(t){let e="";for(let n=0;n<t.length;n++){e+=String.fromCharCode(t[n])}return e}};function decode(t){const e=new Int32Array(5);const n=[];let i=0;do{const r=indexOf(t,i);const s=[];let o=true;let h=0;e[0]=0;for(let n=i;n<r;n++){let i;n=decodeInteger(t,n,e,0);const a=e[0];if(a<h)o=false;h=a;if(hasMoreVlq(t,n,r)){n=decodeInteger(t,n,e,1);n=decodeInteger(t,n,e,2);n=decodeInteger(t,n,e,3);if(hasMoreVlq(t,n,r)){n=decodeInteger(t,n,e,4);i=[a,e[1],e[2],e[3],e[4]]}else{i=[a,e[1],e[2],e[3]]}}else{i=[a]}s.push(i)}if(!o)sort(s);n.push(s);i=r+1}while(i<=t.length);return n}function indexOf(t,e){const n=t.indexOf(";",e);return n===-1?t.length:n}function decodeInteger(t,e,n,i){let r=0;let o=0;let h=0;do{const n=t.charCodeAt(e++);h=s[n];r|=(h&31)<<o;o+=5}while(h&32);const a=r&1;r>>>=1;if(a){r=-2147483648|-r}n[i]+=r;return e}function hasMoreVlq(t,n,i){if(n>=i)return false;return t.charCodeAt(n)!==e}function sort(t){t.sort(sortComparator)}function sortComparator(t,e){return t[0]-e[0]}function encode(t){const i=new Int32Array(5);const r=1024*16;const s=r-36;const h=new Uint8Array(r);const a=h.subarray(0,s);let l=0;let u="";for(let c=0;c<t.length;c++){const d=t[c];if(c>0){if(l===r){u+=o.decode(h);l=0}h[l++]=n}if(d.length===0)continue;i[0]=0;for(let t=0;t<d.length;t++){const n=d[t];if(l>s){u+=o.decode(a);h.copyWithin(0,s,l);l-=s}if(t>0)h[l++]=e;l=encodeInteger(h,l,i,n,0);if(n.length===1)continue;l=encodeInteger(h,l,i,n,1);l=encodeInteger(h,l,i,n,2);l=encodeInteger(h,l,i,n,3);if(n.length===4)continue;l=encodeInteger(h,l,i,n,4)}}return u+o.decode(h.subarray(0,l))}function encodeInteger(t,e,n,i,s){const o=i[s];let h=o-n[s];n[s]=o;h=h<0?-h<<1|1:h<<1;do{let n=h&31;h>>>=5;if(h>0)n|=32;t[e++]=r[n]}while(h>0);return e}t.decode=decode;t.encode=encode;Object.defineProperty(t,"__esModule",{value:true})}))},712:function(t,e,n){"use strict";var i=n(961);class BitSet{constructor(t){this.bits=t instanceof BitSet?t.bits.slice():[]}add(t){this.bits[t>>5]|=1<<(t&31)}has(t){return!!(this.bits[t>>5]&1<<(t&31))}}class Chunk{constructor(t,e,n){this.start=t;this.end=e;this.original=n;this.intro="";this.outro="";this.content=n;this.storeName=false;this.edited=false;{this.previous=null;this.next=null}}appendLeft(t){this.outro+=t}appendRight(t){this.intro=this.intro+t}clone(){const t=new Chunk(this.start,this.end,this.original);t.intro=this.intro;t.outro=this.outro;t.content=this.content;t.storeName=this.storeName;t.edited=this.edited;return t}contains(t){return this.start<t&&t<this.end}eachNext(t){let e=this;while(e){t(e);e=e.next}}eachPrevious(t){let e=this;while(e){t(e);e=e.previous}}edit(t,e,n){this.content=t;if(!n){this.intro="";this.outro=""}this.storeName=e;this.edited=true;return this}prependLeft(t){this.outro=t+this.outro}prependRight(t){this.intro=t+this.intro}split(t){const e=t-this.start;const n=this.original.slice(0,e);const i=this.original.slice(e);this.original=n;const r=new Chunk(t,this.end,i);r.outro=this.outro;this.outro="";this.end=t;if(this.edited){r.edit("",false);this.content=""}else{this.content=n}r.next=this.next;if(r.next)r.next.previous=r;r.previous=this;this.next=r;return r}toString(){return this.intro+this.content+this.outro}trimEnd(t){this.outro=this.outro.replace(t,"");if(this.outro.length)return true;const e=this.content.replace(t,"");if(e.length){if(e!==this.content){this.split(this.start+e.length).edit("",undefined,true)}return true}else{this.edit("",undefined,true);this.intro=this.intro.replace(t,"");if(this.intro.length)return true}}trimStart(t){this.intro=this.intro.replace(t,"");if(this.intro.length)return true;const e=this.content.replace(t,"");if(e.length){if(e!==this.content){this.split(this.end-e.length);this.edit("",undefined,true)}return true}else{this.edit("",undefined,true);this.outro=this.outro.replace(t,"");if(this.outro.length)return true}}}function getBtoa(){if(typeof window!=="undefined"&&typeof window.btoa==="function"){return t=>window.btoa(unescape(encodeURIComponent(t)))}else if(typeof Buffer==="function"){return t=>Buffer.from(t,"utf-8").toString("base64")}else{return()=>{throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}}const r=getBtoa();class SourceMap{constructor(t){this.version=3;this.file=t.file;this.sources=t.sources;this.sourcesContent=t.sourcesContent;this.names=t.names;this.mappings=i.encode(t.mappings)}toString(){return JSON.stringify(this)}toUrl(){return"data:application/json;charset=utf-8;base64,"+r(this.toString())}}function guessIndent(t){const e=t.split("\n");const n=e.filter((t=>/^\t+/.test(t)));const i=e.filter((t=>/^ {2,}/.test(t)));if(n.length===0&&i.length===0){return null}if(n.length>=i.length){return"\t"}const r=i.reduce(((t,e)=>{const n=/^ +/.exec(e)[0].length;return Math.min(n,t)}),Infinity);return new Array(r+1).join(" ")}function getRelativePath(t,e){const n=t.split(/[/\\]/);const i=e.split(/[/\\]/);n.pop();while(n[0]===i[0]){n.shift();i.shift()}if(n.length){let t=n.length;while(t--)n[t]=".."}return n.concat(i).join("/")}const s=Object.prototype.toString;function isObject(t){return s.call(t)==="[object Object]"}function getLocator(t){const e=t.split("\n");const n=[];for(let t=0,i=0;t<e.length;t++){n.push(i);i+=e[t].length+1}return function locate(t){let e=0;let i=n.length;while(e<i){const r=e+i>>1;if(t<n[r]){i=r}else{e=r+1}}const r=e-1;const s=t-n[r];return{line:r,column:s}}}class Mappings{constructor(t){this.hires=t;this.generatedCodeLine=0;this.generatedCodeColumn=0;this.raw=[];this.rawSegments=this.raw[this.generatedCodeLine]=[];this.pending=null}addEdit(t,e,n,i){if(e.length){const e=[this.generatedCodeColumn,t,n.line,n.column];if(i>=0){e.push(i)}this.rawSegments.push(e)}else if(this.pending){this.rawSegments.push(this.pending)}this.advance(e);this.pending=null}addUneditedChunk(t,e,n,i,r){let s=e.start;let o=true;while(s<e.end){if(this.hires||o||r.has(s)){this.rawSegments.push([this.generatedCodeColumn,t,i.line,i.column])}if(n[s]==="\n"){i.line+=1;i.column=0;this.generatedCodeLine+=1;this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0;o=true}else{i.column+=1;this.generatedCodeColumn+=1;o=false}s+=1}this.pending=null}advance(t){if(!t)return;const e=t.split("\n");if(e.length>1){for(let t=0;t<e.length-1;t++){this.generatedCodeLine++;this.raw[this.generatedCodeLine]=this.rawSegments=[]}this.generatedCodeColumn=0}this.generatedCodeColumn+=e[e.length-1].length}}const o="\n";const h={insertLeft:false,insertRight:false,storeName:false};class MagicString{constructor(t,e={}){const n=new Chunk(0,t.length,t);Object.defineProperties(this,{original:{writable:true,value:t},outro:{writable:true,value:""},intro:{writable:true,value:""},firstChunk:{writable:true,value:n},lastChunk:{writable:true,value:n},lastSearchedChunk:{writable:true,value:n},byStart:{writable:true,value:{}},byEnd:{writable:true,value:{}},filename:{writable:true,value:e.filename},indentExclusionRanges:{writable:true,value:e.indentExclusionRanges},sourcemapLocations:{writable:true,value:new BitSet},storedNames:{writable:true,value:{}},indentStr:{writable:true,value:undefined}});this.byStart[0]=n;this.byEnd[t.length]=n}addSourcemapLocation(t){this.sourcemapLocations.add(t)}append(t){if(typeof t!=="string")throw new TypeError("outro content must be a string");this.outro+=t;return this}appendLeft(t,e){if(typeof e!=="string")throw new TypeError("inserted content must be a string");this._split(t);const n=this.byEnd[t];if(n){n.appendLeft(e)}else{this.intro+=e}return this}appendRight(t,e){if(typeof e!=="string")throw new TypeError("inserted content must be a string");this._split(t);const n=this.byStart[t];if(n){n.appendRight(e)}else{this.outro+=e}return this}clone(){const t=new MagicString(this.original,{filename:this.filename});let e=this.firstChunk;let n=t.firstChunk=t.lastSearchedChunk=e.clone();while(e){t.byStart[n.start]=n;t.byEnd[n.end]=n;const i=e.next;const r=i&&i.clone();if(r){n.next=r;r.previous=n;n=r}e=i}t.lastChunk=n;if(this.indentExclusionRanges){t.indentExclusionRanges=this.indentExclusionRanges.slice()}t.sourcemapLocations=new BitSet(this.sourcemapLocations);t.intro=this.intro;t.outro=this.outro;return t}generateDecodedMap(t){t=t||{};const e=0;const n=Object.keys(this.storedNames);const i=new Mappings(t.hires);const r=getLocator(this.original);if(this.intro){i.advance(this.intro)}this.firstChunk.eachNext((t=>{const s=r(t.start);if(t.intro.length)i.advance(t.intro);if(t.edited){i.addEdit(e,t.content,s,t.storeName?n.indexOf(t.original):-1)}else{i.addUneditedChunk(e,t,this.original,s,this.sourcemapLocations)}if(t.outro.length)i.advance(t.outro)}));return{file:t.file?t.file.split(/[/\\]/).pop():null,sources:[t.source?getRelativePath(t.file||"",t.source):null],sourcesContent:t.includeContent?[this.original]:[null],names:n,mappings:i.raw}}generateMap(t){return new SourceMap(this.generateDecodedMap(t))}_ensureindentStr(){if(this.indentStr===undefined){this.indentStr=guessIndent(this.original)}}_getRawIndentString(){this._ensureindentStr();return this.indentStr}getIndentString(){this._ensureindentStr();return this.indentStr===null?"\t":this.indentStr}indent(t,e){const n=/^[^\r\n]/gm;if(isObject(t)){e=t;t=undefined}if(t===undefined){this._ensureindentStr();t=this.indentStr||"\t"}if(t==="")return this;e=e||{};const i={};if(e.exclude){const t=typeof e.exclude[0]==="number"?[e.exclude]:e.exclude;t.forEach((t=>{for(let e=t[0];e<t[1];e+=1){i[e]=true}}))}let r=e.indentStart!==false;const replacer=e=>{if(r)return`${t}${e}`;r=true;return e};this.intro=this.intro.replace(n,replacer);let s=0;let o=this.firstChunk;while(o){const e=o.end;if(o.edited){if(!i[s]){o.content=o.content.replace(n,replacer);if(o.content.length){r=o.content[o.content.length-1]==="\n"}}}else{s=o.start;while(s<e){if(!i[s]){const e=this.original[s];if(e==="\n"){r=true}else if(e!=="\r"&&r){r=false;if(s===o.start){o.prependRight(t)}else{this._splitChunk(o,s);o=o.next;o.prependRight(t)}}}s+=1}}s=o.end;o=o.next}this.outro=this.outro.replace(n,replacer);return this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(t,e){if(!h.insertLeft){console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead");h.insertLeft=true}return this.appendLeft(t,e)}insertRight(t,e){if(!h.insertRight){console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead");h.insertRight=true}return this.prependRight(t,e)}move(t,e,n){if(n>=t&&n<=e)throw new Error("Cannot move a selection inside itself");this._split(t);this._split(e);this._split(n);const i=this.byStart[t];const r=this.byEnd[e];const s=i.previous;const o=r.next;const h=this.byStart[n];if(!h&&r===this.lastChunk)return this;const a=h?h.previous:this.lastChunk;if(s)s.next=o;if(o)o.previous=s;if(a)a.next=i;if(h)h.previous=r;if(!i.previous)this.firstChunk=r.next;if(!r.next){this.lastChunk=i.previous;this.lastChunk.next=null}i.previous=a;r.next=h||null;if(!a)this.firstChunk=i;if(!h)this.lastChunk=r;return this}overwrite(t,e,n,i){i=i||{};return this.update(t,e,n,{...i,overwrite:!i.contentOnly})}update(t,e,n,i){if(typeof n!=="string")throw new TypeError("replacement content must be a string");while(t<0)t+=this.original.length;while(e<0)e+=this.original.length;if(e>this.original.length)throw new Error("end is out of bounds");if(t===e)throw new Error("Cannot overwrite a zero-length range – use appendLeft or prependRight instead");this._split(t);this._split(e);if(i===true){if(!h.storeName){console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string");h.storeName=true}i={storeName:true}}const r=i!==undefined?i.storeName:false;const s=i!==undefined?i.overwrite:false;if(r){const n=this.original.slice(t,e);Object.defineProperty(this.storedNames,n,{writable:true,value:true,enumerable:true})}const o=this.byStart[t];const a=this.byEnd[e];if(o){let t=o;while(t!==a){if(t.next!==this.byStart[t.end]){throw new Error("Cannot overwrite across a split point")}t=t.next;t.edit("",false)}o.edit(n,r,!s)}else{const i=new Chunk(t,e,"").edit(n,r);a.next=i;i.previous=a}return this}prepend(t){if(typeof t!=="string")throw new TypeError("outro content must be a string");this.intro=t+this.intro;return this}prependLeft(t,e){if(typeof e!=="string")throw new TypeError("inserted content must be a string");this._split(t);const n=this.byEnd[t];if(n){n.prependLeft(e)}else{this.intro=e+this.intro}return this}prependRight(t,e){if(typeof e!=="string")throw new TypeError("inserted content must be a string");this._split(t);const n=this.byStart[t];if(n){n.prependRight(e)}else{this.outro=e+this.outro}return this}remove(t,e){while(t<0)t+=this.original.length;while(e<0)e+=this.original.length;if(t===e)return this;if(t<0||e>this.original.length)throw new Error("Character is out of bounds");if(t>e)throw new Error("end must be greater than start");this._split(t);this._split(e);let n=this.byStart[t];while(n){n.intro="";n.outro="";n.edit("");n=e>n.end?this.byStart[n.end]:null}return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let t=this.lastChunk;do{if(t.outro.length)return t.outro[t.outro.length-1];if(t.content.length)return t.content[t.content.length-1];if(t.intro.length)return t.intro[t.intro.length-1]}while(t=t.previous);if(this.intro.length)return this.intro[this.intro.length-1];return""}lastLine(){let t=this.outro.lastIndexOf(o);if(t!==-1)return this.outro.substr(t+1);let e=this.outro;let n=this.lastChunk;do{if(n.outro.length>0){t=n.outro.lastIndexOf(o);if(t!==-1)return n.outro.substr(t+1)+e;e=n.outro+e}if(n.content.length>0){t=n.content.lastIndexOf(o);if(t!==-1)return n.content.substr(t+1)+e;e=n.content+e}if(n.intro.length>0){t=n.intro.lastIndexOf(o);if(t!==-1)return n.intro.substr(t+1)+e;e=n.intro+e}}while(n=n.previous);t=this.intro.lastIndexOf(o);if(t!==-1)return this.intro.substr(t+1)+e;return this.intro+e}slice(t=0,e=this.original.length){while(t<0)t+=this.original.length;while(e<0)e+=this.original.length;let n="";let i=this.firstChunk;while(i&&(i.start>t||i.end<=t)){if(i.start<e&&i.end>=e){return n}i=i.next}if(i&&i.edited&&i.start!==t)throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);const r=i;while(i){if(i.intro&&(r!==i||i.start===t)){n+=i.intro}const s=i.start<e&&i.end>=e;if(s&&i.edited&&i.end!==e)throw new Error(`Cannot use replaced character ${e} as slice end anchor.`);const o=r===i?t-i.start:0;const h=s?i.content.length+e-i.end:i.content.length;n+=i.content.slice(o,h);if(i.outro&&(!s||i.end===e)){n+=i.outro}if(s){break}i=i.next}return n}snip(t,e){const n=this.clone();n.remove(0,t);n.remove(e,n.original.length);return n}_split(t){if(this.byStart[t]||this.byEnd[t])return;let e=this.lastSearchedChunk;const n=t>e.end;while(e){if(e.contains(t))return this._splitChunk(e,t);e=n?this.byStart[e.end]:this.byEnd[e.start]}}_splitChunk(t,e){if(t.edited&&t.content.length){const n=getLocator(this.original)(e);throw new Error(`Cannot split a chunk that has already been edited (${n.line}:${n.column} – "${t.original}")`)}const n=t.split(e);this.byEnd[e]=t;this.byStart[e]=n;this.byEnd[n.end]=n;if(t===this.lastChunk)this.lastChunk=n;this.lastSearchedChunk=t;return true}toString(){let t=this.intro;let e=this.firstChunk;while(e){t+=e.toString();e=e.next}return t+this.outro}isEmpty(){let t=this.firstChunk;do{if(t.intro.length&&t.intro.trim()||t.content.length&&t.content.trim()||t.outro.length&&t.outro.trim())return false}while(t=t.next);return true}length(){let t=this.firstChunk;let e=0;do{e+=t.intro.length+t.content.length+t.outro.length}while(t=t.next);return e}trimLines(){return this.trim("[\\r\\n]")}trim(t){return this.trimStart(t).trimEnd(t)}trimEndAborted(t){const e=new RegExp((t||"\\s")+"+$");this.outro=this.outro.replace(e,"");if(this.outro.length)return true;let n=this.lastChunk;do{const t=n.end;const i=n.trimEnd(e);if(n.end!==t){if(this.lastChunk===n){this.lastChunk=n.next}this.byEnd[n.end]=n;this.byStart[n.next.start]=n.next;this.byEnd[n.next.end]=n.next}if(i)return true;n=n.previous}while(n);return false}trimEnd(t){this.trimEndAborted(t);return this}trimStartAborted(t){const e=new RegExp("^"+(t||"\\s")+"+");this.intro=this.intro.replace(e,"");if(this.intro.length)return true;let n=this.firstChunk;do{const t=n.end;const i=n.trimStart(e);if(n.end!==t){if(n===this.lastChunk)this.lastChunk=n.next;this.byEnd[n.end]=n;this.byStart[n.next.start]=n.next;this.byEnd[n.next.end]=n.next}if(i)return true;n=n.next}while(n);return false}trimStart(t){this.trimStartAborted(t);return this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(t,e){function getReplacement(t,n){if(typeof e==="string"){return e.replace(/\$(\$|&|\d+)/g,((e,n)=>{if(n==="$")return"$";if(n==="&")return t[0];const i=+n;if(i<t.length)return t[+n];return`$${n}`}))}else{return e(...t,t.index,n,t.groups)}}function matchAll(t,e){let n;const i=[];while(n=t.exec(e)){i.push(n)}return i}if(t.global){const e=matchAll(t,this.original);e.forEach((t=>{if(t.index!=null)this.overwrite(t.index,t.index+t[0].length,getReplacement(t,this.original))}))}else{const e=this.original.match(t);if(e&&e.index!=null)this.overwrite(e.index,e.index+e[0].length,getReplacement(e,this.original))}return this}_replaceString(t,e){const{original:n}=this;const i=n.indexOf(t);if(i!==-1){this.overwrite(i,i+t.length,e)}return this}replace(t,e){if(typeof t==="string"){return this._replaceString(t,e)}return this._replaceRegexp(t,e)}_replaceAllString(t,e){const{original:n}=this;const i=t.length;for(let r=n.indexOf(t);r!==-1;r=n.indexOf(t,r+i)){this.overwrite(r,r+i,e)}return this}replaceAll(t,e){if(typeof t==="string"){return this._replaceAllString(t,e)}if(!t.global){throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument")}return this._replaceRegexp(t,e)}}const a=Object.prototype.hasOwnProperty;class Bundle{constructor(t={}){this.intro=t.intro||"";this.separator=t.separator!==undefined?t.separator:"\n";this.sources=[];this.uniqueSources=[];this.uniqueSourceIndexByFilename={}}addSource(t){if(t instanceof MagicString){return this.addSource({content:t,filename:t.filename,separator:this.separator})}if(!isObject(t)||!t.content){throw new Error("bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`")}["filename","indentExclusionRanges","separator"].forEach((e=>{if(!a.call(t,e))t[e]=t.content[e]}));if(t.separator===undefined){t.separator=this.separator}if(t.filename){if(!a.call(this.uniqueSourceIndexByFilename,t.filename)){this.uniqueSourceIndexByFilename[t.filename]=this.uniqueSources.length;this.uniqueSources.push({filename:t.filename,content:t.content.original})}else{const e=this.uniqueSources[this.uniqueSourceIndexByFilename[t.filename]];if(t.content.original!==e.content){throw new Error(`Illegal source: same filename (${t.filename}), different contents`)}}}this.sources.push(t);return this}append(t,e){this.addSource({content:new MagicString(t),separator:e&&e.separator||""});return this}clone(){const t=new Bundle({intro:this.intro,separator:this.separator});this.sources.forEach((e=>{t.addSource({filename:e.filename,content:e.content.clone(),separator:e.separator})}));return t}generateDecodedMap(t={}){const e=[];this.sources.forEach((t=>{Object.keys(t.content.storedNames).forEach((t=>{if(!~e.indexOf(t))e.push(t)}))}));const n=new Mappings(t.hires);if(this.intro){n.advance(this.intro)}this.sources.forEach(((t,i)=>{if(i>0){n.advance(this.separator)}const r=t.filename?this.uniqueSourceIndexByFilename[t.filename]:-1;const s=t.content;const o=getLocator(s.original);if(s.intro){n.advance(s.intro)}s.firstChunk.eachNext((i=>{const h=o(i.start);if(i.intro.length)n.advance(i.intro);if(t.filename){if(i.edited){n.addEdit(r,i.content,h,i.storeName?e.indexOf(i.original):-1)}else{n.addUneditedChunk(r,i,s.original,h,s.sourcemapLocations)}}else{n.advance(i.content)}if(i.outro.length)n.advance(i.outro)}));if(s.outro){n.advance(s.outro)}}));return{file:t.file?t.file.split(/[/\\]/).pop():null,sources:this.uniqueSources.map((e=>t.file?getRelativePath(t.file,e.filename):e.filename)),sourcesContent:this.uniqueSources.map((e=>t.includeContent?e.content:null)),names:e,mappings:n.raw}}generateMap(t){return new SourceMap(this.generateDecodedMap(t))}getIndentString(){const t={};this.sources.forEach((e=>{const n=e.content._getRawIndentString();if(n===null)return;if(!t[n])t[n]=0;t[n]+=1}));return Object.keys(t).sort(((e,n)=>t[e]-t[n]))[0]||"\t"}indent(t){if(!arguments.length){t=this.getIndentString()}if(t==="")return this;let e=!this.intro||this.intro.slice(-1)==="\n";this.sources.forEach(((n,i)=>{const r=n.separator!==undefined?n.separator:this.separator;const s=e||i>0&&/\r?\n$/.test(r);n.content.indent(t,{exclude:n.indentExclusionRanges,indentStart:s});e=n.content.lastChar()==="\n"}));if(this.intro){this.intro=t+this.intro.replace(/^[^\n]/gm,((e,n)=>n>0?t+e:e))}return this}prepend(t){this.intro=t+this.intro;return this}toString(){const t=this.sources.map(((t,e)=>{const n=t.separator!==undefined?t.separator:this.separator;const i=(e>0?n:"")+t.content.toString();return i})).join("");return this.intro+t}isEmpty(){if(this.intro.length&&this.intro.trim())return false;if(this.sources.some((t=>!t.content.isEmpty())))return false;return true}length(){return this.sources.reduce(((t,e)=>t+e.content.length()),this.intro.length)}trimLines(){return this.trim("[\\r\\n]")}trim(t){return this.trimStart(t).trimEnd(t)}trimStart(t){const e=new RegExp("^"+(t||"\\s")+"+");this.intro=this.intro.replace(e,"");if(!this.intro){let e;let n=0;do{e=this.sources[n++];if(!e){break}}while(!e.content.trimStartAborted(t))}return this}trimEnd(t){const e=new RegExp((t||"\\s")+"+$");let n;let i=this.sources.length-1;do{n=this.sources[i--];if(!n){this.intro=this.intro.replace(e,"");break}}while(!n.content.trimEndAborted(t));return this}}MagicString.Bundle=Bundle;MagicString.SourceMap=SourceMap;MagicString.default=MagicString;t.exports=MagicString}};var e={};function __nccwpck_require__(n){var i=e[n];if(i!==undefined){return i.exports}var r=e[n]={exports:{}};var s=true;try{t[n].call(r.exports,r,r.exports,__nccwpck_require__);s=false}finally{if(s)delete e[n]}return r.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(712);module.exports=n})();
@@ -0,0 +1 @@
1
+ {"name":"magic-string","version":"0.27.0","author":"Rich Harris","license":"MIT","types":"./index.d.ts"}
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016-2018 Ari Porad
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,82 @@
1
+ /* (c) 2015 Ari Porad (@ariporad) <http://ariporad.com>. License: ariporad.mit-license.org */
2
+
3
+ /**
4
+ * The hook. Accepts the code of the module and the filename.
5
+ */
6
+ declare type Hook = (code: string, filename: string) => string;
7
+
8
+ /**
9
+ * A matcher function, will be called with path to a file.
10
+ *
11
+ * Should return truthy if the file should be hooked, falsy otherwise.
12
+ */
13
+ declare type Matcher = (path: string) => boolean;
14
+
15
+ /**
16
+ * Reverts the hook when called.
17
+ */
18
+ declare type RevertFunction = () => void;
19
+ interface Options {
20
+ /**
21
+ * The extensions to hook. Should start with '.' (ex. ['.js']).
22
+ *
23
+ * Takes precedence over `exts`, `extension` and `ext`.
24
+ *
25
+ * @alias exts
26
+ * @alias extension
27
+ * @alias ext
28
+ * @default ['.js']
29
+ */
30
+ extensions?: ReadonlyArray<string> | string;
31
+
32
+ /**
33
+ * The extensions to hook. Should start with '.' (ex. ['.js']).
34
+ *
35
+ * Takes precedence over `extension` and `ext`.
36
+ *
37
+ * @alias extension
38
+ * @alias ext
39
+ * @default ['.js']
40
+ */
41
+ exts?: ReadonlyArray<string> | string;
42
+
43
+ /**
44
+ * The extensions to hook. Should start with '.' (ex. ['.js']).
45
+ *
46
+ * Takes precedence over `ext`.
47
+ *
48
+ * @alias ext
49
+ * @default ['.js']
50
+ */
51
+ extension?: ReadonlyArray<string> | string;
52
+
53
+ /**
54
+ * The extensions to hook. Should start with '.' (ex. ['.js']).
55
+ *
56
+ * @default ['.js']
57
+ */
58
+ ext?: ReadonlyArray<string> | string;
59
+
60
+ /**
61
+ * A matcher function, will be called with path to a file.
62
+ *
63
+ * Should return truthy if the file should be hooked, falsy otherwise.
64
+ */
65
+ matcher?: Matcher | null;
66
+
67
+ /**
68
+ * Auto-ignore node_modules. Independent of any matcher.
69
+ *
70
+ * @default true
71
+ */
72
+ ignoreNodeModules?: boolean;
73
+ }
74
+
75
+ /**
76
+ * Add a require hook.
77
+ *
78
+ * @param hook The hook. Accepts the code of the module and the filename. Required.
79
+ * @returns The `revert` function. Reverts the hook when called.
80
+ */
81
+ export declare function addHook(hook: Hook, opts?: Options): RevertFunction;
82
+ export {};
@@ -0,0 +1 @@
1
+ (function(){"use strict";var e={695:function(e,t,n){e=n.nmd(e);Object.defineProperty(t,"__esModule",{value:true});t.addHook=addHook;var r=_interopRequireDefault(n(188));var o=_interopRequireDefault(n(17));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const i=/^(?:.*[\\/])?node_modules(?:[\\/].*)?$/;const s=e.constructor.length>1?e.constructor:r.default;const u="[Pirates] A hook returned a non-string, or nothing at all! This is a"+" violation of intergalactic law!\n"+"--------------------\n"+"If you have no idea what this means or what Pirates is, let me explain: "+"Pirates is a module that makes is easy to implement require hooks. One of"+" the require hooks you're using uses it. One of these require hooks"+" didn't return anything from it's handler, so we don't know what to"+" do. You might want to debug this.";function shouldCompile(e,t,n,r){if(typeof e!=="string"){return false}if(t.indexOf(o.default.extname(e))===-1){return false}const s=o.default.resolve(e);if(r&&i.test(s)){return false}if(n&&typeof n==="function"){return!!n(s)}return true}function addHook(e,t={}){let n=false;const r=[];const o=[];let i;const a=s._extensions[".js"];const f=t.matcher||null;const l=t.ignoreNodeModules!==false;i=t.extensions||t.exts||t.extension||t.ext||[".js"];if(!Array.isArray(i)){i=[i]}i.forEach((t=>{if(typeof t!=="string"){throw new TypeError(`Invalid Extension: ${t}`)}const _=s._extensions[t]||a;o[t]=s._extensions[t];r[t]=s._extensions[t]=function newLoader(t,r){let o;if(!n){if(shouldCompile(r,i,f,l)){o=t._compile;t._compile=function _compile(n){t._compile=o;const i=e(n,r);if(typeof i!=="string"){throw new Error(u)}return t._compile(i,r)}}}_(t,r)}}));return function revert(){if(n)return;n=true;i.forEach((e=>{if(s._extensions[e]===r[e]){if(!o[e]){delete s._extensions[e]}else{s._extensions[e]=o[e]}}}))}}},188:function(e){e.exports=require("module")},17:function(e){e.exports=require("path")}};var t={};function __nccwpck_require__(n){var r=t[n];if(r!==undefined){return r.exports}var o=t[n]={id:n,loaded:false,exports:{}};var i=true;try{e[n](o,o.exports,__nccwpck_require__);i=false}finally{if(i)delete t[n]}o.loaded=true;return o.exports}!function(){__nccwpck_require__.nmd=function(e){e.paths=[];if(!e.children)e.children=[];return e}}();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(695);module.exports=n})();
@@ -0,0 +1 @@
1
+ {"name":"pirates","author":{"name":"Ari Porad","email":"ari@ariporad.com","url":"http://ariporad.com"},"license":"MIT","types":"index.d.ts"}
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6