@base44-preview/cli 0.0.36-pr.353.17ecffc → 0.0.36-pr.353.3c9b882

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
 
@@ -244128,7 +244128,9 @@ class FunctionManager {
244128
244128
  }
244129
244129
  });
244130
244130
  process21.on("exit", (code2) => {
244131
- this.logger.log(`[dev-server] Function "${name2}" exited with code ${code2}`);
244131
+ if (code2 !== null) {
244132
+ this.logger.log(`[dev-server] Function "${name2}" exited with code ${code2}`);
244133
+ }
244132
244134
  this.running.delete(name2);
244133
244135
  });
244134
244136
  process21.on("error", (error48) => {
@@ -244233,7 +244235,7 @@ class Database {
244233
244235
  }
244234
244236
 
244235
244237
  // src/cli/dev/dev-server/dir-watcher.ts
244236
- import { dirname as dirname14 } from "node:path";
244238
+ import { relative as relative4, sep } from "node:path";
244237
244239
 
244238
244240
  // node_modules/chokidar/index.js
244239
244241
  import { EventEmitter as EventEmitter3 } from "node:events";
@@ -245850,69 +245852,53 @@ function watch(paths, options8 = {}) {
245850
245852
  var import_debounce = __toESM(require_debounce(), 1);
245851
245853
  var WATCH_DEBOUNCE_MS = 300;
245852
245854
 
245853
- class DirWatcher {
245854
- targetDir;
245855
+ class WatchBase44Directory {
245856
+ configDir;
245855
245857
  onChange;
245856
245858
  logger;
245857
245859
  watcher = null;
245858
- closed = false;
245859
- constructor(targetDir, onChange, logger) {
245860
- this.targetDir = targetDir;
245860
+ constructor(configDir, onChange, logger) {
245861
+ this.configDir = configDir;
245861
245862
  this.onChange = onChange;
245862
245863
  this.logger = logger;
245863
245864
  }
245864
245865
  async start() {
245865
- if (await pathExists(this.targetDir)) {
245866
+ if (this.watcher) {
245867
+ return;
245868
+ }
245869
+ if (await pathExists(this.configDir)) {
245866
245870
  this.watchTarget();
245867
- } else {
245868
- this.watchParentForCreation();
245869
245871
  }
245870
245872
  }
245871
- close() {
245872
- this.closed = true;
245873
- this.watcher?.close();
245873
+ async close() {
245874
+ await this.watcher?.close();
245874
245875
  this.watcher = null;
245875
245876
  }
245876
- watchTarget() {
245877
- if (this.closed) {
245877
+ getSubfolder(path18) {
245878
+ const rel = relative4(this.configDir, path18);
245879
+ if (!rel || rel === ".")
245878
245880
  return;
245879
- }
245880
- const handler = import_debounce.default(async () => {
245881
- try {
245882
- await this.onChange();
245883
- } catch (error48) {
245884
- this.handleError(error48);
245885
- }
245886
- }, WATCH_DEBOUNCE_MS);
245887
- this.watcher = watch(this.targetDir, { ignoreInitial: true });
245888
- this.watcher.on("all", handler);
245881
+ return rel.split(sep)[0];
245889
245882
  }
245890
- watchParentForCreation() {
245891
- if (this.closed) {
245892
- return;
245893
- }
245894
- const parentDir = dirname14(this.targetDir);
245895
- const handler = import_debounce.default(async () => {
245896
- if (this.closed) {
245897
- return;
245898
- }
245899
- if (await pathExists(this.targetDir)) {
245900
- handler.cancel();
245901
- await this.watcher?.close();
245902
- this.watcher = null;
245903
- this.watchTarget();
245904
- try {
245905
- await this.onChange();
245906
- } catch (error48) {
245907
- 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;
245908
245893
  }
245894
+ const subfolder = this.getSubfolder(filePath);
245895
+ return subfolder !== "functions";
245909
245896
  }
245910
- }, WATCH_DEBOUNCE_MS);
245911
- this.watcher = watch(parentDir, { ignoreInitial: true, depth: 0 });
245897
+ });
245912
245898
  this.watcher.on("all", handler);
245913
- }
245914
- handleError(error48) {
245915
- 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
+ });
245916
245902
  }
245917
245903
  }
245918
245904
 
@@ -246333,22 +246319,23 @@ async function createDevServer(options8) {
246333
246319
  emitEntityEvent = (appId, entityName, event) => {
246334
246320
  broadcastEntityEvent(io6, appId, entityName, event);
246335
246321
  };
246336
- const configDir = dirname15(project2.configPath);
246337
- const functionsDir = join18(configDir, project2.functionsDir);
246338
- const functionsWatcher = new DirWatcher(functionsDir, async () => {
246339
- const { functions: functions2 } = await options8.loadResources();
246340
- const previousNamesLength = functionManager.getFunctionNames().length;
246341
- functionManager.reload(functions2);
246342
- const names = functionManager.getFunctionNames();
246343
- if (names.length > 0) {
246344
- devLogger.log(`Reloaded functions: ${names.sort().join(", ")}`);
246345
- } else if (previousNamesLength > 0) {
246346
- 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
+ }
246347
246334
  }
246348
246335
  }, devLogger);
246349
- await functionsWatcher.start();
246336
+ await base44ConfigWatcher.start();
246350
246337
  const shutdown = () => {
246351
- functionsWatcher.close();
246338
+ base44ConfigWatcher.close();
246352
246339
  io6.close();
246353
246340
  functionManager.stopAll();
246354
246341
  server.close();
@@ -246504,7 +246491,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
246504
246491
  import { release, type } from "node:os";
246505
246492
 
246506
246493
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
246507
- import { dirname as dirname16, posix, sep } from "path";
246494
+ import { dirname as dirname15, posix, sep as sep2 } from "path";
246508
246495
  function createModulerModifier() {
246509
246496
  const getModuleFromFileName = createGetModuleFromFilename();
246510
246497
  return async (frames) => {
@@ -246513,7 +246500,7 @@ function createModulerModifier() {
246513
246500
  return frames;
246514
246501
  };
246515
246502
  }
246516
- 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 === "\\") {
246517
246504
  const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
246518
246505
  return (filename) => {
246519
246506
  if (!filename)
@@ -250731,4 +250718,4 @@ export {
250731
250718
  CLIExitError
250732
250719
  };
250733
250720
 
250734
- //# debugId=34515ECB16FFFDAF64756E2164756E21
250721
+ //# debugId=4A92F9A4AF137C7F64756E2164756E21