pnpm 6.22.1 → 6.23.2

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 (113) hide show
  1. package/dist/node_modules/ansi-regex/index.js +8 -2
  2. package/dist/node_modules/ansi-regex/license +4 -16
  3. package/dist/node_modules/ansi-regex/package.json +53 -62
  4. package/dist/node_modules/aproba/index.js +33 -33
  5. package/dist/node_modules/aproba/package.json +5 -4
  6. package/dist/node_modules/are-we-there-yet/{index.js → lib/index.js} +0 -0
  7. package/dist/node_modules/are-we-there-yet/{tracker-base.js → lib/tracker-base.js} +0 -0
  8. package/dist/node_modules/are-we-there-yet/{tracker-group.js → lib/tracker-group.js} +14 -5
  9. package/dist/node_modules/are-we-there-yet/{tracker-stream.js → lib/tracker-stream.js} +0 -0
  10. package/dist/node_modules/are-we-there-yet/{tracker.js → lib/tracker.js} +3 -1
  11. package/dist/node_modules/are-we-there-yet/package.json +35 -17
  12. package/dist/node_modules/{npmlog → color-support}/LICENSE +0 -0
  13. package/dist/node_modules/color-support/bin.js +3 -0
  14. package/dist/node_modules/color-support/browser.js +14 -0
  15. package/dist/node_modules/color-support/index.js +134 -0
  16. package/dist/node_modules/color-support/package.json +36 -0
  17. package/dist/node_modules/gauge/{base-theme.js → lib/base-theme.js} +7 -3
  18. package/dist/node_modules/gauge/lib/demo.js +45 -0
  19. package/dist/node_modules/gauge/{error.js → lib/error.js} +0 -0
  20. package/dist/node_modules/gauge/lib/has-color.js +4 -0
  21. package/dist/node_modules/gauge/{index.js → lib/index.js} +90 -33
  22. package/dist/node_modules/gauge/{plumbing.js → lib/plumbing.js} +3 -1
  23. package/dist/node_modules/gauge/{process.js → lib/process.js} +0 -0
  24. package/dist/node_modules/gauge/{progress-bar.js → lib/progress-bar.js} +12 -6
  25. package/dist/node_modules/gauge/{render-template.js → lib/render-template.js} +69 -28
  26. package/dist/node_modules/gauge/{set-immediate.js → lib/set-immediate.js} +0 -0
  27. package/dist/node_modules/gauge/{set-interval.js → lib/set-interval.js} +0 -0
  28. package/dist/node_modules/gauge/{spin.js → lib/spin.js} +0 -0
  29. package/dist/node_modules/gauge/{template-item.js → lib/template-item.js} +21 -7
  30. package/dist/node_modules/gauge/{theme-set.js → lib/theme-set.js} +31 -24
  31. package/dist/node_modules/gauge/lib/themes.js +56 -0
  32. package/dist/node_modules/gauge/{wide-truncate.js → lib/wide-truncate.js} +9 -3
  33. package/dist/node_modules/gauge/package.json +39 -40
  34. package/dist/node_modules/is-fullwidth-code-point/index.js +40 -36
  35. package/dist/node_modules/is-fullwidth-code-point/license +4 -16
  36. package/dist/node_modules/is-fullwidth-code-point/package.json +40 -43
  37. package/dist/node_modules/node-gyp/package.json +2 -2
  38. package/dist/node_modules/npmlog/{log.js → lib/log.js} +148 -54
  39. package/dist/node_modules/npmlog/package.json +30 -12
  40. package/dist/node_modules/readable-stream/errors-browser.js +127 -0
  41. package/dist/node_modules/readable-stream/errors.js +116 -0
  42. package/dist/node_modules/readable-stream/experimentalWarning.js +17 -0
  43. package/dist/node_modules/readable-stream/lib/_stream_duplex.js +52 -44
  44. package/dist/node_modules/readable-stream/lib/_stream_passthrough.js +1 -9
  45. package/dist/node_modules/readable-stream/lib/_stream_readable.js +446 -341
  46. package/dist/node_modules/readable-stream/lib/_stream_transform.js +29 -42
  47. package/dist/node_modules/readable-stream/lib/_stream_writable.js +200 -190
  48. package/dist/node_modules/readable-stream/lib/internal/streams/async_iterator.js +207 -0
  49. package/dist/node_modules/readable-stream/lib/internal/streams/buffer_list.js +210 -0
  50. package/dist/node_modules/readable-stream/lib/internal/streams/destroy.js +48 -17
  51. package/dist/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +104 -0
  52. package/dist/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
  53. package/dist/node_modules/readable-stream/lib/internal/streams/from.js +64 -0
  54. package/dist/node_modules/readable-stream/lib/internal/streams/pipeline.js +97 -0
  55. package/dist/node_modules/readable-stream/lib/internal/streams/state.js +27 -0
  56. package/dist/node_modules/readable-stream/package.json +35 -19
  57. package/dist/node_modules/readable-stream/readable-browser.js +2 -0
  58. package/dist/node_modules/readable-stream/readable.js +5 -8
  59. package/dist/node_modules/safe-buffer/index.js +3 -0
  60. package/dist/node_modules/safe-buffer/package.json +18 -4
  61. package/dist/node_modules/signal-exit/index.js +30 -8
  62. package/dist/node_modules/signal-exit/package.json +7 -5
  63. package/dist/node_modules/socks-proxy-agent/package.json +2 -2
  64. package/dist/node_modules/string-width/index.js +29 -19
  65. package/dist/node_modules/string-width/license +4 -16
  66. package/dist/node_modules/string-width/package.json +54 -54
  67. package/dist/node_modules/string_decoder/package.json +5 -2
  68. package/dist/node_modules/strip-ansi/index.js +2 -4
  69. package/dist/node_modules/strip-ansi/license +4 -16
  70. package/dist/node_modules/strip-ansi/package.json +52 -55
  71. package/dist/pnpm.cjs +746 -667
  72. package/package.json +18 -18
  73. package/dist/node_modules/are-we-there-yet/LICENSE +0 -5
  74. package/dist/node_modules/code-point-at/index.js +0 -32
  75. package/dist/node_modules/code-point-at/license +0 -21
  76. package/dist/node_modules/code-point-at/package.json +0 -38
  77. package/dist/node_modules/core-util-is/LICENSE +0 -19
  78. package/dist/node_modules/core-util-is/lib/util.js +0 -107
  79. package/dist/node_modules/core-util-is/package.json +0 -38
  80. package/dist/node_modules/gauge/LICENSE +0 -13
  81. package/dist/node_modules/gauge/has-color.js +0 -12
  82. package/dist/node_modules/gauge/themes.js +0 -54
  83. package/dist/node_modules/isarray/component.json +0 -19
  84. package/dist/node_modules/isarray/index.js +0 -5
  85. package/dist/node_modules/isarray/package.json +0 -45
  86. package/dist/node_modules/isarray/test.js +0 -20
  87. package/dist/node_modules/number-is-nan/index.js +0 -4
  88. package/dist/node_modules/number-is-nan/license +0 -21
  89. package/dist/node_modules/number-is-nan/package.json +0 -35
  90. package/dist/node_modules/object-assign/index.js +0 -90
  91. package/dist/node_modules/object-assign/license +0 -21
  92. package/dist/node_modules/object-assign/package.json +0 -42
  93. package/dist/node_modules/process-nextick-args/index.js +0 -45
  94. package/dist/node_modules/process-nextick-args/package.json +0 -25
  95. package/dist/node_modules/readable-stream/duplex-browser.js +0 -1
  96. package/dist/node_modules/readable-stream/duplex.js +0 -1
  97. package/dist/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
  98. package/dist/node_modules/readable-stream/passthrough.js +0 -1
  99. package/dist/node_modules/readable-stream/transform.js +0 -1
  100. package/dist/node_modules/readable-stream/writable-browser.js +0 -1
  101. package/dist/node_modules/readable-stream/writable.js +0 -8
  102. package/dist/node_modules/wide-align/node_modules/ansi-regex/index.js +0 -10
  103. package/dist/node_modules/wide-align/node_modules/ansi-regex/license +0 -9
  104. package/dist/node_modules/wide-align/node_modules/ansi-regex/package.json +0 -55
  105. package/dist/node_modules/wide-align/node_modules/is-fullwidth-code-point/index.js +0 -50
  106. package/dist/node_modules/wide-align/node_modules/is-fullwidth-code-point/license +0 -9
  107. package/dist/node_modules/wide-align/node_modules/is-fullwidth-code-point/package.json +0 -42
  108. package/dist/node_modules/wide-align/node_modules/string-width/index.js +0 -47
  109. package/dist/node_modules/wide-align/node_modules/string-width/license +0 -9
  110. package/dist/node_modules/wide-align/node_modules/string-width/package.json +0 -56
  111. package/dist/node_modules/wide-align/node_modules/strip-ansi/index.js +0 -4
  112. package/dist/node_modules/wide-align/node_modules/strip-ansi/license +0 -9
  113. package/dist/node_modules/wide-align/node_modules/strip-ansi/package.json +0 -54
@@ -13,11 +13,13 @@ var stream = process.stderr
13
13
  Object.defineProperty(log, 'stream', {
14
14
  set: function (newStream) {
15
15
  stream = newStream
16
- if (this.gauge) this.gauge.setWriteTo(stream, stream)
16
+ if (this.gauge) {
17
+ this.gauge.setWriteTo(stream, stream)
18
+ }
17
19
  },
18
20
  get: function () {
19
21
  return stream
20
- }
22
+ },
21
23
  })
22
24
 
23
25
  // by default, decide based on tty-ness.
@@ -28,11 +30,11 @@ log.useColor = function () {
28
30
 
29
31
  log.enableColor = function () {
30
32
  colorEnabled = true
31
- this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled})
33
+ this.gauge.setTheme({ hasColor: colorEnabled, hasUnicode: unicodeEnabled })
32
34
  }
33
35
  log.disableColor = function () {
34
36
  colorEnabled = false
35
- this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled})
37
+ this.gauge.setTheme({ hasColor: colorEnabled, hasUnicode: unicodeEnabled })
36
38
  }
37
39
 
38
40
  // default level
@@ -40,14 +42,14 @@ log.level = 'info'
40
42
 
41
43
  log.gauge = new Gauge(stream, {
42
44
  enabled: false, // no progress bars unless asked
43
- theme: {hasColor: log.useColor()},
45
+ theme: { hasColor: log.useColor() },
44
46
  template: [
45
- {type: 'progressbar', length: 20},
46
- {type: 'activityIndicator', kerning: 1, length: 1},
47
- {type: 'section', default: ''},
47
+ { type: 'progressbar', length: 20 },
48
+ { type: 'activityIndicator', kerning: 1, length: 1 },
49
+ { type: 'section', default: '' },
48
50
  ':',
49
- {type: 'logline', kerning: 1, default: ''}
50
- ]
51
+ { type: 'logline', kerning: 1, default: '' },
52
+ ],
51
53
  })
52
54
 
53
55
  log.tracker = new Progress.TrackerGroup()
@@ -60,12 +62,12 @@ var unicodeEnabled
60
62
 
61
63
  log.enableUnicode = function () {
62
64
  unicodeEnabled = true
63
- this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
65
+ this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: unicodeEnabled })
64
66
  }
65
67
 
66
68
  log.disableUnicode = function () {
67
69
  unicodeEnabled = false
68
- this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
70
+ this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: unicodeEnabled })
69
71
  }
70
72
 
71
73
  log.setGaugeThemeset = function (themes) {
@@ -77,15 +79,23 @@ log.setGaugeTemplate = function (template) {
77
79
  }
78
80
 
79
81
  log.enableProgress = function () {
80
- if (this.progressEnabled) return
82
+ if (this.progressEnabled) {
83
+ return
84
+ }
85
+
81
86
  this.progressEnabled = true
82
87
  this.tracker.on('change', this.showProgress)
83
- if (this._pause) return
88
+ if (this._paused) {
89
+ return
90
+ }
91
+
84
92
  this.gauge.enable()
85
93
  }
86
94
 
87
95
  log.disableProgress = function () {
88
- if (!this.progressEnabled) return
96
+ if (!this.progressEnabled) {
97
+ return
98
+ }
89
99
  this.progressEnabled = false
90
100
  this.tracker.removeListener('change', this.showProgress)
91
101
  this.gauge.disable()
@@ -97,10 +107,24 @@ var mixinLog = function (tracker) {
97
107
  // mixin the public methods from log into the tracker
98
108
  // (except: conflicts and one's we handle specially)
99
109
  Object.keys(log).forEach(function (P) {
100
- if (P[0] === '_') return
101
- if (trackerConstructors.filter(function (C) { return C === P }).length) return
102
- if (tracker[P]) return
103
- if (typeof log[P] !== 'function') return
110
+ if (P[0] === '_') {
111
+ return
112
+ }
113
+
114
+ if (trackerConstructors.filter(function (C) {
115
+ return C === P
116
+ }).length) {
117
+ return
118
+ }
119
+
120
+ if (tracker[P]) {
121
+ return
122
+ }
123
+
124
+ if (typeof log[P] !== 'function') {
125
+ return
126
+ }
127
+
104
128
  var func = log[P]
105
129
  tracker[P] = function () {
106
130
  return func.apply(log, arguments)
@@ -111,7 +135,9 @@ var mixinLog = function (tracker) {
111
135
  if (tracker instanceof Progress.TrackerGroup) {
112
136
  trackerConstructors.forEach(function (C) {
113
137
  var func = tracker[C]
114
- tracker[C] = function () { return mixinLog(func.apply(tracker, arguments)) }
138
+ tracker[C] = function () {
139
+ return mixinLog(func.apply(tracker, arguments))
140
+ }
115
141
  })
116
142
  }
117
143
  return tracker
@@ -119,24 +145,38 @@ var mixinLog = function (tracker) {
119
145
 
120
146
  // Add tracker constructors to the top level log object
121
147
  trackerConstructors.forEach(function (C) {
122
- log[C] = function () { return mixinLog(this.tracker[C].apply(this.tracker, arguments)) }
148
+ log[C] = function () {
149
+ return mixinLog(this.tracker[C].apply(this.tracker, arguments))
150
+ }
123
151
  })
124
152
 
125
153
  log.clearProgress = function (cb) {
126
- if (!this.progressEnabled) return cb && process.nextTick(cb)
154
+ if (!this.progressEnabled) {
155
+ return cb && process.nextTick(cb)
156
+ }
157
+
127
158
  this.gauge.hide(cb)
128
159
  }
129
160
 
130
161
  log.showProgress = function (name, completed) {
131
- if (!this.progressEnabled) return
162
+ if (!this.progressEnabled) {
163
+ return
164
+ }
165
+
132
166
  var values = {}
133
- if (name) values.section = name
167
+ if (name) {
168
+ values.section = name
169
+ }
170
+
134
171
  var last = log.record[log.record.length - 1]
135
172
  if (last) {
136
173
  values.subsection = last.prefix
137
174
  var disp = log.disp[last.level] || last.level
138
175
  var logline = this._format(disp, log.style[last.level])
139
- if (last.prefix) logline += ' ' + this._format(last.prefix, this.prefixStyle)
176
+ if (last.prefix) {
177
+ logline += ' ' + this._format(last.prefix, this.prefixStyle)
178
+ }
179
+
140
180
  logline += ' ' + last.message.split(/\r?\n/)[0]
141
181
  values.logline = logline
142
182
  }
@@ -147,11 +187,16 @@ log.showProgress = function (name, completed) {
147
187
  // temporarily stop emitting, but don't drop
148
188
  log.pause = function () {
149
189
  this._paused = true
150
- if (this.progressEnabled) this.gauge.disable()
190
+ if (this.progressEnabled) {
191
+ this.gauge.disable()
192
+ }
151
193
  }
152
194
 
153
195
  log.resume = function () {
154
- if (!this._paused) return
196
+ if (!this._paused) {
197
+ return
198
+ }
199
+
155
200
  this._paused = false
156
201
 
157
202
  var b = this._buffer
@@ -159,7 +204,9 @@ log.resume = function () {
159
204
  b.forEach(function (m) {
160
205
  this.emitLog(m)
161
206
  }, this)
162
- if (this.progressEnabled) this.gauge.enable()
207
+ if (this.progressEnabled) {
208
+ this.gauge.enable()
209
+ }
163
210
  }
164
211
 
165
212
  log._buffer = []
@@ -180,28 +227,32 @@ log.log = function (lvl, prefix, message) {
180
227
  var arg = a[i - 2] = arguments[i]
181
228
 
182
229
  // resolve stack traces to a plain string.
183
- if (typeof arg === 'object' && arg &&
184
- (arg instanceof Error) && arg.stack) {
185
-
230
+ if (typeof arg === 'object' && arg instanceof Error && arg.stack) {
186
231
  Object.defineProperty(arg, 'stack', {
187
232
  value: stack = arg.stack + '',
188
233
  enumerable: true,
189
- writable: true
234
+ writable: true,
190
235
  })
191
236
  }
192
237
  }
193
- if (stack) a.unshift(stack + '\n')
238
+ if (stack) {
239
+ a.unshift(stack + '\n')
240
+ }
194
241
  message = util.format.apply(util, a)
195
242
 
196
- var m = { id: id++,
197
- level: lvl,
198
- prefix: String(prefix || ''),
199
- message: message,
200
- messageRaw: a }
243
+ var m = {
244
+ id: id++,
245
+ level: lvl,
246
+ prefix: String(prefix || ''),
247
+ message: message,
248
+ messageRaw: a,
249
+ }
201
250
 
202
251
  this.emit('log', m)
203
252
  this.emit('log.' + lvl, m)
204
- if (m.prefix) this.emit(m.prefix, m)
253
+ if (m.prefix) {
254
+ this.emit(m.prefix, m)
255
+ }
205
256
 
206
257
  this.record.push(m)
207
258
  var mrs = this.maxRecordSize
@@ -219,11 +270,22 @@ log.emitLog = function (m) {
219
270
  this._buffer.push(m)
220
271
  return
221
272
  }
222
- if (this.progressEnabled) this.gauge.pulse(m.prefix)
273
+ if (this.progressEnabled) {
274
+ this.gauge.pulse(m.prefix)
275
+ }
276
+
223
277
  var l = this.levels[m.level]
224
- if (l === undefined) return
225
- if (l < this.levels[this.level]) return
226
- if (l > 0 && !isFinite(l)) return
278
+ if (l === undefined) {
279
+ return
280
+ }
281
+
282
+ if (l < this.levels[this.level]) {
283
+ return
284
+ }
285
+
286
+ if (l > 0 && !isFinite(l)) {
287
+ return
288
+ }
227
289
 
228
290
  // If 'disp' is null or undefined, use the lvl as a default
229
291
  // Allows: '', 0 as valid disp
@@ -236,7 +298,10 @@ log.emitLog = function (m) {
236
298
  }
237
299
  this.write(disp, log.style[m.level])
238
300
  var p = m.prefix || ''
239
- if (p) this.write(' ')
301
+ if (p) {
302
+ this.write(' ')
303
+ }
304
+
240
305
  this.write(p, this.prefixStyle)
241
306
  this.write(' ' + line + '\n')
242
307
  }, this)
@@ -244,36 +309,64 @@ log.emitLog = function (m) {
244
309
  }
245
310
 
246
311
  log._format = function (msg, style) {
247
- if (!stream) return
312
+ if (!stream) {
313
+ return
314
+ }
248
315
 
249
316
  var output = ''
250
317
  if (this.useColor()) {
251
318
  style = style || {}
252
319
  var settings = []
253
- if (style.fg) settings.push(style.fg)
254
- if (style.bg) settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1))
255
- if (style.bold) settings.push('bold')
256
- if (style.underline) settings.push('underline')
257
- if (style.inverse) settings.push('inverse')
258
- if (settings.length) output += consoleControl.color(settings)
259
- if (style.beep) output += consoleControl.beep()
320
+ if (style.fg) {
321
+ settings.push(style.fg)
322
+ }
323
+
324
+ if (style.bg) {
325
+ settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1))
326
+ }
327
+
328
+ if (style.bold) {
329
+ settings.push('bold')
330
+ }
331
+
332
+ if (style.underline) {
333
+ settings.push('underline')
334
+ }
335
+
336
+ if (style.inverse) {
337
+ settings.push('inverse')
338
+ }
339
+
340
+ if (settings.length) {
341
+ output += consoleControl.color(settings)
342
+ }
343
+
344
+ if (style.beep) {
345
+ output += consoleControl.beep()
346
+ }
260
347
  }
261
348
  output += msg
262
349
  if (this.useColor()) {
263
350
  output += consoleControl.color('reset')
264
351
  }
352
+
265
353
  return output
266
354
  }
267
355
 
268
356
  log.write = function (msg, style) {
269
- if (!stream) return
357
+ if (!stream) {
358
+ return
359
+ }
270
360
 
271
361
  stream.write(this._format(msg, style))
272
362
  }
273
363
 
274
364
  log.addLevel = function (lvl, n, style, disp) {
275
365
  // If 'disp' is null or undefined, use the lvl as a default
276
- if (disp == null) disp = lvl
366
+ if (disp == null) {
367
+ disp = lvl
368
+ }
369
+
277
370
  this.levels[lvl] = n
278
371
  this.style[lvl] = style
279
372
  if (!this[lvl]) {
@@ -283,6 +376,7 @@ log.addLevel = function (lvl, n, style, disp) {
283
376
  for (var i = 0; i < arguments.length; i++) {
284
377
  a[i + 1] = arguments[i]
285
378
  }
379
+
286
380
  return this.log.apply(this, a)
287
381
  }.bind(this)
288
382
  }
@@ -1,28 +1,46 @@
1
1
  {
2
- "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
2
+ "author": "GitHub Inc.",
3
3
  "name": "npmlog",
4
4
  "description": "logger for npm",
5
- "version": "4.1.2",
5
+ "version": "6.0.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/npm/npmlog.git"
9
9
  },
10
- "main": "log.js",
10
+ "main": "lib/log.js",
11
11
  "files": [
12
- "log.js"
12
+ "bin",
13
+ "lib"
13
14
  ],
14
15
  "scripts": {
15
- "test": "standard && tap test/*.js"
16
+ "test": "tap",
17
+ "npmclilint": "npmcli-lint",
18
+ "lint": "eslint '**/*.js'",
19
+ "lintfix": "npm run lint -- --fix",
20
+ "posttest": "npm run lint",
21
+ "postsnap": "npm run lintfix --",
22
+ "postlint": "npm-template-check",
23
+ "preversion": "npm test",
24
+ "postversion": "npm publish",
25
+ "prepublishOnly": "git push origin --follow-tags",
26
+ "snap": "tap"
16
27
  },
17
28
  "dependencies": {
18
- "are-we-there-yet": "~1.1.2",
19
- "console-control-strings": "~1.1.0",
20
- "gauge": "~2.7.3",
21
- "set-blocking": "~2.0.0"
29
+ "are-we-there-yet": "^2.0.0",
30
+ "console-control-strings": "^1.1.0",
31
+ "gauge": "^4.0.0",
32
+ "set-blocking": "^2.0.0"
22
33
  },
23
34
  "devDependencies": {
24
- "standard": "~7.1.2",
25
- "tap": "~5.7.3"
35
+ "@npmcli/template-oss": "^2.3.0",
36
+ "tap": "^15.0.9"
26
37
  },
27
- "license": "ISC"
38
+ "license": "ISC",
39
+ "templateVersion": "2.3.0",
40
+ "engines": {
41
+ "node": "^12.13.0 || ^14.15.0 || >=16"
42
+ },
43
+ "tap": {
44
+ "branches": 95
45
+ }
28
46
  }
@@ -0,0 +1,127 @@
1
+ 'use strict';
2
+
3
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
4
+
5
+ var codes = {};
6
+
7
+ function createErrorType(code, message, Base) {
8
+ if (!Base) {
9
+ Base = Error;
10
+ }
11
+
12
+ function getMessage(arg1, arg2, arg3) {
13
+ if (typeof message === 'string') {
14
+ return message;
15
+ } else {
16
+ return message(arg1, arg2, arg3);
17
+ }
18
+ }
19
+
20
+ var NodeError =
21
+ /*#__PURE__*/
22
+ function (_Base) {
23
+ _inheritsLoose(NodeError, _Base);
24
+
25
+ function NodeError(arg1, arg2, arg3) {
26
+ return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
27
+ }
28
+
29
+ return NodeError;
30
+ }(Base);
31
+
32
+ NodeError.prototype.name = Base.name;
33
+ NodeError.prototype.code = code;
34
+ codes[code] = NodeError;
35
+ } // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
36
+
37
+
38
+ function oneOf(expected, thing) {
39
+ if (Array.isArray(expected)) {
40
+ var len = expected.length;
41
+ expected = expected.map(function (i) {
42
+ return String(i);
43
+ });
44
+
45
+ if (len > 2) {
46
+ return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];
47
+ } else if (len === 2) {
48
+ return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
49
+ } else {
50
+ return "of ".concat(thing, " ").concat(expected[0]);
51
+ }
52
+ } else {
53
+ return "of ".concat(thing, " ").concat(String(expected));
54
+ }
55
+ } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
56
+
57
+
58
+ function startsWith(str, search, pos) {
59
+ return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
60
+ } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
61
+
62
+
63
+ function endsWith(str, search, this_len) {
64
+ if (this_len === undefined || this_len > str.length) {
65
+ this_len = str.length;
66
+ }
67
+
68
+ return str.substring(this_len - search.length, this_len) === search;
69
+ } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
70
+
71
+
72
+ function includes(str, search, start) {
73
+ if (typeof start !== 'number') {
74
+ start = 0;
75
+ }
76
+
77
+ if (start + search.length > str.length) {
78
+ return false;
79
+ } else {
80
+ return str.indexOf(search, start) !== -1;
81
+ }
82
+ }
83
+
84
+ createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
85
+ return 'The value "' + value + '" is invalid for option "' + name + '"';
86
+ }, TypeError);
87
+ createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
88
+ // determiner: 'must be' or 'must not be'
89
+ var determiner;
90
+
91
+ if (typeof expected === 'string' && startsWith(expected, 'not ')) {
92
+ determiner = 'must not be';
93
+ expected = expected.replace(/^not /, '');
94
+ } else {
95
+ determiner = 'must be';
96
+ }
97
+
98
+ var msg;
99
+
100
+ if (endsWith(name, ' argument')) {
101
+ // For cases like 'first argument'
102
+ msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
103
+ } else {
104
+ var type = includes(name, '.') ? 'property' : 'argument';
105
+ msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
106
+ }
107
+
108
+ msg += ". Received type ".concat(typeof actual);
109
+ return msg;
110
+ }, TypeError);
111
+ createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
112
+ createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
113
+ return 'The ' + name + ' method is not implemented';
114
+ });
115
+ createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
116
+ createErrorType('ERR_STREAM_DESTROYED', function (name) {
117
+ return 'Cannot call ' + name + ' after a stream was destroyed';
118
+ });
119
+ createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
120
+ createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
121
+ createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
122
+ createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
123
+ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
124
+ return 'Unknown encoding: ' + arg;
125
+ }, TypeError);
126
+ createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
127
+ module.exports.codes = codes;
@@ -0,0 +1,116 @@
1
+ 'use strict';
2
+
3
+ const codes = {};
4
+
5
+ function createErrorType(code, message, Base) {
6
+ if (!Base) {
7
+ Base = Error
8
+ }
9
+
10
+ function getMessage (arg1, arg2, arg3) {
11
+ if (typeof message === 'string') {
12
+ return message
13
+ } else {
14
+ return message(arg1, arg2, arg3)
15
+ }
16
+ }
17
+
18
+ class NodeError extends Base {
19
+ constructor (arg1, arg2, arg3) {
20
+ super(getMessage(arg1, arg2, arg3));
21
+ }
22
+ }
23
+
24
+ NodeError.prototype.name = Base.name;
25
+ NodeError.prototype.code = code;
26
+
27
+ codes[code] = NodeError;
28
+ }
29
+
30
+ // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
31
+ function oneOf(expected, thing) {
32
+ if (Array.isArray(expected)) {
33
+ const len = expected.length;
34
+ expected = expected.map((i) => String(i));
35
+ if (len > 2) {
36
+ return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` +
37
+ expected[len - 1];
38
+ } else if (len === 2) {
39
+ return `one of ${thing} ${expected[0]} or ${expected[1]}`;
40
+ } else {
41
+ return `of ${thing} ${expected[0]}`;
42
+ }
43
+ } else {
44
+ return `of ${thing} ${String(expected)}`;
45
+ }
46
+ }
47
+
48
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
49
+ function startsWith(str, search, pos) {
50
+ return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
51
+ }
52
+
53
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
54
+ function endsWith(str, search, this_len) {
55
+ if (this_len === undefined || this_len > str.length) {
56
+ this_len = str.length;
57
+ }
58
+ return str.substring(this_len - search.length, this_len) === search;
59
+ }
60
+
61
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
62
+ function includes(str, search, start) {
63
+ if (typeof start !== 'number') {
64
+ start = 0;
65
+ }
66
+
67
+ if (start + search.length > str.length) {
68
+ return false;
69
+ } else {
70
+ return str.indexOf(search, start) !== -1;
71
+ }
72
+ }
73
+
74
+ createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
75
+ return 'The value "' + value + '" is invalid for option "' + name + '"'
76
+ }, TypeError);
77
+ createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
78
+ // determiner: 'must be' or 'must not be'
79
+ let determiner;
80
+ if (typeof expected === 'string' && startsWith(expected, 'not ')) {
81
+ determiner = 'must not be';
82
+ expected = expected.replace(/^not /, '');
83
+ } else {
84
+ determiner = 'must be';
85
+ }
86
+
87
+ let msg;
88
+ if (endsWith(name, ' argument')) {
89
+ // For cases like 'first argument'
90
+ msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;
91
+ } else {
92
+ const type = includes(name, '.') ? 'property' : 'argument';
93
+ msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`;
94
+ }
95
+
96
+ msg += `. Received type ${typeof actual}`;
97
+ return msg;
98
+ }, TypeError);
99
+ createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
100
+ createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
101
+ return 'The ' + name + ' method is not implemented'
102
+ });
103
+ createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
104
+ createErrorType('ERR_STREAM_DESTROYED', function (name) {
105
+ return 'Cannot call ' + name + ' after a stream was destroyed';
106
+ });
107
+ createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
108
+ createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
109
+ createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
110
+ createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
111
+ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
112
+ return 'Unknown encoding: ' + arg
113
+ }, TypeError);
114
+ createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
115
+
116
+ module.exports.codes = codes;
@@ -0,0 +1,17 @@
1
+ 'use strict'
2
+
3
+ var experimentalWarnings = new Set();
4
+
5
+ function emitExperimentalWarning(feature) {
6
+ if (experimentalWarnings.has(feature)) return;
7
+ var msg = feature + ' is an experimental feature. This feature could ' +
8
+ 'change at any time';
9
+ experimentalWarnings.add(feature);
10
+ process.emitWarning(msg, 'ExperimentalWarning');
11
+ }
12
+
13
+ function noop() {}
14
+
15
+ module.exports.emitExperimentalWarning = process.emitWarning
16
+ ? emitExperimentalWarning
17
+ : noop;