new license file version [CI SKIP]

This commit is contained in:
2023-03-15 12:34:41 +00:00
parent 0a6d92a1f3
commit 61328d20ed
13115 changed files with 1892314 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
'use strict';
module.exports = require('./async').rejectSeries;

View File

@@ -0,0 +1,12 @@
# Node.js releases data
All data is located in `data` directory.
`data/processed` contains `envs.json` with node.js releases data preprocessed to be used by [Browserslist](https://github.com/ai/browserslist) and other projects. Each version in this file contains only necessary info: version, release date, LTS flag/name, and security flag.
`data/release-schedule` contains `release-schedule.json` with node.js releases date and end of life date.
## Installation
```bash
npm install node-releases
```

View File

@@ -0,0 +1,116 @@
# crypto-random-string
> Generate a [cryptographically strong](https://en.wikipedia.org/wiki/Strong_cryptography) random string
Can be useful for creating an identifier, slug, salt, PIN code, fixture, etc.
## Install
```
$ npm install crypto-random-string
```
## Usage
```js
import cryptoRandomString from 'crypto-random-string';
cryptoRandomString({length: 10});
//=> '2cf05d94db'
cryptoRandomString({length: 10, type: 'base64'});
//=> 'YMiMbaQl6I'
cryptoRandomString({length: 10, type: 'url-safe'});
//=> 'YN-tqc8pOw'
cryptoRandomString({length: 10, type: 'numeric'});
//=> '8314659141'
cryptoRandomString({length: 6, type: 'distinguishable'});
//=> 'CDEHKM'
cryptoRandomString({length: 10, type: 'ascii-printable'});
//=> '`#Rt8$IK>B'
cryptoRandomString({length: 10, type: 'alphanumeric'});
//=> 'DMuKL8YtE7'
cryptoRandomString({length: 10, characters: 'abc'});
//=> 'abaaccabac'
```
## API
### cryptoRandomString(options)
Returns a randomized string. [Hex](https://en.wikipedia.org/wiki/Hexadecimal) by default.
### cryptoRandomString.async(options)
Returns a promise which resolves to a randomized string. [Hex](https://en.wikipedia.org/wiki/Hexadecimal) by default.
For most use-cases, there's really no good reason to use this async version. From the Node.js docs:
> The `crypto.randomBytes()` method will not complete until there is sufficient entropy available. This should normally never take longer than a few milliseconds. The only time when generating the random bytes may conceivably block for a longer period of time is right after boot, when the whole system is still low on entropy.
In general, anything async comes with some overhead on it's own.
#### options
Type: `object`
##### length
*Required*\
Type: `number`
Length of the returned string.
##### type
Type: `string`\
Default: `'hex'`\
Values: `'hex' | 'base64' | 'url-safe' | 'numeric' | 'distinguishable' | 'ascii-printable' | 'alphanumeric'`
Use only characters from a predefined set of allowed characters.
Cannot be set at the same time as the `characters` option.
The `distinguishable` set contains only uppercase characters that are not easily confused: `CDEHKMPRTUWXY012458`. It can be useful if you need to print out a short string that you'd like users to read and type back in with minimal errors. For example, reading a code off of a screen that needs to be typed into a phone to connect two devices.
The `ascii-printable` set contains all [printable ASCII characters](https://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters): ``!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~`` Useful for generating passwords where all possible ASCII characters should be used.
The `alphanumeric` set contains uppercase letters, lowercase letters, and digits: `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`. Useful for generating [nonce](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/nonce) values.
##### characters
Type: `string`\
Minimum length: `1`\
Maximum length: `65536`
Use only characters from a custom set of allowed characters.
Cannot be set at the same time as the `type` option.
## Related
- [random-int](https://github.com/sindresorhus/random-int) - Generate a random integer
- [random-float](https://github.com/sindresorhus/random-float) - Generate a random float
- [random-item](https://github.com/sindresorhus/random-item) - Get a random item from an array
- [random-boolean](https://github.com/arthurvr/random-boolean) - Get a random boolean
- [random-obj-key](https://github.com/sindresorhus/random-obj-key) - Get a random key from an object
- [random-obj-prop](https://github.com/sindresorhus/random-obj-prop) - Get a random property from an object
- [unique-random](https://github.com/sindresorhus/unique-random) - Generate random numbers that are consecutively unique
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-crypto-random-string?utm_source=npm-crypto-random-string&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

View File

@@ -0,0 +1,50 @@
/* istanbul ignore file: deprecated */
import { URL } from 'node:url';
const keys = [
'protocol',
'host',
'hostname',
'port',
'pathname',
'search',
];
export default function optionsToUrl(origin, options) {
if (options.path) {
if (options.pathname) {
throw new TypeError('Parameters `path` and `pathname` are mutually exclusive.');
}
if (options.search) {
throw new TypeError('Parameters `path` and `search` are mutually exclusive.');
}
if (options.searchParams) {
throw new TypeError('Parameters `path` and `searchParams` are mutually exclusive.');
}
}
if (options.search && options.searchParams) {
throw new TypeError('Parameters `search` and `searchParams` are mutually exclusive.');
}
if (!origin) {
if (!options.protocol) {
throw new TypeError('No URL protocol specified');
}
origin = `${options.protocol}//${options.hostname ?? options.host ?? ''}`;
}
const url = new URL(origin);
if (options.path) {
const searchIndex = options.path.indexOf('?');
if (searchIndex === -1) {
options.pathname = options.path;
}
else {
options.pathname = options.path.slice(0, searchIndex);
options.search = options.path.slice(searchIndex + 1);
}
delete options.path;
}
for (const key of keys) {
if (options[key]) {
url[key] = options[key].toString();
}
}
return url;
}

View File

@@ -0,0 +1,180 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const dns_1 = __importDefault(require("dns"));
const tls_1 = __importDefault(require("tls"));
const url_1 = __importDefault(require("url"));
const debug_1 = __importDefault(require("debug"));
const agent_base_1 = require("agent-base");
const socks_1 = require("socks");
const debug = debug_1.default('socks-proxy-agent');
function dnsLookup(host) {
return new Promise((resolve, reject) => {
dns_1.default.lookup(host, (err, res) => {
if (err) {
reject(err);
}
else {
resolve(res);
}
});
});
}
function parseSocksProxy(opts) {
let port = 0;
let lookup = false;
let type = 5;
// Prefer `hostname` over `host`, because of `url.parse()`
const host = opts.hostname || opts.host;
if (!host) {
throw new TypeError('No "host"');
}
if (typeof opts.port === 'number') {
port = opts.port;
}
else if (typeof opts.port === 'string') {
port = parseInt(opts.port, 10);
}
// From RFC 1928, Section 3: https://tools.ietf.org/html/rfc1928#section-3
// "The SOCKS service is conventionally located on TCP port 1080"
if (!port) {
port = 1080;
}
// figure out if we want socks v4 or v5, based on the "protocol" used.
// Defaults to 5.
if (opts.protocol) {
switch (opts.protocol.replace(':', '')) {
case 'socks4':
lookup = true;
// pass through
case 'socks4a':
type = 4;
break;
case 'socks5':
lookup = true;
// pass through
case 'socks': // no version specified, default to 5h
case 'socks5h':
type = 5;
break;
default:
throw new TypeError(`A "socks" protocol must be specified! Got: ${opts.protocol}`);
}
}
if (typeof opts.type !== 'undefined') {
if (opts.type === 4 || opts.type === 5) {
type = opts.type;
}
else {
throw new TypeError(`"type" must be 4 or 5, got: ${opts.type}`);
}
}
const proxy = {
host,
port,
type
};
let userId = opts.userId || opts.username;
let password = opts.password;
if (opts.auth) {
const auth = opts.auth.split(':');
userId = auth[0];
password = auth[1];
}
if (userId) {
Object.defineProperty(proxy, 'userId', {
value: userId,
enumerable: false
});
}
if (password) {
Object.defineProperty(proxy, 'password', {
value: password,
enumerable: false
});
}
return { lookup, proxy };
}
/**
* The `SocksProxyAgent`.
*
* @api public
*/
class SocksProxyAgent extends agent_base_1.Agent {
constructor(_opts) {
let opts;
if (typeof _opts === 'string') {
opts = url_1.default.parse(_opts);
}
else {
opts = _opts;
}
if (!opts) {
throw new TypeError('a SOCKS proxy server `host` and `port` must be specified!');
}
super(opts);
const parsedProxy = parseSocksProxy(opts);
this.lookup = parsedProxy.lookup;
this.proxy = parsedProxy.proxy;
}
/**
* Initiates a SOCKS connection to the specified SOCKS proxy server,
* which in turn connects to the specified remote host and port.
*
* @api protected
*/
callback(req, opts) {
return __awaiter(this, void 0, void 0, function* () {
const { lookup, proxy } = this;
let { host, port, timeout } = opts;
if (!host) {
throw new Error('No `host` defined!');
}
if (lookup) {
// Client-side DNS resolution for "4" and "5" socks proxy versions.
host = yield dnsLookup(host);
}
const socksOpts = {
proxy,
destination: { host, port },
command: 'connect',
timeout
};
debug('Creating socks proxy connection: %o', socksOpts);
const { socket } = yield socks_1.SocksClient.createConnection(socksOpts);
debug('Successfully created socks proxy connection');
if (opts.secureEndpoint) {
// The proxy is connecting to a TLS server, so upgrade
// this socket connection to a TLS connection.
debug('Upgrading socket connection to TLS');
const servername = opts.servername || host;
return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket,
servername }));
}
return socket;
});
}
}
exports.default = SocksProxyAgent;
function omit(obj, ...keys) {
const ret = {};
let key;
for (key in obj) {
if (!keys.includes(key)) {
ret[key] = obj[key];
}
}
return ret;
}
//# sourceMappingURL=agent.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"not.js","sourceRoot":"","sources":["../../../../src/internal/util/not.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,CAAI,IAA0C,EAAE,OAAY;IAC7E,OAAO,CAAC,KAAQ,EAAE,KAAa,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACxE,CAAC"}

View File

@@ -0,0 +1,6 @@
import Tabular from '../tabular';
export interface ContainerEvents {
beforeLoad: () => void;
load: (data: Tabular) => void;
ready: () => void;
}

View File

@@ -0,0 +1,7 @@
import { EnsureBaseOptions, EnsureIsOptional, EnsureDefault } from '../ensure';
declare function ensureNaturalNumber(value: any, options?: EnsureBaseOptions): number;
declare function ensureNaturalNumber(value: any, options?: EnsureBaseOptions & EnsureIsOptional): number | null;
declare function ensureNaturalNumber(value: any, options?: EnsureBaseOptions & EnsureIsOptional & EnsureDefault<number>): number;
export default ensureNaturalNumber;

View File

@@ -0,0 +1,52 @@
{
"name": "emoji-regex",
"version": "9.2.2",
"description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.",
"homepage": "https://mths.be/emoji-regex",
"main": "index.js",
"types": "index.d.ts",
"keywords": [
"unicode",
"regex",
"regexp",
"regular expressions",
"code points",
"symbols",
"characters",
"emoji"
],
"license": "MIT",
"author": {
"name": "Mathias Bynens",
"url": "https://mathiasbynens.be/"
},
"repository": {
"type": "git",
"url": "https://github.com/mathiasbynens/emoji-regex.git"
},
"bugs": "https://github.com/mathiasbynens/emoji-regex/issues",
"files": [
"LICENSE-MIT.txt",
"index.js",
"index.d.ts",
"RGI_Emoji.js",
"RGI_Emoji.d.ts",
"text.js",
"text.d.ts",
"es2015"
],
"scripts": {
"build": "rm -rf -- es2015; babel src -d .; NODE_ENV=es2015 babel src es2015_types -D -d ./es2015; node script/inject-sequences.js",
"test": "mocha",
"test:watch": "npm run test -- --watch"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.4",
"@babel/plugin-proposal-unicode-property-regex": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@unicode/unicode-13.0.0": "^1.0.3",
"mocha": "^6.1.4",
"regexgen": "^1.3.0"
}
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-messageformat/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAA;AAC5C,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,eAAe,iBAAiB,CAAA"}

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"Y Z a b c d e i j k l m n o p q r s t u f H","2":"C K L G M N O","1028":"W X","1540":"P Q R S T U V"},C:{"1":"eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC","164":"0 1 2 3 4 5 6 7 8 9 tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB EC FC","1540":"HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB"},D:{"1":"Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","292":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB","1028":"W X","1540":"hB iB jB kB h lB mB nB oB pB P Q R S T U V"},E:{"1":"G NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","292":"I v J D E F A B C HC zB IC JC KC LC 0B qB","1540":"K L rB 1B","5124":"MC"},F:{"1":"nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"F B C PC QC RC SC qB AC TC rB","292":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB","1028":"lB mB","1540":"WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h"},G:{"1":"nC 2B 3B 4B 5B sB 6B 7B 8B 9B","292":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC","1540":"gC hC iC jC kC lC","5124":"mC"},H:{"2":"oC"},I:{"1":"f","292":"tB I pC qC rC sC BC tC uC"},J:{"292":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"292":"vC"},P:{"1":"g 5C sB 6C 7C 8C","292":"I wC xC yC zC 0C","1540":"0B 1C 2C 3C 4C"},Q:{"1540":"1B"},R:{"1":"9C"},S:{"1":"BD","1540":"AD"}},B:5,C:"CSS Logical Properties"};

View File

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

View File

@@ -0,0 +1,40 @@
{
"name": "type-check",
"version": "0.3.2",
"author": "George Zahariev <z@georgezahariev.com>",
"description": "type-check allows you to check the types of JavaScript values at runtime with a Haskell like type syntax.",
"homepage": "https://github.com/gkz/type-check",
"keywords": [
"type",
"check",
"checking",
"library"
],
"files": [
"lib",
"README.md",
"LICENSE"
],
"main": "./lib/",
"bugs": "https://github.com/gkz/type-check/issues",
"license": "MIT",
"engines": {
"node": ">= 0.8.0"
},
"repository": {
"type": "git",
"url": "git://github.com/gkz/type-check.git"
},
"scripts": {
"test": "make test"
},
"dependencies": {
"prelude-ls": "~1.1.2"
},
"devDependencies": {
"livescript": "~1.4.0",
"mocha": "~2.3.4",
"istanbul": "~0.4.1",
"browserify": "~12.0.1"
}
}

View File

@@ -0,0 +1,14 @@
"use strict";
var resolveException = require("../lib/resolve-exception")
, is = require("./is");
module.exports = function (value /*, options*/) {
if (is(value)) return value;
var options = arguments[1];
var errorMessage =
options && options.name
? "Expected a constructor function for %n, received %v"
: "%v is not a constructor function";
return resolveException(value, errorMessage, options);
};

View File

@@ -0,0 +1,17 @@
module.exports = {
'add': require('./add'),
'ceil': require('./ceil'),
'divide': require('./divide'),
'floor': require('./floor'),
'max': require('./max'),
'maxBy': require('./maxBy'),
'mean': require('./mean'),
'meanBy': require('./meanBy'),
'min': require('./min'),
'minBy': require('./minBy'),
'multiply': require('./multiply'),
'round': require('./round'),
'subtract': require('./subtract'),
'sum': require('./sum'),
'sumBy': require('./sumBy')
};

View File

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

View File

@@ -0,0 +1,10 @@
"use strict";
var forEach = Array.prototype.forEach;
module.exports = function (sep) {
var result = [];
forEach.call(this, function (val) { result.push(val, sep); });
result.pop();
return result;
};

View File

@@ -0,0 +1 @@
{"name":"get-symbol-description","version":"1.0.0","files":{".eslintignore":{"checkedAt":1678883671537,"integrity":"sha512-VLhEcqup3IHXtZJPt07ZYoA9JNRjy1jhU/NU41Yw4E8mEyea/z+6bw5hL3lhCO09pji9E0BH2Q3aDXdc3i9zBg==","mode":420,"size":10},".nycrc":{"checkedAt":1678883669555,"integrity":"sha512-2vm1RFz8Ajl/OYrfoCWPJIm3Bpnf7Gyn5bha/lZx/cq+We3uMy9xj15XeP6x4wF3jf/pO7KMHAkU9mllm605xg==","mode":420,"size":139},"LICENSE":{"checkedAt":1678883671616,"integrity":"sha512-BnoJcv9kJwR3xmFye4OSyYx52JuiWUfoAzjouUfO/Eke87mI1a6IrEi6iKFxxywe6SikoxxCkbElKtYu/MZq5g==","mode":420,"size":1067},".eslintrc":{"checkedAt":1678883671648,"integrity":"sha512-m6KZkllUmVDlgof/exFgVOa0/vCSRv4QZtbzeuE2hcIkYz00ch+xvZAr4m7/m+piYeS0MKYxK1nzYQ4hI2lvrA==","mode":420,"size":156},"getInferredName.js":{"checkedAt":1678883671648,"integrity":"sha512-dIGBUfm4ViW9rnhI8lmIUVyVCxZyM6kE/h1Mv7wme4S3uD/GUZ6aHiZif+viyI/WZrnoDkbMIhI3n46o7E7cNw==","mode":420,"size":287},"test/index.js":{"checkedAt":1678883671648,"integrity":"sha512-GS0jYcUDzjkEc71lToDmcnYV5VcV/6TFcLvH2Uc28UndPqpmdMO9hdYF7ASXmXmoPBG4s7bKAE97LiKYeI3nLg==","mode":420,"size":1787},"index.js":{"checkedAt":1678883671648,"integrity":"sha512-66nBAu1Xr68PTsyzkJdaGDfhQthi2Nj0VPPPFNVht5rNZxK9osrvIJl543CR9PGE8RZ9IhWb6Mi96OfUrp9N6A==","mode":420,"size":1193},"CHANGELOG.md":{"checkedAt":1678883671648,"integrity":"sha512-C5hPkeu/qEKh5Zp9maF/4JTIkpkwmfgC8flxp/mqMakPhPq9dRGpWGC68xlXKUF/CW3VuKwMjfguSFZPv1xEjg==","mode":420,"size":1016},"package.json":{"checkedAt":1678883671648,"integrity":"sha512-AOBd2eL+gkAnjwsX3W1McneP5CvQamtHocfGC5w8rze10lefKAznjMGNMU6FLd5US0bUC+IHy2yTsF6a2jnAxg==","mode":420,"size":1984},".github/FUNDING.yml":{"checkedAt":1678883671653,"integrity":"sha512-11giZ8b/UHNRAjP0btJcyXpKfonFjKVi/vBPllRIm/wagF0fDwS9vybVdpNTTFMj5oxYjIqXSz2kyOs3ojuXPQ==","mode":420,"size":589},"README.md":{"checkedAt":1678883671653,"integrity":"sha512-riapkb6LmxGVw8DsBJ62KARJbzktgn6YB1IaAkQiP+I8p/f6IN4jvMZf1XGMEpDoxMJPywGWZyCrq+u0yY1FFQ==","mode":420,"size":2039}}}

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Error subclass to use when the source has not been modified.
*
* @param {String} message optional "message" property to set
* @api protected
*/
class NotModifiedError extends Error {
constructor(message) {
super(message ||
'Source has not been modified since the provied "cache", re-use previous results');
this.code = 'ENOTMODIFIED';
Object.setPrototypeOf(this, new.target.prototype);
}
}
exports.default = NotModifiedError;
//# sourceMappingURL=notmodified.js.map

View File

@@ -0,0 +1 @@
{"name":"lower-case","version":"1.1.4","files":{"package.json":{"checkedAt":1678883670323,"integrity":"sha512-fhBZcKK7HHXarxaeegrxMOQnCksDuI+mc3LOrWPXW7aBgKOa3CKuqmQtRYIHN8Qwg6ZV73Ft5fWXMdhwxZuEVg==","mode":420,"size":1160},"README.md":{"checkedAt":1678883670323,"integrity":"sha512-ohvggYPeW2fVgMneQyOB00kY7vP+jTfWDoy/Zm1MNzyU836dPSA2zgSTX58C0vxgwyA8mHh9jadV6E+8DK0IvQ==","mode":420,"size":1359},"LICENSE":{"checkedAt":1678883670323,"integrity":"sha512-bYuXCL+h88+itj+QFSy28mlgwrpU+hGhbBPh1aP4X0EhUWaZAltrdZ4FGydlCbHWlRC2RCQUNOb4+Bs9+lqOYw==","mode":420,"size":1103},"lower-case.d.ts":{"checkedAt":1678883670323,"integrity":"sha512-WT1HDSyFU0ukjGOIi2X9fdt3AilYi/WDXl9a9Og9+CGHFhkZBbv9yXkWJu7tULuGwS2Av1EWoMm7wc3n0ojXxw==","mode":420,"size":90},"lower-case.js":{"checkedAt":1678883670323,"integrity":"sha512-kyzu4uj33iZqSTfhAjSoebMw6hSE+oU2TF3205q5TlHZqPDaIm4oQu72BBtjncH7Kh7PIjA49nwAceTfdCSc1A==","mode":420,"size":1065}}}

View File

@@ -0,0 +1,42 @@
declare module '*.module.css' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.scss' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.sass' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.module.less' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.less' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.css' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.sass' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.scss' {
const classes: { readonly [key: string]: string };
export default classes;
}
declare module '*.mdx' {
const component: any;
export default component;
}

View File

@@ -0,0 +1,239 @@
"use strict";
exports.__esModule = true;
exports["default"] = void 0;
var _util = require("../util");
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var cloneNode = function cloneNode(obj, parent) {
if (typeof obj !== 'object' || obj === null) {
return obj;
}
var cloned = new obj.constructor();
for (var i in obj) {
if (!obj.hasOwnProperty(i)) {
continue;
}
var value = obj[i];
var type = typeof value;
if (i === 'parent' && type === 'object') {
if (parent) {
cloned[i] = parent;
}
} else if (value instanceof Array) {
cloned[i] = value.map(function (j) {
return cloneNode(j, cloned);
});
} else {
cloned[i] = cloneNode(value, cloned);
}
}
return cloned;
};
var Node = /*#__PURE__*/function () {
function Node(opts) {
if (opts === void 0) {
opts = {};
}
Object.assign(this, opts);
this.spaces = this.spaces || {};
this.spaces.before = this.spaces.before || '';
this.spaces.after = this.spaces.after || '';
}
var _proto = Node.prototype;
_proto.remove = function remove() {
if (this.parent) {
this.parent.removeChild(this);
}
this.parent = undefined;
return this;
};
_proto.replaceWith = function replaceWith() {
if (this.parent) {
for (var index in arguments) {
this.parent.insertBefore(this, arguments[index]);
}
this.remove();
}
return this;
};
_proto.next = function next() {
return this.parent.at(this.parent.index(this) + 1);
};
_proto.prev = function prev() {
return this.parent.at(this.parent.index(this) - 1);
};
_proto.clone = function clone(overrides) {
if (overrides === void 0) {
overrides = {};
}
var cloned = cloneNode(this);
for (var name in overrides) {
cloned[name] = overrides[name];
}
return cloned;
}
/**
* Some non-standard syntax doesn't follow normal escaping rules for css.
* This allows non standard syntax to be appended to an existing property
* by specifying the escaped value. By specifying the escaped value,
* illegal characters are allowed to be directly inserted into css output.
* @param {string} name the property to set
* @param {any} value the unescaped value of the property
* @param {string} valueEscaped optional. the escaped value of the property.
*/
;
_proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
if (!this.raws) {
this.raws = {};
}
var originalValue = this[name];
var originalEscaped = this.raws[name];
this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
if (originalEscaped || valueEscaped !== value) {
this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
} else {
delete this.raws[name]; // delete any escaped value that was created by the setter.
}
}
/**
* Some non-standard syntax doesn't follow normal escaping rules for css.
* This allows the escaped value to be specified directly, allowing illegal
* characters to be directly inserted into css output.
* @param {string} name the property to set
* @param {any} value the unescaped value of the property
* @param {string} valueEscaped the escaped value of the property.
*/
;
_proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
if (!this.raws) {
this.raws = {};
}
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
this.raws[name] = valueEscaped;
}
/**
* When you want a value to passed through to CSS directly. This method
* deletes the corresponding raw value causing the stringifier to fallback
* to the unescaped value.
* @param {string} name the property to set.
* @param {any} value The value that is both escaped and unescaped.
*/
;
_proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
if (this.raws) {
delete this.raws[name];
}
}
/**
*
* @param {number} line The number (starting with 1)
* @param {number} column The column number (starting with 1)
*/
;
_proto.isAtPosition = function isAtPosition(line, column) {
if (this.source && this.source.start && this.source.end) {
if (this.source.start.line > line) {
return false;
}
if (this.source.end.line < line) {
return false;
}
if (this.source.start.line === line && this.source.start.column > column) {
return false;
}
if (this.source.end.line === line && this.source.end.column < column) {
return false;
}
return true;
}
return undefined;
};
_proto.stringifyProperty = function stringifyProperty(name) {
return this.raws && this.raws[name] || this[name];
};
_proto.valueToString = function valueToString() {
return String(this.stringifyProperty("value"));
};
_proto.toString = function toString() {
return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
};
_createClass(Node, [{
key: "rawSpaceBefore",
get: function get() {
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
if (rawSpace === undefined) {
rawSpace = this.spaces && this.spaces.before;
}
return rawSpace || "";
},
set: function set(raw) {
(0, _util.ensureObject)(this, "raws", "spaces");
this.raws.spaces.before = raw;
}
}, {
key: "rawSpaceAfter",
get: function get() {
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
if (rawSpace === undefined) {
rawSpace = this.spaces.after;
}
return rawSpace || "";
},
set: function set(raw) {
(0, _util.ensureObject)(this, "raws", "spaces");
this.raws.spaces.after = raw;
}
}]);
return Node;
}();
exports["default"] = Node;
module.exports = exports.default;

View File

@@ -0,0 +1,6 @@
"use strict";
var ensureValue = require("./valid-value")
, stringifiable = require("./validate-stringifiable");
module.exports = function (value) { return stringifiable(ensureValue(value)); };

View File

@@ -0,0 +1,16 @@
import assertString from './util/assertString';
import { decimal } from './alpha';
export default function isFloat(str, options) {
assertString(str);
options = options || {};
var _float = new RegExp("^(?:[-+])?(?:[0-9]+)?(?:\\".concat(options.locale ? decimal[options.locale] : '.', "[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$"));
if (str === '' || str === '.' || str === ',' || str === '-' || str === '+') {
return false;
}
var value = parseFloat(str.replace(',', '.'));
return _float.test(str) && (!options.hasOwnProperty('min') || value >= options.min) && (!options.hasOwnProperty('max') || value <= options.max) && (!options.hasOwnProperty('lt') || value < options.lt) && (!options.hasOwnProperty('gt') || value > options.gt);
}
export var locales = Object.keys(decimal);

View File

@@ -0,0 +1,14 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $Object = GetIntrinsic('%Object%');
var CheckObjectCoercible = require('./CheckObjectCoercible');
// http://262.ecma-international.org/5.1/#sec-9.9
module.exports = function ToObject(value) {
CheckObjectCoercible(value);
return $Object(value);
};

View File

@@ -0,0 +1,81 @@
import { EMPTY } from '../observable/empty';
import { MonoTypeOperatorFunction } from '../types';
import { operate } from '../util/lift';
import { createOperatorSubscriber } from './OperatorSubscriber';
/**
* Waits for the source to complete, then emits the last N values from the source,
* as specified by the `count` argument.
*
* ![](takeLast.png)
*
* `takeLast` results in an observable that will hold values up to `count` values in memory,
* until the source completes. It then pushes all values in memory to the consumer, in the
* order they were received from the source, then notifies the consumer that it is
* complete.
*
* If for some reason the source completes before the `count` supplied to `takeLast` is reached,
* all values received until that point are emitted, and then completion is notified.
*
* **Warning**: Using `takeLast` with an observable that never completes will result
* in an observable that never emits a value.
*
* ## Example
*
* Take the last 3 values of an Observable with many values
*
* ```ts
* import { range, takeLast } from 'rxjs';
*
* const many = range(1, 100);
* const lastThree = many.pipe(takeLast(3));
* lastThree.subscribe(x => console.log(x));
* ```
*
* @see {@link take}
* @see {@link takeUntil}
* @see {@link takeWhile}
* @see {@link skip}
*
* @param count The maximum number of values to emit from the end of
* the sequence of values emitted by the source Observable.
* @return A function that returns an Observable that emits at most the last
* `count` values emitted by the source Observable.
*/
export function takeLast<T>(count: number): MonoTypeOperatorFunction<T> {
return count <= 0
? () => EMPTY
: operate((source, subscriber) => {
// This buffer will hold the values we are going to emit
// when the source completes. Since we only want to take the
// last N values, we can't emit until we're sure we're not getting
// any more values.
let buffer: T[] = [];
source.subscribe(
createOperatorSubscriber(
subscriber,
(value) => {
// Add the most recent value onto the end of our buffer.
buffer.push(value);
// If our buffer is now larger than the number of values we
// want to take, we remove the oldest value from the buffer.
count < buffer.length && buffer.shift();
},
() => {
// The source completed, we now know what are last values
// are, emit them in the order they were received.
for (const value of buffer) {
subscriber.next(value);
}
subscriber.complete();
},
// Errors are passed through to the consumer
undefined,
() => {
// During finalization release the values in our buffer.
buffer = null!;
}
)
);
});
}

View File

@@ -0,0 +1 @@
{"name":"webidl-conversions","version":"3.0.1","files":{"package.json":{"checkedAt":1678883669949,"integrity":"sha512-S03mUqpG6V8dIOZMnkEOOR5h+JVsL9R1XLUcmdR6C3Jx67zUPSzGZZKkEYsFcsJHYwkvtWhq5745+4Vm05bxMw==","mode":436,"size":511},"README.md":{"checkedAt":1678883669949,"integrity":"sha512-lkrbOHvz4mPVs6JsyP5ZHYire6YOfCiBpBtlOLABtp7wboqJ1Co4FvyW6KZZZ4A1LlZ8rg2QoBwdYKISNFaK2Q==","mode":436,"size":5480},"LICENSE.md":{"checkedAt":1678883669949,"integrity":"sha512-R3XGbBvkxowiKUU8s67JCtBhg3ZSPfpQMhKhAgMkUmG/08vmBta5eHjNS1cULTLa3OZSRK67/go2wogP52rOnA==","mode":436,"size":1323},"lib/index.js":{"checkedAt":1678883669949,"integrity":"sha512-dPCEJdJ3/fCJJ0V5gwV8dTma7xdcgp5Vzk/rQkcEy82iUM6CreA7BvQ1ASQY9Al1nvNseVlTFr5JKocI6ukGAQ==","mode":436,"size":5056}}}

View File

@@ -0,0 +1,65 @@
# types.ts
> Shared TypeScript definitions for Octokit projects
[![@latest](https://img.shields.io/npm/v/@octokit/types.svg)](https://www.npmjs.com/package/@octokit/types)
[![Build Status](https://github.com/octokit/types.ts/workflows/Test/badge.svg)](https://github.com/octokit/types.ts/actions?workflow=Test)
<!-- toc -->
- [Usage](#usage)
- [Examples](#examples)
- [Get parameter and response data types for a REST API endpoint](#get-parameter-and-response-data-types-for-a-rest-api-endpoint)
- [Get response types from endpoint methods](#get-response-types-from-endpoint-methods)
- [Contributing](#contributing)
- [License](#license)
<!-- tocstop -->
## Usage
See all exported types at https://octokit.github.io/types.ts
## Examples
### Get parameter and response data types for a REST API endpoint
```ts
import { Endpoints } from "@octokit/types";
type listUserReposParameters =
Endpoints["GET /repos/{owner}/{repo}"]["parameters"];
type listUserReposResponse = Endpoints["GET /repos/{owner}/{repo}"]["response"];
async function listRepos(
options: listUserReposParameters
): listUserReposResponse["data"] {
// ...
}
```
### Get response types from endpoint methods
```ts
import {
GetResponseTypeFromEndpointMethod,
GetResponseDataTypeFromEndpointMethod,
} from "@octokit/types";
import { Octokit } from "@octokit/rest";
const octokit = new Octokit();
type CreateLabelResponseType = GetResponseTypeFromEndpointMethod<
typeof octokit.issues.createLabel
>;
type CreateLabelResponseDataType = GetResponseDataTypeFromEndpointMethod<
typeof octokit.issues.createLabel
>;
```
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
## License
[MIT](LICENSE)

View File

@@ -0,0 +1,24 @@
import { BaseActions } from '../../base/actions';
import { Comparator, TCell } from '../../../types';
export interface SortActionsType {
SORT_COLUMN: {
index: number;
direction: 1 | -1;
multi?: boolean;
compare?: Comparator<TCell>;
};
SORT_COLUMN_TOGGLE: {
index: number;
multi?: boolean;
compare?: Comparator<TCell>;
};
}
export declare class SortActions extends BaseActions<SortActionsType> {
sortColumn(
index: number,
direction: 1 | -1,
multi?: boolean,
compare?: Comparator<TCell>,
): void;
sortToggle(index: number, multi?: boolean, compare?: Comparator<TCell>): void;
}

View File

@@ -0,0 +1,18 @@
"use strict";
var absolutize = require("./absolutize");
var relativize = require("./relativize");
function relateUrl(siteUrlObj, urlObj, options)
{
absolutize(urlObj, siteUrlObj, options);
relativize(urlObj, siteUrlObj, options);
return urlObj;
}
module.exports = relateUrl;

View File

@@ -0,0 +1 @@
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0.00395,"101":0,"102":0,"103":0.00395,"104":0.00395,"105":0,"106":0,"107":0,"108":0,"109":0.19355,"110":0.2607,"111":0,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0.00395,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0.0948,"76":0,"77":0,"78":0,"79":0.2765,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0.00395,"88":0,"89":0,"90":0.00395,"91":0,"92":0,"93":0.00395,"94":0.00395,"95":0,"96":0.00395,"97":0,"98":0,"99":0.0158,"100":0,"101":0.00395,"102":0.00395,"103":0.35155,"104":0.0158,"105":0.02765,"106":0.0079,"107":0.09085,"108":0.2686,"109":4.72815,"110":2.1725,"111":0,"112":0,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0.079,"95":0.01185,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.00395,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0.01975,"106":0,"107":0,"108":0.03555,"109":0.5135,"110":0.948},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.01975,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0,"13.1":0.158,"14.1":0.0474,"15.1":0.00395,"15.2-15.3":0.02765,"15.4":0.37525,"15.5":0.75445,"15.6":0.316,"16.0":0.0158,"16.1":0.6162,"16.2":1.2561,"16.3":0.2844,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.9557,"10.0-10.2":0,"10.3":0.03577,"11.0-11.2":0.01022,"11.3-11.4":0.65417,"12.0-12.1":0,"12.2-12.5":1.08346,"13.0-13.1":0,"13.2":0,"13.3":0,"13.4-13.7":0.10732,"14.0-14.4":0.53151,"14.5-14.8":0.50596,"15.0-15.1":0.03066,"15.2-15.3":0.38841,"15.4":0.52129,"15.5":1.46165,"15.6":8.85169,"16.0":3.09196,"16.1":12.1123,"16.2":11.56545,"16.3":7.3236,"16.4":0.15843},P:{"4":0.0322,"20":1.15906,"5.0-5.4":0.01073,"6.2-6.4":0,"7.2-7.4":0.13952,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.05366,"12.0":0,"13.0":0.06439,"14.0":0.07512,"15.0":0.01073,"16.0":0.0322,"17.0":0.06439,"18.0":0.02146,"19.0":1.70639},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.2628},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.0726},H:{"0":0.00573},L:{"0":30.3683},R:{_:"0"},M:{"0":0.21175},Q:{"13.1":0}};

View File

@@ -0,0 +1,64 @@
{
"compilerOptions": {
/* Basic Options */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": ["es5","es6"], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
"declaration": true, /* Generates corresponding '.d.ts' file. */
"sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./v2", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
},
"include": [
"src/**/*.ts"
],
"exclude": [
"src/**/*.test.ts"
]
}

View File

@@ -0,0 +1,764 @@
<h1 align="center">
<br/>
<img src="https://cdn.rawgit.com/jakubpawlowicz/clean-css/master/logo.v2.svg" alt="clean-css logo" width="525px"/>
<br/>
<br/>
</h1>
[![NPM version](https://img.shields.io/npm/v/clean-css.svg?style=flat)](https://www.npmjs.com/package/clean-css)
[![Linux Build Status](https://img.shields.io/travis/jakubpawlowicz/clean-css/master.svg?style=flat&label=Linux%20build)](https://travis-ci.org/jakubpawlowicz/clean-css)
[![Windows Build status](https://img.shields.io/appveyor/ci/jakubpawlowicz/clean-css/master.svg?style=flat&label=Windows%20build)](https://ci.appveyor.com/project/jakubpawlowicz/clean-css/branch/master)
[![Dependency Status](https://img.shields.io/david/jakubpawlowicz/clean-css.svg?style=flat)](https://david-dm.org/jakubpawlowicz/clean-css)
[![NPM Downloads](https://img.shields.io/npm/dm/clean-css.svg)](https://npmcharts.com/compare/clean-css?minimal=true)
[![Twitter](https://img.shields.io/badge/Twitter-@cleancss-blue.svg)](https://twitter.com/cleancss)
clean-css is a fast and efficient CSS optimizer for [Node.js](http://nodejs.org/) platform and [any modern browser](https://jakubpawlowicz.github.io/clean-css).
According to [tests](http://goalsmashers.github.io/css-minification-benchmark/) it is one of the best available.
**Table of Contents**
- [Node.js version support](#nodejs-version-support)
- [Install](#install)
- [Use](#use)
* [Important: 4.0 breaking changes](#important-40-breaking-changes)
* [What's new in version 4.1](#whats-new-in-version-41)
* [What's new in version 4.2](#whats-new-in-version-42)
* [Constructor options](#constructor-options)
* [Compatibility modes](#compatibility-modes)
* [Fetch option](#fetch-option)
* [Formatting options](#formatting-options)
* [Inlining options](#inlining-options)
* [Optimization levels](#optimization-levels)
+ [Level 0 optimizations](#level-0-optimizations)
+ [Level 1 optimizations](#level-1-optimizations)
+ [Level 2 optimizations](#level-2-optimizations)
* [Minify method](#minify-method)
* [Promise interface](#promise-interface)
* [CLI utility](#cli-utility)
- [FAQ](#faq)
* [How to optimize multiple files?](#how-to-optimize-multiple-files)
* [How to process remote `@import`s correctly?](#how-to-process-remote-imports-correctly)
* [How to apply arbitrary transformations to CSS properties?](#how-to-apply-arbitrary-transformations-to-css-properties)
* [How to specify a custom rounding precision?](#how-to-specify-a-custom-rounding-precision)
* [How to keep a CSS fragment intact?](#how-to-keep-a-css-fragment-intact)
* [How to preserve a comment block?](#how-to-preserve-a-comment-block)
* [How to rebase relative image URLs?](#how-to-rebase-relative-image-urls)
* [How to work with source maps?](#how-to-work-with-source-maps)
* [How to apply level 1 & 2 optimizations at the same time?](#how-to-apply-level-1--2-optimizations-at-the-same-time)
* [What level 2 optimizations do?](#what-level-2-optimizations-do)
* [How to use clean-css with build tools?](#how-to-use-clean-css-with-build-tools)
* [How to use clean-css from web browser?](#how-to-use-clean-css-from-web-browser)
- [Contributing](#contributing)
* [How to get started?](#how-to-get-started)
- [Acknowledgments](#acknowledgments)
- [License](#license)
# Node.js version support
clean-css requires Node.js 4.0+ (tested on Linux, OS X, and Windows)
# Install
```
npm install --save-dev clean-css
```
# Use
```js
var CleanCSS = require('clean-css');
var input = 'a{font-weight:bold;}';
var options = { /* options */ };
var output = new CleanCSS(options).minify(input);
```
## Important: 4.0 breaking changes
clean-css 4.0 introduces some breaking changes:
* API and CLI interfaces are split, so API stays in this repository while CLI moves to [clean-css-cli](https://github.com/jakubpawlowicz/clean-css-cli);
* `root`, `relativeTo`, and `target` options are replaced by a single `rebaseTo` option - this means that rebasing URLs and import inlining is much simpler but may not be (YMMV) as powerful as in 3.x;
* `debug` option is gone as stats are always provided in output object under `stats` property;
* `roundingPrecision` is disabled by default;
* `roundingPrecision` applies to **all** units now, not only `px` as in 3.x;
* `processImport` and `processImportFrom` are merged into `inline` option which defaults to `local`. Remote `@import` rules are **NOT** inlined by default anymore;
* splits `inliner: { request: ..., timeout: ... }` option into `inlineRequest` and `inlineTimeout` options;
* remote resources without a protocol, e.g. `//fonts.googleapis.com/css?family=Domine:700`, are not inlined anymore;
* changes default Internet Explorer compatibility from 9+ to 10+, to revert the old default use `{ compatibility: 'ie9' }` flag;
* renames `keepSpecialComments` to `specialComments`;
* moves `roundingPrecision` and `specialComments` to level 1 optimizations options, see examples;
* moves `mediaMerging`, `restructuring`, `semanticMerging`, and `shorthandCompacting` to level 2 optimizations options, see examples below;
* renames `shorthandCompacting` option to `mergeIntoShorthands`;
* level 1 optimizations are the new default, up to 3.x it was level 2;
* `keepBreaks` option is replaced with `{ format: 'keep-breaks' }` to ease transition;
* `sourceMap` option has to be a boolean from now on - to specify an input source map pass it a 2nd argument to `minify` method or via a hash instead;
* `aggressiveMerging` option is removed as aggressive merging is replaced by smarter override merging.
## What's new in version 4.1
clean-css 4.1 introduces the following changes / features:
* `inline: false` as an alias to `inline: ['none']`;
* `multiplePseudoMerging` compatibility flag controlling merging of rules with multiple pseudo classes / elements;
* `removeEmpty` flag in level 1 optimizations controlling removal of rules and nested blocks;
* `removeEmpty` flag in level 2 optimizations controlling removal of rules and nested blocks;
* `compatibility: { selectors: { mergeLimit: <number> } }` flag in compatibility settings controlling maximum number of selectors in a single rule;
* `minify` method improved signature accepting a list of hashes for a predictable traversal;
* `selectorsSortingMethod` level 1 optimization allows `false` or `'none'` for disabling selector sorting;
* `fetch` option controlling a function for handling remote requests;
* new `font` shorthand and `font-*` longhand optimizers;
* removal of `optimizeFont` flag in level 1 optimizations due to new `font` shorthand optimizer;
* `skipProperties` flag in level 2 optimizations controlling which properties won't be optimized;
* new `animation` shorthand and `animation-*` longhand optimizers;
* `removeUnusedAtRules` level 2 optimization controlling removal of unused `@counter-style`, `@font-face`, `@keyframes`, and `@namespace` at rules;
* the [web interface](https://jakubpawlowicz.github.io/clean-css) gets an improved settings panel with "reset to defaults", instant option changes, and settings being persisted across sessions.
## What's new in version 4.2
clean-css 4.2 introduces the following changes / features:
* Adds `process` method for compatibility with optimize-css-assets-webpack-plugin;
* new `transition` property optimizer;
* preserves any CSS content between `/* clean-css ignore:start */` and `/* clean-css ignore:end */` comments;
* allows filtering based on selector in `transform` callback, see [example](#how-to-apply-arbitrary-transformations-to-css-properties);
* adds configurable line breaks via `format: { breakWith: 'lf' }` option.
## Constructor options
clean-css constructor accepts a hash as a parameter with the following options available:
* `compatibility` - controls compatibility mode used; defaults to `ie10+`; see [compatibility modes](#compatibility-modes) for examples;
* `fetch` - controls a function for handling remote requests; see [fetch option](#fetch-option) for examples (since 4.1.0);
* `format` - controls output CSS formatting; defaults to `false`; see [formatting options](#formatting-options) for examples;
* `inline` - controls `@import` inlining rules; defaults to `'local'`; see [inlining options](#inlining-options) for examples;
* `inlineRequest` - controls extra options for inlining remote `@import` rules, can be any of [HTTP(S) request options](https://nodejs.org/api/http.html#http_http_request_options_callback);
* `inlineTimeout` - controls number of milliseconds after which inlining a remote `@import` fails; defaults to 5000;
* `level` - controls optimization level used; defaults to `1`; see [optimization levels](#optimization-levels) for examples;
* `rebase` - controls URL rebasing; defaults to `true`;
* `rebaseTo` - controls a directory to which all URLs are rebased, most likely the directory under which the output file will live; defaults to the current directory;
* `returnPromise` - controls whether `minify` method returns a Promise object or not; defaults to `false`; see [promise interface](#promise-interface) for examples;
* `sourceMap` - controls whether an output source map is built; defaults to `false`;
* `sourceMapInlineSources` - controls embedding sources inside a source map's `sourcesContent` field; defaults to false.
## Compatibility modes
There is a certain number of compatibility mode shortcuts, namely:
* `new CleanCSS({ compatibility: '*' })` (default) - Internet Explorer 10+ compatibility mode
* `new CleanCSS({ compatibility: 'ie9' })` - Internet Explorer 9+ compatibility mode
* `new CleanCSS({ compatibility: 'ie8' })` - Internet Explorer 8+ compatibility mode
* `new CleanCSS({ compatibility: 'ie7' })` - Internet Explorer 7+ compatibility mode
Each of these modes is an alias to a [fine grained configuration](https://github.com/jakubpawlowicz/clean-css/blob/master/lib/options/compatibility.js), with the following options available:
```js
new CleanCSS({
compatibility: {
colors: {
opacity: true // controls `rgba()` / `hsla()` color support
},
properties: {
backgroundClipMerging: true, // controls background-clip merging into shorthand
backgroundOriginMerging: true, // controls background-origin merging into shorthand
backgroundSizeMerging: true, // controls background-size merging into shorthand
colors: true, // controls color optimizations
ieBangHack: false, // controls keeping IE bang hack
ieFilters: false, // controls keeping IE `filter` / `-ms-filter`
iePrefixHack: false, // controls keeping IE prefix hack
ieSuffixHack: false, // controls keeping IE suffix hack
merging: true, // controls property merging based on understandability
shorterLengthUnits: false, // controls shortening pixel units into `pc`, `pt`, or `in` units
spaceAfterClosingBrace: true, // controls keeping space after closing brace - `url() no-repeat` into `url()no-repeat`
urlQuotes: false, // controls keeping quoting inside `url()`
zeroUnits: true // controls removal of units `0` value
},
selectors: {
adjacentSpace: false, // controls extra space before `nav` element
ie7Hack: true, // controls removal of IE7 selector hacks, e.g. `*+html...`
mergeablePseudoClasses: [':active', ...], // controls a whitelist of mergeable pseudo classes
mergeablePseudoElements: ['::after', ...], // controls a whitelist of mergeable pseudo elements
mergeLimit: 8191, // controls maximum number of selectors in a single rule (since 4.1.0)
multiplePseudoMerging: true // controls merging of rules with multiple pseudo classes / elements (since 4.1.0)
},
units: {
ch: true, // controls treating `ch` as a supported unit
in: true, // controls treating `in` as a supported unit
pc: true, // controls treating `pc` as a supported unit
pt: true, // controls treating `pt` as a supported unit
rem: true, // controls treating `rem` as a supported unit
vh: true, // controls treating `vh` as a supported unit
vm: true, // controls treating `vm` as a supported unit
vmax: true, // controls treating `vmax` as a supported unit
vmin: true // controls treating `vmin` as a supported unit
}
}
})
```
You can also use a string when setting a compatibility mode, e.g.
```js
new CleanCSS({
compatibility: 'ie9,-properties.merging' // sets compatibility to IE9 mode with disabled property merging
})
```
## Fetch option
The `fetch` option accepts a function which handles remote resource fetching, e.g.
```js
var request = require('request');
var source = '@import url(http://example.com/path/to/stylesheet.css);';
new CleanCSS({
fetch: function (uri, inlineRequest, inlineTimeout, callback) {
request(uri, function (error, response, body) {
if (error) {
callback(error, null);
} else if (response && response.statusCode != 200) {
callback(response.statusCode, null);
} else {
callback(null, body);
}
});
}
}).minify(source);
```
This option provides a convenient way of overriding the default fetching logic if it doesn't support a particular feature, say CONNECT proxies.
Unless given, the default [loadRemoteResource](https://github.com/jakubpawlowicz/clean-css/blob/master/lib/reader/load-remote-resource.js) logic is used.
## Formatting options
By default output CSS is formatted without any whitespace unless a `format` option is given.
First of all there are two shorthands:
```js
new CleanCSS({
format: 'beautify' // formats output in a really nice way
})
```
and
```js
new CleanCSS({
format: 'keep-breaks' // formats output the default way but adds line breaks for improved readability
})
```
however `format` option also accept a fine-grained set of options:
```js
new CleanCSS({
format: {
breaks: { // controls where to insert breaks
afterAtRule: false, // controls if a line break comes after an at-rule; e.g. `@charset`; defaults to `false`
afterBlockBegins: false, // controls if a line break comes after a block begins; e.g. `@media`; defaults to `false`
afterBlockEnds: false, // controls if a line break comes after a block ends, defaults to `false`
afterComment: false, // controls if a line break comes after a comment; defaults to `false`
afterProperty: false, // controls if a line break comes after a property; defaults to `false`
afterRuleBegins: false, // controls if a line break comes after a rule begins; defaults to `false`
afterRuleEnds: false, // controls if a line break comes after a rule ends; defaults to `false`
beforeBlockEnds: false, // controls if a line break comes before a block ends; defaults to `false`
betweenSelectors: false // controls if a line break comes between selectors; defaults to `false`
},
breakWith: '\n', // controls the new line character, can be `'\r\n'` or `'\n'` (aliased as `'windows'` and `'unix'` or `'crlf'` and `'lf'`); defaults to system one, so former on Windows and latter on Unix
indentBy: 0, // controls number of characters to indent with; defaults to `0`
indentWith: 'space', // controls a character to indent with, can be `'space'` or `'tab'`; defaults to `'space'`
spaces: { // controls where to insert spaces
aroundSelectorRelation: false, // controls if spaces come around selector relations; e.g. `div > a`; defaults to `false`
beforeBlockBegins: false, // controls if a space comes before a block begins; e.g. `.block {`; defaults to `false`
beforeValue: false // controls if a space comes before a value; e.g. `width: 1rem`; defaults to `false`
},
wrapAt: false // controls maximum line length; defaults to `false`
}
})
```
## Inlining options
`inline` option whitelists which `@import` rules will be processed, e.g.
```js
new CleanCSS({
inline: ['local'] // default; enables local inlining only
})
```
```js
new CleanCSS({
inline: ['none'] // disables all inlining
})
```
```js
// introduced in clean-css 4.1.0
new CleanCSS({
inline: false // disables all inlining (alias to `['none']`)
})
```
```js
new CleanCSS({
inline: ['all'] // enables all inlining, same as ['local', 'remote']
})
```
```js
new CleanCSS({
inline: ['local', 'mydomain.example.com'] // enables local inlining plus given remote source
})
```
```js
new CleanCSS({
inline: ['local', 'remote', '!fonts.googleapis.com'] // enables all inlining but from given remote source
})
```
## Optimization levels
The `level` option can be either `0`, `1` (default), or `2`, e.g.
```js
new CleanCSS({
level: 2
})
```
or a fine-grained configuration given via a hash.
Please note that level 1 optimization options are generally safe while level 2 optimizations should be safe for most users.
### Level 0 optimizations
Level 0 optimizations simply means "no optimizations". Use it when you'd like to inline imports and / or rebase URLs but skip everything else.
### Level 1 optimizations
Level 1 optimizations (default) operate on single properties only, e.g. can remove units when not required, turn rgb colors to a shorter hex representation, remove comments, etc
Here is a full list of available options:
```js
new CleanCSS({
level: {
1: {
cleanupCharsets: true, // controls `@charset` moving to the front of a stylesheet; defaults to `true`
normalizeUrls: true, // controls URL normalization; defaults to `true`
optimizeBackground: true, // controls `background` property optimizations; defaults to `true`
optimizeBorderRadius: true, // controls `border-radius` property optimizations; defaults to `true`
optimizeFilter: true, // controls `filter` property optimizations; defaults to `true`
optimizeFont: true, // controls `font` property optimizations; defaults to `true`
optimizeFontWeight: true, // controls `font-weight` property optimizations; defaults to `true`
optimizeOutline: true, // controls `outline` property optimizations; defaults to `true`
removeEmpty: true, // controls removing empty rules and nested blocks; defaults to `true`
removeNegativePaddings: true, // controls removing negative paddings; defaults to `true`
removeQuotes: true, // controls removing quotes when unnecessary; defaults to `true`
removeWhitespace: true, // controls removing unused whitespace; defaults to `true`
replaceMultipleZeros: true, // contols removing redundant zeros; defaults to `true`
replaceTimeUnits: true, // controls replacing time units with shorter values; defaults to `true`
replaceZeroUnits: true, // controls replacing zero values with units; defaults to `true`
roundingPrecision: false, // rounds pixel values to `N` decimal places; `false` disables rounding; defaults to `false`
selectorsSortingMethod: 'standard', // denotes selector sorting method; can be `'natural'` or `'standard'`, `'none'`, or false (the last two since 4.1.0); defaults to `'standard'`
specialComments: 'all', // denotes a number of /*! ... */ comments preserved; defaults to `all`
tidyAtRules: true, // controls at-rules (e.g. `@charset`, `@import`) optimizing; defaults to `true`
tidyBlockScopes: true, // controls block scopes (e.g. `@media`) optimizing; defaults to `true`
tidySelectors: true, // controls selectors optimizing; defaults to `true`,
semicolonAfterLastProperty: false, // controls removing trailing semicolons in rule; defaults to `false` - means remove
transform: function () {} // defines a callback for fine-grained property optimization; defaults to no-op
}
}
});
```
There is an `all` shortcut for toggling all options at the same time, e.g.
```js
new CleanCSS({
level: {
1: {
all: false, // set all values to `false`
tidySelectors: true // turns on optimizing selectors
}
}
});
```
### Level 2 optimizations
Level 2 optimizations operate at rules or multiple properties level, e.g. can remove duplicate rules, remove properties redefined further down a stylesheet, or restructure rules by moving them around.
Please note that if level 2 optimizations are turned on then, unless explicitely disabled, level 1 optimizations are applied as well.
Here is a full list of available options:
```js
new CleanCSS({
level: {
2: {
mergeAdjacentRules: true, // controls adjacent rules merging; defaults to true
mergeIntoShorthands: true, // controls merging properties into shorthands; defaults to true
mergeMedia: true, // controls `@media` merging; defaults to true
mergeNonAdjacentRules: true, // controls non-adjacent rule merging; defaults to true
mergeSemantically: false, // controls semantic merging; defaults to false
overrideProperties: true, // controls property overriding based on understandability; defaults to true
removeEmpty: true, // controls removing empty rules and nested blocks; defaults to `true`
reduceNonAdjacentRules: true, // controls non-adjacent rule reducing; defaults to true
removeDuplicateFontRules: true, // controls duplicate `@font-face` removing; defaults to true
removeDuplicateMediaBlocks: true, // controls duplicate `@media` removing; defaults to true
removeDuplicateRules: true, // controls duplicate rules removing; defaults to true
removeUnusedAtRules: false, // controls unused at rule removing; defaults to false (available since 4.1.0)
restructureRules: false, // controls rule restructuring; defaults to false
skipProperties: [] // controls which properties won't be optimized, defaults to `[]` which means all will be optimized (since 4.1.0)
}
}
});
```
There is an `all` shortcut for toggling all options at the same time, e.g.
```js
new CleanCSS({
level: {
2: {
all: false, // sets all values to `false`
removeDuplicateRules: true // turns on removing duplicate rules
}
}
});
```
## Minify method
Once configured clean-css provides a `minify` method to optimize a given CSS, e.g.
```js
var output = new CleanCSS(options).minify(source);
```
The output of the `minify` method is a hash with following fields:
```js
console.log(output.styles); // optimized output CSS as a string
console.log(output.sourceMap); // output source map if requested with `sourceMap` option
console.log(output.errors); // a list of errors raised
console.log(output.warnings); // a list of warnings raised
console.log(output.stats.originalSize); // original content size after import inlining
console.log(output.stats.minifiedSize); // optimized content size
console.log(output.stats.timeSpent); // time spent on optimizations in milliseconds
console.log(output.stats.efficiency); // `(originalSize - minifiedSize) / originalSize`, e.g. 0.25 if size is reduced from 100 bytes to 75 bytes
```
The `minify` method also accepts an input source map, e.g.
```js
var output = new CleanCSS(options).minify(source, inputSourceMap);
```
or a callback invoked when optimizations are finished, e.g.
```js
new CleanCSS(options).minify(source, function (error, output) {
// `output` is the same as in the synchronous call above
});
```
## Promise interface
If you prefer clean-css to return a Promise object then you need to explicitely ask for it, e.g.
```js
new CleanCSS({ returnPromise: true })
.minify(source)
.then(function (output) { console.log(output.styles); })
.catch(function (error) { // deal with errors });
```
## CLI utility
Clean-css has an associated command line utility that can be installed separately using `npm install clean-css-cli`. For more detailed information, please visit https://github.com/jakubpawlowicz/clean-css-cli.
# FAQ
## How to optimize multiple files?
It can be done either by passing an array of paths, or, when sources are already available, a hash or an array of hashes:
```js
new CleanCSS().minify(['path/to/file/one', 'path/to/file/two']);
```
```js
new CleanCSS().minify({
'path/to/file/one': {
styles: 'contents of file one'
},
'path/to/file/two': {
styles: 'contents of file two'
}
});
```
```js
new CleanCSS().minify([
{'path/to/file/one': {styles: 'contents of file one'}},
{'path/to/file/two': {styles: 'contents of file two'}}
]);
```
Passing an array of hashes allows you to explicitly specify the order in which the input files are concatenated. Whereas when you use a single hash the order is determined by the [traversal order of object properties](http://2ality.com/2015/10/property-traversal-order-es6.html) - available since 4.1.0.
Important note - any `@import` rules already present in the hash will be resolved in memory.
## How to process remote `@import`s correctly?
In order to inline remote `@import` statements you need to provide a callback to minify method as fetching remote assets is an asynchronous operation, e.g.:
```js
var source = '@import url(http://example.com/path/to/remote/styles);';
new CleanCSS({ inline: ['remote'] }).minify(source, function (error, output) {
// output.styles
});
```
If you don't provide a callback, then remote `@import`s will be left as is.
## How to apply arbitrary transformations to CSS properties?
If clean-css doesn't perform a particular property optimization, you can use `transform` callback to apply it:
```js
var source = '.block{background-image:url(/path/to/image.png)}';
var output = new CleanCSS({
level: {
1: {
transform: function (propertyName, propertyValue, selector /* `selector` available since 4.2.0-pre */) {
if (propertyName == 'background-image' && propertyValue.indexOf('/path/to') > -1) {
return propertyValue.replace('/path/to', '../valid/path/to');
}
}
}
}
}).minify(source);
console.log(output.styles); # => .block{background-image:url(../valid/path/to/image.png)}
```
Note: returning `false` from `transform` callback will drop a property.
## How to specify a custom rounding precision?
The level 1 `roundingPrecision` optimization option accept a string with per-unit rounding precision settings, e.g.
```js
new CleanCSS({
level: {
1: {
roundingPrecision: 'all=3,px=5'
}
}
}).minify(source)
```
which sets all units rounding precision to 3 digits except `px` unit precision of 5 digits.
## How to keep a CSS fragment intact?
Note: available in the current master, to be released in 4.2.0.
Wrap the CSS fragment in special comments which instruct clean-css to preserve it, e.g.
```css
.block-1 {
color: red
}
/* clean-css ignore:start */
.block-special {
color: transparent
}
/* clean-css ignore:end */
.block-2 {
margin: 0
}
```
Optimizing this CSS will result in the following output:
```css
.block-1{color:red}
.block-special {
color: transparent
}
.block-2{margin:0}
```
## How to preserve a comment block?
Use the `/*!` notation instead of the standard one `/*`:
```css
/*!
Important comments included in optimized output.
*/
```
## How to rebase relative image URLs?
clean-css will handle it automatically for you in the following cases:
* when full paths to input files are passed in as options;
* when correct paths are passed in via a hash;
* when `rebaseTo` is used with any of above two.
## How to work with source maps?
To generate a source map, use `sourceMap: true` option, e.g.:
```js
new CleanCSS({ sourceMap: true, rebaseTo: pathToOutputDirectory })
.minify(source, function (error, output) {
// access output.sourceMap for SourceMapGenerator object
// see https://github.com/mozilla/source-map/#sourcemapgenerator for more details
});
```
You can also pass an input source map directly as a 2nd argument to `minify` method:
```js
new CleanCSS({ sourceMap: true, rebaseTo: pathToOutputDirectory })
.minify(source, inputSourceMap, function (error, output) {
// access output.sourceMap to access SourceMapGenerator object
// see https://github.com/mozilla/source-map/#sourcemapgenerator for more details
});
```
or even multiple input source maps at once:
```js
new CleanCSS({ sourceMap: true, rebaseTo: pathToOutputDirectory }).minify({
'path/to/source/1': {
styles: '...styles...',
sourceMap: '...source-map...'
},
'path/to/source/2': {
styles: '...styles...',
sourceMap: '...source-map...'
}
}, function (error, output) {
// access output.sourceMap as above
});
```
## How to apply level 1 & 2 optimizations at the same time?
Using the hash configuration specifying both optimization levels, e.g.
```js
new CleanCSS({
level: {
1: {
all: true,
normalizeUrls: false
},
2: {
restructureRules: true
}
}
})
```
will apply level 1 optimizations, except url normalization, and default level 2 optimizations with rule restructuring.
## What level 2 optimizations do?
All level 2 optimizations are dispatched [here](https://github.com/jakubpawlowicz/clean-css/blob/master/lib/optimizer/level-2/optimize.js#L67), and this is what they do:
* `recursivelyOptimizeBlocks` - does all the following operations on a nested block, like `@media` or `@keyframe`;
* `recursivelyOptimizeProperties` - optimizes properties in rulesets and flat at-rules, like @font-face, by splitting them into components (e.g. `margin` into `margin-(bottom|left|right|top)`), optimizing, and restoring them back. You may want to use `mergeIntoShorthands` option to control whether you want to turn multiple components into shorthands;
* `removeDuplicates` - gets rid of duplicate rulesets with exactly the same set of properties, e.g. when including a Sass / Less partial twice for no good reason;
* `mergeAdjacent` - merges adjacent rulesets with the same selector or rules;
* `reduceNonAdjacent` - identifies which properties are overridden in same-selector non-adjacent rulesets, and removes them;
* `mergeNonAdjacentBySelector` - identifies same-selector non-adjacent rulesets which can be moved (!) to be merged, requires all intermediate rulesets to not redefine the moved properties, or if redefined to have the same value;
* `mergeNonAdjacentByBody` - same as the one above but for same-selector non-adjacent rulesets;
* `restructure` - tries to reorganize different-selector different-rules rulesets so they take less space, e.g. `.one{padding:0}.two{margin:0}.one{margin-bottom:3px}` into `.two{margin:0}.one{padding:0;margin-bottom:3px}`;
* `removeDuplicateFontAtRules` - removes duplicated `@font-face` rules;
* `removeDuplicateMediaQueries` - removes duplicated `@media` nested blocks;
* `mergeMediaQueries` - merges non-adjacent `@media` at-rules by the same rules as `mergeNonAdjacentBy*` above;
## How to use clean-css with build tools?
There is a number of 3rd party plugins to popular build tools:
* [Broccoli](https://github.com/broccolijs/broccoli#broccoli): [broccoli-clean-css](https://github.com/shinnn/broccoli-clean-css)
* [Brunch](http://brunch.io/): [clean-css-brunch](https://github.com/brunch/clean-css-brunch)
* [Grunt](http://gruntjs.com): [grunt-contrib-cssmin](https://github.com/gruntjs/grunt-contrib-cssmin)
* [Gulp](http://gulpjs.com/): [gulp-clean-css](https://github.com/scniro/gulp-clean-css)
* [Gulp](http://gulpjs.com/): [using vinyl-map as a wrapper - courtesy of @sogko](https://github.com/jakubpawlowicz/clean-css/issues/342)
* [component-builder2](https://github.com/component/builder2.js): [builder-clean-css](https://github.com/poying/builder-clean-css)
* [Metalsmith](http://metalsmith.io): [metalsmith-clean-css](https://github.com/aymericbeaumet/metalsmith-clean-css)
* [Lasso](https://github.com/lasso-js/lasso): [lasso-clean-css](https://github.com/yomed/lasso-clean-css)
* [Start](https://github.com/start-runner/start): [start-clean-css](https://github.com/start-runner/clean-css)
## How to use clean-css from web browser?
* https://jakubpawlowicz.github.io/clean-css/ (official web interface)
* http://refresh-sf.com/
* http://adamburgess.github.io/clean-css-online/
# Contributing
See [CONTRIBUTING.md](https://github.com/jakubpawlowicz/clean-css/blob/master/CONTRIBUTING.md).
## How to get started?
First clone the sources:
```bash
git clone git@github.com:jakubpawlowicz/clean-css.git
```
then install dependencies:
```bash
cd clean-css
npm install
```
then use any of the following commands to verify your copy:
```bash
npm run bench # for clean-css benchmarks (see [test/bench.js](https://github.com/jakubpawlowicz/clean-css/blob/master/test/bench.js) for details)
npm run browserify # to create the browser-ready clean-css version
npm run check # to lint JS sources with [JSHint](https://github.com/jshint/jshint/)
npm test # to run all tests
```
# Acknowledgments
Sorted alphabetically by GitHub handle:
* [@abarre](https://github.com/abarre) (Anthony Barre) for improvements to `@import` processing;
* [@alexlamsl](https://github.com/alexlamsl) (Alex Lam S.L.) for testing early clean-css 4 versions, reporting bugs, and suggesting numerous improvements.
* [@altschuler](https://github.com/altschuler) (Simon Altschuler) for fixing `@import` processing inside comments;
* [@ben-eb](https://github.com/ben-eb) (Ben Briggs) for sharing ideas about CSS optimizations;
* [@davisjam](https://github.com/davisjam) (Jamie Davis) for disclosing ReDOS vulnerabilities;
* [@facelessuser](https://github.com/facelessuser) (Isaac) for pointing out a flaw in clean-css' stateless mode;
* [@grandrath](https://github.com/grandrath) (Martin Grandrath) for improving `minify` method source traversal in ES6;
* [@jmalonzo](https://github.com/jmalonzo) (Jan Michael Alonzo) for a patch removing node.js' old `sys` package;
* [@lukeapage](https://github.com/lukeapage) (Luke Page) for suggestions and testing the source maps feature;
Plus everyone else involved in [#125](https://github.com/jakubpawlowicz/clean-css/issues/125) for pushing it forward;
* [@madwizard-thomas](https://github.com/madwizard-thomas) for sharing ideas about `@import` inlining and URL rebasing.
* [@ngyikp](https://github.com/ngyikp) (Ng Yik Phang) for testing early clean-css 4 versions, reporting bugs, and suggesting numerous improvements.
* [@wagenet](https://github.com/wagenet) (Peter Wagenet) for suggesting improvements to `@import` inlining behavior;
* [@venemo](https://github.com/venemo) (Timur Kristóf) for an outstanding contribution of advanced property optimizer for 2.2 release;
* [@vvo](https://github.com/vvo) (Vincent Voyer) for a patch with better empty element regex and for inspiring us to do many performance improvements in 0.4 release;
* [@xhmikosr](https://github.com/xhmikosr) for suggesting new features, like option to remove special comments and strip out URLs quotation, and pointing out numerous improvements like JSHint, media queries, etc.
# License
clean-css is released under the [MIT License](https://github.com/jakubpawlowicz/clean-css/blob/master/LICENSE).

View File

@@ -0,0 +1,51 @@
"use strict";
// Dependencies
var parseUrl = require("parse-url"),
isSsh = require("is-ssh");
/**
* gitUp
* Parses the input url.
*
* @name gitUp
* @function
* @param {String} input The input url.
* @return {Object} An object containing the following fields:
*
* - `protocols` (Array): An array with the url protocols (usually it has one element).
* - `port` (null|Number): The domain port.
* - `resource` (String): The url domain (including subdomains).
* - `user` (String): The authentication user (usually for ssh urls).
* - `pathname` (String): The url pathname.
* - `hash` (String): The url hash.
* - `search` (String): The url querystring value.
* - `href` (String): The input url.
* - `protocol` (String): The git url protocol.
* - `token` (String): The oauth token (could appear in the https urls).
*/
function gitUp(input) {
var output = parseUrl(input);
output.token = "";
if (output.password === "x-oauth-basic") {
output.token = output.user;
} else if (output.user === "x-token-auth") {
output.token = output.password;
}
if (isSsh(output.protocols) || output.protocols.length === 0 && isSsh(input)) {
output.protocol = "ssh";
} else if (output.protocols.length) {
output.protocol = output.protocols[0];
} else {
output.protocol = "file";
output.protocols = ["file"];
}
output.href = output.href.replace(/\/$/, "");
return output;
}
module.exports = gitUp;

View File

@@ -0,0 +1,19 @@
"use strict";
var aFrom = require("../array/from")
, assign = require("./assign")
, value = require("./valid-value");
module.exports = function (obj /*, propertyNames, options*/) {
var copy = Object(value(obj)), propertyNames = arguments[1], options = Object(arguments[2]);
if (copy !== obj && !propertyNames) return copy;
var result = {};
if (propertyNames) {
aFrom(propertyNames, function (propertyName) {
if (options.ensure || propertyName in obj) result[propertyName] = obj[propertyName];
});
} else {
assign(result, obj);
}
return result;
};

View File

@@ -0,0 +1,3 @@
"use strict";
module.exports = function () { return typeof Number.EPSILON === "number"; };

View File

@@ -0,0 +1,27 @@
# BigInt
_bigint_ primitive
## `big-int/coerce`
BigInt coercion. If value can be coerced by `BigInt` its result is returned.
For all other values `null` is returned
```javascript
const coerceToBigInt = require("type/big-int/coerce");
coerceToBigInt(12); // 12n
coerceToBigInt(undefined); // null
```
## `big-int/ensure`
If given argument is a _bigint_ coercible value (via [`big-int/coerce`](#big-intcoerce)) returns result bigint.
Otherwise `TypeError` is thrown.
```javascript
const ensureBigInt = require("type/big-int/ensure");
ensureBigInt(12); // 12n
ensureBigInt(null); // Thrown TypeError: null is not a bigint
```

View File

@@ -0,0 +1,58 @@
'use strict';
const {Transform, PassThrough} = require('stream');
const zlib = require('zlib');
const mimicResponse = require('mimic-response');
module.exports = response => {
const contentEncoding = (response.headers['content-encoding'] || '').toLowerCase();
if (!['gzip', 'deflate', 'br'].includes(contentEncoding)) {
return response;
}
// TODO: Remove this when targeting Node.js 12.
const isBrotli = contentEncoding === 'br';
if (isBrotli && typeof zlib.createBrotliDecompress !== 'function') {
response.destroy(new Error('Brotli is not supported on Node.js < 12'));
return response;
}
let isEmpty = true;
const checker = new Transform({
transform(data, _encoding, callback) {
isEmpty = false;
callback(null, data);
},
flush(callback) {
callback();
}
});
const finalStream = new PassThrough({
autoDestroy: false,
destroy(error, callback) {
response.destroy();
callback(error);
}
});
const decompressStream = isBrotli ? zlib.createBrotliDecompress() : zlib.createUnzip();
decompressStream.once('error', error => {
if (isEmpty && !response.readable) {
finalStream.end();
return;
}
finalStream.destroy(error);
});
mimicResponse(response, finalStream);
response.pipe(checker).pipe(decompressStream).pipe(finalStream);
return finalStream;
};

View File

@@ -0,0 +1,55 @@
{
"name": "functions-have-names",
"version": "1.2.3",
"description": "Does this JS environment support the `name` property on functions?",
"main": "index.js",
"scripts": {
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"",
"lint": "eslint --ext=js,mjs .",
"pretest": "npm run lint",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "aud --production"
},
"repository": {
"type": "git",
"url": "git+https://github.com/inspect-js/functions-have-names.git"
},
"keywords": [
"function",
"name",
"es5",
"names",
"functions",
"ie"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/inspect-js/functions-have-names/issues"
},
"homepage": "https://github.com/inspect-js/functions-have-names#readme",
"devDependencies": {
"@ljharb/eslint-config": "^21.0.0",
"aud": "^2.0.0",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.5.3"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
}
}

View File

@@ -0,0 +1,145 @@
/* @prettier */
import { SchedulerLike } from '../types';
import { Observable } from '../Observable';
import { bindCallbackInternals } from './bindCallbackInternals';
export function bindCallback(
callbackFunc: (...args: any[]) => void,
resultSelector: (...args: any[]) => any,
scheduler?: SchedulerLike
): (...args: any[]) => Observable<any>;
// args is the arguments array and we push the callback on the rest tuple since the rest parameter must be last (only item) in a parameter list
export function bindCallback<A extends readonly unknown[], R extends readonly unknown[]>(
callbackFunc: (...args: [...A, (...res: R) => void]) => void,
schedulerLike?: SchedulerLike
): (...arg: A) => Observable<R extends [] ? void : R extends [any] ? R[0] : R>;
/**
* Converts a callback API to a function that returns an Observable.
*
* <span class="informal">Give it a function `f` of type `f(x, callback)` and
* it will return a function `g` that when called as `g(x)` will output an
* Observable.</span>
*
* `bindCallback` is not an operator because its input and output are not
* Observables. The input is a function `func` with some parameters. The
* last parameter must be a callback function that `func` calls when it is
* done.
*
* The output of `bindCallback` is a function that takes the same parameters
* as `func`, except the last one (the callback). When the output function
* is called with arguments it will return an Observable. If function `func`
* calls its callback with one argument, the Observable will emit that value.
* If on the other hand the callback is called with multiple values the resulting
* Observable will emit an array with said values as arguments.
*
* It is **very important** to remember that input function `func` is not called
* when the output function is, but rather when the Observable returned by the output
* function is subscribed. This means if `func` makes an AJAX request, that request
* will be made every time someone subscribes to the resulting Observable, but not before.
*
* The last optional parameter - `scheduler` - can be used to control when the call
* to `func` happens after someone subscribes to Observable, as well as when results
* passed to callback will be emitted. By default, the subscription to an Observable calls `func`
* synchronously, but using {@link asyncScheduler} as the last parameter will defer the call to `func`,
* just like wrapping the call in `setTimeout` with a timeout of `0` would. If you were to use the async Scheduler
* and call `subscribe` on the output Observable, all function calls that are currently executing
* will end before `func` is invoked.
*
* By default, results passed to the callback are emitted immediately after `func` invokes the callback.
* In particular, if the callback is called synchronously, then the subscription of the resulting Observable
* will call the `next` function synchronously as well. If you want to defer that call,
* you may use {@link asyncScheduler} just as before. This means that by using `Scheduler.async` you can
* ensure that `func` always calls its callback asynchronously, thus avoiding terrifying Zalgo.
*
* Note that the Observable created by the output function will always emit a single value
* and then complete immediately. If `func` calls the callback multiple times, values from subsequent
* calls will not appear in the stream. If you need to listen for multiple calls,
* you probably want to use {@link fromEvent} or {@link fromEventPattern} instead.
*
* If `func` depends on some context (`this` property) and is not already bound, the context of `func`
* will be the context that the output function has at call time. In particular, if `func`
* is called as a method of some object and if `func` is not already bound, in order to preserve the context
* it is recommended that the context of the output function is set to that object as well.
*
* If the input function calls its callback in the "node style" (i.e. first argument to callback is
* optional error parameter signaling whether the call failed or not), {@link bindNodeCallback}
* provides convenient error handling and probably is a better choice.
* `bindCallback` will treat such functions the same as any other and error parameters
* (whether passed or not) will always be interpreted as regular callback argument.
*
* ## Examples
*
* ### Convert jQuery's getJSON to an Observable API
* ```ts
* import { bindCallback } from 'rxjs';
* import * as jQuery from 'jquery';
*
* // Suppose we have jQuery.getJSON('/my/url', callback)
* const getJSONAsObservable = bindCallback(jQuery.getJSON);
* const result = getJSONAsObservable('/my/url');
* result.subscribe(x => console.log(x), e => console.error(e));
* ```
*
* ### Receive an array of arguments passed to a callback
* ```ts
* import { bindCallback } from 'rxjs';
*
* const someFunction = (cb) => {
* cb(5, 'some string', {someProperty: 'someValue'})
* };
*
* const boundSomeFunction = bindCallback(someFunction);
* boundSomeFunction(12, 10).subscribe(values => {
* console.log(values); // [22, 2]
* });
* ```
*
* ### Compare behaviour with and without async Scheduler
* ```ts
* import { bindCallback, asyncScheduler } from 'rxjs';
*
* function iCallMyCallbackSynchronously(cb) {
* cb();
* }
*
* const boundSyncFn = bindCallback(iCallMyCallbackSynchronously);
* const boundAsyncFn = bindCallback(iCallMyCallbackSynchronously, null, asyncScheduler);
*
* boundSyncFn().subscribe(() => console.log('I was sync!'));
* boundAsyncFn().subscribe(() => console.log('I was async!'));
* console.log('This happened...');
*
* // Logs:
* // I was sync!
* // This happened...
* // I was async!
* ```
*
* ### Use bindCallback on an object method
* ```ts
* import { bindCallback } from 'rxjs';
*
* const boundMethod = bindCallback(someObject.methodWithCallback);
* boundMethod
* .call(someObject) // make sure methodWithCallback has access to someObject
* .subscribe(subscriber);
* ```
*
* @see {@link bindNodeCallback}
* @see {@link from}
*
* @param {function} func A function with a callback as the last parameter.
* @param {SchedulerLike} [scheduler] The scheduler on which to schedule the
* callbacks.
* @return {function(...params: *): Observable} A function which returns the
* Observable that delivers the same values the callback would deliver.
*/
export function bindCallback(
callbackFunc: (...args: [...any[], (...res: any) => void]) => void,
resultSelector?: ((...args: any[]) => any) | SchedulerLike,
scheduler?: SchedulerLike
): (...args: any[]) => Observable<unknown> {
return bindCallbackInternals(false, callbackFunc, resultSelector, scheduler);
}

View File

@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('eq', require('../eq'));
func.placeholder = require('./placeholder');
module.exports = func;

View File

@@ -0,0 +1,15 @@
import { ObservableInput, SchedulerLike } from '../types';
import { Observable } from '../Observable';
/**
* Converts from a common {@link ObservableInput} type to an observable where subscription and emissions
* are scheduled on the provided scheduler.
*
* @see {@link from}
* @see {@link of}
*
* @param input The observable, array, promise, iterable, etc you would like to schedule
* @param scheduler The scheduler to use to schedule the subscription and emissions from
* the returned observable.
*/
export declare function scheduled<T>(input: ObservableInput<T>, scheduler: SchedulerLike): Observable<T>;
//# sourceMappingURL=scheduled.d.ts.map

View File

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

View File

@@ -0,0 +1,68 @@
const DIRECTIONS = new Set(['normal', 'reverse', 'alternate', 'alternate-reverse'])
const PLAY_STATES = new Set(['running', 'paused'])
const FILL_MODES = new Set(['none', 'forwards', 'backwards', 'both'])
const ITERATION_COUNTS = new Set(['infinite'])
const TIMINGS = new Set([
'linear',
'ease',
'ease-in',
'ease-out',
'ease-in-out',
'step-start',
'step-end',
])
const TIMING_FNS = ['cubic-bezier', 'steps']
const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
const SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
const TIME = /^(-?[\d.]+m?s)$/
const DIGIT = /^(\d+)$/
export default function parseAnimationValue(input) {
let animations = input.split(COMMA)
return animations.map((animation) => {
let value = animation.trim()
let result = { value }
let parts = value.split(SPACE)
let seen = new Set()
for (let part of parts) {
if (!seen.has('DIRECTIONS') && DIRECTIONS.has(part)) {
result.direction = part
seen.add('DIRECTIONS')
} else if (!seen.has('PLAY_STATES') && PLAY_STATES.has(part)) {
result.playState = part
seen.add('PLAY_STATES')
} else if (!seen.has('FILL_MODES') && FILL_MODES.has(part)) {
result.fillMode = part
seen.add('FILL_MODES')
} else if (
!seen.has('ITERATION_COUNTS') &&
(ITERATION_COUNTS.has(part) || DIGIT.test(part))
) {
result.iterationCount = part
seen.add('ITERATION_COUNTS')
} else if (!seen.has('TIMING_FUNCTION') && TIMINGS.has(part)) {
result.timingFunction = part
seen.add('TIMING_FUNCTION')
} else if (!seen.has('TIMING_FUNCTION') && TIMING_FNS.some((f) => part.startsWith(`${f}(`))) {
result.timingFunction = part
seen.add('TIMING_FUNCTION')
} else if (!seen.has('DURATION') && TIME.test(part)) {
result.duration = part
seen.add('DURATION')
} else if (!seen.has('DELAY') && TIME.test(part)) {
result.delay = part
seen.add('DELAY')
} else if (!seen.has('NAME')) {
result.name = part
seen.add('NAME')
} else {
if (!result.unknown) result.unknown = []
result.unknown.push(part)
}
}
return result
})
}

View File

@@ -0,0 +1,7 @@
import { operate } from '../util/lift';
export function subscribeOn(scheduler, delay = 0) {
return operate((source, subscriber) => {
subscriber.add(scheduler.schedule(() => source.subscribe(subscriber), delay));
});
}
//# sourceMappingURL=subscribeOn.js.map

View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/object-inspect
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -0,0 +1,36 @@
/**
Given a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types) return the {@link Primitive | primitive type} it belongs to, or `never` if it's not a primitive.
Use-case: Working with generic types that may be literal types.
@example
```
import type {LiteralToPrimitive} from 'type-fest';
// No overloads needed to get the correct return type
function plus<T extends number | bigint | string>(x: T, y: T): LiteralToPrimitive<T> {
return x + (y as any);
}
plus('a', 'b'); // string
plus(1, 2); // number
plus(1n, 2n); // bigint
```
@category Type
*/
export type LiteralToPrimitive<T> = T extends number
? number
: T extends bigint
? bigint
: T extends string
? string
: T extends boolean
? boolean
: T extends symbol
? symbol
: T extends null
? null
: T extends undefined
? undefined
: never;

View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, /**
* @template {string | import('postcss-selector-parser').Root} T
*
* Prefix all classes in the selector with the given prefix
*
* It can take either a string or a selector AST and will return the same type
*
* @param {string} prefix
* @param {T} selector
* @param {boolean} prependNegative
* @returns {T}
*/ "default", {
enumerable: true,
get: ()=>_default
});
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _default(prefix, selector, prependNegative = false) {
if (prefix === "") {
return selector;
}
let ast = typeof selector === "string" ? (0, _postcssSelectorParser.default)().astSync(selector) : selector;
ast.walkClasses((classSelector)=>{
let baseClass = classSelector.value;
let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith("-");
classSelector.value = shouldPlaceNegativeBeforePrefix ? `-${prefix}${baseClass.slice(1)}` : `${prefix}${baseClass}`;
});
return typeof selector === "string" ? ast.toString() : ast;
}

View File

@@ -0,0 +1,2 @@
if(typeof cptable === 'undefined') cptable = {};
cptable[20924] = (function(){ var d = "ŸŸ\u0002\u0003œ\t†—Ž\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\n\b‡\u0018\u0019’\u001c\u001d\u001e\u001f€‚ƒ„…\u0017\u001bˆ‰Š‹Œ\u0005\u0006\u0007‘\u0016“”•–\u0004˜™š›\u0014\u0015ž\u001a  âäàáãåçñÝ.<(+|&éêëèíîïìß!$*);^-/ÂÄÀÁÃÅÇÑŠ,%_>?øÉÊËÈÍÎÏÌ`:#@'=\"Øabcdefghi«»ðýþ±°jklmnopqrªºæžÆ€µ~stuvwxyz¡¿Ð[Þ®¢£¥·©§¶Œœ<C592>¬š¯]Ž×{ABCDEFGHI­ôöòóõ}JKLMNOPQR¹ûüùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙڟ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();

View File

@@ -0,0 +1 @@
{"version":3,"file":"lift.js","sourceRoot":"","sources":["../../../../src/internal/util/lift.ts"],"names":[],"mappings":";;;AAGA,2CAA0C;AAK1C,SAAgB,OAAO,CAAC,MAAW;IACjC,OAAO,uBAAU,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,CAAC;AAClC,CAAC;AAFD,0BAEC;AAMD,SAAgB,OAAO,CACrB,IAAqF;IAErF,OAAO,UAAC,MAAqB;QAC3B,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;YACnB,OAAO,MAAM,CAAC,IAAI,CAAC,UAA+B,YAA2B;gBAC3E,IAAI;oBACF,OAAO,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;iBACjC;gBAAC,OAAO,GAAG,EAAE;oBACZ,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;iBACjB;YACH,CAAC,CAAC,CAAC;SACJ;QACD,MAAM,IAAI,SAAS,CAAC,wCAAwC,CAAC,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC;AAfD,0BAeC"}