update
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const derived = require("./derived.cjs");
|
||||
const __storeToDerived = /* @__PURE__ */ new WeakMap();
|
||||
const __derivedToStore = /* @__PURE__ */ new WeakMap();
|
||||
const __depsThatHaveWrittenThisTick = {
|
||||
current: []
|
||||
};
|
||||
let __isFlushing = false;
|
||||
let __batchDepth = 0;
|
||||
const __pendingUpdates = /* @__PURE__ */ new Set();
|
||||
const __initialBatchValues = /* @__PURE__ */ new Map();
|
||||
function __flush_internals(relatedVals) {
|
||||
const sorted = Array.from(relatedVals).sort((a, b) => {
|
||||
if (a instanceof derived.Derived && a.options.deps.includes(b)) return 1;
|
||||
if (b instanceof derived.Derived && b.options.deps.includes(a)) return -1;
|
||||
return 0;
|
||||
});
|
||||
for (const derived2 of sorted) {
|
||||
if (__depsThatHaveWrittenThisTick.current.includes(derived2)) {
|
||||
continue;
|
||||
}
|
||||
__depsThatHaveWrittenThisTick.current.push(derived2);
|
||||
derived2.recompute();
|
||||
const stores = __derivedToStore.get(derived2);
|
||||
if (stores) {
|
||||
for (const store of stores) {
|
||||
const relatedLinkedDerivedVals = __storeToDerived.get(store);
|
||||
if (!relatedLinkedDerivedVals) continue;
|
||||
__flush_internals(relatedLinkedDerivedVals);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function __notifyListeners(store) {
|
||||
store.listeners.forEach(
|
||||
(listener) => listener({
|
||||
prevVal: store.prevState,
|
||||
currentVal: store.state
|
||||
})
|
||||
);
|
||||
}
|
||||
function __notifyDerivedListeners(derived2) {
|
||||
derived2.listeners.forEach(
|
||||
(listener) => listener({
|
||||
prevVal: derived2.prevState,
|
||||
currentVal: derived2.state
|
||||
})
|
||||
);
|
||||
}
|
||||
function __flush(store) {
|
||||
if (__batchDepth > 0 && !__initialBatchValues.has(store)) {
|
||||
__initialBatchValues.set(store, store.prevState);
|
||||
}
|
||||
__pendingUpdates.add(store);
|
||||
if (__batchDepth > 0) return;
|
||||
if (__isFlushing) return;
|
||||
try {
|
||||
__isFlushing = true;
|
||||
while (__pendingUpdates.size > 0) {
|
||||
const stores = Array.from(__pendingUpdates);
|
||||
__pendingUpdates.clear();
|
||||
for (const store2 of stores) {
|
||||
const prevState = __initialBatchValues.get(store2) ?? store2.prevState;
|
||||
store2.prevState = prevState;
|
||||
__notifyListeners(store2);
|
||||
}
|
||||
for (const store2 of stores) {
|
||||
const derivedVals = __storeToDerived.get(store2);
|
||||
if (!derivedVals) continue;
|
||||
__depsThatHaveWrittenThisTick.current.push(store2);
|
||||
__flush_internals(derivedVals);
|
||||
}
|
||||
for (const store2 of stores) {
|
||||
const derivedVals = __storeToDerived.get(store2);
|
||||
if (!derivedVals) continue;
|
||||
for (const derived2 of derivedVals) {
|
||||
__notifyDerivedListeners(derived2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
__isFlushing = false;
|
||||
__depsThatHaveWrittenThisTick.current = [];
|
||||
__initialBatchValues.clear();
|
||||
}
|
||||
}
|
||||
function batch(fn) {
|
||||
__batchDepth++;
|
||||
try {
|
||||
fn();
|
||||
} finally {
|
||||
__batchDepth--;
|
||||
if (__batchDepth === 0) {
|
||||
const pendingUpdateToFlush = Array.from(__pendingUpdates)[0];
|
||||
if (pendingUpdateToFlush) {
|
||||
__flush(pendingUpdateToFlush);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.__depsThatHaveWrittenThisTick = __depsThatHaveWrittenThisTick;
|
||||
exports.__derivedToStore = __derivedToStore;
|
||||
exports.__flush = __flush;
|
||||
exports.__storeToDerived = __storeToDerived;
|
||||
exports.batch = batch;
|
||||
//# sourceMappingURL=scheduler.cjs.map
|
||||
@@ -0,0 +1,257 @@
|
||||
var util = require('util')
|
||||
var bl = require('bl')
|
||||
var headers = require('./headers')
|
||||
|
||||
var Writable = require('readable-stream').Writable
|
||||
var PassThrough = require('readable-stream').PassThrough
|
||||
|
||||
var noop = function () {}
|
||||
|
||||
var overflow = function (size) {
|
||||
size &= 511
|
||||
return size && 512 - size
|
||||
}
|
||||
|
||||
var emptyStream = function (self, offset) {
|
||||
var s = new Source(self, offset)
|
||||
s.end()
|
||||
return s
|
||||
}
|
||||
|
||||
var mixinPax = function (header, pax) {
|
||||
if (pax.path) header.name = pax.path
|
||||
if (pax.linkpath) header.linkname = pax.linkpath
|
||||
if (pax.size) header.size = parseInt(pax.size, 10)
|
||||
header.pax = pax
|
||||
return header
|
||||
}
|
||||
|
||||
var Source = function (self, offset) {
|
||||
this._parent = self
|
||||
this.offset = offset
|
||||
PassThrough.call(this, { autoDestroy: false })
|
||||
}
|
||||
|
||||
util.inherits(Source, PassThrough)
|
||||
|
||||
Source.prototype.destroy = function (err) {
|
||||
this._parent.destroy(err)
|
||||
}
|
||||
|
||||
var Extract = function (opts) {
|
||||
if (!(this instanceof Extract)) return new Extract(opts)
|
||||
Writable.call(this, opts)
|
||||
|
||||
opts = opts || {}
|
||||
|
||||
this._offset = 0
|
||||
this._buffer = bl()
|
||||
this._missing = 0
|
||||
this._partial = false
|
||||
this._onparse = noop
|
||||
this._header = null
|
||||
this._stream = null
|
||||
this._overflow = null
|
||||
this._cb = null
|
||||
this._locked = false
|
||||
this._destroyed = false
|
||||
this._pax = null
|
||||
this._paxGlobal = null
|
||||
this._gnuLongPath = null
|
||||
this._gnuLongLinkPath = null
|
||||
|
||||
var self = this
|
||||
var b = self._buffer
|
||||
|
||||
var oncontinue = function () {
|
||||
self._continue()
|
||||
}
|
||||
|
||||
var onunlock = function (err) {
|
||||
self._locked = false
|
||||
if (err) return self.destroy(err)
|
||||
if (!self._stream) oncontinue()
|
||||
}
|
||||
|
||||
var onstreamend = function () {
|
||||
self._stream = null
|
||||
var drain = overflow(self._header.size)
|
||||
if (drain) self._parse(drain, ondrain)
|
||||
else self._parse(512, onheader)
|
||||
if (!self._locked) oncontinue()
|
||||
}
|
||||
|
||||
var ondrain = function () {
|
||||
self._buffer.consume(overflow(self._header.size))
|
||||
self._parse(512, onheader)
|
||||
oncontinue()
|
||||
}
|
||||
|
||||
var onpaxglobalheader = function () {
|
||||
var size = self._header.size
|
||||
self._paxGlobal = headers.decodePax(b.slice(0, size))
|
||||
b.consume(size)
|
||||
onstreamend()
|
||||
}
|
||||
|
||||
var onpaxheader = function () {
|
||||
var size = self._header.size
|
||||
self._pax = headers.decodePax(b.slice(0, size))
|
||||
if (self._paxGlobal) self._pax = Object.assign({}, self._paxGlobal, self._pax)
|
||||
b.consume(size)
|
||||
onstreamend()
|
||||
}
|
||||
|
||||
var ongnulongpath = function () {
|
||||
var size = self._header.size
|
||||
this._gnuLongPath = headers.decodeLongPath(b.slice(0, size), opts.filenameEncoding)
|
||||
b.consume(size)
|
||||
onstreamend()
|
||||
}
|
||||
|
||||
var ongnulonglinkpath = function () {
|
||||
var size = self._header.size
|
||||
this._gnuLongLinkPath = headers.decodeLongPath(b.slice(0, size), opts.filenameEncoding)
|
||||
b.consume(size)
|
||||
onstreamend()
|
||||
}
|
||||
|
||||
var onheader = function () {
|
||||
var offset = self._offset
|
||||
var header
|
||||
try {
|
||||
header = self._header = headers.decode(b.slice(0, 512), opts.filenameEncoding, opts.allowUnknownFormat)
|
||||
} catch (err) {
|
||||
self.emit('error', err)
|
||||
}
|
||||
b.consume(512)
|
||||
|
||||
if (!header) {
|
||||
self._parse(512, onheader)
|
||||
oncontinue()
|
||||
return
|
||||
}
|
||||
if (header.type === 'gnu-long-path') {
|
||||
self._parse(header.size, ongnulongpath)
|
||||
oncontinue()
|
||||
return
|
||||
}
|
||||
if (header.type === 'gnu-long-link-path') {
|
||||
self._parse(header.size, ongnulonglinkpath)
|
||||
oncontinue()
|
||||
return
|
||||
}
|
||||
if (header.type === 'pax-global-header') {
|
||||
self._parse(header.size, onpaxglobalheader)
|
||||
oncontinue()
|
||||
return
|
||||
}
|
||||
if (header.type === 'pax-header') {
|
||||
self._parse(header.size, onpaxheader)
|
||||
oncontinue()
|
||||
return
|
||||
}
|
||||
|
||||
if (self._gnuLongPath) {
|
||||
header.name = self._gnuLongPath
|
||||
self._gnuLongPath = null
|
||||
}
|
||||
|
||||
if (self._gnuLongLinkPath) {
|
||||
header.linkname = self._gnuLongLinkPath
|
||||
self._gnuLongLinkPath = null
|
||||
}
|
||||
|
||||
if (self._pax) {
|
||||
self._header = header = mixinPax(header, self._pax)
|
||||
self._pax = null
|
||||
}
|
||||
|
||||
self._locked = true
|
||||
|
||||
if (!header.size || header.type === 'directory') {
|
||||
self._parse(512, onheader)
|
||||
self.emit('entry', header, emptyStream(self, offset), onunlock)
|
||||
return
|
||||
}
|
||||
|
||||
self._stream = new Source(self, offset)
|
||||
|
||||
self.emit('entry', header, self._stream, onunlock)
|
||||
self._parse(header.size, onstreamend)
|
||||
oncontinue()
|
||||
}
|
||||
|
||||
this._onheader = onheader
|
||||
this._parse(512, onheader)
|
||||
}
|
||||
|
||||
util.inherits(Extract, Writable)
|
||||
|
||||
Extract.prototype.destroy = function (err) {
|
||||
if (this._destroyed) return
|
||||
this._destroyed = true
|
||||
|
||||
if (err) this.emit('error', err)
|
||||
this.emit('close')
|
||||
if (this._stream) this._stream.emit('close')
|
||||
}
|
||||
|
||||
Extract.prototype._parse = function (size, onparse) {
|
||||
if (this._destroyed) return
|
||||
this._offset += size
|
||||
this._missing = size
|
||||
if (onparse === this._onheader) this._partial = false
|
||||
this._onparse = onparse
|
||||
}
|
||||
|
||||
Extract.prototype._continue = function () {
|
||||
if (this._destroyed) return
|
||||
var cb = this._cb
|
||||
this._cb = noop
|
||||
if (this._overflow) this._write(this._overflow, undefined, cb)
|
||||
else cb()
|
||||
}
|
||||
|
||||
Extract.prototype._write = function (data, enc, cb) {
|
||||
if (this._destroyed) return
|
||||
|
||||
var s = this._stream
|
||||
var b = this._buffer
|
||||
var missing = this._missing
|
||||
if (data.length) this._partial = true
|
||||
|
||||
// we do not reach end-of-chunk now. just forward it
|
||||
|
||||
if (data.length < missing) {
|
||||
this._missing -= data.length
|
||||
this._overflow = null
|
||||
if (s) return s.write(data, cb)
|
||||
b.append(data)
|
||||
return cb()
|
||||
}
|
||||
|
||||
// end-of-chunk. the parser should call cb.
|
||||
|
||||
this._cb = cb
|
||||
this._missing = 0
|
||||
|
||||
var overflow = null
|
||||
if (data.length > missing) {
|
||||
overflow = data.slice(missing)
|
||||
data = data.slice(0, missing)
|
||||
}
|
||||
|
||||
if (s) s.end(data)
|
||||
else b.append(data)
|
||||
|
||||
this._overflow = overflow
|
||||
this._onparse()
|
||||
}
|
||||
|
||||
Extract.prototype._final = function (cb) {
|
||||
if (this._partial) return this.destroy(new Error('Unexpected end of data'))
|
||||
cb()
|
||||
}
|
||||
|
||||
module.exports = Extract
|
||||
@@ -0,0 +1,25 @@
|
||||
BSD 2-Clause License
|
||||
|
||||
Copyright (c) Open JS Foundation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"2":"C L M G N O P","33":"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"},C:{"2":"0 1 2 3 4 5 6 7 8 9 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC"},D:{"2":"J PB K D E F A B C L M G N","33":"0 1 2 3 4 5 6 7 8 9 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":"A B C L M G TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB sC SC","33":"K D E F tC uC vC wC"},F:{"2":"F B C 4C 5C 6C 7C FC kC 8C GC","33":"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"},G:{"1":"GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"SC 9C lC","33":"E AD BD CD DD ED FD"},H:{"2":"WD"},I:{"2":"LC J XD YD ZD aD lC","33":"I bD cD"},J:{"2":"D A"},K:{"2":"A B C FC kC GC","33":"H"},L:{"33":"I"},M:{"2":"EC"},N:{"2":"A B"},O:{"33":"HC"},P:{"33":"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:{"33":"oD"},R:{"33":"pD"},S:{"2":"qD rD"}},B:4,C:"CSS Cross-Fade Function",D:true};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,206 @@
|
||||
import { CssSyntaxError, ProcessOptions } from './postcss.js'
|
||||
import PreviousMap from './previous-map.js'
|
||||
|
||||
declare namespace Input {
|
||||
export interface FilePosition {
|
||||
/**
|
||||
* Column of inclusive start position in source file.
|
||||
*/
|
||||
column: number
|
||||
|
||||
/**
|
||||
* Column of exclusive end position in source file.
|
||||
*/
|
||||
endColumn?: number
|
||||
|
||||
/**
|
||||
* Line of exclusive end position in source file.
|
||||
*/
|
||||
endLine?: number
|
||||
|
||||
/**
|
||||
* Absolute path to the source file.
|
||||
*/
|
||||
file?: string
|
||||
|
||||
/**
|
||||
* Line of inclusive start position in source file.
|
||||
*/
|
||||
line: number
|
||||
|
||||
/**
|
||||
* Source code.
|
||||
*/
|
||||
source?: string
|
||||
|
||||
/**
|
||||
* URL for the source file.
|
||||
*/
|
||||
url: string
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
export { Input_ as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the source CSS.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse(css, { from: file })
|
||||
* const input = root.source.input
|
||||
* ```
|
||||
*/
|
||||
declare class Input_ {
|
||||
/**
|
||||
* Input CSS source.
|
||||
*
|
||||
* ```js
|
||||
* const input = postcss.parse('a{}', { from: file }).input
|
||||
* input.css //=> "a{}"
|
||||
* ```
|
||||
*/
|
||||
css: string
|
||||
|
||||
/**
|
||||
* Input source with support for non-CSS documents.
|
||||
*
|
||||
* ```js
|
||||
* const input = postcss.parse('a{}', { from: file, document: '<style>a {}</style>' }).input
|
||||
* input.document //=> "<style>a {}</style>"
|
||||
* input.css //=> "a{}"
|
||||
* ```
|
||||
*/
|
||||
document: string
|
||||
|
||||
/**
|
||||
* The absolute path to the CSS source file defined
|
||||
* with the `from` option.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse(css, { from: 'a.css' })
|
||||
* root.source.input.file //=> '/home/ai/a.css'
|
||||
* ```
|
||||
*/
|
||||
file?: string
|
||||
|
||||
/**
|
||||
* The flag to indicate whether or not the source code has Unicode BOM.
|
||||
*/
|
||||
hasBOM: boolean
|
||||
|
||||
/**
|
||||
* The unique ID of the CSS source. It will be created if `from` option
|
||||
* is not provided (because PostCSS does not know the file path).
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse(css)
|
||||
* root.source.input.file //=> undefined
|
||||
* root.source.input.id //=> "<input css 8LZeVF>"
|
||||
* ```
|
||||
*/
|
||||
id?: string
|
||||
|
||||
/**
|
||||
* The input source map passed from a compilation step before PostCSS
|
||||
* (for example, from Sass compiler).
|
||||
*
|
||||
* ```js
|
||||
* root.source.input.map.consumer().sources //=> ['a.sass']
|
||||
* ```
|
||||
*/
|
||||
map: PreviousMap
|
||||
|
||||
/**
|
||||
* The CSS source identifier. Contains `Input#file` if the user
|
||||
* set the `from` option, or `Input#id` if they did not.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse(css, { from: 'a.css' })
|
||||
* root.source.input.from //=> "/home/ai/a.css"
|
||||
*
|
||||
* const root = postcss.parse(css)
|
||||
* root.source.input.from //=> "<input css 1>"
|
||||
* ```
|
||||
*/
|
||||
get from(): string
|
||||
|
||||
/**
|
||||
* @param css Input CSS source.
|
||||
* @param opts Process options.
|
||||
*/
|
||||
constructor(css: string, opts?: ProcessOptions)
|
||||
|
||||
error(
|
||||
message: string,
|
||||
start:
|
||||
| {
|
||||
column: number
|
||||
line: number
|
||||
}
|
||||
| {
|
||||
offset: number
|
||||
},
|
||||
end:
|
||||
| {
|
||||
column: number
|
||||
line: number
|
||||
}
|
||||
| {
|
||||
offset: number
|
||||
},
|
||||
opts?: { plugin?: CssSyntaxError['plugin'] }
|
||||
): CssSyntaxError
|
||||
/**
|
||||
* Returns `CssSyntaxError` with information about the error and its position.
|
||||
*/
|
||||
error(
|
||||
message: string,
|
||||
line: number,
|
||||
column: number,
|
||||
opts?: { plugin?: CssSyntaxError['plugin'] }
|
||||
): CssSyntaxError
|
||||
error(
|
||||
message: string,
|
||||
offset: number,
|
||||
opts?: { plugin?: CssSyntaxError['plugin'] }
|
||||
): CssSyntaxError
|
||||
/**
|
||||
* Converts source offset to line and column.
|
||||
*
|
||||
* @param offset Source offset.
|
||||
*/
|
||||
fromOffset(offset: number): { col: number; line: number } | null
|
||||
/**
|
||||
* Reads the input source map and returns a symbol position
|
||||
* in the input source (e.g., in a Sass file that was compiled
|
||||
* to CSS before being passed to PostCSS). Optionally takes an
|
||||
* end position, exclusive.
|
||||
*
|
||||
* ```js
|
||||
* root.source.input.origin(1, 1) //=> { file: 'a.css', line: 3, column: 1 }
|
||||
* root.source.input.origin(1, 1, 1, 4)
|
||||
* //=> { file: 'a.css', line: 3, column: 1, endLine: 3, endColumn: 4 }
|
||||
* ```
|
||||
*
|
||||
* @param line Line for inclusive start position in input CSS.
|
||||
* @param column Column for inclusive start position in input CSS.
|
||||
* @param endLine Line for exclusive end position in input CSS.
|
||||
* @param endColumn Column for exclusive end position in input CSS.
|
||||
*
|
||||
* @return Position in input source.
|
||||
*/
|
||||
origin(
|
||||
line: number,
|
||||
column: number,
|
||||
endLine?: number,
|
||||
endColumn?: number
|
||||
): false | Input.FilePosition
|
||||
|
||||
/** Converts this to a JSON-friendly object representation. */
|
||||
toJSON(): object
|
||||
}
|
||||
|
||||
declare class Input extends Input_ {}
|
||||
|
||||
export = Input
|
||||
@@ -0,0 +1,67 @@
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
/*
|
||||
* Copyright 2011 Mozilla Foundation and contributors
|
||||
* Licensed under the New BSD license. See LICENSE or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
|
||||
|
||||
/**
|
||||
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
|
||||
*/
|
||||
exports.encode = function (number) {
|
||||
if (0 <= number && number < intToCharMap.length) {
|
||||
return intToCharMap[number];
|
||||
}
|
||||
throw new TypeError("Must be between 0 and 63: " + number);
|
||||
};
|
||||
|
||||
/**
|
||||
* Decode a single base 64 character code digit to an integer. Returns -1 on
|
||||
* failure.
|
||||
*/
|
||||
exports.decode = function (charCode) {
|
||||
var bigA = 65; // 'A'
|
||||
var bigZ = 90; // 'Z'
|
||||
|
||||
var littleA = 97; // 'a'
|
||||
var littleZ = 122; // 'z'
|
||||
|
||||
var zero = 48; // '0'
|
||||
var nine = 57; // '9'
|
||||
|
||||
var plus = 43; // '+'
|
||||
var slash = 47; // '/'
|
||||
|
||||
var littleOffset = 26;
|
||||
var numberOffset = 52;
|
||||
|
||||
// 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
if (bigA <= charCode && charCode <= bigZ) {
|
||||
return (charCode - bigA);
|
||||
}
|
||||
|
||||
// 26 - 51: abcdefghijklmnopqrstuvwxyz
|
||||
if (littleA <= charCode && charCode <= littleZ) {
|
||||
return (charCode - littleA + littleOffset);
|
||||
}
|
||||
|
||||
// 52 - 61: 0123456789
|
||||
if (zero <= charCode && charCode <= nine) {
|
||||
return (charCode - zero + numberOffset);
|
||||
}
|
||||
|
||||
// 62: +
|
||||
if (charCode == plus) {
|
||||
return 62;
|
||||
}
|
||||
|
||||
// 63: /
|
||||
if (charCode == slash) {
|
||||
return 63;
|
||||
}
|
||||
|
||||
// Invalid base64 digit.
|
||||
return -1;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_index","require","_skip","Symbol","_stop","traverseFast","node","enter","opts","keys","VISITOR_KEYS","type","ret","undefined","key","subNode","Array","isArray","skip","stop"],"sources":["../../src/traverse/traverseFast.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"../definitions/index.ts\";\nimport type * as t from \"../index.ts\";\n\nconst _skip = Symbol();\nconst _stop = Symbol();\n\n/**\n * A prefix AST traversal implementation meant for simple searching and processing.\n * @param enter The callback can return `traverseFast.skip` to skip the subtree of the current node, or `traverseFast.stop` to stop the traversal.\n * @returns `true` if the traversal was stopped by callback, `false` otherwise.\n */\nexport default function traverseFast<Options = object>(\n node: t.Node | null | undefined,\n enter: (\n node: t.Node,\n opts?: Options,\n ) => void | typeof traverseFast.skip | typeof traverseFast.stop,\n opts?: Options,\n): boolean {\n if (!node) return false;\n\n const keys = VISITOR_KEYS[node.type];\n if (!keys) return false;\n\n opts = opts || ({} as Options);\n const ret = enter(node, opts);\n if (ret !== undefined) {\n switch (ret) {\n case _skip:\n return false;\n case _stop:\n return true;\n }\n }\n\n for (const key of keys) {\n const subNode: t.Node | undefined | null =\n // @ts-expect-error key must present in node\n node[key];\n\n if (!subNode) continue;\n\n if (Array.isArray(subNode)) {\n for (const node of subNode) {\n if (traverseFast(node, enter, opts)) return true;\n }\n } else {\n if (traverseFast(subNode, enter, opts)) return true;\n }\n }\n return false;\n}\n\ntraverseFast.skip = _skip;\ntraverseFast.stop = _stop;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,MAAMC,KAAK,GAAGC,MAAM,CAAC,CAAC;AACtB,MAAMC,KAAK,GAAGD,MAAM,CAAC,CAAC;AAOP,SAASE,YAAYA,CAClCC,IAA+B,EAC/BC,KAG+D,EAC/DC,IAAc,EACL;EACT,IAAI,CAACF,IAAI,EAAE,OAAO,KAAK;EAEvB,MAAMG,IAAI,GAAGC,mBAAY,CAACJ,IAAI,CAACK,IAAI,CAAC;EACpC,IAAI,CAACF,IAAI,EAAE,OAAO,KAAK;EAEvBD,IAAI,GAAGA,IAAI,IAAK,CAAC,CAAa;EAC9B,MAAMI,GAAG,GAAGL,KAAK,CAACD,IAAI,EAAEE,IAAI,CAAC;EAC7B,IAAII,GAAG,KAAKC,SAAS,EAAE;IACrB,QAAQD,GAAG;MACT,KAAKV,KAAK;QACR,OAAO,KAAK;MACd,KAAKE,KAAK;QACR,OAAO,IAAI;IACf;EACF;EAEA,KAAK,MAAMU,GAAG,IAAIL,IAAI,EAAE;IACtB,MAAMM,OAAkC,GAEtCT,IAAI,CAACQ,GAAG,CAAC;IAEX,IAAI,CAACC,OAAO,EAAE;IAEd,IAAIC,KAAK,CAACC,OAAO,CAACF,OAAO,CAAC,EAAE;MAC1B,KAAK,MAAMT,IAAI,IAAIS,OAAO,EAAE;QAC1B,IAAIV,YAAY,CAACC,IAAI,EAAEC,KAAK,EAAEC,IAAI,CAAC,EAAE,OAAO,IAAI;MAClD;IACF,CAAC,MAAM;MACL,IAAIH,YAAY,CAACU,OAAO,EAAER,KAAK,EAAEC,IAAI,CAAC,EAAE,OAAO,IAAI;IACrD;EACF;EACA,OAAO,KAAK;AACd;AAEAH,YAAY,CAACa,IAAI,GAAGhB,KAAK;AACzBG,YAAY,CAACc,IAAI,GAAGf,KAAK","ignoreList":[]}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"52":0.00284,"56":0.00284,"78":0.00567,"91":0.00284,"115":0.18711,"123":0.00284,"126":0.00284,"127":0.00284,"128":0.03969,"129":0.00284,"134":0.00567,"135":0.17577,"136":0.55283,"137":0.00567,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 88 89 90 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 120 121 122 124 125 130 131 132 133 138 139 140 3.5 3.6"},D:{"11":0.00284,"34":0.00284,"38":0.00567,"44":0.00284,"47":0.00284,"49":0.00284,"58":0.25232,"64":0.00284,"65":0.01134,"67":0.00284,"68":0.00284,"69":0.00567,"71":0.00284,"72":0.00284,"73":0.01418,"75":0.00284,"79":0.02268,"80":0.01701,"81":0.00284,"83":0.01985,"84":0.00567,"86":0.00284,"87":0.01985,"88":0.00567,"89":0.00284,"90":0.00284,"91":0.00567,"92":0.00567,"93":0.00284,"94":0.01418,"95":0.00567,"96":0.00567,"97":0.00284,"98":0.0482,"99":0.00284,"100":0.00567,"101":0.00567,"102":0.00284,"103":0.01701,"104":0.00284,"105":0.00284,"106":0.00851,"107":0.00851,"108":0.02552,"109":0.94122,"110":0.00851,"111":0.02268,"112":0.00851,"113":0.00284,"114":0.02835,"115":0.00284,"116":0.08789,"117":0.00284,"118":0.00284,"119":0.02268,"120":0.03969,"121":0.01134,"122":0.05103,"123":0.01134,"124":0.04253,"125":0.10773,"126":0.03969,"127":0.02268,"128":0.05103,"129":0.02268,"130":0.03119,"131":0.26649,"132":0.2268,"133":4.86203,"134":9.56246,"135":0.01701,"136":0.01701,_:"4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 35 36 37 39 40 41 42 43 45 46 48 50 51 52 53 54 55 56 57 59 60 61 62 63 66 70 74 76 77 78 85 137 138"},F:{"79":0.00567,"87":0.01418,"88":0.00567,"94":0.00567,"95":0.0567,"111":0.00567,"114":0.00284,"115":0.00284,"116":0.12474,"117":0.7853,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 85 86 89 90 91 92 93 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 112 113 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"18":0.00567,"84":0.00284,"89":0.00284,"90":0.00284,"92":0.02268,"100":0.00567,"109":0.01985,"114":0.03686,"119":0.00284,"122":0.00284,"123":0.00567,"125":0.00284,"126":0.00284,"127":0.00284,"128":0.00284,"129":0.00567,"130":0.01134,"131":0.03686,"132":0.04536,"133":0.83633,"134":1.81724,_:"12 13 14 15 16 17 79 80 81 83 85 86 87 88 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 110 111 112 113 115 116 117 118 120 121 124"},E:{"11":0.00284,"14":0.00851,_:"0 4 5 6 7 8 9 10 12 13 15 3.1 3.2 6.1 7.1 9.1 11.1 12.1 15.1","5.1":0.03402,"10.1":0.00284,"13.1":0.00851,"14.1":0.02268,"15.2-15.3":0.00851,"15.4":0.00284,"15.5":0.01134,"15.6":0.25515,"16.0":0.00567,"16.1":0.01134,"16.2":0.00567,"16.3":0.02552,"16.4":0.00284,"16.5":0.01418,"16.6":0.05954,"17.0":0.00567,"17.1":0.05387,"17.2":0.01701,"17.3":0.01418,"17.4":0.02835,"17.5":0.03969,"17.6":0.15593,"18.0":0.05103,"18.1":0.05103,"18.2":0.03969,"18.3":0.69741,"18.4":0.01134},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00301,"5.0-5.1":0,"6.0-6.1":0.00903,"7.0-7.1":0.00602,"8.1-8.4":0,"9.0-9.2":0.00451,"9.3":0.02107,"10.0-10.2":0.0015,"10.3":0.03461,"11.0-11.2":0.15952,"11.3-11.4":0.01053,"12.0-12.1":0.00602,"12.2-12.5":0.14898,"13.0-13.1":0.00301,"13.2":0.00451,"13.3":0.00602,"13.4-13.7":0.02107,"14.0-14.4":0.05267,"14.5-14.8":0.0632,"15.0-15.1":0.03461,"15.2-15.3":0.03461,"15.4":0.04214,"15.5":0.04816,"15.6-15.8":0.59291,"16.0":0.08427,"16.1":0.17306,"16.2":0.09029,"16.3":0.15651,"16.4":0.03461,"16.5":0.06471,"16.6-16.7":0.70277,"17.0":0.04214,"17.1":0.07524,"17.2":0.05718,"17.3":0.07976,"17.4":0.15952,"17.5":0.35515,"17.6-17.7":1.03083,"18.0":0.28893,"18.1":0.94505,"18.2":0.42287,"18.3":8.83804,"18.4":0.13092},P:{"4":0.10192,"20":0.02038,"21":0.07134,"22":0.16307,"23":0.14269,"24":0.15288,"25":0.27518,"26":0.36691,"27":4.93287,"5.0-5.4":0.01019,"6.2-6.4":0.01019,"7.2-7.4":0.15288,_:"8.2 10.1 12.0","9.2":0.04077,"11.1-11.2":0.03058,"13.0":0.03058,"14.0":0.03058,"15.0":0.01019,"16.0":0.02038,"17.0":0.06115,"18.0":0.01019,"19.0":0.02038},I:{"0":0.05721,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00002,"4.4":0,"4.4.3-4.4.4":0.00006},K:{"0":0.7596,_:"10 11 12 11.1 11.5 12.1"},A:{"9":0.00284,"11":0.01134,_:"6 7 8 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.13615},Q:{_:"14.9"},O:{"0":0.20781},H:{"0":0},L:{"0":52.81018}};
|
||||
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
var stream = require('stream');
|
||||
var util = require('util');
|
||||
var replace = require('./replace');
|
||||
|
||||
var jsonExtRe = /\.json$/;
|
||||
|
||||
module.exports = function(rootEnv) {
|
||||
rootEnv = rootEnv || process.env;
|
||||
return function (file, trOpts) {
|
||||
if (jsonExtRe.test(file)) {
|
||||
return stream.PassThrough();
|
||||
}
|
||||
var envs = trOpts ? [rootEnv, trOpts] : [rootEnv];
|
||||
return new LooseEnvify(envs);
|
||||
};
|
||||
};
|
||||
|
||||
function LooseEnvify(envs) {
|
||||
stream.Transform.call(this);
|
||||
this._data = '';
|
||||
this._envs = envs;
|
||||
}
|
||||
util.inherits(LooseEnvify, stream.Transform);
|
||||
|
||||
LooseEnvify.prototype._transform = function(buf, enc, cb) {
|
||||
this._data += buf;
|
||||
cb();
|
||||
};
|
||||
|
||||
LooseEnvify.prototype._flush = function(cb) {
|
||||
var replaced = replace(this._data, this._envs);
|
||||
this.push(replaced);
|
||||
cb();
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"49":0.00134,"95":0.00134,"115":0.07241,"128":0.01073,"133":0.00536,"135":0.08717,"136":0.45594,_:"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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 120 121 122 123 124 125 126 127 129 130 131 132 134 137 138 139 140 3.5 3.6"},D:{"40":0.00671,"41":0.00134,"43":0.00134,"46":0.00402,"50":0.00134,"54":0.00134,"56":0.00134,"58":0.02146,"59":0.00134,"64":0.01207,"68":0.00671,"70":0.00268,"75":0.00402,"79":0.00402,"84":0.00134,"87":0.00268,"88":0.00134,"89":0.01207,"93":0.00134,"94":0.00134,"97":0.00134,"98":0.00671,"104":0.00268,"106":0.00134,"107":0.00134,"109":0.51629,"110":0.00134,"111":0.00671,"114":0.00536,"116":0.01073,"117":0.00671,"118":0.00134,"119":0.00134,"120":0.00402,"121":0.01341,"122":0.00268,"123":0.00536,"124":0.01341,"125":0.06705,"126":0.01877,"127":0.00134,"128":0.01341,"129":0.00402,"130":0.00402,"131":0.10326,"132":0.11801,"133":2.37223,"134":3.60595,_:"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 42 44 45 47 48 49 51 52 53 55 57 60 61 62 63 65 66 67 69 71 72 73 74 76 77 78 80 81 83 85 86 90 91 92 95 96 99 100 101 102 103 105 108 112 113 115 135 136 137 138"},F:{"85":0.01073,"87":0.00134,"88":0.00402,"95":0.01341,"114":0.00536,"116":0.01207,"117":0.13678,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"18":0.03889,"85":0.00402,"89":0.00268,"90":0.00134,"92":0.02414,"100":0.00134,"107":0.00402,"109":0.02682,"110":0.00134,"111":0.00134,"114":0.00402,"120":0.01877,"121":0.00134,"122":0.00268,"124":0.00268,"125":0.02414,"126":0.00134,"128":0.01207,"129":0.00268,"130":0.01475,"131":0.01743,"132":0.04694,"133":0.5592,"134":0.70134,_:"12 13 14 15 16 17 79 80 81 83 84 86 87 88 91 93 94 95 96 97 98 99 101 102 103 104 105 106 108 112 113 115 116 117 118 119 123 127"},E:{"14":0.00671,_:"0 4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 14.1 15.1 15.2-15.3 15.4 15.5 16.0 16.2 16.3 16.4 16.5 17.0 17.1 17.2 17.3 18.0","13.1":0.00268,"15.6":0.02414,"16.1":0.00268,"16.6":0.00939,"17.4":0.01609,"17.5":0.00671,"17.6":0.02146,"18.1":0.00536,"18.2":0.00268,"18.3":0.07644,"18.4":0.00536},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00117,"5.0-5.1":0,"6.0-6.1":0.00352,"7.0-7.1":0.00235,"8.1-8.4":0,"9.0-9.2":0.00176,"9.3":0.00822,"10.0-10.2":0.00059,"10.3":0.0135,"11.0-11.2":0.06223,"11.3-11.4":0.00411,"12.0-12.1":0.00235,"12.2-12.5":0.05812,"13.0-13.1":0.00117,"13.2":0.00176,"13.3":0.00235,"13.4-13.7":0.00822,"14.0-14.4":0.02055,"14.5-14.8":0.02466,"15.0-15.1":0.0135,"15.2-15.3":0.0135,"15.4":0.01644,"15.5":0.01879,"15.6-15.8":0.23131,"16.0":0.03288,"16.1":0.06751,"16.2":0.03522,"16.3":0.06106,"16.4":0.0135,"16.5":0.02524,"16.6-16.7":0.27417,"17.0":0.01644,"17.1":0.02935,"17.2":0.02231,"17.3":0.03112,"17.4":0.06223,"17.5":0.13855,"17.6-17.7":0.40215,"18.0":0.11272,"18.1":0.36869,"18.2":0.16497,"18.3":3.44792,"18.4":0.05108},P:{"4":0.01012,"20":0.02023,"21":0.01012,"22":0.07081,"23":0.1315,"24":0.53612,"25":0.27312,"26":0.43496,"27":1.52743,_:"5.0-5.4 6.2-6.4 8.2 9.2 10.1 12.0 13.0 14.0 15.0 16.0 18.0","7.2-7.4":0.17196,"11.1-11.2":0.04046,"17.0":0.01012,"19.0":0.06069},I:{"0":0.00864,"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.00001},K:{"0":0.81395,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.00536,_:"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.02598},Q:{"14.9":0.00866},O:{"0":0.22513},H:{"0":0},L:{"0":80.10189}};
|
||||
@@ -0,0 +1,15 @@
|
||||
# Community Participation Guidelines
|
||||
|
||||
This repository is governed by Mozilla's code of conduct and etiquette guidelines.
|
||||
For more details, please read the
|
||||
[Mozilla Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/).
|
||||
|
||||
## How to Report
|
||||
For more information on how to report violations of the Community Participation Guidelines, please read our '[How to Report](https://www.mozilla.org/about/governance/policies/participation/reporting/)' page.
|
||||
|
||||
<!--
|
||||
## Project Specific Etiquette
|
||||
|
||||
In some cases, there will be additional project etiquette i.e.: (https://bugzilla.mozilla.org/page.cgi?id=etiquette.html).
|
||||
Please update for your project.
|
||||
-->
|
||||
@@ -0,0 +1,24 @@
|
||||
const createStoreImpl = (createState) => {
|
||||
let state;
|
||||
const listeners = /* @__PURE__ */ new Set();
|
||||
const setState = (partial, replace) => {
|
||||
const nextState = typeof partial === "function" ? partial(state) : partial;
|
||||
if (!Object.is(nextState, state)) {
|
||||
const previousState = state;
|
||||
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
||||
listeners.forEach((listener) => listener(state, previousState));
|
||||
}
|
||||
};
|
||||
const getState = () => state;
|
||||
const getInitialState = () => initialState;
|
||||
const subscribe = (listener) => {
|
||||
listeners.add(listener);
|
||||
return () => listeners.delete(listener);
|
||||
};
|
||||
const api = { setState, getState, getInitialState, subscribe };
|
||||
const initialState = state = createState(setState, getState, api);
|
||||
return api;
|
||||
};
|
||||
const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
||||
|
||||
export { createStore };
|
||||
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = is;
|
||||
var _shallowEqual = require("../utils/shallowEqual.js");
|
||||
var _isType = require("./isType.js");
|
||||
var _isPlaceholderType = require("./isPlaceholderType.js");
|
||||
var _index = require("../definitions/index.js");
|
||||
function is(type, node, opts) {
|
||||
if (!node) return false;
|
||||
const matches = (0, _isType.default)(node.type, type);
|
||||
if (!matches) {
|
||||
if (!opts && node.type === "Placeholder" && type in _index.FLIPPED_ALIAS_KEYS) {
|
||||
return (0, _isPlaceholderType.default)(node.expectedNode, type);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (opts === undefined) {
|
||||
return true;
|
||||
} else {
|
||||
return (0, _shallowEqual.default)(node, opts);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=is.js.map
|
||||
@@ -0,0 +1,581 @@
|
||||
import { Store } from '@tanstack/store';
|
||||
import { SearchParser, SearchSerializer } from './searchParams.cjs';
|
||||
import { AnyRedirect, ResolvedRedirect } from './redirect.cjs';
|
||||
import { HistoryLocation, HistoryState, ParsedHistoryState, RouterHistory } from '@tanstack/history';
|
||||
import { ControlledPromise, NoInfer, NonNullableUpdater, PickAsRequired, Updater } from './utils.cjs';
|
||||
import { ParsedLocation } from './location.cjs';
|
||||
import { DeferredPromiseState } from './defer.cjs';
|
||||
import { AnyContext, AnyRoute, AnyRouteWithContext, MakeRemountDepsOptionsUnion, RouteMask } from './route.cjs';
|
||||
import { FullSearchSchema, RouteById, RoutePaths, RoutesById, RoutesByPath } from './routeInfo.cjs';
|
||||
import { AnyRouteMatch, MakeRouteMatch, MakeRouteMatchUnion, MatchRouteOptions } from './Matches.cjs';
|
||||
import { BuildLocationFn, CommitLocationOptions, NavigateFn } from './RouterProvider.cjs';
|
||||
import { Manifest } from './manifest.cjs';
|
||||
import { StartSerializer } from './serializer.cjs';
|
||||
import { AnySchema } from './validators.cjs';
|
||||
import { NavigateOptions, ResolveRelativePath, ToOptions } from './link.cjs';
|
||||
import { NotFoundError } from './not-found.cjs';
|
||||
declare global {
|
||||
interface Window {
|
||||
__TSR_ROUTER__?: AnyRouter;
|
||||
}
|
||||
}
|
||||
export type ControllablePromise<T = any> = Promise<T> & {
|
||||
resolve: (value: T) => void;
|
||||
reject: (value?: any) => void;
|
||||
};
|
||||
export type InjectedHtmlEntry = Promise<string>;
|
||||
export interface Register {
|
||||
}
|
||||
export type RegisteredRouter = Register extends {
|
||||
router: infer TRouter extends AnyRouter;
|
||||
} ? TRouter : AnyRouter;
|
||||
export type DefaultRemountDepsFn<TRouteTree extends AnyRoute> = (opts: MakeRemountDepsOptionsUnion<TRouteTree>) => any;
|
||||
export interface DefaultRouterOptionsExtensions {
|
||||
}
|
||||
export interface RouterOptionsExtensions extends DefaultRouterOptionsExtensions {
|
||||
}
|
||||
export interface RouterOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean = false, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated extends Record<string, any> = Record<string, any>> extends RouterOptionsExtensions {
|
||||
/**
|
||||
* The history object that will be used to manage the browser history.
|
||||
*
|
||||
* If not provided, a new createBrowserHistory instance will be created and used.
|
||||
*
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#history-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/history-types)
|
||||
*/
|
||||
history?: TRouterHistory;
|
||||
/**
|
||||
* A function that will be used to stringify search params when generating links.
|
||||
*
|
||||
* @default defaultStringifySearch
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#stringifysearch-method)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)
|
||||
*/
|
||||
stringifySearch?: SearchSerializer;
|
||||
/**
|
||||
* A function that will be used to parse search params when parsing the current location.
|
||||
*
|
||||
* @default defaultParseSearch
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#parsesearch-method)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)
|
||||
*/
|
||||
parseSearch?: SearchParser;
|
||||
/**
|
||||
* If `false`, routes will not be preloaded by default in any way.
|
||||
*
|
||||
* If `'intent'`, routes will be preloaded by default when the user hovers over a link or a `touchstart` event is detected on a `<Link>`.
|
||||
*
|
||||
* If `'viewport'`, routes will be preloaded by default when they are within the viewport.
|
||||
*
|
||||
* @default false
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreload-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
|
||||
*/
|
||||
defaultPreload?: false | 'intent' | 'viewport' | 'render';
|
||||
/**
|
||||
* The delay in milliseconds that a route must be hovered over or touched before it is preloaded.
|
||||
*
|
||||
* @default 50
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloaddelay-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading#preload-delay)
|
||||
*/
|
||||
defaultPreloadDelay?: number;
|
||||
/**
|
||||
* The default `pendingMs` a route should use if no pendingMs is provided.
|
||||
*
|
||||
* @default 1000
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingms-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)
|
||||
*/
|
||||
defaultPendingMs?: number;
|
||||
/**
|
||||
* The default `pendingMinMs` a route should use if no pendingMinMs is provided.
|
||||
*
|
||||
* @default 500
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingminms-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)
|
||||
*/
|
||||
defaultPendingMinMs?: number;
|
||||
/**
|
||||
* The default `staleTime` a route should use if no staleTime is provided. This is the time in milliseconds that a route will be considered fresh.
|
||||
*
|
||||
* @default 0
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstaletime-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)
|
||||
*/
|
||||
defaultStaleTime?: number;
|
||||
/**
|
||||
* The default `preloadStaleTime` a route should use if no preloadStaleTime is provided.
|
||||
*
|
||||
* @default 30_000 `(30 seconds)`
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadstaletime-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
|
||||
*/
|
||||
defaultPreloadStaleTime?: number;
|
||||
/**
|
||||
* The default `defaultPreloadGcTime` a route should use if no preloadGcTime is provided.
|
||||
*
|
||||
* @default 1_800_000 `(30 minutes)`
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadgctime-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)
|
||||
*/
|
||||
defaultPreloadGcTime?: number;
|
||||
/**
|
||||
* If `true`, route navigations will called using `document.startViewTransition()`.
|
||||
*
|
||||
* If the browser does not support this api, this option will be ignored.
|
||||
*
|
||||
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for more information on how this function works.
|
||||
*
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultviewtransition-property)
|
||||
*/
|
||||
defaultViewTransition?: boolean | ViewTransitionOptions;
|
||||
/**
|
||||
* The default `hashScrollIntoView` a route should use if no hashScrollIntoView is provided while navigating
|
||||
*
|
||||
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) for more information on `ScrollIntoViewOptions`.
|
||||
*
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulthashscrollintoview-property)
|
||||
*/
|
||||
defaultHashScrollIntoView?: boolean | ScrollIntoViewOptions;
|
||||
/**
|
||||
* @default 'fuzzy'
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundmode-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#the-notfoundmode-option)
|
||||
*/
|
||||
notFoundMode?: 'root' | 'fuzzy';
|
||||
/**
|
||||
* The default `gcTime` a route should use if no gcTime is provided.
|
||||
*
|
||||
* @default 1_800_000 `(30 minutes)`
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultgctime-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)
|
||||
*/
|
||||
defaultGcTime?: number;
|
||||
/**
|
||||
* If `true`, all routes will be matched as case-sensitive.
|
||||
*
|
||||
* @default false
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#casesensitive-property)
|
||||
*/
|
||||
caseSensitive?: boolean;
|
||||
/**
|
||||
*
|
||||
* The route tree that will be used to configure the router instance.
|
||||
*
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routetree-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/routing/route-trees)
|
||||
*/
|
||||
routeTree?: TRouteTree;
|
||||
/**
|
||||
* The basepath for then entire router. This is useful for mounting a router instance at a subpath.
|
||||
*
|
||||
* @default '/'
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#basepath-property)
|
||||
*/
|
||||
basepath?: string;
|
||||
/**
|
||||
* The root context that will be provided to all routes in the route tree.
|
||||
*
|
||||
* This can be used to provide a context to all routes in the tree without having to provide it to each route individually.
|
||||
*
|
||||
* Optional or required if the root route was created with [`createRootRouteWithContext()`](https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteWithContextFunction).
|
||||
*
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#context-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/router-context)
|
||||
*/
|
||||
context?: InferRouterContext<TRouteTree>;
|
||||
/**
|
||||
* A function that will be called when the router is dehydrated.
|
||||
*
|
||||
* The return value of this function will be serialized and stored in the router's dehydrated state.
|
||||
*
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#dehydrate-method)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
|
||||
*/
|
||||
dehydrate?: () => TDehydrated;
|
||||
/**
|
||||
* A function that will be called when the router is hydrated.
|
||||
*
|
||||
* The return value of this function will be serialized and stored in the router's dehydrated state.
|
||||
*
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#hydrate-method)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)
|
||||
*/
|
||||
hydrate?: (dehydrated: TDehydrated) => void;
|
||||
/**
|
||||
* An array of route masks that will be used to mask routes in the route tree.
|
||||
*
|
||||
* Route masking is when you display a route at a different path than the one it is configured to match, like a modal popup that when shared will unmask to the modal's content instead of the modal's context.
|
||||
*
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routemasks-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking)
|
||||
*/
|
||||
routeMasks?: Array<RouteMask<TRouteTree>>;
|
||||
/**
|
||||
* If `true`, route masks will, by default, be removed when the page is reloaded.
|
||||
*
|
||||
* This can be overridden on a per-mask basis by setting the `unmaskOnReload` option on the mask, or on a per-navigation basis by setting the `unmaskOnReload` option in the `Navigate` options.
|
||||
*
|
||||
* @default false
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#unmaskonreload-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking#unmasking-on-page-reload)
|
||||
*/
|
||||
unmaskOnReload?: boolean;
|
||||
/**
|
||||
* Use `notFoundComponent` instead.
|
||||
*
|
||||
* @deprecated
|
||||
* See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info.
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundroute-property)
|
||||
*/
|
||||
notFoundRoute?: AnyRoute;
|
||||
/**
|
||||
* Configures how trailing slashes are treated.
|
||||
*
|
||||
* - `'always'` will add a trailing slash if not present
|
||||
* - `'never'` will remove the trailing slash if present
|
||||
* - `'preserve'` will not modify the trailing slash.
|
||||
*
|
||||
* @default 'never'
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#trailingslash-property)
|
||||
*/
|
||||
trailingSlash?: TTrailingSlashOption;
|
||||
/**
|
||||
* While usually automatic, sometimes it can be useful to force the router into a server-side state, e.g. when using the router in a non-browser environment that has access to a global.document object.
|
||||
*
|
||||
* @default typeof document !== 'undefined'
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#isserver-property)
|
||||
*/
|
||||
isServer?: boolean;
|
||||
defaultSsr?: boolean;
|
||||
search?: {
|
||||
/**
|
||||
* Configures how unknown search params (= not returned by any `validateSearch`) are treated.
|
||||
*
|
||||
* @default false
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#search.strict-property)
|
||||
*/
|
||||
strict?: boolean;
|
||||
};
|
||||
/**
|
||||
* Configures whether structural sharing is enabled by default for fine-grained selectors.
|
||||
*
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstructuralsharing-property)
|
||||
*/
|
||||
defaultStructuralSharing?: TDefaultStructuralSharingOption;
|
||||
/**
|
||||
* Configures which URI characters are allowed in path params that would ordinarily be escaped by encodeURIComponent.
|
||||
*
|
||||
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#pathparamsallowedcharacters-property)
|
||||
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/path-params#allowed-characters)
|
||||
*/
|
||||
pathParamsAllowedCharacters?: Array<';' | ':' | '@' | '&' | '=' | '+' | '$' | ','>;
|
||||
defaultRemountDeps?: DefaultRemountDepsFn<TRouteTree>;
|
||||
/**
|
||||
* If `true`, scroll restoration will be enabled
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
scrollRestoration?: boolean;
|
||||
/**
|
||||
* A function that will be called to get the key for the scroll restoration cache.
|
||||
*
|
||||
* @default (location) => location.href
|
||||
*/
|
||||
getScrollRestorationKey?: (location: ParsedLocation) => string;
|
||||
/**
|
||||
* The default behavior for scroll restoration.
|
||||
*
|
||||
* @default 'auto'
|
||||
*/
|
||||
scrollRestorationBehavior?: ScrollBehavior;
|
||||
/**
|
||||
* An array of selectors that will be used to scroll to the top of the page in addition to `window`
|
||||
*
|
||||
* @default ['window']
|
||||
*/
|
||||
scrollToTopSelectors?: Array<string>;
|
||||
}
|
||||
export interface RouterState<in out TRouteTree extends AnyRoute = AnyRoute, in out TRouteMatch = MakeRouteMatchUnion> {
|
||||
status: 'pending' | 'idle';
|
||||
loadedAt: number;
|
||||
isLoading: boolean;
|
||||
isTransitioning: boolean;
|
||||
matches: Array<TRouteMatch>;
|
||||
pendingMatches?: Array<TRouteMatch>;
|
||||
cachedMatches: Array<TRouteMatch>;
|
||||
location: ParsedLocation<FullSearchSchema<TRouteTree>>;
|
||||
resolvedLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>;
|
||||
statusCode: number;
|
||||
redirect?: ResolvedRedirect;
|
||||
}
|
||||
export interface BuildNextOptions {
|
||||
to?: string | number | null;
|
||||
params?: true | Updater<unknown>;
|
||||
search?: true | Updater<unknown>;
|
||||
hash?: true | Updater<string>;
|
||||
state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>;
|
||||
mask?: {
|
||||
to?: string | number | null;
|
||||
params?: true | Updater<unknown>;
|
||||
search?: true | Updater<unknown>;
|
||||
hash?: true | Updater<string>;
|
||||
state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>;
|
||||
unmaskOnReload?: boolean;
|
||||
};
|
||||
from?: string;
|
||||
_fromLocation?: ParsedLocation;
|
||||
href?: string;
|
||||
}
|
||||
type NavigationEventInfo = {
|
||||
fromLocation?: ParsedLocation;
|
||||
toLocation: ParsedLocation;
|
||||
pathChanged: boolean;
|
||||
hrefChanged: boolean;
|
||||
hashChanged: boolean;
|
||||
};
|
||||
export type RouterEvents = {
|
||||
onBeforeNavigate: {
|
||||
type: 'onBeforeNavigate';
|
||||
} & NavigationEventInfo;
|
||||
onBeforeLoad: {
|
||||
type: 'onBeforeLoad';
|
||||
} & NavigationEventInfo;
|
||||
onLoad: {
|
||||
type: 'onLoad';
|
||||
} & NavigationEventInfo;
|
||||
onResolved: {
|
||||
type: 'onResolved';
|
||||
} & NavigationEventInfo;
|
||||
onBeforeRouteMount: {
|
||||
type: 'onBeforeRouteMount';
|
||||
} & NavigationEventInfo;
|
||||
onInjectedHtml: {
|
||||
type: 'onInjectedHtml';
|
||||
promise: Promise<string>;
|
||||
};
|
||||
onRendered: {
|
||||
type: 'onRendered';
|
||||
} & NavigationEventInfo;
|
||||
};
|
||||
export type RouterEvent = RouterEvents[keyof RouterEvents];
|
||||
export type ListenerFn<TEvent extends RouterEvent> = (event: TEvent) => void;
|
||||
export type RouterListener<TRouterEvent extends RouterEvent> = {
|
||||
eventType: TRouterEvent['type'];
|
||||
fn: ListenerFn<TRouterEvent>;
|
||||
};
|
||||
export interface MatchRoutesOpts {
|
||||
preload?: boolean;
|
||||
throwOnError?: boolean;
|
||||
_buildLocation?: boolean;
|
||||
dest?: BuildNextOptions;
|
||||
}
|
||||
export type InferRouterContext<TRouteTree extends AnyRoute> = TRouteTree['types']['routerContext'];
|
||||
export type RouterContextOptions<TRouteTree extends AnyRoute> = AnyContext extends InferRouterContext<TRouteTree> ? {
|
||||
context?: InferRouterContext<TRouteTree>;
|
||||
} : {
|
||||
context: InferRouterContext<TRouteTree>;
|
||||
};
|
||||
export type RouterConstructorOptions<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory, TDehydrated extends Record<string, any>> = Omit<RouterOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, 'context'> & RouterContextOptions<TRouteTree>;
|
||||
export interface RouterErrorSerializer<TSerializedError> {
|
||||
serialize: (err: unknown) => TSerializedError;
|
||||
deserialize: (err: TSerializedError) => unknown;
|
||||
}
|
||||
export interface MatchedRoutesResult {
|
||||
matchedRoutes: Array<AnyRoute>;
|
||||
routeParams: Record<string, string>;
|
||||
}
|
||||
export type PreloadRouteFn<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory> = <TFrom extends RoutePaths<TRouteTree> | string = string, TTo extends string | undefined = undefined, TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom, TMaskTo extends string = ''>(opts: NavigateOptions<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<Array<AnyRouteMatch> | undefined>;
|
||||
export type MatchRouteFn<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory> = <TFrom extends RoutePaths<TRouteTree> = '/', TTo extends string | undefined = undefined, TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>>(location: ToOptions<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>, TFrom, TTo>, opts?: MatchRouteOptions) => false | RouteById<TRouteTree, TResolved>['types']['allParams'];
|
||||
export type UpdateFn<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TDefaultStructuralSharingOption extends boolean, TRouterHistory extends RouterHistory, TDehydrated extends Record<string, any>> = (newOptions: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>) => void;
|
||||
export type InvalidateFn<TRouter extends AnyRouter> = (opts?: {
|
||||
filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean;
|
||||
sync?: boolean;
|
||||
}) => Promise<void>;
|
||||
export type ParseLocationFn<TRouteTree extends AnyRoute> = (previousLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>, locationToParse?: HistoryLocation) => ParsedLocation<FullSearchSchema<TRouteTree>>;
|
||||
export type GetMatchRoutesFn = (next: ParsedLocation, dest?: BuildNextOptions) => {
|
||||
matchedRoutes: Array<AnyRoute>;
|
||||
routeParams: Record<string, string>;
|
||||
foundRoute: AnyRoute | undefined;
|
||||
};
|
||||
export type EmitFn = (routerEvent: RouterEvent) => void;
|
||||
export type LoadFn = (opts?: {
|
||||
sync?: boolean;
|
||||
}) => Promise<void>;
|
||||
export type CommitLocationFn = ({ viewTransition, ignoreBlocker, ...next }: ParsedLocation & CommitLocationOptions) => Promise<void>;
|
||||
export type StartTransitionFn = (fn: () => void) => void;
|
||||
export type SubscribeFn = <TType extends keyof RouterEvents>(eventType: TType, fn: ListenerFn<RouterEvents[TType]>) => () => void;
|
||||
export interface MatchRoutesFn {
|
||||
(pathname: string, locationSearch: AnySchema, opts?: MatchRoutesOpts): Array<AnyRouteMatch>;
|
||||
(next: ParsedLocation, opts?: MatchRoutesOpts): Array<AnyRouteMatch>;
|
||||
(pathnameOrNext: string | ParsedLocation, locationSearchOrOpts?: AnySchema | MatchRoutesOpts, opts?: MatchRoutesOpts): Array<AnyRouteMatch>;
|
||||
}
|
||||
export type GetMatchFn = (matchId: string) => AnyRouteMatch | undefined;
|
||||
export type UpdateMatchFn = (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => AnyRouteMatch;
|
||||
export type LoadRouteChunkFn = (route: AnyRoute) => Promise<Array<void>>;
|
||||
export type ResolveRedirect = (err: AnyRedirect) => ResolvedRedirect;
|
||||
export type ClearCacheFn<TRouter extends AnyRouter> = (opts?: {
|
||||
filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean;
|
||||
}) => void;
|
||||
export interface ServerSrr {
|
||||
injectedHtml: Array<InjectedHtmlEntry>;
|
||||
injectHtml: (getHtml: () => string | Promise<string>) => Promise<void>;
|
||||
injectScript: (getScript: () => string | Promise<string>, opts?: {
|
||||
logScript?: boolean;
|
||||
}) => Promise<void>;
|
||||
streamValue: (key: string, value: any) => void;
|
||||
streamedKeys: Set<string>;
|
||||
onMatchSettled: (opts: {
|
||||
router: AnyRouter;
|
||||
match: AnyRouteMatch;
|
||||
}) => any;
|
||||
}
|
||||
export type AnyRouterWithContext<TContext> = RouterCore<AnyRouteWithContext<TContext>, any, any, any, any>;
|
||||
export type AnyRouter = RouterCore<any, any, any, any, any>;
|
||||
export interface ViewTransitionOptions {
|
||||
types: Array<string>;
|
||||
}
|
||||
export declare function defaultSerializeError(err: unknown): {
|
||||
name: string;
|
||||
message: string;
|
||||
} | {
|
||||
data: unknown;
|
||||
};
|
||||
export interface ExtractedBaseEntry {
|
||||
dataType: '__beforeLoadContext' | 'loaderData';
|
||||
type: string;
|
||||
path: Array<string>;
|
||||
id: number;
|
||||
matchIndex: number;
|
||||
}
|
||||
export interface ExtractedStream extends ExtractedBaseEntry {
|
||||
type: 'stream';
|
||||
streamState: StreamState;
|
||||
}
|
||||
export interface ExtractedPromise extends ExtractedBaseEntry {
|
||||
type: 'promise';
|
||||
promiseState: DeferredPromiseState<any>;
|
||||
}
|
||||
export type ExtractedEntry = ExtractedStream | ExtractedPromise;
|
||||
export type StreamState = {
|
||||
promises: Array<ControlledPromise<string | null>>;
|
||||
};
|
||||
export type TrailingSlashOption = 'always' | 'never' | 'preserve';
|
||||
export declare function getLocationChangeInfo(routerState: {
|
||||
resolvedLocation?: ParsedLocation;
|
||||
location: ParsedLocation;
|
||||
}): {
|
||||
fromLocation: ParsedLocation<{}> | undefined;
|
||||
toLocation: ParsedLocation<{}>;
|
||||
pathChanged: boolean;
|
||||
hrefChanged: boolean;
|
||||
hashChanged: boolean;
|
||||
};
|
||||
export type CreateRouterFn = <TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption = 'never', TDefaultStructuralSharingOption extends boolean = false, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated extends Record<string, any> = Record<string, any>>(options: undefined extends number ? 'strictNullChecks must be enabled in tsconfig.json' : RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>) => RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>;
|
||||
export declare class RouterCore<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption, in out TDefaultStructuralSharingOption extends boolean, in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record<string, any> = Record<string, any>> {
|
||||
tempLocationKey: string | undefined;
|
||||
resetNextScroll: boolean;
|
||||
shouldViewTransition?: boolean | ViewTransitionOptions;
|
||||
isViewTransitionTypesSupported?: boolean;
|
||||
subscribers: Set<RouterListener<RouterEvent>>;
|
||||
viewTransitionPromise?: ControlledPromise<true>;
|
||||
isScrollRestoring: boolean;
|
||||
isScrollRestorationSetup: boolean;
|
||||
__store: Store<RouterState<TRouteTree>>;
|
||||
options: PickAsRequired<RouterOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>, 'stringifySearch' | 'parseSearch' | 'context'>;
|
||||
history: TRouterHistory;
|
||||
latestLocation: ParsedLocation<FullSearchSchema<TRouteTree>>;
|
||||
basepath: string;
|
||||
routeTree: TRouteTree;
|
||||
routesById: RoutesById<TRouteTree>;
|
||||
routesByPath: RoutesByPath<TRouteTree>;
|
||||
flatRoutes: Array<AnyRoute>;
|
||||
isServer: boolean;
|
||||
pathParamsDecodeCharMap?: Map<string, string>;
|
||||
/**
|
||||
* @deprecated Use the `createRouter` function instead
|
||||
*/
|
||||
constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>);
|
||||
startTransition: StartTransitionFn;
|
||||
update: UpdateFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>;
|
||||
get state(): RouterState<TRouteTree, import('./Matches.cjs').RouteMatch<any, any, any, any, any, any, any>>;
|
||||
buildRouteTree: () => void;
|
||||
subscribe: SubscribeFn;
|
||||
emit: EmitFn;
|
||||
parseLocation: ParseLocationFn<TRouteTree>;
|
||||
resolvePathWithBase: (from: string, path: string) => string;
|
||||
get looseRoutesById(): Record<string, AnyRoute>;
|
||||
/**
|
||||
@deprecated use the following signature instead
|
||||
```ts
|
||||
matchRoutes (
|
||||
next: ParsedLocation,
|
||||
opts?: { preload?: boolean; throwOnError?: boolean },
|
||||
): Array<AnyRouteMatch>;
|
||||
```
|
||||
*/
|
||||
matchRoutes: MatchRoutesFn;
|
||||
private matchRoutesInternal;
|
||||
getMatchedRoutes: GetMatchRoutesFn;
|
||||
cancelMatch: (id: string) => void;
|
||||
cancelMatches: () => void;
|
||||
buildLocation: BuildLocationFn;
|
||||
commitLocationPromise: undefined | ControlledPromise<void>;
|
||||
commitLocation: CommitLocationFn;
|
||||
buildAndCommitLocation: ({ replace, resetScroll, hashScrollIntoView, viewTransition, ignoreBlocker, href, ...rest }?: BuildNextOptions & CommitLocationOptions) => Promise<void>;
|
||||
navigate: NavigateFn;
|
||||
latestLoadPromise: undefined | Promise<void>;
|
||||
load: LoadFn;
|
||||
startViewTransition: (fn: () => Promise<void>) => void;
|
||||
updateMatch: UpdateMatchFn;
|
||||
getMatch: GetMatchFn;
|
||||
loadMatches: ({ location, matches, preload: allPreload, onReady, updateMatch, sync, }: {
|
||||
location: ParsedLocation;
|
||||
matches: Array<AnyRouteMatch>;
|
||||
preload?: boolean;
|
||||
onReady?: () => Promise<void>;
|
||||
updateMatch?: (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void;
|
||||
getMatch?: (matchId: string) => AnyRouteMatch | undefined;
|
||||
sync?: boolean;
|
||||
}) => Promise<Array<MakeRouteMatch>>;
|
||||
invalidate: InvalidateFn<RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>>;
|
||||
resolveRedirect: (err: AnyRedirect) => ResolvedRedirect;
|
||||
clearCache: ClearCacheFn<this>;
|
||||
clearExpiredCache: () => void;
|
||||
loadRouteChunk: (route: AnyRoute) => Promise<void[]>;
|
||||
preloadRoute: PreloadRouteFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>;
|
||||
matchRoute: MatchRouteFn<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory>;
|
||||
ssr?: {
|
||||
manifest: Manifest | undefined;
|
||||
serializer: StartSerializer;
|
||||
};
|
||||
serverSsr?: {
|
||||
injectedHtml: Array<InjectedHtmlEntry>;
|
||||
injectHtml: (getHtml: () => string | Promise<string>) => Promise<void>;
|
||||
injectScript: (getScript: () => string | Promise<string>, opts?: {
|
||||
logScript?: boolean;
|
||||
}) => Promise<void>;
|
||||
streamValue: (key: string, value: any) => void;
|
||||
streamedKeys: Set<string>;
|
||||
onMatchSettled: (opts: {
|
||||
router: AnyRouter;
|
||||
match: AnyRouteMatch;
|
||||
}) => any;
|
||||
};
|
||||
clientSsr?: {
|
||||
getStreamedValue: <T>(key: string) => T | undefined;
|
||||
};
|
||||
_handleNotFound: (matches: Array<AnyRouteMatch>, err: NotFoundError, { updateMatch, }?: {
|
||||
updateMatch?: (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void;
|
||||
}) => void;
|
||||
hasNotFoundMatch: () => boolean;
|
||||
}
|
||||
export declare class SearchParamError extends Error {
|
||||
}
|
||||
export declare class PathParamError extends Error {
|
||||
}
|
||||
export declare function lazyFn<T extends Record<string, (...args: Array<any>) => any>, TKey extends keyof T = 'default'>(fn: () => Promise<T>, key?: TKey): (...args: Parameters<T[TKey]>) => Promise<Awaited<ReturnType<T[TKey]>>>;
|
||||
export declare function getInitialRouterState(location: ParsedLocation): RouterState<any>;
|
||||
export declare const componentTypes: readonly ["component", "errorComponent", "pendingComponent", "notFoundComponent"];
|
||||
export {};
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="64"
|
||||
height="64"
|
||||
viewBox="0 0 64 64">
|
||||
<path
|
||||
d="M 32.003143,1.4044602 57.432701,62.632577 6.5672991,62.627924 z"
|
||||
style="fill:#ffff00;fill-opacity:0.94117647;fill-rule:nonzero;stroke:#000000;stroke-width:1.00493038;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 408 B |
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","2":"K D E F mC"},B:{"1":"0 9 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M G N O P"},C:{"1":"0 9 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 qC rC","132":"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"},D:{"1":"0 7 8 9 RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"J","16":"2 3 4 5 6 PB K D E","132":"1 F A B C L M G N O P QB"},E:{"1":"C L M G FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB sC SC tC","132":"K D E F A B uC vC wC 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","2":"F B C 4C 5C 6C 7C FC kC 8C GC"},G:{"2":"BD CD","132":"E DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","514":"SC 9C lC AD"},H:{"2":"WD"},I:{"2":"XD YD ZD","260":"LC J aD lC","514":"I bD cD"},J:{"132":"A","260":"D"},K:{"2":"A B C FC kC GC","514":"H"},L:{"260":"I"},M:{"2":"EC"},N:{"514":"A","1028":"B"},O:{"2":"HC"},P:{"260":"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:{"260":"oD"},R:{"260":"pD"},S:{"1":"qD rD"}},B:1,C:"accept attribute for file input",D:true};
|
||||
@@ -0,0 +1,189 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.assumptionsNames = void 0;
|
||||
exports.checkNoUnwrappedItemOptionPairs = checkNoUnwrappedItemOptionPairs;
|
||||
exports.validate = validate;
|
||||
var _removed = require("./removed.js");
|
||||
var _optionAssertions = require("./option-assertions.js");
|
||||
var _configError = require("../../errors/config-error.js");
|
||||
const ROOT_VALIDATORS = {
|
||||
cwd: _optionAssertions.assertString,
|
||||
root: _optionAssertions.assertString,
|
||||
rootMode: _optionAssertions.assertRootMode,
|
||||
configFile: _optionAssertions.assertConfigFileSearch,
|
||||
caller: _optionAssertions.assertCallerMetadata,
|
||||
filename: _optionAssertions.assertString,
|
||||
filenameRelative: _optionAssertions.assertString,
|
||||
code: _optionAssertions.assertBoolean,
|
||||
ast: _optionAssertions.assertBoolean,
|
||||
cloneInputAst: _optionAssertions.assertBoolean,
|
||||
envName: _optionAssertions.assertString
|
||||
};
|
||||
const BABELRC_VALIDATORS = {
|
||||
babelrc: _optionAssertions.assertBoolean,
|
||||
babelrcRoots: _optionAssertions.assertBabelrcSearch
|
||||
};
|
||||
const NONPRESET_VALIDATORS = {
|
||||
extends: _optionAssertions.assertString,
|
||||
ignore: _optionAssertions.assertIgnoreList,
|
||||
only: _optionAssertions.assertIgnoreList,
|
||||
targets: _optionAssertions.assertTargets,
|
||||
browserslistConfigFile: _optionAssertions.assertConfigFileSearch,
|
||||
browserslistEnv: _optionAssertions.assertString
|
||||
};
|
||||
const COMMON_VALIDATORS = {
|
||||
inputSourceMap: _optionAssertions.assertInputSourceMap,
|
||||
presets: _optionAssertions.assertPluginList,
|
||||
plugins: _optionAssertions.assertPluginList,
|
||||
passPerPreset: _optionAssertions.assertBoolean,
|
||||
assumptions: _optionAssertions.assertAssumptions,
|
||||
env: assertEnvSet,
|
||||
overrides: assertOverridesList,
|
||||
test: _optionAssertions.assertConfigApplicableTest,
|
||||
include: _optionAssertions.assertConfigApplicableTest,
|
||||
exclude: _optionAssertions.assertConfigApplicableTest,
|
||||
retainLines: _optionAssertions.assertBoolean,
|
||||
comments: _optionAssertions.assertBoolean,
|
||||
shouldPrintComment: _optionAssertions.assertFunction,
|
||||
compact: _optionAssertions.assertCompact,
|
||||
minified: _optionAssertions.assertBoolean,
|
||||
auxiliaryCommentBefore: _optionAssertions.assertString,
|
||||
auxiliaryCommentAfter: _optionAssertions.assertString,
|
||||
sourceType: _optionAssertions.assertSourceType,
|
||||
wrapPluginVisitorMethod: _optionAssertions.assertFunction,
|
||||
highlightCode: _optionAssertions.assertBoolean,
|
||||
sourceMaps: _optionAssertions.assertSourceMaps,
|
||||
sourceMap: _optionAssertions.assertSourceMaps,
|
||||
sourceFileName: _optionAssertions.assertString,
|
||||
sourceRoot: _optionAssertions.assertString,
|
||||
parserOpts: _optionAssertions.assertObject,
|
||||
generatorOpts: _optionAssertions.assertObject
|
||||
};
|
||||
{
|
||||
Object.assign(COMMON_VALIDATORS, {
|
||||
getModuleId: _optionAssertions.assertFunction,
|
||||
moduleRoot: _optionAssertions.assertString,
|
||||
moduleIds: _optionAssertions.assertBoolean,
|
||||
moduleId: _optionAssertions.assertString
|
||||
});
|
||||
}
|
||||
const knownAssumptions = ["arrayLikeIsIterable", "constantReexports", "constantSuper", "enumerableModuleMeta", "ignoreFunctionLength", "ignoreToPrimitiveHint", "iterableIsArray", "mutableTemplateObject", "noClassCalls", "noDocumentAll", "noIncompleteNsImportDetection", "noNewArrows", "noUninitializedPrivateFieldAccess", "objectRestNoSymbols", "privateFieldsAsSymbols", "privateFieldsAsProperties", "pureGetters", "setClassMethods", "setComputedProperties", "setPublicClassFields", "setSpreadProperties", "skipForOfIteratorClosing", "superIsCallableConstructor"];
|
||||
const assumptionsNames = exports.assumptionsNames = new Set(knownAssumptions);
|
||||
function getSource(loc) {
|
||||
return loc.type === "root" ? loc.source : getSource(loc.parent);
|
||||
}
|
||||
function validate(type, opts, filename) {
|
||||
try {
|
||||
return validateNested({
|
||||
type: "root",
|
||||
source: type
|
||||
}, opts);
|
||||
} catch (error) {
|
||||
const configError = new _configError.default(error.message, filename);
|
||||
if (error.code) configError.code = error.code;
|
||||
throw configError;
|
||||
}
|
||||
}
|
||||
function validateNested(loc, opts) {
|
||||
const type = getSource(loc);
|
||||
assertNoDuplicateSourcemap(opts);
|
||||
Object.keys(opts).forEach(key => {
|
||||
const optLoc = {
|
||||
type: "option",
|
||||
name: key,
|
||||
parent: loc
|
||||
};
|
||||
if (type === "preset" && NONPRESET_VALIDATORS[key]) {
|
||||
throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is not allowed in preset options`);
|
||||
}
|
||||
if (type !== "arguments" && ROOT_VALIDATORS[key]) {
|
||||
throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is only allowed in root programmatic options`);
|
||||
}
|
||||
if (type !== "arguments" && type !== "configfile" && BABELRC_VALIDATORS[key]) {
|
||||
if (type === "babelrcfile" || type === "extendsfile") {
|
||||
throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is not allowed in .babelrc or "extends"ed files, only in root programmatic options, ` + `or babel.config.js/config file options`);
|
||||
}
|
||||
throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is only allowed in root programmatic options, or babel.config.js/config file options`);
|
||||
}
|
||||
const validator = COMMON_VALIDATORS[key] || NONPRESET_VALIDATORS[key] || BABELRC_VALIDATORS[key] || ROOT_VALIDATORS[key] || throwUnknownError;
|
||||
validator(optLoc, opts[key]);
|
||||
});
|
||||
return opts;
|
||||
}
|
||||
function throwUnknownError(loc) {
|
||||
const key = loc.name;
|
||||
if (_removed.default[key]) {
|
||||
const {
|
||||
message,
|
||||
version = 5
|
||||
} = _removed.default[key];
|
||||
throw new Error(`Using removed Babel ${version} option: ${(0, _optionAssertions.msg)(loc)} - ${message}`);
|
||||
} else {
|
||||
const unknownOptErr = new Error(`Unknown option: ${(0, _optionAssertions.msg)(loc)}. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.`);
|
||||
unknownOptErr.code = "BABEL_UNKNOWN_OPTION";
|
||||
throw unknownOptErr;
|
||||
}
|
||||
}
|
||||
function assertNoDuplicateSourcemap(opts) {
|
||||
if (hasOwnProperty.call(opts, "sourceMap") && hasOwnProperty.call(opts, "sourceMaps")) {
|
||||
throw new Error(".sourceMap is an alias for .sourceMaps, cannot use both");
|
||||
}
|
||||
}
|
||||
function assertEnvSet(loc, value) {
|
||||
if (loc.parent.type === "env") {
|
||||
throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside of another .env block`);
|
||||
}
|
||||
const parent = loc.parent;
|
||||
const obj = (0, _optionAssertions.assertObject)(loc, value);
|
||||
if (obj) {
|
||||
for (const envName of Object.keys(obj)) {
|
||||
const env = (0, _optionAssertions.assertObject)((0, _optionAssertions.access)(loc, envName), obj[envName]);
|
||||
if (!env) continue;
|
||||
const envLoc = {
|
||||
type: "env",
|
||||
name: envName,
|
||||
parent
|
||||
};
|
||||
validateNested(envLoc, env);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function assertOverridesList(loc, value) {
|
||||
if (loc.parent.type === "env") {
|
||||
throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside an .env block`);
|
||||
}
|
||||
if (loc.parent.type === "overrides") {
|
||||
throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside an .overrides block`);
|
||||
}
|
||||
const parent = loc.parent;
|
||||
const arr = (0, _optionAssertions.assertArray)(loc, value);
|
||||
if (arr) {
|
||||
for (const [index, item] of arr.entries()) {
|
||||
const objLoc = (0, _optionAssertions.access)(loc, index);
|
||||
const env = (0, _optionAssertions.assertObject)(objLoc, item);
|
||||
if (!env) throw new Error(`${(0, _optionAssertions.msg)(objLoc)} must be an object`);
|
||||
const overridesLoc = {
|
||||
type: "overrides",
|
||||
index,
|
||||
parent
|
||||
};
|
||||
validateNested(overridesLoc, env);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
function checkNoUnwrappedItemOptionPairs(items, index, type, e) {
|
||||
if (index === 0) return;
|
||||
const lastItem = items[index - 1];
|
||||
const thisItem = items[index];
|
||||
if (lastItem.file && lastItem.options === undefined && typeof thisItem.value === "object") {
|
||||
e.message += `\n- Maybe you meant to use\n` + `"${type}s": [\n ["${lastItem.file.request}", ${JSON.stringify(thisItem.value, undefined, 2)}]\n]\n` + `To be a valid ${type}, its name and options should be wrapped in a pair of brackets`;
|
||||
}
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=options.js.map
|
||||
@@ -0,0 +1,188 @@
|
||||
/**
|
||||
* @fileoverview Rule to define spacing before/after arrow function's arrow.
|
||||
* @author Jxck
|
||||
* @deprecated in ESLint v8.53.0
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: "arrow-spacing",
|
||||
url: "https://eslint.style/rules/js/arrow-spacing",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
type: "layout",
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Enforce consistent spacing before and after the arrow in arrow functions",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/arrow-spacing",
|
||||
},
|
||||
|
||||
fixable: "whitespace",
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
before: {
|
||||
type: "boolean",
|
||||
default: true,
|
||||
},
|
||||
after: {
|
||||
type: "boolean",
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
expectedBefore: "Missing space before =>.",
|
||||
unexpectedBefore: "Unexpected space before =>.",
|
||||
|
||||
expectedAfter: "Missing space after =>.",
|
||||
unexpectedAfter: "Unexpected space after =>.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
// merge rules with default
|
||||
const rule = Object.assign({}, context.options[0]);
|
||||
|
||||
rule.before = rule.before !== false;
|
||||
rule.after = rule.after !== false;
|
||||
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
/**
|
||||
* Get tokens of arrow(`=>`) and before/after arrow.
|
||||
* @param {ASTNode} node The arrow function node.
|
||||
* @returns {Object} Tokens of arrow and before/after arrow.
|
||||
*/
|
||||
function getTokens(node) {
|
||||
const arrow = sourceCode.getTokenBefore(
|
||||
node.body,
|
||||
astUtils.isArrowToken,
|
||||
);
|
||||
|
||||
return {
|
||||
before: sourceCode.getTokenBefore(arrow),
|
||||
arrow,
|
||||
after: sourceCode.getTokenAfter(arrow),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Count spaces before/after arrow(`=>`) token.
|
||||
* @param {Object} tokens Tokens before/after arrow.
|
||||
* @returns {Object} count of space before/after arrow.
|
||||
*/
|
||||
function countSpaces(tokens) {
|
||||
const before = tokens.arrow.range[0] - tokens.before.range[1];
|
||||
const after = tokens.after.range[0] - tokens.arrow.range[1];
|
||||
|
||||
return { before, after };
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether space(s) before after arrow(`=>`) is satisfy rule.
|
||||
* if before/after value is `true`, there should be space(s).
|
||||
* if before/after value is `false`, there should be no space.
|
||||
* @param {ASTNode} node The arrow function node.
|
||||
* @returns {void}
|
||||
*/
|
||||
function spaces(node) {
|
||||
const tokens = getTokens(node);
|
||||
const countSpace = countSpaces(tokens);
|
||||
|
||||
if (rule.before) {
|
||||
// should be space(s) before arrow
|
||||
if (countSpace.before === 0) {
|
||||
context.report({
|
||||
node: tokens.before,
|
||||
messageId: "expectedBefore",
|
||||
fix(fixer) {
|
||||
return fixer.insertTextBefore(tokens.arrow, " ");
|
||||
},
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// should be no space before arrow
|
||||
if (countSpace.before > 0) {
|
||||
context.report({
|
||||
node: tokens.before,
|
||||
messageId: "unexpectedBefore",
|
||||
fix(fixer) {
|
||||
return fixer.removeRange([
|
||||
tokens.before.range[1],
|
||||
tokens.arrow.range[0],
|
||||
]);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (rule.after) {
|
||||
// should be space(s) after arrow
|
||||
if (countSpace.after === 0) {
|
||||
context.report({
|
||||
node: tokens.after,
|
||||
messageId: "expectedAfter",
|
||||
fix(fixer) {
|
||||
return fixer.insertTextAfter(tokens.arrow, " ");
|
||||
},
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// should be no space after arrow
|
||||
if (countSpace.after > 0) {
|
||||
context.report({
|
||||
node: tokens.after,
|
||||
messageId: "unexpectedAfter",
|
||||
fix(fixer) {
|
||||
return fixer.removeRange([
|
||||
tokens.arrow.range[1],
|
||||
tokens.after.range[0],
|
||||
]);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
ArrowFunctionExpression: spaces,
|
||||
};
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user