@szymonrybczak/playwright-mcp 0.0.2 → 0.0.5

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 (115) hide show
  1. package/index.d.ts +20 -8
  2. package/lib/cjs/_virtual/_commonjsHelpers.js +9 -0
  3. package/lib/cjs/_virtual/browser.js +11 -0
  4. package/lib/cjs/_virtual/browser2.js +7 -0
  5. package/lib/cjs/cloudflare/package.json.js +10 -0
  6. package/lib/cjs/index.js +27 -0
  7. package/lib/cjs/node_modules/debug/src/browser.js +290 -0
  8. package/lib/cjs/node_modules/debug/src/common.js +307 -0
  9. package/lib/cjs/node_modules/ms/index.js +176 -0
  10. package/lib/cjs/package.js +9 -0
  11. package/lib/cjs/src/browserContextFactory.js +240 -0
  12. package/lib/cjs/src/config.js +77 -0
  13. package/lib/cjs/src/connection.js +74 -0
  14. package/lib/cjs/src/context.js +281 -0
  15. package/lib/cjs/src/fileUtils.js +25 -0
  16. package/lib/cjs/src/index.js +15 -0
  17. package/lib/cjs/src/javascript.js +41 -0
  18. package/lib/cjs/src/manualPromise.js +39 -0
  19. package/lib/cjs/src/pageSnapshot.js +35 -0
  20. package/lib/cjs/src/tab.js +91 -0
  21. package/lib/cjs/src/tools/common.js +60 -0
  22. package/lib/cjs/src/tools/console.js +36 -0
  23. package/lib/cjs/src/tools/dialogs.js +44 -0
  24. package/lib/cjs/src/tools/files.js +43 -0
  25. package/lib/cjs/src/tools/install.js +49 -0
  26. package/lib/cjs/src/tools/keyboard.js +38 -0
  27. package/lib/cjs/src/tools/navigate.js +85 -0
  28. package/lib/cjs/src/tools/network.js +43 -0
  29. package/lib/cjs/src/tools/pdf.js +42 -0
  30. package/lib/cjs/src/tools/screenshot.js +69 -0
  31. package/lib/cjs/src/tools/snapshot.js +195 -0
  32. package/lib/cjs/src/tools/tabs.js +110 -0
  33. package/lib/cjs/src/tools/testing.js +52 -0
  34. package/lib/cjs/src/tools/tool.js +9 -0
  35. package/lib/cjs/src/tools/utils.js +75 -0
  36. package/lib/cjs/src/tools/vision.js +181 -0
  37. package/lib/cjs/src/tools/wait.js +51 -0
  38. package/lib/cjs/src/tools.js +54 -0
  39. package/lib/esm/_virtual/_commonjsHelpers.js +5 -0
  40. package/lib/esm/_virtual/browser.js +7 -0
  41. package/lib/esm/_virtual/browser2.js +3 -0
  42. package/lib/esm/cloudflare/package.json.js +5 -0
  43. package/lib/esm/index.js +23 -0
  44. package/lib/esm/node_modules/debug/src/browser.js +286 -0
  45. package/lib/esm/node_modules/debug/src/common.js +303 -0
  46. package/lib/esm/node_modules/ms/index.js +172 -0
  47. package/lib/esm/package.js +5 -0
  48. package/lib/esm/src/browserContextFactory.js +216 -0
  49. package/lib/esm/src/config.js +72 -0
  50. package/lib/esm/src/connection.js +69 -0
  51. package/lib/esm/src/context.js +277 -0
  52. package/lib/esm/src/fileUtils.js +20 -0
  53. package/lib/esm/src/index.js +11 -0
  54. package/lib/esm/src/javascript.js +35 -0
  55. package/lib/esm/src/manualPromise.js +35 -0
  56. package/lib/esm/src/pageSnapshot.js +31 -0
  57. package/lib/esm/src/tab.js +87 -0
  58. package/lib/esm/src/tools/common.js +56 -0
  59. package/lib/esm/src/tools/console.js +32 -0
  60. package/lib/esm/src/tools/dialogs.js +40 -0
  61. package/lib/esm/src/tools/files.js +39 -0
  62. package/lib/esm/src/tools/install.js +45 -0
  63. package/lib/esm/src/tools/keyboard.js +34 -0
  64. package/lib/esm/src/tools/navigate.js +81 -0
  65. package/lib/esm/src/tools/network.js +39 -0
  66. package/lib/esm/src/tools/pdf.js +38 -0
  67. package/lib/esm/src/tools/screenshot.js +65 -0
  68. package/lib/esm/src/tools/snapshot.js +191 -0
  69. package/lib/esm/src/tools/tabs.js +106 -0
  70. package/lib/esm/src/tools/testing.js +48 -0
  71. package/lib/esm/src/tools/tool.js +5 -0
  72. package/lib/esm/src/tools/utils.js +68 -0
  73. package/lib/esm/src/tools/vision.js +177 -0
  74. package/lib/esm/src/tools/wait.js +47 -0
  75. package/lib/esm/src/tools.js +49 -0
  76. package/package.json +15 -44
  77. package/LICENSE +0 -202
  78. package/README.md +0 -508
  79. package/cli.js +0 -18
  80. package/config.d.ts +0 -128
  81. package/index.js +0 -19
  82. package/lib/browserContextFactory.js +0 -227
  83. package/lib/browserServer.js +0 -151
  84. package/lib/config.js +0 -189
  85. package/lib/connection.js +0 -82
  86. package/lib/context.js +0 -291
  87. package/lib/fileUtils.js +0 -32
  88. package/lib/httpServer.js +0 -201
  89. package/lib/index.js +0 -36
  90. package/lib/javascript.js +0 -49
  91. package/lib/manualPromise.js +0 -111
  92. package/lib/package.js +0 -20
  93. package/lib/pageSnapshot.js +0 -43
  94. package/lib/program.js +0 -72
  95. package/lib/server.js +0 -48
  96. package/lib/tab.js +0 -101
  97. package/lib/tools/common.js +0 -68
  98. package/lib/tools/console.js +0 -44
  99. package/lib/tools/dialogs.js +0 -52
  100. package/lib/tools/files.js +0 -51
  101. package/lib/tools/install.js +0 -57
  102. package/lib/tools/keyboard.js +0 -46
  103. package/lib/tools/navigate.js +0 -93
  104. package/lib/tools/network.js +0 -51
  105. package/lib/tools/pdf.js +0 -49
  106. package/lib/tools/screenshot.js +0 -77
  107. package/lib/tools/snapshot.js +0 -204
  108. package/lib/tools/tabs.js +0 -118
  109. package/lib/tools/testing.js +0 -60
  110. package/lib/tools/tool.js +0 -18
  111. package/lib/tools/utils.js +0 -80
  112. package/lib/tools/vision.js +0 -189
  113. package/lib/tools/wait.js +0 -59
  114. package/lib/tools.js +0 -61
  115. package/lib/transport.js +0 -133
@@ -0,0 +1,286 @@
1
+ import { __module as browser } from '../../../_virtual/browser2.js';
2
+ import { __require as requireCommon } from './common.js';
3
+
4
+ /* eslint-env browser */
5
+
6
+ var hasRequiredBrowser;
7
+
8
+ function requireBrowser () {
9
+ if (hasRequiredBrowser) return browser.exports;
10
+ hasRequiredBrowser = 1;
11
+ (function (module, exports) {
12
+ /**
13
+ * This is the web browser implementation of `debug()`.
14
+ */
15
+
16
+ exports.formatArgs = formatArgs;
17
+ exports.save = save;
18
+ exports.load = load;
19
+ exports.useColors = useColors;
20
+ exports.storage = localstorage();
21
+ exports.destroy = (() => {
22
+ let warned = false;
23
+
24
+ return () => {
25
+ if (!warned) {
26
+ warned = true;
27
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
28
+ }
29
+ };
30
+ })();
31
+
32
+ /**
33
+ * Colors.
34
+ */
35
+
36
+ exports.colors = [
37
+ '#0000CC',
38
+ '#0000FF',
39
+ '#0033CC',
40
+ '#0033FF',
41
+ '#0066CC',
42
+ '#0066FF',
43
+ '#0099CC',
44
+ '#0099FF',
45
+ '#00CC00',
46
+ '#00CC33',
47
+ '#00CC66',
48
+ '#00CC99',
49
+ '#00CCCC',
50
+ '#00CCFF',
51
+ '#3300CC',
52
+ '#3300FF',
53
+ '#3333CC',
54
+ '#3333FF',
55
+ '#3366CC',
56
+ '#3366FF',
57
+ '#3399CC',
58
+ '#3399FF',
59
+ '#33CC00',
60
+ '#33CC33',
61
+ '#33CC66',
62
+ '#33CC99',
63
+ '#33CCCC',
64
+ '#33CCFF',
65
+ '#6600CC',
66
+ '#6600FF',
67
+ '#6633CC',
68
+ '#6633FF',
69
+ '#66CC00',
70
+ '#66CC33',
71
+ '#9900CC',
72
+ '#9900FF',
73
+ '#9933CC',
74
+ '#9933FF',
75
+ '#99CC00',
76
+ '#99CC33',
77
+ '#CC0000',
78
+ '#CC0033',
79
+ '#CC0066',
80
+ '#CC0099',
81
+ '#CC00CC',
82
+ '#CC00FF',
83
+ '#CC3300',
84
+ '#CC3333',
85
+ '#CC3366',
86
+ '#CC3399',
87
+ '#CC33CC',
88
+ '#CC33FF',
89
+ '#CC6600',
90
+ '#CC6633',
91
+ '#CC9900',
92
+ '#CC9933',
93
+ '#CCCC00',
94
+ '#CCCC33',
95
+ '#FF0000',
96
+ '#FF0033',
97
+ '#FF0066',
98
+ '#FF0099',
99
+ '#FF00CC',
100
+ '#FF00FF',
101
+ '#FF3300',
102
+ '#FF3333',
103
+ '#FF3366',
104
+ '#FF3399',
105
+ '#FF33CC',
106
+ '#FF33FF',
107
+ '#FF6600',
108
+ '#FF6633',
109
+ '#FF9900',
110
+ '#FF9933',
111
+ '#FFCC00',
112
+ '#FFCC33'
113
+ ];
114
+
115
+ /**
116
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
117
+ * and the Firebug extension (any Firefox version) are known
118
+ * to support "%c" CSS customizations.
119
+ *
120
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
121
+ */
122
+
123
+ // eslint-disable-next-line complexity
124
+ function useColors() {
125
+ // NB: In an Electron preload script, document will be defined but not fully
126
+ // initialized. Since we know we're in Chrome, we'll just detect this case
127
+ // explicitly
128
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
129
+ return true;
130
+ }
131
+
132
+ // Internet Explorer and Edge do not support colors.
133
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
134
+ return false;
135
+ }
136
+
137
+ let m;
138
+
139
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
140
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
141
+ // eslint-disable-next-line no-return-assign
142
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
143
+ // Is firebug? http://stackoverflow.com/a/398120/376773
144
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
145
+ // Is firefox >= v31?
146
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
147
+ (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
148
+ // Double check webkit in userAgent just in case we are in a worker
149
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
150
+ }
151
+
152
+ /**
153
+ * Colorize log arguments if enabled.
154
+ *
155
+ * @api public
156
+ */
157
+
158
+ function formatArgs(args) {
159
+ args[0] = (this.useColors ? '%c' : '') +
160
+ this.namespace +
161
+ (this.useColors ? ' %c' : ' ') +
162
+ args[0] +
163
+ (this.useColors ? '%c ' : ' ') +
164
+ '+' + module.exports.humanize(this.diff);
165
+
166
+ if (!this.useColors) {
167
+ return;
168
+ }
169
+
170
+ const c = 'color: ' + this.color;
171
+ args.splice(1, 0, c, 'color: inherit');
172
+
173
+ // The final "%c" is somewhat tricky, because there could be other
174
+ // arguments passed either before or after the %c, so we need to
175
+ // figure out the correct index to insert the CSS into
176
+ let index = 0;
177
+ let lastC = 0;
178
+ args[0].replace(/%[a-zA-Z%]/g, match => {
179
+ if (match === '%%') {
180
+ return;
181
+ }
182
+ index++;
183
+ if (match === '%c') {
184
+ // We only are interested in the *last* %c
185
+ // (the user may have provided their own)
186
+ lastC = index;
187
+ }
188
+ });
189
+
190
+ args.splice(lastC, 0, c);
191
+ }
192
+
193
+ /**
194
+ * Invokes `console.debug()` when available.
195
+ * No-op when `console.debug` is not a "function".
196
+ * If `console.debug` is not available, falls back
197
+ * to `console.log`.
198
+ *
199
+ * @api public
200
+ */
201
+ exports.log = console.debug || console.log || (() => {});
202
+
203
+ /**
204
+ * Save `namespaces`.
205
+ *
206
+ * @param {String} namespaces
207
+ * @api private
208
+ */
209
+ function save(namespaces) {
210
+ try {
211
+ if (namespaces) {
212
+ exports.storage.setItem('debug', namespaces);
213
+ } else {
214
+ exports.storage.removeItem('debug');
215
+ }
216
+ } catch (error) {
217
+ // Swallow
218
+ // XXX (@Qix-) should we be logging these?
219
+ }
220
+ }
221
+
222
+ /**
223
+ * Load `namespaces`.
224
+ *
225
+ * @return {String} returns the previously persisted debug modes
226
+ * @api private
227
+ */
228
+ function load() {
229
+ let r;
230
+ try {
231
+ r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;
232
+ } catch (error) {
233
+ // Swallow
234
+ // XXX (@Qix-) should we be logging these?
235
+ }
236
+
237
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
238
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
239
+ r = process.env.DEBUG;
240
+ }
241
+
242
+ return r;
243
+ }
244
+
245
+ /**
246
+ * Localstorage attempts to return the localstorage.
247
+ *
248
+ * This is necessary because safari throws
249
+ * when a user disables cookies/localstorage
250
+ * and you attempt to access it.
251
+ *
252
+ * @return {LocalStorage}
253
+ * @api private
254
+ */
255
+
256
+ function localstorage() {
257
+ try {
258
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
259
+ // The Browser also has localStorage in the global context.
260
+ return localStorage;
261
+ } catch (error) {
262
+ // Swallow
263
+ // XXX (@Qix-) should we be logging these?
264
+ }
265
+ }
266
+
267
+ module.exports = requireCommon()(exports);
268
+
269
+ const {formatters} = module.exports;
270
+
271
+ /**
272
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
273
+ */
274
+
275
+ formatters.j = function (v) {
276
+ try {
277
+ return JSON.stringify(v);
278
+ } catch (error) {
279
+ return '[UnexpectedJSONParseError]: ' + error.message;
280
+ }
281
+ };
282
+ } (browser, browser.exports));
283
+ return browser.exports;
284
+ }
285
+
286
+ export { requireBrowser as __require };
@@ -0,0 +1,303 @@
1
+ import { __require as requireMs } from '../../ms/index.js';
2
+
3
+ var common;
4
+ var hasRequiredCommon;
5
+
6
+ function requireCommon () {
7
+ if (hasRequiredCommon) return common;
8
+ hasRequiredCommon = 1;
9
+ /**
10
+ * This is the common logic for both the Node.js and web browser
11
+ * implementations of `debug()`.
12
+ */
13
+
14
+ function setup(env) {
15
+ createDebug.debug = createDebug;
16
+ createDebug.default = createDebug;
17
+ createDebug.coerce = coerce;
18
+ createDebug.disable = disable;
19
+ createDebug.enable = enable;
20
+ createDebug.enabled = enabled;
21
+ createDebug.humanize = requireMs();
22
+ createDebug.destroy = destroy;
23
+
24
+ Object.keys(env).forEach(key => {
25
+ createDebug[key] = env[key];
26
+ });
27
+
28
+ /**
29
+ * The currently active debug mode names, and names to skip.
30
+ */
31
+
32
+ createDebug.names = [];
33
+ createDebug.skips = [];
34
+
35
+ /**
36
+ * Map of special "%n" handling functions, for the debug "format" argument.
37
+ *
38
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
39
+ */
40
+ createDebug.formatters = {};
41
+
42
+ /**
43
+ * Selects a color for a debug namespace
44
+ * @param {String} namespace The namespace string for the debug instance to be colored
45
+ * @return {Number|String} An ANSI color code for the given namespace
46
+ * @api private
47
+ */
48
+ function selectColor(namespace) {
49
+ let hash = 0;
50
+
51
+ for (let i = 0; i < namespace.length; i++) {
52
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
53
+ hash |= 0; // Convert to 32bit integer
54
+ }
55
+
56
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
57
+ }
58
+ createDebug.selectColor = selectColor;
59
+
60
+ /**
61
+ * Create a debugger with the given `namespace`.
62
+ *
63
+ * @param {String} namespace
64
+ * @return {Function}
65
+ * @api public
66
+ */
67
+ function createDebug(namespace) {
68
+ let prevTime;
69
+ let enableOverride = null;
70
+ let namespacesCache;
71
+ let enabledCache;
72
+
73
+ function debug(...args) {
74
+ // Disabled?
75
+ if (!debug.enabled) {
76
+ return;
77
+ }
78
+
79
+ const self = debug;
80
+
81
+ // Set `diff` timestamp
82
+ const curr = Number(new Date());
83
+ const ms = curr - (prevTime || curr);
84
+ self.diff = ms;
85
+ self.prev = prevTime;
86
+ self.curr = curr;
87
+ prevTime = curr;
88
+
89
+ args[0] = createDebug.coerce(args[0]);
90
+
91
+ if (typeof args[0] !== 'string') {
92
+ // Anything else let's inspect with %O
93
+ args.unshift('%O');
94
+ }
95
+
96
+ // Apply any `formatters` transformations
97
+ let index = 0;
98
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
99
+ // If we encounter an escaped % then don't increase the array index
100
+ if (match === '%%') {
101
+ return '%';
102
+ }
103
+ index++;
104
+ const formatter = createDebug.formatters[format];
105
+ if (typeof formatter === 'function') {
106
+ const val = args[index];
107
+ match = formatter.call(self, val);
108
+
109
+ // Now we need to remove `args[index]` since it's inlined in the `format`
110
+ args.splice(index, 1);
111
+ index--;
112
+ }
113
+ return match;
114
+ });
115
+
116
+ // Apply env-specific formatting (colors, etc.)
117
+ createDebug.formatArgs.call(self, args);
118
+
119
+ const logFn = self.log || createDebug.log;
120
+ logFn.apply(self, args);
121
+ }
122
+
123
+ debug.namespace = namespace;
124
+ debug.useColors = createDebug.useColors();
125
+ debug.color = createDebug.selectColor(namespace);
126
+ debug.extend = extend;
127
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
128
+
129
+ Object.defineProperty(debug, 'enabled', {
130
+ enumerable: true,
131
+ configurable: false,
132
+ get: () => {
133
+ if (enableOverride !== null) {
134
+ return enableOverride;
135
+ }
136
+ if (namespacesCache !== createDebug.namespaces) {
137
+ namespacesCache = createDebug.namespaces;
138
+ enabledCache = createDebug.enabled(namespace);
139
+ }
140
+
141
+ return enabledCache;
142
+ },
143
+ set: v => {
144
+ enableOverride = v;
145
+ }
146
+ });
147
+
148
+ // Env-specific initialization logic for debug instances
149
+ if (typeof createDebug.init === 'function') {
150
+ createDebug.init(debug);
151
+ }
152
+
153
+ return debug;
154
+ }
155
+
156
+ function extend(namespace, delimiter) {
157
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
158
+ newDebug.log = this.log;
159
+ return newDebug;
160
+ }
161
+
162
+ /**
163
+ * Enables a debug mode by namespaces. This can include modes
164
+ * separated by a colon and wildcards.
165
+ *
166
+ * @param {String} namespaces
167
+ * @api public
168
+ */
169
+ function enable(namespaces) {
170
+ createDebug.save(namespaces);
171
+ createDebug.namespaces = namespaces;
172
+
173
+ createDebug.names = [];
174
+ createDebug.skips = [];
175
+
176
+ const split = (typeof namespaces === 'string' ? namespaces : '')
177
+ .trim()
178
+ .replace(/\s+/g, ',')
179
+ .split(',')
180
+ .filter(Boolean);
181
+
182
+ for (const ns of split) {
183
+ if (ns[0] === '-') {
184
+ createDebug.skips.push(ns.slice(1));
185
+ } else {
186
+ createDebug.names.push(ns);
187
+ }
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Checks if the given string matches a namespace template, honoring
193
+ * asterisks as wildcards.
194
+ *
195
+ * @param {String} search
196
+ * @param {String} template
197
+ * @return {Boolean}
198
+ */
199
+ function matchesTemplate(search, template) {
200
+ let searchIndex = 0;
201
+ let templateIndex = 0;
202
+ let starIndex = -1;
203
+ let matchIndex = 0;
204
+
205
+ while (searchIndex < search.length) {
206
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
207
+ // Match character or proceed with wildcard
208
+ if (template[templateIndex] === '*') {
209
+ starIndex = templateIndex;
210
+ matchIndex = searchIndex;
211
+ templateIndex++; // Skip the '*'
212
+ } else {
213
+ searchIndex++;
214
+ templateIndex++;
215
+ }
216
+ } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
217
+ // Backtrack to the last '*' and try to match more characters
218
+ templateIndex = starIndex + 1;
219
+ matchIndex++;
220
+ searchIndex = matchIndex;
221
+ } else {
222
+ return false; // No match
223
+ }
224
+ }
225
+
226
+ // Handle trailing '*' in template
227
+ while (templateIndex < template.length && template[templateIndex] === '*') {
228
+ templateIndex++;
229
+ }
230
+
231
+ return templateIndex === template.length;
232
+ }
233
+
234
+ /**
235
+ * Disable debug output.
236
+ *
237
+ * @return {String} namespaces
238
+ * @api public
239
+ */
240
+ function disable() {
241
+ const namespaces = [
242
+ ...createDebug.names,
243
+ ...createDebug.skips.map(namespace => '-' + namespace)
244
+ ].join(',');
245
+ createDebug.enable('');
246
+ return namespaces;
247
+ }
248
+
249
+ /**
250
+ * Returns true if the given mode name is enabled, false otherwise.
251
+ *
252
+ * @param {String} name
253
+ * @return {Boolean}
254
+ * @api public
255
+ */
256
+ function enabled(name) {
257
+ for (const skip of createDebug.skips) {
258
+ if (matchesTemplate(name, skip)) {
259
+ return false;
260
+ }
261
+ }
262
+
263
+ for (const ns of createDebug.names) {
264
+ if (matchesTemplate(name, ns)) {
265
+ return true;
266
+ }
267
+ }
268
+
269
+ return false;
270
+ }
271
+
272
+ /**
273
+ * Coerce `val`.
274
+ *
275
+ * @param {Mixed} val
276
+ * @return {Mixed}
277
+ * @api private
278
+ */
279
+ function coerce(val) {
280
+ if (val instanceof Error) {
281
+ return val.stack || val.message;
282
+ }
283
+ return val;
284
+ }
285
+
286
+ /**
287
+ * XXX DO NOT USE. This is a temporary stub function.
288
+ * XXX It WILL be removed in the next major release.
289
+ */
290
+ function destroy() {
291
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
292
+ }
293
+
294
+ createDebug.enable(createDebug.load());
295
+
296
+ return createDebug;
297
+ }
298
+
299
+ common = setup;
300
+ return common;
301
+ }
302
+
303
+ export { requireCommon as __require };