lab 2-5
248
Lab2/admin.html
Normal file
@ -0,0 +1,248 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Админка</title>
|
||||
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet" />
|
||||
<link href="css/admin.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-lg sticky-top">
|
||||
<div class="container">
|
||||
<a href="index.html" class="navbar-brand"><img class="brand" src="img/Logo.png"></a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarResponsive">
|
||||
<ul class="navbar-nav me-auto mt-xxl-5">
|
||||
<li class="nav-item">
|
||||
<a href="tv.html" class="nav-link px-4 mx-3">ТВ-каналы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="film.html" class="nav-link px-4 mx-3">Фильмы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="serial.html" class="nav-link px-4 mx-3">Сериалы</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navv" id="navbarResponsive">
|
||||
<ul class="navbar-nav mb-xxl-3">
|
||||
<!-- <li class="nav-item">
|
||||
<a href="#" class="nav-link px-3 mx-2">
|
||||
<img src="img/" alt="VK">
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link px-3 mx-2">
|
||||
<img src="img/" alt="Tg">
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link px-3 mx-2">
|
||||
<img src="img/" alt="Inst">
|
||||
</a>
|
||||
</li> -->
|
||||
<li class="nav-item">
|
||||
<a href="reg.html" class="nav-link px-3 mx-2">Регистрация</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="in.html" class="nav-link px-3 mx-2">Вход</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
|
||||
<!-- <section class="section back admin" style=" font-family: 'Times New Roman', Times, serif !important; font-weight: 600 !important;">
|
||||
<div class="container">
|
||||
<button class="btn btn-primary mb-1 btn-text-adm btn-dob" type="submit" >Добавить пользователя</button>
|
||||
<table class="table table-bordered">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th scope="col">ID</th>
|
||||
<th scope="col">Ф.И.О.</th>
|
||||
<th scope="col">Почта</th>
|
||||
<th scope="col">Номер телефона</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">1</th>
|
||||
<td>Лобашов Иван Дмитриевич</td>
|
||||
<td>ex@mail.ru</td>
|
||||
<td>37625</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section> -->
|
||||
<section class="section back admin">
|
||||
<div class="container">
|
||||
<div class="btn-group" role="group">
|
||||
<button id="items-add" class="btn btn-primary mb-1 btn-text-adm btn-dob">Добавить фильм, сериал или телеканал</button>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<table id="items-table" class="table table-striped">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th scope="col">ID</th>
|
||||
<th scope="col">Тип</th>
|
||||
<th scope="col">Возврастн. кат.</th>
|
||||
<th scope="col">Название</th>
|
||||
<th scope="col">Жанр</th>
|
||||
<th scope="col">Оценка</th>
|
||||
<th scope="col"></th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer class="text-center text_">
|
||||
|
||||
<section class="">
|
||||
<div class="container text-center text-md-start mt-4 pt-5">
|
||||
<a href="#" class="navbar-brand"><img class="brand" src="img/Logo.png"></a>
|
||||
|
||||
<div class="row mt-3">
|
||||
|
||||
<div class="col-md-3 col-lg-4 col-xl-2 mx-auto mb-4">
|
||||
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1"> Тех. поддержка</h6>
|
||||
<p>
|
||||
Ответим на любой ваш вопрос!
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">vano00189@mail.ru</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-lg-3 col-xl-2 mx-auto mb-4">
|
||||
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1">Для гостей </h6>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Акции и скидки</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Подарочные карты</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Пользовательское соглашение</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 col-lg-2 col-xl-2 mx-auto mb-4">
|
||||
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1" >О нас</h6>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Контакты</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Помощь</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Партнерам</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-lg-3 col-xl-2 mx-auto mb-4 ">
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1">Мы в соц. сетях</h6>
|
||||
<div class="social-icons">
|
||||
<a href="#" class="text-reset me-3"><img src="img/vk.png" alt="vk" class="rounded border border-dark"></a>
|
||||
<a href="#" class="text-reset me-3"><img src="img/tg.png" alt="tg" class="rounded border border-dark"></a>
|
||||
<a href="#" class="text-reset"><img src="img/inst.png" alt="Inst" class="rounded border border-dark"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5 col-lg-3 col-xl-3 mx-auto mb-5 mt_">
|
||||
<h6 class="text-uppercase fw-bold mb-4" ><a href="#" class="navbar-brand"><img class="brand" src="img/icon22.png"></a></h6>
|
||||
<h6 class="text-uppercase fw-bold mb-0 "><a href="#" class="navbar-brand"><img src="img/google.png"></a></h6>
|
||||
<h6 class="text-uppercase fw-bold mb-0 mt_1"><a href="#" class="navbar-brand"><img src="img/Appst.png"></a></h6>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</footer>
|
||||
|
||||
<div id="items-update" class="modal fade" tabindex="-1" data-bs-backdrop="static" data-bs-keyboard="false">
|
||||
<div class="modal-dialog">
|
||||
<form id="items-form" class="needs-validation" novalidate>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="items-update-title"></h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="text-center">
|
||||
<img id="image-preview" src="https://via.placeholder.com/200" class="rounded"
|
||||
alt="placeholder">
|
||||
</div>
|
||||
<input id="items-line-id" type="number" hidden>
|
||||
<div class="mb-2">
|
||||
<label for="item" class="form-label">Тип</label>
|
||||
<select id="item" class="form-select" name="selected" required>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<label class="form-label" for="category">Возврастн. кат.</label>
|
||||
<input id="category" name="category" class="form-control" type="number" value="6" min="6"
|
||||
step="2" required>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<label class="form-label" for="nick">Название</label>
|
||||
<input id="nick" name="nick" class="form-control" type="text" placeholder="Введите название" required>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<label class="form-label" for="genre">Жанр</label>
|
||||
<select id="genre" class="form-select" name="selectGen" required>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<label class="form-label" for="ocenka">Оценка</label>
|
||||
<input id="ocenka" name="ocenka" class="form-control" type="number" placeholder="0" min="0"
|
||||
step="0.1" required>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<label class="form-label" for="image">Изображение</label>
|
||||
<input id="image" type="file" name="image" class="form-control" accept="image/*">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
|
||||
<button type="submit" class="btn btn-primary">Сохранить</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script type="module">
|
||||
import validation from "./js/validation";
|
||||
import { linesForm } from "./js/lines";
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
validation();
|
||||
linesForm();
|
||||
});
|
||||
</script>
|
||||
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
44
Lab2/css/admin.css
Normal file
@ -0,0 +1,44 @@
|
||||
@import 'index.css';
|
||||
|
||||
main {
|
||||
background-color: var(--color16);
|
||||
color: white;
|
||||
background-size: cover;
|
||||
|
||||
}
|
||||
|
||||
.admin{
|
||||
font-family: 'Times New Roman', Times, serif !important;
|
||||
font-weight: 600 !important;
|
||||
padding-top: 50px !important;
|
||||
}
|
||||
|
||||
.tabl_2{
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 770px) {
|
||||
.admin{
|
||||
font-size: 8px !important;
|
||||
}
|
||||
|
||||
.btn-dob{
|
||||
font-size: 10px !important;
|
||||
}
|
||||
|
||||
.btn-dob-page{
|
||||
font-size: 10px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-dob{
|
||||
background-color: #a86e38 !important;
|
||||
border: solid 2px #6a6b1f ;
|
||||
}
|
||||
|
||||
.btn-dob-page{
|
||||
background-color: #92a838 !important;
|
||||
border: solid 2px #6a6b1f ;
|
||||
}
|
||||
|
154
Lab2/css/film.css
Normal file
@ -0,0 +1,154 @@
|
||||
@import 'index.css';
|
||||
|
||||
.po{
|
||||
position: relative;
|
||||
top: 26px;
|
||||
left: 3%;
|
||||
}
|
||||
.search-container {
|
||||
margin-left: 5%;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
#search-form {
|
||||
display: inline-block;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
/* Стилизация поля ввода */
|
||||
#search-input {
|
||||
|
||||
height: 32px;
|
||||
width: 90%;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#search-input:focus {
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#search-input:focus {
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#search-input:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
|
||||
.line {
|
||||
width: 90%;
|
||||
height: 4px;
|
||||
background-color: #000;
|
||||
margin-left: 4%;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
|
||||
.btn-tag {
|
||||
background-color: #332D2D;
|
||||
color: white;
|
||||
transition: transform 0.2s;
|
||||
margin-right: 50px;
|
||||
border-radius: 35px;
|
||||
border: solid 3px #F4F5A5;
|
||||
margin-bottom: 15px;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
font-family: HachiMaruPop-Regular, sans-serif;
|
||||
font-weight: 800;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
|
||||
.btn-tag:hover {
|
||||
transform: scale(1.1);
|
||||
background-color: #332D2D;
|
||||
color: white;
|
||||
}
|
||||
.stil{
|
||||
font-size: 16px !important;
|
||||
font-family: Impact, sans-serif;
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.stil2{
|
||||
margin-left: 50px;
|
||||
}
|
||||
|
||||
.filt_ob {
|
||||
width: 202px;
|
||||
height: 198px;
|
||||
border-radius: 35px;
|
||||
border: solid 3px #F4F5A5;
|
||||
background-color: #332D2D;
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.text_tv {
|
||||
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width: 420px ) {
|
||||
.po{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.lead{
|
||||
margin-left: 10px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 272px ) {
|
||||
.stil2{
|
||||
margin-left: 10px !important;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 300px ) {
|
||||
.filt_films{
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
font-size: 15px;
|
||||
}
|
||||
.btn-tag {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
font-size: 18px;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.lead{
|
||||
font-size: 20px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 767px ) {
|
||||
.po{
|
||||
left: 0px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 1200px ) {
|
||||
.po{
|
||||
left: 2%;
|
||||
}
|
||||
|
||||
}
|
130
Lab2/css/in.css
Normal file
@ -0,0 +1,130 @@
|
||||
@import 'index.css';
|
||||
|
||||
.card-background {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #FFFFFF;
|
||||
mix-blend-mode: difference;
|
||||
border-radius: 10px;
|
||||
border: solid #D0D26E 8px;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.vih{
|
||||
font-size: 20px !important;
|
||||
font-family: 'Times New Roman', Times, serif !important;
|
||||
width: 190px;
|
||||
margin-left: 50px;
|
||||
margin-top: 10px;
|
||||
line-height: 25px;
|
||||
font-style: italic;
|
||||
text-decoration: underline;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.reg {
|
||||
position: absolute;
|
||||
top: 30px;
|
||||
right: 40px;
|
||||
background-color: #DBDD7C;
|
||||
padding: 10px 15px 10px 15px;
|
||||
text-decoration: none !important;
|
||||
color: black;
|
||||
border-radius: 17px;
|
||||
font-style: italic;
|
||||
font-family: 'Times New Roman', Times, serif !important;
|
||||
font-weight: 600;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
::placeholder {
|
||||
color: #999;
|
||||
font-style: italic;
|
||||
font-size: 18px;
|
||||
font-family: 'Times New Roman', Times, serif;
|
||||
}
|
||||
|
||||
@media (max-width: 767px ) {
|
||||
|
||||
.card{
|
||||
width: 100% !important;
|
||||
margin-left: 0% !important;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 1000px ) {
|
||||
|
||||
.card{
|
||||
margin-left: 0% !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 500px ) {
|
||||
|
||||
.reg{
|
||||
display: none;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 500px ) {
|
||||
|
||||
.btn-vk{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 267px ) {
|
||||
|
||||
.brand2{
|
||||
width: 150px !important;
|
||||
}
|
||||
|
||||
.brs{
|
||||
margin-left: 15px !important;
|
||||
}
|
||||
|
||||
.vih{
|
||||
margin-left: 15px !important;
|
||||
width: 100px !important;
|
||||
}
|
||||
|
||||
.vhod{
|
||||
width: 100px !important;
|
||||
}
|
||||
|
||||
body, html {
|
||||
font-family: 'Times New Roman', Times, serif;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.lead{
|
||||
font-size: 13px !important;
|
||||
width: 150px !important;
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 233px ) {
|
||||
|
||||
.brand2{
|
||||
width: 130px !important;
|
||||
}
|
||||
|
||||
.btn-vk{
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.vhod{
|
||||
font-size: 10px;
|
||||
width: 60px !important;
|
||||
}
|
||||
}
|
281
Lab2/css/index.css
Normal file
@ -0,0 +1,281 @@
|
||||
@font-face {
|
||||
font-family: "HachiMaruPop-Regular";
|
||||
src: url("../fonts/HachiMaruPop-Regular.ttf") format("truetype");
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Imbue";
|
||||
src: url("../fonts/Imbue.ttf") format("truetype");
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
}
|
||||
body {
|
||||
background-image: url("../img/fon.png");
|
||||
background-attachment: fixed;
|
||||
background-size: cover;
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
body, html {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: black;
|
||||
font-family: Impact, sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.navbar-nav li {
|
||||
border: none;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
white-space: nowrap;
|
||||
background-color: #DBDD7C;
|
||||
border-radius: 17px;
|
||||
font-style: italic;
|
||||
font-style: none;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.nav-link {
|
||||
background-color: transparent;
|
||||
border-radius: 0;
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.nav-link:hover{
|
||||
transition: 1s;
|
||||
opacity: 0.8;
|
||||
background: #c0c264;
|
||||
}
|
||||
|
||||
nav.navbar{
|
||||
background-color: #F5F6BE !important;
|
||||
}
|
||||
|
||||
.navv{
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.navv {
|
||||
display:block;
|
||||
justify-content:center;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
footer{
|
||||
background-color: #1C1919 !important;
|
||||
}
|
||||
|
||||
.text_{
|
||||
font-family: 'Times New Roman', Times, serif;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.text_1{
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.mt_ {
|
||||
margin-top: -120px !important;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.mt_1{
|
||||
margin-top: -15px !important;
|
||||
}
|
||||
|
||||
.back{
|
||||
background-color: #D0D26E;
|
||||
padding-top: 20px;
|
||||
margin-bottom: -22px;
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
|
||||
.lead{
|
||||
font-size: 36px !important;
|
||||
}
|
||||
|
||||
.back_2{
|
||||
background-color: #46214B;
|
||||
border: solid 7px #000000;
|
||||
border-radius: 49px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.ots{
|
||||
padding-top: 75px;
|
||||
}
|
||||
|
||||
|
||||
.card-img-top{
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@media (min-width: 992px ) {
|
||||
.back_2 {
|
||||
width: 760px;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 991px ) {
|
||||
.card{
|
||||
margin-left: 50px !important;
|
||||
|
||||
}
|
||||
|
||||
.card_{
|
||||
margin-left: 30px !important;
|
||||
}
|
||||
|
||||
.film6{
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1200px ) {
|
||||
.back_2 {
|
||||
width: 660px;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 767px ) {
|
||||
|
||||
.colu{
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.colu2{
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.card{
|
||||
width: 300px !important;
|
||||
margin-bottom: 240px !important;
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
}
|
||||
|
||||
.card_{
|
||||
width: 300px !important;
|
||||
margin-bottom: 200px;
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
}
|
||||
|
||||
.back_ob{
|
||||
padding-bottom: 40px;
|
||||
margin-left: 0% !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.img-voz{
|
||||
margin-top: 15px !important;
|
||||
}
|
||||
|
||||
.card-text{
|
||||
margin-top: -15px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 450px ) {
|
||||
|
||||
.card{
|
||||
width: 200px !important;
|
||||
margin-bottom: 100px !important;
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 354px ) {
|
||||
|
||||
.card{
|
||||
width: 200px !important;
|
||||
margin-bottom: 100px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 270px ) {
|
||||
|
||||
.card{
|
||||
width: 150px !important;
|
||||
margin-bottom: 50px !important;
|
||||
}
|
||||
|
||||
.brand{
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 220px ) {
|
||||
|
||||
.card{
|
||||
width: 130px !important;
|
||||
margin-bottom: 40px !important;
|
||||
}
|
||||
|
||||
.brand{
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.stil{
|
||||
font-size: 20px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1400px ) {
|
||||
|
||||
.film7{
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.colu2{
|
||||
display: flex;
|
||||
justify-content: start;
|
||||
flex-wrap: wrap; /* Это позволит переносить элементы на новую строку */
|
||||
|
||||
}
|
||||
.back_ob{
|
||||
background-color: #46214B;
|
||||
border: solid 7px #000000;
|
||||
border-radius: 49px;
|
||||
padding-bottom: 25px;
|
||||
margin-right: 10px;
|
||||
margin-left: 2%;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
.card:hover .card-img-top{
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.card .card-img-top{
|
||||
transition: transform 0.3s;
|
||||
}
|
||||
|
||||
|
||||
p, h6{
|
||||
text-decoration: none;
|
||||
}
|
||||
|
153
Lab2/css/profil.css
Normal file
@ -0,0 +1,153 @@
|
||||
|
||||
@font-face {
|
||||
font-family: "HachiMaruPop-Regular";
|
||||
src: url("../fonts/HachiMaruPop-Regular.ttf") format("truetype");
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "Imbue";
|
||||
src: url("../fonts/Imbue.ttf") format("truetype");
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
}
|
||||
body {
|
||||
background-image: url("../img/fon.png");
|
||||
background-attachment: fixed;
|
||||
background-size: cover;
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
body, html {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: black;
|
||||
font-family: Impact, sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
/* шапка */
|
||||
.navbar-nav li {
|
||||
border: none;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
white-space: nowrap;
|
||||
background-color: #DBDD7C;
|
||||
border-radius: 17px;
|
||||
font-style: italic;
|
||||
font-style: none;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.nav-link {
|
||||
background-color: transparent;
|
||||
border-radius: 0;
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.nav-link:hover{
|
||||
transition: 1s;
|
||||
opacity: 0.8;
|
||||
background: #c0c264;
|
||||
}
|
||||
|
||||
nav.navbar{
|
||||
background-color: #F5F6BE !important;
|
||||
}
|
||||
|
||||
.navv{
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.navv {
|
||||
display:block;
|
||||
justify-content:center;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Середина */
|
||||
.back{
|
||||
background-color: #D0D26E;
|
||||
padding-top: 20px;
|
||||
margin-bottom: -22px;
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
|
||||
.stil{
|
||||
font-size: 16px !important;
|
||||
font-family: Impact, sans-serif;
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.stil2{
|
||||
margin-left: 50px;
|
||||
font-size: 36px !important;
|
||||
}
|
||||
|
||||
.but2:hover{
|
||||
background-color: #160C57 !important;
|
||||
}
|
||||
|
||||
.card-body{
|
||||
background: none;
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.card{
|
||||
background: #F5F6BE;
|
||||
}
|
||||
|
||||
/* подвал */
|
||||
|
||||
footer{
|
||||
background: #1C1919;
|
||||
}
|
||||
|
||||
.text_{
|
||||
font-family: 'Times New Roman', Times, serif;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.text_1{
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 270px ) {
|
||||
.stil{
|
||||
font-size: 15px !important;
|
||||
margin-left: 0px !important;
|
||||
}
|
||||
|
||||
.brand{
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
body, html {
|
||||
font-size: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 220px ) {
|
||||
.brand{
|
||||
width: 150px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 272px ) {
|
||||
.stil2{
|
||||
margin-left: 10px !important;
|
||||
font-size: 25px !important;
|
||||
}
|
||||
|
||||
}
|
96
Lab2/css/reg.css
Normal file
@ -0,0 +1,96 @@
|
||||
@import 'index.css';
|
||||
@import 'in.css';
|
||||
|
||||
|
||||
.vih2{
|
||||
font-size: 20px !important;
|
||||
font-family: 'Times New Roman', Times, serif !important;
|
||||
width: 190px;
|
||||
line-height: 25px;
|
||||
font-style: italic;
|
||||
text-decoration: underline;
|
||||
color: black;
|
||||
}
|
||||
@media (max-width: 767px ) {
|
||||
|
||||
.img_{
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 536px ) {
|
||||
|
||||
.btn-reg{
|
||||
top: 180px !important;
|
||||
left: 35px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 372px ) {
|
||||
|
||||
.vih2{
|
||||
width: 100px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 344px ) {
|
||||
|
||||
.btn-reg{
|
||||
top: 210px !important;
|
||||
}
|
||||
|
||||
.vih{
|
||||
width: 100px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 272px ) {
|
||||
|
||||
.vk-goo{
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 267px ) {
|
||||
|
||||
.btn-reg{
|
||||
top: 145px !important;
|
||||
left: 15px !important;
|
||||
font-size: 20px !important;
|
||||
}
|
||||
|
||||
.lead{
|
||||
font-size: 13px !important;
|
||||
width: 150px !important;
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 226px ) {
|
||||
|
||||
.vih2{
|
||||
font-size: 13px !important;
|
||||
width: 100px !important;
|
||||
}
|
||||
|
||||
.vk-goo{
|
||||
font-size: 10px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 213px ) {
|
||||
|
||||
.btn-reg{
|
||||
font-size: 15px !important;
|
||||
}
|
||||
|
||||
}
|
2
Lab2/css/serial.css
Normal file
@ -0,0 +1,2 @@
|
||||
@import 'index.css';
|
||||
@import 'film.css';
|
132
Lab2/css/tv.css
Normal file
@ -0,0 +1,132 @@
|
||||
@import 'index.css';
|
||||
|
||||
.btn-tag {
|
||||
background-color: #1C1919;
|
||||
color: white;
|
||||
transition: transform 0.2s;
|
||||
margin-right: 25px;
|
||||
border-radius: 12px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.btn-tag:hover {
|
||||
transform: scale(1.1);
|
||||
background-color: #1C1919;
|
||||
color: white;
|
||||
}
|
||||
.stil{
|
||||
font-size: 16px !important;
|
||||
font-family: Impact, sans-serif;
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.stil2{
|
||||
margin-left: 50px;
|
||||
}
|
||||
.card:hover .card-img-top{
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.card .card-img-top{
|
||||
transition: transform 0.3s;
|
||||
}
|
||||
|
||||
@media (max-width: 767px ) {
|
||||
.card{
|
||||
width: 100px !important;
|
||||
margin-bottom: 80px !important;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
.img-voz{
|
||||
margin-top: -25px !important;
|
||||
}
|
||||
|
||||
.card-text{
|
||||
margin-top: -30px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 1400px ) {
|
||||
.card{
|
||||
margin-left: 40px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 300px ) {
|
||||
.filt-tv{
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
}
|
||||
|
||||
.stil{
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
}
|
||||
|
||||
.stil2{
|
||||
margin-left: auto !important;
|
||||
margin-right: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 1200px ) {
|
||||
.card{
|
||||
margin-left: 65px !important;
|
||||
}
|
||||
.card-{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 991px ) {
|
||||
.card{
|
||||
width: 300px !important;
|
||||
margin-bottom: 100px !important;
|
||||
margin-left: auto !important;
|
||||
margin-right: 23px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 575px ) {
|
||||
.card{
|
||||
width: 250px !important;
|
||||
margin-left: auto !important;
|
||||
margin-bottom: auto !important;
|
||||
margin-bottom: 50px !important;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: 400px ) {
|
||||
.card{
|
||||
width: 200px !important;
|
||||
margin-bottom: 30px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 241px ) {
|
||||
.card{
|
||||
width: 150px !important;
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.filt-tv{
|
||||
margin-left: auto !important;
|
||||
}
|
||||
|
||||
.btn-tag {
|
||||
font-size: 10px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.stil2{
|
||||
font-size: 20px !important;
|
||||
}
|
||||
}
|
79
Lab2/data.json
Normal file
428
Lab2/film.html
Normal file
@ -0,0 +1,428 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Киносмешарики</title>
|
||||
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="css/film.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-lg sticky-top">
|
||||
<div class="container">
|
||||
<a href="index.html" class="navbar-brand"><img class="brand" src="img/Logo.png"></a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarResponsive">
|
||||
<ul class="navbar-nav me-auto mt-xxl-5">
|
||||
<li class="nav-item">
|
||||
<a href="tv.html" class="nav-link px-4 mx-3">ТВ-каналы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="film.html" class="nav-link px-4 mx-3">Фильмы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="serial.html" class="nav-link px-4 mx-3">Сериалы</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navv" id="navbarResponsive">
|
||||
<ul class="navbar-nav mb-xxl-3">
|
||||
<!-- <li class="nav-item">
|
||||
<a href="#" class="nav-link px-3 mx-2">
|
||||
<img src="img/" alt="VK">
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link px-3 mx-2">
|
||||
<img src="img/" alt="Tg">
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link px-3 mx-2">
|
||||
<img src="img/" alt="Inst">
|
||||
</a>
|
||||
</li> -->
|
||||
<li class="nav-item">
|
||||
<a href="reg.html" class="nav-link px-3 mx-2">Регистрация</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="in.html" class="nav-link px-3 mx-2">Вход</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
|
||||
<div class="container back">
|
||||
<div class="row">
|
||||
<p class="lead stil">КиноСмешарики | Фильмы</p>
|
||||
<p class="lead stil2">Фильмы ➪</p>
|
||||
<div class="col-12">
|
||||
<img class="po" src="img/6.png" alt="Лого">
|
||||
<div class="search-container">
|
||||
<form id="search-form" action="/search" method="get">
|
||||
|
||||
<input type="text" id="search-input" name="query" placeholder="Название фильма, жанр или имя актёра" autocomplete="off">
|
||||
</form>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
<p class="lead stil2" style="margin-left: 50px;">Фильмы по жанрам</p>
|
||||
<div class="justify-content-start text-start w-100 my-5 filt_films" style="margin-left: 35px; margin-top: 5px !important;">
|
||||
|
||||
<a href="#" class="btn btn-tag btn-rounded " data-mdb-close="true">
|
||||
<div class="" style="margin-top: 65px;">Комедии</div>
|
||||
</a>
|
||||
|
||||
<a href="#" class="btn btn-tag btn-rounded" data-mdb-close="true">
|
||||
<div class="" style="margin-top: 55px;">Мело-драмы</div>
|
||||
</a>
|
||||
|
||||
<a href="#" class="btn btn-tag btn-rounded" data-mdb-close="true">
|
||||
<div class="" style="margin-top: 55px;">Детек тивы</div>
|
||||
</a>
|
||||
|
||||
<a href="#" class="btn btn-tag btn-rounded" data-mdb-close="true">
|
||||
<div class="" style="margin-top: 65px;">Ужасы</div>
|
||||
</a>
|
||||
|
||||
<a href="#" class="btn btn-tag btn-rounded" data-mdb-close="true">
|
||||
<div class="" style="margin-top: 65px;">Боевики</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<p class="lead" style="margin-left: 50px;">Сейчас смотрят</p>
|
||||
<p class="lead" style="margin-left: 50px; font-size: 18px !important; font-family: Imbue, sans-serif !important; font-weight: normal !important;">Самые популярные фильмы за последние сутки</p>
|
||||
<div class="container back_ob mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-start colu2">
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds d-none d-xl-block film6" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds d-none d-xl-block film7" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px; ">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative; ">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<p class="lead" style="margin-left: 50px;">Лучшее зарубежное кино</p>
|
||||
<p class="lead" style="margin-left: 50px; font-size: 18px !important; font-family: Imbue, sans-serif !important; font-weight: normal !important;">Фильмы с высоким рейтингом</p>
|
||||
<div class="container back_ob mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-start colu2">
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds d-none d-xl-block film6" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds d-none d-xl-block film7" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px; ">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative; ">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<p class="lead" style="margin-left: 50px;">Лучшие российские фильмы</p>
|
||||
<p class="lead" style="margin-left: 50px; font-size: 18px !important; font-family: Imbue, sans-serif !important; font-weight: normal !important;">Любое наше кино от комедии до фантастики</p>
|
||||
<div class="container back_ob mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-start colu2">
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds d-none d-xl-block film6" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds d-none d-xl-block film7" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px; ">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative; ">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<footer class="text-center text_">
|
||||
|
||||
<section class="">
|
||||
<div class="container text-center text-md-start mt-4 pt-5">
|
||||
<a href="#" class="navbar-brand"><img class="brand" src="img/Logo.png"></a>
|
||||
|
||||
<div class="row mt-3">
|
||||
|
||||
<div class="col-md-3 col-lg-4 col-xl-2 mx-auto mb-4">
|
||||
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1"> Тех. поддержка</h6>
|
||||
<p>
|
||||
Ответим на любой ваш вопрос!
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">vano00189@mail.ru</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-lg-3 col-xl-2 mx-auto mb-4">
|
||||
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1">Для гостей </h6>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Акции и скидки</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Подарочные карты</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Пользовательское соглашение</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 col-lg-2 col-xl-2 mx-auto mb-4">
|
||||
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1" >О нас</h6>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Контакты</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Помощь</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Партнерам</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-lg-3 col-xl-2 mx-auto mb-4 ">
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1">Мы в соц. сетях</h6>
|
||||
<div class="social-icons">
|
||||
<a href="#" class="text-reset me-3"><img src="img/vk.png" alt="vk" class="rounded border border-dark"></a>
|
||||
<a href="#" class="text-reset me-3"><img src="img/tg.png" alt="tg" class="rounded border border-dark"></a>
|
||||
<a href="#" class="text-reset"><img src="img/inst.png" alt="Inst" class="rounded border border-dark"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5 col-lg-3 col-xl-3 mx-auto mb-5 mt_">
|
||||
<h6 class="text-uppercase fw-bold mb-4" ><a href="#" class="navbar-brand"><img class="brand" src="img/icon22.png"></a></h6>
|
||||
<h6 class="text-uppercase fw-bold mb-0 "><a href="#" class="navbar-brand"><img src="img/google.png"></a></h6>
|
||||
<h6 class="text-uppercase fw-bold mb-0 mt_1"><a href="#" class="navbar-brand"><img src="img/Appst.png"></a></h6>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</footer>
|
||||
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
Lab2/fonts/HachiMaruPop-Regular.ttf
Normal file
BIN
Lab2/fonts/Imbue.ttf
Normal file
BIN
Lab2/img/1.png
Normal file
After Width: | Height: | Size: 210 B |
BIN
Lab2/img/16+.png
Normal file
After Width: | Height: | Size: 436 B |
BIN
Lab2/img/18+.png
Normal file
After Width: | Height: | Size: 440 B |
BIN
Lab2/img/2.png
Normal file
After Width: | Height: | Size: 55 KiB |
BIN
Lab2/img/3.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
Lab2/img/4.png
Normal file
After Width: | Height: | Size: 684 B |
BIN
Lab2/img/5.png
Normal file
After Width: | Height: | Size: 474 B |
195
Lab2/in.html
Normal file
@ -0,0 +1,195 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Киносмешарики</title>
|
||||
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="css/in.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-lg sticky-top">
|
||||
<div class="container">
|
||||
<a href="index.html" class="navbar-brand"><img class="brand" src="img/Logo.png"></a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarResponsive">
|
||||
<ul class="navbar-nav me-auto mt-xxl-5">
|
||||
<li class="nav-item">
|
||||
<a href="tv.html" class="nav-link px-4 mx-3">ТВ-каналы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="film.html" class="nav-link px-4 mx-3">Фильмы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="serial.html" class="nav-link px-4 mx-3">Сериалы</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navv" id="navbarResponsive">
|
||||
<ul class="navbar-nav mb-xxl-3">
|
||||
<!-- <li class="nav-item">
|
||||
<a href="#" class="nav-link px-3 mx-2">
|
||||
<img src="img/" alt="VK">
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link px-3 mx-2">
|
||||
<img src="img/" alt="Tg">
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link px-3 mx-2">
|
||||
<img src="img/" alt="Inst">
|
||||
</a>
|
||||
</li> -->
|
||||
<li class="nav-item">
|
||||
<a href="reg.html" class="nav-link px-3 mx-2">Регистрация</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="in.html" class="nav-link px-3 mx-2">Вход</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
|
||||
<section class="vh-200" style="background-color: none">
|
||||
<div class="container-fluid py-5 h-100">
|
||||
<div class="row d-flex justify-content-center align-items-center h-100">
|
||||
<div class="col-12 col-md-12 col-lg-8 col-xl-6 col-sm-12">
|
||||
<div class="card" style="border-radius: 10px; background-color: rgba(255, 255, 255, 0);">
|
||||
<div class="card-background"></div>
|
||||
<a href="index.html" class="navbar-brand brs" style="margin-top: 20px; margin-left: 40px;" ><img class="brand2" src="img/Logo.png" style="width: 190px;"></a>
|
||||
<a href="index.html" style="width: 190px;" class="vih-"><p class="lead vih">Выйти на главную страницу</p></a>
|
||||
<a href="reg.html" class="reg">Регистрация</a>
|
||||
<div class="card-body p-5 text-center crd">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<div class="form-outline mb-4">
|
||||
<label class="form-label" for="phoneNumber">По номеру телефона</label>
|
||||
<input type="tel" id="phoneNumber" class="form-control form-control-lg" placeholder="+7" />
|
||||
</div>
|
||||
|
||||
<div class="form-outline mb-4">
|
||||
<label class="form-label" for="typeEmailX-2">По почте</label>
|
||||
<input type="email" id="typeEmailX-2" class="form-control form-control-lg" placeholder="Введите ваш email адрес... "/>
|
||||
</div>
|
||||
|
||||
<div class="form-outline mb-4">
|
||||
<label class="form-label" for="typePasswordX-2">Пароль</label>
|
||||
<input type="password" id="typePasswordX-2" class="form-control form-control-lg" placeholder="Введите ваш пароль... "/>
|
||||
</div>
|
||||
|
||||
<div class="form-check d-flex justify-content-start mb-4">
|
||||
<input class="form-check-input" type="checkbox" value="" id="form1Example3" />
|
||||
<label class="form-check-label" for="form1Example3">Запомнить пароль</label>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary btn-lg btn-block vhod" type="submit" style="background-color: #160C57; border-radius: 26px; width: 150px;">Вход</button>
|
||||
</div>
|
||||
<div class="col-md-6 d-none d-lg-block d-xl-block d-md-block">
|
||||
<img src="img/7.png">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr class="my-4">
|
||||
|
||||
<button class="btn btn-lg btn-block btn-primary btn-vk" style="background-color: #4d4de6;"
|
||||
type="submit">Войти через ВК</button>
|
||||
<button class="btn btn-lg btn-block btn-primary btn-vk" style="background-color: #4d4de6;"
|
||||
type="submit">Войти через Google</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<footer class="text-center text_">
|
||||
|
||||
<section class="">
|
||||
<div class="container text-center text-md-start mt-4 pt-5">
|
||||
<a href="#" class="navbar-brand"><img class="brand" src="img/Logo.png"></a>
|
||||
|
||||
<div class="row mt-3">
|
||||
|
||||
<div class="col-md-3 col-lg-4 col-xl-2 mx-auto mb-4">
|
||||
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1"> Тех. поддержка</h6>
|
||||
<p>
|
||||
Ответим на любой ваш вопрос!
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">vano00189@mail.ru</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-lg-3 col-xl-2 mx-auto mb-4">
|
||||
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1">Для гостей </h6>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Акции и скидки</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Подарочные карты</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Пользовательское соглашение</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 col-lg-2 col-xl-2 mx-auto mb-4">
|
||||
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1" >О нас</h6>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Контакты</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Помощь</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Партнерам</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-lg-3 col-xl-2 mx-auto mb-4 ">
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1">Мы в соц. сетях</h6>
|
||||
<div class="social-icons">
|
||||
<a href="#" class="text-reset me-3"><img src="img/vk.png" alt="vk" class="rounded border border-dark"></a>
|
||||
<a href="#" class="text-reset me-3"><img src="img/tg.png" alt="tg" class="rounded border border-dark"></a>
|
||||
<a href="#" class="text-reset"><img src="img/inst.png" alt="Inst" class="rounded border border-dark"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5 col-lg-3 col-xl-3 mx-auto mb-5 mt_">
|
||||
<h6 class="text-uppercase fw-bold mb-4" ><a href="#" class="navbar-brand"><img class="brand" src="img/icon22.png"></a></h6>
|
||||
<h6 class="text-uppercase fw-bold mb-0 "><a href="#" class="navbar-brand"><img src="img/google.png"></a></h6>
|
||||
<h6 class="text-uppercase fw-bold mb-0 mt_1"><a href="#" class="navbar-brand"><img src="img/Appst.png"></a></h6>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</footer>
|
||||
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
396
Lab2/index.html
Normal file
@ -0,0 +1,396 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Киносмешарики</title>
|
||||
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="css/index.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-lg sticky-top">
|
||||
<div class="container">
|
||||
<a href="index.html" class="navbar-brand"><img class="brand" src="img/Logo.png"></a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarResponsive">
|
||||
<ul class="navbar-nav me-auto mt-xxl-5">
|
||||
<li class="nav-item">
|
||||
<a href="tv.html" class="nav-link px-4 mx-3">ТВ-каналы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="film.html" class="nav-link px-4 mx-3">Фильмы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="serial.html" class="nav-link px-4 mx-3">Сериалы</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navv" id="navbarResponsive">
|
||||
<ul class="navbar-nav mb-xxl-3">
|
||||
<!-- <li class="nav-item">
|
||||
<a href="#" class="nav-link px-3 mx-2">
|
||||
<img src="img/" alt="VK">
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link px-3 mx-2">
|
||||
<img src="img/" alt="Tg">
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link px-3 mx-2">
|
||||
<img src="img/" alt="Inst">
|
||||
</a>
|
||||
</li> -->
|
||||
<li class="nav-item">
|
||||
<a href="reg.html" class="nav-link px-3 mx-2">Регистрация</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="in.html" class="nav-link px-3 mx-2">Вход</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
<div class="container back">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<a href="#" class="navbar-brand d-none d-xl-block"><img src="img/2.png"></a>
|
||||
</div>
|
||||
<div class="col-md-12 col-xl-6 col-sm-12">
|
||||
<p class="lead stil">Вперед, к невероятным приключениям! Добро пожаловать в мир кино вместе с нами!</p>
|
||||
<p class="lead ots">Сейчас в кино</p>
|
||||
<div class="container back_2 mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-start colu">
|
||||
<div class="card card_" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card_" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card_" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card card_" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-start colu">
|
||||
<div class="card card_" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card_" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card_" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card card_" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<p class="lead">Любимые Фильмы и сериалы</p>
|
||||
<div class="container back_ob mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-start colu2">
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds d-none d-xl-block film6" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds d-none d-xl-block film7" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px; ">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative; ">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<p class="lead" style="margin-top: 30px;">Сейчас смотрят</p>
|
||||
<div class="container back_ob mb-4">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-start colu2">
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds d-none d-xl-block film6" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a href="#" class="dsds d-none d-xl-block film7" style="text-decoration: none;">
|
||||
<div class="card" style="transition: transform 0.3s; width: 148px; height: 231px; background: none; border: none; margin-top: 20px; margin-left: 25px;">
|
||||
<img src="img/film.png" class="card-img-top" alt="...">
|
||||
<div class="card-body" >
|
||||
<img src="img/16+.png" class="img-voz" style="position: relative; margin-left: -5px; margin-top: -20px;" alt="...">
|
||||
<p class="card-text" style="font-size: 8px; color: #797979; width: 103px; margin-left: 15px; margin-top: -30px; position: relative;">Экшн, приключения, комедия</p>
|
||||
<h6 class="card-title" style="font-size: 14px; font-weight: normal; color: white; width: 148px; position: relative; margin-left: -5px; margin-top: -15px;">Неудержимые 4</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<footer class="text-center text_">
|
||||
|
||||
<section class="">
|
||||
<div class="container text-center text-md-start mt-4 pt-5">
|
||||
<a href="#" class="navbar-brand"><img class="brand" src="img/Logo.png"></a>
|
||||
|
||||
<div class="row mt-3">
|
||||
|
||||
<div class="col-md-3 col-lg-4 col-xl-2 mx-auto mb-4">
|
||||
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1"> Тех. поддержка</h6>
|
||||
<p>
|
||||
Ответим на любой ваш вопрос!
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">vano00189@mail.ru</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-lg-3 col-xl-2 mx-auto mb-4">
|
||||
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1">Для гостей </h6>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Акции и скидки</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Подарочные карты</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Пользовательское соглашение</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 col-lg-2 col-xl-2 mx-auto mb-4">
|
||||
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1" >О нас</h6>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Контакты</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Помощь</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#!" class="text-reset">Партнерам</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 col-lg-3 col-xl-2 mx-auto mb-4 ">
|
||||
<h6 class="text-uppercase fw-bold mb-4 text_1">Мы в соц. сетях</h6>
|
||||
<div class="social-icons">
|
||||
<a href="#" class="text-reset me-3"><img src="img/vk.png" alt="vk" class="rounded border border-dark"></a>
|
||||
<a href="#" class="text-reset me-3"><img src="img/tg.png" alt="tg" class="rounded border border-dark"></a>
|
||||
<a href="#" class="text-reset"><img src="img/inst.png" alt="Inst" class="rounded border border-dark"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5 col-lg-3 col-xl-3 mx-auto mb-5 mt_">
|
||||
<h6 class="text-uppercase fw-bold mb-4" ><a href="#" class="navbar-brand"><img class="brand" src="img/icon22.png"></a></h6>
|
||||
<h6 class="text-uppercase fw-bold mb-0 "><a href="#" class="navbar-brand"><img src="img/google.png"></a></h6>
|
||||
<h6 class="text-uppercase fw-bold mb-0 mt_1"><a href="#" class="navbar-brand"><img src="img/Appst.png"></a></h6>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</footer>
|
||||
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
870
Lab2/node_modules/.acorn-HkmHiliI/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,870 @@
|
||||
## 8.11.2 (2023-10-27)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a bug that caused regular expressions after colon tokens to not be properly tokenized in some circumstances.
|
||||
|
||||
## 8.11.1 (2023-10-26)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a regression where `onToken` would receive 'name' tokens for 'new' keyword tokens.
|
||||
|
||||
## 8.11.0 (2023-10-26)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix an issue where tokenizing (without parsing) an object literal with a property named `class` or `function` could, in some circumstance, put the tokenizer into an invalid state.
|
||||
|
||||
Fix an issue where a slash after a call to a propery named the same as some keywords would be tokenized as a regular expression.
|
||||
|
||||
### New features
|
||||
|
||||
Upgrade to Unicode 15.1.
|
||||
|
||||
Use a set of new, much more precise, TypeScript types.
|
||||
|
||||
## 8.10.0 (2023-07-05)
|
||||
|
||||
### New features
|
||||
|
||||
Add a `checkPrivateFields` option that disables strict checking of private property use.
|
||||
|
||||
## 8.9.0 (2023-06-16)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Forbid dynamic import after `new`, even when part of a member expression.
|
||||
|
||||
### New features
|
||||
|
||||
Add Unicode properties for ES2023.
|
||||
|
||||
Add support for the `v` flag to regular expressions.
|
||||
|
||||
## 8.8.2 (2023-01-23)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a bug that caused `allowHashBang` to be set to false when not provided, even with `ecmaVersion >= 14`.
|
||||
|
||||
Fix an exception when passing no option object to `parse` or `new Parser`.
|
||||
|
||||
Fix incorrect parse error on `if (0) let\n[astral identifier char]`.
|
||||
|
||||
## 8.8.1 (2022-10-24)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Make type for `Comment` compatible with estree types.
|
||||
|
||||
## 8.8.0 (2022-07-21)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Allow parentheses around spread args in destructuring object assignment.
|
||||
|
||||
Fix an issue where the tree contained `directive` properties in when parsing with a language version that doesn't support them.
|
||||
|
||||
### New features
|
||||
|
||||
Support hashbang comments by default in ECMAScript 2023 and later.
|
||||
|
||||
## 8.7.1 (2021-04-26)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Stop handling `"use strict"` directives in ECMAScript versions before 5.
|
||||
|
||||
Fix an issue where duplicate quoted export names in `export *` syntax were incorrectly checked.
|
||||
|
||||
Add missing type for `tokTypes`.
|
||||
|
||||
## 8.7.0 (2021-12-27)
|
||||
|
||||
### New features
|
||||
|
||||
Support quoted export names.
|
||||
|
||||
Upgrade to Unicode 14.
|
||||
|
||||
Add support for Unicode 13 properties in regular expressions.
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Use a loop to find line breaks, because the existing regexp search would overrun the end of the searched range and waste a lot of time in minified code.
|
||||
|
||||
## 8.6.0 (2021-11-18)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a bug where an object literal with multiple `__proto__` properties would incorrectly be accepted if a later property value held an assigment.
|
||||
|
||||
### New features
|
||||
|
||||
Support class private fields with the `in` operator.
|
||||
|
||||
## 8.5.0 (2021-09-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Improve context-dependent tokenization in a number of corner cases.
|
||||
|
||||
Fix location tracking after a 0x2028 or 0x2029 character in a string literal (which before did not increase the line number).
|
||||
|
||||
Fix an issue where arrow function bodies in for loop context would inappropriately consume `in` operators.
|
||||
|
||||
Fix wrong end locations stored on SequenceExpression nodes.
|
||||
|
||||
Implement restriction that `for`/`of` loop LHS can't start with `let`.
|
||||
|
||||
### New features
|
||||
|
||||
Add support for ES2022 class static blocks.
|
||||
|
||||
Allow multiple input files to be passed to the CLI tool.
|
||||
|
||||
## 8.4.1 (2021-06-24)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a bug where `allowAwaitOutsideFunction` would allow `await` in class field initializers, and setting `ecmaVersion` to 13 or higher would allow top-level await in non-module sources.
|
||||
|
||||
## 8.4.0 (2021-06-11)
|
||||
|
||||
### New features
|
||||
|
||||
A new option, `allowSuperOutsideMethod`, can be used to suppress the error when `super` is used in the wrong context.
|
||||
|
||||
## 8.3.0 (2021-05-31)
|
||||
|
||||
### New features
|
||||
|
||||
Default `allowAwaitOutsideFunction` to true for ECMAScript 2022 an higher.
|
||||
|
||||
Add support for the `d` ([indices](https://github.com/tc39/proposal-regexp-match-indices)) regexp flag.
|
||||
|
||||
## 8.2.4 (2021-05-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix spec conformity in corner case 'for await (async of ...)'.
|
||||
|
||||
## 8.2.3 (2021-05-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix an issue where the library couldn't parse 'for (async of ...)'.
|
||||
|
||||
Fix a bug in UTF-16 decoding that would read characters incorrectly in some circumstances.
|
||||
|
||||
## 8.2.2 (2021-04-29)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a bug where a class field initialized to an async arrow function wouldn't allow await inside it. Same issue existed for generator arrow functions with yield.
|
||||
|
||||
## 8.2.1 (2021-04-24)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a regression introduced in 8.2.0 where static or async class methods with keyword names fail to parse.
|
||||
|
||||
## 8.2.0 (2021-04-24)
|
||||
|
||||
### New features
|
||||
|
||||
Add support for ES2022 class fields and private methods.
|
||||
|
||||
## 8.1.1 (2021-04-12)
|
||||
|
||||
### Various
|
||||
|
||||
Stop shipping source maps in the NPM package.
|
||||
|
||||
## 8.1.0 (2021-03-09)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a spurious error in nested destructuring arrays.
|
||||
|
||||
### New features
|
||||
|
||||
Expose `allowAwaitOutsideFunction` in CLI interface.
|
||||
|
||||
Make `allowImportExportAnywhere` also apply to `import.meta`.
|
||||
|
||||
## 8.0.5 (2021-01-25)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Adjust package.json to work with Node 12.16.0 and 13.0-13.6.
|
||||
|
||||
## 8.0.4 (2020-10-05)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Make `await x ** y` an error, following the spec.
|
||||
|
||||
Fix potentially exponential regular expression.
|
||||
|
||||
## 8.0.3 (2020-10-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a wasteful loop during `Parser` creation when setting `ecmaVersion` to `"latest"`.
|
||||
|
||||
## 8.0.2 (2020-09-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Make the TypeScript types reflect the current allowed values for `ecmaVersion`.
|
||||
|
||||
Fix another regexp/division tokenizer issue.
|
||||
|
||||
## 8.0.1 (2020-08-12)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Provide the correct value in the `version` export.
|
||||
|
||||
## 8.0.0 (2020-08-12)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow expressions like `(a = b) = c`.
|
||||
|
||||
Make non-octal escape sequences a syntax error in strict mode.
|
||||
|
||||
### New features
|
||||
|
||||
The package can now be loaded directly as an ECMAScript module in node 13+.
|
||||
|
||||
Update to the set of Unicode properties from ES2021.
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The `ecmaVersion` option is now required. For the moment, omitting it will still work with a warning, but that will change in a future release.
|
||||
|
||||
Some changes to method signatures that may be used by plugins.
|
||||
|
||||
## 7.4.0 (2020-08-03)
|
||||
|
||||
### New features
|
||||
|
||||
Add support for logical assignment operators.
|
||||
|
||||
Add support for numeric separators.
|
||||
|
||||
## 7.3.1 (2020-06-11)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Make the string in the `version` export match the actual library version.
|
||||
|
||||
## 7.3.0 (2020-06-11)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a bug that caused parsing of object patterns with a property named `set` that had a default value to fail.
|
||||
|
||||
### New features
|
||||
|
||||
Add support for optional chaining (`?.`).
|
||||
|
||||
## 7.2.0 (2020-05-09)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix precedence issue in parsing of async arrow functions.
|
||||
|
||||
### New features
|
||||
|
||||
Add support for nullish coalescing.
|
||||
|
||||
Add support for `import.meta`.
|
||||
|
||||
Support `export * as ...` syntax.
|
||||
|
||||
Upgrade to Unicode 13.
|
||||
|
||||
## 6.4.1 (2020-03-09)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
More carefully check for valid UTF16 surrogate pairs in regexp validator.
|
||||
|
||||
## 7.1.1 (2020-03-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Treat `\8` and `\9` as invalid escapes in template strings.
|
||||
|
||||
Allow unicode escapes in property names that are keywords.
|
||||
|
||||
Don't error on an exponential operator expression as argument to `await`.
|
||||
|
||||
More carefully check for valid UTF16 surrogate pairs in regexp validator.
|
||||
|
||||
## 7.1.0 (2019-09-24)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow trailing object literal commas when ecmaVersion is less than 5.
|
||||
|
||||
### New features
|
||||
|
||||
Add a static `acorn` property to the `Parser` class that contains the entire module interface, to allow plugins to access the instance of the library that they are acting on.
|
||||
|
||||
## 7.0.0 (2019-08-13)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
Changes the node format for dynamic imports to use the `ImportExpression` node type, as defined in [ESTree](https://github.com/estree/estree/blob/master/es2020.md#importexpression).
|
||||
|
||||
Makes 10 (ES2019) the default value for the `ecmaVersion` option.
|
||||
|
||||
## 6.3.0 (2019-08-12)
|
||||
|
||||
### New features
|
||||
|
||||
`sourceType: "module"` can now be used even when `ecmaVersion` is less than 6, to parse module-style code that otherwise conforms to an older standard.
|
||||
|
||||
## 6.2.1 (2019-07-21)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug causing Acorn to treat some characters as identifier characters that shouldn't be treated as such.
|
||||
|
||||
Fix issue where setting the `allowReserved` option to `"never"` allowed reserved words in some circumstances.
|
||||
|
||||
## 6.2.0 (2019-07-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Improve valid assignment checking in `for`/`in` and `for`/`of` loops.
|
||||
|
||||
Disallow binding `let` in patterns.
|
||||
|
||||
### New features
|
||||
|
||||
Support bigint syntax with `ecmaVersion` >= 11.
|
||||
|
||||
Support dynamic `import` syntax with `ecmaVersion` >= 11.
|
||||
|
||||
Upgrade to Unicode version 12.
|
||||
|
||||
## 6.1.1 (2019-02-27)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug that caused parsing default exports of with names to fail.
|
||||
|
||||
## 6.1.0 (2019-02-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix scope checking when redefining a `var` as a lexical binding.
|
||||
|
||||
### New features
|
||||
|
||||
Split up `parseSubscripts` to use an internal `parseSubscript` method to make it easier to extend with plugins.
|
||||
|
||||
## 6.0.7 (2019-02-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Check that exported bindings are defined.
|
||||
|
||||
Don't treat `\u180e` as a whitespace character.
|
||||
|
||||
Check for duplicate parameter names in methods.
|
||||
|
||||
Don't allow shorthand properties when they are generators or async methods.
|
||||
|
||||
Forbid binding `await` in async arrow function's parameter list.
|
||||
|
||||
## 6.0.6 (2019-01-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
The content of class declarations and expressions is now always parsed in strict mode.
|
||||
|
||||
Don't allow `let` or `const` to bind the variable name `let`.
|
||||
|
||||
Treat class declarations as lexical.
|
||||
|
||||
Don't allow a generator function declaration as the sole body of an `if` or `else`.
|
||||
|
||||
Ignore `"use strict"` when after an empty statement.
|
||||
|
||||
Allow string line continuations with special line terminator characters.
|
||||
|
||||
Treat `for` bodies as part of the `for` scope when checking for conflicting bindings.
|
||||
|
||||
Fix bug with parsing `yield` in a `for` loop initializer.
|
||||
|
||||
Implement special cases around scope checking for functions.
|
||||
|
||||
## 6.0.5 (2019-01-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix TypeScript type for `Parser.extend` and add `allowAwaitOutsideFunction` to options type.
|
||||
|
||||
Don't treat `let` as a keyword when the next token is `{` on the next line.
|
||||
|
||||
Fix bug that broke checking for parentheses around an object pattern in a destructuring assignment when `preserveParens` was on.
|
||||
|
||||
## 6.0.4 (2018-11-05)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Further improvements to tokenizing regular expressions in corner cases.
|
||||
|
||||
## 6.0.3 (2018-11-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug in tokenizing an expression-less return followed by a function followed by a regular expression.
|
||||
|
||||
Remove stray symlink in the package tarball.
|
||||
|
||||
## 6.0.2 (2018-09-26)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug where default expressions could fail to parse inside an object destructuring assignment expression.
|
||||
|
||||
## 6.0.1 (2018-09-14)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix wrong value in `version` export.
|
||||
|
||||
## 6.0.0 (2018-09-14)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Better handle variable-redefinition checks for catch bindings and functions directly under if statements.
|
||||
|
||||
Forbid `new.target` in top-level arrow functions.
|
||||
|
||||
Fix issue with parsing a regexp after `yield` in some contexts.
|
||||
|
||||
### New features
|
||||
|
||||
The package now comes with TypeScript definitions.
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The default value of the `ecmaVersion` option is now 9 (2018).
|
||||
|
||||
Plugins work differently, and will have to be rewritten to work with this version.
|
||||
|
||||
The loose parser and walker have been moved into separate packages (`acorn-loose` and `acorn-walk`).
|
||||
|
||||
## 5.7.3 (2018-09-10)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix failure to tokenize regexps after expressions like `x.of`.
|
||||
|
||||
Better error message for unterminated template literals.
|
||||
|
||||
## 5.7.2 (2018-08-24)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Properly handle `allowAwaitOutsideFunction` in for statements.
|
||||
|
||||
Treat function declarations at the top level of modules like let bindings.
|
||||
|
||||
Don't allow async function declarations as the only statement under a label.
|
||||
|
||||
## 5.7.0 (2018-06-15)
|
||||
|
||||
### New features
|
||||
|
||||
Upgraded to Unicode 11.
|
||||
|
||||
## 5.6.0 (2018-05-31)
|
||||
|
||||
### New features
|
||||
|
||||
Allow U+2028 and U+2029 in string when ECMAVersion >= 10.
|
||||
|
||||
Allow binding-less catch statements when ECMAVersion >= 10.
|
||||
|
||||
Add `allowAwaitOutsideFunction` option for parsing top-level `await`.
|
||||
|
||||
## 5.5.3 (2018-03-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
A _second_ republish of the code in 5.5.1, this time with yarn, to hopefully get valid timestamps.
|
||||
|
||||
## 5.5.2 (2018-03-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
A republish of the code in 5.5.1 in an attempt to solve an issue with the file timestamps in the npm package being 0.
|
||||
|
||||
## 5.5.1 (2018-03-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix misleading error message for octal escapes in template strings.
|
||||
|
||||
## 5.5.0 (2018-02-27)
|
||||
|
||||
### New features
|
||||
|
||||
The identifier character categorization is now based on Unicode version 10.
|
||||
|
||||
Acorn will now validate the content of regular expressions, including new ES9 features.
|
||||
|
||||
## 5.4.0 (2018-02-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow duplicate or escaped flags on regular expressions.
|
||||
|
||||
Disallow octal escapes in strings in strict mode.
|
||||
|
||||
### New features
|
||||
|
||||
Add support for async iteration.
|
||||
|
||||
Add support for object spread and rest.
|
||||
|
||||
## 5.3.0 (2017-12-28)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix parsing of floating point literals with leading zeroes in loose mode.
|
||||
|
||||
Allow duplicate property names in object patterns.
|
||||
|
||||
Don't allow static class methods named `prototype`.
|
||||
|
||||
Disallow async functions directly under `if` or `else`.
|
||||
|
||||
Parse right-hand-side of `for`/`of` as an assignment expression.
|
||||
|
||||
Stricter parsing of `for`/`in`.
|
||||
|
||||
Don't allow unicode escapes in contextual keywords.
|
||||
|
||||
### New features
|
||||
|
||||
Parsing class members was factored into smaller methods to allow plugins to hook into it.
|
||||
|
||||
## 5.2.1 (2017-10-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix a token context corruption bug.
|
||||
|
||||
## 5.2.0 (2017-10-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix token context tracking for `class` and `function` in property-name position.
|
||||
|
||||
Make sure `%*` isn't parsed as a valid operator.
|
||||
|
||||
Allow shorthand properties `get` and `set` to be followed by default values.
|
||||
|
||||
Disallow `super` when not in callee or object position.
|
||||
|
||||
### New features
|
||||
|
||||
Support [`directive` property](https://github.com/estree/estree/compare/b3de58c9997504d6fba04b72f76e6dd1619ee4eb...1da8e603237144f44710360f8feb7a9977e905e0) on directive expression statements.
|
||||
|
||||
## 5.1.2 (2017-09-04)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disable parsing of legacy HTML-style comments in modules.
|
||||
|
||||
Fix parsing of async methods whose names are keywords.
|
||||
|
||||
## 5.1.1 (2017-07-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix problem with disambiguating regexp and division after a class.
|
||||
|
||||
## 5.1.0 (2017-07-05)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix tokenizing of regexps in an object-desctructuring `for`/`of` loop and after `yield`.
|
||||
|
||||
Parse zero-prefixed numbers with non-octal digits as decimal.
|
||||
|
||||
Allow object/array patterns in rest parameters.
|
||||
|
||||
Don't error when `yield` is used as a property name.
|
||||
|
||||
Allow `async` as a shorthand object property.
|
||||
|
||||
### New features
|
||||
|
||||
Implement the [template literal revision proposal](https://github.com/tc39/proposal-template-literal-revision) for ES9.
|
||||
|
||||
## 5.0.3 (2017-04-01)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix spurious duplicate variable definition errors for named functions.
|
||||
|
||||
## 5.0.2 (2017-03-30)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
A binary operator after a parenthesized arrow expression is no longer incorrectly treated as an error.
|
||||
|
||||
## 5.0.0 (2017-03-28)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Raise an error for duplicated lexical bindings.
|
||||
|
||||
Fix spurious error when an assignement expression occurred after a spread expression.
|
||||
|
||||
Accept regular expressions after `of` (in `for`/`of`), `yield` (in a generator), and braced arrow functions.
|
||||
|
||||
Allow labels in front or `var` declarations, even in strict mode.
|
||||
|
||||
### Breaking changes
|
||||
|
||||
Parse declarations following `export default` as declaration nodes, not expressions. This means that class and function declarations nodes can now have `null` as their `id`.
|
||||
|
||||
## 4.0.11 (2017-02-07)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Allow all forms of member expressions to be parenthesized as lvalue.
|
||||
|
||||
## 4.0.10 (2017-02-07)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Don't expect semicolons after default-exported functions or classes, even when they are expressions.
|
||||
|
||||
Check for use of `'use strict'` directives in non-simple parameter functions, even when already in strict mode.
|
||||
|
||||
## 4.0.9 (2017-02-06)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix incorrect error raised for parenthesized simple assignment targets, so that `(x) = 1` parses again.
|
||||
|
||||
## 4.0.8 (2017-02-03)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Solve spurious parenthesized pattern errors by temporarily erring on the side of accepting programs that our delayed errors don't handle correctly yet.
|
||||
|
||||
## 4.0.7 (2017-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Accept invalidly rejected code like `(x).y = 2` again.
|
||||
|
||||
Don't raise an error when a function _inside_ strict code has a non-simple parameter list.
|
||||
|
||||
## 4.0.6 (2017-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix exponential behavior (manifesting itself as a complete hang for even relatively small source files) introduced by the new 'use strict' check.
|
||||
|
||||
## 4.0.5 (2017-02-02)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Disallow parenthesized pattern expressions.
|
||||
|
||||
Allow keywords as export names.
|
||||
|
||||
Don't allow the `async` keyword to be parenthesized.
|
||||
|
||||
Properly raise an error when a keyword contains a character escape.
|
||||
|
||||
Allow `"use strict"` to appear after other string literal expressions.
|
||||
|
||||
Disallow labeled declarations.
|
||||
|
||||
## 4.0.4 (2016-12-19)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix crash when `export` was followed by a keyword that can't be
|
||||
exported.
|
||||
|
||||
## 4.0.3 (2016-08-16)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Allow regular function declarations inside single-statement `if` branches in loose mode. Forbid them entirely in strict mode.
|
||||
|
||||
Properly parse properties named `async` in ES2017 mode.
|
||||
|
||||
Fix bug where reserved words were broken in ES2017 mode.
|
||||
|
||||
## 4.0.2 (2016-08-11)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Don't ignore period or 'e' characters after octal numbers.
|
||||
|
||||
Fix broken parsing for call expressions in default parameter values of arrow functions.
|
||||
|
||||
## 4.0.1 (2016-08-08)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix false positives in duplicated export name errors.
|
||||
|
||||
## 4.0.0 (2016-08-07)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The default `ecmaVersion` option value is now 7.
|
||||
|
||||
A number of internal method signatures changed, so plugins might need to be updated.
|
||||
|
||||
### Bug fixes
|
||||
|
||||
The parser now raises errors on duplicated export names.
|
||||
|
||||
`arguments` and `eval` can now be used in shorthand properties.
|
||||
|
||||
Duplicate parameter names in non-simple argument lists now always produce an error.
|
||||
|
||||
### New features
|
||||
|
||||
The `ecmaVersion` option now also accepts year-style version numbers
|
||||
(2015, etc).
|
||||
|
||||
Support for `async`/`await` syntax when `ecmaVersion` is >= 8.
|
||||
|
||||
Support for trailing commas in call expressions when `ecmaVersion` is >= 8.
|
||||
|
||||
## 3.3.0 (2016-07-25)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Fix bug in tokenizing of regexp operator after a function declaration.
|
||||
|
||||
Fix parser crash when parsing an array pattern with a hole.
|
||||
|
||||
### New features
|
||||
|
||||
Implement check against complex argument lists in functions that enable strict mode in ES7.
|
||||
|
||||
## 3.2.0 (2016-06-07)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Improve handling of lack of unicode regexp support in host
|
||||
environment.
|
||||
|
||||
Properly reject shorthand properties whose name is a keyword.
|
||||
|
||||
### New features
|
||||
|
||||
Visitors created with `visit.make` now have their base as _prototype_, rather than copying properties into a fresh object.
|
||||
|
||||
## 3.1.0 (2016-04-18)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
Properly tokenize the division operator directly after a function expression.
|
||||
|
||||
Allow trailing comma in destructuring arrays.
|
||||
|
||||
## 3.0.4 (2016-02-25)
|
||||
|
||||
### Fixes
|
||||
|
||||
Allow update expressions as left-hand-side of the ES7 exponential operator.
|
||||
|
||||
## 3.0.2 (2016-02-10)
|
||||
|
||||
### Fixes
|
||||
|
||||
Fix bug that accidentally made `undefined` a reserved word when parsing ES7.
|
||||
|
||||
## 3.0.0 (2016-02-10)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
The default value of the `ecmaVersion` option is now 6 (used to be 5).
|
||||
|
||||
Support for comprehension syntax (which was dropped from the draft spec) has been removed.
|
||||
|
||||
### Fixes
|
||||
|
||||
`let` and `yield` are now “contextual keywords”, meaning you can mostly use them as identifiers in ES5 non-strict code.
|
||||
|
||||
A parenthesized class or function expression after `export default` is now parsed correctly.
|
||||
|
||||
### New features
|
||||
|
||||
When `ecmaVersion` is set to 7, Acorn will parse the exponentiation operator (`**`).
|
||||
|
||||
The identifier character ranges are now based on Unicode 8.0.0.
|
||||
|
||||
Plugins can now override the `raiseRecoverable` method to override the way non-critical errors are handled.
|
||||
|
||||
## 2.7.0 (2016-01-04)
|
||||
|
||||
### Fixes
|
||||
|
||||
Stop allowing rest parameters in setters.
|
||||
|
||||
Disallow `y` rexexp flag in ES5.
|
||||
|
||||
Disallow `\00` and `\000` escapes in strict mode.
|
||||
|
||||
Raise an error when an import name is a reserved word.
|
||||
|
||||
## 2.6.2 (2015-11-10)
|
||||
|
||||
### Fixes
|
||||
|
||||
Don't crash when no options object is passed.
|
||||
|
||||
## 2.6.0 (2015-11-09)
|
||||
|
||||
### Fixes
|
||||
|
||||
Add `await` as a reserved word in module sources.
|
||||
|
||||
Disallow `yield` in a parameter default value for a generator.
|
||||
|
||||
Forbid using a comma after a rest pattern in an array destructuring.
|
||||
|
||||
### New features
|
||||
|
||||
Support parsing stdin in command-line tool.
|
||||
|
||||
## 2.5.0 (2015-10-27)
|
||||
|
||||
### Fixes
|
||||
|
||||
Fix tokenizer support in the command-line tool.
|
||||
|
||||
Stop allowing `new.target` outside of functions.
|
||||
|
||||
Remove legacy `guard` and `guardedHandler` properties from try nodes.
|
||||
|
||||
Stop allowing multiple `__proto__` properties on an object literal in strict mode.
|
||||
|
||||
Don't allow rest parameters to be non-identifier patterns.
|
||||
|
||||
Check for duplicate paramter names in arrow functions.
|
21
Lab2/node_modules/.acorn-HkmHiliI/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2012-2022 by various contributors (see AUTHORS)
|
||||
|
||||
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.
|
283
Lab2/node_modules/.acorn-HkmHiliI/README.md
generated
vendored
Normal file
@ -0,0 +1,283 @@
|
||||
# Acorn
|
||||
|
||||
A tiny, fast JavaScript parser written in JavaScript.
|
||||
|
||||
## Community
|
||||
|
||||
Acorn is open source software released under an
|
||||
[MIT license](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE).
|
||||
|
||||
You are welcome to
|
||||
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
|
||||
requests on [github](https://github.com/acornjs/acorn).
|
||||
|
||||
## Installation
|
||||
|
||||
The easiest way to install acorn is from [`npm`](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
npm install acorn
|
||||
```
|
||||
|
||||
Alternately, you can download the source and build acorn yourself:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/acornjs/acorn.git
|
||||
cd acorn
|
||||
npm install
|
||||
```
|
||||
|
||||
## Interface
|
||||
|
||||
**parse**`(input, options)` is the main interface to the library. The
|
||||
`input` parameter is a string, `options` must be an object setting
|
||||
some of the options listed below. The return value will be an abstract
|
||||
syntax tree object as specified by the [ESTree
|
||||
spec](https://github.com/estree/estree).
|
||||
|
||||
```javascript
|
||||
let acorn = require("acorn");
|
||||
console.log(acorn.parse("1 + 1", {ecmaVersion: 2020}));
|
||||
```
|
||||
|
||||
When encountering a syntax error, the parser will raise a
|
||||
`SyntaxError` object with a meaningful message. The error object will
|
||||
have a `pos` property that indicates the string offset at which the
|
||||
error occurred, and a `loc` object that contains a `{line, column}`
|
||||
object referring to that same position.
|
||||
|
||||
Options are provided by in a second argument, which should be an
|
||||
object containing any of these fields (only `ecmaVersion` is
|
||||
required):
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||
either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019),
|
||||
11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"` (the
|
||||
latest the library supports). This influences support for strict
|
||||
mode, the set of reserved words, and support for new syntax
|
||||
features.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features must be
|
||||
implemented through plugins.
|
||||
|
||||
- **sourceType**: Indicate the mode the code should be parsed in. Can be
|
||||
either `"script"` or `"module"`. This influences global strict mode
|
||||
and parsing of `import` and `export` declarations.
|
||||
|
||||
**NOTE**: If set to `"module"`, then static `import` / `export` syntax
|
||||
will be valid, even if `ecmaVersion` is less than 6.
|
||||
|
||||
- **onInsertedSemicolon**: If given a callback, that callback will be
|
||||
called whenever a missing semicolon is inserted by the parser. The
|
||||
callback will be given the character offset of the point where the
|
||||
semicolon is inserted as argument, and if `locations` is on, also a
|
||||
`{line, column}` object representing this position.
|
||||
|
||||
- **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing
|
||||
commas.
|
||||
|
||||
- **allowReserved**: If `false`, using a reserved word will generate
|
||||
an error. Defaults to `true` for `ecmaVersion` 3, `false` for higher
|
||||
versions. When given the value `"never"`, reserved words and
|
||||
keywords can also not be used as property names (as in Internet
|
||||
Explorer's old parser).
|
||||
|
||||
- **allowReturnOutsideFunction**: By default, a return statement at
|
||||
the top level raises an error. Set this to `true` to accept such
|
||||
code.
|
||||
|
||||
- **allowImportExportEverywhere**: By default, `import` and `export`
|
||||
declarations can only appear at a program's top level. Setting this
|
||||
option to `true` allows them anywhere where a statement is allowed,
|
||||
and also allows `import.meta` expressions to appear in scripts
|
||||
(when `sourceType` is not `"module"`).
|
||||
|
||||
- **allowAwaitOutsideFunction**: If `false`, `await` expressions can
|
||||
only appear inside `async` functions. Defaults to `true` in modules
|
||||
for `ecmaVersion` 2022 and later, `false` for lower versions.
|
||||
Setting this option to `true` allows to have top-level `await`
|
||||
expressions. They are still not allowed in non-`async` functions,
|
||||
though.
|
||||
|
||||
- **allowSuperOutsideMethod**: By default, `super` outside a method
|
||||
raises an error. Set this to `true` to accept such code.
|
||||
|
||||
- **allowHashBang**: When this is enabled, if the code starts with the
|
||||
characters `#!` (as in a shellscript), the first line will be
|
||||
treated as a comment. Defaults to true when `ecmaVersion` >= 2023.
|
||||
|
||||
- **checkPrivateFields**: By default, the parser will verify that
|
||||
private properties are only used in places where they are valid and
|
||||
have been declared. Set this to false to turn such checks off.
|
||||
|
||||
- **locations**: When `true`, each node has a `loc` object attached
|
||||
with `start` and `end` subobjects, each of which contains the
|
||||
one-based line and zero-based column numbers in `{line, column}`
|
||||
form. Default is `false`.
|
||||
|
||||
- **onToken**: If a function is passed for this option, each found
|
||||
token will be passed in same format as tokens returned from
|
||||
`tokenizer().getToken()`.
|
||||
|
||||
If array is passed, each found token is pushed to it.
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **onComment**: If a function is passed for this option, whenever a
|
||||
comment is encountered the function will be called with the
|
||||
following parameters:
|
||||
|
||||
- `block`: `true` if the comment is a block comment, false if it
|
||||
is a line comment.
|
||||
- `text`: The content of the comment.
|
||||
- `start`: Character offset of the start of the comment.
|
||||
- `end`: Character offset of the end of the comment.
|
||||
|
||||
When the `locations` options is on, the `{line, column}` locations
|
||||
of the comment’s start and end are passed as two additional
|
||||
parameters.
|
||||
|
||||
If array is passed for this option, each found comment is pushed
|
||||
to it as object in Esprima format:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"type": "Line" | "Block",
|
||||
"value": "comment text",
|
||||
"start": Number,
|
||||
"end": Number,
|
||||
// If `locations` option is on:
|
||||
"loc": {
|
||||
"start": {line: Number, column: Number}
|
||||
"end": {line: Number, column: Number}
|
||||
},
|
||||
// If `ranges` option is on:
|
||||
"range": [Number, Number]
|
||||
}
|
||||
```
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **ranges**: Nodes have their start and end characters offsets
|
||||
recorded in `start` and `end` properties (directly on the node,
|
||||
rather than the `loc` object, which holds line/column data. To also
|
||||
add a
|
||||
[semi-standardized](https://bugzilla.mozilla.org/show_bug.cgi?id=745678)
|
||||
`range` property holding a `[start, end]` array with the same
|
||||
numbers, set the `ranges` option to `true`.
|
||||
|
||||
- **program**: It is possible to parse multiple files into a single
|
||||
AST by passing the tree produced by parsing the first file as the
|
||||
`program` option in subsequent parses. This will add the toplevel
|
||||
forms of the parsed file to the "Program" (top) node of an existing
|
||||
parse tree.
|
||||
|
||||
- **sourceFile**: When the `locations` option is `true`, you can pass
|
||||
this option to add a `source` attribute in every node’s `loc`
|
||||
object. Note that the contents of this option are not examined or
|
||||
processed in any way; you are free to use whatever format you
|
||||
choose.
|
||||
|
||||
- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property
|
||||
will be added (regardless of the `location` option) directly to the
|
||||
nodes, rather than the `loc` object.
|
||||
|
||||
- **preserveParens**: If this option is `true`, parenthesized expressions
|
||||
are represented by (non-standard) `ParenthesizedExpression` nodes
|
||||
that have a single `expression` property containing the expression
|
||||
inside parentheses.
|
||||
|
||||
**parseExpressionAt**`(input, offset, options)` will parse a single
|
||||
expression in a string, and return its AST. It will not complain if
|
||||
there is more of the string left after the expression.
|
||||
|
||||
**tokenizer**`(input, options)` returns an object with a `getToken`
|
||||
method that can be called repeatedly to get the next token, a `{start,
|
||||
end, type, value}` object (with added `loc` property when the
|
||||
`locations` option is enabled and `range` property when the `ranges`
|
||||
option is enabled). When the token's type is `tokTypes.eof`, you
|
||||
should stop calling the method, since it will keep returning that same
|
||||
token forever.
|
||||
|
||||
Note that tokenizing JavaScript without parsing it is, in modern
|
||||
versions of the language, not really possible due to the way syntax is
|
||||
overloaded in ways that can only be disambiguated by the parse
|
||||
context. This package applies a bunch of heuristics to try and do a
|
||||
reasonable job, but you are advised to use `parse` with the `onToken`
|
||||
option instead of this.
|
||||
|
||||
In ES6 environment, returned result can be used as any other
|
||||
protocol-compliant iterable:
|
||||
|
||||
```javascript
|
||||
for (let token of acorn.tokenizer(str)) {
|
||||
// iterate over the tokens
|
||||
}
|
||||
|
||||
// transform code to array of tokens:
|
||||
var tokens = [...acorn.tokenizer(str)];
|
||||
```
|
||||
|
||||
**tokTypes** holds an object mapping names to the token type objects
|
||||
that end up in the `type` properties of tokens.
|
||||
|
||||
**getLineInfo**`(input, offset)` can be used to get a `{line,
|
||||
column}` object for a given program string and offset.
|
||||
|
||||
### The `Parser` class
|
||||
|
||||
Instances of the **`Parser`** class contain all the state and logic
|
||||
that drives a parse. It has static methods `parse`,
|
||||
`parseExpressionAt`, and `tokenizer` that match the top-level
|
||||
functions by the same name.
|
||||
|
||||
When extending the parser with plugins, you need to call these methods
|
||||
on the extended version of the class. To extend a parser with plugins,
|
||||
you can use its static `extend` method.
|
||||
|
||||
```javascript
|
||||
var acorn = require("acorn");
|
||||
var jsx = require("acorn-jsx");
|
||||
var JSXParser = acorn.Parser.extend(jsx());
|
||||
JSXParser.parse("foo(<bar/>)", {ecmaVersion: 2020});
|
||||
```
|
||||
|
||||
The `extend` method takes any number of plugin values, and returns a
|
||||
new `Parser` class that includes the extra parser logic provided by
|
||||
the plugins.
|
||||
|
||||
## Command line interface
|
||||
|
||||
The `bin/acorn` utility can be used to parse a file from the command
|
||||
line. It accepts as arguments its input file and the following
|
||||
options:
|
||||
|
||||
- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version
|
||||
to parse. Default is version 9.
|
||||
|
||||
- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise.
|
||||
|
||||
- `--locations`: Attaches a "loc" object to each node with "start" and
|
||||
"end" subobjects, each of which contains the one-based line and
|
||||
zero-based column numbers in `{line, column}` form.
|
||||
|
||||
- `--allow-hash-bang`: If the code starts with the characters #! (as
|
||||
in a shellscript), the first line will be treated as a comment.
|
||||
|
||||
- `--allow-await-outside-function`: Allows top-level `await` expressions.
|
||||
See the `allowAwaitOutsideFunction` option for more information.
|
||||
|
||||
- `--compact`: No whitespace is used in the AST output.
|
||||
|
||||
- `--silent`: Do not output the AST, just return the exit status.
|
||||
|
||||
- `--help`: Print the usage information and quit.
|
||||
|
||||
The utility spits out the syntax tree as JSON data.
|
||||
|
||||
## Existing plugins
|
||||
|
||||
- [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx)
|
4
Lab2/node_modules/.acorn-HkmHiliI/bin/acorn
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict"
|
||||
|
||||
require("../dist/bin.js")
|
857
Lab2/node_modules/.acorn-HkmHiliI/dist/acorn.d.mts
generated
vendored
Normal file
@ -0,0 +1,857 @@
|
||||
export interface Node {
|
||||
start: number
|
||||
end: number
|
||||
type: string
|
||||
range?: [number, number]
|
||||
loc?: SourceLocation | null
|
||||
}
|
||||
|
||||
export interface SourceLocation {
|
||||
source?: string | null
|
||||
start: Position
|
||||
end: Position
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
/** 1-based */
|
||||
line: number
|
||||
/** 0-based */
|
||||
column: number
|
||||
}
|
||||
|
||||
export interface Identifier extends Node {
|
||||
type: "Identifier"
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface Literal extends Node {
|
||||
type: "Literal"
|
||||
value?: string | boolean | null | number | RegExp | bigint
|
||||
raw?: string
|
||||
regex?: {
|
||||
pattern: string
|
||||
flags: string
|
||||
}
|
||||
bigint?: string
|
||||
}
|
||||
|
||||
export interface Program extends Node {
|
||||
type: "Program"
|
||||
body: Array<Statement | ModuleDeclaration>
|
||||
sourceType: "script" | "module"
|
||||
}
|
||||
|
||||
export interface Function extends Node {
|
||||
id?: Identifier | null
|
||||
params: Array<Pattern>
|
||||
body: BlockStatement | Expression
|
||||
generator: boolean
|
||||
expression: boolean
|
||||
async: boolean
|
||||
}
|
||||
|
||||
export interface ExpressionStatement extends Node {
|
||||
type: "ExpressionStatement"
|
||||
expression: Expression | Literal
|
||||
directive?: string
|
||||
}
|
||||
|
||||
export interface BlockStatement extends Node {
|
||||
type: "BlockStatement"
|
||||
body: Array<Statement>
|
||||
}
|
||||
|
||||
export interface EmptyStatement extends Node {
|
||||
type: "EmptyStatement"
|
||||
}
|
||||
|
||||
export interface DebuggerStatement extends Node {
|
||||
type: "DebuggerStatement"
|
||||
}
|
||||
|
||||
export interface WithStatement extends Node {
|
||||
type: "WithStatement"
|
||||
object: Expression
|
||||
body: Statement
|
||||
}
|
||||
|
||||
export interface ReturnStatement extends Node {
|
||||
type: "ReturnStatement"
|
||||
argument?: Expression | null
|
||||
}
|
||||
|
||||
export interface LabeledStatement extends Node {
|
||||
type: "LabeledStatement"
|
||||
label: Identifier
|
||||
body: Statement
|
||||
}
|
||||
|
||||
export interface BreakStatement extends Node {
|
||||
type: "BreakStatement"
|
||||
label?: Identifier | null
|
||||
}
|
||||
|
||||
export interface ContinueStatement extends Node {
|
||||
type: "ContinueStatement"
|
||||
label?: Identifier | null
|
||||
}
|
||||
|
||||
export interface IfStatement extends Node {
|
||||
type: "IfStatement"
|
||||
test: Expression
|
||||
consequent: Statement
|
||||
alternate?: Statement | null
|
||||
}
|
||||
|
||||
export interface SwitchStatement extends Node {
|
||||
type: "SwitchStatement"
|
||||
discriminant: Expression
|
||||
cases: Array<SwitchCase>
|
||||
}
|
||||
|
||||
export interface SwitchCase extends Node {
|
||||
type: "SwitchCase"
|
||||
test?: Expression | null
|
||||
consequent: Array<Statement>
|
||||
}
|
||||
|
||||
export interface ThrowStatement extends Node {
|
||||
type: "ThrowStatement"
|
||||
argument: Expression
|
||||
}
|
||||
|
||||
export interface TryStatement extends Node {
|
||||
type: "TryStatement"
|
||||
block: BlockStatement
|
||||
handler?: CatchClause | null
|
||||
finalizer?: BlockStatement | null
|
||||
}
|
||||
|
||||
export interface CatchClause extends Node {
|
||||
type: "CatchClause"
|
||||
param?: Pattern | null
|
||||
body: BlockStatement
|
||||
}
|
||||
|
||||
export interface WhileStatement extends Node {
|
||||
type: "WhileStatement"
|
||||
test: Expression
|
||||
body: Statement
|
||||
}
|
||||
|
||||
export interface DoWhileStatement extends Node {
|
||||
type: "DoWhileStatement"
|
||||
body: Statement
|
||||
test: Expression
|
||||
}
|
||||
|
||||
export interface ForStatement extends Node {
|
||||
type: "ForStatement"
|
||||
init?: VariableDeclaration | Expression | null
|
||||
test?: Expression | null
|
||||
update?: Expression | null
|
||||
body: Statement
|
||||
}
|
||||
|
||||
export interface ForInStatement extends Node {
|
||||
type: "ForInStatement"
|
||||
left: VariableDeclaration | Pattern
|
||||
right: Expression
|
||||
body: Statement
|
||||
}
|
||||
|
||||
export interface FunctionDeclaration extends Function {
|
||||
type: "FunctionDeclaration"
|
||||
id: Identifier
|
||||
body: BlockStatement
|
||||
}
|
||||
|
||||
export interface VariableDeclaration extends Node {
|
||||
type: "VariableDeclaration"
|
||||
declarations: Array<VariableDeclarator>
|
||||
kind: "var" | "let" | "const"
|
||||
}
|
||||
|
||||
export interface VariableDeclarator extends Node {
|
||||
type: "VariableDeclarator"
|
||||
id: Pattern
|
||||
init?: Expression | null
|
||||
}
|
||||
|
||||
export interface ThisExpression extends Node {
|
||||
type: "ThisExpression"
|
||||
}
|
||||
|
||||
export interface ArrayExpression extends Node {
|
||||
type: "ArrayExpression"
|
||||
elements: Array<Expression | SpreadElement | null>
|
||||
}
|
||||
|
||||
export interface ObjectExpression extends Node {
|
||||
type: "ObjectExpression"
|
||||
properties: Array<Property | SpreadElement>
|
||||
}
|
||||
|
||||
export interface Property extends Node {
|
||||
type: "Property"
|
||||
key: Expression
|
||||
value: Expression
|
||||
kind: "init" | "get" | "set"
|
||||
method: boolean
|
||||
shorthand: boolean
|
||||
computed: boolean
|
||||
}
|
||||
|
||||
export interface FunctionExpression extends Function {
|
||||
type: "FunctionExpression"
|
||||
body: BlockStatement
|
||||
}
|
||||
|
||||
export interface UnaryExpression extends Node {
|
||||
type: "UnaryExpression"
|
||||
operator: UnaryOperator
|
||||
prefix: boolean
|
||||
argument: Expression
|
||||
}
|
||||
|
||||
export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"
|
||||
|
||||
export interface UpdateExpression extends Node {
|
||||
type: "UpdateExpression"
|
||||
operator: UpdateOperator
|
||||
argument: Expression
|
||||
prefix: boolean
|
||||
}
|
||||
|
||||
export type UpdateOperator = "++" | "--"
|
||||
|
||||
export interface BinaryExpression extends Node {
|
||||
type: "BinaryExpression"
|
||||
operator: BinaryOperator
|
||||
left: Expression | PrivateIdentifier
|
||||
right: Expression
|
||||
}
|
||||
|
||||
export type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "in" | "instanceof" | "**"
|
||||
|
||||
export interface AssignmentExpression extends Node {
|
||||
type: "AssignmentExpression"
|
||||
operator: AssignmentOperator
|
||||
left: Pattern
|
||||
right: Expression
|
||||
}
|
||||
|
||||
export type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "**=" | "||=" | "&&=" | "??="
|
||||
|
||||
export interface LogicalExpression extends Node {
|
||||
type: "LogicalExpression"
|
||||
operator: LogicalOperator
|
||||
left: Expression
|
||||
right: Expression
|
||||
}
|
||||
|
||||
export type LogicalOperator = "||" | "&&" | "??"
|
||||
|
||||
export interface MemberExpression extends Node {
|
||||
type: "MemberExpression"
|
||||
object: Expression | Super
|
||||
property: Expression | PrivateIdentifier
|
||||
computed: boolean
|
||||
optional: boolean
|
||||
}
|
||||
|
||||
export interface ConditionalExpression extends Node {
|
||||
type: "ConditionalExpression"
|
||||
test: Expression
|
||||
alternate: Expression
|
||||
consequent: Expression
|
||||
}
|
||||
|
||||
export interface CallExpression extends Node {
|
||||
type: "CallExpression"
|
||||
callee: Expression | Super
|
||||
arguments: Array<Expression | SpreadElement>
|
||||
optional: boolean
|
||||
}
|
||||
|
||||
export interface NewExpression extends Node {
|
||||
type: "NewExpression"
|
||||
callee: Expression
|
||||
arguments: Array<Expression | SpreadElement>
|
||||
}
|
||||
|
||||
export interface SequenceExpression extends Node {
|
||||
type: "SequenceExpression"
|
||||
expressions: Array<Expression>
|
||||
}
|
||||
|
||||
export interface ForOfStatement extends Node {
|
||||
type: "ForOfStatement"
|
||||
left: VariableDeclaration | Pattern
|
||||
right: Expression
|
||||
body: Statement
|
||||
await: boolean
|
||||
}
|
||||
|
||||
export interface Super extends Node {
|
||||
type: "Super"
|
||||
}
|
||||
|
||||
export interface SpreadElement extends Node {
|
||||
type: "SpreadElement"
|
||||
argument: Expression
|
||||
}
|
||||
|
||||
export interface ArrowFunctionExpression extends Function {
|
||||
type: "ArrowFunctionExpression"
|
||||
}
|
||||
|
||||
export interface YieldExpression extends Node {
|
||||
type: "YieldExpression"
|
||||
argument?: Expression | null
|
||||
delegate: boolean
|
||||
}
|
||||
|
||||
export interface TemplateLiteral extends Node {
|
||||
type: "TemplateLiteral"
|
||||
quasis: Array<TemplateElement>
|
||||
expressions: Array<Expression>
|
||||
}
|
||||
|
||||
export interface TaggedTemplateExpression extends Node {
|
||||
type: "TaggedTemplateExpression"
|
||||
tag: Expression
|
||||
quasi: TemplateLiteral
|
||||
}
|
||||
|
||||
export interface TemplateElement extends Node {
|
||||
type: "TemplateElement"
|
||||
tail: boolean
|
||||
value: {
|
||||
cooked?: string | null
|
||||
raw: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface AssignmentProperty extends Node {
|
||||
type: "Property"
|
||||
key: Expression
|
||||
value: Pattern
|
||||
kind: "init"
|
||||
method: false
|
||||
shorthand: boolean
|
||||
computed: boolean
|
||||
}
|
||||
|
||||
export interface ObjectPattern extends Node {
|
||||
type: "ObjectPattern"
|
||||
properties: Array<AssignmentProperty | RestElement>
|
||||
}
|
||||
|
||||
export interface ArrayPattern extends Node {
|
||||
type: "ArrayPattern"
|
||||
elements: Array<Pattern | null>
|
||||
}
|
||||
|
||||
export interface RestElement extends Node {
|
||||
type: "RestElement"
|
||||
argument: Pattern
|
||||
}
|
||||
|
||||
export interface AssignmentPattern extends Node {
|
||||
type: "AssignmentPattern"
|
||||
left: Pattern
|
||||
right: Expression
|
||||
}
|
||||
|
||||
export interface Class extends Node {
|
||||
id?: Identifier | null
|
||||
superClass?: Expression | null
|
||||
body: ClassBody
|
||||
}
|
||||
|
||||
export interface ClassBody extends Node {
|
||||
type: "ClassBody"
|
||||
body: Array<MethodDefinition | PropertyDefinition | StaticBlock>
|
||||
}
|
||||
|
||||
export interface MethodDefinition extends Node {
|
||||
type: "MethodDefinition"
|
||||
key: Expression | PrivateIdentifier
|
||||
value: FunctionExpression
|
||||
kind: "constructor" | "method" | "get" | "set"
|
||||
computed: boolean
|
||||
static: boolean
|
||||
}
|
||||
|
||||
export interface ClassDeclaration extends Class {
|
||||
type: "ClassDeclaration"
|
||||
id: Identifier
|
||||
}
|
||||
|
||||
export interface ClassExpression extends Class {
|
||||
type: "ClassExpression"
|
||||
}
|
||||
|
||||
export interface MetaProperty extends Node {
|
||||
type: "MetaProperty"
|
||||
meta: Identifier
|
||||
property: Identifier
|
||||
}
|
||||
|
||||
export interface ImportDeclaration extends Node {
|
||||
type: "ImportDeclaration"
|
||||
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>
|
||||
source: Literal
|
||||
}
|
||||
|
||||
export interface ImportSpecifier extends Node {
|
||||
type: "ImportSpecifier"
|
||||
imported: Identifier | Literal
|
||||
local: Identifier
|
||||
}
|
||||
|
||||
export interface ImportDefaultSpecifier extends Node {
|
||||
type: "ImportDefaultSpecifier"
|
||||
local: Identifier
|
||||
}
|
||||
|
||||
export interface ImportNamespaceSpecifier extends Node {
|
||||
type: "ImportNamespaceSpecifier"
|
||||
local: Identifier
|
||||
}
|
||||
|
||||
export interface ExportNamedDeclaration extends Node {
|
||||
type: "ExportNamedDeclaration"
|
||||
declaration?: Declaration | null
|
||||
specifiers: Array<ExportSpecifier>
|
||||
source?: Literal | null
|
||||
}
|
||||
|
||||
export interface ExportSpecifier extends Node {
|
||||
type: "ExportSpecifier"
|
||||
exported: Identifier | Literal
|
||||
local: Identifier | Literal
|
||||
}
|
||||
|
||||
export interface AnonymousFunctionDeclaration extends Function {
|
||||
type: "FunctionDeclaration"
|
||||
id: null
|
||||
body: BlockStatement
|
||||
}
|
||||
|
||||
export interface AnonymousClassDeclaration extends Class {
|
||||
type: "ClassDeclaration"
|
||||
id: null
|
||||
}
|
||||
|
||||
export interface ExportDefaultDeclaration extends Node {
|
||||
type: "ExportDefaultDeclaration"
|
||||
declaration: AnonymousFunctionDeclaration | FunctionDeclaration | AnonymousClassDeclaration | ClassDeclaration | Expression
|
||||
}
|
||||
|
||||
export interface ExportAllDeclaration extends Node {
|
||||
type: "ExportAllDeclaration"
|
||||
source: Literal
|
||||
exported?: Identifier | Literal | null
|
||||
}
|
||||
|
||||
export interface AwaitExpression extends Node {
|
||||
type: "AwaitExpression"
|
||||
argument: Expression
|
||||
}
|
||||
|
||||
export interface ChainExpression extends Node {
|
||||
type: "ChainExpression"
|
||||
expression: MemberExpression | CallExpression
|
||||
}
|
||||
|
||||
export interface ImportExpression extends Node {
|
||||
type: "ImportExpression"
|
||||
source: Expression
|
||||
}
|
||||
|
||||
export interface ParenthesizedExpression extends Node {
|
||||
type: "ParenthesizedExpression"
|
||||
expression: Expression
|
||||
}
|
||||
|
||||
export interface PropertyDefinition extends Node {
|
||||
type: "PropertyDefinition"
|
||||
key: Expression | PrivateIdentifier
|
||||
value?: Expression | null
|
||||
computed: boolean
|
||||
static: boolean
|
||||
}
|
||||
|
||||
export interface PrivateIdentifier extends Node {
|
||||
type: "PrivateIdentifier"
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface StaticBlock extends Node {
|
||||
type: "StaticBlock"
|
||||
body: Array<Statement>
|
||||
}
|
||||
|
||||
export type Statement =
|
||||
| ExpressionStatement
|
||||
| BlockStatement
|
||||
| EmptyStatement
|
||||
| DebuggerStatement
|
||||
| WithStatement
|
||||
| ReturnStatement
|
||||
| LabeledStatement
|
||||
| BreakStatement
|
||||
| ContinueStatement
|
||||
| IfStatement
|
||||
| SwitchStatement
|
||||
| ThrowStatement
|
||||
| TryStatement
|
||||
| WhileStatement
|
||||
| DoWhileStatement
|
||||
| ForStatement
|
||||
| ForInStatement
|
||||
| ForOfStatement
|
||||
| Declaration
|
||||
|
||||
export type Declaration =
|
||||
| FunctionDeclaration
|
||||
| VariableDeclaration
|
||||
| ClassDeclaration
|
||||
|
||||
export type Expression =
|
||||
| Identifier
|
||||
| Literal
|
||||
| ThisExpression
|
||||
| ArrayExpression
|
||||
| ObjectExpression
|
||||
| FunctionExpression
|
||||
| UnaryExpression
|
||||
| UpdateExpression
|
||||
| BinaryExpression
|
||||
| AssignmentExpression
|
||||
| LogicalExpression
|
||||
| MemberExpression
|
||||
| ConditionalExpression
|
||||
| CallExpression
|
||||
| NewExpression
|
||||
| SequenceExpression
|
||||
| ArrowFunctionExpression
|
||||
| YieldExpression
|
||||
| TemplateLiteral
|
||||
| TaggedTemplateExpression
|
||||
| ClassExpression
|
||||
| MetaProperty
|
||||
| AwaitExpression
|
||||
| ChainExpression
|
||||
| ImportExpression
|
||||
| ParenthesizedExpression
|
||||
|
||||
export type Pattern =
|
||||
| Identifier
|
||||
| MemberExpression
|
||||
| ObjectPattern
|
||||
| ArrayPattern
|
||||
| RestElement
|
||||
| AssignmentPattern
|
||||
|
||||
export type ModuleDeclaration =
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportDefaultDeclaration
|
||||
| ExportAllDeclaration
|
||||
|
||||
export type AnyNode = Statement | Expression | Declaration | ModuleDeclaration | Literal | Program | SwitchCase | CatchClause | Property | Super | SpreadElement | TemplateElement | AssignmentProperty | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | ClassBody | MethodDefinition | MetaProperty | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier | AnonymousFunctionDeclaration | AnonymousClassDeclaration | PropertyDefinition | PrivateIdentifier | StaticBlock
|
||||
|
||||
export function parse(input: string, options: Options): Program
|
||||
|
||||
export function parseExpressionAt(input: string, pos: number, options: Options): Expression
|
||||
|
||||
export function tokenizer(input: string, options: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
|
||||
export type ecmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | "latest"
|
||||
|
||||
export interface Options {
|
||||
/**
|
||||
* `ecmaVersion` indicates the ECMAScript version to parse. Must be
|
||||
* either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
|
||||
* (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"`
|
||||
* (the latest version the library supports). This influences
|
||||
* support for strict mode, the set of reserved words, and support
|
||||
* for new syntax features.
|
||||
*/
|
||||
ecmaVersion: ecmaVersion
|
||||
|
||||
/**
|
||||
* `sourceType` indicates the mode the code should be parsed in.
|
||||
* Can be either `"script"` or `"module"`. This influences global
|
||||
* strict mode and parsing of `import` and `export` declarations.
|
||||
*/
|
||||
sourceType?: "script" | "module"
|
||||
|
||||
/**
|
||||
* a callback that will be called when a semicolon is automatically inserted.
|
||||
* @param lastTokEnd the position of the comma as an offset
|
||||
* @param lastTokEndLoc location if {@link locations} is enabled
|
||||
*/
|
||||
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
|
||||
/**
|
||||
* similar to `onInsertedSemicolon`, but for trailing commas
|
||||
* @param lastTokEnd the position of the comma as an offset
|
||||
* @param lastTokEndLoc location if `locations` is enabled
|
||||
*/
|
||||
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
|
||||
/**
|
||||
* By default, reserved words are only enforced if ecmaVersion >= 5.
|
||||
* Set `allowReserved` to a boolean value to explicitly turn this on
|
||||
* an off. When this option has the value "never", reserved words
|
||||
* and keywords can also not be used as property names.
|
||||
*/
|
||||
allowReserved?: boolean | "never"
|
||||
|
||||
/**
|
||||
* When enabled, a return at the top level is not considered an error.
|
||||
*/
|
||||
allowReturnOutsideFunction?: boolean
|
||||
|
||||
/**
|
||||
* When enabled, import/export statements are not constrained to
|
||||
* appearing at the top of the program, and an import.meta expression
|
||||
* in a script isn't considered an error.
|
||||
*/
|
||||
allowImportExportEverywhere?: boolean
|
||||
|
||||
/**
|
||||
* By default, `await` identifiers are allowed to appear at the top-level scope only if {@link ecmaVersion} >= 2022.
|
||||
* When enabled, await identifiers are allowed to appear at the top-level scope,
|
||||
* but they are still not allowed in non-async functions.
|
||||
*/
|
||||
allowAwaitOutsideFunction?: boolean
|
||||
|
||||
/**
|
||||
* When enabled, super identifiers are not constrained to
|
||||
* appearing in methods and do not raise an error when they appear elsewhere.
|
||||
*/
|
||||
allowSuperOutsideMethod?: boolean
|
||||
|
||||
/**
|
||||
* When enabled, hashbang directive in the beginning of file is
|
||||
* allowed and treated as a line comment. Enabled by default when
|
||||
* {@link ecmaVersion} >= 2023.
|
||||
*/
|
||||
allowHashBang?: boolean
|
||||
|
||||
/**
|
||||
* By default, the parser will verify that private properties are
|
||||
* only used in places where they are valid and have been declared.
|
||||
* Set this to false to turn such checks off.
|
||||
*/
|
||||
checkPrivateFields?: boolean
|
||||
|
||||
/**
|
||||
* When `locations` is on, `loc` properties holding objects with
|
||||
* `start` and `end` properties as {@link Position} objects will be attached to the
|
||||
* nodes.
|
||||
*/
|
||||
locations?: boolean
|
||||
|
||||
/**
|
||||
* a callback that will cause Acorn to call that export function with object in the same
|
||||
* format as tokens returned from `tokenizer().getToken()`. Note
|
||||
* that you are not allowed to call the parser from the
|
||||
* callback—that will corrupt its internal state.
|
||||
*/
|
||||
onToken?: ((token: Token) => void) | Token[]
|
||||
|
||||
|
||||
/**
|
||||
* This takes a export function or an array.
|
||||
*
|
||||
* When a export function is passed, Acorn will call that export function with `(block, text, start,
|
||||
* end)` parameters whenever a comment is skipped. `block` is a
|
||||
* boolean indicating whether this is a block (`/* *\/`) comment,
|
||||
* `text` is the content of the comment, and `start` and `end` are
|
||||
* character offsets that denote the start and end of the comment.
|
||||
* When the {@link locations} option is on, two more parameters are
|
||||
* passed, the full locations of {@link Position} export type of the start and
|
||||
* end of the comments.
|
||||
*
|
||||
* When a array is passed, each found comment of {@link Comment} export type is pushed to the array.
|
||||
*
|
||||
* Note that you are not allowed to call the
|
||||
* parser from the callback—that will corrupt its internal state.
|
||||
*/
|
||||
onComment?: ((
|
||||
isBlock: boolean, text: string, start: number, end: number, startLoc?: Position,
|
||||
endLoc?: Position
|
||||
) => void) | Comment[]
|
||||
|
||||
/**
|
||||
* Nodes have their start and end characters offsets recorded in
|
||||
* `start` and `end` properties (directly on the node, rather than
|
||||
* the `loc` object, which holds line/column data. To also add a
|
||||
* [semi-standardized][range] `range` property holding a `[start,
|
||||
* end]` array with the same numbers, set the `ranges` option to
|
||||
* `true`.
|
||||
*/
|
||||
ranges?: boolean
|
||||
|
||||
/**
|
||||
* It is possible to parse multiple files into a single AST by
|
||||
* passing the tree produced by parsing the first file as
|
||||
* `program` option in subsequent parses. This will add the
|
||||
* toplevel forms of the parsed file to the `Program` (top) node
|
||||
* of an existing parse tree.
|
||||
*/
|
||||
program?: Node
|
||||
|
||||
/**
|
||||
* When {@link locations} is on, you can pass this to record the source
|
||||
* file in every node's `loc` object.
|
||||
*/
|
||||
sourceFile?: string
|
||||
|
||||
/**
|
||||
* This value, if given, is stored in every node, whether {@link locations} is on or off.
|
||||
*/
|
||||
directSourceFile?: string
|
||||
|
||||
/**
|
||||
* When enabled, parenthesized expressions are represented by
|
||||
* (non-standard) ParenthesizedExpression nodes
|
||||
*/
|
||||
preserveParens?: boolean
|
||||
}
|
||||
|
||||
export class Parser {
|
||||
options: Options
|
||||
input: string
|
||||
|
||||
private constructor(options: Options, input: string, startPos?: number)
|
||||
parse(): Program
|
||||
|
||||
static parse(input: string, options: Options): Program
|
||||
static parseExpressionAt(input: string, pos: number, options: Options): Expression
|
||||
static tokenizer(input: string, options: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
static extend(...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser
|
||||
}
|
||||
|
||||
export const defaultOptions: Options
|
||||
|
||||
export function getLineInfo(input: string, offset: number): Position
|
||||
|
||||
export class TokenType {
|
||||
label: string
|
||||
keyword: string | undefined
|
||||
}
|
||||
|
||||
export const tokTypes: {
|
||||
num: TokenType
|
||||
regexp: TokenType
|
||||
string: TokenType
|
||||
name: TokenType
|
||||
privateId: TokenType
|
||||
eof: TokenType
|
||||
|
||||
bracketL: TokenType
|
||||
bracketR: TokenType
|
||||
braceL: TokenType
|
||||
braceR: TokenType
|
||||
parenL: TokenType
|
||||
parenR: TokenType
|
||||
comma: TokenType
|
||||
semi: TokenType
|
||||
colon: TokenType
|
||||
dot: TokenType
|
||||
question: TokenType
|
||||
questionDot: TokenType
|
||||
arrow: TokenType
|
||||
template: TokenType
|
||||
invalidTemplate: TokenType
|
||||
ellipsis: TokenType
|
||||
backQuote: TokenType
|
||||
dollarBraceL: TokenType
|
||||
|
||||
eq: TokenType
|
||||
assign: TokenType
|
||||
incDec: TokenType
|
||||
prefix: TokenType
|
||||
logicalOR: TokenType
|
||||
logicalAND: TokenType
|
||||
bitwiseOR: TokenType
|
||||
bitwiseXOR: TokenType
|
||||
bitwiseAND: TokenType
|
||||
equality: TokenType
|
||||
relational: TokenType
|
||||
bitShift: TokenType
|
||||
plusMin: TokenType
|
||||
modulo: TokenType
|
||||
star: TokenType
|
||||
slash: TokenType
|
||||
starstar: TokenType
|
||||
coalesce: TokenType
|
||||
|
||||
_break: TokenType
|
||||
_case: TokenType
|
||||
_catch: TokenType
|
||||
_continue: TokenType
|
||||
_debugger: TokenType
|
||||
_default: TokenType
|
||||
_do: TokenType
|
||||
_else: TokenType
|
||||
_finally: TokenType
|
||||
_for: TokenType
|
||||
_function: TokenType
|
||||
_if: TokenType
|
||||
_return: TokenType
|
||||
_switch: TokenType
|
||||
_throw: TokenType
|
||||
_try: TokenType
|
||||
_var: TokenType
|
||||
_const: TokenType
|
||||
_while: TokenType
|
||||
_with: TokenType
|
||||
_new: TokenType
|
||||
_this: TokenType
|
||||
_super: TokenType
|
||||
_class: TokenType
|
||||
_extends: TokenType
|
||||
_export: TokenType
|
||||
_import: TokenType
|
||||
_null: TokenType
|
||||
_true: TokenType
|
||||
_false: TokenType
|
||||
_in: TokenType
|
||||
_instanceof: TokenType
|
||||
_typeof: TokenType
|
||||
_void: TokenType
|
||||
_delete: TokenType
|
||||
}
|
||||
|
||||
export interface Comment {
|
||||
type: "Line" | "Block"
|
||||
value: string
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
range?: [number, number]
|
||||
}
|
||||
|
||||
export class Token {
|
||||
type: TokenType
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
range?: [number, number]
|
||||
}
|
||||
|
||||
export const version: string
|
857
Lab2/node_modules/.acorn-HkmHiliI/dist/acorn.d.ts
generated
vendored
Normal file
@ -0,0 +1,857 @@
|
||||
export interface Node {
|
||||
start: number
|
||||
end: number
|
||||
type: string
|
||||
range?: [number, number]
|
||||
loc?: SourceLocation | null
|
||||
}
|
||||
|
||||
export interface SourceLocation {
|
||||
source?: string | null
|
||||
start: Position
|
||||
end: Position
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
/** 1-based */
|
||||
line: number
|
||||
/** 0-based */
|
||||
column: number
|
||||
}
|
||||
|
||||
export interface Identifier extends Node {
|
||||
type: "Identifier"
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface Literal extends Node {
|
||||
type: "Literal"
|
||||
value?: string | boolean | null | number | RegExp | bigint
|
||||
raw?: string
|
||||
regex?: {
|
||||
pattern: string
|
||||
flags: string
|
||||
}
|
||||
bigint?: string
|
||||
}
|
||||
|
||||
export interface Program extends Node {
|
||||
type: "Program"
|
||||
body: Array<Statement | ModuleDeclaration>
|
||||
sourceType: "script" | "module"
|
||||
}
|
||||
|
||||
export interface Function extends Node {
|
||||
id?: Identifier | null
|
||||
params: Array<Pattern>
|
||||
body: BlockStatement | Expression
|
||||
generator: boolean
|
||||
expression: boolean
|
||||
async: boolean
|
||||
}
|
||||
|
||||
export interface ExpressionStatement extends Node {
|
||||
type: "ExpressionStatement"
|
||||
expression: Expression | Literal
|
||||
directive?: string
|
||||
}
|
||||
|
||||
export interface BlockStatement extends Node {
|
||||
type: "BlockStatement"
|
||||
body: Array<Statement>
|
||||
}
|
||||
|
||||
export interface EmptyStatement extends Node {
|
||||
type: "EmptyStatement"
|
||||
}
|
||||
|
||||
export interface DebuggerStatement extends Node {
|
||||
type: "DebuggerStatement"
|
||||
}
|
||||
|
||||
export interface WithStatement extends Node {
|
||||
type: "WithStatement"
|
||||
object: Expression
|
||||
body: Statement
|
||||
}
|
||||
|
||||
export interface ReturnStatement extends Node {
|
||||
type: "ReturnStatement"
|
||||
argument?: Expression | null
|
||||
}
|
||||
|
||||
export interface LabeledStatement extends Node {
|
||||
type: "LabeledStatement"
|
||||
label: Identifier
|
||||
body: Statement
|
||||
}
|
||||
|
||||
export interface BreakStatement extends Node {
|
||||
type: "BreakStatement"
|
||||
label?: Identifier | null
|
||||
}
|
||||
|
||||
export interface ContinueStatement extends Node {
|
||||
type: "ContinueStatement"
|
||||
label?: Identifier | null
|
||||
}
|
||||
|
||||
export interface IfStatement extends Node {
|
||||
type: "IfStatement"
|
||||
test: Expression
|
||||
consequent: Statement
|
||||
alternate?: Statement | null
|
||||
}
|
||||
|
||||
export interface SwitchStatement extends Node {
|
||||
type: "SwitchStatement"
|
||||
discriminant: Expression
|
||||
cases: Array<SwitchCase>
|
||||
}
|
||||
|
||||
export interface SwitchCase extends Node {
|
||||
type: "SwitchCase"
|
||||
test?: Expression | null
|
||||
consequent: Array<Statement>
|
||||
}
|
||||
|
||||
export interface ThrowStatement extends Node {
|
||||
type: "ThrowStatement"
|
||||
argument: Expression
|
||||
}
|
||||
|
||||
export interface TryStatement extends Node {
|
||||
type: "TryStatement"
|
||||
block: BlockStatement
|
||||
handler?: CatchClause | null
|
||||
finalizer?: BlockStatement | null
|
||||
}
|
||||
|
||||
export interface CatchClause extends Node {
|
||||
type: "CatchClause"
|
||||
param?: Pattern | null
|
||||
body: BlockStatement
|
||||
}
|
||||
|
||||
export interface WhileStatement extends Node {
|
||||
type: "WhileStatement"
|
||||
test: Expression
|
||||
body: Statement
|
||||
}
|
||||
|
||||
export interface DoWhileStatement extends Node {
|
||||
type: "DoWhileStatement"
|
||||
body: Statement
|
||||
test: Expression
|
||||
}
|
||||
|
||||
export interface ForStatement extends Node {
|
||||
type: "ForStatement"
|
||||
init?: VariableDeclaration | Expression | null
|
||||
test?: Expression | null
|
||||
update?: Expression | null
|
||||
body: Statement
|
||||
}
|
||||
|
||||
export interface ForInStatement extends Node {
|
||||
type: "ForInStatement"
|
||||
left: VariableDeclaration | Pattern
|
||||
right: Expression
|
||||
body: Statement
|
||||
}
|
||||
|
||||
export interface FunctionDeclaration extends Function {
|
||||
type: "FunctionDeclaration"
|
||||
id: Identifier
|
||||
body: BlockStatement
|
||||
}
|
||||
|
||||
export interface VariableDeclaration extends Node {
|
||||
type: "VariableDeclaration"
|
||||
declarations: Array<VariableDeclarator>
|
||||
kind: "var" | "let" | "const"
|
||||
}
|
||||
|
||||
export interface VariableDeclarator extends Node {
|
||||
type: "VariableDeclarator"
|
||||
id: Pattern
|
||||
init?: Expression | null
|
||||
}
|
||||
|
||||
export interface ThisExpression extends Node {
|
||||
type: "ThisExpression"
|
||||
}
|
||||
|
||||
export interface ArrayExpression extends Node {
|
||||
type: "ArrayExpression"
|
||||
elements: Array<Expression | SpreadElement | null>
|
||||
}
|
||||
|
||||
export interface ObjectExpression extends Node {
|
||||
type: "ObjectExpression"
|
||||
properties: Array<Property | SpreadElement>
|
||||
}
|
||||
|
||||
export interface Property extends Node {
|
||||
type: "Property"
|
||||
key: Expression
|
||||
value: Expression
|
||||
kind: "init" | "get" | "set"
|
||||
method: boolean
|
||||
shorthand: boolean
|
||||
computed: boolean
|
||||
}
|
||||
|
||||
export interface FunctionExpression extends Function {
|
||||
type: "FunctionExpression"
|
||||
body: BlockStatement
|
||||
}
|
||||
|
||||
export interface UnaryExpression extends Node {
|
||||
type: "UnaryExpression"
|
||||
operator: UnaryOperator
|
||||
prefix: boolean
|
||||
argument: Expression
|
||||
}
|
||||
|
||||
export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"
|
||||
|
||||
export interface UpdateExpression extends Node {
|
||||
type: "UpdateExpression"
|
||||
operator: UpdateOperator
|
||||
argument: Expression
|
||||
prefix: boolean
|
||||
}
|
||||
|
||||
export type UpdateOperator = "++" | "--"
|
||||
|
||||
export interface BinaryExpression extends Node {
|
||||
type: "BinaryExpression"
|
||||
operator: BinaryOperator
|
||||
left: Expression | PrivateIdentifier
|
||||
right: Expression
|
||||
}
|
||||
|
||||
export type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "in" | "instanceof" | "**"
|
||||
|
||||
export interface AssignmentExpression extends Node {
|
||||
type: "AssignmentExpression"
|
||||
operator: AssignmentOperator
|
||||
left: Pattern
|
||||
right: Expression
|
||||
}
|
||||
|
||||
export type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "**=" | "||=" | "&&=" | "??="
|
||||
|
||||
export interface LogicalExpression extends Node {
|
||||
type: "LogicalExpression"
|
||||
operator: LogicalOperator
|
||||
left: Expression
|
||||
right: Expression
|
||||
}
|
||||
|
||||
export type LogicalOperator = "||" | "&&" | "??"
|
||||
|
||||
export interface MemberExpression extends Node {
|
||||
type: "MemberExpression"
|
||||
object: Expression | Super
|
||||
property: Expression | PrivateIdentifier
|
||||
computed: boolean
|
||||
optional: boolean
|
||||
}
|
||||
|
||||
export interface ConditionalExpression extends Node {
|
||||
type: "ConditionalExpression"
|
||||
test: Expression
|
||||
alternate: Expression
|
||||
consequent: Expression
|
||||
}
|
||||
|
||||
export interface CallExpression extends Node {
|
||||
type: "CallExpression"
|
||||
callee: Expression | Super
|
||||
arguments: Array<Expression | SpreadElement>
|
||||
optional: boolean
|
||||
}
|
||||
|
||||
export interface NewExpression extends Node {
|
||||
type: "NewExpression"
|
||||
callee: Expression
|
||||
arguments: Array<Expression | SpreadElement>
|
||||
}
|
||||
|
||||
export interface SequenceExpression extends Node {
|
||||
type: "SequenceExpression"
|
||||
expressions: Array<Expression>
|
||||
}
|
||||
|
||||
export interface ForOfStatement extends Node {
|
||||
type: "ForOfStatement"
|
||||
left: VariableDeclaration | Pattern
|
||||
right: Expression
|
||||
body: Statement
|
||||
await: boolean
|
||||
}
|
||||
|
||||
export interface Super extends Node {
|
||||
type: "Super"
|
||||
}
|
||||
|
||||
export interface SpreadElement extends Node {
|
||||
type: "SpreadElement"
|
||||
argument: Expression
|
||||
}
|
||||
|
||||
export interface ArrowFunctionExpression extends Function {
|
||||
type: "ArrowFunctionExpression"
|
||||
}
|
||||
|
||||
export interface YieldExpression extends Node {
|
||||
type: "YieldExpression"
|
||||
argument?: Expression | null
|
||||
delegate: boolean
|
||||
}
|
||||
|
||||
export interface TemplateLiteral extends Node {
|
||||
type: "TemplateLiteral"
|
||||
quasis: Array<TemplateElement>
|
||||
expressions: Array<Expression>
|
||||
}
|
||||
|
||||
export interface TaggedTemplateExpression extends Node {
|
||||
type: "TaggedTemplateExpression"
|
||||
tag: Expression
|
||||
quasi: TemplateLiteral
|
||||
}
|
||||
|
||||
export interface TemplateElement extends Node {
|
||||
type: "TemplateElement"
|
||||
tail: boolean
|
||||
value: {
|
||||
cooked?: string | null
|
||||
raw: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface AssignmentProperty extends Node {
|
||||
type: "Property"
|
||||
key: Expression
|
||||
value: Pattern
|
||||
kind: "init"
|
||||
method: false
|
||||
shorthand: boolean
|
||||
computed: boolean
|
||||
}
|
||||
|
||||
export interface ObjectPattern extends Node {
|
||||
type: "ObjectPattern"
|
||||
properties: Array<AssignmentProperty | RestElement>
|
||||
}
|
||||
|
||||
export interface ArrayPattern extends Node {
|
||||
type: "ArrayPattern"
|
||||
elements: Array<Pattern | null>
|
||||
}
|
||||
|
||||
export interface RestElement extends Node {
|
||||
type: "RestElement"
|
||||
argument: Pattern
|
||||
}
|
||||
|
||||
export interface AssignmentPattern extends Node {
|
||||
type: "AssignmentPattern"
|
||||
left: Pattern
|
||||
right: Expression
|
||||
}
|
||||
|
||||
export interface Class extends Node {
|
||||
id?: Identifier | null
|
||||
superClass?: Expression | null
|
||||
body: ClassBody
|
||||
}
|
||||
|
||||
export interface ClassBody extends Node {
|
||||
type: "ClassBody"
|
||||
body: Array<MethodDefinition | PropertyDefinition | StaticBlock>
|
||||
}
|
||||
|
||||
export interface MethodDefinition extends Node {
|
||||
type: "MethodDefinition"
|
||||
key: Expression | PrivateIdentifier
|
||||
value: FunctionExpression
|
||||
kind: "constructor" | "method" | "get" | "set"
|
||||
computed: boolean
|
||||
static: boolean
|
||||
}
|
||||
|
||||
export interface ClassDeclaration extends Class {
|
||||
type: "ClassDeclaration"
|
||||
id: Identifier
|
||||
}
|
||||
|
||||
export interface ClassExpression extends Class {
|
||||
type: "ClassExpression"
|
||||
}
|
||||
|
||||
export interface MetaProperty extends Node {
|
||||
type: "MetaProperty"
|
||||
meta: Identifier
|
||||
property: Identifier
|
||||
}
|
||||
|
||||
export interface ImportDeclaration extends Node {
|
||||
type: "ImportDeclaration"
|
||||
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>
|
||||
source: Literal
|
||||
}
|
||||
|
||||
export interface ImportSpecifier extends Node {
|
||||
type: "ImportSpecifier"
|
||||
imported: Identifier | Literal
|
||||
local: Identifier
|
||||
}
|
||||
|
||||
export interface ImportDefaultSpecifier extends Node {
|
||||
type: "ImportDefaultSpecifier"
|
||||
local: Identifier
|
||||
}
|
||||
|
||||
export interface ImportNamespaceSpecifier extends Node {
|
||||
type: "ImportNamespaceSpecifier"
|
||||
local: Identifier
|
||||
}
|
||||
|
||||
export interface ExportNamedDeclaration extends Node {
|
||||
type: "ExportNamedDeclaration"
|
||||
declaration?: Declaration | null
|
||||
specifiers: Array<ExportSpecifier>
|
||||
source?: Literal | null
|
||||
}
|
||||
|
||||
export interface ExportSpecifier extends Node {
|
||||
type: "ExportSpecifier"
|
||||
exported: Identifier | Literal
|
||||
local: Identifier | Literal
|
||||
}
|
||||
|
||||
export interface AnonymousFunctionDeclaration extends Function {
|
||||
type: "FunctionDeclaration"
|
||||
id: null
|
||||
body: BlockStatement
|
||||
}
|
||||
|
||||
export interface AnonymousClassDeclaration extends Class {
|
||||
type: "ClassDeclaration"
|
||||
id: null
|
||||
}
|
||||
|
||||
export interface ExportDefaultDeclaration extends Node {
|
||||
type: "ExportDefaultDeclaration"
|
||||
declaration: AnonymousFunctionDeclaration | FunctionDeclaration | AnonymousClassDeclaration | ClassDeclaration | Expression
|
||||
}
|
||||
|
||||
export interface ExportAllDeclaration extends Node {
|
||||
type: "ExportAllDeclaration"
|
||||
source: Literal
|
||||
exported?: Identifier | Literal | null
|
||||
}
|
||||
|
||||
export interface AwaitExpression extends Node {
|
||||
type: "AwaitExpression"
|
||||
argument: Expression
|
||||
}
|
||||
|
||||
export interface ChainExpression extends Node {
|
||||
type: "ChainExpression"
|
||||
expression: MemberExpression | CallExpression
|
||||
}
|
||||
|
||||
export interface ImportExpression extends Node {
|
||||
type: "ImportExpression"
|
||||
source: Expression
|
||||
}
|
||||
|
||||
export interface ParenthesizedExpression extends Node {
|
||||
type: "ParenthesizedExpression"
|
||||
expression: Expression
|
||||
}
|
||||
|
||||
export interface PropertyDefinition extends Node {
|
||||
type: "PropertyDefinition"
|
||||
key: Expression | PrivateIdentifier
|
||||
value?: Expression | null
|
||||
computed: boolean
|
||||
static: boolean
|
||||
}
|
||||
|
||||
export interface PrivateIdentifier extends Node {
|
||||
type: "PrivateIdentifier"
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface StaticBlock extends Node {
|
||||
type: "StaticBlock"
|
||||
body: Array<Statement>
|
||||
}
|
||||
|
||||
export type Statement =
|
||||
| ExpressionStatement
|
||||
| BlockStatement
|
||||
| EmptyStatement
|
||||
| DebuggerStatement
|
||||
| WithStatement
|
||||
| ReturnStatement
|
||||
| LabeledStatement
|
||||
| BreakStatement
|
||||
| ContinueStatement
|
||||
| IfStatement
|
||||
| SwitchStatement
|
||||
| ThrowStatement
|
||||
| TryStatement
|
||||
| WhileStatement
|
||||
| DoWhileStatement
|
||||
| ForStatement
|
||||
| ForInStatement
|
||||
| ForOfStatement
|
||||
| Declaration
|
||||
|
||||
export type Declaration =
|
||||
| FunctionDeclaration
|
||||
| VariableDeclaration
|
||||
| ClassDeclaration
|
||||
|
||||
export type Expression =
|
||||
| Identifier
|
||||
| Literal
|
||||
| ThisExpression
|
||||
| ArrayExpression
|
||||
| ObjectExpression
|
||||
| FunctionExpression
|
||||
| UnaryExpression
|
||||
| UpdateExpression
|
||||
| BinaryExpression
|
||||
| AssignmentExpression
|
||||
| LogicalExpression
|
||||
| MemberExpression
|
||||
| ConditionalExpression
|
||||
| CallExpression
|
||||
| NewExpression
|
||||
| SequenceExpression
|
||||
| ArrowFunctionExpression
|
||||
| YieldExpression
|
||||
| TemplateLiteral
|
||||
| TaggedTemplateExpression
|
||||
| ClassExpression
|
||||
| MetaProperty
|
||||
| AwaitExpression
|
||||
| ChainExpression
|
||||
| ImportExpression
|
||||
| ParenthesizedExpression
|
||||
|
||||
export type Pattern =
|
||||
| Identifier
|
||||
| MemberExpression
|
||||
| ObjectPattern
|
||||
| ArrayPattern
|
||||
| RestElement
|
||||
| AssignmentPattern
|
||||
|
||||
export type ModuleDeclaration =
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportDefaultDeclaration
|
||||
| ExportAllDeclaration
|
||||
|
||||
export type AnyNode = Statement | Expression | Declaration | ModuleDeclaration | Literal | Program | SwitchCase | CatchClause | Property | Super | SpreadElement | TemplateElement | AssignmentProperty | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | ClassBody | MethodDefinition | MetaProperty | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier | AnonymousFunctionDeclaration | AnonymousClassDeclaration | PropertyDefinition | PrivateIdentifier | StaticBlock
|
||||
|
||||
export function parse(input: string, options: Options): Program
|
||||
|
||||
export function parseExpressionAt(input: string, pos: number, options: Options): Expression
|
||||
|
||||
export function tokenizer(input: string, options: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
|
||||
export type ecmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | "latest"
|
||||
|
||||
export interface Options {
|
||||
/**
|
||||
* `ecmaVersion` indicates the ECMAScript version to parse. Must be
|
||||
* either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
|
||||
* (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"`
|
||||
* (the latest version the library supports). This influences
|
||||
* support for strict mode, the set of reserved words, and support
|
||||
* for new syntax features.
|
||||
*/
|
||||
ecmaVersion: ecmaVersion
|
||||
|
||||
/**
|
||||
* `sourceType` indicates the mode the code should be parsed in.
|
||||
* Can be either `"script"` or `"module"`. This influences global
|
||||
* strict mode and parsing of `import` and `export` declarations.
|
||||
*/
|
||||
sourceType?: "script" | "module"
|
||||
|
||||
/**
|
||||
* a callback that will be called when a semicolon is automatically inserted.
|
||||
* @param lastTokEnd the position of the comma as an offset
|
||||
* @param lastTokEndLoc location if {@link locations} is enabled
|
||||
*/
|
||||
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
|
||||
/**
|
||||
* similar to `onInsertedSemicolon`, but for trailing commas
|
||||
* @param lastTokEnd the position of the comma as an offset
|
||||
* @param lastTokEndLoc location if `locations` is enabled
|
||||
*/
|
||||
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||
|
||||
/**
|
||||
* By default, reserved words are only enforced if ecmaVersion >= 5.
|
||||
* Set `allowReserved` to a boolean value to explicitly turn this on
|
||||
* an off. When this option has the value "never", reserved words
|
||||
* and keywords can also not be used as property names.
|
||||
*/
|
||||
allowReserved?: boolean | "never"
|
||||
|
||||
/**
|
||||
* When enabled, a return at the top level is not considered an error.
|
||||
*/
|
||||
allowReturnOutsideFunction?: boolean
|
||||
|
||||
/**
|
||||
* When enabled, import/export statements are not constrained to
|
||||
* appearing at the top of the program, and an import.meta expression
|
||||
* in a script isn't considered an error.
|
||||
*/
|
||||
allowImportExportEverywhere?: boolean
|
||||
|
||||
/**
|
||||
* By default, `await` identifiers are allowed to appear at the top-level scope only if {@link ecmaVersion} >= 2022.
|
||||
* When enabled, await identifiers are allowed to appear at the top-level scope,
|
||||
* but they are still not allowed in non-async functions.
|
||||
*/
|
||||
allowAwaitOutsideFunction?: boolean
|
||||
|
||||
/**
|
||||
* When enabled, super identifiers are not constrained to
|
||||
* appearing in methods and do not raise an error when they appear elsewhere.
|
||||
*/
|
||||
allowSuperOutsideMethod?: boolean
|
||||
|
||||
/**
|
||||
* When enabled, hashbang directive in the beginning of file is
|
||||
* allowed and treated as a line comment. Enabled by default when
|
||||
* {@link ecmaVersion} >= 2023.
|
||||
*/
|
||||
allowHashBang?: boolean
|
||||
|
||||
/**
|
||||
* By default, the parser will verify that private properties are
|
||||
* only used in places where they are valid and have been declared.
|
||||
* Set this to false to turn such checks off.
|
||||
*/
|
||||
checkPrivateFields?: boolean
|
||||
|
||||
/**
|
||||
* When `locations` is on, `loc` properties holding objects with
|
||||
* `start` and `end` properties as {@link Position} objects will be attached to the
|
||||
* nodes.
|
||||
*/
|
||||
locations?: boolean
|
||||
|
||||
/**
|
||||
* a callback that will cause Acorn to call that export function with object in the same
|
||||
* format as tokens returned from `tokenizer().getToken()`. Note
|
||||
* that you are not allowed to call the parser from the
|
||||
* callback—that will corrupt its internal state.
|
||||
*/
|
||||
onToken?: ((token: Token) => void) | Token[]
|
||||
|
||||
|
||||
/**
|
||||
* This takes a export function or an array.
|
||||
*
|
||||
* When a export function is passed, Acorn will call that export function with `(block, text, start,
|
||||
* end)` parameters whenever a comment is skipped. `block` is a
|
||||
* boolean indicating whether this is a block (`/* *\/`) comment,
|
||||
* `text` is the content of the comment, and `start` and `end` are
|
||||
* character offsets that denote the start and end of the comment.
|
||||
* When the {@link locations} option is on, two more parameters are
|
||||
* passed, the full locations of {@link Position} export type of the start and
|
||||
* end of the comments.
|
||||
*
|
||||
* When a array is passed, each found comment of {@link Comment} export type is pushed to the array.
|
||||
*
|
||||
* Note that you are not allowed to call the
|
||||
* parser from the callback—that will corrupt its internal state.
|
||||
*/
|
||||
onComment?: ((
|
||||
isBlock: boolean, text: string, start: number, end: number, startLoc?: Position,
|
||||
endLoc?: Position
|
||||
) => void) | Comment[]
|
||||
|
||||
/**
|
||||
* Nodes have their start and end characters offsets recorded in
|
||||
* `start` and `end` properties (directly on the node, rather than
|
||||
* the `loc` object, which holds line/column data. To also add a
|
||||
* [semi-standardized][range] `range` property holding a `[start,
|
||||
* end]` array with the same numbers, set the `ranges` option to
|
||||
* `true`.
|
||||
*/
|
||||
ranges?: boolean
|
||||
|
||||
/**
|
||||
* It is possible to parse multiple files into a single AST by
|
||||
* passing the tree produced by parsing the first file as
|
||||
* `program` option in subsequent parses. This will add the
|
||||
* toplevel forms of the parsed file to the `Program` (top) node
|
||||
* of an existing parse tree.
|
||||
*/
|
||||
program?: Node
|
||||
|
||||
/**
|
||||
* When {@link locations} is on, you can pass this to record the source
|
||||
* file in every node's `loc` object.
|
||||
*/
|
||||
sourceFile?: string
|
||||
|
||||
/**
|
||||
* This value, if given, is stored in every node, whether {@link locations} is on or off.
|
||||
*/
|
||||
directSourceFile?: string
|
||||
|
||||
/**
|
||||
* When enabled, parenthesized expressions are represented by
|
||||
* (non-standard) ParenthesizedExpression nodes
|
||||
*/
|
||||
preserveParens?: boolean
|
||||
}
|
||||
|
||||
export class Parser {
|
||||
options: Options
|
||||
input: string
|
||||
|
||||
private constructor(options: Options, input: string, startPos?: number)
|
||||
parse(): Program
|
||||
|
||||
static parse(input: string, options: Options): Program
|
||||
static parseExpressionAt(input: string, pos: number, options: Options): Expression
|
||||
static tokenizer(input: string, options: Options): {
|
||||
getToken(): Token
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
static extend(...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser
|
||||
}
|
||||
|
||||
export const defaultOptions: Options
|
||||
|
||||
export function getLineInfo(input: string, offset: number): Position
|
||||
|
||||
export class TokenType {
|
||||
label: string
|
||||
keyword: string | undefined
|
||||
}
|
||||
|
||||
export const tokTypes: {
|
||||
num: TokenType
|
||||
regexp: TokenType
|
||||
string: TokenType
|
||||
name: TokenType
|
||||
privateId: TokenType
|
||||
eof: TokenType
|
||||
|
||||
bracketL: TokenType
|
||||
bracketR: TokenType
|
||||
braceL: TokenType
|
||||
braceR: TokenType
|
||||
parenL: TokenType
|
||||
parenR: TokenType
|
||||
comma: TokenType
|
||||
semi: TokenType
|
||||
colon: TokenType
|
||||
dot: TokenType
|
||||
question: TokenType
|
||||
questionDot: TokenType
|
||||
arrow: TokenType
|
||||
template: TokenType
|
||||
invalidTemplate: TokenType
|
||||
ellipsis: TokenType
|
||||
backQuote: TokenType
|
||||
dollarBraceL: TokenType
|
||||
|
||||
eq: TokenType
|
||||
assign: TokenType
|
||||
incDec: TokenType
|
||||
prefix: TokenType
|
||||
logicalOR: TokenType
|
||||
logicalAND: TokenType
|
||||
bitwiseOR: TokenType
|
||||
bitwiseXOR: TokenType
|
||||
bitwiseAND: TokenType
|
||||
equality: TokenType
|
||||
relational: TokenType
|
||||
bitShift: TokenType
|
||||
plusMin: TokenType
|
||||
modulo: TokenType
|
||||
star: TokenType
|
||||
slash: TokenType
|
||||
starstar: TokenType
|
||||
coalesce: TokenType
|
||||
|
||||
_break: TokenType
|
||||
_case: TokenType
|
||||
_catch: TokenType
|
||||
_continue: TokenType
|
||||
_debugger: TokenType
|
||||
_default: TokenType
|
||||
_do: TokenType
|
||||
_else: TokenType
|
||||
_finally: TokenType
|
||||
_for: TokenType
|
||||
_function: TokenType
|
||||
_if: TokenType
|
||||
_return: TokenType
|
||||
_switch: TokenType
|
||||
_throw: TokenType
|
||||
_try: TokenType
|
||||
_var: TokenType
|
||||
_const: TokenType
|
||||
_while: TokenType
|
||||
_with: TokenType
|
||||
_new: TokenType
|
||||
_this: TokenType
|
||||
_super: TokenType
|
||||
_class: TokenType
|
||||
_extends: TokenType
|
||||
_export: TokenType
|
||||
_import: TokenType
|
||||
_null: TokenType
|
||||
_true: TokenType
|
||||
_false: TokenType
|
||||
_in: TokenType
|
||||
_instanceof: TokenType
|
||||
_typeof: TokenType
|
||||
_void: TokenType
|
||||
_delete: TokenType
|
||||
}
|
||||
|
||||
export interface Comment {
|
||||
type: "Line" | "Block"
|
||||
value: string
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
range?: [number, number]
|
||||
}
|
||||
|
||||
export class Token {
|
||||
type: TokenType
|
||||
start: number
|
||||
end: number
|
||||
loc?: SourceLocation
|
||||
range?: [number, number]
|
||||
}
|
||||
|
||||
export const version: string
|
6001
Lab2/node_modules/.acorn-HkmHiliI/dist/acorn.js
generated
vendored
Normal file
5972
Lab2/node_modules/.acorn-HkmHiliI/dist/acorn.mjs
generated
vendored
Normal file
90
Lab2/node_modules/.acorn-HkmHiliI/dist/bin.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var acorn = require('./acorn.js');
|
||||
|
||||
function _interopNamespaceDefault(e) {
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () { return e[k]; }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n.default = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var acorn__namespace = /*#__PURE__*/_interopNamespaceDefault(acorn);
|
||||
|
||||
var inputFilePaths = [], forceFileName = false, fileMode = false, silent = false, compact = false, tokenize = false;
|
||||
var options = {};
|
||||
|
||||
function help(status) {
|
||||
var print = (status === 0) ? console.log : console.error;
|
||||
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
|
||||
print(" [--tokenize] [--locations] [--allow-hash-bang] [--allow-await-outside-function] [--compact] [--silent] [--module] [--help] [--] [<infile>...]");
|
||||
process.exit(status);
|
||||
}
|
||||
|
||||
for (var i = 2; i < process.argv.length; ++i) {
|
||||
var arg = process.argv[i];
|
||||
if (arg[0] !== "-" || arg === "-") { inputFilePaths.push(arg); }
|
||||
else if (arg === "--") {
|
||||
inputFilePaths.push.apply(inputFilePaths, process.argv.slice(i + 1));
|
||||
forceFileName = true;
|
||||
break
|
||||
} else if (arg === "--locations") { options.locations = true; }
|
||||
else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
|
||||
else if (arg === "--allow-await-outside-function") { options.allowAwaitOutsideFunction = true; }
|
||||
else if (arg === "--silent") { silent = true; }
|
||||
else if (arg === "--compact") { compact = true; }
|
||||
else if (arg === "--help") { help(0); }
|
||||
else if (arg === "--tokenize") { tokenize = true; }
|
||||
else if (arg === "--module") { options.sourceType = "module"; }
|
||||
else {
|
||||
var match = arg.match(/^--ecma(\d+)$/);
|
||||
if (match)
|
||||
{ options.ecmaVersion = +match[1]; }
|
||||
else
|
||||
{ help(1); }
|
||||
}
|
||||
}
|
||||
|
||||
function run(codeList) {
|
||||
var result = [], fileIdx = 0;
|
||||
try {
|
||||
codeList.forEach(function (code, idx) {
|
||||
fileIdx = idx;
|
||||
if (!tokenize) {
|
||||
result = acorn__namespace.parse(code, options);
|
||||
options.program = result;
|
||||
} else {
|
||||
var tokenizer = acorn__namespace.tokenizer(code, options), token;
|
||||
do {
|
||||
token = tokenizer.getToken();
|
||||
result.push(token);
|
||||
} while (token.type !== acorn__namespace.tokTypes.eof)
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(fileMode ? e.message.replace(/\(\d+:\d+\)$/, function (m) { return m.slice(0, 1) + inputFilePaths[fileIdx] + " " + m.slice(1); }) : e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
|
||||
}
|
||||
|
||||
if (fileMode = inputFilePaths.length && (forceFileName || !inputFilePaths.includes("-") || inputFilePaths.length !== 1)) {
|
||||
run(inputFilePaths.map(function (path) { return fs.readFileSync(path, "utf8"); }));
|
||||
} else {
|
||||
var code = "";
|
||||
process.stdin.resume();
|
||||
process.stdin.on("data", function (chunk) { return code += chunk; });
|
||||
process.stdin.on("end", function () { return run([code]); });
|
||||
}
|
50
Lab2/node_modules/.acorn-HkmHiliI/package.json
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "acorn",
|
||||
"description": "ECMAScript parser",
|
||||
"homepage": "https://github.com/acornjs/acorn",
|
||||
"main": "dist/acorn.js",
|
||||
"types": "dist/acorn.d.ts",
|
||||
"module": "dist/acorn.mjs",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"import": "./dist/acorn.mjs",
|
||||
"require": "./dist/acorn.js",
|
||||
"default": "./dist/acorn.js"
|
||||
},
|
||||
"./dist/acorn.js"
|
||||
],
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"version": "8.11.2",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Marijn Haverbeke",
|
||||
"email": "marijnh@gmail.com",
|
||||
"web": "https://marijnhaverbeke.nl"
|
||||
},
|
||||
{
|
||||
"name": "Ingvar Stepanyan",
|
||||
"email": "me@rreverser.com",
|
||||
"web": "https://rreverser.com/"
|
||||
},
|
||||
{
|
||||
"name": "Adrian Heine",
|
||||
"web": "http://adrianheine.de"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/acornjs/acorn.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"prepare": "cd ..; npm run build:main"
|
||||
},
|
||||
"bin": {
|
||||
"acorn": "./bin/acorn"
|
||||
}
|
||||
}
|
19
Lab2/node_modules/.acorn-jsx-ubuxPgbF/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (C) 2012-2017 by Ingvar Stepanyan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
40
Lab2/node_modules/.acorn-jsx-ubuxPgbF/README.md
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
# Acorn-JSX
|
||||
|
||||
[![Build Status](https://travis-ci.org/acornjs/acorn-jsx.svg?branch=master)](https://travis-ci.org/acornjs/acorn-jsx)
|
||||
[![NPM version](https://img.shields.io/npm/v/acorn-jsx.svg)](https://www.npmjs.org/package/acorn-jsx)
|
||||
|
||||
This is plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.
|
||||
|
||||
It was created as an experimental alternative, faster [React.js JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) parser. Later, it replaced the [official parser](https://github.com/facebookarchive/esprima) and these days is used by many prominent development tools.
|
||||
|
||||
## Transpiler
|
||||
|
||||
Please note that this tool only parses source code to JSX AST, which is useful for various language tools and services. If you want to transpile your code to regular ES5-compliant JavaScript with source map, check out [Babel](https://babeljs.io/) and [Buble](https://buble.surge.sh/) transpilers which use `acorn-jsx` under the hood.
|
||||
|
||||
## Usage
|
||||
|
||||
Requiring this module provides you with an Acorn plugin that you can use like this:
|
||||
|
||||
```javascript
|
||||
var acorn = require("acorn");
|
||||
var jsx = require("acorn-jsx");
|
||||
acorn.Parser.extend(jsx()).parse("my(<jsx/>, 'code');");
|
||||
```
|
||||
|
||||
Note that official spec doesn't support mix of XML namespaces and object-style access in tag names (#27) like in `<namespace:Object.Property />`, so it was deprecated in `acorn-jsx@3.0`. If you still want to opt-in to support of such constructions, you can pass the following option:
|
||||
|
||||
```javascript
|
||||
acorn.Parser.extend(jsx({ allowNamespacedObjects: true }))
|
||||
```
|
||||
|
||||
Also, since most apps use pure React transformer, a new option was introduced that allows to prohibit namespaces completely:
|
||||
|
||||
```javascript
|
||||
acorn.Parser.extend(jsx({ allowNamespaces: false }))
|
||||
```
|
||||
|
||||
Note that by default `allowNamespaces` is enabled for spec compliancy.
|
||||
|
||||
## License
|
||||
|
||||
This plugin is issued under the [MIT license](./LICENSE).
|
12
Lab2/node_modules/.acorn-jsx-ubuxPgbF/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { Parser } from 'acorn'
|
||||
|
||||
declare const jsx: (options?: jsx.Options) => (BaseParser: typeof Parser) => typeof Parser;
|
||||
|
||||
declare namespace jsx {
|
||||
interface Options {
|
||||
allowNamespacedObjects?: boolean;
|
||||
allowNamespaces?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = jsx;
|
488
Lab2/node_modules/.acorn-jsx-ubuxPgbF/index.js
generated
vendored
Normal file
@ -0,0 +1,488 @@
|
||||
'use strict';
|
||||
|
||||
const XHTMLEntities = require('./xhtml');
|
||||
|
||||
const hexNumber = /^[\da-fA-F]+$/;
|
||||
const decimalNumber = /^\d+$/;
|
||||
|
||||
// The map to `acorn-jsx` tokens from `acorn` namespace objects.
|
||||
const acornJsxMap = new WeakMap();
|
||||
|
||||
// Get the original tokens for the given `acorn` namespace object.
|
||||
function getJsxTokens(acorn) {
|
||||
acorn = acorn.Parser.acorn || acorn;
|
||||
let acornJsx = acornJsxMap.get(acorn);
|
||||
if (!acornJsx) {
|
||||
const tt = acorn.tokTypes;
|
||||
const TokContext = acorn.TokContext;
|
||||
const TokenType = acorn.TokenType;
|
||||
const tc_oTag = new TokContext('<tag', false);
|
||||
const tc_cTag = new TokContext('</tag', false);
|
||||
const tc_expr = new TokContext('<tag>...</tag>', true, true);
|
||||
const tokContexts = {
|
||||
tc_oTag: tc_oTag,
|
||||
tc_cTag: tc_cTag,
|
||||
tc_expr: tc_expr
|
||||
};
|
||||
const tokTypes = {
|
||||
jsxName: new TokenType('jsxName'),
|
||||
jsxText: new TokenType('jsxText', {beforeExpr: true}),
|
||||
jsxTagStart: new TokenType('jsxTagStart', {startsExpr: true}),
|
||||
jsxTagEnd: new TokenType('jsxTagEnd')
|
||||
};
|
||||
|
||||
tokTypes.jsxTagStart.updateContext = function() {
|
||||
this.context.push(tc_expr); // treat as beginning of JSX expression
|
||||
this.context.push(tc_oTag); // start opening tag context
|
||||
this.exprAllowed = false;
|
||||
};
|
||||
tokTypes.jsxTagEnd.updateContext = function(prevType) {
|
||||
let out = this.context.pop();
|
||||
if (out === tc_oTag && prevType === tt.slash || out === tc_cTag) {
|
||||
this.context.pop();
|
||||
this.exprAllowed = this.curContext() === tc_expr;
|
||||
} else {
|
||||
this.exprAllowed = true;
|
||||
}
|
||||
};
|
||||
|
||||
acornJsx = { tokContexts: tokContexts, tokTypes: tokTypes };
|
||||
acornJsxMap.set(acorn, acornJsx);
|
||||
}
|
||||
|
||||
return acornJsx;
|
||||
}
|
||||
|
||||
// Transforms JSX element name to string.
|
||||
|
||||
function getQualifiedJSXName(object) {
|
||||
if (!object)
|
||||
return object;
|
||||
|
||||
if (object.type === 'JSXIdentifier')
|
||||
return object.name;
|
||||
|
||||
if (object.type === 'JSXNamespacedName')
|
||||
return object.namespace.name + ':' + object.name.name;
|
||||
|
||||
if (object.type === 'JSXMemberExpression')
|
||||
return getQualifiedJSXName(object.object) + '.' +
|
||||
getQualifiedJSXName(object.property);
|
||||
}
|
||||
|
||||
module.exports = function(options) {
|
||||
options = options || {};
|
||||
return function(Parser) {
|
||||
return plugin({
|
||||
allowNamespaces: options.allowNamespaces !== false,
|
||||
allowNamespacedObjects: !!options.allowNamespacedObjects
|
||||
}, Parser);
|
||||
};
|
||||
};
|
||||
|
||||
// This is `tokTypes` of the peer dep.
|
||||
// This can be different instances from the actual `tokTypes` this plugin uses.
|
||||
Object.defineProperty(module.exports, "tokTypes", {
|
||||
get: function get_tokTypes() {
|
||||
return getJsxTokens(require("acorn")).tokTypes;
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
function plugin(options, Parser) {
|
||||
const acorn = Parser.acorn || require("acorn");
|
||||
const acornJsx = getJsxTokens(acorn);
|
||||
const tt = acorn.tokTypes;
|
||||
const tok = acornJsx.tokTypes;
|
||||
const tokContexts = acorn.tokContexts;
|
||||
const tc_oTag = acornJsx.tokContexts.tc_oTag;
|
||||
const tc_cTag = acornJsx.tokContexts.tc_cTag;
|
||||
const tc_expr = acornJsx.tokContexts.tc_expr;
|
||||
const isNewLine = acorn.isNewLine;
|
||||
const isIdentifierStart = acorn.isIdentifierStart;
|
||||
const isIdentifierChar = acorn.isIdentifierChar;
|
||||
|
||||
return class extends Parser {
|
||||
// Expose actual `tokTypes` and `tokContexts` to other plugins.
|
||||
static get acornJsx() {
|
||||
return acornJsx;
|
||||
}
|
||||
|
||||
// Reads inline JSX contents token.
|
||||
jsx_readToken() {
|
||||
let out = '', chunkStart = this.pos;
|
||||
for (;;) {
|
||||
if (this.pos >= this.input.length)
|
||||
this.raise(this.start, 'Unterminated JSX contents');
|
||||
let ch = this.input.charCodeAt(this.pos);
|
||||
|
||||
switch (ch) {
|
||||
case 60: // '<'
|
||||
case 123: // '{'
|
||||
if (this.pos === this.start) {
|
||||
if (ch === 60 && this.exprAllowed) {
|
||||
++this.pos;
|
||||
return this.finishToken(tok.jsxTagStart);
|
||||
}
|
||||
return this.getTokenFromCode(ch);
|
||||
}
|
||||
out += this.input.slice(chunkStart, this.pos);
|
||||
return this.finishToken(tok.jsxText, out);
|
||||
|
||||
case 38: // '&'
|
||||
out += this.input.slice(chunkStart, this.pos);
|
||||
out += this.jsx_readEntity();
|
||||
chunkStart = this.pos;
|
||||
break;
|
||||
|
||||
case 62: // '>'
|
||||
case 125: // '}'
|
||||
this.raise(
|
||||
this.pos,
|
||||
"Unexpected token `" + this.input[this.pos] + "`. Did you mean `" +
|
||||
(ch === 62 ? ">" : "}") + "` or " + "`{\"" + this.input[this.pos] + "\"}" + "`?"
|
||||
);
|
||||
|
||||
default:
|
||||
if (isNewLine(ch)) {
|
||||
out += this.input.slice(chunkStart, this.pos);
|
||||
out += this.jsx_readNewLine(true);
|
||||
chunkStart = this.pos;
|
||||
} else {
|
||||
++this.pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jsx_readNewLine(normalizeCRLF) {
|
||||
let ch = this.input.charCodeAt(this.pos);
|
||||
let out;
|
||||
++this.pos;
|
||||
if (ch === 13 && this.input.charCodeAt(this.pos) === 10) {
|
||||
++this.pos;
|
||||
out = normalizeCRLF ? '\n' : '\r\n';
|
||||
} else {
|
||||
out = String.fromCharCode(ch);
|
||||
}
|
||||
if (this.options.locations) {
|
||||
++this.curLine;
|
||||
this.lineStart = this.pos;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
jsx_readString(quote) {
|
||||
let out = '', chunkStart = ++this.pos;
|
||||
for (;;) {
|
||||
if (this.pos >= this.input.length)
|
||||
this.raise(this.start, 'Unterminated string constant');
|
||||
let ch = this.input.charCodeAt(this.pos);
|
||||
if (ch === quote) break;
|
||||
if (ch === 38) { // '&'
|
||||
out += this.input.slice(chunkStart, this.pos);
|
||||
out += this.jsx_readEntity();
|
||||
chunkStart = this.pos;
|
||||
} else if (isNewLine(ch)) {
|
||||
out += this.input.slice(chunkStart, this.pos);
|
||||
out += this.jsx_readNewLine(false);
|
||||
chunkStart = this.pos;
|
||||
} else {
|
||||
++this.pos;
|
||||
}
|
||||
}
|
||||
out += this.input.slice(chunkStart, this.pos++);
|
||||
return this.finishToken(tt.string, out);
|
||||
}
|
||||
|
||||
jsx_readEntity() {
|
||||
let str = '', count = 0, entity;
|
||||
let ch = this.input[this.pos];
|
||||
if (ch !== '&')
|
||||
this.raise(this.pos, 'Entity must start with an ampersand');
|
||||
let startPos = ++this.pos;
|
||||
while (this.pos < this.input.length && count++ < 10) {
|
||||
ch = this.input[this.pos++];
|
||||
if (ch === ';') {
|
||||
if (str[0] === '#') {
|
||||
if (str[1] === 'x') {
|
||||
str = str.substr(2);
|
||||
if (hexNumber.test(str))
|
||||
entity = String.fromCharCode(parseInt(str, 16));
|
||||
} else {
|
||||
str = str.substr(1);
|
||||
if (decimalNumber.test(str))
|
||||
entity = String.fromCharCode(parseInt(str, 10));
|
||||
}
|
||||
} else {
|
||||
entity = XHTMLEntities[str];
|
||||
}
|
||||
break;
|
||||
}
|
||||
str += ch;
|
||||
}
|
||||
if (!entity) {
|
||||
this.pos = startPos;
|
||||
return '&';
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
// Read a JSX identifier (valid tag or attribute name).
|
||||
//
|
||||
// Optimized version since JSX identifiers can't contain
|
||||
// escape characters and so can be read as single slice.
|
||||
// Also assumes that first character was already checked
|
||||
// by isIdentifierStart in readToken.
|
||||
|
||||
jsx_readWord() {
|
||||
let ch, start = this.pos;
|
||||
do {
|
||||
ch = this.input.charCodeAt(++this.pos);
|
||||
} while (isIdentifierChar(ch) || ch === 45); // '-'
|
||||
return this.finishToken(tok.jsxName, this.input.slice(start, this.pos));
|
||||
}
|
||||
|
||||
// Parse next token as JSX identifier
|
||||
|
||||
jsx_parseIdentifier() {
|
||||
let node = this.startNode();
|
||||
if (this.type === tok.jsxName)
|
||||
node.name = this.value;
|
||||
else if (this.type.keyword)
|
||||
node.name = this.type.keyword;
|
||||
else
|
||||
this.unexpected();
|
||||
this.next();
|
||||
return this.finishNode(node, 'JSXIdentifier');
|
||||
}
|
||||
|
||||
// Parse namespaced identifier.
|
||||
|
||||
jsx_parseNamespacedName() {
|
||||
let startPos = this.start, startLoc = this.startLoc;
|
||||
let name = this.jsx_parseIdentifier();
|
||||
if (!options.allowNamespaces || !this.eat(tt.colon)) return name;
|
||||
var node = this.startNodeAt(startPos, startLoc);
|
||||
node.namespace = name;
|
||||
node.name = this.jsx_parseIdentifier();
|
||||
return this.finishNode(node, 'JSXNamespacedName');
|
||||
}
|
||||
|
||||
// Parses element name in any form - namespaced, member
|
||||
// or single identifier.
|
||||
|
||||
jsx_parseElementName() {
|
||||
if (this.type === tok.jsxTagEnd) return '';
|
||||
let startPos = this.start, startLoc = this.startLoc;
|
||||
let node = this.jsx_parseNamespacedName();
|
||||
if (this.type === tt.dot && node.type === 'JSXNamespacedName' && !options.allowNamespacedObjects) {
|
||||
this.unexpected();
|
||||
}
|
||||
while (this.eat(tt.dot)) {
|
||||
let newNode = this.startNodeAt(startPos, startLoc);
|
||||
newNode.object = node;
|
||||
newNode.property = this.jsx_parseIdentifier();
|
||||
node = this.finishNode(newNode, 'JSXMemberExpression');
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
// Parses any type of JSX attribute value.
|
||||
|
||||
jsx_parseAttributeValue() {
|
||||
switch (this.type) {
|
||||
case tt.braceL:
|
||||
let node = this.jsx_parseExpressionContainer();
|
||||
if (node.expression.type === 'JSXEmptyExpression')
|
||||
this.raise(node.start, 'JSX attributes must only be assigned a non-empty expression');
|
||||
return node;
|
||||
|
||||
case tok.jsxTagStart:
|
||||
case tt.string:
|
||||
return this.parseExprAtom();
|
||||
|
||||
default:
|
||||
this.raise(this.start, 'JSX value should be either an expression or a quoted JSX text');
|
||||
}
|
||||
}
|
||||
|
||||
// JSXEmptyExpression is unique type since it doesn't actually parse anything,
|
||||
// and so it should start at the end of last read token (left brace) and finish
|
||||
// at the beginning of the next one (right brace).
|
||||
|
||||
jsx_parseEmptyExpression() {
|
||||
let node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);
|
||||
return this.finishNodeAt(node, 'JSXEmptyExpression', this.start, this.startLoc);
|
||||
}
|
||||
|
||||
// Parses JSX expression enclosed into curly brackets.
|
||||
|
||||
jsx_parseExpressionContainer() {
|
||||
let node = this.startNode();
|
||||
this.next();
|
||||
node.expression = this.type === tt.braceR
|
||||
? this.jsx_parseEmptyExpression()
|
||||
: this.parseExpression();
|
||||
this.expect(tt.braceR);
|
||||
return this.finishNode(node, 'JSXExpressionContainer');
|
||||
}
|
||||
|
||||
// Parses following JSX attribute name-value pair.
|
||||
|
||||
jsx_parseAttribute() {
|
||||
let node = this.startNode();
|
||||
if (this.eat(tt.braceL)) {
|
||||
this.expect(tt.ellipsis);
|
||||
node.argument = this.parseMaybeAssign();
|
||||
this.expect(tt.braceR);
|
||||
return this.finishNode(node, 'JSXSpreadAttribute');
|
||||
}
|
||||
node.name = this.jsx_parseNamespacedName();
|
||||
node.value = this.eat(tt.eq) ? this.jsx_parseAttributeValue() : null;
|
||||
return this.finishNode(node, 'JSXAttribute');
|
||||
}
|
||||
|
||||
// Parses JSX opening tag starting after '<'.
|
||||
|
||||
jsx_parseOpeningElementAt(startPos, startLoc) {
|
||||
let node = this.startNodeAt(startPos, startLoc);
|
||||
node.attributes = [];
|
||||
let nodeName = this.jsx_parseElementName();
|
||||
if (nodeName) node.name = nodeName;
|
||||
while (this.type !== tt.slash && this.type !== tok.jsxTagEnd)
|
||||
node.attributes.push(this.jsx_parseAttribute());
|
||||
node.selfClosing = this.eat(tt.slash);
|
||||
this.expect(tok.jsxTagEnd);
|
||||
return this.finishNode(node, nodeName ? 'JSXOpeningElement' : 'JSXOpeningFragment');
|
||||
}
|
||||
|
||||
// Parses JSX closing tag starting after '</'.
|
||||
|
||||
jsx_parseClosingElementAt(startPos, startLoc) {
|
||||
let node = this.startNodeAt(startPos, startLoc);
|
||||
let nodeName = this.jsx_parseElementName();
|
||||
if (nodeName) node.name = nodeName;
|
||||
this.expect(tok.jsxTagEnd);
|
||||
return this.finishNode(node, nodeName ? 'JSXClosingElement' : 'JSXClosingFragment');
|
||||
}
|
||||
|
||||
// Parses entire JSX element, including it's opening tag
|
||||
// (starting after '<'), attributes, contents and closing tag.
|
||||
|
||||
jsx_parseElementAt(startPos, startLoc) {
|
||||
let node = this.startNodeAt(startPos, startLoc);
|
||||
let children = [];
|
||||
let openingElement = this.jsx_parseOpeningElementAt(startPos, startLoc);
|
||||
let closingElement = null;
|
||||
|
||||
if (!openingElement.selfClosing) {
|
||||
contents: for (;;) {
|
||||
switch (this.type) {
|
||||
case tok.jsxTagStart:
|
||||
startPos = this.start; startLoc = this.startLoc;
|
||||
this.next();
|
||||
if (this.eat(tt.slash)) {
|
||||
closingElement = this.jsx_parseClosingElementAt(startPos, startLoc);
|
||||
break contents;
|
||||
}
|
||||
children.push(this.jsx_parseElementAt(startPos, startLoc));
|
||||
break;
|
||||
|
||||
case tok.jsxText:
|
||||
children.push(this.parseExprAtom());
|
||||
break;
|
||||
|
||||
case tt.braceL:
|
||||
children.push(this.jsx_parseExpressionContainer());
|
||||
break;
|
||||
|
||||
default:
|
||||
this.unexpected();
|
||||
}
|
||||
}
|
||||
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
|
||||
this.raise(
|
||||
closingElement.start,
|
||||
'Expected corresponding JSX closing tag for <' + getQualifiedJSXName(openingElement.name) + '>');
|
||||
}
|
||||
}
|
||||
let fragmentOrElement = openingElement.name ? 'Element' : 'Fragment';
|
||||
|
||||
node['opening' + fragmentOrElement] = openingElement;
|
||||
node['closing' + fragmentOrElement] = closingElement;
|
||||
node.children = children;
|
||||
if (this.type === tt.relational && this.value === "<") {
|
||||
this.raise(this.start, "Adjacent JSX elements must be wrapped in an enclosing tag");
|
||||
}
|
||||
return this.finishNode(node, 'JSX' + fragmentOrElement);
|
||||
}
|
||||
|
||||
// Parse JSX text
|
||||
|
||||
jsx_parseText() {
|
||||
let node = this.parseLiteral(this.value);
|
||||
node.type = "JSXText";
|
||||
return node;
|
||||
}
|
||||
|
||||
// Parses entire JSX element from current position.
|
||||
|
||||
jsx_parseElement() {
|
||||
let startPos = this.start, startLoc = this.startLoc;
|
||||
this.next();
|
||||
return this.jsx_parseElementAt(startPos, startLoc);
|
||||
}
|
||||
|
||||
parseExprAtom(refShortHandDefaultPos) {
|
||||
if (this.type === tok.jsxText)
|
||||
return this.jsx_parseText();
|
||||
else if (this.type === tok.jsxTagStart)
|
||||
return this.jsx_parseElement();
|
||||
else
|
||||
return super.parseExprAtom(refShortHandDefaultPos);
|
||||
}
|
||||
|
||||
readToken(code) {
|
||||
let context = this.curContext();
|
||||
|
||||
if (context === tc_expr) return this.jsx_readToken();
|
||||
|
||||
if (context === tc_oTag || context === tc_cTag) {
|
||||
if (isIdentifierStart(code)) return this.jsx_readWord();
|
||||
|
||||
if (code == 62) {
|
||||
++this.pos;
|
||||
return this.finishToken(tok.jsxTagEnd);
|
||||
}
|
||||
|
||||
if ((code === 34 || code === 39) && context == tc_oTag)
|
||||
return this.jsx_readString(code);
|
||||
}
|
||||
|
||||
if (code === 60 && this.exprAllowed && this.input.charCodeAt(this.pos + 1) !== 33) {
|
||||
++this.pos;
|
||||
return this.finishToken(tok.jsxTagStart);
|
||||
}
|
||||
return super.readToken(code);
|
||||
}
|
||||
|
||||
updateContext(prevType) {
|
||||
if (this.type == tt.braceL) {
|
||||
var curContext = this.curContext();
|
||||
if (curContext == tc_oTag) this.context.push(tokContexts.b_expr);
|
||||
else if (curContext == tc_expr) this.context.push(tokContexts.b_tmpl);
|
||||
else super.updateContext(prevType);
|
||||
this.exprAllowed = true;
|
||||
} else if (this.type === tt.slash && prevType === tok.jsxTagStart) {
|
||||
this.context.length -= 2; // do not consider JSX expr -> JSX open tag -> ... anymore
|
||||
this.context.push(tc_cTag); // reconsider as closing tag context
|
||||
this.exprAllowed = false;
|
||||
} else {
|
||||
return super.updateContext(prevType);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
27
Lab2/node_modules/.acorn-jsx-ubuxPgbF/package.json
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "acorn-jsx",
|
||||
"description": "Modern, fast React.js JSX parser",
|
||||
"homepage": "https://github.com/acornjs/acorn-jsx",
|
||||
"version": "5.3.2",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Ingvar Stepanyan",
|
||||
"email": "me@rreverser.com",
|
||||
"web": "http://rreverser.com/"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/acornjs/acorn-jsx"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "node test/run.js"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"acorn": "^8.0.1"
|
||||
}
|
||||
}
|
255
Lab2/node_modules/.acorn-jsx-ubuxPgbF/xhtml.js
generated
vendored
Normal file
@ -0,0 +1,255 @@
|
||||
module.exports = {
|
||||
quot: '\u0022',
|
||||
amp: '&',
|
||||
apos: '\u0027',
|
||||
lt: '<',
|
||||
gt: '>',
|
||||
nbsp: '\u00A0',
|
||||
iexcl: '\u00A1',
|
||||
cent: '\u00A2',
|
||||
pound: '\u00A3',
|
||||
curren: '\u00A4',
|
||||
yen: '\u00A5',
|
||||
brvbar: '\u00A6',
|
||||
sect: '\u00A7',
|
||||
uml: '\u00A8',
|
||||
copy: '\u00A9',
|
||||
ordf: '\u00AA',
|
||||
laquo: '\u00AB',
|
||||
not: '\u00AC',
|
||||
shy: '\u00AD',
|
||||
reg: '\u00AE',
|
||||
macr: '\u00AF',
|
||||
deg: '\u00B0',
|
||||
plusmn: '\u00B1',
|
||||
sup2: '\u00B2',
|
||||
sup3: '\u00B3',
|
||||
acute: '\u00B4',
|
||||
micro: '\u00B5',
|
||||
para: '\u00B6',
|
||||
middot: '\u00B7',
|
||||
cedil: '\u00B8',
|
||||
sup1: '\u00B9',
|
||||
ordm: '\u00BA',
|
||||
raquo: '\u00BB',
|
||||
frac14: '\u00BC',
|
||||
frac12: '\u00BD',
|
||||
frac34: '\u00BE',
|
||||
iquest: '\u00BF',
|
||||
Agrave: '\u00C0',
|
||||
Aacute: '\u00C1',
|
||||
Acirc: '\u00C2',
|
||||
Atilde: '\u00C3',
|
||||
Auml: '\u00C4',
|
||||
Aring: '\u00C5',
|
||||
AElig: '\u00C6',
|
||||
Ccedil: '\u00C7',
|
||||
Egrave: '\u00C8',
|
||||
Eacute: '\u00C9',
|
||||
Ecirc: '\u00CA',
|
||||
Euml: '\u00CB',
|
||||
Igrave: '\u00CC',
|
||||
Iacute: '\u00CD',
|
||||
Icirc: '\u00CE',
|
||||
Iuml: '\u00CF',
|
||||
ETH: '\u00D0',
|
||||
Ntilde: '\u00D1',
|
||||
Ograve: '\u00D2',
|
||||
Oacute: '\u00D3',
|
||||
Ocirc: '\u00D4',
|
||||
Otilde: '\u00D5',
|
||||
Ouml: '\u00D6',
|
||||
times: '\u00D7',
|
||||
Oslash: '\u00D8',
|
||||
Ugrave: '\u00D9',
|
||||
Uacute: '\u00DA',
|
||||
Ucirc: '\u00DB',
|
||||
Uuml: '\u00DC',
|
||||
Yacute: '\u00DD',
|
||||
THORN: '\u00DE',
|
||||
szlig: '\u00DF',
|
||||
agrave: '\u00E0',
|
||||
aacute: '\u00E1',
|
||||
acirc: '\u00E2',
|
||||
atilde: '\u00E3',
|
||||
auml: '\u00E4',
|
||||
aring: '\u00E5',
|
||||
aelig: '\u00E6',
|
||||
ccedil: '\u00E7',
|
||||
egrave: '\u00E8',
|
||||
eacute: '\u00E9',
|
||||
ecirc: '\u00EA',
|
||||
euml: '\u00EB',
|
||||
igrave: '\u00EC',
|
||||
iacute: '\u00ED',
|
||||
icirc: '\u00EE',
|
||||
iuml: '\u00EF',
|
||||
eth: '\u00F0',
|
||||
ntilde: '\u00F1',
|
||||
ograve: '\u00F2',
|
||||
oacute: '\u00F3',
|
||||
ocirc: '\u00F4',
|
||||
otilde: '\u00F5',
|
||||
ouml: '\u00F6',
|
||||
divide: '\u00F7',
|
||||
oslash: '\u00F8',
|
||||
ugrave: '\u00F9',
|
||||
uacute: '\u00FA',
|
||||
ucirc: '\u00FB',
|
||||
uuml: '\u00FC',
|
||||
yacute: '\u00FD',
|
||||
thorn: '\u00FE',
|
||||
yuml: '\u00FF',
|
||||
OElig: '\u0152',
|
||||
oelig: '\u0153',
|
||||
Scaron: '\u0160',
|
||||
scaron: '\u0161',
|
||||
Yuml: '\u0178',
|
||||
fnof: '\u0192',
|
||||
circ: '\u02C6',
|
||||
tilde: '\u02DC',
|
||||
Alpha: '\u0391',
|
||||
Beta: '\u0392',
|
||||
Gamma: '\u0393',
|
||||
Delta: '\u0394',
|
||||
Epsilon: '\u0395',
|
||||
Zeta: '\u0396',
|
||||
Eta: '\u0397',
|
||||
Theta: '\u0398',
|
||||
Iota: '\u0399',
|
||||
Kappa: '\u039A',
|
||||
Lambda: '\u039B',
|
||||
Mu: '\u039C',
|
||||
Nu: '\u039D',
|
||||
Xi: '\u039E',
|
||||
Omicron: '\u039F',
|
||||
Pi: '\u03A0',
|
||||
Rho: '\u03A1',
|
||||
Sigma: '\u03A3',
|
||||
Tau: '\u03A4',
|
||||
Upsilon: '\u03A5',
|
||||
Phi: '\u03A6',
|
||||
Chi: '\u03A7',
|
||||
Psi: '\u03A8',
|
||||
Omega: '\u03A9',
|
||||
alpha: '\u03B1',
|
||||
beta: '\u03B2',
|
||||
gamma: '\u03B3',
|
||||
delta: '\u03B4',
|
||||
epsilon: '\u03B5',
|
||||
zeta: '\u03B6',
|
||||
eta: '\u03B7',
|
||||
theta: '\u03B8',
|
||||
iota: '\u03B9',
|
||||
kappa: '\u03BA',
|
||||
lambda: '\u03BB',
|
||||
mu: '\u03BC',
|
||||
nu: '\u03BD',
|
||||
xi: '\u03BE',
|
||||
omicron: '\u03BF',
|
||||
pi: '\u03C0',
|
||||
rho: '\u03C1',
|
||||
sigmaf: '\u03C2',
|
||||
sigma: '\u03C3',
|
||||
tau: '\u03C4',
|
||||
upsilon: '\u03C5',
|
||||
phi: '\u03C6',
|
||||
chi: '\u03C7',
|
||||
psi: '\u03C8',
|
||||
omega: '\u03C9',
|
||||
thetasym: '\u03D1',
|
||||
upsih: '\u03D2',
|
||||
piv: '\u03D6',
|
||||
ensp: '\u2002',
|
||||
emsp: '\u2003',
|
||||
thinsp: '\u2009',
|
||||
zwnj: '\u200C',
|
||||
zwj: '\u200D',
|
||||
lrm: '\u200E',
|
||||
rlm: '\u200F',
|
||||
ndash: '\u2013',
|
||||
mdash: '\u2014',
|
||||
lsquo: '\u2018',
|
||||
rsquo: '\u2019',
|
||||
sbquo: '\u201A',
|
||||
ldquo: '\u201C',
|
||||
rdquo: '\u201D',
|
||||
bdquo: '\u201E',
|
||||
dagger: '\u2020',
|
||||
Dagger: '\u2021',
|
||||
bull: '\u2022',
|
||||
hellip: '\u2026',
|
||||
permil: '\u2030',
|
||||
prime: '\u2032',
|
||||
Prime: '\u2033',
|
||||
lsaquo: '\u2039',
|
||||
rsaquo: '\u203A',
|
||||
oline: '\u203E',
|
||||
frasl: '\u2044',
|
||||
euro: '\u20AC',
|
||||
image: '\u2111',
|
||||
weierp: '\u2118',
|
||||
real: '\u211C',
|
||||
trade: '\u2122',
|
||||
alefsym: '\u2135',
|
||||
larr: '\u2190',
|
||||
uarr: '\u2191',
|
||||
rarr: '\u2192',
|
||||
darr: '\u2193',
|
||||
harr: '\u2194',
|
||||
crarr: '\u21B5',
|
||||
lArr: '\u21D0',
|
||||
uArr: '\u21D1',
|
||||
rArr: '\u21D2',
|
||||
dArr: '\u21D3',
|
||||
hArr: '\u21D4',
|
||||
forall: '\u2200',
|
||||
part: '\u2202',
|
||||
exist: '\u2203',
|
||||
empty: '\u2205',
|
||||
nabla: '\u2207',
|
||||
isin: '\u2208',
|
||||
notin: '\u2209',
|
||||
ni: '\u220B',
|
||||
prod: '\u220F',
|
||||
sum: '\u2211',
|
||||
minus: '\u2212',
|
||||
lowast: '\u2217',
|
||||
radic: '\u221A',
|
||||
prop: '\u221D',
|
||||
infin: '\u221E',
|
||||
ang: '\u2220',
|
||||
and: '\u2227',
|
||||
or: '\u2228',
|
||||
cap: '\u2229',
|
||||
cup: '\u222A',
|
||||
'int': '\u222B',
|
||||
there4: '\u2234',
|
||||
sim: '\u223C',
|
||||
cong: '\u2245',
|
||||
asymp: '\u2248',
|
||||
ne: '\u2260',
|
||||
equiv: '\u2261',
|
||||
le: '\u2264',
|
||||
ge: '\u2265',
|
||||
sub: '\u2282',
|
||||
sup: '\u2283',
|
||||
nsub: '\u2284',
|
||||
sube: '\u2286',
|
||||
supe: '\u2287',
|
||||
oplus: '\u2295',
|
||||
otimes: '\u2297',
|
||||
perp: '\u22A5',
|
||||
sdot: '\u22C5',
|
||||
lceil: '\u2308',
|
||||
rceil: '\u2309',
|
||||
lfloor: '\u230A',
|
||||
rfloor: '\u230B',
|
||||
lang: '\u2329',
|
||||
rang: '\u232A',
|
||||
loz: '\u25CA',
|
||||
spades: '\u2660',
|
||||
clubs: '\u2663',
|
||||
hearts: '\u2665',
|
||||
diams: '\u2666'
|
||||
};
|
20
Lab2/node_modules/.ajv-h16f30rR/.tonic_example.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
var Ajv = require('ajv');
|
||||
var ajv = new Ajv({allErrors: true});
|
||||
|
||||
var schema = {
|
||||
"properties": {
|
||||
"foo": { "type": "string" },
|
||||
"bar": { "type": "number", "maximum": 3 }
|
||||
}
|
||||
};
|
||||
|
||||
var validate = ajv.compile(schema);
|
||||
|
||||
test({"foo": "abc", "bar": 2});
|
||||
test({"foo": 2, "bar": 4});
|
||||
|
||||
function test(data) {
|
||||
var valid = validate(data);
|
||||
if (valid) console.log('Valid!');
|
||||
else console.log('Invalid: ' + ajv.errorsText(validate.errors));
|
||||
}
|
22
Lab2/node_modules/.ajv-h16f30rR/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2017 Evgeny Poberezkin
|
||||
|
||||
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.
|
||||
|
1497
Lab2/node_modules/.ajv-h16f30rR/README.md
generated
vendored
Normal file
7189
Lab2/node_modules/.ajv-h16f30rR/dist/ajv.bundle.js
generated
vendored
Normal file
3
Lab2/node_modules/.ajv-h16f30rR/dist/ajv.min.js
generated
vendored
Normal file
1
Lab2/node_modules/.ajv-h16f30rR/dist/ajv.min.js.map
generated
vendored
Normal file
397
Lab2/node_modules/.ajv-h16f30rR/lib/ajv.d.ts
generated
vendored
Normal file
@ -0,0 +1,397 @@
|
||||
declare var ajv: {
|
||||
(options?: ajv.Options): ajv.Ajv;
|
||||
new(options?: ajv.Options): ajv.Ajv;
|
||||
ValidationError: typeof AjvErrors.ValidationError;
|
||||
MissingRefError: typeof AjvErrors.MissingRefError;
|
||||
$dataMetaSchema: object;
|
||||
}
|
||||
|
||||
declare namespace AjvErrors {
|
||||
class ValidationError extends Error {
|
||||
constructor(errors: Array<ajv.ErrorObject>);
|
||||
|
||||
message: string;
|
||||
errors: Array<ajv.ErrorObject>;
|
||||
ajv: true;
|
||||
validation: true;
|
||||
}
|
||||
|
||||
class MissingRefError extends Error {
|
||||
constructor(baseId: string, ref: string, message?: string);
|
||||
static message: (baseId: string, ref: string) => string;
|
||||
|
||||
message: string;
|
||||
missingRef: string;
|
||||
missingSchema: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace ajv {
|
||||
type ValidationError = AjvErrors.ValidationError;
|
||||
|
||||
type MissingRefError = AjvErrors.MissingRefError;
|
||||
|
||||
interface Ajv {
|
||||
/**
|
||||
* Validate data using schema
|
||||
* Schema will be compiled and cached (using serialized JSON as key, [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize by default).
|
||||
* @param {string|object|Boolean} schemaKeyRef key, ref or schema object
|
||||
* @param {Any} data to be validated
|
||||
* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
|
||||
*/
|
||||
validate(schemaKeyRef: object | string | boolean, data: any): boolean | PromiseLike<any>;
|
||||
/**
|
||||
* Create validating function for passed schema.
|
||||
* @param {object|Boolean} schema schema object
|
||||
* @return {Function} validating function
|
||||
*/
|
||||
compile(schema: object | boolean): ValidateFunction;
|
||||
/**
|
||||
* Creates validating function for passed schema with asynchronous loading of missing schemas.
|
||||
* `loadSchema` option should be a function that accepts schema uri and node-style callback.
|
||||
* @this Ajv
|
||||
* @param {object|Boolean} schema schema object
|
||||
* @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped
|
||||
* @param {Function} callback optional node-style callback, it is always called with 2 parameters: error (or null) and validating function.
|
||||
* @return {PromiseLike<ValidateFunction>} validating function
|
||||
*/
|
||||
compileAsync(schema: object | boolean, meta?: Boolean, callback?: (err: Error, validate: ValidateFunction) => any): PromiseLike<ValidateFunction>;
|
||||
/**
|
||||
* Adds schema to the instance.
|
||||
* @param {object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
|
||||
* @param {string} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
addSchema(schema: Array<object> | object, key?: string): Ajv;
|
||||
/**
|
||||
* Add schema that will be used to validate other schemas
|
||||
* options in META_IGNORE_OPTIONS are alway set to false
|
||||
* @param {object} schema schema object
|
||||
* @param {string} key optional schema key
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
addMetaSchema(schema: object, key?: string): Ajv;
|
||||
/**
|
||||
* Validate schema
|
||||
* @param {object|Boolean} schema schema to validate
|
||||
* @return {Boolean} true if schema is valid
|
||||
*/
|
||||
validateSchema(schema: object | boolean): boolean;
|
||||
/**
|
||||
* Get compiled schema from the instance by `key` or `ref`.
|
||||
* @param {string} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
|
||||
* @return {Function} schema validating function (with property `schema`). Returns undefined if keyRef can't be resolved to an existing schema.
|
||||
*/
|
||||
getSchema(keyRef: string): ValidateFunction | undefined;
|
||||
/**
|
||||
* Remove cached schema(s).
|
||||
* If no parameter is passed all schemas but meta-schemas are removed.
|
||||
* If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
||||
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
||||
* @param {string|object|RegExp|Boolean} schemaKeyRef key, ref, pattern to match key/ref or schema object
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
removeSchema(schemaKeyRef?: object | string | RegExp | boolean): Ajv;
|
||||
/**
|
||||
* Add custom format
|
||||
* @param {string} name format name
|
||||
* @param {string|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
addFormat(name: string, format: FormatValidator | FormatDefinition): Ajv;
|
||||
/**
|
||||
* Define custom keyword
|
||||
* @this Ajv
|
||||
* @param {string} keyword custom keyword, should be a valid identifier, should be different from all standard, custom and macro keywords.
|
||||
* @param {object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
addKeyword(keyword: string, definition: KeywordDefinition): Ajv;
|
||||
/**
|
||||
* Get keyword definition
|
||||
* @this Ajv
|
||||
* @param {string} keyword pre-defined or custom keyword.
|
||||
* @return {object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise.
|
||||
*/
|
||||
getKeyword(keyword: string): object | boolean;
|
||||
/**
|
||||
* Remove keyword
|
||||
* @this Ajv
|
||||
* @param {string} keyword pre-defined or custom keyword.
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
removeKeyword(keyword: string): Ajv;
|
||||
/**
|
||||
* Validate keyword
|
||||
* @this Ajv
|
||||
* @param {object} definition keyword definition object
|
||||
* @param {boolean} throwError true to throw exception if definition is invalid
|
||||
* @return {boolean} validation result
|
||||
*/
|
||||
validateKeyword(definition: KeywordDefinition, throwError: boolean): boolean;
|
||||
/**
|
||||
* Convert array of error message objects to string
|
||||
* @param {Array<object>} errors optional array of validation errors, if not passed errors from the instance are used.
|
||||
* @param {object} options optional options with properties `separator` and `dataVar`.
|
||||
* @return {string} human readable string with all errors descriptions
|
||||
*/
|
||||
errorsText(errors?: Array<ErrorObject> | null, options?: ErrorsTextOptions): string;
|
||||
errors?: Array<ErrorObject> | null;
|
||||
_opts: Options;
|
||||
}
|
||||
|
||||
interface CustomLogger {
|
||||
log(...args: any[]): any;
|
||||
warn(...args: any[]): any;
|
||||
error(...args: any[]): any;
|
||||
}
|
||||
|
||||
interface ValidateFunction {
|
||||
(
|
||||
data: any,
|
||||
dataPath?: string,
|
||||
parentData?: object | Array<any>,
|
||||
parentDataProperty?: string | number,
|
||||
rootData?: object | Array<any>
|
||||
): boolean | PromiseLike<any>;
|
||||
schema?: object | boolean;
|
||||
errors?: null | Array<ErrorObject>;
|
||||
refs?: object;
|
||||
refVal?: Array<any>;
|
||||
root?: ValidateFunction | object;
|
||||
$async?: true;
|
||||
source?: object;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
$data?: boolean;
|
||||
allErrors?: boolean;
|
||||
verbose?: boolean;
|
||||
jsonPointers?: boolean;
|
||||
uniqueItems?: boolean;
|
||||
unicode?: boolean;
|
||||
format?: false | string;
|
||||
formats?: object;
|
||||
keywords?: object;
|
||||
unknownFormats?: true | string[] | 'ignore';
|
||||
schemas?: Array<object> | object;
|
||||
schemaId?: '$id' | 'id' | 'auto';
|
||||
missingRefs?: true | 'ignore' | 'fail';
|
||||
extendRefs?: true | 'ignore' | 'fail';
|
||||
loadSchema?: (uri: string, cb?: (err: Error, schema: object) => void) => PromiseLike<object | boolean>;
|
||||
removeAdditional?: boolean | 'all' | 'failing';
|
||||
useDefaults?: boolean | 'empty' | 'shared';
|
||||
coerceTypes?: boolean | 'array';
|
||||
strictDefaults?: boolean | 'log';
|
||||
strictKeywords?: boolean | 'log';
|
||||
strictNumbers?: boolean;
|
||||
async?: boolean | string;
|
||||
transpile?: string | ((code: string) => string);
|
||||
meta?: boolean | object;
|
||||
validateSchema?: boolean | 'log';
|
||||
addUsedSchema?: boolean;
|
||||
inlineRefs?: boolean | number;
|
||||
passContext?: boolean;
|
||||
loopRequired?: number;
|
||||
ownProperties?: boolean;
|
||||
multipleOfPrecision?: boolean | number;
|
||||
errorDataPath?: string,
|
||||
messages?: boolean;
|
||||
sourceCode?: boolean;
|
||||
processCode?: (code: string, schema: object) => string;
|
||||
cache?: object;
|
||||
logger?: CustomLogger | false;
|
||||
nullable?: boolean;
|
||||
serialize?: ((schema: object | boolean) => any) | false;
|
||||
}
|
||||
|
||||
type FormatValidator = string | RegExp | ((data: string) => boolean | PromiseLike<any>);
|
||||
type NumberFormatValidator = ((data: number) => boolean | PromiseLike<any>);
|
||||
|
||||
interface NumberFormatDefinition {
|
||||
type: "number",
|
||||
validate: NumberFormatValidator;
|
||||
compare?: (data1: number, data2: number) => number;
|
||||
async?: boolean;
|
||||
}
|
||||
|
||||
interface StringFormatDefinition {
|
||||
type?: "string",
|
||||
validate: FormatValidator;
|
||||
compare?: (data1: string, data2: string) => number;
|
||||
async?: boolean;
|
||||
}
|
||||
|
||||
type FormatDefinition = NumberFormatDefinition | StringFormatDefinition;
|
||||
|
||||
interface KeywordDefinition {
|
||||
type?: string | Array<string>;
|
||||
async?: boolean;
|
||||
$data?: boolean;
|
||||
errors?: boolean | string;
|
||||
metaSchema?: object;
|
||||
// schema: false makes validate not to expect schema (ValidateFunction)
|
||||
schema?: boolean;
|
||||
statements?: boolean;
|
||||
dependencies?: Array<string>;
|
||||
modifying?: boolean;
|
||||
valid?: boolean;
|
||||
// one and only one of the following properties should be present
|
||||
validate?: SchemaValidateFunction | ValidateFunction;
|
||||
compile?: (schema: any, parentSchema: object, it: CompilationContext) => ValidateFunction;
|
||||
macro?: (schema: any, parentSchema: object, it: CompilationContext) => object | boolean;
|
||||
inline?: (it: CompilationContext, keyword: string, schema: any, parentSchema: object) => string;
|
||||
}
|
||||
|
||||
interface CompilationContext {
|
||||
level: number;
|
||||
dataLevel: number;
|
||||
dataPathArr: string[];
|
||||
schema: any;
|
||||
schemaPath: string;
|
||||
baseId: string;
|
||||
async: boolean;
|
||||
opts: Options;
|
||||
formats: {
|
||||
[index: string]: FormatDefinition | undefined;
|
||||
};
|
||||
keywords: {
|
||||
[index: string]: KeywordDefinition | undefined;
|
||||
};
|
||||
compositeRule: boolean;
|
||||
validate: (schema: object) => boolean;
|
||||
util: {
|
||||
copy(obj: any, target?: any): any;
|
||||
toHash(source: string[]): { [index: string]: true | undefined };
|
||||
equal(obj: any, target: any): boolean;
|
||||
getProperty(str: string): string;
|
||||
schemaHasRules(schema: object, rules: any): string;
|
||||
escapeQuotes(str: string): string;
|
||||
toQuotedString(str: string): string;
|
||||
getData(jsonPointer: string, dataLevel: number, paths: string[]): string;
|
||||
escapeJsonPointer(str: string): string;
|
||||
unescapeJsonPointer(str: string): string;
|
||||
escapeFragment(str: string): string;
|
||||
unescapeFragment(str: string): string;
|
||||
};
|
||||
self: Ajv;
|
||||
}
|
||||
|
||||
interface SchemaValidateFunction {
|
||||
(
|
||||
schema: any,
|
||||
data: any,
|
||||
parentSchema?: object,
|
||||
dataPath?: string,
|
||||
parentData?: object | Array<any>,
|
||||
parentDataProperty?: string | number,
|
||||
rootData?: object | Array<any>
|
||||
): boolean | PromiseLike<any>;
|
||||
errors?: Array<ErrorObject>;
|
||||
}
|
||||
|
||||
interface ErrorsTextOptions {
|
||||
separator?: string;
|
||||
dataVar?: string;
|
||||
}
|
||||
|
||||
interface ErrorObject {
|
||||
keyword: string;
|
||||
dataPath: string;
|
||||
schemaPath: string;
|
||||
params: ErrorParameters;
|
||||
// Added to validation errors of propertyNames keyword schema
|
||||
propertyName?: string;
|
||||
// Excluded if messages set to false.
|
||||
message?: string;
|
||||
// These are added with the `verbose` option.
|
||||
schema?: any;
|
||||
parentSchema?: object;
|
||||
data?: any;
|
||||
}
|
||||
|
||||
type ErrorParameters = RefParams | LimitParams | AdditionalPropertiesParams |
|
||||
DependenciesParams | FormatParams | ComparisonParams |
|
||||
MultipleOfParams | PatternParams | RequiredParams |
|
||||
TypeParams | UniqueItemsParams | CustomParams |
|
||||
PatternRequiredParams | PropertyNamesParams |
|
||||
IfParams | SwitchParams | NoParams | EnumParams;
|
||||
|
||||
interface RefParams {
|
||||
ref: string;
|
||||
}
|
||||
|
||||
interface LimitParams {
|
||||
limit: number;
|
||||
}
|
||||
|
||||
interface AdditionalPropertiesParams {
|
||||
additionalProperty: string;
|
||||
}
|
||||
|
||||
interface DependenciesParams {
|
||||
property: string;
|
||||
missingProperty: string;
|
||||
depsCount: number;
|
||||
deps: string;
|
||||
}
|
||||
|
||||
interface FormatParams {
|
||||
format: string
|
||||
}
|
||||
|
||||
interface ComparisonParams {
|
||||
comparison: string;
|
||||
limit: number | string;
|
||||
exclusive: boolean;
|
||||
}
|
||||
|
||||
interface MultipleOfParams {
|
||||
multipleOf: number;
|
||||
}
|
||||
|
||||
interface PatternParams {
|
||||
pattern: string;
|
||||
}
|
||||
|
||||
interface RequiredParams {
|
||||
missingProperty: string;
|
||||
}
|
||||
|
||||
interface TypeParams {
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface UniqueItemsParams {
|
||||
i: number;
|
||||
j: number;
|
||||
}
|
||||
|
||||
interface CustomParams {
|
||||
keyword: string;
|
||||
}
|
||||
|
||||
interface PatternRequiredParams {
|
||||
missingPattern: string;
|
||||
}
|
||||
|
||||
interface PropertyNamesParams {
|
||||
propertyName: string;
|
||||
}
|
||||
|
||||
interface IfParams {
|
||||
failingKeyword: string;
|
||||
}
|
||||
|
||||
interface SwitchParams {
|
||||
caseIndex: number;
|
||||
}
|
||||
|
||||
interface NoParams { }
|
||||
|
||||
interface EnumParams {
|
||||
allowedValues: Array<any>;
|
||||
}
|
||||
}
|
||||
|
||||
export = ajv;
|
506
Lab2/node_modules/.ajv-h16f30rR/lib/ajv.js
generated
vendored
Normal file
@ -0,0 +1,506 @@
|
||||
'use strict';
|
||||
|
||||
var compileSchema = require('./compile')
|
||||
, resolve = require('./compile/resolve')
|
||||
, Cache = require('./cache')
|
||||
, SchemaObject = require('./compile/schema_obj')
|
||||
, stableStringify = require('fast-json-stable-stringify')
|
||||
, formats = require('./compile/formats')
|
||||
, rules = require('./compile/rules')
|
||||
, $dataMetaSchema = require('./data')
|
||||
, util = require('./compile/util');
|
||||
|
||||
module.exports = Ajv;
|
||||
|
||||
Ajv.prototype.validate = validate;
|
||||
Ajv.prototype.compile = compile;
|
||||
Ajv.prototype.addSchema = addSchema;
|
||||
Ajv.prototype.addMetaSchema = addMetaSchema;
|
||||
Ajv.prototype.validateSchema = validateSchema;
|
||||
Ajv.prototype.getSchema = getSchema;
|
||||
Ajv.prototype.removeSchema = removeSchema;
|
||||
Ajv.prototype.addFormat = addFormat;
|
||||
Ajv.prototype.errorsText = errorsText;
|
||||
|
||||
Ajv.prototype._addSchema = _addSchema;
|
||||
Ajv.prototype._compile = _compile;
|
||||
|
||||
Ajv.prototype.compileAsync = require('./compile/async');
|
||||
var customKeyword = require('./keyword');
|
||||
Ajv.prototype.addKeyword = customKeyword.add;
|
||||
Ajv.prototype.getKeyword = customKeyword.get;
|
||||
Ajv.prototype.removeKeyword = customKeyword.remove;
|
||||
Ajv.prototype.validateKeyword = customKeyword.validate;
|
||||
|
||||
var errorClasses = require('./compile/error_classes');
|
||||
Ajv.ValidationError = errorClasses.Validation;
|
||||
Ajv.MissingRefError = errorClasses.MissingRef;
|
||||
Ajv.$dataMetaSchema = $dataMetaSchema;
|
||||
|
||||
var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema';
|
||||
|
||||
var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes', 'strictDefaults' ];
|
||||
var META_SUPPORT_DATA = ['/properties'];
|
||||
|
||||
/**
|
||||
* Creates validator instance.
|
||||
* Usage: `Ajv(opts)`
|
||||
* @param {Object} opts optional options
|
||||
* @return {Object} ajv instance
|
||||
*/
|
||||
function Ajv(opts) {
|
||||
if (!(this instanceof Ajv)) return new Ajv(opts);
|
||||
opts = this._opts = util.copy(opts) || {};
|
||||
setLogger(this);
|
||||
this._schemas = {};
|
||||
this._refs = {};
|
||||
this._fragments = {};
|
||||
this._formats = formats(opts.format);
|
||||
|
||||
this._cache = opts.cache || new Cache;
|
||||
this._loadingSchemas = {};
|
||||
this._compilations = [];
|
||||
this.RULES = rules();
|
||||
this._getId = chooseGetId(opts);
|
||||
|
||||
opts.loopRequired = opts.loopRequired || Infinity;
|
||||
if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true;
|
||||
if (opts.serialize === undefined) opts.serialize = stableStringify;
|
||||
this._metaOpts = getMetaSchemaOptions(this);
|
||||
|
||||
if (opts.formats) addInitialFormats(this);
|
||||
if (opts.keywords) addInitialKeywords(this);
|
||||
addDefaultMetaSchema(this);
|
||||
if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta);
|
||||
if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}});
|
||||
addInitialSchemas(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Validate data using schema
|
||||
* Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize.
|
||||
* @this Ajv
|
||||
* @param {String|Object} schemaKeyRef key, ref or schema object
|
||||
* @param {Any} data to be validated
|
||||
* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
|
||||
*/
|
||||
function validate(schemaKeyRef, data) {
|
||||
var v;
|
||||
if (typeof schemaKeyRef == 'string') {
|
||||
v = this.getSchema(schemaKeyRef);
|
||||
if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"');
|
||||
} else {
|
||||
var schemaObj = this._addSchema(schemaKeyRef);
|
||||
v = schemaObj.validate || this._compile(schemaObj);
|
||||
}
|
||||
|
||||
var valid = v(data);
|
||||
if (v.$async !== true) this.errors = v.errors;
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create validating function for passed schema.
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords.
|
||||
* @return {Function} validating function
|
||||
*/
|
||||
function compile(schema, _meta) {
|
||||
var schemaObj = this._addSchema(schema, undefined, _meta);
|
||||
return schemaObj.validate || this._compile(schemaObj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds schema to the instance.
|
||||
* @this Ajv
|
||||
* @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
|
||||
* @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
|
||||
* @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.
|
||||
* @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
function addSchema(schema, key, _skipValidation, _meta) {
|
||||
if (Array.isArray(schema)){
|
||||
for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);
|
||||
return this;
|
||||
}
|
||||
var id = this._getId(schema);
|
||||
if (id !== undefined && typeof id != 'string')
|
||||
throw new Error('schema id must be string');
|
||||
key = resolve.normalizeId(key || id);
|
||||
checkUnique(this, key);
|
||||
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add schema that will be used to validate other schemas
|
||||
* options in META_IGNORE_OPTIONS are alway set to false
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {String} key optional schema key
|
||||
* @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
function addMetaSchema(schema, key, skipValidation) {
|
||||
this.addSchema(schema, key, skipValidation, true);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate schema
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to validate
|
||||
* @param {Boolean} throwOrLogError pass true to throw (or log) an error if invalid
|
||||
* @return {Boolean} true if schema is valid
|
||||
*/
|
||||
function validateSchema(schema, throwOrLogError) {
|
||||
var $schema = schema.$schema;
|
||||
if ($schema !== undefined && typeof $schema != 'string')
|
||||
throw new Error('$schema must be a string');
|
||||
$schema = $schema || this._opts.defaultMeta || defaultMeta(this);
|
||||
if (!$schema) {
|
||||
this.logger.warn('meta-schema not available');
|
||||
this.errors = null;
|
||||
return true;
|
||||
}
|
||||
var valid = this.validate($schema, schema);
|
||||
if (!valid && throwOrLogError) {
|
||||
var message = 'schema is invalid: ' + this.errorsText();
|
||||
if (this._opts.validateSchema == 'log') this.logger.error(message);
|
||||
else throw new Error(message);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
function defaultMeta(self) {
|
||||
var meta = self._opts.meta;
|
||||
self._opts.defaultMeta = typeof meta == 'object'
|
||||
? self._getId(meta) || meta
|
||||
: self.getSchema(META_SCHEMA_ID)
|
||||
? META_SCHEMA_ID
|
||||
: undefined;
|
||||
return self._opts.defaultMeta;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get compiled schema from the instance by `key` or `ref`.
|
||||
* @this Ajv
|
||||
* @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
|
||||
* @return {Function} schema validating function (with property `schema`).
|
||||
*/
|
||||
function getSchema(keyRef) {
|
||||
var schemaObj = _getSchemaObj(this, keyRef);
|
||||
switch (typeof schemaObj) {
|
||||
case 'object': return schemaObj.validate || this._compile(schemaObj);
|
||||
case 'string': return this.getSchema(schemaObj);
|
||||
case 'undefined': return _getSchemaFragment(this, keyRef);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _getSchemaFragment(self, ref) {
|
||||
var res = resolve.schema.call(self, { schema: {} }, ref);
|
||||
if (res) {
|
||||
var schema = res.schema
|
||||
, root = res.root
|
||||
, baseId = res.baseId;
|
||||
var v = compileSchema.call(self, schema, root, undefined, baseId);
|
||||
self._fragments[ref] = new SchemaObject({
|
||||
ref: ref,
|
||||
fragment: true,
|
||||
schema: schema,
|
||||
root: root,
|
||||
baseId: baseId,
|
||||
validate: v
|
||||
});
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _getSchemaObj(self, keyRef) {
|
||||
keyRef = resolve.normalizeId(keyRef);
|
||||
return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove cached schema(s).
|
||||
* If no parameter is passed all schemas but meta-schemas are removed.
|
||||
* If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
||||
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
||||
* @this Ajv
|
||||
* @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
function removeSchema(schemaKeyRef) {
|
||||
if (schemaKeyRef instanceof RegExp) {
|
||||
_removeAllSchemas(this, this._schemas, schemaKeyRef);
|
||||
_removeAllSchemas(this, this._refs, schemaKeyRef);
|
||||
return this;
|
||||
}
|
||||
switch (typeof schemaKeyRef) {
|
||||
case 'undefined':
|
||||
_removeAllSchemas(this, this._schemas);
|
||||
_removeAllSchemas(this, this._refs);
|
||||
this._cache.clear();
|
||||
return this;
|
||||
case 'string':
|
||||
var schemaObj = _getSchemaObj(this, schemaKeyRef);
|
||||
if (schemaObj) this._cache.del(schemaObj.cacheKey);
|
||||
delete this._schemas[schemaKeyRef];
|
||||
delete this._refs[schemaKeyRef];
|
||||
return this;
|
||||
case 'object':
|
||||
var serialize = this._opts.serialize;
|
||||
var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef;
|
||||
this._cache.del(cacheKey);
|
||||
var id = this._getId(schemaKeyRef);
|
||||
if (id) {
|
||||
id = resolve.normalizeId(id);
|
||||
delete this._schemas[id];
|
||||
delete this._refs[id];
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
function _removeAllSchemas(self, schemas, regex) {
|
||||
for (var keyRef in schemas) {
|
||||
var schemaObj = schemas[keyRef];
|
||||
if (!schemaObj.meta && (!regex || regex.test(keyRef))) {
|
||||
self._cache.del(schemaObj.cacheKey);
|
||||
delete schemas[keyRef];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function _addSchema(schema, skipValidation, meta, shouldAddSchema) {
|
||||
if (typeof schema != 'object' && typeof schema != 'boolean')
|
||||
throw new Error('schema should be object or boolean');
|
||||
var serialize = this._opts.serialize;
|
||||
var cacheKey = serialize ? serialize(schema) : schema;
|
||||
var cached = this._cache.get(cacheKey);
|
||||
if (cached) return cached;
|
||||
|
||||
shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
|
||||
|
||||
var id = resolve.normalizeId(this._getId(schema));
|
||||
if (id && shouldAddSchema) checkUnique(this, id);
|
||||
|
||||
var willValidate = this._opts.validateSchema !== false && !skipValidation;
|
||||
var recursiveMeta;
|
||||
if (willValidate && !(recursiveMeta = id && id == resolve.normalizeId(schema.$schema)))
|
||||
this.validateSchema(schema, true);
|
||||
|
||||
var localRefs = resolve.ids.call(this, schema);
|
||||
|
||||
var schemaObj = new SchemaObject({
|
||||
id: id,
|
||||
schema: schema,
|
||||
localRefs: localRefs,
|
||||
cacheKey: cacheKey,
|
||||
meta: meta
|
||||
});
|
||||
|
||||
if (id[0] != '#' && shouldAddSchema) this._refs[id] = schemaObj;
|
||||
this._cache.put(cacheKey, schemaObj);
|
||||
|
||||
if (willValidate && recursiveMeta) this.validateSchema(schema, true);
|
||||
|
||||
return schemaObj;
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function _compile(schemaObj, root) {
|
||||
if (schemaObj.compiling) {
|
||||
schemaObj.validate = callValidate;
|
||||
callValidate.schema = schemaObj.schema;
|
||||
callValidate.errors = null;
|
||||
callValidate.root = root ? root : callValidate;
|
||||
if (schemaObj.schema.$async === true)
|
||||
callValidate.$async = true;
|
||||
return callValidate;
|
||||
}
|
||||
schemaObj.compiling = true;
|
||||
|
||||
var currentOpts;
|
||||
if (schemaObj.meta) {
|
||||
currentOpts = this._opts;
|
||||
this._opts = this._metaOpts;
|
||||
}
|
||||
|
||||
var v;
|
||||
try { v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs); }
|
||||
catch(e) {
|
||||
delete schemaObj.validate;
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
schemaObj.compiling = false;
|
||||
if (schemaObj.meta) this._opts = currentOpts;
|
||||
}
|
||||
|
||||
schemaObj.validate = v;
|
||||
schemaObj.refs = v.refs;
|
||||
schemaObj.refVal = v.refVal;
|
||||
schemaObj.root = v.root;
|
||||
return v;
|
||||
|
||||
|
||||
/* @this {*} - custom context, see passContext option */
|
||||
function callValidate() {
|
||||
/* jshint validthis: true */
|
||||
var _validate = schemaObj.validate;
|
||||
var result = _validate.apply(this, arguments);
|
||||
callValidate.errors = _validate.errors;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function chooseGetId(opts) {
|
||||
switch (opts.schemaId) {
|
||||
case 'auto': return _get$IdOrId;
|
||||
case 'id': return _getId;
|
||||
default: return _get$Id;
|
||||
}
|
||||
}
|
||||
|
||||
/* @this Ajv */
|
||||
function _getId(schema) {
|
||||
if (schema.$id) this.logger.warn('schema $id ignored', schema.$id);
|
||||
return schema.id;
|
||||
}
|
||||
|
||||
/* @this Ajv */
|
||||
function _get$Id(schema) {
|
||||
if (schema.id) this.logger.warn('schema id ignored', schema.id);
|
||||
return schema.$id;
|
||||
}
|
||||
|
||||
|
||||
function _get$IdOrId(schema) {
|
||||
if (schema.$id && schema.id && schema.$id != schema.id)
|
||||
throw new Error('schema $id is different from id');
|
||||
return schema.$id || schema.id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert array of error message objects to string
|
||||
* @this Ajv
|
||||
* @param {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used.
|
||||
* @param {Object} options optional options with properties `separator` and `dataVar`.
|
||||
* @return {String} human readable string with all errors descriptions
|
||||
*/
|
||||
function errorsText(errors, options) {
|
||||
errors = errors || this.errors;
|
||||
if (!errors) return 'No errors';
|
||||
options = options || {};
|
||||
var separator = options.separator === undefined ? ', ' : options.separator;
|
||||
var dataVar = options.dataVar === undefined ? 'data' : options.dataVar;
|
||||
|
||||
var text = '';
|
||||
for (var i=0; i<errors.length; i++) {
|
||||
var e = errors[i];
|
||||
if (e) text += dataVar + e.dataPath + ' ' + e.message + separator;
|
||||
}
|
||||
return text.slice(0, -separator.length);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add custom format
|
||||
* @this Ajv
|
||||
* @param {String} name format name
|
||||
* @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
function addFormat(name, format) {
|
||||
if (typeof format == 'string') format = new RegExp(format);
|
||||
this._formats[name] = format;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
function addDefaultMetaSchema(self) {
|
||||
var $dataSchema;
|
||||
if (self._opts.$data) {
|
||||
$dataSchema = require('./refs/data.json');
|
||||
self.addMetaSchema($dataSchema, $dataSchema.$id, true);
|
||||
}
|
||||
if (self._opts.meta === false) return;
|
||||
var metaSchema = require('./refs/json-schema-draft-07.json');
|
||||
if (self._opts.$data) metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA);
|
||||
self.addMetaSchema(metaSchema, META_SCHEMA_ID, true);
|
||||
self._refs['http://json-schema.org/schema'] = META_SCHEMA_ID;
|
||||
}
|
||||
|
||||
|
||||
function addInitialSchemas(self) {
|
||||
var optsSchemas = self._opts.schemas;
|
||||
if (!optsSchemas) return;
|
||||
if (Array.isArray(optsSchemas)) self.addSchema(optsSchemas);
|
||||
else for (var key in optsSchemas) self.addSchema(optsSchemas[key], key);
|
||||
}
|
||||
|
||||
|
||||
function addInitialFormats(self) {
|
||||
for (var name in self._opts.formats) {
|
||||
var format = self._opts.formats[name];
|
||||
self.addFormat(name, format);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function addInitialKeywords(self) {
|
||||
for (var name in self._opts.keywords) {
|
||||
var keyword = self._opts.keywords[name];
|
||||
self.addKeyword(name, keyword);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkUnique(self, id) {
|
||||
if (self._schemas[id] || self._refs[id])
|
||||
throw new Error('schema with key or id "' + id + '" already exists');
|
||||
}
|
||||
|
||||
|
||||
function getMetaSchemaOptions(self) {
|
||||
var metaOpts = util.copy(self._opts);
|
||||
for (var i=0; i<META_IGNORE_OPTIONS.length; i++)
|
||||
delete metaOpts[META_IGNORE_OPTIONS[i]];
|
||||
return metaOpts;
|
||||
}
|
||||
|
||||
|
||||
function setLogger(self) {
|
||||
var logger = self._opts.logger;
|
||||
if (logger === false) {
|
||||
self.logger = {log: noop, warn: noop, error: noop};
|
||||
} else {
|
||||
if (logger === undefined) logger = console;
|
||||
if (!(typeof logger == 'object' && logger.log && logger.warn && logger.error))
|
||||
throw new Error('logger must implement log, warn and error methods');
|
||||
self.logger = logger;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function noop() {}
|
26
Lab2/node_modules/.ajv-h16f30rR/lib/cache.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
var Cache = module.exports = function Cache() {
|
||||
this._cache = {};
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.put = function Cache_put(key, value) {
|
||||
this._cache[key] = value;
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.get = function Cache_get(key) {
|
||||
return this._cache[key];
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.del = function Cache_del(key) {
|
||||
delete this._cache[key];
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.clear = function Cache_clear() {
|
||||
this._cache = {};
|
||||
};
|
90
Lab2/node_modules/.ajv-h16f30rR/lib/compile/async.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
'use strict';
|
||||
|
||||
var MissingRefError = require('./error_classes').MissingRef;
|
||||
|
||||
module.exports = compileAsync;
|
||||
|
||||
|
||||
/**
|
||||
* Creates validating function for passed schema with asynchronous loading of missing schemas.
|
||||
* `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema.
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped
|
||||
* @param {Function} callback an optional node-style callback, it is called with 2 parameters: error (or null) and validating function.
|
||||
* @return {Promise} promise that resolves with a validating function.
|
||||
*/
|
||||
function compileAsync(schema, meta, callback) {
|
||||
/* eslint no-shadow: 0 */
|
||||
/* global Promise */
|
||||
/* jshint validthis: true */
|
||||
var self = this;
|
||||
if (typeof this._opts.loadSchema != 'function')
|
||||
throw new Error('options.loadSchema should be a function');
|
||||
|
||||
if (typeof meta == 'function') {
|
||||
callback = meta;
|
||||
meta = undefined;
|
||||
}
|
||||
|
||||
var p = loadMetaSchemaOf(schema).then(function () {
|
||||
var schemaObj = self._addSchema(schema, undefined, meta);
|
||||
return schemaObj.validate || _compileAsync(schemaObj);
|
||||
});
|
||||
|
||||
if (callback) {
|
||||
p.then(
|
||||
function(v) { callback(null, v); },
|
||||
callback
|
||||
);
|
||||
}
|
||||
|
||||
return p;
|
||||
|
||||
|
||||
function loadMetaSchemaOf(sch) {
|
||||
var $schema = sch.$schema;
|
||||
return $schema && !self.getSchema($schema)
|
||||
? compileAsync.call(self, { $ref: $schema }, true)
|
||||
: Promise.resolve();
|
||||
}
|
||||
|
||||
|
||||
function _compileAsync(schemaObj) {
|
||||
try { return self._compile(schemaObj); }
|
||||
catch(e) {
|
||||
if (e instanceof MissingRefError) return loadMissingSchema(e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
function loadMissingSchema(e) {
|
||||
var ref = e.missingSchema;
|
||||
if (added(ref)) throw new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved');
|
||||
|
||||
var schemaPromise = self._loadingSchemas[ref];
|
||||
if (!schemaPromise) {
|
||||
schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref);
|
||||
schemaPromise.then(removePromise, removePromise);
|
||||
}
|
||||
|
||||
return schemaPromise.then(function (sch) {
|
||||
if (!added(ref)) {
|
||||
return loadMetaSchemaOf(sch).then(function () {
|
||||
if (!added(ref)) self.addSchema(sch, ref, undefined, meta);
|
||||
});
|
||||
}
|
||||
}).then(function() {
|
||||
return _compileAsync(schemaObj);
|
||||
});
|
||||
|
||||
function removePromise() {
|
||||
delete self._loadingSchemas[ref];
|
||||
}
|
||||
|
||||
function added(ref) {
|
||||
return self._refs[ref] || self._schemas[ref];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
5
Lab2/node_modules/.ajv-h16f30rR/lib/compile/equal.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
// do NOT remove this file - it would break pre-compiled schemas
|
||||
// https://github.com/ajv-validator/ajv/issues/889
|
||||
module.exports = require('fast-deep-equal');
|
34
Lab2/node_modules/.ajv-h16f30rR/lib/compile/error_classes.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
var resolve = require('./resolve');
|
||||
|
||||
module.exports = {
|
||||
Validation: errorSubclass(ValidationError),
|
||||
MissingRef: errorSubclass(MissingRefError)
|
||||
};
|
||||
|
||||
|
||||
function ValidationError(errors) {
|
||||
this.message = 'validation failed';
|
||||
this.errors = errors;
|
||||
this.ajv = this.validation = true;
|
||||
}
|
||||
|
||||
|
||||
MissingRefError.message = function (baseId, ref) {
|
||||
return 'can\'t resolve reference ' + ref + ' from id ' + baseId;
|
||||
};
|
||||
|
||||
|
||||
function MissingRefError(baseId, ref, message) {
|
||||
this.message = message || MissingRefError.message(baseId, ref);
|
||||
this.missingRef = resolve.url(baseId, ref);
|
||||
this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef));
|
||||
}
|
||||
|
||||
|
||||
function errorSubclass(Subclass) {
|
||||
Subclass.prototype = Object.create(Error.prototype);
|
||||
Subclass.prototype.constructor = Subclass;
|
||||
return Subclass;
|
||||
}
|
142
Lab2/node_modules/.ajv-h16f30rR/lib/compile/formats.js
generated
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('./util');
|
||||
|
||||
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
||||
var DAYS = [0,31,28,31,30,31,30,31,31,30,31,30,31];
|
||||
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
|
||||
var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
|
||||
var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
||||
var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
||||
// uri-template: https://tools.ietf.org/html/rfc6570
|
||||
var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
|
||||
// For the source: https://gist.github.com/dperini/729294
|
||||
// For test cases: https://mathiasbynens.be/demo/url-regex
|
||||
// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.
|
||||
// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
|
||||
var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
|
||||
var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
||||
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
||||
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
||||
var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
|
||||
|
||||
|
||||
module.exports = formats;
|
||||
|
||||
function formats(mode) {
|
||||
mode = mode == 'full' ? 'full' : 'fast';
|
||||
return util.copy(formats[mode]);
|
||||
}
|
||||
|
||||
|
||||
formats.fast = {
|
||||
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,
|
||||
// date-time: http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
|
||||
'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,
|
||||
// uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
|
||||
uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
|
||||
'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
||||
'uri-template': URITEMPLATE,
|
||||
url: URL,
|
||||
// email (sources from jsen validator):
|
||||
// http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363
|
||||
// http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation')
|
||||
email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,
|
||||
hostname: HOSTNAME,
|
||||
// optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
|
||||
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
|
||||
// optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
|
||||
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
|
||||
regex: regex,
|
||||
// uuid: http://tools.ietf.org/html/rfc4122
|
||||
uuid: UUID,
|
||||
// JSON-pointer: https://tools.ietf.org/html/rfc6901
|
||||
// uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A
|
||||
'json-pointer': JSON_POINTER,
|
||||
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
|
||||
// relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00
|
||||
'relative-json-pointer': RELATIVE_JSON_POINTER
|
||||
};
|
||||
|
||||
|
||||
formats.full = {
|
||||
date: date,
|
||||
time: time,
|
||||
'date-time': date_time,
|
||||
uri: uri,
|
||||
'uri-reference': URIREF,
|
||||
'uri-template': URITEMPLATE,
|
||||
url: URL,
|
||||
email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
|
||||
hostname: HOSTNAME,
|
||||
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
|
||||
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
|
||||
regex: regex,
|
||||
uuid: UUID,
|
||||
'json-pointer': JSON_POINTER,
|
||||
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
|
||||
'relative-json-pointer': RELATIVE_JSON_POINTER
|
||||
};
|
||||
|
||||
|
||||
function isLeapYear(year) {
|
||||
// https://tools.ietf.org/html/rfc3339#appendix-C
|
||||
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
||||
}
|
||||
|
||||
|
||||
function date(str) {
|
||||
// full-date from http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
var matches = str.match(DATE);
|
||||
if (!matches) return false;
|
||||
|
||||
var year = +matches[1];
|
||||
var month = +matches[2];
|
||||
var day = +matches[3];
|
||||
|
||||
return month >= 1 && month <= 12 && day >= 1 &&
|
||||
day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
|
||||
}
|
||||
|
||||
|
||||
function time(str, full) {
|
||||
var matches = str.match(TIME);
|
||||
if (!matches) return false;
|
||||
|
||||
var hour = matches[1];
|
||||
var minute = matches[2];
|
||||
var second = matches[3];
|
||||
var timeZone = matches[5];
|
||||
return ((hour <= 23 && minute <= 59 && second <= 59) ||
|
||||
(hour == 23 && minute == 59 && second == 60)) &&
|
||||
(!full || timeZone);
|
||||
}
|
||||
|
||||
|
||||
var DATE_TIME_SEPARATOR = /t|\s/i;
|
||||
function date_time(str) {
|
||||
// http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
var dateTime = str.split(DATE_TIME_SEPARATOR);
|
||||
return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true);
|
||||
}
|
||||
|
||||
|
||||
var NOT_URI_FRAGMENT = /\/|:/;
|
||||
function uri(str) {
|
||||
// http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."
|
||||
return NOT_URI_FRAGMENT.test(str) && URI.test(str);
|
||||
}
|
||||
|
||||
|
||||
var Z_ANCHOR = /[^\\]\\Z/;
|
||||
function regex(str) {
|
||||
if (Z_ANCHOR.test(str)) return false;
|
||||
try {
|
||||
new RegExp(str);
|
||||
return true;
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
387
Lab2/node_modules/.ajv-h16f30rR/lib/compile/index.js
generated
vendored
Normal file
@ -0,0 +1,387 @@
|
||||
'use strict';
|
||||
|
||||
var resolve = require('./resolve')
|
||||
, util = require('./util')
|
||||
, errorClasses = require('./error_classes')
|
||||
, stableStringify = require('fast-json-stable-stringify');
|
||||
|
||||
var validateGenerator = require('../dotjs/validate');
|
||||
|
||||
/**
|
||||
* Functions below are used inside compiled validations function
|
||||
*/
|
||||
|
||||
var ucs2length = util.ucs2length;
|
||||
var equal = require('fast-deep-equal');
|
||||
|
||||
// this error is thrown by async schemas to return validation errors via exception
|
||||
var ValidationError = errorClasses.Validation;
|
||||
|
||||
module.exports = compile;
|
||||
|
||||
|
||||
/**
|
||||
* Compiles schema to validation function
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {Object} root object with information about the root schema for this schema
|
||||
* @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution
|
||||
* @param {String} baseId base ID for IDs in the schema
|
||||
* @return {Function} validation function
|
||||
*/
|
||||
function compile(schema, root, localRefs, baseId) {
|
||||
/* jshint validthis: true, evil: true */
|
||||
/* eslint no-shadow: 0 */
|
||||
var self = this
|
||||
, opts = this._opts
|
||||
, refVal = [ undefined ]
|
||||
, refs = {}
|
||||
, patterns = []
|
||||
, patternsHash = {}
|
||||
, defaults = []
|
||||
, defaultsHash = {}
|
||||
, customRules = [];
|
||||
|
||||
root = root || { schema: schema, refVal: refVal, refs: refs };
|
||||
|
||||
var c = checkCompiling.call(this, schema, root, baseId);
|
||||
var compilation = this._compilations[c.index];
|
||||
if (c.compiling) return (compilation.callValidate = callValidate);
|
||||
|
||||
var formats = this._formats;
|
||||
var RULES = this.RULES;
|
||||
|
||||
try {
|
||||
var v = localCompile(schema, root, localRefs, baseId);
|
||||
compilation.validate = v;
|
||||
var cv = compilation.callValidate;
|
||||
if (cv) {
|
||||
cv.schema = v.schema;
|
||||
cv.errors = null;
|
||||
cv.refs = v.refs;
|
||||
cv.refVal = v.refVal;
|
||||
cv.root = v.root;
|
||||
cv.$async = v.$async;
|
||||
if (opts.sourceCode) cv.source = v.source;
|
||||
}
|
||||
return v;
|
||||
} finally {
|
||||
endCompiling.call(this, schema, root, baseId);
|
||||
}
|
||||
|
||||
/* @this {*} - custom context, see passContext option */
|
||||
function callValidate() {
|
||||
/* jshint validthis: true */
|
||||
var validate = compilation.validate;
|
||||
var result = validate.apply(this, arguments);
|
||||
callValidate.errors = validate.errors;
|
||||
return result;
|
||||
}
|
||||
|
||||
function localCompile(_schema, _root, localRefs, baseId) {
|
||||
var isRoot = !_root || (_root && _root.schema == _schema);
|
||||
if (_root.schema != root.schema)
|
||||
return compile.call(self, _schema, _root, localRefs, baseId);
|
||||
|
||||
var $async = _schema.$async === true;
|
||||
|
||||
var sourceCode = validateGenerator({
|
||||
isTop: true,
|
||||
schema: _schema,
|
||||
isRoot: isRoot,
|
||||
baseId: baseId,
|
||||
root: _root,
|
||||
schemaPath: '',
|
||||
errSchemaPath: '#',
|
||||
errorPath: '""',
|
||||
MissingRefError: errorClasses.MissingRef,
|
||||
RULES: RULES,
|
||||
validate: validateGenerator,
|
||||
util: util,
|
||||
resolve: resolve,
|
||||
resolveRef: resolveRef,
|
||||
usePattern: usePattern,
|
||||
useDefault: useDefault,
|
||||
useCustomRule: useCustomRule,
|
||||
opts: opts,
|
||||
formats: formats,
|
||||
logger: self.logger,
|
||||
self: self
|
||||
});
|
||||
|
||||
sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode)
|
||||
+ vars(defaults, defaultCode) + vars(customRules, customRuleCode)
|
||||
+ sourceCode;
|
||||
|
||||
if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);
|
||||
// console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
|
||||
var validate;
|
||||
try {
|
||||
var makeValidate = new Function(
|
||||
'self',
|
||||
'RULES',
|
||||
'formats',
|
||||
'root',
|
||||
'refVal',
|
||||
'defaults',
|
||||
'customRules',
|
||||
'equal',
|
||||
'ucs2length',
|
||||
'ValidationError',
|
||||
sourceCode
|
||||
);
|
||||
|
||||
validate = makeValidate(
|
||||
self,
|
||||
RULES,
|
||||
formats,
|
||||
root,
|
||||
refVal,
|
||||
defaults,
|
||||
customRules,
|
||||
equal,
|
||||
ucs2length,
|
||||
ValidationError
|
||||
);
|
||||
|
||||
refVal[0] = validate;
|
||||
} catch(e) {
|
||||
self.logger.error('Error compiling schema, function code:', sourceCode);
|
||||
throw e;
|
||||
}
|
||||
|
||||
validate.schema = _schema;
|
||||
validate.errors = null;
|
||||
validate.refs = refs;
|
||||
validate.refVal = refVal;
|
||||
validate.root = isRoot ? validate : _root;
|
||||
if ($async) validate.$async = true;
|
||||
if (opts.sourceCode === true) {
|
||||
validate.source = {
|
||||
code: sourceCode,
|
||||
patterns: patterns,
|
||||
defaults: defaults
|
||||
};
|
||||
}
|
||||
|
||||
return validate;
|
||||
}
|
||||
|
||||
function resolveRef(baseId, ref, isRoot) {
|
||||
ref = resolve.url(baseId, ref);
|
||||
var refIndex = refs[ref];
|
||||
var _refVal, refCode;
|
||||
if (refIndex !== undefined) {
|
||||
_refVal = refVal[refIndex];
|
||||
refCode = 'refVal[' + refIndex + ']';
|
||||
return resolvedRef(_refVal, refCode);
|
||||
}
|
||||
if (!isRoot && root.refs) {
|
||||
var rootRefId = root.refs[ref];
|
||||
if (rootRefId !== undefined) {
|
||||
_refVal = root.refVal[rootRefId];
|
||||
refCode = addLocalRef(ref, _refVal);
|
||||
return resolvedRef(_refVal, refCode);
|
||||
}
|
||||
}
|
||||
|
||||
refCode = addLocalRef(ref);
|
||||
var v = resolve.call(self, localCompile, root, ref);
|
||||
if (v === undefined) {
|
||||
var localSchema = localRefs && localRefs[ref];
|
||||
if (localSchema) {
|
||||
v = resolve.inlineRef(localSchema, opts.inlineRefs)
|
||||
? localSchema
|
||||
: compile.call(self, localSchema, root, localRefs, baseId);
|
||||
}
|
||||
}
|
||||
|
||||
if (v === undefined) {
|
||||
removeLocalRef(ref);
|
||||
} else {
|
||||
replaceLocalRef(ref, v);
|
||||
return resolvedRef(v, refCode);
|
||||
}
|
||||
}
|
||||
|
||||
function addLocalRef(ref, v) {
|
||||
var refId = refVal.length;
|
||||
refVal[refId] = v;
|
||||
refs[ref] = refId;
|
||||
return 'refVal' + refId;
|
||||
}
|
||||
|
||||
function removeLocalRef(ref) {
|
||||
delete refs[ref];
|
||||
}
|
||||
|
||||
function replaceLocalRef(ref, v) {
|
||||
var refId = refs[ref];
|
||||
refVal[refId] = v;
|
||||
}
|
||||
|
||||
function resolvedRef(refVal, code) {
|
||||
return typeof refVal == 'object' || typeof refVal == 'boolean'
|
||||
? { code: code, schema: refVal, inline: true }
|
||||
: { code: code, $async: refVal && !!refVal.$async };
|
||||
}
|
||||
|
||||
function usePattern(regexStr) {
|
||||
var index = patternsHash[regexStr];
|
||||
if (index === undefined) {
|
||||
index = patternsHash[regexStr] = patterns.length;
|
||||
patterns[index] = regexStr;
|
||||
}
|
||||
return 'pattern' + index;
|
||||
}
|
||||
|
||||
function useDefault(value) {
|
||||
switch (typeof value) {
|
||||
case 'boolean':
|
||||
case 'number':
|
||||
return '' + value;
|
||||
case 'string':
|
||||
return util.toQuotedString(value);
|
||||
case 'object':
|
||||
if (value === null) return 'null';
|
||||
var valueStr = stableStringify(value);
|
||||
var index = defaultsHash[valueStr];
|
||||
if (index === undefined) {
|
||||
index = defaultsHash[valueStr] = defaults.length;
|
||||
defaults[index] = value;
|
||||
}
|
||||
return 'default' + index;
|
||||
}
|
||||
}
|
||||
|
||||
function useCustomRule(rule, schema, parentSchema, it) {
|
||||
if (self._opts.validateSchema !== false) {
|
||||
var deps = rule.definition.dependencies;
|
||||
if (deps && !deps.every(function(keyword) {
|
||||
return Object.prototype.hasOwnProperty.call(parentSchema, keyword);
|
||||
}))
|
||||
throw new Error('parent schema must have all required keywords: ' + deps.join(','));
|
||||
|
||||
var validateSchema = rule.definition.validateSchema;
|
||||
if (validateSchema) {
|
||||
var valid = validateSchema(schema);
|
||||
if (!valid) {
|
||||
var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors);
|
||||
if (self._opts.validateSchema == 'log') self.logger.error(message);
|
||||
else throw new Error(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var compile = rule.definition.compile
|
||||
, inline = rule.definition.inline
|
||||
, macro = rule.definition.macro;
|
||||
|
||||
var validate;
|
||||
if (compile) {
|
||||
validate = compile.call(self, schema, parentSchema, it);
|
||||
} else if (macro) {
|
||||
validate = macro.call(self, schema, parentSchema, it);
|
||||
if (opts.validateSchema !== false) self.validateSchema(validate, true);
|
||||
} else if (inline) {
|
||||
validate = inline.call(self, it, rule.keyword, schema, parentSchema);
|
||||
} else {
|
||||
validate = rule.definition.validate;
|
||||
if (!validate) return;
|
||||
}
|
||||
|
||||
if (validate === undefined)
|
||||
throw new Error('custom keyword "' + rule.keyword + '"failed to compile');
|
||||
|
||||
var index = customRules.length;
|
||||
customRules[index] = validate;
|
||||
|
||||
return {
|
||||
code: 'customRule' + index,
|
||||
validate: validate
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the schema is currently compiled
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to compile
|
||||
* @param {Object} root root object
|
||||
* @param {String} baseId base schema ID
|
||||
* @return {Object} object with properties "index" (compilation index) and "compiling" (boolean)
|
||||
*/
|
||||
function checkCompiling(schema, root, baseId) {
|
||||
/* jshint validthis: true */
|
||||
var index = compIndex.call(this, schema, root, baseId);
|
||||
if (index >= 0) return { index: index, compiling: true };
|
||||
index = this._compilations.length;
|
||||
this._compilations[index] = {
|
||||
schema: schema,
|
||||
root: root,
|
||||
baseId: baseId
|
||||
};
|
||||
return { index: index, compiling: false };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the schema from the currently compiled list
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to compile
|
||||
* @param {Object} root root object
|
||||
* @param {String} baseId base schema ID
|
||||
*/
|
||||
function endCompiling(schema, root, baseId) {
|
||||
/* jshint validthis: true */
|
||||
var i = compIndex.call(this, schema, root, baseId);
|
||||
if (i >= 0) this._compilations.splice(i, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Index of schema compilation in the currently compiled list
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to compile
|
||||
* @param {Object} root root object
|
||||
* @param {String} baseId base schema ID
|
||||
* @return {Integer} compilation index
|
||||
*/
|
||||
function compIndex(schema, root, baseId) {
|
||||
/* jshint validthis: true */
|
||||
for (var i=0; i<this._compilations.length; i++) {
|
||||
var c = this._compilations[i];
|
||||
if (c.schema == schema && c.root == root && c.baseId == baseId) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
function patternCode(i, patterns) {
|
||||
return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');';
|
||||
}
|
||||
|
||||
|
||||
function defaultCode(i) {
|
||||
return 'var default' + i + ' = defaults[' + i + '];';
|
||||
}
|
||||
|
||||
|
||||
function refValCode(i, refVal) {
|
||||
return refVal[i] === undefined ? '' : 'var refVal' + i + ' = refVal[' + i + '];';
|
||||
}
|
||||
|
||||
|
||||
function customRuleCode(i) {
|
||||
return 'var customRule' + i + ' = customRules[' + i + '];';
|
||||
}
|
||||
|
||||
|
||||
function vars(arr, statement) {
|
||||
if (!arr.length) return '';
|
||||
var code = '';
|
||||
for (var i=0; i<arr.length; i++)
|
||||
code += statement(i, arr);
|
||||
return code;
|
||||
}
|
270
Lab2/node_modules/.ajv-h16f30rR/lib/compile/resolve.js
generated
vendored
Normal file
@ -0,0 +1,270 @@
|
||||
'use strict';
|
||||
|
||||
var URI = require('uri-js')
|
||||
, equal = require('fast-deep-equal')
|
||||
, util = require('./util')
|
||||
, SchemaObject = require('./schema_obj')
|
||||
, traverse = require('json-schema-traverse');
|
||||
|
||||
module.exports = resolve;
|
||||
|
||||
resolve.normalizeId = normalizeId;
|
||||
resolve.fullPath = getFullPath;
|
||||
resolve.url = resolveUrl;
|
||||
resolve.ids = resolveIds;
|
||||
resolve.inlineRef = inlineRef;
|
||||
resolve.schema = resolveSchema;
|
||||
|
||||
/**
|
||||
* [resolve and compile the references ($ref)]
|
||||
* @this Ajv
|
||||
* @param {Function} compile reference to schema compilation funciton (localCompile)
|
||||
* @param {Object} root object with information about the root schema for the current schema
|
||||
* @param {String} ref reference to resolve
|
||||
* @return {Object|Function} schema object (if the schema can be inlined) or validation function
|
||||
*/
|
||||
function resolve(compile, root, ref) {
|
||||
/* jshint validthis: true */
|
||||
var refVal = this._refs[ref];
|
||||
if (typeof refVal == 'string') {
|
||||
if (this._refs[refVal]) refVal = this._refs[refVal];
|
||||
else return resolve.call(this, compile, root, refVal);
|
||||
}
|
||||
|
||||
refVal = refVal || this._schemas[ref];
|
||||
if (refVal instanceof SchemaObject) {
|
||||
return inlineRef(refVal.schema, this._opts.inlineRefs)
|
||||
? refVal.schema
|
||||
: refVal.validate || this._compile(refVal);
|
||||
}
|
||||
|
||||
var res = resolveSchema.call(this, root, ref);
|
||||
var schema, v, baseId;
|
||||
if (res) {
|
||||
schema = res.schema;
|
||||
root = res.root;
|
||||
baseId = res.baseId;
|
||||
}
|
||||
|
||||
if (schema instanceof SchemaObject) {
|
||||
v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);
|
||||
} else if (schema !== undefined) {
|
||||
v = inlineRef(schema, this._opts.inlineRefs)
|
||||
? schema
|
||||
: compile.call(this, schema, root, undefined, baseId);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resolve schema, its root and baseId
|
||||
* @this Ajv
|
||||
* @param {Object} root root object with properties schema, refVal, refs
|
||||
* @param {String} ref reference to resolve
|
||||
* @return {Object} object with properties schema, root, baseId
|
||||
*/
|
||||
function resolveSchema(root, ref) {
|
||||
/* jshint validthis: true */
|
||||
var p = URI.parse(ref)
|
||||
, refPath = _getFullPath(p)
|
||||
, baseId = getFullPath(this._getId(root.schema));
|
||||
if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
|
||||
var id = normalizeId(refPath);
|
||||
var refVal = this._refs[id];
|
||||
if (typeof refVal == 'string') {
|
||||
return resolveRecursive.call(this, root, refVal, p);
|
||||
} else if (refVal instanceof SchemaObject) {
|
||||
if (!refVal.validate) this._compile(refVal);
|
||||
root = refVal;
|
||||
} else {
|
||||
refVal = this._schemas[id];
|
||||
if (refVal instanceof SchemaObject) {
|
||||
if (!refVal.validate) this._compile(refVal);
|
||||
if (id == normalizeId(ref))
|
||||
return { schema: refVal, root: root, baseId: baseId };
|
||||
root = refVal;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!root.schema) return;
|
||||
baseId = getFullPath(this._getId(root.schema));
|
||||
}
|
||||
return getJsonPointer.call(this, p, baseId, root.schema, root);
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function resolveRecursive(root, ref, parsedRef) {
|
||||
/* jshint validthis: true */
|
||||
var res = resolveSchema.call(this, root, ref);
|
||||
if (res) {
|
||||
var schema = res.schema;
|
||||
var baseId = res.baseId;
|
||||
root = res.root;
|
||||
var id = this._getId(schema);
|
||||
if (id) baseId = resolveUrl(baseId, id);
|
||||
return getJsonPointer.call(this, parsedRef, baseId, schema, root);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']);
|
||||
/* @this Ajv */
|
||||
function getJsonPointer(parsedRef, baseId, schema, root) {
|
||||
/* jshint validthis: true */
|
||||
parsedRef.fragment = parsedRef.fragment || '';
|
||||
if (parsedRef.fragment.slice(0,1) != '/') return;
|
||||
var parts = parsedRef.fragment.split('/');
|
||||
|
||||
for (var i = 1; i < parts.length; i++) {
|
||||
var part = parts[i];
|
||||
if (part) {
|
||||
part = util.unescapeFragment(part);
|
||||
schema = schema[part];
|
||||
if (schema === undefined) break;
|
||||
var id;
|
||||
if (!PREVENT_SCOPE_CHANGE[part]) {
|
||||
id = this._getId(schema);
|
||||
if (id) baseId = resolveUrl(baseId, id);
|
||||
if (schema.$ref) {
|
||||
var $ref = resolveUrl(baseId, schema.$ref);
|
||||
var res = resolveSchema.call(this, root, $ref);
|
||||
if (res) {
|
||||
schema = res.schema;
|
||||
root = res.root;
|
||||
baseId = res.baseId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (schema !== undefined && schema !== root.schema)
|
||||
return { schema: schema, root: root, baseId: baseId };
|
||||
}
|
||||
|
||||
|
||||
var SIMPLE_INLINED = util.toHash([
|
||||
'type', 'format', 'pattern',
|
||||
'maxLength', 'minLength',
|
||||
'maxProperties', 'minProperties',
|
||||
'maxItems', 'minItems',
|
||||
'maximum', 'minimum',
|
||||
'uniqueItems', 'multipleOf',
|
||||
'required', 'enum'
|
||||
]);
|
||||
function inlineRef(schema, limit) {
|
||||
if (limit === false) return false;
|
||||
if (limit === undefined || limit === true) return checkNoRef(schema);
|
||||
else if (limit) return countKeys(schema) <= limit;
|
||||
}
|
||||
|
||||
|
||||
function checkNoRef(schema) {
|
||||
var item;
|
||||
if (Array.isArray(schema)) {
|
||||
for (var i=0; i<schema.length; i++) {
|
||||
item = schema[i];
|
||||
if (typeof item == 'object' && !checkNoRef(item)) return false;
|
||||
}
|
||||
} else {
|
||||
for (var key in schema) {
|
||||
if (key == '$ref') return false;
|
||||
item = schema[key];
|
||||
if (typeof item == 'object' && !checkNoRef(item)) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function countKeys(schema) {
|
||||
var count = 0, item;
|
||||
if (Array.isArray(schema)) {
|
||||
for (var i=0; i<schema.length; i++) {
|
||||
item = schema[i];
|
||||
if (typeof item == 'object') count += countKeys(item);
|
||||
if (count == Infinity) return Infinity;
|
||||
}
|
||||
} else {
|
||||
for (var key in schema) {
|
||||
if (key == '$ref') return Infinity;
|
||||
if (SIMPLE_INLINED[key]) {
|
||||
count++;
|
||||
} else {
|
||||
item = schema[key];
|
||||
if (typeof item == 'object') count += countKeys(item) + 1;
|
||||
if (count == Infinity) return Infinity;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
function getFullPath(id, normalize) {
|
||||
if (normalize !== false) id = normalizeId(id);
|
||||
var p = URI.parse(id);
|
||||
return _getFullPath(p);
|
||||
}
|
||||
|
||||
|
||||
function _getFullPath(p) {
|
||||
return URI.serialize(p).split('#')[0] + '#';
|
||||
}
|
||||
|
||||
|
||||
var TRAILING_SLASH_HASH = /#\/?$/;
|
||||
function normalizeId(id) {
|
||||
return id ? id.replace(TRAILING_SLASH_HASH, '') : '';
|
||||
}
|
||||
|
||||
|
||||
function resolveUrl(baseId, id) {
|
||||
id = normalizeId(id);
|
||||
return URI.resolve(baseId, id);
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function resolveIds(schema) {
|
||||
var schemaId = normalizeId(this._getId(schema));
|
||||
var baseIds = {'': schemaId};
|
||||
var fullPaths = {'': getFullPath(schemaId, false)};
|
||||
var localRefs = {};
|
||||
var self = this;
|
||||
|
||||
traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
||||
if (jsonPtr === '') return;
|
||||
var id = self._getId(sch);
|
||||
var baseId = baseIds[parentJsonPtr];
|
||||
var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword;
|
||||
if (keyIndex !== undefined)
|
||||
fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex));
|
||||
|
||||
if (typeof id == 'string') {
|
||||
id = baseId = normalizeId(baseId ? URI.resolve(baseId, id) : id);
|
||||
|
||||
var refVal = self._refs[id];
|
||||
if (typeof refVal == 'string') refVal = self._refs[refVal];
|
||||
if (refVal && refVal.schema) {
|
||||
if (!equal(sch, refVal.schema))
|
||||
throw new Error('id "' + id + '" resolves to more than one schema');
|
||||
} else if (id != normalizeId(fullPath)) {
|
||||
if (id[0] == '#') {
|
||||
if (localRefs[id] && !equal(sch, localRefs[id]))
|
||||
throw new Error('id "' + id + '" resolves to more than one schema');
|
||||
localRefs[id] = sch;
|
||||
} else {
|
||||
self._refs[id] = fullPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
baseIds[jsonPtr] = baseId;
|
||||
fullPaths[jsonPtr] = fullPath;
|
||||
});
|
||||
|
||||
return localRefs;
|
||||
}
|
66
Lab2/node_modules/.ajv-h16f30rR/lib/compile/rules.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
'use strict';
|
||||
|
||||
var ruleModules = require('../dotjs')
|
||||
, toHash = require('./util').toHash;
|
||||
|
||||
module.exports = function rules() {
|
||||
var RULES = [
|
||||
{ type: 'number',
|
||||
rules: [ { 'maximum': ['exclusiveMaximum'] },
|
||||
{ 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] },
|
||||
{ type: 'string',
|
||||
rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] },
|
||||
{ type: 'array',
|
||||
rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] },
|
||||
{ type: 'object',
|
||||
rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames',
|
||||
{ 'properties': ['additionalProperties', 'patternProperties'] } ] },
|
||||
{ rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] }
|
||||
];
|
||||
|
||||
var ALL = [ 'type', '$comment' ];
|
||||
var KEYWORDS = [
|
||||
'$schema', '$id', 'id', '$data', '$async', 'title',
|
||||
'description', 'default', 'definitions',
|
||||
'examples', 'readOnly', 'writeOnly',
|
||||
'contentMediaType', 'contentEncoding',
|
||||
'additionalItems', 'then', 'else'
|
||||
];
|
||||
var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];
|
||||
RULES.all = toHash(ALL);
|
||||
RULES.types = toHash(TYPES);
|
||||
|
||||
RULES.forEach(function (group) {
|
||||
group.rules = group.rules.map(function (keyword) {
|
||||
var implKeywords;
|
||||
if (typeof keyword == 'object') {
|
||||
var key = Object.keys(keyword)[0];
|
||||
implKeywords = keyword[key];
|
||||
keyword = key;
|
||||
implKeywords.forEach(function (k) {
|
||||
ALL.push(k);
|
||||
RULES.all[k] = true;
|
||||
});
|
||||
}
|
||||
ALL.push(keyword);
|
||||
var rule = RULES.all[keyword] = {
|
||||
keyword: keyword,
|
||||
code: ruleModules[keyword],
|
||||
implements: implKeywords
|
||||
};
|
||||
return rule;
|
||||
});
|
||||
|
||||
RULES.all.$comment = {
|
||||
keyword: '$comment',
|
||||
code: ruleModules.$comment
|
||||
};
|
||||
|
||||
if (group.type) RULES.types[group.type] = group;
|
||||
});
|
||||
|
||||
RULES.keywords = toHash(ALL.concat(KEYWORDS));
|
||||
RULES.custom = {};
|
||||
|
||||
return RULES;
|
||||
};
|
9
Lab2/node_modules/.ajv-h16f30rR/lib/compile/schema_obj.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('./util');
|
||||
|
||||
module.exports = SchemaObject;
|
||||
|
||||
function SchemaObject(obj) {
|
||||
util.copy(obj, this);
|
||||
}
|
20
Lab2/node_modules/.ajv-h16f30rR/lib/compile/ucs2length.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
// https://mathiasbynens.be/notes/javascript-encoding
|
||||
// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
|
||||
module.exports = function ucs2length(str) {
|
||||
var length = 0
|
||||
, len = str.length
|
||||
, pos = 0
|
||||
, value;
|
||||
while (pos < len) {
|
||||
length++;
|
||||
value = str.charCodeAt(pos++);
|
||||
if (value >= 0xD800 && value <= 0xDBFF && pos < len) {
|
||||
// high surrogate, and there is a next character
|
||||
value = str.charCodeAt(pos);
|
||||
if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate
|
||||
}
|
||||
}
|
||||
return length;
|
||||
};
|
239
Lab2/node_modules/.ajv-h16f30rR/lib/compile/util.js
generated
vendored
Normal file
@ -0,0 +1,239 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
module.exports = {
|
||||
copy: copy,
|
||||
checkDataType: checkDataType,
|
||||
checkDataTypes: checkDataTypes,
|
||||
coerceToTypes: coerceToTypes,
|
||||
toHash: toHash,
|
||||
getProperty: getProperty,
|
||||
escapeQuotes: escapeQuotes,
|
||||
equal: require('fast-deep-equal'),
|
||||
ucs2length: require('./ucs2length'),
|
||||
varOccurences: varOccurences,
|
||||
varReplace: varReplace,
|
||||
schemaHasRules: schemaHasRules,
|
||||
schemaHasRulesExcept: schemaHasRulesExcept,
|
||||
schemaUnknownRules: schemaUnknownRules,
|
||||
toQuotedString: toQuotedString,
|
||||
getPathExpr: getPathExpr,
|
||||
getPath: getPath,
|
||||
getData: getData,
|
||||
unescapeFragment: unescapeFragment,
|
||||
unescapeJsonPointer: unescapeJsonPointer,
|
||||
escapeFragment: escapeFragment,
|
||||
escapeJsonPointer: escapeJsonPointer
|
||||
};
|
||||
|
||||
|
||||
function copy(o, to) {
|
||||
to = to || {};
|
||||
for (var key in o) to[key] = o[key];
|
||||
return to;
|
||||
}
|
||||
|
||||
|
||||
function checkDataType(dataType, data, strictNumbers, negate) {
|
||||
var EQUAL = negate ? ' !== ' : ' === '
|
||||
, AND = negate ? ' || ' : ' && '
|
||||
, OK = negate ? '!' : ''
|
||||
, NOT = negate ? '' : '!';
|
||||
switch (dataType) {
|
||||
case 'null': return data + EQUAL + 'null';
|
||||
case 'array': return OK + 'Array.isArray(' + data + ')';
|
||||
case 'object': return '(' + OK + data + AND +
|
||||
'typeof ' + data + EQUAL + '"object"' + AND +
|
||||
NOT + 'Array.isArray(' + data + '))';
|
||||
case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
|
||||
NOT + '(' + data + ' % 1)' +
|
||||
AND + data + EQUAL + data +
|
||||
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
|
||||
case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' +
|
||||
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
|
||||
default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkDataTypes(dataTypes, data, strictNumbers) {
|
||||
switch (dataTypes.length) {
|
||||
case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);
|
||||
default:
|
||||
var code = '';
|
||||
var types = toHash(dataTypes);
|
||||
if (types.array && types.object) {
|
||||
code = types.null ? '(': '(!' + data + ' || ';
|
||||
code += 'typeof ' + data + ' !== "object")';
|
||||
delete types.null;
|
||||
delete types.array;
|
||||
delete types.object;
|
||||
}
|
||||
if (types.number) delete types.integer;
|
||||
for (var t in types)
|
||||
code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);
|
||||
function coerceToTypes(optionCoerceTypes, dataTypes) {
|
||||
if (Array.isArray(dataTypes)) {
|
||||
var types = [];
|
||||
for (var i=0; i<dataTypes.length; i++) {
|
||||
var t = dataTypes[i];
|
||||
if (COERCE_TO_TYPES[t]) types[types.length] = t;
|
||||
else if (optionCoerceTypes === 'array' && t === 'array') types[types.length] = t;
|
||||
}
|
||||
if (types.length) return types;
|
||||
} else if (COERCE_TO_TYPES[dataTypes]) {
|
||||
return [dataTypes];
|
||||
} else if (optionCoerceTypes === 'array' && dataTypes === 'array') {
|
||||
return ['array'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toHash(arr) {
|
||||
var hash = {};
|
||||
for (var i=0; i<arr.length; i++) hash[arr[i]] = true;
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
||||
var SINGLE_QUOTE = /'|\\/g;
|
||||
function getProperty(key) {
|
||||
return typeof key == 'number'
|
||||
? '[' + key + ']'
|
||||
: IDENTIFIER.test(key)
|
||||
? '.' + key
|
||||
: "['" + escapeQuotes(key) + "']";
|
||||
}
|
||||
|
||||
|
||||
function escapeQuotes(str) {
|
||||
return str.replace(SINGLE_QUOTE, '\\$&')
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/\r/g, '\\r')
|
||||
.replace(/\f/g, '\\f')
|
||||
.replace(/\t/g, '\\t');
|
||||
}
|
||||
|
||||
|
||||
function varOccurences(str, dataVar) {
|
||||
dataVar += '[^0-9]';
|
||||
var matches = str.match(new RegExp(dataVar, 'g'));
|
||||
return matches ? matches.length : 0;
|
||||
}
|
||||
|
||||
|
||||
function varReplace(str, dataVar, expr) {
|
||||
dataVar += '([^0-9])';
|
||||
expr = expr.replace(/\$/g, '$$$$');
|
||||
return str.replace(new RegExp(dataVar, 'g'), expr + '$1');
|
||||
}
|
||||
|
||||
|
||||
function schemaHasRules(schema, rules) {
|
||||
if (typeof schema == 'boolean') return !schema;
|
||||
for (var key in schema) if (rules[key]) return true;
|
||||
}
|
||||
|
||||
|
||||
function schemaHasRulesExcept(schema, rules, exceptKeyword) {
|
||||
if (typeof schema == 'boolean') return !schema && exceptKeyword != 'not';
|
||||
for (var key in schema) if (key != exceptKeyword && rules[key]) return true;
|
||||
}
|
||||
|
||||
|
||||
function schemaUnknownRules(schema, rules) {
|
||||
if (typeof schema == 'boolean') return;
|
||||
for (var key in schema) if (!rules[key]) return key;
|
||||
}
|
||||
|
||||
|
||||
function toQuotedString(str) {
|
||||
return '\'' + escapeQuotes(str) + '\'';
|
||||
}
|
||||
|
||||
|
||||
function getPathExpr(currentPath, expr, jsonPointers, isNumber) {
|
||||
var path = jsonPointers // false by default
|
||||
? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')')
|
||||
: (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\'');
|
||||
return joinPaths(currentPath, path);
|
||||
}
|
||||
|
||||
|
||||
function getPath(currentPath, prop, jsonPointers) {
|
||||
var path = jsonPointers // false by default
|
||||
? toQuotedString('/' + escapeJsonPointer(prop))
|
||||
: toQuotedString(getProperty(prop));
|
||||
return joinPaths(currentPath, path);
|
||||
}
|
||||
|
||||
|
||||
var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
|
||||
var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
||||
function getData($data, lvl, paths) {
|
||||
var up, jsonPointer, data, matches;
|
||||
if ($data === '') return 'rootData';
|
||||
if ($data[0] == '/') {
|
||||
if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data);
|
||||
jsonPointer = $data;
|
||||
data = 'rootData';
|
||||
} else {
|
||||
matches = $data.match(RELATIVE_JSON_POINTER);
|
||||
if (!matches) throw new Error('Invalid JSON-pointer: ' + $data);
|
||||
up = +matches[1];
|
||||
jsonPointer = matches[2];
|
||||
if (jsonPointer == '#') {
|
||||
if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);
|
||||
return paths[lvl - up];
|
||||
}
|
||||
|
||||
if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl);
|
||||
data = 'data' + ((lvl - up) || '');
|
||||
if (!jsonPointer) return data;
|
||||
}
|
||||
|
||||
var expr = data;
|
||||
var segments = jsonPointer.split('/');
|
||||
for (var i=0; i<segments.length; i++) {
|
||||
var segment = segments[i];
|
||||
if (segment) {
|
||||
data += getProperty(unescapeJsonPointer(segment));
|
||||
expr += ' && ' + data;
|
||||
}
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
||||
|
||||
function joinPaths (a, b) {
|
||||
if (a == '""') return b;
|
||||
return (a + ' + ' + b).replace(/([^\\])' \+ '/g, '$1');
|
||||
}
|
||||
|
||||
|
||||
function unescapeFragment(str) {
|
||||
return unescapeJsonPointer(decodeURIComponent(str));
|
||||
}
|
||||
|
||||
|
||||
function escapeFragment(str) {
|
||||
return encodeURIComponent(escapeJsonPointer(str));
|
||||
}
|
||||
|
||||
|
||||
function escapeJsonPointer(str) {
|
||||
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
||||
}
|
||||
|
||||
|
||||
function unescapeJsonPointer(str) {
|
||||
return str.replace(/~1/g, '/').replace(/~0/g, '~');
|
||||
}
|
49
Lab2/node_modules/.ajv-h16f30rR/lib/data.js
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
var KEYWORDS = [
|
||||
'multipleOf',
|
||||
'maximum',
|
||||
'exclusiveMaximum',
|
||||
'minimum',
|
||||
'exclusiveMinimum',
|
||||
'maxLength',
|
||||
'minLength',
|
||||
'pattern',
|
||||
'additionalItems',
|
||||
'maxItems',
|
||||
'minItems',
|
||||
'uniqueItems',
|
||||
'maxProperties',
|
||||
'minProperties',
|
||||
'required',
|
||||
'additionalProperties',
|
||||
'enum',
|
||||
'format',
|
||||
'const'
|
||||
];
|
||||
|
||||
module.exports = function (metaSchema, keywordsJsonPointers) {
|
||||
for (var i=0; i<keywordsJsonPointers.length; i++) {
|
||||
metaSchema = JSON.parse(JSON.stringify(metaSchema));
|
||||
var segments = keywordsJsonPointers[i].split('/');
|
||||
var keywords = metaSchema;
|
||||
var j;
|
||||
for (j=1; j<segments.length; j++)
|
||||
keywords = keywords[segments[j]];
|
||||
|
||||
for (j=0; j<KEYWORDS.length; j++) {
|
||||
var key = KEYWORDS[j];
|
||||
var schema = keywords[key];
|
||||
if (schema) {
|
||||
keywords[key] = {
|
||||
anyOf: [
|
||||
schema,
|
||||
{ $ref: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return metaSchema;
|
||||
};
|
37
Lab2/node_modules/.ajv-h16f30rR/lib/definition_schema.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var metaSchema = require('./refs/json-schema-draft-07.json');
|
||||
|
||||
module.exports = {
|
||||
$id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js',
|
||||
definitions: {
|
||||
simpleTypes: metaSchema.definitions.simpleTypes
|
||||
},
|
||||
type: 'object',
|
||||
dependencies: {
|
||||
schema: ['validate'],
|
||||
$data: ['validate'],
|
||||
statements: ['inline'],
|
||||
valid: {not: {required: ['macro']}}
|
||||
},
|
||||
properties: {
|
||||
type: metaSchema.properties.type,
|
||||
schema: {type: 'boolean'},
|
||||
statements: {type: 'boolean'},
|
||||
dependencies: {
|
||||
type: 'array',
|
||||
items: {type: 'string'}
|
||||
},
|
||||
metaSchema: {type: 'object'},
|
||||
modifying: {type: 'boolean'},
|
||||
valid: {type: 'boolean'},
|
||||
$data: {type: 'boolean'},
|
||||
async: {type: 'boolean'},
|
||||
errors: {
|
||||
anyOf: [
|
||||
{type: 'boolean'},
|
||||
{const: 'full'}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
113
Lab2/node_modules/.ajv-h16f30rR/lib/dot/_limit.jst
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{## def.setExclusiveLimit:
|
||||
$exclusive = true;
|
||||
$errorKeyword = $exclusiveKeyword;
|
||||
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
|
||||
#}}
|
||||
|
||||
{{
|
||||
var $isMax = $keyword == 'maximum'
|
||||
, $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum'
|
||||
, $schemaExcl = it.schema[$exclusiveKeyword]
|
||||
, $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data
|
||||
, $op = $isMax ? '<' : '>'
|
||||
, $notOp = $isMax ? '>' : '<'
|
||||
, $errorKeyword = undefined;
|
||||
|
||||
if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
if (!($isDataExcl || $schemaExcl === undefined
|
||||
|| typeof $schemaExcl == 'number'
|
||||
|| typeof $schemaExcl == 'boolean')) {
|
||||
throw new Error($exclusiveKeyword + ' must be number or boolean');
|
||||
}
|
||||
}}
|
||||
|
||||
{{? $isDataExcl }}
|
||||
{{
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr)
|
||||
, $exclusive = 'exclusive' + $lvl
|
||||
, $exclType = 'exclType' + $lvl
|
||||
, $exclIsNumber = 'exclIsNumber' + $lvl
|
||||
, $opExpr = 'op' + $lvl
|
||||
, $opStr = '\' + ' + $opExpr + ' + \'';
|
||||
}}
|
||||
var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}};
|
||||
{{ $schemaValueExcl = 'schemaExcl' + $lvl; }}
|
||||
|
||||
var {{=$exclusive}};
|
||||
var {{=$exclType}} = typeof {{=$schemaValueExcl}};
|
||||
if ({{=$exclType}} != 'boolean' && {{=$exclType}} != 'undefined' && {{=$exclType}} != 'number') {
|
||||
{{ var $errorKeyword = $exclusiveKeyword; }}
|
||||
{{# def.error:'_exclusiveLimit' }}
|
||||
} else if ({{# def.$dataNotType:'number' }}
|
||||
{{=$exclType}} == 'number'
|
||||
? (
|
||||
({{=$exclusive}} = {{=$schemaValue}} === undefined || {{=$schemaValueExcl}} {{=$op}}= {{=$schemaValue}})
|
||||
? {{=$data}} {{=$notOp}}= {{=$schemaValueExcl}}
|
||||
: {{=$data}} {{=$notOp}} {{=$schemaValue}}
|
||||
)
|
||||
: (
|
||||
({{=$exclusive}} = {{=$schemaValueExcl}} === true)
|
||||
? {{=$data}} {{=$notOp}}= {{=$schemaValue}}
|
||||
: {{=$data}} {{=$notOp}} {{=$schemaValue}}
|
||||
)
|
||||
|| {{=$data}} !== {{=$data}}) {
|
||||
var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}=';
|
||||
{{
|
||||
if ($schema === undefined) {
|
||||
$errorKeyword = $exclusiveKeyword;
|
||||
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
|
||||
$schemaValue = $schemaValueExcl;
|
||||
$isData = $isDataExcl;
|
||||
}
|
||||
}}
|
||||
{{??}}
|
||||
{{
|
||||
var $exclIsNumber = typeof $schemaExcl == 'number'
|
||||
, $opStr = $op; /*used in error*/
|
||||
}}
|
||||
|
||||
{{? $exclIsNumber && $isData }}
|
||||
{{ var $opExpr = '\'' + $opStr + '\''; /*used in error*/ }}
|
||||
if ({{# def.$dataNotType:'number' }}
|
||||
( {{=$schemaValue}} === undefined
|
||||
|| {{=$schemaExcl}} {{=$op}}= {{=$schemaValue}}
|
||||
? {{=$data}} {{=$notOp}}= {{=$schemaExcl}}
|
||||
: {{=$data}} {{=$notOp}} {{=$schemaValue}} )
|
||||
|| {{=$data}} !== {{=$data}}) {
|
||||
{{??}}
|
||||
{{
|
||||
if ($exclIsNumber && $schema === undefined) {
|
||||
{{# def.setExclusiveLimit }}
|
||||
$schemaValue = $schemaExcl;
|
||||
$notOp += '=';
|
||||
} else {
|
||||
if ($exclIsNumber)
|
||||
$schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema);
|
||||
|
||||
if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {
|
||||
{{# def.setExclusiveLimit }}
|
||||
$notOp += '=';
|
||||
} else {
|
||||
$exclusive = false;
|
||||
$opStr += '=';
|
||||
}
|
||||
}
|
||||
|
||||
var $opExpr = '\'' + $opStr + '\''; /*used in error*/
|
||||
}}
|
||||
|
||||
if ({{# def.$dataNotType:'number' }}
|
||||
{{=$data}} {{=$notOp}} {{=$schemaValue}}
|
||||
|| {{=$data}} !== {{=$data}}) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{ $errorKeyword = $errorKeyword || $keyword; }}
|
||||
{{# def.error:'_limit' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
12
Lab2/node_modules/.ajv-h16f30rR/lib/dot/_limitItems.jst
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{# def.numberKeyword }}
|
||||
|
||||
{{ var $op = $keyword == 'maxItems' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} {{=$data}}.length {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_limitItems' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
12
Lab2/node_modules/.ajv-h16f30rR/lib/dot/_limitLength.jst
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{# def.numberKeyword }}
|
||||
|
||||
{{ var $op = $keyword == 'maxLength' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} {{# def.strLength }} {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_limitLength' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
12
Lab2/node_modules/.ajv-h16f30rR/lib/dot/_limitProperties.jst
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{# def.numberKeyword }}
|
||||
|
||||
{{ var $op = $keyword == 'maxProperties' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} Object.keys({{=$data}}).length {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_limitProperties' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
32
Lab2/node_modules/.ajv-h16f30rR/lib/dot/allOf.jst
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{
|
||||
var $currentBaseId = $it.baseId
|
||||
, $allSchemasEmpty = true;
|
||||
}}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{
|
||||
$allSchemasEmpty = false;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{? $allSchemasEmpty }}
|
||||
if (true) {
|
||||
{{??}}
|
||||
{{= $closingBraces.slice(0,-1) }}
|
||||
{{?}}
|
||||
{{?}}
|
46
Lab2/node_modules/.ajv-h16f30rR/lib/dot/anyOf.jst
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{
|
||||
var $noEmptySchema = $schema.every(function($sch) {
|
||||
return {{# def.nonEmptySchema:$sch }};
|
||||
});
|
||||
}}
|
||||
{{? $noEmptySchema }}
|
||||
{{ var $currentBaseId = $it.baseId; }}
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}} = false;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
|
||||
{{=$valid}} = {{=$valid}} || {{=$nextValid}};
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{~}}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.extraError:'anyOf' }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if (true) {
|
||||
{{?}}
|
||||
{{?}}
|
51
Lab2/node_modules/.ajv-h16f30rR/lib/dot/coerce.def
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
{{## def.coerceType:
|
||||
{{
|
||||
var $dataType = 'dataType' + $lvl
|
||||
, $coerced = 'coerced' + $lvl;
|
||||
}}
|
||||
var {{=$dataType}} = typeof {{=$data}};
|
||||
var {{=$coerced}} = undefined;
|
||||
|
||||
{{? it.opts.coerceTypes == 'array' }}
|
||||
if ({{=$dataType}} == 'object' && Array.isArray({{=$data}}) && {{=$data}}.length == 1) {
|
||||
{{=$data}} = {{=$data}}[0];
|
||||
{{=$dataType}} = typeof {{=$data}};
|
||||
if ({{=it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)}}) {{=$coerced}} = {{=$data}};
|
||||
}
|
||||
{{?}}
|
||||
|
||||
if ({{=$coerced}} !== undefined) ;
|
||||
{{~ $coerceToTypes:$type:$i }}
|
||||
{{? $type == 'string' }}
|
||||
else if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean')
|
||||
{{=$coerced}} = '' + {{=$data}};
|
||||
else if ({{=$data}} === null) {{=$coerced}} = '';
|
||||
{{?? $type == 'number' || $type == 'integer' }}
|
||||
else if ({{=$dataType}} == 'boolean' || {{=$data}} === null
|
||||
|| ({{=$dataType}} == 'string' && {{=$data}} && {{=$data}} == +{{=$data}}
|
||||
{{? $type == 'integer' }} && !({{=$data}} % 1){{?}}))
|
||||
{{=$coerced}} = +{{=$data}};
|
||||
{{?? $type == 'boolean' }}
|
||||
else if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null)
|
||||
{{=$coerced}} = false;
|
||||
else if ({{=$data}} === 'true' || {{=$data}} === 1)
|
||||
{{=$coerced}} = true;
|
||||
{{?? $type == 'null' }}
|
||||
else if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false)
|
||||
{{=$coerced}} = null;
|
||||
{{?? it.opts.coerceTypes == 'array' && $type == 'array' }}
|
||||
else if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null)
|
||||
{{=$coerced}} = [{{=$data}}];
|
||||
{{?}}
|
||||
{{~}}
|
||||
else {
|
||||
{{# def.error:'type' }}
|
||||
}
|
||||
|
||||
if ({{=$coerced}} !== undefined) {
|
||||
{{# def.setParentData }}
|
||||
{{=$data}} = {{=$coerced}};
|
||||
{{? !$dataLvl }}if ({{=$parentData}} !== undefined){{?}}
|
||||
{{=$parentData}}[{{=$parentDataProperty}}] = {{=$coerced}};
|
||||
}
|
||||
#}}
|
9
Lab2/node_modules/.ajv-h16f30rR/lib/dot/comment.jst
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{ var $comment = it.util.toQuotedString($schema); }}
|
||||
{{? it.opts.$comment === true }}
|
||||
console.log({{=$comment}});
|
||||
{{?? typeof it.opts.$comment == 'function' }}
|
||||
self._opts.$comment({{=$comment}}, {{=it.util.toQuotedString($errSchemaPath)}}, validate.root.schema);
|
||||
{{?}}
|
11
Lab2/node_modules/.ajv-h16f30rR/lib/dot/const.jst
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{? !$isData }}
|
||||
var schema{{=$lvl}} = validate.schema{{=$schemaPath}};
|
||||
{{?}}
|
||||
var {{=$valid}} = equal({{=$data}}, schema{{=$lvl}});
|
||||
{{# def.checkError:'const' }}
|
||||
{{? $breakOnError }} else { {{?}}
|
55
Lab2/node_modules/.ajv-h16f30rR/lib/dot/contains.jst
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{
|
||||
var $idx = 'i' + $lvl
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $currentBaseId = it.baseId
|
||||
, $nonEmptySchema = {{# def.nonEmptySchema:$schema }};
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}};
|
||||
|
||||
{{? $nonEmptySchema }}
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
|
||||
var {{=$nextValid}} = false;
|
||||
|
||||
for (var {{=$idx}} = 0; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) {
|
||||
{{
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
|
||||
if ({{=$nextValid}}) break;
|
||||
}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$nextValid}}) {
|
||||
{{??}}
|
||||
if ({{=$data}}.length == 0) {
|
||||
{{?}}
|
||||
|
||||
{{# def.error:'contains' }}
|
||||
} else {
|
||||
{{? $nonEmptySchema }}
|
||||
{{# def.resetErrors }}
|
||||
{{?}}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
191
Lab2/node_modules/.ajv-h16f30rR/lib/dot/custom.jst
generated
vendored
Normal file
@ -0,0 +1,191 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $rule = this
|
||||
, $definition = 'definition' + $lvl
|
||||
, $rDef = $rule.definition
|
||||
, $closingBraces = '';
|
||||
var $validate = $rDef.validate;
|
||||
var $compile, $inline, $macro, $ruleValidate, $validateCode;
|
||||
}}
|
||||
|
||||
{{? $isData && $rDef.$data }}
|
||||
{{
|
||||
$validateCode = 'keywordValidate' + $lvl;
|
||||
var $validateSchema = $rDef.validateSchema;
|
||||
}}
|
||||
var {{=$definition}} = RULES.custom['{{=$keyword}}'].definition;
|
||||
var {{=$validateCode}} = {{=$definition}}.validate;
|
||||
{{??}}
|
||||
{{
|
||||
$ruleValidate = it.useCustomRule($rule, $schema, it.schema, it);
|
||||
if (!$ruleValidate) return;
|
||||
$schemaValue = 'validate.schema' + $schemaPath;
|
||||
$validateCode = $ruleValidate.code;
|
||||
$compile = $rDef.compile;
|
||||
$inline = $rDef.inline;
|
||||
$macro = $rDef.macro;
|
||||
}}
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
var $ruleErrs = $validateCode + '.errors'
|
||||
, $i = 'i' + $lvl
|
||||
, $ruleErr = 'ruleErr' + $lvl
|
||||
, $asyncKeyword = $rDef.async;
|
||||
|
||||
if ($asyncKeyword && !it.async)
|
||||
throw new Error('async keyword in sync schema');
|
||||
}}
|
||||
|
||||
|
||||
{{? !($inline || $macro) }}{{=$ruleErrs}} = null;{{?}}
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}};
|
||||
|
||||
{{## def.callRuleValidate:
|
||||
{{=$validateCode}}.call(
|
||||
{{? it.opts.passContext }}this{{??}}self{{?}}
|
||||
{{? $compile || $rDef.schema === false }}
|
||||
, {{=$data}}
|
||||
{{??}}
|
||||
, {{=$schemaValue}}
|
||||
, {{=$data}}
|
||||
, validate.schema{{=it.schemaPath}}
|
||||
{{?}}
|
||||
, {{# def.dataPath }}
|
||||
{{# def.passParentData }}
|
||||
, rootData
|
||||
)
|
||||
#}}
|
||||
|
||||
{{## def.extendErrors:_inline:
|
||||
for (var {{=$i}}={{=$errs}}; {{=$i}}<errors; {{=$i}}++) {
|
||||
var {{=$ruleErr}} = vErrors[{{=$i}}];
|
||||
if ({{=$ruleErr}}.dataPath === undefined)
|
||||
{{=$ruleErr}}.dataPath = (dataPath || '') + {{= it.errorPath }};
|
||||
{{# _inline ? 'if (\{\{=$ruleErr\}\}.schemaPath === undefined) {' : '' }}
|
||||
{{=$ruleErr}}.schemaPath = "{{=$errSchemaPath}}";
|
||||
{{# _inline ? '}' : '' }}
|
||||
{{? it.opts.verbose }}
|
||||
{{=$ruleErr}}.schema = {{=$schemaValue}};
|
||||
{{=$ruleErr}}.data = {{=$data}};
|
||||
{{?}}
|
||||
}
|
||||
#}}
|
||||
|
||||
|
||||
{{? $isData && $rDef.$data }}
|
||||
{{ $closingBraces += '}'; }}
|
||||
if ({{=$schemaValue}} === undefined) {
|
||||
{{=$valid}} = true;
|
||||
} else {
|
||||
{{? $validateSchema }}
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{=$valid}} = {{=$definition}}.validateSchema({{=$schemaValue}});
|
||||
if ({{=$valid}}) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $inline }}
|
||||
{{? $rDef.statements }}
|
||||
{{= $ruleValidate.validate }}
|
||||
{{??}}
|
||||
{{=$valid}} = {{= $ruleValidate.validate }};
|
||||
{{?}}
|
||||
{{?? $macro }}
|
||||
{{# def.setupNextLevel }}
|
||||
{{
|
||||
$it.schema = $ruleValidate.validate;
|
||||
$it.schemaPath = '';
|
||||
}}
|
||||
{{# def.setCompositeRule }}
|
||||
{{ var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); }}
|
||||
{{# def.resetCompositeRule }}
|
||||
{{= $code }}
|
||||
{{??}}
|
||||
{{# def.beginDefOut}}
|
||||
{{# def.callRuleValidate }}
|
||||
{{# def.storeDefOut:def_callRuleValidate }}
|
||||
|
||||
{{? $rDef.errors === false }}
|
||||
{{=$valid}} = {{? $asyncKeyword }}await {{?}}{{= def_callRuleValidate }};
|
||||
{{??}}
|
||||
{{? $asyncKeyword }}
|
||||
{{ $ruleErrs = 'customErrors' + $lvl; }}
|
||||
var {{=$ruleErrs}} = null;
|
||||
try {
|
||||
{{=$valid}} = await {{= def_callRuleValidate }};
|
||||
} catch (e) {
|
||||
{{=$valid}} = false;
|
||||
if (e instanceof ValidationError) {{=$ruleErrs}} = e.errors;
|
||||
else throw e;
|
||||
}
|
||||
{{??}}
|
||||
{{=$ruleErrs}} = null;
|
||||
{{=$valid}} = {{= def_callRuleValidate }};
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $rDef.modifying }}
|
||||
if ({{=$parentData}}) {{=$data}} = {{=$parentData}}[{{=$parentDataProperty}}];
|
||||
{{?}}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
{{## def.notValidationResult:
|
||||
{{? $rDef.valid === undefined }}
|
||||
!{{? $macro }}{{=$nextValid}}{{??}}{{=$valid}}{{?}}
|
||||
{{??}}
|
||||
{{= !$rDef.valid }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
{{? $rDef.valid }}
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{??}}
|
||||
if ({{# def.notValidationResult }}) {
|
||||
{{ $errorKeyword = $rule.keyword; }}
|
||||
{{# def.beginDefOut}}
|
||||
{{# def.error:'custom' }}
|
||||
{{# def.storeDefOut:def_customError }}
|
||||
|
||||
{{? $inline }}
|
||||
{{? $rDef.errors }}
|
||||
{{? $rDef.errors != 'full' }}
|
||||
{{# def.extendErrors:true }}
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{? $rDef.errors === false}}
|
||||
{{= def_customError }}
|
||||
{{??}}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{= def_customError }}
|
||||
} else {
|
||||
{{# def.extendErrors:true }}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{?? $macro }}
|
||||
{{# def.extraError:'custom' }}
|
||||
{{??}}
|
||||
{{? $rDef.errors === false}}
|
||||
{{= def_customError }}
|
||||
{{??}}
|
||||
if (Array.isArray({{=$ruleErrs}})) {
|
||||
if (vErrors === null) vErrors = {{=$ruleErrs}};
|
||||
else vErrors = vErrors.concat({{=$ruleErrs}});
|
||||
errors = vErrors.length;
|
||||
{{# def.extendErrors:false }}
|
||||
} else {
|
||||
{{= def_customError }}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
{{?}}
|
47
Lab2/node_modules/.ajv-h16f30rR/lib/dot/defaults.def
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
{{## def.assignDefault:
|
||||
{{? it.compositeRule }}
|
||||
{{
|
||||
if (it.opts.strictDefaults) {
|
||||
var $defaultMsg = 'default is ignored for: ' + $passData;
|
||||
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
|
||||
else throw new Error($defaultMsg);
|
||||
}
|
||||
}}
|
||||
{{??}}
|
||||
if ({{=$passData}} === undefined
|
||||
{{? it.opts.useDefaults == 'empty' }}
|
||||
|| {{=$passData}} === null
|
||||
|| {{=$passData}} === ''
|
||||
{{?}}
|
||||
)
|
||||
{{=$passData}} = {{? it.opts.useDefaults == 'shared' }}
|
||||
{{= it.useDefault($sch.default) }}
|
||||
{{??}}
|
||||
{{= JSON.stringify($sch.default) }}
|
||||
{{?}};
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.defaultProperties:
|
||||
{{
|
||||
var $schema = it.schema.properties
|
||||
, $schemaKeys = Object.keys($schema); }}
|
||||
{{~ $schemaKeys:$propertyKey }}
|
||||
{{ var $sch = $schema[$propertyKey]; }}
|
||||
{{? $sch.default !== undefined }}
|
||||
{{ var $passData = $data + it.util.getProperty($propertyKey); }}
|
||||
{{# def.assignDefault }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.defaultItems:
|
||||
{{~ it.schema.items:$sch:$i }}
|
||||
{{? $sch.default !== undefined }}
|
||||
{{ var $passData = $data + '[' + $i + ']'; }}
|
||||
{{# def.assignDefault }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
#}}
|
203
Lab2/node_modules/.ajv-h16f30rR/lib/dot/definitions.def
generated
vendored
Normal file
@ -0,0 +1,203 @@
|
||||
{{## def.setupKeyword:
|
||||
{{
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.setCompositeRule:
|
||||
{{
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.resetCompositeRule:
|
||||
{{ it.compositeRule = $it.compositeRule = $wasComposite; }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.setupNextLevel:
|
||||
{{
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.ifValid:
|
||||
{{? $breakOnError }}
|
||||
if ({{=$valid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.ifResultValid:
|
||||
{{? $breakOnError }}
|
||||
if ({{=$nextValid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.elseIfValid:
|
||||
{{? $breakOnError }}
|
||||
{{ $closingBraces += '}'; }}
|
||||
else {
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.nonEmptySchema:_schema:
|
||||
(it.opts.strictKeywords
|
||||
? (typeof _schema == 'object' && Object.keys(_schema).length > 0)
|
||||
|| _schema === false
|
||||
: it.util.schemaHasRules(_schema, it.RULES.all))
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.strLength:
|
||||
{{? it.opts.unicode === false }}
|
||||
{{=$data}}.length
|
||||
{{??}}
|
||||
ucs2length({{=$data}})
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.willOptimize:
|
||||
it.util.varOccurences($code, $nextData) < 2
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.generateSubschemaCode:
|
||||
{{
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.insertSubschemaCode:
|
||||
{{= it.validate($it) }}
|
||||
{{ $it.baseId = $currentBaseId; }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def._optimizeValidate:
|
||||
it.util.varReplace($code, $nextData, $passData)
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.optimizeValidate:
|
||||
{{? {{# def.willOptimize}} }}
|
||||
{{= {{# def._optimizeValidate }} }}
|
||||
{{??}}
|
||||
var {{=$nextData}} = {{=$passData}};
|
||||
{{= $code }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.$data:
|
||||
{{
|
||||
var $isData = it.opts.$data && $schema && $schema.$data
|
||||
, $schemaValue;
|
||||
}}
|
||||
{{? $isData }}
|
||||
var schema{{=$lvl}} = {{= it.util.getData($schema.$data, $dataLvl, it.dataPathArr) }};
|
||||
{{ $schemaValue = 'schema' + $lvl; }}
|
||||
{{??}}
|
||||
{{ $schemaValue = $schema; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.$dataNotType:_type:
|
||||
{{?$isData}} ({{=$schemaValue}} !== undefined && typeof {{=$schemaValue}} != _type) || {{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.check$dataIsArray:
|
||||
if (schema{{=$lvl}} === undefined) {{=$valid}} = true;
|
||||
else if (!Array.isArray(schema{{=$lvl}})) {{=$valid}} = false;
|
||||
else {
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.numberKeyword:
|
||||
{{? !($isData || typeof $schema == 'number') }}
|
||||
{{ throw new Error($keyword + ' must be number'); }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.beginDefOut:
|
||||
{{
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = '';
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.storeDefOut:_variable:
|
||||
{{
|
||||
var _variable = out;
|
||||
out = $$outStack.pop();
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.dataPath:(dataPath || ''){{? it.errorPath != '""'}} + {{= it.errorPath }}{{?}}#}}
|
||||
|
||||
{{## def.setParentData:
|
||||
{{
|
||||
var $parentData = $dataLvl ? 'data' + (($dataLvl-1)||'') : 'parentData'
|
||||
, $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
|
||||
}}
|
||||
#}}
|
||||
|
||||
{{## def.passParentData:
|
||||
{{# def.setParentData }}
|
||||
, {{= $parentData }}
|
||||
, {{= $parentDataProperty }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.iterateProperties:
|
||||
{{? $ownProperties }}
|
||||
{{=$dataProperties}} = {{=$dataProperties}} || Object.keys({{=$data}});
|
||||
for (var {{=$idx}}=0; {{=$idx}}<{{=$dataProperties}}.length; {{=$idx}}++) {
|
||||
var {{=$key}} = {{=$dataProperties}}[{{=$idx}}];
|
||||
{{??}}
|
||||
for (var {{=$key}} in {{=$data}}) {
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.noPropertyInData:
|
||||
{{=$useData}} === undefined
|
||||
{{? $ownProperties }}
|
||||
|| !{{# def.isOwnProperty }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.isOwnProperty:
|
||||
Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($propertyKey)}}')
|
||||
#}}
|
79
Lab2/node_modules/.ajv-h16f30rR/lib/dot/dependencies.jst
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.missing }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.propertyInData:
|
||||
{{=$data}}{{= it.util.getProperty($property) }} !== undefined
|
||||
{{? $ownProperties }}
|
||||
&& Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($property)}}')
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $schemaDeps = {}
|
||||
, $propertyDeps = {}
|
||||
, $ownProperties = it.opts.ownProperties;
|
||||
|
||||
for ($property in $schema) {
|
||||
if ($property == '__proto__') continue;
|
||||
var $sch = $schema[$property];
|
||||
var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
|
||||
$deps[$property] = $sch;
|
||||
}
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
|
||||
{{ var $currentErrorPath = it.errorPath; }}
|
||||
|
||||
var missing{{=$lvl}};
|
||||
{{ for (var $property in $propertyDeps) { }}
|
||||
{{ $deps = $propertyDeps[$property]; }}
|
||||
{{? $deps.length }}
|
||||
if ({{# def.propertyInData }}
|
||||
{{? $breakOnError }}
|
||||
&& ({{# def.checkMissingProperty:$deps }})) {
|
||||
{{# def.errorMissingProperty:'dependencies' }}
|
||||
{{??}}
|
||||
) {
|
||||
{{~ $deps:$propertyKey }}
|
||||
{{# def.allErrorsMissingProperty:'dependencies' }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
} {{# def.elseIfValid }}
|
||||
{{?}}
|
||||
{{ } }}
|
||||
|
||||
{{
|
||||
it.errorPath = $currentErrorPath;
|
||||
var $currentBaseId = $it.baseId;
|
||||
}}
|
||||
|
||||
|
||||
{{ for (var $property in $schemaDeps) { }}
|
||||
{{ var $sch = $schemaDeps[$property]; }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{# def.propertyInData }}) {
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + it.util.getProperty($property);
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
{{ } }}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
30
Lab2/node_modules/.ajv-h16f30rR/lib/dot/enum.jst
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $i = 'i' + $lvl
|
||||
, $vSchema = 'schema' + $lvl;
|
||||
}}
|
||||
|
||||
{{? !$isData }}
|
||||
var {{=$vSchema}} = validate.schema{{=$schemaPath}};
|
||||
{{?}}
|
||||
var {{=$valid}};
|
||||
|
||||
{{?$isData}}{{# def.check$dataIsArray }}{{?}}
|
||||
|
||||
{{=$valid}} = false;
|
||||
|
||||
for (var {{=$i}}=0; {{=$i}}<{{=$vSchema}}.length; {{=$i}}++)
|
||||
if (equal({{=$data}}, {{=$vSchema}}[{{=$i}}])) {
|
||||
{{=$valid}} = true;
|
||||
break;
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
|
||||
{{# def.checkError:'enum' }}
|
||||
|
||||
{{? $breakOnError }} else { {{?}}
|
194
Lab2/node_modules/.ajv-h16f30rR/lib/dot/errors.def
generated
vendored
Normal file
@ -0,0 +1,194 @@
|
||||
{{# def.definitions }}
|
||||
|
||||
{{## def._error:_rule:
|
||||
{{ 'istanbul ignore else'; }}
|
||||
{{? it.createErrors !== false }}
|
||||
{
|
||||
keyword: '{{= $errorKeyword || _rule }}'
|
||||
, dataPath: (dataPath || '') + {{= it.errorPath }}
|
||||
, schemaPath: {{=it.util.toQuotedString($errSchemaPath)}}
|
||||
, params: {{# def._errorParams[_rule] }}
|
||||
{{? it.opts.messages !== false }}
|
||||
, message: {{# def._errorMessages[_rule] }}
|
||||
{{?}}
|
||||
{{? it.opts.verbose }}
|
||||
, schema: {{# def._errorSchemas[_rule] }}
|
||||
, parentSchema: validate.schema{{=it.schemaPath}}
|
||||
, data: {{=$data}}
|
||||
{{?}}
|
||||
}
|
||||
{{??}}
|
||||
{}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def._addError:_rule:
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.addError:_rule:
|
||||
var err = {{# def._error:_rule }};
|
||||
{{# def._addError:_rule }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.error:_rule:
|
||||
{{# def.beginDefOut}}
|
||||
{{# def._error:_rule }}
|
||||
{{# def.storeDefOut:__err }}
|
||||
|
||||
{{? !it.compositeRule && $breakOnError }}
|
||||
{{ 'istanbul ignore if'; }}
|
||||
{{? it.async }}
|
||||
throw new ValidationError([{{=__err}}]);
|
||||
{{??}}
|
||||
validate.errors = [{{=__err}}];
|
||||
return false;
|
||||
{{?}}
|
||||
{{??}}
|
||||
var err = {{=__err}};
|
||||
{{# def._addError:_rule }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.extraError:_rule:
|
||||
{{# def.addError:_rule}}
|
||||
{{? !it.compositeRule && $breakOnError }}
|
||||
{{ 'istanbul ignore if'; }}
|
||||
{{? it.async }}
|
||||
throw new ValidationError(vErrors);
|
||||
{{??}}
|
||||
validate.errors = vErrors;
|
||||
return false;
|
||||
{{?}}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.checkError:_rule:
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.error:_rule }}
|
||||
}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.resetErrors:
|
||||
errors = {{=$errs}};
|
||||
if (vErrors !== null) {
|
||||
if ({{=$errs}}) vErrors.length = {{=$errs}};
|
||||
else vErrors = null;
|
||||
}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.concatSchema:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=$schema}}{{?}}#}}
|
||||
{{## def.appendSchema:{{?$isData}}' + {{=$schemaValue}}{{??}}{{=$schemaValue}}'{{?}}#}}
|
||||
{{## def.concatSchemaEQ:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=it.util.escapeQuotes($schema)}}{{?}}#}}
|
||||
|
||||
{{## def._errorMessages = {
|
||||
'false schema': "'boolean schema is false'",
|
||||
$ref: "'can\\\'t resolve reference {{=it.util.escapeQuotes($schema)}}'",
|
||||
additionalItems: "'should NOT have more than {{=$schema.length}} items'",
|
||||
additionalProperties: "'{{? it.opts._errorDataPathProperty }}is an invalid additional property{{??}}should NOT have additional properties{{?}}'",
|
||||
anyOf: "'should match some schema in anyOf'",
|
||||
const: "'should be equal to constant'",
|
||||
contains: "'should contain a valid item'",
|
||||
dependencies: "'should have {{? $deps.length == 1 }}property {{= it.util.escapeQuotes($deps[0]) }}{{??}}properties {{= it.util.escapeQuotes($deps.join(\", \")) }}{{?}} when property {{= it.util.escapeQuotes($property) }} is present'",
|
||||
'enum': "'should be equal to one of the allowed values'",
|
||||
format: "'should match format \"{{#def.concatSchemaEQ}}\"'",
|
||||
'if': "'should match \"' + {{=$ifClause}} + '\" schema'",
|
||||
_limit: "'should be {{=$opStr}} {{#def.appendSchema}}",
|
||||
_exclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'",
|
||||
_limitItems: "'should NOT have {{?$keyword=='maxItems'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} items'",
|
||||
_limitLength: "'should NOT be {{?$keyword=='maxLength'}}longer{{??}}shorter{{?}} than {{#def.concatSchema}} characters'",
|
||||
_limitProperties:"'should NOT have {{?$keyword=='maxProperties'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} properties'",
|
||||
multipleOf: "'should be multiple of {{#def.appendSchema}}",
|
||||
not: "'should NOT be valid'",
|
||||
oneOf: "'should match exactly one schema in oneOf'",
|
||||
pattern: "'should match pattern \"{{#def.concatSchemaEQ}}\"'",
|
||||
propertyNames: "'property name \\'{{=$invalidName}}\\' is invalid'",
|
||||
required: "'{{? it.opts._errorDataPathProperty }}is a required property{{??}}should have required property \\'{{=$missingProperty}}\\'{{?}}'",
|
||||
type: "'should be {{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}'",
|
||||
uniqueItems: "'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)'",
|
||||
custom: "'should pass \"{{=$rule.keyword}}\" keyword validation'",
|
||||
patternRequired: "'should have property matching pattern \\'{{=$missingPattern}}\\''",
|
||||
switch: "'should pass \"switch\" keyword validation'",
|
||||
_formatLimit: "'should be {{=$opStr}} \"{{#def.concatSchemaEQ}}\"'",
|
||||
_formatExclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'"
|
||||
} #}}
|
||||
|
||||
|
||||
{{## def.schemaRefOrVal: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=$schema}}{{?}} #}}
|
||||
{{## def.schemaRefOrQS: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}}
|
||||
|
||||
{{## def._errorSchemas = {
|
||||
'false schema': "false",
|
||||
$ref: "{{=it.util.toQuotedString($schema)}}",
|
||||
additionalItems: "false",
|
||||
additionalProperties: "false",
|
||||
anyOf: "validate.schema{{=$schemaPath}}",
|
||||
const: "validate.schema{{=$schemaPath}}",
|
||||
contains: "validate.schema{{=$schemaPath}}",
|
||||
dependencies: "validate.schema{{=$schemaPath}}",
|
||||
'enum': "validate.schema{{=$schemaPath}}",
|
||||
format: "{{#def.schemaRefOrQS}}",
|
||||
'if': "validate.schema{{=$schemaPath}}",
|
||||
_limit: "{{#def.schemaRefOrVal}}",
|
||||
_exclusiveLimit: "validate.schema{{=$schemaPath}}",
|
||||
_limitItems: "{{#def.schemaRefOrVal}}",
|
||||
_limitLength: "{{#def.schemaRefOrVal}}",
|
||||
_limitProperties:"{{#def.schemaRefOrVal}}",
|
||||
multipleOf: "{{#def.schemaRefOrVal}}",
|
||||
not: "validate.schema{{=$schemaPath}}",
|
||||
oneOf: "validate.schema{{=$schemaPath}}",
|
||||
pattern: "{{#def.schemaRefOrQS}}",
|
||||
propertyNames: "validate.schema{{=$schemaPath}}",
|
||||
required: "validate.schema{{=$schemaPath}}",
|
||||
type: "validate.schema{{=$schemaPath}}",
|
||||
uniqueItems: "{{#def.schemaRefOrVal}}",
|
||||
custom: "validate.schema{{=$schemaPath}}",
|
||||
patternRequired: "validate.schema{{=$schemaPath}}",
|
||||
switch: "validate.schema{{=$schemaPath}}",
|
||||
_formatLimit: "{{#def.schemaRefOrQS}}",
|
||||
_formatExclusiveLimit: "validate.schema{{=$schemaPath}}"
|
||||
} #}}
|
||||
|
||||
|
||||
{{## def.schemaValueQS: {{?$isData}}{{=$schemaValue}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}}
|
||||
|
||||
{{## def._errorParams = {
|
||||
'false schema': "{}",
|
||||
$ref: "{ ref: '{{=it.util.escapeQuotes($schema)}}' }",
|
||||
additionalItems: "{ limit: {{=$schema.length}} }",
|
||||
additionalProperties: "{ additionalProperty: '{{=$additionalProperty}}' }",
|
||||
anyOf: "{}",
|
||||
const: "{ allowedValue: schema{{=$lvl}} }",
|
||||
contains: "{}",
|
||||
dependencies: "{ property: '{{= it.util.escapeQuotes($property) }}', missingProperty: '{{=$missingProperty}}', depsCount: {{=$deps.length}}, deps: '{{= it.util.escapeQuotes($deps.length==1 ? $deps[0] : $deps.join(\", \")) }}' }",
|
||||
'enum': "{ allowedValues: schema{{=$lvl}} }",
|
||||
format: "{ format: {{#def.schemaValueQS}} }",
|
||||
'if': "{ failingKeyword: {{=$ifClause}} }",
|
||||
_limit: "{ comparison: {{=$opExpr}}, limit: {{=$schemaValue}}, exclusive: {{=$exclusive}} }",
|
||||
_exclusiveLimit: "{}",
|
||||
_limitItems: "{ limit: {{=$schemaValue}} }",
|
||||
_limitLength: "{ limit: {{=$schemaValue}} }",
|
||||
_limitProperties:"{ limit: {{=$schemaValue}} }",
|
||||
multipleOf: "{ multipleOf: {{=$schemaValue}} }",
|
||||
not: "{}",
|
||||
oneOf: "{ passingSchemas: {{=$passingSchemas}} }",
|
||||
pattern: "{ pattern: {{#def.schemaValueQS}} }",
|
||||
propertyNames: "{ propertyName: '{{=$invalidName}}' }",
|
||||
required: "{ missingProperty: '{{=$missingProperty}}' }",
|
||||
type: "{ type: '{{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}' }",
|
||||
uniqueItems: "{ i: i, j: j }",
|
||||
custom: "{ keyword: '{{=$rule.keyword}}' }",
|
||||
patternRequired: "{ missingPattern: '{{=$missingPattern}}' }",
|
||||
switch: "{ caseIndex: {{=$caseIndex}} }",
|
||||
_formatLimit: "{ comparison: {{=$opExpr}}, limit: {{#def.schemaValueQS}}, exclusive: {{=$exclusive}} }",
|
||||
_formatExclusiveLimit: "{}"
|
||||
} #}}
|
106
Lab2/node_modules/.ajv-h16f30rR/lib/dot/format.jst
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{## def.skipFormat:
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{ return out; }}
|
||||
#}}
|
||||
|
||||
{{? it.opts.format === false }}{{# def.skipFormat }}{{?}}
|
||||
|
||||
|
||||
{{# def.$data }}
|
||||
|
||||
|
||||
{{## def.$dataCheckFormat:
|
||||
{{# def.$dataNotType:'string' }}
|
||||
({{? $unknownFormats != 'ignore' }}
|
||||
({{=$schemaValue}} && !{{=$format}}
|
||||
{{? $allowUnknown }}
|
||||
&& self._opts.unknownFormats.indexOf({{=$schemaValue}}) == -1
|
||||
{{?}}) ||
|
||||
{{?}}
|
||||
({{=$format}} && {{=$formatType}} == '{{=$ruleType}}'
|
||||
&& !(typeof {{=$format}} == 'function'
|
||||
? {{? it.async}}
|
||||
(async{{=$lvl}} ? await {{=$format}}({{=$data}}) : {{=$format}}({{=$data}}))
|
||||
{{??}}
|
||||
{{=$format}}({{=$data}})
|
||||
{{?}}
|
||||
: {{=$format}}.test({{=$data}}))))
|
||||
#}}
|
||||
|
||||
{{## def.checkFormat:
|
||||
{{
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema);
|
||||
if ($isObject) $formatRef += '.validate';
|
||||
}}
|
||||
{{? typeof $format == 'function' }}
|
||||
{{=$formatRef}}({{=$data}})
|
||||
{{??}}
|
||||
{{=$formatRef}}.test({{=$data}})
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $unknownFormats = it.opts.unknownFormats
|
||||
, $allowUnknown = Array.isArray($unknownFormats);
|
||||
}}
|
||||
|
||||
{{? $isData }}
|
||||
{{
|
||||
var $format = 'format' + $lvl
|
||||
, $isObject = 'isObject' + $lvl
|
||||
, $formatType = 'formatType' + $lvl;
|
||||
}}
|
||||
var {{=$format}} = formats[{{=$schemaValue}}];
|
||||
var {{=$isObject}} = typeof {{=$format}} == 'object'
|
||||
&& !({{=$format}} instanceof RegExp)
|
||||
&& {{=$format}}.validate;
|
||||
var {{=$formatType}} = {{=$isObject}} && {{=$format}}.type || 'string';
|
||||
if ({{=$isObject}}) {
|
||||
{{? it.async}}
|
||||
var async{{=$lvl}} = {{=$format}}.async;
|
||||
{{?}}
|
||||
{{=$format}} = {{=$format}}.validate;
|
||||
}
|
||||
if ({{# def.$dataCheckFormat }}) {
|
||||
{{??}}
|
||||
{{ var $format = it.formats[$schema]; }}
|
||||
{{? !$format }}
|
||||
{{? $unknownFormats == 'ignore' }}
|
||||
{{ it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); }}
|
||||
{{# def.skipFormat }}
|
||||
{{?? $allowUnknown && $unknownFormats.indexOf($schema) >= 0 }}
|
||||
{{# def.skipFormat }}
|
||||
{{??}}
|
||||
{{ throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{
|
||||
var $isObject = typeof $format == 'object'
|
||||
&& !($format instanceof RegExp)
|
||||
&& $format.validate;
|
||||
var $formatType = $isObject && $format.type || 'string';
|
||||
if ($isObject) {
|
||||
var $async = $format.async === true;
|
||||
$format = $format.validate;
|
||||
}
|
||||
}}
|
||||
{{? $formatType != $ruleType }}
|
||||
{{# def.skipFormat }}
|
||||
{{?}}
|
||||
{{? $async }}
|
||||
{{
|
||||
if (!it.async) throw new Error('async format in sync schema');
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate';
|
||||
}}
|
||||
if (!(await {{=$formatRef}}({{=$data}}))) {
|
||||
{{??}}
|
||||
if (!{{# def.checkFormat }}) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{# def.error:'format' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
73
Lab2/node_modules/.ajv-h16f30rR/lib/dot/if.jst
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateIfClause:_clause:
|
||||
{{
|
||||
$it.schema = it.schema['_clause'];
|
||||
$it.schemaPath = it.schemaPath + '._clause';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/_clause';
|
||||
}}
|
||||
{{# def.insertSubschemaCode }}
|
||||
{{=$valid}} = {{=$nextValid}};
|
||||
{{? $thenPresent && $elsePresent }}
|
||||
{{ $ifClause = 'ifClause' + $lvl; }}
|
||||
var {{=$ifClause}} = '_clause';
|
||||
{{??}}
|
||||
{{ $ifClause = '\'_clause\''; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
{{
|
||||
var $thenSch = it.schema['then']
|
||||
, $elseSch = it.schema['else']
|
||||
, $thenPresent = $thenSch !== undefined && {{# def.nonEmptySchema:$thenSch }}
|
||||
, $elsePresent = $elseSch !== undefined && {{# def.nonEmptySchema:$elseSch }}
|
||||
, $currentBaseId = $it.baseId;
|
||||
}}
|
||||
|
||||
{{? $thenPresent || $elsePresent }}
|
||||
{{
|
||||
var $ifClause;
|
||||
$it.createErrors = false;
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}} = true;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
{{# def.insertSubschemaCode }}
|
||||
{{ $it.createErrors = true; }}
|
||||
{{# def.resetErrors }}
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
{{? $thenPresent }}
|
||||
if ({{=$nextValid}}) {
|
||||
{{# def.validateIfClause:then }}
|
||||
}
|
||||
{{? $elsePresent }}
|
||||
else {
|
||||
{{?}}
|
||||
{{??}}
|
||||
if (!{{=$nextValid}}) {
|
||||
{{?}}
|
||||
|
||||
{{? $elsePresent }}
|
||||
{{# def.validateIfClause:else }}
|
||||
}
|
||||
{{?}}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.extraError:'if' }}
|
||||
}
|
||||
{{? $breakOnError }} else { {{?}}
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if (true) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
98
Lab2/node_modules/.ajv-h16f30rR/lib/dot/items.jst
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateItems:startFrom:
|
||||
for (var {{=$idx}} = {{=startFrom}}; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) {
|
||||
{{
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
|
||||
{{? $breakOnError }}
|
||||
if (!{{=$nextValid}}) break;
|
||||
{{?}}
|
||||
}
|
||||
#}}
|
||||
|
||||
{{
|
||||
var $idx = 'i' + $lvl
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $currentBaseId = it.baseId;
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}};
|
||||
|
||||
{{? Array.isArray($schema) }}
|
||||
{{ /* 'items' is an array of schemas */}}
|
||||
{{ var $additionalItems = it.schema.additionalItems; }}
|
||||
{{? $additionalItems === false }}
|
||||
{{=$valid}} = {{=$data}}.length <= {{= $schema.length }};
|
||||
{{
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
$errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
}}
|
||||
{{# def.checkError:'additionalItems' }}
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
{{# def.elseIfValid}}
|
||||
{{?}}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{=$data}}.length > {{=$i}}) {
|
||||
{{
|
||||
var $passData = $data + '[' + $i + ']';
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);
|
||||
$it.dataPathArr[$dataNxt] = $i;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
|
||||
{{? typeof $additionalItems == 'object' && {{# def.nonEmptySchema:$additionalItems }} }}
|
||||
{{
|
||||
$it.schema = $additionalItems;
|
||||
$it.schemaPath = it.schemaPath + '.additionalItems';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
}}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{=$data}}.length > {{= $schema.length }}) {
|
||||
{{# def.validateItems: $schema.length }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
|
||||
{{?? {{# def.nonEmptySchema:$schema }} }}
|
||||
{{ /* 'items' is a single schema */}}
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
{{# def.validateItems: 0 }}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
39
Lab2/node_modules/.ajv-h16f30rR/lib/dot/missing.def
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
{{## def.checkMissingProperty:_properties:
|
||||
{{~ _properties:$propertyKey:$i }}
|
||||
{{?$i}} || {{?}}
|
||||
{{
|
||||
var $prop = it.util.getProperty($propertyKey)
|
||||
, $useData = $data + $prop;
|
||||
}}
|
||||
( ({{# def.noPropertyInData }}) && (missing{{=$lvl}} = {{= it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) }}) )
|
||||
{{~}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.errorMissingProperty:_error:
|
||||
{{
|
||||
var $propertyPath = 'missing' + $lvl
|
||||
, $missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.opts.jsonPointers
|
||||
? it.util.getPathExpr($currentErrorPath, $propertyPath, true)
|
||||
: $currentErrorPath + ' + ' + $propertyPath;
|
||||
}
|
||||
}}
|
||||
{{# def.error:_error }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.allErrorsMissingProperty:_error:
|
||||
{{
|
||||
var $prop = it.util.getProperty($propertyKey)
|
||||
, $missingProperty = it.util.escapeQuotes($propertyKey)
|
||||
, $useData = $data + $prop;
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
|
||||
}
|
||||
}}
|
||||
if ({{# def.noPropertyInData }}) {
|
||||
{{# def.addError:_error }}
|
||||
}
|
||||
#}}
|
22
Lab2/node_modules/.ajv-h16f30rR/lib/dot/multipleOf.jst
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{# def.numberKeyword }}
|
||||
|
||||
var division{{=$lvl}};
|
||||
if ({{?$isData}}
|
||||
{{=$schemaValue}} !== undefined && (
|
||||
typeof {{=$schemaValue}} != 'number' ||
|
||||
{{?}}
|
||||
(division{{=$lvl}} = {{=$data}} / {{=$schemaValue}},
|
||||
{{? it.opts.multipleOfPrecision }}
|
||||
Math.abs(Math.round(division{{=$lvl}}) - division{{=$lvl}}) > 1e-{{=it.opts.multipleOfPrecision}}
|
||||
{{??}}
|
||||
division{{=$lvl}} !== parseInt(division{{=$lvl}})
|
||||
{{?}}
|
||||
)
|
||||
{{?$isData}} ) {{?}} ) {
|
||||
{{# def.error:'multipleOf' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
43
Lab2/node_modules/.ajv-h16f30rR/lib/dot/not.jst
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{? {{# def.nonEmptySchema:$schema }} }}
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{
|
||||
$it.createErrors = false;
|
||||
var $allErrorsOption;
|
||||
if ($it.opts.allErrors) {
|
||||
$allErrorsOption = $it.opts.allErrors;
|
||||
$it.opts.allErrors = false;
|
||||
}
|
||||
}}
|
||||
{{= it.validate($it) }}
|
||||
{{
|
||||
$it.createErrors = true;
|
||||
if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;
|
||||
}}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
if ({{=$nextValid}}) {
|
||||
{{# def.error:'not' }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
{{??}}
|
||||
{{# def.addError:'not' }}
|
||||
{{? $breakOnError}}
|
||||
if (false) {
|
||||
{{?}}
|
||||
{{?}}
|
54
Lab2/node_modules/.ajv-h16f30rR/lib/dot/oneOf.jst
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{
|
||||
var $currentBaseId = $it.baseId
|
||||
, $prevValid = 'prevValid' + $lvl
|
||||
, $passingSchemas = 'passingSchemas' + $lvl;
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors
|
||||
, {{=$prevValid}} = false
|
||||
, {{=$valid}} = false
|
||||
, {{=$passingSchemas}} = null;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
{{??}}
|
||||
var {{=$nextValid}} = true;
|
||||
{{?}}
|
||||
|
||||
{{? $i }}
|
||||
if ({{=$nextValid}} && {{=$prevValid}}) {
|
||||
{{=$valid}} = false;
|
||||
{{=$passingSchemas}} = [{{=$passingSchemas}}, {{=$i}}];
|
||||
} else {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
|
||||
if ({{=$nextValid}}) {
|
||||
{{=$valid}} = {{=$prevValid}} = true;
|
||||
{{=$passingSchemas}} = {{=$i}};
|
||||
}
|
||||
{{~}}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.extraError:'oneOf' }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
14
Lab2/node_modules/.ajv-h16f30rR/lib/dot/pattern.jst
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $regexp = $isData
|
||||
? '(new RegExp(' + $schemaValue + '))'
|
||||
: it.usePattern($schema);
|
||||
}}
|
||||
|
||||
if ({{# def.$dataNotType:'string' }} !{{=$regexp}}.test({{=$data}}) ) {
|
||||
{{# def.error:'pattern' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
245
Lab2/node_modules/.ajv-h16f30rR/lib/dot/properties.jst
generated
vendored
Normal file
@ -0,0 +1,245 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateAdditional:
|
||||
{{ /* additionalProperties is schema */
|
||||
$it.schema = $aProperties;
|
||||
$it.schemaPath = it.schemaPath + '.additionalProperties';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
|
||||
$it.errorPath = it.opts._errorDataPathProperty
|
||||
? it.errorPath
|
||||
: it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $key = 'key' + $lvl
|
||||
, $idx = 'idx' + $lvl
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $dataProperties = 'dataProperties' + $lvl;
|
||||
|
||||
var $schemaKeys = Object.keys($schema || {}).filter(notProto)
|
||||
, $pProperties = it.schema.patternProperties || {}
|
||||
, $pPropertyKeys = Object.keys($pProperties).filter(notProto)
|
||||
, $aProperties = it.schema.additionalProperties
|
||||
, $someProperties = $schemaKeys.length || $pPropertyKeys.length
|
||||
, $noAdditional = $aProperties === false
|
||||
, $additionalIsSchema = typeof $aProperties == 'object'
|
||||
&& Object.keys($aProperties).length
|
||||
, $removeAdditional = it.opts.removeAdditional
|
||||
, $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional
|
||||
, $ownProperties = it.opts.ownProperties
|
||||
, $currentBaseId = it.baseId;
|
||||
|
||||
var $required = it.schema.required;
|
||||
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
|
||||
var $requiredHash = it.util.toHash($required);
|
||||
}
|
||||
|
||||
function notProto(p) { return p !== '__proto__'; }
|
||||
}}
|
||||
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$nextValid}} = true;
|
||||
{{? $ownProperties }}
|
||||
var {{=$dataProperties}} = undefined;
|
||||
{{?}}
|
||||
|
||||
{{? $checkAdditional }}
|
||||
{{# def.iterateProperties }}
|
||||
{{? $someProperties }}
|
||||
var isAdditional{{=$lvl}} = !(false
|
||||
{{? $schemaKeys.length }}
|
||||
{{? $schemaKeys.length > 8 }}
|
||||
|| validate.schema{{=$schemaPath}}.hasOwnProperty({{=$key}})
|
||||
{{??}}
|
||||
{{~ $schemaKeys:$propertyKey }}
|
||||
|| {{=$key}} == {{= it.util.toQuotedString($propertyKey) }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{? $pPropertyKeys.length }}
|
||||
{{~ $pPropertyKeys:$pProperty:$i }}
|
||||
|| {{= it.usePattern($pProperty) }}.test({{=$key}})
|
||||
{{~}}
|
||||
{{?}}
|
||||
);
|
||||
|
||||
if (isAdditional{{=$lvl}}) {
|
||||
{{?}}
|
||||
{{? $removeAdditional == 'all' }}
|
||||
delete {{=$data}}[{{=$key}}];
|
||||
{{??}}
|
||||
{{
|
||||
var $currentErrorPath = it.errorPath;
|
||||
var $additionalProperty = '\' + ' + $key + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
}
|
||||
}}
|
||||
{{? $noAdditional }}
|
||||
{{? $removeAdditional }}
|
||||
delete {{=$data}}[{{=$key}}];
|
||||
{{??}}
|
||||
{{=$nextValid}} = false;
|
||||
{{
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
$errSchemaPath = it.errSchemaPath + '/additionalProperties';
|
||||
}}
|
||||
{{# def.error:'additionalProperties' }}
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
{{? $breakOnError }} break; {{?}}
|
||||
{{?}}
|
||||
{{?? $additionalIsSchema }}
|
||||
{{? $removeAdditional == 'failing' }}
|
||||
var {{=$errs}} = errors;
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{# def.validateAdditional }}
|
||||
|
||||
if (!{{=$nextValid}}) {
|
||||
errors = {{=$errs}};
|
||||
if (validate.errors !== null) {
|
||||
if (errors) validate.errors.length = errors;
|
||||
else validate.errors = null;
|
||||
}
|
||||
delete {{=$data}}[{{=$key}}];
|
||||
}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
{{??}}
|
||||
{{# def.validateAdditional }}
|
||||
{{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{ it.errorPath = $currentErrorPath; }}
|
||||
{{?}}
|
||||
{{? $someProperties }}
|
||||
}
|
||||
{{?}}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
|
||||
{{ var $useDefaults = it.opts.useDefaults && !it.compositeRule; }}
|
||||
|
||||
{{? $schemaKeys.length }}
|
||||
{{~ $schemaKeys:$propertyKey }}
|
||||
{{ var $sch = $schema[$propertyKey]; }}
|
||||
|
||||
{{? {{# def.nonEmptySchema:$sch}} }}
|
||||
{{
|
||||
var $prop = it.util.getProperty($propertyKey)
|
||||
, $passData = $data + $prop
|
||||
, $hasDefault = $useDefaults && $sch.default !== undefined;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + $prop;
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);
|
||||
$it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);
|
||||
$it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
|
||||
{{? {{# def.willOptimize }} }}
|
||||
{{
|
||||
$code = {{# def._optimizeValidate }};
|
||||
var $useData = $passData;
|
||||
}}
|
||||
{{??}}
|
||||
{{ var $useData = $nextData; }}
|
||||
var {{=$nextData}} = {{=$passData}};
|
||||
{{?}}
|
||||
|
||||
{{? $hasDefault }}
|
||||
{{= $code }}
|
||||
{{??}}
|
||||
{{? $requiredHash && $requiredHash[$propertyKey] }}
|
||||
if ({{# def.noPropertyInData }}) {
|
||||
{{=$nextValid}} = false;
|
||||
{{
|
||||
var $currentErrorPath = it.errorPath
|
||||
, $currErrSchemaPath = $errSchemaPath
|
||||
, $missingProperty = it.util.escapeQuotes($propertyKey);
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
|
||||
}
|
||||
$errSchemaPath = it.errSchemaPath + '/required';
|
||||
}}
|
||||
{{# def.error:'required' }}
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
{{ it.errorPath = $currentErrorPath; }}
|
||||
} else {
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if ({{# def.noPropertyInData }}) {
|
||||
{{=$nextValid}} = true;
|
||||
} else {
|
||||
{{??}}
|
||||
if ({{=$useData}} !== undefined
|
||||
{{? $ownProperties }}
|
||||
&& {{# def.isOwnProperty }}
|
||||
{{?}}
|
||||
) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{= $code }}
|
||||
}
|
||||
{{?}} {{ /* $hasDefault */ }}
|
||||
{{?}} {{ /* def.nonEmptySchema */ }}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
|
||||
{{? $pPropertyKeys.length }}
|
||||
{{~ $pPropertyKeys:$pProperty }}
|
||||
{{ var $sch = $pProperties[$pProperty]; }}
|
||||
|
||||
{{? {{# def.nonEmptySchema:$sch}} }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
|
||||
$it.errSchemaPath = it.errSchemaPath + '/patternProperties/'
|
||||
+ it.util.escapeFragment($pProperty);
|
||||
}}
|
||||
|
||||
{{# def.iterateProperties }}
|
||||
if ({{= it.usePattern($pProperty) }}.test({{=$key}})) {
|
||||
{{
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
|
||||
{{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}}
|
||||
}
|
||||
{{? $breakOnError }} else {{=$nextValid}} = true; {{?}}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}} {{ /* def.nonEmptySchema */ }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
52
Lab2/node_modules/.ajv-h16f30rR/lib/dot/propertyNames.jst
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
|
||||
{{? {{# def.nonEmptySchema:$schema }} }}
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
|
||||
{{
|
||||
var $key = 'key' + $lvl
|
||||
, $idx = 'idx' + $lvl
|
||||
, $i = 'i' + $lvl
|
||||
, $invalidName = '\' + ' + $key + ' + \''
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $dataProperties = 'dataProperties' + $lvl
|
||||
, $ownProperties = it.opts.ownProperties
|
||||
, $currentBaseId = it.baseId;
|
||||
}}
|
||||
|
||||
{{? $ownProperties }}
|
||||
var {{=$dataProperties}} = undefined;
|
||||
{{?}}
|
||||
{{# def.iterateProperties }}
|
||||
var startErrs{{=$lvl}} = errors;
|
||||
|
||||
{{ var $passData = $key; }}
|
||||
{{# def.setCompositeRule }}
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
if (!{{=$nextValid}}) {
|
||||
for (var {{=$i}}=startErrs{{=$lvl}}; {{=$i}}<errors; {{=$i}}++) {
|
||||
vErrors[{{=$i}}].propertyName = {{=$key}};
|
||||
}
|
||||
{{# def.extraError:'propertyNames' }}
|
||||
{{? $breakOnError }} break; {{?}}
|
||||
}
|
||||
}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
85
Lab2/node_modules/.ajv-h16f30rR/lib/dot/ref.jst
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{## def._validateRef:_v:
|
||||
{{? it.opts.passContext }}
|
||||
{{=_v}}.call(this,
|
||||
{{??}}
|
||||
{{=_v}}(
|
||||
{{?}}
|
||||
{{=$data}}, {{# def.dataPath }}{{# def.passParentData }}, rootData)
|
||||
#}}
|
||||
|
||||
{{ var $async, $refCode; }}
|
||||
{{? $schema == '#' || $schema == '#/' }}
|
||||
{{
|
||||
if (it.isRoot) {
|
||||
$async = it.async;
|
||||
$refCode = 'validate';
|
||||
} else {
|
||||
$async = it.root.schema.$async === true;
|
||||
$refCode = 'root.refVal[0]';
|
||||
}
|
||||
}}
|
||||
{{??}}
|
||||
{{ var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot); }}
|
||||
{{? $refVal === undefined }}
|
||||
{{ var $message = it.MissingRefError.message(it.baseId, $schema); }}
|
||||
{{? it.opts.missingRefs == 'fail' }}
|
||||
{{ it.logger.error($message); }}
|
||||
{{# def.error:'$ref' }}
|
||||
{{? $breakOnError }} if (false) { {{?}}
|
||||
{{?? it.opts.missingRefs == 'ignore' }}
|
||||
{{ it.logger.warn($message); }}
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{??}}
|
||||
{{ throw new it.MissingRefError(it.baseId, $schema, $message); }}
|
||||
{{?}}
|
||||
{{?? $refVal.inline }}
|
||||
{{# def.setupNextLevel }}
|
||||
{{
|
||||
$it.schema = $refVal.schema;
|
||||
$it.schemaPath = '';
|
||||
$it.errSchemaPath = $schema;
|
||||
}}
|
||||
{{ var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code); }}
|
||||
{{= $code }}
|
||||
{{? $breakOnError}}
|
||||
if ({{=$nextValid}}) {
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{
|
||||
$async = $refVal.$async === true || (it.async && $refVal.$async !== false);
|
||||
$refCode = $refVal.code;
|
||||
}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $refCode }}
|
||||
{{# def.beginDefOut}}
|
||||
{{# def._validateRef:$refCode }}
|
||||
{{# def.storeDefOut:__callValidate }}
|
||||
|
||||
{{? $async }}
|
||||
{{ if (!it.async) throw new Error('async schema referenced by sync schema'); }}
|
||||
{{? $breakOnError }} var {{=$valid}}; {{?}}
|
||||
try {
|
||||
await {{=__callValidate}};
|
||||
{{? $breakOnError }} {{=$valid}} = true; {{?}}
|
||||
} catch (e) {
|
||||
if (!(e instanceof ValidationError)) throw e;
|
||||
if (vErrors === null) vErrors = e.errors;
|
||||
else vErrors = vErrors.concat(e.errors);
|
||||
errors = vErrors.length;
|
||||
{{? $breakOnError }} {{=$valid}} = false; {{?}}
|
||||
}
|
||||
{{? $breakOnError }} if ({{=$valid}}) { {{?}}
|
||||
{{??}}
|
||||
if (!{{=__callValidate}}) {
|
||||
if (vErrors === null) vErrors = {{=$refCode}}.errors;
|
||||
else vErrors = vErrors.concat({{=$refCode}}.errors);
|
||||
errors = vErrors.length;
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
{{?}}
|
||||
{{?}}
|
108
Lab2/node_modules/.ajv-h16f30rR/lib/dot/required.jst
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.missing }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{ var $vSchema = 'schema' + $lvl; }}
|
||||
|
||||
{{## def.setupLoop:
|
||||
{{? !$isData }}
|
||||
var {{=$vSchema}} = validate.schema{{=$schemaPath}};
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
var $i = 'i' + $lvl
|
||||
, $propertyPath = 'schema' + $lvl + '[' + $i + ']'
|
||||
, $missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
|
||||
}
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.isRequiredOwnProperty:
|
||||
Object.prototype.hasOwnProperty.call({{=$data}}, {{=$vSchema}}[{{=$i}}])
|
||||
#}}
|
||||
|
||||
|
||||
{{? !$isData }}
|
||||
{{? $schema.length < it.opts.loopRequired &&
|
||||
it.schema.properties && Object.keys(it.schema.properties).length }}
|
||||
{{ var $required = []; }}
|
||||
{{~ $schema:$property }}
|
||||
{{ var $propertySch = it.schema.properties[$property]; }}
|
||||
{{? !($propertySch && {{# def.nonEmptySchema:$propertySch}}) }}
|
||||
{{ $required[$required.length] = $property; }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
{{??}}
|
||||
{{ var $required = $schema; }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
|
||||
{{? $isData || $required.length }}
|
||||
{{
|
||||
var $currentErrorPath = it.errorPath
|
||||
, $loopRequired = $isData || $required.length >= it.opts.loopRequired
|
||||
, $ownProperties = it.opts.ownProperties;
|
||||
}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
var missing{{=$lvl}};
|
||||
{{? $loopRequired }}
|
||||
{{# def.setupLoop }}
|
||||
var {{=$valid}} = true;
|
||||
|
||||
{{?$isData}}{{# def.check$dataIsArray }}{{?}}
|
||||
|
||||
for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
|
||||
{{=$valid}} = {{=$data}}[{{=$vSchema}}[{{=$i}}]] !== undefined
|
||||
{{? $ownProperties }}
|
||||
&& {{# def.isRequiredOwnProperty }}
|
||||
{{?}};
|
||||
if (!{{=$valid}}) break;
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
|
||||
{{# def.checkError:'required' }}
|
||||
else {
|
||||
{{??}}
|
||||
if ({{# def.checkMissingProperty:$required }}) {
|
||||
{{# def.errorMissingProperty:'required' }}
|
||||
} else {
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{? $loopRequired }}
|
||||
{{# def.setupLoop }}
|
||||
{{? $isData }}
|
||||
if ({{=$vSchema}} && !Array.isArray({{=$vSchema}})) {
|
||||
{{# def.addError:'required' }}
|
||||
} else if ({{=$vSchema}} !== undefined) {
|
||||
{{?}}
|
||||
|
||||
for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
|
||||
if ({{=$data}}[{{=$vSchema}}[{{=$i}}]] === undefined
|
||||
{{? $ownProperties }}
|
||||
|| !{{# def.isRequiredOwnProperty }}
|
||||
{{?}}) {
|
||||
{{# def.addError:'required' }}
|
||||
}
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
{{??}}
|
||||
{{~ $required:$propertyKey }}
|
||||
{{# def.allErrorsMissingProperty:'required' }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{ it.errorPath = $currentErrorPath; }}
|
||||
|
||||
{{?? $breakOnError }}
|
||||
if (true) {
|
||||
{{?}}
|
62
Lab2/node_modules/.ajv-h16f30rR/lib/dot/uniqueItems.jst
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
|
||||
{{? ($schema || $isData) && it.opts.uniqueItems !== false }}
|
||||
{{? $isData }}
|
||||
var {{=$valid}};
|
||||
if ({{=$schemaValue}} === false || {{=$schemaValue}} === undefined)
|
||||
{{=$valid}} = true;
|
||||
else if (typeof {{=$schemaValue}} != 'boolean')
|
||||
{{=$valid}} = false;
|
||||
else {
|
||||
{{?}}
|
||||
|
||||
var i = {{=$data}}.length
|
||||
, {{=$valid}} = true
|
||||
, j;
|
||||
if (i > 1) {
|
||||
{{
|
||||
var $itemType = it.schema.items && it.schema.items.type
|
||||
, $typeIsArray = Array.isArray($itemType);
|
||||
}}
|
||||
{{? !$itemType || $itemType == 'object' || $itemType == 'array' ||
|
||||
($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0)) }}
|
||||
outer:
|
||||
for (;i--;) {
|
||||
for (j = i; j--;) {
|
||||
if (equal({{=$data}}[i], {{=$data}}[j])) {
|
||||
{{=$valid}} = false;
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
{{??}}
|
||||
var itemIndices = {}, item;
|
||||
for (;i--;) {
|
||||
var item = {{=$data}}[i];
|
||||
{{ var $method = 'checkDataType' + ($typeIsArray ? 's' : ''); }}
|
||||
if ({{= it.util[$method]($itemType, 'item', it.opts.strictNumbers, true) }}) continue;
|
||||
{{? $typeIsArray}}
|
||||
if (typeof item == 'string') item = '"' + item;
|
||||
{{?}}
|
||||
if (typeof itemIndices[item] == 'number') {
|
||||
{{=$valid}} = false;
|
||||
j = itemIndices[item];
|
||||
break;
|
||||
}
|
||||
itemIndices[item] = i;
|
||||
}
|
||||
{{?}}
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.error:'uniqueItems' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
{{??}}
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{?}}
|
276
Lab2/node_modules/.ajv-h16f30rR/lib/dot/validate.jst
generated
vendored
Normal file
@ -0,0 +1,276 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.defaults }}
|
||||
{{# def.coerce }}
|
||||
|
||||
{{ /**
|
||||
* schema compilation (render) time:
|
||||
* it = { schema, RULES, _validate, opts }
|
||||
* it.validate - this template function,
|
||||
* it is used recursively to generate code for subschemas
|
||||
*
|
||||
* runtime:
|
||||
* "validate" is a variable name to which this function will be assigned
|
||||
* validateRef etc. are defined in the parent scope in index.js
|
||||
*/ }}
|
||||
|
||||
{{
|
||||
var $async = it.schema.$async === true
|
||||
, $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref')
|
||||
, $id = it.self._getId(it.schema);
|
||||
}}
|
||||
|
||||
{{
|
||||
if (it.opts.strictKeywords) {
|
||||
var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords);
|
||||
if ($unknownKwd) {
|
||||
var $keywordsMsg = 'unknown keyword: ' + $unknownKwd;
|
||||
if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg);
|
||||
else throw new Error($keywordsMsg);
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
{{? it.isTop }}
|
||||
var validate = {{?$async}}{{it.async = true;}}async {{?}}function(data, dataPath, parentData, parentDataProperty, rootData) {
|
||||
'use strict';
|
||||
{{? $id && (it.opts.sourceCode || it.opts.processCode) }}
|
||||
{{= '/\*# sourceURL=' + $id + ' */' }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref) }}
|
||||
{{ var $keyword = 'false schema'; }}
|
||||
{{# def.setupKeyword }}
|
||||
{{? it.schema === false}}
|
||||
{{? it.isTop}}
|
||||
{{ $breakOnError = true; }}
|
||||
{{??}}
|
||||
var {{=$valid}} = false;
|
||||
{{?}}
|
||||
{{# def.error:'false schema' }}
|
||||
{{??}}
|
||||
{{? it.isTop}}
|
||||
{{? $async }}
|
||||
return data;
|
||||
{{??}}
|
||||
validate.errors = null;
|
||||
return true;
|
||||
{{?}}
|
||||
{{??}}
|
||||
var {{=$valid}} = true;
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? it.isTop}}
|
||||
};
|
||||
return validate;
|
||||
{{?}}
|
||||
|
||||
{{ return out; }}
|
||||
{{?}}
|
||||
|
||||
|
||||
{{? it.isTop }}
|
||||
{{
|
||||
var $top = it.isTop
|
||||
, $lvl = it.level = 0
|
||||
, $dataLvl = it.dataLevel = 0
|
||||
, $data = 'data';
|
||||
it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema));
|
||||
it.baseId = it.baseId || it.rootId;
|
||||
delete it.isTop;
|
||||
|
||||
it.dataPathArr = [""];
|
||||
|
||||
if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
|
||||
var $defaultMsg = 'default is ignored in the schema root';
|
||||
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
|
||||
else throw new Error($defaultMsg);
|
||||
}
|
||||
}}
|
||||
|
||||
var vErrors = null; {{ /* don't edit, used in replace */ }}
|
||||
var errors = 0; {{ /* don't edit, used in replace */ }}
|
||||
if (rootData === undefined) rootData = data; {{ /* don't edit, used in replace */ }}
|
||||
{{??}}
|
||||
{{
|
||||
var $lvl = it.level
|
||||
, $dataLvl = it.dataLevel
|
||||
, $data = 'data' + ($dataLvl || '');
|
||||
|
||||
if ($id) it.baseId = it.resolve.url(it.baseId, $id);
|
||||
|
||||
if ($async && !it.async) throw new Error('async schema in sync schema');
|
||||
}}
|
||||
|
||||
var errs_{{=$lvl}} = errors;
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
var $valid = 'valid' + $lvl
|
||||
, $breakOnError = !it.opts.allErrors
|
||||
, $closingBraces1 = ''
|
||||
, $closingBraces2 = '';
|
||||
|
||||
var $errorKeyword;
|
||||
var $typeSchema = it.schema.type
|
||||
, $typeIsArray = Array.isArray($typeSchema);
|
||||
|
||||
if ($typeSchema && it.opts.nullable && it.schema.nullable === true) {
|
||||
if ($typeIsArray) {
|
||||
if ($typeSchema.indexOf('null') == -1)
|
||||
$typeSchema = $typeSchema.concat('null');
|
||||
} else if ($typeSchema != 'null') {
|
||||
$typeSchema = [$typeSchema, 'null'];
|
||||
$typeIsArray = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($typeIsArray && $typeSchema.length == 1) {
|
||||
$typeSchema = $typeSchema[0];
|
||||
$typeIsArray = false;
|
||||
}
|
||||
}}
|
||||
|
||||
{{## def.checkType:
|
||||
{{
|
||||
var $schemaPath = it.schemaPath + '.type'
|
||||
, $errSchemaPath = it.errSchemaPath + '/type'
|
||||
, $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
|
||||
}}
|
||||
|
||||
if ({{= it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true) }}) {
|
||||
#}}
|
||||
|
||||
{{? it.schema.$ref && $refKeywords }}
|
||||
{{? it.opts.extendRefs == 'fail' }}
|
||||
{{ throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); }}
|
||||
{{?? it.opts.extendRefs !== true }}
|
||||
{{
|
||||
$refKeywords = false;
|
||||
it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
|
||||
}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? it.schema.$comment && it.opts.$comment }}
|
||||
{{= it.RULES.all.$comment.code(it, '$comment') }}
|
||||
{{?}}
|
||||
|
||||
{{? $typeSchema }}
|
||||
{{? it.opts.coerceTypes }}
|
||||
{{ var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); }}
|
||||
{{?}}
|
||||
|
||||
{{ var $rulesGroup = it.RULES.types[$typeSchema]; }}
|
||||
{{? $coerceToTypes || $typeIsArray || $rulesGroup === true ||
|
||||
($rulesGroup && !$shouldUseGroup($rulesGroup)) }}
|
||||
{{
|
||||
var $schemaPath = it.schemaPath + '.type'
|
||||
, $errSchemaPath = it.errSchemaPath + '/type';
|
||||
}}
|
||||
{{# def.checkType }}
|
||||
{{? $coerceToTypes }}
|
||||
{{# def.coerceType }}
|
||||
{{??}}
|
||||
{{# def.error:'type' }}
|
||||
{{?}}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
|
||||
{{? it.schema.$ref && !$refKeywords }}
|
||||
{{= it.RULES.all.$ref.code(it, '$ref') }}
|
||||
{{? $breakOnError }}
|
||||
}
|
||||
if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) {
|
||||
{{ $closingBraces2 += '}'; }}
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{~ it.RULES:$rulesGroup }}
|
||||
{{? $shouldUseGroup($rulesGroup) }}
|
||||
{{? $rulesGroup.type }}
|
||||
if ({{= it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers) }}) {
|
||||
{{?}}
|
||||
{{? it.opts.useDefaults }}
|
||||
{{? $rulesGroup.type == 'object' && it.schema.properties }}
|
||||
{{# def.defaultProperties }}
|
||||
{{?? $rulesGroup.type == 'array' && Array.isArray(it.schema.items) }}
|
||||
{{# def.defaultItems }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{~ $rulesGroup.rules:$rule }}
|
||||
{{? $shouldUseRule($rule) }}
|
||||
{{ var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); }}
|
||||
{{? $code }}
|
||||
{{= $code }}
|
||||
{{? $breakOnError }}
|
||||
{{ $closingBraces1 += '}'; }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{~}}
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces1 }}
|
||||
{{ $closingBraces1 = ''; }}
|
||||
{{?}}
|
||||
{{? $rulesGroup.type }}
|
||||
}
|
||||
{{? $typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes }}
|
||||
else {
|
||||
{{
|
||||
var $schemaPath = it.schemaPath + '.type'
|
||||
, $errSchemaPath = it.errSchemaPath + '/type';
|
||||
}}
|
||||
{{# def.error:'type' }}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) {
|
||||
{{ $closingBraces2 += '}'; }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{~}}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }} {{= $closingBraces2 }} {{?}}
|
||||
|
||||
{{? $top }}
|
||||
{{? $async }}
|
||||
if (errors === 0) return data; {{ /* don't edit, used in replace */ }}
|
||||
else throw new ValidationError(vErrors); {{ /* don't edit, used in replace */ }}
|
||||
{{??}}
|
||||
validate.errors = vErrors; {{ /* don't edit, used in replace */ }}
|
||||
return errors === 0; {{ /* don't edit, used in replace */ }}
|
||||
{{?}}
|
||||
};
|
||||
|
||||
return validate;
|
||||
{{??}}
|
||||
var {{=$valid}} = errors === errs_{{=$lvl}};
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
function $shouldUseGroup($rulesGroup) {
|
||||
var rules = $rulesGroup.rules;
|
||||
for (var i=0; i < rules.length; i++)
|
||||
if ($shouldUseRule(rules[i]))
|
||||
return true;
|
||||
}
|
||||
|
||||
function $shouldUseRule($rule) {
|
||||
return it.schema[$rule.keyword] !== undefined ||
|
||||
($rule.implements && $ruleImplementsSomeKeyword($rule));
|
||||
}
|
||||
|
||||
function $ruleImplementsSomeKeyword($rule) {
|
||||
var impl = $rule.implements;
|
||||
for (var i=0; i < impl.length; i++)
|
||||
if (it.schema[impl[i]] !== undefined)
|
||||
return true;
|
||||
}
|
||||
}}
|
3
Lab2/node_modules/.ajv-h16f30rR/lib/dotjs/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
These files are compiled dot templates from dot folder.
|
||||
|
||||
Do NOT edit them directly, edit the templates and run `npm run build` from main ajv folder.
|
163
Lab2/node_modules/.ajv-h16f30rR/lib/dotjs/_limit.js
generated
vendored
Normal file
@ -0,0 +1,163 @@
|
||||
'use strict';
|
||||
module.exports = function generate__limit(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $isMax = $keyword == 'maximum',
|
||||
$exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum',
|
||||
$schemaExcl = it.schema[$exclusiveKeyword],
|
||||
$isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data,
|
||||
$op = $isMax ? '<' : '>',
|
||||
$notOp = $isMax ? '>' : '<',
|
||||
$errorKeyword = undefined;
|
||||
if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {
|
||||
throw new Error($exclusiveKeyword + ' must be number or boolean');
|
||||
}
|
||||
if ($isDataExcl) {
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
|
||||
$exclusive = 'exclusive' + $lvl,
|
||||
$exclType = 'exclType' + $lvl,
|
||||
$exclIsNumber = 'exclIsNumber' + $lvl,
|
||||
$opExpr = 'op' + $lvl,
|
||||
$opStr = '\' + ' + $opExpr + ' + \'';
|
||||
out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';
|
||||
$schemaValueExcl = 'schemaExcl' + $lvl;
|
||||
out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { ';
|
||||
var $errorKeyword = $exclusiveKeyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } else if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\'; ';
|
||||
if ($schema === undefined) {
|
||||
$errorKeyword = $exclusiveKeyword;
|
||||
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
|
||||
$schemaValue = $schemaValueExcl;
|
||||
$isData = $isDataExcl;
|
||||
}
|
||||
} else {
|
||||
var $exclIsNumber = typeof $schemaExcl == 'number',
|
||||
$opStr = $op;
|
||||
if ($exclIsNumber && $isData) {
|
||||
var $opExpr = '\'' + $opStr + '\'';
|
||||
out += ' if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { ';
|
||||
} else {
|
||||
if ($exclIsNumber && $schema === undefined) {
|
||||
$exclusive = true;
|
||||
$errorKeyword = $exclusiveKeyword;
|
||||
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
|
||||
$schemaValue = $schemaExcl;
|
||||
$notOp += '=';
|
||||
} else {
|
||||
if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema);
|
||||
if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {
|
||||
$exclusive = true;
|
||||
$errorKeyword = $exclusiveKeyword;
|
||||
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
|
||||
$notOp += '=';
|
||||
} else {
|
||||
$exclusive = false;
|
||||
$opStr += '=';
|
||||
}
|
||||
}
|
||||
var $opExpr = '\'' + $opStr + '\'';
|
||||
out += ' if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { ';
|
||||
}
|
||||
}
|
||||
$errorKeyword = $errorKeyword || $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should be ' + ($opStr) + ' ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + ($schemaValue) + '\'';
|
||||
}
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
80
Lab2/node_modules/.ajv-h16f30rR/lib/dotjs/_limitItems.js
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
'use strict';
|
||||
module.exports = function generate__limitItems(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
var $op = $keyword == 'maxItems' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { ';
|
||||
var $errorKeyword = $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have ';
|
||||
if ($keyword == 'maxItems') {
|
||||
out += 'more';
|
||||
} else {
|
||||
out += 'fewer';
|
||||
}
|
||||
out += ' than ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' items\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '} ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
85
Lab2/node_modules/.ajv-h16f30rR/lib/dotjs/_limitLength.js
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
'use strict';
|
||||
module.exports = function generate__limitLength(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
var $op = $keyword == 'maxLength' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
if (it.opts.unicode === false) {
|
||||
out += ' ' + ($data) + '.length ';
|
||||
} else {
|
||||
out += ' ucs2length(' + ($data) + ') ';
|
||||
}
|
||||
out += ' ' + ($op) + ' ' + ($schemaValue) + ') { ';
|
||||
var $errorKeyword = $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT be ';
|
||||
if ($keyword == 'maxLength') {
|
||||
out += 'longer';
|
||||
} else {
|
||||
out += 'shorter';
|
||||
}
|
||||
out += ' than ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' characters\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '} ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
80
Lab2/node_modules/.ajv-h16f30rR/lib/dotjs/_limitProperties.js
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
'use strict';
|
||||
module.exports = function generate__limitProperties(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!($isData || typeof $schema == 'number')) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
var $op = $keyword == 'maxProperties' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { ';
|
||||
var $errorKeyword = $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have ';
|
||||
if ($keyword == 'maxProperties') {
|
||||
out += 'more';
|
||||
} else {
|
||||
out += 'fewer';
|
||||
}
|
||||
out += ' than ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' properties\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '} ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
42
Lab2/node_modules/.ajv-h16f30rR/lib/dotjs/allOf.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
module.exports = function generate_allOf(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $currentBaseId = $it.baseId,
|
||||
$allSchemasEmpty = true;
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $sch, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
$allSchemasEmpty = false;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($breakOnError) {
|
||||
if ($allSchemasEmpty) {
|
||||
out += ' if (true) { ';
|
||||
} else {
|
||||
out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
73
Lab2/node_modules/.ajv-h16f30rR/lib/dotjs/anyOf.js
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
'use strict';
|
||||
module.exports = function generate_anyOf(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $noEmptySchema = $schema.every(function($sch) {
|
||||
return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all));
|
||||
});
|
||||
if ($noEmptySchema) {
|
||||
var $currentBaseId = $it.baseId;
|
||||
out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; ';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $sch, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should match some schema in anyOf\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError(vErrors); ';
|
||||
} else {
|
||||
out += ' validate.errors = vErrors; return false; ';
|
||||
}
|
||||
}
|
||||
out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
} else {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
14
Lab2/node_modules/.ajv-h16f30rR/lib/dotjs/comment.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
module.exports = function generate_comment(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $schema = it.schema[$keyword];
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $comment = it.util.toQuotedString($schema);
|
||||
if (it.opts.$comment === true) {
|
||||
out += ' console.log(' + ($comment) + ');';
|
||||
} else if (typeof it.opts.$comment == 'function') {
|
||||
out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);';
|
||||
}
|
||||
return out;
|
||||
}
|
56
Lab2/node_modules/.ajv-h16f30rR/lib/dotjs/const.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
module.exports = function generate_const(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!$isData) {
|
||||
out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';';
|
||||
}
|
||||
out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValue: schema' + ($lvl) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should be equal to constant\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' }';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
81
Lab2/node_modules/.ajv-h16f30rR/lib/dotjs/contains.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
'use strict';
|
||||
module.exports = function generate_contains(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $idx = 'i' + $lvl,
|
||||
$dataNxt = $it.dataLevel = it.dataLevel + 1,
|
||||
$nextData = 'data' + $dataNxt,
|
||||
$currentBaseId = it.baseId,
|
||||
$nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all));
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
|
||||
if ($nonEmptySchema) {
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
|
||||
} else {
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
|
||||
}
|
||||
out += ' if (' + ($nextValid) + ') break; } ';
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {';
|
||||
} else {
|
||||
out += ' if (' + ($data) + '.length == 0) {';
|
||||
}
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('contains') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should contain a valid item\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } else { ';
|
||||
if ($nonEmptySchema) {
|
||||
out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
|
||||
}
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
return out;
|
||||
}
|
228
Lab2/node_modules/.ajv-h16f30rR/lib/dotjs/custom.js
generated
vendored
Normal file
@ -0,0 +1,228 @@
|
||||
'use strict';
|
||||
module.exports = function generate_custom(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $rule = this,
|
||||
$definition = 'definition' + $lvl,
|
||||
$rDef = $rule.definition,
|
||||
$closingBraces = '';
|
||||
var $compile, $inline, $macro, $ruleValidate, $validateCode;
|
||||
if ($isData && $rDef.$data) {
|
||||
$validateCode = 'keywordValidate' + $lvl;
|
||||
var $validateSchema = $rDef.validateSchema;
|
||||
out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;';
|
||||
} else {
|
||||
$ruleValidate = it.useCustomRule($rule, $schema, it.schema, it);
|
||||
if (!$ruleValidate) return;
|
||||
$schemaValue = 'validate.schema' + $schemaPath;
|
||||
$validateCode = $ruleValidate.code;
|
||||
$compile = $rDef.compile;
|
||||
$inline = $rDef.inline;
|
||||
$macro = $rDef.macro;
|
||||
}
|
||||
var $ruleErrs = $validateCode + '.errors',
|
||||
$i = 'i' + $lvl,
|
||||
$ruleErr = 'ruleErr' + $lvl,
|
||||
$asyncKeyword = $rDef.async;
|
||||
if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema');
|
||||
if (!($inline || $macro)) {
|
||||
out += '' + ($ruleErrs) + ' = null;';
|
||||
}
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
|
||||
if ($isData && $rDef.$data) {
|
||||
$closingBraces += '}';
|
||||
out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { ';
|
||||
if ($validateSchema) {
|
||||
$closingBraces += '}';
|
||||
out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { ';
|
||||
}
|
||||
}
|
||||
if ($inline) {
|
||||
if ($rDef.statements) {
|
||||
out += ' ' + ($ruleValidate.validate) + ' ';
|
||||
} else {
|
||||
out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; ';
|
||||
}
|
||||
} else if ($macro) {
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
$it.schema = $ruleValidate.validate;
|
||||
$it.schemaPath = '';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
var $code = it.validate($it).replace(/validate\.schema/g, $validateCode);
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
out += ' ' + ($code);
|
||||
} else {
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = '';
|
||||
out += ' ' + ($validateCode) + '.call( ';
|
||||
if (it.opts.passContext) {
|
||||
out += 'this';
|
||||
} else {
|
||||
out += 'self';
|
||||
}
|
||||
if ($compile || $rDef.schema === false) {
|
||||
out += ' , ' + ($data) + ' ';
|
||||
} else {
|
||||
out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' ';
|
||||
}
|
||||
out += ' , (dataPath || \'\')';
|
||||
if (it.errorPath != '""') {
|
||||
out += ' + ' + (it.errorPath);
|
||||
}
|
||||
var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
|
||||
$parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
|
||||
out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) ';
|
||||
var def_callRuleValidate = out;
|
||||
out = $$outStack.pop();
|
||||
if ($rDef.errors === false) {
|
||||
out += ' ' + ($valid) + ' = ';
|
||||
if ($asyncKeyword) {
|
||||
out += 'await ';
|
||||
}
|
||||
out += '' + (def_callRuleValidate) + '; ';
|
||||
} else {
|
||||
if ($asyncKeyword) {
|
||||
$ruleErrs = 'customErrors' + $lvl;
|
||||
out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = await ' + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } ';
|
||||
} else {
|
||||
out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; ';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($rDef.modifying) {
|
||||
out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];';
|
||||
}
|
||||
out += '' + ($closingBraces);
|
||||
if ($rDef.valid) {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
} else {
|
||||
out += ' if ( ';
|
||||
if ($rDef.valid === undefined) {
|
||||
out += ' !';
|
||||
if ($macro) {
|
||||
out += '' + ($nextValid);
|
||||
} else {
|
||||
out += '' + ($valid);
|
||||
}
|
||||
} else {
|
||||
out += ' ' + (!$rDef.valid) + ' ';
|
||||
}
|
||||
out += ') { ';
|
||||
$errorKeyword = $rule.keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = '';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
var def_customError = out;
|
||||
out = $$outStack.pop();
|
||||
if ($inline) {
|
||||
if ($rDef.errors) {
|
||||
if ($rDef.errors != 'full') {
|
||||
out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } ';
|
||||
if (it.opts.verbose) {
|
||||
out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';
|
||||
}
|
||||
out += ' } ';
|
||||
}
|
||||
} else {
|
||||
if ($rDef.errors === false) {
|
||||
out += ' ' + (def_customError) + ' ';
|
||||
} else {
|
||||
out += ' if (' + ($errs) + ' == errors) { ' + (def_customError) + ' } else { for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } ';
|
||||
if (it.opts.verbose) {
|
||||
out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';
|
||||
}
|
||||
out += ' } } ';
|
||||
}
|
||||
}
|
||||
} else if ($macro) {
|
||||
out += ' var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError(vErrors); ';
|
||||
} else {
|
||||
out += ' validate.errors = vErrors; return false; ';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($rDef.errors === false) {
|
||||
out += ' ' + (def_customError) + ' ';
|
||||
} else {
|
||||
out += ' if (Array.isArray(' + ($ruleErrs) + ')) { if (vErrors === null) vErrors = ' + ($ruleErrs) + '; else vErrors = vErrors.concat(' + ($ruleErrs) + '); errors = vErrors.length; for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; ';
|
||||
if (it.opts.verbose) {
|
||||
out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';
|
||||
}
|
||||
out += ' } } else { ' + (def_customError) + ' } ';
|
||||
}
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|