@base44-preview/cli 0.0.36-pr.353.ee448e6 → 0.0.36-pr.353.f5250a0

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
 
@@ -244068,6 +244068,10 @@ class FunctionManager {
244068
244068
  try {
244069
244069
  return await promise2;
244070
244070
  } finally {
244071
+ if (!this.starting.has(name2) && this.running.has(name2)) {
244072
+ this.running.get(name2)?.process.kill();
244073
+ this.running.delete(name2);
244074
+ }
244071
244075
  this.starting.delete(name2);
244072
244076
  }
244073
244077
  }
@@ -244235,7 +244239,7 @@ class Database {
244235
244239
  }
244236
244240
 
244237
244241
  // src/cli/dev/dev-server/dir-watcher.ts
244238
- import { dirname as dirname14 } from "node:path";
244242
+ import { relative as relative4, sep } from "node:path";
244239
244243
 
244240
244244
  // node_modules/chokidar/index.js
244241
244245
  import { EventEmitter as EventEmitter3 } from "node:events";
@@ -245852,14 +245856,13 @@ function watch(paths, options8 = {}) {
245852
245856
  var import_debounce = __toESM(require_debounce(), 1);
245853
245857
  var WATCH_DEBOUNCE_MS = 300;
245854
245858
 
245855
- class DirWatcher {
245856
- targetDir;
245859
+ class WatchBase44Directory {
245860
+ configDir;
245857
245861
  onChange;
245858
245862
  logger;
245859
245863
  watcher = null;
245860
- closed = false;
245861
- constructor(targetDir, onChange, logger) {
245862
- this.targetDir = targetDir;
245864
+ constructor(configDir, onChange, logger) {
245865
+ this.configDir = configDir;
245863
245866
  this.onChange = onChange;
245864
245867
  this.logger = logger;
245865
245868
  }
@@ -245867,59 +245870,39 @@ class DirWatcher {
245867
245870
  if (this.watcher) {
245868
245871
  return;
245869
245872
  }
245870
- if (await pathExists(this.targetDir)) {
245873
+ if (await pathExists(this.configDir)) {
245871
245874
  this.watchTarget();
245872
- } else {
245873
- this.watchParentForCreation();
245874
245875
  }
245875
245876
  }
245876
- close() {
245877
- this.closed = true;
245878
- this.watcher?.close();
245877
+ async close() {
245878
+ await this.watcher?.close();
245879
245879
  this.watcher = null;
245880
245880
  }
245881
- watchTarget() {
245882
- if (this.closed) {
245881
+ getSubfolder(path18) {
245882
+ const rel = relative4(this.configDir, path18);
245883
+ if (!rel || rel === ".")
245883
245884
  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));
245885
+ return rel.split(sep)[0];
245895
245886
  }
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);
245887
+ watchTarget() {
245888
+ const handler = import_debounce.default(async (_event, path18) => {
245889
+ const subfolder = this.getSubfolder(path18);
245890
+ await this.onChange(subfolder);
245891
+ }, WATCH_DEBOUNCE_MS);
245892
+ this.watcher = watch(this.configDir, {
245893
+ ignoreInitial: true,
245894
+ ignored: (filePath) => {
245895
+ if (this.configDir === filePath) {
245896
+ return false;
245914
245897
  }
245898
+ const subfolder = this.getSubfolder(filePath);
245899
+ return subfolder !== "functions";
245915
245900
  }
245916
- }, WATCH_DEBOUNCE_MS);
245917
- this.watcher = watch(parentDir, { ignoreInitial: true, depth: 0 });
245901
+ });
245918
245902
  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);
245903
+ this.watcher.on("error", (err) => {
245904
+ this.logger.error(`[dev-server] Watch handler failed for ${this.configDir}`, err instanceof Error ? err : undefined);
245905
+ });
245923
245906
  }
245924
245907
  }
245925
245908
 
@@ -246340,22 +246323,23 @@ async function createDevServer(options8) {
246340
246323
  emitEntityEvent = (appId, entityName, event) => {
246341
246324
  broadcastEntityEvent(io6, appId, entityName, event);
246342
246325
  };
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");
246326
+ const configDir = dirname14(project2.configPath);
246327
+ const base44ConfigWatcher = new WatchBase44Directory(configDir, async (subfolder) => {
246328
+ if (subfolder === "functions") {
246329
+ const { functions: functions2 } = await options8.loadResources();
246330
+ const previousFunctionCount = functionManager.getFunctionNames().length;
246331
+ functionManager.reload(functions2);
246332
+ const names = functionManager.getFunctionNames();
246333
+ if (names.length > 0) {
246334
+ devLogger.log(`Reloaded functions: ${names.sort().join(", ")}`);
246335
+ } else if (previousFunctionCount > 0) {
246336
+ devLogger.log("All functions removed");
246337
+ }
246354
246338
  }
246355
246339
  }, devLogger);
246356
- await functionsWatcher.start();
246340
+ await base44ConfigWatcher.start();
246357
246341
  const shutdown = () => {
246358
- functionsWatcher.close();
246342
+ base44ConfigWatcher.close();
246359
246343
  io6.close();
246360
246344
  functionManager.stopAll();
246361
246345
  server.close();
@@ -246511,7 +246495,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
246511
246495
  import { release, type } from "node:os";
246512
246496
 
246513
246497
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
246514
- import { dirname as dirname16, posix, sep } from "path";
246498
+ import { dirname as dirname15, posix, sep as sep2 } from "path";
246515
246499
  function createModulerModifier() {
246516
246500
  const getModuleFromFileName = createGetModuleFromFilename();
246517
246501
  return async (frames) => {
@@ -246520,7 +246504,7 @@ function createModulerModifier() {
246520
246504
  return frames;
246521
246505
  };
246522
246506
  }
246523
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname16(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
246507
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows5 = sep2 === "\\") {
246524
246508
  const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
246525
246509
  return (filename) => {
246526
246510
  if (!filename)
@@ -250738,4 +250722,4 @@ export {
250738
250722
  CLIExitError
250739
250723
  };
250740
250724
 
250741
- //# debugId=AFD2B8CB8876F48464756E2164756E21
250725
+ //# debugId=0FDE3E45A7228AE164756E2164756E21