@base44-preview/cli 0.0.36-pr.353.78f7c68 → 0.0.36-pr.353.7ba7a88

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
@@ -243860,7 +243860,7 @@ function getTypesCommand(context) {
243860
243860
  }
243861
243861
 
243862
243862
  // src/cli/dev/dev-server/main.ts
243863
- import { dirname as dirname15, join as join18 } from "node:path";
243863
+ import { dirname as dirname14 } from "node:path";
243864
243864
  var import_cors = __toESM(require_lib4(), 1);
243865
243865
  var import_express4 = __toESM(require_express(), 1);
243866
243866
 
@@ -244235,7 +244235,7 @@ class Database {
244235
244235
  }
244236
244236
 
244237
244237
  // src/cli/dev/dev-server/dir-watcher.ts
244238
- import { dirname as dirname14 } from "node:path";
244238
+ import { relative as relative4, sep } from "node:path";
244239
244239
 
244240
244240
  // node_modules/chokidar/index.js
244241
244241
  import { EventEmitter as EventEmitter3 } from "node:events";
@@ -245852,14 +245852,13 @@ function watch(paths, options8 = {}) {
245852
245852
  var import_debounce = __toESM(require_debounce(), 1);
245853
245853
  var WATCH_DEBOUNCE_MS = 300;
245854
245854
 
245855
- class DirWatcher {
245856
- targetDir;
245855
+ class WatchBase44Directory {
245856
+ configDir;
245857
245857
  onChange;
245858
245858
  logger;
245859
245859
  watcher = null;
245860
- closed = false;
245861
- constructor(targetDir, onChange, logger) {
245862
- this.targetDir = targetDir;
245860
+ constructor(configDir, onChange, logger) {
245861
+ this.configDir = configDir;
245863
245862
  this.onChange = onChange;
245864
245863
  this.logger = logger;
245865
245864
  }
@@ -245867,59 +245866,39 @@ class DirWatcher {
245867
245866
  if (this.watcher) {
245868
245867
  return;
245869
245868
  }
245870
- if (await pathExists(this.targetDir)) {
245869
+ if (await pathExists(this.configDir)) {
245871
245870
  this.watchTarget();
245872
- } else {
245873
- this.watchParentForCreation();
245874
245871
  }
245875
245872
  }
245876
- close() {
245877
- this.closed = true;
245878
- this.watcher?.close();
245873
+ async close() {
245874
+ await this.watcher?.close();
245879
245875
  this.watcher = null;
245880
245876
  }
245881
- watchTarget() {
245882
- if (this.closed) {
245877
+ getSubfolder(path18) {
245878
+ const rel = relative4(this.configDir, path18);
245879
+ if (!rel || rel === ".")
245883
245880
  return;
245884
- }
245885
- const handler = import_debounce.default(async () => {
245886
- try {
245887
- await this.onChange();
245888
- } catch (error48) {
245889
- this.handleError(error48);
245890
- }
245891
- }, WATCH_DEBOUNCE_MS);
245892
- this.watcher = watch(this.targetDir, { ignoreInitial: true });
245893
- this.watcher.on("all", handler);
245894
- this.watcher.on("error", (err) => this.handleError(err));
245881
+ return rel.split(sep)[0];
245895
245882
  }
245896
- watchParentForCreation() {
245897
- if (this.closed) {
245898
- return;
245899
- }
245900
- const parentDir = dirname14(this.targetDir);
245901
- const handler = import_debounce.default(async () => {
245902
- if (this.closed) {
245903
- return;
245904
- }
245905
- if (await pathExists(this.targetDir)) {
245906
- handler.cancel();
245907
- await this.watcher?.close();
245908
- this.watcher = null;
245909
- this.watchTarget();
245910
- try {
245911
- await this.onChange();
245912
- } catch (error48) {
245913
- this.handleError(error48);
245883
+ watchTarget() {
245884
+ const handler = import_debounce.default(async (_event, path18) => {
245885
+ const subfolder = this.getSubfolder(path18);
245886
+ await this.onChange(subfolder);
245887
+ }, WATCH_DEBOUNCE_MS);
245888
+ this.watcher = watch(this.configDir, {
245889
+ ignoreInitial: true,
245890
+ ignored: (filePath) => {
245891
+ if (this.configDir === filePath) {
245892
+ return false;
245914
245893
  }
245894
+ const subfolder = this.getSubfolder(filePath);
245895
+ return subfolder !== "functions";
245915
245896
  }
245916
- }, WATCH_DEBOUNCE_MS);
245917
- this.watcher = watch(parentDir, { ignoreInitial: true, depth: 0 });
245897
+ });
245918
245898
  this.watcher.on("all", handler);
245919
- this.watcher.on("error", (err) => this.handleError(err));
245920
- }
245921
- handleError(error48) {
245922
- this.logger.error(`[dev-server] Watch handler failed for ${this.targetDir}`, error48 instanceof Error ? error48 : undefined);
245899
+ this.watcher.on("error", (err) => {
245900
+ this.logger.error(`[dev-server] Watch handler failed for ${this.configDir}`, err instanceof Error ? err : undefined);
245901
+ });
245923
245902
  }
245924
245903
  }
245925
245904
 
@@ -246340,22 +246319,23 @@ async function createDevServer(options8) {
246340
246319
  emitEntityEvent = (appId, entityName, event) => {
246341
246320
  broadcastEntityEvent(io6, appId, entityName, event);
246342
246321
  };
246343
- const configDir = dirname15(project2.configPath);
246344
- const functionsDir = join18(configDir, project2.functionsDir);
246345
- const functionsWatcher = new DirWatcher(functionsDir, async () => {
246346
- const { functions: functions2 } = await options8.loadResources();
246347
- const previousFunctionCount = functionManager.getFunctionNames().length;
246348
- functionManager.reload(functions2);
246349
- const names = functionManager.getFunctionNames();
246350
- if (names.length > 0) {
246351
- devLogger.log(`Reloaded functions: ${names.sort().join(", ")}`);
246352
- } else if (previousFunctionCount > 0) {
246353
- devLogger.log("All functions removed");
246322
+ const configDir = dirname14(project2.configPath);
246323
+ const base44ConfigWatcher = new WatchBase44Directory(configDir, async (subfolder) => {
246324
+ if (subfolder === "functions") {
246325
+ const { functions: functions2 } = await options8.loadResources();
246326
+ const previousFunctionCount = functionManager.getFunctionNames().length;
246327
+ functionManager.reload(functions2);
246328
+ const names = functionManager.getFunctionNames();
246329
+ if (names.length > 0) {
246330
+ devLogger.log(`Reloaded functions: ${names.sort().join(", ")}`);
246331
+ } else if (previousFunctionCount > 0) {
246332
+ devLogger.log("All functions removed");
246333
+ }
246354
246334
  }
246355
246335
  }, devLogger);
246356
- await functionsWatcher.start();
246336
+ await base44ConfigWatcher.start();
246357
246337
  const shutdown = () => {
246358
- functionsWatcher.close();
246338
+ base44ConfigWatcher.close();
246359
246339
  io6.close();
246360
246340
  functionManager.stopAll();
246361
246341
  server.close();
@@ -246511,7 +246491,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
246511
246491
  import { release, type } from "node:os";
246512
246492
 
246513
246493
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
246514
- import { dirname as dirname16, posix, sep } from "path";
246494
+ import { dirname as dirname15, posix, sep as sep2 } from "path";
246515
246495
  function createModulerModifier() {
246516
246496
  const getModuleFromFileName = createGetModuleFromFilename();
246517
246497
  return async (frames) => {
@@ -246520,7 +246500,7 @@ function createModulerModifier() {
246520
246500
  return frames;
246521
246501
  };
246522
246502
  }
246523
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname16(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
246503
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows5 = sep2 === "\\") {
246524
246504
  const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
246525
246505
  return (filename) => {
246526
246506
  if (!filename)
@@ -250738,4 +250718,4 @@ export {
250738
250718
  CLIExitError
250739
250719
  };
250740
250720
 
250741
- //# debugId=AFD2B8CB8876F48464756E2164756E21
250721
+ //# debugId=4A92F9A4AF137C7F64756E2164756E21