update
This commit is contained in:
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M G N O P"},C:{"1":"0 9 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 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB qC rC"},D:{"1":"0 9 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","194":"SB TB UB VB WB XB YB ZB aB bB cB dB"},E:{"2":"J PB K D sC SC tC uC","260":"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"},F:{"1":"0 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 7 8 F B C G N O P QB RB 4C 5C 6C 7C FC kC 8C GC"},G:{"2":"SC 9C lC AD BD CD","260":"E 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:{"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 dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD","2":"J"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:4,C:"Blending of HTML/SVG elements",D:true};
|
||||
@@ -0,0 +1,97 @@
|
||||
export type PDFDocumentProxy = import("../src/display/api").PDFDocumentProxy;
|
||||
export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
|
||||
export type EventBus = import("./event_utils").EventBus;
|
||||
export type IPDFLinkService = import("./interfaces").IPDFLinkService;
|
||||
export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue;
|
||||
export type PDFThumbnailViewerOptions = {
|
||||
/**
|
||||
* - The container for the thumbnail
|
||||
* elements.
|
||||
*/
|
||||
container: HTMLDivElement;
|
||||
/**
|
||||
* - The application event bus.
|
||||
*/
|
||||
eventBus: EventBus;
|
||||
/**
|
||||
* - The navigation/linking service.
|
||||
*/
|
||||
linkService: IPDFLinkService;
|
||||
/**
|
||||
* - The rendering queue object.
|
||||
*/
|
||||
renderingQueue: PDFRenderingQueue;
|
||||
/**
|
||||
* - Overwrites background and foreground colors
|
||||
* with user defined ones in order to improve readability in high contrast
|
||||
* mode.
|
||||
*/
|
||||
pageColors?: Object | undefined;
|
||||
/**
|
||||
* - The AbortSignal for the window
|
||||
* events.
|
||||
*/
|
||||
abortSignal?: AbortSignal | undefined;
|
||||
/**
|
||||
* - Enables hardware acceleration for
|
||||
* rendering. The default value is `false`.
|
||||
*/
|
||||
enableHWA?: boolean | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} PDFThumbnailViewerOptions
|
||||
* @property {HTMLDivElement} container - The container for the thumbnail
|
||||
* elements.
|
||||
* @property {EventBus} eventBus - The application event bus.
|
||||
* @property {IPDFLinkService} linkService - The navigation/linking service.
|
||||
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
|
||||
* @property {Object} [pageColors] - Overwrites background and foreground colors
|
||||
* with user defined ones in order to improve readability in high contrast
|
||||
* mode.
|
||||
* @property {AbortSignal} [abortSignal] - The AbortSignal for the window
|
||||
* events.
|
||||
* @property {boolean} [enableHWA] - Enables hardware acceleration for
|
||||
* rendering. The default value is `false`.
|
||||
*/
|
||||
/**
|
||||
* Viewer control to display thumbnails for pages in a PDF document.
|
||||
*/
|
||||
export class PDFThumbnailViewer {
|
||||
/**
|
||||
* @param {PDFThumbnailViewerOptions} options
|
||||
*/
|
||||
constructor({ container, eventBus, linkService, renderingQueue, pageColors, abortSignal, enableHWA, }: PDFThumbnailViewerOptions);
|
||||
container: HTMLDivElement;
|
||||
eventBus: import("./event_utils").EventBus;
|
||||
linkService: import("./interfaces").IPDFLinkService;
|
||||
renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
|
||||
pageColors: Object | null;
|
||||
enableHWA: boolean;
|
||||
scroll: {
|
||||
right: boolean;
|
||||
down: boolean;
|
||||
lastX: any;
|
||||
lastY: any;
|
||||
_eventHandler: (evt: any) => void;
|
||||
};
|
||||
getThumbnail(index: any): any;
|
||||
scrollThumbnailIntoView(pageNumber: any): void;
|
||||
_currentPageNumber: any;
|
||||
set pagesRotation(rotation: any);
|
||||
get pagesRotation(): any;
|
||||
_pagesRotation: any;
|
||||
cleanup(): void;
|
||||
_thumbnails: any[] | undefined;
|
||||
_pageLabels: any[] | null | undefined;
|
||||
/**
|
||||
* @param {PDFDocumentProxy} pdfDocument
|
||||
*/
|
||||
setDocument(pdfDocument: PDFDocumentProxy): void;
|
||||
pdfDocument: import("../src/display/api").PDFDocumentProxy | undefined;
|
||||
/**
|
||||
* @param {Array|null} labels
|
||||
*/
|
||||
setPageLabels(labels: any[] | null): void;
|
||||
forceRendering(): boolean;
|
||||
#private;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import type { InferCustomEventPayload } from './customEvent'
|
||||
|
||||
export type ModuleNamespace = Record<string, any> & {
|
||||
[Symbol.toStringTag]: 'Module'
|
||||
}
|
||||
|
||||
export interface ViteHotContext {
|
||||
readonly data: any
|
||||
|
||||
accept(): void
|
||||
accept(cb: (mod: ModuleNamespace | undefined) => void): void
|
||||
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
|
||||
accept(
|
||||
deps: readonly string[],
|
||||
cb: (mods: Array<ModuleNamespace | undefined>) => void,
|
||||
): void
|
||||
|
||||
acceptExports(
|
||||
exportNames: string | readonly string[],
|
||||
cb?: (mod: ModuleNamespace | undefined) => void,
|
||||
): void
|
||||
|
||||
dispose(cb: (data: any) => void): void
|
||||
prune(cb: (data: any) => void): void
|
||||
invalidate(message?: string): void
|
||||
|
||||
on<T extends string>(
|
||||
event: T,
|
||||
cb: (payload: InferCustomEventPayload<T>) => void,
|
||||
): void
|
||||
off<T extends string>(
|
||||
event: T,
|
||||
cb: (payload: InferCustomEventPayload<T>) => void,
|
||||
): void
|
||||
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F mC","129":"A B"},B:{"1":"0 9 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","129":"C L","1025":"M G N O P"},C:{"2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB qC rC","513":"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 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"},D:{"1":"0 1 2 3 4 5 6 7 8 9 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","2":"J PB"},E:{"1":"PB K D E F A B C L M G tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J sC SC"},F:{"1":"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:{"388":"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 XD YD ZD","388":"J I aD lC bD cD"},J:{"2":"D","388":"A"},K:{"1":"A B C FC kC GC","388":"H"},L:{"388":"I"},M:{"641":"EC"},N:{"388":"A B"},O:{"388":"HC"},P:{"388":"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:{"388":"oD"},R:{"388":"pD"},S:{"513":"qD rD"}},B:1,C:"Number input type",D:true};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"2":"C L M G N O P Q H R S T","322":"0 9 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","450":"U V W X Y"},C:{"2":"0 1 2 3 4 5 6 7 8 9 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC"},D:{"2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B","194":"AC BC CC DC Q H R S T","322":"0 9 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","450":"U"},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":"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 4C 5C 6C 7C FC kC 8C GC","194":"xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B","322":"0 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"},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:{"450":"I"},M:{"2":"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:{"2":"qD rD"}},B:7,C:"Portals",D:true};
|
||||
Binary file not shown.
@@ -0,0 +1,117 @@
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { existsSync } from "node:fs";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { isBuiltin } from "node:module";
|
||||
import { createJiti } from "./jiti.mjs";
|
||||
|
||||
let jiti;
|
||||
|
||||
// https://nodejs.org/api/module.html#initialize
|
||||
export async function initialize() {
|
||||
jiti = createJiti();
|
||||
}
|
||||
|
||||
// https://nodejs.org/api/module.html#resolvespecifier-context-nextresolve
|
||||
export async function resolve(specifier, context, nextResolve) {
|
||||
if (_shouldSkip(specifier)) {
|
||||
return nextResolve(specifier, context);
|
||||
}
|
||||
const resolvedPath = jiti.esmResolve(specifier, {
|
||||
parentURL: context?.parentURL,
|
||||
conditions: context?.conditions,
|
||||
});
|
||||
return {
|
||||
url: resolvedPath,
|
||||
shortCircuit: true,
|
||||
};
|
||||
}
|
||||
|
||||
// https://nodejs.org/api/module.html#loadurl-context-nextload
|
||||
export async function load(url, context, nextLoad) {
|
||||
if (_shouldSkip(url)) {
|
||||
return nextLoad(url, context);
|
||||
}
|
||||
|
||||
const filename = fileURLToPath(url);
|
||||
|
||||
if (url.endsWith(".js")) {
|
||||
const pkg = await _findClosestPackageJson(dirname(filename));
|
||||
if (pkg && pkg.type === "module") {
|
||||
return nextLoad(url, context);
|
||||
}
|
||||
}
|
||||
|
||||
const rawSource = await readFile(filename, "utf8");
|
||||
|
||||
if (url.endsWith(".json")) {
|
||||
return {
|
||||
source: `export default ${rawSource}`,
|
||||
format: "module",
|
||||
shortCircuit: true,
|
||||
};
|
||||
}
|
||||
|
||||
const transpiledSource = jiti.transform({
|
||||
source: rawSource,
|
||||
filename: filename,
|
||||
ts: url.endsWith("ts"),
|
||||
retainLines: true,
|
||||
async: true,
|
||||
jsx: jiti.options.jsx,
|
||||
});
|
||||
|
||||
if (url.endsWith(".js") && !transpiledSource.includes("jitiImport")) {
|
||||
return {
|
||||
source: transpiledSource,
|
||||
format: "commonjs",
|
||||
shortCircuit: true,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
source: _wrapSource(transpiledSource, filename),
|
||||
format: "module",
|
||||
shortCircuit: true,
|
||||
};
|
||||
}
|
||||
|
||||
function _wrapSource(source, filename) {
|
||||
const _jitiPath = new URL("jiti.mjs", import.meta.url).href;
|
||||
return /*js*/ `import { createJiti as __createJiti__ } from ${JSON.stringify(_jitiPath)};async function _module(exports, require, module, __filename, __dirname, jitiImport) { ${source}\n};
|
||||
// GENERATED BY JITI ESM LOADER
|
||||
const filename = ${JSON.stringify(filename)};
|
||||
const dirname = ${JSON.stringify(dirname(filename))};
|
||||
const jiti = __createJiti__(filename);
|
||||
const module = { exports: Object.create(null) };
|
||||
await _module(module.exports, jiti, module, filename, dirname, jiti.import);
|
||||
if (module.exports && module.exports.__JITI_ERROR__) {
|
||||
const { filename, line, column, code, message } =
|
||||
module.exports.__JITI_ERROR__;
|
||||
const loc = [filename, line, column].join(':');
|
||||
const err = new Error(code + ": " + message + " " + loc);
|
||||
Error.captureStackTrace(err, _module);
|
||||
throw err;
|
||||
}
|
||||
export default module.exports;
|
||||
`;
|
||||
}
|
||||
|
||||
function _shouldSkip(url) {
|
||||
return (
|
||||
!jiti ||
|
||||
url.endsWith(".mjs") ||
|
||||
url.endsWith(".cjs") ||
|
||||
(!url.startsWith("./") && !url.startsWith("file://")) ||
|
||||
isBuiltin(url)
|
||||
);
|
||||
}
|
||||
|
||||
async function _findClosestPackageJson(dir) {
|
||||
if (dir === "/") return null;
|
||||
const packageJsonPath = join(dir, "package.json");
|
||||
if (existsSync(packageJsonPath)) {
|
||||
return JSON.parse(await readFile(packageJsonPath, "utf8"));
|
||||
}
|
||||
return _findClosestPackageJson(dirname(dir));
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { urlAlphabet } from './url-alphabet/index.js'
|
||||
let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))
|
||||
let customRandom = (alphabet, defaultSize, getRandom) => {
|
||||
let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
|
||||
let step = -~((1.6 * mask * defaultSize) / alphabet.length)
|
||||
return (size = defaultSize) => {
|
||||
let id = ''
|
||||
while (true) {
|
||||
let bytes = getRandom(step)
|
||||
let j = step | 0
|
||||
while (j--) {
|
||||
id += alphabet[bytes[j] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let customAlphabet = (alphabet, size = 21) =>
|
||||
customRandom(alphabet, size, random)
|
||||
let nanoid = (size = 21) =>
|
||||
crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
|
||||
byte &= 63
|
||||
if (byte < 36) {
|
||||
id += byte.toString(36)
|
||||
} else if (byte < 62) {
|
||||
id += (byte - 26).toString(36).toUpperCase()
|
||||
} else if (byte > 62) {
|
||||
id += '-'
|
||||
} else {
|
||||
id += '_'
|
||||
}
|
||||
return id
|
||||
}, '')
|
||||
export { nanoid, customAlphabet, customRandom, urlAlphabet, random }
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"51":0.0025,"56":0.0025,"87":0.005,"89":0.02001,"94":0.0025,"95":0.01,"102":0.01751,"107":0.005,"113":0.01,"114":0.0025,"115":0.06002,"117":0.0025,"121":0.05252,"122":0.0025,"123":0.005,"125":0.005,"127":0.01751,"128":0.2451,"129":0.005,"131":0.005,"133":0.0025,"134":0.02251,"135":0.2551,"136":0.92537,"137":0.0025,_:"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 52 53 54 55 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 88 90 91 92 93 96 97 98 99 100 101 103 104 105 106 108 109 110 111 112 116 118 119 120 124 126 130 132 138 139 140 3.5 3.6"},D:{"44":0.0025,"49":0.0025,"55":0.0075,"56":0.005,"59":0.0025,"60":0.0025,"64":0.01501,"65":0.01,"67":0.0025,"70":0.01,"72":0.0025,"73":0.0025,"74":0.0025,"79":0.01,"80":0.02251,"81":0.01501,"83":0.01,"84":0.0025,"86":0.005,"87":0.01,"88":0.005,"90":0.005,"93":0.01,"94":0.0025,"96":0.01751,"97":0.0025,"103":0.03251,"105":0.0075,"106":0.04502,"107":0.005,"108":0.0075,"109":0.80282,"111":0.0025,"112":0.005,"113":0.0025,"114":0.005,"116":0.02251,"117":0.0025,"118":0.005,"119":0.01,"120":0.01251,"121":0.0075,"122":0.01,"123":0.005,"124":0.02501,"125":0.02751,"126":0.02001,"127":0.01251,"128":0.07253,"129":0.01501,"130":0.03251,"131":0.13505,"132":0.10254,"133":2.7511,"134":5.38215,"135":0.0025,_:"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 45 46 47 48 50 51 52 53 54 57 58 61 62 63 66 68 69 71 75 76 77 78 85 89 91 92 95 98 99 100 101 102 104 110 115 136 137 138"},F:{"37":0.005,"63":0.0025,"65":0.0025,"79":0.0025,"86":0.0025,"87":0.01501,"95":0.02001,"106":0.0025,"110":0.0025,"113":0.0025,"114":0.0075,"115":0.01,"116":0.01251,"117":0.59274,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 64 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 85 88 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 107 108 109 111 112 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"12":0.01251,"14":0.0025,"17":0.01,"18":0.02501,"84":0.0025,"89":0.01251,"90":0.0075,"92":0.05502,"100":0.0025,"109":0.06253,"112":0.0025,"121":0.0025,"122":0.0025,"123":0.09754,"124":0.0025,"127":0.005,"129":0.0025,"130":0.005,"131":0.08253,"132":0.03752,"133":0.81283,"134":1.33553,_:"13 15 16 79 80 81 83 85 86 87 88 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 110 111 113 114 115 116 117 118 119 120 125 126 128"},E:{"11":0.005,"14":0.0025,_:"0 4 5 6 7 8 9 10 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.1 15.2-15.3 15.4 15.5 16.0 16.2 16.3 16.5 17.0 17.1 17.2 17.3 18.2","13.1":0.01,"14.1":0.0075,"15.6":0.01501,"16.1":0.0025,"16.4":0.0025,"16.6":0.0025,"17.4":0.0025,"17.5":0.0025,"17.6":0.03251,"18.0":0.01,"18.1":0.03001,"18.3":0.06253,"18.4":0.02501},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00131,"5.0-5.1":0,"6.0-6.1":0.00392,"7.0-7.1":0.00261,"8.1-8.4":0,"9.0-9.2":0.00196,"9.3":0.00914,"10.0-10.2":0.00065,"10.3":0.01502,"11.0-11.2":0.06924,"11.3-11.4":0.00457,"12.0-12.1":0.00261,"12.2-12.5":0.06466,"13.0-13.1":0.00131,"13.2":0.00196,"13.3":0.00261,"13.4-13.7":0.00914,"14.0-14.4":0.02286,"14.5-14.8":0.02743,"15.0-15.1":0.01502,"15.2-15.3":0.01502,"15.4":0.01829,"15.5":0.0209,"15.6-15.8":0.25735,"16.0":0.03658,"16.1":0.07511,"16.2":0.03919,"16.3":0.06793,"16.4":0.01502,"16.5":0.02809,"16.6-16.7":0.30503,"17.0":0.01829,"17.1":0.03266,"17.2":0.02482,"17.3":0.03462,"17.4":0.06924,"17.5":0.15415,"17.6-17.7":0.44742,"18.0":0.12541,"18.1":0.41019,"18.2":0.18354,"18.3":3.83603,"18.4":0.05683},P:{"4":0.3614,"21":0.02008,"23":0.03012,"24":0.06023,"25":0.01004,"26":0.10039,"27":0.4116,_:"20 22 5.0-5.4 8.2 10.1 11.1-11.2 12.0 14.0 16.0 17.0","6.2-6.4":0.01004,"7.2-7.4":0.10039,"9.2":0.02008,"13.0":0.02008,"15.0":0.01004,"18.0":0.01004,"19.0":0.08031},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0},K:{"0":3.47439,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.0025,_:"6 7 8 9 10 5.5"},S:{"2.5":0.09749,_:"3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.03},Q:{_:"14.9"},O:{"0":0.22497},H:{"0":1.13},L:{"0":71.60323}};
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @fileoverview Types for this package.
|
||||
*/
|
||||
|
||||
import type { Linter } from "eslint";
|
||||
|
||||
/**
|
||||
* Infinite array type.
|
||||
*/
|
||||
export type InfiniteArray<T> = T | InfiniteArray<T>[];
|
||||
|
||||
/**
|
||||
* The type of array element in the `extends` property after flattening.
|
||||
*/
|
||||
export type SimpleExtendsElement = string | Linter.Config;
|
||||
|
||||
/**
|
||||
* The type of array element in the `extends` property before flattening.
|
||||
*/
|
||||
export type ExtendsElement =
|
||||
| SimpleExtendsElement
|
||||
| InfiniteArray<Linter.Config>;
|
||||
|
||||
/**
|
||||
* Config with extends. Valid only inside of `defineConfig()`.
|
||||
*/
|
||||
export interface ConfigWithExtends extends Linter.Config {
|
||||
extends?: ExtendsElement[];
|
||||
}
|
||||
|
||||
export type ConfigWithExtendsArray = InfiniteArray<ConfigWithExtends>[];
|
||||
@@ -0,0 +1,76 @@
|
||||
# supports-color [](https://travis-ci.org/chalk/supports-color)
|
||||
|
||||
> Detect whether a terminal supports color
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install supports-color
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const supportsColor = require('supports-color');
|
||||
|
||||
if (supportsColor.stdout) {
|
||||
console.log('Terminal stdout supports color');
|
||||
}
|
||||
|
||||
if (supportsColor.stdout.has256) {
|
||||
console.log('Terminal stdout supports 256 colors');
|
||||
}
|
||||
|
||||
if (supportsColor.stderr.has16m) {
|
||||
console.log('Terminal stderr supports 16 million colors (truecolor)');
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
|
||||
|
||||
The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag:
|
||||
|
||||
- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors)
|
||||
- `.level = 2` and `.has256 = true`: 256 color support
|
||||
- `.level = 3` and `.has16m = true`: Truecolor support (16 million colors)
|
||||
|
||||
|
||||
## Info
|
||||
|
||||
It obeys the `--color` and `--no-color` CLI flags.
|
||||
|
||||
For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
|
||||
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-supports-color?utm_source=npm-supports-color&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
---
|
||||
@@ -0,0 +1,6 @@
|
||||
export type ClassValue = ClassArray | ClassDictionary | string | number | bigint | null | boolean | undefined;
|
||||
export type ClassDictionary = Record<string, any>;
|
||||
export type ClassArray = ClassValue[];
|
||||
|
||||
export function clsx(...inputs: ClassValue[]): string;
|
||||
export default clsx;
|
||||
@@ -0,0 +1,296 @@
|
||||
# Tapable
|
||||
|
||||
The tapable package expose many Hook classes, which can be used to create hooks for plugins.
|
||||
|
||||
``` javascript
|
||||
const {
|
||||
SyncHook,
|
||||
SyncBailHook,
|
||||
SyncWaterfallHook,
|
||||
SyncLoopHook,
|
||||
AsyncParallelHook,
|
||||
AsyncParallelBailHook,
|
||||
AsyncSeriesHook,
|
||||
AsyncSeriesBailHook,
|
||||
AsyncSeriesWaterfallHook
|
||||
} = require("tapable");
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
``` shell
|
||||
npm install --save tapable
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
All Hook constructors take one optional argument, which is a list of argument names as strings.
|
||||
|
||||
``` js
|
||||
const hook = new SyncHook(["arg1", "arg2", "arg3"]);
|
||||
```
|
||||
|
||||
The best practice is to expose all hooks of a class in a `hooks` property:
|
||||
|
||||
``` js
|
||||
class Car {
|
||||
constructor() {
|
||||
this.hooks = {
|
||||
accelerate: new SyncHook(["newSpeed"]),
|
||||
brake: new SyncHook(),
|
||||
calculateRoutes: new AsyncParallelHook(["source", "target", "routesList"])
|
||||
};
|
||||
}
|
||||
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
Other people can now use these hooks:
|
||||
|
||||
``` js
|
||||
const myCar = new Car();
|
||||
|
||||
// Use the tap method to add a consument
|
||||
myCar.hooks.brake.tap("WarningLampPlugin", () => warningLamp.on());
|
||||
```
|
||||
|
||||
It's required to pass a name to identify the plugin/reason.
|
||||
|
||||
You may receive arguments:
|
||||
|
||||
``` js
|
||||
myCar.hooks.accelerate.tap("LoggerPlugin", newSpeed => console.log(`Accelerating to ${newSpeed}`));
|
||||
```
|
||||
|
||||
For sync hooks, `tap` is the only valid method to add a plugin. Async hooks also support async plugins:
|
||||
|
||||
``` js
|
||||
myCar.hooks.calculateRoutes.tapPromise("GoogleMapsPlugin", (source, target, routesList) => {
|
||||
// return a promise
|
||||
return google.maps.findRoute(source, target).then(route => {
|
||||
routesList.add(route);
|
||||
});
|
||||
});
|
||||
myCar.hooks.calculateRoutes.tapAsync("BingMapsPlugin", (source, target, routesList, callback) => {
|
||||
bing.findRoute(source, target, (err, route) => {
|
||||
if(err) return callback(err);
|
||||
routesList.add(route);
|
||||
// call the callback
|
||||
callback();
|
||||
});
|
||||
});
|
||||
|
||||
// You can still use sync plugins
|
||||
myCar.hooks.calculateRoutes.tap("CachedRoutesPlugin", (source, target, routesList) => {
|
||||
const cachedRoute = cache.get(source, target);
|
||||
if(cachedRoute)
|
||||
routesList.add(cachedRoute);
|
||||
})
|
||||
```
|
||||
The class declaring these hooks need to call them:
|
||||
|
||||
``` js
|
||||
class Car {
|
||||
/**
|
||||
* You won't get returned value from SyncHook or AsyncParallelHook,
|
||||
* to do that, use SyncWaterfallHook and AsyncSeriesWaterfallHook respectively
|
||||
**/
|
||||
|
||||
setSpeed(newSpeed) {
|
||||
// following call returns undefined even when you returned values
|
||||
this.hooks.accelerate.call(newSpeed);
|
||||
}
|
||||
|
||||
useNavigationSystemPromise(source, target) {
|
||||
const routesList = new List();
|
||||
return this.hooks.calculateRoutes.promise(source, target, routesList).then((res) => {
|
||||
// res is undefined for AsyncParallelHook
|
||||
return routesList.getRoutes();
|
||||
});
|
||||
}
|
||||
|
||||
useNavigationSystemAsync(source, target, callback) {
|
||||
const routesList = new List();
|
||||
this.hooks.calculateRoutes.callAsync(source, target, routesList, err => {
|
||||
if(err) return callback(err);
|
||||
callback(null, routesList.getRoutes());
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The Hook will compile a method with the most efficient way of running your plugins. It generates code depending on:
|
||||
* The number of registered plugins (none, one, many)
|
||||
* The kind of registered plugins (sync, async, promise)
|
||||
* The used call method (sync, async, promise)
|
||||
* The number of arguments
|
||||
* Whether interception is used
|
||||
|
||||
This ensures fastest possible execution.
|
||||
|
||||
## Hook types
|
||||
|
||||
Each hook can be tapped with one or several functions. How they are executed depends on the hook type:
|
||||
|
||||
* Basic hook (without “Waterfall”, “Bail” or “Loop” in its name). This hook simply calls every function it tapped in a row.
|
||||
|
||||
* __Waterfall__. A waterfall hook also calls each tapped function in a row. Unlike the basic hook, it passes a return value from each function to the next function.
|
||||
|
||||
* __Bail__. A bail hook allows exiting early. When any of the tapped function returns anything, the bail hook will stop executing the remaining ones.
|
||||
|
||||
* __Loop__. When a plugin in a loop hook returns a non-undefined value the hook will restart from the first plugin. It will loop until all plugins return undefined.
|
||||
|
||||
Additionally, hooks can be synchronous or asynchronous. To reflect this, there’re “Sync”, “AsyncSeries”, and “AsyncParallel” hook classes:
|
||||
|
||||
* __Sync__. A sync hook can only be tapped with synchronous functions (using `myHook.tap()`).
|
||||
|
||||
* __AsyncSeries__. An async-series hook can be tapped with synchronous, callback-based and promise-based functions (using `myHook.tap()`, `myHook.tapAsync()` and `myHook.tapPromise()`). They call each async method in a row.
|
||||
|
||||
* __AsyncParallel__. An async-parallel hook can also be tapped with synchronous, callback-based and promise-based functions (using `myHook.tap()`, `myHook.tapAsync()` and `myHook.tapPromise()`). However, they run each async method in parallel.
|
||||
|
||||
The hook type is reflected in its class name. E.g., `AsyncSeriesWaterfallHook` allows asynchronous functions and runs them in series, passing each function’s return value into the next function.
|
||||
|
||||
|
||||
## Interception
|
||||
|
||||
All Hooks offer an additional interception API:
|
||||
|
||||
``` js
|
||||
myCar.hooks.calculateRoutes.intercept({
|
||||
call: (source, target, routesList) => {
|
||||
console.log("Starting to calculate routes");
|
||||
},
|
||||
register: (tapInfo) => {
|
||||
// tapInfo = { type: "promise", name: "GoogleMapsPlugin", fn: ... }
|
||||
console.log(`${tapInfo.name} is doing its job`);
|
||||
return tapInfo; // may return a new tapInfo object
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
**call**: `(...args) => void` Adding `call` to your interceptor will trigger when hooks are triggered. You have access to the hooks arguments.
|
||||
|
||||
**tap**: `(tap: Tap) => void` Adding `tap` to your interceptor will trigger when a plugin taps into a hook. Provided is the `Tap` object. `Tap` object can't be changed.
|
||||
|
||||
**loop**: `(...args) => void` Adding `loop` to your interceptor will trigger for each loop of a looping hook.
|
||||
|
||||
**register**: `(tap: Tap) => Tap | undefined` Adding `register` to your interceptor will trigger for each added `Tap` and allows to modify it.
|
||||
|
||||
## Context
|
||||
|
||||
Plugins and interceptors can opt-in to access an optional `context` object, which can be used to pass arbitrary values to subsequent plugins and interceptors.
|
||||
|
||||
``` js
|
||||
myCar.hooks.accelerate.intercept({
|
||||
context: true,
|
||||
tap: (context, tapInfo) => {
|
||||
// tapInfo = { type: "sync", name: "NoisePlugin", fn: ... }
|
||||
console.log(`${tapInfo.name} is doing it's job`);
|
||||
|
||||
// `context` starts as an empty object if at least one plugin uses `context: true`.
|
||||
// If no plugins use `context: true`, then `context` is undefined.
|
||||
if (context) {
|
||||
// Arbitrary properties can be added to `context`, which plugins can then access.
|
||||
context.hasMuffler = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
myCar.hooks.accelerate.tap({
|
||||
name: "NoisePlugin",
|
||||
context: true
|
||||
}, (context, newSpeed) => {
|
||||
if (context && context.hasMuffler) {
|
||||
console.log("Silence...");
|
||||
} else {
|
||||
console.log("Vroom!");
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## HookMap
|
||||
|
||||
A HookMap is a helper class for a Map with Hooks
|
||||
|
||||
``` js
|
||||
const keyedHook = new HookMap(key => new SyncHook(["arg"]))
|
||||
```
|
||||
|
||||
``` js
|
||||
keyedHook.for("some-key").tap("MyPlugin", (arg) => { /* ... */ });
|
||||
keyedHook.for("some-key").tapAsync("MyPlugin", (arg, callback) => { /* ... */ });
|
||||
keyedHook.for("some-key").tapPromise("MyPlugin", (arg) => { /* ... */ });
|
||||
```
|
||||
|
||||
``` js
|
||||
const hook = keyedHook.get("some-key");
|
||||
if(hook !== undefined) {
|
||||
hook.callAsync("arg", err => { /* ... */ });
|
||||
}
|
||||
```
|
||||
|
||||
## Hook/HookMap interface
|
||||
|
||||
Public:
|
||||
|
||||
``` ts
|
||||
interface Hook {
|
||||
tap: (name: string | Tap, fn: (context?, ...args) => Result) => void,
|
||||
tapAsync: (name: string | Tap, fn: (context?, ...args, callback: (err, result: Result) => void) => void) => void,
|
||||
tapPromise: (name: string | Tap, fn: (context?, ...args) => Promise<Result>) => void,
|
||||
intercept: (interceptor: HookInterceptor) => void
|
||||
}
|
||||
|
||||
interface HookInterceptor {
|
||||
call: (context?, ...args) => void,
|
||||
loop: (context?, ...args) => void,
|
||||
tap: (context?, tap: Tap) => void,
|
||||
register: (tap: Tap) => Tap,
|
||||
context: boolean
|
||||
}
|
||||
|
||||
interface HookMap {
|
||||
for: (key: any) => Hook,
|
||||
intercept: (interceptor: HookMapInterceptor) => void
|
||||
}
|
||||
|
||||
interface HookMapInterceptor {
|
||||
factory: (key: any, hook: Hook) => Hook
|
||||
}
|
||||
|
||||
interface Tap {
|
||||
name: string,
|
||||
type: string
|
||||
fn: Function,
|
||||
stage: number,
|
||||
context: boolean,
|
||||
before?: string | Array
|
||||
}
|
||||
```
|
||||
|
||||
Protected (only for the class containing the hook):
|
||||
|
||||
``` ts
|
||||
interface Hook {
|
||||
isUsed: () => boolean,
|
||||
call: (...args) => Result,
|
||||
promise: (...args) => Promise<Result>,
|
||||
callAsync: (...args, callback: (err, result: Result) => void) => void,
|
||||
}
|
||||
|
||||
interface HookMap {
|
||||
get: (key: any) => Hook | undefined,
|
||||
for: (key: any) => Hook
|
||||
}
|
||||
```
|
||||
|
||||
## MultiHook
|
||||
|
||||
A helper Hook-like class to redirect taps to multiple other hooks:
|
||||
|
||||
``` js
|
||||
const { MultiHook } = require("tapable");
|
||||
|
||||
this.hooks.allHooks = new MultiHook([this.hooks.hookA, this.hooks.hookB]);
|
||||
```
|
||||
@@ -0,0 +1,83 @@
|
||||
<a name="4.0.3"></a>
|
||||
## [4.0.3](https://github.com/BerkeleyTrue/warning/compare/v4.0.2...v4.0.3) (2019-02-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* incorrect formatting of message with arguments ([b188176](https://github.com/BerkeleyTrue/warning/commit/b188176))
|
||||
|
||||
|
||||
|
||||
<a name="4.0.2"></a>
|
||||
## [4.0.2](https://github.com/BerkeleyTrue/warning/compare/v4.0.1...v4.0.2) (2018-08-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **use jest instead of tap:** tap is a PITA to debug ([c4c026b](https://github.com/BerkeleyTrue/warning/commit/c4c026b))
|
||||
* remove [@provides](https://github.com/provides)Module annotation ([1d808f1](https://github.com/BerkeleyTrue/warning/commit/1d808f1))
|
||||
|
||||
|
||||
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
<a name="4.0.1"></a>
|
||||
## [4.0.1](https://github.com/BerkeleyTrue/warning/compare/v4.0.0...v4.0.1) (2018-05-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add `var printWarning =` to comply with ES5 strict mode ([677dcfa](https://github.com/BerkeleyTrue/warning/commit/677dcfa)), closes [#25](https://github.com/BerkeleyTrue/warning/issues/25)
|
||||
|
||||
<a name="4.0.0"></a>
|
||||
## [4.0.0](https://github.com/BerkeleyTrue/warning/compare/v3.0.0...v4.0.0) (2018-05-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Remove "browser" version ([521f5f5](https://github.com/BerkeleyTrue/warning/commit/521f5f5)), closes [#18](https://github.com/BerkeleyTrue/warning/issues/18) [/github.com/facebook/fbjs/pull/86#issuecomment-285204734](https://github.com//github.com/facebook/fbjs/pull/86/issues/issuecomment-285204734)
|
||||
* Update warning to use the latest version from facebook/fbjs ([0572ddd](https://github.com/BerkeleyTrue/warning/commit/0572ddd))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* **LICENSE:** Change from BSD modified to MIT ([5a63a1b](https://github.com/BerkeleyTrue/warning/commit/5a63a1b))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* **LICENSE:** Change License to MIT from BSD+patents
|
||||
* This changes the internal workings. A major release is
|
||||
made to ensure minimal effect on downstream users.
|
||||
|
||||
|
||||
<a name="3.0.0"></a>
|
||||
## [3.0.0](https://github.com/BerkeleyTrue/warning/compare/v2.1.0...v3.0.0) (2015-10-04)
|
||||
|
||||
### BREAKING CHANGE
|
||||
|
||||
* **package.json** correct license field ([6bd7ad5](https://github.com/BerkeleyTrue/warning/commit/6bd7ad5))
|
||||
|
||||
<a name="2.1.0"></a>
|
||||
## [2.1.0](https://github.com/BerkeleyTrue/warning/compare/v2.0.0...v2.1.0) (2015-10-04)
|
||||
|
||||
### Features
|
||||
|
||||
* switch to loose-envify ([dacc2da](https://github.com/BerkeleyTrue/warning/commit/dacc2da))
|
||||
|
||||
<a name="2.0.0"></a>
|
||||
## [2.0.0](https://github.com/BerkeleyTrue/warning/compare/v1.0.2...v2.0.0) (2015-07-11)
|
||||
|
||||
### BREAKING CHANGE
|
||||
|
||||
* add browser(ify) friendly version ([1a33d40fa1](https://github.com/BerkeleyTrue/warning/commit/1a33d40fa1))
|
||||
|
||||
<a name="1.0.2"></a>
|
||||
## [1.0.2](https://github.com/BerkeleyTrue/warning/compare/v1.0.1...v1.0.2) (2015-05-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* return args in replace ([2ac6962](https://github.com/BerkeleyTrue/warning/commit/2ac6962263))
|
||||
@@ -0,0 +1,19 @@
|
||||
import { AnyContext, AnyPathParams, AnyRoute, UpdatableRouteOptions } from './route.js';
|
||||
import { AnyValidator } from './validators.js';
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: any;
|
||||
fullPaths: any;
|
||||
to: any;
|
||||
fileRoutesByTo: any;
|
||||
id: any;
|
||||
fileRoutesById: any;
|
||||
}
|
||||
export type InferFileRouteTypes<TRouteTree extends AnyRoute> = unknown extends TRouteTree['types']['fileRouteTypes'] ? never : TRouteTree['types']['fileRouteTypes'] extends FileRouteTypes ? TRouteTree['types']['fileRouteTypes'] : never;
|
||||
export interface FileRoutesByPath {
|
||||
}
|
||||
export type LazyRouteOptions = Pick<UpdatableRouteOptions<AnyRoute, string, string, AnyPathParams, AnyValidator, {}, AnyContext, AnyContext, AnyContext, AnyContext>, 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'>;
|
||||
export interface LazyRoute {
|
||||
options: {
|
||||
id: string;
|
||||
} & LazyRouteOptions;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* @fileoverview Disallow the use of process.env()
|
||||
* @author Vignesh Anand
|
||||
* @deprecated in ESLint v7.0.0
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
deprecated: {
|
||||
message: "Node.js rules were moved out of ESLint core.",
|
||||
url: "https://eslint.org/docs/latest/use/migrating-to-7.0.0#deprecate-node-rules",
|
||||
deprecatedSince: "7.0.0",
|
||||
availableUntil: null,
|
||||
replacedBy: [
|
||||
{
|
||||
message:
|
||||
"eslint-plugin-n now maintains deprecated Node.js-related rules.",
|
||||
plugin: {
|
||||
name: "eslint-plugin-n",
|
||||
url: "https://github.com/eslint-community/eslint-plugin-n",
|
||||
},
|
||||
rule: {
|
||||
name: "no-process-env",
|
||||
url: "https://github.com/eslint-community/eslint-plugin-n/tree/master/docs/rules/no-process-env.md",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "Disallow the use of `process.env`",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/no-process-env",
|
||||
},
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
unexpectedProcessEnv: "Unexpected use of process.env.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
MemberExpression(node) {
|
||||
const objectName = node.object.name,
|
||||
propertyName = node.property.name;
|
||||
|
||||
if (
|
||||
objectName === "process" &&
|
||||
!node.computed &&
|
||||
propertyName &&
|
||||
propertyName === "env"
|
||||
) {
|
||||
context.report({ node, messageId: "unexpectedProcessEnv" });
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @param {string} path path
|
||||
* @returns {{paths: string[], segments: string[]}}} paths and segments
|
||||
*/
|
||||
module.exports = function getPaths(path) {
|
||||
if (path === "/") return { paths: ["/"], segments: [""] };
|
||||
const parts = path.split(/(.*?[\\/]+)/);
|
||||
const paths = [path];
|
||||
const segments = [parts[parts.length - 1]];
|
||||
let part = parts[parts.length - 1];
|
||||
path = path.substring(0, path.length - part.length - 1);
|
||||
for (let i = parts.length - 2; i > 2; i -= 2) {
|
||||
paths.push(path);
|
||||
part = parts[i];
|
||||
path = path.substring(0, path.length - part.length) || "/";
|
||||
segments.push(part.slice(0, -1));
|
||||
}
|
||||
part = parts[1];
|
||||
segments.push(part);
|
||||
paths.push(part);
|
||||
return {
|
||||
paths: paths,
|
||||
segments: segments
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} path path
|
||||
* @returns {string|null} basename or null
|
||||
*/
|
||||
module.exports.basename = function basename(path) {
|
||||
const i = path.lastIndexOf("/"),
|
||||
j = path.lastIndexOf("\\");
|
||||
const p = i < 0 ? j : j < 0 ? i : i < j ? j : i;
|
||||
if (p < 0) return null;
|
||||
const s = path.slice(p + 1);
|
||||
return s;
|
||||
};
|
||||
@@ -0,0 +1,628 @@
|
||||
import { beforeAll, describe, expect, it, vi } from 'vitest';
|
||||
import { createRef } from 'react';
|
||||
import { fireEvent, render } from '@testing-library/react';
|
||||
|
||||
import { pdfjs } from './index.test.js';
|
||||
|
||||
import Thumbnail from './Thumbnail.js';
|
||||
|
||||
import failingPdf from '../../../__mocks__/_failing_pdf.js';
|
||||
import silentlyFailingPdf from '../../../__mocks__/_silently_failing_pdf.js';
|
||||
import { loadPDF, makeAsyncCallback, muteConsole, restoreConsole } from '../../../test-utils.js';
|
||||
|
||||
import DocumentContext from './DocumentContext.js';
|
||||
|
||||
import type { PDFDocumentProxy, PDFPageProxy } from 'pdfjs-dist';
|
||||
import type { DocumentContextType, PageCallback } from './shared/types.js';
|
||||
|
||||
const pdfFile = loadPDF('./../../__mocks__/_pdf.pdf');
|
||||
const pdfFile2 = loadPDF('./../../__mocks__/_pdf2.pdf');
|
||||
|
||||
function renderWithContext(children: React.ReactNode, context: Partial<DocumentContextType>) {
|
||||
const { rerender, ...otherResult } = render(
|
||||
<DocumentContext.Provider value={context as DocumentContextType}>
|
||||
{children}
|
||||
</DocumentContext.Provider>,
|
||||
);
|
||||
|
||||
return {
|
||||
...otherResult,
|
||||
rerender: (
|
||||
nextChildren: React.ReactNode,
|
||||
nextContext: Partial<DocumentContextType> = context,
|
||||
) =>
|
||||
rerender(
|
||||
<DocumentContext.Provider value={nextContext as DocumentContextType}>
|
||||
{nextChildren}
|
||||
</DocumentContext.Provider>,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
describe('Thumbnail', () => {
|
||||
// Loaded PDF file
|
||||
let pdf: PDFDocumentProxy;
|
||||
let pdf2: PDFDocumentProxy;
|
||||
|
||||
// Object with basic loaded page information that shall match after successful loading
|
||||
const desiredLoadedThumbnail: Partial<PDFPageProxy> = {};
|
||||
const desiredLoadedThumbnail2: Partial<PDFPageProxy> = {};
|
||||
const desiredLoadedThumbnail3: Partial<PDFPageProxy> = {};
|
||||
|
||||
beforeAll(async () => {
|
||||
pdf = await pdfjs.getDocument({ data: pdfFile.arrayBuffer }).promise;
|
||||
|
||||
const page = await pdf.getPage(1);
|
||||
desiredLoadedThumbnail._pageIndex = page._pageIndex;
|
||||
desiredLoadedThumbnail._pageInfo = page._pageInfo;
|
||||
|
||||
const page2 = await pdf.getPage(2);
|
||||
desiredLoadedThumbnail2._pageIndex = page2._pageIndex;
|
||||
desiredLoadedThumbnail2._pageInfo = page2._pageInfo;
|
||||
|
||||
pdf2 = await pdfjs.getDocument({ data: pdfFile2.arrayBuffer }).promise;
|
||||
|
||||
const page3 = await pdf2.getPage(1);
|
||||
desiredLoadedThumbnail3._pageIndex = page3._pageIndex;
|
||||
desiredLoadedThumbnail3._pageInfo = page3._pageInfo;
|
||||
});
|
||||
|
||||
describe('loading', () => {
|
||||
it('loads a page and calls onLoadSuccess callback properly when placed inside Document', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();
|
||||
|
||||
renderWithContext(<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={0} />, { pdf });
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
await expect(onLoadSuccessPromise).resolves.toMatchObject([desiredLoadedThumbnail]);
|
||||
});
|
||||
|
||||
it('loads a page and calls onLoadSuccess callback properly when pdf prop is passed', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();
|
||||
|
||||
render(<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={0} pdf={pdf} />);
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
await expect(onLoadSuccessPromise).resolves.toMatchObject([desiredLoadedThumbnail]);
|
||||
});
|
||||
|
||||
it('returns all desired parameters in onLoadSuccess callback', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } =
|
||||
makeAsyncCallback<[PageCallback]>();
|
||||
|
||||
renderWithContext(<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={0} />, { pdf });
|
||||
|
||||
expect.assertions(5);
|
||||
|
||||
const [page] = await onLoadSuccessPromise;
|
||||
|
||||
expect(page.width).toBeDefined();
|
||||
expect(page.height).toBeDefined();
|
||||
expect(page.originalWidth).toBeDefined();
|
||||
expect(page.originalHeight).toBeDefined();
|
||||
// Example of a method that got stripped away in the past
|
||||
expect(page.getTextContent).toBeInstanceOf(Function);
|
||||
});
|
||||
|
||||
it('calls onLoadError when failed to load a page', async () => {
|
||||
const { func: onLoadError, promise: onLoadErrorPromise } = makeAsyncCallback();
|
||||
|
||||
muteConsole();
|
||||
|
||||
renderWithContext(<Thumbnail onLoadError={onLoadError} pageIndex={0} />, { pdf: failingPdf });
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
await expect(onLoadErrorPromise).resolves.toMatchObject([expect.any(Error)]);
|
||||
|
||||
restoreConsole();
|
||||
});
|
||||
|
||||
it('loads page when given pageIndex', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();
|
||||
|
||||
renderWithContext(<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={0} />, { pdf });
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
const [page] = await onLoadSuccessPromise;
|
||||
|
||||
expect(page).toMatchObject(desiredLoadedThumbnail);
|
||||
});
|
||||
|
||||
it('loads page when given pageNumber', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();
|
||||
|
||||
renderWithContext(<Thumbnail onLoadSuccess={onLoadSuccess} pageNumber={1} />, { pdf });
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
const [page] = await onLoadSuccessPromise;
|
||||
|
||||
expect(page).toMatchObject(desiredLoadedThumbnail);
|
||||
});
|
||||
|
||||
it('loads page of a given number when given conflicting pageNumber and pageIndex', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();
|
||||
|
||||
renderWithContext(<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={1} pageNumber={1} />, {
|
||||
pdf,
|
||||
});
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
const [page] = await onLoadSuccessPromise;
|
||||
|
||||
expect(page).toMatchObject(desiredLoadedThumbnail);
|
||||
});
|
||||
|
||||
it('replaces a page properly when pdf is changed', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();
|
||||
|
||||
const { rerender } = renderWithContext(
|
||||
<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={0} />,
|
||||
{
|
||||
pdf,
|
||||
},
|
||||
);
|
||||
|
||||
expect.assertions(2);
|
||||
|
||||
await expect(onLoadSuccessPromise).resolves.toMatchObject([desiredLoadedThumbnail]);
|
||||
|
||||
const { func: onLoadSuccess2, promise: onLoadSuccessPromise2 } = makeAsyncCallback();
|
||||
|
||||
rerender(<Thumbnail onLoadSuccess={onLoadSuccess2} pageIndex={0} />, { pdf: pdf2 });
|
||||
|
||||
await expect(onLoadSuccessPromise2).resolves.toMatchObject([desiredLoadedThumbnail3]);
|
||||
});
|
||||
|
||||
it('replaces a page properly when pageNumber is changed', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();
|
||||
|
||||
const { rerender } = renderWithContext(
|
||||
<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={0} />,
|
||||
{
|
||||
pdf,
|
||||
},
|
||||
);
|
||||
|
||||
expect.assertions(2);
|
||||
|
||||
await expect(onLoadSuccessPromise).resolves.toMatchObject([desiredLoadedThumbnail]);
|
||||
|
||||
const { func: onLoadSuccess2, promise: onLoadSuccessPromise2 } = makeAsyncCallback();
|
||||
|
||||
rerender(<Thumbnail onLoadSuccess={onLoadSuccess2} pageIndex={1} />, { pdf });
|
||||
|
||||
await expect(onLoadSuccessPromise2).resolves.toMatchObject([desiredLoadedThumbnail2]);
|
||||
});
|
||||
|
||||
it('throws an error when placed outside Document without pdf prop passed', () => {
|
||||
muteConsole();
|
||||
|
||||
expect(() => render(<Thumbnail pageIndex={0} />)).toThrow();
|
||||
|
||||
restoreConsole();
|
||||
});
|
||||
});
|
||||
|
||||
describe('rendering', () => {
|
||||
it('applies className to its wrapper when given a string', () => {
|
||||
const className = 'testClassName';
|
||||
|
||||
const { container } = renderWithContext(<Thumbnail className={className} pageIndex={0} />, {
|
||||
pdf,
|
||||
});
|
||||
|
||||
const wrapper = container.querySelector('.react-pdf__Thumbnail');
|
||||
|
||||
expect(wrapper).toHaveClass(className);
|
||||
});
|
||||
|
||||
it('passes container element to inputRef properly', () => {
|
||||
const inputRef = createRef<HTMLDivElement>();
|
||||
|
||||
renderWithContext(<Thumbnail inputRef={inputRef} pageIndex={1} />, {
|
||||
pdf: silentlyFailingPdf,
|
||||
});
|
||||
|
||||
expect(inputRef.current).toBeInstanceOf(HTMLDivElement);
|
||||
});
|
||||
|
||||
it('passes canvas element to ThumbnailCanvas properly', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();
|
||||
|
||||
const canvasRef = createRef<HTMLCanvasElement>();
|
||||
|
||||
const { container } = renderWithContext(
|
||||
<Thumbnail canvasRef={canvasRef} onLoadSuccess={onLoadSuccess} pageIndex={0} />,
|
||||
{ pdf },
|
||||
);
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
await onLoadSuccessPromise;
|
||||
|
||||
const pageCanvas = container.querySelector('.react-pdf__Thumbnail__page__canvas');
|
||||
|
||||
expect(canvasRef.current).toBe(pageCanvas);
|
||||
});
|
||||
|
||||
it('renders "No page specified." when given neither pageIndex nor pageNumber', () => {
|
||||
muteConsole();
|
||||
|
||||
const { container } = renderWithContext(<Thumbnail />, { pdf });
|
||||
|
||||
const noData = container.querySelector('.react-pdf__message');
|
||||
|
||||
expect(noData).toBeInTheDocument();
|
||||
expect(noData).toHaveTextContent('No page specified.');
|
||||
|
||||
restoreConsole();
|
||||
});
|
||||
|
||||
it('renders custom no data message when given nothing and noData is given', () => {
|
||||
muteConsole();
|
||||
|
||||
const { container } = renderWithContext(<Thumbnail noData="Nothing here" />, { pdf });
|
||||
|
||||
const noData = container.querySelector('.react-pdf__message');
|
||||
|
||||
expect(noData).toBeInTheDocument();
|
||||
expect(noData).toHaveTextContent('Nothing here');
|
||||
|
||||
restoreConsole();
|
||||
});
|
||||
|
||||
it('renders custom no data message when given nothing and noData is given as a function', () => {
|
||||
muteConsole();
|
||||
|
||||
const { container } = renderWithContext(<Thumbnail noData={() => 'Nothing here'} />, { pdf });
|
||||
|
||||
const noData = container.querySelector('.react-pdf__message');
|
||||
|
||||
expect(noData).toBeInTheDocument();
|
||||
expect(noData).toHaveTextContent('Nothing here');
|
||||
|
||||
restoreConsole();
|
||||
});
|
||||
|
||||
it('renders "Loading page…" when loading a page', async () => {
|
||||
const { container } = renderWithContext(<Thumbnail pageIndex={0} />, { pdf });
|
||||
|
||||
const loading = container.querySelector('.react-pdf__message');
|
||||
|
||||
expect(loading).toBeInTheDocument();
|
||||
expect(loading).toHaveTextContent('Loading page…');
|
||||
});
|
||||
|
||||
it('renders custom loading message when loading a page and loading prop is given', async () => {
|
||||
const { container } = renderWithContext(<Thumbnail loading="Loading" pageIndex={0} />, {
|
||||
pdf,
|
||||
});
|
||||
|
||||
const loading = container.querySelector('.react-pdf__message');
|
||||
|
||||
expect(loading).toBeInTheDocument();
|
||||
expect(loading).toHaveTextContent('Loading');
|
||||
});
|
||||
|
||||
it('renders custom loading message when loading a page and loading prop is given as a function', async () => {
|
||||
const { container } = renderWithContext(
|
||||
<Thumbnail loading={() => 'Loading'} pageIndex={0} />,
|
||||
{
|
||||
pdf,
|
||||
},
|
||||
);
|
||||
|
||||
const loading = container.querySelector('.react-pdf__message');
|
||||
|
||||
expect(loading).toBeInTheDocument();
|
||||
expect(loading).toHaveTextContent('Loading');
|
||||
});
|
||||
|
||||
it('ignores pageIndex when given pageIndex and pageNumber', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();
|
||||
|
||||
renderWithContext(<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={1} pageNumber={1} />, {
|
||||
pdf,
|
||||
});
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
const [page] = await onLoadSuccessPromise;
|
||||
|
||||
expect(page).toMatchObject(desiredLoadedThumbnail);
|
||||
});
|
||||
|
||||
it('requests page to be rendered with default rotation when given nothing', async () => {
|
||||
const { func: onRenderSuccess, promise: onRenderSuccessPromise } =
|
||||
makeAsyncCallback<[PageCallback]>();
|
||||
|
||||
const { container } = renderWithContext(
|
||||
<Thumbnail onRenderSuccess={onRenderSuccess} pageIndex={0} />,
|
||||
{ pdf },
|
||||
);
|
||||
|
||||
const [page] = await onRenderSuccessPromise;
|
||||
|
||||
const pageCanvas = container.querySelector(
|
||||
'.react-pdf__Thumbnail__page__canvas',
|
||||
) as HTMLCanvasElement;
|
||||
|
||||
const { width, height } = window.getComputedStyle(pageCanvas);
|
||||
|
||||
const viewport = page.getViewport({ scale: 1 });
|
||||
|
||||
// Expect the canvas layer not to be rotated
|
||||
expect(Number.parseInt(width, 10)).toBe(Math.floor(viewport.width));
|
||||
expect(Number.parseInt(height, 10)).toBe(Math.floor(viewport.height));
|
||||
});
|
||||
|
||||
it('requests page to be rendered with given rotation when given rotate prop', async () => {
|
||||
const { func: onRenderSuccess, promise: onRenderSuccessPromise } =
|
||||
makeAsyncCallback<[PageCallback]>();
|
||||
const rotate = 90;
|
||||
|
||||
const { container } = renderWithContext(
|
||||
<Thumbnail onRenderSuccess={onRenderSuccess} pageIndex={0} rotate={rotate} />,
|
||||
{ pdf },
|
||||
);
|
||||
|
||||
const [page] = await onRenderSuccessPromise;
|
||||
|
||||
const pageCanvas = container.querySelector(
|
||||
'.react-pdf__Thumbnail__page__canvas',
|
||||
) as HTMLCanvasElement;
|
||||
|
||||
const { width, height } = window.getComputedStyle(pageCanvas);
|
||||
|
||||
const viewport = page.getViewport({ scale: 1, rotation: rotate });
|
||||
|
||||
// Expect the canvas layer to be rotated
|
||||
expect(Number.parseInt(width, 10)).toBe(Math.floor(viewport.width));
|
||||
expect(Number.parseInt(height, 10)).toBe(Math.floor(viewport.height));
|
||||
});
|
||||
|
||||
it('requests page to be rendered in canvas mode by default', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();
|
||||
|
||||
const { container } = renderWithContext(
|
||||
<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={0} />,
|
||||
{ pdf },
|
||||
);
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
await onLoadSuccessPromise;
|
||||
|
||||
const pageCanvas = container.querySelector('.react-pdf__Thumbnail__page__canvas');
|
||||
|
||||
expect(pageCanvas).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('requests page not to be rendered when given renderMode = "none"', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();
|
||||
|
||||
const { container } = renderWithContext(
|
||||
<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={0} renderMode="none" />,
|
||||
{ pdf },
|
||||
);
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
await onLoadSuccessPromise;
|
||||
|
||||
const pageCanvas = container.querySelector('.react-pdf__Thumbnail__page__canvas');
|
||||
|
||||
expect(pageCanvas).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('requests page to be rendered in canvas mode when given renderMode = "canvas"', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();
|
||||
|
||||
const { container } = renderWithContext(
|
||||
<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={0} renderMode="canvas" />,
|
||||
{ pdf },
|
||||
);
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
await onLoadSuccessPromise;
|
||||
|
||||
const pageCanvas = container.querySelector('.react-pdf__Thumbnail__page__canvas');
|
||||
|
||||
expect(pageCanvas).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('requests page to be rendered in custom mode when given renderMode = "custom"', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } = makeAsyncCallback();
|
||||
|
||||
function CustomRenderer() {
|
||||
return <div className="custom-renderer" />;
|
||||
}
|
||||
|
||||
const { container } = renderWithContext(
|
||||
<Thumbnail
|
||||
customRenderer={CustomRenderer}
|
||||
onLoadSuccess={onLoadSuccess}
|
||||
pageIndex={0}
|
||||
renderMode="custom"
|
||||
/>,
|
||||
{ pdf },
|
||||
);
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
await onLoadSuccessPromise;
|
||||
|
||||
const customRenderer = container.querySelector('.custom-renderer');
|
||||
|
||||
expect(customRenderer).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
it('requests page to be rendered at its original size given nothing', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } =
|
||||
makeAsyncCallback<[PageCallback]>();
|
||||
|
||||
renderWithContext(<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={0} />, { pdf });
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
const [page] = await onLoadSuccessPromise;
|
||||
|
||||
expect(page.width).toEqual(page.originalWidth);
|
||||
});
|
||||
|
||||
it('requests page to be rendered with a proper scale when given scale', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } =
|
||||
makeAsyncCallback<[PageCallback]>();
|
||||
const scale = 1.5;
|
||||
|
||||
renderWithContext(<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={0} scale={scale} />, {
|
||||
pdf,
|
||||
});
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
const [page] = await onLoadSuccessPromise;
|
||||
|
||||
expect(page.width).toEqual(page.originalWidth * scale);
|
||||
});
|
||||
|
||||
it('requests page to be rendered with a proper scale when given width', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } =
|
||||
makeAsyncCallback<[PageCallback]>();
|
||||
const width = 600;
|
||||
|
||||
renderWithContext(<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={0} width={width} />, {
|
||||
pdf,
|
||||
});
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
const [page] = await onLoadSuccessPromise;
|
||||
|
||||
expect(page.width).toEqual(width);
|
||||
});
|
||||
|
||||
it('requests page to be rendered with a proper scale when given width and scale (multiplies)', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } =
|
||||
makeAsyncCallback<[PageCallback]>();
|
||||
const width = 600;
|
||||
const scale = 1.5;
|
||||
|
||||
renderWithContext(
|
||||
<Thumbnail onLoadSuccess={onLoadSuccess} pageIndex={0} scale={scale} width={width} />,
|
||||
{
|
||||
pdf,
|
||||
},
|
||||
);
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
const [page] = await onLoadSuccessPromise;
|
||||
|
||||
expect(page.width).toBeCloseTo(width * scale);
|
||||
});
|
||||
|
||||
it('requests page to be rendered with a proper scale when given height', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } =
|
||||
makeAsyncCallback<[PageCallback]>();
|
||||
const height = 850;
|
||||
|
||||
renderWithContext(<Thumbnail height={height} onLoadSuccess={onLoadSuccess} pageIndex={0} />, {
|
||||
pdf,
|
||||
});
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
const [page] = await onLoadSuccessPromise;
|
||||
|
||||
expect(page.height).toEqual(height);
|
||||
});
|
||||
|
||||
it('requests page to be rendered with a proper scale when given height and scale (multiplies)', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } =
|
||||
makeAsyncCallback<[PageCallback]>();
|
||||
const height = 850;
|
||||
const scale = 1.5;
|
||||
|
||||
renderWithContext(
|
||||
<Thumbnail height={height} onLoadSuccess={onLoadSuccess} pageIndex={0} scale={scale} />,
|
||||
{
|
||||
pdf,
|
||||
},
|
||||
);
|
||||
|
||||
expect.assertions(1);
|
||||
|
||||
const [page] = await onLoadSuccessPromise;
|
||||
|
||||
expect(page.height).toBeCloseTo(height * scale);
|
||||
});
|
||||
|
||||
it('requests page to be rendered with a proper scale when given width and height (ignores height)', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } =
|
||||
makeAsyncCallback<[PageCallback]>();
|
||||
const width = 600;
|
||||
const height = 100;
|
||||
|
||||
renderWithContext(
|
||||
<Thumbnail height={height} onLoadSuccess={onLoadSuccess} pageIndex={0} width={width} />,
|
||||
{
|
||||
pdf,
|
||||
},
|
||||
);
|
||||
|
||||
expect.assertions(2);
|
||||
|
||||
const [page] = await onLoadSuccessPromise;
|
||||
|
||||
expect(page.width).toEqual(width);
|
||||
// Expect proportions to be correct even though invalid height was provided
|
||||
expect(page.height).toEqual(page.originalHeight * (page.width / page.originalWidth));
|
||||
});
|
||||
|
||||
it('requests page to be rendered with a proper scale when given width, height and scale (ignores height, multiplies)', async () => {
|
||||
const { func: onLoadSuccess, promise: onLoadSuccessPromise } =
|
||||
makeAsyncCallback<[PageCallback]>();
|
||||
const width = 600;
|
||||
const height = 100;
|
||||
const scale = 1.5;
|
||||
|
||||
renderWithContext(
|
||||
<Thumbnail
|
||||
height={height}
|
||||
onLoadSuccess={onLoadSuccess}
|
||||
pageIndex={0}
|
||||
scale={scale}
|
||||
width={width}
|
||||
/>,
|
||||
{ pdf },
|
||||
);
|
||||
|
||||
expect.assertions(2);
|
||||
|
||||
const [page] = await onLoadSuccessPromise;
|
||||
|
||||
expect(page.width).toBeCloseTo(width * scale);
|
||||
// Expect proportions to be correct even though invalid height was provided
|
||||
expect(page.height).toEqual(page.originalHeight * (page.width / page.originalWidth));
|
||||
});
|
||||
|
||||
it('calls onTouchStart callback when touched a page (sample of touch events family)', () => {
|
||||
const onTouchStart = vi.fn();
|
||||
|
||||
const { container } = renderWithContext(<Thumbnail onTouchStart={onTouchStart} />, { pdf });
|
||||
|
||||
const page = container.querySelector('.react-pdf__Thumbnail__page') as HTMLDivElement;
|
||||
fireEvent.touchStart(page);
|
||||
|
||||
expect(onTouchStart).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment';
|
||||
import type { MemoState } from './binary-search';
|
||||
export type Source = {
|
||||
__proto__: null;
|
||||
[line: number]: Exclude<ReverseSegment, [number]>[];
|
||||
};
|
||||
export default function buildBySources(decoded: readonly SourceMapSegment[][], memos: MemoState[]): Source[];
|
||||
@@ -0,0 +1,31 @@
|
||||
<img src="https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188" />
|
||||
|
||||
# TanStack React Router
|
||||
|
||||

|
||||
|
||||
🤖 Type-safe router w/ built-in caching & URL state management for React!
|
||||
|
||||
<a href="https://twitter.com/intent/tweet?button_hashtag=TanStack" target="\_parent">
|
||||
<img alt="#TanStack" src="https://img.shields.io/twitter/url?color=%2308a0e9&label=%23TanStack&style=social&url=https%3A%2F%2Ftwitter.com%2Fintent%2Ftweet%3Fbutton_hashtag%3DTanStack">
|
||||
</a><a href="https://discord.com/invite/WrRKjPJ" target="\_parent">
|
||||
<img alt="" src="https://img.shields.io/badge/Discord-TanStack-%235865F2" />
|
||||
</a><a href="https://npmjs.com/package/@tanstack/react-router" target="\_parent">
|
||||
<img alt="" src="https://img.shields.io/npm/dm/@tanstack/router.svg" />
|
||||
</a><a href="https://bundlephobia.com/result?p=@tanstack/react-router" target="\_parent">
|
||||
<img alt="" src="https://badgen.net/bundlephobia/minzip/@tanstack/react-router" />
|
||||
</a><a href="#badge">
|
||||
<img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
|
||||
</a><a href="https://github.com/tanstack/router/discussions">
|
||||
<img alt="Join the discussion on Github" src="https://img.shields.io/badge/Github%20Discussions%20%26%20Support-Chat%20now!-blue" />
|
||||
</a><a href="https://bestofjs.org/projects/router"><img alt="Best of JS" src="https://img.shields.io/endpoint?url=https://bestofjs-serverless.now.sh/api/project-badge?fullName=tanstack%2Frouter%26since=daily" /></a><a href="https://github.com/tanstack/router" target="\_parent">
|
||||
<img alt="" src="https://img.shields.io/github/stars/tanstack/router.svg?style=social&label=Star" />
|
||||
</a><a href="https://twitter.com/tan_stack" target="\_parent">
|
||||
<img alt="" src="https://img.shields.io/twitter/follow/tan_stack.svg?style=social&label=Follow @TanStack" />
|
||||
</a><a href="https://twitter.com/tannerlinsley" target="\_parent">
|
||||
<img alt="" src="https://img.shields.io/twitter/follow/tannerlinsley.svg?style=social&label=Follow @TannerLinsley" />
|
||||
</a>
|
||||
|
||||
Enjoy this library? Try the entire [TanStack](https://tanstack.com)! [React Query](https://github.com/tannerlinsley/react-query), [React Table](https://github.com/tanstack/react-table), [React Charts](https://github.com/tannerlinsley/react-charts), [React Virtual](https://github.com/tannerlinsley/react-virtual)
|
||||
|
||||
## Visit [tanstack.com/router](https://tanstack.com/router) for docs, guides, API and more!
|
||||
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/react.production.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/react.development.js');
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_index","require","isPlaceholderType","placeholderType","targetType","aliases","PLACEHOLDERS_ALIAS","includes"],"sources":["../../src/validators/isPlaceholderType.ts"],"sourcesContent":["import { PLACEHOLDERS_ALIAS } from \"../definitions/index.ts\";\n\n/**\n * Test if a `placeholderType` is a `targetType` or if `targetType` is an alias of `placeholderType`.\n */\nexport default function isPlaceholderType(\n placeholderType: string,\n targetType: string,\n): boolean {\n if (placeholderType === targetType) return true;\n\n const aliases: Array<string> | undefined =\n PLACEHOLDERS_ALIAS[placeholderType];\n if (aliases?.includes(targetType)) return true;\n\n return false;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAKe,SAASC,iBAAiBA,CACvCC,eAAuB,EACvBC,UAAkB,EACT;EACT,IAAID,eAAe,KAAKC,UAAU,EAAE,OAAO,IAAI;EAE/C,MAAMC,OAAkC,GACtCC,yBAAkB,CAACH,eAAe,CAAC;EACrC,IAAIE,OAAO,YAAPA,OAAO,CAAEE,QAAQ,CAACH,UAAU,CAAC,EAAE,OAAO,IAAI;EAE9C,OAAO,KAAK;AACd","ignoreList":[]}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Ivan Kopeykin @vankop
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/** @typedef {import("./Resolver")} Resolver */
|
||||
/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */
|
||||
|
||||
const slashCode = "/".charCodeAt(0);
|
||||
const backslashCode = "\\".charCodeAt(0);
|
||||
|
||||
/**
|
||||
* @param {string} path path
|
||||
* @param {string} parent parent path
|
||||
* @returns {boolean} true, if path is inside of parent
|
||||
*/
|
||||
const isInside = (path, parent) => {
|
||||
if (!path.startsWith(parent)) return false;
|
||||
if (path.length === parent.length) return true;
|
||||
const charCode = path.charCodeAt(parent.length);
|
||||
return charCode === slashCode || charCode === backslashCode;
|
||||
};
|
||||
|
||||
module.exports = class RestrictionsPlugin {
|
||||
/**
|
||||
* @param {string | ResolveStepHook} source source
|
||||
* @param {Set<string | RegExp>} restrictions restrictions
|
||||
*/
|
||||
constructor(source, restrictions) {
|
||||
this.source = source;
|
||||
this.restrictions = restrictions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Resolver} resolver the resolver
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(resolver) {
|
||||
resolver
|
||||
.getHook(this.source)
|
||||
.tapAsync("RestrictionsPlugin", (request, resolveContext, callback) => {
|
||||
if (typeof request.path === "string") {
|
||||
const path = request.path;
|
||||
for (const rule of this.restrictions) {
|
||||
if (typeof rule === "string") {
|
||||
if (!isInside(path, rule)) {
|
||||
if (resolveContext.log) {
|
||||
resolveContext.log(
|
||||
`${path} is not inside of the restriction ${rule}`
|
||||
);
|
||||
}
|
||||
return callback(null, null);
|
||||
}
|
||||
} else if (!rule.test(path)) {
|
||||
if (resolveContext.log) {
|
||||
resolveContext.log(
|
||||
`${path} doesn't match the restriction ${rule}`
|
||||
);
|
||||
}
|
||||
return callback(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","2":"K D E F mC"},B:{"1":"0 9 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC"},E:{"1":"J PB K D E F A B C L M G sC SC tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C"},F:{"1":"0 1 2 3 4 5 6 7 8 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 7C FC kC 8C GC","2":"F 4C 5C","16":"6C"},G:{"1":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"1":"WD"},I:{"1":"LC J I XD YD ZD aD lC bD cD"},J:{"1":"D A"},K:{"1":"B C H FC kC GC","16":"A"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:1,C:"Base64 encoding and decoding",D:true};
|
||||
@@ -0,0 +1,33 @@
|
||||
# shebang-regex [](https://travis-ci.org/sindresorhus/shebang-regex)
|
||||
|
||||
> Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install shebang-regex
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const shebangRegex = require('shebang-regex');
|
||||
|
||||
const string = '#!/usr/bin/env node\nconsole.log("unicorns");';
|
||||
|
||||
shebangRegex.test(string);
|
||||
//=> true
|
||||
|
||||
shebangRegex.exec(string)[0];
|
||||
//=> '#!/usr/bin/env node'
|
||||
|
||||
shebangRegex.exec(string)[1];
|
||||
//=> '/usr/bin/env node'
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
@@ -0,0 +1,179 @@
|
||||
var semver = require('semver')
|
||||
|
||||
function getNextTarget (runtime, targets) {
|
||||
if (targets == null) targets = allTargets
|
||||
var latest = targets.filter(function (t) { return t.runtime === runtime }).slice(-1)[0]
|
||||
var increment = runtime === 'electron' ? 'minor' : 'major'
|
||||
var next = semver.inc(latest.target, increment)
|
||||
// Electron releases appear in the registry in their beta form, sometimes there is
|
||||
// no active beta line. During this time we need to double bump
|
||||
if (runtime === 'electron' && semver.parse(latest.target).prerelease.length) {
|
||||
next = semver.inc(next, 'major')
|
||||
}
|
||||
return next
|
||||
}
|
||||
|
||||
function getAbi (target, runtime) {
|
||||
if (target === String(Number(target))) return target
|
||||
if (target) target = target.replace(/^v/, '')
|
||||
if (!runtime) runtime = 'node'
|
||||
|
||||
if (runtime === 'node') {
|
||||
if (!target) return process.versions.modules
|
||||
if (target === process.versions.node) return process.versions.modules
|
||||
}
|
||||
|
||||
var abi
|
||||
var lastTarget
|
||||
|
||||
for (var i = 0; i < allTargets.length; i++) {
|
||||
var t = allTargets[i]
|
||||
if (t.runtime !== runtime) continue
|
||||
if (semver.lte(t.target, target) && (!lastTarget || semver.gte(t.target, lastTarget))) {
|
||||
abi = t.abi
|
||||
lastTarget = t.target
|
||||
}
|
||||
}
|
||||
|
||||
if (abi && semver.lt(target, getNextTarget(runtime))) return abi
|
||||
throw new Error('Could not detect abi for version ' + target + ' and runtime ' + runtime + '. Updating "node-abi" might help solve this issue if it is a new release of ' + runtime)
|
||||
}
|
||||
|
||||
function getTarget (abi, runtime) {
|
||||
if (abi && abi !== String(Number(abi))) return abi
|
||||
if (!runtime) runtime = 'node'
|
||||
|
||||
if (runtime === 'node' && !abi) return process.versions.node
|
||||
|
||||
var match = allTargets
|
||||
.filter(function (t) {
|
||||
return t.abi === abi && t.runtime === runtime
|
||||
})
|
||||
.map(function (t) {
|
||||
return t.target
|
||||
})
|
||||
if (match.length) {
|
||||
var betaSeparatorIndex = match[0].indexOf("-")
|
||||
return betaSeparatorIndex > -1
|
||||
? match[0].substring(0, betaSeparatorIndex)
|
||||
: match[0]
|
||||
}
|
||||
|
||||
throw new Error('Could not detect target for abi ' + abi + ' and runtime ' + runtime)
|
||||
}
|
||||
|
||||
function sortByTargetFn (a, b) {
|
||||
var abiComp = Number(a.abi) - Number(b.abi)
|
||||
if (abiComp !== 0) return abiComp
|
||||
if (a.target < b.target) return -1
|
||||
if (a.target > b.target) return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
function loadGeneratedTargets () {
|
||||
var registry = require('./abi_registry.json')
|
||||
var targets = {
|
||||
supported: [],
|
||||
additional: [],
|
||||
future: []
|
||||
}
|
||||
|
||||
registry.forEach(function (item) {
|
||||
var target = {
|
||||
runtime: item.runtime,
|
||||
target: item.target,
|
||||
abi: item.abi
|
||||
}
|
||||
if (item.lts) {
|
||||
var startDate = new Date(Date.parse(item.lts[0]))
|
||||
var endDate = new Date(Date.parse(item.lts[1]))
|
||||
var currentDate = new Date()
|
||||
target.lts = startDate < currentDate && currentDate < endDate
|
||||
} else {
|
||||
target.lts = false
|
||||
}
|
||||
|
||||
if (target.runtime === 'node-webkit') {
|
||||
targets.additional.push(target)
|
||||
} else if (item.future) {
|
||||
targets.future.push(target)
|
||||
} else {
|
||||
targets.supported.push(target)
|
||||
}
|
||||
})
|
||||
|
||||
targets.supported.sort(sortByTargetFn)
|
||||
targets.additional.sort(sortByTargetFn)
|
||||
targets.future.sort(sortByTargetFn)
|
||||
|
||||
return targets
|
||||
}
|
||||
|
||||
var generatedTargets = loadGeneratedTargets()
|
||||
|
||||
var supportedTargets = [
|
||||
{runtime: 'node', target: '5.0.0', abi: '47', lts: false},
|
||||
{runtime: 'node', target: '6.0.0', abi: '48', lts: false},
|
||||
{runtime: 'node', target: '7.0.0', abi: '51', lts: false},
|
||||
{runtime: 'node', target: '8.0.0', abi: '57', lts: false},
|
||||
{runtime: 'node', target: '9.0.0', abi: '59', lts: false},
|
||||
{runtime: 'node', target: '10.0.0', abi: '64', lts: new Date(2018, 10, 1) < new Date() && new Date() < new Date(2020, 4, 31)},
|
||||
{runtime: 'electron', target: '0.36.0', abi: '47', lts: false},
|
||||
{runtime: 'electron', target: '1.1.0', abi: '48', lts: false},
|
||||
{runtime: 'electron', target: '1.3.0', abi: '49', lts: false},
|
||||
{runtime: 'electron', target: '1.4.0', abi: '50', lts: false},
|
||||
{runtime: 'electron', target: '1.5.0', abi: '51', lts: false},
|
||||
{runtime: 'electron', target: '1.6.0', abi: '53', lts: false},
|
||||
{runtime: 'electron', target: '1.7.0', abi: '54', lts: false},
|
||||
{runtime: 'electron', target: '1.8.0', abi: '57', lts: false},
|
||||
{runtime: 'electron', target: '2.0.0', abi: '57', lts: false},
|
||||
{runtime: 'electron', target: '3.0.0', abi: '64', lts: false},
|
||||
{runtime: 'electron', target: '4.0.0', abi: '64', lts: false},
|
||||
{runtime: 'electron', target: '4.0.4', abi: '69', lts: false}
|
||||
]
|
||||
|
||||
supportedTargets.push.apply(supportedTargets, generatedTargets.supported)
|
||||
|
||||
var additionalTargets = [
|
||||
{runtime: 'node-webkit', target: '0.13.0', abi: '47', lts: false},
|
||||
{runtime: 'node-webkit', target: '0.15.0', abi: '48', lts: false},
|
||||
{runtime: 'node-webkit', target: '0.18.3', abi: '51', lts: false},
|
||||
{runtime: 'node-webkit', target: '0.23.0', abi: '57', lts: false},
|
||||
{runtime: 'node-webkit', target: '0.26.5', abi: '59', lts: false}
|
||||
]
|
||||
|
||||
additionalTargets.push.apply(additionalTargets, generatedTargets.additional)
|
||||
|
||||
var deprecatedTargets = [
|
||||
{runtime: 'node', target: '0.2.0', abi: '1', lts: false},
|
||||
{runtime: 'node', target: '0.9.1', abi: '0x000A', lts: false},
|
||||
{runtime: 'node', target: '0.9.9', abi: '0x000B', lts: false},
|
||||
{runtime: 'node', target: '0.10.4', abi: '11', lts: false},
|
||||
{runtime: 'node', target: '0.11.0', abi: '0x000C', lts: false},
|
||||
{runtime: 'node', target: '0.11.8', abi: '13', lts: false},
|
||||
{runtime: 'node', target: '0.11.11', abi: '14', lts: false},
|
||||
{runtime: 'node', target: '1.0.0', abi: '42', lts: false},
|
||||
{runtime: 'node', target: '1.1.0', abi: '43', lts: false},
|
||||
{runtime: 'node', target: '2.0.0', abi: '44', lts: false},
|
||||
{runtime: 'node', target: '3.0.0', abi: '45', lts: false},
|
||||
{runtime: 'node', target: '4.0.0', abi: '46', lts: false},
|
||||
{runtime: 'electron', target: '0.30.0', abi: '44', lts: false},
|
||||
{runtime: 'electron', target: '0.31.0', abi: '45', lts: false},
|
||||
{runtime: 'electron', target: '0.33.0', abi: '46', lts: false}
|
||||
]
|
||||
|
||||
var futureTargets = generatedTargets.future
|
||||
|
||||
var allTargets = deprecatedTargets
|
||||
.concat(supportedTargets)
|
||||
.concat(additionalTargets)
|
||||
.concat(futureTargets)
|
||||
|
||||
exports.getAbi = getAbi
|
||||
exports.getTarget = getTarget
|
||||
exports.deprecatedTargets = deprecatedTargets
|
||||
exports.supportedTargets = supportedTargets
|
||||
exports.additionalTargets = additionalTargets
|
||||
exports.futureTargets = futureTargets
|
||||
exports.allTargets = allTargets
|
||||
exports._getNextTarget = getNextTarget
|
||||
Reference in New Issue
Block a user