me dejaron cocinar demaciado

This commit is contained in:
2025-04-14 16:10:37 -03:00
parent bd510cb94b
commit 07727cee79
5655 changed files with 293183 additions and 0 deletions

373
node_modules/lightningcss/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,373 @@
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

105
node_modules/lightningcss/README.md generated vendored Normal file
View File

@@ -0,0 +1,105 @@
# ⚡️ Lightning CSS
An extremely fast CSS parser, transformer, and minifier written in Rust. Use it with [Parcel](https://parceljs.org), as a standalone library or CLI, or via a plugin with any other tool.
<img width="680" alt="performance and build size charts" src="https://user-images.githubusercontent.com/19409/189022599-28246659-f94a-46a4-9de0-b6d17adb0e22.png#gh-light-mode-only">
<img width="680" alt="performance and build size charts" src="https://user-images.githubusercontent.com/19409/189022693-6956b044-422b-4f56-9628-d59c6f791095.png#gh-dark-mode-only">
## Features
- **Extremely fast** Parsing and minifying large files is completed in milliseconds, often with significantly smaller output than other tools. See [benchmarks](#benchmarks) below.
- **Typed property values** many other CSS parsers treat property values as an untyped series of tokens. This means that each transformer that wants to do something with these values must interpret them itself, leading to duplicate work and inconsistencies. Lightning CSS parses all values using the grammar from the CSS specification, and exposes a specific value type for each property.
- **Browser-grade parser** Lightning CSS is built on the [cssparser](https://github.com/servo/rust-cssparser) and [selectors](https://github.com/servo/stylo/tree/main/selectors) crates created by Mozilla and used by Firefox and Servo. These provide a solid general purpose CSS-parsing foundation on top of which Lightning CSS implements support for all specific CSS rules and properties.
- **Minification** One of the main purposes of Lightning CSS is to minify CSS to make it smaller. This includes many optimizations including:
- Combining longhand properties into shorthands where possible.
- Merging adjacent rules with the same selectors or declarations when it is safe to do so.
- Combining CSS transforms into a single matrix or vice versa when smaller.
- Removing vendor prefixes that are not needed, based on the provided browser targets.
- Reducing `calc()` expressions where possible.
- Converting colors to shorter hex notation where possible.
- Minifying gradients.
- Minifying CSS grid templates.
- Normalizing property value order.
- Removing default property sub-values which will be inferred by browsers.
- Many micro-optimizations, e.g. converting to shorter units, removing unnecessary quotation marks, etc.
- **Vendor prefixing** Lightning CSS accepts a list of browser targets, and automatically adds (and removes) vendor prefixes.
- **Browserslist configuration** Lightning CSS supports opt-in browserslist configuration discovery to resolve browser targets and integrate with your existing tools and config setup.
- **Syntax lowering** Lightning CSS parses modern CSS syntax, and generates more compatible output where needed, based on browser targets.
- CSS Nesting
- Custom media queries (draft spec)
- Logical properties
* [Color Level 5](https://drafts.csswg.org/css-color-5/)
- `color-mix()` function
- Relative color syntax, e.g. `lab(from purple calc(l * .8) a b)`
- [Color Level 4](https://drafts.csswg.org/css-color-4/)
- `lab()`, `lch()`, `oklab()`, and `oklch()` colors
- `color()` function supporting predefined color spaces such as `display-p3` and `xyz`
- Space separated components in `rgb` and `hsl` functions
- Hex with alpha syntax
- `hwb()` color syntax
- Percent syntax for opacity
- `#rgba` and `#rrggbbaa` hex colors
- Selectors
- `:not` with multiple arguments
- `:lang` with multiple arguments
- `:dir`
- `:is`
- Double position gradient stops (e.g. `red 40% 80%`)
- `clamp()`, `round()`, `rem()`, and `mod()` math functions
- Alignment shorthands (e.g. `place-items`)
- Two-value `overflow` shorthand
- Media query range syntax (e.g. `@media (width <= 100px)` or `@media (100px < width < 500px)`)
- Multi-value `display` property (e.g. `inline flex`)
- `system-ui` font family fallbacks
- **CSS modules** Lightning CSS supports compiling a subset of [CSS modules](https://github.com/css-modules/css-modules) features.
- Locally scoped class and id selectors
- Locally scoped custom identifiers, e.g. `@keyframes` names, grid lines/areas, `@counter-style` names, etc.
- Opt-in support for locally scoped CSS variables and other dashed identifiers.
- `:local()` and `:global()` selectors
- The `composes` property
- **Custom transforms** The Lightning CSS visitor API can be used to implement custom transform plugins.
## Documentation
Lightning CSS can be used from [Parcel](https://parceljs.org), as a standalone library from JavaScript or Rust, using a standalone CLI, or wrapped as a plugin within any other tool. See the [Lightning CSS website](https://lightningcss.dev/docs.html) for documentation.
## Benchmarks
<img width="680" alt="performance and build size charts" src="https://user-images.githubusercontent.com/19409/189022599-28246659-f94a-46a4-9de0-b6d17adb0e22.png#gh-light-mode-only">
<img width="680" alt="performance and build size charts" src="https://user-images.githubusercontent.com/19409/189022693-6956b044-422b-4f56-9628-d59c6f791095.png#gh-dark-mode-only">
```
$ node bench.js bootstrap-4.css
cssnano: 544.809ms
159636 bytes
esbuild: 17.199ms
160332 bytes
lightningcss: 4.16ms
143091 bytes
$ node bench.js animate.css
cssnano: 283.105ms
71723 bytes
esbuild: 11.858ms
72183 bytes
lightningcss: 1.973ms
23666 bytes
$ node bench.js tailwind.css
cssnano: 2.198s
1925626 bytes
esbuild: 107.668ms
1961642 bytes
lightningcss: 43.368ms
1824130 bytes
```
For more benchmarks comparing more tools and input, see [here](http://goalsmashers.github.io/css-minification-benchmark/). Note that some of the tools shown perform unsafe optimizations that may change the behavior of the original CSS in favor of smaller file size. Lightning CSS does not do this the output CSS should always behave identically to the input. Keep this in mind when comparing file sizes between tools.

9716
node_modules/lightningcss/node/ast.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

10346
node_modules/lightningcss/node/ast.js.flow generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
const BROWSER_MAPPING = {
and_chr: 'chrome',
and_ff: 'firefox',
ie_mob: 'ie',
op_mob: 'opera',
and_qq: null,
and_uc: null,
baidu: null,
bb: null,
kaios: null,
op_mini: null,
};
function browserslistToTargets(browserslist) {
let targets = {};
for (let browser of browserslist) {
let [name, v] = browser.split(' ');
if (BROWSER_MAPPING[name] === null) {
continue;
}
let version = parseVersion(v);
if (version == null) {
continue;
}
if (targets[name] == null || version < targets[name]) {
targets[name] = version;
}
}
return targets;
}
function parseVersion(version) {
let [major, minor = 0, patch = 0] = version
.split('-')[0]
.split('.')
.map(v => parseInt(v, 10));
if (isNaN(major) || isNaN(minor) || isNaN(patch)) {
return null;
}
return (major << 16) | (minor << 8) | patch;
}
module.exports = browserslistToTargets;

442
node_modules/lightningcss/node/composeVisitors.js generated vendored Normal file
View File

@@ -0,0 +1,442 @@
// @ts-check
/** @typedef {import('./index').Visitor} Visitor */
/**
* Composes multiple visitor objects into a single one.
* @param {Visitor[]} visitors
* @return {Visitor}
*/
function composeVisitors(visitors) {
if (visitors.length === 1) {
return visitors[0];
}
/** @type Visitor */
let res = {};
composeSimpleVisitors(res, visitors, 'StyleSheet');
composeSimpleVisitors(res, visitors, 'StyleSheetExit');
composeObjectVisitors(res, visitors, 'Rule', ruleVisitor, wrapCustomAndUnknownAtRule);
composeObjectVisitors(res, visitors, 'RuleExit', ruleVisitor, wrapCustomAndUnknownAtRule);
composeObjectVisitors(res, visitors, 'Declaration', declarationVisitor, wrapCustomProperty);
composeObjectVisitors(res, visitors, 'DeclarationExit', declarationVisitor, wrapCustomProperty);
composeSimpleVisitors(res, visitors, 'Url');
composeSimpleVisitors(res, visitors, 'Color');
composeSimpleVisitors(res, visitors, 'Image');
composeSimpleVisitors(res, visitors, 'ImageExit');
composeSimpleVisitors(res, visitors, 'Length');
composeSimpleVisitors(res, visitors, 'Angle');
composeSimpleVisitors(res, visitors, 'Ratio');
composeSimpleVisitors(res, visitors, 'Resolution');
composeSimpleVisitors(res, visitors, 'Time');
composeSimpleVisitors(res, visitors, 'CustomIdent');
composeSimpleVisitors(res, visitors, 'DashedIdent');
composeArrayFunctions(res, visitors, 'MediaQuery');
composeArrayFunctions(res, visitors, 'MediaQueryExit');
composeSimpleVisitors(res, visitors, 'SupportsCondition');
composeSimpleVisitors(res, visitors, 'SupportsConditionExit');
composeArrayFunctions(res, visitors, 'Selector');
composeTokenVisitors(res, visitors, 'Token', 'token', false);
composeTokenVisitors(res, visitors, 'Function', 'function', false);
composeTokenVisitors(res, visitors, 'FunctionExit', 'function', true);
composeTokenVisitors(res, visitors, 'Variable', 'var', false);
composeTokenVisitors(res, visitors, 'VariableExit', 'var', true);
composeTokenVisitors(res, visitors, 'EnvironmentVariable', 'env', false);
composeTokenVisitors(res, visitors, 'EnvironmentVariableExit', 'env', true);
return res;
}
module.exports = composeVisitors;
function wrapCustomAndUnknownAtRule(k, f) {
if (k === 'unknown') {
return (value => f({ type: 'unknown', value }));
}
if (k === 'custom') {
return (value => f({ type: 'custom', value }));
}
return f;
}
function wrapCustomProperty(k, f) {
return k === 'custom' ? (value => f({ property: 'custom', value })) : f;
}
/**
* @param {import('./index').Visitor['Rule']} f
* @param {import('./ast').Rule} item
*/
function ruleVisitor(f, item) {
if (typeof f === 'object') {
if (item.type === 'unknown') {
let v = f.unknown;
if (typeof v === 'object') {
v = v[item.value.name];
}
return v?.(item.value);
}
if (item.type === 'custom') {
let v = f.custom;
if (typeof v === 'object') {
v = v[item.value.name];
}
return v?.(item.value);
}
return f[item.type]?.(item);
}
return f?.(item);
}
/**
* @param {import('./index').Visitor['Declaration']} f
* @param {import('./ast').Declaration} item
*/
function declarationVisitor(f, item) {
if (typeof f === 'object') {
/** @type {string} */
let name = item.property;
if (item.property === 'unparsed') {
name = item.value.propertyId.property;
} else if (item.property === 'custom') {
let v = f.custom;
if (typeof v === 'object') {
v = v[item.value.name];
}
return v?.(item.value);
}
return f[name]?.(item);
}
return f?.(item);
}
/**
*
* @param {Visitor[]} visitors
* @param {string} key
* @returns {[any[], boolean, Set<string>]}
*/
function extractObjectsOrFunctions(visitors, key) {
let values = [];
let hasFunction = false;
let allKeys = new Set();
for (let visitor of visitors) {
let v = visitor[key];
if (v) {
if (typeof v === 'function') {
hasFunction = true;
} else {
for (let key in v) {
allKeys.add(key);
}
}
values.push(v);
}
}
return [values, hasFunction, allKeys];
}
/**
* @template {keyof Visitor} K
* @param {Visitor} res
* @param {Visitor[]} visitors
* @param {K} key
* @param {(visitor: Visitor[K], item: any) => any | any[] | void} apply
* @param {(k: string, f: any) => any} wrapKey
*/
function composeObjectVisitors(res, visitors, key, apply, wrapKey) {
let [values, hasFunction, allKeys] = extractObjectsOrFunctions(visitors, key);
if (values.length === 0) {
return;
}
if (values.length === 1) {
res[key] = values[0];
return;
}
let f = createArrayVisitor(visitors, (visitor, item) => apply(visitor[key], item));
if (hasFunction) {
res[key] = f;
} else {
/** @type {any} */
let v = {};
for (let k of allKeys) {
v[k] = wrapKey(k, f);
}
res[key] = v;
}
}
/**
* @param {Visitor} res
* @param {Visitor[]} visitors
* @param {string} key
* @param {import('./ast').TokenOrValue['type']} type
* @param {boolean} isExit
*/
function composeTokenVisitors(res, visitors, key, type, isExit) {
let [values, hasFunction, allKeys] = extractObjectsOrFunctions(visitors, key);
if (values.length === 0) {
return;
}
if (values.length === 1) {
res[key] = values[0];
return;
}
let f = createTokenVisitor(visitors, type, isExit);
if (hasFunction) {
res[key] = f;
} else {
let v = {};
for (let key of allKeys) {
v[key] = f;
}
res[key] = v;
}
}
/**
* @param {Visitor[]} visitors
* @param {import('./ast').TokenOrValue['type']} type
*/
function createTokenVisitor(visitors, type, isExit) {
let v = createArrayVisitor(visitors, (visitor, /** @type {import('./ast').TokenOrValue} */ item) => {
let f;
switch (item.type) {
case 'token':
f = visitor.Token;
if (typeof f === 'object') {
f = f[item.value.type];
}
break;
case 'function':
f = isExit ? visitor.FunctionExit : visitor.Function;
if (typeof f === 'object') {
f = f[item.value.name];
}
break;
case 'var':
f = isExit ? visitor.VariableExit : visitor.Variable;
break;
case 'env':
f = isExit ? visitor.EnvironmentVariableExit : visitor.EnvironmentVariable;
if (typeof f === 'object') {
let name;
switch (item.value.name.type) {
case 'ua':
case 'unknown':
name = item.value.name.value;
break;
case 'custom':
name = item.value.name.ident;
break;
}
f = f[name];
}
break;
case 'color':
f = visitor.Color;
break;
case 'url':
f = visitor.Url;
break;
case 'length':
f = visitor.Length;
break;
case 'angle':
f = visitor.Angle;
break;
case 'time':
f = visitor.Time;
break;
case 'resolution':
f = visitor.Resolution;
break;
case 'dashed-ident':
f = visitor.DashedIdent;
break;
}
if (!f) {
return;
}
let res = f(item.value);
switch (item.type) {
case 'color':
case 'url':
case 'length':
case 'angle':
case 'time':
case 'resolution':
case 'dashed-ident':
if (Array.isArray(res)) {
res = res.map(value => ({ type: item.type, value }))
} else if (res) {
res = { type: item.type, value: res };
}
break;
}
return res;
});
return value => v({ type, value });
}
/**
* @param {Visitor[]} visitors
* @param {string} key
*/
function extractFunctions(visitors, key) {
let functions = [];
for (let visitor of visitors) {
let f = visitor[key];
if (f) {
functions.push(f);
}
}
return functions;
}
/**
* @param {Visitor} res
* @param {Visitor[]} visitors
* @param {string} key
*/
function composeSimpleVisitors(res, visitors, key) {
let functions = extractFunctions(visitors, key);
if (functions.length === 0) {
return;
}
if (functions.length === 1) {
res[key] = functions[0];
return;
}
res[key] = arg => {
let mutated = false;
for (let f of functions) {
let res = f(arg);
if (res) {
arg = res;
mutated = true;
}
}
return mutated ? arg : undefined;
};
}
/**
* @param {Visitor} res
* @param {Visitor[]} visitors
* @param {string} key
*/
function composeArrayFunctions(res, visitors, key) {
let functions = extractFunctions(visitors, key);
if (functions.length === 0) {
return;
}
if (functions.length === 1) {
res[key] = functions[0];
return;
}
res[key] = createArrayVisitor(functions, (f, item) => f(item));
}
/**
* @template T
* @template V
* @param {T[]} visitors
* @param {(visitor: T, item: V) => V | V[] | void} apply
* @returns {(item: V) => V | V[] | void}
*/
function createArrayVisitor(visitors, apply) {
let seen = new Bitset(visitors.length);
return arg => {
let arr = [arg];
let mutated = false;
seen.clear();
for (let i = 0; i < arr.length; i++) {
// For each value, call all visitors. If a visitor returns a new value,
// we start over, but skip the visitor that generated the value or saw
// it before (to avoid cycles). This way, visitors can be composed in any order.
for (let v = 0; v < visitors.length;) {
if (seen.get(v)) {
v++;
continue;
}
let item = arr[i];
let visitor = visitors[v];
let res = apply(visitor, item);
if (Array.isArray(res)) {
if (res.length === 0) {
arr.splice(i, 1);
} else if (res.length === 1) {
arr[i] = res[0];
} else {
arr.splice(i, 1, ...res);
}
mutated = true;
seen.set(v);
v = 0;
} else if (res) {
arr[i] = res;
mutated = true;
seen.set(v);
v = 0;
} else {
v++;
}
}
}
if (!mutated) {
return;
}
return arr.length === 1 ? arr[0] : arr;
};
}
class Bitset {
constructor(maxBits = 32) {
this.bits = 0;
this.more = maxBits > 32 ? new Uint32Array(Math.ceil((maxBits - 32) / 32)) : null;
}
/** @param {number} bit */
get(bit) {
if (bit >= 32 && this.more) {
let i = Math.floor((bit - 32) / 32);
let b = bit % 32;
return Boolean(this.more[i] & (1 << b));
} else {
return Boolean(this.bits & (1 << bit));
}
}
/** @param {number} bit */
set(bit) {
if (bit >= 32 && this.more) {
let i = Math.floor((bit - 32) / 32);
let b = bit % 32;
this.more[i] |= 1 << b;
} else {
this.bits |= 1 << bit;
}
}
clear() {
this.bits = 0;
if (this.more) {
this.more.fill(0);
}
}
}

28
node_modules/lightningcss/node/flags.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
// This file is autogenerated by build-prefixes.js. DO NOT EDIT!
exports.Features = {
Nesting: 1,
NotSelectorList: 2,
DirSelector: 4,
LangSelectorList: 8,
IsSelector: 16,
TextDecorationThicknessPercent: 32,
MediaIntervalSyntax: 64,
MediaRangeSyntax: 128,
CustomMediaQueries: 256,
ClampFunction: 512,
ColorFunction: 1024,
OklabColors: 2048,
LabColors: 4096,
P3Colors: 8192,
HexAlphaColors: 16384,
SpaceSeparatedColorNotation: 32768,
FontFamilySystemUi: 65536,
DoublePositionGradients: 131072,
VendorPrefixes: 262144,
LogicalProperties: 524288,
LightDark: 1048576,
Selectors: 31,
MediaQueries: 448,
Colors: 1113088,
};

477
node_modules/lightningcss/node/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,477 @@
import type { Angle, CssColor, Rule, CustomProperty, EnvironmentVariable, Function, Image, LengthValue, MediaQuery, Declaration, Ratio, Resolution, Selector, SupportsCondition, Time, Token, TokenOrValue, UnknownAtRule, Url, Variable, StyleRule, DeclarationBlock, ParsedComponent, Multiplier, StyleSheet, Location2 } from './ast';
import { Targets, Features } from './targets';
export * from './ast';
export { Targets, Features };
export interface TransformOptions<C extends CustomAtRules> {
/** The filename being transformed. Used for error messages and source maps. */
filename: string,
/** The source code to transform. */
code: Uint8Array,
/** Whether to enable minification. */
minify?: boolean,
/** Whether to output a source map. */
sourceMap?: boolean,
/** An input source map to extend. */
inputSourceMap?: string,
/**
* An optional project root path, used as the source root in the output source map.
* Also used to generate relative paths for sources used in CSS module hashes.
*/
projectRoot?: string,
/** The browser targets for the generated code. */
targets?: Targets,
/** Features that should always be compiled, even when supported by targets. */
include?: number,
/** Features that should never be compiled, even when unsupported by targets. */
exclude?: number,
/** Whether to enable parsing various draft syntax. */
drafts?: Drafts,
/** Whether to enable various non-standard syntax. */
nonStandard?: NonStandard,
/** Whether to compile this file as a CSS module. */
cssModules?: boolean | CSSModulesConfig,
/**
* Whether to analyze dependencies (e.g. `@import` and `url()`).
* When enabled, `@import` rules are removed, and `url()` dependencies
* are replaced with hashed placeholders that can be replaced with the final
* urls later (after bundling). Dependencies are returned as part of the result.
*/
analyzeDependencies?: boolean | DependencyOptions,
/**
* Replaces user action pseudo classes with class names that can be applied from JavaScript.
* This is useful for polyfills, for example.
*/
pseudoClasses?: PseudoClasses,
/**
* A list of class names, ids, and custom identifiers (e.g. @keyframes) that are known
* to be unused. These will be removed during minification. Note that these are not
* selectors but individual names (without any . or # prefixes).
*/
unusedSymbols?: string[],
/**
* Whether to ignore invalid rules and declarations rather than erroring.
* When enabled, warnings are returned, and the invalid rule or declaration is
* omitted from the output code.
*/
errorRecovery?: boolean,
/**
* An AST visitor object. This allows custom transforms or analysis to be implemented in JavaScript.
* Multiple visitors can be composed into one using the `composeVisitors` function.
* For optimal performance, visitors should be as specific as possible about what types of values
* they care about so that JavaScript has to be called as little as possible.
*/
visitor?: Visitor<C>,
/**
* Defines how to parse custom CSS at-rules. Each at-rule can have a prelude, defined using a CSS
* [syntax string](https://drafts.css-houdini.org/css-properties-values-api/#syntax-strings), and
* a block body. The body can be a declaration list, rule list, or style block as defined in the
* [css spec](https://drafts.csswg.org/css-syntax/#declaration-rule-list).
*/
customAtRules?: C
}
// This is a hack to make TS still provide autocomplete for `property` vs. just making it `string`.
type PropertyStart = '-' | '_' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
export type ReturnedDeclaration = Declaration | {
/** The property name. */
property: `${PropertyStart}${string}`,
/** The raw string value for the declaration. */
raw: string
};
export type ReturnedMediaQuery = MediaQuery | {
/** The raw string value for the media query. */
raw: string
};
type FindByType<Union, Name> = Union extends { type: Name } ? Union : never;
export type ReturnedRule = Rule<ReturnedDeclaration, ReturnedMediaQuery>;
type RequiredValue<Rule> = Rule extends { value: object }
? Rule['value'] extends StyleRule
? Rule & { value: Required<StyleRule> & { declarations: Required<DeclarationBlock> } }
: Rule & { value: Required<Rule['value']> }
: Rule;
type RuleVisitor<R = RequiredValue<Rule>> = ((rule: R) => ReturnedRule | ReturnedRule[] | void);
type MappedRuleVisitors = {
[Name in Exclude<Rule['type'], 'unknown' | 'custom'>]?: RuleVisitor<RequiredValue<FindByType<Rule, Name>>>;
}
type UnknownVisitors<T> = {
[name: string]: RuleVisitor<T>
}
type CustomVisitors<T extends CustomAtRules> = {
[Name in keyof T]?: RuleVisitor<CustomAtRule<Name, T[Name]>>
};
type AnyCustomAtRule<C extends CustomAtRules> = {
[Key in keyof C]: CustomAtRule<Key, C[Key]>
}[keyof C];
type RuleVisitors<C extends CustomAtRules> = MappedRuleVisitors & {
unknown?: UnknownVisitors<UnknownAtRule> | Omit<RuleVisitor<UnknownAtRule>, keyof CallableFunction>,
custom?: CustomVisitors<C> | Omit<RuleVisitor<AnyCustomAtRule<C>>, keyof CallableFunction>
};
type PreludeTypes = Exclude<ParsedComponent['type'], 'literal' | 'repeated' | 'token'>;
type SyntaxString = `<${PreludeTypes}>` | `<${PreludeTypes}>+` | `<${PreludeTypes}>#` | (string & {});
type ComponentTypes = {
[Key in PreludeTypes as `<${Key}>`]: FindByType<ParsedComponent, Key>
};
type Repetitions = {
[Key in PreludeTypes as `<${Key}>+` | `<${Key}>#`]: {
type: "repeated",
value: {
components: FindByType<ParsedComponent, Key>[],
multiplier: Multiplier
}
}
};
type MappedPrelude = ComponentTypes & Repetitions;
type MappedBody<P extends CustomAtRuleDefinition['body']> = P extends 'style-block' ? 'rule-list' : P;
interface CustomAtRule<N, R extends CustomAtRuleDefinition> {
name: N,
prelude: R['prelude'] extends keyof MappedPrelude ? MappedPrelude[R['prelude']] : ParsedComponent,
body: FindByType<CustomAtRuleBody, MappedBody<R['body']>>,
loc: Location2
}
type CustomAtRuleBody = {
type: 'declaration-list',
value: Required<DeclarationBlock>
} | {
type: 'rule-list',
value: RequiredValue<Rule>[]
};
type FindProperty<Union, Name> = Union extends { property: Name } ? Union : never;
type DeclarationVisitor<P = Declaration> = ((property: P) => ReturnedDeclaration | ReturnedDeclaration[] | void);
type MappedDeclarationVisitors = {
[Name in Exclude<Declaration['property'], 'unparsed' | 'custom'>]?: DeclarationVisitor<FindProperty<Declaration, Name> | FindProperty<Declaration, 'unparsed'>>;
}
type CustomPropertyVisitors = {
[name: string]: DeclarationVisitor<CustomProperty>
}
type DeclarationVisitors = MappedDeclarationVisitors & {
custom?: CustomPropertyVisitors | DeclarationVisitor<CustomProperty>
}
interface RawValue {
/** A raw string value which will be parsed like CSS. */
raw: string
}
type TokenReturnValue = TokenOrValue | TokenOrValue[] | RawValue | void;
type TokenVisitor = (token: Token) => TokenReturnValue;
type VisitableTokenTypes = 'ident' | 'at-keyword' | 'hash' | 'id-hash' | 'string' | 'number' | 'percentage' | 'dimension';
type TokenVisitors = {
[Name in VisitableTokenTypes]?: (token: FindByType<Token, Name>) => TokenReturnValue;
}
type FunctionVisitor = (fn: Function) => TokenReturnValue;
type EnvironmentVariableVisitor = (env: EnvironmentVariable) => TokenReturnValue;
type EnvironmentVariableVisitors = {
[name: string]: EnvironmentVariableVisitor
};
export interface Visitor<C extends CustomAtRules> {
StyleSheet?(stylesheet: StyleSheet): StyleSheet<ReturnedDeclaration, ReturnedMediaQuery> | void;
StyleSheetExit?(stylesheet: StyleSheet): StyleSheet<ReturnedDeclaration, ReturnedMediaQuery> | void;
Rule?: RuleVisitor | RuleVisitors<C>;
RuleExit?: RuleVisitor | RuleVisitors<C>;
Declaration?: DeclarationVisitor | DeclarationVisitors;
DeclarationExit?: DeclarationVisitor | DeclarationVisitors;
Url?(url: Url): Url | void;
Color?(color: CssColor): CssColor | void;
Image?(image: Image): Image | void;
ImageExit?(image: Image): Image | void;
Length?(length: LengthValue): LengthValue | void;
Angle?(angle: Angle): Angle | void;
Ratio?(ratio: Ratio): Ratio | void;
Resolution?(resolution: Resolution): Resolution | void;
Time?(time: Time): Time | void;
CustomIdent?(ident: string): string | void;
DashedIdent?(ident: string): string | void;
MediaQuery?(query: MediaQuery): ReturnedMediaQuery | ReturnedMediaQuery[] | void;
MediaQueryExit?(query: MediaQuery): ReturnedMediaQuery | ReturnedMediaQuery[] | void;
SupportsCondition?(condition: SupportsCondition): SupportsCondition;
SupportsConditionExit?(condition: SupportsCondition): SupportsCondition;
Selector?(selector: Selector): Selector | Selector[] | void;
Token?: TokenVisitor | TokenVisitors;
Function?: FunctionVisitor | { [name: string]: FunctionVisitor };
FunctionExit?: FunctionVisitor | { [name: string]: FunctionVisitor };
Variable?(variable: Variable): TokenReturnValue;
VariableExit?(variable: Variable): TokenReturnValue;
EnvironmentVariable?: EnvironmentVariableVisitor | EnvironmentVariableVisitors;
EnvironmentVariableExit?: EnvironmentVariableVisitor | EnvironmentVariableVisitors;
}
export interface CustomAtRules {
[name: string]: CustomAtRuleDefinition
}
export interface CustomAtRuleDefinition {
/**
* Defines the syntax for a custom at-rule prelude. The value should be a
* CSS [syntax string](https://drafts.css-houdini.org/css-properties-values-api/#syntax-strings)
* representing the types of values that are accepted. This property may be omitted or
* set to null to indicate that no prelude is accepted.
*/
prelude?: SyntaxString | null,
/**
* Defines the type of body contained within the at-rule block.
* - declaration-list: A CSS declaration list, as in a style rule.
* - rule-list: A list of CSS rules, as supported within a non-nested
* at-rule such as `@media` or `@supports`.
* - style-block: Both a declaration list and rule list, as accepted within
* a nested at-rule within a style rule (e.g. `@media` inside a style rule
* with directly nested declarations).
*/
body?: 'declaration-list' | 'rule-list' | 'style-block' | null
}
export interface DependencyOptions {
/** Whether to preserve `@import` rules rather than removing them. */
preserveImports?: boolean
}
export type BundleOptions<C extends CustomAtRules> = Omit<TransformOptions<C>, 'code'>;
export interface BundleAsyncOptions<C extends CustomAtRules> extends BundleOptions<C> {
resolver?: Resolver;
}
/** Custom resolver to use when loading CSS files. */
export interface Resolver {
/** Read the given file and return its contents as a string. */
read?: (file: string) => string | Promise<string>;
/**
* Resolve the given CSS import specifier from the provided originating file to a
* path which gets passed to `read()`.
*/
resolve?: (specifier: string, originatingFile: string) => string | Promise<string>;
}
export interface Drafts {
/** Whether to enable @custom-media rules. */
customMedia?: boolean
}
export interface NonStandard {
/** Whether to enable the non-standard >>> and /deep/ selector combinators used by Angular and Vue. */
deepSelectorCombinator?: boolean
}
export interface PseudoClasses {
hover?: string,
active?: string,
focus?: string,
focusVisible?: string,
focusWithin?: string
}
export interface TransformResult {
/** The transformed code. */
code: Uint8Array,
/** The generated source map, if enabled. */
map: Uint8Array | void,
/** CSS module exports, if enabled. */
exports: CSSModuleExports | void,
/** CSS module references, if `dashedIdents` is enabled. */
references: CSSModuleReferences,
/** `@import` and `url()` dependencies, if enabled. */
dependencies: Dependency[] | void,
/** Warnings that occurred during compilation. */
warnings: Warning[]
}
export interface Warning {
message: string,
type: string,
value?: any,
loc: ErrorLocation
}
export interface CSSModulesConfig {
/** The pattern to use when renaming class names and other identifiers. Default is `[hash]_[local]`. */
pattern?: string,
/** Whether to rename dashed identifiers, e.g. custom properties. */
dashedIdents?: boolean,
/** Whether to enable hashing for `@keyframes`. */
animation?: boolean,
/** Whether to enable hashing for CSS grid identifiers. */
grid?: boolean,
/** Whether to enable hashing for `@container` names. */
container?: boolean,
/** Whether to enable hashing for custom identifiers. */
customIdents?: boolean,
/** Whether to require at least one class or id selector in each rule. */
pure?: boolean
}
export type CSSModuleExports = {
/** Maps exported (i.e. original) names to local names. */
[name: string]: CSSModuleExport
};
export interface CSSModuleExport {
/** The local (compiled) name for this export. */
name: string,
/** Whether the export is referenced in this file. */
isReferenced: boolean,
/** Other names that are composed by this export. */
composes: CSSModuleReference[]
}
export type CSSModuleReferences = {
/** Maps placeholder names to references. */
[name: string]: DependencyCSSModuleReference,
};
export type CSSModuleReference = LocalCSSModuleReference | GlobalCSSModuleReference | DependencyCSSModuleReference;
export interface LocalCSSModuleReference {
type: 'local',
/** The local (compiled) name for the reference. */
name: string,
}
export interface GlobalCSSModuleReference {
type: 'global',
/** The referenced global name. */
name: string,
}
export interface DependencyCSSModuleReference {
type: 'dependency',
/** The name to reference within the dependency. */
name: string,
/** The dependency specifier for the referenced file. */
specifier: string
}
export type Dependency = ImportDependency | UrlDependency;
export interface ImportDependency {
type: 'import',
/** The url of the `@import` dependency. */
url: string,
/** The media query for the `@import` rule. */
media: string | null,
/** The `supports()` query for the `@import` rule. */
supports: string | null,
/** The source location where the `@import` rule was found. */
loc: SourceLocation,
/** The placeholder that the import was replaced with. */
placeholder: string
}
export interface UrlDependency {
type: 'url',
/** The url of the dependency. */
url: string,
/** The source location where the `url()` was found. */
loc: SourceLocation,
/** The placeholder that the url was replaced with. */
placeholder: string
}
export interface SourceLocation {
/** The file path in which the dependency exists. */
filePath: string,
/** The start location of the dependency. */
start: Location,
/** The end location (inclusive) of the dependency. */
end: Location
}
export interface Location {
/** The line number (1-based). */
line: number,
/** The column number (0-based). */
column: number
}
export interface ErrorLocation extends Location {
filename: string
}
/**
* Compiles a CSS file, including optionally minifying and lowering syntax to the given
* targets. A source map may also be generated, but this is not enabled by default.
*/
export declare function transform<C extends CustomAtRules>(options: TransformOptions<C>): TransformResult;
export interface TransformAttributeOptions {
/** The filename in which the style attribute appeared. Used for error messages and dependencies. */
filename?: string,
/** The source code to transform. */
code: Uint8Array,
/** Whether to enable minification. */
minify?: boolean,
/** The browser targets for the generated code. */
targets?: Targets,
/**
* Whether to analyze `url()` dependencies.
* When enabled, `url()` dependencies are replaced with hashed placeholders
* that can be replaced with the final urls later (after bundling).
* Dependencies are returned as part of the result.
*/
analyzeDependencies?: boolean,
/**
* Whether to ignore invalid rules and declarations rather than erroring.
* When enabled, warnings are returned, and the invalid rule or declaration is
* omitted from the output code.
*/
errorRecovery?: boolean,
/**
* An AST visitor object. This allows custom transforms or analysis to be implemented in JavaScript.
* Multiple visitors can be composed into one using the `composeVisitors` function.
* For optimal performance, visitors should be as specific as possible about what types of values
* they care about so that JavaScript has to be called as little as possible.
*/
visitor?: Visitor<never>
}
export interface TransformAttributeResult {
/** The transformed code. */
code: Uint8Array,
/** `@import` and `url()` dependencies, if enabled. */
dependencies: Dependency[] | void,
/** Warnings that occurred during compilation. */
warnings: Warning[]
}
/**
* Compiles a single CSS declaration list, such as an inline style attribute in HTML.
*/
export declare function transformStyleAttribute(options: TransformAttributeOptions): TransformAttributeResult;
/**
* Converts a browserslist result into targets that can be passed to lightningcss.
* @param browserslist the result of calling `browserslist`
*/
export declare function browserslistToTargets(browserslist: string[]): Targets;
/**
* Bundles a CSS file and its dependencies, inlining @import rules.
*/
export declare function bundle<C extends CustomAtRules>(options: BundleOptions<C>): TransformResult;
/**
* Bundles a CSS file and its dependencies asynchronously, inlining @import rules.
*/
export declare function bundleAsync<C extends CustomAtRules>(options: BundleAsyncOptions<C>): Promise<TransformResult>;
/**
* Composes multiple visitor objects into a single one.
*/
export declare function composeVisitors<C extends CustomAtRules>(visitors: Visitor<C>[]): Visitor<C>;

28
node_modules/lightningcss/node/index.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
let parts = [process.platform, process.arch];
if (process.platform === 'linux') {
const { MUSL, familySync } = require('detect-libc');
const family = familySync();
if (family === MUSL) {
parts.push('musl');
} else if (process.arch === 'arm') {
parts.push('gnueabihf');
} else {
parts.push('gnu');
}
} else if (process.platform === 'win32') {
parts.push('msvc');
}
if (process.env.CSS_TRANSFORMER_WASM) {
module.exports = require(`../pkg`);
} else {
try {
module.exports = require(`lightningcss-${parts.join('-')}`);
} catch (err) {
module.exports = require(`../lightningcss.${parts.join('-')}.node`);
}
}
module.exports.browserslistToTargets = require('./browserslistToTargets');
module.exports.composeVisitors = require('./composeVisitors');
module.exports.Features = require('./flags').Features;

824
node_modules/lightningcss/node/index.js.flow generated vendored Normal file
View File

@@ -0,0 +1,824 @@
// @flow
type Exclude<A, B> = A;
// see https://gist.github.com/thecotne/6e5969f4aaf8f253985ed36b30ac9fe0
type $FlowGen$If<X: boolean, Then, Else = empty> = $Call<
((true, Then, Else) => Then) & ((false, Then, Else) => Else),
X,
Then,
Else
>;
type $FlowGen$Assignable<A, B> = $Call<
((...r: [B]) => true) & ((...r: [A]) => false),
A
>;
import type {
Angle,
CssColor,
Rule,
CustomProperty,
EnvironmentVariable,
Function,
Image,
LengthValue,
MediaQuery,
Declaration,
Ratio,
Resolution,
Selector,
SupportsCondition,
Time,
Token,
TokenOrValue,
UnknownAtRule,
Url,
Variable,
StyleRule,
DeclarationBlock,
ParsedComponent,
Multiplier,
StyleSheet,
Location2,
} from "./ast.js.flow";
import { Targets, Features } from "./targets.js.flow";
declare export * from "./ast.js.flow";
declare export { Targets, Features };
export type TransformOptions<C: CustomAtRules> = {|
/**
* The filename being transformed. Used for error messages and source maps.
*/
filename: string,
/**
* The source code to transform.
*/
code: Uint8Array,
/**
* Whether to enable minification.
*/
minify?: boolean,
/**
* Whether to output a source map.
*/
sourceMap?: boolean,
/**
* An input source map to extend.
*/
inputSourceMap?: string,
/**
* An optional project root path, used as the source root in the output source map.
* Also used to generate relative paths for sources used in CSS module hashes.
*/
projectRoot?: string,
/**
* The browser targets for the generated code.
*/
targets?: Targets,
/**
* Features that should always be compiled, even when supported by targets.
*/
include?: number,
/**
* Features that should never be compiled, even when unsupported by targets.
*/
exclude?: number,
/**
* Whether to enable parsing various draft syntax.
*/
drafts?: Drafts,
/**
* Whether to enable various non-standard syntax.
*/
nonStandard?: NonStandard,
/**
* Whether to compile this file as a CSS module.
*/
cssModules?: boolean | CSSModulesConfig,
/**
* Whether to analyze dependencies (e.g. string).
* When enabled, string dependencies
* are replaced with hashed placeholders that can be replaced with the final
* urls later (after bundling). Dependencies are returned as part of the result.
*/
analyzeDependencies?: boolean | DependencyOptions,
/**
* Replaces user action pseudo classes with class names that can be applied from JavaScript.
* This is useful for polyfills, for example.
*/
pseudoClasses?: PseudoClasses,
/**
* A list of class names, ids, and custom identifiers (e.g. @keyframes) that are known
* to be unused. These will be removed during minification. Note that these are not
* selectors but individual names (without any . or # prefixes).
*/
unusedSymbols?: string[],
/**
* Whether to ignore invalid rules and declarations rather than erroring.
* When enabled, warnings are returned, and the invalid rule or declaration is
* omitted from the output code.
*/
errorRecovery?: boolean,
/**
* An AST visitor object. This allows custom transforms or analysis to be implemented in JavaScript.
* Multiple visitors can be composed into one using the string function.
* For optimal performance, visitors should be as specific as possible about what types of values
* they care about so that JavaScript has to be called as little as possible.
*/
visitor?: Visitor<C>,
/**
* Defines how to parse custom CSS at-rules. Each at-rule can have a prelude, defined using a CSS
* [syntax string](https://drafts.css-houdini.org/css-properties-values-api/#syntax-strings), and
* a block body. The body can be a declaration list, rule list, or style block as defined in the
* [css spec](https://drafts.csswg.org/css-syntax/#declaration-rule-list).
*/
customAtRules?: C,
|};
declare type PropertyStart =
| "-"
| "_"
| "a"
| "b"
| "c"
| "d"
| "e"
| "f"
| "g"
| "h"
| "i"
| "j"
| "k"
| "l"
| "m"
| "n"
| "o"
| "p"
| "q"
| "r"
| "s"
| "t"
| "u"
| "v"
| "w"
| "x"
| "y"
| "z";
export type ReturnedDeclaration =
| Declaration
| {|
/**
* The property name.
*/
property: string,
/**
* The raw string value for the declaration.
*/
raw: string,
|};
export type ReturnedMediaQuery =
| MediaQuery
| {|
/**
* The raw string value for the media query.
*/
raw: string,
|};
declare type FindByType<Union, Name> = $FlowGen$If<
$FlowGen$Assignable<
Union,
{|
type: Name,
|}
>,
Union,
empty
>;
export type ReturnedRule = Rule<ReturnedDeclaration, ReturnedMediaQuery>;
declare type RequiredValue<Rule> = $FlowGen$If<
$FlowGen$Assignable<
Rule,
{|
value: { [key: string]: any },
|}
>,
$FlowGen$If<
$FlowGen$Assignable<$PropertyType<Rule, "value">, StyleRule>,
{|
...Rule,
...{|
value: {|
...Required<StyleRule>,
...{|
declarations: Required<DeclarationBlock>,
|},
|},
|},
|},
{|
...Rule,
...{|
value: Required<$PropertyType<Rule, "value">>,
|},
|}
>,
Rule
>;
declare type RuleVisitor<R = RequiredValue<Rule>> = (
rule: R
) => ReturnedRule | ReturnedRule[] | void;
declare type MappedRuleVisitors = $ObjMapi<
{ [k: Exclude<$PropertyType<Rule, "type">, "unknown" | "custom">]: any },
<Name>(Name) => RuleVisitor<RequiredValue<FindByType<Rule, Name>>>
>;
declare type UnknownVisitors<T> = {
[name: string]: RuleVisitor<T>,
};
declare type CustomVisitors<T: CustomAtRules> = $ObjMapi<
T,
<Name>(Name) => RuleVisitor<CustomAtRule<Name, $ElementType<T, Name>>>
>;
declare type AnyCustomAtRule<C: CustomAtRules> = $ElementType<
$ObjMapi<C, <Key>(Key) => CustomAtRule<Key, $ElementType<C, Key>>>,
$Keys<C>
>;
declare type RuleVisitors<C: CustomAtRules> = {|
...MappedRuleVisitors,
...{|
unknown?:
| UnknownVisitors<UnknownAtRule>
| $Diff<
RuleVisitor<UnknownAtRule>,
{ [key: $Keys<CallableFunction>]: any }
>,
custom?:
| CustomVisitors<C>
| $Diff<
RuleVisitor<AnyCustomAtRule<C>>,
{ [key: $Keys<CallableFunction>]: any }
>,
|},
|};
declare type PreludeTypes = Exclude<
$PropertyType<ParsedComponent, "type">,
"literal" | "repeated" | "token"
>;
declare type SyntaxString = string | string;
declare type ComponentTypes = $ObjMapi<
{ [k: PreludeTypes]: any },
<Key>(Key) => FindByType<ParsedComponent, Key>
>;
declare type Repetitions = $ObjMapi<
{ [k: PreludeTypes]: any },
<Key>(Key) => {|
type: "repeated",
value: {|
components: FindByType<ParsedComponent, Key>[],
multiplier: Multiplier,
|},
|}
>;
declare type MappedPrelude = {| ...ComponentTypes, ...Repetitions |};
declare type MappedBody<P: $PropertyType<CustomAtRuleDefinition, "body">> =
$FlowGen$If<$FlowGen$Assignable<P, "style-block">, "rule-list", P>;
declare type CustomAtRule<N, R: CustomAtRuleDefinition> = {|
name: N,
prelude: $FlowGen$If<
$FlowGen$Assignable<$PropertyType<R, "prelude">, $Keys<MappedPrelude>>,
$ElementType<MappedPrelude, $PropertyType<R, "prelude">>,
ParsedComponent
>,
body: FindByType<CustomAtRuleBody, MappedBody<$PropertyType<R, "body">>>,
loc: Location2,
|};
declare type CustomAtRuleBody =
| {|
type: "declaration-list",
value: Required<DeclarationBlock>,
|}
| {|
type: "rule-list",
value: RequiredValue<Rule>[],
|};
declare type FindProperty<Union, Name> = $FlowGen$If<
$FlowGen$Assignable<
Union,
{|
property: Name,
|}
>,
Union,
empty
>;
declare type DeclarationVisitor<P = Declaration> = (
property: P
) => ReturnedDeclaration | ReturnedDeclaration[] | void;
declare type MappedDeclarationVisitors = $ObjMapi<
{
[k: Exclude<
$PropertyType<Declaration, "property">,
"unparsed" | "custom"
>]: any,
},
<Name>(
Name
) => DeclarationVisitor<
FindProperty<Declaration, Name> | FindProperty<Declaration, "unparsed">
>
>;
declare type CustomPropertyVisitors = {
[name: string]: DeclarationVisitor<CustomProperty>,
};
declare type DeclarationVisitors = {|
...MappedDeclarationVisitors,
...{|
custom?: CustomPropertyVisitors | DeclarationVisitor<CustomProperty>,
|},
|};
declare type RawValue = {|
/**
* A raw string value which will be parsed like CSS.
*/
raw: string,
|};
declare type TokenReturnValue = TokenOrValue | TokenOrValue[] | RawValue | void;
declare type TokenVisitor = (token: Token) => TokenReturnValue;
declare type VisitableTokenTypes =
| "ident"
| "at-keyword"
| "hash"
| "id-hash"
| "string"
| "number"
| "percentage"
| "dimension";
declare type TokenVisitors = $ObjMapi<
{ [k: VisitableTokenTypes]: any },
<Name>(Name) => (token: FindByType<Token, Name>) => TokenReturnValue
>;
declare type FunctionVisitor = (fn: Function) => TokenReturnValue;
declare type EnvironmentVariableVisitor = (
env: EnvironmentVariable
) => TokenReturnValue;
declare type EnvironmentVariableVisitors = {
[name: string]: EnvironmentVariableVisitor,
};
export type Visitor<C: CustomAtRules> = {|
StyleSheet?: (
stylesheet: StyleSheet
) => StyleSheet<ReturnedDeclaration, ReturnedMediaQuery> | void,
StyleSheetExit?: (
stylesheet: StyleSheet
) => StyleSheet<ReturnedDeclaration, ReturnedMediaQuery> | void,
Rule?: RuleVisitor<> | RuleVisitors<C>,
RuleExit?: RuleVisitor<> | RuleVisitors<C>,
Declaration?: DeclarationVisitor<> | DeclarationVisitors,
DeclarationExit?: DeclarationVisitor<> | DeclarationVisitors,
Url?: (url: Url) => Url | void,
Color?: (color: CssColor) => CssColor | void,
Image?: (image: Image) => Image | void,
ImageExit?: (image: Image) => Image | void,
Length?: (length: LengthValue) => LengthValue | void,
Angle?: (angle: Angle) => Angle | void,
Ratio?: (ratio: Ratio) => Ratio | void,
Resolution?: (resolution: Resolution) => Resolution | void,
Time?: (time: Time) => Time | void,
CustomIdent?: (ident: string) => string | void,
DashedIdent?: (ident: string) => string | void,
MediaQuery?: (
query: MediaQuery
) => ReturnedMediaQuery | ReturnedMediaQuery[] | void,
MediaQueryExit?: (
query: MediaQuery
) => ReturnedMediaQuery | ReturnedMediaQuery[] | void,
SupportsCondition?: (condition: SupportsCondition) => SupportsCondition,
SupportsConditionExit?: (condition: SupportsCondition) => SupportsCondition,
Selector?: (selector: Selector) => Selector | Selector[] | void,
Token?: TokenVisitor | TokenVisitors,
Function?:
| FunctionVisitor
| {
[name: string]: FunctionVisitor,
},
FunctionExit?:
| FunctionVisitor
| {
[name: string]: FunctionVisitor,
},
Variable?: (variable: Variable) => TokenReturnValue,
VariableExit?: (variable: Variable) => TokenReturnValue,
EnvironmentVariable?:
| EnvironmentVariableVisitor
| EnvironmentVariableVisitors,
EnvironmentVariableExit?:
| EnvironmentVariableVisitor
| EnvironmentVariableVisitors,
|};
export type CustomAtRules = {|
[name: string]: CustomAtRuleDefinition,
|};
export type CustomAtRuleDefinition = {|
/**
* Defines the syntax for a custom at-rule prelude. The value should be a
* CSS [syntax string](https://drafts.css-houdini.org/css-properties-values-api/#syntax-strings)
* representing the types of values that are accepted. This property may be omitted or
* set to null to indicate that no prelude is accepted.
*/
prelude?: SyntaxString | null,
/**
* Defines the type of body contained within the at-rule block.
* - declaration-list: A CSS declaration list, as in a style rule.
* - rule-list: A list of CSS rules, as supported within a non-nested
* at-rule such as string.
* - style-block: Both a declaration list and rule list, as accepted within
* a nested at-rule within a style rule (e.g. string inside a style rule
* with directly nested declarations).
*/
body?: "declaration-list" | "rule-list" | "style-block" | null,
|};
export type DependencyOptions = {|
/**
* Whether to preserve string rules rather than removing them.
*/
preserveImports?: boolean,
|};
export type BundleOptions<C: CustomAtRules> = $Diff<
TransformOptions<C>,
{| code: any |}
>;
export type BundleAsyncOptions<C: CustomAtRules> = {|
...$Exact<BundleOptions<C>>,
resolver?: Resolver,
|};
/**
* Custom resolver to use when loading CSS files.
*/
export type Resolver = {|
/**
* Read the given file and return its contents as a string.
*/
read?: (file: string) => string | Promise<string>,
/**
* Resolve the given CSS import specifier from the provided originating file to a
* path which gets passed to string.
*/
resolve?: (
specifier: string,
originatingFile: string
) => string | Promise<string>,
|};
export type Drafts = {|
/**
* Whether to enable @custom-media rules.
*/
customMedia?: boolean,
|};
export type NonStandard = {|
/**
* Whether to enable the non-standard >>> and /deep/ selector combinators used by Angular and Vue.
*/
deepSelectorCombinator?: boolean,
|};
export type PseudoClasses = {|
hover?: string,
active?: string,
focus?: string,
focusVisible?: string,
focusWithin?: string,
|};
export type TransformResult = {|
/**
* The transformed code.
*/
code: Uint8Array,
/**
* The generated source map, if enabled.
*/
map: Uint8Array | void,
/**
* CSS module exports, if enabled.
*/
exports: CSSModuleExports | void,
/**
* CSS module references, if string is enabled.
*/
references: CSSModuleReferences,
/**
* string dependencies, if enabled.
*/
dependencies: Dependency[] | void,
/**
* Warnings that occurred during compilation.
*/
warnings: Warning[],
|};
export type Warning = {|
message: string,
type: string,
value?: any,
loc: ErrorLocation,
|};
export type CSSModulesConfig = {|
/**
* The pattern to use when renaming class names and other identifiers. Default is string.
*/
pattern?: string,
/**
* Whether to rename dashed identifiers, e.g. custom properties.
*/
dashedIdents?: boolean,
/**
* Whether to enable hashing for string.
*/
animation?: boolean,
/**
* Whether to enable hashing for CSS grid identifiers.
*/
grid?: boolean,
/**
* Whether to enable hashing for string names.
*/
container?: boolean,
/**
* Whether to enable hashing for custom identifiers.
*/
customIdents?: boolean,
/**
* Whether to require at least one class or id selector in each rule.
*/
pure?: boolean,
|};
export type CSSModuleExports = {
/**
* Maps exported (i.e. original) names to local names.
*/
[name: string]: CSSModuleExport,
};
export type CSSModuleExport = {|
/**
* The local (compiled) name for this export.
*/
name: string,
/**
* Whether the export is referenced in this file.
*/
isReferenced: boolean,
/**
* Other names that are composed by this export.
*/
composes: CSSModuleReference[],
|};
export type CSSModuleReferences = {
/**
* Maps placeholder names to references.
*/
[name: string]: DependencyCSSModuleReference,
};
export type CSSModuleReference =
| LocalCSSModuleReference
| GlobalCSSModuleReference
| DependencyCSSModuleReference;
export type LocalCSSModuleReference = {|
type: "local",
/**
* The local (compiled) name for the reference.
*/
name: string,
|};
export type GlobalCSSModuleReference = {|
type: "global",
/**
* The referenced global name.
*/
name: string,
|};
export type DependencyCSSModuleReference = {|
type: "dependency",
/**
* The name to reference within the dependency.
*/
name: string,
/**
* The dependency specifier for the referenced file.
*/
specifier: string,
|};
export type Dependency = ImportDependency | UrlDependency;
export type ImportDependency = {|
type: "import",
/**
* The url of the string dependency.
*/
url: string,
/**
* The media query for the string rule.
*/
media: string | null,
/**
* The string rule.
*/
supports: string | null,
/**
* The source location where the string rule was found.
*/
loc: SourceLocation,
/**
* The placeholder that the import was replaced with.
*/
placeholder: string,
|};
export type UrlDependency = {|
type: "url",
/**
* The url of the dependency.
*/
url: string,
/**
* The source location where the string was found.
*/
loc: SourceLocation,
/**
* The placeholder that the url was replaced with.
*/
placeholder: string,
|};
export type SourceLocation = {|
/**
* The file path in which the dependency exists.
*/
filePath: string,
/**
* The start location of the dependency.
*/
start: Location,
/**
* The end location (inclusive) of the dependency.
*/
end: Location,
|};
export type Location = {|
/**
* The line number (1-based).
*/
line: number,
/**
* The column number (0-based).
*/
column: number,
|};
export type ErrorLocation = {|
...$Exact<Location>,
filename: string,
|};
/**
* Compiles a CSS file, including optionally minifying and lowering syntax to the given
* targets. A source map may also be generated, but this is not enabled by default.
*/
declare export function transform<C: CustomAtRules>(
options: TransformOptions<C>
): TransformResult;
export type TransformAttributeOptions = {|
/**
* The filename in which the style attribute appeared. Used for error messages and dependencies.
*/
filename?: string,
/**
* The source code to transform.
*/
code: Uint8Array,
/**
* Whether to enable minification.
*/
minify?: boolean,
/**
* The browser targets for the generated code.
*/
targets?: Targets,
/**
* Whether to analyze string dependencies.
* When enabled, string dependencies are replaced with hashed placeholders
* that can be replaced with the final urls later (after bundling).
* Dependencies are returned as part of the result.
*/
analyzeDependencies?: boolean,
/**
* Whether to ignore invalid rules and declarations rather than erroring.
* When enabled, warnings are returned, and the invalid rule or declaration is
* omitted from the output code.
*/
errorRecovery?: boolean,
/**
* An AST visitor object. This allows custom transforms or analysis to be implemented in JavaScript.
* Multiple visitors can be composed into one using the string function.
* For optimal performance, visitors should be as specific as possible about what types of values
* they care about so that JavaScript has to be called as little as possible.
*/
visitor?: Visitor<empty>,
|};
export type TransformAttributeResult = {|
/**
* The transformed code.
*/
code: Uint8Array,
/**
* string dependencies, if enabled.
*/
dependencies: Dependency[] | void,
/**
* Warnings that occurred during compilation.
*/
warnings: Warning[],
|};
/**
* Compiles a single CSS declaration list, such as an inline style attribute in HTML.
*/
declare export function transformStyleAttribute(
options: TransformAttributeOptions
): TransformAttributeResult;
/**
* Converts a browserslist result into targets that can be passed to lightningcss.
* @param browserslist the result of calling string
*/
declare export function browserslistToTargets(browserslist: string[]): Targets;
/**
* Bundles a CSS file and its dependencies, inlining @import rules.
*/
declare export function bundle<C: CustomAtRules>(
options: BundleOptions<C>
): TransformResult;
/**
* Bundles a CSS file and its dependencies asynchronously, inlining @import rules.
*/
declare export function bundleAsync<C: CustomAtRules>(
options: BundleAsyncOptions<C>
): Promise<TransformResult>;
/**
* Composes multiple visitor objects into a single one.
*/
declare export function composeVisitors<C: CustomAtRules>(
visitors: Visitor<C>[]
): Visitor<C>;

4
node_modules/lightningcss/node/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import index from './index.js';
const { transform, transformStyleAttribute, bundle, bundleAsync, browserslistToTargets, composeVisitors, Features } = index;
export { transform, transformStyleAttribute, bundle, bundleAsync, browserslistToTargets, composeVisitors, Features };

40
node_modules/lightningcss/node/targets.d.ts generated vendored Normal file
View File

@@ -0,0 +1,40 @@
// This file is autogenerated by build-prefixes.js. DO NOT EDIT!
export interface Targets {
android?: number,
chrome?: number,
edge?: number,
firefox?: number,
ie?: number,
ios_saf?: number,
opera?: number,
safari?: number,
samsung?: number
}
export const Features: {
Nesting: 1,
NotSelectorList: 2,
DirSelector: 4,
LangSelectorList: 8,
IsSelector: 16,
TextDecorationThicknessPercent: 32,
MediaIntervalSyntax: 64,
MediaRangeSyntax: 128,
CustomMediaQueries: 256,
ClampFunction: 512,
ColorFunction: 1024,
OklabColors: 2048,
LabColors: 4096,
P3Colors: 8192,
HexAlphaColors: 16384,
SpaceSeparatedColorNotation: 32768,
FontFamilySystemUi: 65536,
DoublePositionGradients: 131072,
VendorPrefixes: 262144,
LogicalProperties: 524288,
LightDark: 1048576,
Selectors: 31,
MediaQueries: 448,
Colors: 1113088,
};

39
node_modules/lightningcss/node/targets.js.flow generated vendored Normal file
View File

@@ -0,0 +1,39 @@
// @flow
export interface Targets {
android?: number;
chrome?: number;
edge?: number;
firefox?: number;
ie?: number;
ios_saf?: number;
opera?: number;
safari?: number;
samsung?: number;
}
declare export var Features: {|
Nesting: 1,
NotSelectorList: 2,
DirSelector: 4,
LangSelectorList: 8,
IsSelector: 16,
TextDecorationThicknessPercent: 32,
MediaIntervalSyntax: 64,
MediaRangeSyntax: 128,
CustomMediaQueries: 256,
ClampFunction: 512,
ColorFunction: 1024,
OklabColors: 2048,
LabColors: 4096,
P3Colors: 8192,
HexAlphaColors: 16384,
SpaceSeparatedColorNotation: 32768,
FontFamilySystemUi: 65536,
DoublePositionGradients: 131072,
VendorPrefixes: 262144,
LogicalProperties: 524288,
LightDark: 1048576,
Selectors: 31,
MediaQueries: 448,
Colors: 1113088,
|};

View File

@@ -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.

View File

@@ -0,0 +1,163 @@
# detect-libc
Node.js module to detect details of the C standard library (libc)
implementation provided by a given Linux system.
Currently supports detection of GNU glibc and MUSL libc.
Provides asychronous and synchronous functions for the
family (e.g. `glibc`, `musl`) and version (e.g. `1.23`, `1.2.3`).
The version numbers of libc implementations
are not guaranteed to be semver-compliant.
For previous v1.x releases, please see the
[v1](https://github.com/lovell/detect-libc/tree/v1) branch.
## Install
```sh
npm install detect-libc
```
## API
### GLIBC
```ts
const GLIBC: string = 'glibc';
```
A String constant containing the value `glibc`.
### MUSL
```ts
const MUSL: string = 'musl';
```
A String constant containing the value `musl`.
### family
```ts
function family(): Promise<string | null>;
```
Resolves asychronously with:
* `glibc` or `musl` when the libc family can be determined
* `null` when the libc family cannot be determined
* `null` when run on a non-Linux platform
```js
const { family, GLIBC, MUSL } = require('detect-libc');
switch (await family()) {
case GLIBC: ...
case MUSL: ...
case null: ...
}
```
### familySync
```ts
function familySync(): string | null;
```
Synchronous version of `family()`.
```js
const { familySync, GLIBC, MUSL } = require('detect-libc');
switch (familySync()) {
case GLIBC: ...
case MUSL: ...
case null: ...
}
```
### version
```ts
function version(): Promise<string | null>;
```
Resolves asychronously with:
* The version when it can be determined
* `null` when the libc family cannot be determined
* `null` when run on a non-Linux platform
```js
const { version } = require('detect-libc');
const v = await version();
if (v) {
const [major, minor, patch] = v.split('.');
}
```
### versionSync
```ts
function versionSync(): string | null;
```
Synchronous version of `version()`.
```js
const { versionSync } = require('detect-libc');
const v = versionSync();
if (v) {
const [major, minor, patch] = v.split('.');
}
```
### isNonGlibcLinux
```ts
function isNonGlibcLinux(): Promise<boolean>;
```
Resolves asychronously with:
* `false` when the libc family is `glibc`
* `true` when the libc family is not `glibc`
* `false` when run on a non-Linux platform
```js
const { isNonGlibcLinux } = require('detect-libc');
if (await isNonGlibcLinux()) { ... }
```
### isNonGlibcLinuxSync
```ts
function isNonGlibcLinuxSync(): boolean;
```
Synchronous version of `isNonGlibcLinux()`.
```js
const { isNonGlibcLinuxSync } = require('detect-libc');
if (isNonGlibcLinuxSync()) { ... }
```
## Licensing
Copyright 2017 Lovell Fuller and others.
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](http://www.apache.org/licenses/LICENSE-2.0.html)
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.

View File

@@ -0,0 +1,14 @@
// Copyright 2017 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
export const GLIBC: 'glibc';
export const MUSL: 'musl';
export function family(): Promise<string | null>;
export function familySync(): string | null;
export function isNonGlibcLinux(): Promise<boolean>;
export function isNonGlibcLinuxSync(): boolean;
export function version(): Promise<string | null>;
export function versionSync(): string | null;

View File

@@ -0,0 +1,267 @@
// Copyright 2017 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
'use strict';
const childProcess = require('child_process');
const { isLinux, getReport } = require('./process');
const { LDD_PATH, readFile, readFileSync } = require('./filesystem');
let cachedFamilyFilesystem;
let cachedVersionFilesystem;
const command = 'getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true';
let commandOut = '';
const safeCommand = () => {
if (!commandOut) {
return new Promise((resolve) => {
childProcess.exec(command, (err, out) => {
commandOut = err ? ' ' : out;
resolve(commandOut);
});
});
}
return commandOut;
};
const safeCommandSync = () => {
if (!commandOut) {
try {
commandOut = childProcess.execSync(command, { encoding: 'utf8' });
} catch (_err) {
commandOut = ' ';
}
}
return commandOut;
};
/**
* A String constant containing the value `glibc`.
* @type {string}
* @public
*/
const GLIBC = 'glibc';
/**
* A Regexp constant to get the GLIBC Version.
* @type {string}
*/
const RE_GLIBC_VERSION = /LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i;
/**
* A String constant containing the value `musl`.
* @type {string}
* @public
*/
const MUSL = 'musl';
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-');
const familyFromReport = () => {
const report = getReport();
if (report.header && report.header.glibcVersionRuntime) {
return GLIBC;
}
if (Array.isArray(report.sharedObjects)) {
if (report.sharedObjects.some(isFileMusl)) {
return MUSL;
}
}
return null;
};
const familyFromCommand = (out) => {
const [getconf, ldd1] = out.split(/[\r\n]+/);
if (getconf && getconf.includes(GLIBC)) {
return GLIBC;
}
if (ldd1 && ldd1.includes(MUSL)) {
return MUSL;
}
return null;
};
const getFamilyFromLddContent = (content) => {
if (content.includes('musl')) {
return MUSL;
}
if (content.includes('GNU C Library')) {
return GLIBC;
}
return null;
};
const familyFromFilesystem = async () => {
if (cachedFamilyFilesystem !== undefined) {
return cachedFamilyFilesystem;
}
cachedFamilyFilesystem = null;
try {
const lddContent = await readFile(LDD_PATH);
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
} catch (e) {}
return cachedFamilyFilesystem;
};
const familyFromFilesystemSync = () => {
if (cachedFamilyFilesystem !== undefined) {
return cachedFamilyFilesystem;
}
cachedFamilyFilesystem = null;
try {
const lddContent = readFileSync(LDD_PATH);
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
} catch (e) {}
return cachedFamilyFilesystem;
};
/**
* Resolves with the libc family when it can be determined, `null` otherwise.
* @returns {Promise<?string>}
*/
const family = async () => {
let family = null;
if (isLinux()) {
family = await familyFromFilesystem();
if (!family) {
family = familyFromReport();
}
if (!family) {
const out = await safeCommand();
family = familyFromCommand(out);
}
}
return family;
};
/**
* Returns the libc family when it can be determined, `null` otherwise.
* @returns {?string}
*/
const familySync = () => {
let family = null;
if (isLinux()) {
family = familyFromFilesystemSync();
if (!family) {
family = familyFromReport();
}
if (!family) {
const out = safeCommandSync();
family = familyFromCommand(out);
}
}
return family;
};
/**
* Resolves `true` only when the platform is Linux and the libc family is not `glibc`.
* @returns {Promise<boolean>}
*/
const isNonGlibcLinux = async () => isLinux() && await family() !== GLIBC;
/**
* Returns `true` only when the platform is Linux and the libc family is not `glibc`.
* @returns {boolean}
*/
const isNonGlibcLinuxSync = () => isLinux() && familySync() !== GLIBC;
const versionFromFilesystem = async () => {
if (cachedVersionFilesystem !== undefined) {
return cachedVersionFilesystem;
}
cachedVersionFilesystem = null;
try {
const lddContent = await readFile(LDD_PATH);
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
if (versionMatch) {
cachedVersionFilesystem = versionMatch[1];
}
} catch (e) {}
return cachedVersionFilesystem;
};
const versionFromFilesystemSync = () => {
if (cachedVersionFilesystem !== undefined) {
return cachedVersionFilesystem;
}
cachedVersionFilesystem = null;
try {
const lddContent = readFileSync(LDD_PATH);
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
if (versionMatch) {
cachedVersionFilesystem = versionMatch[1];
}
} catch (e) {}
return cachedVersionFilesystem;
};
const versionFromReport = () => {
const report = getReport();
if (report.header && report.header.glibcVersionRuntime) {
return report.header.glibcVersionRuntime;
}
return null;
};
const versionSuffix = (s) => s.trim().split(/\s+/)[1];
const versionFromCommand = (out) => {
const [getconf, ldd1, ldd2] = out.split(/[\r\n]+/);
if (getconf && getconf.includes(GLIBC)) {
return versionSuffix(getconf);
}
if (ldd1 && ldd2 && ldd1.includes(MUSL)) {
return versionSuffix(ldd2);
}
return null;
};
/**
* Resolves with the libc version when it can be determined, `null` otherwise.
* @returns {Promise<?string>}
*/
const version = async () => {
let version = null;
if (isLinux()) {
version = await versionFromFilesystem();
if (!version) {
version = versionFromReport();
}
if (!version) {
const out = await safeCommand();
version = versionFromCommand(out);
}
}
return version;
};
/**
* Returns the libc version when it can be determined, `null` otherwise.
* @returns {?string}
*/
const versionSync = () => {
let version = null;
if (isLinux()) {
version = versionFromFilesystemSync();
if (!version) {
version = versionFromReport();
}
if (!version) {
const out = safeCommandSync();
version = versionFromCommand(out);
}
}
return version;
};
module.exports = {
GLIBC,
MUSL,
family,
familySync,
isNonGlibcLinux,
isNonGlibcLinuxSync,
version,
versionSync
};

View File

@@ -0,0 +1,41 @@
// Copyright 2017 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
'use strict';
const fs = require('fs');
/**
* The path where we can find the ldd
*/
const LDD_PATH = '/usr/bin/ldd';
/**
* Read the content of a file synchronous
*
* @param {string} path
* @returns {string}
*/
const readFileSync = (path) => fs.readFileSync(path, 'utf-8');
/**
* Read the content of a file
*
* @param {string} path
* @returns {Promise<string>}
*/
const readFile = (path) => new Promise((resolve, reject) => {
fs.readFile(path, 'utf-8', (err, data) => {
if (err) {
reject(err);
} else {
resolve(data);
}
});
});
module.exports = {
LDD_PATH,
readFileSync,
readFile
};

View File

@@ -0,0 +1,24 @@
// Copyright 2017 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
'use strict';
const isLinux = () => process.platform === 'linux';
let report = null;
const getReport = () => {
if (!report) {
/* istanbul ignore next */
if (isLinux() && process.report) {
const orig = process.report.excludeNetwork;
process.report.excludeNetwork = true;
report = process.report.getReport();
process.report.excludeNetwork = orig;
} else {
report = {};
}
}
return report;
};
module.exports = { isLinux, getReport };

View File

@@ -0,0 +1,40 @@
{
"name": "detect-libc",
"version": "2.0.3",
"description": "Node.js module to detect the C standard library (libc) implementation family and version",
"main": "lib/detect-libc.js",
"files": [
"lib/",
"index.d.ts"
],
"scripts": {
"test": "semistandard && nyc --reporter=text --check-coverage --branches=100 ava test/unit.js",
"bench": "node benchmark/detect-libc",
"bench:calls": "node benchmark/call-familySync.js && sleep 1 && node benchmark/call-isNonGlibcLinuxSync.js && sleep 1 && node benchmark/call-versionSync.js"
},
"repository": {
"type": "git",
"url": "git://github.com/lovell/detect-libc"
},
"keywords": [
"libc",
"glibc",
"musl"
],
"author": "Lovell Fuller <npm@lovell.info>",
"contributors": [
"Niklas Salmoukas <niklas@salmoukas.com>",
"Vinícius Lourenço <vinyygamerlol@gmail.com>"
],
"license": "Apache-2.0",
"devDependencies": {
"ava": "^2.4.0",
"benchmark": "^2.1.4",
"nyc": "^15.1.0",
"proxyquire": "^2.1.3",
"semistandard": "^14.2.3"
},
"engines": {
"node": ">=8"
}
}

109
node_modules/lightningcss/package.json generated vendored Normal file
View File

@@ -0,0 +1,109 @@
{
"name": "lightningcss",
"version": "1.29.2",
"license": "MPL-2.0",
"description": "A CSS parser, transformer, and minifier written in Rust",
"main": "node/index.js",
"types": "node/index.d.ts",
"exports": {
"types": "./node/index.d.ts",
"import": "./node/index.mjs",
"require": "./node/index.js"
},
"browserslist": "last 2 versions, not dead",
"targets": {
"main": false,
"types": false
},
"publishConfig": {
"access": "public"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
},
"repository": {
"type": "git",
"url": "https://github.com/parcel-bundler/lightningcss.git"
},
"engines": {
"node": ">= 12.0.0"
},
"napi": {
"name": "lightningcss"
},
"files": [
"node/*.js",
"node/*.mjs",
"node/*.d.ts",
"node/*.flow"
],
"dependencies": {
"detect-libc": "^2.0.3"
},
"devDependencies": {
"@babel/parser": "7.21.4",
"@babel/traverse": "7.21.4",
"@codemirror/lang-css": "^6.0.1",
"@codemirror/lang-javascript": "^6.1.2",
"@codemirror/lint": "^6.1.0",
"@codemirror/theme-one-dark": "^6.1.0",
"@mdn/browser-compat-data": "~5.7.0",
"@napi-rs/cli": "^2.14.0",
"autoprefixer": "^10.4.20",
"caniuse-lite": "^1.0.30001702",
"codemirror": "^6.0.1",
"cssnano": "^7.0.6",
"esbuild": "^0.19.8",
"flowgen": "^1.21.0",
"jest-diff": "^27.4.2",
"json-schema-to-typescript": "^11.0.2",
"markdown-it-anchor": "^8.6.6",
"markdown-it-prism": "^2.3.0",
"markdown-it-table-of-contents": "^0.6.0",
"napi-wasm": "^1.0.1",
"node-fetch": "^3.1.0",
"parcel": "^2.8.2",
"patch-package": "^6.5.0",
"path-browserify": "^1.0.1",
"postcss": "^8.3.11",
"posthtml-include": "^1.7.4",
"posthtml-markdownit": "^1.3.1",
"posthtml-prism": "^1.0.4",
"process": "^0.11.10",
"puppeteer": "^12.0.1",
"recast": "^0.22.0",
"sharp": "^0.33.5",
"typescript": "^5.7.2",
"util": "^0.12.4",
"uvu": "^0.5.6"
},
"resolutions": {
"lightningcss": "link:."
},
"scripts": {
"prepare": "patch-package",
"build": "node scripts/build.js && node scripts/build-flow.js",
"build-release": "node scripts/build.js --release && node scripts/build-flow.js",
"prepublishOnly": "node scripts/build-flow.js",
"wasm:build": "cargo build --target wasm32-unknown-unknown -p lightningcss_node && wasm-opt target/wasm32-unknown-unknown/debug/lightningcss_node.wasm --asyncify --pass-arg=asyncify-imports@env.await_promise_sync -Oz -o wasm/lightningcss_node.wasm && node scripts/build-wasm.js",
"wasm:build-release": "cargo build --target wasm32-unknown-unknown -p lightningcss_node --release && wasm-opt target/wasm32-unknown-unknown/release/lightningcss_node.wasm --asyncify --pass-arg=asyncify-imports@env.await_promise_sync -Oz -o wasm/lightningcss_node.wasm && node scripts/build-wasm.js",
"website:start": "parcel 'website/*.html' website/playground/index.html",
"website:build": "yarn wasm:build-release && parcel build 'website/*.html' website/playground/index.html",
"build-ast": "cargo run --example schema --features jsonschema && node scripts/build-ast.js",
"tsc": "tsc -p node/tsconfig.json",
"test": "uvu node/test"
},
"optionalDependencies": {
"lightningcss-darwin-x64": "1.29.2",
"lightningcss-linux-x64-gnu": "1.29.2",
"lightningcss-win32-x64-msvc": "1.29.2",
"lightningcss-win32-arm64-msvc": "1.29.2",
"lightningcss-darwin-arm64": "1.29.2",
"lightningcss-linux-arm64-gnu": "1.29.2",
"lightningcss-linux-arm-gnueabihf": "1.29.2",
"lightningcss-linux-arm64-musl": "1.29.2",
"lightningcss-linux-x64-musl": "1.29.2",
"lightningcss-freebsd-x64": "1.29.2"
}
}