@base44-preview/cli 0.1.1-pr.555.5e8fb00 → 0.1.1-pr.555.6305311

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
@@ -163947,7 +163947,7 @@ var require_view = __commonJS((exports, module) => {
163947
163947
  var dirname22 = path18.dirname;
163948
163948
  var basename7 = path18.basename;
163949
163949
  var extname2 = path18.extname;
163950
- var join27 = path18.join;
163950
+ var join28 = path18.join;
163951
163951
  var resolve12 = path18.resolve;
163952
163952
  module.exports = View;
163953
163953
  function View(name2, options8) {
@@ -164009,12 +164009,12 @@ var require_view = __commonJS((exports, module) => {
164009
164009
  };
164010
164010
  View.prototype.resolve = function resolve13(dir, file2) {
164011
164011
  var ext = this.ext;
164012
- var path19 = join27(dir, file2);
164012
+ var path19 = join28(dir, file2);
164013
164013
  var stat2 = tryStat(path19);
164014
164014
  if (stat2 && stat2.isFile()) {
164015
164015
  return path19;
164016
164016
  }
164017
- path19 = join27(dir, basename7(file2, ext), "index" + ext);
164017
+ path19 = join28(dir, basename7(file2, ext), "index" + ext);
164018
164018
  stat2 = tryStat(path19);
164019
164019
  if (stat2 && stat2.isFile()) {
164020
164020
  return path19;
@@ -167709,7 +167709,7 @@ var require_send = __commonJS((exports, module) => {
167709
167709
  var Stream2 = __require("stream");
167710
167710
  var util2 = __require("util");
167711
167711
  var extname2 = path18.extname;
167712
- var join27 = path18.join;
167712
+ var join28 = path18.join;
167713
167713
  var normalize2 = path18.normalize;
167714
167714
  var resolve12 = path18.resolve;
167715
167715
  var sep = path18.sep;
@@ -167881,7 +167881,7 @@ var require_send = __commonJS((exports, module) => {
167881
167881
  return res;
167882
167882
  }
167883
167883
  parts = path19.split(sep);
167884
- path19 = normalize2(join27(root2, path19));
167884
+ path19 = normalize2(join28(root2, path19));
167885
167885
  } else {
167886
167886
  if (UP_PATH_REGEXP.test(path19)) {
167887
167887
  debug('malicious path "%s"', path19);
@@ -168021,7 +168021,7 @@ var require_send = __commonJS((exports, module) => {
168021
168021
  return self2.onStatError(err);
168022
168022
  return self2.error(404);
168023
168023
  }
168024
- var p4 = join27(path19, self2._index[i5]);
168024
+ var p4 = join28(path19, self2._index[i5]);
168025
168025
  debug('stat "%s"', p4);
168026
168026
  fs28.stat(p4, function(err2, stat2) {
168027
168027
  if (err2)
@@ -214616,7 +214616,7 @@ var require_buffer_list = __commonJS((exports, module) => {
214616
214616
  }
214617
214617
  }, {
214618
214618
  key: "join",
214619
- value: function join27(s5) {
214619
+ value: function join28(s5) {
214620
214620
  if (this.length === 0)
214621
214621
  return "";
214622
214622
  var p4 = this.head;
@@ -234018,7 +234018,7 @@ function normalizeBase44Env() {
234018
234018
  loadProjectEnvFiles();
234019
234019
 
234020
234020
  // src/cli/index.ts
234021
- import { dirname as dirname26, join as join30 } from "node:path";
234021
+ import { dirname as dirname26, join as join31 } from "node:path";
234022
234022
  import { fileURLToPath as fileURLToPath6 } from "node:url";
234023
234023
 
234024
234024
  // ../../node_modules/@clack/core/dist/index.mjs
@@ -243807,7 +243807,7 @@ async function readRealtimeHandler(entryFile, realtimeDir) {
243807
243807
  }
243808
243808
  const entry = basename4(entryFile);
243809
243809
  const schemaPath = join10(handlerDir, "schema.jsonc");
243810
- let messageSchema = undefined;
243810
+ let messageSchema;
243811
243811
  if (await pathExists(schemaPath)) {
243812
243812
  const parsed = await readJsonFile(schemaPath);
243813
243813
  const result = RealtimeHandlerSchemaFileSchema.safeParse(parsed);
@@ -254675,6 +254675,7 @@ function getSiteCommand() {
254675
254675
  // src/core/types/generator.ts
254676
254676
  var import_common_tags = __toESM(require_lib2(), 1);
254677
254677
  var import_json_schema_to_typescript = __toESM(require_src3(), 1);
254678
+ import { join as join26 } from "node:path";
254678
254679
  var HEADER2 = import_common_tags.stripIndent`
254679
254680
  // Auto-generated by Base44 CLI - DO NOT EDIT
254680
254681
  // Regenerate with: base44 types generate
@@ -254691,12 +254692,28 @@ var EMPTY_TEMPLATE = import_common_tags.stripIndent`
254691
254692
  // No types to augment - add resources and regenerate
254692
254693
  }
254693
254694
  `;
254695
+ var SDK_PACKAGE_NAMES = ["@base44/sdk", "@base44-preview/sdk"];
254696
+ async function detectSdkPackageName(projectRoot) {
254697
+ try {
254698
+ const pkg = await readJsonFile(join26(projectRoot, "package.json"));
254699
+ const deps = {
254700
+ ...pkg.dependencies,
254701
+ ...pkg.devDependencies
254702
+ };
254703
+ for (const name2 of SDK_PACKAGE_NAMES) {
254704
+ if (name2 in deps)
254705
+ return name2;
254706
+ }
254707
+ } catch {}
254708
+ return "@base44/sdk";
254709
+ }
254694
254710
  async function generateTypesFile(input) {
254695
254711
  const content = await generateContent(input);
254696
254712
  await writeFile(getTypesOutputPath(input.projectRoot), content);
254697
254713
  }
254698
254714
  async function generateContent(input) {
254699
254715
  const { entities, functions, agents, connectors, realtimeHandlers } = input;
254716
+ const sdkPackage = await detectSdkPackageName(input.projectRoot);
254700
254717
  if (!entities.length && !functions.length && !agents.length && !connectors.length && !realtimeHandlers.length) {
254701
254718
  return EMPTY_TEMPLATE;
254702
254719
  }
@@ -254718,7 +254735,7 @@ async function generateContent(input) {
254718
254735
  ],
254719
254736
  [
254720
254737
  "RealtimeHandlerRegistry",
254721
- realtimeHandlers.filter((h5) => h5.messageSchema).map((h5, _10, arr) => {
254738
+ realtimeHandlers.filter((h5) => h5.messageSchema).map((h5, _10, _arr) => {
254722
254739
  const idx = realtimeHandlers.indexOf(h5);
254723
254740
  return `"${h5.name}": ${realtimeRegistryEntries[idx]};`;
254724
254741
  })
@@ -254727,11 +254744,12 @@ async function generateContent(input) {
254727
254744
  const registries2 = registryEntries.filter(([, entries]) => entries.length > 0).map(([name2, entries]) => registry2(name2, entries));
254728
254745
  return [
254729
254746
  HEADER2,
254747
+ "export {};",
254730
254748
  entityInterfaces.join(`
254731
254749
 
254732
254750
  `),
254733
254751
  import_common_tags.source`
254734
- declare module '@base44/sdk' {
254752
+ declare module '${sdkPackage}' {
254735
254753
  ${registries2.join(`
254736
254754
 
254737
254755
  `)}
@@ -254772,7 +254790,7 @@ async function compileRealtimeHandler(handler) {
254772
254790
  additionalProperties: false,
254773
254791
  strictIndexSignatures: true
254774
254792
  });
254775
- const match = ts8.match(/\{([^]*)\}/);
254793
+ const match = ts8.match(/\{([\s\S]*)\}/);
254776
254794
  return match ? `{
254777
254795
  ${match[1]}}` : "unknown";
254778
254796
  } catch {
@@ -254797,10 +254815,10 @@ function toPascalCase(name2) {
254797
254815
  return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
254798
254816
  }
254799
254817
  // src/core/types/update-project.ts
254800
- import { join as join26 } from "node:path";
254818
+ import { join as join27 } from "node:path";
254801
254819
  var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
254802
254820
  async function updateProjectConfig(projectRoot) {
254803
- const tsconfigPath = join26(projectRoot, "tsconfig.json");
254821
+ const tsconfigPath = join27(projectRoot, "tsconfig.json");
254804
254822
  if (!await pathExists(tsconfigPath)) {
254805
254823
  return false;
254806
254824
  }
@@ -254852,7 +254870,7 @@ function getTypesCommand() {
254852
254870
  // src/cli/dev/dev-server/main.ts
254853
254871
  var import_cors = __toESM(require_lib4(), 1);
254854
254872
  var import_express6 = __toESM(require_express(), 1);
254855
- import { dirname as dirname24, join as join29 } from "node:path";
254873
+ import { dirname as dirname24, join as join30 } from "node:path";
254856
254874
 
254857
254875
  // ../../node_modules/get-port/index.js
254858
254876
  import net from "node:net";
@@ -258272,8 +258290,8 @@ async function createDevServer(options8) {
258272
258290
  broadcastEntityEvent(io6, appId, entityName, event);
258273
258291
  };
258274
258292
  const base44ConfigWatcher = new WatchBase44({
258275
- functions: join29(dirname24(project2.configPath), project2.functionsDir),
258276
- entities: join29(dirname24(project2.configPath), project2.entitiesDir)
258293
+ functions: join30(dirname24(project2.configPath), project2.functionsDir),
258294
+ entities: join30(dirname24(project2.configPath), project2.entitiesDir)
258277
258295
  }, devLogger);
258278
258296
  base44ConfigWatcher.on("change", async (name2) => {
258279
258297
  try {
@@ -262839,7 +262857,7 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
262839
262857
  // src/cli/index.ts
262840
262858
  var __dirname4 = dirname26(fileURLToPath6(import.meta.url));
262841
262859
  async function runCLI(options8) {
262842
- ensureNpmAssets(join30(__dirname4, "../assets"));
262860
+ ensureNpmAssets(join31(__dirname4, "../assets"));
262843
262861
  const errorReporter = new ErrorReporter;
262844
262862
  errorReporter.registerProcessErrorHandlers();
262845
262863
  const jsonMode = process.argv.includes("--json");
@@ -262878,4 +262896,4 @@ export {
262878
262896
  CLIExitError
262879
262897
  };
262880
262898
 
262881
- //# debugId=EDDB07DEADDF53C864756E2164756E21
262899
+ //# debugId=8333EEB4A43A09C964756E2164756E21