Skip to content

perf: convert synchronous fs calls to async in production code#7288

Draft
alfonso-noriega wants to merge 1 commit into05-reduce-unsafe-any-castsfrom
06-async-fs-calls
Draft

perf: convert synchronous fs calls to async in production code#7288
alfonso-noriega wants to merge 1 commit into05-reduce-unsafe-any-castsfrom
06-async-fs-calls

Conversation

@alfonso-noriega
Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Fixes #0000

WHAT is this pull request doing?

How to test your changes?

Post-release steps

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing, so I've added a changelog entry with pnpm changeset add

Replaced blocking synchronous filesystem calls with async equivalents:

- getTomls.ts: readdirSync → readdir (from cli-kit)
- locales-configuration.ts: fs.statSync → fileSize, fs.readFileSync → readFile

These sync calls block the Node.js event loop during app loading and
extension bundling. The async versions allow other I/O to proceed
concurrently, improving CLI responsiveness.
Copy link
Copy Markdown
Contributor Author

alfonso-noriega commented Apr 14, 2026

@github-actions
Copy link
Copy Markdown
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/common/object.d.ts
@@ -84,4 +84,12 @@ export declare function isEmpty(object: object): boolean;
  * @param object - The object whose undefined will be deleted.
  * @returns A copy of the object with the undefined elements deleted.
  */
-export declare function compact(object: object): object;
\ No newline at end of file
+export declare function compact(object: object): object;
+/**
+ * Recursively removes properties with  values from an object.
+ * Arrays are traversed but not filtered. Non-object values are returned as-is.
+ *
+ * @param value - The value to strip undefined fields from.
+ * @returns A deep copy of the value with all undefined-valued keys removed.
+ */
+export declare function deepStripUndefined<T>(value: T): T;
\ No newline at end of file
packages/cli-kit/dist/public/node/node-package-manager.d.ts
@@ -60,10 +60,6 @@ export declare class FindUpAndReadPackageJsonNotFoundError extends BugError {
 export declare function packageManagerFromUserAgent(env?: NodeJS.ProcessEnv): PackageManager;
 /**
  * Returns the dependency manager used in a directory.
- * Walks upward from  so workspace packages (e.g. )
- * still resolve to the repo root lockfile ().
- * If no lockfile is found, it falls back to the package manager from the user agent.
- * If the package manager from the user agent is unknown, it returns 'npm'.
  * @param fromDirectory - The starting directory
  * @returns The dependency manager
  */
packages/cli-kit/dist/public/node/upgrade.d.ts
@@ -28,14 +28,11 @@ export declare function versionToAutoUpgrade(): string | undefined;
 export declare function warnIfUpgradeAvailable(): Promise<void>;
 /**
  * Generates a message to remind the user to update the CLI.
- * For major version bumps, appends a link to the GitHub release notes so users
- * can review breaking changes before deciding to upgrade.
  *
  * @param version - The version to update to.
- * @param isMajor - Whether the version bump is a major version change.
  * @returns The message to remind the user to update the CLI.
  */
-export declare function getOutputUpdateCLIReminder(version: string, isMajor?: boolean): string;
+export declare function getOutputUpdateCLIReminder(version: string): string;
 /**
  * Prompts the user to enable or disable automatic upgrades, then persists their choice.
  *
packages/cli-kit/dist/private/node/ui/components/DangerousConfirmationPrompt.d.ts
@@ -1,4 +1,3 @@
-import { InlineToken, TokenItem } from './TokenizedText.js';
 import { InfoTableProps } from './Prompts/InfoTable.js';
 import { AbortSignal } from '../../../../public/node/abort.js';
 import { FunctionComponent } from 'react';
@@ -6,7 +5,6 @@ export interface DangerousConfirmationPromptProps {
     message: string;
     confirmation: string;
     infoTable?: InfoTableProps['table'];
-    warningItem?: TokenItem<InlineToken>;
     onSubmit: (value: boolean) => void;
     abortSignal?: AbortSignal;
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant