diff options
author | 2020-11-16 00:10:28 +0100 | |
---|---|---|
committer | 2020-11-16 00:10:28 +0100 | |
commit | e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d (patch) | |
tree | 55713f725f77b44ebfec86e4eec3ce33e71458ca /node_modules/buffer/bin | |
download | website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.gz website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.bz2 website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.zip |
api, login, auth
Diffstat (limited to 'node_modules/buffer/bin')
-rwxr-xr-x | node_modules/buffer/bin/download-node-tests.js | 106 | ||||
-rw-r--r-- | node_modules/buffer/bin/test.js | 41 | ||||
-rwxr-xr-x | node_modules/buffer/bin/update-authors.sh | 21 | ||||
-rw-r--r-- | node_modules/buffer/bin/zuul-es5.yml | 14 | ||||
-rw-r--r-- | node_modules/buffer/bin/zuul-es6.yml | 6 |
5 files changed, 188 insertions, 0 deletions
diff --git a/node_modules/buffer/bin/download-node-tests.js b/node_modules/buffer/bin/download-node-tests.js new file mode 100755 index 0000000..97efde0 --- /dev/null +++ b/node_modules/buffer/bin/download-node-tests.js @@ -0,0 +1,106 @@ +#!/usr/bin/env node + +var concat = require('concat-stream') +var cp = require('child_process') +var fs = require('fs') +var hyperquest = require('hyperquest') +var path = require('path') +var split = require('split') +var through = require('through2') + +var url = 'https://api.github.com/repos/nodejs/node/contents' +var dirs = [ + '/test/parallel', + '/test/pummel' +] + +cp.execSync('rm -rf node/*.js', { cwd: path.join(__dirname, '../test') }) + +var httpOpts = { + headers: { + 'User-Agent': null + // auth if github rate-limits you... + // 'Authorization': 'Basic ' + Buffer('username:password').toString('base64'), + } +} + +dirs.forEach(function (dir) { + var req = hyperquest(url + dir, httpOpts) + req.pipe(concat(function (data) { + if (req.response.statusCode !== 200) { + throw new Error(url + dir + ': ' + data.toString()) + } + downloadBufferTests(dir, JSON.parse(data)) + })) +}) + +function downloadBufferTests (dir, files) { + files.forEach(function (file) { + if (!/test-buffer.*/.test(file.name)) return + + if (file.name === 'test-buffer-fakes.js') { + // These teses only apply to node, where they're calling into C++ and need to + // ensure the prototype can't be faked, or else there will be a segfault. + return + } + + console.log(file.download_url) + + var out = path.join(__dirname, '../test/node', file.name) + hyperquest(file.download_url, httpOpts) + .pipe(split()) + .pipe(testfixer(file.name)) + .pipe(fs.createWriteStream(out)) + .on('finish', function () { + console.log('wrote ' + file.name) + }) + }) +} + +function testfixer (filename) { + var firstline = true + + return through(function (line, enc, cb) { + line = line.toString() + + if (firstline) { + // require buffer explicitly + var preamble = 'var Buffer = require(\'../../\').Buffer;\n' + if (/use strict/.test(line)) line += '\n' + preamble + else line + preamble + '\n' + line + firstline = false + } + + // use `var` instead of `const`/`let` + line = line.replace(/(const|let) /g, 'var ') + + // make `var common = require('common')` work + line = line.replace(/(var common = require.*)/g, 'var common = { skip: function () {} };') + + // make `require('../common')` work + line = line.replace(/require\('\.\.\/common'\);/g, '') + + // require browser buffer + line = line.replace(/(.*)require\('buffer'\)(.*)/g, '$1require(\'../../\')$2') + + // comment out console logs + line = line.replace(/(.*console\..*)/g, '// $1') + + // we can't reliably test typed array max-sizes in the browser + if (filename === 'test-buffer-big.js') { + line = line.replace(/(.*new Int8Array.*RangeError.*)/, '// $1') + line = line.replace(/(.*new ArrayBuffer.*RangeError.*)/, '// $1') + line = line.replace(/(.*new Float64Array.*RangeError.*)/, '// $1') + } + + // https://github.com/nodejs/node/blob/v0.12/test/parallel/test-buffer.js#L1138 + // unfortunately we can't run this because crypto-browserify doesn't work in old + // versions of ie + if (filename === 'test-buffer.js') { + line = line.replace(/^(\s*)(var crypto = require.*)/, '$1// $2') + line = line.replace(/(crypto.createHash.*\))/, '1 /*$1*/') + } + + cb(null, line + '\n') + }) +} diff --git a/node_modules/buffer/bin/test.js b/node_modules/buffer/bin/test.js new file mode 100644 index 0000000..5a86f1b --- /dev/null +++ b/node_modules/buffer/bin/test.js @@ -0,0 +1,41 @@ +#!/usr/bin/env node + +var cp = require('child_process') +var fs = require('fs') +var path = require('path') + +var shouldRunBrowserTests = !process.env.TRAVIS_PULL_REQUEST || + process.env.TRAVIS_PULL_REQUEST === 'false' + +var node = cp.spawn('npm', ['run', 'test-node'], { stdio: 'inherit' }) +node.on('close', function (code) { + if (code === 0 && shouldRunBrowserTests) { + runBrowserTests() + } else { + process.exit(code) + } +}) + +function runBrowserTests () { + var zuulYmlPath = path.join(__dirname, '..', '.zuul.yml') + + writeES5ZuulYml() + cp.spawn('npm', ['run', 'test-browser-es5'], { stdio: 'inherit' }) + .on('close', function (code) { + if (code !== 0) process.exit(code) + writeES6ZuulYml() + cp.spawn('npm', ['run', 'test-browser-es6'], { stdio: 'inherit' }) + .on('close', function (code) { + process.exit(code) + }) + }) + + function writeES5ZuulYml () { + fs.writeFileSync(zuulYmlPath, fs.readFileSync(path.join(__dirname, 'zuul-es5.yml'))) + } + + function writeES6ZuulYml () { + fs.writeFileSync(zuulYmlPath, fs.readFileSync(path.join(__dirname, 'zuul-es6.yml'))) + } +} + diff --git a/node_modules/buffer/bin/update-authors.sh b/node_modules/buffer/bin/update-authors.sh new file mode 100755 index 0000000..efcbc78 --- /dev/null +++ b/node_modules/buffer/bin/update-authors.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Update AUTHORS.md based on git history. + +git log --reverse --format='%aN (%aE)' | perl -we ' +BEGIN { + %seen = (), @authors = (); +} +while (<>) { + next if $seen{$_}; + next if /(support\@greenkeeper.io)/; + next if /(dcousens\@users.noreply.github.com)/; + next if /(cmetcalf\@appgeo.com)/; + $seen{$_} = push @authors, "- ", $_; +} +END { + print "# Authors\n\n"; + print "#### Ordered by first contribution.\n\n"; + print @authors, "\n"; + print "#### Generated by bin/update-authors.sh.\n"; +} +' > AUTHORS.md diff --git a/node_modules/buffer/bin/zuul-es5.yml b/node_modules/buffer/bin/zuul-es5.yml new file mode 100644 index 0000000..3673bcc --- /dev/null +++ b/node_modules/buffer/bin/zuul-es5.yml @@ -0,0 +1,14 @@ +ui: tape +scripts: + - ./test/_polyfill.js +browsers: + - name: safari + version: latest + - name: ie + version: 8..latest + - name: microsoftedge + version: 13..latest + - name: android + version: 4.4..latest + - name: iphone + version: latest diff --git a/node_modules/buffer/bin/zuul-es6.yml b/node_modules/buffer/bin/zuul-es6.yml new file mode 100644 index 0000000..8054ad6 --- /dev/null +++ b/node_modules/buffer/bin/zuul-es6.yml @@ -0,0 +1,6 @@ +ui: tape +browsers: + - name: chrome + version: '-1..latest' + - name: firefox + version: '-1..latest' |