@parcel/utils 2.0.0-nightly.1138 → 2.0.0-nightly.1158

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/lib/index.js CHANGED
@@ -3438,6 +3438,7 @@ $parcel$export(module.exports, "loadConfig", () => $10671d0be444e08b$export$c1a4
3438
3438
  $parcel$export(module.exports, "DefaultMap", () => $5783bf7916ff59db$export$674cd7dcb504ac5c);
3439
3439
  $parcel$export(module.exports, "DefaultWeakMap", () => $5783bf7916ff59db$export$4924f7ffab2ae440);
3440
3440
  $parcel$export(module.exports, "makeDeferredWithPromise", () => $75952a43539cb60f$export$93f345b3f0dd27e7);
3441
+ $parcel$export(module.exports, "getProgressMessage", () => $01f892dcf45b57a7$export$d28945a2f2ba5e30);
3441
3442
  $parcel$export(module.exports, "isGlob", () => $e8d0e504a4244d84$export$f3a2344a73dbdd42);
3442
3443
  $parcel$export(module.exports, "isGlobMatch", () => $e8d0e504a4244d84$export$16e6d319a883f04e);
3443
3444
  $parcel$export(module.exports, "globSync", () => $e8d0e504a4244d84$export$42275ba87174c828);
@@ -7804,6 +7805,10 @@ $10862ec0f65326f9$var$_IN("1.3.14.3.2.29", "sha1WithRSASignature");
7804
7805
  $10862ec0f65326f9$var$_IN("2.16.840.1.101.3.4.2.1", "sha256");
7805
7806
  $10862ec0f65326f9$var$_IN("2.16.840.1.101.3.4.2.2", "sha384");
7806
7807
  $10862ec0f65326f9$var$_IN("2.16.840.1.101.3.4.2.3", "sha512");
7808
+ $10862ec0f65326f9$var$_IN("2.16.840.1.101.3.4.2.4", "sha224");
7809
+ $10862ec0f65326f9$var$_IN("2.16.840.1.101.3.4.2.5", "sha512-224");
7810
+ $10862ec0f65326f9$var$_IN("2.16.840.1.101.3.4.2.6", "sha512-256");
7811
+ $10862ec0f65326f9$var$_IN("1.2.840.113549.2.2", "md2");
7807
7812
  $10862ec0f65326f9$var$_IN("1.2.840.113549.2.5", "md5");
7808
7813
  // pkcs#7 content types
7809
7814
  $10862ec0f65326f9$var$_IN("1.2.840.113549.1.7.1", "data");
@@ -8129,6 +8134,8 @@ $10862ec0f65326f9$var$_IN("1.3.6.1.5.5.7.3.8", "timeStamping");
8129
8134
  * @param [options] object with options or boolean strict flag
8130
8135
  * [strict] true to be strict when checking value lengths, false to
8131
8136
  * allow truncated values (default: true).
8137
+ * [parseAllBytes] true to ensure all bytes are parsed
8138
+ * (default: true)
8132
8139
  * [decodeBitStrings] true to attempt to decode the content of
8133
8140
  * BIT STRINGs (not OCTET STRINGs) using strict mode. Note that
8134
8141
  * without schema support to understand the data context this can
@@ -8136,21 +8143,34 @@ $10862ec0f65326f9$var$_IN("1.3.6.1.5.5.7.3.8", "timeStamping");
8136
8143
  * flag will be deprecated or removed as soon as schema support is
8137
8144
  * available. (default: true)
8138
8145
  *
8146
+ * @throws Will throw an error for various malformed input conditions.
8147
+ *
8139
8148
  * @return the parsed asn1 object.
8140
8149
  */ $579f29a8775d6845$var$asn1.fromDer = function(bytes, options) {
8141
8150
  if (options === undefined) options = {
8142
8151
  strict: true,
8152
+ parseAllBytes: true,
8143
8153
  decodeBitStrings: true
8144
8154
  };
8145
8155
  if (typeof options === "boolean") options = {
8146
8156
  strict: options,
8157
+ parseAllBytes: true,
8147
8158
  decodeBitStrings: true
8148
8159
  };
8149
8160
  if (!("strict" in options)) options.strict = true;
8161
+ if (!("parseAllBytes" in options)) options.parseAllBytes = true;
8150
8162
  if (!("decodeBitStrings" in options)) options.decodeBitStrings = true;
8151
8163
  // wrap in buffer if needed
8152
8164
  if (typeof bytes === "string") bytes = $iGlOy.util.createBuffer(bytes);
8153
- return $579f29a8775d6845$var$_fromDer(bytes, bytes.length(), 0, options);
8165
+ var byteCount = bytes.length();
8166
+ var value = $579f29a8775d6845$var$_fromDer(bytes, bytes.length(), 0, options);
8167
+ if (options.parseAllBytes && bytes.length() !== 0) {
8168
+ var error = new Error("Unparsed DER bytes remain after ASN.1 parsing.");
8169
+ error.byteCount = byteCount;
8170
+ error.remaining = bytes.length();
8171
+ throw error;
8172
+ }
8173
+ return value;
8154
8174
  };
8155
8175
  /**
8156
8176
  * Internal function to parse an asn1 object from a byte buffer in DER format.
@@ -8246,7 +8266,6 @@ $10862ec0f65326f9$var$_IN("1.3.6.1.5.5.7.3.8", "timeStamping");
8246
8266
  start = bytes.length();
8247
8267
  var subOptions = {
8248
8268
  // enforce strict mode to avoid parsing ASN.1 from plain data
8249
- verbose: options.verbose,
8250
8269
  strict: true,
8251
8270
  decodeBitStrings: true
8252
8271
  };
@@ -8282,7 +8301,10 @@ $10862ec0f65326f9$var$_IN("1.3.6.1.5.5.7.3.8", "timeStamping");
8282
8301
  value += String.fromCharCode(bytes.getInt16());
8283
8302
  remaining -= 2;
8284
8303
  }
8285
- } else value = bytes.getBytes(length);
8304
+ } else {
8305
+ value = bytes.getBytes(length);
8306
+ remaining -= length;
8307
+ }
8286
8308
  }
8287
8309
  // add BIT STRING contents if available
8288
8310
  var asn1Options = bitStringContents === undefined ? null : {
@@ -8854,7 +8876,12 @@ var $579f29a8775d6845$var$_nonLatinRegex = /[^\\u0000-\\u00ff]/;
8854
8876
  } else if (obj.type === $579f29a8775d6845$var$asn1.Type.OCTETSTRING) {
8855
8877
  if (!$579f29a8775d6845$var$_nonLatinRegex.test(obj.value)) rval += "(" + obj.value + ") ";
8856
8878
  rval += "0x" + $iGlOy.util.bytesToHex(obj.value);
8857
- } else if (obj.type === $579f29a8775d6845$var$asn1.Type.UTF8) rval += $iGlOy.util.decodeUtf8(obj.value);
8879
+ } else if (obj.type === $579f29a8775d6845$var$asn1.Type.UTF8) try {
8880
+ rval += $iGlOy.util.decodeUtf8(obj.value);
8881
+ } catch (e) {
8882
+ if (e.message === "URI malformed") rval += "0x" + $iGlOy.util.bytesToHex(obj.value) + " (malformed UTF8)";
8883
+ else throw e;
8884
+ }
8858
8885
  else if (obj.type === $579f29a8775d6845$var$asn1.Type.PRINTABLESTRING || obj.type === $579f29a8775d6845$var$asn1.Type.IA5String) rval += obj.value;
8859
8886
  else if ($579f29a8775d6845$var$_nonLatinRegex.test(obj.value)) rval += "0x" + $iGlOy.util.bytesToHex(obj.value);
8860
8887
  else if (obj.value.length === 0) rval += "[null]";
@@ -14475,6 +14502,45 @@ var $8ab3548bea1beb81$var$publicKeyValidator = $iGlOy.pki.rsa.publicKeyValidator
14475
14502
  }
14476
14503
  ]
14477
14504
  };
14505
+ // validator for a DigestInfo structure
14506
+ var $8ab3548bea1beb81$var$digestInfoValidator = {
14507
+ name: "DigestInfo",
14508
+ tagClass: $8ab3548bea1beb81$var$asn1.Class.UNIVERSAL,
14509
+ type: $8ab3548bea1beb81$var$asn1.Type.SEQUENCE,
14510
+ constructed: true,
14511
+ value: [
14512
+ {
14513
+ name: "DigestInfo.DigestAlgorithm",
14514
+ tagClass: $8ab3548bea1beb81$var$asn1.Class.UNIVERSAL,
14515
+ type: $8ab3548bea1beb81$var$asn1.Type.SEQUENCE,
14516
+ constructed: true,
14517
+ value: [
14518
+ {
14519
+ name: "DigestInfo.DigestAlgorithm.algorithmIdentifier",
14520
+ tagClass: $8ab3548bea1beb81$var$asn1.Class.UNIVERSAL,
14521
+ type: $8ab3548bea1beb81$var$asn1.Type.OID,
14522
+ constructed: false,
14523
+ capture: "algorithmIdentifier"
14524
+ },
14525
+ {
14526
+ // NULL paramters
14527
+ name: "DigestInfo.DigestAlgorithm.parameters",
14528
+ tagClass: $8ab3548bea1beb81$var$asn1.Class.UNIVERSAL,
14529
+ type: $8ab3548bea1beb81$var$asn1.Type.NULL,
14530
+ constructed: false
14531
+ }
14532
+ ]
14533
+ },
14534
+ {
14535
+ // digest
14536
+ name: "DigestInfo.digest",
14537
+ tagClass: $8ab3548bea1beb81$var$asn1.Class.UNIVERSAL,
14538
+ type: $8ab3548bea1beb81$var$asn1.Type.OCTETSTRING,
14539
+ constructed: false,
14540
+ capture: "digest"
14541
+ }
14542
+ ]
14543
+ };
14478
14544
  /**
14479
14545
  * Wrap digest in DigestInfo object.
14480
14546
  *
@@ -15176,19 +15242,46 @@ var $8ab3548bea1beb81$var$publicKeyValidator = $iGlOy.pki.rsa.publicKeyValidator
15176
15242
  * a Forge PSS object for RSASSA-PSS,
15177
15243
  * 'NONE' or null for none, DigestInfo will not be expected, but
15178
15244
  * PKCS#1 v1.5 padding will still be used.
15245
+ * @param options optional verify options
15246
+ * _parseAllDigestBytes testing flag to control parsing of all
15247
+ * digest bytes. Unsupported and not for general usage.
15248
+ * (default: true)
15179
15249
  *
15180
15250
  * @return true if the signature was verified, false if not.
15181
- */ key.verify = function(digest, signature, scheme) {
15251
+ */ key.verify = function(digest, signature, scheme, options) {
15182
15252
  if (typeof scheme === "string") scheme = scheme.toUpperCase();
15183
15253
  else if (scheme === undefined) scheme = "RSASSA-PKCS1-V1_5";
15254
+ if (options === undefined) options = {
15255
+ _parseAllDigestBytes: true
15256
+ };
15257
+ if (!("_parseAllDigestBytes" in options)) options._parseAllDigestBytes = true;
15184
15258
  if (scheme === "RSASSA-PKCS1-V1_5") scheme = {
15185
15259
  verify: function(digest, d) {
15186
15260
  // remove padding
15187
15261
  d = $8ab3548bea1beb81$var$_decodePkcs1_v1_5(d, key, true);
15188
15262
  // d is ASN.1 BER-encoded DigestInfo
15189
- var obj = $8ab3548bea1beb81$var$asn1.fromDer(d);
15263
+ var obj = $8ab3548bea1beb81$var$asn1.fromDer(d, {
15264
+ parseAllBytes: options._parseAllDigestBytes
15265
+ });
15266
+ // validate DigestInfo
15267
+ var capture = {};
15268
+ var errors = [];
15269
+ if (!$8ab3548bea1beb81$var$asn1.validate(obj, $8ab3548bea1beb81$var$digestInfoValidator, capture, errors)) {
15270
+ var error = new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");
15271
+ error.errors = errors;
15272
+ throw error;
15273
+ }
15274
+ // check hash algorithm identifier
15275
+ // see PKCS1-v1-5DigestAlgorithms in RFC 8017
15276
+ // FIXME: add support to vaidator for strict value choices
15277
+ var oid = $8ab3548bea1beb81$var$asn1.derToOid(capture.algorithmIdentifier);
15278
+ if (!(oid === $iGlOy.oids.md2 || oid === $iGlOy.oids.md5 || oid === $iGlOy.oids.sha1 || oid === $iGlOy.oids.sha224 || oid === $iGlOy.oids.sha256 || oid === $iGlOy.oids.sha384 || oid === $iGlOy.oids.sha512 || oid === $iGlOy.oids["sha512-224"] || oid === $iGlOy.oids["sha512-256"])) {
15279
+ var error = new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");
15280
+ error.oid = oid;
15281
+ throw error;
15282
+ }
15190
15283
  // compare the given digest to the decrypted one
15191
- return digest === obj.value[1].value;
15284
+ return digest === capture.digest;
15192
15285
  }
15193
15286
  };
15194
15287
  else if (scheme === "NONE" || scheme === "NULL" || scheme === null) scheme = {
@@ -34828,7 +34921,7 @@ async function $10671d0be444e08b$export$c1a4367d4847eb06(fs, filepath, filenames
34828
34921
  if (cachedOutput) return cachedOutput;
34829
34922
  try {
34830
34923
  let extname = (0, ($parcel$interopDefault($8C1kk$path))).extname(configFile).slice(1);
34831
- if (extname === "js") {
34924
+ if (extname === "js" || extname === "cjs") {
34832
34925
  let output = {
34833
34926
  // $FlowFixMe
34834
34927
  config: (0, (/*@__PURE__*/$parcel$interopDefault($284aeb9e515b63c0$exports)))(require(configFile)),
@@ -35069,6 +35162,22 @@ class $5783bf7916ff59db$export$4924f7ffab2ae440 extends WeakMap {
35069
35162
 
35070
35163
 
35071
35164
 
35165
+ function $01f892dcf45b57a7$export$d28945a2f2ba5e30(event) {
35166
+ switch(event.phase){
35167
+ case "transforming":
35168
+ return `Building ${(0, ($parcel$interopDefault($8C1kk$path))).basename(event.filePath)}...`;
35169
+ case "bundling":
35170
+ return "Bundling...";
35171
+ case "packaging":
35172
+ return `Packaging ${event.bundle.displayName}...`;
35173
+ case "optimizing":
35174
+ return `Optimizing ${event.bundle.displayName}...`;
35175
+ }
35176
+ return null;
35177
+ }
35178
+
35179
+
35180
+
35072
35181
 
35073
35182
 
35074
35183
  function $4b14026b40817fca$export$8a9ede1a78d6a1fe(stream) {