@penvhq/cli 0.3.0 → 0.3.2

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/index.cjs CHANGED
@@ -702,7 +702,6 @@ var import_node_path3 = require("path");
702
702
  var import_node_url2 = require("url");
703
703
  var import_core6 = require("@penvhq/core");
704
704
  var import_citty2 = require("citty");
705
- var import_jiti = require("jiti");
706
705
  var SCHEMA_EXPORT = "schema";
707
706
  var LABELS = {
708
707
  config: "Config",
@@ -781,9 +780,11 @@ function loadSchema(project, environment) {
781
780
  return exclusively(() => loadSchemaExclusively(file, schemaPath, environment));
782
781
  }
783
782
  async function loadSchemaExclusively(file, schemaPath, environment) {
784
- const jiti = (0, import_jiti.createJiti)(file, { interopDefault: false, moduleCache: false });
783
+ const jiti = (0, import_core6.jitiFor)(file);
785
784
  const previous = process.env.PENV_ENV;
785
+ const previousHarvest = process.env[import_core6.SCHEMA_HARVEST_ENV];
786
786
  process.env.PENV_ENV = environment;
787
+ process.env[import_core6.SCHEMA_HARVEST_ENV] = "1";
787
788
  let loaded;
788
789
  try {
789
790
  loaded = await jiti.import(file);
@@ -809,6 +810,11 @@ async function loadSchemaExclusively(file, schemaPath, environment) {
809
810
  } else {
810
811
  process.env.PENV_ENV = previous;
811
812
  }
813
+ if (previousHarvest === void 0) {
814
+ delete process.env[import_core6.SCHEMA_HARVEST_ENV];
815
+ } else {
816
+ process.env[import_core6.SCHEMA_HARVEST_ENV] = previousHarvest;
817
+ }
812
818
  }
813
819
  const exported = typeof loaded === "object" && loaded !== null ? loaded[SCHEMA_EXPORT] : void 0;
814
820
  if (!isZodType(exported)) {