@varlock/nextjs-integration 0.3.4 → 0.3.6
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/next-env-compat.js
CHANGED
|
@@ -14692,9 +14692,10 @@ function loadEnvConfig(dir, dev, _log = console, forceReload = false, _onReload)
|
|
|
14692
14692
|
const cleanEnv = { ...exports.initialEnv };
|
|
14693
14693
|
delete cleanEnv.DEBUG_VARLOCK;
|
|
14694
14694
|
const varlockLoadedEnvStr = execSyncVarlock(`load --format json-full --env ${envFromNextCommand}`, {
|
|
14695
|
-
|
|
14696
|
-
//
|
|
14697
|
-
|
|
14695
|
+
// We handle all error display and exit logic ourselves in the catch block
|
|
14696
|
+
// so we can silently defer on serverless platforms where the binary is missing.
|
|
14697
|
+
showLogsOnError: false,
|
|
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",
|
|
@@ -14712,7 +14717,13 @@ function loadEnvConfig(dir, dev, _log = console, forceReload = false, _onReload)
|
|
|
14712
14717
|
].join("\n"));
|
|
14713
14718
|
process.exit(1);
|
|
14714
14719
|
}
|
|
14720
|
+
const errAny = err;
|
|
14721
|
+
if (errAny.stdout) console.log(errAny.stdout.toString());
|
|
14722
|
+
if (errAny.stderr) console.error(errAny.stderr.toString());
|
|
14715
14723
|
console.error("[varlock] \u26A0\uFE0F failed to load env \u2014 see error above");
|
|
14724
|
+
if (!dev) {
|
|
14725
|
+
process.exit(err.status ?? 1);
|
|
14726
|
+
}
|
|
14716
14727
|
process.env.__VARLOCK_ENV = JSON.stringify({
|
|
14717
14728
|
sources: [],
|
|
14718
14729
|
config: {},
|