tools: update ESLint to 8.3.0

PR-URL: https://github.com/nodejs/node/pull/40917
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
Luigi Pinca authored and GitHub committed 2021-11-22 12:38:27 +00:00
1 parent 8ee4e672ec
commit 7ad052d2bd
56 files changed
+1700 -1287

No files matched your search

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+23 -3
View File
@@ -4,6 +4,26 @@ var path = require('path');
var fs = require('fs');
var acorn = require('./acorn.js');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var acorn__namespace = /*#__PURE__*/_interopNamespace(acorn);
var inputFilePaths = [], forceFileName = false, fileMode = false, silent = false, compact = false, tokenize = false;
var options = {};
@@ -44,14 +64,14 @@ function run(codeList) {
codeList.forEach(function (code, idx) {
fileIdx = idx;
if (!tokenize) {
result = acorn.parse(code, options);
result = acorn__namespace.parse(code, options);
options.program = result;
} else {
var tokenizer = acorn.tokenizer(code, options), token;
var tokenizer = acorn__namespace.tokenizer(code, options), token;
do {
token = tokenizer.getToken();
result.push(token);
} while (token.type !== acorn.tokTypes.eof)
} while (token.type !== acorn__namespace.tokTypes.eof)
}
});
} catch (e) {
+1 -1
View File
@@ -16,7 +16,7 @@
],
"./package.json": "./package.json"
},
"version": "8.5.0",
"version": "8.6.0",
"engines": {"node": ">=0.4.0"},
"maintainers": [
{
+43 -18
View File
@@ -366,7 +366,7 @@ class ParameterDefinition extends Definition {
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
const { Syntax: Syntax$2 } = estraverse__default['default'];
const { Syntax: Syntax$2 } = estraverse__default["default"];
/**
* Test if scope is struct
@@ -491,7 +491,8 @@ class Scope {
constructor(scopeManager, type, upperScope, block, isMethodDefinition) {
/**
* One of 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'.
* One of "global", "module", "function", "function-expression-name", "block", "switch", "catch", "with", "for",
* "class", "class-field-initializer", "class-static-block".
* @member {string} Scope#type
*/
this.type = type;
@@ -559,7 +560,13 @@ class Scope {
* @member {Scope} Scope#variableScope
*/
this.variableScope =
(this.type === "global" || this.type === "function" || this.type === "module" || this.type === "class-field-initializer") ? this : upperScope.variableScope;
this.type === "global" ||
this.type === "module" ||
this.type === "function" ||
this.type === "class-field-initializer" ||
this.type === "class-static-block"
? this
: upperScope.variableScope;
/**
* Whether this scope is created by a FunctionExpression.
@@ -803,8 +810,8 @@ class Scope {
resolve(ident) {
let ref, i, iz;
assert__default['default'](this.__isClosed(), "Scope should be closed.");
assert__default['default'](ident.type === Syntax$2.Identifier, "Target should be identifier.");
assert__default["default"](this.__isClosed(), "Scope should be closed.");
assert__default["default"](ident.type === Syntax$2.Identifier, "Target should be identifier.");
for (i = 0, iz = this.references.length; i < iz; ++i) {
ref = this.references[i];
if (ref.identifier === ident) {
@@ -1008,7 +1015,7 @@ class FunctionScope extends Scope {
const variable = this.set.get("arguments");
assert__default['default'](variable, "Always have arguments variable.");
assert__default["default"](variable, "Always have arguments variable.");
return variable.tainted || variable.references.length !== 0;
}
@@ -1072,6 +1079,12 @@ class ClassFieldInitializerScope extends Scope {
}
}
class ClassStaticBlockScope extends Scope {
constructor(scopeManager, upperScope, block) {
super(scopeManager, "class-static-block", upperScope, block, true);
}
}
/* vim: set sw=4 ts=4 et tw=80 : */
/*
@@ -1124,7 +1137,7 @@ class ScopeManager {
}
__isNodejsScope() {
return this.__options.nodejsScope;
return this.__options.nodejsScope || this.__options.sourceType === "commonjs";
}
isModule() {
@@ -1248,7 +1261,7 @@ class ScopeManager {
__nestScope(scope) {
if (scope instanceof GlobalScope) {
assert__default['default'](this.__currentScope === null);
assert__default["default"](this.__currentScope === null);
this.globalScope = scope;
}
this.__currentScope = scope;
@@ -1287,6 +1300,10 @@ class ScopeManager {
return this.__nestScope(new ClassFieldInitializerScope(this, this.__currentScope, node));
}
__nestClassStaticBlockScope(node) {
return this.__nestScope(new ClassStaticBlockScope(this, this.__currentScope, node));
}
__nestSwitchScope(node) {
return this.__nestScope(new SwitchScope(this, this.__currentScope, node));
}
@@ -1330,7 +1347,7 @@ class ScopeManager {
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
const { Syntax: Syntax$1 } = estraverse__default['default'];
const { Syntax: Syntax$1 } = estraverse__default["default"];
/**
* Get last array element
@@ -1341,7 +1358,7 @@ function getLast(xs) {
return xs[xs.length - 1] || null;
}
class PatternVisitor extends esrecurse__default['default'].Visitor {
class PatternVisitor extends esrecurse__default["default"].Visitor {
static isPattern(node) {
const nodeType = node.type;
@@ -1477,7 +1494,7 @@ class PatternVisitor extends esrecurse__default['default'].Visitor {
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
const { Syntax } = estraverse__default['default'];
const { Syntax } = estraverse__default["default"];
/**
* Traverse identifier in pattern
@@ -1506,7 +1523,7 @@ function traverseIdentifierInPattern(options, rootPattern, referencer, callback)
// FIXME: Now, we don't create module environment, because the context is
// implementation dependent.
class Importer extends esrecurse__default['default'].Visitor {
class Importer extends esrecurse__default["default"].Visitor {
constructor(declaration, referencer) {
super(null, referencer.options);
this.declaration = declaration;
@@ -1553,7 +1570,7 @@ class Importer extends esrecurse__default['default'].Visitor {
}
// Referencing variables and creating bindings.
class Referencer extends esrecurse__default['default'].Visitor {
class Referencer extends esrecurse__default["default"].Visitor {
constructor(options, scopeManager) {
super(null, options);
this.options = options;
@@ -1914,6 +1931,14 @@ class Referencer extends esrecurse__default['default'].Visitor {
}
}
StaticBlock(node) {
this.scopeManager.__nestClassStaticBlockScope(node);
this.visitChildren(node);
this.close(node);
}
MethodDefinition(node) {
this.visitProperty(node);
}
@@ -2035,7 +2060,7 @@ class Referencer extends esrecurse__default['default'].Visitor {
}
ImportDeclaration(node) {
assert__default['default'](this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context.");
assert__default["default"](this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context.");
const importer = new Importer(node, this);
@@ -2087,7 +2112,7 @@ class Referencer extends esrecurse__default['default'].Visitor {
/* vim: set sw=4 ts=4 et tw=80 : */
const version = "6.0.0";
const version = "7.1.0";
/*
Copyright (C) 2012-2014 Yusuke Suzuki <utatane.tea@gmail.com>
@@ -2125,7 +2150,7 @@ function defaultOptions() {
directive: false,
nodejsScope: false,
impliedStrict: false,
sourceType: "script", // one of ['script', 'module']
sourceType: "script", // one of ['script', 'module', 'commonjs']
ecmaVersion: 5,
childVisitorKeys: null,
fallback: "iteration"
@@ -2181,7 +2206,7 @@ function updateDeeply(target, override) {
* a function scope immediately following the global scope.
* @param {boolean} [providedOptions.impliedStrict=false] implied strict mode
* (if ecmaVersion >= 5).
* @param {string} [providedOptions.sourceType='script'] the source type of the script. one of 'script' and 'module'
* @param {string} [providedOptions.sourceType='script'] the source type of the script. one of 'script', 'module', and 'commonjs'
* @param {number} [providedOptions.ecmaVersion=5] which ECMAScript version is considered
* @param {Object} [providedOptions.childVisitorKeys=null] Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option.
* @param {string} [providedOptions.fallback='iteration'] A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option.
@@ -2194,7 +2219,7 @@ function analyze(tree, providedOptions) {
referencer.visit(tree);
assert__default['default'](scopeManager.__currentScope === null, "currentScope should be null.");
assert__default["default"](scopeManager.__currentScope === null, "currentScope should be null.");
return scopeManager;
}
+2 -2
View File
@@ -66,7 +66,7 @@ function defaultOptions() {
directive: false,
nodejsScope: false,
impliedStrict: false,
sourceType: "script", // one of ['script', 'module']
sourceType: "script", // one of ['script', 'module', 'commonjs']
ecmaVersion: 5,
childVisitorKeys: null,
fallback: "iteration"
@@ -122,7 +122,7 @@ function updateDeeply(target, override) {
* a function scope immediately following the global scope.
* @param {boolean} [providedOptions.impliedStrict=false] implied strict mode
* (if ecmaVersion >= 5).
* @param {string} [providedOptions.sourceType='script'] the source type of the script. one of 'script' and 'module'
* @param {string} [providedOptions.sourceType='script'] the source type of the script. one of 'script', 'module', and 'commonjs'
* @param {number} [providedOptions.ecmaVersion=5] which ECMAScript version is considered
* @param {Object} [providedOptions.childVisitorKeys=null] Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option.
* @param {string} [providedOptions.fallback='iteration'] A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option.
@@ -470,6 +470,14 @@ class Referencer extends esrecurse.Visitor {
}
}
StaticBlock(node) {
this.scopeManager.__nestClassStaticBlockScope(node);
this.visitChildren(node);
this.close(node);
}
MethodDefinition(node) {
this.visitProperty(node);
}
+6 -1
View File
@@ -28,6 +28,7 @@ import {
BlockScope,
CatchScope,
ClassFieldInitializerScope,
ClassStaticBlockScope,
ClassScope,
ForScope,
FunctionExpressionNameScope,
@@ -65,7 +66,7 @@ class ScopeManager {
}
__isNodejsScope() {
return this.__options.nodejsScope;
return this.__options.nodejsScope || this.__options.sourceType === "commonjs";
}
isModule() {
@@ -228,6 +229,10 @@ class ScopeManager {
return this.__nestScope(new ClassFieldInitializerScope(this, this.__currentScope, node));
}
__nestClassStaticBlockScope(node) {
return this.__nestScope(new ClassStaticBlockScope(this, this.__currentScope, node));
}
__nestSwitchScope(node) {
return this.__nestScope(new SwitchScope(this, this.__currentScope, node));
}
+17 -3
View File
@@ -157,7 +157,8 @@ class Scope {
constructor(scopeManager, type, upperScope, block, isMethodDefinition) {
/**
* One of 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'.
* One of "global", "module", "function", "function-expression-name", "block", "switch", "catch", "with", "for",
* "class", "class-field-initializer", "class-static-block".
* @member {string} Scope#type
*/
this.type = type;
@@ -225,7 +226,13 @@ class Scope {
* @member {Scope} Scope#variableScope
*/
this.variableScope =
(this.type === "global" || this.type === "function" || this.type === "module" || this.type === "class-field-initializer") ? this : upperScope.variableScope;
this.type === "global" ||
this.type === "module" ||
this.type === "function" ||
this.type === "class-field-initializer" ||
this.type === "class-static-block"
? this
: upperScope.variableScope;
/**
* Whether this scope is created by a FunctionExpression.
@@ -738,6 +745,12 @@ class ClassFieldInitializerScope extends Scope {
}
}
class ClassStaticBlockScope extends Scope {
constructor(scopeManager, upperScope, block) {
super(scopeManager, "class-static-block", upperScope, block, true);
}
}
export {
Scope,
GlobalScope,
@@ -750,7 +763,8 @@ export {
FunctionScope,
ForScope,
ClassScope,
ClassFieldInitializerScope
ClassFieldInitializerScope,
ClassStaticBlockScope
};
/* vim: set sw=4 ts=4 et tw=80 : */
+1 -1
View File
@@ -1,3 +1,3 @@
const version = "6.0.0";
const version = "7.1.0";
export default version;
+4 -4
View File
@@ -11,7 +11,7 @@
},
"./package.json": "./package.json"
},
"version": "6.0.0",
"version": "7.1.0",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
@@ -50,9 +50,9 @@
"eslint-config-eslint": "^7.0.0",
"eslint-plugin-jsdoc": "^35.4.1",
"eslint-plugin-node": "^11.1.0",
"eslint-release": "^3.1.2",
"eslint-visitor-keys": "^3.0.0",
"espree": "^8.0.0",
"eslint-release": "^3.2.0",
"eslint-visitor-keys": "^3.1.0",
"espree": "^9.0.0",
"mocha": "^9.0.1",
"npm-license": "^0.3.3",
"rollup": "^2.52.7",
+3 -2
View File
@@ -17,7 +17,8 @@ $ npm install eslint-visitor-keys
### Requirements
- [Node.js] 10.0.0 or later.
- [Node.js] `^12.22.0`, `^14.17.0`, or `>=16.0.0`
## 📖 Usage
@@ -102,5 +103,5 @@ Welcome. See [ESLint contribution guidelines](https://eslint.org/docs/developer-
[npm]: https://www.npmjs.com/
[Node.js]: https://nodejs.org/en/
[Node.js]: https://nodejs.org/
[ESTree]: https://github.com/estree/estree
@@ -239,6 +239,9 @@ const KEYS = {
SpreadElement: [
"argument"
],
StaticBlock: [
"body"
],
Super: [],
SwitchStatement: [
"discriminant",
@@ -235,6 +235,9 @@ const KEYS = {
SpreadElement: [
"argument"
],
StaticBlock: [
"body"
],
Super: [],
SwitchStatement: [
"discriminant",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "eslint-visitor-keys",
"version": "3.0.0",
"version": "3.1.0",
"description": "Constants and utilities about visitor keys to traverse AST.",
"type": "module",
"main": "dist/eslint-visitor-keys.cjs",
@@ -27,7 +27,7 @@
"eslint-config-eslint": "^7.0.0",
"eslint-plugin-jsdoc": "^35.4.0",
"eslint-plugin-node": "^11.1.0",
"eslint-release": "^3.1.2",
"eslint-release": "^3.2.0",
"mocha": "^9.0.1",
"opener": "^1.5.2",
"rollup": "^2.52.1"
+3 -2
View File
@@ -145,7 +145,7 @@ const options = {
// You can also set "latest" to use the most recently supported version.
ecmaVersion: 5,
// specify which type of script you're parsing ("script" or "module")
// specify which type of script you're parsing ("script", "module", or "commonjs")
sourceType: "script",
// specify additional language features
@@ -154,7 +154,7 @@ const options = {
// enable JSX parsing
jsx: false,
// enable return in global scope
// enable return in global scope (set to true automatically when sourceType is "commonjs")
globalReturn: false,
// enable implied strict mode (if ecmaVersion >= 5)
@@ -238,6 +238,7 @@ Because ECMAScript 2022 is still under development, we are implementing features
* [Class static fields, static private methods and accessors](https://github.com/tc39/proposal-static-class-features)
* [RegExp match indices](https://github.com/tc39/proposal-regexp-match-indices)
* [Top-level await](https://github.com/tc39/proposal-top-level-await)
* [Class static initialization blocks](https://github.com/tc39/proposal-class-static-block)
See [finished-proposals.md](https://github.com/tc39/proposals/blob/master/finished-proposals.md) to know what features are finalized.
+25 -10
View File
@@ -17,14 +17,12 @@ function _interopNamespace(e) {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () {
return e[k];
}
get: function () { return e[k]; }
});
}
});
}
n['default'] = e;
n["default"] = e;
return Object.freeze(n);
}
@@ -462,6 +460,11 @@ function normalizeSourceType(sourceType = "script") {
if (sourceType === "script" || sourceType === "module") {
return sourceType;
}
if (sourceType === "commonjs") {
return "script";
}
throw new Error("Invalid sourceType.");
}
@@ -477,16 +480,21 @@ function normalizeOptions(options) {
const ranges = options.range === true;
const locations = options.loc === true;
const allowReserved = ecmaVersion === 3 ? "never" : false;
const ecmaFeatures = options.ecmaFeatures || {};
const allowReturnOutsideFunction = options.sourceType === "commonjs" ||
Boolean(ecmaFeatures.globalReturn);
if (sourceType === "module" && ecmaVersion < 6) {
throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.");
}
return Object.assign({}, options, {
ecmaVersion,
sourceType,
ranges,
locations,
allowReserved
allowReserved,
allowReturnOutsideFunction
});
}
@@ -546,6 +554,8 @@ var espree = () => Parser => {
code = String(code);
}
// save original source type in case of commonjs
const originalSourceType = opts.sourceType;
const options = normalizeOptions(opts);
const ecmaFeatures = options.ecmaFeatures || {};
const tokenTranslator =
@@ -564,7 +574,7 @@ var espree = () => Parser => {
allowReserved: options.allowReserved,
// Truthy value is true for backward compatibility.
allowReturnOutsideFunction: Boolean(ecmaFeatures.globalReturn),
allowReturnOutsideFunction: options.allowReturnOutsideFunction,
// Collect tokens
onToken: token => {
@@ -588,8 +598,13 @@ var espree = () => Parser => {
}
}, code);
// Initialize internal state.
/*
* Data that is unique to Espree and is not represented internally in
* Acorn. We put all of this data into a symbol property as a way to
* avoid potential naming conflicts with future versions of Acorn.
*/
this[STATE] = {
originalSourceType: originalSourceType || options.sourceType,
tokens: tokenTranslator ? [] : null,
comments: options.comment === true ? [] : null,
impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5,
@@ -634,7 +649,7 @@ var espree = () => Parser => {
const extra = this[STATE];
const program = super.parse();
program.sourceType = this.options.sourceType;
program.sourceType = extra.originalSourceType;
if (extra.comments) {
program.comments = extra.comments;
@@ -810,7 +825,7 @@ var espree = () => Parser => {
};
};
const version$1 = "9.0.0";
const version$1 = "9.1.0";
/**
* @fileoverview Main Espree file that converts Acorn into Esprima output.
@@ -884,7 +899,7 @@ const parsers = {
get jsx() {
if (this._jsx === null) {
this._jsx = acorn__namespace.Parser.extend(jsx__default['default'](), espree());
this._jsx = acorn__namespace.Parser.extend(jsx__default["default"](), espree());
}
return this._jsx;
},
+10 -3
View File
@@ -56,6 +56,8 @@ export default () => Parser => {
code = String(code);
}
// save original source type in case of commonjs
const originalSourceType = opts.sourceType;
const options = normalizeOptions(opts);
const ecmaFeatures = options.ecmaFeatures || {};
const tokenTranslator =
@@ -74,7 +76,7 @@ export default () => Parser => {
allowReserved: options.allowReserved,
// Truthy value is true for backward compatibility.
allowReturnOutsideFunction: Boolean(ecmaFeatures.globalReturn),
allowReturnOutsideFunction: options.allowReturnOutsideFunction,
// Collect tokens
onToken: token => {
@@ -98,8 +100,13 @@ export default () => Parser => {
}
}, code);
// Initialize internal state.
/*
* Data that is unique to Espree and is not represented internally in
* Acorn. We put all of this data into a symbol property as a way to
* avoid potential naming conflicts with future versions of Acorn.
*/
this[STATE] = {
originalSourceType: originalSourceType || options.sourceType,
tokens: tokenTranslator ? [] : null,
comments: options.comment === true ? [] : null,
impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5,
@@ -144,7 +151,7 @@ export default () => Parser => {
const extra = this[STATE];
const program = super.parse();
program.sourceType = this.options.sourceType;
program.sourceType = extra.originalSourceType;
if (extra.comments) {
program.comments = extra.comments;
+11 -1
View File
@@ -73,6 +73,11 @@ function normalizeSourceType(sourceType = "script") {
if (sourceType === "script" || sourceType === "module") {
return sourceType;
}
if (sourceType === "commonjs") {
return "script";
}
throw new Error("Invalid sourceType.");
}
@@ -88,15 +93,20 @@ export function normalizeOptions(options) {
const ranges = options.range === true;
const locations = options.loc === true;
const allowReserved = ecmaVersion === 3 ? "never" : false;
const ecmaFeatures = options.ecmaFeatures || {};
const allowReturnOutsideFunction = options.sourceType === "commonjs" ||
Boolean(ecmaFeatures.globalReturn);
if (sourceType === "module" && ecmaVersion < 6) {
throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.");
}
return Object.assign({}, options, {
ecmaVersion,
sourceType,
ranges,
locations,
allowReserved
allowReserved,
allowReturnOutsideFunction
});
}
+1 -1
View File
@@ -1,3 +1,3 @@
const version = "9.0.0";
const version = "9.1.0";
export default version;
+4 -4
View File
@@ -16,7 +16,7 @@
],
"./package.json": "./package.json"
},
"version": "9.0.0",
"version": "9.1.0",
"files": [
"lib",
"dist/espree.cjs",
@@ -31,9 +31,9 @@
},
"license": "BSD-2-Clause",
"dependencies": {
"acorn": "^8.5.0",
"acorn": "^8.6.0",
"acorn-jsx": "^5.3.1",
"eslint-visitor-keys": "^3.0.0"
"eslint-visitor-keys": "^3.1.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^17.1.0",
@@ -44,7 +44,7 @@
"eslint-config-eslint": "^7.0.0",
"eslint-plugin-jsdoc": "^32.2.0",
"eslint-plugin-node": "^11.1.0",
"eslint-release": "^3.1.2",
"eslint-release": "^3.2.0",
"esprima": "latest",
"esprima-fb": "^8001.2001.0-dev-harmony-fb",
"json-diff": "^0.5.4",
+12
View File
@@ -6,6 +6,18 @@
<sup>**Social Media Photo by [Matt Seymour](https://unsplash.com/@mattseymour) on [Unsplash](https://unsplash.com/)**</sup>
## Announcement 📣
There is a standard approach to recursion and more data-types than what JSON allow, and it's part of this [Structured Clone Module](https://github.com/ungap/structured-clone/#readme).
Beside acting as a polyfill, its `@ungap/structured-clone/json` export provides both `stringify` and `parse`, and it's been tested for being faster than *flatted*, but its produced output is also smaller than *flatted*.
The *@ungap/structured-clone* module is, in short, a drop in replacement for *flatted*, but it's not compatible with *flatted* specialized syntax.
However, if recursion, as well as more data-types, are what you are after, or interesting for your projects, consider switching to this new module whenever you can 👍
- - -
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)**.
+1 -1
View File
@@ -124,4 +124,4 @@ self.Flatted = (function (exports) {
return exports;
}({}));
})({});
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "flatted",
"version": "3.2.2",
"version": "3.2.4",
"description": "A super light and fast circular JSON parser.",
"unpkg": "min.js",
"types": "types.d.ts",
@@ -12,9 +12,9 @@
"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"
"test:php": "php php/test.php",
"coverage": "mkdir -p ./coverage; c8 report --reporter=text-lcov > ./coverage/lcov.info"
},
"repository": {
"type": "git",
@@ -34,20 +34,20 @@
},
"homepage": "https://github.com/WebReflection/flatted#readme",
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.0",
"@ungap/structured-clone": "^0.3.4",
"ascjs": "^5.0.1",
"c8": "^7.7.3",
"c8": "^7.10.0",
"circular-json": "^0.5.9",
"circular-json-es6": "^2.0.2",
"coveralls": "^3.1.1",
"drop-babel-typeof": "^1.0.3",
"jsan": "^3.1.13",
"rollup": "^2.52.8",
"rollup": "^2.59.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^7.0.2",
"terser": "^5.7.1"
"terser": "^5.9.0"
},
"module": "./esm/index.js",
"type": "module",