diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/packages/expo-brownfield/plugin/src/common/filesystem.ts b/packages/expo-brownfield/plugin/src/common/filesystem.ts index dfbcceaeb05b2d..ef944baad6a851 100644 --- a/packages/expo-brownfield/plugin/src/common/filesystem.ts +++ b/packages/expo-brownfield/plugin/src/common/filesystem.ts @@ -25,14 +25,16 @@ const interpolateVariables = (str: string, variables: Record): const maybeReadOverwrittenTemplate = (template: string, platform?: PlatformString): string => { try { accessSync(path.join(process.cwd(), '.brownfield-templates')); + // ⚡ Bolt Optimization: Pass 'utf8' encoding directly to avoid unnecessary intermediate buffer allocation if (existsSync(path.join(process.cwd(), '.brownfield-templates', template))) { - return readFileSync(path.join(process.cwd(), '.brownfield-templates', template)).toString(); + return readFileSync(path.join(process.cwd(), '.brownfield-templates', template), 'utf8'); } if (existsSync(path.join(process.cwd(), '.brownfield-templates', platform ?? '.', template))) { return readFileSync( - path.join(process.cwd(), '.brownfield-templates', platform ?? '.', template) - ).toString(); + path.join(process.cwd(), '.brownfield-templates', platform ?? '.', template), + 'utf8' + ); } // eslint-disable-next-line no-empty } catch {} @@ -55,7 +57,8 @@ const readTemplate = (template: string, platform?: PlatformString): string => { throw new Error(`Template ${template} doesn't exist at ${templatePath}`); } - return readFileSync(templatePath).toString(); + // ⚡ Bolt Optimization: Pass 'utf8' encoding directly to avoid unnecessary intermediate buffer allocation + return readFileSync(templatePath, 'utf8'); }; const createFileFromTemplateInternal = ( diff --git a/packages/pod-install/src/index.ts b/packages/pod-install/src/index.ts index 15184c3f113372..80a7aa50efdec5 100644 --- a/packages/pod-install/src/index.ts +++ b/packages/pod-install/src/index.ts @@ -41,7 +41,8 @@ async function runAsync(maybeProjectDirectory?: string): Promise { process.exit(1); } - const jsonData = JSON.parse(readFileSync(packageJsonPath).toString()); + // ⚡ Bolt Optimization: Use 'utf8' encoding directly in readFileSync to avoid unnecessary memory allocation for the intermediate buffer + const jsonData = JSON.parse(readFileSync(packageJsonPath, 'utf8')); const hasExpoPackage = jsonData.dependencies?.hasOwnProperty('expo'); if (hasExpoPackage) {