@rushstack/trace-import 0.3.8 → 0.3.10
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/LICENSE +23 -23
- package/README.md +155 -155
- package/bin/trace-import +2 -2
- package/lib/TraceImportCommandLineParser.js.map +1 -1
- package/lib/start.js.map +1 -1
- package/lib/traceImport.js.map +1 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
@rushstack/trace-import
|
|
2
|
-
|
|
3
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
|
|
5
|
-
MIT License
|
|
6
|
-
|
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
-
a copy of this software and associated documentation files (the
|
|
9
|
-
"Software"), to deal in the Software without restriction, including
|
|
10
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
-
the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be
|
|
16
|
-
included in all copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
22
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
1
|
+
@rushstack/trace-import
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
|
|
5
|
+
MIT License
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
a copy of this software and associated documentation files (the
|
|
9
|
+
"Software"), to deal in the Software without restriction, including
|
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
22
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
24
24
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,155 +1,155 @@
|
|
|
1
|
-
# @rushstack/trace-import
|
|
2
|
-
|
|
3
|
-
> 🚨 _EARLY PREVIEW RELEASE_ 🚨
|
|
4
|
-
>
|
|
5
|
-
> Not all features are implemented yet. To provide suggestions, please
|
|
6
|
-
> [create a GitHub issue](https://github.com/microsoft/rushstack/issues/new/choose).
|
|
7
|
-
> If you have questions, see the [Rush Stack Help page](https://rushstack.io/pages/help/support/)
|
|
8
|
-
> for support resources.
|
|
9
|
-
|
|
10
|
-
The `trace-import` command line tool helps you:
|
|
11
|
-
|
|
12
|
-
- Analyze `import`/`require()` statements to understand why they aren't resolving correctly
|
|
13
|
-
- Understand the relationships between package folders in your `node_modules` tree
|
|
14
|
-
- Ensure that `package.json` files correctly export their .js and .d.ts entry points
|
|
15
|
-
|
|
16
|
-
## Usage
|
|
17
|
-
|
|
18
|
-
It's recommended to install this package globally:
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
# Install the NPM package
|
|
22
|
-
npm install -g @rushstack/trace-import
|
|
23
|
-
|
|
24
|
-
# View the command-line help
|
|
25
|
-
trace-import --help
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Command line
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
usage: trace-import [-h] [-d] -p IMPORT_PATH [-b FOLDER_PATH] [-t {cjs,es,ts}]
|
|
32
|
-
|
|
33
|
-
This tool analyzes import module paths, to determine the resolved target
|
|
34
|
-
folder. For example, if the "semver" NPM package is installed, "trace-import
|
|
35
|
-
--path semver/index" will print output equivalent to the Node.js require.
|
|
36
|
-
resolve() API. If "@types/semver" is installed, then "trace-import
|
|
37
|
-
--resolution-type ts --path semver/index" will print the .d.ts file path that
|
|
38
|
-
would be resolved by a TypeScript import statement.
|
|
39
|
-
|
|
40
|
-
Optional arguments:
|
|
41
|
-
-h, --help Show this help message and exit.
|
|
42
|
-
-d, --debug Show the full call stack if an error occurs while
|
|
43
|
-
executing the tool
|
|
44
|
-
-p IMPORT_PATH, --path IMPORT_PATH
|
|
45
|
-
The import module path to be analyzed. For example,
|
|
46
|
-
"example" in expressions such as: require("example");
|
|
47
|
-
require.resolve("example"); import { Thing } from
|
|
48
|
-
"example";
|
|
49
|
-
-b FOLDER_PATH, --base-folder FOLDER_PATH
|
|
50
|
-
The "--path" string will be resolved as if the import
|
|
51
|
-
statement appeared in a script located in this folder.
|
|
52
|
-
If omitted, the current working directory is used.
|
|
53
|
-
-t {cjs,es,ts}, --resolution-type {cjs,es,ts}
|
|
54
|
-
The type of module resolution to perform: "cjs" for
|
|
55
|
-
CommonJS, "es" for ES modules, or "ts" for TypeScript
|
|
56
|
-
typings. The default value is "cjs".
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Sample outputs
|
|
60
|
-
|
|
61
|
-
These commands were invoked in the `C:\Git\rushstack\apps\trace-import` folder
|
|
62
|
-
where trace-import is developed.
|
|
63
|
-
|
|
64
|
-
### Resolving a CommonJS main index
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
trace-import --path semver
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Sample output:
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
Base folder: C:\Git\rushstack\apps\trace-import
|
|
74
|
-
Package name: semver
|
|
75
|
-
Package subpath: (not specified)
|
|
76
|
-
|
|
77
|
-
Resolving...
|
|
78
|
-
|
|
79
|
-
Package folder: C:\Git\rushstack\common\temp\node_modules\.pnpm\semver@7.3.8\node_modules\semver
|
|
80
|
-
package.json: semver (7.3.8)
|
|
81
|
-
Main index: "main": "index.js"
|
|
82
|
-
|
|
83
|
-
Target path: C:\Git\rushstack\common\temp\node_modules\.pnpm\semver@7.3.8\node_modules\semver\index.js
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### Resolving a CommonJS package subpath
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
-
trace-import --path typescript/bin/tsc
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Sample output:
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
Base folder: C:\Git\rushstack\apps\trace-import
|
|
96
|
-
Package name: typescript
|
|
97
|
-
Package subpath: bin/tsc
|
|
98
|
-
|
|
99
|
-
Resolving...
|
|
100
|
-
|
|
101
|
-
Package folder: C:\Git\rushstack\common\temp\node_modules\.pnpm\typescript@4.8.4\node_modules\typescript
|
|
102
|
-
package.json: typescript (4.8.4)
|
|
103
|
-
|
|
104
|
-
Target path: C:\Git\rushstack\common\temp\node_modules\.pnpm\typescript@4.8.4\node_modules\typescript\bin\tsc
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Resolving a TypeScript declaration
|
|
108
|
-
|
|
109
|
-
```
|
|
110
|
-
trace-import --resolution-type ts --path semver
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Sample output:
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
Base folder: C:\Git\rushstack\apps\trace-import
|
|
117
|
-
Package name: semver
|
|
118
|
-
Package subpath: (not specified)
|
|
119
|
-
|
|
120
|
-
Resolving...
|
|
121
|
-
|
|
122
|
-
Package folder: C:\Git\rushstack\common\temp\node_modules\.pnpm\semver@7.3.8\node_modules\semver
|
|
123
|
-
package.json: semver (7.3.8)
|
|
124
|
-
@types folder: C:\Git\rushstack\common\temp\node_modules\.pnpm\@types+semver@7.3.5\node_modules\@types\semver
|
|
125
|
-
@types package.json: @types/semver (7.3.5)
|
|
126
|
-
@types main index: "types": "index.d.ts"
|
|
127
|
-
|
|
128
|
-
Target path: C:\Git\rushstack\common\temp\node_modules\.pnpm\@types+semver@7.3.5\node_modules\@types\semver\index.d.ts
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Resolving a relative path
|
|
132
|
-
|
|
133
|
-
```
|
|
134
|
-
trace-import --path ./config/rig.json
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
Sample output:
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
Base folder: C:\Git\rushstack\apps\trace-import
|
|
141
|
-
Import path: ./config/rig.json
|
|
142
|
-
|
|
143
|
-
The import path does not appear to reference an NPM package.
|
|
144
|
-
Resolving...
|
|
145
|
-
|
|
146
|
-
Target path: C:\Git\rushstack\apps\trace-import\config\rig.json
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
## Links
|
|
150
|
-
|
|
151
|
-
- [CHANGELOG.md](https://github.com/microsoft/rushstack/blob/main/apps/trace-import/CHANGELOG.md) - Find
|
|
152
|
-
out what's new in the latest version
|
|
153
|
-
- [Rush Lockfile Explorer](https://lfx.rushstack.io) - The desktop app for troubleshooting PNPM lockfiles
|
|
154
|
-
|
|
155
|
-
The `trace-import` tool is part of the [Rush Stack](https://rushstack.io/) family of projects.
|
|
1
|
+
# @rushstack/trace-import
|
|
2
|
+
|
|
3
|
+
> 🚨 _EARLY PREVIEW RELEASE_ 🚨
|
|
4
|
+
>
|
|
5
|
+
> Not all features are implemented yet. To provide suggestions, please
|
|
6
|
+
> [create a GitHub issue](https://github.com/microsoft/rushstack/issues/new/choose).
|
|
7
|
+
> If you have questions, see the [Rush Stack Help page](https://rushstack.io/pages/help/support/)
|
|
8
|
+
> for support resources.
|
|
9
|
+
|
|
10
|
+
The `trace-import` command line tool helps you:
|
|
11
|
+
|
|
12
|
+
- Analyze `import`/`require()` statements to understand why they aren't resolving correctly
|
|
13
|
+
- Understand the relationships between package folders in your `node_modules` tree
|
|
14
|
+
- Ensure that `package.json` files correctly export their .js and .d.ts entry points
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
It's recommended to install this package globally:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
# Install the NPM package
|
|
22
|
+
npm install -g @rushstack/trace-import
|
|
23
|
+
|
|
24
|
+
# View the command-line help
|
|
25
|
+
trace-import --help
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Command line
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
usage: trace-import [-h] [-d] -p IMPORT_PATH [-b FOLDER_PATH] [-t {cjs,es,ts}]
|
|
32
|
+
|
|
33
|
+
This tool analyzes import module paths, to determine the resolved target
|
|
34
|
+
folder. For example, if the "semver" NPM package is installed, "trace-import
|
|
35
|
+
--path semver/index" will print output equivalent to the Node.js require.
|
|
36
|
+
resolve() API. If "@types/semver" is installed, then "trace-import
|
|
37
|
+
--resolution-type ts --path semver/index" will print the .d.ts file path that
|
|
38
|
+
would be resolved by a TypeScript import statement.
|
|
39
|
+
|
|
40
|
+
Optional arguments:
|
|
41
|
+
-h, --help Show this help message and exit.
|
|
42
|
+
-d, --debug Show the full call stack if an error occurs while
|
|
43
|
+
executing the tool
|
|
44
|
+
-p IMPORT_PATH, --path IMPORT_PATH
|
|
45
|
+
The import module path to be analyzed. For example,
|
|
46
|
+
"example" in expressions such as: require("example");
|
|
47
|
+
require.resolve("example"); import { Thing } from
|
|
48
|
+
"example";
|
|
49
|
+
-b FOLDER_PATH, --base-folder FOLDER_PATH
|
|
50
|
+
The "--path" string will be resolved as if the import
|
|
51
|
+
statement appeared in a script located in this folder.
|
|
52
|
+
If omitted, the current working directory is used.
|
|
53
|
+
-t {cjs,es,ts}, --resolution-type {cjs,es,ts}
|
|
54
|
+
The type of module resolution to perform: "cjs" for
|
|
55
|
+
CommonJS, "es" for ES modules, or "ts" for TypeScript
|
|
56
|
+
typings. The default value is "cjs".
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Sample outputs
|
|
60
|
+
|
|
61
|
+
These commands were invoked in the `C:\Git\rushstack\apps\trace-import` folder
|
|
62
|
+
where trace-import is developed.
|
|
63
|
+
|
|
64
|
+
### Resolving a CommonJS main index
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
trace-import --path semver
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Sample output:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
Base folder: C:\Git\rushstack\apps\trace-import
|
|
74
|
+
Package name: semver
|
|
75
|
+
Package subpath: (not specified)
|
|
76
|
+
|
|
77
|
+
Resolving...
|
|
78
|
+
|
|
79
|
+
Package folder: C:\Git\rushstack\common\temp\node_modules\.pnpm\semver@7.3.8\node_modules\semver
|
|
80
|
+
package.json: semver (7.3.8)
|
|
81
|
+
Main index: "main": "index.js"
|
|
82
|
+
|
|
83
|
+
Target path: C:\Git\rushstack\common\temp\node_modules\.pnpm\semver@7.3.8\node_modules\semver\index.js
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Resolving a CommonJS package subpath
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
trace-import --path typescript/bin/tsc
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Sample output:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
Base folder: C:\Git\rushstack\apps\trace-import
|
|
96
|
+
Package name: typescript
|
|
97
|
+
Package subpath: bin/tsc
|
|
98
|
+
|
|
99
|
+
Resolving...
|
|
100
|
+
|
|
101
|
+
Package folder: C:\Git\rushstack\common\temp\node_modules\.pnpm\typescript@4.8.4\node_modules\typescript
|
|
102
|
+
package.json: typescript (4.8.4)
|
|
103
|
+
|
|
104
|
+
Target path: C:\Git\rushstack\common\temp\node_modules\.pnpm\typescript@4.8.4\node_modules\typescript\bin\tsc
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Resolving a TypeScript declaration
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
trace-import --resolution-type ts --path semver
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Sample output:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
Base folder: C:\Git\rushstack\apps\trace-import
|
|
117
|
+
Package name: semver
|
|
118
|
+
Package subpath: (not specified)
|
|
119
|
+
|
|
120
|
+
Resolving...
|
|
121
|
+
|
|
122
|
+
Package folder: C:\Git\rushstack\common\temp\node_modules\.pnpm\semver@7.3.8\node_modules\semver
|
|
123
|
+
package.json: semver (7.3.8)
|
|
124
|
+
@types folder: C:\Git\rushstack\common\temp\node_modules\.pnpm\@types+semver@7.3.5\node_modules\@types\semver
|
|
125
|
+
@types package.json: @types/semver (7.3.5)
|
|
126
|
+
@types main index: "types": "index.d.ts"
|
|
127
|
+
|
|
128
|
+
Target path: C:\Git\rushstack\common\temp\node_modules\.pnpm\@types+semver@7.3.5\node_modules\@types\semver\index.d.ts
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Resolving a relative path
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
trace-import --path ./config/rig.json
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Sample output:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
Base folder: C:\Git\rushstack\apps\trace-import
|
|
141
|
+
Import path: ./config/rig.json
|
|
142
|
+
|
|
143
|
+
The import path does not appear to reference an NPM package.
|
|
144
|
+
Resolving...
|
|
145
|
+
|
|
146
|
+
Target path: C:\Git\rushstack\apps\trace-import\config\rig.json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Links
|
|
150
|
+
|
|
151
|
+
- [CHANGELOG.md](https://github.com/microsoft/rushstack/blob/main/apps/trace-import/CHANGELOG.md) - Find
|
|
152
|
+
out what's new in the latest version
|
|
153
|
+
- [Rush Lockfile Explorer](https://lfx.rushstack.io) - The desktop app for troubleshooting PNPM lockfiles
|
|
154
|
+
|
|
155
|
+
The `trace-import` tool is part of the [Rush Stack](https://rushstack.io/) family of projects.
|
package/bin/trace-import
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
require('../lib/start.js');
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
require('../lib/start.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TraceImportCommandLineParser.js","sourceRoot":"","sources":["../src/TraceImportCommandLineParser.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,uDAAiC;AACjC,gEAKoC;AACpC,oEAA6D;AAE7D,+CAAiE;AAEjE,MAAa,4BAA6B,SAAQ,mCAAiB;IAMjE;QACE,KAAK,CAAC;YACJ,YAAY,EAAE,cAAc;YAC5B,eAAe,EACb,oFAAoF;gBACpF,iGAAiG;gBACjG,iEAAiE;gBACjE,qGAAqG;gBACrG,oFAAoF;SACvF,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC9C,iBAAiB,EAAE,SAAS;YAC5B,kBAAkB,EAAE,IAAI;YACxB,WAAW,EAAE,sEAAsE;SACpF,CAAC,CAAC;QAEH,IAAI,CAAC,cA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C,IAAI,GAAG,cAAM,CAAC,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;aACpE;SACF;IACH,CAAC;CACF;AAxED,oEAwEC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport colors from 'colors/safe';\nimport {\n CommandLineParser,\n type CommandLineFlagParameter,\n type CommandLineStringParameter,\n type CommandLineChoiceParameter\n} from '@rushstack/ts-command-line';\nimport { InternalError } from '@rushstack/node-core-library';\n\nimport { type ResolutionType, traceImport } from './traceImport';\n\nexport class TraceImportCommandLineParser extends CommandLineParser {\n private readonly _debugParameter: CommandLineFlagParameter;\n private readonly _pathParameter: CommandLineStringParameter;\n private readonly _baseFolderParameter: CommandLineStringParameter;\n private readonly _resolutionTypeParameter: CommandLineChoiceParameter;\n\n public constructor() {\n super({\n toolFilename: 'trace-import',\n toolDescription:\n 'This tool analyzes import module paths, to determine the resolved target folder. ' +\n 'For example, if the \"semver\" NPM package is installed, \"trace-import --path semver/index\" will ' +\n 'print output equivalent to the Node.js require.resolve() API. ' +\n 'If \"@types/semver\" is installed, then \"trace-import --resolution-type ts --path semver/index\" will ' +\n 'print the .d.ts file path that would be resolved by a TypeScript import statement.'\n });\n\n this._debugParameter = this.defineFlagParameter({\n parameterLongName: '--debug',\n parameterShortName: '-d',\n description: 'Show the full call stack if an error occurs while executing the tool'\n });\n\n this._pathParameter = this.defineStringParameter({\n parameterLongName: '--path',\n parameterShortName: '-p',\n description:\n 'The import module path to be analyzed. For example, ' +\n '\"example\" in expressions such as: require(\"example\"); require.resolve(\"example\"); import { Thing } from \"example\";',\n argumentName: 'IMPORT_PATH',\n required: true\n });\n\n this._baseFolderParameter = this.defineStringParameter({\n parameterLongName: '--base-folder',\n parameterShortName: '-b',\n description:\n 'The \"--path\" string will be resolved as if the import statement appeared in a script located in this folder. ' +\n 'If omitted, the current working directory is used.',\n argumentName: 'FOLDER_PATH'\n });\n\n this._resolutionTypeParameter = this.defineChoiceParameter({\n parameterLongName: '--resolution-type',\n parameterShortName: '-t',\n description:\n 'The type of module resolution to perform: ' +\n '\"cjs\" for CommonJS, \"es\" for ES modules, or \"ts\" for TypeScript typings',\n alternatives: ['cjs', 'es', 'ts'],\n defaultValue: 'cjs'\n });\n }\n\n protected async onExecute(): Promise<void> {\n // override\n if (this._debugParameter.value) {\n InternalError.breakInDebugger = true;\n }\n try {\n traceImport({\n importPath: this._pathParameter.value!,\n baseFolder: this._baseFolderParameter.value,\n resolutionType: (this._resolutionTypeParameter.value ?? 'cjs') as ResolutionType\n });\n } catch (error) {\n if (this._debugParameter.value) {\n console.error('\\n' + error.stack);\n } else {\n console.error('\\n' + colors.red('ERROR: ' + error.message.trim()));\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TraceImportCommandLineParser.js","sourceRoot":"","sources":["../src/TraceImportCommandLineParser.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,uDAAiC;AACjC,gEAKoC;AACpC,oEAA6D;AAE7D,+CAAiE;AAEjE,MAAa,4BAA6B,SAAQ,mCAAiB;IAMjE;QACE,KAAK,CAAC;YACJ,YAAY,EAAE,cAAc;YAC5B,eAAe,EACb,oFAAoF;gBACpF,iGAAiG;gBACjG,iEAAiE;gBACjE,qGAAqG;gBACrG,oFAAoF;SACvF,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC9C,iBAAiB,EAAE,SAAS;YAC5B,kBAAkB,EAAE,IAAI;YACxB,WAAW,EAAE,sEAAsE;SACpF,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC;YAC/C,iBAAiB,EAAE,QAAQ;YAC3B,kBAAkB,EAAE,IAAI;YACxB,WAAW,EACT,sDAAsD;gBACtD,oHAAoH;YACtH,YAAY,EAAE,aAA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// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport colors from 'colors/safe';\r\nimport {\r\n CommandLineParser,\r\n type CommandLineFlagParameter,\r\n type CommandLineStringParameter,\r\n type CommandLineChoiceParameter\r\n} from '@rushstack/ts-command-line';\r\nimport { InternalError } from '@rushstack/node-core-library';\r\n\r\nimport { type ResolutionType, traceImport } from './traceImport';\r\n\r\nexport class TraceImportCommandLineParser extends CommandLineParser {\r\n private readonly _debugParameter: CommandLineFlagParameter;\r\n private readonly _pathParameter: CommandLineStringParameter;\r\n private readonly _baseFolderParameter: CommandLineStringParameter;\r\n private readonly _resolutionTypeParameter: CommandLineChoiceParameter;\r\n\r\n public constructor() {\r\n super({\r\n toolFilename: 'trace-import',\r\n toolDescription:\r\n 'This tool analyzes import module paths, to determine the resolved target folder. ' +\r\n 'For example, if the \"semver\" NPM package is installed, \"trace-import --path semver/index\" will ' +\r\n 'print output equivalent to the Node.js require.resolve() API. ' +\r\n 'If \"@types/semver\" is installed, then \"trace-import --resolution-type ts --path semver/index\" will ' +\r\n 'print the .d.ts file path that would be resolved by a TypeScript import statement.'\r\n });\r\n\r\n this._debugParameter = this.defineFlagParameter({\r\n parameterLongName: '--debug',\r\n parameterShortName: '-d',\r\n description: 'Show the full call stack if an error occurs while executing the tool'\r\n });\r\n\r\n this._pathParameter = this.defineStringParameter({\r\n parameterLongName: '--path',\r\n parameterShortName: '-p',\r\n description:\r\n 'The import module path to be analyzed. For example, ' +\r\n '\"example\" in expressions such as: require(\"example\"); require.resolve(\"example\"); import { Thing } from \"example\";',\r\n argumentName: 'IMPORT_PATH',\r\n required: true\r\n });\r\n\r\n this._baseFolderParameter = this.defineStringParameter({\r\n parameterLongName: '--base-folder',\r\n parameterShortName: '-b',\r\n description:\r\n 'The \"--path\" string will be resolved as if the import statement appeared in a script located in this folder. ' +\r\n 'If omitted, the current working directory is used.',\r\n argumentName: 'FOLDER_PATH'\r\n });\r\n\r\n this._resolutionTypeParameter = this.defineChoiceParameter({\r\n parameterLongName: '--resolution-type',\r\n parameterShortName: '-t',\r\n description:\r\n 'The type of module resolution to perform: ' +\r\n '\"cjs\" for CommonJS, \"es\" for ES modules, or \"ts\" for TypeScript typings',\r\n alternatives: ['cjs', 'es', 'ts'],\r\n defaultValue: 'cjs'\r\n });\r\n }\r\n\r\n protected async onExecute(): Promise<void> {\r\n // override\r\n if (this._debugParameter.value) {\r\n InternalError.breakInDebugger = true;\r\n }\r\n try {\r\n traceImport({\r\n importPath: this._pathParameter.value!,\r\n baseFolder: this._baseFolderParameter.value,\r\n resolutionType: (this._resolutionTypeParameter.value ?? 'cjs') as ResolutionType\r\n });\r\n } catch (error) {\r\n if (this._debugParameter.value) {\r\n console.error('\\n' + error.stack);\r\n } else {\r\n console.error('\\n' + colors.red('ERROR: ' + error.message.trim()));\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
package/lib/start.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;AAE3D,uDAAiC;AAEjC,oEAAiE;AACjE,iFAA8E;AAE9E,MAAM,WAAW,GAAW,qCAAiB,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;AAEpF,OAAO,CAAC,GAAG,EAAE,CAAC;AACd,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,IAAI,CAAC,gBAAgB,WAAW,EAAE,CAAC,GAAG,KAAK,GAAG,cAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;AACtG,OAAO,CAAC,GAAG,EAAE,CAAC;AAEd,MAAM,WAAW,GAAiC,IAAI,2DAA4B,EAAE,CAAC;AACrF,WAAW,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACpC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport colors from 'colors/safe';\n\nimport { PackageJsonLookup } from '@rushstack/node-core-library';\nimport { TraceImportCommandLineParser } from './TraceImportCommandLineParser';\n\nconst toolVersion: string = PackageJsonLookup.loadOwnPackageJson(__dirname).version;\n\nconsole.log();\nconsole.log(colors.bold(`trace-import ${toolVersion}`) + ' - ' + colors.cyan('https://rushstack.io'));\nconsole.log();\n\nconst commandLine: TraceImportCommandLineParser = new TraceImportCommandLineParser();\ncommandLine.execute().catch((error) => {\n console.error(error);\n});\n"]}
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;AAE3D,uDAAiC;AAEjC,oEAAiE;AACjE,iFAA8E;AAE9E,MAAM,WAAW,GAAW,qCAAiB,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;AAEpF,OAAO,CAAC,GAAG,EAAE,CAAC;AACd,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,IAAI,CAAC,gBAAgB,WAAW,EAAE,CAAC,GAAG,KAAK,GAAG,cAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;AACtG,OAAO,CAAC,GAAG,EAAE,CAAC;AAEd,MAAM,WAAW,GAAiC,IAAI,2DAA4B,EAAE,CAAC;AACrF,WAAW,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACpC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport colors from 'colors/safe';\r\n\r\nimport { PackageJsonLookup } from '@rushstack/node-core-library';\r\nimport { TraceImportCommandLineParser } from './TraceImportCommandLineParser';\r\n\r\nconst toolVersion: string = PackageJsonLookup.loadOwnPackageJson(__dirname).version;\r\n\r\nconsole.log();\r\nconsole.log(colors.bold(`trace-import ${toolVersion}`) + ' - ' + colors.cyan('https://rushstack.io'));\r\nconsole.log();\r\n\r\nconst commandLine: TraceImportCommandLineParser = new TraceImportCommandLineParser();\r\ncommandLine.execute().catch((error) => {\r\n console.error(error);\r\n});\r\n"]}
|
package/lib/traceImport.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traceImport.js","sourceRoot":"","sources":["../src/traceImport.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,oEAMsC;AACtC,uDAAiC;AACjC,2CAA6B;AAC7B,iDAAmC;AACnC,iDAAmC;AAEnC,MAAM,YAAY,GAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAChE,MAAM,YAAY,GAAa,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAUjE,2CAA2C;AAC3C,+BAA+B;AAC/B,+BAA+B;AAC/B,EAAE;AACF,sCAAsC;AACtC,sCAAsC;AACtC,EAAE;AACF,sBAAsB;AACtB,sBAAsB;AACtB,MAAM,uBAAuB,GAAW,oEAAoE,CAAC;AAE7G,SAAS,aAAa,CAAC,KAAa,EAAE,KAAa;IACjD,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,cAAc,CAAC,KAAa,EAAE,KAAa;IAClD,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;AACtD,CAAC;AA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C,YAAY,CAAC,CAAC,CAAC,YAAY;aAC1E,CAAC,CAAC;SACJ;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,sCAAsC,cAAc,EAAE,CAAC,CAAC;SACzE;QAED,cAAc,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;KAC5C;AACH,CAAC;AAED,SAAgB,WAAW,CAAC,OAAwB;IAClD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI;QACF,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;KACrC;YAAS;QACR,IAAI,QAAQ,CAAC,MAAM,EAAE;YACnB,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;gBAC9B,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;aACnD;SACF;KACF;AACH,CAAC;AAZD,kCAYC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport {\n FileSystem,\n type IPackageJson,\n type IParsedPackageName,\n JsonFile,\n PackageName\n} from '@rushstack/node-core-library';\nimport colors from 'colors/safe';\nimport * as path from 'path';\nimport * as process from 'process';\nimport * as Resolve from 'resolve';\n\nconst jsExtensions: string[] = ['.js', '.cjs', '.jsx', '.json'];\nconst tsExtensions: string[] = ['.d.ts', '.ts', '.tsx', '.json'];\n\nexport type ResolutionType = 'cjs' | 'es' | 'ts';\n\ninterface IExecuteOptions {\n importPath: string;\n baseFolder: string | undefined;\n resolutionType: ResolutionType;\n}\n\n// Somewhat loosely matches inputs such as:\n// my-package/path/to/file.js\n// [group 1 ][group 2 ]\n//\n// @scope/my-package/path/to/file.js\n// [group 1 ][group 2 ]\n//\n// @scope/my-package\n// [group 1 ]\nconst packageImportPathRegExp: RegExp = /^((?:@[a-z0-9_][a-z0-9\\-_\\.]*\\/)?[a-z0-9_][a-z0-9\\-_\\.]*)(\\/.*)?$/i;\n\nfunction logInputField(title: string, value: string): void {\n console.log(colors.cyan(title.padEnd(25)) + value);\n}\n\nfunction logOutputField(title: string, value: string): void {\n console.log(colors.green(title.padEnd(25)) + value);\n}\n\nfunction traceTypeScriptPackage(options: {\n packageSubpath: string;\n packageFolder: string;\n packageJson: IPackageJson;\n warnings: string[];\n atTypes?: boolean;\n}): boolean {\n const { packageSubpath, packageFolder, packageJson, atTypes, warnings } = options;\n\n // For example, if we started with importFullPath=\"semver/index\",\n // here we may get normalizedImportFullPath=\"@types/semver/index\"\n const normalizedImportFullPath: string = packageJson.name + packageSubpath;\n\n // First try to resolve the .js main index\n let cjsTargetPath: string | undefined = undefined;\n try {\n cjsTargetPath = Resolve.sync(normalizedImportFullPath, {\n basedir: packageFolder,\n preserveSymlinks: false,\n extensions: jsExtensions\n });\n } catch (error) {\n // not found\n }\n\n const mainIndexTitle: string = atTypes ? '@types main index:' : 'Main index:';\n\n if (cjsTargetPath) {\n const parsedPath: path.ParsedPath = path.parse(cjsTargetPath);\n\n // Is the resolved .js extension okay?\n if (tsExtensions.indexOf(parsedPath.ext.toLocaleLowerCase()) >= 0) {\n logOutputField(mainIndexTitle, '(inferred from .js main index)');\n console.log();\n logOutputField('Target path:', cjsTargetPath);\n return true;\n }\n\n // Try to replace the file extension\n const dtsTargetPath: string = path.join(parsedPath.dir, parsedPath.name + '.d.ts');\n if (FileSystem.exists(dtsTargetPath)) {\n logOutputField(mainIndexTitle, '(inferred from .js entry point)');\n console.log();\n logOutputField('Target path:', dtsTargetPath);\n return true;\n }\n }\n\n if (!packageSubpath) {\n // Try importing the \"types\"/\"typings\" main index:\n\n if (packageJson.types) {\n logOutputField(mainIndexTitle, `\"types\": ${JSON.stringify(packageJson.types)}`);\n console.log();\n logOutputField('Target path:', path.join(packageFolder, packageJson.types));\n return true;\n }\n\n if (packageJson.typings) {\n logOutputField(mainIndexTitle, `\"typings\": ${JSON.stringify(packageJson.typings)}`);\n console.log();\n logOutputField('Target path:', path.join(packageFolder, packageJson.typings));\n return true;\n }\n\n if (atTypes) {\n warnings.push('The @types package does not define \"types\" or \"typings\" field.');\n }\n } else {\n // Try importing the .d.ts file directly\n let dtsTargetPath: string | undefined = undefined;\n try {\n dtsTargetPath = Resolve.sync(normalizedImportFullPath, {\n basedir: packageFolder,\n preserveSymlinks: false,\n extensions: tsExtensions\n });\n } catch (error) {\n // not found\n }\n\n if (dtsTargetPath) {\n console.log();\n logOutputField('Target path:', dtsTargetPath);\n return true;\n }\n }\n\n return false;\n}\n\nfunction traceImportInner(options: IExecuteOptions, warnings: string[]): void {\n let baseFolder: string;\n if (options.baseFolder) {\n baseFolder = path.resolve(options.baseFolder);\n } else {\n baseFolder = process.cwd();\n }\n\n const importFullPath: string = options.importPath.trim();\n if (!importFullPath) {\n throw new Error(`Invalid import path syntax: ${JSON.stringify(importFullPath)}`);\n }\n const match: RegExpExecArray | null = packageImportPathRegExp.exec(importFullPath);\n\n logInputField('Base folder:', baseFolder);\n\n if (match) {\n const importPackageName: string = match[1];\n const packageSubpath: string | undefined = match[2];\n const packageSubpathWithoutSlash: string | undefined = packageSubpath\n ? packageSubpath.substring(1)\n : undefined;\n\n logInputField('Package name:', importPackageName);\n logInputField('Package subpath:', packageSubpathWithoutSlash || '(not specified)');\n\n console.log('\\nResolving...\\n');\n\n // Resolve the NPM package first\n let packageFolder: string | undefined;\n let packageJson: IPackageJson | undefined = undefined;\n {\n let resolvedPackageJsonPath: string | undefined;\n try {\n resolvedPackageJsonPath = Resolve.sync(`${importPackageName}/package.json`, {\n basedir: baseFolder,\n preserveSymlinks: false\n });\n } catch (e) {\n // Could not find NPM package\n }\n\n if (resolvedPackageJsonPath) {\n packageFolder = path.dirname(resolvedPackageJsonPath);\n logOutputField('Package folder:', packageFolder);\n\n packageJson = JsonFile.load(resolvedPackageJsonPath) as IPackageJson;\n logOutputField(\n 'package.json:',\n `${packageJson.name || '(missing name)'} (${packageJson.version || 'missing version'})`\n );\n }\n }\n\n // Also try to resolve the @types package\n let atTypesPackageFolder: string | undefined = undefined;\n let atTypesPackageJson: IPackageJson | undefined = undefined;\n\n if (options.resolutionType === 'ts') {\n if (!importPackageName.startsWith('@types/')) {\n const parsedPackageName: IParsedPackageName = PackageName.parse(importPackageName);\n let atTypesPackageName: string;\n if (parsedPackageName.scope) {\n atTypesPackageName = `@types/${parsedPackageName.scope}__${parsedPackageName.unscopedName}`;\n } else {\n atTypesPackageName = `@types/${parsedPackageName.unscopedName}`;\n }\n\n let atTypesPackageJsonPath: string | undefined;\n try {\n atTypesPackageJsonPath = Resolve.sync(`${atTypesPackageName}/package.json`, {\n basedir: baseFolder,\n preserveSymlinks: false\n });\n } catch (e) {\n // Unable to resolve @types package\n }\n\n if (atTypesPackageJsonPath) {\n atTypesPackageFolder = path.dirname(atTypesPackageJsonPath);\n logOutputField('@types folder:', atTypesPackageFolder);\n\n atTypesPackageJson = JsonFile.load(atTypesPackageJsonPath) as IPackageJson;\n logOutputField(\n '@types package.json:',\n `${atTypesPackageJson.name || '(missing name)'} (${\n atTypesPackageJson.version || 'missing version'\n })`\n );\n }\n }\n }\n\n switch (options.resolutionType) {\n case 'cjs':\n {\n if (!packageFolder || !packageJson) {\n throw new Error(`Cannot find package \"${importPackageName}\" from \"${baseFolder}\".`);\n }\n\n if (!packageSubpath) {\n if (packageJson.main) {\n logOutputField('Main index:', `\"main\": ${JSON.stringify(packageJson.main)}`);\n } else {\n logOutputField('Main index:', '(none)');\n }\n }\n\n let targetPath: string;\n try {\n targetPath = Resolve.sync(importFullPath, {\n basedir: packageFolder,\n preserveSymlinks: false,\n extensions: jsExtensions\n });\n } catch (error) {\n // Are we importing the main index?\n if (packageSubpath) {\n throw new Error(`Unable to resolve the module subpath: ...${packageSubpath}`);\n } else {\n console.log('\\nThis package does not define a main index.');\n return;\n }\n }\n console.log();\n logOutputField('Target path:', targetPath);\n }\n break;\n case 'ts':\n if (!packageFolder || (!packageJson && !atTypesPackageFolder && !atTypesPackageJson)) {\n throw new Error(`Cannot find package \"${importPackageName}\" from \"${baseFolder}\".`);\n }\n\n if (packageFolder && packageJson) {\n if (traceTypeScriptPackage({ packageSubpath, packageFolder, packageJson, warnings })) {\n if (atTypesPackageFolder) {\n warnings.push('An @types package was found but not used.');\n }\n\n return;\n }\n }\n\n if (atTypesPackageFolder && atTypesPackageJson) {\n if (\n traceTypeScriptPackage({\n packageSubpath,\n packageFolder: atTypesPackageFolder,\n packageJson: atTypesPackageJson,\n warnings,\n atTypes: true\n })\n ) {\n return;\n }\n }\n\n throw new Error(`Unable to resolve the module subpath: ...${packageSubpath}`);\n default:\n throw new Error(`The \"${options.resolutionType}\" resolution type is not implemented yet`);\n }\n } else {\n logInputField('Import path:', importFullPath);\n console.log(`\\nThe import path does not appear to reference an NPM package.`);\n console.log('Resolving...\\n');\n\n let targetPath: string;\n try {\n targetPath = Resolve.sync(importFullPath, {\n basedir: baseFolder,\n preserveSymlinks: false,\n extensions: options.resolutionType === 'ts' ? tsExtensions : jsExtensions\n });\n } catch (error) {\n throw new Error(`Unable to resolve the import path: ${importFullPath}`);\n }\n\n logOutputField('Target path:', targetPath);\n }\n}\n\nexport function traceImport(options: IExecuteOptions): void {\n const warnings: string[] = [];\n try {\n traceImportInner(options, warnings);\n } finally {\n if (warnings.length) {\n console.log();\n for (const warning of warnings) {\n console.log(colors.yellow('Warning: ' + warning));\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"traceImport.js","sourceRoot":"","sources":["../src/traceImport.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,oEAMsC;AACtC,uDAAiC;AACjC,2CAA6B;AAC7B,iDAAmC;AACnC,iDAAmC;AAEnC,MAAM,YAAY,GAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAChE,MAAM,YAAY,GAAa,CAAC,OAAO,EAAE,KAAK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CAAC,EACF;wBACA,OAAO;qBACR;iBACF;gBAED,MAAM,IAAI,KAAK,CAAC,4CAA4C,cAAc,EAAE,CAAC,CAAC;YAChF;gBACE,MAAM,IAAI,KAAK,CAAC,QAAQ,OAAO,CAAC,cAAc,0CAA0C,CAAC,CAAC;SAC7F;KACF;SAAM;QACL,aAAa,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC;QAC9E,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAE9B,IAAI,UAAkB,CAAC;QACvB,IAAI;YACF,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;gBACxC,OAAO,EAAE,UAAU;gBACnB,gBAAgB,EAAE,KAAK;gBACvB,UAAU,EAAE,OAAO,CAAC,cAAc,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY;aAC1E,CAAC,CAAC;SACJ;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,sCAAsC,cAAc,EAAE,CAAC,CAAC;SACzE;QAED,cAAc,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;KAC5C;AACH,CAAC;AAED,SAAgB,WAAW,CAAC,OAAwB;IAClD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI;QACF,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;KACrC;YAAS;QACR,IAAI,QAAQ,CAAC,MAAM,EAAE;YACnB,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;gBAC9B,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;aACnD;SACF;KACF;AACH,CAAC;AAZD,kCAYC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport {\r\n FileSystem,\r\n type IPackageJson,\r\n type IParsedPackageName,\r\n JsonFile,\r\n PackageName\r\n} from '@rushstack/node-core-library';\r\nimport colors from 'colors/safe';\r\nimport * as path from 'path';\r\nimport * as process from 'process';\r\nimport * as Resolve from 'resolve';\r\n\r\nconst jsExtensions: string[] = ['.js', '.cjs', '.jsx', '.json'];\r\nconst tsExtensions: string[] = ['.d.ts', '.ts', '.tsx', '.json'];\r\n\r\nexport type ResolutionType = 'cjs' | 'es' | 'ts';\r\n\r\ninterface IExecuteOptions {\r\n importPath: string;\r\n baseFolder: string | undefined;\r\n resolutionType: ResolutionType;\r\n}\r\n\r\n// Somewhat loosely matches inputs such as:\r\n// my-package/path/to/file.js\r\n// [group 1 ][group 2 ]\r\n//\r\n// @scope/my-package/path/to/file.js\r\n// [group 1 ][group 2 ]\r\n//\r\n// @scope/my-package\r\n// [group 1 ]\r\nconst packageImportPathRegExp: RegExp = /^((?:@[a-z0-9_][a-z0-9\\-_\\.]*\\/)?[a-z0-9_][a-z0-9\\-_\\.]*)(\\/.*)?$/i;\r\n\r\nfunction logInputField(title: string, value: string): void {\r\n console.log(colors.cyan(title.padEnd(25)) + value);\r\n}\r\n\r\nfunction logOutputField(title: string, value: string): void {\r\n console.log(colors.green(title.padEnd(25)) + value);\r\n}\r\n\r\nfunction traceTypeScriptPackage(options: {\r\n packageSubpath: string;\r\n packageFolder: string;\r\n packageJson: IPackageJson;\r\n warnings: string[];\r\n atTypes?: boolean;\r\n}): boolean {\r\n const { packageSubpath, packageFolder, packageJson, atTypes, warnings } = options;\r\n\r\n // For example, if we started with importFullPath=\"semver/index\",\r\n // here we may get normalizedImportFullPath=\"@types/semver/index\"\r\n const normalizedImportFullPath: string = packageJson.name + packageSubpath;\r\n\r\n // First try to resolve the .js main index\r\n let cjsTargetPath: string | undefined = undefined;\r\n try {\r\n cjsTargetPath = Resolve.sync(normalizedImportFullPath, {\r\n basedir: packageFolder,\r\n preserveSymlinks: false,\r\n extensions: jsExtensions\r\n });\r\n } catch (error) {\r\n // not found\r\n }\r\n\r\n const mainIndexTitle: string = atTypes ? '@types main index:' : 'Main index:';\r\n\r\n if (cjsTargetPath) {\r\n const parsedPath: path.ParsedPath = path.parse(cjsTargetPath);\r\n\r\n // Is the resolved .js extension okay?\r\n if (tsExtensions.indexOf(parsedPath.ext.toLocaleLowerCase()) >= 0) {\r\n logOutputField(mainIndexTitle, '(inferred from .js main index)');\r\n console.log();\r\n logOutputField('Target path:', cjsTargetPath);\r\n return true;\r\n }\r\n\r\n // Try to replace the file extension\r\n const dtsTargetPath: string = path.join(parsedPath.dir, parsedPath.name + '.d.ts');\r\n if (FileSystem.exists(dtsTargetPath)) {\r\n logOutputField(mainIndexTitle, '(inferred from .js entry point)');\r\n console.log();\r\n logOutputField('Target path:', dtsTargetPath);\r\n return true;\r\n }\r\n }\r\n\r\n if (!packageSubpath) {\r\n // Try importing the \"types\"/\"typings\" main index:\r\n\r\n if (packageJson.types) {\r\n logOutputField(mainIndexTitle, `\"types\": ${JSON.stringify(packageJson.types)}`);\r\n console.log();\r\n logOutputField('Target path:', path.join(packageFolder, packageJson.types));\r\n return true;\r\n }\r\n\r\n if (packageJson.typings) {\r\n logOutputField(mainIndexTitle, `\"typings\": ${JSON.stringify(packageJson.typings)}`);\r\n console.log();\r\n logOutputField('Target path:', path.join(packageFolder, packageJson.typings));\r\n return true;\r\n }\r\n\r\n if (atTypes) {\r\n warnings.push('The @types package does not define \"types\" or \"typings\" field.');\r\n }\r\n } else {\r\n // Try importing the .d.ts file directly\r\n let dtsTargetPath: string | undefined = undefined;\r\n try {\r\n dtsTargetPath = Resolve.sync(normalizedImportFullPath, {\r\n basedir: packageFolder,\r\n preserveSymlinks: false,\r\n extensions: tsExtensions\r\n });\r\n } catch (error) {\r\n // not found\r\n }\r\n\r\n if (dtsTargetPath) {\r\n console.log();\r\n logOutputField('Target path:', dtsTargetPath);\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\nfunction traceImportInner(options: IExecuteOptions, warnings: string[]): void {\r\n let baseFolder: string;\r\n if (options.baseFolder) {\r\n baseFolder = path.resolve(options.baseFolder);\r\n } else {\r\n baseFolder = process.cwd();\r\n }\r\n\r\n const importFullPath: string = options.importPath.trim();\r\n if (!importFullPath) {\r\n throw new Error(`Invalid import path syntax: ${JSON.stringify(importFullPath)}`);\r\n }\r\n const match: RegExpExecArray | null = packageImportPathRegExp.exec(importFullPath);\r\n\r\n logInputField('Base folder:', baseFolder);\r\n\r\n if (match) {\r\n const importPackageName: string = match[1];\r\n const packageSubpath: string | undefined = match[2];\r\n const packageSubpathWithoutSlash: string | undefined = packageSubpath\r\n ? packageSubpath.substring(1)\r\n : undefined;\r\n\r\n logInputField('Package name:', importPackageName);\r\n logInputField('Package subpath:', packageSubpathWithoutSlash || '(not specified)');\r\n\r\n console.log('\\nResolving...\\n');\r\n\r\n // Resolve the NPM package first\r\n let packageFolder: string | undefined;\r\n let packageJson: IPackageJson | undefined = undefined;\r\n {\r\n let resolvedPackageJsonPath: string | undefined;\r\n try {\r\n resolvedPackageJsonPath = Resolve.sync(`${importPackageName}/package.json`, {\r\n basedir: baseFolder,\r\n preserveSymlinks: false\r\n });\r\n } catch (e) {\r\n // Could not find NPM package\r\n }\r\n\r\n if (resolvedPackageJsonPath) {\r\n packageFolder = path.dirname(resolvedPackageJsonPath);\r\n logOutputField('Package folder:', packageFolder);\r\n\r\n packageJson = JsonFile.load(resolvedPackageJsonPath) as IPackageJson;\r\n logOutputField(\r\n 'package.json:',\r\n `${packageJson.name || '(missing name)'} (${packageJson.version || 'missing version'})`\r\n );\r\n }\r\n }\r\n\r\n // Also try to resolve the @types package\r\n let atTypesPackageFolder: string | undefined = undefined;\r\n let atTypesPackageJson: IPackageJson | undefined = undefined;\r\n\r\n if (options.resolutionType === 'ts') {\r\n if (!importPackageName.startsWith('@types/')) {\r\n const parsedPackageName: IParsedPackageName = PackageName.parse(importPackageName);\r\n let atTypesPackageName: string;\r\n if (parsedPackageName.scope) {\r\n atTypesPackageName = `@types/${parsedPackageName.scope}__${parsedPackageName.unscopedName}`;\r\n } else {\r\n atTypesPackageName = `@types/${parsedPackageName.unscopedName}`;\r\n }\r\n\r\n let atTypesPackageJsonPath: string | undefined;\r\n try {\r\n atTypesPackageJsonPath = Resolve.sync(`${atTypesPackageName}/package.json`, {\r\n basedir: baseFolder,\r\n preserveSymlinks: false\r\n });\r\n } catch (e) {\r\n // Unable to resolve @types package\r\n }\r\n\r\n if (atTypesPackageJsonPath) {\r\n atTypesPackageFolder = path.dirname(atTypesPackageJsonPath);\r\n logOutputField('@types folder:', atTypesPackageFolder);\r\n\r\n atTypesPackageJson = JsonFile.load(atTypesPackageJsonPath) as IPackageJson;\r\n logOutputField(\r\n '@types package.json:',\r\n `${atTypesPackageJson.name || '(missing name)'} (${\r\n atTypesPackageJson.version || 'missing version'\r\n })`\r\n );\r\n }\r\n }\r\n }\r\n\r\n switch (options.resolutionType) {\r\n case 'cjs':\r\n {\r\n if (!packageFolder || !packageJson) {\r\n throw new Error(`Cannot find package \"${importPackageName}\" from \"${baseFolder}\".`);\r\n }\r\n\r\n if (!packageSubpath) {\r\n if (packageJson.main) {\r\n logOutputField('Main index:', `\"main\": ${JSON.stringify(packageJson.main)}`);\r\n } else {\r\n logOutputField('Main index:', '(none)');\r\n }\r\n }\r\n\r\n let targetPath: string;\r\n try {\r\n targetPath = Resolve.sync(importFullPath, {\r\n basedir: packageFolder,\r\n preserveSymlinks: false,\r\n extensions: jsExtensions\r\n });\r\n } catch (error) {\r\n // Are we importing the main index?\r\n if (packageSubpath) {\r\n throw new Error(`Unable to resolve the module subpath: ...${packageSubpath}`);\r\n } else {\r\n console.log('\\nThis package does not define a main index.');\r\n return;\r\n }\r\n }\r\n console.log();\r\n logOutputField('Target path:', targetPath);\r\n }\r\n break;\r\n case 'ts':\r\n if (!packageFolder || (!packageJson && !atTypesPackageFolder && !atTypesPackageJson)) {\r\n throw new Error(`Cannot find package \"${importPackageName}\" from \"${baseFolder}\".`);\r\n }\r\n\r\n if (packageFolder && packageJson) {\r\n if (traceTypeScriptPackage({ packageSubpath, packageFolder, packageJson, warnings })) {\r\n if (atTypesPackageFolder) {\r\n warnings.push('An @types package was found but not used.');\r\n }\r\n\r\n return;\r\n }\r\n }\r\n\r\n if (atTypesPackageFolder && atTypesPackageJson) {\r\n if (\r\n traceTypeScriptPackage({\r\n packageSubpath,\r\n packageFolder: atTypesPackageFolder,\r\n packageJson: atTypesPackageJson,\r\n warnings,\r\n atTypes: true\r\n })\r\n ) {\r\n return;\r\n }\r\n }\r\n\r\n throw new Error(`Unable to resolve the module subpath: ...${packageSubpath}`);\r\n default:\r\n throw new Error(`The \"${options.resolutionType}\" resolution type is not implemented yet`);\r\n }\r\n } else {\r\n logInputField('Import path:', importFullPath);\r\n console.log(`\\nThe import path does not appear to reference an NPM package.`);\r\n console.log('Resolving...\\n');\r\n\r\n let targetPath: string;\r\n try {\r\n targetPath = Resolve.sync(importFullPath, {\r\n basedir: baseFolder,\r\n preserveSymlinks: false,\r\n extensions: options.resolutionType === 'ts' ? tsExtensions : jsExtensions\r\n });\r\n } catch (error) {\r\n throw new Error(`Unable to resolve the import path: ${importFullPath}`);\r\n }\r\n\r\n logOutputField('Target path:', targetPath);\r\n }\r\n}\r\n\r\nexport function traceImport(options: IExecuteOptions): void {\r\n const warnings: string[] = [];\r\n try {\r\n traceImportInner(options, warnings);\r\n } finally {\r\n if (warnings.length) {\r\n console.log();\r\n for (const warning of warnings) {\r\n console.log(colors.yellow('Warning: ' + warning));\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/trace-import",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "CLI tool for understanding how require() and \"import\" statements get resolved",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"semver": "~7.5.4",
|
|
18
18
|
"typescript": "~5.0.4",
|
|
19
19
|
"@rushstack/node-core-library": "3.61.0",
|
|
20
|
-
"@rushstack/ts-command-line": "4.
|
|
20
|
+
"@rushstack/ts-command-line": "4.17.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/resolve": "1.20.2",
|
|
24
24
|
"@types/semver": "7.5.0",
|
|
25
|
-
"@rushstack/heft": "0.
|
|
25
|
+
"@rushstack/heft": "0.63.0",
|
|
26
26
|
"local-node-rig": "1.0.0"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|