@varlock/cloudflare-integration 1.0.0 → 1.1.0

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/sveltekit.js CHANGED
@@ -4,7 +4,7 @@ import { patchGlobalConsole } from 'varlock/patch-console';
4
4
  import { patchGlobalServerResponse } from 'varlock/patch-server-response';
5
5
  import { patchGlobalResponse } from 'varlock/patch-response';
6
6
  import { createDebug } from 'varlock';
7
- import { execSyncVarlock } from 'varlock/exec-sync-varlock';
7
+ import { execSyncVarlock, VarlockExecError } from 'varlock/exec-sync-varlock';
8
8
 
9
9
  // ../vite/dist/index.js
10
10
  var __create = Object.create;
@@ -1409,23 +1409,24 @@ var loadCount = 0;
1409
1409
  function reloadConfig(cwd) {
1410
1410
  debug("loading config - count =", ++loadCount, cwd ? `(cwd: ${cwd})` : "");
1411
1411
  try {
1412
- const execResult = execSyncVarlock("load --format json-full --compact", {
1412
+ const { stdout } = execSyncVarlock("load --format json-full --compact", {
1413
+ fullResult: true,
1413
1414
  env: originalProcessEnv,
1414
1415
  ...cwd && { cwd }
1415
1416
  });
1416
- process.env.__VARLOCK_ENV = execResult;
1417
- varlockLoadedEnv = JSON.parse(process.env.__VARLOCK_ENV);
1417
+ process.env.__VARLOCK_ENV = stdout;
1418
+ varlockLoadedEnv = JSON.parse(stdout);
1418
1419
  configIsValid = true;
1419
1420
  } catch (err) {
1420
- const errAny = err;
1421
- const stdout = errAny?.stdout?.toString();
1422
- if (stdout) {
1423
- try {
1424
- varlockLoadedEnv = JSON.parse(stdout);
1425
- } catch {
1421
+ if (err instanceof VarlockExecError) {
1422
+ if (err.stdout) {
1423
+ try {
1424
+ varlockLoadedEnv = JSON.parse(err.stdout);
1425
+ } catch {
1426
+ }
1426
1427
  }
1428
+ if (err.stderr) console.error(err.stderr);
1427
1429
  }
1428
- if (errAny?.stderr) console.error(errAny.stderr.toString());
1429
1430
  configIsValid = false;
1430
1431
  resetStaticReplacements();
1431
1432
  return;