update
This commit is contained in:
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_arrayWithHoles","require","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","_slicedToArray","arr","i","arrayWithHoles","iterableToArrayLimit","unsupportedIterableToArray","nonIterableRest"],"sources":["../../src/helpers/slicedToArray.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nimport arrayWithHoles from \"./arrayWithHoles.ts\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.ts\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.ts\";\n// @ts-expect-error nonIterableRest is still being converted to TS.\nimport nonIterableRest from \"./nonIterableRest.ts\";\n\nexport default function _slicedToArray<T>(arr: any, i: number): T[] {\n return (\n arrayWithHoles<T>(arr) ||\n iterableToArrayLimit<T>(arr, i) ||\n unsupportedIterableToArray<T>(arr, i) ||\n nonIterableRest()\n );\n}\n"],"mappings":";;;;;;AAEA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,2BAAA,GAAAF,OAAA;AAEA,IAAAG,gBAAA,GAAAH,OAAA;AAEe,SAASI,cAAcA,CAAIC,GAAQ,EAAEC,CAAS,EAAO;EAClE,OACE,IAAAC,uBAAc,EAAIF,GAAG,CAAC,IACtB,IAAAG,6BAAoB,EAAIH,GAAG,EAAEC,CAAC,CAAC,IAC/B,IAAAG,mCAA0B,EAAIJ,GAAG,EAAEC,CAAC,CAAC,IACrC,IAAAI,wBAAe,EAAC,CAAC;AAErB","ignoreList":[]}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "@babel/types",
|
||||
"version": "7.27.0",
|
||||
"description": "Babel Types is a Lodash-esque utility library for AST nodes",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-types",
|
||||
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20types%22+is%3Aopen",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-types"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-string-parser": "^7.25.9",
|
||||
"@babel/helper-validator-identifier": "^7.25.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/generator": "^7.27.0",
|
||||
"@babel/parser": "^7.27.0",
|
||||
"glob": "^7.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"types": "./lib/index-legacy.d.ts",
|
||||
"typesVersions": {
|
||||
">=4.1": {
|
||||
"lib/index-legacy.d.ts": [
|
||||
"lib/index.d.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"useLoaderDeps.js","sources":["../../src/useLoaderDeps.tsx"],"sourcesContent":["import { useMatch } from './useMatch'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\nimport type {\n AnyRouter,\n RegisteredRouter,\n ResolveUseLoaderDeps,\n StrictOrFrom,\n UseLoaderDepsResult,\n} from '@tanstack/router-core'\n\nexport interface UseLoaderDepsBaseOptions<\n TRouter extends AnyRouter,\n TFrom,\n TSelected,\n TStructuralSharing,\n> {\n select?: (\n deps: ResolveUseLoaderDeps<TRouter, TFrom>,\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseLoaderDepsOptions<\n TRouter extends AnyRouter,\n TFrom extends string | undefined,\n TSelected,\n TStructuralSharing,\n> = StrictOrFrom<TRouter, TFrom> &\n UseLoaderDepsBaseOptions<TRouter, TFrom, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseLoaderDepsRoute<out TId> = <\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseLoaderDepsBaseOptions<TRouter, TId, TSelected, TStructuralSharing> &\n StructuralSharingOption<TRouter, TSelected, false>,\n) => UseLoaderDepsResult<TRouter, TId, TSelected>\n\nexport function useLoaderDeps<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string | undefined = undefined,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts: UseLoaderDepsOptions<TRouter, TFrom, TSelected, TStructuralSharing>,\n): UseLoaderDepsResult<TRouter, TFrom, TSelected> {\n const { select, ...rest } = opts\n return useMatch({\n ...rest,\n select: (s) => {\n return select ? select(s.loaderDeps) : s.loaderDeps\n },\n }) as UseLoaderDepsResult<TRouter, TFrom, TSelected>\n}\n"],"names":[],"mappings":";AA0CO,SAAS,cAMd,MACgD;AAChD,QAAM,EAAE,QAAQ,GAAG,KAAA,IAAS;AAC5B,SAAO,SAAS;AAAA,IACd,GAAG;AAAA,IACH,QAAQ,CAAC,MAAM;AACb,aAAO,SAAS,OAAO,EAAE,UAAU,IAAI,EAAE;AAAA,IAAA;AAAA,EAC3C,CACD;AACH;"}
|
||||
@@ -0,0 +1,181 @@
|
||||
import type {
|
||||
FromPathOption,
|
||||
NavigateOptions,
|
||||
PathParamOptions,
|
||||
SearchParamOptions,
|
||||
ToPathOption,
|
||||
} from './link'
|
||||
import type { Redirect } from './redirect'
|
||||
import type { RouteIds } from './routeInfo'
|
||||
import type { AnyRouter, RegisteredRouter } from './router'
|
||||
import type { UseParamsResult } from './useParams'
|
||||
import type { UseSearchResult } from './useSearch'
|
||||
import type { Constrain, ConstrainLiteral } from './utils'
|
||||
|
||||
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>
|
||||
>
|
||||
>
|
||||
@@ -0,0 +1,475 @@
|
||||
/**
|
||||
* @fileoverview Options configuration for optionator.
|
||||
* @author George Zahariev
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const optionator = require("optionator");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Typedefs
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* The options object parsed by Optionator.
|
||||
* @typedef {Object} ParsedCLIOptions
|
||||
* @property {boolean} cache Only check changed files
|
||||
* @property {string} cacheFile Path to the cache file. Deprecated: use --cache-location
|
||||
* @property {string} [cacheLocation] Path to the cache file or directory
|
||||
* @property {"metadata" | "content"} cacheStrategy Strategy to use for detecting changed files in the cache
|
||||
* @property {boolean} [color] Force enabling/disabling of color
|
||||
* @property {string} [config] Use this configuration, overriding .eslintrc.* config options if present
|
||||
* @property {boolean} debug Output debugging information
|
||||
* @property {string[]} [env] Specify environments
|
||||
* @property {boolean} envInfo Output execution environment information
|
||||
* @property {boolean} errorOnUnmatchedPattern Prevent errors when pattern is unmatched
|
||||
* @property {boolean} eslintrc Disable use of configuration from .eslintrc.*
|
||||
* @property {string[]} [ext] Specify JavaScript file extensions
|
||||
* @property {string[]} [flag] Feature flags
|
||||
* @property {boolean} fix Automatically fix problems
|
||||
* @property {boolean} fixDryRun Automatically fix problems without saving the changes to the file system
|
||||
* @property {("directive" | "problem" | "suggestion" | "layout")[]} [fixType] Specify the types of fixes to apply (directive, problem, suggestion, layout)
|
||||
* @property {string} format Use a specific output format
|
||||
* @property {string[]} [global] Define global variables
|
||||
* @property {boolean} [help] Show help
|
||||
* @property {boolean} ignore Disable use of ignore files and patterns
|
||||
* @property {string} [ignorePath] Specify path of ignore file
|
||||
* @property {string[]} [ignorePattern] Patterns of files to ignore. In eslintrc mode, these are in addition to `.eslintignore`
|
||||
* @property {boolean} init Run config initialization wizard
|
||||
* @property {boolean} inlineConfig Prevent comments from changing config or rules
|
||||
* @property {number} maxWarnings Number of warnings to trigger nonzero exit code
|
||||
* @property {string} [outputFile] Specify file to write report to
|
||||
* @property {string} [parser] Specify the parser to be used
|
||||
* @property {Object} [parserOptions] Specify parser options
|
||||
* @property {string[]} [plugin] Specify plugins
|
||||
* @property {string} [printConfig] Print the configuration for the given file
|
||||
* @property {boolean | undefined} reportUnusedDisableDirectives Adds reported errors for unused eslint-disable and eslint-enable directives
|
||||
* @property {string | undefined} reportUnusedDisableDirectivesSeverity A severity string indicating if and how unused disable and enable directives should be tracked and reported.
|
||||
* @property {string} [resolvePluginsRelativeTo] A folder where plugins should be resolved from, CWD by default
|
||||
* @property {Object} [rule] Specify rules
|
||||
* @property {string[]} [rulesdir] Load additional rules from this directory. Deprecated: Use rules from plugins
|
||||
* @property {boolean} stdin Lint code provided on <STDIN>
|
||||
* @property {string} [stdinFilename] Specify filename to process STDIN as
|
||||
* @property {boolean} quiet Report errors only
|
||||
* @property {boolean} [version] Output the version number
|
||||
* @property {boolean} warnIgnored Show warnings when the file list includes ignored files
|
||||
* @property {boolean} [passOnNoPatterns=false] When set to true, missing patterns cause
|
||||
* the linting operation to short circuit and not report any failures.
|
||||
* @property {string[]} _ Positional filenames or patterns
|
||||
* @property {boolean} [stats] Report additional statistics
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Initialization and Public Interface
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// exports "parse(args)", "generateHelp()", and "generateHelpForOption(optionName)"
|
||||
|
||||
/**
|
||||
* Creates the CLI options for ESLint.
|
||||
* @param {boolean} usingFlatConfig Indicates if flat config is being used.
|
||||
* @returns {Object} The optionator instance.
|
||||
*/
|
||||
module.exports = function (usingFlatConfig) {
|
||||
let lookupFlag;
|
||||
|
||||
if (usingFlatConfig) {
|
||||
lookupFlag = {
|
||||
option: "config-lookup",
|
||||
type: "Boolean",
|
||||
default: "true",
|
||||
description: "Disable look up for eslint.config.js",
|
||||
};
|
||||
} else {
|
||||
lookupFlag = {
|
||||
option: "eslintrc",
|
||||
type: "Boolean",
|
||||
default: "true",
|
||||
description: "Disable use of configuration from .eslintrc.*",
|
||||
};
|
||||
}
|
||||
|
||||
let envFlag;
|
||||
|
||||
if (!usingFlatConfig) {
|
||||
envFlag = {
|
||||
option: "env",
|
||||
type: "[String]",
|
||||
description: "Specify environments",
|
||||
};
|
||||
}
|
||||
|
||||
let inspectConfigFlag;
|
||||
|
||||
if (usingFlatConfig) {
|
||||
inspectConfigFlag = {
|
||||
option: "inspect-config",
|
||||
type: "Boolean",
|
||||
description:
|
||||
"Open the config inspector with the current configuration",
|
||||
};
|
||||
}
|
||||
|
||||
let extFlag;
|
||||
|
||||
if (!usingFlatConfig) {
|
||||
extFlag = {
|
||||
option: "ext",
|
||||
type: "[String]",
|
||||
description: "Specify JavaScript file extensions",
|
||||
};
|
||||
} else {
|
||||
extFlag = {
|
||||
option: "ext",
|
||||
type: "[String]",
|
||||
description: "Specify additional file extensions to lint",
|
||||
};
|
||||
}
|
||||
|
||||
let resolvePluginsFlag;
|
||||
|
||||
if (!usingFlatConfig) {
|
||||
resolvePluginsFlag = {
|
||||
option: "resolve-plugins-relative-to",
|
||||
type: "path::String",
|
||||
description:
|
||||
"A folder where plugins should be resolved from, CWD by default",
|
||||
};
|
||||
}
|
||||
|
||||
let rulesDirFlag;
|
||||
|
||||
if (!usingFlatConfig) {
|
||||
rulesDirFlag = {
|
||||
option: "rulesdir",
|
||||
type: "[path::String]",
|
||||
description:
|
||||
"Load additional rules from this directory. Deprecated: Use rules from plugins",
|
||||
};
|
||||
}
|
||||
|
||||
let ignorePathFlag;
|
||||
|
||||
if (!usingFlatConfig) {
|
||||
ignorePathFlag = {
|
||||
option: "ignore-path",
|
||||
type: "path::String",
|
||||
description: "Specify path of ignore file",
|
||||
};
|
||||
}
|
||||
|
||||
let statsFlag;
|
||||
|
||||
if (usingFlatConfig) {
|
||||
statsFlag = {
|
||||
option: "stats",
|
||||
type: "Boolean",
|
||||
default: "false",
|
||||
description: "Add statistics to the lint report",
|
||||
};
|
||||
}
|
||||
|
||||
let warnIgnoredFlag;
|
||||
|
||||
if (usingFlatConfig) {
|
||||
warnIgnoredFlag = {
|
||||
option: "warn-ignored",
|
||||
type: "Boolean",
|
||||
default: "true",
|
||||
description:
|
||||
"Suppress warnings when the file list includes ignored files",
|
||||
};
|
||||
}
|
||||
|
||||
let flagFlag;
|
||||
|
||||
if (usingFlatConfig) {
|
||||
flagFlag = {
|
||||
option: "flag",
|
||||
type: "[String]",
|
||||
description: "Enable a feature flag",
|
||||
};
|
||||
}
|
||||
|
||||
let reportUnusedInlineConfigsFlag;
|
||||
|
||||
if (usingFlatConfig) {
|
||||
reportUnusedInlineConfigsFlag = {
|
||||
option: "report-unused-inline-configs",
|
||||
type: "String",
|
||||
default: void 0,
|
||||
description:
|
||||
"Adds reported errors for unused eslint inline config comments",
|
||||
enum: ["off", "warn", "error", "0", "1", "2"],
|
||||
};
|
||||
}
|
||||
|
||||
return optionator({
|
||||
prepend: "eslint [options] file.js [file.js] [dir]",
|
||||
defaults: {
|
||||
concatRepeatedArrays: true,
|
||||
mergeRepeatedObjects: true,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
heading: "Basic configuration",
|
||||
},
|
||||
lookupFlag,
|
||||
{
|
||||
option: "config",
|
||||
alias: "c",
|
||||
type: "path::String",
|
||||
description: usingFlatConfig
|
||||
? "Use this configuration instead of eslint.config.js, eslint.config.mjs, or eslint.config.cjs"
|
||||
: "Use this configuration, overriding .eslintrc.* config options if present",
|
||||
},
|
||||
inspectConfigFlag,
|
||||
envFlag,
|
||||
extFlag,
|
||||
{
|
||||
option: "global",
|
||||
type: "[String]",
|
||||
description: "Define global variables",
|
||||
},
|
||||
{
|
||||
option: "parser",
|
||||
type: "String",
|
||||
description: "Specify the parser to be used",
|
||||
},
|
||||
{
|
||||
option: "parser-options",
|
||||
type: "Object",
|
||||
description: "Specify parser options",
|
||||
},
|
||||
resolvePluginsFlag,
|
||||
{
|
||||
heading: "Specify Rules and Plugins",
|
||||
},
|
||||
{
|
||||
option: "plugin",
|
||||
type: "[String]",
|
||||
description: "Specify plugins",
|
||||
},
|
||||
{
|
||||
option: "rule",
|
||||
type: "Object",
|
||||
description: "Specify rules",
|
||||
},
|
||||
rulesDirFlag,
|
||||
{
|
||||
heading: "Fix Problems",
|
||||
},
|
||||
{
|
||||
option: "fix",
|
||||
type: "Boolean",
|
||||
default: false,
|
||||
description: "Automatically fix problems",
|
||||
},
|
||||
{
|
||||
option: "fix-dry-run",
|
||||
type: "Boolean",
|
||||
default: false,
|
||||
description:
|
||||
"Automatically fix problems without saving the changes to the file system",
|
||||
},
|
||||
{
|
||||
option: "fix-type",
|
||||
type: "Array",
|
||||
description:
|
||||
"Specify the types of fixes to apply (directive, problem, suggestion, layout)",
|
||||
},
|
||||
{
|
||||
heading: "Ignore Files",
|
||||
},
|
||||
ignorePathFlag,
|
||||
{
|
||||
option: "ignore",
|
||||
type: "Boolean",
|
||||
default: "true",
|
||||
description: "Disable use of ignore files and patterns",
|
||||
},
|
||||
{
|
||||
option: "ignore-pattern",
|
||||
type: "[String]",
|
||||
description: `Patterns of files to ignore${usingFlatConfig ? "" : " (in addition to those in .eslintignore)"}`,
|
||||
concatRepeatedArrays: [
|
||||
true,
|
||||
{
|
||||
oneValuePerFlag: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
heading: "Use stdin",
|
||||
},
|
||||
{
|
||||
option: "stdin",
|
||||
type: "Boolean",
|
||||
default: "false",
|
||||
description: "Lint code provided on <STDIN>",
|
||||
},
|
||||
{
|
||||
option: "stdin-filename",
|
||||
type: "String",
|
||||
description: "Specify filename to process STDIN as",
|
||||
},
|
||||
{
|
||||
heading: "Handle Warnings",
|
||||
},
|
||||
{
|
||||
option: "quiet",
|
||||
type: "Boolean",
|
||||
default: "false",
|
||||
description: "Report errors only",
|
||||
},
|
||||
{
|
||||
option: "max-warnings",
|
||||
type: "Int",
|
||||
default: "-1",
|
||||
description: "Number of warnings to trigger nonzero exit code",
|
||||
},
|
||||
{
|
||||
heading: "Output",
|
||||
},
|
||||
{
|
||||
option: "output-file",
|
||||
alias: "o",
|
||||
type: "path::String",
|
||||
description: "Specify file to write report to",
|
||||
},
|
||||
{
|
||||
option: "format",
|
||||
alias: "f",
|
||||
type: "String",
|
||||
default: "stylish",
|
||||
description: "Use a specific output format",
|
||||
},
|
||||
{
|
||||
option: "color",
|
||||
type: "Boolean",
|
||||
alias: "no-color",
|
||||
description: "Force enabling/disabling of color",
|
||||
},
|
||||
{
|
||||
heading: "Inline configuration comments",
|
||||
},
|
||||
{
|
||||
option: "inline-config",
|
||||
type: "Boolean",
|
||||
default: "true",
|
||||
description: "Prevent comments from changing config or rules",
|
||||
},
|
||||
{
|
||||
option: "report-unused-disable-directives",
|
||||
type: "Boolean",
|
||||
default: void 0,
|
||||
description:
|
||||
"Adds reported errors for unused eslint-disable and eslint-enable directives",
|
||||
},
|
||||
{
|
||||
option: "report-unused-disable-directives-severity",
|
||||
type: "String",
|
||||
default: void 0,
|
||||
description:
|
||||
"Chooses severity level for reporting unused eslint-disable and eslint-enable directives",
|
||||
enum: ["off", "warn", "error", "0", "1", "2"],
|
||||
},
|
||||
reportUnusedInlineConfigsFlag,
|
||||
{
|
||||
heading: "Caching",
|
||||
},
|
||||
{
|
||||
option: "cache",
|
||||
type: "Boolean",
|
||||
default: "false",
|
||||
description: "Only check changed files",
|
||||
},
|
||||
{
|
||||
option: "cache-file",
|
||||
type: "path::String",
|
||||
default: ".eslintcache",
|
||||
description:
|
||||
"Path to the cache file. Deprecated: use --cache-location",
|
||||
},
|
||||
{
|
||||
option: "cache-location",
|
||||
type: "path::String",
|
||||
description: "Path to the cache file or directory",
|
||||
},
|
||||
{
|
||||
option: "cache-strategy",
|
||||
dependsOn: ["cache"],
|
||||
type: "String",
|
||||
default: "metadata",
|
||||
enum: ["metadata", "content"],
|
||||
description:
|
||||
"Strategy to use for detecting changed files in the cache",
|
||||
},
|
||||
{
|
||||
heading: "Miscellaneous",
|
||||
},
|
||||
{
|
||||
option: "init",
|
||||
type: "Boolean",
|
||||
default: "false",
|
||||
description: "Run config initialization wizard",
|
||||
},
|
||||
{
|
||||
option: "env-info",
|
||||
type: "Boolean",
|
||||
default: "false",
|
||||
description: "Output execution environment information",
|
||||
},
|
||||
{
|
||||
option: "error-on-unmatched-pattern",
|
||||
type: "Boolean",
|
||||
default: "true",
|
||||
description: "Prevent errors when pattern is unmatched",
|
||||
},
|
||||
{
|
||||
option: "exit-on-fatal-error",
|
||||
type: "Boolean",
|
||||
default: "false",
|
||||
description: "Exit with exit code 2 in case of fatal error",
|
||||
},
|
||||
warnIgnoredFlag,
|
||||
{
|
||||
option: "pass-on-no-patterns",
|
||||
type: "Boolean",
|
||||
default: false,
|
||||
description:
|
||||
"Exit with exit code 0 in case no file patterns are passed",
|
||||
},
|
||||
{
|
||||
option: "debug",
|
||||
type: "Boolean",
|
||||
default: false,
|
||||
description: "Output debugging information",
|
||||
},
|
||||
{
|
||||
option: "help",
|
||||
alias: "h",
|
||||
type: "Boolean",
|
||||
description: "Show help",
|
||||
},
|
||||
{
|
||||
option: "version",
|
||||
alias: "v",
|
||||
type: "Boolean",
|
||||
description: "Output the version number",
|
||||
},
|
||||
{
|
||||
option: "print-config",
|
||||
type: "path::String",
|
||||
description: "Print the configuration for the given file",
|
||||
},
|
||||
statsFlag,
|
||||
flagFlag,
|
||||
].filter(value => !!value),
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const qss = require("./qss.cjs");
|
||||
const defaultParseSearch = parseSearchWith(JSON.parse);
|
||||
const defaultStringifySearch = stringifySearchWith(
|
||||
JSON.stringify,
|
||||
JSON.parse
|
||||
);
|
||||
function parseSearchWith(parser) {
|
||||
return (searchStr) => {
|
||||
if (searchStr.substring(0, 1) === "?") {
|
||||
searchStr = searchStr.substring(1);
|
||||
}
|
||||
const query = qss.decode(searchStr);
|
||||
for (const key in query) {
|
||||
const value = query[key];
|
||||
if (typeof value === "string") {
|
||||
try {
|
||||
query[key] = parser(value);
|
||||
} catch (err) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return query;
|
||||
};
|
||||
}
|
||||
function stringifySearchWith(stringify, parser) {
|
||||
function stringifyValue(val) {
|
||||
if (typeof val === "object" && val !== null) {
|
||||
try {
|
||||
return stringify(val);
|
||||
} catch (err) {
|
||||
}
|
||||
} else if (typeof val === "string" && typeof parser === "function") {
|
||||
try {
|
||||
parser(val);
|
||||
return stringify(val);
|
||||
} catch (err) {
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
return (search) => {
|
||||
search = { ...search };
|
||||
Object.keys(search).forEach((key) => {
|
||||
const val = search[key];
|
||||
if (typeof val === "undefined" || val === void 0) {
|
||||
delete search[key];
|
||||
} else {
|
||||
search[key] = stringifyValue(val);
|
||||
}
|
||||
});
|
||||
const searchStr = qss.encode(search).toString();
|
||||
return searchStr ? `?${searchStr}` : "";
|
||||
};
|
||||
}
|
||||
exports.defaultParseSearch = defaultParseSearch;
|
||||
exports.defaultStringifySearch = defaultStringifySearch;
|
||||
exports.parseSearchWith = parseSearchWith;
|
||||
exports.stringifySearchWith = stringifySearchWith;
|
||||
//# sourceMappingURL=searchParams.cjs.map
|
||||
@@ -0,0 +1,344 @@
|
||||
"use strict";
|
||||
'use client';
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const jsx_runtime_1 = require("react/jsx-runtime");
|
||||
const react_1 = require("react");
|
||||
const make_event_props_1 = __importDefault(require("make-event-props"));
|
||||
const make_cancellable_promise_1 = __importDefault(require("make-cancellable-promise"));
|
||||
const clsx_1 = __importDefault(require("clsx"));
|
||||
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
||||
const warning_1 = __importDefault(require("warning"));
|
||||
const dequal_1 = require("dequal");
|
||||
const pdfjs = __importStar(require("pdfjs-dist"));
|
||||
const DocumentContext_js_1 = __importDefault(require("./DocumentContext.js"));
|
||||
const Message_js_1 = __importDefault(require("./Message.js"));
|
||||
const LinkService_js_1 = __importDefault(require("./LinkService.js"));
|
||||
const PasswordResponses_js_1 = __importDefault(require("./PasswordResponses.js"));
|
||||
const utils_js_1 = require("./shared/utils.js");
|
||||
const useResolver_js_1 = __importDefault(require("./shared/hooks/useResolver.js"));
|
||||
const { PDFDataRangeTransport } = pdfjs;
|
||||
const defaultOnPassword = (callback, reason) => {
|
||||
switch (reason) {
|
||||
case PasswordResponses_js_1.default.NEED_PASSWORD: {
|
||||
const password = prompt('Enter the password to open this PDF file.');
|
||||
callback(password);
|
||||
break;
|
||||
}
|
||||
case PasswordResponses_js_1.default.INCORRECT_PASSWORD: {
|
||||
const password = prompt('Invalid password. Please try again.');
|
||||
callback(password);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
}
|
||||
};
|
||||
function isParameterObject(file) {
|
||||
return (typeof file === 'object' &&
|
||||
file !== null &&
|
||||
('data' in file || 'range' in file || 'url' in file));
|
||||
}
|
||||
/**
|
||||
* Loads a document passed using `file` prop.
|
||||
*/
|
||||
const Document = (0, react_1.forwardRef)(function Document(_a, ref) {
|
||||
var { children, className, error = 'Failed to load PDF file.', externalLinkRel, externalLinkTarget, file, inputRef, imageResourcesPath, loading = 'Loading PDF…', noData = 'No PDF file specified.', onItemClick, onLoadError: onLoadErrorProps, onLoadProgress, onLoadSuccess: onLoadSuccessProps, onPassword = defaultOnPassword, onSourceError: onSourceErrorProps, onSourceSuccess: onSourceSuccessProps, options, renderMode, rotate } = _a, otherProps = __rest(_a, ["children", "className", "error", "externalLinkRel", "externalLinkTarget", "file", "inputRef", "imageResourcesPath", "loading", "noData", "onItemClick", "onLoadError", "onLoadProgress", "onLoadSuccess", "onPassword", "onSourceError", "onSourceSuccess", "options", "renderMode", "rotate"]);
|
||||
const [sourceState, sourceDispatch] = (0, useResolver_js_1.default)();
|
||||
const { value: source, error: sourceError } = sourceState;
|
||||
const [pdfState, pdfDispatch] = (0, useResolver_js_1.default)();
|
||||
const { value: pdf, error: pdfError } = pdfState;
|
||||
const linkService = (0, react_1.useRef)(new LinkService_js_1.default());
|
||||
const pages = (0, react_1.useRef)([]);
|
||||
const prevFile = (0, react_1.useRef)(undefined);
|
||||
const prevOptions = (0, react_1.useRef)(undefined);
|
||||
if (file && file !== prevFile.current && isParameterObject(file)) {
|
||||
(0, warning_1.default)(!(0, dequal_1.dequal)(file, prevFile.current), `File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`);
|
||||
prevFile.current = file;
|
||||
}
|
||||
// Detect non-memoized changes in options prop
|
||||
if (options && options !== prevOptions.current) {
|
||||
(0, warning_1.default)(!(0, dequal_1.dequal)(options, prevOptions.current), `Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`);
|
||||
prevOptions.current = options;
|
||||
}
|
||||
const viewer = (0, react_1.useRef)({
|
||||
// Handling jumping to internal links target
|
||||
scrollPageIntoView: (args) => {
|
||||
const { dest, pageNumber, pageIndex = pageNumber - 1 } = args;
|
||||
// First, check if custom handling of onItemClick was provided
|
||||
if (onItemClick) {
|
||||
onItemClick({ dest, pageIndex, pageNumber });
|
||||
return;
|
||||
}
|
||||
// If not, try to look for target page within the <Document>.
|
||||
const page = pages.current[pageIndex];
|
||||
if (page) {
|
||||
// Scroll to the page automatically
|
||||
page.scrollIntoView();
|
||||
return;
|
||||
}
|
||||
(0, warning_1.default)(false, `An internal link leading to page ${pageNumber} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`);
|
||||
},
|
||||
});
|
||||
(0, react_1.useImperativeHandle)(ref, () => ({
|
||||
linkService,
|
||||
pages,
|
||||
viewer,
|
||||
}), []);
|
||||
/**
|
||||
* Called when a document source is resolved correctly
|
||||
*/
|
||||
function onSourceSuccess() {
|
||||
if (onSourceSuccessProps) {
|
||||
onSourceSuccessProps();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Called when a document source failed to be resolved correctly
|
||||
*/
|
||||
function onSourceError() {
|
||||
if (!sourceError) {
|
||||
// Impossible, but TypeScript doesn't know that
|
||||
return;
|
||||
}
|
||||
(0, warning_1.default)(false, sourceError.toString());
|
||||
if (onSourceErrorProps) {
|
||||
onSourceErrorProps(sourceError);
|
||||
}
|
||||
}
|
||||
function resetSource() {
|
||||
sourceDispatch({ type: 'RESET' });
|
||||
}
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: See https://github.com/biomejs/biome/issues/3080
|
||||
(0, react_1.useEffect)(resetSource, [file, sourceDispatch]);
|
||||
const findDocumentSource = (0, react_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
||||
if (!file) {
|
||||
return null;
|
||||
}
|
||||
// File is a string
|
||||
if (typeof file === 'string') {
|
||||
if ((0, utils_js_1.isDataURI)(file)) {
|
||||
const fileByteString = (0, utils_js_1.dataURItoByteString)(file);
|
||||
return { data: fileByteString };
|
||||
}
|
||||
(0, utils_js_1.displayCORSWarning)();
|
||||
return { url: file };
|
||||
}
|
||||
// File is PDFDataRangeTransport
|
||||
if (file instanceof PDFDataRangeTransport) {
|
||||
return { range: file };
|
||||
}
|
||||
// File is an ArrayBuffer
|
||||
if ((0, utils_js_1.isArrayBuffer)(file)) {
|
||||
return { data: file };
|
||||
}
|
||||
/**
|
||||
* The cases below are browser-only.
|
||||
* If you're running on a non-browser environment, these cases will be of no use.
|
||||
*/
|
||||
if (utils_js_1.isBrowser) {
|
||||
// File is a Blob
|
||||
if ((0, utils_js_1.isBlob)(file)) {
|
||||
const data = yield (0, utils_js_1.loadFromFile)(file);
|
||||
return { data };
|
||||
}
|
||||
}
|
||||
// At this point, file must be an object
|
||||
(0, tiny_invariant_1.default)(typeof file === 'object', 'Invalid parameter in file, need either Uint8Array, string or a parameter object');
|
||||
(0, tiny_invariant_1.default)(isParameterObject(file), 'Invalid parameter object: need either .data, .range or .url');
|
||||
// File .url is a string
|
||||
if ('url' in file && typeof file.url === 'string') {
|
||||
if ((0, utils_js_1.isDataURI)(file.url)) {
|
||||
const { url } = file, otherParams = __rest(file, ["url"]);
|
||||
const fileByteString = (0, utils_js_1.dataURItoByteString)(url);
|
||||
return Object.assign({ data: fileByteString }, otherParams);
|
||||
}
|
||||
(0, utils_js_1.displayCORSWarning)();
|
||||
}
|
||||
return file;
|
||||
}), [file]);
|
||||
(0, react_1.useEffect)(() => {
|
||||
const cancellable = (0, make_cancellable_promise_1.default)(findDocumentSource());
|
||||
cancellable.promise
|
||||
.then((nextSource) => {
|
||||
sourceDispatch({ type: 'RESOLVE', value: nextSource });
|
||||
})
|
||||
.catch((error) => {
|
||||
sourceDispatch({ type: 'REJECT', error });
|
||||
});
|
||||
return () => {
|
||||
(0, utils_js_1.cancelRunningTask)(cancellable);
|
||||
};
|
||||
}, [findDocumentSource, sourceDispatch]);
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: Ommitted callbacks so they are not called every time they change
|
||||
(0, react_1.useEffect)(() => {
|
||||
if (typeof source === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if (source === false) {
|
||||
onSourceError();
|
||||
return;
|
||||
}
|
||||
onSourceSuccess();
|
||||
}, [source]);
|
||||
/**
|
||||
* Called when a document is read successfully
|
||||
*/
|
||||
function onLoadSuccess() {
|
||||
if (!pdf) {
|
||||
// Impossible, but TypeScript doesn't know that
|
||||
return;
|
||||
}
|
||||
if (onLoadSuccessProps) {
|
||||
onLoadSuccessProps(pdf);
|
||||
}
|
||||
pages.current = new Array(pdf.numPages);
|
||||
linkService.current.setDocument(pdf);
|
||||
}
|
||||
/**
|
||||
* Called when a document failed to read successfully
|
||||
*/
|
||||
function onLoadError() {
|
||||
if (!pdfError) {
|
||||
// Impossible, but TypeScript doesn't know that
|
||||
return;
|
||||
}
|
||||
(0, warning_1.default)(false, pdfError.toString());
|
||||
if (onLoadErrorProps) {
|
||||
onLoadErrorProps(pdfError);
|
||||
}
|
||||
}
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: useEffect intentionally triggered on source change
|
||||
(0, react_1.useEffect)(function resetDocument() {
|
||||
pdfDispatch({ type: 'RESET' });
|
||||
}, [pdfDispatch, source]);
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: Ommitted callbacks so they are not called every time they change
|
||||
(0, react_1.useEffect)(function loadDocument() {
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
const documentInitParams = options
|
||||
? Object.assign(Object.assign({}, source), options) : source;
|
||||
const destroyable = pdfjs.getDocument(documentInitParams);
|
||||
if (onLoadProgress) {
|
||||
destroyable.onProgress = onLoadProgress;
|
||||
}
|
||||
if (onPassword) {
|
||||
destroyable.onPassword = onPassword;
|
||||
}
|
||||
const loadingTask = destroyable;
|
||||
const loadingPromise = loadingTask.promise
|
||||
.then((nextPdf) => {
|
||||
pdfDispatch({ type: 'RESOLVE', value: nextPdf });
|
||||
})
|
||||
.catch((error) => {
|
||||
if (loadingTask.destroyed) {
|
||||
return;
|
||||
}
|
||||
pdfDispatch({ type: 'REJECT', error });
|
||||
});
|
||||
return () => {
|
||||
loadingPromise.finally(() => loadingTask.destroy());
|
||||
};
|
||||
}, [options, pdfDispatch, source]);
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: Ommitted callbacks so they are not called every time they change
|
||||
(0, react_1.useEffect)(() => {
|
||||
if (typeof pdf === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if (pdf === false) {
|
||||
onLoadError();
|
||||
return;
|
||||
}
|
||||
onLoadSuccess();
|
||||
}, [pdf]);
|
||||
(0, react_1.useEffect)(function setupLinkService() {
|
||||
linkService.current.setViewer(viewer.current);
|
||||
linkService.current.setExternalLinkRel(externalLinkRel);
|
||||
linkService.current.setExternalLinkTarget(externalLinkTarget);
|
||||
}, [externalLinkRel, externalLinkTarget]);
|
||||
const registerPage = (0, react_1.useCallback)((pageIndex, ref) => {
|
||||
pages.current[pageIndex] = ref;
|
||||
}, []);
|
||||
const unregisterPage = (0, react_1.useCallback)((pageIndex) => {
|
||||
delete pages.current[pageIndex];
|
||||
}, []);
|
||||
const childContext = (0, react_1.useMemo)(() => ({
|
||||
imageResourcesPath,
|
||||
linkService: linkService.current,
|
||||
onItemClick,
|
||||
pdf,
|
||||
registerPage,
|
||||
renderMode,
|
||||
rotate,
|
||||
unregisterPage,
|
||||
}), [imageResourcesPath, onItemClick, pdf, registerPage, renderMode, rotate, unregisterPage]);
|
||||
const eventProps = (0, react_1.useMemo)(() => (0, make_event_props_1.default)(otherProps, () => pdf),
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: FIXME
|
||||
[otherProps, pdf]);
|
||||
function renderChildren() {
|
||||
return (0, jsx_runtime_1.jsx)(DocumentContext_js_1.default.Provider, { value: childContext, children: children });
|
||||
}
|
||||
function renderContent() {
|
||||
if (!file) {
|
||||
return (0, jsx_runtime_1.jsx)(Message_js_1.default, { type: "no-data", children: typeof noData === 'function' ? noData() : noData });
|
||||
}
|
||||
if (pdf === undefined || pdf === null) {
|
||||
return ((0, jsx_runtime_1.jsx)(Message_js_1.default, { type: "loading", children: typeof loading === 'function' ? loading() : loading }));
|
||||
}
|
||||
if (pdf === false) {
|
||||
return (0, jsx_runtime_1.jsx)(Message_js_1.default, { type: "error", children: typeof error === 'function' ? error() : error });
|
||||
}
|
||||
return renderChildren();
|
||||
}
|
||||
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, clsx_1.default)('react-pdf__Document', className),
|
||||
// Assertion is needed for React 18 compatibility
|
||||
ref: inputRef, style: {
|
||||
['--scale-factor']: '1',
|
||||
} }, eventProps, { children: renderContent() })));
|
||||
});
|
||||
exports.default = Document;
|
||||
Binary file not shown.
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @fileoverview Rule to flag nested ternary expressions
|
||||
* @author Ian Christian Myers
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "Disallow nested ternary expressions",
|
||||
recommended: false,
|
||||
frozen: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-nested-ternary",
|
||||
},
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
noNestedTernary: "Do not nest ternary expressions.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
ConditionalExpression(node) {
|
||||
if (
|
||||
node.alternate.type === "ConditionalExpression" ||
|
||||
node.consequent.type === "ConditionalExpression"
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "noNestedTernary",
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_index","require","isNode","node","VISITOR_KEYS","type"],"sources":["../../src/validators/isNode.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"../definitions/index.ts\";\nimport type * as t from \"../index.ts\";\n\nexport default function isNode(node: any): node is t.Node {\n return !!(node && VISITOR_KEYS[node.type]);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGe,SAASC,MAAMA,CAACC,IAAS,EAAkB;EACxD,OAAO,CAAC,EAAEA,IAAI,IAAIC,mBAAY,CAACD,IAAI,CAACE,IAAI,CAAC,CAAC;AAC5C","ignoreList":[]}
|
||||
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
* @fileoverview Restrict usage of specified globals.
|
||||
* @author Benoît Zugmeyer
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "Disallow specified global variables",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/no-restricted-globals",
|
||||
},
|
||||
|
||||
schema: {
|
||||
type: "array",
|
||||
items: {
|
||||
oneOf: [
|
||||
{
|
||||
type: "string",
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
name: { type: "string" },
|
||||
message: { type: "string" },
|
||||
},
|
||||
required: ["name"],
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
uniqueItems: true,
|
||||
minItems: 0,
|
||||
},
|
||||
|
||||
messages: {
|
||||
defaultMessage: "Unexpected use of '{{name}}'.",
|
||||
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
||||
customMessage: "Unexpected use of '{{name}}'. {{customMessage}}",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
// If no globals are restricted, we don't need to do anything
|
||||
if (context.options.length === 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const restrictedGlobalMessages = context.options.reduce(
|
||||
(memo, option) => {
|
||||
if (typeof option === "string") {
|
||||
memo[option] = null;
|
||||
} else {
|
||||
memo[option.name] = option.message;
|
||||
}
|
||||
|
||||
return memo;
|
||||
},
|
||||
{},
|
||||
);
|
||||
|
||||
/**
|
||||
* Report a variable to be used as a restricted global.
|
||||
* @param {Reference} reference the variable reference
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function reportReference(reference) {
|
||||
const name = reference.identifier.name,
|
||||
customMessage = restrictedGlobalMessages[name],
|
||||
messageId = customMessage ? "customMessage" : "defaultMessage";
|
||||
|
||||
context.report({
|
||||
node: reference.identifier,
|
||||
messageId,
|
||||
data: {
|
||||
name,
|
||||
customMessage,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given name is a restricted global name.
|
||||
* @param {string} name name of a variable
|
||||
* @returns {boolean} whether the variable is a restricted global or not
|
||||
* @private
|
||||
*/
|
||||
function isRestricted(name) {
|
||||
return Object.hasOwn(restrictedGlobalMessages, name);
|
||||
}
|
||||
|
||||
return {
|
||||
Program(node) {
|
||||
const scope = sourceCode.getScope(node);
|
||||
|
||||
// Report variables declared elsewhere (ex: variables defined as "global" by eslint)
|
||||
scope.variables.forEach(variable => {
|
||||
if (!variable.defs.length && isRestricted(variable.name)) {
|
||||
variable.references.forEach(reportReference);
|
||||
}
|
||||
});
|
||||
|
||||
// Report variables not declared at all
|
||||
scope.through.forEach(reference => {
|
||||
if (isRestricted(reference.identifier.name)) {
|
||||
reportReference(reference);
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
export type AnnotationStorage = import("./annotation_storage").AnnotationStorage;
|
||||
export type PageViewport = import("./display_utils").PageViewport;
|
||||
export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService;
|
||||
export type XfaLayerParameters = {
|
||||
viewport: PageViewport;
|
||||
div: HTMLDivElement;
|
||||
xfaHtml: Object;
|
||||
annotationStorage?: import("./annotation_storage").AnnotationStorage | undefined;
|
||||
linkService: IPDFLinkService;
|
||||
/**
|
||||
* - (default value is 'display').
|
||||
*/
|
||||
intent?: string | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} XfaLayerParameters
|
||||
* @property {PageViewport} viewport
|
||||
* @property {HTMLDivElement} div
|
||||
* @property {Object} xfaHtml
|
||||
* @property {AnnotationStorage} [annotationStorage]
|
||||
* @property {IPDFLinkService} linkService
|
||||
* @property {string} [intent] - (default value is 'display').
|
||||
*/
|
||||
export class XfaLayer {
|
||||
static setupStorage(html: any, id: any, element: any, storage: any, intent: any): void;
|
||||
static setAttributes({ html, element, storage, intent, linkService }: {
|
||||
html: any;
|
||||
element: any;
|
||||
storage?: null | undefined;
|
||||
intent: any;
|
||||
linkService: any;
|
||||
}): void;
|
||||
/**
|
||||
* Render the XFA layer.
|
||||
*
|
||||
* @param {XfaLayerParameters} parameters
|
||||
*/
|
||||
static render(parameters: XfaLayerParameters): {
|
||||
textDivs: Text[];
|
||||
};
|
||||
/**
|
||||
* Update the XFA layer.
|
||||
*
|
||||
* @param {XfaLayerParameters} parameters
|
||||
*/
|
||||
static update(parameters: XfaLayerParameters): void;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var acorn = require('./acorn.js');
|
||||
|
||||
function _interopNamespaceDefault(e) {
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () { return e[k]; }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n.default = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var acorn__namespace = /*#__PURE__*/_interopNamespaceDefault(acorn);
|
||||
|
||||
var inputFilePaths = [], forceFileName = false, fileMode = false, silent = false, compact = false, tokenize = false;
|
||||
var options = {};
|
||||
|
||||
function help(status) {
|
||||
var print = (status === 0) ? console.log : console.error;
|
||||
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
|
||||
print(" [--tokenize] [--locations] [--allow-hash-bang] [--allow-await-outside-function] [--compact] [--silent] [--module] [--help] [--] [<infile>...]");
|
||||
process.exit(status);
|
||||
}
|
||||
|
||||
for (var i = 2; i < process.argv.length; ++i) {
|
||||
var arg = process.argv[i];
|
||||
if (arg[0] !== "-" || arg === "-") { inputFilePaths.push(arg); }
|
||||
else if (arg === "--") {
|
||||
inputFilePaths.push.apply(inputFilePaths, process.argv.slice(i + 1));
|
||||
forceFileName = true;
|
||||
break
|
||||
} else if (arg === "--locations") { options.locations = true; }
|
||||
else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
|
||||
else if (arg === "--allow-await-outside-function") { options.allowAwaitOutsideFunction = true; }
|
||||
else if (arg === "--silent") { silent = true; }
|
||||
else if (arg === "--compact") { compact = true; }
|
||||
else if (arg === "--help") { help(0); }
|
||||
else if (arg === "--tokenize") { tokenize = true; }
|
||||
else if (arg === "--module") { options.sourceType = "module"; }
|
||||
else {
|
||||
var match = arg.match(/^--ecma(\d+)$/);
|
||||
if (match)
|
||||
{ options.ecmaVersion = +match[1]; }
|
||||
else
|
||||
{ help(1); }
|
||||
}
|
||||
}
|
||||
|
||||
function run(codeList) {
|
||||
var result = [], fileIdx = 0;
|
||||
try {
|
||||
codeList.forEach(function (code, idx) {
|
||||
fileIdx = idx;
|
||||
if (!tokenize) {
|
||||
result = acorn__namespace.parse(code, options);
|
||||
options.program = result;
|
||||
} else {
|
||||
var tokenizer = acorn__namespace.tokenizer(code, options), token;
|
||||
do {
|
||||
token = tokenizer.getToken();
|
||||
result.push(token);
|
||||
} while (token.type !== acorn__namespace.tokTypes.eof)
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(fileMode ? e.message.replace(/\(\d+:\d+\)$/, function (m) { return m.slice(0, 1) + inputFilePaths[fileIdx] + " " + m.slice(1); }) : e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
|
||||
}
|
||||
|
||||
if (fileMode = inputFilePaths.length && (forceFileName || !inputFilePaths.includes("-") || inputFilePaths.length !== 1)) {
|
||||
run(inputFilePaths.map(function (path) { return fs.readFileSync(path, "utf8"); }));
|
||||
} else {
|
||||
var code = "";
|
||||
process.stdin.resume();
|
||||
process.stdin.on("data", function (chunk) { return code += chunk; });
|
||||
process.stdin.on("end", function () { return run([code]); });
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"wss.js","sourceRoot":"","sources":["../../../src/schemes/wss.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,MAAM,CAAC;AAEtB,MAAM,OAAO,GAAoB;IAChC,MAAM,EAAG,KAAK;IACd,UAAU,EAAG,EAAE,CAAC,UAAU;IAC1B,KAAK,EAAG,EAAE,CAAC,KAAK;IAChB,SAAS,EAAG,EAAE,CAAC,SAAS;CACxB,CAAA;AAED,eAAe,OAAO,CAAC"}
|
||||
@@ -0,0 +1,429 @@
|
||||
/**
|
||||
* @license React
|
||||
* react.react-server.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
var ReactSharedInternals = { H: null, A: null };
|
||||
function formatProdErrorMessage(code) {
|
||||
var url = "https://react.dev/errors/" + code;
|
||||
if (1 < arguments.length) {
|
||||
url += "?args[]=" + encodeURIComponent(arguments[1]);
|
||||
for (var i = 2; i < arguments.length; i++)
|
||||
url += "&args[]=" + encodeURIComponent(arguments[i]);
|
||||
}
|
||||
return (
|
||||
"Minified React error #" +
|
||||
code +
|
||||
"; visit " +
|
||||
url +
|
||||
" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."
|
||||
);
|
||||
}
|
||||
var isArrayImpl = Array.isArray,
|
||||
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
||||
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
||||
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
||||
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
||||
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
||||
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
||||
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
||||
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
||||
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
||||
MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
||||
function getIteratorFn(maybeIterable) {
|
||||
if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
|
||||
maybeIterable =
|
||||
(MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
|
||||
maybeIterable["@@iterator"];
|
||||
return "function" === typeof maybeIterable ? maybeIterable : null;
|
||||
}
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty,
|
||||
assign = Object.assign;
|
||||
function ReactElement(type, key, self, source, owner, props) {
|
||||
self = props.ref;
|
||||
return {
|
||||
$$typeof: REACT_ELEMENT_TYPE,
|
||||
type: type,
|
||||
key: key,
|
||||
ref: void 0 !== self ? self : null,
|
||||
props: props
|
||||
};
|
||||
}
|
||||
function cloneAndReplaceKey(oldElement, newKey) {
|
||||
return ReactElement(
|
||||
oldElement.type,
|
||||
newKey,
|
||||
void 0,
|
||||
void 0,
|
||||
void 0,
|
||||
oldElement.props
|
||||
);
|
||||
}
|
||||
function isValidElement(object) {
|
||||
return (
|
||||
"object" === typeof object &&
|
||||
null !== object &&
|
||||
object.$$typeof === REACT_ELEMENT_TYPE
|
||||
);
|
||||
}
|
||||
function escape(key) {
|
||||
var escaperLookup = { "=": "=0", ":": "=2" };
|
||||
return (
|
||||
"$" +
|
||||
key.replace(/[=:]/g, function (match) {
|
||||
return escaperLookup[match];
|
||||
})
|
||||
);
|
||||
}
|
||||
var userProvidedKeyEscapeRegex = /\/+/g;
|
||||
function getElementKey(element, index) {
|
||||
return "object" === typeof element && null !== element && null != element.key
|
||||
? escape("" + element.key)
|
||||
: index.toString(36);
|
||||
}
|
||||
function noop() {}
|
||||
function resolveThenable(thenable) {
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw thenable.reason;
|
||||
default:
|
||||
switch (
|
||||
("string" === typeof thenable.status
|
||||
? thenable.then(noop, noop)
|
||||
: ((thenable.status = "pending"),
|
||||
thenable.then(
|
||||
function (fulfilledValue) {
|
||||
"pending" === thenable.status &&
|
||||
((thenable.status = "fulfilled"),
|
||||
(thenable.value = fulfilledValue));
|
||||
},
|
||||
function (error) {
|
||||
"pending" === thenable.status &&
|
||||
((thenable.status = "rejected"), (thenable.reason = error));
|
||||
}
|
||||
)),
|
||||
thenable.status)
|
||||
) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw thenable.reason;
|
||||
}
|
||||
}
|
||||
throw thenable;
|
||||
}
|
||||
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
||||
var type = typeof children;
|
||||
if ("undefined" === type || "boolean" === type) children = null;
|
||||
var invokeCallback = !1;
|
||||
if (null === children) invokeCallback = !0;
|
||||
else
|
||||
switch (type) {
|
||||
case "bigint":
|
||||
case "string":
|
||||
case "number":
|
||||
invokeCallback = !0;
|
||||
break;
|
||||
case "object":
|
||||
switch (children.$$typeof) {
|
||||
case REACT_ELEMENT_TYPE:
|
||||
case REACT_PORTAL_TYPE:
|
||||
invokeCallback = !0;
|
||||
break;
|
||||
case REACT_LAZY_TYPE:
|
||||
return (
|
||||
(invokeCallback = children._init),
|
||||
mapIntoArray(
|
||||
invokeCallback(children._payload),
|
||||
array,
|
||||
escapedPrefix,
|
||||
nameSoFar,
|
||||
callback
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
if (invokeCallback)
|
||||
return (
|
||||
(callback = callback(children)),
|
||||
(invokeCallback =
|
||||
"" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar),
|
||||
isArrayImpl(callback)
|
||||
? ((escapedPrefix = ""),
|
||||
null != invokeCallback &&
|
||||
(escapedPrefix =
|
||||
invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
|
||||
mapIntoArray(callback, array, escapedPrefix, "", function (c) {
|
||||
return c;
|
||||
}))
|
||||
: null != callback &&
|
||||
(isValidElement(callback) &&
|
||||
(callback = cloneAndReplaceKey(
|
||||
callback,
|
||||
escapedPrefix +
|
||||
(null == callback.key ||
|
||||
(children && children.key === callback.key)
|
||||
? ""
|
||||
: ("" + callback.key).replace(
|
||||
userProvidedKeyEscapeRegex,
|
||||
"$&/"
|
||||
) + "/") +
|
||||
invokeCallback
|
||||
)),
|
||||
array.push(callback)),
|
||||
1
|
||||
);
|
||||
invokeCallback = 0;
|
||||
var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
|
||||
if (isArrayImpl(children))
|
||||
for (var i = 0; i < children.length; i++)
|
||||
(nameSoFar = children[i]),
|
||||
(type = nextNamePrefix + getElementKey(nameSoFar, i)),
|
||||
(invokeCallback += mapIntoArray(
|
||||
nameSoFar,
|
||||
array,
|
||||
escapedPrefix,
|
||||
type,
|
||||
callback
|
||||
));
|
||||
else if (((i = getIteratorFn(children)), "function" === typeof i))
|
||||
for (
|
||||
children = i.call(children), i = 0;
|
||||
!(nameSoFar = children.next()).done;
|
||||
|
||||
)
|
||||
(nameSoFar = nameSoFar.value),
|
||||
(type = nextNamePrefix + getElementKey(nameSoFar, i++)),
|
||||
(invokeCallback += mapIntoArray(
|
||||
nameSoFar,
|
||||
array,
|
||||
escapedPrefix,
|
||||
type,
|
||||
callback
|
||||
));
|
||||
else if ("object" === type) {
|
||||
if ("function" === typeof children.then)
|
||||
return mapIntoArray(
|
||||
resolveThenable(children),
|
||||
array,
|
||||
escapedPrefix,
|
||||
nameSoFar,
|
||||
callback
|
||||
);
|
||||
array = String(children);
|
||||
throw Error(
|
||||
formatProdErrorMessage(
|
||||
31,
|
||||
"[object Object]" === array
|
||||
? "object with keys {" + Object.keys(children).join(", ") + "}"
|
||||
: array
|
||||
)
|
||||
);
|
||||
}
|
||||
return invokeCallback;
|
||||
}
|
||||
function mapChildren(children, func, context) {
|
||||
if (null == children) return children;
|
||||
var result = [],
|
||||
count = 0;
|
||||
mapIntoArray(children, result, "", "", function (child) {
|
||||
return func.call(context, child, count++);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
function lazyInitializer(payload) {
|
||||
if (-1 === payload._status) {
|
||||
var ctor = payload._result;
|
||||
ctor = ctor();
|
||||
ctor.then(
|
||||
function (moduleObject) {
|
||||
if (0 === payload._status || -1 === payload._status)
|
||||
(payload._status = 1), (payload._result = moduleObject);
|
||||
},
|
||||
function (error) {
|
||||
if (0 === payload._status || -1 === payload._status)
|
||||
(payload._status = 2), (payload._result = error);
|
||||
}
|
||||
);
|
||||
-1 === payload._status && ((payload._status = 0), (payload._result = ctor));
|
||||
}
|
||||
if (1 === payload._status) return payload._result.default;
|
||||
throw payload._result;
|
||||
}
|
||||
function createCacheRoot() {
|
||||
return new WeakMap();
|
||||
}
|
||||
function createCacheNode() {
|
||||
return { s: 0, v: void 0, o: null, p: null };
|
||||
}
|
||||
exports.Children = {
|
||||
map: mapChildren,
|
||||
forEach: function (children, forEachFunc, forEachContext) {
|
||||
mapChildren(
|
||||
children,
|
||||
function () {
|
||||
forEachFunc.apply(this, arguments);
|
||||
},
|
||||
forEachContext
|
||||
);
|
||||
},
|
||||
count: function (children) {
|
||||
var n = 0;
|
||||
mapChildren(children, function () {
|
||||
n++;
|
||||
});
|
||||
return n;
|
||||
},
|
||||
toArray: function (children) {
|
||||
return (
|
||||
mapChildren(children, function (child) {
|
||||
return child;
|
||||
}) || []
|
||||
);
|
||||
},
|
||||
only: function (children) {
|
||||
if (!isValidElement(children)) throw Error(formatProdErrorMessage(143));
|
||||
return children;
|
||||
}
|
||||
};
|
||||
exports.Fragment = REACT_FRAGMENT_TYPE;
|
||||
exports.Profiler = REACT_PROFILER_TYPE;
|
||||
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
||||
exports.Suspense = REACT_SUSPENSE_TYPE;
|
||||
exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
|
||||
ReactSharedInternals;
|
||||
exports.cache = function (fn) {
|
||||
return function () {
|
||||
var dispatcher = ReactSharedInternals.A;
|
||||
if (!dispatcher) return fn.apply(null, arguments);
|
||||
var fnMap = dispatcher.getCacheForType(createCacheRoot);
|
||||
dispatcher = fnMap.get(fn);
|
||||
void 0 === dispatcher &&
|
||||
((dispatcher = createCacheNode()), fnMap.set(fn, dispatcher));
|
||||
fnMap = 0;
|
||||
for (var l = arguments.length; fnMap < l; fnMap++) {
|
||||
var arg = arguments[fnMap];
|
||||
if (
|
||||
"function" === typeof arg ||
|
||||
("object" === typeof arg && null !== arg)
|
||||
) {
|
||||
var objectCache = dispatcher.o;
|
||||
null === objectCache && (dispatcher.o = objectCache = new WeakMap());
|
||||
dispatcher = objectCache.get(arg);
|
||||
void 0 === dispatcher &&
|
||||
((dispatcher = createCacheNode()), objectCache.set(arg, dispatcher));
|
||||
} else
|
||||
(objectCache = dispatcher.p),
|
||||
null === objectCache && (dispatcher.p = objectCache = new Map()),
|
||||
(dispatcher = objectCache.get(arg)),
|
||||
void 0 === dispatcher &&
|
||||
((dispatcher = createCacheNode()),
|
||||
objectCache.set(arg, dispatcher));
|
||||
}
|
||||
if (1 === dispatcher.s) return dispatcher.v;
|
||||
if (2 === dispatcher.s) throw dispatcher.v;
|
||||
try {
|
||||
var result = fn.apply(null, arguments);
|
||||
fnMap = dispatcher;
|
||||
fnMap.s = 1;
|
||||
return (fnMap.v = result);
|
||||
} catch (error) {
|
||||
throw ((result = dispatcher), (result.s = 2), (result.v = error), error);
|
||||
}
|
||||
};
|
||||
};
|
||||
exports.captureOwnerStack = function () {
|
||||
return null;
|
||||
};
|
||||
exports.cloneElement = function (element, config, children) {
|
||||
if (null === element || void 0 === element)
|
||||
throw Error(formatProdErrorMessage(267, element));
|
||||
var props = assign({}, element.props),
|
||||
key = element.key,
|
||||
owner = void 0;
|
||||
if (null != config)
|
||||
for (propName in (void 0 !== config.ref && (owner = void 0),
|
||||
void 0 !== config.key && (key = "" + config.key),
|
||||
config))
|
||||
!hasOwnProperty.call(config, propName) ||
|
||||
"key" === propName ||
|
||||
"__self" === propName ||
|
||||
"__source" === propName ||
|
||||
("ref" === propName && void 0 === config.ref) ||
|
||||
(props[propName] = config[propName]);
|
||||
var propName = arguments.length - 2;
|
||||
if (1 === propName) props.children = children;
|
||||
else if (1 < propName) {
|
||||
for (var childArray = Array(propName), i = 0; i < propName; i++)
|
||||
childArray[i] = arguments[i + 2];
|
||||
props.children = childArray;
|
||||
}
|
||||
return ReactElement(element.type, key, void 0, void 0, owner, props);
|
||||
};
|
||||
exports.createElement = function (type, config, children) {
|
||||
var propName,
|
||||
props = {},
|
||||
key = null;
|
||||
if (null != config)
|
||||
for (propName in (void 0 !== config.key && (key = "" + config.key), config))
|
||||
hasOwnProperty.call(config, propName) &&
|
||||
"key" !== propName &&
|
||||
"__self" !== propName &&
|
||||
"__source" !== propName &&
|
||||
(props[propName] = config[propName]);
|
||||
var childrenLength = arguments.length - 2;
|
||||
if (1 === childrenLength) props.children = children;
|
||||
else if (1 < childrenLength) {
|
||||
for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
|
||||
childArray[i] = arguments[i + 2];
|
||||
props.children = childArray;
|
||||
}
|
||||
if (type && type.defaultProps)
|
||||
for (propName in ((childrenLength = type.defaultProps), childrenLength))
|
||||
void 0 === props[propName] &&
|
||||
(props[propName] = childrenLength[propName]);
|
||||
return ReactElement(type, key, void 0, void 0, null, props);
|
||||
};
|
||||
exports.createRef = function () {
|
||||
return { current: null };
|
||||
};
|
||||
exports.forwardRef = function (render) {
|
||||
return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
|
||||
};
|
||||
exports.isValidElement = isValidElement;
|
||||
exports.lazy = function (ctor) {
|
||||
return {
|
||||
$$typeof: REACT_LAZY_TYPE,
|
||||
_payload: { _status: -1, _result: ctor },
|
||||
_init: lazyInitializer
|
||||
};
|
||||
};
|
||||
exports.memo = function (type, compare) {
|
||||
return {
|
||||
$$typeof: REACT_MEMO_TYPE,
|
||||
type: type,
|
||||
compare: void 0 === compare ? null : compare
|
||||
};
|
||||
};
|
||||
exports.use = function (usable) {
|
||||
return ReactSharedInternals.H.use(usable);
|
||||
};
|
||||
exports.useCallback = function (callback, deps) {
|
||||
return ReactSharedInternals.H.useCallback(callback, deps);
|
||||
};
|
||||
exports.useDebugValue = function () {};
|
||||
exports.useId = function () {
|
||||
return ReactSharedInternals.H.useId();
|
||||
};
|
||||
exports.useMemo = function (create, deps) {
|
||||
return ReactSharedInternals.H.useMemo(create, deps);
|
||||
};
|
||||
exports.version = "19.1.0";
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"B","2":"K D mC","66":"E F A"},B:{"1":"0 9 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 8 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":"1 2 3 4 nC LC J PB K D E F A B C L M G N O P QB qC rC","66":"5 6 7"},D:{"1":"0 9 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","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"},E:{"1":"D E F A B C L M G vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB K sC SC tC uC"},F:{"1":"0 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 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 G 4C","66":"B C 5C 6C 7C FC kC 8C GC"},G:{"1":"E 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","2":"SC 9C lC"},H:{"1":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"1":"A","2":"D"},K:{"1":"H GC","2":"A B C FC kC"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"B","66":"A"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:6,C:"TLS 1.2",D:true};
|
||||
@@ -0,0 +1,15 @@
|
||||
# Installation
|
||||
> `npm install --save @types/babel__core`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for @babel/core (https://github.com/babel/babel/tree/master/packages/babel-core).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__core.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Mon, 20 Nov 2023 23:36:23 GMT
|
||||
* Dependencies: [@babel/parser](https://npmjs.com/package/@babel/parser), [@babel/types](https://npmjs.com/package/@babel/types), [@types/babel__generator](https://npmjs.com/package/@types/babel__generator), [@types/babel__template](https://npmjs.com/package/@types/babel__template), [@types/babel__traverse](https://npmjs.com/package/@types/babel__traverse)
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Troy Gerwien](https://github.com/yortus), [Marvin Hagemeister](https://github.com/marvinhagemeister), [Melvin Groenhoff](https://github.com/mgroenhoff), [Jessica Franco](https://github.com/Jessidhia), and [Ifiok Jr.](https://github.com/ifiokjr).
|
||||
@@ -0,0 +1,177 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
@@ -0,0 +1,119 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _index = require("./path/index.js");
|
||||
var _t = require("@babel/types");
|
||||
var _context = require("./path/context.js");
|
||||
const {
|
||||
VISITOR_KEYS
|
||||
} = _t;
|
||||
class TraversalContext {
|
||||
constructor(scope, opts, state, parentPath) {
|
||||
this.queue = null;
|
||||
this.priorityQueue = null;
|
||||
this.parentPath = parentPath;
|
||||
this.scope = scope;
|
||||
this.state = state;
|
||||
this.opts = opts;
|
||||
}
|
||||
shouldVisit(node) {
|
||||
const opts = this.opts;
|
||||
if (opts.enter || opts.exit) return true;
|
||||
if (opts[node.type]) return true;
|
||||
const keys = VISITOR_KEYS[node.type];
|
||||
if (!(keys != null && keys.length)) return false;
|
||||
for (const key of keys) {
|
||||
if (node[key]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
create(node, container, key, listKey) {
|
||||
return _index.default.get({
|
||||
parentPath: this.parentPath,
|
||||
parent: node,
|
||||
container,
|
||||
key: key,
|
||||
listKey
|
||||
});
|
||||
}
|
||||
maybeQueue(path, notPriority) {
|
||||
if (this.queue) {
|
||||
if (notPriority) {
|
||||
this.queue.push(path);
|
||||
} else {
|
||||
this.priorityQueue.push(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
visitMultiple(container, parent, listKey) {
|
||||
if (container.length === 0) return false;
|
||||
const queue = [];
|
||||
for (let key = 0; key < container.length; key++) {
|
||||
const node = container[key];
|
||||
if (node && this.shouldVisit(node)) {
|
||||
queue.push(this.create(parent, container, key, listKey));
|
||||
}
|
||||
}
|
||||
return this.visitQueue(queue);
|
||||
}
|
||||
visitSingle(node, key) {
|
||||
if (this.shouldVisit(node[key])) {
|
||||
return this.visitQueue([this.create(node, node, key)]);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
visitQueue(queue) {
|
||||
this.queue = queue;
|
||||
this.priorityQueue = [];
|
||||
const visited = new WeakSet();
|
||||
let stop = false;
|
||||
let visitIndex = 0;
|
||||
for (; visitIndex < queue.length;) {
|
||||
const path = queue[visitIndex];
|
||||
visitIndex++;
|
||||
_context.resync.call(path);
|
||||
if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) {
|
||||
_context.pushContext.call(path, this);
|
||||
}
|
||||
if (path.key === null) continue;
|
||||
const {
|
||||
node
|
||||
} = path;
|
||||
if (visited.has(node)) continue;
|
||||
if (node) visited.add(node);
|
||||
if (path.visit()) {
|
||||
stop = true;
|
||||
break;
|
||||
}
|
||||
if (this.priorityQueue.length) {
|
||||
stop = this.visitQueue(this.priorityQueue);
|
||||
this.priorityQueue = [];
|
||||
this.queue = queue;
|
||||
if (stop) break;
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < visitIndex; i++) {
|
||||
_context.popContext.call(queue[i]);
|
||||
}
|
||||
this.queue = null;
|
||||
return stop;
|
||||
}
|
||||
visit(node, key) {
|
||||
const nodes = node[key];
|
||||
if (!nodes) return false;
|
||||
if (Array.isArray(nodes)) {
|
||||
return this.visitMultiple(nodes, node, key);
|
||||
} else {
|
||||
return this.visitSingle(node, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.default = TraversalContext;
|
||||
|
||||
//# sourceMappingURL=context.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"2":"0 9 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"nC LC J PB K D E F A B C L M 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:{"1":"EC"},N:{"2":"A B"},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:{"1":"qD rD"}},B:4,C:"Proximity API",D:true};
|
||||
@@ -0,0 +1,103 @@
|
||||
'use strict';
|
||||
module.exports = function generate_if(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $thenSch = it.schema['then'],
|
||||
$elseSch = it.schema['else'],
|
||||
$thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)),
|
||||
$elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)),
|
||||
$currentBaseId = $it.baseId;
|
||||
if ($thenPresent || $elsePresent) {
|
||||
var $ifClause;
|
||||
$it.createErrors = false;
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = true; ';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
$it.createErrors = true;
|
||||
out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
if ($thenPresent) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$it.schema = it.schema['then'];
|
||||
$it.schemaPath = it.schemaPath + '.then';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/then';
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';
|
||||
if ($thenPresent && $elsePresent) {
|
||||
$ifClause = 'ifClause' + $lvl;
|
||||
out += ' var ' + ($ifClause) + ' = \'then\'; ';
|
||||
} else {
|
||||
$ifClause = '\'then\'';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($elsePresent) {
|
||||
out += ' else { ';
|
||||
}
|
||||
} else {
|
||||
out += ' if (!' + ($nextValid) + ') { ';
|
||||
}
|
||||
if ($elsePresent) {
|
||||
$it.schema = it.schema['else'];
|
||||
$it.schemaPath = it.schemaPath + '.else';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/else';
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';
|
||||
if ($thenPresent && $elsePresent) {
|
||||
$ifClause = 'ifClause' + $lvl;
|
||||
out += ' var ' + ($ifClause) + ' = \'else\'; ';
|
||||
} else {
|
||||
$ifClause = '\'else\'';
|
||||
}
|
||||
out += ' } ';
|
||||
}
|
||||
out += ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('if') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { failingKeyword: ' + ($ifClause) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should match "\' + ' + ($ifClause) + ' + \'" schema\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError(vErrors); ';
|
||||
} else {
|
||||
out += ' validate.errors = vErrors; return false; ';
|
||||
}
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
} else {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
Reference in New Issue
Block a user