dsherret / dsherret/ts-morph

Asynchronous `addSourceFilesAtPaths` and other methods

Open
#759 1 comment 0 reactions 0 assignees View on GitHub
breaking change enhancement
Dominant language
TypeScript
Stars
6.2k
Forks
238
Avg merge
2m
Merged PRs (30d)
1

Description

Right now the methods for adding sources files from the file system are synchronous and the ones for writing back to the file system are asynchronous by default (with sync api available via `-Sync` methods).

This was done because the compiler api reads from the file system synchronously. That said, methods like `addSourceFilesAtPaths`, `addSourceFileAtPath`, etc... could all be asynchronous. `addSourceFilesAtPaths` in particular could get a huge performance boost by parallelizing the work.

The existing api would be moved to `-Sync` methods. For example, `addSourceFilesAtPaths` would become `addSourceFilesAtPathsSync` and then be replaced with an asynchronous `addSourceFilesAtPaths`. The downside to this change is that if someone doesn't read the breaking changes doc and is not inspecting the return value, then they might not notice this has become asynchronous.

Relates to #702.

Contributor guide

Open the contributing guide

Research direction

Start with addSourceFilesAtPaths, addSourceFileAtPath, and the other filesystem source methods described here, then review related issue #702 and the breaking changes documentation. Done means the affected synchronous methods have corresponding -Sync APIs and asynchronous replacements, with the parallelization and compatibility consequences resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.