update
This commit is contained in:
@@ -0,0 +1,209 @@
|
||||
import { aE as LinkDescriptor, aB as MetaDescriptor, aT as ServerDataFrom, aU as ClientDataFrom, aV as Func, aW as unstable_MiddlewareNextFunction, E as Equal, u as unstable_RouterContextProvider, aX as Pretty } from '../../route-data-5OzAzQtT.js';
|
||||
import { M as MiddlewareEnabled, A as AppLoadContext } from '../../future-ldDp5FKH.js';
|
||||
import 'react';
|
||||
|
||||
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
|
||||
type MaybePromise<T> = T | Promise<T>;
|
||||
type RouteModule = {
|
||||
meta?: Func;
|
||||
links?: Func;
|
||||
headers?: Func;
|
||||
loader?: Func;
|
||||
clientLoader?: Func;
|
||||
action?: Func;
|
||||
clientAction?: Func;
|
||||
HydrateFallback?: unknown;
|
||||
default?: unknown;
|
||||
ErrorBoundary?: unknown;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
type LinkDescriptors = LinkDescriptor[];
|
||||
type RouteInfo = {
|
||||
parents: RouteInfo[];
|
||||
module: RouteModule;
|
||||
id: unknown;
|
||||
file: string;
|
||||
path: string;
|
||||
params: unknown;
|
||||
loaderData: unknown;
|
||||
actionData: unknown;
|
||||
};
|
||||
type MetaMatch<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
||||
pathname: string;
|
||||
meta: MetaDescriptor[];
|
||||
data: T["loaderData"];
|
||||
handle?: unknown;
|
||||
error?: unknown;
|
||||
}>;
|
||||
type MetaMatches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [MetaMatch<F>, ...MetaMatches<R>] : Array<MetaMatch<RouteInfo> | undefined>;
|
||||
type CreateMetaArgs<T extends RouteInfo> = {
|
||||
/** This is the current router `Location` object. This is useful for generating tags for routes at specific paths or query parameters. */
|
||||
location: Location;
|
||||
/** {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route. */
|
||||
params: T["params"];
|
||||
/** The return value for this route's server loader function */
|
||||
data: T["loaderData"];
|
||||
/** Thrown errors that trigger error boundaries will be passed to the meta function. This is useful for generating metadata for error pages. */
|
||||
error?: unknown;
|
||||
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
|
||||
matches: MetaMatches<[...T["parents"], T]>;
|
||||
};
|
||||
type MetaDescriptors = MetaDescriptor[];
|
||||
type HeadersArgs = {
|
||||
loaderHeaders: Headers;
|
||||
parentHeaders: Headers;
|
||||
actionHeaders: Headers;
|
||||
errorHeaders: Headers | undefined;
|
||||
};
|
||||
type IsHydrate<ClientLoader> = ClientLoader extends {
|
||||
hydrate: true;
|
||||
} ? true : ClientLoader extends {
|
||||
hydrate: false;
|
||||
} ? false : false;
|
||||
type CreateLoaderData<T extends RouteModule> = _CreateLoaderData<ServerDataFrom<T["loader"]>, ClientDataFrom<T["clientLoader"]>, IsHydrate<T["clientLoader"]>, T extends {
|
||||
HydrateFallback: Func;
|
||||
} ? true : false>;
|
||||
type _CreateLoaderData<ServerLoaderData, ClientLoaderData, ClientLoaderHydrate extends boolean, HasHydrateFallback> = [
|
||||
HasHydrateFallback,
|
||||
ClientLoaderHydrate
|
||||
] extends [true, true] ? IsDefined<ClientLoaderData> extends true ? ClientLoaderData : undefined : [
|
||||
IsDefined<ClientLoaderData>,
|
||||
IsDefined<ServerLoaderData>
|
||||
] extends [true, true] ? ServerLoaderData | ClientLoaderData : IsDefined<ClientLoaderData> extends true ? ClientLoaderData : IsDefined<ServerLoaderData> extends true ? ServerLoaderData : undefined;
|
||||
type CreateActionData<T extends RouteModule> = _CreateActionData<ServerDataFrom<T["action"]>, ClientDataFrom<T["clientAction"]>>;
|
||||
type _CreateActionData<ServerActionData, ClientActionData> = Awaited<[
|
||||
IsDefined<ServerActionData>,
|
||||
IsDefined<ClientActionData>
|
||||
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
|
||||
type ClientDataFunctionArgs<T extends RouteInfo> = {
|
||||
/**
|
||||
* A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
|
||||
*
|
||||
* @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
|
||||
**/
|
||||
request: Request;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
* // app/routes.ts
|
||||
* route("teams/:teamId", "./team.tsx"),
|
||||
*
|
||||
* // app/team.tsx
|
||||
* export function clientLoader({
|
||||
* params,
|
||||
* }: Route.ClientLoaderArgs) {
|
||||
* params.teamId;
|
||||
* // ^ string
|
||||
* }
|
||||
**/
|
||||
params: T["params"];
|
||||
/**
|
||||
* When `future.unstable_middleware` is not enabled, this is undefined.
|
||||
*
|
||||
* When `future.unstable_middleware` is enabled, this is an instance of
|
||||
* `unstable_RouterContextProvider` and can be used to access context values
|
||||
* from your route middlewares. You may pass in initial context values in your
|
||||
* `<HydratedRouter unstable_getContext>` prop
|
||||
*/
|
||||
context: unstable_RouterContextProvider;
|
||||
};
|
||||
type ServerDataFunctionArgs<T extends RouteInfo> = {
|
||||
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the url, method, headers (such as cookies), and request body from the request. */
|
||||
request: Request;
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
* // app/routes.ts
|
||||
* route("teams/:teamId", "./team.tsx"),
|
||||
*
|
||||
* // app/team.tsx
|
||||
* export function loader({
|
||||
* params,
|
||||
* }: Route.LoaderArgs) {
|
||||
* params.teamId;
|
||||
* // ^ string
|
||||
* }
|
||||
**/
|
||||
params: T["params"];
|
||||
/**
|
||||
* Without `future.unstable_middleware` enabled, this is the context passed in
|
||||
* to your server adapter's `getLoadContext` function. It's a way to bridge the
|
||||
* gap between the adapter's request/response API with your React Router app.
|
||||
* It is only applicable if you are using a custom server adapter.
|
||||
*
|
||||
* With `future.unstable_middleware` enabled, this is an instance of
|
||||
* `unstable_RouterContextProvider` and can be used for type-safe access to
|
||||
* context value set in your route middlewares. If you are using a custom
|
||||
* server adapter, you may provide an initial set of context values from your
|
||||
* `getLoadContext` function.
|
||||
*/
|
||||
context: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext;
|
||||
};
|
||||
type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T>, next: unstable_MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
|
||||
type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T>, next: unstable_MiddlewareNextFunction<undefined>) => MaybePromise<void>;
|
||||
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
||||
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
||||
/** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
|
||||
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
|
||||
};
|
||||
type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
||||
type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
||||
/** This is an asynchronous function that makes the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server action for this route. */
|
||||
serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
|
||||
};
|
||||
type CreateHydrateFallbackProps<T extends RouteInfo> = {
|
||||
params: T["params"];
|
||||
loaderData?: T["loaderData"];
|
||||
actionData?: T["actionData"];
|
||||
};
|
||||
type Match<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
||||
pathname: string;
|
||||
data: T["loaderData"];
|
||||
handle: unknown;
|
||||
}>;
|
||||
type Matches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [Match<F>, ...Matches<R>] : Array<Match<RouteInfo> | undefined>;
|
||||
type CreateComponentProps<T extends RouteInfo> = {
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
* // app/routes.ts
|
||||
* route("teams/:teamId", "./team.tsx"),
|
||||
*
|
||||
* // app/team.tsx
|
||||
* export default function Component({
|
||||
* params,
|
||||
* }: Route.ComponentProps) {
|
||||
* params.teamId;
|
||||
* // ^ string
|
||||
* }
|
||||
**/
|
||||
params: T["params"];
|
||||
/** The data returned from the `loader` or `clientLoader` */
|
||||
loaderData: T["loaderData"];
|
||||
/** The data returned from the `action` or `clientAction` following an action submission. */
|
||||
actionData?: T["actionData"];
|
||||
/** An array of the current {@link https://api.reactrouter.com/v7/interfaces/react_router.UIMatch.html route matches}, including parent route matches. */
|
||||
matches: Matches<[...T["parents"], T]>;
|
||||
};
|
||||
type CreateErrorBoundaryProps<T extends RouteInfo> = {
|
||||
/**
|
||||
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
||||
* @example
|
||||
* // app/routes.ts
|
||||
* route("teams/:teamId", "./team.tsx"),
|
||||
*
|
||||
* // app/team.tsx
|
||||
* export function ErrorBoundary({
|
||||
* params,
|
||||
* }: Route.ErrorBoundaryProps) {
|
||||
* params.teamId;
|
||||
* // ^ string
|
||||
* }
|
||||
**/
|
||||
params: T["params"];
|
||||
error: unknown;
|
||||
loaderData?: T["loaderData"];
|
||||
actionData?: T["actionData"];
|
||||
};
|
||||
|
||||
export type { CreateActionData, CreateClientActionArgs, CreateClientLoaderArgs, CreateClientMiddlewareFunction, CreateComponentProps, CreateErrorBoundaryProps, CreateHydrateFallbackProps, CreateLoaderData, CreateMetaArgs, CreateServerActionArgs, CreateServerLoaderArgs, CreateServerMiddlewareFunction, HeadersArgs, LinkDescriptors, MetaDescriptors };
|
||||
@@ -0,0 +1,8 @@
|
||||
import { useRouterState } from "./useRouterState.js";
|
||||
function useCanGoBack() {
|
||||
return useRouterState({ select: (s) => s.location.state.__TSR_index !== 0 });
|
||||
}
|
||||
export {
|
||||
useCanGoBack
|
||||
};
|
||||
//# sourceMappingURL=useCanGoBack.js.map
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
React projects that don't include the DOM library need these interfaces to compile.
|
||||
React Native applications use React, but there is no DOM available. The JavaScript runtime
|
||||
is ES6/ES2015 only. These definitions allow such projects to compile with only `--lib ES6`.
|
||||
|
||||
Warning: all of these interfaces are empty. If you want type definitions for various properties
|
||||
(such as HTMLInputElement.prototype.value), you need to add `--lib DOM` (via command line or tsconfig.json).
|
||||
*/
|
||||
|
||||
interface Event {}
|
||||
interface AnimationEvent extends Event {}
|
||||
interface ClipboardEvent extends Event {}
|
||||
interface CompositionEvent extends Event {}
|
||||
interface DragEvent extends Event {}
|
||||
interface FocusEvent extends Event {}
|
||||
interface KeyboardEvent extends Event {}
|
||||
interface MouseEvent extends Event {}
|
||||
interface TouchEvent extends Event {}
|
||||
interface PointerEvent extends Event {}
|
||||
interface ToggleEvent extends Event {}
|
||||
interface TransitionEvent extends Event {}
|
||||
interface UIEvent extends Event {}
|
||||
interface WheelEvent extends Event {}
|
||||
|
||||
interface EventTarget {}
|
||||
interface Document {}
|
||||
interface DataTransfer {}
|
||||
interface StyleMedia {}
|
||||
|
||||
interface Element {}
|
||||
interface DocumentFragment {}
|
||||
|
||||
interface HTMLElement extends Element {}
|
||||
interface HTMLAnchorElement extends HTMLElement {}
|
||||
interface HTMLAreaElement extends HTMLElement {}
|
||||
interface HTMLAudioElement extends HTMLElement {}
|
||||
interface HTMLBaseElement extends HTMLElement {}
|
||||
interface HTMLBodyElement extends HTMLElement {}
|
||||
interface HTMLBRElement extends HTMLElement {}
|
||||
interface HTMLButtonElement extends HTMLElement {}
|
||||
interface HTMLCanvasElement extends HTMLElement {}
|
||||
interface HTMLDataElement extends HTMLElement {}
|
||||
interface HTMLDataListElement extends HTMLElement {}
|
||||
interface HTMLDetailsElement extends HTMLElement {}
|
||||
interface HTMLDialogElement extends HTMLElement {}
|
||||
interface HTMLDivElement extends HTMLElement {}
|
||||
interface HTMLDListElement extends HTMLElement {}
|
||||
interface HTMLEmbedElement extends HTMLElement {}
|
||||
interface HTMLFieldSetElement extends HTMLElement {}
|
||||
interface HTMLFormElement extends HTMLElement {}
|
||||
interface HTMLHeadingElement extends HTMLElement {}
|
||||
interface HTMLHeadElement extends HTMLElement {}
|
||||
interface HTMLHRElement extends HTMLElement {}
|
||||
interface HTMLHtmlElement extends HTMLElement {}
|
||||
interface HTMLIFrameElement extends HTMLElement {}
|
||||
interface HTMLImageElement extends HTMLElement {}
|
||||
interface HTMLInputElement extends HTMLElement {}
|
||||
interface HTMLModElement extends HTMLElement {}
|
||||
interface HTMLLabelElement extends HTMLElement {}
|
||||
interface HTMLLegendElement extends HTMLElement {}
|
||||
interface HTMLLIElement extends HTMLElement {}
|
||||
interface HTMLLinkElement extends HTMLElement {}
|
||||
interface HTMLMapElement extends HTMLElement {}
|
||||
interface HTMLMetaElement extends HTMLElement {}
|
||||
interface HTMLMeterElement extends HTMLElement {}
|
||||
interface HTMLObjectElement extends HTMLElement {}
|
||||
interface HTMLOListElement extends HTMLElement {}
|
||||
interface HTMLOptGroupElement extends HTMLElement {}
|
||||
interface HTMLOptionElement extends HTMLElement {}
|
||||
interface HTMLOutputElement extends HTMLElement {}
|
||||
interface HTMLParagraphElement extends HTMLElement {}
|
||||
interface HTMLParamElement extends HTMLElement {}
|
||||
interface HTMLPreElement extends HTMLElement {}
|
||||
interface HTMLProgressElement extends HTMLElement {}
|
||||
interface HTMLQuoteElement extends HTMLElement {}
|
||||
interface HTMLSlotElement extends HTMLElement {}
|
||||
interface HTMLScriptElement extends HTMLElement {}
|
||||
interface HTMLSelectElement extends HTMLElement {}
|
||||
interface HTMLSourceElement extends HTMLElement {}
|
||||
interface HTMLSpanElement extends HTMLElement {}
|
||||
interface HTMLStyleElement extends HTMLElement {}
|
||||
interface HTMLTableElement extends HTMLElement {}
|
||||
interface HTMLTableColElement extends HTMLElement {}
|
||||
interface HTMLTableDataCellElement extends HTMLElement {}
|
||||
interface HTMLTableHeaderCellElement extends HTMLElement {}
|
||||
interface HTMLTableRowElement extends HTMLElement {}
|
||||
interface HTMLTableSectionElement extends HTMLElement {}
|
||||
interface HTMLTemplateElement extends HTMLElement {}
|
||||
interface HTMLTextAreaElement extends HTMLElement {}
|
||||
interface HTMLTimeElement extends HTMLElement {}
|
||||
interface HTMLTitleElement extends HTMLElement {}
|
||||
interface HTMLTrackElement extends HTMLElement {}
|
||||
interface HTMLUListElement extends HTMLElement {}
|
||||
interface HTMLVideoElement extends HTMLElement {}
|
||||
interface HTMLWebViewElement extends HTMLElement {}
|
||||
|
||||
interface SVGElement extends Element {}
|
||||
interface SVGSVGElement extends SVGElement {}
|
||||
interface SVGCircleElement extends SVGElement {}
|
||||
interface SVGClipPathElement extends SVGElement {}
|
||||
interface SVGDefsElement extends SVGElement {}
|
||||
interface SVGDescElement extends SVGElement {}
|
||||
interface SVGEllipseElement extends SVGElement {}
|
||||
interface SVGFEBlendElement extends SVGElement {}
|
||||
interface SVGFEColorMatrixElement extends SVGElement {}
|
||||
interface SVGFEComponentTransferElement extends SVGElement {}
|
||||
interface SVGFECompositeElement extends SVGElement {}
|
||||
interface SVGFEConvolveMatrixElement extends SVGElement {}
|
||||
interface SVGFEDiffuseLightingElement extends SVGElement {}
|
||||
interface SVGFEDisplacementMapElement extends SVGElement {}
|
||||
interface SVGFEDistantLightElement extends SVGElement {}
|
||||
interface SVGFEDropShadowElement extends SVGElement {}
|
||||
interface SVGFEFloodElement extends SVGElement {}
|
||||
interface SVGFEFuncAElement extends SVGElement {}
|
||||
interface SVGFEFuncBElement extends SVGElement {}
|
||||
interface SVGFEFuncGElement extends SVGElement {}
|
||||
interface SVGFEFuncRElement extends SVGElement {}
|
||||
interface SVGFEGaussianBlurElement extends SVGElement {}
|
||||
interface SVGFEImageElement extends SVGElement {}
|
||||
interface SVGFEMergeElement extends SVGElement {}
|
||||
interface SVGFEMergeNodeElement extends SVGElement {}
|
||||
interface SVGFEMorphologyElement extends SVGElement {}
|
||||
interface SVGFEOffsetElement extends SVGElement {}
|
||||
interface SVGFEPointLightElement extends SVGElement {}
|
||||
interface SVGFESpecularLightingElement extends SVGElement {}
|
||||
interface SVGFESpotLightElement extends SVGElement {}
|
||||
interface SVGFETileElement extends SVGElement {}
|
||||
interface SVGFETurbulenceElement extends SVGElement {}
|
||||
interface SVGFilterElement extends SVGElement {}
|
||||
interface SVGForeignObjectElement extends SVGElement {}
|
||||
interface SVGGElement extends SVGElement {}
|
||||
interface SVGImageElement extends SVGElement {}
|
||||
interface SVGLineElement extends SVGElement {}
|
||||
interface SVGLinearGradientElement extends SVGElement {}
|
||||
interface SVGMarkerElement extends SVGElement {}
|
||||
interface SVGMaskElement extends SVGElement {}
|
||||
interface SVGMetadataElement extends SVGElement {}
|
||||
interface SVGPathElement extends SVGElement {}
|
||||
interface SVGPatternElement extends SVGElement {}
|
||||
interface SVGPolygonElement extends SVGElement {}
|
||||
interface SVGPolylineElement extends SVGElement {}
|
||||
interface SVGRadialGradientElement extends SVGElement {}
|
||||
interface SVGRectElement extends SVGElement {}
|
||||
interface SVGSetElement extends SVGElement {}
|
||||
interface SVGStopElement extends SVGElement {}
|
||||
interface SVGSwitchElement extends SVGElement {}
|
||||
interface SVGSymbolElement extends SVGElement {}
|
||||
interface SVGTextElement extends SVGElement {}
|
||||
interface SVGTextPathElement extends SVGElement {}
|
||||
interface SVGTSpanElement extends SVGElement {}
|
||||
interface SVGUseElement extends SVGElement {}
|
||||
interface SVGViewElement extends SVGElement {}
|
||||
|
||||
interface FormData {}
|
||||
interface Text {}
|
||||
interface TouchList {}
|
||||
interface WebGLRenderingContext {}
|
||||
interface WebGL2RenderingContext {}
|
||||
|
||||
interface TrustedHTML {}
|
||||
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = normalizeOptions;
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function normalizeOptions(config) {
|
||||
const {
|
||||
filename,
|
||||
cwd,
|
||||
filenameRelative = typeof filename === "string" ? _path().relative(cwd, filename) : "unknown",
|
||||
sourceType = "module",
|
||||
inputSourceMap,
|
||||
sourceMaps = !!inputSourceMap,
|
||||
sourceRoot = config.options.moduleRoot,
|
||||
sourceFileName = _path().basename(filenameRelative),
|
||||
comments = true,
|
||||
compact = "auto"
|
||||
} = config.options;
|
||||
const opts = config.options;
|
||||
const options = Object.assign({}, opts, {
|
||||
parserOpts: Object.assign({
|
||||
sourceType: _path().extname(filenameRelative) === ".mjs" ? "module" : sourceType,
|
||||
sourceFileName: filename,
|
||||
plugins: []
|
||||
}, opts.parserOpts),
|
||||
generatorOpts: Object.assign({
|
||||
filename,
|
||||
auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
|
||||
auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
|
||||
retainLines: opts.retainLines,
|
||||
comments,
|
||||
shouldPrintComment: opts.shouldPrintComment,
|
||||
compact,
|
||||
minified: opts.minified,
|
||||
sourceMaps,
|
||||
sourceRoot,
|
||||
sourceFileName
|
||||
}, opts.generatorOpts)
|
||||
});
|
||||
for (const plugins of config.passes) {
|
||||
for (const plugin of plugins) {
|
||||
if (plugin.manipulateOptions) {
|
||||
plugin.manipulateOptions(options, options.parserOpts);
|
||||
}
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=normalize-opts.js.map
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,108 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const path = require("./path.cjs");
|
||||
const notFound = require("./not-found.cjs");
|
||||
const root = require("./root.cjs");
|
||||
class BaseRoute {
|
||||
constructor(options) {
|
||||
this.init = (opts) => {
|
||||
var _a, _b;
|
||||
this.originalIndex = opts.originalIndex;
|
||||
const options2 = this.options;
|
||||
const isRoot = !(options2 == null ? void 0 : options2.path) && !(options2 == null ? void 0 : options2.id);
|
||||
this.parentRoute = (_b = (_a = this.options).getParentRoute) == null ? void 0 : _b.call(_a);
|
||||
if (isRoot) {
|
||||
this._path = root.rootRouteId;
|
||||
} else if (!this.parentRoute) {
|
||||
throw new Error(
|
||||
`Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`
|
||||
);
|
||||
}
|
||||
let path$1 = isRoot ? root.rootRouteId : options2 == null ? void 0 : options2.path;
|
||||
if (path$1 && path$1 !== "/") {
|
||||
path$1 = path.trimPathLeft(path$1);
|
||||
}
|
||||
const customId = (options2 == null ? void 0 : options2.id) || path$1;
|
||||
let id = isRoot ? root.rootRouteId : path.joinPaths([
|
||||
this.parentRoute.id === root.rootRouteId ? "" : this.parentRoute.id,
|
||||
customId
|
||||
]);
|
||||
if (path$1 === root.rootRouteId) {
|
||||
path$1 = "/";
|
||||
}
|
||||
if (id !== root.rootRouteId) {
|
||||
id = path.joinPaths(["/", id]);
|
||||
}
|
||||
const fullPath = id === root.rootRouteId ? "/" : path.joinPaths([this.parentRoute.fullPath, path$1]);
|
||||
this._path = path$1;
|
||||
this._id = id;
|
||||
this._fullPath = fullPath;
|
||||
this._to = fullPath;
|
||||
this._ssr = (options2 == null ? void 0 : options2.ssr) ?? opts.defaultSsr ?? true;
|
||||
};
|
||||
this.addChildren = (children) => {
|
||||
return this._addFileChildren(children);
|
||||
};
|
||||
this._addFileChildren = (children) => {
|
||||
if (Array.isArray(children)) {
|
||||
this.children = children;
|
||||
}
|
||||
if (typeof children === "object" && children !== null) {
|
||||
this.children = Object.values(children);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
this._addFileTypes = () => {
|
||||
return this;
|
||||
};
|
||||
this.updateLoader = (options2) => {
|
||||
Object.assign(this.options, options2);
|
||||
return this;
|
||||
};
|
||||
this.update = (options2) => {
|
||||
Object.assign(this.options, options2);
|
||||
return this;
|
||||
};
|
||||
this.lazy = (lazyFn) => {
|
||||
this.lazyFn = lazyFn;
|
||||
return this;
|
||||
};
|
||||
this.options = options || {};
|
||||
this.isRoot = !(options == null ? void 0 : options.getParentRoute);
|
||||
if ((options == null ? void 0 : options.id) && (options == null ? void 0 : options.path)) {
|
||||
throw new Error(`Route cannot have both an 'id' and a 'path' option.`);
|
||||
}
|
||||
}
|
||||
get to() {
|
||||
return this._to;
|
||||
}
|
||||
get id() {
|
||||
return this._id;
|
||||
}
|
||||
get path() {
|
||||
return this._path;
|
||||
}
|
||||
get fullPath() {
|
||||
return this._fullPath;
|
||||
}
|
||||
get ssr() {
|
||||
return this._ssr;
|
||||
}
|
||||
}
|
||||
class BaseRouteApi {
|
||||
constructor({ id }) {
|
||||
this.notFound = (opts) => {
|
||||
return notFound.notFound({ routeId: this.id, ...opts });
|
||||
};
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
class BaseRootRoute extends BaseRoute {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
}
|
||||
}
|
||||
exports.BaseRootRoute = BaseRootRoute;
|
||||
exports.BaseRoute = BaseRoute;
|
||||
exports.BaseRouteApi = BaseRouteApi;
|
||||
//# sourceMappingURL=route.cjs.map
|
||||
@@ -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 U V W X Y Z","132":"0 9 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:{"2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB qC rC","132":"0 9 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:{"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 AC BC CC DC Q H R S T U V W X Y Z","132":"0 9 a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC"},E:{"2":"J PB K D E F A B C L M G sC SC tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C","4":"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 xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC 4C 5C 6C 7C FC kC 8C GC","132":"0 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","4":"JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"2":"WD"},I:{"2":"LC J XD YD ZD aD lC bD cD","132":"I"},J:{"2":"D A"},K:{"2":"A B C FC kC GC","132":"H"},L:{"132":"I"},M:{"132":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"2":"J dD eD fD gD hD TC iD jD kD lD mD","132":"1 2 3 4 5 6 7 8 IC JC KC nD"},Q:{"2":"oD"},R:{"132":"pD"},S:{"132":"qD rD"}},B:4,C:"CSS Counter Styles",D:true};
|
||||
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('../cjs/use-sync-external-store-shim.native.production.js');
|
||||
} else {
|
||||
module.exports = require('../cjs/use-sync-external-store-shim.native.development.js');
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
# prelude.ls [](https://travis-ci.org/gkz/prelude-ls)
|
||||
|
||||
is a functionally oriented utility library. It is powerful and flexible. Almost all of its functions are curried. It is written in, and is the recommended base library for, <a href="http://livescript.net">LiveScript</a>.
|
||||
|
||||
See **[the prelude.ls site](http://preludels.com)** for examples, a reference, and more.
|
||||
|
||||
You can install via npm `npm install prelude-ls`
|
||||
|
||||
### Development
|
||||
|
||||
`make test` to test
|
||||
|
||||
`make build` to build `lib` from `src`
|
||||
|
||||
`make build-browser` to build browser versions
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
import type { HistoryLocation } from '@tanstack/history'
|
||||
|
||||
declare module '@tanstack/history' {
|
||||
interface HistoryState {
|
||||
__tempLocation?: HistoryLocation
|
||||
__tempKey?: string
|
||||
__hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @fileoverview Provides helper functions to start/stop the time measurements
|
||||
* that are provided by the ESLint 'stats' option.
|
||||
* @author Mara Kiefer <http://github.com/mnkiefer>
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Start time measurement
|
||||
* @returns {[number, number]} t variable for tracking time
|
||||
*/
|
||||
function startTime() {
|
||||
return process.hrtime();
|
||||
}
|
||||
|
||||
/**
|
||||
* End time measurement
|
||||
* @param {[number, number]} t Variable for tracking time
|
||||
* @returns {number} The measured time in milliseconds
|
||||
*/
|
||||
function endTime(t) {
|
||||
const time = process.hrtime(t);
|
||||
|
||||
return time[0] * 1e3 + time[1] / 1e6;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
startTime,
|
||||
endTime,
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"name": "@types/react-dom",
|
||||
"version": "19.1.1",
|
||||
"description": "TypeScript definitions for react-dom",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Asana",
|
||||
"url": "https://asana.com"
|
||||
},
|
||||
{
|
||||
"name": "AssureSign",
|
||||
"url": "http://www.assuresign.com"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft",
|
||||
"url": "https://microsoft.com"
|
||||
},
|
||||
{
|
||||
"name": "MartynasZilinskas",
|
||||
"githubUsername": "MartynasZilinskas",
|
||||
"url": "https://github.com/MartynasZilinskas"
|
||||
},
|
||||
{
|
||||
"name": "Josh Rutherford",
|
||||
"githubUsername": "theruther4d",
|
||||
"url": "https://github.com/theruther4d"
|
||||
},
|
||||
{
|
||||
"name": "Jessica Franco",
|
||||
"githubUsername": "Jessidhia",
|
||||
"url": "https://github.com/Jessidhia"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Silbermann",
|
||||
"githubUsername": "eps1lon",
|
||||
"url": "https://github.com/eps1lon"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": {
|
||||
"default": "./index.d.ts"
|
||||
}
|
||||
},
|
||||
"./client": {
|
||||
"types": {
|
||||
"default": "./client.d.ts"
|
||||
}
|
||||
},
|
||||
"./canary": {
|
||||
"types": {
|
||||
"default": "./canary.d.ts"
|
||||
}
|
||||
},
|
||||
"./server": {
|
||||
"types": {
|
||||
"default": "./server.d.ts"
|
||||
}
|
||||
},
|
||||
"./static": {
|
||||
"types": {
|
||||
"default": "./static.d.ts"
|
||||
}
|
||||
},
|
||||
"./experimental": {
|
||||
"types": {
|
||||
"default": "./experimental.d.ts"
|
||||
}
|
||||
},
|
||||
"./test-utils": {
|
||||
"types": {
|
||||
"default": "./test-utils/index.d.ts"
|
||||
}
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/react-dom"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^19.0.0"
|
||||
},
|
||||
"typesPublisherContentHash": "2322ab5fd5b3697fab0194e445099d83d82662db19c270a5d061cfef39611932",
|
||||
"typeScriptVersion": "5.1"
|
||||
}
|
||||
@@ -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 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 OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 4 5 6 nC LC J PB K D E F A B C L M G N O P QB qC rC","194":"7 8 RB SB TB UB VB WB XB YB ZB aB bB cB dB"},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":"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 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 AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"SC 9C lC"},H:{"2":"WD"},I:{"1":"I bD cD","2":"LC J XD YD ZD aD lC"},J:{"1":"D A"},K:{"1":"B C H FC kC GC","2":"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:"Channel messaging",D:true};
|
||||
@@ -0,0 +1,11 @@
|
||||
export class Metadata {
|
||||
constructor({ parsedData, rawData }: {
|
||||
parsedData: any;
|
||||
rawData: any;
|
||||
});
|
||||
getRaw(): any;
|
||||
get(name: any): any;
|
||||
getAll(): any;
|
||||
has(name: any): any;
|
||||
#private;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
module.exports={C:{"52":0.00286,"56":0.00286,"57":0.00286,"72":0.00573,"111":0.00286,"115":0.0716,"117":0.00286,"127":0.00859,"128":0.0315,"132":0.02291,"133":0.01718,"134":0.00286,"135":0.10024,"136":0.22053,_:"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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 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 112 113 114 116 118 119 120 121 122 123 124 125 126 129 130 131 137 138 139 140 3.5 3.6"},D:{"35":0.01432,"38":0.00286,"39":0.00573,"40":0.01146,"41":0.00859,"42":0.00286,"43":0.00573,"44":0.01718,"45":0.00573,"46":0.00859,"47":0.00573,"48":0.00859,"49":0.0315,"50":0.00286,"51":0.00859,"52":0.00573,"53":0.00859,"54":0.00573,"55":0.01146,"56":0.00859,"57":0.00573,"58":0.07733,"59":0.00573,"60":0.00573,"65":0.00286,"69":0.00573,"70":0.00859,"72":0.00573,"76":0.13174,"77":2.13654,"78":0.00573,"79":0.01718,"81":0.00859,"83":0.01146,"87":0.06587,"88":0.00286,"89":0.00859,"91":0.00286,"94":0.02005,"96":0.01718,"97":0.0401,"98":0.00286,"99":0.00286,"100":0.00573,"101":0.01432,"102":0.01432,"103":0.00573,"104":0.88498,"105":0.00859,"106":0.14893,"107":0.00859,"108":0.0401,"109":2.75803,"110":0.09451,"111":0.01146,"112":0.02005,"114":0.02005,"115":0.00286,"116":0.02005,"117":0.00573,"118":0.01718,"119":0.02005,"120":0.73032,"121":0.01432,"122":0.10883,"123":0.0716,"124":0.0401,"125":0.08019,"126":0.02005,"127":0.01146,"128":0.01718,"129":0.03723,"130":0.03723,"131":0.3265,"132":0.29786,"133":2.94133,"134":5.82538,"135":0.02291,_:"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 36 37 61 62 63 64 66 67 68 71 73 74 75 80 84 85 86 90 92 93 95 113 136 137 138"},F:{"36":0.01432,"47":0.00286,"53":0.00286,"64":0.00286,"79":0.0315,"82":0.00286,"86":0.00859,"87":0.02578,"92":0.00286,"95":0.15466,"108":0.00286,"112":0.01432,"116":0.06014,"117":0.65872,_:"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 46 48 49 50 51 52 54 55 56 57 58 60 62 63 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 83 84 85 88 89 90 91 93 94 96 97 98 99 100 101 102 103 104 105 106 107 109 110 111 113 114 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"13":0.00286,"14":0.00286,"16":0.00286,"17":0.00286,"18":0.02578,"89":0.00286,"92":0.05155,"100":0.02578,"102":0.00286,"109":0.02291,"110":0.01146,"112":0.00859,"113":0.00286,"114":0.00286,"119":0.00286,"120":0.02005,"122":0.00286,"123":0.00286,"124":0.00286,"125":0.00573,"126":0.00859,"128":0.00286,"129":0.00286,"130":0.01146,"131":0.02578,"132":0.02291,"133":0.58426,"134":0.93366,_:"12 15 79 80 81 83 84 85 86 87 88 90 91 93 94 95 96 97 98 99 101 103 104 105 106 107 108 111 115 116 117 118 121 127"},E:{"14":0.00286,"15":0.34654,_:"0 4 5 6 7 8 9 10 11 12 13 3.1 3.2 6.1 7.1 9.1 10.1 11.1 12.1 15.5 16.0 16.1 16.2 16.3","5.1":0.13461,"13.1":0.00286,"14.1":0.00859,"15.1":0.00286,"15.2-15.3":0.00573,"15.4":0.00859,"15.6":0.02291,"16.4":0.00286,"16.5":0.03723,"16.6":0.2148,"17.0":0.00286,"17.1":0.00573,"17.2":0.00286,"17.3":0.01146,"17.4":0.01432,"17.5":0.00286,"17.6":0.16325,"18.0":0.00859,"18.1":0.07733,"18.2":0.00859,"18.3":0.26349,"18.4":0.05442},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00124,"5.0-5.1":0,"6.0-6.1":0.00371,"7.0-7.1":0.00248,"8.1-8.4":0,"9.0-9.2":0.00186,"9.3":0.00866,"10.0-10.2":0.00062,"10.3":0.01423,"11.0-11.2":0.06559,"11.3-11.4":0.00433,"12.0-12.1":0.00248,"12.2-12.5":0.06126,"13.0-13.1":0.00124,"13.2":0.00186,"13.3":0.00248,"13.4-13.7":0.00866,"14.0-14.4":0.02166,"14.5-14.8":0.02599,"15.0-15.1":0.01423,"15.2-15.3":0.01423,"15.4":0.01733,"15.5":0.0198,"15.6-15.8":0.2438,"16.0":0.03465,"16.1":0.07116,"16.2":0.03713,"16.3":0.06435,"16.4":0.01423,"16.5":0.02661,"16.6-16.7":0.28897,"17.0":0.01733,"17.1":0.03094,"17.2":0.02351,"17.3":0.0328,"17.4":0.06559,"17.5":0.14603,"17.6-17.7":0.42386,"18.0":0.11881,"18.1":0.38859,"18.2":0.17388,"18.3":3.63408,"18.4":0.05383},P:{"4":0.10196,"20":0.0102,"21":0.02039,"22":0.11215,"23":0.09176,"24":0.12235,"25":0.15294,"26":0.22431,"27":1.63131,"5.0-5.4":0.18352,"6.2-6.4":0.04078,"7.2-7.4":0.11215,_:"8.2 12.0 15.0","9.2":0.0102,"10.1":0.0102,"11.1-11.2":0.03059,"13.0":0.0102,"14.0":0.0102,"16.0":0.0102,"17.0":0.0102,"18.0":0.0102,"19.0":0.02039},I:{"0":0.01424,"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.00002},K:{"0":1.81131,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.09165,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.03569},Q:{"14.9":0.04282},O:{"0":0.56382},H:{"0":0.08},L:{"0":60.23723}};
|
||||
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* @fileoverview Rule to check spacing between template tags and their literals
|
||||
* @author Jonathan Wilsson
|
||||
* @deprecated in ESLint v8.53.0
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
deprecated: {
|
||||
message: "Formatting rules are being moved out of ESLint core.",
|
||||
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
|
||||
deprecatedSince: "8.53.0",
|
||||
availableUntil: "10.0.0",
|
||||
replacedBy: [
|
||||
{
|
||||
message:
|
||||
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
||||
url: "https://eslint.style/guide/migration",
|
||||
plugin: {
|
||||
name: "@stylistic/eslint-plugin-js",
|
||||
url: "https://eslint.style/packages/js",
|
||||
},
|
||||
rule: {
|
||||
name: "template-tag-spacing",
|
||||
url: "https://eslint.style/rules/js/template-tag-spacing",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
type: "layout",
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Require or disallow spacing between template tags and their literals",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/template-tag-spacing",
|
||||
},
|
||||
|
||||
fixable: "whitespace",
|
||||
|
||||
schema: [{ enum: ["always", "never"] }],
|
||||
messages: {
|
||||
unexpected:
|
||||
"Unexpected space between template tag and template literal.",
|
||||
missing: "Missing space between template tag and template literal.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const never = context.options[0] !== "always";
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
/**
|
||||
* Check if a space is present between a template tag and its literal
|
||||
* @param {ASTNode} node node to evaluate
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function checkSpacing(node) {
|
||||
const tagToken = sourceCode.getTokenBefore(node.quasi);
|
||||
const literalToken = sourceCode.getFirstToken(node.quasi);
|
||||
const hasWhitespace = sourceCode.isSpaceBetweenTokens(
|
||||
tagToken,
|
||||
literalToken,
|
||||
);
|
||||
|
||||
if (never && hasWhitespace) {
|
||||
context.report({
|
||||
node,
|
||||
loc: {
|
||||
start: tagToken.loc.end,
|
||||
end: literalToken.loc.start,
|
||||
},
|
||||
messageId: "unexpected",
|
||||
fix(fixer) {
|
||||
const comments = sourceCode.getCommentsBefore(
|
||||
node.quasi,
|
||||
);
|
||||
|
||||
// Don't fix anything if there's a single line comment after the template tag
|
||||
if (comments.some(comment => comment.type === "Line")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return fixer.replaceTextRange(
|
||||
[tagToken.range[1], literalToken.range[0]],
|
||||
comments.reduce(
|
||||
(text, comment) =>
|
||||
text + sourceCode.getText(comment),
|
||||
"",
|
||||
),
|
||||
);
|
||||
},
|
||||
});
|
||||
} else if (!never && !hasWhitespace) {
|
||||
context.report({
|
||||
node,
|
||||
loc: {
|
||||
start: node.loc.start,
|
||||
end: literalToken.loc.start,
|
||||
},
|
||||
messageId: "missing",
|
||||
fix(fixer) {
|
||||
return fixer.insertTextAfter(tagToken, " ");
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
TaggedTemplateExpression: checkSpacing,
|
||||
};
|
||||
},
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,177 @@
|
||||
'use strict';
|
||||
|
||||
var parse = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('flag boolean default false', function (t) {
|
||||
var argv = parse(['moo'], {
|
||||
boolean: ['t', 'verbose'],
|
||||
default: { verbose: false, t: false },
|
||||
});
|
||||
|
||||
t.deepEqual(argv, {
|
||||
verbose: false,
|
||||
t: false,
|
||||
_: ['moo'],
|
||||
});
|
||||
|
||||
t.deepEqual(typeof argv.verbose, 'boolean');
|
||||
t.deepEqual(typeof argv.t, 'boolean');
|
||||
t.end();
|
||||
|
||||
});
|
||||
|
||||
test('boolean groups', function (t) {
|
||||
var argv = parse(['-x', '-z', 'one', 'two', 'three'], {
|
||||
boolean: ['x', 'y', 'z'],
|
||||
});
|
||||
|
||||
t.deepEqual(argv, {
|
||||
x: true,
|
||||
y: false,
|
||||
z: true,
|
||||
_: ['one', 'two', 'three'],
|
||||
});
|
||||
|
||||
t.deepEqual(typeof argv.x, 'boolean');
|
||||
t.deepEqual(typeof argv.y, 'boolean');
|
||||
t.deepEqual(typeof argv.z, 'boolean');
|
||||
t.end();
|
||||
});
|
||||
test('boolean and alias with chainable api', function (t) {
|
||||
var aliased = ['-h', 'derp'];
|
||||
var regular = ['--herp', 'derp'];
|
||||
var aliasedArgv = parse(aliased, {
|
||||
boolean: 'herp',
|
||||
alias: { h: 'herp' },
|
||||
});
|
||||
var propertyArgv = parse(regular, {
|
||||
boolean: 'herp',
|
||||
alias: { h: 'herp' },
|
||||
});
|
||||
var expected = {
|
||||
herp: true,
|
||||
h: true,
|
||||
_: ['derp'],
|
||||
};
|
||||
|
||||
t.same(aliasedArgv, expected);
|
||||
t.same(propertyArgv, expected);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('boolean and alias with options hash', function (t) {
|
||||
var aliased = ['-h', 'derp'];
|
||||
var regular = ['--herp', 'derp'];
|
||||
var opts = {
|
||||
alias: { h: 'herp' },
|
||||
boolean: 'herp',
|
||||
};
|
||||
var aliasedArgv = parse(aliased, opts);
|
||||
var propertyArgv = parse(regular, opts);
|
||||
var expected = {
|
||||
herp: true,
|
||||
h: true,
|
||||
_: ['derp'],
|
||||
};
|
||||
t.same(aliasedArgv, expected);
|
||||
t.same(propertyArgv, expected);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('boolean and alias array with options hash', function (t) {
|
||||
var aliased = ['-h', 'derp'];
|
||||
var regular = ['--herp', 'derp'];
|
||||
var alt = ['--harp', 'derp'];
|
||||
var opts = {
|
||||
alias: { h: ['herp', 'harp'] },
|
||||
boolean: 'h',
|
||||
};
|
||||
var aliasedArgv = parse(aliased, opts);
|
||||
var propertyArgv = parse(regular, opts);
|
||||
var altPropertyArgv = parse(alt, opts);
|
||||
var expected = {
|
||||
harp: true,
|
||||
herp: true,
|
||||
h: true,
|
||||
_: ['derp'],
|
||||
};
|
||||
t.same(aliasedArgv, expected);
|
||||
t.same(propertyArgv, expected);
|
||||
t.same(altPropertyArgv, expected);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('boolean and alias using explicit true', function (t) {
|
||||
var aliased = ['-h', 'true'];
|
||||
var regular = ['--herp', 'true'];
|
||||
var opts = {
|
||||
alias: { h: 'herp' },
|
||||
boolean: 'h',
|
||||
};
|
||||
var aliasedArgv = parse(aliased, opts);
|
||||
var propertyArgv = parse(regular, opts);
|
||||
var expected = {
|
||||
herp: true,
|
||||
h: true,
|
||||
_: [],
|
||||
};
|
||||
|
||||
t.same(aliasedArgv, expected);
|
||||
t.same(propertyArgv, expected);
|
||||
t.end();
|
||||
});
|
||||
|
||||
// regression, see https://github.com/substack/node-optimist/issues/71
|
||||
test('boolean and --x=true', function (t) {
|
||||
var parsed = parse(['--boool', '--other=true'], {
|
||||
boolean: 'boool',
|
||||
});
|
||||
|
||||
t.same(parsed.boool, true);
|
||||
t.same(parsed.other, 'true');
|
||||
|
||||
parsed = parse(['--boool', '--other=false'], {
|
||||
boolean: 'boool',
|
||||
});
|
||||
|
||||
t.same(parsed.boool, true);
|
||||
t.same(parsed.other, 'false');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('boolean --boool=true', function (t) {
|
||||
var parsed = parse(['--boool=true'], {
|
||||
default: {
|
||||
boool: false,
|
||||
},
|
||||
boolean: ['boool'],
|
||||
});
|
||||
|
||||
t.same(parsed.boool, true);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('boolean --boool=false', function (t) {
|
||||
var parsed = parse(['--boool=false'], {
|
||||
default: {
|
||||
boool: true,
|
||||
},
|
||||
boolean: ['boool'],
|
||||
});
|
||||
|
||||
t.same(parsed.boool, false);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('boolean using something similar to true', function (t) {
|
||||
var opts = { boolean: 'h' };
|
||||
var result = parse(['-h', 'true.txt'], opts);
|
||||
var expected = {
|
||||
h: true,
|
||||
_: ['true.txt'],
|
||||
};
|
||||
|
||||
t.same(result, expected);
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user