From 81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Wed, 18 Nov 2020 23:26:45 +0100 Subject: rm node_modules --- node_modules/serialize-javascript/LICENSE | 27 --- node_modules/serialize-javascript/README.md | 144 -------------- node_modules/serialize-javascript/index.js | 259 ------------------------- node_modules/serialize-javascript/package.json | 64 ------ 4 files changed, 494 deletions(-) delete mode 100644 node_modules/serialize-javascript/LICENSE delete mode 100644 node_modules/serialize-javascript/README.md delete mode 100644 node_modules/serialize-javascript/index.js delete mode 100644 node_modules/serialize-javascript/package.json (limited to 'node_modules/serialize-javascript') diff --git a/node_modules/serialize-javascript/LICENSE b/node_modules/serialize-javascript/LICENSE deleted file mode 100644 index 263382a..0000000 --- a/node_modules/serialize-javascript/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2014 Yahoo! Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of the Yahoo! Inc. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/serialize-javascript/README.md b/node_modules/serialize-javascript/README.md deleted file mode 100644 index 1339474..0000000 --- a/node_modules/serialize-javascript/README.md +++ /dev/null @@ -1,144 +0,0 @@ -Serialize JavaScript -==================== - -Serialize JavaScript to a _superset_ of JSON that includes regular expressions, dates and functions. - -[![npm Version][npm-badge]][npm] -[![Dependency Status][david-badge]][david] -[![Build Status][travis-badge]][travis] - -## Overview - -The code in this package began its life as an internal module to [express-state][]. To expand its usefulness, it now lives as `serialize-javascript` — an independent package on npm. - -You're probably wondering: **What about `JSON.stringify()`!?** We've found that sometimes we need to serialize JavaScript **functions**, **regexps**, **dates**, **sets** or **maps**. A great example is a web app that uses client-side URL routing where the route definitions are regexps that need to be shared from the server to the client. But this module is also great for communicating between node processes. - -The string returned from this package's single export function is literal JavaScript which can be saved to a `.js` file, or be embedded into an HTML document by making the content of a `' -}); -``` - -The above will produce the following string, HTML-escaped output which is safe to put into an HTML document as it will not cause the inline script element to terminate: - -```js -'{"haxorXSS":"\\u003C\\u002Fscript\\u003E"}' -``` - -> You can pass an optional `unsafe` argument to `serialize()` for straight serialization. - -### Options - -The `serialize()` function accepts an `options` object as its second argument. All options are being defaulted to `undefined`: - -#### `options.space` - -This option is the same as the `space` argument that can be passed to [`JSON.stringify`][JSON.stringify]. It can be used to add whitespace and indentation to the serialized output to make it more readable. - -```js -serialize(obj, {space: 2}); -``` - -#### `options.isJSON` - -This option is a signal to `serialize()` that the object being serialized does not contain any function or regexps values. This enables a hot-path that allows serialization to be over 3x faster. If you're serializing a lot of data, and know its pure JSON, then you can enable this option for a speed-up. - -**Note:** That when using this option, the output will still be escaped to protect against XSS. - -```js -serialize(obj, {isJSON: true}); -``` - -#### `options.unsafe` - -This option is to signal `serialize()` that we want to do a straight conversion, without the XSS protection. This options needs to be explicitly set to `true`. HTML characters and JavaScript line terminators will not be escaped. You will have to roll your own. - -```js -serialize(obj, {unsafe: true}); -``` - -#### `options.ignoreFunction` - -This option is to signal `serialize()` that we do not want serialize JavaScript function. -Just treat function like `JSON.stringify` do, but other features will work as expected. - -```js -serialize(obj, {ignoreFunction: true}); -``` - -## Deserializing - -For some use cases you might also need to deserialize the string. This is explicitly not part of this module. However, you can easily write it yourself: - -```js -function deserialize(serializedJavascript){ - return eval('(' + serializedJavascript + ')'); -} -``` - -**Note:** Don't forget the parentheses around the serialized javascript, as the opening bracket `{` will be considered to be the start of a body. - -## License - -This software is free to use under the Yahoo! Inc. BSD license. -See the [LICENSE file][LICENSE] for license text and copyright information. - - -[npm]: https://www.npmjs.org/package/serialize-javascript -[npm-badge]: https://img.shields.io/npm/v/serialize-javascript.svg?style=flat-square -[david]: https://david-dm.org/yahoo/serialize-javascript -[david-badge]: https://img.shields.io/david/yahoo/serialize-javascript.svg?style=flat-square -[travis]: https://travis-ci.org/yahoo/serialize-javascript -[travis-badge]: https://img.shields.io/travis/yahoo/serialize-javascript.svg?style=flat-square -[express-state]: https://github.com/yahoo/express-state -[JSON.stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify -[LICENSE]: https://github.com/yahoo/serialize-javascript/blob/master/LICENSE diff --git a/node_modules/serialize-javascript/index.js b/node_modules/serialize-javascript/index.js deleted file mode 100644 index 640db8f..0000000 --- a/node_modules/serialize-javascript/index.js +++ /dev/null @@ -1,259 +0,0 @@ -/* -Copyright (c) 2014, Yahoo! Inc. All rights reserved. -Copyrights licensed under the New BSD License. -See the accompanying LICENSE file for terms. -*/ - -'use strict'; - -var randomBytes = require('randombytes'); - -// Generate an internal UID to make the regexp pattern harder to guess. -var UID_LENGTH = 16; -var UID = generateUID(); -var PLACE_HOLDER_REGEXP = new RegExp('(\\\\)?"@__(F|R|D|M|S|A|U|I|B)-' + UID + '-(\\d+)__@"', 'g'); - -var IS_NATIVE_CODE_REGEXP = /\{\s*\[native code\]\s*\}/g; -var IS_PURE_FUNCTION = /function.*?\(/; -var IS_ARROW_FUNCTION = /.*?=>.*?/; -var UNSAFE_CHARS_REGEXP = /[<>\/\u2028\u2029]/g; - -var RESERVED_SYMBOLS = ['*', 'async']; - -// Mapping of unsafe HTML and invalid JavaScript line terminator chars to their -// Unicode char counterparts which are safe to use in JavaScript strings. -var ESCAPED_CHARS = { - '<' : '\\u003C', - '>' : '\\u003E', - '/' : '\\u002F', - '\u2028': '\\u2028', - '\u2029': '\\u2029' -}; - -function escapeUnsafeChars(unsafeChar) { - return ESCAPED_CHARS[unsafeChar]; -} - -function generateUID() { - var bytes = randomBytes(UID_LENGTH); - var result = ''; - for(var i=0; i arg1+5 - if(IS_ARROW_FUNCTION.test(serializedFn)) { - return serializedFn; - } - - var argsStartsAt = serializedFn.indexOf('('); - var def = serializedFn.substr(0, argsStartsAt) - .trim() - .split(' ') - .filter(function(val) { return val.length > 0 }); - - var nonReservedSymbols = def.filter(function(val) { - return RESERVED_SYMBOLS.indexOf(val) === -1 - }); - - // enhanced literal objects, example: {key() {}} - if(nonReservedSymbols.length > 0) { - return (def.indexOf('async') > -1 ? 'async ' : '') + 'function' - + (def.join('').indexOf('*') > -1 ? '*' : '') - + serializedFn.substr(argsStartsAt); - } - - // arrow functions - return serializedFn; - } - - // Check if the parameter is function - if (options.ignoreFunction && typeof obj === "function") { - obj = undefined; - } - // Protects against `JSON.stringify()` returning `undefined`, by serializing - // to the literal string: "undefined". - if (obj === undefined) { - return String(obj); - } - - var str; - - // Creates a JSON string representation of the value. - // NOTE: Node 0.12 goes into slow mode with extra JSON.stringify() args. - if (options.isJSON && !options.space) { - str = JSON.stringify(obj); - } else { - str = JSON.stringify(obj, options.isJSON ? null : replacer, options.space); - } - - // Protects against `JSON.stringify()` returning `undefined`, by serializing - // to the literal string: "undefined". - if (typeof str !== 'string') { - return String(str); - } - - // Replace unsafe HTML and invalid JavaScript line terminator chars with - // their safe Unicode char counterpart. This _must_ happen before the - // regexps and functions are serialized and added back to the string. - if (options.unsafe !== true) { - str = str.replace(UNSAFE_CHARS_REGEXP, escapeUnsafeChars); - } - - if (functions.length === 0 && regexps.length === 0 && dates.length === 0 && maps.length === 0 && sets.length === 0 && arrays.length === 0 && undefs.length === 0 && infinities.length === 0 && bigInts.length === 0) { - return str; - } - - // Replaces all occurrences of function, regexp, date, map and set placeholders in the - // JSON string with their string representations. If the original value can - // not be found, then `undefined` is used. - return str.replace(PLACE_HOLDER_REGEXP, function (match, backSlash, type, valueIndex) { - // The placeholder may not be preceded by a backslash. This is to prevent - // replacing things like `"a\"@__R--0__@"` and thus outputting - // invalid JS. - if (backSlash) { - return match; - } - - if (type === 'D') { - return "new Date(\"" + dates[valueIndex].toISOString() + "\")"; - } - - if (type === 'R') { - return "new RegExp(" + serialize(regexps[valueIndex].source) + ", \"" + regexps[valueIndex].flags + "\")"; - } - - if (type === 'M') { - return "new Map(" + serialize(Array.from(maps[valueIndex].entries()), options) + ")"; - } - - if (type === 'S') { - return "new Set(" + serialize(Array.from(sets[valueIndex].values()), options) + ")"; - } - - if (type === 'A') { - return "Array.prototype.slice.call(" + serialize(Object.assign({ length: arrays[valueIndex].length }, arrays[valueIndex]), options) + ")"; - } - - if (type === 'U') { - return 'undefined' - } - - if (type === 'I') { - return infinities[valueIndex]; - } - - if (type === 'B') { - return "BigInt(\"" + bigInts[valueIndex] + "\")"; - } - - var fn = functions[valueIndex]; - - return serializeFunc(fn); - }); -} diff --git a/node_modules/serialize-javascript/package.json b/node_modules/serialize-javascript/package.json deleted file mode 100644 index a06000d..0000000 --- a/node_modules/serialize-javascript/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "_from": "serialize-javascript@^5.0.1", - "_id": "serialize-javascript@5.0.1", - "_inBundle": false, - "_integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", - "_location": "/serialize-javascript", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "serialize-javascript@^5.0.1", - "name": "serialize-javascript", - "escapedName": "serialize-javascript", - "rawSpec": "^5.0.1", - "saveSpec": null, - "fetchSpec": "^5.0.1" - }, - "_requiredBy": [ - "/copy-webpack-plugin" - ], - "_resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", - "_shasum": "7886ec848049a462467a97d3d918ebb2aaf934f4", - "_spec": "serialize-javascript@^5.0.1", - "_where": "/home/pruss/Dev/3-minute-website/node_modules/copy-webpack-plugin", - "author": { - "name": "Eric Ferraiuolo", - "email": "edf@ericf.me" - }, - "bugs": { - "url": "https://github.com/yahoo/serialize-javascript/issues" - }, - "bundleDependencies": false, - "dependencies": { - "randombytes": "^2.1.0" - }, - "deprecated": false, - "description": "Serialize JavaScript to a superset of JSON that includes regular expressions and functions.", - "devDependencies": { - "benchmark": "^2.1.4", - "chai": "^4.1.0", - "mocha": "^8.0.1", - "nyc": "^15.0.0" - }, - "homepage": "https://github.com/yahoo/serialize-javascript", - "keywords": [ - "serialize", - "serialization", - "javascript", - "js", - "json" - ], - "license": "BSD-3-Clause", - "main": "index.js", - "name": "serialize-javascript", - "repository": { - "type": "git", - "url": "git+https://github.com/yahoo/serialize-javascript.git" - }, - "scripts": { - "benchmark": "node -v && node test/benchmark/serialize.js", - "test": "nyc --reporter=lcov mocha test/unit" - }, - "version": "5.0.1" -} -- cgit v1.2.3