dependency-cruiser 17.4.3 → 18.0.0-beta-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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "17.4.3",
3
+ "version": "18.0.0-beta-1",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -148,7 +148,7 @@
148
148
  "acorn-jsx-walk": "2.0.0",
149
149
  "acorn-loose": "8.5.2",
150
150
  "acorn-walk": "8.3.5",
151
- "commander": "14.0.3",
151
+ "commander": "15.0.0",
152
152
  "enhanced-resolve": "5.22.1",
153
153
  "ignore": "7.0.5",
154
154
  "interpret": "3.1.1",
@@ -159,11 +159,10 @@
159
159
  "rechoir": "0.8.0",
160
160
  "safe-regex": "2.1.1",
161
161
  "semver": "7.8.1",
162
- "tsconfig-paths-webpack-plugin": "4.2.0",
163
162
  "watskeburt": "5.0.3"
164
163
  },
165
164
  "engines": {
166
- "node": "^20.12||^22||>=24"
165
+ "node": "^22||^24||>=26"
167
166
  },
168
167
  "scripts": {
169
168
  "test": "echo see github for test, build and analysis scripts"
@@ -58,7 +58,7 @@ export default async function extractDepcruiseConfig(
58
58
  const lResolvedFileName = resolve(
59
59
  pConfigFileName,
60
60
  pBaseDirectory,
61
- await normalizeResolveOptions(
61
+ normalizeResolveOptions(
62
62
  {
63
63
  extensions: [".js", ".json", ".cjs", ".mjs"],
64
64
  },
@@ -1,6 +1,6 @@
1
+ import { resolve as resolvePath } from "node:path";
1
2
  import enhancedResolve from "enhanced-resolve";
2
3
  import { stripQueryParameters } from "../helpers.mjs";
3
- import pathToPosix from "#utl/path-to-posix.mjs";
4
4
 
5
5
  /** @import {IResolveOptions} from "../../../types/resolve-options.mjs" */
6
6
 
@@ -50,8 +50,10 @@ export function resolve(
50
50
  return stripQueryParameters(
51
51
  gResolvers.get(pCachingContext).resolveSync(
52
52
  {},
53
- // lookupStartPath
54
- pathToPosix(pFileDirectory),
53
+ // lookupStartPath - must be absolute so enhanced-resolve classifies
54
+ // it correctly on Windows (relative paths with backslashes would be
55
+ // treated as PathType.Normal and POSIX-normalised, breaking ".." resolution)
56
+ resolvePath(pFileDirectory),
55
57
  // request
56
58
  pModuleName,
57
59
  ),
@@ -78,7 +78,7 @@ export default async function cruise(
78
78
  );
79
79
 
80
80
  bus.summary("startup: get resolve options", c(5));
81
- const lNormalizedResolveOptions = await normalizeResolveOptions(
81
+ const lNormalizedResolveOptions = normalizeResolveOptions(
82
82
  pResolveOptions,
83
83
  lCruiseOptions,
84
84
  pTranspileOptions?.tsConfig,
@@ -1,4 +1,5 @@
1
1
  import fs from "node:fs";
2
+ import { resolve as resolvePath } from "node:path";
2
3
  import enhancedResolve from "enhanced-resolve";
3
4
  import { scannableExtensions } from "#extract/transpile/meta.mjs";
4
5
  import {
@@ -61,64 +62,20 @@ function getNonOverridableResolveOptions(pCacheDuration) {
61
62
  };
62
63
  }
63
64
 
64
- function pushPlugin(pPlugins, pPluginToPush) {
65
- return (pPlugins || []).concat(pPluginToPush);
66
- }
67
-
68
- // eslint-disable-next-line max-lines-per-function
69
- async function compileResolveOptions(
65
+ function compileResolveOptions(
70
66
  pResolveOptions,
71
67
  pTSConfig,
72
68
  pResolveOptionsFromDCConfig,
73
69
  ) {
74
70
  let lResolveOptions = {};
75
71
 
76
- // There's a performance impact of ~1 ms per resolve even when there
77
- // are 0 paths in the tsconfig, so not loading it when not necessary
78
- // will be a win.
79
- // Also: requiring the plugin only when it's necessary will save some
80
- // startup time (especially on a cold require cache)
81
72
  if (pResolveOptions.tsConfig) {
82
- const { default: TsConfigPathsPlugin } =
83
- await import("tsconfig-paths-webpack-plugin");
84
- lResolveOptions.plugins = pushPlugin(
85
- lResolveOptions.plugins,
86
- // @ts-expect-error TS2351 "TsConfPathsPlugin is not constructable" - is unjustified
87
- new TsConfigPathsPlugin({
88
- configFile: pResolveOptions.tsConfig,
89
- // TsConfigPathsPlugin requires a baseUrl to be present in the tsconfig,
90
- // otherwise it prints scary messages that it didn't and read the tsConfig
91
- // (potentially making users think it's dependency-cruiser disregarding the
92
- // tsconfig). Hence up till version 13.0.4 dependency-cruiser only loaded
93
- // TsConfigPathsPlugin when an options.baseUrl existed. However, this
94
- // isn't necessary anymore:
95
- // - [tsconfig#baseUrl documentation](https://www.typescriptlang.org/tsconfig#baseUrl)
96
- // UNrecommends the use of the baseUrl for non-AMD projects
97
- // - [tsconfig-paths PR #207](https://github.com/dividab/tsconfig-paths/pull/208)
98
- // 'tolerates' undefined baseUrls
99
- //
100
- // Hence, until
101
- // [tpwp issue #99](https://github.com/dividab/tsconfig-paths-webpack-plugin/issues/99)
102
- // lands:
103
- // - pass a default baseUrl to TsConfigPathsPlugin if the baseUrl isn't available
104
- // - pass undefined in all other cases; TsConfigPathsPlugin will read
105
- // it from the tsconfig.json in that case. Passing the processed baseUrl
106
- // (pTSConfig?.options?.baseUrl) instead would've been more obvious, but
107
- // doesn't work, as that is an absolute path and tsconfig-paths(-wpp)
108
- // seems to process that again resulting in invalid paths and unresolved
109
- // or erroneous dependencies
110
- // eslint-disable-next-line no-undefined
111
- baseUrl: pTSConfig?.options?.baseUrl ? undefined : "./",
112
- // TsConfigPathsPlugin doesn't (can't) read enhanced-resolve's
113
- // list of extensions, and the default it uses for extensions
114
- // so we do it ourselves - either with the extensions passed
115
- // or with the supported ones.
116
- extensions:
117
- pResolveOptionsFromDCConfig.extensions ||
118
- pResolveOptions.extensions ||
119
- DEFAULT_RESOLVE_OPTIONS.extensions,
120
- }),
121
- );
73
+ lResolveOptions.tsconfig = {
74
+ configFile: resolvePath(pResolveOptions.tsConfig),
75
+
76
+ // baseUrl: pTSConfig?.options?.baseUrl ? undefined : "./",
77
+ // references: pTSConfig?.options?.references ?? []
78
+ };
122
79
  }
123
80
 
124
81
  return {
@@ -140,14 +97,14 @@ async function compileResolveOptions(
140
97
  * @returns
141
98
  */
142
99
  // eslint-disable-next-line complexity
143
- export default async function normalizeResolveOptions(
100
+ export default function normalizeResolveOptions(
144
101
  pResolveOptions,
145
102
  pOptions,
146
103
  pTSConfig,
147
104
  ) {
148
105
  const lRuleSet = pOptions?.ruleSet ?? {};
149
106
 
150
- return await compileResolveOptions(
107
+ return compileResolveOptions(
151
108
  {
152
109
  // EnhancedResolve's symlinks:
153
110
  // - true => symlinks are followed (vv)
package/src/meta.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  /* generated - don't edit */
2
2
  module.exports = {
3
- version: "17.4.3",
3
+ version: "18.0.0-beta-1",
4
4
  engines: {
5
- node: "^20.12||^22||>=24",
5
+ node: "^22||^24||>=26",
6
6
  },
7
7
  supportedTranspilers: {
8
8
  babel: ">=7.0.0 <8.0.0",