@powerlines/plugin-automd 0.1.312 → 0.1.314

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.
@@ -3,14 +3,14 @@ import { tokenizer } from "../../../../acorn@8.16.0/node_modules/acorn/dist/acor
3
3
  import { joinURL } from "../../../../ufo@1.6.3/node_modules/ufo/dist/index.mjs";
4
4
  import { builtinModules, createRequire } from "node:module";
5
5
  import fs, { promises, realpathSync, statSync } from "node:fs";
6
- import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
6
+ import { fileURLToPath, pathToFileURL } from "node:url";
7
7
  import assert from "node:assert";
8
8
  import process$1 from "node:process";
9
9
  import path from "node:path";
10
10
  import v8 from "node:v8";
11
11
  import { format as format$1, inspect } from "node:util";
12
12
 
13
- //#region ../../node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist/index.mjs
13
+ //#region ../../node_modules/.pnpm/mlly@1.8.1/node_modules/mlly/dist/index.mjs
14
14
  const BUILTIN_MODULES = new Set(builtinModules);
15
15
  function normalizeSlash(path$1) {
16
16
  return path$1.replace(/\\/g, "/");
@@ -77,7 +77,7 @@ codes.ERR_INVALID_ARG_TYPE = createError(
77
77
  * @param {unknown} actual
78
78
  */
79
79
  (name, expected, actual) => {
80
- assert(typeof name === "string", "'name' must be a string");
80
+ assert.ok(typeof name === "string", "'name' must be a string");
81
81
  if (!Array.isArray(expected)) expected = [expected];
82
82
  let message = "The ";
83
83
  if (name.endsWith(" argument")) message += `${name} `;
@@ -93,10 +93,10 @@ codes.ERR_INVALID_ARG_TYPE = createError(
93
93
  /** @type {Array<string>} */
94
94
  const other = [];
95
95
  for (const value of expected) {
96
- assert(typeof value === "string", "All expected entries have to be of type string");
96
+ assert.ok(typeof value === "string", "All expected entries have to be of type string");
97
97
  if (kTypes.has(value)) types$1.push(value.toLowerCase());
98
98
  else if (classRegExp.exec(value) === null) {
99
- assert(value !== "object", "The value \"object\" should be written as \"Object\"");
99
+ assert.ok(value !== "object", "The value \"object\" should be written as \"Object\"");
100
100
  other.push(value);
101
101
  } else instances.push(value);
102
102
  }
@@ -161,7 +161,7 @@ codes.ERR_INVALID_PACKAGE_TARGET = createError(
161
161
  (packagePath, key, target, isImport = false, base = void 0) => {
162
162
  const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
163
163
  if (key === ".") {
164
- assert(isImport === false);
164
+ assert.ok(isImport === false);
165
165
  return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? "; targets must start with \"./\"" : ""}`;
166
166
  }
167
167
  return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? "; targets must start with \"./\"" : ""}`;
@@ -328,15 +328,15 @@ const captureLargerStackTrace = hideStackFrames(
328
328
  */
329
329
  function getMessage(key, parameters, self) {
330
330
  const message = messages.get(key);
331
- assert(message !== void 0, "expected `message` to be found");
331
+ assert.ok(message !== void 0, "expected `message` to be found");
332
332
  if (typeof message === "function") {
333
- assert(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
333
+ assert.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
334
334
  return Reflect.apply(message, self, parameters);
335
335
  }
336
336
  const regex = /%[dfijoOs]/g;
337
337
  let expectedLength = 0;
338
338
  while (regex.exec(message) !== null) expectedLength++;
339
- assert(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
339
+ assert.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
340
340
  if (parameters.length === 0) return message;
341
341
  parameters.unshift(message);
342
342
  return Reflect.apply(format$1, null, parameters);
@@ -537,6 +537,21 @@ function defaultGetFormatWithoutErrors(url, context) {
537
537
  if (!hasOwnProperty.call(protocolHandlers, protocol)) return null;
538
538
  return protocolHandlers[protocol](url, context, true) || null;
539
539
  }
540
+ const DEFAULT_CONDITIONS = Object.freeze(["node", "import"]);
541
+ const DEFAULT_CONDITIONS_SET$1 = new Set(DEFAULT_CONDITIONS);
542
+ /**
543
+ * Returns the default conditions for ES module loading, as a Set.
544
+ */
545
+ function getDefaultConditionsSet() {
546
+ return DEFAULT_CONDITIONS_SET$1;
547
+ }
548
+ /**
549
+ * @param {Array<string>} [conditions]
550
+ * @returns {Set<string>}
551
+ */
552
+ function getConditionsSet(conditions) {
553
+ return getDefaultConditionsSet();
554
+ }
540
555
  const RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
541
556
  const { ERR_INVALID_MODULE_SPECIFIER, ERR_INVALID_PACKAGE_CONFIG, ERR_INVALID_PACKAGE_TARGET, ERR_MODULE_NOT_FOUND, ERR_PACKAGE_IMPORT_NOT_DEFINED, ERR_PACKAGE_PATH_NOT_EXPORTED, ERR_UNSUPPORTED_DIR_IMPORT, ERR_UNSUPPORTED_RESOLVE_REQUEST } = codes;
542
557
  const own = {}.hasOwnProperty;
@@ -575,7 +590,7 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
575
590
  if (process$1.noDeprecation) return;
576
591
  if (defaultGetFormatWithoutErrors(url, { parentURL: base.href }) !== "module") return;
577
592
  const urlPath = fileURLToPath(url.href);
578
- const packagePath = fileURLToPath(new URL$1(".", packageJsonUrl));
593
+ const packagePath = fileURLToPath(new URL(".", packageJsonUrl));
579
594
  const basePath = fileURLToPath(base);
580
595
  if (!main) process$1.emitWarning(`No "main" or "exports" field defined in the package.json for ${packagePath} resolving the main entry point "${urlPath.slice(packagePath.length)}", imported from ${basePath}.\nDefault "index" lookups for the main are deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
581
596
  else if (path.resolve(packagePath, main) !== urlPath) process$1.emitWarning(`Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(packagePath.length)}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
@@ -615,7 +630,7 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
615
630
  /** @type {URL | undefined} */
616
631
  let guess;
617
632
  if (packageConfig.main !== void 0) {
618
- guess = new URL$1(packageConfig.main, packageJsonUrl);
633
+ guess = new URL(packageConfig.main, packageJsonUrl);
619
634
  if (fileExists(guess)) return guess;
620
635
  const tries$1 = [
621
636
  `./${packageConfig.main}.js`,
@@ -627,7 +642,7 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
627
642
  ];
628
643
  let i$1 = -1;
629
644
  while (++i$1 < tries$1.length) {
630
- guess = new URL$1(tries$1[i$1], packageJsonUrl);
645
+ guess = new URL(tries$1[i$1], packageJsonUrl);
631
646
  if (fileExists(guess)) break;
632
647
  guess = void 0;
633
648
  }
@@ -643,7 +658,7 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
643
658
  ];
644
659
  let i = -1;
645
660
  while (++i < tries.length) {
646
- guess = new URL$1(tries[i], packageJsonUrl);
661
+ guess = new URL(tries[i], packageJsonUrl);
647
662
  if (fileExists(guess)) break;
648
663
  guess = void 0;
649
664
  }
@@ -651,7 +666,7 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
651
666
  emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);
652
667
  return guess;
653
668
  }
654
- throw new ERR_MODULE_NOT_FOUND(fileURLToPath(new URL$1(".", packageJsonUrl)), fileURLToPath(base));
669
+ throw new ERR_MODULE_NOT_FOUND(fileURLToPath(new URL(".", packageJsonUrl)), fileURLToPath(base));
655
670
  }
656
671
  /**
657
672
  * @param {URL} resolved
@@ -698,7 +713,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
698
713
  * @returns {Error}
699
714
  */
700
715
  function importNotDefined(specifier, packageJsonUrl, base) {
701
- return new ERR_PACKAGE_IMPORT_NOT_DEFINED(specifier, packageJsonUrl && fileURLToPath(new URL$1(".", packageJsonUrl)), fileURLToPath(base));
716
+ return new ERR_PACKAGE_IMPORT_NOT_DEFINED(specifier, packageJsonUrl && fileURLToPath(new URL(".", packageJsonUrl)), fileURLToPath(base));
702
717
  }
703
718
  /**
704
719
  * @param {string} subpath
@@ -707,7 +722,7 @@ function importNotDefined(specifier, packageJsonUrl, base) {
707
722
  * @returns {Error}
708
723
  */
709
724
  function exportsNotFound(subpath, packageJsonUrl, base) {
710
- return new ERR_PACKAGE_PATH_NOT_EXPORTED(fileURLToPath(new URL$1(".", packageJsonUrl)), subpath, base && fileURLToPath(base));
725
+ return new ERR_PACKAGE_PATH_NOT_EXPORTED(fileURLToPath(new URL(".", packageJsonUrl)), subpath, base && fileURLToPath(base));
711
726
  }
712
727
  /**
713
728
  * @param {string} request
@@ -730,7 +745,7 @@ function throwInvalidSubpath(request, match, packageJsonUrl, internal, base) {
730
745
  */
731
746
  function invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) {
732
747
  target = typeof target === "object" && target !== null ? JSON.stringify(target, null, "") : `${target}`;
733
- return new ERR_INVALID_PACKAGE_TARGET(fileURLToPath(new URL$1(".", packageJsonUrl)), subpath, target, internal, base && fileURLToPath(base));
748
+ return new ERR_INVALID_PACKAGE_TARGET(fileURLToPath(new URL(".", packageJsonUrl)), subpath, target, internal, base && fileURLToPath(base));
734
749
  }
735
750
  /**
736
751
  * @param {string} target
@@ -750,7 +765,7 @@ function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base
750
765
  if (internal && !target.startsWith("../") && !target.startsWith("/")) {
751
766
  let isURL = false;
752
767
  try {
753
- new URL$1(target);
768
+ new URL(target);
754
769
  isURL = true;
755
770
  } catch {}
756
771
  if (!isURL) return packageResolve(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target + subpath, packageJsonUrl, conditions);
@@ -763,9 +778,9 @@ function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base
763
778
  emitInvalidSegmentDeprecation(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target, request, match, packageJsonUrl, internal, base, true);
764
779
  }
765
780
  } else throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
766
- const resolved = new URL$1(target, packageJsonUrl);
781
+ const resolved = new URL(target, packageJsonUrl);
767
782
  const resolvedPath = resolved.pathname;
768
- const packagePath = new URL$1(".", packageJsonUrl).pathname;
783
+ const packagePath = new URL(".", packageJsonUrl).pathname;
769
784
  if (!resolvedPath.startsWith(packagePath)) throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
770
785
  if (subpath === "") return resolved;
771
786
  if (invalidSegmentRegEx.exec(subpath) !== null) {
@@ -774,8 +789,8 @@ function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base
774
789
  if (!isPathMap) emitInvalidSegmentDeprecation(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target, request, match, packageJsonUrl, internal, base, false);
775
790
  } else throwInvalidSubpath(request, match, packageJsonUrl, internal, base);
776
791
  }
777
- if (pattern) return new URL$1(RegExpPrototypeSymbolReplace.call(patternRegEx, resolved.href, () => subpath));
778
- return new URL$1(subpath, resolved);
792
+ if (pattern) return new URL(RegExpPrototypeSymbolReplace.call(patternRegEx, resolved.href, () => subpath));
793
+ return new URL(subpath, resolved);
779
794
  }
780
795
  /**
781
796
  * @param {string} key
@@ -857,10 +872,10 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b
857
872
  * @param {URL} base
858
873
  * @returns {boolean}
859
874
  */
860
- function isConditionalExportsMainSugar(exports, packageJsonUrl, base) {
861
- if (typeof exports === "string" || Array.isArray(exports)) return true;
862
- if (typeof exports !== "object" || exports === null) return false;
863
- const keys = Object.getOwnPropertyNames(exports);
875
+ function isConditionalExportsMainSugar(exports$1, packageJsonUrl, base) {
876
+ if (typeof exports$1 === "string" || Array.isArray(exports$1)) return true;
877
+ if (typeof exports$1 !== "object" || exports$1 === null) return false;
878
+ const keys = Object.getOwnPropertyNames(exports$1);
864
879
  let isConditionalSugar = false;
865
880
  let i = 0;
866
881
  let keyIndex = -1;
@@ -893,17 +908,17 @@ function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
893
908
  * @returns {URL}
894
909
  */
895
910
  function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) {
896
- let exports = packageConfig.exports;
897
- if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) exports = { ".": exports };
898
- if (own.call(exports, packageSubpath) && !packageSubpath.includes("*") && !packageSubpath.endsWith("/")) {
899
- const target = exports[packageSubpath];
911
+ let exports$1 = packageConfig.exports;
912
+ if (isConditionalExportsMainSugar(exports$1, packageJsonUrl, base)) exports$1 = { ".": exports$1 };
913
+ if (own.call(exports$1, packageSubpath) && !packageSubpath.includes("*") && !packageSubpath.endsWith("/")) {
914
+ const target = exports$1[packageSubpath];
900
915
  const resolveResult = resolvePackageTarget(packageJsonUrl, target, "", packageSubpath, base, false, false, false, conditions);
901
916
  if (resolveResult === null || resolveResult === void 0) throw exportsNotFound(packageSubpath, packageJsonUrl, base);
902
917
  return resolveResult;
903
918
  }
904
919
  let bestMatch = "";
905
920
  let bestMatchSubpath = "";
906
- const keys = Object.getOwnPropertyNames(exports);
921
+ const keys = Object.getOwnPropertyNames(exports$1);
907
922
  let i = -1;
908
923
  while (++i < keys.length) {
909
924
  const key = keys[i];
@@ -918,7 +933,7 @@ function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, ba
918
933
  }
919
934
  }
920
935
  if (bestMatch) {
921
- const target = exports[bestMatch];
936
+ const target = exports$1[bestMatch];
922
937
  const resolveResult = resolvePackageTarget(packageJsonUrl, target, bestMatchSubpath, bestMatch, base, true, false, packageSubpath.endsWith("/"), conditions);
923
938
  if (resolveResult === null || resolveResult === void 0) throw exportsNotFound(packageSubpath, packageJsonUrl, base);
924
939
  return resolveResult;
@@ -1013,7 +1028,7 @@ function parsePackageName(specifier, base) {
1013
1028
  * @returns {URL}
1014
1029
  */
1015
1030
  function packageResolve(specifier, base, conditions) {
1016
- if (builtinModules.includes(specifier)) return new URL$1("node:" + specifier);
1031
+ if (builtinModules.includes(specifier)) return new URL("node:" + specifier);
1017
1032
  const { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base);
1018
1033
  const packageConfig = getPackageScopeConfig(base);
1019
1034
  /* c8 ignore next 16 */
@@ -1021,7 +1036,7 @@ function packageResolve(specifier, base, conditions) {
1021
1036
  const packageJsonUrl$1 = pathToFileURL(packageConfig.pjsonPath);
1022
1037
  if (packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) return packageExportsResolve(packageJsonUrl$1, packageSubpath, packageConfig, base, conditions);
1023
1038
  }
1024
- let packageJsonUrl = new URL$1("./node_modules/" + packageName + "/package.json", base);
1039
+ let packageJsonUrl = new URL("./node_modules/" + packageName + "/package.json", base);
1025
1040
  let packageJsonPath = fileURLToPath(packageJsonUrl);
1026
1041
  /** @type {string} */
1027
1042
  let lastPath;
@@ -1029,7 +1044,7 @@ function packageResolve(specifier, base, conditions) {
1029
1044
  const stat = tryStatSync(packageJsonPath.slice(0, -13));
1030
1045
  if (!stat || !stat.isDirectory()) {
1031
1046
  lastPath = packageJsonPath;
1032
- packageJsonUrl = new URL$1((isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json", packageJsonUrl);
1047
+ packageJsonUrl = new URL((isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json", packageJsonUrl);
1033
1048
  packageJsonPath = fileURLToPath(packageJsonUrl);
1034
1049
  continue;
1035
1050
  }
@@ -1039,7 +1054,7 @@ function packageResolve(specifier, base, conditions) {
1039
1054
  });
1040
1055
  if (packageConfig$1.exports !== void 0 && packageConfig$1.exports !== null) return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig$1, base, conditions);
1041
1056
  if (packageSubpath === ".") return legacyMainResolve(packageJsonUrl, packageConfig$1, base);
1042
- return new URL$1(packageSubpath, packageJsonUrl);
1057
+ return new URL(packageSubpath, packageJsonUrl);
1043
1058
  } while (packageJsonPath.length !== lastPath.length);
1044
1059
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), false);
1045
1060
  }
@@ -1079,12 +1094,13 @@ function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {
1079
1094
  * A URL object to the found thing.
1080
1095
  */
1081
1096
  function moduleResolve(specifier, base, conditions, preserveSymlinks) {
1097
+ if (conditions === void 0) conditions = getConditionsSet();
1082
1098
  const protocol = base.protocol;
1083
1099
  const isRemote = protocol === "data:" || protocol === "http:" || protocol === "https:";
1084
1100
  /** @type {URL | undefined} */
1085
1101
  let resolved;
1086
1102
  if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) try {
1087
- resolved = new URL$1(specifier, base);
1103
+ resolved = new URL(specifier, base);
1088
1104
  } catch (error_) {
1089
1105
  const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
1090
1106
  error.cause = error_;
@@ -1092,7 +1108,7 @@ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
1092
1108
  }
1093
1109
  else if (protocol === "file:" && specifier[0] === "#") resolved = packageImportsResolve(specifier, base, conditions);
1094
1110
  else try {
1095
- resolved = new URL$1(specifier);
1111
+ resolved = new URL(specifier);
1096
1112
  } catch (error_) {
1097
1113
  if (isRemote && !builtinModules.includes(specifier)) {
1098
1114
  const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
@@ -1101,7 +1117,7 @@ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
1101
1117
  }
1102
1118
  resolved = packageResolve(specifier, base, conditions);
1103
1119
  }
1104
- assert(resolved !== void 0, "expected to be defined");
1120
+ assert.ok(resolved !== void 0, "expected to be defined");
1105
1121
  if (resolved.protocol !== "file:") return resolved;
1106
1122
  return finalizeResolution(resolved, base);
1107
1123
  }
@@ -1194,14 +1210,56 @@ const EXPORT_STAR_RE = /\bexport\s*\*(?:\s*as\s+(?<name>[\w$]+)\s+)?\s*(?:\s*fro
1194
1210
  const EXPORT_DEFAULT_RE = /\bexport\s+default\s+(async function|function|class|true|false|\W|\d)|\bexport\s+default\s+(?<defaultName>.*)/g;
1195
1211
  const EXPORT_DEFAULT_CLASS_RE = /\bexport\s+default\s+(?<declaration>class)\s+(?<name>[\w$]+)/g;
1196
1212
  const TYPE_RE = /^\s*?type\s/;
1213
+ function _extractExtraNames(extraNamesStr) {
1214
+ const names = [];
1215
+ let depth = 0;
1216
+ let angleDepth = 0;
1217
+ let inString = false;
1218
+ let inTypeAnnotation = false;
1219
+ for (let i = 0; i < extraNamesStr.length; i++) {
1220
+ const char = extraNamesStr[i];
1221
+ if (inString) {
1222
+ if (char === inString) {
1223
+ let backslashCount = 0;
1224
+ for (let j = i - 1; j >= 0 && extraNamesStr[j] === "\\"; j--) backslashCount++;
1225
+ if (backslashCount % 2 === 0) inString = false;
1226
+ }
1227
+ continue;
1228
+ }
1229
+ if (char === "\"" || char === "'" || char === "`") {
1230
+ inString = char;
1231
+ continue;
1232
+ }
1233
+ if (char === ":" && depth === 0 && angleDepth === 0) {
1234
+ inTypeAnnotation = true;
1235
+ continue;
1236
+ }
1237
+ if (char === "=" && extraNamesStr[i + 1] !== ">" && depth === 0 && angleDepth === 0) inTypeAnnotation = false;
1238
+ if (inTypeAnnotation && char === "<") {
1239
+ angleDepth++;
1240
+ continue;
1241
+ }
1242
+ if (inTypeAnnotation && char === ">" && angleDepth > 0) {
1243
+ angleDepth--;
1244
+ continue;
1245
+ }
1246
+ if (char === "(" || char === "[" || char === "{") depth++;
1247
+ else if (char === ")" || char === "]" || char === "}") depth--;
1248
+ if (char === "," && depth === 0 && angleDepth === 0) {
1249
+ const match = extraNamesStr.slice(i + 1).match(/^\s*([\w$]+)/);
1250
+ if (match) names.push(match[1]);
1251
+ }
1252
+ }
1253
+ return names;
1254
+ }
1197
1255
  function findExports(code) {
1198
1256
  const declaredExports = matchAll(EXPORT_DECAL_RE, code, { type: "declaration" });
1199
1257
  for (const declaredExport of declaredExports) {
1200
1258
  if (/^export\s+(?:async\s+)?function/.test(declaredExport.code)) continue;
1201
1259
  const extraNamesStr = declaredExport.extraNames;
1202
1260
  if (extraNamesStr) {
1203
- const extraNames = matchAll(/({.*?})|(\[.*?])|(,\s*(?<name>\w+))/g, extraNamesStr, {}).map((m) => m.name).filter(Boolean);
1204
- declaredExport.names = [declaredExport.name, ...extraNames];
1261
+ const extraNames = _extractExtraNames(extraNamesStr);
1262
+ if (extraNames.length > 0) declaredExport.names = [declaredExport.name, ...extraNames];
1205
1263
  }
1206
1264
  delete declaredExport.extraNames;
1207
1265
  }
@@ -1217,7 +1275,7 @@ function findExports(code) {
1217
1275
  });
1218
1276
  const defaultClassExports = matchAll(EXPORT_DEFAULT_CLASS_RE, code, { type: "declaration" });
1219
1277
  const starExports = matchAll(EXPORT_STAR_RE, code, { type: "star" });
1220
- const exports = normalizeExports([
1278
+ const exports$1 = normalizeExports([
1221
1279
  ...declaredExports,
1222
1280
  ...namedExports,
1223
1281
  ...destructuredExports,
@@ -1225,16 +1283,16 @@ function findExports(code) {
1225
1283
  ...defaultClassExports,
1226
1284
  ...starExports
1227
1285
  ]);
1228
- if (exports.length === 0) return [];
1286
+ if (exports$1.length === 0) return [];
1229
1287
  const exportLocations = _tryGetLocations(code, "export");
1230
1288
  if (exportLocations && exportLocations.length === 0) return [];
1231
- return _filterStatement(exportLocations, exports).filter((exp, index, exports2) => {
1289
+ return _filterStatement(exportLocations, exports$1).filter((exp, index, exports2) => {
1232
1290
  const nextExport = exports2[index + 1];
1233
1291
  return !nextExport || exp.type !== nextExport.type || !exp.name || exp.name !== nextExport.name;
1234
1292
  });
1235
1293
  }
1236
- function normalizeExports(exports) {
1237
- for (const exp of exports) {
1294
+ function normalizeExports(exports$1) {
1295
+ for (const exp of exports$1) {
1238
1296
  if (!exp.name && exp.names && exp.names.length === 1) exp.name = exp.names[0];
1239
1297
  if (exp.name === "default" && exp.type !== "default") {
1240
1298
  exp._type = exp.type;
@@ -1243,7 +1301,7 @@ function normalizeExports(exports) {
1243
1301
  if (!exp.names && exp.name) exp.names = [exp.name];
1244
1302
  if (exp.type === "declaration" && exp.declaration) exp.declarationType = exp.declaration.replace(/^declare\s*/, "");
1245
1303
  }
1246
- return exports;
1304
+ return exports$1;
1247
1305
  }
1248
1306
  function normalizeNamedExports(namedExports) {
1249
1307
  for (const namedExport of namedExports) namedExport.names = namedExport.exports.replace(/^\r?\n?/, "").split(/\s*,\s*/g).filter((name) => !TYPE_RE.test(name)).map((name) => name.replace(/^.*?\sas\s/, "").trim());