update
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @fileoverview Rule to flag use of continue statement
|
||||
* @author Borislav Zhivkov
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "Disallow `continue` statements",
|
||||
recommended: false,
|
||||
frozen: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-continue",
|
||||
},
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
unexpected: "Unexpected use of continue statement.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
ContinueStatement(node) {
|
||||
context.report({ node, messageId: "unexpected" });
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { MapSource as MapSourceType } from './source-map-tree';
|
||||
import type { SourceMapInput, SourceMapLoader } from './types';
|
||||
/**
|
||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
||||
* `OriginalSource`s and `SourceMapTree`s.
|
||||
*
|
||||
* Every sourcemap is composed of a collection of source files and mappings
|
||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
||||
* does not have an associated sourcemap, it is considered an original,
|
||||
* unmodified source file.
|
||||
*/
|
||||
export default function buildSourceMapTree(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader): MapSourceType;
|
||||
@@ -0,0 +1,121 @@
|
||||
import type { SearchSchemaInput } from './route'
|
||||
|
||||
export interface StandardSchemaValidatorProps<TInput, TOutput> {
|
||||
readonly types?: StandardSchemaValidatorTypes<TInput, TOutput> | undefined
|
||||
readonly validate: AnyStandardSchemaValidate
|
||||
}
|
||||
|
||||
export interface StandardSchemaValidator<TInput, TOutput> {
|
||||
readonly '~standard': StandardSchemaValidatorProps<TInput, TOutput>
|
||||
}
|
||||
|
||||
export type AnyStandardSchemaValidator = StandardSchemaValidator<any, any>
|
||||
|
||||
export interface StandardSchemaValidatorTypes<TInput, TOutput> {
|
||||
readonly input: TInput
|
||||
readonly output: TOutput
|
||||
}
|
||||
|
||||
export interface AnyStandardSchemaValidateSuccess {
|
||||
readonly value: any
|
||||
readonly issues?: undefined
|
||||
}
|
||||
|
||||
export interface AnyStandardSchemaValidateFailure {
|
||||
readonly issues: ReadonlyArray<AnyStandardSchemaValidateIssue>
|
||||
}
|
||||
|
||||
export interface AnyStandardSchemaValidateIssue {
|
||||
readonly message: string
|
||||
}
|
||||
|
||||
export interface AnyStandardSchemaValidateInput {
|
||||
readonly value: any
|
||||
}
|
||||
|
||||
export type AnyStandardSchemaValidate = (
|
||||
value: unknown,
|
||||
) =>
|
||||
| (AnyStandardSchemaValidateSuccess | AnyStandardSchemaValidateFailure)
|
||||
| Promise<AnyStandardSchemaValidateSuccess | AnyStandardSchemaValidateFailure>
|
||||
|
||||
export interface ValidatorObj<TInput, TOutput> {
|
||||
parse: ValidatorFn<TInput, TOutput>
|
||||
}
|
||||
|
||||
export type AnyValidatorObj = ValidatorObj<any, any>
|
||||
|
||||
export interface ValidatorAdapter<TInput, TOutput> {
|
||||
types: {
|
||||
input: TInput
|
||||
output: TOutput
|
||||
}
|
||||
parse: (input: unknown) => TOutput
|
||||
}
|
||||
|
||||
export type AnyValidatorAdapter = ValidatorAdapter<any, any>
|
||||
|
||||
export type AnyValidatorFn = ValidatorFn<any, any>
|
||||
|
||||
export type ValidatorFn<TInput, TOutput> = (input: TInput) => TOutput
|
||||
|
||||
export type Validator<TInput, TOutput> =
|
||||
| ValidatorObj<TInput, TOutput>
|
||||
| ValidatorFn<TInput, TOutput>
|
||||
| ValidatorAdapter<TInput, TOutput>
|
||||
| StandardSchemaValidator<TInput, TOutput>
|
||||
| undefined
|
||||
|
||||
export type AnyValidator = Validator<any, any>
|
||||
|
||||
export type AnySchema = {}
|
||||
|
||||
export type DefaultValidator = Validator<Record<string, unknown>, AnySchema>
|
||||
|
||||
export type ResolveSearchValidatorInputFn<TValidator> = TValidator extends (
|
||||
input: infer TSchemaInput,
|
||||
) => any
|
||||
? TSchemaInput extends SearchSchemaInput
|
||||
? Omit<TSchemaInput, keyof SearchSchemaInput>
|
||||
: ResolveValidatorOutputFn<TValidator>
|
||||
: AnySchema
|
||||
|
||||
export type ResolveSearchValidatorInput<TValidator> =
|
||||
TValidator extends AnyStandardSchemaValidator
|
||||
? NonNullable<TValidator['~standard']['types']>['input']
|
||||
: TValidator extends AnyValidatorAdapter
|
||||
? TValidator['types']['input']
|
||||
: TValidator extends AnyValidatorObj
|
||||
? ResolveSearchValidatorInputFn<TValidator['parse']>
|
||||
: ResolveSearchValidatorInputFn<TValidator>
|
||||
|
||||
export type ResolveValidatorInputFn<TValidator> = TValidator extends (
|
||||
input: infer TInput,
|
||||
) => any
|
||||
? TInput
|
||||
: undefined
|
||||
|
||||
export type ResolveValidatorInput<TValidator> =
|
||||
TValidator extends AnyStandardSchemaValidator
|
||||
? NonNullable<TValidator['~standard']['types']>['input']
|
||||
: TValidator extends AnyValidatorAdapter
|
||||
? TValidator['types']['input']
|
||||
: TValidator extends AnyValidatorObj
|
||||
? ResolveValidatorInputFn<TValidator['parse']>
|
||||
: ResolveValidatorInputFn<TValidator>
|
||||
|
||||
export type ResolveValidatorOutputFn<TValidator> = TValidator extends (
|
||||
...args: any
|
||||
) => infer TSchema
|
||||
? TSchema
|
||||
: AnySchema
|
||||
|
||||
export type ResolveValidatorOutput<TValidator> = unknown extends TValidator
|
||||
? TValidator
|
||||
: TValidator extends AnyStandardSchemaValidator
|
||||
? NonNullable<TValidator['~standard']['types']>['output']
|
||||
: TValidator extends AnyValidatorAdapter
|
||||
? TValidator['types']['output']
|
||||
: TValidator extends AnyValidatorObj
|
||||
? ResolveValidatorOutputFn<TValidator['parse']>
|
||||
: ResolveValidatorOutputFn<TValidator>
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"4":"K D E F A B mC"},B:{"1":"0 9 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","4":"C L M G N O"},C:{"1":"0 9 mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"nC LC","4":"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 qC rC"},D:{"1":"0 4 5 6 7 8 9 RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R 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","4":"1 2 3 J PB K D E F A B C L M G N O P QB"},E:{"1":"D E F A B C L M G 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","4":"J PB K sC SC tC"},F:{"1":"0 1 2 3 4 5 6 7 8 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 GC","2":"F 4C 5C","4":"B C 6C 7C FC kC 8C"},G:{"1":"E 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","4":"SC 9C lC AD BD"},H:{"4":"WD"},I:{"1":"I bD cD","4":"LC J XD YD ZD aD lC"},J:{"1":"A","4":"D"},K:{"1":"H","4":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"4":"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":"rD","4":"qD"}},B:4,C:"CSS3 Overflow-wrap",D:true};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{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 lB mB nB oB pB qB rB sB tB"},L:{"1":"I"},B:{"1":"0 9 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M G N O P"},C:{"1":"0 9 ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"nC LC J PB qC rC","33":"1 2 3 4 5 6 7 8 K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB"},M:{"1":"EC"},A:{"2":"K D E F A B mC"},F:{"1":"0 hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB 4C 5C 6C 7C FC kC 8C GC"},K:{"1":"H","2":"A B C FC kC GC"},E:{"1":"L M G 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","2":"J PB K D sC SC tC uC vC 3C","33":"E F A B C wC TC FC"},G:{"1":"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 AD BD CD","33":"E DD ED FD GD HD ID JD KD"},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"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"}},B:6,C:"text-decoration-line property",D:undefined};
|
||||
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "OptionValidator", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _validator.OptionValidator;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "findSuggestion", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _findSuggestion.findSuggestion;
|
||||
}
|
||||
});
|
||||
var _validator = require("./validator.js");
|
||||
var _findSuggestion = require("./find-suggestion.js");
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1,480 @@
|
||||
import AtRule from './at-rule.js'
|
||||
import Comment from './comment.js'
|
||||
import Declaration from './declaration.js'
|
||||
import Node, { ChildNode, ChildProps, NodeProps } from './node.js'
|
||||
import Rule from './rule.js'
|
||||
|
||||
declare namespace Container {
|
||||
export class ContainerWithChildren<
|
||||
Child extends Node = ChildNode
|
||||
> extends Container_<Child> {
|
||||
nodes: Child[]
|
||||
}
|
||||
|
||||
export interface ValueOptions {
|
||||
/**
|
||||
* String that’s used to narrow down values and speed up the regexp search.
|
||||
*/
|
||||
fast?: string
|
||||
|
||||
/**
|
||||
* An array of property names.
|
||||
*/
|
||||
props?: readonly string[]
|
||||
}
|
||||
|
||||
export interface ContainerProps extends NodeProps {
|
||||
nodes?: readonly (ChildProps | Node)[]
|
||||
}
|
||||
|
||||
/**
|
||||
* All types that can be passed into container methods to create or add a new
|
||||
* child node.
|
||||
*/
|
||||
export type NewChild =
|
||||
| ChildProps
|
||||
| Node
|
||||
| readonly ChildProps[]
|
||||
| readonly Node[]
|
||||
| readonly string[]
|
||||
| string
|
||||
| undefined
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
export { Container_ as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* The `Root`, `AtRule`, and `Rule` container nodes
|
||||
* inherit some common methods to help work with their children.
|
||||
*
|
||||
* Note that all containers can store any content. If you write a rule inside
|
||||
* a rule, PostCSS will parse it.
|
||||
*/
|
||||
declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
||||
/**
|
||||
* An array containing the container’s children.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('a { color: black }')
|
||||
* root.nodes.length //=> 1
|
||||
* root.nodes[0].selector //=> 'a'
|
||||
* root.nodes[0].nodes[0].prop //=> 'color'
|
||||
* ```
|
||||
*/
|
||||
nodes: Child[] | undefined
|
||||
|
||||
/**
|
||||
* The container’s first child.
|
||||
*
|
||||
* ```js
|
||||
* rule.first === rules.nodes[0]
|
||||
* ```
|
||||
*/
|
||||
get first(): Child | undefined
|
||||
|
||||
/**
|
||||
* The container’s last child.
|
||||
*
|
||||
* ```js
|
||||
* rule.last === rule.nodes[rule.nodes.length - 1]
|
||||
* ```
|
||||
*/
|
||||
get last(): Child | undefined
|
||||
/**
|
||||
* Inserts new nodes to the end of the container.
|
||||
*
|
||||
* ```js
|
||||
* const decl1 = new Declaration({ prop: 'color', value: 'black' })
|
||||
* const decl2 = new Declaration({ prop: 'background-color', value: 'white' })
|
||||
* rule.append(decl1, decl2)
|
||||
*
|
||||
* root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule
|
||||
* root.append({ selector: 'a' }) // rule
|
||||
* rule.append({ prop: 'color', value: 'black' }) // declaration
|
||||
* rule.append({ text: 'Comment' }) // comment
|
||||
*
|
||||
* root.append('a {}')
|
||||
* root.first.append('color: black; z-index: 1')
|
||||
* ```
|
||||
*
|
||||
* @param nodes New nodes.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
append(...nodes: Container.NewChild[]): this
|
||||
assign(overrides: Container.ContainerProps | object): this
|
||||
clone(overrides?: Partial<Container.ContainerProps>): this
|
||||
|
||||
cloneAfter(overrides?: Partial<Container.ContainerProps>): this
|
||||
|
||||
cloneBefore(overrides?: Partial<Container.ContainerProps>): this
|
||||
/**
|
||||
* Iterates through the container’s immediate children,
|
||||
* calling `callback` for each child.
|
||||
*
|
||||
* Returning `false` in the callback will break iteration.
|
||||
*
|
||||
* This method only iterates through the container’s immediate children.
|
||||
* If you need to recursively iterate through all the container’s descendant
|
||||
* nodes, use `Container#walk`.
|
||||
*
|
||||
* Unlike the for `{}`-cycle or `Array#forEach` this iterator is safe
|
||||
* if you are mutating the array of child nodes during iteration.
|
||||
* PostCSS will adjust the current index to match the mutations.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('a { color: black; z-index: 1 }')
|
||||
* const rule = root.first
|
||||
*
|
||||
* for (const decl of rule.nodes) {
|
||||
* decl.cloneBefore({ prop: '-webkit-' + decl.prop })
|
||||
* // Cycle will be infinite, because cloneBefore moves the current node
|
||||
* // to the next index
|
||||
* }
|
||||
*
|
||||
* rule.each(decl => {
|
||||
* decl.cloneBefore({ prop: '-webkit-' + decl.prop })
|
||||
* // Will be executed only for color and z-index
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param callback Iterator receives each node and index.
|
||||
* @return Returns `false` if iteration was broke.
|
||||
*/
|
||||
each(
|
||||
callback: (node: Child, index: number) => false | void
|
||||
): false | undefined
|
||||
|
||||
/**
|
||||
* Returns `true` if callback returns `true`
|
||||
* for all of the container’s children.
|
||||
*
|
||||
* ```js
|
||||
* const noPrefixes = rule.every(i => i.prop[0] !== '-')
|
||||
* ```
|
||||
*
|
||||
* @param condition Iterator returns true or false.
|
||||
* @return Is every child pass condition.
|
||||
*/
|
||||
every(
|
||||
condition: (node: Child, index: number, nodes: Child[]) => boolean
|
||||
): boolean
|
||||
/**
|
||||
* Returns a `child`’s index within the `Container#nodes` array.
|
||||
*
|
||||
* ```js
|
||||
* rule.index( rule.nodes[2] ) //=> 2
|
||||
* ```
|
||||
*
|
||||
* @param child Child of the current container.
|
||||
* @return Child index.
|
||||
*/
|
||||
index(child: Child | number): number
|
||||
|
||||
/**
|
||||
* Insert new node after old node within the container.
|
||||
*
|
||||
* @param oldNode Child or child’s index.
|
||||
* @param newNode New node.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
insertAfter(oldNode: Child | number, newNode: Container.NewChild): this
|
||||
|
||||
/**
|
||||
* Traverses the container’s descendant nodes, calling callback
|
||||
* for each comment node.
|
||||
*
|
||||
* Like `Container#each`, this method is safe
|
||||
* to use if you are mutating arrays during iteration.
|
||||
*
|
||||
* ```js
|
||||
* root.walkComments(comment => {
|
||||
* comment.remove()
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param callback Iterator receives each node and index.
|
||||
* @return Returns `false` if iteration was broke.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Insert new node before old node within the container.
|
||||
*
|
||||
* ```js
|
||||
* rule.insertBefore(decl, decl.clone({ prop: '-webkit-' + decl.prop }))
|
||||
* ```
|
||||
*
|
||||
* @param oldNode Child or child’s index.
|
||||
* @param newNode New node.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
insertBefore(oldNode: Child | number, newNode: Container.NewChild): this
|
||||
/**
|
||||
* Inserts new nodes to the start of the container.
|
||||
*
|
||||
* ```js
|
||||
* const decl1 = new Declaration({ prop: 'color', value: 'black' })
|
||||
* const decl2 = new Declaration({ prop: 'background-color', value: 'white' })
|
||||
* rule.prepend(decl1, decl2)
|
||||
*
|
||||
* root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule
|
||||
* root.append({ selector: 'a' }) // rule
|
||||
* rule.append({ prop: 'color', value: 'black' }) // declaration
|
||||
* rule.append({ text: 'Comment' }) // comment
|
||||
*
|
||||
* root.append('a {}')
|
||||
* root.first.append('color: black; z-index: 1')
|
||||
* ```
|
||||
*
|
||||
* @param nodes New nodes.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
prepend(...nodes: Container.NewChild[]): this
|
||||
|
||||
/**
|
||||
* Add child to the end of the node.
|
||||
*
|
||||
* ```js
|
||||
* rule.push(new Declaration({ prop: 'color', value: 'black' }))
|
||||
* ```
|
||||
*
|
||||
* @param child New node.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
push(child: Child): this
|
||||
|
||||
/**
|
||||
* Removes all children from the container
|
||||
* and cleans their parent properties.
|
||||
*
|
||||
* ```js
|
||||
* rule.removeAll()
|
||||
* rule.nodes.length //=> 0
|
||||
* ```
|
||||
*
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
removeAll(): this
|
||||
|
||||
/**
|
||||
* Removes node from the container and cleans the parent properties
|
||||
* from the node and its children.
|
||||
*
|
||||
* ```js
|
||||
* rule.nodes.length //=> 5
|
||||
* rule.removeChild(decl)
|
||||
* rule.nodes.length //=> 4
|
||||
* decl.parent //=> undefined
|
||||
* ```
|
||||
*
|
||||
* @param child Child or child’s index.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
removeChild(child: Child | number): this
|
||||
|
||||
replaceValues(
|
||||
pattern: RegExp | string,
|
||||
replaced: { (substring: string, ...args: any[]): string } | string
|
||||
): this
|
||||
/**
|
||||
* Passes all declaration values within the container that match pattern
|
||||
* through callback, replacing those values with the returned result
|
||||
* of callback.
|
||||
*
|
||||
* This method is useful if you are using a custom unit or function
|
||||
* and need to iterate through all values.
|
||||
*
|
||||
* ```js
|
||||
* root.replaceValues(/\d+rem/, { fast: 'rem' }, string => {
|
||||
* return 15 * parseInt(string) + 'px'
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param pattern Replace pattern.
|
||||
* @param {object} options Options to speed up the search.
|
||||
* @param replaced String to replace pattern or callback
|
||||
* that returns a new value. The callback
|
||||
* will receive the same arguments
|
||||
* as those passed to a function parameter
|
||||
* of `String#replace`.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
replaceValues(
|
||||
pattern: RegExp | string,
|
||||
options: Container.ValueOptions,
|
||||
replaced: { (substring: string, ...args: any[]): string } | string
|
||||
): this
|
||||
|
||||
/**
|
||||
* Returns `true` if callback returns `true` for (at least) one
|
||||
* of the container’s children.
|
||||
*
|
||||
* ```js
|
||||
* const hasPrefix = rule.some(i => i.prop[0] === '-')
|
||||
* ```
|
||||
*
|
||||
* @param condition Iterator returns true or false.
|
||||
* @return Is some child pass condition.
|
||||
*/
|
||||
some(
|
||||
condition: (node: Child, index: number, nodes: Child[]) => boolean
|
||||
): boolean
|
||||
|
||||
/**
|
||||
* Traverses the container’s descendant nodes, calling callback
|
||||
* for each node.
|
||||
*
|
||||
* Like container.each(), this method is safe to use
|
||||
* if you are mutating arrays during iteration.
|
||||
*
|
||||
* If you only need to iterate through the container’s immediate children,
|
||||
* use `Container#each`.
|
||||
*
|
||||
* ```js
|
||||
* root.walk(node => {
|
||||
* // Traverses all descendant nodes.
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param callback Iterator receives each node and index.
|
||||
* @return Returns `false` if iteration was broke.
|
||||
*/
|
||||
walk(
|
||||
callback: (node: ChildNode, index: number) => false | void
|
||||
): false | undefined
|
||||
|
||||
/**
|
||||
* Traverses the container’s descendant nodes, calling callback
|
||||
* for each at-rule node.
|
||||
*
|
||||
* If you pass a filter, iteration will only happen over at-rules
|
||||
* that have matching names.
|
||||
*
|
||||
* Like `Container#each`, this method is safe
|
||||
* to use if you are mutating arrays during iteration.
|
||||
*
|
||||
* ```js
|
||||
* root.walkAtRules(rule => {
|
||||
* if (isOld(rule.name)) rule.remove()
|
||||
* })
|
||||
*
|
||||
* let first = false
|
||||
* root.walkAtRules('charset', rule => {
|
||||
* if (!first) {
|
||||
* first = true
|
||||
* } else {
|
||||
* rule.remove()
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param name String or regular expression to filter at-rules by name.
|
||||
* @param callback Iterator receives each node and index.
|
||||
* @return Returns `false` if iteration was broke.
|
||||
*/
|
||||
walkAtRules(
|
||||
nameFilter: RegExp | string,
|
||||
callback: (atRule: AtRule, index: number) => false | void
|
||||
): false | undefined
|
||||
walkAtRules(
|
||||
callback: (atRule: AtRule, index: number) => false | void
|
||||
): false | undefined
|
||||
|
||||
walkComments(
|
||||
callback: (comment: Comment, indexed: number) => false | void
|
||||
): false | undefined
|
||||
walkComments(
|
||||
callback: (comment: Comment, indexed: number) => false | void
|
||||
): false | undefined
|
||||
|
||||
/**
|
||||
* Traverses the container’s descendant nodes, calling callback
|
||||
* for each declaration node.
|
||||
*
|
||||
* If you pass a filter, iteration will only happen over declarations
|
||||
* with matching properties.
|
||||
*
|
||||
* ```js
|
||||
* root.walkDecls(decl => {
|
||||
* checkPropertySupport(decl.prop)
|
||||
* })
|
||||
*
|
||||
* root.walkDecls('border-radius', decl => {
|
||||
* decl.remove()
|
||||
* })
|
||||
*
|
||||
* root.walkDecls(/^background/, decl => {
|
||||
* decl.value = takeFirstColorFromGradient(decl.value)
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* Like `Container#each`, this method is safe
|
||||
* to use if you are mutating arrays during iteration.
|
||||
*
|
||||
* @param prop String or regular expression to filter declarations
|
||||
* by property name.
|
||||
* @param callback Iterator receives each node and index.
|
||||
* @return Returns `false` if iteration was broke.
|
||||
*/
|
||||
walkDecls(
|
||||
propFilter: RegExp | string,
|
||||
callback: (decl: Declaration, index: number) => false | void
|
||||
): false | undefined
|
||||
walkDecls(
|
||||
callback: (decl: Declaration, index: number) => false | void
|
||||
): false | undefined
|
||||
/**
|
||||
* Traverses the container’s descendant nodes, calling callback
|
||||
* for each rule node.
|
||||
*
|
||||
* If you pass a filter, iteration will only happen over rules
|
||||
* with matching selectors.
|
||||
*
|
||||
* Like `Container#each`, this method is safe
|
||||
* to use if you are mutating arrays during iteration.
|
||||
*
|
||||
* ```js
|
||||
* const selectors = []
|
||||
* root.walkRules(rule => {
|
||||
* selectors.push(rule.selector)
|
||||
* })
|
||||
* console.log(`Your CSS uses ${ selectors.length } selectors`)
|
||||
* ```
|
||||
*
|
||||
* @param selector String or regular expression to filter rules by selector.
|
||||
* @param callback Iterator receives each node and index.
|
||||
* @return Returns `false` if iteration was broke.
|
||||
*/
|
||||
walkRules(
|
||||
selectorFilter: RegExp | string,
|
||||
callback: (rule: Rule, index: number) => false | void
|
||||
): false | undefined
|
||||
walkRules(
|
||||
callback: (rule: Rule, index: number) => false | void
|
||||
): false | undefined
|
||||
/**
|
||||
* An internal method that converts a {@link NewChild} into a list of actual
|
||||
* child nodes that can then be added to this container.
|
||||
*
|
||||
* This ensures that the nodes' parent is set to this container, that they use
|
||||
* the correct prototype chain, and that they're marked as dirty.
|
||||
*
|
||||
* @param mnodes The new node or nodes to add.
|
||||
* @param sample A node from whose raws the new node's `before` raw should be
|
||||
* taken.
|
||||
* @param type This should be set to `'prepend'` if the new nodes will be
|
||||
* inserted at the beginning of the container.
|
||||
* @hidden
|
||||
*/
|
||||
protected normalize(
|
||||
nodes: Container.NewChild,
|
||||
sample: Node | undefined,
|
||||
type?: 'prepend' | false
|
||||
): Child[]
|
||||
}
|
||||
|
||||
declare class Container<
|
||||
Child extends Node = ChildNode
|
||||
> extends Container_<Child> {}
|
||||
|
||||
export = Container
|
||||
@@ -0,0 +1,37 @@
|
||||
export declare const clipboardEvents: readonly ["onCopy", "onCut", "onPaste"];
|
||||
export declare const compositionEvents: readonly ["onCompositionEnd", "onCompositionStart", "onCompositionUpdate"];
|
||||
export declare const focusEvents: readonly ["onFocus", "onBlur"];
|
||||
export declare const formEvents: readonly ["onInput", "onInvalid", "onReset", "onSubmit"];
|
||||
export declare const imageEvents: readonly ["onLoad", "onError"];
|
||||
export declare const keyboardEvents: readonly ["onKeyDown", "onKeyPress", "onKeyUp"];
|
||||
export declare const mediaEvents: readonly ["onAbort", "onCanPlay", "onCanPlayThrough", "onDurationChange", "onEmptied", "onEncrypted", "onEnded", "onError", "onLoadedData", "onLoadedMetadata", "onLoadStart", "onPause", "onPlay", "onPlaying", "onProgress", "onRateChange", "onSeeked", "onSeeking", "onStalled", "onSuspend", "onTimeUpdate", "onVolumeChange", "onWaiting"];
|
||||
export declare const mouseEvents: readonly ["onClick", "onContextMenu", "onDoubleClick", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseMove", "onMouseOut", "onMouseOver", "onMouseUp"];
|
||||
export declare const dragEvents: readonly ["onDrag", "onDragEnd", "onDragEnter", "onDragExit", "onDragLeave", "onDragOver", "onDragStart", "onDrop"];
|
||||
export declare const selectionEvents: readonly ["onSelect"];
|
||||
export declare const touchEvents: readonly ["onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart"];
|
||||
export declare const pointerEvents: readonly ["onPointerDown", "onPointerMove", "onPointerUp", "onPointerCancel", "onGotPointerCapture", "onLostPointerCapture", "onPointerEnter", "onPointerLeave", "onPointerOver", "onPointerOut"];
|
||||
export declare const uiEvents: readonly ["onScroll"];
|
||||
export declare const wheelEvents: readonly ["onWheel"];
|
||||
export declare const animationEvents: readonly ["onAnimationStart", "onAnimationEnd", "onAnimationIteration"];
|
||||
export declare const transitionEvents: readonly ["onTransitionEnd"];
|
||||
export declare const otherEvents: readonly ["onToggle"];
|
||||
export declare const changeEvents: readonly ["onChange"];
|
||||
export declare const allEvents: readonly ["onCopy", "onCut", "onPaste", "onCompositionEnd", "onCompositionStart", "onCompositionUpdate", "onFocus", "onBlur", "onInput", "onInvalid", "onReset", "onSubmit", "onLoad", "onError", "onKeyDown", "onKeyPress", "onKeyUp", "onAbort", "onCanPlay", "onCanPlayThrough", "onDurationChange", "onEmptied", "onEncrypted", "onEnded", "onError", "onLoadedData", "onLoadedMetadata", "onLoadStart", "onPause", "onPlay", "onPlaying", "onProgress", "onRateChange", "onSeeked", "onSeeking", "onStalled", "onSuspend", "onTimeUpdate", "onVolumeChange", "onWaiting", "onClick", "onContextMenu", "onDoubleClick", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseMove", "onMouseOut", "onMouseOver", "onMouseUp", "onDrag", "onDragEnd", "onDragEnter", "onDragExit", "onDragLeave", "onDragOver", "onDragStart", "onDrop", "onSelect", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart", "onPointerDown", "onPointerMove", "onPointerUp", "onPointerCancel", "onGotPointerCapture", "onLostPointerCapture", "onPointerEnter", "onPointerLeave", "onPointerOver", "onPointerOut", "onScroll", "onWheel", "onAnimationStart", "onAnimationEnd", "onAnimationIteration", "onTransitionEnd", "onChange", "onToggle"];
|
||||
type AllEvents = (typeof allEvents)[number];
|
||||
type EventHandler<ArgsType> = (event: any, args: ArgsType) => void;
|
||||
type EventHandlerWithoutArgs<ArgsType, OriginalEventHandler> = OriginalEventHandler extends (event: infer Event, args: ArgsType) => void ? (event: Event) => void : never;
|
||||
export type EventProps<ArgsType> = {
|
||||
[K in AllEvents]?: EventHandler<ArgsType>;
|
||||
};
|
||||
type Props<ArgsType> = Record<string, unknown> & EventProps<ArgsType>;
|
||||
type EventPropsWithoutArgs<ArgsType, PropsType> = {
|
||||
[K in keyof PropsType as K extends AllEvents ? K : never]: EventHandlerWithoutArgs<ArgsType, PropsType[K]>;
|
||||
};
|
||||
/**
|
||||
* Returns an object with on-event callback props curried with provided args.
|
||||
* @param {Object} props Props passed to a component.
|
||||
* @param {Function=} getArgs A function that returns argument(s) on-event callbacks
|
||||
* shall be curried with.
|
||||
*/
|
||||
export default function makeEventProps<ArgsType, PropsType extends Props<ArgsType> = Props<ArgsType>>(props: PropsType, getArgs?: (eventName: string) => ArgsType): EventPropsWithoutArgs<ArgsType, PropsType>;
|
||||
export {};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_path","data","require","_helperCompilationTargets","resolveBrowserslistConfigFile","browserslistConfigFile","configFileDir","path","resolve","resolveTargets","options","root","optTargets","targets","Array","isArray","browsers","Object","assign","esmodules","configFile","ignoreBrowserslistConfig","getTargets","configPath","browserslistEnv"],"sources":["../../src/config/resolve-targets.ts"],"sourcesContent":["type browserType = typeof import(\"./resolve-targets-browser\");\ntype nodeType = typeof import(\"./resolve-targets\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of index-browser, since this file may be replaced at bundle time with index-browser.\n({}) as any as browserType as nodeType;\n\nimport type { ValidatedOptions } from \"./validation/options.ts\";\nimport path from \"path\";\nimport getTargets, {\n type InputTargets,\n} from \"@babel/helper-compilation-targets\";\n\nimport type { Targets } from \"@babel/helper-compilation-targets\";\n\nexport function resolveBrowserslistConfigFile(\n browserslistConfigFile: string,\n configFileDir: string,\n): string | undefined {\n return path.resolve(configFileDir, browserslistConfigFile);\n}\n\nexport function resolveTargets(\n options: ValidatedOptions,\n root: string,\n): Targets {\n const optTargets = options.targets;\n let targets: InputTargets;\n\n if (typeof optTargets === \"string\" || Array.isArray(optTargets)) {\n targets = { browsers: optTargets };\n } else if (optTargets) {\n if (\"esmodules\" in optTargets) {\n targets = { ...optTargets, esmodules: \"intersect\" };\n } else {\n // https://github.com/microsoft/TypeScript/issues/17002\n targets = optTargets as InputTargets;\n }\n }\n\n const { browserslistConfigFile } = options;\n let configFile;\n let ignoreBrowserslistConfig = false;\n if (typeof browserslistConfigFile === \"string\") {\n configFile = browserslistConfigFile;\n } else {\n ignoreBrowserslistConfig = browserslistConfigFile === false;\n }\n\n return getTargets(targets, {\n ignoreBrowserslistConfig,\n configFile,\n configPath: root,\n browserslistEnv: options.browserslistEnv,\n });\n}\n"],"mappings":";;;;;;;AAQA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,0BAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,yBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAJA,CAAC,CAAC,CAAC;AAUI,SAASG,6BAA6BA,CAC3CC,sBAA8B,EAC9BC,aAAqB,EACD;EACpB,OAAOC,MAAGA,CAAC,CAACC,OAAO,CAACF,aAAa,EAAED,sBAAsB,CAAC;AAC5D;AAEO,SAASI,cAAcA,CAC5BC,OAAyB,EACzBC,IAAY,EACH;EACT,MAAMC,UAAU,GAAGF,OAAO,CAACG,OAAO;EAClC,IAAIA,OAAqB;EAEzB,IAAI,OAAOD,UAAU,KAAK,QAAQ,IAAIE,KAAK,CAACC,OAAO,CAACH,UAAU,CAAC,EAAE;IAC/DC,OAAO,GAAG;MAAEG,QAAQ,EAAEJ;IAAW,CAAC;EACpC,CAAC,MAAM,IAAIA,UAAU,EAAE;IACrB,IAAI,WAAW,IAAIA,UAAU,EAAE;MAC7BC,OAAO,GAAAI,MAAA,CAAAC,MAAA,KAAQN,UAAU;QAAEO,SAAS,EAAE;MAAW,EAAE;IACrD,CAAC,MAAM;MAELN,OAAO,GAAGD,UAA0B;IACtC;EACF;EAEA,MAAM;IAAEP;EAAuB,CAAC,GAAGK,OAAO;EAC1C,IAAIU,UAAU;EACd,IAAIC,wBAAwB,GAAG,KAAK;EACpC,IAAI,OAAOhB,sBAAsB,KAAK,QAAQ,EAAE;IAC9Ce,UAAU,GAAGf,sBAAsB;EACrC,CAAC,MAAM;IACLgB,wBAAwB,GAAGhB,sBAAsB,KAAK,KAAK;EAC7D;EAEA,OAAO,IAAAiB,mCAAU,EAACT,OAAO,EAAE;IACzBQ,wBAAwB;IACxBD,UAAU;IACVG,UAAU,EAAEZ,IAAI;IAChBa,eAAe,EAAEd,OAAO,CAACc;EAC3B,CAAC,CAAC;AACJ;AAAC","ignoreList":[]}
|
||||
@@ -0,0 +1,13 @@
|
||||
const fs = require('fs')
|
||||
const JSON5 = require('./')
|
||||
|
||||
// eslint-disable-next-line node/no-deprecated-api
|
||||
require.extensions['.json5'] = function (module, filename) {
|
||||
const content = fs.readFileSync(filename, 'utf8')
|
||||
try {
|
||||
module.exports = JSON5.parse(content)
|
||||
} catch (err) {
|
||||
err.message = filename + ': ' + err.message
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { Derived } from './derived'
|
||||
import type { DerivedOptions } from './derived'
|
||||
|
||||
interface EffectOptions
|
||||
extends Omit<
|
||||
DerivedOptions<unknown>,
|
||||
'onUpdate' | 'onSubscribe' | 'lazy' | 'fn'
|
||||
> {
|
||||
/**
|
||||
* Should the effect trigger immediately?
|
||||
* @default false
|
||||
*/
|
||||
eager?: boolean
|
||||
fn: () => void
|
||||
}
|
||||
|
||||
export class Effect {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_derived: Derived<void>
|
||||
|
||||
constructor(opts: EffectOptions) {
|
||||
const { eager, fn, ...derivedProps } = opts
|
||||
|
||||
this._derived = new Derived({
|
||||
...derivedProps,
|
||||
fn: () => {},
|
||||
onUpdate() {
|
||||
fn()
|
||||
},
|
||||
})
|
||||
|
||||
if (eager) {
|
||||
fn()
|
||||
}
|
||||
}
|
||||
|
||||
mount() {
|
||||
return this._derived.mount()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_index","require","_isLet","isBlockScoped","node","isFunctionDeclaration","isClassDeclaration","isLet"],"sources":["../../src/validators/isBlockScoped.ts"],"sourcesContent":["import {\n isClassDeclaration,\n isFunctionDeclaration,\n} from \"./generated/index.ts\";\nimport isLet from \"./isLet.ts\";\nimport type * as t from \"../index.ts\";\n\n/**\n * Check if the input `node` is block scoped.\n */\nexport default function isBlockScoped(node: t.Node): boolean {\n return isFunctionDeclaration(node) || isClassDeclaration(node) || isLet(node);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAMe,SAASE,aAAaA,CAACC,IAAY,EAAW;EAC3D,OAAO,IAAAC,4BAAqB,EAACD,IAAI,CAAC,IAAI,IAAAE,yBAAkB,EAACF,IAAI,CAAC,IAAI,IAAAG,cAAK,EAACH,IAAI,CAAC;AAC/E","ignoreList":[]}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ws.js","sourceRoot":"","sources":["../../../src/schemes/ws.ts"],"names":[],"mappings":"AAOA,kBAAkB,YAAyB;IAC1C,OAAO,OAAO,YAAY,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC;AAC7H,CAAC;AAED,UAAU;AACV,MAAM,OAAO,GAAoB;IAChC,MAAM,EAAG,IAAI;IAEb,UAAU,EAAG,IAAI;IAEjB,KAAK,EAAG,UAAU,UAAwB,EAAE,OAAkB;QAC7D,MAAM,YAAY,GAAG,UAA0B,CAAC;QAEhD,oCAAoC;QACpC,YAAY,CAAC,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;QAE7C,wBAAwB;QACxB,YAAY,CAAC,YAAY,GAAG,CAAC,YAAY,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC9G,YAAY,CAAC,IAAI,GAAG,SAAS,CAAC;QAC9B,YAAY,CAAC,KAAK,GAAG,SAAS,CAAC;QAE/B,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,SAAS,EAAG,UAAU,YAAyB,EAAE,OAAkB;QAClE,4BAA4B;QAC5B,IAAI,YAAY,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,YAAY,CAAC,IAAI,KAAK,EAAE,EAAE;YAC1F,YAAY,CAAC,IAAI,GAAG,SAAS,CAAC;SAC9B;QAED,mCAAmC;QACnC,IAAI,OAAO,YAAY,CAAC,MAAM,KAAK,SAAS,EAAE;YAC7C,YAAY,CAAC,MAAM,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC3D,YAAY,CAAC,MAAM,GAAG,SAAS,CAAC;SAChC;QAED,qCAAqC;QACrC,IAAI,YAAY,CAAC,YAAY,EAAE;YAC9B,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC3D,YAAY,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAC9D,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC;YAC3B,YAAY,CAAC,YAAY,GAAG,SAAS,CAAC;SACtC;QAED,2BAA2B;QAC3B,YAAY,CAAC,QAAQ,GAAG,SAAS,CAAC;QAElC,OAAO,YAAY,CAAC;IACrB,CAAC;CACD,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { AnyContext, AnyPathParams, AnyRoute, UpdatableRouteOptions } from './route.cjs';
|
||||
import { AnyValidator } from './validators.cjs';
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: any;
|
||||
fullPaths: any;
|
||||
to: any;
|
||||
fileRoutesByTo: any;
|
||||
id: any;
|
||||
fileRoutesById: any;
|
||||
}
|
||||
export type InferFileRouteTypes<TRouteTree extends AnyRoute> = unknown extends TRouteTree['types']['fileRouteTypes'] ? never : TRouteTree['types']['fileRouteTypes'] extends FileRouteTypes ? TRouteTree['types']['fileRouteTypes'] : never;
|
||||
export interface FileRoutesByPath {
|
||||
}
|
||||
export type LazyRouteOptions = Pick<UpdatableRouteOptions<AnyRoute, string, string, AnyPathParams, AnyValidator, {}, AnyContext, AnyContext, AnyContext, AnyContext>, 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'>;
|
||||
export interface LazyRoute {
|
||||
options: {
|
||||
id: string;
|
||||
} & LazyRouteOptions;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toPropertyKey;
|
||||
var _toPrimitive = require("./toPrimitive.js");
|
||||
function toPropertyKey(arg) {
|
||||
var key = (0, _toPrimitive.default)(arg, "string");
|
||||
return typeof key === "symbol" ? key : String(key);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=toPropertyKey.js.map
|
||||
@@ -0,0 +1,75 @@
|
||||
export interface ImportGlobOptions<
|
||||
Eager extends boolean,
|
||||
AsType extends string,
|
||||
> {
|
||||
/**
|
||||
* Import type for the import url.
|
||||
*
|
||||
* @deprecated Use `query` instead, e.g. `as: 'url'` -> `query: '?url', import: 'default'`
|
||||
*/
|
||||
as?: AsType
|
||||
/**
|
||||
* Import as static or dynamic
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
eager?: Eager
|
||||
/**
|
||||
* Import only the specific named export. Set to `default` to import the default export.
|
||||
*/
|
||||
import?: string
|
||||
/**
|
||||
* Custom queries
|
||||
*/
|
||||
query?: string | Record<string, string | number | boolean>
|
||||
/**
|
||||
* Search files also inside `node_modules/` and hidden directories (e.g. `.git/`). This might have impact on performance.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
exhaustive?: boolean
|
||||
}
|
||||
|
||||
export type GeneralImportGlobOptions = ImportGlobOptions<boolean, string>
|
||||
|
||||
export interface KnownAsTypeMap {
|
||||
raw: string
|
||||
url: string
|
||||
worker: Worker
|
||||
}
|
||||
|
||||
export interface ImportGlobFunction {
|
||||
/**
|
||||
* Import a list of files with a glob pattern.
|
||||
*
|
||||
* Overload 1: No generic provided, infer the type from `eager` and `as`
|
||||
*/
|
||||
<
|
||||
Eager extends boolean,
|
||||
As extends string,
|
||||
T = As extends keyof KnownAsTypeMap ? KnownAsTypeMap[As] : unknown,
|
||||
>(
|
||||
glob: string | string[],
|
||||
options?: ImportGlobOptions<Eager, As>,
|
||||
): (Eager extends true ? true : false) extends true
|
||||
? Record<string, T>
|
||||
: Record<string, () => Promise<T>>
|
||||
/**
|
||||
* Import a list of files with a glob pattern.
|
||||
*
|
||||
* Overload 2: Module generic provided, infer the type from `eager: false`
|
||||
*/
|
||||
<M>(
|
||||
glob: string | string[],
|
||||
options?: ImportGlobOptions<false, string>,
|
||||
): Record<string, () => Promise<M>>
|
||||
/**
|
||||
* Import a list of files with a glob pattern.
|
||||
*
|
||||
* Overload 3: Module generic provided, infer the type from `eager: true`
|
||||
*/
|
||||
<M>(
|
||||
glob: string | string[],
|
||||
options: ImportGlobOptions<true, string>,
|
||||
): Record<string, M>
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unflatten = void 0;
|
||||
const utils_js_1 = require("./utils.js");
|
||||
const globalObj = (typeof window !== "undefined"
|
||||
? window
|
||||
: typeof globalThis !== "undefined"
|
||||
? globalThis
|
||||
: undefined);
|
||||
function unflatten(parsed) {
|
||||
const { hydrated, values } = this;
|
||||
if (typeof parsed === "number")
|
||||
return hydrate.call(this, parsed);
|
||||
if (!Array.isArray(parsed) || !parsed.length)
|
||||
throw new SyntaxError();
|
||||
const startIndex = values.length;
|
||||
for (const value of parsed) {
|
||||
values.push(value);
|
||||
}
|
||||
hydrated.length = values.length;
|
||||
return hydrate.call(this, startIndex);
|
||||
}
|
||||
exports.unflatten = unflatten;
|
||||
function hydrate(index) {
|
||||
const { hydrated, values, deferred, plugins } = this;
|
||||
let result;
|
||||
const stack = [
|
||||
[
|
||||
index,
|
||||
(v) => {
|
||||
result = v;
|
||||
},
|
||||
],
|
||||
];
|
||||
let postRun = [];
|
||||
while (stack.length > 0) {
|
||||
const [index, set] = stack.pop();
|
||||
switch (index) {
|
||||
case utils_js_1.UNDEFINED:
|
||||
set(undefined);
|
||||
continue;
|
||||
case utils_js_1.NULL:
|
||||
set(null);
|
||||
continue;
|
||||
case utils_js_1.NAN:
|
||||
set(NaN);
|
||||
continue;
|
||||
case utils_js_1.POSITIVE_INFINITY:
|
||||
set(Infinity);
|
||||
continue;
|
||||
case utils_js_1.NEGATIVE_INFINITY:
|
||||
set(-Infinity);
|
||||
continue;
|
||||
case utils_js_1.NEGATIVE_ZERO:
|
||||
set(-0);
|
||||
continue;
|
||||
}
|
||||
if (hydrated[index]) {
|
||||
set(hydrated[index]);
|
||||
continue;
|
||||
}
|
||||
const value = values[index];
|
||||
if (!value || typeof value !== "object") {
|
||||
hydrated[index] = value;
|
||||
set(value);
|
||||
continue;
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
if (typeof value[0] === "string") {
|
||||
const [type, b, c] = value;
|
||||
switch (type) {
|
||||
case utils_js_1.TYPE_DATE:
|
||||
set((hydrated[index] = new Date(b)));
|
||||
continue;
|
||||
case utils_js_1.TYPE_URL:
|
||||
set((hydrated[index] = new URL(b)));
|
||||
continue;
|
||||
case utils_js_1.TYPE_BIGINT:
|
||||
set((hydrated[index] = BigInt(b)));
|
||||
continue;
|
||||
case utils_js_1.TYPE_REGEXP:
|
||||
set((hydrated[index] = new RegExp(b, c)));
|
||||
continue;
|
||||
case utils_js_1.TYPE_SYMBOL:
|
||||
set((hydrated[index] = Symbol.for(b)));
|
||||
continue;
|
||||
case utils_js_1.TYPE_SET:
|
||||
const newSet = new Set();
|
||||
hydrated[index] = newSet;
|
||||
for (let i = 1; i < value.length; i++)
|
||||
stack.push([
|
||||
value[i],
|
||||
(v) => {
|
||||
newSet.add(v);
|
||||
},
|
||||
]);
|
||||
set(newSet);
|
||||
continue;
|
||||
case utils_js_1.TYPE_MAP:
|
||||
const map = new Map();
|
||||
hydrated[index] = map;
|
||||
for (let i = 1; i < value.length; i += 2) {
|
||||
const r = [];
|
||||
stack.push([
|
||||
value[i + 1],
|
||||
(v) => {
|
||||
r[1] = v;
|
||||
},
|
||||
]);
|
||||
stack.push([
|
||||
value[i],
|
||||
(k) => {
|
||||
r[0] = k;
|
||||
},
|
||||
]);
|
||||
postRun.push(() => {
|
||||
map.set(r[0], r[1]);
|
||||
});
|
||||
}
|
||||
set(map);
|
||||
continue;
|
||||
case utils_js_1.TYPE_NULL_OBJECT:
|
||||
const obj = Object.create(null);
|
||||
hydrated[index] = obj;
|
||||
for (const key of Object.keys(b).reverse()) {
|
||||
const r = [];
|
||||
stack.push([
|
||||
b[key],
|
||||
(v) => {
|
||||
r[1] = v;
|
||||
},
|
||||
]);
|
||||
stack.push([
|
||||
Number(key.slice(1)),
|
||||
(k) => {
|
||||
r[0] = k;
|
||||
},
|
||||
]);
|
||||
postRun.push(() => {
|
||||
obj[r[0]] = r[1];
|
||||
});
|
||||
}
|
||||
set(obj);
|
||||
continue;
|
||||
case utils_js_1.TYPE_PROMISE:
|
||||
if (hydrated[b]) {
|
||||
set((hydrated[index] = hydrated[b]));
|
||||
}
|
||||
else {
|
||||
const d = new utils_js_1.Deferred();
|
||||
deferred[b] = d;
|
||||
set((hydrated[index] = d.promise));
|
||||
}
|
||||
continue;
|
||||
case utils_js_1.TYPE_ERROR:
|
||||
const [, message, errorType] = value;
|
||||
let error = errorType && globalObj && globalObj[errorType]
|
||||
? new globalObj[errorType](message)
|
||||
: new Error(message);
|
||||
hydrated[index] = error;
|
||||
set(error);
|
||||
continue;
|
||||
case utils_js_1.TYPE_PREVIOUS_RESOLVED:
|
||||
set((hydrated[index] = hydrated[b]));
|
||||
continue;
|
||||
default:
|
||||
// Run plugins at the end so we have a chance to resolve primitives
|
||||
// without running into a loop
|
||||
if (Array.isArray(plugins)) {
|
||||
const r = [];
|
||||
const vals = value.slice(1);
|
||||
for (let i = 0; i < vals.length; i++) {
|
||||
const v = vals[i];
|
||||
stack.push([
|
||||
v,
|
||||
(v) => {
|
||||
r[i] = v;
|
||||
},
|
||||
]);
|
||||
}
|
||||
postRun.push(() => {
|
||||
for (const plugin of plugins) {
|
||||
const result = plugin(value[0], ...r);
|
||||
if (result) {
|
||||
set((hydrated[index] = result.value));
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new SyntaxError();
|
||||
});
|
||||
continue;
|
||||
}
|
||||
throw new SyntaxError();
|
||||
}
|
||||
}
|
||||
else {
|
||||
const array = [];
|
||||
hydrated[index] = array;
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const n = value[i];
|
||||
if (n !== utils_js_1.HOLE) {
|
||||
stack.push([
|
||||
n,
|
||||
(v) => {
|
||||
array[i] = v;
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
set(array);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const object = {};
|
||||
hydrated[index] = object;
|
||||
for (const key of Object.keys(value).reverse()) {
|
||||
const r = [];
|
||||
stack.push([
|
||||
value[key],
|
||||
(v) => {
|
||||
r[1] = v;
|
||||
},
|
||||
]);
|
||||
stack.push([
|
||||
Number(key.slice(1)),
|
||||
(k) => {
|
||||
r[0] = k;
|
||||
},
|
||||
]);
|
||||
postRun.push(() => {
|
||||
object[r[0]] = r[1];
|
||||
});
|
||||
}
|
||||
set(object);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
while (postRun.length > 0) {
|
||||
postRun.pop()();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user