豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit d5a603c

Browse files
committed
Merge branch 'main' into orkon/lighthouse
2 parents b3cd5ee + 0ccc15e commit d5a603c

File tree

3 files changed

+240
-4
lines changed

3 files changed

+240
-4
lines changed

rollup.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,22 @@ const bundleDependency = (
211211
);
212212
}
213213

214+
// Add chrome-devtools-frontend main license
215+
const lighthouseLicensePath = path.join(
216+
process.cwd(),
217+
'node_modules/lighthouse/LICENSE',
218+
);
219+
if (fs.existsSync(lighthouseLicensePath)) {
220+
manualLicenses.push(
221+
[
222+
'Name: lighthouse',
223+
'License: Apache-2.0',
224+
'',
225+
fs.readFileSync(lighthouseLicensePath, 'utf-8'),
226+
].join('\n'),
227+
);
228+
}
229+
214230
for (const thirdPartyDir of thirdPartyDirectories) {
215231
const fullPath = path.join(process.cwd(), thirdPartyDir);
216232
const licenseFile = path.join(fullPath, 'LICENSE');

scripts/count_tokens.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
import {readFileSync} from 'node:fs';
78
import {parseArgs} from 'node:util';
89

910
import {GoogleGenAI} from '@google/genai';
@@ -16,18 +17,28 @@ const {values, positionals} = parseArgs({
1617
type: 'string',
1718
default: 'gemini-2.5-flash',
1819
},
20+
file: {
21+
type: 'string',
22+
short: 'f',
23+
},
1924
},
2025
allowPositionals: true,
2126
});
2227

23-
if (!positionals[0]) {
24-
console.error('Usage: npm run count-tokens -- -- <text>');
28+
let contents = positionals[0];
29+
30+
if (values.file) {
31+
contents = readFileSync(values.file, 'utf8');
32+
}
33+
34+
if (!contents) {
35+
console.error('Usage: npm run count-tokens -- [-f <file>] [<text>]');
2536
process.exit(1);
2637
}
2738

2839
const response = await ai.models.countTokens({
2940
model: values.model,
30-
contents: positionals[0],
41+
contents,
3142
});
32-
console.log(`Input: ${positionals[0]}`);
43+
console.log(`Input: ${values.file || positionals[0]}`);
3344
console.log(`Tokens: ${response.totalTokens}`);

tests/third_party_notices.test.js.snapshot

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,215 @@ License: Apache-2.0
14491449
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14501450

14511451

1452+
-------------------- DEPENDENCY DIVIDER --------------------
1453+
1454+
Name: lighthouse
1455+
License: Apache-2.0
1456+
1457+
1458+
Apache License
1459+
Version 2.0, January 2004
1460+
http://www.apache.org/licenses/
1461+
1462+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1463+
1464+
1. Definitions.
1465+
1466+
"License" shall mean the terms and conditions for use, reproduction,
1467+
and distribution as defined by Sections 1 through 9 of this document.
1468+
1469+
"Licensor" shall mean the copyright owner or entity authorized by
1470+
the copyright owner that is granting the License.
1471+
1472+
"Legal Entity" shall mean the union of the acting entity and all
1473+
other entities that control, are controlled by, or are under common
1474+
control with that entity. For the purposes of this definition,
1475+
"control" means (i) the power, direct or indirect, to cause the
1476+
direction or management of such entity, whether by contract or
1477+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
1478+
outstanding shares, or (iii) beneficial ownership of such entity.
1479+
1480+
"You" (or "Your") shall mean an individual or Legal Entity
1481+
exercising permissions granted by this License.
1482+
1483+
"Source" form shall mean the preferred form for making modifications,
1484+
including but not limited to software source code, documentation
1485+
source, and configuration files.
1486+
1487+
"Object" form shall mean any form resulting from mechanical
1488+
transformation or translation of a Source form, including but
1489+
not limited to compiled object code, generated documentation,
1490+
and conversions to other media types.
1491+
1492+
"Work" shall mean the work of authorship, whether in Source or
1493+
Object form, made available under the License, as indicated by a
1494+
copyright notice that is included in or attached to the work
1495+
(an example is provided in the Appendix below).
1496+
1497+
"Derivative Works" shall mean any work, whether in Source or Object
1498+
form, that is based on (or derived from) the Work and for which the
1499+
editorial revisions, annotations, elaborations, or other modifications
1500+
represent, as a whole, an original work of authorship. For the purposes
1501+
of this License, Derivative Works shall not include works that remain
1502+
separable from, or merely link (or bind by name) to the interfaces of,
1503+
the Work and Derivative Works thereof.
1504+
1505+
"Contribution" shall mean any work of authorship, including
1506+
the original version of the Work and any modifications or additions
1507+
to that Work or Derivative Works thereof, that is intentionally
1508+
submitted to Licensor for inclusion in the Work by the copyright owner
1509+
or by an individual or Legal Entity authorized to submit on behalf of
1510+
the copyright owner. For the purposes of this definition, "submitted"
1511+
means any form of electronic, verbal, or written communication sent
1512+
to the Licensor or its representatives, including but not limited to
1513+
communication on electronic mailing lists, source code control systems,
1514+
and issue tracking systems that are managed by, or on behalf of, the
1515+
Licensor for the purpose of discussing and improving the Work, but
1516+
excluding communication that is conspicuously marked or otherwise
1517+
designated in writing by the copyright owner as "Not a Contribution."
1518+
1519+
"Contributor" shall mean Licensor and any individual or Legal Entity
1520+
on behalf of whom a Contribution has been received by Licensor and
1521+
subsequently incorporated within the Work.
1522+
1523+
2. Grant of Copyright License. Subject to the terms and conditions of
1524+
this License, each Contributor hereby grants to You a perpetual,
1525+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1526+
copyright license to reproduce, prepare Derivative Works of,
1527+
publicly display, publicly perform, sublicense, and distribute the
1528+
Work and such Derivative Works in Source or Object form.
1529+
1530+
3. Grant of Patent License. Subject to the terms and conditions of
1531+
this License, each Contributor hereby grants to You a perpetual,
1532+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1533+
(except as stated in this section) patent license to make, have made,
1534+
use, offer to sell, sell, import, and otherwise transfer the Work,
1535+
where such license applies only to those patent claims licensable
1536+
by such Contributor that are necessarily infringed by their
1537+
Contribution(s) alone or by combination of their Contribution(s)
1538+
with the Work to which such Contribution(s) was submitted. If You
1539+
institute patent litigation against any entity (including a
1540+
cross-claim or counterclaim in a lawsuit) alleging that the Work
1541+
or a Contribution incorporated within the Work constitutes direct
1542+
or contributory patent infringement, then any patent licenses
1543+
granted to You under this License for that Work shall terminate
1544+
as of the date such litigation is filed.
1545+
1546+
4. Redistribution. You may reproduce and distribute copies of the
1547+
Work or Derivative Works thereof in any medium, with or without
1548+
modifications, and in Source or Object form, provided that You
1549+
meet the following conditions:
1550+
1551+
(a) You must give any other recipients of the Work or
1552+
Derivative Works a copy of this License; and
1553+
1554+
(b) You must cause any modified files to carry prominent notices
1555+
stating that You changed the files; and
1556+
1557+
(c) You must retain, in the Source form of any Derivative Works
1558+
that You distribute, all copyright, patent, trademark, and
1559+
attribution notices from the Source form of the Work,
1560+
excluding those notices that do not pertain to any part of
1561+
the Derivative Works; and
1562+
1563+
(d) If the Work includes a "NOTICE" text file as part of its
1564+
distribution, then any Derivative Works that You distribute must
1565+
include a readable copy of the attribution notices contained
1566+
within such NOTICE file, excluding those notices that do not
1567+
pertain to any part of the Derivative Works, in at least one
1568+
of the following places: within a NOTICE text file distributed
1569+
as part of the Derivative Works; within the Source form or
1570+
documentation, if provided along with the Derivative Works; or,
1571+
within a display generated by the Derivative Works, if and
1572+
wherever such third-party notices normally appear. The contents
1573+
of the NOTICE file are for informational purposes only and
1574+
do not modify the License. You may add Your own attribution
1575+
notices within Derivative Works that You distribute, alongside
1576+
or as an addendum to the NOTICE text from the Work, provided
1577+
that such additional attribution notices cannot be construed
1578+
as modifying the License.
1579+
1580+
You may add Your own copyright statement to Your modifications and
1581+
may provide additional or different license terms and conditions
1582+
for use, reproduction, or distribution of Your modifications, or
1583+
for any such Derivative Works as a whole, provided Your use,
1584+
reproduction, and distribution of the Work otherwise complies with
1585+
the conditions stated in this License.
1586+
1587+
5. Submission of Contributions. Unless You explicitly state otherwise,
1588+
any Contribution intentionally submitted for inclusion in the Work
1589+
by You to the Licensor shall be under the terms and conditions of
1590+
this License, without any additional terms or conditions.
1591+
Notwithstanding the above, nothing herein shall supersede or modify
1592+
the terms of any separate license agreement you may have executed
1593+
with Licensor regarding such Contributions.
1594+
1595+
6. Trademarks. This License does not grant permission to use the trade
1596+
names, trademarks, service marks, or product names of the Licensor,
1597+
except as required for reasonable and customary use in describing the
1598+
origin of the Work and reproducing the content of the NOTICE file.
1599+
1600+
7. Disclaimer of Warranty. Unless required by applicable law or
1601+
agreed to in writing, Licensor provides the Work (and each
1602+
Contributor provides its Contributions) on an "AS IS" BASIS,
1603+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1604+
implied, including, without limitation, any warranties or conditions
1605+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1606+
PARTICULAR PURPOSE. You are solely responsible for determining the
1607+
appropriateness of using or redistributing the Work and assume any
1608+
risks associated with Your exercise of permissions under this License.
1609+
1610+
8. Limitation of Liability. In no event and under no legal theory,
1611+
whether in tort (including negligence), contract, or otherwise,
1612+
unless required by applicable law (such as deliberate and grossly
1613+
negligent acts) or agreed to in writing, shall any Contributor be
1614+
liable to You for damages, including any direct, indirect, special,
1615+
incidental, or consequential damages of any character arising as a
1616+
result of this License or out of the use or inability to use the
1617+
Work (including but not limited to damages for loss of goodwill,
1618+
work stoppage, computer failure or malfunction, or any and all
1619+
other commercial damages or losses), even if such Contributor
1620+
has been advised of the possibility of such damages.
1621+
1622+
9. Accepting Warranty or Additional Liability. While redistributing
1623+
the Work or Derivative Works thereof, You may choose to offer,
1624+
and charge a fee for, acceptance of support, warranty, indemnity,
1625+
or other liability obligations and/or rights consistent with this
1626+
License. However, in accepting such obligations, You may act only
1627+
on Your own behalf and on Your sole responsibility, not on behalf
1628+
of any other Contributor, and only if You agree to indemnify,
1629+
defend, and hold each Contributor harmless for any liability
1630+
incurred by, or claims asserted against, such Contributor by reason
1631+
of your accepting any such warranty or additional liability.
1632+
1633+
END OF TERMS AND CONDITIONS
1634+
1635+
APPENDIX: How to apply the Apache License to your work.
1636+
1637+
To apply the Apache License to your work, attach the following
1638+
boilerplate notice, with the fields enclosed by brackets "[]"
1639+
replaced with your own identifying information. (Don't include
1640+
the brackets!) The text should be enclosed in the appropriate
1641+
comment syntax for the file format. We also recommend that a
1642+
file or class name and description of purpose be included on the
1643+
same "printed page" as the copyright notice for easier
1644+
identification within third-party archives.
1645+
1646+
Copyright [yyyy] [name of copyright owner]
1647+
1648+
Licensed under the Apache License, Version 2.0 (the "License");
1649+
you may not use this file except in compliance with the License.
1650+
You may obtain a copy of the License at
1651+
1652+
http://www.apache.org/licenses/LICENSE-2.0
1653+
1654+
Unless required by applicable law or agreed to in writing, software
1655+
distributed under the License is distributed on an "AS IS" BASIS,
1656+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1657+
See the License for the specific language governing permissions and
1658+
limitations under the License.
1659+
1660+
14521661
-------------------- DEPENDENCY DIVIDER --------------------
14531662

14541663
Name: i18n

0 commit comments

Comments
 (0)