Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

envify

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

envify - npm Package Compare versions

Comparing version 1.2.1 to 2.0.0

7

custom.js

@@ -15,5 +15,3 @@ var through = require('through')

var buffer = []
var env = argv
? xtend(rootEnv, argv)
: rootEnv
argv = argv || {}

@@ -31,3 +29,4 @@ return through(write, flush)

try {
source = jstransform.transform(createVisitors(env), source).code
var visitors = createVisitors([argv, rootEnv])
source = jstransform.transform(visitors, source).code
} catch(err) {

@@ -34,0 +33,0 @@ return this.emit('error', err)

{
"name": "envify",
"version": "1.2.1",
"version": "2.0.0",
"description": "Selectively replace Node-style environment variables with plain strings.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -102,1 +102,24 @@ var envify = require('./custom')

})
test('Handles getter properties', function(t) {
var env = {}
var buffer = ''
var stream = envify(env)
var counter = 0
Object.defineProperty(env, 'DYNAMIC', {
// please don't actually do this:
get: function() { return counter++ ? 'really!' : 'dynamic!' }
})
stream().on('data', function(d) { buffer += d })
.on('end', function() {
t.notEqual(-1, buffer.indexOf('foo = "dynamic!"'))
t.notEqual(-1, buffer.indexOf('bar = "really!"'))
t.end()
})
.end([
'var foo = process.env.DYNAMIC'
, 'var bar = process.env.DYNAMIC'
].join('\n'))
})
var Syntax = require('esprima-fb').Syntax
var utils = require('jstransform/src/utils')
function create(env) {
function create(envs) {
function visitProcessEnv(traverse, node, path, state) {
var key = node.property.name
if (env[key] !== undefined) {
utils.catchup(node.range[0], state)
utils.append(JSON.stringify(env[key]), state)
utils.move(node.range[1], state)
for (var i = 0; i < envs.length; i++) {
var value = envs[i][key]
if (value !== undefined) {
utils.catchup(node.range[0], state)
utils.append(JSON.stringify(value), state)
utils.move(node.range[1], state)
return false
}
}
return false

@@ -14,0 +20,0 @@ }

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