update
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @fileoverview Rule to flag use of with statement
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "Disallow `with` statements",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-with",
|
||||
},
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
unexpectedWith: "Unexpected use of 'with' statement.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
WithStatement(node) {
|
||||
context.report({ node, messageId: "unexpectedWith" });
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = mergeSourceMap;
|
||||
function _remapping() {
|
||||
const data = require("@ampproject/remapping");
|
||||
_remapping = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function mergeSourceMap(inputMap, map, sourceFileName) {
|
||||
const source = sourceFileName.replace(/\\/g, "/");
|
||||
let found = false;
|
||||
const result = _remapping()(rootless(map), (s, ctx) => {
|
||||
if (s === source && !found) {
|
||||
found = true;
|
||||
ctx.source = "";
|
||||
return rootless(inputMap);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
if (typeof inputMap.sourceRoot === "string") {
|
||||
result.sourceRoot = inputMap.sourceRoot;
|
||||
}
|
||||
return Object.assign({}, result);
|
||||
}
|
||||
function rootless(map) {
|
||||
return Object.assign({}, map, {
|
||||
sourceRoot: null
|
||||
});
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=merge-map.js.map
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Feross Aboukhadijeh
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,353 @@
|
||||
'use strict'
|
||||
|
||||
const DEFAULT_RAW = {
|
||||
after: '\n',
|
||||
beforeClose: '\n',
|
||||
beforeComment: '\n',
|
||||
beforeDecl: '\n',
|
||||
beforeOpen: ' ',
|
||||
beforeRule: '\n',
|
||||
colon: ': ',
|
||||
commentLeft: ' ',
|
||||
commentRight: ' ',
|
||||
emptyBody: '',
|
||||
indent: ' ',
|
||||
semicolon: false
|
||||
}
|
||||
|
||||
function capitalize(str) {
|
||||
return str[0].toUpperCase() + str.slice(1)
|
||||
}
|
||||
|
||||
class Stringifier {
|
||||
constructor(builder) {
|
||||
this.builder = builder
|
||||
}
|
||||
|
||||
atrule(node, semicolon) {
|
||||
let name = '@' + node.name
|
||||
let params = node.params ? this.rawValue(node, 'params') : ''
|
||||
|
||||
if (typeof node.raws.afterName !== 'undefined') {
|
||||
name += node.raws.afterName
|
||||
} else if (params) {
|
||||
name += ' '
|
||||
}
|
||||
|
||||
if (node.nodes) {
|
||||
this.block(node, name + params)
|
||||
} else {
|
||||
let end = (node.raws.between || '') + (semicolon ? ';' : '')
|
||||
this.builder(name + params + end, node)
|
||||
}
|
||||
}
|
||||
|
||||
beforeAfter(node, detect) {
|
||||
let value
|
||||
if (node.type === 'decl') {
|
||||
value = this.raw(node, null, 'beforeDecl')
|
||||
} else if (node.type === 'comment') {
|
||||
value = this.raw(node, null, 'beforeComment')
|
||||
} else if (detect === 'before') {
|
||||
value = this.raw(node, null, 'beforeRule')
|
||||
} else {
|
||||
value = this.raw(node, null, 'beforeClose')
|
||||
}
|
||||
|
||||
let buf = node.parent
|
||||
let depth = 0
|
||||
while (buf && buf.type !== 'root') {
|
||||
depth += 1
|
||||
buf = buf.parent
|
||||
}
|
||||
|
||||
if (value.includes('\n')) {
|
||||
let indent = this.raw(node, null, 'indent')
|
||||
if (indent.length) {
|
||||
for (let step = 0; step < depth; step++) value += indent
|
||||
}
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
block(node, start) {
|
||||
let between = this.raw(node, 'between', 'beforeOpen')
|
||||
this.builder(start + between + '{', node, 'start')
|
||||
|
||||
let after
|
||||
if (node.nodes && node.nodes.length) {
|
||||
this.body(node)
|
||||
after = this.raw(node, 'after')
|
||||
} else {
|
||||
after = this.raw(node, 'after', 'emptyBody')
|
||||
}
|
||||
|
||||
if (after) this.builder(after)
|
||||
this.builder('}', node, 'end')
|
||||
}
|
||||
|
||||
body(node) {
|
||||
let last = node.nodes.length - 1
|
||||
while (last > 0) {
|
||||
if (node.nodes[last].type !== 'comment') break
|
||||
last -= 1
|
||||
}
|
||||
|
||||
let semicolon = this.raw(node, 'semicolon')
|
||||
for (let i = 0; i < node.nodes.length; i++) {
|
||||
let child = node.nodes[i]
|
||||
let before = this.raw(child, 'before')
|
||||
if (before) this.builder(before)
|
||||
this.stringify(child, last !== i || semicolon)
|
||||
}
|
||||
}
|
||||
|
||||
comment(node) {
|
||||
let left = this.raw(node, 'left', 'commentLeft')
|
||||
let right = this.raw(node, 'right', 'commentRight')
|
||||
this.builder('/*' + left + node.text + right + '*/', node)
|
||||
}
|
||||
|
||||
decl(node, semicolon) {
|
||||
let between = this.raw(node, 'between', 'colon')
|
||||
let string = node.prop + between + this.rawValue(node, 'value')
|
||||
|
||||
if (node.important) {
|
||||
string += node.raws.important || ' !important'
|
||||
}
|
||||
|
||||
if (semicolon) string += ';'
|
||||
this.builder(string, node)
|
||||
}
|
||||
|
||||
document(node) {
|
||||
this.body(node)
|
||||
}
|
||||
|
||||
raw(node, own, detect) {
|
||||
let value
|
||||
if (!detect) detect = own
|
||||
|
||||
// Already had
|
||||
if (own) {
|
||||
value = node.raws[own]
|
||||
if (typeof value !== 'undefined') return value
|
||||
}
|
||||
|
||||
let parent = node.parent
|
||||
|
||||
if (detect === 'before') {
|
||||
// Hack for first rule in CSS
|
||||
if (!parent || (parent.type === 'root' && parent.first === node)) {
|
||||
return ''
|
||||
}
|
||||
|
||||
// `root` nodes in `document` should use only their own raws
|
||||
if (parent && parent.type === 'document') {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
// Floating child without parent
|
||||
if (!parent) return DEFAULT_RAW[detect]
|
||||
|
||||
// Detect style by other nodes
|
||||
let root = node.root()
|
||||
if (!root.rawCache) root.rawCache = {}
|
||||
if (typeof root.rawCache[detect] !== 'undefined') {
|
||||
return root.rawCache[detect]
|
||||
}
|
||||
|
||||
if (detect === 'before' || detect === 'after') {
|
||||
return this.beforeAfter(node, detect)
|
||||
} else {
|
||||
let method = 'raw' + capitalize(detect)
|
||||
if (this[method]) {
|
||||
value = this[method](root, node)
|
||||
} else {
|
||||
root.walk(i => {
|
||||
value = i.raws[own]
|
||||
if (typeof value !== 'undefined') return false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof value === 'undefined') value = DEFAULT_RAW[detect]
|
||||
|
||||
root.rawCache[detect] = value
|
||||
return value
|
||||
}
|
||||
|
||||
rawBeforeClose(root) {
|
||||
let value
|
||||
root.walk(i => {
|
||||
if (i.nodes && i.nodes.length > 0) {
|
||||
if (typeof i.raws.after !== 'undefined') {
|
||||
value = i.raws.after
|
||||
if (value.includes('\n')) {
|
||||
value = value.replace(/[^\n]+$/, '')
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
})
|
||||
if (value) value = value.replace(/\S/g, '')
|
||||
return value
|
||||
}
|
||||
|
||||
rawBeforeComment(root, node) {
|
||||
let value
|
||||
root.walkComments(i => {
|
||||
if (typeof i.raws.before !== 'undefined') {
|
||||
value = i.raws.before
|
||||
if (value.includes('\n')) {
|
||||
value = value.replace(/[^\n]+$/, '')
|
||||
}
|
||||
return false
|
||||
}
|
||||
})
|
||||
if (typeof value === 'undefined') {
|
||||
value = this.raw(node, null, 'beforeDecl')
|
||||
} else if (value) {
|
||||
value = value.replace(/\S/g, '')
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
rawBeforeDecl(root, node) {
|
||||
let value
|
||||
root.walkDecls(i => {
|
||||
if (typeof i.raws.before !== 'undefined') {
|
||||
value = i.raws.before
|
||||
if (value.includes('\n')) {
|
||||
value = value.replace(/[^\n]+$/, '')
|
||||
}
|
||||
return false
|
||||
}
|
||||
})
|
||||
if (typeof value === 'undefined') {
|
||||
value = this.raw(node, null, 'beforeRule')
|
||||
} else if (value) {
|
||||
value = value.replace(/\S/g, '')
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
rawBeforeOpen(root) {
|
||||
let value
|
||||
root.walk(i => {
|
||||
if (i.type !== 'decl') {
|
||||
value = i.raws.between
|
||||
if (typeof value !== 'undefined') return false
|
||||
}
|
||||
})
|
||||
return value
|
||||
}
|
||||
|
||||
rawBeforeRule(root) {
|
||||
let value
|
||||
root.walk(i => {
|
||||
if (i.nodes && (i.parent !== root || root.first !== i)) {
|
||||
if (typeof i.raws.before !== 'undefined') {
|
||||
value = i.raws.before
|
||||
if (value.includes('\n')) {
|
||||
value = value.replace(/[^\n]+$/, '')
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
})
|
||||
if (value) value = value.replace(/\S/g, '')
|
||||
return value
|
||||
}
|
||||
|
||||
rawColon(root) {
|
||||
let value
|
||||
root.walkDecls(i => {
|
||||
if (typeof i.raws.between !== 'undefined') {
|
||||
value = i.raws.between.replace(/[^\s:]/g, '')
|
||||
return false
|
||||
}
|
||||
})
|
||||
return value
|
||||
}
|
||||
|
||||
rawEmptyBody(root) {
|
||||
let value
|
||||
root.walk(i => {
|
||||
if (i.nodes && i.nodes.length === 0) {
|
||||
value = i.raws.after
|
||||
if (typeof value !== 'undefined') return false
|
||||
}
|
||||
})
|
||||
return value
|
||||
}
|
||||
|
||||
rawIndent(root) {
|
||||
if (root.raws.indent) return root.raws.indent
|
||||
let value
|
||||
root.walk(i => {
|
||||
let p = i.parent
|
||||
if (p && p !== root && p.parent && p.parent === root) {
|
||||
if (typeof i.raws.before !== 'undefined') {
|
||||
let parts = i.raws.before.split('\n')
|
||||
value = parts[parts.length - 1]
|
||||
value = value.replace(/\S/g, '')
|
||||
return false
|
||||
}
|
||||
}
|
||||
})
|
||||
return value
|
||||
}
|
||||
|
||||
rawSemicolon(root) {
|
||||
let value
|
||||
root.walk(i => {
|
||||
if (i.nodes && i.nodes.length && i.last.type === 'decl') {
|
||||
value = i.raws.semicolon
|
||||
if (typeof value !== 'undefined') return false
|
||||
}
|
||||
})
|
||||
return value
|
||||
}
|
||||
|
||||
rawValue(node, prop) {
|
||||
let value = node[prop]
|
||||
let raw = node.raws[prop]
|
||||
if (raw && raw.value === value) {
|
||||
return raw.raw
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
root(node) {
|
||||
this.body(node)
|
||||
if (node.raws.after) this.builder(node.raws.after)
|
||||
}
|
||||
|
||||
rule(node) {
|
||||
this.block(node, this.rawValue(node, 'selector'))
|
||||
if (node.raws.ownSemicolon) {
|
||||
this.builder(node.raws.ownSemicolon, node, 'end')
|
||||
}
|
||||
}
|
||||
|
||||
stringify(node, semicolon) {
|
||||
/* c8 ignore start */
|
||||
if (!this[node.type]) {
|
||||
throw new Error(
|
||||
'Unknown AST node type ' +
|
||||
node.type +
|
||||
'. ' +
|
||||
'Maybe you need to change PostCSS stringifier.'
|
||||
)
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
this[node.type](node, semicolon)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Stringifier
|
||||
Stringifier.default = Stringifier
|
||||
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* Key/value storage for annotation data in forms.
|
||||
*/
|
||||
export class AnnotationStorage {
|
||||
onSetModified: any;
|
||||
onResetModified: any;
|
||||
onAnnotationEditor: any;
|
||||
/**
|
||||
* Get the value for a given key if it exists, or return the default value.
|
||||
* @param {string} key
|
||||
* @param {Object} defaultValue
|
||||
* @returns {Object}
|
||||
*/
|
||||
getValue(key: string, defaultValue: Object): Object;
|
||||
/**
|
||||
* Get the value for a given key.
|
||||
* @param {string} key
|
||||
* @returns {Object}
|
||||
*/
|
||||
getRawValue(key: string): Object;
|
||||
/**
|
||||
* Remove a value from the storage.
|
||||
* @param {string} key
|
||||
*/
|
||||
remove(key: string): void;
|
||||
/**
|
||||
* Set the value for a given key
|
||||
* @param {string} key
|
||||
* @param {Object} value
|
||||
*/
|
||||
setValue(key: string, value: Object): void;
|
||||
/**
|
||||
* Check if the storage contains the given key.
|
||||
* @param {string} key
|
||||
* @returns {boolean}
|
||||
*/
|
||||
has(key: string): boolean;
|
||||
/**
|
||||
* @returns {Object | null}
|
||||
*/
|
||||
getAll(): Object | null;
|
||||
/**
|
||||
* @param {Object} obj
|
||||
*/
|
||||
setAll(obj: Object): void;
|
||||
get size(): number;
|
||||
resetModified(): void;
|
||||
/**
|
||||
* @returns {PrintAnnotationStorage}
|
||||
*/
|
||||
get print(): PrintAnnotationStorage;
|
||||
/**
|
||||
* PLEASE NOTE: Only intended for usage within the API itself.
|
||||
* @ignore
|
||||
*/
|
||||
get serializable(): Readonly<{
|
||||
map: null;
|
||||
hash: "";
|
||||
transfer: undefined;
|
||||
}> | {
|
||||
map: Map<any, any>;
|
||||
hash: string;
|
||||
transfer: any[];
|
||||
};
|
||||
get editorStats(): any;
|
||||
resetModifiedIds(): void;
|
||||
/**
|
||||
* @returns {{ids: Set<string>, hash: string}}
|
||||
*/
|
||||
get modifiedIds(): {
|
||||
ids: Set<string>;
|
||||
hash: string;
|
||||
};
|
||||
#private;
|
||||
}
|
||||
/**
|
||||
* A special `AnnotationStorage` for use during printing, where the serializable
|
||||
* data is *frozen* upon initialization, to prevent scripting from modifying its
|
||||
* contents. (Necessary since printing is triggered synchronously in browsers.)
|
||||
*/
|
||||
export class PrintAnnotationStorage extends AnnotationStorage {
|
||||
constructor(parent: any);
|
||||
/**
|
||||
* PLEASE NOTE: Only intended for usage within the API itself.
|
||||
* @ignore
|
||||
*/
|
||||
get serializable(): {
|
||||
map: any;
|
||||
hash: any;
|
||||
transfer: any;
|
||||
};
|
||||
get modifiedIds(): any;
|
||||
#private;
|
||||
}
|
||||
export const SerializableEmpty: Readonly<{
|
||||
map: null;
|
||||
hash: "";
|
||||
transfer: undefined;
|
||||
}>;
|
||||
@@ -0,0 +1,291 @@
|
||||
/**
|
||||
* @fileoverview Rule to enforce linebreaks after open and before close array brackets
|
||||
* @author Jan Peer Stöcklmair <https://github.com/JPeer264>
|
||||
* @deprecated in ESLint v8.53.0
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
deprecated: {
|
||||
message: "Formatting rules are being moved out of ESLint core.",
|
||||
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
|
||||
deprecatedSince: "8.53.0",
|
||||
availableUntil: "10.0.0",
|
||||
replacedBy: [
|
||||
{
|
||||
message:
|
||||
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
||||
url: "https://eslint.style/guide/migration",
|
||||
plugin: {
|
||||
name: "@stylistic/eslint-plugin-js",
|
||||
url: "https://eslint.style/packages/js",
|
||||
},
|
||||
rule: {
|
||||
name: "array-bracket-newline",
|
||||
url: "https://eslint.style/rules/js/array-bracket-newline",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
type: "layout",
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Enforce linebreaks after opening and before closing array brackets",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/array-bracket-newline",
|
||||
},
|
||||
|
||||
fixable: "whitespace",
|
||||
|
||||
schema: [
|
||||
{
|
||||
oneOf: [
|
||||
{
|
||||
enum: ["always", "never", "consistent"],
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
multiline: {
|
||||
type: "boolean",
|
||||
},
|
||||
minItems: {
|
||||
type: ["integer", "null"],
|
||||
minimum: 0,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
unexpectedOpeningLinebreak:
|
||||
"There should be no linebreak after '['.",
|
||||
unexpectedClosingLinebreak:
|
||||
"There should be no linebreak before ']'.",
|
||||
missingOpeningLinebreak: "A linebreak is required after '['.",
|
||||
missingClosingLinebreak: "A linebreak is required before ']'.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Helpers
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Normalizes a given option value.
|
||||
* @param {string|Object|undefined} option An option value to parse.
|
||||
* @returns {{multiline: boolean, minItems: number}} Normalized option object.
|
||||
*/
|
||||
function normalizeOptionValue(option) {
|
||||
let consistent = false;
|
||||
let multiline = false;
|
||||
let minItems;
|
||||
|
||||
if (option) {
|
||||
if (option === "consistent") {
|
||||
consistent = true;
|
||||
minItems = Number.POSITIVE_INFINITY;
|
||||
} else if (option === "always" || option.minItems === 0) {
|
||||
minItems = 0;
|
||||
} else if (option === "never") {
|
||||
minItems = Number.POSITIVE_INFINITY;
|
||||
} else {
|
||||
multiline = Boolean(option.multiline);
|
||||
minItems = option.minItems || Number.POSITIVE_INFINITY;
|
||||
}
|
||||
} else {
|
||||
consistent = false;
|
||||
multiline = true;
|
||||
minItems = Number.POSITIVE_INFINITY;
|
||||
}
|
||||
|
||||
return { consistent, multiline, minItems };
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes a given option value.
|
||||
* @param {string|Object|undefined} options An option value to parse.
|
||||
* @returns {{ArrayExpression: {multiline: boolean, minItems: number}, ArrayPattern: {multiline: boolean, minItems: number}}} Normalized option object.
|
||||
*/
|
||||
function normalizeOptions(options) {
|
||||
const value = normalizeOptionValue(options);
|
||||
|
||||
return { ArrayExpression: value, ArrayPattern: value };
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports that there shouldn't be a linebreak after the first token
|
||||
* @param {ASTNode} node The node to report in the event of an error.
|
||||
* @param {Token} token The token to use for the report.
|
||||
* @returns {void}
|
||||
*/
|
||||
function reportNoBeginningLinebreak(node, token) {
|
||||
context.report({
|
||||
node,
|
||||
loc: token.loc,
|
||||
messageId: "unexpectedOpeningLinebreak",
|
||||
fix(fixer) {
|
||||
const nextToken = sourceCode.getTokenAfter(token, {
|
||||
includeComments: true,
|
||||
});
|
||||
|
||||
if (astUtils.isCommentToken(nextToken)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return fixer.removeRange([
|
||||
token.range[1],
|
||||
nextToken.range[0],
|
||||
]);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports that there shouldn't be a linebreak before the last token
|
||||
* @param {ASTNode} node The node to report in the event of an error.
|
||||
* @param {Token} token The token to use for the report.
|
||||
* @returns {void}
|
||||
*/
|
||||
function reportNoEndingLinebreak(node, token) {
|
||||
context.report({
|
||||
node,
|
||||
loc: token.loc,
|
||||
messageId: "unexpectedClosingLinebreak",
|
||||
fix(fixer) {
|
||||
const previousToken = sourceCode.getTokenBefore(token, {
|
||||
includeComments: true,
|
||||
});
|
||||
|
||||
if (astUtils.isCommentToken(previousToken)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return fixer.removeRange([
|
||||
previousToken.range[1],
|
||||
token.range[0],
|
||||
]);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports that there should be a linebreak after the first token
|
||||
* @param {ASTNode} node The node to report in the event of an error.
|
||||
* @param {Token} token The token to use for the report.
|
||||
* @returns {void}
|
||||
*/
|
||||
function reportRequiredBeginningLinebreak(node, token) {
|
||||
context.report({
|
||||
node,
|
||||
loc: token.loc,
|
||||
messageId: "missingOpeningLinebreak",
|
||||
fix(fixer) {
|
||||
return fixer.insertTextAfter(token, "\n");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports that there should be a linebreak before the last token
|
||||
* @param {ASTNode} node The node to report in the event of an error.
|
||||
* @param {Token} token The token to use for the report.
|
||||
* @returns {void}
|
||||
*/
|
||||
function reportRequiredEndingLinebreak(node, token) {
|
||||
context.report({
|
||||
node,
|
||||
loc: token.loc,
|
||||
messageId: "missingClosingLinebreak",
|
||||
fix(fixer) {
|
||||
return fixer.insertTextBefore(token, "\n");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports a given node if it violated this rule.
|
||||
* @param {ASTNode} node A node to check. This is an ArrayExpression node or an ArrayPattern node.
|
||||
* @returns {void}
|
||||
*/
|
||||
function check(node) {
|
||||
const elements = node.elements;
|
||||
const normalizedOptions = normalizeOptions(context.options[0]);
|
||||
const options = normalizedOptions[node.type];
|
||||
const openBracket = sourceCode.getFirstToken(node);
|
||||
const closeBracket = sourceCode.getLastToken(node);
|
||||
const firstIncComment = sourceCode.getTokenAfter(openBracket, {
|
||||
includeComments: true,
|
||||
});
|
||||
const lastIncComment = sourceCode.getTokenBefore(closeBracket, {
|
||||
includeComments: true,
|
||||
});
|
||||
const first = sourceCode.getTokenAfter(openBracket);
|
||||
const last = sourceCode.getTokenBefore(closeBracket);
|
||||
|
||||
const needsLinebreaks =
|
||||
elements.length >= options.minItems ||
|
||||
(options.multiline &&
|
||||
elements.length > 0 &&
|
||||
firstIncComment.loc.start.line !==
|
||||
lastIncComment.loc.end.line) ||
|
||||
(elements.length === 0 &&
|
||||
firstIncComment.type === "Block" &&
|
||||
firstIncComment.loc.start.line !==
|
||||
lastIncComment.loc.end.line &&
|
||||
firstIncComment === lastIncComment) ||
|
||||
(options.consistent &&
|
||||
openBracket.loc.end.line !== first.loc.start.line);
|
||||
|
||||
/*
|
||||
* Use tokens or comments to check multiline or not.
|
||||
* But use only tokens to check whether linebreaks are needed.
|
||||
* This allows:
|
||||
* var arr = [ // eslint-disable-line foo
|
||||
* 'a'
|
||||
* ]
|
||||
*/
|
||||
|
||||
if (needsLinebreaks) {
|
||||
if (astUtils.isTokenOnSameLine(openBracket, first)) {
|
||||
reportRequiredBeginningLinebreak(node, openBracket);
|
||||
}
|
||||
if (astUtils.isTokenOnSameLine(last, closeBracket)) {
|
||||
reportRequiredEndingLinebreak(node, closeBracket);
|
||||
}
|
||||
} else {
|
||||
if (!astUtils.isTokenOnSameLine(openBracket, first)) {
|
||||
reportNoBeginningLinebreak(node, openBracket);
|
||||
}
|
||||
if (!astUtils.isTokenOnSameLine(last, closeBracket)) {
|
||||
reportNoEndingLinebreak(node, closeBracket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Public
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
ArrayPattern: check,
|
||||
ArrayExpression: check,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F mC","260":"A B"},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","260":"C L M G N O P"},C:{"1":"0 9 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 qC","260":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB rC"},D:{"1":"0 9 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","2":"J PB","260":"1 2 3 4 5 6 7 8 L M G N O P QB RB SB TB UB VB WB XB YB ZB aB","388":"K D E F A B C"},E:{"1":"A B C L M G 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":"J PB sC SC","260":"K D E F uC vC wC","388":"tC"},F:{"1":"0 6 7 8 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","2":"F B 4C 5C 6C 7C","260":"1 2 3 4 5 C G N O P QB FC kC 8C GC"},G:{"1":"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","2":"SC 9C lC AD","260":"E BD CD DD ED FD"},H:{"2":"WD"},I:{"1":"I cD","2":"XD YD ZD","260":"bD","388":"LC J aD lC"},J:{"260":"A","388":"D"},K:{"1":"H","2":"A B","260":"C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A","260":"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:5,C:"File API",D:true};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"52":0.07986,"68":0.00363,"88":0.00363,"99":0.00363,"111":0.00726,"115":0.45738,"121":0.00363,"123":0.01452,"125":0.01452,"127":0.00363,"128":0.02178,"129":0.00363,"131":0.00363,"132":0.00363,"133":0.00726,"134":0.00726,"135":0.41382,"136":1.35762,"137":0.05082,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 89 90 91 92 93 94 95 96 97 98 100 101 102 103 104 105 106 107 108 109 110 112 113 114 116 117 118 119 120 122 124 126 130 138 139 140 3.5 3.6"},D:{"11":0.00363,"40":0.00363,"41":0.00363,"42":0.00363,"43":0.00726,"45":0.00363,"46":0.00363,"47":0.00363,"48":0.00363,"49":0.05082,"50":0.00363,"51":0.00363,"52":0.00363,"53":0.02904,"54":0.00363,"55":0.00363,"56":0.00363,"57":0.00363,"58":0.00363,"59":0.00363,"60":0.00363,"64":0.01452,"65":0.00363,"68":0.00363,"69":0.00363,"70":0.00363,"71":0.00726,"72":0.00726,"75":0.00363,"76":0.01452,"77":0.00363,"78":0.01452,"79":0.52272,"81":0.00363,"83":0.02178,"84":0.00363,"86":0.00363,"87":0.30855,"88":0.02904,"89":0.00726,"90":0.00726,"91":0.02178,"92":0.00726,"93":0.00726,"94":0.09801,"95":0.00726,"96":0.00726,"97":0.00363,"98":0.01452,"99":0.00726,"100":0.00363,"103":0.01815,"104":0.07986,"105":0.00363,"106":0.0363,"107":0.00363,"108":0.02541,"109":2.58456,"110":0.00726,"111":0.03993,"112":0.01089,"114":0.02541,"115":0.00726,"116":0.0363,"118":0.00726,"119":0.06534,"120":0.0363,"121":0.03993,"122":0.0726,"123":0.04719,"124":0.10527,"125":0.03993,"126":0.05082,"127":0.0363,"128":0.04356,"129":0.09075,"130":0.07623,"131":0.28677,"132":0.46101,"133":6.41784,"134":14.4474,"135":0.01089,"136":0.00363,_:"4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 44 61 62 63 66 67 73 74 80 85 101 102 113 117 137 138"},F:{"28":0.00363,"36":0.00363,"40":0.01452,"46":0.08712,"87":0.01452,"88":0.00726,"89":0.00726,"95":0.08349,"96":0.00363,"101":0.00363,"114":0.00363,"115":0.06171,"116":0.42834,"117":1.38303,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 37 38 39 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 90 91 92 93 94 97 98 99 100 102 103 104 105 106 107 108 109 110 111 112 113 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"18":0.00363,"92":0.01089,"106":0.00363,"108":0.00726,"109":0.0363,"114":0.01089,"121":0.00363,"122":0.01089,"125":0.00363,"126":0.00726,"129":0.01452,"130":0.00726,"131":0.05445,"132":0.03993,"133":0.62799,"134":1.47741,_:"12 13 14 15 16 17 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 107 110 111 112 113 115 116 117 118 119 120 123 124 127 128"},E:{_:"0 4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 17.0","12.1":0.01815,"13.1":0.01089,"14.1":0.01089,"15.1":0.00363,"15.2-15.3":0.01089,"15.4":0.00363,"15.5":0.00726,"15.6":0.13431,"16.0":0.01815,"16.1":0.00726,"16.2":0.01089,"16.3":0.01089,"16.4":0.00363,"16.5":0.00363,"16.6":0.07623,"17.1":0.04719,"17.2":0.00363,"17.3":0.00726,"17.4":0.15246,"17.5":0.02178,"17.6":0.07986,"18.0":0.00363,"18.1":0.04356,"18.2":0.01452,"18.3":0.37389,"18.4":0.01452},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00194,"5.0-5.1":0,"6.0-6.1":0.00581,"7.0-7.1":0.00387,"8.1-8.4":0,"9.0-9.2":0.0029,"9.3":0.01355,"10.0-10.2":0.00097,"10.3":0.02225,"11.0-11.2":0.10257,"11.3-11.4":0.00677,"12.0-12.1":0.00387,"12.2-12.5":0.09579,"13.0-13.1":0.00194,"13.2":0.0029,"13.3":0.00387,"13.4-13.7":0.01355,"14.0-14.4":0.03387,"14.5-14.8":0.04064,"15.0-15.1":0.02225,"15.2-15.3":0.02225,"15.4":0.02709,"15.5":0.03096,"15.6-15.8":0.38124,"16.0":0.05419,"16.1":0.11127,"16.2":0.05806,"16.3":0.10063,"16.4":0.02225,"16.5":0.04161,"16.6-16.7":0.45187,"17.0":0.02709,"17.1":0.04838,"17.2":0.03677,"17.3":0.05128,"17.4":0.10257,"17.5":0.22835,"17.6-17.7":0.66281,"18.0":0.18578,"18.1":0.60765,"18.2":0.2719,"18.3":5.68273,"18.4":0.08418},P:{"4":0.56347,"20":0.02049,"21":0.03073,"22":0.03073,"23":0.0922,"24":0.07171,"25":0.05122,"26":0.12294,"27":3.28863,"5.0-5.4":0.07171,"6.2-6.4":0.13318,"7.2-7.4":0.16392,_:"8.2 9.2 10.1 11.1-11.2 12.0 14.0 15.0 16.0 18.0","13.0":0.01024,"17.0":0.01024,"19.0":0.02049},I:{"0":0.22248,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00007,"4.4":0,"4.4.3-4.4.4":0.00025},K:{"0":0.20384,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.00726,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.15288},Q:{_:"14.9"},O:{"0":0.00637},H:{"0":0},L:{"0":49.60346}};
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "simple-concat",
|
||||
"description": "Super-minimalist version of `concat-stream`. Less than 15 lines!",
|
||||
"version": "1.0.1",
|
||||
"author": {
|
||||
"name": "Feross Aboukhadijeh",
|
||||
"email": "feross@feross.org",
|
||||
"url": "https://feross.org"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/feross/simple-concat/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"standard": "*",
|
||||
"tape": "^5.0.1"
|
||||
},
|
||||
"homepage": "https://github.com/feross/simple-concat",
|
||||
"keywords": [
|
||||
"concat",
|
||||
"concat-stream",
|
||||
"concat stream"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/feross/simple-concat.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && tape test/*.js"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"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","2":"C L M G N O P"},C:{"1":"0 9 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":"1 2 3 4 5 6 7 8 nC LC 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 qC rC","194":"0B 1B 2B"},D:{"1":"0 9 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 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"},E:{"1":"M G 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":"J PB K D E F A B C L sC SC tC uC vC wC TC FC GC xC"},F:{"1":"0 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 3 4 5 6 7 8 F 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 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"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","2":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD"},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:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 hD TC iD jD kD lD mD IC JC KC nD","2":"J dD eD fD gD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"rD","2":"qD"}},B:6,C:"BigInt",D:true};
|
||||
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toPrimitive;
|
||||
function toPrimitive(input, hint) {
|
||||
if (typeof input !== "object" || !input) return input;
|
||||
var prim = input[Symbol.toPrimitive];
|
||||
if (prim !== undefined) {
|
||||
var res = prim.call(input, hint || "default");
|
||||
if (typeof res !== "object") return res;
|
||||
throw new TypeError("@@toPrimitive must return a primitive value.");
|
||||
}
|
||||
return (hint === "string" ? String : Number)(input);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=toPrimitive.js.map
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @fileoverview Rule to check for ambiguous div operator in regexes
|
||||
* @author Matt DuVall <http://www.mattduvall.com>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Disallow equal signs explicitly at the beginning of regular expressions",
|
||||
recommended: false,
|
||||
frozen: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-div-regex",
|
||||
},
|
||||
|
||||
fixable: "code",
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
unexpected:
|
||||
"A regular expression literal can be confused with '/='.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
return {
|
||||
Literal(node) {
|
||||
const token = sourceCode.getFirstToken(node);
|
||||
|
||||
if (
|
||||
token.type === "RegularExpression" &&
|
||||
token.value[1] === "="
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "unexpected",
|
||||
fix(fixer) {
|
||||
return fixer.replaceTextRange(
|
||||
[token.range[0] + 1, token.range[0] + 2],
|
||||
"[=]",
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"B","2":"K D E F A mC"},B:{"1":"C L M G N O P","2":"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"},C:{"2":"0 1 2 3 4 5 6 7 8 9 nC LC 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 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 qC rC"},D:{"2":"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:{"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 IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C"},F:{"2":"0 1 2 3 4 5 6 7 8 F 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 4C 5C 6C 7C FC kC 8C GC"},G:{"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 IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"2":"WD"},I:{"2":"LC J I XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"2":"A B C H FC kC GC"},L:{"2":"I"},M:{"2":"EC"},N:{"1":"B","2":"A"},O:{"2":"HC"},P:{"2":"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:{"2":"oD"},R:{"2":"pD"},S:{"2":"qD rD"}},B:7,C:"Resource Hints: Lazyload",D:true};
|
||||
@@ -0,0 +1,65 @@
|
||||
import { FromPathOption, NavigateOptions, PathParamOptions, SearchParamOptions, ToPathOption } from './link.cjs';
|
||||
import { Redirect } from './redirect.cjs';
|
||||
import { RouteIds } from './routeInfo.cjs';
|
||||
import { AnyRouter, RegisteredRouter } from './router.cjs';
|
||||
import { UseParamsResult } from './useParams.cjs';
|
||||
import { UseSearchResult } from './useSearch.cjs';
|
||||
import { Constrain, ConstrainLiteral } from './utils.cjs';
|
||||
export type ValidateFromPath<TRouter extends AnyRouter = RegisteredRouter, TFrom = string> = FromPathOption<TRouter, TFrom>;
|
||||
export type ValidateToPath<TRouter extends AnyRouter = RegisteredRouter, TTo extends string | undefined = undefined, TFrom extends string = string> = ToPathOption<TRouter, TFrom, TTo>;
|
||||
export type ValidateSearch<TRouter extends AnyRouter = RegisteredRouter, TTo extends string | undefined = undefined, TFrom extends string = string> = SearchParamOptions<TRouter, TFrom, TTo>;
|
||||
export type ValidateParams<TRouter extends AnyRouter = RegisteredRouter, TTo extends string | undefined = undefined, TFrom extends string = string> = PathParamOptions<TRouter, TFrom, TTo>;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InferFrom<TOptions, TDefaultFrom extends string = string> = TOptions extends {
|
||||
from: infer TFrom extends string;
|
||||
} ? TFrom : TDefaultFrom;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InferTo<TOptions> = TOptions extends {
|
||||
to: infer TTo extends string;
|
||||
} ? TTo : undefined;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InferMaskTo<TOptions> = TOptions extends {
|
||||
mask: {
|
||||
to: infer TTo extends string;
|
||||
};
|
||||
} ? TTo : '';
|
||||
export type InferMaskFrom<TOptions> = TOptions extends {
|
||||
mask: {
|
||||
from: infer TFrom extends string;
|
||||
};
|
||||
} ? TFrom : string;
|
||||
export type ValidateNavigateOptions<TRouter extends AnyRouter = RegisteredRouter, TOptions = unknown, TDefaultFrom extends string = string> = Constrain<TOptions, NavigateOptions<TRouter, InferFrom<TOptions, TDefaultFrom>, InferTo<TOptions>, InferMaskFrom<TOptions>, InferMaskTo<TOptions>>>;
|
||||
export type ValidateNavigateOptionsArray<TRouter extends AnyRouter = RegisteredRouter, TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>, TDefaultFrom extends string = string> = {
|
||||
[K in keyof TOptions]: ValidateNavigateOptions<TRouter, TOptions[K], TDefaultFrom>;
|
||||
};
|
||||
export type ValidateRedirectOptions<TRouter extends AnyRouter = RegisteredRouter, TOptions = unknown, TDefaultFrom extends string = string> = Constrain<TOptions, Redirect<TRouter, InferFrom<TOptions, TDefaultFrom>, InferTo<TOptions>, InferMaskFrom<TOptions>, InferMaskTo<TOptions>>>;
|
||||
export type ValidateRedirectOptionsArray<TRouter extends AnyRouter = RegisteredRouter, TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>, TDefaultFrom extends string = string> = {
|
||||
[K in keyof TOptions]: ValidateRedirectOptions<TRouter, TOptions[K], TDefaultFrom>;
|
||||
};
|
||||
export type ValidateId<TRouter extends AnyRouter = RegisteredRouter, TId extends string = string> = ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InferStrict<TOptions> = TOptions extends {
|
||||
strict: infer TStrict extends boolean;
|
||||
} ? TStrict : true;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InferShouldThrow<TOptions> = TOptions extends {
|
||||
shouldThrow: infer TShouldThrow extends boolean;
|
||||
} ? TShouldThrow : true;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type InferSelected<TOptions> = TOptions extends {
|
||||
select: (...args: Array<any>) => infer TSelected;
|
||||
} ? TSelected : unknown;
|
||||
export type ValidateUseSearchResult<TOptions, TRouter extends AnyRouter = RegisteredRouter> = UseSearchResult<TRouter, InferFrom<TOptions>, InferStrict<TOptions>, InferSelected<TOptions>>;
|
||||
export type ValidateUseParamsResult<TOptions, TRouter extends AnyRouter = RegisteredRouter> = Constrain<TOptions, UseParamsResult<TRouter, InferFrom<TOptions>, InferStrict<TOptions>, InferSelected<TOptions>>>;
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_typeof","obj","Symbol","iterator","exports","default","constructor","prototype"],"sources":["../../src/helpers/typeof.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nexport default function _typeof(\n obj: unknown,\n):\n | \"string\"\n | \"number\"\n | \"bigint\"\n | \"boolean\"\n | \"symbol\"\n | \"undefined\"\n | \"object\"\n | \"function\" {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n // @ts-expect-error -- deliberate re-defining typeof\n _typeof = function (obj: unknown) {\n return typeof obj;\n };\n } else {\n // @ts-expect-error -- deliberate re-defining typeof\n _typeof = function (obj: unknown) {\n return obj &&\n typeof Symbol === \"function\" &&\n obj.constructor === Symbol &&\n obj !== Symbol.prototype\n ? \"symbol\"\n : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n"],"mappings":";;;;;;AAEe,SAASA,OAAOA,CAC7BC,GAAY,EASC;EACb,yBAAyB;;EAEzB,IAAI,OAAOC,MAAM,KAAK,UAAU,IAAI,OAAOA,MAAM,CAACC,QAAQ,KAAK,QAAQ,EAAE;IAEvEC,OAAA,CAAAC,OAAA,GAAAL,OAAO,GAAG,SAAAA,CAAUC,GAAY,EAAE;MAChC,OAAO,OAAOA,GAAG;IACnB,CAAC;EACH,CAAC,MAAM;IAELG,OAAA,CAAAC,OAAA,GAAAL,OAAO,GAAG,SAAAA,CAAUC,GAAY,EAAE;MAChC,OAAOA,GAAG,IACR,OAAOC,MAAM,KAAK,UAAU,IAC5BD,GAAG,CAACK,WAAW,KAAKJ,MAAM,IAC1BD,GAAG,KAAKC,MAAM,CAACK,SAAS,GACtB,QAAQ,GACR,OAAON,GAAG;IAChB,CAAC;EACH;EAEA,OAAOD,OAAO,CAACC,GAAG,CAAC;AACrB","ignoreList":[]}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_gensync","data","require","_index","_index2","fs","transformFileRunner","gensync","filename","opts","options","Object","assign","config","loadConfig","code","readFile","run","transformFile","args","errback","transformFileSync","sync","transformFileAsync","async"],"sources":["../src/transform-file.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config/index.ts\";\nimport type { InputOptions, ResolvedConfig } from \"./config/index.ts\";\nimport { run } from \"./transformation/index.ts\";\nimport type { FileResult, FileResultCallback } from \"./transformation/index.ts\";\nimport * as fs from \"./gensync-utils/fs.ts\";\n\ntype transformFileBrowserType = typeof import(\"./transform-file-browser\");\ntype transformFileType = typeof import(\"./transform-file\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of transform-file-browser, since this file may be replaced at bundle time with\n// transform-file-browser.\n({}) as any as transformFileBrowserType as transformFileType;\n\nconst transformFileRunner = gensync(function* (\n filename: string,\n opts?: InputOptions,\n): Handler<FileResult | null> {\n const options = { ...opts, filename };\n\n const config: ResolvedConfig | null = yield* loadConfig(options);\n if (config === null) return null;\n\n const code = yield* fs.readFile(filename, \"utf8\");\n return yield* run(config, code);\n});\n\n// @ts-expect-error TS doesn't detect that this signature is compatible\nexport function transformFile(\n filename: string,\n callback: FileResultCallback,\n): void;\nexport function transformFile(\n filename: string,\n opts: InputOptions | undefined | null,\n callback: FileResultCallback,\n): void;\nexport function transformFile(\n ...args: Parameters<typeof transformFileRunner.errback>\n) {\n transformFileRunner.errback(...args);\n}\n\nexport function transformFileSync(\n ...args: Parameters<typeof transformFileRunner.sync>\n) {\n return transformFileRunner.sync(...args);\n}\nexport function transformFileAsync(\n ...args: Parameters<typeof transformFileRunner.async>\n) {\n return transformFileRunner.async(...args);\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAE,MAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,EAAA,GAAAH,OAAA;AAQA,CAAC,CAAC,CAAC;AAEH,MAAMI,mBAAmB,GAAGC,SAAMA,CAAC,CAAC,WAClCC,QAAgB,EAChBC,IAAmB,EACS;EAC5B,MAAMC,OAAO,GAAAC,MAAA,CAAAC,MAAA,KAAQH,IAAI;IAAED;EAAQ,EAAE;EAErC,MAAMK,MAA6B,GAAG,OAAO,IAAAC,cAAU,EAACJ,OAAO,CAAC;EAChE,IAAIG,MAAM,KAAK,IAAI,EAAE,OAAO,IAAI;EAEhC,MAAME,IAAI,GAAG,OAAOV,EAAE,CAACW,QAAQ,CAACR,QAAQ,EAAE,MAAM,CAAC;EACjD,OAAO,OAAO,IAAAS,WAAG,EAACJ,MAAM,EAAEE,IAAI,CAAC;AACjC,CAAC,CAAC;AAYK,SAASG,aAAaA,CAC3B,GAAGC,IAAoD,EACvD;EACAb,mBAAmB,CAACc,OAAO,CAAC,GAAGD,IAAI,CAAC;AACtC;AAEO,SAASE,iBAAiBA,CAC/B,GAAGF,IAAiD,EACpD;EACA,OAAOb,mBAAmB,CAACgB,IAAI,CAAC,GAAGH,IAAI,CAAC;AAC1C;AACO,SAASI,kBAAkBA,CAChC,GAAGJ,IAAkD,EACrD;EACA,OAAOb,mBAAmB,CAACkB,KAAK,CAAC,GAAGL,IAAI,CAAC;AAC3C;AAAC","ignoreList":[]}
|
||||
@@ -0,0 +1,18 @@
|
||||
const { dirname, resolve } = require('path');
|
||||
const { readdirSync, statSync } = require('fs');
|
||||
|
||||
module.exports = function (start, callback) {
|
||||
let dir = resolve('.', start);
|
||||
let tmp, stats = statSync(dir);
|
||||
|
||||
if (!stats.isDirectory()) {
|
||||
dir = dirname(dir);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
tmp = callback(dir, readdirSync(dir));
|
||||
if (tmp) return resolve(dir, tmp);
|
||||
dir = dirname(tmp = dir);
|
||||
if (tmp === dir) break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user