Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2021-07-27 16:54:26 +00:00
parent 6b0d45a5c6
commit cc1adb825a
4247 changed files with 144820 additions and 149530 deletions

2
node_modules/flatted/LICENSE generated vendored
View file

@ -1,6 +1,6 @@
ISC License
Copyright (c) 2018, Andrea Giammarchi, @WebReflection
Copyright (c) 2018-2020, 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

40
node_modules/flatted/README.md generated vendored
View file

@ -1,9 +1,15 @@
# 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)
[![Downloads](https://img.shields.io/npm/dm/flatted.svg)](https://www.npmjs.com/package/flatted) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/flatted/badge.svg?branch=main)](https://coveralls.io/github/WebReflection/flatted?branch=main) [![Build Status](https://travis-ci.com/WebReflection/flatted.svg?branch=main)](https://travis-ci.com/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)
![snow flake](./flatted.jpg)
<sup>**Social Media Photo by [Matt Seymour](https://unsplash.com/@mattseymour) on [Unsplash](https://unsplash.com/)**</sup>
A super light (0.5K) and fast circular JSON parser, directly from the creator of [CircularJSON](https://github.com/WebReflection/circular-json/#circularjson).
Now available also for **[PHP](./php/flatted.php)**.
```js
npm i flatted
```
@ -12,10 +18,10 @@ Usable via [CDN](https://unpkg.com/flatted) or as regular module.
```js
// ESM
import {parse, stringify} from 'flatted/esm';
import {parse, stringify, toJSON, fromJSON} from 'flatted';
// CJS
const {parse, stringify} = require('flatted/cjs');
const {parse, stringify, toJSON, fromJSON} = require('flatted');
const a = [{}];
a[0].a = a;
@ -24,6 +30,34 @@ a.push(a);
stringify(a); // [["1","0"],{"a":"0"}]
```
## toJSON and from JSON
If you'd like to implicitly survive JSON serialization, these two helpers helps:
```js
import {toJSON, fromJSON} from 'flatted';
class RecursiveMap extends Map {
static fromJSON(any) {
return new this(fromJSON(any));
}
toJSON() {
return toJSON([...this.entries()]);
}
}
const recursive = new RecursiveMap;
const same = {};
same.same = same;
recursive.set('same', same);
const asString = JSON.stringify(recursive);
const asMap = RecursiveMap.fromJSON(JSON.parse(asString));
asMap.get('same') === asMap.get('same').same;
// true
```
## 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))`.

189
node_modules/flatted/cjs/index.js generated vendored
View file

@ -1,114 +1,99 @@
var Flatted = (function (Primitive, primitive) {
'use strict';
/*! (c) 2020 Andrea Giammarchi */
/*!
* 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.
*/
const {parse: $parse, stringify: $stringify} = JSON;
const {keys} = Object;
var Flatted = {
const Primitive = String; // it could be Number
const primitive = 'string'; // it could be 'number'
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);
},
const ignore = {};
const object = 'object';
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);
const noop = (_, value) => value;
const primitives = value => (
value instanceof Primitive ? Primitive(value) : value
);
const Primitives = (_, value) => (
typeof value === primitive ? new Primitive(value) : value
);
const revive = (input, parsed, output, $) => {
const lazy = [];
for (let ke = keys(output), {length} = ke, y = 0; y < length; y++) {
const k = ke[y];
const value = output[k];
if (value instanceof Primitive) {
const tmp = input[value];
if (typeof tmp === object && !parsed.has(tmp)) {
parsed.add(tmp);
output[k] = ignore;
lazy.push({k, a: [input, parsed, tmp, $]});
}
return '[' + output.join(',') + ']';
else
output[k] = $.call(output, k, tmp);
}
};
return Flatted;
function noop(key, value) {
return value;
else if (output[k] !== ignore)
output[k] = $.call(output, k, 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
);
for (let {length} = lazy, i = 0; i < length; i++) {
const {k, a} = lazy[i];
output[k] = $.call(output, k, revive.apply(null, a));
}
return output;
};
function set(known, input, value) {
var index = Primitive(input.push(value) - 1);
known.set(value, index);
return index;
const set = (known, input, value) => {
const index = Primitive(input.push(value) - 1);
known.set(value, index);
return index;
};
const parse = (text, reviver) => {
const input = $parse(text, Primitives).map(primitives);
const value = input[0];
const $ = reviver || noop;
const tmp = typeof value === object && value ?
revive(input, new Set, value, $) :
value;
return $.call({'': tmp}, '', tmp);
};
exports.parse = parse;
const stringify = (value, replacer, space) => {
const $ = replacer && typeof replacer === object ?
(k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0) :
(replacer || noop);
const known = new Map;
const input = [];
const output = [];
let i = +set(known, input, $.call({'': value}, '', value));
let firstRun = !i;
while (i < input.length) {
firstRun = true;
output[i] = $stringify(input[i++], replace, space);
}
// the two kinds of primitives
// 1. the real one
// 2. the wrapped one
function primitives(value) {
return value instanceof Primitive ? Primitive(value) : value;
return '[' + output.join(',') + ']';
function replace(key, value) {
if (firstRun) {
firstRun = !firstRun;
return value;
}
const 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;
}
};
exports.stringify = stringify;
function Primitives(key, value) {
return typeof value === primitive ? new Primitive(value) : value;
}
}(String, 'string'));
module.exports = Flatted;
const toJSON = any => $parse(stringify(any));
exports.toJSON = toJSON;
const fromJSON = any => parse($stringify(any));
exports.fromJSON = fromJSON;

3
node_modules/flatted/cjs/package.json generated vendored Normal file
View file

@ -0,0 +1,3 @@
{
"type": "commonjs"
}

2
node_modules/flatted/es.js generated vendored Normal file
View file

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

186
node_modules/flatted/esm/index.js generated vendored
View file

@ -1,116 +1,94 @@
var Flatted = (function (Primitive, primitive) {
/*! (c) 2020 Andrea Giammarchi */
/*!
* 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.
*/
const {parse: $parse, stringify: $stringify} = JSON;
const {keys} = Object;
var Flatted = {
const Primitive = String; // it could be Number
const primitive = 'string'; // it could be 'number'
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);
},
const ignore = {};
const object = 'object';
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);
const noop = (_, value) => value;
const primitives = value => (
value instanceof Primitive ? Primitive(value) : value
);
const Primitives = (_, value) => (
typeof value === primitive ? new Primitive(value) : value
);
const revive = (input, parsed, output, $) => {
const lazy = [];
for (let ke = keys(output), {length} = ke, y = 0; y < length; y++) {
const k = ke[y];
const value = output[k];
if (value instanceof Primitive) {
const tmp = input[value];
if (typeof tmp === object && !parsed.has(tmp)) {
parsed.add(tmp);
output[k] = ignore;
lazy.push({k, a: [input, parsed, tmp, $]});
}
return '[' + output.join(',') + ']';
else
output[k] = $.call(output, k, tmp);
}
};
return Flatted;
function noop(key, value) {
return value;
else if (output[k] !== ignore)
output[k] = $.call(output, k, 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
);
for (let {length} = lazy, i = 0; i < length; i++) {
const {k, a} = lazy[i];
output[k] = $.call(output, k, revive.apply(null, a));
}
return output;
};
function set(known, input, value) {
var index = Primitive(input.push(value) - 1);
known.set(value, index);
return index;
const set = (known, input, value) => {
const index = Primitive(input.push(value) - 1);
known.set(value, index);
return index;
};
export const parse = (text, reviver) => {
const input = $parse(text, Primitives).map(primitives);
const value = input[0];
const $ = reviver || noop;
const tmp = typeof value === object && value ?
revive(input, new Set, value, $) :
value;
return $.call({'': tmp}, '', tmp);
};
export const stringify = (value, replacer, space) => {
const $ = replacer && typeof replacer === object ?
(k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0) :
(replacer || noop);
const known = new Map;
const input = [];
const output = [];
let i = +set(known, input, $.call({'': value}, '', value));
let firstRun = !i;
while (i < input.length) {
firstRun = true;
output[i] = $stringify(input[i++], replace, space);
}
// the two kinds of primitives
// 1. the real one
// 2. the wrapped one
function primitives(value) {
return value instanceof Primitive ? Primitive(value) : value;
return '[' + output.join(',') + ']';
function replace(key, value) {
if (firstRun) {
firstRun = !firstRun;
return value;
}
const 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;
}
};
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;
export const toJSON = any => $parse(stringify(any));
export const fromJSON = any => parse($stringify(any));

BIN
node_modules/flatted/flatted.jpg generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

206
node_modules/flatted/index.js generated vendored
View file

@ -1,113 +1,127 @@
var Flatted = (function (Primitive, primitive) {
self.Flatted = (function (exports) {
'use strict';
/*!
* 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 = {
/*! (c) 2020 Andrea Giammarchi */
var $parse = JSON.parse,
$stringify = JSON.stringify;
var keys = Object.keys;
var Primitive = String; // it could be Number
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);
},
var primitive = 'string'; // it could be 'number'
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(',') + ']';
}
var ignore = {};
var object = 'object';
var noop = function noop(_, value) {
return value;
};
return Flatted;
var primitives = function primitives(value) {
return value instanceof Primitive ? Primitive(value) : value;
};
function noop(key, value) {
return value;
}
var Primitives = function Primitives(_, value) {
return typeof(value) === primitive ? new Primitive(value) : 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
);
}
var revive = function revive(input, parsed, output, $) {
var lazy = [];
function set(known, input, value) {
for (var ke = keys(output), length = ke.length, y = 0; y < length; y++) {
var k = ke[y];
var value = output[k];
if (value instanceof Primitive) {
var tmp = input[value];
if (typeof(tmp) === object && !parsed.has(tmp)) {
parsed.add(tmp);
output[k] = ignore;
lazy.push({
k: k,
a: [input, parsed, tmp, $]
});
} else output[k] = $.call(output, k, tmp);
} else if (output[k] !== ignore) output[k] = $.call(output, k, value);
}
for (var _length = lazy.length, i = 0; i < _length; i++) {
var _lazy$i = lazy[i],
_k = _lazy$i.k,
a = _lazy$i.a;
output[_k] = $.call(output, _k, revive.apply(null, a));
}
return output;
};
var set = 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
var parse = function parse(text, reviver) {
var input = $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);
};
var stringify = function stringify(value, replacer, space) {
var $ = replacer && typeof(replacer) === object ? function (k, v) {
return k === '' || -1 < replacer.indexOf(k) ? v : void 0;
} : replacer || noop;
var known = new Map();
var input = [];
var output = [];
var i = +set(known, input, $.call({
'': value
}, '', value));
var firstRun = !i;
function primitives(value) {
return value instanceof Primitive ? Primitive(value) : value;
}
while (i < input.length) {
firstRun = true;
output[i] = $stringify(input[i++], replace, space);
}
function Primitives(key, value) {
return typeof value === primitive ? new Primitive(value) : value;
}
return '[' + output.join(',') + ']';
}(String, 'string'));
function replace(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;
}
};
var toJSON = function toJSON(any) {
return $parse(stringify(any));
};
var fromJSON = function fromJSON(any) {
return parse($stringify(any));
};
exports.fromJSON = fromJSON;
exports.parse = parse;
exports.stringify = stringify;
exports.toJSON = toJSON;
return exports;
}({}));

4
node_modules/flatted/min.js generated vendored
View file

@ -1,2 +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");
self.Flatted=function(n){"use strict";
/*! (c) 2020 Andrea Giammarchi */var t=JSON.parse,r=JSON.stringify,e=Object.keys,u=String,a="string",f={},i="object",o=function(n,t){return t},c=function(n){return n instanceof u?u(n):n},l=function(n,t){return typeof t===a?new u(t):t},s=function n(t,r,a,o){for(var c=[],l=e(a),s=l.length,p=0;p<s;p++){var v=l[p],y=a[v];if(y instanceof u){var g=t[y];typeof g!==i||r.has(g)?a[v]=o.call(a,v,g):(r.add(g),a[v]=f,c.push({k:v,a:[t,r,g,o]}))}else a[v]!==f&&(a[v]=o.call(a,v,y))}for(var h=c.length,O=0;O<h;O++){var S=c[O],d=S.k,w=S.a;a[d]=o.call(a,d,n.apply(null,w))}return a},p=function(n,t,r){var e=u(t.push(r)-1);return n.set(r,e),e},v=function(n,r){var e=t(n,l).map(c),u=e[0],a=r||o,f=typeof u===i&&u?s(e,new Set,u,a):u;return a.call({"":f},"",f)},y=function(n,t,e){for(var u=t&&typeof t===i?function(n,r){return""===n||-1<t.indexOf(n)?r:void 0}:t||o,f=new Map,c=[],l=[],s=+p(f,c,u.call({"":n},"",n)),v=!s;s<c.length;)v=!0,l[s]=r(c[s++],y,e);return"["+l.join(",")+"]";function y(n,t){if(v)return v=!v,t;var r=u.call(this,n,t);switch(typeof r){case i:if(null===r)return r;case a:return f.get(r)||p(f,c,r)}return r}};return n.fromJSON=function(n){return v(r(n))},n.parse=v,n.stringify=y,n.toJSON=function(n){return t(y(n))},n}({});

42
node_modules/flatted/package.json generated vendored
View file

@ -1,20 +1,20 @@
{
"name": "flatted",
"version": "2.0.2",
"version": "3.2.1",
"description": "A super light and fast circular JSON parser.",
"unpkg": "min.js",
"main": "cjs/index.js",
"module": "esm/index.js",
"types": "types.d.ts",
"main": "./cjs/index.js",
"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",
"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",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"test": "nyc node test/index.js"
"build": "npm run cjs && npm run rollup:es && npm run rollup:babel && npm run min && npm run test && npm run size",
"cjs": "ascjs esm cjs",
"rollup:es": "rollup --config rollup/es.config.js && sed -i.bck 's/^var /self./' es.js && rm -rf es.js.bck",
"rollup:babel": "rollup --config rollup/babel.config.js && sed -i.bck 's/^var /self./' index.js && rm -rf index.js.bck && drop-babel-typeof index.js",
"min": "terser index.js -c -m -o 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; cat es.js | brotli | wc -c",
"coveralls": "c8 report --reporter=text-lcov | coveralls",
"test": "c8 node test/index.js",
"test:php": "php php/test.php"
},
"repository": {
"type": "git",
@ -34,11 +34,25 @@
},
"homepage": "https://github.com/WebReflection/flatted#readme",
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"ascjs": "^5.0.1",
"c8": "^7.7.3",
"circular-json": "^0.5.9",
"circular-json-es6": "^2.0.2",
"coveralls": "^3.0.11",
"coveralls": "^3.1.1",
"drop-babel-typeof": "^1.0.3",
"jsan": "^3.1.13",
"nyc": "^15.0.0",
"uglify-js": "^3.8.1"
"rollup": "^2.52.8",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^7.0.2",
"terser": "^5.7.1"
},
"module": "./esm/index.js",
"type": "module",
"exports": {
"import": "./esm/index.js",
"default": "./cjs/index.js"
}
}

156
node_modules/flatted/php/flatted.php generated vendored Normal file
View file

@ -0,0 +1,156 @@
<?php
/*!
* ISC License
*
* Copyright (c) 2018-2021, 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.
*/
class FlattedString {
public function __construct($value) {
$this->value = $value;
}
}
class Flatted {
// public utilities
public static function parse($json, $assoc = false, $depth = 512, $options = 0) {
$input = array_map(
'Flatted::asString',
array_map(
'Flatted::wrap',
json_decode($json, $assoc, $depth, $options)
)
);
$value = &$input[0];
$set = array();
$set[] = &$value;
if (is_array($value))
return Flatted::loop(false, array_keys($value), $input, $set, $value);
if (is_object($value))
return Flatted::loop(true, Flatted::keys($value), $input, $set, $value);
return $value;
}
public static function stringify($value, $options = 0, $depth = 512) {
$known = new stdClass;
$known->key = array();
$known->value = array();
$input = array();
$output = array();
$i = intval(Flatted::index($known, $input, $value));
while ($i < count($input)) {
$output[$i] = Flatted::transform($known, $input, $input[$i]);
$i++;
}
return json_encode($output, $options, $depth);
}
// private helpers
private static function asString($value) {
return $value instanceof FlattedString ? $value->value : $value;
}
private static function index(&$known, &$input, &$value) {
$input[] = &$value;
$index = strval(count($input) - 1);
$known->key[] = &$value;
$known->value[] = &$index;
return $index;
}
private static function keys(&$value) {
$obj = new ReflectionObject($value);
$props = $obj->getProperties();
$keys = array();
foreach ($props as $prop)
$keys[] = $prop->getName();
return $keys;
}
private static function loop($obj, $keys, &$input, &$set, &$output) {
foreach ($keys as $key) {
$value = $obj ? $output->$key : $output[$key];
if ($value instanceof FlattedString)
Flatted::ref($obj, $key, $input[$value->value], $input, $set, $output);
}
return $output;
}
private static function relate(&$known, &$input, &$value) {
if (is_string($value) || is_array($value) || is_object($value)) {
$key = array_search($value, $known->key, true);
if ($key !== false)
return $known->value[$key];
return Flatted::index($known, $input, $value);
}
return $value;
}
private static function ref($obj, &$key, &$value, &$input, &$set, &$output) {
if (is_array($value) && !in_array($value, $set, true)) {
$set[] = $value;
$value = Flatted::loop(false, array_keys($value), $input, $set, $value);
}
elseif (is_object($value) && !in_array($value, $set, true)) {
$set[] = $value;
$value = Flatted::loop(true, Flatted::keys($value), $input, $set, $value);
}
if ($obj) {
$output->$key = &$value;
}
else {
$output[$key] = &$value;
}
}
private static function transform(&$known, &$input, &$value) {
if (is_array($value)) {
return array_map(
function ($value) use(&$known, &$input) {
return Flatted::relate($known, $input, $value);
},
$value
);
}
if (is_object($value)) {
$object = new stdClass;
$keys = Flatted::keys($value);
foreach ($keys as $key)
$object->$key = Flatted::relate($known, $input, $value->$key);
return $object;
}
return $value;
}
private static function wrap($value) {
if (is_string($value)) {
return new FlattedString($value);
}
if (is_array($value)) {
return array_map('Flatted::wrap', $value);
}
if (is_object($value)) {
$keys = Flatted::keys($value);
foreach ($keys as $key) {
$value->$key = self::wrap($value->$key);
}
return $value;
}
return $value;
}
}
?>

41
node_modules/flatted/types.d.ts generated vendored
View file

@ -1,19 +1,52 @@
interface Flatted {
/**
* Converts a JavaScript Object Notation (using Flatted encoding) string into an object.
* @param text A valid Flatted string.
* @param reviver A function that transforms the results. This function is called for each member of the object.
* If a member contains nested objects, the nested objects are transformed before the parent object is.
*/
parse(
text: string,
reviver?: (this: any, key: string, value: any) => any
): any;
/**
* Converts a JavaScript value to a JavaScript Object Notation (using Flatted encoding) string.
* @param value A JavaScript value, usually an object or array, to be converted.
* @param replacer A function that transforms the results.
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
*/
stringify(
value: any,
replacer?: (this: any, key: string, value: any) => any,
space?: string | number
): string;
/**
* Converts a JavaScript value to a JavaScript Object Notation (using Flatted encoding) string.
* @param value A JavaScript value, usually an object or array, to be converted.
* @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified.
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
*/
stringify(
value: any,
replacer?: (number | string)[] | null,
space?: string | number
): string;
}
/**
* Fast and minimal circular JSON parser.
* logic example
```js
var a = [{one: 1}, {two: '2'}];
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;
declare const Flatted: Flatted;
export = Flatted;