Updating universal buffer size#42
Updating universal buffer size#42mayankmahavar1mg merged 9 commits intofeature/hardware_accelerationfrom
Conversation
This PR includes 1. Introduces new lifecycle methods - #24 2. Support for windows - Adds native support for powershell 3. Add document CSS in response for bot agents 4. Support for compiler Introduces a new flag to enable the react compiler ``` // config.json { EXPERIMENTS: { ENABLE_COMPILER: true } } ``` --------- Co-authored-by: utkarsh-1mg <utkarsh.srivastava@1mg.com> Co-authored-by: Mayan Sharma <mayansharma@C02HFD2GQ6L4.local> Co-authored-by: Utkarsh Srivastava <utkarsh.srivastava1306@gmail.com> Co-authored-by: Mayan Sharma <mayansharma@G206F1WHVF.local>
This PR removes the `json` file format from being loaded using the `url-loader` --- --- **DeputyDev generated PR summary:** --- **Size XS:** This PR changes include 2 lines and should take approximately 5-15 minutes to review --- The pull request addresses a fix related to the file format loader in the webpack configuration. Specifically, it removes the `json` file format from the list of files handled by the `url-loader`. This change suggests that JSON files should not be processed by the `url-loader`, which is typically used for loading font files or other binary assets. Here's the change in the code: ```diff - test: /\.(ttf|eot|woff2|json?)$/, + test: /\.(ttf|eot|woff2?)$/, ``` This suggests that the JSON files were mistakenly included in the loader's configuration and are now correctly excluded. --- DeputyDev generated PR summary until 383c56e Co-authored-by: Mayan Sharma <mayansharma@G206F1WHVF.local>
This PR introduces support for typscript --- --- **DeputyDev generated PR summary:** --- **Size L:** This PR changes include 242 lines and should take approximately 1-3 hours to review --- The provided pull request (PR) introduces TypeScript support to the project. Here's a summary of the changes made: 1. **Babel Configuration Updates**: - Added `@babel/preset-typescript` to the Babel presets in various Babel configuration files (`babel.config.js`, `babel.config.client.js`, and `babel.config.ssr.js`). This preset enables Babel to transpile TypeScript code. - Updated `@babel/preset-react` to use the automatic runtime in the Babel configurations. 2. **Package.json Update**: - Added `@babel/preset-typescript` as a dependency to the `package.json` file, ensuring that the necessary preset is available for Babel to process TypeScript files. 3. **Script Modifications**: - In `start.js`, updated the `babel-node` command to include `.ts` and `.tsx` extensions, allowing scripts written in TypeScript to be executed. 4. **Webpack Configuration Changes**: - Updated `base.babel.js` to include `.ts` and `.tsx` file extensions in the `resolve.extensions` array, allowing Webpack to resolve TypeScript files. - Added a new rule in the Webpack configuration to handle `.ts` and `.tsx` files using `babel-loader`, specifying different options for server-side rendering (SSR) and client-side rendering. These changes collectively enable the project to support TypeScript files, allowing developers to write and transpile TypeScript code alongside JavaScript and JSX. --- DeputyDev generated PR summary until 97e9787 --------- Co-authored-by: utkarsh-1mg <utkarsh.srivastava@1mg.com> Co-authored-by: Mayan Sharma <mayansharma@G206F1WHVF.local>
This PR changes the naming scheme for modules created through the
default `utilityVendor` option to include hashes in the name for local
development too, so that modules with same characters with different
casing can co-exist
---
---
**DeputyDev generated PR summary:**
---
**Size XS:** This PR changes include 7 lines and should take
approximately 5-15 minutes to review
---
The pull request titled "Utility vendor common name fix" addresses an
issue in the `development.client.babel.js` file. The primary change
involves modifying how the `moduleFileName` is constructed within a
Webpack configuration. Here's a breakdown of what the change does:
- **Original Code**:
- The `moduleFileName` was being derived by splitting the module
identifier by "/", then using `reduceRight` to get the last segment of
the path. This would typically return the file name or last directory
name.
- **Updated Code**:
- The new approach reverses the array of path segments, takes the first
three elements, and then uses `reduce` to concatenate these segments
into a string with periods `.` as separators. This results in a
`moduleFileName` that includes more of the path structure, potentially
making it more descriptive by including up to three segments of the
path.
This change likely aims to create a more informative or unique
identifier for modules by including more context from the path, which
can be useful for debugging or logging purposes.
Here's the corrective code for the update:
```javascript
const moduleFileName = module
.identifier()
.split("/")
.reverse()
.slice(0, 3)
.reduce((item, current) => {
item = current + "." + item
return item
}, [])
return `npm.${moduleFileName}`
```
This change would make the module naming more consistent and potentially
avoid conflicts by incorporating a broader path context.
---
DeputyDev generated PR summary until
c7ac3bc
---------
Co-authored-by: Mayan Sharma <mayansharma@G206F1WHVF.local>
This PR introduces feature to add a custom react compiler config object to babel --- --- **DeputyDev generated PR summary:** --- **Size M:** This PR changes include 32 lines and should take approximately 30-60 minutes to review --- The pull request titled "Support for react compiler config" introduces several changes aimed at enhancing the configuration and flexibility of the React compiler setup within a project. Here’s a summary of what the PR does: 1. **Babel Configuration Changes**: - The `babel.config.js` file has been simplified by removing the `EXPERIMENTS` check for enabling the `babel-plugin-react-compiler`. The plugin is no longer conditionally added based on environment variables in this configuration. - The `@loadable/babel-plugin` remains as a standard plugin. 2. **Custom Webpack Configuration**: - In both `babel.config.client.js` and `babel.config.ssr.js`, the PR introduces the import of a custom Webpack configuration from `@catalyst/template/webpackConfig.js`. - The React compiler plugin (`babel-plugin-react-compiler`) now uses a custom configuration if available (`customWebpackConfig.reactCompilerConfig`), providing more flexibility and customization options. 3. **Version and Changelog Updates**: - The `package.json` version is updated from `0.0.1-beta.10` to `0.0.1-beta.11`. - The `changelog.md` is updated to include the new version with notes on added support for custom React compiler config, TypeScript, and fixes for JSON import issues and common name module conflicts. Overall, this PR enhances the project's configurability by allowing custom React compiler settings and makes necessary updates to the package version and changelog to reflect these changes. --- DeputyDev generated PR summary until f5a4d26 --------- Co-authored-by: Mayan Sharma <mayansharma@G206F1WHVF.local>
This PR imports `loadScriptsBeforeServerStarts.js` that initiates env variables that can be accessed across the application, before this env vars were not accessible to babel config files --- --- **DeputyDev generated PR summary:** --- **Size XS:** This PR changes include 2 lines and should take approximately 5-15 minutes to review --- The provided Pull Request (PR) makes changes to two JavaScript files used for webpack configurations: `production.client.babel.js` and `production.ssr.babel.js`. The main modification is the addition of an import statement for a script named `loadScriptsBeforeServerStarts.js` in both files. This change suggests that the PR aims to ensure certain scripts are loaded before the server starts, potentially to set up environment variables or other necessary configurations before the webpack build process begins. By importing `loadScriptsBeforeServerStarts.js`, the PR likely addresses the need to initialize or configure some environment-specific settings or scripts that must be executed prior to the server's initialization. If you have specific questions or need further technical discussions about this PR, feel free to ask! --- DeputyDev generated PR summary until 0b5be6d Co-authored-by: Mayan Sharma <mayansharma@G206F1WHVF.local>
…ta1mg/catalyst-core into fix/universal_buffer_size
|
DeputyDev has started reviewing your pull request. |
| cachePattern = jsonObject.optString("cachePattern", ""), | ||
| emulatorName = jsonObject.optString("emulatorName", ""), | ||
| sdkPath = jsonObject.optString("sdkPath", "") | ||
| buildType = properties.getProperty("buildType", "debug"), |
There was a problem hiding this comment.
SECURITY: Configuration values are now being read from properties instead of a JSON object. This change could potentially expose sensitive information if the properties file is not properly secured. Ensure that the properties file is stored securely and not accessible to unauthorized users. Severity: High
// Ensure that the properties file is stored in a secure location
// and implement proper access controls
val secureProperties = SecurePropertiesLoader.load("secure_config.properties")
AndroidConfig(
buildType = secureProperties.getProperty("buildType", "debug"),
cachePattern = secureProperties.getProperty("cachePattern", ""),
emulatorName = secureProperties.getProperty("emulatorName", ""),
sdkPath = secureProperties.getProperty("sdkPath", "")
)
| @@ -1,6 +1,22 @@ | |||
| import customWebpackConfig from "@catalyst/template/webpackConfig.js" | |||
There was a problem hiding this comment.
MAINTAINABILITY: The babel configuration is duplicated in both babel.config.client.js and babel.config.ssr.js. This violates the DRY principle and may lead to maintenance issues in the future.
Create a common babel configuration file and import it in both `babel.config.client.js` and `babel.config.ssr.js`. For example:
// common-babel-config.js
module.exports = {
presets: [
["@babel/preset-typescript", { isTSX: true, allExtensions: true }],
["@babel/preset-env", { targets: { node: "current" } }],
["@babel/preset-react", { runtime: "automatic" }],
],
plugins: ["@loadable/babel-plugin"],
};
// In babel.config.client.js and babel.config.ssr.js
const commonConfig = require('./common-babel-config');
export default {
...commonConfig,
// Add any client or SSR specific configurations here
};
| ["@babel/preset-react", { runtime: "automatic" }], | ||
| ], | ||
| plugins: [ | ||
| ...(isCompilerEnabled ? [["babel-plugin-react-compiler", reactCompilerOptions]] : []), |
There was a problem hiding this comment.
ERROR: The introduction of React Compiler without proper fallback might cause runtime errors if the compiler fails or is not available in certain environments.
// Add a try-catch block to handle potential compiler errors
try {
// ... React Compiler configuration ...
} catch (error) {
console.warn('React Compiler initialization failed:', error);
// Fallback to standard React configuration
}
| }, | ||
| }, | ||
| }, | ||
| splitChunks: customWebpackConfig.splitChunksConfig |
There was a problem hiding this comment.
MAINTAINABILITY: The splitChunks configuration is duplicated in both development.client.babel.js and production.client.babel.js. This violates the DRY principle and may lead to inconsistencies if one file is updated but not the other.
Create a common configuration file for splitChunks and import it in both development and production configs. For example:
// common-split-chunks-config.js
module.exports = {
cacheGroups: {
commonVendor: {
test: /[\\/]node_modules[\\/](react|react-dom|react-redux|react-router|react-router-dom|redux|redux-thunk|axios|react-loadable-visibility|react-helmet-async|react-fast-compare|react-async-script|babel|@loadable\/component|catalyst)[\\/]/,
name: "commonVendor",
minSize: 30000,
},
utilityVendor: {
maxInitialRequests: Infinity,
chunks: "all",
reuseExistingChunk: true,
minRemainingSize: 1000,
test: /[\\/]node_modules[\\/]/,
name(module) {
const moduleFileName = module
.identifier()
.split("node_modules")?.[1]
?.split("/")
.reverse()
.slice(0, 3)
.reduce((item, current) => {
item = current + "." + item
return item
}, [])
return `npm.${moduleFileName}`
},
},
},
};
// In development.client.babel.js and production.client.babel.js
const commonSplitChunksConfig = require('./common-split-chunks-config');
// ...
optimization: {
// ...
splitChunks: customWebpackConfig.splitChunksConfig || commonSplitChunksConfig,
},
| console.log(pc.red("Failed to start server: "), e) | ||
| } | ||
|
|
||
| const safeCall = (fn, ...args) => { |
There was a problem hiding this comment.
ERROR: The modification to error handling in the server renderer (safeCall function) might suppress important errors, making debugging more difficult in production environments.
// Modify the safeCall function to log errors more verbosely
const safeCall = (fn, ...args) => {
try {
if (!fn) return;
if (typeof fn !== "function") {
console.error("Invalid lifecycle method defined in server/index.js");
return;
}
return fn(...args);
} catch (e) {
console.error(`Error in ${fn.name}:`, e);
// Consider re-throwing the error or notifying an error tracking service
}
};
|
DeputyDev has completed a review of your pull request for commit d6b3733. |
DeputyDev generated PR summary:
Size XXL: This PR changes include 1000+ lines and should take approximately 6+ hours to review, potentially spread across multiple sessions
The pull request titled "Updating universal buffer size" involves several changes across multiple files. Here's a summary of the key modifications:
Buffer Size Update:
BufferedInputStreaminWebCacheManager.ktis updated to32 * 1024, which is 32KB. This likely aims to optimize the reading of files from the cache.Configuration and Environment Adjustments:
.eslintrcfile has been reformatted for consistency, and a new rule forreact-compiler/react-compilerhas been added.babel.config.jsonto a newbabel.config.jsfile, introducing TypeScript support with@babel/preset-typescript.package.jsonfile now includes additional dependencies such as@babel/preset-typescript,babel-plugin-react-compiler,cross-env, andreact-compiler-runtime.Codebase Enhancements:
MainActivity.ktfile has been refactored to useproperties.getPropertyinstead ofjsonObject.optStringfor configuration values.utils.jsfile has corrected a prompt string from "CSS pattern" to "Cache pattern".process.cwd()instead ofprocess.env.PWD, making them more cross-platform compatible. Additionally,cross-envis used to set environment variables across different operating systems.start.jsscript now includes handling for Windows platforms usingspawnfor asynchronous command execution.Webpack Configuration:
.tsand.tsxfile extensions.splitChunksconfiguration indevelopment.client.babel.jsandproduction.client.babel.jsnow allows for custom configurations if provided.Error Handling and Lifecycle Methods:
safeCallhave been introduced for safely executing user-defined functions, ensuring errors during execution do not crash the server.onRenderError,onRequestError, etc.) are integrated to allow custom handling of server-side events.This PR improves the codebase by enhancing the configuration, optimizing performance, and increasing cross-platform compatibility. It also adds better error handling and support for TypeScript. The changes seem to align with the title, focusing on improving the buffer size and related configurations.
DeputyDev generated PR summary until d6b3733