mirror of
https://github.com/JonasunderscoreJones/aka-worker.git
synced 2025-10-23 09:59:19 +02:00
Initial commit (by create-cloudflare CLI)
This commit is contained in:
parent
8cb86120f1
commit
fff961078a
1777 changed files with 1011798 additions and 0 deletions
9
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/LICENSE.md
generated
vendored
Normal file
9
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 these people
|
||||
|
||||
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.
|
117
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/dist/index.js
generated
vendored
Normal file
117
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,117 @@
|
|||
'use strict';
|
||||
|
||||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
||||
|
||||
const inject = _interopDefault(require('rollup-plugin-inject'));
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const EMPTY_PATH = require.resolve('../polyfills/empty.js');
|
||||
function builtinsResolver(opts) {
|
||||
const libs = new Map();
|
||||
libs.set('process', require.resolve('../polyfills/process-es6'));
|
||||
libs.set('buffer', require.resolve('../polyfills/buffer-es6'));
|
||||
libs.set('util', require.resolve('../polyfills/util'));
|
||||
libs.set('sys', libs.get('util'));
|
||||
libs.set('events', require.resolve('../polyfills/events'));
|
||||
libs.set('stream', require.resolve('../polyfills/stream'));
|
||||
libs.set('path', require.resolve('../polyfills/path'));
|
||||
libs.set('querystring', require.resolve('../polyfills/qs'));
|
||||
libs.set('punycode', require.resolve('../polyfills/punycode'));
|
||||
libs.set('url', require.resolve('../polyfills/url'));
|
||||
libs.set('string_decoder', require.resolve('../polyfills/string-decoder'));
|
||||
libs.set('http', require.resolve('../polyfills/http'));
|
||||
libs.set('https', require.resolve('../polyfills/http'));
|
||||
libs.set('os', require.resolve('../polyfills/os'));
|
||||
libs.set('assert', require.resolve('../polyfills/assert'));
|
||||
libs.set('constants', require.resolve('../polyfills/constants'));
|
||||
libs.set('_stream_duplex', require.resolve('../polyfills/readable-stream/duplex'));
|
||||
libs.set('_stream_passthrough', require.resolve('../polyfills/readable-stream/passthrough'));
|
||||
libs.set('_stream_readable', require.resolve('../polyfills/readable-stream/readable'));
|
||||
libs.set('_stream_writable', require.resolve('../polyfills/readable-stream/writable'));
|
||||
libs.set('_stream_transform', require.resolve('../polyfills/readable-stream/transform'));
|
||||
libs.set('timers', require.resolve('../polyfills/timers'));
|
||||
libs.set('console', require.resolve('../polyfills/console'));
|
||||
libs.set('vm', require.resolve('../polyfills/vm'));
|
||||
libs.set('zlib', require.resolve('../polyfills/zlib'));
|
||||
libs.set('tty', require.resolve('../polyfills/tty'));
|
||||
libs.set('domain', require.resolve('../polyfills/domain'));
|
||||
// not shimmed
|
||||
libs.set('dns', EMPTY_PATH);
|
||||
libs.set('dgram', EMPTY_PATH);
|
||||
libs.set('child_process', EMPTY_PATH);
|
||||
libs.set('cluster', EMPTY_PATH);
|
||||
libs.set('module', EMPTY_PATH);
|
||||
libs.set('net', EMPTY_PATH);
|
||||
libs.set('readline', EMPTY_PATH);
|
||||
libs.set('repl', EMPTY_PATH);
|
||||
libs.set('tls', EMPTY_PATH);
|
||||
libs.set('fs', EMPTY_PATH);
|
||||
libs.set('crypto', EMPTY_PATH);
|
||||
if (opts.fs) {
|
||||
libs.set('fs', require.resolve('../polyfills/browserify-fs'));
|
||||
}
|
||||
if (opts.crypto) {
|
||||
libs.set('crypto', require.resolve('../polyfills/crypto-browserify'));
|
||||
}
|
||||
return (importee) => {
|
||||
if (importee && importee.slice(-1) === '/') {
|
||||
importee === importee.slice(0, -1);
|
||||
}
|
||||
if (libs.has(importee)) {
|
||||
return { id: libs.get(importee), moduleSideEffects: false };
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
function index (opts = {}) {
|
||||
const injectPlugin = inject({
|
||||
include: opts.include === undefined ? 'node_modules/**/*.js' : undefined,
|
||||
exclude: opts.exclude,
|
||||
sourceMap: opts.sourceMap,
|
||||
modules: {
|
||||
'process': 'process',
|
||||
'Buffer': ['buffer', 'Buffer'],
|
||||
'global': GLOBAL_PATH,
|
||||
'__filename': FILENAME_PATH,
|
||||
'__dirname': DIRNAME_PATH,
|
||||
}
|
||||
});
|
||||
const basedir = opts.baseDir || '/';
|
||||
const dirs = new Map();
|
||||
const resolver = builtinsResolver(opts);
|
||||
return {
|
||||
name: 'node-polyfills',
|
||||
resolveId(importee, importer) {
|
||||
if (importee === DIRNAME_PATH) {
|
||||
const id = getRandomId();
|
||||
dirs.set(id, path.dirname('/' + path.relative(basedir, importer)));
|
||||
return { id, moduleSideEffects: false };
|
||||
}
|
||||
if (importee === FILENAME_PATH) {
|
||||
const id = getRandomId();
|
||||
dirs.set(id, path.dirname('/' + path.relative(basedir, importer)));
|
||||
return { id, moduleSideEffects: false };
|
||||
}
|
||||
return resolver(importee);
|
||||
},
|
||||
load(id) {
|
||||
if (dirs.has(id)) {
|
||||
return `export default '${dirs.get(id)}'`;
|
||||
}
|
||||
},
|
||||
transform(code, id) {
|
||||
return injectPlugin.transform.call(this, code, id);
|
||||
}
|
||||
};
|
||||
}
|
||||
function getRandomId() {
|
||||
return crypto.randomBytes(15).toString('hex');
|
||||
}
|
||||
const GLOBAL_PATH = require.resolve('../polyfills/global.js');
|
||||
const DIRNAME_PATH = '\0node-polyfills:dirname';
|
||||
const FILENAME_PATH = '\0node-polyfills:filename';
|
||||
|
||||
module.exports = index;
|
113
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/dist/index.mjs
generated
vendored
Normal file
113
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/dist/index.mjs
generated
vendored
Normal file
|
@ -0,0 +1,113 @@
|
|||
import inject from 'rollup-plugin-inject';
|
||||
import { dirname, relative } from 'path';
|
||||
import { randomBytes } from 'crypto';
|
||||
|
||||
const EMPTY_PATH = require.resolve('../polyfills/empty.js');
|
||||
function builtinsResolver(opts) {
|
||||
const libs = new Map();
|
||||
libs.set('process', require.resolve('../polyfills/process-es6'));
|
||||
libs.set('buffer', require.resolve('../polyfills/buffer-es6'));
|
||||
libs.set('util', require.resolve('../polyfills/util'));
|
||||
libs.set('sys', libs.get('util'));
|
||||
libs.set('events', require.resolve('../polyfills/events'));
|
||||
libs.set('stream', require.resolve('../polyfills/stream'));
|
||||
libs.set('path', require.resolve('../polyfills/path'));
|
||||
libs.set('querystring', require.resolve('../polyfills/qs'));
|
||||
libs.set('punycode', require.resolve('../polyfills/punycode'));
|
||||
libs.set('url', require.resolve('../polyfills/url'));
|
||||
libs.set('string_decoder', require.resolve('../polyfills/string-decoder'));
|
||||
libs.set('http', require.resolve('../polyfills/http'));
|
||||
libs.set('https', require.resolve('../polyfills/http'));
|
||||
libs.set('os', require.resolve('../polyfills/os'));
|
||||
libs.set('assert', require.resolve('../polyfills/assert'));
|
||||
libs.set('constants', require.resolve('../polyfills/constants'));
|
||||
libs.set('_stream_duplex', require.resolve('../polyfills/readable-stream/duplex'));
|
||||
libs.set('_stream_passthrough', require.resolve('../polyfills/readable-stream/passthrough'));
|
||||
libs.set('_stream_readable', require.resolve('../polyfills/readable-stream/readable'));
|
||||
libs.set('_stream_writable', require.resolve('../polyfills/readable-stream/writable'));
|
||||
libs.set('_stream_transform', require.resolve('../polyfills/readable-stream/transform'));
|
||||
libs.set('timers', require.resolve('../polyfills/timers'));
|
||||
libs.set('console', require.resolve('../polyfills/console'));
|
||||
libs.set('vm', require.resolve('../polyfills/vm'));
|
||||
libs.set('zlib', require.resolve('../polyfills/zlib'));
|
||||
libs.set('tty', require.resolve('../polyfills/tty'));
|
||||
libs.set('domain', require.resolve('../polyfills/domain'));
|
||||
// not shimmed
|
||||
libs.set('dns', EMPTY_PATH);
|
||||
libs.set('dgram', EMPTY_PATH);
|
||||
libs.set('child_process', EMPTY_PATH);
|
||||
libs.set('cluster', EMPTY_PATH);
|
||||
libs.set('module', EMPTY_PATH);
|
||||
libs.set('net', EMPTY_PATH);
|
||||
libs.set('readline', EMPTY_PATH);
|
||||
libs.set('repl', EMPTY_PATH);
|
||||
libs.set('tls', EMPTY_PATH);
|
||||
libs.set('fs', EMPTY_PATH);
|
||||
libs.set('crypto', EMPTY_PATH);
|
||||
if (opts.fs) {
|
||||
libs.set('fs', require.resolve('../polyfills/browserify-fs'));
|
||||
}
|
||||
if (opts.crypto) {
|
||||
libs.set('crypto', require.resolve('../polyfills/crypto-browserify'));
|
||||
}
|
||||
return (importee) => {
|
||||
if (importee && importee.slice(-1) === '/') {
|
||||
importee === importee.slice(0, -1);
|
||||
}
|
||||
if (libs.has(importee)) {
|
||||
return { id: libs.get(importee), moduleSideEffects: false };
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
function index (opts = {}) {
|
||||
const injectPlugin = inject({
|
||||
include: opts.include === undefined ? 'node_modules/**/*.js' : undefined,
|
||||
exclude: opts.exclude,
|
||||
sourceMap: opts.sourceMap,
|
||||
modules: {
|
||||
'process': 'process',
|
||||
'Buffer': ['buffer', 'Buffer'],
|
||||
'global': GLOBAL_PATH,
|
||||
'__filename': FILENAME_PATH,
|
||||
'__dirname': DIRNAME_PATH,
|
||||
}
|
||||
});
|
||||
const basedir = opts.baseDir || '/';
|
||||
const dirs = new Map();
|
||||
const resolver = builtinsResolver(opts);
|
||||
return {
|
||||
name: 'node-polyfills',
|
||||
resolveId(importee, importer) {
|
||||
if (importee === DIRNAME_PATH) {
|
||||
const id = getRandomId();
|
||||
dirs.set(id, dirname('/' + relative(basedir, importer)));
|
||||
return { id, moduleSideEffects: false };
|
||||
}
|
||||
if (importee === FILENAME_PATH) {
|
||||
const id = getRandomId();
|
||||
dirs.set(id, dirname('/' + relative(basedir, importer)));
|
||||
return { id, moduleSideEffects: false };
|
||||
}
|
||||
return resolver(importee);
|
||||
},
|
||||
load(id) {
|
||||
if (dirs.has(id)) {
|
||||
return `export default '${dirs.get(id)}'`;
|
||||
}
|
||||
},
|
||||
transform(code, id) {
|
||||
return injectPlugin.transform.call(this, code, id);
|
||||
}
|
||||
};
|
||||
}
|
||||
function getRandomId() {
|
||||
return randomBytes(15).toString('hex');
|
||||
}
|
||||
const GLOBAL_PATH = require.resolve('../polyfills/global.js');
|
||||
const DIRNAME_PATH = '\0node-polyfills:dirname';
|
||||
const FILENAME_PATH = '\0node-polyfills:filename';
|
||||
|
||||
export default index;
|
10
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/dist/types/index.d.ts
generated
vendored
Normal file
10
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/dist/types/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { NodePolyfillsOptions } from './modules';
|
||||
export default function (opts?: NodePolyfillsOptions): {
|
||||
name: string;
|
||||
resolveId(importee: string, importer: string): {
|
||||
id: any;
|
||||
moduleSideEffects: boolean;
|
||||
} | null;
|
||||
load(id: string): string | undefined;
|
||||
transform(code: string, id: string): any;
|
||||
};
|
12
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/dist/types/modules.d.ts
generated
vendored
Normal file
12
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/dist/types/modules.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
export interface NodePolyfillsOptions {
|
||||
fs?: boolean;
|
||||
crypto?: boolean;
|
||||
sourceMap?: boolean;
|
||||
baseDir?: string;
|
||||
include?: Array<string | RegExp> | string | RegExp | null;
|
||||
exclude?: Array<string | RegExp> | string | RegExp | null;
|
||||
}
|
||||
export declare function builtinsResolver(opts: NodePolyfillsOptions): (importee: string) => {
|
||||
id: any;
|
||||
moduleSideEffects: boolean;
|
||||
} | null;
|
51
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/package.json
generated
vendored
Normal file
51
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/package.json
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "rollup-plugin-node-polyfills",
|
||||
"version": "0.2.1",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/types/index.d.ts",
|
||||
"scripts": {
|
||||
"pretest": "npm run build",
|
||||
"test": "mocha",
|
||||
"prebuild": "rm -rf dist && mkdir dist",
|
||||
"build": "npm run build:constants && npm run build:deps && npm run build:bundlers",
|
||||
"build:bundlers": "tsc -p . && rollup -c",
|
||||
"build:deps": "node scripts/build-polyfills.js",
|
||||
"build:constants": "node scripts/build-constants.js",
|
||||
"release": "np --no-yarn --no-release-draft",
|
||||
"browser-test": "serve browser-test/dist",
|
||||
"prebrowser-test": "npm run build && node ./browser-test/index.js"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"polyfills"
|
||||
],
|
||||
"keywords": [
|
||||
"rollup-plugin"
|
||||
],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"rollup-plugin-inject": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify-fs": "^1.0.0",
|
||||
"buffer-es6": "^4.9.2",
|
||||
"crypto-browserify": "^3.11.0",
|
||||
"debug": "^4.1.1",
|
||||
"mocha": "^6.1.4",
|
||||
"np": "^5.0.3",
|
||||
"process-es6": "^0.11.2",
|
||||
"rollup": "^1.15.4",
|
||||
"rollup-plugin-commonjs": "^10.0.0",
|
||||
"rollup-plugin-json": "^4.0.0",
|
||||
"rollup-plugin-license": "^0.9.0",
|
||||
"rollup-plugin-node-resolve": "^5.0.2",
|
||||
"serve": "^11.0.1",
|
||||
"typescript": "^3.5.2"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:ionic-team/rollup-plugin-node-polyfills.git"
|
||||
}
|
||||
}
|
472
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/LICENSE-browserify-fs.txt
generated
vendored
Normal file
472
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/LICENSE-browserify-fs.txt
generated
vendored
Normal file
|
@ -0,0 +1,472 @@
|
|||
Name: browserify-fs
|
||||
Version: 1.0.0
|
||||
License: undefined
|
||||
Private: false
|
||||
Description: fs for the browser using level-filesystem and browserify
|
||||
Repository: undefined
|
||||
|
||||
---
|
||||
|
||||
Name: level-js
|
||||
Version: 2.2.4
|
||||
License: BSD-2-Clause
|
||||
Private: false
|
||||
Description: leveldown/leveldb library for browsers using IndexedDB
|
||||
Repository: git@github.com:maxogden/level.js.git
|
||||
Author: max ogden
|
||||
|
||||
---
|
||||
|
||||
Name: levelup
|
||||
Version: 0.18.6
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Fast & simple storage - a Node.js-style LevelDB wrapper
|
||||
Repository: https://github.com/rvagg/node-levelup.git
|
||||
Homepage: https://github.com/rvagg/node-levelup
|
||||
Contributors:
|
||||
Rod Vagg <r@va.gg> (https://github.com/rvagg)
|
||||
John Chesley <john@chesl.es> (https://github.com/chesles/)
|
||||
Jake Verbaten <raynos2@gmail.com> (https://github.com/raynos)
|
||||
Dominic Tarr <dominic.tarr@gmail.com> (https://github.com/dominictarr)
|
||||
Max Ogden <max@maxogden.com> (https://github.com/maxogden)
|
||||
Lars-Magnus Skog <lars.magnus.skog@gmail.com> (https://github.com/ralphtheninja)
|
||||
David Björklund <david.bjorklund@gmail.com> (https://github.com/kesla)
|
||||
Julian Gruber <julian@juliangruber.com> (https://github.com/juliangruber)
|
||||
Paolo Fragomeni <paolo@async.ly> (https://github.com/hij1nx)
|
||||
Anton Whalley <anton.whalley@nearform.com> (https://github.com/No9)
|
||||
Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)
|
||||
Pedro Teixeira <pedro.teixeira@gmail.com> (https://github.com/pgte)
|
||||
James Halliday <mail@substack.net> (https://github.com/substack)
|
||||
|
||||
---
|
||||
|
||||
Name: level-filesystem
|
||||
Version: 1.2.0
|
||||
License: undefined
|
||||
Private: false
|
||||
Description: Full implementation of the fs module on top of leveldb
|
||||
Repository: undefined
|
||||
|
||||
---
|
||||
|
||||
Name: rollup-plugin-node-resolve
|
||||
Version: 5.0.1
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Bundle third-party dependencies in node_modules
|
||||
Repository: undefined
|
||||
Homepage: https://github.com/rollup/rollup-plugin-node-resolve#readme
|
||||
Author: Rich Harris <richard.a.harris@gmail.com>
|
||||
|
||||
---
|
||||
|
||||
Name: prr
|
||||
Version: 0.0.0
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: A better Object.defineProperty()
|
||||
Repository: https://github.com/rvagg/prr.git
|
||||
Homepage: https://github.com/rvagg/prr
|
||||
|
||||
---
|
||||
|
||||
Name: xtend
|
||||
Version: 2.1.2
|
||||
License: (MIT)
|
||||
Private: false
|
||||
Description: extend like a boss
|
||||
Repository: undefined
|
||||
Homepage: https://github.com/Raynos/xtend
|
||||
Author: Raynos <raynos2@gmail.com>
|
||||
Contributors:
|
||||
Jake Verbaten
|
||||
Matt Esch
|
||||
|
||||
---
|
||||
|
||||
Name: once
|
||||
Version: 1.4.0
|
||||
License: ISC
|
||||
Private: false
|
||||
Description: Run a function exactly one time
|
||||
Repository: git://github.com/isaacs/once
|
||||
Author: Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)
|
||||
|
||||
---
|
||||
|
||||
Name: octal
|
||||
Version: 1.0.0
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Interpret a number as base 8
|
||||
Repository: https://github.com/mafintosh/octal.git
|
||||
Homepage: https://github.com/mafintosh/octal
|
||||
Author: Mathias Buus (@mafintosh)
|
||||
|
||||
---
|
||||
|
||||
Name: readable-stream
|
||||
Version: 1.0.34
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Streams2, a user-land copy of the stream library from Node.js v0.10.x
|
||||
Repository: git://github.com/isaacs/readable-stream
|
||||
Author: Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)
|
||||
|
||||
---
|
||||
|
||||
Name: level-blobs
|
||||
Version: 0.1.7
|
||||
License: undefined
|
||||
Private: false
|
||||
Description: Save binary blobs in level and stream then back
|
||||
Repository: undefined
|
||||
|
||||
---
|
||||
|
||||
Name: level-sublevel
|
||||
Version: 5.2.3
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: partition levelup databases
|
||||
Repository: git://github.com/dominictarr/level-sublevel.git
|
||||
Homepage: https://github.com/dominictarr/level-sublevel
|
||||
Author: Dominic Tarr <dominic.tarr@gmail.com> (http://dominictarr.com)
|
||||
|
||||
---
|
||||
|
||||
Name: fwd-stream
|
||||
Version: 1.0.4
|
||||
License: undefined
|
||||
Private: false
|
||||
Description: Forward a readable stream to another readable stream or a writable stream to another writable stream
|
||||
Repository: undefined
|
||||
|
||||
---
|
||||
|
||||
Name: level-peek
|
||||
Version: 1.0.6
|
||||
License: MIT
|
||||
Private: false
|
||||
Repository: git://github.com/dominictarr/level-peek.git
|
||||
Homepage: https://github.com/dominictarr/level-peek
|
||||
Author: Dominic Tarr <dominic.tarr@gmail.com> (http://dominictarr.com)
|
||||
|
||||
---
|
||||
|
||||
Name: errno
|
||||
Version: 0.1.7
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: libuv errno details exposed
|
||||
Repository: https://github.com/rvagg/node-errno.git
|
||||
|
||||
---
|
||||
|
||||
Name: concat-stream
|
||||
Version: 1.6.2
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: writable stream that concatenates strings or binary data and calls a callback with the result
|
||||
Repository: http://github.com/maxogden/concat-stream.git
|
||||
Author: Max Ogden <max@maxogden.com>
|
||||
|
||||
---
|
||||
|
||||
Name: inherits
|
||||
Version: 2.0.3
|
||||
License: ISC
|
||||
Private: false
|
||||
Description: Browser-friendly inheritance fully compatible with standard node.js inherits()
|
||||
Repository: undefined
|
||||
|
||||
---
|
||||
|
||||
Name: idb-wrapper
|
||||
Version: 1.7.2
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: A cross-browser wrapper for IndexedDB
|
||||
Repository: undefined
|
||||
Homepage: https://github.com/jensarps/IDBWrapper
|
||||
Author: jensarps <mail@jensarps.de> (http://jensarps.de/)
|
||||
Contributors:
|
||||
Github Contributors (https://github.com/jensarps/IDBWrapper/graphs/contributors)
|
||||
|
||||
---
|
||||
|
||||
Name: typedarray-to-buffer
|
||||
Version: 1.0.4
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Convert a typed array to a Buffer without a copy
|
||||
Repository: git://github.com/feross/typedarray-to-buffer.git
|
||||
Homepage: http://feross.org
|
||||
Author: Feross Aboukhadijeh <feross@feross.org> (http://feross.org/)
|
||||
|
||||
---
|
||||
|
||||
Name: abstract-leveldown
|
||||
Version: 0.12.4
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: An abstract prototype matching the LevelDOWN API
|
||||
Repository: https://github.com/rvagg/node-abstract-leveldown.git
|
||||
Homepage: https://github.com/rvagg/node-abstract-leveldown
|
||||
Contributors:
|
||||
Rod Vagg <r@va.gg> (https://github.com/rvagg)
|
||||
John Chesley <john@chesl.es> (https://github.com/chesles/)
|
||||
Jake Verbaten <raynos2@gmail.com> (https://github.com/raynos)
|
||||
Dominic Tarr <dominic.tarr@gmail.com> (https://github.com/dominictarr)
|
||||
Max Ogden <max@maxogden.com> (https://github.com/maxogden)
|
||||
Lars-Magnus Skog <lars.magnus.skog@gmail.com> (https://github.com/ralphtheninja)
|
||||
David Björklund <david.bjorklund@gmail.com> (https://github.com/kesla)
|
||||
Julian Gruber <julian@juliangruber.com> (https://github.com/juliangruber)
|
||||
Paolo Fragomeni <paolo@async.ly> (https://github.com/hij1nx)
|
||||
Anton Whalley <anton.whalley@nearform.com> (https://github.com/No9)
|
||||
Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)
|
||||
Pedro Teixeira <pedro.teixeira@gmail.com> (https://github.com/pgte)
|
||||
James Halliday <mail@substack.net> (https://github.com/substack)
|
||||
|
||||
---
|
||||
|
||||
Name: isbuffer
|
||||
Version: 0.0.0
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: isBuffer for node and browser (supports typed arrays)
|
||||
Repository: git://github.com/juliangruber/isbuffer.git
|
||||
Homepage: https://github.com/juliangruber/isbuffer
|
||||
Author: Julian Gruber <mail@juliangruber.com> (http://juliangruber.com)
|
||||
|
||||
---
|
||||
|
||||
Name: deferred-leveldown
|
||||
Version: 0.2.0
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: For handling delayed-open on LevelDOWN compatible libraries
|
||||
Repository: https://github.com/Level/deferred-leveldown.git
|
||||
Homepage: https://github.com/Level/deferred-leveldown
|
||||
Contributors:
|
||||
Rod Vagg <r@va.gg> (https://github.com/rvagg)
|
||||
John Chesley <john@chesl.es> (https://github.com/chesles/)
|
||||
Jake Verbaten <raynos2@gmail.com> (https://github.com/raynos)
|
||||
Dominic Tarr <dominic.tarr@gmail.com> (https://github.com/dominictarr)
|
||||
Max Ogden <max@maxogden.com> (https://github.com/maxogden)
|
||||
Lars-Magnus Skog <lars.magnus.skog@gmail.com> (https://github.com/ralphtheninja)
|
||||
David Björklund <david.bjorklund@gmail.com> (https://github.com/kesla)
|
||||
Julian Gruber <julian@juliangruber.com> (https://github.com/juliangruber)
|
||||
Paolo Fragomeni <paolo@async.ly> (https://github.com/hij1nx)
|
||||
Anton Whalley <anton.whalley@nearform.com> (https://github.com/No9)
|
||||
Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)
|
||||
Pedro Teixeira <pedro.teixeira@gmail.com> (https://github.com/pgte)
|
||||
James Halliday <mail@substack.net> (https://github.com/substack)
|
||||
|
||||
---
|
||||
|
||||
Name: wrappy
|
||||
Version: 1.0.2
|
||||
License: ISC
|
||||
Private: false
|
||||
Description: Callback wrapping utility
|
||||
Repository: https://github.com/npm/wrappy
|
||||
Homepage: https://github.com/npm/wrappy
|
||||
Author: Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)
|
||||
|
||||
---
|
||||
|
||||
Name: bl
|
||||
Version: 0.8.2
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!
|
||||
Repository: https://github.com/rvagg/bl.git
|
||||
Homepage: https://github.com/rvagg/bl
|
||||
|
||||
---
|
||||
|
||||
Name: object-keys
|
||||
Version: 0.4.0
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: An Object.keys replacement, in case Object.keys is not available. From https://github.com/kriskowal/es5-shim
|
||||
Repository: git://github.com/ljharb/object-keys.git
|
||||
Author: Jordan Harband
|
||||
|
||||
---
|
||||
|
||||
Name: ltgt
|
||||
Version: 2.2.1
|
||||
License: MIT
|
||||
Private: false
|
||||
Repository: git://github.com/dominictarr/ltgt.git
|
||||
Homepage: https://github.com/dominictarr/ltgt
|
||||
Author: Dominic Tarr <dominic.tarr@gmail.com> (http://dominictarr.com)
|
||||
|
||||
---
|
||||
|
||||
Name: typedarray
|
||||
Version: 0.0.6
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: TypedArray polyfill for old browsers
|
||||
Repository: git://github.com/substack/typedarray.git
|
||||
Homepage: https://github.com/substack/typedarray
|
||||
Author: James Halliday <mail@substack.net> (http://substack.net)
|
||||
|
||||
---
|
||||
|
||||
Name: level-fix-range
|
||||
Version: 2.0.0
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: make using levelup reverse ranges easy
|
||||
Repository: git://github.com/dominictarr/level-fix-range.git
|
||||
Homepage: https://github.com/dominictarr/level-fix-range
|
||||
Author: Dominic Tarr <dominic.tarr@gmail.com> (http://dominictarr.com)
|
||||
|
||||
---
|
||||
|
||||
Name: buffer-from
|
||||
Version: 1.1.1
|
||||
License: MIT
|
||||
Private: false
|
||||
Repository: undefined
|
||||
|
||||
---
|
||||
|
||||
Name: isarray
|
||||
Version: 0.0.1
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Array#isArray for older browsers
|
||||
Repository: git://github.com/juliangruber/isarray.git
|
||||
Homepage: https://github.com/juliangruber/isarray
|
||||
Author: Julian Gruber <mail@juliangruber.com> (http://juliangruber.com)
|
||||
|
||||
---
|
||||
|
||||
Name: string_decoder
|
||||
Version: 0.10.31
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: The string_decoder module from Node core
|
||||
Repository: git://github.com/rvagg/string_decoder.git
|
||||
Homepage: https://github.com/rvagg/string_decoder
|
||||
|
||||
---
|
||||
|
||||
Name: safe-buffer
|
||||
Version: 5.1.2
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Safer Node.js Buffer API
|
||||
Repository: git://github.com/feross/safe-buffer.git
|
||||
Homepage: https://github.com/feross/safe-buffer
|
||||
Author: Feross Aboukhadijeh <feross@feross.org> (http://feross.org)
|
||||
|
||||
---
|
||||
|
||||
Name: level-hooks
|
||||
Version: 4.5.0
|
||||
License: undefined
|
||||
Private: false
|
||||
Description: pre/post hooks for leveldb
|
||||
Repository: git://github.com/dominictarr/level-hooks.git
|
||||
Homepage: https://github.com/dominictarr/level-hooks
|
||||
Author: Dominic Tarr <dominic.tarr@gmail.com> (http://bit.ly/dominictarr)
|
||||
|
||||
---
|
||||
|
||||
Name: core-util-is
|
||||
Version: 1.0.2
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: The `util.is*` functions introduced in Node v0.12.
|
||||
Repository: git://github.com/isaacs/core-util-is
|
||||
Author: Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)
|
||||
|
||||
---
|
||||
|
||||
Name: string-range
|
||||
Version: 1.2.2
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: check if a string is within a range
|
||||
Repository: git://github.com/dominictarr/string-range.git
|
||||
Homepage: https://github.com/dominictarr/string-range
|
||||
Author: Dominic Tarr <dominic.tarr@gmail.com> (http://dominictarr.com)
|
||||
|
||||
---
|
||||
|
||||
Name: process-nextick-args
|
||||
Version: 2.0.0
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: process.nextTick but always with args
|
||||
Repository: https://github.com/calvinmetcalf/process-nextick-args.git
|
||||
Homepage: https://github.com/calvinmetcalf/process-nextick-args
|
||||
|
||||
---
|
||||
|
||||
Name: util-deprecate
|
||||
Version: 1.0.2
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: The Node.js `util.deprecate()` function with browser support
|
||||
Repository: git://github.com/TooTallNate/util-deprecate.git
|
||||
Homepage: https://github.com/TooTallNate/util-deprecate
|
||||
Author: Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/)
|
||||
|
||||
---
|
||||
|
||||
Name: clone
|
||||
Version: 0.1.19
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: deep cloning of objects and arrays
|
||||
Repository: git://github.com/pvorb/node-clone.git
|
||||
Author: Paul Vorbach <paul@vorba.ch> (http://paul.vorba.ch/)
|
||||
Contributors:
|
||||
Blake Miner <miner.blake@gmail.com> (http://www.blakeminer.com/)
|
||||
Tian You <axqd001@gmail.com> (http://blog.axqd.net/)
|
||||
George Stagas <gstagas@gmail.com> (http://stagas.com/)
|
||||
Tobiasz Cudnik <tobiasz.cudnik@gmail.com> (https://github.com/TobiaszCudnik)
|
||||
Pavel Lang <langpavel@phpskelet.org> (https://github.com/langpavel)
|
||||
Dan MacTough (http://yabfog.com/)
|
||||
w1nk (https://github.com/w1nk)
|
||||
Hugh Kennedy (http://twitter.com/hughskennedy)
|
||||
Dustin Diaz (http://dustindiaz.com)
|
||||
Ilya Shaisultanov (https://github.com/diversario)
|
||||
Nathan MacInnes <nathan@macinn.es> (http://macinn.es/)
|
||||
Benjamin E. Coe <ben@npmjs.com> (https://twitter.com/benjamincoe)
|
||||
Nathan Zadoks (https://github.com/nathan7)
|
||||
Róbert Oroszi <robert+gh@oroszi.net> (https://github.com/oroce)
|
||||
|
||||
---
|
||||
|
||||
Name: is
|
||||
Version: 0.2.7
|
||||
License: undefined
|
||||
Private: false
|
||||
Description: the definitive JavaScript type testing library
|
||||
Repository: git://github.com/enricomarino/is.git
|
||||
Homepage: https://github.com/enricomarino/is
|
||||
Author: Enrico Marino (http://onirame.com)
|
||||
Contributors:
|
||||
Jordan Harband (https://github.com/ljharb)
|
||||
|
||||
---
|
||||
|
||||
Name: foreach
|
||||
Version: 2.0.5
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: foreach component + npm package
|
||||
Repository: git://github.com/manuelstofer/foreach
|
||||
Author: Manuel Stofer <manuel@takimata.ch>
|
||||
Contributors:
|
||||
Manuel Stofer
|
||||
Jordan Harband (https://github.com/ljharb)
|
10
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/LICENSE-buffer-es6.txt
generated
vendored
Normal file
10
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/LICENSE-buffer-es6.txt
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
Name: buffer-es6
|
||||
Version: 4.9.3
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Node.js Buffer API, for the browser
|
||||
Repository: git://github.com/calvinmetcalf/buffer-es6.git
|
||||
Author: Feross Aboukhadijeh <feross@feross.org> (http://feross.org)
|
||||
Contributors:
|
||||
Romain Beauxis <toots@rastageeks.org>
|
||||
James Halliday <mail@substack.net>
|
355
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/LICENSE-crypto-browserify.txt
generated
vendored
Normal file
355
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/LICENSE-crypto-browserify.txt
generated
vendored
Normal file
|
@ -0,0 +1,355 @@
|
|||
Name: crypto-browserify
|
||||
Version: 3.12.0
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: implementation of crypto for the browser
|
||||
Repository: git://github.com/crypto-browserify/crypto-browserify.git
|
||||
Homepage: https://github.com/crypto-browserify/crypto-browserify
|
||||
Author: Dominic Tarr <dominic.tarr@gmail.com> (dominictarr.com)
|
||||
|
||||
---
|
||||
|
||||
Name: browserify-sign
|
||||
Version: 4.0.4
|
||||
License: ISC
|
||||
Private: false
|
||||
Description: adds node crypto signing for browsers
|
||||
Repository: https://github.com/crypto-browserify/browserify-sign.git
|
||||
|
||||
---
|
||||
|
||||
Name: randombytes
|
||||
Version: 2.1.0
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: random bytes from browserify stand alone
|
||||
Repository: git@github.com:crypto-browserify/randombytes.git
|
||||
Homepage: https://github.com/crypto-browserify/randombytes
|
||||
|
||||
---
|
||||
|
||||
Name: create-hash
|
||||
Version: 1.2.0
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: create hashes for browserify
|
||||
Repository: git@github.com:crypto-browserify/createHash.git
|
||||
Homepage: https://github.com/crypto-browserify/createHash
|
||||
|
||||
---
|
||||
|
||||
Name: browserify-cipher
|
||||
Version: 1.0.1
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: ciphers for the browser
|
||||
Repository: git@github.com:crypto-browserify/browserify-cipher.git
|
||||
Author: Calvin Metcalf <calvin.metcalf@gmail.com>
|
||||
|
||||
---
|
||||
|
||||
Name: pbkdf2
|
||||
Version: 3.0.17
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: This library provides the functionality of PBKDF2 with the ability to use any supported hashing algorithm returned from crypto.getHashes()
|
||||
Repository: https://github.com/crypto-browserify/pbkdf2.git
|
||||
Homepage: https://github.com/crypto-browserify/pbkdf2
|
||||
Author: Daniel Cousens
|
||||
|
||||
---
|
||||
|
||||
Name: diffie-hellman
|
||||
Version: 5.0.3
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: pure js diffie-hellman
|
||||
Repository: https://github.com/crypto-browserify/diffie-hellman.git
|
||||
Homepage: https://github.com/crypto-browserify/diffie-hellman
|
||||
Author: Calvin Metcalf
|
||||
|
||||
---
|
||||
|
||||
Name: create-hmac
|
||||
Version: 1.1.7
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: node style hmacs in the browser
|
||||
Repository: https://github.com/crypto-browserify/createHmac.git
|
||||
Homepage: https://github.com/crypto-browserify/createHmac
|
||||
|
||||
---
|
||||
|
||||
Name: create-ecdh
|
||||
Version: 4.0.3
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: createECDH but browserifiable
|
||||
Repository: https://github.com/crypto-browserify/createECDH.git
|
||||
Homepage: https://github.com/crypto-browserify/createECDH
|
||||
Author: Calvin Metcalf
|
||||
|
||||
---
|
||||
|
||||
Name: public-encrypt
|
||||
Version: 4.0.3
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: browserify version of publicEncrypt & privateDecrypt
|
||||
Repository: https://github.com/crypto-browserify/publicEncrypt.git
|
||||
Homepage: https://github.com/crypto-browserify/publicEncrypt
|
||||
Author: Calvin Metcalf
|
||||
|
||||
---
|
||||
|
||||
Name: randomfill
|
||||
Version: 1.0.4
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: random fill from browserify stand alone
|
||||
Repository: https://github.com/crypto-browserify/randomfill.git
|
||||
Homepage: https://github.com/crypto-browserify/randomfill
|
||||
|
||||
---
|
||||
|
||||
Name: browserify-des
|
||||
Version: 1.0.2
|
||||
License: MIT
|
||||
Private: false
|
||||
Repository: git+https://github.com/crypto-browserify/browserify-des.git
|
||||
Homepage: https://github.com/crypto-browserify/browserify-des#readme
|
||||
Author: Calvin Metcalf <calvin.metcalf@gmail.com>
|
||||
|
||||
---
|
||||
|
||||
Name: browserify-aes
|
||||
Version: 1.2.0
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: aes, for browserify
|
||||
Repository: git://github.com/crypto-browserify/browserify-aes.git
|
||||
Homepage: https://github.com/crypto-browserify/browserify-aes
|
||||
|
||||
---
|
||||
|
||||
Name: safe-buffer
|
||||
Version: 5.1.2
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Safer Node.js Buffer API
|
||||
Repository: git://github.com/feross/safe-buffer.git
|
||||
Homepage: https://github.com/feross/safe-buffer
|
||||
Author: Feross Aboukhadijeh <feross@feross.org> (http://feross.org)
|
||||
|
||||
---
|
||||
|
||||
Name: md5.js
|
||||
Version: 1.3.5
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: node style md5 on pure JavaScript
|
||||
Repository: https://github.com/crypto-browserify/md5.js.git
|
||||
Homepage: https://github.com/crypto-browserify/md5.js
|
||||
Author: Kirill Fomichev <fanatid@ya.ru> (https://github.com/fanatid)
|
||||
|
||||
---
|
||||
|
||||
Name: inherits
|
||||
Version: 2.0.3
|
||||
License: ISC
|
||||
Private: false
|
||||
Description: Browser-friendly inheritance fully compatible with standard node.js inherits()
|
||||
Repository: undefined
|
||||
|
||||
---
|
||||
|
||||
Name: cipher-base
|
||||
Version: 1.0.4
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: abstract base class for crypto-streams
|
||||
Repository: git+https://github.com/crypto-browserify/cipher-base.git
|
||||
Homepage: https://github.com/crypto-browserify/cipher-base#readme
|
||||
Author: Calvin Metcalf <calvin.metcalf@gmail.com>
|
||||
|
||||
---
|
||||
|
||||
Name: evp_bytestokey
|
||||
Version: 1.0.3
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: The insecure key derivation algorithm from OpenSSL
|
||||
Repository: https://github.com/crypto-browserify/EVP_BytesToKey.git
|
||||
Homepage: https://github.com/crypto-browserify/EVP_BytesToKey
|
||||
Author: Calvin Metcalf <calvin.metcalf@gmail.com>
|
||||
Contributors:
|
||||
Kirill Fomichev <fanatid@ya.ru>
|
||||
|
||||
---
|
||||
|
||||
Name: elliptic
|
||||
Version: 6.4.1
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: EC cryptography
|
||||
Repository: git@github.com:indutny/elliptic
|
||||
Homepage: https://github.com/indutny/elliptic
|
||||
Author: Fedor Indutny <fedor@indutny.com>
|
||||
|
||||
---
|
||||
|
||||
Name: bn.js
|
||||
Version: 4.11.8
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Big number implementation in pure javascript
|
||||
Repository: git@github.com:indutny/bn.js
|
||||
Homepage: https://github.com/indutny/bn.js
|
||||
Author: Fedor Indutny <fedor@indutny.com>
|
||||
|
||||
---
|
||||
|
||||
Name: browserify-rsa
|
||||
Version: 4.0.1
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: RSA for browserify
|
||||
Repository: git@github.com:crypto-browserify/browserify-rsa.git
|
||||
|
||||
---
|
||||
|
||||
Name: parse-asn1
|
||||
Version: 5.1.4
|
||||
License: ISC
|
||||
Private: false
|
||||
Description: utility library for parsing asn1 files for use with browserify-sign.
|
||||
Repository: git://github.com/crypto-browserify/parse-asn1.git
|
||||
|
||||
---
|
||||
|
||||
Name: ripemd160
|
||||
Version: 2.0.2
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Compute ripemd160 of bytes or strings.
|
||||
Repository: https://github.com/crypto-browserify/ripemd160
|
||||
|
||||
---
|
||||
|
||||
Name: sha.js
|
||||
Version: 2.4.11
|
||||
License: (MIT AND BSD-3-Clause)
|
||||
Private: false
|
||||
Description: Streamable SHA hashes in pure javascript
|
||||
Repository: git://github.com/crypto-browserify/sha.js.git
|
||||
Homepage: https://github.com/crypto-browserify/sha.js
|
||||
Author: Dominic Tarr <dominic.tarr@gmail.com> (dominictarr.com)
|
||||
|
||||
---
|
||||
|
||||
Name: miller-rabin
|
||||
Version: 4.0.1
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Miller Rabin algorithm for primality test
|
||||
Repository: git@github.com:indutny/miller-rabin
|
||||
Homepage: https://github.com/indutny/miller-rabin
|
||||
Author: Fedor Indutny <fedor@indutny.com>
|
||||
|
||||
---
|
||||
|
||||
Name: des.js
|
||||
Version: 1.0.0
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: DES implementation
|
||||
Repository: git+ssh://git@github.com/indutny/des.js.git
|
||||
Homepage: https://github.com/indutny/des.js#readme
|
||||
Author: Fedor Indutny <fedor@indutny.com>
|
||||
|
||||
---
|
||||
|
||||
Name: hash-base
|
||||
Version: 3.0.4
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: abstract base class for hash-streams
|
||||
Repository: https://github.com/crypto-browserify/hash-base.git
|
||||
Homepage: https://github.com/crypto-browserify/hash-base
|
||||
Author: Kirill Fomichev <fanatid@ya.ru> (https://github.com/fanatid)
|
||||
|
||||
---
|
||||
|
||||
Name: brorand
|
||||
Version: 1.1.0
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Random number generator for browsers and node.js
|
||||
Repository: git@github.com:indutny/brorand
|
||||
Homepage: https://github.com/indutny/brorand
|
||||
Author: Fedor Indutny <fedor@indutny.com>
|
||||
|
||||
---
|
||||
|
||||
Name: buffer-xor
|
||||
Version: 1.0.3
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: A simple module for bitwise-xor on buffers
|
||||
Repository: https://github.com/crypto-browserify/buffer-xor.git
|
||||
Homepage: https://github.com/crypto-browserify/buffer-xor
|
||||
Author: Daniel Cousens
|
||||
|
||||
---
|
||||
|
||||
Name: asn1.js
|
||||
Version: 4.10.1
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: ASN.1 encoder and decoder
|
||||
Repository: git@github.com:indutny/asn1.js
|
||||
Homepage: https://github.com/indutny/asn1.js
|
||||
Author: Fedor Indutny
|
||||
|
||||
---
|
||||
|
||||
Name: minimalistic-assert
|
||||
Version: 1.0.1
|
||||
License: ISC
|
||||
Private: false
|
||||
Description: minimalistic-assert ===
|
||||
Repository: https://github.com/calvinmetcalf/minimalistic-assert.git
|
||||
Homepage: https://github.com/calvinmetcalf/minimalistic-assert
|
||||
|
||||
---
|
||||
|
||||
Name: hash.js
|
||||
Version: 1.1.7
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Various hash functions that could be run by both browser and node
|
||||
Repository: git@github.com:indutny/hash.js
|
||||
Homepage: https://github.com/indutny/hash.js
|
||||
Author: Fedor Indutny <fedor@indutny.com>
|
||||
|
||||
---
|
||||
|
||||
Name: minimalistic-crypto-utils
|
||||
Version: 1.0.1
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Minimalistic tools for JS crypto modules
|
||||
Repository: git+ssh://git@github.com/indutny/minimalistic-crypto-utils.git
|
||||
Homepage: https://github.com/indutny/minimalistic-crypto-utils#readme
|
||||
Author: Fedor Indutny <fedor@indutny.com>
|
||||
|
||||
---
|
||||
|
||||
Name: hmac-drbg
|
||||
Version: 1.0.1
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: Deterministic random bit generator (hmac)
|
||||
Repository: git+ssh://git@github.com/indutny/hmac-drbg.git
|
||||
Homepage: https://github.com/indutny/hmac-drbg#readme
|
||||
Author: Fedor Indutny <fedor@indutny.com>
|
7
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/LICENSE-process-es6.txt
generated
vendored
Normal file
7
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/LICENSE-process-es6.txt
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
Name: process-es6
|
||||
Version: 0.11.6
|
||||
License: MIT
|
||||
Private: false
|
||||
Description: process information for node.js and browsers, but in es6
|
||||
Repository: git://github.com/calvinmetcalf/node-process-es6.git
|
||||
Author: Roman Shtylman <shtylman@gmail.com>
|
488
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/assert.js
generated
vendored
Normal file
488
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/assert.js
generated
vendored
Normal file
|
@ -0,0 +1,488 @@
|
|||
|
||||
function compare(a, b) {
|
||||
if (a === b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var x = a.length;
|
||||
var y = b.length;
|
||||
|
||||
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
||||
if (a[i] !== b[i]) {
|
||||
x = a[i];
|
||||
y = b[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (x < y) {
|
||||
return -1;
|
||||
}
|
||||
if (y < x) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
var hasOwn = Object.prototype.hasOwnProperty;
|
||||
|
||||
var objectKeys = Object.keys || function (obj) {
|
||||
var keys = [];
|
||||
for (var key in obj) {
|
||||
if (hasOwn.call(obj, key)) keys.push(key);
|
||||
}
|
||||
return keys;
|
||||
};
|
||||
// based on node assert, original notice:
|
||||
|
||||
// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
|
||||
//
|
||||
// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
|
||||
//
|
||||
// Originally from narwhal.js (http://narwhaljs.org)
|
||||
// Copyright (c) 2009 Thomas Robinson <280north.com>
|
||||
//
|
||||
// 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 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.
|
||||
import {isBuffer} from 'buffer';
|
||||
import {isPrimitive, inherits, isError, isFunction, isRegExp, isDate, inspect as utilInspect} from 'util';
|
||||
var pSlice = Array.prototype.slice;
|
||||
var _functionsHaveNames;
|
||||
function functionsHaveNames() {
|
||||
if (typeof _functionsHaveNames !== 'undefined') {
|
||||
return _functionsHaveNames;
|
||||
}
|
||||
return _functionsHaveNames = (function () {
|
||||
return function foo() {}.name === 'foo';
|
||||
}());
|
||||
}
|
||||
function pToString (obj) {
|
||||
return Object.prototype.toString.call(obj);
|
||||
}
|
||||
function isView(arrbuf) {
|
||||
if (isBuffer(arrbuf)) {
|
||||
return false;
|
||||
}
|
||||
if (typeof global.ArrayBuffer !== 'function') {
|
||||
return false;
|
||||
}
|
||||
if (typeof ArrayBuffer.isView === 'function') {
|
||||
return ArrayBuffer.isView(arrbuf);
|
||||
}
|
||||
if (!arrbuf) {
|
||||
return false;
|
||||
}
|
||||
if (arrbuf instanceof DataView) {
|
||||
return true;
|
||||
}
|
||||
if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// 1. The assert module provides functions that throw
|
||||
// AssertionError's when particular conditions are not met. The
|
||||
// assert module must conform to the following interface.
|
||||
|
||||
function assert(value, message) {
|
||||
if (!value) fail(value, true, message, '==', ok);
|
||||
}
|
||||
export default assert;
|
||||
|
||||
// 2. The AssertionError is defined in assert.
|
||||
// new assert.AssertionError({ message: message,
|
||||
// actual: actual,
|
||||
// expected: expected })
|
||||
|
||||
var regex = /\s*function\s+([^\(\s]*)\s*/;
|
||||
// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
|
||||
function getName(func) {
|
||||
if (!isFunction(func)) {
|
||||
return;
|
||||
}
|
||||
if (functionsHaveNames()) {
|
||||
return func.name;
|
||||
}
|
||||
var str = func.toString();
|
||||
var match = str.match(regex);
|
||||
return match && match[1];
|
||||
}
|
||||
assert.AssertionError = AssertionError;
|
||||
export function AssertionError(options) {
|
||||
this.name = 'AssertionError';
|
||||
this.actual = options.actual;
|
||||
this.expected = options.expected;
|
||||
this.operator = options.operator;
|
||||
if (options.message) {
|
||||
this.message = options.message;
|
||||
this.generatedMessage = false;
|
||||
} else {
|
||||
this.message = getMessage(this);
|
||||
this.generatedMessage = true;
|
||||
}
|
||||
var stackStartFunction = options.stackStartFunction || fail;
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, stackStartFunction);
|
||||
} else {
|
||||
// non v8 browsers so we can have a stacktrace
|
||||
var err = new Error();
|
||||
if (err.stack) {
|
||||
var out = err.stack;
|
||||
|
||||
// try to strip useless frames
|
||||
var fn_name = getName(stackStartFunction);
|
||||
var idx = out.indexOf('\n' + fn_name);
|
||||
if (idx >= 0) {
|
||||
// once we have located the function frame
|
||||
// we need to strip out everything before it (and its line)
|
||||
var next_line = out.indexOf('\n', idx + 1);
|
||||
out = out.substring(next_line + 1);
|
||||
}
|
||||
|
||||
this.stack = out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// assert.AssertionError instanceof Error
|
||||
inherits(AssertionError, Error);
|
||||
|
||||
function truncate(s, n) {
|
||||
if (typeof s === 'string') {
|
||||
return s.length < n ? s : s.slice(0, n);
|
||||
} else {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
function inspect(something) {
|
||||
if (functionsHaveNames() || !isFunction(something)) {
|
||||
return utilInspect(something);
|
||||
}
|
||||
var rawname = getName(something);
|
||||
var name = rawname ? ': ' + rawname : '';
|
||||
return '[Function' + name + ']';
|
||||
}
|
||||
function getMessage(self) {
|
||||
return truncate(inspect(self.actual), 128) + ' ' +
|
||||
self.operator + ' ' +
|
||||
truncate(inspect(self.expected), 128);
|
||||
}
|
||||
|
||||
// At present only the three keys mentioned above are used and
|
||||
// understood by the spec. Implementations or sub modules can pass
|
||||
// other keys to the AssertionError's constructor - they will be
|
||||
// ignored.
|
||||
|
||||
// 3. All of the following functions must throw an AssertionError
|
||||
// when a corresponding condition is not met, with a message that
|
||||
// may be undefined if not provided. All assertion methods provide
|
||||
// both the actual and expected values to the assertion error for
|
||||
// display purposes.
|
||||
|
||||
export function fail(actual, expected, message, operator, stackStartFunction) {
|
||||
throw new AssertionError({
|
||||
message: message,
|
||||
actual: actual,
|
||||
expected: expected,
|
||||
operator: operator,
|
||||
stackStartFunction: stackStartFunction
|
||||
});
|
||||
}
|
||||
|
||||
// EXTENSION! allows for well behaved errors defined elsewhere.
|
||||
assert.fail = fail;
|
||||
|
||||
// 4. Pure assertion tests whether a value is truthy, as determined
|
||||
// by !!guard.
|
||||
// assert.ok(guard, message_opt);
|
||||
// This statement is equivalent to assert.equal(true, !!guard,
|
||||
// message_opt);. To test strictly for the value true, use
|
||||
// assert.strictEqual(true, guard, message_opt);.
|
||||
|
||||
export function ok(value, message) {
|
||||
if (!value) fail(value, true, message, '==', ok);
|
||||
}
|
||||
assert.ok = ok;
|
||||
export {ok as assert};
|
||||
|
||||
// 5. The equality assertion tests shallow, coercive equality with
|
||||
// ==.
|
||||
// assert.equal(actual, expected, message_opt);
|
||||
assert.equal = equal;
|
||||
export function equal(actual, expected, message) {
|
||||
if (actual != expected) fail(actual, expected, message, '==', equal);
|
||||
}
|
||||
|
||||
// 6. The non-equality assertion tests for whether two objects are not equal
|
||||
// with != assert.notEqual(actual, expected, message_opt);
|
||||
assert.notEqual = notEqual;
|
||||
export function notEqual(actual, expected, message) {
|
||||
if (actual == expected) {
|
||||
fail(actual, expected, message, '!=', notEqual);
|
||||
}
|
||||
}
|
||||
|
||||
// 7. The equivalence assertion tests a deep equality relation.
|
||||
// assert.deepEqual(actual, expected, message_opt);
|
||||
assert.deepEqual = deepEqual;
|
||||
export function deepEqual(actual, expected, message) {
|
||||
if (!_deepEqual(actual, expected, false)) {
|
||||
fail(actual, expected, message, 'deepEqual', deepEqual);
|
||||
}
|
||||
}
|
||||
assert.deepStrictEqual = deepStrictEqual;
|
||||
export function deepStrictEqual(actual, expected, message) {
|
||||
if (!_deepEqual(actual, expected, true)) {
|
||||
fail(actual, expected, message, 'deepStrictEqual', deepStrictEqual);
|
||||
}
|
||||
}
|
||||
|
||||
function _deepEqual(actual, expected, strict, memos) {
|
||||
// 7.1. All identical values are equivalent, as determined by ===.
|
||||
if (actual === expected) {
|
||||
return true;
|
||||
} else if (isBuffer(actual) && isBuffer(expected)) {
|
||||
return compare(actual, expected) === 0;
|
||||
|
||||
// 7.2. If the expected value is a Date object, the actual value is
|
||||
// equivalent if it is also a Date object that refers to the same time.
|
||||
} else if (isDate(actual) && isDate(expected)) {
|
||||
return actual.getTime() === expected.getTime();
|
||||
|
||||
// 7.3 If the expected value is a RegExp object, the actual value is
|
||||
// equivalent if it is also a RegExp object with the same source and
|
||||
// properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
|
||||
} else if (isRegExp(actual) && isRegExp(expected)) {
|
||||
return actual.source === expected.source &&
|
||||
actual.global === expected.global &&
|
||||
actual.multiline === expected.multiline &&
|
||||
actual.lastIndex === expected.lastIndex &&
|
||||
actual.ignoreCase === expected.ignoreCase;
|
||||
|
||||
// 7.4. Other pairs that do not both pass typeof value == 'object',
|
||||
// equivalence is determined by ==.
|
||||
} else if ((actual === null || typeof actual !== 'object') &&
|
||||
(expected === null || typeof expected !== 'object')) {
|
||||
return strict ? actual === expected : actual == expected;
|
||||
|
||||
// If both values are instances of typed arrays, wrap their underlying
|
||||
// ArrayBuffers in a Buffer each to increase performance
|
||||
// This optimization requires the arrays to have the same type as checked by
|
||||
// Object.prototype.toString (aka pToString). Never perform binary
|
||||
// comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
|
||||
// bit patterns are not identical.
|
||||
} else if (isView(actual) && isView(expected) &&
|
||||
pToString(actual) === pToString(expected) &&
|
||||
!(actual instanceof Float32Array ||
|
||||
actual instanceof Float64Array)) {
|
||||
return compare(new Uint8Array(actual.buffer),
|
||||
new Uint8Array(expected.buffer)) === 0;
|
||||
|
||||
// 7.5 For all other Object pairs, including Array objects, equivalence is
|
||||
// determined by having the same number of owned properties (as verified
|
||||
// with Object.prototype.hasOwnProperty.call), the same set of keys
|
||||
// (although not necessarily the same order), equivalent values for every
|
||||
// corresponding key, and an identical 'prototype' property. Note: this
|
||||
// accounts for both named and indexed properties on Arrays.
|
||||
} else if (isBuffer(actual) !== isBuffer(expected)) {
|
||||
return false;
|
||||
} else {
|
||||
memos = memos || {actual: [], expected: []};
|
||||
|
||||
var actualIndex = memos.actual.indexOf(actual);
|
||||
if (actualIndex !== -1) {
|
||||
if (actualIndex === memos.expected.indexOf(expected)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
memos.actual.push(actual);
|
||||
memos.expected.push(expected);
|
||||
|
||||
return objEquiv(actual, expected, strict, memos);
|
||||
}
|
||||
}
|
||||
|
||||
function isArguments(object) {
|
||||
return Object.prototype.toString.call(object) == '[object Arguments]';
|
||||
}
|
||||
|
||||
function objEquiv(a, b, strict, actualVisitedObjects) {
|
||||
if (a === null || a === undefined || b === null || b === undefined)
|
||||
return false;
|
||||
// if one is a primitive, the other must be same
|
||||
if (isPrimitive(a) || isPrimitive(b))
|
||||
return a === b;
|
||||
if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
|
||||
return false;
|
||||
var aIsArgs = isArguments(a);
|
||||
var bIsArgs = isArguments(b);
|
||||
if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
|
||||
return false;
|
||||
if (aIsArgs) {
|
||||
a = pSlice.call(a);
|
||||
b = pSlice.call(b);
|
||||
return _deepEqual(a, b, strict);
|
||||
}
|
||||
var ka = objectKeys(a);
|
||||
var kb = objectKeys(b);
|
||||
var key, i;
|
||||
// having the same number of owned properties (keys incorporates
|
||||
// hasOwnProperty)
|
||||
if (ka.length !== kb.length)
|
||||
return false;
|
||||
//the same set of keys (although not necessarily the same order),
|
||||
ka.sort();
|
||||
kb.sort();
|
||||
//~~~cheap key test
|
||||
for (i = ka.length - 1; i >= 0; i--) {
|
||||
if (ka[i] !== kb[i])
|
||||
return false;
|
||||
}
|
||||
//equivalent values for every corresponding key, and
|
||||
//~~~possibly expensive deep test
|
||||
for (i = ka.length - 1; i >= 0; i--) {
|
||||
key = ka[i];
|
||||
if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 8. The non-equivalence assertion tests for any deep inequality.
|
||||
// assert.notDeepEqual(actual, expected, message_opt);
|
||||
assert.notDeepEqual = notDeepEqual;
|
||||
export function notDeepEqual(actual, expected, message) {
|
||||
if (_deepEqual(actual, expected, false)) {
|
||||
fail(actual, expected, message, 'notDeepEqual', notDeepEqual);
|
||||
}
|
||||
}
|
||||
|
||||
assert.notDeepStrictEqual = notDeepStrictEqual;
|
||||
export function notDeepStrictEqual(actual, expected, message) {
|
||||
if (_deepEqual(actual, expected, true)) {
|
||||
fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 9. The strict equality assertion tests strict equality, as determined by ===.
|
||||
// assert.strictEqual(actual, expected, message_opt);
|
||||
assert.strictEqual = strictEqual;
|
||||
export function strictEqual(actual, expected, message) {
|
||||
if (actual !== expected) {
|
||||
fail(actual, expected, message, '===', strictEqual);
|
||||
}
|
||||
}
|
||||
|
||||
// 10. The strict non-equality assertion tests for strict inequality, as
|
||||
// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
|
||||
assert.notStrictEqual = notStrictEqual;
|
||||
export function notStrictEqual(actual, expected, message) {
|
||||
if (actual === expected) {
|
||||
fail(actual, expected, message, '!==', notStrictEqual);
|
||||
}
|
||||
}
|
||||
|
||||
function expectedException(actual, expected) {
|
||||
if (!actual || !expected) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(expected) == '[object RegExp]') {
|
||||
return expected.test(actual);
|
||||
}
|
||||
|
||||
try {
|
||||
if (actual instanceof expected) {
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore. The instanceof check doesn't work for arrow functions.
|
||||
}
|
||||
|
||||
if (Error.isPrototypeOf(expected)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return expected.call({}, actual) === true;
|
||||
}
|
||||
|
||||
function _tryBlock(block) {
|
||||
var error;
|
||||
try {
|
||||
block();
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
function _throws(shouldThrow, block, expected, message) {
|
||||
var actual;
|
||||
|
||||
if (typeof block !== 'function') {
|
||||
throw new TypeError('"block" argument must be a function');
|
||||
}
|
||||
|
||||
if (typeof expected === 'string') {
|
||||
message = expected;
|
||||
expected = null;
|
||||
}
|
||||
|
||||
actual = _tryBlock(block);
|
||||
|
||||
message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
|
||||
(message ? ' ' + message : '.');
|
||||
|
||||
if (shouldThrow && !actual) {
|
||||
fail(actual, expected, 'Missing expected exception' + message);
|
||||
}
|
||||
|
||||
var userProvidedMessage = typeof message === 'string';
|
||||
var isUnwantedException = !shouldThrow && isError(actual);
|
||||
var isUnexpectedException = !shouldThrow && actual && !expected;
|
||||
|
||||
if ((isUnwantedException &&
|
||||
userProvidedMessage &&
|
||||
expectedException(actual, expected)) ||
|
||||
isUnexpectedException) {
|
||||
fail(actual, expected, 'Got unwanted exception' + message);
|
||||
}
|
||||
|
||||
if ((shouldThrow && actual && expected &&
|
||||
!expectedException(actual, expected)) || (!shouldThrow && actual)) {
|
||||
throw actual;
|
||||
}
|
||||
}
|
||||
|
||||
// 11. Expected to throw an error:
|
||||
// assert.throws(block, Error_opt, message_opt);
|
||||
assert.throws = throws;
|
||||
export function throws(block, /*optional*/error, /*optional*/message) {
|
||||
_throws(true, block, error, message);
|
||||
}
|
||||
|
||||
// EXTENSION! This is annoying to write outside this module.
|
||||
assert.doesNotThrow = doesNotThrow;
|
||||
export function doesNotThrow(block, /*optional*/error, /*optional*/message) {
|
||||
_throws(false, block, error, message);
|
||||
}
|
||||
|
||||
assert.ifError = ifError;
|
||||
export function ifError(err) {
|
||||
if (err) throw err;
|
||||
}
|
19038
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/browserify-fs.js
generated
vendored
Normal file
19038
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/browserify-fs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1981
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/buffer-es6.js
generated
vendored
Normal file
1981
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/buffer-es6.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
13
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/console.js
generated
vendored
Normal file
13
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/console.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
function noop(){}
|
||||
|
||||
export default global.console ? global.console : {
|
||||
log: noop,
|
||||
info: noop,
|
||||
warn: noop,
|
||||
error: noop,
|
||||
dir: noop,
|
||||
assert: noop,
|
||||
time: noop,
|
||||
timeEnd: noop,
|
||||
trace: noop
|
||||
};
|
488
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/constants.js
generated
vendored
Normal file
488
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/constants.js
generated
vendored
Normal file
|
@ -0,0 +1,488 @@
|
|||
export var RTLD_LAZY = 1;
|
||||
export var RTLD_NOW = 2;
|
||||
export var RTLD_GLOBAL = 8;
|
||||
export var RTLD_LOCAL = 4;
|
||||
export var E2BIG = 7;
|
||||
export var EACCES = 13;
|
||||
export var EADDRINUSE = 48;
|
||||
export var EADDRNOTAVAIL = 49;
|
||||
export var EAFNOSUPPORT = 47;
|
||||
export var EAGAIN = 35;
|
||||
export var EALREADY = 37;
|
||||
export var EBADF = 9;
|
||||
export var EBADMSG = 94;
|
||||
export var EBUSY = 16;
|
||||
export var ECANCELED = 89;
|
||||
export var ECHILD = 10;
|
||||
export var ECONNABORTED = 53;
|
||||
export var ECONNREFUSED = 61;
|
||||
export var ECONNRESET = 54;
|
||||
export var EDEADLK = 11;
|
||||
export var EDESTADDRREQ = 39;
|
||||
export var EDOM = 33;
|
||||
export var EDQUOT = 69;
|
||||
export var EEXIST = 17;
|
||||
export var EFAULT = 14;
|
||||
export var EFBIG = 27;
|
||||
export var EHOSTUNREACH = 65;
|
||||
export var EIDRM = 90;
|
||||
export var EILSEQ = 92;
|
||||
export var EINPROGRESS = 36;
|
||||
export var EINTR = 4;
|
||||
export var EINVAL = 22;
|
||||
export var EIO = 5;
|
||||
export var EISCONN = 56;
|
||||
export var EISDIR = 21;
|
||||
export var ELOOP = 62;
|
||||
export var EMFILE = 24;
|
||||
export var EMLINK = 31;
|
||||
export var EMSGSIZE = 40;
|
||||
export var EMULTIHOP = 95;
|
||||
export var ENAMETOOLONG = 63;
|
||||
export var ENETDOWN = 50;
|
||||
export var ENETRESET = 52;
|
||||
export var ENETUNREACH = 51;
|
||||
export var ENFILE = 23;
|
||||
export var ENOBUFS = 55;
|
||||
export var ENODATA = 96;
|
||||
export var ENODEV = 19;
|
||||
export var ENOENT = 2;
|
||||
export var ENOEXEC = 8;
|
||||
export var ENOLCK = 77;
|
||||
export var ENOLINK = 97;
|
||||
export var ENOMEM = 12;
|
||||
export var ENOMSG = 91;
|
||||
export var ENOPROTOOPT = 42;
|
||||
export var ENOSPC = 28;
|
||||
export var ENOSR = 98;
|
||||
export var ENOSTR = 99;
|
||||
export var ENOSYS = 78;
|
||||
export var ENOTCONN = 57;
|
||||
export var ENOTDIR = 20;
|
||||
export var ENOTEMPTY = 66;
|
||||
export var ENOTSOCK = 38;
|
||||
export var ENOTSUP = 45;
|
||||
export var ENOTTY = 25;
|
||||
export var ENXIO = 6;
|
||||
export var EOPNOTSUPP = 102;
|
||||
export var EOVERFLOW = 84;
|
||||
export var EPERM = 1;
|
||||
export var EPIPE = 32;
|
||||
export var EPROTO = 100;
|
||||
export var EPROTONOSUPPORT = 43;
|
||||
export var EPROTOTYPE = 41;
|
||||
export var ERANGE = 34;
|
||||
export var EROFS = 30;
|
||||
export var ESPIPE = 29;
|
||||
export var ESRCH = 3;
|
||||
export var ESTALE = 70;
|
||||
export var ETIME = 101;
|
||||
export var ETIMEDOUT = 60;
|
||||
export var ETXTBSY = 26;
|
||||
export var EWOULDBLOCK = 35;
|
||||
export var EXDEV = 18;
|
||||
export var PRIORITY_LOW = 19;
|
||||
export var PRIORITY_BELOW_NORMAL = 10;
|
||||
export var PRIORITY_NORMAL = 0;
|
||||
export var PRIORITY_ABOVE_NORMAL = -7;
|
||||
export var PRIORITY_HIGH = -14;
|
||||
export var PRIORITY_HIGHEST = -20;
|
||||
export var SIGHUP = 1;
|
||||
export var SIGINT = 2;
|
||||
export var SIGQUIT = 3;
|
||||
export var SIGILL = 4;
|
||||
export var SIGTRAP = 5;
|
||||
export var SIGABRT = 6;
|
||||
export var SIGIOT = 6;
|
||||
export var SIGBUS = 10;
|
||||
export var SIGFPE = 8;
|
||||
export var SIGKILL = 9;
|
||||
export var SIGUSR1 = 30;
|
||||
export var SIGSEGV = 11;
|
||||
export var SIGUSR2 = 31;
|
||||
export var SIGPIPE = 13;
|
||||
export var SIGALRM = 14;
|
||||
export var SIGTERM = 15;
|
||||
export var SIGCHLD = 20;
|
||||
export var SIGCONT = 19;
|
||||
export var SIGSTOP = 17;
|
||||
export var SIGTSTP = 18;
|
||||
export var SIGTTIN = 21;
|
||||
export var SIGTTOU = 22;
|
||||
export var SIGURG = 16;
|
||||
export var SIGXCPU = 24;
|
||||
export var SIGXFSZ = 25;
|
||||
export var SIGVTALRM = 26;
|
||||
export var SIGPROF = 27;
|
||||
export var SIGWINCH = 28;
|
||||
export var SIGIO = 23;
|
||||
export var SIGINFO = 29;
|
||||
export var SIGSYS = 12;
|
||||
export var UV_FS_SYMLINK_DIR = 1;
|
||||
export var UV_FS_SYMLINK_JUNCTION = 2;
|
||||
export var O_RDONLY = 0;
|
||||
export var O_WRONLY = 1;
|
||||
export var O_RDWR = 2;
|
||||
export var UV_DIRENT_UNKNOWN = 0;
|
||||
export var UV_DIRENT_FILE = 1;
|
||||
export var UV_DIRENT_DIR = 2;
|
||||
export var UV_DIRENT_LINK = 3;
|
||||
export var UV_DIRENT_FIFO = 4;
|
||||
export var UV_DIRENT_SOCKET = 5;
|
||||
export var UV_DIRENT_CHAR = 6;
|
||||
export var UV_DIRENT_BLOCK = 7;
|
||||
export var S_IFMT = 61440;
|
||||
export var S_IFREG = 32768;
|
||||
export var S_IFDIR = 16384;
|
||||
export var S_IFCHR = 8192;
|
||||
export var S_IFBLK = 24576;
|
||||
export var S_IFIFO = 4096;
|
||||
export var S_IFLNK = 40960;
|
||||
export var S_IFSOCK = 49152;
|
||||
export var O_CREAT = 512;
|
||||
export var O_EXCL = 2048;
|
||||
export var O_NOCTTY = 131072;
|
||||
export var O_TRUNC = 1024;
|
||||
export var O_APPEND = 8;
|
||||
export var O_DIRECTORY = 1048576;
|
||||
export var O_NOFOLLOW = 256;
|
||||
export var O_SYNC = 128;
|
||||
export var O_DSYNC = 4194304;
|
||||
export var O_SYMLINK = 2097152;
|
||||
export var O_NONBLOCK = 4;
|
||||
export var S_IRWXU = 448;
|
||||
export var S_IRUSR = 256;
|
||||
export var S_IWUSR = 128;
|
||||
export var S_IXUSR = 64;
|
||||
export var S_IRWXG = 56;
|
||||
export var S_IRGRP = 32;
|
||||
export var S_IWGRP = 16;
|
||||
export var S_IXGRP = 8;
|
||||
export var S_IRWXO = 7;
|
||||
export var S_IROTH = 4;
|
||||
export var S_IWOTH = 2;
|
||||
export var S_IXOTH = 1;
|
||||
export var F_OK = 0;
|
||||
export var R_OK = 4;
|
||||
export var W_OK = 2;
|
||||
export var X_OK = 1;
|
||||
export var UV_FS_COPYFILE_EXCL = 1;
|
||||
export var COPYFILE_EXCL = 1;
|
||||
export var UV_FS_COPYFILE_FICLONE = 2;
|
||||
export var COPYFILE_FICLONE = 2;
|
||||
export var UV_FS_COPYFILE_FICLONE_FORCE = 4;
|
||||
export var COPYFILE_FICLONE_FORCE = 4;
|
||||
export var OPENSSL_VERSION_NUMBER = 269488175;
|
||||
export var SSL_OP_ALL = 2147485780;
|
||||
export var SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION = 262144;
|
||||
export var SSL_OP_CIPHER_SERVER_PREFERENCE = 4194304;
|
||||
export var SSL_OP_CISCO_ANYCONNECT = 32768;
|
||||
export var SSL_OP_COOKIE_EXCHANGE = 8192;
|
||||
export var SSL_OP_CRYPTOPRO_TLSEXT_BUG = 2147483648;
|
||||
export var SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS = 2048;
|
||||
export var SSL_OP_EPHEMERAL_RSA = 0;
|
||||
export var SSL_OP_LEGACY_SERVER_CONNECT = 4;
|
||||
export var SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER = 0;
|
||||
export var SSL_OP_MICROSOFT_SESS_ID_BUG = 0;
|
||||
export var SSL_OP_MSIE_SSLV2_RSA_PADDING = 0;
|
||||
export var SSL_OP_NETSCAPE_CA_DN_BUG = 0;
|
||||
export var SSL_OP_NETSCAPE_CHALLENGE_BUG = 0;
|
||||
export var SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG = 0;
|
||||
export var SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG = 0;
|
||||
export var SSL_OP_NO_COMPRESSION = 131072;
|
||||
export var SSL_OP_NO_QUERY_MTU = 4096;
|
||||
export var SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION = 65536;
|
||||
export var SSL_OP_NO_SSLv2 = 0;
|
||||
export var SSL_OP_NO_SSLv3 = 33554432;
|
||||
export var SSL_OP_NO_TICKET = 16384;
|
||||
export var SSL_OP_NO_TLSv1 = 67108864;
|
||||
export var SSL_OP_NO_TLSv1_1 = 268435456;
|
||||
export var SSL_OP_NO_TLSv1_2 = 134217728;
|
||||
export var SSL_OP_PKCS1_CHECK_1 = 0;
|
||||
export var SSL_OP_PKCS1_CHECK_2 = 0;
|
||||
export var SSL_OP_SINGLE_DH_USE = 0;
|
||||
export var SSL_OP_SINGLE_ECDH_USE = 0;
|
||||
export var SSL_OP_SSLEAY_080_CLIENT_DH_BUG = 0;
|
||||
export var SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG = 0;
|
||||
export var SSL_OP_TLS_BLOCK_PADDING_BUG = 0;
|
||||
export var SSL_OP_TLS_D5_BUG = 0;
|
||||
export var SSL_OP_TLS_ROLLBACK_BUG = 8388608;
|
||||
export var ENGINE_METHOD_RSA = 1;
|
||||
export var ENGINE_METHOD_DSA = 2;
|
||||
export var ENGINE_METHOD_DH = 4;
|
||||
export var ENGINE_METHOD_RAND = 8;
|
||||
export var ENGINE_METHOD_EC = 2048;
|
||||
export var ENGINE_METHOD_CIPHERS = 64;
|
||||
export var ENGINE_METHOD_DIGESTS = 128;
|
||||
export var ENGINE_METHOD_PKEY_METHS = 512;
|
||||
export var ENGINE_METHOD_PKEY_ASN1_METHS = 1024;
|
||||
export var ENGINE_METHOD_ALL = 65535;
|
||||
export var ENGINE_METHOD_NONE = 0;
|
||||
export var DH_CHECK_P_NOT_SAFE_PRIME = 2;
|
||||
export var DH_CHECK_P_NOT_PRIME = 1;
|
||||
export var DH_UNABLE_TO_CHECK_GENERATOR = 4;
|
||||
export var DH_NOT_SUITABLE_GENERATOR = 8;
|
||||
export var ALPN_ENABLED = 1;
|
||||
export var RSA_PKCS1_PADDING = 1;
|
||||
export var RSA_SSLV23_PADDING = 2;
|
||||
export var RSA_NO_PADDING = 3;
|
||||
export var RSA_PKCS1_OAEP_PADDING = 4;
|
||||
export var RSA_X931_PADDING = 5;
|
||||
export var RSA_PKCS1_PSS_PADDING = 6;
|
||||
export var RSA_PSS_SALTLEN_DIGEST = -1;
|
||||
export var RSA_PSS_SALTLEN_MAX_SIGN = -2;
|
||||
export var RSA_PSS_SALTLEN_AUTO = -2;
|
||||
export var defaultCoreCipherList = "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA";
|
||||
export var TLS1_VERSION = 769;
|
||||
export var TLS1_1_VERSION = 770;
|
||||
export var TLS1_2_VERSION = 771;
|
||||
export var TLS1_3_VERSION = 772;
|
||||
export var POINT_CONVERSION_COMPRESSED = 2;
|
||||
export var POINT_CONVERSION_UNCOMPRESSED = 4;
|
||||
export var POINT_CONVERSION_HYBRID = 6;
|
||||
export var defaultCipherList = "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA";
|
||||
export default {
|
||||
RTLD_LAZY: RTLD_LAZY,
|
||||
RTLD_NOW: RTLD_NOW,
|
||||
RTLD_GLOBAL: RTLD_GLOBAL,
|
||||
RTLD_LOCAL: RTLD_LOCAL,
|
||||
E2BIG: E2BIG,
|
||||
EACCES: EACCES,
|
||||
EADDRINUSE: EADDRINUSE,
|
||||
EADDRNOTAVAIL: EADDRNOTAVAIL,
|
||||
EAFNOSUPPORT: EAFNOSUPPORT,
|
||||
EAGAIN: EAGAIN,
|
||||
EALREADY: EALREADY,
|
||||
EBADF: EBADF,
|
||||
EBADMSG: EBADMSG,
|
||||
EBUSY: EBUSY,
|
||||
ECANCELED: ECANCELED,
|
||||
ECHILD: ECHILD,
|
||||
ECONNABORTED: ECONNABORTED,
|
||||
ECONNREFUSED: ECONNREFUSED,
|
||||
ECONNRESET: ECONNRESET,
|
||||
EDEADLK: EDEADLK,
|
||||
EDESTADDRREQ: EDESTADDRREQ,
|
||||
EDOM: EDOM,
|
||||
EDQUOT: EDQUOT,
|
||||
EEXIST: EEXIST,
|
||||
EFAULT: EFAULT,
|
||||
EFBIG: EFBIG,
|
||||
EHOSTUNREACH: EHOSTUNREACH,
|
||||
EIDRM: EIDRM,
|
||||
EILSEQ: EILSEQ,
|
||||
EINPROGRESS: EINPROGRESS,
|
||||
EINTR: EINTR,
|
||||
EINVAL: EINVAL,
|
||||
EIO: EIO,
|
||||
EISCONN: EISCONN,
|
||||
EISDIR: EISDIR,
|
||||
ELOOP: ELOOP,
|
||||
EMFILE: EMFILE,
|
||||
EMLINK: EMLINK,
|
||||
EMSGSIZE: EMSGSIZE,
|
||||
EMULTIHOP: EMULTIHOP,
|
||||
ENAMETOOLONG: ENAMETOOLONG,
|
||||
ENETDOWN: ENETDOWN,
|
||||
ENETRESET: ENETRESET,
|
||||
ENETUNREACH: ENETUNREACH,
|
||||
ENFILE: ENFILE,
|
||||
ENOBUFS: ENOBUFS,
|
||||
ENODATA: ENODATA,
|
||||
ENODEV: ENODEV,
|
||||
ENOENT: ENOENT,
|
||||
ENOEXEC: ENOEXEC,
|
||||
ENOLCK: ENOLCK,
|
||||
ENOLINK: ENOLINK,
|
||||
ENOMEM: ENOMEM,
|
||||
ENOMSG: ENOMSG,
|
||||
ENOPROTOOPT: ENOPROTOOPT,
|
||||
ENOSPC: ENOSPC,
|
||||
ENOSR: ENOSR,
|
||||
ENOSTR: ENOSTR,
|
||||
ENOSYS: ENOSYS,
|
||||
ENOTCONN: ENOTCONN,
|
||||
ENOTDIR: ENOTDIR,
|
||||
ENOTEMPTY: ENOTEMPTY,
|
||||
ENOTSOCK: ENOTSOCK,
|
||||
ENOTSUP: ENOTSUP,
|
||||
ENOTTY: ENOTTY,
|
||||
ENXIO: ENXIO,
|
||||
EOPNOTSUPP: EOPNOTSUPP,
|
||||
EOVERFLOW: EOVERFLOW,
|
||||
EPERM: EPERM,
|
||||
EPIPE: EPIPE,
|
||||
EPROTO: EPROTO,
|
||||
EPROTONOSUPPORT: EPROTONOSUPPORT,
|
||||
EPROTOTYPE: EPROTOTYPE,
|
||||
ERANGE: ERANGE,
|
||||
EROFS: EROFS,
|
||||
ESPIPE: ESPIPE,
|
||||
ESRCH: ESRCH,
|
||||
ESTALE: ESTALE,
|
||||
ETIME: ETIME,
|
||||
ETIMEDOUT: ETIMEDOUT,
|
||||
ETXTBSY: ETXTBSY,
|
||||
EWOULDBLOCK: EWOULDBLOCK,
|
||||
EXDEV: EXDEV,
|
||||
PRIORITY_LOW: PRIORITY_LOW,
|
||||
PRIORITY_BELOW_NORMAL: PRIORITY_BELOW_NORMAL,
|
||||
PRIORITY_NORMAL: PRIORITY_NORMAL,
|
||||
PRIORITY_ABOVE_NORMAL: PRIORITY_ABOVE_NORMAL,
|
||||
PRIORITY_HIGH: PRIORITY_HIGH,
|
||||
PRIORITY_HIGHEST: PRIORITY_HIGHEST,
|
||||
SIGHUP: SIGHUP,
|
||||
SIGINT: SIGINT,
|
||||
SIGQUIT: SIGQUIT,
|
||||
SIGILL: SIGILL,
|
||||
SIGTRAP: SIGTRAP,
|
||||
SIGABRT: SIGABRT,
|
||||
SIGIOT: SIGIOT,
|
||||
SIGBUS: SIGBUS,
|
||||
SIGFPE: SIGFPE,
|
||||
SIGKILL: SIGKILL,
|
||||
SIGUSR1: SIGUSR1,
|
||||
SIGSEGV: SIGSEGV,
|
||||
SIGUSR2: SIGUSR2,
|
||||
SIGPIPE: SIGPIPE,
|
||||
SIGALRM: SIGALRM,
|
||||
SIGTERM: SIGTERM,
|
||||
SIGCHLD: SIGCHLD,
|
||||
SIGCONT: SIGCONT,
|
||||
SIGSTOP: SIGSTOP,
|
||||
SIGTSTP: SIGTSTP,
|
||||
SIGTTIN: SIGTTIN,
|
||||
SIGTTOU: SIGTTOU,
|
||||
SIGURG: SIGURG,
|
||||
SIGXCPU: SIGXCPU,
|
||||
SIGXFSZ: SIGXFSZ,
|
||||
SIGVTALRM: SIGVTALRM,
|
||||
SIGPROF: SIGPROF,
|
||||
SIGWINCH: SIGWINCH,
|
||||
SIGIO: SIGIO,
|
||||
SIGINFO: SIGINFO,
|
||||
SIGSYS: SIGSYS,
|
||||
UV_FS_SYMLINK_DIR: UV_FS_SYMLINK_DIR,
|
||||
UV_FS_SYMLINK_JUNCTION: UV_FS_SYMLINK_JUNCTION,
|
||||
O_RDONLY: O_RDONLY,
|
||||
O_WRONLY: O_WRONLY,
|
||||
O_RDWR: O_RDWR,
|
||||
UV_DIRENT_UNKNOWN: UV_DIRENT_UNKNOWN,
|
||||
UV_DIRENT_FILE: UV_DIRENT_FILE,
|
||||
UV_DIRENT_DIR: UV_DIRENT_DIR,
|
||||
UV_DIRENT_LINK: UV_DIRENT_LINK,
|
||||
UV_DIRENT_FIFO: UV_DIRENT_FIFO,
|
||||
UV_DIRENT_SOCKET: UV_DIRENT_SOCKET,
|
||||
UV_DIRENT_CHAR: UV_DIRENT_CHAR,
|
||||
UV_DIRENT_BLOCK: UV_DIRENT_BLOCK,
|
||||
S_IFMT: S_IFMT,
|
||||
S_IFREG: S_IFREG,
|
||||
S_IFDIR: S_IFDIR,
|
||||
S_IFCHR: S_IFCHR,
|
||||
S_IFBLK: S_IFBLK,
|
||||
S_IFIFO: S_IFIFO,
|
||||
S_IFLNK: S_IFLNK,
|
||||
S_IFSOCK: S_IFSOCK,
|
||||
O_CREAT: O_CREAT,
|
||||
O_EXCL: O_EXCL,
|
||||
O_NOCTTY: O_NOCTTY,
|
||||
O_TRUNC: O_TRUNC,
|
||||
O_APPEND: O_APPEND,
|
||||
O_DIRECTORY: O_DIRECTORY,
|
||||
O_NOFOLLOW: O_NOFOLLOW,
|
||||
O_SYNC: O_SYNC,
|
||||
O_DSYNC: O_DSYNC,
|
||||
O_SYMLINK: O_SYMLINK,
|
||||
O_NONBLOCK: O_NONBLOCK,
|
||||
S_IRWXU: S_IRWXU,
|
||||
S_IRUSR: S_IRUSR,
|
||||
S_IWUSR: S_IWUSR,
|
||||
S_IXUSR: S_IXUSR,
|
||||
S_IRWXG: S_IRWXG,
|
||||
S_IRGRP: S_IRGRP,
|
||||
S_IWGRP: S_IWGRP,
|
||||
S_IXGRP: S_IXGRP,
|
||||
S_IRWXO: S_IRWXO,
|
||||
S_IROTH: S_IROTH,
|
||||
S_IWOTH: S_IWOTH,
|
||||
S_IXOTH: S_IXOTH,
|
||||
F_OK: F_OK,
|
||||
R_OK: R_OK,
|
||||
W_OK: W_OK,
|
||||
X_OK: X_OK,
|
||||
UV_FS_COPYFILE_EXCL: UV_FS_COPYFILE_EXCL,
|
||||
COPYFILE_EXCL: COPYFILE_EXCL,
|
||||
UV_FS_COPYFILE_FICLONE: UV_FS_COPYFILE_FICLONE,
|
||||
COPYFILE_FICLONE: COPYFILE_FICLONE,
|
||||
UV_FS_COPYFILE_FICLONE_FORCE: UV_FS_COPYFILE_FICLONE_FORCE,
|
||||
COPYFILE_FICLONE_FORCE: COPYFILE_FICLONE_FORCE,
|
||||
OPENSSL_VERSION_NUMBER: OPENSSL_VERSION_NUMBER,
|
||||
SSL_OP_ALL: SSL_OP_ALL,
|
||||
SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION,
|
||||
SSL_OP_CIPHER_SERVER_PREFERENCE: SSL_OP_CIPHER_SERVER_PREFERENCE,
|
||||
SSL_OP_CISCO_ANYCONNECT: SSL_OP_CISCO_ANYCONNECT,
|
||||
SSL_OP_COOKIE_EXCHANGE: SSL_OP_COOKIE_EXCHANGE,
|
||||
SSL_OP_CRYPTOPRO_TLSEXT_BUG: SSL_OP_CRYPTOPRO_TLSEXT_BUG,
|
||||
SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS,
|
||||
SSL_OP_EPHEMERAL_RSA: SSL_OP_EPHEMERAL_RSA,
|
||||
SSL_OP_LEGACY_SERVER_CONNECT: SSL_OP_LEGACY_SERVER_CONNECT,
|
||||
SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER,
|
||||
SSL_OP_MICROSOFT_SESS_ID_BUG: SSL_OP_MICROSOFT_SESS_ID_BUG,
|
||||
SSL_OP_MSIE_SSLV2_RSA_PADDING: SSL_OP_MSIE_SSLV2_RSA_PADDING,
|
||||
SSL_OP_NETSCAPE_CA_DN_BUG: SSL_OP_NETSCAPE_CA_DN_BUG,
|
||||
SSL_OP_NETSCAPE_CHALLENGE_BUG: SSL_OP_NETSCAPE_CHALLENGE_BUG,
|
||||
SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG,
|
||||
SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG,
|
||||
SSL_OP_NO_COMPRESSION: SSL_OP_NO_COMPRESSION,
|
||||
SSL_OP_NO_QUERY_MTU: SSL_OP_NO_QUERY_MTU,
|
||||
SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION,
|
||||
SSL_OP_NO_SSLv2: SSL_OP_NO_SSLv2,
|
||||
SSL_OP_NO_SSLv3: SSL_OP_NO_SSLv3,
|
||||
SSL_OP_NO_TICKET: SSL_OP_NO_TICKET,
|
||||
SSL_OP_NO_TLSv1: SSL_OP_NO_TLSv1,
|
||||
SSL_OP_NO_TLSv1_1: SSL_OP_NO_TLSv1_1,
|
||||
SSL_OP_NO_TLSv1_2: SSL_OP_NO_TLSv1_2,
|
||||
SSL_OP_PKCS1_CHECK_1: SSL_OP_PKCS1_CHECK_1,
|
||||
SSL_OP_PKCS1_CHECK_2: SSL_OP_PKCS1_CHECK_2,
|
||||
SSL_OP_SINGLE_DH_USE: SSL_OP_SINGLE_DH_USE,
|
||||
SSL_OP_SINGLE_ECDH_USE: SSL_OP_SINGLE_ECDH_USE,
|
||||
SSL_OP_SSLEAY_080_CLIENT_DH_BUG: SSL_OP_SSLEAY_080_CLIENT_DH_BUG,
|
||||
SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG,
|
||||
SSL_OP_TLS_BLOCK_PADDING_BUG: SSL_OP_TLS_BLOCK_PADDING_BUG,
|
||||
SSL_OP_TLS_D5_BUG: SSL_OP_TLS_D5_BUG,
|
||||
SSL_OP_TLS_ROLLBACK_BUG: SSL_OP_TLS_ROLLBACK_BUG,
|
||||
ENGINE_METHOD_RSA: ENGINE_METHOD_RSA,
|
||||
ENGINE_METHOD_DSA: ENGINE_METHOD_DSA,
|
||||
ENGINE_METHOD_DH: ENGINE_METHOD_DH,
|
||||
ENGINE_METHOD_RAND: ENGINE_METHOD_RAND,
|
||||
ENGINE_METHOD_EC: ENGINE_METHOD_EC,
|
||||
ENGINE_METHOD_CIPHERS: ENGINE_METHOD_CIPHERS,
|
||||
ENGINE_METHOD_DIGESTS: ENGINE_METHOD_DIGESTS,
|
||||
ENGINE_METHOD_PKEY_METHS: ENGINE_METHOD_PKEY_METHS,
|
||||
ENGINE_METHOD_PKEY_ASN1_METHS: ENGINE_METHOD_PKEY_ASN1_METHS,
|
||||
ENGINE_METHOD_ALL: ENGINE_METHOD_ALL,
|
||||
ENGINE_METHOD_NONE: ENGINE_METHOD_NONE,
|
||||
DH_CHECK_P_NOT_SAFE_PRIME: DH_CHECK_P_NOT_SAFE_PRIME,
|
||||
DH_CHECK_P_NOT_PRIME: DH_CHECK_P_NOT_PRIME,
|
||||
DH_UNABLE_TO_CHECK_GENERATOR: DH_UNABLE_TO_CHECK_GENERATOR,
|
||||
DH_NOT_SUITABLE_GENERATOR: DH_NOT_SUITABLE_GENERATOR,
|
||||
ALPN_ENABLED: ALPN_ENABLED,
|
||||
RSA_PKCS1_PADDING: RSA_PKCS1_PADDING,
|
||||
RSA_SSLV23_PADDING: RSA_SSLV23_PADDING,
|
||||
RSA_NO_PADDING: RSA_NO_PADDING,
|
||||
RSA_PKCS1_OAEP_PADDING: RSA_PKCS1_OAEP_PADDING,
|
||||
RSA_X931_PADDING: RSA_X931_PADDING,
|
||||
RSA_PKCS1_PSS_PADDING: RSA_PKCS1_PSS_PADDING,
|
||||
RSA_PSS_SALTLEN_DIGEST: RSA_PSS_SALTLEN_DIGEST,
|
||||
RSA_PSS_SALTLEN_MAX_SIGN: RSA_PSS_SALTLEN_MAX_SIGN,
|
||||
RSA_PSS_SALTLEN_AUTO: RSA_PSS_SALTLEN_AUTO,
|
||||
defaultCoreCipherList: defaultCoreCipherList,
|
||||
TLS1_VERSION: TLS1_VERSION,
|
||||
TLS1_1_VERSION: TLS1_1_VERSION,
|
||||
TLS1_2_VERSION: TLS1_2_VERSION,
|
||||
TLS1_3_VERSION: TLS1_3_VERSION,
|
||||
POINT_CONVERSION_COMPRESSED: POINT_CONVERSION_COMPRESSED,
|
||||
POINT_CONVERSION_UNCOMPRESSED: POINT_CONVERSION_UNCOMPRESSED,
|
||||
POINT_CONVERSION_HYBRID: POINT_CONVERSION_HYBRID,
|
||||
defaultCipherList: defaultCipherList
|
||||
};
|
16432
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/crypto-browserify.js
generated
vendored
Normal file
16432
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/crypto-browserify.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
100
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/domain.js
generated
vendored
Normal file
100
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/domain.js
generated
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
<!-- LICENSEFILE/ -->
|
||||
|
||||
<h1>License</h1>
|
||||
|
||||
Unless stated otherwise all works are:
|
||||
|
||||
<ul><li>Copyright © 2013+ <a href="http://bevry.me">Bevry Pty Ltd</a></li></ul>
|
||||
|
||||
and licensed under:
|
||||
|
||||
<ul><li><a href="http://spdx.org/licenses/MIT.html">MIT License</a></li></ul>
|
||||
|
||||
<h2>MIT License</h2>
|
||||
|
||||
<pre>
|
||||
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.
|
||||
</pre>
|
||||
|
||||
<!-- /LICENSEFILE -->
|
||||
*/
|
||||
/*
|
||||
modified by Calvin Metcalf to adhere to how the node one works a little better
|
||||
*/
|
||||
import {EventEmitter} from 'events';
|
||||
import inherits from './inherits';
|
||||
inherits(Domain, EventEmitter);
|
||||
function createEmitError(d) {
|
||||
return emitError;
|
||||
function emitError(e) {
|
||||
d.emit('error', e)
|
||||
}
|
||||
}
|
||||
|
||||
export function Domain() {
|
||||
EventEmitter.call(this);
|
||||
this.__emitError = createEmitError(this);
|
||||
}
|
||||
Domain.prototype.add = function (emitter) {
|
||||
emitter.on('error', this.__emitError);
|
||||
}
|
||||
Domain.prototype.remove = function(emitter) {
|
||||
emitter.removeListener('error', this.__emitError)
|
||||
}
|
||||
Domain.prototype.bind = function(fn) {
|
||||
var emitError = this.__emitError;
|
||||
return function() {
|
||||
var args = Array.prototype.slice.call(arguments)
|
||||
try {
|
||||
fn.apply(null, args)
|
||||
} catch (err) {
|
||||
emitError(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Domain.prototype.intercept = function(fn) {
|
||||
var emitError = this.__emitError;
|
||||
return function(err) {
|
||||
if (err) {
|
||||
emitError(err)
|
||||
} else {
|
||||
var args = Array.prototype.slice.call(arguments, 1)
|
||||
try {
|
||||
fn.apply(null, args)
|
||||
} catch (err) {
|
||||
emitError(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Domain.prototype.run = function(fn) {
|
||||
var emitError = this.__emitError;
|
||||
try {
|
||||
fn()
|
||||
} catch (err) {
|
||||
emitError(err)
|
||||
}
|
||||
return this
|
||||
}
|
||||
Domain.prototype.dispose = function() {
|
||||
this.removeAllListeners()
|
||||
return this
|
||||
}
|
||||
Domain.prototype.enter = Domain.prototype.exit = function() {
|
||||
return this
|
||||
}
|
||||
export function createDomain() {
|
||||
return new Domain();
|
||||
}
|
||||
export var create = createDomain;
|
||||
|
||||
export default {
|
||||
Domain: Domain,
|
||||
createDomain: createDomain,
|
||||
create: create
|
||||
}
|
1
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/empty.js
generated
vendored
Normal file
1
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/empty.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default {};
|
475
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/events.js
generated
vendored
Normal file
475
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/events.js
generated
vendored
Normal file
|
@ -0,0 +1,475 @@
|
|||
'use strict';
|
||||
|
||||
var domain;
|
||||
|
||||
// This constructor is used to store event handlers. Instantiating this is
|
||||
// faster than explicitly calling `Object.create(null)` to get a "clean" empty
|
||||
// object (tested with v8 v4.9).
|
||||
function EventHandlers() {}
|
||||
EventHandlers.prototype = Object.create(null);
|
||||
|
||||
function EventEmitter() {
|
||||
EventEmitter.init.call(this);
|
||||
}
|
||||
export default EventEmitter;
|
||||
export {EventEmitter};
|
||||
|
||||
// nodejs oddity
|
||||
// require('events') === require('events').EventEmitter
|
||||
EventEmitter.EventEmitter = EventEmitter
|
||||
|
||||
EventEmitter.usingDomains = false;
|
||||
|
||||
EventEmitter.prototype.domain = undefined;
|
||||
EventEmitter.prototype._events = undefined;
|
||||
EventEmitter.prototype._maxListeners = undefined;
|
||||
|
||||
// By default EventEmitters will print a warning if more than 10 listeners are
|
||||
// added to it. This is a useful default which helps finding memory leaks.
|
||||
EventEmitter.defaultMaxListeners = 10;
|
||||
|
||||
EventEmitter.init = function() {
|
||||
this.domain = null;
|
||||
if (EventEmitter.usingDomains) {
|
||||
// if there is an active domain, then attach to it.
|
||||
if (domain.active && !(this instanceof domain.Domain)) {
|
||||
this.domain = domain.active;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this._events || this._events === Object.getPrototypeOf(this)._events) {
|
||||
this._events = new EventHandlers();
|
||||
this._eventsCount = 0;
|
||||
}
|
||||
|
||||
this._maxListeners = this._maxListeners || undefined;
|
||||
};
|
||||
|
||||
// Obviously not all Emitters should be limited to 10. This function allows
|
||||
// that to be increased. Set to zero for unlimited.
|
||||
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
||||
if (typeof n !== 'number' || n < 0 || isNaN(n))
|
||||
throw new TypeError('"n" argument must be a positive number');
|
||||
this._maxListeners = n;
|
||||
return this;
|
||||
};
|
||||
|
||||
function $getMaxListeners(that) {
|
||||
if (that._maxListeners === undefined)
|
||||
return EventEmitter.defaultMaxListeners;
|
||||
return that._maxListeners;
|
||||
}
|
||||
|
||||
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
||||
return $getMaxListeners(this);
|
||||
};
|
||||
|
||||
// These standalone emit* functions are used to optimize calling of event
|
||||
// handlers for fast cases because emit() itself often has a variable number of
|
||||
// arguments and can be deoptimized because of that. These functions always have
|
||||
// the same number of arguments and thus do not get deoptimized, so the code
|
||||
// inside them can execute faster.
|
||||
function emitNone(handler, isFn, self) {
|
||||
if (isFn)
|
||||
handler.call(self);
|
||||
else {
|
||||
var len = handler.length;
|
||||
var listeners = arrayClone(handler, len);
|
||||
for (var i = 0; i < len; ++i)
|
||||
listeners[i].call(self);
|
||||
}
|
||||
}
|
||||
function emitOne(handler, isFn, self, arg1) {
|
||||
if (isFn)
|
||||
handler.call(self, arg1);
|
||||
else {
|
||||
var len = handler.length;
|
||||
var listeners = arrayClone(handler, len);
|
||||
for (var i = 0; i < len; ++i)
|
||||
listeners[i].call(self, arg1);
|
||||
}
|
||||
}
|
||||
function emitTwo(handler, isFn, self, arg1, arg2) {
|
||||
if (isFn)
|
||||
handler.call(self, arg1, arg2);
|
||||
else {
|
||||
var len = handler.length;
|
||||
var listeners = arrayClone(handler, len);
|
||||
for (var i = 0; i < len; ++i)
|
||||
listeners[i].call(self, arg1, arg2);
|
||||
}
|
||||
}
|
||||
function emitThree(handler, isFn, self, arg1, arg2, arg3) {
|
||||
if (isFn)
|
||||
handler.call(self, arg1, arg2, arg3);
|
||||
else {
|
||||
var len = handler.length;
|
||||
var listeners = arrayClone(handler, len);
|
||||
for (var i = 0; i < len; ++i)
|
||||
listeners[i].call(self, arg1, arg2, arg3);
|
||||
}
|
||||
}
|
||||
|
||||
function emitMany(handler, isFn, self, args) {
|
||||
if (isFn)
|
||||
handler.apply(self, args);
|
||||
else {
|
||||
var len = handler.length;
|
||||
var listeners = arrayClone(handler, len);
|
||||
for (var i = 0; i < len; ++i)
|
||||
listeners[i].apply(self, args);
|
||||
}
|
||||
}
|
||||
|
||||
EventEmitter.prototype.emit = function emit(type) {
|
||||
var er, handler, len, args, i, events, domain;
|
||||
var needDomainExit = false;
|
||||
var doError = (type === 'error');
|
||||
|
||||
events = this._events;
|
||||
if (events)
|
||||
doError = (doError && events.error == null);
|
||||
else if (!doError)
|
||||
return false;
|
||||
|
||||
domain = this.domain;
|
||||
|
||||
// If there is no 'error' event listener then throw.
|
||||
if (doError) {
|
||||
er = arguments[1];
|
||||
if (domain) {
|
||||
if (!er)
|
||||
er = new Error('Uncaught, unspecified "error" event');
|
||||
er.domainEmitter = this;
|
||||
er.domain = domain;
|
||||
er.domainThrown = false;
|
||||
domain.emit('error', er);
|
||||
} else if (er instanceof Error) {
|
||||
throw er; // Unhandled 'error' event
|
||||
} else {
|
||||
// At least give some kind of context to the user
|
||||
var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
|
||||
err.context = er;
|
||||
throw err;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
handler = events[type];
|
||||
|
||||
if (!handler)
|
||||
return false;
|
||||
|
||||
var isFn = typeof handler === 'function';
|
||||
len = arguments.length;
|
||||
switch (len) {
|
||||
// fast cases
|
||||
case 1:
|
||||
emitNone(handler, isFn, this);
|
||||
break;
|
||||
case 2:
|
||||
emitOne(handler, isFn, this, arguments[1]);
|
||||
break;
|
||||
case 3:
|
||||
emitTwo(handler, isFn, this, arguments[1], arguments[2]);
|
||||
break;
|
||||
case 4:
|
||||
emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
|
||||
break;
|
||||
// slower
|
||||
default:
|
||||
args = new Array(len - 1);
|
||||
for (i = 1; i < len; i++)
|
||||
args[i - 1] = arguments[i];
|
||||
emitMany(handler, isFn, this, args);
|
||||
}
|
||||
|
||||
if (needDomainExit)
|
||||
domain.exit();
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
function _addListener(target, type, listener, prepend) {
|
||||
var m;
|
||||
var events;
|
||||
var existing;
|
||||
|
||||
if (typeof listener !== 'function')
|
||||
throw new TypeError('"listener" argument must be a function');
|
||||
|
||||
events = target._events;
|
||||
if (!events) {
|
||||
events = target._events = new EventHandlers();
|
||||
target._eventsCount = 0;
|
||||
} else {
|
||||
// To avoid recursion in the case that type === "newListener"! Before
|
||||
// adding it to the listeners, first emit "newListener".
|
||||
if (events.newListener) {
|
||||
target.emit('newListener', type,
|
||||
listener.listener ? listener.listener : listener);
|
||||
|
||||
// Re-assign `events` because a newListener handler could have caused the
|
||||
// this._events to be assigned to a new object
|
||||
events = target._events;
|
||||
}
|
||||
existing = events[type];
|
||||
}
|
||||
|
||||
if (!existing) {
|
||||
// Optimize the case of one listener. Don't need the extra array object.
|
||||
existing = events[type] = listener;
|
||||
++target._eventsCount;
|
||||
} else {
|
||||
if (typeof existing === 'function') {
|
||||
// Adding the second element, need to change to array.
|
||||
existing = events[type] = prepend ? [listener, existing] :
|
||||
[existing, listener];
|
||||
} else {
|
||||
// If we've already got an array, just append.
|
||||
if (prepend) {
|
||||
existing.unshift(listener);
|
||||
} else {
|
||||
existing.push(listener);
|
||||
}
|
||||
}
|
||||
|
||||
// Check for listener leak
|
||||
if (!existing.warned) {
|
||||
m = $getMaxListeners(target);
|
||||
if (m && m > 0 && existing.length > m) {
|
||||
existing.warned = true;
|
||||
var w = new Error('Possible EventEmitter memory leak detected. ' +
|
||||
existing.length + ' ' + type + ' listeners added. ' +
|
||||
'Use emitter.setMaxListeners() to increase limit');
|
||||
w.name = 'MaxListenersExceededWarning';
|
||||
w.emitter = target;
|
||||
w.type = type;
|
||||
w.count = existing.length;
|
||||
emitWarning(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
function emitWarning(e) {
|
||||
typeof console.warn === 'function' ? console.warn(e) : console.log(e);
|
||||
}
|
||||
EventEmitter.prototype.addListener = function addListener(type, listener) {
|
||||
return _addListener(this, type, listener, false);
|
||||
};
|
||||
|
||||
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
||||
|
||||
EventEmitter.prototype.prependListener =
|
||||
function prependListener(type, listener) {
|
||||
return _addListener(this, type, listener, true);
|
||||
};
|
||||
|
||||
function _onceWrap(target, type, listener) {
|
||||
var fired = false;
|
||||
function g() {
|
||||
target.removeListener(type, g);
|
||||
if (!fired) {
|
||||
fired = true;
|
||||
listener.apply(target, arguments);
|
||||
}
|
||||
}
|
||||
g.listener = listener;
|
||||
return g;
|
||||
}
|
||||
|
||||
EventEmitter.prototype.once = function once(type, listener) {
|
||||
if (typeof listener !== 'function')
|
||||
throw new TypeError('"listener" argument must be a function');
|
||||
this.on(type, _onceWrap(this, type, listener));
|
||||
return this;
|
||||
};
|
||||
|
||||
EventEmitter.prototype.prependOnceListener =
|
||||
function prependOnceListener(type, listener) {
|
||||
if (typeof listener !== 'function')
|
||||
throw new TypeError('"listener" argument must be a function');
|
||||
this.prependListener(type, _onceWrap(this, type, listener));
|
||||
return this;
|
||||
};
|
||||
|
||||
// emits a 'removeListener' event iff the listener was removed
|
||||
EventEmitter.prototype.removeListener =
|
||||
function removeListener(type, listener) {
|
||||
var list, events, position, i, originalListener;
|
||||
|
||||
if (typeof listener !== 'function')
|
||||
throw new TypeError('"listener" argument must be a function');
|
||||
|
||||
events = this._events;
|
||||
if (!events)
|
||||
return this;
|
||||
|
||||
list = events[type];
|
||||
if (!list)
|
||||
return this;
|
||||
|
||||
if (list === listener || (list.listener && list.listener === listener)) {
|
||||
if (--this._eventsCount === 0)
|
||||
this._events = new EventHandlers();
|
||||
else {
|
||||
delete events[type];
|
||||
if (events.removeListener)
|
||||
this.emit('removeListener', type, list.listener || listener);
|
||||
}
|
||||
} else if (typeof list !== 'function') {
|
||||
position = -1;
|
||||
|
||||
for (i = list.length; i-- > 0;) {
|
||||
if (list[i] === listener ||
|
||||
(list[i].listener && list[i].listener === listener)) {
|
||||
originalListener = list[i].listener;
|
||||
position = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (position < 0)
|
||||
return this;
|
||||
|
||||
if (list.length === 1) {
|
||||
list[0] = undefined;
|
||||
if (--this._eventsCount === 0) {
|
||||
this._events = new EventHandlers();
|
||||
return this;
|
||||
} else {
|
||||
delete events[type];
|
||||
}
|
||||
} else {
|
||||
spliceOne(list, position);
|
||||
}
|
||||
|
||||
if (events.removeListener)
|
||||
this.emit('removeListener', type, originalListener || listener);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
EventEmitter.prototype.removeAllListeners =
|
||||
function removeAllListeners(type) {
|
||||
var listeners, events;
|
||||
|
||||
events = this._events;
|
||||
if (!events)
|
||||
return this;
|
||||
|
||||
// not listening for removeListener, no need to emit
|
||||
if (!events.removeListener) {
|
||||
if (arguments.length === 0) {
|
||||
this._events = new EventHandlers();
|
||||
this._eventsCount = 0;
|
||||
} else if (events[type]) {
|
||||
if (--this._eventsCount === 0)
|
||||
this._events = new EventHandlers();
|
||||
else
|
||||
delete events[type];
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
// emit removeListener for all listeners on all events
|
||||
if (arguments.length === 0) {
|
||||
var keys = Object.keys(events);
|
||||
for (var i = 0, key; i < keys.length; ++i) {
|
||||
key = keys[i];
|
||||
if (key === 'removeListener') continue;
|
||||
this.removeAllListeners(key);
|
||||
}
|
||||
this.removeAllListeners('removeListener');
|
||||
this._events = new EventHandlers();
|
||||
this._eventsCount = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
listeners = events[type];
|
||||
|
||||
if (typeof listeners === 'function') {
|
||||
this.removeListener(type, listeners);
|
||||
} else if (listeners) {
|
||||
// LIFO order
|
||||
do {
|
||||
this.removeListener(type, listeners[listeners.length - 1]);
|
||||
} while (listeners[0]);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
EventEmitter.prototype.listeners = function listeners(type) {
|
||||
var evlistener;
|
||||
var ret;
|
||||
var events = this._events;
|
||||
|
||||
if (!events)
|
||||
ret = [];
|
||||
else {
|
||||
evlistener = events[type];
|
||||
if (!evlistener)
|
||||
ret = [];
|
||||
else if (typeof evlistener === 'function')
|
||||
ret = [evlistener.listener || evlistener];
|
||||
else
|
||||
ret = unwrapListeners(evlistener);
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
EventEmitter.listenerCount = function(emitter, type) {
|
||||
if (typeof emitter.listenerCount === 'function') {
|
||||
return emitter.listenerCount(type);
|
||||
} else {
|
||||
return listenerCount.call(emitter, type);
|
||||
}
|
||||
};
|
||||
|
||||
EventEmitter.prototype.listenerCount = listenerCount;
|
||||
function listenerCount(type) {
|
||||
var events = this._events;
|
||||
|
||||
if (events) {
|
||||
var evlistener = events[type];
|
||||
|
||||
if (typeof evlistener === 'function') {
|
||||
return 1;
|
||||
} else if (evlistener) {
|
||||
return evlistener.length;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EventEmitter.prototype.eventNames = function eventNames() {
|
||||
return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
|
||||
};
|
||||
|
||||
// About 1.5x faster than the two-arg version of Array#splice().
|
||||
function spliceOne(list, index) {
|
||||
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
|
||||
list[i] = list[k];
|
||||
list.pop();
|
||||
}
|
||||
|
||||
function arrayClone(arr, i) {
|
||||
var copy = new Array(i);
|
||||
while (i--)
|
||||
copy[i] = arr[i];
|
||||
return copy;
|
||||
}
|
||||
|
||||
function unwrapListeners(arr) {
|
||||
var ret = new Array(arr.length);
|
||||
for (var i = 0; i < ret.length; ++i) {
|
||||
ret[i] = arr[i].listener || arr[i];
|
||||
}
|
||||
return ret;
|
||||
}
|
3
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/global.js
generated
vendored
Normal file
3
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/global.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
export default (typeof global !== "undefined" ? global :
|
||||
typeof self !== "undefined" ? self :
|
||||
typeof window !== "undefined" ? window : {});
|
52
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/capability.js
generated
vendored
Normal file
52
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/capability.js
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
export var hasFetch = isFunction(global.fetch) && isFunction(global.ReadableStream)
|
||||
|
||||
var _blobConstructor;
|
||||
export function blobConstructor() {
|
||||
if (typeof _blobConstructor !== 'undefined') {
|
||||
return _blobConstructor;
|
||||
}
|
||||
try {
|
||||
new global.Blob([new ArrayBuffer(1)])
|
||||
_blobConstructor = true
|
||||
} catch (e) {
|
||||
_blobConstructor = false
|
||||
}
|
||||
return _blobConstructor
|
||||
}
|
||||
var xhr;
|
||||
|
||||
function checkTypeSupport(type) {
|
||||
if (!xhr) {
|
||||
xhr = new global.XMLHttpRequest()
|
||||
// If location.host is empty, e.g. if this page/worker was loaded
|
||||
// from a Blob, then use example.com to avoid an error
|
||||
xhr.open('GET', global.location.host ? '/' : 'https://example.com')
|
||||
}
|
||||
try {
|
||||
xhr.responseType = type
|
||||
return xhr.responseType === type
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'.
|
||||
// Safari 7.1 appears to have fixed this bug.
|
||||
var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined'
|
||||
var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice)
|
||||
|
||||
export var arraybuffer = haveArrayBuffer && checkTypeSupport('arraybuffer')
|
||||
// These next two tests unavoidably show warnings in Chrome. Since fetch will always
|
||||
// be used if it's available, just return false for these to avoid the warnings.
|
||||
export var msstream = !hasFetch && haveSlice && checkTypeSupport('ms-stream')
|
||||
export var mozchunkedarraybuffer = !hasFetch && haveArrayBuffer &&
|
||||
checkTypeSupport('moz-chunked-arraybuffer')
|
||||
export var overrideMimeType = isFunction(xhr.overrideMimeType)
|
||||
export var vbArray = isFunction(global.VBArray)
|
||||
|
||||
function isFunction(value) {
|
||||
return typeof value === 'function'
|
||||
}
|
||||
|
||||
xhr = null // Help gc
|
278
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/request.js
generated
vendored
Normal file
278
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/request.js
generated
vendored
Normal file
|
@ -0,0 +1,278 @@
|
|||
import * as capability from './capability';
|
||||
import {inherits} from 'util';
|
||||
import {IncomingMessage, readyStates as rStates} from './response';
|
||||
import {Writable} from 'stream';
|
||||
import toArrayBuffer from './to-arraybuffer';
|
||||
|
||||
function decideMode(preferBinary, useFetch) {
|
||||
if (capability.hasFetch && useFetch) {
|
||||
return 'fetch'
|
||||
} else if (capability.mozchunkedarraybuffer) {
|
||||
return 'moz-chunked-arraybuffer'
|
||||
} else if (capability.msstream) {
|
||||
return 'ms-stream'
|
||||
} else if (capability.arraybuffer && preferBinary) {
|
||||
return 'arraybuffer'
|
||||
} else if (capability.vbArray && preferBinary) {
|
||||
return 'text:vbarray'
|
||||
} else {
|
||||
return 'text'
|
||||
}
|
||||
}
|
||||
export default ClientRequest;
|
||||
|
||||
function ClientRequest(opts) {
|
||||
var self = this
|
||||
Writable.call(self)
|
||||
|
||||
self._opts = opts
|
||||
self._body = []
|
||||
self._headers = {}
|
||||
if (opts.auth)
|
||||
self.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64'))
|
||||
Object.keys(opts.headers).forEach(function(name) {
|
||||
self.setHeader(name, opts.headers[name])
|
||||
})
|
||||
|
||||
var preferBinary
|
||||
var useFetch = true
|
||||
if (opts.mode === 'disable-fetch') {
|
||||
// If the use of XHR should be preferred and includes preserving the 'content-type' header
|
||||
useFetch = false
|
||||
preferBinary = true
|
||||
} else if (opts.mode === 'prefer-streaming') {
|
||||
// If streaming is a high priority but binary compatibility and
|
||||
// the accuracy of the 'content-type' header aren't
|
||||
preferBinary = false
|
||||
} else if (opts.mode === 'allow-wrong-content-type') {
|
||||
// If streaming is more important than preserving the 'content-type' header
|
||||
preferBinary = !capability.overrideMimeType
|
||||
} else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') {
|
||||
// Use binary if text streaming may corrupt data or the content-type header, or for speed
|
||||
preferBinary = true
|
||||
} else {
|
||||
throw new Error('Invalid value for opts.mode')
|
||||
}
|
||||
self._mode = decideMode(preferBinary, useFetch)
|
||||
|
||||
self.on('finish', function() {
|
||||
self._onFinish()
|
||||
})
|
||||
}
|
||||
|
||||
inherits(ClientRequest, Writable)
|
||||
// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method
|
||||
var unsafeHeaders = [
|
||||
'accept-charset',
|
||||
'accept-encoding',
|
||||
'access-control-request-headers',
|
||||
'access-control-request-method',
|
||||
'connection',
|
||||
'content-length',
|
||||
'cookie',
|
||||
'cookie2',
|
||||
'date',
|
||||
'dnt',
|
||||
'expect',
|
||||
'host',
|
||||
'keep-alive',
|
||||
'origin',
|
||||
'referer',
|
||||
'te',
|
||||
'trailer',
|
||||
'transfer-encoding',
|
||||
'upgrade',
|
||||
'user-agent',
|
||||
'via'
|
||||
]
|
||||
ClientRequest.prototype.setHeader = function(name, value) {
|
||||
var self = this
|
||||
var lowerName = name.toLowerCase()
|
||||
// This check is not necessary, but it prevents warnings from browsers about setting unsafe
|
||||
// headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but
|
||||
// http-browserify did it, so I will too.
|
||||
if (unsafeHeaders.indexOf(lowerName) !== -1)
|
||||
return
|
||||
|
||||
self._headers[lowerName] = {
|
||||
name: name,
|
||||
value: value
|
||||
}
|
||||
}
|
||||
|
||||
ClientRequest.prototype.getHeader = function(name) {
|
||||
var self = this
|
||||
return self._headers[name.toLowerCase()].value
|
||||
}
|
||||
|
||||
ClientRequest.prototype.removeHeader = function(name) {
|
||||
var self = this
|
||||
delete self._headers[name.toLowerCase()]
|
||||
}
|
||||
|
||||
ClientRequest.prototype._onFinish = function() {
|
||||
var self = this
|
||||
|
||||
if (self._destroyed)
|
||||
return
|
||||
var opts = self._opts
|
||||
|
||||
var headersObj = self._headers
|
||||
var body
|
||||
if (opts.method === 'POST' || opts.method === 'PUT' || opts.method === 'PATCH') {
|
||||
if (capability.blobConstructor()) {
|
||||
body = new global.Blob(self._body.map(function(buffer) {
|
||||
return toArrayBuffer(buffer)
|
||||
}), {
|
||||
type: (headersObj['content-type'] || {}).value || ''
|
||||
})
|
||||
} else {
|
||||
// get utf8 string
|
||||
body = Buffer.concat(self._body).toString()
|
||||
}
|
||||
}
|
||||
|
||||
if (self._mode === 'fetch') {
|
||||
var headers = Object.keys(headersObj).map(function(name) {
|
||||
return [headersObj[name].name, headersObj[name].value]
|
||||
})
|
||||
|
||||
global.fetch(self._opts.url, {
|
||||
method: self._opts.method,
|
||||
headers: headers,
|
||||
body: body,
|
||||
mode: 'cors',
|
||||
credentials: opts.withCredentials ? 'include' : 'same-origin'
|
||||
}).then(function(response) {
|
||||
self._fetchResponse = response
|
||||
self._connect()
|
||||
}, function(reason) {
|
||||
self.emit('error', reason)
|
||||
})
|
||||
} else {
|
||||
var xhr = self._xhr = new global.XMLHttpRequest()
|
||||
try {
|
||||
xhr.open(self._opts.method, self._opts.url, true)
|
||||
} catch (err) {
|
||||
process.nextTick(function() {
|
||||
self.emit('error', err)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Can't set responseType on really old browsers
|
||||
if ('responseType' in xhr)
|
||||
xhr.responseType = self._mode.split(':')[0]
|
||||
|
||||
if ('withCredentials' in xhr)
|
||||
xhr.withCredentials = !!opts.withCredentials
|
||||
|
||||
if (self._mode === 'text' && 'overrideMimeType' in xhr)
|
||||
xhr.overrideMimeType('text/plain; charset=x-user-defined')
|
||||
|
||||
Object.keys(headersObj).forEach(function(name) {
|
||||
xhr.setRequestHeader(headersObj[name].name, headersObj[name].value)
|
||||
})
|
||||
|
||||
self._response = null
|
||||
xhr.onreadystatechange = function() {
|
||||
switch (xhr.readyState) {
|
||||
case rStates.LOADING:
|
||||
case rStates.DONE:
|
||||
self._onXHRProgress()
|
||||
break
|
||||
}
|
||||
}
|
||||
// Necessary for streaming in Firefox, since xhr.response is ONLY defined
|
||||
// in onprogress, not in onreadystatechange with xhr.readyState = 3
|
||||
if (self._mode === 'moz-chunked-arraybuffer') {
|
||||
xhr.onprogress = function() {
|
||||
self._onXHRProgress()
|
||||
}
|
||||
}
|
||||
|
||||
xhr.onerror = function() {
|
||||
if (self._destroyed)
|
||||
return
|
||||
self.emit('error', new Error('XHR error'))
|
||||
}
|
||||
|
||||
try {
|
||||
xhr.send(body)
|
||||
} catch (err) {
|
||||
process.nextTick(function() {
|
||||
self.emit('error', err)
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if xhr.status is readable and non-zero, indicating no error.
|
||||
* Even though the spec says it should be available in readyState 3,
|
||||
* accessing it throws an exception in IE8
|
||||
*/
|
||||
function statusValid(xhr) {
|
||||
try {
|
||||
var status = xhr.status
|
||||
return (status !== null && status !== 0)
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
ClientRequest.prototype._onXHRProgress = function() {
|
||||
var self = this
|
||||
|
||||
if (!statusValid(self._xhr) || self._destroyed)
|
||||
return
|
||||
|
||||
if (!self._response)
|
||||
self._connect()
|
||||
|
||||
self._response._onXHRProgress()
|
||||
}
|
||||
|
||||
ClientRequest.prototype._connect = function() {
|
||||
var self = this
|
||||
|
||||
if (self._destroyed)
|
||||
return
|
||||
|
||||
self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode)
|
||||
self.emit('response', self._response)
|
||||
}
|
||||
|
||||
ClientRequest.prototype._write = function(chunk, encoding, cb) {
|
||||
var self = this
|
||||
|
||||
self._body.push(chunk)
|
||||
cb()
|
||||
}
|
||||
|
||||
ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function() {
|
||||
var self = this
|
||||
self._destroyed = true
|
||||
if (self._response)
|
||||
self._response._destroyed = true
|
||||
if (self._xhr)
|
||||
self._xhr.abort()
|
||||
// Currently, there isn't a way to truly abort a fetch.
|
||||
// If you like bikeshedding, see https://github.com/whatwg/fetch/issues/27
|
||||
}
|
||||
|
||||
ClientRequest.prototype.end = function(data, encoding, cb) {
|
||||
var self = this
|
||||
if (typeof data === 'function') {
|
||||
cb = data
|
||||
data = undefined
|
||||
}
|
||||
|
||||
Writable.prototype.end.call(self, data, encoding, cb)
|
||||
}
|
||||
|
||||
ClientRequest.prototype.flushHeaders = function() {}
|
||||
ClientRequest.prototype.setTimeout = function() {}
|
||||
ClientRequest.prototype.setNoDelay = function() {}
|
||||
ClientRequest.prototype.setSocketKeepAlive = function() {}
|
185
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/response.js
generated
vendored
Normal file
185
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/response.js
generated
vendored
Normal file
|
@ -0,0 +1,185 @@
|
|||
import {overrideMimeType} from './capability';
|
||||
import {inherits} from 'util';
|
||||
import {Readable} from 'stream';
|
||||
|
||||
var rStates = {
|
||||
UNSENT: 0,
|
||||
OPENED: 1,
|
||||
HEADERS_RECEIVED: 2,
|
||||
LOADING: 3,
|
||||
DONE: 4
|
||||
}
|
||||
export {
|
||||
rStates as readyStates
|
||||
};
|
||||
export function IncomingMessage(xhr, response, mode) {
|
||||
var self = this
|
||||
Readable.call(self)
|
||||
|
||||
self._mode = mode
|
||||
self.headers = {}
|
||||
self.rawHeaders = []
|
||||
self.trailers = {}
|
||||
self.rawTrailers = []
|
||||
|
||||
// Fake the 'close' event, but only once 'end' fires
|
||||
self.on('end', function() {
|
||||
// The nextTick is necessary to prevent the 'request' module from causing an infinite loop
|
||||
process.nextTick(function() {
|
||||
self.emit('close')
|
||||
})
|
||||
})
|
||||
var read;
|
||||
if (mode === 'fetch') {
|
||||
self._fetchResponse = response
|
||||
|
||||
self.url = response.url
|
||||
self.statusCode = response.status
|
||||
self.statusMessage = response.statusText
|
||||
// backwards compatible version of for (<item> of <iterable>):
|
||||
// for (var <item>,_i,_it = <iterable>[Symbol.iterator](); <item> = (_i = _it.next()).value,!_i.done;)
|
||||
for (var header, _i, _it = response.headers[Symbol.iterator](); header = (_i = _it.next()).value, !_i.done;) {
|
||||
self.headers[header[0].toLowerCase()] = header[1]
|
||||
self.rawHeaders.push(header[0], header[1])
|
||||
}
|
||||
|
||||
// TODO: this doesn't respect backpressure. Once WritableStream is available, this can be fixed
|
||||
var reader = response.body.getReader()
|
||||
|
||||
read = function () {
|
||||
reader.read().then(function(result) {
|
||||
if (self._destroyed)
|
||||
return
|
||||
if (result.done) {
|
||||
self.push(null)
|
||||
return
|
||||
}
|
||||
self.push(new Buffer(result.value))
|
||||
read()
|
||||
})
|
||||
}
|
||||
read()
|
||||
|
||||
} else {
|
||||
self._xhr = xhr
|
||||
self._pos = 0
|
||||
|
||||
self.url = xhr.responseURL
|
||||
self.statusCode = xhr.status
|
||||
self.statusMessage = xhr.statusText
|
||||
var headers = xhr.getAllResponseHeaders().split(/\r?\n/)
|
||||
headers.forEach(function(header) {
|
||||
var matches = header.match(/^([^:]+):\s*(.*)/)
|
||||
if (matches) {
|
||||
var key = matches[1].toLowerCase()
|
||||
if (key === 'set-cookie') {
|
||||
if (self.headers[key] === undefined) {
|
||||
self.headers[key] = []
|
||||
}
|
||||
self.headers[key].push(matches[2])
|
||||
} else if (self.headers[key] !== undefined) {
|
||||
self.headers[key] += ', ' + matches[2]
|
||||
} else {
|
||||
self.headers[key] = matches[2]
|
||||
}
|
||||
self.rawHeaders.push(matches[1], matches[2])
|
||||
}
|
||||
})
|
||||
|
||||
self._charset = 'x-user-defined'
|
||||
if (!overrideMimeType) {
|
||||
var mimeType = self.rawHeaders['mime-type']
|
||||
if (mimeType) {
|
||||
var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/)
|
||||
if (charsetMatch) {
|
||||
self._charset = charsetMatch[1].toLowerCase()
|
||||
}
|
||||
}
|
||||
if (!self._charset)
|
||||
self._charset = 'utf-8' // best guess
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inherits(IncomingMessage, Readable)
|
||||
|
||||
IncomingMessage.prototype._read = function() {}
|
||||
|
||||
IncomingMessage.prototype._onXHRProgress = function() {
|
||||
var self = this
|
||||
|
||||
var xhr = self._xhr
|
||||
|
||||
var response = null
|
||||
switch (self._mode) {
|
||||
case 'text:vbarray': // For IE9
|
||||
if (xhr.readyState !== rStates.DONE)
|
||||
break
|
||||
try {
|
||||
// This fails in IE8
|
||||
response = new global.VBArray(xhr.responseBody).toArray()
|
||||
} catch (e) {
|
||||
// pass
|
||||
}
|
||||
if (response !== null) {
|
||||
self.push(new Buffer(response))
|
||||
break
|
||||
}
|
||||
// Falls through in IE8
|
||||
case 'text':
|
||||
try { // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4
|
||||
response = xhr.responseText
|
||||
} catch (e) {
|
||||
self._mode = 'text:vbarray'
|
||||
break
|
||||
}
|
||||
if (response.length > self._pos) {
|
||||
var newData = response.substr(self._pos)
|
||||
if (self._charset === 'x-user-defined') {
|
||||
var buffer = new Buffer(newData.length)
|
||||
for (var i = 0; i < newData.length; i++)
|
||||
buffer[i] = newData.charCodeAt(i) & 0xff
|
||||
|
||||
self.push(buffer)
|
||||
} else {
|
||||
self.push(newData, self._charset)
|
||||
}
|
||||
self._pos = response.length
|
||||
}
|
||||
break
|
||||
case 'arraybuffer':
|
||||
if (xhr.readyState !== rStates.DONE || !xhr.response)
|
||||
break
|
||||
response = xhr.response
|
||||
self.push(new Buffer(new Uint8Array(response)))
|
||||
break
|
||||
case 'moz-chunked-arraybuffer': // take whole
|
||||
response = xhr.response
|
||||
if (xhr.readyState !== rStates.LOADING || !response)
|
||||
break
|
||||
self.push(new Buffer(new Uint8Array(response)))
|
||||
break
|
||||
case 'ms-stream':
|
||||
response = xhr.response
|
||||
if (xhr.readyState !== rStates.LOADING)
|
||||
break
|
||||
var reader = new global.MSStreamReader()
|
||||
reader.onprogress = function() {
|
||||
if (reader.result.byteLength > self._pos) {
|
||||
self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos))))
|
||||
self._pos = reader.result.byteLength
|
||||
}
|
||||
}
|
||||
reader.onload = function() {
|
||||
self.push(null)
|
||||
}
|
||||
// reader.onerror = ??? // TODO: this
|
||||
reader.readAsArrayBuffer(response)
|
||||
break
|
||||
}
|
||||
|
||||
// The ms-stream case handles end separately in reader.onload()
|
||||
if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') {
|
||||
self.push(null)
|
||||
}
|
||||
}
|
30
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/to-arraybuffer.js
generated
vendored
Normal file
30
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/http-lib/to-arraybuffer.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
// from https://github.com/jhiesey/to-arraybuffer/blob/6502d9850e70ba7935a7df4ad86b358fc216f9f0/index.js
|
||||
|
||||
// MIT License
|
||||
// Copyright (c) 2016 John Hiesey
|
||||
import {isBuffer} from 'buffer';
|
||||
export default function (buf) {
|
||||
// If the buffer is backed by a Uint8Array, a faster version will work
|
||||
if (buf instanceof Uint8Array) {
|
||||
// If the buffer isn't a subarray, return the underlying ArrayBuffer
|
||||
if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
|
||||
return buf.buffer
|
||||
} else if (typeof buf.buffer.slice === 'function') {
|
||||
// Otherwise we need to get a proper copy
|
||||
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)
|
||||
}
|
||||
}
|
||||
|
||||
if (isBuffer(buf)) {
|
||||
// This is the slow version that will work with any Buffer
|
||||
// implementation (even in old browsers)
|
||||
var arrayCopy = new Uint8Array(buf.length)
|
||||
var len = buf.length
|
||||
for (var i = 0; i < len; i++) {
|
||||
arrayCopy[i] = buf[i]
|
||||
}
|
||||
return arrayCopy.buffer
|
||||
} else {
|
||||
throw new Error('Argument must be a Buffer')
|
||||
}
|
||||
}
|
167
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/http.js
generated
vendored
Normal file
167
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/http.js
generated
vendored
Normal file
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
this and http-lib folder
|
||||
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2015 John Hiesey
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
import ClientRequest from './http-lib/request';
|
||||
import {parse} from 'url';
|
||||
|
||||
export function request(opts, cb) {
|
||||
if (typeof opts === 'string')
|
||||
opts = parse(opts)
|
||||
|
||||
|
||||
// Normally, the page is loaded from http or https, so not specifying a protocol
|
||||
// will result in a (valid) protocol-relative url. However, this won't work if
|
||||
// the protocol is something else, like 'file:'
|
||||
var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : ''
|
||||
|
||||
var protocol = opts.protocol || defaultProtocol
|
||||
var host = opts.hostname || opts.host
|
||||
var port = opts.port
|
||||
var path = opts.path || '/'
|
||||
|
||||
// Necessary for IPv6 addresses
|
||||
if (host && host.indexOf(':') !== -1)
|
||||
host = '[' + host + ']'
|
||||
|
||||
// This may be a relative url. The browser should always be able to interpret it correctly.
|
||||
opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path
|
||||
opts.method = (opts.method || 'GET').toUpperCase()
|
||||
opts.headers = opts.headers || {}
|
||||
|
||||
// Also valid opts.auth, opts.mode
|
||||
|
||||
var req = new ClientRequest(opts)
|
||||
if (cb)
|
||||
req.on('response', cb)
|
||||
return req
|
||||
}
|
||||
|
||||
export function get(opts, cb) {
|
||||
var req = request(opts, cb)
|
||||
req.end()
|
||||
return req
|
||||
}
|
||||
|
||||
export function Agent() {}
|
||||
Agent.defaultMaxSockets = 4
|
||||
|
||||
export var METHODS = [
|
||||
'CHECKOUT',
|
||||
'CONNECT',
|
||||
'COPY',
|
||||
'DELETE',
|
||||
'GET',
|
||||
'HEAD',
|
||||
'LOCK',
|
||||
'M-SEARCH',
|
||||
'MERGE',
|
||||
'MKACTIVITY',
|
||||
'MKCOL',
|
||||
'MOVE',
|
||||
'NOTIFY',
|
||||
'OPTIONS',
|
||||
'PATCH',
|
||||
'POST',
|
||||
'PROPFIND',
|
||||
'PROPPATCH',
|
||||
'PURGE',
|
||||
'PUT',
|
||||
'REPORT',
|
||||
'SEARCH',
|
||||
'SUBSCRIBE',
|
||||
'TRACE',
|
||||
'UNLOCK',
|
||||
'UNSUBSCRIBE'
|
||||
]
|
||||
export var STATUS_CODES = {
|
||||
100: 'Continue',
|
||||
101: 'Switching Protocols',
|
||||
102: 'Processing', // RFC 2518, obsoleted by RFC 4918
|
||||
200: 'OK',
|
||||
201: 'Created',
|
||||
202: 'Accepted',
|
||||
203: 'Non-Authoritative Information',
|
||||
204: 'No Content',
|
||||
205: 'Reset Content',
|
||||
206: 'Partial Content',
|
||||
207: 'Multi-Status', // RFC 4918
|
||||
300: 'Multiple Choices',
|
||||
301: 'Moved Permanently',
|
||||
302: 'Moved Temporarily',
|
||||
303: 'See Other',
|
||||
304: 'Not Modified',
|
||||
305: 'Use Proxy',
|
||||
307: 'Temporary Redirect',
|
||||
400: 'Bad Request',
|
||||
401: 'Unauthorized',
|
||||
402: 'Payment Required',
|
||||
403: 'Forbidden',
|
||||
404: 'Not Found',
|
||||
405: 'Method Not Allowed',
|
||||
406: 'Not Acceptable',
|
||||
407: 'Proxy Authentication Required',
|
||||
408: 'Request Time-out',
|
||||
409: 'Conflict',
|
||||
410: 'Gone',
|
||||
411: 'Length Required',
|
||||
412: 'Precondition Failed',
|
||||
413: 'Request Entity Too Large',
|
||||
414: 'Request-URI Too Large',
|
||||
415: 'Unsupported Media Type',
|
||||
416: 'Requested Range Not Satisfiable',
|
||||
417: 'Expectation Failed',
|
||||
418: 'I\'m a teapot', // RFC 2324
|
||||
422: 'Unprocessable Entity', // RFC 4918
|
||||
423: 'Locked', // RFC 4918
|
||||
424: 'Failed Dependency', // RFC 4918
|
||||
425: 'Unordered Collection', // RFC 4918
|
||||
426: 'Upgrade Required', // RFC 2817
|
||||
428: 'Precondition Required', // RFC 6585
|
||||
429: 'Too Many Requests', // RFC 6585
|
||||
431: 'Request Header Fields Too Large', // RFC 6585
|
||||
500: 'Internal Server Error',
|
||||
501: 'Not Implemented',
|
||||
502: 'Bad Gateway',
|
||||
503: 'Service Unavailable',
|
||||
504: 'Gateway Time-out',
|
||||
505: 'HTTP Version Not Supported',
|
||||
506: 'Variant Also Negotiates', // RFC 2295
|
||||
507: 'Insufficient Storage', // RFC 4918
|
||||
509: 'Bandwidth Limit Exceeded',
|
||||
510: 'Not Extended', // RFC 2774
|
||||
511: 'Network Authentication Required' // RFC 6585
|
||||
};
|
||||
|
||||
export default {
|
||||
request,
|
||||
get,
|
||||
Agent,
|
||||
METHODS,
|
||||
STATUS_CODES
|
||||
}
|
25
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/inherits.js
generated
vendored
Normal file
25
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/inherits.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
var inherits;
|
||||
if (typeof Object.create === 'function'){
|
||||
inherits = function inherits(ctor, superCtor) {
|
||||
// implementation from standard node.js 'util' module
|
||||
ctor.super_ = superCtor
|
||||
ctor.prototype = Object.create(superCtor.prototype, {
|
||||
constructor: {
|
||||
value: ctor,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
};
|
||||
} else {
|
||||
inherits = function inherits(ctor, superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
var TempCtor = function () {}
|
||||
TempCtor.prototype = superCtor.prototype
|
||||
ctor.prototype = new TempCtor()
|
||||
ctor.prototype.constructor = ctor
|
||||
}
|
||||
}
|
||||
export default inherits;
|
113
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/os.js
generated
vendored
Normal file
113
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/os.js
generated
vendored
Normal file
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 CoderPuppy
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
var _endianness;
|
||||
export function endianness() {
|
||||
if (typeof _endianness === 'undefined') {
|
||||
var a = new ArrayBuffer(2);
|
||||
var b = new Uint8Array(a);
|
||||
var c = new Uint16Array(a);
|
||||
b[0] = 1;
|
||||
b[1] = 2;
|
||||
if (c[0] === 258) {
|
||||
_endianness = 'BE';
|
||||
} else if (c[0] === 513){
|
||||
_endianness = 'LE';
|
||||
} else {
|
||||
throw new Error('unable to figure out endianess');
|
||||
}
|
||||
}
|
||||
return _endianness;
|
||||
}
|
||||
|
||||
export function hostname() {
|
||||
if (typeof global.location !== 'undefined') {
|
||||
return global.location.hostname
|
||||
} else return '';
|
||||
}
|
||||
|
||||
export function loadavg() {
|
||||
return [];
|
||||
}
|
||||
|
||||
export function uptime() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
export function freemem() {
|
||||
return Number.MAX_VALUE;
|
||||
}
|
||||
|
||||
export function totalmem() {
|
||||
return Number.MAX_VALUE;
|
||||
}
|
||||
|
||||
export function cpus() {
|
||||
return [];
|
||||
}
|
||||
|
||||
export function type() {
|
||||
return 'Browser';
|
||||
}
|
||||
|
||||
export function release () {
|
||||
if (typeof global.navigator !== 'undefined') {
|
||||
return global.navigator.appVersion;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
export function networkInterfaces(){}
|
||||
export function getNetworkInterfaces(){}
|
||||
|
||||
export function arch() {
|
||||
return 'javascript';
|
||||
}
|
||||
|
||||
export function platform() {
|
||||
return 'browser';
|
||||
}
|
||||
|
||||
export function tmpDir() {
|
||||
return '/tmp';
|
||||
}
|
||||
export var tmpdir = tmpDir;
|
||||
|
||||
export var EOL = '\n';
|
||||
export default {
|
||||
EOL: EOL,
|
||||
tmpdir: tmpdir,
|
||||
tmpDir: tmpDir,
|
||||
networkInterfaces:networkInterfaces,
|
||||
getNetworkInterfaces: getNetworkInterfaces,
|
||||
release: release,
|
||||
type: type,
|
||||
cpus: cpus,
|
||||
totalmem: totalmem,
|
||||
freemem: freemem,
|
||||
uptime: uptime,
|
||||
loadavg: loadavg,
|
||||
hostname: hostname,
|
||||
endianness: endianness,
|
||||
}
|
234
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/path.js
generated
vendored
Normal file
234
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/path.js
generated
vendored
Normal file
|
@ -0,0 +1,234 @@
|
|||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// resolves . and .. elements in a path array with directory names there
|
||||
// must be no slashes, empty elements, or device names (c:\) in the array
|
||||
// (so also no leading and trailing slashes - it does not distinguish
|
||||
// relative and absolute paths)
|
||||
function normalizeArray(parts, allowAboveRoot) {
|
||||
// if the path tries to go above the root, `up` ends up > 0
|
||||
var up = 0;
|
||||
for (var i = parts.length - 1; i >= 0; i--) {
|
||||
var last = parts[i];
|
||||
if (last === '.') {
|
||||
parts.splice(i, 1);
|
||||
} else if (last === '..') {
|
||||
parts.splice(i, 1);
|
||||
up++;
|
||||
} else if (up) {
|
||||
parts.splice(i, 1);
|
||||
up--;
|
||||
}
|
||||
}
|
||||
|
||||
// if the path is allowed to go above the root, restore leading ..s
|
||||
if (allowAboveRoot) {
|
||||
for (; up--; up) {
|
||||
parts.unshift('..');
|
||||
}
|
||||
}
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
// Split a filename into [root, dir, basename, ext], unix version
|
||||
// 'root' is just a slash, or nothing.
|
||||
var splitPathRe =
|
||||
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
||||
var splitPath = function(filename) {
|
||||
return splitPathRe.exec(filename).slice(1);
|
||||
};
|
||||
|
||||
// path.resolve([from ...], to)
|
||||
// posix version
|
||||
export function resolve() {
|
||||
var resolvedPath = '',
|
||||
resolvedAbsolute = false;
|
||||
|
||||
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
||||
var path = (i >= 0) ? arguments[i] : '/';
|
||||
|
||||
// Skip empty and invalid entries
|
||||
if (typeof path !== 'string') {
|
||||
throw new TypeError('Arguments to path.resolve must be strings');
|
||||
} else if (!path) {
|
||||
continue;
|
||||
}
|
||||
|
||||
resolvedPath = path + '/' + resolvedPath;
|
||||
resolvedAbsolute = path.charAt(0) === '/';
|
||||
}
|
||||
|
||||
// At this point the path should be resolved to a full absolute path, but
|
||||
// handle relative paths to be safe (might happen when process.cwd() fails)
|
||||
|
||||
// Normalize the path
|
||||
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
|
||||
return !!p;
|
||||
}), !resolvedAbsolute).join('/');
|
||||
|
||||
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
||||
};
|
||||
|
||||
// path.normalize(path)
|
||||
// posix version
|
||||
export function normalize(path) {
|
||||
var isPathAbsolute = isAbsolute(path),
|
||||
trailingSlash = substr(path, -1) === '/';
|
||||
|
||||
// Normalize the path
|
||||
path = normalizeArray(filter(path.split('/'), function(p) {
|
||||
return !!p;
|
||||
}), !isPathAbsolute).join('/');
|
||||
|
||||
if (!path && !isPathAbsolute) {
|
||||
path = '.';
|
||||
}
|
||||
if (path && trailingSlash) {
|
||||
path += '/';
|
||||
}
|
||||
|
||||
return (isPathAbsolute ? '/' : '') + path;
|
||||
};
|
||||
|
||||
// posix version
|
||||
export function isAbsolute(path) {
|
||||
return path.charAt(0) === '/';
|
||||
}
|
||||
|
||||
// posix version
|
||||
export function join() {
|
||||
var paths = Array.prototype.slice.call(arguments, 0);
|
||||
return normalize(filter(paths, function(p, index) {
|
||||
if (typeof p !== 'string') {
|
||||
throw new TypeError('Arguments to path.join must be strings');
|
||||
}
|
||||
return p;
|
||||
}).join('/'));
|
||||
}
|
||||
|
||||
|
||||
// path.relative(from, to)
|
||||
// posix version
|
||||
export function relative(from, to) {
|
||||
from = resolve(from).substr(1);
|
||||
to = resolve(to).substr(1);
|
||||
|
||||
function trim(arr) {
|
||||
var start = 0;
|
||||
for (; start < arr.length; start++) {
|
||||
if (arr[start] !== '') break;
|
||||
}
|
||||
|
||||
var end = arr.length - 1;
|
||||
for (; end >= 0; end--) {
|
||||
if (arr[end] !== '') break;
|
||||
}
|
||||
|
||||
if (start > end) return [];
|
||||
return arr.slice(start, end - start + 1);
|
||||
}
|
||||
|
||||
var fromParts = trim(from.split('/'));
|
||||
var toParts = trim(to.split('/'));
|
||||
|
||||
var length = Math.min(fromParts.length, toParts.length);
|
||||
var samePartsLength = length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (fromParts[i] !== toParts[i]) {
|
||||
samePartsLength = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var outputParts = [];
|
||||
for (var i = samePartsLength; i < fromParts.length; i++) {
|
||||
outputParts.push('..');
|
||||
}
|
||||
|
||||
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
||||
|
||||
return outputParts.join('/');
|
||||
}
|
||||
|
||||
export var sep = '/';
|
||||
export var delimiter = ':';
|
||||
|
||||
export function dirname(path) {
|
||||
var result = splitPath(path),
|
||||
root = result[0],
|
||||
dir = result[1];
|
||||
|
||||
if (!root && !dir) {
|
||||
// No dirname whatsoever
|
||||
return '.';
|
||||
}
|
||||
|
||||
if (dir) {
|
||||
// It has a dirname, strip trailing slash
|
||||
dir = dir.substr(0, dir.length - 1);
|
||||
}
|
||||
|
||||
return root + dir;
|
||||
}
|
||||
|
||||
export function basename(path, ext) {
|
||||
var f = splitPath(path)[2];
|
||||
// TODO: make this comparison case-insensitive on windows?
|
||||
if (ext && f.substr(-1 * ext.length) === ext) {
|
||||
f = f.substr(0, f.length - ext.length);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
export function extname(path) {
|
||||
return splitPath(path)[3];
|
||||
}
|
||||
export default {
|
||||
extname: extname,
|
||||
basename: basename,
|
||||
dirname: dirname,
|
||||
sep: sep,
|
||||
delimiter: delimiter,
|
||||
relative: relative,
|
||||
join: join,
|
||||
isAbsolute: isAbsolute,
|
||||
normalize: normalize,
|
||||
resolve: resolve
|
||||
};
|
||||
function filter (xs, f) {
|
||||
if (xs.filter) return xs.filter(f);
|
||||
var res = [];
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
if (f(xs[i], i, xs)) res.push(xs[i]);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// String.prototype.substr - negative index don't work in IE8
|
||||
var substr = 'ab'.substr(-1) === 'b' ?
|
||||
function (str, start, len) { return str.substr(start, len) } :
|
||||
function (str, start, len) {
|
||||
if (start < 0) start = str.length + start;
|
||||
return str.substr(start, len);
|
||||
}
|
||||
;
|
224
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/process-es6.js
generated
vendored
Normal file
224
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/process-es6.js
generated
vendored
Normal file
|
@ -0,0 +1,224 @@
|
|||
// shim for using process in browser
|
||||
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
|
||||
|
||||
function defaultSetTimout() {
|
||||
throw new Error('setTimeout has not been defined');
|
||||
}
|
||||
function defaultClearTimeout () {
|
||||
throw new Error('clearTimeout has not been defined');
|
||||
}
|
||||
var cachedSetTimeout = defaultSetTimout;
|
||||
var cachedClearTimeout = defaultClearTimeout;
|
||||
if (typeof global.setTimeout === 'function') {
|
||||
cachedSetTimeout = setTimeout;
|
||||
}
|
||||
if (typeof global.clearTimeout === 'function') {
|
||||
cachedClearTimeout = clearTimeout;
|
||||
}
|
||||
|
||||
function runTimeout(fun) {
|
||||
if (cachedSetTimeout === setTimeout) {
|
||||
//normal enviroments in sane situations
|
||||
return setTimeout(fun, 0);
|
||||
}
|
||||
// if setTimeout wasn't available but was latter defined
|
||||
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
||||
cachedSetTimeout = setTimeout;
|
||||
return setTimeout(fun, 0);
|
||||
}
|
||||
try {
|
||||
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||||
return cachedSetTimeout(fun, 0);
|
||||
} catch(e){
|
||||
try {
|
||||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||||
return cachedSetTimeout.call(null, fun, 0);
|
||||
} catch(e){
|
||||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
||||
return cachedSetTimeout.call(this, fun, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function runClearTimeout(marker) {
|
||||
if (cachedClearTimeout === clearTimeout) {
|
||||
//normal enviroments in sane situations
|
||||
return clearTimeout(marker);
|
||||
}
|
||||
// if clearTimeout wasn't available but was latter defined
|
||||
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
||||
cachedClearTimeout = clearTimeout;
|
||||
return clearTimeout(marker);
|
||||
}
|
||||
try {
|
||||
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||||
return cachedClearTimeout(marker);
|
||||
} catch (e){
|
||||
try {
|
||||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||||
return cachedClearTimeout.call(null, marker);
|
||||
} catch (e){
|
||||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
||||
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
||||
return cachedClearTimeout.call(this, marker);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
var queue = [];
|
||||
var draining = false;
|
||||
var currentQueue;
|
||||
var queueIndex = -1;
|
||||
|
||||
function cleanUpNextTick() {
|
||||
if (!draining || !currentQueue) {
|
||||
return;
|
||||
}
|
||||
draining = false;
|
||||
if (currentQueue.length) {
|
||||
queue = currentQueue.concat(queue);
|
||||
} else {
|
||||
queueIndex = -1;
|
||||
}
|
||||
if (queue.length) {
|
||||
drainQueue();
|
||||
}
|
||||
}
|
||||
|
||||
function drainQueue() {
|
||||
if (draining) {
|
||||
return;
|
||||
}
|
||||
var timeout = runTimeout(cleanUpNextTick);
|
||||
draining = true;
|
||||
|
||||
var len = queue.length;
|
||||
while(len) {
|
||||
currentQueue = queue;
|
||||
queue = [];
|
||||
while (++queueIndex < len) {
|
||||
if (currentQueue) {
|
||||
currentQueue[queueIndex].run();
|
||||
}
|
||||
}
|
||||
queueIndex = -1;
|
||||
len = queue.length;
|
||||
}
|
||||
currentQueue = null;
|
||||
draining = false;
|
||||
runClearTimeout(timeout);
|
||||
}
|
||||
function nextTick(fun) {
|
||||
var args = new Array(arguments.length - 1);
|
||||
if (arguments.length > 1) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
args[i - 1] = arguments[i];
|
||||
}
|
||||
}
|
||||
queue.push(new Item(fun, args));
|
||||
if (queue.length === 1 && !draining) {
|
||||
runTimeout(drainQueue);
|
||||
}
|
||||
}
|
||||
// v8 likes predictible objects
|
||||
function Item(fun, array) {
|
||||
this.fun = fun;
|
||||
this.array = array;
|
||||
}
|
||||
Item.prototype.run = function () {
|
||||
this.fun.apply(null, this.array);
|
||||
};
|
||||
var title = 'browser';
|
||||
var platform = 'browser';
|
||||
var browser = true;
|
||||
var env = {};
|
||||
var argv = [];
|
||||
var version = ''; // empty string to avoid regexp issues
|
||||
var versions = {};
|
||||
var release = {};
|
||||
var config = {};
|
||||
|
||||
function noop() {}
|
||||
|
||||
var on = noop;
|
||||
var addListener = noop;
|
||||
var once = noop;
|
||||
var off = noop;
|
||||
var removeListener = noop;
|
||||
var removeAllListeners = noop;
|
||||
var emit = noop;
|
||||
|
||||
function binding(name) {
|
||||
throw new Error('process.binding is not supported');
|
||||
}
|
||||
|
||||
function cwd () { return '/' }
|
||||
function chdir (dir) {
|
||||
throw new Error('process.chdir is not supported');
|
||||
}function umask() { return 0; }
|
||||
|
||||
// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
|
||||
var performance = global.performance || {};
|
||||
var performanceNow =
|
||||
performance.now ||
|
||||
performance.mozNow ||
|
||||
performance.msNow ||
|
||||
performance.oNow ||
|
||||
performance.webkitNow ||
|
||||
function(){ return (new Date()).getTime() };
|
||||
|
||||
// generate timestamp or delta
|
||||
// see http://nodejs.org/api/process.html#process_process_hrtime
|
||||
function hrtime(previousTimestamp){
|
||||
var clocktime = performanceNow.call(performance)*1e-3;
|
||||
var seconds = Math.floor(clocktime);
|
||||
var nanoseconds = Math.floor((clocktime%1)*1e9);
|
||||
if (previousTimestamp) {
|
||||
seconds = seconds - previousTimestamp[0];
|
||||
nanoseconds = nanoseconds - previousTimestamp[1];
|
||||
if (nanoseconds<0) {
|
||||
seconds--;
|
||||
nanoseconds += 1e9;
|
||||
}
|
||||
}
|
||||
return [seconds,nanoseconds]
|
||||
}
|
||||
|
||||
var startTime = new Date();
|
||||
function uptime() {
|
||||
var currentTime = new Date();
|
||||
var dif = currentTime - startTime;
|
||||
return dif / 1000;
|
||||
}
|
||||
|
||||
var browser$1 = {
|
||||
nextTick: nextTick,
|
||||
title: title,
|
||||
browser: browser,
|
||||
env: env,
|
||||
argv: argv,
|
||||
version: version,
|
||||
versions: versions,
|
||||
on: on,
|
||||
addListener: addListener,
|
||||
once: once,
|
||||
off: off,
|
||||
removeListener: removeListener,
|
||||
removeAllListeners: removeAllListeners,
|
||||
emit: emit,
|
||||
binding: binding,
|
||||
cwd: cwd,
|
||||
chdir: chdir,
|
||||
umask: umask,
|
||||
hrtime: hrtime,
|
||||
platform: platform,
|
||||
release: release,
|
||||
config: config,
|
||||
uptime: uptime
|
||||
};
|
||||
|
||||
export default browser$1;
|
||||
export { addListener, argv, binding, browser, chdir, config, cwd, emit, env, hrtime, nextTick, off, on, once, platform, release, removeAllListeners, removeListener, title, umask, uptime, version, versions };
|
475
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/punycode.js
generated
vendored
Normal file
475
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/punycode.js
generated
vendored
Normal file
|
@ -0,0 +1,475 @@
|
|||
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
||||
|
||||
|
||||
/** Highest positive signed 32-bit float value */
|
||||
var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
|
||||
|
||||
/** Bootstring parameters */
|
||||
var base = 36;
|
||||
var tMin = 1;
|
||||
var tMax = 26;
|
||||
var skew = 38;
|
||||
var damp = 700;
|
||||
var initialBias = 72;
|
||||
var initialN = 128; // 0x80
|
||||
var delimiter = '-'; // '\x2D'
|
||||
|
||||
/** Regular expressions */
|
||||
var regexPunycode = /^xn--/;
|
||||
var regexNonASCII = /[^\x20-\x7E]/; // unprintable ASCII chars + non-ASCII chars
|
||||
var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
|
||||
|
||||
/** Error messages */
|
||||
var errors = {
|
||||
'overflow': 'Overflow: input needs wider integers to process',
|
||||
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
||||
'invalid-input': 'Invalid input'
|
||||
};
|
||||
|
||||
/** Convenience shortcuts */
|
||||
var baseMinusTMin = base - tMin;
|
||||
var floor = Math.floor;
|
||||
var stringFromCharCode = String.fromCharCode;
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* A generic error utility function.
|
||||
* @private
|
||||
* @param {String} type The error type.
|
||||
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
||||
*/
|
||||
function error(type) {
|
||||
throw new RangeError(errors[type]);
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic `Array#map` utility function.
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Function} callback The function that gets called for every array
|
||||
* item.
|
||||
* @returns {Array} A new array of values returned by the callback function.
|
||||
*/
|
||||
function map(array, fn) {
|
||||
var length = array.length;
|
||||
var result = [];
|
||||
while (length--) {
|
||||
result[length] = fn(array[length]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
||||
* addresses.
|
||||
* @private
|
||||
* @param {String} domain The domain name or email address.
|
||||
* @param {Function} callback The function that gets called for every
|
||||
* character.
|
||||
* @returns {Array} A new string of characters returned by the callback
|
||||
* function.
|
||||
*/
|
||||
function mapDomain(string, fn) {
|
||||
var parts = string.split('@');
|
||||
var result = '';
|
||||
if (parts.length > 1) {
|
||||
// In email addresses, only the domain name should be punycoded. Leave
|
||||
// the local part (i.e. everything up to `@`) intact.
|
||||
result = parts[0] + '@';
|
||||
string = parts[1];
|
||||
}
|
||||
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
||||
string = string.replace(regexSeparators, '\x2E');
|
||||
var labels = string.split('.');
|
||||
var encoded = map(labels, fn).join('.');
|
||||
return result + encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array containing the numeric code points of each Unicode
|
||||
* character in the string. While JavaScript uses UCS-2 internally,
|
||||
* this function will convert a pair of surrogate halves (each of which
|
||||
* UCS-2 exposes as separate characters) into a single code point,
|
||||
* matching UTF-16.
|
||||
* @see `punycode.ucs2.encode`
|
||||
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||||
* @memberOf punycode.ucs2
|
||||
* @name decode
|
||||
* @param {String} string The Unicode input string (UCS-2).
|
||||
* @returns {Array} The new array of code points.
|
||||
*/
|
||||
function ucs2decode(string) {
|
||||
var output = [],
|
||||
counter = 0,
|
||||
length = string.length,
|
||||
value,
|
||||
extra;
|
||||
while (counter < length) {
|
||||
value = string.charCodeAt(counter++);
|
||||
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
||||
// high surrogate, and there is a next character
|
||||
extra = string.charCodeAt(counter++);
|
||||
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
|
||||
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
||||
} else {
|
||||
// unmatched surrogate; only append this code unit, in case the next
|
||||
// code unit is the high surrogate of a surrogate pair
|
||||
output.push(value);
|
||||
counter--;
|
||||
}
|
||||
} else {
|
||||
output.push(value);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string based on an array of numeric code points.
|
||||
* @see `punycode.ucs2.decode`
|
||||
* @memberOf punycode.ucs2
|
||||
* @name encode
|
||||
* @param {Array} codePoints The array of numeric code points.
|
||||
* @returns {String} The new Unicode string (UCS-2).
|
||||
*/
|
||||
function ucs2encode(array) {
|
||||
return map(array, function(value) {
|
||||
var output = '';
|
||||
if (value > 0xFFFF) {
|
||||
value -= 0x10000;
|
||||
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
||||
value = 0xDC00 | value & 0x3FF;
|
||||
}
|
||||
output += stringFromCharCode(value);
|
||||
return output;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a basic code point into a digit/integer.
|
||||
* @see `digitToBasic()`
|
||||
* @private
|
||||
* @param {Number} codePoint The basic numeric code point value.
|
||||
* @returns {Number} The numeric value of a basic code point (for use in
|
||||
* representing integers) in the range `0` to `base - 1`, or `base` if
|
||||
* the code point does not represent a value.
|
||||
*/
|
||||
function basicToDigit(codePoint) {
|
||||
if (codePoint - 48 < 10) {
|
||||
return codePoint - 22;
|
||||
}
|
||||
if (codePoint - 65 < 26) {
|
||||
return codePoint - 65;
|
||||
}
|
||||
if (codePoint - 97 < 26) {
|
||||
return codePoint - 97;
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a digit/integer into a basic code point.
|
||||
* @see `basicToDigit()`
|
||||
* @private
|
||||
* @param {Number} digit The numeric value of a basic code point.
|
||||
* @returns {Number} The basic code point whose value (when used for
|
||||
* representing integers) is `digit`, which needs to be in the range
|
||||
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
||||
* used; else, the lowercase form is used. The behavior is undefined
|
||||
* if `flag` is non-zero and `digit` has no uppercase form.
|
||||
*/
|
||||
function digitToBasic(digit, flag) {
|
||||
// 0..25 map to ASCII a..z or A..Z
|
||||
// 26..35 map to ASCII 0..9
|
||||
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bias adaptation function as per section 3.4 of RFC 3492.
|
||||
* https://tools.ietf.org/html/rfc3492#section-3.4
|
||||
* @private
|
||||
*/
|
||||
function adapt(delta, numPoints, firstTime) {
|
||||
var k = 0;
|
||||
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
||||
delta += floor(delta / numPoints);
|
||||
for ( /* no initialization */ ; delta > baseMinusTMin * tMax >> 1; k += base) {
|
||||
delta = floor(delta / baseMinusTMin);
|
||||
}
|
||||
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
||||
* symbols.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The Punycode string of ASCII-only symbols.
|
||||
* @returns {String} The resulting string of Unicode symbols.
|
||||
*/
|
||||
export function decode(input) {
|
||||
// Don't use UCS-2
|
||||
var output = [],
|
||||
inputLength = input.length,
|
||||
out,
|
||||
i = 0,
|
||||
n = initialN,
|
||||
bias = initialBias,
|
||||
basic,
|
||||
j,
|
||||
index,
|
||||
oldi,
|
||||
w,
|
||||
k,
|
||||
digit,
|
||||
t,
|
||||
/** Cached calculation results */
|
||||
baseMinusT;
|
||||
|
||||
// Handle the basic code points: let `basic` be the number of input code
|
||||
// points before the last delimiter, or `0` if there is none, then copy
|
||||
// the first basic code points to the output.
|
||||
|
||||
basic = input.lastIndexOf(delimiter);
|
||||
if (basic < 0) {
|
||||
basic = 0;
|
||||
}
|
||||
|
||||
for (j = 0; j < basic; ++j) {
|
||||
// if it's not a basic code point
|
||||
if (input.charCodeAt(j) >= 0x80) {
|
||||
error('not-basic');
|
||||
}
|
||||
output.push(input.charCodeAt(j));
|
||||
}
|
||||
|
||||
// Main decoding loop: start just after the last delimiter if any basic code
|
||||
// points were copied; start at the beginning otherwise.
|
||||
|
||||
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */ ) {
|
||||
|
||||
// `index` is the index of the next character to be consumed.
|
||||
// Decode a generalized variable-length integer into `delta`,
|
||||
// which gets added to `i`. The overflow checking is easier
|
||||
// if we increase `i` as we go, then subtract off its starting
|
||||
// value at the end to obtain `delta`.
|
||||
for (oldi = i, w = 1, k = base; /* no condition */ ; k += base) {
|
||||
|
||||
if (index >= inputLength) {
|
||||
error('invalid-input');
|
||||
}
|
||||
|
||||
digit = basicToDigit(input.charCodeAt(index++));
|
||||
|
||||
if (digit >= base || digit > floor((maxInt - i) / w)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
i += digit * w;
|
||||
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
|
||||
if (digit < t) {
|
||||
break;
|
||||
}
|
||||
|
||||
baseMinusT = base - t;
|
||||
if (w > floor(maxInt / baseMinusT)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
w *= baseMinusT;
|
||||
|
||||
}
|
||||
|
||||
out = output.length + 1;
|
||||
bias = adapt(i - oldi, out, oldi == 0);
|
||||
|
||||
// `i` was supposed to wrap around from `out` to `0`,
|
||||
// incrementing `n` each time, so we'll fix that now:
|
||||
if (floor(i / out) > maxInt - n) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
n += floor(i / out);
|
||||
i %= out;
|
||||
|
||||
// Insert `n` at position `i` of the output
|
||||
output.splice(i++, 0, n);
|
||||
|
||||
}
|
||||
|
||||
return ucs2encode(output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
||||
* Punycode string of ASCII-only symbols.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The string of Unicode symbols.
|
||||
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
||||
*/
|
||||
export function encode(input) {
|
||||
var n,
|
||||
delta,
|
||||
handledCPCount,
|
||||
basicLength,
|
||||
bias,
|
||||
j,
|
||||
m,
|
||||
q,
|
||||
k,
|
||||
t,
|
||||
currentValue,
|
||||
output = [],
|
||||
/** `inputLength` will hold the number of code points in `input`. */
|
||||
inputLength,
|
||||
/** Cached calculation results */
|
||||
handledCPCountPlusOne,
|
||||
baseMinusT,
|
||||
qMinusT;
|
||||
|
||||
// Convert the input in UCS-2 to Unicode
|
||||
input = ucs2decode(input);
|
||||
|
||||
// Cache the length
|
||||
inputLength = input.length;
|
||||
|
||||
// Initialize the state
|
||||
n = initialN;
|
||||
delta = 0;
|
||||
bias = initialBias;
|
||||
|
||||
// Handle the basic code points
|
||||
for (j = 0; j < inputLength; ++j) {
|
||||
currentValue = input[j];
|
||||
if (currentValue < 0x80) {
|
||||
output.push(stringFromCharCode(currentValue));
|
||||
}
|
||||
}
|
||||
|
||||
handledCPCount = basicLength = output.length;
|
||||
|
||||
// `handledCPCount` is the number of code points that have been handled;
|
||||
// `basicLength` is the number of basic code points.
|
||||
|
||||
// Finish the basic string - if it is not empty - with a delimiter
|
||||
if (basicLength) {
|
||||
output.push(delimiter);
|
||||
}
|
||||
|
||||
// Main encoding loop:
|
||||
while (handledCPCount < inputLength) {
|
||||
|
||||
// All non-basic code points < n have been handled already. Find the next
|
||||
// larger one:
|
||||
for (m = maxInt, j = 0; j < inputLength; ++j) {
|
||||
currentValue = input[j];
|
||||
if (currentValue >= n && currentValue < m) {
|
||||
m = currentValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
||||
// but guard against overflow
|
||||
handledCPCountPlusOne = handledCPCount + 1;
|
||||
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
delta += (m - n) * handledCPCountPlusOne;
|
||||
n = m;
|
||||
|
||||
for (j = 0; j < inputLength; ++j) {
|
||||
currentValue = input[j];
|
||||
|
||||
if (currentValue < n && ++delta > maxInt) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
if (currentValue == n) {
|
||||
// Represent delta as a generalized variable-length integer
|
||||
for (q = delta, k = base; /* no condition */ ; k += base) {
|
||||
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
if (q < t) {
|
||||
break;
|
||||
}
|
||||
qMinusT = q - t;
|
||||
baseMinusT = base - t;
|
||||
output.push(
|
||||
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
||||
);
|
||||
q = floor(qMinusT / baseMinusT);
|
||||
}
|
||||
|
||||
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
||||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
||||
delta = 0;
|
||||
++handledCPCount;
|
||||
}
|
||||
}
|
||||
|
||||
++delta;
|
||||
++n;
|
||||
|
||||
}
|
||||
return output.join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Punycode string representing a domain name or an email address
|
||||
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
||||
* it doesn't matter if you call it on a string that has already been
|
||||
* converted to Unicode.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The Punycoded domain name or email address to
|
||||
* convert to Unicode.
|
||||
* @returns {String} The Unicode representation of the given Punycode
|
||||
* string.
|
||||
*/
|
||||
export function toUnicode(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexPunycode.test(string) ?
|
||||
decode(string.slice(4).toLowerCase()) :
|
||||
string;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Unicode string representing a domain name or an email address to
|
||||
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
||||
* i.e. it doesn't matter if you call it with a domain that's already in
|
||||
* ASCII.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The domain name or email address to convert, as a
|
||||
* Unicode string.
|
||||
* @returns {String} The Punycode representation of the given domain name or
|
||||
* email address.
|
||||
*/
|
||||
export function toASCII(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexNonASCII.test(string) ?
|
||||
'xn--' + encode(string) :
|
||||
string;
|
||||
});
|
||||
}
|
||||
export var version = '1.4.1';
|
||||
/**
|
||||
* An object of methods to convert from JavaScript's internal character
|
||||
* representation (UCS-2) to Unicode code points, and back.
|
||||
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||||
* @memberOf punycode
|
||||
* @type Object
|
||||
*/
|
||||
|
||||
export var ucs2 = {
|
||||
decode: ucs2decode,
|
||||
encode: ucs2encode
|
||||
};
|
||||
export default {
|
||||
version: version,
|
||||
ucs2: ucs2,
|
||||
toASCII: toASCII,
|
||||
toUnicode: toUnicode,
|
||||
encode: encode,
|
||||
decode: decode
|
||||
}
|
147
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/qs.js
generated
vendored
Normal file
147
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/qs.js
generated
vendored
Normal file
|
@ -0,0 +1,147 @@
|
|||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
|
||||
// If obj.hasOwnProperty has been overridden, then calling
|
||||
// obj.hasOwnProperty(prop) will break.
|
||||
// See: https://github.com/joyent/node/issues/1707
|
||||
function hasOwnProperty(obj, prop) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
}
|
||||
var isArray = Array.isArray || function (xs) {
|
||||
return Object.prototype.toString.call(xs) === '[object Array]';
|
||||
};
|
||||
function stringifyPrimitive(v) {
|
||||
switch (typeof v) {
|
||||
case 'string':
|
||||
return v;
|
||||
|
||||
case 'boolean':
|
||||
return v ? 'true' : 'false';
|
||||
|
||||
case 'number':
|
||||
return isFinite(v) ? v : '';
|
||||
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
export function stringify (obj, sep, eq, name) {
|
||||
sep = sep || '&';
|
||||
eq = eq || '=';
|
||||
if (obj === null) {
|
||||
obj = undefined;
|
||||
}
|
||||
|
||||
if (typeof obj === 'object') {
|
||||
return map(objectKeys(obj), function(k) {
|
||||
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
||||
if (isArray(obj[k])) {
|
||||
return map(obj[k], function(v) {
|
||||
return ks + encodeURIComponent(stringifyPrimitive(v));
|
||||
}).join(sep);
|
||||
} else {
|
||||
return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
|
||||
}
|
||||
}).join(sep);
|
||||
|
||||
}
|
||||
|
||||
if (!name) return '';
|
||||
return encodeURIComponent(stringifyPrimitive(name)) + eq +
|
||||
encodeURIComponent(stringifyPrimitive(obj));
|
||||
};
|
||||
|
||||
function map (xs, f) {
|
||||
if (xs.map) return xs.map(f);
|
||||
var res = [];
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
res.push(f(xs[i], i));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
var objectKeys = Object.keys || function (obj) {
|
||||
var res = [];
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
export function parse(qs, sep, eq, options) {
|
||||
sep = sep || '&';
|
||||
eq = eq || '=';
|
||||
var obj = {};
|
||||
|
||||
if (typeof qs !== 'string' || qs.length === 0) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
var regexp = /\+/g;
|
||||
qs = qs.split(sep);
|
||||
|
||||
var maxKeys = 1000;
|
||||
if (options && typeof options.maxKeys === 'number') {
|
||||
maxKeys = options.maxKeys;
|
||||
}
|
||||
|
||||
var len = qs.length;
|
||||
// maxKeys <= 0 means that we should not limit keys count
|
||||
if (maxKeys > 0 && len > maxKeys) {
|
||||
len = maxKeys;
|
||||
}
|
||||
|
||||
for (var i = 0; i < len; ++i) {
|
||||
var x = qs[i].replace(regexp, '%20'),
|
||||
idx = x.indexOf(eq),
|
||||
kstr, vstr, k, v;
|
||||
|
||||
if (idx >= 0) {
|
||||
kstr = x.substr(0, idx);
|
||||
vstr = x.substr(idx + 1);
|
||||
} else {
|
||||
kstr = x;
|
||||
vstr = '';
|
||||
}
|
||||
|
||||
k = decodeURIComponent(kstr);
|
||||
v = decodeURIComponent(vstr);
|
||||
|
||||
if (!hasOwnProperty(obj, k)) {
|
||||
obj[k] = v;
|
||||
} else if (isArray(obj[k])) {
|
||||
obj[k].push(v);
|
||||
} else {
|
||||
obj[k] = [obj[k], v];
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
export default {
|
||||
encode: stringify,
|
||||
stringify: stringify,
|
||||
decode: parse,
|
||||
parse: parse
|
||||
}
|
||||
export {stringify as encode, parse as decode};
|
59
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/readable-stream/buffer-list.js
generated
vendored
Normal file
59
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/readable-stream/buffer-list.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
import {Buffer} from 'buffer';
|
||||
|
||||
export default BufferList;
|
||||
|
||||
function BufferList() {
|
||||
this.head = null;
|
||||
this.tail = null;
|
||||
this.length = 0;
|
||||
}
|
||||
|
||||
BufferList.prototype.push = function (v) {
|
||||
var entry = { data: v, next: null };
|
||||
if (this.length > 0) this.tail.next = entry;else this.head = entry;
|
||||
this.tail = entry;
|
||||
++this.length;
|
||||
};
|
||||
|
||||
BufferList.prototype.unshift = function (v) {
|
||||
var entry = { data: v, next: this.head };
|
||||
if (this.length === 0) this.tail = entry;
|
||||
this.head = entry;
|
||||
++this.length;
|
||||
};
|
||||
|
||||
BufferList.prototype.shift = function () {
|
||||
if (this.length === 0) return;
|
||||
var ret = this.head.data;
|
||||
if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
|
||||
--this.length;
|
||||
return ret;
|
||||
};
|
||||
|
||||
BufferList.prototype.clear = function () {
|
||||
this.head = this.tail = null;
|
||||
this.length = 0;
|
||||
};
|
||||
|
||||
BufferList.prototype.join = function (s) {
|
||||
if (this.length === 0) return '';
|
||||
var p = this.head;
|
||||
var ret = '' + p.data;
|
||||
while (p = p.next) {
|
||||
ret += s + p.data;
|
||||
}return ret;
|
||||
};
|
||||
|
||||
BufferList.prototype.concat = function (n) {
|
||||
if (this.length === 0) return Buffer.alloc(0);
|
||||
if (this.length === 1) return this.head.data;
|
||||
var ret = Buffer.allocUnsafe(n >>> 0);
|
||||
var p = this.head;
|
||||
var i = 0;
|
||||
while (p) {
|
||||
p.data.copy(ret, i);
|
||||
i += p.data.length;
|
||||
p = p.next;
|
||||
}
|
||||
return ret;
|
||||
};
|
45
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/readable-stream/duplex.js
generated
vendored
Normal file
45
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/readable-stream/duplex.js
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
|
||||
import {inherits} from 'util';
|
||||
import {nextTick} from 'process';
|
||||
import {Readable} from './readable';
|
||||
import {Writable} from './writable';
|
||||
|
||||
|
||||
inherits(Duplex, Readable);
|
||||
|
||||
var keys = Object.keys(Writable.prototype);
|
||||
for (var v = 0; v < keys.length; v++) {
|
||||
var method = keys[v];
|
||||
if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
|
||||
}
|
||||
export default Duplex;
|
||||
export function Duplex(options) {
|
||||
if (!(this instanceof Duplex)) return new Duplex(options);
|
||||
|
||||
Readable.call(this, options);
|
||||
Writable.call(this, options);
|
||||
|
||||
if (options && options.readable === false) this.readable = false;
|
||||
|
||||
if (options && options.writable === false) this.writable = false;
|
||||
|
||||
this.allowHalfOpen = true;
|
||||
if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
|
||||
|
||||
this.once('end', onend);
|
||||
}
|
||||
|
||||
// the no-half-open enforcer
|
||||
function onend() {
|
||||
// if we allow half-open state, or if the writable side ended,
|
||||
// then we're ok.
|
||||
if (this.allowHalfOpen || this._writableState.ended) return;
|
||||
|
||||
// no more data can be written.
|
||||
// But allow more writes to happen in this tick.
|
||||
nextTick(onEndNT, this);
|
||||
}
|
||||
|
||||
function onEndNT(self) {
|
||||
self.end();
|
||||
}
|
15
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/readable-stream/passthrough.js
generated
vendored
Normal file
15
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/readable-stream/passthrough.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
import {Transform} from './transform';
|
||||
|
||||
import {inherits} from 'util';
|
||||
inherits(PassThrough, Transform);
|
||||
export default PassThrough;
|
||||
export function PassThrough(options) {
|
||||
if (!(this instanceof PassThrough)) return new PassThrough(options);
|
||||
|
||||
Transform.call(this, options);
|
||||
}
|
||||
|
||||
PassThrough.prototype._transform = function (chunk, encoding, cb) {
|
||||
cb(null, chunk);
|
||||
};
|
896
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/readable-stream/readable.js
generated
vendored
Normal file
896
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/readable-stream/readable.js
generated
vendored
Normal file
|
@ -0,0 +1,896 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
Readable.ReadableState = ReadableState;
|
||||
import EventEmitter from 'events';
|
||||
import {inherits, debuglog} from 'util';
|
||||
import BufferList from './buffer-list';
|
||||
import {StringDecoder} from 'string_decoder';
|
||||
import {Duplex} from './duplex';
|
||||
import {nextTick} from 'process';
|
||||
|
||||
var debug = debuglog('stream');
|
||||
inherits(Readable, EventEmitter);
|
||||
|
||||
function prependListener(emitter, event, fn) {
|
||||
// Sadly this is not cacheable as some libraries bundle their own
|
||||
// event emitter implementation with them.
|
||||
if (typeof emitter.prependListener === 'function') {
|
||||
return emitter.prependListener(event, fn);
|
||||
} else {
|
||||
// This is a hack to make sure that our error handler is attached before any
|
||||
// userland ones. NEVER DO THIS. This is here only because this code needs
|
||||
// to continue to work with older versions of Node.js that do not include
|
||||
// the prependListener() method. The goal is to eventually remove this hack.
|
||||
if (!emitter._events || !emitter._events[event])
|
||||
emitter.on(event, fn);
|
||||
else if (Array.isArray(emitter._events[event]))
|
||||
emitter._events[event].unshift(fn);
|
||||
else
|
||||
emitter._events[event] = [fn, emitter._events[event]];
|
||||
}
|
||||
}
|
||||
function listenerCount (emitter, type) {
|
||||
return emitter.listeners(type).length;
|
||||
}
|
||||
function ReadableState(options, stream) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
// object stream flag. Used to make read(n) ignore n and to
|
||||
// make all the buffer merging and length checks go away
|
||||
this.objectMode = !!options.objectMode;
|
||||
|
||||
if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
|
||||
|
||||
// the point at which it stops calling _read() to fill the buffer
|
||||
// Note: 0 is a valid value, means "don't call _read preemptively ever"
|
||||
var hwm = options.highWaterMark;
|
||||
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
||||
this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
|
||||
|
||||
// cast to ints.
|
||||
this.highWaterMark = ~ ~this.highWaterMark;
|
||||
|
||||
// A linked list is used to store data chunks instead of an array because the
|
||||
// linked list can remove elements from the beginning faster than
|
||||
// array.shift()
|
||||
this.buffer = new BufferList();
|
||||
this.length = 0;
|
||||
this.pipes = null;
|
||||
this.pipesCount = 0;
|
||||
this.flowing = null;
|
||||
this.ended = false;
|
||||
this.endEmitted = false;
|
||||
this.reading = false;
|
||||
|
||||
// a flag to be able to tell if the onwrite cb is called immediately,
|
||||
// or on a later tick. We set this to true at first, because any
|
||||
// actions that shouldn't happen until "later" should generally also
|
||||
// not happen before the first write call.
|
||||
this.sync = true;
|
||||
|
||||
// whenever we return null, then we set a flag to say
|
||||
// that we're awaiting a 'readable' event emission.
|
||||
this.needReadable = false;
|
||||
this.emittedReadable = false;
|
||||
this.readableListening = false;
|
||||
this.resumeScheduled = false;
|
||||
|
||||
// Crypto is kind of old and crusty. Historically, its default string
|
||||
// encoding is 'binary' so we have to make this configurable.
|
||||
// Everything else in the universe uses 'utf8', though.
|
||||
this.defaultEncoding = options.defaultEncoding || 'utf8';
|
||||
|
||||
// when piping, we only care about 'readable' events that happen
|
||||
// after read()ing all the bytes and not getting any pushback.
|
||||
this.ranOut = false;
|
||||
|
||||
// the number of writers that are awaiting a drain event in .pipe()s
|
||||
this.awaitDrain = 0;
|
||||
|
||||
// if true, a maybeReadMore has been scheduled
|
||||
this.readingMore = false;
|
||||
|
||||
this.decoder = null;
|
||||
this.encoding = null;
|
||||
if (options.encoding) {
|
||||
this.decoder = new StringDecoder(options.encoding);
|
||||
this.encoding = options.encoding;
|
||||
}
|
||||
}
|
||||
export default Readable;
|
||||
export function Readable(options) {
|
||||
|
||||
if (!(this instanceof Readable)) return new Readable(options);
|
||||
|
||||
this._readableState = new ReadableState(options, this);
|
||||
|
||||
// legacy
|
||||
this.readable = true;
|
||||
|
||||
if (options && typeof options.read === 'function') this._read = options.read;
|
||||
|
||||
EventEmitter.call(this);
|
||||
}
|
||||
|
||||
// Manually shove something into the read() buffer.
|
||||
// This returns true if the highWaterMark has not been hit yet,
|
||||
// similar to how Writable.write() returns true if you should
|
||||
// write() some more.
|
||||
Readable.prototype.push = function (chunk, encoding) {
|
||||
var state = this._readableState;
|
||||
|
||||
if (!state.objectMode && typeof chunk === 'string') {
|
||||
encoding = encoding || state.defaultEncoding;
|
||||
if (encoding !== state.encoding) {
|
||||
chunk = Buffer.from(chunk, encoding);
|
||||
encoding = '';
|
||||
}
|
||||
}
|
||||
|
||||
return readableAddChunk(this, state, chunk, encoding, false);
|
||||
};
|
||||
|
||||
// Unshift should *always* be something directly out of read()
|
||||
Readable.prototype.unshift = function (chunk) {
|
||||
var state = this._readableState;
|
||||
return readableAddChunk(this, state, chunk, '', true);
|
||||
};
|
||||
|
||||
Readable.prototype.isPaused = function () {
|
||||
return this._readableState.flowing === false;
|
||||
};
|
||||
|
||||
function readableAddChunk(stream, state, chunk, encoding, addToFront) {
|
||||
var er = chunkInvalid(state, chunk);
|
||||
if (er) {
|
||||
stream.emit('error', er);
|
||||
} else if (chunk === null) {
|
||||
state.reading = false;
|
||||
onEofChunk(stream, state);
|
||||
} else if (state.objectMode || chunk && chunk.length > 0) {
|
||||
if (state.ended && !addToFront) {
|
||||
var e = new Error('stream.push() after EOF');
|
||||
stream.emit('error', e);
|
||||
} else if (state.endEmitted && addToFront) {
|
||||
var _e = new Error('stream.unshift() after end event');
|
||||
stream.emit('error', _e);
|
||||
} else {
|
||||
var skipAdd;
|
||||
if (state.decoder && !addToFront && !encoding) {
|
||||
chunk = state.decoder.write(chunk);
|
||||
skipAdd = !state.objectMode && chunk.length === 0;
|
||||
}
|
||||
|
||||
if (!addToFront) state.reading = false;
|
||||
|
||||
// Don't add to the buffer if we've decoded to an empty string chunk and
|
||||
// we're not in object mode
|
||||
if (!skipAdd) {
|
||||
// if we want the data now, just emit it.
|
||||
if (state.flowing && state.length === 0 && !state.sync) {
|
||||
stream.emit('data', chunk);
|
||||
stream.read(0);
|
||||
} else {
|
||||
// update the buffer info.
|
||||
state.length += state.objectMode ? 1 : chunk.length;
|
||||
if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
|
||||
|
||||
if (state.needReadable) emitReadable(stream);
|
||||
}
|
||||
}
|
||||
|
||||
maybeReadMore(stream, state);
|
||||
}
|
||||
} else if (!addToFront) {
|
||||
state.reading = false;
|
||||
}
|
||||
|
||||
return needMoreData(state);
|
||||
}
|
||||
|
||||
// if it's past the high water mark, we can push in some more.
|
||||
// Also, if we have no data yet, we can stand some
|
||||
// more bytes. This is to work around cases where hwm=0,
|
||||
// such as the repl. Also, if the push() triggered a
|
||||
// readable event, and the user called read(largeNumber) such that
|
||||
// needReadable was set, then we ought to push more, so that another
|
||||
// 'readable' event will be triggered.
|
||||
function needMoreData(state) {
|
||||
return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
|
||||
}
|
||||
|
||||
// backwards compatibility.
|
||||
Readable.prototype.setEncoding = function (enc) {
|
||||
this._readableState.decoder = new StringDecoder(enc);
|
||||
this._readableState.encoding = enc;
|
||||
return this;
|
||||
};
|
||||
|
||||
// Don't raise the hwm > 8MB
|
||||
var MAX_HWM = 0x800000;
|
||||
function computeNewHighWaterMark(n) {
|
||||
if (n >= MAX_HWM) {
|
||||
n = MAX_HWM;
|
||||
} else {
|
||||
// Get the next highest power of 2 to prevent increasing hwm excessively in
|
||||
// tiny amounts
|
||||
n--;
|
||||
n |= n >>> 1;
|
||||
n |= n >>> 2;
|
||||
n |= n >>> 4;
|
||||
n |= n >>> 8;
|
||||
n |= n >>> 16;
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
// This function is designed to be inlinable, so please take care when making
|
||||
// changes to the function body.
|
||||
function howMuchToRead(n, state) {
|
||||
if (n <= 0 || state.length === 0 && state.ended) return 0;
|
||||
if (state.objectMode) return 1;
|
||||
if (n !== n) {
|
||||
// Only flow one buffer at a time
|
||||
if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
|
||||
}
|
||||
// If we're asking for more than the current hwm, then raise the hwm.
|
||||
if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
|
||||
if (n <= state.length) return n;
|
||||
// Don't have enough
|
||||
if (!state.ended) {
|
||||
state.needReadable = true;
|
||||
return 0;
|
||||
}
|
||||
return state.length;
|
||||
}
|
||||
|
||||
// you can override either this method, or the async _read(n) below.
|
||||
Readable.prototype.read = function (n) {
|
||||
debug('read', n);
|
||||
n = parseInt(n, 10);
|
||||
var state = this._readableState;
|
||||
var nOrig = n;
|
||||
|
||||
if (n !== 0) state.emittedReadable = false;
|
||||
|
||||
// if we're doing read(0) to trigger a readable event, but we
|
||||
// already have a bunch of data in the buffer, then just trigger
|
||||
// the 'readable' event and move on.
|
||||
if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
|
||||
debug('read: emitReadable', state.length, state.ended);
|
||||
if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
n = howMuchToRead(n, state);
|
||||
|
||||
// if we've ended, and we're now clear, then finish it up.
|
||||
if (n === 0 && state.ended) {
|
||||
if (state.length === 0) endReadable(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
// All the actual chunk generation logic needs to be
|
||||
// *below* the call to _read. The reason is that in certain
|
||||
// synthetic stream cases, such as passthrough streams, _read
|
||||
// may be a completely synchronous operation which may change
|
||||
// the state of the read buffer, providing enough data when
|
||||
// before there was *not* enough.
|
||||
//
|
||||
// So, the steps are:
|
||||
// 1. Figure out what the state of things will be after we do
|
||||
// a read from the buffer.
|
||||
//
|
||||
// 2. If that resulting state will trigger a _read, then call _read.
|
||||
// Note that this may be asynchronous, or synchronous. Yes, it is
|
||||
// deeply ugly to write APIs this way, but that still doesn't mean
|
||||
// that the Readable class should behave improperly, as streams are
|
||||
// designed to be sync/async agnostic.
|
||||
// Take note if the _read call is sync or async (ie, if the read call
|
||||
// has returned yet), so that we know whether or not it's safe to emit
|
||||
// 'readable' etc.
|
||||
//
|
||||
// 3. Actually pull the requested chunks out of the buffer and return.
|
||||
|
||||
// if we need a readable event, then we need to do some reading.
|
||||
var doRead = state.needReadable;
|
||||
debug('need readable', doRead);
|
||||
|
||||
// if we currently have less than the highWaterMark, then also read some
|
||||
if (state.length === 0 || state.length - n < state.highWaterMark) {
|
||||
doRead = true;
|
||||
debug('length less than watermark', doRead);
|
||||
}
|
||||
|
||||
// however, if we've ended, then there's no point, and if we're already
|
||||
// reading, then it's unnecessary.
|
||||
if (state.ended || state.reading) {
|
||||
doRead = false;
|
||||
debug('reading or ended', doRead);
|
||||
} else if (doRead) {
|
||||
debug('do read');
|
||||
state.reading = true;
|
||||
state.sync = true;
|
||||
// if the length is currently zero, then we *need* a readable event.
|
||||
if (state.length === 0) state.needReadable = true;
|
||||
// call internal read method
|
||||
this._read(state.highWaterMark);
|
||||
state.sync = false;
|
||||
// If _read pushed data synchronously, then `reading` will be false,
|
||||
// and we need to re-evaluate how much data we can return to the user.
|
||||
if (!state.reading) n = howMuchToRead(nOrig, state);
|
||||
}
|
||||
|
||||
var ret;
|
||||
if (n > 0) ret = fromList(n, state);else ret = null;
|
||||
|
||||
if (ret === null) {
|
||||
state.needReadable = true;
|
||||
n = 0;
|
||||
} else {
|
||||
state.length -= n;
|
||||
}
|
||||
|
||||
if (state.length === 0) {
|
||||
// If we have nothing in the buffer, then we want to know
|
||||
// as soon as we *do* get something into the buffer.
|
||||
if (!state.ended) state.needReadable = true;
|
||||
|
||||
// If we tried to read() past the EOF, then emit end on the next tick.
|
||||
if (nOrig !== n && state.ended) endReadable(this);
|
||||
}
|
||||
|
||||
if (ret !== null) this.emit('data', ret);
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
function chunkInvalid(state, chunk) {
|
||||
var er = null;
|
||||
if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
|
||||
er = new TypeError('Invalid non-string/buffer chunk');
|
||||
}
|
||||
return er;
|
||||
}
|
||||
|
||||
function onEofChunk(stream, state) {
|
||||
if (state.ended) return;
|
||||
if (state.decoder) {
|
||||
var chunk = state.decoder.end();
|
||||
if (chunk && chunk.length) {
|
||||
state.buffer.push(chunk);
|
||||
state.length += state.objectMode ? 1 : chunk.length;
|
||||
}
|
||||
}
|
||||
state.ended = true;
|
||||
|
||||
// emit 'readable' now to make sure it gets picked up.
|
||||
emitReadable(stream);
|
||||
}
|
||||
|
||||
// Don't emit readable right away in sync mode, because this can trigger
|
||||
// another read() call => stack overflow. This way, it might trigger
|
||||
// a nextTick recursion warning, but that's not so bad.
|
||||
function emitReadable(stream) {
|
||||
var state = stream._readableState;
|
||||
state.needReadable = false;
|
||||
if (!state.emittedReadable) {
|
||||
debug('emitReadable', state.flowing);
|
||||
state.emittedReadable = true;
|
||||
if (state.sync) nextTick(emitReadable_, stream);else emitReadable_(stream);
|
||||
}
|
||||
}
|
||||
|
||||
function emitReadable_(stream) {
|
||||
debug('emit readable');
|
||||
stream.emit('readable');
|
||||
flow(stream);
|
||||
}
|
||||
|
||||
// at this point, the user has presumably seen the 'readable' event,
|
||||
// and called read() to consume some data. that may have triggered
|
||||
// in turn another _read(n) call, in which case reading = true if
|
||||
// it's in progress.
|
||||
// However, if we're not ended, or reading, and the length < hwm,
|
||||
// then go ahead and try to read some more preemptively.
|
||||
function maybeReadMore(stream, state) {
|
||||
if (!state.readingMore) {
|
||||
state.readingMore = true;
|
||||
nextTick(maybeReadMore_, stream, state);
|
||||
}
|
||||
}
|
||||
|
||||
function maybeReadMore_(stream, state) {
|
||||
var len = state.length;
|
||||
while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
|
||||
debug('maybeReadMore read 0');
|
||||
stream.read(0);
|
||||
if (len === state.length)
|
||||
// didn't get any data, stop spinning.
|
||||
break;else len = state.length;
|
||||
}
|
||||
state.readingMore = false;
|
||||
}
|
||||
|
||||
// abstract method. to be overridden in specific implementation classes.
|
||||
// call cb(er, data) where data is <= n in length.
|
||||
// for virtual (non-string, non-buffer) streams, "length" is somewhat
|
||||
// arbitrary, and perhaps not very meaningful.
|
||||
Readable.prototype._read = function (n) {
|
||||
this.emit('error', new Error('not implemented'));
|
||||
};
|
||||
|
||||
Readable.prototype.pipe = function (dest, pipeOpts) {
|
||||
var src = this;
|
||||
var state = this._readableState;
|
||||
|
||||
switch (state.pipesCount) {
|
||||
case 0:
|
||||
state.pipes = dest;
|
||||
break;
|
||||
case 1:
|
||||
state.pipes = [state.pipes, dest];
|
||||
break;
|
||||
default:
|
||||
state.pipes.push(dest);
|
||||
break;
|
||||
}
|
||||
state.pipesCount += 1;
|
||||
debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
|
||||
|
||||
var doEnd = (!pipeOpts || pipeOpts.end !== false);
|
||||
|
||||
var endFn = doEnd ? onend : cleanup;
|
||||
if (state.endEmitted) nextTick(endFn);else src.once('end', endFn);
|
||||
|
||||
dest.on('unpipe', onunpipe);
|
||||
function onunpipe(readable) {
|
||||
debug('onunpipe');
|
||||
if (readable === src) {
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
function onend() {
|
||||
debug('onend');
|
||||
dest.end();
|
||||
}
|
||||
|
||||
// when the dest drains, it reduces the awaitDrain counter
|
||||
// on the source. This would be more elegant with a .once()
|
||||
// handler in flow(), but adding and removing repeatedly is
|
||||
// too slow.
|
||||
var ondrain = pipeOnDrain(src);
|
||||
dest.on('drain', ondrain);
|
||||
|
||||
var cleanedUp = false;
|
||||
function cleanup() {
|
||||
debug('cleanup');
|
||||
// cleanup event handlers once the pipe is broken
|
||||
dest.removeListener('close', onclose);
|
||||
dest.removeListener('finish', onfinish);
|
||||
dest.removeListener('drain', ondrain);
|
||||
dest.removeListener('error', onerror);
|
||||
dest.removeListener('unpipe', onunpipe);
|
||||
src.removeListener('end', onend);
|
||||
src.removeListener('end', cleanup);
|
||||
src.removeListener('data', ondata);
|
||||
|
||||
cleanedUp = true;
|
||||
|
||||
// if the reader is waiting for a drain event from this
|
||||
// specific writer, then it would cause it to never start
|
||||
// flowing again.
|
||||
// So, if this is awaiting a drain, then we just call it now.
|
||||
// If we don't know, then assume that we are waiting for one.
|
||||
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
|
||||
}
|
||||
|
||||
// If the user pushes more data while we're writing to dest then we'll end up
|
||||
// in ondata again. However, we only want to increase awaitDrain once because
|
||||
// dest will only emit one 'drain' event for the multiple writes.
|
||||
// => Introduce a guard on increasing awaitDrain.
|
||||
var increasedAwaitDrain = false;
|
||||
src.on('data', ondata);
|
||||
function ondata(chunk) {
|
||||
debug('ondata');
|
||||
increasedAwaitDrain = false;
|
||||
var ret = dest.write(chunk);
|
||||
if (false === ret && !increasedAwaitDrain) {
|
||||
// If the user unpiped during `dest.write()`, it is possible
|
||||
// to get stuck in a permanently paused state if that write
|
||||
// also returned false.
|
||||
// => Check whether `dest` is still a piping destination.
|
||||
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
||||
debug('false write response, pause', src._readableState.awaitDrain);
|
||||
src._readableState.awaitDrain++;
|
||||
increasedAwaitDrain = true;
|
||||
}
|
||||
src.pause();
|
||||
}
|
||||
}
|
||||
|
||||
// if the dest has an error, then stop piping into it.
|
||||
// however, don't suppress the throwing behavior for this.
|
||||
function onerror(er) {
|
||||
debug('onerror', er);
|
||||
unpipe();
|
||||
dest.removeListener('error', onerror);
|
||||
if (listenerCount(dest, 'error') === 0) dest.emit('error', er);
|
||||
}
|
||||
|
||||
// Make sure our error handler is attached before userland ones.
|
||||
prependListener(dest, 'error', onerror);
|
||||
|
||||
// Both close and finish should trigger unpipe, but only once.
|
||||
function onclose() {
|
||||
dest.removeListener('finish', onfinish);
|
||||
unpipe();
|
||||
}
|
||||
dest.once('close', onclose);
|
||||
function onfinish() {
|
||||
debug('onfinish');
|
||||
dest.removeListener('close', onclose);
|
||||
unpipe();
|
||||
}
|
||||
dest.once('finish', onfinish);
|
||||
|
||||
function unpipe() {
|
||||
debug('unpipe');
|
||||
src.unpipe(dest);
|
||||
}
|
||||
|
||||
// tell the dest that it's being piped to
|
||||
dest.emit('pipe', src);
|
||||
|
||||
// start the flow if it hasn't been started already.
|
||||
if (!state.flowing) {
|
||||
debug('pipe resume');
|
||||
src.resume();
|
||||
}
|
||||
|
||||
return dest;
|
||||
};
|
||||
|
||||
function pipeOnDrain(src) {
|
||||
return function () {
|
||||
var state = src._readableState;
|
||||
debug('pipeOnDrain', state.awaitDrain);
|
||||
if (state.awaitDrain) state.awaitDrain--;
|
||||
if (state.awaitDrain === 0 && src.listeners('data').length) {
|
||||
state.flowing = true;
|
||||
flow(src);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Readable.prototype.unpipe = function (dest) {
|
||||
var state = this._readableState;
|
||||
|
||||
// if we're not piping anywhere, then do nothing.
|
||||
if (state.pipesCount === 0) return this;
|
||||
|
||||
// just one destination. most common case.
|
||||
if (state.pipesCount === 1) {
|
||||
// passed in one, but it's not the right one.
|
||||
if (dest && dest !== state.pipes) return this;
|
||||
|
||||
if (!dest) dest = state.pipes;
|
||||
|
||||
// got a match.
|
||||
state.pipes = null;
|
||||
state.pipesCount = 0;
|
||||
state.flowing = false;
|
||||
if (dest) dest.emit('unpipe', this);
|
||||
return this;
|
||||
}
|
||||
|
||||
// slow case. multiple pipe destinations.
|
||||
|
||||
if (!dest) {
|
||||
// remove all.
|
||||
var dests = state.pipes;
|
||||
var len = state.pipesCount;
|
||||
state.pipes = null;
|
||||
state.pipesCount = 0;
|
||||
state.flowing = false;
|
||||
|
||||
for (var _i = 0; _i < len; _i++) {
|
||||
dests[_i].emit('unpipe', this);
|
||||
}return this;
|
||||
}
|
||||
|
||||
// try to find the right one.
|
||||
var i = indexOf(state.pipes, dest);
|
||||
if (i === -1) return this;
|
||||
|
||||
state.pipes.splice(i, 1);
|
||||
state.pipesCount -= 1;
|
||||
if (state.pipesCount === 1) state.pipes = state.pipes[0];
|
||||
|
||||
dest.emit('unpipe', this);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
// set up data events if they are asked for
|
||||
// Ensure readable listeners eventually get something
|
||||
Readable.prototype.on = function (ev, fn) {
|
||||
var res = EventEmitter.prototype.on.call(this, ev, fn);
|
||||
|
||||
if (ev === 'data') {
|
||||
// Start flowing on next tick if stream isn't explicitly paused
|
||||
if (this._readableState.flowing !== false) this.resume();
|
||||
} else if (ev === 'readable') {
|
||||
var state = this._readableState;
|
||||
if (!state.endEmitted && !state.readableListening) {
|
||||
state.readableListening = state.needReadable = true;
|
||||
state.emittedReadable = false;
|
||||
if (!state.reading) {
|
||||
nextTick(nReadingNextTick, this);
|
||||
} else if (state.length) {
|
||||
emitReadable(this, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
Readable.prototype.addListener = Readable.prototype.on;
|
||||
|
||||
function nReadingNextTick(self) {
|
||||
debug('readable nexttick read 0');
|
||||
self.read(0);
|
||||
}
|
||||
|
||||
// pause() and resume() are remnants of the legacy readable stream API
|
||||
// If the user uses them, then switch into old mode.
|
||||
Readable.prototype.resume = function () {
|
||||
var state = this._readableState;
|
||||
if (!state.flowing) {
|
||||
debug('resume');
|
||||
state.flowing = true;
|
||||
resume(this, state);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
function resume(stream, state) {
|
||||
if (!state.resumeScheduled) {
|
||||
state.resumeScheduled = true;
|
||||
nextTick(resume_, stream, state);
|
||||
}
|
||||
}
|
||||
|
||||
function resume_(stream, state) {
|
||||
if (!state.reading) {
|
||||
debug('resume read 0');
|
||||
stream.read(0);
|
||||
}
|
||||
|
||||
state.resumeScheduled = false;
|
||||
state.awaitDrain = 0;
|
||||
stream.emit('resume');
|
||||
flow(stream);
|
||||
if (state.flowing && !state.reading) stream.read(0);
|
||||
}
|
||||
|
||||
Readable.prototype.pause = function () {
|
||||
debug('call pause flowing=%j', this._readableState.flowing);
|
||||
if (false !== this._readableState.flowing) {
|
||||
debug('pause');
|
||||
this._readableState.flowing = false;
|
||||
this.emit('pause');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
function flow(stream) {
|
||||
var state = stream._readableState;
|
||||
debug('flow', state.flowing);
|
||||
while (state.flowing && stream.read() !== null) {}
|
||||
}
|
||||
|
||||
// wrap an old-style stream as the async data source.
|
||||
// This is *not* part of the readable stream interface.
|
||||
// It is an ugly unfortunate mess of history.
|
||||
Readable.prototype.wrap = function (stream) {
|
||||
var state = this._readableState;
|
||||
var paused = false;
|
||||
|
||||
var self = this;
|
||||
stream.on('end', function () {
|
||||
debug('wrapped end');
|
||||
if (state.decoder && !state.ended) {
|
||||
var chunk = state.decoder.end();
|
||||
if (chunk && chunk.length) self.push(chunk);
|
||||
}
|
||||
|
||||
self.push(null);
|
||||
});
|
||||
|
||||
stream.on('data', function (chunk) {
|
||||
debug('wrapped data');
|
||||
if (state.decoder) chunk = state.decoder.write(chunk);
|
||||
|
||||
// don't skip over falsy values in objectMode
|
||||
if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
|
||||
|
||||
var ret = self.push(chunk);
|
||||
if (!ret) {
|
||||
paused = true;
|
||||
stream.pause();
|
||||
}
|
||||
});
|
||||
|
||||
// proxy all the other methods.
|
||||
// important when wrapping filters and duplexes.
|
||||
for (var i in stream) {
|
||||
if (this[i] === undefined && typeof stream[i] === 'function') {
|
||||
this[i] = function (method) {
|
||||
return function () {
|
||||
return stream[method].apply(stream, arguments);
|
||||
};
|
||||
}(i);
|
||||
}
|
||||
}
|
||||
|
||||
// proxy certain important events.
|
||||
var events = ['error', 'close', 'destroy', 'pause', 'resume'];
|
||||
forEach(events, function (ev) {
|
||||
stream.on(ev, self.emit.bind(self, ev));
|
||||
});
|
||||
|
||||
// when we try to consume some more bytes, simply unpause the
|
||||
// underlying stream.
|
||||
self._read = function (n) {
|
||||
debug('wrapped _read', n);
|
||||
if (paused) {
|
||||
paused = false;
|
||||
stream.resume();
|
||||
}
|
||||
};
|
||||
|
||||
return self;
|
||||
};
|
||||
|
||||
// exposed for testing purposes only.
|
||||
Readable._fromList = fromList;
|
||||
|
||||
// Pluck off n bytes from an array of buffers.
|
||||
// Length is the combined lengths of all the buffers in the list.
|
||||
// This function is designed to be inlinable, so please take care when making
|
||||
// changes to the function body.
|
||||
function fromList(n, state) {
|
||||
// nothing buffered
|
||||
if (state.length === 0) return null;
|
||||
|
||||
var ret;
|
||||
if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
|
||||
// read it all, truncate the list
|
||||
if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
|
||||
state.buffer.clear();
|
||||
} else {
|
||||
// read part of list
|
||||
ret = fromListPartial(n, state.buffer, state.decoder);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Extracts only enough buffered data to satisfy the amount requested.
|
||||
// This function is designed to be inlinable, so please take care when making
|
||||
// changes to the function body.
|
||||
function fromListPartial(n, list, hasStrings) {
|
||||
var ret;
|
||||
if (n < list.head.data.length) {
|
||||
// slice is the same for buffers and strings
|
||||
ret = list.head.data.slice(0, n);
|
||||
list.head.data = list.head.data.slice(n);
|
||||
} else if (n === list.head.data.length) {
|
||||
// first chunk is a perfect match
|
||||
ret = list.shift();
|
||||
} else {
|
||||
// result spans more than one buffer
|
||||
ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Copies a specified amount of characters from the list of buffered data
|
||||
// chunks.
|
||||
// This function is designed to be inlinable, so please take care when making
|
||||
// changes to the function body.
|
||||
function copyFromBufferString(n, list) {
|
||||
var p = list.head;
|
||||
var c = 1;
|
||||
var ret = p.data;
|
||||
n -= ret.length;
|
||||
while (p = p.next) {
|
||||
var str = p.data;
|
||||
var nb = n > str.length ? str.length : n;
|
||||
if (nb === str.length) ret += str;else ret += str.slice(0, n);
|
||||
n -= nb;
|
||||
if (n === 0) {
|
||||
if (nb === str.length) {
|
||||
++c;
|
||||
if (p.next) list.head = p.next;else list.head = list.tail = null;
|
||||
} else {
|
||||
list.head = p;
|
||||
p.data = str.slice(nb);
|
||||
}
|
||||
break;
|
||||
}
|
||||
++c;
|
||||
}
|
||||
list.length -= c;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Copies a specified amount of bytes from the list of buffered data chunks.
|
||||
// This function is designed to be inlinable, so please take care when making
|
||||
// changes to the function body.
|
||||
function copyFromBuffer(n, list) {
|
||||
var ret = Buffer.allocUnsafe(n);
|
||||
var p = list.head;
|
||||
var c = 1;
|
||||
p.data.copy(ret);
|
||||
n -= p.data.length;
|
||||
while (p = p.next) {
|
||||
var buf = p.data;
|
||||
var nb = n > buf.length ? buf.length : n;
|
||||
buf.copy(ret, ret.length - n, 0, nb);
|
||||
n -= nb;
|
||||
if (n === 0) {
|
||||
if (nb === buf.length) {
|
||||
++c;
|
||||
if (p.next) list.head = p.next;else list.head = list.tail = null;
|
||||
} else {
|
||||
list.head = p;
|
||||
p.data = buf.slice(nb);
|
||||
}
|
||||
break;
|
||||
}
|
||||
++c;
|
||||
}
|
||||
list.length -= c;
|
||||
return ret;
|
||||
}
|
||||
|
||||
function endReadable(stream) {
|
||||
var state = stream._readableState;
|
||||
|
||||
// If we get here before consuming all the bytes, then that is a
|
||||
// bug in node. Should never happen.
|
||||
if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
|
||||
|
||||
if (!state.endEmitted) {
|
||||
state.ended = true;
|
||||
nextTick(endReadableNT, state, stream);
|
||||
}
|
||||
}
|
||||
|
||||
function endReadableNT(state, stream) {
|
||||
// Check that we didn't get one last unshift.
|
||||
if (!state.endEmitted && state.length === 0) {
|
||||
state.endEmitted = true;
|
||||
stream.readable = false;
|
||||
stream.emit('end');
|
||||
}
|
||||
}
|
||||
|
||||
function forEach(xs, f) {
|
||||
for (var i = 0, l = xs.length; i < l; i++) {
|
||||
f(xs[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
function indexOf(xs, x) {
|
||||
for (var i = 0, l = xs.length; i < l; i++) {
|
||||
if (xs[i] === x) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
174
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/readable-stream/transform.js
generated
vendored
Normal file
174
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/readable-stream/transform.js
generated
vendored
Normal file
|
@ -0,0 +1,174 @@
|
|||
// a transform stream is a readable/writable stream where you do
|
||||
// something with the data. Sometimes it's called a "filter",
|
||||
// but that's not a great name for it, since that implies a thing where
|
||||
// some bits pass through, and others are simply ignored. (That would
|
||||
// be a valid example of a transform, of course.)
|
||||
//
|
||||
// While the output is causally related to the input, it's not a
|
||||
// necessarily symmetric or synchronous transformation. For example,
|
||||
// a zlib stream might take multiple plain-text writes(), and then
|
||||
// emit a single compressed chunk some time in the future.
|
||||
//
|
||||
// Here's how this works:
|
||||
//
|
||||
// The Transform stream has all the aspects of the readable and writable
|
||||
// stream classes. When you write(chunk), that calls _write(chunk,cb)
|
||||
// internally, and returns false if there's a lot of pending writes
|
||||
// buffered up. When you call read(), that calls _read(n) until
|
||||
// there's enough pending readable data buffered up.
|
||||
//
|
||||
// In a transform stream, the written data is placed in a buffer. When
|
||||
// _read(n) is called, it transforms the queued up data, calling the
|
||||
// buffered _write cb's as it consumes chunks. If consuming a single
|
||||
// written chunk would result in multiple output chunks, then the first
|
||||
// outputted bit calls the readcb, and subsequent chunks just go into
|
||||
// the read buffer, and will cause it to emit 'readable' if necessary.
|
||||
//
|
||||
// This way, back-pressure is actually determined by the reading side,
|
||||
// since _read has to be called to start processing a new chunk. However,
|
||||
// a pathological inflate type of transform can cause excessive buffering
|
||||
// here. For example, imagine a stream where every byte of input is
|
||||
// interpreted as an integer from 0-255, and then results in that many
|
||||
// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
|
||||
// 1kb of data being output. In this case, you could write a very small
|
||||
// amount of input, and end up with a very large amount of output. In
|
||||
// such a pathological inflating mechanism, there'd be no way to tell
|
||||
// the system to stop doing the transform. A single 4MB write could
|
||||
// cause the system to run out of memory.
|
||||
//
|
||||
// However, even in such a pathological case, only a single written chunk
|
||||
// would be consumed, and then the rest would wait (un-transformed) until
|
||||
// the results of the previous transformed chunk were consumed.
|
||||
|
||||
|
||||
import {Duplex} from './duplex';
|
||||
|
||||
|
||||
import {inherits} from 'util';
|
||||
inherits(Transform, Duplex);
|
||||
|
||||
function TransformState(stream) {
|
||||
this.afterTransform = function (er, data) {
|
||||
return afterTransform(stream, er, data);
|
||||
};
|
||||
|
||||
this.needTransform = false;
|
||||
this.transforming = false;
|
||||
this.writecb = null;
|
||||
this.writechunk = null;
|
||||
this.writeencoding = null;
|
||||
}
|
||||
|
||||
function afterTransform(stream, er, data) {
|
||||
var ts = stream._transformState;
|
||||
ts.transforming = false;
|
||||
|
||||
var cb = ts.writecb;
|
||||
|
||||
if (!cb) return stream.emit('error', new Error('no writecb in Transform class'));
|
||||
|
||||
ts.writechunk = null;
|
||||
ts.writecb = null;
|
||||
|
||||
if (data !== null && data !== undefined) stream.push(data);
|
||||
|
||||
cb(er);
|
||||
|
||||
var rs = stream._readableState;
|
||||
rs.reading = false;
|
||||
if (rs.needReadable || rs.length < rs.highWaterMark) {
|
||||
stream._read(rs.highWaterMark);
|
||||
}
|
||||
}
|
||||
export default Transform;
|
||||
export function Transform(options) {
|
||||
if (!(this instanceof Transform)) return new Transform(options);
|
||||
|
||||
Duplex.call(this, options);
|
||||
|
||||
this._transformState = new TransformState(this);
|
||||
|
||||
// when the writable side finishes, then flush out anything remaining.
|
||||
var stream = this;
|
||||
|
||||
// start out asking for a readable event once data is transformed.
|
||||
this._readableState.needReadable = true;
|
||||
|
||||
// we have implemented the _read method, and done the other things
|
||||
// that Readable wants before the first _read call, so unset the
|
||||
// sync guard flag.
|
||||
this._readableState.sync = false;
|
||||
|
||||
if (options) {
|
||||
if (typeof options.transform === 'function') this._transform = options.transform;
|
||||
|
||||
if (typeof options.flush === 'function') this._flush = options.flush;
|
||||
}
|
||||
|
||||
this.once('prefinish', function () {
|
||||
if (typeof this._flush === 'function') this._flush(function (er) {
|
||||
done(stream, er);
|
||||
});else done(stream);
|
||||
});
|
||||
}
|
||||
|
||||
Transform.prototype.push = function (chunk, encoding) {
|
||||
this._transformState.needTransform = false;
|
||||
return Duplex.prototype.push.call(this, chunk, encoding);
|
||||
};
|
||||
|
||||
// This is the part where you do stuff!
|
||||
// override this function in implementation classes.
|
||||
// 'chunk' is an input chunk.
|
||||
//
|
||||
// Call `push(newChunk)` to pass along transformed output
|
||||
// to the readable side. You may call 'push' zero or more times.
|
||||
//
|
||||
// Call `cb(err)` when you are done with this chunk. If you pass
|
||||
// an error, then that'll put the hurt on the whole operation. If you
|
||||
// never call cb(), then you'll never get another chunk.
|
||||
Transform.prototype._transform = function (chunk, encoding, cb) {
|
||||
throw new Error('Not implemented');
|
||||
};
|
||||
|
||||
Transform.prototype._write = function (chunk, encoding, cb) {
|
||||
var ts = this._transformState;
|
||||
ts.writecb = cb;
|
||||
ts.writechunk = chunk;
|
||||
ts.writeencoding = encoding;
|
||||
if (!ts.transforming) {
|
||||
var rs = this._readableState;
|
||||
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
|
||||
}
|
||||
};
|
||||
|
||||
// Doesn't matter what the args are here.
|
||||
// _transform does all the work.
|
||||
// That we got here means that the readable side wants more data.
|
||||
Transform.prototype._read = function (n) {
|
||||
var ts = this._transformState;
|
||||
|
||||
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
|
||||
ts.transforming = true;
|
||||
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
||||
} else {
|
||||
// mark that we need a transform, so that any data that comes in
|
||||
// will get processed, now that we've asked for it.
|
||||
ts.needTransform = true;
|
||||
}
|
||||
};
|
||||
|
||||
function done(stream, er) {
|
||||
if (er) return stream.emit('error', er);
|
||||
|
||||
// if there's nothing in the write buffer, then that means
|
||||
// that nothing more will ever be provided
|
||||
var ws = stream._writableState;
|
||||
var ts = stream._transformState;
|
||||
|
||||
if (ws.length) throw new Error('Calling transform done when ws.length != 0');
|
||||
|
||||
if (ts.transforming) throw new Error('Calling transform done when still transforming');
|
||||
|
||||
return stream.push(null);
|
||||
}
|
483
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/readable-stream/writable.js
generated
vendored
Normal file
483
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/readable-stream/writable.js
generated
vendored
Normal file
|
@ -0,0 +1,483 @@
|
|||
// A bit simpler than readable streams.
|
||||
// Implement an async ._write(chunk, encoding, cb), and it'll handle all
|
||||
// the drain event emission and buffering.
|
||||
|
||||
|
||||
import {inherits, deprecate} from 'util';
|
||||
import {Buffer} from 'buffer';
|
||||
Writable.WritableState = WritableState;
|
||||
import {EventEmitter} from 'events';
|
||||
import {Duplex} from './duplex';
|
||||
import {nextTick} from 'process';
|
||||
inherits(Writable, EventEmitter);
|
||||
|
||||
function nop() {}
|
||||
|
||||
function WriteReq(chunk, encoding, cb) {
|
||||
this.chunk = chunk;
|
||||
this.encoding = encoding;
|
||||
this.callback = cb;
|
||||
this.next = null;
|
||||
}
|
||||
|
||||
function WritableState(options, stream) {
|
||||
Object.defineProperty(this, 'buffer', {
|
||||
get: deprecate(function () {
|
||||
return this.getBuffer();
|
||||
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
|
||||
});
|
||||
options = options || {};
|
||||
|
||||
// object stream flag to indicate whether or not this stream
|
||||
// contains buffers or objects.
|
||||
this.objectMode = !!options.objectMode;
|
||||
|
||||
if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
|
||||
|
||||
// the point at which write() starts returning false
|
||||
// Note: 0 is a valid value, means that we always return false if
|
||||
// the entire buffer is not flushed immediately on write()
|
||||
var hwm = options.highWaterMark;
|
||||
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
||||
this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
|
||||
|
||||
// cast to ints.
|
||||
this.highWaterMark = ~ ~this.highWaterMark;
|
||||
|
||||
this.needDrain = false;
|
||||
// at the start of calling end()
|
||||
this.ending = false;
|
||||
// when end() has been called, and returned
|
||||
this.ended = false;
|
||||
// when 'finish' is emitted
|
||||
this.finished = false;
|
||||
|
||||
// should we decode strings into buffers before passing to _write?
|
||||
// this is here so that some node-core streams can optimize string
|
||||
// handling at a lower level.
|
||||
var noDecode = options.decodeStrings === false;
|
||||
this.decodeStrings = !noDecode;
|
||||
|
||||
// Crypto is kind of old and crusty. Historically, its default string
|
||||
// encoding is 'binary' so we have to make this configurable.
|
||||
// Everything else in the universe uses 'utf8', though.
|
||||
this.defaultEncoding = options.defaultEncoding || 'utf8';
|
||||
|
||||
// not an actual buffer we keep track of, but a measurement
|
||||
// of how much we're waiting to get pushed to some underlying
|
||||
// socket or file.
|
||||
this.length = 0;
|
||||
|
||||
// a flag to see when we're in the middle of a write.
|
||||
this.writing = false;
|
||||
|
||||
// when true all writes will be buffered until .uncork() call
|
||||
this.corked = 0;
|
||||
|
||||
// a flag to be able to tell if the onwrite cb is called immediately,
|
||||
// or on a later tick. We set this to true at first, because any
|
||||
// actions that shouldn't happen until "later" should generally also
|
||||
// not happen before the first write call.
|
||||
this.sync = true;
|
||||
|
||||
// a flag to know if we're processing previously buffered items, which
|
||||
// may call the _write() callback in the same tick, so that we don't
|
||||
// end up in an overlapped onwrite situation.
|
||||
this.bufferProcessing = false;
|
||||
|
||||
// the callback that's passed to _write(chunk,cb)
|
||||
this.onwrite = function (er) {
|
||||
onwrite(stream, er);
|
||||
};
|
||||
|
||||
// the callback that the user supplies to write(chunk,encoding,cb)
|
||||
this.writecb = null;
|
||||
|
||||
// the amount that is being written when _write is called.
|
||||
this.writelen = 0;
|
||||
|
||||
this.bufferedRequest = null;
|
||||
this.lastBufferedRequest = null;
|
||||
|
||||
// number of pending user-supplied write callbacks
|
||||
// this must be 0 before 'finish' can be emitted
|
||||
this.pendingcb = 0;
|
||||
|
||||
// emit prefinish if the only thing we're waiting for is _write cbs
|
||||
// This is relevant for synchronous Transform streams
|
||||
this.prefinished = false;
|
||||
|
||||
// True if the error was already emitted and should not be thrown again
|
||||
this.errorEmitted = false;
|
||||
|
||||
// count buffered requests
|
||||
this.bufferedRequestCount = 0;
|
||||
|
||||
// allocate the first CorkedRequest, there is always
|
||||
// one allocated and free to use, and we maintain at most two
|
||||
this.corkedRequestsFree = new CorkedRequest(this);
|
||||
}
|
||||
|
||||
WritableState.prototype.getBuffer = function writableStateGetBuffer() {
|
||||
var current = this.bufferedRequest;
|
||||
var out = [];
|
||||
while (current) {
|
||||
out.push(current);
|
||||
current = current.next;
|
||||
}
|
||||
return out;
|
||||
};
|
||||
|
||||
export default Writable;
|
||||
export function Writable(options) {
|
||||
|
||||
// Writable ctor is applied to Duplexes, though they're not
|
||||
// instanceof Writable, they're instanceof Readable.
|
||||
if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options);
|
||||
|
||||
this._writableState = new WritableState(options, this);
|
||||
|
||||
// legacy.
|
||||
this.writable = true;
|
||||
|
||||
if (options) {
|
||||
if (typeof options.write === 'function') this._write = options.write;
|
||||
|
||||
if (typeof options.writev === 'function') this._writev = options.writev;
|
||||
}
|
||||
|
||||
EventEmitter.call(this);
|
||||
}
|
||||
|
||||
// Otherwise people can pipe Writable streams, which is just wrong.
|
||||
Writable.prototype.pipe = function () {
|
||||
this.emit('error', new Error('Cannot pipe, not readable'));
|
||||
};
|
||||
|
||||
function writeAfterEnd(stream, cb) {
|
||||
var er = new Error('write after end');
|
||||
// TODO: defer error events consistently everywhere, not just the cb
|
||||
stream.emit('error', er);
|
||||
nextTick(cb, er);
|
||||
}
|
||||
|
||||
// If we get something that is not a buffer, string, null, or undefined,
|
||||
// and we're not in objectMode, then that's an error.
|
||||
// Otherwise stream chunks are all considered to be of length=1, and the
|
||||
// watermarks determine how many objects to keep in the buffer, rather than
|
||||
// how many bytes or characters.
|
||||
function validChunk(stream, state, chunk, cb) {
|
||||
var valid = true;
|
||||
var er = false;
|
||||
// Always throw error if a null is written
|
||||
// if we are not in object mode then throw
|
||||
// if it is not a buffer, string, or undefined.
|
||||
if (chunk === null) {
|
||||
er = new TypeError('May not write null values to stream');
|
||||
} else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
||||
er = new TypeError('Invalid non-string/buffer chunk');
|
||||
}
|
||||
if (er) {
|
||||
stream.emit('error', er);
|
||||
nextTick(cb, er);
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
Writable.prototype.write = function (chunk, encoding, cb) {
|
||||
var state = this._writableState;
|
||||
var ret = false;
|
||||
|
||||
if (typeof encoding === 'function') {
|
||||
cb = encoding;
|
||||
encoding = null;
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
|
||||
|
||||
if (typeof cb !== 'function') cb = nop;
|
||||
|
||||
if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {
|
||||
state.pendingcb++;
|
||||
ret = writeOrBuffer(this, state, chunk, encoding, cb);
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
Writable.prototype.cork = function () {
|
||||
var state = this._writableState;
|
||||
|
||||
state.corked++;
|
||||
};
|
||||
|
||||
Writable.prototype.uncork = function () {
|
||||
var state = this._writableState;
|
||||
|
||||
if (state.corked) {
|
||||
state.corked--;
|
||||
|
||||
if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
||||
}
|
||||
};
|
||||
|
||||
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
||||
// node::ParseEncoding() requires lower case.
|
||||
if (typeof encoding === 'string') encoding = encoding.toLowerCase();
|
||||
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
|
||||
this._writableState.defaultEncoding = encoding;
|
||||
return this;
|
||||
};
|
||||
|
||||
function decodeChunk(state, chunk, encoding) {
|
||||
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
|
||||
chunk = Buffer.from(chunk, encoding);
|
||||
}
|
||||
return chunk;
|
||||
}
|
||||
|
||||
// if we're already writing something, then just put this
|
||||
// in the queue, and wait our turn. Otherwise, call _write
|
||||
// If we return false, then we need a drain event, so set that flag.
|
||||
function writeOrBuffer(stream, state, chunk, encoding, cb) {
|
||||
chunk = decodeChunk(state, chunk, encoding);
|
||||
|
||||
if (Buffer.isBuffer(chunk)) encoding = 'buffer';
|
||||
var len = state.objectMode ? 1 : chunk.length;
|
||||
|
||||
state.length += len;
|
||||
|
||||
var ret = state.length < state.highWaterMark;
|
||||
// we must ensure that previous needDrain will not be reset to false.
|
||||
if (!ret) state.needDrain = true;
|
||||
|
||||
if (state.writing || state.corked) {
|
||||
var last = state.lastBufferedRequest;
|
||||
state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
|
||||
if (last) {
|
||||
last.next = state.lastBufferedRequest;
|
||||
} else {
|
||||
state.bufferedRequest = state.lastBufferedRequest;
|
||||
}
|
||||
state.bufferedRequestCount += 1;
|
||||
} else {
|
||||
doWrite(stream, state, false, len, chunk, encoding, cb);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
||||
state.writelen = len;
|
||||
state.writecb = cb;
|
||||
state.writing = true;
|
||||
state.sync = true;
|
||||
if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
|
||||
state.sync = false;
|
||||
}
|
||||
|
||||
function onwriteError(stream, state, sync, er, cb) {
|
||||
--state.pendingcb;
|
||||
if (sync) nextTick(cb, er);else cb(er);
|
||||
|
||||
stream._writableState.errorEmitted = true;
|
||||
stream.emit('error', er);
|
||||
}
|
||||
|
||||
function onwriteStateUpdate(state) {
|
||||
state.writing = false;
|
||||
state.writecb = null;
|
||||
state.length -= state.writelen;
|
||||
state.writelen = 0;
|
||||
}
|
||||
|
||||
function onwrite(stream, er) {
|
||||
var state = stream._writableState;
|
||||
var sync = state.sync;
|
||||
var cb = state.writecb;
|
||||
|
||||
onwriteStateUpdate(state);
|
||||
|
||||
if (er) onwriteError(stream, state, sync, er, cb);else {
|
||||
// Check if we're actually ready to finish, but don't emit yet
|
||||
var finished = needFinish(state);
|
||||
|
||||
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
|
||||
clearBuffer(stream, state);
|
||||
}
|
||||
|
||||
if (sync) {
|
||||
/*<replacement>*/
|
||||
nextTick(afterWrite, stream, state, finished, cb);
|
||||
/*</replacement>*/
|
||||
} else {
|
||||
afterWrite(stream, state, finished, cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function afterWrite(stream, state, finished, cb) {
|
||||
if (!finished) onwriteDrain(stream, state);
|
||||
state.pendingcb--;
|
||||
cb();
|
||||
finishMaybe(stream, state);
|
||||
}
|
||||
|
||||
// Must force callback to be called on nextTick, so that we don't
|
||||
// emit 'drain' before the write() consumer gets the 'false' return
|
||||
// value, and has a chance to attach a 'drain' listener.
|
||||
function onwriteDrain(stream, state) {
|
||||
if (state.length === 0 && state.needDrain) {
|
||||
state.needDrain = false;
|
||||
stream.emit('drain');
|
||||
}
|
||||
}
|
||||
|
||||
// if there's something in the buffer waiting, then process it
|
||||
function clearBuffer(stream, state) {
|
||||
state.bufferProcessing = true;
|
||||
var entry = state.bufferedRequest;
|
||||
|
||||
if (stream._writev && entry && entry.next) {
|
||||
// Fast case, write everything using _writev()
|
||||
var l = state.bufferedRequestCount;
|
||||
var buffer = new Array(l);
|
||||
var holder = state.corkedRequestsFree;
|
||||
holder.entry = entry;
|
||||
|
||||
var count = 0;
|
||||
while (entry) {
|
||||
buffer[count] = entry;
|
||||
entry = entry.next;
|
||||
count += 1;
|
||||
}
|
||||
|
||||
doWrite(stream, state, true, state.length, buffer, '', holder.finish);
|
||||
|
||||
// doWrite is almost always async, defer these to save a bit of time
|
||||
// as the hot path ends with doWrite
|
||||
state.pendingcb++;
|
||||
state.lastBufferedRequest = null;
|
||||
if (holder.next) {
|
||||
state.corkedRequestsFree = holder.next;
|
||||
holder.next = null;
|
||||
} else {
|
||||
state.corkedRequestsFree = new CorkedRequest(state);
|
||||
}
|
||||
} else {
|
||||
// Slow case, write chunks one-by-one
|
||||
while (entry) {
|
||||
var chunk = entry.chunk;
|
||||
var encoding = entry.encoding;
|
||||
var cb = entry.callback;
|
||||
var len = state.objectMode ? 1 : chunk.length;
|
||||
|
||||
doWrite(stream, state, false, len, chunk, encoding, cb);
|
||||
entry = entry.next;
|
||||
// if we didn't call the onwrite immediately, then
|
||||
// it means that we need to wait until it does.
|
||||
// also, that means that the chunk and cb are currently
|
||||
// being processed, so move the buffer counter past them.
|
||||
if (state.writing) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (entry === null) state.lastBufferedRequest = null;
|
||||
}
|
||||
|
||||
state.bufferedRequestCount = 0;
|
||||
state.bufferedRequest = entry;
|
||||
state.bufferProcessing = false;
|
||||
}
|
||||
|
||||
Writable.prototype._write = function (chunk, encoding, cb) {
|
||||
cb(new Error('not implemented'));
|
||||
};
|
||||
|
||||
Writable.prototype._writev = null;
|
||||
|
||||
Writable.prototype.end = function (chunk, encoding, cb) {
|
||||
var state = this._writableState;
|
||||
|
||||
if (typeof chunk === 'function') {
|
||||
cb = chunk;
|
||||
chunk = null;
|
||||
encoding = null;
|
||||
} else if (typeof encoding === 'function') {
|
||||
cb = encoding;
|
||||
encoding = null;
|
||||
}
|
||||
|
||||
if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
|
||||
|
||||
// .end() fully uncorks
|
||||
if (state.corked) {
|
||||
state.corked = 1;
|
||||
this.uncork();
|
||||
}
|
||||
|
||||
// ignore unnecessary end() calls.
|
||||
if (!state.ending && !state.finished) endWritable(this, state, cb);
|
||||
};
|
||||
|
||||
function needFinish(state) {
|
||||
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
||||
}
|
||||
|
||||
function prefinish(stream, state) {
|
||||
if (!state.prefinished) {
|
||||
state.prefinished = true;
|
||||
stream.emit('prefinish');
|
||||
}
|
||||
}
|
||||
|
||||
function finishMaybe(stream, state) {
|
||||
var need = needFinish(state);
|
||||
if (need) {
|
||||
if (state.pendingcb === 0) {
|
||||
prefinish(stream, state);
|
||||
state.finished = true;
|
||||
stream.emit('finish');
|
||||
} else {
|
||||
prefinish(stream, state);
|
||||
}
|
||||
}
|
||||
return need;
|
||||
}
|
||||
|
||||
function endWritable(stream, state, cb) {
|
||||
state.ending = true;
|
||||
finishMaybe(stream, state);
|
||||
if (cb) {
|
||||
if (state.finished) nextTick(cb);else stream.once('finish', cb);
|
||||
}
|
||||
state.ended = true;
|
||||
stream.writable = false;
|
||||
}
|
||||
|
||||
// It seems a linked list but it is not
|
||||
// there will be only 2 of these for each stream
|
||||
function CorkedRequest(state) {
|
||||
var _this = this;
|
||||
|
||||
this.next = null;
|
||||
this.entry = null;
|
||||
|
||||
this.finish = function (err) {
|
||||
var entry = _this.entry;
|
||||
_this.entry = null;
|
||||
while (entry) {
|
||||
var cb = entry.callback;
|
||||
state.pendingcb--;
|
||||
cb(err);
|
||||
entry = entry.next;
|
||||
}
|
||||
if (state.corkedRequestsFree) {
|
||||
state.corkedRequestsFree.next = _this;
|
||||
} else {
|
||||
state.corkedRequestsFree = _this;
|
||||
}
|
||||
};
|
||||
}
|
185
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/setimmediate.js
generated
vendored
Normal file
185
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/setimmediate.js
generated
vendored
Normal file
|
@ -0,0 +1,185 @@
|
|||
/*
|
||||
MIT Licence
|
||||
Copyright (c) 2012 Barnesandnoble.com, llc, Donavon West, and Domenic Denicola
|
||||
https://github.com/YuzuJS/setImmediate/blob/f1ccbfdf09cb93aadf77c4aa749ea554503b9234/LICENSE.txt
|
||||
*/
|
||||
|
||||
var nextHandle = 1; // Spec says greater than zero
|
||||
var tasksByHandle = {};
|
||||
var currentlyRunningATask = false;
|
||||
var doc = global.document;
|
||||
var registerImmediate;
|
||||
|
||||
export function setImmediate(callback) {
|
||||
// Callback can either be a function or a string
|
||||
if (typeof callback !== "function") {
|
||||
callback = new Function("" + callback);
|
||||
}
|
||||
// Copy function arguments
|
||||
var args = new Array(arguments.length - 1);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
args[i] = arguments[i + 1];
|
||||
}
|
||||
// Store and register the task
|
||||
var task = { callback: callback, args: args };
|
||||
tasksByHandle[nextHandle] = task;
|
||||
registerImmediate(nextHandle);
|
||||
return nextHandle++;
|
||||
}
|
||||
|
||||
export function clearImmediate(handle) {
|
||||
delete tasksByHandle[handle];
|
||||
}
|
||||
|
||||
function run(task) {
|
||||
var callback = task.callback;
|
||||
var args = task.args;
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
callback();
|
||||
break;
|
||||
case 1:
|
||||
callback(args[0]);
|
||||
break;
|
||||
case 2:
|
||||
callback(args[0], args[1]);
|
||||
break;
|
||||
case 3:
|
||||
callback(args[0], args[1], args[2]);
|
||||
break;
|
||||
default:
|
||||
callback.apply(undefined, args);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function runIfPresent(handle) {
|
||||
// From the spec: "Wait until any invocations of this algorithm started before this one have completed."
|
||||
// So if we're currently running a task, we'll need to delay this invocation.
|
||||
if (currentlyRunningATask) {
|
||||
// Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
|
||||
// "too much recursion" error.
|
||||
setTimeout(runIfPresent, 0, handle);
|
||||
} else {
|
||||
var task = tasksByHandle[handle];
|
||||
if (task) {
|
||||
currentlyRunningATask = true;
|
||||
try {
|
||||
run(task);
|
||||
} finally {
|
||||
clearImmediate(handle);
|
||||
currentlyRunningATask = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function installNextTickImplementation() {
|
||||
registerImmediate = function(handle) {
|
||||
process.nextTick(function () { runIfPresent(handle); });
|
||||
};
|
||||
}
|
||||
|
||||
function canUsePostMessage() {
|
||||
// The test against `importScripts` prevents this implementation from being installed inside a web worker,
|
||||
// where `global.postMessage` means something completely different and can't be used for this purpose.
|
||||
if (global.postMessage && !global.importScripts) {
|
||||
var postMessageIsAsynchronous = true;
|
||||
var oldOnMessage = global.onmessage;
|
||||
global.onmessage = function() {
|
||||
postMessageIsAsynchronous = false;
|
||||
};
|
||||
global.postMessage("", "*");
|
||||
global.onmessage = oldOnMessage;
|
||||
return postMessageIsAsynchronous;
|
||||
}
|
||||
}
|
||||
|
||||
function installPostMessageImplementation() {
|
||||
// Installs an event handler on `global` for the `message` event: see
|
||||
// * https://developer.mozilla.org/en/DOM/window.postMessage
|
||||
// * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
|
||||
|
||||
var messagePrefix = "setImmediate$" + Math.random() + "$";
|
||||
var onGlobalMessage = function(event) {
|
||||
if (event.source === global &&
|
||||
typeof event.data === "string" &&
|
||||
event.data.indexOf(messagePrefix) === 0) {
|
||||
runIfPresent(+event.data.slice(messagePrefix.length));
|
||||
}
|
||||
};
|
||||
|
||||
if (global.addEventListener) {
|
||||
global.addEventListener("message", onGlobalMessage, false);
|
||||
} else {
|
||||
global.attachEvent("onmessage", onGlobalMessage);
|
||||
}
|
||||
|
||||
registerImmediate = function(handle) {
|
||||
global.postMessage(messagePrefix + handle, "*");
|
||||
};
|
||||
}
|
||||
|
||||
function installMessageChannelImplementation() {
|
||||
var channel = new MessageChannel();
|
||||
channel.port1.onmessage = function(event) {
|
||||
var handle = event.data;
|
||||
runIfPresent(handle);
|
||||
};
|
||||
|
||||
registerImmediate = function(handle) {
|
||||
channel.port2.postMessage(handle);
|
||||
};
|
||||
}
|
||||
|
||||
function installReadyStateChangeImplementation() {
|
||||
var html = doc.documentElement;
|
||||
registerImmediate = function(handle) {
|
||||
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
|
||||
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
|
||||
var script = doc.createElement("script");
|
||||
script.onreadystatechange = function () {
|
||||
runIfPresent(handle);
|
||||
script.onreadystatechange = null;
|
||||
html.removeChild(script);
|
||||
script = null;
|
||||
};
|
||||
html.appendChild(script);
|
||||
};
|
||||
}
|
||||
|
||||
function installSetTimeoutImplementation() {
|
||||
registerImmediate = function(handle) {
|
||||
setTimeout(runIfPresent, 0, handle);
|
||||
};
|
||||
}
|
||||
|
||||
// If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
|
||||
var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
|
||||
attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
|
||||
|
||||
// Don't get fooled by e.g. browserify environments.
|
||||
if ({}.toString.call(global.process) === "[object process]") {
|
||||
// For Node.js before 0.9
|
||||
installNextTickImplementation();
|
||||
|
||||
} else if (canUsePostMessage()) {
|
||||
// For non-IE10 modern browsers
|
||||
installPostMessageImplementation();
|
||||
|
||||
} else if (global.MessageChannel) {
|
||||
// For web workers, where supported
|
||||
installMessageChannelImplementation();
|
||||
|
||||
} else if (doc && "onreadystatechange" in doc.createElement("script")) {
|
||||
// For IE 6–8
|
||||
installReadyStateChangeImplementation();
|
||||
|
||||
} else {
|
||||
// For older browsers
|
||||
installSetTimeoutImplementation();
|
||||
}
|
||||
export default {
|
||||
setTimeout: setTimeout,
|
||||
clearTimeout: clearTimeout
|
||||
}
|
110
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/stream.js
generated
vendored
Normal file
110
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/stream.js
generated
vendored
Normal file
|
@ -0,0 +1,110 @@
|
|||
import EE from 'events';
|
||||
import {inherits} from 'util';
|
||||
|
||||
import {Duplex} from './readable-stream/duplex.js';
|
||||
import {Readable} from './readable-stream/readable.js';
|
||||
import {Writable} from './readable-stream/writable.js';
|
||||
import {Transform} from './readable-stream/transform.js';
|
||||
import {PassThrough} from './readable-stream/passthrough.js';
|
||||
inherits(Stream, EE);
|
||||
Stream.Readable = Readable;
|
||||
Stream.Writable = Writable;
|
||||
Stream.Duplex = Duplex;
|
||||
Stream.Transform = Transform;
|
||||
Stream.PassThrough = PassThrough;
|
||||
|
||||
// Backwards-compat with node 0.4.x
|
||||
Stream.Stream = Stream;
|
||||
|
||||
export default Stream;
|
||||
export {Readable,Writable,Duplex,Transform,PassThrough,Stream}
|
||||
|
||||
// old-style streams. Note that the pipe method (the only relevant
|
||||
// part of this class) is overridden in the Readable class.
|
||||
|
||||
function Stream() {
|
||||
EE.call(this);
|
||||
}
|
||||
|
||||
Stream.prototype.pipe = function(dest, options) {
|
||||
var source = this;
|
||||
|
||||
function ondata(chunk) {
|
||||
if (dest.writable) {
|
||||
if (false === dest.write(chunk) && source.pause) {
|
||||
source.pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
source.on('data', ondata);
|
||||
|
||||
function ondrain() {
|
||||
if (source.readable && source.resume) {
|
||||
source.resume();
|
||||
}
|
||||
}
|
||||
|
||||
dest.on('drain', ondrain);
|
||||
|
||||
// If the 'end' option is not supplied, dest.end() will be called when
|
||||
// source gets the 'end' or 'close' events. Only dest.end() once.
|
||||
if (!dest._isStdio && (!options || options.end !== false)) {
|
||||
source.on('end', onend);
|
||||
source.on('close', onclose);
|
||||
}
|
||||
|
||||
var didOnEnd = false;
|
||||
function onend() {
|
||||
if (didOnEnd) return;
|
||||
didOnEnd = true;
|
||||
|
||||
dest.end();
|
||||
}
|
||||
|
||||
|
||||
function onclose() {
|
||||
if (didOnEnd) return;
|
||||
didOnEnd = true;
|
||||
|
||||
if (typeof dest.destroy === 'function') dest.destroy();
|
||||
}
|
||||
|
||||
// don't leave dangling pipes when there are errors.
|
||||
function onerror(er) {
|
||||
cleanup();
|
||||
if (EE.listenerCount(this, 'error') === 0) {
|
||||
throw er; // Unhandled stream error in pipe.
|
||||
}
|
||||
}
|
||||
|
||||
source.on('error', onerror);
|
||||
dest.on('error', onerror);
|
||||
|
||||
// remove all the event listeners that were added.
|
||||
function cleanup() {
|
||||
source.removeListener('data', ondata);
|
||||
dest.removeListener('drain', ondrain);
|
||||
|
||||
source.removeListener('end', onend);
|
||||
source.removeListener('close', onclose);
|
||||
|
||||
source.removeListener('error', onerror);
|
||||
dest.removeListener('error', onerror);
|
||||
|
||||
source.removeListener('end', cleanup);
|
||||
source.removeListener('close', cleanup);
|
||||
|
||||
dest.removeListener('close', cleanup);
|
||||
}
|
||||
|
||||
source.on('end', cleanup);
|
||||
source.on('close', cleanup);
|
||||
|
||||
dest.on('close', cleanup);
|
||||
|
||||
dest.emit('pipe', source);
|
||||
|
||||
// Allow for unix-like usage: A.pipe(B).pipe(C)
|
||||
return dest;
|
||||
};
|
220
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/string-decoder.js
generated
vendored
Normal file
220
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/string-decoder.js
generated
vendored
Normal file
|
@ -0,0 +1,220 @@
|
|||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
import {Buffer} from 'buffer';
|
||||
var isBufferEncoding = Buffer.isEncoding
|
||||
|| function(encoding) {
|
||||
switch (encoding && encoding.toLowerCase()) {
|
||||
case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function assertEncoding(encoding) {
|
||||
if (encoding && !isBufferEncoding(encoding)) {
|
||||
throw new Error('Unknown encoding: ' + encoding);
|
||||
}
|
||||
}
|
||||
|
||||
// StringDecoder provides an interface for efficiently splitting a series of
|
||||
// buffers into a series of JS strings without breaking apart multi-byte
|
||||
// characters. CESU-8 is handled as part of the UTF-8 encoding.
|
||||
//
|
||||
// @TODO Handling all encodings inside a single object makes it very difficult
|
||||
// to reason about this code, so it should be split up in the future.
|
||||
// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
|
||||
// points as used by CESU-8.
|
||||
export function StringDecoder(encoding) {
|
||||
this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
|
||||
assertEncoding(encoding);
|
||||
switch (this.encoding) {
|
||||
case 'utf8':
|
||||
// CESU-8 represents each of Surrogate Pair by 3-bytes
|
||||
this.surrogateSize = 3;
|
||||
break;
|
||||
case 'ucs2':
|
||||
case 'utf16le':
|
||||
// UTF-16 represents each of Surrogate Pair by 2-bytes
|
||||
this.surrogateSize = 2;
|
||||
this.detectIncompleteChar = utf16DetectIncompleteChar;
|
||||
break;
|
||||
case 'base64':
|
||||
// Base-64 stores 3 bytes in 4 chars, and pads the remainder.
|
||||
this.surrogateSize = 3;
|
||||
this.detectIncompleteChar = base64DetectIncompleteChar;
|
||||
break;
|
||||
default:
|
||||
this.write = passThroughWrite;
|
||||
return;
|
||||
}
|
||||
|
||||
// Enough space to store all bytes of a single character. UTF-8 needs 4
|
||||
// bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
|
||||
this.charBuffer = new Buffer(6);
|
||||
// Number of bytes received for the current incomplete multi-byte character.
|
||||
this.charReceived = 0;
|
||||
// Number of bytes expected for the current incomplete multi-byte character.
|
||||
this.charLength = 0;
|
||||
};
|
||||
|
||||
|
||||
// write decodes the given buffer and returns it as JS string that is
|
||||
// guaranteed to not contain any partial multi-byte characters. Any partial
|
||||
// character found at the end of the buffer is buffered up, and will be
|
||||
// returned when calling write again with the remaining bytes.
|
||||
//
|
||||
// Note: Converting a Buffer containing an orphan surrogate to a String
|
||||
// currently works, but converting a String to a Buffer (via `new Buffer`, or
|
||||
// Buffer#write) will replace incomplete surrogates with the unicode
|
||||
// replacement character. See https://codereview.chromium.org/121173009/ .
|
||||
StringDecoder.prototype.write = function(buffer) {
|
||||
var charStr = '';
|
||||
// if our last write ended with an incomplete multibyte character
|
||||
while (this.charLength) {
|
||||
// determine how many remaining bytes this buffer has to offer for this char
|
||||
var available = (buffer.length >= this.charLength - this.charReceived) ?
|
||||
this.charLength - this.charReceived :
|
||||
buffer.length;
|
||||
|
||||
// add the new bytes to the char buffer
|
||||
buffer.copy(this.charBuffer, this.charReceived, 0, available);
|
||||
this.charReceived += available;
|
||||
|
||||
if (this.charReceived < this.charLength) {
|
||||
// still not enough chars in this buffer? wait for more ...
|
||||
return '';
|
||||
}
|
||||
|
||||
// remove bytes belonging to the current character from the buffer
|
||||
buffer = buffer.slice(available, buffer.length);
|
||||
|
||||
// get the character that was split
|
||||
charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
|
||||
|
||||
// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
|
||||
var charCode = charStr.charCodeAt(charStr.length - 1);
|
||||
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
||||
this.charLength += this.surrogateSize;
|
||||
charStr = '';
|
||||
continue;
|
||||
}
|
||||
this.charReceived = this.charLength = 0;
|
||||
|
||||
// if there are no more bytes in this buffer, just emit our char
|
||||
if (buffer.length === 0) {
|
||||
return charStr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// determine and set charLength / charReceived
|
||||
this.detectIncompleteChar(buffer);
|
||||
|
||||
var end = buffer.length;
|
||||
if (this.charLength) {
|
||||
// buffer the incomplete character bytes we got
|
||||
buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
|
||||
end -= this.charReceived;
|
||||
}
|
||||
|
||||
charStr += buffer.toString(this.encoding, 0, end);
|
||||
|
||||
var end = charStr.length - 1;
|
||||
var charCode = charStr.charCodeAt(end);
|
||||
// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
|
||||
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
||||
var size = this.surrogateSize;
|
||||
this.charLength += size;
|
||||
this.charReceived += size;
|
||||
this.charBuffer.copy(this.charBuffer, size, 0, size);
|
||||
buffer.copy(this.charBuffer, 0, 0, size);
|
||||
return charStr.substring(0, end);
|
||||
}
|
||||
|
||||
// or just emit the charStr
|
||||
return charStr;
|
||||
};
|
||||
|
||||
// detectIncompleteChar determines if there is an incomplete UTF-8 character at
|
||||
// the end of the given buffer. If so, it sets this.charLength to the byte
|
||||
// length that character, and sets this.charReceived to the number of bytes
|
||||
// that are available for this character.
|
||||
StringDecoder.prototype.detectIncompleteChar = function(buffer) {
|
||||
// determine how many bytes we have to check at the end of this buffer
|
||||
var i = (buffer.length >= 3) ? 3 : buffer.length;
|
||||
|
||||
// Figure out if one of the last i bytes of our buffer announces an
|
||||
// incomplete char.
|
||||
for (; i > 0; i--) {
|
||||
var c = buffer[buffer.length - i];
|
||||
|
||||
// See http://en.wikipedia.org/wiki/UTF-8#Description
|
||||
|
||||
// 110XXXXX
|
||||
if (i == 1 && c >> 5 == 0x06) {
|
||||
this.charLength = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
// 1110XXXX
|
||||
if (i <= 2 && c >> 4 == 0x0E) {
|
||||
this.charLength = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
// 11110XXX
|
||||
if (i <= 3 && c >> 3 == 0x1E) {
|
||||
this.charLength = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.charReceived = i;
|
||||
};
|
||||
|
||||
StringDecoder.prototype.end = function(buffer) {
|
||||
var res = '';
|
||||
if (buffer && buffer.length)
|
||||
res = this.write(buffer);
|
||||
|
||||
if (this.charReceived) {
|
||||
var cr = this.charReceived;
|
||||
var buf = this.charBuffer;
|
||||
var enc = this.encoding;
|
||||
res += buf.slice(0, cr).toString(enc);
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
function passThroughWrite(buffer) {
|
||||
return buffer.toString(this.encoding);
|
||||
}
|
||||
|
||||
function utf16DetectIncompleteChar(buffer) {
|
||||
this.charReceived = buffer.length % 2;
|
||||
this.charLength = this.charReceived ? 2 : 0;
|
||||
}
|
||||
|
||||
function base64DetectIncompleteChar(buffer) {
|
||||
this.charReceived = buffer.length % 3;
|
||||
this.charLength = this.charReceived ? 3 : 0;
|
||||
}
|
76
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/timers.js
generated
vendored
Normal file
76
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/timers.js
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
// License https://jryans.mit-license.org/
|
||||
|
||||
import {setImmediate, clearImmediate} from './setimmediate';
|
||||
export {setImmediate, clearImmediate};
|
||||
// DOM APIs, for completeness
|
||||
var apply = Function.prototype.apply;
|
||||
|
||||
export function clearInterval(timeout) {
|
||||
if (typeof timeout === 'number' && typeof global.clearInterval === 'function') {
|
||||
global.clearInterval(timeout);
|
||||
} else {
|
||||
clearFn(timeout)
|
||||
}
|
||||
}
|
||||
export function clearTimeout(timeout) {
|
||||
if (typeof timeout === 'number' && typeof global.clearTimeout === 'function') {
|
||||
global.clearTimeout(timeout);
|
||||
} else {
|
||||
clearFn(timeout)
|
||||
}
|
||||
}
|
||||
function clearFn(timeout) {
|
||||
if (timeout && typeof timeout.close === 'function') {
|
||||
timeout.close();
|
||||
}
|
||||
}
|
||||
export function setTimeout() {
|
||||
return new Timeout(apply.call(global.setTimeout, window, arguments), clearTimeout);
|
||||
}
|
||||
export function setInterval() {
|
||||
return new Timeout(apply.call(global.setInterval, window, arguments), clearInterval);
|
||||
}
|
||||
|
||||
function Timeout(id) {
|
||||
this._id = id;
|
||||
}
|
||||
Timeout.prototype.unref = Timeout.prototype.ref = function() {};
|
||||
Timeout.prototype.close = function() {
|
||||
clearFn(this._id);
|
||||
}
|
||||
|
||||
// Does not start the time, just sets up the members needed.
|
||||
export function enroll(item, msecs) {
|
||||
clearTimeout(item._idleTimeoutId);
|
||||
item._idleTimeout = msecs;
|
||||
}
|
||||
|
||||
export function unenroll(item) {
|
||||
clearTimeout(item._idleTimeoutId);
|
||||
item._idleTimeout = -1;
|
||||
}
|
||||
export var _unrefActive = active;
|
||||
export function active(item) {
|
||||
clearTimeout(item._idleTimeoutId);
|
||||
|
||||
var msecs = item._idleTimeout;
|
||||
if (msecs >= 0) {
|
||||
item._idleTimeoutId = setTimeout(function onTimeout() {
|
||||
if (item._onTimeout)
|
||||
item._onTimeout();
|
||||
}, msecs);
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
setImmediate: setImmediate,
|
||||
clearImmediate: clearImmediate,
|
||||
setTimeout: setTimeout,
|
||||
clearTimeout: clearTimeout,
|
||||
setInterval: setInterval,
|
||||
clearInterval: clearInterval,
|
||||
active: active,
|
||||
unenroll: unenroll,
|
||||
_unrefActive: _unrefActive,
|
||||
enroll: enroll
|
||||
};
|
20
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/tty.js
generated
vendored
Normal file
20
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/tty.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
// MIT lisence
|
||||
// from https://github.com/substack/tty-browserify/blob/1ba769a6429d242f36226538835b4034bf6b7886/index.js
|
||||
|
||||
export function isatty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function ReadStream() {
|
||||
throw new Error('tty.ReadStream is not implemented');
|
||||
}
|
||||
|
||||
export function WriteStream() {
|
||||
throw new Error('tty.ReadStream is not implemented');
|
||||
}
|
||||
|
||||
export default {
|
||||
isatty: isatty,
|
||||
ReadStream: ReadStream,
|
||||
WriteStream: WriteStream
|
||||
}
|
745
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/url.js
generated
vendored
Normal file
745
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/url.js
generated
vendored
Normal file
|
@ -0,0 +1,745 @@
|
|||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
|
||||
import {toASCII} from 'punycode';
|
||||
import {isObject,isString,isNullOrUndefined,isNull} from 'util';
|
||||
import {parse as qsParse,stringify as qsStringify} from 'querystring';
|
||||
export {
|
||||
urlParse as parse,
|
||||
urlResolve as resolve,
|
||||
urlResolveObject as resolveObject,
|
||||
urlFormat as format
|
||||
};
|
||||
export default {
|
||||
parse: urlParse,
|
||||
resolve: urlResolve,
|
||||
resolveObject: urlResolveObject,
|
||||
format: urlFormat,
|
||||
Url: Url
|
||||
}
|
||||
export function Url() {
|
||||
this.protocol = null;
|
||||
this.slashes = null;
|
||||
this.auth = null;
|
||||
this.host = null;
|
||||
this.port = null;
|
||||
this.hostname = null;
|
||||
this.hash = null;
|
||||
this.search = null;
|
||||
this.query = null;
|
||||
this.pathname = null;
|
||||
this.path = null;
|
||||
this.href = null;
|
||||
}
|
||||
|
||||
// Reference: RFC 3986, RFC 1808, RFC 2396
|
||||
|
||||
// define these here so at least they only have to be
|
||||
// compiled once on the first module load.
|
||||
var protocolPattern = /^([a-z0-9.+-]+:)/i,
|
||||
portPattern = /:[0-9]*$/,
|
||||
|
||||
// Special case for a simple path URL
|
||||
simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
|
||||
|
||||
// RFC 2396: characters reserved for delimiting URLs.
|
||||
// We actually just auto-escape these.
|
||||
delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
|
||||
|
||||
// RFC 2396: characters not allowed for various reasons.
|
||||
unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
|
||||
|
||||
// Allowed by RFCs, but cause of XSS attacks. Always escape these.
|
||||
autoEscape = ['\''].concat(unwise),
|
||||
// Characters that are never ever allowed in a hostname.
|
||||
// Note that any invalid chars are also handled, but these
|
||||
// are the ones that are *expected* to be seen, so we fast-path
|
||||
// them.
|
||||
nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
|
||||
hostEndingChars = ['/', '?', '#'],
|
||||
hostnameMaxLen = 255,
|
||||
hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
|
||||
hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
|
||||
// protocols that can allow "unsafe" and "unwise" chars.
|
||||
unsafeProtocol = {
|
||||
'javascript': true,
|
||||
'javascript:': true
|
||||
},
|
||||
// protocols that never have a hostname.
|
||||
hostlessProtocol = {
|
||||
'javascript': true,
|
||||
'javascript:': true
|
||||
},
|
||||
// protocols that always contain a // bit.
|
||||
slashedProtocol = {
|
||||
'http': true,
|
||||
'https': true,
|
||||
'ftp': true,
|
||||
'gopher': true,
|
||||
'file': true,
|
||||
'http:': true,
|
||||
'https:': true,
|
||||
'ftp:': true,
|
||||
'gopher:': true,
|
||||
'file:': true
|
||||
};
|
||||
|
||||
function urlParse(url, parseQueryString, slashesDenoteHost) {
|
||||
if (url && isObject(url) && url instanceof Url) return url;
|
||||
|
||||
var u = new Url;
|
||||
u.parse(url, parseQueryString, slashesDenoteHost);
|
||||
return u;
|
||||
}
|
||||
Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
|
||||
return parse(this, url, parseQueryString, slashesDenoteHost);
|
||||
}
|
||||
|
||||
function parse(self, url, parseQueryString, slashesDenoteHost) {
|
||||
if (!isString(url)) {
|
||||
throw new TypeError('Parameter \'url\' must be a string, not ' + typeof url);
|
||||
}
|
||||
|
||||
// Copy chrome, IE, opera backslash-handling behavior.
|
||||
// Back slashes before the query string get converted to forward slashes
|
||||
// See: https://code.google.com/p/chromium/issues/detail?id=25916
|
||||
var queryIndex = url.indexOf('?'),
|
||||
splitter =
|
||||
(queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
|
||||
uSplit = url.split(splitter),
|
||||
slashRegex = /\\/g;
|
||||
uSplit[0] = uSplit[0].replace(slashRegex, '/');
|
||||
url = uSplit.join(splitter);
|
||||
|
||||
var rest = url;
|
||||
|
||||
// trim before proceeding.
|
||||
// This is to support parse stuff like " http://foo.com \n"
|
||||
rest = rest.trim();
|
||||
|
||||
if (!slashesDenoteHost && url.split('#').length === 1) {
|
||||
// Try fast path regexp
|
||||
var simplePath = simplePathPattern.exec(rest);
|
||||
if (simplePath) {
|
||||
self.path = rest;
|
||||
self.href = rest;
|
||||
self.pathname = simplePath[1];
|
||||
if (simplePath[2]) {
|
||||
self.search = simplePath[2];
|
||||
if (parseQueryString) {
|
||||
self.query = qsParse(self.search.substr(1));
|
||||
} else {
|
||||
self.query = self.search.substr(1);
|
||||
}
|
||||
} else if (parseQueryString) {
|
||||
self.search = '';
|
||||
self.query = {};
|
||||
}
|
||||
return self;
|
||||
}
|
||||
}
|
||||
|
||||
var proto = protocolPattern.exec(rest);
|
||||
if (proto) {
|
||||
proto = proto[0];
|
||||
var lowerProto = proto.toLowerCase();
|
||||
self.protocol = lowerProto;
|
||||
rest = rest.substr(proto.length);
|
||||
}
|
||||
|
||||
// figure out if it's got a host
|
||||
// user@server is *always* interpreted as a hostname, and url
|
||||
// resolution will treat //foo/bar as host=foo,path=bar because that's
|
||||
// how the browser resolves relative URLs.
|
||||
if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
|
||||
var slashes = rest.substr(0, 2) === '//';
|
||||
if (slashes && !(proto && hostlessProtocol[proto])) {
|
||||
rest = rest.substr(2);
|
||||
self.slashes = true;
|
||||
}
|
||||
}
|
||||
var i, hec, l, p;
|
||||
if (!hostlessProtocol[proto] &&
|
||||
(slashes || (proto && !slashedProtocol[proto]))) {
|
||||
|
||||
// there's a hostname.
|
||||
// the first instance of /, ?, ;, or # ends the host.
|
||||
//
|
||||
// If there is an @ in the hostname, then non-host chars *are* allowed
|
||||
// to the left of the last @ sign, unless some host-ending character
|
||||
// comes *before* the @-sign.
|
||||
// URLs are obnoxious.
|
||||
//
|
||||
// ex:
|
||||
// http://a@b@c/ => user:a@b host:c
|
||||
// http://a@b?@c => user:a host:c path:/?@c
|
||||
|
||||
// v0.12 TODO(isaacs): This is not quite how Chrome does things.
|
||||
// Review our test case against browsers more comprehensively.
|
||||
|
||||
// find the first instance of any hostEndingChars
|
||||
var hostEnd = -1;
|
||||
for (i = 0; i < hostEndingChars.length; i++) {
|
||||
hec = rest.indexOf(hostEndingChars[i]);
|
||||
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
||||
hostEnd = hec;
|
||||
}
|
||||
|
||||
// at this point, either we have an explicit point where the
|
||||
// auth portion cannot go past, or the last @ char is the decider.
|
||||
var auth, atSign;
|
||||
if (hostEnd === -1) {
|
||||
// atSign can be anywhere.
|
||||
atSign = rest.lastIndexOf('@');
|
||||
} else {
|
||||
// atSign must be in auth portion.
|
||||
// http://a@b/c@d => host:b auth:a path:/c@d
|
||||
atSign = rest.lastIndexOf('@', hostEnd);
|
||||
}
|
||||
|
||||
// Now we have a portion which is definitely the auth.
|
||||
// Pull that off.
|
||||
if (atSign !== -1) {
|
||||
auth = rest.slice(0, atSign);
|
||||
rest = rest.slice(atSign + 1);
|
||||
self.auth = decodeURIComponent(auth);
|
||||
}
|
||||
|
||||
// the host is the remaining to the left of the first non-host char
|
||||
hostEnd = -1;
|
||||
for (i = 0; i < nonHostChars.length; i++) {
|
||||
hec = rest.indexOf(nonHostChars[i]);
|
||||
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
||||
hostEnd = hec;
|
||||
}
|
||||
// if we still have not hit it, then the entire thing is a host.
|
||||
if (hostEnd === -1)
|
||||
hostEnd = rest.length;
|
||||
|
||||
self.host = rest.slice(0, hostEnd);
|
||||
rest = rest.slice(hostEnd);
|
||||
|
||||
// pull out port.
|
||||
parseHost(self);
|
||||
|
||||
// we've indicated that there is a hostname,
|
||||
// so even if it's empty, it has to be present.
|
||||
self.hostname = self.hostname || '';
|
||||
|
||||
// if hostname begins with [ and ends with ]
|
||||
// assume that it's an IPv6 address.
|
||||
var ipv6Hostname = self.hostname[0] === '[' &&
|
||||
self.hostname[self.hostname.length - 1] === ']';
|
||||
|
||||
// validate a little.
|
||||
if (!ipv6Hostname) {
|
||||
var hostparts = self.hostname.split(/\./);
|
||||
for (i = 0, l = hostparts.length; i < l; i++) {
|
||||
var part = hostparts[i];
|
||||
if (!part) continue;
|
||||
if (!part.match(hostnamePartPattern)) {
|
||||
var newpart = '';
|
||||
for (var j = 0, k = part.length; j < k; j++) {
|
||||
if (part.charCodeAt(j) > 127) {
|
||||
// we replace non-ASCII char with a temporary placeholder
|
||||
// we need this to make sure size of hostname is not
|
||||
// broken by replacing non-ASCII by nothing
|
||||
newpart += 'x';
|
||||
} else {
|
||||
newpart += part[j];
|
||||
}
|
||||
}
|
||||
// we test again with ASCII char only
|
||||
if (!newpart.match(hostnamePartPattern)) {
|
||||
var validParts = hostparts.slice(0, i);
|
||||
var notHost = hostparts.slice(i + 1);
|
||||
var bit = part.match(hostnamePartStart);
|
||||
if (bit) {
|
||||
validParts.push(bit[1]);
|
||||
notHost.unshift(bit[2]);
|
||||
}
|
||||
if (notHost.length) {
|
||||
rest = '/' + notHost.join('.') + rest;
|
||||
}
|
||||
self.hostname = validParts.join('.');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (self.hostname.length > hostnameMaxLen) {
|
||||
self.hostname = '';
|
||||
} else {
|
||||
// hostnames are always lower case.
|
||||
self.hostname = self.hostname.toLowerCase();
|
||||
}
|
||||
|
||||
if (!ipv6Hostname) {
|
||||
// IDNA Support: Returns a punycoded representation of "domain".
|
||||
// It only converts parts of the domain name that
|
||||
// have non-ASCII characters, i.e. it doesn't matter if
|
||||
// you call it with a domain that already is ASCII-only.
|
||||
self.hostname = toASCII(self.hostname);
|
||||
}
|
||||
|
||||
p = self.port ? ':' + self.port : '';
|
||||
var h = self.hostname || '';
|
||||
self.host = h + p;
|
||||
self.href += self.host;
|
||||
|
||||
// strip [ and ] from the hostname
|
||||
// the host field still retains them, though
|
||||
if (ipv6Hostname) {
|
||||
self.hostname = self.hostname.substr(1, self.hostname.length - 2);
|
||||
if (rest[0] !== '/') {
|
||||
rest = '/' + rest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now rest is set to the post-host stuff.
|
||||
// chop off any delim chars.
|
||||
if (!unsafeProtocol[lowerProto]) {
|
||||
|
||||
// First, make 100% sure that any "autoEscape" chars get
|
||||
// escaped, even if encodeURIComponent doesn't think they
|
||||
// need to be.
|
||||
for (i = 0, l = autoEscape.length; i < l; i++) {
|
||||
var ae = autoEscape[i];
|
||||
if (rest.indexOf(ae) === -1)
|
||||
continue;
|
||||
var esc = encodeURIComponent(ae);
|
||||
if (esc === ae) {
|
||||
esc = escape(ae);
|
||||
}
|
||||
rest = rest.split(ae).join(esc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// chop off from the tail first.
|
||||
var hash = rest.indexOf('#');
|
||||
if (hash !== -1) {
|
||||
// got a fragment string.
|
||||
self.hash = rest.substr(hash);
|
||||
rest = rest.slice(0, hash);
|
||||
}
|
||||
var qm = rest.indexOf('?');
|
||||
if (qm !== -1) {
|
||||
self.search = rest.substr(qm);
|
||||
self.query = rest.substr(qm + 1);
|
||||
if (parseQueryString) {
|
||||
self.query = qsParse(self.query);
|
||||
}
|
||||
rest = rest.slice(0, qm);
|
||||
} else if (parseQueryString) {
|
||||
// no query string, but parseQueryString still requested
|
||||
self.search = '';
|
||||
self.query = {};
|
||||
}
|
||||
if (rest) self.pathname = rest;
|
||||
if (slashedProtocol[lowerProto] &&
|
||||
self.hostname && !self.pathname) {
|
||||
self.pathname = '/';
|
||||
}
|
||||
|
||||
//to support http.request
|
||||
if (self.pathname || self.search) {
|
||||
p = self.pathname || '';
|
||||
var s = self.search || '';
|
||||
self.path = p + s;
|
||||
}
|
||||
|
||||
// finally, reconstruct the href based on what has been validated.
|
||||
self.href = format(self);
|
||||
return self;
|
||||
}
|
||||
|
||||
// format a parsed object into a url string
|
||||
function urlFormat(obj) {
|
||||
// ensure it's an object, and not a string url.
|
||||
// If it's an obj, this is a no-op.
|
||||
// this way, you can call url_format() on strings
|
||||
// to clean up potentially wonky urls.
|
||||
if (isString(obj)) obj = parse({}, obj);
|
||||
return format(obj);
|
||||
}
|
||||
|
||||
function format(self) {
|
||||
var auth = self.auth || '';
|
||||
if (auth) {
|
||||
auth = encodeURIComponent(auth);
|
||||
auth = auth.replace(/%3A/i, ':');
|
||||
auth += '@';
|
||||
}
|
||||
|
||||
var protocol = self.protocol || '',
|
||||
pathname = self.pathname || '',
|
||||
hash = self.hash || '',
|
||||
host = false,
|
||||
query = '';
|
||||
|
||||
if (self.host) {
|
||||
host = auth + self.host;
|
||||
} else if (self.hostname) {
|
||||
host = auth + (self.hostname.indexOf(':') === -1 ?
|
||||
self.hostname :
|
||||
'[' + this.hostname + ']');
|
||||
if (self.port) {
|
||||
host += ':' + self.port;
|
||||
}
|
||||
}
|
||||
|
||||
if (self.query &&
|
||||
isObject(self.query) &&
|
||||
Object.keys(self.query).length) {
|
||||
query = qsStringify(self.query);
|
||||
}
|
||||
|
||||
var search = self.search || (query && ('?' + query)) || '';
|
||||
|
||||
if (protocol && protocol.substr(-1) !== ':') protocol += ':';
|
||||
|
||||
// only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
|
||||
// unless they had them to begin with.
|
||||
if (self.slashes ||
|
||||
(!protocol || slashedProtocol[protocol]) && host !== false) {
|
||||
host = '//' + (host || '');
|
||||
if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
|
||||
} else if (!host) {
|
||||
host = '';
|
||||
}
|
||||
|
||||
if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
|
||||
if (search && search.charAt(0) !== '?') search = '?' + search;
|
||||
|
||||
pathname = pathname.replace(/[?#]/g, function(match) {
|
||||
return encodeURIComponent(match);
|
||||
});
|
||||
search = search.replace('#', '%23');
|
||||
|
||||
return protocol + host + pathname + search + hash;
|
||||
}
|
||||
|
||||
Url.prototype.format = function() {
|
||||
return format(this);
|
||||
}
|
||||
|
||||
function urlResolve(source, relative) {
|
||||
return urlParse(source, false, true).resolve(relative);
|
||||
}
|
||||
|
||||
Url.prototype.resolve = function(relative) {
|
||||
return this.resolveObject(urlParse(relative, false, true)).format();
|
||||
};
|
||||
|
||||
function urlResolveObject(source, relative) {
|
||||
if (!source) return relative;
|
||||
return urlParse(source, false, true).resolveObject(relative);
|
||||
}
|
||||
|
||||
Url.prototype.resolveObject = function(relative) {
|
||||
if (isString(relative)) {
|
||||
var rel = new Url();
|
||||
rel.parse(relative, false, true);
|
||||
relative = rel;
|
||||
}
|
||||
|
||||
var result = new Url();
|
||||
var tkeys = Object.keys(this);
|
||||
for (var tk = 0; tk < tkeys.length; tk++) {
|
||||
var tkey = tkeys[tk];
|
||||
result[tkey] = this[tkey];
|
||||
}
|
||||
|
||||
// hash is always overridden, no matter what.
|
||||
// even href="" will remove it.
|
||||
result.hash = relative.hash;
|
||||
|
||||
// if the relative url is empty, then there's nothing left to do here.
|
||||
if (relative.href === '') {
|
||||
result.href = result.format();
|
||||
return result;
|
||||
}
|
||||
|
||||
// hrefs like //foo/bar always cut to the protocol.
|
||||
if (relative.slashes && !relative.protocol) {
|
||||
// take everything except the protocol from relative
|
||||
var rkeys = Object.keys(relative);
|
||||
for (var rk = 0; rk < rkeys.length; rk++) {
|
||||
var rkey = rkeys[rk];
|
||||
if (rkey !== 'protocol')
|
||||
result[rkey] = relative[rkey];
|
||||
}
|
||||
|
||||
//urlParse appends trailing / to urls like http://www.example.com
|
||||
if (slashedProtocol[result.protocol] &&
|
||||
result.hostname && !result.pathname) {
|
||||
result.path = result.pathname = '/';
|
||||
}
|
||||
|
||||
result.href = result.format();
|
||||
return result;
|
||||
}
|
||||
var relPath;
|
||||
if (relative.protocol && relative.protocol !== result.protocol) {
|
||||
// if it's a known url protocol, then changing
|
||||
// the protocol does weird things
|
||||
// first, if it's not file:, then we MUST have a host,
|
||||
// and if there was a path
|
||||
// to begin with, then we MUST have a path.
|
||||
// if it is file:, then the host is dropped,
|
||||
// because that's known to be hostless.
|
||||
// anything else is assumed to be absolute.
|
||||
if (!slashedProtocol[relative.protocol]) {
|
||||
var keys = Object.keys(relative);
|
||||
for (var v = 0; v < keys.length; v++) {
|
||||
var k = keys[v];
|
||||
result[k] = relative[k];
|
||||
}
|
||||
result.href = result.format();
|
||||
return result;
|
||||
}
|
||||
|
||||
result.protocol = relative.protocol;
|
||||
if (!relative.host && !hostlessProtocol[relative.protocol]) {
|
||||
relPath = (relative.pathname || '').split('/');
|
||||
while (relPath.length && !(relative.host = relPath.shift()));
|
||||
if (!relative.host) relative.host = '';
|
||||
if (!relative.hostname) relative.hostname = '';
|
||||
if (relPath[0] !== '') relPath.unshift('');
|
||||
if (relPath.length < 2) relPath.unshift('');
|
||||
result.pathname = relPath.join('/');
|
||||
} else {
|
||||
result.pathname = relative.pathname;
|
||||
}
|
||||
result.search = relative.search;
|
||||
result.query = relative.query;
|
||||
result.host = relative.host || '';
|
||||
result.auth = relative.auth;
|
||||
result.hostname = relative.hostname || relative.host;
|
||||
result.port = relative.port;
|
||||
// to support http.request
|
||||
if (result.pathname || result.search) {
|
||||
var p = result.pathname || '';
|
||||
var s = result.search || '';
|
||||
result.path = p + s;
|
||||
}
|
||||
result.slashes = result.slashes || relative.slashes;
|
||||
result.href = result.format();
|
||||
return result;
|
||||
}
|
||||
|
||||
var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
|
||||
isRelAbs = (
|
||||
relative.host ||
|
||||
relative.pathname && relative.pathname.charAt(0) === '/'
|
||||
),
|
||||
mustEndAbs = (isRelAbs || isSourceAbs ||
|
||||
(result.host && relative.pathname)),
|
||||
removeAllDots = mustEndAbs,
|
||||
srcPath = result.pathname && result.pathname.split('/') || [],
|
||||
psychotic = result.protocol && !slashedProtocol[result.protocol];
|
||||
relPath = relative.pathname && relative.pathname.split('/') || [];
|
||||
// if the url is a non-slashed url, then relative
|
||||
// links like ../.. should be able
|
||||
// to crawl up to the hostname, as well. This is strange.
|
||||
// result.protocol has already been set by now.
|
||||
// Later on, put the first path part into the host field.
|
||||
if (psychotic) {
|
||||
result.hostname = '';
|
||||
result.port = null;
|
||||
if (result.host) {
|
||||
if (srcPath[0] === '') srcPath[0] = result.host;
|
||||
else srcPath.unshift(result.host);
|
||||
}
|
||||
result.host = '';
|
||||
if (relative.protocol) {
|
||||
relative.hostname = null;
|
||||
relative.port = null;
|
||||
if (relative.host) {
|
||||
if (relPath[0] === '') relPath[0] = relative.host;
|
||||
else relPath.unshift(relative.host);
|
||||
}
|
||||
relative.host = null;
|
||||
}
|
||||
mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
|
||||
}
|
||||
var authInHost;
|
||||
if (isRelAbs) {
|
||||
// it's absolute.
|
||||
result.host = (relative.host || relative.host === '') ?
|
||||
relative.host : result.host;
|
||||
result.hostname = (relative.hostname || relative.hostname === '') ?
|
||||
relative.hostname : result.hostname;
|
||||
result.search = relative.search;
|
||||
result.query = relative.query;
|
||||
srcPath = relPath;
|
||||
// fall through to the dot-handling below.
|
||||
} else if (relPath.length) {
|
||||
// it's relative
|
||||
// throw away the existing file, and take the new path instead.
|
||||
if (!srcPath) srcPath = [];
|
||||
srcPath.pop();
|
||||
srcPath = srcPath.concat(relPath);
|
||||
result.search = relative.search;
|
||||
result.query = relative.query;
|
||||
} else if (!isNullOrUndefined(relative.search)) {
|
||||
// just pull out the search.
|
||||
// like href='?foo'.
|
||||
// Put this after the other two cases because it simplifies the booleans
|
||||
if (psychotic) {
|
||||
result.hostname = result.host = srcPath.shift();
|
||||
//occationaly the auth can get stuck only in host
|
||||
//this especially happens in cases like
|
||||
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
||||
authInHost = result.host && result.host.indexOf('@') > 0 ?
|
||||
result.host.split('@') : false;
|
||||
if (authInHost) {
|
||||
result.auth = authInHost.shift();
|
||||
result.host = result.hostname = authInHost.shift();
|
||||
}
|
||||
}
|
||||
result.search = relative.search;
|
||||
result.query = relative.query;
|
||||
//to support http.request
|
||||
if (!isNull(result.pathname) || !isNull(result.search)) {
|
||||
result.path = (result.pathname ? result.pathname : '') +
|
||||
(result.search ? result.search : '');
|
||||
}
|
||||
result.href = result.format();
|
||||
return result;
|
||||
}
|
||||
|
||||
if (!srcPath.length) {
|
||||
// no path at all. easy.
|
||||
// we've already handled the other stuff above.
|
||||
result.pathname = null;
|
||||
//to support http.request
|
||||
if (result.search) {
|
||||
result.path = '/' + result.search;
|
||||
} else {
|
||||
result.path = null;
|
||||
}
|
||||
result.href = result.format();
|
||||
return result;
|
||||
}
|
||||
|
||||
// if a url ENDs in . or .., then it must get a trailing slash.
|
||||
// however, if it ends in anything else non-slashy,
|
||||
// then it must NOT get a trailing slash.
|
||||
var last = srcPath.slice(-1)[0];
|
||||
var hasTrailingSlash = (
|
||||
(result.host || relative.host || srcPath.length > 1) &&
|
||||
(last === '.' || last === '..') || last === '');
|
||||
|
||||
// strip single dots, resolve double dots to parent dir
|
||||
// if the path tries to go above the root, `up` ends up > 0
|
||||
var up = 0;
|
||||
for (var i = srcPath.length; i >= 0; i--) {
|
||||
last = srcPath[i];
|
||||
if (last === '.') {
|
||||
srcPath.splice(i, 1);
|
||||
} else if (last === '..') {
|
||||
srcPath.splice(i, 1);
|
||||
up++;
|
||||
} else if (up) {
|
||||
srcPath.splice(i, 1);
|
||||
up--;
|
||||
}
|
||||
}
|
||||
|
||||
// if the path is allowed to go above the root, restore leading ..s
|
||||
if (!mustEndAbs && !removeAllDots) {
|
||||
for (; up--; up) {
|
||||
srcPath.unshift('..');
|
||||
}
|
||||
}
|
||||
|
||||
if (mustEndAbs && srcPath[0] !== '' &&
|
||||
(!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
|
||||
srcPath.unshift('');
|
||||
}
|
||||
|
||||
if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
|
||||
srcPath.push('');
|
||||
}
|
||||
|
||||
var isAbsolute = srcPath[0] === '' ||
|
||||
(srcPath[0] && srcPath[0].charAt(0) === '/');
|
||||
|
||||
// put the host back
|
||||
if (psychotic) {
|
||||
result.hostname = result.host = isAbsolute ? '' :
|
||||
srcPath.length ? srcPath.shift() : '';
|
||||
//occationaly the auth can get stuck only in host
|
||||
//this especially happens in cases like
|
||||
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
||||
authInHost = result.host && result.host.indexOf('@') > 0 ?
|
||||
result.host.split('@') : false;
|
||||
if (authInHost) {
|
||||
result.auth = authInHost.shift();
|
||||
result.host = result.hostname = authInHost.shift();
|
||||
}
|
||||
}
|
||||
|
||||
mustEndAbs = mustEndAbs || (result.host && srcPath.length);
|
||||
|
||||
if (mustEndAbs && !isAbsolute) {
|
||||
srcPath.unshift('');
|
||||
}
|
||||
|
||||
if (!srcPath.length) {
|
||||
result.pathname = null;
|
||||
result.path = null;
|
||||
} else {
|
||||
result.pathname = srcPath.join('/');
|
||||
}
|
||||
|
||||
//to support request.http
|
||||
if (!isNull(result.pathname) || !isNull(result.search)) {
|
||||
result.path = (result.pathname ? result.pathname : '') +
|
||||
(result.search ? result.search : '');
|
||||
}
|
||||
result.auth = relative.auth || result.auth;
|
||||
result.slashes = result.slashes || relative.slashes;
|
||||
result.href = result.format();
|
||||
return result;
|
||||
};
|
||||
|
||||
Url.prototype.parseHost = function() {
|
||||
return parseHost(this);
|
||||
};
|
||||
|
||||
function parseHost(self) {
|
||||
var host = self.host;
|
||||
var port = portPattern.exec(host);
|
||||
if (port) {
|
||||
port = port[0];
|
||||
if (port !== ':') {
|
||||
self.port = port.substr(1);
|
||||
}
|
||||
host = host.substr(0, host.length - port.length);
|
||||
}
|
||||
if (host) self.hostname = host;
|
||||
}
|
598
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/util.js
generated
vendored
Normal file
598
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/util.js
generated
vendored
Normal file
|
@ -0,0 +1,598 @@
|
|||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
import process from 'process';
|
||||
var formatRegExp = /%[sdj%]/g;
|
||||
export function format(f) {
|
||||
if (!isString(f)) {
|
||||
var objects = [];
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
objects.push(inspect(arguments[i]));
|
||||
}
|
||||
return objects.join(' ');
|
||||
}
|
||||
|
||||
var i = 1;
|
||||
var args = arguments;
|
||||
var len = args.length;
|
||||
var str = String(f).replace(formatRegExp, function(x) {
|
||||
if (x === '%%') return '%';
|
||||
if (i >= len) return x;
|
||||
switch (x) {
|
||||
case '%s': return String(args[i++]);
|
||||
case '%d': return Number(args[i++]);
|
||||
case '%j':
|
||||
try {
|
||||
return JSON.stringify(args[i++]);
|
||||
} catch (_) {
|
||||
return '[Circular]';
|
||||
}
|
||||
default:
|
||||
return x;
|
||||
}
|
||||
});
|
||||
for (var x = args[i]; i < len; x = args[++i]) {
|
||||
if (isNull(x) || !isObject(x)) {
|
||||
str += ' ' + x;
|
||||
} else {
|
||||
str += ' ' + inspect(x);
|
||||
}
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
|
||||
// Mark that a method should not be used.
|
||||
// Returns a modified function which warns once by default.
|
||||
// If --no-deprecation is set, then it is a no-op.
|
||||
export function deprecate(fn, msg) {
|
||||
// Allow for deprecating things in the process of starting up.
|
||||
if (isUndefined(global.process)) {
|
||||
return function() {
|
||||
return deprecate(fn, msg).apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
if (process.noDeprecation === true) {
|
||||
return fn;
|
||||
}
|
||||
|
||||
var warned = false;
|
||||
function deprecated() {
|
||||
if (!warned) {
|
||||
if (process.throwDeprecation) {
|
||||
throw new Error(msg);
|
||||
} else if (process.traceDeprecation) {
|
||||
console.trace(msg);
|
||||
} else {
|
||||
console.error(msg);
|
||||
}
|
||||
warned = true;
|
||||
}
|
||||
return fn.apply(this, arguments);
|
||||
}
|
||||
|
||||
return deprecated;
|
||||
};
|
||||
|
||||
|
||||
var debugs = {};
|
||||
var debugEnviron;
|
||||
export function debuglog(set) {
|
||||
if (isUndefined(debugEnviron))
|
||||
debugEnviron = process.env.NODE_DEBUG || '';
|
||||
set = set.toUpperCase();
|
||||
if (!debugs[set]) {
|
||||
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
||||
var pid = 0;
|
||||
debugs[set] = function() {
|
||||
var msg = format.apply(null, arguments);
|
||||
console.error('%s %d: %s', set, pid, msg);
|
||||
};
|
||||
} else {
|
||||
debugs[set] = function() {};
|
||||
}
|
||||
}
|
||||
return debugs[set];
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Echos the value of a value. Trys to print the value out
|
||||
* in the best way possible given the different types.
|
||||
*
|
||||
* @param {Object} obj The object to print out.
|
||||
* @param {Object} opts Optional options object that alters the output.
|
||||
*/
|
||||
/* legacy: obj, showHidden, depth, colors*/
|
||||
export function inspect(obj, opts) {
|
||||
// default options
|
||||
var ctx = {
|
||||
seen: [],
|
||||
stylize: stylizeNoColor
|
||||
};
|
||||
// legacy...
|
||||
if (arguments.length >= 3) ctx.depth = arguments[2];
|
||||
if (arguments.length >= 4) ctx.colors = arguments[3];
|
||||
if (isBoolean(opts)) {
|
||||
// legacy...
|
||||
ctx.showHidden = opts;
|
||||
} else if (opts) {
|
||||
// got an "options" object
|
||||
_extend(ctx, opts);
|
||||
}
|
||||
// set default options
|
||||
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
||||
if (isUndefined(ctx.depth)) ctx.depth = 2;
|
||||
if (isUndefined(ctx.colors)) ctx.colors = false;
|
||||
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
||||
if (ctx.colors) ctx.stylize = stylizeWithColor;
|
||||
return formatValue(ctx, obj, ctx.depth);
|
||||
}
|
||||
|
||||
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
||||
inspect.colors = {
|
||||
'bold' : [1, 22],
|
||||
'italic' : [3, 23],
|
||||
'underline' : [4, 24],
|
||||
'inverse' : [7, 27],
|
||||
'white' : [37, 39],
|
||||
'grey' : [90, 39],
|
||||
'black' : [30, 39],
|
||||
'blue' : [34, 39],
|
||||
'cyan' : [36, 39],
|
||||
'green' : [32, 39],
|
||||
'magenta' : [35, 39],
|
||||
'red' : [31, 39],
|
||||
'yellow' : [33, 39]
|
||||
};
|
||||
|
||||
// Don't use 'blue' not visible on cmd.exe
|
||||
inspect.styles = {
|
||||
'special': 'cyan',
|
||||
'number': 'yellow',
|
||||
'boolean': 'yellow',
|
||||
'undefined': 'grey',
|
||||
'null': 'bold',
|
||||
'string': 'green',
|
||||
'date': 'magenta',
|
||||
// "name": intentionally not styling
|
||||
'regexp': 'red'
|
||||
};
|
||||
|
||||
|
||||
function stylizeWithColor(str, styleType) {
|
||||
var style = inspect.styles[styleType];
|
||||
|
||||
if (style) {
|
||||
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
||||
'\u001b[' + inspect.colors[style][1] + 'm';
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function stylizeNoColor(str, styleType) {
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
function arrayToHash(array) {
|
||||
var hash = {};
|
||||
|
||||
array.forEach(function(val, idx) {
|
||||
hash[val] = true;
|
||||
});
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
function formatValue(ctx, value, recurseTimes) {
|
||||
// Provide a hook for user-specified inspect functions.
|
||||
// Check that value is an object with an inspect function on it
|
||||
if (ctx.customInspect &&
|
||||
value &&
|
||||
isFunction(value.inspect) &&
|
||||
// Filter out the util module, it's inspect function is special
|
||||
value.inspect !== inspect &&
|
||||
// Also filter out any prototype objects using the circular check.
|
||||
!(value.constructor && value.constructor.prototype === value)) {
|
||||
var ret = value.inspect(recurseTimes, ctx);
|
||||
if (!isString(ret)) {
|
||||
ret = formatValue(ctx, ret, recurseTimes);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Primitive types cannot have properties
|
||||
var primitive = formatPrimitive(ctx, value);
|
||||
if (primitive) {
|
||||
return primitive;
|
||||
}
|
||||
|
||||
// Look up the keys of the object.
|
||||
var keys = Object.keys(value);
|
||||
var visibleKeys = arrayToHash(keys);
|
||||
|
||||
if (ctx.showHidden) {
|
||||
keys = Object.getOwnPropertyNames(value);
|
||||
}
|
||||
|
||||
// IE doesn't make error fields non-enumerable
|
||||
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
|
||||
if (isError(value)
|
||||
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
||||
return formatError(value);
|
||||
}
|
||||
|
||||
// Some type of object without properties can be shortcutted.
|
||||
if (keys.length === 0) {
|
||||
if (isFunction(value)) {
|
||||
var name = value.name ? ': ' + value.name : '';
|
||||
return ctx.stylize('[Function' + name + ']', 'special');
|
||||
}
|
||||
if (isRegExp(value)) {
|
||||
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
}
|
||||
if (isDate(value)) {
|
||||
return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
||||
}
|
||||
if (isError(value)) {
|
||||
return formatError(value);
|
||||
}
|
||||
}
|
||||
|
||||
var base = '', array = false, braces = ['{', '}'];
|
||||
|
||||
// Make Array say that they are Array
|
||||
if (isArray(value)) {
|
||||
array = true;
|
||||
braces = ['[', ']'];
|
||||
}
|
||||
|
||||
// Make functions say that they are functions
|
||||
if (isFunction(value)) {
|
||||
var n = value.name ? ': ' + value.name : '';
|
||||
base = ' [Function' + n + ']';
|
||||
}
|
||||
|
||||
// Make RegExps say that they are RegExps
|
||||
if (isRegExp(value)) {
|
||||
base = ' ' + RegExp.prototype.toString.call(value);
|
||||
}
|
||||
|
||||
// Make dates with properties first say the date
|
||||
if (isDate(value)) {
|
||||
base = ' ' + Date.prototype.toUTCString.call(value);
|
||||
}
|
||||
|
||||
// Make error with message first say the error
|
||||
if (isError(value)) {
|
||||
base = ' ' + formatError(value);
|
||||
}
|
||||
|
||||
if (keys.length === 0 && (!array || value.length == 0)) {
|
||||
return braces[0] + base + braces[1];
|
||||
}
|
||||
|
||||
if (recurseTimes < 0) {
|
||||
if (isRegExp(value)) {
|
||||
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
} else {
|
||||
return ctx.stylize('[Object]', 'special');
|
||||
}
|
||||
}
|
||||
|
||||
ctx.seen.push(value);
|
||||
|
||||
var output;
|
||||
if (array) {
|
||||
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
||||
} else {
|
||||
output = keys.map(function(key) {
|
||||
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
||||
});
|
||||
}
|
||||
|
||||
ctx.seen.pop();
|
||||
|
||||
return reduceToSingleString(output, base, braces);
|
||||
}
|
||||
|
||||
|
||||
function formatPrimitive(ctx, value) {
|
||||
if (isUndefined(value))
|
||||
return ctx.stylize('undefined', 'undefined');
|
||||
if (isString(value)) {
|
||||
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
||||
.replace(/'/g, "\\'")
|
||||
.replace(/\\"/g, '"') + '\'';
|
||||
return ctx.stylize(simple, 'string');
|
||||
}
|
||||
if (isNumber(value))
|
||||
return ctx.stylize('' + value, 'number');
|
||||
if (isBoolean(value))
|
||||
return ctx.stylize('' + value, 'boolean');
|
||||
// For some reason typeof null is "object", so special case here.
|
||||
if (isNull(value))
|
||||
return ctx.stylize('null', 'null');
|
||||
}
|
||||
|
||||
|
||||
function formatError(value) {
|
||||
return '[' + Error.prototype.toString.call(value) + ']';
|
||||
}
|
||||
|
||||
|
||||
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
||||
var output = [];
|
||||
for (var i = 0, l = value.length; i < l; ++i) {
|
||||
if (hasOwnProperty(value, String(i))) {
|
||||
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
String(i), true));
|
||||
} else {
|
||||
output.push('');
|
||||
}
|
||||
}
|
||||
keys.forEach(function(key) {
|
||||
if (!key.match(/^\d+$/)) {
|
||||
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
key, true));
|
||||
}
|
||||
});
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
||||
var name, str, desc;
|
||||
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
||||
if (desc.get) {
|
||||
if (desc.set) {
|
||||
str = ctx.stylize('[Getter/Setter]', 'special');
|
||||
} else {
|
||||
str = ctx.stylize('[Getter]', 'special');
|
||||
}
|
||||
} else {
|
||||
if (desc.set) {
|
||||
str = ctx.stylize('[Setter]', 'special');
|
||||
}
|
||||
}
|
||||
if (!hasOwnProperty(visibleKeys, key)) {
|
||||
name = '[' + key + ']';
|
||||
}
|
||||
if (!str) {
|
||||
if (ctx.seen.indexOf(desc.value) < 0) {
|
||||
if (isNull(recurseTimes)) {
|
||||
str = formatValue(ctx, desc.value, null);
|
||||
} else {
|
||||
str = formatValue(ctx, desc.value, recurseTimes - 1);
|
||||
}
|
||||
if (str.indexOf('\n') > -1) {
|
||||
if (array) {
|
||||
str = str.split('\n').map(function(line) {
|
||||
return ' ' + line;
|
||||
}).join('\n').substr(2);
|
||||
} else {
|
||||
str = '\n' + str.split('\n').map(function(line) {
|
||||
return ' ' + line;
|
||||
}).join('\n');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
str = ctx.stylize('[Circular]', 'special');
|
||||
}
|
||||
}
|
||||
if (isUndefined(name)) {
|
||||
if (array && key.match(/^\d+$/)) {
|
||||
return str;
|
||||
}
|
||||
name = JSON.stringify('' + key);
|
||||
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
||||
name = name.substr(1, name.length - 2);
|
||||
name = ctx.stylize(name, 'name');
|
||||
} else {
|
||||
name = name.replace(/'/g, "\\'")
|
||||
.replace(/\\"/g, '"')
|
||||
.replace(/(^"|"$)/g, "'");
|
||||
name = ctx.stylize(name, 'string');
|
||||
}
|
||||
}
|
||||
|
||||
return name + ': ' + str;
|
||||
}
|
||||
|
||||
|
||||
function reduceToSingleString(output, base, braces) {
|
||||
var numLinesEst = 0;
|
||||
var length = output.reduce(function(prev, cur) {
|
||||
numLinesEst++;
|
||||
if (cur.indexOf('\n') >= 0) numLinesEst++;
|
||||
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
||||
}, 0);
|
||||
|
||||
if (length > 60) {
|
||||
return braces[0] +
|
||||
(base === '' ? '' : base + '\n ') +
|
||||
' ' +
|
||||
output.join(',\n ') +
|
||||
' ' +
|
||||
braces[1];
|
||||
}
|
||||
|
||||
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
||||
}
|
||||
|
||||
|
||||
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||||
// because it is fragile and can be easily faked with `Object.create()`.
|
||||
export function isArray(ar) {
|
||||
return Array.isArray(ar);
|
||||
}
|
||||
|
||||
export function isBoolean(arg) {
|
||||
return typeof arg === 'boolean';
|
||||
}
|
||||
|
||||
export function isNull(arg) {
|
||||
return arg === null;
|
||||
}
|
||||
|
||||
export function isNullOrUndefined(arg) {
|
||||
return arg == null;
|
||||
}
|
||||
|
||||
export function isNumber(arg) {
|
||||
return typeof arg === 'number';
|
||||
}
|
||||
|
||||
export function isString(arg) {
|
||||
return typeof arg === 'string';
|
||||
}
|
||||
|
||||
export function isSymbol(arg) {
|
||||
return typeof arg === 'symbol';
|
||||
}
|
||||
|
||||
export function isUndefined(arg) {
|
||||
return arg === void 0;
|
||||
}
|
||||
|
||||
export function isRegExp(re) {
|
||||
return isObject(re) && objectToString(re) === '[object RegExp]';
|
||||
}
|
||||
|
||||
export function isObject(arg) {
|
||||
return typeof arg === 'object' && arg !== null;
|
||||
}
|
||||
|
||||
export function isDate(d) {
|
||||
return isObject(d) && objectToString(d) === '[object Date]';
|
||||
}
|
||||
|
||||
export function isError(e) {
|
||||
return isObject(e) &&
|
||||
(objectToString(e) === '[object Error]' || e instanceof Error);
|
||||
}
|
||||
|
||||
export function isFunction(arg) {
|
||||
return typeof arg === 'function';
|
||||
}
|
||||
|
||||
export function isPrimitive(arg) {
|
||||
return arg === null ||
|
||||
typeof arg === 'boolean' ||
|
||||
typeof arg === 'number' ||
|
||||
typeof arg === 'string' ||
|
||||
typeof arg === 'symbol' || // ES6 symbol
|
||||
typeof arg === 'undefined';
|
||||
}
|
||||
|
||||
export function isBuffer(maybeBuf) {
|
||||
return Buffer.isBuffer(maybeBuf);
|
||||
}
|
||||
|
||||
function objectToString(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
}
|
||||
|
||||
|
||||
function pad(n) {
|
||||
return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
||||
}
|
||||
|
||||
|
||||
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
||||
'Oct', 'Nov', 'Dec'];
|
||||
|
||||
// 26 Feb 16:19:34
|
||||
function timestamp() {
|
||||
var d = new Date();
|
||||
var time = [pad(d.getHours()),
|
||||
pad(d.getMinutes()),
|
||||
pad(d.getSeconds())].join(':');
|
||||
return [d.getDate(), months[d.getMonth()], time].join(' ');
|
||||
}
|
||||
|
||||
|
||||
// log is just a thin wrapper to console.log that prepends a timestamp
|
||||
export function log() {
|
||||
console.log('%s - %s', timestamp(), format.apply(null, arguments));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inherit the prototype methods from one constructor into another.
|
||||
*
|
||||
* The Function.prototype.inherits from lang.js rewritten as a standalone
|
||||
* function (not on Function.prototype). NOTE: If this file is to be loaded
|
||||
* during bootstrapping this function needs to be rewritten using some native
|
||||
* functions as prototype setup using normal JavaScript does not work as
|
||||
* expected during bootstrapping (see mirror.js in r114903).
|
||||
*
|
||||
* @param {function} ctor Constructor function which needs to inherit the
|
||||
* prototype.
|
||||
* @param {function} superCtor Constructor function to inherit prototype from.
|
||||
*/
|
||||
import inherits from './inherits';
|
||||
export {inherits}
|
||||
|
||||
export function _extend(origin, add) {
|
||||
// Don't do anything if add isn't an object
|
||||
if (!add || !isObject(add)) return origin;
|
||||
|
||||
var keys = Object.keys(add);
|
||||
var i = keys.length;
|
||||
while (i--) {
|
||||
origin[keys[i]] = add[keys[i]];
|
||||
}
|
||||
return origin;
|
||||
};
|
||||
|
||||
function hasOwnProperty(obj, prop) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
}
|
||||
|
||||
export default {
|
||||
inherits: inherits,
|
||||
_extend: _extend,
|
||||
log: log,
|
||||
isBuffer: isBuffer,
|
||||
isPrimitive: isPrimitive,
|
||||
isFunction: isFunction,
|
||||
isError: isError,
|
||||
isDate: isDate,
|
||||
isObject: isObject,
|
||||
isRegExp: isRegExp,
|
||||
isUndefined: isUndefined,
|
||||
isSymbol: isSymbol,
|
||||
isString: isString,
|
||||
isNumber: isNumber,
|
||||
isNullOrUndefined: isNullOrUndefined,
|
||||
isNull: isNull,
|
||||
isBoolean: isBoolean,
|
||||
isArray: isArray,
|
||||
inspect: inspect,
|
||||
deprecate: deprecate,
|
||||
format: format,
|
||||
debuglog: debuglog
|
||||
}
|
202
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/vm.js
generated
vendored
Normal file
202
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/vm.js
generated
vendored
Normal file
|
@ -0,0 +1,202 @@
|
|||
/*
|
||||
from https://github.com/substack/vm-browserify/blob/bfd7c5f59edec856dc7efe0b77a4f6b2fa20f226/index.js
|
||||
|
||||
MIT license no Copyright holder mentioned
|
||||
*/
|
||||
|
||||
|
||||
function Object_keys(obj) {
|
||||
if (Object.keys) return Object.keys(obj)
|
||||
else {
|
||||
var res = [];
|
||||
for (var key in obj) res.push(key)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
function forEach(xs, fn) {
|
||||
if (xs.forEach) return xs.forEach(fn)
|
||||
else
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
fn(xs[i], i, xs);
|
||||
}
|
||||
}
|
||||
var _defineProp;
|
||||
|
||||
function defineProp(obj, name, value) {
|
||||
if (typeof _defineProp !== 'function') {
|
||||
_defineProp = createDefineProp;
|
||||
}
|
||||
_defineProp(obj, name, value);
|
||||
}
|
||||
|
||||
function createDefineProp() {
|
||||
try {
|
||||
Object.defineProperty({}, '_', {});
|
||||
return function(obj, name, value) {
|
||||
Object.defineProperty(obj, name, {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
value: value
|
||||
})
|
||||
};
|
||||
} catch (e) {
|
||||
return function(obj, name, value) {
|
||||
obj[name] = value;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',
|
||||
'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',
|
||||
'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',
|
||||
'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',
|
||||
'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'
|
||||
];
|
||||
|
||||
function Context() {}
|
||||
Context.prototype = {};
|
||||
|
||||
export function Script(code) {
|
||||
if (!(this instanceof Script)) return new Script(code);
|
||||
this.code = code;
|
||||
}
|
||||
function otherRunInContext(code, context) {
|
||||
var args = Object_keys(global);
|
||||
args.push('with (this.__ctx__){return eval(this.__code__)}');
|
||||
var fn = Function.apply(null, args);
|
||||
return fn.apply({
|
||||
__code__: code,
|
||||
__ctx__: context
|
||||
});
|
||||
}
|
||||
Script.prototype.runInContext = function(context) {
|
||||
if (!(context instanceof Context)) {
|
||||
throw new TypeError('needs a \'context\' argument.');
|
||||
}
|
||||
if (global.document) {
|
||||
var iframe = global.document.createElement('iframe');
|
||||
if (!iframe.style) iframe.style = {};
|
||||
iframe.style.display = 'none';
|
||||
|
||||
global.document.body.appendChild(iframe);
|
||||
|
||||
var win = iframe.contentWindow;
|
||||
var wEval = win.eval,
|
||||
wExecScript = win.execScript;
|
||||
|
||||
if (!wEval && wExecScript) {
|
||||
// win.eval() magically appears when this is called in IE:
|
||||
wExecScript.call(win, 'null');
|
||||
wEval = win.eval;
|
||||
}
|
||||
|
||||
forEach(Object_keys(context), function(key) {
|
||||
win[key] = context[key];
|
||||
});
|
||||
forEach(globals, function(key) {
|
||||
if (context[key]) {
|
||||
win[key] = context[key];
|
||||
}
|
||||
});
|
||||
|
||||
var winKeys = Object_keys(win);
|
||||
|
||||
var res = wEval.call(win, this.code);
|
||||
|
||||
forEach(Object_keys(win), function(key) {
|
||||
// Avoid copying circular objects like `top` and `window` by only
|
||||
// updating existing context properties or new properties in the `win`
|
||||
// that was only introduced after the eval.
|
||||
if (key in context || indexOf(winKeys, key) === -1) {
|
||||
context[key] = win[key];
|
||||
}
|
||||
});
|
||||
|
||||
forEach(globals, function(key) {
|
||||
if (!(key in context)) {
|
||||
defineProp(context, key, win[key]);
|
||||
}
|
||||
});
|
||||
global.document.body.removeChild(iframe);
|
||||
|
||||
return res;
|
||||
}
|
||||
return otherRunInContext(this.code, context);
|
||||
};
|
||||
|
||||
Script.prototype.runInThisContext = function() {
|
||||
var fn = new Function('code', 'return eval(code);');
|
||||
return fn.call(global, this.code); // maybe...
|
||||
};
|
||||
|
||||
Script.prototype.runInNewContext = function(context) {
|
||||
var ctx = createContext(context);
|
||||
var res = this.runInContext(ctx);
|
||||
if (context) {
|
||||
forEach(Object_keys(ctx), function(key) {
|
||||
context[key] = ctx[key];
|
||||
});
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
|
||||
export function createScript(code) {
|
||||
return new Script(code);
|
||||
}
|
||||
|
||||
export function createContext(context) {
|
||||
if (isContext(context)) {
|
||||
return context;
|
||||
}
|
||||
var copy = new Context();
|
||||
if (typeof context === 'object') {
|
||||
forEach(Object_keys(context), function(key) {
|
||||
copy[key] = context[key];
|
||||
});
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
export function runInContext(code, contextifiedSandbox, options) {
|
||||
var script = new Script(code, options);
|
||||
return script.runInContext(contextifiedSandbox, options);
|
||||
}
|
||||
export function runInThisContext(code, options) {
|
||||
var script = new Script(code, options);
|
||||
return script.runInThisContext(options);
|
||||
}
|
||||
export function isContext(context) {
|
||||
return context instanceof Context;
|
||||
}
|
||||
export function runInNewContext(code, sandbox, options) {
|
||||
var script = new Script(code, options);
|
||||
return script.runInNewContext(sandbox, options);
|
||||
}
|
||||
export default {
|
||||
runInContext: runInContext,
|
||||
isContext: isContext,
|
||||
createContext: createContext,
|
||||
createScript: createScript,
|
||||
Script: Script,
|
||||
runInThisContext: runInThisContext,
|
||||
runInNewContext: runInNewContext
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
from indexOf
|
||||
@ author tjholowaychuk
|
||||
@ license MIT
|
||||
*/
|
||||
var _indexOf = [].indexOf;
|
||||
|
||||
function indexOf(arr, obj){
|
||||
if (_indexOf) return arr.indexOf(obj);
|
||||
for (var i = 0; i < arr.length; ++i) {
|
||||
if (arr[i] === obj) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
21
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/LICENSE
generated
vendored
Normal file
21
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (C) 2014-2016 by Vitaly Puzrin
|
||||
|
||||
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.
|
31
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/adler32.js
generated
vendored
Normal file
31
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/adler32.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
// Note: adler32 takes 12% for level 0 and 2% for level 6.
|
||||
// It doesn't worth to make additional optimizationa as in original.
|
||||
// Small size is preferable.
|
||||
|
||||
function adler32(adler, buf, len, pos) {
|
||||
var s1 = (adler & 0xffff) |0,
|
||||
s2 = ((adler >>> 16) & 0xffff) |0,
|
||||
n = 0;
|
||||
|
||||
while (len !== 0) {
|
||||
// Set limit ~ twice less than 5552, to keep
|
||||
// s2 in 31-bits, because we force signed ints.
|
||||
// in other case %= will fail.
|
||||
n = len > 2000 ? 2000 : len;
|
||||
len -= n;
|
||||
|
||||
do {
|
||||
s1 = (s1 + buf[pos++]) |0;
|
||||
s2 = (s2 + s1) |0;
|
||||
} while (--n);
|
||||
|
||||
s1 %= 65521;
|
||||
s2 %= 65521;
|
||||
}
|
||||
|
||||
return (s1 | (s2 << 16)) |0;
|
||||
}
|
||||
|
||||
|
||||
export default adler32;
|
269
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/binding.js
generated
vendored
Normal file
269
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/binding.js
generated
vendored
Normal file
|
@ -0,0 +1,269 @@
|
|||
import msg from './messages';
|
||||
import zstream from './zstream';
|
||||
import {deflateInit2, deflateEnd, deflateReset, deflate} from './deflate';
|
||||
import {inflateInit2, inflate, inflateEnd, inflateReset} from './inflate';
|
||||
// import constants from './constants';
|
||||
|
||||
|
||||
// zlib modes
|
||||
export var NONE = 0;
|
||||
export var DEFLATE = 1;
|
||||
export var INFLATE = 2;
|
||||
export var GZIP = 3;
|
||||
export var GUNZIP = 4;
|
||||
export var DEFLATERAW = 5;
|
||||
export var INFLATERAW = 6;
|
||||
export var UNZIP = 7;
|
||||
export var Z_NO_FLUSH= 0,
|
||||
Z_PARTIAL_FLUSH= 1,
|
||||
Z_SYNC_FLUSH= 2,
|
||||
Z_FULL_FLUSH= 3,
|
||||
Z_FINISH= 4,
|
||||
Z_BLOCK= 5,
|
||||
Z_TREES= 6,
|
||||
|
||||
/* Return codes for the compression/decompression functions. Negative values
|
||||
* are errors, positive values are used for special but normal events.
|
||||
*/
|
||||
Z_OK= 0,
|
||||
Z_STREAM_END= 1,
|
||||
Z_NEED_DICT= 2,
|
||||
Z_ERRNO= -1,
|
||||
Z_STREAM_ERROR= -2,
|
||||
Z_DATA_ERROR= -3,
|
||||
//Z_MEM_ERROR: -4,
|
||||
Z_BUF_ERROR= -5,
|
||||
//Z_VERSION_ERROR: -6,
|
||||
|
||||
/* compression levels */
|
||||
Z_NO_COMPRESSION= 0,
|
||||
Z_BEST_SPEED= 1,
|
||||
Z_BEST_COMPRESSION= 9,
|
||||
Z_DEFAULT_COMPRESSION= -1,
|
||||
|
||||
|
||||
Z_FILTERED= 1,
|
||||
Z_HUFFMAN_ONLY= 2,
|
||||
Z_RLE= 3,
|
||||
Z_FIXED= 4,
|
||||
Z_DEFAULT_STRATEGY= 0,
|
||||
|
||||
/* Possible values of the data_type field (though see inflate()) */
|
||||
Z_BINARY= 0,
|
||||
Z_TEXT= 1,
|
||||
//Z_ASCII: 1, // = Z_TEXT (deprecated)
|
||||
Z_UNKNOWN= 2,
|
||||
|
||||
/* The deflate compression method */
|
||||
Z_DEFLATED= 8;
|
||||
export function Zlib(mode) {
|
||||
if (mode < DEFLATE || mode > UNZIP)
|
||||
throw new TypeError('Bad argument');
|
||||
|
||||
this.mode = mode;
|
||||
this.init_done = false;
|
||||
this.write_in_progress = false;
|
||||
this.pending_close = false;
|
||||
this.windowBits = 0;
|
||||
this.level = 0;
|
||||
this.memLevel = 0;
|
||||
this.strategy = 0;
|
||||
this.dictionary = null;
|
||||
}
|
||||
|
||||
Zlib.prototype.init = function(windowBits, level, memLevel, strategy, dictionary) {
|
||||
this.windowBits = windowBits;
|
||||
this.level = level;
|
||||
this.memLevel = memLevel;
|
||||
this.strategy = strategy;
|
||||
// dictionary not supported.
|
||||
|
||||
if (this.mode === GZIP || this.mode === GUNZIP)
|
||||
this.windowBits += 16;
|
||||
|
||||
if (this.mode === UNZIP)
|
||||
this.windowBits += 32;
|
||||
|
||||
if (this.mode === DEFLATERAW || this.mode === INFLATERAW)
|
||||
this.windowBits = -this.windowBits;
|
||||
|
||||
this.strm = new zstream();
|
||||
var status;
|
||||
switch (this.mode) {
|
||||
case DEFLATE:
|
||||
case GZIP:
|
||||
case DEFLATERAW:
|
||||
status = deflateInit2(
|
||||
this.strm,
|
||||
this.level,
|
||||
Z_DEFLATED,
|
||||
this.windowBits,
|
||||
this.memLevel,
|
||||
this.strategy
|
||||
);
|
||||
break;
|
||||
case INFLATE:
|
||||
case GUNZIP:
|
||||
case INFLATERAW:
|
||||
case UNZIP:
|
||||
status = inflateInit2(
|
||||
this.strm,
|
||||
this.windowBits
|
||||
);
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unknown mode ' + this.mode);
|
||||
}
|
||||
|
||||
if (status !== Z_OK) {
|
||||
this._error(status);
|
||||
return;
|
||||
}
|
||||
|
||||
this.write_in_progress = false;
|
||||
this.init_done = true;
|
||||
};
|
||||
|
||||
Zlib.prototype.params = function() {
|
||||
throw new Error('deflateParams Not supported');
|
||||
};
|
||||
|
||||
Zlib.prototype._writeCheck = function() {
|
||||
if (!this.init_done)
|
||||
throw new Error('write before init');
|
||||
|
||||
if (this.mode === NONE)
|
||||
throw new Error('already finalized');
|
||||
|
||||
if (this.write_in_progress)
|
||||
throw new Error('write already in progress');
|
||||
|
||||
if (this.pending_close)
|
||||
throw new Error('close is pending');
|
||||
};
|
||||
|
||||
Zlib.prototype.write = function(flush, input, in_off, in_len, out, out_off, out_len) {
|
||||
this._writeCheck();
|
||||
this.write_in_progress = true;
|
||||
|
||||
var self = this;
|
||||
process.nextTick(function() {
|
||||
self.write_in_progress = false;
|
||||
var res = self._write(flush, input, in_off, in_len, out, out_off, out_len);
|
||||
self.callback(res[0], res[1]);
|
||||
|
||||
if (self.pending_close)
|
||||
self.close();
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
// set method for Node buffers, used by pako
|
||||
function bufferSet(data, offset) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
this[offset + i] = data[i];
|
||||
}
|
||||
}
|
||||
|
||||
Zlib.prototype.writeSync = function(flush, input, in_off, in_len, out, out_off, out_len) {
|
||||
this._writeCheck();
|
||||
return this._write(flush, input, in_off, in_len, out, out_off, out_len);
|
||||
};
|
||||
|
||||
Zlib.prototype._write = function(flush, input, in_off, in_len, out, out_off, out_len) {
|
||||
this.write_in_progress = true;
|
||||
|
||||
if (flush !== Z_NO_FLUSH &&
|
||||
flush !== Z_PARTIAL_FLUSH &&
|
||||
flush !== Z_SYNC_FLUSH &&
|
||||
flush !== Z_FULL_FLUSH &&
|
||||
flush !== Z_FINISH &&
|
||||
flush !== Z_BLOCK) {
|
||||
throw new Error('Invalid flush value');
|
||||
}
|
||||
|
||||
if (input == null) {
|
||||
input = new Buffer(0);
|
||||
in_len = 0;
|
||||
in_off = 0;
|
||||
}
|
||||
|
||||
if (out._set)
|
||||
out.set = out._set;
|
||||
else
|
||||
out.set = bufferSet;
|
||||
|
||||
var strm = this.strm;
|
||||
strm.avail_in = in_len;
|
||||
strm.input = input;
|
||||
strm.next_in = in_off;
|
||||
strm.avail_out = out_len;
|
||||
strm.output = out;
|
||||
strm.next_out = out_off;
|
||||
var status;
|
||||
switch (this.mode) {
|
||||
case DEFLATE:
|
||||
case GZIP:
|
||||
case DEFLATERAW:
|
||||
status = deflate(strm, flush);
|
||||
break;
|
||||
case UNZIP:
|
||||
case INFLATE:
|
||||
case GUNZIP:
|
||||
case INFLATERAW:
|
||||
status = inflate(strm, flush);
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unknown mode ' + this.mode);
|
||||
}
|
||||
|
||||
if (status !== Z_STREAM_END && status !== Z_OK) {
|
||||
this._error(status);
|
||||
}
|
||||
|
||||
this.write_in_progress = false;
|
||||
return [strm.avail_in, strm.avail_out];
|
||||
};
|
||||
|
||||
Zlib.prototype.close = function() {
|
||||
if (this.write_in_progress) {
|
||||
this.pending_close = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.pending_close = false;
|
||||
|
||||
if (this.mode === DEFLATE || this.mode === GZIP || this.mode === DEFLATERAW) {
|
||||
deflateEnd(this.strm);
|
||||
} else {
|
||||
inflateEnd(this.strm);
|
||||
}
|
||||
|
||||
this.mode = NONE;
|
||||
};
|
||||
var status
|
||||
Zlib.prototype.reset = function() {
|
||||
switch (this.mode) {
|
||||
case DEFLATE:
|
||||
case DEFLATERAW:
|
||||
status = deflateReset(this.strm);
|
||||
break;
|
||||
case INFLATE:
|
||||
case INFLATERAW:
|
||||
status = inflateReset(this.strm);
|
||||
break;
|
||||
}
|
||||
|
||||
if (status !== Z_OK) {
|
||||
this._error(status);
|
||||
}
|
||||
};
|
||||
|
||||
Zlib.prototype._error = function(status) {
|
||||
this.onerror(msg[status] + ': ' + this.strm.msg, status);
|
||||
|
||||
this.write_in_progress = false;
|
||||
if (this.pending_close)
|
||||
this.close();
|
||||
};
|
40
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/crc32.js
generated
vendored
Normal file
40
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/crc32.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
|
||||
// Note: we can't get significant speed boost here.
|
||||
// So write code to minimize size - no pregenerated tables
|
||||
// and array tools dependencies.
|
||||
|
||||
|
||||
// Use ordinary array, since untyped makes no boost here
|
||||
function makeTable() {
|
||||
var c, table = [];
|
||||
|
||||
for (var n = 0; n < 256; n++) {
|
||||
c = n;
|
||||
for (var k = 0; k < 8; k++) {
|
||||
c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
|
||||
}
|
||||
table[n] = c;
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
// Create table on load. Just 255 signed longs. Not a problem.
|
||||
var crcTable = makeTable();
|
||||
|
||||
|
||||
function crc32(crc, buf, len, pos) {
|
||||
var t = crcTable,
|
||||
end = pos + len;
|
||||
|
||||
crc ^= -1;
|
||||
|
||||
for (var i = pos; i < end; i++) {
|
||||
crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
|
||||
}
|
||||
|
||||
return (crc ^ (-1)); // >>> 0;
|
||||
}
|
||||
|
||||
|
||||
export default crc32;
|
1862
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/deflate.js
generated
vendored
Normal file
1862
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/deflate.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
325
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/inffast.js
generated
vendored
Normal file
325
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/inffast.js
generated
vendored
Normal file
|
@ -0,0 +1,325 @@
|
|||
|
||||
// See state defs from inflate.js
|
||||
var BAD = 30; /* got a data error -- remain here until reset */
|
||||
var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
|
||||
|
||||
/*
|
||||
Decode literal, length, and distance codes and write out the resulting
|
||||
literal and match bytes until either not enough input or output is
|
||||
available, an end-of-block is encountered, or a data error is encountered.
|
||||
When large enough input and output buffers are supplied to inflate(), for
|
||||
example, a 16K input buffer and a 64K output buffer, more than 95% of the
|
||||
inflate execution time is spent in this routine.
|
||||
|
||||
Entry assumptions:
|
||||
|
||||
state.mode === LEN
|
||||
strm.avail_in >= 6
|
||||
strm.avail_out >= 258
|
||||
start >= strm.avail_out
|
||||
state.bits < 8
|
||||
|
||||
On return, state.mode is one of:
|
||||
|
||||
LEN -- ran out of enough output space or enough available input
|
||||
TYPE -- reached end of block code, inflate() to interpret next block
|
||||
BAD -- error in block data
|
||||
|
||||
Notes:
|
||||
|
||||
- The maximum input bits used by a length/distance pair is 15 bits for the
|
||||
length code, 5 bits for the length extra, 15 bits for the distance code,
|
||||
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
|
||||
Therefore if strm.avail_in >= 6, then there is enough input to avoid
|
||||
checking for available input while decoding.
|
||||
|
||||
- The maximum bytes that a single length/distance pair can output is 258
|
||||
bytes, which is the maximum length that can be coded. inflate_fast()
|
||||
requires strm.avail_out >= 258 for each loop to avoid checking for
|
||||
output space.
|
||||
*/
|
||||
export default function inflate_fast(strm, start) {
|
||||
var state;
|
||||
var _in; /* local strm.input */
|
||||
var last; /* have enough input while in < last */
|
||||
var _out; /* local strm.output */
|
||||
var beg; /* inflate()'s initial strm.output */
|
||||
var end; /* while out < end, enough space available */
|
||||
//#ifdef INFLATE_STRICT
|
||||
var dmax; /* maximum distance from zlib header */
|
||||
//#endif
|
||||
var wsize; /* window size or zero if not using window */
|
||||
var whave; /* valid bytes in the window */
|
||||
var wnext; /* window write index */
|
||||
// Use `s_window` instead `window`, avoid conflict with instrumentation tools
|
||||
var s_window; /* allocated sliding window, if wsize != 0 */
|
||||
var hold; /* local strm.hold */
|
||||
var bits; /* local strm.bits */
|
||||
var lcode; /* local strm.lencode */
|
||||
var dcode; /* local strm.distcode */
|
||||
var lmask; /* mask for first level of length codes */
|
||||
var dmask; /* mask for first level of distance codes */
|
||||
var here; /* retrieved table entry */
|
||||
var op; /* code bits, operation, extra bits, or */
|
||||
/* window position, window bytes to copy */
|
||||
var len; /* match length, unused bytes */
|
||||
var dist; /* match distance */
|
||||
var from; /* where to copy match from */
|
||||
var from_source;
|
||||
|
||||
|
||||
var input, output; // JS specific, because we have no pointers
|
||||
|
||||
/* copy state to local variables */
|
||||
state = strm.state;
|
||||
//here = state.here;
|
||||
_in = strm.next_in;
|
||||
input = strm.input;
|
||||
last = _in + (strm.avail_in - 5);
|
||||
_out = strm.next_out;
|
||||
output = strm.output;
|
||||
beg = _out - (start - strm.avail_out);
|
||||
end = _out + (strm.avail_out - 257);
|
||||
//#ifdef INFLATE_STRICT
|
||||
dmax = state.dmax;
|
||||
//#endif
|
||||
wsize = state.wsize;
|
||||
whave = state.whave;
|
||||
wnext = state.wnext;
|
||||
s_window = state.window;
|
||||
hold = state.hold;
|
||||
bits = state.bits;
|
||||
lcode = state.lencode;
|
||||
dcode = state.distcode;
|
||||
lmask = (1 << state.lenbits) - 1;
|
||||
dmask = (1 << state.distbits) - 1;
|
||||
|
||||
|
||||
/* decode literals and length/distances until end-of-block or not enough
|
||||
input data or output space */
|
||||
|
||||
top:
|
||||
do {
|
||||
if (bits < 15) {
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
}
|
||||
|
||||
here = lcode[hold & lmask];
|
||||
|
||||
dolen:
|
||||
for (;;) { // Goto emulation
|
||||
op = here >>> 24/*here.bits*/;
|
||||
hold >>>= op;
|
||||
bits -= op;
|
||||
op = (here >>> 16) & 0xff/*here.op*/;
|
||||
if (op === 0) { /* literal */
|
||||
//Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
||||
// "inflate: literal '%c'\n" :
|
||||
// "inflate: literal 0x%02x\n", here.val));
|
||||
output[_out++] = here & 0xffff/*here.val*/;
|
||||
}
|
||||
else if (op & 16) { /* length base */
|
||||
len = here & 0xffff/*here.val*/;
|
||||
op &= 15; /* number of extra bits */
|
||||
if (op) {
|
||||
if (bits < op) {
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
}
|
||||
len += hold & ((1 << op) - 1);
|
||||
hold >>>= op;
|
||||
bits -= op;
|
||||
}
|
||||
//Tracevv((stderr, "inflate: length %u\n", len));
|
||||
if (bits < 15) {
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
}
|
||||
here = dcode[hold & dmask];
|
||||
|
||||
dodist:
|
||||
for (;;) { // goto emulation
|
||||
op = here >>> 24/*here.bits*/;
|
||||
hold >>>= op;
|
||||
bits -= op;
|
||||
op = (here >>> 16) & 0xff/*here.op*/;
|
||||
|
||||
if (op & 16) { /* distance base */
|
||||
dist = here & 0xffff/*here.val*/;
|
||||
op &= 15; /* number of extra bits */
|
||||
if (bits < op) {
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
if (bits < op) {
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
}
|
||||
}
|
||||
dist += hold & ((1 << op) - 1);
|
||||
//#ifdef INFLATE_STRICT
|
||||
if (dist > dmax) {
|
||||
strm.msg = 'invalid distance too far back';
|
||||
state.mode = BAD;
|
||||
break top;
|
||||
}
|
||||
//#endif
|
||||
hold >>>= op;
|
||||
bits -= op;
|
||||
//Tracevv((stderr, "inflate: distance %u\n", dist));
|
||||
op = _out - beg; /* max distance in output */
|
||||
if (dist > op) { /* see if copy from window */
|
||||
op = dist - op; /* distance back in window */
|
||||
if (op > whave) {
|
||||
if (state.sane) {
|
||||
strm.msg = 'invalid distance too far back';
|
||||
state.mode = BAD;
|
||||
break top;
|
||||
}
|
||||
|
||||
// (!) This block is disabled in zlib defailts,
|
||||
// don't enable it for binary compatibility
|
||||
//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
||||
// if (len <= op - whave) {
|
||||
// do {
|
||||
// output[_out++] = 0;
|
||||
// } while (--len);
|
||||
// continue top;
|
||||
// }
|
||||
// len -= op - whave;
|
||||
// do {
|
||||
// output[_out++] = 0;
|
||||
// } while (--op > whave);
|
||||
// if (op === 0) {
|
||||
// from = _out - dist;
|
||||
// do {
|
||||
// output[_out++] = output[from++];
|
||||
// } while (--len);
|
||||
// continue top;
|
||||
// }
|
||||
//#endif
|
||||
}
|
||||
from = 0; // window index
|
||||
from_source = s_window;
|
||||
if (wnext === 0) { /* very common case */
|
||||
from += wsize - op;
|
||||
if (op < len) { /* some from window */
|
||||
len -= op;
|
||||
do {
|
||||
output[_out++] = s_window[from++];
|
||||
} while (--op);
|
||||
from = _out - dist; /* rest from output */
|
||||
from_source = output;
|
||||
}
|
||||
}
|
||||
else if (wnext < op) { /* wrap around window */
|
||||
from += wsize + wnext - op;
|
||||
op -= wnext;
|
||||
if (op < len) { /* some from end of window */
|
||||
len -= op;
|
||||
do {
|
||||
output[_out++] = s_window[from++];
|
||||
} while (--op);
|
||||
from = 0;
|
||||
if (wnext < len) { /* some from start of window */
|
||||
op = wnext;
|
||||
len -= op;
|
||||
do {
|
||||
output[_out++] = s_window[from++];
|
||||
} while (--op);
|
||||
from = _out - dist; /* rest from output */
|
||||
from_source = output;
|
||||
}
|
||||
}
|
||||
}
|
||||
else { /* contiguous in window */
|
||||
from += wnext - op;
|
||||
if (op < len) { /* some from window */
|
||||
len -= op;
|
||||
do {
|
||||
output[_out++] = s_window[from++];
|
||||
} while (--op);
|
||||
from = _out - dist; /* rest from output */
|
||||
from_source = output;
|
||||
}
|
||||
}
|
||||
while (len > 2) {
|
||||
output[_out++] = from_source[from++];
|
||||
output[_out++] = from_source[from++];
|
||||
output[_out++] = from_source[from++];
|
||||
len -= 3;
|
||||
}
|
||||
if (len) {
|
||||
output[_out++] = from_source[from++];
|
||||
if (len > 1) {
|
||||
output[_out++] = from_source[from++];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
from = _out - dist; /* copy direct from output */
|
||||
do { /* minimum length is three */
|
||||
output[_out++] = output[from++];
|
||||
output[_out++] = output[from++];
|
||||
output[_out++] = output[from++];
|
||||
len -= 3;
|
||||
} while (len > 2);
|
||||
if (len) {
|
||||
output[_out++] = output[from++];
|
||||
if (len > 1) {
|
||||
output[_out++] = output[from++];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((op & 64) === 0) { /* 2nd level distance code */
|
||||
here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
|
||||
continue dodist;
|
||||
}
|
||||
else {
|
||||
strm.msg = 'invalid distance code';
|
||||
state.mode = BAD;
|
||||
break top;
|
||||
}
|
||||
|
||||
break; // need to emulate goto via "continue"
|
||||
}
|
||||
}
|
||||
else if ((op & 64) === 0) { /* 2nd level length code */
|
||||
here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
|
||||
continue dolen;
|
||||
}
|
||||
else if (op & 32) { /* end-of-block */
|
||||
//Tracevv((stderr, "inflate: end of block\n"));
|
||||
state.mode = TYPE;
|
||||
break top;
|
||||
}
|
||||
else {
|
||||
strm.msg = 'invalid literal/length code';
|
||||
state.mode = BAD;
|
||||
break top;
|
||||
}
|
||||
|
||||
break; // need to emulate goto via "continue"
|
||||
}
|
||||
} while (_in < last && _out < end);
|
||||
|
||||
/* return unused bytes (on entry, bits < 8, so in won't go too far back) */
|
||||
len = bits >> 3;
|
||||
_in -= len;
|
||||
bits -= len << 3;
|
||||
hold &= (1 << bits) - 1;
|
||||
|
||||
/* update state and return */
|
||||
strm.next_in = _in;
|
||||
strm.next_out = _out;
|
||||
strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));
|
||||
strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));
|
||||
state.hold = hold;
|
||||
state.bits = bits;
|
||||
return;
|
||||
};
|
1650
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/inflate.js
generated
vendored
Normal file
1650
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/inflate.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
329
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/inftrees.js
generated
vendored
Normal file
329
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/inftrees.js
generated
vendored
Normal file
|
@ -0,0 +1,329 @@
|
|||
import {Buf16} from './utils';
|
||||
var MAXBITS = 15;
|
||||
var ENOUGH_LENS = 852;
|
||||
var ENOUGH_DISTS = 592;
|
||||
//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
|
||||
|
||||
var CODES = 0;
|
||||
var LENS = 1;
|
||||
var DISTS = 2;
|
||||
|
||||
var lbase = [ /* Length codes 257..285 base */
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
|
||||
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
|
||||
];
|
||||
|
||||
var lext = [ /* Length codes 257..285 extra */
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
||||
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78
|
||||
];
|
||||
|
||||
var dbase = [ /* Distance codes 0..29 base */
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
||||
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
||||
8193, 12289, 16385, 24577, 0, 0
|
||||
];
|
||||
|
||||
var dext = [ /* Distance codes 0..29 extra */
|
||||
16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
|
||||
23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
|
||||
28, 28, 29, 29, 64, 64
|
||||
];
|
||||
|
||||
export default function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) {
|
||||
var bits = opts.bits;
|
||||
//here = opts.here; /* table entry for duplication */
|
||||
|
||||
var len = 0; /* a code's length in bits */
|
||||
var sym = 0; /* index of code symbols */
|
||||
var min = 0,
|
||||
max = 0; /* minimum and maximum code lengths */
|
||||
var root = 0; /* number of index bits for root table */
|
||||
var curr = 0; /* number of index bits for current table */
|
||||
var drop = 0; /* code bits to drop for sub-table */
|
||||
var left = 0; /* number of prefix codes available */
|
||||
var used = 0; /* code entries in table used */
|
||||
var huff = 0; /* Huffman code */
|
||||
var incr; /* for incrementing code, index */
|
||||
var fill; /* index for replicating entries */
|
||||
var low; /* low bits for current root entry */
|
||||
var mask; /* mask for low root bits */
|
||||
var next; /* next available space in table */
|
||||
var base = null; /* base value table to use */
|
||||
var base_index = 0;
|
||||
// var shoextra; /* extra bits table to use */
|
||||
var end; /* use base and extra for symbol > end */
|
||||
var count = new Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */
|
||||
var offs = new Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */
|
||||
var extra = null;
|
||||
var extra_index = 0;
|
||||
|
||||
var here_bits, here_op, here_val;
|
||||
|
||||
/*
|
||||
Process a set of code lengths to create a canonical Huffman code. The
|
||||
code lengths are lens[0..codes-1]. Each length corresponds to the
|
||||
symbols 0..codes-1. The Huffman code is generated by first sorting the
|
||||
symbols by length from short to long, and retaining the symbol order
|
||||
for codes with equal lengths. Then the code starts with all zero bits
|
||||
for the first code of the shortest length, and the codes are integer
|
||||
increments for the same length, and zeros are appended as the length
|
||||
increases. For the deflate format, these bits are stored backwards
|
||||
from their more natural integer increment ordering, and so when the
|
||||
decoding tables are built in the large loop below, the integer codes
|
||||
are incremented backwards.
|
||||
|
||||
This routine assumes, but does not check, that all of the entries in
|
||||
lens[] are in the range 0..MAXBITS. The caller must assure this.
|
||||
1..MAXBITS is interpreted as that code length. zero means that that
|
||||
symbol does not occur in this code.
|
||||
|
||||
The codes are sorted by computing a count of codes for each length,
|
||||
creating from that a table of starting indices for each length in the
|
||||
sorted table, and then entering the symbols in order in the sorted
|
||||
table. The sorted table is work[], with that space being provided by
|
||||
the caller.
|
||||
|
||||
The length counts are used for other purposes as well, i.e. finding
|
||||
the minimum and maximum length codes, determining if there are any
|
||||
codes at all, checking for a valid set of lengths, and looking ahead
|
||||
at length counts to determine sub-table sizes when building the
|
||||
decoding tables.
|
||||
*/
|
||||
|
||||
/* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
|
||||
for (len = 0; len <= MAXBITS; len++) {
|
||||
count[len] = 0;
|
||||
}
|
||||
for (sym = 0; sym < codes; sym++) {
|
||||
count[lens[lens_index + sym]]++;
|
||||
}
|
||||
|
||||
/* bound code lengths, force root to be within code lengths */
|
||||
root = bits;
|
||||
for (max = MAXBITS; max >= 1; max--) {
|
||||
if (count[max] !== 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (root > max) {
|
||||
root = max;
|
||||
}
|
||||
if (max === 0) { /* no symbols to code at all */
|
||||
//table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */
|
||||
//table.bits[opts.table_index] = 1; //here.bits = (var char)1;
|
||||
//table.val[opts.table_index++] = 0; //here.val = (var short)0;
|
||||
table[table_index++] = (1 << 24) | (64 << 16) | 0;
|
||||
|
||||
|
||||
//table.op[opts.table_index] = 64;
|
||||
//table.bits[opts.table_index] = 1;
|
||||
//table.val[opts.table_index++] = 0;
|
||||
table[table_index++] = (1 << 24) | (64 << 16) | 0;
|
||||
|
||||
opts.bits = 1;
|
||||
return 0; /* no symbols, but wait for decoding to report error */
|
||||
}
|
||||
for (min = 1; min < max; min++) {
|
||||
if (count[min] !== 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (root < min) {
|
||||
root = min;
|
||||
}
|
||||
|
||||
/* check for an over-subscribed or incomplete set of lengths */
|
||||
left = 1;
|
||||
for (len = 1; len <= MAXBITS; len++) {
|
||||
left <<= 1;
|
||||
left -= count[len];
|
||||
if (left < 0) {
|
||||
return -1;
|
||||
} /* over-subscribed */
|
||||
}
|
||||
if (left > 0 && (type === CODES || max !== 1)) {
|
||||
return -1; /* incomplete set */
|
||||
}
|
||||
|
||||
/* generate offsets into symbol table for each length for sorting */
|
||||
offs[1] = 0;
|
||||
for (len = 1; len < MAXBITS; len++) {
|
||||
offs[len + 1] = offs[len] + count[len];
|
||||
}
|
||||
|
||||
/* sort symbols by length, by symbol order within each length */
|
||||
for (sym = 0; sym < codes; sym++) {
|
||||
if (lens[lens_index + sym] !== 0) {
|
||||
work[offs[lens[lens_index + sym]]++] = sym;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Create and fill in decoding tables. In this loop, the table being
|
||||
filled is at next and has curr index bits. The code being used is huff
|
||||
with length len. That code is converted to an index by dropping drop
|
||||
bits off of the bottom. For codes where len is less than drop + curr,
|
||||
those top drop + curr - len bits are incremented through all values to
|
||||
fill the table with replicated entries.
|
||||
|
||||
root is the number of index bits for the root table. When len exceeds
|
||||
root, sub-tables are created pointed to by the root entry with an index
|
||||
of the low root bits of huff. This is saved in low to check for when a
|
||||
new sub-table should be started. drop is zero when the root table is
|
||||
being filled, and drop is root when sub-tables are being filled.
|
||||
|
||||
When a new sub-table is needed, it is necessary to look ahead in the
|
||||
code lengths to determine what size sub-table is needed. The length
|
||||
counts are used for this, and so count[] is decremented as codes are
|
||||
entered in the tables.
|
||||
|
||||
used keeps track of how many table entries have been allocated from the
|
||||
provided *table space. It is checked for LENS and DIST tables against
|
||||
the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
|
||||
the initial root table size constants. See the comments in inftrees.h
|
||||
for more information.
|
||||
|
||||
sym increments through all symbols, and the loop terminates when
|
||||
all codes of length max, i.e. all codes, have been processed. This
|
||||
routine permits incomplete codes, so another loop after this one fills
|
||||
in the rest of the decoding tables with invalid code markers.
|
||||
*/
|
||||
|
||||
/* set up for code type */
|
||||
// poor man optimization - use if-else instead of switch,
|
||||
// to avoid deopts in old v8
|
||||
if (type === CODES) {
|
||||
base = extra = work; /* dummy value--not used */
|
||||
end = 19;
|
||||
|
||||
} else if (type === LENS) {
|
||||
base = lbase;
|
||||
base_index -= 257;
|
||||
extra = lext;
|
||||
extra_index -= 257;
|
||||
end = 256;
|
||||
|
||||
} else { /* DISTS */
|
||||
base = dbase;
|
||||
extra = dext;
|
||||
end = -1;
|
||||
}
|
||||
|
||||
/* initialize opts for loop */
|
||||
huff = 0; /* starting code */
|
||||
sym = 0; /* starting code symbol */
|
||||
len = min; /* starting code length */
|
||||
next = table_index; /* current table to fill in */
|
||||
curr = root; /* current table index bits */
|
||||
drop = 0; /* current bits to drop from code for index */
|
||||
low = -1; /* trigger new sub-table when len > root */
|
||||
used = 1 << root; /* use root table entries */
|
||||
mask = used - 1; /* mask for comparing low */
|
||||
|
||||
/* check available table space */
|
||||
if ((type === LENS && used > ENOUGH_LENS) ||
|
||||
(type === DISTS && used > ENOUGH_DISTS)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
var i = 0;
|
||||
/* process all codes and make table entries */
|
||||
for (;;) {
|
||||
i++;
|
||||
/* create table entry */
|
||||
here_bits = len - drop;
|
||||
if (work[sym] < end) {
|
||||
here_op = 0;
|
||||
here_val = work[sym];
|
||||
} else if (work[sym] > end) {
|
||||
here_op = extra[extra_index + work[sym]];
|
||||
here_val = base[base_index + work[sym]];
|
||||
} else {
|
||||
here_op = 32 + 64; /* end of block */
|
||||
here_val = 0;
|
||||
}
|
||||
|
||||
/* replicate for those indices with low len bits equal to huff */
|
||||
incr = 1 << (len - drop);
|
||||
fill = 1 << curr;
|
||||
min = fill; /* save offset to next table */
|
||||
do {
|
||||
fill -= incr;
|
||||
table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val | 0;
|
||||
} while (fill !== 0);
|
||||
|
||||
/* backwards increment the len-bit code huff */
|
||||
incr = 1 << (len - 1);
|
||||
while (huff & incr) {
|
||||
incr >>= 1;
|
||||
}
|
||||
if (incr !== 0) {
|
||||
huff &= incr - 1;
|
||||
huff += incr;
|
||||
} else {
|
||||
huff = 0;
|
||||
}
|
||||
|
||||
/* go to next symbol, update count, len */
|
||||
sym++;
|
||||
if (--count[len] === 0) {
|
||||
if (len === max) {
|
||||
break;
|
||||
}
|
||||
len = lens[lens_index + work[sym]];
|
||||
}
|
||||
|
||||
/* create new sub-table if needed */
|
||||
if (len > root && (huff & mask) !== low) {
|
||||
/* if first time, transition to sub-tables */
|
||||
if (drop === 0) {
|
||||
drop = root;
|
||||
}
|
||||
|
||||
/* increment past last table */
|
||||
next += min; /* here min is 1 << curr */
|
||||
|
||||
/* determine length of next table */
|
||||
curr = len - drop;
|
||||
left = 1 << curr;
|
||||
while (curr + drop < max) {
|
||||
left -= count[curr + drop];
|
||||
if (left <= 0) {
|
||||
break;
|
||||
}
|
||||
curr++;
|
||||
left <<= 1;
|
||||
}
|
||||
|
||||
/* check for enough space */
|
||||
used += 1 << curr;
|
||||
if ((type === LENS && used > ENOUGH_LENS) ||
|
||||
(type === DISTS && used > ENOUGH_DISTS)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* point entry in root table to sub-table */
|
||||
low = huff & mask;
|
||||
/*table.op[low] = curr;
|
||||
table.bits[low] = root;
|
||||
table.val[low] = next - opts.table_index;*/
|
||||
table[low] = (root << 24) | (curr << 16) | (next - table_index) | 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* fill in remaining table entry if code is incomplete (guaranteed to have
|
||||
at most one remaining entry, since if the code is incomplete, the
|
||||
maximum code length that was allowed to get this far is one bit) */
|
||||
if (huff !== 0) {
|
||||
//table.op[next + huff] = 64; /* invalid code marker */
|
||||
//table.bits[next + huff] = len - drop;
|
||||
//table.val[next + huff] = 0;
|
||||
table[next + huff] = ((len - drop) << 24) | (64 << 16) | 0;
|
||||
}
|
||||
|
||||
/* set return parameters */
|
||||
//opts.table_index += used;
|
||||
opts.bits = root;
|
||||
return 0;
|
||||
};
|
11
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/messages.js
generated
vendored
Normal file
11
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/messages.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
export default {
|
||||
2: 'need dictionary', /* Z_NEED_DICT 2 */
|
||||
1: 'stream end', /* Z_STREAM_END 1 */
|
||||
0: '', /* Z_OK 0 */
|
||||
'-1': 'file error', /* Z_ERRNO (-1) */
|
||||
'-2': 'stream error', /* Z_STREAM_ERROR (-2) */
|
||||
'-3': 'data error', /* Z_DATA_ERROR (-3) */
|
||||
'-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */
|
||||
'-5': 'buffer error', /* Z_BUF_ERROR (-5) */
|
||||
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
|
||||
};
|
1220
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/trees.js
generated
vendored
Normal file
1220
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/trees.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
73
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/utils.js
generated
vendored
Normal file
73
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
var TYPED_OK = (typeof Uint8Array !== 'undefined') &&
|
||||
(typeof Uint16Array !== 'undefined') &&
|
||||
(typeof Int32Array !== 'undefined');
|
||||
|
||||
|
||||
export function assign(obj /*from1, from2, from3, ...*/) {
|
||||
var sources = Array.prototype.slice.call(arguments, 1);
|
||||
while (sources.length) {
|
||||
var source = sources.shift();
|
||||
if (!source) { continue; }
|
||||
|
||||
if (typeof source !== 'object') {
|
||||
throw new TypeError(source + 'must be non-object');
|
||||
}
|
||||
|
||||
for (var p in source) {
|
||||
if (source.hasOwnProperty(p)) {
|
||||
obj[p] = source[p];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
// reduce buffer size, avoiding mem copy
|
||||
export function shrinkBuf(buf, size) {
|
||||
if (buf.length === size) { return buf; }
|
||||
if (buf.subarray) { return buf.subarray(0, size); }
|
||||
buf.length = size;
|
||||
return buf;
|
||||
}
|
||||
export function arraySet(dest, src, src_offs, len, dest_offs) {
|
||||
if (src.subarray && dest.subarray) {
|
||||
dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
|
||||
return;
|
||||
}
|
||||
// Fallback to ordinary array
|
||||
for (var i = 0; i < len; i++) {
|
||||
dest[dest_offs + i] = src[src_offs + i];
|
||||
}
|
||||
}
|
||||
export function flattenChunks(chunks) {
|
||||
var i, l, len, pos, chunk, result;
|
||||
|
||||
// calculate data length
|
||||
len = 0;
|
||||
for (i = 0, l = chunks.length; i < l; i++) {
|
||||
len += chunks[i].length;
|
||||
}
|
||||
|
||||
// join chunks
|
||||
result = new Uint8Array(len);
|
||||
pos = 0;
|
||||
for (i = 0, l = chunks.length; i < l; i++) {
|
||||
chunk = chunks[i];
|
||||
result.set(chunk, pos);
|
||||
pos += chunk.length;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
export var Buf8 = Uint8Array;
|
||||
export var Buf16 = Uint16Array;
|
||||
export var Buf32 = Int32Array;
|
||||
// Enable/Disable typed arrays use, for testing
|
||||
//
|
28
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/zstream.js
generated
vendored
Normal file
28
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib-lib/zstream.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
|
||||
|
||||
function ZStream() {
|
||||
/* next input byte */
|
||||
this.input = null; // JS specific, because we have no pointers
|
||||
this.next_in = 0;
|
||||
/* number of bytes available at input */
|
||||
this.avail_in = 0;
|
||||
/* total number of input bytes read so far */
|
||||
this.total_in = 0;
|
||||
/* next output byte should be put there */
|
||||
this.output = null; // JS specific, because we have no pointers
|
||||
this.next_out = 0;
|
||||
/* remaining free space at output */
|
||||
this.avail_out = 0;
|
||||
/* total number of bytes output so far */
|
||||
this.total_out = 0;
|
||||
/* last error message, NULL if no error */
|
||||
this.msg = ''/*Z_NULL*/;
|
||||
/* not visible by applications */
|
||||
this.state = null;
|
||||
/* best guess about the data type: binary or text */
|
||||
this.data_type = 2/*Z_UNKNOWN*/;
|
||||
/* adler32 value of the uncompressed data */
|
||||
this.adler = 0;
|
||||
}
|
||||
|
||||
export default ZStream;
|
635
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib.js
generated
vendored
Normal file
635
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/polyfills/zlib.js
generated
vendored
Normal file
|
@ -0,0 +1,635 @@
|
|||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
import {Transform} from 'stream';
|
||||
import * as _binding from './zlib-lib/binding';
|
||||
import {inherits} from 'util';
|
||||
function assert (a, msg) {
|
||||
if (!a) {
|
||||
throw new Error(msg);
|
||||
}
|
||||
}
|
||||
var binding = {};
|
||||
Object.keys(_binding).forEach(function (key) {
|
||||
binding[key] = _binding[key];
|
||||
});
|
||||
// zlib doesn't provide these, so kludge them in following the same
|
||||
// const naming scheme zlib uses.
|
||||
binding.Z_MIN_WINDOWBITS = 8;
|
||||
binding.Z_MAX_WINDOWBITS = 15;
|
||||
binding.Z_DEFAULT_WINDOWBITS = 15;
|
||||
|
||||
// fewer than 64 bytes per chunk is stupid.
|
||||
// technically it could work with as few as 8, but even 64 bytes
|
||||
// is absurdly low. Usually a MB or more is best.
|
||||
binding.Z_MIN_CHUNK = 64;
|
||||
binding.Z_MAX_CHUNK = Infinity;
|
||||
binding.Z_DEFAULT_CHUNK = (16 * 1024);
|
||||
|
||||
binding.Z_MIN_MEMLEVEL = 1;
|
||||
binding.Z_MAX_MEMLEVEL = 9;
|
||||
binding.Z_DEFAULT_MEMLEVEL = 8;
|
||||
|
||||
binding.Z_MIN_LEVEL = -1;
|
||||
binding.Z_MAX_LEVEL = 9;
|
||||
binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION;
|
||||
|
||||
|
||||
// translation table for return codes.
|
||||
export var codes = {
|
||||
Z_OK: binding.Z_OK,
|
||||
Z_STREAM_END: binding.Z_STREAM_END,
|
||||
Z_NEED_DICT: binding.Z_NEED_DICT,
|
||||
Z_ERRNO: binding.Z_ERRNO,
|
||||
Z_STREAM_ERROR: binding.Z_STREAM_ERROR,
|
||||
Z_DATA_ERROR: binding.Z_DATA_ERROR,
|
||||
Z_MEM_ERROR: binding.Z_MEM_ERROR,
|
||||
Z_BUF_ERROR: binding.Z_BUF_ERROR,
|
||||
Z_VERSION_ERROR: binding.Z_VERSION_ERROR
|
||||
};
|
||||
|
||||
Object.keys(codes).forEach(function(k) {
|
||||
codes[codes[k]] = k;
|
||||
});
|
||||
|
||||
export function createDeflate(o) {
|
||||
return new Deflate(o);
|
||||
}
|
||||
|
||||
export function createInflate(o) {
|
||||
return new Inflate(o);
|
||||
}
|
||||
|
||||
export function createDeflateRaw(o) {
|
||||
return new DeflateRaw(o);
|
||||
}
|
||||
|
||||
export function createInflateRaw(o) {
|
||||
return new InflateRaw(o);
|
||||
}
|
||||
|
||||
export function createGzip(o) {
|
||||
return new Gzip(o);
|
||||
}
|
||||
|
||||
export function createGunzip(o) {
|
||||
return new Gunzip(o);
|
||||
}
|
||||
|
||||
export function createUnzip(o) {
|
||||
return new Unzip(o);
|
||||
}
|
||||
|
||||
|
||||
// Convenience methods.
|
||||
// compress/decompress a string or buffer in one step.
|
||||
export function deflate(buffer, opts, callback) {
|
||||
if (typeof opts === 'function') {
|
||||
callback = opts;
|
||||
opts = {};
|
||||
}
|
||||
return zlibBuffer(new Deflate(opts), buffer, callback);
|
||||
}
|
||||
|
||||
export function deflateSync(buffer, opts) {
|
||||
return zlibBufferSync(new Deflate(opts), buffer);
|
||||
}
|
||||
|
||||
export function gzip(buffer, opts, callback) {
|
||||
if (typeof opts === 'function') {
|
||||
callback = opts;
|
||||
opts = {};
|
||||
}
|
||||
return zlibBuffer(new Gzip(opts), buffer, callback);
|
||||
}
|
||||
|
||||
export function gzipSync(buffer, opts) {
|
||||
return zlibBufferSync(new Gzip(opts), buffer);
|
||||
}
|
||||
|
||||
export function deflateRaw(buffer, opts, callback) {
|
||||
if (typeof opts === 'function') {
|
||||
callback = opts;
|
||||
opts = {};
|
||||
}
|
||||
return zlibBuffer(new DeflateRaw(opts), buffer, callback);
|
||||
}
|
||||
|
||||
export function deflateRawSync(buffer, opts) {
|
||||
return zlibBufferSync(new DeflateRaw(opts), buffer);
|
||||
}
|
||||
|
||||
export function unzip(buffer, opts, callback) {
|
||||
if (typeof opts === 'function') {
|
||||
callback = opts;
|
||||
opts = {};
|
||||
}
|
||||
return zlibBuffer(new Unzip(opts), buffer, callback);
|
||||
}
|
||||
|
||||
export function unzipSync(buffer, opts) {
|
||||
return zlibBufferSync(new Unzip(opts), buffer);
|
||||
}
|
||||
|
||||
export function inflate(buffer, opts, callback) {
|
||||
if (typeof opts === 'function') {
|
||||
callback = opts;
|
||||
opts = {};
|
||||
}
|
||||
return zlibBuffer(new Inflate(opts), buffer, callback);
|
||||
}
|
||||
|
||||
export function inflateSync(buffer, opts) {
|
||||
return zlibBufferSync(new Inflate(opts), buffer);
|
||||
}
|
||||
|
||||
export function gunzip(buffer, opts, callback) {
|
||||
if (typeof opts === 'function') {
|
||||
callback = opts;
|
||||
opts = {};
|
||||
}
|
||||
return zlibBuffer(new Gunzip(opts), buffer, callback);
|
||||
}
|
||||
|
||||
export function gunzipSync(buffer, opts) {
|
||||
return zlibBufferSync(new Gunzip(opts), buffer);
|
||||
}
|
||||
|
||||
export function inflateRaw(buffer, opts, callback) {
|
||||
if (typeof opts === 'function') {
|
||||
callback = opts;
|
||||
opts = {};
|
||||
}
|
||||
return zlibBuffer(new InflateRaw(opts), buffer, callback);
|
||||
}
|
||||
|
||||
export function inflateRawSync(buffer, opts) {
|
||||
return zlibBufferSync(new InflateRaw(opts), buffer);
|
||||
}
|
||||
|
||||
function zlibBuffer(engine, buffer, callback) {
|
||||
var buffers = [];
|
||||
var nread = 0;
|
||||
|
||||
engine.on('error', onError);
|
||||
engine.on('end', onEnd);
|
||||
|
||||
engine.end(buffer);
|
||||
flow();
|
||||
|
||||
function flow() {
|
||||
var chunk;
|
||||
while (null !== (chunk = engine.read())) {
|
||||
buffers.push(chunk);
|
||||
nread += chunk.length;
|
||||
}
|
||||
engine.once('readable', flow);
|
||||
}
|
||||
|
||||
function onError(err) {
|
||||
engine.removeListener('end', onEnd);
|
||||
engine.removeListener('readable', flow);
|
||||
callback(err);
|
||||
}
|
||||
|
||||
function onEnd() {
|
||||
var buf = Buffer.concat(buffers, nread);
|
||||
buffers = [];
|
||||
callback(null, buf);
|
||||
engine.close();
|
||||
}
|
||||
}
|
||||
|
||||
function zlibBufferSync(engine, buffer) {
|
||||
if (typeof buffer === 'string')
|
||||
buffer = new Buffer(buffer);
|
||||
if (!Buffer.isBuffer(buffer))
|
||||
throw new TypeError('Not a string or buffer');
|
||||
|
||||
var flushFlag = binding.Z_FINISH;
|
||||
|
||||
return engine._processChunk(buffer, flushFlag);
|
||||
}
|
||||
|
||||
// generic zlib
|
||||
// minimal 2-byte header
|
||||
export function Deflate(opts) {
|
||||
if (!(this instanceof Deflate)) return new Deflate(opts);
|
||||
Zlib.call(this, opts, binding.DEFLATE);
|
||||
}
|
||||
|
||||
export function Inflate(opts) {
|
||||
if (!(this instanceof Inflate)) return new Inflate(opts);
|
||||
Zlib.call(this, opts, binding.INFLATE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// gzip - bigger header, same deflate compression
|
||||
export function Gzip(opts) {
|
||||
if (!(this instanceof Gzip)) return new Gzip(opts);
|
||||
Zlib.call(this, opts, binding.GZIP);
|
||||
}
|
||||
|
||||
export function Gunzip(opts) {
|
||||
if (!(this instanceof Gunzip)) return new Gunzip(opts);
|
||||
Zlib.call(this, opts, binding.GUNZIP);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// raw - no header
|
||||
export function DeflateRaw(opts) {
|
||||
if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts);
|
||||
Zlib.call(this, opts, binding.DEFLATERAW);
|
||||
}
|
||||
|
||||
export function InflateRaw(opts) {
|
||||
if (!(this instanceof InflateRaw)) return new InflateRaw(opts);
|
||||
Zlib.call(this, opts, binding.INFLATERAW);
|
||||
}
|
||||
|
||||
|
||||
// auto-detect header.
|
||||
export function Unzip(opts) {
|
||||
if (!(this instanceof Unzip)) return new Unzip(opts);
|
||||
Zlib.call(this, opts, binding.UNZIP);
|
||||
}
|
||||
|
||||
|
||||
// the Zlib class they all inherit from
|
||||
// This thing manages the queue of requests, and returns
|
||||
// true or false if there is anything in the queue when
|
||||
// you call the .write() method.
|
||||
|
||||
export function Zlib(opts, mode) {
|
||||
this._opts = opts = opts || {};
|
||||
this._chunkSize = opts.chunkSize || binding.Z_DEFAULT_CHUNK;
|
||||
|
||||
Transform.call(this, opts);
|
||||
|
||||
if (opts.flush) {
|
||||
if (opts.flush !== binding.Z_NO_FLUSH &&
|
||||
opts.flush !== binding.Z_PARTIAL_FLUSH &&
|
||||
opts.flush !== binding.Z_SYNC_FLUSH &&
|
||||
opts.flush !== binding.Z_FULL_FLUSH &&
|
||||
opts.flush !== binding.Z_FINISH &&
|
||||
opts.flush !== binding.Z_BLOCK) {
|
||||
throw new Error('Invalid flush flag: ' + opts.flush);
|
||||
}
|
||||
}
|
||||
this._flushFlag = opts.flush || binding.Z_NO_FLUSH;
|
||||
|
||||
if (opts.chunkSize) {
|
||||
if (opts.chunkSize < binding.Z_MIN_CHUNK ||
|
||||
opts.chunkSize > binding.Z_MAX_CHUNK) {
|
||||
throw new Error('Invalid chunk size: ' + opts.chunkSize);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.windowBits) {
|
||||
if (opts.windowBits < binding.Z_MIN_WINDOWBITS ||
|
||||
opts.windowBits > binding.Z_MAX_WINDOWBITS) {
|
||||
throw new Error('Invalid windowBits: ' + opts.windowBits);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.level) {
|
||||
if (opts.level < binding.Z_MIN_LEVEL ||
|
||||
opts.level > binding.Z_MAX_LEVEL) {
|
||||
throw new Error('Invalid compression level: ' + opts.level);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.memLevel) {
|
||||
if (opts.memLevel < binding.Z_MIN_MEMLEVEL ||
|
||||
opts.memLevel > binding.Z_MAX_MEMLEVEL) {
|
||||
throw new Error('Invalid memLevel: ' + opts.memLevel);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.strategy) {
|
||||
if (opts.strategy != binding.Z_FILTERED &&
|
||||
opts.strategy != binding.Z_HUFFMAN_ONLY &&
|
||||
opts.strategy != binding.Z_RLE &&
|
||||
opts.strategy != binding.Z_FIXED &&
|
||||
opts.strategy != binding.Z_DEFAULT_STRATEGY) {
|
||||
throw new Error('Invalid strategy: ' + opts.strategy);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.dictionary) {
|
||||
if (!Buffer.isBuffer(opts.dictionary)) {
|
||||
throw new Error('Invalid dictionary: it should be a Buffer instance');
|
||||
}
|
||||
}
|
||||
|
||||
this._binding = new binding.Zlib(mode);
|
||||
|
||||
var self = this;
|
||||
this._hadError = false;
|
||||
this._binding.onerror = function(message, errno) {
|
||||
// there is no way to cleanly recover.
|
||||
// continuing only obscures problems.
|
||||
self._binding = null;
|
||||
self._hadError = true;
|
||||
|
||||
var error = new Error(message);
|
||||
error.errno = errno;
|
||||
error.code = binding.codes[errno];
|
||||
self.emit('error', error);
|
||||
};
|
||||
|
||||
var level = binding.Z_DEFAULT_COMPRESSION;
|
||||
if (typeof opts.level === 'number') level = opts.level;
|
||||
|
||||
var strategy = binding.Z_DEFAULT_STRATEGY;
|
||||
if (typeof opts.strategy === 'number') strategy = opts.strategy;
|
||||
|
||||
this._binding.init(opts.windowBits || binding.Z_DEFAULT_WINDOWBITS,
|
||||
level,
|
||||
opts.memLevel || binding.Z_DEFAULT_MEMLEVEL,
|
||||
strategy,
|
||||
opts.dictionary);
|
||||
|
||||
this._buffer = new Buffer(this._chunkSize);
|
||||
this._offset = 0;
|
||||
this._closed = false;
|
||||
this._level = level;
|
||||
this._strategy = strategy;
|
||||
|
||||
this.once('end', this.close);
|
||||
}
|
||||
|
||||
inherits(Zlib, Transform);
|
||||
|
||||
Zlib.prototype.params = function(level, strategy, callback) {
|
||||
if (level < binding.Z_MIN_LEVEL ||
|
||||
level > binding.Z_MAX_LEVEL) {
|
||||
throw new RangeError('Invalid compression level: ' + level);
|
||||
}
|
||||
if (strategy != binding.Z_FILTERED &&
|
||||
strategy != binding.Z_HUFFMAN_ONLY &&
|
||||
strategy != binding.Z_RLE &&
|
||||
strategy != binding.Z_FIXED &&
|
||||
strategy != binding.Z_DEFAULT_STRATEGY) {
|
||||
throw new TypeError('Invalid strategy: ' + strategy);
|
||||
}
|
||||
|
||||
if (this._level !== level || this._strategy !== strategy) {
|
||||
var self = this;
|
||||
this.flush(binding.Z_SYNC_FLUSH, function() {
|
||||
self._binding.params(level, strategy);
|
||||
if (!self._hadError) {
|
||||
self._level = level;
|
||||
self._strategy = strategy;
|
||||
if (callback) callback();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
process.nextTick(callback);
|
||||
}
|
||||
};
|
||||
|
||||
Zlib.prototype.reset = function() {
|
||||
return this._binding.reset();
|
||||
};
|
||||
|
||||
// This is the _flush function called by the transform class,
|
||||
// internally, when the last chunk has been written.
|
||||
Zlib.prototype._flush = function(callback) {
|
||||
this._transform(new Buffer(0), '', callback);
|
||||
};
|
||||
|
||||
Zlib.prototype.flush = function(kind, callback) {
|
||||
var ws = this._writableState;
|
||||
|
||||
if (typeof kind === 'function' || (kind === void 0 && !callback)) {
|
||||
callback = kind;
|
||||
kind = binding.Z_FULL_FLUSH;
|
||||
}
|
||||
|
||||
if (ws.ended) {
|
||||
if (callback)
|
||||
process.nextTick(callback);
|
||||
} else if (ws.ending) {
|
||||
if (callback)
|
||||
this.once('end', callback);
|
||||
} else if (ws.needDrain) {
|
||||
var self = this;
|
||||
this.once('drain', function() {
|
||||
self.flush(callback);
|
||||
});
|
||||
} else {
|
||||
this._flushFlag = kind;
|
||||
this.write(new Buffer(0), '', callback);
|
||||
}
|
||||
};
|
||||
|
||||
Zlib.prototype.close = function(callback) {
|
||||
if (callback)
|
||||
process.nextTick(callback);
|
||||
|
||||
if (this._closed)
|
||||
return;
|
||||
|
||||
this._closed = true;
|
||||
|
||||
this._binding.close();
|
||||
|
||||
var self = this;
|
||||
process.nextTick(function() {
|
||||
self.emit('close');
|
||||
});
|
||||
};
|
||||
|
||||
Zlib.prototype._transform = function(chunk, encoding, cb) {
|
||||
var flushFlag;
|
||||
var ws = this._writableState;
|
||||
var ending = ws.ending || ws.ended;
|
||||
var last = ending && (!chunk || ws.length === chunk.length);
|
||||
|
||||
if (!chunk === null && !Buffer.isBuffer(chunk))
|
||||
return cb(new Error('invalid input'));
|
||||
|
||||
// If it's the last chunk, or a final flush, we use the Z_FINISH flush flag.
|
||||
// If it's explicitly flushing at some other time, then we use
|
||||
// Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression
|
||||
// goodness.
|
||||
if (last)
|
||||
flushFlag = binding.Z_FINISH;
|
||||
else {
|
||||
flushFlag = this._flushFlag;
|
||||
// once we've flushed the last of the queue, stop flushing and
|
||||
// go back to the normal behavior.
|
||||
if (chunk.length >= ws.length) {
|
||||
this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH;
|
||||
}
|
||||
}
|
||||
|
||||
this._processChunk(chunk, flushFlag, cb);
|
||||
};
|
||||
|
||||
Zlib.prototype._processChunk = function(chunk, flushFlag, cb) {
|
||||
var availInBefore = chunk && chunk.length;
|
||||
var availOutBefore = this._chunkSize - this._offset;
|
||||
var inOff = 0;
|
||||
|
||||
var self = this;
|
||||
|
||||
var async = typeof cb === 'function';
|
||||
|
||||
if (!async) {
|
||||
var buffers = [];
|
||||
var nread = 0;
|
||||
|
||||
var error;
|
||||
this.on('error', function(er) {
|
||||
error = er;
|
||||
});
|
||||
|
||||
do {
|
||||
var res = this._binding.writeSync(flushFlag,
|
||||
chunk, // in
|
||||
inOff, // in_off
|
||||
availInBefore, // in_len
|
||||
this._buffer, // out
|
||||
this._offset, //out_off
|
||||
availOutBefore); // out_len
|
||||
} while (!this._hadError && callback(res[0], res[1]));
|
||||
|
||||
if (this._hadError) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
var buf = Buffer.concat(buffers, nread);
|
||||
this.close();
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
var req = this._binding.write(flushFlag,
|
||||
chunk, // in
|
||||
inOff, // in_off
|
||||
availInBefore, // in_len
|
||||
this._buffer, // out
|
||||
this._offset, //out_off
|
||||
availOutBefore); // out_len
|
||||
|
||||
req.buffer = chunk;
|
||||
req.callback = callback;
|
||||
|
||||
function callback(availInAfter, availOutAfter) {
|
||||
if (self._hadError)
|
||||
return;
|
||||
|
||||
var have = availOutBefore - availOutAfter;
|
||||
assert(have >= 0, 'have should not go down');
|
||||
|
||||
if (have > 0) {
|
||||
var out = self._buffer.slice(self._offset, self._offset + have);
|
||||
self._offset += have;
|
||||
// serve some output to the consumer.
|
||||
if (async) {
|
||||
self.push(out);
|
||||
} else {
|
||||
buffers.push(out);
|
||||
nread += out.length;
|
||||
}
|
||||
}
|
||||
|
||||
// exhausted the output buffer, or used all the input create a new one.
|
||||
if (availOutAfter === 0 || self._offset >= self._chunkSize) {
|
||||
availOutBefore = self._chunkSize;
|
||||
self._offset = 0;
|
||||
self._buffer = new Buffer(self._chunkSize);
|
||||
}
|
||||
|
||||
if (availOutAfter === 0) {
|
||||
// Not actually done. Need to reprocess.
|
||||
// Also, update the availInBefore to the availInAfter value,
|
||||
// so that if we have to hit it a third (fourth, etc.) time,
|
||||
// it'll have the correct byte counts.
|
||||
inOff += (availInBefore - availInAfter);
|
||||
availInBefore = availInAfter;
|
||||
|
||||
if (!async)
|
||||
return true;
|
||||
|
||||
var newReq = self._binding.write(flushFlag,
|
||||
chunk,
|
||||
inOff,
|
||||
availInBefore,
|
||||
self._buffer,
|
||||
self._offset,
|
||||
self._chunkSize);
|
||||
newReq.callback = callback; // this same function
|
||||
newReq.buffer = chunk;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!async)
|
||||
return false;
|
||||
|
||||
// finished with the chunk.
|
||||
cb();
|
||||
}
|
||||
};
|
||||
|
||||
inherits(Deflate, Zlib);
|
||||
inherits(Inflate, Zlib);
|
||||
inherits(Gzip, Zlib);
|
||||
inherits(Gunzip, Zlib);
|
||||
inherits(DeflateRaw, Zlib);
|
||||
inherits(InflateRaw, Zlib);
|
||||
inherits(Unzip, Zlib);
|
||||
export default {
|
||||
codes: codes,
|
||||
createDeflate: createDeflate,
|
||||
createInflate: createInflate,
|
||||
createDeflateRaw: createDeflateRaw,
|
||||
createInflateRaw: createInflateRaw,
|
||||
createGzip: createGzip,
|
||||
createGunzip: createGunzip,
|
||||
createUnzip: createUnzip,
|
||||
deflate: deflate,
|
||||
deflateSync: deflateSync,
|
||||
gzip: gzip,
|
||||
gzipSync: gzipSync,
|
||||
deflateRaw: deflateRaw,
|
||||
deflateRawSync: deflateRawSync,
|
||||
unzip: unzip,
|
||||
unzipSync: unzipSync,
|
||||
inflate: inflate,
|
||||
inflateSync: inflateSync,
|
||||
gunzip: gunzip,
|
||||
gunzipSync: gunzipSync,
|
||||
inflateRaw: inflateRaw,
|
||||
inflateRawSync: inflateRawSync,
|
||||
Deflate: Deflate,
|
||||
Inflate: Inflate,
|
||||
Gzip: Gzip,
|
||||
Gunzip: Gunzip,
|
||||
DeflateRaw: DeflateRaw,
|
||||
InflateRaw: InflateRaw,
|
||||
Unzip: Unzip,
|
||||
Zlib: Zlib
|
||||
};
|
96
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/readme.md
generated
vendored
Normal file
96
cool-dawn-3d3b/node_modules/rollup-plugin-node-polyfills/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
rollup-plugin-node-polyfills
|
||||
===
|
||||
|
||||
```
|
||||
npm install --save-dev rollup-plugin-node-polyfills
|
||||
```
|
||||
|
||||
Allows the node builtins to be `require`d/`import`ed.
|
||||
|
||||
The following modules include ES6 specific version which allow you to do named imports in addition to the default import and should work fine if you only use this plugin.
|
||||
|
||||
- process*
|
||||
- events
|
||||
- stream*
|
||||
- util*
|
||||
- path
|
||||
- buffer*
|
||||
- querystring
|
||||
- url*
|
||||
- string_decoder*
|
||||
- punycode
|
||||
- http*†
|
||||
- https*†
|
||||
- os*
|
||||
- assert*
|
||||
- constants
|
||||
- timers*
|
||||
- console*‡
|
||||
- vm*§
|
||||
- zlib*
|
||||
- tty
|
||||
- domain
|
||||
- dns∆
|
||||
- dgram∆
|
||||
- child_process∆
|
||||
- cluster∆
|
||||
- module∆
|
||||
- net∆
|
||||
- readline∆
|
||||
- repl∆
|
||||
- tls∆
|
||||
- fs˚
|
||||
- crypto˚
|
||||
|
||||
|
||||
† the http and https modules are actually the same and don't differentiate based on protocol
|
||||
|
||||
‡ default export only, because it's console, seriously just use the global
|
||||
|
||||
§ vm does not have all corner cases and has less of them in a web worker
|
||||
|
||||
∆ not shimmed, just returns mock
|
||||
|
||||
˚ optional, add option to enable browserified shim
|
||||
|
||||
Crypto is not shimmed and and we just provide the commonjs one from browserify and it will likely not work, if you really want it please pass `{crypto: true}` as an option.
|
||||
|
||||
Not all included modules rollup equally, streams (and by extension anything that requires it like http) are a mess of circular references that are pretty much impossible to tree-shake out, similarly url methods are actually a shortcut to a url object so those methods don't tree shake out very well, punycode, path, querystring, events, util, and process tree shake very well especially if you do named imports.
|
||||
|
||||
config for using this with something simple like events or querystring
|
||||
|
||||
```js
|
||||
import nodePolyfills from 'rollup-plugin-node-polyfills';
|
||||
rollup({
|
||||
entry: 'main.js',
|
||||
plugins: [
|
||||
nodePolyfills()
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
and now if main contains this, it should just work
|
||||
|
||||
```js
|
||||
import EventEmitter from 'events';
|
||||
import {inherits} from 'util';
|
||||
|
||||
// etc
|
||||
```
|
||||
|
||||
Config for something more complicated like http
|
||||
|
||||
```js
|
||||
import nodePolyfills from 'rollup-plugin-node-polyfills';
|
||||
rollup({
|
||||
entry: 'main.js',
|
||||
plugins: [
|
||||
nodePolyfills()
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
License
|
||||
===
|
||||
|
||||
MIT except ES6 ports of browserify modules which are whatever the original library was.
|
Loading…
Add table
Add a link
Reference in a new issue