update
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["exports","getModuleName","require"],"sources":["../../../src/transformation/file/babel-7-helpers.cjs"],"sourcesContent":["// TODO(Babel 8): Remove this file\n\nif (!process.env.BABEL_8_BREAKING) {\n exports.getModuleName = () =>\n require(\"@babel/helper-module-transforms\").getModuleName;\n} else if (process.env.IS_PUBLISH) {\n throw new Error(\n \"Internal Babel error: This file should only be loaded in Babel 7\",\n );\n}\n"],"mappings":"AAEmC;EACjCA,OAAO,CAACC,aAAa,GAAG,MACtBC,OAAO,CAAC,iCAAiC,CAAC,CAACD,aAAa;AAC5D;AAAC","ignoreList":[]}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_index","require","_inheritsComments","inherits","child","parent","key","INHERIT_KEYS","optional","Object","keys","force","inheritsComments"],"sources":["../../src/modifications/inherits.ts"],"sourcesContent":["import { INHERIT_KEYS } from \"../constants/index.ts\";\nimport inheritsComments from \"../comments/inheritsComments.ts\";\nimport type * as t from \"../index.ts\";\n\n/**\n * Inherit all contextual properties from `parent` node to `child` node.\n */\nexport default function inherits<T extends t.Node | null | undefined>(\n child: T,\n parent: t.Node | null | undefined,\n): T {\n if (!child || !parent) return child;\n\n // optionally inherit specific properties if not null\n for (const key of INHERIT_KEYS.optional) {\n // @ts-expect-error Fixme: refine parent types\n if (child[key] == null) {\n // @ts-expect-error Fixme: refine parent types\n child[key] = parent[key];\n }\n }\n\n // force inherit \"private\" properties\n for (const key of Object.keys(parent)) {\n if (key[0] === \"_\" && key !== \"__clone\") {\n // @ts-expect-error Fixme: refine parent types\n child[key] = parent[key];\n }\n }\n\n // force inherit select properties\n for (const key of INHERIT_KEYS.force) {\n // @ts-expect-error Fixme: refine parent types\n child[key] = parent[key];\n }\n\n inheritsComments(child, parent);\n\n return child;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAMe,SAASE,QAAQA,CAC9BC,KAAQ,EACRC,MAAiC,EAC9B;EACH,IAAI,CAACD,KAAK,IAAI,CAACC,MAAM,EAAE,OAAOD,KAAK;EAGnC,KAAK,MAAME,GAAG,IAAIC,mBAAY,CAACC,QAAQ,EAAE;IAEvC,IAAIJ,KAAK,CAACE,GAAG,CAAC,IAAI,IAAI,EAAE;MAEtBF,KAAK,CAACE,GAAG,CAAC,GAAGD,MAAM,CAACC,GAAG,CAAC;IAC1B;EACF;EAGA,KAAK,MAAMA,GAAG,IAAIG,MAAM,CAACC,IAAI,CAACL,MAAM,CAAC,EAAE;IACrC,IAAIC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAIA,GAAG,KAAK,SAAS,EAAE;MAEvCF,KAAK,CAACE,GAAG,CAAC,GAAGD,MAAM,CAACC,GAAG,CAAC;IAC1B;EACF;EAGA,KAAK,MAAMA,GAAG,IAAIC,mBAAY,CAACI,KAAK,EAAE;IAEpCP,KAAK,CAACE,GAAG,CAAC,GAAGD,MAAM,CAACC,GAAG,CAAC;EAC1B;EAEA,IAAAM,yBAAgB,EAACR,KAAK,EAAEC,MAAM,CAAC;EAE/B,OAAOD,KAAK;AACd","ignoreList":[]}
|
||||
@@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
var KEYWORDS = [
|
||||
'multipleOf',
|
||||
'maximum',
|
||||
'exclusiveMaximum',
|
||||
'minimum',
|
||||
'exclusiveMinimum',
|
||||
'maxLength',
|
||||
'minLength',
|
||||
'pattern',
|
||||
'additionalItems',
|
||||
'maxItems',
|
||||
'minItems',
|
||||
'uniqueItems',
|
||||
'maxProperties',
|
||||
'minProperties',
|
||||
'required',
|
||||
'additionalProperties',
|
||||
'enum',
|
||||
'format',
|
||||
'const'
|
||||
];
|
||||
|
||||
module.exports = function (metaSchema, keywordsJsonPointers) {
|
||||
for (var i=0; i<keywordsJsonPointers.length; i++) {
|
||||
metaSchema = JSON.parse(JSON.stringify(metaSchema));
|
||||
var segments = keywordsJsonPointers[i].split('/');
|
||||
var keywords = metaSchema;
|
||||
var j;
|
||||
for (j=1; j<segments.length; j++)
|
||||
keywords = keywords[segments[j]];
|
||||
|
||||
for (j=0; j<KEYWORDS.length; j++) {
|
||||
var key = KEYWORDS[j];
|
||||
var schema = keywords[key];
|
||||
if (schema) {
|
||||
keywords[key] = {
|
||||
anyOf: [
|
||||
schema,
|
||||
{ $ref: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return metaSchema;
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
parserOptions:
|
||||
ecmaVersion: 6
|
||||
globals:
|
||||
beforeEach: false
|
||||
describe: false
|
||||
it: false
|
||||
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _classApplyDescriptorDestructureSet;
|
||||
function _classApplyDescriptorDestructureSet(receiver, descriptor) {
|
||||
if (descriptor.set) {
|
||||
if (!("__destrObj" in descriptor)) {
|
||||
descriptor.__destrObj = {
|
||||
set value(v) {
|
||||
descriptor.set.call(receiver, v);
|
||||
}
|
||||
};
|
||||
}
|
||||
return descriptor.__destrObj;
|
||||
} else {
|
||||
if (!descriptor.writable) {
|
||||
throw new TypeError("attempted to set read only private field");
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=classApplyDescriptorDestructureSet.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 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","2":"C"},C:{"1":"0 7 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 5 6 nC LC J PB K D E F A B C L M G N O P QB qC rC"},D:{"1":"0 9 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 SB TB UB VB WB XB YB ZB aB bB"},E:{"1":"A B C L M G TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB K D E F sC SC tC uC vC wC"},F:{"1":"0 7 8 RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 5 6 F B C G N O P QB 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"E SC 9C lC AD BD CD DD ED FD"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 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:"ES6 Generators",D:true};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,705 @@
|
||||
export type Platform = 'browser' | 'node' | 'neutral'
|
||||
export type Format = 'iife' | 'cjs' | 'esm'
|
||||
export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx'
|
||||
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
||||
export type Charset = 'ascii' | 'utf8'
|
||||
export type Drop = 'console' | 'debugger'
|
||||
|
||||
interface CommonOptions {
|
||||
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
||||
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'
|
||||
/** Documentation: https://esbuild.github.io/api/#legal-comments */
|
||||
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'
|
||||
/** Documentation: https://esbuild.github.io/api/#source-root */
|
||||
sourceRoot?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#sources-content */
|
||||
sourcesContent?: boolean
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#format */
|
||||
format?: Format
|
||||
/** Documentation: https://esbuild.github.io/api/#global-name */
|
||||
globalName?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#target */
|
||||
target?: string | string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#supported */
|
||||
supported?: Record<string, boolean>
|
||||
/** Documentation: https://esbuild.github.io/api/#platform */
|
||||
platform?: Platform
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||
mangleProps?: RegExp
|
||||
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||
reserveProps?: RegExp
|
||||
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||
mangleQuoted?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||
mangleCache?: Record<string, string | false>
|
||||
/** Documentation: https://esbuild.github.io/api/#drop */
|
||||
drop?: Drop[]
|
||||
/** Documentation: https://esbuild.github.io/api/#drop-labels */
|
||||
dropLabels?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||
minify?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||
minifyWhitespace?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||
minifyIdentifiers?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||
minifySyntax?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#line-limit */
|
||||
lineLimit?: number
|
||||
/** Documentation: https://esbuild.github.io/api/#charset */
|
||||
charset?: Charset
|
||||
/** Documentation: https://esbuild.github.io/api/#tree-shaking */
|
||||
treeShaking?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#ignore-annotations */
|
||||
ignoreAnnotations?: boolean
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx */
|
||||
jsx?: 'transform' | 'preserve' | 'automatic'
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-factory */
|
||||
jsxFactory?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-fragment */
|
||||
jsxFragment?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-import-source */
|
||||
jsxImportSource?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-development */
|
||||
jsxDev?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-side-effects */
|
||||
jsxSideEffects?: boolean
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#define */
|
||||
define?: { [key: string]: string }
|
||||
/** Documentation: https://esbuild.github.io/api/#pure */
|
||||
pure?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#keep-names */
|
||||
keepNames?: boolean
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#color */
|
||||
color?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#log-level */
|
||||
logLevel?: LogLevel
|
||||
/** Documentation: https://esbuild.github.io/api/#log-limit */
|
||||
logLimit?: number
|
||||
/** Documentation: https://esbuild.github.io/api/#log-override */
|
||||
logOverride?: Record<string, LogLevel>
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#tsconfig-raw */
|
||||
tsconfigRaw?: string | TsconfigRaw
|
||||
}
|
||||
|
||||
export interface TsconfigRaw {
|
||||
compilerOptions?: {
|
||||
alwaysStrict?: boolean
|
||||
baseUrl?: string
|
||||
experimentalDecorators?: boolean
|
||||
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error'
|
||||
jsx?: 'preserve' | 'react-native' | 'react' | 'react-jsx' | 'react-jsxdev'
|
||||
jsxFactory?: string
|
||||
jsxFragmentFactory?: string
|
||||
jsxImportSource?: string
|
||||
paths?: Record<string, string[]>
|
||||
preserveValueImports?: boolean
|
||||
strict?: boolean
|
||||
target?: string
|
||||
useDefineForClassFields?: boolean
|
||||
verbatimModuleSyntax?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export interface BuildOptions extends CommonOptions {
|
||||
/** Documentation: https://esbuild.github.io/api/#bundle */
|
||||
bundle?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#splitting */
|
||||
splitting?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#preserve-symlinks */
|
||||
preserveSymlinks?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#outfile */
|
||||
outfile?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#metafile */
|
||||
metafile?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#outdir */
|
||||
outdir?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#outbase */
|
||||
outbase?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#external */
|
||||
external?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#packages */
|
||||
packages?: 'bundle' | 'external'
|
||||
/** Documentation: https://esbuild.github.io/api/#alias */
|
||||
alias?: Record<string, string>
|
||||
/** Documentation: https://esbuild.github.io/api/#loader */
|
||||
loader?: { [ext: string]: Loader }
|
||||
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
||||
resolveExtensions?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
||||
mainFields?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#conditions */
|
||||
conditions?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#write */
|
||||
write?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#allow-overwrite */
|
||||
allowOverwrite?: boolean
|
||||
/** Documentation: https://esbuild.github.io/api/#tsconfig */
|
||||
tsconfig?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#out-extension */
|
||||
outExtension?: { [ext: string]: string }
|
||||
/** Documentation: https://esbuild.github.io/api/#public-path */
|
||||
publicPath?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#entry-names */
|
||||
entryNames?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#chunk-names */
|
||||
chunkNames?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#asset-names */
|
||||
assetNames?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#inject */
|
||||
inject?: string[]
|
||||
/** Documentation: https://esbuild.github.io/api/#banner */
|
||||
banner?: { [type: string]: string }
|
||||
/** Documentation: https://esbuild.github.io/api/#footer */
|
||||
footer?: { [type: string]: string }
|
||||
/** Documentation: https://esbuild.github.io/api/#entry-points */
|
||||
entryPoints?: string[] | Record<string, string> | { in: string, out: string }[]
|
||||
/** Documentation: https://esbuild.github.io/api/#stdin */
|
||||
stdin?: StdinOptions
|
||||
/** Documentation: https://esbuild.github.io/plugins/ */
|
||||
plugins?: Plugin[]
|
||||
/** Documentation: https://esbuild.github.io/api/#working-directory */
|
||||
absWorkingDir?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#node-paths */
|
||||
nodePaths?: string[]; // The "NODE_PATH" variable from Node.js
|
||||
}
|
||||
|
||||
export interface StdinOptions {
|
||||
contents: string | Uint8Array
|
||||
resolveDir?: string
|
||||
sourcefile?: string
|
||||
loader?: Loader
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
id: string
|
||||
pluginName: string
|
||||
text: string
|
||||
location: Location | null
|
||||
notes: Note[]
|
||||
|
||||
/**
|
||||
* Optional user-specified data that is passed through unmodified. You can
|
||||
* use this to stash the original error, for example.
|
||||
*/
|
||||
detail: any
|
||||
}
|
||||
|
||||
export interface Note {
|
||||
text: string
|
||||
location: Location | null
|
||||
}
|
||||
|
||||
export interface Location {
|
||||
file: string
|
||||
namespace: string
|
||||
/** 1-based */
|
||||
line: number
|
||||
/** 0-based, in bytes */
|
||||
column: number
|
||||
/** in bytes */
|
||||
length: number
|
||||
lineText: string
|
||||
suggestion: string
|
||||
}
|
||||
|
||||
export interface OutputFile {
|
||||
path: string
|
||||
contents: Uint8Array
|
||||
hash: string
|
||||
/** "contents" as text (changes automatically with "contents") */
|
||||
readonly text: string
|
||||
}
|
||||
|
||||
export interface BuildResult<ProvidedOptions extends BuildOptions = BuildOptions> {
|
||||
errors: Message[]
|
||||
warnings: Message[]
|
||||
/** Only when "write: false" */
|
||||
outputFiles: OutputFile[] | (ProvidedOptions['write'] extends false ? never : undefined)
|
||||
/** Only when "metafile: true" */
|
||||
metafile: Metafile | (ProvidedOptions['metafile'] extends true ? never : undefined)
|
||||
/** Only when "mangleCache" is present */
|
||||
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
||||
}
|
||||
|
||||
export interface BuildFailure extends Error {
|
||||
errors: Message[]
|
||||
warnings: Message[]
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#serve-arguments */
|
||||
export interface ServeOptions {
|
||||
port?: number
|
||||
host?: string
|
||||
servedir?: string
|
||||
keyfile?: string
|
||||
certfile?: string
|
||||
fallback?: string
|
||||
onRequest?: (args: ServeOnRequestArgs) => void
|
||||
}
|
||||
|
||||
export interface ServeOnRequestArgs {
|
||||
remoteAddress: string
|
||||
method: string
|
||||
path: string
|
||||
status: number
|
||||
/** The time to generate the response, not to send it */
|
||||
timeInMS: number
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#serve-return-values */
|
||||
export interface ServeResult {
|
||||
port: number
|
||||
hosts: string[]
|
||||
}
|
||||
|
||||
export interface TransformOptions extends CommonOptions {
|
||||
/** Documentation: https://esbuild.github.io/api/#sourcefile */
|
||||
sourcefile?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#loader */
|
||||
loader?: Loader
|
||||
/** Documentation: https://esbuild.github.io/api/#banner */
|
||||
banner?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#footer */
|
||||
footer?: string
|
||||
}
|
||||
|
||||
export interface TransformResult<ProvidedOptions extends TransformOptions = TransformOptions> {
|
||||
code: string
|
||||
map: string
|
||||
warnings: Message[]
|
||||
/** Only when "mangleCache" is present */
|
||||
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
||||
/** Only when "legalComments" is "external" */
|
||||
legalComments: string | (ProvidedOptions['legalComments'] extends 'external' ? never : undefined)
|
||||
}
|
||||
|
||||
export interface TransformFailure extends Error {
|
||||
errors: Message[]
|
||||
warnings: Message[]
|
||||
}
|
||||
|
||||
export interface Plugin {
|
||||
name: string
|
||||
setup: (build: PluginBuild) => (void | Promise<void>)
|
||||
}
|
||||
|
||||
export interface PluginBuild {
|
||||
/** Documentation: https://esbuild.github.io/plugins/#build-options */
|
||||
initialOptions: BuildOptions
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#resolve */
|
||||
resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-start */
|
||||
onStart(callback: () =>
|
||||
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-end */
|
||||
onEnd(callback: (result: BuildResult) =>
|
||||
(OnEndResult | null | void | Promise<OnEndResult | null | void>)): void
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-resolve */
|
||||
onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
|
||||
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-load */
|
||||
onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
|
||||
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-dispose */
|
||||
onDispose(callback: () => void): void
|
||||
|
||||
// This is a full copy of the esbuild library in case you need it
|
||||
esbuild: {
|
||||
context: typeof context,
|
||||
build: typeof build,
|
||||
buildSync: typeof buildSync,
|
||||
transform: typeof transform,
|
||||
transformSync: typeof transformSync,
|
||||
formatMessages: typeof formatMessages,
|
||||
formatMessagesSync: typeof formatMessagesSync,
|
||||
analyzeMetafile: typeof analyzeMetafile,
|
||||
analyzeMetafileSync: typeof analyzeMetafileSync,
|
||||
initialize: typeof initialize,
|
||||
version: typeof version,
|
||||
}
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#resolve-options */
|
||||
export interface ResolveOptions {
|
||||
pluginName?: string
|
||||
importer?: string
|
||||
namespace?: string
|
||||
resolveDir?: string
|
||||
kind?: ImportKind
|
||||
pluginData?: any
|
||||
with?: Record<string, string>
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#resolve-results */
|
||||
export interface ResolveResult {
|
||||
errors: Message[]
|
||||
warnings: Message[]
|
||||
|
||||
path: string
|
||||
external: boolean
|
||||
sideEffects: boolean
|
||||
namespace: string
|
||||
suffix: string
|
||||
pluginData: any
|
||||
}
|
||||
|
||||
export interface OnStartResult {
|
||||
errors?: PartialMessage[]
|
||||
warnings?: PartialMessage[]
|
||||
}
|
||||
|
||||
export interface OnEndResult {
|
||||
errors?: PartialMessage[]
|
||||
warnings?: PartialMessage[]
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-options */
|
||||
export interface OnResolveOptions {
|
||||
filter: RegExp
|
||||
namespace?: string
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-arguments */
|
||||
export interface OnResolveArgs {
|
||||
path: string
|
||||
importer: string
|
||||
namespace: string
|
||||
resolveDir: string
|
||||
kind: ImportKind
|
||||
pluginData: any
|
||||
with: Record<string, string>
|
||||
}
|
||||
|
||||
export type ImportKind =
|
||||
| 'entry-point'
|
||||
|
||||
// JS
|
||||
| 'import-statement'
|
||||
| 'require-call'
|
||||
| 'dynamic-import'
|
||||
| 'require-resolve'
|
||||
|
||||
// CSS
|
||||
| 'import-rule'
|
||||
| 'composes-from'
|
||||
| 'url-token'
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */
|
||||
export interface OnResolveResult {
|
||||
pluginName?: string
|
||||
|
||||
errors?: PartialMessage[]
|
||||
warnings?: PartialMessage[]
|
||||
|
||||
path?: string
|
||||
external?: boolean
|
||||
sideEffects?: boolean
|
||||
namespace?: string
|
||||
suffix?: string
|
||||
pluginData?: any
|
||||
|
||||
watchFiles?: string[]
|
||||
watchDirs?: string[]
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-load-options */
|
||||
export interface OnLoadOptions {
|
||||
filter: RegExp
|
||||
namespace?: string
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-load-arguments */
|
||||
export interface OnLoadArgs {
|
||||
path: string
|
||||
namespace: string
|
||||
suffix: string
|
||||
pluginData: any
|
||||
with: Record<string, string>
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-load-results */
|
||||
export interface OnLoadResult {
|
||||
pluginName?: string
|
||||
|
||||
errors?: PartialMessage[]
|
||||
warnings?: PartialMessage[]
|
||||
|
||||
contents?: string | Uint8Array
|
||||
resolveDir?: string
|
||||
loader?: Loader
|
||||
pluginData?: any
|
||||
|
||||
watchFiles?: string[]
|
||||
watchDirs?: string[]
|
||||
}
|
||||
|
||||
export interface PartialMessage {
|
||||
id?: string
|
||||
pluginName?: string
|
||||
text?: string
|
||||
location?: Partial<Location> | null
|
||||
notes?: PartialNote[]
|
||||
detail?: any
|
||||
}
|
||||
|
||||
export interface PartialNote {
|
||||
text?: string
|
||||
location?: Partial<Location> | null
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#metafile */
|
||||
export interface Metafile {
|
||||
inputs: {
|
||||
[path: string]: {
|
||||
bytes: number
|
||||
imports: {
|
||||
path: string
|
||||
kind: ImportKind
|
||||
external?: boolean
|
||||
original?: string
|
||||
with?: Record<string, string>
|
||||
}[]
|
||||
format?: 'cjs' | 'esm'
|
||||
with?: Record<string, string>
|
||||
}
|
||||
}
|
||||
outputs: {
|
||||
[path: string]: {
|
||||
bytes: number
|
||||
inputs: {
|
||||
[path: string]: {
|
||||
bytesInOutput: number
|
||||
}
|
||||
}
|
||||
imports: {
|
||||
path: string
|
||||
kind: ImportKind | 'file-loader'
|
||||
external?: boolean
|
||||
}[]
|
||||
exports: string[]
|
||||
entryPoint?: string
|
||||
cssBundle?: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface FormatMessagesOptions {
|
||||
kind: 'error' | 'warning'
|
||||
color?: boolean
|
||||
terminalWidth?: number
|
||||
}
|
||||
|
||||
export interface AnalyzeMetafileOptions {
|
||||
color?: boolean
|
||||
verbose?: boolean
|
||||
}
|
||||
|
||||
export interface WatchOptions {
|
||||
}
|
||||
|
||||
export interface BuildContext<ProvidedOptions extends BuildOptions = BuildOptions> {
|
||||
/** Documentation: https://esbuild.github.io/api/#rebuild */
|
||||
rebuild(): Promise<BuildResult<ProvidedOptions>>
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#watch */
|
||||
watch(options?: WatchOptions): Promise<void>
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#serve */
|
||||
serve(options?: ServeOptions): Promise<ServeResult>
|
||||
|
||||
cancel(): Promise<void>
|
||||
dispose(): Promise<void>
|
||||
}
|
||||
|
||||
// This is a TypeScript type-level function which replaces any keys in "In"
|
||||
// that aren't in "Out" with "never". We use this to reject properties with
|
||||
// typos in object literals. See: https://stackoverflow.com/questions/49580725
|
||||
type SameShape<Out, In extends Out> = In & { [Key in Exclude<keyof In, keyof Out>]: never }
|
||||
|
||||
/**
|
||||
* This function invokes the "esbuild" command-line tool for you. It returns a
|
||||
* promise that either resolves with a "BuildResult" object or rejects with a
|
||||
* "BuildFailure" object.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#build
|
||||
*/
|
||||
export declare function build<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildResult<T>>
|
||||
|
||||
/**
|
||||
* This is the advanced long-running form of "build" that supports additional
|
||||
* features such as watch mode and a local development server.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#build
|
||||
*/
|
||||
export declare function context<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildContext<T>>
|
||||
|
||||
/**
|
||||
* This function transforms a single JavaScript file. It can be used to minify
|
||||
* JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript
|
||||
* to older JavaScript. It returns a promise that is either resolved with a
|
||||
* "TransformResult" object or rejected with a "TransformFailure" object.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#transform
|
||||
*/
|
||||
export declare function transform<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): Promise<TransformResult<T>>
|
||||
|
||||
/**
|
||||
* Converts log messages to formatted message strings suitable for printing in
|
||||
* the terminal. This allows you to reuse the built-in behavior of esbuild's
|
||||
* log message formatter. This is a batch-oriented API for efficiency.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes
|
||||
*/
|
||||
export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>
|
||||
|
||||
/**
|
||||
* Pretty-prints an analysis of the metafile JSON to a string. This is just for
|
||||
* convenience to be able to match esbuild's pretty-printing exactly. If you want
|
||||
* to customize it, you can just inspect the data in the metafile yourself.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#analyze
|
||||
*/
|
||||
export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>
|
||||
|
||||
/**
|
||||
* A synchronous version of "build".
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#build
|
||||
*/
|
||||
export declare function buildSync<T extends BuildOptions>(options: SameShape<BuildOptions, T>): BuildResult<T>
|
||||
|
||||
/**
|
||||
* A synchronous version of "transform".
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#transform
|
||||
*/
|
||||
export declare function transformSync<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): TransformResult<T>
|
||||
|
||||
/**
|
||||
* A synchronous version of "formatMessages".
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*/
|
||||
export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]
|
||||
|
||||
/**
|
||||
* A synchronous version of "analyzeMetafile".
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#analyze
|
||||
*/
|
||||
export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string
|
||||
|
||||
/**
|
||||
* This configures the browser-based version of esbuild. It is necessary to
|
||||
* call this first and wait for the returned promise to be resolved before
|
||||
* making other API calls when using esbuild in the browser.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes ("options" is required)
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#browser
|
||||
*/
|
||||
export declare function initialize(options: InitializeOptions): Promise<void>
|
||||
|
||||
export interface InitializeOptions {
|
||||
/**
|
||||
* The URL of the "esbuild.wasm" file. This must be provided when running
|
||||
* esbuild in the browser.
|
||||
*/
|
||||
wasmURL?: string | URL
|
||||
|
||||
/**
|
||||
* The result of calling "new WebAssembly.Module(buffer)" where "buffer"
|
||||
* is a typed array or ArrayBuffer containing the binary code of the
|
||||
* "esbuild.wasm" file.
|
||||
*
|
||||
* You can use this as an alternative to "wasmURL" for environments where it's
|
||||
* not possible to download the WebAssembly module.
|
||||
*/
|
||||
wasmModule?: WebAssembly.Module
|
||||
|
||||
/**
|
||||
* By default esbuild runs the WebAssembly-based browser API in a web worker
|
||||
* to avoid blocking the UI thread. This can be disabled by setting "worker"
|
||||
* to false.
|
||||
*/
|
||||
worker?: boolean
|
||||
}
|
||||
|
||||
export let version: string
|
||||
|
||||
// Call this function to terminate esbuild's child process. The child process
|
||||
// is not terminated and re-created after each API call because it's more
|
||||
// efficient to keep it around when there are multiple API calls.
|
||||
//
|
||||
// In node this happens automatically before the parent node process exits. So
|
||||
// you only need to call this if you know you will not make any more esbuild
|
||||
// API calls and you want to clean up resources.
|
||||
//
|
||||
// Unlike node, Deno lacks the necessary APIs to clean up child processes
|
||||
// automatically. You must manually call stop() in Deno when you're done
|
||||
// using esbuild or Deno will continue running forever.
|
||||
//
|
||||
// Another reason you might want to call this is if you are using esbuild from
|
||||
// within a Deno test. Deno fails tests that create a child process without
|
||||
// killing it before the test ends, so you have to call this function (and
|
||||
// await the returned promise) in every Deno test that uses esbuild.
|
||||
export declare function stop(): Promise<void>
|
||||
|
||||
// Note: These declarations exist to avoid type errors when you omit "dom" from
|
||||
// "lib" in your "tsconfig.json" file. TypeScript confusingly declares the
|
||||
// global "WebAssembly" type in "lib.dom.d.ts" even though it has nothing to do
|
||||
// with the browser DOM and is present in many non-browser JavaScript runtimes
|
||||
// (e.g. node and deno). Declaring it here allows esbuild's API to be used in
|
||||
// these scenarios.
|
||||
//
|
||||
// There's an open issue about getting this problem corrected (although these
|
||||
// declarations will need to remain even if this is fixed for backward
|
||||
// compatibility with older TypeScript versions):
|
||||
//
|
||||
// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826
|
||||
//
|
||||
declare global {
|
||||
namespace WebAssembly {
|
||||
interface Module {
|
||||
}
|
||||
}
|
||||
interface URL {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.OptionValidator = void 0;
|
||||
var _findSuggestion = require("./find-suggestion.js");
|
||||
class OptionValidator {
|
||||
constructor(descriptor) {
|
||||
this.descriptor = descriptor;
|
||||
}
|
||||
validateTopLevelOptions(options, TopLevelOptionShape) {
|
||||
const validOptionNames = Object.keys(TopLevelOptionShape);
|
||||
for (const option of Object.keys(options)) {
|
||||
if (!validOptionNames.includes(option)) {
|
||||
throw new Error(this.formatMessage(`'${option}' is not a valid top-level option.
|
||||
- Did you mean '${(0, _findSuggestion.findSuggestion)(option, validOptionNames)}'?`));
|
||||
}
|
||||
}
|
||||
}
|
||||
validateBooleanOption(name, value, defaultValue) {
|
||||
if (value === undefined) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
this.invariant(typeof value === "boolean", `'${name}' option must be a boolean.`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
validateStringOption(name, value, defaultValue) {
|
||||
if (value === undefined) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
this.invariant(typeof value === "string", `'${name}' option must be a string.`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
invariant(condition, message) {
|
||||
if (!condition) {
|
||||
throw new Error(this.formatMessage(message));
|
||||
}
|
||||
}
|
||||
formatMessage(message) {
|
||||
return `${this.descriptor}: ${message}`;
|
||||
}
|
||||
}
|
||||
exports.OptionValidator = OptionValidator;
|
||||
|
||||
//# sourceMappingURL=validator.js.map
|
||||
@@ -0,0 +1,82 @@
|
||||
module.exports = function (obj, opts) {
|
||||
if (!opts) opts = {};
|
||||
if (typeof opts === 'function') opts = { cmp: opts };
|
||||
var space = opts.space || '';
|
||||
if (typeof space === 'number') space = Array(space+1).join(' ');
|
||||
var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false;
|
||||
var replacer = opts.replacer || function(key, value) { return value; };
|
||||
|
||||
var cmp = opts.cmp && (function (f) {
|
||||
return function (node) {
|
||||
return function (a, b) {
|
||||
var aobj = { key: a, value: node[a] };
|
||||
var bobj = { key: b, value: node[b] };
|
||||
return f(aobj, bobj);
|
||||
};
|
||||
};
|
||||
})(opts.cmp);
|
||||
|
||||
var seen = [];
|
||||
return (function stringify (parent, key, node, level) {
|
||||
var indent = space ? ('\n' + new Array(level + 1).join(space)) : '';
|
||||
var colonSeparator = space ? ': ' : ':';
|
||||
|
||||
if (node && node.toJSON && typeof node.toJSON === 'function') {
|
||||
node = node.toJSON();
|
||||
}
|
||||
|
||||
node = replacer.call(parent, key, node);
|
||||
|
||||
if (node === undefined) {
|
||||
return;
|
||||
}
|
||||
if (typeof node !== 'object' || node === null) {
|
||||
return JSON.stringify(node);
|
||||
}
|
||||
if (isArray(node)) {
|
||||
var out = [];
|
||||
for (var i = 0; i < node.length; i++) {
|
||||
var item = stringify(node, i, node[i], level+1) || JSON.stringify(null);
|
||||
out.push(indent + space + item);
|
||||
}
|
||||
return '[' + out.join(',') + indent + ']';
|
||||
}
|
||||
else {
|
||||
if (seen.indexOf(node) !== -1) {
|
||||
if (cycles) return JSON.stringify('__cycle__');
|
||||
throw new TypeError('Converting circular structure to JSON');
|
||||
}
|
||||
else seen.push(node);
|
||||
|
||||
var keys = objectKeys(node).sort(cmp && cmp(node));
|
||||
var out = [];
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
var value = stringify(node, key, node[key], level+1);
|
||||
|
||||
if(!value) continue;
|
||||
|
||||
var keyValue = JSON.stringify(key)
|
||||
+ colonSeparator
|
||||
+ value;
|
||||
;
|
||||
out.push(indent + space + keyValue);
|
||||
}
|
||||
seen.splice(seen.indexOf(node), 1);
|
||||
return '{' + out.join(',') + indent + '}';
|
||||
}
|
||||
})({ '': obj }, '', obj, 0);
|
||||
};
|
||||
|
||||
var isArray = Array.isArray || function (x) {
|
||||
return {}.toString.call(x) === '[object Array]';
|
||||
};
|
||||
|
||||
var objectKeys = Object.keys || function (obj) {
|
||||
var has = Object.prototype.hasOwnProperty || function () { return true };
|
||||
var keys = [];
|
||||
for (var key in obj) {
|
||||
if (has.call(obj, key)) keys.push(key);
|
||||
}
|
||||
return keys;
|
||||
};
|
||||
@@ -0,0 +1,151 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/* Copyright 2015 Mozilla Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
||||
const DEFAULT_LINK_REL = 'noopener noreferrer nofollow';
|
||||
class LinkService {
|
||||
constructor() {
|
||||
this.externalLinkEnabled = true;
|
||||
this.externalLinkRel = undefined;
|
||||
this.externalLinkTarget = undefined;
|
||||
this.isInPresentationMode = false;
|
||||
this.pdfDocument = undefined;
|
||||
this.pdfViewer = undefined;
|
||||
}
|
||||
setDocument(pdfDocument) {
|
||||
this.pdfDocument = pdfDocument;
|
||||
}
|
||||
setViewer(pdfViewer) {
|
||||
this.pdfViewer = pdfViewer;
|
||||
}
|
||||
setExternalLinkRel(externalLinkRel) {
|
||||
this.externalLinkRel = externalLinkRel;
|
||||
}
|
||||
setExternalLinkTarget(externalLinkTarget) {
|
||||
this.externalLinkTarget = externalLinkTarget;
|
||||
}
|
||||
setHistory() {
|
||||
// Intentionally empty
|
||||
}
|
||||
get pagesCount() {
|
||||
return this.pdfDocument ? this.pdfDocument.numPages : 0;
|
||||
}
|
||||
get page() {
|
||||
(0, tiny_invariant_1.default)(this.pdfViewer, 'PDF viewer is not initialized.');
|
||||
return this.pdfViewer.currentPageNumber || 0;
|
||||
}
|
||||
set page(value) {
|
||||
(0, tiny_invariant_1.default)(this.pdfViewer, 'PDF viewer is not initialized.');
|
||||
this.pdfViewer.currentPageNumber = value;
|
||||
}
|
||||
get rotation() {
|
||||
return 0;
|
||||
}
|
||||
set rotation(_value) {
|
||||
// Intentionally empty
|
||||
}
|
||||
goToDestination(dest) {
|
||||
return new Promise((resolve) => {
|
||||
(0, tiny_invariant_1.default)(this.pdfDocument, 'PDF document not loaded.');
|
||||
(0, tiny_invariant_1.default)(dest, 'Destination is not specified.');
|
||||
if (typeof dest === 'string') {
|
||||
this.pdfDocument.getDestination(dest).then(resolve);
|
||||
}
|
||||
else if (Array.isArray(dest)) {
|
||||
resolve(dest);
|
||||
}
|
||||
else {
|
||||
dest.then(resolve);
|
||||
}
|
||||
}).then((explicitDest) => {
|
||||
(0, tiny_invariant_1.default)(Array.isArray(explicitDest), `"${explicitDest}" is not a valid destination array.`);
|
||||
const destRef = explicitDest[0];
|
||||
new Promise((resolve) => {
|
||||
(0, tiny_invariant_1.default)(this.pdfDocument, 'PDF document not loaded.');
|
||||
if (destRef instanceof Object) {
|
||||
this.pdfDocument
|
||||
.getPageIndex(destRef)
|
||||
.then((pageIndex) => {
|
||||
resolve(pageIndex);
|
||||
})
|
||||
.catch(() => {
|
||||
(0, tiny_invariant_1.default)(false, `"${destRef}" is not a valid page reference.`);
|
||||
});
|
||||
}
|
||||
else if (typeof destRef === 'number') {
|
||||
resolve(destRef);
|
||||
}
|
||||
else {
|
||||
(0, tiny_invariant_1.default)(false, `"${destRef}" is not a valid destination reference.`);
|
||||
}
|
||||
}).then((pageIndex) => {
|
||||
const pageNumber = pageIndex + 1;
|
||||
(0, tiny_invariant_1.default)(this.pdfViewer, 'PDF viewer is not initialized.');
|
||||
(0, tiny_invariant_1.default)(pageNumber >= 1 && pageNumber <= this.pagesCount, `"${pageNumber}" is not a valid page number.`);
|
||||
this.pdfViewer.scrollPageIntoView({
|
||||
dest: explicitDest,
|
||||
pageIndex,
|
||||
pageNumber,
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
navigateTo(dest) {
|
||||
this.goToDestination(dest);
|
||||
}
|
||||
goToPage(pageNumber) {
|
||||
const pageIndex = pageNumber - 1;
|
||||
(0, tiny_invariant_1.default)(this.pdfViewer, 'PDF viewer is not initialized.');
|
||||
(0, tiny_invariant_1.default)(pageNumber >= 1 && pageNumber <= this.pagesCount, `"${pageNumber}" is not a valid page number.`);
|
||||
this.pdfViewer.scrollPageIntoView({
|
||||
pageIndex,
|
||||
pageNumber,
|
||||
});
|
||||
}
|
||||
addLinkAttributes(link, url, newWindow) {
|
||||
link.href = url;
|
||||
link.rel = this.externalLinkRel || DEFAULT_LINK_REL;
|
||||
link.target = newWindow ? '_blank' : this.externalLinkTarget || '';
|
||||
}
|
||||
getDestinationHash() {
|
||||
return '#';
|
||||
}
|
||||
getAnchorUrl() {
|
||||
return '#';
|
||||
}
|
||||
setHash() {
|
||||
// Intentionally empty
|
||||
}
|
||||
executeNamedAction() {
|
||||
// Intentionally empty
|
||||
}
|
||||
cachePageRef() {
|
||||
// Intentionally empty
|
||||
}
|
||||
isPageVisible() {
|
||||
return true;
|
||||
}
|
||||
isPageCached() {
|
||||
return true;
|
||||
}
|
||||
executeSetOCGState() {
|
||||
// Intentionally empty
|
||||
}
|
||||
}
|
||||
exports.default = LinkService;
|
||||
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const resolveFrom = require('resolve-from');
|
||||
const parentModule = require('parent-module');
|
||||
|
||||
module.exports = moduleId => {
|
||||
if (typeof moduleId !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
const parentPath = parentModule(__filename);
|
||||
|
||||
const cwd = parentPath ? path.dirname(parentPath) : __dirname;
|
||||
const filePath = resolveFrom(cwd, moduleId);
|
||||
|
||||
const oldModule = require.cache[filePath];
|
||||
// Delete itself from module parent
|
||||
if (oldModule && oldModule.parent) {
|
||||
let i = oldModule.parent.children.length;
|
||||
|
||||
while (i--) {
|
||||
if (oldModule.parent.children[i].id === filePath) {
|
||||
oldModule.parent.children.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete require.cache[filePath]; // Delete module from cache
|
||||
|
||||
const parent = require.cache[parentPath]; // If `filePath` and `parentPath` are the same, cache will already be deleted so we won't get a memory leak in next step
|
||||
|
||||
// In case cache doesn't have parent, fall back to normal require
|
||||
return parent === undefined || parent.require === undefined ? require(filePath) : parent.require(filePath);
|
||||
};
|
||||
@@ -0,0 +1,58 @@
|
||||
const parse = require('./parse.js')
|
||||
|
||||
const diff = (version1, version2) => {
|
||||
const v1 = parse(version1, null, true)
|
||||
const v2 = parse(version2, null, true)
|
||||
const comparison = v1.compare(v2)
|
||||
|
||||
if (comparison === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
const v1Higher = comparison > 0
|
||||
const highVersion = v1Higher ? v1 : v2
|
||||
const lowVersion = v1Higher ? v2 : v1
|
||||
const highHasPre = !!highVersion.prerelease.length
|
||||
const lowHasPre = !!lowVersion.prerelease.length
|
||||
|
||||
if (lowHasPre && !highHasPre) {
|
||||
// Going from prerelease -> no prerelease requires some special casing
|
||||
|
||||
// If the low version has only a major, then it will always be a major
|
||||
// Some examples:
|
||||
// 1.0.0-1 -> 1.0.0
|
||||
// 1.0.0-1 -> 1.1.1
|
||||
// 1.0.0-1 -> 2.0.0
|
||||
if (!lowVersion.patch && !lowVersion.minor) {
|
||||
return 'major'
|
||||
}
|
||||
|
||||
// If the main part has no difference
|
||||
if (lowVersion.compareMain(highVersion) === 0) {
|
||||
if (lowVersion.minor && !lowVersion.patch) {
|
||||
return 'minor'
|
||||
}
|
||||
return 'patch'
|
||||
}
|
||||
}
|
||||
|
||||
// add the `pre` prefix if we are going to a prerelease version
|
||||
const prefix = highHasPre ? 'pre' : ''
|
||||
|
||||
if (v1.major !== v2.major) {
|
||||
return prefix + 'major'
|
||||
}
|
||||
|
||||
if (v1.minor !== v2.minor) {
|
||||
return prefix + 'minor'
|
||||
}
|
||||
|
||||
if (v1.patch !== v2.patch) {
|
||||
return prefix + 'patch'
|
||||
}
|
||||
|
||||
// high and low are preleases
|
||||
return 'prerelease'
|
||||
}
|
||||
|
||||
module.exports = diff
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_assertClassBrand","require","_classPrivateFieldSet2","privateMap","receiver","value","set","assertClassBrand"],"sources":["../../src/helpers/classPrivateFieldSet2.ts"],"sourcesContent":["/* @minVersion 7.24.0 */\n\nimport assertClassBrand from \"./assertClassBrand.ts\";\n\nexport default function _classPrivateFieldSet2(\n privateMap: WeakMap<any, any>,\n receiver: any,\n value: any,\n) {\n privateMap.set(assertClassBrand(privateMap, receiver), value);\n return value;\n}\n"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAEe,SAASC,sBAAsBA,CAC5CC,UAA6B,EAC7BC,QAAa,EACbC,KAAU,EACV;EACAF,UAAU,CAACG,GAAG,CAAC,IAAAC,yBAAgB,EAACJ,UAAU,EAAEC,QAAQ,CAAC,EAAEC,KAAK,CAAC;EAC7D,OAAOA,KAAK;AACd","ignoreList":[]}
|
||||
@@ -0,0 +1,19 @@
|
||||
# @babel/helper-validator-option
|
||||
|
||||
> Validate plugin/preset options
|
||||
|
||||
See our website [@babel/helper-validator-option](https://babeljs.io/docs/babel-helper-validator-option) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save @babel/helper-validator-option
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-validator-option
|
||||
```
|
||||
@@ -0,0 +1,21 @@
|
||||
const fs = require('fs')
|
||||
const paths = ['C:/libjpeg-turbo']
|
||||
|
||||
if (process.arch === 'x64') {
|
||||
paths.unshift('C:/libjpeg-turbo64')
|
||||
}
|
||||
|
||||
paths.forEach(function (path) {
|
||||
if (exists(path)) {
|
||||
process.stdout.write(path)
|
||||
process.exit()
|
||||
}
|
||||
})
|
||||
|
||||
function exists (path) {
|
||||
try {
|
||||
return fs.lstatSync(path).isDirectory()
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parse = void 0;
|
||||
exports.parseAsync = parseAsync;
|
||||
exports.parseSync = parseSync;
|
||||
function _gensync() {
|
||||
const data = require("gensync");
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _index = require("./config/index.js");
|
||||
var _index2 = require("./parser/index.js");
|
||||
var _normalizeOpts = require("./transformation/normalize-opts.js");
|
||||
var _rewriteStackTrace = require("./errors/rewrite-stack-trace.js");
|
||||
const parseRunner = _gensync()(function* parse(code, opts) {
|
||||
const config = yield* (0, _index.default)(opts);
|
||||
if (config === null) {
|
||||
return null;
|
||||
}
|
||||
return yield* (0, _index2.default)(config.passes, (0, _normalizeOpts.default)(config), code);
|
||||
});
|
||||
const parse = exports.parse = function parse(code, opts, callback) {
|
||||
if (typeof opts === "function") {
|
||||
callback = opts;
|
||||
opts = undefined;
|
||||
}
|
||||
if (callback === undefined) {
|
||||
{
|
||||
return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(code, opts);
|
||||
}
|
||||
}
|
||||
(0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.errback)(code, opts, callback);
|
||||
};
|
||||
function parseSync(...args) {
|
||||
return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(...args);
|
||||
}
|
||||
function parseAsync(...args) {
|
||||
return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.async)(...args);
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=parse.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"52":0.00173,"101":0.00173,"107":0.00173,"109":0.0069,"113":0.00173,"115":0.14153,"116":0.00345,"122":0.00173,"123":0.00518,"125":0.00518,"127":0.00173,"128":0.02244,"129":0.00345,"130":0.00173,"131":0.00518,"132":0.00173,"133":0.01036,"134":0.03625,"135":0.16915,"136":0.66796,"137":0.00173,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 102 103 104 105 106 108 110 111 112 114 117 118 119 120 121 124 126 138 139 140 3.5 3.6"},D:{"39":0.00173,"40":0.00173,"41":0.00173,"42":0.00173,"43":0.00173,"44":0.00173,"45":0.00173,"46":0.00173,"47":0.00863,"48":0.00173,"49":0.00518,"50":0.00173,"51":0.00173,"52":0.00173,"53":0.00173,"54":0.00173,"55":0.00345,"56":0.00345,"57":0.00173,"58":0.00345,"59":0.00173,"60":0.00173,"63":0.00173,"66":0.00173,"68":0.00173,"69":0.00345,"70":0.00173,"71":0.00173,"72":0.00173,"73":0.00518,"74":0.00173,"75":0.01208,"79":0.04142,"81":0.00173,"83":0.01036,"84":0.00173,"85":0.00345,"86":0.00518,"87":0.01553,"88":0.00173,"89":0.00345,"90":0.00173,"91":0.00173,"93":0.00863,"94":0.01036,"95":0.00173,"98":0.00345,"99":0.00345,"101":0.00173,"102":0.00173,"103":0.00863,"104":0.00345,"105":0.00173,"106":0.00345,"107":0.0069,"108":0.02244,"109":0.93204,"110":0.00518,"111":0.01381,"112":0.01036,"113":0.01036,"114":0.00345,"115":0.00518,"116":0.0397,"117":0.00173,"118":0.00345,"119":0.01208,"120":0.03625,"121":0.0069,"122":0.07077,"123":0.00863,"124":0.09493,"125":0.10701,"126":0.02762,"127":0.01036,"128":0.0466,"129":0.04315,"130":0.04315,"131":0.252,"132":0.28134,"133":3.1068,"134":5.49731,"135":0.0069,_:"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 61 62 64 65 67 76 77 78 80 92 96 97 100 136 137 138"},F:{"28":0.00173,"40":0.00173,"46":0.0069,"87":0.00518,"88":0.00173,"95":0.0069,"114":0.00345,"115":0.00173,"116":0.05351,"117":0.29687,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"18":0.00173,"89":0.0069,"92":0.00345,"102":0.00173,"109":0.02244,"114":0.0069,"119":0.00173,"120":0.00173,"121":0.00173,"122":0.00173,"123":0.0069,"125":0.00173,"126":0.0069,"127":0.00173,"128":0.00173,"129":0.00173,"130":0.01208,"131":0.01899,"132":0.05005,"133":0.34347,"134":0.79223,_:"12 13 14 15 16 17 79 80 81 83 84 85 86 87 88 90 91 93 94 95 96 97 98 99 100 101 103 104 105 106 107 108 110 111 112 113 115 116 117 118 124"},E:{"14":0.00518,_:"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","13.1":0.00863,"14.1":0.01208,"15.1":0.00518,"15.2-15.3":0.00345,"15.4":0.00345,"15.5":0.01208,"15.6":0.09148,"16.0":0.0069,"16.1":0.04833,"16.2":0.00345,"16.3":0.01899,"16.4":0.0069,"16.5":0.01381,"16.6":0.12772,"17.0":0.0069,"17.1":0.05523,"17.2":0.01036,"17.3":0.02416,"17.4":0.12427,"17.5":0.11909,"17.6":0.16742,"18.0":0.02934,"18.1":0.10183,"18.2":0.06559,"18.3":1.06667,"18.4":0.01726},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00676,"5.0-5.1":0,"6.0-6.1":0.02029,"7.0-7.1":0.01353,"8.1-8.4":0,"9.0-9.2":0.01014,"9.3":0.04734,"10.0-10.2":0.00338,"10.3":0.07778,"11.0-11.2":0.35845,"11.3-11.4":0.02367,"12.0-12.1":0.01353,"12.2-12.5":0.33478,"13.0-13.1":0.00676,"13.2":0.01014,"13.3":0.01353,"13.4-13.7":0.04734,"14.0-14.4":0.11836,"14.5-14.8":0.14203,"15.0-15.1":0.07778,"15.2-15.3":0.07778,"15.4":0.09468,"15.5":0.10821,"15.6-15.8":1.33234,"16.0":0.18937,"16.1":0.38888,"16.2":0.2029,"16.3":0.35168,"16.4":0.07778,"16.5":0.14541,"16.6-16.7":1.5792,"17.0":0.09468,"17.1":0.16908,"17.2":0.1285,"17.3":0.17922,"17.4":0.35845,"17.5":0.79805,"17.6-17.7":2.31638,"18.0":0.64926,"18.1":2.12363,"18.2":0.95023,"18.3":19.86004,"18.4":0.2942},P:{"4":0.10146,"20":0.03044,"21":0.01015,"22":0.02029,"23":0.03044,"24":0.06087,"25":0.05073,"26":0.1116,"27":2.50602,"5.0-5.4":0.01015,"6.2-6.4":0.01015,"7.2-7.4":0.08117,_:"8.2 9.2 10.1 12.0 13.0 15.0 16.0 17.0 18.0 19.0","11.1-11.2":0.01015,"14.0":0.04058},I:{"0":0.02477,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00003},K:{"0":0.20512,_:"10 11 12 11.1 11.5 12.1"},A:{"9":0.00173,"11":0.02589,_:"6 7 8 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.32269},Q:{_:"14.9"},O:{"0":0.01655},H:{"0":0.01},L:{"0":46.05753}};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_deepArray","require","Plugin","constructor","plugin","options","key","externalDependencies","finalize","manipulateOptions","post","pre","visitor","parserOverride","generatorOverride","name","exports","default"],"sources":["../../src/config/plugin.ts"],"sourcesContent":["import { finalize } from \"./helpers/deep-array.ts\";\nimport type { ReadonlyDeepArray } from \"./helpers/deep-array.ts\";\nimport type { PluginObject } from \"./validation/plugins.ts\";\n\nexport default class Plugin {\n key: string | undefined | null;\n manipulateOptions?: (options: unknown, parserOpts: unknown) => void;\n post?: PluginObject[\"post\"];\n pre?: PluginObject[\"pre\"];\n visitor: PluginObject[\"visitor\"];\n\n parserOverride?: Function;\n generatorOverride?: Function;\n\n options: object;\n\n externalDependencies: ReadonlyDeepArray<string>;\n\n constructor(\n plugin: PluginObject,\n options: object,\n key?: string,\n externalDependencies: ReadonlyDeepArray<string> = finalize([]),\n ) {\n this.key = plugin.name || key;\n\n this.manipulateOptions = plugin.manipulateOptions;\n this.post = plugin.post;\n this.pre = plugin.pre;\n this.visitor = plugin.visitor || {};\n this.parserOverride = plugin.parserOverride;\n this.generatorOverride = plugin.generatorOverride;\n\n this.options = options;\n this.externalDependencies = externalDependencies;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAIe,MAAMC,MAAM,CAAC;EAc1BC,WAAWA,CACTC,MAAoB,EACpBC,OAAe,EACfC,GAAY,EACZC,oBAA+C,GAAG,IAAAC,mBAAQ,EAAC,EAAE,CAAC,EAC9D;IAAA,KAlBFF,GAAG;IAAA,KACHG,iBAAiB;IAAA,KACjBC,IAAI;IAAA,KACJC,GAAG;IAAA,KACHC,OAAO;IAAA,KAEPC,cAAc;IAAA,KACdC,iBAAiB;IAAA,KAEjBT,OAAO;IAAA,KAEPE,oBAAoB;IAQlB,IAAI,CAACD,GAAG,GAAGF,MAAM,CAACW,IAAI,IAAIT,GAAG;IAE7B,IAAI,CAACG,iBAAiB,GAAGL,MAAM,CAACK,iBAAiB;IACjD,IAAI,CAACC,IAAI,GAAGN,MAAM,CAACM,IAAI;IACvB,IAAI,CAACC,GAAG,GAAGP,MAAM,CAACO,GAAG;IACrB,IAAI,CAACC,OAAO,GAAGR,MAAM,CAACQ,OAAO,IAAI,CAAC,CAAC;IACnC,IAAI,CAACC,cAAc,GAAGT,MAAM,CAACS,cAAc;IAC3C,IAAI,CAACC,iBAAiB,GAAGV,MAAM,CAACU,iBAAiB;IAEjD,IAAI,CAACT,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACE,oBAAoB,GAAGA,oBAAoB;EAClD;AACF;AAACS,OAAA,CAAAC,OAAA,GAAAf,MAAA;AAAA","ignoreList":[]}
|
||||
@@ -0,0 +1,235 @@
|
||||
import type { InferFileRouteTypes } from './fileRoute'
|
||||
import type { AddTrailingSlash, RemoveTrailingSlashes } from './link'
|
||||
import type { AnyRoute } from './route'
|
||||
import type { AnyRouter, TrailingSlashOption } from './router'
|
||||
import type { PartialMergeAll } from './utils'
|
||||
|
||||
export type ParseRoute<TRouteTree, TAcc = TRouteTree> = TRouteTree extends {
|
||||
types: { children: infer TChildren }
|
||||
}
|
||||
? unknown extends TChildren
|
||||
? TAcc
|
||||
: TChildren extends ReadonlyArray<any>
|
||||
? ParseRoute<TChildren[number], TAcc | TChildren[number]>
|
||||
: ParseRoute<
|
||||
TChildren[keyof TChildren],
|
||||
TAcc | TChildren[keyof TChildren]
|
||||
>
|
||||
: TAcc
|
||||
|
||||
export type ParseRouteWithoutBranches<TRouteTree> =
|
||||
ParseRoute<TRouteTree> extends infer TRoute extends AnyRoute
|
||||
? TRoute extends any
|
||||
? unknown extends TRoute['types']['children']
|
||||
? TRoute
|
||||
: TRoute['types']['children'] extends ReadonlyArray<any>
|
||||
? '/' extends TRoute['types']['children'][number]['path']
|
||||
? never
|
||||
: TRoute
|
||||
: '/' extends TRoute['types']['children'][keyof TRoute['types']['children']]['path']
|
||||
? never
|
||||
: TRoute
|
||||
: never
|
||||
: never
|
||||
|
||||
export type CodeRoutesById<TRouteTree extends AnyRoute> =
|
||||
ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute
|
||||
? {
|
||||
[K in TRoutes as K['id']]: K
|
||||
}
|
||||
: never
|
||||
|
||||
export type RoutesById<TRouteTree extends AnyRoute> =
|
||||
InferFileRouteTypes<TRouteTree> extends never
|
||||
? CodeRoutesById<TRouteTree>
|
||||
: InferFileRouteTypes<TRouteTree>['fileRoutesById']
|
||||
|
||||
export type RouteById<TRouteTree extends AnyRoute, TId> = Extract<
|
||||
RoutesById<TRouteTree>[TId & keyof RoutesById<TRouteTree>],
|
||||
AnyRoute
|
||||
>
|
||||
|
||||
export type CodeRouteIds<TRouteTree extends AnyRoute> =
|
||||
ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute
|
||||
? TRoutes['id']
|
||||
: never
|
||||
|
||||
export type RouteIds<TRouteTree extends AnyRoute> =
|
||||
InferFileRouteTypes<TRouteTree> extends never
|
||||
? CodeRouteIds<TRouteTree>
|
||||
: InferFileRouteTypes<TRouteTree>['id']
|
||||
|
||||
export type ParentPath<TRouter extends AnyRouter> =
|
||||
TrailingSlashOptionByRouter<TRouter> extends 'always'
|
||||
? '../'
|
||||
: TrailingSlashOptionByRouter<TRouter> extends 'never'
|
||||
? '..'
|
||||
: '../' | '..'
|
||||
|
||||
export type CurrentPath<TRouter extends AnyRouter> =
|
||||
TrailingSlashOptionByRouter<TRouter> extends 'always'
|
||||
? './'
|
||||
: TrailingSlashOptionByRouter<TRouter> extends 'never'
|
||||
? '.'
|
||||
: './' | '.'
|
||||
|
||||
export type ToPath<TRouter extends AnyRouter, TTo extends string> =
|
||||
TrailingSlashOptionByRouter<TRouter> extends 'always'
|
||||
? AddTrailingSlash<TTo>
|
||||
: TrailingSlashOptionByRouter<TRouter> extends 'never'
|
||||
? RemoveTrailingSlashes<TTo>
|
||||
: AddTrailingSlash<TTo> | RemoveTrailingSlashes<TTo>
|
||||
|
||||
export type CatchAllPaths<TRouter extends AnyRouter> =
|
||||
| CurrentPath<TRouter>
|
||||
| ParentPath<TRouter>
|
||||
|
||||
export type CodeRoutesByPath<TRouteTree extends AnyRoute> =
|
||||
ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute
|
||||
? {
|
||||
[K in TRoutes as K['fullPath']]: K
|
||||
}
|
||||
: never
|
||||
|
||||
export type RoutesByPath<TRouteTree extends AnyRoute> =
|
||||
InferFileRouteTypes<TRouteTree> extends never
|
||||
? CodeRoutesByPath<TRouteTree>
|
||||
: InferFileRouteTypes<TRouteTree>['fileRoutesByFullPath']
|
||||
|
||||
export type RouteByPath<TRouteTree extends AnyRoute, TPath> = Extract<
|
||||
RoutesByPath<TRouteTree>[TPath & keyof RoutesByPath<TRouteTree>],
|
||||
AnyRoute
|
||||
>
|
||||
|
||||
export type CodeRoutePaths<TRouteTree extends AnyRoute> =
|
||||
ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute
|
||||
? TRoutes['fullPath']
|
||||
: never
|
||||
|
||||
export type RoutePaths<TRouteTree extends AnyRoute> = unknown extends TRouteTree
|
||||
? string
|
||||
:
|
||||
| (InferFileRouteTypes<TRouteTree> extends never
|
||||
? CodeRoutePaths<TRouteTree>
|
||||
: InferFileRouteTypes<TRouteTree>['fullPaths'])
|
||||
| '/'
|
||||
|
||||
export type RouteToPathAlwaysTrailingSlash<TRoute extends AnyRoute> =
|
||||
TRoute['path'] extends '/'
|
||||
? TRoute['fullPath']
|
||||
: TRoute['fullPath'] extends '/'
|
||||
? TRoute['fullPath']
|
||||
: `${TRoute['fullPath']}/`
|
||||
|
||||
export type RouteToPathNeverTrailingSlash<TRoute extends AnyRoute> =
|
||||
TRoute['path'] extends '/'
|
||||
? TRoute['fullPath'] extends '/'
|
||||
? TRoute['fullPath']
|
||||
: RemoveTrailingSlashes<TRoute['fullPath']>
|
||||
: TRoute['fullPath']
|
||||
|
||||
export type RouteToPathPreserveTrailingSlash<TRoute extends AnyRoute> =
|
||||
| RouteToPathNeverTrailingSlash<TRoute>
|
||||
| RouteToPathAlwaysTrailingSlash<TRoute>
|
||||
|
||||
export type RouteToPathByTrailingSlashOption<TRoute extends AnyRoute> = {
|
||||
always: RouteToPathAlwaysTrailingSlash<TRoute>
|
||||
preserve: RouteToPathPreserveTrailingSlash<TRoute>
|
||||
never: RouteToPathNeverTrailingSlash<TRoute>
|
||||
}
|
||||
|
||||
export type TrailingSlashOptionByRouter<TRouter extends AnyRouter> =
|
||||
TrailingSlashOption extends TRouter['options']['trailingSlash']
|
||||
? 'never'
|
||||
: NonNullable<TRouter['options']['trailingSlash']>
|
||||
|
||||
export type RouteToByRouter<
|
||||
TRouter extends AnyRouter,
|
||||
TRoute extends AnyRoute,
|
||||
> = RouteToPathByTrailingSlashOption<TRoute>[TrailingSlashOptionByRouter<TRouter>]
|
||||
|
||||
export type CodeRouteToPath<TRouter extends AnyRouter> =
|
||||
ParseRouteWithoutBranches<TRouter['routeTree']> extends infer TRoute extends
|
||||
AnyRoute
|
||||
? TRoute extends any
|
||||
? RouteToByRouter<TRouter, TRoute>
|
||||
: never
|
||||
: never
|
||||
|
||||
export type FileRouteToPath<
|
||||
TRouter extends AnyRouter,
|
||||
TTo = InferFileRouteTypes<TRouter['routeTree']>['to'],
|
||||
TTrailingSlashOption = TrailingSlashOptionByRouter<TRouter>,
|
||||
> = 'never' extends TTrailingSlashOption
|
||||
? TTo
|
||||
: 'always' extends TTrailingSlashOption
|
||||
? AddTrailingSlash<TTo>
|
||||
: TTo | AddTrailingSlash<TTo>
|
||||
|
||||
export type RouteToPath<TRouter extends AnyRouter> = unknown extends TRouter
|
||||
? string
|
||||
: InferFileRouteTypes<TRouter['routeTree']> extends never
|
||||
? CodeRouteToPath<TRouter>
|
||||
: FileRouteToPath<TRouter>
|
||||
|
||||
export type CodeRoutesByToPath<TRouter extends AnyRouter> =
|
||||
ParseRouteWithoutBranches<TRouter['routeTree']> extends infer TRoutes extends
|
||||
AnyRoute
|
||||
? {
|
||||
[TRoute in TRoutes as RouteToByRouter<TRouter, TRoute>]: TRoute
|
||||
}
|
||||
: never
|
||||
|
||||
export type RoutesByToPath<TRouter extends AnyRouter> =
|
||||
InferFileRouteTypes<TRouter['routeTree']> extends never
|
||||
? CodeRoutesByToPath<TRouter>
|
||||
: InferFileRouteTypes<TRouter['routeTree']>['fileRoutesByTo']
|
||||
|
||||
export type CodeRouteByToPath<TRouter extends AnyRouter, TTo> = Extract<
|
||||
RoutesByToPath<TRouter>[TTo & keyof RoutesByToPath<TRouter>],
|
||||
AnyRoute
|
||||
>
|
||||
|
||||
export type FileRouteByToPath<TRouter extends AnyRouter, TTo> =
|
||||
'never' extends TrailingSlashOptionByRouter<TRouter>
|
||||
? CodeRouteByToPath<TRouter, TTo>
|
||||
: 'always' extends TrailingSlashOptionByRouter<TRouter>
|
||||
? TTo extends '/'
|
||||
? CodeRouteByToPath<TRouter, TTo>
|
||||
: TTo extends `${infer TPath}/`
|
||||
? CodeRouteByToPath<TRouter, TPath>
|
||||
: never
|
||||
: CodeRouteByToPath<
|
||||
TRouter,
|
||||
TTo extends '/' ? TTo : RemoveTrailingSlashes<TTo>
|
||||
>
|
||||
|
||||
export type RouteByToPath<TRouter extends AnyRouter, TTo> =
|
||||
InferFileRouteTypes<TRouter['routeTree']> extends never
|
||||
? CodeRouteByToPath<TRouter, TTo>
|
||||
: FileRouteByToPath<TRouter, TTo>
|
||||
|
||||
export type FullSearchSchema<TRouteTree extends AnyRoute> =
|
||||
ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute
|
||||
? PartialMergeAll<TRoutes['types']['fullSearchSchema']>
|
||||
: never
|
||||
|
||||
export type FullSearchSchemaInput<TRouteTree extends AnyRoute> =
|
||||
ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute
|
||||
? PartialMergeAll<TRoutes['types']['fullSearchSchemaInput']>
|
||||
: never
|
||||
|
||||
export type AllParams<TRouteTree extends AnyRoute> =
|
||||
ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute
|
||||
? PartialMergeAll<TRoutes['types']['allParams']>
|
||||
: never
|
||||
|
||||
export type AllContext<TRouteTree extends AnyRoute> =
|
||||
ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute
|
||||
? PartialMergeAll<TRoutes['types']['allContext']>
|
||||
: never
|
||||
|
||||
export type AllLoaderData<TRouteTree extends AnyRoute> =
|
||||
ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute
|
||||
? PartialMergeAll<TRoutes['types']['loaderData']>
|
||||
: never
|
||||
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.WHILE_TYPES = exports.USERWHITESPACABLE_TYPES = exports.UNARYLIKE_TYPES = exports.TYPESCRIPT_TYPES = exports.TSTYPE_TYPES = exports.TSTYPEELEMENT_TYPES = exports.TSENTITYNAME_TYPES = exports.TSBASETYPE_TYPES = exports.TERMINATORLESS_TYPES = exports.STATEMENT_TYPES = exports.STANDARDIZED_TYPES = exports.SCOPABLE_TYPES = exports.PUREISH_TYPES = exports.PROPERTY_TYPES = exports.PRIVATE_TYPES = exports.PATTERN_TYPES = exports.PATTERNLIKE_TYPES = exports.OBJECTMEMBER_TYPES = exports.MODULESPECIFIER_TYPES = exports.MODULEDECLARATION_TYPES = exports.MISCELLANEOUS_TYPES = exports.METHOD_TYPES = exports.LVAL_TYPES = exports.LOOP_TYPES = exports.LITERAL_TYPES = exports.JSX_TYPES = exports.IMPORTOREXPORTDECLARATION_TYPES = exports.IMMUTABLE_TYPES = exports.FUNCTION_TYPES = exports.FUNCTIONPARENT_TYPES = exports.FOR_TYPES = exports.FORXSTATEMENT_TYPES = exports.FLOW_TYPES = exports.FLOWTYPE_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.EXPRESSION_TYPES = exports.EXPRESSIONWRAPPER_TYPES = exports.EXPORTDECLARATION_TYPES = exports.ENUMMEMBER_TYPES = exports.ENUMBODY_TYPES = exports.DECLARATION_TYPES = exports.CONDITIONAL_TYPES = exports.COMPLETIONSTATEMENT_TYPES = exports.CLASS_TYPES = exports.BLOCK_TYPES = exports.BLOCKPARENT_TYPES = exports.BINARY_TYPES = exports.ACCESSOR_TYPES = void 0;
|
||||
var _index = require("../../definitions/index.js");
|
||||
const STANDARDIZED_TYPES = exports.STANDARDIZED_TYPES = _index.FLIPPED_ALIAS_KEYS["Standardized"];
|
||||
const EXPRESSION_TYPES = exports.EXPRESSION_TYPES = _index.FLIPPED_ALIAS_KEYS["Expression"];
|
||||
const BINARY_TYPES = exports.BINARY_TYPES = _index.FLIPPED_ALIAS_KEYS["Binary"];
|
||||
const SCOPABLE_TYPES = exports.SCOPABLE_TYPES = _index.FLIPPED_ALIAS_KEYS["Scopable"];
|
||||
const BLOCKPARENT_TYPES = exports.BLOCKPARENT_TYPES = _index.FLIPPED_ALIAS_KEYS["BlockParent"];
|
||||
const BLOCK_TYPES = exports.BLOCK_TYPES = _index.FLIPPED_ALIAS_KEYS["Block"];
|
||||
const STATEMENT_TYPES = exports.STATEMENT_TYPES = _index.FLIPPED_ALIAS_KEYS["Statement"];
|
||||
const TERMINATORLESS_TYPES = exports.TERMINATORLESS_TYPES = _index.FLIPPED_ALIAS_KEYS["Terminatorless"];
|
||||
const COMPLETIONSTATEMENT_TYPES = exports.COMPLETIONSTATEMENT_TYPES = _index.FLIPPED_ALIAS_KEYS["CompletionStatement"];
|
||||
const CONDITIONAL_TYPES = exports.CONDITIONAL_TYPES = _index.FLIPPED_ALIAS_KEYS["Conditional"];
|
||||
const LOOP_TYPES = exports.LOOP_TYPES = _index.FLIPPED_ALIAS_KEYS["Loop"];
|
||||
const WHILE_TYPES = exports.WHILE_TYPES = _index.FLIPPED_ALIAS_KEYS["While"];
|
||||
const EXPRESSIONWRAPPER_TYPES = exports.EXPRESSIONWRAPPER_TYPES = _index.FLIPPED_ALIAS_KEYS["ExpressionWrapper"];
|
||||
const FOR_TYPES = exports.FOR_TYPES = _index.FLIPPED_ALIAS_KEYS["For"];
|
||||
const FORXSTATEMENT_TYPES = exports.FORXSTATEMENT_TYPES = _index.FLIPPED_ALIAS_KEYS["ForXStatement"];
|
||||
const FUNCTION_TYPES = exports.FUNCTION_TYPES = _index.FLIPPED_ALIAS_KEYS["Function"];
|
||||
const FUNCTIONPARENT_TYPES = exports.FUNCTIONPARENT_TYPES = _index.FLIPPED_ALIAS_KEYS["FunctionParent"];
|
||||
const PUREISH_TYPES = exports.PUREISH_TYPES = _index.FLIPPED_ALIAS_KEYS["Pureish"];
|
||||
const DECLARATION_TYPES = exports.DECLARATION_TYPES = _index.FLIPPED_ALIAS_KEYS["Declaration"];
|
||||
const PATTERNLIKE_TYPES = exports.PATTERNLIKE_TYPES = _index.FLIPPED_ALIAS_KEYS["PatternLike"];
|
||||
const LVAL_TYPES = exports.LVAL_TYPES = _index.FLIPPED_ALIAS_KEYS["LVal"];
|
||||
const TSENTITYNAME_TYPES = exports.TSENTITYNAME_TYPES = _index.FLIPPED_ALIAS_KEYS["TSEntityName"];
|
||||
const LITERAL_TYPES = exports.LITERAL_TYPES = _index.FLIPPED_ALIAS_KEYS["Literal"];
|
||||
const IMMUTABLE_TYPES = exports.IMMUTABLE_TYPES = _index.FLIPPED_ALIAS_KEYS["Immutable"];
|
||||
const USERWHITESPACABLE_TYPES = exports.USERWHITESPACABLE_TYPES = _index.FLIPPED_ALIAS_KEYS["UserWhitespacable"];
|
||||
const METHOD_TYPES = exports.METHOD_TYPES = _index.FLIPPED_ALIAS_KEYS["Method"];
|
||||
const OBJECTMEMBER_TYPES = exports.OBJECTMEMBER_TYPES = _index.FLIPPED_ALIAS_KEYS["ObjectMember"];
|
||||
const PROPERTY_TYPES = exports.PROPERTY_TYPES = _index.FLIPPED_ALIAS_KEYS["Property"];
|
||||
const UNARYLIKE_TYPES = exports.UNARYLIKE_TYPES = _index.FLIPPED_ALIAS_KEYS["UnaryLike"];
|
||||
const PATTERN_TYPES = exports.PATTERN_TYPES = _index.FLIPPED_ALIAS_KEYS["Pattern"];
|
||||
const CLASS_TYPES = exports.CLASS_TYPES = _index.FLIPPED_ALIAS_KEYS["Class"];
|
||||
const IMPORTOREXPORTDECLARATION_TYPES = exports.IMPORTOREXPORTDECLARATION_TYPES = _index.FLIPPED_ALIAS_KEYS["ImportOrExportDeclaration"];
|
||||
const EXPORTDECLARATION_TYPES = exports.EXPORTDECLARATION_TYPES = _index.FLIPPED_ALIAS_KEYS["ExportDeclaration"];
|
||||
const MODULESPECIFIER_TYPES = exports.MODULESPECIFIER_TYPES = _index.FLIPPED_ALIAS_KEYS["ModuleSpecifier"];
|
||||
const ACCESSOR_TYPES = exports.ACCESSOR_TYPES = _index.FLIPPED_ALIAS_KEYS["Accessor"];
|
||||
const PRIVATE_TYPES = exports.PRIVATE_TYPES = _index.FLIPPED_ALIAS_KEYS["Private"];
|
||||
const FLOW_TYPES = exports.FLOW_TYPES = _index.FLIPPED_ALIAS_KEYS["Flow"];
|
||||
const FLOWTYPE_TYPES = exports.FLOWTYPE_TYPES = _index.FLIPPED_ALIAS_KEYS["FlowType"];
|
||||
const FLOWBASEANNOTATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = _index.FLIPPED_ALIAS_KEYS["FlowBaseAnnotation"];
|
||||
const FLOWDECLARATION_TYPES = exports.FLOWDECLARATION_TYPES = _index.FLIPPED_ALIAS_KEYS["FlowDeclaration"];
|
||||
const FLOWPREDICATE_TYPES = exports.FLOWPREDICATE_TYPES = _index.FLIPPED_ALIAS_KEYS["FlowPredicate"];
|
||||
const ENUMBODY_TYPES = exports.ENUMBODY_TYPES = _index.FLIPPED_ALIAS_KEYS["EnumBody"];
|
||||
const ENUMMEMBER_TYPES = exports.ENUMMEMBER_TYPES = _index.FLIPPED_ALIAS_KEYS["EnumMember"];
|
||||
const JSX_TYPES = exports.JSX_TYPES = _index.FLIPPED_ALIAS_KEYS["JSX"];
|
||||
const MISCELLANEOUS_TYPES = exports.MISCELLANEOUS_TYPES = _index.FLIPPED_ALIAS_KEYS["Miscellaneous"];
|
||||
const TYPESCRIPT_TYPES = exports.TYPESCRIPT_TYPES = _index.FLIPPED_ALIAS_KEYS["TypeScript"];
|
||||
const TSTYPEELEMENT_TYPES = exports.TSTYPEELEMENT_TYPES = _index.FLIPPED_ALIAS_KEYS["TSTypeElement"];
|
||||
const TSTYPE_TYPES = exports.TSTYPE_TYPES = _index.FLIPPED_ALIAS_KEYS["TSType"];
|
||||
const TSBASETYPE_TYPES = exports.TSBASETYPE_TYPES = _index.FLIPPED_ALIAS_KEYS["TSBaseType"];
|
||||
const MODULEDECLARATION_TYPES = exports.MODULEDECLARATION_TYPES = IMPORTOREXPORTDECLARATION_TYPES;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
Reference in New Issue
Block a user