@rebasepro/cli 0.10.1-canary.8650626 → 0.10.1-canary.b1e3dbf

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
@@ -20,6 +20,24 @@ export interface BuildBundleResult {
20
20
  manifest: RebaseBundleManifest;
21
21
  collectionCount: number;
22
22
  }
23
+ /**
24
+ * Whether the compiled config package exports a `storageAuthorize` hook.
25
+ *
26
+ * Recorded in the manifest so a host can refuse a deploy that would enable file
27
+ * storage with no access model, rather than let the runtime's boot guard turn it
28
+ * into a crash loop the developer cannot read.
29
+ *
30
+ * Read from the *compiled* index, deliberately: that is the exact module the
31
+ * runtime imports and reads the export off, so this cannot disagree with what
32
+ * actually happens at boot. It is a textual check rather than an import because
33
+ * a freshly built bundle cannot resolve its own dependencies until it is
34
+ * deployed — the same reason schema hashing reads source.
35
+ *
36
+ * Errs toward `false`: a missed detection costs a deploy rejection whose message
37
+ * says exactly how to proceed, while a false positive would hand back the crash
38
+ * loop this exists to prevent.
39
+ */
40
+ export declare function detectStorageAuthorize(compiledConfigDir: string): boolean;
23
41
  /**
24
42
  * Detect native code in the dependency closure.
25
43
  *
package/dist/index.es.js CHANGED
@@ -2981,6 +2981,43 @@ async function writeBundleTsconfig(projectRoot, outDir, includes, skipTypeCheck)
2981
2981
  return tsconfigPath;
2982
2982
  }
2983
2983
  /**
2984
+ * Whether the compiled config package exports a `storageAuthorize` hook.
2985
+ *
2986
+ * Recorded in the manifest so a host can refuse a deploy that would enable file
2987
+ * storage with no access model, rather than let the runtime's boot guard turn it
2988
+ * into a crash loop the developer cannot read.
2989
+ *
2990
+ * Read from the *compiled* index, deliberately: that is the exact module the
2991
+ * runtime imports and reads the export off, so this cannot disagree with what
2992
+ * actually happens at boot. It is a textual check rather than an import because
2993
+ * a freshly built bundle cannot resolve its own dependencies until it is
2994
+ * deployed — the same reason schema hashing reads source.
2995
+ *
2996
+ * Errs toward `false`: a missed detection costs a deploy rejection whose message
2997
+ * says exactly how to proceed, while a false positive would hand back the crash
2998
+ * loop this exists to prevent.
2999
+ */
3000
+ function detectStorageAuthorize(compiledConfigDir) {
3001
+ const indexPath = [
3002
+ ".js",
3003
+ ".mjs",
3004
+ ".ts"
3005
+ ].map((ext) => path.join(compiledConfigDir, `index${ext}`)).find((candidate) => fs.existsSync(candidate));
3006
+ if (!indexPath) return false;
3007
+ let source;
3008
+ try {
3009
+ source = fs.readFileSync(indexPath, "utf8");
3010
+ } catch {
3011
+ return false;
3012
+ }
3013
+ if (/\bexport\s+(?:async\s+)?(?:const|let|var|function)\s+storageAuthorize\b/.test(source)) return true;
3014
+ for (const clause of source.matchAll(/\bexport\s*\{([^}]*)\}/g)) if (clause[1].split(",").map((entry) => {
3015
+ const parts = entry.split(/\bas\b/);
3016
+ return parts[parts.length - 1].trim();
3017
+ }).includes("storageAuthorize")) return true;
3018
+ return false;
3019
+ }
3020
+ /**
2984
3021
  * Detect native code in the dependency closure.
2985
3022
  *
2986
3023
  * Walks declared runtime dependencies breadth-first through `node_modules`,
@@ -3297,6 +3334,7 @@ async function buildBundle(options) {
3297
3334
  }
3298
3335
  const declared = collectDeclaredDependencies(projectRoot);
3299
3336
  const nativeModules = detectNativeDependencies(projectRoot, declared);
3337
+ const declaresStorageAuthorize = detectStorageAuthorize(path.join(outDir, paths.config));
3300
3338
  const schemaOut = paths.schema.replace(/\.ts$/, ".js");
3301
3339
  const relative = (target) => fs.existsSync(path.join(outDir, target)) ? target : void 0;
3302
3340
  const manifest = {
@@ -3322,6 +3360,7 @@ async function buildBundle(options) {
3322
3360
  native: nativeModules.length > 0,
3323
3361
  nativeModules: nativeModules.length > 0 ? nativeModules : void 0
3324
3362
  },
3363
+ storage: { authorize: declaresStorageAuthorize },
3325
3364
  deps: { declared },
3326
3365
  build: {
3327
3366
  cli: resolveCliVersion(),
@@ -8926,6 +8965,6 @@ ${chalk.gray("Documentation: https://rebase.pro/docs")}
8926
8965
  `);
8927
8966
  }
8928
8967
  //#endregion
8929
- export { CURRENT_RUNTIME_RANGE, DEFAULT_BUNDLE_DIR, DEFAULT_CONFIG_DIR, DEFAULT_CRONS_DIR, DEFAULT_FUNCTIONS_DIR, DEFAULT_SCHEMA_FILE, MANIFEST_FILENAME, ManifestError, appsCommand, assessManagedCompatibility, authCommand, buildBundle, buildCommand, buildInitQuestions, buildStaticBundle, buildableApps, cloudCommand, collectDeclaredDependencies, configureEnvFile, createRebaseApp, dbCommand, detectNativeDependencies, detectPackageManager, devCommand, doctorCommand, entry, findBackendApp, findBackendDir, findEnvFile, findFrontendDir, findProjectRoot, formatCdTarget, generateSdkCommand, getActiveBackendPlugin, getPMCommands, isPnpmAvailable, loadManifest, manifestExists, manifestPath, normalizeEsmSpecifiers, pnpmAvailabilityFromProbe, printInitHelp, requireBackendDir, requireProjectRoot, resetPnpmAvailabilityCache, resolveBackendPaths, resolveLocalBin, resolvePluginCliScript, resolveTsx, schemaCommand, startCommand, synthesizeManifest, validateManifest, validateProjectName, validateTsxInstallation, writeManifest };
8968
+ export { CURRENT_RUNTIME_RANGE, DEFAULT_BUNDLE_DIR, DEFAULT_CONFIG_DIR, DEFAULT_CRONS_DIR, DEFAULT_FUNCTIONS_DIR, DEFAULT_SCHEMA_FILE, MANIFEST_FILENAME, ManifestError, appsCommand, assessManagedCompatibility, authCommand, buildBundle, buildCommand, buildInitQuestions, buildStaticBundle, buildableApps, cloudCommand, collectDeclaredDependencies, configureEnvFile, createRebaseApp, dbCommand, detectNativeDependencies, detectPackageManager, detectStorageAuthorize, devCommand, doctorCommand, entry, findBackendApp, findBackendDir, findEnvFile, findFrontendDir, findProjectRoot, formatCdTarget, generateSdkCommand, getActiveBackendPlugin, getPMCommands, isPnpmAvailable, loadManifest, manifestExists, manifestPath, normalizeEsmSpecifiers, pnpmAvailabilityFromProbe, printInitHelp, requireBackendDir, requireProjectRoot, resetPnpmAvailabilityCache, resolveBackendPaths, resolveLocalBin, resolvePluginCliScript, resolveTsx, schemaCommand, startCommand, synthesizeManifest, validateManifest, validateProjectName, validateTsxInstallation, writeManifest };
8930
8969
 
8931
8970
  //# sourceMappingURL=index.es.js.map