@rebasepro/cli 0.16.0 → 0.16.1-canary.g767fc35

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/bundle.d.ts CHANGED
@@ -193,6 +193,25 @@ export interface VendorResult {
193
193
  * the upload is compressed: crossing it means "getting close", not "will fail".
194
194
  */
195
195
  export declare const VENDOR_SIZE_WARN_BYTES: number;
196
+ /**
197
+ * Where vendoring stops being an optimisation and becomes a bundle nobody can
198
+ * deploy.
199
+ *
200
+ * Past this, shipping the tree anyway trades a faster cold start for a 413 — and
201
+ * the 413 arrives at deploy time, after a build nobody watches, with a remedy
202
+ * (`--no-vendor`) that requires knowing this happened. Unvendoring here costs
203
+ * 40–60s of cold start and produces a bundle that uploads; that is the better
204
+ * side of the trade to be on by default.
205
+ *
206
+ * 200 MB assumes a **2x** floor on compression, which is pessimistic for a tree
207
+ * of JavaScript (3–5x is typical) and deliberately so: source maps and prebuilt
208
+ * binaries compress far worse than source, and the failure this prevents is
209
+ * asymmetric — a bundle refused at the door versus a minute of cold start.
210
+ * `--vendor` overrides it, for a deploy path with no upload at all (a Dockerfile
211
+ * built from source, where the tree is copied into an image and the control
212
+ * plane never sees it).
213
+ */
214
+ export declare const VENDOR_SIZE_MAX_BYTES: number;
196
215
  /**
197
216
  * Install the bundle's declared dependencies into the bundle itself.
198
217
  *
package/dist/index.es.js CHANGED
@@ -5070,6 +5070,25 @@ var VENDOR_TARGET_CPU = "x64";
5070
5070
  * the upload is compressed: crossing it means "getting close", not "will fail".
5071
5071
  */
5072
5072
  var VENDOR_SIZE_WARN_BYTES = 150 * 1024 * 1024;
5073
+ /**
5074
+ * Where vendoring stops being an optimisation and becomes a bundle nobody can
5075
+ * deploy.
5076
+ *
5077
+ * Past this, shipping the tree anyway trades a faster cold start for a 413 — and
5078
+ * the 413 arrives at deploy time, after a build nobody watches, with a remedy
5079
+ * (`--no-vendor`) that requires knowing this happened. Unvendoring here costs
5080
+ * 40–60s of cold start and produces a bundle that uploads; that is the better
5081
+ * side of the trade to be on by default.
5082
+ *
5083
+ * 200 MB assumes a **2x** floor on compression, which is pessimistic for a tree
5084
+ * of JavaScript (3–5x is typical) and deliberately so: source maps and prebuilt
5085
+ * binaries compress far worse than source, and the failure this prevents is
5086
+ * asymmetric — a bundle refused at the door versus a minute of cold start.
5087
+ * `--vendor` overrides it, for a deploy path with no upload at all (a Dockerfile
5088
+ * built from source, where the tree is copied into an image and the control
5089
+ * plane never sees it).
5090
+ */
5091
+ var VENDOR_SIZE_MAX_BYTES = 200 * 1024 * 1024;
5073
5092
  /** Bytes on disk under `dir`. Bounded so a pathological tree cannot hang a build. */
5074
5093
  function directorySize(dir, budget = 2e5) {
5075
5094
  let total = 0;
@@ -5188,10 +5207,22 @@ function vendorDependencies(options) {
5188
5207
  skipped: `the installed tree is missing ${missing.join(", ")}, which the runtime resolves from the bundle — the bundle declares it at a version no registry can serve (a workspace link), so nothing was vendored rather than shipping a tree that boots without a driver`
5189
5208
  };
5190
5209
  }
5210
+ const bytes = directorySize(installed);
5211
+ if (bytes > 209715200 && options.requested !== true) {
5212
+ fs.rmSync(installed, {
5213
+ recursive: true,
5214
+ force: true
5215
+ });
5216
+ fs.rmSync(path.join(options.outDir, "package-lock.json"), { force: true });
5217
+ return {
5218
+ vendored: false,
5219
+ skipped: `the installed tree is ${Math.round(bytes / (1024 * 1024))} MB, past the point where the upload can be expected to fit under the control plane's 100 MB limit — a bundle that is refused at the door is worse than one that installs at boot. Pass --vendor to keep it anyway (a deploy that builds from source never uploads the tree), or shrink the declared dependencies`
5220
+ };
5221
+ }
5191
5222
  return {
5192
5223
  vendored: true,
5193
5224
  target,
5194
- bytes: directorySize(installed)
5225
+ bytes
5195
5226
  };
5196
5227
  }
5197
5228
  /**
@@ -5601,6 +5632,8 @@ ${chalk.bold("Options")}
5601
5632
  --skip-schema Do not regenerate the database schema from collections
5602
5633
  --no-vendor Do not install dependencies into the bundle (they
5603
5634
  install on every pod start instead, ~40-60s slower)
5635
+ --vendor Install them whatever the tree's size — for a
5636
+ deploy that builds from source and never uploads it
5604
5637
  --legacy Run every workspace's own build script instead
5605
5638
  -h, --help Show this help
5606
5639
 
@@ -5621,6 +5654,7 @@ async function buildCommand(rawArgs = []) {
5621
5654
  "--out": "--output",
5622
5655
  "--skip-type-check": Boolean,
5623
5656
  "--no-vendor": Boolean,
5657
+ "--vendor": Boolean,
5624
5658
  "--skip-schema": Boolean,
5625
5659
  "--no-static": Boolean,
5626
5660
  "--skip-static-build": Boolean,
@@ -5686,7 +5720,7 @@ async function buildCommand(rawArgs = []) {
5686
5720
  storage: manifest.storage,
5687
5721
  skipTypeCheck: args["--skip-type-check"],
5688
5722
  skipSchema: args["--skip-schema"],
5689
- vendor: args["--no-vendor"] ? false : void 0
5723
+ vendor: args["--no-vendor"] ? false : args["--vendor"] ? true : void 0
5690
5724
  });
5691
5725
  const rel = path.relative(projectRoot, result.outDir);
5692
5726
  console.log(chalk.green(` ✓ bundle → ${rel}/`));
@@ -5695,8 +5729,8 @@ async function buildCommand(rawArgs = []) {
5695
5729
  console.log(chalk.dim(` dependencies installed into the bundle (${result.vendor.target?.os}/${result.vendor.target?.cpu})`));
5696
5730
  if ((result.vendor.bytes ?? 0) > 157286400) {
5697
5731
  const mb = Math.round((result.vendor.bytes ?? 0) / (1024 * 1024));
5698
- console.log(chalk.yellow(` ⚠ the installed tree is ${mb} MB — close to the 100 MB upload limit`));
5699
- console.log(chalk.dim(" Rebuild with --no-vendor if the deploy is rejected as too large."));
5732
+ console.log(chalk.yellow(` ⚠ the installed tree is ${mb} MB on disk enough to risk the control plane's 100 MB limit on the compressed upload`));
5733
+ console.log(chalk.dim(" Shrink the declared dependencies, or rebuild with --no-vendor."));
5700
5734
  }
5701
5735
  } else if (Object.keys(result.manifest.deps.declared).length === 0) console.log(chalk.dim(" no dependencies to install — nothing to bundle"));
5702
5736
  else {
@@ -13034,6 +13068,6 @@ function telemetryNotice() {
13034
13068
  return chalk.gray(`Usage sharing: ${sharing ? "on" : "off"} — ${chalk.cyan("rebase telemetry")} to inspect or change\n`);
13035
13069
  }
13036
13070
  //#endregion
13037
- export { CURRENT_RUNTIME_RANGE, DEFAULT_BUNDLE_DIR, DEFAULT_CONFIG_DIR, DEFAULT_CRONS_DIR, DEFAULT_FUNCTIONS_DIR, DEFAULT_SCHEMA_FILE, DEV_FLAGS, DEV_PORT_FILENAME, INIT_FLAGS, MANIFEST_FILENAME, ManifestError, RESET_PASSWORD_FLAGS, TEMPLATE_PLACEHOLDER_FILES, VENDOR_SIZE_WARN_BYTES, VENDOR_TARGET_CPU, VENDOR_TARGET_OS, absolutizeLocalPathArgs, appsCommand, assessManagedCompatibility, authCommand, buildBundle, buildCommand, buildInitQuestions, buildStaticBundle, buildableApps, cloudCommand, collectDeclaredDependencies, configureEnvFile, createRebaseApp, dbCommand, detectFrameworkDepDrift, detectNativeDependencies, detectPackageManager, detectStorageAuthorize, devCommand, doctorCommand, ejectCommand, entry, findBackendApp, findBackendDir, findEnvFile, findFrontendDir, findLibpqUrlProblems, findProjectRoot, findUnusedServerEntry, foldStaticIntoBundle, formatCdTarget, generateSdkCommand, getActiveBackendPlugin, getPMCommands, getProjectPort, isIdentifierLike, isPnpmAvailable, isPortAvailable, loadManifest, manifestExists, manifestPath, normalizeEsmSpecifiers, pnpmAvailabilityFromProbe, positionals, printInitHelp, readEnvFile, renderPayload, requireBackendDir, requireProjectRoot, resetPnpmAvailabilityCache, resolveBackendPaths, resolveCliVersion, resolveExampleBaseUrl, resolveLocalBin, resolvePluginCliScript, resolveResetPasswordArgs, resolveRuntimeImageTag, resolveStartPort, resolveTsx, schemaCommand, selectUserForEmail, startCommand, synthesizeManifest, validateManifest, validateProjectName, validateTsxInstallation, vendorDependencies, writeManifest };
13071
+ export { CURRENT_RUNTIME_RANGE, DEFAULT_BUNDLE_DIR, DEFAULT_CONFIG_DIR, DEFAULT_CRONS_DIR, DEFAULT_FUNCTIONS_DIR, DEFAULT_SCHEMA_FILE, DEV_FLAGS, DEV_PORT_FILENAME, INIT_FLAGS, MANIFEST_FILENAME, ManifestError, RESET_PASSWORD_FLAGS, TEMPLATE_PLACEHOLDER_FILES, VENDOR_SIZE_MAX_BYTES, VENDOR_SIZE_WARN_BYTES, VENDOR_TARGET_CPU, VENDOR_TARGET_OS, absolutizeLocalPathArgs, appsCommand, assessManagedCompatibility, authCommand, buildBundle, buildCommand, buildInitQuestions, buildStaticBundle, buildableApps, cloudCommand, collectDeclaredDependencies, configureEnvFile, createRebaseApp, dbCommand, detectFrameworkDepDrift, detectNativeDependencies, detectPackageManager, detectStorageAuthorize, devCommand, doctorCommand, ejectCommand, entry, findBackendApp, findBackendDir, findEnvFile, findFrontendDir, findLibpqUrlProblems, findProjectRoot, findUnusedServerEntry, foldStaticIntoBundle, formatCdTarget, generateSdkCommand, getActiveBackendPlugin, getPMCommands, getProjectPort, isIdentifierLike, isPnpmAvailable, isPortAvailable, loadManifest, manifestExists, manifestPath, normalizeEsmSpecifiers, pnpmAvailabilityFromProbe, positionals, printInitHelp, readEnvFile, renderPayload, requireBackendDir, requireProjectRoot, resetPnpmAvailabilityCache, resolveBackendPaths, resolveCliVersion, resolveExampleBaseUrl, resolveLocalBin, resolvePluginCliScript, resolveResetPasswordArgs, resolveRuntimeImageTag, resolveStartPort, resolveTsx, schemaCommand, selectUserForEmail, startCommand, synthesizeManifest, validateManifest, validateProjectName, validateTsxInstallation, vendorDependencies, writeManifest };
13038
13072
 
13039
13073
  //# sourceMappingURL=index.es.js.map