Repository navigation
perf: import the types only by import type, and load the conflicter, execa and which-package-manager when used - #875
Merged
Conversation
…execa and which-package-manager when used
- The imports of types only written `import { type A }` kept an import of
their module in the JavaScript emitted by verbatimModuleSyntax: the whole
mem-fs-editor and the conflicter were loaded for a type. They are
`import type`, and @typescript-eslint/no-import-type-side-effects forbids
them.
- The conflicter is imported by the commit, execa and which-package-manager
by an install.
Importing the environment loads 190 modules, 405 before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
import type: five imports of types only were writtenimport { type A } from '…'. WithverbatimModuleSyntax, TypeScript keeps animport {} from '…'of their module in the JavaScript: the whole mem-fs-editor (forMemFsEditorFile) and the conflicter (forConflicterOptions) were loaded for a type. They areimport type, and@typescript-eslint/no-import-type-side-effectsforbids the inline form.commitSharedFsTask, at the commit only.packageManagerInstallTask, at an install only.test/generator-features.tsresets the module mocks once for the file: reset after the first version of the generator, the later ones ran the actual execa, which the install now imports when it runs.Benchmark
Importing
yeoman-environment:Test plan
npm test(eslint, prettier, tsc, the tests), and the tests with 2 and 4 workersimport {} fromleft indist🤖 Generated with Claude Code