setup
This commit is contained in:
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
+92
@@ -0,0 +1,92 @@
|
|||||||
|
Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
http://scripts.sil.org/OFL
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
Vendored
+201
@@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Vendored
+33
@@ -0,0 +1,33 @@
|
|||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>My App</title>
|
||||||
|
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta
|
||||||
|
name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1.0, viewport-fit=cover, user-scalable=no"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<meta
|
||||||
|
name="theme-color"
|
||||||
|
content="hsla(0, 0%, 100%, 100%)"
|
||||||
|
media="(prefers-color-scheme: light)"
|
||||||
|
/>
|
||||||
|
<meta
|
||||||
|
name="theme-color"
|
||||||
|
content="black"
|
||||||
|
media="(prefers-color-scheme: dark)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="styles.css" />
|
||||||
|
<link rel="manifest" href="manifest.json" />
|
||||||
|
<link rel="icon" href="icon.png" />
|
||||||
|
<script src="support.js" defer></script>
|
||||||
|
|
||||||
|
<script src="index.js" defer></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<main></main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
(() => {
|
||||||
|
// src/index.tsx
|
||||||
|
document.querySelector("main").append();
|
||||||
|
})();
|
||||||
Vendored
+10
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "My App",
|
||||||
|
"display": "standalone",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "icon.png",
|
||||||
|
"sizes": "any"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Vendored
+948
@@ -0,0 +1,948 @@
|
|||||||
|
/*
|
||||||
|
BASIC
|
||||||
|
*/
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
text-align: left;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
COLORS
|
||||||
|
*/
|
||||||
|
/* definition */
|
||||||
|
:root {
|
||||||
|
--background: hsla(0, 0%, 100%, 100%);
|
||||||
|
--background-transparent: hsla(0, 0%, 100%, 60%);
|
||||||
|
--background-hover: hsla(0, 0%, 55%, 12%);
|
||||||
|
--background-active: hsla(0, 0%, 55%, 12%);
|
||||||
|
|
||||||
|
--layer: hsla(0, 0%, 96%, 60%);
|
||||||
|
|
||||||
|
--surface: #f4f4f4;
|
||||||
|
--surface-hover: #e8e8e8;
|
||||||
|
--surface-active: #c6c6c6;
|
||||||
|
|
||||||
|
--border: hsla(0, 0%, 0%, 10%);
|
||||||
|
--surface-border: #8d8d8d;
|
||||||
|
|
||||||
|
--text-normal: #161616;
|
||||||
|
--text-on-color: #ffffff;
|
||||||
|
|
||||||
|
--text-success: #24a148;
|
||||||
|
--text-warn: #f1c21b;
|
||||||
|
--text-error: #da1e28;
|
||||||
|
--text-info: #0043ce;
|
||||||
|
|
||||||
|
--link: #0f62fe;
|
||||||
|
--link-hover: #0043ce;
|
||||||
|
|
||||||
|
--primary: #0f62fe;
|
||||||
|
--primary-hover: #0353e9;
|
||||||
|
--primary-active: #002d9c;
|
||||||
|
|
||||||
|
--danger: #da1e28;
|
||||||
|
--danger-hover: #ba1b23;
|
||||||
|
--danger-active: #750e13;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root {
|
||||||
|
--background: hsla(0, 0%, 9%, 100%);
|
||||||
|
--background-transparent: hsla(0, 0%, 9%, 60%);
|
||||||
|
--background-hover: hsla(0, 0%, 55%, 16%);
|
||||||
|
--background-active: hsla(0, 0%, 55%, 40%);
|
||||||
|
|
||||||
|
--layer: hsla(0, 0%, 15%, 60%);
|
||||||
|
|
||||||
|
--surface: #262626;
|
||||||
|
--surface-hover: #333333;
|
||||||
|
--surface-active: #6f6f6f;
|
||||||
|
|
||||||
|
--border: hsla(0, 0%, 100%, 10%);
|
||||||
|
--surface-border: #6f6f6f;
|
||||||
|
|
||||||
|
--text-normal: #f4f4f4;
|
||||||
|
|
||||||
|
--text-success: #42be65;
|
||||||
|
--text-warning: #f1c21b;
|
||||||
|
--text-error: #fa4d56;
|
||||||
|
--text-info: #4589ff;
|
||||||
|
|
||||||
|
--link: #78a9ff;
|
||||||
|
--link-hover: #a6c8ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (display-mode: standalone) {
|
||||||
|
:root {
|
||||||
|
--background: hsla(0, 0%, 0%, 100%);
|
||||||
|
--background-transparent: hsla(0, 0%, 0%, 60%);
|
||||||
|
--layer: hsla(0, 0%, 0%, 60%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* basic */
|
||||||
|
html {
|
||||||
|
background-color: var(--background);
|
||||||
|
color: var(--text-normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal > div {
|
||||||
|
background-color: var(--background);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu,
|
||||||
|
header {
|
||||||
|
background-color: var(--background-transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
color: inherit;
|
||||||
|
accent-color: var(--primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* text */
|
||||||
|
|
||||||
|
.success {
|
||||||
|
color: var(--text-success);
|
||||||
|
}
|
||||||
|
|
||||||
|
.warning {
|
||||||
|
color: var(--text-warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
color: var(--text-error);
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
color: var(--text-info);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* controls */
|
||||||
|
button,
|
||||||
|
footer,
|
||||||
|
input,
|
||||||
|
textarea,
|
||||||
|
select,
|
||||||
|
.surface,
|
||||||
|
.tile {
|
||||||
|
background-color: var(--surface);
|
||||||
|
}
|
||||||
|
@media (hover: hover) {
|
||||||
|
button:hover,
|
||||||
|
select:hover,
|
||||||
|
button.tile.ghost:hover,
|
||||||
|
[selected]:active {
|
||||||
|
background-color: var(--surface-hover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
button:active,
|
||||||
|
select:active,
|
||||||
|
button.tile.ghost:active,
|
||||||
|
[selected] {
|
||||||
|
background-color: var(--surface-active);
|
||||||
|
}
|
||||||
|
header button {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:checked {
|
||||||
|
background-color: var(--primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* primary button */
|
||||||
|
button.primary {
|
||||||
|
background-color: var(--primary);
|
||||||
|
color: var(--text-on-color);
|
||||||
|
}
|
||||||
|
@media (hover: hover) {
|
||||||
|
button.primary:hover {
|
||||||
|
background-color: var(--primary-hover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
button.primary:active {
|
||||||
|
background-color: var(--primary-active);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ghost button */
|
||||||
|
button.ghost:not(.tile) {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
button.ghost {
|
||||||
|
color: var(--link);
|
||||||
|
}
|
||||||
|
.tab-link[active] {
|
||||||
|
color: var(--primary);
|
||||||
|
}
|
||||||
|
@media (hover: hover) {
|
||||||
|
button.ghost:hover {
|
||||||
|
background-color: var(--background-hover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
button.ghost:active {
|
||||||
|
background-color: var(--background-active);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* danger button */
|
||||||
|
button.danger {
|
||||||
|
background-color: var(--danger);
|
||||||
|
color: var(--text-on-color);
|
||||||
|
}
|
||||||
|
@media (hover: hover) {
|
||||||
|
button.danger:hover {
|
||||||
|
background-color: var(--danger-hover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
button.danger:active {
|
||||||
|
background-color: var(--danger-active);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
SIZES
|
||||||
|
*/
|
||||||
|
:root {
|
||||||
|
/* gap */
|
||||||
|
--gap-between-tiles: 4px;
|
||||||
|
--gap-in-tab-links: 1rem;
|
||||||
|
--gap-in-controls: 1.2rem;
|
||||||
|
|
||||||
|
/* margin */
|
||||||
|
--label-top-padding: 0.25rem;
|
||||||
|
--label-tile-top-padding: 0.5rem;
|
||||||
|
--label-margin-bottom: 1rem;
|
||||||
|
--content-margin: 0.75rem;
|
||||||
|
|
||||||
|
/* padding */
|
||||||
|
--control-padding: 1rem;
|
||||||
|
--control-marker-padding: 0.7rem;
|
||||||
|
--content-padding: 1rem;
|
||||||
|
--modal-padding: 1.25rem;
|
||||||
|
--horizontal-tab-link-padding: 0.8rem;
|
||||||
|
|
||||||
|
/* size */
|
||||||
|
--checkbox-size: 16px;
|
||||||
|
|
||||||
|
--menu-height-mobile: calc(var(--header-height) + var(--safe-area-bottom));
|
||||||
|
--menu-width-desktop: 200px;
|
||||||
|
--split-pane-width-desktop: 300px;
|
||||||
|
|
||||||
|
--control-height: 42px;
|
||||||
|
--header-height: 48px;
|
||||||
|
|
||||||
|
--max-input-width: 24rem;
|
||||||
|
--max-content-width: 38rem;
|
||||||
|
|
||||||
|
/* safe */
|
||||||
|
--safe-area-top: env(safe-area-inset-top);
|
||||||
|
--safe-area-left: env(safe-area-inset-left);
|
||||||
|
--safe-area-right: env(safe-area-inset-right);
|
||||||
|
--safe-area-bottom: max(env(safe-area-inset-bottom), var(--control-padding));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
TYPE
|
||||||
|
*/
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: IBM Plex Sans;
|
||||||
|
src: url("Fonts/IBMPlexSans-Regular.ttf");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: IBM Plex Mono;
|
||||||
|
src: url("Fonts/IBMPlexMono-Regular.ttf");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: IBM Plex Serif;
|
||||||
|
src: url("Fonts/IBMPlexSerif-Regular.ttf");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
MAIN
|
||||||
|
*/
|
||||||
|
/* appearance */
|
||||||
|
input[type="checkbox"],
|
||||||
|
input[type="radio"],
|
||||||
|
select {
|
||||||
|
appearance: none;
|
||||||
|
--webkit-appearance: none;
|
||||||
|
--mpz-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* backdrop-filter */
|
||||||
|
header,
|
||||||
|
menu {
|
||||||
|
backdrop-filter: blur(70px);
|
||||||
|
-webkit-backdrop-filter: blur(70px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* border, outline, etc */
|
||||||
|
button,
|
||||||
|
input,
|
||||||
|
select,
|
||||||
|
textarea {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
border-top: 1px solid var(--surface-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not(
|
||||||
|
label.tile *
|
||||||
|
),
|
||||||
|
label.tile,
|
||||||
|
select:not(label.tile *),
|
||||||
|
textarea:not(label.tile *) {
|
||||||
|
border-bottom: 1px solid var(--surface-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus:not(
|
||||||
|
label.tile *
|
||||||
|
),
|
||||||
|
label.tile:has(input:focus),
|
||||||
|
label.tile:has(textarea:focus),
|
||||||
|
textarea:focus:not(label.tile *),
|
||||||
|
[selected] {
|
||||||
|
outline: var(--gap-between-tiles) solid var(--primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* border-radius */
|
||||||
|
* {
|
||||||
|
border-radius: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="radio"] {
|
||||||
|
border-radius: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cursor */
|
||||||
|
a,
|
||||||
|
.tab-link {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* display etc */
|
||||||
|
.align-start {
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:not(.tile),
|
||||||
|
footer,
|
||||||
|
input,
|
||||||
|
header,
|
||||||
|
label.inline,
|
||||||
|
.modal,
|
||||||
|
select,
|
||||||
|
textarea,
|
||||||
|
.align-center,
|
||||||
|
.tile:not(label) {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.align-end {
|
||||||
|
align-items: end;
|
||||||
|
}
|
||||||
|
|
||||||
|
label,
|
||||||
|
label * {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer,
|
||||||
|
header,
|
||||||
|
input[type="checkbox"],
|
||||||
|
input[type="radio"],
|
||||||
|
label.inline,
|
||||||
|
main,
|
||||||
|
.flex-column,
|
||||||
|
.flex-row,
|
||||||
|
.modal[open],
|
||||||
|
.modal > div,
|
||||||
|
.tile,
|
||||||
|
.tile > div {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:not(.tile),
|
||||||
|
input,
|
||||||
|
select,
|
||||||
|
textarea {
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal,
|
||||||
|
[hidden] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
main,
|
||||||
|
.flex,
|
||||||
|
.tile,
|
||||||
|
.tile > div {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-column,
|
||||||
|
.modal > div,
|
||||||
|
.tile > div {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
button,
|
||||||
|
.tile {
|
||||||
|
gap: var(--gap-in-controls);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gap {
|
||||||
|
gap: var(--gap-between-tiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
header,
|
||||||
|
button,
|
||||||
|
.justify-apart {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.justify-start,
|
||||||
|
.tile {
|
||||||
|
justify-content: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer,
|
||||||
|
header button,
|
||||||
|
input[type="checkbox"],
|
||||||
|
input[type="radio"],
|
||||||
|
.justify-center,
|
||||||
|
.modal {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.justify-end {
|
||||||
|
justify-content: end;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* opacity */
|
||||||
|
[disabled] {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
label span,
|
||||||
|
.helper-text,
|
||||||
|
.secondary,
|
||||||
|
.tab-link:not([active]) {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* padding, margin, etc */
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
main,
|
||||||
|
p {
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
margin: var(--content-margin) 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:is(code, p):not(:last-child) {
|
||||||
|
margin-bottom: var(--content-margin);
|
||||||
|
}
|
||||||
|
|
||||||
|
label:not(.tile) {
|
||||||
|
margin-bottom: var(--label-margin-bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
label.tile {
|
||||||
|
margin-bottom: var(--gap-between-tiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
label:not(.tile) span:first-child {
|
||||||
|
margin-top: var(--label-top-padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
label.tile span:first-child {
|
||||||
|
margin-top: var(--label-tile-top-padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="color"],
|
||||||
|
input[type="checkbox"],
|
||||||
|
input[type="radio"] {
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
article > div {
|
||||||
|
padding: var(--content-padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
button:not(.tile):not(header *),
|
||||||
|
input,
|
||||||
|
select {
|
||||||
|
padding: 0px var(--control-padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea,
|
||||||
|
.tile:not(label) {
|
||||||
|
padding: var(--control-padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal main {
|
||||||
|
padding: var(--modal-padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
article > div {
|
||||||
|
padding-top: calc(var(--header-height) + var(--content-margin));
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
padding-left: var(--content-padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
label.tile:has(> span.icon) {
|
||||||
|
padding-left: var(--control-padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
article > div {
|
||||||
|
padding-bottom: calc(
|
||||||
|
var(--menu-height-mobile) + var(--control-height) + var(--content-padding)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
text-indent: var(--control-padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
label.tile:has(> span.icon) {
|
||||||
|
text-indent: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* pointer-events */
|
||||||
|
[disabled] {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* position etc */
|
||||||
|
article > div,
|
||||||
|
footer,
|
||||||
|
header,
|
||||||
|
select + .icon,
|
||||||
|
.absolute {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal,
|
||||||
|
.fixed {
|
||||||
|
position: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
article,
|
||||||
|
main,
|
||||||
|
input,
|
||||||
|
label,
|
||||||
|
.relative {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticky {
|
||||||
|
position: sticky;
|
||||||
|
}
|
||||||
|
|
||||||
|
article > div,
|
||||||
|
header,
|
||||||
|
.modal,
|
||||||
|
.top-0 {
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
article > div,
|
||||||
|
footer,
|
||||||
|
header,
|
||||||
|
.modal,
|
||||||
|
.left-0 {
|
||||||
|
left: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
article > div,
|
||||||
|
footer,
|
||||||
|
header,
|
||||||
|
.modal,
|
||||||
|
.right-0 {
|
||||||
|
right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
select + .icon {
|
||||||
|
right: var(--control-marker-padding);
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
bottom: var(--menu-height-mobile);
|
||||||
|
}
|
||||||
|
|
||||||
|
article > div,
|
||||||
|
select + .icon,
|
||||||
|
.modal,
|
||||||
|
.bottom-0 {
|
||||||
|
bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* size */
|
||||||
|
article,
|
||||||
|
main,
|
||||||
|
select + .icon,
|
||||||
|
.modal > div,
|
||||||
|
.modal main {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:not(.tile):not(header *),
|
||||||
|
footer,
|
||||||
|
input:not([type="checkbox"]):not([type="radio"]),
|
||||||
|
select,
|
||||||
|
select + .icon,
|
||||||
|
textarea {
|
||||||
|
height: var(--control-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
header,
|
||||||
|
header button {
|
||||||
|
height: var(--header-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
article {
|
||||||
|
min-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width-50 {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
article,
|
||||||
|
input:not([type="checkbox"]):not([type="radio"]),
|
||||||
|
footer,
|
||||||
|
header,
|
||||||
|
main,
|
||||||
|
select,
|
||||||
|
textarea,
|
||||||
|
.modal > div,
|
||||||
|
.width-content,
|
||||||
|
.width-input,
|
||||||
|
.tile,
|
||||||
|
.tile > div,
|
||||||
|
.width-100 {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
header button {
|
||||||
|
width: var(--header-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="checkbox"],
|
||||||
|
input[type="radio"] {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
text
|
||||||
|
*/
|
||||||
|
* {
|
||||||
|
font-family: IBM Plex Sans;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 1.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 1.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: IBM Plex Mono;
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary,
|
||||||
|
.helper-text,
|
||||||
|
.error-text,
|
||||||
|
label {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* text-decoration */
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* z-index */
|
||||||
|
footer,
|
||||||
|
header,
|
||||||
|
menu {
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal > div {
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PSEUDO
|
||||||
|
*/
|
||||||
|
input[type="checkbox"]:checked::before {
|
||||||
|
content: "check";
|
||||||
|
font-size: 70% !important;
|
||||||
|
color: var(--text-on-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="radio"]:checked::before {
|
||||||
|
content: "";
|
||||||
|
|
||||||
|
background-color: var(--text-on-color);
|
||||||
|
border-radius: 100%;
|
||||||
|
|
||||||
|
--inset: 4px;
|
||||||
|
position: absolute;
|
||||||
|
top: var(--inset);
|
||||||
|
left: var(--inset);
|
||||||
|
right: var(--inset);
|
||||||
|
bottom: var(--inset);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal::before {
|
||||||
|
content: "";
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
right: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
|
||||||
|
background-color: var(--background);
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
LAYOUT
|
||||||
|
*/
|
||||||
|
/* basic */
|
||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
|
||||||
|
margin: 0px;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
padding-left: var(--safe-area-left);
|
||||||
|
padding-right: var(--safe-area-right);
|
||||||
|
padding-top: var(--safe-area-top);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu {
|
||||||
|
width: 100%;
|
||||||
|
height: var(--menu-height-mobile);
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0px;
|
||||||
|
left: 0px;
|
||||||
|
right: 0px;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-around;
|
||||||
|
|
||||||
|
padding-top: 0px;
|
||||||
|
padding-bottom: var(--safe-area-bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-link {
|
||||||
|
width: 100%;
|
||||||
|
height: var(--header-height);
|
||||||
|
|
||||||
|
padding: var(--horizontal-tab-link-padding) var(--control-padding);
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0px;
|
||||||
|
|
||||||
|
font-size: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
article > div {
|
||||||
|
padding-bottom: calc(
|
||||||
|
var(--menu-height-mobile) + var(--header-height) + var(--content-padding)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* overflow */
|
||||||
|
menu {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
article,
|
||||||
|
body,
|
||||||
|
main {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
article > div {
|
||||||
|
overflow: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
overflow-x: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* scrolling */
|
||||||
|
main {
|
||||||
|
scrollbar-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
main::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
}
|
||||||
|
|
||||||
|
article {
|
||||||
|
scroll-snap-align: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
scroll-snap-type: x mandatory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* desktop */
|
||||||
|
@media (min-width: 640px) {
|
||||||
|
/* basic */
|
||||||
|
.mobile-only {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* border, outline, etc */
|
||||||
|
.modal > div {
|
||||||
|
border: 1px solid var(--surface-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu,
|
||||||
|
main.split > article:first-of-type {
|
||||||
|
border-right: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* size */
|
||||||
|
.modal > div {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
p,
|
||||||
|
.width-content,
|
||||||
|
.modal > div {
|
||||||
|
max-width: var(--max-content-width);
|
||||||
|
}
|
||||||
|
|
||||||
|
input,
|
||||||
|
label,
|
||||||
|
select,
|
||||||
|
textarea,
|
||||||
|
.width-input {
|
||||||
|
max-width: var(--max-input-width);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* layout */
|
||||||
|
body {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
main.split {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: var(--split-pane-width-desktop) 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
article > div {
|
||||||
|
padding-bottom: calc(var(--content-padding) + var(--control-height));
|
||||||
|
}
|
||||||
|
|
||||||
|
menu {
|
||||||
|
position: static;
|
||||||
|
|
||||||
|
width: var(--menu-width-desktop);
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: start;
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-link {
|
||||||
|
width: 100%;
|
||||||
|
height: var(--control-height);
|
||||||
|
|
||||||
|
flex-direction: row;
|
||||||
|
gap: var(--gap-in-tab-links);
|
||||||
|
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
ICONS
|
||||||
|
*/
|
||||||
|
input[type="checkbox"],
|
||||||
|
.tile.arrow-right::after,
|
||||||
|
.icon {
|
||||||
|
font-family: "Material Symbols Sharp";
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
font-size: 24px;
|
||||||
|
line-height: 1;
|
||||||
|
letter-spacing: normal;
|
||||||
|
text-transform: none;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
word-wrap: normal;
|
||||||
|
direction: ltr;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Material Symbols Sharp";
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 300;
|
||||||
|
src: url("Icons/material-icons.woff") format("woff");
|
||||||
|
}
|
||||||
Vendored
+10
@@ -0,0 +1,10 @@
|
|||||||
|
document.querySelector("main").addEventListener("scroll", () => {
|
||||||
|
const links = document.querySelectorAll(".tab-link");
|
||||||
|
links.forEach((element) => element.removeAttribute("active"));
|
||||||
|
|
||||||
|
const pageWidth = document.querySelector("main > article").offsetWidth;
|
||||||
|
const scroll = document.querySelector("main").scrollLeft;
|
||||||
|
const currentPage = Math.round(scroll / pageWidth);
|
||||||
|
|
||||||
|
if (links[currentPage]) links[currentPage].setAttribute("active", "");
|
||||||
|
});
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
../esbuild/bin/esbuild
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
../uuid/dist/bin/uuid
|
||||||
+80
@@ -0,0 +1,80 @@
|
|||||||
|
{
|
||||||
|
"name": "udn-broadcast",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"node_modules/@esbuild/darwin-x64": {
|
||||||
|
"version": "0.23.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.0.tgz",
|
||||||
|
"integrity": "sha512-IMQ6eme4AfznElesHUPDZ+teuGwoRmVuuixu7sv92ZkdQcPbsNHzutd+rAfaBKo8YK3IrBEi9SLLKWJdEvJniQ==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/bloatless-react": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/bloatless-react/-/bloatless-react-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-CW9nNjH5GMcGCDwoQ012UwfSuY9IyfFQ8XAUcdg6wEbUm82OeO9DUyTgtb90j612sIFeCPBTxbkwkbgHo/ECXA==",
|
||||||
|
"dependencies": {
|
||||||
|
"uuid": "^10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild": {
|
||||||
|
"version": "0.23.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.0.tgz",
|
||||||
|
"integrity": "sha512-1lvV17H2bMYda/WaFb2jLPeHU3zml2k4/yagNMG8Q/YtfMjCwEUZa2eXXMgZTVSL5q1n4H7sQ0X6CdJDqqeCFA==",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"bin": {
|
||||||
|
"esbuild": "bin/esbuild"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@esbuild/aix-ppc64": "0.23.0",
|
||||||
|
"@esbuild/android-arm": "0.23.0",
|
||||||
|
"@esbuild/android-arm64": "0.23.0",
|
||||||
|
"@esbuild/android-x64": "0.23.0",
|
||||||
|
"@esbuild/darwin-arm64": "0.23.0",
|
||||||
|
"@esbuild/darwin-x64": "0.23.0",
|
||||||
|
"@esbuild/freebsd-arm64": "0.23.0",
|
||||||
|
"@esbuild/freebsd-x64": "0.23.0",
|
||||||
|
"@esbuild/linux-arm": "0.23.0",
|
||||||
|
"@esbuild/linux-arm64": "0.23.0",
|
||||||
|
"@esbuild/linux-ia32": "0.23.0",
|
||||||
|
"@esbuild/linux-loong64": "0.23.0",
|
||||||
|
"@esbuild/linux-mips64el": "0.23.0",
|
||||||
|
"@esbuild/linux-ppc64": "0.23.0",
|
||||||
|
"@esbuild/linux-riscv64": "0.23.0",
|
||||||
|
"@esbuild/linux-s390x": "0.23.0",
|
||||||
|
"@esbuild/linux-x64": "0.23.0",
|
||||||
|
"@esbuild/netbsd-x64": "0.23.0",
|
||||||
|
"@esbuild/openbsd-arm64": "0.23.0",
|
||||||
|
"@esbuild/openbsd-x64": "0.23.0",
|
||||||
|
"@esbuild/sunos-x64": "0.23.0",
|
||||||
|
"@esbuild/win32-arm64": "0.23.0",
|
||||||
|
"@esbuild/win32-ia32": "0.23.0",
|
||||||
|
"@esbuild/win32-x64": "0.23.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/uuid": {
|
||||||
|
"version": "10.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz",
|
||||||
|
"integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==",
|
||||||
|
"funding": [
|
||||||
|
"https://github.com/sponsors/broofa",
|
||||||
|
"https://github.com/sponsors/ctavan"
|
||||||
|
],
|
||||||
|
"bin": {
|
||||||
|
"uuid": "dist/bin/uuid"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
# esbuild
|
||||||
|
|
||||||
|
This is the macOS 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
|
||||||
BIN
Binary file not shown.
+20
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "@esbuild/darwin-x64",
|
||||||
|
"version": "0.23.0",
|
||||||
|
"description": "The macOS 64-bit binary for esbuild, a JavaScript bundler.",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/evanw/esbuild.git"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"preferUnplugged": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
]
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
tabWidth: 4
|
||||||
+674
@@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
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
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
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>.
|
||||||
+232
@@ -0,0 +1,232 @@
|
|||||||
|
# bloatless-react
|
||||||
|
|
||||||
|
Bloatless-React is a very minimal and flexible alternative to React.
|
||||||
|
|
||||||
|
# Features
|
||||||
|
|
||||||
|
- Supports reactivity through States
|
||||||
|
- Supports JSX for components
|
||||||
|
- Written in TypeScript
|
||||||
|
- Really minimal (under 200 lines)
|
||||||
|
- No bloated server or compiler required - just bundle the JavaScript into a static .html file
|
||||||
|
|
||||||
|
# Setup
|
||||||
|
|
||||||
|
You can use any bundler you want, but esbuild is the fastest and smallest out there:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm install esbuild bloatless-react
|
||||||
|
mkdir src dist
|
||||||
|
touch src/index.tsx dist/index.html
|
||||||
|
```
|
||||||
|
|
||||||
|
The following build script will be enough:
|
||||||
|
```JSON
|
||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"build": "esbuild src/index.tsx --bundle --outdir=dist"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
# States
|
||||||
|
|
||||||
|
In Bloatless-React, States are the foundation of how reactivity is implemented. Similar to many frameworks, a State can hold a value and triggers the UI to update when it changes. However, **subscriptions have to be made manually** due to the minimal nature of this project.
|
||||||
|
|
||||||
|
```TypeScript
|
||||||
|
// Import
|
||||||
|
import * as React from 'bloatless-react';
|
||||||
|
|
||||||
|
// Create States
|
||||||
|
const name = new React.State("John Doe"); // will be State<string>
|
||||||
|
const age = new React.State(69); //will be State<number>
|
||||||
|
|
||||||
|
// Get value
|
||||||
|
console.log(name.value);
|
||||||
|
|
||||||
|
// Subscribe
|
||||||
|
age.subscribe(newAge => console.log(`Age changed to ${newAge}`));
|
||||||
|
|
||||||
|
// Set value
|
||||||
|
name.value = "Jeff";
|
||||||
|
```
|
||||||
|
|
||||||
|
## Proxy States
|
||||||
|
|
||||||
|
A Proxy State is a State based on multiple other States. This reduces code and can increase performance.
|
||||||
|
|
||||||
|
```TypeScript
|
||||||
|
// Import
|
||||||
|
import * as React from 'bloatless-react';
|
||||||
|
|
||||||
|
// Create States
|
||||||
|
const name = new React.State("John Doe"); // will be State<string>
|
||||||
|
const age = new React.State(69); //will be State<number>
|
||||||
|
|
||||||
|
// Proxy State
|
||||||
|
const summary = React.createProxyState([name, age], () => `${name.value} is ${age.value} years old.`)
|
||||||
|
summary.subscribe(console.log);
|
||||||
|
```
|
||||||
|
|
||||||
|
## ListStates
|
||||||
|
|
||||||
|
A `ListState<T>` is a State whose value is a `Set<T>`. A ListState allows specific subscriptions to detect when items get added and removed. This allows dynamic lists to run efficiently.
|
||||||
|
|
||||||
|
```TypeScript
|
||||||
|
// Import
|
||||||
|
import * as React from 'bloatless-react';
|
||||||
|
|
||||||
|
// Define Item type
|
||||||
|
class Item implements React.Identifiable {
|
||||||
|
id = React.UUID();
|
||||||
|
constructor(public text: string) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create ListState
|
||||||
|
const listState = new React.ListState<Item>();
|
||||||
|
|
||||||
|
// Handle addition and removal
|
||||||
|
listState.handleAddition((newItem) => {
|
||||||
|
console.log(`${newItem.text} was added`);
|
||||||
|
listState.handleRemoval(newItem, () => console.log(`${newItem.text} was removed`));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add item
|
||||||
|
const newItem = new Item("hello, world!");
|
||||||
|
listState.add(newItem);
|
||||||
|
|
||||||
|
// Remove item
|
||||||
|
listState.remove(newItem);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Persistence
|
||||||
|
|
||||||
|
States can persist through reloads via LocalStorage. To implement this, modify your code like this:
|
||||||
|
```diff
|
||||||
|
-const myState = new React.State("hello");
|
||||||
|
+const myState = React.restoreState("my-state", "hello");
|
||||||
|
|
||||||
|
-const myListState = new React.ListState<Item>();
|
||||||
|
+const myListState = React.restoreListState<Item>("my-list-state");
|
||||||
|
```
|
||||||
|
|
||||||
|
# UI
|
||||||
|
|
||||||
|
For a minimalist stylesheet, I'd recommend checking out my project called [carbon-mini](https://github.com/marlon-erler/carbon-mini/).
|
||||||
|
|
||||||
|
Bloatless React provides a modified polyfill for the React API. This means that **you can use JSX** almost like you would in a React project. Additional functionailiy is implemented through directives, similar to Svelte:
|
||||||
|
|
||||||
|
## Handling Events
|
||||||
|
|
||||||
|
The `on:<event>` directive adds an EventListener. This directive also supports the `on:enter` event.
|
||||||
|
|
||||||
|
```TypeScript
|
||||||
|
<input on:enter={someFunction}></input>
|
||||||
|
<button on:click={someFunction}>Click me</button>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Changing Properties
|
||||||
|
|
||||||
|
The `subscribe:<property>` directive subscribes to a State and changes the element's property. The property will be changed through the DOM API, so you can use innerText and innerHTML. You can not use this to set attributes.
|
||||||
|
|
||||||
|
```TypeScript
|
||||||
|
const name = new React.State("John Doe");
|
||||||
|
<span subscribe:innerText={name}></span>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Toggling Attributes
|
||||||
|
|
||||||
|
The `toggle:<attribute>` directive toggles attributes on the HTML element without assigning a value. This is useful for the `disabled` attribute.
|
||||||
|
|
||||||
|
```TypeScript
|
||||||
|
const isDisabled = new React.State(false);
|
||||||
|
<button toggle:disabled={isDisabled}>Some button</button>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Binding Input Values
|
||||||
|
|
||||||
|
The `bind:<property>` directive acts like a combination of `subscribe:<property>` and `on:input`. It binds the element's property to the state bi-directinally.
|
||||||
|
|
||||||
|
```TypeScript
|
||||||
|
const name = new React.State("John Doe");
|
||||||
|
// Both inputs will be in sync
|
||||||
|
<input bind:value={name}></input>
|
||||||
|
<input bind:value={name}></input>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dynamically Creating and Removing Child Elements
|
||||||
|
|
||||||
|
The `subscribe:children` directive subscribes to a ListState and adds/removes child elements accordingly.
|
||||||
|
|
||||||
|
```TypeScript
|
||||||
|
import * as React from 'bloatless-react';
|
||||||
|
|
||||||
|
// Define Item
|
||||||
|
class Item implements React.Identifiable {
|
||||||
|
id = React.UUID();
|
||||||
|
constructor(public text: string) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This ListItemConverter creates an HTML element based on an Item
|
||||||
|
const convertItem: React.ListItemConverter<Item> = (item, listState) => {
|
||||||
|
function remove() {
|
||||||
|
listState.remove(item);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<span>
|
||||||
|
{item.text}
|
||||||
|
<button on:click={remove}>Remove</button>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create ListState
|
||||||
|
const listState = new React.ListState<Item>();
|
||||||
|
|
||||||
|
// Prepare adding items
|
||||||
|
const newItemName = new React.State("");
|
||||||
|
|
||||||
|
function addItem() {
|
||||||
|
const newItem = new Item(newItemName.value);
|
||||||
|
listState.add(newItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build UI
|
||||||
|
document.body.append(
|
||||||
|
<div>
|
||||||
|
<input bind:value={newItemName}></input>
|
||||||
|
<button on:click={addItem}>Add</button>
|
||||||
|
<div subscribe:children={[listState, convertItem]}></div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
# Changelog
|
||||||
|
## 1.1.0
|
||||||
|
- Improve code
|
||||||
|
- Add missing `break` statements for directives
|
||||||
|
- Add `toggle` directive
|
||||||
|
- Improve documentation
|
||||||
|
|
||||||
|
## 1.1.1
|
||||||
|
- Improve documentation
|
||||||
|
|
||||||
|
## 1.1.2
|
||||||
|
- Remove `console.log()` calls
|
||||||
|
- Improve documentation
|
||||||
|
|
||||||
|
## 1.1.3
|
||||||
|
- Add `on:enter` directive
|
||||||
|
|
||||||
|
## 1.2.0
|
||||||
|
**BREAKING CHANGES**
|
||||||
|
- Replace UUID class with function;
|
||||||
|
- `new UUID()` => `UUID() returns string`
|
||||||
|
- Replace definition of `Identifiable`
|
||||||
|
- now has `id: string` instead of `uuid: UUID()`
|
||||||
|
|
||||||
|
Other changes:
|
||||||
|
- Add State persistence
|
||||||
|
- Add error description when utilizing `subscribe:children` incorrectly
|
||||||
|
- Fix bug where ListState subscriptions were not called
|
||||||
|
- Improve documentation
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
(()=>{var a=class{value;constructor(){this.value=""}toString(){return this.value}};function l(t){return t instanceof r?t.value:t}function o(t){return t instanceof r?t:new r(t)}var r=class{_value;_bindings=new Set;constructor(e){this._value=e}get value(){return this._value}set value(e){this._value!=e&&(this._value=e,this.callSubscriptions())}callSubscriptions(){this._bindings.forEach(e=>e(this._value))}subscribe(e){this._bindings.add(e)}},s=class extends r{additionHandlers=new Set;removalHandlers=new Map;constructor(){super(new Set)}add(...e){e.forEach(i=>{this.value.add(i),this.additionHandlers.forEach(n=>n(i))})}delete(...e){e.forEach(i=>{this.value.delete(i);let n=i.uuid;this.removalHandlers.has(n)&&(this.removalHandlers.get(n)(i),this.removalHandlers.delete(n))})}handleAddition(e){this.additionHandlers.add(e)}handleRemoval(e,i){this.removalHandlers.set(e.uuid,i)}};function d(t,e,i,n="input"){i.subscribe(u=>{t[e]=i.value}),t.addEventListener(n,()=>{i.value=t[e]})}})();
|
||||||
+254
@@ -0,0 +1,254 @@
|
|||||||
|
import { v4 } from "uuid";
|
||||||
|
|
||||||
|
/*
|
||||||
|
DATA MODEL
|
||||||
|
*/
|
||||||
|
/* Types */
|
||||||
|
export interface Identifiable {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Stringifiable {
|
||||||
|
toString: () => string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Utility */
|
||||||
|
export function UUID(): string {
|
||||||
|
return v4();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* State */
|
||||||
|
export type StateSubscription<T> = (newValue: T) => void;
|
||||||
|
export type AdditionSubscription<T> = (newItem: T) => void;
|
||||||
|
export type RemovalSubscription<T> = (removedItem: T) => void;
|
||||||
|
|
||||||
|
export class State<T> {
|
||||||
|
private _value: T;
|
||||||
|
private _bindings = new Set<StateSubscription<T>>();
|
||||||
|
|
||||||
|
// init
|
||||||
|
constructor(initialValue: T) {
|
||||||
|
this._value = initialValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// value
|
||||||
|
get value(): T {
|
||||||
|
return this._value;
|
||||||
|
}
|
||||||
|
|
||||||
|
set value(newValue: T) {
|
||||||
|
if (this._value == newValue) return;
|
||||||
|
this._value = newValue;
|
||||||
|
this.callSubscriptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
// subscriptions
|
||||||
|
callSubscriptions(): void {
|
||||||
|
this._bindings.forEach((fn) => fn(this._value));
|
||||||
|
}
|
||||||
|
|
||||||
|
subscribe(fn: (newValue: T) => void): void {
|
||||||
|
this._bindings.add(fn);
|
||||||
|
fn(this._value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// stringify
|
||||||
|
toString(): string {
|
||||||
|
return JSON.stringify(this._value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ListState<T extends Identifiable> extends State<Set<T>> {
|
||||||
|
private additionHandlers = new Set<AdditionSubscription<T>>();
|
||||||
|
private removalHandlers = new Map<string, RemovalSubscription<T>>();
|
||||||
|
|
||||||
|
// init
|
||||||
|
constructor(initialItems?: T[]) {
|
||||||
|
super(new Set<T>(initialItems));
|
||||||
|
}
|
||||||
|
|
||||||
|
// list
|
||||||
|
add(...items: T[]): void {
|
||||||
|
items.forEach((item) => {
|
||||||
|
this.value.add(item);
|
||||||
|
this.additionHandlers.forEach((handler) => handler(item));
|
||||||
|
});
|
||||||
|
this.callSubscriptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
remove(...items: T[]): void {
|
||||||
|
items.forEach((item) => {
|
||||||
|
this.value.delete(item);
|
||||||
|
const id = item.id;
|
||||||
|
|
||||||
|
if (!this.removalHandlers.has(id)) return;
|
||||||
|
this.removalHandlers.get(id)!(item);
|
||||||
|
this.removalHandlers.delete(id);
|
||||||
|
});
|
||||||
|
this.callSubscriptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
// handlers
|
||||||
|
handleAddition(handler: AdditionSubscription<T>): void {
|
||||||
|
this.additionHandlers.add(handler);
|
||||||
|
[...this.value.values()].forEach(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleRemoval(item: T, handler: RemovalSubscription<T>): void {
|
||||||
|
this.removalHandlers.set(item.id, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
// stringification
|
||||||
|
toString(): string {
|
||||||
|
const array = [...this.value];
|
||||||
|
const json = JSON.stringify(array);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UTILITY
|
||||||
|
export function createProxyState<T>(
|
||||||
|
statesToSubscibe: State<any>[],
|
||||||
|
fn: () => T
|
||||||
|
): State<T> {
|
||||||
|
const proxyState = new State<T>(fn());
|
||||||
|
statesToSubscibe.forEach((state) =>
|
||||||
|
state.subscribe(() => (proxyState.value = fn()))
|
||||||
|
);
|
||||||
|
return proxyState;
|
||||||
|
}
|
||||||
|
|
||||||
|
function persistState(localStorageKey: string, state: State<any>) {
|
||||||
|
state.subscribe(() => {
|
||||||
|
const stringifiedValue = state.toString();
|
||||||
|
localStorage.setItem(localStorageKey, stringifiedValue);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function restoreState<T>(
|
||||||
|
localStorageKey: string,
|
||||||
|
initialStateValue: T
|
||||||
|
): State<T> {
|
||||||
|
const storedString =
|
||||||
|
localStorage.getItem(localStorageKey) ??
|
||||||
|
JSON.stringify(initialStateValue);
|
||||||
|
const convertedValue = JSON.parse(storedString);
|
||||||
|
|
||||||
|
const state = new State(convertedValue);
|
||||||
|
persistState(localStorageKey, state);
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function restoreListState<T extends Identifiable>(
|
||||||
|
localStorageKey: string
|
||||||
|
): ListState<T> {
|
||||||
|
const storedString = localStorage.getItem(localStorageKey) ?? "";
|
||||||
|
|
||||||
|
let initialItems: any[] = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
const array = JSON.parse(storedString);
|
||||||
|
if (!Array.isArray(array)) throw "";
|
||||||
|
initialItems = array;
|
||||||
|
} catch {}
|
||||||
|
|
||||||
|
const state = new ListState<T>(initialItems);
|
||||||
|
persistState(localStorageKey, state);
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ListItemConverter<T extends Identifiable> = (
|
||||||
|
item: T,
|
||||||
|
listState: ListState<T>
|
||||||
|
) => HTMLElement;
|
||||||
|
|
||||||
|
/*
|
||||||
|
JSX
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function createElement(
|
||||||
|
tagName: keyof HTMLElementTagNameMap,
|
||||||
|
attributes: { [key: string]: any } | null = {},
|
||||||
|
...children: (HTMLElement | string)[]
|
||||||
|
) {
|
||||||
|
const element = document.createElement(tagName);
|
||||||
|
|
||||||
|
if (attributes != null)
|
||||||
|
Object.entries(attributes).forEach((entry) => {
|
||||||
|
const [attributename, value] = entry;
|
||||||
|
const [directiveKey, directiveValue] = attributename.split(":");
|
||||||
|
|
||||||
|
switch (directiveKey) {
|
||||||
|
case "on": {
|
||||||
|
switch (directiveValue) {
|
||||||
|
case "enter": {
|
||||||
|
element.addEventListener("keydown", (e) => {
|
||||||
|
if ((e as KeyboardEvent).key != "Enter") return;
|
||||||
|
value();
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
element.addEventListener(directiveValue, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "subscribe": {
|
||||||
|
if (directiveValue == "children") {
|
||||||
|
try {
|
||||||
|
const [listState, toElement] = value as [
|
||||||
|
listState: ListState<any>,
|
||||||
|
(
|
||||||
|
item: any,
|
||||||
|
listState: ListState<any>
|
||||||
|
) => HTMLElement
|
||||||
|
];
|
||||||
|
|
||||||
|
listState.handleAddition((newItem) => {
|
||||||
|
const child = toElement(newItem, listState);
|
||||||
|
listState.handleRemoval(newItem, () =>
|
||||||
|
child.remove()
|
||||||
|
);
|
||||||
|
element.append(child);
|
||||||
|
});
|
||||||
|
} catch {
|
||||||
|
throw `error: cannot process subscribe:children directive because ListItemConverter is not defined. Usage: "subscribe:children={[list, converter]}"; you can find a more detailed example in the documentation`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const state = value as State<any>;
|
||||||
|
state.subscribe(
|
||||||
|
(newValue) => (element[directiveValue] = newValue)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "bind": {
|
||||||
|
const state = value as State<any>;
|
||||||
|
state.subscribe(
|
||||||
|
(newValue) => (element[directiveValue] = newValue)
|
||||||
|
);
|
||||||
|
element.addEventListener(
|
||||||
|
"input",
|
||||||
|
() => (state.value = (element as any)[directiveValue])
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "toggle": {
|
||||||
|
const state = value as State<any>;
|
||||||
|
state.subscribe((newValue) =>
|
||||||
|
element.toggleAttribute(directiveValue, newValue)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
element.setAttribute(attributename, value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
children.filter((x) => x).forEach((child) => element.append(child));
|
||||||
|
|
||||||
|
return element;
|
||||||
|
}
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "bloatless-react",
|
||||||
|
"version": "1.2.0",
|
||||||
|
"description": "very minimal and flexible react alternative",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/marlon-erler/bloatless-react"
|
||||||
|
},
|
||||||
|
"author": "marlon-erler",
|
||||||
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
|
"dependencies": {
|
||||||
|
"uuid": "^10.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Evan Wallace
|
||||||
|
|
||||||
|
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.
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
# esbuild
|
||||||
|
|
||||||
|
This is a JavaScript bundler and minifier. See https://github.com/evanw/esbuild and the [JavaScript API documentation](https://esbuild.github.io/api/) for details.
|
||||||
BIN
Binary file not shown.
+286
@@ -0,0 +1,286 @@
|
|||||||
|
"use strict";
|
||||||
|
var __create = Object.create;
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __getProtoOf = Object.getPrototypeOf;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __copyProps = (to, from, except, desc) => {
|
||||||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||||||
|
for (let key of __getOwnPropNames(from))
|
||||||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||||
|
// If the importer is in node compatibility mode or this is not an ESM
|
||||||
|
// file that has been converted to a CommonJS file using a Babel-
|
||||||
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||||
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||||
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||||
|
mod
|
||||||
|
));
|
||||||
|
|
||||||
|
// lib/npm/node-platform.ts
|
||||||
|
var fs = require("fs");
|
||||||
|
var os = require("os");
|
||||||
|
var path = require("path");
|
||||||
|
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
||||||
|
var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
|
||||||
|
var knownWindowsPackages = {
|
||||||
|
"win32 arm64 LE": "@esbuild/win32-arm64",
|
||||||
|
"win32 ia32 LE": "@esbuild/win32-ia32",
|
||||||
|
"win32 x64 LE": "@esbuild/win32-x64"
|
||||||
|
};
|
||||||
|
var knownUnixlikePackages = {
|
||||||
|
"aix ppc64 BE": "@esbuild/aix-ppc64",
|
||||||
|
"android arm64 LE": "@esbuild/android-arm64",
|
||||||
|
"darwin arm64 LE": "@esbuild/darwin-arm64",
|
||||||
|
"darwin x64 LE": "@esbuild/darwin-x64",
|
||||||
|
"freebsd arm64 LE": "@esbuild/freebsd-arm64",
|
||||||
|
"freebsd x64 LE": "@esbuild/freebsd-x64",
|
||||||
|
"linux arm LE": "@esbuild/linux-arm",
|
||||||
|
"linux arm64 LE": "@esbuild/linux-arm64",
|
||||||
|
"linux ia32 LE": "@esbuild/linux-ia32",
|
||||||
|
"linux mips64el LE": "@esbuild/linux-mips64el",
|
||||||
|
"linux ppc64 LE": "@esbuild/linux-ppc64",
|
||||||
|
"linux riscv64 LE": "@esbuild/linux-riscv64",
|
||||||
|
"linux s390x BE": "@esbuild/linux-s390x",
|
||||||
|
"linux x64 LE": "@esbuild/linux-x64",
|
||||||
|
"linux loong64 LE": "@esbuild/linux-loong64",
|
||||||
|
"netbsd x64 LE": "@esbuild/netbsd-x64",
|
||||||
|
"openbsd arm64 LE": "@esbuild/openbsd-arm64",
|
||||||
|
"openbsd x64 LE": "@esbuild/openbsd-x64",
|
||||||
|
"sunos x64 LE": "@esbuild/sunos-x64"
|
||||||
|
};
|
||||||
|
var knownWebAssemblyFallbackPackages = {
|
||||||
|
"android arm LE": "@esbuild/android-arm",
|
||||||
|
"android x64 LE": "@esbuild/android-x64"
|
||||||
|
};
|
||||||
|
function pkgAndSubpathForCurrentPlatform() {
|
||||||
|
let pkg;
|
||||||
|
let subpath;
|
||||||
|
let isWASM = false;
|
||||||
|
let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
|
||||||
|
if (platformKey in knownWindowsPackages) {
|
||||||
|
pkg = knownWindowsPackages[platformKey];
|
||||||
|
subpath = "esbuild.exe";
|
||||||
|
} else if (platformKey in knownUnixlikePackages) {
|
||||||
|
pkg = knownUnixlikePackages[platformKey];
|
||||||
|
subpath = "bin/esbuild";
|
||||||
|
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
||||||
|
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
||||||
|
subpath = "bin/esbuild";
|
||||||
|
isWASM = true;
|
||||||
|
} else {
|
||||||
|
throw new Error(`Unsupported platform: ${platformKey}`);
|
||||||
|
}
|
||||||
|
return { pkg, subpath, isWASM };
|
||||||
|
}
|
||||||
|
function downloadedBinPath(pkg, subpath) {
|
||||||
|
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
||||||
|
return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// lib/npm/node-install.ts
|
||||||
|
var fs2 = require("fs");
|
||||||
|
var os2 = require("os");
|
||||||
|
var path2 = require("path");
|
||||||
|
var zlib = require("zlib");
|
||||||
|
var https = require("https");
|
||||||
|
var child_process = require("child_process");
|
||||||
|
var versionFromPackageJSON = require(path2.join(__dirname, "package.json")).version;
|
||||||
|
var toPath = path2.join(__dirname, "bin", "esbuild");
|
||||||
|
var isToPathJS = true;
|
||||||
|
function validateBinaryVersion(...command) {
|
||||||
|
command.push("--version");
|
||||||
|
let stdout;
|
||||||
|
try {
|
||||||
|
stdout = child_process.execFileSync(command.shift(), command, {
|
||||||
|
// Without this, this install script strangely crashes with the error
|
||||||
|
// "EACCES: permission denied, write" but only on Ubuntu Linux when node is
|
||||||
|
// installed from the Snap Store. This is not a problem when you download
|
||||||
|
// the official version of node. The problem appears to be that stderr
|
||||||
|
// (i.e. file descriptor 2) isn't writable?
|
||||||
|
//
|
||||||
|
// More info:
|
||||||
|
// - https://snapcraft.io/ (what the Snap Store is)
|
||||||
|
// - https://nodejs.org/dist/ (download the official version of node)
|
||||||
|
// - https://github.com/evanw/esbuild/issues/1711#issuecomment-1027554035
|
||||||
|
//
|
||||||
|
stdio: "pipe"
|
||||||
|
}).toString().trim();
|
||||||
|
} catch (err) {
|
||||||
|
if (os2.platform() === "darwin" && /_SecTrustEvaluateWithError/.test(err + "")) {
|
||||||
|
let os3 = "this version of macOS";
|
||||||
|
try {
|
||||||
|
os3 = "macOS " + child_process.execFileSync("sw_vers", ["-productVersion"]).toString().trim();
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
throw new Error(`The "esbuild" package cannot be installed because ${os3} is too outdated.
|
||||||
|
|
||||||
|
The Go compiler (which esbuild relies on) no longer supports ${os3},
|
||||||
|
which means the "esbuild" binary executable can't be run. You can either:
|
||||||
|
|
||||||
|
* Update your version of macOS to one that the Go compiler supports
|
||||||
|
* Use the "esbuild-wasm" package instead of the "esbuild" package
|
||||||
|
* Build esbuild yourself using an older version of the Go compiler
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
if (stdout !== versionFromPackageJSON) {
|
||||||
|
throw new Error(`Expected ${JSON.stringify(versionFromPackageJSON)} but got ${JSON.stringify(stdout)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function isYarn() {
|
||||||
|
const { npm_config_user_agent } = process.env;
|
||||||
|
if (npm_config_user_agent) {
|
||||||
|
return /\byarn\//.test(npm_config_user_agent);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function fetch(url) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
https.get(url, (res) => {
|
||||||
|
if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location)
|
||||||
|
return fetch(res.headers.location).then(resolve, reject);
|
||||||
|
if (res.statusCode !== 200)
|
||||||
|
return reject(new Error(`Server responded with ${res.statusCode}`));
|
||||||
|
let chunks = [];
|
||||||
|
res.on("data", (chunk) => chunks.push(chunk));
|
||||||
|
res.on("end", () => resolve(Buffer.concat(chunks)));
|
||||||
|
}).on("error", reject);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function extractFileFromTarGzip(buffer, subpath) {
|
||||||
|
try {
|
||||||
|
buffer = zlib.unzipSync(buffer);
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`);
|
||||||
|
}
|
||||||
|
let str = (i, n) => String.fromCharCode(...buffer.subarray(i, i + n)).replace(/\0.*$/, "");
|
||||||
|
let offset = 0;
|
||||||
|
subpath = `package/${subpath}`;
|
||||||
|
while (offset < buffer.length) {
|
||||||
|
let name = str(offset, 100);
|
||||||
|
let size = parseInt(str(offset + 124, 12), 8);
|
||||||
|
offset += 512;
|
||||||
|
if (!isNaN(size)) {
|
||||||
|
if (name === subpath) return buffer.subarray(offset, offset + size);
|
||||||
|
offset += size + 511 & ~511;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`);
|
||||||
|
}
|
||||||
|
function installUsingNPM(pkg, subpath, binPath) {
|
||||||
|
const env = { ...process.env, npm_config_global: void 0 };
|
||||||
|
const esbuildLibDir = path2.dirname(require.resolve("esbuild"));
|
||||||
|
const installDir = path2.join(esbuildLibDir, "npm-install");
|
||||||
|
fs2.mkdirSync(installDir);
|
||||||
|
try {
|
||||||
|
fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
|
||||||
|
child_process.execSync(
|
||||||
|
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${versionFromPackageJSON}`,
|
||||||
|
{ cwd: installDir, stdio: "pipe", env }
|
||||||
|
);
|
||||||
|
const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
|
||||||
|
fs2.renameSync(installedBinPath, binPath);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
removeRecursive(installDir);
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function removeRecursive(dir) {
|
||||||
|
for (const entry of fs2.readdirSync(dir)) {
|
||||||
|
const entryPath = path2.join(dir, entry);
|
||||||
|
let stats;
|
||||||
|
try {
|
||||||
|
stats = fs2.lstatSync(entryPath);
|
||||||
|
} catch {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (stats.isDirectory()) removeRecursive(entryPath);
|
||||||
|
else fs2.unlinkSync(entryPath);
|
||||||
|
}
|
||||||
|
fs2.rmdirSync(dir);
|
||||||
|
}
|
||||||
|
function applyManualBinaryPathOverride(overridePath) {
|
||||||
|
const pathString = JSON.stringify(overridePath);
|
||||||
|
fs2.writeFileSync(toPath, `#!/usr/bin/env node
|
||||||
|
require('child_process').execFileSync(${pathString}, process.argv.slice(2), { stdio: 'inherit' });
|
||||||
|
`);
|
||||||
|
const libMain = path2.join(__dirname, "lib", "main.js");
|
||||||
|
const code = fs2.readFileSync(libMain, "utf8");
|
||||||
|
fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString};
|
||||||
|
${code}`);
|
||||||
|
}
|
||||||
|
function maybeOptimizePackage(binPath) {
|
||||||
|
if (os2.platform() !== "win32" && !isYarn()) {
|
||||||
|
const tempPath = path2.join(__dirname, "bin-esbuild");
|
||||||
|
try {
|
||||||
|
fs2.linkSync(binPath, tempPath);
|
||||||
|
fs2.renameSync(tempPath, toPath);
|
||||||
|
isToPathJS = false;
|
||||||
|
fs2.unlinkSync(tempPath);
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
|
||||||
|
const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${versionFromPackageJSON}.tgz`;
|
||||||
|
console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
|
||||||
|
try {
|
||||||
|
fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
|
||||||
|
fs2.chmodSync(binPath, 493);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function checkAndPreparePackage() {
|
||||||
|
if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
|
||||||
|
if (!fs2.existsSync(ESBUILD_BINARY_PATH)) {
|
||||||
|
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
|
||||||
|
} else {
|
||||||
|
applyManualBinaryPathOverride(ESBUILD_BINARY_PATH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
|
||||||
|
let binPath;
|
||||||
|
try {
|
||||||
|
binPath = require.resolve(`${pkg}/${subpath}`);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`[esbuild] Failed to find package "${pkg}" on the file system
|
||||||
|
|
||||||
|
This can happen if you use the "--no-optional" flag. The "optionalDependencies"
|
||||||
|
package.json feature is used by esbuild to install the correct binary executable
|
||||||
|
for your current platform. This install script will now attempt to work around
|
||||||
|
this. If that fails, you need to remove the "--no-optional" flag to use esbuild.
|
||||||
|
`);
|
||||||
|
binPath = downloadedBinPath(pkg, subpath);
|
||||||
|
try {
|
||||||
|
console.error(`[esbuild] Trying to install package "${pkg}" using npm`);
|
||||||
|
installUsingNPM(pkg, subpath, binPath);
|
||||||
|
} catch (e2) {
|
||||||
|
console.error(`[esbuild] Failed to install package "${pkg}" using npm: ${e2 && e2.message || e2}`);
|
||||||
|
try {
|
||||||
|
await downloadDirectlyFromNPM(pkg, subpath, binPath);
|
||||||
|
} catch (e3) {
|
||||||
|
throw new Error(`Failed to install package "${pkg}"`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maybeOptimizePackage(binPath);
|
||||||
|
}
|
||||||
|
checkAndPreparePackage().then(() => {
|
||||||
|
if (isToPathJS) {
|
||||||
|
validateBinaryVersion(process.execPath, toPath);
|
||||||
|
} else {
|
||||||
|
validateBinaryVersion(toPath);
|
||||||
|
}
|
||||||
|
});
|
||||||
+705
@@ -0,0 +1,705 @@
|
|||||||
|
export type Platform = 'browser' | 'node' | 'neutral'
|
||||||
|
export type Format = 'iife' | 'cjs' | 'esm'
|
||||||
|
export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx'
|
||||||
|
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
||||||
|
export type Charset = 'ascii' | 'utf8'
|
||||||
|
export type Drop = 'console' | 'debugger'
|
||||||
|
|
||||||
|
interface CommonOptions {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
||||||
|
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#legal-comments */
|
||||||
|
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#source-root */
|
||||||
|
sourceRoot?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#sources-content */
|
||||||
|
sourcesContent?: boolean
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#format */
|
||||||
|
format?: Format
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#global-name */
|
||||||
|
globalName?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#target */
|
||||||
|
target?: string | string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#supported */
|
||||||
|
supported?: Record<string, boolean>
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#platform */
|
||||||
|
platform?: Platform
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
mangleProps?: RegExp
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
reserveProps?: RegExp
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
mangleQuoted?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
mangleCache?: Record<string, string | false>
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#drop */
|
||||||
|
drop?: Drop[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#drop-labels */
|
||||||
|
dropLabels?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minify?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minifyWhitespace?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minifyIdentifiers?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minifySyntax?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#line-limit */
|
||||||
|
lineLimit?: number
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#charset */
|
||||||
|
charset?: Charset
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#tree-shaking */
|
||||||
|
treeShaking?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#ignore-annotations */
|
||||||
|
ignoreAnnotations?: boolean
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx */
|
||||||
|
jsx?: 'transform' | 'preserve' | 'automatic'
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-factory */
|
||||||
|
jsxFactory?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-fragment */
|
||||||
|
jsxFragment?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-import-source */
|
||||||
|
jsxImportSource?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-development */
|
||||||
|
jsxDev?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-side-effects */
|
||||||
|
jsxSideEffects?: boolean
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#define */
|
||||||
|
define?: { [key: string]: string }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#pure */
|
||||||
|
pure?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#keep-names */
|
||||||
|
keepNames?: boolean
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#color */
|
||||||
|
color?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#log-level */
|
||||||
|
logLevel?: LogLevel
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#log-limit */
|
||||||
|
logLimit?: number
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#log-override */
|
||||||
|
logOverride?: Record<string, LogLevel>
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#tsconfig-raw */
|
||||||
|
tsconfigRaw?: string | TsconfigRaw
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TsconfigRaw {
|
||||||
|
compilerOptions?: {
|
||||||
|
alwaysStrict?: boolean
|
||||||
|
baseUrl?: string
|
||||||
|
experimentalDecorators?: boolean
|
||||||
|
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error'
|
||||||
|
jsx?: 'preserve' | 'react-native' | 'react' | 'react-jsx' | 'react-jsxdev'
|
||||||
|
jsxFactory?: string
|
||||||
|
jsxFragmentFactory?: string
|
||||||
|
jsxImportSource?: string
|
||||||
|
paths?: Record<string, string[]>
|
||||||
|
preserveValueImports?: boolean
|
||||||
|
strict?: boolean
|
||||||
|
target?: string
|
||||||
|
useDefineForClassFields?: boolean
|
||||||
|
verbatimModuleSyntax?: boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildOptions extends CommonOptions {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#bundle */
|
||||||
|
bundle?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#splitting */
|
||||||
|
splitting?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#preserve-symlinks */
|
||||||
|
preserveSymlinks?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#outfile */
|
||||||
|
outfile?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#metafile */
|
||||||
|
metafile?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#outdir */
|
||||||
|
outdir?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#outbase */
|
||||||
|
outbase?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#external */
|
||||||
|
external?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#packages */
|
||||||
|
packages?: 'bundle' | 'external'
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#alias */
|
||||||
|
alias?: Record<string, string>
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#loader */
|
||||||
|
loader?: { [ext: string]: Loader }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
||||||
|
resolveExtensions?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
||||||
|
mainFields?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#conditions */
|
||||||
|
conditions?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#write */
|
||||||
|
write?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#allow-overwrite */
|
||||||
|
allowOverwrite?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#tsconfig */
|
||||||
|
tsconfig?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#out-extension */
|
||||||
|
outExtension?: { [ext: string]: string }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#public-path */
|
||||||
|
publicPath?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#entry-names */
|
||||||
|
entryNames?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#chunk-names */
|
||||||
|
chunkNames?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#asset-names */
|
||||||
|
assetNames?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#inject */
|
||||||
|
inject?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#banner */
|
||||||
|
banner?: { [type: string]: string }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#footer */
|
||||||
|
footer?: { [type: string]: string }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#entry-points */
|
||||||
|
entryPoints?: string[] | Record<string, string> | { in: string, out: string }[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#stdin */
|
||||||
|
stdin?: StdinOptions
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/ */
|
||||||
|
plugins?: Plugin[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#working-directory */
|
||||||
|
absWorkingDir?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#node-paths */
|
||||||
|
nodePaths?: string[]; // The "NODE_PATH" variable from Node.js
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StdinOptions {
|
||||||
|
contents: string | Uint8Array
|
||||||
|
resolveDir?: string
|
||||||
|
sourcefile?: string
|
||||||
|
loader?: Loader
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Message {
|
||||||
|
id: string
|
||||||
|
pluginName: string
|
||||||
|
text: string
|
||||||
|
location: Location | null
|
||||||
|
notes: Note[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional user-specified data that is passed through unmodified. You can
|
||||||
|
* use this to stash the original error, for example.
|
||||||
|
*/
|
||||||
|
detail: any
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Note {
|
||||||
|
text: string
|
||||||
|
location: Location | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Location {
|
||||||
|
file: string
|
||||||
|
namespace: string
|
||||||
|
/** 1-based */
|
||||||
|
line: number
|
||||||
|
/** 0-based, in bytes */
|
||||||
|
column: number
|
||||||
|
/** in bytes */
|
||||||
|
length: number
|
||||||
|
lineText: string
|
||||||
|
suggestion: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OutputFile {
|
||||||
|
path: string
|
||||||
|
contents: Uint8Array
|
||||||
|
hash: string
|
||||||
|
/** "contents" as text (changes automatically with "contents") */
|
||||||
|
readonly text: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildResult<ProvidedOptions extends BuildOptions = BuildOptions> {
|
||||||
|
errors: Message[]
|
||||||
|
warnings: Message[]
|
||||||
|
/** Only when "write: false" */
|
||||||
|
outputFiles: OutputFile[] | (ProvidedOptions['write'] extends false ? never : undefined)
|
||||||
|
/** Only when "metafile: true" */
|
||||||
|
metafile: Metafile | (ProvidedOptions['metafile'] extends true ? never : undefined)
|
||||||
|
/** Only when "mangleCache" is present */
|
||||||
|
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildFailure extends Error {
|
||||||
|
errors: Message[]
|
||||||
|
warnings: Message[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#serve-arguments */
|
||||||
|
export interface ServeOptions {
|
||||||
|
port?: number
|
||||||
|
host?: string
|
||||||
|
servedir?: string
|
||||||
|
keyfile?: string
|
||||||
|
certfile?: string
|
||||||
|
fallback?: string
|
||||||
|
onRequest?: (args: ServeOnRequestArgs) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ServeOnRequestArgs {
|
||||||
|
remoteAddress: string
|
||||||
|
method: string
|
||||||
|
path: string
|
||||||
|
status: number
|
||||||
|
/** The time to generate the response, not to send it */
|
||||||
|
timeInMS: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#serve-return-values */
|
||||||
|
export interface ServeResult {
|
||||||
|
port: number
|
||||||
|
host: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TransformOptions extends CommonOptions {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#sourcefile */
|
||||||
|
sourcefile?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#loader */
|
||||||
|
loader?: Loader
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#banner */
|
||||||
|
banner?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#footer */
|
||||||
|
footer?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TransformResult<ProvidedOptions extends TransformOptions = TransformOptions> {
|
||||||
|
code: string
|
||||||
|
map: string
|
||||||
|
warnings: Message[]
|
||||||
|
/** Only when "mangleCache" is present */
|
||||||
|
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
||||||
|
/** Only when "legalComments" is "external" */
|
||||||
|
legalComments: string | (ProvidedOptions['legalComments'] extends 'external' ? never : undefined)
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TransformFailure extends Error {
|
||||||
|
errors: Message[]
|
||||||
|
warnings: Message[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Plugin {
|
||||||
|
name: string
|
||||||
|
setup: (build: PluginBuild) => (void | Promise<void>)
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginBuild {
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#build-options */
|
||||||
|
initialOptions: BuildOptions
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#resolve */
|
||||||
|
resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-start */
|
||||||
|
onStart(callback: () =>
|
||||||
|
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-end */
|
||||||
|
onEnd(callback: (result: BuildResult) =>
|
||||||
|
(OnEndResult | null | void | Promise<OnEndResult | null | void>)): void
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-resolve */
|
||||||
|
onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
|
||||||
|
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-load */
|
||||||
|
onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
|
||||||
|
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-dispose */
|
||||||
|
onDispose(callback: () => void): void
|
||||||
|
|
||||||
|
// This is a full copy of the esbuild library in case you need it
|
||||||
|
esbuild: {
|
||||||
|
context: typeof context,
|
||||||
|
build: typeof build,
|
||||||
|
buildSync: typeof buildSync,
|
||||||
|
transform: typeof transform,
|
||||||
|
transformSync: typeof transformSync,
|
||||||
|
formatMessages: typeof formatMessages,
|
||||||
|
formatMessagesSync: typeof formatMessagesSync,
|
||||||
|
analyzeMetafile: typeof analyzeMetafile,
|
||||||
|
analyzeMetafileSync: typeof analyzeMetafileSync,
|
||||||
|
initialize: typeof initialize,
|
||||||
|
version: typeof version,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#resolve-options */
|
||||||
|
export interface ResolveOptions {
|
||||||
|
pluginName?: string
|
||||||
|
importer?: string
|
||||||
|
namespace?: string
|
||||||
|
resolveDir?: string
|
||||||
|
kind?: ImportKind
|
||||||
|
pluginData?: any
|
||||||
|
with?: Record<string, string>
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#resolve-results */
|
||||||
|
export interface ResolveResult {
|
||||||
|
errors: Message[]
|
||||||
|
warnings: Message[]
|
||||||
|
|
||||||
|
path: string
|
||||||
|
external: boolean
|
||||||
|
sideEffects: boolean
|
||||||
|
namespace: string
|
||||||
|
suffix: string
|
||||||
|
pluginData: any
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OnStartResult {
|
||||||
|
errors?: PartialMessage[]
|
||||||
|
warnings?: PartialMessage[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OnEndResult {
|
||||||
|
errors?: PartialMessage[]
|
||||||
|
warnings?: PartialMessage[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-options */
|
||||||
|
export interface OnResolveOptions {
|
||||||
|
filter: RegExp
|
||||||
|
namespace?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-arguments */
|
||||||
|
export interface OnResolveArgs {
|
||||||
|
path: string
|
||||||
|
importer: string
|
||||||
|
namespace: string
|
||||||
|
resolveDir: string
|
||||||
|
kind: ImportKind
|
||||||
|
pluginData: any
|
||||||
|
with: Record<string, string>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ImportKind =
|
||||||
|
| 'entry-point'
|
||||||
|
|
||||||
|
// JS
|
||||||
|
| 'import-statement'
|
||||||
|
| 'require-call'
|
||||||
|
| 'dynamic-import'
|
||||||
|
| 'require-resolve'
|
||||||
|
|
||||||
|
// CSS
|
||||||
|
| 'import-rule'
|
||||||
|
| 'composes-from'
|
||||||
|
| 'url-token'
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */
|
||||||
|
export interface OnResolveResult {
|
||||||
|
pluginName?: string
|
||||||
|
|
||||||
|
errors?: PartialMessage[]
|
||||||
|
warnings?: PartialMessage[]
|
||||||
|
|
||||||
|
path?: string
|
||||||
|
external?: boolean
|
||||||
|
sideEffects?: boolean
|
||||||
|
namespace?: string
|
||||||
|
suffix?: string
|
||||||
|
pluginData?: any
|
||||||
|
|
||||||
|
watchFiles?: string[]
|
||||||
|
watchDirs?: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-load-options */
|
||||||
|
export interface OnLoadOptions {
|
||||||
|
filter: RegExp
|
||||||
|
namespace?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-load-arguments */
|
||||||
|
export interface OnLoadArgs {
|
||||||
|
path: string
|
||||||
|
namespace: string
|
||||||
|
suffix: string
|
||||||
|
pluginData: any
|
||||||
|
with: Record<string, string>
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-load-results */
|
||||||
|
export interface OnLoadResult {
|
||||||
|
pluginName?: string
|
||||||
|
|
||||||
|
errors?: PartialMessage[]
|
||||||
|
warnings?: PartialMessage[]
|
||||||
|
|
||||||
|
contents?: string | Uint8Array
|
||||||
|
resolveDir?: string
|
||||||
|
loader?: Loader
|
||||||
|
pluginData?: any
|
||||||
|
|
||||||
|
watchFiles?: string[]
|
||||||
|
watchDirs?: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PartialMessage {
|
||||||
|
id?: string
|
||||||
|
pluginName?: string
|
||||||
|
text?: string
|
||||||
|
location?: Partial<Location> | null
|
||||||
|
notes?: PartialNote[]
|
||||||
|
detail?: any
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PartialNote {
|
||||||
|
text?: string
|
||||||
|
location?: Partial<Location> | null
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#metafile */
|
||||||
|
export interface Metafile {
|
||||||
|
inputs: {
|
||||||
|
[path: string]: {
|
||||||
|
bytes: number
|
||||||
|
imports: {
|
||||||
|
path: string
|
||||||
|
kind: ImportKind
|
||||||
|
external?: boolean
|
||||||
|
original?: string
|
||||||
|
with?: Record<string, string>
|
||||||
|
}[]
|
||||||
|
format?: 'cjs' | 'esm'
|
||||||
|
with?: Record<string, string>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outputs: {
|
||||||
|
[path: string]: {
|
||||||
|
bytes: number
|
||||||
|
inputs: {
|
||||||
|
[path: string]: {
|
||||||
|
bytesInOutput: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
imports: {
|
||||||
|
path: string
|
||||||
|
kind: ImportKind | 'file-loader'
|
||||||
|
external?: boolean
|
||||||
|
}[]
|
||||||
|
exports: string[]
|
||||||
|
entryPoint?: string
|
||||||
|
cssBundle?: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FormatMessagesOptions {
|
||||||
|
kind: 'error' | 'warning'
|
||||||
|
color?: boolean
|
||||||
|
terminalWidth?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AnalyzeMetafileOptions {
|
||||||
|
color?: boolean
|
||||||
|
verbose?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WatchOptions {
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildContext<ProvidedOptions extends BuildOptions = BuildOptions> {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#rebuild */
|
||||||
|
rebuild(): Promise<BuildResult<ProvidedOptions>>
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#watch */
|
||||||
|
watch(options?: WatchOptions): Promise<void>
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#serve */
|
||||||
|
serve(options?: ServeOptions): Promise<ServeResult>
|
||||||
|
|
||||||
|
cancel(): Promise<void>
|
||||||
|
dispose(): Promise<void>
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is a TypeScript type-level function which replaces any keys in "In"
|
||||||
|
// that aren't in "Out" with "never". We use this to reject properties with
|
||||||
|
// typos in object literals. See: https://stackoverflow.com/questions/49580725
|
||||||
|
type SameShape<Out, In extends Out> = In & { [Key in Exclude<keyof In, keyof Out>]: never }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function invokes the "esbuild" command-line tool for you. It returns a
|
||||||
|
* promise that either resolves with a "BuildResult" object or rejects with a
|
||||||
|
* "BuildFailure" object.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#build
|
||||||
|
*/
|
||||||
|
export declare function build<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildResult<T>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the advanced long-running form of "build" that supports additional
|
||||||
|
* features such as watch mode and a local development server.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#build
|
||||||
|
*/
|
||||||
|
export declare function context<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildContext<T>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function transforms a single JavaScript file. It can be used to minify
|
||||||
|
* JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript
|
||||||
|
* to older JavaScript. It returns a promise that is either resolved with a
|
||||||
|
* "TransformResult" object or rejected with a "TransformFailure" object.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#transform
|
||||||
|
*/
|
||||||
|
export declare function transform<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): Promise<TransformResult<T>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts log messages to formatted message strings suitable for printing in
|
||||||
|
* the terminal. This allows you to reuse the built-in behavior of esbuild's
|
||||||
|
* log message formatter. This is a batch-oriented API for efficiency.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*/
|
||||||
|
export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pretty-prints an analysis of the metafile JSON to a string. This is just for
|
||||||
|
* convenience to be able to match esbuild's pretty-printing exactly. If you want
|
||||||
|
* to customize it, you can just inspect the data in the metafile yourself.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#analyze
|
||||||
|
*/
|
||||||
|
export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "build".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#build
|
||||||
|
*/
|
||||||
|
export declare function buildSync<T extends BuildOptions>(options: SameShape<BuildOptions, T>): BuildResult<T>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "transform".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#transform
|
||||||
|
*/
|
||||||
|
export declare function transformSync<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): TransformResult<T>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "formatMessages".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*/
|
||||||
|
export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "analyzeMetafile".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#analyze
|
||||||
|
*/
|
||||||
|
export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This configures the browser-based version of esbuild. It is necessary to
|
||||||
|
* call this first and wait for the returned promise to be resolved before
|
||||||
|
* making other API calls when using esbuild in the browser.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes ("options" is required)
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#browser
|
||||||
|
*/
|
||||||
|
export declare function initialize(options: InitializeOptions): Promise<void>
|
||||||
|
|
||||||
|
export interface InitializeOptions {
|
||||||
|
/**
|
||||||
|
* The URL of the "esbuild.wasm" file. This must be provided when running
|
||||||
|
* esbuild in the browser.
|
||||||
|
*/
|
||||||
|
wasmURL?: string | URL
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The result of calling "new WebAssembly.Module(buffer)" where "buffer"
|
||||||
|
* is a typed array or ArrayBuffer containing the binary code of the
|
||||||
|
* "esbuild.wasm" file.
|
||||||
|
*
|
||||||
|
* You can use this as an alternative to "wasmURL" for environments where it's
|
||||||
|
* not possible to download the WebAssembly module.
|
||||||
|
*/
|
||||||
|
wasmModule?: WebAssembly.Module
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default esbuild runs the WebAssembly-based browser API in a web worker
|
||||||
|
* to avoid blocking the UI thread. This can be disabled by setting "worker"
|
||||||
|
* to false.
|
||||||
|
*/
|
||||||
|
worker?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export let version: string
|
||||||
|
|
||||||
|
// Call this function to terminate esbuild's child process. The child process
|
||||||
|
// is not terminated and re-created after each API call because it's more
|
||||||
|
// efficient to keep it around when there are multiple API calls.
|
||||||
|
//
|
||||||
|
// In node this happens automatically before the parent node process exits. So
|
||||||
|
// you only need to call this if you know you will not make any more esbuild
|
||||||
|
// API calls and you want to clean up resources.
|
||||||
|
//
|
||||||
|
// Unlike node, Deno lacks the necessary APIs to clean up child processes
|
||||||
|
// automatically. You must manually call stop() in Deno when you're done
|
||||||
|
// using esbuild or Deno will continue running forever.
|
||||||
|
//
|
||||||
|
// Another reason you might want to call this is if you are using esbuild from
|
||||||
|
// within a Deno test. Deno fails tests that create a child process without
|
||||||
|
// killing it before the test ends, so you have to call this function (and
|
||||||
|
// await the returned promise) in every Deno test that uses esbuild.
|
||||||
|
export declare function stop(): Promise<void>
|
||||||
|
|
||||||
|
// Note: These declarations exist to avoid type errors when you omit "dom" from
|
||||||
|
// "lib" in your "tsconfig.json" file. TypeScript confusingly declares the
|
||||||
|
// global "WebAssembly" type in "lib.dom.d.ts" even though it has nothing to do
|
||||||
|
// with the browser DOM and is present in many non-browser JavaScript runtimes
|
||||||
|
// (e.g. node and deno). Declaring it here allows esbuild's API to be used in
|
||||||
|
// these scenarios.
|
||||||
|
//
|
||||||
|
// There's an open issue about getting this problem corrected (although these
|
||||||
|
// declarations will need to remain even if this is fixed for backward
|
||||||
|
// compatibility with older TypeScript versions):
|
||||||
|
//
|
||||||
|
// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826
|
||||||
|
//
|
||||||
|
declare global {
|
||||||
|
namespace WebAssembly {
|
||||||
|
interface Module {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
interface URL {
|
||||||
|
}
|
||||||
|
}
|
||||||
+2240
File diff suppressed because it is too large
Load Diff
+47
@@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"name": "esbuild",
|
||||||
|
"version": "0.23.0",
|
||||||
|
"description": "An extremely fast JavaScript and CSS bundler and minifier.",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/evanw/esbuild.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postinstall": "node install.js"
|
||||||
|
},
|
||||||
|
"main": "lib/main.js",
|
||||||
|
"types": "lib/main.d.ts",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"esbuild": "bin/esbuild"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@esbuild/aix-ppc64": "0.23.0",
|
||||||
|
"@esbuild/android-arm": "0.23.0",
|
||||||
|
"@esbuild/android-arm64": "0.23.0",
|
||||||
|
"@esbuild/android-x64": "0.23.0",
|
||||||
|
"@esbuild/darwin-arm64": "0.23.0",
|
||||||
|
"@esbuild/darwin-x64": "0.23.0",
|
||||||
|
"@esbuild/freebsd-arm64": "0.23.0",
|
||||||
|
"@esbuild/freebsd-x64": "0.23.0",
|
||||||
|
"@esbuild/linux-arm": "0.23.0",
|
||||||
|
"@esbuild/linux-arm64": "0.23.0",
|
||||||
|
"@esbuild/linux-ia32": "0.23.0",
|
||||||
|
"@esbuild/linux-loong64": "0.23.0",
|
||||||
|
"@esbuild/linux-mips64el": "0.23.0",
|
||||||
|
"@esbuild/linux-ppc64": "0.23.0",
|
||||||
|
"@esbuild/linux-riscv64": "0.23.0",
|
||||||
|
"@esbuild/linux-s390x": "0.23.0",
|
||||||
|
"@esbuild/linux-x64": "0.23.0",
|
||||||
|
"@esbuild/netbsd-x64": "0.23.0",
|
||||||
|
"@esbuild/openbsd-arm64": "0.23.0",
|
||||||
|
"@esbuild/openbsd-x64": "0.23.0",
|
||||||
|
"@esbuild/sunos-x64": "0.23.0",
|
||||||
|
"@esbuild/win32-arm64": "0.23.0",
|
||||||
|
"@esbuild/win32-ia32": "0.23.0",
|
||||||
|
"@esbuild/win32-x64": "0.23.0"
|
||||||
|
},
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
+292
@@ -0,0 +1,292 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
## [10.0.0](https://github.com/uuidjs/uuid/compare/v9.0.0...v10.0.0) (2024-06-07)
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
- update node support (drop node@12, node@14, add node@20) (#750)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- support support rfc9562 MAX uuid (new in RFC9562) ([#714](https://github.com/uuidjs/uuid/issues/714)) ([0385cd3](https://github.com/uuidjs/uuid/commit/0385cd3f18ae9920678b2849932fa7a9d9aee7d0))
|
||||||
|
- support rfc9562 v6 uuids ([#754](https://github.com/uuidjs/uuid/issues/754)) ([c4ed13e](https://github.com/uuidjs/uuid/commit/c4ed13e7159d87c9e42a349bdd9dc955f1af46b6))
|
||||||
|
- support rfc9562 v7 uuids ([#681](https://github.com/uuidjs/uuid/issues/681)) ([db76a12](https://github.com/uuidjs/uuid/commit/db76a1284760c441438f50a57924b322dae08891))
|
||||||
|
- update node support matrix (only support node 16-20) ([#750](https://github.com/uuidjs/uuid/issues/750)) ([883b163](https://github.com/uuidjs/uuid/commit/883b163b9ab9d6655bfbd8a35e61a3c71674dfe1))
|
||||||
|
- support rfc9562 v8 uuids ([#759](https://github.com/uuidjs/uuid/issues/759)) ([35a5342](https://github.com/uuidjs/uuid/commit/35a53428202657e402e6b4aa68f56c08194541bf))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- revert "perf: remove superfluous call to toLowerCase ([#677](https://github.com/uuidjs/uuid/issues/677))" ([#738](https://github.com/uuidjs/uuid/issues/738)) ([e267b90](https://github.com/uuidjs/uuid/commit/e267b9073df1d0ce119ee53c0487fe76acb2be37))
|
||||||
|
|
||||||
|
## [9.0.1](https://github.com/uuidjs/uuid/compare/v9.0.0...v9.0.1) (2023-09-12)
|
||||||
|
|
||||||
|
### build
|
||||||
|
|
||||||
|
- Fix CI to work with Node.js 20.x
|
||||||
|
|
||||||
|
## [9.0.0](https://github.com/uuidjs/uuid/compare/v8.3.2...v9.0.0) (2022-09-05)
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
- Drop Node.js 10.x support. This library always aims at supporting one EOLed LTS release which by this time now is 12.x which has reached EOL 30 Apr 2022.
|
||||||
|
|
||||||
|
- Remove the minified UMD build from the package.
|
||||||
|
|
||||||
|
Minified code is hard to audit and since this is a widely used library it seems more appropriate nowadays to optimize for auditability than to ship a legacy module format that, at best, serves educational purposes nowadays.
|
||||||
|
|
||||||
|
For production browser use cases, users should be using a bundler. For educational purposes, today's online sandboxes like replit.com offer convenient ways to load npm modules, so the use case for UMD through repos like UNPKG or jsDelivr has largely vanished.
|
||||||
|
|
||||||
|
- Drop IE 11 and Safari 10 support. Drop support for browsers that don't correctly implement const/let and default arguments, and no longer transpile the browser build to ES2015.
|
||||||
|
|
||||||
|
This also removes the fallback on msCrypto instead of the crypto API.
|
||||||
|
|
||||||
|
Browser tests are run in the first supported version of each supported browser and in the latest (as of this commit) version available on Browserstack.
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- optimize uuid.v1 by 1.3x uuid.v4 by 4.3x (430%) ([#597](https://github.com/uuidjs/uuid/issues/597)) ([3a033f6](https://github.com/uuidjs/uuid/commit/3a033f6bab6bb3780ece6d645b902548043280bc))
|
||||||
|
- remove UMD build ([#645](https://github.com/uuidjs/uuid/issues/645)) ([e948a0f](https://github.com/uuidjs/uuid/commit/e948a0f22bf22f4619b27bd913885e478e20fe6f)), closes [#620](https://github.com/uuidjs/uuid/issues/620)
|
||||||
|
- use native crypto.randomUUID when available ([#600](https://github.com/uuidjs/uuid/issues/600)) ([c9e076c](https://github.com/uuidjs/uuid/commit/c9e076c852edad7e9a06baaa1d148cf4eda6c6c4))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- add Jest/jsdom compatibility ([#642](https://github.com/uuidjs/uuid/issues/642)) ([16f9c46](https://github.com/uuidjs/uuid/commit/16f9c469edf46f0786164cdf4dc980743984a6fd))
|
||||||
|
- change default export to named function ([#545](https://github.com/uuidjs/uuid/issues/545)) ([c57bc5a](https://github.com/uuidjs/uuid/commit/c57bc5a9a0653273aa639cda9177ce52efabe42a))
|
||||||
|
- handle error when parameter is not set in v3 and v5 ([#622](https://github.com/uuidjs/uuid/issues/622)) ([fcd7388](https://github.com/uuidjs/uuid/commit/fcd73881692d9fabb63872576ba28e30ff852091))
|
||||||
|
- run npm audit fix ([#644](https://github.com/uuidjs/uuid/issues/644)) ([04686f5](https://github.com/uuidjs/uuid/commit/04686f54c5fed2cfffc1b619f4970c4bb8532353))
|
||||||
|
- upgrading from uuid3 broken link ([#568](https://github.com/uuidjs/uuid/issues/568)) ([1c849da](https://github.com/uuidjs/uuid/commit/1c849da6e164259e72e18636726345b13a7eddd6))
|
||||||
|
|
||||||
|
### build
|
||||||
|
|
||||||
|
- drop Node.js 8.x from babel transpile target ([#603](https://github.com/uuidjs/uuid/issues/603)) ([aa11485](https://github.com/uuidjs/uuid/commit/aa114858260402107ec8a1e1a825dea0a259bcb5))
|
||||||
|
- drop support for legacy browsers (IE11, Safari 10) ([#604](https://github.com/uuidjs/uuid/issues/604)) ([0f433e5](https://github.com/uuidjs/uuid/commit/0f433e5ec444edacd53016de67db021102f36148))
|
||||||
|
|
||||||
|
- drop node 10.x to upgrade dev dependencies ([#653](https://github.com/uuidjs/uuid/issues/653)) ([28a5712](https://github.com/uuidjs/uuid/commit/28a571283f8abda6b9d85e689f95b7d3ee9e282e)), closes [#643](https://github.com/uuidjs/uuid/issues/643)
|
||||||
|
|
||||||
|
### [8.3.2](https://github.com/uuidjs/uuid/compare/v8.3.1...v8.3.2) (2020-12-08)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- lazy load getRandomValues ([#537](https://github.com/uuidjs/uuid/issues/537)) ([16c8f6d](https://github.com/uuidjs/uuid/commit/16c8f6df2f6b09b4d6235602d6a591188320a82e)), closes [#536](https://github.com/uuidjs/uuid/issues/536)
|
||||||
|
|
||||||
|
### [8.3.1](https://github.com/uuidjs/uuid/compare/v8.3.0...v8.3.1) (2020-10-04)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- support expo>=39.0.0 ([#515](https://github.com/uuidjs/uuid/issues/515)) ([c65a0f3](https://github.com/uuidjs/uuid/commit/c65a0f3fa73b901959d638d1e3591dfacdbed867)), closes [#375](https://github.com/uuidjs/uuid/issues/375)
|
||||||
|
|
||||||
|
## [8.3.0](https://github.com/uuidjs/uuid/compare/v8.2.0...v8.3.0) (2020-07-27)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- add parse/stringify/validate/version/NIL APIs ([#479](https://github.com/uuidjs/uuid/issues/479)) ([0e6c10b](https://github.com/uuidjs/uuid/commit/0e6c10ba1bf9517796ff23c052fc0468eedfd5f4)), closes [#475](https://github.com/uuidjs/uuid/issues/475) [#478](https://github.com/uuidjs/uuid/issues/478) [#480](https://github.com/uuidjs/uuid/issues/480) [#481](https://github.com/uuidjs/uuid/issues/481) [#180](https://github.com/uuidjs/uuid/issues/180)
|
||||||
|
|
||||||
|
## [8.2.0](https://github.com/uuidjs/uuid/compare/v8.1.0...v8.2.0) (2020-06-23)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- improve performance of v1 string representation ([#453](https://github.com/uuidjs/uuid/issues/453)) ([0ee0b67](https://github.com/uuidjs/uuid/commit/0ee0b67c37846529c66089880414d29f3ae132d5))
|
||||||
|
- remove deprecated v4 string parameter ([#454](https://github.com/uuidjs/uuid/issues/454)) ([88ce3ca](https://github.com/uuidjs/uuid/commit/88ce3ca0ba046f60856de62c7ce03f7ba98ba46c)), closes [#437](https://github.com/uuidjs/uuid/issues/437)
|
||||||
|
- support jspm ([#473](https://github.com/uuidjs/uuid/issues/473)) ([e9f2587](https://github.com/uuidjs/uuid/commit/e9f2587a92575cac31bc1d4ae944e17c09756659))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- prepare package exports for webpack 5 ([#468](https://github.com/uuidjs/uuid/issues/468)) ([8d6e6a5](https://github.com/uuidjs/uuid/commit/8d6e6a5f8965ca9575eb4d92e99a43435f4a58a8))
|
||||||
|
|
||||||
|
## [8.1.0](https://github.com/uuidjs/uuid/compare/v8.0.0...v8.1.0) (2020-05-20)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- improve v4 performance by reusing random number array ([#435](https://github.com/uuidjs/uuid/issues/435)) ([bf4af0d](https://github.com/uuidjs/uuid/commit/bf4af0d711b4d2ed03d1f74fd12ad0baa87dc79d))
|
||||||
|
- optimize V8 performance of bytesToUuid ([#434](https://github.com/uuidjs/uuid/issues/434)) ([e156415](https://github.com/uuidjs/uuid/commit/e156415448ec1af2351fa0b6660cfb22581971f2))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- export package.json required by react-native and bundlers ([#449](https://github.com/uuidjs/uuid/issues/449)) ([be1c8fe](https://github.com/uuidjs/uuid/commit/be1c8fe9a3206c358e0059b52fafd7213aa48a52)), closes [ai/nanoevents#44](https://github.com/ai/nanoevents/issues/44#issuecomment-602010343) [#444](https://github.com/uuidjs/uuid/issues/444)
|
||||||
|
|
||||||
|
## [8.0.0](https://github.com/uuidjs/uuid/compare/v7.0.3...v8.0.0) (2020-04-29)
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
- For native ECMAScript Module (ESM) usage in Node.js only named exports are exposed, there is no more default export.
|
||||||
|
|
||||||
|
```diff
|
||||||
|
-import uuid from 'uuid';
|
||||||
|
-console.log(uuid.v4()); // -> 'cd6c3b08-0adc-4f4b-a6ef-36087a1c9869'
|
||||||
|
+import { v4 as uuidv4 } from 'uuid';
|
||||||
|
+uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
|
||||||
|
```
|
||||||
|
|
||||||
|
- Deep requiring specific algorithms of this library like `require('uuid/v4')`, which has been deprecated in `uuid@7`, is no longer supported.
|
||||||
|
|
||||||
|
Instead use the named exports that this module exports.
|
||||||
|
|
||||||
|
For ECMAScript Modules (ESM):
|
||||||
|
|
||||||
|
```diff
|
||||||
|
-import uuidv4 from 'uuid/v4';
|
||||||
|
+import { v4 as uuidv4 } from 'uuid';
|
||||||
|
uuidv4();
|
||||||
|
```
|
||||||
|
|
||||||
|
For CommonJS:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
-const uuidv4 = require('uuid/v4');
|
||||||
|
+const { v4: uuidv4 } = require('uuid');
|
||||||
|
uuidv4();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- native Node.js ES Modules (wrapper approach) ([#423](https://github.com/uuidjs/uuid/issues/423)) ([2d9f590](https://github.com/uuidjs/uuid/commit/2d9f590ad9701d692625c07ed62f0a0f91227991)), closes [#245](https://github.com/uuidjs/uuid/issues/245) [#419](https://github.com/uuidjs/uuid/issues/419) [#342](https://github.com/uuidjs/uuid/issues/342)
|
||||||
|
- remove deep requires ([#426](https://github.com/uuidjs/uuid/issues/426)) ([daf72b8](https://github.com/uuidjs/uuid/commit/daf72b84ceb20272a81bb5fbddb05dd95922cbba))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- add CommonJS syntax example to README quickstart section ([#417](https://github.com/uuidjs/uuid/issues/417)) ([e0ec840](https://github.com/uuidjs/uuid/commit/e0ec8402c7ad44b7ef0453036c612f5db513fda0))
|
||||||
|
|
||||||
|
### [7.0.3](https://github.com/uuidjs/uuid/compare/v7.0.2...v7.0.3) (2020-03-31)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- make deep require deprecation warning work in browsers ([#409](https://github.com/uuidjs/uuid/issues/409)) ([4b71107](https://github.com/uuidjs/uuid/commit/4b71107d8c0d2ef56861ede6403fc9dc35a1e6bf)), closes [#408](https://github.com/uuidjs/uuid/issues/408)
|
||||||
|
|
||||||
|
### [7.0.2](https://github.com/uuidjs/uuid/compare/v7.0.1...v7.0.2) (2020-03-04)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- make access to msCrypto consistent ([#393](https://github.com/uuidjs/uuid/issues/393)) ([8bf2a20](https://github.com/uuidjs/uuid/commit/8bf2a20f3565df743da7215eebdbada9d2df118c))
|
||||||
|
- simplify link in deprecation warning ([#391](https://github.com/uuidjs/uuid/issues/391)) ([bb2c8e4](https://github.com/uuidjs/uuid/commit/bb2c8e4e9f4c5f9c1eaaf3ea59710c633cd90cb7))
|
||||||
|
- update links to match content in readme ([#386](https://github.com/uuidjs/uuid/issues/386)) ([44f2f86](https://github.com/uuidjs/uuid/commit/44f2f86e9d2bbf14ee5f0f00f72a3db1292666d4))
|
||||||
|
|
||||||
|
### [7.0.1](https://github.com/uuidjs/uuid/compare/v7.0.0...v7.0.1) (2020-02-25)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- clean up esm builds for node and browser ([#383](https://github.com/uuidjs/uuid/issues/383)) ([59e6a49](https://github.com/uuidjs/uuid/commit/59e6a49e7ce7b3e8fb0f3ee52b9daae72af467dc))
|
||||||
|
- provide browser versions independent from module system ([#380](https://github.com/uuidjs/uuid/issues/380)) ([4344a22](https://github.com/uuidjs/uuid/commit/4344a22e7aed33be8627eeaaf05360f256a21753)), closes [#378](https://github.com/uuidjs/uuid/issues/378)
|
||||||
|
|
||||||
|
## [7.0.0](https://github.com/uuidjs/uuid/compare/v3.4.0...v7.0.0) (2020-02-24)
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
- The default export, which used to be the v4() method but which was already discouraged in v3.x of this library, has been removed.
|
||||||
|
- Explicitly note that deep imports of the different uuid version functions are deprecated and no longer encouraged and that ECMAScript module named imports should be used instead. Emit a deprecation warning for people who deep-require the different algorithm variants.
|
||||||
|
- Remove builtin support for insecure random number generators in the browser. Users who want that will have to supply their own random number generator function.
|
||||||
|
- Remove support for generating v3 and v5 UUIDs in Node.js<4.x
|
||||||
|
- Convert code base to ECMAScript Modules (ESM) and release CommonJS build for node and ESM build for browser bundlers.
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- add UMD build to npm package ([#357](https://github.com/uuidjs/uuid/issues/357)) ([4e75adf](https://github.com/uuidjs/uuid/commit/4e75adf435196f28e3fbbe0185d654b5ded7ca2c)), closes [#345](https://github.com/uuidjs/uuid/issues/345)
|
||||||
|
- add various es module and CommonJS examples ([b238510](https://github.com/uuidjs/uuid/commit/b238510bf352463521f74bab175a3af9b7a42555))
|
||||||
|
- ensure that docs are up-to-date in CI ([ee5e77d](https://github.com/uuidjs/uuid/commit/ee5e77db547474f5a8f23d6c857a6d399209986b))
|
||||||
|
- hybrid CommonJS & ECMAScript modules build ([a3f078f](https://github.com/uuidjs/uuid/commit/a3f078faa0baff69ab41aed08e041f8f9c8993d0))
|
||||||
|
- remove insecure fallback random number generator ([3a5842b](https://github.com/uuidjs/uuid/commit/3a5842b141a6e5de0ae338f391661e6b84b167c9)), closes [#173](https://github.com/uuidjs/uuid/issues/173)
|
||||||
|
- remove support for pre Node.js v4 Buffer API ([#356](https://github.com/uuidjs/uuid/issues/356)) ([b59b5c5](https://github.com/uuidjs/uuid/commit/b59b5c5ecad271c5453f1a156f011671f6d35627))
|
||||||
|
- rename repository to github:uuidjs/uuid ([#351](https://github.com/uuidjs/uuid/issues/351)) ([c37a518](https://github.com/uuidjs/uuid/commit/c37a518e367ac4b6d0aa62dba1bc6ce9e85020f7)), closes [#338](https://github.com/uuidjs/uuid/issues/338)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- add deep-require proxies for local testing and adjust tests ([#365](https://github.com/uuidjs/uuid/issues/365)) ([7fedc79](https://github.com/uuidjs/uuid/commit/7fedc79ac8fda4bfd1c566c7f05ef4ac13b2db48))
|
||||||
|
- add note about removal of default export ([#372](https://github.com/uuidjs/uuid/issues/372)) ([12749b7](https://github.com/uuidjs/uuid/commit/12749b700eb49db8a9759fd306d8be05dbfbd58c)), closes [#370](https://github.com/uuidjs/uuid/issues/370)
|
||||||
|
- deprecated deep requiring of the different algorithm versions ([#361](https://github.com/uuidjs/uuid/issues/361)) ([c0bdf15](https://github.com/uuidjs/uuid/commit/c0bdf15e417639b1aeb0b247b2fb11f7a0a26b23))
|
||||||
|
|
||||||
|
## [3.4.0](https://github.com/uuidjs/uuid/compare/v3.3.3...v3.4.0) (2020-01-16)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- rename repository to github:uuidjs/uuid ([#351](https://github.com/uuidjs/uuid/issues/351)) ([e2d7314](https://github.com/uuidjs/uuid/commit/e2d7314)), closes [#338](https://github.com/uuidjs/uuid/issues/338)
|
||||||
|
|
||||||
|
## [3.3.3](https://github.com/uuidjs/uuid/compare/v3.3.2...v3.3.3) (2019-08-19)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- no longer run ci tests on node v4
|
||||||
|
- upgrade dependencies
|
||||||
|
|
||||||
|
## [3.3.2](https://github.com/uuidjs/uuid/compare/v3.3.1...v3.3.2) (2018-06-28)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- typo ([305d877](https://github.com/uuidjs/uuid/commit/305d877))
|
||||||
|
|
||||||
|
## [3.3.1](https://github.com/uuidjs/uuid/compare/v3.3.0...v3.3.1) (2018-06-28)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- fix [#284](https://github.com/uuidjs/uuid/issues/284) by setting function name in try-catch ([f2a60f2](https://github.com/uuidjs/uuid/commit/f2a60f2))
|
||||||
|
|
||||||
|
# [3.3.0](https://github.com/uuidjs/uuid/compare/v3.2.1...v3.3.0) (2018-06-22)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- assignment to readonly property to allow running in strict mode ([#270](https://github.com/uuidjs/uuid/issues/270)) ([d062fdc](https://github.com/uuidjs/uuid/commit/d062fdc))
|
||||||
|
- fix [#229](https://github.com/uuidjs/uuid/issues/229) ([c9684d4](https://github.com/uuidjs/uuid/commit/c9684d4))
|
||||||
|
- Get correct version of IE11 crypto ([#274](https://github.com/uuidjs/uuid/issues/274)) ([153d331](https://github.com/uuidjs/uuid/commit/153d331))
|
||||||
|
- mem issue when generating uuid ([#267](https://github.com/uuidjs/uuid/issues/267)) ([c47702c](https://github.com/uuidjs/uuid/commit/c47702c))
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- enforce Conventional Commit style commit messages ([#282](https://github.com/uuidjs/uuid/issues/282)) ([cc9a182](https://github.com/uuidjs/uuid/commit/cc9a182))
|
||||||
|
|
||||||
|
## [3.2.1](https://github.com/uuidjs/uuid/compare/v3.2.0...v3.2.1) (2018-01-16)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- use msCrypto if available. Fixes [#241](https://github.com/uuidjs/uuid/issues/241) ([#247](https://github.com/uuidjs/uuid/issues/247)) ([1fef18b](https://github.com/uuidjs/uuid/commit/1fef18b))
|
||||||
|
|
||||||
|
# [3.2.0](https://github.com/uuidjs/uuid/compare/v3.1.0...v3.2.0) (2018-01-16)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- remove mistakenly added typescript dependency, rollback version (standard-version will auto-increment) ([09fa824](https://github.com/uuidjs/uuid/commit/09fa824))
|
||||||
|
- use msCrypto if available. Fixes [#241](https://github.com/uuidjs/uuid/issues/241) ([#247](https://github.com/uuidjs/uuid/issues/247)) ([1fef18b](https://github.com/uuidjs/uuid/commit/1fef18b))
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- Add v3 Support ([#217](https://github.com/uuidjs/uuid/issues/217)) ([d94f726](https://github.com/uuidjs/uuid/commit/d94f726))
|
||||||
|
|
||||||
|
# [3.1.0](https://github.com/uuidjs/uuid/compare/v3.1.0...v3.0.1) (2017-06-17)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- (fix) Add .npmignore file to exclude test/ and other non-essential files from packing. (#183)
|
||||||
|
- Fix typo (#178)
|
||||||
|
- Simple typo fix (#165)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- v5 support in CLI (#197)
|
||||||
|
- V5 support (#188)
|
||||||
|
|
||||||
|
# 3.0.1 (2016-11-28)
|
||||||
|
|
||||||
|
- split uuid versions into separate files
|
||||||
|
|
||||||
|
# 3.0.0 (2016-11-17)
|
||||||
|
|
||||||
|
- remove .parse and .unparse
|
||||||
|
|
||||||
|
# 2.0.0
|
||||||
|
|
||||||
|
- Removed uuid.BufferClass
|
||||||
|
|
||||||
|
# 1.4.0
|
||||||
|
|
||||||
|
- Improved module context detection
|
||||||
|
- Removed public RNG functions
|
||||||
|
|
||||||
|
# 1.3.2
|
||||||
|
|
||||||
|
- Improve tests and handling of v1() options (Issue #24)
|
||||||
|
- Expose RNG option to allow for perf testing with different generators
|
||||||
|
|
||||||
|
# 1.3.0
|
||||||
|
|
||||||
|
- Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)!
|
||||||
|
- Support for node.js crypto API
|
||||||
|
- De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
Please feel free to file GitHub Issues or propose Pull Requests. We're always happy to discuss improvements to this library!
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Releasing
|
||||||
|
|
||||||
|
Releases are supposed to be done from master, version bumping is automated through [`standard-version`](https://github.com/conventional-changelog/standard-version):
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm run release -- --dry-run # verify output manually
|
||||||
|
npm run release # follow the instructions from the output of this command
|
||||||
|
```
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2010-2020 Robert Kieffer 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.
|
||||||
+584
@@ -0,0 +1,584 @@
|
|||||||
|
<!--
|
||||||
|
-- This file is auto-generated from README_js.md. Changes should be made there.
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
# uuid [](https://github.com/uuidjs/uuid/actions?query=workflow%3ACI) [](https://github.com/uuidjs/uuid/actions?query=workflow%3ABrowser)
|
||||||
|
|
||||||
|
For the creation of [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (formally [RFC4122](https://www.rfc-editor.org/rfc/rfc4122.html)) UUIDs
|
||||||
|
|
||||||
|
- **Complete** - Support for all RFC9562 (nee RFC4122) UUID versions
|
||||||
|
- **Cross-platform** - Support for ...
|
||||||
|
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and [CDN builds](#cdn-builds)
|
||||||
|
- NodeJS 16+ ([LTS releases](https://github.com/nodejs/Release))
|
||||||
|
- Chrome, Safari, Firefox, Edge browsers
|
||||||
|
- Webpack and rollup.js module bundlers
|
||||||
|
- [React Native / Expo](#react-native--expo)
|
||||||
|
- **Secure** - Cryptographically-strong random values
|
||||||
|
- **Small** - Zero-dependency, small footprint, plays nice with "tree shaking" packagers
|
||||||
|
- **CLI** - Includes the [`uuid` command line](#command-line) utility
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
> [!NOTE]
|
||||||
|
> Upgrading from `uuid@3`? Your code is probably okay, but check out [Upgrading From `uuid@3`](#upgrading-from-uuid3) for details.
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
> [!NOTE]
|
||||||
|
> Only interested in creating a version 4 UUID? You might be able to use [`crypto.randomUUID()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID), eliminating the need to install this library.
|
||||||
|
|
||||||
|
## Quickstart
|
||||||
|
|
||||||
|
To create a random UUID...
|
||||||
|
|
||||||
|
**1. Install**
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm install uuid
|
||||||
|
```
|
||||||
|
|
||||||
|
**2. Create a UUID** (ES6 module syntax)
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
|
||||||
|
```
|
||||||
|
|
||||||
|
... or using CommonJS syntax:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const { v4: uuidv4 } = require('uuid');
|
||||||
|
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
||||||
|
```
|
||||||
|
|
||||||
|
For timestamp UUIDs, namespace UUIDs, and other options read on ...
|
||||||
|
|
||||||
|
## API Summary
|
||||||
|
|
||||||
|
| | | |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| [`uuid.NIL`](#uuidnil) | The nil UUID string (all zeros) | New in `uuid@8.3` |
|
||||||
|
| [`uuid.MAX`](#uuidmax) | The max UUID string (all ones) | New in `uuid@9.1` |
|
||||||
|
| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes | New in `uuid@8.3` |
|
||||||
|
| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string | New in `uuid@8.3` |
|
||||||
|
| [`uuid.v1()`](#uuidv1options-buffer-offset) | Create a version 1 (timestamp) UUID | |
|
||||||
|
| [`uuid.v1ToV6()`](#uuidv1tov6uuid) | Create a version 6 UUID from a version 1 UUID | New in `uuid@10` |
|
||||||
|
| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Create a version 3 (namespace w/ MD5) UUID | |
|
||||||
|
| [`uuid.v4()`](#uuidv4options-buffer-offset) | Create a version 4 (random) UUID | |
|
||||||
|
| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Create a version 5 (namespace w/ SHA-1) UUID | |
|
||||||
|
| [`uuid.v6()`](#uuidv6options-buffer-offset) | Create a version 6 (timestamp, reordered) UUID | New in `uuid@10` |
|
||||||
|
| [`uuid.v6ToV1()`](#uuidv6tov1uuid) | Create a version 1 UUID from a version 6 UUID | New in `uuid@10` |
|
||||||
|
| [`uuid.v7()`](#uuidv7options-buffer-offset) | Create a version 7 (Unix Epoch time-based) UUID | New in `uuid@10` |
|
||||||
|
| ~~[`uuid.v8()`](#uuidv8)~~ | "Intentionally left blank" | |
|
||||||
|
| [`uuid.validate()`](#uuidvalidatestr) | Test a string to see if it is a valid UUID | New in `uuid@8.3` |
|
||||||
|
| [`uuid.version()`](#uuidversionstr) | Detect RFC version of a UUID | New in `uuid@8.3` |
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### uuid.NIL
|
||||||
|
|
||||||
|
The nil UUID string (all zeros).
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { NIL as NIL_UUID } from 'uuid';
|
||||||
|
|
||||||
|
NIL_UUID; // ⇨ '00000000-0000-0000-0000-000000000000'
|
||||||
|
```
|
||||||
|
|
||||||
|
### uuid.MAX
|
||||||
|
|
||||||
|
The max UUID string (all ones).
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { MAX as MAX_UUID } from 'uuid';
|
||||||
|
|
||||||
|
MAX_UUID; // ⇨ 'ffffffff-ffff-ffff-ffff-ffffffffffff'
|
||||||
|
```
|
||||||
|
|
||||||
|
### uuid.parse(str)
|
||||||
|
|
||||||
|
Convert UUID string to array of bytes
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --------- | ---------------------------------------- |
|
||||||
|
| `str` | A valid UUID `String` |
|
||||||
|
| _returns_ | `Uint8Array[16]` |
|
||||||
|
| _throws_ | `TypeError` if `str` is not a valid UUID |
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
> [!NOTE]
|
||||||
|
> Ordering of values in the byte arrays used by `parse()` and `stringify()` follows the left ↠ right order of hex-pairs in UUID strings. As shown in the example below.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { parse as uuidParse } from 'uuid';
|
||||||
|
|
||||||
|
// Parse a UUID
|
||||||
|
const bytes = uuidParse('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b');
|
||||||
|
|
||||||
|
// Convert to hex strings to show byte order (for documentation purposes)
|
||||||
|
[...bytes].map((v) => v.toString(16).padStart(2, '0')); // ⇨
|
||||||
|
// [
|
||||||
|
// '6e', 'c0', 'bd', '7f',
|
||||||
|
// '11', 'c0', '43', 'da',
|
||||||
|
// '97', '5e', '2a', '8a',
|
||||||
|
// 'd9', 'eb', 'ae', '0b'
|
||||||
|
// ]
|
||||||
|
```
|
||||||
|
|
||||||
|
### uuid.stringify(arr[, offset])
|
||||||
|
|
||||||
|
Convert array of bytes to UUID string
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| -------------- | ---------------------------------------------------------------------------- |
|
||||||
|
| `arr` | `Array`-like collection of 16 values (starting from `offset`) between 0-255. |
|
||||||
|
| [`offset` = 0] | `Number` Starting index in the Array |
|
||||||
|
| _returns_ | `String` |
|
||||||
|
| _throws_ | `TypeError` if a valid UUID string cannot be generated |
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
> [!NOTE]
|
||||||
|
> Ordering of values in the byte arrays used by `parse()` and `stringify()` follows the left ↠ right order of hex-pairs in UUID strings. As shown in the example below.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { stringify as uuidStringify } from 'uuid';
|
||||||
|
|
||||||
|
const uuidBytes = [
|
||||||
|
0x6e, 0xc0, 0xbd, 0x7f, 0x11, 0xc0, 0x43, 0xda, 0x97, 0x5e, 0x2a, 0x8a, 0xd9, 0xeb, 0xae, 0x0b,
|
||||||
|
];
|
||||||
|
|
||||||
|
uuidStringify(uuidBytes); // ⇨ '6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'
|
||||||
|
```
|
||||||
|
|
||||||
|
### uuid.v1([options[, buffer[, offset]]])
|
||||||
|
|
||||||
|
Create an RFC version 1 (timestamp) UUID
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --- | --- |
|
||||||
|
| [`options`] | `Object` with one or more of the following properties: |
|
||||||
|
| [`options.node` ] | RFC "node" field as an `Array[6]` of byte values (per 4.1.6) |
|
||||||
|
| [`options.clockseq`] | RFC "clock sequence" as a `Number` between 0 - 0x3fff |
|
||||||
|
| [`options.msecs`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) |
|
||||||
|
| [`options.nsecs`] | RFC "timestamp" field (`Number` of nanoseconds to add to `msecs`, should be 0-10,000) |
|
||||||
|
| [`options.random`] | `Array` of 16 random bytes (0-255) |
|
||||||
|
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
|
||||||
|
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` |
|
||||||
|
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
||||||
|
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
||||||
|
| _throws_ | `Error` if more than 10M UUIDs/sec are requested |
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
> [!NOTE]
|
||||||
|
> The default [node id](https://datatracker.ietf.org/doc/html/rfc9562#section-5.1) (the last 12 digits in the UUID) is generated once, randomly, on process startup, and then remains unchanged for the duration of the process.
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
> [!NOTE]
|
||||||
|
> `options.random` and `options.rng` are only meaningful on the very first call to `v1()`, where they may be passed to initialize the internal `node` and `clockseq` fields.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v1 as uuidv1 } from 'uuid';
|
||||||
|
|
||||||
|
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-8bad-9b1deb4d3b7d'
|
||||||
|
```
|
||||||
|
|
||||||
|
Example using `options`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v1 as uuidv1 } from 'uuid';
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
|
||||||
|
clockseq: 0x1234,
|
||||||
|
msecs: new Date('2011-11-01').getTime(),
|
||||||
|
nsecs: 5678,
|
||||||
|
};
|
||||||
|
uuidv1(options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab'
|
||||||
|
```
|
||||||
|
|
||||||
|
### uuid.v1ToV6(uuid)
|
||||||
|
|
||||||
|
Convert a UUID from version 1 to version 6
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v1ToV6 } from 'uuid';
|
||||||
|
|
||||||
|
v1ToV6('92f62d9e-22c4-11ef-97e9-325096b39f47'); // ⇨ '1ef22c49-2f62-6d9e-97e9-325096b39f47'
|
||||||
|
```
|
||||||
|
|
||||||
|
### uuid.v3(name, namespace[, buffer[, offset]])
|
||||||
|
|
||||||
|
Create an RFC version 3 (namespace w/ MD5) UUID
|
||||||
|
|
||||||
|
API is identical to `v5()`, but uses "v3" instead.
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Per the RFC, "_If backward compatibility is not an issue, SHA-1 [Version 5] is preferred_."
|
||||||
|
|
||||||
|
### uuid.v4([options[, buffer[, offset]]])
|
||||||
|
|
||||||
|
Create an RFC version 4 (random) UUID
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --- | --- |
|
||||||
|
| [`options`] | `Object` with one or more of the following properties: |
|
||||||
|
| [`options.random`] | `Array` of 16 random bytes (0-255) |
|
||||||
|
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
|
||||||
|
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` |
|
||||||
|
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
||||||
|
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
|
||||||
|
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
||||||
|
```
|
||||||
|
|
||||||
|
Example using predefined `random` values:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
|
||||||
|
const v4options = {
|
||||||
|
random: [
|
||||||
|
0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36,
|
||||||
|
],
|
||||||
|
};
|
||||||
|
uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836'
|
||||||
|
```
|
||||||
|
|
||||||
|
### uuid.v5(name, namespace[, buffer[, offset]])
|
||||||
|
|
||||||
|
Create an RFC version 5 (namespace w/ SHA-1) UUID
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --- | --- |
|
||||||
|
| `name` | `String \| Array` |
|
||||||
|
| `namespace` | `String \| Array[16]` Namespace UUID |
|
||||||
|
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` |
|
||||||
|
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
||||||
|
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
> [!NOTE]
|
||||||
|
> The RFC `DNS` and `URL` namespaces are available as `v5.DNS` and `v5.URL`.
|
||||||
|
|
||||||
|
Example with custom namespace:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v5 as uuidv5 } from 'uuid';
|
||||||
|
|
||||||
|
// Define a custom namespace. Readers, create your own using something like
|
||||||
|
// https://www.uuidgenerator.net/
|
||||||
|
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
|
||||||
|
|
||||||
|
uuidv5('Hello, World!', MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614681'
|
||||||
|
```
|
||||||
|
|
||||||
|
Example with RFC `URL` namespace:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v5 as uuidv5 } from 'uuid';
|
||||||
|
|
||||||
|
uuidv5('https://www.w3.org/', uuidv5.URL); // ⇨ 'c106a26a-21bb-5538-8bf2-57095d1976c1'
|
||||||
|
```
|
||||||
|
|
||||||
|
### uuid.v6([options[, buffer[, offset]]])
|
||||||
|
|
||||||
|
Create an RFC version 6 (timestamp, reordered) UUID
|
||||||
|
|
||||||
|
This method takes the same arguments as uuid.v1().
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v6 as uuidv6 } from 'uuid';
|
||||||
|
|
||||||
|
uuidv6(); // ⇨ '1e940672-c5ea-64c0-8bad-9b1deb4d3b7d'
|
||||||
|
```
|
||||||
|
|
||||||
|
Example using `options`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v6 as uuidv6 } from 'uuid';
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
|
||||||
|
clockseq: 0x1234,
|
||||||
|
msecs: new Date('2011-11-01').getTime(),
|
||||||
|
nsecs: 5678,
|
||||||
|
};
|
||||||
|
uuidv6(options); // ⇨ '1e1041c7-10b9-662e-9234-0123456789ab'
|
||||||
|
```
|
||||||
|
|
||||||
|
### uuid.v6ToV1(uuid)
|
||||||
|
|
||||||
|
Convert a UUID from version 6 to version 1
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v6ToV1 } from 'uuid';
|
||||||
|
|
||||||
|
v6ToV1('1ef22c49-2f62-6d9e-97e9-325096b39f47'); // ⇨ '92f62d9e-22c4-11ef-97e9-325096b39f47'
|
||||||
|
```
|
||||||
|
|
||||||
|
### uuid.v7([options[, buffer[, offset]]])
|
||||||
|
|
||||||
|
Create an RFC version 7 (random) UUID
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --- | --- |
|
||||||
|
| [`options`] | `Object` with one or more of the following properties: |
|
||||||
|
| [`options.msecs`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) |
|
||||||
|
| [`options.random`] | `Array` of 16 random bytes (0-255) |
|
||||||
|
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
|
||||||
|
| [`options.seq`] | 31 bit monotonic sequence counter as `Number` between 0 - 0x7fffffff |
|
||||||
|
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` |
|
||||||
|
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
||||||
|
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v7 as uuidv7 } from 'uuid';
|
||||||
|
|
||||||
|
uuidv7(); // ⇨ '01695553-c90c-722d-9b5d-b38dfbbd4bed'
|
||||||
|
```
|
||||||
|
|
||||||
|
### ~~uuid.v8()~~
|
||||||
|
|
||||||
|
**_"Intentionally left blank"_**
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
> [!NOTE]
|
||||||
|
> Version 8 (experimental) UUIDs are "[for experimental or vendor-specific use cases](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-8)". The RFC does not define a creation algorithm for them, which is why this package does not offer a `v8()` method. The `validate()` and `version()` methods do work with such UUIDs, however.
|
||||||
|
|
||||||
|
### uuid.validate(str)
|
||||||
|
|
||||||
|
Test a string to see if it is a valid UUID
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --------- | --------------------------------------------------- |
|
||||||
|
| `str` | `String` to validate |
|
||||||
|
| _returns_ | `true` if string is a valid UUID, `false` otherwise |
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { validate as uuidValidate } from 'uuid';
|
||||||
|
|
||||||
|
uuidValidate('not a UUID'); // ⇨ false
|
||||||
|
uuidValidate('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ true
|
||||||
|
```
|
||||||
|
|
||||||
|
Using `validate` and `version` together it is possible to do per-version validation, e.g. validate for only v4 UUIds.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { version as uuidVersion } from 'uuid';
|
||||||
|
import { validate as uuidValidate } from 'uuid';
|
||||||
|
|
||||||
|
function uuidValidateV4(uuid) {
|
||||||
|
return uuidValidate(uuid) && uuidVersion(uuid) === 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
const v1Uuid = 'd9428888-122b-11e1-b85c-61cd3cbb3210';
|
||||||
|
const v4Uuid = '109156be-c4fb-41ea-b1b4-efe1671c5836';
|
||||||
|
|
||||||
|
uuidValidateV4(v4Uuid); // ⇨ true
|
||||||
|
uuidValidateV4(v1Uuid); // ⇨ false
|
||||||
|
```
|
||||||
|
|
||||||
|
### uuid.version(str)
|
||||||
|
|
||||||
|
Detect RFC version of a UUID
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --------- | ---------------------------------------- |
|
||||||
|
| `str` | A valid UUID `String` |
|
||||||
|
| _returns_ | `Number` The RFC version of the UUID |
|
||||||
|
| _throws_ | `TypeError` if `str` is not a valid UUID |
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { version as uuidVersion } from 'uuid';
|
||||||
|
|
||||||
|
uuidVersion('45637ec4-c85f-11ea-87d0-0242ac130003'); // ⇨ 1
|
||||||
|
uuidVersion('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ 4
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
> [!NOTE]
|
||||||
|
> This method returns `0` for the `NIL` UUID, and `15` for the `MAX` UUID.
|
||||||
|
|
||||||
|
## Command Line
|
||||||
|
|
||||||
|
UUIDs can be generated from the command line using `uuid`.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ npx uuid
|
||||||
|
ddeb27fb-d9a0-4624-be4d-4615062daed4
|
||||||
|
```
|
||||||
|
|
||||||
|
The default is to generate version 4 UUIDS, however the other versions are supported. Type `uuid --help` for details:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ npx uuid --help
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
uuid
|
||||||
|
uuid v1
|
||||||
|
uuid v3 <name> <namespace uuid>
|
||||||
|
uuid v4
|
||||||
|
uuid v5 <name> <namespace uuid>
|
||||||
|
uuid v7
|
||||||
|
uuid --help
|
||||||
|
|
||||||
|
Note: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs
|
||||||
|
defined by RFC9562
|
||||||
|
```
|
||||||
|
|
||||||
|
## ECMAScript Modules
|
||||||
|
|
||||||
|
This library comes with [ECMAScript Modules](https://www.ecma-international.org/ecma-262/6.0/#sec-modules) (ESM) support for Node.js versions that support it ([example](./examples/node-esmodules/)) as well as bundlers like [rollup.js](https://rollupjs.org/guide/en/#tree-shaking) ([example](./examples/browser-rollup/)) and [webpack](https://webpack.js.org/guides/tree-shaking/) ([example](./examples/browser-webpack/)) (targeting both, Node.js and browser environments).
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
||||||
|
```
|
||||||
|
|
||||||
|
To run the examples you must first create a dist build of this library in the module root:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
## CDN Builds
|
||||||
|
|
||||||
|
### ECMAScript Modules
|
||||||
|
|
||||||
|
To load this module directly into modern browsers that [support loading ECMAScript Modules](https://caniuse.com/#feat=es6-module) you can make use of [jspm](https://jspm.org/):
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script type="module">
|
||||||
|
import { v4 as uuidv4 } from 'https://jspm.dev/uuid';
|
||||||
|
console.log(uuidv4()); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
### UMD
|
||||||
|
|
||||||
|
As of `uuid@9` [UMD (Universal Module Definition)](https://github.com/umdjs/umd) builds are no longer shipped with this library.
|
||||||
|
|
||||||
|
If you need a UMD build of this library, use a bundler like Webpack or Rollup. Alternatively, refer to the documentation of [`uuid@8.3.2`](https://github.com/uuidjs/uuid/blob/v8.3.2/README.md#umd) which was the last version that shipped UMD builds.
|
||||||
|
|
||||||
|
## Known issues
|
||||||
|
|
||||||
|
### Duplicate UUIDs (Googlebot)
|
||||||
|
|
||||||
|
This module may generate duplicate UUIDs when run in clients with _deterministic_ random number generators, such as [Googlebot crawlers](https://developers.google.com/search/docs/advanced/crawling/overview-google-crawlers). This can cause problems for apps that expect client-generated UUIDs to always be unique. Developers should be prepared for this and have a strategy for dealing with possible collisions, such as:
|
||||||
|
|
||||||
|
- Check for duplicate UUIDs, fail gracefully
|
||||||
|
- Disable write operations for Googlebot clients
|
||||||
|
|
||||||
|
### "getRandomValues() not supported"
|
||||||
|
|
||||||
|
This error occurs in environments where the standard [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) API is not supported. This issue can be resolved by adding an appropriate polyfill:
|
||||||
|
|
||||||
|
### React Native / Expo
|
||||||
|
|
||||||
|
1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme)
|
||||||
|
1. Import it _before_ `uuid`. Since `uuid` might also appear as a transitive dependency of some other imports it's safest to just import `react-native-get-random-values` as the very first thing in your entry point:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import 'react-native-get-random-values';
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
> [!NOTE]
|
||||||
|
> If you are using Expo, you must be using at least `react-native-get-random-values@1.5.0` and `expo@39.0.0`.
|
||||||
|
|
||||||
|
### Web Workers / Service Workers (Edge <= 18)
|
||||||
|
|
||||||
|
[In Edge <= 18, Web Crypto is not supported in Web Workers or Service Workers](https://caniuse.com/#feat=cryptography) and we are not aware of a polyfill (let us know if you find one, please).
|
||||||
|
|
||||||
|
### IE 11 (Internet Explorer)
|
||||||
|
|
||||||
|
Support for IE11 and other legacy browsers has been dropped as of `uuid@9`. If you need to support legacy browsers, you can always transpile the uuid module source yourself (e.g. using [Babel](https://babeljs.io/)).
|
||||||
|
|
||||||
|
## Upgrading From `uuid@7`
|
||||||
|
|
||||||
|
### Only Named Exports Supported When Using with Node.js ESM
|
||||||
|
|
||||||
|
`uuid@7` did not come with native ECMAScript Module (ESM) support for Node.js. Importing it in Node.js ESM consequently imported the CommonJS source with a default export. This library now comes with true Node.js ESM support and only provides named exports.
|
||||||
|
|
||||||
|
Instead of doing:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import uuid from 'uuid';
|
||||||
|
uuid.v4();
|
||||||
|
```
|
||||||
|
|
||||||
|
you will now have to use the named exports:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
uuidv4();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deep Requires No Longer Supported
|
||||||
|
|
||||||
|
Deep requires like `require('uuid/v4')` [which have been deprecated in `uuid@7`](#deep-requires-now-deprecated) are no longer supported.
|
||||||
|
|
||||||
|
## Upgrading From `uuid@3`
|
||||||
|
|
||||||
|
"_Wait... what happened to `uuid@4` thru `uuid@6`?!?_"
|
||||||
|
|
||||||
|
In order to avoid confusion with RFC [version 4](#uuidv4options-buffer-offset) and [version 5](#uuidv5name-namespace-buffer-offset) UUIDs, and a possible [version 6](http://gh.peabody.io/uuidv6/), releases 4 thru 6 of this module have been skipped.
|
||||||
|
|
||||||
|
### Deep Requires Now Deprecated
|
||||||
|
|
||||||
|
`uuid@3` encouraged the use of deep requires to minimize the bundle size of browser builds:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const uuidv4 = require('uuid/v4'); // <== NOW DEPRECATED!
|
||||||
|
uuidv4();
|
||||||
|
```
|
||||||
|
|
||||||
|
As of `uuid@7` this library now provides ECMAScript modules builds, which allow packagers like Webpack and Rollup to do "tree-shaking" to remove dead code. Instead, use the `import` syntax:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
uuidv4();
|
||||||
|
```
|
||||||
|
|
||||||
|
... or for CommonJS:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const { v4: uuidv4 } = require('uuid');
|
||||||
|
uuidv4();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Default Export Removed
|
||||||
|
|
||||||
|
`uuid@3` was exporting the Version 4 UUID method as a default export:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const uuid = require('uuid'); // <== REMOVED!
|
||||||
|
```
|
||||||
|
|
||||||
|
This usage pattern was already discouraged in `uuid@3` and has been removed in `uuid@7`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Markdown generated from [README_js.md](README_js.md) by <a href="https://github.com/broofa/runmd"><image height="12px" src="https://camo.githubusercontent.com/5c7c603cd1e6a43370b0a5063d457e0dabb74cf317adc7baba183acb686ee8d0/687474703a2f2f692e696d6775722e636f6d2f634a4b6f3662552e706e67" /></a>
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
require('../uuid-bin');
|
||||||
+104
@@ -0,0 +1,104 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "MAX", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _max.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "NIL", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _nil.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "parse", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _parse.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "stringify", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _stringify.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "v1", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _v.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "v1ToV6", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _v1ToV.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "v3", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _v2.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "v4", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _v3.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "v5", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _v4.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "v6", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _v5.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "v6ToV1", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _v6ToV.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "v7", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _v6.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "validate", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _validate.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "version", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function get() {
|
||||||
|
return _version.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var _max = _interopRequireDefault(require("./max.js"));
|
||||||
|
var _nil = _interopRequireDefault(require("./nil.js"));
|
||||||
|
var _parse = _interopRequireDefault(require("./parse.js"));
|
||||||
|
var _stringify = _interopRequireDefault(require("./stringify.js"));
|
||||||
|
var _v = _interopRequireDefault(require("./v1.js"));
|
||||||
|
var _v1ToV = _interopRequireDefault(require("./v1ToV6.js"));
|
||||||
|
var _v2 = _interopRequireDefault(require("./v3.js"));
|
||||||
|
var _v3 = _interopRequireDefault(require("./v4.js"));
|
||||||
|
var _v4 = _interopRequireDefault(require("./v5.js"));
|
||||||
|
var _v5 = _interopRequireDefault(require("./v6.js"));
|
||||||
|
var _v6ToV = _interopRequireDefault(require("./v6ToV1.js"));
|
||||||
|
var _v6 = _interopRequireDefault(require("./v7.js"));
|
||||||
|
var _validate = _interopRequireDefault(require("./validate.js"));
|
||||||
|
var _version = _interopRequireDefault(require("./version.js"));
|
||||||
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
var _default = exports.default = 'ffffffff-ffff-ffff-ffff-ffffffffffff';
|
||||||
+200
@@ -0,0 +1,200 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
/*
|
||||||
|
* Browser-compatible JavaScript MD5
|
||||||
|
*
|
||||||
|
* Modification of JavaScript MD5
|
||||||
|
* https://github.com/blueimp/JavaScript-MD5
|
||||||
|
*
|
||||||
|
* Copyright 2011, Sebastian Tschan
|
||||||
|
* https://blueimp.net
|
||||||
|
*
|
||||||
|
* Licensed under the MIT license:
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*
|
||||||
|
* Based on
|
||||||
|
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
|
||||||
|
* Digest Algorithm, as defined in RFC 1321.
|
||||||
|
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
|
||||||
|
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
||||||
|
* Distributed under the BSD License
|
||||||
|
* See http://pajhome.org.uk/crypt/md5 for more info.
|
||||||
|
*/
|
||||||
|
function md5(bytes) {
|
||||||
|
if (typeof bytes === 'string') {
|
||||||
|
var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
||||||
|
|
||||||
|
bytes = new Uint8Array(msg.length);
|
||||||
|
for (var i = 0; i < msg.length; ++i) {
|
||||||
|
bytes[i] = msg.charCodeAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert an array of little-endian words to an array of bytes
|
||||||
|
*/
|
||||||
|
function md5ToHexEncodedArray(input) {
|
||||||
|
var output = [];
|
||||||
|
var length32 = input.length * 32;
|
||||||
|
var hexTab = '0123456789abcdef';
|
||||||
|
for (var i = 0; i < length32; i += 8) {
|
||||||
|
var x = input[i >> 5] >>> i % 32 & 0xff;
|
||||||
|
var hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
|
||||||
|
output.push(hex);
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate output length with padding and bit length
|
||||||
|
*/
|
||||||
|
function getOutputLength(inputLength8) {
|
||||||
|
return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Calculate the MD5 of an array of little-endian words, and a bit length.
|
||||||
|
*/
|
||||||
|
function wordsToMd5(x, len) {
|
||||||
|
/* append padding */
|
||||||
|
x[len >> 5] |= 0x80 << len % 32;
|
||||||
|
x[getOutputLength(len) - 1] = len;
|
||||||
|
var a = 1732584193;
|
||||||
|
var b = -271733879;
|
||||||
|
var c = -1732584194;
|
||||||
|
var d = 271733878;
|
||||||
|
for (var i = 0; i < x.length; i += 16) {
|
||||||
|
var olda = a;
|
||||||
|
var oldb = b;
|
||||||
|
var oldc = c;
|
||||||
|
var oldd = d;
|
||||||
|
a = md5ff(a, b, c, d, x[i], 7, -680876936);
|
||||||
|
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
|
||||||
|
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
|
||||||
|
b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
||||||
|
a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
|
||||||
|
d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
||||||
|
c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
||||||
|
b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
|
||||||
|
a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
||||||
|
d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
||||||
|
c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
|
||||||
|
b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
||||||
|
a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
||||||
|
d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
|
||||||
|
c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
||||||
|
b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
||||||
|
a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
|
||||||
|
d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
||||||
|
c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
|
||||||
|
b = md5gg(b, c, d, a, x[i], 20, -373897302);
|
||||||
|
a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
|
||||||
|
d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
|
||||||
|
c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
|
||||||
|
b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
|
||||||
|
a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
|
||||||
|
d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
||||||
|
c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
|
||||||
|
b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
||||||
|
a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
||||||
|
d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
|
||||||
|
c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
||||||
|
b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
||||||
|
a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
|
||||||
|
d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
||||||
|
c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
||||||
|
b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
|
||||||
|
a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
||||||
|
d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
||||||
|
c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
|
||||||
|
b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
||||||
|
a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
|
||||||
|
d = md5hh(d, a, b, c, x[i], 11, -358537222);
|
||||||
|
c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
|
||||||
|
b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
|
||||||
|
a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
|
||||||
|
d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
|
||||||
|
c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
|
||||||
|
b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
|
||||||
|
a = md5ii(a, b, c, d, x[i], 6, -198630844);
|
||||||
|
d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
||||||
|
c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
||||||
|
b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
|
||||||
|
a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
||||||
|
d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
||||||
|
c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
|
||||||
|
b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
||||||
|
a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
||||||
|
d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
|
||||||
|
c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
||||||
|
b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
||||||
|
a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
|
||||||
|
d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
||||||
|
c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
|
||||||
|
b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
|
||||||
|
a = safeAdd(a, olda);
|
||||||
|
b = safeAdd(b, oldb);
|
||||||
|
c = safeAdd(c, oldc);
|
||||||
|
d = safeAdd(d, oldd);
|
||||||
|
}
|
||||||
|
return [a, b, c, d];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert an array bytes to an array of little-endian words
|
||||||
|
* Characters >255 have their high-byte silently ignored.
|
||||||
|
*/
|
||||||
|
function bytesToWords(input) {
|
||||||
|
if (input.length === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
var length8 = input.length * 8;
|
||||||
|
var output = new Uint32Array(getOutputLength(length8));
|
||||||
|
for (var i = 0; i < length8; i += 8) {
|
||||||
|
output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
||||||
|
* to work around bugs in some JS interpreters.
|
||||||
|
*/
|
||||||
|
function safeAdd(x, y) {
|
||||||
|
var lsw = (x & 0xffff) + (y & 0xffff);
|
||||||
|
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
||||||
|
return msw << 16 | lsw & 0xffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bitwise rotate a 32-bit number to the left.
|
||||||
|
*/
|
||||||
|
function bitRotateLeft(num, cnt) {
|
||||||
|
return num << cnt | num >>> 32 - cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These functions implement the four basic operations the algorithm uses.
|
||||||
|
*/
|
||||||
|
function md5cmn(q, a, b, x, s, t) {
|
||||||
|
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
|
||||||
|
}
|
||||||
|
function md5ff(a, b, c, d, x, s, t) {
|
||||||
|
return md5cmn(b & c | ~b & d, a, b, x, s, t);
|
||||||
|
}
|
||||||
|
function md5gg(a, b, c, d, x, s, t) {
|
||||||
|
return md5cmn(b & d | c & ~d, a, b, x, s, t);
|
||||||
|
}
|
||||||
|
function md5hh(a, b, c, d, x, s, t) {
|
||||||
|
return md5cmn(b ^ c ^ d, a, b, x, s, t);
|
||||||
|
}
|
||||||
|
function md5ii(a, b, c, d, x, s, t) {
|
||||||
|
return md5cmn(c ^ (b | ~d), a, b, x, s, t);
|
||||||
|
}
|
||||||
|
var _default = exports.default = md5;
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
var randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
||||||
|
var _default = exports.default = {
|
||||||
|
randomUUID
|
||||||
|
};
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
var _default = exports.default = '00000000-0000-0000-0000-000000000000';
|
||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
var _validate = _interopRequireDefault(require("./validate.js"));
|
||||||
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||||
|
function parse(uuid) {
|
||||||
|
if (!(0, _validate.default)(uuid)) {
|
||||||
|
throw TypeError('Invalid UUID');
|
||||||
|
}
|
||||||
|
var v;
|
||||||
|
var arr = new Uint8Array(16);
|
||||||
|
|
||||||
|
// Parse ########-....-....-....-............
|
||||||
|
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
||||||
|
arr[1] = v >>> 16 & 0xff;
|
||||||
|
arr[2] = v >>> 8 & 0xff;
|
||||||
|
arr[3] = v & 0xff;
|
||||||
|
|
||||||
|
// Parse ........-####-....-....-............
|
||||||
|
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
||||||
|
arr[5] = v & 0xff;
|
||||||
|
|
||||||
|
// Parse ........-....-####-....-............
|
||||||
|
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
||||||
|
arr[7] = v & 0xff;
|
||||||
|
|
||||||
|
// Parse ........-....-....-####-............
|
||||||
|
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
||||||
|
arr[9] = v & 0xff;
|
||||||
|
|
||||||
|
// Parse ........-....-....-....-############
|
||||||
|
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
|
||||||
|
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
|
||||||
|
arr[11] = v / 0x100000000 & 0xff;
|
||||||
|
arr[12] = v >>> 24 & 0xff;
|
||||||
|
arr[13] = v >>> 16 & 0xff;
|
||||||
|
arr[14] = v >>> 8 & 0xff;
|
||||||
|
arr[15] = v & 0xff;
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
var _default = exports.default = parse;
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
var _default = exports.default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = rng;
|
||||||
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
||||||
|
// require the crypto API and do not support built-in fallback to lower quality random number
|
||||||
|
// generators (like Math.random()).
|
||||||
|
|
||||||
|
var getRandomValues;
|
||||||
|
var rnds8 = new Uint8Array(16);
|
||||||
|
function rng() {
|
||||||
|
// lazy load so that environments that need to polyfill have a chance to do so
|
||||||
|
if (!getRandomValues) {
|
||||||
|
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
||||||
|
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
||||||
|
if (!getRandomValues) {
|
||||||
|
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getRandomValues(rnds8);
|
||||||
|
}
|
||||||
+82
@@ -0,0 +1,82 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
// Adapted from Chris Veness' SHA1 code at
|
||||||
|
// http://www.movable-type.co.uk/scripts/sha1.html
|
||||||
|
function f(s, x, y, z) {
|
||||||
|
switch (s) {
|
||||||
|
case 0:
|
||||||
|
return x & y ^ ~x & z;
|
||||||
|
case 1:
|
||||||
|
return x ^ y ^ z;
|
||||||
|
case 2:
|
||||||
|
return x & y ^ x & z ^ y & z;
|
||||||
|
case 3:
|
||||||
|
return x ^ y ^ z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function ROTL(x, n) {
|
||||||
|
return x << n | x >>> 32 - n;
|
||||||
|
}
|
||||||
|
function sha1(bytes) {
|
||||||
|
var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
|
||||||
|
var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
|
||||||
|
if (typeof bytes === 'string') {
|
||||||
|
var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
||||||
|
|
||||||
|
bytes = [];
|
||||||
|
for (var i = 0; i < msg.length; ++i) {
|
||||||
|
bytes.push(msg.charCodeAt(i));
|
||||||
|
}
|
||||||
|
} else if (!Array.isArray(bytes)) {
|
||||||
|
// Convert Array-like to Array
|
||||||
|
bytes = Array.prototype.slice.call(bytes);
|
||||||
|
}
|
||||||
|
bytes.push(0x80);
|
||||||
|
var l = bytes.length / 4 + 2;
|
||||||
|
var N = Math.ceil(l / 16);
|
||||||
|
var M = new Array(N);
|
||||||
|
for (var _i = 0; _i < N; ++_i) {
|
||||||
|
var arr = new Uint32Array(16);
|
||||||
|
for (var j = 0; j < 16; ++j) {
|
||||||
|
arr[j] = bytes[_i * 64 + j * 4] << 24 | bytes[_i * 64 + j * 4 + 1] << 16 | bytes[_i * 64 + j * 4 + 2] << 8 | bytes[_i * 64 + j * 4 + 3];
|
||||||
|
}
|
||||||
|
M[_i] = arr;
|
||||||
|
}
|
||||||
|
M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
|
||||||
|
M[N - 1][14] = Math.floor(M[N - 1][14]);
|
||||||
|
M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
|
||||||
|
for (var _i2 = 0; _i2 < N; ++_i2) {
|
||||||
|
var W = new Uint32Array(80);
|
||||||
|
for (var t = 0; t < 16; ++t) {
|
||||||
|
W[t] = M[_i2][t];
|
||||||
|
}
|
||||||
|
for (var _t = 16; _t < 80; ++_t) {
|
||||||
|
W[_t] = ROTL(W[_t - 3] ^ W[_t - 8] ^ W[_t - 14] ^ W[_t - 16], 1);
|
||||||
|
}
|
||||||
|
var a = H[0];
|
||||||
|
var b = H[1];
|
||||||
|
var c = H[2];
|
||||||
|
var d = H[3];
|
||||||
|
var e = H[4];
|
||||||
|
for (var _t2 = 0; _t2 < 80; ++_t2) {
|
||||||
|
var s = Math.floor(_t2 / 20);
|
||||||
|
var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[_t2] >>> 0;
|
||||||
|
e = d;
|
||||||
|
d = c;
|
||||||
|
c = ROTL(b, 30) >>> 0;
|
||||||
|
b = a;
|
||||||
|
a = T;
|
||||||
|
}
|
||||||
|
H[0] = H[0] + a >>> 0;
|
||||||
|
H[1] = H[1] + b >>> 0;
|
||||||
|
H[2] = H[2] + c >>> 0;
|
||||||
|
H[3] = H[3] + d >>> 0;
|
||||||
|
H[4] = H[4] + e >>> 0;
|
||||||
|
}
|
||||||
|
return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
|
||||||
|
}
|
||||||
|
var _default = exports.default = sha1;
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
exports.unsafeStringify = unsafeStringify;
|
||||||
|
var _validate = _interopRequireDefault(require("./validate.js"));
|
||||||
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||||
|
/**
|
||||||
|
* Convert array of 16 byte values to UUID string format of the form:
|
||||||
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||||||
|
*/
|
||||||
|
var byteToHex = [];
|
||||||
|
for (var i = 0; i < 256; ++i) {
|
||||||
|
byteToHex.push((i + 0x100).toString(16).slice(1));
|
||||||
|
}
|
||||||
|
function unsafeStringify(arr, offset = 0) {
|
||||||
|
// Note: Be careful editing this code! It's been tuned for performance
|
||||||
|
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
||||||
|
//
|
||||||
|
// Note to future-self: No, you can't remove the `toLowerCase()` call.
|
||||||
|
// REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351
|
||||||
|
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
||||||
|
}
|
||||||
|
function stringify(arr, offset = 0) {
|
||||||
|
var uuid = unsafeStringify(arr, offset);
|
||||||
|
// Consistency check for valid UUID. If this throws, it's likely due to one
|
||||||
|
// of the following:
|
||||||
|
// - One or more input array values don't map to a hex octet (leading to
|
||||||
|
// "undefined" in the uuid)
|
||||||
|
// - Invalid input values for the RFC `version` or `variant` fields
|
||||||
|
if (!(0, _validate.default)(uuid)) {
|
||||||
|
throw TypeError('Stringified UUID is invalid');
|
||||||
|
}
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
var _default = exports.default = stringify;
|
||||||
+131
@@ -0,0 +1,131 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
var _rng = _interopRequireDefault(require("./rng.js"));
|
||||||
|
var _stringify = require("./stringify.js");
|
||||||
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||||
|
// **`v1()` - Generate time-based UUID**
|
||||||
|
//
|
||||||
|
// Inspired by https://github.com/LiosK/UUID.js
|
||||||
|
// and http://docs.python.org/library/uuid.html
|
||||||
|
|
||||||
|
var _nodeId;
|
||||||
|
var _clockseq;
|
||||||
|
|
||||||
|
// Previous uuid creation time
|
||||||
|
var _lastMSecs = 0;
|
||||||
|
var _lastNSecs = 0;
|
||||||
|
|
||||||
|
// See https://github.com/uuidjs/uuid for API details
|
||||||
|
function v1(options, buf, offset) {
|
||||||
|
var i = buf && offset || 0;
|
||||||
|
var b = buf || new Array(16);
|
||||||
|
options = options || {};
|
||||||
|
var node = options.node;
|
||||||
|
var clockseq = options.clockseq;
|
||||||
|
|
||||||
|
// v1 only: Use cached `node` and `clockseq` values
|
||||||
|
if (!options._v6) {
|
||||||
|
if (!node) {
|
||||||
|
node = _nodeId;
|
||||||
|
}
|
||||||
|
if (clockseq == null) {
|
||||||
|
clockseq = _clockseq;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle cases where we need entropy. We do this lazily to minimize issues
|
||||||
|
// related to insufficient system entropy. See #189
|
||||||
|
if (node == null || clockseq == null) {
|
||||||
|
var seedBytes = options.random || (options.rng || _rng.default)();
|
||||||
|
|
||||||
|
// Randomize node
|
||||||
|
if (node == null) {
|
||||||
|
node = [seedBytes[0], seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
||||||
|
|
||||||
|
// v1 only: cache node value for reuse
|
||||||
|
if (!_nodeId && !options._v6) {
|
||||||
|
// per RFC4122 4.5: Set MAC multicast bit (v1 only)
|
||||||
|
node[0] |= 0x01; // Set multicast bit
|
||||||
|
|
||||||
|
_nodeId = node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Randomize clockseq
|
||||||
|
if (clockseq == null) {
|
||||||
|
// Per 4.2.2, randomize (14 bit) clockseq
|
||||||
|
clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
|
||||||
|
if (_clockseq === undefined && !options._v6) {
|
||||||
|
_clockseq = clockseq;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// v1 & v6 timestamps are 100 nano-second units since the Gregorian epoch,
|
||||||
|
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so time is
|
||||||
|
// handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
||||||
|
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
||||||
|
var msecs = options.msecs !== undefined ? options.msecs : Date.now();
|
||||||
|
|
||||||
|
// Per 4.2.1.2, use count of uuid's generated during the current clock
|
||||||
|
// cycle to simulate higher resolution clock
|
||||||
|
var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
|
||||||
|
|
||||||
|
// Time since last uuid creation (in msecs)
|
||||||
|
var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000;
|
||||||
|
|
||||||
|
// Per 4.2.1.2, Bump clockseq on clock regression
|
||||||
|
if (dt < 0 && options.clockseq === undefined) {
|
||||||
|
clockseq = clockseq + 1 & 0x3fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
||||||
|
// time interval
|
||||||
|
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
||||||
|
nsecs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Per 4.2.1.2 Throw error if too many uuids are requested
|
||||||
|
if (nsecs >= 10000) {
|
||||||
|
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
|
||||||
|
}
|
||||||
|
_lastMSecs = msecs;
|
||||||
|
_lastNSecs = nsecs;
|
||||||
|
_clockseq = clockseq;
|
||||||
|
|
||||||
|
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
||||||
|
msecs += 12219292800000;
|
||||||
|
|
||||||
|
// `time_low`
|
||||||
|
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
||||||
|
b[i++] = tl >>> 24 & 0xff;
|
||||||
|
b[i++] = tl >>> 16 & 0xff;
|
||||||
|
b[i++] = tl >>> 8 & 0xff;
|
||||||
|
b[i++] = tl & 0xff;
|
||||||
|
|
||||||
|
// `time_mid`
|
||||||
|
var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
|
||||||
|
b[i++] = tmh >>> 8 & 0xff;
|
||||||
|
b[i++] = tmh & 0xff;
|
||||||
|
|
||||||
|
// `time_high_and_version`
|
||||||
|
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
||||||
|
b[i++] = tmh >>> 16 & 0xff;
|
||||||
|
|
||||||
|
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
||||||
|
b[i++] = clockseq >>> 8 | 0x80;
|
||||||
|
|
||||||
|
// `clock_seq_low`
|
||||||
|
b[i++] = clockseq & 0xff;
|
||||||
|
|
||||||
|
// `node`
|
||||||
|
for (var n = 0; n < 6; ++n) {
|
||||||
|
b[i + n] = node[n];
|
||||||
|
}
|
||||||
|
return buf || (0, _stringify.unsafeStringify)(b);
|
||||||
|
}
|
||||||
|
var _default = exports.default = v1;
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = v1ToV6;
|
||||||
|
var _parse = _interopRequireDefault(require("./parse.js"));
|
||||||
|
var _stringify = require("./stringify.js");
|
||||||
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||||
|
/**
|
||||||
|
* Convert a v1 UUID to a v6 UUID
|
||||||
|
*
|
||||||
|
* @param {string|Uint8Array} uuid - The v1 UUID to convert to v6
|
||||||
|
* @returns {string|Uint8Array} The v6 UUID as the same type as the `uuid` arg
|
||||||
|
* (string or Uint8Array)
|
||||||
|
*/
|
||||||
|
function v1ToV6(uuid) {
|
||||||
|
var v1Bytes = typeof uuid === 'string' ? (0, _parse.default)(uuid) : uuid;
|
||||||
|
var v6Bytes = _v1ToV6(v1Bytes);
|
||||||
|
return typeof uuid === 'string' ? (0, _stringify.unsafeStringify)(v6Bytes) : v6Bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do the field transformation needed for v1 -> v6
|
||||||
|
function _v1ToV6(v1Bytes, randomize = false) {
|
||||||
|
return Uint8Array.of((v1Bytes[6] & 0x0f) << 4 | v1Bytes[7] >> 4 & 0x0f, (v1Bytes[7] & 0x0f) << 4 | (v1Bytes[4] & 0xf0) >> 4, (v1Bytes[4] & 0x0f) << 4 | (v1Bytes[5] & 0xf0) >> 4, (v1Bytes[5] & 0x0f) << 4 | (v1Bytes[0] & 0xf0) >> 4, (v1Bytes[0] & 0x0f) << 4 | (v1Bytes[1] & 0xf0) >> 4, (v1Bytes[1] & 0x0f) << 4 | (v1Bytes[2] & 0xf0) >> 4, 0x60 | v1Bytes[2] & 0x0f, v1Bytes[3], v1Bytes[8], v1Bytes[9], v1Bytes[10], v1Bytes[11], v1Bytes[12], v1Bytes[13], v1Bytes[14], v1Bytes[15]);
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
var _v = _interopRequireDefault(require("./v35.js"));
|
||||||
|
var _md = _interopRequireDefault(require("./md5.js"));
|
||||||
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||||
|
var v3 = (0, _v.default)('v3', 0x30, _md.default);
|
||||||
|
var _default = exports.default = v3;
|
||||||
+63
@@ -0,0 +1,63 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.URL = exports.DNS = void 0;
|
||||||
|
exports.default = v35;
|
||||||
|
var _stringify = require("./stringify.js");
|
||||||
|
var _parse = _interopRequireDefault(require("./parse.js"));
|
||||||
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||||
|
function stringToBytes(str) {
|
||||||
|
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
||||||
|
|
||||||
|
var bytes = [];
|
||||||
|
for (var i = 0; i < str.length; ++i) {
|
||||||
|
bytes.push(str.charCodeAt(i));
|
||||||
|
}
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
var DNS = exports.DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
||||||
|
var URL = exports.URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
||||||
|
function v35(name, version, hashfunc) {
|
||||||
|
function generateUUID(value, namespace, buf, offset) {
|
||||||
|
var _namespace;
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
value = stringToBytes(value);
|
||||||
|
}
|
||||||
|
if (typeof namespace === 'string') {
|
||||||
|
namespace = (0, _parse.default)(namespace);
|
||||||
|
}
|
||||||
|
if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
|
||||||
|
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute hash of namespace and value, Per 4.3
|
||||||
|
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
||||||
|
// hashfunc([...namespace, ... value])`
|
||||||
|
var bytes = new Uint8Array(16 + value.length);
|
||||||
|
bytes.set(namespace);
|
||||||
|
bytes.set(value, namespace.length);
|
||||||
|
bytes = hashfunc(bytes);
|
||||||
|
bytes[6] = bytes[6] & 0x0f | version;
|
||||||
|
bytes[8] = bytes[8] & 0x3f | 0x80;
|
||||||
|
if (buf) {
|
||||||
|
offset = offset || 0;
|
||||||
|
for (var i = 0; i < 16; ++i) {
|
||||||
|
buf[offset + i] = bytes[i];
|
||||||
|
}
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
return (0, _stringify.unsafeStringify)(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function#name is not settable on some platforms (#270)
|
||||||
|
try {
|
||||||
|
generateUUID.name = name;
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
|
// For CommonJS default export support
|
||||||
|
generateUUID.DNS = DNS;
|
||||||
|
generateUUID.URL = URL;
|
||||||
|
return generateUUID;
|
||||||
|
}
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
var _native = _interopRequireDefault(require("./native.js"));
|
||||||
|
var _rng = _interopRequireDefault(require("./rng.js"));
|
||||||
|
var _stringify = require("./stringify.js");
|
||||||
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||||
|
function v4(options, buf, offset) {
|
||||||
|
if (_native.default.randomUUID && !buf && !options) {
|
||||||
|
return _native.default.randomUUID();
|
||||||
|
}
|
||||||
|
options = options || {};
|
||||||
|
var rnds = options.random || (options.rng || _rng.default)();
|
||||||
|
|
||||||
|
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
||||||
|
rnds[6] = rnds[6] & 0x0f | 0x40;
|
||||||
|
rnds[8] = rnds[8] & 0x3f | 0x80;
|
||||||
|
|
||||||
|
// Copy bytes to buffer, if provided
|
||||||
|
if (buf) {
|
||||||
|
offset = offset || 0;
|
||||||
|
for (var i = 0; i < 16; ++i) {
|
||||||
|
buf[offset + i] = rnds[i];
|
||||||
|
}
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
return (0, _stringify.unsafeStringify)(rnds);
|
||||||
|
}
|
||||||
|
var _default = exports.default = v4;
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
var _v = _interopRequireDefault(require("./v35.js"));
|
||||||
|
var _sha = _interopRequireDefault(require("./sha1.js"));
|
||||||
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||||
|
var v5 = (0, _v.default)('v5', 0x50, _sha.default);
|
||||||
|
var _default = exports.default = v5;
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = v6;
|
||||||
|
var _stringify = require("./stringify.js");
|
||||||
|
var _v = _interopRequireDefault(require("./v1.js"));
|
||||||
|
var _v1ToV = _interopRequireDefault(require("./v1ToV6.js"));
|
||||||
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||||
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||||
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||||
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||||
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
||||||
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {object} options
|
||||||
|
* @param {Uint8Array=} buf
|
||||||
|
* @param {number=} offset
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
function v6(options = {}, buf, offset = 0) {
|
||||||
|
// v6 is v1 with different field layout, so we start with a v1 UUID, albeit
|
||||||
|
// with slightly different behavior around how the clock_seq and node fields
|
||||||
|
// are randomized, which is why we call v1 with _v6: true.
|
||||||
|
var bytes = (0, _v.default)(_objectSpread(_objectSpread({}, options), {}, {
|
||||||
|
_v6: true
|
||||||
|
}), new Uint8Array(16));
|
||||||
|
|
||||||
|
// Reorder the fields to v6 layout.
|
||||||
|
bytes = (0, _v1ToV.default)(bytes);
|
||||||
|
|
||||||
|
// Return as a byte array if requested
|
||||||
|
if (buf) {
|
||||||
|
for (var i = 0; i < 16; i++) {
|
||||||
|
buf[offset + i] = bytes[i];
|
||||||
|
}
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
return (0, _stringify.unsafeStringify)(bytes);
|
||||||
|
}
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = v6ToV1;
|
||||||
|
var _parse = _interopRequireDefault(require("./parse.js"));
|
||||||
|
var _stringify = require("./stringify.js");
|
||||||
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||||
|
/**
|
||||||
|
* Convert a v6 UUID to a v1 UUID
|
||||||
|
*
|
||||||
|
* @param {string|Uint8Array} uuid - The v6 UUID to convert to v6
|
||||||
|
* @returns {string|Uint8Array} The v1 UUID as the same type as the `uuid` arg
|
||||||
|
* (string or Uint8Array)
|
||||||
|
*/
|
||||||
|
function v6ToV1(uuid) {
|
||||||
|
var v6Bytes = typeof uuid === 'string' ? (0, _parse.default)(uuid) : uuid;
|
||||||
|
var v1Bytes = _v6ToV1(v6Bytes);
|
||||||
|
return typeof uuid === 'string' ? (0, _stringify.unsafeStringify)(v1Bytes) : v1Bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do the field transformation needed for v6 -> v1
|
||||||
|
function _v6ToV1(v6Bytes) {
|
||||||
|
return Uint8Array.of((v6Bytes[3] & 0x0f) << 4 | v6Bytes[4] >> 4 & 0x0f, (v6Bytes[4] & 0x0f) << 4 | (v6Bytes[5] & 0xf0) >> 4, (v6Bytes[5] & 0x0f) << 4 | v6Bytes[6] & 0x0f, v6Bytes[7], (v6Bytes[1] & 0x0f) << 4 | (v6Bytes[2] & 0xf0) >> 4, (v6Bytes[2] & 0x0f) << 4 | (v6Bytes[3] & 0xf0) >> 4, 0x10 | (v6Bytes[0] & 0xf0) >> 4, (v6Bytes[0] & 0x0f) << 4 | (v6Bytes[1] & 0xf0) >> 4, v6Bytes[8], v6Bytes[9], v6Bytes[10], v6Bytes[11], v6Bytes[12], v6Bytes[13], v6Bytes[14], v6Bytes[15]);
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user