Game
- Create class "player"
This commit is contained in:
BIN
site/real_game/.DS_Store
vendored
Normal file
BIN
site/real_game/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
site/real_game/class/.DS_Store
vendored
Normal file
BIN
site/real_game/class/.DS_Store
vendored
Normal file
Binary file not shown.
80
site/real_game/class/Player.js
Normal file
80
site/real_game/class/Player.js
Normal file
@ -0,0 +1,80 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Player.js :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/18 00:30:31 by edbernar #+# #+# */
|
||||
/* Updated: 2024/08/18 01:47:15 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
/*
|
||||
Explication du code :
|
||||
- Un seul joueur peut etre instancié, sinon ça throw une erreur
|
||||
- Lorsqu'une touche est pressée, celle-ci sera ajoutée à la variable "pressedButton"
|
||||
Exemple : w et a sont pressées -> pressedButton = ['w', 'a']
|
||||
- Les lignes avec cleanup sont l'êquivalent d'un destructeur en CPP
|
||||
- Pour appliquer des actions sur les touches, il suffit de faire ça dans la fonction
|
||||
update en regardant si la touche voulue est pressée dans la variable "pressedButton"
|
||||
*/
|
||||
|
||||
/*
|
||||
Todo (Eddy) :
|
||||
- Ajouter une camera sur l'object
|
||||
- Faire une fonction pour changer le mode de la camera (fix ou accrochée)
|
||||
*/
|
||||
|
||||
let playerExist = false;
|
||||
|
||||
class Player
|
||||
{
|
||||
pressedButton = [];
|
||||
constructor (object)
|
||||
{
|
||||
if (playerExist)
|
||||
throw Error("Player is already init.");
|
||||
playerExist = true;
|
||||
this.cleanup = new FinalizationRegistry((heldValue) => {
|
||||
playerExist = false;
|
||||
})
|
||||
this.cleanup.register(this, null);
|
||||
|
||||
document.addEventListener('keydown', (e) => {
|
||||
let i;
|
||||
|
||||
i = 0;
|
||||
while (i < this.pressedButton.length && e.key != this.pressedButton[i])
|
||||
i++;
|
||||
if (i == this.pressedButton.length)
|
||||
this.pressedButton.push(e.key);
|
||||
});
|
||||
|
||||
document.addEventListener('keyup', (e) => {
|
||||
let i;
|
||||
|
||||
i = 0;
|
||||
while (i < this.pressedButton.length && e.key != this.pressedButton[i])
|
||||
i++;
|
||||
if (i != this.pressedButton.length)
|
||||
this.pressedButton.splice(i, 1);
|
||||
});
|
||||
}
|
||||
|
||||
update()
|
||||
{
|
||||
let i;
|
||||
|
||||
i = 0;
|
||||
while (i < this.pressedButton.length)
|
||||
{
|
||||
if (this.pressedButton[i] == 'a')
|
||||
console.log('A is pressed !');
|
||||
i++;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export { Player };
|
16
site/real_game/index.html
Normal file
16
site/real_game/index.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Page</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
<script src="./main.js" type="module"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
19
site/real_game/main.js
Normal file
19
site/real_game/main.js
Normal file
@ -0,0 +1,19 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.js :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/18 00:53:53 by edbernar #+# #+# */
|
||||
/* Updated: 2024/08/18 01:09:38 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
import { Player } from './Player'
|
||||
|
||||
const player = new Player(null);
|
||||
|
||||
setInterval(() => {
|
||||
player.update();
|
||||
}, 100);
|
1
site/real_game/node_modules/.bin/esbuild
generated
vendored
Symbolic link
1
site/real_game/node_modules/.bin/esbuild
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../esbuild/bin/esbuild
|
1
site/real_game/node_modules/.bin/nanoid
generated
vendored
Symbolic link
1
site/real_game/node_modules/.bin/nanoid
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../nanoid/bin/nanoid.cjs
|
1
site/real_game/node_modules/.bin/rollup
generated
vendored
Symbolic link
1
site/real_game/node_modules/.bin/rollup
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../rollup/dist/bin/rollup
|
1
site/real_game/node_modules/.bin/vite
generated
vendored
Symbolic link
1
site/real_game/node_modules/.bin/vite
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../vite/bin/vite.js
|
255
site/real_game/node_modules/.package-lock.json
generated
vendored
Normal file
255
site/real_game/node_modules/.package-lock.json
generated
vendored
Normal file
@ -0,0 +1,255 @@
|
||||
{
|
||||
"name": "class",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@esbuild/darwin-arm64": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz",
|
||||
"integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/rollup-darwin-arm64": {
|
||||
"version": "4.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.20.0.tgz",
|
||||
"integrity": "sha512-uFVfvzvsdGtlSLuL0ZlvPJvl6ZmrH4CBwLGEFPe7hUmf7htGAN+aXo43R/V6LATyxlKVC/m6UsLb7jbG+LG39Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
]
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
|
||||
"integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.21.5",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
|
||||
"integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.21.5",
|
||||
"@esbuild/android-arm": "0.21.5",
|
||||
"@esbuild/android-arm64": "0.21.5",
|
||||
"@esbuild/android-x64": "0.21.5",
|
||||
"@esbuild/darwin-arm64": "0.21.5",
|
||||
"@esbuild/darwin-x64": "0.21.5",
|
||||
"@esbuild/freebsd-arm64": "0.21.5",
|
||||
"@esbuild/freebsd-x64": "0.21.5",
|
||||
"@esbuild/linux-arm": "0.21.5",
|
||||
"@esbuild/linux-arm64": "0.21.5",
|
||||
"@esbuild/linux-ia32": "0.21.5",
|
||||
"@esbuild/linux-loong64": "0.21.5",
|
||||
"@esbuild/linux-mips64el": "0.21.5",
|
||||
"@esbuild/linux-ppc64": "0.21.5",
|
||||
"@esbuild/linux-riscv64": "0.21.5",
|
||||
"@esbuild/linux-s390x": "0.21.5",
|
||||
"@esbuild/linux-x64": "0.21.5",
|
||||
"@esbuild/netbsd-x64": "0.21.5",
|
||||
"@esbuild/openbsd-x64": "0.21.5",
|
||||
"@esbuild/sunos-x64": "0.21.5",
|
||||
"@esbuild/win32-arm64": "0.21.5",
|
||||
"@esbuild/win32-ia32": "0.21.5",
|
||||
"@esbuild/win32-x64": "0.21.5"
|
||||
}
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.7",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
|
||||
"integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"nanoid": "bin/nanoid.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz",
|
||||
"integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.41",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.41.tgz",
|
||||
"integrity": "sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.7",
|
||||
"picocolors": "^1.0.1",
|
||||
"source-map-js": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "4.20.0",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.20.0.tgz",
|
||||
"integrity": "sha512-6rbWBChcnSGzIlXeIdNIZTopKYad8ZG8ajhl78lGRLsI2rX8IkaotQhVas2Ma+GPxJav19wrSzvRvuiv0YKzWw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/estree": "1.0.5"
|
||||
},
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0",
|
||||
"npm": ">=8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-android-arm-eabi": "4.20.0",
|
||||
"@rollup/rollup-android-arm64": "4.20.0",
|
||||
"@rollup/rollup-darwin-arm64": "4.20.0",
|
||||
"@rollup/rollup-darwin-x64": "4.20.0",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.20.0",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.20.0",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.20.0",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.20.0",
|
||||
"@rollup/rollup-linux-powerpc64le-gnu": "4.20.0",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.20.0",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.20.0",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.20.0",
|
||||
"@rollup/rollup-linux-x64-musl": "4.20.0",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.20.0",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.20.0",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.20.0",
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz",
|
||||
"integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/three": {
|
||||
"version": "0.167.1",
|
||||
"resolved": "https://registry.npmjs.org/three/-/three-0.167.1.tgz",
|
||||
"integrity": "sha512-gYTLJA/UQip6J/tJvl91YYqlZF47+D/kxiWrbTon35ZHlXEN0VOo+Qke2walF1/x92v55H6enomymg4Dak52kw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "5.4.1",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.1.tgz",
|
||||
"integrity": "sha512-1oE6yuNXssjrZdblI9AfBbHCC41nnyoVoEZxQnID6yvQZAFBzxxkqoFLtHUMkYunL8hwOLEjgTuxpkRxvba3kA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"esbuild": "^0.21.3",
|
||||
"postcss": "^8.4.41",
|
||||
"rollup": "^4.13.0"
|
||||
},
|
||||
"bin": {
|
||||
"vite": "bin/vite.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.0.0 || >=20.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/vitejs/vite?sponsor=1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "^18.0.0 || >=20.0.0",
|
||||
"less": "*",
|
||||
"lightningcss": "^1.21.0",
|
||||
"sass": "*",
|
||||
"sass-embedded": "*",
|
||||
"stylus": "*",
|
||||
"sugarss": "*",
|
||||
"terser": "^5.4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/node": {
|
||||
"optional": true
|
||||
},
|
||||
"less": {
|
||||
"optional": true
|
||||
},
|
||||
"lightningcss": {
|
||||
"optional": true
|
||||
},
|
||||
"sass": {
|
||||
"optional": true
|
||||
},
|
||||
"sass-embedded": {
|
||||
"optional": true
|
||||
},
|
||||
"stylus": {
|
||||
"optional": true
|
||||
},
|
||||
"sugarss": {
|
||||
"optional": true
|
||||
},
|
||||
"terser": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
8
site/real_game/node_modules/.vite/deps/_metadata.json
generated
vendored
Normal file
8
site/real_game/node_modules/.vite/deps/_metadata.json
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"hash": "d27ca5c8",
|
||||
"configHash": "7970fc20",
|
||||
"lockfileHash": "13ac84ee",
|
||||
"browserHash": "2d791e19",
|
||||
"optimized": {},
|
||||
"chunks": {}
|
||||
}
|
3
site/real_game/node_modules/.vite/deps/package.json
generated
vendored
Normal file
3
site/real_game/node_modules/.vite/deps/package.json
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
3
site/real_game/node_modules/@esbuild/darwin-arm64/README.md
generated
vendored
Normal file
3
site/real_game/node_modules/@esbuild/darwin-arm64/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# esbuild
|
||||
|
||||
This is the macOS ARM 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
|
BIN
site/real_game/node_modules/@esbuild/darwin-arm64/bin/esbuild
generated
vendored
Executable file
BIN
site/real_game/node_modules/@esbuild/darwin-arm64/bin/esbuild
generated
vendored
Executable file
Binary file not shown.
20
site/real_game/node_modules/@esbuild/darwin-arm64/package.json
generated
vendored
Normal file
20
site/real_game/node_modules/@esbuild/darwin-arm64/package.json
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "@esbuild/darwin-arm64",
|
||||
"version": "0.21.5",
|
||||
"description": "The macOS ARM 64-bit binary for esbuild, a JavaScript bundler.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/evanw/esbuild.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"preferUnplugged": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"cpu": [
|
||||
"arm64"
|
||||
]
|
||||
}
|
3
site/real_game/node_modules/@rollup/rollup-darwin-arm64/README.md
generated
vendored
Normal file
3
site/real_game/node_modules/@rollup/rollup-darwin-arm64/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# `@rollup/rollup-darwin-arm64`
|
||||
|
||||
This is the **aarch64-apple-darwin** binary for `rollup`
|
19
site/real_game/node_modules/@rollup/rollup-darwin-arm64/package.json
generated
vendored
Normal file
19
site/real_game/node_modules/@rollup/rollup-darwin-arm64/package.json
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "@rollup/rollup-darwin-arm64",
|
||||
"version": "4.20.0",
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"files": [
|
||||
"rollup.darwin-arm64.node"
|
||||
],
|
||||
"description": "Native bindings for Rollup",
|
||||
"author": "Lukas Taegert-Atkinson",
|
||||
"homepage": "https://rollupjs.org/",
|
||||
"license": "MIT",
|
||||
"repository": "rollup/rollup",
|
||||
"main": "./rollup.darwin-arm64.node"
|
||||
}
|
BIN
site/real_game/node_modules/@rollup/rollup-darwin-arm64/rollup.darwin-arm64.node
generated
vendored
Normal file
BIN
site/real_game/node_modules/@rollup/rollup-darwin-arm64/rollup.darwin-arm64.node
generated
vendored
Normal file
Binary file not shown.
21
site/real_game/node_modules/@types/estree/LICENSE
generated
vendored
Normal file
21
site/real_game/node_modules/@types/estree/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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
|
15
site/real_game/node_modules/@types/estree/README.md
generated
vendored
Normal file
15
site/real_game/node_modules/@types/estree/README.md
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# Installation
|
||||
> `npm install --save @types/estree`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for estree (https://github.com/estree/estree).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Mon, 06 Nov 2023 22:41:05 GMT
|
||||
* Dependencies: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [RReverser](https://github.com/RReverser).
|
167
site/real_game/node_modules/@types/estree/flow.d.ts
generated
vendored
Normal file
167
site/real_game/node_modules/@types/estree/flow.d.ts
generated
vendored
Normal file
@ -0,0 +1,167 @@
|
||||
declare namespace ESTree {
|
||||
interface FlowTypeAnnotation extends Node {}
|
||||
|
||||
interface FlowBaseTypeAnnotation extends FlowTypeAnnotation {}
|
||||
|
||||
interface FlowLiteralTypeAnnotation extends FlowTypeAnnotation, Literal {}
|
||||
|
||||
interface FlowDeclaration extends Declaration {}
|
||||
|
||||
interface AnyTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||
|
||||
interface ArrayTypeAnnotation extends FlowTypeAnnotation {
|
||||
elementType: FlowTypeAnnotation;
|
||||
}
|
||||
|
||||
interface BooleanLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
|
||||
|
||||
interface BooleanTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||
|
||||
interface ClassImplements extends Node {
|
||||
id: Identifier;
|
||||
typeParameters?: TypeParameterInstantiation | null;
|
||||
}
|
||||
|
||||
interface ClassProperty {
|
||||
key: Expression;
|
||||
value?: Expression | null;
|
||||
typeAnnotation?: TypeAnnotation | null;
|
||||
computed: boolean;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
interface DeclareClass extends FlowDeclaration {
|
||||
id: Identifier;
|
||||
typeParameters?: TypeParameterDeclaration | null;
|
||||
body: ObjectTypeAnnotation;
|
||||
extends: InterfaceExtends[];
|
||||
}
|
||||
|
||||
interface DeclareFunction extends FlowDeclaration {
|
||||
id: Identifier;
|
||||
}
|
||||
|
||||
interface DeclareModule extends FlowDeclaration {
|
||||
id: Literal | Identifier;
|
||||
body: BlockStatement;
|
||||
}
|
||||
|
||||
interface DeclareVariable extends FlowDeclaration {
|
||||
id: Identifier;
|
||||
}
|
||||
|
||||
interface FunctionTypeAnnotation extends FlowTypeAnnotation {
|
||||
params: FunctionTypeParam[];
|
||||
returnType: FlowTypeAnnotation;
|
||||
rest?: FunctionTypeParam | null;
|
||||
typeParameters?: TypeParameterDeclaration | null;
|
||||
}
|
||||
|
||||
interface FunctionTypeParam {
|
||||
name: Identifier;
|
||||
typeAnnotation: FlowTypeAnnotation;
|
||||
optional: boolean;
|
||||
}
|
||||
|
||||
interface GenericTypeAnnotation extends FlowTypeAnnotation {
|
||||
id: Identifier | QualifiedTypeIdentifier;
|
||||
typeParameters?: TypeParameterInstantiation | null;
|
||||
}
|
||||
|
||||
interface InterfaceExtends extends Node {
|
||||
id: Identifier | QualifiedTypeIdentifier;
|
||||
typeParameters?: TypeParameterInstantiation | null;
|
||||
}
|
||||
|
||||
interface InterfaceDeclaration extends FlowDeclaration {
|
||||
id: Identifier;
|
||||
typeParameters?: TypeParameterDeclaration | null;
|
||||
extends: InterfaceExtends[];
|
||||
body: ObjectTypeAnnotation;
|
||||
}
|
||||
|
||||
interface IntersectionTypeAnnotation extends FlowTypeAnnotation {
|
||||
types: FlowTypeAnnotation[];
|
||||
}
|
||||
|
||||
interface MixedTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||
|
||||
interface NullableTypeAnnotation extends FlowTypeAnnotation {
|
||||
typeAnnotation: TypeAnnotation;
|
||||
}
|
||||
|
||||
interface NumberLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
|
||||
|
||||
interface NumberTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||
|
||||
interface StringLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
|
||||
|
||||
interface StringTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||
|
||||
interface TupleTypeAnnotation extends FlowTypeAnnotation {
|
||||
types: FlowTypeAnnotation[];
|
||||
}
|
||||
|
||||
interface TypeofTypeAnnotation extends FlowTypeAnnotation {
|
||||
argument: FlowTypeAnnotation;
|
||||
}
|
||||
|
||||
interface TypeAlias extends FlowDeclaration {
|
||||
id: Identifier;
|
||||
typeParameters?: TypeParameterDeclaration | null;
|
||||
right: FlowTypeAnnotation;
|
||||
}
|
||||
|
||||
interface TypeAnnotation extends Node {
|
||||
typeAnnotation: FlowTypeAnnotation;
|
||||
}
|
||||
|
||||
interface TypeCastExpression extends Expression {
|
||||
expression: Expression;
|
||||
typeAnnotation: TypeAnnotation;
|
||||
}
|
||||
|
||||
interface TypeParameterDeclaration extends Node {
|
||||
params: Identifier[];
|
||||
}
|
||||
|
||||
interface TypeParameterInstantiation extends Node {
|
||||
params: FlowTypeAnnotation[];
|
||||
}
|
||||
|
||||
interface ObjectTypeAnnotation extends FlowTypeAnnotation {
|
||||
properties: ObjectTypeProperty[];
|
||||
indexers: ObjectTypeIndexer[];
|
||||
callProperties: ObjectTypeCallProperty[];
|
||||
}
|
||||
|
||||
interface ObjectTypeCallProperty extends Node {
|
||||
value: FunctionTypeAnnotation;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
interface ObjectTypeIndexer extends Node {
|
||||
id: Identifier;
|
||||
key: FlowTypeAnnotation;
|
||||
value: FlowTypeAnnotation;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
interface ObjectTypeProperty extends Node {
|
||||
key: Expression;
|
||||
value: FlowTypeAnnotation;
|
||||
optional: boolean;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
interface QualifiedTypeIdentifier extends Node {
|
||||
qualification: Identifier | QualifiedTypeIdentifier;
|
||||
id: Identifier;
|
||||
}
|
||||
|
||||
interface UnionTypeAnnotation extends FlowTypeAnnotation {
|
||||
types: FlowTypeAnnotation[];
|
||||
}
|
||||
|
||||
interface VoidTypeAnnotation extends FlowBaseTypeAnnotation {}
|
||||
}
|
683
site/real_game/node_modules/@types/estree/index.d.ts
generated
vendored
Normal file
683
site/real_game/node_modules/@types/estree/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,683 @@
|
||||
// This definition file follows a somewhat unusual format. ESTree allows
|
||||
// runtime type checks based on the `type` parameter. In order to explain this
|
||||
// to typescript we want to use discriminated union types:
|
||||
// https://github.com/Microsoft/TypeScript/pull/9163
|
||||
//
|
||||
// For ESTree this is a bit tricky because the high level interfaces like
|
||||
// Node or Function are pulling double duty. We want to pass common fields down
|
||||
// to the interfaces that extend them (like Identifier or
|
||||
// ArrowFunctionExpression), but you can't extend a type union or enforce
|
||||
// common fields on them. So we've split the high level interfaces into two
|
||||
// types, a base type which passes down inherited fields, and a type union of
|
||||
// all types which extend the base type. Only the type union is exported, and
|
||||
// the union is how other types refer to the collection of inheriting types.
|
||||
//
|
||||
// This makes the definitions file here somewhat more difficult to maintain,
|
||||
// but it has the notable advantage of making ESTree much easier to use as
|
||||
// an end user.
|
||||
|
||||
export interface BaseNodeWithoutComments {
|
||||
// Every leaf interface that extends BaseNode must specify a type property.
|
||||
// The type property should be a string literal. For example, Identifier
|
||||
// has: `type: "Identifier"`
|
||||
type: string;
|
||||
loc?: SourceLocation | null | undefined;
|
||||
range?: [number, number] | undefined;
|
||||
}
|
||||
|
||||
export interface BaseNode extends BaseNodeWithoutComments {
|
||||
leadingComments?: Comment[] | undefined;
|
||||
trailingComments?: Comment[] | undefined;
|
||||
}
|
||||
|
||||
export interface NodeMap {
|
||||
AssignmentProperty: AssignmentProperty;
|
||||
CatchClause: CatchClause;
|
||||
Class: Class;
|
||||
ClassBody: ClassBody;
|
||||
Expression: Expression;
|
||||
Function: Function;
|
||||
Identifier: Identifier;
|
||||
Literal: Literal;
|
||||
MethodDefinition: MethodDefinition;
|
||||
ModuleDeclaration: ModuleDeclaration;
|
||||
ModuleSpecifier: ModuleSpecifier;
|
||||
Pattern: Pattern;
|
||||
PrivateIdentifier: PrivateIdentifier;
|
||||
Program: Program;
|
||||
Property: Property;
|
||||
PropertyDefinition: PropertyDefinition;
|
||||
SpreadElement: SpreadElement;
|
||||
Statement: Statement;
|
||||
Super: Super;
|
||||
SwitchCase: SwitchCase;
|
||||
TemplateElement: TemplateElement;
|
||||
VariableDeclarator: VariableDeclarator;
|
||||
}
|
||||
|
||||
export type Node = NodeMap[keyof NodeMap];
|
||||
|
||||
export interface Comment extends BaseNodeWithoutComments {
|
||||
type: "Line" | "Block";
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface SourceLocation {
|
||||
source?: string | null | undefined;
|
||||
start: Position;
|
||||
end: Position;
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
/** >= 1 */
|
||||
line: number;
|
||||
/** >= 0 */
|
||||
column: number;
|
||||
}
|
||||
|
||||
export interface Program extends BaseNode {
|
||||
type: "Program";
|
||||
sourceType: "script" | "module";
|
||||
body: Array<Directive | Statement | ModuleDeclaration>;
|
||||
comments?: Comment[] | undefined;
|
||||
}
|
||||
|
||||
export interface Directive extends BaseNode {
|
||||
type: "ExpressionStatement";
|
||||
expression: Literal;
|
||||
directive: string;
|
||||
}
|
||||
|
||||
export interface BaseFunction extends BaseNode {
|
||||
params: Pattern[];
|
||||
generator?: boolean | undefined;
|
||||
async?: boolean | undefined;
|
||||
// The body is either BlockStatement or Expression because arrow functions
|
||||
// can have a body that's either. FunctionDeclarations and
|
||||
// FunctionExpressions have only BlockStatement bodies.
|
||||
body: BlockStatement | Expression;
|
||||
}
|
||||
|
||||
export type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
|
||||
|
||||
export type Statement =
|
||||
| ExpressionStatement
|
||||
| BlockStatement
|
||||
| StaticBlock
|
||||
| EmptyStatement
|
||||
| DebuggerStatement
|
||||
| WithStatement
|
||||
| ReturnStatement
|
||||
| LabeledStatement
|
||||
| BreakStatement
|
||||
| ContinueStatement
|
||||
| IfStatement
|
||||
| SwitchStatement
|
||||
| ThrowStatement
|
||||
| TryStatement
|
||||
| WhileStatement
|
||||
| DoWhileStatement
|
||||
| ForStatement
|
||||
| ForInStatement
|
||||
| ForOfStatement
|
||||
| Declaration;
|
||||
|
||||
export interface BaseStatement extends BaseNode {}
|
||||
|
||||
export interface EmptyStatement extends BaseStatement {
|
||||
type: "EmptyStatement";
|
||||
}
|
||||
|
||||
export interface BlockStatement extends BaseStatement {
|
||||
type: "BlockStatement";
|
||||
body: Statement[];
|
||||
innerComments?: Comment[] | undefined;
|
||||
}
|
||||
|
||||
export interface StaticBlock extends Omit<BlockStatement, "type"> {
|
||||
type: "StaticBlock";
|
||||
}
|
||||
|
||||
export interface ExpressionStatement extends BaseStatement {
|
||||
type: "ExpressionStatement";
|
||||
expression: Expression;
|
||||
}
|
||||
|
||||
export interface IfStatement extends BaseStatement {
|
||||
type: "IfStatement";
|
||||
test: Expression;
|
||||
consequent: Statement;
|
||||
alternate?: Statement | null | undefined;
|
||||
}
|
||||
|
||||
export interface LabeledStatement extends BaseStatement {
|
||||
type: "LabeledStatement";
|
||||
label: Identifier;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface BreakStatement extends BaseStatement {
|
||||
type: "BreakStatement";
|
||||
label?: Identifier | null | undefined;
|
||||
}
|
||||
|
||||
export interface ContinueStatement extends BaseStatement {
|
||||
type: "ContinueStatement";
|
||||
label?: Identifier | null | undefined;
|
||||
}
|
||||
|
||||
export interface WithStatement extends BaseStatement {
|
||||
type: "WithStatement";
|
||||
object: Expression;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface SwitchStatement extends BaseStatement {
|
||||
type: "SwitchStatement";
|
||||
discriminant: Expression;
|
||||
cases: SwitchCase[];
|
||||
}
|
||||
|
||||
export interface ReturnStatement extends BaseStatement {
|
||||
type: "ReturnStatement";
|
||||
argument?: Expression | null | undefined;
|
||||
}
|
||||
|
||||
export interface ThrowStatement extends BaseStatement {
|
||||
type: "ThrowStatement";
|
||||
argument: Expression;
|
||||
}
|
||||
|
||||
export interface TryStatement extends BaseStatement {
|
||||
type: "TryStatement";
|
||||
block: BlockStatement;
|
||||
handler?: CatchClause | null | undefined;
|
||||
finalizer?: BlockStatement | null | undefined;
|
||||
}
|
||||
|
||||
export interface WhileStatement extends BaseStatement {
|
||||
type: "WhileStatement";
|
||||
test: Expression;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface DoWhileStatement extends BaseStatement {
|
||||
type: "DoWhileStatement";
|
||||
body: Statement;
|
||||
test: Expression;
|
||||
}
|
||||
|
||||
export interface ForStatement extends BaseStatement {
|
||||
type: "ForStatement";
|
||||
init?: VariableDeclaration | Expression | null | undefined;
|
||||
test?: Expression | null | undefined;
|
||||
update?: Expression | null | undefined;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface BaseForXStatement extends BaseStatement {
|
||||
left: VariableDeclaration | Pattern;
|
||||
right: Expression;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface ForInStatement extends BaseForXStatement {
|
||||
type: "ForInStatement";
|
||||
}
|
||||
|
||||
export interface DebuggerStatement extends BaseStatement {
|
||||
type: "DebuggerStatement";
|
||||
}
|
||||
|
||||
export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
||||
|
||||
export interface BaseDeclaration extends BaseStatement {}
|
||||
|
||||
export interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration {
|
||||
type: "FunctionDeclaration";
|
||||
/** It is null when a function declaration is a part of the `export default function` statement */
|
||||
id: Identifier | null;
|
||||
body: BlockStatement;
|
||||
}
|
||||
|
||||
export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
|
||||
id: Identifier;
|
||||
}
|
||||
|
||||
export interface VariableDeclaration extends BaseDeclaration {
|
||||
type: "VariableDeclaration";
|
||||
declarations: VariableDeclarator[];
|
||||
kind: "var" | "let" | "const";
|
||||
}
|
||||
|
||||
export interface VariableDeclarator extends BaseNode {
|
||||
type: "VariableDeclarator";
|
||||
id: Pattern;
|
||||
init?: Expression | null | undefined;
|
||||
}
|
||||
|
||||
export interface ExpressionMap {
|
||||
ArrayExpression: ArrayExpression;
|
||||
ArrowFunctionExpression: ArrowFunctionExpression;
|
||||
AssignmentExpression: AssignmentExpression;
|
||||
AwaitExpression: AwaitExpression;
|
||||
BinaryExpression: BinaryExpression;
|
||||
CallExpression: CallExpression;
|
||||
ChainExpression: ChainExpression;
|
||||
ClassExpression: ClassExpression;
|
||||
ConditionalExpression: ConditionalExpression;
|
||||
FunctionExpression: FunctionExpression;
|
||||
Identifier: Identifier;
|
||||
ImportExpression: ImportExpression;
|
||||
Literal: Literal;
|
||||
LogicalExpression: LogicalExpression;
|
||||
MemberExpression: MemberExpression;
|
||||
MetaProperty: MetaProperty;
|
||||
NewExpression: NewExpression;
|
||||
ObjectExpression: ObjectExpression;
|
||||
SequenceExpression: SequenceExpression;
|
||||
TaggedTemplateExpression: TaggedTemplateExpression;
|
||||
TemplateLiteral: TemplateLiteral;
|
||||
ThisExpression: ThisExpression;
|
||||
UnaryExpression: UnaryExpression;
|
||||
UpdateExpression: UpdateExpression;
|
||||
YieldExpression: YieldExpression;
|
||||
}
|
||||
|
||||
export type Expression = ExpressionMap[keyof ExpressionMap];
|
||||
|
||||
export interface BaseExpression extends BaseNode {}
|
||||
|
||||
export type ChainElement = SimpleCallExpression | MemberExpression;
|
||||
|
||||
export interface ChainExpression extends BaseExpression {
|
||||
type: "ChainExpression";
|
||||
expression: ChainElement;
|
||||
}
|
||||
|
||||
export interface ThisExpression extends BaseExpression {
|
||||
type: "ThisExpression";
|
||||
}
|
||||
|
||||
export interface ArrayExpression extends BaseExpression {
|
||||
type: "ArrayExpression";
|
||||
elements: Array<Expression | SpreadElement | null>;
|
||||
}
|
||||
|
||||
export interface ObjectExpression extends BaseExpression {
|
||||
type: "ObjectExpression";
|
||||
properties: Array<Property | SpreadElement>;
|
||||
}
|
||||
|
||||
export interface PrivateIdentifier extends BaseNode {
|
||||
type: "PrivateIdentifier";
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Property extends BaseNode {
|
||||
type: "Property";
|
||||
key: Expression | PrivateIdentifier;
|
||||
value: Expression | Pattern; // Could be an AssignmentProperty
|
||||
kind: "init" | "get" | "set";
|
||||
method: boolean;
|
||||
shorthand: boolean;
|
||||
computed: boolean;
|
||||
}
|
||||
|
||||
export interface PropertyDefinition extends BaseNode {
|
||||
type: "PropertyDefinition";
|
||||
key: Expression | PrivateIdentifier;
|
||||
value?: Expression | null | undefined;
|
||||
computed: boolean;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
export interface FunctionExpression extends BaseFunction, BaseExpression {
|
||||
id?: Identifier | null | undefined;
|
||||
type: "FunctionExpression";
|
||||
body: BlockStatement;
|
||||
}
|
||||
|
||||
export interface SequenceExpression extends BaseExpression {
|
||||
type: "SequenceExpression";
|
||||
expressions: Expression[];
|
||||
}
|
||||
|
||||
export interface UnaryExpression extends BaseExpression {
|
||||
type: "UnaryExpression";
|
||||
operator: UnaryOperator;
|
||||
prefix: true;
|
||||
argument: Expression;
|
||||
}
|
||||
|
||||
export interface BinaryExpression extends BaseExpression {
|
||||
type: "BinaryExpression";
|
||||
operator: BinaryOperator;
|
||||
left: Expression;
|
||||
right: Expression;
|
||||
}
|
||||
|
||||
export interface AssignmentExpression extends BaseExpression {
|
||||
type: "AssignmentExpression";
|
||||
operator: AssignmentOperator;
|
||||
left: Pattern | MemberExpression;
|
||||
right: Expression;
|
||||
}
|
||||
|
||||
export interface UpdateExpression extends BaseExpression {
|
||||
type: "UpdateExpression";
|
||||
operator: UpdateOperator;
|
||||
argument: Expression;
|
||||
prefix: boolean;
|
||||
}
|
||||
|
||||
export interface LogicalExpression extends BaseExpression {
|
||||
type: "LogicalExpression";
|
||||
operator: LogicalOperator;
|
||||
left: Expression;
|
||||
right: Expression;
|
||||
}
|
||||
|
||||
export interface ConditionalExpression extends BaseExpression {
|
||||
type: "ConditionalExpression";
|
||||
test: Expression;
|
||||
alternate: Expression;
|
||||
consequent: Expression;
|
||||
}
|
||||
|
||||
export interface BaseCallExpression extends BaseExpression {
|
||||
callee: Expression | Super;
|
||||
arguments: Array<Expression | SpreadElement>;
|
||||
}
|
||||
export type CallExpression = SimpleCallExpression | NewExpression;
|
||||
|
||||
export interface SimpleCallExpression extends BaseCallExpression {
|
||||
type: "CallExpression";
|
||||
optional: boolean;
|
||||
}
|
||||
|
||||
export interface NewExpression extends BaseCallExpression {
|
||||
type: "NewExpression";
|
||||
}
|
||||
|
||||
export interface MemberExpression extends BaseExpression, BasePattern {
|
||||
type: "MemberExpression";
|
||||
object: Expression | Super;
|
||||
property: Expression | PrivateIdentifier;
|
||||
computed: boolean;
|
||||
optional: boolean;
|
||||
}
|
||||
|
||||
export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
|
||||
|
||||
export interface BasePattern extends BaseNode {}
|
||||
|
||||
export interface SwitchCase extends BaseNode {
|
||||
type: "SwitchCase";
|
||||
test?: Expression | null | undefined;
|
||||
consequent: Statement[];
|
||||
}
|
||||
|
||||
export interface CatchClause extends BaseNode {
|
||||
type: "CatchClause";
|
||||
param: Pattern | null;
|
||||
body: BlockStatement;
|
||||
}
|
||||
|
||||
export interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
||||
type: "Identifier";
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral;
|
||||
|
||||
export interface SimpleLiteral extends BaseNode, BaseExpression {
|
||||
type: "Literal";
|
||||
value: string | boolean | number | null;
|
||||
raw?: string | undefined;
|
||||
}
|
||||
|
||||
export interface RegExpLiteral extends BaseNode, BaseExpression {
|
||||
type: "Literal";
|
||||
value?: RegExp | null | undefined;
|
||||
regex: {
|
||||
pattern: string;
|
||||
flags: string;
|
||||
};
|
||||
raw?: string | undefined;
|
||||
}
|
||||
|
||||
export interface BigIntLiteral extends BaseNode, BaseExpression {
|
||||
type: "Literal";
|
||||
value?: bigint | null | undefined;
|
||||
bigint: string;
|
||||
raw?: string | undefined;
|
||||
}
|
||||
|
||||
export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
||||
|
||||
export type BinaryOperator =
|
||||
| "=="
|
||||
| "!="
|
||||
| "==="
|
||||
| "!=="
|
||||
| "<"
|
||||
| "<="
|
||||
| ">"
|
||||
| ">="
|
||||
| "<<"
|
||||
| ">>"
|
||||
| ">>>"
|
||||
| "+"
|
||||
| "-"
|
||||
| "*"
|
||||
| "/"
|
||||
| "%"
|
||||
| "**"
|
||||
| "|"
|
||||
| "^"
|
||||
| "&"
|
||||
| "in"
|
||||
| "instanceof";
|
||||
|
||||
export type LogicalOperator = "||" | "&&" | "??";
|
||||
|
||||
export type AssignmentOperator =
|
||||
| "="
|
||||
| "+="
|
||||
| "-="
|
||||
| "*="
|
||||
| "/="
|
||||
| "%="
|
||||
| "**="
|
||||
| "<<="
|
||||
| ">>="
|
||||
| ">>>="
|
||||
| "|="
|
||||
| "^="
|
||||
| "&="
|
||||
| "||="
|
||||
| "&&="
|
||||
| "??=";
|
||||
|
||||
export type UpdateOperator = "++" | "--";
|
||||
|
||||
export interface ForOfStatement extends BaseForXStatement {
|
||||
type: "ForOfStatement";
|
||||
await: boolean;
|
||||
}
|
||||
|
||||
export interface Super extends BaseNode {
|
||||
type: "Super";
|
||||
}
|
||||
|
||||
export interface SpreadElement extends BaseNode {
|
||||
type: "SpreadElement";
|
||||
argument: Expression;
|
||||
}
|
||||
|
||||
export interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
||||
type: "ArrowFunctionExpression";
|
||||
expression: boolean;
|
||||
body: BlockStatement | Expression;
|
||||
}
|
||||
|
||||
export interface YieldExpression extends BaseExpression {
|
||||
type: "YieldExpression";
|
||||
argument?: Expression | null | undefined;
|
||||
delegate: boolean;
|
||||
}
|
||||
|
||||
export interface TemplateLiteral extends BaseExpression {
|
||||
type: "TemplateLiteral";
|
||||
quasis: TemplateElement[];
|
||||
expressions: Expression[];
|
||||
}
|
||||
|
||||
export interface TaggedTemplateExpression extends BaseExpression {
|
||||
type: "TaggedTemplateExpression";
|
||||
tag: Expression;
|
||||
quasi: TemplateLiteral;
|
||||
}
|
||||
|
||||
export interface TemplateElement extends BaseNode {
|
||||
type: "TemplateElement";
|
||||
tail: boolean;
|
||||
value: {
|
||||
/** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */
|
||||
cooked?: string | null | undefined;
|
||||
raw: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface AssignmentProperty extends Property {
|
||||
value: Pattern;
|
||||
kind: "init";
|
||||
method: boolean; // false
|
||||
}
|
||||
|
||||
export interface ObjectPattern extends BasePattern {
|
||||
type: "ObjectPattern";
|
||||
properties: Array<AssignmentProperty | RestElement>;
|
||||
}
|
||||
|
||||
export interface ArrayPattern extends BasePattern {
|
||||
type: "ArrayPattern";
|
||||
elements: Array<Pattern | null>;
|
||||
}
|
||||
|
||||
export interface RestElement extends BasePattern {
|
||||
type: "RestElement";
|
||||
argument: Pattern;
|
||||
}
|
||||
|
||||
export interface AssignmentPattern extends BasePattern {
|
||||
type: "AssignmentPattern";
|
||||
left: Pattern;
|
||||
right: Expression;
|
||||
}
|
||||
|
||||
export type Class = ClassDeclaration | ClassExpression;
|
||||
export interface BaseClass extends BaseNode {
|
||||
superClass?: Expression | null | undefined;
|
||||
body: ClassBody;
|
||||
}
|
||||
|
||||
export interface ClassBody extends BaseNode {
|
||||
type: "ClassBody";
|
||||
body: Array<MethodDefinition | PropertyDefinition | StaticBlock>;
|
||||
}
|
||||
|
||||
export interface MethodDefinition extends BaseNode {
|
||||
type: "MethodDefinition";
|
||||
key: Expression | PrivateIdentifier;
|
||||
value: FunctionExpression;
|
||||
kind: "constructor" | "method" | "get" | "set";
|
||||
computed: boolean;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
export interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration {
|
||||
type: "ClassDeclaration";
|
||||
/** It is null when a class declaration is a part of the `export default class` statement */
|
||||
id: Identifier | null;
|
||||
}
|
||||
|
||||
export interface ClassDeclaration extends MaybeNamedClassDeclaration {
|
||||
id: Identifier;
|
||||
}
|
||||
|
||||
export interface ClassExpression extends BaseClass, BaseExpression {
|
||||
type: "ClassExpression";
|
||||
id?: Identifier | null | undefined;
|
||||
}
|
||||
|
||||
export interface MetaProperty extends BaseExpression {
|
||||
type: "MetaProperty";
|
||||
meta: Identifier;
|
||||
property: Identifier;
|
||||
}
|
||||
|
||||
export type ModuleDeclaration =
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportDefaultDeclaration
|
||||
| ExportAllDeclaration;
|
||||
export interface BaseModuleDeclaration extends BaseNode {}
|
||||
|
||||
export type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier;
|
||||
export interface BaseModuleSpecifier extends BaseNode {
|
||||
local: Identifier;
|
||||
}
|
||||
|
||||
export interface ImportDeclaration extends BaseModuleDeclaration {
|
||||
type: "ImportDeclaration";
|
||||
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
|
||||
source: Literal;
|
||||
}
|
||||
|
||||
export interface ImportSpecifier extends BaseModuleSpecifier {
|
||||
type: "ImportSpecifier";
|
||||
imported: Identifier;
|
||||
}
|
||||
|
||||
export interface ImportExpression extends BaseExpression {
|
||||
type: "ImportExpression";
|
||||
source: Expression;
|
||||
}
|
||||
|
||||
export interface ImportDefaultSpecifier extends BaseModuleSpecifier {
|
||||
type: "ImportDefaultSpecifier";
|
||||
}
|
||||
|
||||
export interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
|
||||
type: "ImportNamespaceSpecifier";
|
||||
}
|
||||
|
||||
export interface ExportNamedDeclaration extends BaseModuleDeclaration {
|
||||
type: "ExportNamedDeclaration";
|
||||
declaration?: Declaration | null | undefined;
|
||||
specifiers: ExportSpecifier[];
|
||||
source?: Literal | null | undefined;
|
||||
}
|
||||
|
||||
export interface ExportSpecifier extends BaseModuleSpecifier {
|
||||
type: "ExportSpecifier";
|
||||
exported: Identifier;
|
||||
}
|
||||
|
||||
export interface ExportDefaultDeclaration extends BaseModuleDeclaration {
|
||||
type: "ExportDefaultDeclaration";
|
||||
declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression;
|
||||
}
|
||||
|
||||
export interface ExportAllDeclaration extends BaseModuleDeclaration {
|
||||
type: "ExportAllDeclaration";
|
||||
exported: Identifier | null;
|
||||
source: Literal;
|
||||
}
|
||||
|
||||
export interface AwaitExpression extends BaseExpression {
|
||||
type: "AwaitExpression";
|
||||
argument: Expression;
|
||||
}
|
26
site/real_game/node_modules/@types/estree/package.json
generated
vendored
Normal file
26
site/real_game/node_modules/@types/estree/package.json
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "@types/estree",
|
||||
"version": "1.0.5",
|
||||
"description": "TypeScript definitions for estree",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "RReverser",
|
||||
"githubUsername": "RReverser",
|
||||
"url": "https://github.com/RReverser"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/estree"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "6f0eeaffe488ce594e73f8df619c677d752a279b51edbc744e4aebb20db4b3a7",
|
||||
"typeScriptVersion": "4.5",
|
||||
"nonNpm": true
|
||||
}
|
21
site/real_game/node_modules/esbuild/LICENSE.md
generated
vendored
Normal file
21
site/real_game/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
site/real_game/node_modules/esbuild/README.md
generated
vendored
Normal file
3
site/real_game/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
site/real_game/node_modules/esbuild/bin/esbuild
generated
vendored
Executable file
BIN
site/real_game/node_modules/esbuild/bin/esbuild
generated
vendored
Executable file
Binary file not shown.
285
site/real_game/node_modules/esbuild/install.js
generated
vendored
Normal file
285
site/real_game/node_modules/esbuild/install.js
generated
vendored
Normal file
@ -0,0 +1,285 @@
|
||||
"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(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
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 isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
|
||||
var knownWindowsPackages = {
|
||||
"win32 arm64 LE": "@esbuild/win32-arm64",
|
||||
"win32 ia32 LE": "@esbuild/win32-ia32",
|
||||
"win32 x64 LE": "@esbuild/win32-x64"
|
||||
};
|
||||
var knownUnixlikePackages = {
|
||||
"aix ppc64 BE": "@esbuild/aix-ppc64",
|
||||
"android arm64 LE": "@esbuild/android-arm64",
|
||||
"darwin arm64 LE": "@esbuild/darwin-arm64",
|
||||
"darwin x64 LE": "@esbuild/darwin-x64",
|
||||
"freebsd arm64 LE": "@esbuild/freebsd-arm64",
|
||||
"freebsd x64 LE": "@esbuild/freebsd-x64",
|
||||
"linux arm LE": "@esbuild/linux-arm",
|
||||
"linux arm64 LE": "@esbuild/linux-arm64",
|
||||
"linux ia32 LE": "@esbuild/linux-ia32",
|
||||
"linux mips64el LE": "@esbuild/linux-mips64el",
|
||||
"linux ppc64 LE": "@esbuild/linux-ppc64",
|
||||
"linux riscv64 LE": "@esbuild/linux-riscv64",
|
||||
"linux s390x BE": "@esbuild/linux-s390x",
|
||||
"linux x64 LE": "@esbuild/linux-x64",
|
||||
"linux loong64 LE": "@esbuild/linux-loong64",
|
||||
"netbsd x64 LE": "@esbuild/netbsd-x64",
|
||||
"openbsd x64 LE": "@esbuild/openbsd-x64",
|
||||
"sunos x64 LE": "@esbuild/sunos-x64"
|
||||
};
|
||||
var knownWebAssemblyFallbackPackages = {
|
||||
"android arm LE": "@esbuild/android-arm",
|
||||
"android x64 LE": "@esbuild/android-x64"
|
||||
};
|
||||
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.replace("/", "-")}-${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 versionFromPackageJSON = require(path2.join(__dirname, "package.json")).version;
|
||||
var toPath = path2.join(__dirname, "bin", "esbuild");
|
||||
var isToPathJS = true;
|
||||
function validateBinaryVersion(...command) {
|
||||
command.push("--version");
|
||||
let stdout;
|
||||
try {
|
||||
stdout = child_process.execFileSync(command.shift(), command, {
|
||||
// Without this, this install script strangely crashes with the error
|
||||
// "EACCES: permission denied, write" but only on Ubuntu Linux when node is
|
||||
// installed from the Snap Store. This is not a problem when you download
|
||||
// the official version of node. The problem appears to be that stderr
|
||||
// (i.e. file descriptor 2) isn't writable?
|
||||
//
|
||||
// More info:
|
||||
// - https://snapcraft.io/ (what the Snap Store is)
|
||||
// - https://nodejs.org/dist/ (download the official version of node)
|
||||
// - https://github.com/evanw/esbuild/issues/1711#issuecomment-1027554035
|
||||
//
|
||||
stdio: "pipe"
|
||||
}).toString().trim();
|
||||
} catch (err) {
|
||||
if (os2.platform() === "darwin" && /_SecTrustEvaluateWithError/.test(err + "")) {
|
||||
let os3 = "this version of macOS";
|
||||
try {
|
||||
os3 = "macOS " + child_process.execFileSync("sw_vers", ["-productVersion"]).toString().trim();
|
||||
} catch {
|
||||
}
|
||||
throw new Error(`The "esbuild" package cannot be installed because ${os3} is too outdated.
|
||||
|
||||
The Go compiler (which esbuild relies on) no longer supports ${os3},
|
||||
which means the "esbuild" binary executable can't be run. You can either:
|
||||
|
||||
* Update your version of macOS to one that the Go compiler supports
|
||||
* Use the "esbuild-wasm" package instead of the "esbuild" package
|
||||
* Build esbuild yourself using an older version of the Go compiler
|
||||
`);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
if (stdout !== versionFromPackageJSON) {
|
||||
throw new Error(`Expected ${JSON.stringify(versionFromPackageJSON)} 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}@${versionFromPackageJSON}`,
|
||||
{ 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.replace("@esbuild/", "")}-${versionFromPackageJSON}.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 (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
|
||||
if (!fs2.existsSync(ESBUILD_BINARY_PATH)) {
|
||||
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
|
||||
} else {
|
||||
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(process.execPath, toPath);
|
||||
} else {
|
||||
validateBinaryVersion(toPath);
|
||||
}
|
||||
});
|
705
site/real_game/node_modules/esbuild/lib/main.d.ts
generated
vendored
Normal file
705
site/real_game/node_modules/esbuild/lib/main.d.ts
generated
vendored
Normal file
@ -0,0 +1,705 @@
|
||||
export type Platform = 'browser' | 'node' | 'neutral'
|
||||
export type Format = 'iife' | 'cjs' | 'esm'
|
||||
export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx'
|
||||
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/#drop-labels */
|
||||
dropLabels?: string[]
|
||||
/** 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/#line-limit */
|
||||
lineLimit?: number
|
||||
/** 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/#jsx-side-effects */
|
||||
jsxSideEffects?: 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>
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#tsconfig-raw */
|
||||
tsconfigRaw?: string | TsconfigRaw
|
||||
}
|
||||
|
||||
export interface TsconfigRaw {
|
||||
compilerOptions?: {
|
||||
alwaysStrict?: boolean
|
||||
baseUrl?: string
|
||||
experimentalDecorators?: boolean
|
||||
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error'
|
||||
jsx?: 'preserve' | 'react-native' | 'react' | 'react-jsx' | 'react-jsxdev'
|
||||
jsxFactory?: string
|
||||
jsxFragmentFactory?: string
|
||||
jsxImportSource?: string
|
||||
paths?: Record<string, string[]>
|
||||
preserveValueImports?: boolean
|
||||
strict?: boolean
|
||||
target?: string
|
||||
useDefineForClassFields?: boolean
|
||||
verbatimModuleSyntax?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
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/#packages */
|
||||
packages?: 'external'
|
||||
/** Documentation: https://esbuild.github.io/api/#alias */
|
||||
alias?: Record<string, 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/#entry-points */
|
||||
entryPoints?: string[] | Record<string, string> | { in: string, out: 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
|
||||
}
|
||||
|
||||
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
|
||||
contents: Uint8Array
|
||||
hash: string
|
||||
/** "contents" as text (changes automatically with "contents") */
|
||||
readonly text: string
|
||||
}
|
||||
|
||||
export interface BuildResult<ProvidedOptions extends BuildOptions = BuildOptions> {
|
||||
errors: Message[]
|
||||
warnings: Message[]
|
||||
/** Only when "write: false" */
|
||||
outputFiles: OutputFile[] | (ProvidedOptions['write'] extends false ? never : undefined)
|
||||
/** Only when "metafile: true" */
|
||||
metafile: Metafile | (ProvidedOptions['metafile'] extends true ? never : undefined)
|
||||
/** Only when "mangleCache" is present */
|
||||
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
||||
}
|
||||
|
||||
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
|
||||
keyfile?: string
|
||||
certfile?: string
|
||||
fallback?: 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
|
||||
}
|
||||
|
||||
export interface TransformOptions extends CommonOptions {
|
||||
/** Documentation: https://esbuild.github.io/api/#sourcefile */
|
||||
sourcefile?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#loader */
|
||||
loader?: Loader
|
||||
/** Documentation: https://esbuild.github.io/api/#banner */
|
||||
banner?: string
|
||||
/** Documentation: https://esbuild.github.io/api/#footer */
|
||||
footer?: string
|
||||
}
|
||||
|
||||
export interface TransformResult<ProvidedOptions extends TransformOptions = TransformOptions> {
|
||||
code: string
|
||||
map: string
|
||||
warnings: Message[]
|
||||
/** Only when "mangleCache" is present */
|
||||
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
||||
/** Only when "legalComments" is "external" */
|
||||
legalComments: string | (ProvidedOptions['legalComments'] extends 'external' ? never : undefined)
|
||||
}
|
||||
|
||||
export interface TransformFailure extends Error {
|
||||
errors: Message[]
|
||||
warnings: Message[]
|
||||
}
|
||||
|
||||
export interface Plugin {
|
||||
name: string
|
||||
setup: (build: PluginBuild) => (void | Promise<void>)
|
||||
}
|
||||
|
||||
export interface PluginBuild {
|
||||
/** Documentation: https://esbuild.github.io/plugins/#build-options */
|
||||
initialOptions: BuildOptions
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#resolve */
|
||||
resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-start */
|
||||
onStart(callback: () =>
|
||||
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-end */
|
||||
onEnd(callback: (result: BuildResult) =>
|
||||
(OnEndResult | null | void | Promise<OnEndResult | null | void>)): void
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-resolve */
|
||||
onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
|
||||
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-load */
|
||||
onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
|
||||
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-dispose */
|
||||
onDispose(callback: () => void): void
|
||||
|
||||
// This is a full copy of the esbuild library in case you need it
|
||||
esbuild: {
|
||||
context: typeof context,
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#resolve-options */
|
||||
export interface ResolveOptions {
|
||||
pluginName?: string
|
||||
importer?: string
|
||||
namespace?: string
|
||||
resolveDir?: string
|
||||
kind?: ImportKind
|
||||
pluginData?: any
|
||||
with?: Record<string, string>
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#resolve-results */
|
||||
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 OnEndResult {
|
||||
errors?: PartialMessage[]
|
||||
warnings?: PartialMessage[]
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-options */
|
||||
export interface OnResolveOptions {
|
||||
filter: RegExp
|
||||
namespace?: string
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-arguments */
|
||||
export interface OnResolveArgs {
|
||||
path: string
|
||||
importer: string
|
||||
namespace: string
|
||||
resolveDir: string
|
||||
kind: ImportKind
|
||||
pluginData: any
|
||||
with: Record<string, string>
|
||||
}
|
||||
|
||||
export type ImportKind =
|
||||
| 'entry-point'
|
||||
|
||||
// JS
|
||||
| 'import-statement'
|
||||
| 'require-call'
|
||||
| 'dynamic-import'
|
||||
| 'require-resolve'
|
||||
|
||||
// CSS
|
||||
| 'import-rule'
|
||||
| 'composes-from'
|
||||
| 'url-token'
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */
|
||||
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[]
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-load-options */
|
||||
export interface OnLoadOptions {
|
||||
filter: RegExp
|
||||
namespace?: string
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-load-arguments */
|
||||
export interface OnLoadArgs {
|
||||
path: string
|
||||
namespace: string
|
||||
suffix: string
|
||||
pluginData: any
|
||||
with: Record<string, string>
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/plugins/#on-load-results */
|
||||
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
|
||||
}
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#metafile */
|
||||
export interface Metafile {
|
||||
inputs: {
|
||||
[path: string]: {
|
||||
bytes: number
|
||||
imports: {
|
||||
path: string
|
||||
kind: ImportKind
|
||||
external?: boolean
|
||||
original?: string
|
||||
with?: Record<string, string>
|
||||
}[]
|
||||
format?: 'cjs' | 'esm'
|
||||
with?: Record<string, string>
|
||||
}
|
||||
}
|
||||
outputs: {
|
||||
[path: string]: {
|
||||
bytes: number
|
||||
inputs: {
|
||||
[path: string]: {
|
||||
bytesInOutput: number
|
||||
}
|
||||
}
|
||||
imports: {
|
||||
path: string
|
||||
kind: ImportKind | 'file-loader'
|
||||
external?: boolean
|
||||
}[]
|
||||
exports: string[]
|
||||
entryPoint?: string
|
||||
cssBundle?: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface FormatMessagesOptions {
|
||||
kind: 'error' | 'warning'
|
||||
color?: boolean
|
||||
terminalWidth?: number
|
||||
}
|
||||
|
||||
export interface AnalyzeMetafileOptions {
|
||||
color?: boolean
|
||||
verbose?: boolean
|
||||
}
|
||||
|
||||
export interface WatchOptions {
|
||||
}
|
||||
|
||||
export interface BuildContext<ProvidedOptions extends BuildOptions = BuildOptions> {
|
||||
/** Documentation: https://esbuild.github.io/api/#rebuild */
|
||||
rebuild(): Promise<BuildResult<ProvidedOptions>>
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#watch */
|
||||
watch(options?: WatchOptions): Promise<void>
|
||||
|
||||
/** Documentation: https://esbuild.github.io/api/#serve */
|
||||
serve(options?: ServeOptions): Promise<ServeResult>
|
||||
|
||||
cancel(): Promise<void>
|
||||
dispose(): Promise<void>
|
||||
}
|
||||
|
||||
// This is a TypeScript type-level function which replaces any keys in "In"
|
||||
// that aren't in "Out" with "never". We use this to reject properties with
|
||||
// typos in object literals. See: https://stackoverflow.com/questions/49580725
|
||||
type SameShape<Out, In extends Out> = In & { [Key in Exclude<keyof In, keyof Out>]: never }
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export declare function build<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildResult<T>>
|
||||
|
||||
/**
|
||||
* This is the advanced long-running form of "build" that supports additional
|
||||
* features such as watch mode and a local development server.
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#build
|
||||
*/
|
||||
export declare function context<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildContext<T>>
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export declare function transform<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): Promise<TransformResult<T>>
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export declare function buildSync<T extends BuildOptions>(options: SameShape<BuildOptions, T>): BuildResult<T>
|
||||
|
||||
/**
|
||||
* A synchronous version of "transform".
|
||||
*
|
||||
* - Works in node: yes
|
||||
* - Works in browser: no
|
||||
*
|
||||
* Documentation: https://esbuild.github.io/api/#transform
|
||||
*/
|
||||
export declare function transformSync<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): TransformResult<T>
|
||||
|
||||
/**
|
||||
* 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/#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 | URL
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
// Call this function to terminate esbuild's child process. The child process
|
||||
// is not terminated and re-created after each API call because it's more
|
||||
// efficient to keep it around when there are multiple API calls.
|
||||
//
|
||||
// In node this happens automatically before the parent node process exits. So
|
||||
// you only need to call this if you know you will not make any more esbuild
|
||||
// API calls and you want to clean up resources.
|
||||
//
|
||||
// Unlike node, Deno lacks the necessary APIs to clean up child processes
|
||||
// automatically. You must manually call stop() in Deno when you're done
|
||||
// using esbuild or Deno will continue running forever.
|
||||
//
|
||||
// Another reason you might want to call this is if you are using esbuild from
|
||||
// within a Deno test. Deno fails tests that create a child process without
|
||||
// killing it before the test ends, so you have to call this function (and
|
||||
// await the returned promise) in every Deno test that uses esbuild.
|
||||
export declare function stop(): Promise<void>
|
||||
|
||||
// Note: These declarations exist to avoid type errors when you omit "dom" from
|
||||
// "lib" in your "tsconfig.json" file. TypeScript confusingly declares the
|
||||
// global "WebAssembly" type in "lib.dom.d.ts" even though it has nothing to do
|
||||
// with the browser DOM and is present in many non-browser JavaScript runtimes
|
||||
// (e.g. node and deno). Declaring it here allows esbuild's API to be used in
|
||||
// these scenarios.
|
||||
//
|
||||
// There's an open issue about getting this problem corrected (although these
|
||||
// declarations will need to remain even if this is fixed for backward
|
||||
// compatibility with older TypeScript versions):
|
||||
//
|
||||
// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826
|
||||
//
|
||||
declare global {
|
||||
namespace WebAssembly {
|
||||
interface Module {
|
||||
}
|
||||
}
|
||||
interface URL {
|
||||
}
|
||||
}
|
2239
site/real_game/node_modules/esbuild/lib/main.js
generated
vendored
Normal file
2239
site/real_game/node_modules/esbuild/lib/main.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
46
site/real_game/node_modules/esbuild/package.json
generated
vendored
Normal file
46
site/real_game/node_modules/esbuild/package.json
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "esbuild",
|
||||
"version": "0.21.5",
|
||||
"description": "An extremely fast JavaScript and CSS bundler and minifier.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/evanw/esbuild.git"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node install.js"
|
||||
},
|
||||
"main": "lib/main.js",
|
||||
"types": "lib/main.d.ts",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.21.5",
|
||||
"@esbuild/android-arm": "0.21.5",
|
||||
"@esbuild/android-arm64": "0.21.5",
|
||||
"@esbuild/android-x64": "0.21.5",
|
||||
"@esbuild/darwin-arm64": "0.21.5",
|
||||
"@esbuild/darwin-x64": "0.21.5",
|
||||
"@esbuild/freebsd-arm64": "0.21.5",
|
||||
"@esbuild/freebsd-x64": "0.21.5",
|
||||
"@esbuild/linux-arm": "0.21.5",
|
||||
"@esbuild/linux-arm64": "0.21.5",
|
||||
"@esbuild/linux-ia32": "0.21.5",
|
||||
"@esbuild/linux-loong64": "0.21.5",
|
||||
"@esbuild/linux-mips64el": "0.21.5",
|
||||
"@esbuild/linux-ppc64": "0.21.5",
|
||||
"@esbuild/linux-riscv64": "0.21.5",
|
||||
"@esbuild/linux-s390x": "0.21.5",
|
||||
"@esbuild/linux-x64": "0.21.5",
|
||||
"@esbuild/netbsd-x64": "0.21.5",
|
||||
"@esbuild/openbsd-x64": "0.21.5",
|
||||
"@esbuild/sunos-x64": "0.21.5",
|
||||
"@esbuild/win32-arm64": "0.21.5",
|
||||
"@esbuild/win32-ia32": "0.21.5",
|
||||
"@esbuild/win32-x64": "0.21.5"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
22
site/real_game/node_modules/fsevents/LICENSE
generated
vendored
Normal file
22
site/real_game/node_modules/fsevents/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
-----------
|
||||
|
||||
Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller
|
||||
|
||||
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.
|
89
site/real_game/node_modules/fsevents/README.md
generated
vendored
Normal file
89
site/real_game/node_modules/fsevents/README.md
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
# fsevents
|
||||
|
||||
Native access to MacOS FSEvents in [Node.js](https://nodejs.org/)
|
||||
|
||||
The FSEvents API in MacOS allows applications to register for notifications of
|
||||
changes to a given directory tree. It is a very fast and lightweight alternative
|
||||
to kqueue.
|
||||
|
||||
This is a low-level library. For a cross-platform file watching module that
|
||||
uses fsevents, check out [Chokidar](https://github.com/paulmillr/chokidar).
|
||||
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
npm install fsevents
|
||||
```
|
||||
|
||||
Supports only **Node.js v8.16 and higher**.
|
||||
|
||||
```js
|
||||
const fsevents = require('fsevents');
|
||||
|
||||
// To start observation
|
||||
const stop = fsevents.watch(__dirname, (path, flags, id) => {
|
||||
const info = fsevents.getInfo(path, flags);
|
||||
});
|
||||
|
||||
// To end observation
|
||||
stop();
|
||||
```
|
||||
|
||||
> **Important note:** The API behaviour is slightly different from typical JS APIs. The `stop` function **must** be
|
||||
> retrieved and stored somewhere, even if you don't plan to stop the watcher. If you forget it, the garbage collector
|
||||
> will eventually kick in, the watcher will be unregistered, and your callbacks won't be called anymore.
|
||||
|
||||
The callback passed as the second parameter to `.watch` get's called whenever the operating system detects a
|
||||
a change in the file system. It takes three arguments:
|
||||
|
||||
###### `fsevents.watch(dirname: string, (path: string, flags: number, id: string) => void): () => Promise<undefined>`
|
||||
|
||||
* `path: string` - the item in the filesystem that have been changed
|
||||
* `flags: number` - a numeric value describing what the change was
|
||||
* `id: string` - an unique-id identifying this specific event
|
||||
|
||||
Returns closer callback which when called returns a Promise resolving when the watcher process has been shut down.
|
||||
|
||||
###### `fsevents.getInfo(path: string, flags: number, id: string): FsEventInfo`
|
||||
|
||||
The `getInfo` function takes the `path`, `flags` and `id` arguments and converts those parameters into a structure
|
||||
that is easier to digest to determine what the change was.
|
||||
|
||||
The `FsEventsInfo` has the following shape:
|
||||
|
||||
```js
|
||||
/**
|
||||
* @typedef {'created'|'modified'|'deleted'|'moved'|'root-changed'|'cloned'|'unknown'} FsEventsEvent
|
||||
* @typedef {'file'|'directory'|'symlink'} FsEventsType
|
||||
*/
|
||||
{
|
||||
"event": "created", // {FsEventsEvent}
|
||||
"path": "file.txt",
|
||||
"type": "file", // {FsEventsType}
|
||||
"changes": {
|
||||
"inode": true, // Had iNode Meta-Information changed
|
||||
"finder": false, // Had Finder Meta-Data changed
|
||||
"access": false, // Had access permissions changed
|
||||
"xattrs": false // Had xAttributes changed
|
||||
},
|
||||
"flags": 0x100000000
|
||||
}
|
||||
```
|
||||
|
||||
## Changelog
|
||||
|
||||
- v2.3 supports Apple Silicon ARM CPUs
|
||||
- v2 supports node 8.16+ and reduces package size massively
|
||||
- v1.2.8 supports node 6+
|
||||
- v1.2.7 supports node 4+
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- I'm getting `EBADPLATFORM` `Unsupported platform for fsevents` error.
|
||||
- It's fine, nothing is broken. fsevents is macos-only. Other platforms are skipped. If you want to hide this warning, report a bug to NPM bugtracker asking them to hide ebadplatform warnings by default.
|
||||
|
||||
## License
|
||||
|
||||
The MIT License Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller — see LICENSE file.
|
||||
|
||||
Visit our [GitHub page](https://github.com/fsevents/fsevents) and [NPM Page](https://npmjs.org/package/fsevents)
|
46
site/real_game/node_modules/fsevents/fsevents.d.ts
generated
vendored
Normal file
46
site/real_game/node_modules/fsevents/fsevents.d.ts
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
declare type Event = "created" | "cloned" | "modified" | "deleted" | "moved" | "root-changed" | "unknown";
|
||||
declare type Type = "file" | "directory" | "symlink";
|
||||
declare type FileChanges = {
|
||||
inode: boolean;
|
||||
finder: boolean;
|
||||
access: boolean;
|
||||
xattrs: boolean;
|
||||
};
|
||||
declare type Info = {
|
||||
event: Event;
|
||||
path: string;
|
||||
type: Type;
|
||||
changes: FileChanges;
|
||||
flags: number;
|
||||
};
|
||||
declare type WatchHandler = (path: string, flags: number, id: string) => void;
|
||||
export declare function watch(path: string, handler: WatchHandler): () => Promise<void>;
|
||||
export declare function watch(path: string, since: number, handler: WatchHandler): () => Promise<void>;
|
||||
export declare function getInfo(path: string, flags: number): Info;
|
||||
export declare const constants: {
|
||||
None: 0x00000000;
|
||||
MustScanSubDirs: 0x00000001;
|
||||
UserDropped: 0x00000002;
|
||||
KernelDropped: 0x00000004;
|
||||
EventIdsWrapped: 0x00000008;
|
||||
HistoryDone: 0x00000010;
|
||||
RootChanged: 0x00000020;
|
||||
Mount: 0x00000040;
|
||||
Unmount: 0x00000080;
|
||||
ItemCreated: 0x00000100;
|
||||
ItemRemoved: 0x00000200;
|
||||
ItemInodeMetaMod: 0x00000400;
|
||||
ItemRenamed: 0x00000800;
|
||||
ItemModified: 0x00001000;
|
||||
ItemFinderInfoMod: 0x00002000;
|
||||
ItemChangeOwner: 0x00004000;
|
||||
ItemXattrMod: 0x00008000;
|
||||
ItemIsFile: 0x00010000;
|
||||
ItemIsDir: 0x00020000;
|
||||
ItemIsSymlink: 0x00040000;
|
||||
ItemIsHardlink: 0x00100000;
|
||||
ItemIsLastHardlink: 0x00200000;
|
||||
OwnEvent: 0x00080000;
|
||||
ItemCloned: 0x00400000;
|
||||
};
|
||||
export {};
|
83
site/real_game/node_modules/fsevents/fsevents.js
generated
vendored
Normal file
83
site/real_game/node_modules/fsevents/fsevents.js
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
** © 2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller
|
||||
** Licensed under MIT License.
|
||||
*/
|
||||
|
||||
/* jshint node:true */
|
||||
"use strict";
|
||||
|
||||
if (process.platform !== "darwin") {
|
||||
throw new Error(`Module 'fsevents' is not compatible with platform '${process.platform}'`);
|
||||
}
|
||||
|
||||
const Native = require("./fsevents.node");
|
||||
const events = Native.constants;
|
||||
|
||||
function watch(path, since, handler) {
|
||||
if (typeof path !== "string") {
|
||||
throw new TypeError(`fsevents argument 1 must be a string and not a ${typeof path}`);
|
||||
}
|
||||
if ("function" === typeof since && "undefined" === typeof handler) {
|
||||
handler = since;
|
||||
since = Native.flags.SinceNow;
|
||||
}
|
||||
if (typeof since !== "number") {
|
||||
throw new TypeError(`fsevents argument 2 must be a number and not a ${typeof since}`);
|
||||
}
|
||||
if (typeof handler !== "function") {
|
||||
throw new TypeError(`fsevents argument 3 must be a function and not a ${typeof handler}`);
|
||||
}
|
||||
|
||||
let instance = Native.start(Native.global, path, since, handler);
|
||||
if (!instance) throw new Error(`could not watch: ${path}`);
|
||||
return () => {
|
||||
const result = instance ? Promise.resolve(instance).then(Native.stop) : Promise.resolve(undefined);
|
||||
instance = undefined;
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
function getInfo(path, flags) {
|
||||
return {
|
||||
path,
|
||||
flags,
|
||||
event: getEventType(flags),
|
||||
type: getFileType(flags),
|
||||
changes: getFileChanges(flags),
|
||||
};
|
||||
}
|
||||
|
||||
function getFileType(flags) {
|
||||
if (events.ItemIsFile & flags) return "file";
|
||||
if (events.ItemIsDir & flags) return "directory";
|
||||
if (events.MustScanSubDirs & flags) return "directory";
|
||||
if (events.ItemIsSymlink & flags) return "symlink";
|
||||
}
|
||||
function anyIsTrue(obj) {
|
||||
for (let key in obj) {
|
||||
if (obj[key]) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function getEventType(flags) {
|
||||
if (events.ItemRemoved & flags) return "deleted";
|
||||
if (events.ItemRenamed & flags) return "moved";
|
||||
if (events.ItemCreated & flags) return "created";
|
||||
if (events.ItemModified & flags) return "modified";
|
||||
if (events.RootChanged & flags) return "root-changed";
|
||||
if (events.ItemCloned & flags) return "cloned";
|
||||
if (anyIsTrue(flags)) return "modified";
|
||||
return "unknown";
|
||||
}
|
||||
function getFileChanges(flags) {
|
||||
return {
|
||||
inode: !!(events.ItemInodeMetaMod & flags),
|
||||
finder: !!(events.ItemFinderInfoMod & flags),
|
||||
access: !!(events.ItemChangeOwner & flags),
|
||||
xattrs: !!(events.ItemXattrMod & flags),
|
||||
};
|
||||
}
|
||||
|
||||
exports.watch = watch;
|
||||
exports.getInfo = getInfo;
|
||||
exports.constants = events;
|
BIN
site/real_game/node_modules/fsevents/fsevents.node
generated
vendored
Executable file
BIN
site/real_game/node_modules/fsevents/fsevents.node
generated
vendored
Executable file
Binary file not shown.
62
site/real_game/node_modules/fsevents/package.json
generated
vendored
Normal file
62
site/real_game/node_modules/fsevents/package.json
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"name": "fsevents",
|
||||
"version": "2.3.3",
|
||||
"description": "Native Access to MacOS FSEvents",
|
||||
"main": "fsevents.js",
|
||||
"types": "fsevents.d.ts",
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"files": [
|
||||
"fsevents.d.ts",
|
||||
"fsevents.js",
|
||||
"fsevents.node"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "node-gyp clean && rm -f fsevents.node",
|
||||
"build": "node-gyp clean && rm -f fsevents.node && node-gyp rebuild && node-gyp clean",
|
||||
"test": "/bin/bash ./test.sh 2>/dev/null",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fsevents/fsevents.git"
|
||||
},
|
||||
"keywords": [
|
||||
"fsevents",
|
||||
"mac"
|
||||
],
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Philipp Dunkel",
|
||||
"email": "pip@pipobscure.com"
|
||||
},
|
||||
{
|
||||
"name": "Ben Noordhuis",
|
||||
"email": "info@bnoordhuis.nl"
|
||||
},
|
||||
{
|
||||
"name": "Elan Shankar",
|
||||
"email": "elan.shanker@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Miroslav Bajtoš",
|
||||
"email": "mbajtoss@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Paul Miller",
|
||||
"url": "https://paulmillr.com"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/fsevents/fsevents/issues"
|
||||
},
|
||||
"homepage": "https://github.com/fsevents/fsevents",
|
||||
"devDependencies": {
|
||||
"node-gyp": "^9.4.0"
|
||||
}
|
||||
}
|
20
site/real_game/node_modules/nanoid/LICENSE
generated
vendored
Normal file
20
site/real_game/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
site/real_game/node_modules/nanoid/README.md
generated
vendored
Normal file
39
site/real_game/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 **[here](https://github.com/ai/nanoid#readme)**.
|
34
site/real_game/node_modules/nanoid/async/index.browser.cjs
generated
vendored
Normal file
34
site/real_game/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
site/real_game/node_modules/nanoid/async/index.browser.js
generated
vendored
Normal file
34
site/real_game/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
site/real_game/node_modules/nanoid/async/index.cjs
generated
vendored
Normal file
35
site/real_game/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
site/real_game/node_modules/nanoid/async/index.d.ts
generated
vendored
Normal file
56
site/real_game/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
site/real_game/node_modules/nanoid/async/index.js
generated
vendored
Normal file
35
site/real_game/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
site/real_game/node_modules/nanoid/async/index.native.js
generated
vendored
Normal file
26
site/real_game/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
site/real_game/node_modules/nanoid/async/package.json
generated
vendored
Normal file
12
site/real_game/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
site/real_game/node_modules/nanoid/bin/nanoid.cjs
generated
vendored
Executable file
55
site/real_game/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
site/real_game/node_modules/nanoid/index.browser.cjs
generated
vendored
Normal file
34
site/real_game/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
site/real_game/node_modules/nanoid/index.browser.js
generated
vendored
Normal file
34
site/real_game/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
site/real_game/node_modules/nanoid/index.cjs
generated
vendored
Normal file
45
site/real_game/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
site/real_game/node_modules/nanoid/index.d.cts
generated
vendored
Normal file
91
site/real_game/node_modules/nanoid/index.d.cts
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
|
91
site/real_game/node_modules/nanoid/index.d.ts
generated
vendored
Normal file
91
site/real_game/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
site/real_game/node_modules/nanoid/index.js
generated
vendored
Normal file
45
site/real_game/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
site/real_game/node_modules/nanoid/nanoid.js
generated
vendored
Normal file
1
site/real_game/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
site/real_game/node_modules/nanoid/non-secure/index.cjs
generated
vendored
Normal file
21
site/real_game/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
site/real_game/node_modules/nanoid/non-secure/index.d.ts
generated
vendored
Normal file
33
site/real_game/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
site/real_game/node_modules/nanoid/non-secure/index.js
generated
vendored
Normal file
21
site/real_game/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
site/real_game/node_modules/nanoid/non-secure/package.json
generated
vendored
Normal file
6
site/real_game/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"
|
||||
}
|
88
site/real_game/node_modules/nanoid/package.json
generated
vendored
Normal file
88
site/real_game/node_modules/nanoid/package.json
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
"name": "nanoid",
|
||||
"version": "3.3.7",
|
||||
"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"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"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": {
|
||||
".": {
|
||||
"browser": "./index.browser.js",
|
||||
"require": {
|
||||
"types": "./index.d.cts",
|
||||
"default": "./index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./index.d.ts",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./package.json": "./package.json",
|
||||
"./async/package.json": "./async/package.json",
|
||||
"./async": {
|
||||
"browser": "./async/index.browser.js",
|
||||
"require": {
|
||||
"types": "./index.d.cts",
|
||||
"default": "./async/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./index.d.ts",
|
||||
"default": "./async/index.js"
|
||||
},
|
||||
"default": "./async/index.js"
|
||||
},
|
||||
"./non-secure/package.json": "./non-secure/package.json",
|
||||
"./non-secure": {
|
||||
"require": {
|
||||
"types": "./index.d.cts",
|
||||
"default": "./non-secure/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./index.d.ts",
|
||||
"default": "./non-secure/index.js"
|
||||
},
|
||||
"default": "./non-secure/index.js"
|
||||
},
|
||||
"./url-alphabet/package.json": "./url-alphabet/package.json",
|
||||
"./url-alphabet": {
|
||||
"require": {
|
||||
"types": "./index.d.cts",
|
||||
"default": "./url-alphabet/index.cjs"
|
||||
},
|
||||
"import": {
|
||||
"types": "./index.d.ts",
|
||||
"default": "./url-alphabet/index.js"
|
||||
},
|
||||
"default": "./url-alphabet/index.js"
|
||||
}
|
||||
}
|
||||
}
|
3
site/real_game/node_modules/nanoid/url-alphabet/index.cjs
generated
vendored
Normal file
3
site/real_game/node_modules/nanoid/url-alphabet/index.cjs
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
let urlAlphabet =
|
||||
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
|
||||
module.exports = { urlAlphabet }
|
3
site/real_game/node_modules/nanoid/url-alphabet/index.js
generated
vendored
Normal file
3
site/real_game/node_modules/nanoid/url-alphabet/index.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
let urlAlphabet =
|
||||
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
|
||||
export { urlAlphabet }
|
6
site/real_game/node_modules/nanoid/url-alphabet/package.json
generated
vendored
Normal file
6
site/real_game/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"
|
||||
}
|
15
site/real_game/node_modules/picocolors/LICENSE
generated
vendored
Normal file
15
site/real_game/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
site/real_game/node_modules/picocolors/README.md
generated
vendored
Normal file
21
site/real_game/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
site/real_game/node_modules/picocolors/package.json
generated
vendored
Normal file
25
site/real_game/node_modules/picocolors/package.json
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "picocolors",
|
||||
"version": "1.0.1",
|
||||
"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
site/real_game/node_modules/picocolors/picocolors.browser.js
generated
vendored
Normal file
4
site/real_game/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
site/real_game/node_modules/picocolors/picocolors.d.ts
generated
vendored
Normal file
5
site/real_game/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
|
65
site/real_game/node_modules/picocolors/picocolors.js
generated
vendored
Normal file
65
site/real_game/node_modules/picocolors/picocolors.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
let argv = process.argv || [],
|
||||
env = process.env
|
||||
let isColorSupported =
|
||||
!("NO_COLOR" in env || argv.includes("--no-color")) &&
|
||||
("FORCE_COLOR" in env ||
|
||||
argv.includes("--color") ||
|
||||
process.platform === "win32" ||
|
||||
(require != null && require("tty").isatty(1) && env.TERM !== "dumb") ||
|
||||
"CI" in 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 result = ""
|
||||
let cursor = 0
|
||||
do {
|
||||
result += string.substring(cursor, index) + replace
|
||||
cursor = index + close.length
|
||||
index = string.indexOf(close, cursor)
|
||||
} while (~index)
|
||||
return result + string.substring(cursor)
|
||||
}
|
||||
|
||||
let createColors = (enabled = isColorSupported) => {
|
||||
let init = enabled ? formatter : () => String
|
||||
return {
|
||||
isColorSupported: enabled,
|
||||
reset: init("\x1b[0m", "\x1b[0m"),
|
||||
bold: init("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
||||
dim: init("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
||||
italic: init("\x1b[3m", "\x1b[23m"),
|
||||
underline: init("\x1b[4m", "\x1b[24m"),
|
||||
inverse: init("\x1b[7m", "\x1b[27m"),
|
||||
hidden: init("\x1b[8m", "\x1b[28m"),
|
||||
strikethrough: init("\x1b[9m", "\x1b[29m"),
|
||||
black: init("\x1b[30m", "\x1b[39m"),
|
||||
red: init("\x1b[31m", "\x1b[39m"),
|
||||
green: init("\x1b[32m", "\x1b[39m"),
|
||||
yellow: init("\x1b[33m", "\x1b[39m"),
|
||||
blue: init("\x1b[34m", "\x1b[39m"),
|
||||
magenta: init("\x1b[35m", "\x1b[39m"),
|
||||
cyan: init("\x1b[36m", "\x1b[39m"),
|
||||
white: init("\x1b[37m", "\x1b[39m"),
|
||||
gray: init("\x1b[90m", "\x1b[39m"),
|
||||
bgBlack: init("\x1b[40m", "\x1b[49m"),
|
||||
bgRed: init("\x1b[41m", "\x1b[49m"),
|
||||
bgGreen: init("\x1b[42m", "\x1b[49m"),
|
||||
bgYellow: init("\x1b[43m", "\x1b[49m"),
|
||||
bgBlue: init("\x1b[44m", "\x1b[49m"),
|
||||
bgMagenta: init("\x1b[45m", "\x1b[49m"),
|
||||
bgCyan: init("\x1b[46m", "\x1b[49m"),
|
||||
bgWhite: init("\x1b[47m", "\x1b[49m"),
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = createColors()
|
||||
module.exports.createColors = createColors
|
30
site/real_game/node_modules/picocolors/types.ts
generated
vendored
Normal file
30
site/real_game/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
site/real_game/node_modules/postcss/LICENSE
generated
vendored
Normal file
20
site/real_game/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.
|
28
site/real_game/node_modules/postcss/README.md
generated
vendored
Normal file
28
site/real_game/node_modules/postcss/README.md
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
# PostCSS
|
||||
|
||||
<img align="right" width="95" height="95"
|
||||
alt="Philosopher’s stone, logo of PostCSS"
|
||||
src="https://postcss.org/logo.svg">
|
||||
|
||||
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] and [Stylelint] PostCSS plugins is one of the most popular CSS tools.
|
||||
|
||||
---
|
||||
|
||||
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" /> Made at <b><a href="https://evilmartians.com/devtools?utm_source=postcss&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, product consulting for <b>developer tools</b>.
|
||||
|
||||
---
|
||||
|
||||
[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
|
||||
[Stylelint]: https://stylelint.io/
|
||||
[plugins]: https://github.com/postcss/postcss#plugins
|
||||
|
||||
|
||||
## Docs
|
||||
Read full docs **[here](https://postcss.org/)**.
|
140
site/real_game/node_modules/postcss/lib/at-rule.d.ts
generated
vendored
Normal file
140
site/real_game/node_modules/postcss/lib/at-rule.d.ts
generated
vendored
Normal file
@ -0,0 +1,140 @@
|
||||
import Container, {
|
||||
ContainerProps,
|
||||
ContainerWithChildren
|
||||
} from './container.js'
|
||||
|
||||
declare namespace AtRule {
|
||||
export interface AtRuleRaws extends Record<string, unknown> {
|
||||
/**
|
||||
* 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 space symbols before the node. It also stores `*`
|
||||
* and `_` symbols before the declaration (IE hack).
|
||||
*/
|
||||
before?: string
|
||||
|
||||
/**
|
||||
* The symbols between the last parameter and `{` for rules.
|
||||
*/
|
||||
between?: string
|
||||
|
||||
/**
|
||||
* The rule’s selector with comments.
|
||||
*/
|
||||
params?: {
|
||||
raw: string
|
||||
value: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains `true` if the last child has an (optional) semicolon.
|
||||
*/
|
||||
semicolon?: boolean
|
||||
}
|
||||
|
||||
export interface AtRuleProps extends ContainerProps {
|
||||
/** Name of the at-rule. */
|
||||
name: string
|
||||
/** Parameters following the name of the at-rule. */
|
||||
params?: number | string
|
||||
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
|
||||
raws?: AtRuleRaws
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
export { AtRule_ as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 //=> []
|
||||
* ```
|
||||
*/
|
||||
declare class AtRule_ extends Container {
|
||||
/**
|
||||
* An array containing the layer’s children.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('@layer example { a { color: black } }')
|
||||
* const layer = root.first
|
||||
* layer.nodes.length //=> 1
|
||||
* layer.nodes[0].selector //=> 'a'
|
||||
* ```
|
||||
*
|
||||
* Can be `undefinded` if the at-rule has no body.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('@layer a, b, c;')
|
||||
* const layer = root.first
|
||||
* layer.nodes //=> undefined
|
||||
* ```
|
||||
*/
|
||||
nodes: Container['nodes']
|
||||
parent: ContainerWithChildren | undefined
|
||||
|
||||
raws: AtRule.AtRuleRaws
|
||||
type: 'atrule'
|
||||
constructor(defaults?: AtRule.AtRuleProps)
|
||||
assign(overrides: AtRule.AtRuleProps | object): this
|
||||
|
||||
clone(overrides?: Partial<AtRule.AtRuleProps>): this
|
||||
|
||||
cloneAfter(overrides?: Partial<AtRule.AtRuleProps>): this
|
||||
|
||||
cloneBefore(overrides?: Partial<AtRule.AtRuleProps>): this
|
||||
/**
|
||||
* The at-rule’s name immediately follows the `@`.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('@media print {}')
|
||||
* const media = root.first
|
||||
* media.name //=> 'media'
|
||||
* ```
|
||||
*/
|
||||
get name(): string
|
||||
set name(value: 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'
|
||||
* ```
|
||||
*/
|
||||
get params(): string
|
||||
set params(value: string)
|
||||
}
|
||||
|
||||
declare class AtRule extends AtRule_ {}
|
||||
|
||||
export = AtRule
|
25
site/real_game/node_modules/postcss/lib/at-rule.js
generated
vendored
Normal file
25
site/real_game/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)
|
68
site/real_game/node_modules/postcss/lib/comment.d.ts
generated
vendored
Normal file
68
site/real_game/node_modules/postcss/lib/comment.d.ts
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
import Container from './container.js'
|
||||
import Node, { NodeProps } from './node.js'
|
||||
|
||||
declare namespace Comment {
|
||||
export 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 {
|
||||
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
|
||||
raws?: CommentRaws
|
||||
/** Content of the comment. */
|
||||
text: string
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
export { Comment_ as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* It represents a class that handles
|
||||
* [CSS comments](https://developer.mozilla.org/en-US/docs/Web/CSS/Comments)
|
||||
*
|
||||
* ```js
|
||||
* Once (root, { Comment }) {
|
||||
* const note = new Comment({ text: 'Note: …' })
|
||||
* root.append(note)
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Remember that CSS comments inside selectors, at-rule parameters,
|
||||
* or declaration values will be stored in the `raws` properties
|
||||
* explained above.
|
||||
*/
|
||||
declare class Comment_ extends Node {
|
||||
parent: Container | undefined
|
||||
raws: Comment.CommentRaws
|
||||
type: 'comment'
|
||||
constructor(defaults?: Comment.CommentProps)
|
||||
|
||||
assign(overrides: Comment.CommentProps | object): this
|
||||
|
||||
clone(overrides?: Partial<Comment.CommentProps>): this
|
||||
cloneAfter(overrides?: Partial<Comment.CommentProps>): this
|
||||
cloneBefore(overrides?: Partial<Comment.CommentProps>): this
|
||||
/**
|
||||
* The comment's text.
|
||||
*/
|
||||
get text(): string
|
||||
set text(value: string)
|
||||
}
|
||||
|
||||
declare class Comment extends Comment_ {}
|
||||
|
||||
export = Comment
|
13
site/real_game/node_modules/postcss/lib/comment.js
generated
vendored
Normal file
13
site/real_game/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
|
490
site/real_game/node_modules/postcss/lib/container.d.ts
generated
vendored
Normal file
490
site/real_game/node_modules/postcss/lib/container.d.ts
generated
vendored
Normal file
@ -0,0 +1,490 @@
|
||||
import AtRule from './at-rule.js'
|
||||
import Comment from './comment.js'
|
||||
import Declaration from './declaration.js'
|
||||
import Node, { ChildNode, ChildProps, NodeProps } from './node.js'
|
||||
import Rule from './rule.js'
|
||||
|
||||
declare namespace Container {
|
||||
export class ContainerWithChildren<
|
||||
Child extends Node = ChildNode
|
||||
> extends Container_<Child> {
|
||||
nodes: Child[]
|
||||
}
|
||||
|
||||
export interface ValueOptions {
|
||||
/**
|
||||
* String that’s used to narrow down values and speed up the regexp search.
|
||||
*/
|
||||
fast?: string
|
||||
|
||||
/**
|
||||
* An array of property names.
|
||||
*/
|
||||
props?: string[]
|
||||
}
|
||||
|
||||
export interface ContainerProps extends NodeProps {
|
||||
nodes?: (Node | ChildProps)[]
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
export { Container_ as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
declare 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[] | 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: (
|
||||
| ChildProps
|
||||
| ChildProps[]
|
||||
| Node
|
||||
| Node[]
|
||||
| string
|
||||
| string[]
|
||||
| undefined
|
||||
)[]
|
||||
): this
|
||||
|
||||
assign(overrides: Container.ContainerProps | object): this
|
||||
clone(overrides?: Partial<Container.ContainerProps>): this
|
||||
cloneAfter(overrides?: Partial<Container.ContainerProps>): this
|
||||
cloneBefore(overrides?: Partial<Container.ContainerProps>): this
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
/**
|
||||
* 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 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
|
||||
|
||||
/**
|
||||
* 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:
|
||||
| Node
|
||||
| Node[]
|
||||
| ChildProps
|
||||
| ChildProps[]
|
||||
| string
|
||||
| string[]
|
||||
| undefined
|
||||
): 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:
|
||||
| Node
|
||||
| Node[]
|
||||
| ChildProps
|
||||
| ChildProps[]
|
||||
| string
|
||||
| string[]
|
||||
| undefined
|
||||
): this
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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: (
|
||||
| ChildProps
|
||||
| ChildProps[]
|
||||
| Node
|
||||
| Node[]
|
||||
| string
|
||||
| string[]
|
||||
| undefined
|
||||
)[]
|
||||
): 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
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
replaceValues(
|
||||
pattern: RegExp | string,
|
||||
replaced: { (substring: string, ...args: any[]): string } | string
|
||||
): 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: RegExp | string,
|
||||
options: Container.ValueOptions,
|
||||
replaced: { (substring: string, ...args: any[]): string } | string
|
||||
): this
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
/**
|
||||
* 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 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: RegExp | string,
|
||||
callback: (atRule: AtRule, index: number) => false | void
|
||||
): false | undefined
|
||||
|
||||
walkAtRules(
|
||||
callback: (atRule: AtRule, index: number) => false | void
|
||||
): false | undefined
|
||||
walkComments(
|
||||
callback: (comment: Comment, indexed: number) => false | void
|
||||
): false | undefined
|
||||
|
||||
walkComments(
|
||||
callback: (comment: Comment, indexed: 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: RegExp | string,
|
||||
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: RegExp | string,
|
||||
callback: (rule: Rule, index: number) => false | void
|
||||
): false | undefined
|
||||
walkRules(
|
||||
callback: (rule: Rule, index: number) => false | void
|
||||
): false | undefined
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
|
||||
declare class Container<
|
||||
Child extends Node = ChildNode
|
||||
> extends Container_<Child> {}
|
||||
|
||||
export = Container
|
445
site/real_game/node_modules/postcss/lib/container.js
generated
vendored
Normal file
445
site/real_game/node_modules/postcss/lib/container.js
generated
vendored
Normal file
@ -0,0 +1,445 @@
|
||||
'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 markTreeDirty(node) {
|
||||
node[isClean] = false
|
||||
if (node.proxyOf.nodes) {
|
||||
for (let i of node.proxyOf.nodes) {
|
||||
markTreeDirty(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Container extends Node {
|
||||
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
|
||||
}
|
||||
|
||||
cleanRaws(keepBetween) {
|
||||
super.cleanRaws(keepBetween)
|
||||
if (this.nodes) {
|
||||
for (let node of this.nodes) node.cleanRaws(keepBetween)
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
every(condition) {
|
||||
return this.nodes.every(condition)
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
getProxyProcessor() {
|
||||
return {
|
||||
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]
|
||||
}
|
||||
},
|
||||
|
||||
set(node, prop, value) {
|
||||
if (node[prop] === value) return true
|
||||
node[prop] = value
|
||||
if (prop === 'name' || prop === 'params' || prop === 'selector') {
|
||||
node.markDirty()
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index(child) {
|
||||
if (typeof child === 'number') return child
|
||||
if (child.proxyOf) child = child.proxyOf
|
||||
return this.proxyOf.nodes.indexOf(child)
|
||||
}
|
||||
|
||||
insertAfter(exist, add) {
|
||||
let existIndex = this.index(exist)
|
||||
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse()
|
||||
existIndex = this.index(exist)
|
||||
for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node)
|
||||
|
||||
let index
|
||||
for (let id in this.indexes) {
|
||||
index = this.indexes[id]
|
||||
if (existIndex < index) {
|
||||
this.indexes[id] = index + nodes.length
|
||||
}
|
||||
}
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
insertBefore(exist, add) {
|
||||
let existIndex = this.index(exist)
|
||||
let type = existIndex === 0 ? 'prepend' : false
|
||||
let nodes = this.normalize(
|
||||
add,
|
||||
this.proxyOf.nodes[existIndex],
|
||||
type
|
||||
).reverse()
|
||||
existIndex = this.index(exist)
|
||||
for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node)
|
||||
|
||||
let index
|
||||
for (let id in this.indexes) {
|
||||
index = this.indexes[id]
|
||||
if (existIndex <= index) {
|
||||
this.indexes[id] = index + nodes.length
|
||||
}
|
||||
}
|
||||
|
||||
this.markDirty()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
normalize(nodes, sample) {
|
||||
if (typeof nodes === 'string') {
|
||||
nodes = cleanSource(parse(nodes).nodes)
|
||||
} else if (typeof nodes === 'undefined') {
|
||||
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.selectors) {
|
||||
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]) markTreeDirty(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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
push(child) {
|
||||
child.parent = this
|
||||
this.proxyOf.nodes.push(child)
|
||||
return this
|
||||
}
|
||||
|
||||
removeAll() {
|
||||
for (let node of this.proxyOf.nodes) node.parent = undefined
|
||||
this.proxyOf.nodes = []
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
some(condition) {
|
||||
return this.nodes.some(condition)
|
||||
}
|
||||
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
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]
|
||||
}
|
||||
}
|
||||
|
||||
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 */
|
248
site/real_game/node_modules/postcss/lib/css-syntax-error.d.ts
generated
vendored
Normal file
248
site/real_game/node_modules/postcss/lib/css-syntax-error.d.ts
generated
vendored
Normal file
@ -0,0 +1,248 @@
|
||||
import { FilePosition } from './input.js'
|
||||
|
||||
declare namespace CssSyntaxError {
|
||||
/**
|
||||
* A position that is part of a range.
|
||||
*/
|
||||
export interface RangePosition {
|
||||
/**
|
||||
* The column number in the input.
|
||||
*/
|
||||
column: number
|
||||
|
||||
/**
|
||||
* The line number in the input.
|
||||
*/
|
||||
line: number
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
export { CssSyntaxError_ as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
declare class CssSyntaxError_ extends Error {
|
||||
/**
|
||||
* 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 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 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
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
/**
|
||||
* 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'
|
||||
|
||||
/**
|
||||
* Plugin name, if error came from plugin.
|
||||
*
|
||||
* ```js
|
||||
* error.plugin //=> 'postcss-vars'
|
||||
* ```
|
||||
*/
|
||||
plugin?: string
|
||||
|
||||
/**
|
||||
* Error message.
|
||||
*
|
||||
* ```js
|
||||
* error.message //=> 'Unclosed block'
|
||||
* ```
|
||||
*/
|
||||
reason: string
|
||||
|
||||
/**
|
||||
* Source code of the broken file.
|
||||
*
|
||||
* ```js
|
||||
* error.source //=> 'a { b {} }'
|
||||
* error.input.source //=> 'a b { }'
|
||||
* ```
|
||||
*/
|
||||
source?: string
|
||||
|
||||
stack: string
|
||||
|
||||
/**
|
||||
* 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?: CssSyntaxError.RangePosition | number,
|
||||
columnOrEndPos?: CssSyntaxError.RangePosition | number,
|
||||
source?: string,
|
||||
file?: string,
|
||||
plugin?: 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
|
||||
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
|
||||
declare class CssSyntaxError extends CssSyntaxError_ {}
|
||||
|
||||
export = CssSyntaxError
|
100
site/real_game/node_modules/postcss/lib/css-syntax-error.js
generated
vendored
Normal file
100
site/real_game/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, gray, red } = 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
|
151
site/real_game/node_modules/postcss/lib/declaration.d.ts
generated
vendored
Normal file
151
site/real_game/node_modules/postcss/lib/declaration.d.ts
generated
vendored
Normal file
@ -0,0 +1,151 @@
|
||||
import { ContainerWithChildren } from './container.js'
|
||||
import Node from './node.js'
|
||||
|
||||
declare namespace Declaration {
|
||||
export 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?: {
|
||||
raw: string
|
||||
value: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DeclarationProps {
|
||||
/** Whether the declaration has an `!important` annotation. */
|
||||
important?: boolean
|
||||
/** Name of the declaration. */
|
||||
prop: string
|
||||
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
|
||||
raws?: DeclarationRaws
|
||||
/** Value of the declaration. */
|
||||
value: string
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
export { Declaration_ as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* It represents a class that handles
|
||||
* [CSS declarations](https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax#css_declarations)
|
||||
*
|
||||
* ```js
|
||||
* Once (root, { Declaration }) {
|
||||
* const 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'
|
||||
* ```
|
||||
*/
|
||||
declare class Declaration_ extends Node {
|
||||
parent: ContainerWithChildren | undefined
|
||||
raws: Declaration.DeclarationRaws
|
||||
|
||||
type: 'decl'
|
||||
|
||||
constructor(defaults?: Declaration.DeclarationProps)
|
||||
assign(overrides: Declaration.DeclarationProps | object): this
|
||||
|
||||
clone(overrides?: Partial<Declaration.DeclarationProps>): this
|
||||
|
||||
cloneAfter(overrides?: Partial<Declaration.DeclarationProps>): this
|
||||
|
||||
cloneBefore(overrides?: Partial<Declaration.DeclarationProps>): this
|
||||
/**
|
||||
* It represents a specificity of the declaration.
|
||||
*
|
||||
* If true, the CSS declaration will have an
|
||||
* [important](https://developer.mozilla.org/en-US/docs/Web/CSS/important)
|
||||
* specifier.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('a { color: black !important; color: red }')
|
||||
*
|
||||
* root.first.first.important //=> true
|
||||
* root.first.last.important //=> undefined
|
||||
* ```
|
||||
*/
|
||||
get important(): boolean
|
||||
|
||||
set important(value: boolean)
|
||||
/**
|
||||
* The property name for a CSS declaration.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('a { color: black }')
|
||||
* const decl = root.first.first
|
||||
*
|
||||
* decl.prop //=> 'color'
|
||||
* ```
|
||||
*/
|
||||
get prop(): string
|
||||
|
||||
set prop(value: string)
|
||||
/**
|
||||
* The property value for a CSS declaration.
|
||||
*
|
||||
* Any CSS comments inside the value string will be filtered out.
|
||||
* CSS comments present in the source value will be available in
|
||||
* the `raws` property.
|
||||
*
|
||||
* Assigning new `value` would ignore the comments in `raws`
|
||||
* property while compiling node to string.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('a { color: black }')
|
||||
* const decl = root.first.first
|
||||
*
|
||||
* decl.value //=> 'black'
|
||||
* ```
|
||||
*/
|
||||
get value(): string
|
||||
set value(value: string)
|
||||
/**
|
||||
* It represents a getter that returns `true` if a declaration starts with
|
||||
* `--` or `$`, which are used to declare variables in CSS and SASS/SCSS.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse(':root { --one: 1 }')
|
||||
* const one = root.first.first
|
||||
*
|
||||
* one.variable //=> true
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('$one: 1')
|
||||
* const one = root.first
|
||||
*
|
||||
* one.variable //=> true
|
||||
* ```
|
||||
*/
|
||||
get variable(): boolean
|
||||
}
|
||||
|
||||
declare class Declaration extends Declaration_ {}
|
||||
|
||||
export = Declaration
|
24
site/real_game/node_modules/postcss/lib/declaration.js
generated
vendored
Normal file
24
site/real_game/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
|
69
site/real_game/node_modules/postcss/lib/document.d.ts
generated
vendored
Normal file
69
site/real_game/node_modules/postcss/lib/document.d.ts
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
import Container, { ContainerProps } from './container.js'
|
||||
import { ProcessOptions } from './postcss.js'
|
||||
import Result from './result.js'
|
||||
import Root from './root.js'
|
||||
|
||||
declare namespace Document {
|
||||
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>
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
export { Document_ as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* ```
|
||||
*/
|
||||
declare class Document_ extends Container<Root> {
|
||||
nodes: Root[]
|
||||
parent: undefined
|
||||
type: 'document'
|
||||
|
||||
constructor(defaults?: Document.DocumentProps)
|
||||
|
||||
assign(overrides: Document.DocumentProps | object): this
|
||||
clone(overrides?: Partial<Document.DocumentProps>): this
|
||||
cloneAfter(overrides?: Partial<Document.DocumentProps>): this
|
||||
cloneBefore(overrides?: Partial<Document.DocumentProps>): this
|
||||
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
|
||||
declare class Document extends Document_ {}
|
||||
|
||||
export = Document
|
33
site/real_game/node_modules/postcss/lib/document.js
generated
vendored
Normal file
33
site/real_game/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
|
9
site/real_game/node_modules/postcss/lib/fromJSON.d.ts
generated
vendored
Normal file
9
site/real_game/node_modules/postcss/lib/fromJSON.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import { JSONHydrator } from './postcss.js'
|
||||
|
||||
interface FromJSON extends JSONHydrator {
|
||||
default: FromJSON
|
||||
}
|
||||
|
||||
declare const fromJSON: FromJSON
|
||||
|
||||
export = fromJSON
|
54
site/real_game/node_modules/postcss/lib/fromJSON.js
generated
vendored
Normal file
54
site/real_game/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
|
197
site/real_game/node_modules/postcss/lib/input.d.ts
generated
vendored
Normal file
197
site/real_game/node_modules/postcss/lib/input.d.ts
generated
vendored
Normal file
@ -0,0 +1,197 @@
|
||||
import { CssSyntaxError, ProcessOptions } from './postcss.js'
|
||||
import PreviousMap from './previous-map.js'
|
||||
|
||||
declare namespace Input {
|
||||
export interface FilePosition {
|
||||
/**
|
||||
* Column of inclusive start position in source file.
|
||||
*/
|
||||
column: number
|
||||
|
||||
/**
|
||||
* Column of exclusive end position in source file.
|
||||
*/
|
||||
endColumn?: number
|
||||
|
||||
/**
|
||||
* Line of exclusive end position in source file.
|
||||
*/
|
||||
endLine?: number
|
||||
|
||||
/**
|
||||
* Absolute path to the source file.
|
||||
*/
|
||||
file?: string
|
||||
|
||||
/**
|
||||
* Line of inclusive start position in source file.
|
||||
*/
|
||||
line: number
|
||||
|
||||
/**
|
||||
* Source code.
|
||||
*/
|
||||
source?: string
|
||||
|
||||
/**
|
||||
* URL for the source file.
|
||||
*/
|
||||
url: string
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
export { Input_ as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the source CSS.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse(css, { from: file })
|
||||
* const input = root.source.input
|
||||
* ```
|
||||
*/
|
||||
declare class Input_ {
|
||||
/**
|
||||
* Input CSS source.
|
||||
*
|
||||
* ```js
|
||||
* const input = postcss.parse('a{}', { from: file }).input
|
||||
* input.css //=> "a{}"
|
||||
* ```
|
||||
*/
|
||||
css: string
|
||||
|
||||
/**
|
||||
* 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 flag to indicate whether or not the source code has Unicode BOM.
|
||||
*/
|
||||
hasBOM: boolean
|
||||
|
||||
/**
|
||||
* 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 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
|
||||
|
||||
/**
|
||||
* @param css Input CSS source.
|
||||
* @param opts Process options.
|
||||
*/
|
||||
constructor(css: string, opts?: ProcessOptions)
|
||||
|
||||
error(
|
||||
message: string,
|
||||
start:
|
||||
| {
|
||||
column: number
|
||||
line: number
|
||||
}
|
||||
| {
|
||||
offset: number
|
||||
},
|
||||
end:
|
||||
| {
|
||||
column: number
|
||||
line: number
|
||||
}
|
||||
| {
|
||||
offset: number
|
||||
},
|
||||
opts?: { plugin?: CssSyntaxError['plugin'] }
|
||||
): CssSyntaxError
|
||||
|
||||
/**
|
||||
* Returns `CssSyntaxError` with information about the error and its position.
|
||||
*/
|
||||
error(
|
||||
message: string,
|
||||
line: number,
|
||||
column: number,
|
||||
opts?: { plugin?: CssSyntaxError['plugin'] }
|
||||
): CssSyntaxError
|
||||
|
||||
error(
|
||||
message: string,
|
||||
offset: number,
|
||||
opts?: { plugin?: CssSyntaxError['plugin'] }
|
||||
): CssSyntaxError
|
||||
|
||||
/**
|
||||
* Converts source offset to line and column.
|
||||
*
|
||||
* @param offset Source offset.
|
||||
*/
|
||||
fromOffset(offset: number): { col: number; line: number } | null
|
||||
/**
|
||||
* 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
|
||||
): false | Input.FilePosition
|
||||
/**
|
||||
* 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
|
||||
|
||||
/** Converts this to a JSON-friendly object representation. */
|
||||
toJSON(): object
|
||||
}
|
||||
|
||||
declare class Input extends Input_ {}
|
||||
|
||||
export = Input
|
248
site/real_game/node_modules/postcss/lib/input.js
generated
vendored
Normal file
248
site/real_game/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 { isAbsolute, resolve } = 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
|
||||
}
|
||||
|
||||
error(message, line, column, opts = {}) {
|
||||
let result, endLine, endColumn
|
||||
|
||||
if (line && typeof line === 'object') {
|
||||
let start = line
|
||||
let end = column
|
||||
if (typeof start.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
|
||||
: { column: origin.column, line: origin.line },
|
||||
origin.endLine === undefined
|
||||
? origin.column
|
||||
: { column: origin.endColumn, line: origin.endLine },
|
||||
origin.source,
|
||||
origin.file,
|
||||
opts.plugin
|
||||
)
|
||||
} else {
|
||||
result = new CssSyntaxError(
|
||||
message,
|
||||
endLine === undefined ? line : { column, line },
|
||||
endLine === undefined ? column : { column: endColumn, line: endLine },
|
||||
this.css,
|
||||
this.file,
|
||||
opts.plugin
|
||||
)
|
||||
}
|
||||
|
||||
result.input = { column, endColumn, endLine, line, source: this.css }
|
||||
if (this.file) {
|
||||
if (pathToFileURL) {
|
||||
result.input.url = pathToFileURL(this.file).toString()
|
||||
}
|
||||
result.input.file = this.file
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
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 {
|
||||
col: offset - lineToIndex[min] + 1,
|
||||
line: min + 1
|
||||
}
|
||||
}
|
||||
|
||||
mapResolve(file) {
|
||||
if (/^\w+:\/\//.test(file)) {
|
||||
return file
|
||||
}
|
||||
return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file)
|
||||
}
|
||||
|
||||
origin(line, column, endLine, endColumn) {
|
||||
if (!this.map) return false
|
||||
let consumer = this.map.consumer()
|
||||
|
||||
let from = consumer.originalPositionFor({ column, line })
|
||||
if (!from.source) return false
|
||||
|
||||
let to
|
||||
if (typeof endLine === 'number') {
|
||||
to = consumer.originalPositionFor({ column: endColumn, line: endLine })
|
||||
}
|
||||
|
||||
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 = {
|
||||
column: from.column,
|
||||
endColumn: to && to.column,
|
||||
endLine: to && to.line,
|
||||
line: from.line,
|
||||
url: fromUrl.toString()
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
get from() {
|
||||
return this.file || this.id
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Input
|
||||
Input.default = Input
|
||||
|
||||
if (terminalHighlight && terminalHighlight.registerInput) {
|
||||
terminalHighlight.registerInput(Input)
|
||||
}
|
190
site/real_game/node_modules/postcss/lib/lazy-result.d.ts
generated
vendored
Normal file
190
site/real_game/node_modules/postcss/lib/lazy-result.d.ts
generated
vendored
Normal file
@ -0,0 +1,190 @@
|
||||
import Document from './document.js'
|
||||
import { SourceMap } from './postcss.js'
|
||||
import Processor from './processor.js'
|
||||
import Result, { Message, ResultOptions } from './result.js'
|
||||
import Root from './root.js'
|
||||
import Warning from './warning.js'
|
||||
|
||||
declare namespace LazyResult {
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
export { LazyResult_ as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* A Promise proxy for the result of PostCSS transformations.
|
||||
*
|
||||
* A `LazyResult` instance is returned by `Processor#process`.
|
||||
*
|
||||
* ```js
|
||||
* const lazy = postcss([autoprefixer]).process(css)
|
||||
* ```
|
||||
*/
|
||||
declare class LazyResult_<RootNode = Document | Root>
|
||||
implements PromiseLike<Result<RootNode>>
|
||||
{
|
||||
/**
|
||||
* 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<RootNode>>['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<RootNode>>['finally']
|
||||
|
||||
/**
|
||||
* 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<RootNode>>['then']
|
||||
|
||||
/**
|
||||
* @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)
|
||||
|
||||
/**
|
||||
* Run plugin in async way and return `Result`.
|
||||
*
|
||||
* @return Result with output content.
|
||||
*/
|
||||
async(): Promise<Result<RootNode>>
|
||||
|
||||
/**
|
||||
* Run plugin in sync way and return `Result`.
|
||||
*
|
||||
* @return Result with output content.
|
||||
*/
|
||||
sync(): Result<RootNode>
|
||||
|
||||
/**
|
||||
* Alias for the `LazyResult#css` property.
|
||||
*
|
||||
* ```js
|
||||
* lazy + '' === lazy.css
|
||||
* ```
|
||||
*
|
||||
* @return Output CSS.
|
||||
*/
|
||||
toString(): string
|
||||
|
||||
/**
|
||||
* Processes input CSS through synchronous plugins
|
||||
* and calls `Result#warnings`.
|
||||
*
|
||||
* @return Warnings from plugins.
|
||||
*/
|
||||
warnings(): Warning[]
|
||||
|
||||
/**
|
||||
* 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, 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
|
||||
|
||||
/**
|
||||
* 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#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[]
|
||||
|
||||
/**
|
||||
* Options from the `Processor#process` call.
|
||||
*/
|
||||
get opts(): ResultOptions
|
||||
|
||||
/**
|
||||
* Returns a `Processor` instance, which will be used
|
||||
* for CSS transformations.
|
||||
*/
|
||||
get processor(): Processor
|
||||
|
||||
/**
|
||||
* 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(): RootNode
|
||||
|
||||
/**
|
||||
* Returns the default string description of an object.
|
||||
* Required to implement the Promise interface.
|
||||
*/
|
||||
get [Symbol.toStringTag](): string
|
||||
}
|
||||
|
||||
declare class LazyResult<
|
||||
RootNode = Document | Root
|
||||
> extends LazyResult_<RootNode> {}
|
||||
|
||||
export = LazyResult
|
550
site/real_game/node_modules/postcss/lib/lazy-result.js
generated
vendored
Normal file
550
site/real_game/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 = {
|
||||
atrule: 'AtRule',
|
||||
comment: 'Comment',
|
||||
decl: 'Declaration',
|
||||
document: 'Document',
|
||||
root: 'Root',
|
||||
rule: 'Rule'
|
||||
}
|
||||
|
||||
const PLUGIN_PROPS = {
|
||||
AtRule: true,
|
||||
AtRuleExit: true,
|
||||
Comment: true,
|
||||
CommentExit: true,
|
||||
Declaration: true,
|
||||
DeclarationExit: true,
|
||||
Document: true,
|
||||
DocumentExit: true,
|
||||
Once: true,
|
||||
OnceExit: true,
|
||||
postcssPlugin: true,
|
||||
prepare: true,
|
||||
Root: true,
|
||||
RootExit: true,
|
||||
Rule: true,
|
||||
RuleExit: true
|
||||
}
|
||||
|
||||
const NOT_VISITORS = {
|
||||
Once: true,
|
||||
postcssPlugin: true,
|
||||
prepare: 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 {
|
||||
eventIndex: 0,
|
||||
events,
|
||||
iterator: 0,
|
||||
node,
|
||||
visitorIndex: 0,
|
||||
visitors: []
|
||||
}
|
||||
}
|
||||
|
||||
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, postcss, result: this.result }
|
||||
this.plugins = this.processor.plugins.map(plugin => {
|
||||
if (typeof plugin === 'object' && plugin.prepare) {
|
||||
return { ...plugin, ...plugin.prepare(this.result) }
|
||||
} else {
|
||||
return plugin
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
catch(onRejected) {
|
||||
return this.async().catch(onRejected)
|
||||
}
|
||||
|
||||
finally(onFinally) {
|
||||
return this.async().then(onFinally, onFinally)
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.css
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
warnings() {
|
||||
return this.sync().warnings()
|
||||
}
|
||||
|
||||
get content() {
|
||||
return this.stringify().content
|
||||
}
|
||||
|
||||
get css() {
|
||||
return this.stringify().css
|
||||
}
|
||||
|
||||
get map() {
|
||||
return this.stringify().map
|
||||
}
|
||||
|
||||
get messages() {
|
||||
return this.sync().messages
|
||||
}
|
||||
|
||||
get opts() {
|
||||
return this.result.opts
|
||||
}
|
||||
|
||||
get processor() {
|
||||
return this.result.processor
|
||||
}
|
||||
|
||||
get root() {
|
||||
return this.sync().root
|
||||
}
|
||||
|
||||
get [Symbol.toStringTag]() {
|
||||
return 'LazyResult'
|
||||
}
|
||||
}
|
||||
|
||||
LazyResult.registerPostcss = dependant => {
|
||||
postcss = dependant
|
||||
}
|
||||
|
||||
module.exports = LazyResult
|
||||
LazyResult.default = LazyResult
|
||||
|
||||
Root.registerLazyResult(LazyResult)
|
||||
Document.registerLazyResult(LazyResult)
|
56
site/real_game/node_modules/postcss/lib/list.d.ts
generated
vendored
Normal file
56
site/real_game/node_modules/postcss/lib/list.d.ts
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
declare namespace list {
|
||||
type List = {
|
||||
/**
|
||||
* 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[]
|
||||
|
||||
default: List
|
||||
|
||||
/**
|
||||
* 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 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[]
|
||||
}
|
||||
}
|
||||
|
||||
declare const list: list.List
|
||||
|
||||
export = list
|
58
site/real_game/node_modules/postcss/lib/list.js
generated
vendored
Normal file
58
site/real_game/node_modules/postcss/lib/list.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
'use strict'
|
||||
|
||||
let list = {
|
||||
comma(string) {
|
||||
return list.split(string, [','], true)
|
||||
},
|
||||
|
||||
space(string) {
|
||||
let spaces = [' ', '\n', '\t']
|
||||
return list.split(string, spaces)
|
||||
},
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = list
|
||||
list.default = list
|
368
site/real_game/node_modules/postcss/lib/map-generator.js
generated
vendored
Normal file
368
site/real_game/node_modules/postcss/lib/map-generator.js
generated
vendored
Normal file
@ -0,0 +1,368 @@
|
||||
'use strict'
|
||||
|
||||
let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js')
|
||||
let { dirname, relative, resolve, sep } = require('path')
|
||||
let { pathToFileURL } = require('url')
|
||||
|
||||
let Input = require('./input')
|
||||
|
||||
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator)
|
||||
let pathAvailable = Boolean(dirname && resolve && relative && sep)
|
||||
|
||||
class MapGenerator {
|
||||
constructor(stringify, root, opts, cssString) {
|
||||
this.stringify = stringify
|
||||
this.mapOpts = opts.map || {}
|
||||
this.root = root
|
||||
this.opts = opts
|
||||
this.css = cssString
|
||||
this.originalCSS = cssString
|
||||
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute
|
||||
|
||||
this.memoizedFileURLs = new Map()
|
||||
this.memoizedPaths = new Map()
|
||||
this.memoizedURLs = new Map()
|
||||
}
|
||||
|
||||
addAnnotation() {
|
||||
let content
|
||||
|
||||
if (this.isInline()) {
|
||||
content =
|
||||
'data:application/json;base64,' + this.toBase64(this.map.toString())
|
||||
} else if (typeof this.mapOpts.annotation === 'string') {
|
||||
content = this.mapOpts.annotation
|
||||
} else if (typeof this.mapOpts.annotation === 'function') {
|
||||
content = this.mapOpts.annotation(this.opts.to, this.root)
|
||||
} else {
|
||||
content = this.outputFile() + '.map'
|
||||
}
|
||||
let eol = '\n'
|
||||
if (this.css.includes('\r\n')) eol = '\r\n'
|
||||
|
||||
this.css += eol + '/*# sourceMappingURL=' + content + ' */'
|
||||
}
|
||||
|
||||
applyPrevMaps() {
|
||||
for (let prev of this.previous()) {
|
||||
let from = this.toUrl(this.path(prev.file))
|
||||
let root = prev.root || dirname(prev.file)
|
||||
let map
|
||||
|
||||
if (this.mapOpts.sourcesContent === false) {
|
||||
map = new SourceMapConsumer(prev.text)
|
||||
if (map.sourcesContent) {
|
||||
map.sourcesContent = null
|
||||
}
|
||||
} else {
|
||||
map = prev.consumer()
|
||||
}
|
||||
|
||||
this.map.applySourceMap(map, from, this.toUrl(this.path(root)))
|
||||
}
|
||||
}
|
||||
|
||||
clearAnnotation() {
|
||||
if (this.mapOpts.annotation === false) return
|
||||
|
||||
if (this.root) {
|
||||
let node
|
||||
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
|
||||
node = this.root.nodes[i]
|
||||
if (node.type !== 'comment') continue
|
||||
if (node.text.indexOf('# sourceMappingURL=') === 0) {
|
||||
this.root.removeChild(i)
|
||||
}
|
||||
}
|
||||
} else if (this.css) {
|
||||
this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, '')
|
||||
}
|
||||
}
|
||||
|
||||
generate() {
|
||||
this.clearAnnotation()
|
||||
if (pathAvailable && sourceMapAvailable && this.isMap()) {
|
||||
return this.generateMap()
|
||||
} else {
|
||||
let result = ''
|
||||
this.stringify(this.root, i => {
|
||||
result += i
|
||||
})
|
||||
return [result]
|
||||
}
|
||||
}
|
||||
|
||||
generateMap() {
|
||||
if (this.root) {
|
||||
this.generateString()
|
||||
} else if (this.previous().length === 1) {
|
||||
let prev = this.previous()[0].consumer()
|
||||
prev.file = this.outputFile()
|
||||
this.map = SourceMapGenerator.fromSourceMap(prev, {
|
||||
ignoreInvalidMapping: true
|
||||
})
|
||||
} else {
|
||||
this.map = new SourceMapGenerator({
|
||||
file: this.outputFile(),
|
||||
ignoreInvalidMapping: true
|
||||
})
|
||||
this.map.addMapping({
|
||||
generated: { column: 0, line: 1 },
|
||||
original: { column: 0, line: 1 },
|
||||
source: this.opts.from
|
||||
? this.toUrl(this.path(this.opts.from))
|
||||
: '<no source>'
|
||||
})
|
||||
}
|
||||
|
||||
if (this.isSourcesContent()) this.setSourcesContent()
|
||||
if (this.root && this.previous().length > 0) this.applyPrevMaps()
|
||||
if (this.isAnnotation()) this.addAnnotation()
|
||||
|
||||
if (this.isInline()) {
|
||||
return [this.css]
|
||||
} else {
|
||||
return [this.css, this.map]
|
||||
}
|
||||
}
|
||||
|
||||
generateString() {
|
||||
this.css = ''
|
||||
this.map = new SourceMapGenerator({
|
||||
file: this.outputFile(),
|
||||
ignoreInvalidMapping: true
|
||||
})
|
||||
|
||||
let line = 1
|
||||
let column = 1
|
||||
|
||||
let noSource = '<no source>'
|
||||
let mapping = {
|
||||
generated: { column: 0, line: 0 },
|
||||
original: { column: 0, line: 0 },
|
||||
source: ''
|
||||
}
|
||||
|
||||
let lines, last
|
||||
this.stringify(this.root, (str, node, type) => {
|
||||
this.css += str
|
||||
|
||||
if (node && type !== 'end') {
|
||||
mapping.generated.line = line
|
||||
mapping.generated.column = column - 1
|
||||
if (node.source && node.source.start) {
|
||||
mapping.source = this.sourcePath(node)
|
||||
mapping.original.line = node.source.start.line
|
||||
mapping.original.column = node.source.start.column - 1
|
||||
this.map.addMapping(mapping)
|
||||
} else {
|
||||
mapping.source = noSource
|
||||
mapping.original.line = 1
|
||||
mapping.original.column = 0
|
||||
this.map.addMapping(mapping)
|
||||
}
|
||||
}
|
||||
|
||||
lines = str.match(/\n/g)
|
||||
if (lines) {
|
||||
line += lines.length
|
||||
last = str.lastIndexOf('\n')
|
||||
column = str.length - last
|
||||
} else {
|
||||
column += str.length
|
||||
}
|
||||
|
||||
if (node && type !== 'start') {
|
||||
let p = node.parent || { raws: {} }
|
||||
let childless =
|
||||
node.type === 'decl' || (node.type === 'atrule' && !node.nodes)
|
||||
if (!childless || node !== p.last || p.raws.semicolon) {
|
||||
if (node.source && node.source.end) {
|
||||
mapping.source = this.sourcePath(node)
|
||||
mapping.original.line = node.source.end.line
|
||||
mapping.original.column = node.source.end.column - 1
|
||||
mapping.generated.line = line
|
||||
mapping.generated.column = column - 2
|
||||
this.map.addMapping(mapping)
|
||||
} else {
|
||||
mapping.source = noSource
|
||||
mapping.original.line = 1
|
||||
mapping.original.column = 0
|
||||
mapping.generated.line = line
|
||||
mapping.generated.column = column - 1
|
||||
this.map.addMapping(mapping)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
isAnnotation() {
|
||||
if (this.isInline()) {
|
||||
return true
|
||||
}
|
||||
if (typeof this.mapOpts.annotation !== 'undefined') {
|
||||
return this.mapOpts.annotation
|
||||
}
|
||||
if (this.previous().length) {
|
||||
return this.previous().some(i => i.annotation)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
isInline() {
|
||||
if (typeof this.mapOpts.inline !== 'undefined') {
|
||||
return this.mapOpts.inline
|
||||
}
|
||||
|
||||
let annotation = this.mapOpts.annotation
|
||||
if (typeof annotation !== 'undefined' && annotation !== true) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (this.previous().length) {
|
||||
return this.previous().some(i => i.inline)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
isMap() {
|
||||
if (typeof this.opts.map !== 'undefined') {
|
||||
return !!this.opts.map
|
||||
}
|
||||
return this.previous().length > 0
|
||||
}
|
||||
|
||||
isSourcesContent() {
|
||||
if (typeof this.mapOpts.sourcesContent !== 'undefined') {
|
||||
return this.mapOpts.sourcesContent
|
||||
}
|
||||
if (this.previous().length) {
|
||||
return this.previous().some(i => i.withContent())
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
outputFile() {
|
||||
if (this.opts.to) {
|
||||
return this.path(this.opts.to)
|
||||
} else if (this.opts.from) {
|
||||
return this.path(this.opts.from)
|
||||
} else {
|
||||
return 'to.css'
|
||||
}
|
||||
}
|
||||
|
||||
path(file) {
|
||||
if (this.mapOpts.absolute) return file
|
||||
if (file.charCodeAt(0) === 60 /* `<` */) return file
|
||||
if (/^\w+:\/\//.test(file)) return file
|
||||
let cached = this.memoizedPaths.get(file)
|
||||
if (cached) return cached
|
||||
|
||||
let from = this.opts.to ? dirname(this.opts.to) : '.'
|
||||
|
||||
if (typeof this.mapOpts.annotation === 'string') {
|
||||
from = dirname(resolve(from, this.mapOpts.annotation))
|
||||
}
|
||||
|
||||
let path = relative(from, file)
|
||||
this.memoizedPaths.set(file, path)
|
||||
|
||||
return path
|
||||
}
|
||||
|
||||
previous() {
|
||||
if (!this.previousMaps) {
|
||||
this.previousMaps = []
|
||||
if (this.root) {
|
||||
this.root.walk(node => {
|
||||
if (node.source && node.source.input.map) {
|
||||
let map = node.source.input.map
|
||||
if (!this.previousMaps.includes(map)) {
|
||||
this.previousMaps.push(map)
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
let input = new Input(this.originalCSS, this.opts)
|
||||
if (input.map) this.previousMaps.push(input.map)
|
||||
}
|
||||
}
|
||||
|
||||
return this.previousMaps
|
||||
}
|
||||
|
||||
setSourcesContent() {
|
||||
let already = {}
|
||||
if (this.root) {
|
||||
this.root.walk(node => {
|
||||
if (node.source) {
|
||||
let from = node.source.input.from
|
||||
if (from && !already[from]) {
|
||||
already[from] = true
|
||||
let fromUrl = this.usesFileUrls
|
||||
? this.toFileUrl(from)
|
||||
: this.toUrl(this.path(from))
|
||||
this.map.setSourceContent(fromUrl, node.source.input.css)
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (this.css) {
|
||||
let from = this.opts.from
|
||||
? this.toUrl(this.path(this.opts.from))
|
||||
: '<no source>'
|
||||
this.map.setSourceContent(from, this.css)
|
||||
}
|
||||
}
|
||||
|
||||
sourcePath(node) {
|
||||
if (this.mapOpts.from) {
|
||||
return this.toUrl(this.mapOpts.from)
|
||||
} else if (this.usesFileUrls) {
|
||||
return this.toFileUrl(node.source.input.from)
|
||||
} else {
|
||||
return this.toUrl(this.path(node.source.input.from))
|
||||
}
|
||||
}
|
||||
|
||||
toBase64(str) {
|
||||
if (Buffer) {
|
||||
return Buffer.from(str).toString('base64')
|
||||
} else {
|
||||
return window.btoa(unescape(encodeURIComponent(str)))
|
||||
}
|
||||
}
|
||||
|
||||
toFileUrl(path) {
|
||||
let cached = this.memoizedFileURLs.get(path)
|
||||
if (cached) return cached
|
||||
|
||||
if (pathToFileURL) {
|
||||
let fileURL = pathToFileURL(path).toString()
|
||||
this.memoizedFileURLs.set(path, fileURL)
|
||||
|
||||
return fileURL
|
||||
} else {
|
||||
throw new Error(
|
||||
'`map.absolute` option is not available in this PostCSS build'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
toUrl(path) {
|
||||
let cached = this.memoizedURLs.get(path)
|
||||
if (cached) return cached
|
||||
|
||||
if (sep === '\\') {
|
||||
path = path.replace(/\\/g, '/')
|
||||
}
|
||||
|
||||
let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent)
|
||||
this.memoizedURLs.set(path, url)
|
||||
|
||||
return url
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MapGenerator
|
46
site/real_game/node_modules/postcss/lib/no-work-result.d.ts
generated
vendored
Normal file
46
site/real_game/node_modules/postcss/lib/no-work-result.d.ts
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
import LazyResult from './lazy-result.js'
|
||||
import { SourceMap } from './postcss.js'
|
||||
import Processor from './processor.js'
|
||||
import Result, { Message, ResultOptions } from './result.js'
|
||||
import Root from './root.js'
|
||||
import Warning from './warning.js'
|
||||
|
||||
declare namespace NoWorkResult {
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
export { NoWorkResult_ as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* A Promise proxy for the result of PostCSS transformations.
|
||||
* This lazy result instance doesn't parse css unless `NoWorkResult#root` or `Result#root`
|
||||
* are accessed. See the example below for details.
|
||||
* A `NoWork` instance is returned by `Processor#process` ONLY when no plugins defined.
|
||||
*
|
||||
* ```js
|
||||
* const noWorkResult = postcss().process(css) // No plugins are defined.
|
||||
* // CSS is not parsed
|
||||
* let root = noWorkResult.root // now css is parsed because we accessed the root
|
||||
* ```
|
||||
*/
|
||||
declare class NoWorkResult_ implements LazyResult<Root> {
|
||||
catch: Promise<Result<Root>>['catch']
|
||||
finally: Promise<Result<Root>>['finally']
|
||||
then: Promise<Result<Root>>['then']
|
||||
constructor(processor: Processor, css: string, opts: ResultOptions)
|
||||
async(): Promise<Result<Root>>
|
||||
sync(): Result<Root>
|
||||
toString(): string
|
||||
warnings(): Warning[]
|
||||
get content(): string
|
||||
get css(): string
|
||||
get map(): SourceMap
|
||||
get messages(): Message[]
|
||||
get opts(): ResultOptions
|
||||
get processor(): Processor
|
||||
get root(): Root
|
||||
get [Symbol.toStringTag](): string
|
||||
}
|
||||
|
||||
declare class NoWorkResult extends NoWorkResult_ {}
|
||||
|
||||
export = NoWorkResult
|
138
site/real_game/node_modules/postcss/lib/no-work-result.js
generated
vendored
Normal file
138
site/real_game/node_modules/postcss/lib/no-work-result.js
generated
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
'use strict'
|
||||
|
||||
let MapGenerator = require('./map-generator')
|
||||
let stringify = require('./stringify')
|
||||
let warnOnce = require('./warn-once')
|
||||
let parse = require('./parse')
|
||||
const Result = require('./result')
|
||||
|
||||
class NoWorkResult {
|
||||
constructor(processor, css, opts) {
|
||||
css = css.toString()
|
||||
this.stringified = false
|
||||
|
||||
this._processor = processor
|
||||
this._css = css
|
||||
this._opts = opts
|
||||
this._map = undefined
|
||||
let root
|
||||
|
||||
let str = stringify
|
||||
this.result = new Result(this._processor, root, this._opts)
|
||||
this.result.css = css
|
||||
|
||||
let self = this
|
||||
Object.defineProperty(this.result, 'root', {
|
||||
get() {
|
||||
return self.root
|
||||
}
|
||||
})
|
||||
|
||||
let map = new MapGenerator(str, root, this._opts, css)
|
||||
if (map.isMap()) {
|
||||
let [generatedCSS, generatedMap] = map.generate()
|
||||
if (generatedCSS) {
|
||||
this.result.css = generatedCSS
|
||||
}
|
||||
if (generatedMap) {
|
||||
this.result.map = generatedMap
|
||||
}
|
||||
} else {
|
||||
map.clearAnnotation()
|
||||
this.result.css = map.css
|
||||
}
|
||||
}
|
||||
|
||||
async() {
|
||||
if (this.error) return Promise.reject(this.error)
|
||||
return Promise.resolve(this.result)
|
||||
}
|
||||
|
||||
catch(onRejected) {
|
||||
return this.async().catch(onRejected)
|
||||
}
|
||||
|
||||
finally(onFinally) {
|
||||
return this.async().then(onFinally, onFinally)
|
||||
}
|
||||
|
||||
sync() {
|
||||
if (this.error) throw this.error
|
||||
return this.result
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this._css
|
||||
}
|
||||
|
||||
warnings() {
|
||||
return []
|
||||
}
|
||||
|
||||
get content() {
|
||||
return this.result.css
|
||||
}
|
||||
|
||||
get css() {
|
||||
return this.result.css
|
||||
}
|
||||
|
||||
get map() {
|
||||
return this.result.map
|
||||
}
|
||||
|
||||
get messages() {
|
||||
return []
|
||||
}
|
||||
|
||||
get opts() {
|
||||
return this.result.opts
|
||||
}
|
||||
|
||||
get processor() {
|
||||
return this.result.processor
|
||||
}
|
||||
|
||||
get root() {
|
||||
if (this._root) {
|
||||
return this._root
|
||||
}
|
||||
|
||||
let root
|
||||
let parser = parse
|
||||
|
||||
try {
|
||||
root = parser(this._css, this._opts)
|
||||
} catch (error) {
|
||||
this.error = error
|
||||
}
|
||||
|
||||
if (this.error) {
|
||||
throw this.error
|
||||
} else {
|
||||
this._root = root
|
||||
return root
|
||||
}
|
||||
}
|
||||
|
||||
get [Symbol.toStringTag]() {
|
||||
return 'NoWorkResult'
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NoWorkResult
|
||||
NoWorkResult.default = NoWorkResult
|
536
site/real_game/node_modules/postcss/lib/node.d.ts
generated
vendored
Normal file
536
site/real_game/node_modules/postcss/lib/node.d.ts
generated
vendored
Normal file
@ -0,0 +1,536 @@
|
||||
import AtRule = require('./at-rule.js')
|
||||
|
||||
import { AtRuleProps } from './at-rule.js'
|
||||
import Comment, { CommentProps } from './comment.js'
|
||||
import Container from './container.js'
|
||||
import CssSyntaxError from './css-syntax-error.js'
|
||||
import Declaration, { DeclarationProps } from './declaration.js'
|
||||
import Document from './document.js'
|
||||
import Input from './input.js'
|
||||
import { Stringifier, Syntax } from './postcss.js'
|
||||
import Result from './result.js'
|
||||
import Root from './root.js'
|
||||
import Rule, { RuleProps } from './rule.js'
|
||||
import Warning, { WarningOptions } from './warning.js'
|
||||
|
||||
declare namespace Node {
|
||||
export type ChildNode = AtRule.default | Comment | Declaration | Rule
|
||||
|
||||
export type AnyNode =
|
||||
| AtRule.default
|
||||
| Comment
|
||||
| Declaration
|
||||
| Document
|
||||
| Root
|
||||
| Rule
|
||||
|
||||
export type ChildProps =
|
||||
| AtRuleProps
|
||||
| CommentProps
|
||||
| DeclarationProps
|
||||
| RuleProps
|
||||
|
||||
export interface Position {
|
||||
/**
|
||||
* Source line in file. In contrast to `offset` it starts from 1.
|
||||
*/
|
||||
column: number
|
||||
|
||||
/**
|
||||
* Source column in file.
|
||||
*/
|
||||
line: number
|
||||
|
||||
/**
|
||||
* Source offset in file. It starts from 0.
|
||||
*/
|
||||
offset: number
|
||||
}
|
||||
|
||||
export interface Range {
|
||||
/**
|
||||
* End position, exclusive.
|
||||
*/
|
||||
end: Position
|
||||
|
||||
/**
|
||||
* Start position, inclusive.
|
||||
*/
|
||||
start: Position
|
||||
}
|
||||
|
||||
/**
|
||||
* Source represents an interface for the {@link Node.source} property.
|
||||
*/
|
||||
export interface Source {
|
||||
/**
|
||||
* The inclusive ending position for the source
|
||||
* code of a node.
|
||||
*/
|
||||
end?: Position
|
||||
|
||||
/**
|
||||
* The source file from where a node has originated.
|
||||
*/
|
||||
input: Input
|
||||
|
||||
/**
|
||||
* The inclusive starting position for the source
|
||||
* code of a node.
|
||||
*/
|
||||
start?: Position
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface represents an interface for an object received
|
||||
* as parameter by Node class constructor.
|
||||
*/
|
||||
export interface NodeProps {
|
||||
source?: Source
|
||||
}
|
||||
|
||||
export interface NodeErrorOptions {
|
||||
/**
|
||||
* An ending index inside a node's string that should be highlighted as
|
||||
* source of error.
|
||||
*/
|
||||
endIndex?: number
|
||||
/**
|
||||
* An index inside a node's string that should be highlighted as source
|
||||
* of error.
|
||||
*/
|
||||
index?: number
|
||||
/**
|
||||
* Plugin name that created this error. PostCSS will set it automatically.
|
||||
*/
|
||||
plugin?: string
|
||||
/**
|
||||
* A word inside a node's string, that should be highlighted as source
|
||||
* of error.
|
||||
*/
|
||||
word?: string
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-shadow
|
||||
class Node extends Node_ {}
|
||||
export { Node as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* It represents an abstract class that handles common
|
||||
* methods for other CSS abstract syntax tree nodes.
|
||||
*
|
||||
* Any node that represents CSS selector or value should
|
||||
* not extend the `Node` class.
|
||||
*/
|
||||
declare abstract class Node_ {
|
||||
/**
|
||||
* It represents parent of the current node.
|
||||
*
|
||||
* ```js
|
||||
* root.nodes[0].parent === root //=> true
|
||||
* ```
|
||||
*/
|
||||
parent: Container | Document | undefined
|
||||
|
||||
/**
|
||||
* It represents unnecessary whitespace and characters present
|
||||
* in the css source code.
|
||||
*
|
||||
* Information to generate byte-to-byte equal node string as it was
|
||||
* in the origin input.
|
||||
*
|
||||
* The properties of the raws object are decided by parser,
|
||||
* the default parser uses the following properties:
|
||||
*
|
||||
* * `before`: the space symbols before the node. It also stores `*`
|
||||
* and `_` symbols before the declaration (IE hack).
|
||||
* * `after`: the space symbols after the last child of the node
|
||||
* to the end of the node.
|
||||
* * `between`: the symbols between the property and value
|
||||
* for declarations, selector and `{` for rules, or last parameter
|
||||
* and `{` for at-rules.
|
||||
* * `semicolon`: contains true if the last child has
|
||||
* an (optional) semicolon.
|
||||
* * `afterName`: the space between the at-rule name and its parameters.
|
||||
* * `left`: the space symbols between `/*` and the comment’s text.
|
||||
* * `right`: the space symbols between the comment’s text
|
||||
* and <code>*/</code>.
|
||||
* - `important`: the content of the important statement,
|
||||
* if it is not just `!important`.
|
||||
*
|
||||
* PostCSS filters out the comments inside selectors, declaration values
|
||||
* and at-rule parameters but it stores the origin content in raws.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('a {\n color:black\n}')
|
||||
* root.first.first.raws //=> { before: '\n ', between: ':' }
|
||||
* ```
|
||||
*/
|
||||
raws: any
|
||||
|
||||
/**
|
||||
* It represents information related to origin of a node and is required
|
||||
* for generating source maps.
|
||||
*
|
||||
* The nodes that are created manually using the public APIs
|
||||
* provided by PostCSS will have `source` undefined and
|
||||
* will be absent in the source map.
|
||||
*
|
||||
* For this reason, the plugin developer should consider
|
||||
* duplicating nodes as the duplicate node will have the
|
||||
* same source as the original node by default or assign
|
||||
* source to a node created manually.
|
||||
*
|
||||
* ```js
|
||||
* decl.source.input.from //=> '/home/ai/source.css'
|
||||
* decl.source.start //=> { line: 10, column: 2 }
|
||||
* decl.source.end //=> { line: 10, column: 12 }
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* // Incorrect method, source not specified!
|
||||
* const prefixed = postcss.decl({
|
||||
* prop: '-moz-' + decl.prop,
|
||||
* value: decl.value
|
||||
* })
|
||||
*
|
||||
* // Correct method, source is inherited when duplicating.
|
||||
* const prefixed = decl.clone({
|
||||
* prop: '-moz-' + decl.prop
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* if (atrule.name === 'add-link') {
|
||||
* const rule = postcss.rule({
|
||||
* selector: 'a',
|
||||
* source: atrule.source
|
||||
* })
|
||||
*
|
||||
* atrule.parent.insertBefore(atrule, rule)
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
source?: Node.Source
|
||||
|
||||
/**
|
||||
* It represents type of a node in
|
||||
* an abstract syntax tree.
|
||||
*
|
||||
* A type of node helps in identification of a node
|
||||
* and perform operation based on it's type.
|
||||
*
|
||||
* ```js
|
||||
* const declaration = new Declaration({
|
||||
* prop: 'color',
|
||||
* value: 'black'
|
||||
* })
|
||||
*
|
||||
* declaration.type //=> 'decl'
|
||||
* ```
|
||||
*/
|
||||
type: string
|
||||
|
||||
constructor(defaults?: object)
|
||||
|
||||
/**
|
||||
* Insert new node after current node to current node’s parent.
|
||||
*
|
||||
* Just alias for `node.parent.insertAfter(node, add)`.
|
||||
*
|
||||
* ```js
|
||||
* decl.after('color: black')
|
||||
* ```
|
||||
*
|
||||
* @param newNode New node.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
after(newNode: Node | Node.ChildProps | Node[] | string | undefined): this
|
||||
|
||||
/**
|
||||
* It assigns properties to an existing node instance.
|
||||
*
|
||||
* ```js
|
||||
* decl.assign({ prop: 'word-wrap', value: 'break-word' })
|
||||
* ```
|
||||
*
|
||||
* @param overrides New properties to override the node.
|
||||
*
|
||||
* @return `this` for method chaining.
|
||||
*/
|
||||
assign(overrides: object): this
|
||||
|
||||
/**
|
||||
* Insert new node before current node to current node’s parent.
|
||||
*
|
||||
* Just alias for `node.parent.insertBefore(node, add)`.
|
||||
*
|
||||
* ```js
|
||||
* decl.before('content: ""')
|
||||
* ```
|
||||
*
|
||||
* @param newNode New node.
|
||||
* @return This node for methods chain.
|
||||
*/
|
||||
before(newNode: Node | Node.ChildProps | Node[] | string | undefined): this
|
||||
|
||||
/**
|
||||
* Clear the code style properties for the node and its children.
|
||||
*
|
||||
* ```js
|
||||
* node.raws.before //=> ' '
|
||||
* node.cleanRaws()
|
||||
* node.raws.before //=> undefined
|
||||
* ```
|
||||
*
|
||||
* @param keepBetween Keep the `raws.between` symbols.
|
||||
*/
|
||||
cleanRaws(keepBetween?: boolean): void
|
||||
|
||||
/**
|
||||
* It creates clone of an existing node, which includes all the properties
|
||||
* and their values, that includes `raws` but not `type`.
|
||||
*
|
||||
* ```js
|
||||
* decl.raws.before //=> "\n "
|
||||
* const cloned = decl.clone({ prop: '-moz-' + decl.prop })
|
||||
* cloned.raws.before //=> "\n "
|
||||
* cloned.toString() //=> -moz-transform: scale(0)
|
||||
* ```
|
||||
*
|
||||
* @param overrides New properties to override in the clone.
|
||||
*
|
||||
* @return Duplicate of the node instance.
|
||||
*/
|
||||
clone(overrides?: object): this
|
||||
|
||||
/**
|
||||
* Shortcut to clone the node and insert the resulting cloned node
|
||||
* after the current node.
|
||||
*
|
||||
* @param overrides New properties to override in the clone.
|
||||
* @return New node.
|
||||
*/
|
||||
cloneAfter(overrides?: object): this
|
||||
|
||||
/**
|
||||
* Shortcut to clone the node and insert the resulting cloned node
|
||||
* before the current node.
|
||||
*
|
||||
* ```js
|
||||
* decl.cloneBefore({ prop: '-moz-' + decl.prop })
|
||||
* ```
|
||||
*
|
||||
* @param overrides Mew properties to override in the clone.
|
||||
*
|
||||
* @return New node
|
||||
*/
|
||||
cloneBefore(overrides?: object): this
|
||||
|
||||
/**
|
||||
* It creates an instance of the class `CssSyntaxError` and parameters passed
|
||||
* to this method are assigned to the error instance.
|
||||
*
|
||||
* The error instance will have description for the
|
||||
* error, original position of the node in the
|
||||
* source, showing line and column number.
|
||||
*
|
||||
* If any previous map is present, it would be used
|
||||
* to get original position of the source.
|
||||
*
|
||||
* The Previous Map here is referred to the source map
|
||||
* generated by previous compilation, example: Less,
|
||||
* Stylus and Sass.
|
||||
*
|
||||
* This method returns the error instance instead of
|
||||
* throwing it.
|
||||
*
|
||||
* ```js
|
||||
* if (!variables[name]) {
|
||||
* throw decl.error(`Unknown variable ${name}`, { word: name })
|
||||
* // CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black
|
||||
* // color: $black
|
||||
* // a
|
||||
* // ^
|
||||
* // background: white
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param message Description for the error instance.
|
||||
* @param options Options for the error instance.
|
||||
*
|
||||
* @return Error instance is returned.
|
||||
*/
|
||||
error(message: string, options?: Node.NodeErrorOptions): CssSyntaxError
|
||||
|
||||
/**
|
||||
* Returns the next child of the node’s parent.
|
||||
* Returns `undefined` if the current node is the last child.
|
||||
*
|
||||
* ```js
|
||||
* if (comment.text === 'delete next') {
|
||||
* const next = comment.next()
|
||||
* if (next) {
|
||||
* next.remove()
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @return Next node.
|
||||
*/
|
||||
next(): Node.ChildNode | undefined
|
||||
|
||||
/**
|
||||
* Get the position for a word or an index inside the node.
|
||||
*
|
||||
* @param opts Options.
|
||||
* @return Position.
|
||||
*/
|
||||
positionBy(opts?: Pick<WarningOptions, 'index' | 'word'>): Node.Position
|
||||
|
||||
/**
|
||||
* Convert string index to line/column.
|
||||
*
|
||||
* @param index The symbol number in the node’s string.
|
||||
* @return Symbol position in file.
|
||||
*/
|
||||
positionInside(index: number): Node.Position
|
||||
|
||||
/**
|
||||
* Returns the previous child of the node’s parent.
|
||||
* Returns `undefined` if the current node is the first child.
|
||||
*
|
||||
* ```js
|
||||
* const annotation = decl.prev()
|
||||
* if (annotation.type === 'comment') {
|
||||
* readAnnotation(annotation.text)
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @return Previous node.
|
||||
*/
|
||||
prev(): Node.ChildNode | undefined
|
||||
|
||||
/**
|
||||
* Get the range for a word or start and end index inside the node.
|
||||
* The start index is inclusive; the end index is exclusive.
|
||||
*
|
||||
* @param opts Options.
|
||||
* @return Range.
|
||||
*/
|
||||
rangeBy(
|
||||
opts?: Pick<WarningOptions, 'endIndex' | 'index' | 'word'>
|
||||
): Node.Range
|
||||
|
||||
/**
|
||||
* Returns a `raws` value. If the node is missing
|
||||
* the code style property (because the node was manually built or cloned),
|
||||
* PostCSS will try to autodetect the code style property by looking
|
||||
* at other nodes in the tree.
|
||||
*
|
||||
* ```js
|
||||
* const root = postcss.parse('a { background: white }')
|
||||
* root.nodes[0].append({ prop: 'color', value: 'black' })
|
||||
* root.nodes[0].nodes[1].raws.before //=> undefined
|
||||
* root.nodes[0].nodes[1].raw('before') //=> ' '
|
||||
* ```
|
||||
*
|
||||
* @param prop Name of code style property.
|
||||
* @param defaultType Name of default value, it can be missed
|
||||
* if the value is the same as prop.
|
||||
* @return {string} Code style value.
|
||||
*/
|
||||
raw(prop: string, defaultType?: string): string
|
||||
|
||||
/**
|
||||
* It removes the node from its parent and deletes its parent property.
|
||||
*
|
||||
* ```js
|
||||
* if (decl.prop.match(/^-webkit-/)) {
|
||||
* decl.remove()
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @return `this` for method chaining.
|
||||
*/
|
||||
remove(): this
|
||||
|
||||
/**
|
||||
* Inserts node(s) before the current node and removes the current node.
|
||||
*
|
||||
* ```js
|
||||
* AtRule: {
|
||||
* mixin: atrule => {
|
||||
* atrule.replaceWith(mixinRules[atrule.params])
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param nodes Mode(s) to replace current one.
|
||||
* @return Current node to methods chain.
|
||||
*/
|
||||
replaceWith(
|
||||
...nodes: (
|
||||
| Node
|
||||
| Node[]
|
||||
| Node.ChildProps
|
||||
| Node.ChildProps[]
|
||||
)[]
|
||||
): this
|
||||
|
||||
/**
|
||||
* Finds the Root instance of the node’s tree.
|
||||
*
|
||||
* ```js
|
||||
* root.nodes[0].nodes[0].root() === root
|
||||
* ```
|
||||
*
|
||||
* @return Root parent.
|
||||
*/
|
||||
root(): Root
|
||||
|
||||
/**
|
||||
* Fix circular links on `JSON.stringify()`.
|
||||
*
|
||||
* @return Cleaned object.
|
||||
*/
|
||||
toJSON(): object
|
||||
|
||||
/**
|
||||
* It compiles the node to browser readable cascading style sheets string
|
||||
* depending on it's type.
|
||||
*
|
||||
* ```js
|
||||
* new Rule({ selector: 'a' }).toString() //=> "a {}"
|
||||
* ```
|
||||
*
|
||||
* @param stringifier A syntax to use in string generation.
|
||||
* @return CSS string of this node.
|
||||
*/
|
||||
toString(stringifier?: Stringifier | Syntax): string
|
||||
|
||||
/**
|
||||
* It is a wrapper for {@link Result#warn}, providing convenient
|
||||
* way of generating warnings.
|
||||
*
|
||||
* ```js
|
||||
* Declaration: {
|
||||
* bad: (decl, { result }) => {
|
||||
* decl.warn(result, 'Deprecated property: bad')
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param result The `Result` instance that will receive the warning.
|
||||
* @param message Description for the warning.
|
||||
* @param options Options for the warning.
|
||||
*
|
||||
* @return `Warning` instance is returned
|
||||
*/
|
||||
warn(result: Result, message: string, options?: WarningOptions): Warning
|
||||
}
|
||||
|
||||
declare class Node extends Node_ {}
|
||||
|
||||
export = Node
|
381
site/real_game/node_modules/postcss/lib/node.js
generated
vendored
Normal file
381
site/real_game/node_modules/postcss/lib/node.js
generated
vendored
Normal file
@ -0,0 +1,381 @@
|
||||
'use strict'
|
||||
|
||||
let { isClean, my } = require('./symbols')
|
||||
let CssSyntaxError = require('./css-syntax-error')
|
||||
let Stringifier = require('./stringifier')
|
||||
let stringify = require('./stringify')
|
||||
|
||||
function cloneNode(obj, parent) {
|
||||
let cloned = new obj.constructor()
|
||||
|
||||
for (let i in obj) {
|
||||
if (!Object.prototype.hasOwnProperty.call(obj, i)) {
|
||||
/* c8 ignore next 2 */
|
||||
continue
|
||||
}
|
||||
if (i === 'proxyCache') continue
|
||||
let value = obj[i]
|
||||
let type = typeof value
|
||||
|
||||
if (i === 'parent' && type === 'object') {
|
||||
if (parent) cloned[i] = parent
|
||||
} else if (i === 'source') {
|
||||
cloned[i] = value
|
||||
} else if (Array.isArray(value)) {
|
||||
cloned[i] = value.map(j => cloneNode(j, cloned))
|
||||
} else {
|
||||
if (type === 'object' && value !== null) value = cloneNode(value)
|
||||
cloned[i] = value
|
||||
}
|
||||
}
|
||||
|
||||
return cloned
|
||||
}
|
||||
|
||||
class Node {
|
||||
constructor(defaults = {}) {
|
||||
this.raws = {}
|
||||
this[isClean] = false
|
||||
this[my] = true
|
||||
|
||||
for (let name in defaults) {
|
||||
if (name === 'nodes') {
|
||||
this.nodes = []
|
||||
for (let node of defaults[name]) {
|
||||
if (typeof node.clone === 'function') {
|
||||
this.append(node.clone())
|
||||
} else {
|
||||
this.append(node)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this[name] = defaults[name]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addToError(error) {
|
||||
error.postcssNode = this
|
||||
if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) {
|
||||
let s = this.source
|
||||
error.stack = error.stack.replace(
|
||||
/\n\s{4}at /,
|
||||
`$&${s.input.from}:${s.start.line}:${s.start.column}$&`
|
||||
)
|
||||
}
|
||||
return error
|
||||
}
|
||||
|
||||
after(add) {
|
||||
this.parent.insertAfter(this, add)
|
||||
return this
|
||||
}
|
||||
|
||||
assign(overrides = {}) {
|
||||
for (let name in overrides) {
|
||||
this[name] = overrides[name]
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
before(add) {
|
||||
this.parent.insertBefore(this, add)
|
||||
return this
|
||||
}
|
||||
|
||||
cleanRaws(keepBetween) {
|
||||
delete this.raws.before
|
||||
delete this.raws.after
|
||||
if (!keepBetween) delete this.raws.between
|
||||
}
|
||||
|
||||
clone(overrides = {}) {
|
||||
let cloned = cloneNode(this)
|
||||
for (let name in overrides) {
|
||||
cloned[name] = overrides[name]
|
||||
}
|
||||
return cloned
|
||||
}
|
||||
|
||||
cloneAfter(overrides = {}) {
|
||||
let cloned = this.clone(overrides)
|
||||
this.parent.insertAfter(this, cloned)
|
||||
return cloned
|
||||
}
|
||||
|
||||
cloneBefore(overrides = {}) {
|
||||
let cloned = this.clone(overrides)
|
||||
this.parent.insertBefore(this, cloned)
|
||||
return cloned
|
||||
}
|
||||
|
||||
error(message, opts = {}) {
|
||||
if (this.source) {
|
||||
let { end, start } = this.rangeBy(opts)
|
||||
return this.source.input.error(
|
||||
message,
|
||||
{ column: start.column, line: start.line },
|
||||
{ column: end.column, line: end.line },
|
||||
opts
|
||||
)
|
||||
}
|
||||
return new CssSyntaxError(message)
|
||||
}
|
||||
|
||||
getProxyProcessor() {
|
||||
return {
|
||||
get(node, prop) {
|
||||
if (prop === 'proxyOf') {
|
||||
return node
|
||||
} else if (prop === 'root') {
|
||||
return () => node.root().toProxy()
|
||||
} else {
|
||||
return node[prop]
|
||||
}
|
||||
},
|
||||
|
||||
set(node, prop, value) {
|
||||
if (node[prop] === value) return true
|
||||
node[prop] = value
|
||||
if (
|
||||
prop === 'prop' ||
|
||||
prop === 'value' ||
|
||||
prop === 'name' ||
|
||||
prop === 'params' ||
|
||||
prop === 'important' ||
|
||||
/* c8 ignore next */
|
||||
prop === 'text'
|
||||
) {
|
||||
node.markDirty()
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
markDirty() {
|
||||
if (this[isClean]) {
|
||||
this[isClean] = false
|
||||
let next = this
|
||||
while ((next = next.parent)) {
|
||||
next[isClean] = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next() {
|
||||
if (!this.parent) return undefined
|
||||
let index = this.parent.index(this)
|
||||
return this.parent.nodes[index + 1]
|
||||
}
|
||||
|
||||
positionBy(opts, stringRepresentation) {
|
||||
let pos = this.source.start
|
||||
if (opts.index) {
|
||||
pos = this.positionInside(opts.index, stringRepresentation)
|
||||
} else if (opts.word) {
|
||||
stringRepresentation = this.toString()
|
||||
let index = stringRepresentation.indexOf(opts.word)
|
||||
if (index !== -1) pos = this.positionInside(index, stringRepresentation)
|
||||
}
|
||||
return pos
|
||||
}
|
||||
|
||||
positionInside(index, stringRepresentation) {
|
||||
let string = stringRepresentation || this.toString()
|
||||
let column = this.source.start.column
|
||||
let line = this.source.start.line
|
||||
|
||||
for (let i = 0; i < index; i++) {
|
||||
if (string[i] === '\n') {
|
||||
column = 1
|
||||
line += 1
|
||||
} else {
|
||||
column += 1
|
||||
}
|
||||
}
|
||||
|
||||
return { column, line }
|
||||
}
|
||||
|
||||
prev() {
|
||||
if (!this.parent) return undefined
|
||||
let index = this.parent.index(this)
|
||||
return this.parent.nodes[index - 1]
|
||||
}
|
||||
|
||||
rangeBy(opts) {
|
||||
let start = {
|
||||
column: this.source.start.column,
|
||||
line: this.source.start.line
|
||||
}
|
||||
let end = this.source.end
|
||||
? {
|
||||
column: this.source.end.column + 1,
|
||||
line: this.source.end.line
|
||||
}
|
||||
: {
|
||||
column: start.column + 1,
|
||||
line: start.line
|
||||
}
|
||||
|
||||
if (opts.word) {
|
||||
let stringRepresentation = this.toString()
|
||||
let index = stringRepresentation.indexOf(opts.word)
|
||||
if (index !== -1) {
|
||||
start = this.positionInside(index, stringRepresentation)
|
||||
end = this.positionInside(index + opts.word.length, stringRepresentation)
|
||||
}
|
||||
} else {
|
||||
if (opts.start) {
|
||||
start = {
|
||||
column: opts.start.column,
|
||||
line: opts.start.line
|
||||
}
|
||||
} else if (opts.index) {
|
||||
start = this.positionInside(opts.index)
|
||||
}
|
||||
|
||||
if (opts.end) {
|
||||
end = {
|
||||
column: opts.end.column,
|
||||
line: opts.end.line
|
||||
}
|
||||
} else if (typeof opts.endIndex === 'number') {
|
||||
end = this.positionInside(opts.endIndex)
|
||||
} else if (opts.index) {
|
||||
end = this.positionInside(opts.index + 1)
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
end.line < start.line ||
|
||||
(end.line === start.line && end.column <= start.column)
|
||||
) {
|
||||
end = { column: start.column + 1, line: start.line }
|
||||
}
|
||||
|
||||
return { end, start }
|
||||
}
|
||||
|
||||
raw(prop, defaultType) {
|
||||
let str = new Stringifier()
|
||||
return str.raw(this, prop, defaultType)
|
||||
}
|
||||
|
||||
remove() {
|
||||
if (this.parent) {
|
||||
this.parent.removeChild(this)
|
||||
}
|
||||
this.parent = undefined
|
||||
return this
|
||||
}
|
||||
|
||||
replaceWith(...nodes) {
|
||||
if (this.parent) {
|
||||
let bookmark = this
|
||||
let foundSelf = false
|
||||
for (let node of nodes) {
|
||||
if (node === this) {
|
||||
foundSelf = true
|
||||
} else if (foundSelf) {
|
||||
this.parent.insertAfter(bookmark, node)
|
||||
bookmark = node
|
||||
} else {
|
||||
this.parent.insertBefore(bookmark, node)
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundSelf) {
|
||||
this.remove()
|
||||
}
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
root() {
|
||||
let result = this
|
||||
while (result.parent && result.parent.type !== 'document') {
|
||||
result = result.parent
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
toJSON(_, inputs) {
|
||||
let fixed = {}
|
||||
let emitInputs = inputs == null
|
||||
inputs = inputs || new Map()
|
||||
let inputsNextIndex = 0
|
||||
|
||||
for (let name in this) {
|
||||
if (!Object.prototype.hasOwnProperty.call(this, name)) {
|
||||
/* c8 ignore next 2 */
|
||||
continue
|
||||
}
|
||||
if (name === 'parent' || name === 'proxyCache') continue
|
||||
let value = this[name]
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
fixed[name] = value.map(i => {
|
||||
if (typeof i === 'object' && i.toJSON) {
|
||||
return i.toJSON(null, inputs)
|
||||
} else {
|
||||
return i
|
||||
}
|
||||
})
|
||||
} else if (typeof value === 'object' && value.toJSON) {
|
||||
fixed[name] = value.toJSON(null, inputs)
|
||||
} else if (name === 'source') {
|
||||
let inputId = inputs.get(value.input)
|
||||
if (inputId == null) {
|
||||
inputId = inputsNextIndex
|
||||
inputs.set(value.input, inputsNextIndex)
|
||||
inputsNextIndex++
|
||||
}
|
||||
fixed[name] = {
|
||||
end: value.end,
|
||||
inputId,
|
||||
start: value.start
|
||||
}
|
||||
} else {
|
||||
fixed[name] = value
|
||||
}
|
||||
}
|
||||
|
||||
if (emitInputs) {
|
||||
fixed.inputs = [...inputs.keys()].map(input => input.toJSON())
|
||||
}
|
||||
|
||||
return fixed
|
||||
}
|
||||
|
||||
toProxy() {
|
||||
if (!this.proxyCache) {
|
||||
this.proxyCache = new Proxy(this, this.getProxyProcessor())
|
||||
}
|
||||
return this.proxyCache
|
||||
}
|
||||
|
||||
toString(stringifier = stringify) {
|
||||
if (stringifier.stringify) stringifier = stringifier.stringify
|
||||
let result = ''
|
||||
stringifier(this, i => {
|
||||
result += i
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
warn(result, text, opts) {
|
||||
let data = { node: this }
|
||||
for (let i in opts) data[i] = opts[i]
|
||||
return result.warn(text, data)
|
||||
}
|
||||
|
||||
get proxyOf() {
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Node
|
||||
Node.default = Node
|
9
site/real_game/node_modules/postcss/lib/parse.d.ts
generated
vendored
Normal file
9
site/real_game/node_modules/postcss/lib/parse.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import { Parser } from './postcss.js'
|
||||
|
||||
interface Parse extends Parser {
|
||||
default: Parse
|
||||
}
|
||||
|
||||
declare const parse: Parse
|
||||
|
||||
export = parse
|
42
site/real_game/node_modules/postcss/lib/parse.js
generated
vendored
Normal file
42
site/real_game/node_modules/postcss/lib/parse.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
'use strict'
|
||||
|
||||
let Container = require('./container')
|
||||
let Parser = require('./parser')
|
||||
let Input = require('./input')
|
||||
|
||||
function parse(css, opts) {
|
||||
let input = new Input(css, opts)
|
||||
let parser = new Parser(input)
|
||||
try {
|
||||
parser.parse()
|
||||
} catch (e) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (e.name === 'CssSyntaxError' && opts && opts.from) {
|
||||
if (/\.scss$/i.test(opts.from)) {
|
||||
e.message +=
|
||||
'\nYou tried to parse SCSS with ' +
|
||||
'the standard CSS parser; ' +
|
||||
'try again with the postcss-scss parser'
|
||||
} else if (/\.sass/i.test(opts.from)) {
|
||||
e.message +=
|
||||
'\nYou tried to parse Sass with ' +
|
||||
'the standard CSS parser; ' +
|
||||
'try again with the postcss-sass parser'
|
||||
} else if (/\.less$/i.test(opts.from)) {
|
||||
e.message +=
|
||||
'\nYou tried to parse Less with ' +
|
||||
'the standard CSS parser; ' +
|
||||
'try again with the postcss-less parser'
|
||||
}
|
||||
}
|
||||
}
|
||||
throw e
|
||||
}
|
||||
|
||||
return parser.root
|
||||
}
|
||||
|
||||
module.exports = parse
|
||||
parse.default = parse
|
||||
|
||||
Container.registerParse(parse)
|
609
site/real_game/node_modules/postcss/lib/parser.js
generated
vendored
Normal file
609
site/real_game/node_modules/postcss/lib/parser.js
generated
vendored
Normal file
@ -0,0 +1,609 @@
|
||||
'use strict'
|
||||
|
||||
let Declaration = require('./declaration')
|
||||
let tokenizer = require('./tokenize')
|
||||
let Comment = require('./comment')
|
||||
let AtRule = require('./at-rule')
|
||||
let Root = require('./root')
|
||||
let Rule = require('./rule')
|
||||
|
||||
const SAFE_COMMENT_NEIGHBOR = {
|
||||
empty: true,
|
||||
space: true
|
||||
}
|
||||
|
||||
function findLastWithPosition(tokens) {
|
||||
for (let i = tokens.length - 1; i >= 0; i--) {
|
||||
let token = tokens[i]
|
||||
let pos = token[3] || token[2]
|
||||
if (pos) return pos
|
||||
}
|
||||
}
|
||||
|
||||
class Parser {
|
||||
constructor(input) {
|
||||
this.input = input
|
||||
|
||||
this.root = new Root()
|
||||
this.current = this.root
|
||||
this.spaces = ''
|
||||
this.semicolon = false
|
||||
|
||||
this.createTokenizer()
|
||||
this.root.source = { input, start: { column: 1, line: 1, offset: 0 } }
|
||||
}
|
||||
|
||||
atrule(token) {
|
||||
let node = new AtRule()
|
||||
node.name = token[1].slice(1)
|
||||
if (node.name === '') {
|
||||
this.unnamedAtrule(node, token)
|
||||
}
|
||||
this.init(node, token[2])
|
||||
|
||||
let type
|
||||
let prev
|
||||
let shift
|
||||
let last = false
|
||||
let open = false
|
||||
let params = []
|
||||
let brackets = []
|
||||
|
||||
while (!this.tokenizer.endOfFile()) {
|
||||
token = this.tokenizer.nextToken()
|
||||
type = token[0]
|
||||
|
||||
if (type === '(' || type === '[') {
|
||||
brackets.push(type === '(' ? ')' : ']')
|
||||
} else if (type === '{' && brackets.length > 0) {
|
||||
brackets.push('}')
|
||||
} else if (type === brackets[brackets.length - 1]) {
|
||||
brackets.pop()
|
||||
}
|
||||
|
||||
if (brackets.length === 0) {
|
||||
if (type === ';') {
|
||||
node.source.end = this.getPosition(token[2])
|
||||
node.source.end.offset++
|
||||
this.semicolon = true
|
||||
break
|
||||
} else if (type === '{') {
|
||||
open = true
|
||||
break
|
||||
} else if (type === '}') {
|
||||
if (params.length > 0) {
|
||||
shift = params.length - 1
|
||||
prev = params[shift]
|
||||
while (prev && prev[0] === 'space') {
|
||||
prev = params[--shift]
|
||||
}
|
||||
if (prev) {
|
||||
node.source.end = this.getPosition(prev[3] || prev[2])
|
||||
node.source.end.offset++
|
||||
}
|
||||
}
|
||||
this.end(token)
|
||||
break
|
||||
} else {
|
||||
params.push(token)
|
||||
}
|
||||
} else {
|
||||
params.push(token)
|
||||
}
|
||||
|
||||
if (this.tokenizer.endOfFile()) {
|
||||
last = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
node.raws.between = this.spacesAndCommentsFromEnd(params)
|
||||
if (params.length) {
|
||||
node.raws.afterName = this.spacesAndCommentsFromStart(params)
|
||||
this.raw(node, 'params', params)
|
||||
if (last) {
|
||||
token = params[params.length - 1]
|
||||
node.source.end = this.getPosition(token[3] || token[2])
|
||||
node.source.end.offset++
|
||||
this.spaces = node.raws.between
|
||||
node.raws.between = ''
|
||||
}
|
||||
} else {
|
||||
node.raws.afterName = ''
|
||||
node.params = ''
|
||||
}
|
||||
|
||||
if (open) {
|
||||
node.nodes = []
|
||||
this.current = node
|
||||
}
|
||||
}
|
||||
|
||||
checkMissedSemicolon(tokens) {
|
||||
let colon = this.colon(tokens)
|
||||
if (colon === false) return
|
||||
|
||||
let founded = 0
|
||||
let token
|
||||
for (let j = colon - 1; j >= 0; j--) {
|
||||
token = tokens[j]
|
||||
if (token[0] !== 'space') {
|
||||
founded += 1
|
||||
if (founded === 2) break
|
||||
}
|
||||
}
|
||||
// If the token is a word, e.g. `!important`, `red` or any other valid property's value.
|
||||
// Then we need to return the colon after that word token. [3] is the "end" colon of that word.
|
||||
// And because we need it after that one we do +1 to get the next one.
|
||||
throw this.input.error(
|
||||
'Missed semicolon',
|
||||
token[0] === 'word' ? token[3] + 1 : token[2]
|
||||
)
|
||||
}
|
||||
|
||||
colon(tokens) {
|
||||
let brackets = 0
|
||||
let token, type, prev
|
||||
for (let [i, element] of tokens.entries()) {
|
||||
token = element
|
||||
type = token[0]
|
||||
|
||||
if (type === '(') {
|
||||
brackets += 1
|
||||
}
|
||||
if (type === ')') {
|
||||
brackets -= 1
|
||||
}
|
||||
if (brackets === 0 && type === ':') {
|
||||
if (!prev) {
|
||||
this.doubleColon(token)
|
||||
} else if (prev[0] === 'word' && prev[1] === 'progid') {
|
||||
continue
|
||||
} else {
|
||||
return i
|
||||
}
|
||||
}
|
||||
|
||||
prev = token
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
comment(token) {
|
||||
let node = new Comment()
|
||||
this.init(node, token[2])
|
||||
node.source.end = this.getPosition(token[3] || token[2])
|
||||
node.source.end.offset++
|
||||
|
||||
let text = token[1].slice(2, -2)
|
||||
if (/^\s*$/.test(text)) {
|
||||
node.text = ''
|
||||
node.raws.left = text
|
||||
node.raws.right = ''
|
||||
} else {
|
||||
let match = text.match(/^(\s*)([^]*\S)(\s*)$/)
|
||||
node.text = match[2]
|
||||
node.raws.left = match[1]
|
||||
node.raws.right = match[3]
|
||||
}
|
||||
}
|
||||
|
||||
createTokenizer() {
|
||||
this.tokenizer = tokenizer(this.input)
|
||||
}
|
||||
|
||||
decl(tokens, customProperty) {
|
||||
let node = new Declaration()
|
||||
this.init(node, tokens[0][2])
|
||||
|
||||
let last = tokens[tokens.length - 1]
|
||||
if (last[0] === ';') {
|
||||
this.semicolon = true
|
||||
tokens.pop()
|
||||
}
|
||||
|
||||
node.source.end = this.getPosition(
|
||||
last[3] || last[2] || findLastWithPosition(tokens)
|
||||
)
|
||||
node.source.end.offset++
|
||||
|
||||
while (tokens[0][0] !== 'word') {
|
||||
if (tokens.length === 1) this.unknownWord(tokens)
|
||||
node.raws.before += tokens.shift()[1]
|
||||
}
|
||||
node.source.start = this.getPosition(tokens[0][2])
|
||||
|
||||
node.prop = ''
|
||||
while (tokens.length) {
|
||||
let type = tokens[0][0]
|
||||
if (type === ':' || type === 'space' || type === 'comment') {
|
||||
break
|
||||
}
|
||||
node.prop += tokens.shift()[1]
|
||||
}
|
||||
|
||||
node.raws.between = ''
|
||||
|
||||
let token
|
||||
while (tokens.length) {
|
||||
token = tokens.shift()
|
||||
|
||||
if (token[0] === ':') {
|
||||
node.raws.between += token[1]
|
||||
break
|
||||
} else {
|
||||
if (token[0] === 'word' && /\w/.test(token[1])) {
|
||||
this.unknownWord([token])
|
||||
}
|
||||
node.raws.between += token[1]
|
||||
}
|
||||
}
|
||||
|
||||
if (node.prop[0] === '_' || node.prop[0] === '*') {
|
||||
node.raws.before += node.prop[0]
|
||||
node.prop = node.prop.slice(1)
|
||||
}
|
||||
|
||||
let firstSpaces = []
|
||||
let next
|
||||
while (tokens.length) {
|
||||
next = tokens[0][0]
|
||||
if (next !== 'space' && next !== 'comment') break
|
||||
firstSpaces.push(tokens.shift())
|
||||
}
|
||||
|
||||
this.precheckMissedSemicolon(tokens)
|
||||
|
||||
for (let i = tokens.length - 1; i >= 0; i--) {
|
||||
token = tokens[i]
|
||||
if (token[1].toLowerCase() === '!important') {
|
||||
node.important = true
|
||||
let string = this.stringFrom(tokens, i)
|
||||
string = this.spacesFromEnd(tokens) + string
|
||||
if (string !== ' !important') node.raws.important = string
|
||||
break
|
||||
} else if (token[1].toLowerCase() === 'important') {
|
||||
let cache = tokens.slice(0)
|
||||
let str = ''
|
||||
for (let j = i; j > 0; j--) {
|
||||
let type = cache[j][0]
|
||||
if (str.trim().indexOf('!') === 0 && type !== 'space') {
|
||||
break
|
||||
}
|
||||
str = cache.pop()[1] + str
|
||||
}
|
||||
if (str.trim().indexOf('!') === 0) {
|
||||
node.important = true
|
||||
node.raws.important = str
|
||||
tokens = cache
|
||||
}
|
||||
}
|
||||
|
||||
if (token[0] !== 'space' && token[0] !== 'comment') {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment')
|
||||
|
||||
if (hasWord) {
|
||||
node.raws.between += firstSpaces.map(i => i[1]).join('')
|
||||
firstSpaces = []
|
||||
}
|
||||
this.raw(node, 'value', firstSpaces.concat(tokens), customProperty)
|
||||
|
||||
if (node.value.includes(':') && !customProperty) {
|
||||
this.checkMissedSemicolon(tokens)
|
||||
}
|
||||
}
|
||||
|
||||
doubleColon(token) {
|
||||
throw this.input.error(
|
||||
'Double colon',
|
||||
{ offset: token[2] },
|
||||
{ offset: token[2] + token[1].length }
|
||||
)
|
||||
}
|
||||
|
||||
emptyRule(token) {
|
||||
let node = new Rule()
|
||||
this.init(node, token[2])
|
||||
node.selector = ''
|
||||
node.raws.between = ''
|
||||
this.current = node
|
||||
}
|
||||
|
||||
end(token) {
|
||||
if (this.current.nodes && this.current.nodes.length) {
|
||||
this.current.raws.semicolon = this.semicolon
|
||||
}
|
||||
this.semicolon = false
|
||||
|
||||
this.current.raws.after = (this.current.raws.after || '') + this.spaces
|
||||
this.spaces = ''
|
||||
|
||||
if (this.current.parent) {
|
||||
this.current.source.end = this.getPosition(token[2])
|
||||
this.current.source.end.offset++
|
||||
this.current = this.current.parent
|
||||
} else {
|
||||
this.unexpectedClose(token)
|
||||
}
|
||||
}
|
||||
|
||||
endFile() {
|
||||
if (this.current.parent) this.unclosedBlock()
|
||||
if (this.current.nodes && this.current.nodes.length) {
|
||||
this.current.raws.semicolon = this.semicolon
|
||||
}
|
||||
this.current.raws.after = (this.current.raws.after || '') + this.spaces
|
||||
this.root.source.end = this.getPosition(this.tokenizer.position())
|
||||
}
|
||||
|
||||
freeSemicolon(token) {
|
||||
this.spaces += token[1]
|
||||
if (this.current.nodes) {
|
||||
let prev = this.current.nodes[this.current.nodes.length - 1]
|
||||
if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) {
|
||||
prev.raws.ownSemicolon = this.spaces
|
||||
this.spaces = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Helpers
|
||||
|
||||
getPosition(offset) {
|
||||
let pos = this.input.fromOffset(offset)
|
||||
return {
|
||||
column: pos.col,
|
||||
line: pos.line,
|
||||
offset
|
||||
}
|
||||
}
|
||||
|
||||
init(node, offset) {
|
||||
this.current.push(node)
|
||||
node.source = {
|
||||
input: this.input,
|
||||
start: this.getPosition(offset)
|
||||
}
|
||||
node.raws.before = this.spaces
|
||||
this.spaces = ''
|
||||
if (node.type !== 'comment') this.semicolon = false
|
||||
}
|
||||
|
||||
other(start) {
|
||||
let end = false
|
||||
let type = null
|
||||
let colon = false
|
||||
let bracket = null
|
||||
let brackets = []
|
||||
let customProperty = start[1].startsWith('--')
|
||||
|
||||
let tokens = []
|
||||
let token = start
|
||||
while (token) {
|
||||
type = token[0]
|
||||
tokens.push(token)
|
||||
|
||||
if (type === '(' || type === '[') {
|
||||
if (!bracket) bracket = token
|
||||
brackets.push(type === '(' ? ')' : ']')
|
||||
} else if (customProperty && colon && type === '{') {
|
||||
if (!bracket) bracket = token
|
||||
brackets.push('}')
|
||||
} else if (brackets.length === 0) {
|
||||
if (type === ';') {
|
||||
if (colon) {
|
||||
this.decl(tokens, customProperty)
|
||||
return
|
||||
} else {
|
||||
break
|
||||
}
|
||||
} else if (type === '{') {
|
||||
this.rule(tokens)
|
||||
return
|
||||
} else if (type === '}') {
|
||||
this.tokenizer.back(tokens.pop())
|
||||
end = true
|
||||
break
|
||||
} else if (type === ':') {
|
||||
colon = true
|
||||
}
|
||||
} else if (type === brackets[brackets.length - 1]) {
|
||||
brackets.pop()
|
||||
if (brackets.length === 0) bracket = null
|
||||
}
|
||||
|
||||
token = this.tokenizer.nextToken()
|
||||
}
|
||||
|
||||
if (this.tokenizer.endOfFile()) end = true
|
||||
if (brackets.length > 0) this.unclosedBracket(bracket)
|
||||
|
||||
if (end && colon) {
|
||||
if (!customProperty) {
|
||||
while (tokens.length) {
|
||||
token = tokens[tokens.length - 1][0]
|
||||
if (token !== 'space' && token !== 'comment') break
|
||||
this.tokenizer.back(tokens.pop())
|
||||
}
|
||||
}
|
||||
this.decl(tokens, customProperty)
|
||||
} else {
|
||||
this.unknownWord(tokens)
|
||||
}
|
||||
}
|
||||
|
||||
parse() {
|
||||
let token
|
||||
while (!this.tokenizer.endOfFile()) {
|
||||
token = this.tokenizer.nextToken()
|
||||
|
||||
switch (token[0]) {
|
||||
case 'space':
|
||||
this.spaces += token[1]
|
||||
break
|
||||
|
||||
case ';':
|
||||
this.freeSemicolon(token)
|
||||
break
|
||||
|
||||
case '}':
|
||||
this.end(token)
|
||||
break
|
||||
|
||||
case 'comment':
|
||||
this.comment(token)
|
||||
break
|
||||
|
||||
case 'at-word':
|
||||
this.atrule(token)
|
||||
break
|
||||
|
||||
case '{':
|
||||
this.emptyRule(token)
|
||||
break
|
||||
|
||||
default:
|
||||
this.other(token)
|
||||
break
|
||||
}
|
||||
}
|
||||
this.endFile()
|
||||
}
|
||||
|
||||
precheckMissedSemicolon(/* tokens */) {
|
||||
// Hook for Safe Parser
|
||||
}
|
||||
|
||||
raw(node, prop, tokens, customProperty) {
|
||||
let token, type
|
||||
let length = tokens.length
|
||||
let value = ''
|
||||
let clean = true
|
||||
let next, prev
|
||||
|
||||
for (let i = 0; i < length; i += 1) {
|
||||
token = tokens[i]
|
||||
type = token[0]
|
||||
if (type === 'space' && i === length - 1 && !customProperty) {
|
||||
clean = false
|
||||
} else if (type === 'comment') {
|
||||
prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty'
|
||||
next = tokens[i + 1] ? tokens[i + 1][0] : 'empty'
|
||||
if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {
|
||||
if (value.slice(-1) === ',') {
|
||||
clean = false
|
||||
} else {
|
||||
value += token[1]
|
||||
}
|
||||
} else {
|
||||
clean = false
|
||||
}
|
||||
} else {
|
||||
value += token[1]
|
||||
}
|
||||
}
|
||||
if (!clean) {
|
||||
let raw = tokens.reduce((all, i) => all + i[1], '')
|
||||
node.raws[prop] = { raw, value }
|
||||
}
|
||||
node[prop] = value
|
||||
}
|
||||
|
||||
rule(tokens) {
|
||||
tokens.pop()
|
||||
|
||||
let node = new Rule()
|
||||
this.init(node, tokens[0][2])
|
||||
|
||||
node.raws.between = this.spacesAndCommentsFromEnd(tokens)
|
||||
this.raw(node, 'selector', tokens)
|
||||
this.current = node
|
||||
}
|
||||
|
||||
spacesAndCommentsFromEnd(tokens) {
|
||||
let lastTokenType
|
||||
let spaces = ''
|
||||
while (tokens.length) {
|
||||
lastTokenType = tokens[tokens.length - 1][0]
|
||||
if (lastTokenType !== 'space' && lastTokenType !== 'comment') break
|
||||
spaces = tokens.pop()[1] + spaces
|
||||
}
|
||||
return spaces
|
||||
}
|
||||
|
||||
// Errors
|
||||
|
||||
spacesAndCommentsFromStart(tokens) {
|
||||
let next
|
||||
let spaces = ''
|
||||
while (tokens.length) {
|
||||
next = tokens[0][0]
|
||||
if (next !== 'space' && next !== 'comment') break
|
||||
spaces += tokens.shift()[1]
|
||||
}
|
||||
return spaces
|
||||
}
|
||||
|
||||
spacesFromEnd(tokens) {
|
||||
let lastTokenType
|
||||
let spaces = ''
|
||||
while (tokens.length) {
|
||||
lastTokenType = tokens[tokens.length - 1][0]
|
||||
if (lastTokenType !== 'space') break
|
||||
spaces = tokens.pop()[1] + spaces
|
||||
}
|
||||
return spaces
|
||||
}
|
||||
|
||||
stringFrom(tokens, from) {
|
||||
let result = ''
|
||||
for (let i = from; i < tokens.length; i++) {
|
||||
result += tokens[i][1]
|
||||
}
|
||||
tokens.splice(from, tokens.length - from)
|
||||
return result
|
||||
}
|
||||
|
||||
unclosedBlock() {
|
||||
let pos = this.current.source.start
|
||||
throw this.input.error('Unclosed block', pos.line, pos.column)
|
||||
}
|
||||
|
||||
unclosedBracket(bracket) {
|
||||
throw this.input.error(
|
||||
'Unclosed bracket',
|
||||
{ offset: bracket[2] },
|
||||
{ offset: bracket[2] + 1 }
|
||||
)
|
||||
}
|
||||
|
||||
unexpectedClose(token) {
|
||||
throw this.input.error(
|
||||
'Unexpected }',
|
||||
{ offset: token[2] },
|
||||
{ offset: token[2] + 1 }
|
||||
)
|
||||
}
|
||||
|
||||
unknownWord(tokens) {
|
||||
throw this.input.error(
|
||||
'Unknown word',
|
||||
{ offset: tokens[0][2] },
|
||||
{ offset: tokens[0][2] + tokens[0][1].length }
|
||||
)
|
||||
}
|
||||
|
||||
unnamedAtrule(node, token) {
|
||||
throw this.input.error(
|
||||
'At-rule without name',
|
||||
{ offset: token[2] },
|
||||
{ offset: token[2] + token[1].length }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Parser
|
69
site/real_game/node_modules/postcss/lib/postcss.d.mts
generated
vendored
Normal file
69
site/real_game/node_modules/postcss/lib/postcss.d.mts
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
export {
|
||||
// postcss function / namespace
|
||||
default,
|
||||
|
||||
// Value exports from postcss.mjs
|
||||
stringify,
|
||||
fromJSON,
|
||||
// @ts-expect-error This value exists, but it’s untyped.
|
||||
plugin,
|
||||
parse,
|
||||
list,
|
||||
document,
|
||||
comment,
|
||||
atRule,
|
||||
rule,
|
||||
decl,
|
||||
root,
|
||||
CssSyntaxError,
|
||||
Declaration,
|
||||
Container,
|
||||
Processor,
|
||||
Document,
|
||||
Comment,
|
||||
Warning,
|
||||
AtRule,
|
||||
Result,
|
||||
Input,
|
||||
Rule,
|
||||
Root,
|
||||
Node,
|
||||
|
||||
// Type-only exports
|
||||
AcceptedPlugin,
|
||||
AnyNode,
|
||||
AtRuleProps,
|
||||
Builder,
|
||||
ChildNode,
|
||||
ChildProps,
|
||||
CommentProps,
|
||||
ContainerProps,
|
||||
DeclarationProps,
|
||||
DocumentProps,
|
||||
FilePosition,
|
||||
Helpers,
|
||||
JSONHydrator,
|
||||
Message,
|
||||
NodeErrorOptions,
|
||||
NodeProps,
|
||||
OldPlugin,
|
||||
Parser,
|
||||
Plugin,
|
||||
PluginCreator,
|
||||
Position,
|
||||
Postcss,
|
||||
ProcessOptions,
|
||||
RootProps,
|
||||
RuleProps,
|
||||
Source,
|
||||
SourceMap,
|
||||
SourceMapOptions,
|
||||
Stringifier,
|
||||
Syntax,
|
||||
TransformCallback,
|
||||
Transformer,
|
||||
WarningOptions,
|
||||
|
||||
// This is a class, but it’s not re-exported. That’s why it’s exported as type-only here.
|
||||
type LazyResult
|
||||
} from './postcss.js'
|
450
site/real_game/node_modules/postcss/lib/postcss.d.ts
generated
vendored
Normal file
450
site/real_game/node_modules/postcss/lib/postcss.d.ts
generated
vendored
Normal file
@ -0,0 +1,450 @@
|
||||
import { RawSourceMap, SourceMapGenerator } from 'source-map-js'
|
||||
|
||||
import AtRule, { AtRuleProps } from './at-rule.js'
|
||||
import Comment, { CommentProps } from './comment.js'
|
||||
import Container, { ContainerProps } from './container.js'
|
||||
import CssSyntaxError from './css-syntax-error.js'
|
||||
import Declaration, { DeclarationProps } from './declaration.js'
|
||||
import Document, { DocumentProps } from './document.js'
|
||||
import Input, { FilePosition } from './input.js'
|
||||
import LazyResult from './lazy-result.js'
|
||||
import list from './list.js'
|
||||
import Node, {
|
||||
AnyNode,
|
||||
ChildNode,
|
||||
ChildProps,
|
||||
NodeErrorOptions,
|
||||
NodeProps,
|
||||
Position,
|
||||
Source
|
||||
} from './node.js'
|
||||
import Processor from './processor.js'
|
||||
import Result, { Message } from './result.js'
|
||||
import Root, { RootProps } from './root.js'
|
||||
import Rule, { RuleProps } from './rule.js'
|
||||
import Warning, { WarningOptions } from './warning.js'
|
||||
|
||||
type DocumentProcessor = (
|
||||
document: Document,
|
||||
helper: postcss.Helpers
|
||||
) => Promise<void> | void
|
||||
type RootProcessor = (
|
||||
root: Root,
|
||||
helper: postcss.Helpers
|
||||
) => Promise<void> | void
|
||||
type DeclarationProcessor = (
|
||||
decl: Declaration,
|
||||
helper: postcss.Helpers
|
||||
) => Promise<void> | void
|
||||
type RuleProcessor = (
|
||||
rule: Rule,
|
||||
helper: postcss.Helpers
|
||||
) => Promise<void> | void
|
||||
type AtRuleProcessor = (
|
||||
atRule: AtRule,
|
||||
helper: postcss.Helpers
|
||||
) => Promise<void> | void
|
||||
type CommentProcessor = (
|
||||
comment: Comment,
|
||||
helper: postcss.Helpers
|
||||
) => Promise<void> | void
|
||||
|
||||
interface Processors {
|
||||
/**
|
||||
* Will be called on all`AtRule` nodes.
|
||||
*
|
||||
* Will be called again on node or children changes.
|
||||
*/
|
||||
AtRule?: { [name: string]: AtRuleProcessor } | AtRuleProcessor
|
||||
|
||||
/**
|
||||
* Will be called on all `AtRule` nodes, when all children will be processed.
|
||||
*
|
||||
* Will be called again on node or children changes.
|
||||
*/
|
||||
AtRuleExit?: { [name: string]: AtRuleProcessor } | AtRuleProcessor
|
||||
|
||||
/**
|
||||
* Will be called on all `Comment` nodes.
|
||||
*
|
||||
* Will be called again on node or children changes.
|
||||
*/
|
||||
Comment?: CommentProcessor
|
||||
|
||||
/**
|
||||
* Will be called on all `Comment` nodes after listeners
|
||||
* for `Comment` event.
|
||||
*
|
||||
* Will be called again on node or children changes.
|
||||
*/
|
||||
CommentExit?: CommentProcessor
|
||||
|
||||
/**
|
||||
* Will be called on all `Declaration` nodes after listeners
|
||||
* for `Declaration` event.
|
||||
*
|
||||
* Will be called again on node or children changes.
|
||||
*/
|
||||
Declaration?: { [prop: string]: DeclarationProcessor } | DeclarationProcessor
|
||||
|
||||
/**
|
||||
* Will be called on all `Declaration` nodes.
|
||||
*
|
||||
* Will be called again on node or children changes.
|
||||
*/
|
||||
DeclarationExit?:
|
||||
| { [prop: string]: DeclarationProcessor }
|
||||
| DeclarationProcessor
|
||||
|
||||
/**
|
||||
* Will be called on `Document` node.
|
||||
*
|
||||
* Will be called again on children changes.
|
||||
*/
|
||||
Document?: DocumentProcessor
|
||||
|
||||
/**
|
||||
* Will be called on `Document` node, when all children will be processed.
|
||||
*
|
||||
* Will be called again on children changes.
|
||||
*/
|
||||
DocumentExit?: DocumentProcessor
|
||||
|
||||
/**
|
||||
* Will be called on `Root` node once.
|
||||
*/
|
||||
Once?: RootProcessor
|
||||
|
||||
/**
|
||||
* Will be called on `Root` node once, when all children will be processed.
|
||||
*/
|
||||
OnceExit?: RootProcessor
|
||||
|
||||
/**
|
||||
* Will be called on `Root` node.
|
||||
*
|
||||
* Will be called again on children changes.
|
||||
*/
|
||||
Root?: RootProcessor
|
||||
|
||||
/**
|
||||
* Will be called on `Root` node, when all children will be processed.
|
||||
*
|
||||
* Will be called again on children changes.
|
||||
*/
|
||||
RootExit?: RootProcessor
|
||||
|
||||
/**
|
||||
* Will be called on all `Rule` nodes.
|
||||
*
|
||||
* Will be called again on node or children changes.
|
||||
*/
|
||||
Rule?: RuleProcessor
|
||||
|
||||
/**
|
||||
* Will be called on all `Rule` nodes, when all children will be processed.
|
||||
*
|
||||
* Will be called again on node or children changes.
|
||||
*/
|
||||
RuleExit?: RuleProcessor
|
||||
}
|
||||
|
||||
declare namespace postcss {
|
||||
export {
|
||||
AnyNode,
|
||||
AtRule,
|
||||
AtRuleProps,
|
||||
ChildNode,
|
||||
ChildProps,
|
||||
Comment,
|
||||
CommentProps,
|
||||
Container,
|
||||
ContainerProps,
|
||||
CssSyntaxError,
|
||||
Declaration,
|
||||
DeclarationProps,
|
||||
Document,
|
||||
DocumentProps,
|
||||
FilePosition,
|
||||
Input,
|
||||
LazyResult,
|
||||
list,
|
||||
Message,
|
||||
Node,
|
||||
NodeErrorOptions,
|
||||
NodeProps,
|
||||
Position,
|
||||
Processor,
|
||||
Result,
|
||||
Root,
|
||||
RootProps,
|
||||
Rule,
|
||||
RuleProps,
|
||||
Source,
|
||||
Warning,
|
||||
WarningOptions
|
||||
}
|
||||
|
||||
export type SourceMap = {
|
||||
toJSON(): RawSourceMap
|
||||
} & SourceMapGenerator
|
||||
|
||||
export type Helpers = { postcss: Postcss; result: Result } & Postcss
|
||||
|
||||
export interface Plugin extends Processors {
|
||||
postcssPlugin: string
|
||||
prepare?: (result: Result) => Processors
|
||||
}
|
||||
|
||||
export interface PluginCreator<PluginOptions> {
|
||||
(opts?: PluginOptions): Plugin | Processor
|
||||
postcss: true
|
||||
}
|
||||
|
||||
export interface Transformer extends TransformCallback {
|
||||
postcssPlugin: string
|
||||
postcssVersion: string
|
||||
}
|
||||
|
||||
export interface TransformCallback {
|
||||
(root: Root, result: Result): Promise<void> | void
|
||||
}
|
||||
|
||||
export interface OldPlugin<T> extends Transformer {
|
||||
(opts?: T): Transformer
|
||||
postcss: Transformer
|
||||
}
|
||||
|
||||
export type AcceptedPlugin =
|
||||
| {
|
||||
postcss: Processor | TransformCallback
|
||||
}
|
||||
| OldPlugin<any>
|
||||
| Plugin
|
||||
| PluginCreator<any>
|
||||
| Processor
|
||||
| TransformCallback
|
||||
|
||||
export interface Parser<RootNode = Document | Root> {
|
||||
(
|
||||
css: { toString(): string } | string,
|
||||
opts?: Pick<ProcessOptions, 'from' | 'map'>
|
||||
): RootNode
|
||||
}
|
||||
|
||||
export interface Builder {
|
||||
(part: string, node?: AnyNode, type?: 'end' | 'start'): void
|
||||
}
|
||||
|
||||
export interface Stringifier {
|
||||
(node: AnyNode, builder: Builder): void
|
||||
}
|
||||
|
||||
export interface JSONHydrator {
|
||||
(data: object): Node
|
||||
(data: object[]): Node[]
|
||||
}
|
||||
|
||||
export interface Syntax<RootNode = Document | Root> {
|
||||
/**
|
||||
* Function to generate AST by string.
|
||||
*/
|
||||
parse?: Parser<RootNode>
|
||||
|
||||
/**
|
||||
* Class to generate string by AST.
|
||||
*/
|
||||
stringify?: Stringifier
|
||||
}
|
||||
|
||||
export interface SourceMapOptions {
|
||||
/**
|
||||
* Use absolute path in generated source map.
|
||||
*/
|
||||
absolute?: boolean
|
||||
|
||||
/**
|
||||
* Indicates that PostCSS should add annotation comments to the CSS.
|
||||
* By default, PostCSS will always add a comment with a path
|
||||
* to the source map. PostCSS will not add annotations to CSS files
|
||||
* that do not contain any comments.
|
||||
*
|
||||
* By default, PostCSS presumes that you want to save the source map as
|
||||
* `opts.to + '.map'` and will use this path in the annotation comment.
|
||||
* A different path can be set by providing a string value for annotation.
|
||||
*
|
||||
* If you have set `inline: true`, annotation cannot be disabled.
|
||||
*/
|
||||
annotation?: ((file: string, root: Root) => string) | boolean | string
|
||||
|
||||
/**
|
||||
* Override `from` in map’s sources.
|
||||
*/
|
||||
from?: string
|
||||
|
||||
/**
|
||||
* Indicates that the source map should be embedded in the output CSS
|
||||
* as a Base64-encoded comment. By default, it is `true`.
|
||||
* But if all previous maps are external, not inline, PostCSS will not embed
|
||||
* the map even if you do not set this option.
|
||||
*
|
||||
* If you have an inline source map, the result.map property will be empty,
|
||||
* as the source map will be contained within the text of `result.css`.
|
||||
*/
|
||||
inline?: boolean
|
||||
|
||||
/**
|
||||
* Source map content from a previous processing step (e.g., Sass).
|
||||
*
|
||||
* PostCSS will try to read the previous source map
|
||||
* automatically (based on comments within the source CSS), but you can use
|
||||
* this option to identify it manually.
|
||||
*
|
||||
* If desired, you can omit the previous map with prev: `false`.
|
||||
*/
|
||||
prev?: ((file: string) => string) | boolean | object | string
|
||||
|
||||
/**
|
||||
* Indicates that PostCSS should set the origin content (e.g., Sass source)
|
||||
* of the source map. By default, it is true. But if all previous maps do not
|
||||
* contain sources content, PostCSS will also leave it out even if you
|
||||
* do not set this option.
|
||||
*/
|
||||
sourcesContent?: boolean
|
||||
}
|
||||
|
||||
export interface ProcessOptions<RootNode = Document | Root> {
|
||||
/**
|
||||
* The path of the CSS source file. You should always set `from`,
|
||||
* because it is used in source map generation and syntax error messages.
|
||||
*/
|
||||
from?: string | undefined
|
||||
|
||||
/**
|
||||
* Source map options
|
||||
*/
|
||||
map?: boolean | SourceMapOptions
|
||||
|
||||
/**
|
||||
* Function to generate AST by string.
|
||||
*/
|
||||
parser?: Parser<RootNode> | Syntax<RootNode>
|
||||
|
||||
/**
|
||||
* Class to generate string by AST.
|
||||
*/
|
||||
stringifier?: Stringifier | Syntax<RootNode>
|
||||
|
||||
/**
|
||||
* Object with parse and stringify.
|
||||
*/
|
||||
syntax?: Syntax<RootNode>
|
||||
|
||||
/**
|
||||
* The path where you'll put the output CSS file. You should always set `to`
|
||||
* to generate correct source maps.
|
||||
*/
|
||||
to?: string
|
||||
}
|
||||
|
||||
export type Postcss = typeof postcss
|
||||
|
||||
/**
|
||||
* Default function to convert a node tree into a CSS string.
|
||||
*/
|
||||
export let stringify: Stringifier
|
||||
|
||||
/**
|
||||
* Parses source css and returns a new `Root` or `Document` node,
|
||||
* which contains the source CSS nodes.
|
||||
*
|
||||
* ```js
|
||||
* // Simple CSS concatenation with source map support
|
||||
* const root1 = postcss.parse(css1, { from: file1 })
|
||||
* const root2 = postcss.parse(css2, { from: file2 })
|
||||
* root1.append(root2).toResult().css
|
||||
* ```
|
||||
*/
|
||||
export let parse: Parser<Root>
|
||||
|
||||
/**
|
||||
* Rehydrate a JSON AST (from `Node#toJSON`) back into the AST classes.
|
||||
*
|
||||
* ```js
|
||||
* const json = root.toJSON()
|
||||
* // save to file, send by network, etc
|
||||
* const root2 = postcss.fromJSON(json)
|
||||
* ```
|
||||
*/
|
||||
export let fromJSON: JSONHydrator
|
||||
|
||||
/**
|
||||
* Creates a new `Comment` node.
|
||||
*
|
||||
* @param defaults Properties for the new node.
|
||||
* @return New comment node
|
||||
*/
|
||||
export function comment(defaults?: CommentProps): Comment
|
||||
|
||||
/**
|
||||
* Creates a new `AtRule` node.
|
||||
*
|
||||
* @param defaults Properties for the new node.
|
||||
* @return New at-rule node.
|
||||
*/
|
||||
export function atRule(defaults?: AtRuleProps): AtRule
|
||||
|
||||
/**
|
||||
* Creates a new `Declaration` node.
|
||||
*
|
||||
* @param defaults Properties for the new node.
|
||||
* @return New declaration node.
|
||||
*/
|
||||
export function decl(defaults?: DeclarationProps): Declaration
|
||||
|
||||
/**
|
||||
* Creates a new `Rule` node.
|
||||
*
|
||||
* @param default Properties for the new node.
|
||||
* @return New rule node.
|
||||
*/
|
||||
export function rule(defaults?: RuleProps): Rule
|
||||
|
||||
/**
|
||||
* Creates a new `Root` node.
|
||||
*
|
||||
* @param defaults Properties for the new node.
|
||||
* @return New root node.
|
||||
*/
|
||||
export function root(defaults?: RootProps): Root
|
||||
|
||||
/**
|
||||
* Creates a new `Document` node.
|
||||
*
|
||||
* @param defaults Properties for the new node.
|
||||
* @return New document node.
|
||||
*/
|
||||
export function document(defaults?: DocumentProps): Document
|
||||
|
||||
export { postcss as default }
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new `Processor` instance that will apply `plugins`
|
||||
* as CSS processors.
|
||||
*
|
||||
* ```js
|
||||
* let postcss = require('postcss')
|
||||
*
|
||||
* postcss(plugins).process(css, { from, to }).then(result => {
|
||||
* console.log(result.css)
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @param plugins PostCSS plugins.
|
||||
* @return Processor to process multiple CSS.
|
||||
*/
|
||||
declare function postcss(plugins?: postcss.AcceptedPlugin[]): Processor
|
||||
declare function postcss(...plugins: postcss.AcceptedPlugin[]): Processor
|
||||
|
||||
export = postcss
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user