docs: 仓库链接指向本镜像仓库
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s

This commit is contained in:
TanTan committed 2026-11-13 09:25:58 +08:00
1 parent f954252a34
commit e311ca3275
35554 files changed
+6229626 -4

No files matched your search

@@ -0,0 +1,17 @@
import {useLink as $298d61e98472621b$export$dcf14c9974fe2767} from "./useLink.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
export {$298d61e98472621b$export$dcf14c9974fe2767 as useLink};
//# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,uFAAuF;AACvF,gGAAgG;;;;;AASzF,SAAS,yCAAc,IAAiB;IAC7C,OAAO,0CAAW,MAAM,IAAI,CAAA,GAAA,2CAAgB;IAC5C,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI;IAC9C,OAAO,qCAAe,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW;AACzG;AAEA,SAAS,qCAAe,IAAY,EAAE,KAAa,EAAE,GAAW,EAAE,IAAY,EAAE,MAAc,EAAE,MAAc,EAAE,WAAmB;IACjI,sEAAsE;IACtE,gCAAgC;IAChC,IAAI,OAAO,IAAI;IACf,KAAK,WAAW,CAAC,MAAM,QAAQ,QAAQ;IACvC,KAAK,cAAc,CAAC,MAAM,QAAQ,GAAG;IACrC,OAAO,KAAK,OAAO;AACrB;AAEO,SAAS,0CAAkB,EAAU,EAAE,QAAgB;IAC5D,qBAAqB;IACrB,IAAI,aAAa,OACf,OAAO;IAGT,6DAA6D;IAC7D,IAAI,KAAK,KAAK,aAAa,CAAA,GAAA,0CAAe,KACxC,OAAO,IAAI,KAAK,IAAI,iBAAiB,KAA9B;IAGT,IAAI,QAAC,IAAI,SAAE,KAAK,OAAE,GAAG,QAAE,IAAI,UAAE,MAAM,UAAE,MAAM,EAAC,GAAG,uCAAiB,IAAI;IACpE,IAAI,MAAM,qCAAe,MAAM,OAAO,KAAK,MAAM,QAAQ,QAAQ;IACjE,OAAO,MAAM,KAAK,KAAK,CAAC,KAAK,QAAQ;AACvC;AAEA,MAAM,6CAAuB,IAAI;AAEjC,SAAS,uCAAiB,EAAU,EAAE,QAAgB;IACpD,IAAI,YAAY,2CAAqB,GAAG,CAAC;IACzC,IAAI,CAAC,WAAW;QACd,YAAY,IAAI,KAAK,cAAc,CAAC,SAAS;sBAC3C;YACA,QAAQ;YACR,KAAK;YACL,MAAM;YACN,OAAO;YACP,KAAK;YACL,MAAM;YACN,QAAQ;YACR,QAAQ;QACV;QAEA,2CAAqB,GAAG,CAAC,UAAU;IACrC;IAEA,IAAI,QAAQ,UAAU,aAAa,CAAC,IAAI,KAAK;IAC7C,IAAI,aAAuC,CAAC;IAC5C,KAAK,IAAI,QAAQ,MACf,IAAI,KAAK,IAAI,KAAK,WAChB,UAAU,CAAC,KAAK,IAAI,CAAC,GAAG,KAAK,KAAK;IAKtC,OAAO;QACL,0FAA0F;QAC1F,MAAM,WAAW,GAAG,KAAK,QAAQ,WAAW,GAAG,KAAK,MAAM,CAAC,WAAW,IAAI,GAAG,IAAI,CAAC,WAAW,IAAI;QACjG,OAAO,CAAC,WAAW,KAAK;QACxB,KAAK,CAAC,WAAW,GAAG;QACpB,MAAM,WAAW,IAAI,KAAK,OAAO,IAAI,CAAC,WAAW,IAAI;QACrD,QAAQ,CAAC,WAAW,MAAM;QAC1B,QAAQ,CAAC,WAAW,MAAM;IAC5B;AACF;AAEA,MAAM,kCAAY;AAEX,SAAS,0CAAkB,IAAsB,EAAE,QAAgB;IACxE,IAAI,KAAK,yCAAc;IACvB,IAAI,UAAU,KAAK,0CAAkB,KAAK,iCAAW;IACrD,IAAI,QAAQ,KAAK,0CAAkB,KAAK,iCAAW;IACnD,OAAO,wCAAkB,MAAM,UAAU,SAAS;AACpD;AAEA,SAAS,wCAAkB,IAAsB,EAAE,QAAgB,EAAE,OAAe,EAAE,KAAa;IACjG,IAAI,QAAQ,YAAY,QAAQ;QAAC;KAAQ,GAAG;QAAC;QAAS;KAAM;IAC5D,OAAO,MAAM,MAAM,CAAC,CAAA,WAAY,sCAAgB,MAAM,UAAU;AAClE;AAEA,SAAS,sCAAgB,IAAsB,EAAE,QAAgB,EAAE,QAAgB;IACjF,IAAI,QAAQ,uCAAiB,UAAU;IACvC,OAAO,KAAK,IAAI,KAAK,MAAM,IAAI,IAC1B,KAAK,KAAK,KAAK,MAAM,KAAK,IAC1B,KAAK,GAAG,KAAK,MAAM,GAAG,IACtB,KAAK,IAAI,KAAK,MAAM,IAAI,IACxB,KAAK,MAAM,KAAK,MAAM,MAAM,IAC5B,KAAK,MAAM,KAAK,MAAM,MAAM;AACnC;AAEO,SAAS,0CAAW,IAAqC,EAAE,QAAgB,EAAE,iBAAiC,YAAY;IAC/H,IAAI,WAAW,0CAAmB;IAElC,uDAAuD;IACvD,IAAI,aAAa,OACf,OAAO,yCAAc;IAGvB,uGAAuG;IACvG,IAAI,aAAa,CAAA,GAAA,0CAAe,OAAO,mBAAmB,cAAc;QACtE,WAAW,0CAAW,UAAU,IAAI,CAAA,GAAA,2CAAgB;QAEpD,+FAA+F;QAC/F,IAAI,OAAO,IAAI;QACf,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,SAAS,GAAG,EAAE,SAAS,IAAI;QACtD,KAAK,WAAW,CAAC,MAAM,SAAS,KAAK,GAAG,GAAG,SAAS,GAAG;QACvD,KAAK,QAAQ,CAAC,SAAS,IAAI,EAAE,SAAS,MAAM,EAAE,SAAS,MAAM,EAAE,SAAS,WAAW;QACnF,OAAO,KAAK,OAAO;IACrB;IAEA,IAAI,KAAK,yCAAc;IACvB,IAAI,eAAe,0CAAkB,KAAK,iCAAW;IACrD,IAAI,cAAc,0CAAkB,KAAK,iCAAW;IACpD,IAAI,QAAQ,wCAAkB,UAAU,UAAU,KAAK,cAAc,KAAK;IAE1E,IAAI,MAAM,MAAM,KAAK,GACnB,OAAO,KAAK,CAAC,EAAE;IAGjB,IAAI,MAAM,MAAM,GAAG,GACjB,OAAQ;QACN,2DAA2D;QAC3D,KAAK;QACL,KAAK;YACH,OAAO,KAAK,CAAC,EAAE;QACjB,KAAK;YACH,OAAO,KAAK,CAAC,MAAM,MAAM,GAAG,EAAE;QAChC,KAAK;YACH,MAAM,IAAI,WAAW;IACzB;IAGF,OAAQ;QACN,KAAK;YACH,OAAO,KAAK,GAAG,CAAC,KAAK,cAAc,KAAK;QAC1C,8DAA8D;QAC9D,KAAK;QACL,KAAK;YACH,OAAO,KAAK,GAAG,CAAC,KAAK,cAAc,KAAK;QAC1C,KAAK;YACH,MAAM,IAAI,WAAW;IACzB;AACF;AAEO,SAAS,0CAAO,QAAyC,EAAE,QAAgB,EAAE,iBAAiC,YAAY;IAC/H,OAAO,IAAI,KAAK,0CAAW,UAAU,UAAU;AACjD;AAKO,SAAS,0CAAa,EAAU,EAAE,QAAgB;IACvD,IAAI,SAAS,0CAAkB,IAAI;IACnC,IAAI,OAAO,IAAI,KAAK,KAAK;IACzB,IAAI,OAAO,KAAK,cAAc;IAC9B,IAAI,QAAQ,KAAK,WAAW,KAAK;IACjC,IAAI,MAAM,KAAK,UAAU;IACzB,IAAI,OAAO,KAAK,WAAW;IAC3B,IAAI,SAAS,KAAK,aAAa;IAC/B,IAAI,SAAS,KAAK,aAAa;IAC/B,IAAI,cAAc,KAAK,kBAAkB;IAEzC,OAAO,IAAI,CAAA,GAAA,uCAAY,EAAE,OAAO,IAAI,OAAO,MAAM,OAAO,IAAI,CAAC,OAAO,IAAI,MAAM,OAAO,KAAK,UAAU,QAAQ,MAAM,QAAQ,QAAQ;AACpI;AAKO,SAAS,0CAAS,IAAU,EAAE,QAAgB;IACnD,OAAO,0CAAa,KAAK,OAAO,IAAI;AACtC;AAEO,SAAS,0CAAgB,IAAU;IACxC,OAAO,0CAAS,MAAM,CAAA,GAAA,0CAAe;AACvC;AAGO,SAAS,0CAAe,QAAyB;IACtD,OAAO,IAAI,CAAA,GAAA,sCAAW,EAAE,SAAS,QAAQ,EAAE,SAAS,GAAG,EAAE,SAAS,IAAI,EAAE,SAAS,KAAK,EAAE,SAAS,GAAG;AACtG;AAEO,SAAS,0CAAa,IAAqB;IAChD,OAAO;QACL,KAAK,KAAK,GAAG;QACb,MAAM,KAAK,IAAI;QACf,OAAO,KAAK,KAAK;QACjB,KAAK,KAAK,GAAG;IACf;AACF;AAEO,SAAS,0CAAa,IAAa;IACxC,OAAO;QACL,MAAM,KAAK,IAAI;QACf,QAAQ,KAAK,MAAM;QACnB,QAAQ,KAAK,MAAM;QACnB,aAAa,KAAK,WAAW;IAC/B;AACF;AAMO,SAAS,0CAAmB,IAAqD,EAAE,IAAc;IACtG,IAAI,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,cAAc;IACpD,IAAI,cAAc,MACf,CAAA,QAAC,IAAI,UAAE,MAAM,UAAE,MAAM,eAAE,WAAW,EAAC,GAAG,IAAG;SACrC,IAAI,UAAU,QAAQ,CAAC,MAC5B,OAAO;IAGT,IAAI,MACD,CAAA,QAAC,IAAI,UAAE,MAAM,UAAE,MAAM,eAAE,WAAW,EAAC,GAAG,IAAG;IAG5C,OAAO,IAAI,CAAA,GAAA,0CAAe,EACxB,KAAK,QAAQ,EACb,KAAK,GAAG,EACR,KAAK,IAAI,EACT,KAAK,KAAK,EACV,KAAK,GAAG,EACR,MACA,QACA,QACA;AAEJ;AAGO,SAAS,0CAAO,QAA0C;IAC/D,OAAO,IAAI,CAAA,GAAA,8BAAG,EAAE,SAAS,IAAI,EAAE,SAAS,MAAM,EAAE,SAAS,MAAM,EAAE,SAAS,WAAW;AACvF;AAGO,SAAS,0CAAsC,IAAO,EAAE,QAAkB;IAC/E,IAAI,CAAA,GAAA,yCAAc,EAAE,KAAK,QAAQ,EAAE,WACjC,OAAO;IAGT,IAAI,eAAe,SAAS,aAAa,CAAC,KAAK,QAAQ,CAAC,WAAW,CAAC;IACpE,IAAI,OAAmB,KAAK,IAAI;IAChC,KAAK,QLine truncated
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"4 5 GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I","2":"1 2 3 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w","4162":"0 x y z"},C:{"1":"0 1 2 3 4 5 w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC","2":"6 7 8 9 xC TC J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB 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 UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC 0C 1C","194":"KC LC Q H R WC S T U V W X Y Z a b","257":"c d e f g h i j k l m n o p q r s t","2049":"u v"},D:{"1":"0 1 2 3 4 5 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 GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","2":"6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB 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 UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T"},E:{"1":"gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED","2":"J ZB K D E F A B C L M G 2C ZC 3C 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC","1796":"dC eC fC"},F:{"1":"0 1 2 3 4 5 EC FC GC HC IC JC KC LC Q H R WC 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":"6 7 8 9 F B C G N O P aB AB BB CB DB EB FB 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 FD GD HD ID NC uC JD OC"},G:{"1":"gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","2":"E ZC KD vC LD MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD","1281":"QC dC eC fC"},H:{"2":"hD"},I:{"1":"I","2":"TC J iD jD kD lD vC mD nD"},J:{"2":"D A"},K:{"1":"H","2":"A B C NC uC OC"},L:{"1":"I"},M:{"1":"MC"},N:{"2":"A B"},O:{"1":"PC"},P:{"1":"6 7 8 9 AB BB CB DB EB FB wD xD QC RC SC yD","2":"J oD pD qD rD sD aC tD uD vD"},Q:{"2":"zD"},R:{"1":"0D"},S:{"2":"1D 2D"}},B:6,C:"AVIF image format",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"ProviderBinding.js","sourceRoot":"","sources":["../../../../src/binding/models/ProviderBinding.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
export { _ as default } from "../esm/_unsupported_iterable_to_array.js";
@@ -0,0 +1,34 @@
import { TLSSocket, ConnectionOptions } from 'tls'
import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from 'net'
export default buildConnector
declare function buildConnector (options?: buildConnector.BuildOptions): buildConnector.connector
declare namespace buildConnector {
export type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & {
allowH2?: boolean;
maxCachedSessions?: number | null;
socketPath?: string | null;
timeout?: number | null;
port?: number;
keepAlive?: boolean | null;
keepAliveInitialDelay?: number | null;
}
export interface Options {
hostname: string
host?: string
protocol: string
port: string
servername?: string
localAddress?: string | null
httpSocket?: Socket
}
export type Callback = (...args: CallbackArgs) => void
type CallbackArgs = [null, Socket | TLSSocket] | [Error, null]
export interface connector {
(options: buildConnector.Options, callback: buildConnector.Callback): void
}
}
@@ -0,0 +1,624 @@
export default `flf2a. 6 5 15 0 10
slide.flf (C) 1994 by Victor Parada (vparada@inf.utfsm.cl) 94/08/18.
Looks nice in some kind of screens and paper.
Feel free to replace "#", "H" and "|" to some other chars.
Try option "-m -1" to disable smush and get clear fonts.
Latin fonts a' e' i' o' u' n~ and N~ replaces A" O" U" a" o" u" and B.
. $
.. $
.. $
.. $
. $
. $$
#| $
#| $
#| $
.. $
#| $
$$
#|#| $
#|#| $
# #. $
.. $
$
$$
#H H| $
##HHH|| $
#H H| $
##HHH|| $
#H H| $
$$
#| $
#HH|| $
##H|. $
.#H|| $
##HH| $
#| $$
## || $
## H| $
.#|. $
#H || $
## || $
$$
#|. $
#| . $
##H || $
## || $
##H || $
$$
#| $
#| $
#. $
. $
$
$$
#|| $
##| $
##. $
##| $
#|| $
$$
##| $
#|| $
.|| $
#|| $
##| $
$$
## || $
#H| $
##HHH|| $
#H| $
## || $
$$
.. $
.#|. $
##HH|| $
.#|. $
.. $
$$
$
$
. $
#| $
#| $
#. $$
$
.. $
#H|| $
.. $
$
$$
$
$
. $
#| $
#| $
$$
.H| $
#| $
#| $
#| $
#H. $
$$
#HH| $
## || $
## H|| $
##H || $
#HH| $
$$
#| $
##| $
#| $
#| $
#| $
$$
##HH| $
. || $
#HH| $
## . $
##HH|| $
$$
##HH| $
. || $
#HH| $
. || $
##HH| $
$$
#|| $
#H|| $
## || $
##H||| $
.|| $
$$
##HH|| $
## . $
##HH| $
. || $
##HH| $
$$
#HH| $
## . $
##HH| $
## || $
#HH| $
$$
##HH|| $
. #| $
#| $
#| $
##. $
$$
#HH| $
## || $
#HH| $
## || $
#HH| $
$$
#HH| $
## || $
#HH|| $
. || $
#HH| $
$$
#| $
#| $
.. $
#| $
#| $
$$
#| $
#| $
.. $
#| $
#| $
#. $$
.H| $
#| $
##. $
#| $
.H| $
$$
.. $
#H|| $
.. $
#H|| $
.. $
$$
##. $
#| $
.|| $
#| $
##. $
$$
##HH| $
. || $
#H| $
.. $
#| $
$$
#HH| $
## H|| $
## H|| $
## . $
#HH| $
$$
#| $
#HH| $
## || $
##HH|| $
## || $
$$
##HH| $
## || $
##HH| $
## || $
##HH| $
$$
#HH|| $
## . $
## . $
## . $
#HH|| $
$$
##HH| $
## || $
## || $
## || $
##HH| $
$$
##HH|| $
# . $
##HH| $
## . $
##HH|| $
$$
##HH|| $
## . $
##HH| $
## . $
## . $
$$
#HH|| $
## . $
## H|| $
## || $
#HH|| $
$$
## || $
## || $
##HH|| $
## || $
## || $
$$
#HH| $
#| $
#| $
#| $
#HH| $
$$
. || $
. || $
. || $
## || $
#HH| $
$$
## || $
## H| $
##H| $
## H| $
## || $
$$
##. $
##. $
##. $
## . $
##HH| $
$$
## || $
### H|| $
###HH|| $
## H || $
## || $
$$
## || $
##H || $
##HH|| $
## H|| $
## || $
$$
#HH| $
## || $
## || $
## || $
#HH| $
$$
##HH| $
## || $
##HH| $
## . $
##. $
$$
#HH| $
## || $
## || $
## H| $
#HHH| $
$$
##HH| $
## || $
##HH| $
## H| $
## || $
$$
#HH|| $
## . $
#HH| $
. || $
##HH| $
$$
##HH|| $
.#|. $
#| $
#| $
#| $
$$
## || $
## || $
## || $
## || $
#HH| $
$$
## || $
## || $
## || $
#HH| $
#| $
$$
## || $
## H || $
###HH|| $
### H|| $
## || $
$$
## || $
#HH| $
#| $
#HH| $
## || $
$$
## || $
## || $
#HH| $
#| $
#| $
$$
##HH|| $
. #| $
#| $
#H . $
##HH|| $
$$
##H| $
##. $
##. $
##. $
##H| $
$$
#H. $
#| $
#| $
#| $
.H| $
$$
##H| $
.H| $
.H| $
.H| $
##H| $
$$
#| $
##|| $
# | $
$
$
$$
$
$
.. $
.. $
.... $
##HH|| $$
#| $
#| $
.| $
$
$
$$
$
##| $
.H| $
##H| $
##HH| $
$$
##. $
##. $
##H| $
## H| $
##H| $
$$
.. $
#HH| $
## . $
## . $
#HH| $
$$
.H| $
.H| $
#HH| $
## H| $
#HH| $
$$
$
#H| $
##HH| $
## . $
#HH| $
$$
#H| $
##. $
##|. $
##. $
##. $
$$
$
#HH| $
## H| $
#HH| $
. H| $
##H| $$
##. $
##. $
##H| $
## H| $
## H| $
$$
#| $
... $
#| $
#| $
#H| $
$$
.H| $
. . $
.H| $
.H| $
.H| $
##| $$
## . $
## H| $
##H| $
##H| $
## H| $
$$
#| $
#|. $
#| $
#| $
#H| $
$$
$
##H H| $
### HH| $
## H H| $
## H| $
$$
$
##H| $
## H| $
## H| $
## H| $
$$
$
#H| $
## H| $
## H| $
#H| $
$$
$
##H| $
## H| $
##H| $
##. $
##. $$
$
#HH| $
## H| $
#HH| $
.H| $
.H| $$
$
## H| $
##H| $
##. $
##. $
$$
$
#HH| $
##H| $
. H| $
##H| $
$$
#|. $
##HH| $
#|. $
#| $
#H| $
$$
$
## H| $
## H| $
## H| $
#HH| $
$$
$
## H| $
## H| $
#H| $
#. $
$$
$
## H| $
## H H| $
###HHH| $
## H| $
$$
$
## H| $
#H| $
#H| $
## H| $
$$
$
## H| $
## H| $
#HH| $
. H| $
##H| $$
$
##HH| $
.#| $
#|. $
##HH| $
$$
#HH| $
#|. $
##. $
#|. $
#HH| $
$$
#| $
#| $
#| $
#| $
#| $
#| $$
##H| $
.#| $
.H| $
.#| $
##H| $
$$
#H H| $
##HHH| $
## H| $
. . $
$
$$
#| $
##|.. $
.H| $
##H| $
##HH| $
$$
.#| $
#H|. $
##HH| $
## . $
#HH| $
$$
#| $
... $
#| $
#| $
#H| $
$$
.#| $
#H|. $
## H| $
## H| $
#H| $
$$
#| $
## H| $
## H| $
## H| $
#HH| $
$$
##HH| $
... $
##H| $
## H| $
## H| $
$$
##HH|| $
... $
##H || $
## H|| $
## || $
$$
`
@@ -0,0 +1,30 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
module.exports = {
meta: {
docs: {
description: "disallow `new.target` meta property.",
category: "ES2015",
recommended: false,
url:
"http://mysticatea.github.io/eslint-plugin-es/rules/no-new-target.html",
},
fixable: null,
messages: {
forbidden: "ES2015 'new.target' meta property is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
"MetaProperty[meta.name='new'][property.name='target']"(node) {
context.report({ node, messageId: "forbidden" })
},
}
},
}
@@ -0,0 +1,24 @@
# @heroui/framer-utils
A Quick description of the component
> This is an internal utility, not intended for public usage.
## Installation
```sh
yarn add @heroui/framer-utils
# or
npm i @heroui/framer-utils
```
## Contribution
Yes please! See the
[contributing guidelines](https://github.com/frontio-ai/heroui/blob/master/CONTRIBUTING.md)
for details.
## License
This project is licensed under the terms of the
[MIT license](https://github.com/frontio-ai/heroui/blob/master/LICENSE).
@@ -0,0 +1 @@
{"version":3,"names":["_renamer","require","_index","_traverseForScope","_binding","_t","t","_cache","globalsBuiltinLower","globalsBuiltinUpper","assignmentExpression","callExpression","cloneNode","getBindingIdentifiers","identifier","isArrayExpression","isBinary","isCallExpression","isClass","isClassBody","isClassDeclaration","isExportAllDeclaration","isExportDefaultDeclaration","isExportNamedDeclaration","isFunctionDeclaration","isIdentifier","isImportDeclaration","isLiteral","isMemberExpression","isMethod","isModuleSpecifier","isNullLiteral","isObjectExpression","isProperty","isPureish","isRegExpLiteral","isSuper","isTaggedTemplateExpression","isTemplateLiteral","isThisExpression","isUnaryExpression","isVariableDeclaration","expressionStatement","matchesPattern","memberExpression","numericLiteral","toIdentifier","variableDeclaration","variableDeclarator","isRecordExpression","isTupleExpression","isObjectProperty","isTopicReference","isMetaProperty","isPrivateName","isExportDeclaration","buildUndefinedNode","sequenceExpression","gatherNodeParts","node","parts","type","_node$specifiers","source","specifiers","length","e","declaration","local","push","value","object","property","name","callee","properties","argument","key","left","id","expression","meta","openingElement","openingFragment","namespace","resetScope","scope","references","Object","create","uids","bindings","globals","isAnonymousFunctionExpression","path","isFunctionExpression","isArrowFunctionExpression","NOT_LOCAL_BINDING","Symbol","for","collectorVisitor","ForStatement","declar","get","isVar","parentScope","getFunctionParent","getProgramParent","registerBinding","Declaration","isBlockScoped","parent","registerDeclaration","ImportDeclaration","getBlockParent","TSImportEqualsDeclaration","ReferencedIdentifier","state","isTSQualifiedName","right","parentPath","isTSImportEqualsDeclaration","ForXStatement","isPattern","constantViolations","ExportDeclaration","exit","binding","getBinding","reference","decl","declarations","keys","LabeledStatement","AssignmentExpression","assignments","UpdateExpression","UnaryExpression","operator","BlockScoped","CatchClause","Function","params","param","ClassExpression","TSTypeAnnotation","skip","scopeVisitor","uid","Scope","constructor","block","inited","labels","referencesSet","uidsSet","data","crawling","cached","scopeCache","set","Map","defineProperties","enumerable","configurable","writable","_parent","_path","shouldSkip","listKey","isScope","Error","generateDeclaredUidIdentifier","generateUidIdentifier","generateUid","replace","i","hasLabel","hasBinding","hasGlobal","hasReference","program","generateUidBasedOnNode","defaultName","join","slice","generateUidIdentifierBasedOnNode","isStatic","constant","maybeGenerateMemoised","dontPush","checkBlockScopedCollisions","kind","duplicate","hub","buildError","TypeError","rename","oldName","newName","renamer","Renamer","arguments","dump","sep","repeat","console","log","violations","getLabel","registerLabel","label","isLabeledStatement","declare","isTypeDeclaration","importKind","specifier","isTypeSpecifier","isImportSpecifier","registerConstantViolation","ids","getAssignmentIdentifiers","_this$getBinding","reassign","bindingPath","ReferenceError","declarators","getOuterBindingIdentifiers","getOwnBinding","Binding","addGlobal","hasUid","isPure","constantsOnly","_node$decorators","superClass","decorators","body","method","elem","elements","prop","_node$decorators2","computed","_node$decorators3","static","expressions","tag","noGlobals","quasi","isStringLiteral","setData","val","getData","removeData","init","crawl","isProgram","programParent","traverse","visitors","merge","typeVisitors","visit","enter","call","ref","opts","getPatternParent","isBlockStatement","isSwitchStatement","unique","pushContainer","isLoop","isCatchClause","isFunction","ensureBlock","blockHoist","_blockHoist","dataKey","declarPath","unshiftContainer","declarator","len","isFunctionParent","isBlockParent","getAllBindings","bindingIdentifierEquals","getBindingIdentifier","previousPath","_previousPath","_this$getBinding2","getOwnBindingIdentifier","hasOwnBinding","noUids","upToScope","includes","contextVariables","parentHasBinding","_this$parent","moveBindingTo","info","removeOwnBinding","removeBinding","_this$getBinding3","hoistVariables","emit","seen","Set","isVariableDeclarator","has","add","firstId","isForXStatement","replaceWith","remove","expr","isForStatement","exports","default","prototype","_renameFromMap","map","_generateUid","toArray","arrayLikeIsIterable","isGenericType","helperName","args","unshift","addHelper","getAllBindingsOfKind","kinds","parentBlock"],"sources":["../../src/scope/index.ts"],"sourcesContent":["import Renamer from \"./lib/renamer.ts\";\nimport type NodePath from \"../path/index.ts\";\nimport traverse from \"../index.ts\";\nimport traverseForScope from \"./traverseForScope.ts\";\nimport Binding from \"./binding.ts\";\nimport type { BindingKind } from \"./binding.ts\";\nimpLine truncated
@@ -0,0 +1,96 @@
'use strict';
var $RangeError = require('es-errors/range');
var $TypeError = require('es-errors/type');
var isTypedArray = require('is-typed-array');
var typedArrayBuffer = require('typed-array-buffer');
var typedArrayByteOffset = require('typed-array-byte-offset');
var typedArrayLength = require('typed-array-length');
var whichTypedArray = require('which-typed-array');
var isInteger = require('math-intrinsics/isInteger');
var Get = require('./Get');
var IsBigIntElementType = require('./IsBigIntElementType');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var LengthOfArrayLike = require('./LengthOfArrayLike');
var SetValueInBuffer = require('./SetValueInBuffer');
var ToBigInt = require('./ToBigInt');
var ToNumber = require('./ToNumber');
var ToObject = require('./ToObject');
var ToString = require('./ToString');
var tableTAO = require('./tables/typed-array-objects');
// https://262.ecma-international.org/12.0/#sec-settypedarrayfromarraylike
module.exports = function SetTypedArrayFromArrayLike(target, targetOffset, source) {
var whichTarget = whichTypedArray(target);
if (!whichTarget) {
throw new $TypeError('Assertion failed: target must be a TypedArray instance');
}
if (targetOffset !== Infinity && (!isInteger(targetOffset) || targetOffset < 0)) {
throw new $TypeError('Assertion failed: targetOffset must be a non-negative integer or +Infinity');
}
if (isTypedArray(source)) {
throw new $TypeError('Assertion failed: source must not be a TypedArray instance'); // step 1
}
var targetBuffer = typedArrayBuffer(target); // step 2
if (IsDetachedBuffer(targetBuffer)) {
throw new $TypeError('target’s buffer is detached'); // step 3
}
var targetLength = typedArrayLength(target); // step 4
var targetName = whichTarget; // step 5
var targetType = tableTAO.name['$' + targetName]; // step 7
var targetElementSize = tableTAO.size['$' + targetType]; // step 6
var targetByteOffset = typedArrayByteOffset(target); // step 8
var src = ToObject(source); // step 9
var srcLength = LengthOfArrayLike(src); // step 10
if (targetOffset === Infinity) {
throw new $RangeError('targetOffset must be a finite integer'); // step 11
}
if (srcLength + targetOffset > targetLength) {
throw new $RangeError('targetOffset + srcLength must be <= target.length'); // step 12
}
var targetByteIndex = (targetOffset * targetElementSize) + targetByteOffset; // step 13
var k = 0; // step 14
var limit = targetByteIndex + (targetElementSize * srcLength); // step 15
while (targetByteIndex < limit) { // step 16
var Pk = ToString(k); // step 16.a
var value = Get(src, Pk); // step 16.b
if (IsBigIntElementType(targetType)) {
value = ToBigInt(value); // step 16.c
} else {
value = ToNumber(value); // step 16.d
}
if (IsDetachedBuffer(targetBuffer)) {
throw new $TypeError('target’s buffer is detached'); // step 16.e
}
SetValueInBuffer(targetBuffer, targetByteIndex, targetType, value, true, 'Unordered'); // step 16.f
k += 1; // step 16.g
targetByteIndex += targetElementSize; // step 16.h
}
};
@@ -0,0 +1,62 @@
import { EndOfStreamError } from './Errors.js';
import { AbstractStreamReader } from "./AbstractStreamReader.js";
export class WebStreamDefaultReader extends AbstractStreamReader {
constructor(reader) {
super();
this.reader = reader;
this.buffer = null; // Internal buffer to store excess data
}
/**
* Copy chunk to target, and store the remainder in this.buffer
*/
writeChunk(target, chunk) {
const written = Math.min(chunk.length, target.length);
target.set(chunk.subarray(0, written));
// Adjust the remainder of the buffer
if (written < chunk.length) {
this.buffer = chunk.subarray(written);
}
else {
this.buffer = null;
}
return written;
}
/**
* Read from stream
* @param buffer - Target Uint8Array (or Buffer) to store data read from stream in
* @param mayBeLess - If true, may fill the buffer partially
* @protected Bytes read
*/
async readFromStream(buffer, mayBeLess) {
if (buffer.length === 0)
return 0;
let totalBytesRead = 0;
// Serve from the internal buffer first
if (this.buffer) {
totalBytesRead += this.writeChunk(buffer, this.buffer);
}
// Continue reading from the stream if more data is needed
while (totalBytesRead < buffer.length && !this.endOfStream) {
const result = await this.reader.read();
if (result.done) {
this.endOfStream = true;
break;
}
if (result.value) {
totalBytesRead += this.writeChunk(buffer.subarray(totalBytesRead), result.value);
}
}
if (!mayBeLess && totalBytesRead === 0 && this.endOfStream) {
throw new EndOfStreamError();
}
return totalBytesRead;
}
abort() {
this.interrupted = true;
return this.reader.cancel();
}
async close() {
await this.abort();
this.reader.releaseLock();
}
}
@@ -0,0 +1 @@
{"name":"micromark-util-normalize-identifier","version":"2.0.1","requiresBuild":false,"files":{"license":{"checkedAt":1794532112631,"integrity":"sha512-ic4iF2Ap25Sn5T9MMw7nJ9C20WL6V01rybBBQi2Qx8cQC9/ERFEqGnove1HT65tK2TIKM30PZoOV3Qbz2FE//A==","mode":420,"size":1094},"dev/index.js":{"checkedAt":1794532113557,"integrity":"sha512-vw+JaCvIw2mxR+ujdW7jEmA/37UjlJgc5JQm6sB/PeKG4Gak/ZEXYavlxz8jkaKhXWXar0ToJXbI8z/ZehE7CQ==","mode":420,"size":1364},"index.js":{"checkedAt":1794532113557,"integrity":"sha512-xqzGOFchuJGffB3+Lu8MJi9GcxkqTxIQzaivhNeglLgyzLC0FkojOGhznvZJJBROV4gYNdbJo2VVwx6A7F5E1w==","mode":420,"size":1248},"package.json":{"checkedAt":1794532113558,"integrity":"sha512-hGUezuBJrMLYIVxyPJuqX3RFXDDAwqhFmgZHIu6ZuZkNvMS6ufPQuW29um/MWzk7j4ZragaBoyoulXfKEwOkTg==","mode":420,"size":1374},"dev/index.d.ts.map":{"checkedAt":1794532113558,"integrity":"sha512-kYV2H9xcpf9EiY79pSjDG5UmOEckG6RUYLqQ1Abay4j5seKi7HhdEJT8H4Gjb9/afFSSaIAL3Di+77WrkSU9qw==","mode":420,"size":157},"index.d.ts.map":{"checkedAt":1794532113558,"integrity":"sha512-kYV2H9xcpf9EiY79pSjDG5UmOEckG6RUYLqQ1Abay4j5seKi7HhdEJT8H4Gjb9/afFSSaIAL3Di+77WrkSU9qw==","mode":420,"size":157},"readme.md":{"checkedAt":1794532113558,"integrity":"sha512-ycqo19ugLEeGsIQVnPizPk8pU/kdDULhQ7NFdLJ512LpGjRMJnmH9BZCwi25T2BLUY4OZHA3JCSdV8S+uwIBeg==","mode":420,"size":5246},"dev/index.d.ts":{"checkedAt":1794532113558,"integrity":"sha512-qyio5phtL1U/v4ZRmN9ubecOMJVRL9ARlho9UCayKvmoaxwvOB3qiXhKfT+B9RI+wJZ+dZwsQCUhzWYdelS5UQ==","mode":420,"size":808},"index.d.ts":{"checkedAt":1794532113558,"integrity":"sha512-qyio5phtL1U/v4ZRmN9ubecOMJVRL9ARlho9UCayKvmoaxwvOB3qiXhKfT+B9RI+wJZ+dZwsQCUhzWYdelS5UQ==","mode":420,"size":808}}}
@@ -0,0 +1,80 @@
2.0.0 - 2024-09-04
==========
* Drop support for Node.js <18
1.0.0 - 2024-09-04
==========
* Drop support for Node.js below 0.8
* Fix: Ignore `If-Modified-Since` in the presence of `If-None-Match`, according to [spec](https://www.rfc-editor.org/rfc/rfc9110.html#section-13.1.3-5). Fixes [#35](https://github.com/jshttp/fresh/issues/35)
0.5.2 / 2017-09-13
==================
* Fix regression matching multiple ETags in `If-None-Match`
* perf: improve `If-None-Match` token parsing
0.5.1 / 2017-09-11
==================
* Fix handling of modified headers with invalid dates
* perf: improve ETag match loop
0.5.0 / 2017-02-21
==================
* Fix incorrect result when `If-None-Match` has both `*` and ETags
* Fix weak `ETag` matching to match spec
* perf: delay reading header values until needed
* perf: skip checking modified time if ETag check failed
* perf: skip parsing `If-None-Match` when no `ETag` header
* perf: use `Date.parse` instead of `new Date`
0.4.0 / 2017-02-05
==================
* Fix false detection of `no-cache` request directive
* perf: enable strict mode
* perf: hoist regular expressions
* perf: remove duplicate conditional
* perf: remove unnecessary boolean coercions
0.3.0 / 2015-05-12
==================
* Add weak `ETag` matching support
0.2.4 / 2014-09-07
==================
* Support Node.js 0.6
0.2.3 / 2014-09-07
==================
* Move repository to jshttp
0.2.2 / 2014-02-19
==================
* Revert "Fix for blank page on Safari reload"
0.2.1 / 2014-01-29
==================
* Fix for blank page on Safari reload
0.2.0 / 2013-08-11
==================
* Return stale for `Cache-Control: no-cache`
0.1.0 / 2012-06-15
==================
* Add `If-None-Match: *` support
0.0.1 / 2012-06-10
==================
* Initial release
@@ -0,0 +1 @@
!function(_,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],e):(_="undefined"!=typeof globalThis?globalThis:_||self).dayjs_locale_th=e(_.dayjs)}(this,(function(_){"use strict";function e(_){return _&&"object"==typeof _&&"default"in _?_:{default:_}}var t=e(_),d={name:"th",weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.".split("_"),formats:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา H:mm",LLLL:"วันddddที่ D MMMM YYYY เวลา H:mm"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"},ordinal:function(_){return _+"."}};return t.default.locale(d,null,!0),d}));
@@ -0,0 +1,79 @@
export declare enum PredefinedFormats {
camelCase = 1,
strictCamelCase = 2,
PascalCase = 3,
StrictPascalCase = 4,
snake_case = 5,
UPPER_CASE = 6
}
export type PredefinedFormatsString = keyof typeof PredefinedFormats;
export declare enum UnderscoreOptions {
forbid = 1,
allow = 2,
require = 3,
requireDouble = 4,
allowDouble = 5,
allowSingleOrDouble = 6
}
export type UnderscoreOptionsString = keyof typeof UnderscoreOptions;
export declare enum Selectors {
variable = 1,
function = 2,
parameter = 4,
parameterProperty = 8,
classicAccessor = 16,
enumMember = 32,
classMethod = 64,
objectLiteralMethod = 128,
typeMethod = 256,
classProperty = 512,
objectLiteralProperty = 1024,
typeProperty = 2048,
autoAccessor = 4096,
class = 8192,
interface = 16384,
typeAlias = 32768,
enum = 65536,
typeParameter = 131072,
import = 262144
}
export type SelectorsString = keyof typeof Selectors;
export declare enum MetaSelectors {
default = -1,
variableLike = 7,
memberLike = 8184,
typeLike = 253952,
method = 448,
property = 3584,
accessor = 4112
}
export type MetaSelectorsString = keyof typeof MetaSelectors;
export type IndividualAndMetaSelectorsString = MetaSelectorsString | SelectorsString;
export declare enum Modifiers {
const = 1,
readonly = 2,
static = 4,
public = 8,
protected = 16,
private = 32,
'#private' = 64,
abstract = 128,
destructured = 256,
global = 512,
exported = 1024,
unused = 2048,
requiresQuotes = 4096,
override = 8192,
async = 16384,
default = 32768,
namespace = 65536
}
export type ModifiersString = keyof typeof Modifiers;
export declare enum TypeModifiers {
boolean = 131072,
string = 262144,
number = 524288,
function = 1048576,
array = 2097152
}
export type TypeModifiersString = keyof typeof TypeModifiers;
@@ -0,0 +1,31 @@
var baseDifference = require('./_baseDifference'),
baseRest = require('./_baseRest'),
isArrayLikeObject = require('./isArrayLikeObject');
/**
* Creates an array excluding all given values using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* **Note:** Unlike `_.pull`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...*} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @see _.difference, _.xor
* @example
*
* _.without([2, 1, 2, 3], 1, 2);
* // => [3]
*/
var without = baseRest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, values)
: [];
});
module.exports = without;
@@ -0,0 +1,52 @@
{
"name": "read-pkg",
"version": "6.0.0",
"description": "Read a package.json file",
"license": "MIT",
"repository": "sindresorhus/read-pkg",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=12"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"json",
"read",
"parse",
"file",
"fs",
"graceful",
"load",
"package",
"normalize"
],
"dependencies": {
"@types/normalize-package-data": "^2.4.0",
"normalize-package-data": "^3.0.2",
"parse-json": "^5.2.0",
"type-fest": "^1.0.1"
},
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
},
"xo": {
"ignores": [
"test/test.js"
]
}
}
@@ -0,0 +1,43 @@
var $c1jOQ$reactariautils = require("@react-aria/utils");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useMenuSection", () => $63008655e23408c5$export$73f7a44322579622);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $63008655e23408c5$export$73f7a44322579622(props) {
let { heading: heading, 'aria-label': ariaLabel } = props;
let headingId = (0, $c1jOQ$reactariautils.useId)();
return {
itemProps: {
role: 'presentation'
},
headingProps: heading ? {
// Techincally, menus cannot contain headings according to ARIA.
// We hide the heading from assistive technology, using role="presentation",
// and only use it as a label for the nested group.
id: headingId,
role: 'presentation'
} : {},
groupProps: {
role: 'group',
'aria-label': ariaLabel,
'aria-labelledby': heading ? headingId : undefined
}
};
}
//# sourceMappingURL=useMenuSection.main.js.map
@@ -0,0 +1,34 @@
import baseInvoke from './_baseInvoke.js';
import baseRest from './_baseRest.js';
/**
* Creates a function that invokes the method at `path` of a given object.
* Any additional arguments are provided to the invoked method.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Util
* @param {Array|string} path The path of the method to invoke.
* @param {...*} [args] The arguments to invoke the method with.
* @returns {Function} Returns the new invoker function.
* @example
*
* var objects = [
* { 'a': { 'b': _.constant(2) } },
* { 'a': { 'b': _.constant(1) } }
* ];
*
* _.map(objects, _.method('a.b'));
* // => [2, 1]
*
* _.map(objects, _.method(['a', 'b']));
* // => [2, 1]
*/
var method = baseRest(function(path, args) {
return function(object) {
return baseInvoke(object, path, args);
};
});
export default method;
@@ -0,0 +1,65 @@
{
"name": "@humanwhocodes/module-importer",
"version": "1.0.1",
"description": "Universal module importer for Node.js",
"main": "src/module-importer.cjs",
"module": "src/module-importer.js",
"type": "module",
"types": "dist/module-importer.d.ts",
"exports": {
"require": "./src/module-importer.cjs",
"import": "./src/module-importer.js"
},
"files": [
"dist",
"src"
],
"publishConfig": {
"access": "public"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.js": [
"eslint --fix"
]
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/nzakas"
},
"scripts": {
"build": "rollup -c && tsc",
"prepare": "npm run build",
"lint": "eslint src/ tests/",
"test:unit": "c8 mocha tests/module-importer.test.js",
"test:build": "node tests/pkg.test.cjs && node tests/pkg.test.mjs",
"test": "npm run test:unit && npm run test:build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/humanwhocodes/module-importer.git"
},
"keywords": [
"modules",
"esm",
"commonjs"
],
"engines": {
"node": ">=12.22"
},
"author": "Nicholas C. Zaks",
"license": "Apache-2.0",
"devDependencies": {
"@types/node": "^18.7.6",
"c8": "7.12.0",
"chai": "4.3.6",
"eslint": "8.22.0",
"lint-staged": "13.0.3",
"mocha": "9.2.2",
"rollup": "2.78.0",
"typescript": "4.7.4",
"yorkie": "2.0.0"
}
}
@@ -0,0 +1,11 @@
"use client";
import {
skeleton_default
} from "./chunk-TLYTI3QM.mjs";
import {
useSkeleton
} from "./chunk-XB6FZTQR.mjs";
export {
skeleton_default as Skeleton,
useSkeleton
};
@@ -0,0 +1,186 @@
'use strict';
var utils = require('../utils.js');
require('eslint-visitor-keys');
require('espree');
require('estraverse');
const optionDefaults = {
allow: "none"
};
const messages = {
moveToNewLine: "`{{descriptor}}` must be placed on a new line"
};
var jsxOneExpressionPerLine = utils.createRule({
name: "jsx-one-expression-per-line",
package: "jsx",
meta: {
type: "layout",
docs: {
description: "Require one JSX element per line"
},
fixable: "whitespace",
messages,
schema: [
{
type: "object",
properties: {
allow: {
type: "string",
enum: ["none", "literal", "single-child", "single-line", "non-jsx"]
}
},
default: optionDefaults,
additionalProperties: false
}
]
},
create(context) {
const options = Object.assign({}, optionDefaults, context.options[0]);
function nodeKey(node) {
return `${node.loc.start.line},${node.loc.start.column}`;
}
function nodeDescriptor(n) {
return "openingElement" in n && n.openingElement && "name" in n.openingElement.name ? String(n.openingElement.name.name) : context.sourceCode.getText(n).replace(/\n/g, "");
}
function handleJSX(node) {
const children = node.children;
if (!children || !children.length)
return;
if (options.allow === "non-jsx" && !children.find((child) => child.type === "JSXFragment" || child.type === "JSXElement")) {
return;
}
const openingElement = node.openingElement || node.openingFragment;
const closingElement = node.closingElement || node.closingFragment;
const openingElementStartLine = openingElement.loc.start.line;
const openingElementEndLine = openingElement.loc.end.line;
const closingElementStartLine = closingElement.loc.start.line;
const closingElementEndLine = closingElement.loc.end.line;
if (children.length === 1) {
const child = children[0];
if (openingElementStartLine === openingElementEndLine && openingElementEndLine === closingElementStartLine && closingElementStartLine === closingElementEndLine && closingElementEndLine === child.loc.start.line && child.loc.start.line === child.loc.end.line) {
if (options.allow === "single-child" || options.allow === "literal" && (child.type === "Literal" || child.type === "JSXText") || options.allow === "single-line") {
return;
}
}
}
if (options.allow === "single-line") {
const firstChild = children[0];
const lastChild = children[children.length - 1];
const lineDifference = lastChild.loc.end.line - firstChild.loc.start.line;
let lineBreaks = 0;
if (firstChild.type === "Literal" || firstChild.type === "JSXText") {
if (/^\s*?\n/.test(firstChild.raw))
lineBreaks += 1;
}
if (lastChild.type === "Literal" || lastChild.type === "JSXText") {
if (/\n\s*$/.test(lastChild.raw))
lineBreaks += 1;
}
if (lineDifference === 0 && lineBreaks === 0 || lineDifference === 2 && lineBreaks === 2)
return;
}
const childrenGroupedByLine = {};
const fixDetailsByNode = {};
children.forEach((child) => {
let countNewLinesBeforeContent = 0;
let countNewLinesAfterContent = 0;
if (child.type === "Literal" || child.type === "JSXText") {
if (utils.isWhiteSpaces(child.raw))
return;
countNewLinesBeforeContent = (child.raw.match(/^\s*\n/g) || []).length;
countNewLinesAfterContent = (child.raw.match(/\n\s*$/g) || []).length;
}
const startLine = child.loc.start.line + countNewLinesBeforeContent;
const endLine = child.loc.end.line - countNewLinesAfterContent;
if (startLine === endLine) {
if (!childrenGroupedByLine[startLine])
childrenGroupedByLine[startLine] = [];
childrenGroupedByLine[startLine].push(child);
} else {
if (!childrenGroupedByLine[startLine])
childrenGroupedByLine[startLine] = [];
childrenGroupedByLine[startLine].push(child);
if (!childrenGroupedByLine[endLine])
childrenGroupedByLine[endLine] = [];
childrenGroupedByLine[endLine].push(child);
}
});
Object.keys(childrenGroupedByLine).forEach((_line) => {
const line = parseInt(_line, 10);
const firstIndex = 0;
const lastIndex = childrenGroupedByLine[line].length - 1;
childrenGroupedByLine[line].forEach((child, i) => {
let prevChild;
let nextChild;
if (i === firstIndex) {
if (line === openingElementEndLine)
prevChild = openingElement;
} else {
prevChild = childrenGroupedByLine[line][i - 1];
}
if (i === lastIndex) {
if (line === closingElementStartLine)
nextChild = closingElement;
}
if (!prevChild && !nextChild)
return;
const spaceBetweenPrev = () => {
return (prevChild.type === "Literal" || prevChild.type === "JSXText") && prevChild.raw.endsWith(" ") || (child.type === "Literal" || child.type === "JSXText") && child.raw.startsWith(" ") || context.sourceCode.isSpaceBetweenTokens(prevChild, child);
};
const spaceBetweenNext = () => {
return (nextChild.type === "Literal" || nextChild.type === "JSXText") && nextChild.raw.startsWith(" ") || (child.type === "Literal" || child.type === "JSXText") && child.raw.endsWith(" ") || context.sourceCode.isSpaceBetweenTokens(child, nextChild);
};
const source = context.sourceCode.getText(child);
const leadingSpace = !!(prevChild && spaceBetweenPrev());
const trailingSpace = !!(nextChild && spaceBetweenNext());
const leadingNewLine = !!prevChild;
const trailingNewLine = !!nextChild;
const key = nodeKey(child);
if (!fixDetailsByNode[key]) {
fixDetailsByNode[key] = {
node: child,
source,
descriptor: nodeDescriptor(child)
};
}
if (leadingSpace)
fixDetailsByNode[key].leadingSpace = true;
if (leadingNewLine)
fixDetailsByNode[key].leadingNewLine = true;
if (trailingNewLine)
fixDetailsByNode[key].trailingNewLine = true;
if (trailingSpace)
fixDetailsByNode[key].trailingSpace = true;
});
});
Object.keys(fixDetailsByNode).forEach((key) => {
const details = fixDetailsByNode[key];
const nodeToReport = details.node;
const descriptor = details.descriptor;
const source = details.source.replace(/(^ +| +$)/g, "");
const leadingSpaceString = details.leadingSpace ? "\n{' '}" : "";
const trailingSpaceString = details.trailingSpace ? "{' '}\n" : "";
const leadingNewLineString = details.leadingNewLine ? "\n" : "";
const trailingNewLineString = details.trailingNewLine ? "\n" : "";
const replaceText = `${leadingSpaceString}${leadingNewLineString}${source}${trailingNewLineString}${trailingSpaceString}`;
context.report({
messageId: "moveToNewLine",
node: nodeToReport,
data: {
descriptor
},
fix(fixer) {
return fixer.replaceText(nodeToReport, replaceText);
}
});
});
}
return {
JSXElement: handleJSX,
JSXFragment: handleJSX
};
}
});
module.exports = jsxOneExpressionPerLine;
@@ -0,0 +1,61 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.1.0](https://github.com/inspect-js/get-symbol-description/compare/v1.0.2...v1.1.0) - 2024-12-17
### Commits
- [New] add types [`b957b65`](https://github.com/inspect-js/get-symbol-description/commit/b957b65e08bc1a6ac95fa5ab769ec241b9cac885)
- [actions] split out node 10-20, and 20+ [`bfbcae2`](https://github.com/inspect-js/get-symbol-description/commit/bfbcae2ab7224fcf4328bc139ba79445d64030a6)
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `es-value-fixtures`, `object-inspect`, tape` [`197ba80`](https://github.com/inspect-js/get-symbol-description/commit/197ba80ef87153e28f20ec353e8b926ddb145da0)
- [Refactor] use `call-bound` directly [`9df4de4`](https://github.com/inspect-js/get-symbol-description/commit/9df4de4e8faae09e84c5ac97ec22b4f010d03fca)
- [Deps] update `call-bind`, `get-intrinsic` [`44c1400`](https://github.com/inspect-js/get-symbol-description/commit/44c1400d5088429f6a32a5f81628d9f7270f68ca)
- [Dev Deps] update `hasown`, `tape` [`44e2264`](https://github.com/inspect-js/get-symbol-description/commit/44e226470a83e89523bb4898e1ef7a0942e6cb3a)
- [Tests] replace `aud` with `npm audit` [`62d9414`](https://github.com/inspect-js/get-symbol-description/commit/62d9414d316f7ba2320cb6fad8d9fd4d8b99c420)
- [Deps] update `call-bind` [`396ee27`](https://github.com/inspect-js/get-symbol-description/commit/396ee2763238415c51eec62fbc41bf274c6552b2)
- [Dev Deps] add missing peer dep [`cc4b9eb`](https://github.com/inspect-js/get-symbol-description/commit/cc4b9eb527504a49e91f560ee6d9cb942db4e46f)
## [v1.0.2](https://github.com/inspect-js/get-symbol-description/compare/v1.0.1...v1.0.2) - 2024-02-07
### Fixed
- [Deps] add missing `get-intrinsic` [`#3`](https://github.com/inspect-js/get-symbol-description/issues/3)
## [v1.0.1](https://github.com/inspect-js/get-symbol-description/compare/v1.0.0...v1.0.1) - 2024-02-05
### Commits
- [actions] reuse common workflows [`168adf2`](https://github.com/inspect-js/get-symbol-description/commit/168adf213f86e5c69a93b4768a20ad543a70b231)
- [meta] use `npmignore` to autogenerate an npmignore file [`fa3b323`](https://github.com/inspect-js/get-symbol-description/commit/fa3b323f0605cf966a5cef1a103ada46d63e466b)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `es-value-fixtures`, `foreach`, `object-inspect`, `tape` [`9301b9e`](https://github.com/inspect-js/get-symbol-description/commit/9301b9e274fd9b7544af3d7d437dd254e83095e0)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`a92a011`](https://github.com/inspect-js/get-symbol-description/commit/a92a0119f373fb61c58e3eb1d5fb6b3a3f66f157)
- [actions] update rebase action to use reusable workflow [`66cea29`](https://github.com/inspect-js/get-symbol-description/commit/66cea29835bc88ab5e937ccf996ea96409475a0e)
- [actions] update codecov uploader [`84079e1`](https://github.com/inspect-js/get-symbol-description/commit/84079e12e1421a79b63757cc3ab9c599e8eecc75)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `safe-publish-latest`, `tape` [`9f298a5`](https://github.com/inspect-js/get-symbol-description/commit/9f298a521e6f8a9b974b6b95e0b3de8aeaf74d9c)
- [Dev Deps] use `hasown` instead of `has` [`e993bd6`](https://github.com/inspect-js/get-symbol-description/commit/e993bd62a08a1adc2f75664be99a36e031ecf604)
- [Dev Deps] update `aud`, `npmignore`, `tape` [`5044bed`](https://github.com/inspect-js/get-symbol-description/commit/5044bed49a1b2b529b0c92fee0504747fda78147)
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`3923eab`](https://github.com/inspect-js/get-symbol-description/commit/3923eabcf3eb2ddad7dbfd542102c29646dac242)
- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`a24f5c5`](https://github.com/inspect-js/get-symbol-description/commit/a24f5c5f6ddd1f24b22ecdc2546eb9b06924f62a)
- [Deps] update `call-bind`, `get-intrinsic` [`accd484`](https://github.com/inspect-js/get-symbol-description/commit/accd484cb970c11fb39eb5ec4301572fa4043e37)
- [Dev Deps] update `object-inspect`, `tape` [`6c66623`](https://github.com/inspect-js/get-symbol-description/commit/6c666237114333bcb548e2c9ba6eb4924cb154ad)
- [Dev Deps] update `object-inspect`, `tape` [`586dfe3`](https://github.com/inspect-js/get-symbol-description/commit/586dfe35b9b6e7dba3fb7577c5973b7466d101a3)
- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`bc8c7e0`](https://github.com/inspect-js/get-symbol-description/commit/bc8c7e0382682164f78b87f41764a0a2e389c435)
- [Tests] use `for-each` instead of `foreach` [`ca97918`](https://github.com/inspect-js/get-symbol-description/commit/ca97918eaad4ff1df11fd6f187da60227722dfcd)
- [Robustness] cache String slice [`5ce0c56`](https://github.com/inspect-js/get-symbol-description/commit/5ce0c5658224ed5cf5c6775a18ee2ad60c5b7ba8)
- [Deps] update `get-intrinsic` [`b656c5c`](https://github.com/inspect-js/get-symbol-description/commit/b656c5c68fbeec35d75a635ca991b61ed004bf54)
- [Deps] update `get-intrinsic` [`74cf3b6`](https://github.com/inspect-js/get-symbol-description/commit/74cf3b6525c49998f2c984d350e4d59d7f70794c)
- [meta] fix FUNDING.yml [`6cf76c8`](https://github.com/inspect-js/get-symbol-description/commit/6cf76c8c56bf366f767a84e82038db54b508641a)
## v1.0.0 - 2021-08-17
### Commits
- Initial commit: pulled from es-abstract [`6e34a05`](https://github.com/inspect-js/get-symbol-description/commit/6e34a05ef10ce8620078cf4cecbe276c1fc1ae77)
- Initial commit [`3862092`](https://github.com/inspect-js/get-symbol-description/commit/3862092248d8ffa071ec90ec39d73e8be14ba6f1)
- [meta] do not publish github action workflow files [`9d1e2b9`](https://github.com/inspect-js/get-symbol-description/commit/9d1e2b94dd97664da5d0666985a3695c23f45865)
- npm init [`5051b32`](https://github.com/inspect-js/get-symbol-description/commit/5051b3221829f364c44b4d5e9a0c35aab3247f6a)
- Only apps should have lockfiles [`b866d1c`](https://github.com/inspect-js/get-symbol-description/commit/b866d1c4b4029277618d968cfb3cbe00f012d1a7)
@@ -0,0 +1 @@
module.exports={C:{"48":0.00718,"52":0.05027,"78":0.00359,"92":0.00359,"111":0.00359,"114":0.00718,"115":0.27651,"125":0.00359,"127":0.00359,"128":0.02155,"132":0.01436,"134":0.00359,"135":0.00359,"136":0.00359,"139":0.00359,"140":0.01796,"141":0.00718,"142":0.02873,"143":0.77566,"144":0.70384,_:"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 49 50 51 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 79 80 81 82 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 112 113 116 117 118 119 120 121 122 123 124 126 129 130 131 133 137 138 145 146 147 3.5 3.6"},D:{"39":0.00359,"40":0.00359,"41":0.00359,"42":0.00359,"43":0.00359,"44":0.00359,"45":0.00359,"46":0.00359,"47":0.00359,"48":0.00359,"49":0.01436,"50":0.00359,"51":0.00359,"52":0.00359,"53":0.01436,"54":0.00359,"55":0.00359,"56":0.00718,"57":0.00359,"58":0.01436,"59":0.00359,"60":0.00359,"66":0.00359,"70":0.01796,"71":0.00359,"73":0.00359,"79":0.28728,"83":0.01436,"84":0.01077,"87":0.07541,"90":0.00359,"91":0.00718,"92":0.00359,"93":0.00359,"94":0.00359,"95":0.01077,"98":0.01077,"102":0.00718,"103":0.00718,"104":0.00359,"108":0.10055,"109":1.92119,"111":0.00718,"112":1.29635,"113":0.00359,"114":0.02514,"116":0.0395,"118":0.00359,"119":0.00718,"120":0.02155,"121":0.01077,"122":0.04309,"123":0.02155,"124":0.01796,"125":2.06123,"126":0.19751,"127":0.01796,"128":0.04309,"129":0.01436,"130":0.00718,"131":0.07182,"132":0.03232,"133":0.07541,"134":0.03232,"135":0.06105,"136":0.04668,"137":0.05027,"138":0.21187,"139":0.33037,"140":4.94481,"141":13.47343,"142":0.12928,"143":0.00359,_:"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 61 62 63 64 65 67 68 69 72 74 75 76 77 78 80 81 85 86 88 89 96 97 99 100 101 105 106 107 110 115 117 144 145"},F:{"36":0.02514,"40":0.04668,"46":0.03591,"91":0.01077,"92":0.02873,"95":0.0395,"114":0.00359,"119":0.00718,"120":0.06823,"121":0.10055,"122":0.75052,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 115 116 117 118 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"92":0.00359,"109":0.01077,"114":0.02155,"115":0.00718,"122":0.00359,"123":0.00359,"130":0.00359,"131":0.00718,"132":0.00359,"133":0.00718,"134":0.01436,"135":0.00359,"136":0.00718,"137":0.01077,"138":0.00718,"139":0.00718,"140":0.3591,"141":1.50104,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 116 117 118 119 120 121 124 125 126 127 128 129 142"},E:{"14":0.00359,_:"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.4 15.5 16.0 16.2 16.4 17.4 18.0 18.2 26.2","13.1":0.00359,"15.2-15.3":0.00359,"15.6":0.00718,"16.1":0.01436,"16.3":0.00359,"16.5":0.00359,"16.6":0.04309,"17.0":0.00359,"17.1":0.06464,"17.2":0.00359,"17.3":0.00359,"17.5":0.00718,"17.6":0.02514,"18.1":0.00359,"18.3":0.02155,"18.4":0.00718,"18.5-18.6":0.05027,"26.0":0.1616,"26.1":0.02514},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00157,"5.0-5.1":0,"6.0-6.1":0.00626,"7.0-7.1":0.0047,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.0141,"10.0-10.2":0.00157,"10.3":0.02662,"11.0-11.2":0.39466,"11.3-11.4":0.0094,"12.0-12.1":0.00313,"12.2-12.5":0.07674,"13.0-13.1":0,"13.2":0.00783,"13.3":0.00313,"13.4-13.7":0.01253,"14.0-14.4":0.02662,"14.5-14.8":0.02819,"15.0-15.1":0.02662,"15.2-15.3":0.02036,"15.4":0.02349,"15.5":0.02662,"15.6-15.8":0.34768,"16.0":0.04698,"16.1":0.0877,"16.2":0.04542,"16.3":0.08144,"16.4":0.02036,"16.5":0.03602,"16.6-16.7":0.46514,"17.0":0.03289,"17.1":0.05012,"17.2":0.03602,"17.3":0.05325,"17.4":0.09397,"17.5":0.16131,"17.6-17.7":0.40719,"18.0":0.0924,"18.1":0.19107,"18.2":0.10336,"18.3":0.33202,"18.4":0.17071,"18.5-18.6":8.70447,"26.0":1.07592,"26.1":0.03915},P:{"4":0.18383,"21":0.01021,"22":0.01021,"23":0.01021,"24":0.04085,"25":0.04085,"26":0.03064,"27":0.09191,"28":3.10468,"29":0.18383,_:"20 8.2 9.2 10.1 11.1-11.2 12.0 13.0 15.0 17.0 18.0 19.0","5.0-5.4":0.04085,"6.2-6.4":0.01021,"7.2-7.4":0.12255,"14.0":0.03064,"16.0":0.01021},I:{"0":0.0128,"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.17302,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.00359,_:"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.10894},Q:{_:"14.9"},O:{"0":0.00641},H:{"0":0},L:{"0":47.44531}};
@@ -0,0 +1,68 @@
{
"name": "vinyl-fs",
"version": "3.0.3",
"description": "Vinyl adapter for the file system.",
"author": "Gulp Team <team@gulpjs.com> (http://gulpjs.com/)",
"contributors": [
"Eric Schoffstall <yo@contra.io>",
"Blaine Bublitz <blaine.bublitz@gmail.com>"
],
"repository": "gulpjs/vinyl-fs",
"license": "MIT",
"engines": {
"node": ">= 0.10"
},
"main": "index.js",
"files": [
"LICENSE",
"index.js",
"lib"
],
"scripts": {
"lint": "eslint . && jscs index.js lib/ test/",
"pretest": "npm run lint",
"test": "mocha --async-only",
"cover": "istanbul cover _mocha --report lcovonly",
"coveralls": "npm run cover && istanbul-coveralls"
},
"dependencies": {
"fs-mkdirp-stream": "^1.0.0",
"glob-stream": "^6.1.0",
"graceful-fs": "^4.0.0",
"is-valid-glob": "^1.0.0",
"lazystream": "^1.0.0",
"lead": "^1.0.0",
"object.assign": "^4.0.4",
"pumpify": "^1.3.5",
"readable-stream": "^2.3.3",
"remove-bom-buffer": "^3.0.0",
"remove-bom-stream": "^1.2.0",
"resolve-options": "^1.1.0",
"through2": "^2.0.0",
"to-through": "^2.0.0",
"value-or-function": "^3.0.0",
"vinyl": "^2.0.0",
"vinyl-sourcemap": "^1.1.0"
},
"devDependencies": {
"eslint": "^1.10.3",
"eslint-config-gulp": "^2.0.0",
"expect": "^1.19.0",
"istanbul": "^0.4.3",
"istanbul-coveralls": "^1.0.3",
"jscs": "^2.4.0",
"jscs-preset-gulp": "^1.0.0",
"mississippi": "^1.2.0",
"mocha": "^3.5.0",
"rimraf": "^2.6.1"
},
"keywords": [
"gulp",
"vinyl-adapter",
"vinyl",
"file",
"file system",
"fs",
"streams"
]
}
@@ -0,0 +1,157 @@
// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
import { util } from "../helpers/util.js";
const Test = z.object({
f1: z.number(),
f2: z.string().optional(),
f3: z.string().nullable(),
f4: z.array(z.object({ t: z.union([z.string(), z.boolean()]) })),
});
type TestFlattenedErrors = z.inferFlattenedErrors<typeof Test, { message: string; code: number }>;
type TestFormErrors = z.inferFlattenedErrors<typeof Test>;
test("default flattened errors type inference", () => {
type TestTypeErrors = {
formErrors: string[];
fieldErrors: { [P in keyof z.TypeOf<typeof Test>]?: string[] | undefined };
};
util.assertEqual<z.inferFlattenedErrors<typeof Test>, TestTypeErrors>(true);
util.assertEqual<z.inferFlattenedErrors<typeof Test, { message: string }>, TestTypeErrors>(false);
});
test("custom flattened errors type inference", () => {
type ErrorType = { message: string; code: number };
type TestTypeErrors = {
formErrors: ErrorType[];
fieldErrors: {
[P in keyof z.TypeOf<typeof Test>]?: ErrorType[] | undefined;
};
};
util.assertEqual<z.inferFlattenedErrors<typeof Test>, TestTypeErrors>(false);
util.assertEqual<z.inferFlattenedErrors<typeof Test, { message: string; code: number }>, TestTypeErrors>(true);
util.assertEqual<z.inferFlattenedErrors<typeof Test, { message: string }>, TestTypeErrors>(false);
});
test("form errors type inference", () => {
type TestTypeErrors = {
formErrors: string[];
fieldErrors: { [P in keyof z.TypeOf<typeof Test>]?: string[] | undefined };
};
util.assertEqual<z.inferFlattenedErrors<typeof Test>, TestTypeErrors>(true);
});
test(".flatten() type assertion", () => {
const parsed = Test.safeParse({}) as z.SafeParseError<void>;
const validFlattenedErrors: TestFlattenedErrors = parsed.error.flatten(() => ({ message: "", code: 0 }));
// @ts-expect-error should fail assertion between `TestFlattenedErrors` and unmapped `flatten()`.
const invalidFlattenedErrors: TestFlattenedErrors = parsed.error.flatten();
const validFormErrors: TestFormErrors = parsed.error.flatten();
// @ts-expect-error should fail assertion between `TestFormErrors` and mapped `flatten()`.
const invalidFormErrors: TestFormErrors = parsed.error.flatten(() => ({
message: "string",
code: 0,
}));
[validFlattenedErrors, invalidFlattenedErrors, validFormErrors, invalidFormErrors];
});
test(".formErrors type assertion", () => {
const parsed = Test.safeParse({}) as z.SafeParseError<void>;
const validFormErrors: TestFormErrors = parsed.error.formErrors;
// @ts-expect-error should fail assertion between `TestFlattenedErrors` and `.formErrors`.
const invalidFlattenedErrors: TestFlattenedErrors = parsed.error.formErrors;
[validFormErrors, invalidFlattenedErrors];
});
test("all errors", () => {
const propertySchema = z.string();
const schema = z
.object({
a: propertySchema,
b: propertySchema,
})
.refine(
(val) => {
return val.a === val.b;
},
{ message: "Must be equal" }
);
try {
schema.parse({
a: "asdf",
b: "qwer",
});
} catch (error) {
if (error instanceof z.ZodError) {
expect(error.flatten()).toEqual({
formErrors: ["Must be equal"],
fieldErrors: {},
});
}
}
try {
schema.parse({
a: null,
b: null,
});
} catch (_error) {
const error = _error as z.ZodError;
expect(error.flatten()).toEqual({
formErrors: [],
fieldErrors: {
a: ["Expected string, received null"],
b: ["Expected string, received null"],
},
});
expect(error.flatten((iss) => iss.message.toUpperCase())).toEqual({
formErrors: [],
fieldErrors: {
a: ["EXPECTED STRING, RECEIVED NULL"],
b: ["EXPECTED STRING, RECEIVED NULL"],
},
});
// Test identity
expect(error.flatten((i: z.ZodIssue) => i)).toEqual({
formErrors: [],
fieldErrors: {
a: [
{
code: "invalid_type",
expected: "string",
message: "Expected string, received null",
path: ["a"],
received: "null",
},
],
b: [
{
code: "invalid_type",
expected: "string",
message: "Expected string, received null",
path: ["b"],
received: "null",
},
],
},
});
// Test mapping
expect(error.flatten((i: z.ZodIssue) => i.message.length)).toEqual({
formErrors: [],
fieldErrors: {
a: ["Expected string, received null".length],
b: ["Expected string, received null".length],
},
});
}
});
@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cloneBinding = cloneBinding;
const BindingType_1 = require("../models/BindingType");
const cloneConstantValueBinding_1 = require("./cloneConstantValueBinding");
const cloneDynamicValueBinding_1 = require("./cloneDynamicValueBinding");
const cloneFactoryBinding_1 = require("./cloneFactoryBinding");
const cloneInstanceBinding_1 = require("./cloneInstanceBinding");
const cloneProviderBinding_1 = require("./cloneProviderBinding");
const cloneResolvedValueBinding_1 = require("./cloneResolvedValueBinding");
const cloneServiceRedirectionBinding_1 = require("./cloneServiceRedirectionBinding");
/**
* Creates a deep clone of a binding.
*
* @param binding - The binding to clone
* @returns A clone of the binding
*/
function cloneBinding(binding) {
// Switch based on binding type to delegate to specific clone functions
switch (binding.type) {
case BindingType_1.bindingTypeValues.ConstantValue:
return (0, cloneConstantValueBinding_1.cloneConstantValueBinding)(binding);
case BindingType_1.bindingTypeValues.DynamicValue:
return (0, cloneDynamicValueBinding_1.cloneDynamicValueBinding)(binding);
case BindingType_1.bindingTypeValues.Factory:
return (0, cloneFactoryBinding_1.cloneFactoryBinding)(binding);
case BindingType_1.bindingTypeValues.Instance:
return (0, cloneInstanceBinding_1.cloneInstanceBinding)(binding);
case BindingType_1.bindingTypeValues.Provider:
return (0, cloneProviderBinding_1.cloneProviderBinding)(binding);
case BindingType_1.bindingTypeValues.ResolvedValue:
return (0, cloneResolvedValueBinding_1.cloneResolvedValueBinding)(binding);
case BindingType_1.bindingTypeValues.ServiceRedirection:
return (0, cloneServiceRedirectionBinding_1.cloneServiceRedirectionBinding)(binding);
}
}
//# sourceMappingURL=cloneBinding.js.map
@@ -0,0 +1,3 @@
import CryptoJS = require("./index");
export = CryptoJS.mode.CFB;
@@ -0,0 +1,86 @@
'use strict';
const fs = require('fs');
const path = require('path');
const stream = require('stream');
const tar = require('tar-stream');
const utils = require('../utils');
const ready = require('get-ready');
class TarFileStream extends stream.Transform {
constructor(opts) {
super(opts);
const pack = tar.pack();
pack.on('data', chunk => this.push(chunk));
pack.on('end', () => this.ready(true));
const sourceType = utils.sourceType(opts.source);
if (sourceType === 'file') {
// stat file to get file size
fs.stat(opts.source, (err, stat) => {
if (err) return this.emit('error', err);
this.entry = pack.entry({ name: opts.relativePath || path.basename(opts.source), size: stat.size, mode: stat.mode & 0o777 }, err => {
if (err) return this.emit('error', err);
pack.finalize();
});
const stream = fs.createReadStream(opts.source, opts.fs);
stream.on('error', err => this.emit('error', err));
stream.pipe(this);
});
} else if (sourceType === 'buffer') {
if (!opts.relativePath) return this.emit('error', 'opts.relativePath is required if opts.source is a buffer');
pack.entry({ name: opts.relativePath }, opts.source);
pack.finalize();
this.end();
} else { // stream or undefined
if (!opts.relativePath) return process.nextTick(() => this.emit('error', 'opts.relativePath is required'));
if (opts.size) {
this.entry = pack.entry({ name: opts.relativePath, size: opts.size }, err => {
if (err) return this.emit('error', err);
pack.finalize();
});
} else {
if (!opts.suppressSizeWarning) {
console.warn('You should specify the size of streamming data by opts.size to prevent all streaming data from loading into memory. If you are sure about memory cost, pass opts.suppressSizeWarning: true to suppress this warning');
}
const buf = [];
this.entry = new stream.Writable({
write(chunk, _, callback) {
buf.push(chunk);
callback();
},
});
this.entry.on('finish', () => {
pack.entry({ name: opts.relativePath }, Buffer.concat(buf));
pack.finalize();
});
}
if (sourceType === 'stream') {
opts.source.on('error', err => this.emit('error', err));
opts.source.pipe(this);
}
}
}
_transform(chunk, encoding, callback) {
if (this.entry) {
this.entry.write(chunk, encoding, callback);
}
}
_flush(callback) {
if (this.entry) {
this.entry.end();
}
this.ready(callback);
}
}
ready.mixin(TarFileStream.prototype);
module.exports = TarFileStream;
@@ -0,0 +1,3 @@
export * from "./lib/index.js";
export type LightOptions = import('./lib/index.js').LightOptions;
export type Options = import('./lib/index.js').Options;
@@ -0,0 +1,796 @@
var fs = require("fs");
var zlib = require("zlib");
var fd_slicer = require("fd-slicer2");
var crc32 = require("buffer-crc32");
var util = require("util");
var EventEmitter = require("events").EventEmitter;
var Transform = require("stream").Transform;
var PassThrough = require("stream").PassThrough;
var Writable = require("stream").Writable;
exports.open = open;
exports.fromFd = fromFd;
exports.fromBuffer = fromBuffer;
exports.fromRandomAccessReader = fromRandomAccessReader;
exports.dosDateTimeToDate = dosDateTimeToDate;
exports.validateFileName = validateFileName;
exports.ZipFile = ZipFile;
exports.Entry = Entry;
exports.RandomAccessReader = RandomAccessReader;
function open(path, options, callback) {
if (typeof options === "function") {
callback = options;
options = null;
}
if (options == null) options = {};
if (options.autoClose == null) options.autoClose = true;
if (options.lazyEntries == null) options.lazyEntries = false;
if (options.decodeStrings == null) options.decodeStrings = true;
if (options.validateEntrySizes == null) options.validateEntrySizes = true;
if (options.strictFileNames == null) options.strictFileNames = false;
if (callback == null) callback = defaultCallback;
fs.open(path, "r", function(err, fd) {
if (err) return callback(err);
fromFd(fd, options, function(err, zipfile) {
if (err) fs.close(fd, defaultCallback);
callback(err, zipfile);
});
});
}
function fromFd(fd, options, callback) {
if (typeof options === "function") {
callback = options;
options = null;
}
if (options == null) options = {};
if (options.autoClose == null) options.autoClose = false;
if (options.lazyEntries == null) options.lazyEntries = false;
if (options.decodeStrings == null) options.decodeStrings = true;
if (options.validateEntrySizes == null) options.validateEntrySizes = true;
if (options.strictFileNames == null) options.strictFileNames = false;
if (callback == null) callback = defaultCallback;
fs.fstat(fd, function(err, stats) {
if (err) return callback(err);
var reader = fd_slicer.createFromFd(fd, {autoClose: true});
fromRandomAccessReader(reader, stats.size, options, callback);
});
}
function fromBuffer(buffer, options, callback) {
if (typeof options === "function") {
callback = options;
options = null;
}
if (options == null) options = {};
options.autoClose = false;
if (options.lazyEntries == null) options.lazyEntries = false;
if (options.decodeStrings == null) options.decodeStrings = true;
if (options.validateEntrySizes == null) options.validateEntrySizes = true;
if (options.strictFileNames == null) options.strictFileNames = false;
// limit the max chunk size. see https://github.com/thejoshwolfe/yauzl/issues/87
var reader = fd_slicer.createFromBuffer(buffer, {maxChunkSize: 0x10000});
fromRandomAccessReader(reader, buffer.length, options, callback);
}
function fromRandomAccessReader(reader, totalSize, options, callback) {
if (typeof options === "function") {
callback = options;
options = null;
}
if (options == null) options = {};
if (options.autoClose == null) options.autoClose = true;
if (options.lazyEntries == null) options.lazyEntries = false;
if (options.decodeStrings == null) options.decodeStrings = true;
var decodeStrings = !!options.decodeStrings;
if (options.validateEntrySizes == null) options.validateEntrySizes = true;
if (options.strictFileNames == null) options.strictFileNames = false;
if (callback == null) callback = defaultCallback;
if (typeof totalSize !== "number") throw new Error("expected totalSize parameter to be a number");
if (totalSize > Number.MAX_SAFE_INTEGER) {
throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");
}
// the matching unref() call is in zipfile.close()
reader.ref();
// eocdr means End of Central Directory Record.
// search backwards for the eocdr signature.
// the last field of the eocdr is a variable-length comment.
// the comment size is encoded in a 2-byte field in the eocdr, which we can't find without trudging backwards through the comment to find it.
// as a consequence of this design decision, it's possible to have ambiguous zip file metadata if a coherent eocdr was in the comment.
// we search backwards for a eocdr signature, and hope that whoever made the zip file was smart enough to forbid the eocdr signature in the comment.
var eocdrWithoutCommentSize = 22;
var maxCommentSize = 0xffff; // 2-byte size
var bufferSize = Math.min(eocdrWithoutCommentSize + maxCommentSize, totalSize);
var buffer = newBuffer(bufferSize);
var bufferReadStart = totalSize - buffer.length;
readAndAssertNoEof(reader, buffer, 0, bufferSize, bufferReadStart, function(err) {
if (err) return callback(err);
for (var i = bufferSize - eocdrWithoutCommentSize; i >= 0; i -= 1) {
if (buffer.readUInt32LE(i) !== 0x06054b50) continue;
// found eocdr
var eocdrBuffer = buffer.slice(i);
// 0 - End of central directory signature = 0x06054b50
// 4 - Number of this disk
var diskNumber = eocdrBuffer.readUInt16LE(4);
if (diskNumber !== 0) {
return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
}
// 6 - Disk where central directory starts
// 8 - Number of central directory records on this disk
// 10 - Total number of central directory records
var entryCount = eocdrBuffer.readUInt16LE(10);
// 12 - Size of central directory (bytes)
// 16 - Offset of start of central directory, relative to start of archive
var centralDirectoryOffset = eocdrBuffer.readUInt32LE(16);
// 20 - Comment length
var commentLength = eocdrBuffer.readUInt16LE(20);
var expectedCommentLength = eocdrBuffer.length - eocdrWithoutCommentSize;
if (commentLength !== expectedCommentLength) {
return callback(new Error("invalid comment length. expected: " + expectedCommentLength + ". found: " + commentLength));
}
// 22 - Comment
// the encoding is always cp437.
var comment = decodeStrings ? decodeBuffer(eocdrBuffer, 22, eocdrBuffer.length, false)
: eocdrBuffer.slice(22);
if (!(entryCount === 0xffff || centralDirectoryOffset === 0xffffffff)) {
return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes, options.strictFileNames));
}
// ZIP64 format
// ZIP64 Zip64 end of central directory locator
var zip64EocdlBuffer = newBuffer(20);
var zip64EocdlOffset = bufferReadStart + i - zip64EocdlBuffer.length;
readAndAssertNoEof(reader, zip64EocdlBuffer, 0, zip64EocdlBuffer.length, zip64EocdlOffset, function(err) {
if (err) return callback(err);
// 0 - zip64 end of central dir locator signature = 0x07064b50
if (zip64EocdlBuffer.readUInt32LE(0) !== 0x07064b50) {
return callback(new Error("invalid zip64 end of central directory locator signature"));
}
// 4 - number of the disk with the start of the zip64 end of central directory
// 8 - relative offset of the zip64 end of central directory record
var zip64EocdrOffset = readUInt64LE(zip64EocdlBuffer, 8);
// 16 - total number of disks
// ZIP64 end of central directory record
var zip64EocdrBuffer = newBuffer(56);
readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err) {
if (err) return callback(err);
// 0 - zip64 end of central dir signature 4 bytes (0x06064b50)
if (zip64EocdrBuffer.readUInt32LE(0) !== 0x06064b50) {
return callback(new Error("invalid zip64 end of central directory record signature"));
}
// 4 - size of zip64 end of central directory record 8 bytes
// 12 - version made by 2 bytes
// 14 - version needed to extract 2 bytes
// 16 - number of this disk 4 bytes
// 20 - number of the disk with the start of the central directory 4 bytes
// 24 - total number of entries in the central directory on this disk 8 bytes
// 32 - total number of entries in the central directory 8 bytes
entryCount = readUInt64LE(zip64EocdrBuffer, 32);
// 40 - size of the central directory 8 bytes
// 48 - offset of start of central directory with respect to the starting disk number 8 bytes
centralDirectoryOffset = readUInt64LE(zip64EocdrBuffer, 48);
// 56 - zip64 extensible data sector (variable size)
return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes, options.strictFileNames));
});
});
return;
}
callback(new Error("end of central directory record signature not found"));
});
}
util.inherits(ZipFile, EventEmitter);
function ZipFile(reader, centralDirectoryOffset, fileSize, entryCount, comment, autoClose, lazyEntries, decodeStrings, validateEntrySizes, strictFileNames) {
var self = this;
EventEmitter.call(self);
self.reader = reader;
// forward close events
self.reader.on("error", function(err) {
// error closing the fd
emitError(self, err);
});
self.reader.once("close", function() {
self.emit("close");
});
self.readEntryCursor = centralDirectoryOffset;
self.fileSize = fileSize;
self.entryCount = entryCount;
self.comment = comment;
self.entriesRead = 0;
self.autoClose = !!autoClose;
self.lazyEntries = !!lazyEntries;
self.decodeStrings = !!decodeStrings;
self.validateEntrySizes = !!validateEntrySizes;
self.strictFileNames = !!strictFileNames;
self.isOpen = true;
self.emittedError = false;
if (!self.lazyEntries) self._readEntry();
}
ZipFile.prototype.close = function() {
if (!this.isOpen) return;
this.isOpen = false;
this.reader.unref();
};
function emitErrorAndAutoClose(self, err) {
if (self.autoClose) self.close();
emitError(self, err);
}
function emitError(self, err) {
if (self.emittedError) return;
self.emittedError = true;
self.emit("error", err);
}
ZipFile.prototype.readEntry = function() {
if (!this.lazyEntries) throw new Error("readEntry() called without lazyEntries:true");
this._readEntry();
};
ZipFile.prototype._readEntry = function() {
var self = this;
if (self.entryCount === self.entriesRead) {
// done with metadata
setImmediate(function() {
if (self.autoClose) self.close();
if (self.emittedError) return;
self.emit("end");
});
return;
}
if (self.emittedError) return;
var buffer = newBuffer(46);
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) {
if (err) return emitErrorAndAutoClose(self, err);
if (self.emittedError) return;
var entry = new Entry();
// 0 - Central directory file header signature
var signature = buffer.readUInt32LE(0);
if (signature !== 0x02014b50) return emitErrorAndAutoClose(self, new Error("invalid central directory file header signature: 0x" + signature.toString(16)));
// 4 - Version made by
entry.versionMadeBy = buffer.readUInt16LE(4);
// 6 - Version needed to extract (minimum)
entry.versionNeededToExtract = buffer.readUInt16LE(6);
// 8 - General purpose bit flag
entry.generalPurposeBitFlag = buffer.readUInt16LE(8);
// 10 - Compression method
entry.compressionMethod = buffer.readUInt16LE(10);
// 12 - File last modification time
entry.lastModFileTime = buffer.readUInt16LE(12);
// 14 - File last modification date
entry.lastModFileDate = buffer.readUInt16LE(14);
// 16 - CRC-32
entry.crc32 = buffer.readUInt32LE(16);
// 20 - Compressed size
entry.compressedSize = buffer.readUInt32LE(20);
// 24 - Uncompressed size
entry.uncompressedSize = buffer.readUInt32LE(24);
// 28 - File name length (n)
entry.fileNameLength = buffer.readUInt16LE(28);
// 30 - Extra field length (m)
entry.extraFieldLength = buffer.readUInt16LE(30);
// 32 - File comment length (k)
entry.fileCommentLength = buffer.readUInt16LE(32);
// 34 - Disk number where file starts
// 36 - Internal file attributes
entry.internalFileAttributes = buffer.readUInt16LE(36);
// 38 - External file attributes
entry.externalFileAttributes = buffer.readUInt32LE(38);
// 42 - Relative offset of local file header
entry.relativeOffsetOfLocalHeader = buffer.readUInt32LE(42);
if (entry.generalPurposeBitFlag & 0x40) return emitErrorAndAutoClose(self, new Error("strong encryption is not supported"));
self.readEntryCursor += 46;
buffer = newBuffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength);
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) {
if (err) return emitErrorAndAutoClose(self, err);
if (self.emittedError) return;
// 46 - File name
var isUtf8 = (entry.generalPurposeBitFlag & 0x800) !== 0;
entry.fileName = self.decodeStrings ? decodeBuffer(buffer, 0, entry.fileNameLength, isUtf8)
: buffer.slice(0, entry.fileNameLength);
// 46+n - Extra field
var fileCommentStart = entry.fileNameLength + entry.extraFieldLength;
var extraFieldBuffer = buffer.slice(entry.fileNameLength, fileCommentStart);
entry.extraFields = [];
var i = 0;
while (i < extraFieldBuffer.length - 3) {
var headerId = extraFieldBuffer.readUInt16LE(i + 0);
var dataSize = extraFieldBuffer.readUInt16LE(i + 2);
var dataStart = i + 4;
var dataEnd = dataStart + dataSize;
if (dataEnd > extraFieldBuffer.length) return emitErrorAndAutoClose(self, new Error("extra field length exceeds extra field buffer size"));
var dataBuffer = newBuffer(dataSize);
extraFieldBuffer.copy(dataBuffer, 0, dataStart, dataEnd);
entry.extraFields.push({
id: headerId,
data: dataBuffer,
});
i = dataEnd;
}
// 46+n+m - File comment
entry.fileComment = self.decodeStrings ? decodeBuffer(buffer, fileCommentStart, fileCommentStart + entry.fileCommentLength, isUtf8)
: buffer.slice(fileCommentStart, fileCommentStart + entry.fileCommentLength);
// compatibility hack for https://github.com/thejoshwolfe/yauzl/issues/47
entry.comment = entry.fileComment;
self.readEntryCursor += buffer.length;
self.entriesRead += 1;
if (entry.uncompressedSize === 0xffffffff ||
entry.compressedSize === 0xffffffff ||
entry.relativeOffsetOfLocalHeader === 0xffffffff) {
// ZIP64 format
// find the Zip64 Extended Information Extra Field
var zip64EiefBuffer = null;
for (var i = 0; i < entry.extraFields.length; i++) {
var extraField = entry.extraFields[i];
if (extraField.id === 0x0001) {
zip64EiefBuffer = extraField.data;
break;
}
}
if (zip64EiefBuffer == null) {
return emitErrorAndAutoClose(self, new Error("expected zip64 extended information extra field"));
}
var index = 0;
// 0 - Original Size 8 bytes
if (entry.uncompressedSize === 0xffffffff) {
if (index + 8 > zip64EiefBuffer.length) {
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include uncompressed size"));
}
entry.uncompressedSize = readUInt64LE(zip64EiefBuffer, index);
index += 8;
}
// 8 - Compressed Size 8 bytes
if (entry.compressedSize === 0xffffffff) {
if (index + 8 > zip64EiefBuffer.length) {
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include compressed size"));
}
entry.compressedSize = readUInt64LE(zip64EiefBuffer, index);
index += 8;
}
// 16 - Relative Header Offset 8 bytes
if (entry.relativeOffsetOfLocalHeader === 0xffffffff) {
if (index + 8 > zip64EiefBuffer.length) {
return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include relative header offset"));
}
entry.relativeOffsetOfLocalHeader = readUInt64LE(zip64EiefBuffer, index);
index += 8;
}
// 24 - Disk Start Number 4 bytes
}
// check for Info-ZIP Unicode Path Extra Field (0x7075)
// see https://github.com/thejoshwolfe/yauzl/issues/33
if (self.decodeStrings) {
for (var i = 0; i < entry.extraFields.length; i++) {
var extraField = entry.extraFields[i];
if (extraField.id === 0x7075) {
if (extraField.data.length < 6) {
// too short to be meaningful
continue;
}
// Version 1 byte version of this extra field, currently 1
if (extraField.data.readUInt8(0) !== 1) {
// > Changes may not be backward compatible so this extra
// > field should not be used if the version is not recognized.
continue;
}
// NameCRC32 4 bytes File Name Field CRC32 Checksum
var oldNameCrc32 = extraField.data.readUInt32LE(1);
if (crc32.unsigned(buffer.slice(0, entry.fileNameLength)) !== oldNameCrc32) {
// > If the CRC check fails, this UTF-8 Path Extra Field should be
// > ignored and the File Name field in the header should be used instead.
continue;
}
// UnicodeName Variable UTF-8 version of the entry File Name
entry.fileName = decodeBuffer(extraField.data, 5, extraField.data.length, true);
break;
}
}
}
// validate file size
if (self.validateEntrySizes && entry.compressionMethod === 0) {
var expectedCompressedSize = entry.uncompressedSize;
if (entry.isEncrypted()) {
// traditional encryption prefixes the file data with a header
expectedCompressedSize += 12;
}
if (entry.compressedSize !== expectedCompressedSize) {
var msg = "compressed/uncompressed size mismatch for stored file: " + entry.compressedSize + " != " + entry.uncompressedSize;
return emitErrorAndAutoClose(self, new Error(msg));
}
}
if (self.decodeStrings) {
if (!self.strictFileNames) {
// allow backslash
entry.fileName = entry.fileName.replace(/\\/g, "/");
}
var errorMessage = validateFileName(entry.fileName, self.validateFileNameOptions);
if (errorMessage != null) return emitErrorAndAutoClose(self, new Error(errorMessage));
}
self.emit("entry", entry);
if (!self.lazyEntries) self._readEntry();
});
});
};
ZipFile.prototype.openReadStream = function(entry, options, callback) {
var self = this;
// parameter validation
var relativeStart = 0;
var relativeEnd = entry.compressedSize;
if (callback == null) {
callback = options;
options = {};
} else {
// validate options that the caller has no excuse to get wrong
if (options.decrypt != null) {
if (!entry.isEncrypted()) {
throw new Error("options.decrypt can only be specified for encrypted entries");
}
if (options.decrypt !== false) throw new Error("invalid options.decrypt value: " + options.decrypt);
if (entry.isCompressed()) {
if (options.decompress !== false) throw new Error("entry is encrypted and compressed, and options.decompress !== false");
}
}
if (options.decompress != null) {
if (!entry.isCompressed()) {
throw new Error("options.decompress can only be specified for compressed entries");
}
if (!(options.decompress === false || options.decompress === true)) {
throw new Error("invalid options.decompress value: " + options.decompress);
}
}
if (options.start != null || options.end != null) {
if (entry.isCompressed() && options.decompress !== false) {
throw new Error("start/end range not allowed for compressed entry without options.decompress === false");
}
if (entry.isEncrypted() && options.decrypt !== false) {
throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false");
}
}
if (options.start != null) {
relativeStart = options.start;
if (relativeStart < 0) throw new Error("options.start < 0");
if (relativeStart > entry.compressedSize) throw new Error("options.start > entry.compressedSize");
}
if (options.end != null) {
relativeEnd = options.end;
if (relativeEnd < 0) throw new Error("options.end < 0");
if (relativeEnd > entry.compressedSize) throw new Error("options.end > entry.compressedSize");
if (relativeEnd < relativeStart) throw new Error("options.end < options.start");
}
}
// any further errors can either be caused by the zipfile,
// or were introduced in a minor version of yauzl,
// so should be passed to the client rather than thrown.
if (!self.isOpen) return callback(new Error("closed"));
if (entry.isEncrypted()) {
if (options.decrypt !== false) return callback(new Error("entry is encrypted, and options.decrypt !== false"));
}
// make sure we don't lose the fd before we open the actual read stream
self.reader.ref();
var buffer = newBuffer(30);
readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader, function(err) {
try {
if (err) return callback(err);
// 0 - Local file header signature = 0x04034b50
var signature = buffer.readUInt32LE(0);
if (signature !== 0x04034b50) {
return callback(new Error("invalid local file header signature: 0x" + signature.toString(16)));
}
// all this should be redundant
// 4 - Version needed to extract (minimum)
// 6 - General purpose bit flag
// 8 - Compression method
// 10 - File last modification time
// 12 - File last modification date
// 14 - CRC-32
// 18 - Compressed size
// 22 - Uncompressed size
// 26 - File name length (n)
var fileNameLength = buffer.readUInt16LE(26);
// 28 - Extra field length (m)
var extraFieldLength = buffer.readUInt16LE(28);
// 30 - File name
// 30+n - Extra field
var localFileHeaderEnd = entry.relativeOffsetOfLocalHeader + buffer.length + fileNameLength + extraFieldLength;
var decompress;
if (entry.compressionMethod === 0) {
// 0 - The file is stored (no compression)
decompress = false;
} else if (entry.compressionMethod === 8) {
// 8 - The file is Deflated
decompress = options.decompress != null ? options.decompress : true;
} else {
return callback(new Error("unsupported compression method: " + entry.compressionMethod));
}
var fileDataStart = localFileHeaderEnd;
var fileDataEnd = fileDataStart + entry.compressedSize;
if (entry.compressedSize !== 0) {
// bounds check now, because the read streams will probably not complain loud enough.
// since we're dealing with an unsigned offset plus an unsigned size,
// we only have 1 thing to check for.
if (fileDataEnd > self.fileSize) {
return callback(new Error("file data overflows file bounds: " +
fileDataStart + " + " + entry.compressedSize + " > " + self.fileSize));
}
}
var readStream = self.reader.createReadStream({
start: fileDataStart + relativeStart,
end: fileDataStart + relativeEnd,
});
var endpointStream = readStream;
if (decompress) {
var destroyed = false;
var inflateFilter = zlib.createInflateRaw();
readStream.on("error", function(err) {
// setImmediate here because errors can be emitted during the first call to pipe()
setImmediate(function() {
if (!destroyed) inflateFilter.emit("error", err);
});
});
readStream.pipe(inflateFilter);
if (self.validateEntrySizes) {
endpointStream = new AssertByteCountStream(entry.uncompressedSize);
inflateFilter.on("error", function(err) {
// forward zlib errors to the client-visible stream
setImmediate(function() {
if (!destroyed) endpointStream.emit("error", err);
});
});
inflateFilter.pipe(endpointStream);
} else {
// the zlib filter is the client-visible stream
endpointStream = inflateFilter;
}
// this is part of yauzl's API, so implement this function on the client-visible stream
endpointStream.destroy = function() {
destroyed = true;
if (inflateFilter !== endpointStream) inflateFilter.unpipe(endpointStream);
readStream.unpipe(inflateFilter);
// TODO: the inflateFilter may cause a memory leak. see Issue #27.
readStream.destroy();
};
}
callback(null, endpointStream);
} finally {
self.reader.unref();
}
});
};
function Entry() {
}
Entry.prototype.getLastModDate = function() {
return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime);
};
Entry.prototype.isEncrypted = function() {
return (this.generalPurposeBitFlag & 0x1) !== 0;
};
Entry.prototype.isCompressed = function() {
return this.compressionMethod === 8;
};
function dosDateTimeToDate(date, time) {
var day = date & 0x1f; // 1-31
var month = (date >> 5 & 0xf) - 1; // 1-12, 0-11
var year = (date >> 9 & 0x7f) + 1980; // 0-128, 1980-2108
var millisecond = 0;
var second = (time & 0x1f) * 2; // 0-29, 0-58 (even numbers)
var minute = time >> 5 & 0x3f; // 0-59
var hour = time >> 11 & 0x1f; // 0-23
return new Date(year, month, day, hour, minute, second, millisecond);
}
function validateFileName(fileName) {
if (fileName.indexOf("\\") !== -1) {
return "invalid characters in fileName: " + fileName;
}
if (/^[a-zA-Z]:/.test(fileName) || /^\//.test(fileName)) {
return "absolute path: " + fileName;
}
if (fileName.split("/").indexOf("..") !== -1) {
return "invalid relative path: " + fileName;
}
// all good
return null;
}
function readAndAssertNoEof(reader, buffer, offset, length, position, callback) {
if (length === 0) {
// fs.read will throw an out-of-bounds error if you try to read 0 bytes from a 0 byte file
return setImmediate(function() { callback(null, newBuffer(0)); });
}
reader.read(buffer, offset, length, position, function(err, bytesRead) {
if (err) return callback(err);
if (bytesRead < length) {
return callback(new Error("unexpected EOF"));
}
callback();
});
}
util.inherits(AssertByteCountStream, Transform);
function AssertByteCountStream(byteCount) {
Transform.call(this);
this.actualByteCount = 0;
this.expectedByteCount = byteCount;
}
AssertByteCountStream.prototype._transform = function(chunk, encoding, cb) {
this.actualByteCount += chunk.length;
if (this.actualByteCount > this.expectedByteCount) {
var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount;
return cb(new Error(msg));
}
cb(null, chunk);
};
AssertByteCountStream.prototype._flush = function(cb) {
if (this.actualByteCount < this.expectedByteCount) {
var msg = "not enough bytes in the stream. expected " + this.expectedByteCount + ". got only " + this.actualByteCount;
return cb(new Error(msg));
}
cb();
};
util.inherits(RandomAccessReader, EventEmitter);
function RandomAccessReader() {
EventEmitter.call(this);
this.refCount = 0;
}
RandomAccessReader.prototype.ref = function() {
this.refCount += 1;
};
RandomAccessReader.prototype.unref = function() {
var self = this;
self.refCount -= 1;
if (self.refCount > 0) return;
if (self.refCount < 0) throw new Error("invalid unref");
self.close(onCloseDone);
function onCloseDone(err) {
if (err) return self.emit('error', err);
self.emit('close');
}
};
RandomAccessReader.prototype.createReadStream = function(options) {
var start = options.start;
var end = options.end;
if (start === end) {
var emptyStream = new PassThrough();
setImmediate(function() {
emptyStream.end();
});
return emptyStream;
}
var stream = this._readStreamForRange(start, end);
var destroyed = false;
var refUnrefFilter = new RefUnrefFilter(this);
stream.on("error", function(err) {
setImmediate(function() {
if (!destroyed) refUnrefFilter.emit("error", err);
});
});
refUnrefFilter.destroy = function() {
stream.unpipe(refUnrefFilter);
refUnrefFilter.unref();
stream.destroy();
};
var byteCounter = new AssertByteCountStream(end - start);
refUnrefFilter.on("error", function(err) {
setImmediate(function() {
if (!destroyed) byteCounter.emit("error", err);
});
});
byteCounter.destroy = function() {
destroyed = true;
refUnrefFilter.unpipe(byteCounter);
refUnrefFilter.destroy();
};
return stream.pipe(refUnrefFilter).pipe(byteCounter);
};
RandomAccessReader.prototype._readStreamForRange = function(start, end) {
throw new Error("not implemented");
};
RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) {
var readStream = this.createReadStream({start: position, end: position + length});
var writeStream = new Writable();
var written = 0;
writeStream._write = function(chunk, encoding, cb) {
chunk.copy(buffer, offset + written, 0, chunk.length);
written += chunk.length;
cb();
};
writeStream.on("finish", callback);
readStream.on("error", function(error) {
callback(error);
});
readStream.pipe(writeStream);
};
RandomAccessReader.prototype.close = function(callback) {
setImmediate(callback);
};
util.inherits(RefUnrefFilter, PassThrough);
function RefUnrefFilter(context) {
PassThrough.call(this);
this.context = context;
this.context.ref();
this.unreffedYet = false;
}
RefUnrefFilter.prototype._flush = function(cb) {
this.unref();
cb();
};
RefUnrefFilter.prototype.unref = function(cb) {
if (this.unreffedYet) return;
this.unreffedYet = true;
this.context.unref();
};
var cp437 = '\u0000☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ';
function decodeBuffer(buffer, start, end, isUtf8) {
if (isUtf8) {
return buffer.toString("utf8", start, end);
} else {
var result = "";
for (var i = start; i < end; i++) {
result += cp437[buffer[i]];
}
return result;
}
}
function readUInt64LE(buffer, offset) {
// there is no native function for this, because we can't actually store 64-bit integers precisely.
// after 53 bits, JavaScript's Number type (IEEE 754 double) can't store individual integers anymore.
// but since 53 bits is a whole lot more than 32 bits, we do our best anyway.
var lower32 = buffer.readUInt32LE(offset);
var upper32 = buffer.readUInt32LE(offset + 4);
// we can't use bitshifting here, because JavaScript bitshifting only works on 32-bit integers.
return upper32 * 0x100000000 + lower32;
// as long as we're bounds checking the result of this function against the total file size,
// we'll catch any overflow errors, because we already made sure the total file size was within reason.
}
// Node 10 deprecated new Buffer().
var newBuffer;
if (typeof Buffer.allocUnsafe === "function") {
newBuffer = function(len) {
return Buffer.allocUnsafe(len);
};
} else {
newBuffer = function(len) {
return new Buffer(len);
};
}
function defaultCallback(err) {
if (err) throw err;
}
@@ -0,0 +1,588 @@
//#region rolldown:runtime
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
//#endregion
const path = __toESM(require("path"));
const fs = __toESM(require("fs"));
//#region src/utils.ts
function cleanPath(path$1) {
let normalized = (0, path.normalize)(path$1);
if (normalized.length > 1 && normalized[normalized.length - 1] === path.sep) normalized = normalized.substring(0, normalized.length - 1);
return normalized;
}
const SLASHES_REGEX = /[\\/]/g;
function convertSlashes(path$1, separator) {
return path$1.replace(SLASHES_REGEX, separator);
}
const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
function isRootDirectory(path$1) {
return path$1 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$1);
}
function normalizePath(path$1, options) {
const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
if (resolvePaths) path$1 = (0, path.resolve)(path$1);
if (normalizePath$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
if (path$1 === ".") return "";
const needsSeperator = path$1[path$1.length - 1] !== pathSeparator;
return convertSlashes(needsSeperator ? path$1 + pathSeparator : path$1, pathSeparator);
}
//#endregion
//#region src/api/functions/join-path.ts
function joinPathWithBasePath(filename, directoryPath) {
return directoryPath + filename;
}
function joinPathWithRelativePath(root, options) {
return function(filename, directoryPath) {
const sameRoot = directoryPath.startsWith(root);
if (sameRoot) return directoryPath.slice(root.length) + filename;
else return convertSlashes((0, path.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
};
}
function joinPath(filename) {
return filename;
}
function joinDirectoryPath(filename, directoryPath, separator) {
return directoryPath + filename + separator;
}
function build$7(root, options) {
const { relativePaths, includeBasePath } = options;
return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath;
}
//#endregion
//#region src/api/functions/push-directory.ts
function pushDirectoryWithRelativePath(root) {
return function(directoryPath, paths) {
paths.push(directoryPath.substring(root.length) || ".");
};
}
function pushDirectoryFilterWithRelativePath(root) {
return function(directoryPath, paths, filters) {
const relativePath = directoryPath.substring(root.length) || ".";
if (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath);
};
}
const pushDirectory = (directoryPath, paths) => {
paths.push(directoryPath || ".");
};
const pushDirectoryFilter = (directoryPath, paths, filters) => {
const path$1 = directoryPath || ".";
if (filters.every((filter) => filter(path$1, true))) paths.push(path$1);
};
const empty$2 = () => {};
function build$6(root, options) {
const { includeDirs, filters, relativePaths } = options;
if (!includeDirs) return empty$2;
if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
return filters && filters.length ? pushDirectoryFilter : pushDirectory;
}
//#endregion
//#region src/api/functions/push-file.ts
const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
if (filters.every((filter) => filter(filename, false))) counts.files++;
};
const pushFileFilter = (filename, paths, _counts, filters) => {
if (filters.every((filter) => filter(filename, false))) paths.push(filename);
};
const pushFileCount = (_filename, _paths, counts, _filters) => {
counts.files++;
};
const pushFile = (filename, paths) => {
paths.push(filename);
};
const empty$1 = () => {};
function build$5(options) {
const { excludeFiles, filters, onlyCounts } = options;
if (excludeFiles) return empty$1;
if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
else if (onlyCounts) return pushFileCount;
else return pushFile;
}
//#endregion
//#region src/api/functions/get-array.ts
const getArray = (paths) => {
return paths;
};
const getArrayGroup = () => {
return [""].slice(0, 0);
};
function build$4(options) {
return options.group ? getArrayGroup : getArray;
}
//#endregion
//#region src/api/functions/group-files.ts
const groupFiles = (groups, directory, files) => {
groups.push({
directory,
files,
dir: directory
});
};
const empty = () => {};
function build$3(options) {
return options.group ? groupFiles : empty;
}
//#endregion
//#region src/api/functions/resolve-symlink.ts
const resolveSymlinksAsync = function(path$1, state, callback$1) {
const { queue, fs: fs$1, options: { suppressErrors } } = state;
queue.enqueue();
fs$1.realpath(path$1, (error, resolvedPath) => {
if (error) return queue.dequeue(suppressErrors ? null : error, state);
fs$1.stat(resolvedPath, (error$1, stat) => {
if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state);
callback$1(stat, resolvedPath);
queue.dequeue(null, state);
});
});
};
const resolveSymlinks = function(path$1, state, callback$1) {
const { queue, fs: fs$1, options: { suppressErrors } } = state;
queue.enqueue();
try {
const resolvedPath = fs$1.realpathSync(path$1);
const stat = fs$1.statSync(resolvedPath);
if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return;
callback$1(stat, resolvedPath);
} catch (e) {
if (!suppressErrors) throw e;
}
};
function build$2(options, isSynchronous) {
if (!options.resolveSymlinks || options.excludeSymlinks) return null;
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
}
function isRecursive(path$1, resolved, state) {
if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
let parent = (0, path.dirname)(path$1);
let depth = 1;
while (parent !== state.root && depth < 2) {
const resolvedPath = state.symlinks.get(parent);
const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));
if (isSameRoot) depth++;
else parent = (0, path.dirname)(parent);
}
state.symlinks.set(path$1, resolved);
return depth > 1;
}
function isRecursiveUsingRealPaths(resolved, state) {
return state.visited.includes(resolved + state.options.pathSeparator);
}
//#endregion
//#region src/api/functions/invoke-callback.ts
const onlyCountsSync = (state) => {
return state.counts;
};
const groupsSync = (state) => {
return state.groups;
};
const defaultSync = (state) => {
return state.paths;
};
const limitFilesSync = (state) => {
return state.paths.slice(0, state.options.maxFiles);
};
const onlyCountsAsync = (state, error, callback$1) => {
report(error, callback$1, state.counts, state.options.suppressErrors);
return null;
};
const defaultAsync = (state, error, callback$1) => {
report(error, callback$1, state.paths, state.options.suppressErrors);
return null;
};
const limitFilesAsync = (state, error, callback$1) => {
report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
return null;
};
const groupsAsync = (state, error, callback$1) => {
report(error, callback$1, state.groups, state.options.suppressErrors);
return null;
};
function report(error, callback$1, output, suppressErrors) {
if (error && !suppressErrors) callback$1(error, output);
else callback$1(null, output);
}
function build$1(options, isSynchronous) {
const { onlyCounts, group, maxFiles } = options;
if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
else if (group) return isSynchronous ? groupsSync : groupsAsync;
else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
else return isSynchronous ? defaultSync : defaultAsync;
}
//#endregion
//#region src/api/functions/walk-directory.ts
const readdirOpts = { withFileTypes: true };
const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
state.queue.enqueue();
if (currentDepth < 0) return state.queue.dequeue(null, state);
const { fs: fs$1 } = state;
state.visited.push(crawlPath);
state.counts.directories++;
fs$1.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
callback$1(entries, directoryPath, currentDepth);
state.queue.dequeue(state.options.suppressErrors ? null : error, state);
});
};
const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
const { fs: fs$1 } = state;
if (currentDepth < 0) return;
state.visited.push(crawlPath);
state.counts.directories++;
let entries = [];
try {
entries = fs$1.readdirSync(crawlPath || ".", readdirOpts);
} catch (e) {
if (!state.options.suppressErrors) throw e;
}
callback$1(entries, directoryPath, currentDepth);
};
function build(isSynchronous) {
return isSynchronous ? walkSync : walkAsync;
}
//#endregion
//#region src/api/queue.ts
/**
* This is a custom stateless queue to track concurrent async fs calls.
* It increments a counter whenever a call is queued and decrements it
* as soon as it completes. When the counter hits 0, it calls onQueueEmpty.
*/
var Queue = class {
count = 0;
constructor(onQueueEmpty) {
this.onQueueEmpty = onQueueEmpty;
}
enqueue() {
this.count++;
return this.count;
}
dequeue(error, output) {
if (this.onQueueEmpty && (--this.count <= 0 || error)) {
this.onQueueEmpty(error, output);
if (error) {
output.controller.abort();
this.onQueueEmpty = void 0;
}
}
}
};
//#endregion
//#region src/api/counter.ts
var Counter = class {
_files = 0;
_directories = 0;
set files(num) {
this._files = num;
}
get files() {
return this._files;
}
set directories(num) {
this._directories = num;
}
get directories() {
return this._directories;
}
/**
* @deprecated use `directories` instead
*/
/* c8 ignore next 3 */
get dirs() {
return this._directories;
}
};
//#endregion
//#region src/api/aborter.ts
/**
* AbortController is not supported on Node 14 so we use this until we can drop
* support for Node 14.
*/
var Aborter = class {
aborted = false;
abort() {
this.aborted = true;
}
};
//#endregion
//#region src/api/walker.ts
var Walker = class {
root;
isSynchronous;
state;
joinPath;
pushDirectory;
pushFile;
getArray;
groupFiles;
resolveSymlink;
walkDirectory;
callbackInvoker;
constructor(root, options, callback$1) {
this.isSynchronous = !callback$1;
this.callbackInvoker = build$1(options, this.isSynchronous);
this.root = normalizePath(root, options);
this.state = {
root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1),
paths: [""].slice(0, 0),
groups: [],
counts: new Counter(),
options,
queue: new Queue((error, state) => this.callbackInvoker(state, error, callback$1)),
symlinks: /* @__PURE__ */ new Map(),
visited: [""].slice(0, 0),
controller: new Aborter(),
fs: options.fs || fs
};
this.joinPath = build$7(this.root, options);
this.pushDirectory = build$6(this.root, options);
this.pushFile = build$5(options);
this.getArray = build$4(options);
this.groupFiles = build$3(options);
this.resolveSymlink = build$2(options, this.isSynchronous);
this.walkDirectory = build(this.isSynchronous);
}
start() {
this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
}
walk = (entries, directoryPath, depth) => {
const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
const files = this.getArray(this.state.paths);
for (let i = 0; i < entries.length; ++i) {
const entry = entries[i];
if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
const filename = this.joinPath(entry.name, directoryPath);
this.pushFile(filename, files, this.state.counts, filters);
} else if (entry.isDirectory()) {
let path$1 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
if (exclude && exclude(entry.name, path$1)) continue;
this.pushDirectory(path$1, paths, filters);
this.walkDirectory(this.state, path$1, path$1, depth - 1, this.walk);
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
let path$1 = joinPathWithBasePath(entry.name, directoryPath);
this.resolveSymlink(path$1, this.state, (stat, resolvedPath) => {
if (stat.isDirectory()) {
resolvedPath = normalizePath(resolvedPath, this.state.options);
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return;
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth - 1, this.walk);
} else {
resolvedPath = useRealPaths ? resolvedPath : path$1;
const filename = (0, path.basename)(resolvedPath);
const directoryPath$1 = normalizePath((0, path.dirname)(resolvedPath), this.state.options);
resolvedPath = this.joinPath(filename, directoryPath$1);
this.pushFile(resolvedPath, files, this.state.counts, filters);
}
});
}
}
this.groupFiles(this.state.groups, directoryPath, files);
};
};
//#endregion
//#region src/api/async.ts
function promise(root, options) {
return new Promise((resolve$1, reject) => {
callback(root, options, (err, output) => {
if (err) return reject(err);
resolve$1(output);
});
});
}
function callback(root, options, callback$1) {
let walker = new Walker(root, options, callback$1);
walker.start();
}
//#endregion
//#region src/api/sync.ts
function sync(root, options) {
const walker = new Walker(root, options);
return walker.start();
}
//#endregion
//#region src/builder/api-builder.ts
var APIBuilder = class {
constructor(root, options) {
this.root = root;
this.options = options;
}
withPromise() {
return promise(this.root, this.options);
}
withCallback(cb) {
callback(this.root, this.options, cb);
}
sync() {
return sync(this.root, this.options);
}
};
//#endregion
//#region src/builder/index.ts
let pm = null;
/* c8 ignore next 6 */
try {
require.resolve("picomatch");
pm = require("picomatch");
} catch {}
var Builder = class {
globCache = {};
options = {
maxDepth: Infinity,
suppressErrors: true,
pathSeparator: path.sep,
filters: []
};
globFunction;
constructor(options) {
this.options = {
...this.options,
...options
};
this.globFunction = this.options.globFunction;
}
group() {
this.options.group = true;
return this;
}
withPathSeparator(separator) {
this.options.pathSeparator = separator;
return this;
}
withBasePath() {
this.options.includeBasePath = true;
return this;
}
withRelativePaths() {
this.options.relativePaths = true;
return this;
}
withDirs() {
this.options.includeDirs = true;
return this;
}
withMaxDepth(depth) {
this.options.maxDepth = depth;
return this;
}
withMaxFiles(limit) {
this.options.maxFiles = limit;
return this;
}
withFullPaths() {
this.options.resolvePaths = true;
this.options.includeBasePath = true;
return this;
}
withErrors() {
this.options.suppressErrors = false;
return this;
}
withSymlinks({ resolvePaths = true } = {}) {
this.options.resolveSymlinks = true;
this.options.useRealPaths = resolvePaths;
return this.withFullPaths();
}
withAbortSignal(signal) {
this.options.signal = signal;
return this;
}
normalize() {
this.options.normalizePath = true;
return this;
}
filter(predicate) {
this.options.filters.push(predicate);
return this;
}
onlyDirs() {
this.options.excludeFiles = true;
this.options.includeDirs = true;
return this;
}
exclude(predicate) {
this.options.exclude = predicate;
return this;
}
onlyCounts() {
this.options.onlyCounts = true;
return this;
}
crawl(root) {
return new APIBuilder(root || ".", this.options);
}
withGlobFunction(fn) {
this.globFunction = fn;
return this;
}
/**
* @deprecated Pass options using the constructor instead:
* ```ts
* new fdir(options).crawl("/path/to/root");
* ```
* This method will be removed in v7.0
*/
/* c8 ignore next 4 */
crawlWithOptions(root, options) {
this.options = {
...this.options,
...options
};
return new APIBuilder(root || ".", this.options);
}
glob(...patterns) {
if (this.globFunction) return this.globWithOptions(patterns);
return this.globWithOptions(patterns, ...[{ dot: true }]);
}
globWithOptions(patterns, ...options) {
const globFn = this.globFunction || pm;
/* c8 ignore next 5 */
if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
var isMatch = this.globCache[patterns.join("\0")];
if (!isMatch) {
isMatch = globFn(patterns, ...options);
this.globCache[patterns.join("\0")] = isMatch;
}
this.options.filters.push((path$1) => isMatch(path$1));
return this;
}
};
//#endregion
exports.fdir = Builder;
@@ -0,0 +1 @@
{"version":3,"file":"toolbar.js","names":["Delta","EmbedBlot","Scope","Quill","logger","Module","debug","Toolbar","constructor","quill","options","Array","isArray","container","document","createElement","setAttribute","addControls","parentNode","insertBefore","querySelector","HTMLElement","error","classList","add","controls","handlers","Object","keys","forEach","format","handler","addHandler","from","querySelectorAll","input","attach","on","events","EDITOR_CHANGE","range","selection","getRange","update","find","className","indexOf","slice","length","tagName","scroll","query","warn","eventName","addEventListener","e","value","selectedIndex","selected","hasAttribute","contains","preventDefault","focus","call","prototype","prompt","updateContents","retain","index","delete","insert","sources","USER","push","formats","getFormat","pair","option","replace","remove","isActive","getAttribute","toString","toggle","DEFAULTS","addButton","appendChild","groups","group","control","addSelect","values","String","clean","getSelection","name","INLINE","removeFormat","direction","align","indent","parseInt","modifier","link","list","default"],"sources":["../../src/modules/toolbar.ts"],"sourcesContent":["import Delta from 'quill-delta';\nimport { EmbedBlot, Scope } from 'parchment';\nimport Quill from '../core/quill.js';\nimport logger from '../core/logger.js';\nimport Module from '../core/module.js';\nimport type { Range } from '../core/selection.js';\n\nconst debug = logger('quill:toolbar');\n\ntype Handler = (this: Toolbar, value: any) => void;\n\nexport type ToolbarConfig = Array<\n string[] | Array<string | Record<string, unknown>>\n>;\nexport interface ToolbarProps {\n container?: HTMLElement | ToolbarConfig | null;\n handlers?: Record<string, Handler>;\n option?: number;\n module?: boolean;\n theme?: boolean;\n}\n\nclass Toolbar extends Module<ToolbarProps> {\n static DEFAULTS: ToolbarProps;\n\n container?: HTMLElement | null;\n controls: [string, HTMLElement][];\n handlers: Record<string, Handler>;\n\n constructor(quill: Quill, options: Partial<ToolbarProps>) {\n super(quill, options);\n if (Array.isArray(this.options.container)) {\n const container = document.createElement('div');\n container.setAttribute('role', 'toolbar');\n addControls(container, this.options.container);\n quill.container?.parentNode?.insertBefore(container, quill.container);\n this.container = container;\n } else if (typeof this.options.container === 'string') {\n this.container = document.querySelector(this.options.container);\n } else {\n this.container = this.options.container;\n }\n if (!(this.container instanceof HTMLElement)) {\n debug.error('Container required for toolbar', this.options);\n return;\n }\n this.container.classList.add('ql-toolbar');\n this.controls = [];\n this.handlers = {};\n if (this.options.handlers) {\n Object.keys(this.options.handlers).forEach((format) => {\n const handler = this.options.handlers?.[format];\n if (handler) {\n this.addHandler(format, handler);\n }\n });\n }\n Array.from(this.container.querySelectorAll('button, select')).forEach(\n (input) => {\n // @ts-expect-error\n this.attach(input);\n },\n );\n this.quill.on(Quill.events.EDITOR_CHANGE, () => {\n const [range] = this.quill.selection.getRange(); // quill.getSelection triggers update\n this.update(range);\n });\n }\n\n addHandler(format: string, handler: Handler) {\n this.handlers[format] = handler;\n }\n\n attach(input: HTMLElement) {\n let format = Array.from(input.classList).find((className) => {\n return className.indexOf('ql-') === 0;\n });\n if (!format) return;\n format = format.slice('ql-'.length);\n if (input.tagName === 'BUTTON') {\n input.setAttribute('type', 'button');\n }\n if (\n this.handlers[format] == null &&\n this.quill.scroll.query(format) == null\n ) {\n debug.warn('ignoring attaching to nonexistent format', format, input);\n return;\n }\n const eventName = input.tagName === 'SELECT' ? 'change' : 'click';\n input.addEventListener(eventName, (e) => {\n let value;\n if (input.tagName === 'SELECT') {\n // @ts-expect-error\n if (input.selectedIndex < 0) return;\n // @ts-expect-error\n const selected = input.options[input.selectedIndex];\n if (selected.hasAttribute('selected')) {\n value = false;\n } else {\n value = selected.value || false;\n }\n } else {\n if (input.classList.contains('ql-active')) {\n value = false;\n } else {\n // @ts-expect-error\n value = input.value || !input.hasAttribute('value');\n }\n e.preventDefault();\n }\n this.quill.focus();\n const [range] = this.quill.selection.getRange();\n if (this.handlers[format] != nuLine truncated
@@ -0,0 +1,28 @@
var Symbol = require('./_Symbol'),
getRawTag = require('./_getRawTag'),
objectToString = require('./_objectToString');
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
}
module.exports = baseGetTag;
@@ -0,0 +1,97 @@
import type { TSESTree } from '@typescript-eslint/types';
import type { Definition } from '../definition';
import type { ReferenceImplicitGlobal } from '../referencer/Reference';
import type { ScopeManager } from '../ScopeManager';
import type { FunctionScope } from './FunctionScope';
import type { GlobalScope } from './GlobalScope';
import type { ModuleScope } from './ModuleScope';
import type { Scope } from './Scope';
import type { TSModuleScope } from './TSModuleScope';
import { Reference, ReferenceFlag } from '../referencer/Reference';
import { Variable } from '../variable';
import { ScopeType } from './ScopeType';
type VariableScope = FunctionScope | GlobalScope | ModuleScope | TSModuleScope;
export declare abstract class ScopeBase<Type extends ScopeType, Block extends TSESTree.Node, Upper extends Scope | null> {
#private;
/**
* A unique ID for this instance - primarily used to help debugging and testing
*/
readonly $id: number;
/**
* The AST node which created this scope.
* @public
*/
readonly block: Block;
/**
* The array of child scopes. This does not include grandchild scopes.
* @public
*/
readonly childScopes: Scope[];
/**
* Whether this scope is created by a FunctionExpression.
* @public
*/
readonly functionExpressionScope: boolean;
/**
* Whether 'use strict' is in effect in this scope.
* @public
*/
isStrict: boolean;
/**
* List of {@link Reference}s that are left to be resolved (i.e. which
* need to be linked to the variable they refer to).
*/
protected leftToResolve: Reference[] | null;
/**
* Any variable {@link Reference} found in this scope.
* This includes occurrences of local variables as well as variables from parent scopes (including the global scope).
* For local variables this also includes defining occurrences (like in a 'var' statement).
* In a 'function' scope this does not include the occurrences of the formal parameter in the parameter list.
* @public
*/
readonly references: Reference[];
/**
* The map from variable names to variable objects.
* @public
*/
readonly set: Map<string, Variable>;
/**
* The {@link Reference}s that are not resolved with this scope.
* @public
*/
readonly through: Reference[];
readonly type: Type;
/**
* Reference to the parent {@link Scope}.
* @public
*/
readonly upper: Upper;
/**
* The scoped {@link Variable}s of this scope.
* In the case of a 'function' scope this includes the automatic argument `arguments` as its first element, as well
* as all further formal arguments.
* This does not include variables which are defined in child scopes.
* @public
*/
readonly variables: Variable[];
readonly variableScope: VariableScope;
constructor(scopeManager: ScopeManager, type: Type, upperScope: Upper, block: Block, isMethodDefinition: boolean);
private isVariableScope;
private shouldStaticallyCloseForGlobal;
close(scopeManager: ScopeManager): Scope | null;
shouldStaticallyClose(): boolean;
/**
* To override by function scopes.
* References in default parameters isn't resolved to variables which are in their function body.
*/
protected defineVariable(nameOrVariable: string | Variable, set: Map<string, Variable>, variables: Variable[], node: TSESTree.Identifier | null, def: Definition | null): void;
protected delegateToUpperScope(ref: Reference): void;
protected isValidResolution(_ref: Reference, _variable: Variable): boolean;
private addDeclaredVariablesOfNode;
defineIdentifier(node: TSESTree.Identifier, def: Definition): void;
defineLiteralIdentifier(node: TSESTree.StringLiteral, def: Definition): void;
referenceDualValueType(node: TSESTree.Identifier): void;
referenceType(node: TSESTree.Identifier): void;
referenceValue(node: TSESTree.Identifier | TSESTree.JSXIdentifier, assign?: ReferenceFlag, writeExpr?: TSESTree.Expression | null, maybeImplicitGlobal?: ReferenceImplicitGlobal | null, init?: boolean): void;
}
export {};
@@ -0,0 +1,58 @@
import { createNextState, isDraft } from '../immerImports'
import type { Draft } from 'immer'
import type { EntityId, DraftableEntityState, PreventAny } from './models'
import type { PayloadAction } from '../createAction'
import { isFSA } from '../createAction'
export const isDraftTyped = isDraft as <T>(
value: T | Draft<T>,
) => value is Draft<T>
export function createSingleArgumentStateOperator<T, Id extends EntityId>(
mutator: (state: DraftableEntityState<T, Id>) => void,
) {
const operator = createStateOperator(
(_: undefined, state: DraftableEntityState<T, Id>) => mutator(state),
)
return function operation<S extends DraftableEntityState<T, Id>>(
state: PreventAny<S, T, Id>,
): S {
return operator(state as S, undefined)
}
}
export function createStateOperator<T, Id extends EntityId, R>(
mutator: (arg: R, state: DraftableEntityState<T, Id>) => void,
) {
return function operation<S extends DraftableEntityState<T, Id>>(
state: S,
arg: R | PayloadAction<R>,
): S {
function isPayloadActionArgument(
arg: R | PayloadAction<R>,
): arg is PayloadAction<R> {
return isFSA(arg)
}
const runMutator = (draft: DraftableEntityState<T, Id>) => {
if (isPayloadActionArgument(arg)) {
mutator(arg.payload, draft)
} else {
mutator(arg, draft)
}
}
if (isDraftTyped<DraftableEntityState<T, Id>>(state)) {
// we must already be inside a `createNextState` call, likely because
// this is being wrapped in `createReducer` or `createSlice`.
// It's safe to just pass the draft to the mutator.
runMutator(state)
// since it's a draft, we'll just return it
return state
}
return createNextState(state, runMutator)
}
}
@@ -0,0 +1,48 @@
import Literal from './Literal';
import JSXElement from './JSXElement';
import JSXText from './JSXText';
import JSXFragment from './JSXFragment';
import JSXExpressionContainer, { extractLiteral } from './expressions';
// Composition map of types to their extractor functions.
const TYPES = {
Literal,
JSXElement,
JSXExpressionContainer,
JSXText,
JSXFragment,
};
// Composition map of types to their extractor functions to handle literals.
const LITERAL_TYPES = {
...TYPES,
JSXElement: () => null,
JSXExpressionContainer: extractLiteral,
};
/**
* This function maps an AST value node
* to its correct extractor function for its
* given type.
*
* This will map correctly for *all* possible types.
*
* @param value - AST Value object on a JSX Attribute.
*/
export default function getValue(value) {
if (!TYPES[value.type]) console.log(value.type);
return TYPES[value.type](value);
}
/**
* This function maps an AST value node
* to its correct extractor function for its
* given type.
*
* This will map correctly for *some* possible types that map to literals.
*
* @param value - AST Value object on a JSX Attribute.
*/
export function getLiteralValue(value) {
return LITERAL_TYPES[value.type](value);
}
@@ -0,0 +1,27 @@
/**
* Check if the value is an object.
*
* 校验是否是一个对象
*
* @example
* ```js
* import { isObject } from 'is-what-type';
*
* isObject(1); // false
* isObject(undefined); // false
* isObject({}); // true
* isObject([]); // true
* isObject(null); // false
* isObject(function() {}); // true
* isObject(new Date()); // true
* isObject('string'); // false
* isObject(true); // false
* isObject(false); // false
* isObject(NaN); // false
* isObject(Infinity); // false
* ```
*
* @param value - The value to check
* @returns `true` if the value is an object, `false` otherwise
*/
export declare function isObject<T = object>(value: unknown): value is T;
@@ -0,0 +1,320 @@
import {fromAbsolute as $11d87f3f76e88657$export$1b96692a1ba042ac, toAbsolute as $11d87f3f76e88657$export$5107c82f94518f5c, toCalendar as $11d87f3f76e88657$export$b4a036af3fc0b032, toCalendarDate as $11d87f3f76e88657$export$93522d1a439f3617} from "./conversion.module.js";
import {weekStartData as $2fe286d2fb449abb$export$7a5acbd77d414bd9} from "./weekStartData.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $14e0f24ef4ac5c92$export$ea39ec197993aef0(a, b) {
b = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(b, a.calendar);
return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
}
function $14e0f24ef4ac5c92$export$a18c89cbd24170ff(a, b) {
b = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(b, a.calendar);
// In the Japanese calendar, months can span multiple eras/years, so only compare the first of the month.
a = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(a);
b = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(b);
return a.era === b.era && a.year === b.year && a.month === b.month;
}
function $14e0f24ef4ac5c92$export$5841f9eb9773f25f(a, b) {
b = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(b, a.calendar);
a = $14e0f24ef4ac5c92$export$f91e89d3d0406102(a);
b = $14e0f24ef4ac5c92$export$f91e89d3d0406102(b);
return a.era === b.era && a.year === b.year;
}
function $14e0f24ef4ac5c92$export$91b62ebf2ba703ee(a, b) {
return $14e0f24ef4ac5c92$export$dbc69fd56b53d5e(a.calendar, b.calendar) && $14e0f24ef4ac5c92$export$ea39ec197993aef0(a, b);
}
function $14e0f24ef4ac5c92$export$5a8da0c44a3afdf2(a, b) {
return $14e0f24ef4ac5c92$export$dbc69fd56b53d5e(a.calendar, b.calendar) && $14e0f24ef4ac5c92$export$a18c89cbd24170ff(a, b);
}
function $14e0f24ef4ac5c92$export$ea840f5a6dda8147(a, b) {
return $14e0f24ef4ac5c92$export$dbc69fd56b53d5e(a.calendar, b.calendar) && $14e0f24ef4ac5c92$export$5841f9eb9773f25f(a, b);
}
function $14e0f24ef4ac5c92$export$dbc69fd56b53d5e(a, b) {
var _a_isEqual, _b_isEqual;
var _a_isEqual1, _ref;
return (_ref = (_a_isEqual1 = (_a_isEqual = a.isEqual) === null || _a_isEqual === void 0 ? void 0 : _a_isEqual.call(a, b)) !== null && _a_isEqual1 !== void 0 ? _a_isEqual1 : (_b_isEqual = b.isEqual) === null || _b_isEqual === void 0 ? void 0 : _b_isEqual.call(b, a)) !== null && _ref !== void 0 ? _ref : a.identifier === b.identifier;
}
function $14e0f24ef4ac5c92$export$629b0a497aa65267(date, timeZone) {
return $14e0f24ef4ac5c92$export$ea39ec197993aef0(date, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone));
}
const $14e0f24ef4ac5c92$var$DAY_MAP = {
sun: 0,
mon: 1,
tue: 2,
wed: 3,
thu: 4,
fri: 5,
sat: 6
};
function $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale, firstDayOfWeek) {
let julian = date.calendar.toJulianDay(date);
// If julian is negative, then julian % 7 will be negative, so we adjust
// accordingly. Julian day 0 is Monday.
let weekStart = firstDayOfWeek ? $14e0f24ef4ac5c92$var$DAY_MAP[firstDayOfWeek] : $14e0f24ef4ac5c92$var$getWeekStart(locale);
let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7;
if (dayOfWeek < 0) dayOfWeek += 7;
return dayOfWeek;
}
function $14e0f24ef4ac5c92$export$461939dd4422153(timeZone) {
return (0, $11d87f3f76e88657$export$1b96692a1ba042ac)(Date.now(), timeZone);
}
function $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone) {
return (0, $11d87f3f76e88657$export$93522d1a439f3617)($14e0f24ef4ac5c92$export$461939dd4422153(timeZone));
}
function $14e0f24ef4ac5c92$export$68781ddf31c0090f(a, b) {
return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
}
function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a, b) {
return $14e0f24ef4ac5c92$var$timeToMs(a) - $14e0f24ef4ac5c92$var$timeToMs(b);
}
function $14e0f24ef4ac5c92$var$timeToMs(a) {
return a.hour * 3600000 + a.minute * 60000 + a.second * 1000 + a.millisecond;
}
function $14e0f24ef4ac5c92$export$126c91c941de7e(a, timeZone) {
let ms = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(a, timeZone);
let tomorrow = a.add({
days: 1
});
let tomorrowMs = (0, $11d87f3f76e88657$export$5107c82f94518f5c)(tomorrow, timeZone);
return (tomorrowMs - ms) / 3600000;
}
let $14e0f24ef4ac5c92$var$localTimeZone = null;
function $14e0f24ef4ac5c92$export$aa8b41735afcabd2() {
if ($14e0f24ef4ac5c92$var$localTimeZone == null) $14e0f24ef4ac5c92$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
return $14e0f24ef4ac5c92$var$localTimeZone;
}
function $14e0f24ef4ac5c92$export$61a9d83ceb59a3dd(timeZone) {
$14e0f24ef4ac5c92$var$localTimeZone = timeZone;
}
function $14e0f24ef4ac5c92$export$55753838ffe79333() {
$14e0f24ef4ac5c92$var$localTimeZone = null;
}
function $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date) {
// Use `subtract` instead of `set` so we don't get constrained in an era.
return date.subtract({
days: date.day - 1
});
}
function $14e0f24ef4ac5c92$export$a2258d9c4118825c(date) {
return date.add({
days: date.calendar.getDaysInMonth(date) - date.day
});
}
function $14e0f24ef4ac5c92$export$f91e89d3d0406102(date) {
return $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date.subtract({
months: date.month - 1
}));
}
function $14e0f24ef4ac5c92$export$8b7aa55c66d5569e(date) {
return $14e0f24ef4ac5c92$export$a2258d9c4118825c(date.add({
months: date.calendar.getMonthsInYear(date) - date.month
}));
}
function $14e0f24ef4ac5c92$export$5412ac11713b72ad(date) {
if (date.calendar.getMinimumMonthInYear) return date.calendar.getMinimumMonthInYear(date);
return 1;
}
function $14e0f24ef4ac5c92$export$b2f4953d301981d5(date) {
if (date.calendar.getMinimumDayInMonth) return date.calendar.getMinimumDayInMonth(date);
return 1;
}
function $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date, locale, firstDayOfWeek) {
let dayOfWeek = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale, firstDayOfWeek);
return date.subtract({
days: dayOfWeek
});
}
function $14e0f24ef4ac5c92$export$ef8b6d9133084f4e(date, locale, firstDayOfWeek) {
return $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date, locale, firstDayOfWeek).add({
days: 6
});
}
const $14e0f24ef4ac5c92$var$cachedRegions = new Map();
const $14e0f24ef4ac5c92$var$cachedWeekInfo = new Map();
function $14e0f24ef4ac5c92$var$getRegion(locale) {
// If the Intl.Locale API is available, use it to get the region for the locale.
// @ts-ignore
if (Intl.Locale) {
// Constructing an Intl.Locale is expensive, so cache the result.
let region = $14e0f24ef4ac5c92$var$cachedRegions.get(locale);
if (!region) {
// @ts-ignore
region = new Intl.Locale(locale).maximize().region;
if (region) $14e0f24ef4ac5c92$var$cachedRegions.set(locale, region);
}
return region;
}
// If not, just try splitting the string.
// If the second part of the locale string is 'u',
// then this is a unicode extension, so ignore it.
// Otherwise, it should be the region.
let part = locale.split('-')[1];
return part === 'u' ? undefined : part;
}
function $14e0f24ef4ac5c92$var$getWeekStart(locale) {
// TODO: use Intl.Locale for this once browsers support the weekInfo property
// https://github.com/tc39/proposal-intl-locale-info
let weekInfo = $14e0f24ef4ac5c92$var$cachedWeekInfo.get(locale);
if (!weekInfo) {
if (Intl.Locale) {
// @ts-ignore
let localeInst = new Intl.Locale(locale);
if ('getWeekInfo' in localeInst) {
// @ts-expect-error
weekInfo = localeInst.getWeekInfo();
if (weekInfo) {
$14e0f24ef4ac5c92$var$cachedWeekInfo.set(locale, weekInfo);
return weekInfo.firstDay;
}
}
}
let region = $14e0f24ef4ac5c92$var$getRegion(locale);
if (locale.includes('-fw-')) {
// pull the value for the attribute fw from strings such as en-US-u-ca-iso8601-fw-tue or en-US-u-ca-iso8601-fw-mon-nu-thai
// where the fw attribute could be followed by another unicode locale extension or not
let day = locale.split('-fw-')[1].split('-')[0];
if (day === 'mon') weekInfo = {
firstDay: 1
};
else if (day === 'tue') weekInfo = {
firstDay: 2
};
else if (day === 'wed') weekInfo = {
firstDay: 3
};
else if (day === 'thu') weekInfo = {
firstDay: 4
};
else if (day === 'fri') weekInfo = {
firstDay: 5
};
else if (day === 'sat') weekInfo = {
firstDay: 6
};
else weekInfo = {
firstDay: 0
};
} else if (locale.includes('-ca-iso8601')) weekInfo = {
firstDay: 1
};
else weekInfo = {
firstDay: region ? (0, $2fe286d2fb449abb$export$7a5acbd77d414bd9)[region] || 0 : 0
};
$14e0f24ef4ac5c92$var$cachedWeekInfo.set(locale, weekInfo);
}
return weekInfo.firstDay;
}
function $14e0f24ef4ac5c92$export$ccc1b2479e7dd654(date, locale, firstDayOfWeek) {
let days = date.calendar.getDaysInMonth(date);
return Math.ceil(($14e0f24ef4ac5c92$export$2061056d06d7cdf7($14e0f24ef4ac5c92$export$a5a3b454ada2268e(date), locale, firstDayOfWeek) + days) / 7);
}
function $14e0f24ef4ac5c92$export$5c333a116e949cdd(a, b) {
if (a && b) return a.compare(b) <= 0 ? a : b;
return a || b;
}
function $14e0f24ef4ac5c92$export$a75f2bff57811055(a, b) {
if (a && b) return a.compare(b) >= 0 ? a : b;
return a || b;
}
const $14e0f24ef4ac5c92$var$WEEKEND_DATA = {
AF: [
4,
5
],
AE: [
5,
6
],
BH: [
5,
6
],
DZ: [
5,
6
],
EG: [
5,
6
],
IL: [
5,
6
],
IQ: [
5,
6
],
IR: [
5,
5
],
JO: [
5,
6
],
KW: [
5,
6
],
LY: [
5,
6
],
OM: [
5,
6
],
QA: [
5,
6
],
SA: [
5,
6
],
SD: [
5,
6
],
SY: [
5,
6
],
YE: [
5,
6
]
};
function $14e0f24ef4ac5c92$export$618d60ea299da42(date, locale) {
let julian = date.calendar.toJulianDay(date);
// If julian is negative, then julian % 7 will be negative, so we adjust
// accordingly. Julian day 0 is Monday.
let dayOfWeek = Math.ceil(julian + 1) % 7;
if (dayOfWeek < 0) dayOfWeek += 7;
let region = $14e0f24ef4ac5c92$var$getRegion(locale);
// Use Intl.Locale for this once weekInfo is supported.
// https://github.com/tc39/proposal-intl-locale-info
let [start, end] = $14e0f24ef4ac5c92$var$WEEKEND_DATA[region] || [
6,
0
];
return dayOfWeek === start || dayOfWeek === end;
}
function $14e0f24ef4ac5c92$export$ee9d87258e1d19ed(date, locale) {
return !$14e0f24ef4ac5c92$export$618d60ea299da42(date, locale);
}
export {$14e0f24ef4ac5c92$export$ea39ec197993aef0 as isSameDay, $14e0f24ef4ac5c92$export$a18c89cbd24170ff as isSameMonth, $14e0f24ef4ac5c92$export$a5a3b454ada2268e as startOfMonth, $14e0f24ef4ac5c92$export$5841f9eb9773f25f as isSameYear, $14e0f24ef4ac5c92$export$f91e89d3d0406102 as startOfYear, $14e0f24ef4ac5c92$export$91b62ebf2ba703ee as isEqualDay, $14e0f24ef4ac5c92$export$dbc69fd56b53d5e as isEqualCalendar, $14e0f24ef4ac5c92$export$5a8da0c44a3afdf2 as isEqualMonth, $14e0f24ef4ac5c92$export$ea840f5a6dda8147 as isEqualYear, $14e0f24ef4ac5c92$export$629b0a497aa65267 as isToday, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3 as today, $14e0f24ef4ac5c92$export$2061056d06d7cdf7 as getDayOfWeek, $14e0f24ef4ac5c92$export$461939dd4422153 as now, $14e0f24ef4ac5c92$export$68781ddf31c0090f as compareDate, $14e0f24ef4ac5c92$export$c19a80a9721b80f6 as compareTime, $14e0f24ef4ac5c92$export$126c91c941de7e as getHoursInDay, $14e0f24ef4ac5c92$export$aa8b41735afcabd2 as getLocalTimeZone, $14e0f24ef4ac5c92$export$61a9d83ceb59a3dd as setLocalTimeZone, $14e0f24ef4ac5c92$export$55753838ffe79333 as resetLocalTimeZone, $14e0f24ef4ac5c92$export$a2258d9c4118825c as endOfMonth, $14e0f24ef4ac5c92$export$8b7aa55c66d5569e as endOfYear, $14e0f24ef4ac5c92$export$5412ac11713b72ad as getMinimumMonthInYear, $14e0f24ef4ac5c92$export$b2f4953d301981d5 as getMinimumDayInMonth, $14e0f24ef4ac5c92$export$42c81a444fbfb5d4 as startOfWeek, $14e0f24ef4ac5c92$export$ef8b6d9133084f4e as endOfWeek, $14e0f24ef4ac5c92$export$ccc1b2479e7dd654 as getWeeksInMonth, $14e0f24ef4ac5c92$export$5c333a116e949cdd as minDate, $14e0f24ef4ac5c92$export$a75f2bff57811055 as maxDate, $14e0f24ef4ac5c92$export$618d60ea299da42 as isWeekend, $14e0f24ef4ac5c92$export$ee9d87258e1d19ed as isWeekday};
//# sourceMappingURL=queries.module.js.map
@@ -0,0 +1,396 @@
'use strict';
/* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.
TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed
*/
/**
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
*/
/* eslint-enable jsdoc/valid-types -- doesn't allow `readonly string[]`. TODO: check why */
/**
* @type {VisitorKeys}
*/
const KEYS = {
ArrayExpression: [
"elements"
],
ArrayPattern: [
"elements"
],
ArrowFunctionExpression: [
"params",
"body"
],
AssignmentExpression: [
"left",
"right"
],
AssignmentPattern: [
"left",
"right"
],
AwaitExpression: [
"argument"
],
BinaryExpression: [
"left",
"right"
],
BlockStatement: [
"body"
],
BreakStatement: [
"label"
],
CallExpression: [
"callee",
"arguments"
],
CatchClause: [
"param",
"body"
],
ChainExpression: [
"expression"
],
ClassBody: [
"body"
],
ClassDeclaration: [
"id",
"superClass",
"body"
],
ClassExpression: [
"id",
"superClass",
"body"
],
ConditionalExpression: [
"test",
"consequent",
"alternate"
],
ContinueStatement: [
"label"
],
DebuggerStatement: [],
DoWhileStatement: [
"body",
"test"
],
EmptyStatement: [],
ExperimentalRestProperty: [
"argument"
],
ExperimentalSpreadProperty: [
"argument"
],
ExportAllDeclaration: [
"exported",
"source",
"attributes"
],
ExportDefaultDeclaration: [
"declaration"
],
ExportNamedDeclaration: [
"declaration",
"specifiers",
"source",
"attributes"
],
ExportSpecifier: [
"local",
"exported"
],
ExpressionStatement: [
"expression"
],
ForInStatement: [
"left",
"right",
"body"
],
ForOfStatement: [
"left",
"right",
"body"
],
ForStatement: [
"init",
"test",
"update",
"body"
],
FunctionDeclaration: [
"id",
"params",
"body"
],
FunctionExpression: [
"id",
"params",
"body"
],
Identifier: [],
IfStatement: [
"test",
"consequent",
"alternate"
],
ImportAttribute: [
"key",
"value"
],
ImportDeclaration: [
"specifiers",
"source",
"attributes"
],
ImportDefaultSpecifier: [
"local"
],
ImportExpression: [
"source",
"options"
],
ImportNamespaceSpecifier: [
"local"
],
ImportSpecifier: [
"imported",
"local"
],
JSXAttribute: [
"name",
"value"
],
JSXClosingElement: [
"name"
],
JSXClosingFragment: [],
JSXElement: [
"openingElement",
"children",
"closingElement"
],
JSXEmptyExpression: [],
JSXExpressionContainer: [
"expression"
],
JSXFragment: [
"openingFragment",
"children",
"closingFragment"
],
JSXIdentifier: [],
JSXMemberExpression: [
"object",
"property"
],
JSXNamespacedName: [
"namespace",
"name"
],
JSXOpeningElement: [
"name",
"attributes"
],
JSXOpeningFragment: [],
JSXSpreadAttribute: [
"argument"
],
JSXSpreadChild: [
"expression"
],
JSXText: [],
LabeledStatement: [
"label",
"body"
],
Literal: [],
LogicalExpression: [
"left",
"right"
],
MemberExpression: [
"object",
"property"
],
MetaProperty: [
"meta",
"property"
],
MethodDefinition: [
"key",
"value"
],
NewExpression: [
"callee",
"arguments"
],
ObjectExpression: [
"properties"
],
ObjectPattern: [
"properties"
],
PrivateIdentifier: [],
Program: [
"body"
],
Property: [
"key",
"value"
],
PropertyDefinition: [
"key",
"value"
],
RestElement: [
"argument"
],
ReturnStatement: [
"argument"
],
SequenceExpression: [
"expressions"
],
SpreadElement: [
"argument"
],
StaticBlock: [
"body"
],
Super: [],
SwitchCase: [
"test",
"consequent"
],
SwitchStatement: [
"discriminant",
"cases"
],
TaggedTemplateExpression: [
"tag",
"quasi"
],
TemplateElement: [],
TemplateLiteral: [
"quasis",
"expressions"
],
ThisExpression: [],
ThrowStatement: [
"argument"
],
TryStatement: [
"block",
"handler",
"finalizer"
],
UnaryExpression: [
"argument"
],
UpdateExpression: [
"argument"
],
VariableDeclaration: [
"declarations"
],
VariableDeclarator: [
"id",
"init"
],
WhileStatement: [
"test",
"body"
],
WithStatement: [
"object",
"body"
],
YieldExpression: [
"argument"
]
};
// Types.
const NODE_TYPES = Object.keys(KEYS);
// Freeze the keys.
for (const type of NODE_TYPES) {
Object.freeze(KEYS[type]);
}
Object.freeze(KEYS);
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
/**
* @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys
*/
// List to ignore keys.
const KEY_BLACKLIST = new Set([
"parent",
"leadingComments",
"trailingComments"
]);
/**
* Check whether a given key should be used or not.
* @param {string} key The key to check.
* @returns {boolean} `true` if the key should be used.
*/
function filterKey(key) {
return !KEY_BLACKLIST.has(key) && key[0] !== "_";
}
/* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.
TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed
*/
/**
* Get visitor keys of a given node.
* @param {Object} node The AST node to get keys.
* @returns {readonly string[]} Visitor keys of the node.
*/
function getKeys(node) {
return Object.keys(node).filter(filterKey);
}
/* eslint-enable jsdoc/valid-types -- doesn't allow `readonly` */
/**
* Make the union set with `KEYS` and given keys.
* @param {VisitorKeys} additionalKeys The additional keys.
* @returns {VisitorKeys} The union set.
*/
function unionWith(additionalKeys) {
const retv = /** @type {{ [type: string]: ReadonlyArray<string> }} */
(Object.assign({}, KEYS));
for (const type of Object.keys(additionalKeys)) {
if (Object.hasOwn(retv, type)) {
const keys = new Set(additionalKeys[type]);
for (const key of retv[type]) {
keys.add(key);
}
retv[type] = Object.freeze(Array.from(keys));
} else {
retv[type] = Object.freeze(Array.from(additionalKeys[type]));
}
}
return Object.freeze(retv);
}
exports.KEYS = KEYS;
exports.getKeys = getKeys;
exports.unionWith = unionWith;
@@ -0,0 +1,37 @@
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
name: visual-studio
on:
push:
branches:
- main
- release/v*
pull_request:
branches:
- main
- release/v*
jobs:
visual-studio:
strategy:
fail-fast: false
max-parallel: 8
matrix:
os: [windows-latest]
msvs-version: [2016, 2019, 2022] # https://github.com/actions/virtual-environments/tree/main/images/win
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install Dependencies
run: |
npm install --no-progress
# npm audit fix --force
- name: Set Windows environment
if: startsWith(matrix.os, 'windows')
run: |
echo 'GYP_MSVS_VERSION=${{ matrix.msvs-version }}' >> $Env:GITHUB_ENV
echo 'GYP_MSVS_OVERRIDE_PATH=C:\\Dummy' >> $Env:GITHUB_ENV
- name: Environment Information
run: npx envinfo
- name: Run Node tests
run: npm test
@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fsWalk = require("@nodelib/fs.walk");
const reader_1 = require("./reader");
const stream_1 = require("./stream");
class ReaderAsync extends reader_1.default {
constructor() {
super(...arguments);
this._walkAsync = fsWalk.walk;
this._readerStream = new stream_1.default(this._settings);
}
dynamic(root, options) {
return new Promise((resolve, reject) => {
this._walkAsync(root, options, (error, entries) => {
if (error === null) {
resolve(entries);
}
else {
reject(error);
}
});
});
}
async static(patterns, options) {
const entries = [];
const stream = this._readerStream.static(patterns, options);
// After #235, replace it with an asynchronous iterator.
return new Promise((resolve, reject) => {
stream.once('error', reject);
stream.on('data', (entry) => entries.push(entry));
stream.once('end', () => resolve(entries));
});
}
}
exports.default = ReaderAsync;
@@ -0,0 +1,16 @@
export * from './convertAAGUIDToString.js';
export * from './convertCertBufferToPEM.js';
export * from './convertCOSEtoPKCS.js';
export * from './decodeAttestationObject.js';
export * from './decodeClientDataJSON.js';
export * from './decodeCredentialPublicKey.js';
export * from './generateChallenge.js';
export * from './generateUserID.js';
export * from './getCertificateInfo.js';
export * from './isCertRevoked.js';
export * from './parseAuthenticatorData.js';
export * from './toHash.js';
export * from './validateCertificatePath.js';
export * from './verifySignature.js';
export * from './iso/index.js';
export * as cose from './cose.js';
@@ -0,0 +1,41 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
useCallbackRef: () => useCallbackRef
});
module.exports = __toCommonJS(index_exports);
var import_react = require("react");
var import_use_safe_layout_effect = require("@heroui/use-safe-layout-effect");
function useCallbackRef(fn, deps = []) {
const ref = (0, import_react.useRef)(fn);
(0, import_use_safe_layout_effect.useSafeLayoutEffect)(() => {
ref.current = fn;
});
return (0, import_react.useCallback)((...args) => {
var _a;
return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args);
}, deps);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
useCallbackRef
});
@@ -0,0 +1,251 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _table = _interopRequireDefault(require("./table"));
var _struct = _interopRequireDefault(require("./struct"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @file OS/2表
* @author mengke01(kekee000@gmail.com)
*
* http://www.microsoft.com/typography/otspec/os2.htm
*/
var _default = exports.default = _table.default.create('OS/2', [['version', _struct.default.Uint16], ['xAvgCharWidth', _struct.default.Int16], ['usWeightClass', _struct.default.Uint16], ['usWidthClass', _struct.default.Uint16], ['fsType', _struct.default.Uint16], ['ySubscriptXSize', _struct.default.Uint16], ['ySubscriptYSize', _struct.default.Uint16], ['ySubscriptXOffset', _struct.default.Uint16], ['ySubscriptYOffset', _struct.default.Uint16], ['ySuperscriptXSize', _struct.default.Uint16], ['ySuperscriptYSize', _struct.default.Uint16], ['ySuperscriptXOffset', _struct.default.Uint16], ['ySuperscriptYOffset', _struct.default.Uint16], ['yStrikeoutSize', _struct.default.Uint16], ['yStrikeoutPosition', _struct.default.Uint16], ['sFamilyClass', _struct.default.Uint16],
// Panose
['bFamilyType', _struct.default.Uint8], ['bSerifStyle', _struct.default.Uint8], ['bWeight', _struct.default.Uint8], ['bProportion', _struct.default.Uint8], ['bContrast', _struct.default.Uint8], ['bStrokeVariation', _struct.default.Uint8], ['bArmStyle', _struct.default.Uint8], ['bLetterform', _struct.default.Uint8], ['bMidline', _struct.default.Uint8], ['bXHeight', _struct.default.Uint8],
// unicode range
['ulUnicodeRange1', _struct.default.Uint32], ['ulUnicodeRange2', _struct.default.Uint32], ['ulUnicodeRange3', _struct.default.Uint32], ['ulUnicodeRange4', _struct.default.Uint32],
// char 4
['achVendID', _struct.default.String, 4], ['fsSelection', _struct.default.Uint16], ['usFirstCharIndex', _struct.default.Uint16], ['usLastCharIndex', _struct.default.Uint16], ['sTypoAscender', _struct.default.Int16], ['sTypoDescender', _struct.default.Int16], ['sTypoLineGap', _struct.default.Int16], ['usWinAscent', _struct.default.Uint16], ['usWinDescent', _struct.default.Uint16],
// version 0 above 39
['ulCodePageRange1', _struct.default.Uint32], ['ulCodePageRange2', _struct.default.Uint32],
// version 1 above 41
['sxHeight', _struct.default.Int16], ['sCapHeight', _struct.default.Int16], ['usDefaultChar', _struct.default.Uint16], ['usBreakChar', _struct.default.Uint16], ['usMaxContext', _struct.default.Uint16]
// version 2,3,4 above 46
], {
read: function read(reader, ttf) {
var format = reader.readUint16(this.offset);
var struct = this.struct;
// format2
if (format === 0) {
struct = struct.slice(0, 39);
} else if (format === 1) {
struct = struct.slice(0, 41);
}
var OS2Head = _table.default.create('os2head', struct);
var tbl = new OS2Head(this.offset).read(reader, ttf);
// 补齐其他version的字段
var os2Fields = {
ulCodePageRange1: 1,
ulCodePageRange2: 0,
sxHeight: 0,
sCapHeight: 0,
usDefaultChar: 0,
usBreakChar: 32,
usMaxContext: 0
};
return Object.assign(os2Fields, tbl);
},
size: function size(ttf) {
// 更新其他表的统计信息
// header
var xMin = 16384;
var yMin = 16384;
var xMax = -16384;
var yMax = -16384;
// hhea
var advanceWidthMax = -1;
var minLeftSideBearing = 16384;
var minRightSideBearing = 16384;
var xMaxExtent = -16384;
// os2 count
var xAvgCharWidth = 0;
var usFirstCharIndex = 0x10FFFF;
var usLastCharIndex = -1;
// maxp
var maxPoints = 0;
var maxContours = 0;
var maxCompositePoints = 0;
var maxCompositeContours = 0;
var maxSizeOfInstructions = 0;
var maxComponentElements = 0;
var glyfNotEmpty = 0; // 非空glyf
var hinting = ttf.writeOptions ? ttf.writeOptions.hinting : false;
// 计算instructions和functiondefs
if (hinting) {
if (ttf.cvt) {
maxSizeOfInstructions = Math.max(maxSizeOfInstructions, ttf.cvt.length);
}
if (ttf.prep) {
maxSizeOfInstructions = Math.max(maxSizeOfInstructions, ttf.prep.length);
}
if (ttf.fpgm) {
maxSizeOfInstructions = Math.max(maxSizeOfInstructions, ttf.fpgm.length);
}
}
ttf.glyf.forEach(function (glyf) {
// 统计control point信息
if (glyf.compound) {
var compositeContours = 0;
var compositePoints = 0;
glyf.glyfs.forEach(function (g) {
var cglyf = ttf.glyf[g.glyphIndex];
if (!cglyf) {
return;
}
compositeContours += cglyf.contours ? cglyf.contours.length : 0;
if (cglyf.contours && cglyf.contours.length) {
cglyf.contours.forEach(function (contour) {
compositePoints += contour.length;
});
}
});
maxComponentElements = Math.max(maxComponentElements, glyf.glyfs.length);
maxCompositePoints = Math.max(maxCompositePoints, compositePoints);
maxCompositeContours = Math.max(maxCompositeContours, compositeContours);
}
// 简单图元
else if (glyf.contours && glyf.contours.length) {
maxContours = Math.max(maxContours, glyf.contours.length);
var points = 0;
glyf.contours.forEach(function (contour) {
points += contour.length;
});
maxPoints = Math.max(maxPoints, points);
}
if (hinting && glyf.instructions) {
maxSizeOfInstructions = Math.max(maxSizeOfInstructions, glyf.instructions.length);
}
// 统计边界信息
if (null != glyf.xMin && glyf.xMin < xMin) {
xMin = glyf.xMin;
}
if (null != glyf.yMin && glyf.yMin < yMin) {
yMin = glyf.yMin;
}
if (null != glyf.xMax && glyf.xMax > xMax) {
xMax = glyf.xMax;
}
if (null != glyf.yMax && glyf.yMax > yMax) {
yMax = glyf.yMax;
}
advanceWidthMax = Math.max(advanceWidthMax, glyf.advanceWidth);
minLeftSideBearing = Math.min(minLeftSideBearing, glyf.leftSideBearing);
if (null != glyf.xMax) {
minRightSideBearing = Math.min(minRightSideBearing, glyf.advanceWidth - glyf.xMax);
xMaxExtent = Math.max(xMaxExtent, glyf.xMax);
}
if (null != glyf.advanceWidth) {
xAvgCharWidth += glyf.advanceWidth;
glyfNotEmpty++;
}
var unicodes = glyf.unicode;
if (typeof glyf.unicode === 'number') {
unicodes = [glyf.unicode];
}
if (Array.isArray(unicodes)) {
unicodes.forEach(function (unicode) {
if (unicode !== 0xFFFF) {
usFirstCharIndex = Math.min(usFirstCharIndex, unicode);
usLastCharIndex = Math.max(usLastCharIndex, unicode);
}
});
}
});
// 重新设置version 4
ttf['OS/2'].version = 0x4;
ttf['OS/2'].achVendID = (ttf['OS/2'].achVendID + ' ').slice(0, 4);
ttf['OS/2'].xAvgCharWidth = xAvgCharWidth / (glyfNotEmpty || 1);
ttf['OS/2'].ulUnicodeRange2 = 268435456;
ttf['OS/2'].usFirstCharIndex = usFirstCharIndex;
ttf['OS/2'].usLastCharIndex = usLastCharIndex;
// rewrite hhea
ttf.hhea.version = ttf.hhea.version || 0x1;
ttf.hhea.advanceWidthMax = advanceWidthMax;
ttf.hhea.minLeftSideBearing = minLeftSideBearing;
ttf.hhea.minRightSideBearing = minRightSideBearing;
ttf.hhea.xMaxExtent = xMaxExtent;
// rewrite head
ttf.head.version = ttf.head.version || 0x1;
ttf.head.lowestRecPPEM = ttf.head.lowestRecPPEM || 0x8;
ttf.head.xMin = xMin;
ttf.head.yMin = yMin;
ttf.head.xMax = xMax;
ttf.head.yMax = yMax;
// head rewrite
if (ttf.support.head) {
var _ttf$support$head = ttf.support.head,
_xMin = _ttf$support$head.xMin,
_yMin = _ttf$support$head.yMin,
_xMax = _ttf$support$head.xMax,
_yMax = _ttf$support$head.yMax;
if (_xMin != null) {
ttf.head.xMin = _xMin;
}
if (_yMin != null) {
ttf.head.yMin = _yMin;
}
if (_xMax != null) {
ttf.head.xMax = _xMax;
}
if (_yMax != null) {
ttf.head.yMax = _yMax;
}
}
// hhea rewrite
if (ttf.support.hhea) {
var _ttf$support$hhea = ttf.support.hhea,
_advanceWidthMax = _ttf$support$hhea.advanceWidthMax,
_xMaxExtent = _ttf$support$hhea.xMaxExtent,
_minLeftSideBearing = _ttf$support$hhea.minLeftSideBearing,
_minRightSideBearing = _ttf$support$hhea.minRightSideBearing;
if (_advanceWidthMax != null) {
ttf.hhea.advanceWidthMax = _advanceWidthMax;
}
if (_xMaxExtent != null) {
ttf.hhea.xMaxExtent = _xMaxExtent;
}
if (_minLeftSideBearing != null) {
ttf.hhea.minLeftSideBearing = _minLeftSideBearing;
}
if (_minRightSideBearing != null) {
ttf.hhea.minRightSideBearing = _minRightSideBearing;
}
}
// 这里根据存储的maxp来设置新的maxp,避免重复计算maxp
ttf.maxp = ttf.maxp || {};
ttf.support.maxp = {
version: 1.0,
numGlyphs: ttf.glyf.length,
maxPoints: maxPoints,
maxContours: maxContours,
maxCompositePoints: maxCompositePoints,
maxCompositeContours: maxCompositeContours,
maxZones: ttf.maxp.maxZones || 0,
maxTwilightPoints: ttf.maxp.maxTwilightPoints || 0,
maxStorage: ttf.maxp.maxStorage || 0,
maxFunctionDefs: ttf.maxp.maxFunctionDefs || 0,
maxStackElements: ttf.maxp.maxStackElements || 0,
maxSizeOfInstructions: maxSizeOfInstructions,
maxComponentElements: maxComponentElements,
maxComponentDepth: maxComponentElements ? 1 : 0
};
return _table.default.size.call(this, ttf);
}
});
@@ -0,0 +1,65 @@
{
"100": "Continue",
"101": "Switching Protocols",
"102": "Processing",
"103": "Early Hints",
"200": "OK",
"201": "Created",
"202": "Accepted",
"203": "Non-Authoritative Information",
"204": "No Content",
"205": "Reset Content",
"206": "Partial Content",
"207": "Multi-Status",
"208": "Already Reported",
"226": "IM Used",
"300": "Multiple Choices",
"301": "Moved Permanently",
"302": "Found",
"303": "See Other",
"304": "Not Modified",
"305": "Use Proxy",
"307": "Temporary Redirect",
"308": "Permanent Redirect",
"400": "Bad Request",
"401": "Unauthorized",
"402": "Payment Required",
"403": "Forbidden",
"404": "Not Found",
"405": "Method Not Allowed",
"406": "Not Acceptable",
"407": "Proxy Authentication Required",
"408": "Request Timeout",
"409": "Conflict",
"410": "Gone",
"411": "Length Required",
"412": "Precondition Failed",
"413": "Payload Too Large",
"414": "URI Too Long",
"415": "Unsupported Media Type",
"416": "Range Not Satisfiable",
"417": "Expectation Failed",
"418": "I'm a Teapot",
"421": "Misdirected Request",
"422": "Unprocessable Entity",
"423": "Locked",
"424": "Failed Dependency",
"425": "Too Early",
"426": "Upgrade Required",
"428": "Precondition Required",
"429": "Too Many Requests",
"431": "Request Header Fields Too Large",
"451": "Unavailable For Legal Reasons",
"500": "Internal Server Error",
"501": "Not Implemented",
"502": "Bad Gateway",
"503": "Service Unavailable",
"504": "Gateway Timeout",
"505": "HTTP Version Not Supported",
"506": "Variant Also Negotiates",
"507": "Insufficient Storage",
"508": "Loop Detected",
"509": "Bandwidth Limit Exceeded",
"510": "Not Extended",
"511": "Network Authentication Required"
}
@@ -0,0 +1,23 @@
/**
* Copyright (c) 2019, Microsoft Corporation (MIT License).
*/
export function pollUntil(cb: () => boolean, timeout: number, interval: number): Promise<void> {
return new Promise<void>((resolve, reject) => {
const intervalId = setInterval(() => {
if (cb()) {
clearInterval(intervalId);
clearTimeout(timeoutId);
resolve();
}
}, interval);
const timeoutId = setTimeout(() => {
clearInterval(intervalId);
if (cb()) {
resolve();
} else {
reject();
}
}, timeout);
});
}
@@ -0,0 +1,26 @@
"use strict"
const { READ } = require("@eslint-community/eslint-utils")
/**
* @satisfies {import('../types.js').SupportVersionTraceMap}
*/
const tty = {
isatty: { [READ]: { supported: ["0.5.8"] } },
ReadStream: { [READ]: { supported: ["0.5.8"] } },
WriteStream: { [READ]: { supported: ["0.5.8"] } },
}
/**
* @satisfies {import('../types.js').SupportVersionTraceMap}
*/
module.exports = {
tty: {
[READ]: { supported: ["0.5.8"] },
...tty,
},
"node:tty": {
[READ]: { supported: ["14.13.1", "12.20.0"] },
...tty,
},
}
@@ -0,0 +1,34 @@
module.exports = {
'attempt': require('./attempt'),
'bindAll': require('./bindAll'),
'cond': require('./cond'),
'conforms': require('./conforms'),
'constant': require('./constant'),
'defaultTo': require('./defaultTo'),
'flow': require('./flow'),
'flowRight': require('./flowRight'),
'identity': require('./identity'),
'iteratee': require('./iteratee'),
'matches': require('./matches'),
'matchesProperty': require('./matchesProperty'),
'method': require('./method'),
'methodOf': require('./methodOf'),
'mixin': require('./mixin'),
'noop': require('./noop'),
'nthArg': require('./nthArg'),
'over': require('./over'),
'overEvery': require('./overEvery'),
'overSome': require('./overSome'),
'property': require('./property'),
'propertyOf': require('./propertyOf'),
'range': require('./range'),
'rangeRight': require('./rangeRight'),
'stubArray': require('./stubArray'),
'stubFalse': require('./stubFalse'),
'stubObject': require('./stubObject'),
'stubString': require('./stubString'),
'stubTrue': require('./stubTrue'),
'times': require('./times'),
'toPath': require('./toPath'),
'uniqueId': require('./uniqueId')
};
@@ -0,0 +1 @@
{"mappings":";;;;;AAoCO,SAAS,0CAAa,QAA4B,CAAC,CAAC;IACzD,IAAI,aACF,YAAY,oBACZ,WAAW,UACX,MAAM,EACP,GAAG;IACJ,IAAI,QAAQ,CAAA,GAAA,aAAK,EAAE;QACjB,WAAW;QACX,gBAAgB,aAAa,CAAA,GAAA,qBAAa;IAC5C;IACA,IAAI,CAAC,WAAW,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IACvC,IAAI,CAAC,qBAAqB,gBAAgB,GAAG,CAAA,GAAA,eAAO,EAAE,IAAM,MAAM,OAAO,CAAC,SAAS,IAAI,MAAM,OAAO,CAAC,cAAc;IAEnH,IAAI,cAAc,CAAA,GAAA,kBAAU,EAAE,IAAM,gBAAgB,MAAM,OAAO,CAAC,SAAS,IAAI,MAAM,OAAO,CAAC,cAAc,GAAG,EAAE;IAEhH,IAAI,gBAAgB,CAAA,GAAA,kBAAU,EAAE,CAAA;QAC9B,MAAM,OAAO,CAAC,SAAS,GAAG;QAC1B,WAAW;QACX;IACF,GAAG;QAAC;KAAY;IAEhB,CAAA,GAAA,8BAAsB,EAAE,CAAC;QACvB,MAAM,OAAO,CAAC,cAAc,GAAG;QAC/B;IACF,GAAG,EAAE,EAAE;qBAAC;IAAW;IAEnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAC1B,YAAY;uBACZ;IACF;IAEA,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QACtC,YAAY,CAAC;QACb,qBAAqB;IACvB;IAEA,OAAO;mBACL;QACA,gBAAgB;QAChB,YAAY,SAAS,mBAAmB;IAC1C;AACF","sources":["packages/@react-aria/focus/src/useFocusRing.ts"],"sourcesContent":["import {DOMAttributes} from '@react-types/shared';\nimport {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';\nimport {useCallback, useRef, useState} from 'react';\n\nexport interface AriaFocusRingProps {\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default 'false'\n */\n within?: boolean,\n\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\nexport interface FocusRingAria {\n /** Whether the element is currently focused. */\n isFocused: boolean,\n\n /** Whether keyboard focus should be visible. */\n isFocusVisible: boolean,\n\n /** Props to apply to the container element with the focus ring. */\n focusProps: DOMAttributes\n}\n\n/**\n * Determines whether a focus ring should be shown to indicate keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function useFocusRing(props: AriaFocusRingProps = {}): FocusRingAria {\n let {\n autoFocus = false,\n isTextInput,\n within\n } = props;\n let state = useRef({\n isFocused: false,\n isFocusVisible: autoFocus || isFocusVisible()\n });\n let [isFocused, setFocused] = useState(false);\n let [isFocusVisibleState, setFocusVisible] = useState(() => state.current.isFocused && state.current.isFocusVisible);\n\n let updateState = useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);\n\n let onFocusChange = useCallback(isFocused => {\n state.current.isFocused = isFocused;\n setFocused(isFocused);\n updateState();\n }, [updateState]);\n\n useFocusVisibleListener((isFocusVisible) => {\n state.current.isFocusVisible = isFocusVisible;\n updateState();\n }, [], {isTextInput});\n\n let {focusProps} = useFocus({\n isDisabled: within,\n onFocusChange\n });\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange\n });\n\n return {\n isFocused,\n isFocusVisible: isFocusVisibleState,\n focusProps: within ? focusWithinProps : focusProps\n };\n}\n"],"names":[],"version":3,"file":"useFocusRing.module.js.map"}
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=BindingFluentSyntax.js.map
@@ -0,0 +1,72 @@
/**
* A runtime-agnostic collection of methods for working with Base64URL encoding
* @module
*/
import base64 from '@hexagon/base64';
/**
* Decode from a Base64URL-encoded string to an ArrayBuffer. Best used when converting a
* credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or
* excludeCredentials.
*
* @param buffer Value to decode from base64
* @param to (optional) The decoding to use, in case it's desirable to decode from base64 instead
*/
export function toBuffer(base64urlString, from = 'base64url') {
const _buffer = base64.toArrayBuffer(base64urlString, from === 'base64url');
return new Uint8Array(_buffer);
}
/**
* Encode the given array buffer into a Base64URL-encoded string. Ideal for converting various
* credential response ArrayBuffers to string for sending back to the server as JSON.
*
* @param buffer Value to encode to base64
* @param to (optional) The encoding to use, in case it's desirable to encode to base64 instead
*/
export function fromBuffer(buffer, to = 'base64url') {
/**
* Gracefully handle Uint8Array subclass types, like Node's Buffer, that can have a large
* ArrayBuffer backing it.
*/
const _normalized = new Uint8Array(buffer);
return base64.fromArrayBuffer(_normalized.buffer, to === 'base64url');
}
/**
* Convert a base64url string into base64
*/
export function toBase64(base64urlString) {
const fromBase64Url = base64.toArrayBuffer(base64urlString, true);
const toBase64 = base64.fromArrayBuffer(fromBase64Url);
return toBase64;
}
/**
* Encode a UTF-8 string to base64url
*/
export function fromUTF8String(utf8String) {
return base64.fromString(utf8String, true);
}
/**
* Decode a base64url string into its original UTF-8 string
*/
export function toUTF8String(base64urlString) {
return base64.toString(base64urlString, true);
}
/**
* Confirm that the string is encoded into base64
*/
export function isBase64(input) {
return base64.validate(input, false);
}
/**
* Confirm that the string is encoded into base64url, with support for optional padding
*/
export function isBase64URL(input) {
// Trim padding characters from the string if present
input = trimPadding(input);
return base64.validate(input, true);
}
/**
* Remove optional padding from a base64url-encoded string
*/
export function trimPadding(input) {
return input.replace(/=/g, '');
}
@@ -0,0 +1,22 @@
var baseCreate = require('./_baseCreate'),
baseLodash = require('./_baseLodash');
/**
* The base constructor for creating `lodash` wrapper objects.
*
* @private
* @param {*} value The value to wrap.
* @param {boolean} [chainAll] Enable explicit method chain sequences.
*/
function LodashWrapper(value, chainAll) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__chain__ = !!chainAll;
this.__index__ = 0;
this.__values__ = undefined;
}
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
LodashWrapper.prototype.constructor = LodashWrapper;
module.exports = LodashWrapper;
@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSortedNodesModulesNames = void 0;
var getSortedNodesModulesNames = function (modules) {
return modules
.filter(function (m) {
return [
'ImportSpecifier',
'ImportDefaultSpecifier',
'ImportNamespaceSpecifier',
].includes(m.type);
})
.map(function (m) { return m.local.name; });
}; // TODO: get from specifier
exports.getSortedNodesModulesNames = getSortedNodesModulesNames;
@@ -0,0 +1,3 @@
import RegistryBase from "./registry-base";
export default class Registry extends RegistryBase {
}
@@ -0,0 +1,8 @@
type ShapeType = {
width: number;
height: number;
};
declare const getCSSStyleVal: (str: string, parentNum: number) => number;
declare const getRealShape: (el: HTMLElement | null) => ShapeType;
export { ShapeType, getCSSStyleVal, getRealShape };
@@ -0,0 +1,3 @@
import type { DependencyList } from 'react';
declare function useAsyncEffect(effect: () => AsyncGenerator<void, void, void> | Promise<void>, deps?: DependencyList): void;
export default useAsyncEffect;
@@ -0,0 +1,73 @@
var $2a8c0bb1629926c8$exports = require("./useEvent.main.js");
var $78605a5d7424e31b$exports = require("./useLayoutEffect.main.js");
var $4Zukt$react = require("react");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useLoadMore", () => $faa6ccd6fb62f877$export$7717c92ee915373e);
/*
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $faa6ccd6fb62f877$export$7717c92ee915373e(props, ref) {
let { isLoading: isLoading, onLoadMore: onLoadMore, scrollOffset: scrollOffset = 1, items: items } = props;
// Handle scrolling, and call onLoadMore when nearing the bottom.
let isLoadingRef = (0, $4Zukt$react.useRef)(isLoading);
let prevProps = (0, $4Zukt$react.useRef)(props);
let onScroll = (0, $4Zukt$react.useCallback)(()=>{
if (ref.current && !isLoadingRef.current && onLoadMore) {
let shouldLoadMore = ref.current.scrollHeight - ref.current.scrollTop - ref.current.clientHeight < ref.current.clientHeight * scrollOffset;
if (shouldLoadMore) {
isLoadingRef.current = true;
onLoadMore();
}
}
}, [
onLoadMore,
ref,
scrollOffset
]);
let lastItems = (0, $4Zukt$react.useRef)(items);
(0, $78605a5d7424e31b$exports.useLayoutEffect)(()=>{
// Only update isLoadingRef if props object actually changed,
// not if a local state change occurred.
if (props !== prevProps.current) {
isLoadingRef.current = isLoading;
prevProps.current = props;
}
// TODO: Eventually this hook will move back into RAC during which we will accept the collection as a option to this hook.
// We will only load more if the collection has changed after the last load to prevent multiple onLoadMore from being called
// while the data from the last onLoadMore is being processed by RAC collection.
let shouldLoadMore = (ref === null || ref === void 0 ? void 0 : ref.current) && !isLoadingRef.current && onLoadMore && (!items || items !== lastItems.current) && ref.current.clientHeight === ref.current.scrollHeight;
if (shouldLoadMore) {
isLoadingRef.current = true;
onLoadMore === null || onLoadMore === void 0 ? void 0 : onLoadMore();
}
lastItems.current = items;
}, [
isLoading,
onLoadMore,
props,
ref,
items
]);
// TODO: maybe this should still just return scroll props?
// Test against case where the ref isn't defined when this is called
// Think this was a problem when trying to attach to the scrollable body of the table in OnLoadMoreTableBodyScroll
(0, $2a8c0bb1629926c8$exports.useEvent)(ref, 'scroll', onScroll);
}
//# sourceMappingURL=useLoadMore.main.js.map
@@ -0,0 +1,37 @@
.container {
display: flex;
flex-direction: column;
font-family: sans-serif;
}
.container > p {
font-size: 1rem;
}
.container > em {
font-size: .8rem;
}
.dropzone {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
border-width: 2px;
border-radius: 2px;
border-color: #eeeeee;
border-style: dashed;
background-color: #fafafa;
color: #bdbdbd;
outline: none;
transition: border .24s ease-in-out;
}
.dropzone:focus {
border-color: #2196f3;
}
.dropzone.disabled {
opacity: 0.6;
}
@@ -0,0 +1,15 @@
The ISC License
Copyright (c) 2017-2022 npm, Inc., Isaac Z. Schlueter, and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IsValidTimeZoneName = IsValidTimeZoneName;
/**
* https://tc39.es/ecma402/#sec-isvalidtimezonename
* @param tz
* @param implDetails implementation details
*/
function IsValidTimeZoneName(tz, _a) {
var zoneNamesFromData = _a.zoneNamesFromData, uppercaseLinks = _a.uppercaseLinks;
var uppercasedTz = tz.toUpperCase();
var zoneNames = new Set();
var linkNames = new Set();
zoneNamesFromData.map(function (z) { return z.toUpperCase(); }).forEach(function (z) { return zoneNames.add(z); });
Object.keys(uppercaseLinks).forEach(function (linkName) {
linkNames.add(linkName.toUpperCase());
zoneNames.add(uppercaseLinks[linkName].toUpperCase());
});
return zoneNames.has(uppercasedTz) || linkNames.has(uppercasedTz);
}
@@ -0,0 +1,3 @@
import { OneBotAction } from './OneBotAction';
export declare const AutoRegisterRouter: Array<new (...args: any[]) => OneBotAction<unknown, unknown>>;
export declare function ActionHandler(target: new (...args: any[]) => OneBotAction<unknown, unknown>): void;
@@ -0,0 +1,677 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
// eslint-disable-next-line n/prefer-global/process
const { nextTick } = require("process");
/** @typedef {import("./Resolver").FileSystem} FileSystem */
/** @typedef {import("./Resolver").PathLike} PathLike */
/** @typedef {import("./Resolver").PathOrFileDescriptor} PathOrFileDescriptor */
/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */
/** @typedef {FileSystem & SyncFileSystem} BaseFileSystem */
/**
* @template T
* @typedef {import("./Resolver").FileSystemCallback<T>} FileSystemCallback<T>
*/
/**
* @param {string} path path
* @returns {string} dirname
*/
const dirname = (path) => {
let idx = path.length - 1;
while (idx >= 0) {
const char = path.charCodeAt(idx);
// slash or backslash
if (char === 47 || char === 92) break;
idx--;
}
if (idx < 0) return "";
return path.slice(0, idx);
};
/**
* @template T
* @param {FileSystemCallback<T>[]} callbacks callbacks
* @param {Error | null} err error
* @param {T} result result
*/
const runCallbacks = (callbacks, err, result) => {
if (callbacks.length === 1) {
callbacks[0](err, result);
callbacks.length = 0;
return;
}
let error;
for (const callback of callbacks) {
try {
callback(err, result);
} catch (err) {
if (!error) error = err;
}
}
callbacks.length = 0;
if (error) throw error;
};
// eslint-disable-next-line jsdoc/no-restricted-syntax
/** @typedef {Function} EXPECTED_FUNCTION */
// eslint-disable-next-line jsdoc/no-restricted-syntax
/** @typedef {any} EXPECTED_ANY */
class OperationMergerBackend {
/**
* @param {EXPECTED_FUNCTION | undefined} provider async method in filesystem
* @param {EXPECTED_FUNCTION | undefined} syncProvider sync method in filesystem
* @param {BaseFileSystem} providerContext call context for the provider methods
*/
constructor(provider, syncProvider, providerContext) {
this._provider = provider;
this._syncProvider = syncProvider;
this._providerContext = providerContext;
this._activeAsyncOperations = new Map();
this.provide = this._provider
? // Comment to align jsdoc
/**
* @param {PathLike | PathOrFileDescriptor} path path
* @param {object | FileSystemCallback<EXPECTED_ANY> | undefined} options options
* @param {FileSystemCallback<EXPECTED_ANY>=} callback callback
* @returns {EXPECTED_ANY} result
*/
(path, options, callback) => {
if (typeof options === "function") {
callback =
/** @type {FileSystemCallback<EXPECTED_ANY>} */
(options);
options = undefined;
}
if (
typeof path !== "string" &&
!Buffer.isBuffer(path) &&
!(path instanceof URL) &&
typeof path !== "number"
) {
/** @type {EXPECTED_FUNCTION} */
(callback)(
new TypeError("path must be a string, Buffer, URL or number"),
);
return;
}
if (options) {
return /** @type {EXPECTED_FUNCTION} */ (this._provider).call(
this._providerContext,
path,
options,
callback,
);
}
let callbacks = this._activeAsyncOperations.get(path);
if (callbacks) {
callbacks.push(callback);
return;
}
this._activeAsyncOperations.set(path, (callbacks = [callback]));
/** @type {EXPECTED_FUNCTION} */
(provider)(
path,
/**
* @param {Error} err error
* @param {EXPECTED_ANY} result result
*/
(err, result) => {
this._activeAsyncOperations.delete(path);
runCallbacks(callbacks, err, result);
},
);
}
: null;
this.provideSync = this._syncProvider
? // Comment to align jsdoc
/**
* @param {PathLike | PathOrFileDescriptor} path path
* @param {object=} options options
* @returns {EXPECTED_ANY} result
*/
(path, options) =>
/** @type {EXPECTED_FUNCTION} */ (this._syncProvider).call(
this._providerContext,
path,
options,
)
: null;
}
purge() {}
purgeParent() {}
}
/*
IDLE:
insert data: goto SYNC
SYNC:
before provide: run ticks
event loop tick: goto ASYNC_ACTIVE
ASYNC:
timeout: run tick, goto ASYNC_PASSIVE
ASYNC_PASSIVE:
before provide: run ticks
IDLE --[insert data]--> SYNC --[event loop tick]--> ASYNC_ACTIVE --[interval tick]-> ASYNC_PASSIVE
^ |
+---------[insert data]-------+
*/
const STORAGE_MODE_IDLE = 0;
const STORAGE_MODE_SYNC = 1;
const STORAGE_MODE_ASYNC = 2;
/**
* @callback Provide
* @param {PathLike | PathOrFileDescriptor} path path
* @param {EXPECTED_ANY} options options
* @param {FileSystemCallback<EXPECTED_ANY>} callback callback
* @returns {void}
*/
class CacheBackend {
/**
* @param {number} duration max cache duration of items
* @param {EXPECTED_FUNCTION | undefined} provider async method
* @param {EXPECTED_FUNCTION | undefined} syncProvider sync method
* @param {BaseFileSystem} providerContext call context for the provider methods
*/
constructor(duration, provider, syncProvider, providerContext) {
this._duration = duration;
this._provider = provider;
this._syncProvider = syncProvider;
this._providerContext = providerContext;
/** @type {Map<string, FileSystemCallback<EXPECTED_ANY>[]>} */
this._activeAsyncOperations = new Map();
/** @type {Map<string, { err: Error | null, result?: EXPECTED_ANY, level: Set<string> }>} */
this._data = new Map();
/** @type {Set<string>[]} */
this._levels = [];
for (let i = 0; i < 10; i++) this._levels.push(new Set());
for (let i = 5000; i < duration; i += 500) this._levels.push(new Set());
this._currentLevel = 0;
this._tickInterval = Math.floor(duration / this._levels.length);
/** @type {STORAGE_MODE_IDLE | STORAGE_MODE_SYNC | STORAGE_MODE_ASYNC} */
this._mode = STORAGE_MODE_IDLE;
/** @type {NodeJS.Timeout | undefined} */
this._timeout = undefined;
/** @type {number | undefined} */
this._nextDecay = undefined;
// eslint-disable-next-line no-warning-comments
// @ts-ignore
this.provide = provider ? this.provide.bind(this) : null;
// eslint-disable-next-line no-warning-comments
// @ts-ignore
this.provideSync = syncProvider ? this.provideSync.bind(this) : null;
}
/**
* @param {PathLike | PathOrFileDescriptor} path path
* @param {EXPECTED_ANY} options options
* @param {FileSystemCallback<EXPECTED_ANY>} callback callback
* @returns {void}
*/
provide(path, options, callback) {
if (typeof options === "function") {
callback = options;
options = undefined;
}
if (
typeof path !== "string" &&
!Buffer.isBuffer(path) &&
!(path instanceof URL) &&
typeof path !== "number"
) {
callback(new TypeError("path must be a string, Buffer, URL or number"));
return;
}
const strPath = typeof path !== "string" ? path.toString() : path;
if (options) {
return /** @type {EXPECTED_FUNCTION} */ (this._provider).call(
this._providerContext,
path,
options,
callback,
);
}
// When in sync mode we can move to async mode
if (this._mode === STORAGE_MODE_SYNC) {
this._enterAsyncMode();
}
// Check in cache
const cacheEntry = this._data.get(strPath);
if (cacheEntry !== undefined) {
if (cacheEntry.err) return nextTick(callback, cacheEntry.err);
return nextTick(callback, null, cacheEntry.result);
}
// Check if there is already the same operation running
let callbacks = this._activeAsyncOperations.get(strPath);
if (callbacks !== undefined) {
callbacks.push(callback);
return;
}
this._activeAsyncOperations.set(strPath, (callbacks = [callback]));
// Run the operation
/** @type {EXPECTED_FUNCTION} */
(this._provider).call(
this._providerContext,
path,
/**
* @param {Error | null} err error
* @param {EXPECTED_ANY=} result result
*/
(err, result) => {
this._activeAsyncOperations.delete(strPath);
this._storeResult(strPath, err, result);
// Enter async mode if not yet done
this._enterAsyncMode();
runCallbacks(
/** @type {FileSystemCallback<EXPECTED_ANY>[]} */ (callbacks),
err,
result,
);
},
);
}
/**
* @param {PathLike | PathOrFileDescriptor} path path
* @param {EXPECTED_ANY} options options
* @returns {EXPECTED_ANY} result
*/
provideSync(path, options) {
if (
typeof path !== "string" &&
!Buffer.isBuffer(path) &&
!(path instanceof URL) &&
typeof path !== "number"
) {
throw new TypeError("path must be a string");
}
const strPath = typeof path !== "string" ? path.toString() : path;
if (options) {
return /** @type {EXPECTED_FUNCTION} */ (this._syncProvider).call(
this._providerContext,
path,
options,
);
}
// In sync mode we may have to decay some cache items
if (this._mode === STORAGE_MODE_SYNC) {
this._runDecays();
}
// Check in cache
const cacheEntry = this._data.get(strPath);
if (cacheEntry !== undefined) {
if (cacheEntry.err) throw cacheEntry.err;
return cacheEntry.result;
}
// Get all active async operations
// This sync operation will also complete them
const callbacks = this._activeAsyncOperations.get(strPath);
this._activeAsyncOperations.delete(strPath);
// Run the operation
// When in idle mode, we will enter sync mode
let result;
try {
result = /** @type {EXPECTED_FUNCTION} */ (this._syncProvider).call(
this._providerContext,
path,
);
} catch (err) {
this._storeResult(strPath, /** @type {Error} */ (err), undefined);
this._enterSyncModeWhenIdle();
if (callbacks) {
runCallbacks(callbacks, /** @type {Error} */ (err), undefined);
}
throw err;
}
this._storeResult(strPath, null, result);
this._enterSyncModeWhenIdle();
if (callbacks) {
runCallbacks(callbacks, null, result);
}
return result;
}
/**
* @param {(string | Buffer | URL | number | (string | URL | Buffer | number)[] | Set<string | URL | Buffer | number>)=} what what to purge
*/
purge(what) {
if (!what) {
if (this._mode !== STORAGE_MODE_IDLE) {
this._data.clear();
for (const level of this._levels) {
level.clear();
}
this._enterIdleMode();
}
} else if (
typeof what === "string" ||
Buffer.isBuffer(what) ||
what instanceof URL ||
typeof what === "number"
) {
const strWhat = typeof what !== "string" ? what.toString() : what;
for (const [key, data] of this._data) {
if (key.startsWith(strWhat)) {
this._data.delete(key);
data.level.delete(key);
}
}
if (this._data.size === 0) {
this._enterIdleMode();
}
} else {
for (const [key, data] of this._data) {
for (const item of what) {
const strItem = typeof item !== "string" ? item.toString() : item;
if (key.startsWith(strItem)) {
this._data.delete(key);
data.level.delete(key);
break;
}
}
}
if (this._data.size === 0) {
this._enterIdleMode();
}
}
}
/**
* @param {(string | Buffer | URL | number | (string | URL | Buffer | number)[] | Set<string | URL | Buffer | number>)=} what what to purge
*/
purgeParent(what) {
if (!what) {
this.purge();
} else if (
typeof what === "string" ||
Buffer.isBuffer(what) ||
what instanceof URL ||
typeof what === "number"
) {
const strWhat = typeof what !== "string" ? what.toString() : what;
this.purge(dirname(strWhat));
} else {
const set = new Set();
for (const item of what) {
const strItem = typeof item !== "string" ? item.toString() : item;
set.add(dirname(strItem));
}
this.purge(set);
}
}
/**
* @param {string} path path
* @param {Error | null} err error
* @param {EXPECTED_ANY} result result
*/
_storeResult(path, err, result) {
if (this._data.has(path)) return;
const level = this._levels[this._currentLevel];
this._data.set(path, { err, result, level });
level.add(path);
}
_decayLevel() {
const nextLevel = (this._currentLevel + 1) % this._levels.length;
const decay = this._levels[nextLevel];
this._currentLevel = nextLevel;
for (const item of decay) {
this._data.delete(item);
}
decay.clear();
if (this._data.size === 0) {
this._enterIdleMode();
} else {
/** @type {number} */
(this._nextDecay) += this._tickInterval;
}
}
_runDecays() {
while (
/** @type {number} */ (this._nextDecay) <= Date.now() &&
this._mode !== STORAGE_MODE_IDLE
) {
this._decayLevel();
}
}
_enterAsyncMode() {
let timeout = 0;
switch (this._mode) {
case STORAGE_MODE_ASYNC:
return;
case STORAGE_MODE_IDLE:
this._nextDecay = Date.now() + this._tickInterval;
timeout = this._tickInterval;
break;
case STORAGE_MODE_SYNC:
this._runDecays();
// _runDecays may change the mode
if (
/** @type {STORAGE_MODE_IDLE | STORAGE_MODE_SYNC | STORAGE_MODE_ASYNC} */
(this._mode) === STORAGE_MODE_IDLE
) {
return;
}
timeout = Math.max(
0,
/** @type {number} */ (this._nextDecay) - Date.now(),
);
break;
}
this._mode = STORAGE_MODE_ASYNC;
const ref = setTimeout(() => {
this._mode = STORAGE_MODE_SYNC;
this._runDecays();
}, timeout);
if (ref.unref) ref.unref();
this._timeout = ref;
}
_enterSyncModeWhenIdle() {
if (this._mode === STORAGE_MODE_IDLE) {
this._mode = STORAGE_MODE_SYNC;
this._nextDecay = Date.now() + this._tickInterval;
}
}
_enterIdleMode() {
this._mode = STORAGE_MODE_IDLE;
this._nextDecay = undefined;
if (this._timeout) clearTimeout(this._timeout);
}
}
/**
* @template {EXPECTED_FUNCTION} Provider
* @template {EXPECTED_FUNCTION} AsyncProvider
* @template FileSystem
* @param {number} duration duration in ms files are cached
* @param {Provider | undefined} provider provider
* @param {AsyncProvider | undefined} syncProvider sync provider
* @param {BaseFileSystem} providerContext provider context
* @returns {OperationMergerBackend | CacheBackend} backend
*/
const createBackend = (duration, provider, syncProvider, providerContext) => {
if (duration > 0) {
return new CacheBackend(duration, provider, syncProvider, providerContext);
}
return new OperationMergerBackend(provider, syncProvider, providerContext);
};
module.exports = class CachedInputFileSystem {
/**
* @param {BaseFileSystem} fileSystem file system
* @param {number} duration duration in ms files are cached
*/
constructor(fileSystem, duration) {
this.fileSystem = fileSystem;
this._lstatBackend = createBackend(
duration,
this.fileSystem.lstat,
this.fileSystem.lstatSync,
this.fileSystem,
);
const lstat = this._lstatBackend.provide;
this.lstat = /** @type {FileSystem["lstat"]} */ (lstat);
const lstatSync = this._lstatBackend.provideSync;
this.lstatSync = /** @type {SyncFileSystem["lstatSync"]} */ (lstatSync);
this._statBackend = createBackend(
duration,
this.fileSystem.stat,
this.fileSystem.statSync,
this.fileSystem,
);
const stat = this._statBackend.provide;
this.stat = /** @type {FileSystem["stat"]} */ (stat);
const statSync = this._statBackend.provideSync;
this.statSync = /** @type {SyncFileSystem["statSync"]} */ (statSync);
this._readdirBackend = createBackend(
duration,
this.fileSystem.readdir,
this.fileSystem.readdirSync,
this.fileSystem,
);
const readdir = this._readdirBackend.provide;
this.readdir = /** @type {FileSystem["readdir"]} */ (readdir);
const readdirSync = this._readdirBackend.provideSync;
this.readdirSync = /** @type {SyncFileSystem["readdirSync"]} */ (
readdirSync
);
this._readFileBackend = createBackend(
duration,
this.fileSystem.readFile,
this.fileSystem.readFileSync,
this.fileSystem,
);
const readFile = this._readFileBackend.provide;
this.readFile = /** @type {FileSystem["readFile"]} */ (readFile);
const readFileSync = this._readFileBackend.provideSync;
this.readFileSync = /** @type {SyncFileSystem["readFileSync"]} */ (
readFileSync
);
this._readJsonBackend = createBackend(
duration,
// prettier-ignore
this.fileSystem.readJson ||
(this.readFile &&
(
/**
* @param {string} path path
* @param {FileSystemCallback<EXPECTED_ANY>} callback callback
*/
(path, callback) => {
this.readFile(path, (err, buffer) => {
if (err) return callback(err);
if (!buffer || buffer.length === 0)
{return callback(new Error("No file content"));}
let data;
try {
data = JSON.parse(buffer.toString("utf8"));
} catch (err_) {
return callback(/** @type {Error} */ (err_));
}
callback(null, data);
});
})
),
// prettier-ignore
this.fileSystem.readJsonSync ||
(this.readFileSync &&
(
/**
* @param {string} path path
* @returns {EXPECTED_ANY} result
*/
(path) => {
const buffer = this.readFileSync(path);
const data = JSON.parse(buffer.toString("utf8"));
return data;
}
)),
this.fileSystem,
);
const readJson = this._readJsonBackend.provide;
this.readJson = /** @type {FileSystem["readJson"]} */ (readJson);
const readJsonSync = this._readJsonBackend.provideSync;
this.readJsonSync = /** @type {SyncFileSystem["readJsonSync"]} */ (
readJsonSync
);
this._readlinkBackend = createBackend(
duration,
this.fileSystem.readlink,
this.fileSystem.readlinkSync,
this.fileSystem,
);
const readlink = this._readlinkBackend.provide;
this.readlink = /** @type {FileSystem["readlink"]} */ (readlink);
const readlinkSync = this._readlinkBackend.provideSync;
this.readlinkSync = /** @type {SyncFileSystem["readlinkSync"]} */ (
readlinkSync
);
this._realpathBackend = createBackend(
duration,
this.fileSystem.realpath,
this.fileSystem.realpathSync,
this.fileSystem,
);
const realpath = this._realpathBackend.provide;
this.realpath = /** @type {FileSystem["realpath"]} */ (realpath);
const realpathSync = this._realpathBackend.provideSync;
this.realpathSync = /** @type {SyncFileSystem["realpathSync"]} */ (
realpathSync
);
}
/**
* @param {(string | Buffer | URL | number | (string | URL | Buffer | number)[] | Set<string | URL | Buffer | number>)=} what what to purge
*/
purge(what) {
this._statBackend.purge(what);
this._lstatBackend.purge(what);
this._readdirBackend.purgeParent(what);
this._readFileBackend.purge(what);
this._readlinkBackend.purge(what);
this._readJsonBackend.purge(what);
this._realpathBackend.purge(what);
}
};
@@ -0,0 +1,28 @@
import { PrettyFormatOptions } from '@vitest/pretty-format';
type Inspect = (value: unknown, options: Options) => string;
interface Options {
showHidden: boolean;
depth: number;
colors: boolean;
customInspect: boolean;
showProxy: boolean;
maxArrayLength: number;
breakLength: number;
truncate: number;
seen: unknown[];
inspect: Inspect;
stylize: (value: string, styleType: string) => string;
}
type LoupeOptions = Partial<Options>;
interface StringifyOptions extends PrettyFormatOptions {
maxLength?: number;
}
declare function stringify(object: unknown, maxDepth?: number, { maxLength,...options }?: StringifyOptions): string;
declare const formatRegExp: RegExp;
declare function format(...args: unknown[]): string;
declare function inspect(obj: unknown, options?: LoupeOptions): string;
declare function objDisplay(obj: unknown, options?: LoupeOptions): string;
export { format, formatRegExp, inspect, objDisplay, stringify };
export type { LoupeOptions, StringifyOptions };
@@ -0,0 +1,180 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
import {GridNode, GridRow, GridCollection as IGridCollection} from '@react-types/grid';
import {Key} from '@react-types/shared';
interface GridCollectionOptions<T> {
columnCount: number,
items: GridRow<T>[],
visitNode?: (cell: GridNode<T>) => GridNode<T>
}
export class GridCollection<T> implements IGridCollection<T> {
keyMap: Map<Key, GridNode<T>> = new Map();
columnCount: number;
rows: GridNode<T>[];
constructor(opts: GridCollectionOptions<T>) {
this.keyMap = new Map();
this.columnCount = opts?.columnCount;
this.rows = [];
let visit = (node: GridNode<T>) => {
// If the node is the same object as the previous node for the same key,
// we can skip this node and its children. We always visit columns though,
// because we depend on order to build the columns array.
let prevNode = this.keyMap.get(node.key);
if (opts.visitNode) {
node = opts.visitNode(node);
}
this.keyMap.set(node.key, node);
let childKeys = new Set();
let last: GridNode<T> | null = null;
let rowHasCellWithColSpan = false;
if (node.type === 'item') {
for (let child of node.childNodes) {
if (child.props?.colSpan !== undefined) {
rowHasCellWithColSpan = true;
break;
}
}
}
for (let child of node.childNodes as Iterable<GridNode<T>>) {
if (child.type === 'cell' && rowHasCellWithColSpan) {
child.colspan = child.props?.colSpan;
child.colSpan = child.props?.colSpan;
child.colIndex = !last ? child.index : (last.colIndex ?? last.index) + (last.colSpan ?? 1);
}
if (child.type === 'cell' && child.parentKey == null) {
// if child is a cell parent key isn't already established by the collection, match child node to parent row
child.parentKey = node.key;
}
childKeys.add(child.key);
if (last) {
last.nextKey = child.key;
child.prevKey = last.key;
} else {
child.prevKey = null;
}
visit(child);
last = child;
}
if (last) {
last.nextKey = null;
}
// Remove deleted nodes and their children from the key map
if (prevNode) {
for (let child of prevNode.childNodes) {
if (!childKeys.has(child.key)) {
remove(child);
}
}
}
};
let remove = (node: GridNode<T>) => {
this.keyMap.delete(node.key);
for (let child of node.childNodes) {
if (this.keyMap.get(child.key) === child) {
remove(child);
}
}
};
let last: GridNode<T> | null = null;
for (let [i, node] of opts.items.entries()) {
let rowNode: GridNode<T> = {
...node,
level: node.level ?? 0,
key: node.key ?? 'row-' + i,
type: node.type ?? 'row',
value: node.value ?? null,
hasChildNodes: true,
childNodes: [...node.childNodes],
rendered: node.rendered,
textValue: node.textValue ?? '',
index: node.index ?? i
};
if (last) {
last.nextKey = rowNode.key;
rowNode.prevKey = last.key;
} else {
rowNode.prevKey = null;
}
this.rows.push(rowNode);
visit(rowNode);
last = rowNode;
}
if (last) {
last.nextKey = null;
}
}
*[Symbol.iterator](): IterableIterator<GridNode<T>> {
yield* [...this.rows];
}
get size(): number {
return [...this.rows].length;
}
getKeys(): IterableIterator<Key> {
return this.keyMap.keys();
}
getKeyBefore(key: Key): Key | null {
let node = this.keyMap.get(key);
return node ? node.prevKey ?? null : null;
}
getKeyAfter(key: Key): Key | null {
let node = this.keyMap.get(key);
return node ? node.nextKey ?? null : null;
}
getFirstKey(): Key | null {
return [...this.rows][0]?.key;
}
getLastKey(): Key | null {
let rows = [...this.rows];
return rows[rows.length - 1]?.key;
}
getItem(key: Key): GridNode<T> | null {
return this.keyMap.get(key) ?? null;
}
at(idx: number): GridNode<T> | null {
const keys = [...this.getKeys()];
return this.getItem(keys[idx]);
}
getChildren(key: Key): Iterable<GridNode<T>> {
let node = this.keyMap.get(key);
return node?.childNodes || [];
}
}
@@ -0,0 +1,268 @@
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
const args1 = z.tuple([z.string()]);
const returns1 = z.number();
const func1 = z.function({
input: args1,
output: returns1,
});
test("function parsing", () => {
const parsed = func1.implement((arg: any) => arg.length);
const result = parsed("asdf");
expect(result).toBe(4);
});
test("parsed function fail 1", () => {
// @ts-expect-error
const parsed = func1.implement((x: string) => x);
expect(() => parsed("asdf")).toThrow();
});
test("parsed function fail 2", () => {
// @ts-expect-error
const parsed = func1.implement((x: string) => x);
expect(() => parsed(13 as any)).toThrow();
});
test("function inference 1", () => {
type func1 = (typeof func1)["_input"];
expectTypeOf<func1>().toEqualTypeOf<(k: string) => number>();
});
// test("method parsing", () => {
// const methodObject = z.object({
// property: z.number(),
// method: z
// .function()
// .input(z.tuple([z.string()]))
// .output(z.number()),
// });
// const methodInstance = {
// property: 3,
// method: function (s: string) {
// return s.length + this.property;
// },
// };
// const parsed = methodObject.parse(methodInstance);
// expect(parsed.method("length=8")).toBe(11); // 8 length + 3 property
// });
// test("async method parsing", async () => {
// const methodObject = z.object({
// property: z.number(),
// method: z.function().input(z.string()).output(z.promise(z.number())),
// });
// const methodInstance = {
// property: 3,
// method: async function (s: string) {
// return s.length + this.property;
// },
// };
// const parsed = methodObject.parse(methodInstance);
// expect(await parsed.method("length=8")).toBe(11); // 8 length + 3 property
// });
test("args method", () => {
const t1 = z.function();
type t1 = (typeof t1)["_input"];
expectTypeOf<t1>().toEqualTypeOf<(...args_1: never[]) => unknown>();
t1._input;
const t2args = z.tuple([z.string()], z.unknown());
const t2 = t1.input(t2args);
type t2 = (typeof t2)["_input"];
expectTypeOf<t2>().toEqualTypeOf<(arg: string, ...args_1: unknown[]) => unknown>();
const t3 = t2.output(z.boolean());
type t3 = (typeof t3)["_input"];
expectTypeOf<t3>().toEqualTypeOf<(arg: string, ...args_1: unknown[]) => boolean>();
});
// test("custom args", () => {
// const fn = z.function().implement((_a: string, _b: number) => {
// return new Date();
// });
// expectTypeOf(fn).toEqualTypeOf<(a: string, b: number) => Date>();
// });
const args2 = z.tuple([
z.object({
f1: z.number(),
f2: z.string().nullable(),
f3: z.array(z.boolean().optional()).optional(),
}),
]);
const returns2 = z.union([z.string(), z.number()]);
const func2 = z.function({
input: args2,
output: returns2,
});
test("function inference 2", () => {
type func2 = (typeof func2)["_input"];
expectTypeOf<func2>().toEqualTypeOf<
(arg: {
f3?: (boolean | undefined)[] | undefined;
f1: number;
f2: string | null;
}) => string | number
>();
});
test("valid function run", () => {
const validFunc2Instance = func2.implement((_x) => {
_x.f2;
_x.f3![0];
return "adf" as any;
});
validFunc2Instance({
f1: 21,
f2: "asdf",
f3: [true, false],
});
});
test("input validation error", () => {
const schema = z.function({
input: z.tuple([z.string()]),
output: z.void(),
});
const fn = schema.implement(() => 1234 as any);
// @ts-expect-error
const checker = () => fn();
try {
checker();
} catch (e: any) {
expect(e.issues).toMatchInlineSnapshot(`
[
{
"code": "invalid_type",
"expected": "string",
"message": "Invalid input: expected string, received undefined",
"path": [
0,
],
},
]
`);
}
});
test("array inputs", () => {
const a = z.function({
input: [
z.object({
name: z.string(),
age: z.number().int(),
}),
],
output: z.string(),
});
a.implement((args) => {
return `${args.age}`;
});
const b = z.function({
input: [
z.object({
name: z.string(),
age: z.number().int(),
}),
],
});
b.implement((args) => {
return `${args.age}`;
});
});
test("output validation error", () => {
const schema = z.function({
input: z.tuple([]),
output: z.string(),
});
const fn = schema.implement(() => 1234 as any);
try {
fn();
} catch (e: any) {
expect(e.issues).toMatchInlineSnapshot(`
[
{
"code": "invalid_type",
"expected": "string",
"message": "Invalid input: expected string, received number",
"path": [],
},
]
`);
}
});
test("function with async refinements", async () => {
const schema = z
.function()
.input([z.string().refine(async (val) => val.length > 10)])
.output(z.promise(z.number().refine(async (val) => val > 10)));
const func = schema.implementAsync(async (val) => {
return val.length;
});
const results = [];
try {
await func("asdfasdf");
results.push("success");
} catch (_) {
results.push("fail");
}
try {
await func("asdflkjasdflkjsf");
results.push("success");
} catch (_) {
results.push("fail");
}
expect(results).toEqual(["fail", "success"]);
});
test("non async function with async refinements should fail", async () => {
const func = z
.function()
.input([z.string().refine(async (val) => val.length > 10)])
.output(z.number().refine(async (val) => val > 10))
.implement((val) => {
return val.length;
});
const results = [];
try {
await func("asdasdfasdffasdf");
results.push("success");
} catch (_) {
results.push("fail");
}
expect(results).toEqual(["fail"]);
});
test("extra parameters with rest", () => {
const maxLength5 = z
.function()
.input([z.string()], z.unknown())
.output(z.boolean())
.implement((str, _arg, _qewr) => {
return str.length <= 5;
});
const filteredList = ["apple", "orange", "pear", "banana", "strawberry"].filter(maxLength5);
expect(filteredList.length).toEqual(2);
});
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('isString', require('../isString'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,9 @@
import {
getMargin,
useSpacer
} from "./chunk-BRFD4NXM.mjs";
import "./chunk-CH7FQ62Q.mjs";
export {
getMargin,
useSpacer
};
@@ -0,0 +1 @@
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/glob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,WAAW,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAGL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKpD,4CAA4C;AAC5C,gDAAgD;AAChD,MAAM,eAAe,GACnB,CACE,OAAO,OAAO,KAAK,QAAQ;IAC3B,OAAO;IACP,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CACrC,CAAC,CAAC;IACD,OAAO,CAAC,QAAQ;IAClB,CAAC,CAAC,OAAO,CAAA;AAyVX;;GAEG;AACH,MAAM,OAAO,IAAI;IACf,QAAQ,CAAU;IAClB,GAAG,CAAQ;IACX,IAAI,CAAS;IACb,GAAG,CAAS;IACZ,WAAW,CAAS;IACpB,MAAM,CAAS;IACf,MAAM,CAAiC;IACvC,aAAa,CAAS;IACtB,IAAI,CAAU;IACd,SAAS,CAAS;IAClB,QAAQ,CAAQ;IAChB,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,KAAK,CAAS;IACd,KAAK,CAAS;IACd,UAAU,CAAS;IACnB,OAAO,CAAU;IACjB,QAAQ,CAAiB;IACzB,QAAQ,CAAS;IACjB,MAAM,CAAY;IAClB,IAAI,CAAS;IACb,MAAM,CAAc;IACpB,oBAAoB,CAAS;IAC7B,aAAa,CAAiB;IAC9B,mBAAmB,CAAS;IAE5B;;OAEG;IACH,IAAI,CAAM;IAEV;;OAEG;IACH,QAAQ,CAAW;IAEnB;;;;;;;;;;;OAWG;IACH,YAAY,OAA0B,EAAE,IAAU;QAChD,qBAAqB;QACrB,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAA;QACvD,oBAAoB;QACpB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,aAAgC,CAAA;QAC5D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QACzB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAA;QAC3B,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAA;QACrB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAA;QACrC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA;QACzB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;QACvB,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,GAAG,GAAG,EAAE,CAAA;QACf,CAAC;aAAM,IAAI,IAAI,CAAC,GAAG,YAAY,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACrE,IAAI,CAAC,GAAG,GAAG,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACpC,CAAC;QACD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,CAAA;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACrB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAA;QACzC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAA;QAC7B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAA;QAC/B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC7B,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,KAAK,KAAK,CAAA;QAE7D,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAA;QACnC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAA;QACjC,IAAI,CAAC,QAAQ;YACX,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAA;QAC9D,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;QACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QAEzB,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;QAC/D,CAAC;QAED,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,GAAG,CAAC,OAAO,CAAC,CAAA;QACrB,CAAC;QAED,IAAI,CAAC,oBAAoB;YACvB,CAAC,CAAC,IAAI,CAAC,oBAAoB;gBAC1B,IAAyC,CAAC,kBAAkB;oBAC3D,KAAK,CAAA;QAET,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC9B,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAA;QACnD,CAAC;QAED,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACpB,MAAM,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAA;YACxD,CAAC;YACD,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;QACjE,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QAEtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,eAAe,CAAA;QAChD,IAAI,CAAC,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAA;QAChD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;YACzB,IACE,IAAI,CAAC,MAAM,KAAK,SAAS;gBACzB,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC,MAAM,EAClC,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;YACrE,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GACV,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,eAAe;gBAC3C,CAAC,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,gBAAgB;oBAC/C,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe;wBACjC,CAAC,CAAC,UAAU,CAAA;YACd,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;gBACjC,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,EAAE,EAAE,IAAI,CAAC,EAAE;aACZ,CAAC,CAAA;QACJ,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;QAEhC,8DAA8D;QAC9D,0DAA0D;QAC1D,6DAA6D;QAC7D,kCAAkC;QAClC,MAAM,eAAe,GACnB,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAA;QAEzD,MAAM,GAAG,GAAqB;YAC5B,mCAAmC;YACnC,GAAG,IAAI;YACP,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,eAAe;YACf,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI;YACd,iBAAiB,EAAE,CAAC;YACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;YAC/C,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;SACzB,CAAA;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;QACxD,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,GAAG,CAAC,MAAM,CACtC,CAAC,GAA0B,EAAE,CAAC,EAAE,EAAE;YAChC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;YACrB,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,Line truncated
@@ -0,0 +1,102 @@
var $c9aa5a224613c979$exports = require("./ListCollection.main.js");
var $5RsKl$reactstatelyselection = require("@react-stately/selection");
var $5RsKl$react = require("react");
var $5RsKl$reactstatelycollections = require("@react-stately/collections");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useListState", () => $5450691d3629f6ea$export$2f645645f7bca764);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $5450691d3629f6ea$export$2f645645f7bca764(props) {
let { filter: filter, layoutDelegate: layoutDelegate } = props;
let selectionState = (0, $5RsKl$reactstatelyselection.useMultipleSelectionState)(props);
let disabledKeys = (0, $5RsKl$react.useMemo)(()=>props.disabledKeys ? new Set(props.disabledKeys) : new Set(), [
props.disabledKeys
]);
let factory = (0, $5RsKl$react.useCallback)((nodes)=>filter ? new (0, $c9aa5a224613c979$exports.ListCollection)(filter(nodes)) : new (0, $c9aa5a224613c979$exports.ListCollection)(nodes), [
filter
]);
let context = (0, $5RsKl$react.useMemo)(()=>({
suppressTextValueWarning: props.suppressTextValueWarning
}), [
props.suppressTextValueWarning
]);
let collection = (0, $5RsKl$reactstatelycollections.useCollection)(props, factory, context);
let selectionManager = (0, $5RsKl$react.useMemo)(()=>new (0, $5RsKl$reactstatelyselection.SelectionManager)(collection, selectionState, {
layoutDelegate: layoutDelegate
}), [
collection,
selectionState,
layoutDelegate
]);
// Reset focused key if that item is deleted from the collection.
const cachedCollection = (0, $5RsKl$react.useRef)(null);
(0, $5RsKl$react.useEffect)(()=>{
if (selectionState.focusedKey != null && !collection.getItem(selectionState.focusedKey) && cachedCollection.current) {
const startItem = cachedCollection.current.getItem(selectionState.focusedKey);
const cachedItemNodes = [
...cachedCollection.current.getKeys()
].map((key)=>{
const itemNode = cachedCollection.current.getItem(key);
return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === 'item' ? itemNode : null;
}).filter((node)=>node !== null);
const itemNodes = [
...collection.getKeys()
].map((key)=>{
const itemNode = collection.getItem(key);
return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === 'item' ? itemNode : null;
}).filter((node)=>node !== null);
var _cachedItemNodes_length, _itemNodes_length;
const diff = ((_cachedItemNodes_length = cachedItemNodes === null || cachedItemNodes === void 0 ? void 0 : cachedItemNodes.length) !== null && _cachedItemNodes_length !== void 0 ? _cachedItemNodes_length : 0) - ((_itemNodes_length = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length !== void 0 ? _itemNodes_length : 0);
var _startItem_index, _startItem_index1, _itemNodes_length1;
let index = Math.min(diff > 1 ? Math.max(((_startItem_index = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index !== void 0 ? _startItem_index : 0) - diff + 1, 0) : (_startItem_index1 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index1 !== void 0 ? _startItem_index1 : 0, ((_itemNodes_length1 = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length1 !== void 0 ? _itemNodes_length1 : 0) - 1);
let newNode = null;
let isReverseSearching = false;
while(index >= 0){
if (!selectionManager.isDisabled(itemNodes[index].key)) {
newNode = itemNodes[index];
break;
}
// Find next, not disabled item.
if (index < itemNodes.length - 1 && !isReverseSearching) index++;
else {
isReverseSearching = true;
var _startItem_index2, _startItem_index3;
if (index > ((_startItem_index2 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index2 !== void 0 ? _startItem_index2 : 0)) index = (_startItem_index3 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index3 !== void 0 ? _startItem_index3 : 0;
index--;
}
}
selectionState.setFocusedKey(newNode ? newNode.key : null);
}
cachedCollection.current = collection;
}, [
collection,
selectionManager,
selectionState,
selectionState.focusedKey
]);
return {
collection: collection,
disabledKeys: disabledKeys,
selectionManager: selectionManager
};
}
//# sourceMappingURL=useListState.main.js.map
@@ -0,0 +1,13 @@
import React from 'react';
import type { DataType, PhotoProviderBase } from './types';
import './PhotoSlider.less';
export interface IPhotoSliderProps extends PhotoProviderBase {
images: DataType[];
index?: number;
onIndexChange?: (index: number) => void;
visible: boolean;
onClose: (evt?: React.MouseEvent | React.TouchEvent) => void;
afterClose?: () => void;
direction?: 'ltr' | 'rtl';
}
export default function PhotoSlider(props: IPhotoSliderProps): React.JSX.Element | null;
@@ -0,0 +1,451 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = formatToParts;
var tslib_1 = require("tslib");
var decimal_js_1 = tslib_1.__importDefault(require("decimal.js"));
var regex_generated_1 = require("../regex.generated");
var digit_mapping_generated_1 = require("./digit-mapping.generated");
var GetUnsignedRoundingMode_1 = require("./GetUnsignedRoundingMode");
var ToRawFixed_1 = require("./ToRawFixed");
// This is from: unicode-12.1.0/General_Category/Symbol/regex.js
// IE11 does not support unicode flag, otherwise this is just /\p{S}/u.
// /^\p{S}/u
var CARET_S_UNICODE_REGEX = new RegExp("^".concat(regex_generated_1.S_UNICODE_REGEX.source));
// /\p{S}$/u
var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(regex_generated_1.S_UNICODE_REGEX.source, "$"));
var CLDR_NUMBER_PATTERN = /[#0](?:[\.,][#0]+)*/g;
function formatToParts(numberResult, data, pl, options) {
var _a;
var sign = numberResult.sign, exponent = numberResult.exponent, magnitude = numberResult.magnitude;
var notation = options.notation, style = options.style, numberingSystem = options.numberingSystem;
var defaultNumberingSystem = data.numbers.nu[0];
// #region Part 1: partition and interpolate the CLDR number pattern.
// ----------------------------------------------------------
var compactNumberPattern = null;
if (notation === 'compact' && magnitude) {
compactNumberPattern = getCompactDisplayPattern(numberResult, pl, data, style, options.compactDisplay, options.currencyDisplay, numberingSystem);
}
// This is used multiple times
var nonNameCurrencyPart;
if (style === 'currency' && options.currencyDisplay !== 'name') {
var byCurrencyDisplay = data.currencies[options.currency];
if (byCurrencyDisplay) {
switch (options.currencyDisplay) {
case 'code':
nonNameCurrencyPart = options.currency;
break;
case 'symbol':
nonNameCurrencyPart = byCurrencyDisplay.symbol;
break;
default:
nonNameCurrencyPart = byCurrencyDisplay.narrow;
break;
}
}
else {
// Fallback for unknown currency
nonNameCurrencyPart = options.currency;
}
}
var numberPattern;
if (!compactNumberPattern) {
// Note: if the style is unit, or is currency and the currency display is name,
// its unit parts will be interpolated in part 2. So here we can fallback to decimal.
if (style === 'decimal' ||
style === 'unit' ||
(style === 'currency' && options.currencyDisplay === 'name')) {
// Shortcut for decimal
var decimalData = data.numbers.decimal[numberingSystem] ||
data.numbers.decimal[defaultNumberingSystem];
numberPattern = getPatternForSign(decimalData.standard, sign);
}
else if (style === 'currency') {
var currencyData = data.numbers.currency[numberingSystem] ||
data.numbers.currency[defaultNumberingSystem];
// We replace number pattern part with `0` for easier postprocessing.
numberPattern = getPatternForSign(currencyData[options.currencySign], sign);
}
else {
// percent
var percentPattern = data.numbers.percent[numberingSystem] ||
data.numbers.percent[defaultNumberingSystem];
numberPattern = getPatternForSign(percentPattern, sign);
}
}
else {
numberPattern = compactNumberPattern;
}
// Extract the decimal number pattern string. It looks like "#,##0,00", which will later be
// used to infer decimal group sizes.
var decimalNumberPattern = CLDR_NUMBER_PATTERN.exec(numberPattern)[0];
// Now we start to substitute patterns
// 1. replace strings like `0` and `#,##0.00` with `{0}`
// 2. unquote characters (invariant: the quoted characters does not contain the special tokens)
numberPattern = numberPattern
.replace(CLDR_NUMBER_PATTERN, '{0}')
.replace(/'(.)'/g, '$1');
// Handle currency spacing (both compact and non-compact).
if (style === 'currency' && options.currencyDisplay !== 'name') {
var currencyData = data.numbers.currency[numberingSystem] ||
data.numbers.currency[defaultNumberingSystem];
// See `currencySpacing` substitution rule in TR-35.
// Here we always assume the currencyMatch is "[:^S:]" and surroundingMatch is "[:digit:]".
//
// Example 1: for pattern "#,##0.00¤" with symbol "US$", we replace "¤" with the symbol,
// but insert an extra non-break space before the symbol, because "[:^S:]" matches "U" in
// "US$" and "[:digit:]" matches the latn numbering system digits.
//
// Example 2: for pattern "¤#,##0.00" with symbol "US$", there is no spacing between symbol
// and number, because `$` does not match "[:^S:]".
//
// Implementation note: here we do the best effort to infer the insertion.
// We also assume that `beforeInsertBetween` and `afterInsertBetween` will never be `;`.
var afterCurrency = currencyData.currencySpacing.afterInsertBetween;
if (afterCurrency && !S_DOLLAR_UNICODE_REGEX.test(nonNameCurrencyPart)) {
numberPattern = numberPattern.replace('¤{0}', "\u00A4".concat(afterCurrency, "{0}"));
}
var beforeCurrency = currencyData.currencySpacing.beforeInsertBetween;
if (beforeCurrency && !CARET_S_UNICODE_REGEX.test(nonNameCurrencyPart)) {
numberPattern = numberPattern.replace('{0}¤', "{0}".concat(beforeCurrency, "\u00A4"));
}
}
// The following tokens are special: `{0}`, `¤`, `%`, `-`, `+`, `{c:...}.
var numberPatternParts = numberPattern.split(/({c:[^}]+}|\{0\}|[¤%\-\+])/g);
var numberParts = [];
var symbols = data.numbers.symbols[numberingSystem] ||
data.numbers.symbols[defaultNumberingSystem];
for (var _i = 0, numberPatternParts_1 = numberPatternParts; _i < numberPatternParts_1.length; _i++) {
var part = numberPatternParts_1[_i];
if (!part) {
continue;
}
switch (part) {
case '{0}': {
// We only need to handle scientific and engineering notation here.
numberParts.push.apply(numberParts, partitionNumberIntoParts(symbols, numberResult, notation, exponent, numberingSystem,
// If compact number pattern exists, do not insert group separators.
!compactNumberPattern && ((_a = options.useGrouping) !== null && _a !== void 0 ? _a : true), decimalNumberPattern, style, options.roundingIncrement, (0, GetUnsignedRoundingMode_1.GetUnsignedRoundingMode)(options.roundingMode, sign === -1)));
break;
}
case '-':
numberParts.push({ type: 'minusSign', value: symbols.minusSign });
break;
case '+':
numberParts.push({ type: 'plusSign', value: symbols.plusSign });
break;
case '%':
numberParts.push({ type: 'percentSign', value: symbols.percentSign });
break;
case '¤':
// Computed above when handling currency spacing.
numberParts.push({ type: 'currency', value: nonNameCurrencyPart });
break;
default:
if (/^\{c:/.test(part)) {
numberParts.push({
type: 'compact',
value: part.substring(3, part.length - 1),
});
}
else {
// literal
numberParts.push({ type: 'literal', value: part });
}
break;
}
}
// #endregion
// #region Part 2: interpolate unit pattern if necessary.
// ----------------------------------------------
switch (style) {
case 'currency': {
// `currencyDisplay: 'name'` has similar pattern handling as units.
if (options.currencyDisplay === 'name') {
var unitPattern = (data.numbers.currency[numberingSystem] ||
data.numbers.currency[defaultNumberingSystem]).unitPattern;
// Select plural
var unitName = void 0;
var currencyNameData = data.currencies[options.currency];
if (currencyNameData) {
unitName = selectPlural(pl, numberResult.roundedNumber
.times(decimal_js_1.default.pow(10, exponent))
.toNumber(), currencyNameData.displayName);
}
else {
// Fallback for unknown currency
unitName = options.currency;
}
// Do {0} and {1} substitution
var unitPatternParts = unitPattern.split(/(\{[01]\})/g);
var result = [];
for (var _b = 0, unitPatternParts_1 = unitPatternParts; _b < unitPatternParts_1.length; _b++) {
var part = unitPatternParts_1[_b];
switch (part) {
case '{0}':
result.push.apply(result, numberParts);
break;
case '{1}':
result.push({ type: 'currency', value: unitName });
break;
default:
if (part) {
result.push({ type: 'literal', value: part });
}
break;
}
}
return result;
}
else {
return numberParts;
}
}
case 'unit': {
var unit = options.unit, unitDisplay = options.unitDisplay;
var unitData = data.units.simple[unit];
var unitPattern = void 0;
if (unitData) {
// Simple unit pattern
unitPattern = selectPlural(pl, numberResult.roundedNumber
.times(decimal_js_1.default.pow(10, exponent))
.toNumber(), data.units.simple[unit][unitDisplay]);
}
else {
// See: http://unicode.org/reports/tr35/tr35-general.html#perUnitPatterns
// If cannot find unit in the simple pattern, it must be "per" compound pattern.
// Implementation note: we are not following TR-35 here because we need to format to parts!
var _c = unit.split('-per-'), numeratorUnit = _c[0], denominatorUnit = _c[1];
unitData = data.units.simple[numeratorUnit];
var numeratorUnitPattern = selectPlural(pl, numberResult.roundedNumber
.times(decimal_js_1.default.pow(10, exponent))
.toNumber(), data.units.simple[numeratorUnit][unitDisplay]);
var perUnitPattern = data.units.simple[denominatorUnit].perUnit[unitDisplay];
if (perUnitPattern) {
// perUnitPattern exists, combine it with numeratorUnitPattern
unitPattern = perUnitPattern.replace('{0}', numeratorUnitPattern);
}
else {
// get compoundUnit pattern (e.g. "{0} per {1}"), repalce {0} with numerator pattern and {1} with
// the denominator pattern in singular form.
var perPattern = data.units.compound.per[unitDisplay];
var denominatorPattern = selectPlural(pl, 1, data.units.simple[denominatorUnit][unitDisplay]);
unitPattern = unitPattern = perPattern
.replace('{0}', numeratorUnitPattern)
.replace('{1}', denominatorPattern.replace('{0}', ''));
}
}
var result = [];
// We need spacing around "{0}" because they are not treated as "unit" parts, but "literal".
for (var _d = 0, _e = unitPattern.split(/(\s*\{0\}\s*)/); _d < _e.length; _d++) {
var part = _e[_d];
var interpolateMatch = /^(\s*)\{0\}(\s*)$/.exec(part);
if (interpolateMatch) {
// Space before "{0}"
if (interpolateMatch[1]) {
result.push({ type: 'literal', value: interpolateMatch[1] });
}
// "{0}" itself
result.push.apply(result, numberParts);
// Space after "{0}"
if (interpolateMatch[2]) {
result.push({ type: 'literal', value: interpolateMatch[2] });
}
}
else if (part) {
result.push({ type: 'unit', value: part });
}
}
return result;
}
default:
return numberParts;
}
// #endregion
}
// A subset of https://tc39.es/ecma402/#sec-partitionnotationsubpattern
// Plus the exponent parts handling.
function partitionNumberIntoParts(symbols, numberResult, notation, exponent, numberingSystem, useGrouping,
/**
* This is the decimal number pattern without signs or symbols.
* It is used to infer the group size when `useGrouping` is true.
*
* A typical value looks like "#,##0.00" (primary group size is 3).
* Some locales like Hindi has secondary group size of 2 (e.g. "#,##,##0.00").
*/
decimalNumberPattern, style, roundingIncrement, unsignedRoundingMode) {
var result = [];
// eslint-disable-next-line prefer-const
var n = numberResult.formattedString, x = numberResult.roundedNumber;
if (x.isNaN()) {
return [{ type: 'nan', value: n }];
}
else if (!x.isFinite()) {
return [{ type: 'infinity', value: n }];
}
var digitReplacementTable = digit_mapping_generated_1.digitMapping[numberingSystem];
if (digitReplacementTable) {
n = n.replace(/\d/g, function (digit) { return digitReplacementTable[+digit] || digit; });
}
// TODO: Else use an implementation dependent algorithm to map n to the appropriate
// representation of n in the given numbering system.
var decimalSepIndex = n.indexOf('.');
var integer;
var fraction;
if (decimalSepIndex > 0) {
integer = n.slice(0, decimalSepIndex);
fraction = n.slice(decimalSepIndex + 1);
}
else {
integer = n;
}
// #region Grouping integer digits
// The weird compact and x >= 10000 check is to ensure consistency with Node.js and Chrome.
// Note that `de` does not have compact form for thousands, but Node.js does not insert grouping separator
// unless the rounded number is greater than 10000:
// NumberFormat('de', {notation: 'compact', compactDisplay: 'short'}).format(1234) //=> "1234"
// NumberFormat('de').format(1234) //=> "1.234"
var shouldUseGrouping = false;
if (useGrouping === 'always') {
shouldUseGrouping = true;
}
else if (useGrouping === 'min2') {
shouldUseGrouping = x.greaterThanOrEqualTo(10000);
}
else if (useGrouping === 'auto' || useGrouping) {
shouldUseGrouping = notation !== 'compact' || x.greaterThanOrEqualTo(10000);
}
if (shouldUseGrouping) {
// a. Let groupSepSymbol be the implementation-, locale-, and numbering system-dependent (ILND) String representing the grouping separator.
// For currency we should use `currencyGroup` instead of generic `group`
var groupSepSymbol = style === 'currency' && symbols.currencyGroup != null
? symbols.currencyGroup
: symbols.group;
var groups = [];
// > There may be two different grouping sizes: The primary grouping size used for the least
// > significant integer group, and the secondary grouping size used for more significant groups.
// > If a pattern contains multiple grouping separators, the interval between the last one and the
// > end of the integer defines the primary grouping size, and the interval between the last two
// > defines the secondary grouping size. All others are ignored.
var integerNumberPattern = decimalNumberPattern.split('.')[0];
var patternGroups = integerNumberPattern.split(',');
var primaryGroupingSize = 3;
var secondaryGroupingSize = 3;
if (patternGroups.length > 1) {
primaryGroupingSize = patternGroups[patternGroups.length - 1].length;
}
if (patternGroups.length > 2) {
secondaryGroupingSize = patternGroups[patternGroups.length - 2].length;
}
var i = integer.length - primaryGroupingSize;
if (i > 0) {
// Slice the least significant integer group
groups.push(integer.slice(i, i + primaryGroupingSize));
// Then iteratively push the more signicant groups
// TODO: handle surrogate pairs in some numbering system digits
for (i -= secondaryGroupingSize; i > 0; i -= secondaryGroupingSize) {
groups.push(integer.slice(i, i + secondaryGroupingSize));
}
groups.push(integer.slice(0, i + secondaryGroupingSize));
}
else {
groups.push(integer);
}
while (groups.length > 0) {
var integerGroup = groups.pop();
result.push({ type: 'integer', value: integerGroup });
if (groups.length > 0) {
result.push({ type: 'group', value: groupSepSymbol });
}
}
}
else {
result.push({ type: 'integer', value: integer });
}
// #endregion
if (fraction !== undefined) {
var decimalSepSymbol = style === 'currency' && symbols.currencyDecimal != null
? symbols.currencyDecimal
: symbols.decimal;
result.push({ type: 'decimal', value: decimalSepSymbol }, { type: 'fraction', value: fraction });
}
if ((notation === 'scientific' || notation === 'engineering') &&
x.isFinite()) {
result.push({ type: 'exponentSeparator', value: symbols.exponential });
if (exponent < 0) {
result.push({ type: 'exponentMinusSign', value: symbols.minusSign });
exponent = -exponent;
}
var exponentResult = (0, ToRawFixed_1.ToRawFixed)(new decimal_js_1.default(exponent), 0, 0, roundingIncrement, unsignedRoundingMode);
result.push({
type: 'exponentInteger',
value: exponentResult.formattedString,
});
}
return result;
}
function getPatternForSign(pattern, sign) {
if (pattern.indexOf(';') < 0) {
pattern = "".concat(pattern, ";-").concat(pattern);
}
var _a = pattern.split(';'), zeroPattern = _a[0], negativePattern = _a[1];
switch (sign) {
case 0:
return zeroPattern;
case -1:
return negativePattern;
default:
return negativePattern.indexOf('-') >= 0
? negativePattern.replace(/-/g, '+')
: "+".concat(zeroPattern);
}
}
// Find the CLDR pattern for compact notation based on the magnitude of data and style.
//
// Example return value: "¤ {c:laki}000;¤{c:laki} -0" (`sw` locale):
// - Notice the `{c:...}` token that wraps the compact literal.
// - The consecutive zeros are normalized to single zero to match CLDR_NUMBER_PATTERN.
//
// Returning null means the compact display pattern cannot be found.
function getCompactDisplayPattern(numberResult, pl, data, style, compactDisplay, currencyDisplay, numberingSystem) {
var _a;
var roundedNumber = numberResult.roundedNumber, sign = numberResult.sign, magnitude = numberResult.magnitude;
var magnitudeKey = String(Math.pow(10, magnitude));
var defaultNumberingSystem = data.numbers.nu[0];
var pattern;
if (style === 'currency' && currencyDisplay !== 'name') {
var byNumberingSystem = data.numbers.currency;
var currencyData = byNumberingSystem[numberingSystem] ||
byNumberingSystem[defaultNumberingSystem];
// NOTE: compact notation ignores currencySign!
var compactPluralRules = (_a = currencyData.short) === null || _a === void 0 ? void 0 : _a[magnitudeKey];
if (!compactPluralRules) {
return null;
}
pattern = selectPlural(pl, roundedNumber.toNumber(), compactPluralRules);
}
else {
var byNumberingSystem = data.numbers.decimal;
var byCompactDisplay = byNumberingSystem[numberingSystem] ||
byNumberingSystem[defaultNumberingSystem];
var compactPlaralRule = byCompactDisplay[compactDisplay][magnitudeKey];
if (!compactPlaralRule) {
return null;
}
pattern = selectPlural(pl, roundedNumber.toNumber(), compactPlaralRule);
}
// See https://unicode.org/reports/tr35/tr35-numbers.html#Compact_Number_Formats
// > If the value is precisely “0”, either explicit or defaulted, then the normal number format
// > pattern for that sort of object is supplied.
if (pattern === '0') {
return null;
}
pattern = getPatternForSign(pattern, sign)
// Extract compact literal from the pattern
.replace(/([^\s;\-\+\d¤]+)/g, '{c:$1}')
// We replace one or more zeros with a single zero so it matches `CLDR_NUMBER_PATTERN`.
.replace(/0+/, '0');
return pattern;
}
function selectPlural(pl, x, rules) {
return rules[pl.select(x)] || rules.other;
}
@@ -0,0 +1,5 @@
/*! https://mths.be/includes v2.0.0 by @mathias */
'use strict';
require('./shim')();
@@ -0,0 +1,9 @@
import ws from "./ws";
const handler = {
scheme: "wss",
domainHost: ws.domainHost,
parse: ws.parse,
serialize: ws.serialize
};
export default handler;
//# sourceMappingURL=wss.js.map
@@ -0,0 +1,4 @@
import { ServiceIdentifier } from '@inversifyjs/common';
import { BindingConstraints } from '@inversifyjs/core';
export declare function isNotParentBindingConstraintsWithServiceId(serviceId: ServiceIdentifier): (constraints: BindingConstraints) => boolean;
//# sourceMappingURL=isNotParentBindingConstraintsWithServiceId.d.ts.map
@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var docNoterefRole = {
abstract: false,
accessibleNameRequired: true,
baseConcepts: [],
childrenPresentational: false,
nameFrom: ['author', 'contents'],
prohibitedProps: [],
props: {
'aria-errormessage': null,
'aria-invalid': null
},
relatedConcepts: [{
concept: {
name: 'noteref [EPUB-SSV]'
},
module: 'EPUB'
}],
requireContextRole: [],
requiredContextRole: [],
requiredOwnedElements: [],
requiredProps: {},
superClass: [['roletype', 'widget', 'command', 'link']]
};
var _default = exports.default = docNoterefRole;
@@ -0,0 +1,5 @@
type primitive = null | undefined | string | symbol | number | boolean | bigint;
declare function ToPrimitive(input: unknown, hint?: StringConstructor | NumberConstructor): primitive;
export = ToPrimitive;
@@ -0,0 +1,12 @@
'use strict'
const { stringify } = require('jsonfile/utils')
const { outputFile } = require('../output-file')
async function outputJson (file, data, options = {}) {
const str = stringify(data, options)
await outputFile(file, str, options)
}
module.exports = outputJson
@@ -0,0 +1,444 @@
// @ts-check
import path from 'path'
import fs from 'fs'
import postcssrc from 'postcss-load-config'
import { lilconfig } from 'lilconfig'
import loadPlugins from 'postcss-load-config/src/plugins' // Little bit scary, looking at private/internal API
import loadOptions from 'postcss-load-config/src/options' // Little bit scary, looking at private/internal API
import tailwind from '../../processTailwindFeatures'
import { loadAutoprefixer, loadCssNano, loadPostcss, loadPostcssImport } from './deps'
import { formatNodes, drainStdin, outputFile } from './utils'
import { env } from '../../lib/sharedState'
import resolveConfig from '../../../resolveConfig.js'
import { createBroadPatternCheck, parseCandidateFiles } from '../../lib/content.js'
import { createWatcher } from './watching.js'
import fastGlob from 'fast-glob'
import { findAtConfigPath } from '../../lib/findAtConfigPath.js'
import log from '../../util/log'
import { loadConfig } from '../../lib/load-config'
import getModuleDependencies from '../../lib/getModuleDependencies'
/**
*
* @param {string} [customPostCssPath ]
* @returns
*/
async function loadPostCssPlugins(customPostCssPath) {
let config = customPostCssPath
? await (async () => {
let file = path.resolve(customPostCssPath)
// Implementation, see: https://unpkg.com/browse/postcss-load-config@3.1.0/src/index.js
// @ts-ignore
let { config = {} } = await lilconfig('postcss').load(file)
if (typeof config === 'function') {
config = config()
} else {
config = Object.assign({}, config)
}
if (!config.plugins) {
config.plugins = []
}
// We have to await these because in v5 and v6 of postcss-load-config
// these functions return promises while they don't in v4. Awaiting a
// non-promise is basically a no-op so this is safe to do.
return {
file,
plugins: await loadPlugins(config, file),
options: await loadOptions(config, file),
}
})()
: await postcssrc()
let configPlugins = config.plugins
let configPluginTailwindIdx = configPlugins.findIndex((plugin) => {
if (typeof plugin === 'function' && plugin.name === 'tailwindcss') {
return true
}
if (typeof plugin === 'object' && plugin !== null && plugin.postcssPlugin === 'tailwindcss') {
return true
}
return false
})
let beforePlugins =
configPluginTailwindIdx === -1 ? [] : configPlugins.slice(0, configPluginTailwindIdx)
let afterPlugins =
configPluginTailwindIdx === -1
? configPlugins
: configPlugins.slice(configPluginTailwindIdx + 1)
return [beforePlugins, afterPlugins, config.options]
}
function loadBuiltinPostcssPlugins() {
let postcss = loadPostcss()
let IMPORT_COMMENT = '__TAILWIND_RESTORE_IMPORT__: '
return [
[
(root) => {
root.walkAtRules('import', (rule) => {
if (rule.params.slice(1).startsWith('tailwindcss/')) {
rule.after(postcss.comment({ text: IMPORT_COMMENT + rule.params }))
rule.remove()
}
})
},
loadPostcssImport(),
(root) => {
root.walkComments((rule) => {
if (rule.text.startsWith(IMPORT_COMMENT)) {
rule.after(
postcss.atRule({
name: 'import',
params: rule.text.replace(IMPORT_COMMENT, ''),
})
)
rule.remove()
}
})
},
],
[],
{},
]
}
let state = {
/** @type {any} */
context: null,
/** @type {ReturnType<typeof createWatcher> | null} */
watcher: null,
/** @type {{content: string, extension: string}[]} */
changedContent: [],
/** @type {ReturnType<typeof load> | null} */
configBag: null,
contextDependencies: new Set(),
/** @type {import('../../lib/content.js').ContentPath[]} */
contentPaths: [],
refreshContentPaths() {
this.contentPaths = parseCandidateFiles(this.context, this.context?.tailwindConfig)
},
get config() {
return this.context.tailwindConfig
},
get contentPatterns() {
return {
all: this.contentPaths.map((contentPath) => contentPath.pattern),
dynamic: this.contentPaths
.filter((contentPath) => contentPath.glob !== undefined)
.map((contentPath) => contentPath.pattern),
}
},
loadConfig(configPath, content) {
if (this.watcher && configPath) {
this.refreshConfigDependencies()
}
let config = loadConfig(configPath)
let dependencies = getModuleDependencies(configPath)
this.configBag = {
config,
dependencies,
dispose() {
for (let file of dependencies) {
delete require.cache[require.resolve(file)]
}
},
}
// @ts-ignore
this.configBag.config = resolveConfig(this.configBag.config, { content: { files: [] } })
// Override content files if `--content` has been passed explicitly
if (content?.length > 0) {
this.configBag.config.content.files = content
}
return this.configBag.config
},
refreshConfigDependencies() {
env.DEBUG && console.time('Module dependencies')
this.configBag?.dispose()
env.DEBUG && console.timeEnd('Module dependencies')
},
readContentPaths() {
let content = []
// Resolve globs from the content config
// TODO: When we make the postcss plugin async-capable this can become async
let files = fastGlob.sync(this.contentPatterns.all)
let checkBroadPattern = createBroadPatternCheck(this.contentPatterns.all)
for (let file of files) {
checkBroadPattern(file)
content.push({
content: fs.readFileSync(path.resolve(file), 'utf8'),
extension: path.extname(file).slice(1),
})
}
// Resolve raw content in the tailwind config
let rawContent = this.config.content.files.filter((file) => {
return file !== null && typeof file === 'object'
})
for (let { raw: htmlContent, extension = 'html' } of rawContent) {
content.push({ content: htmlContent, extension })
}
return content
},
getContext({ createContext, cliConfigPath, root, result, content }) {
env.DEBUG && console.time('Searching for config')
let configPath = findAtConfigPath(root, result) ?? cliConfigPath
env.DEBUG && console.timeEnd('Searching for config')
if (this.context) {
this.context.changedContent = this.changedContent.splice(0)
return this.context
}
env.DEBUG && console.time('Loading config')
let config = this.loadConfig(configPath, content)
env.DEBUG && console.timeEnd('Loading config')
env.DEBUG && console.time('Creating context')
this.context = createContext(config, [])
Object.assign(this.context, {
userConfigPath: configPath,
})
env.DEBUG && console.timeEnd('Creating context')
env.DEBUG && console.time('Resolving content paths')
this.refreshContentPaths()
env.DEBUG && console.timeEnd('Resolving content paths')
if (this.watcher) {
env.DEBUG && console.time('Watch new files')
this.watcher.refreshWatchedFiles()
env.DEBUG && console.timeEnd('Watch new files')
}
for (let file of this.readContentPaths()) {
this.context.changedContent.push(file)
}
return this.context
},
}
export async function createProcessor(args, cliConfigPath) {
let postcss = loadPostcss()
let input = args['--input']
let output = args['--output']
let includePostCss = args['--postcss']
let customPostCssPath = typeof args['--postcss'] === 'string' ? args['--postcss'] : undefined
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss
? await loadPostCssPlugins(customPostCssPath)
: loadBuiltinPostcssPlugins()
if (args['--purge']) {
log.warn('purge-flag-deprecated', [
'The `--purge` flag has been deprecated.',
'Please use `--content` instead.',
])
if (!args['--content']) {
args['--content'] = args['--purge']
}
}
let content = args['--content']?.split(/(?<!{[^}]+),/) ?? []
let tailwindPlugin = () => {
return {
postcssPlugin: 'tailwindcss',
async Once(root, { result }) {
env.DEBUG && console.time('Compiling CSS')
await tailwind(({ createContext }) => {
console.error()
console.error('Rebuilding...')
return () => {
return state.getContext({
createContext,
cliConfigPath,
root,
result,
content,
})
}
})(root, result)
env.DEBUG && console.timeEnd('Compiling CSS')
},
}
}
tailwindPlugin.postcss = true
let plugins = [
...beforePlugins,
tailwindPlugin,
!args['--minify'] && formatNodes,
...afterPlugins,
!args['--no-autoprefixer'] && loadAutoprefixer(),
args['--minify'] && loadCssNano(),
].filter(Boolean)
/** @type {import('postcss').Processor} */
// @ts-ignore
let processor = postcss(plugins)
async function readInput() {
// Piping in data, let's drain the stdin
if (input === '-') {
return drainStdin()
}
// Input file has been provided
if (input) {
return fs.promises.readFile(path.resolve(input), 'utf8')
}
// No input file provided, fallback to default at-rules
return '@tailwind base; @tailwind components; @tailwind utilities'
}
async function build() {
let start = process.hrtime.bigint()
return readInput()
.then((css) => processor.process(css, { ...postcssOptions, from: input, to: output }))
.then((result) => {
if (!state.watcher) {
return result
}
env.DEBUG && console.time('Recording PostCSS dependencies')
for (let message of result.messages) {
if (message.type === 'dependency') {
state.contextDependencies.add(message.file)
}
}
env.DEBUG && console.timeEnd('Recording PostCSS dependencies')
// TODO: This needs to be in a different spot
env.DEBUG && console.time('Watch new files')
state.watcher.refreshWatchedFiles()
env.DEBUG && console.timeEnd('Watch new files')
return result
})
.then((result) => {
if (!output) {
process.stdout.write(result.css)
return
}
return Promise.all([
outputFile(result.opts.to, result.css),
result.map && outputFile(result.opts.to + '.map', result.map.toString()),
])
})
.then(() => {
let end = process.hrtime.bigint()
console.error()
console.error('Done in', (end - start) / BigInt(1e6) + 'ms.')
})
.then(
() => {},
(err) => {
// TODO: If an initial build fails we can't easily pick up any PostCSS dependencies
// that were collected before the error occurred
// The result is not stored on the error so we have to store it externally
// and pull the messages off of it here somehow
// This results in a less than ideal DX because the watcher will not pick up
// changes to imported CSS if one of them caused an error during the initial build
// If you fix it and then save the main CSS file so there's no error
// The watcher will start watching the imported CSS files and will be
// resilient to future errors.
if (state.watcher) {
console.error(err)
} else {
return Promise.reject(err)
}
}
)
}
/**
* @param {{file: string, content(): Promise<string>, extension: string}[]} changes
*/
async function parseChanges(changes) {
return Promise.all(
changes.map(async (change) => ({
content: await change.content(),
extension: change.extension,
}))
)
}
if (input !== undefined && input !== '-') {
state.contextDependencies.add(path.resolve(input))
}
return {
build,
watch: async () => {
state.watcher = createWatcher(args, {
state,
/**
* @param {{file: string, content(): Promise<string>, extension: string}[]} changes
*/
async rebuild(changes) {
let needsNewContext = changes.some((change) => {
return (
state.configBag?.dependencies.has(change.file) ||
state.contextDependencies.has(change.file)
)
})
if (needsNewContext) {
state.context = null
} else {
for (let change of await parseChanges(changes)) {
state.changedContent.push(change)
}
}
return build()
},
})
await build()
},
}
}
@@ -0,0 +1,35 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./BlockScope"), exports);
__exportStar(require("./CatchScope"), exports);
__exportStar(require("./ClassFieldInitializerScope"), exports);
__exportStar(require("./ClassScope"), exports);
__exportStar(require("./ConditionalTypeScope"), exports);
__exportStar(require("./ForScope"), exports);
__exportStar(require("./FunctionExpressionNameScope"), exports);
__exportStar(require("./FunctionScope"), exports);
__exportStar(require("./FunctionTypeScope"), exports);
__exportStar(require("./GlobalScope"), exports);
__exportStar(require("./MappedTypeScope"), exports);
__exportStar(require("./ModuleScope"), exports);
__exportStar(require("./Scope"), exports);
__exportStar(require("./ScopeType"), exports);
__exportStar(require("./SwitchScope"), exports);
__exportStar(require("./TSEnumScope"), exports);
__exportStar(require("./TSModuleScope"), exports);
__exportStar(require("./TypeScope"), exports);
__exportStar(require("./WithScope"), exports);
@@ -0,0 +1,4 @@
{
"main": "../../cjs/_export_star.cjs",
"module": "../../esm/_export_star.js"
}
@@ -0,0 +1,8 @@
"use client";
import {
card_footer_default
} from "./chunk-TE6SZS6W.mjs";
import "./chunk-XHGGCEVJ.mjs";
export {
card_footer_default as default
};
@@ -0,0 +1,219 @@
/**
* @fileoverview Rule to count multiple spaces in regular expressions
* @author Matt DuVall <http://www.mattduvall.com/>
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
const regexpp = require("@eslint-community/regexpp");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const regExpParser = new regexpp.RegExpParser();
const DOUBLE_SPACE = / {2}/u;
/**
* Check if node is a string
* @param {ASTNode} node node to evaluate
* @returns {boolean} True if its a string
* @private
*/
function isString(node) {
return node && node.type === "Literal" && typeof node.value === "string";
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Disallow multiple spaces in regular expressions",
recommended: true,
url: "https://eslint.org/docs/latest/rules/no-regex-spaces",
},
schema: [],
fixable: "code",
messages: {
multipleSpaces: "Spaces are hard to count. Use {{{length}}}.",
},
},
create(context) {
const sourceCode = context.sourceCode;
/**
* Validate regular expression
* @param {ASTNode} nodeToReport Node to report.
* @param {string} pattern Regular expression pattern to validate.
* @param {string} rawPattern Raw representation of the pattern in the source code.
* @param {number} rawPatternStartRange Start range of the pattern in the source code.
* @param {string} flags Regular expression flags.
* @returns {void}
* @private
*/
function checkRegex(
nodeToReport,
pattern,
rawPattern,
rawPatternStartRange,
flags,
) {
// Skip if there are no consecutive spaces in the source code, to avoid reporting e.g., RegExp(' \ ').
if (!DOUBLE_SPACE.test(rawPattern)) {
return;
}
const characterClassNodes = [];
let regExpAST;
try {
regExpAST = regExpParser.parsePattern(
pattern,
0,
pattern.length,
{
unicode: flags.includes("u"),
unicodeSets: flags.includes("v"),
},
);
} catch {
// Ignore regular expressions with syntax errors
return;
}
regexpp.visitRegExpAST(regExpAST, {
onCharacterClassEnter(ccNode) {
characterClassNodes.push(ccNode);
},
});
const spacesPattern = /( {2,})(?: [+*{?]|[^+*{?]|$)/gu;
let match;
while ((match = spacesPattern.exec(pattern))) {
const {
1: { length },
index,
} = match;
// Report only consecutive spaces that are not in character classes.
if (
characterClassNodes.every(
({ start, end }) => index < start || end <= index,
)
) {
context.report({
node: nodeToReport,
messageId: "multipleSpaces",
data: { length },
fix(fixer) {
if (pattern !== rawPattern) {
return null;
}
return fixer.replaceTextRange(
[
rawPatternStartRange + index,
rawPatternStartRange + index + length,
],
` {${length}}`,
);
},
});
// Report only the first occurrence of consecutive spaces
return;
}
}
}
/**
* Validate regular expression literals
* @param {ASTNode} node node to validate
* @returns {void}
* @private
*/
function checkLiteral(node) {
if (node.regex) {
const pattern = node.regex.pattern;
const rawPattern = node.raw.slice(1, node.raw.lastIndexOf("/"));
const rawPatternStartRange = node.range[0] + 1;
const flags = node.regex.flags;
checkRegex(
node,
pattern,
rawPattern,
rawPatternStartRange,
flags,
);
}
}
/**
* Validate strings passed to the RegExp constructor
* @param {ASTNode} node node to validate
* @returns {void}
* @private
*/
function checkFunction(node) {
const scope = sourceCode.getScope(node);
const regExpVar = astUtils.getVariableByName(scope, "RegExp");
const shadowed = regExpVar && regExpVar.defs.length > 0;
const patternNode = node.arguments[0];
if (
node.callee.type === "Identifier" &&
node.callee.name === "RegExp" &&
isString(patternNode) &&
!shadowed
) {
const pattern = patternNode.value;
const rawPattern = patternNode.raw.slice(1, -1);
const rawPatternStartRange = patternNode.range[0] + 1;
let flags;
if (node.arguments.length < 2) {
// It has no flags.
flags = "";
} else {
const flagsNode = node.arguments[1];
if (isString(flagsNode)) {
flags = flagsNode.value;
} else {
// The flags cannot be determined.
return;
}
}
checkRegex(
node,
pattern,
rawPattern,
rawPatternStartRange,
flags,
);
}
}
return {
Literal: checkLiteral,
CallExpression: checkFunction,
NewExpression: checkFunction,
};
},
};
@@ -0,0 +1 @@
{"version":3,"file":"compile-pattern.d.ts","sourceRoot":"","sources":["compile-pattern.js"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
"use client";
import {
dropdown_default
} from "./chunk-KQ5CH2X7.mjs";
import "./chunk-BV7BCS3N.mjs";
import "./chunk-IURKDIR4.mjs";
export {
dropdown_default as default
};
@@ -0,0 +1,11 @@
import ResizeObserverPolyfill from './ResizeObserver.js';
import global from './shims/global.js';
export default (() => {
// Export existing implementation if available.
if (typeof global.ResizeObserver !== 'undefined') {
return global.ResizeObserver;
}
return ResizeObserverPolyfill;
})();
@@ -0,0 +1,18 @@
import { createTailwindMerge } from './create-tailwind-merge'
import { getDefaultConfig } from './default-config'
import { mergeConfigs } from './merge-configs'
import { Config } from './types'
type CreateConfigSubsequent = (config: Config) => Config
export function extendTailwindMerge(
configExtension: Partial<Config> | CreateConfigSubsequent,
...createConfig: CreateConfigSubsequent[]
) {
return typeof configExtension === 'function'
? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig)
: createTailwindMerge(
() => mergeConfigs(getDefaultConfig(), configExtension),
...createConfig,
)
}
@@ -0,0 +1,15 @@
'use strict';
module.exports = function(pattern) {
if (typeof pattern !== 'string') {
throw new TypeError('expected a string');
}
var glob = { negated: false, pattern: pattern, original: pattern };
if (pattern.charAt(0) === '!' && pattern.charAt(1) !== '(') {
glob.negated = true;
glob.pattern = pattern.slice(1);
}
return glob;
};
@@ -0,0 +1,825 @@
export default `flf2a$ 8 7 20 -1 7
STELLAR by Ron Fritz 8/94
Figlet Release 2.0
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@@
\`..@
\`..@
\`..@
\`. @
\`. @
@
\`..@
@@
\`. \`.@
\`. \`.@
@
@
@
@
@
@@
@
\`.. \`.. @
\`...... \`....@
\`.. \`.. @
\`.. \`.. @
\`...... \`....@
\`.. \`.. @
@@
\`.. @
\`. \`.. @
\`.. @
\`.. @
\`..@
\`.. \`.. @
\`.. @
@@
@
\`.. \`.. @
\`.. @
\`.. @
\`.. @
\`.. @
\`.. \`.. @
@@
\`. @
\`.. \`..@
\`.. @
\`... @
\`.. @
\`.. \`..@
\`. @
@@
\`..@
\`.@
@
@
@
@
@
@@
\`..@
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
\`..@
@@
\`.. @
\`.. @
\`..@
\`..@
\`..@
\`.. @
\`.. @
@@
\`.. @
\`.. \`.. \`..@
\`. \`. \`.. @
\`.... \`.......@
\`. \`. \`.. @
\`.. \`.. \`..@
\`.. @
@@
@
\`.. @
\`.. @
\`... \`.....@
\`.. @
\`.. @
@
@@
@
@
@
@
@
@
\`..@
\`.@@
@
@
@
\`.....@
@
@
@
@@
@
@
@
@
@
@
\`..@
@@
\`..@
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
@@
@
\`.. @
\`.. \`.. @
\`.. \`.. @
\`.. \`..@
\`.. \`.. @
\`... @
@@
@
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
\`....@
@@
@
\`.. \`.. @
\`. \`..@
\`.. @
\`.. @
\`.. @
\`........ @
@@
@
\`.. \`.. @
\`.. @
\`.. @
\`.. @
\`..@
\`..... @
@@
@
\`.. @
\` \`.. @
\`. \`.. @
\`.. \`.. @
\`.... \`. \`..@
\`.. @
@@
@
\`.. \`... @
\`.. @
\`... @
\`.. @
\`..@
\`... \`.. @
@@
@
\`.. @
\`.. @
\`.. @
\`. \`.. @
\`.. \`..@
\`.. \`.. @
@@
@
\`..... \`..@
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
@@
@
\`. @
\`.. \`.. @
\`.. \`. @
\`.. \`. @
\`.. \`..@
\`.... @
@@
@
\`. \`.. @
\`.. \`..@
\`. \`.. @
\`. \`.. @
\`.. @
\`.. @
@@
@
@
@
@
\`..@
@
\`..@
@@
@
@
@
@
\`..@
@
\`..@
\`.@@
\`..@
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
\`..@
@@
@
@
\`......@
@
\`......@
@
@
@@
\`.. @
\`.. @
\`.. @
\`..@
\`.. @
\`.. @
\`.. @
@@
\`... @
\`.. @
\`..@
\`.. @
\`.. @
@
\`.. @
@@
@
\`... @
\`. \`.. @
\`. \`.. \`..@
\`.. \`..\` \`..@
\`.. \`\`\` @
\`.. @
@@
\`. @
\`. .. @
\`. \`.. @
\`.. \`.. @
\`...... \`.. @
\`.. \`.. @
\`.. \`..@
@@
\`.. \`.. @
\`. \`.. @
\`. \`..@
\`... \`. @
\`. \`..@
\`. \`.@
\`.... \`.. @
@@
\`.. @
\`.. \`..@
\`.. @
\`.. @
\`.. @
\`.. \`..@
\`.... @
@@
\`..... @
\`.. \`.. @
\`.. \`..@
\`.. \`..@
\`.. \`..@
\`.. \`.. @
\`..... @
@@
\`........@
\`.. @
\`.. @
\`...... @
\`.. @
\`.. @
\`........@
@@
\`........@
\`.. @
\`.. @
\`...... @
\`.. @
\`.. @
\`.. @
@@
\`.... @
\`. \`.. @
\`.. @
\`.. @
\`.. \`....@
\`.. \`. @
\`..... @
@@
\`.. \`..@
\`.. \`..@
\`.. \`..@
\`...... \`..@
\`.. \`..@
\`.. \`..@
\`.. \`..@
@@
\`..@
\`..@
\`..@
\`..@
\`..@
\`..@
\`..@
@@
\`..@
\`..@
\`..@
\`..@
\`..@
\`. \`..@
\`.... @
@@
\`.. \`.. @
\`.. \`.. @
\`.. \`.. @
\`. \`. @
\`.. \`.. @
\`.. \`.. @
\`.. \`..@
@@
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
\`........@
@@
\`.. \`..@
\`. \`.. \`...@
\`.. \`.. \` \`..@
\`.. \`.. \`..@
\`.. \`. \`..@
\`.. \`..@
\`.. \`..@
@@
\`... \`..@
\`. \`.. \`..@
\`.. \`.. \`..@
\`.. \`.. \`..@
\`.. \`. \`..@
\`.. \`. ..@
\`.. \`..@
@@
\`.... @
\`.. \`.. @
\`.. \`..@
\`.. \`..@
\`.. \`..@
\`.. \`.. @
\`.... @
@@
\`....... @
\`.. \`..@
\`.. \`..@
\`....... @
\`.. @
\`.. @
\`.. @
@@
\`.... @
\`.. \`.. @
\`.. \`..@
\`.. \`..@
\`.. \`..@
\`.. \`. \`.. @
\`.. .. @
\`. @@
\`....... @
\`.. \`.. @
\`.. \`.. @
\`. \`.. @
\`.. \`.. @
\`.. \`.. @
\`.. \`..@
@@
\`.. .. @
\`.. \`..@
\`.. @
\`.. @
\`.. @
\`.. \`..@
\`.. .. @
@@
\`... \`......@
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
@@
\`.. \`..@
\`.. \`..@
\`.. \`..@
\`.. \`..@
\`.. \`..@
\`.. \`..@
\`..... @
@@
\`.. \`..@
\`.. \`.. @
\`.. \`.. @
\`.. \`.. @
\`.. \`.. @
\`.... @
\`.. @
@@
\`.. \`..@
\`.. \`..@
\`.. \`. \`..@
\`.. \`.. \`..@
\`.. \`. \`.. \`..@
\`. \`. \`....@
\`.. \`..@
@@
\`.. \`..@
\`.. \`.. @
\`.. \`.. @
\`.. @
\`.. \`.. @
\`.. \`.. @
\`.. \`..@
@@
\`.. \`..@
\`.. \`.. @
\`.. \`.. @
\`.. @
\`.. @
\`.. @
\`.. @
@@
\`....... \`..@
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
\`...........@
@@
\`....@
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
\`....@
@@
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
\`.. @
\`..@
@@
\`....@
\`..@
\`..@
\`..@
\`..@
\`..@
\`....@
@@
\`.. @
\`.. \`.. @
\`.. \`..@
@
@
@
@
@@
@
@
@
@
@
@
@
\`.....@@
\`..@
\`. @
@
@
@
@
@
@@
@
@
\`.. @
\`.. \`.. @
\`.. \`.. @
\`.. \`.. @
\`.. \`...@
@@
\`.. @
\`.. @
\`.. @
\`.. \`.. @
\`.. \`..@
\`.. \`..@
\`.. \`.. @
@@
@
@
\`...@
\`.. @
\`.. @
\`.. @
\`...@
@@
\`..@
\`..@
\`..@
\`.. \`..@
\`. \`..@
\`. \`..@
\`.. \`..@
@@
@
@
\`.. @
\`. \`.. @
\`..... \`..@
\`. @
\`.... @
@@
\`..@
\`. @
\`.\`. \`.@
\`.. @
\`.. @
\`.. @
\`.. @
@@
@
@
\`.. @
\`.. \`..@
\`.. \`..@
\`.. \`..@
\`.. @
\`.. @@
@
\`.. @
\`.. @
\`. \`. @
\`.. \`..@
\`. \`..@
\`.. \`..@
@@
@
\`.@
@
\`..@
\`..@
\`..@
\`..@
@@
@
\`..@
@
\`..@
\`..@
\`..@
\`..@
\`... @@
\`.. @
\`.. @
\`.. \`..@
\`.. \`.. @
\`.\`.. @
\`.. \`.. @
\`.. \`..@
@@
\`..@
\`..@
\`..@
\`..@
\`..@
\`..@
\`...@
@@
@
@
\`... \`.. \`.. @
\`.. \`. \`..@
\`.. \`. \`..@
\`.. \`. \`..@
\`... \`. \`..@
@@
@
@
\`.. \`.. @
\`.. \`..@
\`.. \`..@
\`.. \`..@
\`... \`..@
@@
@
@
\`.. @
\`.. \`.. @
\`.. \`..@
\`.. \`.. @
\`.. @
@@
@
@
\`. \`.. @
\`. \`.. @
\`. \`..@
\`.. \`.. @
\`.. @
\`.. @@
@
@
\`.. @
\`. \`.. @
\`. \`.. @
\`..\`.. @
\`.. @
\`...@@
@
@
\`. \`...@
\`.. @
\`.. @
\`.. @
\`... @
@@
@
@
\`.... @
\`.. @
\`... @
\`..@
\`.. \`..@
@@
\`.. @
\`.. @
\`.\`. \`.@
\`.. @
\`.. @
\`.. @
\`.. @
@@
@
@
\`.. \`..@
\`.. \`..@
\`.. \`..@
\`.. \`..@
\`..\`..@
@@
@
@
\`.. \`..@
\`.. \`.. @
\`.. \`.. @
\`.\`.. @
\`.. @
@@
@
@
\`.. \`...@
\`.. . \`..@
\`.. \`. \`..@
\`. \`. \`.\`..@
\`... \`...@
@@
@
@
\`.. \`..@
\`. \`.. @
\`. @
\`. \`.. @
\`.. \`..@
@@
@
@
\`.. \`..@
\`.. \`.. @
\`... @
\`.. @
\`.. @
\`.. @@
@
@
\`.... \`..@
\`.. @
\`.. @
\`.. @
\`........@
@@
\`..@
\`.. @
\`.. @
\`... @
\`.. @
\`.. @
\`..@
@@
\`.@
\`.@
\`.@
@
\`.@
\`.@
\`.@
@@
\`.. @
\`.. @
\`.. @
\`..@
\`.. @
\`.. @
\`.. @
@@
\`.. \`. @
\`. \`..@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
`
@@ -0,0 +1,2 @@
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferTypeParameter", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
export default _default;
@@ -0,0 +1,413 @@
flf2a$ 4 3 10 0 4
straight.flf Version 2
by: Bas Meijer meijer@info.win.tue.nl bas@damek.kth.se
fixed by: Ryan Youck youck@cs.uregina.ca
Disclaimer: most capitals have been designed by someone else
$$@
$$@
$$@
$$@@
@
| @
. @
@@
// @
$$ @
@
@@
@
_|_|_ @
-|-|- @
@@
||_ @
(||$ @
_||) @
|| @@
@
0/ @
/0 @
@@
@
()/ @
(X @
@@
/ @
$ @
$ @
@@
$/ @
($ @
$\ @
@@
\$ @
$) @
/$ @
@@
$ $@
$\/$@
$/\$@
$ $@@
$ $@
$_|_$@
$ | $@
$ $@@
$@
$$@
,$@
$@@
$ $@
$__$@
$ $@
$ $@@
$@
$ $@
. $@
$@@
@
$/ @
/$ @
@@
$ __ @
$/ \ @
$\__/ @
$ @@
$ @
$/| @
$ | @
$ @@
$__ @
$ _) @
$/__ @
$ @@
$__ @
$ _) @
$__) @
$ @@
$ @
$|__| @
$ | @
$ @@
$ __ @
$|_ @
$__) @
$ @@
$ __ @
$/__ @
$\__) @
$ @@
$___ @
$ / @
$ / @
$ @@
$ __ @
$(__) @
$(__) @
$ @@
$ __ @
$(__\ @
$ __/ @
$ @@
@
. @
. @
@@
@
. @
, @
@@
$ $@
$/$@
$\$@
$ $@@
$ $@
$__$@
$--$@
$ $@@
$ $@
$\$@
$/$@
$ $@@
$ _ @
$ )@
$ . @
$ @@
@
@
@
@@
@
$/\ @
/--\ @
@@
$__ @
|__) @
|__) @
@@
$__ @
/ @
\__ @
@@
$__ @
| \ @
|__/ @
@@
$__ @
|_ @
|__ @
@@
$__ @
|_ @
| @
@@
$__ @
/ _ @
\__) @
@@
$ @
|__| @
| | @
@@
$ @
| @
| @
@@
$ @
$| @
__) @
@@
$ @
|_/ @
| \ @
@@
$ @
| @
|__ @
@@
$ @
|\/| @
| | @
@@
$ @
|\ | @
| \| @
@@
$__ @
/ \ @
\__/ @
@@
$__ @
|__) @
| $ @
@@
$__ @
/ \ @
\_\/ @
@@
$__ @
|__) @
| \ @
@@
$__ @
(_ @
__) @
@@
___ @
$|$ @
| @
@@
$ @
/ \ @
\__/ @
@@
$ @
\ / @
\/ @
@@
$ @
| | @
|/\| @
@@
$ @
\_/ @
/ \ @
@@
$ @
\_/ @
| @
@@
___ @
$_/ @
/__ @
@@
_ @
|$ @
|_ @
@@
@
\ @
\ @
@@
_ @
$| @
_| @
@@
@
/\ @
$$ @
@@
@
@
__ @
@@
\ @
$ @
$ @
@@
@
_ @
(_| @
@@
@
|_ @
|_) @
@@
@
_ @
(_ @
@@
@
_| @
(_| @
@@
@
_ @
(- @
@@
_ @
(_ @
|$ @
@@
@
_ @
(_) @
_/ @@
@
|_ @
| ) @
@@
@
. @
| @
@@
@
. @
| @
/ @@
@
|$ @
|( @
@@
@
| @
| @
@@
@
_ @
||| @
@@
@
_ @
| ) @
@@
@
_ @
(_) @
@@
@
_ @
|_) @
| @@
@
_ @
(_| @
| @@
@
_ @
|$ @
@@
@
_ @
_) @
@@
@
|_ @
|_ @
@@
@
$ $ @
|_| @
@@
@
$$ @
\/ @
@@
@
$ $ @
\)/ @
@@
@
$$ @
)( @
@@
@
$$ @
\/ @
/ @@
@
_ @
/_ @
@@
( @
< @
( @
@@
| @
| @
| @
@@
) @
> @
) @
@@
@
/\/ @
@
@@
o o @
/\ @
/--\ @
@@
o__o @
/ \ @
\__/ @
@@
o o @
/ \ @
\__/ @
@@
@
-_- @
(_| @
@@
@
-_- @
(_) @
@@
@
- - @
|_| @
@@
__ @
|__) @
|__) @
| @@
@@ -0,0 +1 @@
{"name":"@swc/core","version":"1.15.1","requiresBuild":true,"files":{"README.md":{"checkedAt":1794532090478,"integrity":"sha512-xp+Ox4c0o3kgn9Ui/KEIaGmLRJrKj24RzraChFgqmOft1St8NFUxJhDydxTdlvOuZTTAoBHcowWRo0VzNIPHxQ==","mode":420,"size":4163},"Visitor.d.ts":{"checkedAt":1794532090478,"integrity":"sha512-53dL17LqrM+E+RmdZ3YSev+L+0AyuNjjeJorpBwX23yZg3ddTOfdmeYhYOUrm3POU9y0b+DmvQ044o3OhWMTyw==","mode":420,"size":17467},"Visitor.js":{"checkedAt":1794532090478,"integrity":"sha512-Lii2sQNO4vMN+0rjhKpDItUA63lG4jaTCkwNUHLc7lWwrR3ho44BVNSJ16KE0ZExyTKORbss7sAPTytVwuNYdw==","mode":420,"size":47322},"binding.d.ts":{"checkedAt":1794532090480,"integrity":"sha512-Oz9blD+Wd2Y54XKFSLZyfEfLYN/+YH8ztQrfl241EdHO/smAjZMfz1E5oTIYY+tbc0msRlHw29YQPtDTxR3zQg==","mode":420,"size":2402},"binding.js":{"checkedAt":1794532090480,"integrity":"sha512-wxAzgcml05sEvT5SO5NaSdX/UP1IhR8yEfYKners2IhUWmxT5/7EiKv9NxDoseEm27kOJDSceJSQu2TukwCQLQ==","mode":420,"size":9179},"index.d.ts":{"checkedAt":1794532090480,"integrity":"sha512-Bg1jPokx7nNBwDK6GnguK7YvtUSP9aa0HraO+/Zq67kRBmHhkaTU/jRI6e2wAozRyi6gHpbGne4R9cBbSWYWhw==","mode":420,"size":5731},"index.js":{"checkedAt":1794532090480,"integrity":"sha512-3A3pe+fS3MdjgOVk4owvwTSZ4uITLve1+tMGye2KYyjEAkRALCWeCd2yweLOtiB0lRVlpHr0V7F9LRai4oug0g==","mode":420,"size":19145},"package.json":{"checkedAt":1794532090481,"integrity":"sha512-lpAUDijwcr3e2WegiyIp6VgdLL36CFxHFnGaMjc86vN5WdemjeoQG4Q9wqpTEHcDAbPzrQewZYnQk5DrCPLDXw==","mode":420,"size":3270},"postinstall.js":{"checkedAt":1794532090481,"integrity":"sha512-7ya1k+6Z0MGog47gqI3LzXrOi6S624DIl66BmyK7pWdmYtBAe5PAeaZw1gjdhFFr/uuIR6skkWIBaL1TkSc9xg==","mode":420,"size":6857},"spack.d.ts":{"checkedAt":1794532090481,"integrity":"sha512-WC7AxaSRMXP6xocSRSOks6OqHeC1LwqT59l+Z2G7LDBHCiQIdRAqaIx89QAl/lx+k+dfCH9JA1PqmzpMjUr4lw==","mode":420,"size":1265},"spack.js":{"checkedAt":1794532090481,"integrity":"sha512-zydLid3+J7RUuYVazVjuuqb/HjbZwycHSP1z4Q8tagyhAbb6Je7AS/YF4yQUJ+1mF17CD1zb65eUSDBJVQqYMw==","mode":420,"size":3544},"util.d.ts":{"checkedAt":1794532090481,"integrity":"sha512-Qtq2IniPEbBGqwTWThUVZWAsSMACg9E7OoX3VEiJWzOVsfNyUjf5zWWwT7HquP9Whom46jdULWQDSWjKQMQhyA==","mode":420,"size":60},"util.js":{"checkedAt":1794532090482,"integrity":"sha512-KIeVHUPiRNmCGT7h9H9ocXNUX0Y7JEQLISVtq7L8lDU5+NOU7RQQKuoI/GeTAcgEM3jSVu1Y6GIx4FZO+mc13g==","mode":420,"size":3100}},"sideEffects":{"linux-x64-node-v24-3bfe02b9ea66b3de4bc5ac85426a2b7ac05b7db1":{"README.md":{"checkedAt":1794532090478,"integrity":"sha512-xp+Ox4c0o3kgn9Ui/KEIaGmLRJrKj24RzraChFgqmOft1St8NFUxJhDydxTdlvOuZTTAoBHcowWRo0VzNIPHxQ==","mode":33188,"size":4163},"Visitor.d.ts":{"checkedAt":1794532090478,"integrity":"sha512-53dL17LqrM+E+RmdZ3YSev+L+0AyuNjjeJorpBwX23yZg3ddTOfdmeYhYOUrm3POU9y0b+DmvQ044o3OhWMTyw==","mode":33188,"size":17467},"Visitor.js":{"checkedAt":1794532090478,"integrity":"sha512-Lii2sQNO4vMN+0rjhKpDItUA63lG4jaTCkwNUHLc7lWwrR3ho44BVNSJ16KE0ZExyTKORbss7sAPTytVwuNYdw==","mode":33188,"size":47322},"binding.d.ts":{"checkedAt":1794532090480,"integrity":"sha512-Oz9blD+Wd2Y54XKFSLZyfEfLYN/+YH8ztQrfl241EdHO/smAjZMfz1E5oTIYY+tbc0msRlHw29YQPtDTxR3zQg==","mode":33188,"size":2402},"binding.js":{"checkedAt":1794532090480,"integrity":"sha512-wxAzgcml05sEvT5SO5NaSdX/UP1IhR8yEfYKners2IhUWmxT5/7EiKv9NxDoseEm27kOJDSceJSQu2TukwCQLQ==","mode":33188,"size":9179},"index.d.ts":{"checkedAt":1794532090480,"integrity":"sha512-Bg1jPokx7nNBwDK6GnguK7YvtUSP9aa0HraO+/Zq67kRBmHhkaTU/jRI6e2wAozRyi6gHpbGne4R9cBbSWYWhw==","mode":33188,"size":5731},"index.js":{"checkedAt":1794532090480,"integrity":"sha512-3A3pe+fS3MdjgOVk4owvwTSZ4uITLve1+tMGye2KYyjEAkRALCWeCd2yweLOtiB0lRVlpHr0V7F9LRai4oug0g==","mode":33188,"size":19145},"package.json":{"checkedAt":1794532090481,"integrity":"sha512-lpAUDijwcr3e2WegiyIp6VgdLL36CFxHFnGaMjc86vN5WdemjeoQG4Q9wqpTEHcDAbPzrQewZYnQk5DrCPLDXw==","mode":33188,"size":3270},"postinstall.js":{"checkedAt":1794532090481,"integrity":"sha512-7ya1k+6Z0MGog47gqI3LzXrOi6S624DIl66BmyK7pWdmYtBAe5PAeaZw1gjdhFFr/uuIR6skkWIBaL1TkSc9xg==","mode":33188,"size":6857},"spack.d.ts":{"checkedAt":1794532090481,"integrity":"sha512-WC7AxaSRMXP6xocSRSOks6OqHeC1LwqT59l+Z2G7LDBHCiQIdRAqaIx89QAl/lx+k+dfCH9JA1PqmzpMjUr4lw==","mode":33188,"size":1265},"spack.js":{"checkedAt":1794532090481,"integrity":"sha512-zydLid3+J7RUuYVazVjuuqb/HjbZwycHSP1z4Q8tagyhAbb6Je7AS/YF4yQUJ+1mF17CD1zb65eUSDBJVQqYMw==","mode":33188,"size":3544},"util.d.ts":{"checkedAt":1794532090481,"integrity":"sha512-Qtq2IniPEbBGqwTWThUVZWAsSMACg9E7OoX3VEiJWzOVsfNyUjf5zWWwT7HquP9Whom46jdULWQDSWjKQMQhyA==","mode":33188,"size":60},"util.js":{"checkedAt":1794532090482,"integrity":"sha512-KIeVHUPiRNmCGT7h9H9ocXNUX0Y7JEQLISVtq7L8lDU5+NOU7RQQKuoI/GeTAcgEM3jSVu1Y6GIx4FZO+mc13g==","mode":33188,"size":3100}}}}
@@ -0,0 +1,268 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.InlineStyleParser = factory());
})(this, (function () { 'use strict';
// http://www.w3.org/TR/CSS21/grammar.html
// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
var NEWLINE_REGEX = /\n/g;
var WHITESPACE_REGEX = /^\s*/;
// declaration
var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
var COLON_REGEX = /^:\s*/;
var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
var SEMICOLON_REGEX = /^[;\s]*/;
// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
var TRIM_REGEX = /^\s+|\s+$/g;
// strings
var NEWLINE = '\n';
var FORWARD_SLASH = '/';
var ASTERISK = '*';
var EMPTY_STRING = '';
// types
var TYPE_COMMENT = 'comment';
var TYPE_DECLARATION = 'declaration';
/**
* @param {String} style
* @param {Object} [options]
* @return {Object[]}
* @throws {TypeError}
* @throws {Error}
*/
function index (style, options) {
if (typeof style !== 'string') {
throw new TypeError('First argument must be a string');
}
if (!style) return [];
options = options || {};
/**
* Positional.
*/
var lineno = 1;
var column = 1;
/**
* Update lineno and column based on `str`.
*
* @param {String} str
*/
function updatePosition(str) {
var lines = str.match(NEWLINE_REGEX);
if (lines) lineno += lines.length;
var i = str.lastIndexOf(NEWLINE);
column = ~i ? str.length - i : column + str.length;
}
/**
* Mark position and patch `node.position`.
*
* @return {Function}
*/
function position() {
var start = { line: lineno, column: column };
return function (node) {
node.position = new Position(start);
whitespace();
return node;
};
}
/**
* Store position information for a node.
*
* @constructor
* @property {Object} start
* @property {Object} end
* @property {undefined|String} source
*/
function Position(start) {
this.start = start;
this.end = { line: lineno, column: column };
this.source = options.source;
}
/**
* Non-enumerable source string.
*/
Position.prototype.content = style;
/**
* Error `msg`.
*
* @param {String} msg
* @throws {Error}
*/
function error(msg) {
var err = new Error(
options.source + ':' + lineno + ':' + column + ': ' + msg
);
err.reason = msg;
err.filename = options.source;
err.line = lineno;
err.column = column;
err.source = style;
if (options.silent) ; else {
throw err;
}
}
/**
* Match `re` and return captures.
*
* @param {RegExp} re
* @return {undefined|Array}
*/
function match(re) {
var m = re.exec(style);
if (!m) return;
var str = m[0];
updatePosition(str);
style = style.slice(str.length);
return m;
}
/**
* Parse whitespace.
*/
function whitespace() {
match(WHITESPACE_REGEX);
}
/**
* Parse comments.
*
* @param {Object[]} [rules]
* @return {Object[]}
*/
function comments(rules) {
var c;
rules = rules || [];
while ((c = comment())) {
if (c !== false) {
rules.push(c);
}
}
return rules;
}
/**
* Parse comment.
*
* @return {Object}
* @throws {Error}
*/
function comment() {
var pos = position();
if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;
var i = 2;
while (
EMPTY_STRING != style.charAt(i) &&
(ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))
) {
++i;
}
i += 2;
if (EMPTY_STRING === style.charAt(i - 1)) {
return error('End of comment missing');
}
var str = style.slice(2, i - 2);
column += 2;
updatePosition(str);
style = style.slice(i);
column += 2;
return pos({
type: TYPE_COMMENT,
comment: str
});
}
/**
* Parse declaration.
*
* @return {Object}
* @throws {Error}
*/
function declaration() {
var pos = position();
// prop
var prop = match(PROPERTY_REGEX);
if (!prop) return;
comment();
// :
if (!match(COLON_REGEX)) return error("property missing ':'");
// val
var val = match(VALUE_REGEX);
var ret = pos({
type: TYPE_DECLARATION,
property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
value: val
? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))
: EMPTY_STRING
});
// ;
match(SEMICOLON_REGEX);
return ret;
}
/**
* Parse declarations.
*
* @return {Object[]}
*/
function declarations() {
var decls = [];
comments(decls);
// declarations
var decl;
while ((decl = declaration())) {
if (decl !== false) {
decls.push(decl);
comments(decls);
}
}
return decls;
}
whitespace();
return declarations();
}
/**
* Trim `str`.
*
* @param {String} str
* @return {String}
*/
function trim(str) {
return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
}
return index;
}));
//# sourceMappingURL=inline-style-parser.js.map
@@ -0,0 +1,9 @@
import { CanonicalizeLocaleList } from './abstract/CanonicalizeLocaleList';
import { ResolveLocale } from './abstract/ResolveLocale';
export function match(requestedLocales, availableLocales, defaultLocale, opts) {
return ResolveLocale(availableLocales, CanonicalizeLocaleList(requestedLocales), {
localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || 'best fit',
}, [], {}, function () { return defaultLocale; }).locale;
}
export { LookupSupportedLocales } from './abstract/LookupSupportedLocales';
export { ResolveLocale } from './abstract/ResolveLocale';
@@ -0,0 +1,831 @@
import { GeneratorOptions } from "@babel/generator";
import { ParserOptions } from "@babel/parser";
import template from "@babel/template";
import traverse, { Hub, NodePath, Scope, Visitor } from "@babel/traverse";
import * as t from "@babel/types";
export { GeneratorOptions, NodePath, ParserOptions, t as types, template, traverse, Visitor };
export type Node = t.Node;
export type ParseResult = ReturnType<typeof import("@babel/parser").parse>;
export const version: string;
export const DEFAULT_EXTENSIONS: [".js", ".jsx", ".es6", ".es", ".mjs"];
/**
* Source map standard format as to revision 3
* @see {@link https://sourcemaps.info/spec.html}
* @see {@link https://github.com/mozilla/source-map/blob/HEAD/source-map.d.ts}
*/
interface InputSourceMap {
version: number;
sources: string[];
names: string[];
sourceRoot?: string | undefined;
sourcesContent?: string[] | undefined;
mappings: string;
file: string;
}
export interface TransformOptions {
/**
* Specify which assumptions it can make about your code, to better optimize the compilation result. **NOTE**: This replaces the various `loose` options in plugins in favor of
* top-level options that can apply to multiple plugins
*
* @see https://babeljs.io/docs/en/assumptions
*/
assumptions?: { [name: string]: boolean } | null | undefined;
/**
* Include the AST in the returned object
*
* Default: `false`
*/
ast?: boolean | null | undefined;
/**
* Attach a comment after all non-user injected code
*
* Default: `null`
*/
auxiliaryCommentAfter?: string | null | undefined;
/**
* Attach a comment before all non-user injected code
*
* Default: `null`
*/
auxiliaryCommentBefore?: string | null | undefined;
/**
* Specify the "root" folder that defines the location to search for "babel.config.js", and the default folder to allow `.babelrc` files inside of.
*
* Default: `"."`
*/
root?: string | null | undefined;
/**
* This option, combined with the "root" value, defines how Babel chooses its project root.
* The different modes define different ways that Babel can process the "root" value to get
* the final project root.
*
* @see https://babeljs.io/docs/en/next/options#rootmode
*/
rootMode?: "root" | "upward" | "upward-optional" | undefined;
/**
* The config file to load Babel's config from. Defaults to searching for "babel.config.js" inside the "root" folder. `false` will disable searching for config files.
*
* Default: `undefined`
*/
configFile?: string | boolean | null | undefined;
/**
* Specify whether or not to use .babelrc and
* .babelignore files.
*
* Default: `true`
*/
babelrc?: boolean | null | undefined;
/**
* Specify which packages should be search for .babelrc files when they are being compiled. `true` to always search, or a path string or an array of paths to packages to search
* inside of. Defaults to only searching the "root" package.
*
* Default: `(root)`
*/
babelrcRoots?: boolean | MatchPattern | MatchPattern[] | null | undefined;
/**
* Toggles whether or not browserslist config sources are used, which includes searching for any browserslist files or referencing the browserslist key inside package.json.
* This is useful for projects that use a browserslist config for files that won't be compiled with Babel.
*
* If a string is specified, it must represent the path of a browserslist configuration file. Relative paths are resolved relative to the configuration file which specifies
* this option, or to `cwd` when it's passed as part of the programmatic options.
*
* Default: `true`
*/
browserslistConfigFile?: boolean | null | undefined;
/**
* The Browserslist environment to use.
*
* Default: `undefined`
*/
browserslistEnv?: string | null | undefined;
/**
* By default `babel.transformFromAst` will clone the input AST to avoid mutations.
* Specifying `cloneInputAst: false` can improve parsing performance if the input AST is not used elsewhere.
*
* Default: `true`
*/
cloneInputAst?: boolean | null | undefined;
/**
* Defaults to environment variable `BABEL_ENV` if set, or else `NODE_ENV` if set, or else it defaults to `"development"`
*
* Default: env vars
*/
envName?: string | undefined;
/**
* If any of patterns match, the current configuration object is considered inactive and is ignored during config processing.
*/
exclude?: MatchPattern | MatchPattern[] | undefined;
/**
* Enable code generation
*
* Default: `true`
*/
code?: boolean | null | undefined;
/**
* Output comments in generated output
*
* Default: `true`
*/
comments?: boolean | null | undefined;
/**
* Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB
*
* Default: `"auto"`
*/
compact?: boolean | "auto" | null | undefined;
/**
* The working directory that Babel's programmatic options are loaded relative to.
*
* Default: `"."`
*/
cwd?: string | null | undefined;
/**
* Utilities may pass a caller object to identify themselves to Babel and
* pass capability-related flags for use by configs, presets and plugins.
*
* @see https://babeljs.io/docs/en/next/options#caller
*/
caller?: TransformCaller | undefined;
/**
* This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { \/* specific options *\/ } } }`
* which will use those options when the `envName` is `production`
*
* Default: `{}`
*/
env?: { [index: string]: TransformOptions | null | undefined } | null | undefined;
/**
* A path to a `.babelrc` file to extend
*
* Default: `null`
*/
extends?: string | null | undefined;
/**
* Filename for use in errors etc
*
* Default: `"unknown"`
*/
filename?: string | null | undefined;
/**
* Filename relative to `sourceRoot`
*
* Default: `(filename)`
*/
filenameRelative?: string | null | undefined;
/**
* An object containing the options to be passed down to the babel code generator, @babel/generator
*
* Default: `{}`
*/
generatorOpts?: GeneratorOptions | null | undefined;
/**
* Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used
*
* Default: `null`
*/
getModuleId?: ((moduleName: string) => string | null | undefined) | null | undefined;
/**
* ANSI highlight syntax error code frames
*
* Default: `true`
*/
highlightCode?: boolean | null | undefined;
/**
* Opposite to the `only` option. `ignore` is disregarded if `only` is specified
*
* Default: `null`
*/
ignore?: MatchPattern[] | null | undefined;
/**
* This option is a synonym for "test"
*/
include?: MatchPattern | MatchPattern[] | undefined;
/**
* A source map object that the output source map will be based on
*
* Default: `null`
*/
inputSourceMap?: InputSourceMap | null | undefined;
/**
* Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe)
*
* Default: `false`
*/
minified?: boolean | null | undefined;
/**
* Specify a custom name for module ids
*
* Default: `null`
*/
moduleId?: string | null | undefined;
/**
* If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules)
*
* Default: `false`
*/
moduleIds?: boolean | null | undefined;
/**
* Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions
*
* Default: `(sourceRoot)`
*/
moduleRoot?: string | null | undefined;
/**
* A glob, regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile
* a non-matching file it's returned verbatim
*
* Default: `null`
*/
only?: MatchPattern[] | null | undefined;
/**
* Allows users to provide an array of options that will be merged into the current configuration one at a time.
* This feature is best used alongside the "test"/"include"/"exclude" options to provide conditions for which an override should apply
*/
overrides?: TransformOptions[] | undefined;
/**
* An object containing the options to be passed down to the babel parser, @babel/parser
*
* Default: `{}`
*/
parserOpts?: ParserOptions | null | undefined;
/**
* List of plugins to load and use
*
* Default: `[]`
*/
plugins?: PluginItem[] | null | undefined;
/**
* List of presets (a set of plugins) to load and use
*
* Default: `[]`
*/
presets?: PluginItem[] | null | undefined;
/**
* Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE**: This will not retain the columns)
*
* Default: `false`
*/
retainLines?: boolean | null | undefined;
/**
* An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE**: This overrides the `comment` option when used
*
* Default: `null`
*/
shouldPrintComment?: ((commentContents: string) => boolean) | null | undefined;
/**
* Set `sources[0]` on returned source map
*
* Default: `(filenameRelative)`
*/
sourceFileName?: string | null | undefined;
/**
* If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"`
* then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!**
*
* Default: `false`
*/
sourceMaps?: boolean | "inline" | "both" | null | undefined;
/**
* The root from which all sources are relative
*
* Default: `(moduleRoot)`
*/
sourceRoot?: string | null | undefined;
/**
* Indicate the mode the code should be parsed in. Can be one of "script", "module", or "unambiguous". `"unambiguous"` will make Babel attempt to guess, based on the presence of ES6
* `import` or `export` statements. Files with ES6 `import`s and `export`s are considered `"module"` and are otherwise `"script"`.
*
* Default: `("module")`
*/
sourceType?: "script" | "module" | "unambiguous" | null | undefined;
/**
* If all patterns fail to match, the current configuration object is considered inactive and is ignored during config processing.
*/
test?: MatchPattern | MatchPattern[] | undefined;
/**
* Describes the environments you support/target for your project.
* This can either be a [browserslist-compatible](https://github.com/ai/browserslist) query (with [caveats](https://babeljs.io/docs/en/babel-preset-env#ineffective-browserslist-queries))
*
* Default: `{}`
*/
targets?:
| string
| string[]
| {
esmodules?: boolean;
node?: Omit<string, "current"> | "current" | true;
safari?: Omit<string, "tp"> | "tp";
browsers?: string | string[];
android?: string;
chrome?: string;
deno?: string;
edge?: string;
electron?: string;
firefox?: string;
ie?: string;
ios?: string;
opera?: string;
rhino?: string;
samsung?: string;
};
/**
* An optional callback that can be used to wrap visitor methods. **NOTE**: This is useful for things like introspection, and not really needed for implementing anything. Called as
* `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`.
*/
wrapPluginVisitorMethod?:
| ((
pluginAlias: string,
visitorType: "enter" | "exit",
callback: (path: NodePath, state: any) => void,
) => (path: NodePath, state: any) => void)
| null
| undefined;
}
export interface TransformCaller {
// the only required property
name: string;
// e.g. set to true by `babel-loader` and false by `babel-jest`
supportsStaticESM?: boolean | undefined;
supportsDynamicImport?: boolean | undefined;
supportsExportNamespaceFrom?: boolean | undefined;
supportsTopLevelAwait?: boolean | undefined;
// augment this with a "declare module '@babel/core' { ... }" if you need more keys
}
export type FileResultCallback = (err: Error | null, result: BabelFileResult | null) => any;
export interface MatchPatternContext {
envName: string;
dirname: string;
caller: TransformCaller | undefined;
}
export type MatchPattern = string | RegExp | ((filename: string | undefined, context: MatchPatternContext) => boolean);
/**
* Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.
*/
export function transform(code: string, callback: FileResultCallback): void;
/**
* Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.
*/
export function transform(code: string, opts: TransformOptions | undefined, callback: FileResultCallback): void;
/**
* Here for backward-compatibility. Ideally use `transformSync` if you want a synchronous API.
*/
export function transform(code: string, opts?: TransformOptions): BabelFileResult | null;
/**
* Transforms the passed in code. Returning an object with the generated code, source map, and AST.
*/
export function transformSync(code: string, opts?: TransformOptions): BabelFileResult | null;
/**
* Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.
*/
export function transformAsync(code: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
/**
* Asynchronously transforms the entire contents of a file.
*/
export function transformFile(filename: string, callback: FileResultCallback): void;
/**
* Asynchronously transforms the entire contents of a file.
*/
export function transformFile(filename: string, opts: TransformOptions | undefined, callback: FileResultCallback): void;
/**
* Synchronous version of `babel.transformFile`. Returns the transformed contents of the `filename`.
*/
export function transformFileSync(filename: string, opts?: TransformOptions): BabelFileResult | null;
/**
* Asynchronously transforms the entire contents of a file.
*/
export function transformFileAsync(filename: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
/**
* Given an AST, transform it.
*/
export function transformFromAst(ast: Node, code: string | undefined, callback: FileResultCallback): void;
/**
* Given an AST, transform it.
*/
export function transformFromAst(
ast: Node,
code: string | undefined,
opts: TransformOptions | undefined,
callback: FileResultCallback,
): void;
/**
* Here for backward-compatibility. Ideally use ".transformSync" if you want a synchronous API.
*/
export function transformFromAstSync(ast: Node, code?: string, opts?: TransformOptions): BabelFileResult | null;
/**
* Given an AST, transform it.
*/
export function transformFromAstAsync(
ast: Node,
code?: string,
opts?: TransformOptions,
): Promise<BabelFileResult | null>;
// A babel plugin is a simple function which must return an object matching
// the following interface. Babel will throw if it finds unknown properties.
// The list of allowed plugin keys is here:
// https://github.com/babel/babel/blob/4e50b2d9d9c376cee7a2cbf56553fe5b982ea53c/packages/babel-core/src/config/option-manager.js#L71
export interface PluginObj<S = PluginPass> {
name?: string | undefined;
manipulateOptions?(opts: any, parserOpts: any): void;
pre?(this: S, file: BabelFile): void;
visitor: Visitor<S>;
post?(this: S, file: BabelFile): void;
inherits?: any;
}
export interface BabelFile {
ast: t.File;
opts: TransformOptions;
hub: Hub;
metadata: object;
path: NodePath<t.Program>;
scope: Scope;
inputMap: object | null;
code: string;
}
export interface PluginPass {
file: BabelFile;
key: string;
opts: object;
cwd: string;
filename: string | undefined;
get(key: unknown): any;
set(key: unknown, value: unknown): void;
[key: string]: unknown;
}
export interface BabelFileResult {
ast?: t.File | null | undefined;
code?: string | null | undefined;
ignored?: boolean | undefined;
map?:
| {
version: number;
sources: string[];
names: string[];
sourceRoot?: string | undefined;
sourcesContent?: string[] | undefined;
mappings: string;
file: string;
}
| null
| undefined;
metadata?: BabelFileMetadata | undefined;
}
export interface BabelFileMetadata {
usedHelpers: string[];
marked: Array<{
type: string;
message: string;
loc: object;
}>;
modules: BabelFileModulesMetadata;
}
export interface BabelFileModulesMetadata {
imports: object[];
exports: {
exported: object[];
specifiers: object[];
};
}
export type FileParseCallback = (err: Error | null, result: ParseResult | null) => any;
/**
* Given some code, parse it using Babel's standard behavior.
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
*/
export function parse(code: string, callback: FileParseCallback): void;
/**
* Given some code, parse it using Babel's standard behavior.
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
*/
export function parse(code: string, options: TransformOptions | undefined, callback: FileParseCallback): void;
/**
* Given some code, parse it using Babel's standard behavior.
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
*/
export function parse(code: string, options?: TransformOptions): ParseResult | null;
/**
* Given some code, parse it using Babel's standard behavior.
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
*/
export function parseSync(code: string, options?: TransformOptions): ParseResult | null;
/**
* Given some code, parse it using Babel's standard behavior.
* Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled.
*/
export function parseAsync(code: string, options?: TransformOptions): Promise<ParseResult | null>;
/**
* Resolve Babel's options fully, resulting in an options object where:
*
* * opts.plugins is a full list of Plugin instances.
* * opts.presets is empty and all presets are flattened into opts.
* * It can be safely passed back to Babel. Fields like babelrc have been set to false so that later calls to Babel
* will not make a second attempt to load config files.
*
* Plugin instances aren't meant to be manipulated directly, but often callers will serialize this opts to JSON to
* use it as a cache key representing the options Babel has received. Caching on this isn't 100% guaranteed to
* invalidate properly, but it is the best we have at the moment.
*/
export function loadOptions(options?: TransformOptions): object | null;
/**
* To allow systems to easily manipulate and validate a user's config, this function resolves the plugins and
* presets and proceeds no further. The expectation is that callers will take the config's .options, manipulate it
* as then see fit and pass it back to Babel again.
*
* * `babelrc: string | void` - The path of the `.babelrc` file, if there was one.
* * `babelignore: string | void` - The path of the `.babelignore` file, if there was one.
* * `options: ValidatedOptions` - The partially resolved options, which can be manipulated and passed back
* to Babel again.
* * `plugins: Array<ConfigItem>` - See below.
* * `presets: Array<ConfigItem>` - See below.
* * It can be safely passed back to Babel. Fields like `babelrc` have been set to false so that later calls to
* Babel will not make a second attempt to load config files.
*
* `ConfigItem` instances expose properties to introspect the values, but each item should be treated as
* immutable. If changes are desired, the item should be removed from the list and replaced with either a normal
* Babel config value, or with a replacement item created by `babel.createConfigItem`. See that function for
* information about `ConfigItem` fields.
*/
export function loadPartialConfig(options?: TransformOptions): Readonly<PartialConfig> | null;
export function loadPartialConfigAsync(options?: TransformOptions): Promise<Readonly<PartialConfig> | null>;
export interface PartialConfig {
options: TransformOptions;
babelrc?: string | undefined;
babelignore?: string | undefined;
config?: string | undefined;
hasFilesystemConfig: () => boolean;
}
export interface ConfigItem {
/**
* The name that the user gave the plugin instance, e.g. `plugins: [ ['env', {}, 'my-env'] ]`
*/
name?: string | undefined;
/**
* The resolved value of the plugin.
*/
value: object | ((...args: any[]) => any);
/**
* The options object passed to the plugin.
*/
options?: object | false | undefined;
/**
* The path that the options are relative to.
*/
dirname: string;
/**
* Information about the plugin's file, if Babel knows it.
* *
*/
file?:
| {
/**
* The file that the user requested, e.g. `"@babel/env"`
*/
request: string;
/**
* The full path of the resolved file, e.g. `"/tmp/node_modules/@babel/preset-env/lib/index.js"`
*/
resolved: string;
}
| null
| undefined;
}
export type PluginOptions = object | undefined | false;
export type PluginTarget = string | object | ((...args: any[]) => any);
export type PluginItem =
| ConfigItem
| PluginObj<any>
| PluginTarget
| [PluginTarget, PluginOptions]
| [PluginTarget, PluginOptions, string | undefined];
export function resolvePlugin(name: string, dirname: string): string | null;
export function resolvePreset(name: string, dirname: string): string | null;
export interface CreateConfigItemOptions {
dirname?: string | undefined;
type?: "preset" | "plugin" | undefined;
}
/**
* Allows build tooling to create and cache config items up front. If this function is called multiple times for a
* given plugin, Babel will call the plugin's function itself multiple times. If you have a clear set of expected
* plugins and presets to inject, pre-constructing the config items would be recommended.
*/
export function createConfigItem(
value: PluginTarget | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined],
options?: CreateConfigItemOptions,
): ConfigItem;
// NOTE: the documentation says the ConfigAPI also exposes @babel/core's exports, but it actually doesn't
/**
* @see https://babeljs.io/docs/en/next/config-files#config-function-api
*/
export interface ConfigAPI {
/**
* The version string for the Babel version that is loading the config file.
*
* @see https://babeljs.io/docs/en/next/config-files#apiversion
*/
version: string;
/**
* @see https://babeljs.io/docs/en/next/config-files#apicache
*/
cache: SimpleCacheConfigurator;
/**
* @see https://babeljs.io/docs/en/next/config-files#apienv
*/
env: EnvFunction;
// undocumented; currently hardcoded to return 'false'
// async(): boolean
/**
* This API is used as a way to access the `caller` data that has been passed to Babel.
* Since many instances of Babel may be running in the same process with different `caller` values,
* this API is designed to automatically configure `api.cache`, the same way `api.env()` does.
*
* The `caller` value is available as the first parameter of the callback function.
* It is best used with something like this to toggle configuration behavior
* based on a specific environment:
*
* @example
* function isBabelRegister(caller?: { name: string }) {
* return !!(caller && caller.name === "@babel/register")
* }
* api.caller(isBabelRegister)
*
* @see https://babeljs.io/docs/en/next/config-files#apicallercb
*/
caller<T extends SimpleCacheKey>(callerCallback: (caller: TransformOptions["caller"]) => T): T;
/**
* While `api.version` can be useful in general, it's sometimes nice to just declare your version.
* This API exposes a simple way to do that with:
*
* @example
* api.assertVersion(7) // major version only
* api.assertVersion("^7.2")
*
* @see https://babeljs.io/docs/en/next/config-files#apiassertversionrange
*/
assertVersion(versionRange: number | string): boolean;
// NOTE: this is an undocumented reexport from "@babel/parser" but it's missing from its types
// tokTypes: typeof tokTypes
}
/**
* JS configs are great because they can compute a config on the fly,
* but the downside there is that it makes caching harder.
* Babel wants to avoid re-executing the config function every time a file is compiled,
* because then it would also need to re-execute any plugin and preset functions
* referenced in that config.
*
* To avoid this, Babel expects users of config functions to tell it how to manage caching
* within a config file.
*
* @see https://babeljs.io/docs/en/next/config-files#apicache
*/
export interface SimpleCacheConfigurator {
// there is an undocumented call signature that is a shorthand for forever()/never()/using().
// (ever: boolean): void
// <T extends SimpleCacheKey>(callback: CacheCallback<T>): T
/**
* Permacache the computed config and never call the function again.
*/
forever(): void;
/**
* Do not cache this config, and re-execute the function every time.
*/
never(): void;
/**
* Any time the using callback returns a value other than the one that was expected,
* the overall config function will be called again and a new entry will be added to the cache.
*
* @example
* api.cache.using(() => process.env.NODE_ENV)
*/
using<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): T;
/**
* Any time the using callback returns a value other than the one that was expected,
* the overall config function will be called again and all entries in the cache will
* be replaced with the result.
*
* @example
* api.cache.invalidate(() => process.env.NODE_ENV)
*/
invalidate<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): T;
}
// https://github.com/babel/babel/blob/v7.3.3/packages/babel-core/src/config/caching.js#L231
export type SimpleCacheKey = string | boolean | number | null | undefined;
export type SimpleCacheCallback<T extends SimpleCacheKey> = () => T;
/**
* Since `NODE_ENV` is a fairly common way to toggle behavior, Babel also includes an API function
* meant specifically for that. This API is used as a quick way to check the `"envName"` that Babel
* was loaded with, which takes `NODE_ENV` into account if no other overriding environment is set.
*
* @see https://babeljs.io/docs/en/next/config-files#apienv
*/
export interface EnvFunction {
/**
* @returns the current `envName` string
*/
(): string;
/**
* @returns `true` if the `envName` is `===` any of the given strings
*/
(envName: string | readonly string[]): boolean;
// the official documentation is misleading for this one...
// this just passes the callback to `cache.using` but with an additional argument.
// it returns its result instead of necessarily returning a boolean.
<T extends SimpleCacheKey>(envCallback: (envName: NonNullable<TransformOptions["envName"]>) => T): T;
}
export type ConfigFunction = (api: ConfigAPI) => TransformOptions;
export as namespace babel;
@@ -0,0 +1 @@
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAaM,SAAS;IACd,IAAI,kBAAkB,CAAA,GAAA,mBAAK,EAAE,IAAI;IACjC,IAAI,oBAAoB,CAAA,GAAA,wBAAU,EAAE,CAAC,aAAa,MAAM,UAAU;QAChE,8EAA8E;QAC9E,IAAI,KAAK,CAAA,oBAAA,8BAAA,QAAS,IAAI,IAAG,CAAC,GAAG;YAC3B,gBAAgB,OAAO,CAAC,MAAM,CAAC;YAC/B,YAAY;QACd,IAAI;QACJ,gBAAgB,OAAO,CAAC,GAAG,CAAC,UAAU;kBAAC;yBAAM;gBAAa;qBAAI;QAAO;QACrE,YAAY,gBAAgB,CAAC,MAAM,IAAI;IACzC,GAAG,EAAE;IACL,IAAI,uBAAuB,CAAA,GAAA,wBAAU,EAAE,CAAC,aAAa,MAAM,UAAU;YAC1D;QAAT,IAAI,KAAK,EAAA,+BAAA,gBAAgB,OAAO,CAAC,GAAG,CAAC,uBAA5B,mDAAA,6BAAuC,EAAE,KAAI;QACtD,YAAY,mBAAmB,CAAC,MAAM,IAAI;QAC1C,gBAAgB,OAAO,CAAC,MAAM,CAAC;IACjC,GAAG,EAAE;IACL,IAAI,2BAA2B,CAAA,GAAA,wBAAU,EAAE;QACzC,gBAAgB,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO;YACtC,qBAAqB,MAAM,WAAW,EAAE,MAAM,IAAI,EAAE,KAAK,MAAM,OAAO;QACxE;IACF,GAAG;QAAC;KAAqB;IAGzB,CAAA,GAAA,sBAAQ,EAAE;QACR,OAAO;IACT,GAAG;QAAC;KAAyB;IAE7B,OAAO;2BAAC;8BAAmB;kCAAsB;IAAwB;AAC3E","sources":["packages/@react-aria/utils/src/useGlobalListeners.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useCallback, useEffect, useRef} from 'react';\n\ninterface GlobalListeners {\n addGlobalListener<K extends keyof WindowEventMap>(el: Window, type: K, listener: (this: Document, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void,\n addGlobalListener<K extends keyof DocumentEventMap>(el: EventTarget, type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void,\n addGlobalListener(el: EventTarget, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void,\n removeGlobalListener<K extends keyof DocumentEventMap>(el: EventTarget, type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void,\n removeGlobalListener(el: EventTarget, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void,\n removeAllGlobalListeners(): void\n}\n\nexport function useGlobalListeners(): GlobalListeners {\n let globalListeners = useRef(new Map());\n let addGlobalListener = useCallback((eventTarget, type, listener, options) => {\n // Make sure we remove the listener after it is called with the `once` option.\n let fn = options?.once ? (...args) => {\n globalListeners.current.delete(listener);\n listener(...args);\n } : listener;\n globalListeners.current.set(listener, {type, eventTarget, fn, options});\n eventTarget.addEventListener(type, fn, options);\n }, []);\n let removeGlobalListener = useCallback((eventTarget, type, listener, options) => {\n let fn = globalListeners.current.get(listener)?.fn || listener;\n eventTarget.removeEventListener(type, fn, options);\n globalListeners.current.delete(listener);\n }, []);\n let removeAllGlobalListeners = useCallback(() => {\n globalListeners.current.forEach((value, key) => {\n removeGlobalListener(value.eventTarget, value.type, key, value.options);\n });\n }, [removeGlobalListener]);\n\n \n useEffect(() => {\n return removeAllGlobalListeners;\n }, [removeAllGlobalListeners]);\n\n return {addGlobalListener, removeGlobalListener, removeAllGlobalListeners};\n}\n"],"names":[],"version":3,"file":"useGlobalListeners.main.js.map"}
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more