opencode-dotenv 0.3.1 → 0.3.3

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.
Files changed (2) hide show
  1. package/dist/index.js +5 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -814,6 +814,8 @@ function getHomeDir() {
814
814
  }
815
815
  function parseDotenv(content) {
816
816
  const result = {};
817
+ if (typeof content !== "string")
818
+ return result;
817
819
  const lines = content.split(`
818
820
  `);
819
821
  let i = 0;
@@ -883,6 +885,9 @@ function isValidEnvKey(key) {
883
885
  return VALID_ENV_KEY.test(key);
884
886
  }
885
887
  function expandPath(rawPath) {
888
+ if (typeof rawPath !== "string") {
889
+ return null;
890
+ }
886
891
  const home = getHomeDir();
887
892
  const expanded = rawPath.replace(/^~/, home);
888
893
  const resolved = resolve(expanded);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-dotenv",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "OpenCode plugin to load .env files at startup",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",