@sidecar-ai/cli 0.1.0-alpha.7 → 0.1.0-alpha.9

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/index.js CHANGED
@@ -897,6 +897,7 @@ function warnRuntimeSchemaFallback(sourcePath, error) {
897
897
  import { createHash } from "crypto";
898
898
  import { existsSync as existsSync3 } from "fs";
899
899
  import { mkdir, readFile, writeFile } from "fs/promises";
900
+ import { createRequire } from "module";
900
901
  import path4 from "path";
901
902
  import { pathToFileURL as pathToFileURL2 } from "url";
902
903
  import { build as esbuild } from "esbuild";
@@ -906,6 +907,7 @@ import {
906
907
  SyntaxKind
907
908
  } from "ts-morph";
908
909
  var CLAUDE_FONT_RESOURCE_DOMAIN = "https://assets.claude.ai";
910
+ var requireFromCompiler = createRequire(import.meta.url);
909
911
  async function buildWidgets(rootDir, outDir, tools, config = void 0) {
910
912
  const widgets = tools.filter(
911
913
  (entry) => Boolean(entry.widget)
@@ -938,7 +940,7 @@ createRoot(document.getElementById("root")!).render(
938
940
  );
939
941
  const baseOptions = enforceWidgetBuildInvariants({
940
942
  absWorkingDir: rootDir,
941
- alias: devSidecarBundleAliases(rootDir),
943
+ alias: sidecarWidgetAliases(rootDir),
942
944
  bundle: true,
943
945
  entryPoints: [entryFile],
944
946
  format: "iife",
@@ -1069,9 +1071,11 @@ function mergeWidgetBuildOptions(...options) {
1069
1071
  return merged;
1070
1072
  }
1071
1073
  function enforceWidgetBuildInvariants(options, required) {
1074
+ const aliases = required ? { ...options.alias ?? {}, ...reactSingletonAliases(required.rootDir) } : options.alias;
1072
1075
  return {
1073
1076
  ...options,
1074
1077
  absWorkingDir: required?.rootDir ?? options.absWorkingDir,
1078
+ alias: aliases,
1075
1079
  bundle: true,
1076
1080
  entryPoints: required ? [required.entryFile] : options.entryPoints,
1077
1081
  format: "iife",
@@ -1080,6 +1084,27 @@ function enforceWidgetBuildInvariants(options, required) {
1080
1084
  write: false
1081
1085
  };
1082
1086
  }
1087
+ function sidecarWidgetAliases(rootDir) {
1088
+ return {
1089
+ ...devSidecarBundleAliases(rootDir) ?? {},
1090
+ ...reactSingletonAliases(rootDir)
1091
+ };
1092
+ }
1093
+ function reactSingletonAliases(rootDir) {
1094
+ return {
1095
+ react: resolveProjectModule(rootDir, "react"),
1096
+ "react/jsx-runtime": resolveProjectModule(rootDir, "react/jsx-runtime"),
1097
+ "react/jsx-dev-runtime": resolveProjectModule(rootDir, "react/jsx-dev-runtime"),
1098
+ "react-dom": resolveProjectModule(rootDir, "react-dom"),
1099
+ "react-dom/client": resolveProjectModule(rootDir, "react-dom/client"),
1100
+ "react-dom/server": resolveProjectModule(rootDir, "react-dom/server")
1101
+ };
1102
+ }
1103
+ function resolveProjectModule(rootDir, specifier) {
1104
+ return requireFromCompiler.resolve(specifier, {
1105
+ paths: [rootDir, process.cwd()]
1106
+ });
1107
+ }
1083
1108
  function normalizeAliases(rootDir, aliases) {
1084
1109
  if (!aliases) {
1085
1110
  return void 0;
@@ -1906,7 +1931,7 @@ function analyzeProjectConfig(rootDir) {
1906
1931
  listChanged: readBooleanNested(definition, "tools", "listChanged") ?? false
1907
1932
  },
1908
1933
  pagination: {
1909
- pageSize: readNumberNested(definition, "pagination", "pageSize") ?? 10,
1934
+ pageSize: readNumberNested(definition, "pagination", "pageSize") ?? 50,
1910
1935
  hasOverride: hasProperty(readObjectProperty3(definition, "pagination"), "override")
1911
1936
  }
1912
1937
  };
@@ -1963,7 +1988,7 @@ function defaultCompilerConfig() {
1963
1988
  listChanged: false
1964
1989
  },
1965
1990
  pagination: {
1966
- pageSize: 10,
1991
+ pageSize: 50,
1967
1992
  hasOverride: false
1968
1993
  }
1969
1994
  };
@@ -4035,7 +4060,7 @@ var SidecarMcpServer = class {
4035
4060
  /** Returns the server-chosen page size for all built-in list pagination. */
4036
4061
  pageSize() {
4037
4062
  const configured = this.options.pagination?.pageSize;
4038
- return configured && configured > 0 ? Math.floor(configured) : 10;
4063
+ return configured && configured > 0 ? Math.floor(configured) : 50;
4039
4064
  }
4040
4065
  /** Executes a tool after request-level and tool-level auth checks. */
4041
4066
  async callTool(request, context) {