catalyst-core-internal 0.0.1-beta.9 โ 0.0.1
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/README.md +16 -119
- package/babel.config.js +32 -0
- package/bin/catalyst.js +92 -12
- package/changelog.md +129 -0
- package/dist/caching.js +1 -0
- package/dist/index.js +1 -0
- package/dist/logger.js +10 -0
- package/dist/native/androidProject/app/build.gradle.kts +414 -0
- package/dist/native/androidProject/app/proguard-rules.pro +67 -0
- package/dist/native/androidProject/app/src/debug/res/xml/network_security_config.xml +8 -0
- package/dist/native/androidProject/app/src/main/AndroidManifest.xml +54 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/BridgeMessageValidator.kt +560 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/CatalystConstants.kt +106 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/CustomWebview.kt +1013 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/MainActivity.kt +517 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/MetricsMonitor.kt +341 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/NativeBridge.kt +931 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/SplashActivity.kt +111 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/Utils.kt +129 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/WebCacheManager.kt +450 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/BridgeUtils.kt +239 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/CameraUtils.kt +269 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/DeviceInfoUtils.kt +73 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/DownloadUtils.kt +272 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/FileSizeRouterUtils.kt +347 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/FileUtils.kt +335 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/FrameworkServerUtils.kt +411 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/IntentUtils.kt +299 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/KeyboardUtil.kt +82 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/NetworkUtils.kt +105 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/NotificationConstants.kt +28 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/NotificationUtils.kt +639 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/SafeAreaUtils.kt +62 -0
- package/dist/native/androidProject/app/src/main/res/drawable/ic_launcher_background.xml +170 -0
- package/dist/native/androidProject/app/src/main/res/drawable/ic_launcher_foreground.xml +30 -0
- package/dist/native/androidProject/app/src/main/res/drawable/splashscreen_fallback.png +0 -0
- package/dist/native/androidProject/app/src/main/res/layout/activity_main.xml +29 -0
- package/dist/native/androidProject/app/src/main/res/layout/activity_splash.xml +20 -0
- package/dist/native/androidProject/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +6 -0
- package/dist/native/androidProject/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +6 -0
- package/dist/native/androidProject/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
- package/dist/native/androidProject/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
- package/dist/native/androidProject/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
- package/dist/native/androidProject/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
- package/dist/native/androidProject/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
- package/dist/native/androidProject/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
- package/dist/native/androidProject/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
- package/dist/native/androidProject/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
- package/dist/native/androidProject/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
- package/dist/native/androidProject/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
- package/dist/native/androidProject/app/src/main/res/values/colors.xml +10 -0
- package/dist/native/androidProject/app/src/main/res/values/strings.xml +3 -0
- package/dist/native/androidProject/app/src/main/res/values/themes.xml +26 -0
- package/dist/native/androidProject/app/src/main/res/values-night/themes.xml +26 -0
- package/dist/native/androidProject/app/src/main/res/xml/backup_rules.xml +13 -0
- package/dist/native/androidProject/app/src/main/res/xml/data_extraction_rules.xml +19 -0
- package/dist/native/androidProject/app/src/main/res/xml/file_paths.xml +18 -0
- package/dist/native/androidProject/app/src/main/res/xml/network_security_config.xml +12 -0
- package/dist/native/androidProject/app/src/noFcm/java/io/yourname/androidproject/utils/NotificationManager.kt +158 -0
- package/dist/native/androidProject/app/src/noFcm/java/io/yourname/androidproject/utils/PushNotificationUtils.kt +94 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/BridgeMessageValidatorTest.kt +267 -0
- package/dist/native/androidProject/app/src/withFcm/java/io/yourname/androidproject/utils/NotificationManager.kt +224 -0
- package/dist/native/androidProject/app/src/withFcm/java/io/yourname/androidproject/utils/PushNotificationUtils.kt +399 -0
- package/dist/native/androidProject/build.gradle.kts +11 -0
- package/dist/native/androidProject/gradle/libs.versions.toml +28 -0
- package/dist/native/androidProject/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/dist/native/androidProject/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/dist/native/androidProject/gradle.properties +23 -0
- package/dist/native/androidProject/gradlew +185 -0
- package/dist/native/androidProject/gradlew.bat +89 -0
- package/dist/native/androidProject/keystore/Untitled +0 -0
- package/dist/native/androidProject/keystore/release-key.jks +0 -0
- package/dist/native/androidProject/settings.gradle.kts +35 -0
- package/dist/native/androidSetup.js +8 -0
- package/dist/native/assets/catalyst.png +0 -0
- package/dist/native/bridge/WebBridge.js +59 -0
- package/dist/native/bridge/constants/NativeInterfaces.js +37 -0
- package/dist/native/bridge/errors.js +39 -0
- package/dist/native/bridge/hooks.js +107 -0
- package/dist/native/bridge/safeArea.js +5 -0
- package/dist/native/bridge/standardizedHooks.js +98 -0
- package/dist/native/bridge/useBaseHook.js +43 -0
- package/dist/native/bridge/utils/CameraUtils.js +58 -0
- package/dist/native/bridge/utils/FileObjectConverter.js +40 -0
- package/dist/native/bridge/utils/NativeBridge.js +94 -0
- package/dist/native/build.swift +31 -0
- package/dist/native/buildAppAndroid.js +147 -0
- package/dist/native/buildAppIos.js +308 -0
- package/dist/native/iosnativeWebView/Configurations/Debug.xcconfig +21 -0
- package/dist/native/iosnativeWebView/Configurations/Release.xcconfig +24 -0
- package/dist/native/iosnativeWebView/Configurations/Shared.xcconfig +55 -0
- package/dist/native/iosnativeWebView/Package.resolved +158 -0
- package/dist/native/iosnativeWebView/Package.swift +26 -0
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/LocalNotificationHandler.swift +293 -0
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/NotificationManager.swift +299 -0
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/PushNotificationHandler.swift +199 -0
- package/dist/native/iosnativeWebView/Sources/Core/Constants/CatalystConstants.swift +115 -0
- package/dist/native/iosnativeWebView/Sources/Core/Constants/ConfigConstants.swift +28 -0
- package/dist/native/iosnativeWebView/Sources/Core/Notifications/NotificationModels.swift +156 -0
- package/dist/native/iosnativeWebView/Sources/Core/Protocols/NotificationHandlerProtocol.swift +35 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/BootTimingUtility.swift +26 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/CacheManager.swift +277 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/CameraTransportUtils.swift +363 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/DeviceInfoUtils.swift +67 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/FilePickerHandler.swift +1053 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/FrameworkServerUtils.swift +901 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/ImageHandler.swift +474 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/NetworkMonitor.swift +112 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/NotificationHandlerProvider.swift +20 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/NullNotificationHandler.swift +85 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/ResourceURLProtocol.swift +153 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/SafeAreaUtils.swift +132 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/URLWhitelistManager.swift +238 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/WebKitConfig.swift +43 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeCommandHandler.swift +644 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeDelegateHandler.swift +166 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeFileHandler.swift +340 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeJavaScriptInterface.swift +149 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeMessageValidator.swift +593 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/NativeBridge.swift +326 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashView.swift +95 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashViewModel.swift +86 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebView.swift +181 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewModel.swift +182 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewNavigationDelegate.swift +395 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/AppDelegate.swift +71 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/Assets.xcassets/Contents.json +6 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/ContentView.swift +111 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/Info-Release.plist +21 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/Info.plist +28 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/Preview Content/Preview Assets.xcassets/Contents.json +6 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/iosnativeWebView.entitlements +8 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/iosnativeWebViewApp.swift +87 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/localhost.p12 +0 -0
- package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/project.pbxproj +558 -0
- package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +159 -0
- package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/xcshareddata/xcschemes/iosnativeWebView.xcscheme +112 -0
- package/dist/native/renameAndroidProject.js +89 -0
- package/dist/native/setupEmulatorIos.js +36 -0
- package/dist/native/setupServer.js +28 -0
- package/dist/native/terminalProgress.js +11 -0
- package/dist/native/utils.js +12 -0
- package/dist/otel.js +4 -0
- package/dist/router/ClientRouter.js +3 -0
- package/dist/router/ServerRouter.js +1 -0
- package/dist/router.js +1 -0
- package/dist/scripts/build.js +3 -0
- package/dist/scripts/checkVersion.js +1 -0
- package/dist/scripts/devBuild.js +3 -0
- package/dist/scripts/devServe.js +3 -0
- package/dist/scripts/loadEnvironmentVariables.js +6 -0
- package/dist/scripts/loadScriptsBeforeServerStarts.js +4 -0
- package/dist/scripts/registerAliases.js +2 -0
- package/dist/scripts/scriptUtils.js +2 -0
- package/dist/scripts/serve.js +3 -0
- package/dist/scripts/start.js +6 -0
- package/dist/scripts/validator.js +1 -0
- package/dist/sentry.js +5 -0
- package/dist/server/expressServer.js +9 -0
- package/dist/server/renderer/document/Body.js +11 -0
- package/dist/server/renderer/document/Head.js +9 -0
- package/dist/server/renderer/document/index.js +1 -0
- package/dist/server/renderer/extract.js +27 -0
- package/dist/server/renderer/handler.js +24 -0
- package/dist/server/renderer/index.js +1 -0
- package/dist/server/startServer.js +7 -0
- package/dist/server/utils/userAgentUtil.js +9 -0
- package/dist/server/utils/validator.js +1 -0
- package/dist/webpack/babel-plugins/remove-client.plugin.js +5 -0
- package/dist/webpack/babel-plugins/remove-ssr.plugin.js +5 -0
- package/dist/webpack/babel.config.client.js +1 -0
- package/dist/webpack/babel.config.ssr.js +1 -0
- package/dist/webpack/base.babel.js +8 -0
- package/dist/webpack/development.client.babel.js +19 -0
- package/dist/webpack/production.client.babel.js +4 -0
- package/dist/webpack/production.ssr.babel.js +4 -0
- package/dist/webpack/scssParams.js +9 -0
- package/package.json +124 -88
- package/.eslintignore +0 -9
- package/.eslintrc +0 -92
- package/babel.config.json +0 -20
- package/caching.js +0 -16
- package/index.js +0 -16
- package/logger.js +0 -99
- package/router/ClientRouter.js +0 -19
- package/router/ServerRouter.js +0 -19
- package/router/index.js +0 -32
- package/router.js +0 -16
- package/scripts/build.js +0 -42
- package/scripts/checkVersion.js +0 -5
- package/scripts/devBuild.js +0 -42
- package/scripts/devServe.js +0 -43
- package/scripts/loadEnvironmentVariables.js +0 -24
- package/scripts/loadScriptsBeforeServerStarts.js +0 -47
- package/scripts/prepare.js +0 -19
- package/scripts/registerAliases.js +0 -30
- package/scripts/serve.js +0 -43
- package/scripts/start.js +0 -35
- package/scripts/validator.js +0 -127
- package/server/expressServer.js +0 -50
- package/server/mainIndex.js +0 -65
- package/server/mainServer.js +0 -70
- package/server/renderer/document/Body.js +0 -36
- package/server/renderer/document/Head.js +0 -43
- package/server/renderer/document/index.js +0 -27
- package/server/renderer/extract.js +0 -87
- package/server/renderer/handler.js +0 -240
- package/server/renderer/index.js +0 -12
- package/server/renderer/render.js +0 -84
- package/server/renderer/userAgentUtil.js +0 -55
- package/server/startServer.js +0 -66
- package/server/utils/metaTags.js +0 -13
- package/server/utils/userAgentUtil.js +0 -51
- package/server/utils/validator.js +0 -127
- package/tsconfig.json +0 -110
- package/webpack/babel-plugins/remove-client.plugin.js +0 -31
- package/webpack/babel-plugins/remove-ssr.plugin.js +0 -21
- package/webpack/babel.config.client.js +0 -24
- package/webpack/babel.config.js +0 -20
- package/webpack/babel.config.ssr.js +0 -24
- package/webpack/base.babel.js +0 -175
- package/webpack/development.client.babel.js +0 -85
- package/webpack/plugins/mime-types.js +0 -82
- package/webpack/plugins/route-manifest-copy.js +0 -122
- package/webpack/plugins/route-manifest-plugin.js +0 -122
- package/webpack/plugins/upload-assets-plugin.js +0 -181
- package/webpack/production.client.babel.js +0 -78
- package/webpack/production.ssr.babel.js +0 -61
- package/webpack/scssParams.js +0 -51
package/README.md
CHANGED
|
@@ -1,146 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://onemg.gumlet.io/staging/7ee66dfb-b5fb-4fbe-8dea-789685e45f7a.svg">
|
|
4
|
+
<img alt="Catalyst logo" src="https://onemg.gumlet.io/staging/2fdb0975-8f51-4fd1-bd7d-6375d793f581.svg" height="128">
|
|
5
|
+
</picture>
|
|
6
|
+
</div>
|
|
4
7
|
|
|
5
8
|
## Table of Contents
|
|
6
9
|
|
|
7
10
|
- Overview
|
|
8
11
|
- Installation
|
|
9
|
-
- Data Fetching with Catalyst
|
|
10
|
-
- serverFetcher
|
|
11
|
-
- clientFetcher
|
|
12
|
-
- refetch (for data revalidation)
|
|
13
|
-
- State Management
|
|
14
12
|
|
|
15
13
|
## Overview
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
Catalyst offers a comprehensive suite of features designed for modern web development. It includes isomorphic rendering for optimal performance, an extendable server with full-stack capabilities, and configurable state management. The framework employs smart prefetching of data and chunks, allows easy configuration of global styles and layouts, and provides SEO optimization at both global and page levels.
|
|
16
|
+
|
|
17
|
+
This version adds support for Universal app for both Android and iOS. Please checkout [Universal App Documentaion](https://catalyst.1mg.com/public_docs/content/Universal%20App/RunUniversalApp)
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
20
20
|
|
|
21
21
|
**System Requirements**
|
|
22
22
|
|
|
23
23
|
- Node version 20.4.0 or later
|
|
24
|
-
- macOS and Linux
|
|
24
|
+
- Compatible with **macOS** and **Linux**
|
|
25
25
|
|
|
26
26
|
**Automatic Installation**
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Run the following commands in the directory where you want to set up the Catalyst app:
|
|
29
29
|
|
|
30
|
-
```
|
|
30
|
+
```bash
|
|
31
31
|
npx create-catalyst-app@latest
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- Enter the name of your Catalyst application.
|
|
37
|
-
- Choose state management.
|
|
38
|
-
- Once packages are installed,start the development server by running the following command.
|
|
39
|
-
|
|
40
|
-
```js
|
|
41
|
-
cd project-name && npm run start
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
- Navigate to http://localhost:3005
|
|
45
|
-
|
|
46
|
-
The dev server should be running now.
|
|
47
|
-
|
|
48
|
-
Visit our official documentation:
|
|
49
|
-
https://catalyst.1mg.com/public_docs/content/installation
|
|
50
|
-
|
|
51
|
-
## Data Fetching with Catalyst
|
|
52
|
-
|
|
53
|
-
we have serverFetcher function for fetching with SSR and clientFetcher function for fetching during client side rendering and navigations.
|
|
54
|
-
|
|
55
|
-
**serverFetcher**
|
|
56
|
-
|
|
57
|
-
server fetcher will get request, request params, search params and store (if project is setup with redux or rtk) as arguments. We can declare it as an async function and use await for fetching or use then chaining for data fetching.
|
|
58
|
-
|
|
59
|
-
if server fetcher is called for a route then client fetcher will not be called for that route, unless called with refetch.
|
|
60
|
-
|
|
61
|
-
```js
|
|
62
|
-
Home.serverFetcher = async ({ req, params, searchParams }, { store }) => {
|
|
63
|
-
store.dispatch(someAction())
|
|
64
|
-
const res = await fetch("some_url")
|
|
65
|
-
const json = await res.json()
|
|
66
|
-
return json
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
data returned from fetcher function will be accessible through useCurrentRouteData() hook provided by router.
|
|
34
|
+
You will see some prompts to configure your application.
|
|
71
35
|
|
|
72
|
-
```
|
|
73
|
-
|
|
36
|
+
```bash
|
|
37
|
+
cd <name-of-your-project> && npm run start
|
|
74
38
|
```
|
|
75
39
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
**clientFetcher**
|
|
79
|
-
|
|
80
|
-
client fetcher would be called on client side rendering and client side navigations. `store` would be available as a param in client side for dispatching redux/rtk actions.
|
|
81
|
-
|
|
82
|
-
```js
|
|
83
|
-
Home.clientFetcher = async ({ route, location, params, searchParams, navigate }, { store }) => {
|
|
84
|
-
store.dispatch(someAction())
|
|
85
|
-
const res = await fetch("some_url")
|
|
86
|
-
const json = await res.json()
|
|
87
|
-
return json
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
data returned from client fetcher function will be accessible through useCurrentRouteData() hook provided by router (hook for data access through client is same).
|
|
92
|
-
|
|
93
|
-
```js
|
|
94
|
-
const [data, error, isFetched] = useCurrentRouteData()
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
**refetch (for data revalidation)**
|
|
98
|
-
|
|
99
|
-
refetch function can be used were we need to execute clientFetcher based on some condition(such as for infinite scroll or some state change inside container or onClick.)
|
|
100
|
-
|
|
101
|
-
We can pass arguments in refetch function which would
|
|
102
|
-
|
|
103
|
-
```js
|
|
104
|
-
const [data,error,isFetched,refetch] = useCurrentRouteData()
|
|
105
|
-
|
|
106
|
-
useEffect(()=>{
|
|
107
|
-
refetch({refetchArgument:some_value})
|
|
108
|
-
},[arg])
|
|
109
|
-
|
|
110
|
-
clientFetcher = ({},{refetchArgument}) => {
|
|
111
|
-
|
|
112
|
-
const res = await api_call // refetchArg can be used as a param in api call
|
|
113
|
-
return res
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## State Management
|
|
119
|
-
|
|
120
|
-
state management wrappers are defined in stateProvider.js file
|
|
121
|
-
|
|
122
|
-
store can be configured by manipulating store/index.js as per user requirements (custom middlewares etc can be added in this way.
|
|
123
|
-
|
|
124
|
-
initial state and request object would be provided in createStore function which will be called on server and client, we use the params to add additional arguments and middlewares in redux store.
|
|
125
|
-
|
|
126
|
-
```js
|
|
127
|
-
const configureStore = (initialState, cookies, requestObj, customHeaders) => {
|
|
128
|
-
const api = fetchInstance
|
|
129
|
-
const store = createStore({
|
|
130
|
-
reducer: rootReducer,
|
|
131
|
-
middleware: (getDefaultMiddleware) =>
|
|
132
|
-
getDefaultMiddleware({
|
|
133
|
-
thunk: {
|
|
134
|
-
extraArgument: { api },
|
|
135
|
-
},
|
|
136
|
-
}),
|
|
137
|
-
preloadedState: initialState,
|
|
138
|
-
})
|
|
139
|
-
return store
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export default configureStore
|
|
143
|
-
```
|
|
40
|
+
The development server will start at `http://localhost:3005`
|
|
144
41
|
|
|
145
42
|
## Documentation
|
|
146
43
|
|
package/babel.config.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module.exports = (api) => {
|
|
2
|
+
api.cache(true)
|
|
3
|
+
|
|
4
|
+
return {
|
|
5
|
+
presets: [
|
|
6
|
+
[
|
|
7
|
+
"@babel/preset-typescript",
|
|
8
|
+
{
|
|
9
|
+
isTSX: true,
|
|
10
|
+
allExtensions: true,
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
[
|
|
14
|
+
"@babel/preset-env",
|
|
15
|
+
{
|
|
16
|
+
targets: {
|
|
17
|
+
node: "current",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
["@babel/preset-react", { runtime: "automatic" }],
|
|
22
|
+
],
|
|
23
|
+
compact: true,
|
|
24
|
+
plugins: ["@loadable/babel-plugin"],
|
|
25
|
+
env: {
|
|
26
|
+
test: {
|
|
27
|
+
presets: ["@babel/preset-react"],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
ignore: ["__TEST__"],
|
|
31
|
+
}
|
|
32
|
+
}
|
package/bin/catalyst.js
CHANGED
|
@@ -5,27 +5,110 @@ process.on("unhandledRejection", (err) => {
|
|
|
5
5
|
})
|
|
6
6
|
const { spawnSync } = require("node:child_process")
|
|
7
7
|
const args = process.argv.slice(2)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
|
|
9
|
+
// Array of valid commands
|
|
10
|
+
const validCommands = [
|
|
11
|
+
"build",
|
|
12
|
+
"start",
|
|
13
|
+
"serve",
|
|
14
|
+
"devBuild",
|
|
15
|
+
"devServe",
|
|
16
|
+
"buildApp",
|
|
17
|
+
"buildApp:ios",
|
|
18
|
+
"buildApp:android",
|
|
19
|
+
"setupEmulator",
|
|
20
|
+
"setupEmulator:ios",
|
|
21
|
+
"setupEmulator:android",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
// Map of platform-specific commands to their script paths
|
|
25
|
+
const platformScripts = {
|
|
26
|
+
"setupEmulator:ios": "../dist/native/setupEmulatorIos.js",
|
|
27
|
+
"setupEmulator:android": "../dist/native/androidSetup.js",
|
|
28
|
+
"buildApp:ios": "../dist/native/buildAppIos.js",
|
|
29
|
+
"buildApp:android": "../dist/native/buildAppAndroid.js",
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Helper to check if arg is a platform command
|
|
33
|
+
const isPlatformCommand = (arg, prefix) => {
|
|
34
|
+
if (!arg.startsWith(`${prefix}:`)) return false
|
|
35
|
+
const platform = arg.split(":")[1]
|
|
36
|
+
return ["ios", "android"].includes(platform) || platform === undefined
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Helper function to run a platform command
|
|
40
|
+
const runPlatformCommand = (baseCommand, platform) => {
|
|
41
|
+
const command = `${baseCommand}:${platform}`
|
|
14
42
|
const result = spawnSync(
|
|
15
43
|
process.execPath,
|
|
16
|
-
nodeArgs.concat(require.resolve(
|
|
44
|
+
nodeArgs.concat(require.resolve(platformScripts[command])).concat(args.slice(scriptIndex + 1)),
|
|
17
45
|
{ stdio: "inherit" }
|
|
18
46
|
)
|
|
47
|
+
return result
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Helper function to run commands for all platforms
|
|
51
|
+
const runAllPlatforms = (baseCommand) => {
|
|
52
|
+
const platforms = ["ios", "android"]
|
|
53
|
+
for (const platform of platforms) {
|
|
54
|
+
const result = runPlatformCommand(baseCommand, platform)
|
|
55
|
+
if (result.status !== 0) {
|
|
56
|
+
handleProcessResult(result)
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
process.exit(0)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const scriptIndex = args.findIndex(
|
|
64
|
+
(x) =>
|
|
65
|
+
x === "build" ||
|
|
66
|
+
x === "start" ||
|
|
67
|
+
x === "serve" ||
|
|
68
|
+
x === "devBuild" ||
|
|
69
|
+
x === "devServe" ||
|
|
70
|
+
isPlatformCommand(x, "buildApp") ||
|
|
71
|
+
isPlatformCommand(x, "setupEmulator")
|
|
72
|
+
)
|
|
73
|
+
const script = scriptIndex === -1 ? args[0] : args[scriptIndex]
|
|
74
|
+
const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : []
|
|
75
|
+
|
|
76
|
+
if (validCommands.includes(script)) {
|
|
77
|
+
// Handle platform-specific or combined commands
|
|
78
|
+
if (script === "buildApp" || script === "setupEmulator") {
|
|
79
|
+
// Run for all platforms if no specific platform is specified
|
|
80
|
+
runAllPlatforms(script)
|
|
81
|
+
} else if (script in platformScripts) {
|
|
82
|
+
// Run for specific platform
|
|
83
|
+
const result = spawnSync(
|
|
84
|
+
process.execPath,
|
|
85
|
+
nodeArgs.concat(require.resolve(platformScripts[script])).concat(args.slice(scriptIndex + 1)),
|
|
86
|
+
{ stdio: "inherit" }
|
|
87
|
+
)
|
|
88
|
+
handleProcessResult(result)
|
|
89
|
+
} else {
|
|
90
|
+
// Original commands
|
|
91
|
+
const result = spawnSync(
|
|
92
|
+
process.execPath,
|
|
93
|
+
nodeArgs.concat(require.resolve("../dist/scripts/" + script)).concat(args.slice(scriptIndex + 1)),
|
|
94
|
+
{ stdio: "inherit" }
|
|
95
|
+
)
|
|
96
|
+
handleProcessResult(result)
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
console.log('Unknown script "' + script + '".')
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Helper function to handle process results
|
|
103
|
+
function handleProcessResult(result) {
|
|
19
104
|
if (result.signal) {
|
|
20
105
|
if (result.signal === "SIGKILL") {
|
|
21
|
-
/* eslint-disable no-console */
|
|
22
106
|
console.log(
|
|
23
107
|
"The build failed because the process exited too early. " +
|
|
24
108
|
"This probably means the system ran out of memory or someone called " +
|
|
25
109
|
"`kill -9` on the process."
|
|
26
110
|
)
|
|
27
111
|
} else if (result.signal === "SIGTERM") {
|
|
28
|
-
/* eslint-disable no-console */
|
|
29
112
|
console.log(
|
|
30
113
|
"The build failed because the process exited too early. " +
|
|
31
114
|
"Someone might have called `kill` or `killall`, or the system could " +
|
|
@@ -35,7 +118,4 @@ if (["build", "start", "serve", "devBuild", "devServe"].includes(script)) {
|
|
|
35
118
|
process.exit(1)
|
|
36
119
|
}
|
|
37
120
|
process.exit(result.status)
|
|
38
|
-
} else {
|
|
39
|
-
/* eslint-disable no-console */
|
|
40
|
-
console.log('Unknown script "' + script + '".');
|
|
41
121
|
}
|
package/changelog.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.3-canary.20] - 2025-12-12
|
|
4
|
+
|
|
5
|
+
- Patch: Allow localhost traffic to be served from http
|
|
6
|
+
|
|
7
|
+
## [0.0.3-canary.19] - 2025-12-09
|
|
8
|
+
|
|
9
|
+
- Offline fallback support: packages `public/offline.html` into Android/iOS bundles and shows it automatically when connectivity drops (with retry handling)
|
|
10
|
+
- Notification refactor: streamlined config toggle for local vs push, centralized permission/asset handling, and simpler routing into the web app
|
|
11
|
+
- Access control: combined access control config for ios
|
|
12
|
+
|
|
13
|
+
## [0.0.3-canary.18] - 2025-11-19
|
|
14
|
+
|
|
15
|
+
- Configuration Files
|
|
16
|
+
- Android Native WebView - MainActivity.kt
|
|
17
|
+
- Android Native WebView - CustomWebview.kt
|
|
18
|
+
|
|
19
|
+
## [0.0.3-canary.17] - 2025-11-19
|
|
20
|
+
|
|
21
|
+
- โจ Added complete notification system (local & push)
|
|
22
|
+
- ๐ New useNotification() React hook
|
|
23
|
+
- ๐ฑ Firebase Cloud Messaging conditional build support
|
|
24
|
+
- ๐ค Android notification handling in MainActivity
|
|
25
|
+
- ๐ง 5 new notification commands + 5 callbacks in NativeBridge
|
|
26
|
+
- ๐ฆ Auto-processing of notification icons & sounds
|
|
27
|
+
- โ๏ธ Conditional dependencies based on notification config
|
|
28
|
+
- ๐งน Updated .gitignore & .npmignore
|
|
29
|
+
- ๐ Enhanced build process with automatic permission injection
|
|
30
|
+
- ๐ Deep link integration with notifications
|
|
31
|
+
|
|
32
|
+
## [0.0.3-canary.16] - 2025-11-19
|
|
33
|
+
|
|
34
|
+
- FeaturesGallery Support for File Picker: Enhanced file picker to open native gallery for selecting images and videos
|
|
35
|
+
- HTTPS Framework Server: Enabled HTTPS support for the framework server with self-signed SSL certificate
|
|
36
|
+
- MIME Type Handling: Fixed and improved MIME type detection and handling in the file picker
|
|
37
|
+
|
|
38
|
+
## [0.0.3-canary.15] - 2025-11-19
|
|
39
|
+
|
|
40
|
+
- Adding Android release support and appInfo key
|
|
41
|
+
|
|
42
|
+
## [0.0.3-canary.14] - 2025-09-29
|
|
43
|
+
|
|
44
|
+
- Android custom splashscreen
|
|
45
|
+
|
|
46
|
+
## [0.0.3-canary.13] - 2025-09-28
|
|
47
|
+
|
|
48
|
+
- Multi file support in useFilePicker hook
|
|
49
|
+
- Android multiple app icon support
|
|
50
|
+
- Android whitelisting toggle support
|
|
51
|
+
|
|
52
|
+
## [0.0.3-canary.12] - 2025-09-26
|
|
53
|
+
|
|
54
|
+
- Universal App Context: Added comprehensive context support for building universal mobile applications
|
|
55
|
+
- OpenTelemetry SDK Integration: Built-in support for observability and performance monitoring with Otel SDK
|
|
56
|
+
|
|
57
|
+
## [0.0.3-canary.11] - 2025-09-26
|
|
58
|
+
|
|
59
|
+
- Build organization: Store APKs and iOS builds organized by generation date and time for better tracking and management
|
|
60
|
+
- Enhanced Android native support: Add support for native keyboard and webview resizing in Android
|
|
61
|
+
- Device info API web support: Web support in device info API
|
|
62
|
+
|
|
63
|
+
## [0.0.3-canary.10] - 2025-09-11
|
|
64
|
+
|
|
65
|
+
- **Sentry import bug fix**
|
|
66
|
+
- **Open telemetry SDK**
|
|
67
|
+
|
|
68
|
+
## [0.0.3-canary.9] - 2025-09-11
|
|
69
|
+
|
|
70
|
+
- **App name configuration**
|
|
71
|
+
- **Device Info API**
|
|
72
|
+
- **Access control configuration**
|
|
73
|
+
|
|
74
|
+
## [0.0.3-canary.8] - 2025-01-06
|
|
75
|
+
|
|
76
|
+
- **App icon configuration**
|
|
77
|
+
- **Splash screen integration**
|
|
78
|
+
- **Url Whitelisting**
|
|
79
|
+
|
|
80
|
+
## [0.0.3-canary.7] - 2025-01-06
|
|
81
|
+
|
|
82
|
+
### ๐ Features
|
|
83
|
+
|
|
84
|
+
- **Native API Integration**: Enhanced native module integration for better performance
|
|
85
|
+
- **Automated IP Resolution**: Intelligent network detection eliminates manual IP configuration
|
|
86
|
+
- **Universal Build System**: Streamlined one-command builds for both Android and iOS platforms
|
|
87
|
+
- **Enhanced CLI Interface**: Improved command-line tools for better developer experience
|
|
88
|
+
|
|
89
|
+
### ๐ Bug Fixes
|
|
90
|
+
|
|
91
|
+
- Fixed IP address detection issues on development environments
|
|
92
|
+
- Resolved build configuration conflicts between platforms
|
|
93
|
+
- Improved error handling and recovery mechanisms
|
|
94
|
+
|
|
95
|
+
### ๐ง Improvements
|
|
96
|
+
|
|
97
|
+
- **Performance**: Optimized native module loading and execution
|
|
98
|
+
- **Developer Experience**: Enhanced CLI with better error messages and debugging info
|
|
99
|
+
- **Configuration**: Dynamic config updates without requiring restarts
|
|
100
|
+
- **Build Process**: Faster and more reliable build pipeline
|
|
101
|
+
|
|
102
|
+
### ๐งช Testing & Validation
|
|
103
|
+
|
|
104
|
+
- โ
**Android Build**: Verified APK generation, installation, and runtime behavior
|
|
105
|
+
- โ
**iOS Build**: Tested build process and device compatibility
|
|
106
|
+
- โ
**IP Detection**: Validated automatic network resolution across platforms
|
|
107
|
+
- โ
**Native Modules**: Confirmed API integration and performance benchmarks
|
|
108
|
+
- โ
**CLI Operations**: Tested enhanced command-line workflows and error handling
|
|
109
|
+
|
|
110
|
+
### ๐ Breaking Changes
|
|
111
|
+
|
|
112
|
+
**None** - All changes maintain backward compatibility while enhancing existing functionality
|
|
113
|
+
|
|
114
|
+
### ๐ Technical Details
|
|
115
|
+
|
|
116
|
+
- Improved native API bridge for better cross-platform communication
|
|
117
|
+
- Enhanced error reporting with detailed stack traces and suggestions
|
|
118
|
+
- Optimized build configuration for faster development cycles
|
|
119
|
+
- Added comprehensive logging for debugging and monitoring
|
|
120
|
+
|
|
121
|
+
### ๐ Migration Notes
|
|
122
|
+
|
|
123
|
+
- No migration steps required
|
|
124
|
+
- Existing projects will automatically benefit from improvements
|
|
125
|
+
- Optional: Update CLI usage to leverage new enhanced features
|
|
126
|
+
|
|
127
|
+
## Version
|
|
128
|
+
|
|
129
|
+
- Target version: 0.0.3-canary.7
|
package/dist/caching.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _apiCaching=require("@tata1mg/api-caching");Object.keys(_apiCaching).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_apiCaching[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function(){return _apiCaching[key];}});});
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _index=require("./server/renderer/document/index");Object.keys(_index).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_index[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function(){return _index[key];}});});
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";const pc=require("picocolors");const winston=require("winston");const DailyRotateFile=require("winston-daily-rotate-file");const{createLogger,format,transports}=winston;/**
|
|
2
|
+
* @description Logger library with rotational strategy. Creates a logs folder in root.
|
|
3
|
+
* With debug, error and info log directories with their respective log files.
|
|
4
|
+
*
|
|
5
|
+
* @format Logstash with timestamp
|
|
6
|
+
* @param config { @enableDebugLogs: Bool // default: true }
|
|
7
|
+
* @returns loggerInstance
|
|
8
|
+
*
|
|
9
|
+
*/const configureLogger=(config={})=>{const{enableDebugLogs=true,enableFileLogging=true,enableConsoleLogging=true}=config;const consoleTransport=new transports.Console({level:"debug"});const fileTransport=(type="info")=>{return new DailyRotateFile({filename:`${process.env.src_path}/logs/${type}/%DATE%.${type}.log`,datePattern:"YYYY-MM-DD",maxFiles:"3d",// Logs will be removed after 2days,
|
|
10
|
+
loglevel:type,level:type});};const infoLogger=createLogger({format:format.combine(format.timestamp({format:"YYYY-MM-DD HH:mm:ss"}),format.json()),defaultMeta:{loglevel:"info"}});const debugLogger=createLogger({format:format.combine(format.timestamp({format:"YYYY-MM-DD HH:mm:ss"}),format.json()),defaultMeta:{loglevel:"debug"}});const errorLogger=createLogger({format:format.combine(format.timestamp({format:"YYYY-MM-DD HH:mm:ss"}),format.json()),defaultMeta:{loglevel:"error"}});if(enableConsoleLogging&&JSON.parse(enableConsoleLogging)){infoLogger.add(consoleTransport);debugLogger.add(consoleTransport);errorLogger.add(consoleTransport);}if(enableFileLogging&&JSON.parse(enableFileLogging)){infoLogger.add(fileTransport("info"));debugLogger.add(fileTransport("debug"));errorLogger.add(fileTransport("error"));}const Logger={debug:()=>{},error:msg=>{console.log(pc.red(pc.bold("ERROR: "+JSON.stringify(msg))));errorLogger.error(msg);},info:msg=>{console.log(pc.green(pc.bold("INFO: "+JSON.stringify(msg))));infoLogger.info(msg);}};if(enableDebugLogs&&JSON.parse(enableDebugLogs)){Logger.debug=msg=>{console.log(pc.yellow(pc.bold("DEBUG: "+JSON.stringify(msg))));debugLogger.debug(msg);};}if(global)global.logger=Logger;return Logger;};module.exports={configureLogger};
|