add day 1
This commit is contained in:
1
day1/node_modules/.bin/esbuild
generated
vendored
Symbolic link
1
day1/node_modules/.bin/esbuild
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../esbuild/bin/esbuild
|
||||
1
day1/node_modules/.bin/nanoid
generated
vendored
Symbolic link
1
day1/node_modules/.bin/nanoid
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../nanoid/bin/nanoid.cjs
|
||||
1
day1/node_modules/.bin/resolve
generated
vendored
Symbolic link
1
day1/node_modules/.bin/resolve
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../resolve/bin/resolve
|
||||
1
day1/node_modules/.bin/rollup
generated
vendored
Symbolic link
1
day1/node_modules/.bin/rollup
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../rollup/dist/bin/rollup
|
||||
1
day1/node_modules/.bin/vite
generated
vendored
Symbolic link
1
day1/node_modules/.bin/vite
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../vite/bin/vite.js
|
||||
228
day1/node_modules/.package-lock.json
generated
vendored
Normal file
228
day1/node_modules/.package-lock.json
generated
vendored
Normal file
@@ -0,0 +1,228 @@
|
||||
{
|
||||
"name": "day1",
|
||||
"version": "0.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.54.tgz",
|
||||
"integrity": "sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/linux-loong64": "0.14.54",
|
||||
"esbuild-android-64": "0.14.54",
|
||||
"esbuild-android-arm64": "0.14.54",
|
||||
"esbuild-darwin-64": "0.14.54",
|
||||
"esbuild-darwin-arm64": "0.14.54",
|
||||
"esbuild-freebsd-64": "0.14.54",
|
||||
"esbuild-freebsd-arm64": "0.14.54",
|
||||
"esbuild-linux-32": "0.14.54",
|
||||
"esbuild-linux-64": "0.14.54",
|
||||
"esbuild-linux-arm": "0.14.54",
|
||||
"esbuild-linux-arm64": "0.14.54",
|
||||
"esbuild-linux-mips64le": "0.14.54",
|
||||
"esbuild-linux-ppc64le": "0.14.54",
|
||||
"esbuild-linux-riscv64": "0.14.54",
|
||||
"esbuild-linux-s390x": "0.14.54",
|
||||
"esbuild-netbsd-64": "0.14.54",
|
||||
"esbuild-openbsd-64": "0.14.54",
|
||||
"esbuild-sunos-64": "0.14.54",
|
||||
"esbuild-windows-32": "0.14.54",
|
||||
"esbuild-windows-64": "0.14.54",
|
||||
"esbuild-windows-arm64": "0.14.54"
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild-linux-64": {
|
||||
"version": "0.14.54",
|
||||
"resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz",
|
||||
"integrity": "sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-core-module": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
|
||||
"integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has": "^1.0.3"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.4",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
|
||||
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"nanoid": "bin/nanoid.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/path-parse": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
||||
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.16",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz",
|
||||
"integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.4",
|
||||
"picocolors": "^1.0.0",
|
||||
"source-map-js": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/resolve": {
|
||||
"version": "1.22.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
||||
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-core-module": "^2.9.0",
|
||||
"path-parse": "^1.0.7",
|
||||
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"resolve": "bin/resolve"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "2.77.3",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.77.3.tgz",
|
||||
"integrity": "sha512-/qxNTG7FbmefJWoeeYJFbHehJ2HNWnjkAFRKzWN/45eNBBF/r8lo992CwcJXEzyVxs5FmfId+vTSTQDb+bxA+g==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
|
||||
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/supports-preserve-symlinks-flag": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
||||
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "2.9.15",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-2.9.15.tgz",
|
||||
"integrity": "sha512-fzMt2jK4vQ3yK56te3Kqpkaeq9DkcZfBbzHwYpobasvgYmP2SoAr6Aic05CsB4CzCZbsDv4sujX3pkEGhLabVQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"esbuild": "^0.14.27",
|
||||
"postcss": "^8.4.13",
|
||||
"resolve": "^1.22.0",
|
||||
"rollup": ">=2.59.0 <2.78.0"
|
||||
},
|
||||
"bin": {
|
||||
"vite": "bin/vite.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.2.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"less": "*",
|
||||
"sass": "*",
|
||||
"stylus": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"less": {
|
||||
"optional": true
|
||||
},
|
||||
"sass": {
|
||||
"optional": true
|
||||
},
|
||||
"stylus": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
day1/node_modules/.vite/deps/package.json
generated
vendored
Normal file
1
day1/node_modules/.vite/deps/package.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"type":"module"}
|
||||
3
day1/node_modules/esbuild-linux-64/README.md
generated
vendored
Normal file
3
day1/node_modules/esbuild-linux-64/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# esbuild
|
||||
|
||||
This is the Linux 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
|
||||
BIN
day1/node_modules/esbuild-linux-64/bin/esbuild
generated
vendored
Executable file
BIN
day1/node_modules/esbuild-linux-64/bin/esbuild
generated
vendored
Executable file
Binary file not shown.
17
day1/node_modules/esbuild-linux-64/package.json
generated
vendored
Normal file
17
day1/node_modules/esbuild-linux-64/package.json
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "esbuild-linux-64",
|
||||
"version": "0.14.54",
|
||||
"description": "The Linux 64-bit binary for esbuild, a JavaScript bundler.",
|
||||
"repository": "https://github.com/evanw/esbuild",
|
||||
"license": "MIT",
|
||||
"preferUnplugged": false,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
21
day1/node_modules/esbuild/LICENSE.md
generated
vendored
Normal file
21
day1/node_modules/esbuild/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Evan Wallace
|
||||
|
||||
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.
|
||||
3
day1/node_modules/esbuild/README.md
generated
vendored
Normal file
3
day1/node_modules/esbuild/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# esbuild
|
||||
|
||||
This is a JavaScript bundler and minifier. See https://github.com/evanw/esbuild and the [JavaScript API documentation](https://esbuild.github.io/api/) for details.
|
||||
BIN
day1/node_modules/esbuild/bin/esbuild
generated
vendored
Executable file
BIN
day1/node_modules/esbuild/bin/esbuild
generated
vendored
Executable file
Binary file not shown.
244
day1/node_modules/esbuild/install.js
generated
vendored
Normal file
244
day1/node_modules/esbuild/install.js
generated
vendored
Normal file
@@ -0,0 +1,244 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
|
||||
// lib/npm/node-platform.ts
|
||||
var fs = require("fs");
|
||||
var os = require("os");
|
||||
var path = require("path");
|
||||
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
||||
var knownWindowsPackages = {
|
||||
"win32 arm64 LE": "esbuild-windows-arm64",
|
||||
"win32 ia32 LE": "esbuild-windows-32",
|
||||
"win32 x64 LE": "esbuild-windows-64"
|
||||
};
|
||||
var knownUnixlikePackages = {
|
||||
"android arm64 LE": "esbuild-android-arm64",
|
||||
"darwin arm64 LE": "esbuild-darwin-arm64",
|
||||
"darwin x64 LE": "esbuild-darwin-64",
|
||||
"freebsd arm64 LE": "esbuild-freebsd-arm64",
|
||||
"freebsd x64 LE": "esbuild-freebsd-64",
|
||||
"linux arm LE": "esbuild-linux-arm",
|
||||
"linux arm64 LE": "esbuild-linux-arm64",
|
||||
"linux ia32 LE": "esbuild-linux-32",
|
||||
"linux mips64el LE": "esbuild-linux-mips64le",
|
||||
"linux ppc64 LE": "esbuild-linux-ppc64le",
|
||||
"linux riscv64 LE": "esbuild-linux-riscv64",
|
||||
"linux s390x BE": "esbuild-linux-s390x",
|
||||
"linux x64 LE": "esbuild-linux-64",
|
||||
"linux loong64 LE": "@esbuild/linux-loong64",
|
||||
"netbsd x64 LE": "esbuild-netbsd-64",
|
||||
"openbsd x64 LE": "esbuild-openbsd-64",
|
||||
"sunos x64 LE": "esbuild-sunos-64"
|
||||
};
|
||||
var knownWebAssemblyFallbackPackages = {
|
||||
"android x64 LE": "esbuild-android-64"
|
||||
};
|
||||
function pkgAndSubpathForCurrentPlatform() {
|
||||
let pkg;
|
||||
let subpath;
|
||||
let isWASM = false;
|
||||
let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
|
||||
if (platformKey in knownWindowsPackages) {
|
||||
pkg = knownWindowsPackages[platformKey];
|
||||
subpath = "esbuild.exe";
|
||||
} else if (platformKey in knownUnixlikePackages) {
|
||||
pkg = knownUnixlikePackages[platformKey];
|
||||
subpath = "bin/esbuild";
|
||||
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
||||
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
||||
subpath = "bin/esbuild";
|
||||
isWASM = true;
|
||||
} else {
|
||||
throw new Error(`Unsupported platform: ${platformKey}`);
|
||||
}
|
||||
return { pkg, subpath, isWASM };
|
||||
}
|
||||
function downloadedBinPath(pkg, subpath) {
|
||||
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
||||
return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`);
|
||||
}
|
||||
|
||||
// lib/npm/node-install.ts
|
||||
var fs2 = require("fs");
|
||||
var os2 = require("os");
|
||||
var path2 = require("path");
|
||||
var zlib = require("zlib");
|
||||
var https = require("https");
|
||||
var child_process = require("child_process");
|
||||
var toPath = path2.join(__dirname, "bin", "esbuild");
|
||||
var isToPathJS = true;
|
||||
function validateBinaryVersion(...command) {
|
||||
command.push("--version");
|
||||
const stdout = child_process.execFileSync(command.shift(), command, {
|
||||
stdio: "pipe"
|
||||
}).toString().trim();
|
||||
if (stdout !== "0.14.54") {
|
||||
throw new Error(`Expected ${JSON.stringify("0.14.54")} but got ${JSON.stringify(stdout)}`);
|
||||
}
|
||||
}
|
||||
function isYarn() {
|
||||
const { npm_config_user_agent } = process.env;
|
||||
if (npm_config_user_agent) {
|
||||
return /\byarn\//.test(npm_config_user_agent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function fetch(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
https.get(url, (res) => {
|
||||
if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location)
|
||||
return fetch(res.headers.location).then(resolve, reject);
|
||||
if (res.statusCode !== 200)
|
||||
return reject(new Error(`Server responded with ${res.statusCode}`));
|
||||
let chunks = [];
|
||||
res.on("data", (chunk) => chunks.push(chunk));
|
||||
res.on("end", () => resolve(Buffer.concat(chunks)));
|
||||
}).on("error", reject);
|
||||
});
|
||||
}
|
||||
function extractFileFromTarGzip(buffer, subpath) {
|
||||
try {
|
||||
buffer = zlib.unzipSync(buffer);
|
||||
} catch (err) {
|
||||
throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`);
|
||||
}
|
||||
let str = (i, n) => String.fromCharCode(...buffer.subarray(i, i + n)).replace(/\0.*$/, "");
|
||||
let offset = 0;
|
||||
subpath = `package/${subpath}`;
|
||||
while (offset < buffer.length) {
|
||||
let name = str(offset, 100);
|
||||
let size = parseInt(str(offset + 124, 12), 8);
|
||||
offset += 512;
|
||||
if (!isNaN(size)) {
|
||||
if (name === subpath)
|
||||
return buffer.subarray(offset, offset + size);
|
||||
offset += size + 511 & ~511;
|
||||
}
|
||||
}
|
||||
throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`);
|
||||
}
|
||||
function installUsingNPM(pkg, subpath, binPath) {
|
||||
const env = { ...process.env, npm_config_global: void 0 };
|
||||
const esbuildLibDir = path2.dirname(require.resolve("esbuild"));
|
||||
const installDir = path2.join(esbuildLibDir, "npm-install");
|
||||
fs2.mkdirSync(installDir);
|
||||
try {
|
||||
fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
|
||||
child_process.execSync(
|
||||
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.14.54"}`,
|
||||
{ cwd: installDir, stdio: "pipe", env }
|
||||
);
|
||||
const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
|
||||
fs2.renameSync(installedBinPath, binPath);
|
||||
} finally {
|
||||
try {
|
||||
removeRecursive(installDir);
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
}
|
||||
function removeRecursive(dir) {
|
||||
for (const entry of fs2.readdirSync(dir)) {
|
||||
const entryPath = path2.join(dir, entry);
|
||||
let stats;
|
||||
try {
|
||||
stats = fs2.lstatSync(entryPath);
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
if (stats.isDirectory())
|
||||
removeRecursive(entryPath);
|
||||
else
|
||||
fs2.unlinkSync(entryPath);
|
||||
}
|
||||
fs2.rmdirSync(dir);
|
||||
}
|
||||
function applyManualBinaryPathOverride(overridePath) {
|
||||
const pathString = JSON.stringify(overridePath);
|
||||
fs2.writeFileSync(toPath, `#!/usr/bin/env node
|
||||
require('child_process').execFileSync(${pathString}, process.argv.slice(2), { stdio: 'inherit' });
|
||||
`);
|
||||
const libMain = path2.join(__dirname, "lib", "main.js");
|
||||
const code = fs2.readFileSync(libMain, "utf8");
|
||||
fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString};
|
||||
${code}`);
|
||||
}
|
||||
function maybeOptimizePackage(binPath) {
|
||||
if (os2.platform() !== "win32" && !isYarn()) {
|
||||
const tempPath = path2.join(__dirname, "bin-esbuild");
|
||||
try {
|
||||
fs2.linkSync(binPath, tempPath);
|
||||
fs2.renameSync(tempPath, toPath);
|
||||
isToPathJS = false;
|
||||
fs2.unlinkSync(tempPath);
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
}
|
||||
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
|
||||
const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.14.54"}.tgz`;
|
||||
console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
|
||||
try {
|
||||
fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
|
||||
fs2.chmodSync(binPath, 493);
|
||||
} catch (e) {
|
||||
console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
async function checkAndPreparePackage() {
|
||||
if (ESBUILD_BINARY_PATH) {
|
||||
applyManualBinaryPathOverride(ESBUILD_BINARY_PATH);
|
||||
return;
|
||||
}
|
||||
const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
|
||||
let binPath;
|
||||
try {
|
||||
binPath = require.resolve(`${pkg}/${subpath}`);
|
||||
} catch (e) {
|
||||
console.error(`[esbuild] Failed to find package "${pkg}" on the file system
|
||||
|
||||
This can happen if you use the "--no-optional" flag. The "optionalDependencies"
|
||||
package.json feature is used by esbuild to install the correct binary executable
|
||||
for your current platform. This install script will now attempt to work around
|
||||
this. If that fails, you need to remove the "--no-optional" flag to use esbuild.
|
||||
`);
|
||||
binPath = downloadedBinPath(pkg, subpath);
|
||||
try {
|
||||
console.error(`[esbuild] Trying to install package "${pkg}" using npm`);
|
||||
installUsingNPM(pkg, subpath, binPath);
|
||||
} catch (e2) {
|
||||
console.error(`[esbuild] Failed to install package "${pkg}" using npm: ${e2 && e2.message || e2}`);
|
||||
try {
|
||||
await downloadDirectlyFromNPM(pkg, subpath, binPath);
|
||||
} catch (e3) {
|
||||
throw new Error(`Failed to install package "${pkg}"`);
|
||||
}
|
||||
}
|
||||
}
|
||||
maybeOptimizePackage(binPath);
|
||||
}
|
||||
checkAndPreparePackage().then(() => {
|
||||
if (isToPathJS) {
|
||||
validateBinaryVersion("node", toPath);
|
||||
} else {
|
||||
validateBinaryVersion(toPath);
|
||||
}
|
||||
});
|
||||
602
day1/node_modules/esbuild/lib/main.d.ts
generated
vendored
Normal file
602
day1/node_modules/esbuild/lib/main.d.ts
generated
vendored
Normal file
@@ -0,0 +1,602 @@
|
||||
export type Platform = 'browser' | 'node' | 'neutral';
|
||||
export type Format = 'iife' | 'cjs' | 'esm';
|
||||
export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'copy' | 'default';
|
||||
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent';
|
||||
export type Charset = 'ascii' | 'utf8';
|
||||
export type Drop = 'console' | 'debugger';
|
||||
|
||||
interface CommonOptions {
|
||||
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
||||
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both';
|
||||
/** Documentation: https://esbuild.github.io/api/#legal-comments */
|
||||
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external';
|
||||
/** Documentation: https://esbuild.github.io/api/#source-root */
|
||||
sourceRoot?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#sources-content */
|
||||
sourcesContent?: boolean;
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#format */
|
||||
format?: Format;
|
||||
/** Documentation: https://esbuild.github.io/api/#global-name */
|
||||
globalName?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#target */
|
||||
target?: string | string[];
|
||||
/** Documentation: https://esbuild.github.io/api/#supported */
|
||||
supported?: Record<string, boolean>;
|
||||
/** Documentation: https://esbuild.github.io/api/#platform */
|
||||
platform?: Platform;
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||
mangleProps?: RegExp;
|
||||
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||
reserveProps?: RegExp;
|
||||
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||
mangleQuoted?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||
mangleCache?: Record<string, string | false>;
|
||||
/** Documentation: https://esbuild.github.io/api/#drop */
|
||||
drop?: Drop[];
|
||||
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||
minify?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||
minifyWhitespace?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||
minifyIdentifiers?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||
minifySyntax?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#charset */
|
||||
charset?: Charset;
|
||||
/** Documentation: https://esbuild.github.io/api/#tree-shaking */
|
||||
treeShaking?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#ignore-annotations */
|
||||
ignoreAnnotations?: boolean;
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx */
|
||||
jsx?: 'transform' | 'preserve' | 'automatic';
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-factory */
|
||||
jsxFactory?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-fragment */
|
||||
jsxFragment?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-import-source */
|
||||
jsxImportSource?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#jsx-development */
|
||||
jsxDev?: boolean;
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#define */
|
||||
define?: { [key: string]: string };
|
||||
/** Documentation: https://esbuild.github.io/api/#pure */
|
||||
pure?: string[];
|
||||
/** Documentation: https://esbuild.github.io/api/#keep-names */
|
||||
keepNames?: boolean;
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#color */
|
||||
color?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#log-level */
|
||||
logLevel?: LogLevel;
|
||||
/** Documentation: https://esbuild.github.io/api/#log-limit */
|
||||
logLimit?: number;
|
||||
/** Documentation: https://esbuild.github.io/api/#log-override */
|
||||
logOverride?: Record<string, LogLevel>;
|
||||
}
|
||||
|
||||
export interface BuildOptions extends CommonOptions {
|
||||
/** Documentation: https://esbuild.github.io/api/#bundle */
|
||||
bundle?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#splitting */
|
||||
splitting?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#preserve-symlinks */
|
||||
preserveSymlinks?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#outfile */
|
||||
outfile?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#metafile */
|
||||
metafile?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#outdir */
|
||||
outdir?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#outbase */
|
||||
outbase?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#external */
|
||||
external?: string[];
|
||||
/** Documentation: https://esbuild.github.io/api/#loader */
|
||||
loader?: { [ext: string]: Loader };
|
||||
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
||||
resolveExtensions?: string[];
|
||||
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
||||
mainFields?: string[];
|
||||
/** Documentation: https://esbuild.github.io/api/#conditions */
|
||||
conditions?: string[];
|
||||
/** Documentation: https://esbuild.github.io/api/#write */
|
||||
write?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#allow-overwrite */
|
||||
allowOverwrite?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#tsconfig */
|
||||
tsconfig?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#out-extension */
|
||||
outExtension?: { [ext: string]: string };
|
||||
/** Documentation: https://esbuild.github.io/api/#public-path */
|
||||
publicPath?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#entry-names */
|
||||
entryNames?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#chunk-names */
|
||||
chunkNames?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#asset-names */
|
||||
assetNames?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#inject */
|
||||
inject?: string[];
|
||||
/** Documentation: https://esbuild.github.io/api/#banner */
|
||||
banner?: { [type: string]: string };
|
||||
/** Documentation: https://esbuild.github.io/api/#footer */
|
||||
footer?: { [type: string]: string };
|
||||
/** Documentation: https://esbuild.github.io/api/#incremental */
|
||||
incremental?: boolean;
|
||||
/** Documentation: https://esbuild.github.io/api/#entry-points */
|
||||
entryPoints?: string[] | Record<string, string>;
|
||||
/** Documentation: https://esbuild.github.io/api/#stdin */
|
||||
stdin?: StdinOptions;
|
||||
/** Documentation: https://esbuild.github.io/plugins/ */
|
||||
plugins?: Plugin[];
|
||||
/** Documentation: https://esbuild.github.io/api/#working-directory */
|
||||
absWorkingDir?: string;
|
||||
/** Documentation: https://esbuild.github.io/api/#node-paths */
|
||||
nodePaths?: string[]; // The "NODE_PATH" variable from Node.js
|
||||
/** Documentation: https://esbuild.github.io/api/#watch */
|
||||
watch?: boolean | WatchMode;
|
||||
}
|
||||
|
||||
export interface WatchMode {
|
||||
onRebuild?: (error: BuildFailure | null, result: BuildResult | null) => void;
|
||||
}
|
||||
|
||||
export interface StdinOptions {
|
||||
contents: string | Uint8Array;
|
||||
resolveDir?: string;
|
||||
sourcefile?: string;
|
||||
loader?: Loader;
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
id: string;
|
||||
pluginName: string;
|
||||
text: string;
|
||||
location: Location | null;
|
||||
notes: Note[];
|
||||
|
||||
/**
|
||||
* Optional user-specified data that is passed through unmodified. You can
|
||||
* use this to stash the original error, for example.
|
||||
*/
|
||||
detail: any;
|
||||
}
|
||||
|
||||
export interface Note {
|
||||
text: string;
|
||||
location: Location | null;
|
||||
}
|
||||
|
||||
export interface Location {
|
||||
file: string;
|
||||
namespace: string;
|
||||
/** 1-based */
|
||||
line: number;
|
||||
/** 0-based, in bytes */
|
||||
column: number;
|
||||
/** in bytes */
|
||||
length: number;
|
||||
lineText: string;
|
||||
suggestion: string;
|
||||
}
|
||||
|
||||
export interface OutputFile {
|
||||
path: string;
|
||||
/** "text" as bytes */
|
||||
contents: Uint8Array;
|
||||
/** "contents" as text */
|
||||
text: string;
|
||||
}
|
||||
|
||||
export interface BuildInvalidate {
|
||||
(): Promise<BuildIncremental>;
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
export interface BuildIncremental extends BuildResult {
|
||||
rebuild: BuildInvalidate;
|
||||
}
|
||||
|
||||
export interface BuildResult {
|
||||
errors: Message[];
|
||||
warnings: Message[];
|
||||
/** Only when "write: false" */
|
||||
outputFiles?: OutputFile[];
|
||||
/** Only when "incremental: true" */
|
||||
rebuild?: BuildInvalidate;
|
||||
/** Only when "watch: true" */
|
||||
stop?: () => void;
|
||||
/** Only when "metafile: true" */
|
||||
metafile?: Metafile;
|
||||
/** Only when "mangleCache" is present */
|
||||
mangleCache?: Record<string, string | false>;
|
||||
}
|
||||
|
||||
export interface BuildFailure extends Error {
|
||||
errors: Message[];
|
||||
warnings: Message[];
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#serve-arguments */
|
||||
export interface ServeOptions {
|
||||
port?: number;
|
||||
host?: string;
|
||||
servedir?: string;
|
||||
onRequest?: (args: ServeOnRequestArgs) => void;
|
||||
}
|
||||
|
||||
export interface ServeOnRequestArgs {
|
||||
remoteAddress: string;
|
||||
method: string;
|
||||
path: string;
|
||||
status: number;
|
||||
/** The time to generate the response, not to send it */
|
||||
timeInMS: number;
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#serve-return-values */
|
||||
export interface ServeResult {
|
||||
port: number;
|
||||
host: string;
|
||||
wait: Promise<void>;
|
||||
stop: () => void;
|
||||
}
|
||||
|
||||
export interface TransformOptions extends CommonOptions {
|
||||
tsconfigRaw?: string | {
|
||||
compilerOptions?: {
|
||||
jsxFactory?: string,
|
||||
jsxFragmentFactory?: string,
|
||||
useDefineForClassFields?: boolean,
|
||||
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error',
|
||||
preserveValueImports?: boolean,
|
||||
},
|
||||
};
|
||||
|
||||
sourcefile?: string;
|
||||
loader?: Loader;
|
||||
banner?: string;
|
||||
footer?: string;
|
||||
}
|
||||
|
||||
export interface TransformResult {
|
||||
code: string;
|
||||
map: string;
|
||||
warnings: Message[];
|
||||
/** Only when "mangleCache" is present */
|
||||
mangleCache?: Record<string, string | false>;
|
||||
}
|
||||
|
||||
export interface TransformFailure extends Error {
|
||||
errors: Message[];
|
||||
warnings: Message[];
|
||||
}
|
||||
|
||||
export interface Plugin {
|
||||
name: string;
|
||||
setup: (build: PluginBuild) => (void | Promise<void>);
|
||||
}
|
||||
|
||||
export interface PluginBuild {
|
||||
initialOptions: BuildOptions;
|
||||
resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>;
|
||||
|
||||
onStart(callback: () =>
|
||||
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void;
|
||||
onEnd(callback: (result: BuildResult) =>
|
||||
(void | Promise<void>)): void;
|
||||
onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
|
||||
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void;
|
||||
onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
|
||||
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void;
|
||||
|
||||
// This is a full copy of the esbuild library in case you need it
|
||||
esbuild: {
|
||||
serve: typeof serve,
|
||||
build: typeof build,
|
||||
buildSync: typeof buildSync,
|
||||
transform: typeof transform,
|
||||
transformSync: typeof transformSync,
|
||||
formatMessages: typeof formatMessages,
|
||||
formatMessagesSync: typeof formatMessagesSync,
|
||||
analyzeMetafile: typeof analyzeMetafile,
|
||||
analyzeMetafileSync: typeof analyzeMetafileSync,
|
||||
initialize: typeof initialize,
|
||||
version: typeof version,
|
||||
};
|
||||
}
|
||||
|
||||
export interface ResolveOptions {
|
||||
pluginName?: string;
|
||||
importer?: string;
|
||||
namespace?: string;
|
||||
resolveDir?: string;
|
||||
kind?: ImportKind;
|
||||
pluginData?: any;
|
||||
}
|
||||
|
||||
export interface ResolveResult {
|
||||
errors: Message[];
|
||||
warnings: Message[];
|
||||
|
||||
path: string;
|
||||
external: boolean;
|
||||
sideEffects: boolean;
|
||||
namespace: string;
|
||||
suffix: string;
|
||||
pluginData: any;
|
||||
}
|
||||
|
||||
export interface OnStartResult {
|
||||
errors?: PartialMessage[];
|
||||
warnings?: PartialMessage[];
|
||||
}
|
||||
|
||||
export interface OnResolveOptions {
|
||||
filter: RegExp;
|
||||
namespace?: string;
|
||||
}
|
||||
|
||||
export interface OnResolveArgs {
|
||||
path: string;
|
||||
importer: string;
|
||||
namespace: string;
|
||||
resolveDir: string;
|
||||
kind: ImportKind;
|
||||
pluginData: any;
|
||||
}
|
||||
|
||||
export type ImportKind =
|
||||
| 'entry-point'
|
||||
|
||||
// JS
|
||||
| 'import-statement'
|
||||
| 'require-call'
|
||||
| 'dynamic-import'
|
||||
| 'require-resolve'
|
||||
|
||||
// CSS
|
||||
| 'import-rule'
|
||||
| 'url-token'
|
||||
|
||||
export interface OnResolveResult {
|
||||
pluginName?: string;
|
||||
|
||||
errors?: PartialMessage[];
|
||||
warnings?: PartialMessage[];
|
||||
|
||||
path?: string;
|
||||
external?: boolean;
|
||||
sideEffects?: boolean;
|
||||
namespace?: string;
|
||||
suffix?: string;
|
||||
pluginData?: any;
|
||||
|
||||
watchFiles?: string[];
|
||||
watchDirs?: string[];
|
||||
}
|
||||
|
||||
export interface OnLoadOptions {
|
||||
filter: RegExp;
|
||||
namespace?: string;
|
||||
}
|
||||
|
||||
export interface OnLoadArgs {
|
||||
path: string;
|
||||
namespace: string;
|
||||
suffix: string;
|
||||
pluginData: any;
|
||||
}
|
||||
|
||||
export interface OnLoadResult {
|
||||
pluginName?: string;
|
||||
|
||||
errors?: PartialMessage[];
|
||||
warnings?: PartialMessage[];
|
||||
|
||||
contents?: string | Uint8Array;
|
||||
resolveDir?: string;
|
||||
loader?: Loader;
|
||||
pluginData?: any;
|
||||
|
||||
watchFiles?: string[];
|
||||
watchDirs?: string[];
|
||||
}
|
||||
|
||||
export interface PartialMessage {
|
||||
id?: string;
|
||||
pluginName?: string;
|
||||
text?: string;
|
||||
location?: Partial<Location> | null;
|
||||
notes?: PartialNote[];
|
||||
detail?: any;
|
||||
}
|
||||
|
||||
export interface PartialNote {
|
||||
text?: string;
|
||||
location?: Partial<Location> | null;
|
||||
}
|
||||
|
||||
export interface Metafile {
|
||||
inputs: {
|
||||
[path: string]: {
|
||||
bytes: number
|
||||
imports: {
|
||||
path: string
|
||||
kind: ImportKind
|
||||
}[]
|
||||
}
|
||||
}
|
||||
outputs: {
|
||||
[path: string]: {
|
||||
bytes: number
|
||||
inputs: {
|
||||
[path: string]: {
|
||||
bytesInOutput: number
|
||||
}
|
||||
}
|
||||
imports: {
|
||||
path: string
|
||||
kind: ImportKind
|
||||
}[]
|
||||
exports: string[]
|
||||
entryPoint?: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface FormatMessagesOptions {
|
||||
kind: 'error' | 'warning';
|
||||
color?: boolean;
|
||||
terminalWidth?: number;
|
||||
}
|
||||
|
||||
export interface AnalyzeMetafileOptions {
|
||||
color?: boolean;
|
||||
verbose?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function invokes the "esbuild" command-line tool for you. It returns a
|
||||
* promise that either resolves with a "BuildResult" object or rejects with a
|
||||
* "BuildFailure" object.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#build-api
|
||||
*/
|
||||
export declare function build(options: BuildOptions & { write: false }): Promise<BuildResult & { outputFiles: OutputFile[] }>;
|
||||
export declare function build(options: BuildOptions & { incremental: true, metafile: true }): Promise<BuildIncremental & { metafile: Metafile }>;
|
||||
export declare function build(options: BuildOptions & { incremental: true }): Promise<BuildIncremental>;
|
||||
export declare function build(options: BuildOptions & { metafile: true }): Promise<BuildResult & { metafile: Metafile }>;
|
||||
export declare function build(options: BuildOptions): Promise<BuildResult>;
|
||||
|
||||
/**
|
||||
* This function is similar to "build" but it serves the resulting files over
|
||||
* HTTP on a localhost address with the specified port.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#serve
|
||||
*/
|
||||
export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOptions): Promise<ServeResult>;
|
||||
|
||||
/**
|
||||
* This function transforms a single JavaScript file. It can be used to minify
|
||||
* JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript
|
||||
* to older JavaScript. It returns a promise that is either resolved with a
|
||||
* "TransformResult" object or rejected with a "TransformFailure" object.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#transform-api
|
||||
*/
|
||||
export declare function transform(input: string | Uint8Array, options?: TransformOptions): Promise<TransformResult>;
|
||||
|
||||
/**
|
||||
* Converts log messages to formatted message strings suitable for printing in
|
||||
* the terminal. This allows you to reuse the built-in behavior of esbuild's
|
||||
* log message formatter. This is a batch-oriented API for efficiency.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes
|
||||
*/
|
||||
export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>;
|
||||
|
||||
/**
|
||||
* Pretty-prints an analysis of the metafile JSON to a string. This is just for
|
||||
* convenience to be able to match esbuild's pretty-printing exactly. If you want
|
||||
* to customize it, you can just inspect the data in the metafile yourself.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#analyze
|
||||
*/
|
||||
export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>;
|
||||
|
||||
/**
|
||||
* A synchronous version of "build".
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#build-api
|
||||
*/
|
||||
export declare function buildSync(options: BuildOptions & { write: false }): BuildResult & { outputFiles: OutputFile[] };
|
||||
export declare function buildSync(options: BuildOptions): BuildResult;
|
||||
|
||||
/**
|
||||
* A synchronous version of "transform".
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#transform-api
|
||||
*/
|
||||
export declare function transformSync(input: string, options?: TransformOptions): TransformResult;
|
||||
|
||||
/**
|
||||
* A synchronous version of "formatMessages".
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*/
|
||||
export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[];
|
||||
|
||||
/**
|
||||
* A synchronous version of "analyzeMetafile".
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#analyze
|
||||
*/
|
||||
export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string;
|
||||
|
||||
/**
|
||||
* This configures the browser-based version of esbuild. It is necessary to
|
||||
* call this first and wait for the returned promise to be resolved before
|
||||
* making other API calls when using esbuild in the browser.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: yes ("options" is required)
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#running-in-the-browser
|
||||
*/
|
||||
export declare function initialize(options: InitializeOptions): Promise<void>;
|
||||
|
||||
export interface InitializeOptions {
|
||||
/**
|
||||
* The URL of the "esbuild.wasm" file. This must be provided when running
|
||||
* esbuild in the browser.
|
||||
*/
|
||||
wasmURL?: string
|
||||
|
||||
/**
|
||||
* The result of calling "new WebAssembly.Module(buffer)" where "buffer"
|
||||
* is a typed array or ArrayBuffer containing the binary code of the
|
||||
* "esbuild.wasm" file.
|
||||
*
|
||||
* You can use this as an alternative to "wasmURL" for environments where it's
|
||||
* not possible to download the WebAssembly module.
|
||||
*/
|
||||
wasmModule?: WebAssembly.Module
|
||||
|
||||
/**
|
||||
* By default esbuild runs the WebAssembly-based browser API in a web worker
|
||||
* to avoid blocking the UI thread. This can be disabled by setting "worker"
|
||||
* to false.
|
||||
*/
|
||||
worker?: boolean
|
||||
}
|
||||
|
||||
export let version: string;
|
||||
2332
day1/node_modules/esbuild/lib/main.js
generated
vendored
Normal file
2332
day1/node_modules/esbuild/lib/main.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
41
day1/node_modules/esbuild/package.json
generated
vendored
Normal file
41
day1/node_modules/esbuild/package.json
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "esbuild",
|
||||
"version": "0.14.54",
|
||||
"description": "An extremely fast JavaScript and CSS bundler and minifier.",
|
||||
"repository": "https://github.com/evanw/esbuild",
|
||||
"scripts": {
|
||||
"postinstall": "node install.js"
|
||||
},
|
||||
"main": "lib/main.js",
|
||||
"types": "lib/main.d.ts",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/linux-loong64": "0.14.54",
|
||||
"esbuild-android-64": "0.14.54",
|
||||
"esbuild-android-arm64": "0.14.54",
|
||||
"esbuild-darwin-64": "0.14.54",
|
||||
"esbuild-darwin-arm64": "0.14.54",
|
||||
"esbuild-freebsd-64": "0.14.54",
|
||||
"esbuild-freebsd-arm64": "0.14.54",
|
||||
"esbuild-linux-32": "0.14.54",
|
||||
"esbuild-linux-64": "0.14.54",
|
||||
"esbuild-linux-arm": "0.14.54",
|
||||
"esbuild-linux-arm64": "0.14.54",
|
||||
"esbuild-linux-mips64le": "0.14.54",
|
||||
"esbuild-linux-ppc64le": "0.14.54",
|
||||
"esbuild-linux-riscv64": "0.14.54",
|
||||
"esbuild-linux-s390x": "0.14.54",
|
||||
"esbuild-netbsd-64": "0.14.54",
|
||||
"esbuild-openbsd-64": "0.14.54",
|
||||
"esbuild-sunos-64": "0.14.54",
|
||||
"esbuild-windows-32": "0.14.54",
|
||||
"esbuild-windows-64": "0.14.54",
|
||||
"esbuild-windows-arm64": "0.14.54"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
20
day1/node_modules/function-bind/.editorconfig
generated
vendored
Normal file
20
day1/node_modules/function-bind/.editorconfig
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 120
|
||||
|
||||
[CHANGELOG.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
max_line_length = off
|
||||
|
||||
[Makefile]
|
||||
max_line_length = off
|
||||
15
day1/node_modules/function-bind/.eslintrc
generated
vendored
Normal file
15
day1/node_modules/function-bind/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"func-name-matching": 0,
|
||||
"indent": [2, 4],
|
||||
"max-nested-callbacks": [2, 3],
|
||||
"max-params": [2, 3],
|
||||
"max-statements": [2, 20],
|
||||
"no-new-func": [1],
|
||||
"strict": [0]
|
||||
}
|
||||
}
|
||||
176
day1/node_modules/function-bind/.jscs.json
generated
vendored
Normal file
176
day1/node_modules/function-bind/.jscs.json
generated
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
{
|
||||
"es3": true,
|
||||
|
||||
"additionalRules": [],
|
||||
|
||||
"requireSemicolons": true,
|
||||
|
||||
"disallowMultipleSpaces": true,
|
||||
|
||||
"disallowIdentifierNames": [],
|
||||
|
||||
"requireCurlyBraces": {
|
||||
"allExcept": [],
|
||||
"keywords": ["if", "else", "for", "while", "do", "try", "catch"]
|
||||
},
|
||||
|
||||
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"],
|
||||
|
||||
"disallowSpaceAfterKeywords": [],
|
||||
|
||||
"disallowSpaceBeforeComma": true,
|
||||
"disallowSpaceAfterComma": false,
|
||||
"disallowSpaceBeforeSemicolon": true,
|
||||
|
||||
"disallowNodeTypes": [
|
||||
"DebuggerStatement",
|
||||
"ForInStatement",
|
||||
"LabeledStatement",
|
||||
"SwitchCase",
|
||||
"SwitchStatement",
|
||||
"WithStatement"
|
||||
],
|
||||
|
||||
"requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] },
|
||||
|
||||
"requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true },
|
||||
"requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true },
|
||||
"disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true },
|
||||
"requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true },
|
||||
"disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true },
|
||||
|
||||
"requireSpaceBetweenArguments": true,
|
||||
|
||||
"disallowSpacesInsideParentheses": true,
|
||||
|
||||
"disallowSpacesInsideArrayBrackets": true,
|
||||
|
||||
"disallowQuotedKeysInObjects": { "allExcept": ["reserved"] },
|
||||
|
||||
"disallowSpaceAfterObjectKeys": true,
|
||||
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
|
||||
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
|
||||
"requireSpaceAfterPrefixUnaryOperators": [],
|
||||
|
||||
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
|
||||
"requireSpaceBeforePostfixUnaryOperators": [],
|
||||
|
||||
"disallowSpaceBeforeBinaryOperators": [],
|
||||
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
|
||||
|
||||
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
|
||||
"disallowSpaceAfterBinaryOperators": [],
|
||||
|
||||
"disallowImplicitTypeConversion": ["binary", "string"],
|
||||
|
||||
"disallowKeywords": ["with", "eval"],
|
||||
|
||||
"requireKeywordsOnNewLine": [],
|
||||
"disallowKeywordsOnNewLine": ["else"],
|
||||
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
|
||||
"disallowTrailingWhitespace": true,
|
||||
|
||||
"disallowTrailingComma": true,
|
||||
|
||||
"excludeFiles": ["node_modules/**", "vendor/**"],
|
||||
|
||||
"disallowMultipleLineStrings": true,
|
||||
|
||||
"requireDotNotation": { "allExcept": ["keywords"] },
|
||||
|
||||
"requireParenthesesAroundIIFE": true,
|
||||
|
||||
"validateLineBreaks": "LF",
|
||||
|
||||
"validateQuoteMarks": {
|
||||
"escape": true,
|
||||
"mark": "'"
|
||||
},
|
||||
|
||||
"disallowOperatorBeforeLineBreak": [],
|
||||
|
||||
"requireSpaceBeforeKeywords": [
|
||||
"do",
|
||||
"for",
|
||||
"if",
|
||||
"else",
|
||||
"switch",
|
||||
"case",
|
||||
"try",
|
||||
"catch",
|
||||
"finally",
|
||||
"while",
|
||||
"with",
|
||||
"return"
|
||||
],
|
||||
|
||||
"validateAlignedFunctionParameters": {
|
||||
"lineBreakAfterOpeningBraces": true,
|
||||
"lineBreakBeforeClosingBraces": true
|
||||
},
|
||||
|
||||
"requirePaddingNewLinesBeforeExport": true,
|
||||
|
||||
"validateNewlineAfterArrayElements": {
|
||||
"maximum": 8
|
||||
},
|
||||
|
||||
"requirePaddingNewLinesAfterUseStrict": true,
|
||||
|
||||
"disallowArrowFunctions": true,
|
||||
|
||||
"disallowMultiLineTernary": true,
|
||||
|
||||
"validateOrderInObjectKeys": "asc-insensitive",
|
||||
|
||||
"disallowIdenticalDestructuringNames": true,
|
||||
|
||||
"disallowNestedTernaries": { "maxLevel": 1 },
|
||||
|
||||
"requireSpaceAfterComma": { "allExcept": ["trailing"] },
|
||||
"requireAlignedMultilineParams": false,
|
||||
|
||||
"requireSpacesInGenerator": {
|
||||
"afterStar": true
|
||||
},
|
||||
|
||||
"disallowSpacesInGenerator": {
|
||||
"beforeStar": true
|
||||
},
|
||||
|
||||
"disallowVar": false,
|
||||
|
||||
"requireArrayDestructuring": false,
|
||||
|
||||
"requireEnhancedObjectLiterals": false,
|
||||
|
||||
"requireObjectDestructuring": false,
|
||||
|
||||
"requireEarlyReturn": false,
|
||||
|
||||
"requireCapitalizedConstructorsNew": {
|
||||
"allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"]
|
||||
},
|
||||
|
||||
"requireImportAlphabetized": false,
|
||||
|
||||
"requireSpaceBeforeObjectValues": true,
|
||||
"requireSpaceBeforeDestructuredValues": true,
|
||||
|
||||
"disallowSpacesInsideTemplateStringPlaceholders": true,
|
||||
|
||||
"disallowArrayDestructuringReturn": false,
|
||||
|
||||
"requireNewlineBeforeSingleStatementsInIf": false,
|
||||
|
||||
"disallowUnusedVariables": true,
|
||||
|
||||
"requireSpacesInsideImportedObjectBraces": true,
|
||||
|
||||
"requireUseStrict": true
|
||||
}
|
||||
|
||||
22
day1/node_modules/function-bind/.npmignore
generated
vendored
Normal file
22
day1/node_modules/function-bind/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# gitignore
|
||||
.DS_Store
|
||||
.monitor
|
||||
.*.swp
|
||||
.nodemonignore
|
||||
releases
|
||||
*.log
|
||||
*.err
|
||||
fleet.json
|
||||
public/browserify
|
||||
bin/*.json
|
||||
.bin
|
||||
build
|
||||
compile
|
||||
.lock-wscript
|
||||
coverage
|
||||
node_modules
|
||||
|
||||
# Only apps should have lockfiles
|
||||
npm-shrinkwrap.json
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
168
day1/node_modules/function-bind/.travis.yml
generated
vendored
Normal file
168
day1/node_modules/function-bind/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
language: node_js
|
||||
os:
|
||||
- linux
|
||||
node_js:
|
||||
- "8.4"
|
||||
- "7.10"
|
||||
- "6.11"
|
||||
- "5.12"
|
||||
- "4.8"
|
||||
- "iojs-v3.3"
|
||||
- "iojs-v2.5"
|
||||
- "iojs-v1.8"
|
||||
- "0.12"
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
before_install:
|
||||
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then npm install -g npm@1.3 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi'
|
||||
- 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then if [ "${TRAVIS_NODE_VERSION%${TRAVIS_NODE_VERSION#[0-9]}}" = "0" ] || [ "${TRAVIS_NODE_VERSION:0:4}" = "iojs" ]; then npm install -g npm@4.5 ; else npm install -g npm; fi; fi'
|
||||
install:
|
||||
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then nvm install 0.8 && npm install -g npm@1.3 && npm install -g npm@1.4.28 && npm install -g npm@2 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;'
|
||||
script:
|
||||
- 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi'
|
||||
- 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi'
|
||||
- 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi'
|
||||
- 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi'
|
||||
sudo: false
|
||||
env:
|
||||
- TEST=true
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- node_js: "node"
|
||||
env: PRETEST=true
|
||||
- node_js: "4"
|
||||
env: COVERAGE=true
|
||||
- node_js: "8.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.10"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.11"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.10"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v3.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v3.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v3.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.11"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
allow_failures:
|
||||
- os: osx
|
||||
- env: TEST=true ALLOW_FAILURE=true
|
||||
20
day1/node_modules/function-bind/LICENSE
generated
vendored
Normal file
20
day1/node_modules/function-bind/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2013 Raynos.
|
||||
|
||||
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.
|
||||
|
||||
48
day1/node_modules/function-bind/README.md
generated
vendored
Normal file
48
day1/node_modules/function-bind/README.md
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
# function-bind
|
||||
|
||||
<!--
|
||||
[![build status][travis-svg]][travis-url]
|
||||
[![NPM version][npm-badge-svg]][npm-url]
|
||||
[![Coverage Status][5]][6]
|
||||
[![gemnasium Dependency Status][7]][8]
|
||||
[![Dependency status][deps-svg]][deps-url]
|
||||
[![Dev Dependency status][dev-deps-svg]][dev-deps-url]
|
||||
-->
|
||||
|
||||
<!-- [![browser support][11]][12] -->
|
||||
|
||||
Implementation of function.prototype.bind
|
||||
|
||||
## Example
|
||||
|
||||
I mainly do this for unit tests I run on phantomjs.
|
||||
PhantomJS does not have Function.prototype.bind :(
|
||||
|
||||
```js
|
||||
Function.prototype.bind = require("function-bind")
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
`npm install function-bind`
|
||||
|
||||
## Contributors
|
||||
|
||||
- Raynos
|
||||
|
||||
## MIT Licenced
|
||||
|
||||
[travis-svg]: https://travis-ci.org/Raynos/function-bind.svg
|
||||
[travis-url]: https://travis-ci.org/Raynos/function-bind
|
||||
[npm-badge-svg]: https://badge.fury.io/js/function-bind.svg
|
||||
[npm-url]: https://npmjs.org/package/function-bind
|
||||
[5]: https://coveralls.io/repos/Raynos/function-bind/badge.png
|
||||
[6]: https://coveralls.io/r/Raynos/function-bind
|
||||
[7]: https://gemnasium.com/Raynos/function-bind.png
|
||||
[8]: https://gemnasium.com/Raynos/function-bind
|
||||
[deps-svg]: https://david-dm.org/Raynos/function-bind.svg
|
||||
[deps-url]: https://david-dm.org/Raynos/function-bind
|
||||
[dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies
|
||||
[11]: https://ci.testling.com/Raynos/function-bind.png
|
||||
[12]: https://ci.testling.com/Raynos/function-bind
|
||||
52
day1/node_modules/function-bind/implementation.js
generated
vendored
Normal file
52
day1/node_modules/function-bind/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint no-invalid-this: 1 */
|
||||
|
||||
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
||||
var slice = Array.prototype.slice;
|
||||
var toStr = Object.prototype.toString;
|
||||
var funcType = '[object Function]';
|
||||
|
||||
module.exports = function bind(that) {
|
||||
var target = this;
|
||||
if (typeof target !== 'function' || toStr.call(target) !== funcType) {
|
||||
throw new TypeError(ERROR_MESSAGE + target);
|
||||
}
|
||||
var args = slice.call(arguments, 1);
|
||||
|
||||
var bound;
|
||||
var binder = function () {
|
||||
if (this instanceof bound) {
|
||||
var result = target.apply(
|
||||
this,
|
||||
args.concat(slice.call(arguments))
|
||||
);
|
||||
if (Object(result) === result) {
|
||||
return result;
|
||||
}
|
||||
return this;
|
||||
} else {
|
||||
return target.apply(
|
||||
that,
|
||||
args.concat(slice.call(arguments))
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
var boundLength = Math.max(0, target.length - args.length);
|
||||
var boundArgs = [];
|
||||
for (var i = 0; i < boundLength; i++) {
|
||||
boundArgs.push('$' + i);
|
||||
}
|
||||
|
||||
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
|
||||
|
||||
if (target.prototype) {
|
||||
var Empty = function Empty() {};
|
||||
Empty.prototype = target.prototype;
|
||||
bound.prototype = new Empty();
|
||||
Empty.prototype = null;
|
||||
}
|
||||
|
||||
return bound;
|
||||
};
|
||||
5
day1/node_modules/function-bind/index.js
generated
vendored
Normal file
5
day1/node_modules/function-bind/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = Function.prototype.bind || implementation;
|
||||
63
day1/node_modules/function-bind/package.json
generated
vendored
Normal file
63
day1/node_modules/function-bind/package.json
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "function-bind",
|
||||
"version": "1.1.1",
|
||||
"description": "Implementation of Function.prototype.bind",
|
||||
"keywords": [
|
||||
"function",
|
||||
"bind",
|
||||
"shim",
|
||||
"es5"
|
||||
],
|
||||
"author": "Raynos <raynos2@gmail.com>",
|
||||
"repository": "git://github.com/Raynos/function-bind.git",
|
||||
"main": "index",
|
||||
"homepage": "https://github.com/Raynos/function-bind",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Raynos"
|
||||
},
|
||||
{
|
||||
"name": "Jordan Harband",
|
||||
"url": "https://github.com/ljharb"
|
||||
}
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/Raynos/function-bind/issues",
|
||||
"email": "raynos2@gmail.com"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^12.2.1",
|
||||
"covert": "^1.1.0",
|
||||
"eslint": "^4.5.0",
|
||||
"jscs": "^3.0.7",
|
||||
"tape": "^4.8.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "npm run coverage -- --quiet",
|
||||
"tests-only": "node test",
|
||||
"coverage": "covert test/*.js",
|
||||
"lint": "npm run jscs && npm run eslint",
|
||||
"jscs": "jscs *.js */*.js",
|
||||
"eslint": "eslint *.js */*.js"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/16..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/22..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
}
|
||||
}
|
||||
9
day1/node_modules/function-bind/test/.eslintrc
generated
vendored
Normal file
9
day1/node_modules/function-bind/test/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"rules": {
|
||||
"array-bracket-newline": 0,
|
||||
"array-element-newline": 0,
|
||||
"max-statements-per-line": [2, { "max": 2 }],
|
||||
"no-invalid-this": 0,
|
||||
"no-magic-numbers": 0,
|
||||
}
|
||||
}
|
||||
252
day1/node_modules/function-bind/test/index.js
generated
vendored
Normal file
252
day1/node_modules/function-bind/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
// jscs:disable requireUseStrict
|
||||
|
||||
var test = require('tape');
|
||||
|
||||
var functionBind = require('../implementation');
|
||||
var getCurrentContext = function () { return this; };
|
||||
|
||||
test('functionBind is a function', function (t) {
|
||||
t.equal(typeof functionBind, 'function');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('non-functions', function (t) {
|
||||
var nonFunctions = [true, false, [], {}, 42, 'foo', NaN, /a/g];
|
||||
t.plan(nonFunctions.length);
|
||||
for (var i = 0; i < nonFunctions.length; ++i) {
|
||||
try { functionBind.call(nonFunctions[i]); } catch (ex) {
|
||||
t.ok(ex instanceof TypeError, 'throws when given ' + String(nonFunctions[i]));
|
||||
}
|
||||
}
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('without a context', function (t) {
|
||||
t.test('binds properly', function (st) {
|
||||
var args, context;
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
context = this;
|
||||
})
|
||||
};
|
||||
namespace.func(1, 2, 3);
|
||||
st.deepEqual(args, [1, 2, 3]);
|
||||
st.equal(context, getCurrentContext.call());
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('binds properly, and still supplies bound arguments', function (st) {
|
||||
var args, context;
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
context = this;
|
||||
}, undefined, 1, 2, 3)
|
||||
};
|
||||
namespace.func(4, 5, 6);
|
||||
st.deepEqual(args, [1, 2, 3, 4, 5, 6]);
|
||||
st.equal(context, getCurrentContext.call());
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('returns properly', function (st) {
|
||||
var args;
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
return this;
|
||||
}, null)
|
||||
};
|
||||
var context = namespace.func(1, 2, 3);
|
||||
st.equal(context, getCurrentContext.call(), 'returned context is namespaced context');
|
||||
st.deepEqual(args, [1, 2, 3], 'passed arguments are correct');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('returns properly with bound arguments', function (st) {
|
||||
var args;
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
return this;
|
||||
}, null, 1, 2, 3)
|
||||
};
|
||||
var context = namespace.func(4, 5, 6);
|
||||
st.equal(context, getCurrentContext.call(), 'returned context is namespaced context');
|
||||
st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('called as a constructor', function (st) {
|
||||
var thunkify = function (value) {
|
||||
return function () { return value; };
|
||||
};
|
||||
st.test('returns object value', function (sst) {
|
||||
var expectedReturnValue = [1, 2, 3];
|
||||
var Constructor = functionBind.call(thunkify(expectedReturnValue), null);
|
||||
var result = new Constructor();
|
||||
sst.equal(result, expectedReturnValue);
|
||||
sst.end();
|
||||
});
|
||||
|
||||
st.test('does not return primitive value', function (sst) {
|
||||
var Constructor = functionBind.call(thunkify(42), null);
|
||||
var result = new Constructor();
|
||||
sst.notEqual(result, 42);
|
||||
sst.end();
|
||||
});
|
||||
|
||||
st.test('object from bound constructor is instance of original and bound constructor', function (sst) {
|
||||
var A = function (x) {
|
||||
this.name = x || 'A';
|
||||
};
|
||||
var B = functionBind.call(A, null, 'B');
|
||||
|
||||
var result = new B();
|
||||
sst.ok(result instanceof B, 'result is instance of bound constructor');
|
||||
sst.ok(result instanceof A, 'result is instance of original constructor');
|
||||
sst.end();
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('with a context', function (t) {
|
||||
t.test('with no bound arguments', function (st) {
|
||||
var args, context;
|
||||
var boundContext = {};
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
context = this;
|
||||
}, boundContext)
|
||||
};
|
||||
namespace.func(1, 2, 3);
|
||||
st.equal(context, boundContext, 'binds a context properly');
|
||||
st.deepEqual(args, [1, 2, 3], 'supplies passed arguments');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('with bound arguments', function (st) {
|
||||
var args, context;
|
||||
var boundContext = {};
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
context = this;
|
||||
}, boundContext, 1, 2, 3)
|
||||
};
|
||||
namespace.func(4, 5, 6);
|
||||
st.equal(context, boundContext, 'binds a context properly');
|
||||
st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'supplies bound and passed arguments');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('returns properly', function (st) {
|
||||
var boundContext = {};
|
||||
var args;
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
return this;
|
||||
}, boundContext)
|
||||
};
|
||||
var context = namespace.func(1, 2, 3);
|
||||
st.equal(context, boundContext, 'returned context is bound context');
|
||||
st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context');
|
||||
st.deepEqual(args, [1, 2, 3], 'passed arguments are correct');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('returns properly with bound arguments', function (st) {
|
||||
var boundContext = {};
|
||||
var args;
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
return this;
|
||||
}, boundContext, 1, 2, 3)
|
||||
};
|
||||
var context = namespace.func(4, 5, 6);
|
||||
st.equal(context, boundContext, 'returned context is bound context');
|
||||
st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context');
|
||||
st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('passes the correct arguments when called as a constructor', function (st) {
|
||||
var expected = { name: 'Correct' };
|
||||
var namespace = {
|
||||
Func: functionBind.call(function (arg) {
|
||||
return arg;
|
||||
}, { name: 'Incorrect' })
|
||||
};
|
||||
var returned = new namespace.Func(expected);
|
||||
st.equal(returned, expected, 'returns the right arg when called as a constructor');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('has the new instance\'s context when called as a constructor', function (st) {
|
||||
var actualContext;
|
||||
var expectedContext = { foo: 'bar' };
|
||||
var namespace = {
|
||||
Func: functionBind.call(function () {
|
||||
actualContext = this;
|
||||
}, expectedContext)
|
||||
};
|
||||
var result = new namespace.Func();
|
||||
st.equal(result instanceof namespace.Func, true);
|
||||
st.notEqual(actualContext, expectedContext);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('bound function length', function (t) {
|
||||
t.test('sets a correct length without thisArg', function (st) {
|
||||
var subject = functionBind.call(function (a, b, c) { return a + b + c; });
|
||||
st.equal(subject.length, 3);
|
||||
st.equal(subject(1, 2, 3), 6);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('sets a correct length with thisArg', function (st) {
|
||||
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {});
|
||||
st.equal(subject.length, 3);
|
||||
st.equal(subject(1, 2, 3), 6);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('sets a correct length without thisArg and first argument', function (st) {
|
||||
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1);
|
||||
st.equal(subject.length, 2);
|
||||
st.equal(subject(2, 3), 6);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('sets a correct length with thisArg and first argument', function (st) {
|
||||
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1);
|
||||
st.equal(subject.length, 2);
|
||||
st.equal(subject(2, 3), 6);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('sets a correct length without thisArg and too many arguments', function (st) {
|
||||
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1, 2, 3, 4);
|
||||
st.equal(subject.length, 0);
|
||||
st.equal(subject(), 6);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('sets a correct length with thisArg and too many arguments', function (st) {
|
||||
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1, 2, 3, 4);
|
||||
st.equal(subject.length, 0);
|
||||
st.equal(subject(), 6);
|
||||
st.end();
|
||||
});
|
||||
});
|
||||
22
day1/node_modules/has/LICENSE-MIT
generated
vendored
Normal file
22
day1/node_modules/has/LICENSE-MIT
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2013 Thiago de Arruda
|
||||
|
||||
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.
|
||||
18
day1/node_modules/has/README.md
generated
vendored
Normal file
18
day1/node_modules/has/README.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# has
|
||||
|
||||
> Object.prototype.hasOwnProperty.call shortcut
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save has
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var has = require('has');
|
||||
|
||||
has({}, 'hasOwnProperty'); // false
|
||||
has(Object.prototype, 'hasOwnProperty'); // true
|
||||
```
|
||||
48
day1/node_modules/has/package.json
generated
vendored
Normal file
48
day1/node_modules/has/package.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "has",
|
||||
"description": "Object.prototype.hasOwnProperty.call shortcut",
|
||||
"version": "1.0.3",
|
||||
"homepage": "https://github.com/tarruda/has",
|
||||
"author": {
|
||||
"name": "Thiago de Arruda",
|
||||
"email": "tpadilha84@gmail.com"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jordan Harband",
|
||||
"email": "ljharb@gmail.com",
|
||||
"url": "http://ljharb.codes"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/tarruda/has.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tarruda/has/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT"
|
||||
}
|
||||
],
|
||||
"main": "./src",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^12.2.1",
|
||||
"eslint": "^4.19.1",
|
||||
"tape": "^4.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"pretest": "npm run lint",
|
||||
"test": "tape test"
|
||||
}
|
||||
}
|
||||
5
day1/node_modules/has/src/index.js
generated
vendored
Normal file
5
day1/node_modules/has/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var bind = require('function-bind');
|
||||
|
||||
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
||||
10
day1/node_modules/has/test/index.js
generated
vendored
Normal file
10
day1/node_modules/has/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var has = require('../');
|
||||
|
||||
test('has', function (t) {
|
||||
t.equal(has({}, 'hasOwnProperty'), false, 'object literal does not have own property "hasOwnProperty"');
|
||||
t.equal(has(Object.prototype, 'hasOwnProperty'), true, 'Object.prototype has own property "hasOwnProperty"');
|
||||
t.end();
|
||||
});
|
||||
18
day1/node_modules/is-core-module/.eslintrc
generated
vendored
Normal file
18
day1/node_modules/is-core-module/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": "@ljharb",
|
||||
"root": true,
|
||||
"rules": {
|
||||
"func-style": 1,
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": "test/**",
|
||||
"rules": {
|
||||
"global-require": 0,
|
||||
"max-depth": 0,
|
||||
"max-lines-per-function": 0,
|
||||
"no-negated-condition": 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
9
day1/node_modules/is-core-module/.nycrc
generated
vendored
Normal file
9
day1/node_modules/is-core-module/.nycrc
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
||||
143
day1/node_modules/is-core-module/CHANGELOG.md
generated
vendored
Normal file
143
day1/node_modules/is-core-module/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v2.10.0](https://github.com/inspect-js/is-core-module/compare/v2.9.0...v2.10.0) - 2022-08-03
|
||||
|
||||
### Commits
|
||||
|
||||
- [New] `node:test` is now available in node ^16.17 [`e8fd36e`](https://github.com/inspect-js/is-core-module/commit/e8fd36e9b86c917775a07cc473b62a3294f459f2)
|
||||
- [Tests] improve skip message [`c014a4c`](https://github.com/inspect-js/is-core-module/commit/c014a4c0cd6eb15fff573ae4709191775e70cab4)
|
||||
|
||||
## [v2.9.0](https://github.com/inspect-js/is-core-module/compare/v2.8.1...v2.9.0) - 2022-04-19
|
||||
|
||||
### Commits
|
||||
|
||||
- [New] add `node:test`, in node 18+ [`f853eca`](https://github.com/inspect-js/is-core-module/commit/f853eca801d0a7d4e1dbb670f1b6d9837d9533c5)
|
||||
- [Tests] use `mock-property` [`03b3644`](https://github.com/inspect-js/is-core-module/commit/03b3644dff4417f4ba5a7d0aa0138f5f6b3e5c46)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`7c0e2d0`](https://github.com/inspect-js/is-core-module/commit/7c0e2d06ed2a89acf53abe2ab34d703ed5b03455)
|
||||
- [meta] simplify "exports" [`d6ed201`](https://github.com/inspect-js/is-core-module/commit/d6ed201eba7fbba0e59814a9050fc49a6e9878c8)
|
||||
|
||||
## [v2.8.1](https://github.com/inspect-js/is-core-module/compare/v2.8.0...v2.8.1) - 2022-01-05
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] reuse common workflows [`cd2cf9b`](https://github.com/inspect-js/is-core-module/commit/cd2cf9b3b66c8d328f65610efe41e9325db7716d)
|
||||
- [Fix] update node 0.4 results [`062195d`](https://github.com/inspect-js/is-core-module/commit/062195d89f0876a88b95d378b43f7fcc1205bc5b)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`0790b62`](https://github.com/inspect-js/is-core-module/commit/0790b6222848c6167132f9f73acc3520fa8d1298)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`7d139a6`](https://github.com/inspect-js/is-core-module/commit/7d139a6d767709eabf0a0251e074ec1fb230c06e)
|
||||
- [Tests] run `nyc` in `tests-only`, not `test` [`780e8a0`](https://github.com/inspect-js/is-core-module/commit/780e8a049951c71cf78b1707f0871c48a28bde14)
|
||||
|
||||
## [v2.8.0](https://github.com/inspect-js/is-core-module/compare/v2.7.0...v2.8.0) - 2021-10-14
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] update codecov uploader [`0cfe94e`](https://github.com/inspect-js/is-core-module/commit/0cfe94e106a7d005ea03e008c0a21dec13a77904)
|
||||
- [New] add `readline/promises` to node v17+ [`4f78c30`](https://github.com/inspect-js/is-core-module/commit/4f78c3008b1b58b4db6dc91d99610b1bc859da7e)
|
||||
- [Tests] node ^14.18 supports `node:` prefixes for CJS [`43e2f17`](https://github.com/inspect-js/is-core-module/commit/43e2f177452cea2f0eaf34f61b5407217bbdb6f4)
|
||||
|
||||
## [v2.7.0](https://github.com/inspect-js/is-core-module/compare/v2.6.0...v2.7.0) - 2021-09-27
|
||||
|
||||
### Commits
|
||||
|
||||
- [New] node `v14.18` added `node:`-prefixed core modules to `require` [`6d943ab`](https://github.com/inspect-js/is-core-module/commit/6d943abe81382b9bbe344384d80fbfebe1cc0526)
|
||||
- [Tests] add coverage for Object.prototype pollution [`c6baf5f`](https://github.com/inspect-js/is-core-module/commit/c6baf5f942311a1945c1af41167bb80b84df2af7)
|
||||
- [Dev Deps] update `@ljharb/eslint-config` [`6717f00`](https://github.com/inspect-js/is-core-module/commit/6717f000d063ea57beb772bded36c2f056ac404c)
|
||||
- [eslint] fix linter warning [`594c10b`](https://github.com/inspect-js/is-core-module/commit/594c10bb7d39d7eb00925c90924199ff596184b2)
|
||||
- [meta] add `sideEffects` flag [`c32cfa5`](https://github.com/inspect-js/is-core-module/commit/c32cfa5195632944c4dd4284a142b8476e75be13)
|
||||
|
||||
## [v2.6.0](https://github.com/inspect-js/is-core-module/compare/v2.5.0...v2.6.0) - 2021-08-17
|
||||
|
||||
### Commits
|
||||
|
||||
- [Dev Deps] update `eslint`, `tape` [`6cc928f`](https://github.com/inspect-js/is-core-module/commit/6cc928f8a4bba66aeeccc4f6beeac736d4bd3081)
|
||||
- [New] add `stream/consumers` to node `>= 16.7` [`a1a423e`](https://github.com/inspect-js/is-core-module/commit/a1a423e467e4cc27df180234fad5bab45943e67d)
|
||||
- [Refactor] Remove duplicated `&&` operand [`86faea7`](https://github.com/inspect-js/is-core-module/commit/86faea738213a2433c62d1098488dc9314dca832)
|
||||
- [Tests] include prereleases [`a4da7a6`](https://github.com/inspect-js/is-core-module/commit/a4da7a6abf7568e2aa4fd98e69452179f1850963)
|
||||
|
||||
## [v2.5.0](https://github.com/inspect-js/is-core-module/compare/v2.4.0...v2.5.0) - 2021-07-12
|
||||
|
||||
### Commits
|
||||
|
||||
- [Dev Deps] update `auto-changelog`, `eslint` [`6334cc9`](https://github.com/inspect-js/is-core-module/commit/6334cc94f3af7469685bd8f236740991baaf2705)
|
||||
- [New] add `stream/web` to node v16.5+ [`17ac59b`](https://github.com/inspect-js/is-core-module/commit/17ac59b662d63e220a2e5728625f005c24f177b2)
|
||||
|
||||
## [v2.4.0](https://github.com/inspect-js/is-core-module/compare/v2.3.0...v2.4.0) - 2021-05-09
|
||||
|
||||
### Commits
|
||||
|
||||
- [readme] add actions and codecov badges [`82b7faa`](https://github.com/inspect-js/is-core-module/commit/82b7faa12b56dbe47fbea67e1a5b9e447027ba40)
|
||||
- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`8096868`](https://github.com/inspect-js/is-core-module/commit/8096868c024a161ccd4d44110b136763e92eace8)
|
||||
- [Dev Deps] update `eslint` [`6726824`](https://github.com/inspect-js/is-core-module/commit/67268249b88230018c510f6532a8046d7326346f)
|
||||
- [New] add `diagnostics_channel` to node `^14.17` [`86c6563`](https://github.com/inspect-js/is-core-module/commit/86c65634201b8ff9b3e48a9a782594579c7f5c3c)
|
||||
- [meta] fix prepublish script [`697a01e`](https://github.com/inspect-js/is-core-module/commit/697a01e3c9c0be074066520954f30fb28532ec57)
|
||||
|
||||
## [v2.3.0](https://github.com/inspect-js/is-core-module/compare/v2.2.0...v2.3.0) - 2021-04-24
|
||||
|
||||
### Commits
|
||||
|
||||
- [meta] do not publish github action workflow files [`060d4bb`](https://github.com/inspect-js/is-core-module/commit/060d4bb971a29451c19ff336eb56bee27f9fa95a)
|
||||
- [New] add support for `node:` prefix, in node 16+ [`7341223`](https://github.com/inspect-js/is-core-module/commit/73412230a769f6e81c05eea50b6520cebf54ed2f)
|
||||
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`016269a`](https://github.com/inspect-js/is-core-module/commit/016269abae9f6657a5254adfbb813f09a05067f9)
|
||||
- [patch] remove unneeded `.0` in version ranges [`cb466a6`](https://github.com/inspect-js/is-core-module/commit/cb466a6d89e52b8389e5c12715efcd550c41cea3)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`c9f9c39`](https://github.com/inspect-js/is-core-module/commit/c9f9c396ace60ef81906f98059c064e6452473ed)
|
||||
- [actions] update workflows [`3ee4a89`](https://github.com/inspect-js/is-core-module/commit/3ee4a89fd5a02fccd43882d905448ea6a98e9a3c)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`dee4fed`](https://github.com/inspect-js/is-core-module/commit/dee4fed79690c1d43a22f7fa9426abebdc6d727f)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`7d046ba`](https://github.com/inspect-js/is-core-module/commit/7d046ba07ae8c9292e43652694ca808d7b309de8)
|
||||
- [meta] use `prepublishOnly` script for npm 7+ [`149e677`](https://github.com/inspect-js/is-core-module/commit/149e6771a5ede6d097e71785b467a9c4b4977cc7)
|
||||
- [readme] remove travis badge [`903b51d`](https://github.com/inspect-js/is-core-module/commit/903b51d6b69b98abeabfbc3695c345b02646f19c)
|
||||
|
||||
## [v2.2.0](https://github.com/inspect-js/is-core-module/compare/v2.1.0...v2.2.0) - 2020-11-26
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] migrate tests to Github Actions [`c919f57`](https://github.com/inspect-js/is-core-module/commit/c919f573c0a92d10a0acad0b650b5aecb033d426)
|
||||
- [patch] `core.json`: %s/ /\t/g [`db3f685`](https://github.com/inspect-js/is-core-module/commit/db3f68581f53e73cc09cd675955eb1bdd6a5a39b)
|
||||
- [Tests] run `nyc` on all tests [`b2f925f`](https://github.com/inspect-js/is-core-module/commit/b2f925f8866f210ef441f39fcc8cc42692ab89b1)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`; add `safe-publish-latest` [`89f02a2`](https://github.com/inspect-js/is-core-module/commit/89f02a2b4162246dea303a6ee31bb9a550b05c72)
|
||||
- [New] add `path/posix`, `path/win32`, `util/types` [`77f94f1`](https://github.com/inspect-js/is-core-module/commit/77f94f1e90ffd7c0be2a3f1aa8574ebf7fd981b3)
|
||||
|
||||
## [v2.1.0](https://github.com/inspect-js/is-core-module/compare/v2.0.0...v2.1.0) - 2020-11-04
|
||||
|
||||
### Commits
|
||||
|
||||
- [Dev Deps] update `eslint` [`5e0034e`](https://github.com/inspect-js/is-core-module/commit/5e0034eae57c09c8f1bd769f502486a00f56c6e4)
|
||||
- [New] Add `diagnostics_channel` [`c2d83d0`](https://github.com/inspect-js/is-core-module/commit/c2d83d0a0225a1a658945d9bab7036ea347d29ec)
|
||||
|
||||
## [v2.0.0](https://github.com/inspect-js/is-core-module/compare/v1.0.2...v2.0.0) - 2020-09-29
|
||||
|
||||
### Commits
|
||||
|
||||
- v2 implementation [`865aeb5`](https://github.com/inspect-js/is-core-module/commit/865aeb5ca0e90248a3dfff5d7622e4751fdeb9cd)
|
||||
- Only apps should have lockfiles [`5a5e660`](https://github.com/inspect-js/is-core-module/commit/5a5e660d568e37eb44e17fb1ebb12a105205fc2b)
|
||||
- Initial commit for v2 [`5a51524`](https://github.com/inspect-js/is-core-module/commit/5a51524e06f92adece5fbb138c69b7b9748a2348)
|
||||
- Tests [`116eae4`](https://github.com/inspect-js/is-core-module/commit/116eae4fccd01bc72c1fd3cc4b7561c387afc496)
|
||||
- [meta] add `auto-changelog` [`c24388b`](https://github.com/inspect-js/is-core-module/commit/c24388bee828d223040519d1f5b226ca35beee63)
|
||||
- [actions] add "Automatic Rebase" and "require allow edits" actions [`34292db`](https://github.com/inspect-js/is-core-module/commit/34292dbcbadae0868aff03c22dbd8b7b8a11558a)
|
||||
- [Tests] add `npm run lint` [`4f9eeee`](https://github.com/inspect-js/is-core-module/commit/4f9eeee7ddff10698bbf528620f4dc8d4fa3e697)
|
||||
- [readme] fix travis badges, https all URLs [`e516a73`](https://github.com/inspect-js/is-core-module/commit/e516a73b0dccce20938c432b1ba512eae8eff9e9)
|
||||
- [meta] create FUNDING.yml [`1aabebc`](https://github.com/inspect-js/is-core-module/commit/1aabebca98d01f8a04e46bc2e2520fa93cf21ac6)
|
||||
- [Fix] `domain`: domain landed sometime > v0.7.7 and <= v0.7.12 [`2df7d37`](https://github.com/inspect-js/is-core-module/commit/2df7d37595d41b15eeada732b706b926c2771655)
|
||||
- [Fix] `sys`: worked in 0.6, not 0.7, and 0.8+ [`a75c134`](https://github.com/inspect-js/is-core-module/commit/a75c134229e1e9441801f6b73f6a52489346eb65)
|
||||
|
||||
## [v1.0.2](https://github.com/inspect-js/is-core-module/compare/v1.0.1...v1.0.2) - 2014-09-28
|
||||
|
||||
### Commits
|
||||
|
||||
- simpler [`66fe90f`](https://github.com/inspect-js/is-core-module/commit/66fe90f9771581b9adc0c3900baa52c21b5baea2)
|
||||
|
||||
## [v1.0.1](https://github.com/inspect-js/is-core-module/compare/v1.0.0...v1.0.1) - 2014-09-28
|
||||
|
||||
### Commits
|
||||
|
||||
- remove stupid [`f21f906`](https://github.com/inspect-js/is-core-module/commit/f21f906f882c2bd656a5fc5ed6fbe48ddaffb2ac)
|
||||
- update readme [`1eff0ec`](https://github.com/inspect-js/is-core-module/commit/1eff0ec69798d1ec65771552d1562911e90a8027)
|
||||
|
||||
## v1.0.0 - 2014-09-28
|
||||
|
||||
### Commits
|
||||
|
||||
- init [`48e5e76`](https://github.com/inspect-js/is-core-module/commit/48e5e76cac378fddb8c1f7d4055b8dfc943d6b96)
|
||||
20
day1/node_modules/is-core-module/LICENSE
generated
vendored
Normal file
20
day1/node_modules/is-core-module/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Dave Justice
|
||||
|
||||
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.
|
||||
40
day1/node_modules/is-core-module/README.md
generated
vendored
Normal file
40
day1/node_modules/is-core-module/README.md
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# is-core-module <sup>[![Version Badge][2]][1]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][5]][6]
|
||||
[![dev dependency status][7]][8]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][11]][1]
|
||||
|
||||
Is this specifier a node.js core module? Optionally provide a node version to check; defaults to the current node version.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var isCore = require('is-core-module');
|
||||
var assert = require('assert');
|
||||
assert(isCore('fs'));
|
||||
assert(!isCore('butts'));
|
||||
```
|
||||
|
||||
## Tests
|
||||
Clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[1]: https://npmjs.org/package/is-core-module
|
||||
[2]: https://versionbadg.es/inspect-js/is-core-module.svg
|
||||
[5]: https://david-dm.org/inspect-js/is-core-module.svg
|
||||
[6]: https://david-dm.org/inspect-js/is-core-module
|
||||
[7]: https://david-dm.org/inspect-js/is-core-module/dev-status.svg
|
||||
[8]: https://david-dm.org/inspect-js/is-core-module#info=devDependencies
|
||||
[11]: https://nodei.co/npm/is-core-module.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/is-core-module.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/is-core-module.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=is-core-module
|
||||
[codecov-image]: https://codecov.io/gh/inspect-js/is-core-module/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/inspect-js/is-core-module/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-core-module
|
||||
[actions-url]: https://github.com/inspect-js/is-core-module/actions
|
||||
153
day1/node_modules/is-core-module/core.json
generated
vendored
Normal file
153
day1/node_modules/is-core-module/core.json
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
{
|
||||
"assert": true,
|
||||
"node:assert": [">= 14.18 && < 15", ">= 16"],
|
||||
"assert/strict": ">= 15",
|
||||
"node:assert/strict": ">= 16",
|
||||
"async_hooks": ">= 8",
|
||||
"node:async_hooks": [">= 14.18 && < 15", ">= 16"],
|
||||
"buffer_ieee754": ">= 0.5 && < 0.9.7",
|
||||
"buffer": true,
|
||||
"node:buffer": [">= 14.18 && < 15", ">= 16"],
|
||||
"child_process": true,
|
||||
"node:child_process": [">= 14.18 && < 15", ">= 16"],
|
||||
"cluster": ">= 0.5",
|
||||
"node:cluster": [">= 14.18 && < 15", ">= 16"],
|
||||
"console": true,
|
||||
"node:console": [">= 14.18 && < 15", ">= 16"],
|
||||
"constants": true,
|
||||
"node:constants": [">= 14.18 && < 15", ">= 16"],
|
||||
"crypto": true,
|
||||
"node:crypto": [">= 14.18 && < 15", ">= 16"],
|
||||
"_debug_agent": ">= 1 && < 8",
|
||||
"_debugger": "< 8",
|
||||
"dgram": true,
|
||||
"node:dgram": [">= 14.18 && < 15", ">= 16"],
|
||||
"diagnostics_channel": [">= 14.17 && < 15", ">= 15.1"],
|
||||
"node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
|
||||
"dns": true,
|
||||
"node:dns": [">= 14.18 && < 15", ">= 16"],
|
||||
"dns/promises": ">= 15",
|
||||
"node:dns/promises": ">= 16",
|
||||
"domain": ">= 0.7.12",
|
||||
"node:domain": [">= 14.18 && < 15", ">= 16"],
|
||||
"events": true,
|
||||
"node:events": [">= 14.18 && < 15", ">= 16"],
|
||||
"freelist": "< 6",
|
||||
"fs": true,
|
||||
"node:fs": [">= 14.18 && < 15", ">= 16"],
|
||||
"fs/promises": [">= 10 && < 10.1", ">= 14"],
|
||||
"node:fs/promises": [">= 14.18 && < 15", ">= 16"],
|
||||
"_http_agent": ">= 0.11.1",
|
||||
"node:_http_agent": [">= 14.18 && < 15", ">= 16"],
|
||||
"_http_client": ">= 0.11.1",
|
||||
"node:_http_client": [">= 14.18 && < 15", ">= 16"],
|
||||
"_http_common": ">= 0.11.1",
|
||||
"node:_http_common": [">= 14.18 && < 15", ">= 16"],
|
||||
"_http_incoming": ">= 0.11.1",
|
||||
"node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
|
||||
"_http_outgoing": ">= 0.11.1",
|
||||
"node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
|
||||
"_http_server": ">= 0.11.1",
|
||||
"node:_http_server": [">= 14.18 && < 15", ">= 16"],
|
||||
"http": true,
|
||||
"node:http": [">= 14.18 && < 15", ">= 16"],
|
||||
"http2": ">= 8.8",
|
||||
"node:http2": [">= 14.18 && < 15", ">= 16"],
|
||||
"https": true,
|
||||
"node:https": [">= 14.18 && < 15", ">= 16"],
|
||||
"inspector": ">= 8",
|
||||
"node:inspector": [">= 14.18 && < 15", ">= 16"],
|
||||
"_linklist": "< 8",
|
||||
"module": true,
|
||||
"node:module": [">= 14.18 && < 15", ">= 16"],
|
||||
"net": true,
|
||||
"node:net": [">= 14.18 && < 15", ">= 16"],
|
||||
"node-inspect/lib/_inspect": ">= 7.6 && < 12",
|
||||
"node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
|
||||
"node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
|
||||
"os": true,
|
||||
"node:os": [">= 14.18 && < 15", ">= 16"],
|
||||
"path": true,
|
||||
"node:path": [">= 14.18 && < 15", ">= 16"],
|
||||
"path/posix": ">= 15.3",
|
||||
"node:path/posix": ">= 16",
|
||||
"path/win32": ">= 15.3",
|
||||
"node:path/win32": ">= 16",
|
||||
"perf_hooks": ">= 8.5",
|
||||
"node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
|
||||
"process": ">= 1",
|
||||
"node:process": [">= 14.18 && < 15", ">= 16"],
|
||||
"punycode": ">= 0.5",
|
||||
"node:punycode": [">= 14.18 && < 15", ">= 16"],
|
||||
"querystring": true,
|
||||
"node:querystring": [">= 14.18 && < 15", ">= 16"],
|
||||
"readline": true,
|
||||
"node:readline": [">= 14.18 && < 15", ">= 16"],
|
||||
"readline/promises": ">= 17",
|
||||
"node:readline/promises": ">= 17",
|
||||
"repl": true,
|
||||
"node:repl": [">= 14.18 && < 15", ">= 16"],
|
||||
"smalloc": ">= 0.11.5 && < 3",
|
||||
"_stream_duplex": ">= 0.9.4",
|
||||
"node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
|
||||
"_stream_transform": ">= 0.9.4",
|
||||
"node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
|
||||
"_stream_wrap": ">= 1.4.1",
|
||||
"node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
|
||||
"_stream_passthrough": ">= 0.9.4",
|
||||
"node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
|
||||
"_stream_readable": ">= 0.9.4",
|
||||
"node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
|
||||
"_stream_writable": ">= 0.9.4",
|
||||
"node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
|
||||
"stream": true,
|
||||
"node:stream": [">= 14.18 && < 15", ">= 16"],
|
||||
"stream/consumers": ">= 16.7",
|
||||
"node:stream/consumers": ">= 16.7",
|
||||
"stream/promises": ">= 15",
|
||||
"node:stream/promises": ">= 16",
|
||||
"stream/web": ">= 16.5",
|
||||
"node:stream/web": ">= 16.5",
|
||||
"string_decoder": true,
|
||||
"node:string_decoder": [">= 14.18 && < 15", ">= 16"],
|
||||
"sys": [">= 0.4 && < 0.7", ">= 0.8"],
|
||||
"node:sys": [">= 14.18 && < 15", ">= 16"],
|
||||
"node:test": [">= 16.17 && < 17", ">= 18"],
|
||||
"timers": true,
|
||||
"node:timers": [">= 14.18 && < 15", ">= 16"],
|
||||
"timers/promises": ">= 15",
|
||||
"node:timers/promises": ">= 16",
|
||||
"_tls_common": ">= 0.11.13",
|
||||
"node:_tls_common": [">= 14.18 && < 15", ">= 16"],
|
||||
"_tls_legacy": ">= 0.11.3 && < 10",
|
||||
"_tls_wrap": ">= 0.11.3",
|
||||
"node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
|
||||
"tls": true,
|
||||
"node:tls": [">= 14.18 && < 15", ">= 16"],
|
||||
"trace_events": ">= 10",
|
||||
"node:trace_events": [">= 14.18 && < 15", ">= 16"],
|
||||
"tty": true,
|
||||
"node:tty": [">= 14.18 && < 15", ">= 16"],
|
||||
"url": true,
|
||||
"node:url": [">= 14.18 && < 15", ">= 16"],
|
||||
"util": true,
|
||||
"node:util": [">= 14.18 && < 15", ">= 16"],
|
||||
"util/types": ">= 15.3",
|
||||
"node:util/types": ">= 16",
|
||||
"v8/tools/arguments": ">= 10 && < 12",
|
||||
"v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
||||
"v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
||||
"v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
||||
"v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
||||
"v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
||||
"v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
||||
"v8": ">= 1",
|
||||
"node:v8": [">= 14.18 && < 15", ">= 16"],
|
||||
"vm": true,
|
||||
"node:vm": [">= 14.18 && < 15", ">= 16"],
|
||||
"wasi": ">= 13.4 && < 13.5",
|
||||
"worker_threads": ">= 11.7",
|
||||
"node:worker_threads": [">= 14.18 && < 15", ">= 16"],
|
||||
"zlib": ">= 0.5",
|
||||
"node:zlib": [">= 14.18 && < 15", ">= 16"]
|
||||
}
|
||||
69
day1/node_modules/is-core-module/index.js
generated
vendored
Normal file
69
day1/node_modules/is-core-module/index.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
'use strict';
|
||||
|
||||
var has = require('has');
|
||||
|
||||
function specifierIncluded(current, specifier) {
|
||||
var nodeParts = current.split('.');
|
||||
var parts = specifier.split(' ');
|
||||
var op = parts.length > 1 ? parts[0] : '=';
|
||||
var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.');
|
||||
|
||||
for (var i = 0; i < 3; ++i) {
|
||||
var cur = parseInt(nodeParts[i] || 0, 10);
|
||||
var ver = parseInt(versionParts[i] || 0, 10);
|
||||
if (cur === ver) {
|
||||
continue; // eslint-disable-line no-restricted-syntax, no-continue
|
||||
}
|
||||
if (op === '<') {
|
||||
return cur < ver;
|
||||
}
|
||||
if (op === '>=') {
|
||||
return cur >= ver;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return op === '>=';
|
||||
}
|
||||
|
||||
function matchesRange(current, range) {
|
||||
var specifiers = range.split(/ ?&& ?/);
|
||||
if (specifiers.length === 0) {
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < specifiers.length; ++i) {
|
||||
if (!specifierIncluded(current, specifiers[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function versionIncluded(nodeVersion, specifierValue) {
|
||||
if (typeof specifierValue === 'boolean') {
|
||||
return specifierValue;
|
||||
}
|
||||
|
||||
var current = typeof nodeVersion === 'undefined'
|
||||
? process.versions && process.versions.node
|
||||
: nodeVersion;
|
||||
|
||||
if (typeof current !== 'string') {
|
||||
throw new TypeError(typeof nodeVersion === 'undefined' ? 'Unable to determine current node version' : 'If provided, a valid node version is required');
|
||||
}
|
||||
|
||||
if (specifierValue && typeof specifierValue === 'object') {
|
||||
for (var i = 0; i < specifierValue.length; ++i) {
|
||||
if (matchesRange(current, specifierValue[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return matchesRange(current, specifierValue);
|
||||
}
|
||||
|
||||
var data = require('./core.json');
|
||||
|
||||
module.exports = function isCore(x, nodeVersion) {
|
||||
return has(data, x) && versionIncluded(nodeVersion, data[x]);
|
||||
};
|
||||
65
day1/node_modules/is-core-module/package.json
generated
vendored
Normal file
65
day1/node_modules/is-core-module/package.json
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "is-core-module",
|
||||
"version": "2.10.0",
|
||||
"description": "Is this specifier a node.js core module?",
|
||||
"main": "index.js",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"lint": "eslint .",
|
||||
"pretest": "npm run lint",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/inspect-js/is-core-module.git"
|
||||
},
|
||||
"keywords": [
|
||||
"core",
|
||||
"modules",
|
||||
"module",
|
||||
"npm",
|
||||
"node",
|
||||
"dependencies"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/inspect-js/is-core-module/issues"
|
||||
},
|
||||
"homepage": "https://github.com/inspect-js/is-core-module",
|
||||
"dependencies": {
|
||||
"has": "^1.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^21.0.0",
|
||||
"aud": "^2.0.0",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"eslint": "=8.8.0",
|
||||
"mock-property": "^1.0.0",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"semver": "^6.3.0",
|
||||
"tape": "^5.5.3"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
}
|
||||
}
|
||||
133
day1/node_modules/is-core-module/test/index.js
generated
vendored
Normal file
133
day1/node_modules/is-core-module/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var keys = require('object-keys');
|
||||
var semver = require('semver');
|
||||
var mockProperty = require('mock-property');
|
||||
|
||||
var isCore = require('../');
|
||||
var data = require('../core.json');
|
||||
|
||||
var supportsNodePrefix = semver.satisfies(process.versions.node, '^14.18 || >= 16', { includePrerelease: true });
|
||||
|
||||
test('core modules', function (t) {
|
||||
t.test('isCore()', function (st) {
|
||||
st.ok(isCore('fs'));
|
||||
st.ok(isCore('net'));
|
||||
st.ok(isCore('http'));
|
||||
|
||||
st.ok(!isCore('seq'));
|
||||
st.ok(!isCore('../'));
|
||||
|
||||
st.ok(!isCore('toString'));
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('core list', function (st) {
|
||||
var cores = keys(data);
|
||||
st.plan(cores.length);
|
||||
|
||||
for (var i = 0; i < cores.length; ++i) {
|
||||
var mod = cores[i];
|
||||
var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func
|
||||
if (isCore(mod)) {
|
||||
st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw');
|
||||
} else {
|
||||
st['throws'](requireFunc, mod + ' not supported; requiring throws');
|
||||
}
|
||||
}
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('core via repl module', { skip: !data.repl }, function (st) {
|
||||
var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle
|
||||
if (!libs) {
|
||||
st.skip('repl._builtinLibs does not exist');
|
||||
} else {
|
||||
for (var i = 0; i < libs.length; ++i) {
|
||||
var mod = libs[i];
|
||||
st.ok(data[mod], mod + ' is a core module');
|
||||
st.doesNotThrow(
|
||||
function () { require(mod); }, // eslint-disable-line no-loop-func
|
||||
'requiring ' + mod + ' does not throw'
|
||||
);
|
||||
if (mod.slice(0, 5) !== 'node:') {
|
||||
if (supportsNodePrefix) {
|
||||
st.doesNotThrow(
|
||||
function () { require('node:' + mod); }, // eslint-disable-line no-loop-func
|
||||
'requiring node:' + mod + ' does not throw'
|
||||
);
|
||||
} else {
|
||||
st['throws'](
|
||||
function () { require('node:' + mod); }, // eslint-disable-line no-loop-func
|
||||
'requiring node:' + mod + ' throws'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('core via builtinModules list', { skip: !data.module }, function (st) {
|
||||
var libs = require('module').builtinModules;
|
||||
if (!libs) {
|
||||
st.skip('module.builtinModules does not exist');
|
||||
} else {
|
||||
var excludeList = [
|
||||
'_debug_agent',
|
||||
'v8/tools/tickprocessor-driver',
|
||||
'v8/tools/SourceMap',
|
||||
'v8/tools/tickprocessor',
|
||||
'v8/tools/profile'
|
||||
];
|
||||
// see https://github.com/nodejs/node/issues/42785
|
||||
if (semver.satisfies(process.version, '>= 18')) {
|
||||
libs = libs.concat('node:test');
|
||||
}
|
||||
for (var i = 0; i < libs.length; ++i) {
|
||||
var mod = libs[i];
|
||||
if (excludeList.indexOf(mod) === -1) {
|
||||
st.ok(data[mod], mod + ' is a core module');
|
||||
st.doesNotThrow(
|
||||
function () { require(mod); }, // eslint-disable-line no-loop-func
|
||||
'requiring ' + mod + ' does not throw'
|
||||
);
|
||||
if (mod.slice(0, 5) !== 'node:') {
|
||||
if (supportsNodePrefix) {
|
||||
st.doesNotThrow(
|
||||
function () { require('node:' + mod); }, // eslint-disable-line no-loop-func
|
||||
'requiring node:' + mod + ' does not throw'
|
||||
);
|
||||
} else {
|
||||
st['throws'](
|
||||
function () { require('node:' + mod); }, // eslint-disable-line no-loop-func
|
||||
'requiring node:' + mod + ' throws'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('Object.prototype pollution', function (st) {
|
||||
var nonKey = 'not a core module';
|
||||
st.teardown(mockProperty(Object.prototype, 'fs', { value: false }));
|
||||
st.teardown(mockProperty(Object.prototype, 'path', { value: '>= 999999999' }));
|
||||
st.teardown(mockProperty(Object.prototype, 'http', { value: data.http }));
|
||||
st.teardown(mockProperty(Object.prototype, nonKey, { value: true }));
|
||||
|
||||
st.equal(isCore('fs'), true, 'fs is a core module even if Object.prototype lies');
|
||||
st.equal(isCore('path'), true, 'path is a core module even if Object.prototype lies');
|
||||
st.equal(isCore('http'), true, 'path is a core module even if Object.prototype matches data');
|
||||
st.equal(isCore(nonKey), false, '"' + nonKey + '" is not a core module even if Object.prototype lies');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
20
day1/node_modules/nanoid/LICENSE
generated
vendored
Normal file
20
day1/node_modules/nanoid/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2017 Andrey Sitnik <andrey@sitnik.ru>
|
||||
|
||||
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.
|
||||
39
day1/node_modules/nanoid/README.md
generated
vendored
Normal file
39
day1/node_modules/nanoid/README.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# Nano ID
|
||||
|
||||
<img src="https://ai.github.io/nanoid/logo.svg" align="right"
|
||||
alt="Nano ID logo by Anton Lovchikov" width="180" height="94">
|
||||
|
||||
**English** | [Русский](./README.ru.md) | [简体中文](./README.zh-CN.md) | [Bahasa Indonesia](./README.id-ID.md)
|
||||
|
||||
A tiny, secure, URL-friendly, unique string ID generator for JavaScript.
|
||||
|
||||
> “An amazing level of senseless perfectionism,
|
||||
> which is simply impossible not to respect.”
|
||||
|
||||
* **Small.** 130 bytes (minified and gzipped). No dependencies.
|
||||
[Size Limit] controls the size.
|
||||
* **Fast.** It is 2 times faster than UUID.
|
||||
* **Safe.** It uses hardware random generator. Can be used in clusters.
|
||||
* **Short IDs.** It uses a larger alphabet than UUID (`A-Za-z0-9_-`).
|
||||
So ID size was reduced from 36 to 21 symbols.
|
||||
* **Portable.** Nano ID was ported
|
||||
to [20 programming languages](#other-programming-languages).
|
||||
|
||||
```js
|
||||
import { nanoid } from 'nanoid'
|
||||
model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT"
|
||||
```
|
||||
|
||||
Supports modern browsers, IE [with Babel], Node.js and React Native.
|
||||
|
||||
[online tool]: https://gitpod.io/#https://github.com/ai/nanoid/
|
||||
[with Babel]: https://developer.epages.com/blog/coding/how-to-transpile-node-modules-with-babel-and-webpack-in-a-monorepo/
|
||||
[Size Limit]: https://github.com/ai/size-limit
|
||||
|
||||
<a href="https://evilmartians.com/?utm_source=nanoid">
|
||||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
|
||||
alt="Sponsored by Evil Martians" width="236" height="54">
|
||||
</a>
|
||||
|
||||
## Docs
|
||||
Read **[full docs](https://github.com/ai/nanoid#readme)** on GitHub.
|
||||
34
day1/node_modules/nanoid/async/index.browser.cjs
generated
vendored
Normal file
34
day1/node_modules/nanoid/async/index.browser.cjs
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes))
|
||||
let customAlphabet = (alphabet, defaultSize = 21) => {
|
||||
let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
|
||||
let step = -~((1.6 * mask * defaultSize) / alphabet.length)
|
||||
return async (size = defaultSize) => {
|
||||
let id = ''
|
||||
while (true) {
|
||||
let bytes = crypto.getRandomValues(new Uint8Array(step))
|
||||
let i = step
|
||||
while (i--) {
|
||||
id += alphabet[bytes[i] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let nanoid = async (size = 21) => {
|
||||
let id = ''
|
||||
let bytes = crypto.getRandomValues(new Uint8Array(size))
|
||||
while (size--) {
|
||||
let byte = bytes[size] & 63
|
||||
if (byte < 36) {
|
||||
id += byte.toString(36)
|
||||
} else if (byte < 62) {
|
||||
id += (byte - 26).toString(36).toUpperCase()
|
||||
} else if (byte < 63) {
|
||||
id += '_'
|
||||
} else {
|
||||
id += '-'
|
||||
}
|
||||
}
|
||||
return id
|
||||
}
|
||||
module.exports = { nanoid, customAlphabet, random }
|
||||
34
day1/node_modules/nanoid/async/index.browser.js
generated
vendored
Normal file
34
day1/node_modules/nanoid/async/index.browser.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes))
|
||||
let customAlphabet = (alphabet, defaultSize = 21) => {
|
||||
let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
|
||||
let step = -~((1.6 * mask * defaultSize) / alphabet.length)
|
||||
return async (size = defaultSize) => {
|
||||
let id = ''
|
||||
while (true) {
|
||||
let bytes = crypto.getRandomValues(new Uint8Array(step))
|
||||
let i = step
|
||||
while (i--) {
|
||||
id += alphabet[bytes[i] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let nanoid = async (size = 21) => {
|
||||
let id = ''
|
||||
let bytes = crypto.getRandomValues(new Uint8Array(size))
|
||||
while (size--) {
|
||||
let byte = bytes[size] & 63
|
||||
if (byte < 36) {
|
||||
id += byte.toString(36)
|
||||
} else if (byte < 62) {
|
||||
id += (byte - 26).toString(36).toUpperCase()
|
||||
} else if (byte < 63) {
|
||||
id += '_'
|
||||
} else {
|
||||
id += '-'
|
||||
}
|
||||
}
|
||||
return id
|
||||
}
|
||||
export { nanoid, customAlphabet, random }
|
||||
35
day1/node_modules/nanoid/async/index.cjs
generated
vendored
Normal file
35
day1/node_modules/nanoid/async/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
let crypto = require('crypto')
|
||||
let { urlAlphabet } = require('../url-alphabet/index.cjs')
|
||||
let random = bytes =>
|
||||
new Promise((resolve, reject) => {
|
||||
crypto.randomFill(Buffer.allocUnsafe(bytes), (err, buf) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
} else {
|
||||
resolve(buf)
|
||||
}
|
||||
})
|
||||
})
|
||||
let customAlphabet = (alphabet, defaultSize = 21) => {
|
||||
let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
|
||||
let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
|
||||
let tick = (id, size = defaultSize) =>
|
||||
random(step).then(bytes => {
|
||||
let i = step
|
||||
while (i--) {
|
||||
id += alphabet[bytes[i] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
return tick(id, size)
|
||||
})
|
||||
return size => tick('', size)
|
||||
}
|
||||
let nanoid = (size = 21) =>
|
||||
random(size).then(bytes => {
|
||||
let id = ''
|
||||
while (size--) {
|
||||
id += urlAlphabet[bytes[size] & 63]
|
||||
}
|
||||
return id
|
||||
})
|
||||
module.exports = { nanoid, customAlphabet, random }
|
||||
56
day1/node_modules/nanoid/async/index.d.ts
generated
vendored
Normal file
56
day1/node_modules/nanoid/async/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Generate secure URL-friendly unique ID. The non-blocking version.
|
||||
*
|
||||
* By default, the ID will have 21 symbols to have a collision probability
|
||||
* similar to UUID v4.
|
||||
*
|
||||
* ```js
|
||||
* import { nanoid } from 'nanoid/async'
|
||||
* nanoid().then(id => {
|
||||
* model.id = id
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param size Size of the ID. The default size is 21.
|
||||
* @returns A promise with a random string.
|
||||
*/
|
||||
export function nanoid(size?: number): Promise<string>
|
||||
|
||||
/**
|
||||
* A low-level function.
|
||||
* Generate secure unique ID with custom alphabet. The non-blocking version.
|
||||
*
|
||||
* Alphabet must contain 256 symbols or less. Otherwise, the generator
|
||||
* will not be secure.
|
||||
*
|
||||
* @param alphabet Alphabet used to generate the ID.
|
||||
* @param defaultSize Size of the ID. The default size is 21.
|
||||
* @returns A function that returns a promise with a random string.
|
||||
*
|
||||
* ```js
|
||||
* import { customAlphabet } from 'nanoid/async'
|
||||
* const nanoid = customAlphabet('0123456789абвгдеё', 5)
|
||||
* nanoid().then(id => {
|
||||
* model.id = id //=> "8ё56а"
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
export function customAlphabet(
|
||||
alphabet: string,
|
||||
defaultSize?: number
|
||||
): (size?: number) => Promise<string>
|
||||
|
||||
/**
|
||||
* Generate an array of random bytes collected from hardware noise.
|
||||
*
|
||||
* ```js
|
||||
* import { random } from 'nanoid/async'
|
||||
* random(5).then(bytes => {
|
||||
* bytes //=> [10, 67, 212, 67, 89]
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param bytes Size of the array.
|
||||
* @returns A promise with a random bytes array.
|
||||
*/
|
||||
export function random(bytes: number): Promise<Uint8Array>
|
||||
35
day1/node_modules/nanoid/async/index.js
generated
vendored
Normal file
35
day1/node_modules/nanoid/async/index.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import crypto from 'crypto'
|
||||
import { urlAlphabet } from '../url-alphabet/index.js'
|
||||
let random = bytes =>
|
||||
new Promise((resolve, reject) => {
|
||||
crypto.randomFill(Buffer.allocUnsafe(bytes), (err, buf) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
} else {
|
||||
resolve(buf)
|
||||
}
|
||||
})
|
||||
})
|
||||
let customAlphabet = (alphabet, defaultSize = 21) => {
|
||||
let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
|
||||
let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
|
||||
let tick = (id, size = defaultSize) =>
|
||||
random(step).then(bytes => {
|
||||
let i = step
|
||||
while (i--) {
|
||||
id += alphabet[bytes[i] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
return tick(id, size)
|
||||
})
|
||||
return size => tick('', size)
|
||||
}
|
||||
let nanoid = (size = 21) =>
|
||||
random(size).then(bytes => {
|
||||
let id = ''
|
||||
while (size--) {
|
||||
id += urlAlphabet[bytes[size] & 63]
|
||||
}
|
||||
return id
|
||||
})
|
||||
export { nanoid, customAlphabet, random }
|
||||
26
day1/node_modules/nanoid/async/index.native.js
generated
vendored
Normal file
26
day1/node_modules/nanoid/async/index.native.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { getRandomBytesAsync } from 'expo-random'
|
||||
import { urlAlphabet } from '../url-alphabet/index.js'
|
||||
let random = getRandomBytesAsync
|
||||
let customAlphabet = (alphabet, defaultSize = 21) => {
|
||||
let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
|
||||
let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
|
||||
let tick = (id, size = defaultSize) =>
|
||||
random(step).then(bytes => {
|
||||
let i = step
|
||||
while (i--) {
|
||||
id += alphabet[bytes[i] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
return tick(id, size)
|
||||
})
|
||||
return size => tick('', size)
|
||||
}
|
||||
let nanoid = (size = 21) =>
|
||||
random(size).then(bytes => {
|
||||
let id = ''
|
||||
while (size--) {
|
||||
id += urlAlphabet[bytes[size] & 63]
|
||||
}
|
||||
return id
|
||||
})
|
||||
export { nanoid, customAlphabet, random }
|
||||
12
day1/node_modules/nanoid/async/package.json
generated
vendored
Normal file
12
day1/node_modules/nanoid/async/package.json
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"type": "module",
|
||||
"main": "index.cjs",
|
||||
"module": "index.js",
|
||||
"react-native": {
|
||||
"./index.js": "./index.native.js"
|
||||
},
|
||||
"browser": {
|
||||
"./index.js": "./index.browser.js",
|
||||
"./index.cjs": "./index.browser.cjs"
|
||||
}
|
||||
}
|
||||
55
day1/node_modules/nanoid/bin/nanoid.cjs
generated
vendored
Executable file
55
day1/node_modules/nanoid/bin/nanoid.cjs
generated
vendored
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
let { nanoid, customAlphabet } = require('..')
|
||||
|
||||
function print(msg) {
|
||||
process.stdout.write(msg + '\n')
|
||||
}
|
||||
|
||||
function error(msg) {
|
||||
process.stderr.write(msg + '\n')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
||||
print(`
|
||||
Usage
|
||||
$ nanoid [options]
|
||||
|
||||
Options
|
||||
-s, --size Generated ID size
|
||||
-a, --alphabet Alphabet to use
|
||||
-h, --help Show this help
|
||||
|
||||
Examples
|
||||
$ nanoid --s 15
|
||||
S9sBF77U6sDB8Yg
|
||||
|
||||
$ nanoid --size 10 --alphabet abc
|
||||
bcabababca`)
|
||||
process.exit()
|
||||
}
|
||||
|
||||
let alphabet, size
|
||||
for (let i = 2; i < process.argv.length; i++) {
|
||||
let arg = process.argv[i]
|
||||
if (arg === '--size' || arg === '-s') {
|
||||
size = Number(process.argv[i + 1])
|
||||
i += 1
|
||||
if (Number.isNaN(size) || size <= 0) {
|
||||
error('Size must be positive integer')
|
||||
}
|
||||
} else if (arg === '--alphabet' || arg === '-a') {
|
||||
alphabet = process.argv[i + 1]
|
||||
i += 1
|
||||
} else {
|
||||
error('Unknown argument ' + arg)
|
||||
}
|
||||
}
|
||||
|
||||
if (alphabet) {
|
||||
let customNanoid = customAlphabet(alphabet, size)
|
||||
print(customNanoid())
|
||||
} else {
|
||||
print(nanoid(size))
|
||||
}
|
||||
34
day1/node_modules/nanoid/index.browser.cjs
generated
vendored
Normal file
34
day1/node_modules/nanoid/index.browser.cjs
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
let { urlAlphabet } = require('./url-alphabet/index.cjs')
|
||||
let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))
|
||||
let customRandom = (alphabet, defaultSize, getRandom) => {
|
||||
let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
|
||||
let step = -~((1.6 * mask * defaultSize) / alphabet.length)
|
||||
return (size = defaultSize) => {
|
||||
let id = ''
|
||||
while (true) {
|
||||
let bytes = getRandom(step)
|
||||
let j = step
|
||||
while (j--) {
|
||||
id += alphabet[bytes[j] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let customAlphabet = (alphabet, size = 21) =>
|
||||
customRandom(alphabet, size, random)
|
||||
let nanoid = (size = 21) =>
|
||||
crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
|
||||
byte &= 63
|
||||
if (byte < 36) {
|
||||
id += byte.toString(36)
|
||||
} else if (byte < 62) {
|
||||
id += (byte - 26).toString(36).toUpperCase()
|
||||
} else if (byte > 62) {
|
||||
id += '-'
|
||||
} else {
|
||||
id += '_'
|
||||
}
|
||||
return id
|
||||
}, '')
|
||||
module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random }
|
||||
34
day1/node_modules/nanoid/index.browser.js
generated
vendored
Normal file
34
day1/node_modules/nanoid/index.browser.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import { urlAlphabet } from './url-alphabet/index.js'
|
||||
let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))
|
||||
let customRandom = (alphabet, defaultSize, getRandom) => {
|
||||
let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
|
||||
let step = -~((1.6 * mask * defaultSize) / alphabet.length)
|
||||
return (size = defaultSize) => {
|
||||
let id = ''
|
||||
while (true) {
|
||||
let bytes = getRandom(step)
|
||||
let j = step
|
||||
while (j--) {
|
||||
id += alphabet[bytes[j] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let customAlphabet = (alphabet, size = 21) =>
|
||||
customRandom(alphabet, size, random)
|
||||
let nanoid = (size = 21) =>
|
||||
crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
|
||||
byte &= 63
|
||||
if (byte < 36) {
|
||||
id += byte.toString(36)
|
||||
} else if (byte < 62) {
|
||||
id += (byte - 26).toString(36).toUpperCase()
|
||||
} else if (byte > 62) {
|
||||
id += '-'
|
||||
} else {
|
||||
id += '_'
|
||||
}
|
||||
return id
|
||||
}, '')
|
||||
export { nanoid, customAlphabet, customRandom, urlAlphabet, random }
|
||||
45
day1/node_modules/nanoid/index.cjs
generated
vendored
Normal file
45
day1/node_modules/nanoid/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
let crypto = require('crypto')
|
||||
let { urlAlphabet } = require('./url-alphabet/index.cjs')
|
||||
const POOL_SIZE_MULTIPLIER = 128
|
||||
let pool, poolOffset
|
||||
let fillPool = bytes => {
|
||||
if (!pool || pool.length < bytes) {
|
||||
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER)
|
||||
crypto.randomFillSync(pool)
|
||||
poolOffset = 0
|
||||
} else if (poolOffset + bytes > pool.length) {
|
||||
crypto.randomFillSync(pool)
|
||||
poolOffset = 0
|
||||
}
|
||||
poolOffset += bytes
|
||||
}
|
||||
let random = bytes => {
|
||||
fillPool((bytes -= 0))
|
||||
return pool.subarray(poolOffset - bytes, poolOffset)
|
||||
}
|
||||
let customRandom = (alphabet, defaultSize, getRandom) => {
|
||||
let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
|
||||
let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
|
||||
return (size = defaultSize) => {
|
||||
let id = ''
|
||||
while (true) {
|
||||
let bytes = getRandom(step)
|
||||
let i = step
|
||||
while (i--) {
|
||||
id += alphabet[bytes[i] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let customAlphabet = (alphabet, size = 21) =>
|
||||
customRandom(alphabet, size, random)
|
||||
let nanoid = (size = 21) => {
|
||||
fillPool((size -= 0))
|
||||
let id = ''
|
||||
for (let i = poolOffset - size; i < poolOffset; i++) {
|
||||
id += urlAlphabet[pool[i] & 63]
|
||||
}
|
||||
return id
|
||||
}
|
||||
module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random }
|
||||
91
day1/node_modules/nanoid/index.d.ts
generated
vendored
Normal file
91
day1/node_modules/nanoid/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* Generate secure URL-friendly unique ID.
|
||||
*
|
||||
* By default, the ID will have 21 symbols to have a collision probability
|
||||
* similar to UUID v4.
|
||||
*
|
||||
* ```js
|
||||
* import { nanoid } from 'nanoid'
|
||||
* model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
|
||||
* ```
|
||||
*
|
||||
* @param size Size of the ID. The default size is 21.
|
||||
* @returns A random string.
|
||||
*/
|
||||
export function nanoid(size?: number): string
|
||||
|
||||
/**
|
||||
* Generate secure unique ID with custom alphabet.
|
||||
*
|
||||
* Alphabet must contain 256 symbols or less. Otherwise, the generator
|
||||
* will not be secure.
|
||||
*
|
||||
* @param alphabet Alphabet used to generate the ID.
|
||||
* @param defaultSize Size of the ID. The default size is 21.
|
||||
* @returns A random string generator.
|
||||
*
|
||||
* ```js
|
||||
* const { customAlphabet } = require('nanoid')
|
||||
* const nanoid = customAlphabet('0123456789абвгдеё', 5)
|
||||
* nanoid() //=> "8ё56а"
|
||||
* ```
|
||||
*/
|
||||
export function customAlphabet(
|
||||
alphabet: string,
|
||||
defaultSize?: number
|
||||
): (size?: number) => string
|
||||
|
||||
/**
|
||||
* Generate unique ID with custom random generator and alphabet.
|
||||
*
|
||||
* Alphabet must contain 256 symbols or less. Otherwise, the generator
|
||||
* will not be secure.
|
||||
*
|
||||
* ```js
|
||||
* import { customRandom } from 'nanoid/format'
|
||||
*
|
||||
* const nanoid = customRandom('abcdef', 5, size => {
|
||||
* const random = []
|
||||
* for (let i = 0; i < size; i++) {
|
||||
* random.push(randomByte())
|
||||
* }
|
||||
* return random
|
||||
* })
|
||||
*
|
||||
* nanoid() //=> "fbaef"
|
||||
* ```
|
||||
*
|
||||
* @param alphabet Alphabet used to generate a random string.
|
||||
* @param size Size of the random string.
|
||||
* @param random A random bytes generator.
|
||||
* @returns A random string generator.
|
||||
*/
|
||||
export function customRandom(
|
||||
alphabet: string,
|
||||
size: number,
|
||||
random: (bytes: number) => Uint8Array
|
||||
): () => string
|
||||
|
||||
/**
|
||||
* URL safe symbols.
|
||||
*
|
||||
* ```js
|
||||
* import { urlAlphabet } from 'nanoid'
|
||||
* const nanoid = customAlphabet(urlAlphabet, 10)
|
||||
* nanoid() //=> "Uakgb_J5m9"
|
||||
* ```
|
||||
*/
|
||||
export const urlAlphabet: string
|
||||
|
||||
/**
|
||||
* Generate an array of random bytes collected from hardware noise.
|
||||
*
|
||||
* ```js
|
||||
* import { customRandom, random } from 'nanoid'
|
||||
* const nanoid = customRandom("abcdef", 5, random)
|
||||
* ```
|
||||
*
|
||||
* @param bytes Size of the array.
|
||||
* @returns An array of random bytes.
|
||||
*/
|
||||
export function random(bytes: number): Uint8Array
|
||||
45
day1/node_modules/nanoid/index.js
generated
vendored
Normal file
45
day1/node_modules/nanoid/index.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import crypto from 'crypto'
|
||||
import { urlAlphabet } from './url-alphabet/index.js'
|
||||
const POOL_SIZE_MULTIPLIER = 128
|
||||
let pool, poolOffset
|
||||
let fillPool = bytes => {
|
||||
if (!pool || pool.length < bytes) {
|
||||
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER)
|
||||
crypto.randomFillSync(pool)
|
||||
poolOffset = 0
|
||||
} else if (poolOffset + bytes > pool.length) {
|
||||
crypto.randomFillSync(pool)
|
||||
poolOffset = 0
|
||||
}
|
||||
poolOffset += bytes
|
||||
}
|
||||
let random = bytes => {
|
||||
fillPool((bytes -= 0))
|
||||
return pool.subarray(poolOffset - bytes, poolOffset)
|
||||
}
|
||||
let customRandom = (alphabet, defaultSize, getRandom) => {
|
||||
let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
|
||||
let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
|
||||
return (size = defaultSize) => {
|
||||
let id = ''
|
||||
while (true) {
|
||||
let bytes = getRandom(step)
|
||||
let i = step
|
||||
while (i--) {
|
||||
id += alphabet[bytes[i] & mask] || ''
|
||||
if (id.length === size) return id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let customAlphabet = (alphabet, size = 21) =>
|
||||
customRandom(alphabet, size, random)
|
||||
let nanoid = (size = 21) => {
|
||||
fillPool((size -= 0))
|
||||
let id = ''
|
||||
for (let i = poolOffset - size; i < poolOffset; i++) {
|
||||
id += urlAlphabet[pool[i] & 63]
|
||||
}
|
||||
return id
|
||||
}
|
||||
export { nanoid, customAlphabet, customRandom, urlAlphabet, random }
|
||||
1
day1/node_modules/nanoid/nanoid.js
generated
vendored
Normal file
1
day1/node_modules/nanoid/nanoid.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export let nanoid=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e<63?"_":"-"),"");
|
||||
21
day1/node_modules/nanoid/non-secure/index.cjs
generated
vendored
Normal file
21
day1/node_modules/nanoid/non-secure/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
let urlAlphabet =
|
||||
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
|
||||
let customAlphabet = (alphabet, defaultSize = 21) => {
|
||||
return (size = defaultSize) => {
|
||||
let id = ''
|
||||
let i = size
|
||||
while (i--) {
|
||||
id += alphabet[(Math.random() * alphabet.length) | 0]
|
||||
}
|
||||
return id
|
||||
}
|
||||
}
|
||||
let nanoid = (size = 21) => {
|
||||
let id = ''
|
||||
let i = size
|
||||
while (i--) {
|
||||
id += urlAlphabet[(Math.random() * 64) | 0]
|
||||
}
|
||||
return id
|
||||
}
|
||||
module.exports = { nanoid, customAlphabet }
|
||||
33
day1/node_modules/nanoid/non-secure/index.d.ts
generated
vendored
Normal file
33
day1/node_modules/nanoid/non-secure/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Generate URL-friendly unique ID. This method uses the non-secure
|
||||
* predictable random generator with bigger collision probability.
|
||||
*
|
||||
* ```js
|
||||
* import { nanoid } from 'nanoid/non-secure'
|
||||
* model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
|
||||
* ```
|
||||
*
|
||||
* @param size Size of the ID. The default size is 21.
|
||||
* @returns A random string.
|
||||
*/
|
||||
export function nanoid(size?: number): string
|
||||
|
||||
/**
|
||||
* Generate a unique ID based on a custom alphabet.
|
||||
* This method uses the non-secure predictable random generator
|
||||
* with bigger collision probability.
|
||||
*
|
||||
* @param alphabet Alphabet used to generate the ID.
|
||||
* @param defaultSize Size of the ID. The default size is 21.
|
||||
* @returns A random string generator.
|
||||
*
|
||||
* ```js
|
||||
* import { customAlphabet } from 'nanoid/non-secure'
|
||||
* const nanoid = customAlphabet('0123456789абвгдеё', 5)
|
||||
* model.id = //=> "8ё56а"
|
||||
* ```
|
||||
*/
|
||||
export function customAlphabet(
|
||||
alphabet: string,
|
||||
defaultSize?: number
|
||||
): (size?: number) => string
|
||||
21
day1/node_modules/nanoid/non-secure/index.js
generated
vendored
Normal file
21
day1/node_modules/nanoid/non-secure/index.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
let urlAlphabet =
|
||||
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
|
||||
let customAlphabet = (alphabet, defaultSize = 21) => {
|
||||
return (size = defaultSize) => {
|
||||
let id = ''
|
||||
let i = size
|
||||
while (i--) {
|
||||
id += alphabet[(Math.random() * alphabet.length) | 0]
|
||||
}
|
||||
return id
|
||||
}
|
||||
}
|
||||
let nanoid = (size = 21) => {
|
||||
let id = ''
|
||||
let i = size
|
||||
while (i--) {
|
||||
id += urlAlphabet[(Math.random() * 64) | 0]
|
||||
}
|
||||
return id
|
||||
}
|
||||
export { nanoid, customAlphabet }
|
||||
6
day1/node_modules/nanoid/non-secure/package.json
generated
vendored
Normal file
6
day1/node_modules/nanoid/non-secure/package.json
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "module",
|
||||
"main": "index.cjs",
|
||||
"module": "index.js",
|
||||
"react-native": "index.js"
|
||||
}
|
||||
60
day1/node_modules/nanoid/package.json
generated
vendored
Normal file
60
day1/node_modules/nanoid/package.json
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "nanoid",
|
||||
"version": "3.3.4",
|
||||
"description": "A tiny (116 bytes), secure URL-friendly unique string ID generator",
|
||||
"keywords": [
|
||||
"uuid",
|
||||
"random",
|
||||
"id",
|
||||
"url"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||
},
|
||||
"author": "Andrey Sitnik <andrey@sitnik.ru>",
|
||||
"license": "MIT",
|
||||
"repository": "ai/nanoid",
|
||||
"browser": {
|
||||
"./index.js": "./index.browser.js",
|
||||
"./async/index.js": "./async/index.browser.js",
|
||||
"./async/index.cjs": "./async/index.browser.cjs",
|
||||
"./index.cjs": "./index.browser.cjs"
|
||||
},
|
||||
"react-native": "index.js",
|
||||
"bin": "./bin/nanoid.cjs",
|
||||
"sideEffects": false,
|
||||
"types": "./index.d.ts",
|
||||
"type": "module",
|
||||
"main": "index.cjs",
|
||||
"module": "index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"browser": "./index.browser.js",
|
||||
"require": "./index.cjs",
|
||||
"import": "./index.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./index.d.ts": "./index.d.ts",
|
||||
"./package.json": "./package.json",
|
||||
"./async/package.json": "./async/package.json",
|
||||
"./async": {
|
||||
"browser": "./async/index.browser.js",
|
||||
"require": "./async/index.cjs",
|
||||
"import": "./async/index.js",
|
||||
"default": "./async/index.js"
|
||||
},
|
||||
"./non-secure/package.json": "./non-secure/package.json",
|
||||
"./non-secure": {
|
||||
"require": "./non-secure/index.cjs",
|
||||
"import": "./non-secure/index.js",
|
||||
"default": "./non-secure/index.js"
|
||||
},
|
||||
"./url-alphabet/package.json": "./url-alphabet/package.json",
|
||||
"./url-alphabet": {
|
||||
"require": "./url-alphabet/index.cjs",
|
||||
"import": "./url-alphabet/index.js",
|
||||
"default": "./url-alphabet/index.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
3
day1/node_modules/nanoid/url-alphabet/index.cjs
generated
vendored
Normal file
3
day1/node_modules/nanoid/url-alphabet/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
let urlAlphabet =
|
||||
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
|
||||
module.exports = { urlAlphabet }
|
||||
3
day1/node_modules/nanoid/url-alphabet/index.js
generated
vendored
Normal file
3
day1/node_modules/nanoid/url-alphabet/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
let urlAlphabet =
|
||||
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
|
||||
export { urlAlphabet }
|
||||
6
day1/node_modules/nanoid/url-alphabet/package.json
generated
vendored
Normal file
6
day1/node_modules/nanoid/url-alphabet/package.json
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "module",
|
||||
"main": "index.cjs",
|
||||
"module": "index.js",
|
||||
"react-native": "index.js"
|
||||
}
|
||||
21
day1/node_modules/path-parse/LICENSE
generated
vendored
Normal file
21
day1/node_modules/path-parse/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Javier Blanco
|
||||
|
||||
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.
|
||||
42
day1/node_modules/path-parse/README.md
generated
vendored
Normal file
42
day1/node_modules/path-parse/README.md
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# path-parse [](https://travis-ci.org/jbgutierrez/path-parse)
|
||||
|
||||
> Node.js [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) [ponyfill](https://ponyfill.com).
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save path-parse
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var pathParse = require('path-parse');
|
||||
|
||||
pathParse('/home/user/dir/file.txt');
|
||||
//=> {
|
||||
// root : "/",
|
||||
// dir : "/home/user/dir",
|
||||
// base : "file.txt",
|
||||
// ext : ".txt",
|
||||
// name : "file"
|
||||
// }
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
See [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) docs.
|
||||
|
||||
### pathParse(path)
|
||||
|
||||
### pathParse.posix(path)
|
||||
|
||||
The Posix specific version.
|
||||
|
||||
### pathParse.win32(path)
|
||||
|
||||
The Windows specific version.
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Javier Blanco](http://jbgutierrez.info)
|
||||
75
day1/node_modules/path-parse/index.js
generated
vendored
Normal file
75
day1/node_modules/path-parse/index.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
'use strict';
|
||||
|
||||
var isWindows = process.platform === 'win32';
|
||||
|
||||
// Regex to split a windows path into into [dir, root, basename, name, ext]
|
||||
var splitWindowsRe =
|
||||
/^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
|
||||
|
||||
var win32 = {};
|
||||
|
||||
function win32SplitPath(filename) {
|
||||
return splitWindowsRe.exec(filename).slice(1);
|
||||
}
|
||||
|
||||
win32.parse = function(pathString) {
|
||||
if (typeof pathString !== 'string') {
|
||||
throw new TypeError(
|
||||
"Parameter 'pathString' must be a string, not " + typeof pathString
|
||||
);
|
||||
}
|
||||
var allParts = win32SplitPath(pathString);
|
||||
if (!allParts || allParts.length !== 5) {
|
||||
throw new TypeError("Invalid path '" + pathString + "'");
|
||||
}
|
||||
return {
|
||||
root: allParts[1],
|
||||
dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1),
|
||||
base: allParts[2],
|
||||
ext: allParts[4],
|
||||
name: allParts[3]
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Split a filename into [dir, root, basename, name, ext], unix version
|
||||
// 'root' is just a slash, or nothing.
|
||||
var splitPathRe =
|
||||
/^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/;
|
||||
var posix = {};
|
||||
|
||||
|
||||
function posixSplitPath(filename) {
|
||||
return splitPathRe.exec(filename).slice(1);
|
||||
}
|
||||
|
||||
|
||||
posix.parse = function(pathString) {
|
||||
if (typeof pathString !== 'string') {
|
||||
throw new TypeError(
|
||||
"Parameter 'pathString' must be a string, not " + typeof pathString
|
||||
);
|
||||
}
|
||||
var allParts = posixSplitPath(pathString);
|
||||
if (!allParts || allParts.length !== 5) {
|
||||
throw new TypeError("Invalid path '" + pathString + "'");
|
||||
}
|
||||
|
||||
return {
|
||||
root: allParts[1],
|
||||
dir: allParts[0].slice(0, -1),
|
||||
base: allParts[2],
|
||||
ext: allParts[4],
|
||||
name: allParts[3],
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
if (isWindows)
|
||||
module.exports = win32.parse;
|
||||
else /* posix */
|
||||
module.exports = posix.parse;
|
||||
|
||||
module.exports.posix = posix.parse;
|
||||
module.exports.win32 = win32.parse;
|
||||
33
day1/node_modules/path-parse/package.json
generated
vendored
Normal file
33
day1/node_modules/path-parse/package.json
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "path-parse",
|
||||
"version": "1.0.7",
|
||||
"description": "Node.js path.parse() ponyfill",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jbgutierrez/path-parse.git"
|
||||
},
|
||||
"keywords": [
|
||||
"path",
|
||||
"paths",
|
||||
"file",
|
||||
"dir",
|
||||
"parse",
|
||||
"built-in",
|
||||
"util",
|
||||
"utils",
|
||||
"core",
|
||||
"ponyfill",
|
||||
"polyfill",
|
||||
"shim"
|
||||
],
|
||||
"author": "Javier Blanco <http://jbgutierrez.info>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jbgutierrez/path-parse/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jbgutierrez/path-parse#readme"
|
||||
}
|
||||
15
day1/node_modules/picocolors/LICENSE
generated
vendored
Normal file
15
day1/node_modules/picocolors/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
21
day1/node_modules/picocolors/README.md
generated
vendored
Normal file
21
day1/node_modules/picocolors/README.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# picocolors
|
||||
|
||||
The tiniest and the fastest library for terminal output formatting with ANSI colors.
|
||||
|
||||
```javascript
|
||||
import pc from "picocolors"
|
||||
|
||||
console.log(
|
||||
pc.green(`How are ${pc.italic(`you`)} doing?`)
|
||||
)
|
||||
```
|
||||
|
||||
- **No dependencies.**
|
||||
- **14 times** smaller and **2 times** faster than chalk.
|
||||
- Used by popular tools like PostCSS, SVGO, Stylelint, and Browserslist.
|
||||
- Node.js v6+ & browsers support. Support for both CJS and ESM projects.
|
||||
- TypeScript type declarations included.
|
||||
- [`NO_COLOR`](https://no-color.org/) friendly.
|
||||
|
||||
## Docs
|
||||
Read **[full docs](https://github.com/alexeyraspopov/picocolors#readme)** on GitHub.
|
||||
25
day1/node_modules/picocolors/package.json
generated
vendored
Normal file
25
day1/node_modules/picocolors/package.json
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "picocolors",
|
||||
"version": "1.0.0",
|
||||
"main": "./picocolors.js",
|
||||
"types": "./picocolors.d.ts",
|
||||
"browser": {
|
||||
"./picocolors.js": "./picocolors.browser.js"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"description": "The tiniest and the fastest library for terminal output formatting with ANSI colors",
|
||||
"files": [
|
||||
"picocolors.*",
|
||||
"types.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"terminal",
|
||||
"colors",
|
||||
"formatting",
|
||||
"cli",
|
||||
"console"
|
||||
],
|
||||
"author": "Alexey Raspopov",
|
||||
"repository": "alexeyraspopov/picocolors",
|
||||
"license": "ISC"
|
||||
}
|
||||
4
day1/node_modules/picocolors/picocolors.browser.js
generated
vendored
Normal file
4
day1/node_modules/picocolors/picocolors.browser.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
var x=String;
|
||||
var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x}};
|
||||
module.exports=create();
|
||||
module.exports.createColors = create;
|
||||
5
day1/node_modules/picocolors/picocolors.d.ts
generated
vendored
Normal file
5
day1/node_modules/picocolors/picocolors.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Colors } from "./types"
|
||||
|
||||
declare const picocolors: Colors & { createColors: (enabled?: boolean) => Colors }
|
||||
|
||||
export = picocolors
|
||||
58
day1/node_modules/picocolors/picocolors.js
generated
vendored
Normal file
58
day1/node_modules/picocolors/picocolors.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
let tty = require("tty")
|
||||
|
||||
let isColorSupported =
|
||||
!("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
|
||||
("FORCE_COLOR" in process.env ||
|
||||
process.argv.includes("--color") ||
|
||||
process.platform === "win32" ||
|
||||
(tty.isatty(1) && process.env.TERM !== "dumb") ||
|
||||
"CI" in process.env)
|
||||
|
||||
let formatter =
|
||||
(open, close, replace = open) =>
|
||||
input => {
|
||||
let string = "" + input
|
||||
let index = string.indexOf(close, open.length)
|
||||
return ~index
|
||||
? open + replaceClose(string, close, replace, index) + close
|
||||
: open + string + close
|
||||
}
|
||||
|
||||
let replaceClose = (string, close, replace, index) => {
|
||||
let start = string.substring(0, index) + replace
|
||||
let end = string.substring(index + close.length)
|
||||
let nextIndex = end.indexOf(close)
|
||||
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
|
||||
}
|
||||
|
||||
let createColors = (enabled = isColorSupported) => ({
|
||||
isColorSupported: enabled,
|
||||
reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
|
||||
bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
|
||||
dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
|
||||
italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
|
||||
underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
|
||||
inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
|
||||
hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
|
||||
strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
|
||||
black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
|
||||
red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
|
||||
green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
|
||||
yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
|
||||
blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
|
||||
magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
|
||||
cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
|
||||
white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
|
||||
gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
|
||||
bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
|
||||
bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
|
||||
bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
|
||||
bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
|
||||
bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
|
||||
bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
|
||||
bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
|
||||
bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
|
||||
})
|
||||
|
||||
module.exports = createColors()
|
||||
module.exports.createColors = createColors
|
||||
30
day1/node_modules/picocolors/types.ts
generated
vendored
Normal file
30
day1/node_modules/picocolors/types.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
export type Formatter = (input: string | number | null | undefined) => string
|
||||
|
||||
export interface Colors {
|
||||
isColorSupported: boolean
|
||||
reset: Formatter
|
||||
bold: Formatter
|
||||
dim: Formatter
|
||||
italic: Formatter
|
||||
underline: Formatter
|
||||
inverse: Formatter
|
||||
hidden: Formatter
|
||||
strikethrough: Formatter
|
||||
black: Formatter
|
||||
red: Formatter
|
||||
green: Formatter
|
||||
yellow: Formatter
|
||||
blue: Formatter
|
||||
magenta: Formatter
|
||||
cyan: Formatter
|
||||
white: Formatter
|
||||
gray: Formatter
|
||||
bgBlack: Formatter
|
||||
bgRed: Formatter
|
||||
bgGreen: Formatter
|
||||
bgYellow: Formatter
|
||||
bgBlue: Formatter
|
||||
bgMagenta: Formatter
|
||||
bgCyan: Formatter
|
||||
bgWhite: Formatter
|
||||
}
|
||||
20
day1/node_modules/postcss/LICENSE
generated
vendored
Normal file
20
day1/node_modules/postcss/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2013 Andrey Sitnik <andrey@sitnik.ru>
|
||||
|
||||
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.
|
||||
44
day1/node_modules/postcss/README.md
generated
vendored
Normal file
44
day1/node_modules/postcss/README.md
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# PostCSS [![Gitter][chat-img]][chat]
|
||||
|
||||
<img align="right" width="95" height="95"
|
||||
alt="Philosopher’s stone, logo of PostCSS"
|
||||
src="https://postcss.org/logo.svg">
|
||||
|
||||
[chat-img]: https://img.shields.io/badge/Gitter-Join_the_PostCSS_chat-brightgreen.svg
|
||||
[chat]: https://gitter.im/postcss/postcss
|
||||
|
||||
PostCSS is a tool for transforming styles with JS plugins.
|
||||
These plugins can lint your CSS, support variables and mixins,
|
||||
transpile future CSS syntax, inline images, and more.
|
||||
|
||||
PostCSS is used by industry leaders including Wikipedia, Twitter, Alibaba,
|
||||
and JetBrains. The [Autoprefixer] PostCSS plugin is one of the most popular
|
||||
CSS processors.
|
||||
|
||||
PostCSS takes a CSS file and provides an API to analyze and modify its rules
|
||||
(by transforming them into an [Abstract Syntax Tree]).
|
||||
This API can then be used by [plugins] to do a lot of useful things,
|
||||
e.g., to find errors automatically, or to insert vendor prefixes.
|
||||
|
||||
**Support / Discussion:** [Gitter](https://gitter.im/postcss/postcss)<br>
|
||||
**Twitter account:** [@postcss](https://twitter.com/postcss)<br>
|
||||
**VK.com page:** [postcss](https://vk.com/postcss)<br>
|
||||
**中文翻译**: [`docs/README-cn.md`](./docs/README-cn.md)
|
||||
|
||||
For PostCSS commercial support (consulting, improving the front-end culture
|
||||
of your company, PostCSS plugins), contact [Evil Martians]
|
||||
at <postcss@evilmartians.com>.
|
||||
|
||||
[Abstract Syntax Tree]: https://en.wikipedia.org/wiki/Abstract_syntax_tree
|
||||
[Evil Martians]: https://evilmartians.com/?utm_source=postcss
|
||||
[Autoprefixer]: https://github.com/postcss/autoprefixer
|
||||
[plugins]: https://github.com/postcss/postcss#plugins
|
||||
|
||||
<a href="https://evilmartians.com/?utm_source=postcss">
|
||||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
|
||||
alt="Sponsored by Evil Martians" width="236" height="54">
|
||||
</a>
|
||||
|
||||
|
||||
## Docs
|
||||
Read **[full docs](https://github.com/postcss/postcss#readme)** on GitHub.
|
||||
106
day1/node_modules/postcss/lib/at-rule.d.ts
generated
vendored
Normal file
106
day1/node_modules/postcss/lib/at-rule.d.ts
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
import Container, { ContainerProps } from './container.js'
|
||||
|
||||
interface AtRuleRaws extends Record<string, unknown> {
|
||||
/**
|
||||
* The space symbols before the node. It also stores `*`
|
||||
* and `_` symbols before the declaration (IE hack).
|
||||
*/
|
||||
before?: string
|
||||
|
||||
/**
|
||||
* The space symbols after the last child of the node to the end of the node.
|
||||
*/
|
||||
after?: string
|
||||
|
||||
/**
|
||||
* The space between the at-rule name and its parameters.
|
||||
*/
|
||||
afterName?: string
|
||||
|
||||
/**
|
||||
* The symbols between the last parameter and `{` for rules.
|
||||
*/
|
||||
between?: string
|
||||
|
||||
/**
|
||||
* Contains `true` if the last child has an (optional) semicolon.
|
||||
*/
|
||||
semicolon?: boolean
|
||||
|
||||
/**
|
||||
* The rule’s selector with comments.
|
||||
*/
|
||||
params?: {
|
||||
value: string
|
||||
raw: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface AtRuleProps extends ContainerProps {
|
||||
/** Name of the at-rule. */
|
||||
name: string
|
||||
/** Parameters following the name of the at-rule. */
|
||||
params?: string | number
|
||||
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
|
||||
raws?: AtRuleRaws
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an at-rule.
|
||||
*
|
||||
* ```js
|
||||
* Once (root, { AtRule }) {
|
||||
* let media = new AtRule({ name: 'media', params: 'print' })
|
||||
* media.append(…)
|
||||
* root.append(media)
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* If it’s followed in the CSS by a {} block, this node will have
|
||||
* a nodes property representing its children.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('@charset "UTF-8"; @media print {}')
|
||||
*
|
||||
* const charset = root.first
|
||||
* charset.type //=> 'atrule'
|
||||
* charset.nodes //=> undefined
|
||||
*
|
||||
* const media = root.last
|
||||
* media.nodes //=> []
|
||||
* ```
|
||||
*/
|
||||
export default class AtRule extends Container {
|
||||
type: 'atrule'
|
||||
parent: Container | undefined
|
||||
raws: AtRuleRaws
|
||||
|
||||
/**
|
||||
* The at-rule’s name immediately follows the `@`.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('@media print {}')
|
||||
* media.name //=> 'media'
|
||||
* const media = root.first
|
||||
* ```
|
||||
*/
|
||||
name: string
|
||||
|
||||
/**
|
||||
* The at-rule’s parameters, the values that follow the at-rule’s name
|
||||
* but precede any {} block.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('@media print, screen {}')
|
||||
* const media = root.first
|
||||
* media.params //=> 'print, screen'
|
||||
* ```
|
||||
*/
|
||||
params: string
|
||||
|
||||
constructor(defaults?: AtRuleProps)
|
||||
assign(overrides: object | AtRuleProps): this
|
||||
clone(overrides?: Partial<AtRuleProps>): this
|
||||
cloneBefore(overrides?: Partial<AtRuleProps>): this
|
||||
cloneAfter(overrides?: Partial<AtRuleProps>): this
|
||||
}
|
||||
25
day1/node_modules/postcss/lib/at-rule.js
generated
vendored
Normal file
25
day1/node_modules/postcss/lib/at-rule.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict'
|
||||
|
||||
let Container = require('./container')
|
||||
|
||||
class AtRule extends Container {
|
||||
constructor(defaults) {
|
||||
super(defaults)
|
||||
this.type = 'atrule'
|
||||
}
|
||||
|
||||
append(...children) {
|
||||
if (!this.proxyOf.nodes) this.nodes = []
|
||||
return super.append(...children)
|
||||
}
|
||||
|
||||
prepend(...children) {
|
||||
if (!this.proxyOf.nodes) this.nodes = []
|
||||
return super.prepend(...children)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AtRule
|
||||
AtRule.default = AtRule
|
||||
|
||||
Container.registerAtRule(AtRule)
|
||||
56
day1/node_modules/postcss/lib/comment.d.ts
generated
vendored
Normal file
56
day1/node_modules/postcss/lib/comment.d.ts
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
import Container from './container.js'
|
||||
import Node, { NodeProps } from './node.js'
|
||||
|
||||
interface CommentRaws extends Record<string, unknown> {
|
||||
/**
|
||||
* The space symbols before the node.
|
||||
*/
|
||||
before?: string
|
||||
|
||||
/**
|
||||
* The space symbols between `/*` and the comment’s text.
|
||||
*/
|
||||
left?: string
|
||||
|
||||
/**
|
||||
* The space symbols between the comment’s text.
|
||||
*/
|
||||
right?: string
|
||||
}
|
||||
|
||||
export interface CommentProps extends NodeProps {
|
||||
/** Content of the comment. */
|
||||
text: string
|
||||
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
|
||||
raws?: CommentRaws
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a comment between declarations or statements (rule and at-rules).
|
||||
*
|
||||
* ```js
|
||||
* Once (root, { Comment }) {
|
||||
* let note = new Comment({ text: 'Note: …' })
|
||||
* root.append(note)
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Comments inside selectors, at-rule parameters, or declaration values
|
||||
* will be stored in the `raws` properties explained above.
|
||||
*/
|
||||
export default class Comment extends Node {
|
||||
type: 'comment'
|
||||
parent: Container | undefined
|
||||
raws: CommentRaws
|
||||
|
||||
/**
|
||||
* The comment's text.
|
||||
*/
|
||||
text: string
|
||||
|
||||
constructor(defaults?: CommentProps)
|
||||
assign(overrides: object | CommentProps): this
|
||||
clone(overrides?: Partial<CommentProps>): this
|
||||
cloneBefore(overrides?: Partial<CommentProps>): this
|
||||
cloneAfter(overrides?: Partial<CommentProps>): this
|
||||
}
|
||||
13
day1/node_modules/postcss/lib/comment.js
generated
vendored
Normal file
13
day1/node_modules/postcss/lib/comment.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict'
|
||||
|
||||
let Node = require('./node')
|
||||
|
||||
class Comment extends Node {
|
||||
constructor(defaults) {
|
||||
super(defaults)
|
||||
this.type = 'comment'
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Comment
|
||||
Comment.default = Comment
|
||||
442
day1/node_modules/postcss/lib/container.d.ts
generated
vendored
Normal file
442
day1/node_modules/postcss/lib/container.d.ts
generated
vendored
Normal file
@@ -0,0 +1,442 @@
|
||||
import Node, { ChildNode, NodeProps, ChildProps } from './node.js'
|
||||
import Declaration from './declaration.js'
|
||||
import Comment from './comment.js'
|
||||
import AtRule from './at-rule.js'
|
||||
import Rule from './rule.js'
|
||||
|
||||
interface ValueOptions {
|
||||
/**
|
||||
* An array of property names.
|
||||
*/
|
||||
props?: string[]
|
||||
|
||||
/**
|
||||
* String that’s used to narrow down values and speed up the regexp search.
|
||||
*/
|
||||
fast?: string
|
||||
}
|
||||
|
||||
export interface ContainerProps extends NodeProps {
|
||||
nodes?: (ChildNode | ChildProps)[]
|
||||
}
|
||||
|
||||
/**
|
||||
* The `Root`, `AtRule`, and `Rule` container nodes
|
||||
* inherit some common methods to help work with their children.
|
||||
*
|
||||
* Note that all containers can store any content. If you write a rule inside
|
||||
* a rule, PostCSS will parse it.
|
||||
*/
|
||||
export default abstract class Container<
|
||||
Child extends Node = ChildNode
|
||||
> extends Node {
|
||||
/**
|
||||
* An array containing the container’s children.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('a { color: black }')
|
||||
* root.nodes.length //=> 1
|
||||
* root.nodes[0].selector //=> 'a'
|
||||
* root.nodes[0].nodes[0].prop //=> 'color'
|
||||
* ```
|
||||
*/
|
||||
nodes: Child[]
|
||||
|
||||
/**
|
||||
* The container’s first child.
|
||||
*
|
||||
* ```js
|
||||
* rule.first === rules.nodes[0]
|
||||
* ```
|
||||
*/
|
||||
get first(): Child | undefined
|
||||
|
||||
/**
|
||||
* The container’s last child.
|
||||
*
|
||||
* ```js
|
||||
* rule.last === rule.nodes[rule.nodes.length - 1]
|
||||
* ```
|
||||
*/
|
||||
get last(): Child | undefined
|
||||
|
||||
/**
|
||||
* Iterates through the container’s immediate children,
|
||||
* calling `callback` for each child.
|
||||
*
|
||||
* Returning `false` in the callback will break iteration.
|
||||
*
|
||||
* This method only iterates through the container’s immediate children.
|
||||
* If you need to recursively iterate through all the container’s descendant
|
||||
* nodes, use `Container#walk`.
|
||||
*
|
||||
* Unlike the for `{}`-cycle or `Array#forEach` this iterator is safe
|
||||
* if you are mutating the array of child nodes during iteration.
|
||||
* PostCSS will adjust the current index to match the mutations.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('a { color: black; z-index: 1 }')
|
||||
* const rule = root.first
|
||||
*
|
||||
* for (const decl of rule.nodes) {
|
||||
* decl.cloneBefore({ prop: '-webkit-' + decl.prop })
|
||||
* // Cycle will be infinite, because cloneBefore moves the current node
|
||||
* // to the next index
|
||||
* }
|
||||
*
|
||||
* rule.each(decl => {
|
||||
* decl.cloneBefore({ prop: '-webkit-' + decl.prop })
|
||||
* // Will be executed only for color and z-index
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param callback Iterator receives each node and index.
|
||||
* @return Returns `false` if iteration was broke.
|
||||
*/
|
||||
each(
|
||||
callback: (node: Child, index: number) => false | void
|
||||
): false | undefined
|
||||
|
||||
/**
|
||||
* Traverses the container’s descendant nodes, calling callback
|
||||
* for each node.
|
||||
*
|
||||
* Like container.each(), this method is safe to use
|
||||
* if you are mutating arrays during iteration.
|
||||
*
|
||||
* If you only need to iterate through the container’s immediate children,
|
||||
* use `Container#each`.
|
||||
*
|
||||
* ```js
|
||||
* root.walk(node => {
|
||||
* // Traverses all descendant nodes.
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param callback Iterator receives each node and index.
|
||||
* @return Returns `false` if iteration was broke.
|
||||
*/
|
||||
walk(
|
||||
callback: (node: ChildNode, index: number) => false | void
|
||||
): false | undefined
|
||||
|
||||
/**
|
||||
* Traverses the container’s descendant nodes, calling callback
|
||||
* for each declaration node.
|
||||
*
|
||||
* If you pass a filter, iteration will only happen over declarations
|
||||
* with matching properties.
|
||||
*
|
||||
* ```js
|
||||
* root.walkDecls(decl => {
|
||||
* checkPropertySupport(decl.prop)
|
||||
* })
|
||||
*
|
||||
* root.walkDecls('border-radius', decl => {
|
||||
* decl.remove()
|
||||
* })
|
||||
*
|
||||
* root.walkDecls(/^background/, decl => {
|
||||
* decl.value = takeFirstColorFromGradient(decl.value)
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* Like `Container#each`, this method is safe
|
||||
* to use if you are mutating arrays during iteration.
|
||||
*
|
||||
* @param prop String or regular expression to filter declarations
|
||||
* by property name.
|
||||
* @param callback Iterator receives each node and index.
|
||||
* @return Returns `false` if iteration was broke.
|
||||
*/
|
||||
walkDecls(
|
||||
propFilter: string | RegExp,
|
||||
callback: (decl: Declaration, index: number) => false | void
|
||||
): false | undefined
|
||||
walkDecls(
|
||||
callback: (decl: Declaration, index: number) => false | void
|
||||
): false | undefined
|
||||
|
||||
/**
|
||||
* Traverses the container’s descendant nodes, calling callback
|
||||
* for each rule node.
|
||||
*
|
||||
* If you pass a filter, iteration will only happen over rules
|
||||
* with matching selectors.
|
||||
*
|
||||
* Like `Container#each`, this method is safe
|
||||
* to use if you are mutating arrays during iteration.
|
||||
*
|
||||
* ```js
|
||||
* const selectors = []
|
||||
* root.walkRules(rule => {
|
||||
* selectors.push(rule.selector)
|
||||
* })
|
||||
* console.log(`Your CSS uses ${ selectors.length } selectors`)
|
||||
* ```
|
||||
*
|
||||
* @param selector String or regular expression to filter rules by selector.
|
||||
* @param callback Iterator receives each node and index.
|
||||
* @return Returns `false` if iteration was broke.
|
||||
*/
|
||||
walkRules(
|
||||
selectorFilter: string | RegExp,
|
||||
callback: (rule: Rule, index: number) => false | void
|
||||
): false | undefined
|
||||
walkRules(
|
||||
callback: (rule: Rule, index: number) => false | void
|
||||
): false | undefined
|
||||
|
||||
/**
|
||||
* Traverses the container’s descendant nodes, calling callback
|
||||
* for each at-rule node.
|
||||
*
|
||||
* If you pass a filter, iteration will only happen over at-rules
|
||||
* that have matching names.
|
||||
*
|
||||
* Like `Container#each`, this method is safe
|
||||
* to use if you are mutating arrays during iteration.
|
||||
*
|
||||
* ```js
|
||||
* root.walkAtRules(rule => {
|
||||
* if (isOld(rule.name)) rule.remove()
|
||||
* })
|
||||
*
|
||||
* let first = false
|
||||
* root.walkAtRules('charset', rule => {
|
||||
* if (!first) {
|
||||
* first = true
|
||||
* } else {
|
||||
* rule.remove()
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param name String or regular expression to filter at-rules by name.
|
||||
* @param callback Iterator receives each node and index.
|
||||
* @return Returns `false` if iteration was broke.
|
||||
*/
|
||||
walkAtRules(
|
||||
nameFilter: string | RegExp,
|
||||
callback: (atRule: AtRule, index: number) => false | void
|
||||
): false | undefined
|
||||
walkAtRules(
|
||||
callback: (atRule: AtRule, index: number) => false | void
|
||||
): false | undefined
|
||||
|
||||
/**
|
||||
* Traverses the container’s descendant nodes, calling callback
|
||||
* for each comment node.
|
||||
*
|
||||
* Like `Container#each`, this method is safe
|
||||
* to use if you are mutating arrays during iteration.
|
||||
*
|
||||
* ```js
|
||||
* root.walkComments(comment => {
|
||||
* comment.remove()
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param callback Iterator receives each node and index.
|
||||
* @return Returns `false` if iteration was broke.
|
||||
*/
|
||||
|
||||
walkComments(
|
||||
callback: (comment: Comment, indexed: number) => false | void
|
||||
): false | undefined
|
||||
walkComments(
|
||||
callback: (comment: Comment, indexed: number) => false | void
|
||||
): false | undefined
|
||||
|
||||
/**
|
||||
* Inserts new nodes to the end of the container.
|
||||
*
|
||||
* ```js
|
||||
* const decl1 = new Declaration({ prop: 'color', value: 'black' })
|
||||
* const decl2 = new Declaration({ prop: 'background-color', value: 'white' })
|
||||
* rule.append(decl1, decl2)
|
||||
*
|
||||
* root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule
|
||||
* root.append({ selector: 'a' }) // rule
|
||||
* rule.append({ prop: 'color', value: 'black' }) // declaration
|
||||
* rule.append({ text: 'Comment' }) // comment
|
||||
*
|
||||
* root.append('a {}')
|
||||
* root.first.append('color: black; z-index: 1')
|
||||
* ```
|
||||
*
|
||||
* @param nodes New nodes.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
append(
|
||||
...nodes: (Node | Node[] | ChildProps | ChildProps[] | string | string[])[]
|
||||
): this
|
||||
|
||||
/**
|
||||
* Inserts new nodes to the start of the container.
|
||||
*
|
||||
* ```js
|
||||
* const decl1 = new Declaration({ prop: 'color', value: 'black' })
|
||||
* const decl2 = new Declaration({ prop: 'background-color', value: 'white' })
|
||||
* rule.prepend(decl1, decl2)
|
||||
*
|
||||
* root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule
|
||||
* root.append({ selector: 'a' }) // rule
|
||||
* rule.append({ prop: 'color', value: 'black' }) // declaration
|
||||
* rule.append({ text: 'Comment' }) // comment
|
||||
*
|
||||
* root.append('a {}')
|
||||
* root.first.append('color: black; z-index: 1')
|
||||
* ```
|
||||
*
|
||||
* @param nodes New nodes.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
prepend(
|
||||
...nodes: (Node | Node[] | ChildProps | ChildProps[] | string | string[])[]
|
||||
): this
|
||||
|
||||
/**
|
||||
* Add child to the end of the node.
|
||||
*
|
||||
* ```js
|
||||
* rule.push(new Declaration({ prop: 'color', value: 'black' }))
|
||||
* ```
|
||||
*
|
||||
* @param child New node.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
push(child: Child): this
|
||||
|
||||
/**
|
||||
* Insert new node before old node within the container.
|
||||
*
|
||||
* ```js
|
||||
* rule.insertBefore(decl, decl.clone({ prop: '-webkit-' + decl.prop }))
|
||||
* ```
|
||||
*
|
||||
* @param oldNode Child or child’s index.
|
||||
* @param newNode New node.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
insertBefore(
|
||||
oldNode: Child | number,
|
||||
newNode: Child | ChildProps | string | Child[] | ChildProps[] | string[]
|
||||
): this
|
||||
|
||||
/**
|
||||
* Insert new node after old node within the container.
|
||||
*
|
||||
* @param oldNode Child or child’s index.
|
||||
* @param newNode New node.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
insertAfter(
|
||||
oldNode: Child | number,
|
||||
newNode: Child | ChildProps | string | Child[] | ChildProps[] | string[]
|
||||
): this
|
||||
|
||||
/**
|
||||
* Removes node from the container and cleans the parent properties
|
||||
* from the node and its children.
|
||||
*
|
||||
* ```js
|
||||
* rule.nodes.length //=> 5
|
||||
* rule.removeChild(decl)
|
||||
* rule.nodes.length //=> 4
|
||||
* decl.parent //=> undefined
|
||||
* ```
|
||||
*
|
||||
* @param child Child or child’s index.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
removeChild(child: Child | number): this
|
||||
|
||||
/**
|
||||
* Removes all children from the container
|
||||
* and cleans their parent properties.
|
||||
*
|
||||
* ```js
|
||||
* rule.removeAll()
|
||||
* rule.nodes.length //=> 0
|
||||
* ```
|
||||
*
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
removeAll(): this
|
||||
|
||||
/**
|
||||
* Passes all declaration values within the container that match pattern
|
||||
* through callback, replacing those values with the returned result
|
||||
* of callback.
|
||||
*
|
||||
* This method is useful if you are using a custom unit or function
|
||||
* and need to iterate through all values.
|
||||
*
|
||||
* ```js
|
||||
* root.replaceValues(/\d+rem/, { fast: 'rem' }, string => {
|
||||
* return 15 * parseInt(string) + 'px'
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param pattern Replace pattern.
|
||||
* @param {object} opts Options to speed up the search.
|
||||
* @param callback String to replace pattern or callback
|
||||
* that returns a new value. The callback
|
||||
* will receive the same arguments
|
||||
* as those passed to a function parameter
|
||||
* of `String#replace`.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
replaceValues(
|
||||
pattern: string | RegExp,
|
||||
options: ValueOptions,
|
||||
replaced: string | { (substring: string, ...args: any[]): string }
|
||||
): this
|
||||
replaceValues(
|
||||
pattern: string | RegExp,
|
||||
replaced: string | { (substring: string, ...args: any[]): string }
|
||||
): this
|
||||
|
||||
/**
|
||||
* Returns `true` if callback returns `true`
|
||||
* for all of the container’s children.
|
||||
*
|
||||
* ```js
|
||||
* const noPrefixes = rule.every(i => i.prop[0] !== '-')
|
||||
* ```
|
||||
*
|
||||
* @param condition Iterator returns true or false.
|
||||
* @return Is every child pass condition.
|
||||
*/
|
||||
every(
|
||||
condition: (node: Child, index: number, nodes: Child[]) => boolean
|
||||
): boolean
|
||||
|
||||
/**
|
||||
* Returns `true` if callback returns `true` for (at least) one
|
||||
* of the container’s children.
|
||||
*
|
||||
* ```js
|
||||
* const hasPrefix = rule.some(i => i.prop[0] === '-')
|
||||
* ```
|
||||
*
|
||||
* @param condition Iterator returns true or false.
|
||||
* @return Is some child pass condition.
|
||||
*/
|
||||
some(
|
||||
condition: (node: Child, index: number, nodes: Child[]) => boolean
|
||||
): boolean
|
||||
|
||||
/**
|
||||
* Returns a `child`’s index within the `Container#nodes` array.
|
||||
*
|
||||
* ```js
|
||||
* rule.index( rule.nodes[2] ) //=> 2
|
||||
* ```
|
||||
*
|
||||
* @param child Child of the current container.
|
||||
* @return Child index.
|
||||
*/
|
||||
index(child: Child | number): number
|
||||
}
|
||||
439
day1/node_modules/postcss/lib/container.js
generated
vendored
Normal file
439
day1/node_modules/postcss/lib/container.js
generated
vendored
Normal file
@@ -0,0 +1,439 @@
|
||||
'use strict'
|
||||
|
||||
let { isClean, my } = require('./symbols')
|
||||
let Declaration = require('./declaration')
|
||||
let Comment = require('./comment')
|
||||
let Node = require('./node')
|
||||
|
||||
let parse, Rule, AtRule, Root
|
||||
|
||||
function cleanSource(nodes) {
|
||||
return nodes.map(i => {
|
||||
if (i.nodes) i.nodes = cleanSource(i.nodes)
|
||||
delete i.source
|
||||
return i
|
||||
})
|
||||
}
|
||||
|
||||
function markDirtyUp(node) {
|
||||
node[isClean] = false
|
||||
if (node.proxyOf.nodes) {
|
||||
for (let i of node.proxyOf.nodes) {
|
||||
markDirtyUp(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Container extends Node {
|
||||
push(child) {
|
||||
child.parent = this
|
||||
this.proxyOf.nodes.push(child)
|
||||
return this
|
||||
}
|
||||
|
||||
each(callback) {
|
||||
if (!this.proxyOf.nodes) return undefined
|
||||
let iterator = this.getIterator()
|
||||
|
||||
let index, result
|
||||
while (this.indexes[iterator] < this.proxyOf.nodes.length) {
|
||||
index = this.indexes[iterator]
|
||||
result = callback(this.proxyOf.nodes[index], index)
|
||||
if (result === false) break
|
||||
|
||||
this.indexes[iterator] += 1
|
||||
}
|
||||
|
||||
delete this.indexes[iterator]
|
||||
return result
|
||||
}
|
||||
|
||||
walk(callback) {
|
||||
return this.each((child, i) => {
|
||||
let result
|
||||
try {
|
||||
result = callback(child, i)
|
||||
} catch (e) {
|
||||
throw child.addToError(e)
|
||||
}
|
||||
if (result !== false && child.walk) {
|
||||
result = child.walk(callback)
|
||||
}
|
||||
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
walkDecls(prop, callback) {
|
||||
if (!callback) {
|
||||
callback = prop
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'decl') {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (prop instanceof RegExp) {
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'decl' && prop.test(child.prop)) {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'decl' && child.prop === prop) {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
walkRules(selector, callback) {
|
||||
if (!callback) {
|
||||
callback = selector
|
||||
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'rule') {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (selector instanceof RegExp) {
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'rule' && selector.test(child.selector)) {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'rule' && child.selector === selector) {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
walkAtRules(name, callback) {
|
||||
if (!callback) {
|
||||
callback = name
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'atrule') {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (name instanceof RegExp) {
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'atrule' && name.test(child.name)) {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'atrule' && child.name === name) {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
walkComments(callback) {
|
||||
return this.walk((child, i) => {
|
||||
if (child.type === 'comment') {
|
||||
return callback(child, i)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
append(...children) {
|
||||
for (let child of children) {
|
||||
let nodes = this.normalize(child, this.last)
|
||||
for (let node of nodes) this.proxyOf.nodes.push(node)
|
||||
}
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
prepend(...children) {
|
||||
children = children.reverse()
|
||||
for (let child of children) {
|
||||
let nodes = this.normalize(child, this.first, 'prepend').reverse()
|
||||
for (let node of nodes) this.proxyOf.nodes.unshift(node)
|
||||
for (let id in this.indexes) {
|
||||
this.indexes[id] = this.indexes[id] + nodes.length
|
||||
}
|
||||
}
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
cleanRaws(keepBetween) {
|
||||
super.cleanRaws(keepBetween)
|
||||
if (this.nodes) {
|
||||
for (let node of this.nodes) node.cleanRaws(keepBetween)
|
||||
}
|
||||
}
|
||||
|
||||
insertBefore(exist, add) {
|
||||
exist = this.index(exist)
|
||||
|
||||
let type = exist === 0 ? 'prepend' : false
|
||||
let nodes = this.normalize(add, this.proxyOf.nodes[exist], type).reverse()
|
||||
for (let node of nodes) this.proxyOf.nodes.splice(exist, 0, node)
|
||||
|
||||
let index
|
||||
for (let id in this.indexes) {
|
||||
index = this.indexes[id]
|
||||
if (exist <= index) {
|
||||
this.indexes[id] = index + nodes.length
|
||||
}
|
||||
}
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
insertAfter(exist, add) {
|
||||
exist = this.index(exist)
|
||||
|
||||
let nodes = this.normalize(add, this.proxyOf.nodes[exist]).reverse()
|
||||
for (let node of nodes) this.proxyOf.nodes.splice(exist + 1, 0, node)
|
||||
|
||||
let index
|
||||
for (let id in this.indexes) {
|
||||
index = this.indexes[id]
|
||||
if (exist < index) {
|
||||
this.indexes[id] = index + nodes.length
|
||||
}
|
||||
}
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
removeChild(child) {
|
||||
child = this.index(child)
|
||||
this.proxyOf.nodes[child].parent = undefined
|
||||
this.proxyOf.nodes.splice(child, 1)
|
||||
|
||||
let index
|
||||
for (let id in this.indexes) {
|
||||
index = this.indexes[id]
|
||||
if (index >= child) {
|
||||
this.indexes[id] = index - 1
|
||||
}
|
||||
}
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
removeAll() {
|
||||
for (let node of this.proxyOf.nodes) node.parent = undefined
|
||||
this.proxyOf.nodes = []
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
replaceValues(pattern, opts, callback) {
|
||||
if (!callback) {
|
||||
callback = opts
|
||||
opts = {}
|
||||
}
|
||||
|
||||
this.walkDecls(decl => {
|
||||
if (opts.props && !opts.props.includes(decl.prop)) return
|
||||
if (opts.fast && !decl.value.includes(opts.fast)) return
|
||||
|
||||
decl.value = decl.value.replace(pattern, callback)
|
||||
})
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
every(condition) {
|
||||
return this.nodes.every(condition)
|
||||
}
|
||||
|
||||
some(condition) {
|
||||
return this.nodes.some(condition)
|
||||
}
|
||||
|
||||
index(child) {
|
||||
if (typeof child === 'number') return child
|
||||
if (child.proxyOf) child = child.proxyOf
|
||||
return this.proxyOf.nodes.indexOf(child)
|
||||
}
|
||||
|
||||
get first() {
|
||||
if (!this.proxyOf.nodes) return undefined
|
||||
return this.proxyOf.nodes[0]
|
||||
}
|
||||
|
||||
get last() {
|
||||
if (!this.proxyOf.nodes) return undefined
|
||||
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]
|
||||
}
|
||||
|
||||
normalize(nodes, sample) {
|
||||
if (typeof nodes === 'string') {
|
||||
nodes = cleanSource(parse(nodes).nodes)
|
||||
} else if (Array.isArray(nodes)) {
|
||||
nodes = nodes.slice(0)
|
||||
for (let i of nodes) {
|
||||
if (i.parent) i.parent.removeChild(i, 'ignore')
|
||||
}
|
||||
} else if (nodes.type === 'root' && this.type !== 'document') {
|
||||
nodes = nodes.nodes.slice(0)
|
||||
for (let i of nodes) {
|
||||
if (i.parent) i.parent.removeChild(i, 'ignore')
|
||||
}
|
||||
} else if (nodes.type) {
|
||||
nodes = [nodes]
|
||||
} else if (nodes.prop) {
|
||||
if (typeof nodes.value === 'undefined') {
|
||||
throw new Error('Value field is missed in node creation')
|
||||
} else if (typeof nodes.value !== 'string') {
|
||||
nodes.value = String(nodes.value)
|
||||
}
|
||||
nodes = [new Declaration(nodes)]
|
||||
} else if (nodes.selector) {
|
||||
nodes = [new Rule(nodes)]
|
||||
} else if (nodes.name) {
|
||||
nodes = [new AtRule(nodes)]
|
||||
} else if (nodes.text) {
|
||||
nodes = [new Comment(nodes)]
|
||||
} else {
|
||||
throw new Error('Unknown node type in node creation')
|
||||
}
|
||||
|
||||
let processed = nodes.map(i => {
|
||||
/* c8 ignore next */
|
||||
if (!i[my]) Container.rebuild(i)
|
||||
i = i.proxyOf
|
||||
if (i.parent) i.parent.removeChild(i)
|
||||
if (i[isClean]) markDirtyUp(i)
|
||||
if (typeof i.raws.before === 'undefined') {
|
||||
if (sample && typeof sample.raws.before !== 'undefined') {
|
||||
i.raws.before = sample.raws.before.replace(/\S/g, '')
|
||||
}
|
||||
}
|
||||
i.parent = this.proxyOf
|
||||
return i
|
||||
})
|
||||
|
||||
return processed
|
||||
}
|
||||
|
||||
getProxyProcessor() {
|
||||
return {
|
||||
set(node, prop, value) {
|
||||
if (node[prop] === value) return true
|
||||
node[prop] = value
|
||||
if (prop === 'name' || prop === 'params' || prop === 'selector') {
|
||||
node.markDirty()
|
||||
}
|
||||
return true
|
||||
},
|
||||
|
||||
get(node, prop) {
|
||||
if (prop === 'proxyOf') {
|
||||
return node
|
||||
} else if (!node[prop]) {
|
||||
return node[prop]
|
||||
} else if (
|
||||
prop === 'each' ||
|
||||
(typeof prop === 'string' && prop.startsWith('walk'))
|
||||
) {
|
||||
return (...args) => {
|
||||
return node[prop](
|
||||
...args.map(i => {
|
||||
if (typeof i === 'function') {
|
||||
return (child, index) => i(child.toProxy(), index)
|
||||
} else {
|
||||
return i
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
} else if (prop === 'every' || prop === 'some') {
|
||||
return cb => {
|
||||
return node[prop]((child, ...other) =>
|
||||
cb(child.toProxy(), ...other)
|
||||
)
|
||||
}
|
||||
} else if (prop === 'root') {
|
||||
return () => node.root().toProxy()
|
||||
} else if (prop === 'nodes') {
|
||||
return node.nodes.map(i => i.toProxy())
|
||||
} else if (prop === 'first' || prop === 'last') {
|
||||
return node[prop].toProxy()
|
||||
} else {
|
||||
return node[prop]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getIterator() {
|
||||
if (!this.lastEach) this.lastEach = 0
|
||||
if (!this.indexes) this.indexes = {}
|
||||
|
||||
this.lastEach += 1
|
||||
let iterator = this.lastEach
|
||||
this.indexes[iterator] = 0
|
||||
|
||||
return iterator
|
||||
}
|
||||
}
|
||||
|
||||
Container.registerParse = dependant => {
|
||||
parse = dependant
|
||||
}
|
||||
|
||||
Container.registerRule = dependant => {
|
||||
Rule = dependant
|
||||
}
|
||||
|
||||
Container.registerAtRule = dependant => {
|
||||
AtRule = dependant
|
||||
}
|
||||
|
||||
Container.registerRoot = dependant => {
|
||||
Root = dependant
|
||||
}
|
||||
|
||||
module.exports = Container
|
||||
Container.default = Container
|
||||
|
||||
/* c8 ignore start */
|
||||
Container.rebuild = node => {
|
||||
if (node.type === 'atrule') {
|
||||
Object.setPrototypeOf(node, AtRule.prototype)
|
||||
} else if (node.type === 'rule') {
|
||||
Object.setPrototypeOf(node, Rule.prototype)
|
||||
} else if (node.type === 'decl') {
|
||||
Object.setPrototypeOf(node, Declaration.prototype)
|
||||
} else if (node.type === 'comment') {
|
||||
Object.setPrototypeOf(node, Comment.prototype)
|
||||
} else if (node.type === 'root') {
|
||||
Object.setPrototypeOf(node, Root.prototype)
|
||||
}
|
||||
|
||||
node[my] = true
|
||||
|
||||
if (node.nodes) {
|
||||
node.nodes.forEach(child => {
|
||||
Container.rebuild(child)
|
||||
})
|
||||
}
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
239
day1/node_modules/postcss/lib/css-syntax-error.d.ts
generated
vendored
Normal file
239
day1/node_modules/postcss/lib/css-syntax-error.d.ts
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
import { FilePosition } from './input.js'
|
||||
|
||||
/**
|
||||
* A position that is part of a range.
|
||||
*/
|
||||
export interface RangePosition {
|
||||
/**
|
||||
* The line number in the input.
|
||||
*/
|
||||
line: number
|
||||
|
||||
/**
|
||||
* The column number in the input.
|
||||
*/
|
||||
column: number
|
||||
}
|
||||
|
||||
/**
|
||||
* The CSS parser throws this error for broken CSS.
|
||||
*
|
||||
* Custom parsers can throw this error for broken custom syntax using
|
||||
* the `Node#error` method.
|
||||
*
|
||||
* PostCSS will use the input source map to detect the original error location.
|
||||
* If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS,
|
||||
* PostCSS will show the original position in the Sass file.
|
||||
*
|
||||
* If you need the position in the PostCSS input
|
||||
* (e.g., to debug the previous compiler), use `error.input.file`.
|
||||
*
|
||||
* ```js
|
||||
* // Raising error from plugin
|
||||
* throw node.error('Unknown variable', { plugin: 'postcss-vars' })
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* // Catching and checking syntax error
|
||||
* try {
|
||||
* postcss.parse('a{')
|
||||
* } catch (error) {
|
||||
* if (error.name === 'CssSyntaxError') {
|
||||
* error //=> CssSyntaxError
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export default class CssSyntaxError {
|
||||
/**
|
||||
* Instantiates a CSS syntax error. Can be instantiated for a single position
|
||||
* or for a range.
|
||||
* @param message Error message.
|
||||
* @param lineOrStartPos If for a single position, the line number, or if for
|
||||
* a range, the inclusive start position of the error.
|
||||
* @param columnOrEndPos If for a single position, the column number, or if for
|
||||
* a range, the exclusive end position of the error.
|
||||
* @param source Source code of the broken file.
|
||||
* @param file Absolute path to the broken file.
|
||||
* @param plugin PostCSS plugin name, if error came from plugin.
|
||||
*/
|
||||
constructor(
|
||||
message: string,
|
||||
lineOrStartPos?: number | RangePosition,
|
||||
columnOrEndPos?: number | RangePosition,
|
||||
source?: string,
|
||||
file?: string,
|
||||
plugin?: string
|
||||
)
|
||||
|
||||
stack: string
|
||||
|
||||
/**
|
||||
* Always equal to `'CssSyntaxError'`. You should always check error type
|
||||
* by `error.name === 'CssSyntaxError'`
|
||||
* instead of `error instanceof CssSyntaxError`,
|
||||
* because npm could have several PostCSS versions.
|
||||
*
|
||||
* ```js
|
||||
* if (error.name === 'CssSyntaxError') {
|
||||
* error //=> CssSyntaxError
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
name: 'CssSyntaxError'
|
||||
|
||||
/**
|
||||
* Error message.
|
||||
*
|
||||
* ```js
|
||||
* error.message //=> 'Unclosed block'
|
||||
* ```
|
||||
*/
|
||||
reason: string
|
||||
|
||||
/**
|
||||
* Full error text in the GNU error format
|
||||
* with plugin, file, line and column.
|
||||
*
|
||||
* ```js
|
||||
* error.message //=> 'a.css:1:1: Unclosed block'
|
||||
* ```
|
||||
*/
|
||||
message: string
|
||||
|
||||
/**
|
||||
* Absolute path to the broken file.
|
||||
*
|
||||
* ```js
|
||||
* error.file //=> 'a.sass'
|
||||
* error.input.file //=> 'a.css'
|
||||
* ```
|
||||
*
|
||||
* PostCSS will use the input source map to detect the original location.
|
||||
* If you need the position in the PostCSS input, use `error.input.file`.
|
||||
*/
|
||||
file?: string
|
||||
|
||||
/**
|
||||
* Source line of the error.
|
||||
*
|
||||
* ```js
|
||||
* error.line //=> 2
|
||||
* error.input.line //=> 4
|
||||
* ```
|
||||
*
|
||||
* PostCSS will use the input source map to detect the original location.
|
||||
* If you need the position in the PostCSS input, use `error.input.line`.
|
||||
*/
|
||||
line?: number
|
||||
|
||||
/**
|
||||
* Source column of the error.
|
||||
*
|
||||
* ```js
|
||||
* error.column //=> 1
|
||||
* error.input.column //=> 4
|
||||
* ```
|
||||
*
|
||||
* PostCSS will use the input source map to detect the original location.
|
||||
* If you need the position in the PostCSS input, use `error.input.column`.
|
||||
*/
|
||||
column?: number
|
||||
|
||||
/**
|
||||
* Source line of the error's end, exclusive. Provided if the error pertains
|
||||
* to a range.
|
||||
*
|
||||
* ```js
|
||||
* error.endLine //=> 3
|
||||
* error.input.endLine //=> 4
|
||||
* ```
|
||||
*
|
||||
* PostCSS will use the input source map to detect the original location.
|
||||
* If you need the position in the PostCSS input, use `error.input.endLine`.
|
||||
*/
|
||||
endLine?: number
|
||||
|
||||
/**
|
||||
* Source column of the error's end, exclusive. Provided if the error pertains
|
||||
* to a range.
|
||||
*
|
||||
* ```js
|
||||
* error.endColumn //=> 1
|
||||
* error.input.endColumn //=> 4
|
||||
* ```
|
||||
*
|
||||
* PostCSS will use the input source map to detect the original location.
|
||||
* If you need the position in the PostCSS input, use `error.input.endColumn`.
|
||||
*/
|
||||
endColumn?: number
|
||||
|
||||
/**
|
||||
* Source code of the broken file.
|
||||
*
|
||||
* ```js
|
||||
* error.source //=> 'a { b {} }'
|
||||
* error.input.source //=> 'a b { }'
|
||||
* ```
|
||||
*/
|
||||
source?: string
|
||||
|
||||
/**
|
||||
* Plugin name, if error came from plugin.
|
||||
*
|
||||
* ```js
|
||||
* error.plugin //=> 'postcss-vars'
|
||||
* ```
|
||||
*/
|
||||
plugin?: string
|
||||
|
||||
/**
|
||||
* Input object with PostCSS internal information
|
||||
* about input file. If input has source map
|
||||
* from previous tool, PostCSS will use origin
|
||||
* (for example, Sass) source. You can use this
|
||||
* object to get PostCSS input source.
|
||||
*
|
||||
* ```js
|
||||
* error.input.file //=> 'a.css'
|
||||
* error.file //=> 'a.sass'
|
||||
* ```
|
||||
*/
|
||||
input?: FilePosition
|
||||
|
||||
/**
|
||||
* Returns error position, message and source code of the broken part.
|
||||
*
|
||||
* ```js
|
||||
* error.toString() //=> "CssSyntaxError: app.css:1:1: Unclosed block
|
||||
* // > 1 | a {
|
||||
* // | ^"
|
||||
* ```
|
||||
*
|
||||
* @return Error position, message and source code.
|
||||
*/
|
||||
toString(): string
|
||||
|
||||
/**
|
||||
* Returns a few lines of CSS source that caused the error.
|
||||
*
|
||||
* If the CSS has an input source map without `sourceContent`,
|
||||
* this method will return an empty string.
|
||||
*
|
||||
* ```js
|
||||
* error.showSourceCode() //=> " 4 | }
|
||||
* // 5 | a {
|
||||
* // > 6 | bad
|
||||
* // | ^
|
||||
* // 7 | }
|
||||
* // 8 | b {"
|
||||
* ```
|
||||
*
|
||||
* @param color Whether arrow will be colored red by terminal
|
||||
* color codes. By default, PostCSS will detect
|
||||
* color support by `process.stdout.isTTY`
|
||||
* and `process.env.NODE_DISABLE_COLORS`.
|
||||
* @return Few lines of CSS source that caused the error.
|
||||
*/
|
||||
showSourceCode(color?: boolean): string
|
||||
}
|
||||
100
day1/node_modules/postcss/lib/css-syntax-error.js
generated
vendored
Normal file
100
day1/node_modules/postcss/lib/css-syntax-error.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
'use strict'
|
||||
|
||||
let pico = require('picocolors')
|
||||
|
||||
let terminalHighlight = require('./terminal-highlight')
|
||||
|
||||
class CssSyntaxError extends Error {
|
||||
constructor(message, line, column, source, file, plugin) {
|
||||
super(message)
|
||||
this.name = 'CssSyntaxError'
|
||||
this.reason = message
|
||||
|
||||
if (file) {
|
||||
this.file = file
|
||||
}
|
||||
if (source) {
|
||||
this.source = source
|
||||
}
|
||||
if (plugin) {
|
||||
this.plugin = plugin
|
||||
}
|
||||
if (typeof line !== 'undefined' && typeof column !== 'undefined') {
|
||||
if (typeof line === 'number') {
|
||||
this.line = line
|
||||
this.column = column
|
||||
} else {
|
||||
this.line = line.line
|
||||
this.column = line.column
|
||||
this.endLine = column.line
|
||||
this.endColumn = column.column
|
||||
}
|
||||
}
|
||||
|
||||
this.setMessage()
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, CssSyntaxError)
|
||||
}
|
||||
}
|
||||
|
||||
setMessage() {
|
||||
this.message = this.plugin ? this.plugin + ': ' : ''
|
||||
this.message += this.file ? this.file : '<css input>'
|
||||
if (typeof this.line !== 'undefined') {
|
||||
this.message += ':' + this.line + ':' + this.column
|
||||
}
|
||||
this.message += ': ' + this.reason
|
||||
}
|
||||
|
||||
showSourceCode(color) {
|
||||
if (!this.source) return ''
|
||||
|
||||
let css = this.source
|
||||
if (color == null) color = pico.isColorSupported
|
||||
if (terminalHighlight) {
|
||||
if (color) css = terminalHighlight(css)
|
||||
}
|
||||
|
||||
let lines = css.split(/\r?\n/)
|
||||
let start = Math.max(this.line - 3, 0)
|
||||
let end = Math.min(this.line + 2, lines.length)
|
||||
|
||||
let maxWidth = String(end).length
|
||||
|
||||
let mark, aside
|
||||
if (color) {
|
||||
let { bold, red, gray } = pico.createColors(true)
|
||||
mark = text => bold(red(text))
|
||||
aside = text => gray(text)
|
||||
} else {
|
||||
mark = aside = str => str
|
||||
}
|
||||
|
||||
return lines
|
||||
.slice(start, end)
|
||||
.map((line, index) => {
|
||||
let number = start + 1 + index
|
||||
let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | '
|
||||
if (number === this.line) {
|
||||
let spacing =
|
||||
aside(gutter.replace(/\d/g, ' ')) +
|
||||
line.slice(0, this.column - 1).replace(/[^\t]/g, ' ')
|
||||
return mark('>') + aside(gutter) + line + '\n ' + spacing + mark('^')
|
||||
}
|
||||
return ' ' + aside(gutter) + line
|
||||
})
|
||||
.join('\n')
|
||||
}
|
||||
|
||||
toString() {
|
||||
let code = this.showSourceCode()
|
||||
if (code) {
|
||||
code = '\n\n' + code + '\n'
|
||||
}
|
||||
return this.name + ': ' + this.message + code
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CssSyntaxError
|
||||
CssSyntaxError.default = CssSyntaxError
|
||||
124
day1/node_modules/postcss/lib/declaration.d.ts
generated
vendored
Normal file
124
day1/node_modules/postcss/lib/declaration.d.ts
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
import Container from './container.js'
|
||||
import Node from './node.js'
|
||||
|
||||
interface DeclarationRaws extends Record<string, unknown> {
|
||||
/**
|
||||
* The space symbols before the node. It also stores `*`
|
||||
* and `_` symbols before the declaration (IE hack).
|
||||
*/
|
||||
before?: string
|
||||
|
||||
/**
|
||||
* The symbols between the property and value for declarations.
|
||||
*/
|
||||
between?: string
|
||||
|
||||
/**
|
||||
* The content of the important statement, if it is not just `!important`.
|
||||
*/
|
||||
important?: string
|
||||
|
||||
/**
|
||||
* Declaration value with comments.
|
||||
*/
|
||||
value?: {
|
||||
value: string
|
||||
raw: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DeclarationProps {
|
||||
/** Name of the declaration. */
|
||||
prop: string
|
||||
/** Value of the declaration. */
|
||||
value: string
|
||||
/** Whether the declaration has an `!important` annotation. */
|
||||
important?: boolean
|
||||
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
|
||||
raws?: DeclarationRaws
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a CSS declaration.
|
||||
*
|
||||
* ```js
|
||||
* Once (root, { Declaration }) {
|
||||
* let color = new Declaration({ prop: 'color', value: 'black' })
|
||||
* root.append(color)
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('a { color: black }')
|
||||
* const decl = root.first.first
|
||||
* decl.type //=> 'decl'
|
||||
* decl.toString() //=> ' color: black'
|
||||
* ```
|
||||
*/
|
||||
export default class Declaration extends Node {
|
||||
type: 'decl'
|
||||
parent: Container | undefined
|
||||
raws: DeclarationRaws
|
||||
|
||||
/**
|
||||
* The declaration's property name.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('a { color: black }')
|
||||
* const decl = root.first.first
|
||||
* decl.prop //=> 'color'
|
||||
* ```
|
||||
*/
|
||||
prop: string
|
||||
|
||||
/**
|
||||
* The declaration’s value.
|
||||
*
|
||||
* This value will be cleaned of comments. If the source value contained
|
||||
* comments, those comments will be available in the `raws` property.
|
||||
* If you have not changed the value, the result of `decl.toString()`
|
||||
* will include the original raws value (comments and all).
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('a { color: black }')
|
||||
* const decl = root.first.first
|
||||
* decl.value //=> 'black'
|
||||
* ```
|
||||
*/
|
||||
value: string
|
||||
|
||||
/**
|
||||
* `true` if the declaration has an `!important` annotation.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('a { color: black !important; color: red }')
|
||||
* root.first.first.important //=> true
|
||||
* root.first.last.important //=> undefined
|
||||
* ```
|
||||
*/
|
||||
important: boolean
|
||||
|
||||
/**
|
||||
* `true` if declaration is declaration of CSS Custom Property
|
||||
* or Sass variable.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse(':root { --one: 1 }')
|
||||
* let one = root.first.first
|
||||
* one.variable //=> true
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('$one: 1')
|
||||
* let one = root.first
|
||||
* one.variable //=> true
|
||||
* ```
|
||||
*/
|
||||
variable: boolean
|
||||
|
||||
constructor(defaults?: DeclarationProps)
|
||||
assign(overrides: object | DeclarationProps): this
|
||||
clone(overrides?: Partial<DeclarationProps>): this
|
||||
cloneBefore(overrides?: Partial<DeclarationProps>): this
|
||||
cloneAfter(overrides?: Partial<DeclarationProps>): this
|
||||
}
|
||||
24
day1/node_modules/postcss/lib/declaration.js
generated
vendored
Normal file
24
day1/node_modules/postcss/lib/declaration.js
generated
vendored
Normal file
@@ -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
|
||||
57
day1/node_modules/postcss/lib/document.d.ts
generated
vendored
Normal file
57
day1/node_modules/postcss/lib/document.d.ts
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
import Container, { ContainerProps } from './container.js'
|
||||
import { ProcessOptions } from './postcss.js'
|
||||
import Result from './result.js'
|
||||
import Root, { RootProps } from './root.js'
|
||||
|
||||
export interface DocumentProps extends ContainerProps {
|
||||
nodes?: Root[]
|
||||
|
||||
/**
|
||||
* Information to generate byte-to-byte equal node string as it was
|
||||
* in the origin input.
|
||||
*
|
||||
* Every parser saves its own properties.
|
||||
*/
|
||||
raws?: Record<string, any>
|
||||
}
|
||||
|
||||
type ChildNode = Root
|
||||
type ChildProps = RootProps
|
||||
|
||||
/**
|
||||
* Represents a file and contains all its parsed nodes.
|
||||
*
|
||||
* **Experimental:** some aspects of this node could change within minor
|
||||
* or patch version releases.
|
||||
*
|
||||
* ```js
|
||||
* const document = htmlParser(
|
||||
* '<html><style>a{color:black}</style><style>b{z-index:2}</style>'
|
||||
* )
|
||||
* document.type //=> 'document'
|
||||
* document.nodes.length //=> 2
|
||||
* ```
|
||||
*/
|
||||
export default class Document extends Container<Root> {
|
||||
type: 'document'
|
||||
parent: undefined
|
||||
|
||||
constructor(defaults?: DocumentProps)
|
||||
|
||||
/**
|
||||
* Returns a `Result` instance representing the document’s CSS roots.
|
||||
*
|
||||
* ```js
|
||||
* const root1 = postcss.parse(css1, { from: 'a.css' })
|
||||
* const root2 = postcss.parse(css2, { from: 'b.css' })
|
||||
* const document = postcss.document()
|
||||
* document.append(root1)
|
||||
* document.append(root2)
|
||||
* const result = document.toResult({ to: 'all.css', map: true })
|
||||
* ```
|
||||
*
|
||||
* @param opts Options.
|
||||
* @return Result with current document’s CSS.
|
||||
*/
|
||||
toResult(options?: ProcessOptions): Result
|
||||
}
|
||||
33
day1/node_modules/postcss/lib/document.js
generated
vendored
Normal file
33
day1/node_modules/postcss/lib/document.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict'
|
||||
|
||||
let Container = require('./container')
|
||||
|
||||
let LazyResult, Processor
|
||||
|
||||
class Document extends Container {
|
||||
constructor(defaults) {
|
||||
// type needs to be passed to super, otherwise child roots won't be normalized correctly
|
||||
super({ type: 'document', ...defaults })
|
||||
|
||||
if (!this.nodes) {
|
||||
this.nodes = []
|
||||
}
|
||||
}
|
||||
|
||||
toResult(opts = {}) {
|
||||
let lazy = new LazyResult(new Processor(), this, opts)
|
||||
|
||||
return lazy.stringify()
|
||||
}
|
||||
}
|
||||
|
||||
Document.registerLazyResult = dependant => {
|
||||
LazyResult = dependant
|
||||
}
|
||||
|
||||
Document.registerProcessor = dependant => {
|
||||
Processor = dependant
|
||||
}
|
||||
|
||||
module.exports = Document
|
||||
Document.default = Document
|
||||
5
day1/node_modules/postcss/lib/fromJSON.d.ts
generated
vendored
Normal file
5
day1/node_modules/postcss/lib/fromJSON.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { JSONHydrator } from './postcss.js'
|
||||
|
||||
declare const fromJSON: JSONHydrator
|
||||
|
||||
export default fromJSON
|
||||
54
day1/node_modules/postcss/lib/fromJSON.js
generated
vendored
Normal file
54
day1/node_modules/postcss/lib/fromJSON.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
'use strict'
|
||||
|
||||
let Declaration = require('./declaration')
|
||||
let PreviousMap = require('./previous-map')
|
||||
let Comment = require('./comment')
|
||||
let AtRule = require('./at-rule')
|
||||
let Input = require('./input')
|
||||
let Root = require('./root')
|
||||
let Rule = require('./rule')
|
||||
|
||||
function fromJSON(json, inputs) {
|
||||
if (Array.isArray(json)) return json.map(n => fromJSON(n))
|
||||
|
||||
let { inputs: ownInputs, ...defaults } = json
|
||||
if (ownInputs) {
|
||||
inputs = []
|
||||
for (let input of ownInputs) {
|
||||
let inputHydrated = { ...input, __proto__: Input.prototype }
|
||||
if (inputHydrated.map) {
|
||||
inputHydrated.map = {
|
||||
...inputHydrated.map,
|
||||
__proto__: PreviousMap.prototype
|
||||
}
|
||||
}
|
||||
inputs.push(inputHydrated)
|
||||
}
|
||||
}
|
||||
if (defaults.nodes) {
|
||||
defaults.nodes = json.nodes.map(n => fromJSON(n, inputs))
|
||||
}
|
||||
if (defaults.source) {
|
||||
let { inputId, ...source } = defaults.source
|
||||
defaults.source = source
|
||||
if (inputId != null) {
|
||||
defaults.source.input = inputs[inputId]
|
||||
}
|
||||
}
|
||||
if (defaults.type === 'root') {
|
||||
return new Root(defaults)
|
||||
} else if (defaults.type === 'decl') {
|
||||
return new Declaration(defaults)
|
||||
} else if (defaults.type === 'rule') {
|
||||
return new Rule(defaults)
|
||||
} else if (defaults.type === 'comment') {
|
||||
return new Comment(defaults)
|
||||
} else if (defaults.type === 'atrule') {
|
||||
return new AtRule(defaults)
|
||||
} else {
|
||||
throw new Error('Unknown node type: ' + json.type)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = fromJSON
|
||||
fromJSON.default = fromJSON
|
||||
150
day1/node_modules/postcss/lib/input.d.ts
generated
vendored
Normal file
150
day1/node_modules/postcss/lib/input.d.ts
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
import { ProcessOptions } from './postcss.js'
|
||||
import PreviousMap from './previous-map.js'
|
||||
|
||||
export interface FilePosition {
|
||||
/**
|
||||
* URL for the source file.
|
||||
*/
|
||||
url: string
|
||||
|
||||
/**
|
||||
* Absolute path to the source file.
|
||||
*/
|
||||
file?: string
|
||||
|
||||
/**
|
||||
* Line of inclusive start position in source file.
|
||||
*/
|
||||
line: number
|
||||
|
||||
/**
|
||||
* Column of inclusive start position in source file.
|
||||
*/
|
||||
column: number
|
||||
|
||||
/**
|
||||
* Line of exclusive end position in source file.
|
||||
*/
|
||||
endLine?: number
|
||||
|
||||
/**
|
||||
* Column of exclusive end position in source file.
|
||||
*/
|
||||
endColumn?: number
|
||||
|
||||
/**
|
||||
* Source code.
|
||||
*/
|
||||
source?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the source CSS.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse(css, { from: file })
|
||||
* const input = root.source.input
|
||||
* ```
|
||||
*/
|
||||
export default class Input {
|
||||
/**
|
||||
* Input CSS source.
|
||||
*
|
||||
* ```js
|
||||
* const input = postcss.parse('a{}', { from: file }).input
|
||||
* input.css //=> "a{}"
|
||||
* ```
|
||||
*/
|
||||
css: string
|
||||
|
||||
/**
|
||||
* The input source map passed from a compilation step before PostCSS
|
||||
* (for example, from Sass compiler).
|
||||
*
|
||||
* ```js
|
||||
* root.source.input.map.consumer().sources //=> ['a.sass']
|
||||
* ```
|
||||
*/
|
||||
map: PreviousMap
|
||||
|
||||
/**
|
||||
* The absolute path to the CSS source file defined
|
||||
* with the `from` option.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse(css, { from: 'a.css' })
|
||||
* root.source.input.file //=> '/home/ai/a.css'
|
||||
* ```
|
||||
*/
|
||||
file?: string
|
||||
|
||||
/**
|
||||
* The unique ID of the CSS source. It will be created if `from` option
|
||||
* is not provided (because PostCSS does not know the file path).
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse(css)
|
||||
* root.source.input.file //=> undefined
|
||||
* root.source.input.id //=> "<input css 8LZeVF>"
|
||||
* ```
|
||||
*/
|
||||
id?: string
|
||||
|
||||
/**
|
||||
* The flag to indicate whether or not the source code has Unicode BOM.
|
||||
*/
|
||||
hasBOM: boolean
|
||||
|
||||
/**
|
||||
* @param css Input CSS source.
|
||||
* @param opts Process options.
|
||||
*/
|
||||
constructor(css: string, opts?: ProcessOptions)
|
||||
|
||||
/**
|
||||
* The CSS source identifier. Contains `Input#file` if the user
|
||||
* set the `from` option, or `Input#id` if they did not.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse(css, { from: 'a.css' })
|
||||
* root.source.input.from //=> "/home/ai/a.css"
|
||||
*
|
||||
* const root = postcss.parse(css)
|
||||
* root.source.input.from //=> "<input css 1>"
|
||||
* ```
|
||||
*/
|
||||
get from(): string
|
||||
|
||||
/**
|
||||
* Reads the input source map and returns a symbol position
|
||||
* in the input source (e.g., in a Sass file that was compiled
|
||||
* to CSS before being passed to PostCSS). Optionally takes an
|
||||
* end position, exclusive.
|
||||
*
|
||||
* ```js
|
||||
* root.source.input.origin(1, 1) //=> { file: 'a.css', line: 3, column: 1 }
|
||||
* root.source.input.origin(1, 1, 1, 4)
|
||||
* //=> { file: 'a.css', line: 3, column: 1, endLine: 3, endColumn: 4 }
|
||||
* ```
|
||||
*
|
||||
* @param line Line for inclusive start position in input CSS.
|
||||
* @param column Column for inclusive start position in input CSS.
|
||||
* @param endLine Line for exclusive end position in input CSS.
|
||||
* @param endColumn Column for exclusive end position in input CSS.
|
||||
*
|
||||
* @return Position in input source.
|
||||
*/
|
||||
origin(
|
||||
line: number,
|
||||
column: number,
|
||||
endLine?: number,
|
||||
endColumn?: number
|
||||
): FilePosition | false
|
||||
|
||||
/**
|
||||
* Converts source offset to line and column.
|
||||
*
|
||||
* @param offset Source offset.
|
||||
*/
|
||||
fromOffset(offset: number): { line: number; col: number } | null
|
||||
}
|
||||
248
day1/node_modules/postcss/lib/input.js
generated
vendored
Normal file
248
day1/node_modules/postcss/lib/input.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
'use strict'
|
||||
|
||||
let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js')
|
||||
let { fileURLToPath, pathToFileURL } = require('url')
|
||||
let { resolve, isAbsolute } = require('path')
|
||||
let { nanoid } = require('nanoid/non-secure')
|
||||
|
||||
let terminalHighlight = require('./terminal-highlight')
|
||||
let CssSyntaxError = require('./css-syntax-error')
|
||||
let PreviousMap = require('./previous-map')
|
||||
|
||||
let fromOffsetCache = Symbol('fromOffsetCache')
|
||||
|
||||
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator)
|
||||
let pathAvailable = Boolean(resolve && isAbsolute)
|
||||
|
||||
class Input {
|
||||
constructor(css, opts = {}) {
|
||||
if (
|
||||
css === null ||
|
||||
typeof css === 'undefined' ||
|
||||
(typeof css === 'object' && !css.toString)
|
||||
) {
|
||||
throw new Error(`PostCSS received ${css} instead of CSS string`)
|
||||
}
|
||||
|
||||
this.css = css.toString()
|
||||
|
||||
if (this.css[0] === '\uFEFF' || this.css[0] === '\uFFFE') {
|
||||
this.hasBOM = true
|
||||
this.css = this.css.slice(1)
|
||||
} else {
|
||||
this.hasBOM = false
|
||||
}
|
||||
|
||||
if (opts.from) {
|
||||
if (
|
||||
!pathAvailable ||
|
||||
/^\w+:\/\//.test(opts.from) ||
|
||||
isAbsolute(opts.from)
|
||||
) {
|
||||
this.file = opts.from
|
||||
} else {
|
||||
this.file = resolve(opts.from)
|
||||
}
|
||||
}
|
||||
|
||||
if (pathAvailable && sourceMapAvailable) {
|
||||
let map = new PreviousMap(this.css, opts)
|
||||
if (map.text) {
|
||||
this.map = map
|
||||
let file = map.consumer().file
|
||||
if (!this.file && file) this.file = this.mapResolve(file)
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.file) {
|
||||
this.id = '<input css ' + nanoid(6) + '>'
|
||||
}
|
||||
if (this.map) this.map.file = this.from
|
||||
}
|
||||
|
||||
fromOffset(offset) {
|
||||
let lastLine, lineToIndex
|
||||
if (!this[fromOffsetCache]) {
|
||||
let lines = this.css.split('\n')
|
||||
lineToIndex = new Array(lines.length)
|
||||
let prevIndex = 0
|
||||
|
||||
for (let i = 0, l = lines.length; i < l; i++) {
|
||||
lineToIndex[i] = prevIndex
|
||||
prevIndex += lines[i].length + 1
|
||||
}
|
||||
|
||||
this[fromOffsetCache] = lineToIndex
|
||||
} else {
|
||||
lineToIndex = this[fromOffsetCache]
|
||||
}
|
||||
lastLine = lineToIndex[lineToIndex.length - 1]
|
||||
|
||||
let min = 0
|
||||
if (offset >= lastLine) {
|
||||
min = lineToIndex.length - 1
|
||||
} else {
|
||||
let max = lineToIndex.length - 2
|
||||
let mid
|
||||
while (min < max) {
|
||||
mid = min + ((max - min) >> 1)
|
||||
if (offset < lineToIndex[mid]) {
|
||||
max = mid - 1
|
||||
} else if (offset >= lineToIndex[mid + 1]) {
|
||||
min = mid + 1
|
||||
} else {
|
||||
min = mid
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
line: min + 1,
|
||||
col: offset - lineToIndex[min] + 1
|
||||
}
|
||||
}
|
||||
|
||||
error(message, line, column, opts = {}) {
|
||||
let result, endLine, endColumn
|
||||
|
||||
if (line && typeof line === 'object') {
|
||||
let start = line
|
||||
let end = column
|
||||
if (typeof line.offset === 'number') {
|
||||
let pos = this.fromOffset(start.offset)
|
||||
line = pos.line
|
||||
column = pos.col
|
||||
} else {
|
||||
line = start.line
|
||||
column = start.column
|
||||
}
|
||||
if (typeof end.offset === 'number') {
|
||||
let pos = this.fromOffset(end.offset)
|
||||
endLine = pos.line
|
||||
endColumn = pos.col
|
||||
} else {
|
||||
endLine = end.line
|
||||
endColumn = end.column
|
||||
}
|
||||
} else if (!column) {
|
||||
let pos = this.fromOffset(line)
|
||||
line = pos.line
|
||||
column = pos.col
|
||||
}
|
||||
|
||||
let origin = this.origin(line, column, endLine, endColumn)
|
||||
if (origin) {
|
||||
result = new CssSyntaxError(
|
||||
message,
|
||||
origin.endLine === undefined
|
||||
? origin.line
|
||||
: { line: origin.line, column: origin.column },
|
||||
origin.endLine === undefined
|
||||
? origin.column
|
||||
: { line: origin.endLine, column: origin.endColumn },
|
||||
origin.source,
|
||||
origin.file,
|
||||
opts.plugin
|
||||
)
|
||||
} else {
|
||||
result = new CssSyntaxError(
|
||||
message,
|
||||
endLine === undefined ? line : { line, column },
|
||||
endLine === undefined ? column : { line: endLine, column: endColumn },
|
||||
this.css,
|
||||
this.file,
|
||||
opts.plugin
|
||||
)
|
||||
}
|
||||
|
||||
result.input = { line, column, endLine, endColumn, source: this.css }
|
||||
if (this.file) {
|
||||
if (pathToFileURL) {
|
||||
result.input.url = pathToFileURL(this.file).toString()
|
||||
}
|
||||
result.input.file = this.file
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
origin(line, column, endLine, endColumn) {
|
||||
if (!this.map) return false
|
||||
let consumer = this.map.consumer()
|
||||
|
||||
let from = consumer.originalPositionFor({ line, column })
|
||||
if (!from.source) return false
|
||||
|
||||
let to
|
||||
if (typeof endLine === 'number') {
|
||||
to = consumer.originalPositionFor({ line: endLine, column: endColumn })
|
||||
}
|
||||
|
||||
let fromUrl
|
||||
|
||||
if (isAbsolute(from.source)) {
|
||||
fromUrl = pathToFileURL(from.source)
|
||||
} else {
|
||||
fromUrl = new URL(
|
||||
from.source,
|
||||
this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile)
|
||||
)
|
||||
}
|
||||
|
||||
let result = {
|
||||
url: fromUrl.toString(),
|
||||
line: from.line,
|
||||
column: from.column,
|
||||
endLine: to && to.line,
|
||||
endColumn: to && to.column
|
||||
}
|
||||
|
||||
if (fromUrl.protocol === 'file:') {
|
||||
if (fileURLToPath) {
|
||||
result.file = fileURLToPath(fromUrl)
|
||||
} else {
|
||||
/* c8 ignore next 2 */
|
||||
throw new Error(`file: protocol is not available in this PostCSS build`)
|
||||
}
|
||||
}
|
||||
|
||||
let source = consumer.sourceContentFor(from.source)
|
||||
if (source) result.source = source
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
mapResolve(file) {
|
||||
if (/^\w+:\/\//.test(file)) {
|
||||
return file
|
||||
}
|
||||
return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file)
|
||||
}
|
||||
|
||||
get from() {
|
||||
return this.file || this.id
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
let json = {}
|
||||
for (let name of ['hasBOM', 'css', 'file', 'id']) {
|
||||
if (this[name] != null) {
|
||||
json[name] = this[name]
|
||||
}
|
||||
}
|
||||
if (this.map) {
|
||||
json.map = { ...this.map }
|
||||
if (json.map.consumerCache) {
|
||||
json.map.consumerCache = undefined
|
||||
}
|
||||
}
|
||||
return json
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Input
|
||||
Input.default = Input
|
||||
|
||||
if (terminalHighlight && terminalHighlight.registerInput) {
|
||||
terminalHighlight.registerInput(Input)
|
||||
}
|
||||
176
day1/node_modules/postcss/lib/lazy-result.d.ts
generated
vendored
Normal file
176
day1/node_modules/postcss/lib/lazy-result.d.ts
generated
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
import Result, { Message, ResultOptions } from './result.js'
|
||||
import { SourceMap } from './postcss.js'
|
||||
import Processor from './processor.js'
|
||||
import Warning from './warning.js'
|
||||
import Root from './root.js'
|
||||
|
||||
/**
|
||||
* A Promise proxy for the result of PostCSS transformations.
|
||||
*
|
||||
* A `LazyResult` instance is returned by `Processor#process`.
|
||||
*
|
||||
* ```js
|
||||
* const lazy = postcss([autoprefixer]).process(css)
|
||||
* ```
|
||||
*/
|
||||
export default class LazyResult implements PromiseLike<Result> {
|
||||
/**
|
||||
* Processes input CSS through synchronous and asynchronous plugins
|
||||
* and calls `onFulfilled` with a Result instance. If a plugin throws
|
||||
* an error, the `onRejected` callback will be executed.
|
||||
*
|
||||
* It implements standard Promise API.
|
||||
*
|
||||
* ```js
|
||||
* postcss([autoprefixer]).process(css, { from: cssPath }).then(result => {
|
||||
* console.log(result.css)
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
then: Promise<Result>['then']
|
||||
|
||||
/**
|
||||
* Processes input CSS through synchronous and asynchronous plugins
|
||||
* and calls onRejected for each error thrown in any plugin.
|
||||
*
|
||||
* It implements standard Promise API.
|
||||
*
|
||||
* ```js
|
||||
* postcss([autoprefixer]).process(css).then(result => {
|
||||
* console.log(result.css)
|
||||
* }).catch(error => {
|
||||
* console.error(error)
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
catch: Promise<Result>['catch']
|
||||
|
||||
/**
|
||||
* Processes input CSS through synchronous and asynchronous plugins
|
||||
* and calls onFinally on any error or when all plugins will finish work.
|
||||
*
|
||||
* It implements standard Promise API.
|
||||
*
|
||||
* ```js
|
||||
* postcss([autoprefixer]).process(css).finally(() => {
|
||||
* console.log('processing ended')
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
finally: Promise<Result>['finally']
|
||||
|
||||
/**
|
||||
* @param processor Processor used for this transformation.
|
||||
* @param css CSS to parse and transform.
|
||||
* @param opts Options from the `Processor#process` or `Root#toResult`.
|
||||
*/
|
||||
constructor(processor: Processor, css: string, opts: ResultOptions)
|
||||
|
||||
/**
|
||||
* Returns the default string description of an object.
|
||||
* Required to implement the Promise interface.
|
||||
*/
|
||||
get [Symbol.toStringTag](): string
|
||||
|
||||
/**
|
||||
* Returns a `Processor` instance, which will be used
|
||||
* for CSS transformations.
|
||||
*/
|
||||
get processor(): Processor
|
||||
|
||||
/**
|
||||
* Options from the `Processor#process` call.
|
||||
*/
|
||||
get opts(): ResultOptions
|
||||
|
||||
/**
|
||||
* Processes input CSS through synchronous plugins, converts `Root`
|
||||
* to a CSS string and returns `Result#css`.
|
||||
*
|
||||
* This property will only work with synchronous plugins.
|
||||
* If the processor contains any asynchronous plugins
|
||||
* it will throw an error.
|
||||
*
|
||||
* PostCSS runners should always use `LazyResult#then`.
|
||||
*/
|
||||
get css(): string
|
||||
|
||||
/**
|
||||
* An alias for the `css` property. Use it with syntaxes
|
||||
* that generate non-CSS output.
|
||||
*
|
||||
* This property will only work with synchronous plugins.
|
||||
* If the processor contains any asynchronous plugins
|
||||
* it will throw an error.
|
||||
*
|
||||
* PostCSS runners should always use `LazyResult#then`.
|
||||
*/
|
||||
get content(): string
|
||||
|
||||
/**
|
||||
* Processes input CSS through synchronous plugins
|
||||
* and returns `Result#map`.
|
||||
*
|
||||
* This property will only work with synchronous plugins.
|
||||
* If the processor contains any asynchronous plugins
|
||||
* it will throw an error.
|
||||
*
|
||||
* PostCSS runners should always use `LazyResult#then`.
|
||||
*/
|
||||
get map(): SourceMap
|
||||
|
||||
/**
|
||||
* Processes input CSS through synchronous plugins
|
||||
* and returns `Result#root`.
|
||||
*
|
||||
* This property will only work with synchronous plugins. If the processor
|
||||
* contains any asynchronous plugins it will throw an error.
|
||||
*
|
||||
* PostCSS runners should always use `LazyResult#then`.
|
||||
*/
|
||||
get root(): Root
|
||||
|
||||
/**
|
||||
* Processes input CSS through synchronous plugins
|
||||
* and returns `Result#messages`.
|
||||
*
|
||||
* This property will only work with synchronous plugins. If the processor
|
||||
* contains any asynchronous plugins it will throw an error.
|
||||
*
|
||||
* PostCSS runners should always use `LazyResult#then`.
|
||||
*/
|
||||
get messages(): Message[]
|
||||
|
||||
/**
|
||||
* Processes input CSS through synchronous plugins
|
||||
* and calls `Result#warnings`.
|
||||
*
|
||||
* @return Warnings from plugins.
|
||||
*/
|
||||
warnings(): Warning[]
|
||||
|
||||
/**
|
||||
* Alias for the `LazyResult#css` property.
|
||||
*
|
||||
* ```js
|
||||
* lazy + '' === lazy.css
|
||||
* ```
|
||||
*
|
||||
* @return Output CSS.
|
||||
*/
|
||||
toString(): string
|
||||
|
||||
/**
|
||||
* Run plugin in sync way and return `Result`.
|
||||
*
|
||||
* @return Result with output content.
|
||||
*/
|
||||
sync(): Result
|
||||
|
||||
/**
|
||||
* Run plugin in async way and return `Result`.
|
||||
*
|
||||
* @return Result with output content.
|
||||
*/
|
||||
async(): Promise<Result>
|
||||
}
|
||||
550
day1/node_modules/postcss/lib/lazy-result.js
generated
vendored
Normal file
550
day1/node_modules/postcss/lib/lazy-result.js
generated
vendored
Normal file
@@ -0,0 +1,550 @@
|
||||
'use strict'
|
||||
|
||||
let { isClean, my } = require('./symbols')
|
||||
let MapGenerator = require('./map-generator')
|
||||
let stringify = require('./stringify')
|
||||
let Container = require('./container')
|
||||
let Document = require('./document')
|
||||
let warnOnce = require('./warn-once')
|
||||
let Result = require('./result')
|
||||
let parse = require('./parse')
|
||||
let Root = require('./root')
|
||||
|
||||
const TYPE_TO_CLASS_NAME = {
|
||||
document: 'Document',
|
||||
root: 'Root',
|
||||
atrule: 'AtRule',
|
||||
rule: 'Rule',
|
||||
decl: 'Declaration',
|
||||
comment: 'Comment'
|
||||
}
|
||||
|
||||
const PLUGIN_PROPS = {
|
||||
postcssPlugin: true,
|
||||
prepare: true,
|
||||
Once: true,
|
||||
Document: true,
|
||||
Root: true,
|
||||
Declaration: true,
|
||||
Rule: true,
|
||||
AtRule: true,
|
||||
Comment: true,
|
||||
DeclarationExit: true,
|
||||
RuleExit: true,
|
||||
AtRuleExit: true,
|
||||
CommentExit: true,
|
||||
RootExit: true,
|
||||
DocumentExit: true,
|
||||
OnceExit: true
|
||||
}
|
||||
|
||||
const NOT_VISITORS = {
|
||||
postcssPlugin: true,
|
||||
prepare: true,
|
||||
Once: true
|
||||
}
|
||||
|
||||
const CHILDREN = 0
|
||||
|
||||
function isPromise(obj) {
|
||||
return typeof obj === 'object' && typeof obj.then === 'function'
|
||||
}
|
||||
|
||||
function getEvents(node) {
|
||||
let key = false
|
||||
let type = TYPE_TO_CLASS_NAME[node.type]
|
||||
if (node.type === 'decl') {
|
||||
key = node.prop.toLowerCase()
|
||||
} else if (node.type === 'atrule') {
|
||||
key = node.name.toLowerCase()
|
||||
}
|
||||
|
||||
if (key && node.append) {
|
||||
return [
|
||||
type,
|
||||
type + '-' + key,
|
||||
CHILDREN,
|
||||
type + 'Exit',
|
||||
type + 'Exit-' + key
|
||||
]
|
||||
} else if (key) {
|
||||
return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key]
|
||||
} else if (node.append) {
|
||||
return [type, CHILDREN, type + 'Exit']
|
||||
} else {
|
||||
return [type, type + 'Exit']
|
||||
}
|
||||
}
|
||||
|
||||
function toStack(node) {
|
||||
let events
|
||||
if (node.type === 'document') {
|
||||
events = ['Document', CHILDREN, 'DocumentExit']
|
||||
} else if (node.type === 'root') {
|
||||
events = ['Root', CHILDREN, 'RootExit']
|
||||
} else {
|
||||
events = getEvents(node)
|
||||
}
|
||||
|
||||
return {
|
||||
node,
|
||||
events,
|
||||
eventIndex: 0,
|
||||
visitors: [],
|
||||
visitorIndex: 0,
|
||||
iterator: 0
|
||||
}
|
||||
}
|
||||
|
||||
function cleanMarks(node) {
|
||||
node[isClean] = false
|
||||
if (node.nodes) node.nodes.forEach(i => cleanMarks(i))
|
||||
return node
|
||||
}
|
||||
|
||||
let postcss = {}
|
||||
|
||||
class LazyResult {
|
||||
constructor(processor, css, opts) {
|
||||
this.stringified = false
|
||||
this.processed = false
|
||||
|
||||
let root
|
||||
if (
|
||||
typeof css === 'object' &&
|
||||
css !== null &&
|
||||
(css.type === 'root' || css.type === 'document')
|
||||
) {
|
||||
root = cleanMarks(css)
|
||||
} else if (css instanceof LazyResult || css instanceof Result) {
|
||||
root = cleanMarks(css.root)
|
||||
if (css.map) {
|
||||
if (typeof opts.map === 'undefined') opts.map = {}
|
||||
if (!opts.map.inline) opts.map.inline = false
|
||||
opts.map.prev = css.map
|
||||
}
|
||||
} else {
|
||||
let parser = parse
|
||||
if (opts.syntax) parser = opts.syntax.parse
|
||||
if (opts.parser) parser = opts.parser
|
||||
if (parser.parse) parser = parser.parse
|
||||
|
||||
try {
|
||||
root = parser(css, opts)
|
||||
} catch (error) {
|
||||
this.processed = true
|
||||
this.error = error
|
||||
}
|
||||
|
||||
if (root && !root[my]) {
|
||||
/* c8 ignore next 2 */
|
||||
Container.rebuild(root)
|
||||
}
|
||||
}
|
||||
|
||||
this.result = new Result(processor, root, opts)
|
||||
this.helpers = { ...postcss, result: this.result, postcss }
|
||||
this.plugins = this.processor.plugins.map(plugin => {
|
||||
if (typeof plugin === 'object' && plugin.prepare) {
|
||||
return { ...plugin, ...plugin.prepare(this.result) }
|
||||
} else {
|
||||
return plugin
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
get [Symbol.toStringTag]() {
|
||||
return 'LazyResult'
|
||||
}
|
||||
|
||||
get processor() {
|
||||
return this.result.processor
|
||||
}
|
||||
|
||||
get opts() {
|
||||
return this.result.opts
|
||||
}
|
||||
|
||||
get css() {
|
||||
return this.stringify().css
|
||||
}
|
||||
|
||||
get content() {
|
||||
return this.stringify().content
|
||||
}
|
||||
|
||||
get map() {
|
||||
return this.stringify().map
|
||||
}
|
||||
|
||||
get root() {
|
||||
return this.sync().root
|
||||
}
|
||||
|
||||
get messages() {
|
||||
return this.sync().messages
|
||||
}
|
||||
|
||||
warnings() {
|
||||
return this.sync().warnings()
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.css
|
||||
}
|
||||
|
||||
then(onFulfilled, onRejected) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!('from' in this.opts)) {
|
||||
warnOnce(
|
||||
'Without `from` option PostCSS could generate wrong source map ' +
|
||||
'and will not find Browserslist config. Set it to CSS file path ' +
|
||||
'or to `undefined` to prevent this warning.'
|
||||
)
|
||||
}
|
||||
}
|
||||
return this.async().then(onFulfilled, onRejected)
|
||||
}
|
||||
|
||||
catch(onRejected) {
|
||||
return this.async().catch(onRejected)
|
||||
}
|
||||
|
||||
finally(onFinally) {
|
||||
return this.async().then(onFinally, onFinally)
|
||||
}
|
||||
|
||||
async() {
|
||||
if (this.error) return Promise.reject(this.error)
|
||||
if (this.processed) return Promise.resolve(this.result)
|
||||
if (!this.processing) {
|
||||
this.processing = this.runAsync()
|
||||
}
|
||||
return this.processing
|
||||
}
|
||||
|
||||
sync() {
|
||||
if (this.error) throw this.error
|
||||
if (this.processed) return this.result
|
||||
this.processed = true
|
||||
|
||||
if (this.processing) {
|
||||
throw this.getAsyncError()
|
||||
}
|
||||
|
||||
for (let plugin of this.plugins) {
|
||||
let promise = this.runOnRoot(plugin)
|
||||
if (isPromise(promise)) {
|
||||
throw this.getAsyncError()
|
||||
}
|
||||
}
|
||||
|
||||
this.prepareVisitors()
|
||||
if (this.hasListener) {
|
||||
let root = this.result.root
|
||||
while (!root[isClean]) {
|
||||
root[isClean] = true
|
||||
this.walkSync(root)
|
||||
}
|
||||
if (this.listeners.OnceExit) {
|
||||
if (root.type === 'document') {
|
||||
for (let subRoot of root.nodes) {
|
||||
this.visitSync(this.listeners.OnceExit, subRoot)
|
||||
}
|
||||
} else {
|
||||
this.visitSync(this.listeners.OnceExit, root)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.result
|
||||
}
|
||||
|
||||
stringify() {
|
||||
if (this.error) throw this.error
|
||||
if (this.stringified) return this.result
|
||||
this.stringified = true
|
||||
|
||||
this.sync()
|
||||
|
||||
let opts = this.result.opts
|
||||
let str = stringify
|
||||
if (opts.syntax) str = opts.syntax.stringify
|
||||
if (opts.stringifier) str = opts.stringifier
|
||||
if (str.stringify) str = str.stringify
|
||||
|
||||
let map = new MapGenerator(str, this.result.root, this.result.opts)
|
||||
let data = map.generate()
|
||||
this.result.css = data[0]
|
||||
this.result.map = data[1]
|
||||
|
||||
return this.result
|
||||
}
|
||||
|
||||
walkSync(node) {
|
||||
node[isClean] = true
|
||||
let events = getEvents(node)
|
||||
for (let event of events) {
|
||||
if (event === CHILDREN) {
|
||||
if (node.nodes) {
|
||||
node.each(child => {
|
||||
if (!child[isClean]) this.walkSync(child)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
let visitors = this.listeners[event]
|
||||
if (visitors) {
|
||||
if (this.visitSync(visitors, node.toProxy())) return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
visitSync(visitors, node) {
|
||||
for (let [plugin, visitor] of visitors) {
|
||||
this.result.lastPlugin = plugin
|
||||
let promise
|
||||
try {
|
||||
promise = visitor(node, this.helpers)
|
||||
} catch (e) {
|
||||
throw this.handleError(e, node.proxyOf)
|
||||
}
|
||||
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
|
||||
return true
|
||||
}
|
||||
if (isPromise(promise)) {
|
||||
throw this.getAsyncError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
runOnRoot(plugin) {
|
||||
this.result.lastPlugin = plugin
|
||||
try {
|
||||
if (typeof plugin === 'object' && plugin.Once) {
|
||||
if (this.result.root.type === 'document') {
|
||||
let roots = this.result.root.nodes.map(root =>
|
||||
plugin.Once(root, this.helpers)
|
||||
)
|
||||
|
||||
if (isPromise(roots[0])) {
|
||||
return Promise.all(roots)
|
||||
}
|
||||
|
||||
return roots
|
||||
}
|
||||
|
||||
return plugin.Once(this.result.root, this.helpers)
|
||||
} else if (typeof plugin === 'function') {
|
||||
return plugin(this.result.root, this.result)
|
||||
}
|
||||
} catch (error) {
|
||||
throw this.handleError(error)
|
||||
}
|
||||
}
|
||||
|
||||
getAsyncError() {
|
||||
throw new Error('Use process(css).then(cb) to work with async plugins')
|
||||
}
|
||||
|
||||
handleError(error, node) {
|
||||
let plugin = this.result.lastPlugin
|
||||
try {
|
||||
if (node) node.addToError(error)
|
||||
this.error = error
|
||||
if (error.name === 'CssSyntaxError' && !error.plugin) {
|
||||
error.plugin = plugin.postcssPlugin
|
||||
error.setMessage()
|
||||
} else if (plugin.postcssVersion) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
let pluginName = plugin.postcssPlugin
|
||||
let pluginVer = plugin.postcssVersion
|
||||
let runtimeVer = this.result.processor.version
|
||||
let a = pluginVer.split('.')
|
||||
let b = runtimeVer.split('.')
|
||||
|
||||
if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
'Unknown error from PostCSS plugin. Your current PostCSS ' +
|
||||
'version is ' +
|
||||
runtimeVer +
|
||||
', but ' +
|
||||
pluginName +
|
||||
' uses ' +
|
||||
pluginVer +
|
||||
'. Perhaps this is the source of the error below.'
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
/* c8 ignore next 3 */
|
||||
// eslint-disable-next-line no-console
|
||||
if (console && console.error) console.error(err)
|
||||
}
|
||||
return error
|
||||
}
|
||||
|
||||
async runAsync() {
|
||||
this.plugin = 0
|
||||
for (let i = 0; i < this.plugins.length; i++) {
|
||||
let plugin = this.plugins[i]
|
||||
let promise = this.runOnRoot(plugin)
|
||||
if (isPromise(promise)) {
|
||||
try {
|
||||
await promise
|
||||
} catch (error) {
|
||||
throw this.handleError(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.prepareVisitors()
|
||||
if (this.hasListener) {
|
||||
let root = this.result.root
|
||||
while (!root[isClean]) {
|
||||
root[isClean] = true
|
||||
let stack = [toStack(root)]
|
||||
while (stack.length > 0) {
|
||||
let promise = this.visitTick(stack)
|
||||
if (isPromise(promise)) {
|
||||
try {
|
||||
await promise
|
||||
} catch (e) {
|
||||
let node = stack[stack.length - 1].node
|
||||
throw this.handleError(e, node)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.listeners.OnceExit) {
|
||||
for (let [plugin, visitor] of this.listeners.OnceExit) {
|
||||
this.result.lastPlugin = plugin
|
||||
try {
|
||||
if (root.type === 'document') {
|
||||
let roots = root.nodes.map(subRoot =>
|
||||
visitor(subRoot, this.helpers)
|
||||
)
|
||||
|
||||
await Promise.all(roots)
|
||||
} else {
|
||||
await visitor(root, this.helpers)
|
||||
}
|
||||
} catch (e) {
|
||||
throw this.handleError(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.processed = true
|
||||
return this.stringify()
|
||||
}
|
||||
|
||||
prepareVisitors() {
|
||||
this.listeners = {}
|
||||
let add = (plugin, type, cb) => {
|
||||
if (!this.listeners[type]) this.listeners[type] = []
|
||||
this.listeners[type].push([plugin, cb])
|
||||
}
|
||||
for (let plugin of this.plugins) {
|
||||
if (typeof plugin === 'object') {
|
||||
for (let event in plugin) {
|
||||
if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
|
||||
throw new Error(
|
||||
`Unknown event ${event} in ${plugin.postcssPlugin}. ` +
|
||||
`Try to update PostCSS (${this.processor.version} now).`
|
||||
)
|
||||
}
|
||||
if (!NOT_VISITORS[event]) {
|
||||
if (typeof plugin[event] === 'object') {
|
||||
for (let filter in plugin[event]) {
|
||||
if (filter === '*') {
|
||||
add(plugin, event, plugin[event][filter])
|
||||
} else {
|
||||
add(
|
||||
plugin,
|
||||
event + '-' + filter.toLowerCase(),
|
||||
plugin[event][filter]
|
||||
)
|
||||
}
|
||||
}
|
||||
} else if (typeof plugin[event] === 'function') {
|
||||
add(plugin, event, plugin[event])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.hasListener = Object.keys(this.listeners).length > 0
|
||||
}
|
||||
|
||||
visitTick(stack) {
|
||||
let visit = stack[stack.length - 1]
|
||||
let { node, visitors } = visit
|
||||
|
||||
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
|
||||
stack.pop()
|
||||
return
|
||||
}
|
||||
|
||||
if (visitors.length > 0 && visit.visitorIndex < visitors.length) {
|
||||
let [plugin, visitor] = visitors[visit.visitorIndex]
|
||||
visit.visitorIndex += 1
|
||||
if (visit.visitorIndex === visitors.length) {
|
||||
visit.visitors = []
|
||||
visit.visitorIndex = 0
|
||||
}
|
||||
this.result.lastPlugin = plugin
|
||||
try {
|
||||
return visitor(node.toProxy(), this.helpers)
|
||||
} catch (e) {
|
||||
throw this.handleError(e, node)
|
||||
}
|
||||
}
|
||||
|
||||
if (visit.iterator !== 0) {
|
||||
let iterator = visit.iterator
|
||||
let child
|
||||
while ((child = node.nodes[node.indexes[iterator]])) {
|
||||
node.indexes[iterator] += 1
|
||||
if (!child[isClean]) {
|
||||
child[isClean] = true
|
||||
stack.push(toStack(child))
|
||||
return
|
||||
}
|
||||
}
|
||||
visit.iterator = 0
|
||||
delete node.indexes[iterator]
|
||||
}
|
||||
|
||||
let events = visit.events
|
||||
while (visit.eventIndex < events.length) {
|
||||
let event = events[visit.eventIndex]
|
||||
visit.eventIndex += 1
|
||||
if (event === CHILDREN) {
|
||||
if (node.nodes && node.nodes.length) {
|
||||
node[isClean] = true
|
||||
visit.iterator = node.getIterator()
|
||||
}
|
||||
return
|
||||
} else if (this.listeners[event]) {
|
||||
visit.visitors = this.listeners[event]
|
||||
return
|
||||
}
|
||||
}
|
||||
stack.pop()
|
||||
}
|
||||
}
|
||||
|
||||
LazyResult.registerPostcss = dependant => {
|
||||
postcss = dependant
|
||||
}
|
||||
|
||||
module.exports = LazyResult
|
||||
LazyResult.default = LazyResult
|
||||
|
||||
Root.registerLazyResult(LazyResult)
|
||||
Document.registerLazyResult(LazyResult)
|
||||
51
day1/node_modules/postcss/lib/list.d.ts
generated
vendored
Normal file
51
day1/node_modules/postcss/lib/list.d.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
export type List = {
|
||||
/**
|
||||
* Safely splits values.
|
||||
*
|
||||
* ```js
|
||||
* Once (root, { list }) {
|
||||
* list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)']
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param string separated values.
|
||||
* @param separators array of separators.
|
||||
* @param last boolean indicator.
|
||||
* @return Split values.
|
||||
*/
|
||||
split(string: string, separators: string[], last: boolean): string[]
|
||||
/**
|
||||
* Safely splits space-separated values (such as those for `background`,
|
||||
* `border-radius`, and other shorthand properties).
|
||||
*
|
||||
* ```js
|
||||
* Once (root, { list }) {
|
||||
* list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param str Space-separated values.
|
||||
* @return Split values.
|
||||
*/
|
||||
space(str: string): string[]
|
||||
|
||||
/**
|
||||
* Safely splits comma-separated values (such as those for `transition-*`
|
||||
* and `background` properties).
|
||||
*
|
||||
* ```js
|
||||
* Once (root, { list }) {
|
||||
* list.comma('black, linear-gradient(white, black)')
|
||||
* //=> ['black', 'linear-gradient(white, black)']
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param str Comma-separated values.
|
||||
* @return Split values.
|
||||
*/
|
||||
comma(str: string): string[]
|
||||
}
|
||||
|
||||
declare const list: List
|
||||
|
||||
export default list
|
||||
58
day1/node_modules/postcss/lib/list.js
generated
vendored
Normal file
58
day1/node_modules/postcss/lib/list.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
'use strict'
|
||||
|
||||
let list = {
|
||||
split(string, separators, last) {
|
||||
let array = []
|
||||
let current = ''
|
||||
let split = false
|
||||
|
||||
let func = 0
|
||||
let inQuote = false
|
||||
let prevQuote = ''
|
||||
let escape = false
|
||||
|
||||
for (let letter of string) {
|
||||
if (escape) {
|
||||
escape = false
|
||||
} else if (letter === '\\') {
|
||||
escape = true
|
||||
} else if (inQuote) {
|
||||
if (letter === prevQuote) {
|
||||
inQuote = false
|
||||
}
|
||||
} else if (letter === '"' || letter === "'") {
|
||||
inQuote = true
|
||||
prevQuote = letter
|
||||
} else if (letter === '(') {
|
||||
func += 1
|
||||
} else if (letter === ')') {
|
||||
if (func > 0) func -= 1
|
||||
} else if (func === 0) {
|
||||
if (separators.includes(letter)) split = true
|
||||
}
|
||||
|
||||
if (split) {
|
||||
if (current !== '') array.push(current.trim())
|
||||
current = ''
|
||||
split = false
|
||||
} else {
|
||||
current += letter
|
||||
}
|
||||
}
|
||||
|
||||
if (last || current !== '') array.push(current.trim())
|
||||
return array
|
||||
},
|
||||
|
||||
space(string) {
|
||||
let spaces = [' ', '\n', '\t']
|
||||
return list.split(string, spaces)
|
||||
},
|
||||
|
||||
comma(string) {
|
||||
return list.split(string, [','], true)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = list
|
||||
list.default = list
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user