3 Commits
2.3.4 ... 1.1.0

Author SHA1 Message Date
synt-xerror
240c392fad yt-dlp support 2026-03-12 01:22:29 -03:00
synt-xerror
b96332e618 Merge branch 'main' 2026-03-11 20:10:28 -03:00
SyntaxError!
c95d66a763 Initial commit 2026-03-11 20:00:13 -03:00
5472 changed files with 989870 additions and 3462 deletions

8
.gitignore vendored
View File

@@ -1,10 +1,4 @@
env env.js
.wwebjs_auth .wwebjs_auth
.wwebjs_cache .wwebjs_cache
downloads downloads
src/node_modules/
node_modules/
cookies.txt
bin/
mychats.txt
manybot.conf

695
LICENSE
View File

@@ -1,674 +1,21 @@
GNU GENERAL PUBLIC LICENSE MIT License
Version 3, 29 June 2007
Copyright (c) 2026 SyntaxError!
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies Permission is hereby granted, free of charge, to any person obtaining a copy
of this license document, but changing it is not allowed. of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Preamble to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
The GNU General Public License is a free, copyleft license for furnished to do so, subject to the following conditions:
software and other kinds of works.
The above copyright notice and this permission notice shall be included in all
The licenses for most software and other practical works are designed copies or substantial portions of the Software.
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
share and change all versions of a program--to make sure it remains free IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
software for all its users. We, the Free Software Foundation, use the FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
GNU General Public License for most of our software; it applies also to AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
any other work released this way by its authors. You can apply it to LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
your programs, too. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@@ -1,56 +1,2 @@
![ManyBot Logo](logo.png) # manybot
Cool whatsapp bot. Local and free.
Criei esse bot para servir um grupo de amigos. Meu foco não é fazer ele funcionar para todo mundo.
Ele é 100% local e gratuito, sem necessidade de APIs burocraticas. Usufrui da biblioteca `whatsapp-web.js`, que permite bastante coisa mesmo sem a API oficial.
Você consegue totalmente clonar esse repoistório e rodar seu próprio ManyBot. A licenca GPLv3 permite que você modifique o que quiser e faça seu próprio bot, mas se for publicar, deve ser open source assim como o ManyBot original.
Algumas funcionalidades desse bot inclui:
- Funciona em multiplos chats em apenas uma única sessão
- Comandos de jogos e download com yt-dlp
- Gerador de figurinhas
- Ferramenta para pegar IDs dos chats
- Entre outros
---
# Requisitos
- Node.js
- NPM
- Sistema Linux ou Windows
obs: Sistemas Android e iOS ainda não são 100% compatíveis. O suporte para Termux está em fases de testes e sem garantia de funcionamento correto.
# Instalação (Linux)
1. Clone o repositório e entre:
```
git clone https://github.com/synt-xerror/manybot
cd manybot
```
2. Execute o script de instalação:
```
bash setup
```
3. Rode o bot pela primeira vez:
```
node src/main.js
```
Ele vai pedir para que escaneie o QR Code com seu celular.
Vá em: WhatsApp > Trẽs pontos no canto inferior > Dispositivos conectados > Conectar um dispositivo
# Instalação (Windows)
O uso desse bot foi pensado para rodar em um terminal Linux com Bash. No entanto, você pode usar o Git Bash, que simula um terminal Linux com Bash real:
1. Para baixar o Git Bash: https://git-scm.com/install/windows
Selecione a versão que deseja (portátil ou instalador)
2. Para baixar o Node.js: https://nodejs.org/pt-br/download/current
Role a tela e selecione "binário independente (.zip)"
Ou se preferir, use um gerenciador de pacotes como mostra no conteúdo inicial
Após baixar e instalar ambos, abra o Git Bash e execute exatamente os mesmos passos do Linux

View File

@@ -1,35 +0,0 @@
#!/bin/bash
# ferramenta de desenvolvimento apenas, pode apagar se quiser
# ./deploy <commit> <branch> <version (if branch=master)>
COMMIT_MSG="$1"
BRANCH="$2"
VERSION="$3"
if [ -z "$COMMIT_MSG" ] || [ -z "$BRANCH" ]; then
echo "Uso: ./deploy <commit> <branch> [version if branch=master]"
exit 1
fi
# mudar para a branch
git checkout $BRANCH || { echo "Error ao change to $BRANCH"; exit 1; }
# se for master, atualizar versão
if [ "$BRANCH" == "master" ] && [ -n "$VERSION" ]; then
echo "Updating version to $VERSION"
git tag $VERSION
npm version $VERSION --no-git-tag-version
git add package.json
git commit -m "Bump version to $VERSION"
git push origin $VERSION
fi
# adicionar alterações e commit
git add .
git commit -m "$COMMIT_MSG"
# push
git push origin $BRANCH
echo "Deploy completed."

36
get_id.js Normal file
View File

@@ -0,0 +1,36 @@
// main.js
import pkg from 'whatsapp-web.js';
const { Client, LocalAuth } = pkg;
import qrcode from 'qrcode-terminal';
const CLIENT_ID = "bot_permanente"; // sempre o mesmo
const client = new Client({
authStrategy: new LocalAuth({ clientId: CLIENT_ID }),
puppeteer: { headless: true }
});
client.on('qr', qr => {
console.log("[BOT] QR Code gerado. Escaneie apenas uma vez:");
qrcode.generate(qr, { small: true });
});
client.on('ready', () => console.log("[BOT] WhatsApp conectado e sessão permanente"));
client.on('message_create', async msg => {
try {
const chat = await msg.getChat(); // pega o chat uma única vez
console.log("==================================");
console.log(`CHAT NAME : ${chat.name || chat.id.user || "Sem nome"}`);
console.log(`CHAT ID : ${chat.id._serialized}`);
console.log(`FROM : ${msg.from}`);
console.log(`BODY : ${msg.body}`);
console.log("==================================\n");
} catch (err) {
console.error("[ERRO]", err);
}
});
client.initialize();

BIN
logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

230
main.js Normal file
View File

@@ -0,0 +1,230 @@
import pkg from 'whatsapp-web.js';
const { Client, LocalAuth, MessageMedia } = pkg;
import qrcode from 'qrcode-terminal';
import fs from 'fs';
const CHAT_ID_ALVO = process.argv[2];
if (!CHAT_ID_ALVO) {
console.error("Use: node main.js <ID_DO_CHAT>");
process.exit(1);
}
// Cada chat tem um clientId único e persistente
const CLIENT_ID = `chat_${CHAT_ID_ALVO.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
const BOT_PREFIX = "🤖 *ManyBot:* ";
const client = new Client({
authStrategy: new LocalAuth({ clientId: CLIENT_ID }),
puppeteer: {
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
timeout: 60000,
}
});
client.on('qr', qr => {
console.log(`[${CHAT_ID_ALVO}] QR Code gerado. Escaneie apenas uma vez:`);
qrcode.generate(qr, { small: true });
});
client.on('ready', () => console.log(`[${CHAT_ID_ALVO}] WhatsApp conectado.`));
client.on('disconnected', reason => {
console.warn(`[${CHAT_ID_ALVO}] Desconectado: ${reason}. Tentando reconectar...`);
setTimeout(() => client.initialize(), 5000);
});
client.on('message_create', async msg => {
try {
const chat = await msg.getChat();
if (chat.id._serialized !== CHAT_ID_ALVO) return;
console.log("==================================");
console.log(`CHAT NAME : ${chat.name || chat.id.user || "Sem nome"}`);
console.log(`CHAT ID : ${chat.id._serialized}`);
console.log(`FROM : ${msg.from}`);
console.log(`BODY : ${msg.body}`);
console.log("==================================\n");
await processarComando(msg);
await processarJogo(msg);
} catch (err) {
console.error("[ERRO]", err);
}
});
// ---------------- Funções de envio ----------------
async function enviarVideo(cliente, chatId, caminhoArquivo) {
if (!fs.existsSync(caminhoArquivo)) throw new Error(`Arquivo não encontrado: ${caminhoArquivo}`);
const arquivo = fs.readFileSync(caminhoArquivo);
const media = new MessageMedia('video/mp4', arquivo.toString('base64'), caminhoArquivo.split('/').pop());
await cliente.sendMessage(chatId, media, { sendMediaAsDocument: false });
fs.unlinkSync(caminhoArquivo);
console.log(`[BOT] Vídeo enviado e removido: ${caminhoArquivo}`);
}
async function enviarAudio(cliente, chatId, caminhoArquivo) {
if (!fs.existsSync(caminhoArquivo)) throw new Error(`Arquivo não encontrado: ${caminhoArquivo}`);
const arquivo = fs.readFileSync(caminhoArquivo);
const media = new MessageMedia('audio/mpeg', arquivo.toString('base64'), caminhoArquivo.split('/').pop());
await cliente.sendMessage(chatId, media, { sendAudioAsVoice: false });
fs.unlinkSync(caminhoArquivo);
console.log(`[BOT] Áudio enviado e removido: ${caminhoArquivo}`);
}
function botMsg(texto) {
return `${BOT_PREFIX}\n${texto}`;
}
function iniciarJogo(chat) {
const numeroSecreto = Math.floor(Math.random() * 100) + 1;
jogoAtivo = numeroSecreto;
console.log(`[JOGO] ${chat.name}: Número escolhido ${numeroSecreto}`);
chat.sendMessage(botMsg("Hora do jogo! Tentem adivinhar o número de 1 a 100!"));
}
// ---------------- Download ----------------
let downloadsAtivos = 0;
const MAX_DOWNLOADS = 2;
const downloadQueue = [];
let processingQueue = false;
// Garantir que a pasta downloads exista
if (!fs.existsSync('downloads')) fs.mkdirSync('downloads');
import { exec } from "child_process";
function get_video(url, id) {
downloadsAtivos++;
return new Promise((resolve, reject) => {
const cmd = `yt-dlp -t mp4 --print after_move:filepath -o "downloads/${id}.%(ext)s" "${url}"`;
exec(cmd, (error, stdout, stderr) => {
downloadsAtivos--;
if (stderr) console.error(stderr);
if (error) return reject(new Error(`yt-dlp falhou: ${error.message}`));
const filepath = stdout.trim();
if (!filepath) return reject(new Error("yt-dlp não retornou filepath"));
resolve(filepath);
});
});
}
function get_audio(url, id) {
downloadsAtivos++;
return new Promise((resolve, reject) => {
const cmd = `yt-dlp -t mp3 --print after_move:filepath -o "downloads/${id}.%(ext)s" "${url}"`;
exec(cmd, (error, stdout, stderr) => {
downloadsAtivos--;
if (stderr) console.error(stderr);
if (error) return reject(new Error(`yt-dlp falhou: ${error.message}`));
const filepath = stdout.trim();
if (!filepath) return reject(new Error("yt-dlp não retornou filepath"));
resolve(filepath);
});
});
}
function enqueueDownload(type, url, msg) {
return new Promise((resolve, reject) => {
downloadQueue.push({ type, url, msg, resolve, reject });
processQueue();
});
}
async function processQueue() {
if (processingQueue) return;
processingQueue = true;
while (downloadQueue.length) {
const { type, url, msg, resolve, reject } = downloadQueue.shift();
const chat = await msg.getChat();
const chatId = chat.id._serialized;
try {
let caminho;
if (type === 'video') caminho = await get_video(url, msg.id._serialized);
else caminho = await get_audio(url, msg.id._serialized);
if (type === 'video') await enviarVideo(client, chatId, caminho);
else await enviarAudio(client, chatId, caminho);
resolve(caminho);
} catch (err) {
reject(err);
const chat = await msg.getChat();
chat.sendMessage(botMsg(`❌ Erro ao baixar ${type}: ${err.message}`));
}
}
processingQueue = false;
}
// ---------------- Comandos ----------------
async function processarComando(msg) {
const tokens = msg.body.trim().split(/\s+/);
if (tokens[0] !== "!many") return;
const chat = await msg.getChat();
if (tokens.length === 1) {
chat.sendMessage(botMsg(
"- `!many ping` -> testa se estou funcionando\n" +
"- `!many jogo` -> jogo de adivinhação\n" +
"- `!many video <link>` -> baixo um vídeo da internet para você!\n" +
"- `!many audio <link>` -> baixo um audio da internet para você!"
));
return;
}
if (tokens[1] === "ping") chat.sendMessage(botMsg("pong 🏓"));
if (tokens[1] === "jogo") iniciarJogo(chat);
if (tokens[1] === "video" && tokens[2]) {
chat.sendMessage(botMsg("⏳ Baixando vídeo, aguarde..."));
enqueueDownload('video', tokens[2], msg);
}
if (tokens[1] === "audio" && tokens[2]) {
chat.sendMessage(botMsg("⏳ Baixando áudio, aguarde..."));
enqueueDownload('audio', tokens[2], msg);
}
}
// ---------------- Jogo ----------------
async function processarJogo(msg) {
const chat = await msg.getChat();
if (!jogoAtivo) return;
const tentativa = msg.body.trim();
if (!/^\d+$/.test(tentativa)) return;
const num = parseInt(tentativa, 10);
if (num === jogoAtivo) {
chat.sendMessage(botMsg(`Parabéns! Você acertou! Número: ${jogoAtivo}`));
jogoAtivo = null;
} else if (num > jogoAtivo) chat.sendMessage(botMsg(`Quase! Um pouco menor. Sua resposta: ${num}`));
else chat.sendMessage(botMsg(`Quase! Um pouco maior. Sua resposta: ${num}`));
}
client.initialize();

1
node_modules/.bin/browsers generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../@puppeteer/browsers/lib/cjs/main-cli.js

1
node_modules/.bin/crc32 generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../crc-32/bin/crc32.njs

1
node_modules/.bin/escodegen generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../escodegen/bin/escodegen.js

1
node_modules/.bin/esgenerate generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../escodegen/bin/esgenerate.js

1
node_modules/.bin/esparse generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../esprima/bin/esparse.js

1
node_modules/.bin/esvalidate generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../esprima/bin/esvalidate.js

1
node_modules/.bin/extract-zip generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../extract-zip/cli.js

1
node_modules/.bin/js-yaml generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../js-yaml/bin/js-yaml.js

1
node_modules/.bin/mime generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../mime/cli.js

1
node_modules/.bin/mkdirp generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../mkdirp/bin/cmd.js

1
node_modules/.bin/puppeteer generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../puppeteer/lib/cjs/puppeteer/node/cli.js

1
node_modules/.bin/qrcode-terminal generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../qrcode-terminal/bin/qrcode-terminal.js

1
node_modules/.bin/rimraf generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../rimraf/bin.js

1
node_modules/.bin/semver generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../semver/bin/semver.js

1
node_modules/.bin/which generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../which/bin/which

2096
node_modules/.package-lock.json generated vendored Normal file

File diff suppressed because it is too large Load Diff

22
node_modules/@babel/code-frame/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

19
node_modules/@babel/code-frame/README.md generated vendored Normal file
View File

@@ -0,0 +1,19 @@
# @babel/code-frame
> Generate errors that contain a code frame that point to source locations.
See our website [@babel/code-frame](https://babeljs.io/docs/babel-code-frame) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/code-frame
```
or using yarn:
```sh
yarn add @babel/code-frame --dev
```

217
node_modules/@babel/code-frame/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,217 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var picocolors = require('picocolors');
var jsTokens = require('js-tokens');
var helperValidatorIdentifier = require('@babel/helper-validator-identifier');
function isColorSupported() {
return (typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? false : picocolors.isColorSupported
);
}
const compose = (f, g) => v => f(g(v));
function buildDefs(colors) {
return {
keyword: colors.cyan,
capitalized: colors.yellow,
jsxIdentifier: colors.yellow,
punctuator: colors.yellow,
number: colors.magenta,
string: colors.green,
regex: colors.magenta,
comment: colors.gray,
invalid: compose(compose(colors.white, colors.bgRed), colors.bold),
gutter: colors.gray,
marker: compose(colors.red, colors.bold),
message: compose(colors.red, colors.bold),
reset: colors.reset
};
}
const defsOn = buildDefs(picocolors.createColors(true));
const defsOff = buildDefs(picocolors.createColors(false));
function getDefs(enabled) {
return enabled ? defsOn : defsOff;
}
const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
const BRACKET = /^[()[\]{}]$/;
let tokenize;
const JSX_TAG = /^[a-z][\w-]*$/i;
const getTokenType = function (token, offset, text) {
if (token.type === "name") {
const tokenValue = token.value;
if (helperValidatorIdentifier.isKeyword(tokenValue) || helperValidatorIdentifier.isStrictReservedWord(tokenValue, true) || sometimesKeywords.has(tokenValue)) {
return "keyword";
}
if (JSX_TAG.test(tokenValue) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) {
return "jsxIdentifier";
}
const firstChar = String.fromCodePoint(tokenValue.codePointAt(0));
if (firstChar !== firstChar.toLowerCase()) {
return "capitalized";
}
}
if (token.type === "punctuator" && BRACKET.test(token.value)) {
return "bracket";
}
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
return "punctuator";
}
return token.type;
};
tokenize = function* (text) {
let match;
while (match = jsTokens.default.exec(text)) {
const token = jsTokens.matchToToken(match);
yield {
type: getTokenType(token, match.index, text),
value: token.value
};
}
};
function highlight(text) {
if (text === "") return "";
const defs = getDefs(true);
let highlighted = "";
for (const {
type,
value
} of tokenize(text)) {
if (type in defs) {
highlighted += value.split(NEWLINE$1).map(str => defs[type](str)).join("\n");
} else {
highlighted += value;
}
}
return highlighted;
}
let deprecationWarningShown = false;
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
function getMarkerLines(loc, source, opts, startLineBaseZero) {
const startLoc = Object.assign({
column: 0,
line: -1
}, loc.start);
const endLoc = Object.assign({}, startLoc, loc.end);
const {
linesAbove = 2,
linesBelow = 3
} = opts || {};
const startLine = startLoc.line - startLineBaseZero;
const startColumn = startLoc.column;
const endLine = endLoc.line - startLineBaseZero;
const endColumn = endLoc.column;
let start = Math.max(startLine - (linesAbove + 1), 0);
let end = Math.min(source.length, endLine + linesBelow);
if (startLine === -1) {
start = 0;
}
if (endLine === -1) {
end = source.length;
}
const lineDiff = endLine - startLine;
const markerLines = {};
if (lineDiff) {
for (let i = 0; i <= lineDiff; i++) {
const lineNumber = i + startLine;
if (!startColumn) {
markerLines[lineNumber] = true;
} else if (i === 0) {
const sourceLength = source[lineNumber - 1].length;
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
} else if (i === lineDiff) {
markerLines[lineNumber] = [0, endColumn];
} else {
const sourceLength = source[lineNumber - i].length;
markerLines[lineNumber] = [0, sourceLength];
}
}
} else {
if (startColumn === endColumn) {
if (startColumn) {
markerLines[startLine] = [startColumn, 0];
} else {
markerLines[startLine] = true;
}
} else {
markerLines[startLine] = [startColumn, endColumn - startColumn];
}
}
return {
start,
end,
markerLines
};
}
function codeFrameColumns(rawLines, loc, opts = {}) {
const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
const startLineBaseZero = (opts.startLine || 1) - 1;
const defs = getDefs(shouldHighlight);
const lines = rawLines.split(NEWLINE);
const {
start,
end,
markerLines
} = getMarkerLines(loc, lines, opts, startLineBaseZero);
const hasColumns = loc.start && typeof loc.start.column === "number";
const numberMaxWidth = String(end + startLineBaseZero).length;
const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
const number = start + 1 + index;
const paddedNumber = ` ${number + startLineBaseZero}`.slice(-numberMaxWidth);
const gutter = ` ${paddedNumber} |`;
const hasMarker = markerLines[number];
const lastMarkerLine = !markerLines[number + 1];
if (hasMarker) {
let markerLine = "";
if (Array.isArray(hasMarker)) {
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
const numberOfMarkers = hasMarker[1] || 1;
markerLine = ["\n ", defs.gutter(gutter.replace(/\d/g, " ")), " ", markerSpacing, defs.marker("^").repeat(numberOfMarkers)].join("");
if (lastMarkerLine && opts.message) {
markerLine += " " + defs.message(opts.message);
}
}
return [defs.marker(">"), defs.gutter(gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
} else {
return ` ${defs.gutter(gutter)}${line.length > 0 ? ` ${line}` : ""}`;
}
}).join("\n");
if (opts.message && !hasColumns) {
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
}
if (shouldHighlight) {
return defs.reset(frame);
} else {
return frame;
}
}
function index (rawLines, lineNumber, colNumber, opts = {}) {
if (!deprecationWarningShown) {
deprecationWarningShown = true;
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
if (process.emitWarning) {
process.emitWarning(message, "DeprecationWarning");
} else {
const deprecationError = new Error(message);
deprecationError.name = "DeprecationWarning";
console.warn(new Error(message));
}
}
colNumber = Math.max(colNumber, 0);
const location = {
start: {
column: colNumber,
line: lineNumber
}
};
return codeFrameColumns(rawLines, location, opts);
}
exports.codeFrameColumns = codeFrameColumns;
exports.default = index;
exports.highlight = highlight;
//# sourceMappingURL=index.js.map

1
node_modules/@babel/code-frame/lib/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

32
node_modules/@babel/code-frame/package.json generated vendored Normal file
View File

@@ -0,0 +1,32 @@
{
"name": "@babel/code-frame",
"version": "7.29.0",
"description": "Generate errors that contain a code frame that point to source locations.",
"author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-code-frame",
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-code-frame"
},
"main": "./lib/index.js",
"dependencies": {
"@babel/helper-validator-identifier": "^7.28.5",
"js-tokens": "^4.0.0",
"picocolors": "^1.1.1"
},
"devDependencies": {
"charcodes": "^0.2.0",
"import-meta-resolve": "^4.1.0",
"strip-ansi": "^4.0.0"
},
"engines": {
"node": ">=6.9.0"
},
"type": "commonjs"
}

View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,19 @@
# @babel/helper-validator-identifier
> Validate identifier/keywords name
See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/babel-helper-validator-identifier) for more information.
## Install
Using npm:
```sh
npm install --save @babel/helper-validator-identifier
```
or using yarn:
```sh
yarn add @babel/helper-validator-identifier
```

View File

@@ -0,0 +1,70 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isIdentifierChar = isIdentifierChar;
exports.isIdentifierName = isIdentifierName;
exports.isIdentifierStart = isIdentifierStart;
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dc\ua7f1-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
let nonASCIIidentifierChars = "\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1add\u1ae0-\u1aeb\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 57, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 261, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489];
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
function isInAstralSet(code, set) {
let pos = 0x10000;
for (let i = 0, length = set.length; i < length; i += 2) {
pos += set[i];
if (pos > code) return false;
pos += set[i + 1];
if (pos >= code) return true;
}
return false;
}
function isIdentifierStart(code) {
if (code < 65) return code === 36;
if (code <= 90) return true;
if (code < 97) return code === 95;
if (code <= 122) return true;
if (code <= 0xffff) {
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
}
return isInAstralSet(code, astralIdentifierStartCodes);
}
function isIdentifierChar(code) {
if (code < 48) return code === 36;
if (code < 58) return true;
if (code < 65) return false;
if (code <= 90) return true;
if (code < 97) return code === 95;
if (code <= 122) return true;
if (code <= 0xffff) {
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
}
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
}
function isIdentifierName(name) {
let isFirst = true;
for (let i = 0; i < name.length; i++) {
let cp = name.charCodeAt(i);
if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) {
const trail = name.charCodeAt(++i);
if ((trail & 0xfc00) === 0xdc00) {
cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);
}
}
if (isFirst) {
isFirst = false;
if (!isIdentifierStart(cp)) {
return false;
}
} else if (!isIdentifierChar(cp)) {
return false;
}
}
return !isFirst;
}
//# sourceMappingURL=identifier.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,57 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isIdentifierChar", {
enumerable: true,
get: function () {
return _identifier.isIdentifierChar;
}
});
Object.defineProperty(exports, "isIdentifierName", {
enumerable: true,
get: function () {
return _identifier.isIdentifierName;
}
});
Object.defineProperty(exports, "isIdentifierStart", {
enumerable: true,
get: function () {
return _identifier.isIdentifierStart;
}
});
Object.defineProperty(exports, "isKeyword", {
enumerable: true,
get: function () {
return _keyword.isKeyword;
}
});
Object.defineProperty(exports, "isReservedWord", {
enumerable: true,
get: function () {
return _keyword.isReservedWord;
}
});
Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
enumerable: true,
get: function () {
return _keyword.isStrictBindOnlyReservedWord;
}
});
Object.defineProperty(exports, "isStrictBindReservedWord", {
enumerable: true,
get: function () {
return _keyword.isStrictBindReservedWord;
}
});
Object.defineProperty(exports, "isStrictReservedWord", {
enumerable: true,
get: function () {
return _keyword.isStrictReservedWord;
}
});
var _identifier = require("./identifier.js");
var _keyword = require("./keyword.js");
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_identifier","require","_keyword"],"sources":["../src/index.ts"],"sourcesContent":["export {\n isIdentifierName,\n isIdentifierChar,\n isIdentifierStart,\n} from \"./identifier.ts\";\nexport {\n isReservedWord,\n isStrictBindOnlyReservedWord,\n isStrictBindReservedWord,\n isStrictReservedWord,\n isKeyword,\n} from \"./keyword.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA","ignoreList":[]}

View File

@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isKeyword = isKeyword;
exports.isReservedWord = isReservedWord;
exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
exports.isStrictBindReservedWord = isStrictBindReservedWord;
exports.isStrictReservedWord = isStrictReservedWord;
const reservedWords = {
keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
strictBind: ["eval", "arguments"]
};
const keywords = new Set(reservedWords.keyword);
const reservedWordsStrictSet = new Set(reservedWords.strict);
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
function isReservedWord(word, inModule) {
return inModule && word === "await" || word === "enum";
}
function isStrictReservedWord(word, inModule) {
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
}
function isStrictBindOnlyReservedWord(word) {
return reservedWordsStrictBindSet.has(word);
}
function isStrictBindReservedWord(word, inModule) {
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
}
function isKeyword(word) {
return keywords.has(word);
}
//# sourceMappingURL=keyword.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["reservedWords","keyword","strict","strictBind","keywords","Set","reservedWordsStrictSet","reservedWordsStrictBindSet","isReservedWord","word","inModule","isStrictReservedWord","has","isStrictBindOnlyReservedWord","isStrictBindReservedWord","isKeyword"],"sources":["../src/keyword.ts"],"sourcesContent":["const reservedWords = {\n keyword: [\n \"break\",\n \"case\",\n \"catch\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"do\",\n \"else\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"return\",\n \"switch\",\n \"throw\",\n \"try\",\n \"var\",\n \"const\",\n \"while\",\n \"with\",\n \"new\",\n \"this\",\n \"super\",\n \"class\",\n \"extends\",\n \"export\",\n \"import\",\n \"null\",\n \"true\",\n \"false\",\n \"in\",\n \"instanceof\",\n \"typeof\",\n \"void\",\n \"delete\",\n ],\n strict: [\n \"implements\",\n \"interface\",\n \"let\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"static\",\n \"yield\",\n ],\n strictBind: [\"eval\", \"arguments\"],\n};\nconst keywords = new Set(reservedWords.keyword);\nconst reservedWordsStrictSet = new Set(reservedWords.strict);\nconst reservedWordsStrictBindSet = new Set(reservedWords.strictBind);\n\n/**\n * Checks if word is a reserved word in non-strict mode\n */\nexport function isReservedWord(word: string, inModule: boolean): boolean {\n return (inModule && word === \"await\") || word === \"enum\";\n}\n\n/**\n * Checks if word is a reserved word in non-binding strict mode\n *\n * Includes non-strict reserved words\n */\nexport function isStrictReservedWord(word: string, inModule: boolean): boolean {\n return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode, but it is allowed as\n * a normal identifier.\n */\nexport function isStrictBindOnlyReservedWord(word: string): boolean {\n return reservedWordsStrictBindSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode\n *\n * Includes non-strict reserved words and non-binding strict reserved words\n */\nexport function isStrictBindReservedWord(\n word: string,\n inModule: boolean,\n): boolean {\n return (\n isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word)\n );\n}\n\nexport function isKeyword(word: string): boolean {\n return keywords.has(word);\n}\n"],"mappings":";;;;;;;;;;AAAA,MAAMA,aAAa,GAAG;EACpBC,OAAO,EAAE,CACP,OAAO,EACP,MAAM,EACN,OAAO,EACP,UAAU,EACV,UAAU,EACV,SAAS,EACT,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,KAAK,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACN,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,QAAQ,CACT;EACDC,MAAM,EAAE,CACN,YAAY,EACZ,WAAW,EACX,KAAK,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,CACR;EACDC,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW;AAClC,CAAC;AACD,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAACL,aAAa,CAACC,OAAO,CAAC;AAC/C,MAAMK,sBAAsB,GAAG,IAAID,GAAG,CAACL,aAAa,CAACE,MAAM,CAAC;AAC5D,MAAMK,0BAA0B,GAAG,IAAIF,GAAG,CAACL,aAAa,CAACG,UAAU,CAAC;AAK7D,SAASK,cAAcA,CAACC,IAAY,EAAEC,QAAiB,EAAW;EACvE,OAAQA,QAAQ,IAAID,IAAI,KAAK,OAAO,IAAKA,IAAI,KAAK,MAAM;AAC1D;AAOO,SAASE,oBAAoBA,CAACF,IAAY,EAAEC,QAAiB,EAAW;EAC7E,OAAOF,cAAc,CAACC,IAAI,EAAEC,QAAQ,CAAC,IAAIJ,sBAAsB,CAACM,GAAG,CAACH,IAAI,CAAC;AAC3E;AAMO,SAASI,4BAA4BA,CAACJ,IAAY,EAAW;EAClE,OAAOF,0BAA0B,CAACK,GAAG,CAACH,IAAI,CAAC;AAC7C;AAOO,SAASK,wBAAwBA,CACtCL,IAAY,EACZC,QAAiB,EACR;EACT,OACEC,oBAAoB,CAACF,IAAI,EAAEC,QAAQ,CAAC,IAAIG,4BAA4B,CAACJ,IAAI,CAAC;AAE9E;AAEO,SAASM,SAASA,CAACN,IAAY,EAAW;EAC/C,OAAOL,QAAQ,CAACQ,GAAG,CAACH,IAAI,CAAC;AAC3B","ignoreList":[]}

View File

@@ -0,0 +1,31 @@
{
"name": "@babel/helper-validator-identifier",
"version": "7.28.5",
"description": "Validate identifier/keywords name",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-helper-validator-identifier"
},
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "./lib/index.js",
"exports": {
".": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"./package.json": "./package.json"
},
"devDependencies": {
"@unicode/unicode-17.0.0": "^1.6.10",
"charcodes": "^0.2.0"
},
"engines": {
"node": ">=6.9.0"
},
"author": "The Babel Team (https://babel.dev/team)",
"type": "commonjs"
}

21
node_modules/@pedroslopez/moduleraid/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Andreas N.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

85
node_modules/@pedroslopez/moduleraid/README.md generated vendored Normal file
View File

@@ -0,0 +1,85 @@
**NOTE** This package was modified from pixeldesu's original moduleRaid for compatibility with webpack v5 used in WhatsApp Web. No support will be given outside of anything strictly necessary to extract modules in WhatsApp Web.
<div align='center'>
<img width=200px src='.github/logo.png?raw=true'>
<h1>moduleRaid</h1>
<p>moduleRaid is a utility to get modules and module constructors from <code>webpackJsonp</code> functions embedded on websites by Webpack. It also provides functions to search through returned modules.</p>
</div>
<h2 align='center'>Installation</h2>
You can get moduleRaid over npm
```
$ npm install moduleraid
```
Or if you directly want to use it in the browser
```html
<script src="https://unpkg.com/moduleraid@4.0.1/moduleraid.js"></script>
<!-- minified -->
<script src="https://unpkg.com/moduleraid@4.0.1/moduleraid.min.js"></script>
```
Alternatively, just copy the script from `moduleraid.js` and run it in a devtool console
on the site of your choosing.
<h2 align='center'>Usage</h2>
### Preparation
Using `moduleRaid` as a module, simply require and execute it somewhere where it will end up as a public facing script on a page that also
includes a Webpack build!
```js
const moduleRaid = require('moduleraid')
window.mR = moduleRaid()
```
If you a running the script from the console or loading it over a service like unpkg, no further need for preparations!
### The `moduleraid` object
Once `moduleRaid` is run or included on a page that includes a Webpack build (usually noted by a `webpackJsonp` function), it
will return a object, containing:
* `modules`: An object containing all modules we could get from Webpack
* `constructors`: An array containing all module constructor functions
* `get(id)`: Get the module from the specified `id`
* `findModule(query)`: Return the module that has `query` as a key in its exports
* `findFunction(query)`: Return functions that include `query` (`query` can be either a string or a function)
If you run the code in devtools or load it as external script from unpkg/etc. the `moduleRaid` object can be found in `window.mR` by default.
**Note:** If moduleRaid had to get modules through iteration, `constructors` will be empty and so `findFunction` will not work.
#### Debug Mode
If you call moduleRaid with an optional argument `true`, you will enable debug output. Debug output will show errors that are normally supressed.
In the version that is minified and you can't just add another argument easily, simply run `window.mRdebug = true` before adding the script and you should
be fine!
<h2 align='center'>How it works</h2>
There already was a script basically doing the same as `moduleRaid` some months earlier, called [`webcrack`](https://gist.github.com/no-boot-device/cb63762000e606e50690911cac1bcead) (made by [no-boot-device](https://github.com/no-boot-device)), which was rendered obsolute due to structural changes in how you can access Webpack modules from the outside.
This library is an effort to bring back the ability to inspect all available modules, for debugging or userscript purposes.
As noted above, Webpack exposes a function `webpackJsonp` containing all the code that has been bundled with Webpack. The function takes three
parameters, all of them being an array. The first two don't seem to really matter, the last one is interesting, it seems to directly return
a module given an index.
So, in a brute-forcy manner we simply run a `while` over `webpackJsonp([], [], [i])` until we get an exception from Webpack (trying to run `call`
on `undefined`), and now we have all modules (_or most of them_)!
<h2 align='center'>Known Issues</h2>
* There seem to be a lot of empty modules, I'm not sure if these are _padding_ or something is missing here
<h2 align='center'>License</h2>
moduleRaid is licensed under the MIT License

73
node_modules/@pedroslopez/moduleraid/moduleraid.js generated vendored Normal file
View File

@@ -0,0 +1,73 @@
/* moduleRaid v5
* https://github.com/@pedroslopez/moduleRaid
*
* Copyright pixeldesu, pedroslopez and other contributors
* Licensed under the MIT License
* https://github.com/pedroslopez/moduleRaid/blob/master/LICENSE
*/
const moduleRaid = function () {
moduleRaid.mID = Math.random().toString(36).substring(7);
moduleRaid.mObj = {};
fillModuleArray = function() {
(window.webpackChunkbuild || window.webpackChunkwhatsapp_web_client).push([
[moduleRaid.mID], {}, function(e) {
Object.keys(e.m).forEach(function(mod) {
moduleRaid.mObj[mod] = e(mod);
})
}
]);
}
fillModuleArray();
get = function get (id) {
return moduleRaid.mObj[id]
}
findModule = function findModule (query) {
results = [];
modules = Object.keys(moduleRaid.mObj);
modules.forEach(function(mKey) {
mod = moduleRaid.mObj[mKey];
if (typeof mod !== 'undefined') {
if (typeof query === 'string') {
if (typeof mod.default === 'object') {
for (key in mod.default) {
if (key == query) results.push(mod);
}
}
for (key in mod) {
if (key == query) results.push(mod);
}
} else if (typeof query === 'function') {
if (query(mod)) {
results.push(mod);
}
} else {
throw new TypeError('findModule can only find via string and function, ' + (typeof query) + ' was passed');
}
}
})
return results;
}
return {
modules: moduleRaid.mObj,
constructors: moduleRaid.cArr,
findModule: findModule,
get: get
}
}
if (typeof module === 'object' && module.exports) {
module.exports = moduleRaid;
} else {
window.mR = moduleRaid();
}

29
node_modules/@pedroslopez/moduleraid/package.json generated vendored Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "@pedroslopez/moduleraid",
"version": "5.0.2",
"description": "Get modules from webpack v5",
"main": "moduleraid.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"types": "./moduleraid.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/pixeldesu/moduleRaid.git"
},
"keywords": [
"webpack",
"module",
"research",
"extraction"
],
"files": [
"moduleraid.js"
],
"author": "Andreas Nedbal <andy@pixelde.su>, Pedro Lopez <pedroslopez@me.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/pixeldesu/moduleRaid/issues"
},
"homepage": "https://github.com/@pedroslopez/moduleRaid#readme"
}

160
node_modules/@puppeteer/browsers/README.md generated vendored Normal file
View File

@@ -0,0 +1,160 @@
# @puppeteer/browsers
Manage and launch browsers/drivers from a CLI or programmatically.
## System requirements
- A compatible Node version (see `engines` in `package.json`).
- For Firefox downloads:
- Linux builds: `xz` and `bzip2` utilities are required to unpack `.tar.gz` and `.tar.bz2` archives.
- MacOS builds: `hdiutil` is required to unpack `.dmg` archives.
## CLI
Use `npx` to run the CLI:
```bash
# This will install and run the @puppeteer/browsers package.
# If it is already installed in the current directory, the installed
# version will be used.
npx @puppeteer/browsers --help
```
Built-in per-command `help` will provide all documentation you need to use the CLI.
```bash
npx @puppeteer/browsers --help # help for all commands
npx @puppeteer/browsers install --help # help for the install command
npx @puppeteer/browsers launch --help # help for the launch command
npx @puppeteer/browsers clear --help # help for the clear command
npx @puppeteer/browsers list --help # help for the list command
```
You can specify the version of the `@puppeteer/browsers` when using
`npx`:
```bash
# Always install and use the latest version from the registry.
npx @puppeteer/browsers@latest --help
# Always use a specifc version.
npx @puppeteer/browsers@2.4.1 --help
# Always install the latest version and automatically confirm the installation.
npx --yes @puppeteer/browsers@latest --help
```
To clear all installed browsers, use the `clear` command:
```bash
npx @puppeteer/browsers clear
```
To list all installed browsers, use the `list` command:
```bash
npx @puppeteer/browsers list
```
Some example to give an idea of what the CLI looks like (use the `--help` command for more examples):
```sh
# Download the latest available Chrome for Testing binary corresponding to the Stable channel.
npx @puppeteer/browsers install chrome@stable
# Download a specific Chrome for Testing version.
npx @puppeteer/browsers install chrome@116.0.5793.0
# Download the latest Chrome for Testing version for the given milestone.
npx @puppeteer/browsers install chrome@117
# Download the latest available ChromeDriver version corresponding to the Canary channel.
npx @puppeteer/browsers install chromedriver@canary
# Download a specific ChromeDriver version.
npx @puppeteer/browsers install chromedriver@116.0.5793.0
# On Ubuntu/Debian and only for Chrome, install the browser and required system dependencies.
# If the browser version has already been installed, the command
# will still attempt to install system dependencies.
# Requires root privileges.
npx puppeteer browsers install chrome --install-deps
```
## Known limitations
1. Launching the system browsers is only possible for Chrome/Chromium.
## Custom Providers
You can implement custom browser providers to download from alternative sources like corporate mirrors, private repositories, or specialized browser builds.
```typescript
import {
BrowserProvider,
DownloadOptions,
Browser,
BrowserPlatform,
} from '@puppeteer/browsers';
class SimpleMirrorProvider implements BrowserProvider {
constructor(private mirrorUrl: string) {}
supports(options: DownloadOptions): boolean {
return options.browser === Browser.CHROME;
}
getDownloadUrl(options: DownloadOptions): URL | null {
const {buildId, platform} = options;
const filenameMap = {
[BrowserPlatform.LINUX]: 'chrome-linux64.zip',
[BrowserPlatform.MAC]: 'chrome-mac-x64.zip',
[BrowserPlatform.MAC_ARM]: 'chrome-mac-arm64.zip',
[BrowserPlatform.WIN32]: 'chrome-win32.zip',
[BrowserPlatform.WIN64]: 'chrome-win64.zip',
};
const filename = filenameMap[platform];
if (!filename) return null;
return new URL(`${this.mirrorUrl}/chrome/${buildId}/${filename}`);
}
getExecutablePath(options: DownloadOptions): string {
const {platform} = options;
if (
platform === BrowserPlatform.MAC ||
platform === BrowserPlatform.MAC_ARM
) {
return 'chrome-mac/Chromium.app/Contents/MacOS/Chromium';
} else if (platform === BrowserPlatform.LINUX) {
return 'chrome-linux64/chrome';
} else if (platform.includes('win')) {
return 'chrome-win64/chrome.exe';
}
throw new Error(`Unsupported platform: ${platform}`);
}
}
```
Use with the `install` API:
```typescript
import {install} from '@puppeteer/browsers';
const customProvider = new SimpleMirrorProvider('https://internal.company.com');
await install({
browser: Browser.CHROME,
buildId: '120.0.6099.109',
platform: BrowserPlatform.LINUX,
cacheDir: '/tmp/puppeteer-cache',
providers: [customProvider],
});
```
Multiple providers can be chained - they're tried in order until one succeeds, with a default provider such as Chrome for Testing, as an automatic fallback.
:::caution
Custom providers are NOT officially supported by Puppeteer. You accept full responsibility for binary compatibility, testing, and maintenance.
:::
## API
The programmatic API allows installing and launching browsers from your code. See the `test` folder for examples on how to use the `install`, `canInstall`, `launch`, `computeExecutablePath`, `computeSystemExecutablePath` and other methods.

29
node_modules/@puppeteer/browsers/lib/cjs/CLI.d.ts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import * as readline from 'node:readline';
import { Browser } from './browser-data/browser-data.js';
/**
* @public
*/
export declare class CLI {
#private;
constructor(opts?: string | {
cachePath?: string;
scriptName?: string;
version?: string;
prefixCommand?: {
cmd: string;
description: string;
};
allowCachePathOverride?: boolean;
pinnedBrowsers?: Partial<Record<Browser, {
buildId: string;
skipDownload: boolean;
}>>;
}, rl?: readline.Interface);
run(argv: string[]): Promise<void>;
}
//# sourceMappingURL=CLI.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CLI.d.ts","sourceRoot":"","sources":["../../src/CLI.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAI1C,OAAO,EACL,OAAO,EAIR,MAAM,gCAAgC,CAAC;AAoCxC;;GAEG;AACH,qBAAa,GAAG;;gBAkBZ,IAAI,CAAC,EACD,MAAM,GACN;QACE,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAA;SAAC,CAAC;QACnD,sBAAsB,CAAC,EAAE,OAAO,CAAC;QACjC,cAAc,CAAC,EAAE,OAAO,CACtB,MAAM,CACJ,OAAO,EACP;YACE,OAAO,EAAE,MAAM,CAAC;YAChB,YAAY,EAAE,OAAO,CAAC;SACvB,CACF,CACF,CAAC;KACH,EACL,EAAE,CAAC,EAAE,QAAQ,CAAC,SAAS;IA+EnB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CA+YzC"}

375
node_modules/@puppeteer/browsers/lib/cjs/CLI.js generated vendored Normal file
View File

@@ -0,0 +1,375 @@
"use strict";
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CLI = void 0;
const node_process_1 = require("node:process");
const readline = __importStar(require("node:readline"));
const browser_data_js_1 = require("./browser-data/browser-data.js");
const Cache_js_1 = require("./Cache.js");
const detectPlatform_js_1 = require("./detectPlatform.js");
const install_js_1 = require("./install.js");
const launch_js_1 = require("./launch.js");
function isValidBrowser(browser) {
return Object.values(browser_data_js_1.Browser).includes(browser);
}
function isValidPlatform(platform) {
return Object.values(browser_data_js_1.BrowserPlatform).includes(platform);
}
// If moved update release-please config
// x-release-please-start-version
const packageVersion = '2.13.0';
// x-release-please-end
/**
* @public
*/
class CLI {
#cachePath;
#rl;
#scriptName;
#version;
#allowCachePathOverride;
#pinnedBrowsers;
#prefixCommand;
constructor(opts, rl) {
if (!opts) {
opts = {};
}
if (typeof opts === 'string') {
opts = {
cachePath: opts,
};
}
this.#cachePath = opts.cachePath ?? process.cwd();
this.#rl = rl;
this.#scriptName = opts.scriptName ?? '@puppeteer/browsers';
this.#version = opts.version ?? packageVersion;
this.#allowCachePathOverride = opts.allowCachePathOverride ?? true;
this.#pinnedBrowsers = opts.pinnedBrowsers;
this.#prefixCommand = opts.prefixCommand;
}
#defineBrowserParameter(yargs, required) {
return yargs.positional('browser', {
description: 'Which browser to install <browser>[@<buildId|latest>]. `latest` will try to find the latest available build. `buildId` is a browser-specific identifier such as a version or a revision.',
type: 'string',
coerce: (opt) => {
const browser = {
name: this.#parseBrowser(opt),
buildId: this.#parseBuildId(opt),
};
if (!isValidBrowser(browser.name)) {
throw new Error(`Unsupported browser '${browser.name}'`);
}
return browser;
},
demandOption: required,
});
}
#definePlatformParameter(yargs) {
return yargs.option('platform', {
type: 'string',
desc: 'Platform that the binary needs to be compatible with.',
choices: Object.values(browser_data_js_1.BrowserPlatform),
default: (0, detectPlatform_js_1.detectBrowserPlatform)(),
coerce: platform => {
if (!isValidPlatform(platform)) {
throw new Error(`Unsupported platform '${platform}'`);
}
return platform;
},
defaultDescription: 'Auto-detected',
});
}
#definePathParameter(yargs, required = false) {
if (!this.#allowCachePathOverride) {
return yargs;
}
return yargs.option('path', {
type: 'string',
desc: 'Path to the root folder for the browser downloads and installation. If a relative path is provided, it will be resolved relative to the current working directory. The installation folder structure is compatible with the cache structure used by Puppeteer.',
defaultDescription: 'Current working directory',
...(required ? {} : { default: process.cwd() }),
demandOption: required,
});
}
async run(argv) {
const { default: yargs } = await import('yargs');
const { hideBin } = await import('yargs/helpers');
const yargsInstance = yargs(hideBin(argv));
let target = yargsInstance
.scriptName(this.#scriptName)
.version(this.#version);
if (this.#prefixCommand) {
target = target.command(this.#prefixCommand.cmd, this.#prefixCommand.description, yargs => {
return this.#build(yargs);
});
}
else {
target = this.#build(target);
}
await target
.demandCommand(1)
.help()
.wrap(Math.min(120, yargsInstance.terminalWidth()))
.parseAsync();
}
#build(yargs) {
const latestOrPinned = this.#pinnedBrowsers ? 'pinned' : 'latest';
// If there are pinned browsers allow the positional arg to be optional
const browserArgType = this.#pinnedBrowsers ? '[browser]' : '<browser>';
return yargs
.command(`install ${browserArgType}`, 'Download and install the specified browser. If successful, the command outputs the actual browser buildId that was installed and the absolute path to the browser executable (see --format).', yargs => {
if (this.#pinnedBrowsers) {
yargs.example('$0 install', 'Install all pinned browsers');
}
yargs
.example('$0 install chrome', `Install the ${latestOrPinned} available build of the Chrome browser.`)
.example('$0 install chrome@latest', 'Install the latest available build for the Chrome browser.')
.example('$0 install chrome@stable', 'Install the latest available build for the Chrome browser from the stable channel.')
.example('$0 install chrome@beta', 'Install the latest available build for the Chrome browser from the beta channel.')
.example('$0 install chrome@dev', 'Install the latest available build for the Chrome browser from the dev channel.')
.example('$0 install chrome@canary', 'Install the latest available build for the Chrome Canary browser.')
.example('$0 install chrome@115', 'Install the latest available build for Chrome 115.')
.example('$0 install chromedriver@canary', 'Install the latest available build for ChromeDriver Canary.')
.example('$0 install chromedriver@115', 'Install the latest available build for ChromeDriver 115.')
.example('$0 install chromedriver@115.0.5790', 'Install the latest available patch (115.0.5790.X) build for ChromeDriver.')
.example('$0 install chrome-headless-shell', 'Install the latest available chrome-headless-shell build.')
.example('$0 install chrome-headless-shell@beta', 'Install the latest available chrome-headless-shell build corresponding to the Beta channel.')
.example('$0 install chrome-headless-shell@118', 'Install the latest available chrome-headless-shell 118 build.')
.example('$0 install chromium@1083080', 'Install the revision 1083080 of the Chromium browser.')
.example('$0 install firefox', 'Install the latest nightly available build of the Firefox browser.')
.example('$0 install firefox@stable', 'Install the latest stable build of the Firefox browser.')
.example('$0 install firefox@beta', 'Install the latest beta build of the Firefox browser.')
.example('$0 install firefox@devedition', 'Install the latest devedition build of the Firefox browser.')
.example('$0 install firefox@esr', 'Install the latest ESR build of the Firefox browser.')
.example('$0 install firefox@nightly', 'Install the latest nightly build of the Firefox browser.')
.example('$0 install firefox@stable_111.0.1', 'Install a specific version of the Firefox browser.')
.example('$0 install firefox --platform mac', 'Install the latest Mac (Intel) build of the Firefox browser.');
if (this.#allowCachePathOverride) {
yargs.example('$0 install firefox --path /tmp/my-browser-cache', 'Install to the specified cache directory.');
}
const yargsWithBrowserParam = this.#defineBrowserParameter(yargs, !Boolean(this.#pinnedBrowsers));
const yargsWithPlatformParam = this.#definePlatformParameter(yargsWithBrowserParam);
return this.#definePathParameter(yargsWithPlatformParam, false)
.option('base-url', {
type: 'string',
desc: 'Base URL to download from',
})
.option('install-deps', {
type: 'boolean',
desc: 'Whether to attempt installing system dependencies (only supported on Linux, requires root privileges).',
default: false,
})
.option('format', {
type: 'string',
desc: 'Format to use for the output. Supported placeholders: {{browser}}, {{buildId}}, {{path}}, {{platform}}',
default: '{{browser}}@{{buildId}} {{path}}',
});
}, async (args) => {
if (this.#pinnedBrowsers && !args.browser) {
// Use allSettled to avoid scenarios that
// a browser may fail early and leave the other
// installation in a faulty state
const result = await Promise.allSettled(Object.entries(this.#pinnedBrowsers).map(async ([browser, options]) => {
if (options.skipDownload) {
return;
}
await this.#install({
...args,
browser: {
name: browser,
buildId: options.buildId,
},
});
}));
for (const install of result) {
if (install.status === 'rejected') {
throw install.reason;
}
}
}
else {
await this.#install(args);
}
})
.command('launch <browser>', 'Launch the specified browser', yargs => {
yargs
.example('$0 launch chrome@115.0.5790.170', 'Launch Chrome 115.0.5790.170')
.example('$0 launch firefox@112.0a1', 'Launch the Firefox browser identified by the milestone 112.0a1.')
.example('$0 launch chrome@115.0.5790.170 --detached', 'Launch the browser but detach the sub-processes.')
.example('$0 launch chrome@canary --system', 'Try to locate the Canary build of Chrome installed on the system and launch it.')
.example('$0 launch chrome@115.0.5790.170 -- --version', 'Launch Chrome 115.0.5790.170 and pass custom argument to the binary.');
const yargsWithExtraAgs = yargs.parserConfiguration({
'populate--': true,
// Yargs does not have the correct overload for this.
});
const yargsWithBrowserParam = this.#defineBrowserParameter(yargsWithExtraAgs, true);
const yargsWithPlatformParam = this.#definePlatformParameter(yargsWithBrowserParam);
return this.#definePathParameter(yargsWithPlatformParam)
.option('detached', {
type: 'boolean',
desc: 'Detach the child process.',
default: false,
})
.option('system', {
type: 'boolean',
desc: 'Search for a browser installed on the system instead of the cache folder.',
default: false,
})
.option('dumpio', {
type: 'boolean',
desc: "Forwards the browser's process stdout and stderr",
default: false,
});
}, async (args) => {
const extraArgs = args['--']?.filter(arg => {
return typeof arg === 'string';
});
args.browser.buildId = this.#resolvePinnedBrowserIfNeeded(args.browser.buildId, args.browser.name);
const executablePath = args.system
? (0, launch_js_1.computeSystemExecutablePath)({
browser: args.browser.name,
// TODO: throw an error if not a ChromeReleaseChannel is provided.
channel: args.browser.buildId,
platform: args.platform,
})
: (0, launch_js_1.computeExecutablePath)({
browser: args.browser.name,
buildId: args.browser.buildId,
cacheDir: args.path ?? this.#cachePath,
platform: args.platform,
});
(0, launch_js_1.launch)({
args: extraArgs,
executablePath,
dumpio: args.dumpio,
detached: args.detached,
});
})
.command('clear', this.#allowCachePathOverride
? 'Removes all installed browsers from the specified cache directory'
: `Removes all installed browsers from ${this.#cachePath}`, yargs => {
return this.#definePathParameter(yargs, true);
}, async (args) => {
const cacheDir = args.path ?? this.#cachePath;
const rl = this.#rl ?? readline.createInterface({ input: node_process_1.stdin, output: node_process_1.stdout });
rl.question(`Do you want to permanently and recursively delete the content of ${cacheDir} (yes/No)? `, answer => {
rl.close();
if (!['y', 'yes'].includes(answer.toLowerCase().trim())) {
console.log('Cancelled.');
return;
}
const cache = new Cache_js_1.Cache(cacheDir);
cache.clear();
console.log(`${cacheDir} cleared.`);
});
})
.command('list', 'List all installed browsers in the cache directory', yargs => {
yargs.example('$0 list', 'List all installed browsers in the cache directory');
if (this.#allowCachePathOverride) {
yargs.example('$0 list --path /tmp/my-browser-cache', 'List browsers installed in the specified cache directory');
}
return this.#definePathParameter(yargs);
}, async (args) => {
const cacheDir = args.path ?? this.#cachePath;
const cache = new Cache_js_1.Cache(cacheDir);
const browsers = cache.getInstalledBrowsers();
for (const browser of browsers) {
console.log(`${browser.browser}@${browser.buildId} (${browser.platform}) ${browser.executablePath}`);
}
})
.demandCommand(1)
.help();
}
#parseBrowser(version) {
return version.split('@').shift();
}
#parseBuildId(version) {
const parts = version.split('@');
return parts.length === 2
? parts[1]
: this.#pinnedBrowsers
? 'pinned'
: 'latest';
}
#resolvePinnedBrowserIfNeeded(buildId, browserName) {
if (buildId === 'pinned') {
const options = this.#pinnedBrowsers?.[browserName];
if (!options || !options.buildId) {
throw new Error(`No pinned version found for ${browserName}`);
}
return options.buildId;
}
return buildId;
}
async #install(args) {
if (!args.browser) {
throw new Error(`No browser arg provided`);
}
if (!args.platform) {
throw new Error(`Could not resolve the current platform`);
}
args.browser.buildId = this.#resolvePinnedBrowserIfNeeded(args.browser.buildId, args.browser.name);
const originalBuildId = args.browser.buildId;
args.browser.buildId = await (0, browser_data_js_1.resolveBuildId)(args.browser.name, args.platform, args.browser.buildId);
await (0, install_js_1.install)({
browser: args.browser.name,
buildId: args.browser.buildId,
platform: args.platform,
cacheDir: args.path ?? this.#cachePath,
downloadProgressCallback: 'default',
baseUrl: args.baseUrl,
buildIdAlias: originalBuildId !== args.browser.buildId ? originalBuildId : undefined,
installDeps: args.installDeps,
});
const executablePath = (0, launch_js_1.computeExecutablePath)({
browser: args.browser.name,
buildId: args.browser.buildId,
cacheDir: args.path ?? this.#cachePath,
platform: args.platform,
});
console.log(args.format
.replace(/{{browser}}/g, args.browser.name)
.replace(/{{buildId}}/g, args.browser.buildId)
.replace(/{{path}}/g, executablePath)
.replace(/{{platform}}/g, args.platform));
}
}
exports.CLI = CLI;
//# sourceMappingURL=CLI.js.map

1
node_modules/@puppeteer/browsers/lib/cjs/CLI.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

89
node_modules/@puppeteer/browsers/lib/cjs/Cache.d.ts generated vendored Normal file
View File

@@ -0,0 +1,89 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import { Browser, type BrowserPlatform } from './browser-data/browser-data.js';
/**
* @public
*/
export declare class InstalledBrowser {
#private;
browser: Browser;
buildId: string;
platform: BrowserPlatform;
readonly executablePath: string;
/**
* @internal
*/
constructor(cache: Cache, browser: Browser, buildId: string, platform: BrowserPlatform);
/**
* Path to the root of the installation folder. Use
* {@link computeExecutablePath} to get the path to the executable binary.
*/
get path(): string;
readMetadata(): Metadata;
writeMetadata(metadata: Metadata): void;
}
/**
* @internal
*/
export interface ComputeExecutablePathOptions {
/**
* Determines which platform the browser will be suited for.
*
* @defaultValue **Auto-detected.**
*/
platform?: BrowserPlatform;
/**
* Determines which browser to launch.
*/
browser: Browser;
/**
* Determines which buildId to download. BuildId should uniquely identify
* binaries and they are used for caching.
*/
buildId: string;
}
/**
* @public
*/
export interface Metadata {
aliases: Record<string, string>;
executablePaths?: Record<string, string>;
}
/**
* The cache used by Puppeteer relies on the following structure:
*
* - rootDir
* -- <browser1> | browserRoot(browser1)
* ---- <platform>-<buildId> | installationDir()
* ------ the browser-platform-buildId
* ------ specific structure.
* -- <browser2> | browserRoot(browser2)
* ---- <platform>-<buildId> | installationDir()
* ------ the browser-platform-buildId
* ------ specific structure.
* @internal
*/
export declare class Cache {
#private;
constructor(rootDir: string);
/**
* @internal
*/
get rootDir(): string;
browserRoot(browser: Browser): string;
metadataFile(browser: Browser): string;
readMetadata(browser: Browser): Metadata;
writeMetadata(browser: Browser, metadata: Metadata): void;
readExecutablePath(browser: Browser, platform: BrowserPlatform, buildId: string): string | null;
writeExecutablePath(browser: Browser, platform: BrowserPlatform, buildId: string, executablePath: string): void;
resolveAlias(browser: Browser, alias: string): string | undefined;
installationDir(browser: Browser, platform: BrowserPlatform, buildId: string): string;
clear(): void;
uninstall(browser: Browser, platform: BrowserPlatform, buildId: string): void;
getInstalledBrowsers(): InstalledBrowser[];
computeExecutablePath(options: ComputeExecutablePathOptions): string;
}
//# sourceMappingURL=Cache.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../src/Cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EACL,OAAO,EACP,KAAK,eAAe,EAGrB,MAAM,gCAAgC,CAAC;AAKxC;;GAEG;AACH,qBAAa,gBAAgB;;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAIhC;;OAEG;gBAED,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,eAAe;IAa3B;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAMjB;IAED,YAAY,IAAI,QAAQ;IAIxB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAGxC;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IAEvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,KAAK;;gBAGJ,OAAO,EAAE,MAAM;IAI3B;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAIrC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAItC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ;IAaxC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAMzD,kBAAkB,CAChB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI;IAMhB,mBAAmB,CACjB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GACrB,IAAI;IAUP,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAUjE,eAAe,CACb,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM;IAIT,KAAK,IAAI,IAAI;IASb,SAAS,CACP,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,IAAI;IAqBP,oBAAoB,IAAI,gBAAgB,EAAE;IA+B1C,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,MAAM;CAqCrE"}

216
node_modules/@puppeteer/browsers/lib/cjs/Cache.js generated vendored Normal file
View File

@@ -0,0 +1,216 @@
"use strict";
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cache = exports.InstalledBrowser = void 0;
const node_fs_1 = __importDefault(require("node:fs"));
const node_os_1 = __importDefault(require("node:os"));
const node_path_1 = __importDefault(require("node:path"));
const debug_1 = __importDefault(require("debug"));
const browser_data_js_1 = require("./browser-data/browser-data.js");
const detectPlatform_js_1 = require("./detectPlatform.js");
const debugCache = (0, debug_1.default)('puppeteer:browsers:cache');
/**
* @public
*/
class InstalledBrowser {
browser;
buildId;
platform;
executablePath;
#cache;
/**
* @internal
*/
constructor(cache, browser, buildId, platform) {
this.#cache = cache;
this.browser = browser;
this.buildId = buildId;
this.platform = platform;
this.executablePath = cache.computeExecutablePath({
browser,
buildId,
platform,
});
}
/**
* Path to the root of the installation folder. Use
* {@link computeExecutablePath} to get the path to the executable binary.
*/
get path() {
return this.#cache.installationDir(this.browser, this.platform, this.buildId);
}
readMetadata() {
return this.#cache.readMetadata(this.browser);
}
writeMetadata(metadata) {
this.#cache.writeMetadata(this.browser, metadata);
}
}
exports.InstalledBrowser = InstalledBrowser;
/**
* The cache used by Puppeteer relies on the following structure:
*
* - rootDir
* -- <browser1> | browserRoot(browser1)
* ---- <platform>-<buildId> | installationDir()
* ------ the browser-platform-buildId
* ------ specific structure.
* -- <browser2> | browserRoot(browser2)
* ---- <platform>-<buildId> | installationDir()
* ------ the browser-platform-buildId
* ------ specific structure.
* @internal
*/
class Cache {
#rootDir;
constructor(rootDir) {
this.#rootDir = rootDir;
}
/**
* @internal
*/
get rootDir() {
return this.#rootDir;
}
browserRoot(browser) {
return node_path_1.default.join(this.#rootDir, browser);
}
metadataFile(browser) {
return node_path_1.default.join(this.browserRoot(browser), '.metadata');
}
readMetadata(browser) {
const metatadaPath = this.metadataFile(browser);
if (!node_fs_1.default.existsSync(metatadaPath)) {
return { aliases: {} };
}
// TODO: add type-safe parsing.
const data = JSON.parse(node_fs_1.default.readFileSync(metatadaPath, 'utf8'));
if (typeof data !== 'object') {
throw new Error('.metadata is not an object');
}
return data;
}
writeMetadata(browser, metadata) {
const metatadaPath = this.metadataFile(browser);
node_fs_1.default.mkdirSync(node_path_1.default.dirname(metatadaPath), { recursive: true });
node_fs_1.default.writeFileSync(metatadaPath, JSON.stringify(metadata, null, 2));
}
readExecutablePath(browser, platform, buildId) {
const metadata = this.readMetadata(browser);
const key = `${platform}-${buildId}`;
return metadata.executablePaths?.[key] ?? null;
}
writeExecutablePath(browser, platform, buildId, executablePath) {
const metadata = this.readMetadata(browser);
if (!metadata.executablePaths) {
metadata.executablePaths = {};
}
const key = `${platform}-${buildId}`;
metadata.executablePaths[key] = executablePath;
this.writeMetadata(browser, metadata);
}
resolveAlias(browser, alias) {
const metadata = this.readMetadata(browser);
if (alias === 'latest') {
return Object.values(metadata.aliases || {})
.sort((0, browser_data_js_1.getVersionComparator)(browser))
.at(-1);
}
return metadata.aliases[alias];
}
installationDir(browser, platform, buildId) {
return node_path_1.default.join(this.browserRoot(browser), `${platform}-${buildId}`);
}
clear() {
node_fs_1.default.rmSync(this.#rootDir, {
force: true,
recursive: true,
maxRetries: 10,
retryDelay: 500,
});
}
uninstall(browser, platform, buildId) {
const metadata = this.readMetadata(browser);
for (const alias of Object.keys(metadata.aliases)) {
if (metadata.aliases[alias] === buildId) {
delete metadata.aliases[alias];
}
}
// Clean up executable path entry
const key = `${platform}-${buildId}`;
if (metadata.executablePaths?.[key]) {
delete metadata.executablePaths[key];
this.writeMetadata(browser, metadata);
}
node_fs_1.default.rmSync(this.installationDir(browser, platform, buildId), {
force: true,
recursive: true,
maxRetries: 10,
retryDelay: 500,
});
}
getInstalledBrowsers() {
if (!node_fs_1.default.existsSync(this.#rootDir)) {
return [];
}
const types = node_fs_1.default.readdirSync(this.#rootDir);
const browsers = types.filter((t) => {
return Object.values(browser_data_js_1.Browser).includes(t);
});
return browsers.flatMap(browser => {
const files = node_fs_1.default.readdirSync(this.browserRoot(browser));
return files
.map(file => {
const result = parseFolderPath(node_path_1.default.join(this.browserRoot(browser), file));
if (!result) {
return null;
}
return new InstalledBrowser(this, browser, result.buildId, result.platform);
})
.filter((item) => {
return item !== null;
});
});
}
computeExecutablePath(options) {
options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)();
if (!options.platform) {
throw new Error(`Cannot download a binary for the provided platform: ${node_os_1.default.platform()} (${node_os_1.default.arch()})`);
}
try {
options.buildId =
this.resolveAlias(options.browser, options.buildId) ?? options.buildId;
}
catch {
debugCache('could not read .metadata file for the browser');
}
const installationDir = this.installationDir(options.browser, options.platform, options.buildId);
const storedExecutablePath = this.readExecutablePath(options.browser, options.platform, options.buildId);
if (storedExecutablePath) {
// The metadata contains a resolved relative path from the installation dir
return node_path_1.default.join(installationDir, storedExecutablePath);
}
return node_path_1.default.join(installationDir, browser_data_js_1.executablePathByBrowser[options.browser](options.platform, options.buildId));
}
}
exports.Cache = Cache;
function parseFolderPath(folderPath) {
const name = node_path_1.default.basename(folderPath);
const splits = name.split('-');
if (splits.length !== 2) {
return;
}
const [platform, buildId] = splits;
if (!buildId || !platform) {
return;
}
return { platform, buildId };
}
//# sourceMappingURL=Cache.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,26 @@
/**
* @license
* Copyright 2026 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import type { Browser, BrowserPlatform } from './browser-data/browser-data.js';
import type { BrowserProvider, DownloadOptions } from './provider.js';
/**
* Default provider implementation that uses default sources.
* This is the standard provider used by Puppeteer.
*
* @public
*/
export declare class DefaultProvider implements BrowserProvider {
#private;
constructor(baseUrl?: string);
supports(_options: DownloadOptions): boolean;
getDownloadUrl(options: DownloadOptions): URL;
getExecutablePath(options: {
browser: Browser;
buildId: string;
platform: BrowserPlatform;
}): string;
getName(): string;
}
//# sourceMappingURL=DefaultProvider.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DefaultProvider.d.ts","sourceRoot":"","sources":["../../src/DefaultProvider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAE,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAK7E,OAAO,KAAK,EAAC,eAAe,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAEpE;;;;;GAKG;AACH,qBAAa,eAAgB,YAAW,eAAe;;gBAGzC,OAAO,CAAC,EAAE,MAAM;IAI5B,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO;IAK5C,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;IAgB7C,iBAAiB,CAAC,OAAO,EAAE;QACzB,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,eAAe,CAAC;KAC3B,GAAG,MAAM;IAOV,OAAO,IAAI,MAAM;CAGlB"}

View File

@@ -0,0 +1,39 @@
"use strict";
/**
* @license
* Copyright 2026 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultProvider = void 0;
const browser_data_js_1 = require("./browser-data/browser-data.js");
/**
* Default provider implementation that uses default sources.
* This is the standard provider used by Puppeteer.
*
* @public
*/
class DefaultProvider {
#baseUrl;
constructor(baseUrl) {
this.#baseUrl = baseUrl;
}
supports(_options) {
// Default provider supports all browsers
return true;
}
getDownloadUrl(options) {
return this.#getDownloadUrl(options.browser, options.platform, options.buildId);
}
#getDownloadUrl(browser, platform, buildId) {
return new URL(browser_data_js_1.downloadUrls[browser](platform, buildId, this.#baseUrl));
}
getExecutablePath(options) {
return browser_data_js_1.executablePathByBrowser[options.browser](options.platform, options.buildId);
}
getName() {
return 'DefaultProvider';
}
}
exports.DefaultProvider = DefaultProvider;
//# sourceMappingURL=DefaultProvider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DefaultProvider.js","sourceRoot":"","sources":["../../src/DefaultProvider.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,oEAGwC;AAGxC;;;;;GAKG;AACH,MAAa,eAAe;IAC1B,QAAQ,CAAU;IAElB,YAAY,OAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,QAAQ,CAAC,QAAyB;QAChC,yCAAyC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,cAAc,CAAC,OAAwB;QACrC,OAAO,IAAI,CAAC,eAAe,CACzB,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,OAAO,CAChB,CAAC;IACJ,CAAC;IAED,eAAe,CACb,OAAgB,EAChB,QAAyB,EACzB,OAAe;QAEf,OAAO,IAAI,GAAG,CAAC,8BAAY,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,iBAAiB,CAAC,OAIjB;QACC,OAAO,yCAAuB,CAAC,OAAO,CAAC,OAAO,CAAC,CAC7C,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,OAAO,CAChB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AA1CD,0CA0CC"}

View File

@@ -0,0 +1,7 @@
/**
* @license
* Copyright 2026 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
export {};
//# sourceMappingURL=DefaultProvider.spec.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DefaultProvider.spec.d.ts","sourceRoot":"","sources":["../../src/DefaultProvider.spec.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}

View File

@@ -0,0 +1,80 @@
"use strict";
/**
* @license
* Copyright 2026 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const node_assert_1 = __importDefault(require("node:assert"));
const main_js_1 = require("./main.js");
describe('DefaultProvider', () => {
let provider;
beforeEach(() => {
provider = new main_js_1.DefaultProvider();
});
describe('constructor', () => {
it('should create provider with default base URL', () => {
const defaultProvider = new main_js_1.DefaultProvider();
(0, node_assert_1.default)(defaultProvider instanceof main_js_1.DefaultProvider);
});
it('should create provider with custom base URL', () => {
const customBaseUrl = 'https://custom.example.com/';
const customProvider = new main_js_1.DefaultProvider(customBaseUrl);
(0, node_assert_1.default)(customProvider instanceof main_js_1.DefaultProvider);
});
});
describe('BrowserProvider interface compliance', () => {
it('should implement supports method', () => {
node_assert_1.default.strictEqual(typeof provider.supports, 'function');
});
it('should implement getDownloadUrl method', () => {
node_assert_1.default.strictEqual(typeof provider.getDownloadUrl, 'function');
});
it('should implement getExecutablePath method', () => {
node_assert_1.default.strictEqual(typeof provider.getExecutablePath, 'function');
});
});
describe('basic functionality', () => {
it('should handle different browsers', () => {
// Test with a known build ID that should exist
const result = provider.supports({
browser: main_js_1.Browser.CHROME,
platform: main_js_1.BrowserPlatform.LINUX,
buildId: '120.0.6099.109',
});
// Chrome for Testing supports all browsers
node_assert_1.default.strictEqual(result, true);
});
it('should handle different platforms', () => {
const result = provider.supports({
browser: main_js_1.Browser.CHROME,
platform: main_js_1.BrowserPlatform.MAC,
buildId: '120.0.6099.109',
});
// Chrome for Testing supports all platforms
node_assert_1.default.strictEqual(result, true);
});
it('should handle ChromeDriver', () => {
const result = provider.supports({
browser: main_js_1.Browser.CHROMEDRIVER,
platform: main_js_1.BrowserPlatform.LINUX,
buildId: '120.0.6099.109',
});
// Chrome for Testing supports all browsers
node_assert_1.default.strictEqual(result, true);
});
it('should return URL for valid build', () => {
const result = provider.getDownloadUrl({
browser: main_js_1.Browser.CHROME,
platform: main_js_1.BrowserPlatform.LINUX,
buildId: '120.0.6099.109',
});
(0, node_assert_1.default)(result instanceof URL);
(0, node_assert_1.default)(result.toString().includes('120.0.6099.109'));
});
});
});
//# sourceMappingURL=DefaultProvider.spec.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DefaultProvider.spec.js","sourceRoot":"","sources":["../../src/DefaultProvider.spec.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AAEH,8DAAiC;AAEjC,uCAAoE;AAEpE,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,QAAyB,CAAC;IAE9B,UAAU,CAAC,GAAG,EAAE;QACd,QAAQ,GAAG,IAAI,yBAAe,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;YACtD,MAAM,eAAe,GAAG,IAAI,yBAAe,EAAE,CAAC;YAC9C,IAAA,qBAAM,EAAC,eAAe,YAAY,yBAAe,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;YACrD,MAAM,aAAa,GAAG,6BAA6B,CAAC;YACpD,MAAM,cAAc,GAAG,IAAI,yBAAe,CAAC,aAAa,CAAC,CAAC;YAC1D,IAAA,qBAAM,EAAC,cAAc,YAAY,yBAAe,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;QACpD,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;YAC1C,qBAAM,CAAC,WAAW,CAAC,OAAO,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,qBAAM,CAAC,WAAW,CAAC,OAAO,QAAQ,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;YACnD,qBAAM,CAAC,WAAW,CAAC,OAAO,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACnC,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;YAC1C,+CAA+C;YAC/C,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC;gBAC/B,OAAO,EAAE,iBAAO,CAAC,MAAM;gBACvB,QAAQ,EAAE,yBAAe,CAAC,KAAK;gBAC/B,OAAO,EAAE,gBAAgB;aAC1B,CAAC,CAAC;YAEH,2CAA2C;YAC3C,qBAAM,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;YAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC;gBAC/B,OAAO,EAAE,iBAAO,CAAC,MAAM;gBACvB,QAAQ,EAAE,yBAAe,CAAC,GAAG;gBAC7B,OAAO,EAAE,gBAAgB;aAC1B,CAAC,CAAC;YAEH,4CAA4C;YAC5C,qBAAM,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;YACpC,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC;gBAC/B,OAAO,EAAE,iBAAO,CAAC,YAAY;gBAC7B,QAAQ,EAAE,yBAAe,CAAC,KAAK;gBAC/B,OAAO,EAAE,gBAAgB;aAC1B,CAAC,CAAC;YAEH,2CAA2C;YAC3C,qBAAM,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;YAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC;gBACrC,OAAO,EAAE,iBAAO,CAAC,MAAM;gBACvB,QAAQ,EAAE,yBAAe,CAAC,KAAK;gBAC/B,OAAO,EAAE,gBAAgB;aAC1B,CAAC,CAAC;YAEH,IAAA,qBAAM,EAAC,MAAM,YAAY,GAAG,CAAC,CAAC;YAC9B,IAAA,qBAAM,EAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}

View File

@@ -0,0 +1,77 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import * as chromeHeadlessShell from './chrome-headless-shell.js';
import * as chrome from './chrome.js';
import * as chromedriver from './chromedriver.js';
import * as chromium from './chromium.js';
import * as firefox from './firefox.js';
import { Browser, BrowserPlatform, BrowserTag, ChromeReleaseChannel, type ProfileOptions } from './types.js';
export type { ProfileOptions };
export declare const downloadUrls: {
chromedriver: typeof chromedriver.resolveDownloadUrl;
"chrome-headless-shell": typeof chromeHeadlessShell.resolveDownloadUrl;
chrome: typeof chrome.resolveDownloadUrl;
chromium: typeof chromium.resolveDownloadUrl;
firefox: typeof firefox.resolveDownloadUrl;
};
export declare const downloadPaths: {
chromedriver: typeof chromedriver.resolveDownloadPath;
"chrome-headless-shell": typeof chromeHeadlessShell.resolveDownloadPath;
chrome: typeof chrome.resolveDownloadPath;
chromium: typeof chromium.resolveDownloadPath;
firefox: typeof firefox.resolveDownloadPath;
};
export declare const executablePathByBrowser: {
chromedriver: typeof chromedriver.relativeExecutablePath;
"chrome-headless-shell": typeof chromeHeadlessShell.relativeExecutablePath;
chrome: typeof chrome.relativeExecutablePath;
chromium: typeof chromium.relativeExecutablePath;
firefox: typeof firefox.relativeExecutablePath;
};
export declare const versionComparators: {
chromedriver: typeof chromeHeadlessShell.compareVersions;
"chrome-headless-shell": typeof chromeHeadlessShell.compareVersions;
chrome: typeof chromeHeadlessShell.compareVersions;
chromium: typeof chromium.compareVersions;
firefox: typeof firefox.compareVersions;
};
export { Browser, BrowserPlatform, ChromeReleaseChannel };
/**
* @public
*/
export declare function resolveBuildId(browser: Browser, platform: BrowserPlatform, tag: string | BrowserTag): Promise<string>;
/**
* @public
*/
export declare function createProfile(browser: Browser, opts: ProfileOptions): Promise<void>;
/**
* @public
*
* Get's the first resolved system path
*/
export declare function resolveSystemExecutablePath(browser: Browser, platform: BrowserPlatform, channel: ChromeReleaseChannel): string;
/**
* Returns the expected default user data dir for the given channel. It does not
* check if the dir actually exists.
*
* @public
*/
export declare function resolveDefaultUserDataDir(browser: Browser, platform: BrowserPlatform, channel: ChromeReleaseChannel): string;
/**
* @internal
*
* Returns multiple paths where the executable may be located at on the current system
* ordered by likelihood (based on heuristics).
*/
export declare function resolveSystemExecutablePaths(browser: Browser, platform: BrowserPlatform, channel: ChromeReleaseChannel): [string, ...string[]];
/**
* Returns a version comparator for the given browser that can be used to sort
* browser versions.
*
* @public
*/
export declare function getVersionComparator(browser: Browser): (a: string, b: string) => number;
//# sourceMappingURL=browser-data.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"browser-data.d.ts","sourceRoot":"","sources":["../../../src/browser-data/browser-data.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,mBAAmB,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EACL,OAAO,EACP,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAC,cAAc,EAAC,CAAC;AAE7B,eAAO,MAAM,YAAY;;;;;;CAMxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;CAMzB,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;CAMnC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;CAM9B,CAAC;AAEF,OAAO,EAAC,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAC,CAAC;AA+GxD;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,GAAG,EAAE,MAAM,GAAG,UAAU,GACvB,OAAO,CAAC,MAAM,CAAC,CA+BjB;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CAYR;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CAYR;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAYvB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,GACf,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAElC"}

View File

@@ -0,0 +1,279 @@
"use strict";
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChromeReleaseChannel = exports.BrowserPlatform = exports.Browser = exports.versionComparators = exports.executablePathByBrowser = exports.downloadPaths = exports.downloadUrls = void 0;
exports.resolveBuildId = resolveBuildId;
exports.createProfile = createProfile;
exports.resolveSystemExecutablePath = resolveSystemExecutablePath;
exports.resolveDefaultUserDataDir = resolveDefaultUserDataDir;
exports.resolveSystemExecutablePaths = resolveSystemExecutablePaths;
exports.getVersionComparator = getVersionComparator;
const chromeHeadlessShell = __importStar(require("./chrome-headless-shell.js"));
const chrome = __importStar(require("./chrome.js"));
const chromedriver = __importStar(require("./chromedriver.js"));
const chromium = __importStar(require("./chromium.js"));
const firefox = __importStar(require("./firefox.js"));
const types_js_1 = require("./types.js");
Object.defineProperty(exports, "Browser", { enumerable: true, get: function () { return types_js_1.Browser; } });
Object.defineProperty(exports, "BrowserPlatform", { enumerable: true, get: function () { return types_js_1.BrowserPlatform; } });
Object.defineProperty(exports, "ChromeReleaseChannel", { enumerable: true, get: function () { return types_js_1.ChromeReleaseChannel; } });
exports.downloadUrls = {
[types_js_1.Browser.CHROMEDRIVER]: chromedriver.resolveDownloadUrl,
[types_js_1.Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.resolveDownloadUrl,
[types_js_1.Browser.CHROME]: chrome.resolveDownloadUrl,
[types_js_1.Browser.CHROMIUM]: chromium.resolveDownloadUrl,
[types_js_1.Browser.FIREFOX]: firefox.resolveDownloadUrl,
};
exports.downloadPaths = {
[types_js_1.Browser.CHROMEDRIVER]: chromedriver.resolveDownloadPath,
[types_js_1.Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.resolveDownloadPath,
[types_js_1.Browser.CHROME]: chrome.resolveDownloadPath,
[types_js_1.Browser.CHROMIUM]: chromium.resolveDownloadPath,
[types_js_1.Browser.FIREFOX]: firefox.resolveDownloadPath,
};
exports.executablePathByBrowser = {
[types_js_1.Browser.CHROMEDRIVER]: chromedriver.relativeExecutablePath,
[types_js_1.Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.relativeExecutablePath,
[types_js_1.Browser.CHROME]: chrome.relativeExecutablePath,
[types_js_1.Browser.CHROMIUM]: chromium.relativeExecutablePath,
[types_js_1.Browser.FIREFOX]: firefox.relativeExecutablePath,
};
exports.versionComparators = {
[types_js_1.Browser.CHROMEDRIVER]: chromedriver.compareVersions,
[types_js_1.Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.compareVersions,
[types_js_1.Browser.CHROME]: chrome.compareVersions,
[types_js_1.Browser.CHROMIUM]: chromium.compareVersions,
[types_js_1.Browser.FIREFOX]: firefox.compareVersions,
};
/**
* @internal
*/
async function resolveBuildIdForBrowserTag(browser, platform, tag) {
switch (browser) {
case types_js_1.Browser.FIREFOX:
switch (tag) {
case types_js_1.BrowserTag.LATEST:
return await firefox.resolveBuildId(firefox.FirefoxChannel.NIGHTLY);
case types_js_1.BrowserTag.BETA:
return await firefox.resolveBuildId(firefox.FirefoxChannel.BETA);
case types_js_1.BrowserTag.NIGHTLY:
return await firefox.resolveBuildId(firefox.FirefoxChannel.NIGHTLY);
case types_js_1.BrowserTag.DEVEDITION:
return await firefox.resolveBuildId(firefox.FirefoxChannel.DEVEDITION);
case types_js_1.BrowserTag.STABLE:
return await firefox.resolveBuildId(firefox.FirefoxChannel.STABLE);
case types_js_1.BrowserTag.ESR:
return await firefox.resolveBuildId(firefox.FirefoxChannel.ESR);
case types_js_1.BrowserTag.CANARY:
case types_js_1.BrowserTag.DEV:
throw new Error(`${tag.toUpperCase()} is not available for Firefox`);
}
case types_js_1.Browser.CHROME: {
switch (tag) {
case types_js_1.BrowserTag.LATEST:
return await chrome.resolveBuildId(types_js_1.ChromeReleaseChannel.CANARY);
case types_js_1.BrowserTag.BETA:
return await chrome.resolveBuildId(types_js_1.ChromeReleaseChannel.BETA);
case types_js_1.BrowserTag.CANARY:
return await chrome.resolveBuildId(types_js_1.ChromeReleaseChannel.CANARY);
case types_js_1.BrowserTag.DEV:
return await chrome.resolveBuildId(types_js_1.ChromeReleaseChannel.DEV);
case types_js_1.BrowserTag.STABLE:
return await chrome.resolveBuildId(types_js_1.ChromeReleaseChannel.STABLE);
case types_js_1.BrowserTag.NIGHTLY:
case types_js_1.BrowserTag.DEVEDITION:
case types_js_1.BrowserTag.ESR:
throw new Error(`${tag.toUpperCase()} is not available for Chrome`);
}
}
case types_js_1.Browser.CHROMEDRIVER: {
switch (tag) {
case types_js_1.BrowserTag.LATEST:
case types_js_1.BrowserTag.CANARY:
return await chromedriver.resolveBuildId(types_js_1.ChromeReleaseChannel.CANARY);
case types_js_1.BrowserTag.BETA:
return await chromedriver.resolveBuildId(types_js_1.ChromeReleaseChannel.BETA);
case types_js_1.BrowserTag.DEV:
return await chromedriver.resolveBuildId(types_js_1.ChromeReleaseChannel.DEV);
case types_js_1.BrowserTag.STABLE:
return await chromedriver.resolveBuildId(types_js_1.ChromeReleaseChannel.STABLE);
case types_js_1.BrowserTag.NIGHTLY:
case types_js_1.BrowserTag.DEVEDITION:
case types_js_1.BrowserTag.ESR:
throw new Error(`${tag.toUpperCase()} is not available for ChromeDriver`);
}
}
case types_js_1.Browser.CHROMEHEADLESSSHELL: {
switch (tag) {
case types_js_1.BrowserTag.LATEST:
case types_js_1.BrowserTag.CANARY:
return await chromeHeadlessShell.resolveBuildId(types_js_1.ChromeReleaseChannel.CANARY);
case types_js_1.BrowserTag.BETA:
return await chromeHeadlessShell.resolveBuildId(types_js_1.ChromeReleaseChannel.BETA);
case types_js_1.BrowserTag.DEV:
return await chromeHeadlessShell.resolveBuildId(types_js_1.ChromeReleaseChannel.DEV);
case types_js_1.BrowserTag.STABLE:
return await chromeHeadlessShell.resolveBuildId(types_js_1.ChromeReleaseChannel.STABLE);
case types_js_1.BrowserTag.NIGHTLY:
case types_js_1.BrowserTag.DEVEDITION:
case types_js_1.BrowserTag.ESR:
throw new Error(`${tag} is not available for chrome-headless-shell`);
}
}
case types_js_1.Browser.CHROMIUM:
switch (tag) {
case types_js_1.BrowserTag.LATEST:
return await chromium.resolveBuildId(platform);
case types_js_1.BrowserTag.NIGHTLY:
case types_js_1.BrowserTag.CANARY:
case types_js_1.BrowserTag.DEV:
case types_js_1.BrowserTag.DEVEDITION:
case types_js_1.BrowserTag.BETA:
case types_js_1.BrowserTag.STABLE:
case types_js_1.BrowserTag.ESR:
throw new Error(`${tag} is not supported for Chromium. Use 'latest' instead.`);
}
}
}
/**
* @public
*/
async function resolveBuildId(browser, platform, tag) {
const browserTag = tag;
if (Object.values(types_js_1.BrowserTag).includes(browserTag)) {
return await resolveBuildIdForBrowserTag(browser, platform, browserTag);
}
switch (browser) {
case types_js_1.Browser.FIREFOX:
return tag;
case types_js_1.Browser.CHROME:
const chromeResult = await chrome.resolveBuildId(tag);
if (chromeResult) {
return chromeResult;
}
return tag;
case types_js_1.Browser.CHROMEDRIVER:
const chromeDriverResult = await chromedriver.resolveBuildId(tag);
if (chromeDriverResult) {
return chromeDriverResult;
}
return tag;
case types_js_1.Browser.CHROMEHEADLESSSHELL:
const chromeHeadlessShellResult = await chromeHeadlessShell.resolveBuildId(tag);
if (chromeHeadlessShellResult) {
return chromeHeadlessShellResult;
}
return tag;
case types_js_1.Browser.CHROMIUM:
return tag;
}
}
/**
* @public
*/
async function createProfile(browser, opts) {
switch (browser) {
case types_js_1.Browser.FIREFOX:
return await firefox.createProfile(opts);
case types_js_1.Browser.CHROME:
case types_js_1.Browser.CHROMIUM:
throw new Error(`Profile creation is not support for ${browser} yet`);
}
}
/**
* @public
*
* Get's the first resolved system path
*/
function resolveSystemExecutablePath(browser, platform, channel) {
switch (browser) {
case types_js_1.Browser.CHROMEDRIVER:
case types_js_1.Browser.CHROMEHEADLESSSHELL:
case types_js_1.Browser.FIREFOX:
case types_js_1.Browser.CHROMIUM:
throw new Error(`System browser detection is not supported for ${browser} yet.`);
case types_js_1.Browser.CHROME:
return chrome.resolveSystemExecutablePaths(platform, channel)[0];
}
}
/**
* Returns the expected default user data dir for the given channel. It does not
* check if the dir actually exists.
*
* @public
*/
function resolveDefaultUserDataDir(browser, platform, channel) {
switch (browser) {
case types_js_1.Browser.CHROMEDRIVER:
case types_js_1.Browser.CHROMEHEADLESSSHELL:
case types_js_1.Browser.FIREFOX:
case types_js_1.Browser.CHROMIUM:
throw new Error(`Default user dir detection is not supported for ${browser} yet.`);
case types_js_1.Browser.CHROME:
return chrome.resolveDefaultUserDataDir(platform, channel);
}
}
/**
* @internal
*
* Returns multiple paths where the executable may be located at on the current system
* ordered by likelihood (based on heuristics).
*/
function resolveSystemExecutablePaths(browser, platform, channel) {
switch (browser) {
case types_js_1.Browser.CHROMEDRIVER:
case types_js_1.Browser.CHROMEHEADLESSSHELL:
case types_js_1.Browser.FIREFOX:
case types_js_1.Browser.CHROMIUM:
throw new Error(`System browser detection is not supported for ${browser} yet.`);
case types_js_1.Browser.CHROME:
return chrome.resolveSystemExecutablePaths(platform, channel);
}
}
/**
* Returns a version comparator for the given browser that can be used to sort
* browser versions.
*
* @public
*/
function getVersionComparator(browser) {
return exports.versionComparators[browser];
}
//# sourceMappingURL=browser-data.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
import { BrowserPlatform } from './types.js';
export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;
export { resolveBuildId, compareVersions } from './chrome.js';
//# sourceMappingURL=chrome-headless-shell.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"chrome-headless-shell.d.ts","sourceRoot":"","sources":["../../../src/browser-data/chrome-headless-shell.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAkB3C,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,SAA6D,GACnE,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAMV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,GACf,MAAM,CAqBR;AAED,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,aAAa,CAAC"}

View File

@@ -0,0 +1,58 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.compareVersions = exports.resolveBuildId = void 0;
exports.resolveDownloadUrl = resolveDownloadUrl;
exports.resolveDownloadPath = resolveDownloadPath;
exports.relativeExecutablePath = relativeExecutablePath;
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
const node_path_1 = __importDefault(require("node:path"));
const types_js_1 = require("./types.js");
function folder(platform) {
switch (platform) {
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
return 'linux64';
case types_js_1.BrowserPlatform.MAC_ARM:
return 'mac-arm64';
case types_js_1.BrowserPlatform.MAC:
return 'mac-x64';
case types_js_1.BrowserPlatform.WIN32:
return 'win32';
case types_js_1.BrowserPlatform.WIN64:
return 'win64';
}
}
function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public') {
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
}
function resolveDownloadPath(platform, buildId) {
return [
buildId,
folder(platform),
`chrome-headless-shell-${folder(platform)}.zip`,
];
}
function relativeExecutablePath(platform, _buildId) {
switch (platform) {
case types_js_1.BrowserPlatform.MAC:
case types_js_1.BrowserPlatform.MAC_ARM:
return node_path_1.default.join('chrome-headless-shell-' + folder(platform), 'chrome-headless-shell');
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
return node_path_1.default.join('chrome-headless-shell-linux64', 'chrome-headless-shell');
case types_js_1.BrowserPlatform.WIN32:
case types_js_1.BrowserPlatform.WIN64:
return node_path_1.default.join('chrome-headless-shell-' + folder(platform), 'chrome-headless-shell.exe');
}
}
var chrome_js_1 = require("./chrome.js");
Object.defineProperty(exports, "resolveBuildId", { enumerable: true, get: function () { return chrome_js_1.resolveBuildId; } });
Object.defineProperty(exports, "compareVersions", { enumerable: true, get: function () { return chrome_js_1.compareVersions; } });
//# sourceMappingURL=chrome-headless-shell.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"chrome-headless-shell.js","sourceRoot":"","sources":["../../../src/browser-data/chrome-headless-shell.ts"],"names":[],"mappings":";;;;;;AAyBA,gDAMC;AAED,kDASC;AAED,wDAwBC;AApED;;;;GAIG;AACH,0DAA6B;AAE7B,yCAA2C;AAE3C,SAAS,MAAM,CAAC,QAAyB;IACvC,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,SAAS,CAAC;QACnB,KAAK,0BAAe,CAAC,OAAO;YAC1B,OAAO,WAAW,CAAC;QACrB,KAAK,0BAAe,CAAC,GAAG;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,OAAO,CAAC;QACjB,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAgB,kBAAkB,CAChC,QAAyB,EACzB,OAAe,EACf,OAAO,GAAG,0DAA0D;IAEpE,OAAO,GAAG,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,SAAgB,mBAAmB,CACjC,QAAyB,EACzB,OAAe;IAEf,OAAO;QACL,OAAO;QACP,MAAM,CAAC,QAAQ,CAAC;QAChB,yBAAyB,MAAM,CAAC,QAAQ,CAAC,MAAM;KAChD,CAAC;AACJ,CAAC;AAED,SAAgB,sBAAsB,CACpC,QAAyB,EACzB,QAAgB;IAEhB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,GAAG,CAAC;QACzB,KAAK,0BAAe,CAAC,OAAO;YAC1B,OAAO,mBAAI,CAAC,IAAI,CACd,wBAAwB,GAAG,MAAM,CAAC,QAAQ,CAAC,EAC3C,uBAAuB,CACxB,CAAC;QACJ,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,mBAAI,CAAC,IAAI,CACd,+BAA+B,EAC/B,uBAAuB,CACxB,CAAC;QACJ,KAAK,0BAAe,CAAC,KAAK,CAAC;QAC3B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,mBAAI,CAAC,IAAI,CACd,wBAAwB,GAAG,MAAM,CAAC,QAAQ,CAAC,EAC3C,2BAA2B,CAC5B,CAAC;IACN,CAAC;AACH,CAAC;AAED,yCAA4D;AAApD,2GAAA,cAAc,OAAA;AAAE,4GAAA,eAAe,OAAA"}

View File

@@ -0,0 +1,33 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import { BrowserPlatform, ChromeReleaseChannel } from './types.js';
export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;
export declare function changeBaseVersionUrlForTesting(url: string): void;
export declare function resetBaseVersionUrlForTesting(): void;
export declare function getLastKnownGoodReleaseForChannel(channel: ChromeReleaseChannel): Promise<{
version: string;
revision: string;
}>;
export declare function getLastKnownGoodReleaseForMilestone(milestone: string): Promise<{
version: string;
revision: string;
} | undefined>;
export declare function getLastKnownGoodReleaseForBuild(
/**
* @example `112.0.23`,
*/
buildPrefix: string): Promise<{
version: string;
revision: string;
} | undefined>;
export declare function resolveBuildId(channel: ChromeReleaseChannel): Promise<string>;
export declare function resolveBuildId(channel: string): Promise<string | undefined>;
export declare function resolveSystemExecutablePaths(platform: BrowserPlatform, channel: ChromeReleaseChannel): [string, ...string[]];
export declare function resolveDefaultUserDataDir(platform: BrowserPlatform, channel: ChromeReleaseChannel): string;
export declare function compareVersions(a: string, b: string): number;
//# sourceMappingURL=chrome.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../../src/browser-data/chrome.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAC,MAAM,YAAY,CAAC;AAkBjE,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,SAA6D,GACnE,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAEV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,GACf,MAAM,CAkBR;AAID,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEhE;AACD,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD;AAED,wBAAsB,iCAAiC,CACrD,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAAC,CAoB9C;AAED,wBAAsB,mCAAmC,CACvD,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,GAAG,SAAS,CAAC,CAS1D;AAED,wBAAsB,+BAA+B;AACnD;;GAEG;AACH,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,GAAG,SAAS,CAAC,CAS1D;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAAC;AACnB,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AA2I/B,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAyCvB;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CA8DR;AAoBD,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAc5D"}

View File

@@ -0,0 +1,313 @@
"use strict";
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveDownloadUrl = resolveDownloadUrl;
exports.resolveDownloadPath = resolveDownloadPath;
exports.relativeExecutablePath = relativeExecutablePath;
exports.changeBaseVersionUrlForTesting = changeBaseVersionUrlForTesting;
exports.resetBaseVersionUrlForTesting = resetBaseVersionUrlForTesting;
exports.getLastKnownGoodReleaseForChannel = getLastKnownGoodReleaseForChannel;
exports.getLastKnownGoodReleaseForMilestone = getLastKnownGoodReleaseForMilestone;
exports.getLastKnownGoodReleaseForBuild = getLastKnownGoodReleaseForBuild;
exports.resolveBuildId = resolveBuildId;
exports.resolveSystemExecutablePaths = resolveSystemExecutablePaths;
exports.resolveDefaultUserDataDir = resolveDefaultUserDataDir;
exports.compareVersions = compareVersions;
const node_child_process_1 = require("node:child_process");
const node_os_1 = __importDefault(require("node:os"));
const node_path_1 = __importDefault(require("node:path"));
const semver_1 = __importDefault(require("semver"));
const httpUtil_js_1 = require("../httpUtil.js");
const types_js_1 = require("./types.js");
function folder(platform) {
switch (platform) {
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
return 'linux64';
case types_js_1.BrowserPlatform.MAC_ARM:
return 'mac-arm64';
case types_js_1.BrowserPlatform.MAC:
return 'mac-x64';
case types_js_1.BrowserPlatform.WIN32:
return 'win32';
case types_js_1.BrowserPlatform.WIN64:
return 'win64';
}
}
function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public') {
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
}
function resolveDownloadPath(platform, buildId) {
return [buildId, folder(platform), `chrome-${folder(platform)}.zip`];
}
function relativeExecutablePath(platform, _buildId) {
switch (platform) {
case types_js_1.BrowserPlatform.MAC:
case types_js_1.BrowserPlatform.MAC_ARM:
return node_path_1.default.join('chrome-' + folder(platform), 'Google Chrome for Testing.app', 'Contents', 'MacOS', 'Google Chrome for Testing');
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
return node_path_1.default.join('chrome-linux64', 'chrome');
case types_js_1.BrowserPlatform.WIN32:
case types_js_1.BrowserPlatform.WIN64:
return node_path_1.default.join('chrome-' + folder(platform), 'chrome.exe');
}
}
let baseVersionUrl = 'https://googlechromelabs.github.io/chrome-for-testing';
function changeBaseVersionUrlForTesting(url) {
baseVersionUrl = url;
}
function resetBaseVersionUrlForTesting() {
baseVersionUrl = 'https://googlechromelabs.github.io/chrome-for-testing';
}
async function getLastKnownGoodReleaseForChannel(channel) {
const data = (await (0, httpUtil_js_1.getJSON)(new URL(`${baseVersionUrl}/last-known-good-versions.json`)));
for (const channel of Object.keys(data.channels)) {
data.channels[channel.toLowerCase()] = data.channels[channel];
delete data.channels[channel];
}
return data.channels[channel];
}
async function getLastKnownGoodReleaseForMilestone(milestone) {
const data = (await (0, httpUtil_js_1.getJSON)(new URL(`${baseVersionUrl}/latest-versions-per-milestone.json`)));
return data.milestones[milestone];
}
async function getLastKnownGoodReleaseForBuild(
/**
* @example `112.0.23`,
*/
buildPrefix) {
const data = (await (0, httpUtil_js_1.getJSON)(new URL(`${baseVersionUrl}/latest-patch-versions-per-build.json`)));
return data.builds[buildPrefix];
}
async function resolveBuildId(channel) {
if (Object.values(types_js_1.ChromeReleaseChannel).includes(channel)) {
return (await getLastKnownGoodReleaseForChannel(channel)).version;
}
if (channel.match(/^\d+$/)) {
// Potentially a milestone.
return (await getLastKnownGoodReleaseForMilestone(channel))?.version;
}
if (channel.match(/^\d+\.\d+\.\d+$/)) {
// Potentially a build prefix without the patch version.
return (await getLastKnownGoodReleaseForBuild(channel))?.version;
}
return;
}
const WINDOWS_ENV_PARAM_NAMES = [
'PROGRAMFILES',
'ProgramW6432',
'ProgramFiles(x86)',
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/installer/mini_installer/README.md
'LOCALAPPDATA',
];
function getChromeWindowsLocation(channel, locationsPrefixes) {
if (locationsPrefixes.size === 0) {
throw new Error('Non of the common Windows Env variables were set');
}
let suffix;
switch (channel) {
case types_js_1.ChromeReleaseChannel.STABLE:
suffix = 'Google\\Chrome\\Application\\chrome.exe';
break;
case types_js_1.ChromeReleaseChannel.BETA:
suffix = 'Google\\Chrome Beta\\Application\\chrome.exe';
break;
case types_js_1.ChromeReleaseChannel.CANARY:
suffix = 'Google\\Chrome SxS\\Application\\chrome.exe';
break;
case types_js_1.ChromeReleaseChannel.DEV:
suffix = 'Google\\Chrome Dev\\Application\\chrome.exe';
break;
}
return [...locationsPrefixes.values()].map(l => {
return node_path_1.default.win32.join(l, suffix);
});
}
function getWslVariable(variable) {
try {
// The Windows env for the paths are not passed down
// to WSL, so we evoke `cmd.exe` which is usually on the PATH
// from which the env can be access with all uppercase names.
// The return value is a Windows Path - `C:\Program Files`.
const result = (0, node_child_process_1.execSync)(`cmd.exe /c echo %${variable.toLocaleUpperCase()}%`, {
// We need to ignore the stderr as cmd.exe
// prints a message about wrong UNC path not supported.
stdio: ['ignore', 'pipe', 'ignore'],
encoding: 'utf-8',
}).trim();
if (result) {
return result;
}
}
catch { }
return;
}
function getWslLocation(channel) {
const wslVersion = (0, node_child_process_1.execSync)('wslinfo --version', {
stdio: ['ignore', 'pipe', 'ignore'],
encoding: 'utf-8',
}).trim();
if (!wslVersion) {
throw new Error('Not in WSL or unsupported version of WSL.');
}
const wslPrefixes = new Set();
for (const name of WINDOWS_ENV_PARAM_NAMES) {
const wslPrefix = getWslVariable(name);
if (wslPrefix) {
wslPrefixes.add(wslPrefix);
}
}
const windowsPath = getChromeWindowsLocation(channel, wslPrefixes);
return windowsPath.map(path => {
// The above command returned the Windows paths `C:\Program Files\...\chrome.exe`
// Use the `wslpath` utility tool to transform into the mounted disk
return (0, node_child_process_1.execSync)(`wslpath "${path}"`).toString().trim();
});
}
function getChromeLinuxOrWslLocation(channel) {
const locations = [];
switch (channel) {
case types_js_1.ChromeReleaseChannel.STABLE:
locations.push('/opt/google/chrome/chrome');
break;
case types_js_1.ChromeReleaseChannel.BETA:
locations.push('/opt/google/chrome-beta/chrome');
break;
case types_js_1.ChromeReleaseChannel.CANARY:
locations.push('/opt/google/chrome-canary/chrome');
break;
case types_js_1.ChromeReleaseChannel.DEV:
locations.push('/opt/google/chrome-unstable/chrome');
break;
}
try {
const wslPath = getWslLocation(channel);
if (wslPath) {
locations.push(...wslPath);
}
}
catch {
// Ignore WSL errors
}
return locations;
}
function resolveSystemExecutablePaths(platform, channel) {
switch (platform) {
case types_js_1.BrowserPlatform.WIN64:
case types_js_1.BrowserPlatform.WIN32:
const prefixLocation = new Set(WINDOWS_ENV_PARAM_NAMES.map(name => {
return process.env[name];
}).filter((l) => {
return !!l;
}));
// Fallbacks in case env vars are misconfigured.
prefixLocation.add('C:\\Program Files');
prefixLocation.add('C:\\Program Files (x86)');
prefixLocation.add('D:\\Program Files');
prefixLocation.add('D:\\Program Files (x86)');
return getChromeWindowsLocation(channel, prefixLocation);
case types_js_1.BrowserPlatform.MAC_ARM:
case types_js_1.BrowserPlatform.MAC:
switch (channel) {
case types_js_1.ChromeReleaseChannel.STABLE:
return [
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
];
case types_js_1.ChromeReleaseChannel.BETA:
return [
'/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta',
];
case types_js_1.ChromeReleaseChannel.CANARY:
return [
'/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary',
];
case types_js_1.ChromeReleaseChannel.DEV:
return [
'/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev',
];
}
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
return getChromeLinuxOrWslLocation(channel);
}
}
function resolveDefaultUserDataDir(platform, channel) {
switch (platform) {
case types_js_1.BrowserPlatform.WIN64:
case types_js_1.BrowserPlatform.WIN32:
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_paths_win.cc;l=42;drc=4c86c7940a47c36b8bf52c134483ef2da86caa62
switch (channel) {
case types_js_1.ChromeReleaseChannel.STABLE:
return node_path_1.default.join(getLocalAppDataWin(), 'Google', 'Chrome', 'User Data');
case types_js_1.ChromeReleaseChannel.BETA:
return node_path_1.default.join(getLocalAppDataWin(), 'Google', 'Chrome Beta', 'User Data');
case types_js_1.ChromeReleaseChannel.CANARY:
return node_path_1.default.join(getLocalAppDataWin(), 'Google', 'Chrome SxS', 'User Data');
case types_js_1.ChromeReleaseChannel.DEV:
return node_path_1.default.join(getLocalAppDataWin(), 'Google', 'Chrome Dev', 'User Data');
}
case types_js_1.BrowserPlatform.MAC_ARM:
case types_js_1.BrowserPlatform.MAC:
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_paths_mac.mm;l=86;drc=4c86c7940a47c36b8bf52c134483ef2da86caa62
switch (channel) {
case types_js_1.ChromeReleaseChannel.STABLE:
return node_path_1.default.join(getBaseUserDataDirPathMac(), 'Chrome');
case types_js_1.ChromeReleaseChannel.BETA:
return node_path_1.default.join(getBaseUserDataDirPathMac(), 'Chrome Beta');
case types_js_1.ChromeReleaseChannel.DEV:
return node_path_1.default.join(getBaseUserDataDirPathMac(), 'Chrome Dev');
case types_js_1.ChromeReleaseChannel.CANARY:
return node_path_1.default.join(getBaseUserDataDirPathMac(), 'Chrome Canary');
}
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_paths_linux.cc;l=80;drc=4c86c7940a47c36b8bf52c134483ef2da86caa62
switch (channel) {
case types_js_1.ChromeReleaseChannel.STABLE:
return node_path_1.default.join(getConfigHomeLinux(), 'google-chrome');
case types_js_1.ChromeReleaseChannel.BETA:
return node_path_1.default.join(getConfigHomeLinux(), 'google-chrome-beta');
case types_js_1.ChromeReleaseChannel.CANARY:
return node_path_1.default.join(getConfigHomeLinux(), 'google-chrome-canary');
case types_js_1.ChromeReleaseChannel.DEV:
return node_path_1.default.join(getConfigHomeLinux(), 'google-chrome-unstable');
}
}
}
function getLocalAppDataWin() {
return (process.env['LOCALAPPDATA'] || node_path_1.default.join(node_os_1.default.homedir(), 'AppData', 'Local'));
}
function getConfigHomeLinux() {
return (process.env['CHROME_CONFIG_HOME'] ||
process.env['XDG_CONFIG_HOME'] ||
node_path_1.default.join(node_os_1.default.homedir(), '.config'));
}
function getBaseUserDataDirPathMac() {
return node_path_1.default.join(node_os_1.default.homedir(), 'Library', 'Application Support', 'Google');
}
function compareVersions(a, b) {
if (!semver_1.default.valid(a)) {
throw new Error(`Version ${a} is not a valid semver version`);
}
if (!semver_1.default.valid(b)) {
throw new Error(`Version ${b} is not a valid semver version`);
}
if (semver_1.default.gt(a, b)) {
return 1;
}
else if (semver_1.default.lt(a, b)) {
return -1;
}
else {
return 0;
}
}
//# sourceMappingURL=chrome.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
import { BrowserPlatform } from './types.js';
export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;
export { resolveBuildId, compareVersions } from './chrome.js';
//# sourceMappingURL=chromedriver.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"chromedriver.d.ts","sourceRoot":"","sources":["../../../src/browser-data/chromedriver.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAkB3C,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,SAA6D,GACnE,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAEV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,GACf,MAAM,CAYR;AAED,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,aAAa,CAAC"}

View File

@@ -0,0 +1,54 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.compareVersions = exports.resolveBuildId = void 0;
exports.resolveDownloadUrl = resolveDownloadUrl;
exports.resolveDownloadPath = resolveDownloadPath;
exports.relativeExecutablePath = relativeExecutablePath;
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
const node_path_1 = __importDefault(require("node:path"));
const types_js_1 = require("./types.js");
function folder(platform) {
switch (platform) {
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
return 'linux64';
case types_js_1.BrowserPlatform.MAC_ARM:
return 'mac-arm64';
case types_js_1.BrowserPlatform.MAC:
return 'mac-x64';
case types_js_1.BrowserPlatform.WIN32:
return 'win32';
case types_js_1.BrowserPlatform.WIN64:
return 'win64';
}
}
function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public') {
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
}
function resolveDownloadPath(platform, buildId) {
return [buildId, folder(platform), `chromedriver-${folder(platform)}.zip`];
}
function relativeExecutablePath(platform, _buildId) {
switch (platform) {
case types_js_1.BrowserPlatform.MAC:
case types_js_1.BrowserPlatform.MAC_ARM:
return node_path_1.default.join('chromedriver-' + folder(platform), 'chromedriver');
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
return node_path_1.default.join('chromedriver-linux64', 'chromedriver');
case types_js_1.BrowserPlatform.WIN32:
case types_js_1.BrowserPlatform.WIN64:
return node_path_1.default.join('chromedriver-' + folder(platform), 'chromedriver.exe');
}
}
var chrome_js_1 = require("./chrome.js");
Object.defineProperty(exports, "resolveBuildId", { enumerable: true, get: function () { return chrome_js_1.resolveBuildId; } });
Object.defineProperty(exports, "compareVersions", { enumerable: true, get: function () { return chrome_js_1.compareVersions; } });
//# sourceMappingURL=chromedriver.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"chromedriver.js","sourceRoot":"","sources":["../../../src/browser-data/chromedriver.ts"],"names":[],"mappings":";;;;;;AAyBA,gDAMC;AAED,kDAKC;AAED,wDAeC;AAvDD;;;;GAIG;AACH,0DAA6B;AAE7B,yCAA2C;AAE3C,SAAS,MAAM,CAAC,QAAyB;IACvC,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,SAAS,CAAC;QACnB,KAAK,0BAAe,CAAC,OAAO;YAC1B,OAAO,WAAW,CAAC;QACrB,KAAK,0BAAe,CAAC,GAAG;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,OAAO,CAAC;QACjB,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAgB,kBAAkB,CAChC,QAAyB,EACzB,OAAe,EACf,OAAO,GAAG,0DAA0D;IAEpE,OAAO,GAAG,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,SAAgB,mBAAmB,CACjC,QAAyB,EACzB,OAAe;IAEf,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,gBAAgB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC7E,CAAC;AAED,SAAgB,sBAAsB,CACpC,QAAyB,EACzB,QAAgB;IAEhB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,GAAG,CAAC;QACzB,KAAK,0BAAe,CAAC,OAAO;YAC1B,OAAO,mBAAI,CAAC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,CAAC;QACvE,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,mBAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;QAC3D,KAAK,0BAAe,CAAC,KAAK,CAAC;QAC3B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,mBAAI,CAAC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AAED,yCAA4D;AAApD,2GAAA,cAAc,OAAA;AAAE,4GAAA,eAAe,OAAA"}

View File

@@ -0,0 +1,12 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import { BrowserPlatform } from './types.js';
export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;
export declare function resolveBuildId(platform: BrowserPlatform): Promise<string>;
export declare function compareVersions(a: string, b: string): number;
//# sourceMappingURL=chromium.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"chromium.d.ts","sourceRoot":"","sources":["../../../src/browser-data/chromium.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAiC3C,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,SAA8D,GACpE,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAEV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,GACf,MAAM,CAkBR;AACD,wBAAsB,cAAc,CAClC,QAAQ,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D"}

View File

@@ -0,0 +1,73 @@
"use strict";
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveDownloadUrl = resolveDownloadUrl;
exports.resolveDownloadPath = resolveDownloadPath;
exports.relativeExecutablePath = relativeExecutablePath;
exports.resolveBuildId = resolveBuildId;
exports.compareVersions = compareVersions;
const node_path_1 = __importDefault(require("node:path"));
const httpUtil_js_1 = require("../httpUtil.js");
const types_js_1 = require("./types.js");
function archive(platform, buildId) {
switch (platform) {
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
return 'chrome-linux';
case types_js_1.BrowserPlatform.MAC_ARM:
case types_js_1.BrowserPlatform.MAC:
return 'chrome-mac';
case types_js_1.BrowserPlatform.WIN32:
case types_js_1.BrowserPlatform.WIN64:
// Windows archive name changed at r591479.
return parseInt(buildId, 10) > 591479 ? 'chrome-win' : 'chrome-win32';
}
}
function folder(platform) {
switch (platform) {
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
return 'Linux_x64';
case types_js_1.BrowserPlatform.MAC_ARM:
return 'Mac_Arm';
case types_js_1.BrowserPlatform.MAC:
return 'Mac';
case types_js_1.BrowserPlatform.WIN32:
return 'Win';
case types_js_1.BrowserPlatform.WIN64:
return 'Win_x64';
}
}
function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chromium-browser-snapshots') {
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
}
function resolveDownloadPath(platform, buildId) {
return [folder(platform), buildId, `${archive(platform, buildId)}.zip`];
}
function relativeExecutablePath(platform, _buildId) {
switch (platform) {
case types_js_1.BrowserPlatform.MAC:
case types_js_1.BrowserPlatform.MAC_ARM:
return node_path_1.default.join('chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium');
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
return node_path_1.default.join('chrome-linux', 'chrome');
case types_js_1.BrowserPlatform.WIN32:
case types_js_1.BrowserPlatform.WIN64:
return node_path_1.default.join('chrome-win', 'chrome.exe');
}
}
async function resolveBuildId(platform) {
return await (0, httpUtil_js_1.getText)(new URL(`https://storage.googleapis.com/chromium-browser-snapshots/${folder(platform)}/LAST_CHANGE`));
}
function compareVersions(a, b) {
return Number(a) - Number(b);
}
//# sourceMappingURL=chromium.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"chromium.js","sourceRoot":"","sources":["../../../src/browser-data/chromium.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AAuCH,gDAMC;AAED,kDAKC;AAED,wDAqBC;AACD,wCAUC;AAED,0CAEC;AAxFD,0DAA6B;AAE7B,gDAAuC;AAEvC,yCAA2C;AAE3C,SAAS,OAAO,CAAC,QAAyB,EAAE,OAAe;IACzD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,cAAc,CAAC;QACxB,KAAK,0BAAe,CAAC,OAAO,CAAC;QAC7B,KAAK,0BAAe,CAAC,GAAG;YACtB,OAAO,YAAY,CAAC;QACtB,KAAK,0BAAe,CAAC,KAAK,CAAC;QAC3B,KAAK,0BAAe,CAAC,KAAK;YACxB,2CAA2C;YAC3C,OAAO,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC;IAC1E,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,QAAyB;IACvC,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,WAAW,CAAC;QACrB,KAAK,0BAAe,CAAC,OAAO;YAC1B,OAAO,SAAS,CAAC;QACnB,KAAK,0BAAe,CAAC,GAAG;YACtB,OAAO,KAAK,CAAC;QACf,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,KAAK,CAAC;QACf,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,SAAgB,kBAAkB,CAChC,QAAyB,EACzB,OAAe,EACf,OAAO,GAAG,2DAA2D;IAErE,OAAO,GAAG,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,SAAgB,mBAAmB,CACjC,QAAyB,EACzB,OAAe;IAEf,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC1E,CAAC;AAED,SAAgB,sBAAsB,CACpC,QAAyB,EACzB,QAAgB;IAEhB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,GAAG,CAAC;QACzB,KAAK,0BAAe,CAAC,OAAO;YAC1B,OAAO,mBAAI,CAAC,IAAI,CACd,YAAY,EACZ,cAAc,EACd,UAAU,EACV,OAAO,EACP,UAAU,CACX,CAAC;QACJ,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,mBAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;QAC7C,KAAK,0BAAe,CAAC,KAAK,CAAC;QAC3B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,mBAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;AACH,CAAC;AACM,KAAK,UAAU,cAAc,CAClC,QAAyB;IAEzB,OAAO,MAAM,IAAA,qBAAO,EAClB,IAAI,GAAG,CACL,6DAA6D,MAAM,CACjE,QAAQ,CACT,cAAc,CAChB,CACF,CAAC;AACJ,CAAC;AAED,SAAgB,eAAe,CAAC,CAAS,EAAE,CAAS;IAClD,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC"}

View File

@@ -0,0 +1,22 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import { BrowserPlatform, type ProfileOptions } from './types.js';
export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
export declare function relativeExecutablePath(platform: BrowserPlatform, buildId: string): string;
export declare enum FirefoxChannel {
STABLE = "stable",
ESR = "esr",
DEVEDITION = "devedition",
BETA = "beta",
NIGHTLY = "nightly"
}
export declare function changeBaseVersionUrlForTesting(url: string): void;
export declare function resetBaseVersionUrlForTesting(): void;
export declare function resolveBuildId(channel?: FirefoxChannel): Promise<string>;
export declare function createProfile(options: ProfileOptions): Promise<void>;
export declare function compareVersions(a: string, b: string): number;
//# sourceMappingURL=firefox.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"firefox.d.ts","sourceRoot":"","sources":["../../../src/browser-data/firefox.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,EAAC,eAAe,EAAE,KAAK,cAAc,EAAC,MAAM,YAAY,CAAC;AA8DhE,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAiBR;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAgBV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,CAoCR;AAED,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAID,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEhE;AAED,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD;AAED,wBAAsB,cAAc,CAClC,OAAO,GAAE,cAAuC,GAC/C,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAa1E;AAgQD,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAG5D"}

View File

@@ -0,0 +1,388 @@
"use strict";
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FirefoxChannel = void 0;
exports.resolveDownloadUrl = resolveDownloadUrl;
exports.resolveDownloadPath = resolveDownloadPath;
exports.relativeExecutablePath = relativeExecutablePath;
exports.changeBaseVersionUrlForTesting = changeBaseVersionUrlForTesting;
exports.resetBaseVersionUrlForTesting = resetBaseVersionUrlForTesting;
exports.resolveBuildId = resolveBuildId;
exports.createProfile = createProfile;
exports.compareVersions = compareVersions;
const node_fs_1 = __importDefault(require("node:fs"));
const node_path_1 = __importDefault(require("node:path"));
const httpUtil_js_1 = require("../httpUtil.js");
const types_js_1 = require("./types.js");
function getFormat(buildId) {
const majorVersion = Number(buildId.split('.').shift());
return majorVersion >= 135 ? 'xz' : 'bz2';
}
function archiveNightly(platform, buildId) {
switch (platform) {
case types_js_1.BrowserPlatform.LINUX:
return `firefox-${buildId}.en-US.linux-x86_64.tar.${getFormat(buildId)}`;
case types_js_1.BrowserPlatform.LINUX_ARM:
return `firefox-${buildId}.en-US.linux-aarch64.tar.${getFormat(buildId)}`;
case types_js_1.BrowserPlatform.MAC_ARM:
case types_js_1.BrowserPlatform.MAC:
return `firefox-${buildId}.en-US.mac.dmg`;
case types_js_1.BrowserPlatform.WIN32:
case types_js_1.BrowserPlatform.WIN64:
return `firefox-${buildId}.en-US.${platform}.zip`;
}
}
function archive(platform, buildId) {
switch (platform) {
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
return `firefox-${buildId}.tar.${getFormat(buildId)}`;
case types_js_1.BrowserPlatform.MAC_ARM:
case types_js_1.BrowserPlatform.MAC:
return `Firefox ${buildId}.dmg`;
case types_js_1.BrowserPlatform.WIN32:
case types_js_1.BrowserPlatform.WIN64:
return `Firefox Setup ${buildId}.exe`;
}
}
function platformName(platform) {
switch (platform) {
case types_js_1.BrowserPlatform.LINUX:
return `linux-x86_64`;
case types_js_1.BrowserPlatform.LINUX_ARM:
return `linux-aarch64`;
case types_js_1.BrowserPlatform.MAC_ARM:
case types_js_1.BrowserPlatform.MAC:
return `mac`;
case types_js_1.BrowserPlatform.WIN32:
case types_js_1.BrowserPlatform.WIN64:
return platform;
}
}
function parseBuildId(buildId) {
for (const value of Object.values(FirefoxChannel)) {
if (buildId.startsWith(value + '_')) {
buildId = buildId.substring(value.length + 1);
return [value, buildId];
}
}
// Older versions do not have channel as the prefix.«
return [FirefoxChannel.NIGHTLY, buildId];
}
function resolveDownloadUrl(platform, buildId, baseUrl) {
const [channel] = parseBuildId(buildId);
switch (channel) {
case FirefoxChannel.NIGHTLY:
baseUrl ??=
'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central';
break;
case FirefoxChannel.DEVEDITION:
baseUrl ??= 'https://archive.mozilla.org/pub/devedition/releases';
break;
case FirefoxChannel.BETA:
case FirefoxChannel.STABLE:
case FirefoxChannel.ESR:
baseUrl ??= 'https://archive.mozilla.org/pub/firefox/releases';
break;
}
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
}
function resolveDownloadPath(platform, buildId) {
const [channel, resolvedBuildId] = parseBuildId(buildId);
switch (channel) {
case FirefoxChannel.NIGHTLY:
return [archiveNightly(platform, resolvedBuildId)];
case FirefoxChannel.DEVEDITION:
case FirefoxChannel.BETA:
case FirefoxChannel.STABLE:
case FirefoxChannel.ESR:
return [
resolvedBuildId,
platformName(platform),
'en-US',
archive(platform, resolvedBuildId),
];
}
}
function relativeExecutablePath(platform, buildId) {
const [channel] = parseBuildId(buildId);
switch (channel) {
case FirefoxChannel.NIGHTLY:
switch (platform) {
case types_js_1.BrowserPlatform.MAC_ARM:
case types_js_1.BrowserPlatform.MAC:
return node_path_1.default.join('Firefox Nightly.app', 'Contents', 'MacOS', 'firefox');
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
return node_path_1.default.join('firefox', 'firefox');
case types_js_1.BrowserPlatform.WIN32:
case types_js_1.BrowserPlatform.WIN64:
return node_path_1.default.join('firefox', 'firefox.exe');
}
case FirefoxChannel.BETA:
case FirefoxChannel.DEVEDITION:
case FirefoxChannel.ESR:
case FirefoxChannel.STABLE:
switch (platform) {
case types_js_1.BrowserPlatform.MAC_ARM:
case types_js_1.BrowserPlatform.MAC:
return node_path_1.default.join('Firefox.app', 'Contents', 'MacOS', 'firefox');
case types_js_1.BrowserPlatform.LINUX_ARM:
case types_js_1.BrowserPlatform.LINUX:
return node_path_1.default.join('firefox', 'firefox');
case types_js_1.BrowserPlatform.WIN32:
case types_js_1.BrowserPlatform.WIN64:
return node_path_1.default.join('core', 'firefox.exe');
}
}
}
var FirefoxChannel;
(function (FirefoxChannel) {
FirefoxChannel["STABLE"] = "stable";
FirefoxChannel["ESR"] = "esr";
FirefoxChannel["DEVEDITION"] = "devedition";
FirefoxChannel["BETA"] = "beta";
FirefoxChannel["NIGHTLY"] = "nightly";
})(FirefoxChannel || (exports.FirefoxChannel = FirefoxChannel = {}));
let baseVersionUrl = 'https://product-details.mozilla.org/1.0';
function changeBaseVersionUrlForTesting(url) {
baseVersionUrl = url;
}
function resetBaseVersionUrlForTesting() {
baseVersionUrl = 'https://product-details.mozilla.org/1.0';
}
async function resolveBuildId(channel = FirefoxChannel.NIGHTLY) {
const channelToVersionKey = {
[FirefoxChannel.ESR]: 'FIREFOX_ESR',
[FirefoxChannel.STABLE]: 'LATEST_FIREFOX_VERSION',
[FirefoxChannel.DEVEDITION]: 'FIREFOX_DEVEDITION',
[FirefoxChannel.BETA]: 'FIREFOX_DEVEDITION',
[FirefoxChannel.NIGHTLY]: 'FIREFOX_NIGHTLY',
};
const versions = (await (0, httpUtil_js_1.getJSON)(new URL(`${baseVersionUrl}/firefox_versions.json`)));
const version = versions[channelToVersionKey[channel]];
if (!version) {
throw new Error(`Channel ${channel} is not found.`);
}
return channel + '_' + version;
}
async function createProfile(options) {
if (!node_fs_1.default.existsSync(options.path)) {
await node_fs_1.default.promises.mkdir(options.path, {
recursive: true,
});
}
await syncPreferences({
preferences: {
...defaultProfilePreferences(options.preferences),
...options.preferences,
},
path: options.path,
});
}
function defaultProfilePreferences(extraPrefs) {
const server = 'dummy.test';
const defaultPrefs = {
// Make sure Shield doesn't hit the network.
'app.normandy.api_url': '',
// Disable Firefox old build background check
'app.update.checkInstallTime': false,
// Disable automatically upgrading Firefox
'app.update.disabledForTesting': true,
// Increase the APZ content response timeout to 1 minute
'apz.content_response_timeout': 60000,
// Prevent various error message on the console
// jest-puppeteer asserts that no error message is emitted by the console
'browser.contentblocking.features.standard': '-tp,tpPrivate,cookieBehavior0,-cryptoTP,-fp',
// Enable the dump function: which sends messages to the system
// console
// https://bugzilla.mozilla.org/show_bug.cgi?id=1543115
'browser.dom.window.dump.enabled': true,
// Disable topstories
'browser.newtabpage.activity-stream.feeds.system.topstories': false,
// Always display a blank page
'browser.newtabpage.enabled': false,
// Background thumbnails in particular cause grief: and disabling
// thumbnails in general cannot hurt
'browser.pagethumbnails.capturing_disabled': true,
// Disable safebrowsing components.
'browser.safebrowsing.blockedURIs.enabled': false,
'browser.safebrowsing.downloads.enabled': false,
'browser.safebrowsing.malware.enabled': false,
'browser.safebrowsing.phishing.enabled': false,
// Disable updates to search engines.
'browser.search.update': false,
// Do not restore the last open set of tabs if the browser has crashed
'browser.sessionstore.resume_from_crash': false,
// Skip check for default browser on startup
'browser.shell.checkDefaultBrowser': false,
// Disable newtabpage
'browser.startup.homepage': 'about:blank',
// Do not redirect user when a milstone upgrade of Firefox is detected
'browser.startup.homepage_override.mstone': 'ignore',
// Start with a blank page about:blank
'browser.startup.page': 0,
// Do not allow background tabs to be zombified on Android: otherwise for
// tests that open additional tabs: the test harness tab itself might get
// unloaded
'browser.tabs.disableBackgroundZombification': false,
// Do not warn when closing all other open tabs
'browser.tabs.warnOnCloseOtherTabs': false,
// Do not warn when multiple tabs will be opened
'browser.tabs.warnOnOpen': false,
// Do not automatically offer translations, as tests do not expect this.
'browser.translations.automaticallyPopup': false,
// Disable the UI tour.
'browser.uitour.enabled': false,
// Turn off search suggestions in the location bar so as not to trigger
// network connections.
'browser.urlbar.suggest.searches': false,
// Disable first run splash page on Windows 10
'browser.usedOnWindows10.introURL': '',
// Do not warn on quitting Firefox
'browser.warnOnQuit': false,
// Defensively disable data reporting systems
'datareporting.healthreport.documentServerURI': `http://${server}/dummy/healthreport/`,
'datareporting.healthreport.logging.consoleEnabled': false,
'datareporting.healthreport.service.enabled': false,
'datareporting.healthreport.service.firstRun': false,
'datareporting.healthreport.uploadEnabled': false,
// Do not show datareporting policy notifications which can interfere with tests
'datareporting.policy.dataSubmissionEnabled': false,
'datareporting.policy.dataSubmissionPolicyBypassNotification': true,
// DevTools JSONViewer sometimes fails to load dependencies with its require.js.
// This doesn't affect Puppeteer but spams console (Bug 1424372)
'devtools.jsonview.enabled': false,
// Disable popup-blocker
'dom.disable_open_during_load': false,
// Enable the support for File object creation in the content process
// Required for |Page.setFileInputFiles| protocol method.
'dom.file.createInChild': true,
// Disable the ProcessHangMonitor
'dom.ipc.reportProcessHangs': false,
// Disable slow script dialogues
'dom.max_chrome_script_run_time': 0,
'dom.max_script_run_time': 0,
// Only load extensions from the application and user profile
// AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION
'extensions.autoDisableScopes': 0,
'extensions.enabledScopes': 5,
// Disable metadata caching for installed add-ons by default
'extensions.getAddons.cache.enabled': false,
// Disable installing any distribution extensions or add-ons.
'extensions.installDistroAddons': false,
// Turn off extension updates so they do not bother tests
'extensions.update.enabled': false,
// Turn off extension updates so they do not bother tests
'extensions.update.notifyUser': false,
// Make sure opening about:addons will not hit the network
'extensions.webservice.discoverURL': `http://${server}/dummy/discoveryURL`,
// Allow the application to have focus even it runs in the background
'focusmanager.testmode': true,
// Disable useragent updates
'general.useragent.updates.enabled': false,
// Always use network provider for geolocation tests so we bypass the
// macOS dialog raised by the corelocation provider
'geo.provider.testing': true,
// Do not scan Wifi
'geo.wifi.scan': false,
// No hang monitor
'hangmonitor.timeout': 0,
// Show chrome errors and warnings in the error console
'javascript.options.showInConsole': true,
// Disable download and usage of OpenH264: and Widevine plugins
'media.gmp-manager.updateEnabled': false,
// Disable the GFX sanity window
'media.sanity-test.disabled': true,
// Disable experimental feature that is only available in Nightly
'network.cookie.sameSite.laxByDefault': false,
// Do not prompt for temporary redirects
'network.http.prompt-temp-redirect': false,
// Disable speculative connections so they are not reported as leaking
// when they are hanging around
'network.http.speculative-parallel-limit': 0,
// Do not automatically switch between offline and online
'network.manage-offline-status': false,
// Make sure SNTP requests do not hit the network
'network.sntp.pools': server,
// Disable Flash.
'plugin.state.flash': 0,
'privacy.trackingprotection.enabled': false,
// Can be removed once Firefox 89 is no longer supported
// https://bugzilla.mozilla.org/show_bug.cgi?id=1710839
'remote.enabled': true,
// Until Bug 1999693 is resolved, this preference needs to be set to allow
// Webdriver BiDi to automatically dismiss file pickers.
'remote.bidi.dismiss_file_pickers.enabled': true,
// Disabled screenshots component
'screenshots.browser.component.enabled': false,
// Don't do network connections for mitm priming
'security.certerrors.mitm.priming.enabled': false,
// Local documents have access to all other local documents,
// including directory listings
'security.fileuri.strict_origin_policy': false,
// Do not wait for the notification button security delay
'security.notification_enable_delay': 0,
// Ensure blocklist updates do not hit the network
'services.settings.server': `http://${server}/dummy/blocklist/`,
// Do not automatically fill sign-in forms with known usernames and
// passwords
'signon.autofillForms': false,
// Disable password capture, so that tests that include forms are not
// influenced by the presence of the persistent doorhanger notification
'signon.rememberSignons': false,
// Disable first-run welcome page
'startup.homepage_welcome_url': 'about:blank',
// Disable first-run welcome page
'startup.homepage_welcome_url.additional': '',
// Disable browser animations (tabs, fullscreen, sliding alerts)
'toolkit.cosmeticAnimations.enabled': false,
// Prevent starting into safe mode after application crashes
'toolkit.startup.max_resumed_crashes': -1,
};
return Object.assign(defaultPrefs, extraPrefs);
}
async function backupFile(input) {
if (!node_fs_1.default.existsSync(input)) {
return;
}
await node_fs_1.default.promises.copyFile(input, input + '.puppeteer');
}
/**
* Populates the user.js file with custom preferences as needed to allow
* Firefox's support to properly function. These preferences will be
* automatically copied over to prefs.js during startup of Firefox. To be
* able to restore the original values of preferences a backup of prefs.js
* will be created.
*/
async function syncPreferences(options) {
const prefsPath = node_path_1.default.join(options.path, 'prefs.js');
const userPath = node_path_1.default.join(options.path, 'user.js');
const lines = Object.entries(options.preferences).map(([key, value]) => {
return `user_pref(${JSON.stringify(key)}, ${JSON.stringify(value)});`;
});
// Use allSettled to prevent corruption.
const result = await Promise.allSettled([
backupFile(userPath).then(async () => {
await node_fs_1.default.promises.writeFile(userPath, lines.join('\n'));
}),
backupFile(prefsPath),
]);
for (const command of result) {
if (command.status === 'rejected') {
throw command.reason;
}
}
}
function compareVersions(a, b) {
// TODO: this is a not very reliable check.
return parseInt(a.replace('.', ''), 16) - parseInt(b.replace('.', ''), 16);
}
//# sourceMappingURL=firefox.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,66 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Supported browsers.
*
* @public
*/
export declare enum Browser {
CHROME = "chrome",
CHROMEHEADLESSSHELL = "chrome-headless-shell",
CHROMIUM = "chromium",
FIREFOX = "firefox",
CHROMEDRIVER = "chromedriver"
}
/**
* Platform names used to identify a OS platform x architecture combination in the way
* that is relevant for the browser download.
*
* @public
*/
export declare enum BrowserPlatform {
LINUX = "linux",
LINUX_ARM = "linux_arm",
MAC = "mac",
MAC_ARM = "mac_arm",
WIN32 = "win32",
WIN64 = "win64"
}
/**
* Enum describing a release channel for a browser.
*
* You can use this in combination with {@link resolveBuildId} to resolve
* a build ID based on a release channel.
*
* @public
*/
export declare enum BrowserTag {
CANARY = "canary",
NIGHTLY = "nightly",
BETA = "beta",
DEV = "dev",
DEVEDITION = "devedition",
STABLE = "stable",
ESR = "esr",
LATEST = "latest"
}
/**
* @public
*/
export interface ProfileOptions {
preferences: Record<string, unknown>;
path: string;
}
/**
* @public
*/
export declare enum ChromeReleaseChannel {
STABLE = "stable",
DEV = "dev",
CANARY = "canary",
BETA = "beta"
}
//# sourceMappingURL=types.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/browser-data/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,oBAAY,OAAO;IACjB,MAAM,WAAW;IACjB,mBAAmB,0BAA0B;IAC7C,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,YAAY,iBAAiB;CAC9B;AAED;;;;;GAKG;AACH,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED;;;;;;;GAOG;AACH,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,oBAAY,oBAAoB;IAC9B,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd"}

View File

@@ -0,0 +1,66 @@
"use strict";
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChromeReleaseChannel = exports.BrowserTag = exports.BrowserPlatform = exports.Browser = void 0;
/**
* Supported browsers.
*
* @public
*/
var Browser;
(function (Browser) {
Browser["CHROME"] = "chrome";
Browser["CHROMEHEADLESSSHELL"] = "chrome-headless-shell";
Browser["CHROMIUM"] = "chromium";
Browser["FIREFOX"] = "firefox";
Browser["CHROMEDRIVER"] = "chromedriver";
})(Browser || (exports.Browser = Browser = {}));
/**
* Platform names used to identify a OS platform x architecture combination in the way
* that is relevant for the browser download.
*
* @public
*/
var BrowserPlatform;
(function (BrowserPlatform) {
BrowserPlatform["LINUX"] = "linux";
BrowserPlatform["LINUX_ARM"] = "linux_arm";
BrowserPlatform["MAC"] = "mac";
BrowserPlatform["MAC_ARM"] = "mac_arm";
BrowserPlatform["WIN32"] = "win32";
BrowserPlatform["WIN64"] = "win64";
})(BrowserPlatform || (exports.BrowserPlatform = BrowserPlatform = {}));
/**
* Enum describing a release channel for a browser.
*
* You can use this in combination with {@link resolveBuildId} to resolve
* a build ID based on a release channel.
*
* @public
*/
var BrowserTag;
(function (BrowserTag) {
BrowserTag["CANARY"] = "canary";
BrowserTag["NIGHTLY"] = "nightly";
BrowserTag["BETA"] = "beta";
BrowserTag["DEV"] = "dev";
BrowserTag["DEVEDITION"] = "devedition";
BrowserTag["STABLE"] = "stable";
BrowserTag["ESR"] = "esr";
BrowserTag["LATEST"] = "latest";
})(BrowserTag || (exports.BrowserTag = BrowserTag = {}));
/**
* @public
*/
var ChromeReleaseChannel;
(function (ChromeReleaseChannel) {
ChromeReleaseChannel["STABLE"] = "stable";
ChromeReleaseChannel["DEV"] = "dev";
ChromeReleaseChannel["CANARY"] = "canary";
ChromeReleaseChannel["BETA"] = "beta";
})(ChromeReleaseChannel || (exports.ChromeReleaseChannel = ChromeReleaseChannel = {}));
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/browser-data/types.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;GAIG;AACH,IAAY,OAMX;AAND,WAAY,OAAO;IACjB,4BAAiB,CAAA;IACjB,wDAA6C,CAAA;IAC7C,gCAAqB,CAAA;IACrB,8BAAmB,CAAA;IACnB,wCAA6B,CAAA;AAC/B,CAAC,EANW,OAAO,uBAAP,OAAO,QAMlB;AAED;;;;;GAKG;AACH,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,0CAAuB,CAAA;IACvB,8BAAW,CAAA;IACX,sCAAmB,CAAA;IACnB,kCAAe,CAAA;IACf,kCAAe,CAAA;AACjB,CAAC,EAPW,eAAe,+BAAf,eAAe,QAO1B;AAED;;;;;;;GAOG;AACH,IAAY,UASX;AATD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;IACnB,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,uCAAyB,CAAA;IACzB,+BAAiB,CAAA;IACjB,yBAAW,CAAA;IACX,+BAAiB,CAAA;AACnB,CAAC,EATW,UAAU,0BAAV,UAAU,QASrB;AAUD;;GAEG;AACH,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,mCAAW,CAAA;IACX,yCAAiB,CAAA;IACjB,qCAAa,CAAA;AACf,CAAC,EALW,oBAAoB,oCAApB,oBAAoB,QAK/B"}

8
node_modules/@puppeteer/browsers/lib/cjs/debug.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import debug from 'debug';
export { debug };
//# sourceMappingURL=debug.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/debug.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,KAAK,EAAC,CAAC"}

14
node_modules/@puppeteer/browsers/lib/cjs/debug.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
"use strict";
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.debug = void 0;
const debug_1 = __importDefault(require("debug"));
exports.debug = debug_1.default;
//# sourceMappingURL=debug.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/debug.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,kDAA0B;AAElB,gBAFD,eAAK,CAEC"}

View File

@@ -0,0 +1,11 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import { BrowserPlatform } from './browser-data/browser-data.js';
/**
* @public
*/
export declare function detectBrowserPlatform(): BrowserPlatform | undefined;
//# sourceMappingURL=detectPlatform.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectPlatform.d.ts","sourceRoot":"","sources":["../../src/detectPlatform.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAE/D;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,GAAG,SAAS,CAmBnE"}

View File

@@ -0,0 +1,53 @@
"use strict";
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.detectBrowserPlatform = detectBrowserPlatform;
const node_os_1 = __importDefault(require("node:os"));
const browser_data_js_1 = require("./browser-data/browser-data.js");
/**
* @public
*/
function detectBrowserPlatform() {
const platform = node_os_1.default.platform();
const arch = node_os_1.default.arch();
switch (platform) {
case 'darwin':
return arch === 'arm64' ? browser_data_js_1.BrowserPlatform.MAC_ARM : browser_data_js_1.BrowserPlatform.MAC;
case 'linux':
return arch === 'arm64'
? browser_data_js_1.BrowserPlatform.LINUX_ARM
: browser_data_js_1.BrowserPlatform.LINUX;
case 'win32':
return arch === 'x64' ||
// Windows 11 for ARM supports x64 emulation
(arch === 'arm64' && isWindows11(node_os_1.default.release()))
? browser_data_js_1.BrowserPlatform.WIN64
: browser_data_js_1.BrowserPlatform.WIN32;
default:
return undefined;
}
}
/**
* Windows 11 is identified by the version 10.0.22000 or greater
* @internal
*/
function isWindows11(version) {
const parts = version.split('.');
if (parts.length > 2) {
const major = parseInt(parts[0], 10);
const minor = parseInt(parts[1], 10);
const patch = parseInt(parts[2], 10);
return (major > 10 ||
(major === 10 && minor > 0) ||
(major === 10 && minor === 0 && patch >= 22000));
}
return false;
}
//# sourceMappingURL=detectPlatform.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectPlatform.js","sourceRoot":"","sources":["../../src/detectPlatform.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AASH,sDAmBC;AA1BD,sDAAyB;AAEzB,oEAA+D;AAE/D;;GAEG;AACH,SAAgB,qBAAqB;IACnC,MAAM,QAAQ,GAAG,iBAAE,CAAC,QAAQ,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,iBAAE,CAAC,IAAI,EAAE,CAAC;IACvB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,iCAAe,CAAC,OAAO,CAAC,CAAC,CAAC,iCAAe,CAAC,GAAG,CAAC;QAC1E,KAAK,OAAO;YACV,OAAO,IAAI,KAAK,OAAO;gBACrB,CAAC,CAAC,iCAAe,CAAC,SAAS;gBAC3B,CAAC,CAAC,iCAAe,CAAC,KAAK,CAAC;QAC5B,KAAK,OAAO;YACV,OAAO,IAAI,KAAK,KAAK;gBACnB,4CAA4C;gBAC5C,CAAC,IAAI,KAAK,OAAO,IAAI,WAAW,CAAC,iBAAE,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC/C,CAAC,CAAC,iCAAe,CAAC,KAAK;gBACvB,CAAC,CAAC,iCAAe,CAAC,KAAK,CAAC;QAC5B;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,OAAe;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC;QAC/C,OAAO,CACL,KAAK,GAAG,EAAE;YACV,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC;YAC3B,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,CAChD,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}

17
node_modules/@puppeteer/browsers/lib/cjs/fileUtil.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @internal
*/
export declare function unpackArchive(archivePath: string, folderPath: string): Promise<void>;
/**
* @internal
*/
export declare const internalConstantsForTesting: {
xz: string;
bzip2: string;
};
//# sourceMappingURL=fileUtil.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"fileUtil.d.ts","sourceRoot":"","sources":["../../src/fileUtil.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;GAEG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CA6Bf;AAgDD;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;CAGvC,CAAC"}

196
node_modules/@puppeteer/browsers/lib/cjs/fileUtil.js generated vendored Normal file
View File

@@ -0,0 +1,196 @@
"use strict";
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.internalConstantsForTesting = void 0;
exports.unpackArchive = unpackArchive;
const node_child_process_1 = require("node:child_process");
const node_fs_1 = require("node:fs");
const promises_1 = require("node:fs/promises");
const path = __importStar(require("node:path"));
const node_stream_1 = require("node:stream");
const debug_1 = __importDefault(require("debug"));
const debugFileUtil = (0, debug_1.default)('puppeteer:browsers:fileUtil');
/**
* @internal
*/
async function unpackArchive(archivePath, folderPath) {
if (!path.isAbsolute(folderPath)) {
folderPath = path.resolve(process.cwd(), folderPath);
}
if (archivePath.endsWith('.zip')) {
const extractZip = await import('extract-zip');
await extractZip.default(archivePath, { dir: folderPath });
}
else if (archivePath.endsWith('.tar.bz2')) {
await extractTar(archivePath, folderPath, 'bzip2');
}
else if (archivePath.endsWith('.dmg')) {
await (0, promises_1.mkdir)(folderPath);
await installDMG(archivePath, folderPath);
}
else if (archivePath.endsWith('.exe')) {
// Firefox on Windows.
const result = (0, node_child_process_1.spawnSync)(archivePath, [`/ExtractDir=${folderPath}`], {
env: {
__compat_layer: 'RunAsInvoker',
},
});
if (result.status !== 0) {
throw new Error(`Failed to extract ${archivePath} to ${folderPath}: ${result.output}`);
}
}
else if (archivePath.endsWith('.tar.xz')) {
await extractTar(archivePath, folderPath, 'xz');
}
else {
throw new Error(`Unsupported archive format: ${archivePath}`);
}
}
function createTransformStream(child) {
const stream = new node_stream_1.Stream.Transform({
transform(chunk, encoding, callback) {
if (!child.stdin.write(chunk, encoding)) {
child.stdin.once('drain', callback);
}
else {
callback();
}
},
flush(callback) {
if (child.stdout.destroyed) {
callback();
}
else {
child.stdin.end();
child.stdout.on('close', callback);
}
},
});
child.stdin.on('error', e => {
if ('code' in e && e.code === 'EPIPE') {
// finished before reading the file finished (i.e. head)
stream.emit('end');
}
else {
stream.destroy(e);
}
});
child.stdout
.on('data', data => {
return stream.push(data);
})
.on('error', e => {
return stream.destroy(e);
});
child.once('close', () => {
return stream.end();
});
return stream;
}
/**
* @internal
*/
exports.internalConstantsForTesting = {
xz: 'xz',
bzip2: 'bzip2',
};
/**
* @internal
*/
async function extractTar(tarPath, folderPath, decompressUtilityName) {
const tarFs = await import('tar-fs');
return await new Promise((fulfill, reject) => {
function handleError(utilityName) {
return (error) => {
if ('code' in error && error.code === 'ENOENT') {
error = new Error(`\`${utilityName}\` utility is required to unpack this archive`, {
cause: error,
});
}
reject(error);
};
}
const unpack = (0, node_child_process_1.spawn)(exports.internalConstantsForTesting[decompressUtilityName], ['-d'], {
stdio: ['pipe', 'pipe', 'inherit'],
})
.once('error', handleError(decompressUtilityName))
.once('exit', code => {
debugFileUtil(`${decompressUtilityName} exited, code=${code}`);
});
const tar = tarFs.extract(folderPath);
tar.once('error', handleError('tar'));
tar.once('finish', fulfill);
(0, node_fs_1.createReadStream)(tarPath).pipe(createTransformStream(unpack)).pipe(tar);
});
}
/**
* @internal
*/
async function installDMG(dmgPath, folderPath) {
const { stdout } = (0, node_child_process_1.spawnSync)(`hdiutil`, [
'attach',
'-nobrowse',
'-noautoopen',
dmgPath,
]);
const volumes = stdout.toString('utf8').match(/\/Volumes\/(.*)/m);
if (!volumes) {
throw new Error(`Could not find volume path in ${stdout}`);
}
const mountPath = volumes[0];
try {
const fileNames = await (0, promises_1.readdir)(mountPath);
const appName = fileNames.find(item => {
return typeof item === 'string' && item.endsWith('.app');
});
if (!appName) {
throw new Error(`Cannot find app in ${mountPath}`);
}
const mountedPath = path.join(mountPath, appName);
(0, node_child_process_1.spawnSync)('cp', ['-R', mountedPath, folderPath]);
}
finally {
(0, node_child_process_1.spawnSync)('hdiutil', ['detach', mountPath, '-quiet']);
}
}
//# sourceMappingURL=fileUtil.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"fileUtil.js","sourceRoot":"","sources":["../../src/fileUtil.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBH,sCAgCC;AA9CD,2DAAoD;AACpD,qCAAyC;AACzC,+CAAgD;AAChD,gDAAkC;AAElC,6CAAmC;AAEnC,kDAA0B;AAE1B,MAAM,aAAa,GAAG,IAAA,eAAK,EAAC,6BAA6B,CAAC,CAAC;AAE3D;;GAEG;AACI,KAAK,UAAU,aAAa,CACjC,WAAmB,EACnB,UAAkB;IAElB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACjC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;IACD,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACjC,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;QAC/C,MAAM,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,EAAC,GAAG,EAAE,UAAU,EAAC,CAAC,CAAC;IAC3D,CAAC;SAAM,IAAI,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5C,MAAM,UAAU,CAAC,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;SAAM,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACxC,MAAM,IAAA,gBAAK,EAAC,UAAU,CAAC,CAAC;QACxB,MAAM,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IAC5C,CAAC;SAAM,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACxC,sBAAsB;QACtB,MAAM,MAAM,GAAG,IAAA,8BAAS,EAAC,WAAW,EAAE,CAAC,eAAe,UAAU,EAAE,CAAC,EAAE;YACnE,GAAG,EAAE;gBACH,cAAc,EAAE,cAAc;aAC/B;SACF,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CACb,qBAAqB,WAAW,OAAO,UAAU,KAAK,MAAM,CAAC,MAAM,EAAE,CACtE,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3C,MAAM,UAAU,CAAC,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,+BAA+B,WAAW,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAC5B,KAAoD;IAEpD,MAAM,MAAM,GAAG,IAAI,oBAAM,CAAC,SAAS,CAAC;QAClC,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ;YACjC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;gBACxC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACtC,CAAC;iBAAM,CAAC;gBACN,QAAQ,EAAE,CAAC;YACb,CAAC;QACH,CAAC;QAED,KAAK,CAAC,QAAQ;YACZ,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;gBAC3B,QAAQ,EAAE,CAAC;YACb,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;gBAClB,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE;QAC1B,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YACtC,wDAAwD;YACxD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,MAAM;SACT,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;QACjB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC,CAAC;SACD,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE;QACf,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEL,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;QACvB,OAAO,MAAM,CAAC,GAAG,EAAE,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACU,QAAA,2BAA2B,GAAG;IACzC,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,OAAO;CACf,CAAC;AAEF;;GAEG;AACH,KAAK,UAAU,UAAU,CACvB,OAAe,EACf,UAAkB,EAClB,qBAA+D;IAE/D,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,OAAO,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACjD,SAAS,WAAW,CAAC,WAAmB;YACtC,OAAO,CAAC,KAAY,EAAE,EAAE;gBACtB,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAC/C,KAAK,GAAG,IAAI,KAAK,CACf,KAAK,WAAW,+CAA+C,EAC/D;wBACE,KAAK,EAAE,KAAK;qBACb,CACF,CAAC;gBACJ,CAAC;gBACD,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAG,IAAA,0BAAK,EAClB,mCAA2B,CAAC,qBAAqB,CAAC,EAClD,CAAC,IAAI,CAAC,EACN;YACE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC;SACnC,CACF;aACE,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,qBAAqB,CAAC,CAAC;aACjD,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;YACnB,aAAa,CAAC,GAAG,qBAAqB,iBAAiB,IAAI,EAAE,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEL,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACtC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;QACtC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC5B,IAAA,0BAAgB,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,UAAkB;IAC3D,MAAM,EAAC,MAAM,EAAC,GAAG,IAAA,8BAAS,EAAC,SAAS,EAAE;QACpC,QAAQ;QACR,WAAW;QACX,aAAa;QACb,OAAO;KACR,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAClE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,iCAAiC,MAAM,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAE,CAAC;IAE9B,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,IAAA,kBAAO,EAAC,SAAS,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACpC,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,sBAAsB,SAAS,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAU,EAAE,OAAO,CAAC,CAAC;QAEnD,IAAA,8BAAS,EAAC,IAAI,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;IACnD,CAAC;YAAS,CAAC;QACT,IAAA,8BAAS,EAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;IACxD,CAAC;AACH,CAAC"}

16
node_modules/@puppeteer/browsers/lib/cjs/httpUtil.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import * as http from 'node:http';
import { URL } from 'node:url';
export declare function headHttpRequest(url: URL): Promise<boolean>;
export declare function httpRequest(url: URL, method: string, response: (x: http.IncomingMessage) => void, keepAlive?: boolean): http.ClientRequest;
/**
* @internal
*/
export declare function downloadFile(url: URL, destinationPath: string, progressCallback?: (downloadedBytes: number, totalBytes: number) => void): Promise<void>;
export declare function getJSON(url: URL): Promise<unknown>;
export declare function getText(url: URL): Promise<string>;
//# sourceMappingURL=httpUtil.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"httpUtil.d.ts","sourceRoot":"","sources":["../../src/httpUtil.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAC,GAAG,EAAmB,MAAM,UAAU,CAAC;AAI/C,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAgB1D;AAED,wBAAgB,WAAW,CACzB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,eAAe,KAAK,IAAI,EAC3C,SAAS,UAAO,GACf,IAAI,CAAC,aAAa,CAiCpB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,eAAe,EAAE,MAAM,EACvB,gBAAgB,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,GACvE,OAAO,CAAC,IAAI,CAAC,CA6Cf;AAED,wBAAsB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAOxD;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CA6BjD"}

Some files were not shown because too many files have changed in this diff Show More