new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-present, Jon Schlinkert.
|
||||
|
||||
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 @@
|
||||
module.exports={A:{A:{"1":"F A B","2":"J D E CC"},B:{"1":"C K L G M N O P Q R 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"},C:{"1":"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 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 tB EC","36":"FC"},D:{"1":"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 WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R 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 GC","516":"I v J D E F A B C K L"},E:{"1":"D E F A B C K L G KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","772":"I v J HC zB IC JC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C 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 ZB aB bB cB dB 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 RC SC qB AC TC rB","2":"F PC","36":"QC"},G:{"1":"E XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","4":"zB UC BC WC","516":"VC"},H:{"132":"oC"},I:{"1":"f tC uC","36":"pC","516":"tB I sC BC","548":"qC rC"},J:{"1":"D A"},K:{"1":"A B C h qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:4,C:"CSS3 Background-image options"};
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Base Storage class. All storage implementation must inherit this class
|
||||
*/
|
||||
import { TData } from '../types';
|
||||
declare abstract class Storage<I> {
|
||||
/**
|
||||
* Returns all rows based on ...args
|
||||
* @param args
|
||||
*/
|
||||
abstract get(...args: any[]): Promise<StorageResponse>;
|
||||
/**
|
||||
* To set all rows
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
set?(data: I | Function): this;
|
||||
}
|
||||
export interface StorageResponse {
|
||||
data: TData;
|
||||
total: number;
|
||||
}
|
||||
export default Storage;
|
||||
@@ -0,0 +1,33 @@
|
||||
var baseIsEqual = require('./_baseIsEqual'),
|
||||
get = require('./get'),
|
||||
hasIn = require('./hasIn'),
|
||||
isKey = require('./_isKey'),
|
||||
isStrictComparable = require('./_isStrictComparable'),
|
||||
matchesStrictComparable = require('./_matchesStrictComparable'),
|
||||
toKey = require('./_toKey');
|
||||
|
||||
/** Used to compose bitmasks for value comparisons. */
|
||||
var COMPARE_PARTIAL_FLAG = 1,
|
||||
COMPARE_UNORDERED_FLAG = 2;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} path The path of the property to get.
|
||||
* @param {*} srcValue The value to match.
|
||||
* @returns {Function} Returns the new spec function.
|
||||
*/
|
||||
function baseMatchesProperty(path, srcValue) {
|
||||
if (isKey(path) && isStrictComparable(srcValue)) {
|
||||
return matchesStrictComparable(toKey(path), srcValue);
|
||||
}
|
||||
return function(object) {
|
||||
var objValue = get(object, path);
|
||||
return (objValue === undefined && objValue === srcValue)
|
||||
? hasIn(object, path)
|
||||
: baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = baseMatchesProperty;
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Espen Hovlandsdal
|
||||
|
||||
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 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"P Q R 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","2":"C K L G M N O"},C:{"1":"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":"0 1 2 3 4 5 6 7 8 9 DC 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 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 hB iB jB EC FC"},D:{"1":"MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R 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 GC","2":"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","194":"JB KB LB"},E:{"1":"sB 6B 7B 8B 9B OC","2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B"},F:{"1":"9 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 ZB aB bB cB dB 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","2":"0 1 2 3 4 5 F B C G M N O w g x y z PC QC RC SC qB AC TC rB","194":"6 7 8"},G:{"1":"sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","2":"I"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"BD","2":"AD"}},B:5,C:"CSS Motion Path"};
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"cross-spawn","version":"7.0.3","files":{"LICENSE":{"checkedAt":1678883670656,"integrity":"sha512-sdx6Wb/15kFQa2MCaz8/0HBqj6vEfWp8uQRPYPF+ab8n+qOh1BsOtT3JBVtWCCzcDA5BnrgK7dL27+cCD192LQ==","mode":420,"size":1105},"lib/util/escape.js":{"checkedAt":1678883670656,"integrity":"sha512-FzlWsM9dogBMhOEolrpyYqgW58XSnWMBSzlW9eYOZhw5fnHYz55kBI4UTQLT8SlKn1hogXm/d/OVf2slsuvUGA==","mode":420,"size":1172},"lib/enoent.js":{"checkedAt":1678883670656,"integrity":"sha512-8Y7bZtL2oy4AOiiB1eIe96uyX/DAnycKpfJb/S+eZSW+rdXy5ZmMzWvcy+rgzTv1vha6U0SCGDQQVSNEqGeKCw==","mode":420,"size":1480},"index.js":{"checkedAt":1678883670656,"integrity":"sha512-3t1JwevJilhaGp18WKxElPuWYs+HtJtp/ymjL2r1iRI6fwEsnBXoniM02VG7Twlorp7A816DJIawemVcyLhvyg==","mode":420,"size":1192},"lib/parse.js":{"checkedAt":1678883670656,"integrity":"sha512-YC+tSB6G2YG43fn/1JFJa/mXBdCcLIUJeC678EKPQBPPOp3gy2cHPwgSGyhEYS90zQR+/wd+lEDaCpEMsa7o9g==","mode":420,"size":3065},"lib/util/readShebang.js":{"checkedAt":1678883670656,"integrity":"sha512-RYd3aNSqwCM772XDLLuMsNNxUaI0KPcXREssK3GznxsGJSLW/4o9xEMuP2PfZqVa5ylX7FUlyJzhAnh3X4Yryw==","mode":420,"size":549},"lib/util/resolveCommand.js":{"checkedAt":1678883670656,"integrity":"sha512-T72oZ1h7imJm+BH1N6SjeK3BfdS//DwPLGTCnhzlKg0VDeT9aJVrIF5hSZy5akyhisQvSVNplIgEzMx8qxPCBw==","mode":420,"size":1557},"CHANGELOG.md":{"checkedAt":1678883670657,"integrity":"sha512-0XqOK077dhHgte1pqVjgUzxmzyGdXZYGCBdBAHUDxDkvXzoroNOp+Mr0xOyRMSKWP+rMcINqIwv04OtTZt99iA==","mode":420,"size":4704},"package.json":{"checkedAt":1678883670657,"integrity":"sha512-+fDColcyfwSrHQaDkGiGZ1VlNWbkAeIzS8/AOwL92LpQKppUVWyDXjHagfItFgkaCg1G605VCynhtRzB9OjfIA==","mode":420,"size":1655},"README.md":{"checkedAt":1678883670657,"integrity":"sha512-xHV+p4rnXAPIemcDlq+eUtqyoqhRgEBDEGYXD6n1iD1JXClD9CT1qMz4XLaNlr6DYNd4r7NrMmfW+bc9TXDQ4w==","mode":420,"size":4728}}}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"G M N O P Q R 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","2":"C K","194":"L"},C:{"1":"SB TB UB VB WB XB YB uB ZB vB aB bB cB dB 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":"0 1 2 3 4 5 6 7 8 9 DC 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 HB IB JB KB LB MB NB OB PB QB RB EC FC"},D:{"1":"VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R 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 GC","2":"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"},E:{"1":"B C K L G qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E F A HC zB IC JC KC LC","514":"0B"},F:{"1":"IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB 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","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB PC QC RC SC qB AC TC rB"},G:{"1":"dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC ZC aC bC","514":"cC"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","2":"I wC"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"BD","2":"AD"}},B:6,C:"Async functions"};
|
||||
@@ -0,0 +1,268 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const childProcess = require('child_process');
|
||||
const crossSpawn = require('cross-spawn');
|
||||
const stripFinalNewline = require('strip-final-newline');
|
||||
const npmRunPath = require('npm-run-path');
|
||||
const onetime = require('onetime');
|
||||
const makeError = require('./lib/error');
|
||||
const normalizeStdio = require('./lib/stdio');
|
||||
const {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} = require('./lib/kill');
|
||||
const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = require('./lib/stream');
|
||||
const {mergePromise, getSpawnedPromise} = require('./lib/promise');
|
||||
const {joinCommand, parseCommand, getEscapedCommand} = require('./lib/command');
|
||||
|
||||
const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;
|
||||
|
||||
const getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) => {
|
||||
const env = extendEnv ? {...process.env, ...envOption} : envOption;
|
||||
|
||||
if (preferLocal) {
|
||||
return npmRunPath.env({env, cwd: localDir, execPath});
|
||||
}
|
||||
|
||||
return env;
|
||||
};
|
||||
|
||||
const handleArguments = (file, args, options = {}) => {
|
||||
const parsed = crossSpawn._parse(file, args, options);
|
||||
file = parsed.command;
|
||||
args = parsed.args;
|
||||
options = parsed.options;
|
||||
|
||||
options = {
|
||||
maxBuffer: DEFAULT_MAX_BUFFER,
|
||||
buffer: true,
|
||||
stripFinalNewline: true,
|
||||
extendEnv: true,
|
||||
preferLocal: false,
|
||||
localDir: options.cwd || process.cwd(),
|
||||
execPath: process.execPath,
|
||||
encoding: 'utf8',
|
||||
reject: true,
|
||||
cleanup: true,
|
||||
all: false,
|
||||
windowsHide: true,
|
||||
...options
|
||||
};
|
||||
|
||||
options.env = getEnv(options);
|
||||
|
||||
options.stdio = normalizeStdio(options);
|
||||
|
||||
if (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {
|
||||
// #116
|
||||
args.unshift('/q');
|
||||
}
|
||||
|
||||
return {file, args, options, parsed};
|
||||
};
|
||||
|
||||
const handleOutput = (options, value, error) => {
|
||||
if (typeof value !== 'string' && !Buffer.isBuffer(value)) {
|
||||
// When `execa.sync()` errors, we normalize it to '' to mimic `execa()`
|
||||
return error === undefined ? undefined : '';
|
||||
}
|
||||
|
||||
if (options.stripFinalNewline) {
|
||||
return stripFinalNewline(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
const execa = (file, args, options) => {
|
||||
const parsed = handleArguments(file, args, options);
|
||||
const command = joinCommand(file, args);
|
||||
const escapedCommand = getEscapedCommand(file, args);
|
||||
|
||||
validateTimeout(parsed.options);
|
||||
|
||||
let spawned;
|
||||
try {
|
||||
spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);
|
||||
} catch (error) {
|
||||
// Ensure the returned error is always both a promise and a child process
|
||||
const dummySpawned = new childProcess.ChildProcess();
|
||||
const errorPromise = Promise.reject(makeError({
|
||||
error,
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
all: '',
|
||||
command,
|
||||
escapedCommand,
|
||||
parsed,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false
|
||||
}));
|
||||
return mergePromise(dummySpawned, errorPromise);
|
||||
}
|
||||
|
||||
const spawnedPromise = getSpawnedPromise(spawned);
|
||||
const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
|
||||
const processDone = setExitHandler(spawned, parsed.options, timedPromise);
|
||||
|
||||
const context = {isCanceled: false};
|
||||
|
||||
spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
|
||||
spawned.cancel = spawnedCancel.bind(null, spawned, context);
|
||||
|
||||
const handlePromise = async () => {
|
||||
const [{error, exitCode, signal, timedOut}, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
|
||||
const stdout = handleOutput(parsed.options, stdoutResult);
|
||||
const stderr = handleOutput(parsed.options, stderrResult);
|
||||
const all = handleOutput(parsed.options, allResult);
|
||||
|
||||
if (error || exitCode !== 0 || signal !== null) {
|
||||
const returnedError = makeError({
|
||||
error,
|
||||
exitCode,
|
||||
signal,
|
||||
stdout,
|
||||
stderr,
|
||||
all,
|
||||
command,
|
||||
escapedCommand,
|
||||
parsed,
|
||||
timedOut,
|
||||
isCanceled: context.isCanceled,
|
||||
killed: spawned.killed
|
||||
});
|
||||
|
||||
if (!parsed.options.reject) {
|
||||
return returnedError;
|
||||
}
|
||||
|
||||
throw returnedError;
|
||||
}
|
||||
|
||||
return {
|
||||
command,
|
||||
escapedCommand,
|
||||
exitCode: 0,
|
||||
stdout,
|
||||
stderr,
|
||||
all,
|
||||
failed: false,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false
|
||||
};
|
||||
};
|
||||
|
||||
const handlePromiseOnce = onetime(handlePromise);
|
||||
|
||||
handleInput(spawned, parsed.options.input);
|
||||
|
||||
spawned.all = makeAllStream(spawned, parsed.options);
|
||||
|
||||
return mergePromise(spawned, handlePromiseOnce);
|
||||
};
|
||||
|
||||
module.exports = execa;
|
||||
|
||||
module.exports.sync = (file, args, options) => {
|
||||
const parsed = handleArguments(file, args, options);
|
||||
const command = joinCommand(file, args);
|
||||
const escapedCommand = getEscapedCommand(file, args);
|
||||
|
||||
validateInputSync(parsed.options);
|
||||
|
||||
let result;
|
||||
try {
|
||||
result = childProcess.spawnSync(parsed.file, parsed.args, parsed.options);
|
||||
} catch (error) {
|
||||
throw makeError({
|
||||
error,
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
all: '',
|
||||
command,
|
||||
escapedCommand,
|
||||
parsed,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false
|
||||
});
|
||||
}
|
||||
|
||||
const stdout = handleOutput(parsed.options, result.stdout, result.error);
|
||||
const stderr = handleOutput(parsed.options, result.stderr, result.error);
|
||||
|
||||
if (result.error || result.status !== 0 || result.signal !== null) {
|
||||
const error = makeError({
|
||||
stdout,
|
||||
stderr,
|
||||
error: result.error,
|
||||
signal: result.signal,
|
||||
exitCode: result.status,
|
||||
command,
|
||||
escapedCommand,
|
||||
parsed,
|
||||
timedOut: result.error && result.error.code === 'ETIMEDOUT',
|
||||
isCanceled: false,
|
||||
killed: result.signal !== null
|
||||
});
|
||||
|
||||
if (!parsed.options.reject) {
|
||||
return error;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
return {
|
||||
command,
|
||||
escapedCommand,
|
||||
exitCode: 0,
|
||||
stdout,
|
||||
stderr,
|
||||
failed: false,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.command = (command, options) => {
|
||||
const [file, ...args] = parseCommand(command);
|
||||
return execa(file, args, options);
|
||||
};
|
||||
|
||||
module.exports.commandSync = (command, options) => {
|
||||
const [file, ...args] = parseCommand(command);
|
||||
return execa.sync(file, args, options);
|
||||
};
|
||||
|
||||
module.exports.node = (scriptPath, args, options = {}) => {
|
||||
if (args && !Array.isArray(args) && typeof args === 'object') {
|
||||
options = args;
|
||||
args = [];
|
||||
}
|
||||
|
||||
const stdio = normalizeStdio.node(options);
|
||||
const defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));
|
||||
|
||||
const {
|
||||
nodePath = process.execPath,
|
||||
nodeOptions = defaultExecArgv
|
||||
} = options;
|
||||
|
||||
return execa(
|
||||
nodePath,
|
||||
[
|
||||
...nodeOptions,
|
||||
scriptPath,
|
||||
...(Array.isArray(args) ? args : [])
|
||||
],
|
||||
{
|
||||
...options,
|
||||
stdin: undefined,
|
||||
stdout: undefined,
|
||||
stderr: undefined,
|
||||
stdio,
|
||||
shell: false
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,191 @@
|
||||
declare module 'path/posix' {
|
||||
import path = require('path');
|
||||
export = path;
|
||||
}
|
||||
declare module 'path/win32' {
|
||||
import path = require('path');
|
||||
export = path;
|
||||
}
|
||||
/**
|
||||
* The `path` module provides utilities for working with file and directory paths.
|
||||
* It can be accessed using:
|
||||
*
|
||||
* ```js
|
||||
* const path = require('path');
|
||||
* ```
|
||||
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/path.js)
|
||||
*/
|
||||
declare module 'path' {
|
||||
namespace path {
|
||||
/**
|
||||
* A parsed path object generated by path.parse() or consumed by path.format().
|
||||
*/
|
||||
interface ParsedPath {
|
||||
/**
|
||||
* The root of the path such as '/' or 'c:\'
|
||||
*/
|
||||
root: string;
|
||||
/**
|
||||
* The full directory path such as '/home/user/dir' or 'c:\path\dir'
|
||||
*/
|
||||
dir: string;
|
||||
/**
|
||||
* The file name including extension (if any) such as 'index.html'
|
||||
*/
|
||||
base: string;
|
||||
/**
|
||||
* The file extension (if any) such as '.html'
|
||||
*/
|
||||
ext: string;
|
||||
/**
|
||||
* The file name without extension (if any) such as 'index'
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
interface FormatInputPathObject {
|
||||
/**
|
||||
* The root of the path such as '/' or 'c:\'
|
||||
*/
|
||||
root?: string | undefined;
|
||||
/**
|
||||
* The full directory path such as '/home/user/dir' or 'c:\path\dir'
|
||||
*/
|
||||
dir?: string | undefined;
|
||||
/**
|
||||
* The file name including extension (if any) such as 'index.html'
|
||||
*/
|
||||
base?: string | undefined;
|
||||
/**
|
||||
* The file extension (if any) such as '.html'
|
||||
*/
|
||||
ext?: string | undefined;
|
||||
/**
|
||||
* The file name without extension (if any) such as 'index'
|
||||
*/
|
||||
name?: string | undefined;
|
||||
}
|
||||
interface PlatformPath {
|
||||
/**
|
||||
* Normalize a string path, reducing '..' and '.' parts.
|
||||
* When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.
|
||||
*
|
||||
* @param path string path to normalize.
|
||||
* @throws {TypeError} if `path` is not a string.
|
||||
*/
|
||||
normalize(path: string): string;
|
||||
/**
|
||||
* Join all arguments together and normalize the resulting path.
|
||||
*
|
||||
* @param paths paths to join.
|
||||
* @throws {TypeError} if any of the path segments is not a string.
|
||||
*/
|
||||
join(...paths: string[]): string;
|
||||
/**
|
||||
* The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
|
||||
*
|
||||
* Starting from leftmost {from} parameter, resolves {to} to an absolute path.
|
||||
*
|
||||
* If {to} isn't already absolute, {from} arguments are prepended in right to left order,
|
||||
* until an absolute path is found. If after using all {from} paths still no absolute path is found,
|
||||
* the current working directory is used as well. The resulting path is normalized,
|
||||
* and trailing slashes are removed unless the path gets resolved to the root directory.
|
||||
*
|
||||
* @param paths A sequence of paths or path segments.
|
||||
* @throws {TypeError} if any of the arguments is not a string.
|
||||
*/
|
||||
resolve(...paths: string[]): string;
|
||||
/**
|
||||
* Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
|
||||
*
|
||||
* If the given {path} is a zero-length string, `false` will be returned.
|
||||
*
|
||||
* @param path path to test.
|
||||
* @throws {TypeError} if `path` is not a string.
|
||||
*/
|
||||
isAbsolute(path: string): boolean;
|
||||
/**
|
||||
* Solve the relative path from {from} to {to} based on the current working directory.
|
||||
* At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
|
||||
*
|
||||
* @throws {TypeError} if either `from` or `to` is not a string.
|
||||
*/
|
||||
relative(from: string, to: string): string;
|
||||
/**
|
||||
* Return the directory name of a path. Similar to the Unix dirname command.
|
||||
*
|
||||
* @param path the path to evaluate.
|
||||
* @throws {TypeError} if `path` is not a string.
|
||||
*/
|
||||
dirname(path: string): string;
|
||||
/**
|
||||
* Return the last portion of a path. Similar to the Unix basename command.
|
||||
* Often used to extract the file name from a fully qualified path.
|
||||
*
|
||||
* @param path the path to evaluate.
|
||||
* @param suffix optionally, an extension to remove from the result.
|
||||
* @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
|
||||
*/
|
||||
basename(path: string, suffix?: string): string;
|
||||
/**
|
||||
* Return the extension of the path, from the last '.' to end of string in the last portion of the path.
|
||||
* If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.
|
||||
*
|
||||
* @param path the path to evaluate.
|
||||
* @throws {TypeError} if `path` is not a string.
|
||||
*/
|
||||
extname(path: string): string;
|
||||
/**
|
||||
* The platform-specific file separator. '\\' or '/'.
|
||||
*/
|
||||
readonly sep: '\\' | '/';
|
||||
/**
|
||||
* The platform-specific file delimiter. ';' or ':'.
|
||||
*/
|
||||
readonly delimiter: ';' | ':';
|
||||
/**
|
||||
* Returns an object from a path string - the opposite of format().
|
||||
*
|
||||
* @param path path to evaluate.
|
||||
* @throws {TypeError} if `path` is not a string.
|
||||
*/
|
||||
parse(path: string): ParsedPath;
|
||||
/**
|
||||
* Returns a path string from an object - the opposite of parse().
|
||||
*
|
||||
* @param pathObject path to evaluate.
|
||||
*/
|
||||
format(pathObject: FormatInputPathObject): string;
|
||||
/**
|
||||
* On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
|
||||
* If path is not a string, path will be returned without modifications.
|
||||
* This method is meaningful only on Windows system.
|
||||
* On POSIX systems, the method is non-operational and always returns path without modifications.
|
||||
*/
|
||||
toNamespacedPath(path: string): string;
|
||||
/**
|
||||
* Posix specific pathing.
|
||||
* Same as parent object on posix.
|
||||
*/
|
||||
readonly posix: PlatformPath;
|
||||
/**
|
||||
* Windows specific pathing.
|
||||
* Same as parent object on windows
|
||||
*/
|
||||
readonly win32: PlatformPath;
|
||||
}
|
||||
}
|
||||
const path: path.PlatformPath;
|
||||
export = path;
|
||||
}
|
||||
declare module 'node:path' {
|
||||
import path = require('path');
|
||||
export = path;
|
||||
}
|
||||
declare module 'node:path/posix' {
|
||||
import path = require('path/posix');
|
||||
export = path;
|
||||
}
|
||||
declare module 'node:path/win32' {
|
||||
import path = require('path/win32');
|
||||
export = path;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
'use strict'
|
||||
|
||||
let Node = require('./node')
|
||||
|
||||
class Declaration extends Node {
|
||||
constructor(defaults) {
|
||||
if (
|
||||
defaults &&
|
||||
typeof defaults.value !== 'undefined' &&
|
||||
typeof defaults.value !== 'string'
|
||||
) {
|
||||
defaults = { ...defaults, value: String(defaults.value) }
|
||||
}
|
||||
super(defaults)
|
||||
this.type = 'decl'
|
||||
}
|
||||
|
||||
get variable() {
|
||||
return this.prop.startsWith('--') || this.prop[0] === '$'
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Declaration
|
||||
Declaration.default = Declaration
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"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","2":"C K L G M N O","260":"P Q R S"},C:{"1":"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":"0 1 2 3 4 5 6 7 8 DC tB I v J D E F A B C K L G M N O w g x y z EC FC","260":"uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB","516":"NB OB PB QB RB SB TB UB VB WB XB YB","580":"9 AB BB CB DB EB FB GB HB IB JB KB LB MB","2049":"mB nB oB pB P Q"},D:{"1":"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 GC","2":"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","132":"CB DB EB","260":"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 hB iB jB kB h lB mB nB oB pB P Q R S"},E:{"1":"G NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E F A HC zB IC JC KC LC 0B","1090":"B C K qB rB","2049":"L 1B MC"},F:{"1":"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","2":"F B C G M N O w g x y PC QC RC SC qB AC TC rB","132":"0 1 z","260":"2 3 4 5 6 7 8 9 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 ZB aB bB cB dB eB fB gB hB iB"},G:{"2":"E zB UC BC VC WC XC YC ZC aC bC cC","1090":"dC eC fC gC hC iC jC","2049":"kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"260":"vC"},P:{"260":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"260":"1B"},R:{"1":"9C"},S:{"1":"BD","516":"AD"}},B:5,C:"Web Animations API"};
|
||||
@@ -0,0 +1,125 @@
|
||||
{
|
||||
"name": "tailwindcss",
|
||||
"version": "3.2.7",
|
||||
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"types": "types/index.d.ts",
|
||||
"repository": "https://github.com/tailwindlabs/tailwindcss.git",
|
||||
"bugs": "https://github.com/tailwindlabs/tailwindcss/issues",
|
||||
"homepage": "https://tailwindcss.com",
|
||||
"bin": {
|
||||
"tailwind": "lib/cli.js",
|
||||
"tailwindcss": "lib/cli.js"
|
||||
},
|
||||
"tailwindcss": {
|
||||
"engine": "stable"
|
||||
},
|
||||
"scripts": {
|
||||
"prebuild": "npm run generate && rimraf lib",
|
||||
"build": "swc src --out-dir lib --copy-files",
|
||||
"postbuild": "esbuild lib/cli-peer-dependencies.js --bundle --platform=node --outfile=peers/index.js --define:process.env.CSS_TRANSFORMER_WASM=false",
|
||||
"rebuild-fixtures": "npm run build && node -r @swc/register scripts/rebuildFixtures.js",
|
||||
"style": "eslint .",
|
||||
"pretest": "npm run generate",
|
||||
"test": "jest",
|
||||
"test:integrations": "npm run test --prefix ./integrations",
|
||||
"install:integrations": "node scripts/install-integrations.js",
|
||||
"generate:plugin-list": "node -r @swc/register scripts/create-plugin-list.js",
|
||||
"generate:types": "node -r @swc/register scripts/generate-types.js",
|
||||
"generate": "npm run generate:plugin-list && npm run generate:types",
|
||||
"release-channel": "node ./scripts/release-channel.js",
|
||||
"release-notes": "node ./scripts/release-notes.js",
|
||||
"prepublishOnly": "npm install --force && npm run build"
|
||||
},
|
||||
"files": [
|
||||
"src/*",
|
||||
"cli/*",
|
||||
"lib/*",
|
||||
"peers/*",
|
||||
"scripts/*.js",
|
||||
"stubs/*.stub.js",
|
||||
"nesting/*",
|
||||
"types/**/*",
|
||||
"*.d.ts",
|
||||
"*.css",
|
||||
"*.js"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@swc/cli": "0.1.59",
|
||||
"@swc/core": "1.3.24",
|
||||
"@swc/jest": "0.2.24",
|
||||
"@swc/register": "0.1.10",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"browserslist": "^4.21.4",
|
||||
"concurrently": "^7.5.0",
|
||||
"cssnano": "^5.1.14",
|
||||
"esbuild": "^0.16.10",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"jest": "^28.1.3",
|
||||
"jest-diff": "^28.1.3",
|
||||
"lightningcss": "^1.18.0",
|
||||
"prettier": "^2.8.1",
|
||||
"rimraf": "^3.0.0",
|
||||
"source-map-js": "^1.0.2",
|
||||
"turbo": "^1.6.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.0.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"arg": "^5.0.2",
|
||||
"chokidar": "^3.5.3",
|
||||
"color-name": "^1.1.4",
|
||||
"detective": "^5.2.1",
|
||||
"didyoumean": "^1.2.2",
|
||||
"dlv": "^1.1.3",
|
||||
"fast-glob": "^3.2.12",
|
||||
"glob-parent": "^6.0.2",
|
||||
"is-glob": "^4.0.3",
|
||||
"lilconfig": "^2.0.6",
|
||||
"micromatch": "^4.0.5",
|
||||
"normalize-path": "^3.0.0",
|
||||
"object-hash": "^3.0.0",
|
||||
"picocolors": "^1.0.0",
|
||||
"postcss": "^8.0.9",
|
||||
"postcss-import": "^14.1.0",
|
||||
"postcss-js": "^4.0.0",
|
||||
"postcss-load-config": "^3.1.4",
|
||||
"postcss-nested": "6.0.0",
|
||||
"postcss-selector-parser": "^6.0.11",
|
||||
"postcss-value-parser": "^4.2.0",
|
||||
"quick-lru": "^5.1.1",
|
||||
"resolve": "^1.22.1"
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"not edge <= 18",
|
||||
"not ie 11",
|
||||
"not op_mini all"
|
||||
],
|
||||
"jest": {
|
||||
"testTimeout": 30000,
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/jest/customMatchers.js"
|
||||
],
|
||||
"testPathIgnorePatterns": [
|
||||
"/node_modules/",
|
||||
"/integrations/",
|
||||
"/standalone-cli/",
|
||||
"\\.test\\.skip\\.js$"
|
||||
],
|
||||
"transformIgnorePatterns": [
|
||||
"node_modules/(?!lightningcss)"
|
||||
],
|
||||
"transform": {
|
||||
"\\.js$": "@swc/jest",
|
||||
"\\.ts$": "@swc/jest"
|
||||
}
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.13.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","2":"J D E CC","132":"F"},B:{"1":"C K L G M N O P Q R 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"},C:{"2":"DC tB","260":"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 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 EC FC"},D:{"1":"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 hB iB jB kB h lB mB nB oB pB P Q R 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 GC"},E:{"1":"v J D E F A B C K L G IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I HC zB"},F:{"1":"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 WB XB YB ZB aB bB cB dB 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","2":"F B C PC QC RC SC qB AC TC rB"},G:{"16":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"16":"tB I f pC qC rC sC BC tC uC"},J:{"16":"D A"},K:{"1":"h","16":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"1":"B","2":"A"},O:{"1":"vC"},P:{"1":"g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","16":"I"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:5,C:"Resource Hints: dns-prefetch"};
|
||||
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
var callable = require("es5-ext/object/valid-callable");
|
||||
|
||||
module.exports = function (userNormalizer) {
|
||||
var normalizer;
|
||||
if (typeof userNormalizer === "function") return { set: userNormalizer, get: userNormalizer };
|
||||
normalizer = { get: callable(userNormalizer.get) };
|
||||
if (userNormalizer.set !== undefined) {
|
||||
normalizer.set = callable(userNormalizer.set);
|
||||
if (userNormalizer.delete) normalizer.delete = callable(userNormalizer.delete);
|
||||
if (userNormalizer.clear) normalizer.clear = callable(userNormalizer.clear);
|
||||
return normalizer;
|
||||
}
|
||||
normalizer.set = normalizer.get;
|
||||
return normalizer;
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export default function ansiRegex({onlyFirst = false} = {}) {
|
||||
const pattern = [
|
||||
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
||||
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
|
||||
].join('|');
|
||||
|
||||
return new RegExp(pattern, onlyFirst ? undefined : 'g');
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
'use strict';
|
||||
|
||||
var hasToStringTag = require('has-tostringtag/shams')();
|
||||
var forEach = require('foreach');
|
||||
var test = require('tape');
|
||||
var isRegex = require('..');
|
||||
|
||||
test('not regexes', function (t) {
|
||||
t.notOk(isRegex(), 'undefined is not regex');
|
||||
t.notOk(isRegex(null), 'null is not regex');
|
||||
t.notOk(isRegex(false), 'false is not regex');
|
||||
t.notOk(isRegex(true), 'true is not regex');
|
||||
t.notOk(isRegex(42), 'number is not regex');
|
||||
t.notOk(isRegex('foo'), 'string is not regex');
|
||||
t.notOk(isRegex([]), 'array is not regex');
|
||||
t.notOk(isRegex({}), 'object is not regex');
|
||||
t.notOk(isRegex(function () {}), 'function is not regex');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('@@toStringTag', { skip: !hasToStringTag }, function (t) {
|
||||
var regex = /a/g;
|
||||
var fakeRegex = {
|
||||
toString: function () { return String(regex); },
|
||||
valueOf: function () { return regex; }
|
||||
};
|
||||
fakeRegex[Symbol.toStringTag] = 'RegExp';
|
||||
t.notOk(isRegex(fakeRegex), 'fake RegExp with @@toStringTag "RegExp" is not regex');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('regexes', function (t) {
|
||||
t.ok(isRegex(/a/g), 'regex literal is regex');
|
||||
t.ok(isRegex(new RegExp('a', 'g')), 'regex object is regex');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('does not mutate regexes', function (t) {
|
||||
t.test('lastIndex is a marker object', function (st) {
|
||||
var regex = /a/;
|
||||
var marker = {};
|
||||
regex.lastIndex = marker;
|
||||
st.equal(regex.lastIndex, marker, 'lastIndex is the marker object');
|
||||
st.ok(isRegex(regex), 'is regex');
|
||||
st.equal(regex.lastIndex, marker, 'lastIndex is the marker object after isRegex');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('lastIndex is nonzero', function (st) {
|
||||
var regex = /a/;
|
||||
regex.lastIndex = 3;
|
||||
st.equal(regex.lastIndex, 3, 'lastIndex is 3');
|
||||
st.ok(isRegex(regex), 'is regex');
|
||||
st.equal(regex.lastIndex, 3, 'lastIndex is 3 after isRegex');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('does not perform operations observable to Proxies', { skip: typeof Proxy !== 'function' }, function (t) {
|
||||
var Handler = function () {
|
||||
this.trapCalls = [];
|
||||
};
|
||||
|
||||
forEach([
|
||||
'defineProperty',
|
||||
'deleteProperty',
|
||||
'get',
|
||||
'getOwnPropertyDescriptor',
|
||||
'getPrototypeOf',
|
||||
'has',
|
||||
'isExtensible',
|
||||
'ownKeys',
|
||||
'preventExtensions',
|
||||
'set',
|
||||
'setPrototypeOf'
|
||||
], function (trapName) {
|
||||
Handler.prototype[trapName] = function () {
|
||||
this.trapCalls.push(trapName);
|
||||
return Reflect[trapName].apply(Reflect, arguments);
|
||||
};
|
||||
});
|
||||
|
||||
t.test('proxy of object', function (st) {
|
||||
var handler = new Handler();
|
||||
var proxy = new Proxy({ lastIndex: 0 }, handler);
|
||||
|
||||
st.equal(isRegex(proxy), false, 'proxy of plain object is not regex');
|
||||
st.deepEqual(handler.trapCalls, ['getOwnPropertyDescriptor'], 'no unexpected proxy traps were triggered');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('proxy of RegExp instance', function (st) {
|
||||
var handler = new Handler();
|
||||
var proxy = new Proxy(/a/, handler);
|
||||
|
||||
st.equal(isRegex(proxy), false, 'proxy of RegExp instance is not regex');
|
||||
st.deepEqual(handler.trapCalls, ['getOwnPropertyDescriptor'], 'no unexpected proxy traps were triggered');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
@@ -0,0 +1,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[870] = (function(){ var d = "\u0000\u0001\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäţáăčçć[.<(+!&éęëůíîľĺß]$*);^-/ÂÄ˝ÁĂČÇĆ|,%_>?ˇÉĘËŮÍÎĽĹ`:#@'=\"˘abcdefghiśňđýřş°jklmnopqrłńš¸˛¤ą~stuvwxyzŚŇĐÝŘŞ˙ĄżŢݧžźŽŹŁŃЍ´×{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 }; })();
|
||||
@@ -0,0 +1,78 @@
|
||||
import { Observer } from './types';
|
||||
import { Subscription } from './Subscription';
|
||||
/**
|
||||
* Implements the {@link Observer} interface and extends the
|
||||
* {@link Subscription} class. While the {@link Observer} is the public API for
|
||||
* consuming the values of an {@link Observable}, all Observers get converted to
|
||||
* a Subscriber, in order to provide Subscription-like capabilities such as
|
||||
* `unsubscribe`. Subscriber is a common type in RxJS, and crucial for
|
||||
* implementing operators, but it is rarely used as a public API.
|
||||
*
|
||||
* @class Subscriber<T>
|
||||
*/
|
||||
export declare class Subscriber<T> extends Subscription implements Observer<T> {
|
||||
/**
|
||||
* A static factory for a Subscriber, given a (potentially partial) definition
|
||||
* of an Observer.
|
||||
* @param next The `next` callback of an Observer.
|
||||
* @param error The `error` callback of an
|
||||
* Observer.
|
||||
* @param complete The `complete` callback of an
|
||||
* Observer.
|
||||
* @return A Subscriber wrapping the (partially defined)
|
||||
* Observer represented by the given arguments.
|
||||
* @nocollapse
|
||||
* @deprecated Do not use. Will be removed in v8. There is no replacement for this
|
||||
* method, and there is no reason to be creating instances of `Subscriber` directly.
|
||||
* If you have a specific use case, please file an issue.
|
||||
*/
|
||||
static create<T>(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber<T>;
|
||||
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
|
||||
protected isStopped: boolean;
|
||||
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */
|
||||
protected destination: Subscriber<any> | Observer<any>;
|
||||
/**
|
||||
* @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
|
||||
* There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.
|
||||
*/
|
||||
constructor(destination?: Subscriber<any> | Observer<any>);
|
||||
/**
|
||||
* The {@link Observer} callback to receive notifications of type `next` from
|
||||
* the Observable, with a value. The Observable may call this method 0 or more
|
||||
* times.
|
||||
* @param {T} [value] The `next` value.
|
||||
* @return {void}
|
||||
*/
|
||||
next(value?: T): void;
|
||||
/**
|
||||
* The {@link Observer} callback to receive notifications of type `error` from
|
||||
* the Observable, with an attached `Error`. Notifies the Observer that
|
||||
* the Observable has experienced an error condition.
|
||||
* @param {any} [err] The `error` exception.
|
||||
* @return {void}
|
||||
*/
|
||||
error(err?: any): void;
|
||||
/**
|
||||
* The {@link Observer} callback to receive a valueless notification of type
|
||||
* `complete` from the Observable. Notifies the Observer that the Observable
|
||||
* has finished sending push-based notifications.
|
||||
* @return {void}
|
||||
*/
|
||||
complete(): void;
|
||||
unsubscribe(): void;
|
||||
protected _next(value: T): void;
|
||||
protected _error(err: any): void;
|
||||
protected _complete(): void;
|
||||
}
|
||||
export declare class SafeSubscriber<T> extends Subscriber<T> {
|
||||
constructor(observerOrNext?: Partial<Observer<T>> | ((value: T) => void) | null, error?: ((e?: any) => void) | null, complete?: (() => void) | null);
|
||||
}
|
||||
/**
|
||||
* The observer used as a stub for subscriptions where the user did not
|
||||
* pass any arguments to `subscribe`. Comes with the default error handling
|
||||
* behavior.
|
||||
*/
|
||||
export declare const EMPTY_OBSERVER: Readonly<Observer<any>> & {
|
||||
closed: true;
|
||||
};
|
||||
//# sourceMappingURL=Subscriber.d.ts.map
|
||||
@@ -0,0 +1,16 @@
|
||||
# Installation
|
||||
> `npm install --save @types/html-minifier`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for html-minifier (https://github.com/kangax/html-minifier).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-minifier.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Thu, 23 Dec 2021 23:34:49 GMT
|
||||
* Dependencies: [@types/uglify-js](https://npmjs.com/package/@types/uglify-js), [@types/clean-css](https://npmjs.com/package/@types/clean-css), [@types/relateurl](https://npmjs.com/package/@types/relateurl)
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Tanguy Krotoff](https://github.com/tkrotoff), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
|
||||
@@ -0,0 +1,2 @@
|
||||
declare function coerceToSafeInteger(value: any): number | null;
|
||||
export default coerceToSafeInteger;
|
||||
@@ -0,0 +1,872 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
getClassNameFromSelector: ()=>getClassNameFromSelector,
|
||||
resolveMatches: ()=>resolveMatches,
|
||||
generateRules: ()=>generateRules
|
||||
});
|
||||
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
||||
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
||||
const _parseObjectStyles = /*#__PURE__*/ _interopRequireDefault(require("../util/parseObjectStyles"));
|
||||
const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("../util/isPlainObject"));
|
||||
const _prefixSelector = /*#__PURE__*/ _interopRequireDefault(require("../util/prefixSelector"));
|
||||
const _pluginUtils = require("../util/pluginUtils");
|
||||
const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
|
||||
const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
|
||||
const _formatVariantSelector = require("../util/formatVariantSelector");
|
||||
const _nameClass = require("../util/nameClass");
|
||||
const _dataTypes = require("../util/dataTypes");
|
||||
const _setupContextUtils = require("./setupContextUtils");
|
||||
const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interopRequireDefault(require("../util/isSyntacticallyValidPropertyValue"));
|
||||
const _splitAtTopLevelOnlyJs = require("../util/splitAtTopLevelOnly.js");
|
||||
const _featureFlags = require("../featureFlags");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== "function") return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function(nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interopRequireWildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
||||
return {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj){
|
||||
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
let classNameParser = (0, _postcssSelectorParser.default)((selectors)=>{
|
||||
return selectors.first.filter(({ type })=>type === "class").pop().value;
|
||||
});
|
||||
function getClassNameFromSelector(selector) {
|
||||
return classNameParser.transformSync(selector);
|
||||
}
|
||||
// Generate match permutations for a class candidate, like:
|
||||
// ['ring-offset-blue', '100']
|
||||
// ['ring-offset', 'blue-100']
|
||||
// ['ring', 'offset-blue-100']
|
||||
// Example with dynamic classes:
|
||||
// ['grid-cols', '[[linename],1fr,auto]']
|
||||
// ['grid', 'cols-[[linename],1fr,auto]']
|
||||
function* candidatePermutations(candidate) {
|
||||
let lastIndex = Infinity;
|
||||
while(lastIndex >= 0){
|
||||
let dashIdx;
|
||||
let wasSlash = false;
|
||||
if (lastIndex === Infinity && candidate.endsWith("]")) {
|
||||
let bracketIdx = candidate.indexOf("[");
|
||||
// If character before `[` isn't a dash or a slash, this isn't a dynamic class
|
||||
// eg. string[]
|
||||
if (candidate[bracketIdx - 1] === "-") {
|
||||
dashIdx = bracketIdx - 1;
|
||||
} else if (candidate[bracketIdx - 1] === "/") {
|
||||
dashIdx = bracketIdx - 1;
|
||||
wasSlash = true;
|
||||
} else {
|
||||
dashIdx = -1;
|
||||
}
|
||||
} else if (lastIndex === Infinity && candidate.includes("/")) {
|
||||
dashIdx = candidate.lastIndexOf("/");
|
||||
wasSlash = true;
|
||||
} else {
|
||||
dashIdx = candidate.lastIndexOf("-", lastIndex);
|
||||
}
|
||||
if (dashIdx < 0) {
|
||||
break;
|
||||
}
|
||||
let prefix = candidate.slice(0, dashIdx);
|
||||
let modifier = candidate.slice(wasSlash ? dashIdx : dashIdx + 1);
|
||||
lastIndex = dashIdx - 1;
|
||||
// TODO: This feels a bit hacky
|
||||
if (prefix === "" || modifier === "/") {
|
||||
continue;
|
||||
}
|
||||
yield [
|
||||
prefix,
|
||||
modifier
|
||||
];
|
||||
}
|
||||
}
|
||||
function applyPrefix(matches, context) {
|
||||
if (matches.length === 0 || context.tailwindConfig.prefix === "") {
|
||||
return matches;
|
||||
}
|
||||
for (let match of matches){
|
||||
let [meta] = match;
|
||||
if (meta.options.respectPrefix) {
|
||||
let container = _postcss.default.root({
|
||||
nodes: [
|
||||
match[1].clone()
|
||||
]
|
||||
});
|
||||
let classCandidate = match[1].raws.tailwind.classCandidate;
|
||||
container.walkRules((r)=>{
|
||||
// If this is a negative utility with a dash *before* the prefix we
|
||||
// have to ensure that the generated selector matches the candidate
|
||||
// Not doing this will cause `-tw-top-1` to generate the class `.tw--top-1`
|
||||
// The disconnect between candidate <-> class can cause @apply to hard crash.
|
||||
let shouldPrependNegative = classCandidate.startsWith("-");
|
||||
r.selector = (0, _prefixSelector.default)(context.tailwindConfig.prefix, r.selector, shouldPrependNegative);
|
||||
});
|
||||
match[1] = container.nodes[0];
|
||||
}
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
function applyImportant(matches, classCandidate) {
|
||||
if (matches.length === 0) {
|
||||
return matches;
|
||||
}
|
||||
let result = [];
|
||||
for (let [meta, rule] of matches){
|
||||
let container = _postcss.default.root({
|
||||
nodes: [
|
||||
rule.clone()
|
||||
]
|
||||
});
|
||||
container.walkRules((r)=>{
|
||||
let ast = (0, _postcssSelectorParser.default)().astSync(r.selector);
|
||||
// Remove extraneous selectors that do not include the base candidate
|
||||
ast.each((sel)=>(0, _formatVariantSelector.eliminateIrrelevantSelectors)(sel, classCandidate));
|
||||
// Update all instances of the base candidate to include the important marker
|
||||
(0, _pluginUtils.updateAllClasses)(ast, (className)=>className === classCandidate ? `!${className}` : className);
|
||||
r.selector = ast.toString();
|
||||
r.walkDecls((d)=>d.important = true);
|
||||
});
|
||||
result.push([
|
||||
{
|
||||
...meta,
|
||||
important: true
|
||||
},
|
||||
container.nodes[0]
|
||||
]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Takes a list of rule tuples and applies a variant like `hover`, sm`,
|
||||
// whatever to it. We used to do some extra caching here to avoid generating
|
||||
// a variant of the same rule more than once, but this was never hit because
|
||||
// we cache at the entire selector level further up the tree.
|
||||
//
|
||||
// Technically you can get a cache hit if you have `hover:focus:text-center`
|
||||
// and `focus:hover:text-center` in the same project, but it doesn't feel
|
||||
// worth the complexity for that case.
|
||||
function applyVariant(variant, matches, context) {
|
||||
if (matches.length === 0) {
|
||||
return matches;
|
||||
}
|
||||
/** @type {{modifier: string | null, value: string | null}} */ let args = {
|
||||
modifier: null,
|
||||
value: _sharedState.NONE
|
||||
};
|
||||
// Retrieve "modifier"
|
||||
{
|
||||
let [baseVariant, ...modifiers] = (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(variant, "/");
|
||||
// This is a hack to support variants with `/` in them, like `ar-1/10/20:text-red-500`
|
||||
// In this case 1/10 is a value but /20 is a modifier
|
||||
if (modifiers.length > 1) {
|
||||
baseVariant = baseVariant + "/" + modifiers.slice(0, -1).join("/");
|
||||
modifiers = modifiers.slice(-1);
|
||||
}
|
||||
if (modifiers.length && !context.variantMap.has(variant)) {
|
||||
variant = baseVariant;
|
||||
args.modifier = modifiers[0];
|
||||
if (!(0, _featureFlags.flagEnabled)(context.tailwindConfig, "generalizedModifiers")) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
// Retrieve "arbitrary value"
|
||||
if (variant.endsWith("]") && !variant.startsWith("[")) {
|
||||
// We either have:
|
||||
// @[200px]
|
||||
// group-[:hover]
|
||||
//
|
||||
// But we don't want:
|
||||
// @-[200px] (`-` is incorrect)
|
||||
// group[:hover] (`-` is missing)
|
||||
let match = /(.)(-?)\[(.*)\]/g.exec(variant);
|
||||
if (match) {
|
||||
let [, char, seperator, value] = match;
|
||||
// @-[200px] case
|
||||
if (char === "@" && seperator === "-") return [];
|
||||
// group[:hover] case
|
||||
if (char !== "@" && seperator === "") return [];
|
||||
variant = variant.replace(`${seperator}[${value}]`, "");
|
||||
args.value = value;
|
||||
}
|
||||
}
|
||||
// Register arbitrary variants
|
||||
if (isArbitraryValue(variant) && !context.variantMap.has(variant)) {
|
||||
let selector = (0, _dataTypes.normalize)(variant.slice(1, -1));
|
||||
if (!(0, _setupContextUtils.isValidVariantFormatString)(selector)) {
|
||||
return [];
|
||||
}
|
||||
let fn = (0, _setupContextUtils.parseVariant)(selector);
|
||||
let sort = context.offsets.recordVariant(variant);
|
||||
context.variantMap.set(variant, [
|
||||
[
|
||||
sort,
|
||||
fn
|
||||
]
|
||||
]);
|
||||
}
|
||||
if (context.variantMap.has(variant)) {
|
||||
let isArbitraryVariant = isArbitraryValue(variant);
|
||||
let variantFunctionTuples = context.variantMap.get(variant).slice();
|
||||
let result = [];
|
||||
for (let [meta, rule] of matches){
|
||||
// Don't generate variants for user css
|
||||
if (meta.layer === "user") {
|
||||
continue;
|
||||
}
|
||||
let container = _postcss.default.root({
|
||||
nodes: [
|
||||
rule.clone()
|
||||
]
|
||||
});
|
||||
for (let [variantSort, variantFunction, containerFromArray] of variantFunctionTuples){
|
||||
let clone = (containerFromArray !== null && containerFromArray !== void 0 ? containerFromArray : container).clone();
|
||||
let collectedFormats = [];
|
||||
function prepareBackup() {
|
||||
// Already prepared, chicken out
|
||||
if (clone.raws.neededBackup) {
|
||||
return;
|
||||
}
|
||||
clone.raws.neededBackup = true;
|
||||
clone.walkRules((rule)=>rule.raws.originalSelector = rule.selector);
|
||||
}
|
||||
function modifySelectors(modifierFunction) {
|
||||
prepareBackup();
|
||||
clone.each((rule)=>{
|
||||
if (rule.type !== "rule") {
|
||||
return;
|
||||
}
|
||||
rule.selectors = rule.selectors.map((selector)=>{
|
||||
return modifierFunction({
|
||||
get className () {
|
||||
return getClassNameFromSelector(selector);
|
||||
},
|
||||
selector
|
||||
});
|
||||
});
|
||||
});
|
||||
return clone;
|
||||
}
|
||||
let ruleWithVariant = variantFunction({
|
||||
// Public API
|
||||
get container () {
|
||||
prepareBackup();
|
||||
return clone;
|
||||
},
|
||||
separator: context.tailwindConfig.separator,
|
||||
modifySelectors,
|
||||
// Private API for now
|
||||
wrap (wrapper) {
|
||||
let nodes = clone.nodes;
|
||||
clone.removeAll();
|
||||
wrapper.append(nodes);
|
||||
clone.append(wrapper);
|
||||
},
|
||||
format (selectorFormat) {
|
||||
collectedFormats.push({
|
||||
format: selectorFormat,
|
||||
isArbitraryVariant
|
||||
});
|
||||
},
|
||||
args
|
||||
});
|
||||
// It can happen that a list of format strings is returned from within the function. In that
|
||||
// case, we have to process them as well. We can use the existing `variantSort`.
|
||||
if (Array.isArray(ruleWithVariant)) {
|
||||
for (let [idx, variantFunction1] of ruleWithVariant.entries()){
|
||||
// This is a little bit scary since we are pushing to an array of items that we are
|
||||
// currently looping over. However, you can also think of it like a processing queue
|
||||
// where you keep handling jobs until everything is done and each job can queue more
|
||||
// jobs if needed.
|
||||
variantFunctionTuples.push([
|
||||
context.offsets.applyParallelOffset(variantSort, idx),
|
||||
variantFunction1,
|
||||
// If the clone has been modified we have to pass that back
|
||||
// though so each rule can use the modified container
|
||||
clone.clone()
|
||||
]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (typeof ruleWithVariant === "string") {
|
||||
collectedFormats.push({
|
||||
format: ruleWithVariant,
|
||||
isArbitraryVariant
|
||||
});
|
||||
}
|
||||
if (ruleWithVariant === null) {
|
||||
continue;
|
||||
}
|
||||
// We had to backup selectors, therefore we assume that somebody touched
|
||||
// `container` or `modifySelectors`. Let's see if they did, so that we
|
||||
// can restore the selectors, and collect the format strings.
|
||||
if (clone.raws.neededBackup) {
|
||||
delete clone.raws.neededBackup;
|
||||
clone.walkRules((rule)=>{
|
||||
let before = rule.raws.originalSelector;
|
||||
if (!before) return;
|
||||
delete rule.raws.originalSelector;
|
||||
if (before === rule.selector) return; // No mutation happened
|
||||
let modified = rule.selector;
|
||||
// Rebuild the base selector, this is what plugin authors would do
|
||||
// as well. E.g.: `${variant}${separator}${className}`.
|
||||
// However, plugin authors probably also prepend or append certain
|
||||
// classes, pseudos, ids, ...
|
||||
let rebuiltBase = (0, _postcssSelectorParser.default)((selectors)=>{
|
||||
selectors.walkClasses((classNode)=>{
|
||||
classNode.value = `${variant}${context.tailwindConfig.separator}${classNode.value}`;
|
||||
});
|
||||
}).processSync(before);
|
||||
// Now that we know the original selector, the new selector, and
|
||||
// the rebuild part in between, we can replace the part that plugin
|
||||
// authors need to rebuild with `&`, and eventually store it in the
|
||||
// collectedFormats. Similar to what `format('...')` would do.
|
||||
//
|
||||
// E.g.:
|
||||
// variant: foo
|
||||
// selector: .markdown > p
|
||||
// modified (by plugin): .foo .foo\\:markdown > p
|
||||
// rebuiltBase (internal): .foo\\:markdown > p
|
||||
// format: .foo &
|
||||
collectedFormats.push({
|
||||
format: modified.replace(rebuiltBase, "&"),
|
||||
isArbitraryVariant
|
||||
});
|
||||
rule.selector = before;
|
||||
});
|
||||
}
|
||||
// This tracks the originating layer for the variant
|
||||
// For example:
|
||||
// .sm:underline {} is a variant of something in the utilities layer
|
||||
// .sm:container {} is a variant of the container component
|
||||
clone.nodes[0].raws.tailwind = {
|
||||
...clone.nodes[0].raws.tailwind,
|
||||
parentLayer: meta.layer
|
||||
};
|
||||
var _meta_collectedFormats;
|
||||
let withOffset = [
|
||||
{
|
||||
...meta,
|
||||
sort: context.offsets.applyVariantOffset(meta.sort, variantSort, Object.assign(args, context.variantOptions.get(variant))),
|
||||
collectedFormats: ((_meta_collectedFormats = meta.collectedFormats) !== null && _meta_collectedFormats !== void 0 ? _meta_collectedFormats : []).concat(collectedFormats)
|
||||
},
|
||||
clone.nodes[0]
|
||||
];
|
||||
result.push(withOffset);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
function parseRules(rule, cache, options = {}) {
|
||||
// PostCSS node
|
||||
if (!(0, _isPlainObject.default)(rule) && !Array.isArray(rule)) {
|
||||
return [
|
||||
[
|
||||
rule
|
||||
],
|
||||
options
|
||||
];
|
||||
}
|
||||
// Tuple
|
||||
if (Array.isArray(rule)) {
|
||||
return parseRules(rule[0], cache, rule[1]);
|
||||
}
|
||||
// Simple object
|
||||
if (!cache.has(rule)) {
|
||||
cache.set(rule, (0, _parseObjectStyles.default)(rule));
|
||||
}
|
||||
return [
|
||||
cache.get(rule),
|
||||
options
|
||||
];
|
||||
}
|
||||
const IS_VALID_PROPERTY_NAME = /^[a-z_-]/;
|
||||
function isValidPropName(name) {
|
||||
return IS_VALID_PROPERTY_NAME.test(name);
|
||||
}
|
||||
/**
|
||||
* @param {string} declaration
|
||||
* @returns {boolean}
|
||||
*/ function looksLikeUri(declaration) {
|
||||
// Quick bailout for obvious non-urls
|
||||
// This doesn't support schemes that don't use a leading // but that's unlikely to be a problem
|
||||
if (!declaration.includes("://")) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
const url = new URL(declaration);
|
||||
return url.scheme !== "" && url.host !== "";
|
||||
} catch (err) {
|
||||
// Definitely not a valid url
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function isParsableNode(node) {
|
||||
let isParsable = true;
|
||||
node.walkDecls((decl)=>{
|
||||
if (!isParsableCssValue(decl.prop, decl.value)) {
|
||||
isParsable = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return isParsable;
|
||||
}
|
||||
function isParsableCssValue(property, value) {
|
||||
// We don't want to to treat [https://example.com] as a custom property
|
||||
// Even though, according to the CSS grammar, it's a totally valid CSS declaration
|
||||
// So we short-circuit here by checking if the custom property looks like a url
|
||||
if (looksLikeUri(`${property}:${value}`)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
_postcss.default.parse(`a{${property}:${value}}`).toResult();
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function extractArbitraryProperty(classCandidate, context) {
|
||||
var _classCandidate_match;
|
||||
let [, property, value] = (_classCandidate_match = classCandidate.match(/^\[([a-zA-Z0-9-_]+):(\S+)\]$/)) !== null && _classCandidate_match !== void 0 ? _classCandidate_match : [];
|
||||
if (value === undefined) {
|
||||
return null;
|
||||
}
|
||||
if (!isValidPropName(property)) {
|
||||
return null;
|
||||
}
|
||||
if (!(0, _isSyntacticallyValidPropertyValue.default)(value)) {
|
||||
return null;
|
||||
}
|
||||
let normalized = (0, _dataTypes.normalize)(value);
|
||||
if (!isParsableCssValue(property, normalized)) {
|
||||
return null;
|
||||
}
|
||||
let sort = context.offsets.arbitraryProperty();
|
||||
return [
|
||||
[
|
||||
{
|
||||
sort,
|
||||
layer: "utilities"
|
||||
},
|
||||
()=>({
|
||||
[(0, _nameClass.asClass)(classCandidate)]: {
|
||||
[property]: normalized
|
||||
}
|
||||
})
|
||||
]
|
||||
];
|
||||
}
|
||||
function* resolveMatchedPlugins(classCandidate, context) {
|
||||
if (context.candidateRuleMap.has(classCandidate)) {
|
||||
yield [
|
||||
context.candidateRuleMap.get(classCandidate),
|
||||
"DEFAULT"
|
||||
];
|
||||
}
|
||||
yield* function*(arbitraryPropertyRule) {
|
||||
if (arbitraryPropertyRule !== null) {
|
||||
yield [
|
||||
arbitraryPropertyRule,
|
||||
"DEFAULT"
|
||||
];
|
||||
}
|
||||
}(extractArbitraryProperty(classCandidate, context));
|
||||
let candidatePrefix = classCandidate;
|
||||
let negative = false;
|
||||
const twConfigPrefix = context.tailwindConfig.prefix;
|
||||
const twConfigPrefixLen = twConfigPrefix.length;
|
||||
const hasMatchingPrefix = candidatePrefix.startsWith(twConfigPrefix) || candidatePrefix.startsWith(`-${twConfigPrefix}`);
|
||||
if (candidatePrefix[twConfigPrefixLen] === "-" && hasMatchingPrefix) {
|
||||
negative = true;
|
||||
candidatePrefix = twConfigPrefix + candidatePrefix.slice(twConfigPrefixLen + 1);
|
||||
}
|
||||
if (negative && context.candidateRuleMap.has(candidatePrefix)) {
|
||||
yield [
|
||||
context.candidateRuleMap.get(candidatePrefix),
|
||||
"-DEFAULT"
|
||||
];
|
||||
}
|
||||
for (let [prefix, modifier] of candidatePermutations(candidatePrefix)){
|
||||
if (context.candidateRuleMap.has(prefix)) {
|
||||
yield [
|
||||
context.candidateRuleMap.get(prefix),
|
||||
negative ? `-${modifier}` : modifier
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
function splitWithSeparator(input, separator) {
|
||||
if (input === _sharedState.NOT_ON_DEMAND) {
|
||||
return [
|
||||
_sharedState.NOT_ON_DEMAND
|
||||
];
|
||||
}
|
||||
return (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(input, separator);
|
||||
}
|
||||
function* recordCandidates(matches, classCandidate) {
|
||||
for (const match of matches){
|
||||
var _match__options;
|
||||
var _match__options_preserveSource;
|
||||
match[1].raws.tailwind = {
|
||||
...match[1].raws.tailwind,
|
||||
classCandidate,
|
||||
preserveSource: (_match__options_preserveSource = (_match__options = match[0].options) === null || _match__options === void 0 ? void 0 : _match__options.preserveSource) !== null && _match__options_preserveSource !== void 0 ? _match__options_preserveSource : false
|
||||
};
|
||||
yield match;
|
||||
}
|
||||
}
|
||||
function* resolveMatches(candidate, context, original = candidate) {
|
||||
let separator = context.tailwindConfig.separator;
|
||||
let [classCandidate, ...variants] = splitWithSeparator(candidate, separator).reverse();
|
||||
let important = false;
|
||||
if (classCandidate.startsWith("!")) {
|
||||
important = true;
|
||||
classCandidate = classCandidate.slice(1);
|
||||
}
|
||||
if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping")) {
|
||||
if (classCandidate.startsWith("(") && classCandidate.endsWith(")")) {
|
||||
let base = variants.slice().reverse().join(separator);
|
||||
for (let part of (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(classCandidate.slice(1, -1), ",")){
|
||||
yield* resolveMatches(base + separator + part, context, original);
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: Reintroduce this in ways that doesn't break on false positives
|
||||
// function sortAgainst(toSort, against) {
|
||||
// return toSort.slice().sort((a, z) => {
|
||||
// return bigSign(against.get(a)[0] - against.get(z)[0])
|
||||
// })
|
||||
// }
|
||||
// let sorted = sortAgainst(variants, context.variantMap)
|
||||
// if (sorted.toString() !== variants.toString()) {
|
||||
// let corrected = sorted.reverse().concat(classCandidate).join(':')
|
||||
// throw new Error(`Class ${candidate} should be written as ${corrected}`)
|
||||
// }
|
||||
for (let matchedPlugins of resolveMatchedPlugins(classCandidate, context)){
|
||||
let matches = [];
|
||||
let typesByMatches = new Map();
|
||||
let [plugins, modifier] = matchedPlugins;
|
||||
let isOnlyPlugin = plugins.length === 1;
|
||||
for (let [sort, plugin] of plugins){
|
||||
let matchesPerPlugin = [];
|
||||
if (typeof plugin === "function") {
|
||||
for (let ruleSet of [].concat(plugin(modifier, {
|
||||
isOnlyPlugin
|
||||
}))){
|
||||
let [rules, options] = parseRules(ruleSet, context.postCssNodeCache);
|
||||
for (let rule of rules){
|
||||
matchesPerPlugin.push([
|
||||
{
|
||||
...sort,
|
||||
options: {
|
||||
...sort.options,
|
||||
...options
|
||||
}
|
||||
},
|
||||
rule
|
||||
]);
|
||||
}
|
||||
}
|
||||
} else if (modifier === "DEFAULT" || modifier === "-DEFAULT") {
|
||||
let ruleSet1 = plugin;
|
||||
let [rules1, options1] = parseRules(ruleSet1, context.postCssNodeCache);
|
||||
for (let rule1 of rules1){
|
||||
matchesPerPlugin.push([
|
||||
{
|
||||
...sort,
|
||||
options: {
|
||||
...sort.options,
|
||||
...options1
|
||||
}
|
||||
},
|
||||
rule1
|
||||
]);
|
||||
}
|
||||
}
|
||||
if (matchesPerPlugin.length > 0) {
|
||||
var _sort_options;
|
||||
var _sort_options_types, _sort_options1;
|
||||
let matchingTypes = Array.from((0, _pluginUtils.getMatchingTypes)((_sort_options_types = (_sort_options = sort.options) === null || _sort_options === void 0 ? void 0 : _sort_options.types) !== null && _sort_options_types !== void 0 ? _sort_options_types : [], modifier, (_sort_options1 = sort.options) !== null && _sort_options1 !== void 0 ? _sort_options1 : {}, context.tailwindConfig)).map(([_, type])=>type);
|
||||
if (matchingTypes.length > 0) {
|
||||
typesByMatches.set(matchesPerPlugin, matchingTypes);
|
||||
}
|
||||
matches.push(matchesPerPlugin);
|
||||
}
|
||||
}
|
||||
if (isArbitraryValue(modifier)) {
|
||||
if (matches.length > 1) {
|
||||
// Partition plugins in 2 categories so that we can start searching in the plugins that
|
||||
// don't have `any` as a type first.
|
||||
let [withAny, withoutAny] = matches.reduce((group, plugin)=>{
|
||||
let hasAnyType = plugin.some(([{ options }])=>options.types.some(({ type })=>type === "any"));
|
||||
if (hasAnyType) {
|
||||
group[0].push(plugin);
|
||||
} else {
|
||||
group[1].push(plugin);
|
||||
}
|
||||
return group;
|
||||
}, [
|
||||
[],
|
||||
[]
|
||||
]);
|
||||
function findFallback(matches) {
|
||||
// If only a single plugin matches, let's take that one
|
||||
if (matches.length === 1) {
|
||||
return matches[0];
|
||||
}
|
||||
// Otherwise, find the plugin that creates a valid rule given the arbitrary value, and
|
||||
// also has the correct type which preferOnConflicts the plugin in case of clashes.
|
||||
return matches.find((rules)=>{
|
||||
let matchingTypes = typesByMatches.get(rules);
|
||||
return rules.some(([{ options }, rule])=>{
|
||||
if (!isParsableNode(rule)) {
|
||||
return false;
|
||||
}
|
||||
return options.types.some(({ type , preferOnConflict })=>matchingTypes.includes(type) && preferOnConflict);
|
||||
});
|
||||
});
|
||||
}
|
||||
var _findFallback;
|
||||
// Try to find a fallback plugin, because we already know that multiple plugins matched for
|
||||
// the given arbitrary value.
|
||||
let fallback = (_findFallback = findFallback(withoutAny)) !== null && _findFallback !== void 0 ? _findFallback : findFallback(withAny);
|
||||
if (fallback) {
|
||||
matches = [
|
||||
fallback
|
||||
];
|
||||
} else {
|
||||
var _typesByMatches_get;
|
||||
let typesPerPlugin = matches.map((match)=>new Set([
|
||||
...(_typesByMatches_get = typesByMatches.get(match)) !== null && _typesByMatches_get !== void 0 ? _typesByMatches_get : []
|
||||
]));
|
||||
// Remove duplicates, so that we can detect proper unique types for each plugin.
|
||||
for (let pluginTypes of typesPerPlugin){
|
||||
for (let type of pluginTypes){
|
||||
let removeFromOwnGroup = false;
|
||||
for (let otherGroup of typesPerPlugin){
|
||||
if (pluginTypes === otherGroup) continue;
|
||||
if (otherGroup.has(type)) {
|
||||
otherGroup.delete(type);
|
||||
removeFromOwnGroup = true;
|
||||
}
|
||||
}
|
||||
if (removeFromOwnGroup) pluginTypes.delete(type);
|
||||
}
|
||||
}
|
||||
let messages = [];
|
||||
for (let [idx, group] of typesPerPlugin.entries()){
|
||||
for (let type1 of group){
|
||||
let rules2 = matches[idx].map(([, rule])=>rule).flat().map((rule)=>rule.toString().split("\n").slice(1, -1) // Remove selector and closing '}'
|
||||
.map((line)=>line.trim()).map((x)=>` ${x}`) // Re-indent
|
||||
.join("\n")).join("\n\n");
|
||||
messages.push(` Use \`${candidate.replace("[", `[${type1}:`)}\` for \`${rules2.trim()}\``);
|
||||
break;
|
||||
}
|
||||
}
|
||||
_log.default.warn([
|
||||
`The class \`${candidate}\` is ambiguous and matches multiple utilities.`,
|
||||
...messages,
|
||||
`If this is content and not a class, replace it with \`${candidate.replace("[", "[").replace("]", "]")}\` to silence this warning.`
|
||||
]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
matches = matches.map((list)=>list.filter((match)=>isParsableNode(match[1])));
|
||||
}
|
||||
matches = matches.flat();
|
||||
matches = Array.from(recordCandidates(matches, classCandidate));
|
||||
matches = applyPrefix(matches, context);
|
||||
if (important) {
|
||||
matches = applyImportant(matches, classCandidate);
|
||||
}
|
||||
for (let variant of variants){
|
||||
matches = applyVariant(variant, matches, context);
|
||||
}
|
||||
for (let match of matches){
|
||||
match[1].raws.tailwind = {
|
||||
...match[1].raws.tailwind,
|
||||
candidate
|
||||
};
|
||||
// Apply final format selector
|
||||
match = applyFinalFormat(match, {
|
||||
context,
|
||||
candidate,
|
||||
original
|
||||
});
|
||||
// Skip rules with invalid selectors
|
||||
// This will cause the candidate to be added to the "not class"
|
||||
// cache skipping it entirely for future builds
|
||||
if (match === null) {
|
||||
continue;
|
||||
}
|
||||
yield match;
|
||||
}
|
||||
}
|
||||
}
|
||||
function applyFinalFormat(match, { context , candidate , original }) {
|
||||
if (!match[0].collectedFormats) {
|
||||
return match;
|
||||
}
|
||||
let isValid = true;
|
||||
let finalFormat;
|
||||
try {
|
||||
finalFormat = (0, _formatVariantSelector.formatVariantSelector)(match[0].collectedFormats, {
|
||||
context,
|
||||
candidate
|
||||
});
|
||||
} catch {
|
||||
// The format selector we produced is invalid
|
||||
// This could be because:
|
||||
// - A bug exists
|
||||
// - A plugin introduced an invalid variant selector (ex: `addVariant('foo', '&;foo')`)
|
||||
// - The user used an invalid arbitrary variant (ex: `[&;foo]:underline`)
|
||||
// Either way the build will fail because of this
|
||||
// We would rather that the build pass "silently" given that this could
|
||||
// happen because of picking up invalid things when scanning content
|
||||
// So we'll throw out the candidate instead
|
||||
return null;
|
||||
}
|
||||
let container = _postcss.default.root({
|
||||
nodes: [
|
||||
match[1].clone()
|
||||
]
|
||||
});
|
||||
container.walkRules((rule)=>{
|
||||
if (inKeyframes(rule)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
rule.selector = (0, _formatVariantSelector.finalizeSelector)(rule.selector, finalFormat, {
|
||||
candidate: original,
|
||||
context
|
||||
});
|
||||
} catch {
|
||||
// If this selector is invalid we also want to skip it
|
||||
// But it's likely that being invalid here means there's a bug in a plugin rather than too loosely matching content
|
||||
isValid = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (!isValid) {
|
||||
return null;
|
||||
}
|
||||
match[1] = container.nodes[0];
|
||||
return match;
|
||||
}
|
||||
function inKeyframes(rule) {
|
||||
return rule.parent && rule.parent.type === "atrule" && rule.parent.name === "keyframes";
|
||||
}
|
||||
function getImportantStrategy(important) {
|
||||
if (important === true) {
|
||||
return (rule)=>{
|
||||
if (inKeyframes(rule)) {
|
||||
return;
|
||||
}
|
||||
rule.walkDecls((d)=>{
|
||||
if (d.parent.type === "rule" && !inKeyframes(d.parent)) {
|
||||
d.important = true;
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
if (typeof important === "string") {
|
||||
return (rule)=>{
|
||||
if (inKeyframes(rule)) {
|
||||
return;
|
||||
}
|
||||
rule.selectors = rule.selectors.map((selector)=>{
|
||||
return `${important} ${selector}`;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
function generateRules(candidates, context) {
|
||||
let allRules = [];
|
||||
let strategy = getImportantStrategy(context.tailwindConfig.important);
|
||||
for (let candidate of candidates){
|
||||
if (context.notClassCache.has(candidate)) {
|
||||
continue;
|
||||
}
|
||||
if (context.candidateRuleCache.has(candidate)) {
|
||||
allRules = allRules.concat(Array.from(context.candidateRuleCache.get(candidate)));
|
||||
continue;
|
||||
}
|
||||
let matches = Array.from(resolveMatches(candidate, context));
|
||||
if (matches.length === 0) {
|
||||
context.notClassCache.add(candidate);
|
||||
continue;
|
||||
}
|
||||
context.classCache.set(candidate, matches);
|
||||
var _context_candidateRuleCache_get;
|
||||
let rules = (_context_candidateRuleCache_get = context.candidateRuleCache.get(candidate)) !== null && _context_candidateRuleCache_get !== void 0 ? _context_candidateRuleCache_get : new Set();
|
||||
context.candidateRuleCache.set(candidate, rules);
|
||||
for (const match of matches){
|
||||
let [{ sort , options }, rule] = match;
|
||||
if (options.respectImportant && strategy) {
|
||||
let container = _postcss.default.root({
|
||||
nodes: [
|
||||
rule.clone()
|
||||
]
|
||||
});
|
||||
container.walkRules(strategy);
|
||||
rule = container.nodes[0];
|
||||
}
|
||||
let newEntry = [
|
||||
sort,
|
||||
rule
|
||||
];
|
||||
rules.add(newEntry);
|
||||
context.ruleCache.add(newEntry);
|
||||
allRules.push(newEntry);
|
||||
}
|
||||
}
|
||||
return allRules;
|
||||
}
|
||||
function isArbitraryValue(input) {
|
||||
return input.startsWith("[") && input.endsWith("]");
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
var baseSum = require('./_baseSum');
|
||||
|
||||
/** Used as references for various `Number` constants. */
|
||||
var NAN = 0 / 0;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.mean` and `_.meanBy` without support for
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {number} Returns the mean.
|
||||
*/
|
||||
function baseMean(array, iteratee) {
|
||||
var length = array == null ? 0 : array.length;
|
||||
return length ? (baseSum(array, iteratee) / length) : NAN;
|
||||
}
|
||||
|
||||
module.exports = baseMean;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"performanceTimestampProvider.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/performanceTimestampProvider.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,4BAA4B,GAAiC;IACxE,GAAG;QAGD,OAAO,CAAC,4BAA4B,CAAC,QAAQ,IAAI,WAAW,CAAC,CAAC,GAAG,EAAE,CAAC;IACtE,CAAC;IACD,QAAQ,EAAE,SAAS;CACpB,CAAC"}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Taken from: https://github.com/paulmillr/es6-shim/
|
||||
|
||||
"use strict";
|
||||
|
||||
var toInteger = require("../../../number/to-integer")
|
||||
, toPosInt = require("../../../number/to-pos-integer")
|
||||
, validValue = require("../../../object/valid-value")
|
||||
, max = Math.max
|
||||
, min = Math.min;
|
||||
|
||||
module.exports = function (value /*, start, end*/) {
|
||||
var arr = validValue(this)
|
||||
, start = arguments[1]
|
||||
, end = arguments[2]
|
||||
, length = toPosInt(arr.length)
|
||||
, relativeStart
|
||||
, i;
|
||||
|
||||
start = start === undefined ? 0 : toInteger(start);
|
||||
end = end === undefined ? length : toInteger(end);
|
||||
|
||||
relativeStart = start < 0 ? max(length + start, 0) : min(start, length);
|
||||
for (i = relativeStart; i < length && i < end; ++i) arr[i] = value;
|
||||
return arr;
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
// @ts-check
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "init", {
|
||||
enumerable: true,
|
||||
get: ()=>init
|
||||
});
|
||||
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
||||
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function init(args, configs) {
|
||||
let messages = [];
|
||||
var _args___;
|
||||
let tailwindConfigLocation = _path.default.resolve((_args___ = args["_"][1]) !== null && _args___ !== void 0 ? _args___ : `./${configs.tailwind}`);
|
||||
if (_fs.default.existsSync(tailwindConfigLocation)) {
|
||||
messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
|
||||
} else {
|
||||
let stubFile = _fs.default.readFileSync(args["--full"] ? _path.default.resolve(__dirname, "../../../stubs/defaultConfig.stub.js") : _path.default.resolve(__dirname, "../../../stubs/simpleConfig.stub.js"), "utf8");
|
||||
// Change colors import
|
||||
stubFile = stubFile.replace("../colors", "tailwindcss/colors");
|
||||
_fs.default.writeFileSync(tailwindConfigLocation, stubFile, "utf8");
|
||||
messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
|
||||
}
|
||||
if (args["--postcss"]) {
|
||||
let postcssConfigLocation = _path.default.resolve(`./${configs.postcss}`);
|
||||
if (_fs.default.existsSync(postcssConfigLocation)) {
|
||||
messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
|
||||
} else {
|
||||
let stubFile1 = _fs.default.readFileSync(_path.default.resolve(__dirname, "../../../stubs/defaultPostCssConfig.stub.js"), "utf8");
|
||||
_fs.default.writeFileSync(postcssConfigLocation, stubFile1, "utf8");
|
||||
messages.push(`Created PostCSS config file: ${_path.default.basename(postcssConfigLocation)}`);
|
||||
}
|
||||
}
|
||||
if (messages.length > 0) {
|
||||
console.log();
|
||||
for (let message of messages){
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,443 @@
|
||||
// AST walker module for Mozilla Parser API compatible trees
|
||||
|
||||
// A simple walk is one where you simply specify callbacks to be
|
||||
// called on specific nodes. The last two arguments are optional. A
|
||||
// simple use would be
|
||||
//
|
||||
// walk.simple(myTree, {
|
||||
// Expression: function(node) { ... }
|
||||
// });
|
||||
//
|
||||
// to do something with all expressions. All Parser API node types
|
||||
// can be used to identify node types, as well as Expression and
|
||||
// Statement, which denote categories of nodes.
|
||||
//
|
||||
// The base argument can be used to pass a custom (recursive)
|
||||
// walker, and state can be used to give this walked an initial
|
||||
// state.
|
||||
|
||||
function simple(node, visitors, baseVisitor, state, override) {
|
||||
if (!baseVisitor) { baseVisitor = base
|
||||
; }(function c(node, st, override) {
|
||||
var type = override || node.type, found = visitors[type];
|
||||
baseVisitor[type](node, st, c);
|
||||
if (found) { found(node, st); }
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
// An ancestor walk keeps an array of ancestor nodes (including the
|
||||
// current node) and passes them to the callback as third parameter
|
||||
// (and also as state parameter when no other state is present).
|
||||
function ancestor(node, visitors, baseVisitor, state, override) {
|
||||
var ancestors = [];
|
||||
if (!baseVisitor) { baseVisitor = base
|
||||
; }(function c(node, st, override) {
|
||||
var type = override || node.type, found = visitors[type];
|
||||
var isNew = node !== ancestors[ancestors.length - 1];
|
||||
if (isNew) { ancestors.push(node); }
|
||||
baseVisitor[type](node, st, c);
|
||||
if (found) { found(node, st || ancestors, ancestors); }
|
||||
if (isNew) { ancestors.pop(); }
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
// A recursive walk is one where your functions override the default
|
||||
// walkers. They can modify and replace the state parameter that's
|
||||
// threaded through the walk, and can opt how and whether to walk
|
||||
// their child nodes (by calling their third argument on these
|
||||
// nodes).
|
||||
function recursive(node, state, funcs, baseVisitor, override) {
|
||||
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor
|
||||
;(function c(node, st, override) {
|
||||
visitor[override || node.type](node, st, c);
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
function makeTest(test) {
|
||||
if (typeof test === "string")
|
||||
{ return function (type) { return type === test; } }
|
||||
else if (!test)
|
||||
{ return function () { return true; } }
|
||||
else
|
||||
{ return test }
|
||||
}
|
||||
|
||||
var Found = function Found(node, state) { this.node = node; this.state = state; };
|
||||
|
||||
// A full walk triggers the callback on each node
|
||||
function full(node, callback, baseVisitor, state, override) {
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
var last
|
||||
;(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
baseVisitor[type](node, st, c);
|
||||
if (last !== node) {
|
||||
callback(node, st, type);
|
||||
last = node;
|
||||
}
|
||||
})(node, state, override);
|
||||
}
|
||||
|
||||
// An fullAncestor walk is like an ancestor walk, but triggers
|
||||
// the callback on each node
|
||||
function fullAncestor(node, callback, baseVisitor, state) {
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
var ancestors = [], last
|
||||
;(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
var isNew = node !== ancestors[ancestors.length - 1];
|
||||
if (isNew) { ancestors.push(node); }
|
||||
baseVisitor[type](node, st, c);
|
||||
if (last !== node) {
|
||||
callback(node, st || ancestors, ancestors, type);
|
||||
last = node;
|
||||
}
|
||||
if (isNew) { ancestors.pop(); }
|
||||
})(node, state);
|
||||
}
|
||||
|
||||
// Find a node with a given start, end, and type (all are optional,
|
||||
// null can be used as wildcard). Returns a {node, state} object, or
|
||||
// undefined when it doesn't find a matching node.
|
||||
function findNodeAt(node, start, end, test, baseVisitor, state) {
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
test = makeTest(test);
|
||||
try {
|
||||
(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
if ((start == null || node.start <= start) &&
|
||||
(end == null || node.end >= end))
|
||||
{ baseVisitor[type](node, st, c); }
|
||||
if ((start == null || node.start === start) &&
|
||||
(end == null || node.end === end) &&
|
||||
test(type, node))
|
||||
{ throw new Found(node, st) }
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) { return e }
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the innermost node of a given type that contains the given
|
||||
// position. Interface similar to findNodeAt.
|
||||
function findNodeAround(node, pos, test, baseVisitor, state) {
|
||||
test = makeTest(test);
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
try {
|
||||
(function c(node, st, override) {
|
||||
var type = override || node.type;
|
||||
if (node.start > pos || node.end < pos) { return }
|
||||
baseVisitor[type](node, st, c);
|
||||
if (test(type, node)) { throw new Found(node, st) }
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) { return e }
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the outermost matching node after a given position.
|
||||
function findNodeAfter(node, pos, test, baseVisitor, state) {
|
||||
test = makeTest(test);
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
try {
|
||||
(function c(node, st, override) {
|
||||
if (node.end < pos) { return }
|
||||
var type = override || node.type;
|
||||
if (node.start >= pos && test(type, node)) { throw new Found(node, st) }
|
||||
baseVisitor[type](node, st, c);
|
||||
})(node, state);
|
||||
} catch (e) {
|
||||
if (e instanceof Found) { return e }
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
// Find the outermost matching node before a given position.
|
||||
function findNodeBefore(node, pos, test, baseVisitor, state) {
|
||||
test = makeTest(test);
|
||||
if (!baseVisitor) { baseVisitor = base; }
|
||||
var max
|
||||
;(function c(node, st, override) {
|
||||
if (node.start > pos) { return }
|
||||
var type = override || node.type;
|
||||
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
|
||||
{ max = new Found(node, st); }
|
||||
baseVisitor[type](node, st, c);
|
||||
})(node, state);
|
||||
return max
|
||||
}
|
||||
|
||||
// Used to create a custom walker. Will fill in all missing node
|
||||
// type properties with the defaults.
|
||||
function make(funcs, baseVisitor) {
|
||||
var visitor = Object.create(baseVisitor || base);
|
||||
for (var type in funcs) { visitor[type] = funcs[type]; }
|
||||
return visitor
|
||||
}
|
||||
|
||||
function skipThrough(node, st, c) { c(node, st); }
|
||||
function ignore(_node, _st, _c) {}
|
||||
|
||||
// Node walkers.
|
||||
|
||||
var base = {};
|
||||
|
||||
base.Program = base.BlockStatement = base.StaticBlock = function (node, st, c) {
|
||||
for (var i = 0, list = node.body; i < list.length; i += 1)
|
||||
{
|
||||
var stmt = list[i];
|
||||
|
||||
c(stmt, st, "Statement");
|
||||
}
|
||||
};
|
||||
base.Statement = skipThrough;
|
||||
base.EmptyStatement = ignore;
|
||||
base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression =
|
||||
function (node, st, c) { return c(node.expression, st, "Expression"); };
|
||||
base.IfStatement = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.consequent, st, "Statement");
|
||||
if (node.alternate) { c(node.alternate, st, "Statement"); }
|
||||
};
|
||||
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
|
||||
base.BreakStatement = base.ContinueStatement = ignore;
|
||||
base.WithStatement = function (node, st, c) {
|
||||
c(node.object, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.SwitchStatement = function (node, st, c) {
|
||||
c(node.discriminant, st, "Expression");
|
||||
for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
|
||||
var cs = list$1[i$1];
|
||||
|
||||
if (cs.test) { c(cs.test, st, "Expression"); }
|
||||
for (var i = 0, list = cs.consequent; i < list.length; i += 1)
|
||||
{
|
||||
var cons = list[i];
|
||||
|
||||
c(cons, st, "Statement");
|
||||
}
|
||||
}
|
||||
};
|
||||
base.SwitchCase = function (node, st, c) {
|
||||
if (node.test) { c(node.test, st, "Expression"); }
|
||||
for (var i = 0, list = node.consequent; i < list.length; i += 1)
|
||||
{
|
||||
var cons = list[i];
|
||||
|
||||
c(cons, st, "Statement");
|
||||
}
|
||||
};
|
||||
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
|
||||
if (node.argument) { c(node.argument, st, "Expression"); }
|
||||
};
|
||||
base.ThrowStatement = base.SpreadElement =
|
||||
function (node, st, c) { return c(node.argument, st, "Expression"); };
|
||||
base.TryStatement = function (node, st, c) {
|
||||
c(node.block, st, "Statement");
|
||||
if (node.handler) { c(node.handler, st); }
|
||||
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
|
||||
};
|
||||
base.CatchClause = function (node, st, c) {
|
||||
if (node.param) { c(node.param, st, "Pattern"); }
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForStatement = function (node, st, c) {
|
||||
if (node.init) { c(node.init, st, "ForInit"); }
|
||||
if (node.test) { c(node.test, st, "Expression"); }
|
||||
if (node.update) { c(node.update, st, "Expression"); }
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
|
||||
c(node.left, st, "ForInit");
|
||||
c(node.right, st, "Expression");
|
||||
c(node.body, st, "Statement");
|
||||
};
|
||||
base.ForInit = function (node, st, c) {
|
||||
if (node.type === "VariableDeclaration") { c(node, st); }
|
||||
else { c(node, st, "Expression"); }
|
||||
};
|
||||
base.DebuggerStatement = ignore;
|
||||
|
||||
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
|
||||
base.VariableDeclaration = function (node, st, c) {
|
||||
for (var i = 0, list = node.declarations; i < list.length; i += 1)
|
||||
{
|
||||
var decl = list[i];
|
||||
|
||||
c(decl, st);
|
||||
}
|
||||
};
|
||||
base.VariableDeclarator = function (node, st, c) {
|
||||
c(node.id, st, "Pattern");
|
||||
if (node.init) { c(node.init, st, "Expression"); }
|
||||
};
|
||||
|
||||
base.Function = function (node, st, c) {
|
||||
if (node.id) { c(node.id, st, "Pattern"); }
|
||||
for (var i = 0, list = node.params; i < list.length; i += 1)
|
||||
{
|
||||
var param = list[i];
|
||||
|
||||
c(param, st, "Pattern");
|
||||
}
|
||||
c(node.body, st, node.expression ? "Expression" : "Statement");
|
||||
};
|
||||
|
||||
base.Pattern = function (node, st, c) {
|
||||
if (node.type === "Identifier")
|
||||
{ c(node, st, "VariablePattern"); }
|
||||
else if (node.type === "MemberExpression")
|
||||
{ c(node, st, "MemberPattern"); }
|
||||
else
|
||||
{ c(node, st); }
|
||||
};
|
||||
base.VariablePattern = ignore;
|
||||
base.MemberPattern = skipThrough;
|
||||
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
|
||||
base.ArrayPattern = function (node, st, c) {
|
||||
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
||||
var elt = list[i];
|
||||
|
||||
if (elt) { c(elt, st, "Pattern"); }
|
||||
}
|
||||
};
|
||||
base.ObjectPattern = function (node, st, c) {
|
||||
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
||||
var prop = list[i];
|
||||
|
||||
if (prop.type === "Property") {
|
||||
if (prop.computed) { c(prop.key, st, "Expression"); }
|
||||
c(prop.value, st, "Pattern");
|
||||
} else if (prop.type === "RestElement") {
|
||||
c(prop.argument, st, "Pattern");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
base.Expression = skipThrough;
|
||||
base.ThisExpression = base.Super = base.MetaProperty = ignore;
|
||||
base.ArrayExpression = function (node, st, c) {
|
||||
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
||||
var elt = list[i];
|
||||
|
||||
if (elt) { c(elt, st, "Expression"); }
|
||||
}
|
||||
};
|
||||
base.ObjectExpression = function (node, st, c) {
|
||||
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
||||
{
|
||||
var prop = list[i];
|
||||
|
||||
c(prop, st);
|
||||
}
|
||||
};
|
||||
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
|
||||
base.SequenceExpression = function (node, st, c) {
|
||||
for (var i = 0, list = node.expressions; i < list.length; i += 1)
|
||||
{
|
||||
var expr = list[i];
|
||||
|
||||
c(expr, st, "Expression");
|
||||
}
|
||||
};
|
||||
base.TemplateLiteral = function (node, st, c) {
|
||||
for (var i = 0, list = node.quasis; i < list.length; i += 1)
|
||||
{
|
||||
var quasi = list[i];
|
||||
|
||||
c(quasi, st);
|
||||
}
|
||||
|
||||
for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
|
||||
{
|
||||
var expr = list$1[i$1];
|
||||
|
||||
c(expr, st, "Expression");
|
||||
}
|
||||
};
|
||||
base.TemplateElement = ignore;
|
||||
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
|
||||
c(node.argument, st, "Expression");
|
||||
};
|
||||
base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
|
||||
c(node.left, st, "Expression");
|
||||
c(node.right, st, "Expression");
|
||||
};
|
||||
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
|
||||
c(node.left, st, "Pattern");
|
||||
c(node.right, st, "Expression");
|
||||
};
|
||||
base.ConditionalExpression = function (node, st, c) {
|
||||
c(node.test, st, "Expression");
|
||||
c(node.consequent, st, "Expression");
|
||||
c(node.alternate, st, "Expression");
|
||||
};
|
||||
base.NewExpression = base.CallExpression = function (node, st, c) {
|
||||
c(node.callee, st, "Expression");
|
||||
if (node.arguments)
|
||||
{ for (var i = 0, list = node.arguments; i < list.length; i += 1)
|
||||
{
|
||||
var arg = list[i];
|
||||
|
||||
c(arg, st, "Expression");
|
||||
} }
|
||||
};
|
||||
base.MemberExpression = function (node, st, c) {
|
||||
c(node.object, st, "Expression");
|
||||
if (node.computed) { c(node.property, st, "Expression"); }
|
||||
};
|
||||
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
|
||||
if (node.declaration)
|
||||
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
|
||||
if (node.source) { c(node.source, st, "Expression"); }
|
||||
};
|
||||
base.ExportAllDeclaration = function (node, st, c) {
|
||||
if (node.exported)
|
||||
{ c(node.exported, st); }
|
||||
c(node.source, st, "Expression");
|
||||
};
|
||||
base.ImportDeclaration = function (node, st, c) {
|
||||
for (var i = 0, list = node.specifiers; i < list.length; i += 1)
|
||||
{
|
||||
var spec = list[i];
|
||||
|
||||
c(spec, st);
|
||||
}
|
||||
c(node.source, st, "Expression");
|
||||
};
|
||||
base.ImportExpression = function (node, st, c) {
|
||||
c(node.source, st, "Expression");
|
||||
};
|
||||
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore;
|
||||
|
||||
base.TaggedTemplateExpression = function (node, st, c) {
|
||||
c(node.tag, st, "Expression");
|
||||
c(node.quasi, st, "Expression");
|
||||
};
|
||||
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
|
||||
base.Class = function (node, st, c) {
|
||||
if (node.id) { c(node.id, st, "Pattern"); }
|
||||
if (node.superClass) { c(node.superClass, st, "Expression"); }
|
||||
c(node.body, st);
|
||||
};
|
||||
base.ClassBody = function (node, st, c) {
|
||||
for (var i = 0, list = node.body; i < list.length; i += 1)
|
||||
{
|
||||
var elt = list[i];
|
||||
|
||||
c(elt, st);
|
||||
}
|
||||
};
|
||||
base.MethodDefinition = base.PropertyDefinition = base.Property = function (node, st, c) {
|
||||
if (node.computed) { c(node.key, st, "Expression"); }
|
||||
if (node.value) { c(node.value, st, "Expression"); }
|
||||
};
|
||||
|
||||
export { ancestor, base, findNodeAfter, findNodeAround, findNodeAt, findNodeBefore, full, fullAncestor, make, recursive, simple };
|
||||
@@ -0,0 +1,8 @@
|
||||
export var config = {
|
||||
onUnhandledError: null,
|
||||
onStoppedNotification: null,
|
||||
Promise: undefined,
|
||||
useDeprecatedSynchronousErrorHandling: false,
|
||||
useDeprecatedNextContext: false,
|
||||
};
|
||||
//# sourceMappingURL=config.js.map
|
||||
@@ -0,0 +1,153 @@
|
||||
import { MonoTypeOperatorFunction, Observer } from '../types';
|
||||
import { isFunction } from '../util/isFunction';
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
import { identity } from '../util/identity';
|
||||
|
||||
export interface TapObserver<T> extends Observer<T> {
|
||||
subscribe: () => void;
|
||||
unsubscribe: () => void;
|
||||
finalize: () => void;
|
||||
}
|
||||
export function tap<T>(observerOrNext?: Partial<TapObserver<T>> | ((value: T) => void)): MonoTypeOperatorFunction<T>;
|
||||
/** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */
|
||||
export function tap<T>(
|
||||
next?: ((value: T) => void) | null,
|
||||
error?: ((error: any) => void) | null,
|
||||
complete?: (() => void) | null
|
||||
): MonoTypeOperatorFunction<T>;
|
||||
|
||||
/**
|
||||
* Used to perform side-effects for notifications from the source observable
|
||||
*
|
||||
* <span class="informal">Used when you want to affect outside state with a notification without altering the notification</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Tap is designed to allow the developer a designated place to perform side effects. While you _could_ perform side-effects
|
||||
* inside of a `map` or a `mergeMap`, that would make their mapping functions impure, which isn't always a big deal, but will
|
||||
* make it so you can't do things like memoize those functions. The `tap` operator is designed solely for such side-effects to
|
||||
* help you remove side-effects from other operations.
|
||||
*
|
||||
* For any notification, next, error, or complete, `tap` will call the appropriate callback you have provided to it, via a function
|
||||
* reference, or a partial observer, then pass that notification down the stream.
|
||||
*
|
||||
* The observable returned by `tap` is an exact mirror of the source, with one exception: Any error that occurs -- synchronously -- in a handler
|
||||
* provided to `tap` will be emitted as an error from the returned observable.
|
||||
*
|
||||
* > Be careful! You can mutate objects as they pass through the `tap` operator's handlers.
|
||||
*
|
||||
* The most common use of `tap` is actually for debugging. You can place a `tap(console.log)` anywhere
|
||||
* in your observable `pipe`, log out the notifications as they are emitted by the source returned by the previous
|
||||
* operation.
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Check a random number before it is handled. Below is an observable that will use a random number between 0 and 1,
|
||||
* and emit `'big'` or `'small'` depending on the size of that number. But we wanted to log what the original number
|
||||
* was, so we have added a `tap(console.log)`.
|
||||
*
|
||||
* ```ts
|
||||
* import { of, tap, map } from 'rxjs';
|
||||
*
|
||||
* of(Math.random()).pipe(
|
||||
* tap(console.log),
|
||||
* map(n => n > 0.5 ? 'big' : 'small')
|
||||
* ).subscribe(console.log);
|
||||
* ```
|
||||
*
|
||||
* Using `tap` to analyze a value and force an error. Below is an observable where in our system we only
|
||||
* want to emit numbers 3 or less we get from another source. We can force our observable to error
|
||||
* using `tap`.
|
||||
*
|
||||
* ```ts
|
||||
* import { of, tap } from 'rxjs';
|
||||
*
|
||||
* const source = of(1, 2, 3, 4, 5);
|
||||
*
|
||||
* source.pipe(
|
||||
* tap(n => {
|
||||
* if (n > 3) {
|
||||
* throw new TypeError(`Value ${ n } is greater than 3`);
|
||||
* }
|
||||
* })
|
||||
* )
|
||||
* .subscribe({ next: console.log, error: err => console.log(err.message) });
|
||||
* ```
|
||||
*
|
||||
* We want to know when an observable completes before moving on to the next observable. The system
|
||||
* below will emit a random series of `'X'` characters from 3 different observables in sequence. The
|
||||
* only way we know when one observable completes and moves to the next one, in this case, is because
|
||||
* we have added a `tap` with the side effect of logging to console.
|
||||
*
|
||||
* ```ts
|
||||
* import { of, concatMap, interval, take, map, tap } from 'rxjs';
|
||||
*
|
||||
* of(1, 2, 3).pipe(
|
||||
* concatMap(n => interval(1000).pipe(
|
||||
* take(Math.round(Math.random() * 10)),
|
||||
* map(() => 'X'),
|
||||
* tap({ complete: () => console.log(`Done with ${ n }`) })
|
||||
* ))
|
||||
* )
|
||||
* .subscribe(console.log);
|
||||
* ```
|
||||
*
|
||||
* @see {@link finalize}
|
||||
* @see {@link Observable#subscribe}
|
||||
*
|
||||
* @param observerOrNext A next handler or partial observer
|
||||
* @param error An error handler
|
||||
* @param complete A completion handler
|
||||
* @return A function that returns an Observable identical to the source, but
|
||||
* runs the specified Observer or callback(s) for each item.
|
||||
*/
|
||||
export function tap<T>(
|
||||
observerOrNext?: Partial<TapObserver<T>> | ((value: T) => void) | null,
|
||||
error?: ((e: any) => void) | null,
|
||||
complete?: (() => void) | null
|
||||
): MonoTypeOperatorFunction<T> {
|
||||
// We have to check to see not only if next is a function,
|
||||
// but if error or complete were passed. This is because someone
|
||||
// could technically call tap like `tap(null, fn)` or `tap(null, null, fn)`.
|
||||
const tapObserver =
|
||||
isFunction(observerOrNext) || error || complete
|
||||
? // tslint:disable-next-line: no-object-literal-type-assertion
|
||||
({ next: observerOrNext as Exclude<typeof observerOrNext, Partial<TapObserver<T>>>, error, complete } as Partial<TapObserver<T>>)
|
||||
: observerOrNext;
|
||||
|
||||
return tapObserver
|
||||
? operate((source, subscriber) => {
|
||||
tapObserver.subscribe?.();
|
||||
let isUnsub = true;
|
||||
source.subscribe(
|
||||
createOperatorSubscriber(
|
||||
subscriber,
|
||||
(value) => {
|
||||
tapObserver.next?.(value);
|
||||
subscriber.next(value);
|
||||
},
|
||||
() => {
|
||||
isUnsub = false;
|
||||
tapObserver.complete?.();
|
||||
subscriber.complete();
|
||||
},
|
||||
(err) => {
|
||||
isUnsub = false;
|
||||
tapObserver.error?.(err);
|
||||
subscriber.error(err);
|
||||
},
|
||||
() => {
|
||||
if (isUnsub) {
|
||||
tapObserver.unsubscribe?.();
|
||||
}
|
||||
tapObserver.finalize?.();
|
||||
}
|
||||
)
|
||||
);
|
||||
})
|
||||
: // Tap was called with no valid tap observer or handler
|
||||
// (e.g. `tap(null, null, null)` or `tap(null)` or `tap()`)
|
||||
// so we're going to just mirror the source.
|
||||
identity;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var easing = require('../easing/index.js');
|
||||
var internal = require('../internal/index.js');
|
||||
|
||||
function flip(node, { from, to }, params = {}) {
|
||||
const style = getComputedStyle(node);
|
||||
const transform = style.transform === 'none' ? '' : style.transform;
|
||||
const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat);
|
||||
const dx = (from.left + from.width * ox / to.width) - (to.left + ox);
|
||||
const dy = (from.top + from.height * oy / to.height) - (to.top + oy);
|
||||
const { delay = 0, duration = (d) => Math.sqrt(d) * 120, easing: easing$1 = easing.cubicOut } = params;
|
||||
return {
|
||||
delay,
|
||||
duration: internal.is_function(duration) ? duration(Math.sqrt(dx * dx + dy * dy)) : duration,
|
||||
easing: easing$1,
|
||||
css: (t, u) => {
|
||||
const x = u * dx;
|
||||
const y = u * dy;
|
||||
const sx = t + u * from.width / to.width;
|
||||
const sy = t + u * from.height / to.height;
|
||||
return `transform: ${transform} translate(${x}px, ${y}px) scale(${sx}, ${sy});`;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.flip = flip;
|
||||
@@ -0,0 +1,49 @@
|
||||
/// <reference types="node" />
|
||||
import { Readable } from 'stream';
|
||||
import { FindProxyForURL } from 'pac-resolver';
|
||||
import { Agent, AgentCallbackReturn, ClientRequest, RequestOptions } from 'agent-base';
|
||||
import { PacProxyAgentOptions } from '.';
|
||||
/**
|
||||
* The `PacProxyAgent` class.
|
||||
*
|
||||
* A few different "protocol" modes are supported (supported protocols are
|
||||
* backed by the `get-uri` module):
|
||||
*
|
||||
* - "pac+data", "data" - refers to an embedded "data:" URI
|
||||
* - "pac+file", "file" - refers to a local file
|
||||
* - "pac+ftp", "ftp" - refers to a file located on an FTP server
|
||||
* - "pac+http", "http" - refers to an HTTP endpoint
|
||||
* - "pac+https", "https" - refers to an HTTPS endpoint
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
export default class PacProxyAgent extends Agent {
|
||||
uri: string;
|
||||
opts: PacProxyAgentOptions;
|
||||
cache?: Readable;
|
||||
resolver?: FindProxyForURL;
|
||||
resolverHash: string;
|
||||
resolverPromise?: Promise<FindProxyForURL>;
|
||||
constructor(uri: string, opts?: PacProxyAgentOptions);
|
||||
private clearResolverPromise;
|
||||
/**
|
||||
* Loads the PAC proxy file from the source if necessary, and returns
|
||||
* a generated `FindProxyForURL()` resolver function to use.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
private getResolver;
|
||||
private loadResolver;
|
||||
/**
|
||||
* Loads the contents of the PAC proxy file.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
private loadPacFile;
|
||||
/**
|
||||
* Called when the node-core HTTP client library is creating a new HTTP request.
|
||||
*
|
||||
* @api protected
|
||||
*/
|
||||
callback(req: ClientRequest, opts: RequestOptions): Promise<AgentCallbackReturn>;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import type {Subtract} from './internal';
|
||||
import type {IsEqual} from './is-equal';
|
||||
|
||||
type Recursive<T> = ReadonlyArray<Recursive<T>>;
|
||||
|
||||
/**
|
||||
Creates a type that represents a multidimensional readonly array that of the given type and dimension.
|
||||
|
||||
Use-cases:
|
||||
- Return a n-dimensional array from functions.
|
||||
- Declare a n-dimensional array by defining its dimensions rather than declaring `[]` repetitively.
|
||||
- Infer the dimensions of a n-dimensional array automatically from function arguments.
|
||||
- Avoid the need to know in advance the dimensions of a n-dimensional array allowing them to be dynamic.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {MultidimensionalReadonlyArray} from 'type-fest';
|
||||
|
||||
function emptyMatrix<T extends number>(dimensions: T): MultidimensionalReadonlyArray<unknown, T> {
|
||||
const matrix: unknown[] = [];
|
||||
|
||||
let subMatrix = matrix;
|
||||
for (let dimension = 1; dimension < dimensions; ++dimension) {
|
||||
console.log(`Initializing dimension #${dimension}`);
|
||||
|
||||
subMatrix[0] = [];
|
||||
if (dimension < dimensions - 1) {
|
||||
subMatrix = subMatrix[0] as unknown[];
|
||||
} else {
|
||||
subMatrix[0] = 42;
|
||||
}
|
||||
}
|
||||
|
||||
return matrix as MultidimensionalReadonlyArray<unknown, T>;
|
||||
}
|
||||
|
||||
const matrix = emptyMatrix(3);
|
||||
|
||||
const answer = matrix[0][0][0]; // 42
|
||||
```
|
||||
|
||||
@category Array
|
||||
*/
|
||||
export type MultidimensionalReadonlyArray<Element, Dimensions extends number> = number extends Dimensions
|
||||
? Recursive<Element>
|
||||
: IsEqual<Dimensions, 0> extends true
|
||||
? Element
|
||||
: ReadonlyArray<MultidimensionalReadonlyArray<Element, Subtract<Dimensions, 1>>>;
|
||||
@@ -0,0 +1,21 @@
|
||||
import {OptionalKeysOf} from './optional-keys-of';
|
||||
|
||||
/**
|
||||
Creates a type that represents `true` or `false` depending on whether the given type has any optional fields.
|
||||
|
||||
This is useful when you want to create an API whose behavior depends on the presence or absence of optional fields.
|
||||
|
||||
@example
|
||||
```
|
||||
import type {HasOptionalKeys, OptionalKeysOf} from 'type-fest';
|
||||
|
||||
type UpdateService<Entity extends object> = {
|
||||
removeField: HasOptionalKeys<Entity> extends true
|
||||
? (field: OptionalKeysOf<Entity>) => Promise<void>
|
||||
: never
|
||||
}
|
||||
```
|
||||
|
||||
@category Utilities
|
||||
*/
|
||||
export type HasOptionalKeys<BaseType extends object> = OptionalKeysOf<BaseType> extends never ? false : true;
|
||||
@@ -0,0 +1,12 @@
|
||||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('deep', function (t) {
|
||||
t.plan(4);
|
||||
var obj = [[[[[[500]]]]]];
|
||||
t.equal(inspect(obj), '[ [ [ [ [ [Array] ] ] ] ] ]');
|
||||
t.equal(inspect(obj, { depth: 4 }), '[ [ [ [ [Array] ] ] ] ]');
|
||||
t.equal(inspect(obj, { depth: 2 }), '[ [ [Array] ] ]');
|
||||
|
||||
t.equal(inspect([[[{ a: 1 }]]], { depth: 3 }), '[ [ [ [Object] ] ] ]');
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
import { OperatorFunction } from '../types';
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
|
||||
/**
|
||||
* Emits `false` if the input Observable emits any values, or emits `true` if the
|
||||
* input Observable completes without emitting any values.
|
||||
*
|
||||
* <span class="informal">Tells whether any values are emitted by an Observable.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* `isEmpty` transforms an Observable that emits values into an Observable that
|
||||
* emits a single boolean value representing whether or not any values were
|
||||
* emitted by the source Observable. As soon as the source Observable emits a
|
||||
* value, `isEmpty` will emit a `false` and complete. If the source Observable
|
||||
* completes having not emitted anything, `isEmpty` will emit a `true` and
|
||||
* complete.
|
||||
*
|
||||
* A similar effect could be achieved with {@link count}, but `isEmpty` can emit
|
||||
* a `false` value sooner.
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Emit `false` for a non-empty Observable
|
||||
*
|
||||
* ```ts
|
||||
* import { Subject, isEmpty } from 'rxjs';
|
||||
*
|
||||
* const source = new Subject<string>();
|
||||
* const result = source.pipe(isEmpty());
|
||||
*
|
||||
* source.subscribe(x => console.log(x));
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* source.next('a');
|
||||
* source.next('b');
|
||||
* source.next('c');
|
||||
* source.complete();
|
||||
*
|
||||
* // Outputs
|
||||
* // 'a'
|
||||
* // false
|
||||
* // 'b'
|
||||
* // 'c'
|
||||
* ```
|
||||
*
|
||||
* Emit `true` for an empty Observable
|
||||
*
|
||||
* ```ts
|
||||
* import { EMPTY, isEmpty } from 'rxjs';
|
||||
*
|
||||
* const result = EMPTY.pipe(isEmpty());
|
||||
* result.subscribe(x => console.log(x));
|
||||
*
|
||||
* // Outputs
|
||||
* // true
|
||||
* ```
|
||||
*
|
||||
* @see {@link count}
|
||||
* @see {@link EMPTY}
|
||||
*
|
||||
* @return A function that returns an Observable that emits boolean value
|
||||
* indicating whether the source Observable was empty or not.
|
||||
*/
|
||||
export function isEmpty<T>(): OperatorFunction<T, boolean> {
|
||||
return operate((source, subscriber) => {
|
||||
source.subscribe(
|
||||
createOperatorSubscriber(
|
||||
subscriber,
|
||||
() => {
|
||||
subscriber.next(false);
|
||||
subscriber.complete();
|
||||
},
|
||||
() => {
|
||||
subscriber.next(true);
|
||||
subscriber.complete();
|
||||
}
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import { Subscription } from '../Subscription';
|
||||
import { operate } from '../util/lift';
|
||||
import { innerFrom } from '../observable/innerFrom';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
import { noop } from '../util/noop';
|
||||
import { arrRemove } from '../util/arrRemove';
|
||||
export function bufferToggle(openings, closingSelector) {
|
||||
return operate((source, subscriber) => {
|
||||
const buffers = [];
|
||||
innerFrom(openings).subscribe(createOperatorSubscriber(subscriber, (openValue) => {
|
||||
const buffer = [];
|
||||
buffers.push(buffer);
|
||||
const closingSubscription = new Subscription();
|
||||
const emitBuffer = () => {
|
||||
arrRemove(buffers, buffer);
|
||||
subscriber.next(buffer);
|
||||
closingSubscription.unsubscribe();
|
||||
};
|
||||
closingSubscription.add(innerFrom(closingSelector(openValue)).subscribe(createOperatorSubscriber(subscriber, emitBuffer, noop)));
|
||||
}, noop));
|
||||
source.subscribe(createOperatorSubscriber(subscriber, (value) => {
|
||||
for (const buffer of buffers) {
|
||||
buffer.push(value);
|
||||
}
|
||||
}, () => {
|
||||
while (buffers.length > 0) {
|
||||
subscriber.next(buffers.shift());
|
||||
}
|
||||
subscriber.complete();
|
||||
}));
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=bufferToggle.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require('./head');
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bufferWhen.js","sourceRoot":"","sources":["../../../../src/internal/operators/bufferWhen.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAwCpD,MAAM,UAAU,UAAU,CAAI,eAA2C;IACvE,OAAO,OAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAEhC,IAAI,MAAM,GAAe,IAAI,CAAC;QAI9B,IAAI,iBAAiB,GAAyB,IAAI,CAAC;QAMnD,IAAM,UAAU,GAAG;YAGjB,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,WAAW,EAAE,CAAC;YAEjC,IAAM,CAAC,GAAG,MAAM,CAAC;YACjB,MAAM,GAAG,EAAE,CAAC;YACZ,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAGxB,SAAS,CAAC,eAAe,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,iBAAiB,GAAG,wBAAwB,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QACvH,CAAC,CAAC;QAGF,UAAU,EAAE,CAAC;QAGb,MAAM,CAAC,SAAS,CACd,wBAAwB,CACtB,UAAU,EAEV,UAAC,KAAK,IAAK,OAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,KAAK,CAAC,EAAnB,CAAmB,EAG9B;YACE,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAClC,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC,EAED,SAAS,EAET,cAAM,OAAA,CAAC,MAAM,GAAG,iBAAiB,GAAG,IAAK,CAAC,EAApC,CAAoC,CAC3C,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,110 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/dist</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> csv2json/dist
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/13762</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/11883</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/2950</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/8549</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 low'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file low" data-value="csvtojson.js"><a href="csvtojson.js.html">csvtojson.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="8755" class="abs low">0/8755</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="6057" class="abs low">0/6057</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1477" class="abs low">0/1477</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="8543" class="abs low">0/8543</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="csvtojson.min.js"><a href="csvtojson.min.js.html">csvtojson.min.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="5007" class="abs low">0/5007</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="5826" class="abs low">0/5826</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1473" class="abs low">0/1473</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="6" class="abs low">0/6</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><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 Fri May 11 2018 21:20:20 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>
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,273 @@
|
||||
# Acorn
|
||||
|
||||
A tiny, fast JavaScript parser written in JavaScript.
|
||||
|
||||
## Community
|
||||
|
||||
Acorn is open source software released under an
|
||||
[MIT license](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE).
|
||||
|
||||
You are welcome to
|
||||
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
|
||||
requests on [github](https://github.com/acornjs/acorn). For questions
|
||||
and discussion, please use the
|
||||
[Tern discussion forum](https://discuss.ternjs.net).
|
||||
|
||||
## Installation
|
||||
|
||||
The easiest way to install acorn is from [`npm`](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
npm install acorn
|
||||
```
|
||||
|
||||
Alternately, you can download the source and build acorn yourself:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/acornjs/acorn.git
|
||||
cd acorn
|
||||
npm install
|
||||
```
|
||||
|
||||
## Interface
|
||||
|
||||
**parse**`(input, options)` is the main interface to the library. The
|
||||
`input` parameter is a string, `options` must be an object setting
|
||||
some of the options listed below. The return value will be an abstract
|
||||
syntax tree object as specified by the [ESTree
|
||||
spec](https://github.com/estree/estree).
|
||||
|
||||
```javascript
|
||||
let acorn = require("acorn");
|
||||
console.log(acorn.parse("1 + 1", {ecmaVersion: 2020}));
|
||||
```
|
||||
|
||||
When encountering a syntax error, the parser will raise a
|
||||
`SyntaxError` object with a meaningful message. The error object will
|
||||
have a `pos` property that indicates the string offset at which the
|
||||
error occurred, and a `loc` object that contains a `{line, column}`
|
||||
object referring to that same position.
|
||||
|
||||
Options are provided by in a second argument, which should be an
|
||||
object containing any of these fields (only `ecmaVersion` is
|
||||
required):
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||
either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019),
|
||||
11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"` (the
|
||||
latest the library supports). This influences support for strict
|
||||
mode, the set of reserved words, and support for new syntax
|
||||
features.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features must be
|
||||
implemented through plugins.
|
||||
|
||||
- **sourceType**: Indicate the mode the code should be parsed in. Can be
|
||||
either `"script"` or `"module"`. This influences global strict mode
|
||||
and parsing of `import` and `export` declarations.
|
||||
|
||||
**NOTE**: If set to `"module"`, then static `import` / `export` syntax
|
||||
will be valid, even if `ecmaVersion` is less than 6.
|
||||
|
||||
- **onInsertedSemicolon**: If given a callback, that callback will be
|
||||
called whenever a missing semicolon is inserted by the parser. The
|
||||
callback will be given the character offset of the point where the
|
||||
semicolon is inserted as argument, and if `locations` is on, also a
|
||||
`{line, column}` object representing this position.
|
||||
|
||||
- **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing
|
||||
commas.
|
||||
|
||||
- **allowReserved**: If `false`, using a reserved word will generate
|
||||
an error. Defaults to `true` for `ecmaVersion` 3, `false` for higher
|
||||
versions. When given the value `"never"`, reserved words and
|
||||
keywords can also not be used as property names (as in Internet
|
||||
Explorer's old parser).
|
||||
|
||||
- **allowReturnOutsideFunction**: By default, a return statement at
|
||||
the top level raises an error. Set this to `true` to accept such
|
||||
code.
|
||||
|
||||
- **allowImportExportEverywhere**: By default, `import` and `export`
|
||||
declarations can only appear at a program's top level. Setting this
|
||||
option to `true` allows them anywhere where a statement is allowed,
|
||||
and also allows `import.meta` expressions to appear in scripts
|
||||
(when `sourceType` is not `"module"`).
|
||||
|
||||
- **allowAwaitOutsideFunction**: If `false`, `await` expressions can
|
||||
only appear inside `async` functions. Defaults to `true` for
|
||||
`ecmaVersion` 2022 and later, `false` for lower versions. Setting this option to
|
||||
`true` allows to have top-level `await` expressions. They are
|
||||
still not allowed in non-`async` functions, though.
|
||||
|
||||
- **allowSuperOutsideMethod**: By default, `super` outside a method
|
||||
raises an error. Set this to `true` to accept such code.
|
||||
|
||||
- **allowHashBang**: When this is enabled, if the code starts with the
|
||||
characters `#!` (as in a shellscript), the first line will be
|
||||
treated as a comment. Defaults to true when `ecmaVersion` >= 2023.
|
||||
|
||||
- **locations**: When `true`, each node has a `loc` object attached
|
||||
with `start` and `end` subobjects, each of which contains the
|
||||
one-based line and zero-based column numbers in `{line, column}`
|
||||
form. Default is `false`.
|
||||
|
||||
- **onToken**: If a function is passed for this option, each found
|
||||
token will be passed in same format as tokens returned from
|
||||
`tokenizer().getToken()`.
|
||||
|
||||
If array is passed, each found token is pushed to it.
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **onComment**: If a function is passed for this option, whenever a
|
||||
comment is encountered the function will be called with the
|
||||
following parameters:
|
||||
|
||||
- `block`: `true` if the comment is a block comment, false if it
|
||||
is a line comment.
|
||||
- `text`: The content of the comment.
|
||||
- `start`: Character offset of the start of the comment.
|
||||
- `end`: Character offset of the end of the comment.
|
||||
|
||||
When the `locations` options is on, the `{line, column}` locations
|
||||
of the comment’s start and end are passed as two additional
|
||||
parameters.
|
||||
|
||||
If array is passed for this option, each found comment is pushed
|
||||
to it as object in Esprima format:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"type": "Line" | "Block",
|
||||
"value": "comment text",
|
||||
"start": Number,
|
||||
"end": Number,
|
||||
// If `locations` option is on:
|
||||
"loc": {
|
||||
"start": {line: Number, column: Number}
|
||||
"end": {line: Number, column: Number}
|
||||
},
|
||||
// If `ranges` option is on:
|
||||
"range": [Number, Number]
|
||||
}
|
||||
```
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **ranges**: Nodes have their start and end characters offsets
|
||||
recorded in `start` and `end` properties (directly on the node,
|
||||
rather than the `loc` object, which holds line/column data. To also
|
||||
add a
|
||||
[semi-standardized](https://bugzilla.mozilla.org/show_bug.cgi?id=745678)
|
||||
`range` property holding a `[start, end]` array with the same
|
||||
numbers, set the `ranges` option to `true`.
|
||||
|
||||
- **program**: It is possible to parse multiple files into a single
|
||||
AST by passing the tree produced by parsing the first file as the
|
||||
`program` option in subsequent parses. This will add the toplevel
|
||||
forms of the parsed file to the "Program" (top) node of an existing
|
||||
parse tree.
|
||||
|
||||
- **sourceFile**: When the `locations` option is `true`, you can pass
|
||||
this option to add a `source` attribute in every node’s `loc`
|
||||
object. Note that the contents of this option are not examined or
|
||||
processed in any way; you are free to use whatever format you
|
||||
choose.
|
||||
|
||||
- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property
|
||||
will be added (regardless of the `location` option) directly to the
|
||||
nodes, rather than the `loc` object.
|
||||
|
||||
- **preserveParens**: If this option is `true`, parenthesized expressions
|
||||
are represented by (non-standard) `ParenthesizedExpression` nodes
|
||||
that have a single `expression` property containing the expression
|
||||
inside parentheses.
|
||||
|
||||
**parseExpressionAt**`(input, offset, options)` will parse a single
|
||||
expression in a string, and return its AST. It will not complain if
|
||||
there is more of the string left after the expression.
|
||||
|
||||
**tokenizer**`(input, options)` returns an object with a `getToken`
|
||||
method that can be called repeatedly to get the next token, a `{start,
|
||||
end, type, value}` object (with added `loc` property when the
|
||||
`locations` option is enabled and `range` property when the `ranges`
|
||||
option is enabled). When the token's type is `tokTypes.eof`, you
|
||||
should stop calling the method, since it will keep returning that same
|
||||
token forever.
|
||||
|
||||
In ES6 environment, returned result can be used as any other
|
||||
protocol-compliant iterable:
|
||||
|
||||
```javascript
|
||||
for (let token of acorn.tokenizer(str)) {
|
||||
// iterate over the tokens
|
||||
}
|
||||
|
||||
// transform code to array of tokens:
|
||||
var tokens = [...acorn.tokenizer(str)];
|
||||
```
|
||||
|
||||
**tokTypes** holds an object mapping names to the token type objects
|
||||
that end up in the `type` properties of tokens.
|
||||
|
||||
**getLineInfo**`(input, offset)` can be used to get a `{line,
|
||||
column}` object for a given program string and offset.
|
||||
|
||||
### The `Parser` class
|
||||
|
||||
Instances of the **`Parser`** class contain all the state and logic
|
||||
that drives a parse. It has static methods `parse`,
|
||||
`parseExpressionAt`, and `tokenizer` that match the top-level
|
||||
functions by the same name.
|
||||
|
||||
When extending the parser with plugins, you need to call these methods
|
||||
on the extended version of the class. To extend a parser with plugins,
|
||||
you can use its static `extend` method.
|
||||
|
||||
```javascript
|
||||
var acorn = require("acorn");
|
||||
var jsx = require("acorn-jsx");
|
||||
var JSXParser = acorn.Parser.extend(jsx());
|
||||
JSXParser.parse("foo(<bar/>)", {ecmaVersion: 2020});
|
||||
```
|
||||
|
||||
The `extend` method takes any number of plugin values, and returns a
|
||||
new `Parser` class that includes the extra parser logic provided by
|
||||
the plugins.
|
||||
|
||||
## Command line interface
|
||||
|
||||
The `bin/acorn` utility can be used to parse a file from the command
|
||||
line. It accepts as arguments its input file and the following
|
||||
options:
|
||||
|
||||
- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version
|
||||
to parse. Default is version 9.
|
||||
|
||||
- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise.
|
||||
|
||||
- `--locations`: Attaches a "loc" object to each node with "start" and
|
||||
"end" subobjects, each of which contains the one-based line and
|
||||
zero-based column numbers in `{line, column}` form.
|
||||
|
||||
- `--allow-hash-bang`: If the code starts with the characters #! (as
|
||||
in a shellscript), the first line will be treated as a comment.
|
||||
|
||||
- `--allow-await-outside-function`: Allows top-level `await` expressions.
|
||||
See the `allowAwaitOutsideFunction` option for more information.
|
||||
|
||||
- `--compact`: No whitespace is used in the AST output.
|
||||
|
||||
- `--silent`: Do not output the AST, just return the exit status.
|
||||
|
||||
- `--help`: Print the usage information and quit.
|
||||
|
||||
The utility spits out the syntax tree as JSON data.
|
||||
|
||||
## Existing plugins
|
||||
|
||||
- [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx)
|
||||
@@ -0,0 +1,61 @@
|
||||
'use strict'
|
||||
|
||||
const u = require('universalify').fromCallback
|
||||
const path = require('path')
|
||||
const fs = require('graceful-fs')
|
||||
const mkdir = require('../mkdirs')
|
||||
const pathExists = require('../path-exists').pathExists
|
||||
|
||||
function createLink (srcpath, dstpath, callback) {
|
||||
function makeLink (srcpath, dstpath) {
|
||||
fs.link(srcpath, dstpath, err => {
|
||||
if (err) return callback(err)
|
||||
callback(null)
|
||||
})
|
||||
}
|
||||
|
||||
pathExists(dstpath, (err, destinationExists) => {
|
||||
if (err) return callback(err)
|
||||
if (destinationExists) return callback(null)
|
||||
fs.lstat(srcpath, (err) => {
|
||||
if (err) {
|
||||
err.message = err.message.replace('lstat', 'ensureLink')
|
||||
return callback(err)
|
||||
}
|
||||
|
||||
const dir = path.dirname(dstpath)
|
||||
pathExists(dir, (err, dirExists) => {
|
||||
if (err) return callback(err)
|
||||
if (dirExists) return makeLink(srcpath, dstpath)
|
||||
mkdir.mkdirs(dir, err => {
|
||||
if (err) return callback(err)
|
||||
makeLink(srcpath, dstpath)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function createLinkSync (srcpath, dstpath) {
|
||||
const destinationExists = fs.existsSync(dstpath)
|
||||
if (destinationExists) return undefined
|
||||
|
||||
try {
|
||||
fs.lstatSync(srcpath)
|
||||
} catch (err) {
|
||||
err.message = err.message.replace('lstat', 'ensureLink')
|
||||
throw err
|
||||
}
|
||||
|
||||
const dir = path.dirname(dstpath)
|
||||
const dirExists = fs.existsSync(dir)
|
||||
if (dirExists) return fs.linkSync(srcpath, dstpath)
|
||||
mkdir.mkdirsSync(dir)
|
||||
|
||||
return fs.linkSync(srcpath, dstpath)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createLink: u(createLink),
|
||||
createLinkSync
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mapTo.js","sourceRoot":"","sources":["../../../../src/internal/operators/mapTo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AA4C5B,MAAM,UAAU,KAAK,CAAI,KAAQ;IAC/B,OAAO,GAAG,CAAC,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC,CAAC;AAC1B,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"isEmpty.js","sourceRoot":"","sources":["../../../../src/internal/operators/isEmpty.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AA+DhE,MAAM,UAAU,OAAO;IACrB,OAAO,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACpC,MAAM,CAAC,SAAS,CACd,wBAAwB,CACtB,UAAU,EACV,GAAG,EAAE;YACH,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC,EACD,GAAG,EAAE;YACH,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACtB,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC,CACF,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
Reference in New Issue
Block a user