This commit is contained in:
2022-09-30 05:39:11 +00:00
parent 41ee9463ae
commit 4687fa49bc
11418 changed files with 1312504 additions and 0 deletions

View File

@ -0,0 +1,8 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # not working due missing www.
open_collective: #
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: https://www.patreon.com/webreflection

15
buildfiles/app/node_modules/flatted/LICENSE generated vendored Normal file
View File

@ -0,0 +1,15 @@
ISC License
Copyright (c) 2018, Andrea Giammarchi, @WebReflection
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

65
buildfiles/app/node_modules/flatted/README.md generated vendored Normal file
View File

@ -0,0 +1,65 @@
# flatted
![Downloads](https://img.shields.io/npm/dm/flatted.svg) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/flatted/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/flatted?branch=master) [![Build Status](https://travis-ci.org/WebReflection/flatted.svg?branch=master)](https://travis-ci.org/WebReflection/flatted) [![License: ISC](https://img.shields.io/badge/License-ISC-yellow.svg)](https://opensource.org/licenses/ISC) ![WebReflection status](https://offline.report/status/webreflection.svg)
A super light (0.5K) and fast circular JSON parser, directly from the creator of [CircularJSON](https://github.com/WebReflection/circular-json/#circularjson).
```js
npm i flatted
```
Usable via [CDN](https://unpkg.com/flatted) or as regular module.
```js
// ESM
import {parse, stringify} from 'flatted/esm';
// CJS
const {parse, stringify} = require('flatted/cjs');
const a = [{}];
a[0].a = a;
a.push(a);
stringify(a); // [["1","0"],{"a":"0"}]
```
## Flatted VS JSON
As it is for every other specialized format capable of serializing and deserializing circular data, you should never `JSON.parse(Flatted.stringify(data))`, and you should never `Flatted.parse(JSON.stringify(data))`.
The only way this could work is to `Flatted.parse(Flatted.stringify(data))`, as it is also for _CircularJSON_ or any other, otherwise there's no granted data integrity.
Also please note this project serializes and deserializes only data compatible with JSON, so that sockets, or anything else with internal classes different from those allowed by JSON standard, won't be serialized and unserialized as expected.
### New in V1: Exact same JSON API
* Added a [reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Syntax) parameter to `.parse(string, reviver)` and revive your own objects.
* Added a [replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Syntax) and a `space` parameter to `.stringify(object, replacer, space)` for feature parity with JSON signature.
### Compatibility
All ECMAScript engines compatible with `Map`, `Set`, `Object.keys`, and `Array.prototype.reduce` will work, even if polyfilled.
### How does it work ?
While stringifying, all Objects, including Arrays, and strings, are flattened out and replaced as unique index. `*`
Once parsed, all indexes will be replaced through the flattened collection.
<sup><sub>`*` represented as string to avoid conflicts with numbers</sub></sup>
```js
// logic example
var a = [{one: 1}, {two: '2'}];
a[0].a = a;
// a is the main object, will be at index '0'
// {one: 1} is the second object, index '1'
// {two: '2'} the third, in '2', and it has a string
// which will be found at index '3'
Flatted.stringify(a);
// [["1","2"],{"one":1,"a":"0"},{"two":"3"},"2"]
// a[one,two] {one: 1, a} {two: '2'} '2'
```

94
buildfiles/app/node_modules/flatted/SPECS.md generated vendored Normal file
View File

@ -0,0 +1,94 @@
# Flatted Specifications
This document describes operations performed to produce, or parse, the flatted output.
## stringify(any) => flattedString
The output is always an `Array` that contains at index `0` the given value.
If the value is an `Array` or an `Object`, per each property value passed through the callback, return the value as is if it's not an `Array`, an `Object`, or a `string`.
In case it's an `Array`, an `Object`, or a `string`, return the index as `string`, associated through a `Map`.
Giving the following example:
```js
flatted.stringify('a'); // ["a"]
flatted.stringify(['a']); // [["1"],"a"]
flatted.stringify(['a', 1, 'b']); // [["1",1,"2"],"a","b"]
```
There is an `input` containing `[array, "a", "b"]`, where the `array` has indexes `"1"` and `"2"` as strings, indexes that point respectively at `"a"` and `"b"` within the input `[array, "a", "b"]`.
The exact same happens for objects.
```js
flatted.stringify('a'); // ["a"]
flatted.stringify({a: 'a'}); // [{"a":"1"},"a"]
flatted.stringify({a: 'a', n: 1, b: 'b'}); // [{"a":"1","n":1,"b":"2"},"a","b"]
```
Every object, string, or array, encountered during serialization will be stored once as stringified index.
```js
// per each property/value of the object/array
if (any == null || !/object|string/.test(typeof any))
return any;
if (!map.has(any)) {
const index = String(arr.length);
arr.push(any);
map.set(any, index);
}
return map.get(any);
```
This, performed before going through all properties, grants unique indexes per reference.
The stringified indexes ensure there won't be conflicts with regularly stored numbers.
## parse(flattedString) => any
Everything that is a `string` is wrapped as `new String`, but strings in the array, from index `1` on, is kept as regular `string`.
```js
const input = JSON.parse('[{"a":"1"},"b"]', Strings).map(strings);
// convert strings primitives into String instances
function Strings(key, value) {
return typeof value === 'string' ? new String(value) : value;
}
// converts String instances into strings primitives
function strings(value) {
return value instanceof String ? String(value) : value;
}
```
The `input` array will have a regular `string` at index `1`, but its object at index `0` will have an `instanceof String` as `.a` property.
That is the key to place back values from the rest of the array, so that per each property of the object at index `0`, if the value is an `instanceof` String, something not serializable via JSON, it means it can be used to retrieve the position of its value from the `input` array.
If such `value` is an object and it hasn't been parsed yet, add it as parsed and go through all its properties/values.
```js
// outside any loop ...
const parsed = new Set;
// ... per each property/value ...
if (value instanceof Primitive) {
const tmp = input[parseInt(value)];
if (typeof tmp === 'object' && !parsed.has(tmp)) {
parsed.add(tmp);
output[key] = tmp;
if (typeof tmp === 'object' && tmp != null) {
// perform this same logic per
// each nested property/value ...
}
} else {
output[key] = tmp;
}
} else
output[key] = tmp;
```
As summary, the whole logic is based on polluting the de-serialization with a kind of variable that is unexpected, hence secure to use as directive to retrieve an index with a value.
The usage of a `Map` and a `Set` to flag known references/strings as visited/stored makes **flatted** a rock solid, fast, and compact, solution.

114
buildfiles/app/node_modules/flatted/cjs/index.js generated vendored Normal file
View File

@ -0,0 +1,114 @@
var Flatted = (function (Primitive, primitive) {
/*!
* ISC License
*
* Copyright (c) 2018, Andrea Giammarchi, @WebReflection
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
var Flatted = {
parse: function parse(text, reviver) {
var input = JSON.parse(text, Primitives).map(primitives);
var value = input[0];
var $ = reviver || noop;
var tmp = typeof value === 'object' && value ?
revive(input, new Set, value, $) :
value;
return $.call({'': tmp}, '', tmp);
},
stringify: function stringify(value, replacer, space) {
for (var
firstRun,
known = new Map,
input = [],
output = [],
$ = replacer && typeof replacer === typeof input ?
function (k, v) {
if (k === '' || -1 < replacer.indexOf(k)) return v;
} :
(replacer || noop),
i = +set(known, input, $.call({'': value}, '', value)),
replace = function (key, value) {
if (firstRun) {
firstRun = !firstRun;
return value;
}
var after = $.call(this, key, value);
switch (typeof after) {
case 'object':
if (after === null) return after;
case primitive:
return known.get(after) || set(known, input, after);
}
return after;
};
i < input.length; i++
) {
firstRun = true;
output[i] = JSON.stringify(input[i], replace, space);
}
return '[' + output.join(',') + ']';
}
};
return Flatted;
function noop(key, value) {
return value;
}
function revive(input, parsed, output, $) {
return Object.keys(output).reduce(
function (output, key) {
var value = output[key];
if (value instanceof Primitive) {
var tmp = input[value];
if (typeof tmp === 'object' && !parsed.has(tmp)) {
parsed.add(tmp);
output[key] = $.call(output, key, revive(input, parsed, tmp, $));
} else {
output[key] = $.call(output, key, tmp);
}
} else
output[key] = $.call(output, key, value);
return output;
},
output
);
}
function set(known, input, value) {
var index = Primitive(input.push(value) - 1);
known.set(value, index);
return index;
}
// the two kinds of primitives
// 1. the real one
// 2. the wrapped one
function primitives(value) {
return value instanceof Primitive ? Primitive(value) : value;
}
function Primitives(key, value) {
return typeof value === primitive ? new Primitive(value) : value;
}
}(String, 'string'));
module.exports = Flatted;

116
buildfiles/app/node_modules/flatted/esm/index.js generated vendored Normal file
View File

@ -0,0 +1,116 @@
var Flatted = (function (Primitive, primitive) {
/*!
* ISC License
*
* Copyright (c) 2018, Andrea Giammarchi, @WebReflection
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
var Flatted = {
parse: function parse(text, reviver) {
var input = JSON.parse(text, Primitives).map(primitives);
var value = input[0];
var $ = reviver || noop;
var tmp = typeof value === 'object' && value ?
revive(input, new Set, value, $) :
value;
return $.call({'': tmp}, '', tmp);
},
stringify: function stringify(value, replacer, space) {
for (var
firstRun,
known = new Map,
input = [],
output = [],
$ = replacer && typeof replacer === typeof input ?
function (k, v) {
if (k === '' || -1 < replacer.indexOf(k)) return v;
} :
(replacer || noop),
i = +set(known, input, $.call({'': value}, '', value)),
replace = function (key, value) {
if (firstRun) {
firstRun = !firstRun;
return value;
}
var after = $.call(this, key, value);
switch (typeof after) {
case 'object':
if (after === null) return after;
case primitive:
return known.get(after) || set(known, input, after);
}
return after;
};
i < input.length; i++
) {
firstRun = true;
output[i] = JSON.stringify(input[i], replace, space);
}
return '[' + output.join(',') + ']';
}
};
return Flatted;
function noop(key, value) {
return value;
}
function revive(input, parsed, output, $) {
return Object.keys(output).reduce(
function (output, key) {
var value = output[key];
if (value instanceof Primitive) {
var tmp = input[value];
if (typeof tmp === 'object' && !parsed.has(tmp)) {
parsed.add(tmp);
output[key] = $.call(output, key, revive(input, parsed, tmp, $));
} else {
output[key] = $.call(output, key, tmp);
}
} else
output[key] = $.call(output, key, value);
return output;
},
output
);
}
function set(known, input, value) {
var index = Primitive(input.push(value) - 1);
known.set(value, index);
return index;
}
// the two kinds of primitives
// 1. the real one
// 2. the wrapped one
function primitives(value) {
return value instanceof Primitive ? Primitive(value) : value;
}
function Primitives(key, value) {
return typeof value === primitive ? new Primitive(value) : value;
}
}(String, 'string'));
export default Flatted;
export var parse = Flatted.parse;
export var stringify = Flatted.stringify;

113
buildfiles/app/node_modules/flatted/index.js generated vendored Normal file
View File

@ -0,0 +1,113 @@
var Flatted = (function (Primitive, primitive) {
/*!
* ISC License
*
* Copyright (c) 2018, Andrea Giammarchi, @WebReflection
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
var Flatted = {
parse: function parse(text, reviver) {
var input = JSON.parse(text, Primitives).map(primitives);
var value = input[0];
var $ = reviver || noop;
var tmp = typeof value === 'object' && value ?
revive(input, new Set, value, $) :
value;
return $.call({'': tmp}, '', tmp);
},
stringify: function stringify(value, replacer, space) {
for (var
firstRun,
known = new Map,
input = [],
output = [],
$ = replacer && typeof replacer === typeof input ?
function (k, v) {
if (k === '' || -1 < replacer.indexOf(k)) return v;
} :
(replacer || noop),
i = +set(known, input, $.call({'': value}, '', value)),
replace = function (key, value) {
if (firstRun) {
firstRun = !firstRun;
return value;
}
var after = $.call(this, key, value);
switch (typeof after) {
case 'object':
if (after === null) return after;
case primitive:
return known.get(after) || set(known, input, after);
}
return after;
};
i < input.length; i++
) {
firstRun = true;
output[i] = JSON.stringify(input[i], replace, space);
}
return '[' + output.join(',') + ']';
}
};
return Flatted;
function noop(key, value) {
return value;
}
function revive(input, parsed, output, $) {
return Object.keys(output).reduce(
function (output, key) {
var value = output[key];
if (value instanceof Primitive) {
var tmp = input[value];
if (typeof tmp === 'object' && !parsed.has(tmp)) {
parsed.add(tmp);
output[key] = $.call(output, key, revive(input, parsed, tmp, $));
} else {
output[key] = $.call(output, key, tmp);
}
} else
output[key] = $.call(output, key, value);
return output;
},
output
);
}
function set(known, input, value) {
var index = Primitive(input.push(value) - 1);
known.set(value, index);
return index;
}
// the two kinds of primitives
// 1. the real one
// 2. the wrapped one
function primitives(value) {
return value instanceof Primitive ? Primitive(value) : value;
}
function Primitives(key, value) {
return typeof value === primitive ? new Primitive(value) : value;
}
}(String, 'string'));

2
buildfiles/app/node_modules/flatted/min.js generated vendored Normal file
View File

@ -0,0 +1,2 @@
/*! (c) 2018, Andrea Giammarchi, (ISC) */
var Flatted=function(a,l){return{parse:function(n,t){var e=JSON.parse(n,i).map(f),r=e[0],u=t||s,c="object"==typeof r&&r?function u(c,f,n,i){return Object.keys(n).reduce(function(n,t){var e=n[t];if(e instanceof a){var r=c[e];"object"!=typeof r||f.has(r)?n[t]=i.call(n,t,r):(f.add(r),n[t]=i.call(n,t,u(c,f,r,i)))}else n[t]=i.call(n,t,e);return n},n)}(e,new Set,r,u):r;return u.call({"":c},"",c)},stringify:function(n,e,t){function r(n,t){if(u)return u=!u,t;var e=a.call(this,n,t);switch(typeof e){case"object":if(null===e)return e;case l:return c.get(e)||p(c,f,e)}return e}for(var u,c=new Map,f=[],i=[],a=e&&typeof e==typeof f?function(n,t){if(""===n||-1<e.indexOf(n))return t}:e||s,o=+p(c,f,a.call({"":n},"",n));o<f.length;o++)u=!0,i[o]=JSON.stringify(f[o],r,t);return"["+i.join(",")+"]"}};function s(n,t){return t}function p(n,t,e){var r=a(t.push(e)-1);return n.set(e,r),r}function f(n){return n instanceof a?a(n):n}function i(n,t){return typeof t==l?new a(t):t}}(String,"string");

75
buildfiles/app/node_modules/flatted/package.json generated vendored Normal file
View File

@ -0,0 +1,75 @@
{
"_args": [
[
"flatted@2.0.2",
"/home/shihaam/www/freezer.shihaam.me/app"
]
],
"_development": true,
"_from": "flatted@2.0.2",
"_id": "flatted@2.0.2",
"_inBundle": false,
"_integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==",
"_location": "/flatted",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "flatted@2.0.2",
"name": "flatted",
"escapedName": "flatted",
"rawSpec": "2.0.2",
"saveSpec": null,
"fetchSpec": "2.0.2"
},
"_requiredBy": [
"/flat-cache"
],
"_resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz",
"_spec": "2.0.2",
"_where": "/home/shihaam/www/freezer.shihaam.me/app",
"author": {
"name": "Andrea Giammarchi"
},
"bugs": {
"url": "https://github.com/WebReflection/flatted/issues"
},
"description": "A super light and fast circular JSON parser.",
"devDependencies": {
"circular-json": "^0.5.9",
"circular-json-es6": "^2.0.2",
"coveralls": "^3.0.11",
"jsan": "^3.1.13",
"nyc": "^15.0.0",
"uglify-js": "^3.8.1"
},
"homepage": "https://github.com/WebReflection/flatted#readme",
"keywords": [
"circular",
"JSON",
"fast",
"parser",
"minimal"
],
"license": "ISC",
"main": "cjs/index.js",
"module": "esm/index.js",
"name": "flatted",
"repository": {
"type": "git",
"url": "git+https://github.com/WebReflection/flatted.git"
},
"scripts": {
"bench": "node test/bench.js",
"build": "npm run cjs && npm test && npm run esm && npm run min && npm run size",
"cjs": "cp index.js cjs/index.js; echo 'module.exports = Flatted;' >> cjs/index.js",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"esm": "cp index.js esm/index.js; echo 'export default Flatted;' >> esm/index.js; echo 'export var parse = Flatted.parse;' >> esm/index.js; echo 'export var stringify = Flatted.stringify;' >> esm/index.js",
"min": "echo '/*! (c) 2018, Andrea Giammarchi, (ISC) */'>min.js && uglifyjs index.js --support-ie8 -c -m >> min.js",
"size": "cat index.js | wc -c;cat min.js | wc -c;gzip -c9 min.js | wc -c;cat min.js | brotli | wc -c",
"test": "nyc node test/index.js"
},
"types": "types.d.ts",
"unpkg": "min.js",
"version": "2.0.2"
}

19
buildfiles/app/node_modules/flatted/types.d.ts generated vendored Normal file
View File

@ -0,0 +1,19 @@
/**
* Fast and minimal circular JSON parser.
* logic example
```js
var a = [{one: 1}, {two: '2'}];
a[0].a = a;
// a is the main object, will be at index '0'
// {one: 1} is the second object, index '1'
// {two: '2'} the third, in '2', and it has a string
// which will be found at index '3'
Flatted.stringify(a);
// [["1","2"],{"one":1,"a":"0"},{"two":"3"},"2"]
// a[one,two] {one: 1, a} {two: '2'} '2'
```
*/
declare const Flatted: typeof JSON;
export = Flatted;