@base44-preview/cli 0.0.37-pr.364.7a8fa09 → 0.0.37-pr.364.f1afd32

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 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 item of Object.values(this.itemsToWatch)) {
246256
- if (await pathExists(item.path)) {
246257
- this.watchers.set(item.name, this.watchTarget(item));
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 item of Object.values(this.itemsToWatch)) {
246278
- const watchItem = this.watchers.get(item.name);
246279
- const exists = await pathExists(item.path);
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
- this.emit("change", item.name, item.path);
246282
- this.watchers.set(item.name, this.watchTarget(item));
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
- this.emit("change", item.name, item.path);
246289
+ this.emit("change", name2, path19);
246286
246290
  setTimeout(() => {
246287
- this.watchers.forEach((watcher, name2) => {
246291
+ this.watchers.forEach((watcher, watcherName) => {
246288
246292
  if (watcher.closed) {
246289
- this.watchers.delete(name2);
246293
+ this.watchers.delete(watcherName);
246290
246294
  }
246291
246295
  });
246292
246296
  });
@@ -246296,15 +246300,15 @@ class WatchBase44 extends EventEmitter4 {
246296
246300
  this.watchEntries();
246297
246301
  }, WATCH_QUEUE_DELAY_MS);
246298
246302
  }
246299
- watchTarget(item) {
246300
- const watcher = watch(item.path, {
246303
+ watchTarget(name2, targetPath) {
246304
+ const watcher = watch(targetPath, {
246301
246305
  ignoreInitial: true
246302
246306
  });
246303
246307
  watcher.on("all", import_debounce.default(async (_event, path19) => {
246304
- this.emit("change", item.name, relative4(item.path, path19));
246308
+ this.emit("change", name2, relative4(targetPath, path19));
246305
246309
  }, WATCH_DEBOUNCE_MS));
246306
246310
  watcher.on("error", (err) => {
246307
- this.logger.error(`[dev-server] Watch handler failed for ${item.path}`, err instanceof Error ? err : undefined);
246311
+ this.logger.error(`[dev-server] Watch handler failed for ${targetPath}`, err instanceof Error ? err : undefined);
246308
246312
  });
246309
246313
  return watcher;
246310
246314
  }
@@ -246378,14 +246382,8 @@ async function createDevServer(options8) {
246378
246382
  broadcastEntityEvent(io6, appId, entityName, event);
246379
246383
  };
246380
246384
  const base44ConfigWatcher = new WatchBase44({
246381
- functions: {
246382
- name: "functions",
246383
- path: join18(dirname14(project2.configPath), project2.functionsDir)
246384
- },
246385
- entities: {
246386
- name: "entities",
246387
- path: join18(dirname14(project2.configPath), project2.entitiesDir)
246388
- }
246385
+ functions: join18(dirname14(project2.configPath), project2.functionsDir),
246386
+ entities: join18(dirname14(project2.configPath), project2.entitiesDir)
246389
246387
  }, devLogger);
246390
246388
  base44ConfigWatcher.on("change", async (name2) => {
246391
246389
  try {
@@ -250802,4 +250800,4 @@ export {
250802
250800
  CLIExitError
250803
250801
  };
250804
250802
 
250805
- //# debugId=8709F28AC0FAB59064756E2164756E21
250803
+ //# debugId=D4D6D0470D70803264756E2164756E21