@base44-preview/cli 0.0.37-pr.364.24d182e → 0.0.37-pr.364.45ad860
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/cli/index.js +25 -31
- package/dist/cli/index.js.map +4 -4
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -246241,20 +246241,23 @@ var WATCH_QUEUE_DELAY_MS = 500;
|
|
|
246241
246241
|
class WatchBase44 extends EventEmitter4 {
|
|
246242
246242
|
itemsToWatch;
|
|
246243
246243
|
logger;
|
|
246244
|
+
entryNames;
|
|
246244
246245
|
watchers = new Map;
|
|
246245
246246
|
queueWaitForCreationTimeout = null;
|
|
246246
246247
|
constructor(itemsToWatch, logger) {
|
|
246247
246248
|
super();
|
|
246248
246249
|
this.itemsToWatch = itemsToWatch;
|
|
246249
246250
|
this.logger = logger;
|
|
246251
|
+
this.entryNames = Object.keys(itemsToWatch);
|
|
246250
246252
|
}
|
|
246251
246253
|
async start() {
|
|
246252
246254
|
if (this.watchers.size > 0) {
|
|
246253
246255
|
return;
|
|
246254
246256
|
}
|
|
246255
|
-
for (const
|
|
246256
|
-
|
|
246257
|
-
|
|
246257
|
+
for (const name2 of this.entryNames) {
|
|
246258
|
+
const targetPath = this.itemsToWatch[name2];
|
|
246259
|
+
if (await pathExists(targetPath)) {
|
|
246260
|
+
this.watchers.set(name2, this.watchTarget(name2, targetPath));
|
|
246258
246261
|
}
|
|
246259
246262
|
}
|
|
246260
246263
|
this.watchEntries();
|
|
@@ -246274,19 +246277,20 @@ class WatchBase44 extends EventEmitter4 {
|
|
|
246274
246277
|
clearTimeout(this.queueWaitForCreationTimeout);
|
|
246275
246278
|
}
|
|
246276
246279
|
this.queueWaitForCreationTimeout = setTimeout(async () => {
|
|
246277
|
-
for (const
|
|
246278
|
-
const
|
|
246279
|
-
const
|
|
246280
|
+
for (const name2 of this.entryNames) {
|
|
246281
|
+
const path19 = this.itemsToWatch[name2];
|
|
246282
|
+
const watchItem = this.watchers.get(name2);
|
|
246283
|
+
const exists = await pathExists(path19);
|
|
246280
246284
|
if (!watchItem && exists) {
|
|
246281
|
-
|
|
246282
|
-
this.watchers.set(
|
|
246285
|
+
this.emit("change", name2, path19);
|
|
246286
|
+
this.watchers.set(name2, this.watchTarget(name2, path19));
|
|
246283
246287
|
} else if (watchItem && !exists) {
|
|
246284
246288
|
await watchItem.close();
|
|
246285
|
-
|
|
246289
|
+
this.emit("change", name2, path19);
|
|
246286
246290
|
setTimeout(() => {
|
|
246287
|
-
this.watchers.forEach((watcher,
|
|
246291
|
+
this.watchers.forEach((watcher, watcherName) => {
|
|
246288
246292
|
if (watcher.closed) {
|
|
246289
|
-
this.watchers.delete(
|
|
246293
|
+
this.watchers.delete(watcherName);
|
|
246290
246294
|
}
|
|
246291
246295
|
});
|
|
246292
246296
|
});
|
|
@@ -246296,18 +246300,15 @@ class WatchBase44 extends EventEmitter4 {
|
|
|
246296
246300
|
this.watchEntries();
|
|
246297
246301
|
}, WATCH_QUEUE_DELAY_MS);
|
|
246298
246302
|
}
|
|
246299
|
-
|
|
246300
|
-
|
|
246301
|
-
this.emit("change", item.name, relative4(item.path, path19));
|
|
246302
|
-
}, WATCH_DEBOUNCE_MS);
|
|
246303
|
-
};
|
|
246304
|
-
watchTarget(item) {
|
|
246305
|
-
const watcher = watch(item.path, {
|
|
246303
|
+
watchTarget(name2, targetPath) {
|
|
246304
|
+
const watcher = watch(targetPath, {
|
|
246306
246305
|
ignoreInitial: true
|
|
246307
246306
|
});
|
|
246308
|
-
watcher.on("all",
|
|
246307
|
+
watcher.on("all", import_debounce.default(async (_event, path19) => {
|
|
246308
|
+
this.emit("change", name2, relative4(targetPath, path19));
|
|
246309
|
+
}, WATCH_DEBOUNCE_MS));
|
|
246309
246310
|
watcher.on("error", (err) => {
|
|
246310
|
-
this.logger.error(`
|
|
246311
|
+
this.logger.error(`Watch handler failed for ${targetPath}`, err instanceof Error ? err : undefined);
|
|
246311
246312
|
});
|
|
246312
246313
|
return watcher;
|
|
246313
246314
|
}
|
|
@@ -246381,19 +246382,13 @@ async function createDevServer(options8) {
|
|
|
246381
246382
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
246382
246383
|
};
|
|
246383
246384
|
const base44ConfigWatcher = new WatchBase44({
|
|
246384
|
-
functions:
|
|
246385
|
-
|
|
246386
|
-
path: join18(dirname14(project2.configPath), project2.functionsDir)
|
|
246387
|
-
},
|
|
246388
|
-
entities: {
|
|
246389
|
-
name: "entities",
|
|
246390
|
-
path: join18(dirname14(project2.configPath), project2.entitiesDir)
|
|
246391
|
-
}
|
|
246385
|
+
functions: join18(dirname14(project2.configPath), project2.functionsDir),
|
|
246386
|
+
entities: join18(dirname14(project2.configPath), project2.entitiesDir)
|
|
246392
246387
|
}, devLogger);
|
|
246393
246388
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
246394
246389
|
try {
|
|
246390
|
+
const { functions: functions2, entities: entities2 } = await options8.loadResources();
|
|
246395
246391
|
if (name2 === "functions") {
|
|
246396
|
-
const { functions: functions2 } = await options8.loadResources();
|
|
246397
246392
|
const previousFunctionCount = functionManager.getFunctionNames().length;
|
|
246398
246393
|
functionManager.reload(functions2);
|
|
246399
246394
|
const names = functionManager.getFunctionNames();
|
|
@@ -246405,7 +246400,6 @@ async function createDevServer(options8) {
|
|
|
246405
246400
|
}
|
|
246406
246401
|
if (name2 === "entities") {
|
|
246407
246402
|
const previousEntityCount = db2.getCollectionNames().length;
|
|
246408
|
-
const { entities: entities2 } = await options8.loadResources();
|
|
246409
246403
|
db2.dropAll();
|
|
246410
246404
|
if (previousEntityCount > 0) {
|
|
246411
246405
|
devLogger.log("Entities directory changed, clearing data...");
|
|
@@ -250805,4 +250799,4 @@ export {
|
|
|
250805
250799
|
CLIExitError
|
|
250806
250800
|
};
|
|
250807
250801
|
|
|
250808
|
-
//# debugId=
|
|
250802
|
+
//# debugId=1F612090E5DA7F5064756E2164756E21
|