update
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
import { BaseRootRoute, BaseRoute, BaseRouteApi, AnyContext, AnyRoute, AnyRouter, ConstrainLiteral, ErrorComponentProps, NotFoundError, NotFoundRouteProps, RegisteredRouter, ResolveFullPath, ResolveId, ResolveParams, RootRouteId, RootRouteOptions, RouteConstraints, RouteIds, RouteMask, RouteOptions, RouteTypesById, RouterCore, ToMaskOptions, UseNavigateResult } from '@tanstack/router-core';
|
||||
import { UseLoaderDataRoute } from './useLoaderData.js';
|
||||
import { UseMatchRoute } from './useMatch.js';
|
||||
import { UseLoaderDepsRoute } from './useLoaderDeps.js';
|
||||
import { UseParamsRoute } from './useParams.js';
|
||||
import { UseSearchRoute } from './useSearch.js';
|
||||
import { UseRouteContextRoute } from './useRouteContext.js';
|
||||
import type * as React from 'react';
|
||||
declare module '@tanstack/router-core' {
|
||||
interface UpdatableRouteOptionsExtensions {
|
||||
component?: RouteComponent;
|
||||
errorComponent?: false | null | ErrorRouteComponent;
|
||||
notFoundComponent?: NotFoundRouteComponent;
|
||||
pendingComponent?: RouteComponent;
|
||||
}
|
||||
interface RouteExtensions<TId extends string, TFullPath extends string> {
|
||||
useMatch: UseMatchRoute<TId>;
|
||||
useRouteContext: UseRouteContextRoute<TId>;
|
||||
useSearch: UseSearchRoute<TId>;
|
||||
useParams: UseParamsRoute<TId>;
|
||||
useLoaderDeps: UseLoaderDepsRoute<TId>;
|
||||
useLoaderData: UseLoaderDataRoute<TId>;
|
||||
useNavigate: () => UseNavigateResult<TFullPath>;
|
||||
}
|
||||
}
|
||||
export declare function getRouteApi<const TId, TRouter extends AnyRouter = RegisteredRouter>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>): RouteApi<TId, TRouter>;
|
||||
export declare class RouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> extends BaseRouteApi<TId, TRouter> {
|
||||
/**
|
||||
* @deprecated Use the `getRouteApi` function instead.
|
||||
*/
|
||||
constructor({ id }: {
|
||||
id: TId;
|
||||
});
|
||||
useMatch: UseMatchRoute<TId>;
|
||||
useRouteContext: UseRouteContextRoute<TId>;
|
||||
useSearch: UseSearchRoute<TId>;
|
||||
useParams: UseParamsRoute<TId>;
|
||||
useLoaderDeps: UseLoaderDepsRoute<TId>;
|
||||
useLoaderData: UseLoaderDataRoute<TId>;
|
||||
useNavigate: () => UseNavigateResult<RouteTypesById<TRouter, TId>["fullPath"]>;
|
||||
notFound: (opts?: NotFoundError) => NotFoundError;
|
||||
}
|
||||
export declare class Route<in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, in out TPath extends RouteConstraints['TPath'] = '/', in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, in out TCustomId extends RouteConstraints['TCustomId'] = string, in out TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, in out TSearchValidator = undefined, in out TParams = ResolveParams<TPath>, in out TRouterContext = AnyContext, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown> extends BaseRoute<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes> {
|
||||
/**
|
||||
* @deprecated Use the `createRoute` function instead.
|
||||
*/
|
||||
constructor(options?: RouteOptions<TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>);
|
||||
useMatch: UseMatchRoute<TId>;
|
||||
useRouteContext: UseRouteContextRoute<TId>;
|
||||
useSearch: UseSearchRoute<TId>;
|
||||
useParams: UseParamsRoute<TId>;
|
||||
useLoaderDeps: UseLoaderDepsRoute<TId>;
|
||||
useLoaderData: UseLoaderDataRoute<TId>;
|
||||
useNavigate: () => UseNavigateResult<TFullPath>;
|
||||
}
|
||||
export declare function createRoute<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown>(options: RouteOptions<TParentRoute, TId, TCustomId, TFullPath, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn>): Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren>;
|
||||
export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>;
|
||||
export declare function createRootRouteWithContext<TRouterContext extends {}>(): <TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TSearchValidator = undefined, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined>(options?: RootRouteOptions<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn>) => RootRoute<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, unknown, unknown>;
|
||||
/**
|
||||
* @deprecated Use the `createRootRouteWithContext` function instead.
|
||||
*/
|
||||
export declare const rootRouteWithContext: typeof createRootRouteWithContext;
|
||||
export declare class RootRoute<in out TSearchValidator = undefined, in out TRouterContext = {}, in out TRouteContextFn = AnyContext, in out TBeforeLoadFn = AnyContext, in out TLoaderDeps extends Record<string, any> = {}, in out TLoaderFn = undefined, in out TChildren = unknown, in out TFileRouteTypes = unknown> extends BaseRootRoute<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, TFileRouteTypes> {
|
||||
/**
|
||||
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
||||
*/
|
||||
constructor(options?: RootRouteOptions<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn>);
|
||||
useMatch: UseMatchRoute<RootRouteId>;
|
||||
useRouteContext: UseRouteContextRoute<RootRouteId>;
|
||||
useSearch: UseSearchRoute<RootRouteId>;
|
||||
useParams: UseParamsRoute<RootRouteId>;
|
||||
useLoaderDeps: UseLoaderDepsRoute<RootRouteId>;
|
||||
useLoaderData: UseLoaderDataRoute<RootRouteId>;
|
||||
useNavigate: () => UseNavigateResult<"/">;
|
||||
}
|
||||
export declare function createRootRoute<TSearchValidator = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined>(options?: RootRouteOptions<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn>): RootRoute<TSearchValidator, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, unknown, unknown>;
|
||||
export declare function createRouteMask<TRouteTree extends AnyRoute, TFrom extends string, TTo extends string>(opts: {
|
||||
routeTree: TRouteTree;
|
||||
} & ToMaskOptions<RouterCore<TRouteTree, 'never', boolean>, TFrom, TTo>): RouteMask<TRouteTree>;
|
||||
export type ReactNode = any;
|
||||
export type SyncRouteComponent<TProps> = ((props: TProps) => ReactNode) | React.LazyExoticComponent<(props: TProps) => ReactNode>;
|
||||
export type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
|
||||
preload?: () => Promise<void>;
|
||||
};
|
||||
export type RouteComponent<TProps = any> = AsyncRouteComponent<TProps>;
|
||||
export type ErrorRouteComponent = RouteComponent<ErrorComponentProps>;
|
||||
export type NotFoundRouteComponent = SyncRouteComponent<NotFoundRouteProps>;
|
||||
export declare class NotFoundRoute<TParentRoute extends AnyRootRoute, TRouterContext = AnyContext, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TSearchValidator = undefined, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown> extends Route<TParentRoute, '/404', '/404', '404', '404', TSearchValidator, {}, TRouterContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren> {
|
||||
constructor(options: Omit<RouteOptions<TParentRoute, string, string, string, string, TSearchValidator, {}, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn>, 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id' | 'params'>);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* PDF.js worker entry file.
|
||||
*
|
||||
* This file is identical to Mozilla's pdf.worker.entry.js, with one exception being placed inside
|
||||
* this bundle, not theirs.
|
||||
*/
|
||||
(typeof window !== 'undefined' ? window : {}).pdfjsWorker =
|
||||
// @ts-expect-error - pdfjs-dist does not ship with types
|
||||
await import('pdfjs-dist/build/pdf.worker.mjs');
|
||||
export {};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
module.exports={C:{_:"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 52 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 3.5 3.6"},D:{"134":33.33,_:"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 52 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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 135 136 137 138"},F:{_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134"},E:{_:"0 4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 15.2-15.3 15.4 15.5 15.6 16.0 16.1 16.2 16.3 16.4 16.5 16.6 17.0 17.1 17.2 17.3 17.4 17.5 17.6 18.0 18.1 18.2 18.3 18.4"},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00333,"5.0-5.1":0,"6.0-6.1":0.01,"7.0-7.1":0.00667,"8.1-8.4":0,"9.0-9.2":0.005,"9.3":0.02333,"10.0-10.2":0.00167,"10.3":0.03834,"11.0-11.2":0.17668,"11.3-11.4":0.01167,"12.0-12.1":0.00667,"12.2-12.5":0.16501,"13.0-13.1":0.00333,"13.2":0.005,"13.3":0.00667,"13.4-13.7":0.02333,"14.0-14.4":0.05834,"14.5-14.8":0.07,"15.0-15.1":0.03834,"15.2-15.3":0.03834,"15.4":0.04667,"15.5":0.05334,"15.6-15.8":0.6567,"16.0":0.09334,"16.1":0.19168,"16.2":0.10001,"16.3":0.17334,"16.4":0.03834,"16.5":0.07167,"16.6-16.7":0.77837,"17.0":0.04667,"17.1":0.08334,"17.2":0.06334,"17.3":0.08834,"17.4":0.17668,"17.5":0.39335,"17.6-17.7":1.14172,"18.0":0.32002,"18.1":1.04672,"18.2":0.46836,"18.3":9.78882,"18.4":0.14501},P:{_:"4 20 21 22 23 24 25 26 27 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0"},I:{"0":49.89749,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.015,"4.4":0,"4.4.3-4.4.4":0.055},K:{"0":0,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{_:"0"},Q:{_:"14.9"},O:{_:"0"},H:{"0":0},L:{_:"0"}};
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { AllParams, RouteById } from './routeInfo'
|
||||
import type { AnyRouter } from './router'
|
||||
import type { Expand } from './utils'
|
||||
|
||||
export type ResolveUseParams<
|
||||
TRouter extends AnyRouter,
|
||||
TFrom,
|
||||
TStrict extends boolean,
|
||||
> = TStrict extends false
|
||||
? AllParams<TRouter['routeTree']>
|
||||
: Expand<RouteById<TRouter['routeTree'], TFrom>['types']['allParams']>
|
||||
|
||||
export type UseParamsResult<
|
||||
TRouter extends AnyRouter,
|
||||
TFrom,
|
||||
TStrict extends boolean,
|
||||
TSelected,
|
||||
> = unknown extends TSelected
|
||||
? ResolveUseParams<TRouter, TFrom, TStrict>
|
||||
: TSelected
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_core","require","_traverse","rewriteThisVisitor","rewriteThis","programPath","visitors","environmentVisitor","ThisExpression","path","replaceWith","t","unaryExpression","numericLiteral","noScope","traverse","node"],"sources":["../src/rewrite-this.ts"],"sourcesContent":["import { types as t } from \"@babel/core\";\nimport traverse, { visitors, type NodePath } from \"@babel/traverse\";\n\n/**\n * A lazily constructed visitor to walk the tree, rewriting all `this` references in the\n * top-level scope to be `void 0` (undefined).\n *\n */\nlet rewriteThisVisitor: Parameters<typeof traverse>[1];\n\nexport default function rewriteThis(programPath: NodePath) {\n if (!rewriteThisVisitor) {\n rewriteThisVisitor = visitors.environmentVisitor({\n ThisExpression(path) {\n path.replaceWith(t.unaryExpression(\"void\", t.numericLiteral(0), true));\n },\n });\n rewriteThisVisitor.noScope = true;\n }\n // Rewrite \"this\" to be \"undefined\".\n traverse(programPath.node, rewriteThisVisitor);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAOA,IAAIE,kBAAkD;AAEvC,SAASC,WAAWA,CAACC,WAAqB,EAAE;EACzD,IAAI,CAACF,kBAAkB,EAAE;IACvBA,kBAAkB,GAAGG,kBAAQ,CAACC,kBAAkB,CAAC;MAC/CC,cAAcA,CAACC,IAAI,EAAE;QACnBA,IAAI,CAACC,WAAW,CAACC,WAAC,CAACC,eAAe,CAAC,MAAM,EAAED,WAAC,CAACE,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;MACxE;IACF,CAAC,CAAC;IACFV,kBAAkB,CAACW,OAAO,GAAG,IAAI;EACnC;EAEA,IAAAC,iBAAQ,EAACV,WAAW,CAACW,IAAI,EAAEb,kBAAkB,CAAC;AAChD","ignoreList":[]}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined"],"sources":["../../src/helpers/asyncToGenerator.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nfunction asyncGeneratorStep<TYield, TReturn>(\n gen: Generator<TYield, TReturn, Awaited<TYield>>,\n resolve: (value: TReturn) => void,\n reject: (error: unknown) => void,\n _next: (value: Awaited<TYield> | undefined) => void,\n _throw: (err: unknown) => void,\n key: \"next\",\n arg: Awaited<TYield> | undefined,\n): void;\nfunction asyncGeneratorStep<TYield, TReturn>(\n gen: Generator<TYield, TReturn, Awaited<TYield>>,\n resolve: (value: TReturn) => void,\n reject: (error: unknown) => void,\n _next: (value: Awaited<TYield> | undefined) => void,\n _throw: (err: unknown) => void,\n key: \"throw\",\n arg: unknown,\n): void;\nfunction asyncGeneratorStep<TYield, TReturn>(\n gen: Generator<TYield, TReturn, Awaited<TYield>>,\n resolve: (value: TReturn) => void,\n reject: (error: unknown) => void,\n _next: (value: Awaited<TYield> | undefined) => void,\n _throw: (err: unknown) => void,\n key: \"next\" | \"throw\",\n arg: any,\n): void {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n // The \"value\" variable is defined above before the \"info.done\" guard\n // So TypeScript can't narrowing \"value\" to TReturn here\n // If we use \"info.value\" here the type is narrowed correctly.\n // Still requires manual casting for the smaller bundle size.\n resolve(value as TReturn);\n } else {\n // Same as above, TypeScript can't narrow \"value\" to TYield here\n Promise.resolve(value as TYield).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator<\n This,\n Args extends unknown[],\n TYield,\n TReturn,\n>(\n fn: (\n this: This,\n ...args: Args\n ) => Generator<TYield, TReturn, Awaited<TYield>>,\n): (this: This, ...args: Args) => Promise<TReturn> {\n return function (this: any) {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n // Casting \"args\" to \"Args\" is intentional since we are trying to avoid the spread operator (not ES5)\n var gen = fn.apply(self, args as any as Args);\n function _next(value: Awaited<TYield> | undefined) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err: unknown) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n"],"mappings":";;;;;;AAoBA,SAASA,kBAAkBA,CACzBC,GAAgD,EAChDC,OAAiC,EACjCC,MAAgC,EAChCC,KAAmD,EACnDC,MAA8B,EAC9BC,GAAqB,EACrBC,GAAQ,EACF;EACN,IAAI;IACF,IAAIC,IAAI,GAAGP,GAAG,CAACK,GAAG,CAAC,CAACC,GAAG,CAAC;IACxB,IAAIE,KAAK,GAAGD,IAAI,CAACC,KAAK;EACxB,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdP,MAAM,CAACO,KAAK,CAAC;IACb;EACF;EAEA,IAAIF,IAAI,CAACG,IAAI,EAAE;IAKbT,OAAO,CAACO,KAAgB,CAAC;EAC3B,CAAC,MAAM;IAELG,OAAO,CAACV,OAAO,CAACO,KAAe,CAAC,CAACI,IAAI,CAACT,KAAK,EAAEC,MAAM,CAAC;EACtD;AACF;AAEe,SAASS,iBAAiBA,CAMvCC,EAGgD,EACC;EACjD,OAAO,YAAqB;IAC1B,IAAIC,IAAI,GAAG,IAAI;MACbC,IAAI,GAAGC,SAAS;IAClB,OAAO,IAAIN,OAAO,CAAC,UAAUV,OAAO,EAAEC,MAAM,EAAE;MAE5C,IAAIF,GAAG,GAAGc,EAAE,CAACI,KAAK,CAACH,IAAI,EAAEC,IAAmB,CAAC;MAC7C,SAASb,KAAKA,CAACK,KAAkC,EAAE;QACjDT,kBAAkB,CAACC,GAAG,EAAEC,OAAO,EAAEC,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAE,MAAM,EAAEI,KAAK,CAAC;MACxE;MACA,SAASJ,MAAMA,CAACe,GAAY,EAAE;QAC5BpB,kBAAkB,CAACC,GAAG,EAAEC,OAAO,EAAEC,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAE,OAAO,EAAEe,GAAG,CAAC;MACvE;MAEAhB,KAAK,CAACiB,SAAS,CAAC;IAClB,CAAC,CAAC;EACJ,CAAC;AACH","ignoreList":[]}
|
||||
@@ -0,0 +1,133 @@
|
||||
'use strict'
|
||||
|
||||
let pico = require('picocolors')
|
||||
|
||||
let terminalHighlight = require('./terminal-highlight')
|
||||
|
||||
class CssSyntaxError extends Error {
|
||||
constructor(message, line, column, source, file, plugin) {
|
||||
super(message)
|
||||
this.name = 'CssSyntaxError'
|
||||
this.reason = message
|
||||
|
||||
if (file) {
|
||||
this.file = file
|
||||
}
|
||||
if (source) {
|
||||
this.source = source
|
||||
}
|
||||
if (plugin) {
|
||||
this.plugin = plugin
|
||||
}
|
||||
if (typeof line !== 'undefined' && typeof column !== 'undefined') {
|
||||
if (typeof line === 'number') {
|
||||
this.line = line
|
||||
this.column = column
|
||||
} else {
|
||||
this.line = line.line
|
||||
this.column = line.column
|
||||
this.endLine = column.line
|
||||
this.endColumn = column.column
|
||||
}
|
||||
}
|
||||
|
||||
this.setMessage()
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, CssSyntaxError)
|
||||
}
|
||||
}
|
||||
|
||||
setMessage() {
|
||||
this.message = this.plugin ? this.plugin + ': ' : ''
|
||||
this.message += this.file ? this.file : '<css input>'
|
||||
if (typeof this.line !== 'undefined') {
|
||||
this.message += ':' + this.line + ':' + this.column
|
||||
}
|
||||
this.message += ': ' + this.reason
|
||||
}
|
||||
|
||||
showSourceCode(color) {
|
||||
if (!this.source) return ''
|
||||
|
||||
let css = this.source
|
||||
if (color == null) color = pico.isColorSupported
|
||||
|
||||
let aside = text => text
|
||||
let mark = text => text
|
||||
let highlight = text => text
|
||||
if (color) {
|
||||
let { bold, gray, red } = pico.createColors(true)
|
||||
mark = text => bold(red(text))
|
||||
aside = text => gray(text)
|
||||
if (terminalHighlight) {
|
||||
highlight = text => terminalHighlight(text)
|
||||
}
|
||||
}
|
||||
|
||||
let lines = css.split(/\r?\n/)
|
||||
let start = Math.max(this.line - 3, 0)
|
||||
let end = Math.min(this.line + 2, lines.length)
|
||||
let maxWidth = String(end).length
|
||||
|
||||
return lines
|
||||
.slice(start, end)
|
||||
.map((line, index) => {
|
||||
let number = start + 1 + index
|
||||
let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | '
|
||||
if (number === this.line) {
|
||||
if (line.length > 160) {
|
||||
let padding = 20
|
||||
let subLineStart = Math.max(0, this.column - padding)
|
||||
let subLineEnd = Math.max(
|
||||
this.column + padding,
|
||||
this.endColumn + padding
|
||||
)
|
||||
let subLine = line.slice(subLineStart, subLineEnd)
|
||||
|
||||
let spacing =
|
||||
aside(gutter.replace(/\d/g, ' ')) +
|
||||
line
|
||||
.slice(0, Math.min(this.column - 1, padding - 1))
|
||||
.replace(/[^\t]/g, ' ')
|
||||
|
||||
return (
|
||||
mark('>') +
|
||||
aside(gutter) +
|
||||
highlight(subLine) +
|
||||
'\n ' +
|
||||
spacing +
|
||||
mark('^')
|
||||
)
|
||||
}
|
||||
|
||||
let spacing =
|
||||
aside(gutter.replace(/\d/g, ' ')) +
|
||||
line.slice(0, this.column - 1).replace(/[^\t]/g, ' ')
|
||||
|
||||
return (
|
||||
mark('>') +
|
||||
aside(gutter) +
|
||||
highlight(line) +
|
||||
'\n ' +
|
||||
spacing +
|
||||
mark('^')
|
||||
)
|
||||
}
|
||||
|
||||
return ' ' + aside(gutter) + highlight(line)
|
||||
})
|
||||
.join('\n')
|
||||
}
|
||||
|
||||
toString() {
|
||||
let code = this.showSourceCode()
|
||||
if (code) {
|
||||
code = '\n\n' + code + '\n'
|
||||
}
|
||||
return this.name + ': ' + this.message + code
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CssSyntaxError
|
||||
CssSyntaxError.default = CssSyntaxError
|
||||
@@ -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:{"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:{"1":"0 9 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 cB dB eB fB gB hB iB jB kB","66":"lB mB nB","129":"oB pB qB rB sB tB"},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:{"1":"0 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 SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"2":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 fD gD hD TC iD jD kD lD mD IC JC KC nD","2":"J dD eD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"2":"qD rD"}},B:5,C:"Credential Management API",D:true};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_identity","x"],"sources":["../../src/helpers/identity.ts"],"sourcesContent":["/* @minVersion 7.17.0 */\n\nexport default function _identity<T>(x: T) {\n return x;\n}\n"],"mappings":";;;;;;AAEe,SAASA,SAASA,CAAIC,CAAI,EAAE;EACzC,OAAOA,CAAC;AACV","ignoreList":[]}
|
||||
@@ -0,0 +1,346 @@
|
||||
var test = require('tape')
|
||||
var rimraf = require('rimraf')
|
||||
var tar = require('../index')
|
||||
var tarStream = require('tar-stream')
|
||||
var path = require('path')
|
||||
var fs = require('fs')
|
||||
var os = require('os')
|
||||
|
||||
var win32 = os.platform() === 'win32'
|
||||
|
||||
var mtime = function (st) {
|
||||
return Math.floor(st.mtime.getTime() / 1000)
|
||||
}
|
||||
|
||||
test('copy a -> copy/a', function (t) {
|
||||
t.plan(5)
|
||||
|
||||
var a = path.join(__dirname, 'fixtures', 'a')
|
||||
var b = path.join(__dirname, 'fixtures', 'copy', 'a')
|
||||
|
||||
rimraf.sync(b)
|
||||
tar.pack(a)
|
||||
.pipe(tar.extract(b))
|
||||
.on('finish', function () {
|
||||
var files = fs.readdirSync(b)
|
||||
t.same(files.length, 1)
|
||||
t.same(files[0], 'hello.txt')
|
||||
var fileB = path.join(b, files[0])
|
||||
var fileA = path.join(a, files[0])
|
||||
t.same(fs.readFileSync(fileB, 'utf-8'), fs.readFileSync(fileA, 'utf-8'))
|
||||
t.same(fs.statSync(fileB).mode, fs.statSync(fileA).mode)
|
||||
t.same(mtime(fs.statSync(fileB)), mtime(fs.statSync(fileA)))
|
||||
})
|
||||
})
|
||||
|
||||
test('copy b -> copy/b', function (t) {
|
||||
t.plan(8)
|
||||
|
||||
var a = path.join(__dirname, 'fixtures', 'b')
|
||||
var b = path.join(__dirname, 'fixtures', 'copy', 'b')
|
||||
|
||||
rimraf.sync(b)
|
||||
tar.pack(a)
|
||||
.pipe(tar.extract(b))
|
||||
.on('finish', function () {
|
||||
var files = fs.readdirSync(b)
|
||||
t.same(files.length, 1)
|
||||
t.same(files[0], 'a')
|
||||
var dirB = path.join(b, files[0])
|
||||
var dirA = path.join(a, files[0])
|
||||
t.same(fs.statSync(dirB).mode, fs.statSync(dirA).mode)
|
||||
t.same(mtime(fs.statSync(dirB)), mtime(fs.statSync(dirA)))
|
||||
t.ok(fs.statSync(dirB).isDirectory())
|
||||
var fileB = path.join(dirB, 'test.txt')
|
||||
var fileA = path.join(dirA, 'test.txt')
|
||||
t.same(fs.readFileSync(fileB, 'utf-8'), fs.readFileSync(fileA, 'utf-8'))
|
||||
t.same(fs.statSync(fileB).mode, fs.statSync(fileA).mode)
|
||||
t.same(mtime(fs.statSync(fileB)), mtime(fs.statSync(fileA)))
|
||||
})
|
||||
})
|
||||
|
||||
test('symlink', function (t) {
|
||||
if (win32) { // no symlink support on win32 currently. TODO: test if this can be enabled somehow
|
||||
t.plan(1)
|
||||
t.ok(true)
|
||||
return
|
||||
}
|
||||
|
||||
t.plan(5)
|
||||
|
||||
var a = path.join(__dirname, 'fixtures', 'c')
|
||||
|
||||
rimraf.sync(path.join(a, 'link'))
|
||||
fs.symlinkSync('.gitignore', path.join(a, 'link'))
|
||||
|
||||
var b = path.join(__dirname, 'fixtures', 'copy', 'c')
|
||||
|
||||
rimraf.sync(b)
|
||||
tar.pack(a)
|
||||
.pipe(tar.extract(b))
|
||||
.on('finish', function () {
|
||||
var files = fs.readdirSync(b).sort()
|
||||
t.same(files.length, 2)
|
||||
t.same(files[0], '.gitignore')
|
||||
t.same(files[1], 'link')
|
||||
|
||||
var linkA = path.join(a, 'link')
|
||||
var linkB = path.join(b, 'link')
|
||||
|
||||
t.same(mtime(fs.lstatSync(linkB)), mtime(fs.lstatSync(linkA)))
|
||||
t.same(fs.readlinkSync(linkB), fs.readlinkSync(linkA))
|
||||
})
|
||||
})
|
||||
|
||||
test('follow symlinks', function (t) {
|
||||
if (win32) { // no symlink support on win32 currently. TODO: test if this can be enabled somehow
|
||||
t.plan(1)
|
||||
t.ok(true)
|
||||
return
|
||||
}
|
||||
|
||||
t.plan(5)
|
||||
|
||||
var a = path.join(__dirname, 'fixtures', 'c')
|
||||
|
||||
rimraf.sync(path.join(a, 'link'))
|
||||
fs.symlinkSync('.gitignore', path.join(a, 'link'))
|
||||
|
||||
var b = path.join(__dirname, 'fixtures', 'copy', 'c-dereference')
|
||||
|
||||
rimraf.sync(b)
|
||||
tar.pack(a, { dereference: true })
|
||||
.pipe(tar.extract(b))
|
||||
.on('finish', function () {
|
||||
var files = fs.readdirSync(b).sort()
|
||||
t.same(files.length, 2)
|
||||
t.same(files[0], '.gitignore')
|
||||
t.same(files[1], 'link')
|
||||
|
||||
var file1 = path.join(b, '.gitignore')
|
||||
var file2 = path.join(b, 'link')
|
||||
|
||||
t.same(mtime(fs.lstatSync(file1)), mtime(fs.lstatSync(file2)))
|
||||
t.same(fs.readFileSync(file1), fs.readFileSync(file2))
|
||||
})
|
||||
})
|
||||
|
||||
test('strip', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var a = path.join(__dirname, 'fixtures', 'b')
|
||||
var b = path.join(__dirname, 'fixtures', 'copy', 'b-strip')
|
||||
|
||||
rimraf.sync(b)
|
||||
|
||||
tar.pack(a)
|
||||
.pipe(tar.extract(b, { strip: 1 }))
|
||||
.on('finish', function () {
|
||||
var files = fs.readdirSync(b).sort()
|
||||
t.same(files.length, 1)
|
||||
t.same(files[0], 'test.txt')
|
||||
})
|
||||
})
|
||||
|
||||
test('strip + map', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var a = path.join(__dirname, 'fixtures', 'b')
|
||||
var b = path.join(__dirname, 'fixtures', 'copy', 'b-strip')
|
||||
|
||||
rimraf.sync(b)
|
||||
|
||||
var uppercase = function (header) {
|
||||
header.name = header.name.toUpperCase()
|
||||
return header
|
||||
}
|
||||
|
||||
tar.pack(a)
|
||||
.pipe(tar.extract(b, { strip: 1, map: uppercase }))
|
||||
.on('finish', function () {
|
||||
var files = fs.readdirSync(b).sort()
|
||||
t.same(files.length, 1)
|
||||
t.same(files[0], 'TEST.TXT')
|
||||
})
|
||||
})
|
||||
|
||||
test('map + dir + permissions', function (t) {
|
||||
t.plan(win32 ? 1 : 2) // skip chmod test, it's not working like unix
|
||||
|
||||
var a = path.join(__dirname, 'fixtures', 'b')
|
||||
var b = path.join(__dirname, 'fixtures', 'copy', 'a-perms')
|
||||
|
||||
rimraf.sync(b)
|
||||
|
||||
var aWithMode = function (header) {
|
||||
if (header.name === 'a') {
|
||||
header.mode = parseInt(700, 8)
|
||||
}
|
||||
return header
|
||||
}
|
||||
|
||||
tar.pack(a)
|
||||
.pipe(tar.extract(b, { map: aWithMode }))
|
||||
.on('finish', function () {
|
||||
var files = fs.readdirSync(b).sort()
|
||||
var stat = fs.statSync(path.join(b, 'a'))
|
||||
t.same(files.length, 1)
|
||||
if (!win32) {
|
||||
t.same(stat.mode & parseInt(777, 8), parseInt(700, 8))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
test('specific entries', function (t) {
|
||||
t.plan(6)
|
||||
|
||||
var a = path.join(__dirname, 'fixtures', 'd')
|
||||
var b = path.join(__dirname, 'fixtures', 'copy', 'd-entries')
|
||||
|
||||
var entries = ['file1', 'sub-files/file3', 'sub-dir']
|
||||
|
||||
rimraf.sync(b)
|
||||
tar.pack(a, { entries: entries })
|
||||
.pipe(tar.extract(b))
|
||||
.on('finish', function () {
|
||||
var files = fs.readdirSync(b)
|
||||
t.same(files.length, 3)
|
||||
t.notSame(files.indexOf('file1'), -1)
|
||||
t.notSame(files.indexOf('sub-files'), -1)
|
||||
t.notSame(files.indexOf('sub-dir'), -1)
|
||||
var subFiles = fs.readdirSync(path.join(b, 'sub-files'))
|
||||
t.same(subFiles, ['file3'])
|
||||
var subDir = fs.readdirSync(path.join(b, 'sub-dir'))
|
||||
t.same(subDir, ['file5'])
|
||||
})
|
||||
})
|
||||
|
||||
test('check type while mapping header on packing', function (t) {
|
||||
t.plan(3)
|
||||
|
||||
var e = path.join(__dirname, 'fixtures', 'e')
|
||||
|
||||
var checkHeaderType = function (header) {
|
||||
if (header.name.indexOf('.') === -1) t.same(header.type, header.name)
|
||||
}
|
||||
|
||||
tar.pack(e, { map: checkHeaderType })
|
||||
})
|
||||
|
||||
test('finish callbacks', function (t) {
|
||||
t.plan(3)
|
||||
|
||||
var a = path.join(__dirname, 'fixtures', 'a')
|
||||
var b = path.join(__dirname, 'fixtures', 'copy', 'a')
|
||||
|
||||
rimraf.sync(b)
|
||||
|
||||
var packEntries = 0
|
||||
var extractEntries = 0
|
||||
|
||||
var countPackEntry = function (header) { packEntries++ }
|
||||
var countExtractEntry = function (header) { extractEntries++ }
|
||||
|
||||
var pack
|
||||
var onPackFinish = function (passedPack) {
|
||||
t.equal(packEntries, 2, 'All entries have been packed') // 2 entries - the file and base directory
|
||||
t.equal(passedPack, pack, 'The finish hook passes the pack')
|
||||
}
|
||||
|
||||
var onExtractFinish = function () { t.equal(extractEntries, 2) }
|
||||
|
||||
pack = tar.pack(a, { map: countPackEntry, finish: onPackFinish })
|
||||
|
||||
pack.pipe(tar.extract(b, { map: countExtractEntry, finish: onExtractFinish }))
|
||||
.on('finish', function () {
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('not finalizing the pack', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var a = path.join(__dirname, 'fixtures', 'a')
|
||||
var b = path.join(__dirname, 'fixtures', 'b')
|
||||
|
||||
var out = path.join(__dirname, 'fixtures', 'copy', 'merged-packs')
|
||||
|
||||
rimraf.sync(out)
|
||||
|
||||
var prefixer = function (prefix) {
|
||||
return function (header) {
|
||||
header.name = path.join(prefix, header.name)
|
||||
return header
|
||||
}
|
||||
}
|
||||
|
||||
tar.pack(a, {
|
||||
map: prefixer('a-files'),
|
||||
finalize: false,
|
||||
finish: packB
|
||||
})
|
||||
|
||||
function packB (pack) {
|
||||
tar.pack(b, { pack: pack, map: prefixer('b-files') })
|
||||
.pipe(tar.extract(out))
|
||||
.on('finish', assertResults)
|
||||
}
|
||||
|
||||
function assertResults () {
|
||||
var containers = fs.readdirSync(out)
|
||||
t.deepEqual(containers, ['a-files', 'b-files'])
|
||||
var aFiles = fs.readdirSync(path.join(out, 'a-files'))
|
||||
t.deepEqual(aFiles, ['hello.txt'])
|
||||
}
|
||||
})
|
||||
|
||||
test('do not extract invalid tar', function (t) {
|
||||
var a = path.join(__dirname, 'fixtures', 'invalid.tar')
|
||||
|
||||
var out = path.join(__dirname, 'fixtures', 'invalid')
|
||||
|
||||
rimraf.sync(out)
|
||||
|
||||
fs.createReadStream(a)
|
||||
.pipe(tar.extract(out))
|
||||
.on('error', function (err) {
|
||||
t.ok(/is not a valid symlink/i.test(err.message))
|
||||
fs.stat(path.join(out, '../bar'), function (err) {
|
||||
t.ok(err)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('no abs hardlink targets', function (t) {
|
||||
var out = path.join(__dirname, 'fixtures', 'invalid')
|
||||
var outside = path.join(__dirname, 'fixtures', 'outside')
|
||||
|
||||
rimraf.sync(out)
|
||||
|
||||
var s = tarStream.pack()
|
||||
|
||||
fs.writeFileSync(outside, 'something')
|
||||
|
||||
s.entry({
|
||||
type: 'link',
|
||||
name: 'link',
|
||||
linkname: outside
|
||||
})
|
||||
|
||||
s.entry({
|
||||
name: 'link'
|
||||
}, 'overwrite')
|
||||
|
||||
s.finalize()
|
||||
|
||||
s.pipe(tar.extract(out))
|
||||
.on('error', function (err) {
|
||||
t.ok(err, 'had error')
|
||||
fs.readFile(outside, 'utf-8', function (err, str) {
|
||||
t.error(err, 'no error')
|
||||
t.same(str, 'something')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,154 @@
|
||||
/**
|
||||
* @fileoverview restrict values that can be used as Promise rejection reasons
|
||||
* @author Teddy Katz
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
defaultOptions: [
|
||||
{
|
||||
allowEmptyReject: false,
|
||||
},
|
||||
],
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Require using Error objects as Promise rejection reasons",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/prefer-promise-reject-errors",
|
||||
},
|
||||
|
||||
fixable: null,
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
allowEmptyReject: { type: "boolean" },
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
rejectAnError:
|
||||
"Expected the Promise rejection reason to be an Error.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const [{ allowEmptyReject }] = context.options;
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Helpers
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Checks the argument of a reject() or Promise.reject() CallExpression, and reports it if it can't be an Error
|
||||
* @param {ASTNode} callExpression A CallExpression node which is used to reject a Promise
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkRejectCall(callExpression) {
|
||||
if (!callExpression.arguments.length && allowEmptyReject) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!callExpression.arguments.length ||
|
||||
!astUtils.couldBeError(callExpression.arguments[0]) ||
|
||||
(callExpression.arguments[0].type === "Identifier" &&
|
||||
callExpression.arguments[0].name === "undefined")
|
||||
) {
|
||||
context.report({
|
||||
node: callExpression,
|
||||
messageId: "rejectAnError",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a function call is a Promise.reject() call
|
||||
* @param {ASTNode} node A CallExpression node
|
||||
* @returns {boolean} `true` if the call is a Promise.reject() call
|
||||
*/
|
||||
function isPromiseRejectCall(node) {
|
||||
return astUtils.isSpecificMemberAccess(
|
||||
node.callee,
|
||||
"Promise",
|
||||
"reject",
|
||||
);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Public
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
// Check `Promise.reject(value)` calls.
|
||||
CallExpression(node) {
|
||||
if (isPromiseRejectCall(node)) {
|
||||
checkRejectCall(node);
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Check for `new Promise((resolve, reject) => {})`, and check for reject() calls.
|
||||
* This function is run on "NewExpression:exit" instead of "NewExpression" to ensure that
|
||||
* the nodes in the expression already have the `parent` property.
|
||||
*/
|
||||
"NewExpression:exit"(node) {
|
||||
if (
|
||||
node.callee.type === "Identifier" &&
|
||||
node.callee.name === "Promise" &&
|
||||
node.arguments.length &&
|
||||
astUtils.isFunction(node.arguments[0]) &&
|
||||
node.arguments[0].params.length > 1 &&
|
||||
node.arguments[0].params[1].type === "Identifier"
|
||||
) {
|
||||
sourceCode
|
||||
.getDeclaredVariables(node.arguments[0])
|
||||
|
||||
/*
|
||||
* Find the first variable that matches the second parameter's name.
|
||||
* If the first parameter has the same name as the second parameter, then the variable will actually
|
||||
* be "declared" when the first parameter is evaluated, but then it will be immediately overwritten
|
||||
* by the second parameter. It's not possible for an expression with the variable to be evaluated before
|
||||
* the variable is overwritten, because functions with duplicate parameters cannot have destructuring or
|
||||
* default assignments in their parameter lists. Therefore, it's not necessary to explicitly account for
|
||||
* this case.
|
||||
*/
|
||||
.find(
|
||||
variable =>
|
||||
variable.name ===
|
||||
node.arguments[0].params[1].name,
|
||||
)
|
||||
|
||||
// Get the references to that variable.
|
||||
.references // Only check the references that read the parameter's value.
|
||||
.filter(ref => ref.isRead())
|
||||
|
||||
// Only check the references that are used as the callee in a function call, e.g. `reject(foo)`.
|
||||
.filter(
|
||||
ref =>
|
||||
ref.identifier.parent.type ===
|
||||
"CallExpression" &&
|
||||
ref.identifier === ref.identifier.parent.callee,
|
||||
)
|
||||
|
||||
// Check the argument of the function call to determine whether it's an Error.
|
||||
.forEach(ref => checkRejectCall(ref.identifier.parent));
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
import { AnyRoute, AnyRouter } from '@tanstack/router-core';
|
||||
export declare function renderRouteNotFound(router: AnyRouter, route: AnyRoute, data: any): import("react/jsx-runtime").JSX.Element;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"136":0.13248,_:"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 52 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 137 138 139 140 3.5 3.6"},D:{"109":0.1863,"118":0.1863,"132":0.26082,"133":0.03726,"134":1.77606,_:"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 52 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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 119 120 121 122 123 124 125 126 127 128 129 130 131 135 136 137 138"},F:{_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"132":0.0207,"133":0.0207,"134":0.43056,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131"},E:{_:"0 4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1 14.1 15.4","15.1":0.9729,"15.2-15.3":0.05796,"15.5":0.03726,"15.6":0.54234,"16.0":0.07452,"16.1":0.09522,"16.2":0.5796,"16.3":0.6003,"16.4":0.03726,"16.5":0.69138,"16.6":3.77982,"17.0":0.16974,"17.1":3.17952,"17.2":0.82386,"17.3":0.3933,"17.4":2.1321,"17.5":2.50884,"17.6":10.81368,"18.0":0.16974,"18.1":0.6003,"18.2":0.9729,"18.3":5.59314,"18.4":0.14904},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0,"11.0-11.2":0,"11.3-11.4":0,"12.0-12.1":0,"12.2-12.5":0,"13.0-13.1":0,"13.2":0,"13.3":0,"13.4-13.7":0,"14.0-14.4":0,"14.5-14.8":0,"15.0-15.1":0,"15.2-15.3":0.31073,"15.4":0.08995,"15.5":0,"15.6-15.8":0.25758,"16.0":0.69505,"16.1":1.07937,"16.2":0.12674,"16.3":0.40068,"16.4":0.05315,"16.5":0.12674,"16.6-16.7":6.29224,"17.0":0.05315,"17.1":0.33117,"17.2":0.08995,"17.3":0.14719,"17.4":0.73185,"17.5":3.42209,"17.6-17.7":7.95626,"18.0":0.12674,"18.1":2.24869,"18.2":0.42112,"18.3":15.14797,"18.4":0.76864},P:{_:"4 20 21 22 23 24 25 26 27 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0"},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":0,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.0586},Q:{"14.9":0.07618},O:{_:"0"},H:{"0":0},L:{"0":16.60908}};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"52":0.04204,"56":0.00526,"60":0.00526,"68":0.00526,"78":0.00526,"88":0.00526,"89":0.00526,"97":0.00526,"98":0.00526,"100":0.02102,"101":0.00526,"102":0.00526,"103":0.00526,"110":0.00526,"111":0.00526,"113":0.01051,"115":0.62009,"117":0.01577,"118":0.02628,"121":0.00526,"122":0.00526,"123":0.01051,"125":0.02102,"127":0.03679,"128":0.16291,"129":0.02102,"130":0.00526,"131":0.01051,"132":0.01577,"133":0.03679,"134":0.16816,"135":1.20865,"136":4.62966,"137":0.00526,_:"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 57 58 59 61 62 63 64 65 66 67 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 90 91 92 93 94 95 96 99 104 105 106 107 108 109 112 114 116 119 120 124 126 138 139 140 3.5 3.6"},D:{"38":0.00526,"41":0.00526,"49":0.01051,"69":0.01051,"79":0.05255,"80":0.00526,"84":0.00526,"87":0.02102,"88":0.00526,"89":0.00526,"90":0.00526,"91":0.00526,"94":0.00526,"97":0.00526,"100":0.00526,"101":0.00526,"102":0.23122,"103":0.02628,"104":0.06832,"105":0.01051,"106":0.01051,"107":0.02102,"108":0.03153,"109":1.11406,"110":0.01051,"111":0.02628,"112":0.01577,"113":0.01577,"114":0.0473,"115":0.03153,"116":0.05781,"117":0.01051,"118":0.01577,"119":0.03679,"120":0.03153,"121":0.02102,"122":0.11561,"123":0.03679,"124":0.09459,"125":0.01577,"126":0.06306,"127":0.03153,"128":0.12087,"129":0.05781,"130":0.1051,"131":0.45193,"132":0.70417,"133":8.26612,"134":16.62682,"135":0.01577,"136":0.00526,_:"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 39 40 42 43 44 45 46 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 70 71 72 73 74 75 76 77 78 81 83 85 86 92 93 95 96 98 99 137 138"},F:{"36":0.00526,"46":0.00526,"79":0.00526,"84":0.00526,"85":0.02102,"87":0.03679,"88":0.02102,"95":0.09459,"105":0.00526,"114":0.00526,"115":0.00526,"116":0.4677,"117":2.12828,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 86 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 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:{"92":0.01051,"102":0.00526,"107":0.00526,"108":0.01051,"109":0.07883,"111":0.00526,"114":0.00526,"118":0.16816,"120":0.00526,"121":0.00526,"122":0.01577,"123":0.00526,"124":0.01051,"125":0.01051,"126":0.03679,"127":0.00526,"128":0.00526,"129":0.02102,"130":0.09985,"131":0.08408,"132":0.11561,"133":2.30169,"134":5.68591,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 103 104 105 106 110 112 113 115 116 117 119"},E:{"14":0.01051,_:"0 4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.2-15.3","13.1":0.02102,"14.1":0.03153,"15.1":0.00526,"15.4":0.00526,"15.5":0.05781,"15.6":0.13138,"16.0":0.03679,"16.1":0.02102,"16.2":0.01051,"16.3":0.02628,"16.4":0.01051,"16.5":0.02628,"16.6":0.26275,"17.0":0.02102,"17.1":0.07883,"17.2":0.02102,"17.3":0.02628,"17.4":0.05255,"17.5":0.14714,"17.6":0.28377,"18.0":0.05255,"18.1":0.11036,"18.2":0.05255,"18.3":1.27697,"18.4":0.02628},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00206,"5.0-5.1":0,"6.0-6.1":0.00618,"7.0-7.1":0.00412,"8.1-8.4":0,"9.0-9.2":0.00309,"9.3":0.01441,"10.0-10.2":0.00103,"10.3":0.02367,"11.0-11.2":0.10909,"11.3-11.4":0.0072,"12.0-12.1":0.00412,"12.2-12.5":0.10189,"13.0-13.1":0.00206,"13.2":0.00309,"13.3":0.00412,"13.4-13.7":0.01441,"14.0-14.4":0.03602,"14.5-14.8":0.04323,"15.0-15.1":0.02367,"15.2-15.3":0.02367,"15.4":0.02882,"15.5":0.03293,"15.6-15.8":0.4055,"16.0":0.05763,"16.1":0.11836,"16.2":0.06175,"16.3":0.10704,"16.4":0.02367,"16.5":0.04426,"16.6-16.7":0.48063,"17.0":0.02882,"17.1":0.05146,"17.2":0.03911,"17.3":0.05455,"17.4":0.10909,"17.5":0.24289,"17.6-17.7":0.705,"18.0":0.1976,"18.1":0.64633,"18.2":0.2892,"18.3":6.04444,"18.4":0.08954},P:{"4":0.04177,"20":0.01044,"21":0.01044,"22":0.01044,"23":0.04177,"24":0.02089,"25":0.02089,"26":0.06266,"27":2.40183,_:"5.0-5.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0","6.2-6.4":0.01044,"19.0":0.01044},I:{"0":0.10417,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00003,"4.4":0,"4.4.3-4.4.4":0.00011},K:{"0":0.54093,_:"10 11 12 11.1 11.5 12.1"},A:{"8":0.00558,"11":0.08375,_:"6 7 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.41282},Q:{"14.9":0.00475},O:{"0":0.08541},H:{"0":0},L:{"0":33.60638}};
|
||||
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
var Type = require('../type');
|
||||
|
||||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
function resolveYamlSet(data) {
|
||||
if (data === null) return true;
|
||||
|
||||
var key, object = data;
|
||||
|
||||
for (key in object) {
|
||||
if (_hasOwnProperty.call(object, key)) {
|
||||
if (object[key] !== null) return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function constructYamlSet(data) {
|
||||
return data !== null ? data : {};
|
||||
}
|
||||
|
||||
module.exports = new Type('tag:yaml.org,2002:set', {
|
||||
kind: 'mapping',
|
||||
resolve: resolveYamlSet,
|
||||
construct: constructYamlSet
|
||||
});
|
||||
Binary file not shown.
Reference in New Issue
Block a user