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
|
@@ -1,22 +1,72 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.base64ToFile = base64ToFile;
|
|
7
|
+
exports.canCreateFileObject = canCreateFileObject;
|
|
8
|
+
exports.getUnsupportedTransportMessage = getUnsupportedTransportMessage;
|
|
9
|
+
exports.urlToFile = urlToFile;
|
|
10
|
+
/**
|
|
2
11
|
* FileObjectConverter
|
|
3
12
|
* Converts base64 and URL file data to JavaScript File objects
|
|
4
13
|
* for direct use in FormData and POST API calls
|
|
5
|
-
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
6
17
|
* Convert base64 data URI to File object (synchronous)
|
|
7
18
|
* @param {string} base64String - Base64 data URI (e.g., "data:image/jpeg;base64,...")
|
|
8
19
|
* @param {string} filename - Desired filename for the File object
|
|
9
20
|
* @param {string} mimeType - MIME type (e.g., "image/jpeg")
|
|
10
21
|
* @returns {File} JavaScript File object
|
|
11
22
|
* @throws {Error} If base64 string is invalid or conversion fails
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
*/
|
|
24
|
+
function base64ToFile(base64String, filename, mimeType) {
|
|
25
|
+
try {
|
|
26
|
+
// Validate inputs
|
|
27
|
+
if (!base64String || typeof base64String !== "string") {
|
|
28
|
+
throw new Error("Invalid base64 string provided");
|
|
29
|
+
}
|
|
30
|
+
if (!filename || typeof filename !== "string") {
|
|
31
|
+
throw new Error("Invalid filename provided");
|
|
32
|
+
}
|
|
33
|
+
if (!mimeType || typeof mimeType !== "string") {
|
|
34
|
+
throw new Error("Invalid MIME type provided");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Extract base64 data from data URI
|
|
38
|
+
// Format: "data:image/jpeg;base64,/9j/4AAQSkZJRg..."
|
|
39
|
+
const base64Data = base64String.includes(",") ? base64String.split(",")[1] : base64String;
|
|
40
|
+
|
|
41
|
+
// Decode base64 to binary string
|
|
42
|
+
const binaryString = atob(base64Data);
|
|
43
|
+
|
|
44
|
+
// Convert binary string to byte array
|
|
45
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
46
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
47
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Create Blob from byte array
|
|
51
|
+
const blob = new Blob([bytes], {
|
|
52
|
+
type: mimeType
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Create and return File object
|
|
56
|
+
return new File([blob], filename, {
|
|
57
|
+
type: mimeType
|
|
58
|
+
});
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error("❌ FileObjectConverter: base64ToFile failed", {
|
|
61
|
+
filename,
|
|
62
|
+
mimeType,
|
|
63
|
+
error: error.message
|
|
64
|
+
});
|
|
65
|
+
throw new Error(`Failed to convert base64 to File: ${error.message}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
20
70
|
* Fetch file from URL and convert to File object (asynchronous)
|
|
21
71
|
* Used for Framework Server routes (localhost:8080)
|
|
22
72
|
* @param {string} url - File URL (e.g., "http://localhost:8080/file/xyz")
|
|
@@ -24,17 +74,78 @@ return new File([blob],filename,{type:mimeType});}catch(error){console.error("
|
|
|
24
74
|
* @param {string} mimeType - MIME type (e.g., "image/jpeg")
|
|
25
75
|
* @returns {Promise<File>} JavaScript File object
|
|
26
76
|
* @throws {Error} If fetch fails or conversion fails
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
77
|
+
*/
|
|
78
|
+
async function urlToFile(url, filename, mimeType) {
|
|
79
|
+
try {
|
|
80
|
+
// Validate inputs
|
|
81
|
+
if (!url || typeof url !== "string") {
|
|
82
|
+
throw new Error("Invalid URL provided");
|
|
83
|
+
}
|
|
84
|
+
if (!filename || typeof filename !== "string") {
|
|
85
|
+
throw new Error("Invalid filename provided");
|
|
86
|
+
}
|
|
87
|
+
if (!mimeType || typeof mimeType !== "string") {
|
|
88
|
+
throw new Error("Invalid MIME type provided");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Validate localhost URL for security
|
|
92
|
+
if (!url.includes("localhost") && !url.includes("127.0.0.1")) {
|
|
93
|
+
throw new Error("Only localhost URLs are supported for security reasons");
|
|
94
|
+
}
|
|
95
|
+
console.log("🔄 FileObjectConverter: Fetching file from Framework Server", {
|
|
96
|
+
url,
|
|
97
|
+
filename,
|
|
98
|
+
mimeType
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Fetch file from Framework Server
|
|
102
|
+
const response = await fetch(url);
|
|
103
|
+
if (!response.ok) {
|
|
104
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Convert response to Blob
|
|
108
|
+
const blob = await response.blob();
|
|
109
|
+
|
|
110
|
+
// Create and return File object
|
|
111
|
+
const file = new File([blob], filename, {
|
|
112
|
+
type: mimeType
|
|
113
|
+
});
|
|
114
|
+
console.log("✅ FileObjectConverter: File object created successfully", {
|
|
115
|
+
filename,
|
|
116
|
+
size: file.size,
|
|
117
|
+
type: file.type
|
|
118
|
+
});
|
|
119
|
+
return file;
|
|
120
|
+
} catch (error) {
|
|
121
|
+
console.error("❌ FileObjectConverter: urlToFile failed", {
|
|
122
|
+
url,
|
|
123
|
+
filename,
|
|
124
|
+
mimeType,
|
|
125
|
+
error: error.message
|
|
126
|
+
});
|
|
127
|
+
throw new Error(`Failed to fetch and convert URL to File: ${error.message}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
33
132
|
* Check if a File object can be created from the given transport type
|
|
34
133
|
* @param {string} transport - Transport type (BRIDGE_BASE64, FRAMEWORK_SERVER, CONTENT_PROVIDER)
|
|
35
134
|
* @returns {boolean} True if File object can be created
|
|
36
|
-
*/
|
|
135
|
+
*/
|
|
136
|
+
function canCreateFileObject(transport) {
|
|
137
|
+
const supportedTransports = ["BRIDGE_BASE64", "FRAMEWORK_SERVER"];
|
|
138
|
+
return supportedTransports.includes(transport);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
37
142
|
* Get user-friendly error message for unsupported transport
|
|
38
143
|
* @param {string} transport - Transport type
|
|
39
144
|
* @returns {string} Error message
|
|
40
|
-
*/
|
|
145
|
+
*/
|
|
146
|
+
function getUnsupportedTransportMessage(transport) {
|
|
147
|
+
if (transport === "CONTENT_PROVIDER") {
|
|
148
|
+
return "File object creation is not supported for CONTENT_PROVIDER transport. Use base64 data instead.";
|
|
149
|
+
}
|
|
150
|
+
return `File object creation is not supported for transport type: ${transport}`;
|
|
151
|
+
}
|