Socket
Socket
Sign inDemoInstall

react-native-dotenv

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-dotenv - npm Package Compare versions

Comparing version 3.4.1 to 3.4.2

1

__tests__/__fixtures__/module-name/source.js

@@ -1,2 +0,1 @@

// eslint-disable-next-line import/no-unresolved
import {API_KEY, DEV_USERNAME} from 'react-native-dotenv'

@@ -3,0 +2,0 @@

8

__tests__/index.test.js

@@ -6,2 +6,6 @@ const {transformFileSync} = require('@babel/core')

describe('react-native-dotenv', () => {
if (process.env.NODE_ENV === undefined) {
process.env.NODE_ENV = test
}
const OLD_ENV = process.env

@@ -51,3 +55,3 @@ afterEach(() => {

/*
// Temporarily removing this test because modifying process.env is not working inline for unsafe mode
// removed because babel caches process.env if multiple tests using the same fixtures
it('should prioritize environment variables over variables defined in .env', () => {

@@ -113,3 +117,3 @@ process.env.API_KEY = 'i win'

const {code} = transformFileSync(FIXTURES + 'module-name/source.js')
expect(code).toBe('// eslint-disable-next-line import/no-unresolved\nconsole.log("abc123");\nconsole.log("username");')
expect(code).toBe('console.log("abc123");\nconsole.log("username");')
})

@@ -116,0 +120,0 @@

@@ -89,29 +89,9 @@ const {readFileSync, statSync} = require('fs')

const dotenvTemporary = undefObjectAssign({}, process.env)
if (options.safe) {
const parsed = parseDotenvFile(options.path, options.verbose)
const localParsed = parseDotenvFile(localFilePath, options.verbose)
const modeParsed = parseDotenvFile(modeFilePath, options.verbose)
const modeLocalParsed = parseDotenvFile(modeLocalFilePath, options.verbose)
const parsed = parseDotenvFile(options.path, options.verbose)
const localParsed = parseDotenvFile(localFilePath, options.verbose)
const modeParsed = parseDotenvFile(modeFilePath, options.verbose)
const modeLocalParsed = parseDotenvFile(modeLocalFilePath, options.verbose)
env = (options.safe) ? safeObjectAssign(undefObjectAssign(undefObjectAssign(undefObjectAssign(parsed, modeParsed), localParsed), modeLocalParsed), dotenvTemporary, ['NODE_ENV', 'BABEL_ENV', options.envName])
: undefObjectAssign(undefObjectAssign(undefObjectAssign(undefObjectAssign(parsed, modeParsed), localParsed), modeLocalParsed), dotenvTemporary)
env = safeObjectAssign(undefObjectAssign(undefObjectAssign(undefObjectAssign(parsed, modeParsed), localParsed), modeLocalParsed), dotenvTemporary, ['NODE_ENV', 'BABEL_ENV', options.envName])
} else {
// The order should be inversed as once defined it won't look elsewhere
dotenv.config({
path: modeLocalFilePath,
silent: true,
})
dotenv.config({
path: modeFilePath,
silent: true,
})
dotenv.config({
path: localFilePath,
silent: true,
})
dotenv.config({
path: options.path,
})
env = process.env
}
api.addExternalDependency(path.resolve(options.path))

@@ -118,0 +98,0 @@ api.addExternalDependency(path.resolve(localFilePath))

{
"name": "react-native-dotenv",
"version": "3.4.1",
"version": "3.4.2",
"description": "Load environment variables using import statements.",

@@ -29,7 +29,7 @@ "repository": "github:goatandsheep/react-native-dotenv",

"devDependencies": {
"@babel/core": "7.17.7",
"@babel/core": "7.19.6",
"codecov": "^3.8.3",
"jest": "27.5.1",
"jest-junit": "^14.0.1",
"xo": "^0.48.0"
"xo": "^0.52.4"
},

@@ -70,3 +70,4 @@ "author": "Kemal Ahmed",

"unicorn/prefer-module": "off",
"node/prefer-global/process": "off"
"node/prefer-global/process": "off",
"n/prefer-global/process": "off"
}

@@ -88,3 +89,4 @@ },

"@env",
"foo"
"foo",
"react-native-dotenv"
]

@@ -91,0 +93,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc