update
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
|
||||
var n = 'rc'+Math.random()
|
||||
var assert = require('assert')
|
||||
|
||||
process.env[n+'_envOption'] = 42
|
||||
|
||||
var config = require('../')(n, {
|
||||
option: true
|
||||
})
|
||||
|
||||
console.log(config)
|
||||
|
||||
assert.equal(config.option, true)
|
||||
assert.equal(config.envOption, 42)
|
||||
|
||||
var customArgv = require('../')(n, {
|
||||
option: true
|
||||
}, { // nopt-like argv
|
||||
option: false,
|
||||
envOption: 24,
|
||||
argv: {
|
||||
remain: [],
|
||||
cooked: ['--no-option', '--envOption', '24'],
|
||||
original: ['--no-option', '--envOption=24']
|
||||
}
|
||||
})
|
||||
|
||||
console.log(customArgv)
|
||||
|
||||
assert.equal(customArgv.option, false)
|
||||
assert.equal(customArgv.envOption, 24)
|
||||
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var jsonrc = path.resolve('.' + n + 'rc');
|
||||
|
||||
fs.writeFileSync(jsonrc, [
|
||||
'{',
|
||||
'// json overrides default',
|
||||
'"option": false,',
|
||||
'/* env overrides json */',
|
||||
'"envOption": 24',
|
||||
'}'
|
||||
].join('\n'));
|
||||
|
||||
var commentedJSON = require('../')(n, {
|
||||
option: true
|
||||
})
|
||||
|
||||
fs.unlinkSync(jsonrc);
|
||||
|
||||
console.log(commentedJSON)
|
||||
|
||||
assert.equal(commentedJSON.option, false)
|
||||
assert.equal(commentedJSON.envOption, 42)
|
||||
|
||||
assert.equal(commentedJSON.config, jsonrc)
|
||||
assert.equal(commentedJSON.configs.length, 1)
|
||||
assert.equal(commentedJSON.configs[0], jsonrc)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
module.exports={A:{D:{"2":"J PB K D E F A B C L M G N","33":"0 1 2 3 4 5 6 7 8 9 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"},L:{"33":"I"},B:{"2":"C L M G N O P","33":"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:{"1":"0 9 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 qC rC","33":"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"},M:{"1":"EC"},A:{"2":"K D E F A B mC"},F:{"2":"F B C 4C 5C 6C 7C FC kC 8C GC","33":"0 1 2 3 4 5 6 7 8 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"},K:{"2":"A B C FC kC GC","33":"H"},E:{"1":"VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC","2":"J PB sC SC tC 3C","33":"K D E F A B C L M G uC vC wC TC FC GC xC yC zC UC"},G:{"1":"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","33":"E BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC"},P:{"33":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},I:{"2":"LC J XD YD ZD aD lC","33":"I bD cD"}},B:6,C:"print-color-adjust property",D:undefined};
|
||||
@@ -0,0 +1,223 @@
|
||||
{
|
||||
"name": "eslint",
|
||||
"version": "9.23.0",
|
||||
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
||||
"description": "An AST-based pattern checker for JavaScript.",
|
||||
"type": "commonjs",
|
||||
"bin": {
|
||||
"eslint": "./bin/eslint.js"
|
||||
},
|
||||
"main": "./lib/api.js",
|
||||
"types": "./lib/types/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./lib/types/index.d.ts",
|
||||
"default": "./lib/api.js"
|
||||
},
|
||||
"./config": {
|
||||
"types": "./lib/types/config-api.d.ts",
|
||||
"default": "./lib/config-api.js"
|
||||
},
|
||||
"./package.json": "./package.json",
|
||||
"./use-at-your-own-risk": {
|
||||
"types": "./lib/types/use-at-your-own-risk.d.ts",
|
||||
"default": "./lib/unsupported-api.js"
|
||||
},
|
||||
"./rules": {
|
||||
"types": "./lib/types/rules.d.ts"
|
||||
},
|
||||
"./universal": {
|
||||
"types": "./lib/types/universal.d.ts",
|
||||
"default": "./lib/universal.js"
|
||||
}
|
||||
},
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"use-at-your-own-risk": [
|
||||
"./lib/types/use-at-your-own-risk.d.ts"
|
||||
],
|
||||
"rules": [
|
||||
"./lib/types/rules.d.ts"
|
||||
],
|
||||
"universal": [
|
||||
"./lib/types/universal.d.ts"
|
||||
],
|
||||
"config": [
|
||||
"./lib/types/config-api.d.ts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build:docs:update-links": "node tools/fetch-docs-links.js",
|
||||
"build:site": "node Makefile.js gensite",
|
||||
"build:webpack": "node Makefile.js webpack",
|
||||
"build:readme": "node tools/update-readme.js",
|
||||
"build:rules-index": "node Makefile.js generateRuleIndexPage",
|
||||
"lint": "trunk check --no-fix --ignore=docs/**/*.js -a --filter=eslint && trunk check --no-fix --ignore=docs/**/*.js",
|
||||
"lint:docs:js": "trunk check --no-fix --ignore=** --ignore=!docs/**/*.js -a --filter=eslint && trunk check --no-fix --ignore=** --ignore=!docs/**/*.js",
|
||||
"lint:docs:rule-examples": "node Makefile.js checkRuleExamples",
|
||||
"lint:unused": "knip",
|
||||
"lint:fix": "trunk check -y --ignore=docs/**/*.js -a --filter=eslint && trunk check -y --ignore=docs/**/*.js",
|
||||
"lint:fix:docs:js": "trunk check -y --ignore=** --ignore=!docs/**/*.js -a --flter=eslint && trunk check -y --ignore=** --ignore=!docs/**/*.js",
|
||||
"lint:rule-types": "node tools/update-rule-type-headers.js --check",
|
||||
"lint:types": "attw --pack",
|
||||
"release:generate:alpha": "node Makefile.js generatePrerelease -- alpha",
|
||||
"release:generate:beta": "node Makefile.js generatePrerelease -- beta",
|
||||
"release:generate:latest": "node Makefile.js generateRelease -- latest",
|
||||
"release:generate:maintenance": "node Makefile.js generateRelease -- maintenance",
|
||||
"release:generate:rc": "node Makefile.js generatePrerelease -- rc",
|
||||
"release:publish": "node Makefile.js publishRelease",
|
||||
"test": "node Makefile.js test",
|
||||
"test:browser": "node Makefile.js cypress",
|
||||
"test:cli": "mocha",
|
||||
"test:fuzz": "node Makefile.js fuzz",
|
||||
"test:performance": "node Makefile.js perf",
|
||||
"test:emfile": "node tools/check-emfile-handling.js",
|
||||
"test:types": "tsc -p tests/lib/types/tsconfig.json"
|
||||
},
|
||||
"gitHooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*": "trunk check --fix",
|
||||
"lib/rules/*.js": [
|
||||
"node tools/update-eslint-all.js",
|
||||
"node tools/update-rule-type-headers.js",
|
||||
"git add packages/js/src/configs/eslint-all.js lib/types/rules.d.ts"
|
||||
],
|
||||
"docs/src/rules/*.md": [
|
||||
"node tools/check-rule-examples.js",
|
||||
"node tools/fetch-docs-links.js",
|
||||
"git add docs/src/_data/further_reading_links.json"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"bin",
|
||||
"conf",
|
||||
"lib",
|
||||
"messages"
|
||||
],
|
||||
"repository": "eslint/eslint",
|
||||
"funding": "https://eslint.org/donate",
|
||||
"homepage": "https://eslint.org",
|
||||
"bugs": "https://github.com/eslint/eslint/issues/",
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.12.1",
|
||||
"@eslint/config-array": "^0.19.2",
|
||||
"@eslint/config-helpers": "^0.2.0",
|
||||
"@eslint/core": "^0.12.0",
|
||||
"@eslint/eslintrc": "^3.3.1",
|
||||
"@eslint/js": "9.23.0",
|
||||
"@eslint/plugin-kit": "^0.2.7",
|
||||
"@humanfs/node": "^0.16.6",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@humanwhocodes/retry": "^0.4.2",
|
||||
"@types/estree": "^1.0.6",
|
||||
"@types/json-schema": "^7.0.15",
|
||||
"ajv": "^6.12.4",
|
||||
"chalk": "^4.0.0",
|
||||
"cross-spawn": "^7.0.6",
|
||||
"debug": "^4.3.2",
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"eslint-scope": "^8.3.0",
|
||||
"eslint-visitor-keys": "^4.2.0",
|
||||
"espree": "^10.3.0",
|
||||
"esquery": "^1.5.0",
|
||||
"esutils": "^2.0.2",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"file-entry-cache": "^8.0.0",
|
||||
"find-up": "^5.0.0",
|
||||
"glob-parent": "^6.0.2",
|
||||
"ignore": "^5.2.0",
|
||||
"imurmurhash": "^0.1.4",
|
||||
"is-glob": "^4.0.0",
|
||||
"json-stable-stringify-without-jsonify": "^1.0.1",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"minimatch": "^3.1.2",
|
||||
"natural-compare": "^1.4.0",
|
||||
"optionator": "^0.9.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@arethetypeswrong/cli": "^0.17.0",
|
||||
"@babel/core": "^7.4.3",
|
||||
"@babel/preset-env": "^7.4.3",
|
||||
"@cypress/webpack-preprocessor": "^6.0.2",
|
||||
"@eslint/json": "^0.11.0",
|
||||
"@trunkio/launcher": "^1.3.0",
|
||||
"@types/node": "^20.11.5",
|
||||
"@typescript-eslint/parser": "^8.4.0",
|
||||
"babel-loader": "^8.0.5",
|
||||
"c8": "^7.12.0",
|
||||
"chai": "^4.0.1",
|
||||
"cheerio": "^0.22.0",
|
||||
"common-tags": "^1.8.0",
|
||||
"core-js": "^3.1.3",
|
||||
"cypress": "^14.1.0",
|
||||
"ejs": "^3.0.2",
|
||||
"eslint": "file:.",
|
||||
"eslint-config-eslint": "file:packages/eslint-config-eslint",
|
||||
"eslint-plugin-eslint-plugin": "^6.0.0",
|
||||
"eslint-plugin-expect-type": "^0.6.0",
|
||||
"eslint-plugin-yml": "^1.14.0",
|
||||
"eslint-release": "^3.3.0",
|
||||
"eslint-rule-composer": "^0.3.0",
|
||||
"eslump": "^3.0.0",
|
||||
"esprima": "^4.0.1",
|
||||
"fast-glob": "^3.2.11",
|
||||
"fs-teardown": "^0.1.3",
|
||||
"glob": "^10.0.0",
|
||||
"globals": "^15.0.0",
|
||||
"got": "^11.8.3",
|
||||
"gray-matter": "^4.0.3",
|
||||
"jiti": "^2.1.0",
|
||||
"knip": "^5.32.0",
|
||||
"lint-staged": "^11.0.0",
|
||||
"load-perf": "^0.2.0",
|
||||
"markdown-it": "^12.2.0",
|
||||
"markdown-it-container": "^3.0.0",
|
||||
"marked": "^4.0.8",
|
||||
"metascraper": "^5.25.7",
|
||||
"metascraper-description": "^5.25.7",
|
||||
"metascraper-image": "^5.29.3",
|
||||
"metascraper-logo": "^5.25.7",
|
||||
"metascraper-logo-favicon": "^5.25.7",
|
||||
"metascraper-title": "^5.25.7",
|
||||
"mocha": "^10.7.3",
|
||||
"node-polyfill-webpack-plugin": "^1.0.3",
|
||||
"npm-license": "^0.3.3",
|
||||
"pirates": "^4.0.5",
|
||||
"progress": "^2.0.3",
|
||||
"proxyquire": "^2.0.1",
|
||||
"recast": "^0.23.0",
|
||||
"regenerator-runtime": "^0.14.0",
|
||||
"semver": "^7.5.3",
|
||||
"shelljs": "^0.9.0",
|
||||
"sinon": "^11.0.0",
|
||||
"typescript": "^5.3.3",
|
||||
"webpack": "^5.23.0",
|
||||
"webpack-cli": "^4.5.0",
|
||||
"yorkie": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"jiti": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"jiti": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"ast",
|
||||
"lint",
|
||||
"javascript",
|
||||
"ecmascript",
|
||||
"espree"
|
||||
],
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
const version = "10.3.0";
|
||||
|
||||
export default version;
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the
|
||||
* index of the `key` in the backing array.
|
||||
*
|
||||
* This is designed to allow synchronizing a second array with the contents of the backing array,
|
||||
* like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`,
|
||||
* and there are never duplicates.
|
||||
*/
|
||||
class SetArray {
|
||||
constructor() {
|
||||
this._indexes = { __proto__: null };
|
||||
this.array = [];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Typescript doesn't allow friend access to private fields, so this just casts the set into a type
|
||||
* with public access modifiers.
|
||||
*/
|
||||
function cast(set) {
|
||||
return set;
|
||||
}
|
||||
/**
|
||||
* Gets the index associated with `key` in the backing array, if it is already present.
|
||||
*/
|
||||
function get(setarr, key) {
|
||||
return cast(setarr)._indexes[key];
|
||||
}
|
||||
/**
|
||||
* Puts `key` into the backing array, if it is not already present. Returns
|
||||
* the index of the `key` in the backing array.
|
||||
*/
|
||||
function put(setarr, key) {
|
||||
// The key may or may not be present. If it is present, it's a number.
|
||||
const index = get(setarr, key);
|
||||
if (index !== undefined)
|
||||
return index;
|
||||
const { array, _indexes: indexes } = cast(setarr);
|
||||
const length = array.push(key);
|
||||
return (indexes[key] = length - 1);
|
||||
}
|
||||
/**
|
||||
* Pops the last added item out of the SetArray.
|
||||
*/
|
||||
function pop(setarr) {
|
||||
const { array, _indexes: indexes } = cast(setarr);
|
||||
if (array.length === 0)
|
||||
return;
|
||||
const last = array.pop();
|
||||
indexes[last] = undefined;
|
||||
}
|
||||
/**
|
||||
* Removes the key, if it exists in the set.
|
||||
*/
|
||||
function remove(setarr, key) {
|
||||
const index = get(setarr, key);
|
||||
if (index === undefined)
|
||||
return;
|
||||
const { array, _indexes: indexes } = cast(setarr);
|
||||
for (let i = index + 1; i < array.length; i++) {
|
||||
const k = array[i];
|
||||
array[i - 1] = k;
|
||||
indexes[k]--;
|
||||
}
|
||||
indexes[key] = undefined;
|
||||
array.pop();
|
||||
}
|
||||
|
||||
export { SetArray, get, pop, put, remove };
|
||||
//# sourceMappingURL=set-array.mjs.map
|
||||
@@ -0,0 +1,180 @@
|
||||
import invariant from 'tiny-invariant';
|
||||
import warning from 'warning';
|
||||
|
||||
import type { PDFPageProxy } from 'pdfjs-dist';
|
||||
import type { PageCallback } from './types.js';
|
||||
|
||||
/**
|
||||
* Checks if we're running in a browser environment.
|
||||
*/
|
||||
export const isBrowser: boolean = typeof window !== 'undefined';
|
||||
|
||||
/**
|
||||
* Checks whether we're running from a local file system.
|
||||
*/
|
||||
export const isLocalFileSystem: boolean = isBrowser && window.location.protocol === 'file:';
|
||||
|
||||
/**
|
||||
* Checks whether a variable is defined.
|
||||
*
|
||||
* @param {*} variable Variable to check
|
||||
*/
|
||||
export function isDefined<T>(variable: T | undefined): variable is T {
|
||||
return typeof variable !== 'undefined';
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a variable is defined and not null.
|
||||
*
|
||||
* @param {*} variable Variable to check
|
||||
*/
|
||||
export function isProvided<T>(variable: T | null | undefined): variable is T {
|
||||
return isDefined(variable) && variable !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a variable provided is a string.
|
||||
*
|
||||
* @param {*} variable Variable to check
|
||||
*/
|
||||
export function isString(variable: unknown): variable is string {
|
||||
return typeof variable === 'string';
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a variable provided is an ArrayBuffer.
|
||||
*
|
||||
* @param {*} variable Variable to check
|
||||
*/
|
||||
export function isArrayBuffer(variable: unknown): variable is ArrayBuffer {
|
||||
return variable instanceof ArrayBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a variable provided is a Blob.
|
||||
*
|
||||
* @param {*} variable Variable to check
|
||||
*/
|
||||
export function isBlob(variable: unknown): variable is Blob {
|
||||
invariant(isBrowser, 'isBlob can only be used in a browser environment');
|
||||
|
||||
return variable instanceof Blob;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a variable provided is a data URI.
|
||||
*
|
||||
* @param {*} variable String to check
|
||||
*/
|
||||
export function isDataURI(variable: unknown): variable is `data:${string}` {
|
||||
return isString(variable) && /^data:/.test(variable);
|
||||
}
|
||||
|
||||
export function dataURItoByteString(dataURI: unknown): string {
|
||||
invariant(isDataURI(dataURI), 'Invalid data URI.');
|
||||
|
||||
const [headersString = '', dataString = ''] = dataURI.split(',');
|
||||
const headers = headersString.split(';');
|
||||
|
||||
if (headers.indexOf('base64') !== -1) {
|
||||
return atob(dataString);
|
||||
}
|
||||
|
||||
return unescape(dataString);
|
||||
}
|
||||
|
||||
export function getDevicePixelRatio(): number {
|
||||
return (isBrowser && window.devicePixelRatio) || 1;
|
||||
}
|
||||
|
||||
const allowFileAccessFromFilesTip =
|
||||
'On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.';
|
||||
|
||||
export function displayCORSWarning(): void {
|
||||
warning(
|
||||
!isLocalFileSystem,
|
||||
`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${allowFileAccessFromFilesTip}`,
|
||||
);
|
||||
}
|
||||
|
||||
export function displayWorkerWarning(): void {
|
||||
warning(
|
||||
!isLocalFileSystem,
|
||||
`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${allowFileAccessFromFilesTip}`,
|
||||
);
|
||||
}
|
||||
|
||||
export function cancelRunningTask(runningTask?: { cancel?: () => void } | null): void {
|
||||
if (runningTask?.cancel) runningTask.cancel();
|
||||
}
|
||||
|
||||
export function makePageCallback(page: PDFPageProxy, scale: number): PageCallback {
|
||||
Object.defineProperty(page, 'width', {
|
||||
get() {
|
||||
return this.view[2] * scale;
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
Object.defineProperty(page, 'height', {
|
||||
get() {
|
||||
return this.view[3] * scale;
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
Object.defineProperty(page, 'originalWidth', {
|
||||
get() {
|
||||
return this.view[2];
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
Object.defineProperty(page, 'originalHeight', {
|
||||
get() {
|
||||
return this.view[3];
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
return page as PageCallback;
|
||||
}
|
||||
|
||||
export function isCancelException(error: Error): boolean {
|
||||
return error.name === 'RenderingCancelledException';
|
||||
}
|
||||
|
||||
export function loadFromFile(file: Blob): Promise<ArrayBuffer> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = () => {
|
||||
if (!reader.result) {
|
||||
return reject(new Error('Error while reading a file.'));
|
||||
}
|
||||
|
||||
resolve(reader.result as ArrayBuffer);
|
||||
};
|
||||
|
||||
reader.onerror = (event) => {
|
||||
if (!event.target) {
|
||||
return reject(new Error('Error while reading a file.'));
|
||||
}
|
||||
|
||||
const { error } = event.target;
|
||||
|
||||
if (!error) {
|
||||
return reject(new Error('Error while reading a file.'));
|
||||
}
|
||||
|
||||
switch (error.code) {
|
||||
case error.NOT_FOUND_ERR:
|
||||
return reject(new Error('Error while reading a file: File not found.'));
|
||||
case error.SECURITY_ERR:
|
||||
return reject(new Error('Error while reading a file: Security error.'));
|
||||
case error.ABORT_ERR:
|
||||
return reject(new Error('Error while reading a file: Aborted.'));
|
||||
default:
|
||||
return reject(new Error('Error while reading a file.'));
|
||||
}
|
||||
};
|
||||
|
||||
reader.readAsArrayBuffer(file);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @fileoverview Assertion utilities.
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
/**
|
||||
* Throws an error if the given condition is not truthy.
|
||||
* @param {boolean} condition The condition to check.
|
||||
* @param {string} message The message to include with the error.
|
||||
* @returns {void}
|
||||
* @throws {Error} When the condition is not truthy.
|
||||
*/
|
||||
export function assert(condition, message = "Assertion failed.") {
|
||||
if (!condition) {
|
||||
throw new Error(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "@eslint/plugin-kit",
|
||||
"version": "0.2.8",
|
||||
"description": "Utilities for building ESLint plugins.",
|
||||
"author": "Nicholas C. Zakas",
|
||||
"type": "module",
|
||||
"main": "dist/esm/index.js",
|
||||
"types": "dist/esm/index.d.ts",
|
||||
"exports": {
|
||||
"require": {
|
||||
"types": "./dist/cjs/index.d.cts",
|
||||
"default": "./dist/cjs/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/eslint/rewrite.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint/rewrite/issues"
|
||||
},
|
||||
"homepage": "https://github.com/eslint/rewrite#readme",
|
||||
"scripts": {
|
||||
"build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js",
|
||||
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
|
||||
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts",
|
||||
"pretest": "npm run build",
|
||||
"test": "mocha tests/",
|
||||
"test:coverage": "c8 npm test",
|
||||
"test:jsr": "npx jsr@latest publish --dry-run",
|
||||
"test:types": "tsc -p tests/types/tsconfig.json"
|
||||
},
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"eslintplugin",
|
||||
"eslint-plugin"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@eslint/core": "^0.13.0",
|
||||
"levn": "^0.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/levn": "^0.4.0",
|
||||
"c8": "^9.1.0",
|
||||
"mocha": "^10.4.0",
|
||||
"rollup": "^4.16.2",
|
||||
"rollup-plugin-copy": "^3.5.0",
|
||||
"typescript": "^5.4.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
* See LICENSE file in root directory for full license.
|
||||
*/
|
||||
import KEYS from "./visitor-keys.js";
|
||||
|
||||
/**
|
||||
* @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys
|
||||
*/
|
||||
|
||||
// List to ignore keys.
|
||||
const KEY_BLACKLIST = new Set([
|
||||
"parent",
|
||||
"leadingComments",
|
||||
"trailingComments"
|
||||
]);
|
||||
|
||||
/**
|
||||
* Check whether a given key should be used or not.
|
||||
* @param {string} key The key to check.
|
||||
* @returns {boolean} `true` if the key should be used.
|
||||
*/
|
||||
function filterKey(key) {
|
||||
return !KEY_BLACKLIST.has(key) && key[0] !== "_";
|
||||
}
|
||||
|
||||
|
||||
/* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.
|
||||
TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed
|
||||
*/
|
||||
/**
|
||||
* Get visitor keys of a given node.
|
||||
* @param {Object} node The AST node to get keys.
|
||||
* @returns {readonly string[]} Visitor keys of the node.
|
||||
*/
|
||||
export function getKeys(node) {
|
||||
return Object.keys(node).filter(filterKey);
|
||||
}
|
||||
/* eslint-enable jsdoc/valid-types -- doesn't allow `readonly` */
|
||||
|
||||
/**
|
||||
* Make the union set with `KEYS` and given keys.
|
||||
* @param {VisitorKeys} additionalKeys The additional keys.
|
||||
* @returns {VisitorKeys} The union set.
|
||||
*/
|
||||
export function unionWith(additionalKeys) {
|
||||
const retv = /** @type {{ [type: string]: ReadonlyArray<string> }} */
|
||||
(Object.assign({}, KEYS));
|
||||
|
||||
for (const type of Object.keys(additionalKeys)) {
|
||||
if (Object.hasOwn(retv, type)) {
|
||||
const keys = new Set(additionalKeys[type]);
|
||||
|
||||
for (const key of retv[type]) {
|
||||
keys.add(key);
|
||||
}
|
||||
|
||||
retv[type] = Object.freeze(Array.from(keys));
|
||||
} else {
|
||||
retv[type] = Object.freeze(Array.from(additionalKeys[type]));
|
||||
}
|
||||
}
|
||||
|
||||
return Object.freeze(retv);
|
||||
}
|
||||
|
||||
export { KEYS };
|
||||
@@ -0,0 +1,354 @@
|
||||
var chownr = require('chownr')
|
||||
var tar = require('tar-stream')
|
||||
var pump = require('pump')
|
||||
var mkdirp = require('mkdirp-classic')
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var os = require('os')
|
||||
|
||||
var win32 = os.platform() === 'win32'
|
||||
|
||||
var noop = function () {}
|
||||
|
||||
var echo = function (name) {
|
||||
return name
|
||||
}
|
||||
|
||||
var normalize = !win32 ? echo : function (name) {
|
||||
return name.replace(/\\/g, '/').replace(/[:?<>|]/g, '_')
|
||||
}
|
||||
|
||||
var statAll = function (fs, stat, cwd, ignore, entries, sort) {
|
||||
var queue = entries || ['.']
|
||||
|
||||
return function loop (callback) {
|
||||
if (!queue.length) return callback()
|
||||
var next = queue.shift()
|
||||
var nextAbs = path.join(cwd, next)
|
||||
|
||||
stat.call(fs, nextAbs, function (err, stat) {
|
||||
if (err) return callback(err)
|
||||
|
||||
if (!stat.isDirectory()) return callback(null, next, stat)
|
||||
|
||||
fs.readdir(nextAbs, function (err, files) {
|
||||
if (err) return callback(err)
|
||||
|
||||
if (sort) files.sort()
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
if (!ignore(path.join(cwd, next, files[i]))) queue.push(path.join(next, files[i]))
|
||||
}
|
||||
|
||||
callback(null, next, stat)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var strip = function (map, level) {
|
||||
return function (header) {
|
||||
header.name = header.name.split('/').slice(level).join('/')
|
||||
|
||||
var linkname = header.linkname
|
||||
if (linkname && (header.type === 'link' || path.isAbsolute(linkname))) {
|
||||
header.linkname = linkname.split('/').slice(level).join('/')
|
||||
}
|
||||
|
||||
return map(header)
|
||||
}
|
||||
}
|
||||
|
||||
exports.pack = function (cwd, opts) {
|
||||
if (!cwd) cwd = '.'
|
||||
if (!opts) opts = {}
|
||||
|
||||
var xfs = opts.fs || fs
|
||||
var ignore = opts.ignore || opts.filter || noop
|
||||
var map = opts.map || noop
|
||||
var mapStream = opts.mapStream || echo
|
||||
var statNext = statAll(xfs, opts.dereference ? xfs.stat : xfs.lstat, cwd, ignore, opts.entries, opts.sort)
|
||||
var strict = opts.strict !== false
|
||||
var umask = typeof opts.umask === 'number' ? ~opts.umask : ~processUmask()
|
||||
var dmode = typeof opts.dmode === 'number' ? opts.dmode : 0
|
||||
var fmode = typeof opts.fmode === 'number' ? opts.fmode : 0
|
||||
var pack = opts.pack || tar.pack()
|
||||
var finish = opts.finish || noop
|
||||
|
||||
if (opts.strip) map = strip(map, opts.strip)
|
||||
|
||||
if (opts.readable) {
|
||||
dmode |= parseInt(555, 8)
|
||||
fmode |= parseInt(444, 8)
|
||||
}
|
||||
if (opts.writable) {
|
||||
dmode |= parseInt(333, 8)
|
||||
fmode |= parseInt(222, 8)
|
||||
}
|
||||
|
||||
var onsymlink = function (filename, header) {
|
||||
xfs.readlink(path.join(cwd, filename), function (err, linkname) {
|
||||
if (err) return pack.destroy(err)
|
||||
header.linkname = normalize(linkname)
|
||||
pack.entry(header, onnextentry)
|
||||
})
|
||||
}
|
||||
|
||||
var onstat = function (err, filename, stat) {
|
||||
if (err) return pack.destroy(err)
|
||||
if (!filename) {
|
||||
if (opts.finalize !== false) pack.finalize()
|
||||
return finish(pack)
|
||||
}
|
||||
|
||||
if (stat.isSocket()) return onnextentry() // tar does not support sockets...
|
||||
|
||||
var header = {
|
||||
name: normalize(filename),
|
||||
mode: (stat.mode | (stat.isDirectory() ? dmode : fmode)) & umask,
|
||||
mtime: stat.mtime,
|
||||
size: stat.size,
|
||||
type: 'file',
|
||||
uid: stat.uid,
|
||||
gid: stat.gid
|
||||
}
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
header.size = 0
|
||||
header.type = 'directory'
|
||||
header = map(header) || header
|
||||
return pack.entry(header, onnextentry)
|
||||
}
|
||||
|
||||
if (stat.isSymbolicLink()) {
|
||||
header.size = 0
|
||||
header.type = 'symlink'
|
||||
header = map(header) || header
|
||||
return onsymlink(filename, header)
|
||||
}
|
||||
|
||||
// TODO: add fifo etc...
|
||||
|
||||
header = map(header) || header
|
||||
|
||||
if (!stat.isFile()) {
|
||||
if (strict) return pack.destroy(new Error('unsupported type for ' + filename))
|
||||
return onnextentry()
|
||||
}
|
||||
|
||||
var entry = pack.entry(header, onnextentry)
|
||||
if (!entry) return
|
||||
|
||||
var rs = mapStream(xfs.createReadStream(path.join(cwd, filename), { start: 0, end: header.size > 0 ? header.size - 1 : header.size }), header)
|
||||
|
||||
rs.on('error', function (err) { // always forward errors on destroy
|
||||
entry.destroy(err)
|
||||
})
|
||||
|
||||
pump(rs, entry)
|
||||
}
|
||||
|
||||
var onnextentry = function (err) {
|
||||
if (err) return pack.destroy(err)
|
||||
statNext(onstat)
|
||||
}
|
||||
|
||||
onnextentry()
|
||||
|
||||
return pack
|
||||
}
|
||||
|
||||
var head = function (list) {
|
||||
return list.length ? list[list.length - 1] : null
|
||||
}
|
||||
|
||||
var processGetuid = function () {
|
||||
return process.getuid ? process.getuid() : -1
|
||||
}
|
||||
|
||||
var processUmask = function () {
|
||||
return process.umask ? process.umask() : 0
|
||||
}
|
||||
|
||||
exports.extract = function (cwd, opts) {
|
||||
if (!cwd) cwd = '.'
|
||||
if (!opts) opts = {}
|
||||
|
||||
var xfs = opts.fs || fs
|
||||
var ignore = opts.ignore || opts.filter || noop
|
||||
var map = opts.map || noop
|
||||
var mapStream = opts.mapStream || echo
|
||||
var own = opts.chown !== false && !win32 && processGetuid() === 0
|
||||
var extract = opts.extract || tar.extract()
|
||||
var stack = []
|
||||
var now = new Date()
|
||||
var umask = typeof opts.umask === 'number' ? ~opts.umask : ~processUmask()
|
||||
var dmode = typeof opts.dmode === 'number' ? opts.dmode : 0
|
||||
var fmode = typeof opts.fmode === 'number' ? opts.fmode : 0
|
||||
var strict = opts.strict !== false
|
||||
|
||||
if (opts.strip) map = strip(map, opts.strip)
|
||||
|
||||
if (opts.readable) {
|
||||
dmode |= parseInt(555, 8)
|
||||
fmode |= parseInt(444, 8)
|
||||
}
|
||||
if (opts.writable) {
|
||||
dmode |= parseInt(333, 8)
|
||||
fmode |= parseInt(222, 8)
|
||||
}
|
||||
|
||||
var utimesParent = function (name, cb) { // we just set the mtime on the parent dir again everytime we write an entry
|
||||
var top
|
||||
while ((top = head(stack)) && name.slice(0, top[0].length) !== top[0]) stack.pop()
|
||||
if (!top) return cb()
|
||||
xfs.utimes(top[0], now, top[1], cb)
|
||||
}
|
||||
|
||||
var utimes = function (name, header, cb) {
|
||||
if (opts.utimes === false) return cb()
|
||||
|
||||
if (header.type === 'directory') return xfs.utimes(name, now, header.mtime, cb)
|
||||
if (header.type === 'symlink') return utimesParent(name, cb) // TODO: how to set mtime on link?
|
||||
|
||||
xfs.utimes(name, now, header.mtime, function (err) {
|
||||
if (err) return cb(err)
|
||||
utimesParent(name, cb)
|
||||
})
|
||||
}
|
||||
|
||||
var chperm = function (name, header, cb) {
|
||||
var link = header.type === 'symlink'
|
||||
|
||||
/* eslint-disable node/no-deprecated-api */
|
||||
var chmod = link ? xfs.lchmod : xfs.chmod
|
||||
var chown = link ? xfs.lchown : xfs.chown
|
||||
/* eslint-enable node/no-deprecated-api */
|
||||
|
||||
if (!chmod) return cb()
|
||||
|
||||
var mode = (header.mode | (header.type === 'directory' ? dmode : fmode)) & umask
|
||||
|
||||
if (chown && own) chown.call(xfs, name, header.uid, header.gid, onchown)
|
||||
else onchown(null)
|
||||
|
||||
function onchown (err) {
|
||||
if (err) return cb(err)
|
||||
if (!chmod) return cb()
|
||||
chmod.call(xfs, name, mode, cb)
|
||||
}
|
||||
}
|
||||
|
||||
extract.on('entry', function (header, stream, next) {
|
||||
header = map(header) || header
|
||||
header.name = normalize(header.name)
|
||||
var name = path.join(cwd, path.join('/', header.name))
|
||||
|
||||
if (ignore(name, header)) {
|
||||
stream.resume()
|
||||
return next()
|
||||
}
|
||||
|
||||
var stat = function (err) {
|
||||
if (err) return next(err)
|
||||
utimes(name, header, function (err) {
|
||||
if (err) return next(err)
|
||||
if (win32) return next()
|
||||
chperm(name, header, next)
|
||||
})
|
||||
}
|
||||
|
||||
var onsymlink = function () {
|
||||
if (win32) return next() // skip symlinks on win for now before it can be tested
|
||||
xfs.unlink(name, function () {
|
||||
var dst = path.resolve(path.dirname(name), header.linkname)
|
||||
if (!dst.startsWith(path.resolve(cwd))) return next(new Error(name + ' is not a valid symlink'))
|
||||
|
||||
xfs.symlink(header.linkname, name, stat)
|
||||
})
|
||||
}
|
||||
|
||||
var onlink = function () {
|
||||
if (win32) return next() // skip links on win for now before it can be tested
|
||||
xfs.unlink(name, function () {
|
||||
var srcpath = path.join(cwd, path.join('/', header.linkname))
|
||||
|
||||
xfs.link(srcpath, name, function (err) {
|
||||
if (err && err.code === 'EPERM' && opts.hardlinkAsFilesFallback) {
|
||||
stream = xfs.createReadStream(srcpath)
|
||||
return onfile()
|
||||
}
|
||||
|
||||
stat(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
var onfile = function () {
|
||||
var ws = xfs.createWriteStream(name)
|
||||
var rs = mapStream(stream, header)
|
||||
|
||||
ws.on('error', function (err) { // always forward errors on destroy
|
||||
rs.destroy(err)
|
||||
})
|
||||
|
||||
pump(rs, ws, function (err) {
|
||||
if (err) return next(err)
|
||||
ws.on('close', stat)
|
||||
})
|
||||
}
|
||||
|
||||
if (header.type === 'directory') {
|
||||
stack.push([name, header.mtime])
|
||||
return mkdirfix(name, {
|
||||
fs: xfs, own: own, uid: header.uid, gid: header.gid
|
||||
}, stat)
|
||||
}
|
||||
|
||||
var dir = path.dirname(name)
|
||||
|
||||
validate(xfs, dir, path.join(cwd, '.'), function (err, valid) {
|
||||
if (err) return next(err)
|
||||
if (!valid) return next(new Error(dir + ' is not a valid path'))
|
||||
|
||||
mkdirfix(dir, {
|
||||
fs: xfs, own: own, uid: header.uid, gid: header.gid
|
||||
}, function (err) {
|
||||
if (err) return next(err)
|
||||
|
||||
switch (header.type) {
|
||||
case 'file': return onfile()
|
||||
case 'link': return onlink()
|
||||
case 'symlink': return onsymlink()
|
||||
}
|
||||
|
||||
if (strict) return next(new Error('unsupported type for ' + name + ' (' + header.type + ')'))
|
||||
|
||||
stream.resume()
|
||||
next()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
if (opts.finish) extract.on('finish', opts.finish)
|
||||
|
||||
return extract
|
||||
}
|
||||
|
||||
function validate (fs, name, root, cb) {
|
||||
if (name === root) return cb(null, true)
|
||||
fs.lstat(name, function (err, st) {
|
||||
if (err && err.code !== 'ENOENT') return cb(err)
|
||||
if (err || st.isDirectory()) return validate(fs, path.join(name, '..'), root, cb)
|
||||
cb(null, false)
|
||||
})
|
||||
}
|
||||
|
||||
function mkdirfix (name, opts, cb) {
|
||||
mkdirp(name, { fs: opts.fs }, function (err, made) {
|
||||
if (!err && made && opts.own) {
|
||||
chownr(made, opts.uid, opts.gid, cb)
|
||||
} else {
|
||||
cb(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _temporalUndefined;
|
||||
function _temporalUndefined() {}
|
||||
|
||||
//# sourceMappingURL=temporalUndefined.js.map
|
||||
Binary file not shown.
@@ -0,0 +1,10 @@
|
||||
import { StructuralSharingOption, ValidateSelected } from './structuralSharing.js';
|
||||
import { AnyRouter, MakeRouteMatch, MakeRouteMatchUnion, RegisteredRouter, StrictOrFrom, ThrowConstraint, ThrowOrOptional } from '@tanstack/router-core';
|
||||
export interface UseMatchBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TThrow extends boolean, TSelected, TStructuralSharing extends boolean> {
|
||||
select?: (match: MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict>) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
|
||||
shouldThrow?: TThrow;
|
||||
}
|
||||
export type UseMatchRoute<out TFrom> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseMatchBaseOptions<TRouter, TFrom, true, true, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>) => UseMatchResult<TRouter, TFrom, true, TSelected>;
|
||||
export type UseMatchOptions<TRouter extends AnyRouter, TFrom extends string | undefined, TStrict extends boolean, TThrow extends boolean, TSelected, TStructuralSharing extends boolean> = StrictOrFrom<TRouter, TFrom, TStrict> & UseMatchBaseOptions<TRouter, TFrom, TStrict, TThrow, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>;
|
||||
export type UseMatchResult<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected> = unknown extends TSelected ? TStrict extends true ? MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict> : MakeRouteMatchUnion<TRouter> : TSelected;
|
||||
export declare function useMatch<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TStrict extends boolean = true, TThrow extends boolean = true, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts: UseMatchOptions<TRouter, TFrom, TStrict, ThrowConstraint<TStrict, TThrow>, TSelected, TStructuralSharing>): ThrowOrOptional<UseMatchResult<TRouter, TFrom, TStrict, TSelected>, TThrow>;
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "tiny-warning",
|
||||
"version": "1.0.3",
|
||||
"keywords": [
|
||||
"warning",
|
||||
"warn"
|
||||
],
|
||||
"description": "A tiny warning function",
|
||||
"main": "dist/tiny-warning.cjs.js",
|
||||
"module": "dist/tiny-warning.esm.js",
|
||||
"types": "src/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"/dist",
|
||||
"/src"
|
||||
],
|
||||
"author": "Alex Reardon <alexreardon@gmail.com>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/alexreardon/tiny-warning.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/alexreardon/tiny-warning/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "yarn jest",
|
||||
"lint": "yarn prettier --debug-check src/** test/**",
|
||||
"typecheck": "yarn flow",
|
||||
"validate": "yarn lint && yarn flow",
|
||||
"build:clean": "rimraf dist",
|
||||
"build:flow": "echo \"// @flow\n\nexport * from '../src';\" > dist/tiny-warning.cjs.js.flow",
|
||||
"build:dist": "yarn rollup --config rollup.config.js",
|
||||
"build": "yarn build:clean && yarn build:dist && yarn build:flow",
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.5.0",
|
||||
"@babel/preset-env": "^7.5.0",
|
||||
"@babel/preset-flow": "^7.0.0",
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"babel-jest": "^24.8.0",
|
||||
"flow-bin": "0.102.0",
|
||||
"jest": "^24.8.0",
|
||||
"prettier": "1.18.2",
|
||||
"regenerator-runtime": "^0.13.2",
|
||||
"rimraf": "^2.6.3",
|
||||
"rollup": "^1.16.6",
|
||||
"rollup-plugin-babel": "^4.3.3",
|
||||
"rollup-plugin-replace": "^2.2.0",
|
||||
"rollup-plugin-uglify": "^6.0.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.TokenMap = void 0;
|
||||
var _t = require("@babel/types");
|
||||
const {
|
||||
traverseFast,
|
||||
VISITOR_KEYS
|
||||
} = _t;
|
||||
class TokenMap {
|
||||
constructor(ast, tokens, source) {
|
||||
this._tokens = void 0;
|
||||
this._source = void 0;
|
||||
this._nodesToTokenIndexes = new Map();
|
||||
this._nodesOccurrencesCountCache = new Map();
|
||||
this._tokensCache = new Map();
|
||||
this._tokens = tokens;
|
||||
this._source = source;
|
||||
traverseFast(ast, node => {
|
||||
const indexes = this._getTokensIndexesOfNode(node);
|
||||
if (indexes.length > 0) this._nodesToTokenIndexes.set(node, indexes);
|
||||
});
|
||||
this._tokensCache = null;
|
||||
}
|
||||
has(node) {
|
||||
return this._nodesToTokenIndexes.has(node);
|
||||
}
|
||||
getIndexes(node) {
|
||||
return this._nodesToTokenIndexes.get(node);
|
||||
}
|
||||
find(node, condition) {
|
||||
const indexes = this._nodesToTokenIndexes.get(node);
|
||||
if (indexes) {
|
||||
for (let k = 0; k < indexes.length; k++) {
|
||||
const index = indexes[k];
|
||||
const tok = this._tokens[index];
|
||||
if (condition(tok, index)) return tok;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
findLastIndex(node, condition) {
|
||||
const indexes = this._nodesToTokenIndexes.get(node);
|
||||
if (indexes) {
|
||||
for (let k = indexes.length - 1; k >= 0; k--) {
|
||||
const index = indexes[k];
|
||||
const tok = this._tokens[index];
|
||||
if (condition(tok, index)) return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
findMatching(node, test, occurrenceCount = 0) {
|
||||
const indexes = this._nodesToTokenIndexes.get(node);
|
||||
if (indexes) {
|
||||
let i = 0;
|
||||
const count = occurrenceCount;
|
||||
if (count > 1) {
|
||||
const cache = this._nodesOccurrencesCountCache.get(node);
|
||||
if (cache && cache.test === test && cache.count < count) {
|
||||
i = cache.i + 1;
|
||||
occurrenceCount -= cache.count + 1;
|
||||
}
|
||||
}
|
||||
for (; i < indexes.length; i++) {
|
||||
const tok = this._tokens[indexes[i]];
|
||||
if (this.matchesOriginal(tok, test)) {
|
||||
if (occurrenceCount === 0) {
|
||||
if (count > 0) {
|
||||
this._nodesOccurrencesCountCache.set(node, {
|
||||
test,
|
||||
count,
|
||||
i
|
||||
});
|
||||
}
|
||||
return tok;
|
||||
}
|
||||
occurrenceCount--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
matchesOriginal(token, test) {
|
||||
if (token.end - token.start !== test.length) return false;
|
||||
if (token.value != null) return token.value === test;
|
||||
return this._source.startsWith(test, token.start);
|
||||
}
|
||||
startMatches(node, test) {
|
||||
const indexes = this._nodesToTokenIndexes.get(node);
|
||||
if (!indexes) return false;
|
||||
const tok = this._tokens[indexes[0]];
|
||||
if (tok.start !== node.start) return false;
|
||||
return this.matchesOriginal(tok, test);
|
||||
}
|
||||
endMatches(node, test) {
|
||||
const indexes = this._nodesToTokenIndexes.get(node);
|
||||
if (!indexes) return false;
|
||||
const tok = this._tokens[indexes[indexes.length - 1]];
|
||||
if (tok.end !== node.end) return false;
|
||||
return this.matchesOriginal(tok, test);
|
||||
}
|
||||
_getTokensIndexesOfNode(node) {
|
||||
if (node.start == null || node.end == null) return [];
|
||||
const {
|
||||
first,
|
||||
last
|
||||
} = this._findTokensOfNode(node, 0, this._tokens.length - 1);
|
||||
let low = first;
|
||||
const children = childrenIterator(node);
|
||||
if ((node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration") && node.declaration && node.declaration.type === "ClassDeclaration") {
|
||||
children.next();
|
||||
}
|
||||
const indexes = [];
|
||||
for (const child of children) {
|
||||
if (child == null) continue;
|
||||
if (child.start == null || child.end == null) continue;
|
||||
const childTok = this._findTokensOfNode(child, low, last);
|
||||
const high = childTok.first;
|
||||
for (let k = low; k < high; k++) indexes.push(k);
|
||||
low = childTok.last + 1;
|
||||
}
|
||||
for (let k = low; k <= last; k++) indexes.push(k);
|
||||
return indexes;
|
||||
}
|
||||
_findTokensOfNode(node, low, high) {
|
||||
const cached = this._tokensCache.get(node);
|
||||
if (cached) return cached;
|
||||
const first = this._findFirstTokenOfNode(node.start, low, high);
|
||||
const last = this._findLastTokenOfNode(node.end, first, high);
|
||||
this._tokensCache.set(node, {
|
||||
first,
|
||||
last
|
||||
});
|
||||
return {
|
||||
first,
|
||||
last
|
||||
};
|
||||
}
|
||||
_findFirstTokenOfNode(start, low, high) {
|
||||
while (low <= high) {
|
||||
const mid = high + low >> 1;
|
||||
if (start < this._tokens[mid].start) {
|
||||
high = mid - 1;
|
||||
} else if (start > this._tokens[mid].start) {
|
||||
low = mid + 1;
|
||||
} else {
|
||||
return mid;
|
||||
}
|
||||
}
|
||||
return low;
|
||||
}
|
||||
_findLastTokenOfNode(end, low, high) {
|
||||
while (low <= high) {
|
||||
const mid = high + low >> 1;
|
||||
if (end < this._tokens[mid].end) {
|
||||
high = mid - 1;
|
||||
} else if (end > this._tokens[mid].end) {
|
||||
low = mid + 1;
|
||||
} else {
|
||||
return mid;
|
||||
}
|
||||
}
|
||||
return high;
|
||||
}
|
||||
}
|
||||
exports.TokenMap = TokenMap;
|
||||
function* childrenIterator(node) {
|
||||
if (node.type === "TemplateLiteral") {
|
||||
yield node.quasis[0];
|
||||
for (let i = 1; i < node.quasis.length; i++) {
|
||||
yield node.expressions[i - 1];
|
||||
yield node.quasis[i];
|
||||
}
|
||||
return;
|
||||
}
|
||||
const keys = VISITOR_KEYS[node.type];
|
||||
for (const key of keys) {
|
||||
const child = node[key];
|
||||
if (!child) continue;
|
||||
if (Array.isArray(child)) {
|
||||
yield* child;
|
||||
} else {
|
||||
yield child;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=token-map.js.map
|
||||
@@ -0,0 +1,18 @@
|
||||
export class OptionalContentConfig {
|
||||
constructor(data: any, renderingIntent?: number);
|
||||
renderingIntent: number;
|
||||
name: any;
|
||||
creator: any;
|
||||
isVisible(group: any): any;
|
||||
setVisibility(id: any, visible?: boolean, preserveRB?: boolean): void;
|
||||
setOCGState({ state, preserveRB }: {
|
||||
state: any;
|
||||
preserveRB: any;
|
||||
}): void;
|
||||
get hasInitialVisibility(): boolean;
|
||||
getOrder(): any;
|
||||
getGroups(): any;
|
||||
getGroup(id: any): any;
|
||||
getHash(): string;
|
||||
#private;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"48":0.00669,"52":0.02342,"61":0.00335,"71":0.00335,"78":0.00669,"87":0.00335,"102":0.00335,"107":0.00669,"108":0.00335,"111":0.00335,"113":0.00335,"114":0.00335,"115":0.46496,"118":0.00335,"119":0.00335,"120":0.58872,"125":0.01004,"126":0.00335,"127":0.00669,"128":0.07359,"129":0.00669,"130":0.00335,"131":0.01004,"132":0.00669,"133":0.01338,"134":0.03011,"135":0.63221,"136":2.3783,"137":0.00335,_:"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 49 50 51 53 54 55 56 57 58 59 60 62 63 64 65 66 67 68 69 70 72 73 74 75 76 77 79 80 81 82 83 84 85 86 88 89 90 91 92 93 94 95 96 97 98 99 100 101 103 104 105 106 109 110 112 116 117 121 122 123 124 138 139 140 3.5 3.6"},D:{"34":0.01004,"38":0.01673,"41":0.00335,"49":0.00669,"53":0.01004,"69":0.00335,"73":0.00335,"79":0.13715,"84":0.00335,"87":0.07694,"88":0.01338,"91":0.00335,"94":0.01004,"95":0.00335,"96":0.00335,"100":0.00669,"102":0.00335,"103":0.02342,"104":0.02007,"106":0.00335,"107":0.00669,"108":0.03011,"109":1.12392,"110":0.00335,"111":0.01004,"112":0.00669,"113":0.00335,"114":0.01673,"115":0.00669,"116":0.0368,"117":0.00335,"118":0.01673,"119":0.02007,"120":0.07025,"121":0.02342,"122":0.05352,"123":0.01338,"124":0.03345,"125":0.01338,"126":0.03011,"127":0.02007,"128":0.06356,"129":0.02676,"130":0.04683,"131":0.17394,"132":0.52517,"133":6.06114,"134":12.06542,"135":0.01673,"136":0.00335,_:"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 35 36 37 39 40 42 43 44 45 46 47 48 50 51 52 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 70 71 72 74 75 76 77 78 80 81 83 85 86 89 90 92 93 97 98 99 101 105 137 138"},F:{"46":0.00669,"79":0.00335,"85":0.00335,"86":0.00669,"87":0.01673,"88":0.00335,"95":0.07694,"104":0.00335,"105":0.00669,"106":0.04349,"114":0.00335,"115":0.00335,"116":0.21743,"117":1.02357,_:"9 11 12 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 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 80 81 82 83 84 89 90 91 92 93 94 96 97 98 99 100 101 102 103 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:{"92":0.00335,"97":0.00335,"109":0.02342,"120":0.4014,"122":0.00335,"125":0.00335,"126":0.00335,"128":0.00335,"129":0.00669,"130":0.01004,"131":0.02007,"132":0.07359,"133":0.79946,"134":1.94679,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 119 121 123 124 127"},E:{"14":0.00335,_:"0 4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.1","13.1":0.01338,"14.1":0.01004,"15.2-15.3":0.00335,"15.4":0.00335,"15.5":0.00335,"15.6":0.0669,"16.0":0.01673,"16.1":0.00669,"16.2":0.00669,"16.3":0.01338,"16.4":0.00335,"16.5":0.01004,"16.6":0.07359,"17.0":0.00669,"17.1":0.05687,"17.2":0.00669,"17.3":0.01004,"17.4":0.02007,"17.5":0.03011,"17.6":0.12042,"18.0":0.01338,"18.1":0.05018,"18.2":0.05018,"18.3":0.59541,"18.4":0.01338},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00187,"5.0-5.1":0,"6.0-6.1":0.0056,"7.0-7.1":0.00373,"8.1-8.4":0,"9.0-9.2":0.0028,"9.3":0.01307,"10.0-10.2":0.00093,"10.3":0.02148,"11.0-11.2":0.09897,"11.3-11.4":0.00654,"12.0-12.1":0.00373,"12.2-12.5":0.09244,"13.0-13.1":0.00187,"13.2":0.0028,"13.3":0.00373,"13.4-13.7":0.01307,"14.0-14.4":0.03268,"14.5-14.8":0.03922,"15.0-15.1":0.02148,"15.2-15.3":0.02148,"15.4":0.02614,"15.5":0.02988,"15.6-15.8":0.36788,"16.0":0.05229,"16.1":0.10738,"16.2":0.05602,"16.3":0.0971,"16.4":0.02148,"16.5":0.04015,"16.6-16.7":0.43604,"17.0":0.02614,"17.1":0.04668,"17.2":0.03548,"17.3":0.04949,"17.4":0.09897,"17.5":0.22035,"17.6-17.7":0.63958,"18.0":0.17927,"18.1":0.58636,"18.2":0.26237,"18.3":5.4836,"18.4":0.08123},P:{"4":0.15577,"20":0.01038,"21":0.02077,"22":0.03115,"23":0.04154,"24":0.04154,"25":0.03115,"26":0.08308,"27":2.61689,"5.0-5.4":0.01038,"6.2-6.4":0.01038,"7.2-7.4":0.02077,_:"8.2 9.2 10.1 11.1-11.2 12.0 14.0 15.0 16.0 17.0 18.0","13.0":0.01038,"19.0":0.01038},I:{"0":0.09297,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00003,"4.4":0,"4.4.3-4.4.4":0.0001},K:{"0":0.33941,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.01004,_:"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.27951},Q:{_:"14.9"},O:{"0":0.01331},H:{"0":0},L:{"0":54.39711}};
|
||||
@@ -0,0 +1,3 @@
|
||||
àRCopyright 1990-2009 Adobe Systems Incorporated.
|
||||
All rights reserved.
|
||||
See ./LICENSEá ETen-B5-H` ^
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_toIdentifier","require","toBindingIdentifierName","name","toIdentifier"],"sources":["../../src/converters/toBindingIdentifierName.ts"],"sourcesContent":["import toIdentifier from \"./toIdentifier.ts\";\n\nexport default function toBindingIdentifierName(name: string): string {\n name = toIdentifier(name);\n if (name === \"eval\" || name === \"arguments\") name = \"_\" + name;\n\n return name;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAEe,SAASC,uBAAuBA,CAACC,IAAY,EAAU;EACpEA,IAAI,GAAG,IAAAC,qBAAY,EAACD,IAAI,CAAC;EACzB,IAAIA,IAAI,KAAK,MAAM,IAAIA,IAAI,KAAK,WAAW,EAAEA,IAAI,GAAG,GAAG,GAAGA,IAAI;EAE9D,OAAOA,IAAI;AACb","ignoreList":[]}
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"name": "eslint-scope",
|
||||
"description": "ECMAScript scope analyzer for ESLint",
|
||||
"homepage": "https://github.com/eslint/js/blob/main/packages/eslint-scope/README.md",
|
||||
"main": "./dist/eslint-scope.cjs",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./lib/index.js",
|
||||
"require": "./dist/eslint-scope.cjs"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"version": "8.3.0",
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
},
|
||||
"repository": "eslint/js",
|
||||
"funding": "https://opencollective.com/eslint",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint/js/issues"
|
||||
},
|
||||
"license": "BSD-2-Clause",
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"build:update-version": "node tools/update-version.js",
|
||||
"prepublishOnly": "npm run build:update-version && npm run build",
|
||||
"pretest": "npm run build",
|
||||
"release:generate:latest": "eslint-generate-release",
|
||||
"release:generate:alpha": "eslint-generate-prerelease alpha",
|
||||
"release:generate:beta": "eslint-generate-prerelease beta",
|
||||
"release:generate:rc": "eslint-generate-prerelease rc",
|
||||
"release:publish": "eslint-publish-release",
|
||||
"test": "node Makefile.js test"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"lib",
|
||||
"dist/eslint-scope.cjs"
|
||||
],
|
||||
"dependencies": {
|
||||
"esrecurse": "^4.3.0",
|
||||
"estraverse": "^5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/parser": "^8.7.0",
|
||||
"c8": "^7.7.3",
|
||||
"chai": "^4.3.4",
|
||||
"eslint-release": "^3.2.0",
|
||||
"eslint-visitor-keys": "^4.2.0",
|
||||
"espree": "^10.3.0",
|
||||
"mocha": "^9.0.1",
|
||||
"npm-license": "^0.3.3",
|
||||
"rollup": "^2.52.7",
|
||||
"shelljs": "^0.8.5",
|
||||
"typescript": "^5.4.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
# ESLint Core
|
||||
|
||||
## Overview
|
||||
|
||||
This package is the future home of the rewritten, runtime-agnostic ESLint core.
|
||||
|
||||
Right now, it exports the core types necessary to implement language plugins.
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0
|
||||
|
||||
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
|
||||
<!--sponsorsstart-->
|
||||
|
||||
## Sponsors
|
||||
|
||||
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
|
||||
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
|
||||
|
||||
<h3>Platinum Sponsors</h3>
|
||||
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
|
||||
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3>
|
||||
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
|
||||
<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nolebase.ayaka.io"><img src="https://avatars.githubusercontent.com/u/11081491" alt="Neko" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
|
||||
<h3>Technology Sponsors</h3>
|
||||
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
|
||||
<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
|
||||
<!--sponsorsend-->
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
module.exports={A:{D:{"1":"0 9 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 K D E F A B C L M G","33":"1 2 3 4 5 6 7 8 N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB"},L:{"1":"I"},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 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 qC rC","33":"1 2 3 4 5 6 7 8 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"},M:{"1":"EC"},A:{"2":"K D E F A B mC"},F:{"1":"0 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 C 4C 5C 6C 7C FC kC 8C GC","33":"1 2 3 4 5 6 7 8 G N O P QB RB SB TB UB VB WB XB"},K:{"1":"H","2":"A B C FC kC GC"},E:{"1":"B C L M G 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","2":"J PB sC SC tC 3C","33":"K D E F A uC vC wC TC"},G:{"1":"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","33":"E BD CD DD ED FD GD HD"},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"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"}},B:6,C:"isolate from unicode-bidi",D:undefined};
|
||||
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const jsxRuntime = require("react/jsx-runtime");
|
||||
const routerCore = require("@tanstack/router-core");
|
||||
const useRouter = require("./useRouter.cjs");
|
||||
const ScriptOnce = require("./ScriptOnce.cjs");
|
||||
function ScrollRestoration() {
|
||||
const router = useRouter.useRouter();
|
||||
const getKey = router.options.getScrollRestorationKey || routerCore.defaultGetScrollRestorationKey;
|
||||
const userKey = getKey(router.latestLocation);
|
||||
const resolvedKey = userKey !== routerCore.defaultGetScrollRestorationKey(router.latestLocation) ? userKey : null;
|
||||
if (!router.isScrollRestoring || !router.isServer) {
|
||||
return null;
|
||||
}
|
||||
return /* @__PURE__ */ jsxRuntime.jsx(
|
||||
ScriptOnce.ScriptOnce,
|
||||
{
|
||||
children: `(${routerCore.restoreScroll.toString()})(${JSON.stringify(routerCore.storageKey)},${JSON.stringify(resolvedKey)}, undefined, true)`,
|
||||
log: false
|
||||
}
|
||||
);
|
||||
}
|
||||
exports.ScrollRestoration = ScrollRestoration;
|
||||
//# sourceMappingURL=scroll-restoration.cjs.map
|
||||
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _slicedToArray;
|
||||
var _arrayWithHoles = require("./arrayWithHoles.js");
|
||||
var _iterableToArrayLimit = require("./iterableToArrayLimit.js");
|
||||
var _unsupportedIterableToArray = require("./unsupportedIterableToArray.js");
|
||||
var _nonIterableRest = require("./nonIterableRest.js");
|
||||
function _slicedToArray(arr, i) {
|
||||
return (0, _arrayWithHoles.default)(arr) || (0, _iterableToArrayLimit.default)(arr, i) || (0, _unsupportedIterableToArray.default)(arr, i) || (0, _nonIterableRest.default)();
|
||||
}
|
||||
|
||||
//# sourceMappingURL=slicedToArray.js.map
|
||||
@@ -0,0 +1,223 @@
|
||||
/**
|
||||
* @fileoverview Rule that warns when identifier names that are
|
||||
* specified in the configuration are used.
|
||||
* @author Keith Cirkel (http://keithcirkel.co.uk)
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Checks whether the given node represents assignment target in a normal assignment or destructuring.
|
||||
* @param {ASTNode} node The node to check.
|
||||
* @returns {boolean} `true` if the node is assignment target.
|
||||
*/
|
||||
function isAssignmentTarget(node) {
|
||||
const parent = node.parent;
|
||||
|
||||
return (
|
||||
// normal assignment
|
||||
(parent.type === "AssignmentExpression" && parent.left === node) ||
|
||||
// destructuring
|
||||
parent.type === "ArrayPattern" ||
|
||||
parent.type === "RestElement" ||
|
||||
(parent.type === "Property" &&
|
||||
parent.value === node &&
|
||||
parent.parent.type === "ObjectPattern") ||
|
||||
(parent.type === "AssignmentPattern" && parent.left === node)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given node represents an imported name that is renamed in the same import/export specifier.
|
||||
*
|
||||
* Examples:
|
||||
* import { a as b } from 'mod'; // node `a` is renamed import
|
||||
* export { a as b } from 'mod'; // node `a` is renamed import
|
||||
* @param {ASTNode} node `Identifier` node to check.
|
||||
* @returns {boolean} `true` if the node is a renamed import.
|
||||
*/
|
||||
function isRenamedImport(node) {
|
||||
const parent = node.parent;
|
||||
|
||||
return (
|
||||
(parent.type === "ImportSpecifier" &&
|
||||
parent.imported !== parent.local &&
|
||||
parent.imported === node) ||
|
||||
(parent.type === "ExportSpecifier" &&
|
||||
parent.parent.source && // re-export
|
||||
parent.local !== parent.exported &&
|
||||
parent.local === node)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given node is an ObjectPattern destructuring.
|
||||
*
|
||||
* Examples:
|
||||
* const { a : b } = foo;
|
||||
* @param {ASTNode} node `Identifier` node to check.
|
||||
* @returns {boolean} `true` if the node is in an ObjectPattern destructuring.
|
||||
*/
|
||||
function isPropertyNameInDestructuring(node) {
|
||||
const parent = node.parent;
|
||||
|
||||
return (
|
||||
!parent.computed &&
|
||||
parent.type === "Property" &&
|
||||
parent.parent.type === "ObjectPattern" &&
|
||||
parent.key === node
|
||||
);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
defaultOptions: [],
|
||||
|
||||
docs: {
|
||||
description: "Disallow specified identifiers",
|
||||
recommended: false,
|
||||
frozen: true,
|
||||
url: "https://eslint.org/docs/latest/rules/id-denylist",
|
||||
},
|
||||
|
||||
schema: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
},
|
||||
uniqueItems: true,
|
||||
},
|
||||
messages: {
|
||||
restricted: "Identifier '{{name}}' is restricted.",
|
||||
restrictedPrivate: "Identifier '#{{name}}' is restricted.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const denyList = new Set(context.options);
|
||||
const reportedNodes = new Set();
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
let globalScope;
|
||||
|
||||
/**
|
||||
* Checks whether the given name is restricted.
|
||||
* @param {string} name The name to check.
|
||||
* @returns {boolean} `true` if the name is restricted.
|
||||
* @private
|
||||
*/
|
||||
function isRestricted(name) {
|
||||
return denyList.has(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given node represents a reference to a global variable that is not declared in the source code.
|
||||
* These identifiers will be allowed, as it is assumed that user has no control over the names of external global variables.
|
||||
* @param {ASTNode} node `Identifier` node to check.
|
||||
* @returns {boolean} `true` if the node is a reference to a global variable.
|
||||
*/
|
||||
function isReferenceToGlobalVariable(node) {
|
||||
const variable = globalScope.set.get(node.name);
|
||||
|
||||
return (
|
||||
variable &&
|
||||
variable.defs.length === 0 &&
|
||||
variable.references.some(ref => ref.identifier === node)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the given node should be checked.
|
||||
* @param {ASTNode} node `Identifier` node.
|
||||
* @returns {boolean} `true` if the node should be checked.
|
||||
*/
|
||||
function shouldCheck(node) {
|
||||
// Import attributes are defined by environments, so naming conventions shouldn't apply to them
|
||||
if (astUtils.isImportAttributeKey(node)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const parent = node.parent;
|
||||
|
||||
/*
|
||||
* Member access has special rules for checking property names.
|
||||
* Read access to a property with a restricted name is allowed, because it can be on an object that user has no control over.
|
||||
* Write access isn't allowed, because it potentially creates a new property with a restricted name.
|
||||
*/
|
||||
if (
|
||||
parent.type === "MemberExpression" &&
|
||||
parent.property === node &&
|
||||
!parent.computed
|
||||
) {
|
||||
return isAssignmentTarget(parent);
|
||||
}
|
||||
|
||||
return (
|
||||
parent.type !== "CallExpression" &&
|
||||
parent.type !== "NewExpression" &&
|
||||
!isRenamedImport(node) &&
|
||||
!isPropertyNameInDestructuring(node) &&
|
||||
!isReferenceToGlobalVariable(node)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an AST node as a rule violation.
|
||||
* @param {ASTNode} node The node to report.
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function report(node) {
|
||||
/*
|
||||
* We used the range instead of the node because it's possible
|
||||
* for the same identifier to be represented by two different
|
||||
* nodes, with the most clear example being shorthand properties:
|
||||
* { foo }
|
||||
* In this case, "foo" is represented by one node for the name
|
||||
* and one for the value. The only way to know they are the same
|
||||
* is to look at the range.
|
||||
*/
|
||||
if (!reportedNodes.has(node.range.toString())) {
|
||||
const isPrivate = node.type === "PrivateIdentifier";
|
||||
|
||||
context.report({
|
||||
node,
|
||||
messageId: isPrivate ? "restrictedPrivate" : "restricted",
|
||||
data: {
|
||||
name: node.name,
|
||||
},
|
||||
});
|
||||
reportedNodes.add(node.range.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
Program(node) {
|
||||
globalScope = sourceCode.getScope(node);
|
||||
},
|
||||
|
||||
[["Identifier", "PrivateIdentifier"]](node) {
|
||||
if (isRestricted(node.name) && shouldCheck(node)) {
|
||||
report(node);
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 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';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/react-compiler-runtime.production.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/react-compiler-runtime.development.js');
|
||||
}
|
||||
Reference in New Issue
Block a user