catalyst-core 0.2.0-beta.3 → 0.3.0-beta.2
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/babel.native.config.cjs +8 -0
- package/bin/catalyst.js +49 -105
- package/changelog.md +8 -0
- package/dist/caching.js +1 -1
- package/dist/globals.d.ts +7 -0
- package/dist/index.jsx +8 -0
- package/dist/logger.js +74 -3
- package/dist/native/androidProject/app/build.gradle.kts +45 -4
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/NativeBridge.kt +86 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/BridgeUtils.kt +8 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/FrameworkServerUtils.kt +173 -13
- package/dist/native/androidProject/settings.gradle.kts +10 -0
- package/dist/native/androidSetup.js +300 -8
- package/dist/native/bridge/WebBridge.js +481 -59
- package/dist/native/bridge/constants/NativeInterfaces.js +304 -45
- package/dist/native/bridge/errors.js +250 -26
- package/dist/native/bridge/hooks/index.js +132 -1
- package/dist/native/bridge/hooks/useAI.js +94 -0
- package/dist/native/bridge/hooks/useCamera.js +347 -9
- package/dist/native/bridge/hooks/useDataProtection.js +200 -2
- package/dist/native/bridge/hooks/useDeviceInfo.js +71 -2
- package/dist/native/bridge/hooks/useFilePicker.js +429 -2
- package/dist/native/bridge/hooks/useGoogleSignIn.js +81 -1
- package/dist/native/bridge/hooks/useHapticFeedback.js +196 -1
- package/dist/native/bridge/hooks/useIntent.js +95 -1
- package/dist/native/bridge/hooks/useNativeTransition.js +202 -27
- package/dist/native/bridge/hooks/useNetworkStatus.js +84 -3
- package/dist/native/bridge/hooks/useNotification.js +318 -2
- package/dist/native/bridge/hooks/useSafeArea.js +84 -2
- package/dist/native/bridge/hooks/useVideoStream.js +434 -6
- package/dist/native/bridge/hooks/utils.js +27 -1
- package/dist/native/bridge/hooks.js +16 -1
- package/dist/native/bridge/perf/collectors/ApiCollector.js +66 -3
- package/dist/native/bridge/perf/collectors/CacheCollector.js +186 -11
- package/dist/native/bridge/perf/collectors/HookCollector.js +141 -19
- package/dist/native/bridge/perf/collectors/InsightsCollector.js +481 -23
- package/dist/native/bridge/perf/collectors/InteractionCollector.js +245 -10
- package/dist/native/bridge/perf/collectors/KeyboardCollector.js +107 -8
- package/dist/native/bridge/perf/collectors/NavigationCollector.js +273 -32
- package/dist/native/bridge/perf/collectors/NetworkTimingCollector.js +178 -2
- package/dist/native/bridge/perf/collectors/RenderCollector.js +258 -14
- package/dist/native/bridge/perf/collectors/ScrollCollector.js +95 -9
- package/dist/native/bridge/perf/collectors/ThreadCollector.js +90 -6
- package/dist/native/bridge/perf/core/constants.js +103 -20
- package/dist/native/bridge/perf/core/measure.js +179 -30
- package/dist/native/bridge/perf/core/session.js +89 -23
- package/dist/native/bridge/perf/core/store.js +554 -1
- package/dist/native/bridge/perf/core/summary.js +174 -1
- package/dist/native/bridge/perf/core/traceExport.js +240 -1
- package/dist/native/bridge/perf/core/waterfalls.js +146 -1
- package/dist/native/bridge/perf/index.js +359 -38
- package/dist/native/bridge/safeArea.js +53 -5
- package/dist/native/bridge/standardizedHooks.js +595 -82
- package/dist/native/bridge/useBaseHook.js +274 -38
- package/dist/native/bridge/utils/CameraUtils.js +201 -56
- package/dist/native/bridge/utils/FileObjectConverter.js +129 -18
- package/dist/native/bridge/utils/NativeBridge.js +425 -141
- package/dist/native/buildAndroid/assets.js +510 -13
- package/dist/native/buildAndroid/build.js +296 -19
- package/dist/native/buildAndroid/config.js +87 -1
- package/dist/native/buildAndroid/index.js +406 -1
- package/dist/native/buildAppAndroid.js +34 -2
- package/dist/native/buildAppIos.js +62 -2
- package/dist/native/buildIos/assets.js +609 -8
- package/dist/native/buildIos/build.js +639 -20
- package/dist/native/buildIos/config.js +294 -12
- package/dist/native/buildIos/index.js +343 -6
- package/dist/native/buildIos/plugins.js +343 -16
- package/dist/native/internal-plugins/device-info-plugin/android/DeviceInfoPlugin.kt +43 -0
- package/dist/native/internal-plugins/device-info-plugin/ios/DeviceInfoPlugin.swift +28 -0
- package/dist/native/internal-plugins/device-info-plugin/manifest.json +19 -0
- package/dist/native/internalPluginUtils.js +232 -7
- package/dist/native/package.json +3 -0
- package/dist/native/plugin-bridge/PluginBridge.js +227 -1
- package/dist/native/pluginComposerAndroid.js +407 -23
- package/dist/native/pluginComposerIos.js +435 -11
- package/dist/native/renameAndroidProject.js +1094 -88
- package/dist/native/setupEmulatorIos.js +289 -22
- package/dist/native/setupServer.js +160 -19
- package/dist/native/terminalProgress.js +199 -11
- package/dist/native/utils.js +193 -15
- package/dist/offline/catalyst-sw.js +145 -1
- package/dist/offline/registerServiceWorker.js +33 -1
- package/dist/otel.js +375 -46
- package/dist/router/ClientRouter.js +14 -2
- package/dist/router/ServerRouter.js +9 -1
- package/dist/router.js +1 -1
- package/dist/scripts/build.js +112 -3
- package/dist/scripts/checkVersion.js +3 -1
- package/dist/scripts/cleanCache.js +30 -1
- package/dist/scripts/generateOfflineManifest.js +116 -1
- package/dist/scripts/loadEnvironmentVariables.js +32 -6
- package/dist/scripts/plugins.js +309 -1
- package/dist/scripts/preServerInit.js +13 -0
- package/dist/scripts/scriptUtils.js +54 -3
- package/dist/scripts/serve.js +51 -4
- package/dist/scripts/start.js +47 -10
- package/dist/scripts/validator.js +149 -1
- package/dist/sentry.cjs +127 -0
- package/dist/sentry.js +125 -5
- package/dist/server/expressServer.js +296 -5
- package/dist/server/manifestCache.js +36 -0
- package/dist/server/renderer/ChunkExtractor.js +144 -0
- package/dist/server/renderer/document/Body.jsx +59 -0
- package/dist/server/renderer/document/FastRefresh.jsx +20 -0
- package/dist/server/renderer/document/Head.jsx +60 -0
- package/dist/server/renderer/document/index.jsx +2 -0
- package/dist/server/renderer/extract.js +149 -31
- package/dist/server/renderer/handler.jsx +450 -0
- package/dist/server/renderer/index.js +8 -1
- package/dist/server/renderer/render.js +47 -0
- package/dist/server/utils/botDetectionMiddleware.js +29 -0
- package/dist/server/utils/cjsRequire.js +10 -0
- package/dist/server/utils/userAgentUtil.js +87 -9
- package/dist/server/utils/validator.js +164 -1
- package/dist/vite/FastRefresh.jsx +20 -0
- package/dist/vite/inject-cache-key-plugin.js +276 -0
- package/dist/vite/loadCustomViteConfig.js +22 -0
- package/dist/vite/manifest-categorization-plugin.js +455 -0
- package/dist/vite/node-loader.mjs +458 -0
- package/dist/vite/scssParams.js +21 -0
- package/dist/vite/vite.config.client.js +130 -0
- package/dist/vite/vite.config.js +498 -0
- package/dist/vite/vite.config.server.js +84 -0
- package/dist/web-router/components/MetaTag.jsx +34 -0
- package/dist/web-router/components/RouterDataProvider.jsx +332 -0
- package/dist/web-router/components/Split.jsx +200 -0
- package/dist/web-router/components/SplitInview.jsx +106 -0
- package/dist/web-router/components/SsrRequestContext.jsx +14 -0
- package/dist/web-router/context.jsx +12 -0
- package/dist/web-router/hooks.jsx +72 -0
- package/dist/web-router/types/components/MetaTag.d.ts +2 -0
- package/dist/web-router/types/components/RouterDataProvider.d.ts +95 -0
- package/dist/web-router/types/context.d.ts +14 -0
- package/dist/web-router/types/hooks.d.ts +1 -0
- package/dist/web-router/types/index.d.ts +3 -0
- package/dist/web-router/types/utils/metaDataUtils.d.ts +24 -0
- package/dist/web-router/utils/metaDataUtils.jsx +119 -0
- package/mcp_v2/conversion-tasks.json +35 -17
- package/mcp_v2/knowledge-base.json +176 -17
- package/mcp_v2/lib/helpers.js +10 -0
- package/mcp_v2/mcp.js +40 -8
- package/mcp_v2/package.json +1 -0
- package/mcp_v2/tools/build.js +161 -37
- package/mcp_v2/tools/conversion.js +106 -5
- package/mcp_v2/tools/tasks.js +18 -14
- package/package.json +35 -68
- package/babel.config.js +0 -32
- package/dist/index.js +0 -1
- package/dist/scripts/devBuild.js +0 -3
- package/dist/scripts/devServe.js +0 -3
- package/dist/scripts/loadScriptsBeforeServerStarts.js +0 -4
- package/dist/scripts/registerAliases.js +0 -6
- package/dist/server/renderer/document/Body.js +0 -11
- package/dist/server/renderer/document/Head.js +0 -9
- package/dist/server/renderer/document/index.js +0 -1
- package/dist/server/renderer/handler.js +0 -47
- package/dist/server/startServer.js +0 -57
- package/dist/webpack/babel-plugins/remove-client.plugin.js +0 -5
- package/dist/webpack/babel-plugins/remove-ssr.plugin.js +0 -5
- package/dist/webpack/babel.config.client.js +0 -1
- package/dist/webpack/babel.config.ssr.js +0 -1
- package/dist/webpack/base.babel.js +0 -7
- package/dist/webpack/development.client.babel.js +0 -10
- package/dist/webpack/production.client.babel.js +0 -4
- package/dist/webpack/production.ssr.babel.js +0 -8
- package/dist/webpack/scssParams.js +0 -9
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useNavigate, useLocation } from "react-router-dom"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {number} delay
|
|
5
|
+
*/
|
|
6
|
+
function wait(delay) {
|
|
7
|
+
return new Promise((resolve) => {
|
|
8
|
+
setTimeout(resolve, delay)
|
|
9
|
+
})
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// function navigationDirection(param) {
|
|
13
|
+
// if (typeof param === "string") {
|
|
14
|
+
// return "forward-navigation"
|
|
15
|
+
// } else if (typeof param === "number") {
|
|
16
|
+
// return param < 0 ? "backward-navigation" : param > 0 ? "forward-navigation" : "Same_page_navigation"
|
|
17
|
+
// } else {
|
|
18
|
+
// return "Invalid_param"
|
|
19
|
+
// }
|
|
20
|
+
// }
|
|
21
|
+
|
|
22
|
+
// export function useNavigateWithTransition() {
|
|
23
|
+
// const navigate = useNavigate()
|
|
24
|
+
// const { setIsExitComplete, updateScrollPosition } = useScrollRestorationContext()
|
|
25
|
+
// const location = useLocation()
|
|
26
|
+
// function transition(route, options = {}) {
|
|
27
|
+
// if (document.startViewTransition && options.skipTransition) {
|
|
28
|
+
// const directionForNavigation = navigationDirection(route)
|
|
29
|
+
// //decide whether to use backward transition or forward transition or no transition in case route is 0
|
|
30
|
+
// if (directionForNavigation === "Same_page_navigation") {
|
|
31
|
+
// navigate(route, options)
|
|
32
|
+
// return
|
|
33
|
+
// }
|
|
34
|
+
// //select the root element and give it the viewTransitionNameb by the directionForNavigation
|
|
35
|
+
// const rootElementRef = document.querySelector(":root")
|
|
36
|
+
// rootElementRef.style.viewTransitionName = directionForNavigation
|
|
37
|
+
|
|
38
|
+
// const viewTransition = document.startViewTransition(async function updateCallback() {
|
|
39
|
+
// // Update scroll position for the current route
|
|
40
|
+
// updateScrollPosition(location.key, parseInt(window.scrollY, 10))
|
|
41
|
+
// delete options.skipTransition
|
|
42
|
+
// navigate(route, options)
|
|
43
|
+
// await wait(50)
|
|
44
|
+
// })
|
|
45
|
+
|
|
46
|
+
// // A Promise that fulfills once the pseudo-element tree is created and the transition animation is about to start.
|
|
47
|
+
// viewTransition.ready.then(() => {
|
|
48
|
+
// if (directionForNavigation === "backward-navigation") {
|
|
49
|
+
// setIsExitComplete(true)
|
|
50
|
+
// } else {
|
|
51
|
+
// window.scrollTo({ top: 0, left: 0, behavior: "auto" })
|
|
52
|
+
// }
|
|
53
|
+
// })
|
|
54
|
+
|
|
55
|
+
// //A Promise that fulfills once the transition animation is finished, and the new page view is visible and interactive to the user.
|
|
56
|
+
// viewTransition.finished.finally(() => {
|
|
57
|
+
// // Clear the temporary tag
|
|
58
|
+
// if (rootElementRef) rootElementRef.style.viewTransitionName = ""
|
|
59
|
+
// })
|
|
60
|
+
// } else {
|
|
61
|
+
// // fallback for old browser
|
|
62
|
+
// delete options.skipTransition
|
|
63
|
+
// navigate(route, options)
|
|
64
|
+
// }
|
|
65
|
+
// }
|
|
66
|
+
|
|
67
|
+
// return transition
|
|
68
|
+
// }
|
|
69
|
+
|
|
70
|
+
export const useNavigateWithTransition = () => {
|
|
71
|
+
return useNavigate()
|
|
72
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Router Data
|
|
3
|
+
* @typedef {{data: any, error: any, isFetching: boolean, isFetched:boolean, refetch?:(args:any)=>Promise<void>}} RouteData
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @type {import("react").Context<Object.<string, RouteData>>}
|
|
7
|
+
*/
|
|
8
|
+
export const RouterContext: import("react").Context<{
|
|
9
|
+
[x: string]: RouteData
|
|
10
|
+
}>
|
|
11
|
+
export function serverDataFetcher(
|
|
12
|
+
serverFetchDataProps: ServerFetchDataProps,
|
|
13
|
+
fetcherArgs: {
|
|
14
|
+
[x: string]: any
|
|
15
|
+
}
|
|
16
|
+
): Promise<{
|
|
17
|
+
[x: string]: RouteData
|
|
18
|
+
}>
|
|
19
|
+
export function RouterDataProvider({
|
|
20
|
+
children,
|
|
21
|
+
initialState,
|
|
22
|
+
fetcherArgs,
|
|
23
|
+
config,
|
|
24
|
+
}: RouterDataProviderProps): React.JSX.Element
|
|
25
|
+
export function useCurrentRouteData(): RouteData
|
|
26
|
+
export function useRouterData(): {
|
|
27
|
+
[x: string]: RouteData
|
|
28
|
+
}
|
|
29
|
+
export type RouteData = {
|
|
30
|
+
data: any
|
|
31
|
+
error: any
|
|
32
|
+
isFetching: boolean
|
|
33
|
+
isFetched: boolean
|
|
34
|
+
refetch?: (args: any) => Promise<void>
|
|
35
|
+
}
|
|
36
|
+
export type RouterDataProviderConfig = {
|
|
37
|
+
/**
|
|
38
|
+
* disableCaching disable caching of fetched data - default is false
|
|
39
|
+
*/
|
|
40
|
+
disableCaching?: boolean | undefined
|
|
41
|
+
}
|
|
42
|
+
export type RouterFetcherProps = {
|
|
43
|
+
/**
|
|
44
|
+
* route object
|
|
45
|
+
*/
|
|
46
|
+
route: any
|
|
47
|
+
/**
|
|
48
|
+
* the current location object, which represents the current URL in web browsers.
|
|
49
|
+
*/
|
|
50
|
+
location: import("react-router-dom").Location
|
|
51
|
+
/**
|
|
52
|
+
* object of key/value pairs of the dynamic params from the current URL that were matched by the route path.
|
|
53
|
+
*/
|
|
54
|
+
params: import("react-router-dom").Params
|
|
55
|
+
/**
|
|
56
|
+
* search parameters via URLSearchParams interface.
|
|
57
|
+
*/
|
|
58
|
+
searchParams: URLSearchParams
|
|
59
|
+
/**
|
|
60
|
+
* function to navigate to other pages based on response.
|
|
61
|
+
*/
|
|
62
|
+
navigate: import("react-router-dom").NavigateFunction
|
|
63
|
+
}
|
|
64
|
+
export type ServerFetchDataProps = {
|
|
65
|
+
/**
|
|
66
|
+
* routes Array
|
|
67
|
+
*/
|
|
68
|
+
routes: import("react-router-dom").RouteObject[]
|
|
69
|
+
/**
|
|
70
|
+
* current url
|
|
71
|
+
*/
|
|
72
|
+
url: string
|
|
73
|
+
/**
|
|
74
|
+
* Express request object
|
|
75
|
+
*/
|
|
76
|
+
req: import("express").Request
|
|
77
|
+
}
|
|
78
|
+
export type RouterDataProviderProps = {
|
|
79
|
+
/**
|
|
80
|
+
* Initial State of Data Provider - Mostly used to hydrate client with data from server
|
|
81
|
+
*/
|
|
82
|
+
initialState: any
|
|
83
|
+
children: any
|
|
84
|
+
/**
|
|
85
|
+
* anything passed in fetcherArgs is passed to all the fetcher functions
|
|
86
|
+
*/
|
|
87
|
+
fetcherArgs: {
|
|
88
|
+
[x: string]: any
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Global router data provider config
|
|
92
|
+
*/
|
|
93
|
+
config: RouterDataProviderConfig
|
|
94
|
+
}
|
|
95
|
+
import React from "react"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef oneMgRouterContext
|
|
3
|
+
* @property {import("react-router-dom").RouteMatch<string, import("react-router-dom").RouteObject>[]=} matchedRoutes
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @description This is internal context made for sharing data among router components
|
|
7
|
+
* @type {import("react").Context<oneMgRouterContext>}
|
|
8
|
+
*/
|
|
9
|
+
export const OneMgRouterContext: import("react").Context<oneMgRouterContext>
|
|
10
|
+
export type oneMgRouterContext = {
|
|
11
|
+
matchedRoutes?:
|
|
12
|
+
| import("react-router-dom").RouteMatch<string, import("react-router-dom").RouteObject>[]
|
|
13
|
+
| undefined
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function useNavigateWithTransition(): import("react-router-dom").NavigateFunction
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merges multiple lists of head elements, ensuring that later lists override earlier ones in case of duplicates.
|
|
3
|
+
* Handles all types of head elements, including title, meta, link, etc.
|
|
4
|
+
*
|
|
5
|
+
* @param {...Array<JSX.Element>} lists - Multiple lists of JSX head elements, where the first argument is the parent and the rest are children in order.
|
|
6
|
+
* @returns {Array<JSX.Element>} - The combined list with later lists overriding duplicates from earlier ones.
|
|
7
|
+
*/
|
|
8
|
+
export function mergeHeadElements(...lists: Array<JSX.Element>[]): Array<JSX.Element>
|
|
9
|
+
/**
|
|
10
|
+
* Deletes all elements in the head with a specific data attribute.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} attributeName - The name of the data attribute to search for.
|
|
13
|
+
* @param {string} [attributeValue] - The specific value of the data attribute to match (optional).
|
|
14
|
+
*/
|
|
15
|
+
export function deleteHeadTagsByDataAttribute(attributeName: string, attributeValue?: string): void
|
|
16
|
+
/**
|
|
17
|
+
* Returns resolved array of meta data elements.
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
* @param {Array<Match>} matchedRoutes - Array of all matches.
|
|
21
|
+
* @param {Object} routeData - Data returned from Router.
|
|
22
|
+
* @returns {Array<JSX.Element>} - List of all meta tags for the matched location.
|
|
23
|
+
*/
|
|
24
|
+
export function getMetaData(matchedRoutes: Array<Match>, routeData: Object): Array<JSX.Element>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
/**
|
|
3
|
+
* Merges multiple lists of head elements, ensuring that later lists override earlier ones in case of duplicates.
|
|
4
|
+
* Handles all types of head elements, including title, meta, link, etc.
|
|
5
|
+
*
|
|
6
|
+
* @param {...Array<JSX.Element>} lists - Multiple lists of JSX head elements, where the first argument is the parent and the rest are children in order.
|
|
7
|
+
* @returns {Array<JSX.Element>} - The combined list with later lists overriding duplicates from earlier ones.
|
|
8
|
+
*/
|
|
9
|
+
export function mergeHeadElements(...lists) {
|
|
10
|
+
const elementMap = new Map()
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Function to get a unique key for a head element based on its type and attributes.
|
|
14
|
+
* @param {JSX.Element} element - The head element from which to derive a key.
|
|
15
|
+
* @returns {string} - A unique key representing the element.
|
|
16
|
+
*/
|
|
17
|
+
const getKey = (element) => {
|
|
18
|
+
const { type, props } = element
|
|
19
|
+
|
|
20
|
+
if (type === "title") {
|
|
21
|
+
return "title" // Only one title should exist in a document
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// For meta tags, use 'name' or 'property' as unique identifiers
|
|
25
|
+
if (type === "meta") {
|
|
26
|
+
if (props.charset) {
|
|
27
|
+
return "charset" // Charset should be unique in a document
|
|
28
|
+
}
|
|
29
|
+
return props.name || props.property || props["http-equiv"] || props.httpEquiv || ""
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// For link tags, use 'rel' as a unique identifier
|
|
33
|
+
// if (type === "link") {
|
|
34
|
+
// return props.rel || "";
|
|
35
|
+
// }
|
|
36
|
+
|
|
37
|
+
// Create a unique representation for other types of elements
|
|
38
|
+
return `${type}:${Object.entries(props)
|
|
39
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
40
|
+
.join(",")}`
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Loop through all the lists, ensuring later lists override earlier ones
|
|
44
|
+
lists?.forEach((list) => {
|
|
45
|
+
list?.forEach((element) => {
|
|
46
|
+
const key = getKey(element)
|
|
47
|
+
if (key) {
|
|
48
|
+
elementMap.set(key, element) // Overwrite earlier elements with later ones
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
// Return the combined list of head elements
|
|
54
|
+
return Array.from(elementMap.values())
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Deletes all elements in the head with a specific data attribute.
|
|
59
|
+
*
|
|
60
|
+
* @param {string} attributeName - The name of the data attribute to search for.
|
|
61
|
+
* @param {string} [attributeValue] - The specific value of the data attribute to match (optional).
|
|
62
|
+
*/
|
|
63
|
+
export function deleteHeadTagsByDataAttribute(attributeName, attributeValue) {
|
|
64
|
+
const head = document.head
|
|
65
|
+
const tagsToDelete = []
|
|
66
|
+
|
|
67
|
+
// Iterate over all children in the head section
|
|
68
|
+
Array.from(head.children).forEach((element) => {
|
|
69
|
+
const hasAttribute = element.hasAttribute(`data-${attributeName}`)
|
|
70
|
+
|
|
71
|
+
// If a specific attribute value is provided, check for it
|
|
72
|
+
if (attributeValue && hasAttribute) {
|
|
73
|
+
const matchesValue = element.getAttribute(`data-${attributeName}`) === attributeValue
|
|
74
|
+
if (matchesValue) {
|
|
75
|
+
tagsToDelete.push(element)
|
|
76
|
+
}
|
|
77
|
+
} else if (hasAttribute) {
|
|
78
|
+
// If no specific value, just check if the attribute is present
|
|
79
|
+
tagsToDelete.push(element)
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
// Delete all the tags that matched the attribute condition
|
|
84
|
+
tagsToDelete.forEach((tag) => {
|
|
85
|
+
head.removeChild(tag)
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Returns resolved array of meta data elements.
|
|
91
|
+
*
|
|
92
|
+
*
|
|
93
|
+
* @param {Array<Match>} matchedRoutes - Array of all matches.
|
|
94
|
+
* @param {Object} routeData - Data returned from Router.
|
|
95
|
+
* @returns {Array<JSX.Element>} - List of all meta tags for the matched location.
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
export function getMetaData(matchedRoutes, routeData) {
|
|
99
|
+
let allTags = []
|
|
100
|
+
try {
|
|
101
|
+
matchedRoutes?.forEach?.((match) => {
|
|
102
|
+
const setMetaData = match?.route?.component?.setMetaData
|
|
103
|
+
if (setMetaData) {
|
|
104
|
+
let tags = setMetaData(routeData)
|
|
105
|
+
allTags = [...allTags, tags]
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
if (Array.isArray(allTags) && allTags.length > 0) {
|
|
109
|
+
let mergedTags = mergeHeadElements(...allTags)
|
|
110
|
+
allTags = mergedTags.map((el, index) =>
|
|
111
|
+
React.cloneElement(el, { "data-catalyst": true, key: index })
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
} catch (er) {
|
|
115
|
+
console.log("meta tags error is ===>", er)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return allTags
|
|
119
|
+
}
|
|
@@ -11,17 +11,20 @@
|
|
|
11
11
|
"field: API_URL must be present"
|
|
12
12
|
],
|
|
13
13
|
"fix_guide": "Create config/config.json with: { NODE_SERVER_PORT: 3000, API_URL: 'https://api.example.com', CLIENT_ENV_KEYS: [], PUBLIC_STATIC_ASSET_URL: '', WEBVIEW_CONFIG: { port: 3000, accessControl: { enabled: true, allowedUrls: [] } } }",
|
|
14
|
-
"verify_hint": "Run `npm run
|
|
14
|
+
"verify_hint": "Run `npm run start` on Catalyst 0.3.x, or `npm run devServe` on legacy 0.2.x. The server should start without config errors.",
|
|
15
15
|
"depends_on": []
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"id": "T2_ROUTER_DEP",
|
|
19
19
|
"tier": 1,
|
|
20
|
-
"title": "
|
|
20
|
+
"title": "Router dependency matches the Catalyst runtime generation",
|
|
21
21
|
"detect_pattern": "package_json_dep",
|
|
22
|
-
"how_to_check": [
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
"how_to_check": [
|
|
23
|
+
"Catalyst 0.2.x: package.json includes @tata1mg/router and Catalyst router APIs import from it",
|
|
24
|
+
"Catalyst 0.3.x+: package.json does not include @tata1mg/router and Catalyst router APIs import from catalyst-core"
|
|
25
|
+
],
|
|
26
|
+
"fix_guide": "Version-specific: for Catalyst 0.2.x install @tata1mg/router and import RouterDataProvider, Outlet, navigation, and data hooks from it. For Catalyst 0.3.x+, remove @tata1mg/router and import those APIs from catalyst-core. Never mix the two router generations.",
|
|
27
|
+
"verify_hint": "Run the development command for the installed generation. Confirm there are no unresolved router imports, duplicate React-element errors, or blank route outlets.",
|
|
25
28
|
"depends_on": ["T1_CONFIG"]
|
|
26
29
|
},
|
|
27
30
|
{
|
|
@@ -34,7 +37,21 @@
|
|
|
34
37
|
"pattern: file must export an array (export default [ or module.exports = [)"
|
|
35
38
|
],
|
|
36
39
|
"fix_guide": "Create src/js/routes/index.js: import HomePage from '../pages/Home'; export default [{ path: '/', component: HomePage, exact: true }]. Add one entry per page component. Each component needs serverFetcher/clientFetcher attached (see T4_DATA_FETCHING).",
|
|
37
|
-
"verify_hint": "Run `npm run
|
|
40
|
+
"verify_hint": "Run `npm run start` on 0.3.x or `npm run devServe` on 0.2.x and open the first route. Check for blank output, 404s, or 'No routes matched' warnings.",
|
|
41
|
+
"depends_on": ["T2_ROUTER_DEP"]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "T2b_RUNTIME_DEPS",
|
|
45
|
+
"tier": 1,
|
|
46
|
+
"title": "React runtime matches the Catalyst generation",
|
|
47
|
+
"detect_pattern": "package_json_dep + version_check",
|
|
48
|
+
"how_to_check": [
|
|
49
|
+
"Catalyst 0.3.x+: react and react-dom are exactly 19.0.0",
|
|
50
|
+
"Catalyst 0.3.x+: @tata1mg/router and @loadable/component are absent",
|
|
51
|
+
"Catalyst 0.2.x: retain the React and loadable versions supported by that release"
|
|
52
|
+
],
|
|
53
|
+
"fix_guide": "For Catalyst 0.3.x+, set react and react-dom to exactly 19.0.0 without ^ or ~, remove @tata1mg/router and @loadable/component, and reinstall so the application and catalyst-core resolve one React runtime. Do not apply these dependency changes to an application staying on 0.2.x.",
|
|
54
|
+
"verify_hint": "Run npm ls react react-dom. A 0.3.x application should resolve React 19.0.0 without duplicate or invalid runtime copies.",
|
|
38
55
|
"depends_on": ["T2_ROUTER_DEP"]
|
|
39
56
|
},
|
|
40
57
|
{
|
|
@@ -51,7 +68,7 @@
|
|
|
51
68
|
"signal: files with .serverFetcher = or .clientFetcher = (converted pages)",
|
|
52
69
|
"llm judges: is any useEffect+fetch file a page component that needs conversion?"
|
|
53
70
|
],
|
|
54
|
-
"fix_guide": "For each page component:
|
|
71
|
+
"fix_guide": "For each page component: remove initial useEffect data loading, attach serverFetcher/clientFetcher statics, and read route data with useCurrentRouteData(). Import the hook from @tata1mg/router on 0.2.x or catalyst-core on 0.3.x+.",
|
|
55
72
|
"verify_hint": "Open a migrated page in browser. Open DevTools Network tab — on first load there should be NO XHR/fetch calls for page data (data arrives server-rendered in HTML). View Page Source and confirm the page content (not just a loading skeleton) is present in the raw HTML. If content is missing from source, serverFetcher is not attached or not running.",
|
|
56
73
|
"depends_on": ["T3_ROUTES_FILE"]
|
|
57
74
|
},
|
|
@@ -64,21 +81,21 @@
|
|
|
64
81
|
"file: src/js/routes/utils.js must exist",
|
|
65
82
|
"pattern: RouterDataProvider must be imported and used in utils.js"
|
|
66
83
|
],
|
|
67
|
-
"fix_guide": "Create src/js/routes/utils.js
|
|
84
|
+
"fix_guide": "Create src/js/routes/utils.js using the CCA preparedRoutes pattern. Import RouterDataProvider and MetaTag from @tata1mg/router on 0.2.x or catalyst-core on 0.3.x+. Wrap App and pass routerInitialState plus fetcherArgs when a store is used.",
|
|
68
85
|
"verify_hint": "In a page component that uses useCurrentRouteData(), console.log the return value. It should be the data object returned by serverFetcher — not undefined. If undefined, RouterDataProvider is not wrapping the tree or the route entry is missing the component reference.",
|
|
69
86
|
"depends_on": ["T3_ROUTES_FILE"]
|
|
70
87
|
},
|
|
71
88
|
{
|
|
72
89
|
"id": "T6_APP_SHELL",
|
|
73
90
|
"tier": 1,
|
|
74
|
-
"title": "App shell renders <Outlet />
|
|
91
|
+
"title": "App shell renders the generation-appropriate <Outlet />",
|
|
75
92
|
"detect_pattern": "file_exists + code_pattern",
|
|
76
93
|
"how_to_check": [
|
|
77
94
|
"file: src/js/containers/App/index.js must exist",
|
|
78
|
-
"pattern: Outlet
|
|
95
|
+
"pattern: Outlet comes from @tata1mg/router on 0.2.x or catalyst-core on 0.3.x+",
|
|
79
96
|
"pattern: <Outlet /> must be rendered in the component"
|
|
80
97
|
],
|
|
81
|
-
"fix_guide": "
|
|
98
|
+
"fix_guide": "Render <Outlet /> where route content belongs. Import it from @tata1mg/router on Catalyst 0.2.x or catalyst-core on 0.3.x+. Keep global layout around the outlet.",
|
|
82
99
|
"verify_hint": "Open the app in browser. Global layout (header, footer, nav) should appear on every page. The area where page content changes should not be blank. If page content area is empty, <Outlet /> is missing or placed incorrectly in the App shell.",
|
|
83
100
|
"depends_on": ["T5_ROUTER_DATA_PROVIDER"]
|
|
84
101
|
},
|
|
@@ -92,8 +109,8 @@
|
|
|
92
109
|
"file: server/server.js must exist",
|
|
93
110
|
"file: server/document.js must exist"
|
|
94
111
|
],
|
|
95
|
-
"fix_guide": "Create
|
|
96
|
-
"verify_hint": "Run
|
|
112
|
+
"fix_guide": "Create server/index.js, server/server.js, and server/document.js using the template for the installed generation. On 0.3.x these are ESM: server/index.js exports preServerInit, server/server.js exports addMiddlewares(app), and server/document.js exports a React document that renders Head and Body from catalyst-core. Preserve the legacy 0.2.x server contract when not upgrading.",
|
|
113
|
+
"verify_hint": "Run the generation-appropriate development command and inspect View Source. The response must contain the document shell and rendered application root.",
|
|
97
114
|
"depends_on": ["T1_CONFIG"]
|
|
98
115
|
},
|
|
99
116
|
{
|
|
@@ -108,9 +125,10 @@
|
|
|
108
125
|
"pattern: client/index.js must call WebBridge.init()",
|
|
109
126
|
"pattern: client/index.js must use hydrateRoot from 'react-dom/client' (not ReactDOM.render or hydrate)",
|
|
110
127
|
"pattern: client/index.js must import clientRouter from 'catalyst-core/router/ClientRouter'",
|
|
111
|
-
"pattern:
|
|
128
|
+
"pattern: RouterProvider comes from @tata1mg/router on 0.2.x or catalyst-core on 0.3.x+",
|
|
129
|
+
"pattern: 0.2.x waits for loadableReady; 0.3.x+ waits for hydrationReady"
|
|
112
130
|
],
|
|
113
|
-
"fix_guide": "
|
|
131
|
+
"fix_guide": "Use hydrateRoot and initialize WebBridge before hydration. On 0.2.x, import RouterProvider from @tata1mg/router and wait for loadableReady from @loadable/component. On 0.3.x+, import RouterProvider and hydrationReady from catalyst-core, then call hydrationReady().then(() => hydrateRoot(...)). Do not retain @loadable/component in the Vite runtime.",
|
|
114
132
|
"verify_hint": "Open the app in browser. Open DevTools Console — there should be no 'hydrateRoot' mismatch warnings (if there are, server HTML and client render differ). Open DevTools Elements — the #app or #root div should have React content inside it (not empty). Click an interactive element — if nothing responds, hydration failed. Also confirm global styles are applied (CSS loads).",
|
|
115
133
|
"depends_on": ["T6_APP_SHELL"]
|
|
116
134
|
},
|
|
@@ -127,8 +145,8 @@
|
|
|
127
145
|
"package.json scripts must include: setupEmulator:ios",
|
|
128
146
|
"package.json scripts must include: setupEmulator:android"
|
|
129
147
|
],
|
|
130
|
-
"fix_guide": "Add
|
|
131
|
-
"verify_hint": "Run `npm run
|
|
148
|
+
"fix_guide": "Add buildApp, buildApp:ios, buildApp:android, setupEmulator, setupEmulator:ios, and setupEmulator:android scripts. Legacy 0.2.x may also expose devBuild/devServe. Current 0.3.x removes those commands: use catalyst start for development and catalyst build followed by catalyst serve for production validation.",
|
|
149
|
+
"verify_hint": "Run `npm run start`, then verify the required platform command resolves. On 0.3.x, devBuild/devServe should not be present.",
|
|
132
150
|
"depends_on": ["T1_CONFIG"]
|
|
133
151
|
},
|
|
134
152
|
{
|