react app

This commit is contained in:
Mario Romano
2016-04-06 17:52:19 +01:00
parent f7e6ef55a2
commit 29df96a085
4425 changed files with 446323 additions and 0 deletions

2
react-app/node_modules/envify/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,2 @@
test.js
.travis.yml

145
react-app/node_modules/envify/README.md generated vendored Normal file
View File

@@ -0,0 +1,145 @@
# envify [![Build Status](https://secure.travis-ci.org/hughsk/envify.png?branch=master)](http://travis-ci.org/hughsk/envify) [![stable](http://hughsk.github.io/stability-badges/dist/stable.svg)](http://github.com/hughsk/stability-badges) #
Selectively replace Node-style environment variables with plain strings.
Available as a standalone CLI tool and a
[Browserify](http://browserify.org) v2 transform.
Works best in combination with [uglifyify](http://github.com/hughsk/uglifyify).
## Installation ##
If you're using the module with Browserify:
``` bash
npm install envify browserify
```
Or, for the CLI:
``` bash
sudo npm install -g envify
```
## Usage ##
envify will replace your environment variable checks with ordinary strings -
only the variables you use will be included, so you don't have to worry about,
say, `AWS_SECRET_KEY` leaking through either. Take this example script:
``` javascript
if (process.env.NODE_ENV === "development") {
console.log('development only')
}
```
After running it through envify with `NODE_ENV` set to `production`, you'll
get this:
``` javascript
if ("production" === "development") {
console.log('development only')
}
```
By running this through a good minifier (e.g.
[UglifyJS2](https://github.com/mishoo/UglifyJS)), the above code would be
stripped out completely.
However, if you bundled the same script with `NODE_ENV` set to `development`:
``` javascript
if ("development" === "development") {
console.log('development only')
}
```
The `if` statement will evaluate to `true`, so the code won't be removed.
## CLI Usage ##
With browserify:
``` bash
browserify index.js -t envify > bundle.js
```
Or standalone:
``` bash
envify index.js > bundle.js
```
You can also specify additional custom environment variables using
browserify's [subarg](http://github.com/substack/subarg) syntax, which is
available in versions 3.25.0 and above:
``` bash
browserify index.js -t [ envify --NODE_ENV development ] > bundle.js
browserify index.js -t [ envify --NODE_ENV production ] > bundle.js
```
## Module Usage ##
**require('envify')**
Returns a transform stream that updates based on the Node process'
`process.env` object.
**require('envify/custom')([environment])**
If you want to stay away from your environment variables, you can supply
your own object to use in its place:
``` javascript
var browserify = require('browserify')
, envify = require('envify/custom')
, fs = require('fs')
var b = browserify('main.js')
, output = fs.createWriteStream('bundle.js')
b.transform(envify({
NODE_ENV: 'development'
}))
b.bundle().pipe(output)
```
## Purging `process.env` ##
By default, environment variables that are not defined will be left untouched.
This is because in some cases, you might want to run an envify transform over
your source more than once, and removing these values would make that
impossible.
However, if any references to `process.env` are remaining after transforming
your source with envify, browserify will automatically insert its shim for
Node's process object, which will increase the size of your bundle. This weighs
in at around 2KB, so if you're trying to be conservative with your bundle size
you can "purge" these remaining variables such that any missing ones are simply
replaced with undefined.
To do so through the command-line, simply use the subarg syntax and include
`purge` after `envify`, e.g.:
``` bash
browserify index.js -t [ envify purge --NODE_ENV development ]
```
Or if you're using the module API, you can pass `_: "purge"` into your
arguments like so:
``` javascript
b.transform(envify({
_: 'purge'
, NODE_ENV: 'development'
}))
```
## Contributors ##
* [hughsk](http://github.com/hughsk)
* [benjamn](http://github.com/benjamn)
* [zag2art](http://github.com/zag2art)
* [bjoerge](http://github.com/bjoerge)
* [andreypopp](http://github.com/andreypopp)
* [jupl](http://github.com/jupl)

17
react-app/node_modules/envify/bin/envify generated vendored Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env node
var envify = require('../')
, fs = require('fs')
if (process.argv[2]) {
fs.createReadStream(process.argv[2], { encoding: 'utf8' })
.pipe(envify(process.argv[2]))
.pipe(process.stdout)
} else {
process.stdin.resume()
process.stdin
.pipe(envify(__filename))
.pipe(process.stdout)
}

38
react-app/node_modules/envify/custom.js generated vendored Normal file
View 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)
}
}
}

1
react-app/node_modules/envify/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
module.exports = require('./custom')(process.env)

94
react-app/node_modules/envify/package.json generated vendored Normal file
View File

@@ -0,0 +1,94 @@
{
"_args": [
[
"envify@^3.0.0",
"/Users/mromano/dev/react-sfs/node_modules/react"
]
],
"_from": "envify@>=3.0.0 <4.0.0",
"_id": "envify@3.4.0",
"_inCache": true,
"_installable": true,
"_location": "/envify",
"_npmUser": {
"email": "zertosh@gmail.com",
"name": "zertosh"
},
"_npmVersion": "1.4.28",
"_phantomChildren": {},
"_requested": {
"name": "envify",
"raw": "envify@^3.0.0",
"rawSpec": "^3.0.0",
"scope": null,
"spec": ">=3.0.0 <4.0.0",
"type": "range"
},
"_requiredBy": [
"/react"
],
"_resolved": "https://registry.npmjs.org/envify/-/envify-3.4.0.tgz",
"_shasum": "a0bed52222529076a02fabf6ce00eef42d7b6734",
"_shrinkwrap": null,
"_spec": "envify@^3.0.0",
"_where": "/Users/mromano/dev/react-sfs/node_modules/react",
"author": {
"email": "hughskennedy@gmail.com",
"name": "Hugh Kennedy",
"url": "http://hughskennedy.com/"
},
"bin": {
"envify": "bin/envify"
},
"bugs": {
"url": "https://github.com/hughsk/envify/issues"
},
"dependencies": {
"jstransform": "^10.0.1",
"through": "~2.3.4"
},
"description": "Selectively replace Node-style environment variables with plain strings.",
"devDependencies": {
"tap-spec": "^1.0.1",
"tape": "~2.3.2"
},
"directories": {},
"dist": {
"shasum": "a0bed52222529076a02fabf6ce00eef42d7b6734",
"tarball": "https://registry.npmjs.org/envify/-/envify-3.4.0.tgz"
},
"gitHead": "c42c2052e33f82b651a992686c3578639bf0339b",
"homepage": "https://github.com/hughsk/envify",
"keywords": [
"environment",
"variables",
"browserify",
"browserify-transform",
"transform",
"source",
"configuration"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"email": "hughskennedy@gmail.com",
"name": "hughsk"
},
{
"email": "zertosh@gmail.com",
"name": "zertosh"
}
],
"name": "envify",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/hughsk/envify.git"
},
"scripts": {
"test": "node test.js | tap-spec"
},
"version": "3.4.0"
}

49
react-app/node_modules/envify/visitors.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
var Syntax = require('jstransform').Syntax
var utils = require('jstransform/src/utils')
function create(envs) {
var args = [].concat(envs[0]._ || []).concat(envs[1]._ || [])
var purge = args.indexOf('purge') !== -1
function visitProcessEnv(traverse, node, path, state) {
var key = node.property.name || node.property.value
for (var i = 0; i < envs.length; i++) {
var value = envs[i][key]
if (value !== undefined) {
replaceEnv(node, state, value)
return false
}
}
if (purge) {
replaceEnv(node, state, undefined)
}
return false
}
function replaceEnv(node, state, value) {
utils.catchup(node.range[0], state)
utils.append(JSON.stringify(value), state)
utils.move(node.range[1], state)
}
visitProcessEnv.test = function(node, path, state) {
return (
node.type === Syntax.MemberExpression
&& !(path[0].type === Syntax.AssignmentExpression && path[0].left === node)
&& node.property.type === (node.computed ? Syntax.Literal : Syntax.Identifier)
&& node.object.computed === false
&& node.object.type === Syntax.MemberExpression
&& node.object.object.type === Syntax.Identifier
&& node.object.object.name === 'process'
&& node.object.property.type === Syntax.Identifier
&& node.object.property.name === 'env'
)
}
return [visitProcessEnv]
}
module.exports = create