mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
react app
This commit is contained in:
38
react-app/node_modules/envify/custom.js
generated
vendored
Normal file
38
react-app/node_modules/envify/custom.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
var through = require('through')
|
||||
, jstransform = require('jstransform')
|
||||
, createVisitors = require('./visitors')
|
||||
|
||||
var processEnvPattern = /\bprocess\.env\b/
|
||||
|
||||
module.exports = function(rootEnv) {
|
||||
rootEnv = rootEnv || process.env || {}
|
||||
|
||||
return function envify(file, argv) {
|
||||
if (/\.json$/.test(file)) return through()
|
||||
|
||||
var buffer = []
|
||||
argv = argv || {}
|
||||
|
||||
return through(write, flush)
|
||||
|
||||
function write(data) {
|
||||
buffer.push(data)
|
||||
}
|
||||
|
||||
function flush() {
|
||||
var source = buffer.join('')
|
||||
|
||||
if (processEnvPattern.test(source)) {
|
||||
try {
|
||||
var visitors = createVisitors([argv, rootEnv])
|
||||
source = jstransform.transform(visitors, source).code
|
||||
} catch(err) {
|
||||
return this.emit('error', err)
|
||||
}
|
||||
}
|
||||
|
||||
this.queue(source)
|
||||
this.queue(null)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user