@bytecodealliance/jco 0.4.2 → 0.5.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.
package/api.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__bytecodealliance_componentize_js_a7e85369__ from "@bytecodealliance/componentize-js";
2
1
  import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
3
2
  /******/ var __webpack_modules__ = ({
4
3
 
@@ -2783,60 +2782,48 @@ module.exports.q = codes;
2783
2782
  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2784
2783
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2785
2784
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
2785
+
2786
2786
  // a duplex stream is just a stream that is both readable and writable.
2787
2787
  // Since JS doesn't have multiple prototypal inheritance, this class
2788
2788
  // prototypally inherits from Readable, and then parasitically from
2789
2789
  // Writable.
2790
2790
 
2791
- /*<replacement>*/
2792
2791
 
2792
+
2793
+ /*<replacement>*/
2793
2794
  var objectKeys = Object.keys || function (obj) {
2794
2795
  var keys = [];
2795
-
2796
- for (var key in obj) {
2797
- keys.push(key);
2798
- }
2799
-
2796
+ for (var key in obj) keys.push(key);
2800
2797
  return keys;
2801
2798
  };
2802
2799
  /*</replacement>*/
2803
2800
 
2804
-
2805
2801
  module.exports = Duplex;
2806
-
2807
2802
  var Readable = __nccwpck_require__(1433);
2808
-
2809
2803
  var Writable = __nccwpck_require__(6993);
2810
-
2811
2804
  __nccwpck_require__(4124)(Duplex, Readable);
2812
-
2813
2805
  {
2814
2806
  // Allow the keys array to be GC'ed.
2815
2807
  var keys = objectKeys(Writable.prototype);
2816
-
2817
2808
  for (var v = 0; v < keys.length; v++) {
2818
2809
  var method = keys[v];
2819
2810
  if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
2820
2811
  }
2821
2812
  }
2822
-
2823
2813
  function Duplex(options) {
2824
2814
  if (!(this instanceof Duplex)) return new Duplex(options);
2825
2815
  Readable.call(this, options);
2826
2816
  Writable.call(this, options);
2827
2817
  this.allowHalfOpen = true;
2828
-
2829
2818
  if (options) {
2830
2819
  if (options.readable === false) this.readable = false;
2831
2820
  if (options.writable === false) this.writable = false;
2832
-
2833
2821
  if (options.allowHalfOpen === false) {
2834
2822
  this.allowHalfOpen = false;
2835
2823
  this.once('end', onend);
2836
2824
  }
2837
2825
  }
2838
2826
  }
2839
-
2840
2827
  Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
2841
2828
  // making it explicit this property is not enumerable
2842
2829
  // because otherwise some prototype manipulation in
@@ -2863,20 +2850,20 @@ Object.defineProperty(Duplex.prototype, 'writableLength', {
2863
2850
  get: function get() {
2864
2851
  return this._writableState.length;
2865
2852
  }
2866
- }); // the no-half-open enforcer
2853
+ });
2867
2854
 
2855
+ // the no-half-open enforcer
2868
2856
  function onend() {
2869
2857
  // If the writable side ended, then we're ok.
2870
- if (this._writableState.ended) return; // no more data can be written.
2871
- // But allow more writes to happen in this tick.
2858
+ if (this._writableState.ended) return;
2872
2859
 
2860
+ // no more data can be written.
2861
+ // But allow more writes to happen in this tick.
2873
2862
  process.nextTick(onEndNT, this);
2874
2863
  }
2875
-
2876
2864
  function onEndNT(self) {
2877
2865
  self.end();
2878
2866
  }
2879
-
2880
2867
  Object.defineProperty(Duplex.prototype, 'destroyed', {
2881
2868
  // making it explicit this property is not enumerable
2882
2869
  // because otherwise some prototype manipulation in
@@ -2886,7 +2873,6 @@ Object.defineProperty(Duplex.prototype, 'destroyed', {
2886
2873
  if (this._readableState === undefined || this._writableState === undefined) {
2887
2874
  return false;
2888
2875
  }
2889
-
2890
2876
  return this._readableState.destroyed && this._writableState.destroyed;
2891
2877
  },
2892
2878
  set: function set(value) {
@@ -2894,10 +2880,10 @@ Object.defineProperty(Duplex.prototype, 'destroyed', {
2894
2880
  // has not been initialized yet
2895
2881
  if (this._readableState === undefined || this._writableState === undefined) {
2896
2882
  return;
2897
- } // backward compatibility, the user is explicitly
2898
- // managing destroyed
2899
-
2883
+ }
2900
2884
 
2885
+ // backward compatibility, the user is explicitly
2886
+ // managing destroyed
2901
2887
  this._readableState.destroyed = value;
2902
2888
  this._writableState.destroyed = value;
2903
2889
  }
@@ -2928,22 +2914,20 @@ Object.defineProperty(Duplex.prototype, 'destroyed', {
2928
2914
  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2929
2915
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2930
2916
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
2917
+
2931
2918
  // a passthrough stream.
2932
2919
  // basically just the most minimal sort of Transform stream.
2933
2920
  // Every written chunk gets output as-is.
2934
2921
 
2935
2922
 
2936
- module.exports = PassThrough;
2937
2923
 
2924
+ module.exports = PassThrough;
2938
2925
  var Transform = __nccwpck_require__(4415);
2939
-
2940
2926
  __nccwpck_require__(4124)(PassThrough, Transform);
2941
-
2942
2927
  function PassThrough(options) {
2943
2928
  if (!(this instanceof PassThrough)) return new PassThrough(options);
2944
2929
  Transform.call(this, options);
2945
2930
  }
2946
-
2947
2931
  PassThrough.prototype._transform = function (chunk, encoding, cb) {
2948
2932
  cb(null, chunk);
2949
2933
  };
@@ -2975,47 +2959,38 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) {
2975
2959
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
2976
2960
 
2977
2961
 
2962
+
2978
2963
  module.exports = Readable;
2979
- /*<replacement>*/
2980
2964
 
2965
+ /*<replacement>*/
2981
2966
  var Duplex;
2982
2967
  /*</replacement>*/
2983
2968
 
2984
2969
  Readable.ReadableState = ReadableState;
2985
- /*<replacement>*/
2986
2970
 
2971
+ /*<replacement>*/
2987
2972
  var EE = (__nccwpck_require__(2361).EventEmitter);
2988
-
2989
2973
  var EElistenerCount = function EElistenerCount(emitter, type) {
2990
2974
  return emitter.listeners(type).length;
2991
2975
  };
2992
2976
  /*</replacement>*/
2993
2977
 
2994
2978
  /*<replacement>*/
2995
-
2996
-
2997
2979
  var Stream = __nccwpck_require__(2387);
2998
2980
  /*</replacement>*/
2999
2981
 
3000
-
3001
2982
  var Buffer = (__nccwpck_require__(4300).Buffer);
3002
-
3003
- var OurUint8Array = global.Uint8Array || function () {};
3004
-
2983
+ var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
3005
2984
  function _uint8ArrayToBuffer(chunk) {
3006
2985
  return Buffer.from(chunk);
3007
2986
  }
3008
-
3009
2987
  function _isUint8Array(obj) {
3010
2988
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
3011
2989
  }
3012
- /*<replacement>*/
3013
-
3014
2990
 
2991
+ /*<replacement>*/
3015
2992
  var debugUtil = __nccwpck_require__(3837);
3016
-
3017
2993
  var debug;
3018
-
3019
2994
  if (debugUtil && debugUtil.debuglog) {
3020
2995
  debug = debugUtil.debuglog('stream');
3021
2996
  } else {
@@ -3023,60 +2998,57 @@ if (debugUtil && debugUtil.debuglog) {
3023
2998
  }
3024
2999
  /*</replacement>*/
3025
3000
 
3026
-
3027
3001
  var BufferList = __nccwpck_require__(2746);
3028
-
3029
3002
  var destroyImpl = __nccwpck_require__(7049);
3030
-
3031
3003
  var _require = __nccwpck_require__(9948),
3032
- getHighWaterMark = _require.getHighWaterMark;
3033
-
3004
+ getHighWaterMark = _require.getHighWaterMark;
3034
3005
  var _require$codes = (__nccwpck_require__(7214)/* .codes */ .q),
3035
- ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
3036
- ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
3037
- ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
3038
- ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance.
3039
-
3006
+ ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
3007
+ ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
3008
+ ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
3009
+ ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
3040
3010
 
3011
+ // Lazy loaded to improve the startup performance.
3041
3012
  var StringDecoder;
3042
3013
  var createReadableStreamAsyncIterator;
3043
3014
  var from;
3044
-
3045
3015
  __nccwpck_require__(4124)(Readable, Stream);
3046
-
3047
3016
  var errorOrDestroy = destroyImpl.errorOrDestroy;
3048
3017
  var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
3049
-
3050
3018
  function prependListener(emitter, event, fn) {
3051
3019
  // Sadly this is not cacheable as some libraries bundle their own
3052
3020
  // event emitter implementation with them.
3053
- if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any
3021
+ if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
3022
+
3023
+ // This is a hack to make sure that our error handler is attached before any
3054
3024
  // userland ones. NEVER DO THIS. This is here only because this code needs
3055
3025
  // to continue to work with older versions of Node.js that do not include
3056
3026
  // the prependListener() method. The goal is to eventually remove this hack.
3057
-
3058
3027
  if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
3059
3028
  }
3060
-
3061
3029
  function ReadableState(options, stream, isDuplex) {
3062
3030
  Duplex = Duplex || __nccwpck_require__(1359);
3063
- options = options || {}; // Duplex streams are both readable and writable, but share
3031
+ options = options || {};
3032
+
3033
+ // Duplex streams are both readable and writable, but share
3064
3034
  // the same options object.
3065
3035
  // However, some cases require setting options to different
3066
3036
  // values for the readable and the writable sides of the duplex stream.
3067
3037
  // These options can be provided separately as readableXXX and writableXXX.
3038
+ if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;
3068
3039
 
3069
- if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to
3040
+ // object stream flag. Used to make read(n) ignore n and to
3070
3041
  // make all the buffer merging and length checks go away
3071
-
3072
3042
  this.objectMode = !!options.objectMode;
3073
- if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer
3043
+ if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
3044
+
3045
+ // the point at which it stops calling _read() to fill the buffer
3074
3046
  // Note: 0 is a valid value, means "don't call _read preemptively ever"
3047
+ this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex);
3075
3048
 
3076
- this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the
3049
+ // A linked list is used to store data chunks instead of an array because the
3077
3050
  // linked list can remove elements from the beginning faster than
3078
3051
  // array.shift()
3079
-
3080
3052
  this.buffer = new BufferList();
3081
3053
  this.length = 0;
3082
3054
  this.pipes = null;
@@ -3084,61 +3056,66 @@ function ReadableState(options, stream, isDuplex) {
3084
3056
  this.flowing = null;
3085
3057
  this.ended = false;
3086
3058
  this.endEmitted = false;
3087
- this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted
3059
+ this.reading = false;
3060
+
3061
+ // a flag to be able to tell if the event 'readable'/'data' is emitted
3088
3062
  // immediately, or on a later tick. We set this to true at first, because
3089
3063
  // any actions that shouldn't happen until "later" should generally also
3090
3064
  // not happen before the first read call.
3065
+ this.sync = true;
3091
3066
 
3092
- this.sync = true; // whenever we return null, then we set a flag to say
3067
+ // whenever we return null, then we set a flag to say
3093
3068
  // that we're awaiting a 'readable' event emission.
3094
-
3095
3069
  this.needReadable = false;
3096
3070
  this.emittedReadable = false;
3097
3071
  this.readableListening = false;
3098
3072
  this.resumeScheduled = false;
3099
- this.paused = true; // Should close be emitted on destroy. Defaults to true.
3073
+ this.paused = true;
3074
+
3075
+ // Should close be emitted on destroy. Defaults to true.
3076
+ this.emitClose = options.emitClose !== false;
3100
3077
 
3101
- this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish')
3078
+ // Should .destroy() be called after 'end' (and potentially 'finish')
3079
+ this.autoDestroy = !!options.autoDestroy;
3102
3080
 
3103
- this.autoDestroy = !!options.autoDestroy; // has it been destroyed
3081
+ // has it been destroyed
3082
+ this.destroyed = false;
3104
3083
 
3105
- this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string
3084
+ // Crypto is kind of old and crusty. Historically, its default string
3106
3085
  // encoding is 'binary' so we have to make this configurable.
3107
3086
  // Everything else in the universe uses 'utf8', though.
3087
+ this.defaultEncoding = options.defaultEncoding || 'utf8';
3108
3088
 
3109
- this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s
3110
-
3111
- this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled
3089
+ // the number of writers that are awaiting a drain event in .pipe()s
3090
+ this.awaitDrain = 0;
3112
3091
 
3092
+ // if true, a maybeReadMore has been scheduled
3113
3093
  this.readingMore = false;
3114
3094
  this.decoder = null;
3115
3095
  this.encoding = null;
3116
-
3117
3096
  if (options.encoding) {
3118
3097
  if (!StringDecoder) StringDecoder = (__nccwpck_require__(4841)/* .StringDecoder */ .s);
3119
3098
  this.decoder = new StringDecoder(options.encoding);
3120
3099
  this.encoding = options.encoding;
3121
3100
  }
3122
3101
  }
3123
-
3124
3102
  function Readable(options) {
3125
3103
  Duplex = Duplex || __nccwpck_require__(1359);
3126
- if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside
3127
- // the ReadableState constructor, at least with V8 6.5
3104
+ if (!(this instanceof Readable)) return new Readable(options);
3128
3105
 
3106
+ // Checking for a Stream.Duplex instance is faster here instead of inside
3107
+ // the ReadableState constructor, at least with V8 6.5
3129
3108
  var isDuplex = this instanceof Duplex;
3130
- this._readableState = new ReadableState(options, this, isDuplex); // legacy
3109
+ this._readableState = new ReadableState(options, this, isDuplex);
3131
3110
 
3111
+ // legacy
3132
3112
  this.readable = true;
3133
-
3134
3113
  if (options) {
3135
3114
  if (typeof options.read === 'function') this._read = options.read;
3136
3115
  if (typeof options.destroy === 'function') this._destroy = options.destroy;
3137
3116
  }
3138
-
3139
3117
  Stream.call(this);
3140
3118
  }
3141
-
3142
3119
  Object.defineProperty(Readable.prototype, 'destroyed', {
3143
3120
  // making it explicit this property is not enumerable
3144
3121
  // because otherwise some prototype manipulation in
@@ -3148,7 +3125,6 @@ Object.defineProperty(Readable.prototype, 'destroyed', {
3148
3125
  if (this._readableState === undefined) {
3149
3126
  return false;
3150
3127
  }
3151
-
3152
3128
  return this._readableState.destroyed;
3153
3129
  },
3154
3130
  set: function set(value) {
@@ -3156,69 +3132,60 @@ Object.defineProperty(Readable.prototype, 'destroyed', {
3156
3132
  // has not been initialized yet
3157
3133
  if (!this._readableState) {
3158
3134
  return;
3159
- } // backward compatibility, the user is explicitly
3160
- // managing destroyed
3161
-
3135
+ }
3162
3136
 
3137
+ // backward compatibility, the user is explicitly
3138
+ // managing destroyed
3163
3139
  this._readableState.destroyed = value;
3164
3140
  }
3165
3141
  });
3166
3142
  Readable.prototype.destroy = destroyImpl.destroy;
3167
3143
  Readable.prototype._undestroy = destroyImpl.undestroy;
3168
-
3169
3144
  Readable.prototype._destroy = function (err, cb) {
3170
3145
  cb(err);
3171
- }; // Manually shove something into the read() buffer.
3146
+ };
3147
+
3148
+ // Manually shove something into the read() buffer.
3172
3149
  // This returns true if the highWaterMark has not been hit yet,
3173
3150
  // similar to how Writable.write() returns true if you should
3174
3151
  // write() some more.
3175
-
3176
-
3177
3152
  Readable.prototype.push = function (chunk, encoding) {
3178
3153
  var state = this._readableState;
3179
3154
  var skipChunkCheck;
3180
-
3181
3155
  if (!state.objectMode) {
3182
3156
  if (typeof chunk === 'string') {
3183
3157
  encoding = encoding || state.defaultEncoding;
3184
-
3185
3158
  if (encoding !== state.encoding) {
3186
3159
  chunk = Buffer.from(chunk, encoding);
3187
3160
  encoding = '';
3188
3161
  }
3189
-
3190
3162
  skipChunkCheck = true;
3191
3163
  }
3192
3164
  } else {
3193
3165
  skipChunkCheck = true;
3194
3166
  }
3195
-
3196
3167
  return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
3197
- }; // Unshift should *always* be something directly out of read()
3198
-
3168
+ };
3199
3169
 
3170
+ // Unshift should *always* be something directly out of read()
3200
3171
  Readable.prototype.unshift = function (chunk) {
3201
3172
  return readableAddChunk(this, chunk, null, true, false);
3202
3173
  };
3203
-
3204
3174
  function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
3205
3175
  debug('readableAddChunk', chunk);
3206
3176
  var state = stream._readableState;
3207
-
3208
3177
  if (chunk === null) {
3209
3178
  state.reading = false;
3210
3179
  onEofChunk(stream, state);
3211
3180
  } else {
3212
3181
  var er;
3213
3182
  if (!skipChunkCheck) er = chunkInvalid(state, chunk);
3214
-
3215
3183
  if (er) {
3216
3184
  errorOrDestroy(stream, er);
3217
3185
  } else if (state.objectMode || chunk && chunk.length > 0) {
3218
3186
  if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
3219
3187
  chunk = _uint8ArrayToBuffer(chunk);
3220
3188
  }
3221
-
3222
3189
  if (addToFront) {
3223
3190
  if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);
3224
3191
  } else if (state.ended) {
@@ -3227,7 +3194,6 @@ function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
3227
3194
  return false;
3228
3195
  } else {
3229
3196
  state.reading = false;
3230
-
3231
3197
  if (state.decoder && !encoding) {
3232
3198
  chunk = state.decoder.write(chunk);
3233
3199
  if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
@@ -3239,14 +3205,13 @@ function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
3239
3205
  state.reading = false;
3240
3206
  maybeReadMore(stream, state);
3241
3207
  }
3242
- } // We can push more data if we are below the highWaterMark.
3208
+ }
3209
+
3210
+ // We can push more data if we are below the highWaterMark.
3243
3211
  // Also, if we have no data yet, we can stand some more bytes.
3244
3212
  // This is to work around cases where hwm=0, such as the repl.
3245
-
3246
-
3247
3213
  return !state.ended && (state.length < state.highWaterMark || state.length === 0);
3248
3214
  }
3249
-
3250
3215
  function addChunk(stream, state, chunk, addToFront) {
3251
3216
  if (state.flowing && state.length === 0 && !state.sync) {
3252
3217
  state.awaitDrain = 0;
@@ -3257,50 +3222,42 @@ function addChunk(stream, state, chunk, addToFront) {
3257
3222
  if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
3258
3223
  if (state.needReadable) emitReadable(stream);
3259
3224
  }
3260
-
3261
3225
  maybeReadMore(stream, state);
3262
3226
  }
3263
-
3264
3227
  function chunkInvalid(state, chunk) {
3265
3228
  var er;
3266
-
3267
3229
  if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
3268
3230
  er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);
3269
3231
  }
3270
-
3271
3232
  return er;
3272
3233
  }
3273
-
3274
3234
  Readable.prototype.isPaused = function () {
3275
3235
  return this._readableState.flowing === false;
3276
- }; // backwards compatibility.
3277
-
3236
+ };
3278
3237
 
3238
+ // backwards compatibility.
3279
3239
  Readable.prototype.setEncoding = function (enc) {
3280
3240
  if (!StringDecoder) StringDecoder = (__nccwpck_require__(4841)/* .StringDecoder */ .s);
3281
3241
  var decoder = new StringDecoder(enc);
3282
- this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8
3283
-
3284
- this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers:
3242
+ this._readableState.decoder = decoder;
3243
+ // If setEncoding(null), decoder.encoding equals utf8
3244
+ this._readableState.encoding = this._readableState.decoder.encoding;
3285
3245
 
3246
+ // Iterate over current buffer to convert already stored Buffers:
3286
3247
  var p = this._readableState.buffer.head;
3287
3248
  var content = '';
3288
-
3289
3249
  while (p !== null) {
3290
3250
  content += decoder.write(p.data);
3291
3251
  p = p.next;
3292
3252
  }
3293
-
3294
3253
  this._readableState.buffer.clear();
3295
-
3296
3254
  if (content !== '') this._readableState.buffer.push(content);
3297
3255
  this._readableState.length = content.length;
3298
3256
  return this;
3299
- }; // Don't raise the hwm > 1GB
3300
-
3257
+ };
3301
3258
 
3259
+ // Don't raise the hwm > 1GB
3302
3260
  var MAX_HWM = 0x40000000;
3303
-
3304
3261
  function computeNewHighWaterMark(n) {
3305
3262
  if (n >= MAX_HWM) {
3306
3263
  // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.
@@ -3316,55 +3273,54 @@ function computeNewHighWaterMark(n) {
3316
3273
  n |= n >>> 16;
3317
3274
  n++;
3318
3275
  }
3319
-
3320
3276
  return n;
3321
- } // This function is designed to be inlinable, so please take care when making
3322
- // changes to the function body.
3323
-
3277
+ }
3324
3278
 
3279
+ // This function is designed to be inlinable, so please take care when making
3280
+ // changes to the function body.
3325
3281
  function howMuchToRead(n, state) {
3326
3282
  if (n <= 0 || state.length === 0 && state.ended) return 0;
3327
3283
  if (state.objectMode) return 1;
3328
-
3329
3284
  if (n !== n) {
3330
3285
  // Only flow one buffer at a time
3331
3286
  if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
3332
- } // If we're asking for more than the current hwm, then raise the hwm.
3333
-
3334
-
3287
+ }
3288
+ // If we're asking for more than the current hwm, then raise the hwm.
3335
3289
  if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
3336
- if (n <= state.length) return n; // Don't have enough
3337
-
3290
+ if (n <= state.length) return n;
3291
+ // Don't have enough
3338
3292
  if (!state.ended) {
3339
3293
  state.needReadable = true;
3340
3294
  return 0;
3341
3295
  }
3342
-
3343
3296
  return state.length;
3344
- } // you can override either this method, or the async _read(n) below.
3345
-
3297
+ }
3346
3298
 
3299
+ // you can override either this method, or the async _read(n) below.
3347
3300
  Readable.prototype.read = function (n) {
3348
3301
  debug('read', n);
3349
3302
  n = parseInt(n, 10);
3350
3303
  var state = this._readableState;
3351
3304
  var nOrig = n;
3352
- if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we
3305
+ if (n !== 0) state.emittedReadable = false;
3306
+
3307
+ // if we're doing read(0) to trigger a readable event, but we
3353
3308
  // already have a bunch of data in the buffer, then just trigger
3354
3309
  // the 'readable' event and move on.
3355
-
3356
3310
  if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
3357
3311
  debug('read: emitReadable', state.length, state.ended);
3358
3312
  if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
3359
3313
  return null;
3360
3314
  }
3315
+ n = howMuchToRead(n, state);
3361
3316
 
3362
- n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.
3363
-
3317
+ // if we've ended, and we're now clear, then finish it up.
3364
3318
  if (n === 0 && state.ended) {
3365
3319
  if (state.length === 0) endReadable(this);
3366
3320
  return null;
3367
- } // All the actual chunk generation logic needs to be
3321
+ }
3322
+
3323
+ // All the actual chunk generation logic needs to be
3368
3324
  // *below* the call to _read. The reason is that in certain
3369
3325
  // synthetic stream cases, such as passthrough streams, _read
3370
3326
  // may be a completely synchronous operation which may change
@@ -3385,40 +3341,37 @@ Readable.prototype.read = function (n) {
3385
3341
  // 'readable' etc.
3386
3342
  //
3387
3343
  // 3. Actually pull the requested chunks out of the buffer and return.
3388
- // if we need a readable event, then we need to do some reading.
3389
-
3390
3344
 
3345
+ // if we need a readable event, then we need to do some reading.
3391
3346
  var doRead = state.needReadable;
3392
- debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some
3347
+ debug('need readable', doRead);
3393
3348
 
3349
+ // if we currently have less than the highWaterMark, then also read some
3394
3350
  if (state.length === 0 || state.length - n < state.highWaterMark) {
3395
3351
  doRead = true;
3396
3352
  debug('length less than watermark', doRead);
3397
- } // however, if we've ended, then there's no point, and if we're already
3398
- // reading, then it's unnecessary.
3399
-
3353
+ }
3400
3354
 
3355
+ // however, if we've ended, then there's no point, and if we're already
3356
+ // reading, then it's unnecessary.
3401
3357
  if (state.ended || state.reading) {
3402
3358
  doRead = false;
3403
3359
  debug('reading or ended', doRead);
3404
3360
  } else if (doRead) {
3405
3361
  debug('do read');
3406
3362
  state.reading = true;
3407
- state.sync = true; // if the length is currently zero, then we *need* a readable event.
3408
-
3409
- if (state.length === 0) state.needReadable = true; // call internal read method
3410
-
3363
+ state.sync = true;
3364
+ // if the length is currently zero, then we *need* a readable event.
3365
+ if (state.length === 0) state.needReadable = true;
3366
+ // call internal read method
3411
3367
  this._read(state.highWaterMark);
3412
-
3413
- state.sync = false; // If _read pushed data synchronously, then `reading` will be false,
3368
+ state.sync = false;
3369
+ // If _read pushed data synchronously, then `reading` will be false,
3414
3370
  // and we need to re-evaluate how much data we can return to the user.
3415
-
3416
3371
  if (!state.reading) n = howMuchToRead(nOrig, state);
3417
3372
  }
3418
-
3419
3373
  var ret;
3420
3374
  if (n > 0) ret = fromList(n, state);else ret = null;
3421
-
3422
3375
  if (ret === null) {
3423
3376
  state.needReadable = state.length <= state.highWaterMark;
3424
3377
  n = 0;
@@ -3426,34 +3379,28 @@ Readable.prototype.read = function (n) {
3426
3379
  state.length -= n;
3427
3380
  state.awaitDrain = 0;
3428
3381
  }
3429
-
3430
3382
  if (state.length === 0) {
3431
3383
  // If we have nothing in the buffer, then we want to know
3432
3384
  // as soon as we *do* get something into the buffer.
3433
- if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.
3385
+ if (!state.ended) state.needReadable = true;
3434
3386
 
3387
+ // If we tried to read() past the EOF, then emit end on the next tick.
3435
3388
  if (nOrig !== n && state.ended) endReadable(this);
3436
3389
  }
3437
-
3438
3390
  if (ret !== null) this.emit('data', ret);
3439
3391
  return ret;
3440
3392
  };
3441
-
3442
3393
  function onEofChunk(stream, state) {
3443
3394
  debug('onEofChunk');
3444
3395
  if (state.ended) return;
3445
-
3446
3396
  if (state.decoder) {
3447
3397
  var chunk = state.decoder.end();
3448
-
3449
3398
  if (chunk && chunk.length) {
3450
3399
  state.buffer.push(chunk);
3451
3400
  state.length += state.objectMode ? 1 : chunk.length;
3452
3401
  }
3453
3402
  }
3454
-
3455
3403
  state.ended = true;
3456
-
3457
3404
  if (state.sync) {
3458
3405
  // if we are sync, wait until next tick to emit the data.
3459
3406
  // Otherwise we risk emitting data in the flow()
@@ -3462,61 +3409,56 @@ function onEofChunk(stream, state) {
3462
3409
  } else {
3463
3410
  // emit 'readable' now to make sure it gets picked up.
3464
3411
  state.needReadable = false;
3465
-
3466
3412
  if (!state.emittedReadable) {
3467
3413
  state.emittedReadable = true;
3468
3414
  emitReadable_(stream);
3469
3415
  }
3470
3416
  }
3471
- } // Don't emit readable right away in sync mode, because this can trigger
3417
+ }
3418
+
3419
+ // Don't emit readable right away in sync mode, because this can trigger
3472
3420
  // another read() call => stack overflow. This way, it might trigger
3473
3421
  // a nextTick recursion warning, but that's not so bad.
3474
-
3475
-
3476
3422
  function emitReadable(stream) {
3477
3423
  var state = stream._readableState;
3478
3424
  debug('emitReadable', state.needReadable, state.emittedReadable);
3479
3425
  state.needReadable = false;
3480
-
3481
3426
  if (!state.emittedReadable) {
3482
3427
  debug('emitReadable', state.flowing);
3483
3428
  state.emittedReadable = true;
3484
3429
  process.nextTick(emitReadable_, stream);
3485
3430
  }
3486
3431
  }
3487
-
3488
3432
  function emitReadable_(stream) {
3489
3433
  var state = stream._readableState;
3490
3434
  debug('emitReadable_', state.destroyed, state.length, state.ended);
3491
-
3492
3435
  if (!state.destroyed && (state.length || state.ended)) {
3493
3436
  stream.emit('readable');
3494
3437
  state.emittedReadable = false;
3495
- } // The stream needs another readable event if
3438
+ }
3439
+
3440
+ // The stream needs another readable event if
3496
3441
  // 1. It is not flowing, as the flow mechanism will take
3497
3442
  // care of it.
3498
3443
  // 2. It is not ended.
3499
3444
  // 3. It is below the highWaterMark, so we can schedule
3500
3445
  // another readable later.
3501
-
3502
-
3503
3446
  state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
3504
3447
  flow(stream);
3505
- } // at this point, the user has presumably seen the 'readable' event,
3448
+ }
3449
+
3450
+ // at this point, the user has presumably seen the 'readable' event,
3506
3451
  // and called read() to consume some data. that may have triggered
3507
3452
  // in turn another _read(n) call, in which case reading = true if
3508
3453
  // it's in progress.
3509
3454
  // However, if we're not ended, or reading, and the length < hwm,
3510
3455
  // then go ahead and try to read some more preemptively.
3511
-
3512
-
3513
3456
  function maybeReadMore(stream, state) {
3514
3457
  if (!state.readingMore) {
3515
3458
  state.readingMore = true;
3516
3459
  process.nextTick(maybeReadMore_, stream, state);
3517
3460
  }
3518
3461
  }
3519
-
3520
3462
  function maybeReadMore_(stream, state) {
3521
3463
  // Attempt to read more data if we should.
3522
3464
  //
@@ -3545,49 +3487,42 @@ function maybeReadMore_(stream, state) {
3545
3487
  var len = state.length;
3546
3488
  debug('maybeReadMore read 0');
3547
3489
  stream.read(0);
3548
- if (len === state.length) // didn't get any data, stop spinning.
3490
+ if (len === state.length)
3491
+ // didn't get any data, stop spinning.
3549
3492
  break;
3550
3493
  }
3551
-
3552
3494
  state.readingMore = false;
3553
- } // abstract method. to be overridden in specific implementation classes.
3495
+ }
3496
+
3497
+ // abstract method. to be overridden in specific implementation classes.
3554
3498
  // call cb(er, data) where data is <= n in length.
3555
3499
  // for virtual (non-string, non-buffer) streams, "length" is somewhat
3556
3500
  // arbitrary, and perhaps not very meaningful.
3557
-
3558
-
3559
3501
  Readable.prototype._read = function (n) {
3560
3502
  errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));
3561
3503
  };
3562
-
3563
3504
  Readable.prototype.pipe = function (dest, pipeOpts) {
3564
3505
  var src = this;
3565
3506
  var state = this._readableState;
3566
-
3567
3507
  switch (state.pipesCount) {
3568
3508
  case 0:
3569
3509
  state.pipes = dest;
3570
3510
  break;
3571
-
3572
3511
  case 1:
3573
3512
  state.pipes = [state.pipes, dest];
3574
3513
  break;
3575
-
3576
3514
  default:
3577
3515
  state.pipes.push(dest);
3578
3516
  break;
3579
3517
  }
3580
-
3581
3518
  state.pipesCount += 1;
3582
3519
  debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
3583
3520
  var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
3584
3521
  var endFn = doEnd ? onend : unpipe;
3585
3522
  if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);
3586
3523
  dest.on('unpipe', onunpipe);
3587
-
3588
3524
  function onunpipe(readable, unpipeInfo) {
3589
3525
  debug('onunpipe');
3590
-
3591
3526
  if (readable === src) {
3592
3527
  if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
3593
3528
  unpipeInfo.hasUnpiped = true;
@@ -3595,23 +3530,21 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
3595
3530
  }
3596
3531
  }
3597
3532
  }
3598
-
3599
3533
  function onend() {
3600
3534
  debug('onend');
3601
3535
  dest.end();
3602
- } // when the dest drains, it reduces the awaitDrain counter
3536
+ }
3537
+
3538
+ // when the dest drains, it reduces the awaitDrain counter
3603
3539
  // on the source. This would be more elegant with a .once()
3604
3540
  // handler in flow(), but adding and removing repeatedly is
3605
3541
  // too slow.
3606
-
3607
-
3608
3542
  var ondrain = pipeOnDrain(src);
3609
3543
  dest.on('drain', ondrain);
3610
3544
  var cleanedUp = false;
3611
-
3612
3545
  function cleanup() {
3613
- debug('cleanup'); // cleanup event handlers once the pipe is broken
3614
-
3546
+ debug('cleanup');
3547
+ // cleanup event handlers once the pipe is broken
3615
3548
  dest.removeListener('close', onclose);
3616
3549
  dest.removeListener('finish', onfinish);
3617
3550
  dest.removeListener('drain', ondrain);
@@ -3620,22 +3553,20 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
3620
3553
  src.removeListener('end', onend);
3621
3554
  src.removeListener('end', unpipe);
3622
3555
  src.removeListener('data', ondata);
3623
- cleanedUp = true; // if the reader is waiting for a drain event from this
3556
+ cleanedUp = true;
3557
+
3558
+ // if the reader is waiting for a drain event from this
3624
3559
  // specific writer, then it would cause it to never start
3625
3560
  // flowing again.
3626
3561
  // So, if this is awaiting a drain, then we just call it now.
3627
3562
  // If we don't know, then assume that we are waiting for one.
3628
-
3629
3563
  if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
3630
3564
  }
3631
-
3632
3565
  src.on('data', ondata);
3633
-
3634
3566
  function ondata(chunk) {
3635
3567
  debug('ondata');
3636
3568
  var ret = dest.write(chunk);
3637
3569
  debug('dest.write', ret);
3638
-
3639
3570
  if (ret === false) {
3640
3571
  // If the user unpiped during `dest.write()`, it is possible
3641
3572
  // to get stuck in a permanently paused state if that write
@@ -3645,87 +3576,84 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
3645
3576
  debug('false write response, pause', state.awaitDrain);
3646
3577
  state.awaitDrain++;
3647
3578
  }
3648
-
3649
3579
  src.pause();
3650
3580
  }
3651
- } // if the dest has an error, then stop piping into it.
3652
- // however, don't suppress the throwing behavior for this.
3653
-
3581
+ }
3654
3582
 
3583
+ // if the dest has an error, then stop piping into it.
3584
+ // however, don't suppress the throwing behavior for this.
3655
3585
  function onerror(er) {
3656
3586
  debug('onerror', er);
3657
3587
  unpipe();
3658
3588
  dest.removeListener('error', onerror);
3659
3589
  if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);
3660
- } // Make sure our error handler is attached before userland ones.
3661
-
3590
+ }
3662
3591
 
3663
- prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.
3592
+ // Make sure our error handler is attached before userland ones.
3593
+ prependListener(dest, 'error', onerror);
3664
3594
 
3595
+ // Both close and finish should trigger unpipe, but only once.
3665
3596
  function onclose() {
3666
3597
  dest.removeListener('finish', onfinish);
3667
3598
  unpipe();
3668
3599
  }
3669
-
3670
3600
  dest.once('close', onclose);
3671
-
3672
3601
  function onfinish() {
3673
3602
  debug('onfinish');
3674
3603
  dest.removeListener('close', onclose);
3675
3604
  unpipe();
3676
3605
  }
3677
-
3678
3606
  dest.once('finish', onfinish);
3679
-
3680
3607
  function unpipe() {
3681
3608
  debug('unpipe');
3682
3609
  src.unpipe(dest);
3683
- } // tell the dest that it's being piped to
3684
-
3610
+ }
3685
3611
 
3686
- dest.emit('pipe', src); // start the flow if it hasn't been started already.
3612
+ // tell the dest that it's being piped to
3613
+ dest.emit('pipe', src);
3687
3614
 
3615
+ // start the flow if it hasn't been started already.
3688
3616
  if (!state.flowing) {
3689
3617
  debug('pipe resume');
3690
3618
  src.resume();
3691
3619
  }
3692
-
3693
3620
  return dest;
3694
3621
  };
3695
-
3696
3622
  function pipeOnDrain(src) {
3697
3623
  return function pipeOnDrainFunctionResult() {
3698
3624
  var state = src._readableState;
3699
3625
  debug('pipeOnDrain', state.awaitDrain);
3700
3626
  if (state.awaitDrain) state.awaitDrain--;
3701
-
3702
3627
  if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
3703
3628
  state.flowing = true;
3704
3629
  flow(src);
3705
3630
  }
3706
3631
  };
3707
3632
  }
3708
-
3709
3633
  Readable.prototype.unpipe = function (dest) {
3710
3634
  var state = this._readableState;
3711
3635
  var unpipeInfo = {
3712
3636
  hasUnpiped: false
3713
- }; // if we're not piping anywhere, then do nothing.
3637
+ };
3714
3638
 
3715
- if (state.pipesCount === 0) return this; // just one destination. most common case.
3639
+ // if we're not piping anywhere, then do nothing.
3640
+ if (state.pipesCount === 0) return this;
3716
3641
 
3642
+ // just one destination. most common case.
3717
3643
  if (state.pipesCount === 1) {
3718
3644
  // passed in one, but it's not the right one.
3719
3645
  if (dest && dest !== state.pipes) return this;
3720
- if (!dest) dest = state.pipes; // got a match.
3646
+ if (!dest) dest = state.pipes;
3721
3647
 
3648
+ // got a match.
3722
3649
  state.pipes = null;
3723
3650
  state.pipesCount = 0;
3724
3651
  state.flowing = false;
3725
3652
  if (dest) dest.emit('unpipe', this, unpipeInfo);
3726
3653
  return this;
3727
- } // slow case. multiple pipe destinations.
3654
+ }
3728
3655
 
3656
+ // slow case. multiple pipe destinations.
3729
3657
 
3730
3658
  if (!dest) {
3731
3659
  // remove all.
@@ -3734,17 +3662,13 @@ Readable.prototype.unpipe = function (dest) {
3734
3662
  state.pipes = null;
3735
3663
  state.pipesCount = 0;
3736
3664
  state.flowing = false;
3737
-
3738
- for (var i = 0; i < len; i++) {
3739
- dests[i].emit('unpipe', this, {
3740
- hasUnpiped: false
3741
- });
3742
- }
3743
-
3665
+ for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, {
3666
+ hasUnpiped: false
3667
+ });
3744
3668
  return this;
3745
- } // try to find the right one.
3746
-
3669
+ }
3747
3670
 
3671
+ // try to find the right one.
3748
3672
  var index = indexOf(state.pipes, dest);
3749
3673
  if (index === -1) return this;
3750
3674
  state.pipes.splice(index, 1);
@@ -3752,19 +3676,19 @@ Readable.prototype.unpipe = function (dest) {
3752
3676
  if (state.pipesCount === 1) state.pipes = state.pipes[0];
3753
3677
  dest.emit('unpipe', this, unpipeInfo);
3754
3678
  return this;
3755
- }; // set up data events if they are asked for
3756
- // Ensure readable listeners eventually get something
3757
-
3679
+ };
3758
3680
 
3681
+ // set up data events if they are asked for
3682
+ // Ensure readable listeners eventually get something
3759
3683
  Readable.prototype.on = function (ev, fn) {
3760
3684
  var res = Stream.prototype.on.call(this, ev, fn);
3761
3685
  var state = this._readableState;
3762
-
3763
3686
  if (ev === 'data') {
3764
3687
  // update readableListening so that resume() may be a no-op
3765
3688
  // a few lines down. This is needed to support once('readable').
3766
- state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused
3689
+ state.readableListening = this.listenerCount('readable') > 0;
3767
3690
 
3691
+ // Try start flowing on next tick if stream isn't explicitly paused
3768
3692
  if (state.flowing !== false) this.resume();
3769
3693
  } else if (ev === 'readable') {
3770
3694
  if (!state.endEmitted && !state.readableListening) {
@@ -3772,7 +3696,6 @@ Readable.prototype.on = function (ev, fn) {
3772
3696
  state.flowing = false;
3773
3697
  state.emittedReadable = false;
3774
3698
  debug('on readable', state.length, state.reading);
3775
-
3776
3699
  if (state.length) {
3777
3700
  emitReadable(this);
3778
3701
  } else if (!state.reading) {
@@ -3780,15 +3703,11 @@ Readable.prototype.on = function (ev, fn) {
3780
3703
  }
3781
3704
  }
3782
3705
  }
3783
-
3784
3706
  return res;
3785
3707
  };
3786
-
3787
3708
  Readable.prototype.addListener = Readable.prototype.on;
3788
-
3789
3709
  Readable.prototype.removeListener = function (ev, fn) {
3790
3710
  var res = Stream.prototype.removeListener.call(this, ev, fn);
3791
-
3792
3711
  if (ev === 'readable') {
3793
3712
  // We need to check if there is someone still listening to
3794
3713
  // readable and reset the state. However this needs to happen
@@ -3798,13 +3717,10 @@ Readable.prototype.removeListener = function (ev, fn) {
3798
3717
  // effect.
3799
3718
  process.nextTick(updateReadableListening, this);
3800
3719
  }
3801
-
3802
3720
  return res;
3803
3721
  };
3804
-
3805
3722
  Readable.prototype.removeAllListeners = function (ev) {
3806
3723
  var res = Stream.prototype.removeAllListeners.apply(this, arguments);
3807
-
3808
3724
  if (ev === 'readable' || ev === undefined) {
3809
3725
  // We need to check if there is someone still listening to
3810
3726
  // readable and reset the state. However this needs to happen
@@ -3814,121 +3730,103 @@ Readable.prototype.removeAllListeners = function (ev) {
3814
3730
  // effect.
3815
3731
  process.nextTick(updateReadableListening, this);
3816
3732
  }
3817
-
3818
3733
  return res;
3819
3734
  };
3820
-
3821
3735
  function updateReadableListening(self) {
3822
3736
  var state = self._readableState;
3823
3737
  state.readableListening = self.listenerCount('readable') > 0;
3824
-
3825
3738
  if (state.resumeScheduled && !state.paused) {
3826
3739
  // flowing needs to be set to true now, otherwise
3827
3740
  // the upcoming resume will not flow.
3828
- state.flowing = true; // crude way to check if we should resume
3741
+ state.flowing = true;
3742
+
3743
+ // crude way to check if we should resume
3829
3744
  } else if (self.listenerCount('data') > 0) {
3830
3745
  self.resume();
3831
3746
  }
3832
3747
  }
3833
-
3834
3748
  function nReadingNextTick(self) {
3835
3749
  debug('readable nexttick read 0');
3836
3750
  self.read(0);
3837
- } // pause() and resume() are remnants of the legacy readable stream API
3838
- // If the user uses them, then switch into old mode.
3839
-
3751
+ }
3840
3752
 
3753
+ // pause() and resume() are remnants of the legacy readable stream API
3754
+ // If the user uses them, then switch into old mode.
3841
3755
  Readable.prototype.resume = function () {
3842
3756
  var state = this._readableState;
3843
-
3844
3757
  if (!state.flowing) {
3845
- debug('resume'); // we flow only if there is no one listening
3758
+ debug('resume');
3759
+ // we flow only if there is no one listening
3846
3760
  // for readable, but we still have to call
3847
3761
  // resume()
3848
-
3849
3762
  state.flowing = !state.readableListening;
3850
3763
  resume(this, state);
3851
3764
  }
3852
-
3853
3765
  state.paused = false;
3854
3766
  return this;
3855
3767
  };
3856
-
3857
3768
  function resume(stream, state) {
3858
3769
  if (!state.resumeScheduled) {
3859
3770
  state.resumeScheduled = true;
3860
3771
  process.nextTick(resume_, stream, state);
3861
3772
  }
3862
3773
  }
3863
-
3864
3774
  function resume_(stream, state) {
3865
3775
  debug('resume', state.reading);
3866
-
3867
3776
  if (!state.reading) {
3868
3777
  stream.read(0);
3869
3778
  }
3870
-
3871
3779
  state.resumeScheduled = false;
3872
3780
  stream.emit('resume');
3873
3781
  flow(stream);
3874
3782
  if (state.flowing && !state.reading) stream.read(0);
3875
3783
  }
3876
-
3877
3784
  Readable.prototype.pause = function () {
3878
3785
  debug('call pause flowing=%j', this._readableState.flowing);
3879
-
3880
3786
  if (this._readableState.flowing !== false) {
3881
3787
  debug('pause');
3882
3788
  this._readableState.flowing = false;
3883
3789
  this.emit('pause');
3884
3790
  }
3885
-
3886
3791
  this._readableState.paused = true;
3887
3792
  return this;
3888
3793
  };
3889
-
3890
3794
  function flow(stream) {
3891
3795
  var state = stream._readableState;
3892
3796
  debug('flow', state.flowing);
3797
+ while (state.flowing && stream.read() !== null);
3798
+ }
3893
3799
 
3894
- while (state.flowing && stream.read() !== null) {
3895
- ;
3896
- }
3897
- } // wrap an old-style stream as the async data source.
3800
+ // wrap an old-style stream as the async data source.
3898
3801
  // This is *not* part of the readable stream interface.
3899
3802
  // It is an ugly unfortunate mess of history.
3900
-
3901
-
3902
3803
  Readable.prototype.wrap = function (stream) {
3903
3804
  var _this = this;
3904
-
3905
3805
  var state = this._readableState;
3906
3806
  var paused = false;
3907
3807
  stream.on('end', function () {
3908
3808
  debug('wrapped end');
3909
-
3910
3809
  if (state.decoder && !state.ended) {
3911
3810
  var chunk = state.decoder.end();
3912
3811
  if (chunk && chunk.length) _this.push(chunk);
3913
3812
  }
3914
-
3915
3813
  _this.push(null);
3916
3814
  });
3917
3815
  stream.on('data', function (chunk) {
3918
3816
  debug('wrapped data');
3919
- if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode
3817
+ if (state.decoder) chunk = state.decoder.write(chunk);
3920
3818
 
3819
+ // don't skip over falsy values in objectMode
3921
3820
  if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
3922
-
3923
3821
  var ret = _this.push(chunk);
3924
-
3925
3822
  if (!ret) {
3926
3823
  paused = true;
3927
3824
  stream.pause();
3928
3825
  }
3929
- }); // proxy all the other methods.
3930
- // important when wrapping filters and duplexes.
3826
+ });
3931
3827
 
3828
+ // proxy all the other methods.
3829
+ // important when wrapping filters and duplexes.
3932
3830
  for (var i in stream) {
3933
3831
  if (this[i] === undefined && typeof stream[i] === 'function') {
3934
3832
  this[i] = function methodWrap(method) {
@@ -3937,37 +3835,32 @@ Readable.prototype.wrap = function (stream) {
3937
3835
  };
3938
3836
  }(i);
3939
3837
  }
3940
- } // proxy certain important events.
3941
-
3838
+ }
3942
3839
 
3840
+ // proxy certain important events.
3943
3841
  for (var n = 0; n < kProxyEvents.length; n++) {
3944
3842
  stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
3945
- } // when we try to consume some more bytes, simply unpause the
3946
- // underlying stream.
3947
-
3843
+ }
3948
3844
 
3845
+ // when we try to consume some more bytes, simply unpause the
3846
+ // underlying stream.
3949
3847
  this._read = function (n) {
3950
3848
  debug('wrapped _read', n);
3951
-
3952
3849
  if (paused) {
3953
3850
  paused = false;
3954
3851
  stream.resume();
3955
3852
  }
3956
3853
  };
3957
-
3958
3854
  return this;
3959
3855
  };
3960
-
3961
3856
  if (typeof Symbol === 'function') {
3962
3857
  Readable.prototype[Symbol.asyncIterator] = function () {
3963
3858
  if (createReadableStreamAsyncIterator === undefined) {
3964
3859
  createReadableStreamAsyncIterator = __nccwpck_require__(3306);
3965
3860
  }
3966
-
3967
3861
  return createReadableStreamAsyncIterator(this);
3968
3862
  };
3969
3863
  }
3970
-
3971
3864
  Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
3972
3865
  // making it explicit this property is not enumerable
3973
3866
  // because otherwise some prototype manipulation in
@@ -3999,8 +3892,9 @@ Object.defineProperty(Readable.prototype, 'readableFlowing', {
3999
3892
  this._readableState.flowing = state;
4000
3893
  }
4001
3894
  }
4002
- }); // exposed for testing purposes only.
3895
+ });
4003
3896
 
3897
+ // exposed for testing purposes only.
4004
3898
  Readable._fromList = fromList;
4005
3899
  Object.defineProperty(Readable.prototype, 'readableLength', {
4006
3900
  // making it explicit this property is not enumerable
@@ -4010,11 +3904,12 @@ Object.defineProperty(Readable.prototype, 'readableLength', {
4010
3904
  get: function get() {
4011
3905
  return this._readableState.length;
4012
3906
  }
4013
- }); // Pluck off n bytes from an array of buffers.
3907
+ });
3908
+
3909
+ // Pluck off n bytes from an array of buffers.
4014
3910
  // Length is the combined lengths of all the buffers in the list.
4015
3911
  // This function is designed to be inlinable, so please take care when making
4016
3912
  // changes to the function body.
4017
-
4018
3913
  function fromList(n, state) {
4019
3914
  // nothing buffered
4020
3915
  if (state.length === 0) return null;
@@ -4029,52 +3924,44 @@ function fromList(n, state) {
4029
3924
  }
4030
3925
  return ret;
4031
3926
  }
4032
-
4033
3927
  function endReadable(stream) {
4034
3928
  var state = stream._readableState;
4035
3929
  debug('endReadable', state.endEmitted);
4036
-
4037
3930
  if (!state.endEmitted) {
4038
3931
  state.ended = true;
4039
3932
  process.nextTick(endReadableNT, state, stream);
4040
3933
  }
4041
3934
  }
4042
-
4043
3935
  function endReadableNT(state, stream) {
4044
- debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift.
3936
+ debug('endReadableNT', state.endEmitted, state.length);
4045
3937
 
3938
+ // Check that we didn't get one last unshift.
4046
3939
  if (!state.endEmitted && state.length === 0) {
4047
3940
  state.endEmitted = true;
4048
3941
  stream.readable = false;
4049
3942
  stream.emit('end');
4050
-
4051
3943
  if (state.autoDestroy) {
4052
3944
  // In case of duplex streams we need a way to detect
4053
3945
  // if the writable side is ready for autoDestroy as well
4054
3946
  var wState = stream._writableState;
4055
-
4056
3947
  if (!wState || wState.autoDestroy && wState.finished) {
4057
3948
  stream.destroy();
4058
3949
  }
4059
3950
  }
4060
3951
  }
4061
3952
  }
4062
-
4063
3953
  if (typeof Symbol === 'function') {
4064
3954
  Readable.from = function (iterable, opts) {
4065
3955
  if (from === undefined) {
4066
3956
  from = __nccwpck_require__(5621);
4067
3957
  }
4068
-
4069
3958
  return from(Readable, iterable, opts);
4070
3959
  };
4071
3960
  }
4072
-
4073
3961
  function indexOf(xs, x) {
4074
3962
  for (var i = 0, l = xs.length; i < l; i++) {
4075
3963
  if (xs[i] === x) return i;
4076
3964
  }
4077
-
4078
3965
  return -1;
4079
3966
  }
4080
3967
 
@@ -4103,6 +3990,7 @@ function indexOf(xs, x) {
4103
3990
  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
4104
3991
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
4105
3992
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
3993
+
4106
3994
  // a transform stream is a readable/writable stream where you do
4107
3995
  // something with the data. Sometimes it's called a "filter",
4108
3996
  // but that's not a great name for it, since that implies a thing where
@@ -4146,40 +4034,34 @@ function indexOf(xs, x) {
4146
4034
  // the results of the previous transformed chunk were consumed.
4147
4035
 
4148
4036
 
4149
- module.exports = Transform;
4150
4037
 
4038
+ module.exports = Transform;
4151
4039
  var _require$codes = (__nccwpck_require__(7214)/* .codes */ .q),
4152
- ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
4153
- ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
4154
- ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
4155
- ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
4156
-
4040
+ ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
4041
+ ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
4042
+ ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
4043
+ ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
4157
4044
  var Duplex = __nccwpck_require__(1359);
4158
-
4159
4045
  __nccwpck_require__(4124)(Transform, Duplex);
4160
-
4161
4046
  function afterTransform(er, data) {
4162
4047
  var ts = this._transformState;
4163
4048
  ts.transforming = false;
4164
4049
  var cb = ts.writecb;
4165
-
4166
4050
  if (cb === null) {
4167
4051
  return this.emit('error', new ERR_MULTIPLE_CALLBACK());
4168
4052
  }
4169
-
4170
4053
  ts.writechunk = null;
4171
4054
  ts.writecb = null;
4172
- if (data != null) // single equals check for both `null` and `undefined`
4055
+ if (data != null)
4056
+ // single equals check for both `null` and `undefined`
4173
4057
  this.push(data);
4174
4058
  cb(er);
4175
4059
  var rs = this._readableState;
4176
4060
  rs.reading = false;
4177
-
4178
4061
  if (rs.needReadable || rs.length < rs.highWaterMark) {
4179
4062
  this._read(rs.highWaterMark);
4180
4063
  }
4181
4064
  }
4182
-
4183
4065
  function Transform(options) {
4184
4066
  if (!(this instanceof Transform)) return new Transform(options);
4185
4067
  Duplex.call(this, options);
@@ -4190,26 +4072,25 @@ function Transform(options) {
4190
4072
  writecb: null,
4191
4073
  writechunk: null,
4192
4074
  writeencoding: null
4193
- }; // start out asking for a readable event once data is transformed.
4075
+ };
4076
+
4077
+ // start out asking for a readable event once data is transformed.
4078
+ this._readableState.needReadable = true;
4194
4079
 
4195
- this._readableState.needReadable = true; // we have implemented the _read method, and done the other things
4080
+ // we have implemented the _read method, and done the other things
4196
4081
  // that Readable wants before the first _read call, so unset the
4197
4082
  // sync guard flag.
4198
-
4199
4083
  this._readableState.sync = false;
4200
-
4201
4084
  if (options) {
4202
4085
  if (typeof options.transform === 'function') this._transform = options.transform;
4203
4086
  if (typeof options.flush === 'function') this._flush = options.flush;
4204
- } // When the writable side finishes, then flush out anything remaining.
4205
-
4087
+ }
4206
4088
 
4089
+ // When the writable side finishes, then flush out anything remaining.
4207
4090
  this.on('prefinish', prefinish);
4208
4091
  }
4209
-
4210
4092
  function prefinish() {
4211
4093
  var _this = this;
4212
-
4213
4094
  if (typeof this._flush === 'function' && !this._readableState.destroyed) {
4214
4095
  this._flush(function (er, data) {
4215
4096
  done(_this, er, data);
@@ -4218,11 +4099,12 @@ function prefinish() {
4218
4099
  done(this, null, null);
4219
4100
  }
4220
4101
  }
4221
-
4222
4102
  Transform.prototype.push = function (chunk, encoding) {
4223
4103
  this._transformState.needTransform = false;
4224
4104
  return Duplex.prototype.push.call(this, chunk, encoding);
4225
- }; // This is the part where you do stuff!
4105
+ };
4106
+
4107
+ // This is the part where you do stuff!
4226
4108
  // override this function in implementation classes.
4227
4109
  // 'chunk' is an input chunk.
4228
4110
  //
@@ -4232,33 +4114,27 @@ Transform.prototype.push = function (chunk, encoding) {
4232
4114
  // Call `cb(err)` when you are done with this chunk. If you pass
4233
4115
  // an error, then that'll put the hurt on the whole operation. If you
4234
4116
  // never call cb(), then you'll never get another chunk.
4235
-
4236
-
4237
4117
  Transform.prototype._transform = function (chunk, encoding, cb) {
4238
4118
  cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));
4239
4119
  };
4240
-
4241
4120
  Transform.prototype._write = function (chunk, encoding, cb) {
4242
4121
  var ts = this._transformState;
4243
4122
  ts.writecb = cb;
4244
4123
  ts.writechunk = chunk;
4245
4124
  ts.writeencoding = encoding;
4246
-
4247
4125
  if (!ts.transforming) {
4248
4126
  var rs = this._readableState;
4249
4127
  if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
4250
4128
  }
4251
- }; // Doesn't matter what the args are here.
4129
+ };
4130
+
4131
+ // Doesn't matter what the args are here.
4252
4132
  // _transform does all the work.
4253
4133
  // That we got here means that the readable side wants more data.
4254
-
4255
-
4256
4134
  Transform.prototype._read = function (n) {
4257
4135
  var ts = this._transformState;
4258
-
4259
4136
  if (ts.writechunk !== null && !ts.transforming) {
4260
4137
  ts.transforming = true;
4261
-
4262
4138
  this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
4263
4139
  } else {
4264
4140
  // mark that we need a transform, so that any data that comes in
@@ -4266,20 +4142,20 @@ Transform.prototype._read = function (n) {
4266
4142
  ts.needTransform = true;
4267
4143
  }
4268
4144
  };
4269
-
4270
4145
  Transform.prototype._destroy = function (err, cb) {
4271
4146
  Duplex.prototype._destroy.call(this, err, function (err2) {
4272
4147
  cb(err2);
4273
4148
  });
4274
4149
  };
4275
-
4276
4150
  function done(stream, er, data) {
4277
4151
  if (er) return stream.emit('error', er);
4278
- if (data != null) // single equals check for both `null` and `undefined`
4279
- stream.push(data); // TODO(BridgeAR): Write a test for these two error cases
4152
+ if (data != null)
4153
+ // single equals check for both `null` and `undefined`
4154
+ stream.push(data);
4155
+
4156
+ // TODO(BridgeAR): Write a test for these two error cases
4280
4157
  // if there's nothing in the write buffer, then that means
4281
4158
  // that nothing more will ever be provided
4282
-
4283
4159
  if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
4284
4160
  if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
4285
4161
  return stream.push(null);
@@ -4310,29 +4186,29 @@ function done(stream, er, data) {
4310
4186
  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
4311
4187
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
4312
4188
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
4189
+
4313
4190
  // A bit simpler than readable streams.
4314
4191
  // Implement an async ._write(chunk, encoding, cb), and it'll handle all
4315
4192
  // the drain event emission and buffering.
4316
4193
 
4317
4194
 
4195
+
4318
4196
  module.exports = Writable;
4319
- /* <replacement> */
4320
4197
 
4198
+ /* <replacement> */
4321
4199
  function WriteReq(chunk, encoding, cb) {
4322
4200
  this.chunk = chunk;
4323
4201
  this.encoding = encoding;
4324
4202
  this.callback = cb;
4325
4203
  this.next = null;
4326
- } // It seems a linked list but it is not
4327
- // there will be only 2 of these for each stream
4328
-
4204
+ }
4329
4205
 
4206
+ // It seems a linked list but it is not
4207
+ // there will be only 2 of these for each stream
4330
4208
  function CorkedRequest(state) {
4331
4209
  var _this = this;
4332
-
4333
4210
  this.next = null;
4334
4211
  this.entry = null;
4335
-
4336
4212
  this.finish = function () {
4337
4213
  onCorkedFinish(_this, state);
4338
4214
  };
@@ -4340,155 +4216,159 @@ function CorkedRequest(state) {
4340
4216
  /* </replacement> */
4341
4217
 
4342
4218
  /*<replacement>*/
4343
-
4344
-
4345
4219
  var Duplex;
4346
4220
  /*</replacement>*/
4347
4221
 
4348
4222
  Writable.WritableState = WritableState;
4349
- /*<replacement>*/
4350
4223
 
4224
+ /*<replacement>*/
4351
4225
  var internalUtil = {
4352
4226
  deprecate: __nccwpck_require__(5278)
4353
4227
  };
4354
4228
  /*</replacement>*/
4355
4229
 
4356
4230
  /*<replacement>*/
4357
-
4358
4231
  var Stream = __nccwpck_require__(2387);
4359
4232
  /*</replacement>*/
4360
4233
 
4361
-
4362
4234
  var Buffer = (__nccwpck_require__(4300).Buffer);
4363
-
4364
- var OurUint8Array = global.Uint8Array || function () {};
4365
-
4235
+ var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
4366
4236
  function _uint8ArrayToBuffer(chunk) {
4367
4237
  return Buffer.from(chunk);
4368
4238
  }
4369
-
4370
4239
  function _isUint8Array(obj) {
4371
4240
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
4372
4241
  }
4373
-
4374
4242
  var destroyImpl = __nccwpck_require__(7049);
4375
-
4376
4243
  var _require = __nccwpck_require__(9948),
4377
- getHighWaterMark = _require.getHighWaterMark;
4378
-
4244
+ getHighWaterMark = _require.getHighWaterMark;
4379
4245
  var _require$codes = (__nccwpck_require__(7214)/* .codes */ .q),
4380
- ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
4381
- ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
4382
- ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
4383
- ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
4384
- ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
4385
- ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
4386
- ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
4387
- ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
4388
-
4246
+ ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
4247
+ ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
4248
+ ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
4249
+ ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
4250
+ ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
4251
+ ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
4252
+ ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
4253
+ ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
4389
4254
  var errorOrDestroy = destroyImpl.errorOrDestroy;
4390
-
4391
4255
  __nccwpck_require__(4124)(Writable, Stream);
4392
-
4393
4256
  function nop() {}
4394
-
4395
4257
  function WritableState(options, stream, isDuplex) {
4396
4258
  Duplex = Duplex || __nccwpck_require__(1359);
4397
- options = options || {}; // Duplex streams are both readable and writable, but share
4259
+ options = options || {};
4260
+
4261
+ // Duplex streams are both readable and writable, but share
4398
4262
  // the same options object.
4399
4263
  // However, some cases require setting options to different
4400
4264
  // values for the readable and the writable sides of the duplex stream,
4401
4265
  // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.
4266
+ if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;
4402
4267
 
4403
- if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream
4268
+ // object stream flag to indicate whether or not this stream
4404
4269
  // contains buffers or objects.
4405
-
4406
4270
  this.objectMode = !!options.objectMode;
4407
- if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false
4271
+ if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
4272
+
4273
+ // the point at which write() starts returning false
4408
4274
  // Note: 0 is a valid value, means that we always return false if
4409
4275
  // the entire buffer is not flushed immediately on write()
4276
+ this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex);
4410
4277
 
4411
- this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called
4412
-
4413
- this.finalCalled = false; // drain event flag.
4414
-
4415
- this.needDrain = false; // at the start of calling end()
4278
+ // if _final has been called
4279
+ this.finalCalled = false;
4416
4280
 
4417
- this.ending = false; // when end() has been called, and returned
4418
-
4419
- this.ended = false; // when 'finish' is emitted
4281
+ // drain event flag.
4282
+ this.needDrain = false;
4283
+ // at the start of calling end()
4284
+ this.ending = false;
4285
+ // when end() has been called, and returned
4286
+ this.ended = false;
4287
+ // when 'finish' is emitted
4288
+ this.finished = false;
4420
4289
 
4421
- this.finished = false; // has it been destroyed
4290
+ // has it been destroyed
4291
+ this.destroyed = false;
4422
4292
 
4423
- this.destroyed = false; // should we decode strings into buffers before passing to _write?
4293
+ // should we decode strings into buffers before passing to _write?
4424
4294
  // this is here so that some node-core streams can optimize string
4425
4295
  // handling at a lower level.
4426
-
4427
4296
  var noDecode = options.decodeStrings === false;
4428
- this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string
4297
+ this.decodeStrings = !noDecode;
4298
+
4299
+ // Crypto is kind of old and crusty. Historically, its default string
4429
4300
  // encoding is 'binary' so we have to make this configurable.
4430
4301
  // Everything else in the universe uses 'utf8', though.
4302
+ this.defaultEncoding = options.defaultEncoding || 'utf8';
4431
4303
 
4432
- this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement
4304
+ // not an actual buffer we keep track of, but a measurement
4433
4305
  // of how much we're waiting to get pushed to some underlying
4434
4306
  // socket or file.
4307
+ this.length = 0;
4435
4308
 
4436
- this.length = 0; // a flag to see when we're in the middle of a write.
4309
+ // a flag to see when we're in the middle of a write.
4310
+ this.writing = false;
4437
4311
 
4438
- this.writing = false; // when true all writes will be buffered until .uncork() call
4312
+ // when true all writes will be buffered until .uncork() call
4313
+ this.corked = 0;
4439
4314
 
4440
- this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,
4315
+ // a flag to be able to tell if the onwrite cb is called immediately,
4441
4316
  // or on a later tick. We set this to true at first, because any
4442
4317
  // actions that shouldn't happen until "later" should generally also
4443
4318
  // not happen before the first write call.
4319
+ this.sync = true;
4444
4320
 
4445
- this.sync = true; // a flag to know if we're processing previously buffered items, which
4321
+ // a flag to know if we're processing previously buffered items, which
4446
4322
  // may call the _write() callback in the same tick, so that we don't
4447
4323
  // end up in an overlapped onwrite situation.
4324
+ this.bufferProcessing = false;
4448
4325
 
4449
- this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)
4450
-
4326
+ // the callback that's passed to _write(chunk,cb)
4451
4327
  this.onwrite = function (er) {
4452
4328
  onwrite(stream, er);
4453
- }; // the callback that the user supplies to write(chunk,encoding,cb)
4454
-
4329
+ };
4455
4330
 
4456
- this.writecb = null; // the amount that is being written when _write is called.
4331
+ // the callback that the user supplies to write(chunk,encoding,cb)
4332
+ this.writecb = null;
4457
4333
 
4334
+ // the amount that is being written when _write is called.
4458
4335
  this.writelen = 0;
4459
4336
  this.bufferedRequest = null;
4460
- this.lastBufferedRequest = null; // number of pending user-supplied write callbacks
4337
+ this.lastBufferedRequest = null;
4338
+
4339
+ // number of pending user-supplied write callbacks
4461
4340
  // this must be 0 before 'finish' can be emitted
4341
+ this.pendingcb = 0;
4462
4342
 
4463
- this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs
4343
+ // emit prefinish if the only thing we're waiting for is _write cbs
4464
4344
  // This is relevant for synchronous Transform streams
4345
+ this.prefinished = false;
4465
4346
 
4466
- this.prefinished = false; // True if the error was already emitted and should not be thrown again
4347
+ // True if the error was already emitted and should not be thrown again
4348
+ this.errorEmitted = false;
4467
4349
 
4468
- this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.
4350
+ // Should close be emitted on destroy. Defaults to true.
4351
+ this.emitClose = options.emitClose !== false;
4469
4352
 
4470
- this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')
4353
+ // Should .destroy() be called after 'finish' (and potentially 'end')
4354
+ this.autoDestroy = !!options.autoDestroy;
4471
4355
 
4472
- this.autoDestroy = !!options.autoDestroy; // count buffered requests
4356
+ // count buffered requests
4357
+ this.bufferedRequestCount = 0;
4473
4358
 
4474
- this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always
4359
+ // allocate the first CorkedRequest, there is always
4475
4360
  // one allocated and free to use, and we maintain at most two
4476
-
4477
4361
  this.corkedRequestsFree = new CorkedRequest(this);
4478
4362
  }
4479
-
4480
4363
  WritableState.prototype.getBuffer = function getBuffer() {
4481
4364
  var current = this.bufferedRequest;
4482
4365
  var out = [];
4483
-
4484
4366
  while (current) {
4485
4367
  out.push(current);
4486
4368
  current = current.next;
4487
4369
  }
4488
-
4489
4370
  return out;
4490
4371
  };
4491
-
4492
4372
  (function () {
4493
4373
  try {
4494
4374
  Object.defineProperty(WritableState.prototype, 'buffer', {
@@ -4497,12 +4377,11 @@ WritableState.prototype.getBuffer = function getBuffer() {
4497
4377
  }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
4498
4378
  });
4499
4379
  } catch (_) {}
4500
- })(); // Test _writableState for inheritance to account for Duplex streams,
4501
- // whose prototype chain only points to Readable.
4502
-
4380
+ })();
4503
4381
 
4382
+ // Test _writableState for inheritance to account for Duplex streams,
4383
+ // whose prototype chain only points to Readable.
4504
4384
  var realHasInstance;
4505
-
4506
4385
  if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
4507
4386
  realHasInstance = Function.prototype[Symbol.hasInstance];
4508
4387
  Object.defineProperty(Writable, Symbol.hasInstance, {
@@ -4517,81 +4396,73 @@ if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.protot
4517
4396
  return object instanceof this;
4518
4397
  };
4519
4398
  }
4520
-
4521
4399
  function Writable(options) {
4522
- Duplex = Duplex || __nccwpck_require__(1359); // Writable ctor is applied to Duplexes, too.
4400
+ Duplex = Duplex || __nccwpck_require__(1359);
4401
+
4402
+ // Writable ctor is applied to Duplexes, too.
4523
4403
  // `realHasInstance` is necessary because using plain `instanceof`
4524
4404
  // would return false, as no `_writableState` property is attached.
4405
+
4525
4406
  // Trying to use the custom `instanceof` for Writable here will also break the
4526
4407
  // Node.js LazyTransform implementation, which has a non-trivial getter for
4527
4408
  // `_writableState` that would lead to infinite recursion.
4409
+
4528
4410
  // Checking for a Stream.Duplex instance is faster here instead of inside
4529
4411
  // the WritableState constructor, at least with V8 6.5
4530
-
4531
4412
  var isDuplex = this instanceof Duplex;
4532
4413
  if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
4533
- this._writableState = new WritableState(options, this, isDuplex); // legacy.
4414
+ this._writableState = new WritableState(options, this, isDuplex);
4534
4415
 
4416
+ // legacy.
4535
4417
  this.writable = true;
4536
-
4537
4418
  if (options) {
4538
4419
  if (typeof options.write === 'function') this._write = options.write;
4539
4420
  if (typeof options.writev === 'function') this._writev = options.writev;
4540
4421
  if (typeof options.destroy === 'function') this._destroy = options.destroy;
4541
4422
  if (typeof options.final === 'function') this._final = options.final;
4542
4423
  }
4543
-
4544
4424
  Stream.call(this);
4545
- } // Otherwise people can pipe Writable streams, which is just wrong.
4546
-
4425
+ }
4547
4426
 
4427
+ // Otherwise people can pipe Writable streams, which is just wrong.
4548
4428
  Writable.prototype.pipe = function () {
4549
4429
  errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
4550
4430
  };
4551
-
4552
4431
  function writeAfterEnd(stream, cb) {
4553
- var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb
4554
-
4432
+ var er = new ERR_STREAM_WRITE_AFTER_END();
4433
+ // TODO: defer error events consistently everywhere, not just the cb
4555
4434
  errorOrDestroy(stream, er);
4556
4435
  process.nextTick(cb, er);
4557
- } // Checks that a user-supplied chunk is valid, especially for the particular
4436
+ }
4437
+
4438
+ // Checks that a user-supplied chunk is valid, especially for the particular
4558
4439
  // mode the stream is in. Currently this means that `null` is never accepted
4559
4440
  // and undefined/non-string values are only allowed in object mode.
4560
-
4561
-
4562
4441
  function validChunk(stream, state, chunk, cb) {
4563
4442
  var er;
4564
-
4565
4443
  if (chunk === null) {
4566
4444
  er = new ERR_STREAM_NULL_VALUES();
4567
4445
  } else if (typeof chunk !== 'string' && !state.objectMode) {
4568
4446
  er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);
4569
4447
  }
4570
-
4571
4448
  if (er) {
4572
4449
  errorOrDestroy(stream, er);
4573
4450
  process.nextTick(cb, er);
4574
4451
  return false;
4575
4452
  }
4576
-
4577
4453
  return true;
4578
4454
  }
4579
-
4580
4455
  Writable.prototype.write = function (chunk, encoding, cb) {
4581
4456
  var state = this._writableState;
4582
4457
  var ret = false;
4583
-
4584
4458
  var isBuf = !state.objectMode && _isUint8Array(chunk);
4585
-
4586
4459
  if (isBuf && !Buffer.isBuffer(chunk)) {
4587
4460
  chunk = _uint8ArrayToBuffer(chunk);
4588
4461
  }
4589
-
4590
4462
  if (typeof encoding === 'function') {
4591
4463
  cb = encoding;
4592
4464
  encoding = null;
4593
4465
  }
4594
-
4595
4466
  if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
4596
4467
  if (typeof cb !== 'function') cb = nop;
4597
4468
  if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
@@ -4600,20 +4471,16 @@ Writable.prototype.write = function (chunk, encoding, cb) {
4600
4471
  }
4601
4472
  return ret;
4602
4473
  };
4603
-
4604
4474
  Writable.prototype.cork = function () {
4605
4475
  this._writableState.corked++;
4606
4476
  };
4607
-
4608
4477
  Writable.prototype.uncork = function () {
4609
4478
  var state = this._writableState;
4610
-
4611
4479
  if (state.corked) {
4612
4480
  state.corked--;
4613
4481
  if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
4614
4482
  }
4615
4483
  };
4616
-
4617
4484
  Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
4618
4485
  // node::ParseEncoding() requires lower case.
4619
4486
  if (typeof encoding === 'string') encoding = encoding.toLowerCase();
@@ -4621,7 +4488,6 @@ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
4621
4488
  this._writableState.defaultEncoding = encoding;
4622
4489
  return this;
4623
4490
  };
4624
-
4625
4491
  Object.defineProperty(Writable.prototype, 'writableBuffer', {
4626
4492
  // making it explicit this property is not enumerable
4627
4493
  // because otherwise some prototype manipulation in
@@ -4631,15 +4497,12 @@ Object.defineProperty(Writable.prototype, 'writableBuffer', {
4631
4497
  return this._writableState && this._writableState.getBuffer();
4632
4498
  }
4633
4499
  });
4634
-
4635
4500
  function decodeChunk(state, chunk, encoding) {
4636
4501
  if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
4637
4502
  chunk = Buffer.from(chunk, encoding);
4638
4503
  }
4639
-
4640
4504
  return chunk;
4641
4505
  }
4642
-
4643
4506
  Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
4644
4507
  // making it explicit this property is not enumerable
4645
4508
  // because otherwise some prototype manipulation in
@@ -4648,27 +4511,25 @@ Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
4648
4511
  get: function get() {
4649
4512
  return this._writableState.highWaterMark;
4650
4513
  }
4651
- }); // if we're already writing something, then just put this
4514
+ });
4515
+
4516
+ // if we're already writing something, then just put this
4652
4517
  // in the queue, and wait our turn. Otherwise, call _write
4653
4518
  // If we return false, then we need a drain event, so set that flag.
4654
-
4655
4519
  function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
4656
4520
  if (!isBuf) {
4657
4521
  var newChunk = decodeChunk(state, chunk, encoding);
4658
-
4659
4522
  if (chunk !== newChunk) {
4660
4523
  isBuf = true;
4661
4524
  encoding = 'buffer';
4662
4525
  chunk = newChunk;
4663
4526
  }
4664
4527
  }
4665
-
4666
4528
  var len = state.objectMode ? 1 : chunk.length;
4667
4529
  state.length += len;
4668
- var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.
4669
-
4530
+ var ret = state.length < state.highWaterMark;
4531
+ // we must ensure that previous needDrain will not be reset to false.
4670
4532
  if (!ret) state.needDrain = true;
4671
-
4672
4533
  if (state.writing || state.corked) {
4673
4534
  var last = state.lastBufferedRequest;
4674
4535
  state.lastBufferedRequest = {
@@ -4678,21 +4539,17 @@ function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
4678
4539
  callback: cb,
4679
4540
  next: null
4680
4541
  };
4681
-
4682
4542
  if (last) {
4683
4543
  last.next = state.lastBufferedRequest;
4684
4544
  } else {
4685
4545
  state.bufferedRequest = state.lastBufferedRequest;
4686
4546
  }
4687
-
4688
4547
  state.bufferedRequestCount += 1;
4689
4548
  } else {
4690
4549
  doWrite(stream, state, false, len, chunk, encoding, cb);
4691
4550
  }
4692
-
4693
4551
  return ret;
4694
4552
  }
4695
-
4696
4553
  function doWrite(stream, state, writev, len, chunk, encoding, cb) {
4697
4554
  state.writelen = len;
4698
4555
  state.writecb = cb;
@@ -4701,16 +4558,14 @@ function doWrite(stream, state, writev, len, chunk, encoding, cb) {
4701
4558
  if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
4702
4559
  state.sync = false;
4703
4560
  }
4704
-
4705
4561
  function onwriteError(stream, state, sync, er, cb) {
4706
4562
  --state.pendingcb;
4707
-
4708
4563
  if (sync) {
4709
4564
  // defer the callback if we are being called synchronously
4710
4565
  // to avoid piling up things on the stack
4711
- process.nextTick(cb, er); // this can emit finish, and it will always happen
4566
+ process.nextTick(cb, er);
4567
+ // this can emit finish, and it will always happen
4712
4568
  // after error
4713
-
4714
4569
  process.nextTick(finishMaybe, stream, state);
4715
4570
  stream._writableState.errorEmitted = true;
4716
4571
  errorOrDestroy(stream, er);
@@ -4719,20 +4574,18 @@ function onwriteError(stream, state, sync, er, cb) {
4719
4574
  // it is async
4720
4575
  cb(er);
4721
4576
  stream._writableState.errorEmitted = true;
4722
- errorOrDestroy(stream, er); // this can emit finish, but finish must
4577
+ errorOrDestroy(stream, er);
4578
+ // this can emit finish, but finish must
4723
4579
  // always follow error
4724
-
4725
4580
  finishMaybe(stream, state);
4726
4581
  }
4727
4582
  }
4728
-
4729
4583
  function onwriteStateUpdate(state) {
4730
4584
  state.writing = false;
4731
4585
  state.writecb = null;
4732
4586
  state.length -= state.writelen;
4733
4587
  state.writelen = 0;
4734
4588
  }
4735
-
4736
4589
  function onwrite(stream, er) {
4737
4590
  var state = stream._writableState;
4738
4591
  var sync = state.sync;
@@ -4742,11 +4595,9 @@ function onwrite(stream, er) {
4742
4595
  if (er) onwriteError(stream, state, sync, er, cb);else {
4743
4596
  // Check if we're actually ready to finish, but don't emit yet
4744
4597
  var finished = needFinish(state) || stream.destroyed;
4745
-
4746
4598
  if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
4747
4599
  clearBuffer(stream, state);
4748
4600
  }
4749
-
4750
4601
  if (sync) {
4751
4602
  process.nextTick(afterWrite, stream, state, finished, cb);
4752
4603
  } else {
@@ -4754,29 +4605,27 @@ function onwrite(stream, er) {
4754
4605
  }
4755
4606
  }
4756
4607
  }
4757
-
4758
4608
  function afterWrite(stream, state, finished, cb) {
4759
4609
  if (!finished) onwriteDrain(stream, state);
4760
4610
  state.pendingcb--;
4761
4611
  cb();
4762
4612
  finishMaybe(stream, state);
4763
- } // Must force callback to be called on nextTick, so that we don't
4613
+ }
4614
+
4615
+ // Must force callback to be called on nextTick, so that we don't
4764
4616
  // emit 'drain' before the write() consumer gets the 'false' return
4765
4617
  // value, and has a chance to attach a 'drain' listener.
4766
-
4767
-
4768
4618
  function onwriteDrain(stream, state) {
4769
4619
  if (state.length === 0 && state.needDrain) {
4770
4620
  state.needDrain = false;
4771
4621
  stream.emit('drain');
4772
4622
  }
4773
- } // if there's something in the buffer waiting, then process it
4774
-
4623
+ }
4775
4624
 
4625
+ // if there's something in the buffer waiting, then process it
4776
4626
  function clearBuffer(stream, state) {
4777
4627
  state.bufferProcessing = true;
4778
4628
  var entry = state.bufferedRequest;
4779
-
4780
4629
  if (stream._writev && entry && entry.next) {
4781
4630
  // Fast case, write everything using _writev()
4782
4631
  var l = state.bufferedRequestCount;
@@ -4785,28 +4634,25 @@ function clearBuffer(stream, state) {
4785
4634
  holder.entry = entry;
4786
4635
  var count = 0;
4787
4636
  var allBuffers = true;
4788
-
4789
4637
  while (entry) {
4790
4638
  buffer[count] = entry;
4791
4639
  if (!entry.isBuf) allBuffers = false;
4792
4640
  entry = entry.next;
4793
4641
  count += 1;
4794
4642
  }
4795
-
4796
4643
  buffer.allBuffers = allBuffers;
4797
- doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time
4798
- // as the hot path ends with doWrite
4644
+ doWrite(stream, state, true, state.length, buffer, '', holder.finish);
4799
4645
 
4646
+ // doWrite is almost always async, defer these to save a bit of time
4647
+ // as the hot path ends with doWrite
4800
4648
  state.pendingcb++;
4801
4649
  state.lastBufferedRequest = null;
4802
-
4803
4650
  if (holder.next) {
4804
4651
  state.corkedRequestsFree = holder.next;
4805
4652
  holder.next = null;
4806
4653
  } else {
4807
4654
  state.corkedRequestsFree = new CorkedRequest(state);
4808
4655
  }
4809
-
4810
4656
  state.bufferedRequestCount = 0;
4811
4657
  } else {
4812
4658
  // Slow case, write chunks one-by-one
@@ -4817,32 +4663,26 @@ function clearBuffer(stream, state) {
4817
4663
  var len = state.objectMode ? 1 : chunk.length;
4818
4664
  doWrite(stream, state, false, len, chunk, encoding, cb);
4819
4665
  entry = entry.next;
4820
- state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then
4666
+ state.bufferedRequestCount--;
4667
+ // if we didn't call the onwrite immediately, then
4821
4668
  // it means that we need to wait until it does.
4822
4669
  // also, that means that the chunk and cb are currently
4823
4670
  // being processed, so move the buffer counter past them.
4824
-
4825
4671
  if (state.writing) {
4826
4672
  break;
4827
4673
  }
4828
4674
  }
4829
-
4830
4675
  if (entry === null) state.lastBufferedRequest = null;
4831
4676
  }
4832
-
4833
4677
  state.bufferedRequest = entry;
4834
4678
  state.bufferProcessing = false;
4835
4679
  }
4836
-
4837
4680
  Writable.prototype._write = function (chunk, encoding, cb) {
4838
4681
  cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));
4839
4682
  };
4840
-
4841
4683
  Writable.prototype._writev = null;
4842
-
4843
4684
  Writable.prototype.end = function (chunk, encoding, cb) {
4844
4685
  var state = this._writableState;
4845
-
4846
4686
  if (typeof chunk === 'function') {
4847
4687
  cb = chunk;
4848
4688
  chunk = null;
@@ -4851,19 +4691,18 @@ Writable.prototype.end = function (chunk, encoding, cb) {
4851
4691
  cb = encoding;
4852
4692
  encoding = null;
4853
4693
  }
4694
+ if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
4854
4695
 
4855
- if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks
4856
-
4696
+ // .end() fully uncorks
4857
4697
  if (state.corked) {
4858
4698
  state.corked = 1;
4859
4699
  this.uncork();
4860
- } // ignore unnecessary end() calls.
4861
-
4700
+ }
4862
4701
 
4702
+ // ignore unnecessary end() calls.
4863
4703
  if (!state.ending) endWritable(this, state, cb);
4864
4704
  return this;
4865
4705
  };
4866
-
4867
4706
  Object.defineProperty(Writable.prototype, 'writableLength', {
4868
4707
  // making it explicit this property is not enumerable
4869
4708
  // because otherwise some prototype manipulation in
@@ -4873,25 +4712,20 @@ Object.defineProperty(Writable.prototype, 'writableLength', {
4873
4712
  return this._writableState.length;
4874
4713
  }
4875
4714
  });
4876
-
4877
4715
  function needFinish(state) {
4878
4716
  return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
4879
4717
  }
4880
-
4881
4718
  function callFinal(stream, state) {
4882
4719
  stream._final(function (err) {
4883
4720
  state.pendingcb--;
4884
-
4885
4721
  if (err) {
4886
4722
  errorOrDestroy(stream, err);
4887
4723
  }
4888
-
4889
4724
  state.prefinished = true;
4890
4725
  stream.emit('prefinish');
4891
4726
  finishMaybe(stream, state);
4892
4727
  });
4893
4728
  }
4894
-
4895
4729
  function prefinish(stream, state) {
4896
4730
  if (!state.prefinished && !state.finalCalled) {
4897
4731
  if (typeof stream._final === 'function' && !state.destroyed) {
@@ -4904,59 +4738,47 @@ function prefinish(stream, state) {
4904
4738
  }
4905
4739
  }
4906
4740
  }
4907
-
4908
4741
  function finishMaybe(stream, state) {
4909
4742
  var need = needFinish(state);
4910
-
4911
4743
  if (need) {
4912
4744
  prefinish(stream, state);
4913
-
4914
4745
  if (state.pendingcb === 0) {
4915
4746
  state.finished = true;
4916
4747
  stream.emit('finish');
4917
-
4918
4748
  if (state.autoDestroy) {
4919
4749
  // In case of duplex streams we need a way to detect
4920
4750
  // if the readable side is ready for autoDestroy as well
4921
4751
  var rState = stream._readableState;
4922
-
4923
4752
  if (!rState || rState.autoDestroy && rState.endEmitted) {
4924
4753
  stream.destroy();
4925
4754
  }
4926
4755
  }
4927
4756
  }
4928
4757
  }
4929
-
4930
4758
  return need;
4931
4759
  }
4932
-
4933
4760
  function endWritable(stream, state, cb) {
4934
4761
  state.ending = true;
4935
4762
  finishMaybe(stream, state);
4936
-
4937
4763
  if (cb) {
4938
4764
  if (state.finished) process.nextTick(cb);else stream.once('finish', cb);
4939
4765
  }
4940
-
4941
4766
  state.ended = true;
4942
4767
  stream.writable = false;
4943
4768
  }
4944
-
4945
4769
  function onCorkedFinish(corkReq, state, err) {
4946
4770
  var entry = corkReq.entry;
4947
4771
  corkReq.entry = null;
4948
-
4949
4772
  while (entry) {
4950
4773
  var cb = entry.callback;
4951
4774
  state.pendingcb--;
4952
4775
  cb(err);
4953
4776
  entry = entry.next;
4954
- } // reuse the free corkReq.
4955
-
4777
+ }
4956
4778
 
4779
+ // reuse the free corkReq.
4957
4780
  state.corkedRequestsFree.next = corkReq;
4958
4781
  }
4959
-
4960
4782
  Object.defineProperty(Writable.prototype, 'destroyed', {
4961
4783
  // making it explicit this property is not enumerable
4962
4784
  // because otherwise some prototype manipulation in
@@ -4966,7 +4788,6 @@ Object.defineProperty(Writable.prototype, 'destroyed', {
4966
4788
  if (this._writableState === undefined) {
4967
4789
  return false;
4968
4790
  }
4969
-
4970
4791
  return this._writableState.destroyed;
4971
4792
  },
4972
4793
  set: function set(value) {
@@ -4974,16 +4795,15 @@ Object.defineProperty(Writable.prototype, 'destroyed', {
4974
4795
  // has not been initialized yet
4975
4796
  if (!this._writableState) {
4976
4797
  return;
4977
- } // backward compatibility, the user is explicitly
4978
- // managing destroyed
4979
-
4798
+ }
4980
4799
 
4800
+ // backward compatibility, the user is explicitly
4801
+ // managing destroyed
4981
4802
  this._writableState.destroyed = value;
4982
4803
  }
4983
4804
  });
4984
4805
  Writable.prototype.destroy = destroyImpl.destroy;
4985
4806
  Writable.prototype._undestroy = destroyImpl.undestroy;
4986
-
4987
4807
  Writable.prototype._destroy = function (err, cb) {
4988
4808
  cb(err);
4989
4809
  };
@@ -4996,11 +4816,10 @@ Writable.prototype._destroy = function (err, cb) {
4996
4816
 
4997
4817
 
4998
4818
  var _Object$setPrototypeO;
4999
-
5000
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5001
-
4819
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4820
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
4821
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5002
4822
  var finished = __nccwpck_require__(6080);
5003
-
5004
4823
  var kLastResolve = Symbol('lastResolve');
5005
4824
  var kLastReject = Symbol('lastReject');
5006
4825
  var kError = Symbol('error');
@@ -5008,22 +4827,19 @@ var kEnded = Symbol('ended');
5008
4827
  var kLastPromise = Symbol('lastPromise');
5009
4828
  var kHandlePromise = Symbol('handlePromise');
5010
4829
  var kStream = Symbol('stream');
5011
-
5012
4830
  function createIterResult(value, done) {
5013
4831
  return {
5014
4832
  value: value,
5015
4833
  done: done
5016
4834
  };
5017
4835
  }
5018
-
5019
4836
  function readAndResolve(iter) {
5020
4837
  var resolve = iter[kLastResolve];
5021
-
5022
4838
  if (resolve !== null) {
5023
- var data = iter[kStream].read(); // we defer if data is null
4839
+ var data = iter[kStream].read();
4840
+ // we defer if data is null
5024
4841
  // we can be expecting either 'end' or
5025
4842
  // 'error'
5026
-
5027
4843
  if (data !== null) {
5028
4844
  iter[kLastPromise] = null;
5029
4845
  iter[kLastResolve] = null;
@@ -5032,13 +4848,11 @@ function readAndResolve(iter) {
5032
4848
  }
5033
4849
  }
5034
4850
  }
5035
-
5036
4851
  function onReadable(iter) {
5037
4852
  // we wait for the next tick, because it might
5038
4853
  // emit an error with process.nextTick
5039
4854
  process.nextTick(readAndResolve, iter);
5040
4855
  }
5041
-
5042
4856
  function wrapForNext(lastPromise, iter) {
5043
4857
  return function (resolve, reject) {
5044
4858
  lastPromise.then(function () {
@@ -5046,33 +4860,26 @@ function wrapForNext(lastPromise, iter) {
5046
4860
  resolve(createIterResult(undefined, true));
5047
4861
  return;
5048
4862
  }
5049
-
5050
4863
  iter[kHandlePromise](resolve, reject);
5051
4864
  }, reject);
5052
4865
  };
5053
4866
  }
5054
-
5055
4867
  var AsyncIteratorPrototype = Object.getPrototypeOf(function () {});
5056
4868
  var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
5057
4869
  get stream() {
5058
4870
  return this[kStream];
5059
4871
  },
5060
-
5061
4872
  next: function next() {
5062
4873
  var _this = this;
5063
-
5064
4874
  // if we have detected an error in the meanwhile
5065
4875
  // reject straight away
5066
4876
  var error = this[kError];
5067
-
5068
4877
  if (error !== null) {
5069
4878
  return Promise.reject(error);
5070
4879
  }
5071
-
5072
4880
  if (this[kEnded]) {
5073
4881
  return Promise.resolve(createIterResult(undefined, true));
5074
4882
  }
5075
-
5076
4883
  if (this[kStream].destroyed) {
5077
4884
  // We need to defer via nextTick because if .destroy(err) is
5078
4885
  // called, the error will be emitted via nextTick, and
@@ -5087,29 +4894,25 @@ var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPro
5087
4894
  }
5088
4895
  });
5089
4896
  });
5090
- } // if we have multiple next() calls
4897
+ }
4898
+
4899
+ // if we have multiple next() calls
5091
4900
  // we will wait for the previous Promise to finish
5092
4901
  // this logic is optimized to support for await loops,
5093
4902
  // where next() is only called once at a time
5094
-
5095
-
5096
4903
  var lastPromise = this[kLastPromise];
5097
4904
  var promise;
5098
-
5099
4905
  if (lastPromise) {
5100
4906
  promise = new Promise(wrapForNext(lastPromise, this));
5101
4907
  } else {
5102
4908
  // fast path needed to support multiple this.push()
5103
4909
  // without triggering the next() queue
5104
4910
  var data = this[kStream].read();
5105
-
5106
4911
  if (data !== null) {
5107
4912
  return Promise.resolve(createIterResult(data, false));
5108
4913
  }
5109
-
5110
4914
  promise = new Promise(this[kHandlePromise]);
5111
4915
  }
5112
-
5113
4916
  this[kLastPromise] = promise;
5114
4917
  return promise;
5115
4918
  }
@@ -5117,7 +4920,6 @@ var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPro
5117
4920
  return this;
5118
4921
  }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
5119
4922
  var _this2 = this;
5120
-
5121
4923
  // destroy(err, cb) is a private API
5122
4924
  // we can guarantee we have that here, because we control the
5123
4925
  // Readable class this is attached to
@@ -5127,15 +4929,12 @@ var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPro
5127
4929
  reject(err);
5128
4930
  return;
5129
4931
  }
5130
-
5131
4932
  resolve(createIterResult(undefined, true));
5132
4933
  });
5133
4934
  });
5134
4935
  }), _Object$setPrototypeO), AsyncIteratorPrototype);
5135
-
5136
4936
  var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
5137
4937
  var _Object$create;
5138
-
5139
4938
  var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
5140
4939
  value: stream,
5141
4940
  writable: true
@@ -5154,7 +4953,6 @@ var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterat
5154
4953
  }), _defineProperty(_Object$create, kHandlePromise, {
5155
4954
  value: function value(resolve, reject) {
5156
4955
  var data = iterator[kStream].read();
5157
-
5158
4956
  if (data) {
5159
4957
  iterator[kLastPromise] = null;
5160
4958
  iterator[kLastResolve] = null;
@@ -5170,35 +4968,30 @@ var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterat
5170
4968
  iterator[kLastPromise] = null;
5171
4969
  finished(stream, function (err) {
5172
4970
  if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
5173
- var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise
4971
+ var reject = iterator[kLastReject];
4972
+ // reject if we are waiting for data in the Promise
5174
4973
  // returned by next() and store the error
5175
-
5176
4974
  if (reject !== null) {
5177
4975
  iterator[kLastPromise] = null;
5178
4976
  iterator[kLastResolve] = null;
5179
4977
  iterator[kLastReject] = null;
5180
4978
  reject(err);
5181
4979
  }
5182
-
5183
4980
  iterator[kError] = err;
5184
4981
  return;
5185
4982
  }
5186
-
5187
4983
  var resolve = iterator[kLastResolve];
5188
-
5189
4984
  if (resolve !== null) {
5190
4985
  iterator[kLastPromise] = null;
5191
4986
  iterator[kLastResolve] = null;
5192
4987
  iterator[kLastReject] = null;
5193
4988
  resolve(createIterResult(undefined, true));
5194
4989
  }
5195
-
5196
4990
  iterator[kEnded] = true;
5197
4991
  });
5198
4992
  stream.on('readable', onReadable.bind(null, iterator));
5199
4993
  return iterator;
5200
4994
  };
5201
-
5202
4995
  module.exports = createReadableStreamAsyncIterator;
5203
4996
 
5204
4997
  /***/ }),
@@ -5208,41 +5001,29 @@ module.exports = createReadableStreamAsyncIterator;
5208
5001
 
5209
5002
 
5210
5003
 
5211
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
5212
-
5213
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5214
-
5215
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5216
-
5004
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5005
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5006
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5217
5007
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5218
-
5219
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
5220
-
5221
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
5222
-
5008
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
5009
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5010
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5011
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5223
5012
  var _require = __nccwpck_require__(4300),
5224
- Buffer = _require.Buffer;
5225
-
5013
+ Buffer = _require.Buffer;
5226
5014
  var _require2 = __nccwpck_require__(3837),
5227
- inspect = _require2.inspect;
5228
-
5015
+ inspect = _require2.inspect;
5229
5016
  var custom = inspect && inspect.custom || 'inspect';
5230
-
5231
5017
  function copyBuffer(src, target, offset) {
5232
5018
  Buffer.prototype.copy.call(src, target, offset);
5233
5019
  }
5234
-
5235
- module.exports =
5236
- /*#__PURE__*/
5237
- function () {
5020
+ module.exports = /*#__PURE__*/function () {
5238
5021
  function BufferList() {
5239
5022
  _classCallCheck(this, BufferList);
5240
-
5241
5023
  this.head = null;
5242
5024
  this.tail = null;
5243
5025
  this.length = 0;
5244
5026
  }
5245
-
5246
5027
  _createClass(BufferList, [{
5247
5028
  key: "push",
5248
5029
  value: function push(v) {
@@ -5286,11 +5067,7 @@ function () {
5286
5067
  if (this.length === 0) return '';
5287
5068
  var p = this.head;
5288
5069
  var ret = '' + p.data;
5289
-
5290
- while (p = p.next) {
5291
- ret += s + p.data;
5292
- }
5293
-
5070
+ while (p = p.next) ret += s + p.data;
5294
5071
  return ret;
5295
5072
  }
5296
5073
  }, {
@@ -5300,21 +5077,19 @@ function () {
5300
5077
  var ret = Buffer.allocUnsafe(n >>> 0);
5301
5078
  var p = this.head;
5302
5079
  var i = 0;
5303
-
5304
5080
  while (p) {
5305
5081
  copyBuffer(p.data, ret, i);
5306
5082
  i += p.data.length;
5307
5083
  p = p.next;
5308
5084
  }
5309
-
5310
5085
  return ret;
5311
- } // Consumes a specified amount of bytes or characters from the buffered data.
5086
+ }
5312
5087
 
5088
+ // Consumes a specified amount of bytes or characters from the buffered data.
5313
5089
  }, {
5314
5090
  key: "consume",
5315
5091
  value: function consume(n, hasStrings) {
5316
5092
  var ret;
5317
-
5318
5093
  if (n < this.head.data.length) {
5319
5094
  // `slice` is the same for buffers and strings.
5320
5095
  ret = this.head.data.slice(0, n);
@@ -5326,15 +5101,15 @@ function () {
5326
5101
  // Result spans more than one buffer.
5327
5102
  ret = hasStrings ? this._getString(n) : this._getBuffer(n);
5328
5103
  }
5329
-
5330
5104
  return ret;
5331
5105
  }
5332
5106
  }, {
5333
5107
  key: "first",
5334
5108
  value: function first() {
5335
5109
  return this.head.data;
5336
- } // Consumes a specified amount of characters from the buffered data.
5110
+ }
5337
5111
 
5112
+ // Consumes a specified amount of characters from the buffered data.
5338
5113
  }, {
5339
5114
  key: "_getString",
5340
5115
  value: function _getString(n) {
@@ -5342,13 +5117,11 @@ function () {
5342
5117
  var c = 1;
5343
5118
  var ret = p.data;
5344
5119
  n -= ret.length;
5345
-
5346
5120
  while (p = p.next) {
5347
5121
  var str = p.data;
5348
5122
  var nb = n > str.length ? str.length : n;
5349
5123
  if (nb === str.length) ret += str;else ret += str.slice(0, n);
5350
5124
  n -= nb;
5351
-
5352
5125
  if (n === 0) {
5353
5126
  if (nb === str.length) {
5354
5127
  ++c;
@@ -5357,17 +5130,15 @@ function () {
5357
5130
  this.head = p;
5358
5131
  p.data = str.slice(nb);
5359
5132
  }
5360
-
5361
5133
  break;
5362
5134
  }
5363
-
5364
5135
  ++c;
5365
5136
  }
5366
-
5367
5137
  this.length -= c;
5368
5138
  return ret;
5369
- } // Consumes a specified amount of bytes from the buffered data.
5139
+ }
5370
5140
 
5141
+ // Consumes a specified amount of bytes from the buffered data.
5371
5142
  }, {
5372
5143
  key: "_getBuffer",
5373
5144
  value: function _getBuffer(n) {
@@ -5376,13 +5147,11 @@ function () {
5376
5147
  var c = 1;
5377
5148
  p.data.copy(ret);
5378
5149
  n -= p.data.length;
5379
-
5380
5150
  while (p = p.next) {
5381
5151
  var buf = p.data;
5382
5152
  var nb = n > buf.length ? buf.length : n;
5383
5153
  buf.copy(ret, ret.length - n, 0, nb);
5384
5154
  n -= nb;
5385
-
5386
5155
  if (n === 0) {
5387
5156
  if (nb === buf.length) {
5388
5157
  ++c;
@@ -5391,21 +5160,19 @@ function () {
5391
5160
  this.head = p;
5392
5161
  p.data = buf.slice(nb);
5393
5162
  }
5394
-
5395
5163
  break;
5396
5164
  }
5397
-
5398
5165
  ++c;
5399
5166
  }
5400
-
5401
5167
  this.length -= c;
5402
5168
  return ret;
5403
- } // Make sure the linked list only shows the minimal necessary information.
5169
+ }
5404
5170
 
5171
+ // Make sure the linked list only shows the minimal necessary information.
5405
5172
  }, {
5406
5173
  key: custom,
5407
5174
  value: function value(_, options) {
5408
- return inspect(this, _objectSpread({}, options, {
5175
+ return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
5409
5176
  // Only inspect one level.
5410
5177
  depth: 0,
5411
5178
  // It should not recurse.
@@ -5413,7 +5180,6 @@ function () {
5413
5180
  }));
5414
5181
  }
5415
5182
  }]);
5416
-
5417
5183
  return BufferList;
5418
5184
  }();
5419
5185
 
@@ -5422,14 +5188,13 @@ function () {
5422
5188
  /***/ 7049:
5423
5189
  /***/ ((module) => {
5424
5190
 
5425
- // undocumented cb() API, needed for core, not for public API
5426
5191
 
5192
+
5193
+ // undocumented cb() API, needed for core, not for public API
5427
5194
  function destroy(err, cb) {
5428
5195
  var _this = this;
5429
-
5430
5196
  var readableDestroyed = this._readableState && this._readableState.destroyed;
5431
5197
  var writableDestroyed = this._writableState && this._writableState.destroyed;
5432
-
5433
5198
  if (readableDestroyed || writableDestroyed) {
5434
5199
  if (cb) {
5435
5200
  cb(err);
@@ -5441,21 +5206,20 @@ function destroy(err, cb) {
5441
5206
  process.nextTick(emitErrorNT, this, err);
5442
5207
  }
5443
5208
  }
5444
-
5445
5209
  return this;
5446
- } // we set destroyed to true before firing error callbacks in order
5447
- // to make it re-entrance safe in case destroy() is called within callbacks
5210
+ }
5448
5211
 
5212
+ // we set destroyed to true before firing error callbacks in order
5213
+ // to make it re-entrance safe in case destroy() is called within callbacks
5449
5214
 
5450
5215
  if (this._readableState) {
5451
5216
  this._readableState.destroyed = true;
5452
- } // if this is a duplex stream mark the writable part as destroyed as well
5453
-
5217
+ }
5454
5218
 
5219
+ // if this is a duplex stream mark the writable part as destroyed as well
5455
5220
  if (this._writableState) {
5456
5221
  this._writableState.destroyed = true;
5457
5222
  }
5458
-
5459
5223
  this._destroy(err || null, function (err) {
5460
5224
  if (!cb && err) {
5461
5225
  if (!_this._writableState) {
@@ -5473,21 +5237,17 @@ function destroy(err, cb) {
5473
5237
  process.nextTick(emitCloseNT, _this);
5474
5238
  }
5475
5239
  });
5476
-
5477
5240
  return this;
5478
5241
  }
5479
-
5480
5242
  function emitErrorAndCloseNT(self, err) {
5481
5243
  emitErrorNT(self, err);
5482
5244
  emitCloseNT(self);
5483
5245
  }
5484
-
5485
5246
  function emitCloseNT(self) {
5486
5247
  if (self._writableState && !self._writableState.emitClose) return;
5487
5248
  if (self._readableState && !self._readableState.emitClose) return;
5488
5249
  self.emit('close');
5489
5250
  }
5490
-
5491
5251
  function undestroy() {
5492
5252
  if (this._readableState) {
5493
5253
  this._readableState.destroyed = false;
@@ -5495,7 +5255,6 @@ function undestroy() {
5495
5255
  this._readableState.ended = false;
5496
5256
  this._readableState.endEmitted = false;
5497
5257
  }
5498
-
5499
5258
  if (this._writableState) {
5500
5259
  this._writableState.destroyed = false;
5501
5260
  this._writableState.ended = false;
@@ -5506,22 +5265,20 @@ function undestroy() {
5506
5265
  this._writableState.errorEmitted = false;
5507
5266
  }
5508
5267
  }
5509
-
5510
5268
  function emitErrorNT(self, err) {
5511
5269
  self.emit('error', err);
5512
5270
  }
5513
-
5514
5271
  function errorOrDestroy(stream, err) {
5515
5272
  // We have tests that rely on errors being emitted
5516
5273
  // in the same tick, so changing this is semver major.
5517
5274
  // For now when you opt-in to autoDestroy we allow
5518
5275
  // the error to be emitted nextTick. In a future
5519
5276
  // semver major update we should change the default to this.
5277
+
5520
5278
  var rState = stream._readableState;
5521
5279
  var wState = stream._writableState;
5522
5280
  if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
5523
5281
  }
5524
-
5525
5282
  module.exports = {
5526
5283
  destroy: destroy,
5527
5284
  undestroy: undestroy,
@@ -5537,77 +5294,61 @@ module.exports = {
5537
5294
  // permission from the author, Mathias Buus (@mafintosh).
5538
5295
 
5539
5296
 
5540
- var ERR_STREAM_PREMATURE_CLOSE = (__nccwpck_require__(7214)/* .codes.ERR_STREAM_PREMATURE_CLOSE */ .q.ERR_STREAM_PREMATURE_CLOSE);
5541
5297
 
5298
+ var ERR_STREAM_PREMATURE_CLOSE = (__nccwpck_require__(7214)/* .codes.ERR_STREAM_PREMATURE_CLOSE */ .q.ERR_STREAM_PREMATURE_CLOSE);
5542
5299
  function once(callback) {
5543
5300
  var called = false;
5544
5301
  return function () {
5545
5302
  if (called) return;
5546
5303
  called = true;
5547
-
5548
5304
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5549
5305
  args[_key] = arguments[_key];
5550
5306
  }
5551
-
5552
5307
  callback.apply(this, args);
5553
5308
  };
5554
5309
  }
5555
-
5556
5310
  function noop() {}
5557
-
5558
5311
  function isRequest(stream) {
5559
5312
  return stream.setHeader && typeof stream.abort === 'function';
5560
5313
  }
5561
-
5562
5314
  function eos(stream, opts, callback) {
5563
5315
  if (typeof opts === 'function') return eos(stream, null, opts);
5564
5316
  if (!opts) opts = {};
5565
5317
  callback = once(callback || noop);
5566
5318
  var readable = opts.readable || opts.readable !== false && stream.readable;
5567
5319
  var writable = opts.writable || opts.writable !== false && stream.writable;
5568
-
5569
5320
  var onlegacyfinish = function onlegacyfinish() {
5570
5321
  if (!stream.writable) onfinish();
5571
5322
  };
5572
-
5573
5323
  var writableEnded = stream._writableState && stream._writableState.finished;
5574
-
5575
5324
  var onfinish = function onfinish() {
5576
5325
  writable = false;
5577
5326
  writableEnded = true;
5578
5327
  if (!readable) callback.call(stream);
5579
5328
  };
5580
-
5581
5329
  var readableEnded = stream._readableState && stream._readableState.endEmitted;
5582
-
5583
5330
  var onend = function onend() {
5584
5331
  readable = false;
5585
5332
  readableEnded = true;
5586
5333
  if (!writable) callback.call(stream);
5587
5334
  };
5588
-
5589
5335
  var onerror = function onerror(err) {
5590
5336
  callback.call(stream, err);
5591
5337
  };
5592
-
5593
5338
  var onclose = function onclose() {
5594
5339
  var err;
5595
-
5596
5340
  if (readable && !readableEnded) {
5597
5341
  if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
5598
5342
  return callback.call(stream, err);
5599
5343
  }
5600
-
5601
5344
  if (writable && !writableEnded) {
5602
5345
  if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
5603
5346
  return callback.call(stream, err);
5604
5347
  }
5605
5348
  };
5606
-
5607
5349
  var onrequest = function onrequest() {
5608
5350
  stream.req.on('finish', onfinish);
5609
5351
  };
5610
-
5611
5352
  if (isRequest(stream)) {
5612
5353
  stream.on('complete', onfinish);
5613
5354
  stream.on('abort', onclose);
@@ -5617,7 +5358,6 @@ function eos(stream, opts, callback) {
5617
5358
  stream.on('end', onlegacyfinish);
5618
5359
  stream.on('close', onlegacyfinish);
5619
5360
  }
5620
-
5621
5361
  stream.on('end', onend);
5622
5362
  stream.on('finish', onfinish);
5623
5363
  if (opts.error !== false) stream.on('error', onerror);
@@ -5635,7 +5375,6 @@ function eos(stream, opts, callback) {
5635
5375
  stream.removeListener('close', onclose);
5636
5376
  };
5637
5377
  }
5638
-
5639
5378
  module.exports = eos;
5640
5379
 
5641
5380
  /***/ }),
@@ -5646,52 +5385,42 @@ module.exports = eos;
5646
5385
 
5647
5386
 
5648
5387
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
5649
-
5650
5388
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5651
-
5652
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
5653
-
5654
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5655
-
5656
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5657
-
5389
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5390
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5391
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5392
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5393
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5658
5394
  var ERR_INVALID_ARG_TYPE = (__nccwpck_require__(7214)/* .codes.ERR_INVALID_ARG_TYPE */ .q.ERR_INVALID_ARG_TYPE);
5659
-
5660
5395
  function from(Readable, iterable, opts) {
5661
5396
  var iterator;
5662
-
5663
5397
  if (iterable && typeof iterable.next === 'function') {
5664
5398
  iterator = iterable;
5665
5399
  } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable);
5666
-
5667
5400
  var readable = new Readable(_objectSpread({
5668
5401
  objectMode: true
5669
- }, opts)); // Reading boolean to protect against _read
5402
+ }, opts));
5403
+ // Reading boolean to protect against _read
5670
5404
  // being called before last iteration completion.
5671
-
5672
5405
  var reading = false;
5673
-
5674
5406
  readable._read = function () {
5675
5407
  if (!reading) {
5676
5408
  reading = true;
5677
5409
  next();
5678
5410
  }
5679
5411
  };
5680
-
5681
5412
  function next() {
5682
5413
  return _next2.apply(this, arguments);
5683
5414
  }
5684
-
5685
5415
  function _next2() {
5686
5416
  _next2 = _asyncToGenerator(function* () {
5687
5417
  try {
5688
- var _ref = yield iterator.next(),
5689
- value = _ref.value,
5690
- done = _ref.done;
5691
-
5418
+ var _yield$iterator$next = yield iterator.next(),
5419
+ value = _yield$iterator$next.value,
5420
+ done = _yield$iterator$next.done;
5692
5421
  if (done) {
5693
5422
  readable.push(null);
5694
- } else if (readable.push((yield value))) {
5423
+ } else if (readable.push(yield value)) {
5695
5424
  next();
5696
5425
  } else {
5697
5426
  reading = false;
@@ -5702,12 +5431,11 @@ function from(Readable, iterable, opts) {
5702
5431
  });
5703
5432
  return _next2.apply(this, arguments);
5704
5433
  }
5705
-
5706
5434
  return readable;
5707
5435
  }
5708
-
5709
5436
  module.exports = from;
5710
5437
 
5438
+
5711
5439
  /***/ }),
5712
5440
 
5713
5441
  /***/ 6989:
@@ -5717,8 +5445,8 @@ module.exports = from;
5717
5445
  // permission from the author, Mathias Buus (@mafintosh).
5718
5446
 
5719
5447
 
5720
- var eos;
5721
5448
 
5449
+ var eos;
5722
5450
  function once(callback) {
5723
5451
  var called = false;
5724
5452
  return function () {
@@ -5727,20 +5455,16 @@ function once(callback) {
5727
5455
  callback.apply(void 0, arguments);
5728
5456
  };
5729
5457
  }
5730
-
5731
5458
  var _require$codes = (__nccwpck_require__(7214)/* .codes */ .q),
5732
- ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
5733
- ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
5734
-
5459
+ ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
5460
+ ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
5735
5461
  function noop(err) {
5736
5462
  // Rethrow the error if it exists to avoid swallowing it
5737
5463
  if (err) throw err;
5738
5464
  }
5739
-
5740
5465
  function isRequest(stream) {
5741
5466
  return stream.setHeader && typeof stream.abort === 'function';
5742
5467
  }
5743
-
5744
5468
  function destroyer(stream, reading, writing, callback) {
5745
5469
  callback = once(callback);
5746
5470
  var closed = false;
@@ -5760,40 +5484,34 @@ function destroyer(stream, reading, writing, callback) {
5760
5484
  return function (err) {
5761
5485
  if (closed) return;
5762
5486
  if (destroyed) return;
5763
- destroyed = true; // request.destroy just do .end - .abort is what we want
5487
+ destroyed = true;
5764
5488
 
5489
+ // request.destroy just do .end - .abort is what we want
5765
5490
  if (isRequest(stream)) return stream.abort();
5766
5491
  if (typeof stream.destroy === 'function') return stream.destroy();
5767
5492
  callback(err || new ERR_STREAM_DESTROYED('pipe'));
5768
5493
  };
5769
5494
  }
5770
-
5771
5495
  function call(fn) {
5772
5496
  fn();
5773
5497
  }
5774
-
5775
5498
  function pipe(from, to) {
5776
5499
  return from.pipe(to);
5777
5500
  }
5778
-
5779
5501
  function popCallback(streams) {
5780
5502
  if (!streams.length) return noop;
5781
5503
  if (typeof streams[streams.length - 1] !== 'function') return noop;
5782
5504
  return streams.pop();
5783
5505
  }
5784
-
5785
5506
  function pipeline() {
5786
5507
  for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
5787
5508
  streams[_key] = arguments[_key];
5788
5509
  }
5789
-
5790
5510
  var callback = popCallback(streams);
5791
5511
  if (Array.isArray(streams[0])) streams = streams[0];
5792
-
5793
5512
  if (streams.length < 2) {
5794
5513
  throw new ERR_MISSING_ARGS('streams');
5795
5514
  }
5796
-
5797
5515
  var error;
5798
5516
  var destroys = streams.map(function (stream, i) {
5799
5517
  var reading = i < streams.length - 1;
@@ -5808,7 +5526,6 @@ function pipeline() {
5808
5526
  });
5809
5527
  return streams.reduce(pipe);
5810
5528
  }
5811
-
5812
5529
  module.exports = pipeline;
5813
5530
 
5814
5531
  /***/ }),
@@ -5819,27 +5536,22 @@ module.exports = pipeline;
5819
5536
 
5820
5537
 
5821
5538
  var ERR_INVALID_OPT_VALUE = (__nccwpck_require__(7214)/* .codes.ERR_INVALID_OPT_VALUE */ .q.ERR_INVALID_OPT_VALUE);
5822
-
5823
5539
  function highWaterMarkFrom(options, isDuplex, duplexKey) {
5824
5540
  return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
5825
5541
  }
5826
-
5827
5542
  function getHighWaterMark(state, options, duplexKey, isDuplex) {
5828
5543
  var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
5829
-
5830
5544
  if (hwm != null) {
5831
5545
  if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
5832
5546
  var name = isDuplex ? duplexKey : 'highWaterMark';
5833
5547
  throw new ERR_INVALID_OPT_VALUE(name, hwm);
5834
5548
  }
5835
-
5836
5549
  return Math.floor(hwm);
5837
- } // Default value
5838
-
5550
+ }
5839
5551
 
5552
+ // Default value
5840
5553
  return state.objectMode ? 16 : 16 * 1024;
5841
5554
  }
5842
-
5843
5555
  module.exports = {
5844
5556
  getHighWaterMark: getHighWaterMark
5845
5557
  };
@@ -6836,15 +6548,6 @@ function bisearch(ucs) {
6836
6548
  }
6837
6549
 
6838
6550
 
6839
- /***/ }),
6840
-
6841
- /***/ 9291:
6842
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
6843
-
6844
- var x = y => { var x = {}; __nccwpck_require__.d(x, y); return x; }
6845
- var y = x => () => x
6846
- module.exports = x({ ["componentize"]: () => __WEBPACK_EXTERNAL_MODULE__bytecodealliance_componentize_js_a7e85369__.componentize });
6847
-
6848
6551
  /***/ }),
6849
6552
 
6850
6553
  /***/ 9491:
@@ -7133,16 +6836,16 @@ function chalkTemplate(firstString, ...arguments_) {
7133
6836
 
7134
6837
  /***/ }),
7135
6838
 
7136
- /***/ 67:
6839
+ /***/ 2719:
7137
6840
  /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {
7138
6841
 
7139
6842
 
7140
6843
  // EXPORTS
7141
6844
  __nccwpck_require__.d(__webpack_exports__, {
7142
- "Z": () => (/* binding */ ora)
6845
+ "ZP": () => (/* binding */ ora)
7143
6846
  });
7144
6847
 
7145
- // UNUSED EXPORTS: oraPromise
6848
+ // UNUSED EXPORTS: oraPromise, spinners
7146
6849
 
7147
6850
  // EXTERNAL MODULE: external "node:process"
7148
6851
  var external_node_process_ = __nccwpck_require__(7742);
@@ -7940,7 +7643,7 @@ function isInteractive({stream = process.stdout} = {}) {
7940
7643
  const external_node_readline_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:readline");
7941
7644
  // EXTERNAL MODULE: ./node_modules/bl/bl.js
7942
7645
  var bl = __nccwpck_require__(336);
7943
- ;// CONCATENATED MODULE: ./node_modules/ora/utilities.js
7646
+ ;// CONCATENATED MODULE: ./node_modules/stdin-discarder/index.js
7944
7647
 
7945
7648
 
7946
7649
 
@@ -7957,7 +7660,7 @@ class StdinDiscarder {
7957
7660
  this.#mutedStream.pipe(external_node_process_.stdout);
7958
7661
 
7959
7662
  const self = this; // eslint-disable-line unicorn/no-this-assignment
7960
- this.#ourEmit = function (event, data, ...args) {
7663
+ this.#ourEmit = function (event, data, ...arguments_) {
7961
7664
  const {stdin} = external_node_process_;
7962
7665
  if (self.#requests > 0 || stdin.emit === self.#ourEmit) {
7963
7666
  if (event === 'keypress') { // Fixes readline behavior
@@ -7968,9 +7671,9 @@ class StdinDiscarder {
7968
7671
  external_node_process_.emit('SIGINT');
7969
7672
  }
7970
7673
 
7971
- Reflect.apply(self.#ourEmit, this, [event, data, ...args]);
7674
+ Reflect.apply(self.#ourEmit, this, [event, data, ...arguments_]);
7972
7675
  } else {
7973
- Reflect.apply(external_node_process_.stdin.emit, this, [event, data, ...args]);
7676
+ Reflect.apply(external_node_process_.stdin.emit, this, [event, data, ...arguments_]);
7974
7677
  }
7975
7678
  };
7976
7679
  }
@@ -8027,8 +7730,11 @@ class StdinDiscarder {
8027
7730
  }
8028
7731
  }
8029
7732
 
8030
- ;// CONCATENATED MODULE: ./node_modules/ora/index.js
7733
+ const stdinDiscarder = new StdinDiscarder();
8031
7734
 
7735
+ /* harmony default export */ const stdin_discarder = (stdinDiscarder);
7736
+
7737
+ ;// CONCATENATED MODULE: ./node_modules/ora/index.js
8032
7738
 
8033
7739
 
8034
7740
 
@@ -8039,7 +7745,6 @@ class StdinDiscarder {
8039
7745
 
8040
7746
 
8041
7747
 
8042
- let stdinDiscarder;
8043
7748
 
8044
7749
  class Ora {
8045
7750
  #linesToClear = 0;
@@ -8060,10 +7765,6 @@ class Ora {
8060
7765
  color;
8061
7766
 
8062
7767
  constructor(options) {
8063
- if (!stdinDiscarder) {
8064
- stdinDiscarder = new StdinDiscarder();
8065
- }
8066
-
8067
7768
  if (typeof options === 'string') {
8068
7769
  options = {
8069
7770
  text: options,
@@ -8313,7 +8014,7 @@ class Ora {
8313
8014
 
8314
8015
  if (this.#options.discardStdin && external_node_process_.stdin.isTTY) {
8315
8016
  this.#isDiscardingStdin = true;
8316
- stdinDiscarder.start();
8017
+ stdin_discarder.start();
8317
8018
  }
8318
8019
 
8319
8020
  this.render();
@@ -8336,7 +8037,7 @@ class Ora {
8336
8037
  }
8337
8038
 
8338
8039
  if (this.#options.discardStdin && external_node_process_.stdin.isTTY && this.#isDiscardingStdin) {
8339
- stdinDiscarder.stop();
8040
+ stdin_discarder.stop();
8340
8041
  this.#isDiscardingStdin = false;
8341
8042
  }
8342
8043
 
@@ -8416,6 +8117,8 @@ async function oraPromise(action, options) {
8416
8117
  }
8417
8118
 
8418
8119
 
8120
+
8121
+
8419
8122
  /***/ }),
8420
8123
 
8421
8124
  /***/ 1124:
@@ -8475,6 +8178,8 @@ __nccwpck_require__.d(__webpack_exports__, {
8475
8178
 
8476
8179
 
8477
8180
 
8181
+
8182
+
8478
8183
  function characters(str) {
8479
8184
  return str.split("");
8480
8185
  }
@@ -8528,48 +8233,26 @@ function return_this() { return this; }
8528
8233
  function return_null() { return null; }
8529
8234
 
8530
8235
  var MAP = (function() {
8531
- function MAP(a, f, backwards) {
8532
- var ret = [], top = [], i;
8533
- function doit() {
8534
- var val = f(a[i], i);
8535
- var is_last = val instanceof Last;
8536
- if (is_last) val = val.v;
8537
- if (val instanceof AtTop) {
8538
- val = val.v;
8539
- if (val instanceof Splice) {
8540
- top.push.apply(top, backwards ? val.v.slice().reverse() : val.v);
8541
- } else {
8542
- top.push(val);
8543
- }
8544
- } else if (val !== skip) {
8545
- if (val instanceof Splice) {
8546
- ret.push.apply(ret, backwards ? val.v.slice().reverse() : val.v);
8547
- } else {
8548
- ret.push(val);
8549
- }
8550
- }
8551
- return is_last;
8552
- }
8553
- if (Array.isArray(a)) {
8554
- if (backwards) {
8555
- for (i = a.length; --i >= 0;) if (doit()) break;
8556
- ret.reverse();
8557
- top.reverse();
8558
- } else {
8559
- for (i = 0; i < a.length; ++i) if (doit()) break;
8236
+ function MAP(a, tw, allow_splicing = true) {
8237
+ const new_a = [];
8238
+
8239
+ for (let i = 0; i < a.length; ++i) {
8240
+ let item = a[i];
8241
+ let ret = item.transform(tw, allow_splicing);
8242
+
8243
+ if (ret instanceof ast_AST_Node) {
8244
+ new_a.push(ret);
8245
+ } else if (ret instanceof Splice) {
8246
+ new_a.push(...ret.v);
8560
8247
  }
8561
- } else {
8562
- for (i in a) if (HOP(a, i)) if (doit()) break;
8563
8248
  }
8564
- return top.concat(ret);
8249
+
8250
+ return new_a;
8565
8251
  }
8566
- MAP.at_top = function(val) { return new AtTop(val); };
8252
+
8567
8253
  MAP.splice = function(val) { return new Splice(val); };
8568
- MAP.last = function(val) { return new Last(val); };
8569
- var skip = MAP.skip = {};
8570
- function AtTop(val) { this.v = val; }
8254
+ MAP.skip = {};
8571
8255
  function Splice(val) { this.v = val; }
8572
- function Last(val) { this.v = val; }
8573
8256
  return MAP;
8574
8257
  })();
8575
8258
 
@@ -8862,6 +8545,19 @@ var UNICODE = {
8862
8545
  ID_Continue: /(?:[$0-9A-Z_a-z\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF])+/,
8863
8546
  };
8864
8547
 
8548
+ try {
8549
+ UNICODE = {
8550
+ // https://262.ecma-international.org/13.0/#prod-IdentifierStartChar
8551
+ // $, _, ID_Start
8552
+ ID_Start: new RegExp("[_$\\p{ID_Start}]", "u"),
8553
+ // https://262.ecma-international.org/13.0/#prod-IdentifierPartChar
8554
+ // $, zero-width-joiner, zero-width-non-joiner, ID_Continue
8555
+ ID_Continue: new RegExp("[$\\u200C\\u200D\\p{ID_Continue}]+", "u"),
8556
+ };
8557
+ } catch(e) {
8558
+ // Could not use modern JS \p{...}. UNICODE is already defined above so let's continue
8559
+ }
8560
+
8865
8561
  function get_full_char(str, pos) {
8866
8562
  if (is_surrogate_pair_head(str.charCodeAt(pos))) {
8867
8563
  if (is_surrogate_pair_tail(str.charCodeAt(pos + 1))) {
@@ -10655,7 +10351,12 @@ function parse_parse($TEXT, options) {
10655
10351
  }
10656
10352
 
10657
10353
  function try_() {
10658
- var body = block_(), bcatch = null, bfinally = null;
10354
+ var body, bcatch = null, bfinally = null;
10355
+ body = new AST_TryBlock({
10356
+ start : S.token,
10357
+ body : block_(),
10358
+ end : prev(),
10359
+ });
10659
10360
  if (is("keyword", "catch")) {
10660
10361
  var start = S.token;
10661
10362
  next();
@@ -10691,14 +10392,20 @@ function parse_parse($TEXT, options) {
10691
10392
  });
10692
10393
  }
10693
10394
 
10395
+ /**
10396
+ * var
10397
+ * vardef1 = 2,
10398
+ * vardef2 = 3;
10399
+ */
10694
10400
  function vardefs(no_in, kind) {
10695
- var a = [];
10401
+ var var_defs = [];
10696
10402
  var def;
10697
10403
  for (;;) {
10698
10404
  var sym_type =
10699
10405
  kind === "var" ? AST_SymbolVar :
10700
10406
  kind === "const" ? AST_SymbolConst :
10701
10407
  kind === "let" ? AST_SymbolLet : null;
10408
+ // var { a } = b
10702
10409
  if (is("punc", "{") || is("punc", "[")) {
10703
10410
  def = new AST_VarDef({
10704
10411
  start: S.token,
@@ -10718,12 +10425,12 @@ function parse_parse($TEXT, options) {
10718
10425
  });
10719
10426
  if (def.name.name == "import") croak("Unexpected token: import");
10720
10427
  }
10721
- a.push(def);
10428
+ var_defs.push(def);
10722
10429
  if (!is("punc", ","))
10723
10430
  break;
10724
10431
  next();
10725
10432
  }
10726
- return a;
10433
+ return var_defs;
10727
10434
  }
10728
10435
 
10729
10436
  var var_ = function(no_in) {
@@ -10884,7 +10591,7 @@ function parse_parse($TEXT, options) {
10884
10591
  if (is("operator", "new")) {
10885
10592
  return new_(allow_calls);
10886
10593
  }
10887
- if (is("operator", "import")) {
10594
+ if (is("name", "import") && is_token(peek(), "punc", ".")) {
10888
10595
  return import_meta();
10889
10596
  }
10890
10597
  var start = S.token;
@@ -11380,7 +11087,7 @@ function parse_parse($TEXT, options) {
11380
11087
 
11381
11088
  function import_meta() {
11382
11089
  var start = S.token;
11383
- expect_token("operator", "import");
11090
+ expect_token("name", "import");
11384
11091
  expect_token("punc", ".");
11385
11092
  expect_token("name", "meta");
11386
11093
  return subscripts(new AST_ImportMeta({
@@ -11390,9 +11097,10 @@ function parse_parse($TEXT, options) {
11390
11097
  }
11391
11098
 
11392
11099
  function map_name(is_import) {
11393
- function make_symbol(type) {
11100
+ function make_symbol(type, quote) {
11394
11101
  return new type({
11395
11102
  name: as_property_name(),
11103
+ quote: quote || undefined,
11396
11104
  start: prev(),
11397
11105
  end: prev()
11398
11106
  });
@@ -11405,16 +11113,16 @@ function parse_parse($TEXT, options) {
11405
11113
  var name;
11406
11114
 
11407
11115
  if (is_import) {
11408
- foreign_name = make_symbol(foreign_type);
11116
+ foreign_name = make_symbol(foreign_type, start.quote);
11409
11117
  } else {
11410
- name = make_symbol(type);
11118
+ name = make_symbol(type, start.quote);
11411
11119
  }
11412
11120
  if (is("name", "as")) {
11413
11121
  next(); // The "as" word
11414
11122
  if (is_import) {
11415
11123
  name = make_symbol(type);
11416
11124
  } else {
11417
- foreign_name = make_symbol(foreign_type);
11125
+ foreign_name = make_symbol(foreign_type, S.token.quote);
11418
11126
  }
11419
11127
  } else if (is_import) {
11420
11128
  name = new type(foreign_name);
@@ -11430,20 +11138,26 @@ function parse_parse($TEXT, options) {
11430
11138
  });
11431
11139
  }
11432
11140
 
11433
- function map_nameAsterisk(is_import, name) {
11141
+ function map_nameAsterisk(is_import, import_or_export_foreign_name) {
11434
11142
  var foreign_type = is_import ? AST_SymbolImportForeign : AST_SymbolExportForeign;
11435
11143
  var type = is_import ? AST_SymbolImport : AST_SymbolExport;
11436
11144
  var start = S.token;
11437
- var foreign_name;
11145
+ var name, foreign_name;
11438
11146
  var end = prev();
11439
11147
 
11148
+ if (is_import) {
11149
+ name = import_or_export_foreign_name;
11150
+ } else {
11151
+ foreign_name = import_or_export_foreign_name;
11152
+ }
11153
+
11440
11154
  name = name || new type({
11441
11155
  start: start,
11442
11156
  name: "*",
11443
11157
  end: end,
11444
11158
  });
11445
11159
 
11446
- foreign_name = new foreign_type({
11160
+ foreign_name = foreign_name || new foreign_type({
11447
11161
  start: start,
11448
11162
  name: "*",
11449
11163
  end: end,
@@ -11472,9 +11186,9 @@ function parse_parse($TEXT, options) {
11472
11186
  } else if (is("operator", "*")) {
11473
11187
  var name;
11474
11188
  next();
11475
- if (is_import && is("name", "as")) {
11189
+ if (is("name", "as")) {
11476
11190
  next(); // The "as" word
11477
- name = as_symbol(is_import ? AST_SymbolImport : AST_SymbolExportForeign);
11191
+ name = is_import ? as_symbol(AST_SymbolImport) : as_symbol_or_string(AST_SymbolExportForeign);
11478
11192
  }
11479
11193
  names = [map_nameAsterisk(is_import, name)];
11480
11194
  }
@@ -11639,6 +11353,27 @@ function parse_parse($TEXT, options) {
11639
11353
  return sym;
11640
11354
  }
11641
11355
 
11356
+ function as_symbol_or_string(type) {
11357
+ if (!is("name")) {
11358
+ if (!is("string")) {
11359
+ croak("Name or string expected");
11360
+ }
11361
+ var tok = S.token;
11362
+ var ret = new type({
11363
+ start : tok,
11364
+ end : tok,
11365
+ name : tok.value,
11366
+ quote : tok.quote
11367
+ });
11368
+ next();
11369
+ return ret;
11370
+ }
11371
+ var sym = _make_symbol(type);
11372
+ _verify_symbol(sym);
11373
+ next();
11374
+ return sym;
11375
+ }
11376
+
11642
11377
  // Annotate AST_Call, AST_Lambda or AST_New with the special comments
11643
11378
  function annotate(node) {
11644
11379
  var start = node.start;
@@ -12124,6 +11859,14 @@ class ast_AST_Token {
12124
11859
  Object.seal(this);
12125
11860
  }
12126
11861
 
11862
+ // Return a string summary of the token for node.js console.log
11863
+ [Symbol.for("nodejs.util.inspect.custom")](_depth, options) {
11864
+ const special = str => options.stylize(str, "special");
11865
+ const quote = typeof this.value === "string" && this.value.includes("`") ? "'" : "`";
11866
+ const value = `${quote}${this.value}${quote}`;
11867
+ return `${special("[AST_Token")} ${value} at ${this.line}:${this.col}${special("]")}`;
11868
+ }
11869
+
12127
11870
  get nlb() {
12128
11871
  return has_tok_flag(this, TOK_FLAG_NLB);
12129
11872
  }
@@ -12254,8 +11997,21 @@ var AST_SimpleStatement = DEFNODE("SimpleStatement", "body", function AST_Simple
12254
11997
 
12255
11998
  function walk_body(node, visitor) {
12256
11999
  const body = node.body;
12257
- for (var i = 0, len = body.length; i < len; i++) {
12258
- body[i]._walk(visitor);
12000
+ if (visitor.walk_defun_first) {
12001
+ for (var i = 0, len = body.length; i < len; i++) {
12002
+ if (body[i] instanceof AST_Defun) {
12003
+ body[i]._walk(visitor);
12004
+ }
12005
+ }
12006
+ for (var i = 0, len = body.length; i < len; i++) {
12007
+ if (!(body[i] instanceof AST_Defun)) {
12008
+ body[i]._walk(visitor);
12009
+ }
12010
+ }
12011
+ } else {
12012
+ for (var i = 0, len = body.length; i < len; i++) {
12013
+ body[i]._walk(visitor);
12014
+ }
12259
12015
  }
12260
12016
  }
12261
12017
 
@@ -13007,6 +12763,7 @@ var AST_Jump = DEFNODE("Jump", null, function AST_Jump(props) {
13007
12763
  $documentation: "Base class for “jumps” (for now that's `return`, `throw`, `break` and `continue`)"
13008
12764
  }, AST_Statement);
13009
12765
 
12766
+ /** Base class for “exits” (`return` and `throw`) */
13010
12767
  var AST_Exit = DEFNODE("Exit", "value", function AST_Exit(props) {
13011
12768
  if (props) {
13012
12769
  this.value = props.value;
@@ -13269,12 +13026,11 @@ var AST_Case = DEFNODE("Case", "expression", function AST_Case(props) {
13269
13026
 
13270
13027
  /* -----[ EXCEPTIONS ]----- */
13271
13028
 
13272
- var AST_Try = DEFNODE("Try", "bcatch bfinally", function AST_Try(props) {
13029
+ var AST_Try = DEFNODE("Try", "body bcatch bfinally", function AST_Try(props) {
13273
13030
  if (props) {
13031
+ this.body = props.body;
13274
13032
  this.bcatch = props.bcatch;
13275
13033
  this.bfinally = props.bfinally;
13276
- this.body = props.body;
13277
- this.block_scope = props.block_scope;
13278
13034
  this.start = props.start;
13279
13035
  this.end = props.end;
13280
13036
  }
@@ -13283,12 +13039,13 @@ var AST_Try = DEFNODE("Try", "bcatch bfinally", function AST_Try(props) {
13283
13039
  }, {
13284
13040
  $documentation: "A `try` statement",
13285
13041
  $propdoc: {
13042
+ body: "[AST_TryBlock] the try block",
13286
13043
  bcatch: "[AST_Catch?] the catch block, or null if not present",
13287
13044
  bfinally: "[AST_Finally?] the finally block, or null if not present"
13288
13045
  },
13289
13046
  _walk: function(visitor) {
13290
13047
  return visitor._visit(this, function() {
13291
- walk_body(this, visitor);
13048
+ this.body._walk(visitor);
13292
13049
  if (this.bcatch) this.bcatch._walk(visitor);
13293
13050
  if (this.bfinally) this.bfinally._walk(visitor);
13294
13051
  });
@@ -13296,9 +13053,21 @@ var AST_Try = DEFNODE("Try", "bcatch bfinally", function AST_Try(props) {
13296
13053
  _children_backwards(push) {
13297
13054
  if (this.bfinally) push(this.bfinally);
13298
13055
  if (this.bcatch) push(this.bcatch);
13299
- let i = this.body.length;
13300
- while (i--) push(this.body[i]);
13056
+ push(this.body);
13301
13057
  },
13058
+ }, AST_Statement);
13059
+
13060
+ var AST_TryBlock = DEFNODE("TryBlock", null, function AST_TryBlock(props) {
13061
+ if (props) {
13062
+ this.body = props.body;
13063
+ this.block_scope = props.block_scope;
13064
+ this.start = props.start;
13065
+ this.end = props.end;
13066
+ }
13067
+
13068
+ this.flags = 0;
13069
+ }, {
13070
+ $documentation: "The `try` block of a try statement"
13302
13071
  }, AST_Block);
13303
13072
 
13304
13073
  var AST_Catch = DEFNODE("Catch", "argname", function AST_Catch(props) {
@@ -14601,6 +14370,7 @@ var AST_SymbolImportForeign = DEFNODE("SymbolImportForeign", null, function AST_
14601
14370
  this.scope = props.scope;
14602
14371
  this.name = props.name;
14603
14372
  this.thedef = props.thedef;
14373
+ this.quote = props.quote;
14604
14374
  this.start = props.start;
14605
14375
  this.end = props.end;
14606
14376
  }
@@ -14652,6 +14422,7 @@ var AST_SymbolExport = DEFNODE("SymbolExport", null, function AST_SymbolExport(p
14652
14422
  this.scope = props.scope;
14653
14423
  this.name = props.name;
14654
14424
  this.thedef = props.thedef;
14425
+ this.quote = props.quote;
14655
14426
  this.start = props.start;
14656
14427
  this.end = props.end;
14657
14428
  }
@@ -14666,6 +14437,7 @@ var AST_SymbolExportForeign = DEFNODE("SymbolExportForeign", null, function AST_
14666
14437
  this.scope = props.scope;
14667
14438
  this.name = props.name;
14668
14439
  this.thedef = props.thedef;
14440
+ this.quote = props.quote;
14669
14441
  this.start = props.start;
14670
14442
  this.end = props.end;
14671
14443
  }
@@ -15018,10 +14790,11 @@ const walk_abort = Symbol("abort walk");
15018
14790
  /* -----[ TreeWalker ]----- */
15019
14791
 
15020
14792
  class TreeWalker {
15021
- constructor(callback) {
14793
+ constructor(callback, { walk_defun_first = false } = {}) {
15022
14794
  this.visit = callback;
15023
14795
  this.stack = [];
15024
14796
  this.directives = Object.create(null);
14797
+ this.walk_defun_first = walk_defun_first;
15025
14798
  }
15026
14799
 
15027
14800
  _visit(node, descend) {
@@ -15193,12 +14966,6 @@ function def_transform(node, descend) {
15193
14966
  });
15194
14967
  }
15195
14968
 
15196
- function do_list(list, tw) {
15197
- return MAP(list, function(node) {
15198
- return node.transform(tw, true);
15199
- });
15200
- }
15201
-
15202
14969
  def_transform(ast_AST_Node, noop);
15203
14970
 
15204
14971
  def_transform(AST_LabeledStatement, function(self, tw) {
@@ -15211,7 +14978,7 @@ def_transform(AST_SimpleStatement, function(self, tw) {
15211
14978
  });
15212
14979
 
15213
14980
  def_transform(AST_Block, function(self, tw) {
15214
- self.body = do_list(self.body, tw);
14981
+ self.body = MAP(self.body, tw);
15215
14982
  });
15216
14983
 
15217
14984
  def_transform(AST_Do, function(self, tw) {
@@ -15258,27 +15025,27 @@ def_transform(AST_If, function(self, tw) {
15258
15025
 
15259
15026
  def_transform(AST_Switch, function(self, tw) {
15260
15027
  self.expression = self.expression.transform(tw);
15261
- self.body = do_list(self.body, tw);
15028
+ self.body = MAP(self.body, tw);
15262
15029
  });
15263
15030
 
15264
15031
  def_transform(AST_Case, function(self, tw) {
15265
15032
  self.expression = self.expression.transform(tw);
15266
- self.body = do_list(self.body, tw);
15033
+ self.body = MAP(self.body, tw);
15267
15034
  });
15268
15035
 
15269
15036
  def_transform(AST_Try, function(self, tw) {
15270
- self.body = do_list(self.body, tw);
15037
+ self.body = self.body.transform(tw);
15271
15038
  if (self.bcatch) self.bcatch = self.bcatch.transform(tw);
15272
15039
  if (self.bfinally) self.bfinally = self.bfinally.transform(tw);
15273
15040
  });
15274
15041
 
15275
15042
  def_transform(AST_Catch, function(self, tw) {
15276
15043
  if (self.argname) self.argname = self.argname.transform(tw);
15277
- self.body = do_list(self.body, tw);
15044
+ self.body = MAP(self.body, tw);
15278
15045
  });
15279
15046
 
15280
15047
  def_transform(AST_Definitions, function(self, tw) {
15281
- self.definitions = do_list(self.definitions, tw);
15048
+ self.definitions = MAP(self.definitions, tw);
15282
15049
  });
15283
15050
 
15284
15051
  def_transform(AST_VarDef, function(self, tw) {
@@ -15287,26 +15054,26 @@ def_transform(AST_VarDef, function(self, tw) {
15287
15054
  });
15288
15055
 
15289
15056
  def_transform(AST_Destructuring, function(self, tw) {
15290
- self.names = do_list(self.names, tw);
15057
+ self.names = MAP(self.names, tw);
15291
15058
  });
15292
15059
 
15293
15060
  def_transform(AST_Lambda, function(self, tw) {
15294
15061
  if (self.name) self.name = self.name.transform(tw);
15295
- self.argnames = do_list(self.argnames, tw);
15062
+ self.argnames = MAP(self.argnames, tw, /* allow_splicing */ false);
15296
15063
  if (self.body instanceof ast_AST_Node) {
15297
15064
  self.body = self.body.transform(tw);
15298
15065
  } else {
15299
- self.body = do_list(self.body, tw);
15066
+ self.body = MAP(self.body, tw);
15300
15067
  }
15301
15068
  });
15302
15069
 
15303
15070
  def_transform(AST_Call, function(self, tw) {
15304
15071
  self.expression = self.expression.transform(tw);
15305
- self.args = do_list(self.args, tw);
15072
+ self.args = MAP(self.args, tw, /* allow_splicing */ false);
15306
15073
  });
15307
15074
 
15308
15075
  def_transform(ast_AST_Sequence, function(self, tw) {
15309
- const result = do_list(self.expressions, tw);
15076
+ const result = MAP(self.expressions, tw);
15310
15077
  self.expressions = result.length
15311
15078
  ? result
15312
15079
  : [new AST_Number({ value: 0 })];
@@ -15354,11 +15121,11 @@ def_transform(AST_Conditional, function(self, tw) {
15354
15121
  });
15355
15122
 
15356
15123
  def_transform(ast_AST_Array, function(self, tw) {
15357
- self.elements = do_list(self.elements, tw);
15124
+ self.elements = MAP(self.elements, tw);
15358
15125
  });
15359
15126
 
15360
15127
  def_transform(AST_Object, function(self, tw) {
15361
- self.properties = do_list(self.properties, tw);
15128
+ self.properties = MAP(self.properties, tw);
15362
15129
  });
15363
15130
 
15364
15131
  def_transform(AST_ObjectProperty, function(self, tw) {
@@ -15371,11 +15138,11 @@ def_transform(AST_ObjectProperty, function(self, tw) {
15371
15138
  def_transform(AST_Class, function(self, tw) {
15372
15139
  if (self.name) self.name = self.name.transform(tw);
15373
15140
  if (self.extends) self.extends = self.extends.transform(tw);
15374
- self.properties = do_list(self.properties, tw);
15141
+ self.properties = MAP(self.properties, tw);
15375
15142
  });
15376
15143
 
15377
15144
  def_transform(AST_ClassStaticBlock, function(self, tw) {
15378
- self.body = do_list(self.body, tw);
15145
+ self.body = MAP(self.body, tw);
15379
15146
  });
15380
15147
 
15381
15148
  def_transform(AST_Expansion, function(self, tw) {
@@ -15389,19 +15156,19 @@ def_transform(AST_NameMapping, function(self, tw) {
15389
15156
 
15390
15157
  def_transform(AST_Import, function(self, tw) {
15391
15158
  if (self.imported_name) self.imported_name = self.imported_name.transform(tw);
15392
- if (self.imported_names) do_list(self.imported_names, tw);
15159
+ if (self.imported_names) MAP(self.imported_names, tw);
15393
15160
  self.module_name = self.module_name.transform(tw);
15394
15161
  });
15395
15162
 
15396
15163
  def_transform(AST_Export, function(self, tw) {
15397
15164
  if (self.exported_definition) self.exported_definition = self.exported_definition.transform(tw);
15398
15165
  if (self.exported_value) self.exported_value = self.exported_value.transform(tw);
15399
- if (self.exported_names) do_list(self.exported_names, tw);
15166
+ if (self.exported_names) MAP(self.exported_names, tw);
15400
15167
  if (self.module_name) self.module_name = self.module_name.transform(tw);
15401
15168
  });
15402
15169
 
15403
15170
  def_transform(AST_TemplateString, function(self, tw) {
15404
- self.segments = do_list(self.segments, tw);
15171
+ self.segments = MAP(self.segments, tw);
15405
15172
  });
15406
15173
 
15407
15174
  def_transform(AST_PrefixedTemplateString, function(self, tw) {
@@ -15640,7 +15407,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
15640
15407
  return new AST_Try({
15641
15408
  start : my_start_token(M),
15642
15409
  end : my_end_token(M),
15643
- body : from_moz(M.block).body,
15410
+ body : new AST_TryBlock(from_moz(M.block)),
15644
15411
  bcatch : from_moz(handlers[0]),
15645
15412
  bfinally : M.finalizer ? new AST_Finally(from_moz(M.finalizer)) : null
15646
15413
  });
@@ -15825,24 +15592,11 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
15825
15592
  var imported_name = null;
15826
15593
  var imported_names = null;
15827
15594
  M.specifiers.forEach(function (specifier) {
15828
- if (specifier.type === "ImportSpecifier") {
15595
+ if (specifier.type === "ImportSpecifier" || specifier.type === "ImportNamespaceSpecifier") {
15829
15596
  if (!imported_names) { imported_names = []; }
15830
- imported_names.push(new AST_NameMapping({
15831
- start: my_start_token(specifier),
15832
- end: my_end_token(specifier),
15833
- foreign_name: from_moz(specifier.imported),
15834
- name: from_moz(specifier.local)
15835
- }));
15597
+ imported_names.push(from_moz(specifier));
15836
15598
  } else if (specifier.type === "ImportDefaultSpecifier") {
15837
- imported_name = from_moz(specifier.local);
15838
- } else if (specifier.type === "ImportNamespaceSpecifier") {
15839
- if (!imported_names) { imported_names = []; }
15840
- imported_names.push(new AST_NameMapping({
15841
- start: my_start_token(specifier),
15842
- end: my_end_token(specifier),
15843
- foreign_name: new AST_SymbolImportForeign({ name: "*" }),
15844
- name: from_moz(specifier.local)
15845
- }));
15599
+ imported_name = from_moz(specifier);
15846
15600
  }
15847
15601
  });
15848
15602
  return new AST_Import({
@@ -15855,14 +15609,39 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
15855
15609
  });
15856
15610
  },
15857
15611
 
15612
+ ImportSpecifier: function(M) {
15613
+ return new AST_NameMapping({
15614
+ start: my_start_token(M),
15615
+ end: my_end_token(M),
15616
+ foreign_name: from_moz(M.imported),
15617
+ name: from_moz(M.local)
15618
+ });
15619
+ },
15620
+
15621
+ ImportDefaultSpecifier: function(M) {
15622
+ return from_moz(M.local);
15623
+ },
15624
+
15625
+ ImportNamespaceSpecifier: function(M) {
15626
+ return new AST_NameMapping({
15627
+ start: my_start_token(M),
15628
+ end: my_end_token(M),
15629
+ foreign_name: new AST_SymbolImportForeign({ name: "*" }),
15630
+ name: from_moz(M.local)
15631
+ });
15632
+ },
15633
+
15858
15634
  ExportAllDeclaration: function(M) {
15635
+ var foreign_name = M.exported == null ?
15636
+ new AST_SymbolExportForeign({ name: "*" }) :
15637
+ from_moz(M.exported);
15859
15638
  return new AST_Export({
15860
15639
  start: my_start_token(M),
15861
15640
  end: my_end_token(M),
15862
15641
  exported_names: [
15863
15642
  new AST_NameMapping({
15864
15643
  name: new AST_SymbolExportForeign({ name: "*" }),
15865
- foreign_name: new AST_SymbolExportForeign({ name: "*" })
15644
+ foreign_name: foreign_name
15866
15645
  })
15867
15646
  ],
15868
15647
  module_name: from_moz(M.source),
@@ -15876,10 +15655,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
15876
15655
  end: my_end_token(M),
15877
15656
  exported_definition: from_moz(M.declaration),
15878
15657
  exported_names: M.specifiers && M.specifiers.length ? M.specifiers.map(function (specifier) {
15879
- return new AST_NameMapping({
15880
- foreign_name: from_moz(specifier.exported),
15881
- name: from_moz(specifier.local)
15882
- });
15658
+ return from_moz(specifier);
15883
15659
  }) : null,
15884
15660
  module_name: from_moz(M.source),
15885
15661
  assert_clause: assert_clause_from_moz(M.assertions)
@@ -15895,6 +15671,13 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
15895
15671
  });
15896
15672
  },
15897
15673
 
15674
+ ExportSpecifier: function(M) {
15675
+ return new AST_NameMapping({
15676
+ foreign_name: from_moz(M.exported),
15677
+ name: from_moz(M.local)
15678
+ });
15679
+ },
15680
+
15898
15681
  Literal: function(M) {
15899
15682
  var val = M.value, args = {
15900
15683
  start : my_start_token(M),
@@ -15920,6 +15703,22 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
15920
15703
  if (val === null) return new AST_Null(args);
15921
15704
  switch (typeof val) {
15922
15705
  case "string":
15706
+ args.quote = "\"";
15707
+ var p = FROM_MOZ_STACK[FROM_MOZ_STACK.length - 2];
15708
+ if (p.type == "ImportSpecifier") {
15709
+ args.name = val;
15710
+ return new AST_SymbolImportForeign(args);
15711
+ } else if (p.type == "ExportSpecifier") {
15712
+ args.name = val;
15713
+ if (M == p.exported) {
15714
+ return new AST_SymbolExportForeign(args);
15715
+ } else {
15716
+ return new AST_SymbolExport(args);
15717
+ }
15718
+ } else if (p.type == "ExportAllDeclaration" && M == p.exported) {
15719
+ args.name = val;
15720
+ return new AST_SymbolExportForeign(args);
15721
+ }
15923
15722
  args.value = val;
15924
15723
  return new AST_String(args);
15925
15724
  case "number":
@@ -16579,7 +16378,7 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
16579
16378
  def_to_moz(AST_Try, function To_Moz_TryStatement(M) {
16580
16379
  return {
16581
16380
  type: "TryStatement",
16582
- block: to_moz_block(M),
16381
+ block: to_moz_block(M.body),
16583
16382
  handler: to_moz(M.bcatch),
16584
16383
  guardedHandlers: [],
16585
16384
  finalizer: to_moz(M.bfinally)
@@ -16624,10 +16423,17 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
16624
16423
 
16625
16424
  def_to_moz(AST_Export, function To_Moz_ExportDeclaration(M) {
16626
16425
  if (M.exported_names) {
16627
- if (M.exported_names[0].name.name === "*") {
16426
+ var first_exported = M.exported_names[0];
16427
+ var first_exported_name = first_exported.name;
16428
+ if (first_exported_name.name === "*" && !first_exported_name.quote) {
16429
+ var foreign_name = first_exported.foreign_name;
16430
+ var exported = foreign_name.name === "*" && !foreign_name.quote
16431
+ ? null
16432
+ : to_moz(foreign_name);
16628
16433
  return {
16629
16434
  type: "ExportAllDeclaration",
16630
16435
  source: to_moz(M.module_name),
16436
+ exported: exported,
16631
16437
  assertions: assert_clause_to_moz(M.assert_clause)
16632
16438
  };
16633
16439
  }
@@ -16659,19 +16465,22 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
16659
16465
  local: to_moz(M.imported_name)
16660
16466
  });
16661
16467
  }
16662
- if (M.imported_names && M.imported_names[0].foreign_name.name === "*") {
16663
- specifiers.push({
16664
- type: "ImportNamespaceSpecifier",
16665
- local: to_moz(M.imported_names[0].name)
16666
- });
16667
- } else if (M.imported_names) {
16668
- M.imported_names.forEach(function(name_mapping) {
16468
+ if (M.imported_names) {
16469
+ var first_imported_foreign_name = M.imported_names[0].foreign_name;
16470
+ if (first_imported_foreign_name.name === "*" && !first_imported_foreign_name.quote) {
16669
16471
  specifiers.push({
16670
- type: "ImportSpecifier",
16671
- local: to_moz(name_mapping.name),
16672
- imported: to_moz(name_mapping.foreign_name)
16472
+ type: "ImportNamespaceSpecifier",
16473
+ local: to_moz(M.imported_names[0].name)
16673
16474
  });
16674
- });
16475
+ } else {
16476
+ M.imported_names.forEach(function(name_mapping) {
16477
+ specifiers.push({
16478
+ type: "ImportSpecifier",
16479
+ local: to_moz(name_mapping.name),
16480
+ imported: to_moz(name_mapping.foreign_name)
16481
+ });
16482
+ });
16483
+ }
16675
16484
  }
16676
16485
  return {
16677
16486
  type: "ImportDeclaration",
@@ -16935,7 +16744,14 @@ def_transform(AST_PrefixedTemplateString, function(self, tw) {
16935
16744
  });
16936
16745
 
16937
16746
  def_to_moz(ast_AST_Symbol, function To_Moz_Identifier(M, parent) {
16938
- if (M instanceof AST_SymbolMethod && parent.quote) {
16747
+ if (
16748
+ (M instanceof AST_SymbolMethod && parent.quote) ||
16749
+ ((
16750
+ M instanceof AST_SymbolImportForeign ||
16751
+ M instanceof AST_SymbolExportForeign ||
16752
+ M instanceof AST_SymbolExport
16753
+ ) && M.quote)
16754
+ ) {
16939
16755
  return {
16940
16756
  type: "Literal",
16941
16757
  value: M.name
@@ -18260,7 +18076,7 @@ function output_OutputStream(options) {
18260
18076
  }
18261
18077
 
18262
18078
  AST_StatementWithBody.DEFMETHOD("_do_print_body", function(output) {
18263
- force_statement(this.body, output);
18079
+ print_maybe_braced_body(this.body, output);
18264
18080
  });
18265
18081
 
18266
18082
  DEFPRINT(AST_Statement, function(self, output) {
@@ -18589,7 +18405,7 @@ function output_OutputStream(options) {
18589
18405
  b = b.body;
18590
18406
  } else break;
18591
18407
  }
18592
- force_statement(self.body, output);
18408
+ print_maybe_braced_body(self.body, output);
18593
18409
  }
18594
18410
  DEFPRINT(AST_If, function(self, output) {
18595
18411
  output.print("if");
@@ -18606,7 +18422,7 @@ function output_OutputStream(options) {
18606
18422
  if (self.alternative instanceof AST_If)
18607
18423
  self.alternative.print(output);
18608
18424
  else
18609
- force_statement(self.alternative, output);
18425
+ print_maybe_braced_body(self.alternative, output);
18610
18426
  } else {
18611
18427
  self._do_print_body(output);
18612
18428
  }
@@ -18655,7 +18471,7 @@ function output_OutputStream(options) {
18655
18471
  DEFPRINT(AST_Try, function(self, output) {
18656
18472
  output.print("try");
18657
18473
  output.space();
18658
- print_braced(self, output);
18474
+ self.body.print(output);
18659
18475
  if (self.bcatch) {
18660
18476
  output.space();
18661
18477
  self.bcatch.print(output);
@@ -18665,6 +18481,9 @@ function output_OutputStream(options) {
18665
18481
  self.bfinally.print(output);
18666
18482
  }
18667
18483
  });
18484
+ DEFPRINT(AST_TryBlock, function(self, output) {
18485
+ print_braced(self, output);
18486
+ });
18668
18487
  DEFPRINT(AST_Catch, function(self, output) {
18669
18488
  output.print("catch");
18670
18489
  if (self.argname) {
@@ -18716,7 +18535,9 @@ function output_OutputStream(options) {
18716
18535
  output.space();
18717
18536
  }
18718
18537
  if (self.imported_names) {
18719
- if (self.imported_names.length === 1 && self.imported_names[0].foreign_name.name === "*") {
18538
+ if (self.imported_names.length === 1 &&
18539
+ self.imported_names[0].foreign_name.name === "*" &&
18540
+ !self.imported_names[0].foreign_name.quote) {
18720
18541
  self.imported_names[0].print(output);
18721
18542
  } else {
18722
18543
  output.print("{");
@@ -18750,14 +18571,31 @@ function output_OutputStream(options) {
18750
18571
  DEFPRINT(AST_NameMapping, function(self, output) {
18751
18572
  var is_import = output.parent() instanceof AST_Import;
18752
18573
  var definition = self.name.definition();
18574
+ var foreign_name = self.foreign_name;
18753
18575
  var names_are_different =
18754
18576
  (definition && definition.mangled_name || self.name.name) !==
18755
- self.foreign_name.name;
18577
+ foreign_name.name;
18578
+ if (!names_are_different &&
18579
+ foreign_name.name === "*" &&
18580
+ foreign_name.quote != self.name.quote) {
18581
+ // export * as "*"
18582
+ names_are_different = true;
18583
+ }
18584
+ var foreign_name_is_name = foreign_name.quote == null;
18756
18585
  if (names_are_different) {
18757
18586
  if (is_import) {
18758
- output.print(self.foreign_name.name);
18587
+ if (foreign_name_is_name) {
18588
+ output.print(foreign_name.name);
18589
+ } else {
18590
+ output.print_string(foreign_name.name, foreign_name.quote);
18591
+ }
18759
18592
  } else {
18760
- self.name.print(output);
18593
+ if (self.name.quote == null) {
18594
+ self.name.print(output);
18595
+ } else {
18596
+ output.print_string(self.name.name, self.name.quote);
18597
+ }
18598
+
18761
18599
  }
18762
18600
  output.space();
18763
18601
  output.print("as");
@@ -18765,10 +18603,18 @@ function output_OutputStream(options) {
18765
18603
  if (is_import) {
18766
18604
  self.name.print(output);
18767
18605
  } else {
18768
- output.print(self.foreign_name.name);
18606
+ if (foreign_name_is_name) {
18607
+ output.print(foreign_name.name);
18608
+ } else {
18609
+ output.print_string(foreign_name.name, foreign_name.quote);
18610
+ }
18769
18611
  }
18770
18612
  } else {
18771
- self.name.print(output);
18613
+ if (self.name.quote == null) {
18614
+ self.name.print(output);
18615
+ } else {
18616
+ output.print_string(self.name.name, self.name.quote);
18617
+ }
18772
18618
  }
18773
18619
  });
18774
18620
 
@@ -18780,8 +18626,10 @@ function output_OutputStream(options) {
18780
18626
  output.space();
18781
18627
  }
18782
18628
  if (self.exported_names) {
18783
- if (self.exported_names.length === 1 && self.exported_names[0].name.name === "*") {
18784
- self.exported_names[0].print(output);
18629
+ if (self.exported_names.length === 1 &&
18630
+ self.exported_names[0].name.name === "*" &&
18631
+ !self.exported_names[0].name.quote) {
18632
+ self.exported_names[0].print(output);
18785
18633
  } else {
18786
18634
  output.print("{");
18787
18635
  self.exported_names.forEach(function(name_export, i) {
@@ -19301,12 +19149,15 @@ function output_OutputStream(options) {
19301
19149
  }
19302
19150
  });
19303
19151
 
19304
- function force_statement(stat, output) {
19152
+ /** if, for, while, may or may not have braces surrounding its body */
19153
+ function print_maybe_braced_body(stat, output) {
19305
19154
  if (output.option("braces")) {
19306
19155
  make_block(stat, output);
19307
19156
  } else {
19308
19157
  if (!stat || stat instanceof AST_EmptyStatement)
19309
19158
  output.force_semicolon();
19159
+ else if (stat instanceof AST_Let || stat instanceof AST_Const || stat instanceof AST_Class)
19160
+ make_block(stat, output);
19310
19161
  else
19311
19162
  stat.print(output);
19312
19163
  }
@@ -19530,7 +19381,7 @@ AST_Switch.prototype.shallow_cmp = pass_through;
19530
19381
  AST_SwitchBranch.prototype.shallow_cmp = pass_through;
19531
19382
 
19532
19383
  AST_Try.prototype.shallow_cmp = function(other) {
19533
- return (this.bcatch == null ? other.bcatch == null : this.bcatch === other.bcatch) && (this.bfinally == null ? other.bfinally == null : this.bfinally === other.bfinally);
19384
+ return (this.body === other.body) && (this.bcatch == null ? other.bcatch == null : this.bcatch === other.bcatch) && (this.bfinally == null ? other.bfinally == null : this.bfinally === other.bfinally);
19534
19385
  };
19535
19386
 
19536
19387
  AST_Catch.prototype.shallow_cmp = function(other) {
@@ -19804,16 +19655,12 @@ AST_Scope.DEFMETHOD("figure_out_scope", function(options, { parent_scope = null,
19804
19655
  const save_scope = scope;
19805
19656
  node.block_scope = scope = new AST_Scope(node);
19806
19657
  scope._block_scope = true;
19807
- // AST_Try in the AST sadly *is* (not has) a body itself,
19808
- // and its catch and finally branches are children of the AST_Try itself
19809
- const parent_scope = node instanceof AST_Catch
19810
- ? save_scope.parent_scope
19811
- : save_scope;
19812
- scope.init_scope_vars(parent_scope);
19658
+ scope.init_scope_vars(save_scope);
19813
19659
  scope.uses_with = save_scope.uses_with;
19814
19660
  scope.uses_eval = save_scope.uses_eval;
19661
+
19815
19662
  if (options.safari10) {
19816
- if (node instanceof AST_For || node instanceof AST_ForIn) {
19663
+ if (node instanceof AST_For || node instanceof AST_ForIn || node instanceof AST_ForOf) {
19817
19664
  for_scopes.push(scope);
19818
19665
  }
19819
19666
  }
@@ -19823,7 +19670,7 @@ AST_Scope.DEFMETHOD("figure_out_scope", function(options, { parent_scope = null,
19823
19670
  // AST_Switch has a scope within the body, but it itself "is a block scope"
19824
19671
  // This means the switched expression has to belong to the outer scope
19825
19672
  // while the body inside belongs to the switch itself.
19826
- // This is pretty nasty and warrants an AST change similar to AST_Try (read above)
19673
+ // This is pretty nasty and warrants an AST change
19827
19674
  const the_block_scope = scope;
19828
19675
  scope = save_scope;
19829
19676
  node.expression.walk(tw);
@@ -20775,9 +20622,7 @@ AST_Default.prototype._size = function () {
20775
20622
  return 8 + list_overhead(this.body);
20776
20623
  };
20777
20624
 
20778
- AST_Try.prototype._size = function () {
20779
- return 3 + list_overhead(this.body);
20780
- };
20625
+ AST_Try.prototype._size = () => 3;
20781
20626
 
20782
20627
  AST_Catch.prototype._size = function () {
20783
20628
  let size = 7 + list_overhead(this.body);
@@ -21322,9 +21167,10 @@ function is_func_expr(node) {
21322
21167
  return node instanceof AST_Arrow || node instanceof AST_Function;
21323
21168
  }
21324
21169
 
21170
+ /**
21171
+ * Used to determine whether the node can benefit from negation.
21172
+ * Not the case with arrow functions (you need an extra set of parens). */
21325
21173
  function is_iife_call(node) {
21326
- // Used to determine whether the node can benefit from negation.
21327
- // Not the case with arrow functions (you need an extra set of parens).
21328
21174
  if (node.TYPE != "Call") return false;
21329
21175
  return node.expression instanceof AST_Function || is_iife_call(node.expression);
21330
21176
  }
@@ -21507,6 +21353,9 @@ const object_methods = [
21507
21353
 
21508
21354
  const is_pure_native_method = make_nested_lookup({
21509
21355
  Array: [
21356
+ "at",
21357
+ "flat",
21358
+ "includes",
21510
21359
  "indexOf",
21511
21360
  "join",
21512
21361
  "lastIndexOf",
@@ -21527,22 +21376,41 @@ const is_pure_native_method = make_nested_lookup({
21527
21376
  ...object_methods,
21528
21377
  ],
21529
21378
  String: [
21379
+ "at",
21530
21380
  "charAt",
21531
21381
  "charCodeAt",
21382
+ "charPointAt",
21532
21383
  "concat",
21384
+ "endsWith",
21385
+ "fromCharCode",
21386
+ "fromCodePoint",
21387
+ "includes",
21533
21388
  "indexOf",
21534
21389
  "italics",
21535
21390
  "lastIndexOf",
21391
+ "localeCompare",
21536
21392
  "match",
21393
+ "matchAll",
21394
+ "normalize",
21395
+ "padStart",
21396
+ "padEnd",
21397
+ "repeat",
21537
21398
  "replace",
21399
+ "replaceAll",
21538
21400
  "search",
21539
21401
  "slice",
21540
21402
  "split",
21403
+ "startsWith",
21541
21404
  "substr",
21542
21405
  "substring",
21406
+ "repeat",
21407
+ "toLocaleLowerCase",
21408
+ "toLocaleUpperCase",
21543
21409
  "toLowerCase",
21544
21410
  "toUpperCase",
21545
21411
  "trim",
21412
+ "trimEnd",
21413
+ "trimStart",
21546
21414
  ...object_methods,
21547
21415
  ],
21548
21416
  });
@@ -21707,7 +21575,7 @@ const unary_side_effects = makePredicate("delete ++ --");
21707
21575
  def_is_number(AST_Number, return_true);
21708
21576
  const unary = makePredicate("+ - ~ ++ --");
21709
21577
  def_is_number(AST_Unary, function() {
21710
- return unary.has(this.operator);
21578
+ return unary.has(this.operator) && !(this.expression instanceof AST_BigInt);
21711
21579
  });
21712
21580
  const numeric_ops = makePredicate("- * / % & | ^ << >> >>>");
21713
21581
  def_is_number(AST_Binary, function(compressor) {
@@ -21836,7 +21704,7 @@ function is_nullish(node, compressor) {
21836
21704
  || any(this.body, compressor);
21837
21705
  });
21838
21706
  def_has_side_effects(AST_Try, function(compressor) {
21839
- return any(this.body, compressor)
21707
+ return this.body.has_side_effects(compressor)
21840
21708
  || this.bcatch && this.bcatch.has_side_effects(compressor)
21841
21709
  || this.bfinally && this.bfinally.has_side_effects(compressor);
21842
21710
  });
@@ -21845,6 +21713,7 @@ function is_nullish(node, compressor) {
21845
21713
  || this.body && this.body.has_side_effects(compressor)
21846
21714
  || this.alternative && this.alternative.has_side_effects(compressor);
21847
21715
  });
21716
+ def_has_side_effects(AST_ImportMeta, return_false);
21848
21717
  def_has_side_effects(AST_LabeledStatement, function(compressor) {
21849
21718
  return this.body.has_side_effects(compressor);
21850
21719
  });
@@ -21948,6 +21817,7 @@ function is_nullish(node, compressor) {
21948
21817
  def_may_throw(AST_Lambda, return_false);
21949
21818
  def_may_throw(AST_SymbolDeclaration, return_false);
21950
21819
  def_may_throw(AST_This, return_false);
21820
+ def_may_throw(AST_ImportMeta, return_false);
21951
21821
 
21952
21822
  function any(list, compressor) {
21953
21823
  for (var i = list.length; --i >= 0;)
@@ -22065,7 +21935,7 @@ function is_nullish(node, compressor) {
22065
21935
  });
22066
21936
  def_may_throw(AST_SymbolClassProperty, return_false);
22067
21937
  def_may_throw(AST_Try, function(compressor) {
22068
- return this.bcatch ? this.bcatch.may_throw(compressor) : any(this.body, compressor)
21938
+ return this.bcatch ? this.bcatch.may_throw(compressor) : this.body.may_throw(compressor)
22069
21939
  || this.bfinally && this.bfinally.may_throw(compressor);
22070
21940
  });
22071
21941
  def_may_throw(AST_Unary, function(compressor) {
@@ -22311,6 +22181,11 @@ function is_lhs(node, parent) {
22311
22181
  var name = this.name + suffix;
22312
22182
  if (HOP(defines, name)) return to_node(defines[name], this);
22313
22183
  });
22184
+ def_find_defs(AST_ImportMeta, function(compressor, suffix) {
22185
+ var defines = compressor.option("global_defs");
22186
+ var name = "import.meta" + suffix;
22187
+ if (HOP(defines, name)) return to_node(defines[name], this);
22188
+ });
22314
22189
  })(function(node, func) {
22315
22190
  node.DEFMETHOD("_find_defs", func);
22316
22191
  });
@@ -23747,15 +23622,17 @@ AST_Scope.DEFMETHOD("drop_unused", function(compressor) {
23747
23622
 
23748
23623
 
23749
23624
 
23750
- // Define the method AST_Node#reduce_vars, which goes through the AST in
23751
- // execution order to perform basic flow analysis
23752
-
23625
+ /**
23626
+ * Define the method AST_Node#reduce_vars, which goes through the AST in
23627
+ * execution order to perform basic flow analysis
23628
+ */
23753
23629
  function def_reduce_vars(node, func) {
23754
23630
  node.DEFMETHOD("reduce_vars", func);
23755
23631
  }
23756
23632
 
23757
23633
  def_reduce_vars(ast_AST_Node, noop);
23758
23634
 
23635
+ /** Clear definition properties */
23759
23636
  function reset_def(compressor, def) {
23760
23637
  def.assignments = 0;
23761
23638
  def.chained = false;
@@ -23764,7 +23641,10 @@ function reset_def(compressor, def) {
23764
23641
  def.recursive_refs = 0;
23765
23642
  def.references = [];
23766
23643
  def.single_use = undefined;
23767
- if (def.scope.pinned()) {
23644
+ if (
23645
+ def.scope.pinned()
23646
+ || (def.orig[0] instanceof AST_SymbolFunarg && def.scope.uses_arguments)
23647
+ ) {
23768
23648
  def.fixed = false;
23769
23649
  } else if (def.orig[0] instanceof AST_SymbolConst || !compressor.exposed(def)) {
23770
23650
  def.fixed = def.init;
@@ -24086,15 +23966,15 @@ def_reduce_vars(AST_Default, function(tw, descend) {
24086
23966
 
24087
23967
  function mark_lambda(tw, descend, compressor) {
24088
23968
  clear_flag(this, INLINED);
23969
+
24089
23970
  push(tw);
23971
+
24090
23972
  reset_variables(tw, compressor, this);
24091
- if (this.uses_arguments) {
24092
- descend();
24093
- pop(tw);
24094
- return;
24095
- }
23973
+
24096
23974
  var iife;
24097
23975
  if (!this.name
23976
+ && !this.uses_arguments
23977
+ && !this.pinned()
24098
23978
  && (iife = tw.parent()) instanceof AST_Call
24099
23979
  && iife.expression === this
24100
23980
  && !iife.args.some(arg => arg instanceof AST_Expansion)
@@ -24119,8 +23999,10 @@ function mark_lambda(tw, descend, compressor) {
24119
23999
  }
24120
24000
  });
24121
24001
  }
24002
+
24122
24003
  descend();
24123
24004
  pop(tw);
24005
+
24124
24006
  return true;
24125
24007
  }
24126
24008
 
@@ -24249,7 +24131,7 @@ def_reduce_vars(AST_Toplevel, function(tw, descend, compressor) {
24249
24131
  def_reduce_vars(AST_Try, function(tw, descend, compressor) {
24250
24132
  reset_block_variables(compressor, this);
24251
24133
  push(tw);
24252
- walk_body(this, tw);
24134
+ this.body.walk(tw);
24253
24135
  pop(tw);
24254
24136
  if (this.bcatch) {
24255
24137
  push(tw);
@@ -24462,13 +24344,11 @@ function tighten_body(statements, compressor) {
24462
24344
  function find_loop_scope_try() {
24463
24345
  var node = compressor.self(), level = 0, in_loop = false, in_try = false;
24464
24346
  do {
24465
- if (node instanceof AST_Catch || node instanceof AST_Finally) {
24466
- level++;
24467
- } else if (node instanceof AST_IterationStatement) {
24347
+ if (node instanceof AST_IterationStatement) {
24468
24348
  in_loop = true;
24469
24349
  } else if (node instanceof AST_Scope) {
24470
24350
  break;
24471
- } else if (node instanceof AST_Try) {
24351
+ } else if (node instanceof AST_TryBlock) {
24472
24352
  in_try = true;
24473
24353
  }
24474
24354
  } while (node = compressor.parent(level++));
@@ -24512,6 +24392,9 @@ function tighten_body(statements, compressor) {
24512
24392
  && (node.logical || node.operator != "=" && lhs.equivalent_to(node.left))
24513
24393
  || node instanceof AST_Await
24514
24394
  || node instanceof AST_Call && lhs instanceof ast_AST_PropAccess && lhs.equivalent_to(node.expression)
24395
+ ||
24396
+ (node instanceof AST_Call || node instanceof ast_AST_PropAccess)
24397
+ && node.optional
24515
24398
  || node instanceof AST_Debugger
24516
24399
  || node instanceof AST_Destructuring
24517
24400
  || node instanceof AST_Expansion
@@ -24685,7 +24568,11 @@ function tighten_body(statements, compressor) {
24685
24568
  var hit = funarg;
24686
24569
  var abort = false, replaced = 0, can_replace = !args || !hit;
24687
24570
  if (!can_replace) {
24688
- for (var j = compressor.self().argnames.lastIndexOf(candidate.name) + 1; !abort && j < args.length; j++) {
24571
+ for (
24572
+ let j = compressor.self().argnames.lastIndexOf(candidate.name) + 1;
24573
+ !abort && j < args.length;
24574
+ j++
24575
+ ) {
24689
24576
  args[j].transform(scanner);
24690
24577
  }
24691
24578
  can_replace = true;
@@ -25632,14 +25519,21 @@ function tighten_body(statements, compressor) {
25632
25519
  CHANGED = true;
25633
25520
  stat.init = exprs.length ? make_sequence(stat.init, exprs) : null;
25634
25521
  statements[++j] = stat;
25635
- } else if (prev instanceof AST_Var && (!stat.init || stat.init.TYPE == prev.TYPE)) {
25522
+ } else if (
25523
+ prev instanceof AST_Var
25524
+ && (!stat.init || stat.init.TYPE == prev.TYPE)
25525
+ ) {
25636
25526
  if (stat.init) {
25637
25527
  prev.definitions = prev.definitions.concat(stat.init.definitions);
25638
25528
  }
25639
25529
  stat.init = prev;
25640
25530
  statements[j] = stat;
25641
25531
  CHANGED = true;
25642
- } else if (defs && stat.init && defs.TYPE == stat.init.TYPE && declarations_only(stat.init)) {
25532
+ } else if (
25533
+ defs instanceof AST_Var
25534
+ && stat.init instanceof AST_Var
25535
+ && declarations_only(stat.init)
25536
+ ) {
25643
25537
  defs.definitions = defs.definitions.concat(stat.init.definitions);
25644
25538
  stat.init = null;
25645
25539
  statements[++j] = stat;
@@ -25742,7 +25636,13 @@ function tighten_body(statements, compressor) {
25742
25636
 
25743
25637
 
25744
25638
 
25745
-
25639
+ /**
25640
+ * Module that contains the inlining logic.
25641
+ *
25642
+ * @module
25643
+ *
25644
+ * The stars of the show are `inline_into_symbolref` and `inline_into_call`.
25645
+ */
25746
25646
 
25747
25647
  function within_array_or_object_literal(compressor) {
25748
25648
  var node, level = 0;
@@ -25773,136 +25673,135 @@ function scope_encloses_variables_in_this_scope(scope, pulled_scope) {
25773
25673
 
25774
25674
  function inline_into_symbolref(self, compressor) {
25775
25675
  const parent = compressor.parent();
25776
- if (compressor.option("reduce_vars") && is_lhs(self, parent) !== self) {
25777
- const def = self.definition();
25778
- const nearest_scope = compressor.find_scope();
25779
- if (compressor.top_retain && def.global && compressor.top_retain(def)) {
25780
- def.fixed = false;
25781
- def.single_use = false;
25782
- return self;
25676
+
25677
+ const def = self.definition();
25678
+ const nearest_scope = compressor.find_scope();
25679
+ if (compressor.top_retain && def.global && compressor.top_retain(def)) {
25680
+ def.fixed = false;
25681
+ def.single_use = false;
25682
+ return self;
25683
+ }
25684
+
25685
+ let fixed = self.fixed_value();
25686
+ let single_use = def.single_use
25687
+ && !(parent instanceof AST_Call
25688
+ && (parent.is_callee_pure(compressor))
25689
+ || has_annotation(parent, _NOINLINE))
25690
+ && !(parent instanceof AST_Export
25691
+ && fixed instanceof AST_Lambda
25692
+ && fixed.name);
25693
+
25694
+ if (single_use && fixed instanceof ast_AST_Node) {
25695
+ single_use =
25696
+ !fixed.has_side_effects(compressor)
25697
+ && !fixed.may_throw(compressor);
25698
+ }
25699
+
25700
+ if (single_use && (fixed instanceof AST_Lambda || fixed instanceof AST_Class)) {
25701
+ if (retain_top_func(fixed, compressor)) {
25702
+ single_use = false;
25703
+ } else if (def.scope !== self.scope
25704
+ && (def.escaped == 1
25705
+ || has_flag(fixed, INLINED)
25706
+ || within_array_or_object_literal(compressor)
25707
+ || !compressor.option("reduce_funcs"))) {
25708
+ single_use = false;
25709
+ } else if (is_recursive_ref(compressor, def)) {
25710
+ single_use = false;
25711
+ } else if (def.scope !== self.scope || def.orig[0] instanceof AST_SymbolFunarg) {
25712
+ single_use = fixed.is_constant_expression(self.scope);
25713
+ if (single_use == "f") {
25714
+ var scope = self.scope;
25715
+ do {
25716
+ if (scope instanceof AST_Defun || is_func_expr(scope)) {
25717
+ set_flag(scope, INLINED);
25718
+ }
25719
+ } while (scope = scope.parent_scope);
25720
+ }
25783
25721
  }
25722
+ }
25784
25723
 
25785
- let fixed = self.fixed_value();
25786
- let single_use = def.single_use
25787
- && !(parent instanceof AST_Call
25788
- && (parent.is_callee_pure(compressor))
25789
- || has_annotation(parent, _NOINLINE))
25790
- && !(parent instanceof AST_Export
25791
- && fixed instanceof AST_Lambda
25792
- && fixed.name);
25793
-
25794
- if (single_use && fixed instanceof ast_AST_Node) {
25795
- single_use =
25796
- !fixed.has_side_effects(compressor)
25797
- && !fixed.may_throw(compressor);
25798
- }
25799
-
25800
- if (single_use && (fixed instanceof AST_Lambda || fixed instanceof AST_Class)) {
25801
- if (retain_top_func(fixed, compressor)) {
25802
- single_use = false;
25803
- } else if (def.scope !== self.scope
25804
- && (def.escaped == 1
25805
- || has_flag(fixed, INLINED)
25806
- || within_array_or_object_literal(compressor)
25807
- || !compressor.option("reduce_funcs"))) {
25808
- single_use = false;
25809
- } else if (is_recursive_ref(compressor, def)) {
25810
- single_use = false;
25811
- } else if (def.scope !== self.scope || def.orig[0] instanceof AST_SymbolFunarg) {
25812
- single_use = fixed.is_constant_expression(self.scope);
25813
- if (single_use == "f") {
25814
- var scope = self.scope;
25815
- do {
25816
- if (scope instanceof AST_Defun || is_func_expr(scope)) {
25817
- set_flag(scope, INLINED);
25818
- }
25819
- } while (scope = scope.parent_scope);
25724
+ if (single_use && (fixed instanceof AST_Lambda || fixed instanceof AST_Class)) {
25725
+ single_use =
25726
+ def.scope === self.scope
25727
+ && !scope_encloses_variables_in_this_scope(nearest_scope, fixed)
25728
+ || parent instanceof AST_Call
25729
+ && parent.expression === self
25730
+ && !scope_encloses_variables_in_this_scope(nearest_scope, fixed)
25731
+ && !(fixed.name && fixed.name.definition().recursive_refs > 0);
25732
+ }
25733
+
25734
+ if (single_use && fixed) {
25735
+ if (fixed instanceof AST_DefClass) {
25736
+ set_flag(fixed, SQUEEZED);
25737
+ fixed = make_node(AST_ClassExpression, fixed, fixed);
25738
+ }
25739
+ if (fixed instanceof AST_Defun) {
25740
+ set_flag(fixed, SQUEEZED);
25741
+ fixed = make_node(AST_Function, fixed, fixed);
25742
+ }
25743
+ if (def.recursive_refs > 0 && fixed.name instanceof AST_SymbolDefun) {
25744
+ const defun_def = fixed.name.definition();
25745
+ let lambda_def = fixed.variables.get(fixed.name.name);
25746
+ let name = lambda_def && lambda_def.orig[0];
25747
+ if (!(name instanceof AST_SymbolLambda)) {
25748
+ name = make_node(AST_SymbolLambda, fixed.name, fixed.name);
25749
+ name.scope = fixed;
25750
+ fixed.name = name;
25751
+ lambda_def = fixed.def_function(name);
25752
+ }
25753
+ ast_walk(fixed, node => {
25754
+ if (node instanceof AST_SymbolRef && node.definition() === defun_def) {
25755
+ node.thedef = lambda_def;
25756
+ lambda_def.references.push(node);
25820
25757
  }
25821
- }
25758
+ });
25822
25759
  }
25760
+ if (
25761
+ (fixed instanceof AST_Lambda || fixed instanceof AST_Class)
25762
+ && fixed.parent_scope !== nearest_scope
25763
+ ) {
25764
+ fixed = fixed.clone(true, compressor.get_toplevel());
25823
25765
 
25824
- if (single_use && (fixed instanceof AST_Lambda || fixed instanceof AST_Class)) {
25825
- single_use =
25826
- def.scope === self.scope
25827
- && !scope_encloses_variables_in_this_scope(nearest_scope, fixed)
25828
- || parent instanceof AST_Call
25829
- && parent.expression === self
25830
- && !scope_encloses_variables_in_this_scope(nearest_scope, fixed)
25831
- && !(fixed.name && fixed.name.definition().recursive_refs > 0);
25766
+ nearest_scope.add_child_scope(fixed);
25832
25767
  }
25768
+ return fixed.optimize(compressor);
25769
+ }
25833
25770
 
25834
- if (single_use && fixed) {
25835
- if (fixed instanceof AST_DefClass) {
25836
- set_flag(fixed, SQUEEZED);
25837
- fixed = make_node(AST_ClassExpression, fixed, fixed);
25838
- }
25839
- if (fixed instanceof AST_Defun) {
25840
- set_flag(fixed, SQUEEZED);
25841
- fixed = make_node(AST_Function, fixed, fixed);
25842
- }
25843
- if (def.recursive_refs > 0 && fixed.name instanceof AST_SymbolDefun) {
25844
- const defun_def = fixed.name.definition();
25845
- let lambda_def = fixed.variables.get(fixed.name.name);
25846
- let name = lambda_def && lambda_def.orig[0];
25847
- if (!(name instanceof AST_SymbolLambda)) {
25848
- name = make_node(AST_SymbolLambda, fixed.name, fixed.name);
25849
- name.scope = fixed;
25850
- fixed.name = name;
25851
- lambda_def = fixed.def_function(name);
25852
- }
25853
- ast_walk(fixed, node => {
25854
- if (node instanceof AST_SymbolRef && node.definition() === defun_def) {
25855
- node.thedef = lambda_def;
25856
- lambda_def.references.push(node);
25857
- }
25858
- });
25771
+ // multiple uses
25772
+ if (fixed) {
25773
+ let replace;
25774
+
25775
+ if (fixed instanceof AST_This) {
25776
+ if (!(def.orig[0] instanceof AST_SymbolFunarg)
25777
+ && def.references.every((ref) =>
25778
+ def.scope === ref.scope
25779
+ )) {
25780
+ replace = fixed;
25859
25781
  }
25782
+ } else {
25783
+ var ev = fixed.evaluate(compressor);
25860
25784
  if (
25861
- (fixed instanceof AST_Lambda || fixed instanceof AST_Class)
25862
- && fixed.parent_scope !== nearest_scope
25785
+ ev !== fixed
25786
+ && (compressor.option("unsafe_regexp") || !(ev instanceof RegExp))
25863
25787
  ) {
25864
- fixed = fixed.clone(true, compressor.get_toplevel());
25865
-
25866
- nearest_scope.add_child_scope(fixed);
25788
+ replace = make_node_from_constant(ev, fixed);
25867
25789
  }
25868
- return fixed.optimize(compressor);
25869
25790
  }
25870
25791
 
25871
- // multiple uses
25872
- if (fixed) {
25873
- let replace;
25792
+ if (replace) {
25793
+ const name_length = self.size(compressor);
25794
+ const replace_size = replace.size(compressor);
25874
25795
 
25875
- if (fixed instanceof AST_This) {
25876
- if (!(def.orig[0] instanceof AST_SymbolFunarg)
25877
- && def.references.every((ref) =>
25878
- def.scope === ref.scope
25879
- )) {
25880
- replace = fixed;
25881
- }
25882
- } else {
25883
- var ev = fixed.evaluate(compressor);
25884
- if (
25885
- ev !== fixed
25886
- && (compressor.option("unsafe_regexp") || !(ev instanceof RegExp))
25887
- ) {
25888
- replace = make_node_from_constant(ev, fixed);
25889
- }
25796
+ let overhead = 0;
25797
+ if (compressor.option("unused") && !compressor.exposed(def)) {
25798
+ overhead =
25799
+ (name_length + 2 + replace_size) /
25800
+ (def.references.length - def.assignments);
25890
25801
  }
25891
25802
 
25892
- if (replace) {
25893
- const name_length = self.size(compressor);
25894
- const replace_size = replace.size(compressor);
25895
-
25896
- let overhead = 0;
25897
- if (compressor.option("unused") && !compressor.exposed(def)) {
25898
- overhead =
25899
- (name_length + 2 + replace_size) /
25900
- (def.references.length - def.assignments);
25901
- }
25902
-
25903
- if (replace_size <= name_length + overhead) {
25904
- return replace;
25905
- }
25803
+ if (replace_size <= name_length + overhead) {
25804
+ return replace;
25906
25805
  }
25907
25806
  }
25908
25807
  }
@@ -26642,7 +26541,7 @@ AST_Toplevel.DEFMETHOD("reset_opt_flags", function(compressor) {
26642
26541
  }
26643
26542
  return node.reduce_vars(preparation, descend, compressor);
26644
26543
  }
26645
- });
26544
+ }, { walk_defun_first: true });
26646
26545
  // Stack of look-up tables to keep track of whether a `SymbolDef` has been
26647
26546
  // properly assigned before use:
26648
26547
  // - `push()` & `pop()` when visiting conditional branches
@@ -27632,9 +27531,9 @@ def_optimize(AST_Switch, function(self, compressor) {
27632
27531
  });
27633
27532
 
27634
27533
  def_optimize(AST_Try, function(self, compressor) {
27635
- tighten_body(self.body, compressor);
27636
27534
  if (self.bcatch && self.bfinally && self.bfinally.body.every(is_empty)) self.bfinally = null;
27637
- if (compressor.option("dead_code") && self.body.every(is_empty)) {
27535
+
27536
+ if (compressor.option("dead_code") && self.body.body.every(is_empty)) {
27638
27537
  var body = [];
27639
27538
  if (self.bcatch) {
27640
27539
  trim_unreachable_code(compressor, self.bcatch, body);
@@ -28840,16 +28739,21 @@ def_optimize(ast_AST_Assign, function(self, compressor) {
28840
28739
  return self;
28841
28740
 
28842
28741
  function in_try(level, node) {
28843
- var right = self.right;
28844
- self.right = make_node(AST_Null, right);
28845
- var may_throw = node.may_throw(compressor);
28846
- self.right = right;
28847
- var scope = self.left.definition().scope;
28742
+ function may_assignment_throw() {
28743
+ const right = self.right;
28744
+ self.right = make_node(AST_Null, right);
28745
+ const may_throw = node.may_throw(compressor);
28746
+ self.right = right;
28747
+
28748
+ return may_throw;
28749
+ }
28750
+
28751
+ var stop_at = self.left.definition().scope.get_defun_scope();
28848
28752
  var parent;
28849
- while ((parent = compressor.parent(level++)) !== scope) {
28753
+ while ((parent = compressor.parent(level++)) !== stop_at) {
28850
28754
  if (parent instanceof AST_Try) {
28851
28755
  if (parent.bfinally) return true;
28852
- if (may_throw && parent.bcatch) return true;
28756
+ if (parent.bcatch && may_assignment_throw()) return true;
28853
28757
  }
28854
28758
  }
28855
28759
  }
@@ -28862,7 +28766,13 @@ def_optimize(AST_DefaultAssign, function(self, compressor) {
28862
28766
  var evaluateRight = self.right.evaluate(compressor);
28863
28767
 
28864
28768
  // `[x = undefined] = foo` ---> `[x] = foo`
28865
- if (evaluateRight === undefined) {
28769
+ // `(arg = undefined) => ...` ---> `(arg) => ...` (unless `keep_fargs`)
28770
+ if (
28771
+ evaluateRight === undefined &&
28772
+ (compressor.parent() instanceof AST_Lambda
28773
+ ? compressor.option("keep_fargs") === false
28774
+ : true)
28775
+ ) {
28866
28776
  self = self.left;
28867
28777
  } else if (evaluateRight !== self.right) {
28868
28778
  evaluateRight = make_node_from_constant(evaluateRight, self.right);
@@ -39091,12 +39001,15 @@ function mangle_properties(ast, options) {
39091
39001
 
39092
39002
 
39093
39003
 
39094
- var to_ascii = typeof atob == "undefined" ? function(b64) {
39095
- return Buffer.from(b64, "base64").toString();
39096
- } : atob;
39097
- var to_base64 = typeof btoa == "undefined" ? function(str) {
39098
- return Buffer.from(str).toString("base64");
39099
- } : btoa;
39004
+ // to/from base64 functions
39005
+ // Prefer built-in Buffer, if available, then use hack
39006
+ // https://developer.mozilla.org/en-US/docs/Glossary/Base64#The_Unicode_Problem
39007
+ var to_ascii = typeof Buffer !== "undefined"
39008
+ ? (b64) => Buffer.from(b64, "base64").toString()
39009
+ : (b64) => decodeURIComponent(escape(atob(b64)));
39010
+ var to_base64 = typeof Buffer !== "undefined"
39011
+ ? (str) => Buffer.from(str).toString("base64")
39012
+ : (str) => btoa(unescape(encodeURIComponent(str)));
39100
39013
 
39101
39014
  function read_source_map(code) {
39102
39015
  var match = /(?:^|[^.])\/\/# sourceMappingURL=data:application\/json(;[\w=-]*)?;base64,([+/0-9A-Za-z]*=*)\s*$/.exec(code);
@@ -39346,10 +39259,13 @@ async function minify_minify(files, options, _fs_module) {
39346
39259
  if (options.format.spidermonkey) {
39347
39260
  result.ast = toplevel.to_mozilla_ast();
39348
39261
  }
39262
+ let format_options;
39349
39263
  if (!HOP(options.format, "code") || options.format.code) {
39350
- if (!options.format.ast) {
39264
+ // Make a shallow copy so that we can modify without mutating the user's input.
39265
+ format_options = {...options.format};
39266
+ if (!format_options.ast) {
39351
39267
  // Destroy stuff to save RAM. (unless the deprecated `ast` option is on)
39352
- options.format._destroy_ast = true;
39268
+ format_options._destroy_ast = true;
39353
39269
 
39354
39270
  ast_walk(toplevel, node => {
39355
39271
  if (node instanceof AST_Scope) {
@@ -39369,17 +39285,17 @@ async function minify_minify(files, options, _fs_module) {
39369
39285
  if (options.sourceMap.includeSources && files instanceof AST_Toplevel) {
39370
39286
  throw new Error("original source content unavailable");
39371
39287
  }
39372
- options.format.source_map = await SourceMap({
39288
+ format_options.source_map = await SourceMap({
39373
39289
  file: options.sourceMap.filename,
39374
39290
  orig: options.sourceMap.content,
39375
39291
  root: options.sourceMap.root,
39376
39292
  files: options.sourceMap.includeSources ? files : null,
39377
39293
  });
39378
39294
  }
39379
- delete options.format.ast;
39380
- delete options.format.code;
39381
- delete options.format.spidermonkey;
39382
- var stream = output_OutputStream(options.format);
39295
+ delete format_options.ast;
39296
+ delete format_options.code;
39297
+ delete format_options.spidermonkey;
39298
+ var stream = output_OutputStream(format_options);
39383
39299
  toplevel.print(stream);
39384
39300
  result.code = stream.get();
39385
39301
  if (options.sourceMap) {
@@ -39387,7 +39303,7 @@ async function minify_minify(files, options, _fs_module) {
39387
39303
  configurable: true,
39388
39304
  enumerable: true,
39389
39305
  get() {
39390
- const map = options.format.source_map.getEncoded();
39306
+ const map = format_options.source_map.getEncoded();
39391
39307
  return (result.map = options.sourceMap.asObject ? map : JSON.stringify(map));
39392
39308
  },
39393
39309
  set(value) {
@@ -39397,7 +39313,7 @@ async function minify_minify(files, options, _fs_module) {
39397
39313
  });
39398
39314
  }
39399
39315
  });
39400
- result.decoded_map = options.format.source_map.getDecoded();
39316
+ result.decoded_map = format_options.source_map.getDecoded();
39401
39317
  if (options.sourceMap.url == "inline") {
39402
39318
  var sourceMap = typeof result.map === "object" ? JSON.stringify(result.map) : result.map;
39403
39319
  result.code += "\n//# sourceMappingURL=data:application/json;charset=utf-8;base64," + to_base64(sourceMap);
@@ -39412,8 +39328,8 @@ async function minify_minify(files, options, _fs_module) {
39412
39328
  options.nameCache.props = cache_to_json(options.mangle.properties.cache);
39413
39329
  }
39414
39330
  }
39415
- if (options.format && options.format.source_map) {
39416
- options.format.source_map.destroy();
39331
+ if (format_options && format_options.source_map) {
39332
+ format_options.source_map.destroy();
39417
39333
  }
39418
39334
  if (timings) {
39419
39335
  timings.end = Date.now();
@@ -40931,19 +40847,24 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
40931
40847
  /* harmony export */ "Xs": () => (/* binding */ metadataAdd),
40932
40848
  /* harmony export */ "YO": () => (/* binding */ componentWit),
40933
40849
  /* harmony export */ "eL": () => (/* binding */ metadataShow),
40934
- /* harmony export */ "he": () => (/* reexport safe */ _bytecodealliance_componentize_js__WEBPACK_IMPORTED_MODULE_3__.componentize)
40850
+ /* harmony export */ "ol": () => (/* binding */ preview1AdapterCommandPath),
40851
+ /* harmony export */ "tc": () => (/* binding */ preview1AdapterReactorPath)
40935
40852
  /* harmony export */ });
40936
40853
  /* harmony import */ var _cmd_opt_js__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(5862);
40937
40854
  /* harmony import */ var _cmd_transpile_js__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(2229);
40938
40855
  /* harmony import */ var _obj_wasm_tools_js__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(8980);
40939
- /* harmony import */ var _bytecodealliance_componentize_js__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(9291);
40940
40856
  var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_cmd_opt_js__WEBPACK_IMPORTED_MODULE_0__, _cmd_transpile_js__WEBPACK_IMPORTED_MODULE_1__, _obj_wasm_tools_js__WEBPACK_IMPORTED_MODULE_2__]);
40941
40857
  ([_cmd_opt_js__WEBPACK_IMPORTED_MODULE_0__, _cmd_transpile_js__WEBPACK_IMPORTED_MODULE_1__, _obj_wasm_tools_js__WEBPACK_IMPORTED_MODULE_2__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
40942
40858
 
40943
40859
 
40944
40860
 
40945
40861
  const { parse, print, componentNew, componentWit, componentEmbed, metadataAdd, metadataShow } = _obj_wasm_tools_js__WEBPACK_IMPORTED_MODULE_2__/* .exports */ .I;
40946
-
40862
+ function preview1AdapterCommandPath () {
40863
+ return __nccwpck_require__.ab + "wasi_snapshot_preview1.command.wasm";
40864
+ }
40865
+ function preview1AdapterReactorPath () {
40866
+ return __nccwpck_require__.ab + "wasi_snapshot_preview1.reactor.wasm";
40867
+ }
40947
40868
 
40948
40869
  __webpack_async_result__();
40949
40870
  } catch(e) { __webpack_async_result__(e); } });
@@ -40963,7 +40884,7 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
40963
40884
  /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(7310);
40964
40885
  /* harmony import */ var chalk_template__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(267);
40965
40886
  /* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(8649);
40966
- /* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(67);
40887
+ /* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(2719);
40967
40888
  var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_obj_wasm_tools_js__WEBPACK_IMPORTED_MODULE_0__]);
40968
40889
  _obj_wasm_tools_js__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
40969
40890
 
@@ -41034,7 +40955,7 @@ async function optimizeComponent (componentBytes, opts) {
41034
40955
  let completed = 0;
41035
40956
  const spinnerText = () => chalk_template__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z`{cyan ${completed} / ${coreModules.length}} Running Binaryen on WebAssembly Component Internal Core Modules \n`;
41036
40957
  if (showSpinner) {
41037
- spinner = (0,ora__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)({
40958
+ spinner = (0,ora__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .ZP)({
41038
40959
  color: 'cyan',
41039
40960
  spinner: 'bouncingBar'
41040
40961
  }).start();
@@ -41139,7 +41060,7 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
41139
41060
  /* harmony import */ var _opt_js__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(5862);
41140
41061
  /* harmony import */ var terser__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(1124);
41141
41062
  /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_7__ = __nccwpck_require__(7310);
41142
- /* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_8__ = __nccwpck_require__(67);
41063
+ /* harmony import */ var ora__WEBPACK_IMPORTED_MODULE_8__ = __nccwpck_require__(2719);
41143
41064
  var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_obj_js_component_bindgen_component_js__WEBPACK_IMPORTED_MODULE_0__, _opt_js__WEBPACK_IMPORTED_MODULE_5__]);
41144
41065
  ([_obj_js_component_bindgen_component_js__WEBPACK_IMPORTED_MODULE_0__, _opt_js__WEBPACK_IMPORTED_MODULE_5__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
41145
41066
 
@@ -41262,7 +41183,7 @@ async function transpileComponent (component, opts = {}) {
41262
41183
  let completed = 0;
41263
41184
  const spinnerText = () => chalk_template__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z`{cyan ${completed} / ${wasmFiles.length}} Running Binaryen wasm2js on Wasm core modules (this takes a while)...\n`;
41264
41185
  if (showSpinner) {
41265
- spinner = (0,ora__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)({
41186
+ spinner = (0,ora__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .ZP)({
41266
41187
  color: 'cyan',
41267
41188
  spinner: 'bouncingBar'
41268
41189
  }).start();
@@ -41837,12 +41758,13 @@ module.exports = JSON.parse('{"dots":{"interval":80,"frames":["⠋","⠙","⠹",
41837
41758
  /******/ var __webpack_exports__componentEmbed = __webpack_exports__.Ch;
41838
41759
  /******/ var __webpack_exports__componentNew = __webpack_exports__.LM;
41839
41760
  /******/ var __webpack_exports__componentWit = __webpack_exports__.YO;
41840
- /******/ var __webpack_exports__componentize = __webpack_exports__.he;
41841
41761
  /******/ var __webpack_exports__metadataAdd = __webpack_exports__.Xs;
41842
41762
  /******/ var __webpack_exports__metadataShow = __webpack_exports__.eL;
41843
41763
  /******/ var __webpack_exports__opt = __webpack_exports__.MD;
41844
41764
  /******/ var __webpack_exports__parse = __webpack_exports__.Qc;
41765
+ /******/ var __webpack_exports__preview1AdapterCommandPath = __webpack_exports__.ol;
41766
+ /******/ var __webpack_exports__preview1AdapterReactorPath = __webpack_exports__.tc;
41845
41767
  /******/ var __webpack_exports__print = __webpack_exports__.S0;
41846
41768
  /******/ var __webpack_exports__transpile = __webpack_exports__.LZ;
41847
- /******/ export { __webpack_exports__componentEmbed as componentEmbed, __webpack_exports__componentNew as componentNew, __webpack_exports__componentWit as componentWit, __webpack_exports__componentize as componentize, __webpack_exports__metadataAdd as metadataAdd, __webpack_exports__metadataShow as metadataShow, __webpack_exports__opt as opt, __webpack_exports__parse as parse, __webpack_exports__print as print, __webpack_exports__transpile as transpile };
41769
+ /******/ export { __webpack_exports__componentEmbed as componentEmbed, __webpack_exports__componentNew as componentNew, __webpack_exports__componentWit as componentWit, __webpack_exports__metadataAdd as metadataAdd, __webpack_exports__metadataShow as metadataShow, __webpack_exports__opt as opt, __webpack_exports__parse as parse, __webpack_exports__preview1AdapterCommandPath as preview1AdapterCommandPath, __webpack_exports__preview1AdapterReactorPath as preview1AdapterReactorPath, __webpack_exports__print as print, __webpack_exports__transpile as transpile };
41848
41770
  /******/