-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile files and directories whose names start with .
#1164
Draft
mrm007
wants to merge
4
commits into
main
Choose a base branch
from
vocab-dirs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'skuba': patch | ||
--- | ||
|
||
build: When using esbuild, ensure files and directories whose names start with . are also compiled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
{ | ||
"exclude": ["**/__mocks__/**/*", "**/*.test.ts", "src/testing/**/*"], | ||
"extends": "./tsconfig.json", | ||
"include": ["src/**/*"] | ||
"include": [ | ||
"src/**/*", | ||
// Must be explicit about including dotfiles otherwise TypeScript ignores them | ||
// https://github.com/microsoft/TypeScript/blob/v5.0.4/src/compiler/utilities.ts#L8828-L8830 | ||
"src/**/.*", | ||
"src/**/.*/**/*", | ||
"src/**/.*/**/.*" | ||
] | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for finding this @mrm007. I recall you first mentioned that this affected our
esbuild
implementation; does it affecttsc
too?If it's
esbuild
only then I'm hoping we can add some adapter logic to deal with this under the hood.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strangely, it's only for esbuild. Running
tsc
via the command line finds and compiles all files, as expected.The filter is applied only when resolving the config programmatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay wow, this is a great find. It comes down to this and is actually a deeper bug with the
esbuild
implementation:skuba/src/cli/build/esbuild.ts
Lines 68 to 82 in 3196eb1
The TypeScript API does not include dot paths when deriving
fileNames
and this holds true fortsc
internally. However,tsc
performs module resolution and will subsequently include files like.vocab/index.ts
only if they have been imported by another module infileNames
. On the other hand, ouresbuild
adapter disables bundling and ends up classifying files like.vocab/index.ts
as "external" dependencies that should not be included.There are a few options here:
tsconfig.json#include
as per this PR. This is simple but feels like a rather arcane fix.fileNames
in theesbuild
adapter that includes dot paths by default. This would let us play nicely with Vocab but won't promise to match the TypeScript implementation.metafile
out ofesbuild
and identify imports that should be included in a second pass.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we do the globbing ourselves and include all the dotfiles? Basically, applying the same technique mentioned here #1163 (comment):
skuba.entryPoint
i.e.src
forsrc/index.ts
*.{ts,tsx,cts,mts}
filesSomething like this
2c96e5b
(#1164)