@dloizides/frontend-devtools 2.1.0 → 2.1.1

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.
@@ -2186,6 +2186,14 @@ function isExemptFile2(path2, allow) {
2186
2186
  if (TEST_FILE2.test(path2) || SHARED_SOURCE.test(path2)) return true;
2187
2187
  return allow.some((fragment) => path2.includes(fragment));
2188
2188
  }
2189
+ var MODULE_DECLARATIONS = /* @__PURE__ */ new Set(["ImportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration"]);
2190
+ function usesPackage(program, packageName) {
2191
+ return program.body.some((statement) => {
2192
+ if (!MODULE_DECLARATIONS.has(statement.type) || statement.source == null) return false;
2193
+ const source = statement.source.value;
2194
+ return source === packageName || typeof source === "string" && source.startsWith(`${packageName}/`);
2195
+ });
2196
+ }
2189
2197
  function literalText(node) {
2190
2198
  if (node.type === "Literal") return typeof node.value === "string" ? node.value : "";
2191
2199
  return node.quasis.length === 1 ? node.quasis[0].value.cooked ?? "" : "";
@@ -2227,7 +2235,7 @@ var noReimplementedPackageRule = {
2227
2235
  return {
2228
2236
  Program(node) {
2229
2237
  for (const entry of REIMPLEMENTED_PACKAGE_REGISTRY)
2230
- if (entry.paths.some((pattern) => pattern.test(path2))) report(node, entry);
2238
+ if (entry.paths.some((pattern) => pattern.test(path2)) && !usesPackage(node, entry.package)) report(node, entry);
2231
2239
  },
2232
2240
  Literal: checkLiteral,
2233
2241
  TemplateLiteral: checkLiteral