dependency-cruiser 16.4.0 → 16.4.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.
- package/package.json +1 -1
- package/src/cache/cache.mjs +0 -2
- package/src/cache/find-content-changes.mjs +0 -2
- package/src/cache/metadata-strategy.mjs +0 -1
- package/src/cli/init-config/find-extensions.mjs +0 -3
- package/src/extract/resolve/module-classifiers.mjs +8 -1
- package/src/meta.cjs +1 -1
- package/src/validate/match-dependency-rule.mjs +0 -1
- package/src/validate/match-module-rule.mjs +4 -4
package/package.json
CHANGED
package/src/cache/cache.mjs
CHANGED
|
@@ -9,9 +9,7 @@ import {
|
|
|
9
9
|
import { optionsAreCompatible } from "./options-compatible.mjs";
|
|
10
10
|
import MetadataStrategy from "./metadata-strategy.mjs";
|
|
11
11
|
import ContentStrategy from "./content-strategy.mjs";
|
|
12
|
-
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
13
12
|
import { scannableExtensions } from "#extract/transpile/meta.mjs";
|
|
14
|
-
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
15
13
|
import { bus } from "#utl/bus.mjs";
|
|
16
14
|
|
|
17
15
|
/**
|
|
@@ -8,9 +8,7 @@ import {
|
|
|
8
8
|
hasInterestingExtension,
|
|
9
9
|
moduleIsInterestingForDiff,
|
|
10
10
|
} from "./helpers.mjs";
|
|
11
|
-
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
12
11
|
import { bus } from "#utl/bus.mjs";
|
|
13
|
-
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
14
12
|
import findAllFiles from "#utl/find-all-files.mjs";
|
|
15
13
|
|
|
16
14
|
/**
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
/* eslint-disable security/detect-object-injection */
|
|
3
|
-
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
4
3
|
import { scannableExtensions } from "#extract/transpile/meta.mjs";
|
|
5
|
-
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
6
4
|
import getExtension from "#utl/get-extension.mjs";
|
|
7
|
-
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
8
5
|
import findAllFiles from "#utl/find-all-files.mjs";
|
|
9
6
|
|
|
10
7
|
/**
|
|
@@ -168,8 +168,15 @@ function isWorkspaceAliased(pModuleName, pResolvedModuleName, pManifest) {
|
|
|
168
168
|
// oh and: ```picomatch.isMatch('asdf', 'asdf/**') === true``` so
|
|
169
169
|
// in case it's only 'asdf' that's in the resolved module name for some reason
|
|
170
170
|
// we're good as well.
|
|
171
|
+
//
|
|
172
|
+
// workspaces is supposed to be array of strings, where each string is
|
|
173
|
+
// a glob pattern. However, in the field there's occasions where it's
|
|
174
|
+
// not a string. We'll just ignore those for now, hence the presence of
|
|
175
|
+
// the `typeof pWorkspace === "string"` check.
|
|
171
176
|
const lModuleFriendlyWorkspaceGlobs = lWorkspaces.map((pWorkspace) =>
|
|
172
|
-
pWorkspace.endsWith("/")
|
|
177
|
+
typeof pWorkspace === "string" && pWorkspace.endsWith("/")
|
|
178
|
+
? `${pWorkspace}**`
|
|
179
|
+
: `${pWorkspace}/**`,
|
|
173
180
|
);
|
|
174
181
|
if (picomatch.isMatch(pResolvedModuleName, lModuleFriendlyWorkspaceGlobs)) {
|
|
175
182
|
return true;
|
package/src/meta.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { isModuleOnlyRule, isFolderScope } from "./rule-classifiers.mjs";
|
|
3
3
|
import matchers from "./matchers.mjs";
|
|
4
|
-
// @ts-expect-error ts(2307) - apparently tsc doesn't understand subpath imports yet
|
|
5
4
|
import { extractGroups } from "#utl/regex-util.mjs";
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -13,7 +13,7 @@ import { extractGroups } from "#utl/regex-util.mjs";
|
|
|
13
13
|
function matchesOrphanRule(pRule, pModule) {
|
|
14
14
|
return (
|
|
15
15
|
Object.hasOwn(pRule?.from ?? {}, "orphan") &&
|
|
16
|
-
// @ts-expect-error the '
|
|
16
|
+
// @ts-expect-error the 'hasOwn' above guarantees there's a 'from.orphan' attribute
|
|
17
17
|
pModule.orphan === pRule.from.orphan &&
|
|
18
18
|
matchers.fromPath(pRule, pModule) &&
|
|
19
19
|
matchers.fromPathNot(pRule, pModule)
|
|
@@ -34,11 +34,11 @@ function matchesReachableRule(pRule, pModule) {
|
|
|
34
34
|
Object.hasOwn(pRule?.to ?? {}, "reachable") &&
|
|
35
35
|
Object.hasOwn(pModule, "reachable")
|
|
36
36
|
) {
|
|
37
|
-
// @ts-expect-error the '
|
|
37
|
+
// @ts-expect-error the 'hasOwn' above ensures the 'reachable' exists
|
|
38
38
|
const lReachableRecord = pModule.reachable.find(
|
|
39
39
|
(pReachable) =>
|
|
40
40
|
pReachable.asDefinedInRule === pRule.name &&
|
|
41
|
-
// @ts-expect-error the '
|
|
41
|
+
// @ts-expect-error the 'hasOwn' above ensures the 'to.reachable' exists
|
|
42
42
|
pReachable.value === pRule.to.reachable,
|
|
43
43
|
);
|
|
44
44
|
if (lReachableRecord) {
|
|
@@ -66,7 +66,7 @@ function matchesReachesRule(pRule, pModule) {
|
|
|
66
66
|
return (
|
|
67
67
|
Object.hasOwn(pRule?.to ?? {}, "reachable") &&
|
|
68
68
|
Object.hasOwn(pModule, "reaches") &&
|
|
69
|
-
// @ts-expect-error the '
|
|
69
|
+
// @ts-expect-error the 'hasOwn' above guarantees the .reaches exists
|
|
70
70
|
pModule.reaches.some(
|
|
71
71
|
(pReaches) =>
|
|
72
72
|
pReaches.asDefinedInRule === pRule.name &&
|