@alanszp/eventbridge-client 12.0.2 → 13.0.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 (151) hide show
  1. package/package.json +4 -7
  2. package/.gitignore +0 -3
  3. package/.npmignore +0 -3
  4. package/node_modules/@cspotcode/source-map-support/LICENSE.md +0 -21
  5. package/node_modules/@cspotcode/source-map-support/README.md +0 -289
  6. package/node_modules/@cspotcode/source-map-support/browser-source-map-support.js +0 -114
  7. package/node_modules/@cspotcode/source-map-support/package.json +0 -50
  8. package/node_modules/@cspotcode/source-map-support/register-hook-require.d.ts +0 -7
  9. package/node_modules/@cspotcode/source-map-support/register-hook-require.js +0 -3
  10. package/node_modules/@cspotcode/source-map-support/register.d.ts +0 -7
  11. package/node_modules/@cspotcode/source-map-support/register.js +0 -1
  12. package/node_modules/@cspotcode/source-map-support/source-map-support.d.ts +0 -76
  13. package/node_modules/@cspotcode/source-map-support/source-map-support.js +0 -938
  14. package/node_modules/@jridgewell/trace-mapping/LICENSE +0 -19
  15. package/node_modules/@jridgewell/trace-mapping/README.md +0 -193
  16. package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +0 -514
  17. package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map +0 -1
  18. package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js +0 -528
  19. package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map +0 -1
  20. package/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts +0 -8
  21. package/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts +0 -32
  22. package/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts +0 -7
  23. package/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts +0 -1
  24. package/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts +0 -2
  25. package/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +0 -16
  26. package/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts +0 -4
  27. package/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +0 -70
  28. package/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts +0 -85
  29. package/node_modules/@jridgewell/trace-mapping/package.json +0 -70
  30. package/node_modules/@types/node/LICENSE +0 -21
  31. package/node_modules/@types/node/README.md +0 -15
  32. package/node_modules/@types/node/assert/strict.d.ts +0 -8
  33. package/node_modules/@types/node/assert.d.ts +0 -996
  34. package/node_modules/@types/node/async_hooks.d.ts +0 -539
  35. package/node_modules/@types/node/buffer.d.ts +0 -2362
  36. package/node_modules/@types/node/child_process.d.ts +0 -1540
  37. package/node_modules/@types/node/cluster.d.ts +0 -432
  38. package/node_modules/@types/node/console.d.ts +0 -415
  39. package/node_modules/@types/node/constants.d.ts +0 -19
  40. package/node_modules/@types/node/crypto.d.ts +0 -4487
  41. package/node_modules/@types/node/dgram.d.ts +0 -596
  42. package/node_modules/@types/node/diagnostics_channel.d.ts +0 -545
  43. package/node_modules/@types/node/dns/promises.d.ts +0 -425
  44. package/node_modules/@types/node/dns.d.ts +0 -809
  45. package/node_modules/@types/node/dom-events.d.ts +0 -122
  46. package/node_modules/@types/node/domain.d.ts +0 -170
  47. package/node_modules/@types/node/events.d.ts +0 -879
  48. package/node_modules/@types/node/fs/promises.d.ts +0 -1239
  49. package/node_modules/@types/node/fs.d.ts +0 -4311
  50. package/node_modules/@types/node/globals.d.ts +0 -411
  51. package/node_modules/@types/node/globals.global.d.ts +0 -1
  52. package/node_modules/@types/node/http.d.ts +0 -1887
  53. package/node_modules/@types/node/http2.d.ts +0 -2382
  54. package/node_modules/@types/node/https.d.ts +0 -550
  55. package/node_modules/@types/node/index.d.ts +0 -88
  56. package/node_modules/@types/node/inspector.d.ts +0 -2747
  57. package/node_modules/@types/node/module.d.ts +0 -315
  58. package/node_modules/@types/node/net.d.ts +0 -949
  59. package/node_modules/@types/node/os.d.ts +0 -478
  60. package/node_modules/@types/node/package.json +0 -229
  61. package/node_modules/@types/node/path.d.ts +0 -191
  62. package/node_modules/@types/node/perf_hooks.d.ts +0 -645
  63. package/node_modules/@types/node/process.d.ts +0 -1561
  64. package/node_modules/@types/node/punycode.d.ts +0 -117
  65. package/node_modules/@types/node/querystring.d.ts +0 -141
  66. package/node_modules/@types/node/readline/promises.d.ts +0 -150
  67. package/node_modules/@types/node/readline.d.ts +0 -539
  68. package/node_modules/@types/node/repl.d.ts +0 -430
  69. package/node_modules/@types/node/stream/consumers.d.ts +0 -12
  70. package/node_modules/@types/node/stream/promises.d.ts +0 -83
  71. package/node_modules/@types/node/stream/web.d.ts +0 -366
  72. package/node_modules/@types/node/stream.d.ts +0 -1701
  73. package/node_modules/@types/node/string_decoder.d.ts +0 -67
  74. package/node_modules/@types/node/test.d.ts +0 -1465
  75. package/node_modules/@types/node/timers/promises.d.ts +0 -93
  76. package/node_modules/@types/node/timers.d.ts +0 -240
  77. package/node_modules/@types/node/tls.d.ts +0 -1210
  78. package/node_modules/@types/node/trace_events.d.ts +0 -182
  79. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  80. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  81. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  82. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
  83. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  84. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  85. package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  86. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  87. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4487
  88. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -596
  89. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -545
  90. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  91. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  92. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  93. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  94. package/node_modules/@types/node/ts4.8/events.d.ts +0 -879
  95. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1239
  96. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4311
  97. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -411
  98. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  99. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1887
  100. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  101. package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  102. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  103. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  104. package/node_modules/@types/node/ts4.8/module.d.ts +0 -315
  105. package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
  106. package/node_modules/@types/node/ts4.8/os.d.ts +0 -478
  107. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  108. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -645
  109. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1561
  110. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  111. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  112. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  113. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  114. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  115. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  116. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  117. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -366
  118. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  119. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  120. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1465
  121. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  122. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  123. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  124. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  125. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  126. package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
  127. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2183
  128. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -764
  129. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -903
  130. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -179
  131. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  132. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  133. package/node_modules/@types/node/tty.d.ts +0 -208
  134. package/node_modules/@types/node/url.d.ts +0 -927
  135. package/node_modules/@types/node/util.d.ts +0 -2183
  136. package/node_modules/@types/node/v8.d.ts +0 -764
  137. package/node_modules/@types/node/vm.d.ts +0 -903
  138. package/node_modules/@types/node/wasi.d.ts +0 -179
  139. package/node_modules/@types/node/worker_threads.d.ts +0 -691
  140. package/node_modules/@types/node/zlib.d.ts +0 -517
  141. package/src/aws/awsEventbridgeClient.ts +0 -4
  142. package/src/aws/awsTypes.ts +0 -10
  143. package/src/aws/index.ts +0 -2
  144. package/src/basicEventbridgeClient.test.ts +0 -149
  145. package/src/basicEventbridgeClient.ts +0 -160
  146. package/src/helpers/mapLaraEventToAWSEvent.ts +0 -37
  147. package/src/index.ts +0 -3
  148. package/src/mockEventbridgeClient.ts +0 -11
  149. package/src/mocks/fixtures/eventbridgeFixture.ts +0 -41
  150. package/src/types/UpdatedEvent.ts +0 -39
  151. package/src/types/index.ts +0 -1
@@ -1,938 +0,0 @@
1
- const { TraceMap, originalPositionFor, AnyMap } = require('@jridgewell/trace-mapping');
2
- var path = require('path');
3
- const { fileURLToPath, pathToFileURL } = require('url');
4
- var util = require('util');
5
-
6
- var fs;
7
- try {
8
- fs = require('fs');
9
- if (!fs.existsSync || !fs.readFileSync) {
10
- // fs doesn't have all methods we need
11
- fs = null;
12
- }
13
- } catch (err) {
14
- /* nop */
15
- }
16
-
17
- /**
18
- * Requires a module which is protected against bundler minification.
19
- *
20
- * @param {NodeModule} mod
21
- * @param {string} request
22
- */
23
- function dynamicRequire(mod, request) {
24
- return mod.require(request);
25
- }
26
-
27
- /**
28
- * @typedef {{
29
- * enabled: boolean;
30
- * originalValue: any;
31
- * installedValue: any;
32
- * }} HookState
33
- * Used for installing and uninstalling hooks
34
- */
35
-
36
- // Increment this if the format of sharedData changes in a breaking way.
37
- var sharedDataVersion = 1;
38
-
39
- /**
40
- * @template T
41
- * @param {T} defaults
42
- * @returns {T}
43
- */
44
- function initializeSharedData(defaults) {
45
- var sharedDataKey = 'source-map-support/sharedData';
46
- if (typeof Symbol !== 'undefined') {
47
- sharedDataKey = Symbol.for(sharedDataKey);
48
- }
49
- var sharedData = this[sharedDataKey];
50
- if (!sharedData) {
51
- sharedData = { version: sharedDataVersion };
52
- if (Object.defineProperty) {
53
- Object.defineProperty(this, sharedDataKey, { value: sharedData });
54
- } else {
55
- this[sharedDataKey] = sharedData;
56
- }
57
- }
58
- if (sharedDataVersion !== sharedData.version) {
59
- throw new Error("Multiple incompatible instances of source-map-support were loaded");
60
- }
61
- for (var key in defaults) {
62
- if (!(key in sharedData)) {
63
- sharedData[key] = defaults[key];
64
- }
65
- }
66
- return sharedData;
67
- }
68
-
69
- // If multiple instances of source-map-support are loaded into the same
70
- // context, they shouldn't overwrite each other. By storing handlers, caches,
71
- // and other state on a shared object, different instances of
72
- // source-map-support can work together in a limited way. This does require
73
- // that future versions of source-map-support continue to support the fields on
74
- // this object. If this internal contract ever needs to be broken, increment
75
- // sharedDataVersion. (This version number is not the same as any of the
76
- // package's version numbers, which should reflect the *external* API of
77
- // source-map-support.)
78
- var sharedData = initializeSharedData({
79
-
80
- // Only install once if called multiple times
81
- // Remember how the environment looked before installation so we can restore if able
82
- /** @type {HookState} */
83
- errorPrepareStackTraceHook: undefined,
84
- /** @type {HookState} */
85
- processEmitHook: undefined,
86
- /** @type {HookState} */
87
- moduleResolveFilenameHook: undefined,
88
-
89
- /** @type {Array<(request: string, parent: any, isMain: boolean, options: any, redirectedRequest: string) => void>} */
90
- onConflictingLibraryRedirectArr: [],
91
-
92
- // If true, the caches are reset before a stack trace formatting operation
93
- emptyCacheBetweenOperations: false,
94
-
95
- // Maps a file path to a string containing the file contents
96
- fileContentsCache: Object.create(null),
97
-
98
- // Maps a file path to a source map for that file
99
- /** @type {Record<string, {url: string, map: TraceMap}} */
100
- sourceMapCache: Object.create(null),
101
-
102
- // Priority list of retrieve handlers
103
- retrieveFileHandlers: [],
104
- retrieveMapHandlers: [],
105
-
106
- // Priority list of internally-implemented handlers.
107
- // When resetting state, we must keep these.
108
- internalRetrieveFileHandlers: [],
109
- internalRetrieveMapHandlers: [],
110
-
111
- });
112
-
113
- // Supports {browser, node, auto}
114
- var environment = "auto";
115
-
116
- // Regex for detecting source maps
117
- var reSourceMap = /^data:application\/json[^,]+base64,/;
118
-
119
- function isInBrowser() {
120
- if (environment === "browser")
121
- return true;
122
- if (environment === "node")
123
- return false;
124
- return ((typeof window !== 'undefined') && (typeof XMLHttpRequest === 'function') && !(window.require && window.module && window.process && window.process.type === "renderer"));
125
- }
126
-
127
- function hasGlobalProcessEventEmitter() {
128
- return ((typeof process === 'object') && (process !== null) && (typeof process.on === 'function'));
129
- }
130
-
131
- function tryFileURLToPath(v) {
132
- if(isFileUrl(v)) {
133
- return fileURLToPath(v);
134
- }
135
- return v;
136
- }
137
-
138
- // TODO un-copy these from resolve-uri; see if they can be exported from that lib
139
- function isFileUrl(input) {
140
- return input.startsWith('file:');
141
- }
142
- function isAbsoluteUrl(input) {
143
- return schemeRegex.test(input);
144
- }
145
- // Matches the scheme of a URL, eg "http://"
146
- const schemeRegex = /^[\w+.-]+:\/\//;
147
- function isSchemeRelativeUrl(input) {
148
- return input.startsWith('//');
149
- }
150
-
151
- // #region Caches
152
- /** @param {string} pathOrFileUrl */
153
- function getCacheKey(pathOrFileUrl) {
154
- if(pathOrFileUrl.startsWith('node:')) return pathOrFileUrl;
155
- if(isFileUrl(pathOrFileUrl)) {
156
- // Must normalize spaces to %20, stuff like that
157
- return new URL(pathOrFileUrl).toString();
158
- } else {
159
- try {
160
- return pathToFileURL(pathOrFileUrl).toString();
161
- } catch {
162
- return pathOrFileUrl;
163
- }
164
- }
165
- }
166
- function getFileContentsCache(key) {
167
- return sharedData.fileContentsCache[getCacheKey(key)];
168
- }
169
- function hasFileContentsCacheFromKey(key) {
170
- return Object.prototype.hasOwnProperty.call(sharedData.fileContentsCache, key);
171
- }
172
- function getFileContentsCacheFromKey(key) {
173
- return sharedData.fileContentsCache[key];
174
- }
175
- function setFileContentsCache(key, value) {
176
- return sharedData.fileContentsCache[getCacheKey(key)] = value;
177
- }
178
- function getSourceMapCache(key) {
179
- return sharedData.sourceMapCache[getCacheKey(key)];
180
- }
181
- function setSourceMapCache(key, value) {
182
- return sharedData.sourceMapCache[getCacheKey(key)] = value;
183
- }
184
- function clearCaches() {
185
- sharedData.fileContentsCache = Object.create(null);
186
- sharedData.sourceMapCache = Object.create(null);
187
- }
188
- // #endregion Caches
189
-
190
- function handlerExec(list, internalList) {
191
- return function(arg) {
192
- for (var i = 0; i < list.length; i++) {
193
- var ret = list[i](arg);
194
- if (ret) {
195
- return ret;
196
- }
197
- }
198
- for (var i = 0; i < internalList.length; i++) {
199
- var ret = internalList[i](arg);
200
- if (ret) {
201
- return ret;
202
- }
203
- }
204
- return null;
205
- };
206
- }
207
-
208
- var retrieveFile = handlerExec(sharedData.retrieveFileHandlers, sharedData.internalRetrieveFileHandlers);
209
-
210
- sharedData.internalRetrieveFileHandlers.push(function(path) {
211
- // Trim the path to make sure there is no extra whitespace.
212
- path = path.trim();
213
- if (/^file:/.test(path)) {
214
- // existsSync/readFileSync can't handle file protocol, but once stripped, it works
215
- path = path.replace(/file:\/\/\/(\w:)?/, function(protocol, drive) {
216
- return drive ?
217
- '' : // file:///C:/dir/file -> C:/dir/file
218
- '/'; // file:///root-dir/file -> /root-dir/file
219
- });
220
- }
221
- const key = getCacheKey(path);
222
- if(hasFileContentsCacheFromKey(key)) {
223
- return getFileContentsCacheFromKey(key);
224
- }
225
-
226
- var contents = '';
227
- try {
228
- if (!fs) {
229
- // Use SJAX if we are in the browser
230
- var xhr = new XMLHttpRequest();
231
- xhr.open('GET', path, /** async */ false);
232
- xhr.send(null);
233
- if (xhr.readyState === 4 && xhr.status === 200) {
234
- contents = xhr.responseText;
235
- }
236
- } else if (fs.existsSync(path)) {
237
- // Otherwise, use the filesystem
238
- contents = fs.readFileSync(path, 'utf8');
239
- }
240
- } catch (er) {
241
- /* ignore any errors */
242
- }
243
-
244
- return setFileContentsCache(path, contents);
245
- });
246
-
247
- // Support URLs relative to a directory, but be careful about a protocol prefix
248
- // in case we are in the browser (i.e. directories may start with "http://" or "file:///")
249
- function supportRelativeURL(file, url) {
250
- if(!file) return url;
251
- // given that this happens within error formatting codepath, probably best to
252
- // fallback instead of throwing if anything goes wrong
253
- try {
254
- // if should output a URL
255
- if(isAbsoluteUrl(file) || isSchemeRelativeUrl(file)) {
256
- if(isAbsoluteUrl(url) || isSchemeRelativeUrl(url)) {
257
- return new URL(url, file).toString();
258
- }
259
- if(path.isAbsolute(url)) {
260
- return new URL(pathToFileURL(url), file).toString();
261
- }
262
- // url is relative path or URL
263
- return new URL(url.replace(/\\/g, '/'), file).toString();
264
- }
265
- // if should output a path (unless URL is something like https://)
266
- if(path.isAbsolute(file)) {
267
- if(isFileUrl(url)) {
268
- return fileURLToPath(url);
269
- }
270
- if(isSchemeRelativeUrl(url)) {
271
- return fileURLToPath(new URL(url, 'file://'));
272
- }
273
- if(isAbsoluteUrl(url)) {
274
- // url is a non-file URL
275
- // Go with the URL
276
- return url;
277
- }
278
- if(path.isAbsolute(url)) {
279
- // Normalize at all? decodeURI or normalize slashes?
280
- return path.normalize(url);
281
- }
282
- // url is relative path or URL
283
- return path.join(file, '..', decodeURI(url));
284
- }
285
- // If we get here, file is relative.
286
- // Shouldn't happen since node identifies modules with absolute paths or URLs.
287
- // But we can take a stab at returning something meaningful anyway.
288
- if(isAbsoluteUrl(url) || isSchemeRelativeUrl(url)) {
289
- return url;
290
- }
291
- return path.join(file, '..', url);
292
- } catch(e) {
293
- return url;
294
- }
295
- }
296
-
297
- // Return pathOrUrl in the same style as matchStyleOf: either a file URL or a native path
298
- function matchStyleOfPathOrUrl(matchStyleOf, pathOrUrl) {
299
- try {
300
- if(isAbsoluteUrl(matchStyleOf) || isSchemeRelativeUrl(matchStyleOf)) {
301
- if(isAbsoluteUrl(pathOrUrl) || isSchemeRelativeUrl(pathOrUrl)) return pathOrUrl;
302
- if(path.isAbsolute(pathOrUrl)) return pathToFileURL(pathOrUrl).toString();
303
- } else if(path.isAbsolute(matchStyleOf)) {
304
- if(isAbsoluteUrl(pathOrUrl) || isSchemeRelativeUrl(pathOrUrl)) {
305
- return fileURLToPath(new URL(pathOrUrl, 'file://'));
306
- }
307
- }
308
- return pathOrUrl;
309
- } catch(e) {
310
- return pathOrUrl;
311
- }
312
- }
313
-
314
- function retrieveSourceMapURL(source) {
315
- var fileData;
316
-
317
- if (isInBrowser()) {
318
- try {
319
- var xhr = new XMLHttpRequest();
320
- xhr.open('GET', source, false);
321
- xhr.send(null);
322
- fileData = xhr.readyState === 4 ? xhr.responseText : null;
323
-
324
- // Support providing a sourceMappingURL via the SourceMap header
325
- var sourceMapHeader = xhr.getResponseHeader("SourceMap") ||
326
- xhr.getResponseHeader("X-SourceMap");
327
- if (sourceMapHeader) {
328
- return sourceMapHeader;
329
- }
330
- } catch (e) {
331
- }
332
- }
333
-
334
- // Get the URL of the source map
335
- fileData = retrieveFile(tryFileURLToPath(source));
336
- var re = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;
337
- // Keep executing the search to find the *last* sourceMappingURL to avoid
338
- // picking up sourceMappingURLs from comments, strings, etc.
339
- var lastMatch, match;
340
- while (match = re.exec(fileData)) lastMatch = match;
341
- if (!lastMatch) return null;
342
- return lastMatch[1];
343
- };
344
-
345
- // Can be overridden by the retrieveSourceMap option to install. Takes a
346
- // generated source filename; returns a {map, optional url} object, or null if
347
- // there is no source map. The map field may be either a string or the parsed
348
- // JSON object (ie, it must be a valid argument to the SourceMapConsumer
349
- // constructor).
350
- /** @type {(source: string) => import('./source-map-support').UrlAndMap | null} */
351
- var retrieveSourceMap = handlerExec(sharedData.retrieveMapHandlers, sharedData.internalRetrieveMapHandlers);
352
- sharedData.internalRetrieveMapHandlers.push(function(source) {
353
- var sourceMappingURL = retrieveSourceMapURL(source);
354
- if (!sourceMappingURL) return null;
355
-
356
- // Read the contents of the source map
357
- var sourceMapData;
358
- if (reSourceMap.test(sourceMappingURL)) {
359
- // Support source map URL as a data url
360
- var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(',') + 1);
361
- sourceMapData = Buffer.from(rawData, "base64").toString();
362
- sourceMappingURL = source;
363
- } else {
364
- // Support source map URLs relative to the source URL
365
- sourceMappingURL = supportRelativeURL(source, sourceMappingURL);
366
- sourceMapData = retrieveFile(tryFileURLToPath(sourceMappingURL));
367
- }
368
-
369
- if (!sourceMapData) {
370
- return null;
371
- }
372
-
373
- return {
374
- url: sourceMappingURL,
375
- map: sourceMapData
376
- };
377
- });
378
-
379
- function mapSourcePosition(position) {
380
- var sourceMap = getSourceMapCache(position.source);
381
- if (!sourceMap) {
382
- // Call the (overrideable) retrieveSourceMap function to get the source map.
383
- var urlAndMap = retrieveSourceMap(position.source);
384
- if (urlAndMap) {
385
- sourceMap = setSourceMapCache(position.source, {
386
- url: urlAndMap.url,
387
- map: new AnyMap(urlAndMap.map, urlAndMap.url)
388
- });
389
-
390
- // Overwrite trace-mapping's resolutions, because they do not handle
391
- // Windows paths the way we want.
392
- // TODO Remove now that windows path support was added to resolve-uri and thus trace-mapping?
393
- sourceMap.map.resolvedSources = sourceMap.map.sources.map(s => supportRelativeURL(sourceMap.url, s));
394
-
395
- // Load all sources stored inline with the source map into the file cache
396
- // to pretend like they are already loaded. They may not exist on disk.
397
- if (sourceMap.map.sourcesContent) {
398
- sourceMap.map.resolvedSources.forEach(function(resolvedSource, i) {
399
- var contents = sourceMap.map.sourcesContent[i];
400
- if (contents) {
401
- setFileContentsCache(resolvedSource, contents);
402
- }
403
- });
404
- }
405
- } else {
406
- sourceMap = setSourceMapCache(position.source, {
407
- url: null,
408
- map: null
409
- });
410
- }
411
- }
412
-
413
- // Resolve the source URL relative to the URL of the source map
414
- if (sourceMap && sourceMap.map) {
415
- var originalPosition = originalPositionFor(sourceMap.map, position);
416
-
417
- // Only return the original position if a matching line was found. If no
418
- // matching line is found then we return position instead, which will cause
419
- // the stack trace to print the path and line for the compiled file. It is
420
- // better to give a precise location in the compiled file than a vague
421
- // location in the original file.
422
- if (originalPosition.source !== null) {
423
- // originalPosition.source has *already* been resolved against sourceMap.url
424
- // so is *already* as absolute as possible.
425
- // However, we want to ensure we output in same format as input: URL or native path
426
- originalPosition.source = matchStyleOfPathOrUrl(
427
- position.source, originalPosition.source);
428
- return originalPosition;
429
- }
430
- }
431
-
432
- return position;
433
- }
434
-
435
- // Parses code generated by FormatEvalOrigin(), a function inside V8:
436
- // https://code.google.com/p/v8/source/browse/trunk/src/messages.js
437
- function mapEvalOrigin(origin) {
438
- // Most eval() calls are in this format
439
- var match = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin);
440
- if (match) {
441
- var position = mapSourcePosition({
442
- source: match[2],
443
- line: +match[3],
444
- column: match[4] - 1
445
- });
446
- return 'eval at ' + match[1] + ' (' + position.source + ':' +
447
- position.line + ':' + (position.column + 1) + ')';
448
- }
449
-
450
- // Parse nested eval() calls using recursion
451
- match = /^eval at ([^(]+) \((.+)\)$/.exec(origin);
452
- if (match) {
453
- return 'eval at ' + match[1] + ' (' + mapEvalOrigin(match[2]) + ')';
454
- }
455
-
456
- // Make sure we still return useful information if we didn't find anything
457
- return origin;
458
- }
459
-
460
- // This is copied almost verbatim from the V8 source code at
461
- // https://code.google.com/p/v8/source/browse/trunk/src/messages.js
462
- // Update 2022-04-29:
463
- // https://github.com/v8/v8/blob/98f6f100c5ab8e390e51422747c4ef644d5ac6f2/src/builtins/builtins-callsite.cc#L175-L179
464
- // https://github.com/v8/v8/blob/98f6f100c5ab8e390e51422747c4ef644d5ac6f2/src/objects/call-site-info.cc#L795-L804
465
- // https://github.com/v8/v8/blob/98f6f100c5ab8e390e51422747c4ef644d5ac6f2/src/objects/call-site-info.cc#L717-L750
466
- // The implementation of wrapCallSite() used to just forward to the actual source
467
- // code of CallSite.prototype.toString but unfortunately a new release of V8
468
- // did something to the prototype chain and broke the shim. The only fix I
469
- // could find was copy/paste.
470
- function CallSiteToString() {
471
- var fileName;
472
- var fileLocation = "";
473
- if (this.isNative()) {
474
- fileLocation = "native";
475
- } else {
476
- fileName = this.getScriptNameOrSourceURL();
477
- if (!fileName && this.isEval()) {
478
- fileLocation = this.getEvalOrigin();
479
- fileLocation += ", "; // Expecting source position to follow.
480
- }
481
-
482
- if (fileName) {
483
- fileLocation += fileName;
484
- } else {
485
- // Source code does not originate from a file and is not native, but we
486
- // can still get the source position inside the source string, e.g. in
487
- // an eval string.
488
- fileLocation += "<anonymous>";
489
- }
490
- var lineNumber = this.getLineNumber();
491
- if (lineNumber != null) {
492
- fileLocation += ":" + lineNumber;
493
- var columnNumber = this.getColumnNumber();
494
- if (columnNumber) {
495
- fileLocation += ":" + columnNumber;
496
- }
497
- }
498
- }
499
-
500
- var line = "";
501
- var isAsync = this.isAsync ? this.isAsync() : false;
502
- if(isAsync) {
503
- line += 'async ';
504
- var isPromiseAll = this.isPromiseAll ? this.isPromiseAll() : false;
505
- var isPromiseAny = this.isPromiseAny ? this.isPromiseAny() : false;
506
- if(isPromiseAny || isPromiseAll) {
507
- line += isPromiseAll ? 'Promise.all (index ' : 'Promise.any (index ';
508
- var promiseIndex = this.getPromiseIndex();
509
- line += promiseIndex + ')';
510
- }
511
- }
512
- var functionName = this.getFunctionName();
513
- var addSuffix = true;
514
- var isConstructor = this.isConstructor();
515
- var isMethodCall = !(this.isToplevel() || isConstructor);
516
- if (isMethodCall) {
517
- var typeName = this.getTypeName();
518
- // Fixes shim to be backward compatable with Node v0 to v4
519
- if (typeName === "[object Object]") {
520
- typeName = "null";
521
- }
522
- var methodName = this.getMethodName();
523
- if (functionName) {
524
- if (typeName && functionName.indexOf(typeName) != 0) {
525
- line += typeName + ".";
526
- }
527
- line += functionName;
528
- if (methodName && functionName.indexOf("." + methodName) != functionName.length - methodName.length - 1) {
529
- line += " [as " + methodName + "]";
530
- }
531
- } else {
532
- line += typeName + "." + (methodName || "<anonymous>");
533
- }
534
- } else if (isConstructor) {
535
- line += "new " + (functionName || "<anonymous>");
536
- } else if (functionName) {
537
- line += functionName;
538
- } else {
539
- line += fileLocation;
540
- addSuffix = false;
541
- }
542
- if (addSuffix) {
543
- line += " (" + fileLocation + ")";
544
- }
545
- return line;
546
- }
547
-
548
- function cloneCallSite(frame) {
549
- var object = {};
550
- Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach(function(name) {
551
- object[name] = /^(?:is|get)/.test(name) ? function() { return frame[name].call(frame); } : frame[name];
552
- });
553
- object.toString = CallSiteToString;
554
- return object;
555
- }
556
-
557
- function wrapCallSite(frame, state) {
558
- // provides interface backward compatibility
559
- if (state === undefined) {
560
- state = { nextPosition: null, curPosition: null }
561
- }
562
- if(frame.isNative()) {
563
- state.curPosition = null;
564
- return frame;
565
- }
566
-
567
- // Most call sites will return the source file from getFileName(), but code
568
- // passed to eval() ending in "//# sourceURL=..." will return the source file
569
- // from getScriptNameOrSourceURL() instead
570
- var source = frame.getFileName() || frame.getScriptNameOrSourceURL();
571
- if (source) {
572
- // v8 does not expose its internal isWasm, etc methods, so we do this instead.
573
- if(source.startsWith('wasm://')) {
574
- state.curPosition = null;
575
- return frame;
576
- }
577
-
578
- var line = frame.getLineNumber();
579
- var column = frame.getColumnNumber() - 1;
580
-
581
- // Fix position in Node where some (internal) code is prepended.
582
- // See https://github.com/evanw/node-source-map-support/issues/36
583
- // Header removed in node at ^10.16 || >=11.11.0
584
- // v11 is not an LTS candidate, we can just test the one version with it.
585
- // Test node versions for: 10.16-19, 10.20+, 12-19, 20-99, 100+, or 11.11
586
- var noHeader = /^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;
587
- var headerLength = noHeader.test(process.version) ? 0 : 62;
588
- if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) {
589
- column -= headerLength;
590
- }
591
-
592
- var position = mapSourcePosition({
593
- source: source,
594
- line: line,
595
- column: column
596
- });
597
- state.curPosition = position;
598
- frame = cloneCallSite(frame);
599
- var originalFunctionName = frame.getFunctionName;
600
- frame.getFunctionName = function() {
601
- if (state.nextPosition == null) {
602
- return originalFunctionName();
603
- }
604
- return state.nextPosition.name || originalFunctionName();
605
- };
606
- frame.getFileName = function() { return position.source; };
607
- frame.getLineNumber = function() { return position.line; };
608
- frame.getColumnNumber = function() { return position.column + 1; };
609
- frame.getScriptNameOrSourceURL = function() { return position.source; };
610
- return frame;
611
- }
612
-
613
- // Code called using eval() needs special handling
614
- var origin = frame.isEval() && frame.getEvalOrigin();
615
- if (origin) {
616
- origin = mapEvalOrigin(origin);
617
- frame = cloneCallSite(frame);
618
- frame.getEvalOrigin = function() { return origin; };
619
- return frame;
620
- }
621
-
622
- // If we get here then we were unable to change the source position
623
- return frame;
624
- }
625
-
626
- var kIsNodeError = undefined;
627
- try {
628
- // Get a deliberate ERR_INVALID_ARG_TYPE
629
- // TODO is there a better way to reliably get an instance of NodeError?
630
- path.resolve(123);
631
- } catch(e) {
632
- const symbols = Object.getOwnPropertySymbols(e);
633
- const symbol = symbols.find(function (s) {return s.toString().indexOf('kIsNodeError') >= 0});
634
- if(symbol) kIsNodeError = symbol;
635
- }
636
-
637
- const ErrorPrototypeToString = (err) =>Error.prototype.toString.call(err);
638
-
639
- /** @param {HookState} hookState */
640
- function createPrepareStackTrace(hookState) {
641
- return prepareStackTrace;
642
-
643
- // This function is part of the V8 stack trace API, for more info see:
644
- // https://v8.dev/docs/stack-trace-api
645
- function prepareStackTrace(error, stack) {
646
- if(!hookState.enabled) return hookState.originalValue.apply(this, arguments);
647
-
648
- if (sharedData.emptyCacheBetweenOperations) {
649
- clearCaches();
650
- }
651
-
652
- // node gives its own errors special treatment. Mimic that behavior
653
- // https://github.com/nodejs/node/blob/3cbaabc4622df1b4009b9d026a1a970bdbae6e89/lib/internal/errors.js#L118-L128
654
- // https://github.com/nodejs/node/pull/39182
655
- var errorString;
656
- if (kIsNodeError) {
657
- if(kIsNodeError in error) {
658
- errorString = `${error.name} [${error.code}]: ${error.message}`;
659
- } else {
660
- errorString = ErrorPrototypeToString(error);
661
- }
662
- } else {
663
- var name = error.name || 'Error';
664
- var message = error.message || '';
665
- errorString = message ? name + ": " + message : name;
666
- }
667
-
668
- var state = { nextPosition: null, curPosition: null };
669
- var processedStack = [];
670
- for (var i = stack.length - 1; i >= 0; i--) {
671
- processedStack.push('\n at ' + wrapCallSite(stack[i], state));
672
- state.nextPosition = state.curPosition;
673
- }
674
- state.curPosition = state.nextPosition = null;
675
- return errorString + processedStack.reverse().join('');
676
- }
677
- }
678
-
679
- // Generate position and snippet of original source with pointer
680
- function getErrorSource(error) {
681
- var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
682
- if (match) {
683
- var source = match[1];
684
- var line = +match[2];
685
- var column = +match[3];
686
-
687
- // Support the inline sourceContents inside the source map
688
- var contents = getFileContentsCache(source);
689
-
690
- const sourceAsPath = tryFileURLToPath(source);
691
-
692
- // Support files on disk
693
- if (!contents && fs && fs.existsSync(sourceAsPath)) {
694
- try {
695
- contents = fs.readFileSync(sourceAsPath, 'utf8');
696
- } catch (er) {
697
- contents = '';
698
- }
699
- }
700
-
701
- // Format the line from the original source code like node does
702
- if (contents) {
703
- var code = contents.split(/(?:\r\n|\r|\n)/)[line - 1];
704
- if (code) {
705
- return source + ':' + line + '\n' + code + '\n' +
706
- new Array(column).join(' ') + '^';
707
- }
708
- }
709
- }
710
- return null;
711
- }
712
-
713
- function printFatalErrorUponExit (error) {
714
- var source = getErrorSource(error);
715
-
716
- // Ensure error is printed synchronously and not truncated
717
- if (process.stderr._handle && process.stderr._handle.setBlocking) {
718
- process.stderr._handle.setBlocking(true);
719
- }
720
-
721
- if (source) {
722
- console.error(source);
723
- }
724
-
725
- // Matches node's behavior for colorized output
726
- console.error(
727
- util.inspect(error, {
728
- customInspect: false,
729
- colors: process.stderr.isTTY
730
- })
731
- );
732
- }
733
-
734
- function shimEmitUncaughtException () {
735
- const originalValue = process.emit;
736
- var hook = sharedData.processEmitHook = {
737
- enabled: true,
738
- originalValue,
739
- installedValue: undefined
740
- };
741
- var isTerminatingDueToFatalException = false;
742
- var fatalException;
743
-
744
- process.emit = sharedData.processEmitHook.installedValue = function (type) {
745
- const hadListeners = originalValue.apply(this, arguments);
746
- if(hook.enabled) {
747
- if (type === 'uncaughtException' && !hadListeners) {
748
- isTerminatingDueToFatalException = true;
749
- fatalException = arguments[1];
750
- process.exit(1);
751
- }
752
- if (type === 'exit' && isTerminatingDueToFatalException) {
753
- printFatalErrorUponExit(fatalException);
754
- }
755
- }
756
- return hadListeners;
757
- };
758
- }
759
-
760
- var originalRetrieveFileHandlers = sharedData.retrieveFileHandlers.slice(0);
761
- var originalRetrieveMapHandlers = sharedData.retrieveMapHandlers.slice(0);
762
-
763
- exports.wrapCallSite = wrapCallSite;
764
- exports.getErrorSource = getErrorSource;
765
- exports.mapSourcePosition = mapSourcePosition;
766
- exports.retrieveSourceMap = retrieveSourceMap;
767
-
768
- exports.install = function(options) {
769
- options = options || {};
770
-
771
- if (options.environment) {
772
- environment = options.environment;
773
- if (["node", "browser", "auto"].indexOf(environment) === -1) {
774
- throw new Error("environment " + environment + " was unknown. Available options are {auto, browser, node}")
775
- }
776
- }
777
-
778
- // Use dynamicRequire to avoid including in browser bundles
779
- var Module = dynamicRequire(module, 'module');
780
-
781
- // Redirect subsequent imports of "source-map-support"
782
- // to this package
783
- const {redirectConflictingLibrary = true, onConflictingLibraryRedirect} = options;
784
- if(redirectConflictingLibrary) {
785
- if (!sharedData.moduleResolveFilenameHook) {
786
- const originalValue = Module._resolveFilename;
787
- const moduleResolveFilenameHook = sharedData.moduleResolveFilenameHook = {
788
- enabled: true,
789
- originalValue,
790
- installedValue: undefined,
791
- }
792
- Module._resolveFilename = sharedData.moduleResolveFilenameHook.installedValue = function (request, parent, isMain, options) {
793
- if (moduleResolveFilenameHook.enabled) {
794
- // Match all source-map-support entrypoints: source-map-support, source-map-support/register
795
- let requestRedirect;
796
- if (request === 'source-map-support') {
797
- requestRedirect = './';
798
- } else if (request === 'source-map-support/register') {
799
- requestRedirect = './register';
800
- }
801
-
802
- if (requestRedirect !== undefined) {
803
- const newRequest = require.resolve(requestRedirect);
804
- for (const cb of sharedData.onConflictingLibraryRedirectArr) {
805
- cb(request, parent, isMain, options, newRequest);
806
- }
807
- request = newRequest;
808
- }
809
- }
810
-
811
- return originalValue.call(this, request, parent, isMain, options);
812
- }
813
- }
814
- if (onConflictingLibraryRedirect) {
815
- sharedData.onConflictingLibraryRedirectArr.push(onConflictingLibraryRedirect);
816
- }
817
- }
818
-
819
- // Allow sources to be found by methods other than reading the files
820
- // directly from disk.
821
- if (options.retrieveFile) {
822
- if (options.overrideRetrieveFile) {
823
- sharedData.retrieveFileHandlers.length = 0;
824
- }
825
-
826
- sharedData.retrieveFileHandlers.unshift(options.retrieveFile);
827
- }
828
-
829
- // Allow source maps to be found by methods other than reading the files
830
- // directly from disk.
831
- if (options.retrieveSourceMap) {
832
- if (options.overrideRetrieveSourceMap) {
833
- sharedData.retrieveMapHandlers.length = 0;
834
- }
835
-
836
- sharedData.retrieveMapHandlers.unshift(options.retrieveSourceMap);
837
- }
838
-
839
- // Support runtime transpilers that include inline source maps
840
- if (options.hookRequire && !isInBrowser()) {
841
- var $compile = Module.prototype._compile;
842
-
843
- if (!$compile.__sourceMapSupport) {
844
- Module.prototype._compile = function(content, filename) {
845
- setFileContentsCache(filename, content);
846
- setSourceMapCache(filename, undefined);
847
- return $compile.call(this, content, filename);
848
- };
849
-
850
- Module.prototype._compile.__sourceMapSupport = true;
851
- }
852
- }
853
-
854
- // Configure options
855
- if (!sharedData.emptyCacheBetweenOperations) {
856
- sharedData.emptyCacheBetweenOperations = 'emptyCacheBetweenOperations' in options ?
857
- options.emptyCacheBetweenOperations : false;
858
- }
859
-
860
-
861
- // Install the error reformatter
862
- if (!sharedData.errorPrepareStackTraceHook) {
863
- const originalValue = Error.prepareStackTrace;
864
- sharedData.errorPrepareStackTraceHook = {
865
- enabled: true,
866
- originalValue,
867
- installedValue: undefined
868
- };
869
- Error.prepareStackTrace = sharedData.errorPrepareStackTraceHook.installedValue = createPrepareStackTrace(sharedData.errorPrepareStackTraceHook);
870
- }
871
-
872
- if (!sharedData.processEmitHook) {
873
- var installHandler = 'handleUncaughtExceptions' in options ?
874
- options.handleUncaughtExceptions : true;
875
-
876
- // Do not override 'uncaughtException' with our own handler in Node.js
877
- // Worker threads. Workers pass the error to the main thread as an event,
878
- // rather than printing something to stderr and exiting.
879
- try {
880
- // We need to use `dynamicRequire` because `require` on it's own will be optimized by WebPack/Browserify.
881
- var worker_threads = dynamicRequire(module, 'worker_threads');
882
- if (worker_threads.isMainThread === false) {
883
- installHandler = false;
884
- }
885
- } catch(e) {}
886
-
887
- // Provide the option to not install the uncaught exception handler. This is
888
- // to support other uncaught exception handlers (in test frameworks, for
889
- // example). If this handler is not installed and there are no other uncaught
890
- // exception handlers, uncaught exceptions will be caught by node's built-in
891
- // exception handler and the process will still be terminated. However, the
892
- // generated JavaScript code will be shown above the stack trace instead of
893
- // the original source code.
894
- if (installHandler && hasGlobalProcessEventEmitter()) {
895
- shimEmitUncaughtException();
896
- }
897
- }
898
- };
899
-
900
- exports.uninstall = function() {
901
- if(sharedData.processEmitHook) {
902
- // Disable behavior
903
- sharedData.processEmitHook.enabled = false;
904
- // If possible, remove our hook function. May not be possible if subsequent third-party hooks have wrapped around us.
905
- if(process.emit === sharedData.processEmitHook.installedValue) {
906
- process.emit = sharedData.processEmitHook.originalValue;
907
- }
908
- sharedData.processEmitHook = undefined;
909
- }
910
- if(sharedData.errorPrepareStackTraceHook) {
911
- // Disable behavior
912
- sharedData.errorPrepareStackTraceHook.enabled = false;
913
- // If possible or necessary, remove our hook function.
914
- // In vanilla environments, prepareStackTrace is `undefined`.
915
- // We cannot delegate to `undefined` the way we can to a function w/`.apply()`; our only option is to remove the function.
916
- // If we are the *first* hook installed, and another was installed on top of us, we have no choice but to remove both.
917
- if(Error.prepareStackTrace === sharedData.errorPrepareStackTraceHook.installedValue || typeof sharedData.errorPrepareStackTraceHook.originalValue !== 'function') {
918
- Error.prepareStackTrace = sharedData.errorPrepareStackTraceHook.originalValue;
919
- }
920
- sharedData.errorPrepareStackTraceHook = undefined;
921
- }
922
- if (sharedData.moduleResolveFilenameHook) {
923
- // Disable behavior
924
- sharedData.moduleResolveFilenameHook.enabled = false;
925
- // If possible, remove our hook function. May not be possible if subsequent third-party hooks have wrapped around us.
926
- var Module = dynamicRequire(module, 'module');
927
- if(Module._resolveFilename === sharedData.moduleResolveFilenameHook.installedValue) {
928
- Module._resolveFilename = sharedData.moduleResolveFilenameHook.originalValue;
929
- }
930
- sharedData.moduleResolveFilenameHook = undefined;
931
- }
932
- sharedData.onConflictingLibraryRedirectArr.length = 0;
933
- }
934
-
935
- exports.resetRetrieveHandlers = function() {
936
- sharedData.retrieveFileHandlers.length = 0;
937
- sharedData.retrieveMapHandlers.length = 0;
938
- }