mol_dump_lib 0.0.971 → 0.0.973

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/web.js CHANGED
@@ -3947,14 +3947,14 @@ var $;
3947
3947
  };
3948
3948
  return regexp2;
3949
3949
  }
3950
- static vary(sources) {
3950
+ static vary(sources, flags = 'gsu') {
3951
3951
  const groups = [];
3952
3952
  const chunks = sources.map(source => {
3953
3953
  const regexp = $mol_regexp.from(source);
3954
3954
  groups.push(...regexp.groups);
3955
3955
  return regexp.source;
3956
3956
  });
3957
- return new $mol_regexp(`(?:${chunks.join('|')})`, '', groups);
3957
+ return new $mol_regexp(`(?:${chunks.join('|')})`, flags, groups);
3958
3958
  }
3959
3959
  static optional(source) {
3960
3960
  return $mol_regexp.repeat_greedy(source, 0, 1);
@@ -6102,6 +6102,93 @@ var $;
6102
6102
  })($mol_rest_code = $.$mol_rest_code || ($.$mol_rest_code = {}));
6103
6103
  })($ || ($ = {}));
6104
6104
 
6105
+ ;
6106
+ "use strict";
6107
+ var $;
6108
+ (function ($) {
6109
+ function cause_serialize(cause) {
6110
+ return JSON.stringify(cause, null, ' ')
6111
+ .replace(/\(/, '<')
6112
+ .replace(/\)/, ' >');
6113
+ }
6114
+ function frame_normalize(frame) {
6115
+ return (typeof frame === 'string' ? frame : cause_serialize(frame))
6116
+ .trim()
6117
+ .replace(/at /gm, ' at ')
6118
+ .replace(/^(?! +at )(.*)/gm, ' at | $1 (#)');
6119
+ }
6120
+ class $mol_error_mix extends AggregateError {
6121
+ cause;
6122
+ name = $$.$mol_func_name(this.constructor).replace(/^\$/, '') + '_Error';
6123
+ constructor(message, cause = {}, ...errors) {
6124
+ super(errors, message, { cause });
6125
+ this.cause = cause;
6126
+ const desc = Object.getOwnPropertyDescriptor(this, 'stack');
6127
+ const stack_get = () => desc?.get?.() ?? super.stack ?? desc?.value ?? this.message;
6128
+ Object.defineProperty(this, 'stack', {
6129
+ get: () => stack_get() + '\n' + [
6130
+ this.cause ?? 'no cause',
6131
+ ...this.errors.flatMap(e => [
6132
+ String(e.stack),
6133
+ ...e instanceof $mol_error_mix || !e.cause ? [] : [e.cause]
6134
+ ])
6135
+ ].map(frame_normalize).join('\n')
6136
+ });
6137
+ Object.defineProperty(this, 'cause', {
6138
+ get: () => cause
6139
+ });
6140
+ }
6141
+ static [Symbol.toPrimitive]() {
6142
+ return this.toString();
6143
+ }
6144
+ static toString() {
6145
+ return $$.$mol_func_name(this);
6146
+ }
6147
+ static make(...params) {
6148
+ return new this(...params);
6149
+ }
6150
+ }
6151
+ $.$mol_error_mix = $mol_error_mix;
6152
+ })($ || ($ = {}));
6153
+
6154
+ ;
6155
+ "use strict";
6156
+ var $;
6157
+ (function ($) {
6158
+ function pass(data) {
6159
+ return data;
6160
+ }
6161
+ function $mol_error_fence(task, fallback, loading = pass) {
6162
+ try {
6163
+ return task();
6164
+ }
6165
+ catch (error) {
6166
+ let normalized;
6167
+ try {
6168
+ normalized = $mol_promise_like(error) ? loading(error) : fallback(error);
6169
+ }
6170
+ catch (sub_error) {
6171
+ normalized = $mol_promise_like(sub_error) ? sub_error : new $mol_error_mix(sub_error.message, { error }, sub_error);
6172
+ }
6173
+ if (normalized instanceof Error || $mol_promise_like(normalized)) {
6174
+ $mol_fail_hidden(normalized);
6175
+ }
6176
+ return normalized;
6177
+ }
6178
+ }
6179
+ $.$mol_error_fence = $mol_error_fence;
6180
+ })($ || ($ = {}));
6181
+
6182
+ ;
6183
+ "use strict";
6184
+ var $;
6185
+ (function ($) {
6186
+ function $mol_error_enriched(cause, cb) {
6187
+ return $mol_error_fence(cb, e => new $mol_error_mix(e.message, cause, e));
6188
+ }
6189
+ $.$mol_error_enriched = $mol_error_enriched;
6190
+ })($ || ($ = {}));
6191
+
6105
6192
  ;
6106
6193
  "use strict";
6107
6194
  var $;
@@ -6154,13 +6241,13 @@ var $;
6154
6241
  return decoder.decode(buffer);
6155
6242
  }
6156
6243
  json() {
6157
- return $mol_wire_sync(this.native).json();
6244
+ return $mol_error_enriched(this, () => $mol_wire_sync(this.native).json());
6158
6245
  }
6159
6246
  blob() {
6160
- return $mol_wire_sync(this.native).blob();
6247
+ return $mol_error_enriched(this, () => $mol_wire_sync(this.native).blob());
6161
6248
  }
6162
6249
  buffer() {
6163
- return $mol_wire_sync(this.native).arrayBuffer();
6250
+ return $mol_error_enriched(this, () => $mol_wire_sync(this.native).arrayBuffer());
6164
6251
  }
6165
6252
  xml() {
6166
6253
  return $mol_dom_parse(this.text(), 'application/xml');