@kya-os/mcp-i 1.5.9-canary.13 ā 1.5.9-canary.15
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/dist/compiler/index.js +33 -7
- package/package.json +1 -1
package/dist/compiler/index.js
CHANGED
|
@@ -41,25 +41,33 @@ const path_validation_1 = require("../utils/path-validation");
|
|
|
41
41
|
const utils_1 = require("./config/utils");
|
|
42
42
|
dotenv_1.default.config();
|
|
43
43
|
async function compile({ onBuild, platform } = {}) {
|
|
44
|
+
console.log('[COMPILER] compile() called with platform:', platform);
|
|
44
45
|
// Initialize compiler context if not already set
|
|
45
46
|
const mode = process.env.NODE_ENV === "production" ? "production" : "development";
|
|
47
|
+
console.log('[COMPILER] Mode determined:', mode);
|
|
48
|
+
console.log('[COMPILER] NODE_ENV:', process.env.NODE_ENV);
|
|
46
49
|
// Use compiler context provider to set up the context properly
|
|
47
50
|
return new Promise((resolve, reject) => {
|
|
51
|
+
console.log('[COMPILER] Creating promise for compilation');
|
|
48
52
|
(0, compiler_context_1.compilerContextProvider)({
|
|
49
53
|
mode,
|
|
50
54
|
projectRoot: process.cwd(),
|
|
51
55
|
platforms: {},
|
|
52
56
|
}, () => {
|
|
57
|
+
console.log('[COMPILER] Calling compileInternal');
|
|
53
58
|
compileInternal({ onBuild, platform }).then(resolve).catch(reject);
|
|
54
59
|
});
|
|
55
60
|
});
|
|
56
61
|
}
|
|
57
62
|
async function compileInternal({ onBuild, platform } = {}) {
|
|
63
|
+
console.log('[COMPILER] compileInternal() starting - platform:', platform);
|
|
58
64
|
const { mode } = compiler_context_1.compilerContext.getContext();
|
|
59
65
|
const { toolPaths } = compiler_context_1.compilerContext.getContext();
|
|
66
|
+
console.log('[COMPILER] compileInternal() - mode from context:', mode);
|
|
60
67
|
const startTime = Date.now();
|
|
61
68
|
let compilerStarted = false;
|
|
62
69
|
const xmpcConfig = await (0, parse_xmcp_config_1.getConfig)();
|
|
70
|
+
console.log('[COMPILER] Config loaded, http:', !!xmpcConfig.http, 'stdio:', !!xmpcConfig.stdio);
|
|
63
71
|
compiler_context_1.compilerContext.setContext({
|
|
64
72
|
xmcpConfig: xmpcConfig,
|
|
65
73
|
});
|
|
@@ -114,6 +122,7 @@ async function compileInternal({ onBuild, platform } = {}) {
|
|
|
114
122
|
}
|
|
115
123
|
// start compiler
|
|
116
124
|
watcher.onReady(() => {
|
|
125
|
+
console.log('[COMPILER] Watcher ready - initializing compilation');
|
|
117
126
|
let firstBuild = true;
|
|
118
127
|
compilerStarted = true;
|
|
119
128
|
// delete existing runtime folder
|
|
@@ -122,6 +131,7 @@ async function compileInternal({ onBuild, platform } = {}) {
|
|
|
122
131
|
generateCode();
|
|
123
132
|
const compiler = (0, webpack_1.webpack)(webpackConfig);
|
|
124
133
|
const handleCompilation = (err, stats) => {
|
|
134
|
+
console.log('[COMPILER] handleCompilation callback called - err:', !!err, 'stats:', !!stats, 'firstBuild:', firstBuild);
|
|
125
135
|
if (err) {
|
|
126
136
|
console.error(err);
|
|
127
137
|
reject(err);
|
|
@@ -143,35 +153,51 @@ async function compileInternal({ onBuild, platform } = {}) {
|
|
|
143
153
|
console.log(`${cli_icons_1.greenCheck} Compiled in ${chalk.bold.green(`${duration}ms`)}`);
|
|
144
154
|
(0, on_first_build_1.onFirstBuild)(mode, xmpcConfig);
|
|
145
155
|
onBuild?.();
|
|
156
|
+
console.log('[COMPILER] First build completed - mode:', mode, 'platform:', platform);
|
|
146
157
|
// In production mode, close watcher and compiler, then resolve
|
|
147
158
|
if (mode === "production") {
|
|
159
|
+
console.log('[COMPILER] Production mode detected - platform:', platform);
|
|
148
160
|
watcher.close().then(async () => {
|
|
149
161
|
// Close webpack compiler to release all resources
|
|
150
|
-
compiler.close(
|
|
162
|
+
compiler.close((compilerCloseErr) => {
|
|
151
163
|
if (compilerCloseErr) {
|
|
152
164
|
console.error('Error closing webpack compiler:', compilerCloseErr);
|
|
153
165
|
reject(compilerCloseErr);
|
|
166
|
+
return;
|
|
154
167
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
168
|
+
console.log('[COMPILER] Compiler closed successfully');
|
|
169
|
+
console.log('[COMPILER] Platform value in callback:', platform);
|
|
170
|
+
console.log('[COMPILER] Checking if platform === "vercel":', platform === 'vercel');
|
|
171
|
+
// Platform-specific post-build steps (must be handled after compiler.close completes)
|
|
172
|
+
if (platform === 'vercel') {
|
|
173
|
+
console.log('[COMPILER] Vercel platform detected! Starting async build...');
|
|
174
|
+
// Wrap async operations in a separate async function
|
|
175
|
+
(async () => {
|
|
158
176
|
try {
|
|
177
|
+
console.log('[COMPILER] Inside async IIFE');
|
|
159
178
|
console.log('\nš¦ Building Vercel deployment package...');
|
|
160
179
|
// Dynamic import of Vercel build utilities
|
|
161
180
|
// This will be available when @kya-os/mcp-i-vercel is installed
|
|
181
|
+
console.log('[COMPILER] Attempting dynamic import of @kya-os/mcp-i-vercel/build');
|
|
162
182
|
const vercelModule = await import('@kya-os/mcp-i-vercel/build').catch((importErr) => {
|
|
183
|
+
console.error('[COMPILER] Dynamic import failed:', importErr);
|
|
163
184
|
throw new Error(`Cannot find @kya-os/mcp-i-vercel package. ` +
|
|
164
185
|
`Install it with: npm install @kya-os/mcp-i-vercel\n` +
|
|
165
186
|
`Original error: ${importErr instanceof Error ? importErr.message : String(importErr)}`);
|
|
166
187
|
});
|
|
188
|
+
console.log('[COMPILER] Dynamic import successful');
|
|
189
|
+
console.log('[COMPILER] Calling buildVercelOutput()');
|
|
167
190
|
await vercelModule.buildVercelOutput();
|
|
191
|
+
console.log('[COMPILER] buildVercelOutput() completed');
|
|
192
|
+
resolve();
|
|
168
193
|
}
|
|
169
194
|
catch (vercelBuildErr) {
|
|
170
|
-
console.error('Error building Vercel output:', vercelBuildErr);
|
|
195
|
+
console.error('[COMPILER] Error building Vercel output:', vercelBuildErr);
|
|
171
196
|
reject(vercelBuildErr);
|
|
172
|
-
return;
|
|
173
197
|
}
|
|
174
|
-
}
|
|
198
|
+
})();
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
175
201
|
resolve();
|
|
176
202
|
}
|
|
177
203
|
});
|