@varlock/nextjs-integration 0.3.4 → 0.3.5

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.
@@ -14693,8 +14693,9 @@ function loadEnvConfig(dir, dev, _log = console, forceReload = false, _onReload)
14693
14693
  delete cleanEnv.DEBUG_VARLOCK;
14694
14694
  const varlockLoadedEnvStr = execSyncVarlock(`load --format json-full --env ${envFromNextCommand}`, {
14695
14695
  showLogsOnError: true,
14696
- // in a build, we want to fail and exit, while in dev we can keep retrying when changes are detected
14697
- exitOnError: !dev,
14696
+ // Never use exitOnError here we handle all error cases in the catch block
14697
+ // below, including the "binary not found" case on serverless platforms.
14698
+ exitOnError: false,
14698
14699
  env: cleanEnv
14699
14700
  });
14700
14701
  if (loadCount >= 2) {
@@ -14703,6 +14704,10 @@ function loadEnvConfig(dir, dev, _log = console, forceReload = false, _onReload)
14703
14704
  varlockLoadedEnv = JSON.parse(varlockLoadedEnvStr);
14704
14705
  } catch (err) {
14705
14706
  if (err.message.includes("Unable to find varlock executable")) {
14707
+ if (!dev) {
14708
+ debug4("varlock binary not found \u2014 deferring to init bundle");
14709
+ return { combinedEnv: { ...exports.initialEnv }, parsedEnv: {}, loadedEnvFiles: [] };
14710
+ }
14706
14711
  console.error([
14707
14712
  "",
14708
14713
  "\u274C ERROR: varlock not found",
@@ -14713,6 +14718,9 @@ function loadEnvConfig(dir, dev, _log = console, forceReload = false, _onReload)
14713
14718
  process.exit(1);
14714
14719
  }
14715
14720
  console.error("[varlock] \u26A0\uFE0F failed to load env \u2014 see error above");
14721
+ if (!dev) {
14722
+ process.exit(err.status ?? 1);
14723
+ }
14716
14724
  process.env.__VARLOCK_ENV = JSON.stringify({
14717
14725
  sources: [],
14718
14726
  config: {},