flow like the river

This commit is contained in:
root 2025-11-07 00:06:12 +01:00
commit 013fe673f3
42435 changed files with 5764238 additions and 0 deletions

13
BACK_BACK/node_modules/brfs/.travis.yml generated vendored Executable file
View file

@ -0,0 +1,13 @@
language: node_js
node_js:
- "9"
- "8"
- "6"
- "4"
- "iojs"
- "0.12"
- "0.10"
- "0.8"
before_install:
- 'nvm install-latest-npm'
sudo: false

18
BACK_BACK/node_modules/brfs/LICENSE generated vendored Executable file
View file

@ -0,0 +1,18 @@
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

20
BACK_BACK/node_modules/brfs/bin/cmd.js generated vendored Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var brfs = require('../');
var file = process.argv[2];
if (file === '-h' || file === '--help') {
return fs.createReadStream(path.join(__dirname, 'usage.txt'))
.pipe(process.stdout)
;
}
var fromFile = file && file !== '-';
var rs = fromFile
? fs.createReadStream(file)
: process.stdin
;
var fpath = fromFile ? file : path.join(process.cwd(), '-');
rs.pipe(brfs(fpath)).pipe(process.stdout);

13
BACK_BACK/node_modules/brfs/bin/usage.txt generated vendored Executable file
View file

@ -0,0 +1,13 @@
usage:
brfs file
Inline `fs.readFileSync()` calls from `file`, printing the transformed file
contents to stdout.
brfs
brfs -
Inline `fs.readFileSync()` calls from stdin, printing the transformed file
contents to stdout.

4
BACK_BACK/node_modules/brfs/example/async.js generated vendored Executable file
View file

@ -0,0 +1,4 @@
var fs = require('fs');
fs.readFile(__dirname + '/robot.html', 'utf8', function (err, html) {
console.log(html);
});

3
BACK_BACK/node_modules/brfs/example/main.js generated vendored Executable file
View file

@ -0,0 +1,3 @@
var fs = require('fs');
var html = fs.readFileSync(__dirname + '/robot.html', 'utf8');
console.log(html);

1
BACK_BACK/node_modules/brfs/example/robot.html generated vendored Executable file
View file

@ -0,0 +1 @@
<b>beep boop</b>

151
BACK_BACK/node_modules/brfs/index.js generated vendored Executable file
View file

@ -0,0 +1,151 @@
var staticModule = require('static-module');
var quote = require('quote-stream');
var through = require('through2');
var fs = require('fs');
var path = require('path');
var resolve = require('resolve');
module.exports = function (file, opts) {
if (/\.json$/.test(file)) return through();
function resolver (p) {
return resolve.sync(p, { basedir: path.dirname(file) });
}
var vars = {
__filename: file,
__dirname: path.dirname(file),
require: { resolve: resolver }
};
if (!opts) opts = {};
if (opts.vars) Object.keys(opts.vars).forEach(function (key) {
vars[key] = opts.vars[key];
});
var sm = staticModule(
{
fs: {
readFileSync: readFileSync,
readFile: readFile,
readdirSync: readdirSync,
readdir: readdir
}
},
{
vars: vars,
varModules: { path: path },
parserOpts: opts && opts.parserOpts,
sourceMap: opts && (opts.sourceMap || opts._flags && opts._flags.debug)
}
);
return sm;
function readFile (file, enc, cb) {
if (typeof enc === 'function') {
cb = enc;
enc = null;
}
if (enc && typeof enc === 'object' && enc.encoding) {
enc = enc.encoding;
}
var isBuffer = false;
if (enc === null || enc === undefined) {
isBuffer = true;
enc = 'base64';
}
var stream = through(write, end);
stream.push('process.nextTick(function(){(' + cb + ')(null,');
if (isBuffer) stream.push('Buffer(');
var s = fs.createReadStream(file, { encoding: enc });
s.on('error', function (err) { sm.emit('error', err) });
return s.pipe(quote()).pipe(stream);
function write (buf, enc, next) {
this.push(buf);
next();
}
function end (next) {
if (isBuffer) this.push(',"base64")');
this.push(')})');
this.push(null);
sm.emit('file', file);
next()
}
}
function readFileSync (file, enc) {
var isBuffer = false;
if (enc === null || enc === undefined) {
isBuffer = true;
enc = 'base64';
}
if (enc && typeof enc === 'object' && enc.encoding) {
enc = enc.encoding;
}
var stream = fs.createReadStream(file, { encoding: enc })
.on('error', function (err) { sm.emit('error', err) })
.pipe(quote()).pipe(through(write, end))
;
if (isBuffer) {
stream.push('Buffer(');
}
return stream;
function write (buf, enc, next) {
this.push(buf);
next();
}
function end (next) {
if (isBuffer) this.push(',"base64")');
this.push(null);
sm.emit('file', file);
next();
}
}
function readdir(path, cb) {
var stream = through(write, end);
stream.push('process.nextTick(function(){(' + cb + ')(null,');
fs.readdir(path, function (err, src) {
if (err) {
stream.emit('error', err);
return;
}
stream.push(JSON.stringify(src));
stream.end(')})');
});
return stream;
function write (buf, enc, next) {
this.push(buf);
next();
}
function end (next) {
this.push(null);
next();
}
}
function readdirSync (path) {
var stream = through(write, end);
fs.readdir(path, function (err, src) {
if (err) {
stream.emit('error', err);
return;
}
stream.end(JSON.stringify(src));
});
return stream;
function write (buf, enc, next) {
this.push(buf);
next();
}
function end (next) {
this.push(null);
next();
}
}
};

46
BACK_BACK/node_modules/brfs/package.json generated vendored Executable file
View file

@ -0,0 +1,46 @@
{
"name": "brfs",
"version": "1.6.1",
"description": "browserify fs.readFileSync() static asset inliner",
"main": "index.js",
"bin": {
"brfs": "bin/cmd.js"
},
"dependencies": {
"quote-stream": "^1.0.1",
"resolve": "^1.1.5",
"static-module": "^2.2.0",
"through2": "^2.0.0"
},
"devDependencies": {
"browserify": "^16.1.1",
"concat-stream": "^1.6.0",
"tap": "~0.4.8",
"through": "^2.3.4"
},
"scripts": {
"test": "tap test/*.js"
},
"repository": {
"type": "git",
"url": "git://github.com/substack/brfs.git"
},
"homepage": "https://github.com/substack/brfs",
"keywords": [
"browserify",
"browserify-transform",
"fs",
"readFileSync",
"plugin",
"static",
"asset",
"bundle",
"base64"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"license": "MIT"
}

189
BACK_BACK/node_modules/brfs/readme.markdown generated vendored Executable file
View file

@ -0,0 +1,189 @@
# brfs
fs.readFileSync() and fs.readFile() static asset browserify transform
[![build status](https://secure.travis-ci.org/browserify/brfs.png)](http://travis-ci.org/browserify/brfs)
This module is a plugin for [browserify](http://browserify.org) to parse the AST
for `fs.readFileSync()` calls so that you can inline file contents into your
bundles.
Even though this module is intended for use with browserify, nothing about it is
particularly specific to browserify so it should be generally useful in other
projects.
# example
for a main.js:
``` js
var fs = require('fs');
var html = fs.readFileSync(__dirname + '/robot.html', 'utf8');
console.log(html);
```
and a robot.html:
``` html
<b>beep boop</b>
```
first `npm install brfs` into your project, then:
## on the command-line
```
$ browserify -t brfs example/main.js > bundle.js
```
now in the bundle output file,
``` js
var html = fs.readFileSync(__dirname + '/robot.html', 'utf8');
```
turns into:
``` js
var html = "<b>beep boop</b>\n";
```
## or with the api
``` js
var browserify = require('browserify');
var fs = require('fs');
var b = browserify('example/main.js');
b.transform('brfs');
b.bundle().pipe(fs.createWriteStream('bundle.js'));
```
## async
You can also use `fs.readFile()`:
``` js
var fs = require('fs');
fs.readFile(__dirname + '/robot.html', 'utf8', function (err, html) {
console.log(html);
});
```
When you run this code through brfs, it turns into:
``` js
var fs = require('fs');
process.nextTick(function () {(function (err, html) {
console.log(html);
})(null,"<b>beep boop</b>\n")});
```
# methods
brfs looks for:
* `fs.readFileSync(pathExpr, enc=null)`
* `fs.readFile(pathExpr, enc=null, cb)`
* `fs.readdirSync(pathExpr)`
* `fs.readdir(pathExpr, cb)`
Inside of each `pathExpr`, you can use
[statically analyzable](http://npmjs.org/package/static-eval) expressions and
these variables and functions:
* `__dirname`
* `__filename`
* `path` if you `var path = require('path')` first
* `require.resolve()`
Just like node, the default encoding is `null` and will give back a `Buffer`.
If you want differently-encoded file contents for your inline content you can
set `enc` to `'utf8'`, `'base64'`, or `'hex'`.
In async mode when a callback `cb` is given, the contents of `pathExpr` are
inlined into the source inside of a `process.nextTick()` call.
When you use a `'file'`-event aware watcher such as
[watchify](https://npmjs.org/package/watchify), the inlined assets will be
updated automatically.
If you want to use this plugin directly, not through browserify, the api
follows.
``` js
var brfs = require('brfs')
```
## var tr = brfs(file, opts)
Return a through stream `tr` inlining `fs.readFileSync()` file contents
in-place.
Optionally, you can set which `opts.vars` will be used in the
[static argument evaluation](https://npmjs.org/package/static-eval)
in addition to `__dirname` and `__filename`.
`opts.parserOpts` can be used to configure the parser brfs uses,
[acorn](https://github.com/acornjs/acorn#main-parser).
# events
## tr.on('file', function (file) {})
For every file included with `fs.readFileSync()` or `fs.readFile()`, the `tr`
instance emits a `'file'` event with the `file` path.
# usage
A tiny command-line program ships with this module to make debugging easier.
```
usage:
brfs file
Inline `fs.readFileSync()` calls from `file`, printing the transformed file
contents to stdout.
brfs
brfs -
Inline `fs.readFileSync()` calls from stdin, printing the transformed file
contents to stdout.
```
# install
With [npm](https://npmjs.org) do:
```
npm install brfs
```
then use `-t brfs` with the browserify command or use `.transform('brfs')` from
the browserify api.
# gotchas
Since `brfs` evaluates your source code *statically*, you can't use dynamic expressions that need to be evaluated at run time. For example:
```js
// WILL NOT WORK!
var file = window.someFilePath;
var str = require('fs').readFileSync(file, 'utf8');
```
Instead, you must use simpler expressions that can be resolved at build-time:
```js
var str = require('fs').readFileSync(__dirname + '/file.txt', 'utf8');
```
Another gotcha: `brfs` does not yet support ES module `import` statements. See [brfs-babel](https://github.com/Jam3/brfs-babel) for an experimental replacement that supports this syntax.
# license
MIT

23
BACK_BACK/node_modules/brfs/test/ag.js generated vendored Executable file
View file

@ -0,0 +1,23 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var fs = require('fs');
var path = require('path');
test('skip parsing json', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/files/ag.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, { console: { log: log } });
});
function log (msg) {
t.equal('<h1>abcdefg</h1>\n', msg);
}
});

51
BACK_BACK/node_modules/brfs/test/async.js generated vendored Executable file
View file

@ -0,0 +1,51 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var fs = require('fs');
var path = require('path');
test('async', function (t) {
t.plan(1);
var b = browserify(__dirname + '/files/async.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, {
setTimeout: setTimeout,
clearTimeout: clearTimeout,
console: { log: log }
});
});
function log (msg) { t.equal(msg, 'what\n') }
});
test('async encoding', function (t) {
t.plan(1);
var b = browserify(__dirname + '/files/async_encoding.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, {
setTimeout: setTimeout,
clearTimeout: clearTimeout,
console: { log: log }
});
});
function log (msg) { t.equal(msg, '776861740a') }
});
test('async string encoding', function (t) {
t.plan(1);
var b = browserify(__dirname + '/files/async_str_encoding.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, {
setTimeout: setTimeout,
clearTimeout: clearTimeout,
console: { log: log }
});
});
function log (msg) { t.equal(msg, '776861740a') }
});

31
BACK_BACK/node_modules/brfs/test/buffer.js generated vendored Executable file
View file

@ -0,0 +1,31 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var path = require('path');
if (!ArrayBuffer.isView) ArrayBuffer.isView = function () { return false; };
test('sync string encoding', function (t) {
t.plan(2);
var b = browserify(__dirname + '/files/buffer.js');
b.require('buffer', { expose: 'buffer' });
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
var context = {
setTimeout: setTimeout,
console: { log: log },
ArrayBuffer: ArrayBuffer,
Uint8Array: Uint8Array,
DataView: DataView
};
var buffers = [];
vm.runInNewContext(src, context);
t.ok(context.require('buffer').Buffer.isBuffer(buffers[0]), 'isBuffer');
t.equal(buffers[0].toString('utf8'), '<b>beep boop</b>\n');
function log (msg) { buffers.push(msg) }
});
});

25
BACK_BACK/node_modules/brfs/test/bundle.js generated vendored Executable file
View file

@ -0,0 +1,25 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var fs = require('fs');
var path = require('path');
var html = fs.readFileSync(__dirname + '/files/robot.html', 'utf8');
test('bundle a file', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/files/main.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, { console: { log: log } });
});
function log (msg) {
t.equal(html, msg);
}
});

26
BACK_BACK/node_modules/brfs/test/cmd.js generated vendored Executable file
View file

@ -0,0 +1,26 @@
var test = require('tap').test;
var exec = require('child_process').exec;
var vm = require('vm');
var fs = require('fs');
var html = fs.readFileSync(__dirname + '/files/robot.html', 'utf8');
test('cmd.js', function (t) {
t.plan(1);
exec(__dirname + '/../bin/cmd.js ' + __dirname + '/files/main.js',
function (error, stdout, stderr) {
if (error !== null) {
t.fail();
} else {
vm.runInNewContext(stdout, {
require: function () {},
console: { log: log }
});
function log (msg) {
t.equal(html, msg);
};
};
}
);
});

17
BACK_BACK/node_modules/brfs/test/dynamic_read_concat.js generated vendored Executable file
View file

@ -0,0 +1,17 @@
var test = require('tap').test;
var browserify = require('browserify');
var path = require('path');
test('dynamically loaded file gets skipped', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/files/dynamic_read_concat');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
else t.ok(true, 'build success');
});
});

17
BACK_BACK/node_modules/brfs/test/dynamic_read_no_concat.js generated vendored Executable file
View file

@ -0,0 +1,17 @@
var test = require('tap').test;
var browserify = require('browserify');
var path = require('path');
test('dynamically loaded file gets skipped', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/files/dynamic_read_no_concat.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
else t.ok(true, 'build success');
});
});

19
BACK_BACK/node_modules/brfs/test/encoding.js generated vendored Executable file
View file

@ -0,0 +1,19 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var path = require('path');
test('sync string encoding', function (t) {
t.plan(1);
var b = browserify(__dirname + '/files/encoding.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, {
setTimeout: setTimeout,
console: { log: log }
});
});
function log (msg) { t.equal(msg, '3c623e6265657020626f6f703c2f623e0a') }
});

5
BACK_BACK/node_modules/brfs/test/files/ag.js generated vendored Executable file
View file

@ -0,0 +1,5 @@
var fs = require('fs');
var pre = fs.readFileSync(__dirname + '/ag_pre.html', 'utf8');
var post = fs.readFileSync(__dirname + '/ag_post.html', 'utf8');
var ag = require('./ag.json');
console.log(pre + Object.keys(ag).sort().join('') + post);

1
BACK_BACK/node_modules/brfs/test/files/ag.json generated vendored Executable file
View file

@ -0,0 +1 @@
{"a":1,"b":2,"c":2,"d":3,"e":4,"f":5,"g":6}

1
BACK_BACK/node_modules/brfs/test/files/ag_post.html generated vendored Executable file
View file

@ -0,0 +1 @@
</h1>

1
BACK_BACK/node_modules/brfs/test/files/ag_pre.html generated vendored Executable file
View file

@ -0,0 +1 @@
<h1>

4
BACK_BACK/node_modules/brfs/test/files/async.js generated vendored Executable file
View file

@ -0,0 +1,4 @@
var fs = require('fs');
fs.readFile(__dirname + '/async.txt', 'utf8', function (err, txt) {
console.log(txt);
});

1
BACK_BACK/node_modules/brfs/test/files/async.txt generated vendored Executable file
View file

@ -0,0 +1 @@
what

4
BACK_BACK/node_modules/brfs/test/files/async_encoding.js generated vendored Executable file
View file

@ -0,0 +1,4 @@
var fs = require('fs');
fs.readFile(__dirname + '/async.txt', { encoding: 'hex' }, function (err, txt) {
console.log(txt);
});

View file

@ -0,0 +1,4 @@
var fs = require('fs');
fs.readFile(__dirname + '/async.txt', 'hex', function (err, txt) {
console.log(txt);
});

3
BACK_BACK/node_modules/brfs/test/files/buffer.js generated vendored Executable file
View file

@ -0,0 +1,3 @@
var fs = require('fs');
var txt = fs.readFileSync(__dirname + '/robot.html');
console.log(txt);

View file

@ -0,0 +1,4 @@
var fs = require('fs');
var path = require('path');
var dynamicallyCreatedFilename = path.join('/files/', 'somefile');
var stuff = fs.readFileSync(__dirname + dynamicallyCreatedFilename + __dirname, 'utf8');

View file

@ -0,0 +1,4 @@
var fs = require('fs');
var path = require('path');
var dynamicallyCreatedFilename = path.join('/files/', 'somefile');
var stuff = fs.readFileSync(dynamicallyCreatedFilename, 'utf8');

4
BACK_BACK/node_modules/brfs/test/files/encoding.js generated vendored Executable file
View file

@ -0,0 +1,4 @@
var fs = require('fs');
var txt = fs.readFileSync(__dirname + '/robot.html', { encoding: 'hex' });
console.log(txt);

3
BACK_BACK/node_modules/brfs/test/files/hoist.js generated vendored Executable file
View file

@ -0,0 +1,3 @@
var fs = require('fs');
var html = fs.readFileSync(__dirname + '/robot.html', 'utf8');
console.log(html);

2
BACK_BACK/node_modules/brfs/test/files/inline.js generated vendored Executable file
View file

@ -0,0 +1,2 @@
var html = require('fs').readFileSync(__dirname + '/robot.html', 'utf8');
console.log(html);

3
BACK_BACK/node_modules/brfs/test/files/main.js generated vendored Executable file
View file

@ -0,0 +1,3 @@
var fs = require('fs');
var html = fs.readFileSync(__dirname + '/robot.html', 'utf8');
console.log(html);

3
BACK_BACK/node_modules/brfs/test/files/multi_var.js generated vendored Executable file
View file

@ -0,0 +1,3 @@
var x = 5, y = require('fs'), z = 555;
var html = y.readFileSync(__dirname + '/robot.html', 'utf8');
console.log(html);

3
BACK_BACK/node_modules/brfs/test/files/non_fs.js generated vendored Executable file
View file

@ -0,0 +1,3 @@
var blarg = require('fs');
var html = blarg.readFileSync(__dirname + '/robot.html', 'utf8');
console.log(html);

4
BACK_BACK/node_modules/brfs/test/files/path_join.js generated vendored Executable file
View file

@ -0,0 +1,4 @@
var fs = require('fs');
var path = require('path');
var html = fs.readFileSync(path.join(__dirname, 'robot.html'), 'utf8');
console.log(html);

View file

@ -0,0 +1,4 @@
var fs = require('fs');
var xxx = require('path');
var html = fs.readFileSync(xxx.join(__dirname, 'robot.html'), 'utf8');
console.log(html);

View file

@ -0,0 +1,4 @@
var fs = require('fs');
var join = require('path').join;
var html = fs.readFileSync(join(__dirname, 'robot.html'), 'utf8');
console.log(html);

3
BACK_BACK/node_modules/brfs/test/files/readdir-sync.js generated vendored Executable file
View file

@ -0,0 +1,3 @@
var fs = require('fs');
console.log(fs.readdirSync(__dirname));

6
BACK_BACK/node_modules/brfs/test/files/readdir.js generated vendored Executable file
View file

@ -0,0 +1,6 @@
var fs = require('fs');
fs.readdir(__dirname, function(err, files) {
if (err) throw err;
console.log(files);
});

1
BACK_BACK/node_modules/brfs/test/files/robot.html generated vendored Executable file
View file

@ -0,0 +1 @@
<b>beep boop</b>

3
BACK_BACK/node_modules/brfs/test/files/separators.js generated vendored Executable file
View file

@ -0,0 +1,3 @@
var fs = require('fs');
var text = fs.readFileSync(__dirname + '/separators.txt', 'utf8');
console.log(text);

3
BACK_BACK/node_modules/brfs/test/files/separators.txt generated vendored Executable file
View file

@ -0,0 +1,3 @@
LINE_SEPARATOR: (U+2028)
PARAGRAPH_SEPARATOR: (U+2029)

3
BACK_BACK/node_modules/brfs/test/files/tr.beep generated vendored Executable file
View file

@ -0,0 +1,3 @@
var fs = require('fs');
var html = fs.readFileSync(__dirname + '/tr.html', 'utf8');
console.log((FN(){ return html.length })());

1
BACK_BACK/node_modules/brfs/test/files/tr.html generated vendored Executable file
View file

@ -0,0 +1 @@
<h1>abc</h1>

17
BACK_BACK/node_modules/brfs/test/files/with_comments.js generated vendored Executable file
View file

@ -0,0 +1,17 @@
var
/**
* Dependencies.
*/
fs = require('fs'),
/**
* Local variables.
*/
style = fs.readFileSync(__dirname + '/robot.html', 'utf8');
module.exports = function () {
console.log(style);
};
module.exports();

25
BACK_BACK/node_modules/brfs/test/hoist.js generated vendored Executable file
View file

@ -0,0 +1,25 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var fs = require('fs');
var path = require('path');
var html = fs.readFileSync(__dirname + '/files/robot.html', 'utf8');
test('hoisted fs declaration', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/files/hoist.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, { console: { log: log } });
});
function log (msg) {
t.equal(html, msg);
}
});

25
BACK_BACK/node_modules/brfs/test/inline.js generated vendored Executable file
View file

@ -0,0 +1,25 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var fs = require('fs');
var path = require('path');
var html = fs.readFileSync(__dirname + '/files/robot.html', 'utf8');
test('bundle a file', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/files/inline.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, { console: { log: log } });
});
function log (msg) {
t.equal(html, msg);
}
});

25
BACK_BACK/node_modules/brfs/test/multi_var.js generated vendored Executable file
View file

@ -0,0 +1,25 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var fs = require('fs');
var path = require('path');
var html = fs.readFileSync(__dirname + '/files/robot.html', 'utf8');
test('multiple var assignments', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/files/multi_var.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, { console: { log: log } });
});
function log (msg) {
t.equal(html, msg);
}
});

25
BACK_BACK/node_modules/brfs/test/non_fs.js generated vendored Executable file
View file

@ -0,0 +1,25 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var fs = require('fs');
var path = require('path');
var html = fs.readFileSync(__dirname + '/files/robot.html', 'utf8');
test('bundle a file', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/files/non_fs.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, { console: { log: log } });
});
function log (msg) {
t.equal(html, msg);
}
});

25
BACK_BACK/node_modules/brfs/test/path_join.js generated vendored Executable file
View file

@ -0,0 +1,25 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var fs = require('fs');
var path = require('path');
var html = fs.readFileSync(__dirname + '/files/robot.html', 'utf8');
test('path.join', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/files/path_join.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, { console: { log: log } });
});
function log (msg) {
t.equal(html, msg);
}
});

25
BACK_BACK/node_modules/brfs/test/path_join_other_name.js generated vendored Executable file
View file

@ -0,0 +1,25 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var fs = require('fs');
var path = require('path');
var html = fs.readFileSync(__dirname + '/files/robot.html', 'utf8');
test('path.join other name', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/files/path_join_other_name.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, { console: { log: log } });
});
function log (msg) {
t.equal(html, msg);
}
});

25
BACK_BACK/node_modules/brfs/test/path_join_single_var.js generated vendored Executable file
View file

@ -0,0 +1,25 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var fs = require('fs');
var path = require('path');
var html = fs.readFileSync(__dirname + '/files/robot.html', 'utf8');
test('path.join single var', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/files/path_join_single_var.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, { console: { log: log } });
});
function log (msg) {
t.equal(html, msg);
}
});

44
BACK_BACK/node_modules/brfs/test/readdir.js generated vendored Executable file
View file

@ -0,0 +1,44 @@
var browserify = require('browserify');
var test = require('tap').test;
var path = require('path');
var vm = require('vm');
var fs = require('fs');
test('readdir', function(t) {
t.plan(1);
var expected = fs.readdirSync(__dirname + '/files');
var b = browserify(__dirname + '/files/readdir.js');
b.transform(path.dirname(__dirname));
b.bundle(function(err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, {
console: { log: log },
setTimeout: setTimeout,
clearTimeout: clearTimeout
});
});
function log(actual) {
t.deepEqual(expected, actual);
}
});
test('readdirSync', function(t) {
t.plan(1);
var expected = fs.readdirSync(__dirname + '/files');
var b = browserify(__dirname + '/files/readdir-sync.js');
b.transform(path.dirname(__dirname));
b.bundle(function(err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, {
console: { log: log }
});
});
function log(actual) {
t.deepEqual(expected, actual);
}
});

21
BACK_BACK/node_modules/brfs/test/require_resolve.js generated vendored Executable file
View file

@ -0,0 +1,21 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var fs = require('fs');
var path = require('path');
test('require.resolve', function (t) {
t.plan(2);
var b = browserify();
b.add(__dirname + '/require_resolve/main.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
t.ifError(err);
vm.runInNewContext(src, { console: { log: log } });
});
function log (msg) { t.equal(msg, 'amaze\n') }
});

4
BACK_BACK/node_modules/brfs/test/require_resolve/main.js generated vendored Executable file
View file

@ -0,0 +1,4 @@
var fs = require('fs');
var path = require('path');
var html = fs.readFileSync(require.resolve('aaa/wow.txt'), 'utf8');
console.log(html);

View file

@ -0,0 +1 @@
amaze

45
BACK_BACK/node_modules/brfs/test/separators.js generated vendored Executable file
View file

@ -0,0 +1,45 @@
var test = require('tap').test;
var exec = require('child_process').exec;
var browserify = require('browserify');
var path = require('path');
var vm = require('vm');
var fs = require('fs');
var text = fs.readFileSync(__dirname + '/files/separators.txt', 'utf8');
test('run file with special unicode separators', function (t) {
t.plan(1);
exec(__dirname + '/../bin/cmd.js ' + __dirname + '/files/separators.js',
function (error, stdout, stderr) {
if (error !== null) {
t.fail();
} else {
vm.runInNewContext(stdout, {
require: function () {},
console: { log: log }
});
function log (msg) {
t.equal(text, msg);
};
};
}
);
});
test('bundle file with special unicode separators', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/files/separators.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, { console: { log: log } });
});
function log (msg) {
t.equal(text, msg);
}
});

41
BACK_BACK/node_modules/brfs/test/tr.js generated vendored Executable file
View file

@ -0,0 +1,41 @@
var test = require('tap').test;
var browserify = require('browserify');
var through = require('through');
var vm = require('vm');
var fs = require('fs');
var path = require('path');
test('parse non-js, non-json files', function (t) {
t.plan(2);
var b = browserify();
b.add(__dirname + '/files/tr.beep');
b.transform(function (file) {
var buffers = [];
if (!/\.beep$/.test(file)) return through();
return through(write, end);
function write (buf) { buffers.push(buf) }
function end () {
var src = Buffer.concat(buffers).toString('utf8');
this.queue(src.replace(/\bFN\b/g, 'function'));
this.queue(null);
}
});
b.transform(path.dirname(__dirname));
var bs = b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, { console: { log: log } });
});
b.on('transform', function (tr) {
tr.on('file', function (file) {
t.equal(file, __dirname + '/files/tr.html');
});
});
function log (msg) {
t.equal(13, msg);
}
});

25
BACK_BACK/node_modules/brfs/test/with_comments.js generated vendored Executable file
View file

@ -0,0 +1,25 @@
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
var fs = require('fs');
var path = require('path');
var html = fs.readFileSync(__dirname + '/files/robot.html', 'utf8');
test('with comment separators', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/files/with_comments.js');
b.transform(path.dirname(__dirname));
b.bundle(function (err, src) {
if (err) t.fail(err);
vm.runInNewContext(src, { console: { log: log } });
});
function log (msg) {
t.equal(html, msg);
}
});