new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
export function not<T>(pred: (value: T, index: number) => boolean, thisArg: any): (value: T, index: number) => boolean {
|
||||
return (value: T, index: number) => !pred.call(thisArg, value, index);
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
degenerator
|
||||
===========
|
||||
### Compiles sync functions into async functions
|
||||
[](https://github.com/TooTallNate/node-degenerator/actions?workflow=Node+CI)
|
||||
|
||||
Sometimes you need to write sync looking code that's really async under the hood.
|
||||
This module takes a String to one or more synchronous JavaScript functions, and
|
||||
returns a new String that with those JS functions transpiled into `async`
|
||||
functions.
|
||||
|
||||
So this:
|
||||
|
||||
```js
|
||||
function foo() {
|
||||
return a('bar') || b();
|
||||
}
|
||||
```
|
||||
|
||||
Gets compiled into:
|
||||
|
||||
```js
|
||||
async function foo() {
|
||||
return await a('bar') || await b();
|
||||
}
|
||||
```
|
||||
|
||||
With the compiled output code, you can evaluate the code using the `vm` module
|
||||
in Node.js, or save the code to a file and require it, or whatever.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Install with `npm`:
|
||||
|
||||
```bash
|
||||
$ npm install degenerator
|
||||
```
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
You must explicitly specify the names of the functions that should be
|
||||
"asyncified". So say we wanted to expose a `get(url)` function that did
|
||||
and HTTP request and returned the response body.
|
||||
|
||||
The user has provided us with this implementation:
|
||||
|
||||
``` js
|
||||
function myFn() {
|
||||
const one = get('https://google.com');
|
||||
const two = get('http://nodejs.org');
|
||||
const three = JSON.parse(get('http://jsonip.org'));
|
||||
return [one, two, three];
|
||||
}
|
||||
```
|
||||
|
||||
Now we can compile this into an asyncronous function, implement the
|
||||
async `get()` function, and finally evaluate it into a real JavaScript function
|
||||
instance with the `vm` module:
|
||||
|
||||
|
||||
```typescript
|
||||
import vm from 'vm';
|
||||
import degenerator from 'degenerator';
|
||||
|
||||
// The `get()` function is Promise-based (error handling omitted for brevity)
|
||||
function get(endpoint: string) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var mod = 0 == endpoint.indexOf('https:') ? require('https') : require('http');
|
||||
var req = mod.get(endpoint);
|
||||
req.on('response', function (res) {
|
||||
var data = '';
|
||||
res.setEncoding('utf8');
|
||||
res.on('data', function (b) { data += b; });
|
||||
res.on('end', function () {
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Convert the JavaScript string provided from the user (assumed to be `str` var)
|
||||
str = degenerator(str, [ 'get' ]);
|
||||
|
||||
// Turn the JS String into a real async function instance
|
||||
const asyncFn = vm.runInNewContext(`(${str})`, { get });
|
||||
|
||||
// Now we can invoke the function asynchronously
|
||||
asyncFn().then((res) => {
|
||||
// Do something with `res`...
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
### degenerator(code: string, names: Array<string|RegExp>, options?: DegeneratorOptions): String
|
||||
|
||||
Returns a "degeneratorified" JavaScript string, with `async`/`await` transplanted.
|
||||
|
||||
#### DegeneratorOptions
|
||||
|
||||
An options object _may_ be passed in as the third parameter, with the following
|
||||
values:
|
||||
|
||||
* `output` - string - May be `"async"` or `"generator"`, defaults to `"async"`.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,9 @@
|
||||
export const getSearch = parsedURL => {
|
||||
if (parsedURL.search) {
|
||||
return parsedURL.search;
|
||||
}
|
||||
|
||||
const lastOffset = parsedURL.href.length - 1;
|
||||
const hash = parsedURL.hash || (parsedURL.href[lastOffset] === '#' ? '#' : '');
|
||||
return parsedURL.href[lastOffset - hash.length] === '?' ? '?' : '';
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
var mockProperty = require('mock-property');
|
||||
|
||||
test('when Object#hasOwnProperty is deleted', function (t) {
|
||||
t.plan(1);
|
||||
var arr = [1, , 3]; // eslint-disable-line no-sparse-arrays
|
||||
|
||||
t.teardown(mockProperty(Array.prototype, 1, { value: 2 })); // this is needed to account for "in" vs "hasOwnProperty"
|
||||
t.teardown(mockProperty(Object.prototype, 'hasOwnProperty', { 'delete': true }));
|
||||
|
||||
t.equal(inspect(arr), '[ 1, , 3 ]');
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")() ? WeakMap : require("./polyfill");
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"graceful-fs","version":"4.2.10","files":{"LICENSE":{"checkedAt":1678883671995,"integrity":"sha512-9S+vcwahUDJag10LNkKQEhRjjiujSahAh3pAf3UyvGorpH9VcaCcy40X7GmpWdU4c3oexWU3nWHgxq23SoRjDQ==","mode":420,"size":791},"clone.js":{"checkedAt":1678883671995,"integrity":"sha512-V/1CyAqNsXJzTKnScDSOspgl5S77BhnVMUkITWzYzbzoFZq8L4mjvBJ6p75E4iO88fQ90PSw3mB97C6AsbWh5A==","mode":420,"size":496},"graceful-fs.js":{"checkedAt":1678883671995,"integrity":"sha512-NsPPfY7vyQZA3QvEg3n4HhlPWWCEhpAD6q3ZXbNJUeahnCAsJEqfOJQEfbCjEnI8of2BcbJ7KbK3j/+HoD8yOQ==","mode":420,"size":12680},"package.json":{"checkedAt":1678883671998,"integrity":"sha512-mue601R4om85m8nx5UEHLeJ+Q5MfKKCSlN5Ol0E6GIZTgpm3JabHRidbuoBuKCyCXsdNf+W9qpB30U3e0yxtow==","mode":420,"size":989},"legacy-streams.js":{"checkedAt":1678883671998,"integrity":"sha512-fJ2pTS2t7K/mDaTHtzmuALFQYQsrXApFRQRTrfkyqFL7ZVEUyycknCHjHCoPZHYFohp/4dBv/3hI6plqNnzZ8g==","mode":420,"size":2655},"polyfills.js":{"checkedAt":1678883671998,"integrity":"sha512-bNMRMbtaxoTY9NwO1MwjwAU67rLK84/5gp3UMTj/Who40f5N00GsKBUhM0ekKMq00fGIkcPypfL9aTbJnIkKiw==","mode":420,"size":10118},"README.md":{"checkedAt":1678883672002,"integrity":"sha512-Q9LFbVsvjJYo7K4jiVV1cq3I1qceERCZ5hixwmj+TyhTF2KCuMOgcVH5WLRuMl0KVho6DJB9ZU3hjf0Wo1pwmw==","mode":420,"size":4741}}}
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 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.
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"windowCount.d.ts","sourceRoot":"","sources":["../../../../src/internal/operators/windowCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,GAAE,MAAU,GAAG,gBAAgB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CA6DnH"}
|
||||
@@ -0,0 +1,92 @@
|
||||
"use strict";
|
||||
/**
|
||||
* True during (or between) the specified time(s).
|
||||
*
|
||||
* Even though the examples don't show it, this parameter may be present in
|
||||
* each of the different parameter profiles, always as the last parameter.
|
||||
*
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* ``` js
|
||||
* timerange(12)
|
||||
* true from noon to 1pm.
|
||||
*
|
||||
* timerange(12, 13)
|
||||
* same as above.
|
||||
*
|
||||
* timerange(12, "GMT")
|
||||
* true from noon to 1pm, in GMT timezone.
|
||||
*
|
||||
* timerange(9, 17)
|
||||
* true from 9am to 5pm.
|
||||
*
|
||||
* timerange(8, 30, 17, 00)
|
||||
* true from 8:30am to 5:00pm.
|
||||
*
|
||||
* timerange(0, 0, 0, 0, 0, 30)
|
||||
* true between midnight and 30 seconds past midnight.
|
||||
* ```
|
||||
*
|
||||
* timeRange(hour)
|
||||
* timeRange(hour1, hour2)
|
||||
* timeRange(hour1, min1, hour2, min2)
|
||||
* timeRange(hour1, min1, sec1, hour2, min2, sec2)
|
||||
* timeRange(hour1, min1, sec1, hour2, min2, sec2, gmt)
|
||||
*
|
||||
* @param {String} hour is the hour from 0 to 23. (0 is midnight, 23 is 11 pm.)
|
||||
* @param {String} min minutes from 0 to 59.
|
||||
* @param {String} sec seconds from 0 to 59.
|
||||
* @param {String} gmt either the string "GMT" for GMT timezone, or not specified, for local timezone.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function timeRange() {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
const args = Array.prototype.slice.call(arguments);
|
||||
const lastArg = args.pop();
|
||||
const useGMTzone = lastArg === 'GMT';
|
||||
const currentDate = new Date();
|
||||
if (!useGMTzone) {
|
||||
args.push(lastArg);
|
||||
}
|
||||
const noOfArgs = args.length;
|
||||
let result = false;
|
||||
let numericArgs = args.map((n) => parseInt(n, 10));
|
||||
// timeRange(hour)
|
||||
if (noOfArgs === 1) {
|
||||
result = getCurrentHour(useGMTzone, currentDate) === numericArgs[0];
|
||||
// timeRange(hour1, hour2)
|
||||
}
|
||||
else if (noOfArgs === 2) {
|
||||
const currentHour = getCurrentHour(useGMTzone, currentDate);
|
||||
result = numericArgs[0] <= currentHour && currentHour < numericArgs[1];
|
||||
// timeRange(hour1, min1, hour2, min2)
|
||||
}
|
||||
else if (noOfArgs === 4) {
|
||||
result = valueInRange(secondsElapsedToday(numericArgs[0], numericArgs[1], 0), secondsElapsedToday(getCurrentHour(useGMTzone, currentDate), getCurrentMinute(useGMTzone, currentDate), 0), secondsElapsedToday(numericArgs[2], numericArgs[3], 59));
|
||||
// timeRange(hour1, min1, sec1, hour2, min2, sec2)
|
||||
}
|
||||
else if (noOfArgs === 6) {
|
||||
result = valueInRange(secondsElapsedToday(numericArgs[0], numericArgs[1], numericArgs[2]), secondsElapsedToday(getCurrentHour(useGMTzone, currentDate), getCurrentMinute(useGMTzone, currentDate), getCurrentSecond(useGMTzone, currentDate)), secondsElapsedToday(numericArgs[3], numericArgs[4], numericArgs[5]));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.default = timeRange;
|
||||
function secondsElapsedToday(hh, mm, ss) {
|
||||
return hh * 3600 + mm * 60 + ss;
|
||||
}
|
||||
function getCurrentHour(gmt, currentDate) {
|
||||
return gmt ? currentDate.getUTCHours() : currentDate.getHours();
|
||||
}
|
||||
function getCurrentMinute(gmt, currentDate) {
|
||||
return gmt ? currentDate.getUTCMinutes() : currentDate.getMinutes();
|
||||
}
|
||||
function getCurrentSecond(gmt, currentDate) {
|
||||
return gmt ? currentDate.getUTCSeconds() : currentDate.getSeconds();
|
||||
}
|
||||
// start <= value <= finish
|
||||
function valueInRange(start, value, finish) {
|
||||
return start <= value && value <= finish;
|
||||
}
|
||||
//# sourceMappingURL=timeRange.js.map
|
||||
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>cloneNodes
|
||||
});
|
||||
function cloneNodes(nodes, source = undefined, raws = undefined) {
|
||||
return nodes.map((node)=>{
|
||||
var _node_raws_tailwind;
|
||||
let cloned = node.clone();
|
||||
// We always want override the source map
|
||||
// except when explicitly told not to
|
||||
let shouldOverwriteSource = ((_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.preserveSource) !== true || !cloned.source;
|
||||
if (source !== undefined && shouldOverwriteSource) {
|
||||
cloned.source = source;
|
||||
if ("walk" in cloned) {
|
||||
cloned.walk((child)=>{
|
||||
child.source = source;
|
||||
});
|
||||
}
|
||||
}
|
||||
if (raws !== undefined) {
|
||||
cloned.raws.tailwind = {
|
||||
...cloned.raws.tailwind,
|
||||
...raws
|
||||
};
|
||||
}
|
||||
return cloned;
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
import {FetchBaseError} from './base.js';
|
||||
|
||||
/**
|
||||
* @typedef {{ address?: string, code: string, dest?: string, errno: number, info?: object, message: string, path?: string, port?: number, syscall: string}} SystemError
|
||||
*/
|
||||
|
||||
/**
|
||||
* FetchError interface for operational errors
|
||||
*/
|
||||
export class FetchError extends FetchBaseError {
|
||||
/**
|
||||
* @param {string} message - Error message for human
|
||||
* @param {string} [type] - Error type for machine
|
||||
* @param {SystemError} [systemError] - For Node.js system error
|
||||
*/
|
||||
constructor(message, type, systemError) {
|
||||
super(message, type);
|
||||
// When err.type is `system`, err.erroredSysCall contains system error and err.code contains system error code
|
||||
if (systemError) {
|
||||
// eslint-disable-next-line no-multi-assign
|
||||
this.code = this.errno = systemError.code;
|
||||
this.erroredSysCall = systemError.syscall;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
var baseFill = require('./_baseFill'),
|
||||
isIterateeCall = require('./_isIterateeCall');
|
||||
|
||||
/**
|
||||
* Fills elements of `array` with `value` from `start` up to, but not
|
||||
* including, `end`.
|
||||
*
|
||||
* **Note:** This method mutates `array`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 3.2.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to fill.
|
||||
* @param {*} value The value to fill `array` with.
|
||||
* @param {number} [start=0] The start position.
|
||||
* @param {number} [end=array.length] The end position.
|
||||
* @returns {Array} Returns `array`.
|
||||
* @example
|
||||
*
|
||||
* var array = [1, 2, 3];
|
||||
*
|
||||
* _.fill(array, 'a');
|
||||
* console.log(array);
|
||||
* // => ['a', 'a', 'a']
|
||||
*
|
||||
* _.fill(Array(3), 2);
|
||||
* // => [2, 2, 2]
|
||||
*
|
||||
* _.fill([4, 6, 8, 10], '*', 1, 3);
|
||||
* // => [4, '*', '*', 10]
|
||||
*/
|
||||
function fill(array, value, start, end) {
|
||||
var length = array == null ? 0 : array.length;
|
||||
if (!length) {
|
||||
return [];
|
||||
}
|
||||
if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
|
||||
start = 0;
|
||||
end = length;
|
||||
}
|
||||
return baseFill(array, value, start, end);
|
||||
}
|
||||
|
||||
module.exports = fill;
|
||||
@@ -0,0 +1,4 @@
|
||||
export type UserIdsNotMatchingError = {
|
||||
name: string;
|
||||
message: string;
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
let promise
|
||||
|
||||
module.exports = typeof queueMicrotask === 'function'
|
||||
? queueMicrotask.bind(typeof window !== 'undefined' ? window : global)
|
||||
// reuse resolved promise, and allocate it lazily
|
||||
: cb => (promise || (promise = Promise.resolve()))
|
||||
.then(cb)
|
||||
.catch(err => setTimeout(() => { throw err }, 0))
|
||||
@@ -0,0 +1,23 @@
|
||||
import { innerFrom } from '../observable/innerFrom';
|
||||
import { operate } from '../util/lift';
|
||||
import { noop } from '../util/noop';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
export function sample(notifier) {
|
||||
return operate(function (source, subscriber) {
|
||||
var hasValue = false;
|
||||
var lastValue = null;
|
||||
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
||||
hasValue = true;
|
||||
lastValue = value;
|
||||
}));
|
||||
innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, function () {
|
||||
if (hasValue) {
|
||||
hasValue = false;
|
||||
var value = lastValue;
|
||||
lastValue = null;
|
||||
subscriber.next(value);
|
||||
}
|
||||
}, noop));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=sample.js.map
|
||||
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.UnsubscriptionError = void 0;
|
||||
var createErrorClass_1 = require("./createErrorClass");
|
||||
exports.UnsubscriptionError = createErrorClass_1.createErrorClass(function (_super) {
|
||||
return function UnsubscriptionErrorImpl(errors) {
|
||||
_super(this);
|
||||
this.message = errors
|
||||
? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
|
||||
: '';
|
||||
this.name = 'UnsubscriptionError';
|
||||
this.errors = errors;
|
||||
};
|
||||
});
|
||||
//# sourceMappingURL=UnsubscriptionError.js.map
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")() ? Math.hypot : require("./shim");
|
||||
@@ -0,0 +1,35 @@
|
||||
var root = require('./_root'),
|
||||
toInteger = require('./toInteger'),
|
||||
toNumber = require('./toNumber'),
|
||||
toString = require('./toString');
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeIsFinite = root.isFinite,
|
||||
nativeMin = Math.min;
|
||||
|
||||
/**
|
||||
* Creates a function like `_.round`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} methodName The name of the `Math` method to use when rounding.
|
||||
* @returns {Function} Returns the new round function.
|
||||
*/
|
||||
function createRound(methodName) {
|
||||
var func = Math[methodName];
|
||||
return function(number, precision) {
|
||||
number = toNumber(number);
|
||||
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
|
||||
if (precision && nativeIsFinite(number)) {
|
||||
// Shift with exponential notation to avoid floating-point issues.
|
||||
// See [MDN](https://mdn.io/round#Examples) for more details.
|
||||
var pair = (toString(number) + 'e').split('e'),
|
||||
value = func(pair[0] + 'e' + (+pair[1] + precision));
|
||||
|
||||
pair = (toString(value) + 'e').split('e');
|
||||
return +(pair[0] + 'e' + (+pair[1] - precision));
|
||||
}
|
||||
return func(number);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = createRound;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"iterator.js","sourceRoot":"","sources":["../../../../src/internal/symbol/iterator.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB;IAC/B,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;QACpD,OAAO,YAAmB,CAAC;KAC5B;IAED,OAAO,MAAM,CAAC,QAAQ,CAAC;AACzB,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAC"}
|
||||
@@ -0,0 +1,25 @@
|
||||
var isObjectLike = require('./isObjectLike'),
|
||||
isPlainObject = require('./isPlainObject');
|
||||
|
||||
/**
|
||||
* Checks if `value` is likely a DOM element.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isElement(document.body);
|
||||
* // => true
|
||||
*
|
||||
* _.isElement('<body>');
|
||||
* // => false
|
||||
*/
|
||||
function isElement(value) {
|
||||
return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
|
||||
}
|
||||
|
||||
module.exports = isElement;
|
||||
@@ -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.00399,"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.03988,"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.00798,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0.00399,"72":0.00798,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.00399,"79":0,"80":0.00399,"81":0.01196,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0.00399,"89":0,"90":0,"91":0,"92":0.07178,"93":0,"94":0,"95":0.00798,"96":0,"97":0.00399,"98":0.00399,"99":0.00399,"100":0,"101":0.00399,"102":0.03988,"103":0.00399,"104":0.00399,"105":0.00399,"106":0.00798,"107":0.05583,"108":0.04387,"109":1.15253,"110":1.10866,"111":0.00798,"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.00399,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0.00399,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0.00798,"44":0,"45":0,"46":0,"47":0.00399,"48":0.00399,"49":0.03988,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0.00798,"56":0,"57":0,"58":0.00399,"59":0,"60":0.01196,"61":0,"62":0,"63":0.00798,"64":0.00399,"65":0.00399,"66":0,"67":0,"68":0,"69":0.00399,"70":0.01196,"71":0,"72":0,"73":0,"74":0.00798,"75":0.08774,"76":0.01196,"77":0,"78":0.00399,"79":0.05184,"80":0.01595,"81":0.01595,"83":0.00399,"84":0.00399,"85":0.01196,"86":0,"87":0.01595,"88":0,"89":0.00399,"90":0,"91":0.00399,"92":0.00399,"93":0.01196,"94":0.01196,"95":0.05583,"96":0.02393,"97":0.00399,"98":0.00399,"99":0.00399,"100":0.00399,"101":0.00399,"102":0.11565,"103":0.0319,"104":0.0997,"105":0.01595,"106":0.02393,"107":0.10768,"108":0.2991,"109":4.5543,"110":2.34494,"111":0,"112":0.00399,"113":0},F:{"9":0,"11":0,"12":0.00399,"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.01196,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0.00399,"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.01196,"62":0,"63":0.01595,"64":0,"65":0,"66":0.01994,"67":0.15952,"68":0,"69":0,"70":0.00399,"71":0,"72":0,"73":0,"74":0.00399,"75":0,"76":0,"77":0,"78":0.00399,"79":0,"80":0,"81":0,"82":0,"83":0.00399,"84":0,"85":0.00399,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.00798,"94":0.21535,"95":0.39481,"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.00798,"15":0,"16":0,"17":0,"18":0.00798,"79":0,"80":0,"81":0,"83":0,"84":0.00399,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.02792,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0.00399,"106":0.00399,"107":0.01196,"108":0.02393,"109":0.77367,"110":0.91724},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00399,"14":0,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0.00399,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0,"13.1":0.01196,"14.1":0.00399,"15.1":0,"15.2-15.3":0,"15.4":0.00399,"15.5":0.00798,"15.6":0.01196,"16.0":0.00399,"16.1":0.00798,"16.2":0.01994,"16.3":0.01994,"16.4":0},G:{"8":0.00234,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0.00234,"6.0-6.1":0.02925,"7.0-7.1":0.06317,"8.1-8.4":0,"9.0-9.2":0.00468,"9.3":0.2562,"10.0-10.2":0,"10.3":0.29715,"11.0-11.2":0.0117,"11.3-11.4":0,"12.0-12.1":0.15325,"12.2-12.5":2.01571,"13.0-13.1":0.01989,"13.2":0.43286,"13.3":0.00585,"13.4-13.7":0.09125,"14.0-14.4":0.34395,"14.5-14.8":0.48316,"15.0-15.1":0.52528,"15.2-15.3":0.20824,"15.4":0.09476,"15.5":0.27375,"15.6":0.4972,"16.0":0.61536,"16.1":0.84231,"16.2":1.4448,"16.3":1.30091,"16.4":0.00468},P:{"4":0.13332,"20":0.1846,"5.0-5.4":0.01026,"6.2-6.4":0,"7.2-7.4":0.02051,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.01026,"12.0":0.01026,"13.0":0.01026,"14.0":0,"15.0":0,"16.0":0,"17.0":0.01026,"18.0":0.01026,"19.0":0.29742},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.0167,"4.2-4.3":0.01909,"4.4":0,"4.4.3-4.4.4":0.2398},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.01196,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0.00601,_:"3.0-3.1"},J:{"7":0,"10":0.00601},O:{"0":0.47495},H:{"0":1.96366},L:{"0":71.43765},R:{_:"0"},M:{"0":0.07214},Q:{"13.1":0.00601}};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defer.js","sourceRoot":"","sources":["../../../../src/internal/observable/defer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAkDxC,MAAM,UAAU,KAAK,CAAiC,iBAA0B;IAC9E,OAAO,IAAI,UAAU,CAAqB,CAAC,UAAU,EAAE,EAAE;QACvD,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/async.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,mDAAkD;AAiDrC,QAAA,cAAc,GAAG,IAAI,+BAAc,CAAC,yBAAW,CAAC,CAAC;AAKjD,QAAA,KAAK,GAAG,sBAAc,CAAC"}
|
||||
@@ -0,0 +1,109 @@
|
||||
import { OperatorFunction, ObservableInput, ObservedValueOf, SubjectLike } from '../types';
|
||||
import { Observable } from '../Observable';
|
||||
import { Subject } from '../Subject';
|
||||
import { innerFrom } from '../observable/innerFrom';
|
||||
import { operate } from '../util/lift';
|
||||
import { fromSubscribable } from '../observable/fromSubscribable';
|
||||
|
||||
/**
|
||||
* An object used to configure {@link connect} operator.
|
||||
*/
|
||||
export interface ConnectConfig<T> {
|
||||
/**
|
||||
* A factory function used to create the Subject through which the source
|
||||
* is multicast. By default, this creates a {@link Subject}.
|
||||
*/
|
||||
connector: () => SubjectLike<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default configuration for `connect`.
|
||||
*/
|
||||
const DEFAULT_CONFIG: ConnectConfig<unknown> = {
|
||||
connector: () => new Subject<unknown>(),
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an observable by multicasting the source within a function that
|
||||
* allows the developer to define the usage of the multicast prior to connection.
|
||||
*
|
||||
* This is particularly useful if the observable source you wish to multicast could
|
||||
* be synchronous or asynchronous. This sets it apart from {@link share}, which, in the
|
||||
* case of totally synchronous sources will fail to share a single subscription with
|
||||
* multiple consumers, as by the time the subscription to the result of {@link share}
|
||||
* has returned, if the source is synchronous its internal reference count will jump from
|
||||
* 0 to 1 back to 0 and reset.
|
||||
*
|
||||
* To use `connect`, you provide a `selector` function that will give you
|
||||
* a multicast observable that is not yet connected. You then use that multicast observable
|
||||
* to create a resulting observable that, when subscribed, will set up your multicast. This is
|
||||
* generally, but not always, accomplished with {@link merge}.
|
||||
*
|
||||
* Note that using a {@link takeUntil} inside of `connect`'s `selector` _might_ mean you were looking
|
||||
* to use the {@link takeWhile} operator instead.
|
||||
*
|
||||
* When you subscribe to the result of `connect`, the `selector` function will be called. After
|
||||
* the `selector` function returns, the observable it returns will be subscribed to, _then_ the
|
||||
* multicast will be connected to the source.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Sharing a totally synchronous observable
|
||||
*
|
||||
* ```ts
|
||||
* import { of, tap, connect, merge, map, filter } from 'rxjs';
|
||||
*
|
||||
* const source$ = of(1, 2, 3, 4, 5).pipe(
|
||||
* tap({
|
||||
* subscribe: () => console.log('subscription started'),
|
||||
* next: n => console.log(`source emitted ${ n }`)
|
||||
* })
|
||||
* );
|
||||
*
|
||||
* source$.pipe(
|
||||
* // Notice in here we're merging 3 subscriptions to `shared$`.
|
||||
* connect(shared$ => merge(
|
||||
* shared$.pipe(map(n => `all ${ n }`)),
|
||||
* shared$.pipe(filter(n => n % 2 === 0), map(n => `even ${ n }`)),
|
||||
* shared$.pipe(filter(n => n % 2 === 1), map(n => `odd ${ n }`))
|
||||
* ))
|
||||
* )
|
||||
* .subscribe(console.log);
|
||||
*
|
||||
* // Expected output: (notice only one subscription)
|
||||
* 'subscription started'
|
||||
* 'source emitted 1'
|
||||
* 'all 1'
|
||||
* 'odd 1'
|
||||
* 'source emitted 2'
|
||||
* 'all 2'
|
||||
* 'even 2'
|
||||
* 'source emitted 3'
|
||||
* 'all 3'
|
||||
* 'odd 3'
|
||||
* 'source emitted 4'
|
||||
* 'all 4'
|
||||
* 'even 4'
|
||||
* 'source emitted 5'
|
||||
* 'all 5'
|
||||
* 'odd 5'
|
||||
* ```
|
||||
*
|
||||
* @param selector A function used to set up the multicast. Gives you a multicast observable
|
||||
* that is not yet connected. With that, you're expected to create and return
|
||||
* and Observable, that when subscribed to, will utilize the multicast observable.
|
||||
* After this function is executed -- and its return value subscribed to -- the
|
||||
* operator will subscribe to the source, and the connection will be made.
|
||||
* @param config The configuration object for `connect`.
|
||||
*/
|
||||
export function connect<T, O extends ObservableInput<unknown>>(
|
||||
selector: (shared: Observable<T>) => O,
|
||||
config: ConnectConfig<T> = DEFAULT_CONFIG
|
||||
): OperatorFunction<T, ObservedValueOf<O>> {
|
||||
const { connector } = config;
|
||||
return operate((source, subscriber) => {
|
||||
const subject = connector();
|
||||
innerFrom(selector(fromSubscribable(subject))).subscribe(subscriber);
|
||||
subscriber.add(source.subscribe(subject));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var gh = require('./');
|
||||
|
||||
if (!process.argv[2]) {
|
||||
process.stderr.write('Error: URL must be provided as first argument\n');
|
||||
process.exit(1);
|
||||
}
|
||||
var res = gh(process.argv[2]);
|
||||
if (res == null) {
|
||||
process.stderr.write('Error: Invalid parameter: ' + process.argv[2] + '\n');
|
||||
process.exit(1);
|
||||
}
|
||||
process.stdout.write(JSON.stringify(res, null, 2) + '\n');
|
||||
@@ -0,0 +1,2 @@
|
||||
var n,t,r,u,o=require("preact"),i=0,f=[],c=[],e=o.options.__b,a=o.options.__r,v=o.options.diffed,l=o.options.__c,s=o.options.unmount;function p(n,r){o.options.__h&&o.options.__h(t,n,i||r),i=0;var u=t.__H||(t.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({__V:c}),u.__[n]}function x(n){return i=1,m(P,n)}function m(r,u,o){var i=p(n++,2);if(i.t=r,!i.__c&&(i.__=[o?o(u):P(void 0,u),function(n){var t=i.__N?i.__N[0]:i.__[0],r=i.t(t,n);t!==r&&(i.__N=[r,i.__[1]],i.__c.setState({}))}],i.__c=t,!t.u)){t.u=!0;var f=t.shouldComponentUpdate;t.shouldComponentUpdate=function(n,t,r){if(!i.__c.__H)return!0;var u=i.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return!n.__N}))return!f||f.call(this,n,t,r);var o=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(o=!0)}}),!(!o&&i.__c.props===n)&&(!f||f.call(this,n,t,r))}}return i.__N||i.__}function d(r,u){var i=p(n++,4);!o.options.__s&&T(i.__H,u)&&(i.__=r,i.o=u,t.__h.push(i))}function y(t,r){var u=p(n++,7);return T(u.__H,r)?(u.__V=t(),u.o=r,u.__h=t,u.__V):u.__}function h(){for(var n;n=f.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(A),n.__H.__h.forEach(F),n.__H.__h=[]}catch(t){n.__H.__h=[],o.options.__e(t,n.__v)}}o.options.__b=function(n){t=null,e&&e(n)},o.options.__r=function(u){a&&a(u),n=0;var o=(t=u.__c).__H;o&&(r===t?(o.__h=[],t.__h=[],o.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.o=void 0})):(o.__h.forEach(A),o.__h.forEach(F),o.__h=[])),r=t},o.options.diffed=function(n){v&&v(n);var i=n.__c;i&&i.__H&&(i.__H.__h.length&&(1!==f.push(i)&&u===o.options.requestAnimationFrame||((u=o.options.requestAnimationFrame)||q)(h)),i.__H.__.forEach(function(n){n.o&&(n.__H=n.o),n.__V!==c&&(n.__=n.__V),n.o=void 0,n.__V=c})),r=t=null},o.options.__c=function(n,t){t.some(function(n){try{n.__h.forEach(A),n.__h=n.__h.filter(function(n){return!n.__||F(n)})}catch(r){t.some(function(n){n.__h&&(n.__h=[])}),t=[],o.options.__e(r,n.__v)}}),l&&l(n,t)},o.options.unmount=function(n){s&&s(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{A(n)}catch(n){t=n}}),r.__H=void 0,t&&o.options.__e(t,r.__v))};var _="function"==typeof requestAnimationFrame;function q(n){var t,r=function(){clearTimeout(u),_&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,100);_&&(t=requestAnimationFrame(r))}function A(n){var r=t,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),t=r}function F(n){var r=t;n.__c=n.__(),t=r}function T(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function P(n,t){return"function"==typeof t?t(n):t}exports.useCallback=function(n,t){return i=8,y(function(){return n},t)},exports.useContext=function(r){var u=t.context[r.__c],o=p(n++,9);return o.c=r,u?(null==o.__&&(o.__=!0,u.sub(t)),u.props.value):r.__},exports.useDebugValue=function(n,t){o.options.useDebugValue&&o.options.useDebugValue(t?t(n):n)},exports.useEffect=function(r,u){var i=p(n++,3);!o.options.__s&&T(i.__H,u)&&(i.__=r,i.o=u,t.__H.__h.push(i))},exports.useErrorBoundary=function(r){var u=p(n++,10),o=x();return u.__=r,t.componentDidCatch||(t.componentDidCatch=function(n,t){u.__&&u.__(n,t),o[1](n)}),[o[0],function(){o[1](void 0)}]},exports.useId=function(){var r=p(n++,11);if(!r.__){for(var u=t.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var o=u.__m||(u.__m=[0,0]);r.__="P"+o[0]+"-"+o[1]++}return r.__},exports.useImperativeHandle=function(n,t,r){i=6,d(function(){return"function"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==r?r:r.concat(n))},exports.useLayoutEffect=d,exports.useMemo=y,exports.useReducer=m,exports.useRef=function(n){return i=5,y(function(){return{current:n}},[])},exports.useState=x;
|
||||
//# sourceMappingURL=hooks.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fromSubscribable.js","sourceRoot":"","sources":["../../../../src/internal/observable/fromSubscribable.ts"],"names":[],"mappings":";;;AAAA,4CAA2C;AAc3C,SAAgB,gBAAgB,CAAI,YAA6B;IAC/D,OAAO,IAAI,uBAAU,CAAC,UAAC,UAAyB,IAAK,OAAA,YAAY,CAAC,SAAS,CAAC,UAAU,CAAC,EAAlC,CAAkC,CAAC,CAAC;AAC3F,CAAC;AAFD,4CAEC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"catchError.js","sourceRoot":"","sources":["../../../../src/internal/operators/catchError.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAoGvC,MAAM,UAAU,UAAU,CACxB,QAAgD;IAEhD,OAAO,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACpC,IAAI,QAAQ,GAAwB,IAAI,CAAC;QACzC,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,aAA6C,CAAC;QAElD,QAAQ,GAAG,MAAM,CAAC,SAAS,CACzB,wBAAwB,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE;YACjE,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACvE,IAAI,QAAQ,EAAE;gBACZ,QAAQ,CAAC,WAAW,EAAE,CAAC;gBACvB,QAAQ,GAAG,IAAI,CAAC;gBAChB,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;aACrC;iBAAM;gBAGL,SAAS,GAAG,IAAI,CAAC;aAClB;QACH,CAAC,CAAC,CACH,CAAC;QAEF,IAAI,SAAS,EAAE;YAMb,QAAQ,CAAC,WAAW,EAAE,CAAC;YACvB,QAAQ,GAAG,IAAI,CAAC;YAChB,aAAc,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;SACtC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,52 @@
|
||||
function partitionRules(root) {
|
||||
if (!root.walkAtRules) return
|
||||
|
||||
let applyParents = new Set()
|
||||
|
||||
root.walkAtRules('apply', (rule) => {
|
||||
applyParents.add(rule.parent)
|
||||
})
|
||||
|
||||
if (applyParents.size === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
for (let rule of applyParents) {
|
||||
let nodeGroups = []
|
||||
let lastGroup = []
|
||||
|
||||
for (let node of rule.nodes) {
|
||||
if (node.type === 'atrule' && node.name === 'apply') {
|
||||
if (lastGroup.length > 0) {
|
||||
nodeGroups.push(lastGroup)
|
||||
lastGroup = []
|
||||
}
|
||||
nodeGroups.push([node])
|
||||
} else {
|
||||
lastGroup.push(node)
|
||||
}
|
||||
}
|
||||
|
||||
if (lastGroup.length > 0) {
|
||||
nodeGroups.push(lastGroup)
|
||||
}
|
||||
|
||||
if (nodeGroups.length === 1) {
|
||||
continue
|
||||
}
|
||||
|
||||
for (let group of [...nodeGroups].reverse()) {
|
||||
let clone = rule.clone({ nodes: [] })
|
||||
clone.append(group)
|
||||
rule.after(clone)
|
||||
}
|
||||
|
||||
rule.remove()
|
||||
}
|
||||
}
|
||||
|
||||
export default function expandApplyAtRules() {
|
||||
return (root) => {
|
||||
partitionRules(root)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"52":0.12074,"60":0.10976,"68":0.02195,"76":0.00549,"78":0.13171,"83":0.01098,"88":0.01098,"91":0.01098,"97":0.01098,"99":0.01646,"100":0.01098,"102":0.1372,"103":0.01098,"104":0.01098,"105":0.01646,"106":0.03842,"107":0.02195,"108":0.89454,"109":3.96234,"110":2.40374,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 61 62 63 64 65 66 67 69 70 71 72 73 74 75 77 79 80 81 82 84 85 86 87 89 90 92 93 94 95 96 98 101 111 112 3.5 3.6"},D:{"49":0.0439,"51":0.03293,"70":0.00549,"78":0.02744,"79":0.03842,"80":0.01098,"81":0.00549,"83":0.02195,"84":0.01098,"85":0.06037,"86":0.01646,"87":0.01646,"88":0.01098,"89":0.02744,"90":0.01098,"91":0.01098,"92":0.08781,"94":0.01098,"96":0.01098,"97":0.02744,"98":0.10427,"99":0.01098,"100":0.02195,"101":0.01098,"102":0.02744,"103":0.10976,"104":0.10427,"105":0.04939,"106":0.06586,"107":0.0933,"108":0.69698,"109":20.22328,"110":13.29742,"111":0.01098,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 71 72 73 74 75 76 77 93 95 112 113"},F:{"28":0.01098,"36":0.00549,"46":0.01646,"49":0.00549,"93":0.12074,"94":1.07565,"95":0.64758,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 47 48 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 9.5-9.6 10.5 10.6 11.1 11.5 11.6 12.1","10.0-10.1":0},B:{"92":0.00549,"98":0.00549,"103":0.01098,"104":0.00549,"105":0.01098,"107":0.05488,"108":0.0933,"109":2.40923,"110":3.08426,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 99 100 101 102 106"},E:{"4":0,"13":0.01646,"14":0.05488,"15":0.01098,_:"0 5 6 7 8 9 10 11 12 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 16.4","12.1":0.01098,"13.1":0.12622,"14.1":0.19757,"15.1":0.01098,"15.2-15.3":0.04939,"15.4":0.05488,"15.5":0.0933,"15.6":0.38965,"16.0":0.12622,"16.1":0.25245,"16.2":0.53234,"16.3":0.55978},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.01332,"10.0-10.2":0,"10.3":0.01211,"11.0-11.2":0.00363,"11.3-11.4":0.00242,"12.0-12.1":0.00847,"12.2-12.5":0.09686,"13.0-13.1":0.00363,"13.2":0.00484,"13.3":0.00726,"13.4-13.7":0.05327,"14.0-14.4":0.14407,"14.5-14.8":0.37653,"15.0-15.1":0.06538,"15.2-15.3":0.08354,"15.4":0.15376,"15.5":0.30025,"15.6":1.07389,"16.0":1.84995,"16.1":3.03765,"16.2":2.54974,"16.3":1.68045,"16.4":0.00969},P:{"4":0.08272,"20":1.05474,"5.0-5.4":0.03048,"6.2-6.4":0.04064,"7.2-7.4":0.26414,"8.2":0.01016,"9.2":0.02068,"10.1":0.03048,"11.1-11.2":0.01034,"12.0":0.03048,"13.0":0.01034,"14.0":0.04136,"15.0":0.03102,"16.0":0.04136,"17.0":0.0517,"18.0":0.12409,"19.0":1.97505},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00376,"4.2-4.3":0.01128,"4.4":0,"4.4.3-4.4.4":0.03009},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"11":0.06586,_:"6 7 8 9 10 5.5"},N:{"10":0.03712,"11":0.07423},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.00903},H:{"0":0.188},L:{"0":30.45174},R:{_:"0"},M:{"0":0.36104},Q:{"13.1":0}};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"lilconfig","version":"2.0.6","files":{"LICENSE":{"checkedAt":1678883673215,"integrity":"sha512-txMJJrZgavEhj/NNGDrQdf6TTioNOY9MLDz5oQSN9g27QsPlawzM72tkT23oYk3CwOG9FRa9Lh8s/3mATJ6N+A==","mode":420,"size":1074},"dist/index.js":{"checkedAt":1678883673215,"integrity":"sha512-7YwTn8k3bWcNbGYrCoc1Ol8N5MlGXkVrxjm4iAPaMBrFIeivrRoGaXEpTnuPqsdYk7mtTWeS1qB0K/QIIorC9g==","mode":420,"size":9524},"package.json":{"checkedAt":1678883673215,"integrity":"sha512-x40SvxV/RudZhnfXPAIm38v6Czq6OBAqHecY7QLExJmxip+3lfMn7b9v4dnlJWafuQBOAmFCFTAsy4Y0n19D/Q==","mode":420,"size":1299},"readme.md":{"checkedAt":1678883673217,"integrity":"sha512-99V7hYbxym4cotq7LyR57ea55R8sdo9FkIreFes87xXvKu2nnAsTs+8sGqS/4mgHysvt8hXpmsj6cXe4iU+E7g==","mode":420,"size":3042},"dist/index.d.ts":{"checkedAt":1678883673217,"integrity":"sha512-SFoYAlA39JjHqb4ilhQ839D5DXcxyzQ1mQFLOBBdrWGioO8TPS50Y0D4TdGJouXYzFJBVlFBi5NO2i2YfXwPcQ==","mode":420,"size":1521}}}
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('commit', require('../commit'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,412 @@
|
||||
import selectorParser from 'postcss-selector-parser'
|
||||
import unescape from 'postcss-selector-parser/dist/util/unesc'
|
||||
import escapeClassName from '../util/escapeClassName'
|
||||
import prefixSelector from '../util/prefixSelector'
|
||||
|
||||
/** @typedef {import('postcss-selector-parser').Root} Root */
|
||||
/** @typedef {import('postcss-selector-parser').Selector} Selector */
|
||||
/** @typedef {import('postcss-selector-parser').Pseudo} Pseudo */
|
||||
/** @typedef {import('postcss-selector-parser').Node} Node */
|
||||
|
||||
/** @typedef {{format: string, isArbitraryVariant: boolean}[]} RawFormats */
|
||||
/** @typedef {import('postcss-selector-parser').Root} ParsedFormats */
|
||||
/** @typedef {RawFormats | ParsedFormats} AcceptedFormats */
|
||||
|
||||
let MERGE = ':merge'
|
||||
|
||||
/**
|
||||
* @param {RawFormats} formats
|
||||
* @param {{context: any, candidate: string, base: string | null}} options
|
||||
* @returns {ParsedFormats | null}
|
||||
*/
|
||||
export function formatVariantSelector(formats, { context, candidate }) {
|
||||
let prefix = context?.tailwindConfig.prefix ?? ''
|
||||
|
||||
// Parse the format selector into an AST
|
||||
let parsedFormats = formats.map((format) => {
|
||||
let ast = selectorParser().astSync(format.format)
|
||||
|
||||
return {
|
||||
...format,
|
||||
ast: format.isArbitraryVariant ? ast : prefixSelector(prefix, ast),
|
||||
}
|
||||
})
|
||||
|
||||
// We start with the candidate selector
|
||||
let formatAst = selectorParser.root({
|
||||
nodes: [
|
||||
selectorParser.selector({
|
||||
nodes: [selectorParser.className({ value: escapeClassName(candidate) })],
|
||||
}),
|
||||
],
|
||||
})
|
||||
|
||||
// And iteratively merge each format selector into the candidate selector
|
||||
for (let { ast } of parsedFormats) {
|
||||
// 1. Handle :merge() special pseudo-class
|
||||
;[formatAst, ast] = handleMergePseudo(formatAst, ast)
|
||||
|
||||
// 2. Merge the format selector into the current selector AST
|
||||
ast.walkNesting((nesting) => nesting.replaceWith(...formatAst.nodes[0].nodes))
|
||||
|
||||
// 3. Keep going!
|
||||
formatAst = ast
|
||||
}
|
||||
|
||||
return formatAst
|
||||
}
|
||||
|
||||
/**
|
||||
* Given any node in a selector this gets the "simple" selector it's a part of
|
||||
* A simple selector is just a list of nodes without any combinators
|
||||
* Technically :is(), :not(), :has(), etc… can have combinators but those are nested
|
||||
* inside the relevant node and won't be picked up so they're fine to ignore
|
||||
*
|
||||
* @param {Node} node
|
||||
* @returns {Node[]}
|
||||
**/
|
||||
function simpleSelectorForNode(node) {
|
||||
/** @type {Node[]} */
|
||||
let nodes = []
|
||||
|
||||
// Walk backwards until we hit a combinator node (or the start)
|
||||
while (node.prev() && node.prev().type !== 'combinator') {
|
||||
node = node.prev()
|
||||
}
|
||||
|
||||
// Now record all non-combinator nodes until we hit one (or the end)
|
||||
while (node && node.type !== 'combinator') {
|
||||
nodes.push(node)
|
||||
node = node.next()
|
||||
}
|
||||
|
||||
return nodes
|
||||
}
|
||||
|
||||
/**
|
||||
* Resorts the nodes in a selector to ensure they're in the correct order
|
||||
* Tags go before classes, and pseudo classes go after classes
|
||||
*
|
||||
* @param {Selector} sel
|
||||
* @returns {Selector}
|
||||
**/
|
||||
function resortSelector(sel) {
|
||||
sel.sort((a, b) => {
|
||||
if (a.type === 'tag' && b.type === 'class') {
|
||||
return -1
|
||||
} else if (a.type === 'class' && b.type === 'tag') {
|
||||
return 1
|
||||
} else if (a.type === 'class' && b.type === 'pseudo' && b.value.startsWith('::')) {
|
||||
return -1
|
||||
} else if (a.type === 'pseudo' && a.value.startsWith('::') && b.type === 'class') {
|
||||
return 1
|
||||
}
|
||||
|
||||
return sel.index(a) - sel.index(b)
|
||||
})
|
||||
|
||||
return sel
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove extraneous selectors that do not include the base class/candidate
|
||||
*
|
||||
* Example:
|
||||
* Given the utility `.a, .b { color: red}`
|
||||
* Given the candidate `sm:b`
|
||||
*
|
||||
* The final selector should be `.sm\:b` and not `.a, .sm\:b`
|
||||
*
|
||||
* @param {Selector} ast
|
||||
* @param {string} base
|
||||
*/
|
||||
export function eliminateIrrelevantSelectors(sel, base) {
|
||||
let hasClassesMatchingCandidate = false
|
||||
|
||||
sel.walk((child) => {
|
||||
if (child.type === 'class' && child.value === base) {
|
||||
hasClassesMatchingCandidate = true
|
||||
return false // Stop walking
|
||||
}
|
||||
})
|
||||
|
||||
if (!hasClassesMatchingCandidate) {
|
||||
sel.remove()
|
||||
}
|
||||
|
||||
// We do NOT recursively eliminate sub selectors that don't have the base class
|
||||
// as this is NOT a safe operation. For example, if we have:
|
||||
// `.space-x-2 > :not([hidden]) ~ :not([hidden])`
|
||||
// We cannot remove the [hidden] from the :not() because it would change the
|
||||
// meaning of the selector.
|
||||
|
||||
// TODO: Can we do this for :matches, :is, and :where?
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} current
|
||||
* @param {AcceptedFormats} formats
|
||||
* @param {{context: any, candidate: string, base: string | null}} options
|
||||
* @returns {string}
|
||||
*/
|
||||
export function finalizeSelector(current, formats, { context, candidate, base }) {
|
||||
let separator = context?.tailwindConfig?.separator ?? ':'
|
||||
|
||||
// Split by the separator, but ignore the separator inside square brackets:
|
||||
//
|
||||
// E.g.: dark:lg:hover:[paint-order:markers]
|
||||
// ┬ ┬ ┬ ┬
|
||||
// │ │ │ ╰── We will not split here
|
||||
// ╰──┴─────┴─────────────── We will split here
|
||||
//
|
||||
base = base ?? candidate.split(new RegExp(`\\${separator}(?![^[]*\\])`)).pop()
|
||||
|
||||
// Parse the selector into an AST
|
||||
let selector = selectorParser().astSync(current)
|
||||
|
||||
// Normalize escaped classes, e.g.:
|
||||
//
|
||||
// The idea would be to replace the escaped `base` in the selector with the
|
||||
// `format`. However, in css you can escape the same selector in a few
|
||||
// different ways. This would result in different strings and therefore we
|
||||
// can't replace it properly.
|
||||
//
|
||||
// base: bg-[rgb(255,0,0)]
|
||||
// base in selector: bg-\\[rgb\\(255\\,0\\,0\\)\\]
|
||||
// escaped base: bg-\\[rgb\\(255\\2c 0\\2c 0\\)\\]
|
||||
//
|
||||
selector.walkClasses((node) => {
|
||||
if (node.raws && node.value.includes(base)) {
|
||||
node.raws.value = escapeClassName(unescape(node.raws.value))
|
||||
}
|
||||
})
|
||||
|
||||
// Remove extraneous selectors that do not include the base candidate
|
||||
selector.each((sel) => eliminateIrrelevantSelectors(sel, base))
|
||||
|
||||
// If there are no formats that means there were no variants added to the candidate
|
||||
// so we can just return the selector as-is
|
||||
let formatAst = Array.isArray(formats)
|
||||
? formatVariantSelector(formats, { context, candidate })
|
||||
: formats
|
||||
|
||||
if (formatAst === null) {
|
||||
return selector.toString()
|
||||
}
|
||||
|
||||
let simpleStart = selectorParser.comment({ value: '/*__simple__*/' })
|
||||
let simpleEnd = selectorParser.comment({ value: '/*__simple__*/' })
|
||||
|
||||
// We can safely replace the escaped base now, since the `base` section is
|
||||
// now in a normalized escaped value.
|
||||
selector.walkClasses((node) => {
|
||||
if (node.value !== base) {
|
||||
return
|
||||
}
|
||||
|
||||
let parent = node.parent
|
||||
let formatNodes = formatAst.nodes[0].nodes
|
||||
|
||||
// Perf optimization: if the parent is a single class we can just replace it and be done
|
||||
if (parent.nodes.length === 1) {
|
||||
node.replaceWith(...formatNodes)
|
||||
return
|
||||
}
|
||||
|
||||
let simpleSelector = simpleSelectorForNode(node)
|
||||
parent.insertBefore(simpleSelector[0], simpleStart)
|
||||
parent.insertAfter(simpleSelector[simpleSelector.length - 1], simpleEnd)
|
||||
|
||||
for (let child of formatNodes) {
|
||||
parent.insertBefore(simpleSelector[0], child.clone())
|
||||
}
|
||||
|
||||
node.remove()
|
||||
|
||||
// Re-sort the simple selector to ensure it's in the correct order
|
||||
simpleSelector = simpleSelectorForNode(simpleStart)
|
||||
let firstNode = parent.index(simpleStart)
|
||||
|
||||
parent.nodes.splice(
|
||||
firstNode,
|
||||
simpleSelector.length,
|
||||
...resortSelector(selectorParser.selector({ nodes: simpleSelector })).nodes
|
||||
)
|
||||
|
||||
simpleStart.remove()
|
||||
simpleEnd.remove()
|
||||
})
|
||||
|
||||
// Remove unnecessary pseudo selectors that we used as placeholders
|
||||
selector.walkPseudos((p) => {
|
||||
if (p.value === MERGE) {
|
||||
p.replaceWith(p.nodes)
|
||||
}
|
||||
})
|
||||
|
||||
// Move pseudo elements to the end of the selector (if necessary)
|
||||
selector.each((sel) => {
|
||||
let pseudoElements = collectPseudoElements(sel)
|
||||
if (pseudoElements.length > 0) {
|
||||
sel.nodes.push(pseudoElements.sort(sortSelector))
|
||||
}
|
||||
})
|
||||
|
||||
return selector.toString()
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Selector} selector
|
||||
* @param {Selector} format
|
||||
*/
|
||||
export function handleMergePseudo(selector, format) {
|
||||
/** @type {{pseudo: Pseudo, value: string}[]} */
|
||||
let merges = []
|
||||
|
||||
// Find all :merge() pseudo-classes in `selector`
|
||||
selector.walkPseudos((pseudo) => {
|
||||
if (pseudo.value === MERGE) {
|
||||
merges.push({
|
||||
pseudo,
|
||||
value: pseudo.nodes[0].toString(),
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// Find all :merge() "attachments" in `format` and attach them to the matching selector in `selector`
|
||||
format.walkPseudos((pseudo) => {
|
||||
if (pseudo.value !== MERGE) {
|
||||
return
|
||||
}
|
||||
|
||||
let value = pseudo.nodes[0].toString()
|
||||
|
||||
// Does `selector` contain a :merge() pseudo-class with the same value?
|
||||
let existing = merges.find((merge) => merge.value === value)
|
||||
|
||||
// Nope so there's nothing to do
|
||||
if (!existing) {
|
||||
return
|
||||
}
|
||||
|
||||
// Everything after `:merge()` up to the next combinator is what is attached to the merged selector
|
||||
let attachments = []
|
||||
let next = pseudo.next()
|
||||
while (next && next.type !== 'combinator') {
|
||||
attachments.push(next)
|
||||
next = next.next()
|
||||
}
|
||||
|
||||
let combinator = next
|
||||
|
||||
existing.pseudo.parent.insertAfter(
|
||||
existing.pseudo,
|
||||
selectorParser.selector({ nodes: attachments.map((node) => node.clone()) })
|
||||
)
|
||||
|
||||
pseudo.remove()
|
||||
attachments.forEach((node) => node.remove())
|
||||
|
||||
// What about this case:
|
||||
// :merge(.group):focus > &
|
||||
// :merge(.group):hover &
|
||||
if (combinator && combinator.type === 'combinator') {
|
||||
combinator.remove()
|
||||
}
|
||||
})
|
||||
|
||||
return [selector, format]
|
||||
}
|
||||
|
||||
// Note: As a rule, double colons (::) should be used instead of a single colon
|
||||
// (:). This distinguishes pseudo-classes from pseudo-elements. However, since
|
||||
// this distinction was not present in older versions of the W3C spec, most
|
||||
// browsers support both syntaxes for the original pseudo-elements.
|
||||
let pseudoElementsBC = [':before', ':after', ':first-line', ':first-letter']
|
||||
|
||||
// These pseudo-elements _can_ be combined with other pseudo selectors AND the order does matter.
|
||||
let pseudoElementExceptions = [
|
||||
'::file-selector-button',
|
||||
|
||||
// Webkit scroll bar pseudo elements can be combined with user-action pseudo classes
|
||||
'::-webkit-scrollbar',
|
||||
'::-webkit-scrollbar-button',
|
||||
'::-webkit-scrollbar-thumb',
|
||||
'::-webkit-scrollbar-track',
|
||||
'::-webkit-scrollbar-track-piece',
|
||||
'::-webkit-scrollbar-corner',
|
||||
'::-webkit-resizer',
|
||||
]
|
||||
|
||||
/**
|
||||
* This will make sure to move pseudo's to the correct spot (the end for
|
||||
* pseudo elements) because otherwise the selector will never work
|
||||
* anyway.
|
||||
*
|
||||
* E.g.:
|
||||
* - `before:hover:text-center` would result in `.before\:hover\:text-center:hover::before`
|
||||
* - `hover:before:text-center` would result in `.hover\:before\:text-center:hover::before`
|
||||
*
|
||||
* `::before:hover` doesn't work, which means that we can make it work for you by flipping the order.
|
||||
*
|
||||
* @param {Selector} selector
|
||||
**/
|
||||
function collectPseudoElements(selector) {
|
||||
/** @type {Node[]} */
|
||||
let nodes = []
|
||||
|
||||
for (let node of selector.nodes) {
|
||||
if (isPseudoElement(node)) {
|
||||
nodes.push(node)
|
||||
selector.removeChild(node)
|
||||
}
|
||||
|
||||
if (node?.nodes) {
|
||||
nodes.push(...collectPseudoElements(node))
|
||||
}
|
||||
}
|
||||
|
||||
return nodes
|
||||
}
|
||||
|
||||
// This will make sure to move pseudo's to the correct spot (the end for
|
||||
// pseudo elements) because otherwise the selector will never work
|
||||
// anyway.
|
||||
//
|
||||
// E.g.:
|
||||
// - `before:hover:text-center` would result in `.before\:hover\:text-center:hover::before`
|
||||
// - `hover:before:text-center` would result in `.hover\:before\:text-center:hover::before`
|
||||
//
|
||||
// `::before:hover` doesn't work, which means that we can make it work
|
||||
// for you by flipping the order.
|
||||
function sortSelector(a, z) {
|
||||
// Both nodes are non-pseudo's so we can safely ignore them and keep
|
||||
// them in the same order.
|
||||
if (a.type !== 'pseudo' && z.type !== 'pseudo') {
|
||||
return 0
|
||||
}
|
||||
|
||||
// If one of them is a combinator, we need to keep it in the same order
|
||||
// because that means it will start a new "section" in the selector.
|
||||
if ((a.type === 'combinator') ^ (z.type === 'combinator')) {
|
||||
return 0
|
||||
}
|
||||
|
||||
// One of the items is a pseudo and the other one isn't. Let's move
|
||||
// the pseudo to the right.
|
||||
if ((a.type === 'pseudo') ^ (z.type === 'pseudo')) {
|
||||
return (a.type === 'pseudo') - (z.type === 'pseudo')
|
||||
}
|
||||
|
||||
// Both are pseudo's, move the pseudo elements (except for
|
||||
// ::file-selector-button) to the right.
|
||||
return isPseudoElement(a) - isPseudoElement(z)
|
||||
}
|
||||
|
||||
function isPseudoElement(node) {
|
||||
if (node.type !== 'pseudo') return false
|
||||
if (pseudoElementExceptions.includes(node.value)) return false
|
||||
|
||||
return node.value.startsWith('::') || pseudoElementsBC.includes(node.value)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
Copyright Google
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,8 @@
|
||||
export default function isPlainObject(value) {
|
||||
if (Object.prototype.toString.call(value) !== '[object Object]') {
|
||||
return false
|
||||
}
|
||||
|
||||
const prototype = Object.getPrototypeOf(value)
|
||||
return prototype === null || prototype === Object.prototype
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import colors from 'picocolors'
|
||||
|
||||
let alreadyShown = new Set()
|
||||
|
||||
function log(type, messages, key) {
|
||||
if (typeof process !== 'undefined' && process.env.JEST_WORKER_ID) return
|
||||
|
||||
if (key && alreadyShown.has(key)) return
|
||||
if (key) alreadyShown.add(key)
|
||||
|
||||
console.warn('')
|
||||
messages.forEach((message) => console.warn(type, '-', message))
|
||||
}
|
||||
|
||||
export function dim(input) {
|
||||
return colors.dim(input)
|
||||
}
|
||||
|
||||
export default {
|
||||
info(key, messages) {
|
||||
log(colors.bold(colors.cyan('info')), ...(Array.isArray(key) ? [key] : [messages, key]))
|
||||
},
|
||||
warn(key, messages) {
|
||||
log(colors.bold(colors.yellow('warn')), ...(Array.isArray(key) ? [key] : [messages, key]))
|
||||
},
|
||||
risk(key, messages) {
|
||||
log(colors.bold(colors.magenta('risk')), ...(Array.isArray(key) ? [key] : [messages, key]))
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")() ? Object.entries : require("./implementation");
|
||||
@@ -0,0 +1,30 @@
|
||||
var isObject = require('./isObject');
|
||||
|
||||
/** Built-in value references. */
|
||||
var objectCreate = Object.create;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.create` without support for assigning
|
||||
* properties to the created object.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} proto The object to inherit from.
|
||||
* @returns {Object} Returns the new object.
|
||||
*/
|
||||
var baseCreate = (function() {
|
||||
function object() {}
|
||||
return function(proto) {
|
||||
if (!isObject(proto)) {
|
||||
return {};
|
||||
}
|
||||
if (objectCreate) {
|
||||
return objectCreate(proto);
|
||||
}
|
||||
object.prototype = proto;
|
||||
var result = new object;
|
||||
object.prototype = undefined;
|
||||
return result;
|
||||
};
|
||||
}());
|
||||
|
||||
module.exports = baseCreate;
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').mapValues;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"argsOrArgArray.js","sourceRoot":"","sources":["../../../../src/internal/util/argsOrArgArray.ts"],"names":[],"mappings":"AAAA,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;AAM1B,MAAM,UAAU,cAAc,CAAI,IAAiB;IACjD,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,IAAY,CAAC;AACzE,CAAC"}
|
||||
@@ -0,0 +1,26 @@
|
||||
var memoize = require('./memoize');
|
||||
|
||||
/** Used as the maximum memoize cache size. */
|
||||
var MAX_MEMOIZE_SIZE = 500;
|
||||
|
||||
/**
|
||||
* A specialized version of `_.memoize` which clears the memoized function's
|
||||
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to have its output memoized.
|
||||
* @returns {Function} Returns the new memoized function.
|
||||
*/
|
||||
function memoizeCapped(func) {
|
||||
var result = memoize(func, function(key) {
|
||||
if (cache.size === MAX_MEMOIZE_SIZE) {
|
||||
cache.clear();
|
||||
}
|
||||
return key;
|
||||
});
|
||||
|
||||
var cache = result.cache;
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = memoizeCapped;
|
||||
@@ -0,0 +1,25 @@
|
||||
module.exports = {
|
||||
'after': require('./after'),
|
||||
'ary': require('./ary'),
|
||||
'before': require('./before'),
|
||||
'bind': require('./bind'),
|
||||
'bindKey': require('./bindKey'),
|
||||
'curry': require('./curry'),
|
||||
'curryRight': require('./curryRight'),
|
||||
'debounce': require('./debounce'),
|
||||
'defer': require('./defer'),
|
||||
'delay': require('./delay'),
|
||||
'flip': require('./flip'),
|
||||
'memoize': require('./memoize'),
|
||||
'negate': require('./negate'),
|
||||
'once': require('./once'),
|
||||
'overArgs': require('./overArgs'),
|
||||
'partial': require('./partial'),
|
||||
'partialRight': require('./partialRight'),
|
||||
'rearg': require('./rearg'),
|
||||
'rest': require('./rest'),
|
||||
'spread': require('./spread'),
|
||||
'throttle': require('./throttle'),
|
||||
'unary': require('./unary'),
|
||||
'wrap': require('./wrap')
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
Methods to exclude.
|
||||
*/
|
||||
type ArrayLengthMutationKeys = 'splice' | 'push' | 'pop' | 'shift' | 'unshift';
|
||||
|
||||
/**
|
||||
Create a type that represents an array of the given type and length. The array's length and the `Array` prototype methods that manipulate its length are excluded in the resulting type.
|
||||
|
||||
Please participate in [this issue](https://github.com/microsoft/TypeScript/issues/26223) if you want to have a similiar type built into TypeScript.
|
||||
|
||||
Use-cases:
|
||||
- Declaring fixed-length tuples or arrays with a large number of items.
|
||||
- Creating a range union (for example, `0 | 1 | 2 | 3 | 4` from the keys of such a type) without having to resort to recursive types.
|
||||
- Creating an array of coordinates with a static length, for example, length of 3 for a 3D vector.
|
||||
|
||||
@example
|
||||
```
|
||||
import {FixedLengthArray} from 'type-fest';
|
||||
|
||||
type FencingTeam = FixedLengthArray<string, 3>;
|
||||
|
||||
const guestFencingTeam: FencingTeam = ['Josh', 'Michael', 'Robert'];
|
||||
|
||||
const homeFencingTeam: FencingTeam = ['George', 'John'];
|
||||
//=> error TS2322: Type string[] is not assignable to type 'FencingTeam'
|
||||
|
||||
guestFencingTeam.push('Sam');
|
||||
//=> error TS2339: Property 'push' does not exist on type 'FencingTeam'
|
||||
```
|
||||
|
||||
@category Utilities
|
||||
*/
|
||||
export type FixedLengthArray<Element, Length extends number, ArrayPrototype = [Element, ...Element[]]> = Pick<
|
||||
ArrayPrototype,
|
||||
Exclude<keyof ArrayPrototype, ArrayLengthMutationKeys>
|
||||
> & {
|
||||
[index: number]: Element;
|
||||
[Symbol.iterator]: () => IterableIterator<Element>;
|
||||
readonly length: Length;
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
// TODO; semver-major: remove
|
||||
|
||||
module.exports = require('call-bind');
|
||||
@@ -0,0 +1,255 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for dataClean.ts</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="prettify.css" />
|
||||
<link rel="stylesheet" href="base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="index.html">All files</a> dataClean.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>7/7</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">75% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>3/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>1/1</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>7/7</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">135x</span>
|
||||
<span class="cline-any cline-yes">135x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">135x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">135x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">14x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">135x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { ParseRuntime } from "./ParseRuntime";
|
||||
import stripBom from "strip-bom";
|
||||
/**
|
||||
* For each data chunk coming to parser:
|
||||
* 1. append the data to the buffer that is left from last chunk
|
||||
* 2. check if utf8 chars being split, if does, stripe the bytes and add to left buffer.
|
||||
* 3. stripBom
|
||||
*/
|
||||
export function prepareData(chunk: Buffer, runtime: ParseRuntime): string {
|
||||
const workChunk = concatLeftChunk(chunk, runtime);
|
||||
runtime.csvLineBuffer = undefined;
|
||||
const cleanCSVString = cleanUtf8Split(workChunk, runtime).toString("utf8");
|
||||
if (runtime.started === false) {
|
||||
return stripBom(cleanCSVString);
|
||||
} else {
|
||||
return cleanCSVString;
|
||||
}
|
||||
}<span class="missing-if-branch" title="if path not taken" >I</span>
|
||||
/**
|
||||
* append data to buffer that is left form last chunk
|
||||
*/
|
||||
function concatLeftChunk(chunk: Buffer, runtime: ParseRuntime): Buffer {
|
||||
if (runtime.csvLineBuffer && runtime.csvLineBuffer.length > 0) {
|
||||
return Buffer.concat([runtime.csvLineBuffer, chunk]);
|
||||
} else {
|
||||
return chunk;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* check if utf8 chars being split, if does, stripe the bytes and add to left buffer.
|
||||
*/
|
||||
function cleanUtf8Split(chunk: Buffer, runtime: ParseRuntime): Buffer {
|
||||
let idx = chunk.length - 1;
|
||||
/**
|
||||
* From Keyang:
|
||||
* The code below is to check if a single utf8 char (which could be multiple bytes) being split.
|
||||
* If the char being split, the buffer from two chunk needs to be concat
|
||||
* check how utf8 being encoded to understand the code below.
|
||||
* If anyone has any better way to do this, please let me know.
|
||||
*/
|
||||
if ((chunk[idx] & 1 << 7) != 0) {
|
||||
while ((chunk[idx] & 3 << 6) === 128) {
|
||||
idx--;
|
||||
}
|
||||
idx--;
|
||||
}
|
||||
if (idx != chunk.length - 1) {
|
||||
runtime.csvLineBuffer = chunk.slice(idx + 1);
|
||||
return chunk.slice(0, idx + 1)
|
||||
// var _cb=cb;
|
||||
// var self=this;
|
||||
// cb=function(){
|
||||
// if (self._csvLineBuffer){
|
||||
// self._csvLineBuffer=Buffer.concat([bufFromString(self._csvLineBuffer,"utf8"),left]);
|
||||
// }else{
|
||||
// self._csvLineBuffer=left;
|
||||
// }
|
||||
// _cb();
|
||||
// }
|
||||
} else {
|
||||
return chunk;
|
||||
}
|
||||
}</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Thu May 17 2018 01:25:26 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="sorter.js"></script>
|
||||
<script src="block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user