Commit 19656b8
authored
feat: support tsconfig paths and package-relative imports [sc-22644] (#1006)
* feat: async dependency collector
* refactor: switch to a sync implementation to avoid changes to constructs
* refactor: remove unnecessary try/catch
* feat: look up original TS sources when dealing with folders as modules
* fix: include package.json when resolving module folders
* feat: let parser know how tsconfig paths were resolved for a file
This optionally allows the parser to massage the file structure into an
alternate output format.
* feat: add jsconfig.json support
* fix: supported module check was accidentally negated
* feat: bundle relevant tsconfig/jsconfig.json files
These files are currently not utilized by the backend but they might be
in the near future.
* feat: cache all source files and set up unique IDs for later dedup purposes
* feat: add tests for tsconfig behavior
* feat: more complete support for imports with extensions
* chore: remove unused code
* fix: remove mistakenly implemented useless package-relative path support
* fix: remove unused variable
* fix: remove unused variable
* feat: cache common dependencies within a Session
Shares a common Parser (or Parsers, one per runtime) within a Session and
avoids unnecessary AST walks for filePaths the parser has already seen when
parsing other entrypoints.
Share PackageFilesResolver so that its file caches can be shared within the
same Parser (which is now also shared within the Session), and cache
its result per filePath to avoid duplicate work.
Helps use cases where there are multiple entrypoints that share
common libraries.
* fix: remove allowImportingTsExtensions support
Does not play well during a nested lookup when we're looking up a path that
we've already resolved to a candidate with a .ts extension earlier in the
process. Not a super useful feature anyway.
* chore: empty out package-lock.json in fixtures, keep file
* feat: support `index.json` which apparently works1 parent 5dbc83f commit 19656b8
File tree
48 files changed
+1400
-111
lines changed- packages/cli/src
- constructs
- services/check-parser
- __tests__
- check-parser-fixtures
- import-js-from-ts
- no-import-ts-from-js
- tsconfig-allow-importing-ts-extensions
- src
- tsconfig-paths-sample-project
- lib1
- folder
- lib2
- lib3
- foo
- src
- tsconfig-paths-unused
- src
- package-files
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
48 files changed
+1400
-111
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
352 | 351 | | |
353 | 352 | | |
354 | 353 | | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
| 354 | + | |
359 | 355 | | |
360 | 356 | | |
361 | 357 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
119 | 118 | | |
120 | 119 | | |
121 | 120 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 121 | + | |
126 | 122 | | |
127 | 123 | | |
128 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 106 | + | |
111 | 107 | | |
112 | 108 | | |
113 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
| 151 | + | |
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
| |||
191 | 193 | | |
192 | 194 | | |
193 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
194 | 212 | | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments