update
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,152 @@
|
||||
/**
|
||||
* @license React
|
||||
* react-dom.react-server.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
var React = require("react");
|
||||
function noop() {}
|
||||
var Internals = {
|
||||
d: {
|
||||
f: noop,
|
||||
r: function () {
|
||||
throw Error(
|
||||
"Invalid form element. requestFormReset must be passed a form that was rendered by React."
|
||||
);
|
||||
},
|
||||
D: noop,
|
||||
C: noop,
|
||||
L: noop,
|
||||
m: noop,
|
||||
X: noop,
|
||||
S: noop,
|
||||
M: noop
|
||||
},
|
||||
p: 0,
|
||||
findDOMNode: null
|
||||
};
|
||||
if (!React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE)
|
||||
throw Error(
|
||||
'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
|
||||
);
|
||||
function getCrossOriginStringAs(as, input) {
|
||||
if ("font" === as) return "";
|
||||
if ("string" === typeof input)
|
||||
return "use-credentials" === input ? input : "";
|
||||
}
|
||||
exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
|
||||
Internals;
|
||||
exports.preconnect = function (href, options) {
|
||||
"string" === typeof href &&
|
||||
(options
|
||||
? ((options = options.crossOrigin),
|
||||
(options =
|
||||
"string" === typeof options
|
||||
? "use-credentials" === options
|
||||
? options
|
||||
: ""
|
||||
: void 0))
|
||||
: (options = null),
|
||||
Internals.d.C(href, options));
|
||||
};
|
||||
exports.prefetchDNS = function (href) {
|
||||
"string" === typeof href && Internals.d.D(href);
|
||||
};
|
||||
exports.preinit = function (href, options) {
|
||||
if ("string" === typeof href && options && "string" === typeof options.as) {
|
||||
var as = options.as,
|
||||
crossOrigin = getCrossOriginStringAs(as, options.crossOrigin),
|
||||
integrity =
|
||||
"string" === typeof options.integrity ? options.integrity : void 0,
|
||||
fetchPriority =
|
||||
"string" === typeof options.fetchPriority
|
||||
? options.fetchPriority
|
||||
: void 0;
|
||||
"style" === as
|
||||
? Internals.d.S(
|
||||
href,
|
||||
"string" === typeof options.precedence ? options.precedence : void 0,
|
||||
{
|
||||
crossOrigin: crossOrigin,
|
||||
integrity: integrity,
|
||||
fetchPriority: fetchPriority
|
||||
}
|
||||
)
|
||||
: "script" === as &&
|
||||
Internals.d.X(href, {
|
||||
crossOrigin: crossOrigin,
|
||||
integrity: integrity,
|
||||
fetchPriority: fetchPriority,
|
||||
nonce: "string" === typeof options.nonce ? options.nonce : void 0
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.preinitModule = function (href, options) {
|
||||
if ("string" === typeof href)
|
||||
if ("object" === typeof options && null !== options) {
|
||||
if (null == options.as || "script" === options.as) {
|
||||
var crossOrigin = getCrossOriginStringAs(
|
||||
options.as,
|
||||
options.crossOrigin
|
||||
);
|
||||
Internals.d.M(href, {
|
||||
crossOrigin: crossOrigin,
|
||||
integrity:
|
||||
"string" === typeof options.integrity ? options.integrity : void 0,
|
||||
nonce: "string" === typeof options.nonce ? options.nonce : void 0
|
||||
});
|
||||
}
|
||||
} else null == options && Internals.d.M(href);
|
||||
};
|
||||
exports.preload = function (href, options) {
|
||||
if (
|
||||
"string" === typeof href &&
|
||||
"object" === typeof options &&
|
||||
null !== options &&
|
||||
"string" === typeof options.as
|
||||
) {
|
||||
var as = options.as,
|
||||
crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
|
||||
Internals.d.L(href, as, {
|
||||
crossOrigin: crossOrigin,
|
||||
integrity:
|
||||
"string" === typeof options.integrity ? options.integrity : void 0,
|
||||
nonce: "string" === typeof options.nonce ? options.nonce : void 0,
|
||||
type: "string" === typeof options.type ? options.type : void 0,
|
||||
fetchPriority:
|
||||
"string" === typeof options.fetchPriority
|
||||
? options.fetchPriority
|
||||
: void 0,
|
||||
referrerPolicy:
|
||||
"string" === typeof options.referrerPolicy
|
||||
? options.referrerPolicy
|
||||
: void 0,
|
||||
imageSrcSet:
|
||||
"string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
|
||||
imageSizes:
|
||||
"string" === typeof options.imageSizes ? options.imageSizes : void 0,
|
||||
media: "string" === typeof options.media ? options.media : void 0
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.preloadModule = function (href, options) {
|
||||
if ("string" === typeof href)
|
||||
if (options) {
|
||||
var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
|
||||
Internals.d.m(href, {
|
||||
as:
|
||||
"string" === typeof options.as && "script" !== options.as
|
||||
? options.as
|
||||
: void 0,
|
||||
crossOrigin: crossOrigin,
|
||||
integrity:
|
||||
"string" === typeof options.integrity ? options.integrity : void 0
|
||||
});
|
||||
} else Internals.d.m(href);
|
||||
};
|
||||
exports.version = "19.1.0";
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @fileoverview Rule to flag comparisons to null without a type-checking
|
||||
* operator.
|
||||
* @author Ian Christian Myers
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Disallow `null` comparisons without type-checking operators",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/no-eq-null",
|
||||
},
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
unexpected: "Use '===' to compare with null.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
BinaryExpression(node) {
|
||||
const badOperator =
|
||||
node.operator === "==" || node.operator === "!=";
|
||||
|
||||
if (
|
||||
(node.right.type === "Literal" &&
|
||||
node.right.raw === "null" &&
|
||||
badOperator) ||
|
||||
(node.left.type === "Literal" &&
|
||||
node.left.raw === "null" &&
|
||||
badOperator)
|
||||
) {
|
||||
context.report({ node, messageId: "unexpected" });
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,92 @@
|
||||
// Generated by LiveScript 1.6.0
|
||||
var split, join, lines, unlines, words, unwords, chars, unchars, reverse, repeat, capitalize, camelize, dasherize;
|
||||
split = curry$(function(sep, str){
|
||||
return str.split(sep);
|
||||
});
|
||||
join = curry$(function(sep, xs){
|
||||
return xs.join(sep);
|
||||
});
|
||||
lines = function(str){
|
||||
if (!str.length) {
|
||||
return [];
|
||||
}
|
||||
return str.split('\n');
|
||||
};
|
||||
unlines = function(it){
|
||||
return it.join('\n');
|
||||
};
|
||||
words = function(str){
|
||||
if (!str.length) {
|
||||
return [];
|
||||
}
|
||||
return str.split(/[ ]+/);
|
||||
};
|
||||
unwords = function(it){
|
||||
return it.join(' ');
|
||||
};
|
||||
chars = function(it){
|
||||
return it.split('');
|
||||
};
|
||||
unchars = function(it){
|
||||
return it.join('');
|
||||
};
|
||||
reverse = function(str){
|
||||
return str.split('').reverse().join('');
|
||||
};
|
||||
repeat = curry$(function(n, str){
|
||||
var result, i$;
|
||||
result = '';
|
||||
for (i$ = 0; i$ < n; ++i$) {
|
||||
result += str;
|
||||
}
|
||||
return result;
|
||||
});
|
||||
capitalize = function(str){
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
};
|
||||
camelize = function(it){
|
||||
return it.replace(/[-_]+(.)?/g, function(arg$, c){
|
||||
return (c != null ? c : '').toUpperCase();
|
||||
});
|
||||
};
|
||||
dasherize = function(str){
|
||||
return str.replace(/([^-A-Z])([A-Z]+)/g, function(arg$, lower, upper){
|
||||
return lower + "-" + (upper.length > 1
|
||||
? upper
|
||||
: upper.toLowerCase());
|
||||
}).replace(/^([A-Z]+)/, function(arg$, upper){
|
||||
if (upper.length > 1) {
|
||||
return upper + "-";
|
||||
} else {
|
||||
return upper.toLowerCase();
|
||||
}
|
||||
});
|
||||
};
|
||||
module.exports = {
|
||||
split: split,
|
||||
join: join,
|
||||
lines: lines,
|
||||
unlines: unlines,
|
||||
words: words,
|
||||
unwords: unwords,
|
||||
chars: chars,
|
||||
unchars: unchars,
|
||||
reverse: reverse,
|
||||
repeat: repeat,
|
||||
capitalize: capitalize,
|
||||
camelize: camelize,
|
||||
dasherize: dasherize
|
||||
};
|
||||
function curry$(f, bound){
|
||||
var context,
|
||||
_curry = function(args) {
|
||||
return f.length > 1 ? function(){
|
||||
var params = args ? args.concat() : [];
|
||||
context = bound ? context || this : this;
|
||||
return params.push.apply(params, arguments) <
|
||||
f.length && arguments.length ?
|
||||
_curry.call(context, params) : f.apply(context, params);
|
||||
} : f;
|
||||
};
|
||||
return _curry();
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* A class that manages a queue of retry jobs.
|
||||
*/
|
||||
export class Retrier {
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {Function} check The function to call.
|
||||
* @param {object} [options] The options for the instance.
|
||||
* @param {number} [options.timeout] The timeout for the queue.
|
||||
* @param {number} [options.maxDelay] The maximum delay for the queue.
|
||||
*/
|
||||
constructor(check: Function, { timeout, maxDelay }?: {
|
||||
timeout?: number | undefined;
|
||||
maxDelay?: number | undefined;
|
||||
} | undefined);
|
||||
/**
|
||||
* Adds a new retry job to the queue.
|
||||
* @param {Function} fn The function to call.
|
||||
* @param {object} [options] The options for the job.
|
||||
* @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation.
|
||||
* @returns {Promise<any>} A promise that resolves when the queue is
|
||||
* processed.
|
||||
*/
|
||||
retry(fn: Function, { signal }?: {
|
||||
signal?: AbortSignal | undefined;
|
||||
} | undefined): Promise<any>;
|
||||
#private;
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
# gensync
|
||||
|
||||
This module allows for developers to write common code that can share
|
||||
implementation details, hiding whether an underlying request happens
|
||||
synchronously or asynchronously. This is in contrast with many current Node
|
||||
APIs which explicitly implement the same API twice, once with calls to
|
||||
synchronous functions, and once with asynchronous functions.
|
||||
|
||||
Take for example `fs.readFile` and `fs.readFileSync`, if you're writing an API
|
||||
that loads a file and then performs a synchronous operation on the data, it
|
||||
can be frustrating to maintain two parallel functions.
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const fs = require("fs");
|
||||
const gensync = require("gensync");
|
||||
|
||||
const readFile = gensync({
|
||||
sync: fs.readFileSync,
|
||||
errback: fs.readFile,
|
||||
});
|
||||
|
||||
const myOperation = gensync(function* (filename) {
|
||||
const code = yield* readFile(filename, "utf8");
|
||||
|
||||
return "// some custom prefix\n" + code;
|
||||
});
|
||||
|
||||
// Load and add the prefix synchronously:
|
||||
const result = myOperation.sync("./some-file.js");
|
||||
|
||||
// Load and add the prefix asynchronously with promises:
|
||||
myOperation.async("./some-file.js").then(result => {
|
||||
|
||||
});
|
||||
|
||||
// Load and add the prefix asynchronously with promises:
|
||||
myOperation.errback("./some-file.js", (err, result) => {
|
||||
|
||||
});
|
||||
```
|
||||
|
||||
This could even be exposed as your official API by doing
|
||||
```js
|
||||
// Using the common 'Sync' suffix for sync functions, and 'Async' suffix for
|
||||
// promise-returning versions.
|
||||
exports.myOperationSync = myOperation.sync;
|
||||
exports.myOperationAsync = myOperation.async;
|
||||
exports.myOperation = myOperation.errback;
|
||||
```
|
||||
or potentially expose one of the async versions as the default, with a
|
||||
`.sync` property on the function to expose the synchronous version.
|
||||
```js
|
||||
module.exports = myOperation.errback;
|
||||
module.exports.sync = myOperation.sync;
|
||||
````
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### gensync(generatorFnOrOptions)
|
||||
|
||||
Returns a function that can be "await"-ed in another `gensync` generator
|
||||
function, or executed via
|
||||
|
||||
* `.sync(...args)` - Returns the computed value, or throws.
|
||||
* `.async(...args)` - Returns a promise for the computed value.
|
||||
* `.errback(...args, (err, result) => {})` - Calls the callback with the computed value, or error.
|
||||
|
||||
|
||||
#### Passed a generator
|
||||
|
||||
Wraps the generator to populate the `.sync`/`.async`/`.errback` helpers above to
|
||||
allow for evaluation of the generator for the final value.
|
||||
|
||||
##### Example
|
||||
|
||||
```js
|
||||
const readFile = function* () {
|
||||
return 42;
|
||||
};
|
||||
|
||||
const readFileAndMore = gensync(function* (){
|
||||
const val = yield* readFile();
|
||||
return 42 + val;
|
||||
});
|
||||
|
||||
// In general cases
|
||||
const code = readFileAndMore.sync("./file.js", "utf8");
|
||||
readFileAndMore.async("./file.js", "utf8").then(code => {})
|
||||
readFileAndMore.errback("./file.js", "utf8", (err, code) => {});
|
||||
|
||||
// In a generator being called indirectly with .sync/.async/.errback
|
||||
const code = yield* readFileAndMore("./file.js", "utf8");
|
||||
```
|
||||
|
||||
|
||||
#### Passed an options object
|
||||
|
||||
* `opts.sync`
|
||||
|
||||
Example: `(...args) => 4`
|
||||
|
||||
A function that will be called when `.sync()` is called on the `gensync()`
|
||||
result, or when the result is passed to `yield*` in another generator that
|
||||
is being run synchronously.
|
||||
|
||||
Also called for `.async()` calls if no async handlers are provided.
|
||||
|
||||
* `opts.async`
|
||||
|
||||
Example: `async (...args) => 4`
|
||||
|
||||
A function that will be called when `.async()` or `.errback()` is called on
|
||||
the `gensync()` result, or when the result is passed to `yield*` in another
|
||||
generator that is being run asynchronously.
|
||||
|
||||
* `opts.errback`
|
||||
|
||||
Example: `(...args, cb) => cb(null, 4)`
|
||||
|
||||
A function that will be called when `.async()` or `.errback()` is called on
|
||||
the `gensync()` result, or when the result is passed to `yield*` in another
|
||||
generator that is being run asynchronously.
|
||||
|
||||
This option allows for simpler compatibility with many existing Node APIs,
|
||||
and also avoids introducing the extra even loop turns that promises introduce
|
||||
to access the result value.
|
||||
|
||||
* `opts.name`
|
||||
|
||||
Example: `"readFile"`
|
||||
|
||||
A string name to apply to the returned function. If no value is provided,
|
||||
the name of `errback`/`async`/`sync` functions will be used, with any
|
||||
`Sync` or `Async` suffix stripped off. If the callback is simply named
|
||||
with ES6 inference (same name as the options property), the name is ignored.
|
||||
|
||||
* `opts.arity`
|
||||
|
||||
Example: `4`
|
||||
|
||||
A number for the length to set on the returned function. If no value
|
||||
is provided, the length will be carried over from the `sync` function's
|
||||
`length` value.
|
||||
|
||||
##### Example
|
||||
|
||||
```js
|
||||
const readFile = gensync({
|
||||
sync: fs.readFileSync,
|
||||
errback: fs.readFile,
|
||||
});
|
||||
|
||||
const code = readFile.sync("./file.js", "utf8");
|
||||
readFile.async("./file.js", "utf8").then(code => {})
|
||||
readFile.errback("./file.js", "utf8", (err, code) => {});
|
||||
```
|
||||
|
||||
|
||||
### gensync.all(iterable)
|
||||
|
||||
`Promise.all`-like combinator that works with an iterable of generator objects
|
||||
that could be passed to `yield*` within a gensync generator.
|
||||
|
||||
#### Example
|
||||
|
||||
```js
|
||||
const loadFiles = gensync(function* () {
|
||||
return yield* gensync.all([
|
||||
readFile("./one.js"),
|
||||
readFile("./two.js"),
|
||||
readFile("./three.js"),
|
||||
]);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
### gensync.race(iterable)
|
||||
|
||||
`Promise.race`-like combinator that works with an iterable of generator objects
|
||||
that could be passed to `yield*` within a gensync generator.
|
||||
|
||||
#### Example
|
||||
|
||||
```js
|
||||
const loadFiles = gensync(function* () {
|
||||
return yield* gensync.race([
|
||||
readFile("./one.js"),
|
||||
readFile("./two.js"),
|
||||
readFile("./three.js"),
|
||||
]);
|
||||
});
|
||||
```
|
||||
@@ -0,0 +1,488 @@
|
||||
'use strict';
|
||||
|
||||
const XHTMLEntities = require('./xhtml');
|
||||
|
||||
const hexNumber = /^[\da-fA-F]+$/;
|
||||
const decimalNumber = /^\d+$/;
|
||||
|
||||
// The map to `acorn-jsx` tokens from `acorn` namespace objects.
|
||||
const acornJsxMap = new WeakMap();
|
||||
|
||||
// Get the original tokens for the given `acorn` namespace object.
|
||||
function getJsxTokens(acorn) {
|
||||
acorn = acorn.Parser.acorn || acorn;
|
||||
let acornJsx = acornJsxMap.get(acorn);
|
||||
if (!acornJsx) {
|
||||
const tt = acorn.tokTypes;
|
||||
const TokContext = acorn.TokContext;
|
||||
const TokenType = acorn.TokenType;
|
||||
const tc_oTag = new TokContext('<tag', false);
|
||||
const tc_cTag = new TokContext('</tag', false);
|
||||
const tc_expr = new TokContext('<tag>...</tag>', true, true);
|
||||
const tokContexts = {
|
||||
tc_oTag: tc_oTag,
|
||||
tc_cTag: tc_cTag,
|
||||
tc_expr: tc_expr
|
||||
};
|
||||
const tokTypes = {
|
||||
jsxName: new TokenType('jsxName'),
|
||||
jsxText: new TokenType('jsxText', {beforeExpr: true}),
|
||||
jsxTagStart: new TokenType('jsxTagStart', {startsExpr: true}),
|
||||
jsxTagEnd: new TokenType('jsxTagEnd')
|
||||
};
|
||||
|
||||
tokTypes.jsxTagStart.updateContext = function() {
|
||||
this.context.push(tc_expr); // treat as beginning of JSX expression
|
||||
this.context.push(tc_oTag); // start opening tag context
|
||||
this.exprAllowed = false;
|
||||
};
|
||||
tokTypes.jsxTagEnd.updateContext = function(prevType) {
|
||||
let out = this.context.pop();
|
||||
if (out === tc_oTag && prevType === tt.slash || out === tc_cTag) {
|
||||
this.context.pop();
|
||||
this.exprAllowed = this.curContext() === tc_expr;
|
||||
} else {
|
||||
this.exprAllowed = true;
|
||||
}
|
||||
};
|
||||
|
||||
acornJsx = { tokContexts: tokContexts, tokTypes: tokTypes };
|
||||
acornJsxMap.set(acorn, acornJsx);
|
||||
}
|
||||
|
||||
return acornJsx;
|
||||
}
|
||||
|
||||
// Transforms JSX element name to string.
|
||||
|
||||
function getQualifiedJSXName(object) {
|
||||
if (!object)
|
||||
return object;
|
||||
|
||||
if (object.type === 'JSXIdentifier')
|
||||
return object.name;
|
||||
|
||||
if (object.type === 'JSXNamespacedName')
|
||||
return object.namespace.name + ':' + object.name.name;
|
||||
|
||||
if (object.type === 'JSXMemberExpression')
|
||||
return getQualifiedJSXName(object.object) + '.' +
|
||||
getQualifiedJSXName(object.property);
|
||||
}
|
||||
|
||||
module.exports = function(options) {
|
||||
options = options || {};
|
||||
return function(Parser) {
|
||||
return plugin({
|
||||
allowNamespaces: options.allowNamespaces !== false,
|
||||
allowNamespacedObjects: !!options.allowNamespacedObjects
|
||||
}, Parser);
|
||||
};
|
||||
};
|
||||
|
||||
// This is `tokTypes` of the peer dep.
|
||||
// This can be different instances from the actual `tokTypes` this plugin uses.
|
||||
Object.defineProperty(module.exports, "tokTypes", {
|
||||
get: function get_tokTypes() {
|
||||
return getJsxTokens(require("acorn")).tokTypes;
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
function plugin(options, Parser) {
|
||||
const acorn = Parser.acorn || require("acorn");
|
||||
const acornJsx = getJsxTokens(acorn);
|
||||
const tt = acorn.tokTypes;
|
||||
const tok = acornJsx.tokTypes;
|
||||
const tokContexts = acorn.tokContexts;
|
||||
const tc_oTag = acornJsx.tokContexts.tc_oTag;
|
||||
const tc_cTag = acornJsx.tokContexts.tc_cTag;
|
||||
const tc_expr = acornJsx.tokContexts.tc_expr;
|
||||
const isNewLine = acorn.isNewLine;
|
||||
const isIdentifierStart = acorn.isIdentifierStart;
|
||||
const isIdentifierChar = acorn.isIdentifierChar;
|
||||
|
||||
return class extends Parser {
|
||||
// Expose actual `tokTypes` and `tokContexts` to other plugins.
|
||||
static get acornJsx() {
|
||||
return acornJsx;
|
||||
}
|
||||
|
||||
// Reads inline JSX contents token.
|
||||
jsx_readToken() {
|
||||
let out = '', chunkStart = this.pos;
|
||||
for (;;) {
|
||||
if (this.pos >= this.input.length)
|
||||
this.raise(this.start, 'Unterminated JSX contents');
|
||||
let ch = this.input.charCodeAt(this.pos);
|
||||
|
||||
switch (ch) {
|
||||
case 60: // '<'
|
||||
case 123: // '{'
|
||||
if (this.pos === this.start) {
|
||||
if (ch === 60 && this.exprAllowed) {
|
||||
++this.pos;
|
||||
return this.finishToken(tok.jsxTagStart);
|
||||
}
|
||||
return this.getTokenFromCode(ch);
|
||||
}
|
||||
out += this.input.slice(chunkStart, this.pos);
|
||||
return this.finishToken(tok.jsxText, out);
|
||||
|
||||
case 38: // '&'
|
||||
out += this.input.slice(chunkStart, this.pos);
|
||||
out += this.jsx_readEntity();
|
||||
chunkStart = this.pos;
|
||||
break;
|
||||
|
||||
case 62: // '>'
|
||||
case 125: // '}'
|
||||
this.raise(
|
||||
this.pos,
|
||||
"Unexpected token `" + this.input[this.pos] + "`. Did you mean `" +
|
||||
(ch === 62 ? ">" : "}") + "` or " + "`{\"" + this.input[this.pos] + "\"}" + "`?"
|
||||
);
|
||||
|
||||
default:
|
||||
if (isNewLine(ch)) {
|
||||
out += this.input.slice(chunkStart, this.pos);
|
||||
out += this.jsx_readNewLine(true);
|
||||
chunkStart = this.pos;
|
||||
} else {
|
||||
++this.pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jsx_readNewLine(normalizeCRLF) {
|
||||
let ch = this.input.charCodeAt(this.pos);
|
||||
let out;
|
||||
++this.pos;
|
||||
if (ch === 13 && this.input.charCodeAt(this.pos) === 10) {
|
||||
++this.pos;
|
||||
out = normalizeCRLF ? '\n' : '\r\n';
|
||||
} else {
|
||||
out = String.fromCharCode(ch);
|
||||
}
|
||||
if (this.options.locations) {
|
||||
++this.curLine;
|
||||
this.lineStart = this.pos;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
jsx_readString(quote) {
|
||||
let out = '', chunkStart = ++this.pos;
|
||||
for (;;) {
|
||||
if (this.pos >= this.input.length)
|
||||
this.raise(this.start, 'Unterminated string constant');
|
||||
let ch = this.input.charCodeAt(this.pos);
|
||||
if (ch === quote) break;
|
||||
if (ch === 38) { // '&'
|
||||
out += this.input.slice(chunkStart, this.pos);
|
||||
out += this.jsx_readEntity();
|
||||
chunkStart = this.pos;
|
||||
} else if (isNewLine(ch)) {
|
||||
out += this.input.slice(chunkStart, this.pos);
|
||||
out += this.jsx_readNewLine(false);
|
||||
chunkStart = this.pos;
|
||||
} else {
|
||||
++this.pos;
|
||||
}
|
||||
}
|
||||
out += this.input.slice(chunkStart, this.pos++);
|
||||
return this.finishToken(tt.string, out);
|
||||
}
|
||||
|
||||
jsx_readEntity() {
|
||||
let str = '', count = 0, entity;
|
||||
let ch = this.input[this.pos];
|
||||
if (ch !== '&')
|
||||
this.raise(this.pos, 'Entity must start with an ampersand');
|
||||
let startPos = ++this.pos;
|
||||
while (this.pos < this.input.length && count++ < 10) {
|
||||
ch = this.input[this.pos++];
|
||||
if (ch === ';') {
|
||||
if (str[0] === '#') {
|
||||
if (str[1] === 'x') {
|
||||
str = str.substr(2);
|
||||
if (hexNumber.test(str))
|
||||
entity = String.fromCharCode(parseInt(str, 16));
|
||||
} else {
|
||||
str = str.substr(1);
|
||||
if (decimalNumber.test(str))
|
||||
entity = String.fromCharCode(parseInt(str, 10));
|
||||
}
|
||||
} else {
|
||||
entity = XHTMLEntities[str];
|
||||
}
|
||||
break;
|
||||
}
|
||||
str += ch;
|
||||
}
|
||||
if (!entity) {
|
||||
this.pos = startPos;
|
||||
return '&';
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
// Read a JSX identifier (valid tag or attribute name).
|
||||
//
|
||||
// Optimized version since JSX identifiers can't contain
|
||||
// escape characters and so can be read as single slice.
|
||||
// Also assumes that first character was already checked
|
||||
// by isIdentifierStart in readToken.
|
||||
|
||||
jsx_readWord() {
|
||||
let ch, start = this.pos;
|
||||
do {
|
||||
ch = this.input.charCodeAt(++this.pos);
|
||||
} while (isIdentifierChar(ch) || ch === 45); // '-'
|
||||
return this.finishToken(tok.jsxName, this.input.slice(start, this.pos));
|
||||
}
|
||||
|
||||
// Parse next token as JSX identifier
|
||||
|
||||
jsx_parseIdentifier() {
|
||||
let node = this.startNode();
|
||||
if (this.type === tok.jsxName)
|
||||
node.name = this.value;
|
||||
else if (this.type.keyword)
|
||||
node.name = this.type.keyword;
|
||||
else
|
||||
this.unexpected();
|
||||
this.next();
|
||||
return this.finishNode(node, 'JSXIdentifier');
|
||||
}
|
||||
|
||||
// Parse namespaced identifier.
|
||||
|
||||
jsx_parseNamespacedName() {
|
||||
let startPos = this.start, startLoc = this.startLoc;
|
||||
let name = this.jsx_parseIdentifier();
|
||||
if (!options.allowNamespaces || !this.eat(tt.colon)) return name;
|
||||
var node = this.startNodeAt(startPos, startLoc);
|
||||
node.namespace = name;
|
||||
node.name = this.jsx_parseIdentifier();
|
||||
return this.finishNode(node, 'JSXNamespacedName');
|
||||
}
|
||||
|
||||
// Parses element name in any form - namespaced, member
|
||||
// or single identifier.
|
||||
|
||||
jsx_parseElementName() {
|
||||
if (this.type === tok.jsxTagEnd) return '';
|
||||
let startPos = this.start, startLoc = this.startLoc;
|
||||
let node = this.jsx_parseNamespacedName();
|
||||
if (this.type === tt.dot && node.type === 'JSXNamespacedName' && !options.allowNamespacedObjects) {
|
||||
this.unexpected();
|
||||
}
|
||||
while (this.eat(tt.dot)) {
|
||||
let newNode = this.startNodeAt(startPos, startLoc);
|
||||
newNode.object = node;
|
||||
newNode.property = this.jsx_parseIdentifier();
|
||||
node = this.finishNode(newNode, 'JSXMemberExpression');
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
// Parses any type of JSX attribute value.
|
||||
|
||||
jsx_parseAttributeValue() {
|
||||
switch (this.type) {
|
||||
case tt.braceL:
|
||||
let node = this.jsx_parseExpressionContainer();
|
||||
if (node.expression.type === 'JSXEmptyExpression')
|
||||
this.raise(node.start, 'JSX attributes must only be assigned a non-empty expression');
|
||||
return node;
|
||||
|
||||
case tok.jsxTagStart:
|
||||
case tt.string:
|
||||
return this.parseExprAtom();
|
||||
|
||||
default:
|
||||
this.raise(this.start, 'JSX value should be either an expression or a quoted JSX text');
|
||||
}
|
||||
}
|
||||
|
||||
// JSXEmptyExpression is unique type since it doesn't actually parse anything,
|
||||
// and so it should start at the end of last read token (left brace) and finish
|
||||
// at the beginning of the next one (right brace).
|
||||
|
||||
jsx_parseEmptyExpression() {
|
||||
let node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);
|
||||
return this.finishNodeAt(node, 'JSXEmptyExpression', this.start, this.startLoc);
|
||||
}
|
||||
|
||||
// Parses JSX expression enclosed into curly brackets.
|
||||
|
||||
jsx_parseExpressionContainer() {
|
||||
let node = this.startNode();
|
||||
this.next();
|
||||
node.expression = this.type === tt.braceR
|
||||
? this.jsx_parseEmptyExpression()
|
||||
: this.parseExpression();
|
||||
this.expect(tt.braceR);
|
||||
return this.finishNode(node, 'JSXExpressionContainer');
|
||||
}
|
||||
|
||||
// Parses following JSX attribute name-value pair.
|
||||
|
||||
jsx_parseAttribute() {
|
||||
let node = this.startNode();
|
||||
if (this.eat(tt.braceL)) {
|
||||
this.expect(tt.ellipsis);
|
||||
node.argument = this.parseMaybeAssign();
|
||||
this.expect(tt.braceR);
|
||||
return this.finishNode(node, 'JSXSpreadAttribute');
|
||||
}
|
||||
node.name = this.jsx_parseNamespacedName();
|
||||
node.value = this.eat(tt.eq) ? this.jsx_parseAttributeValue() : null;
|
||||
return this.finishNode(node, 'JSXAttribute');
|
||||
}
|
||||
|
||||
// Parses JSX opening tag starting after '<'.
|
||||
|
||||
jsx_parseOpeningElementAt(startPos, startLoc) {
|
||||
let node = this.startNodeAt(startPos, startLoc);
|
||||
node.attributes = [];
|
||||
let nodeName = this.jsx_parseElementName();
|
||||
if (nodeName) node.name = nodeName;
|
||||
while (this.type !== tt.slash && this.type !== tok.jsxTagEnd)
|
||||
node.attributes.push(this.jsx_parseAttribute());
|
||||
node.selfClosing = this.eat(tt.slash);
|
||||
this.expect(tok.jsxTagEnd);
|
||||
return this.finishNode(node, nodeName ? 'JSXOpeningElement' : 'JSXOpeningFragment');
|
||||
}
|
||||
|
||||
// Parses JSX closing tag starting after '</'.
|
||||
|
||||
jsx_parseClosingElementAt(startPos, startLoc) {
|
||||
let node = this.startNodeAt(startPos, startLoc);
|
||||
let nodeName = this.jsx_parseElementName();
|
||||
if (nodeName) node.name = nodeName;
|
||||
this.expect(tok.jsxTagEnd);
|
||||
return this.finishNode(node, nodeName ? 'JSXClosingElement' : 'JSXClosingFragment');
|
||||
}
|
||||
|
||||
// Parses entire JSX element, including it's opening tag
|
||||
// (starting after '<'), attributes, contents and closing tag.
|
||||
|
||||
jsx_parseElementAt(startPos, startLoc) {
|
||||
let node = this.startNodeAt(startPos, startLoc);
|
||||
let children = [];
|
||||
let openingElement = this.jsx_parseOpeningElementAt(startPos, startLoc);
|
||||
let closingElement = null;
|
||||
|
||||
if (!openingElement.selfClosing) {
|
||||
contents: for (;;) {
|
||||
switch (this.type) {
|
||||
case tok.jsxTagStart:
|
||||
startPos = this.start; startLoc = this.startLoc;
|
||||
this.next();
|
||||
if (this.eat(tt.slash)) {
|
||||
closingElement = this.jsx_parseClosingElementAt(startPos, startLoc);
|
||||
break contents;
|
||||
}
|
||||
children.push(this.jsx_parseElementAt(startPos, startLoc));
|
||||
break;
|
||||
|
||||
case tok.jsxText:
|
||||
children.push(this.parseExprAtom());
|
||||
break;
|
||||
|
||||
case tt.braceL:
|
||||
children.push(this.jsx_parseExpressionContainer());
|
||||
break;
|
||||
|
||||
default:
|
||||
this.unexpected();
|
||||
}
|
||||
}
|
||||
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
|
||||
this.raise(
|
||||
closingElement.start,
|
||||
'Expected corresponding JSX closing tag for <' + getQualifiedJSXName(openingElement.name) + '>');
|
||||
}
|
||||
}
|
||||
let fragmentOrElement = openingElement.name ? 'Element' : 'Fragment';
|
||||
|
||||
node['opening' + fragmentOrElement] = openingElement;
|
||||
node['closing' + fragmentOrElement] = closingElement;
|
||||
node.children = children;
|
||||
if (this.type === tt.relational && this.value === "<") {
|
||||
this.raise(this.start, "Adjacent JSX elements must be wrapped in an enclosing tag");
|
||||
}
|
||||
return this.finishNode(node, 'JSX' + fragmentOrElement);
|
||||
}
|
||||
|
||||
// Parse JSX text
|
||||
|
||||
jsx_parseText() {
|
||||
let node = this.parseLiteral(this.value);
|
||||
node.type = "JSXText";
|
||||
return node;
|
||||
}
|
||||
|
||||
// Parses entire JSX element from current position.
|
||||
|
||||
jsx_parseElement() {
|
||||
let startPos = this.start, startLoc = this.startLoc;
|
||||
this.next();
|
||||
return this.jsx_parseElementAt(startPos, startLoc);
|
||||
}
|
||||
|
||||
parseExprAtom(refShortHandDefaultPos) {
|
||||
if (this.type === tok.jsxText)
|
||||
return this.jsx_parseText();
|
||||
else if (this.type === tok.jsxTagStart)
|
||||
return this.jsx_parseElement();
|
||||
else
|
||||
return super.parseExprAtom(refShortHandDefaultPos);
|
||||
}
|
||||
|
||||
readToken(code) {
|
||||
let context = this.curContext();
|
||||
|
||||
if (context === tc_expr) return this.jsx_readToken();
|
||||
|
||||
if (context === tc_oTag || context === tc_cTag) {
|
||||
if (isIdentifierStart(code)) return this.jsx_readWord();
|
||||
|
||||
if (code == 62) {
|
||||
++this.pos;
|
||||
return this.finishToken(tok.jsxTagEnd);
|
||||
}
|
||||
|
||||
if ((code === 34 || code === 39) && context == tc_oTag)
|
||||
return this.jsx_readString(code);
|
||||
}
|
||||
|
||||
if (code === 60 && this.exprAllowed && this.input.charCodeAt(this.pos + 1) !== 33) {
|
||||
++this.pos;
|
||||
return this.finishToken(tok.jsxTagStart);
|
||||
}
|
||||
return super.readToken(code);
|
||||
}
|
||||
|
||||
updateContext(prevType) {
|
||||
if (this.type == tt.braceL) {
|
||||
var curContext = this.curContext();
|
||||
if (curContext == tc_oTag) this.context.push(tokContexts.b_expr);
|
||||
else if (curContext == tc_expr) this.context.push(tokContexts.b_tmpl);
|
||||
else super.updateContext(prevType);
|
||||
this.exprAllowed = true;
|
||||
} else if (this.type === tt.slash && prevType === tok.jsxTagStart) {
|
||||
this.context.length -= 2; // do not consider JSX expr -> JSX open tag -> ... anymore
|
||||
this.context.push(tc_cTag); // reconsider as closing tag context
|
||||
this.exprAllowed = false;
|
||||
} else {
|
||||
return super.updateContext(prevType);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"B","2":"K D E F A mC"},B:{"1":"0 9 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"nC LC J PB K D E F A B C L M G N O qC rC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC"},E:{"1":"J PB K D E F A B C L M G sC SC tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C"},F:{"1":"0 1 2 3 4 5 6 7 8 C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 8C GC","2":"F B 4C 5C 6C 7C FC kC"},G:{"1":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"1":"WD"},I:{"1":"LC J I XD YD ZD aD lC bD cD"},J:{"1":"D A"},K:{"1":"C H GC","2":"A B FC kC"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"B","2":"A"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:5,C:"Window.devicePixelRatio",D:true};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,324 @@
|
||||
/**
|
||||
* @fileoverview Prefer destructuring from arrays and objects
|
||||
* @author Alex LaFroscia
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const PRECEDENCE_OF_ASSIGNMENT_EXPR = astUtils.getPrecedence({
|
||||
type: "AssignmentExpression",
|
||||
});
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "Require destructuring from arrays and/or objects",
|
||||
recommended: false,
|
||||
frozen: true,
|
||||
url: "https://eslint.org/docs/latest/rules/prefer-destructuring",
|
||||
},
|
||||
|
||||
fixable: "code",
|
||||
|
||||
schema: [
|
||||
{
|
||||
/*
|
||||
* old support {array: Boolean, object: Boolean}
|
||||
* new support {VariableDeclarator: {}, AssignmentExpression: {}}
|
||||
*/
|
||||
oneOf: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
VariableDeclarator: {
|
||||
type: "object",
|
||||
properties: {
|
||||
array: {
|
||||
type: "boolean",
|
||||
},
|
||||
object: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
AssignmentExpression: {
|
||||
type: "object",
|
||||
properties: {
|
||||
array: {
|
||||
type: "boolean",
|
||||
},
|
||||
object: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
array: {
|
||||
type: "boolean",
|
||||
},
|
||||
object: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
enforceForRenamedProperties: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
preferDestructuring: "Use {{type}} destructuring.",
|
||||
},
|
||||
},
|
||||
create(context) {
|
||||
const enabledTypes = context.options[0];
|
||||
const enforceForRenamedProperties =
|
||||
context.options[1] &&
|
||||
context.options[1].enforceForRenamedProperties;
|
||||
let normalizedOptions = {
|
||||
VariableDeclarator: { array: true, object: true },
|
||||
AssignmentExpression: { array: true, object: true },
|
||||
};
|
||||
|
||||
if (enabledTypes) {
|
||||
normalizedOptions =
|
||||
typeof enabledTypes.array !== "undefined" ||
|
||||
typeof enabledTypes.object !== "undefined"
|
||||
? {
|
||||
VariableDeclarator: enabledTypes,
|
||||
AssignmentExpression: enabledTypes,
|
||||
}
|
||||
: enabledTypes;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Checks if destructuring type should be checked.
|
||||
* @param {string} nodeType "AssignmentExpression" or "VariableDeclarator"
|
||||
* @param {string} destructuringType "array" or "object"
|
||||
* @returns {boolean} `true` if the destructuring type should be checked for the given node
|
||||
*/
|
||||
function shouldCheck(nodeType, destructuringType) {
|
||||
return (
|
||||
normalizedOptions &&
|
||||
normalizedOptions[nodeType] &&
|
||||
normalizedOptions[nodeType][destructuringType]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the given node is accessing an array index
|
||||
*
|
||||
* This is used to differentiate array index access from object property
|
||||
* access.
|
||||
* @param {ASTNode} node the node to evaluate
|
||||
* @returns {boolean} whether or not the node is an integer
|
||||
*/
|
||||
function isArrayIndexAccess(node) {
|
||||
return Number.isInteger(node.property.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Report that the given node should use destructuring
|
||||
* @param {ASTNode} reportNode the node to report
|
||||
* @param {string} type the type of destructuring that should have been done
|
||||
* @param {Function|null} fix the fix function or null to pass to context.report
|
||||
* @returns {void}
|
||||
*/
|
||||
function report(reportNode, type, fix) {
|
||||
context.report({
|
||||
node: reportNode,
|
||||
messageId: "preferDestructuring",
|
||||
data: { type },
|
||||
fix,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a node should be fixed into object destructuring
|
||||
*
|
||||
* The fixer only fixes the simplest case of object destructuring,
|
||||
* like: `let x = a.x`;
|
||||
*
|
||||
* Assignment expression is not fixed.
|
||||
* Array destructuring is not fixed.
|
||||
* Renamed property is not fixed.
|
||||
* @param {ASTNode} node the node to evaluate
|
||||
* @returns {boolean} whether or not the node should be fixed
|
||||
*/
|
||||
function shouldFix(node) {
|
||||
return (
|
||||
node.type === "VariableDeclarator" &&
|
||||
node.id.type === "Identifier" &&
|
||||
node.init.type === "MemberExpression" &&
|
||||
!node.init.computed &&
|
||||
node.init.property.type === "Identifier" &&
|
||||
node.id.name === node.init.property.name
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix a node into object destructuring.
|
||||
* This function only handles the simplest case of object destructuring,
|
||||
* see {@link shouldFix}.
|
||||
* @param {SourceCodeFixer} fixer the fixer object
|
||||
* @param {ASTNode} node the node to be fixed.
|
||||
* @returns {Object} a fix for the node
|
||||
*/
|
||||
function fixIntoObjectDestructuring(fixer, node) {
|
||||
const rightNode = node.init;
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
// Don't fix if that would remove any comments. Only comments inside `rightNode.object` can be preserved.
|
||||
if (
|
||||
sourceCode.getCommentsInside(node).length >
|
||||
sourceCode.getCommentsInside(rightNode.object).length
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let objectText = sourceCode.getText(rightNode.object);
|
||||
|
||||
if (
|
||||
astUtils.getPrecedence(rightNode.object) <
|
||||
PRECEDENCE_OF_ASSIGNMENT_EXPR
|
||||
) {
|
||||
objectText = `(${objectText})`;
|
||||
}
|
||||
|
||||
return fixer.replaceText(
|
||||
node,
|
||||
`{${rightNode.property.name}} = ${objectText}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the `prefer-destructuring` rules are followed based on the
|
||||
* given left- and right-hand side of the assignment.
|
||||
*
|
||||
* Pulled out into a separate method so that VariableDeclarators and
|
||||
* AssignmentExpressions can share the same verification logic.
|
||||
* @param {ASTNode} leftNode the left-hand side of the assignment
|
||||
* @param {ASTNode} rightNode the right-hand side of the assignment
|
||||
* @param {ASTNode} reportNode the node to report the error on
|
||||
* @returns {void}
|
||||
*/
|
||||
function performCheck(leftNode, rightNode, reportNode) {
|
||||
if (
|
||||
rightNode.type !== "MemberExpression" ||
|
||||
rightNode.object.type === "Super" ||
|
||||
rightNode.property.type === "PrivateIdentifier"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isArrayIndexAccess(rightNode)) {
|
||||
if (shouldCheck(reportNode.type, "array")) {
|
||||
report(reportNode, "array", null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const fix = shouldFix(reportNode)
|
||||
? fixer => fixIntoObjectDestructuring(fixer, reportNode)
|
||||
: null;
|
||||
|
||||
if (
|
||||
shouldCheck(reportNode.type, "object") &&
|
||||
enforceForRenamedProperties
|
||||
) {
|
||||
report(reportNode, "object", fix);
|
||||
return;
|
||||
}
|
||||
|
||||
if (shouldCheck(reportNode.type, "object")) {
|
||||
const property = rightNode.property;
|
||||
|
||||
if (
|
||||
(property.type === "Literal" &&
|
||||
leftNode.name === property.value) ||
|
||||
(property.type === "Identifier" &&
|
||||
leftNode.name === property.name &&
|
||||
!rightNode.computed)
|
||||
) {
|
||||
report(reportNode, "object", fix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given variable declarator is coming from an property access
|
||||
* that should be using destructuring instead
|
||||
* @param {ASTNode} node the variable declarator to check
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkVariableDeclarator(node) {
|
||||
// Skip if variable is declared without assignment
|
||||
if (!node.init) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We only care about member expressions past this point
|
||||
if (node.init.type !== "MemberExpression") {
|
||||
return;
|
||||
}
|
||||
|
||||
performCheck(node.id, node.init, node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the `prefer-destructuring` check on an AssignmentExpression
|
||||
* @param {ASTNode} node the AssignmentExpression node
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkAssignmentExpression(node) {
|
||||
if (node.operator === "=") {
|
||||
performCheck(node.left, node.right, node);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Public
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
VariableDeclarator: checkVariableDeclarator,
|
||||
AssignmentExpression: checkAssignmentExpression,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
export { TSR_DEFERRED_PROMISE, defer } from './defer.js';
|
||||
export type { DeferredPromiseState, DeferredPromise } from './defer.js';
|
||||
export { preloadWarning } from './link.js';
|
||||
export type { IsRequiredParams, ParsePathParams, AddTrailingSlash, RemoveTrailingSlashes, AddLeadingSlash, RemoveLeadingSlashes, ActiveOptions, LinkOptionsProps, ResolveCurrentPath, ResolveParentPath, ResolveRelativePath, LinkCurrentTargetElement, FindDescendantToPaths, InferDescendantToPaths, RelativeToPath, RelativeToParentPath, RelativeToCurrentPath, AbsoluteToPath, RelativeToPathAutoComplete, NavigateOptions, ToOptions, ToMaskOptions, ToSubOptions, ResolveRoute, SearchParamOptions, PathParamOptions, ToPathOption, LinkOptions, MakeOptionalPathParams, FromPathOption, MakeOptionalSearchParams, MaskOptions, ToSubOptionsProps, RequiredToOptions, } from './link.js';
|
||||
export type { RouteToPath, TrailingSlashOptionByRouter, ParseRoute, CodeRouteToPath, RouteIds, FullSearchSchema, FullSearchSchemaInput, AllParams, RouteById, AllContext, RoutePaths, RoutesById, RoutesByPath, AllLoaderData, RouteByPath, } from './routeInfo.js';
|
||||
export type { InferFileRouteTypes, FileRouteTypes, FileRoutesByPath, LazyRoute, LazyRouteOptions, } from './fileRoute.js';
|
||||
export type { StartSerializer, Serializable, SerializerParse, SerializerParseBy, SerializerStringify, SerializerStringifyBy, SerializerExtensions, } from './serializer.js';
|
||||
export type { ParsedLocation } from './location.js';
|
||||
export type { Manifest, RouterManagedTag } from './manifest.js';
|
||||
export { isMatch } from './Matches.js';
|
||||
export type { AnyMatchAndValue, FindValueByIndex, FindValueByKey, CreateMatchAndValue, NextMatchAndValue, IsMatchKeyOf, IsMatchPath, IsMatchResult, IsMatchParse, IsMatch, RouteMatch, RouteMatchExtensions, MakeRouteMatchUnion, MakeRouteMatch, AnyRouteMatch, MakeRouteMatchFromRoute, MatchRouteOptions, } from './Matches.js';
|
||||
export { joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, removeTrailingSlash, exactPathTest, resolvePath, parsePathname, interpolatePath, matchPathname, removeBasepath, matchByPath, } from './path.js';
|
||||
export type { Segment } from './path.js';
|
||||
export { encode, decode } from './qss.js';
|
||||
export { rootRouteId } from './root.js';
|
||||
export type { RootRouteId } from './root.js';
|
||||
export { BaseRoute, BaseRouteApi, BaseRootRoute } from './route.js';
|
||||
export type { AnyPathParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, SearchFilter, SearchMiddlewareContext, SearchMiddleware, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, InferAllParams, InferAllContext, MetaDescriptor, RouteLinkEntry, SearchValidator, AnySearchValidator, DefaultSearchValidator, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, ParseSplatParams, SplatParams, ResolveParams, ParseParamsFn, StringifyParamsFn, ParamsOptions, UpdatableStaticRouteOption, LooseReturnType, LooseAsyncReturnType, ContextReturnType, ContextAsyncReturnType, ResolveRouteContext, ResolveLoaderData, RoutePrefix, TrimPath, TrimPathLeft, TrimPathRight, ResolveSearchSchemaFnInput, ResolveSearchSchemaInput, ResolveSearchSchemaFn, ResolveSearchSchema, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllContext, BeforeLoadContextParameter, RouteContextParameter, ResolveAllParamsFromParent, AnyRoute, Route, RouteTypes, FullSearchSchemaOption, RemountDepsOptions, MakeRemountDepsOptionsUnion, ResolveFullPath, AnyRouteWithContext, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, RouteContextFn, BeforeLoadFn, ContextOptions, RouteContextOptions, BeforeLoadContextOptions, RootRouteOptions, UpdatableRouteOptionsExtensions, RouteConstraints, RouteTypesById, RouteMask, RouteExtensions, RouteLazyFn, RouteAddChildrenFn, RouteAddFileChildrenFn, RouteAddFileTypesFn, } from './route.js';
|
||||
export { defaultSerializeError, getLocationChangeInfo, RouterCore, componentTypes, lazyFn, SearchParamError, PathParamError, getInitialRouterState, } from './router.js';
|
||||
export type { ViewTransitionOptions, ExtractedBaseEntry, ExtractedStream, ExtractedPromise, ExtractedEntry, StreamState, TrailingSlashOption, Register, AnyRouter, AnyRouterWithContext, RegisteredRouter, RouterState, BuildNextOptions, RouterListener, RouterEvent, ListenerFn, RouterEvents, MatchRoutesOpts, RouterOptionsExtensions, DefaultRemountDepsFn, PreloadRouteFn, MatchRouteFn, RouterContextOptions, RouterOptions, RouterConstructorOptions, UpdateFn, ParseLocationFn, InvalidateFn, ControllablePromise, InjectedHtmlEntry, RouterErrorSerializer, MatchedRoutesResult, EmitFn, LoadFn, GetMatchFn, SubscribeFn, UpdateMatchFn, CommitLocationFn, GetMatchRoutesFn, MatchRoutesFn, StartTransitionFn, LoadRouteChunkFn, ServerSrr, ClearCacheFn, CreateRouterFn, } from './router.js';
|
||||
export type { MatchLocation, CommitLocationOptions, NavigateFn, BuildLocationFn, } from './RouterProvider.js';
|
||||
export { retainSearchParams, stripSearchParams } from './searchMiddleware.js';
|
||||
export { defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, } from './searchParams.js';
|
||||
export type { SearchSerializer, SearchParser } from './searchParams.js';
|
||||
export type { OptionalStructuralSharing } from './structuralSharing.js';
|
||||
export { last, functionalUpdate, pick, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, escapeJSON, shallow, createControlledPromise, } from './utils.js';
|
||||
export type { NoInfer, IsAny, PickAsRequired, PickRequired, PickOptional, WithoutEmpty, Expand, DeepPartial, MakeDifferenceOptional, IsUnion, IsNonEmptyObject, Assign, IntersectAssign, Timeout, Updater, NonNullableUpdater, StringLiteral, ThrowOrOptional, ThrowConstraint, ControlledPromise, ExtractObjects, PartialMergeAllObject, MergeAllPrimitive, ExtractPrimitives, PartialMergeAll, Constrain, ConstrainLiteral, UnionToIntersection, MergeAllObjects, MergeAll, ValidateJSON, StrictOrFrom, } from './utils.js';
|
||||
export type { StandardSchemaValidatorProps, StandardSchemaValidator, AnyStandardSchemaValidator, StandardSchemaValidatorTypes, AnyStandardSchemaValidateSuccess, AnyStandardSchemaValidateFailure, AnyStandardSchemaValidateIssue, AnyStandardSchemaValidateInput, AnyStandardSchemaValidate, ValidatorObj, AnyValidatorObj, ValidatorAdapter, AnyValidatorAdapter, AnyValidatorFn, ValidatorFn, Validator, AnyValidator, AnySchema, DefaultValidator, ResolveSearchValidatorInputFn, ResolveSearchValidatorInput, ResolveValidatorInputFn, ResolveValidatorInput, ResolveValidatorOutputFn, ResolveValidatorOutput, } from './validators.js';
|
||||
export type { UseRouteContextBaseOptions, UseRouteContextOptions, UseRouteContextResult, } from './useRouteContext.js';
|
||||
export type { UseSearchResult, ResolveUseSearch } from './useSearch.js';
|
||||
export type { UseParamsResult, ResolveUseParams } from './useParams.js';
|
||||
export type { UseNavigateResult } from './useNavigate.js';
|
||||
export type { UseLoaderDepsResult, ResolveUseLoaderDeps } from './useLoaderDeps.js';
|
||||
export type { UseLoaderDataResult, ResolveUseLoaderData } from './useLoaderData.js';
|
||||
export type { Redirect, ResolvedRedirect, AnyRedirect } from './redirect.js';
|
||||
export { redirect, isRedirect, isResolvedRedirect } from './redirect.js';
|
||||
export type { NotFoundError } from './not-found.js';
|
||||
export { isNotFound, notFound } from './not-found.js';
|
||||
export { defaultGetScrollRestorationKey, restoreScroll, storageKey, getCssSelector, scrollRestorationCache, setupScrollRestoration, handleHashScroll, } from './scroll-restoration.js';
|
||||
export type { ScrollRestorationOptions, ScrollRestorationEntry, } from './scroll-restoration.js';
|
||||
export type { ValidateFromPath, ValidateToPath, ValidateSearch, ValidateParams, InferFrom, InferTo, InferMaskTo, InferMaskFrom, ValidateNavigateOptions, ValidateNavigateOptionsArray, ValidateRedirectOptions, ValidateRedirectOptionsArray, ValidateId, InferStrict, InferShouldThrow, InferSelected, ValidateUseSearchResult, ValidateUseParamsResult, } from './typePrimitives.js';
|
||||
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
var parse = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('nums', function (t) {
|
||||
var argv = parse([
|
||||
'-x', '1234',
|
||||
'-y', '5.67',
|
||||
'-z', '1e7',
|
||||
'-w', '10f',
|
||||
'--hex', '0xdeadbeef',
|
||||
'789',
|
||||
]);
|
||||
t.deepEqual(argv, {
|
||||
x: 1234,
|
||||
y: 5.67,
|
||||
z: 1e7,
|
||||
w: '10f',
|
||||
hex: 0xdeadbeef,
|
||||
_: [789],
|
||||
});
|
||||
t.deepEqual(typeof argv.x, 'number');
|
||||
t.deepEqual(typeof argv.y, 'number');
|
||||
t.deepEqual(typeof argv.z, 'number');
|
||||
t.deepEqual(typeof argv.w, 'string');
|
||||
t.deepEqual(typeof argv.hex, 'number');
|
||||
t.deepEqual(typeof argv._[0], 'number');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('already a number', function (t) {
|
||||
var argv = parse(['-x', 1234, 789]);
|
||||
t.deepEqual(argv, { x: 1234, _: [789] });
|
||||
t.deepEqual(typeof argv.x, 'number');
|
||||
t.deepEqual(typeof argv._[0], 'number');
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"132":"K D E F A B mC"},B:{"1":"0 9 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","4":"C L M G N O P"},C:{"1":"0 9 mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"nC LC J PB K D E F A B qC rC","33":"1 2 3 4 5 6 7 8 C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB"},D:{"1":"0 9 kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB","322":"YB ZB aB bB cB dB eB fB gB hB iB jB"},E:{"1":"IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB K D E F A B C L M G sC SC tC uC vC wC TC FC GC xC yC zC UC VC HC 0C"},F:{"1":"0 XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 F B C G N O P QB 4C 5C 6C 7C FC kC 8C GC","578":"3 4 5 6 7 8 RB SB TB UB VB WB"},G:{"1":"IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"132":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD","2":"J"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"rD","33":"qD"}},B:4,C:"CSS3 text-align-last",D:true};
|
||||
@@ -0,0 +1,373 @@
|
||||
"use strict";
|
||||
|
||||
// These use the global symbol registry so that multiple copies of this
|
||||
// library can work together in case they are not deduped.
|
||||
const GENSYNC_START = Symbol.for("gensync:v1:start");
|
||||
const GENSYNC_SUSPEND = Symbol.for("gensync:v1:suspend");
|
||||
|
||||
const GENSYNC_EXPECTED_START = "GENSYNC_EXPECTED_START";
|
||||
const GENSYNC_EXPECTED_SUSPEND = "GENSYNC_EXPECTED_SUSPEND";
|
||||
const GENSYNC_OPTIONS_ERROR = "GENSYNC_OPTIONS_ERROR";
|
||||
const GENSYNC_RACE_NONEMPTY = "GENSYNC_RACE_NONEMPTY";
|
||||
const GENSYNC_ERRBACK_NO_CALLBACK = "GENSYNC_ERRBACK_NO_CALLBACK";
|
||||
|
||||
module.exports = Object.assign(
|
||||
function gensync(optsOrFn) {
|
||||
let genFn = optsOrFn;
|
||||
if (typeof optsOrFn !== "function") {
|
||||
genFn = newGenerator(optsOrFn);
|
||||
} else {
|
||||
genFn = wrapGenerator(optsOrFn);
|
||||
}
|
||||
|
||||
return Object.assign(genFn, makeFunctionAPI(genFn));
|
||||
},
|
||||
{
|
||||
all: buildOperation({
|
||||
name: "all",
|
||||
arity: 1,
|
||||
sync: function(args) {
|
||||
const items = Array.from(args[0]);
|
||||
return items.map(item => evaluateSync(item));
|
||||
},
|
||||
async: function(args, resolve, reject) {
|
||||
const items = Array.from(args[0]);
|
||||
|
||||
if (items.length === 0) {
|
||||
Promise.resolve().then(() => resolve([]));
|
||||
return;
|
||||
}
|
||||
|
||||
let count = 0;
|
||||
const results = items.map(() => undefined);
|
||||
items.forEach((item, i) => {
|
||||
evaluateAsync(
|
||||
item,
|
||||
val => {
|
||||
results[i] = val;
|
||||
count += 1;
|
||||
|
||||
if (count === results.length) resolve(results);
|
||||
},
|
||||
reject
|
||||
);
|
||||
});
|
||||
},
|
||||
}),
|
||||
race: buildOperation({
|
||||
name: "race",
|
||||
arity: 1,
|
||||
sync: function(args) {
|
||||
const items = Array.from(args[0]);
|
||||
if (items.length === 0) {
|
||||
throw makeError("Must race at least 1 item", GENSYNC_RACE_NONEMPTY);
|
||||
}
|
||||
|
||||
return evaluateSync(items[0]);
|
||||
},
|
||||
async: function(args, resolve, reject) {
|
||||
const items = Array.from(args[0]);
|
||||
if (items.length === 0) {
|
||||
throw makeError("Must race at least 1 item", GENSYNC_RACE_NONEMPTY);
|
||||
}
|
||||
|
||||
for (const item of items) {
|
||||
evaluateAsync(item, resolve, reject);
|
||||
}
|
||||
},
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Given a generator function, return the standard API object that executes
|
||||
* the generator and calls the callbacks.
|
||||
*/
|
||||
function makeFunctionAPI(genFn) {
|
||||
const fns = {
|
||||
sync: function(...args) {
|
||||
return evaluateSync(genFn.apply(this, args));
|
||||
},
|
||||
async: function(...args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
evaluateAsync(genFn.apply(this, args), resolve, reject);
|
||||
});
|
||||
},
|
||||
errback: function(...args) {
|
||||
const cb = args.pop();
|
||||
if (typeof cb !== "function") {
|
||||
throw makeError(
|
||||
"Asynchronous function called without callback",
|
||||
GENSYNC_ERRBACK_NO_CALLBACK
|
||||
);
|
||||
}
|
||||
|
||||
let gen;
|
||||
try {
|
||||
gen = genFn.apply(this, args);
|
||||
} catch (err) {
|
||||
cb(err);
|
||||
return;
|
||||
}
|
||||
|
||||
evaluateAsync(gen, val => cb(undefined, val), err => cb(err));
|
||||
},
|
||||
};
|
||||
return fns;
|
||||
}
|
||||
|
||||
function assertTypeof(type, name, value, allowUndefined) {
|
||||
if (
|
||||
typeof value === type ||
|
||||
(allowUndefined && typeof value === "undefined")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
let msg;
|
||||
if (allowUndefined) {
|
||||
msg = `Expected opts.${name} to be either a ${type}, or undefined.`;
|
||||
} else {
|
||||
msg = `Expected opts.${name} to be a ${type}.`;
|
||||
}
|
||||
|
||||
throw makeError(msg, GENSYNC_OPTIONS_ERROR);
|
||||
}
|
||||
function makeError(msg, code) {
|
||||
return Object.assign(new Error(msg), { code });
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an options object, return a new generator that dispatches the
|
||||
* correct handler based on sync or async execution.
|
||||
*/
|
||||
function newGenerator({ name, arity, sync, async, errback }) {
|
||||
assertTypeof("string", "name", name, true /* allowUndefined */);
|
||||
assertTypeof("number", "arity", arity, true /* allowUndefined */);
|
||||
assertTypeof("function", "sync", sync);
|
||||
assertTypeof("function", "async", async, true /* allowUndefined */);
|
||||
assertTypeof("function", "errback", errback, true /* allowUndefined */);
|
||||
if (async && errback) {
|
||||
throw makeError(
|
||||
"Expected one of either opts.async or opts.errback, but got _both_.",
|
||||
GENSYNC_OPTIONS_ERROR
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof name !== "string") {
|
||||
let fnName;
|
||||
if (errback && errback.name && errback.name !== "errback") {
|
||||
fnName = errback.name;
|
||||
}
|
||||
if (async && async.name && async.name !== "async") {
|
||||
fnName = async.name.replace(/Async$/, "");
|
||||
}
|
||||
if (sync && sync.name && sync.name !== "sync") {
|
||||
fnName = sync.name.replace(/Sync$/, "");
|
||||
}
|
||||
|
||||
if (typeof fnName === "string") {
|
||||
name = fnName;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof arity !== "number") {
|
||||
arity = sync.length;
|
||||
}
|
||||
|
||||
return buildOperation({
|
||||
name,
|
||||
arity,
|
||||
sync: function(args) {
|
||||
return sync.apply(this, args);
|
||||
},
|
||||
async: function(args, resolve, reject) {
|
||||
if (async) {
|
||||
async.apply(this, args).then(resolve, reject);
|
||||
} else if (errback) {
|
||||
errback.call(this, ...args, (err, value) => {
|
||||
if (err == null) resolve(value);
|
||||
else reject(err);
|
||||
});
|
||||
} else {
|
||||
resolve(sync.apply(this, args));
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function wrapGenerator(genFn) {
|
||||
return setFunctionMetadata(genFn.name, genFn.length, function(...args) {
|
||||
return genFn.apply(this, args);
|
||||
});
|
||||
}
|
||||
|
||||
function buildOperation({ name, arity, sync, async }) {
|
||||
return setFunctionMetadata(name, arity, function*(...args) {
|
||||
const resume = yield GENSYNC_START;
|
||||
if (!resume) {
|
||||
// Break the tail call to avoid a bug in V8 v6.X with --harmony enabled.
|
||||
const res = sync.call(this, args);
|
||||
return res;
|
||||
}
|
||||
|
||||
let result;
|
||||
try {
|
||||
async.call(
|
||||
this,
|
||||
args,
|
||||
value => {
|
||||
if (result) return;
|
||||
|
||||
result = { value };
|
||||
resume();
|
||||
},
|
||||
err => {
|
||||
if (result) return;
|
||||
|
||||
result = { err };
|
||||
resume();
|
||||
}
|
||||
);
|
||||
} catch (err) {
|
||||
result = { err };
|
||||
resume();
|
||||
}
|
||||
|
||||
// Suspend until the callbacks run. Will resume synchronously if the
|
||||
// callback was already called.
|
||||
yield GENSYNC_SUSPEND;
|
||||
|
||||
if (result.hasOwnProperty("err")) {
|
||||
throw result.err;
|
||||
}
|
||||
|
||||
return result.value;
|
||||
});
|
||||
}
|
||||
|
||||
function evaluateSync(gen) {
|
||||
let value;
|
||||
while (!({ value } = gen.next()).done) {
|
||||
assertStart(value, gen);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function evaluateAsync(gen, resolve, reject) {
|
||||
(function step() {
|
||||
try {
|
||||
let value;
|
||||
while (!({ value } = gen.next()).done) {
|
||||
assertStart(value, gen);
|
||||
|
||||
// If this throws, it is considered to have broken the contract
|
||||
// established for async handlers. If these handlers are called
|
||||
// synchronously, it is also considered bad behavior.
|
||||
let sync = true;
|
||||
let didSyncResume = false;
|
||||
const out = gen.next(() => {
|
||||
if (sync) {
|
||||
didSyncResume = true;
|
||||
} else {
|
||||
step();
|
||||
}
|
||||
});
|
||||
sync = false;
|
||||
|
||||
assertSuspend(out, gen);
|
||||
|
||||
if (!didSyncResume) {
|
||||
// Callback wasn't called synchronously, so break out of the loop
|
||||
// and let it call 'step' later.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return resolve(value);
|
||||
} catch (err) {
|
||||
return reject(err);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
function assertStart(value, gen) {
|
||||
if (value === GENSYNC_START) return;
|
||||
|
||||
throwError(
|
||||
gen,
|
||||
makeError(
|
||||
`Got unexpected yielded value in gensync generator: ${JSON.stringify(
|
||||
value
|
||||
)}. Did you perhaps mean to use 'yield*' instead of 'yield'?`,
|
||||
GENSYNC_EXPECTED_START
|
||||
)
|
||||
);
|
||||
}
|
||||
function assertSuspend({ value, done }, gen) {
|
||||
if (!done && value === GENSYNC_SUSPEND) return;
|
||||
|
||||
throwError(
|
||||
gen,
|
||||
makeError(
|
||||
done
|
||||
? "Unexpected generator completion. If you get this, it is probably a gensync bug."
|
||||
: `Expected GENSYNC_SUSPEND, got ${JSON.stringify(
|
||||
value
|
||||
)}. If you get this, it is probably a gensync bug.`,
|
||||
GENSYNC_EXPECTED_SUSPEND
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function throwError(gen, err) {
|
||||
// Call `.throw` so that users can step in a debugger to easily see which
|
||||
// 'yield' passed an unexpected value. If the `.throw` call didn't throw
|
||||
// back to the generator, we explicitly do it to stop the error
|
||||
// from being swallowed by user code try/catches.
|
||||
if (gen.throw) gen.throw(err);
|
||||
throw err;
|
||||
}
|
||||
|
||||
function isIterable(value) {
|
||||
return (
|
||||
!!value &&
|
||||
(typeof value === "object" || typeof value === "function") &&
|
||||
!value[Symbol.iterator]
|
||||
);
|
||||
}
|
||||
|
||||
function setFunctionMetadata(name, arity, fn) {
|
||||
if (typeof name === "string") {
|
||||
// This should always work on the supported Node versions, but for the
|
||||
// sake of users that are compiling to older versions, we check for
|
||||
// configurability so we don't throw.
|
||||
const nameDesc = Object.getOwnPropertyDescriptor(fn, "name");
|
||||
if (!nameDesc || nameDesc.configurable) {
|
||||
Object.defineProperty(
|
||||
fn,
|
||||
"name",
|
||||
Object.assign(nameDesc || {}, {
|
||||
configurable: true,
|
||||
value: name,
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof arity === "number") {
|
||||
const lengthDesc = Object.getOwnPropertyDescriptor(fn, "length");
|
||||
if (!lengthDesc || lengthDesc.configurable) {
|
||||
Object.defineProperty(
|
||||
fn,
|
||||
"length",
|
||||
Object.assign(lengthDesc || {}, {
|
||||
configurable: true,
|
||||
value: arity,
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return fn;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _initializerDefineProperty;
|
||||
function _initializerDefineProperty(target, property, descriptor, context) {
|
||||
if (!descriptor) return;
|
||||
Object.defineProperty(target, property, {
|
||||
enumerable: descriptor.enumerable,
|
||||
configurable: descriptor.configurable,
|
||||
writable: descriptor.writable,
|
||||
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=initializerDefineProperty.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
|
||||
import { RouterManagedTag } from '@tanstack/router-core';
|
||||
export declare const useTags: () => RouterManagedTag[];
|
||||
/**
|
||||
* @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.
|
||||
* It should be rendered in the `<head>` of your document.
|
||||
*/
|
||||
export declare function HeadContent(): import("react/jsx-runtime").JSX.Element[];
|
||||
@@ -0,0 +1,385 @@
|
||||
/**
|
||||
* @license React
|
||||
* react-jsx-runtime.react-server.development.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
"production" !== process.env.NODE_ENV &&
|
||||
(function () {
|
||||
function getComponentNameFromType(type) {
|
||||
if (null == type) return null;
|
||||
if ("function" === typeof type)
|
||||
return type.$$typeof === REACT_CLIENT_REFERENCE
|
||||
? null
|
||||
: type.displayName || type.name || null;
|
||||
if ("string" === typeof type) return type;
|
||||
switch (type) {
|
||||
case REACT_FRAGMENT_TYPE:
|
||||
return "Fragment";
|
||||
case REACT_PROFILER_TYPE:
|
||||
return "Profiler";
|
||||
case REACT_STRICT_MODE_TYPE:
|
||||
return "StrictMode";
|
||||
case REACT_SUSPENSE_TYPE:
|
||||
return "Suspense";
|
||||
case REACT_SUSPENSE_LIST_TYPE:
|
||||
return "SuspenseList";
|
||||
case REACT_ACTIVITY_TYPE:
|
||||
return "Activity";
|
||||
}
|
||||
if ("object" === typeof type)
|
||||
switch (
|
||||
("number" === typeof type.tag &&
|
||||
console.error(
|
||||
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
||||
),
|
||||
type.$$typeof)
|
||||
) {
|
||||
case REACT_PORTAL_TYPE:
|
||||
return "Portal";
|
||||
case REACT_CONTEXT_TYPE:
|
||||
return (type.displayName || "Context") + ".Provider";
|
||||
case REACT_CONSUMER_TYPE:
|
||||
return (type._context.displayName || "Context") + ".Consumer";
|
||||
case REACT_FORWARD_REF_TYPE:
|
||||
var innerType = type.render;
|
||||
type = type.displayName;
|
||||
type ||
|
||||
((type = innerType.displayName || innerType.name || ""),
|
||||
(type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
|
||||
return type;
|
||||
case REACT_MEMO_TYPE:
|
||||
return (
|
||||
(innerType = type.displayName || null),
|
||||
null !== innerType
|
||||
? innerType
|
||||
: getComponentNameFromType(type.type) || "Memo"
|
||||
);
|
||||
case REACT_LAZY_TYPE:
|
||||
innerType = type._payload;
|
||||
type = type._init;
|
||||
try {
|
||||
return getComponentNameFromType(type(innerType));
|
||||
} catch (x) {}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function testStringCoercion(value) {
|
||||
return "" + value;
|
||||
}
|
||||
function checkKeyStringCoercion(value) {
|
||||
try {
|
||||
testStringCoercion(value);
|
||||
var JSCompiler_inline_result = !1;
|
||||
} catch (e) {
|
||||
JSCompiler_inline_result = !0;
|
||||
}
|
||||
if (JSCompiler_inline_result) {
|
||||
JSCompiler_inline_result = console;
|
||||
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
||||
var JSCompiler_inline_result$jscomp$0 =
|
||||
("function" === typeof Symbol &&
|
||||
Symbol.toStringTag &&
|
||||
value[Symbol.toStringTag]) ||
|
||||
value.constructor.name ||
|
||||
"Object";
|
||||
JSCompiler_temp_const.call(
|
||||
JSCompiler_inline_result,
|
||||
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
||||
JSCompiler_inline_result$jscomp$0
|
||||
);
|
||||
return testStringCoercion(value);
|
||||
}
|
||||
}
|
||||
function getTaskName(type) {
|
||||
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
||||
if (
|
||||
"object" === typeof type &&
|
||||
null !== type &&
|
||||
type.$$typeof === REACT_LAZY_TYPE
|
||||
)
|
||||
return "<...>";
|
||||
try {
|
||||
var name = getComponentNameFromType(type);
|
||||
return name ? "<" + name + ">" : "<...>";
|
||||
} catch (x) {
|
||||
return "<...>";
|
||||
}
|
||||
}
|
||||
function getOwner() {
|
||||
var dispatcher = ReactSharedInternalsServer.A;
|
||||
return null === dispatcher ? null : dispatcher.getOwner();
|
||||
}
|
||||
function UnknownOwner() {
|
||||
return Error("react-stack-top-frame");
|
||||
}
|
||||
function hasValidKey(config) {
|
||||
if (hasOwnProperty.call(config, "key")) {
|
||||
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
||||
if (getter && getter.isReactWarning) return !1;
|
||||
}
|
||||
return void 0 !== config.key;
|
||||
}
|
||||
function defineKeyPropWarningGetter(props, displayName) {
|
||||
function warnAboutAccessingKey() {
|
||||
specialPropKeyWarningShown ||
|
||||
((specialPropKeyWarningShown = !0),
|
||||
console.error(
|
||||
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
||||
displayName
|
||||
));
|
||||
}
|
||||
warnAboutAccessingKey.isReactWarning = !0;
|
||||
Object.defineProperty(props, "key", {
|
||||
get: warnAboutAccessingKey,
|
||||
configurable: !0
|
||||
});
|
||||
}
|
||||
function elementRefGetterWithDeprecationWarning() {
|
||||
var componentName = getComponentNameFromType(this.type);
|
||||
didWarnAboutElementRef[componentName] ||
|
||||
((didWarnAboutElementRef[componentName] = !0),
|
||||
console.error(
|
||||
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
||||
));
|
||||
componentName = this.props.ref;
|
||||
return void 0 !== componentName ? componentName : null;
|
||||
}
|
||||
function ReactElement(
|
||||
type,
|
||||
key,
|
||||
self,
|
||||
source,
|
||||
owner,
|
||||
props,
|
||||
debugStack,
|
||||
debugTask
|
||||
) {
|
||||
self = props.ref;
|
||||
type = {
|
||||
$$typeof: REACT_ELEMENT_TYPE,
|
||||
type: type,
|
||||
key: key,
|
||||
props: props,
|
||||
_owner: owner
|
||||
};
|
||||
null !== (void 0 !== self ? self : null)
|
||||
? Object.defineProperty(type, "ref", {
|
||||
enumerable: !1,
|
||||
get: elementRefGetterWithDeprecationWarning
|
||||
})
|
||||
: Object.defineProperty(type, "ref", { enumerable: !1, value: null });
|
||||
type._store = {};
|
||||
Object.defineProperty(type._store, "validated", {
|
||||
configurable: !1,
|
||||
enumerable: !1,
|
||||
writable: !0,
|
||||
value: 0
|
||||
});
|
||||
Object.defineProperty(type, "_debugInfo", {
|
||||
configurable: !1,
|
||||
enumerable: !1,
|
||||
writable: !0,
|
||||
value: null
|
||||
});
|
||||
Object.defineProperty(type, "_debugStack", {
|
||||
configurable: !1,
|
||||
enumerable: !1,
|
||||
writable: !0,
|
||||
value: debugStack
|
||||
});
|
||||
Object.defineProperty(type, "_debugTask", {
|
||||
configurable: !1,
|
||||
enumerable: !1,
|
||||
writable: !0,
|
||||
value: debugTask
|
||||
});
|
||||
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
||||
return type;
|
||||
}
|
||||
function jsxDEVImpl(
|
||||
type,
|
||||
config,
|
||||
maybeKey,
|
||||
isStaticChildren,
|
||||
source,
|
||||
self,
|
||||
debugStack,
|
||||
debugTask
|
||||
) {
|
||||
var children = config.children;
|
||||
if (void 0 !== children)
|
||||
if (isStaticChildren)
|
||||
if (isArrayImpl(children)) {
|
||||
for (
|
||||
isStaticChildren = 0;
|
||||
isStaticChildren < children.length;
|
||||
isStaticChildren++
|
||||
)
|
||||
validateChildKeys(children[isStaticChildren]);
|
||||
Object.freeze && Object.freeze(children);
|
||||
} else
|
||||
console.error(
|
||||
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
||||
);
|
||||
else validateChildKeys(children);
|
||||
if (hasOwnProperty.call(config, "key")) {
|
||||
children = getComponentNameFromType(type);
|
||||
var keys = Object.keys(config).filter(function (k) {
|
||||
return "key" !== k;
|
||||
});
|
||||
isStaticChildren =
|
||||
0 < keys.length
|
||||
? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
|
||||
: "{key: someKey}";
|
||||
didWarnAboutKeySpread[children + isStaticChildren] ||
|
||||
((keys =
|
||||
0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
|
||||
console.error(
|
||||
'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
|
||||
isStaticChildren,
|
||||
children,
|
||||
keys,
|
||||
children
|
||||
),
|
||||
(didWarnAboutKeySpread[children + isStaticChildren] = !0));
|
||||
}
|
||||
children = null;
|
||||
void 0 !== maybeKey &&
|
||||
(checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
|
||||
hasValidKey(config) &&
|
||||
(checkKeyStringCoercion(config.key), (children = "" + config.key));
|
||||
if ("key" in config) {
|
||||
maybeKey = {};
|
||||
for (var propName in config)
|
||||
"key" !== propName && (maybeKey[propName] = config[propName]);
|
||||
} else maybeKey = config;
|
||||
children &&
|
||||
defineKeyPropWarningGetter(
|
||||
maybeKey,
|
||||
"function" === typeof type
|
||||
? type.displayName || type.name || "Unknown"
|
||||
: type
|
||||
);
|
||||
return ReactElement(
|
||||
type,
|
||||
children,
|
||||
self,
|
||||
source,
|
||||
getOwner(),
|
||||
maybeKey,
|
||||
debugStack,
|
||||
debugTask
|
||||
);
|
||||
}
|
||||
function validateChildKeys(node) {
|
||||
"object" === typeof node &&
|
||||
null !== node &&
|
||||
node.$$typeof === REACT_ELEMENT_TYPE &&
|
||||
node._store &&
|
||||
(node._store.validated = 1);
|
||||
}
|
||||
var React = require("react"),
|
||||
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
||||
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
||||
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
||||
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
||||
REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
||||
Symbol.for("react.provider");
|
||||
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
||||
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
||||
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
||||
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
||||
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
||||
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
||||
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
||||
REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
|
||||
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
|
||||
ReactSharedInternalsServer =
|
||||
React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
||||
if (!ReactSharedInternalsServer)
|
||||
throw Error(
|
||||
'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
|
||||
);
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty,
|
||||
isArrayImpl = Array.isArray,
|
||||
createTask = console.createTask
|
||||
? console.createTask
|
||||
: function () {
|
||||
return null;
|
||||
};
|
||||
React = {
|
||||
"react-stack-bottom-frame": function (callStackForError) {
|
||||
return callStackForError();
|
||||
}
|
||||
};
|
||||
var specialPropKeyWarningShown;
|
||||
var didWarnAboutElementRef = {};
|
||||
var unknownOwnerDebugStack = React["react-stack-bottom-frame"].bind(
|
||||
React,
|
||||
UnknownOwner
|
||||
)();
|
||||
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
||||
var didWarnAboutKeySpread = {};
|
||||
exports.Fragment = REACT_FRAGMENT_TYPE;
|
||||
exports.jsx = function (type, config, maybeKey, source, self) {
|
||||
var trackActualOwner =
|
||||
1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
|
||||
return jsxDEVImpl(
|
||||
type,
|
||||
config,
|
||||
maybeKey,
|
||||
!1,
|
||||
source,
|
||||
self,
|
||||
trackActualOwner
|
||||
? Error("react-stack-top-frame")
|
||||
: unknownOwnerDebugStack,
|
||||
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
||||
);
|
||||
};
|
||||
exports.jsxDEV = function (
|
||||
type,
|
||||
config,
|
||||
maybeKey,
|
||||
isStaticChildren,
|
||||
source,
|
||||
self
|
||||
) {
|
||||
var trackActualOwner =
|
||||
1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
|
||||
return jsxDEVImpl(
|
||||
type,
|
||||
config,
|
||||
maybeKey,
|
||||
isStaticChildren,
|
||||
source,
|
||||
self,
|
||||
trackActualOwner
|
||||
? Error("react-stack-top-frame")
|
||||
: unknownOwnerDebugStack,
|
||||
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
||||
);
|
||||
};
|
||||
exports.jsxs = function (type, config, maybeKey, source, self) {
|
||||
var trackActualOwner =
|
||||
1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
|
||||
return jsxDEVImpl(
|
||||
type,
|
||||
config,
|
||||
maybeKey,
|
||||
!0,
|
||||
source,
|
||||
self,
|
||||
trackActualOwner
|
||||
? Error("react-stack-top-frame")
|
||||
: unknownOwnerDebugStack,
|
||||
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
||||
);
|
||||
};
|
||||
})();
|
||||
@@ -0,0 +1,46 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{
|
||||
var $noEmptySchema = $schema.every(function($sch) {
|
||||
return {{# def.nonEmptySchema:$sch }};
|
||||
});
|
||||
}}
|
||||
{{? $noEmptySchema }}
|
||||
{{ var $currentBaseId = $it.baseId; }}
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}} = false;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
|
||||
{{=$valid}} = {{=$valid}} || {{=$nextValid}};
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{~}}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.extraError:'anyOf' }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if (true) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","16":"mC","132":"K D E F"},B:{"1":"0 9 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"nC LC J PB K D qC rC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC"},E:{"1":"J PB K D E F A B C L M G tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"sC SC"},F:{"1":"0 1 2 3 4 5 6 7 8 B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 5C 6C 7C FC kC 8C GC","16":"F 4C"},G:{"1":"E 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","16":"SC"},H:{"1":"WD"},I:{"1":"LC J I ZD aD lC bD cD","16":"XD YD"},J:{"1":"D A"},K:{"1":"A B C H FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:4,C:"Element.insertAdjacentHTML()",D:true};
|
||||
Reference in New Issue
Block a user