catalyst-core 0.0.1-beta.11 → 0.0.1-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Changelog
2
2
 
3
- ## [0.0.1-beta.11] - 21-02-2024
3
+ ## [0.0.1-beta.12] - 06-03-2025
4
+
5
+ - Add support for ESM only packages
6
+
7
+ ## [0.0.1-beta.11] - 21-02-2025
4
8
 
5
9
  - Add support for custom react compiler config
6
10
  - Add support for typescript
@@ -1,3 +1,3 @@
1
1
  "use strict";const path=require("path");const{spawnSync}=require("child_process");const{green,cyan,yellow}=require("picocolors");const{name}=require(`${process.cwd()}/package.json`);const{BUILD_OUTPUT_PATH}=require(`${process.cwd()}/config/config.json`);const{arrayToObject,printBundleInformation}=require("./scriptUtils.js");/**
2
2
  * @description - creates a production build of the application.
3
- */function build(){const isWindows=process.platform==="win32";const commandLineArguments=process.argv.slice(2);const argumentsObject=arrayToObject(commandLineArguments);const dirname=path.resolve(__dirname,"../../");const commands=["node ./dist/scripts/checkVersion",`${isWindows?"rd -r -fo":"rm -rf"} ${process.cwd()}/${BUILD_OUTPUT_PATH} & node ./dist/scripts/loadScriptsBeforeServerStarts.js`,`cross-env APPLICATION=${name||"catalyst_app"} webpack --config ./dist/webpack/production.client.babel.js --progress`,`cross-env APPLICATION=${name||"catalyst_app"} SSR=true webpack --config ./dist/webpack/production.ssr.babel.js`,`cross-env APPLICATION=${name||"catalyst_app"} npx babel ./dist/server --out-dir ${process.cwd()}/${BUILD_OUTPUT_PATH} --ignore '**/*.test.js,./dist/server/renderer/handler.js' --quiet`,`cross-env APPLICATION=${name||"catalyst_app"} npx babel ${process.cwd()}/server --out-dir ${process.cwd()}/${BUILD_OUTPUT_PATH} --quiet`];const command=commands.join(isWindows?" && ":" ; ");console.log("Creating an optimized production build...");const result=spawnSync(command,[],{cwd:dirname,stdio:"inherit",shell:true,env:{...process.env,src_path:process.cwd(),BUILD_OUTPUT_PATH:BUILD_OUTPUT_PATH,NODE_ENV:"production",IS_DEV_COMMAND:false,...argumentsObject}});if(result.error){console.error("Error occurred:",result.error);}else{console.log(green("Compiled successfully."));console.log("\nFile sizes after gzip:\n");printBundleInformation();console.log(`\nThe ${cyan(BUILD_OUTPUT_PATH)} folder is ready to be deployed.`);console.log("You may serve it with a serve command:");console.log(cyan("\n npm run serve"));console.log("\nFind out more about deployment here:");console.log(yellow("\n https://catalyst.1mg.com/public_docs/content/deployment\n"));}}build();
3
+ */function build(){const isWindows=process.platform==="win32";const commandLineArguments=process.argv.slice(2);const argumentsObject=arrayToObject(commandLineArguments);const dirname=path.resolve(__dirname,"../../");const commands=["node ./dist/scripts/checkVersion",`${isWindows?"rd -r -fo":"rm -rf"} ${process.cwd()}/${BUILD_OUTPUT_PATH} & node ./dist/scripts/loadScriptsBeforeServerStarts.js`,`cross-env APPLICATION=${name||"catalyst_app"} webpack --config ./dist/webpack/production.client.babel.js --progress`,`cross-env APPLICATION=${name||"catalyst_app"} SSR=true webpack --config ./dist/webpack/production.ssr.babel.js`,`cross-env APPLICATION=${name||"catalyst_app"} npx babel ./dist/server --out-dir ${process.cwd()}/${BUILD_OUTPUT_PATH} --ignore '**/*.test.js,./dist/server/renderer/handler.js' --quiet`,`cross-env APPLICATION=${name||"catalyst_app"} npx babel ${process.cwd()}/server --out-dir ${process.cwd()}/${BUILD_OUTPUT_PATH} --quiet`];const command=commands.join(isWindows?" && ":" ; ");console.log("Creating an optimized production build...");const result=spawnSync(command,[],{cwd:dirname,stdio:"inherit",shell:true,env:{...process.env,src_path:process.cwd(),BUILD_OUTPUT_PATH:BUILD_OUTPUT_PATH,NODE_ENV:"production",IS_DEV_COMMAND:false,...argumentsObject}});if(result.error){console.error("Error occurred:",result.error);}else{console.log(green("Compiled successfully."));console.log("\nFile sizes after gzip:\n");printBundleInformation();console.log(`\nThe ${cyan(BUILD_OUTPUT_PATH)} folder is ready to be deployed.`);console.log("You may serve it with a serve command:");console.log(cyan("\n npm run serve"));console.log("\nFind out more about deployment here:");console.log(yellow("\n https://catalyst.1mg.com/public_docs/content/Deployment%20and%20Production/deployment\n"));}}build();
@@ -1,3 +1,3 @@
1
1
  "use strict";const path=require("path");const{spawnSync}=require("child_process");const{green,cyan,yellow}=require("picocolors");const{name}=require(`${process.cwd()}/package.json`);const{BUILD_OUTPUT_PATH}=require(`${process.cwd()}/config/config.json`);const{arrayToObject,printBundleInformation}=require("./scriptUtils.js");/**
2
2
  * @description - creates a production build of the application.
3
- */function devBuild(){const isWindows=process.platform==="win32";const commandLineArguments=process.argv.slice(2);const argumentsObject=arrayToObject(commandLineArguments);const dirname=path.resolve(__dirname,"../../");const commands=["node ./dist/scripts/checkVersion",`${isWindows?"rd -r -fo":"rm -rf"} ${process.cwd()}/${BUILD_OUTPUT_PATH} & node ./dist/scripts/loadScriptsBeforeServerStarts.js`,`cross-env APPLICATION=${name||"catalyst_app"} webpack --config ./dist/webpack/production.client.babel.js --progress`,` cross-env APPLICATION=${name||"catalyst_app"} SSR=true webpack --config ./dist/webpack/production.ssr.babel.js`,`cross-env APPLICATION=${name||"catalyst_app"} npx babel ./dist/server --out-dir ${process.cwd()}/${BUILD_OUTPUT_PATH} --ignore '**/*.test.js,./dist/server/renderer/handler.js' --quiet`,`cross-env APPLICATION=${name||"catalyst_app"} npx babel ${process.cwd()}/server --out-dir ${process.cwd()}/${BUILD_OUTPUT_PATH} --quiet`];const command=commands.join(isWindows?" && ":" ; ");console.log("Creating an optimized local build...");const result=spawnSync(command,[],{cwd:dirname,stdio:"inherit",shell:true,env:{...process.env,src_path:process.cwd(),BUILD_OUTPUT_PATH:BUILD_OUTPUT_PATH,NODE_ENV:"production",IS_DEV_COMMAND:true,...argumentsObject}});if(result.error){console.error("Error occurred:",result.error);}else{console.log(green("Compiled successfully."));console.log("\nFile sizes after gzip:\n");printBundleInformation();console.log(`\nThe ${cyan(BUILD_OUTPUT_PATH)} folder is ready to be deployed.`);console.log("You may serve it with a serve command:");console.log(cyan("\n npm run devServe"));console.log("\nFind out more about deployment here:");console.log(yellow("\n https://catalyst.1mg.com/public_docs/content/deployment\n"));}}devBuild();
3
+ */function devBuild(){const isWindows=process.platform==="win32";const commandLineArguments=process.argv.slice(2);const argumentsObject=arrayToObject(commandLineArguments);const dirname=path.resolve(__dirname,"../../");const commands=["node ./dist/scripts/checkVersion",`${isWindows?"rd -r -fo":"rm -rf"} ${process.cwd()}/${BUILD_OUTPUT_PATH} & node ./dist/scripts/loadScriptsBeforeServerStarts.js`,`cross-env APPLICATION=${name||"catalyst_app"} webpack --config ./dist/webpack/production.client.babel.js --progress`,` cross-env APPLICATION=${name||"catalyst_app"} SSR=true webpack --config ./dist/webpack/production.ssr.babel.js`,`cross-env APPLICATION=${name||"catalyst_app"} npx babel ./dist/server --out-dir ${process.cwd()}/${BUILD_OUTPUT_PATH} --ignore '**/*.test.js,./dist/server/renderer/handler.js' --quiet`,`cross-env APPLICATION=${name||"catalyst_app"} npx babel ${process.cwd()}/server --out-dir ${process.cwd()}/${BUILD_OUTPUT_PATH} --quiet`];const command=commands.join(isWindows?" && ":" ; ");console.log("Creating an optimized local build...");const result=spawnSync(command,[],{cwd:dirname,stdio:"inherit",shell:true,env:{...process.env,src_path:process.cwd(),BUILD_OUTPUT_PATH:BUILD_OUTPUT_PATH,NODE_ENV:"production",IS_DEV_COMMAND:true,...argumentsObject}});if(result.error){console.error("Error occurred:",result.error);}else{console.log(green("Compiled successfully."));console.log("\nFile sizes after gzip:\n");printBundleInformation();console.log(`\nThe ${cyan(BUILD_OUTPUT_PATH)} folder is ready to be deployed.`);console.log("You may serve it with a serve command:");console.log(cyan("\n npm run devServe"));console.log("\nFind out more about deployment here:");console.log(yellow("\n https://catalyst.1mg.com/public_docs/content/Deployment%20and%20Production/deployment\n"));}}devBuild();
@@ -1,6 +1,6 @@
1
1
  "use strict";const path=require("path");const{spawnSync,spawn}=require("child_process");const{arrayToObject}=require("./scriptUtils");const{name}=require(`${process.cwd()}/package.json`);const{BUILD_OUTPUT_PATH}=require(`${process.cwd()}/config/config.json`);/**
2
2
  * @description - starts webpack dev server and node server.
3
- */function start(){const isWindows=process.platform==="win32";const commandLineArguments=process.argv.slice(2);const argumentsObject=arrayToObject(commandLineArguments);const dirname=path.resolve(__dirname,"../../");let command=`
3
+ */function start(){const isWindows=process.platform==="win32";const commandLineArguments=process.argv.slice(2);const argumentsObject=arrayToObject(commandLineArguments);const dirname=path.resolve(__dirname,"../../");const command=`
4
4
  node ./dist/scripts/checkVersion
5
5
  npx babel-node -r ./dist/scripts/loadScriptsBeforeServerStarts.js ./dist/webpack/development.client.babel --no-warnings=ExperimentalWarning --no-warnings=BABEL & npx babel-node -r ./dist/scripts/loadScriptsBeforeServerStarts.js ./dist/server/startServer.js --extensions .js,.ts,.jsx,.tsx --watch-path=${process.env.PWD}/server --watch-path=${process.env.PWD}/src --ignore='__IGNORE__' --no-warnings=ExperimentalWarning --no-warnings=BABEL
6
6
  `;if(isWindows){spawn(`node ./dist/scripts/checkVersion && start /b npx babel-node -r ./dist/scripts/loadScriptsBeforeServerStarts.js ./dist/webpack/development.client.babel --no-warnings=ExperimentalWarning --no-warnings=BABEL`,[],{cwd:dirname,stdio:"inherit",shell:true,env:{...process.env,src_path:process.cwd(),NODE_ENV:"development",IS_DEV_COMMAND:false,APPLICATION:name||"catalyst_app",BUILD_OUTPUT_PATH:BUILD_OUTPUT_PATH,...argumentsObject}});spawn(`node ./dist/scripts/checkVersion && npx babel-node -r ./dist/scripts/loadScriptsBeforeServerStarts.js ./dist/server/startServer.js --watch-path=${process.cwd()}/server --watch-path=${process.cwd()}/src --ignore='__IGNORE__' --no-warnings=ExperimentalWarning --no-warnings=BABEL`,[],{cwd:dirname,stdio:"inherit",shell:true,env:{...process.env,src_path:process.cwd(),NODE_ENV:"development",IS_DEV_COMMAND:false,APPLICATION:name||"catalyst_app",BUILD_OUTPUT_PATH:BUILD_OUTPUT_PATH,...argumentsObject}});}else{spawnSync(command,[],{cwd:dirname,stdio:"inherit",shell:true,env:{...process.env,src_path:process.cwd(),NODE_ENV:"development",IS_DEV_COMMAND:false,APPLICATION:name||"catalyst_app",BUILD_OUTPUT_PATH:BUILD_OUTPUT_PATH,...argumentsObject}});}}start();
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _express=_interopRequireDefault(require("express"));var _handler=_interopRequireDefault(require("./handler"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e};}const router=_express.default.Router();router.use(_handler.default);var _default=exports.default=router;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _express=_interopRequireDefault(require("express"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e};}const router=_express.default.Router();if(process.env.NODE_ENV==="production"){const handler=require("./handler").default;router.use(handler);}else{const developmentHandler=require("../../../.catalyst-dev/server/renderer/handler.development.js").default;router.use(developmentHandler);}var _default=exports.default=router;
@@ -1,7 +1,7 @@
1
1
  "use strict";var _fs=_interopRequireDefault(require("fs"));var _path=_interopRequireDefault(require("path"));var _nodeUtil=_interopRequireDefault(require("node:util"));var _chokidar=_interopRequireDefault(require("chokidar"));var _picocolors=require("picocolors");var _index=require("@catalyst/template/server/index.js");var _validator=require("@catalyst/server/utils/validator.js");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e};}const env=process.env.NODE_ENV||"development";// function defined by user which needs to run before server starts
2
2
  (0,_validator.safeCall)(_index.preServerInit);process.on("uncaughtException",(err,origin)=>{console.log(process.stderr.fd);console.log(`Caught exception: ${err}\n`+`Exception origin: ${origin}`);});process.on("SIGINT",function(data){console.log("SIGINT");console.log(data);process.exit(0);});process.on("uncaughtExceptionMonitor",(err,origin)=>{console.log(err,origin);});process.on("message",function(msg){if(msg=="shutdown"){console.log("Closing all connections...");setTimeout(function(){console.log("Finished closing connections");process.exit(0);},1500);}});if(env==="development"){// Add better stack tracing for promises in dev mode
3
- process.on("unhandledRejection",r=>console.debug(r));}const port=process.env.NODE_SERVER_PORT??3005;const host=process.env.NODE_SERVER_HOSTNAME??"localhost";let statsPath=_path.default.join(__dirname,`../../`,"loadable-stats.json");if(env==="production"){statsPath=_path.default.join(process.env.src_path,`${process.env.BUILD_OUTPUT_PATH}/public/loadable-stats.json`);}const watcher=_chokidar.default.watch(statsPath,{persistent:true});let serverInstance=null;const restartServer=()=>{const server=require("./expressServer.js").default;serverInstance=server.listen({port,host});};const startServer=()=>{const server=require("./expressServer.js").default;serverInstance=server.listen({port,host},error=>{const{APPLICATION,NODE_SERVER_HOSTNAME,NODE_SERVER_PORT}=process.env;if(error){console.log("An error occured while starting the Application server : ",error);// function defined by user which needs to run if server fails
4
- (0,_validator.safeCall)(_index.onServerError);return;}if(env==="development")console.log((0,_picocolors.green)("Compiled successfully!"));console.log(`\nYou can now view ${APPLICATION} in the browser.\n`);console.log(_nodeUtil.default.format("\tLocal:".padEnd(8),(0,_picocolors.cyan)(`http://${NODE_SERVER_HOSTNAME}:${NODE_SERVER_PORT}`)));if(env==="development"){console.log("\nNote that the development build is not optimized.");console.log("To create a production build, use "+(0,_picocolors.cyan)("npm run build"));}console.log("\nFind out more about deployment here:");console.log((0,_picocolors.yellow)("\n https://catalyst.1mg.com/public_docs/content/deployment\n"));});};if(_fs.default.existsSync(statsPath)){// if loadable-stats.json exist this block will start the server in development environment. This happens in dev environment when loadable stats already exists and developer is making changes to the files. lodable-stats.json will be updated after every change.
3
+ process.on("unhandledRejection",r=>console.debug(r));}const port=process.env.NODE_SERVER_PORT??3005;const host=process.env.NODE_SERVER_HOSTNAME??"localhost";let statsPath=_path.default.join(__dirname,`../../`,".catalyst-dev","/server","/renderer","handler.development.js");if(env==="production"){statsPath=_path.default.join(process.env.src_path,`${process.env.BUILD_OUTPUT_PATH}/public/loadable-stats.json`);}const watcher=_chokidar.default.watch(statsPath,{persistent:true});let serverInstance=null;const restartServer=()=>{const server=require("./expressServer.js").default;const{APPLICATION,NODE_SERVER_HOSTNAME,NODE_SERVER_PORT}=process.env;serverInstance=server.listen({port,host});console.log("Server Restarted!");console.log(`You can now view ${APPLICATION} in the browser.`);console.log(_nodeUtil.default.format("Local:",(0,_picocolors.cyan)(`http://${NODE_SERVER_HOSTNAME}:${NODE_SERVER_PORT}`)));};const startServer=()=>{const server=require("./expressServer.js").default;serverInstance=server.listen({port,host},error=>{const{APPLICATION,NODE_SERVER_HOSTNAME,NODE_SERVER_PORT}=process.env;if(error){console.log("An error occured while starting the Application server : ",error);// function defined by user which needs to run if server fails
4
+ (0,_validator.safeCall)(_index.onServerError);return;}if(env==="development")console.log((0,_picocolors.green)("Compiled successfully!"));console.log(`\nYou can now view ${APPLICATION} in the browser.\n`);console.log(_nodeUtil.default.format("\tLocal:".padEnd(8),(0,_picocolors.cyan)(`http://${NODE_SERVER_HOSTNAME}:${NODE_SERVER_PORT}`)));if(env==="development"){console.log("\nNote that the development build is not optimized.");console.log("To create a production build, use "+(0,_picocolors.cyan)("npm run build"));}console.log("\nFind out more about deployment here:");console.log((0,_picocolors.yellow)("\n https://catalyst.1mg.com/public_docs/content/Deployment%20and%20Production/deployment\n"));});};if(_fs.default.existsSync(statsPath)){// if loadable-stats.json exist this block will start the server in development environment. This happens in dev environment when loadable stats already exists and developer is making changes to the files. lodable-stats.json will be updated after every change.
5
5
  watcher.on("change",()=>{watcher.close();if(serverInstance){serverInstance.close(()=>startServer());}else{startServer();}});// this block will start the server when your files have been compiled for production and lodable-stats.json exists.
6
6
  watcher.on("add",()=>{if(env==="production"){watcher.close();startServer();}});}else{// this block will start the server in development environment for the first time when loadable-stats.json does not exists.
7
7
  watcher.on("add",()=>{watcher.close();if(serverInstance){serverInstance.close(()=>startServer());}else{startServer();}});}if(_fs.default.existsSync(statsPath)){if(env==="development"){restartServer();}}
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.basePlugins=void 0;var _path=_interopRequireDefault(require("path"));var _webpack=_interopRequireDefault(require("webpack"));var _webpackPlugin=_interopRequireDefault(require("@loadable/webpack-plugin"));var _miniCssExtractPlugin=_interopRequireDefault(require("mini-css-extract-plugin"));var _webpackBundleAnalyzer=require("webpack-bundle-analyzer");var _config=_interopRequireDefault(require("@catalyst/root/config.json"));var _package=require("@catalyst/template/package.json");var _scssParams=require("@catalyst/webpack/scssParams");var _babelConfig=_interopRequireDefault(require("@catalyst/webpack/babel.config.ssr"));var _babelConfig2=_interopRequireDefault(require("@catalyst/webpack/babel.config.client"));var _loadEnvironmentVariables=_interopRequireDefault(require("@catalyst/scripts/loadEnvironmentVariables"));var _config2=require("@catalyst/template/config/config.json");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e};}(0,_loadEnvironmentVariables.default)();const isDev=process.env.NODE_ENV==="development";const isSSR=!!process.env.SSR||false;const basePlugins=exports.basePlugins=[new _webpackPlugin.default({filename:"loadable-stats.json",writeToDisk:{filename:_path.default.join(__dirname,"../..")}}),// **This loads process.env variable during webpack build process
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.basePlugins=void 0;var _path=_interopRequireDefault(require("path"));var _webpack=_interopRequireDefault(require("webpack"));var _miniCssExtractPlugin=_interopRequireDefault(require("mini-css-extract-plugin"));var _webpackBundleAnalyzer=require("webpack-bundle-analyzer");var _config=_interopRequireDefault(require("@catalyst/root/config.json"));var _package=require("@catalyst/template/package.json");var _scssParams=require("@catalyst/webpack/scssParams");var _babelConfig=_interopRequireDefault(require("@catalyst/webpack/babel.config.ssr"));var _babelConfig2=_interopRequireDefault(require("@catalyst/webpack/babel.config.client"));var _loadEnvironmentVariables=_interopRequireDefault(require("@catalyst/scripts/loadEnvironmentVariables"));var _config2=require("@catalyst/template/config/config.json");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e};}(0,_loadEnvironmentVariables.default)();const isDev=process.env.NODE_ENV==="development";const isSSR=!!process.env.SSR||false;const basePlugins=exports.basePlugins=[// **This loads process.env variable during webpack build process
2
2
  new _webpack.default.DefinePlugin({"process.env":([..._config2.CLIENT_ENV_VARIABLES,"BUILD_OUTPUT_PATH","PUBLIC_STATIC_ASSET_PATH","PUBLIC_STATIC_ASSET_URL","src_path","PWD"]||[]).reduce((clientEnvMap,env)=>{clientEnvMap[env]=JSON.stringify(process.env[env]);return clientEnvMap;},{})}),// ** This is used to analyze bundle size.
3
3
  _config2.ANALYZE_BUNDLE&&new _webpackBundleAnalyzer.BundleAnalyzerPlugin({generateStatsFile:_config2.ANALYZE_BUNDLE}),new _webpack.default.IgnorePlugin({resourceRegExp:/^\.\/locale$/,contextRegExp:/moment$/})];const{IS_DEV_COMMAND,PUBLIC_STATIC_ASSET_URL,PUBLIC_STATIC_ASSET_PATH,WEBPACK_DEV_SERVER_HOSTNAME,WEBPACK_DEV_SERVER_PORT,NODE_SERVER_HOSTNAME,NODE_SERVER_PORT}=process.env;let publicPath=isDev?`http://${WEBPACK_DEV_SERVER_HOSTNAME}:${WEBPACK_DEV_SERVER_PORT}/`:`${PUBLIC_STATIC_ASSET_URL}${PUBLIC_STATIC_ASSET_PATH}`;// serves assets from local on running devBuild and devServe command
4
4
  if(IS_DEV_COMMAND==="true"&&!isDev){publicPath=`http://${NODE_SERVER_HOSTNAME}:${NODE_SERVER_PORT}/assets/`;}var _default=exports.default={context:_path.default.resolve(process.env.src_path),mode:isDev?"development":"production",entry:{app:[_path.default.resolve(process.env.src_path,"./client/index.js")]},output:{path:_path.default.join(process.env.src_path,`${process.env.BUILD_OUTPUT_PATH}/public`),filename:process.env.NODE_ENV==="development"?"[name].bundle.js":"[name].[contenthash].js",chunkFilename:process.env.NODE_ENV==="development"?"[name].bundle.js":"[name].[contenthash].js",publicPath:publicPath},resolve:{fallback:{url:require.resolve("url")},extensions:[".js",".jsx",".scss",".ts",".tsx"],alias:Object.keys(_package._moduleAliases||{}).reduce((moduleEnvMap,alias)=>{moduleEnvMap[alias]=_path.default.join(process.env.src_path,..._package._moduleAliases[alias].split("/"));return moduleEnvMap;},{})},plugins:basePlugins,module:{rules:[{test:/\.jsx$|\.js$/,exclude:_path.default.resolve(process.env.src_path,"./node_modules"),use:{loader:"babel-loader",options:isSSR?_babelConfig.default:_babelConfig2.default}},{test:/\.tsx$|\.ts$/,exclude:_path.default.resolve(process.env.src_path,"./node_modules"),use:{loader:"babel-loader",options:isSSR?_babelConfig.default:_babelConfig2.default}},{// This loader processes all the .scss files that should be modularized. This should exclude anything inside node_modules and everything inside src/css/base since they should be globally scoped.
@@ -1,4 +1,19 @@
1
- "use strict";var _webpack=_interopRequireDefault(require("webpack"));var _webpackMerge=_interopRequireDefault(require("webpack-merge"));var _webpackDevServer=_interopRequireDefault(require("webpack-dev-server"));var _miniCssExtractPlugin=_interopRequireDefault(require("mini-css-extract-plugin"));var _reactRefreshWebpackPlugin=_interopRequireDefault(require("@pmmmwh/react-refresh-webpack-plugin"));var _config=_interopRequireDefault(require("@catalyst/root/config.json"));var _baseBabel=_interopRequireDefault(require("@catalyst/webpack/base.babel.js"));var _webpackConfig=_interopRequireDefault(require("@catalyst/template/webpackConfig.js"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e};}const{WEBPACK_DEV_SERVER_PORT,WEBPACK_DEV_SERVER_HOSTNAME}=process.env;const webpackConfig=(0,_webpackMerge.default)(_baseBabel.default,{devtool:"inline-source-map",stats:"none",infrastructureLogging:{level:"none"},plugins:[new _reactRefreshWebpackPlugin.default({overlay:{entry:false}}),new _miniCssExtractPlugin.default({filename:_config.default.cssChunkFileName,ignoreOrder:true}),..._webpackConfig.default.developmentPlugins].filter(Boolean),optimization:{runtimeChunk:"single",moduleIds:"deterministic",splitChunks:_webpackConfig.default.splitChunksConfig?_webpackConfig.default.splitChunksConfig:{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",// minSize: 0, // Enable to replicate stand alone chunking for all packages
1
+ "use strict";var _webpack=_interopRequireDefault(require("webpack"));var _webpackMerge=_interopRequireWildcard(require("webpack-merge"));var _webpackDevServer=_interopRequireDefault(require("webpack-dev-server"));var _webpackPlugin=_interopRequireDefault(require("@loadable/webpack-plugin"));var _miniCssExtractPlugin=_interopRequireDefault(require("mini-css-extract-plugin"));var _reactRefreshWebpackPlugin=_interopRequireDefault(require("@pmmmwh/react-refresh-webpack-plugin"));var _path=_interopRequireDefault(require("path"));var _webpackNodeExternals=_interopRequireDefault(require("webpack-node-externals"));var _appRootPath=_interopRequireDefault(require("app-root-path"));var _registerAliases=require("../scripts/registerAliases.js");var _config=_interopRequireDefault(require("@catalyst/root/config.json"));var _baseBabel=_interopRequireDefault(require("@catalyst/webpack/base.babel.js"));var _webpackConfig=_interopRequireDefault(require("@catalyst/template/webpackConfig.js"));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&{}.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e};}// Import the catalystResultMap for SSR support
2
+ const{WEBPACK_DEV_SERVER_PORT,WEBPACK_DEV_SERVER_HOSTNAME}=process.env;// Create client config
3
+ const webpackClientConfig=(0,_webpackMerge.default)(_baseBabel.default,{devtool:"inline-source-map",stats:"none",infrastructureLogging:{level:"none"},plugins:[new _webpackPlugin.default({filename:"loadable-stats.json",writeToDisk:{filename:_path.default.join(__dirname,"../..")}}),new _reactRefreshWebpackPlugin.default({overlay:{entry:false}}),new _miniCssExtractPlugin.default({filename:_config.default.cssChunkFileName,ignoreOrder:true}),..._webpackConfig.default.developmentPlugins].filter(Boolean),optimization:{runtimeChunk:"single",moduleIds:"deterministic",splitChunks:_webpackConfig.default.splitChunksConfig?_webpackConfig.default.splitChunksConfig:{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",// minSize: 0, // Enable to replicate stand alone chunking for all packages
2
4
  reuseExistingChunk:true,// Disable to replicate stand alone chunking for all packages
3
5
  minRemainingSize:1000,// Disable to replicate stand alone chunking for all packages
4
- 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}`;}}}}}});let devServer=new _webpackDevServer.default({port:WEBPACK_DEV_SERVER_PORT,host:WEBPACK_DEV_SERVER_HOSTNAME,static:{publicPath:webpackConfig.output.publicPath},hot:true,historyApiFallback:true,headers:{"Access-Control-Allow-Origin":"*"},client:{logging:"error",overlay:{errors:false,warnings:false,runtimeErrors:false},reconnect:true}},(0,_webpack.default)(webpackConfig));devServer.startCallback(()=>{console.log("Catalyst is compiling your files.");console.log("Please wait until bundling is finished.\n");});
6
+ 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}`;}}}}}});// Create SSR config
7
+ const webpackSSRConfig=(0,_webpackMerge.mergeWithCustomize)({customizeArray:(0,_webpackMerge.customizeArray)({entry:"replace",optimization:"replace",plugins:"prepend"}),customizeObject:(0,_webpackMerge.customizeObject)({entry:"replace",optimization:"replace",plugins:"prepend"})})(_baseBabel.default,{mode:"development",stats:"none",target:"node",entry:{handler:_path.default.resolve(__dirname,"..","./server/renderer/handler.js")},externals:[/\.(html|png|gif|jpg)$/,(0,_webpackNodeExternals.default)({modulesDir:_path.default.resolve(process.env.src_path,"./node_modules"),allowlist:_webpackConfig.default.transpileModules?_webpackConfig.default.transpileModules:[]}),(0,_webpackNodeExternals.default)({modulesDir:_path.default.join(_appRootPath.default.path,"./node_modules"),allowlist:_webpackConfig.default.transpileModules?_webpackConfig.default.transpileModules:[]})],resolve:{alias:_registerAliases.catalystResultMap},output:{path:_path.default.join(__dirname,"../..",".catalyst-dev","/server","/renderer"),chunkFilename:_config.default.chunkFileName,filename:"handler.development.js",libraryTarget:"commonjs"},plugins:[new _webpackPlugin.default({filename:"loadable-stats.json",writeToDisk:{filename:_path.default.join(__dirname,"../..",".catalyst-dev","/server","/renderer")}}),new _miniCssExtractPlugin.default({filename:_config.default.cssChunkFileName,ignoreOrder:true}),..._webpackConfig.default.ssrPlugins].filter(Boolean)});// Create separate compiler for SSR that writes to disk
8
+ const ssrCompiler=(0,_webpack.default)(webpackSSRConfig);const watchInstance=ssrCompiler.watch({},err=>{if(err){console.error(err);return;}});// Create dev server for client-side only
9
+ let devServer=new _webpackDevServer.default({port:WEBPACK_DEV_SERVER_PORT,host:WEBPACK_DEV_SERVER_HOSTNAME,static:{publicPath:webpackClientConfig.output.publicPath},hot:true,historyApiFallback:true,headers:{"Access-Control-Allow-Origin":"*"},client:{logging:"error",overlay:{errors:false,warnings:false,runtimeErrors:false},reconnect:true}},(0,_webpack.default)(webpackClientConfig));devServer.startCallback(()=>{console.log("Catalyst is compiling your files.");console.log("Please wait until bundling is finished.\n");});// Cleanup on exit
10
+ const cleanup=()=>{// Close webpack watch
11
+ watchInstance.close(()=>{// Delete the development handler file
12
+ try{// Delete the file
13
+ require("fs").unlinkSync(_path.default.join(__dirname,"../..",".catalyst-dev","/server","/renderer","handler.development.js"));// Try to remove the renderer directory
14
+ require("fs").rmdirSync(_path.default.join(process.env.src_path,".catalyst-dev","/renderer"));// Try to remove the parent directory
15
+ require("fs").rmdirSync(_path.default.join(process.env.src_path,".catalyst-dev"));}catch(err){// Ignore errors during cleanup
16
+ }process.exit();});};// Handle various ways the process might exit
17
+ process.on("SIGINT",cleanup);// Ctrl+C
18
+ process.on("SIGTERM",cleanup);// kill
19
+ process.on("exit",cleanup);// normal exit
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _registerAliases2=require("../scripts/registerAliases.js");require("../scripts/loadScriptsBeforeServerStarts.js");var _miniCssExtractPlugin=_interopRequireDefault(require("mini-css-extract-plugin"));var _webpackMerge=require("webpack-merge");var _base=_interopRequireDefault(require("@catalyst/webpack/base.babel"));var _config=_interopRequireDefault(require("@catalyst/root/config.json"));var _webpackConfig=_interopRequireDefault(require("@catalyst/template/webpackConfig.js"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e};}/* eslint-disable */const clientConfig=(0,_webpackMerge.mergeWithCustomize)({customizeArray:(0,_webpackMerge.customizeArray)({entry:"prepend",plugins:"append",module:"prepend"}),customizeObject:(0,_webpackMerge.customizeObject)({entry:"prepend",plugins:"append",module:"prepend"})})(_base.default,{mode:"production",stats:"errors-only",resolve:{alias:_registerAliases2.catalystResultMap},optimization:{runtimeChunk:"single",moduleIds:"deterministic",splitChunks:_webpackConfig.default.splitChunksConfig?_webpackConfig.default.splitChunksConfig:{cacheGroups:{commonVendor:{chunks:"all",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:400000,maxSize:400000},utilityVendor:{maxInitialRequests:Infinity,chunks:"all",// minSize: 0, // Enable to replicate stand alone chunking for all packages
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _registerAliases2=require("../scripts/registerAliases.js");require("../scripts/loadScriptsBeforeServerStarts.js");var _path=_interopRequireDefault(require("path"));var _webpackPlugin=_interopRequireDefault(require("@loadable/webpack-plugin"));var _miniCssExtractPlugin=_interopRequireDefault(require("mini-css-extract-plugin"));var _webpackMerge=require("webpack-merge");var _base=_interopRequireDefault(require("@catalyst/webpack/base.babel"));var _config=_interopRequireDefault(require("@catalyst/root/config.json"));var _webpackConfig=_interopRequireDefault(require("@catalyst/template/webpackConfig.js"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e};}/* eslint-disable */const clientConfig=(0,_webpackMerge.mergeWithCustomize)({customizeArray:(0,_webpackMerge.customizeArray)({entry:"prepend",plugins:"append",module:"prepend"}),customizeObject:(0,_webpackMerge.customizeObject)({entry:"prepend",plugins:"append",module:"prepend"})})(_base.default,{mode:"production",stats:"errors-only",resolve:{alias:_registerAliases2.catalystResultMap},optimization:{runtimeChunk:"single",moduleIds:"deterministic",splitChunks:_webpackConfig.default.splitChunksConfig?_webpackConfig.default.splitChunksConfig:{cacheGroups:{commonVendor:{chunks:"all",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:400000,maxSize:400000},utilityVendor:{maxInitialRequests:Infinity,chunks:"all",// minSize: 0, // Enable to replicate stand alone chunking for all packages
2
2
  reuseExistingChunk:true,// Disable to replicate stand alone chunking for all packages
3
3
  minRemainingSize:1000,// Disable to replicate stand alone chunking for all packages
4
- minSize:1000,maxSize:120000,test:/[\\/]node_modules[\\/]/,name(module){const moduleFileName=module.identifier().split("/").reverse().slice(0,3).reduce((item,current)=>{item=current+"."+item;return item;},[]);return`npm.${moduleFileName}`;}}},chunks:"all",name(module){const moduleFileName=module.identifier().split("/").reverse().slice(0,3).reduce((item,current)=>{item=current+"."+item;return item;},[]);return`npm.${moduleFileName}`;}}},plugins:[new _miniCssExtractPlugin.default({filename:_config.default.cssChunkFileName,ignoreOrder:true}),..._webpackConfig.default.clientPlugins]});var _default=exports.default=clientConfig;
4
+ minSize:1000,maxSize:120000,test:/[\\/]node_modules[\\/]/,name(module){const moduleFileName=module.identifier().split("/").reverse().slice(0,3).reduce((item,current)=>{item=current+"."+item;return item;},[]);return`npm.${moduleFileName}`;}}},chunks:"all",name(module){const moduleFileName=module.identifier().split("/").reverse().slice(0,3).reduce((item,current)=>{item=current+"."+item;return item;},[]);return`npm.${moduleFileName}`;}}},plugins:[new _webpackPlugin.default({filename:"loadable-stats.json",writeToDisk:{filename:_path.default.join(__dirname,"../..")}}),new _miniCssExtractPlugin.default({filename:_config.default.cssChunkFileName,ignoreOrder:true}),..._webpackConfig.default.clientPlugins]});var _default=exports.default=clientConfig;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _registerAliases2=require("../scripts/registerAliases.js");require("../scripts/loadScriptsBeforeServerStarts.js");var _path=_interopRequireDefault(require("path"));var _webpackNodeExternals=_interopRequireDefault(require("webpack-node-externals"));var _appRootPath=_interopRequireDefault(require("app-root-path"));var _base=_interopRequireDefault(require("@catalyst/webpack/base.babel"));var _config=_interopRequireDefault(require("@catalyst/root/config.json"));var _webpackConfig=_interopRequireDefault(require("@catalyst/template/webpackConfig.js"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e};}/* eslint-disable */const{mergeWithCustomize,customizeArray,customizeObject}=require("webpack-merge");const ssrConfig=mergeWithCustomize({customizeArray:customizeArray({entry:"replace",optimization:"replace",plugins:"prepend"}),customizeObject:customizeObject({entry:"replace",optimization:"replace",plugins:"prepend"})})(_base.default,{mode:"production",stats:"errors-only",optimization:{splitChunks:{chunks:"all",minSize:10000000,name:false}},resolve:{alias:_registerAliases2.catalystResultMap},plugins:[..._webpackConfig.default.ssrPlugins],target:"node",entry:{handler:_path.default.resolve(__dirname,"..","./server/renderer/handler.js")},externals:[// images are handled by isomorphic webpack.
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _registerAliases2=require("../scripts/registerAliases.js");require("../scripts/loadScriptsBeforeServerStarts.js");var _path=_interopRequireDefault(require("path"));var _webpackNodeExternals=_interopRequireDefault(require("webpack-node-externals"));var _webpackPlugin=_interopRequireDefault(require("@loadable/webpack-plugin"));var _appRootPath=_interopRequireDefault(require("app-root-path"));var _base=_interopRequireDefault(require("@catalyst/webpack/base.babel"));var _config=_interopRequireDefault(require("@catalyst/root/config.json"));var _webpackConfig=_interopRequireDefault(require("@catalyst/template/webpackConfig.js"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e};}/* eslint-disable */const{mergeWithCustomize,customizeArray,customizeObject}=require("webpack-merge");const ssrConfig=mergeWithCustomize({customizeArray:customizeArray({entry:"replace",optimization:"replace",plugins:"prepend"}),customizeObject:customizeObject({entry:"replace",optimization:"replace",plugins:"prepend"})})(_base.default,{mode:"production",stats:"errors-only",optimization:{splitChunks:{chunks:"all",minSize:10000000,name:false}},resolve:{alias:_registerAliases2.catalystResultMap},plugins:[..._webpackConfig.default.ssrPlugins,new _webpackPlugin.default({filename:"loadable-stats.json",writeToDisk:{filename:_path.default.join(__dirname,"../..")}})],target:"node",entry:{handler:_path.default.resolve(__dirname,"..","./server/renderer/handler.js")},externals:[// images are handled by isomorphic webpack.
2
2
  // html files are required directly
3
3
  /\.(html|png|gif|jpg)$/,// treat all node modules as external to keep this bundle small
4
- (0,_webpackNodeExternals.default)({modulesDir:_path.default.resolve(process.env.src_path,"./node_modules")}),(0,_webpackNodeExternals.default)({modulesDir:_path.default.join(_appRootPath.default.path,"./node_modules")})],output:{path:_path.default.join(process.env.src_path,process.env.BUILD_OUTPUT_PATH,"/renderer"),chunkFilename:_config.default.chunkFileNameProd,filename:"handler.js",libraryTarget:"commonjs"}});var _default=exports.default=ssrConfig;
4
+ (0,_webpackNodeExternals.default)({modulesDir:_path.default.resolve(process.env.src_path,"./node_modules"),allowlist:_webpackConfig.default.transpileModules?_webpackConfig.default.transpileModules:[]}),(0,_webpackNodeExternals.default)({modulesDir:_path.default.join(_appRootPath.default.path,"./node_modules"),allowlist:_webpackConfig.default.transpileModules?_webpackConfig.default.transpileModules:[]})],output:{path:_path.default.join(process.env.src_path,process.env.BUILD_OUTPUT_PATH,"/renderer"),chunkFilename:_config.default.chunkFileNameProd,filename:"handler.js",libraryTarget:"commonjs"}});var _default=exports.default=ssrConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catalyst-core",
3
- "version": "0.0.1-beta.11",
3
+ "version": "0.0.1-beta.12",
4
4
  "main": "index.js",
5
5
  "description": "Web framework that provides great performance out of the box",
6
6
  "bin": {
package/run.sh CHANGED
@@ -1,3 +1,3 @@
1
1
  npm run prepare
2
- rm -rf ../1mg_web/mweb/node_modules/catalyst-core/dist
3
- mv dist ../1mg_web/mweb/node_modules/catalyst-core/
2
+ rm -rf ../demo-apps/cca-basic/node_modules/catalyst-core/dist
3
+ mv dist ../demo-apps/cca-basic/node_modules/catalyst-core/