Preparing for react

This commit is contained in:
Tomasz 2021-01-23 10:38:30 +01:00
parent 704dc35d79
commit 7e629a702e
5765 changed files with 618212 additions and 54 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -21,16 +21,6 @@ from .API.school_data import get_school_data
from .API.dashboard import get_dashboard
from .decrypt import decrypt_cookies
#views
def default_view(request, *args, **kwargs):
return render(request, 'index.html')
def content_view(request, *args, **kwargs):
if request.session.has_key('is_logged'):
return render(request, 'content.html')
else:
return redirect('../')
#API
def login(request, *args, **kwargs):
data = json.loads(request.body)

BIN
db.sqlite3 Normal file

Binary file not shown.

4
files/js/dist/out-attedance.js vendored Normal file
View file

@ -0,0 +1,4 @@
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ })()
;

4
files/js/dist/out-exams.js vendored Normal file
View file

@ -0,0 +1,4 @@
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ })()
;

4
files/js/dist/out-grades.js vendored Normal file
View file

@ -0,0 +1,4 @@
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ })()
;

4
files/js/dist/out-homeworks.js vendored Normal file
View file

@ -0,0 +1,4 @@
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ })()
;

4
files/js/dist/out-login.js vendored Normal file
View file

@ -0,0 +1,4 @@
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ })()
;

4
files/js/dist/out-messages.js vendored Normal file
View file

@ -0,0 +1,4 @@
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ })()
;

4
files/js/dist/out-mobile_access.js vendored Normal file
View file

@ -0,0 +1,4 @@
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ })()
;

4
files/js/dist/out-notes.js vendored Normal file
View file

@ -0,0 +1,4 @@
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ })()
;

4
files/js/dist/out-start.js vendored Normal file
View file

@ -0,0 +1,4 @@
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ })()
;

4
files/js/dist/out-timetable.js vendored Normal file
View file

@ -0,0 +1,4 @@
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ })()
;

0
frontend/__init__.py Normal file
View file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

3
frontend/admin.py Normal file
View file

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
frontend/apps.py Normal file
View file

@ -0,0 +1,5 @@
from django.apps import AppConfig
class FrontendConfig(AppConfig):
name = 'frontend'

30
frontend/files/js/dist/out-attedance.js vendored Normal file
View file

@ -0,0 +1,30 @@
/******/ (function() { // webpackBootstrap
/*!******************************************!*\
!*** ./static/frontend/js/attendance.js ***!
\******************************************/
var attendance_ = document.querySelector('#attendance_');
myStorage = window.sessionStorage;
var getAttendance = function getAttendance() {
document.querySelector('#content').innerHTML = 'Here is attendance (in my imagination)';
cookies_data = sessionStorage.getItem('cookies_data');
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/attendance', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
}).then(function (response) {
return response.json();
}).then(function (data) {
console.log(data);
});
};
attendance_.addEventListener('click', getAttendance);
/******/ })()
;
//# sourceMappingURL=out-attedance.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["webpack://wulkanowy-web/./static/frontend/js/attendance.js"],"names":["attendance_","document","querySelector","myStorage","window","sessionStorage","getAttendance","innerHTML","cookies_data","getItem","csrfcookie_","fetch","url","method","mode","headers","body","then","response","json","data","console","log","addEventListener"],"mappings":";;;;AAAA,IAAMA,WAAW,GAAGC,QAAQ,CAACC,aAAT,CAAuB,cAAvB,CAApB;AAEAC,SAAS,GAAGC,MAAM,CAACC,cAAnB;;AAEA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,GAAM;AACxBL,UAAQ,CAACC,aAAT,CAAuB,UAAvB,EAAmCK,SAAnC,GAA+C,wCAA/C;AACAC,cAAY,GAAGH,cAAc,CAACI,OAAf,CAAuB,cAAvB,CAAf;AACAC,aAAW,GAAGL,cAAc,CAACI,OAAf,CAAuB,YAAvB,CAAd;AACAE,OAAK,CAACC,GAAG,GAAG,mBAAP,EAA4B;AAC7BC,UAAM,EAAE,MADqB;AAE7BC,QAAI,EAAE,MAFuB;AAG7BC,WAAO,EAAE;AACL,sBAAgB,kBADX;AAEL,qBAAeL;AAFV,KAHoB;AAO7BM,QAAI,EAAER;AAPuB,GAA5B,CAAL,CAQGS,IARH,CAQQ,UAAAC,QAAQ;AAAA,WAAIA,QAAQ,CAACC,IAAT,EAAJ;AAAA,GARhB,EAQqCF,IARrC,CAQ0C,UAAAG,IAAI,EAAI;AAC9CC,WAAO,CAACC,GAAR,CAAYF,IAAZ;AACH,GAVD;AAWH,CAfD;;AAiBApB,WAAW,CAACuB,gBAAZ,CAA6B,OAA7B,EAAsCjB,aAAtC,E","file":"out-attedance.js","sourcesContent":["const attendance_ = document.querySelector('#attendance_');\n\nmyStorage = window.sessionStorage;\n\nconst getAttendance = () => {\n document.querySelector('#content').innerHTML = 'Here is attendance (in my imagination)';\n cookies_data = sessionStorage.getItem('cookies_data');\n csrfcookie_ = sessionStorage.getItem('csrfcookie');\n fetch(url = '../api/attendance', {\n method: 'POST',\n mode: 'cors',\n headers: {\n 'Content-Type': 'application/json',\n 'X-CSRFToken': csrfcookie_\n },\n body: cookies_data\n }).then(response => response.json()).then(data => {\n console.log(data);\n })\n}\n\nattendance_.addEventListener('click', getAttendance);"],"sourceRoot":""}

30
frontend/files/js/dist/out-exams.js vendored Normal file
View file

@ -0,0 +1,30 @@
/******/ (function() { // webpackBootstrap
/*!*************************************!*\
!*** ./static/frontend/js/exams.js ***!
\*************************************/
var exams_ = document.querySelector('#exams_');
myStorage = window.sessionStorage;
var getExams = function getExams() {
document.querySelector('#content').innerHTML = 'Here is exams (in my imagination)';
cookies_data = sessionStorage.getItem('cookies_data');
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/exams', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
}).then(function (response) {
return response.json();
}).then(function (data) {
console.log(data);
});
};
exams_.addEventListener('click', getExams);
/******/ })()
;
//# sourceMappingURL=out-exams.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["webpack://wulkanowy-web/./static/frontend/js/exams.js"],"names":["exams_","document","querySelector","myStorage","window","sessionStorage","getExams","innerHTML","cookies_data","getItem","csrfcookie_","fetch","url","method","mode","headers","body","then","response","json","data","console","log","addEventListener"],"mappings":";;;;AAAA,IAAMA,MAAM,GAAGC,QAAQ,CAACC,aAAT,CAAuB,SAAvB,CAAf;AAEAC,SAAS,GAAGC,MAAM,CAACC,cAAnB;;AAEA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,GAAM;AACnBL,UAAQ,CAACC,aAAT,CAAuB,UAAvB,EAAmCK,SAAnC,GAA+C,mCAA/C;AACAC,cAAY,GAAGH,cAAc,CAACI,OAAf,CAAuB,cAAvB,CAAf;AACAC,aAAW,GAAGL,cAAc,CAACI,OAAf,CAAuB,YAAvB,CAAd;AACAE,OAAK,CAACC,GAAG,GAAG,cAAP,EAAuB;AACxBC,UAAM,EAAE,MADgB;AAExBC,QAAI,EAAE,MAFkB;AAGxBC,WAAO,EAAE;AACL,sBAAgB,kBADX;AAEL,qBAAeL;AAFV,KAHe;AAOxBM,QAAI,EAAER;AAPkB,GAAvB,CAAL,CAQGS,IARH,CAQQ,UAAAC,QAAQ;AAAA,WAAIA,QAAQ,CAACC,IAAT,EAAJ;AAAA,GARhB,EAQqCF,IARrC,CAQ0C,UAAAG,IAAI,EAAI;AAC9CC,WAAO,CAACC,GAAR,CAAYF,IAAZ;AACH,GAVD;AAWH,CAfD;;AAiBApB,MAAM,CAACuB,gBAAP,CAAwB,OAAxB,EAAiCjB,QAAjC,E","file":"out-exams.js","sourcesContent":["const exams_ = document.querySelector('#exams_');\n\nmyStorage = window.sessionStorage;\n\nconst getExams = () => {\n document.querySelector('#content').innerHTML = 'Here is exams (in my imagination)';\n cookies_data = sessionStorage.getItem('cookies_data');\n csrfcookie_ = sessionStorage.getItem('csrfcookie');\n fetch(url = '../api/exams', {\n method: 'POST',\n mode: 'cors',\n headers: {\n 'Content-Type': 'application/json',\n 'X-CSRFToken': csrfcookie_\n },\n body: cookies_data\n }).then(response => response.json()).then(data => {\n console.log(data)\n })\n}\n\nexams_.addEventListener('click', getExams);"],"sourceRoot":""}

134
frontend/files/js/dist/out-grades.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

30
frontend/files/js/dist/out-homeworks.js vendored Normal file
View file

@ -0,0 +1,30 @@
/******/ (function() { // webpackBootstrap
/*!*****************************************!*\
!*** ./static/frontend/js/homeworks.js ***!
\*****************************************/
var homeworks_ = document.querySelector('#homeworks_');
myStorage = window.sessionStorage;
var getHomeworks = function getHomeworks() {
document.querySelector('#content').innerHTML = 'Here is homeworks (in my imagination)';
cookies_data = sessionStorage.getItem('cookies_data');
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/homeworks', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
}).then(function (response) {
return response.json();
}).then(function (data) {
console.log(data);
});
};
homeworks_.addEventListener('click', getHomeworks);
/******/ })()
;
//# sourceMappingURL=out-homeworks.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["webpack://wulkanowy-web/./static/frontend/js/homeworks.js"],"names":["homeworks_","document","querySelector","myStorage","window","sessionStorage","getHomeworks","innerHTML","cookies_data","getItem","csrfcookie_","fetch","url","method","mode","headers","body","then","response","json","data","console","log","addEventListener"],"mappings":";;;;AAAA,IAAMA,UAAU,GAAGC,QAAQ,CAACC,aAAT,CAAuB,aAAvB,CAAnB;AAEAC,SAAS,GAAGC,MAAM,CAACC,cAAnB;;AAEA,IAAMC,YAAY,GAAG,SAAfA,YAAe,GAAM;AACvBL,UAAQ,CAACC,aAAT,CAAuB,UAAvB,EAAmCK,SAAnC,GAA+C,uCAA/C;AACAC,cAAY,GAAGH,cAAc,CAACI,OAAf,CAAuB,cAAvB,CAAf;AACAC,aAAW,GAAGL,cAAc,CAACI,OAAf,CAAuB,YAAvB,CAAd;AACAE,OAAK,CAACC,GAAG,GAAG,kBAAP,EAA2B;AAC5BC,UAAM,EAAE,MADoB;AAE5BC,QAAI,EAAE,MAFsB;AAG5BC,WAAO,EAAE;AACL,sBAAgB,kBADX;AAEL,qBAAeL;AAFV,KAHmB;AAO5BM,QAAI,EAAER;AAPsB,GAA3B,CAAL,CAQGS,IARH,CAQQ,UAAAC,QAAQ;AAAA,WAAIA,QAAQ,CAACC,IAAT,EAAJ;AAAA,GARhB,EAQqCF,IARrC,CAQ0C,UAAAG,IAAI,EAAI;AAC9CC,WAAO,CAACC,GAAR,CAAYF,IAAZ;AACH,GAVD;AAWH,CAfD;;AAiBApB,UAAU,CAACuB,gBAAX,CAA4B,OAA5B,EAAqCjB,YAArC,E","file":"out-homeworks.js","sourcesContent":["const homeworks_ = document.querySelector('#homeworks_');\n\nmyStorage = window.sessionStorage;\n\nconst getHomeworks = () => {\n document.querySelector('#content').innerHTML = 'Here is homeworks (in my imagination)';\n cookies_data = sessionStorage.getItem('cookies_data');\n csrfcookie_ = sessionStorage.getItem('csrfcookie');\n fetch(url = '../api/homeworks', {\n method: 'POST',\n mode: 'cors',\n headers: {\n 'Content-Type': 'application/json',\n 'X-CSRFToken': csrfcookie_\n },\n body: cookies_data\n }).then(response => response.json()).then(data => {\n console.log(data);\n })\n}\n\nhomeworks_.addEventListener('click', getHomeworks);"],"sourceRoot":""}

80
frontend/files/js/dist/out-login.js vendored Normal file
View file

@ -0,0 +1,80 @@
/******/ (function() { // webpackBootstrap
/*!*************************************!*\
!*** ./static/frontend/js/login.js ***!
\*************************************/
var button = document.querySelector('#button');
var login = function login() {
var loginName = document.querySelector('#id_loginName').value;
var Password = document.querySelector('#id_Password').value;
var symbol = document.querySelector('#id_Symbol').value;
var diary = document.querySelector('#id_diary').value;
if (loginName != '' && Password != '' && symbol != '') {
switch (diary) {
case 'Fakelog':
var diaryUrl = 'http://cufs.fakelog.cf/';
sessionStorage.setItem('diary_url', 'http://cufs.fakelog.cf/');
break;
case 'Vulcan UONET+':
var diaryUrl = 'https://cufs.vulcan.net.pl/';
sessionStorage.setItem('diary_url', 'https://cufs.vulcan.net.pl/');
break;
}
data = {
'loginName': loginName,
'Password': Password,
'Symbol': symbol,
'diaryUrl': diaryUrl
};
fetch(url = 'api/login', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie()
},
body: JSON.stringify(data)
}).then(function (response) {
return response.json();
}).then(function (data) {
if (data['success']) {
myStorage = window.sessionStorage;
sessionStorage.setItem('cookies_data', JSON.stringify(data));
sessionStorage.setItem('csrfcookie', csrfcookie());
sessionStorage.setItem('email', document.querySelector('#id_loginName').value);
sessionStorage.setItem('symbol', document.querySelector('#id_Symbol').value);
window.location.href = "/content/";
} else {
document.querySelector('#error').innerHTML = 'Nieprawidłowy login, hasło lub symbol';
}
});
}
};
var csrfcookie = function csrfcookie() {
var cookieValue = null,
name = 'csrftoken';
if (document.cookie && document.cookie !== '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i].trim();
if (cookie.substring(0, name.length + 1) == name + '=') {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
};
button.addEventListener('click', login);
/******/ })()
;
//# sourceMappingURL=out-login.js.map

File diff suppressed because one or more lines are too long

248
frontend/files/js/dist/out-messages.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,51 @@
/******/ (function() { // webpackBootstrap
/*!*********************************************!*\
!*** ./static/frontend/js/mobile_access.js ***!
\*********************************************/
var registered_ = document.querySelector('#mobile_access_');
myStorage = window.sessionStorage;
var getRegisteredDevices = function getRegisteredDevices() {
document.querySelector('#content').innerHTML = '<button id="register_device_">ZAJERESTRUJ URZĄDZENIE</button><div id="register_device_data"></div><br />Here is registered mobile devices (in my imagination)';
cookies_data = sessionStorage.getItem('cookies_data');
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/mobile/registered', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
}).then(function (response) {
return response.json();
}).then(function (data) {
console.log(data);
var register_device_ = document.querySelector('#register_device_');
register_device_.addEventListener('click', registerDevice);
});
};
var registerDevice = function registerDevice() {
cookies_data = sessionStorage.getItem('cookies_data');
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/mobile/register', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
}).then(function (response) {
return response.json();
}).then(function (data) {
console.log(data);
document.querySelector('#register_device_data').innerHTML = data.data.QrCodeImage + '<br /> TOKEN:' + data.data.TokenKey + '<br /> PIN:' + data.data.PIN + '<br /> SYMBOL:' + data.data.CustomerGroup;
});
};
registered_.addEventListener('click', getRegisteredDevices);
/******/ })()
;
//# sourceMappingURL=out-mobile_access.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["webpack://wulkanowy-web/./static/frontend/js/mobile_access.js"],"names":["registered_","document","querySelector","myStorage","window","sessionStorage","getRegisteredDevices","innerHTML","cookies_data","getItem","csrfcookie_","fetch","url","method","mode","headers","body","then","response","json","data","console","log","register_device_","addEventListener","registerDevice","QrCodeImage","TokenKey","PIN","CustomerGroup"],"mappings":";;;;AAAA,IAAMA,WAAW,GAAGC,QAAQ,CAACC,aAAT,CAAuB,iBAAvB,CAApB;AAEAC,SAAS,GAAGC,MAAM,CAACC,cAAnB;;AAEA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,GAAM;AAC/BL,UAAQ,CAACC,aAAT,CAAuB,UAAvB,EAAmCK,SAAnC,GAA+C,+JAA/C;AACAC,cAAY,GAAGH,cAAc,CAACI,OAAf,CAAuB,cAAvB,CAAf;AACAC,aAAW,GAAGL,cAAc,CAACI,OAAf,CAAuB,YAAvB,CAAd;AACAE,OAAK,CAACC,GAAG,GAAG,0BAAP,EAAmC;AACpCC,UAAM,EAAE,MAD4B;AAEpCC,QAAI,EAAE,MAF8B;AAGpCC,WAAO,EAAE;AACL,sBAAgB,kBADX;AAEL,qBAAeL;AAFV,KAH2B;AAOpCM,QAAI,EAAER;AAP8B,GAAnC,CAAL,CAQGS,IARH,CAQQ,UAAAC,QAAQ;AAAA,WAAIA,QAAQ,CAACC,IAAT,EAAJ;AAAA,GARhB,EAQqCF,IARrC,CAQ0C,UAAAG,IAAI,EAAI;AAC9CC,WAAO,CAACC,GAAR,CAAYF,IAAZ;AACA,QAAMG,gBAAgB,GAAGtB,QAAQ,CAACC,aAAT,CAAuB,mBAAvB,CAAzB;AACAqB,oBAAgB,CAACC,gBAAjB,CAAkC,OAAlC,EAA2CC,cAA3C;AACH,GAZD;AAaH,CAjBD;;AAmBA,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,GAAM;AACzBjB,cAAY,GAAGH,cAAc,CAACI,OAAf,CAAuB,cAAvB,CAAf;AACAC,aAAW,GAAGL,cAAc,CAACI,OAAf,CAAuB,YAAvB,CAAd;AACAE,OAAK,CAACC,GAAG,GAAG,wBAAP,EAAiC;AAClCC,UAAM,EAAE,MAD0B;AAElCC,QAAI,EAAE,MAF4B;AAGlCC,WAAO,EAAE;AACL,sBAAgB,kBADX;AAEL,qBAAeL;AAFV,KAHyB;AAOlCM,QAAI,EAAER;AAP4B,GAAjC,CAAL,CAQGS,IARH,CAQQ,UAAAC,QAAQ;AAAA,WAAIA,QAAQ,CAACC,IAAT,EAAJ;AAAA,GARhB,EAQqCF,IARrC,CAQ0C,UAAAG,IAAI,EAAI;AAC9CC,WAAO,CAACC,GAAR,CAAYF,IAAZ;AACAnB,YAAQ,CAACC,aAAT,CAAuB,uBAAvB,EAAgDK,SAAhD,GAA4Da,IAAI,CAACA,IAAL,CAAUM,WAAV,GAAsB,eAAtB,GAAsCN,IAAI,CAACA,IAAL,CAAUO,QAAhD,GAAyD,aAAzD,GAAuEP,IAAI,CAACA,IAAL,CAAUQ,GAAjF,GAAqF,gBAArF,GAAsGR,IAAI,CAACA,IAAL,CAAUS,aAA5K;AACH,GAXD;AAYH,CAfD;;AAiBA7B,WAAW,CAACwB,gBAAZ,CAA6B,OAA7B,EAAsClB,oBAAtC,E","file":"out-mobile_access.js","sourcesContent":["const registered_ = document.querySelector('#mobile_access_');\n\nmyStorage = window.sessionStorage;\n\nconst getRegisteredDevices = () => {\n document.querySelector('#content').innerHTML = '<button id=\"register_device_\">ZAJERESTRUJ URZĄDZENIE</button><div id=\"register_device_data\"></div><br />Here is registered mobile devices (in my imagination)';\n cookies_data = sessionStorage.getItem('cookies_data');\n csrfcookie_ = sessionStorage.getItem('csrfcookie');\n fetch(url = '../api/mobile/registered', {\n method: 'POST',\n mode: 'cors',\n headers: {\n 'Content-Type': 'application/json',\n 'X-CSRFToken': csrfcookie_\n },\n body: cookies_data\n }).then(response => response.json()).then(data => {\n console.log(data);\n const register_device_ = document.querySelector('#register_device_');\n register_device_.addEventListener('click', registerDevice);\n })\n}\n\nconst registerDevice = () => {\n cookies_data = sessionStorage.getItem('cookies_data');\n csrfcookie_ = sessionStorage.getItem('csrfcookie');\n fetch(url = '../api/mobile/register', {\n method: 'POST',\n mode: 'cors',\n headers: {\n 'Content-Type': 'application/json',\n 'X-CSRFToken': csrfcookie_\n },\n body: cookies_data\n }).then(response => response.json()).then(data => {\n console.log(data);\n document.querySelector('#register_device_data').innerHTML = data.data.QrCodeImage+'<br /> TOKEN:'+data.data.TokenKey+'<br /> PIN:'+data.data.PIN+'<br /> SYMBOL:'+data.data.CustomerGroup;\n })\n}\n\nregistered_.addEventListener('click', getRegisteredDevices);"],"sourceRoot":""}

46
frontend/files/js/dist/out-notes.js vendored Normal file
View file

@ -0,0 +1,46 @@
/******/ (function() { // webpackBootstrap
/*!*************************************!*\
!*** ./static/frontend/js/notes.js ***!
\*************************************/
var notes_ = document.querySelector('#notes_');
content = document.getElementById("content");
myStorage = window.sessionStorage;
var getNotes = function getNotes() {
content.innerHTML = "";
cookies_data = sessionStorage.getItem('cookies_data');
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/notes', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
}).then(function (response) {
return response.json();
}).then(function (data) {
var uwagi = data.data.Uwagi;
var osiagniecia = data.data.Osiagniecia;
console.log(data);
var uwagiList = document.createElement("ul");
uwagiList.id = "notesList";
content.append(uwagiList);
uwagi.forEach(function (uwaga) {
uwagaElement = document.createElement("li");
uwagaElement.innerHTML = "<div class=\"noteElement\"><h6 style=\"display:block; margin-top: -5px;\">".concat(uwaga.Kategoria, "</h6><span style=\"display:block; float: right; margin-top: -25px; font-size: 13px;\">").concat(uwaga.Nauczyciel, "</span><span style=\"display:block; width: 50%; font-size: 12px;\">").concat(uwaga.TrescUwagi, "</span><span style=\"float:right; font-size: 20px; margin-top: -20px; font-weight: 700;\">").concat(uwaga.Punkty, "</span></div>");
uwagiList.append(uwagaElement);
});
osiagniecia.forEach(function (osiagniecie) {
osiagniecieElement = document.createElement("li");
osiagniecieElement.innerHTML = "<div class=\"achievementElement\"><span>".concat(osiagniecie, "</span></div>");
uwagiList.append(osiagniecieElement);
});
});
};
notes_.addEventListener('click', getNotes);
/******/ })()
;
//# sourceMappingURL=out-notes.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["webpack://wulkanowy-web/./static/frontend/js/notes.js"],"names":["notes_","document","querySelector","content","getElementById","myStorage","window","sessionStorage","getNotes","innerHTML","cookies_data","getItem","csrfcookie_","fetch","url","method","mode","headers","body","then","response","json","data","uwagi","Uwagi","osiagniecia","Osiagniecia","console","log","uwagiList","createElement","id","append","forEach","uwaga","uwagaElement","Kategoria","Nauczyciel","TrescUwagi","Punkty","osiagniecie","osiagniecieElement","addEventListener"],"mappings":";;;;AAAA,IAAMA,MAAM,GAAGC,QAAQ,CAACC,aAAT,CAAuB,SAAvB,CAAf;AACAC,OAAO,GAAGF,QAAQ,CAACG,cAAT,CAAwB,SAAxB,CAAV;AAEAC,SAAS,GAAGC,MAAM,CAACC,cAAnB;;AAEA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,GAAM;AACnBL,SAAO,CAACM,SAAR,GAAoB,EAApB;AACAC,cAAY,GAAGH,cAAc,CAACI,OAAf,CAAuB,cAAvB,CAAf;AACAC,aAAW,GAAGL,cAAc,CAACI,OAAf,CAAuB,YAAvB,CAAd;AACAE,OAAK,CAACC,GAAG,GAAG,cAAP,EAAuB;AACxBC,UAAM,EAAE,MADgB;AAExBC,QAAI,EAAE,MAFkB;AAGxBC,WAAO,EAAE;AACL,sBAAgB,kBADX;AAEL,qBAAeL;AAFV,KAHe;AAOxBM,QAAI,EAAER;AAPkB,GAAvB,CAAL,CAQGS,IARH,CAQQ,UAAAC,QAAQ;AAAA,WAAIA,QAAQ,CAACC,IAAT,EAAJ;AAAA,GARhB,EAQqCF,IARrC,CAQ0C,UAAAG,IAAI,EAAI;AAC9C,QAAMC,KAAK,GAAGD,IAAI,CAACA,IAAL,CAAUE,KAAxB;AACA,QAAMC,WAAW,GAAGH,IAAI,CAACA,IAAL,CAAUI,WAA9B;AACAC,WAAO,CAACC,GAAR,CAAYN,IAAZ;AAEA,QAAMO,SAAS,GAAG5B,QAAQ,CAAC6B,aAAT,CAAuB,IAAvB,CAAlB;AACAD,aAAS,CAACE,EAAV,GAAe,WAAf;AACA5B,WAAO,CAAC6B,MAAR,CAAeH,SAAf;AAEAN,SAAK,CAACU,OAAN,CAAc,UAACC,KAAD,EAAW;AACrBC,kBAAY,GAAGlC,QAAQ,CAAC6B,aAAT,CAAuB,IAAvB,CAAf;AACAK,kBAAY,CAAC1B,SAAb,uFAAkGyB,KAAK,CAACE,SAAxG,mGAAwMF,KAAK,CAACG,UAA9M,gFAA4RH,KAAK,CAACI,UAAlS,uGAAuYJ,KAAK,CAACK,MAA7Y;AACAV,eAAS,CAACG,MAAV,CAAiBG,YAAjB;AACH,KAJD;AAMAV,eAAW,CAACQ,OAAZ,CAAoB,UAACO,WAAD,EAAiB;AACjCC,wBAAkB,GAAGxC,QAAQ,CAAC6B,aAAT,CAAuB,IAAvB,CAArB;AACAW,wBAAkB,CAAChC,SAAnB,qDAAwE+B,WAAxE;AACAX,eAAS,CAACG,MAAV,CAAiBS,kBAAjB;AACH,KAJD;AAKH,GA5BD;AA6BH,CAjCD;;AAmCAzC,MAAM,CAAC0C,gBAAP,CAAwB,OAAxB,EAAiClC,QAAjC,E","file":"out-notes.js","sourcesContent":["const notes_ = document.querySelector('#notes_');\ncontent = document.getElementById(\"content\")\n\nmyStorage = window.sessionStorage;\n\nconst getNotes = () => {\n content.innerHTML = \"\"\n cookies_data = sessionStorage.getItem('cookies_data');\n csrfcookie_ = sessionStorage.getItem('csrfcookie');\n fetch(url = '../api/notes', {\n method: 'POST',\n mode: 'cors',\n headers: {\n 'Content-Type': 'application/json',\n 'X-CSRFToken': csrfcookie_\n },\n body: cookies_data\n }).then(response => response.json()).then(data => {\n const uwagi = data.data.Uwagi\n const osiagniecia = data.data.Osiagniecia\n console.log(data);\n\n const uwagiList = document.createElement(\"ul\")\n uwagiList.id = \"notesList\"\n content.append(uwagiList)\n\n uwagi.forEach((uwaga) => {\n uwagaElement = document.createElement(\"li\")\n uwagaElement.innerHTML = `<div class=\"noteElement\"><h6 style=\"display:block; margin-top: -5px;\">${uwaga.Kategoria}</h6><span style=\"display:block; float: right; margin-top: -25px; font-size: 13px;\">${uwaga.Nauczyciel}</span><span style=\"display:block; width: 50%; font-size: 12px;\">${uwaga.TrescUwagi}</span><span style=\"float:right; font-size: 20px; margin-top: -20px; font-weight: 700;\">${uwaga.Punkty}</span></div>`\n uwagiList.append(uwagaElement)\n })\n\n osiagniecia.forEach((osiagniecie) => {\n osiagniecieElement = document.createElement(\"li\")\n osiagniecieElement.innerHTML = `<div class=\"achievementElement\"><span>${osiagniecie}</span></div>`\n uwagiList.append(osiagniecieElement)\n })\n })\n}\n\nnotes_.addEventListener('click', getNotes);"],"sourceRoot":""}

22
frontend/files/js/dist/out-start.js vendored Normal file
View file

@ -0,0 +1,22 @@
/******/ (function() { // webpackBootstrap
/*!*************************************!*\
!*** ./static/frontend/js/start.js ***!
\*************************************/
var name_ = document.querySelector('#name');
var email_ = document.querySelector('#email');
myStorage = window.sessionStorage;
var studentName = function studentName() {
var cookies_data = JSON.parse(sessionStorage.getItem('cookies_data'));
name_.innerHTML = cookies_data['data']['register_r']['data'][0]['UczenImie'] + ' ' + cookies_data['data']['register_r']['data'][0]['UczenImie2'] + ' ' + cookies_data['data']['register_r']['data'][0]['UczenNazwisko'];
};
var studentEmail = function studentEmail() {
email_.innerHTML = sessionStorage.getItem('email');
};
window.addEventListener('load', studentName);
window.addEventListener('load', studentEmail);
/******/ })()
;
//# sourceMappingURL=out-start.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["webpack://wulkanowy-web/./static/frontend/js/start.js"],"names":["name_","document","querySelector","email_","myStorage","window","sessionStorage","studentName","cookies_data","JSON","parse","getItem","innerHTML","studentEmail","addEventListener"],"mappings":";;;;AAAA,IAAMA,KAAK,GAAGC,QAAQ,CAACC,aAAT,CAAuB,OAAvB,CAAd;AACA,IAAMC,MAAM,GAAGF,QAAQ,CAACC,aAAT,CAAuB,QAAvB,CAAf;AAEAE,SAAS,GAAGC,MAAM,CAACC,cAAnB;;AAEA,IAAMC,WAAW,GAAG,SAAdA,WAAc,GAAM;AACtB,MAAMC,YAAY,GAAGC,IAAI,CAACC,KAAL,CAAWJ,cAAc,CAACK,OAAf,CAAuB,cAAvB,CAAX,CAArB;AACAX,OAAK,CAACY,SAAN,GAAkBJ,YAAY,CAAC,MAAD,CAAZ,CAAqB,YAArB,EAAmC,MAAnC,EAA2C,CAA3C,EAA8C,WAA9C,IAA2D,GAA3D,GAA+DA,YAAY,CAAC,MAAD,CAAZ,CAAqB,YAArB,EAAmC,MAAnC,EAA2C,CAA3C,EAA8C,YAA9C,CAA/D,GAA2H,GAA3H,GAA+HA,YAAY,CAAC,MAAD,CAAZ,CAAqB,YAArB,EAAmC,MAAnC,EAA2C,CAA3C,EAA8C,eAA9C,CAAjJ;AACH,CAHD;;AAKA,IAAMK,YAAY,GAAG,SAAfA,YAAe,GAAM;AACvBV,QAAM,CAACS,SAAP,GAAmBN,cAAc,CAACK,OAAf,CAAuB,OAAvB,CAAnB;AACH,CAFD;;AAIAN,MAAM,CAACS,gBAAP,CAAwB,MAAxB,EAAgCP,WAAhC;AACAF,MAAM,CAACS,gBAAP,CAAwB,MAAxB,EAAgCD,YAAhC,E","file":"out-start.js","sourcesContent":["const name_ = document.querySelector('#name');\nconst email_ = document.querySelector('#email');\n\nmyStorage = window.sessionStorage;\n\nconst studentName = () => {\n const cookies_data = JSON.parse(sessionStorage.getItem('cookies_data'))\n name_.innerHTML = cookies_data['data']['register_r']['data'][0]['UczenImie']+' '+cookies_data['data']['register_r']['data'][0]['UczenImie2']+' '+cookies_data['data']['register_r']['data'][0]['UczenNazwisko']\n};\n\nconst studentEmail = () => {\n email_.innerHTML = sessionStorage.getItem('email') \n};\n\nwindow.addEventListener('load', studentName);\nwindow.addEventListener('load', studentEmail);"],"sourceRoot":""}

30
frontend/files/js/dist/out-timetable.js vendored Normal file
View file

@ -0,0 +1,30 @@
/******/ (function() { // webpackBootstrap
/*!*****************************************!*\
!*** ./static/frontend/js/timetable.js ***!
\*****************************************/
var timetable_ = document.querySelector('#timetable_');
myStorage = window.sessionStorage;
var getTimetable = function getTimetable() {
document.querySelector('#content').innerHTML = 'Here is timetable (in my imagination)';
cookies_data = sessionStorage.getItem('cookies_data');
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/timetable', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
}).then(function (response) {
return response.json();
}).then(function (data) {
console.log(data);
});
};
timetable_.addEventListener('click', getTimetable);
/******/ })()
;
//# sourceMappingURL=out-timetable.js.map

View file

@ -0,0 +1 @@
{"version":3,"sources":["webpack://wulkanowy-web/./static/frontend/js/timetable.js"],"names":["timetable_","document","querySelector","myStorage","window","sessionStorage","getTimetable","innerHTML","cookies_data","getItem","csrfcookie_","fetch","url","method","mode","headers","body","then","response","json","data","console","log","addEventListener"],"mappings":";;;;AAAA,IAAMA,UAAU,GAAGC,QAAQ,CAACC,aAAT,CAAuB,aAAvB,CAAnB;AAEAC,SAAS,GAAGC,MAAM,CAACC,cAAnB;;AAEA,IAAMC,YAAY,GAAG,SAAfA,YAAe,GAAM;AACvBL,UAAQ,CAACC,aAAT,CAAuB,UAAvB,EAAmCK,SAAnC,GAA+C,uCAA/C;AACAC,cAAY,GAAGH,cAAc,CAACI,OAAf,CAAuB,cAAvB,CAAf;AACAC,aAAW,GAAGL,cAAc,CAACI,OAAf,CAAuB,YAAvB,CAAd;AACAE,OAAK,CAACC,GAAG,GAAG,kBAAP,EAA2B;AAC5BC,UAAM,EAAE,MADoB;AAE5BC,QAAI,EAAE,MAFsB;AAG5BC,WAAO,EAAE;AACL,sBAAgB,kBADX;AAEL,qBAAeL;AAFV,KAHmB;AAO5BM,QAAI,EAAER;AAPsB,GAA3B,CAAL,CAQGS,IARH,CAQQ,UAAAC,QAAQ;AAAA,WAAIA,QAAQ,CAACC,IAAT,EAAJ;AAAA,GARhB,EAQqCF,IARrC,CAQ0C,UAAAG,IAAI,EAAI;AAC9CC,WAAO,CAACC,GAAR,CAAYF,IAAZ;AACH,GAVD;AAWH,CAfD;;AAiBApB,UAAU,CAACuB,gBAAX,CAA4B,OAA5B,EAAqCjB,YAArC,E","file":"out-timetable.js","sourcesContent":["const timetable_ = document.querySelector('#timetable_');\n\nmyStorage = window.sessionStorage;\n\nconst getTimetable = () => {\n document.querySelector('#content').innerHTML = 'Here is timetable (in my imagination)';\n cookies_data = sessionStorage.getItem('cookies_data');\n csrfcookie_ = sessionStorage.getItem('csrfcookie');\n fetch(url = '../api/timetable', {\n method: 'POST',\n mode: 'cors',\n headers: {\n 'Content-Type': 'application/json',\n 'X-CSRFToken': csrfcookie_\n },\n body: cookies_data\n }).then(response => response.json()).then(data => {\n console.log(data)\n })\n}\n\ntimetable_.addEventListener('click', getTimetable);"],"sourceRoot":""}

View file

3
frontend/models.py Normal file
View file

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

1
frontend/node_modules/.bin/acorn generated vendored Symbolic link
View file

@ -0,0 +1 @@
../acorn/bin/acorn

1
frontend/node_modules/.bin/browserslist generated vendored Symbolic link
View file

@ -0,0 +1 @@
../browserslist/cli.js

1
frontend/node_modules/.bin/envinfo generated vendored Symbolic link
View file

@ -0,0 +1 @@
../envinfo/dist/cli.js

1
frontend/node_modules/.bin/import-local-fixture generated vendored Symbolic link
View file

@ -0,0 +1 @@
../import-local/fixtures/cli.js

1
frontend/node_modules/.bin/jsesc generated vendored Symbolic link
View file

@ -0,0 +1 @@
../jsesc/bin/jsesc

1
frontend/node_modules/.bin/json5 generated vendored Symbolic link
View file

@ -0,0 +1 @@
../json5/lib/cli.js

1
frontend/node_modules/.bin/node-which generated vendored Symbolic link
View file

@ -0,0 +1 @@
../which/bin/node-which

1
frontend/node_modules/.bin/parser generated vendored Symbolic link
View file

@ -0,0 +1 @@
../@babel/parser/bin/babel-parser.js

1
frontend/node_modules/.bin/regjsparser generated vendored Symbolic link
View file

@ -0,0 +1 @@
../regjsparser/bin/parser

1
frontend/node_modules/.bin/semver generated vendored Symbolic link
View file

@ -0,0 +1 @@
../semver/bin/semver

1
frontend/node_modules/.bin/terser generated vendored Symbolic link
View file

@ -0,0 +1 @@
../terser/bin/terser

1
frontend/node_modules/.bin/webpack generated vendored Symbolic link
View file

@ -0,0 +1 @@
../webpack/bin/webpack.js

1
frontend/node_modules/.bin/webpack-cli generated vendored Symbolic link
View file

@ -0,0 +1 @@
../webpack-cli/bin/cli.js

22
frontend/node_modules/@babel/code-frame/LICENSE generated vendored Normal file
View file

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.

19
frontend/node_modules/@babel/code-frame/README.md generated vendored Normal file
View file

@ -0,0 +1,19 @@
# @babel/code-frame
> Generate errors that contain a code frame that point to source locations.
See our website [@babel/code-frame](https://babeljs.io/docs/en/babel-code-frame) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/code-frame
```
or using yarn:
```sh
yarn add @babel/code-frame --dev
```

167
frontend/node_modules/@babel/code-frame/lib/index.js generated vendored Normal file
View file

@ -0,0 +1,167 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.codeFrameColumns = codeFrameColumns;
exports.default = _default;
var _highlight = _interopRequireWildcard(require("@babel/highlight"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
let deprecationWarningShown = false;
function getDefs(chalk) {
return {
gutter: chalk.grey,
marker: chalk.red.bold,
message: chalk.red.bold
};
}
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
function getMarkerLines(loc, source, opts) {
const startLoc = Object.assign({
column: 0,
line: -1
}, loc.start);
const endLoc = Object.assign({}, startLoc, loc.end);
const {
linesAbove = 2,
linesBelow = 3
} = opts || {};
const startLine = startLoc.line;
const startColumn = startLoc.column;
const endLine = endLoc.line;
const endColumn = endLoc.column;
let start = Math.max(startLine - (linesAbove + 1), 0);
let end = Math.min(source.length, endLine + linesBelow);
if (startLine === -1) {
start = 0;
}
if (endLine === -1) {
end = source.length;
}
const lineDiff = endLine - startLine;
const markerLines = {};
if (lineDiff) {
for (let i = 0; i <= lineDiff; i++) {
const lineNumber = i + startLine;
if (!startColumn) {
markerLines[lineNumber] = true;
} else if (i === 0) {
const sourceLength = source[lineNumber - 1].length;
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
} else if (i === lineDiff) {
markerLines[lineNumber] = [0, endColumn];
} else {
const sourceLength = source[lineNumber - i].length;
markerLines[lineNumber] = [0, sourceLength];
}
}
} else {
if (startColumn === endColumn) {
if (startColumn) {
markerLines[startLine] = [startColumn, 0];
} else {
markerLines[startLine] = true;
}
} else {
markerLines[startLine] = [startColumn, endColumn - startColumn];
}
}
return {
start,
end,
markerLines
};
}
function codeFrameColumns(rawLines, loc, opts = {}) {
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
const chalk = (0, _highlight.getChalk)(opts);
const defs = getDefs(chalk);
const maybeHighlight = (chalkFn, string) => {
return highlighted ? chalkFn(string) : string;
};
const lines = rawLines.split(NEWLINE);
const {
start,
end,
markerLines
} = getMarkerLines(loc, lines, opts);
const hasColumns = loc.start && typeof loc.start.column === "number";
const numberMaxWidth = String(end).length;
const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
const number = start + 1 + index;
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
const gutter = ` ${paddedNumber} | `;
const hasMarker = markerLines[number];
const lastMarkerLine = !markerLines[number + 1];
if (hasMarker) {
let markerLine = "";
if (Array.isArray(hasMarker)) {
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
const numberOfMarkers = hasMarker[1] || 1;
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
if (lastMarkerLine && opts.message) {
markerLine += " " + maybeHighlight(defs.message, opts.message);
}
}
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
} else {
return ` ${maybeHighlight(defs.gutter, gutter)}${line}`;
}
}).join("\n");
if (opts.message && !hasColumns) {
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
}
if (highlighted) {
return chalk.reset(frame);
} else {
return frame;
}
}
function _default(rawLines, lineNumber, colNumber, opts = {}) {
if (!deprecationWarningShown) {
deprecationWarningShown = true;
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
if (process.emitWarning) {
process.emitWarning(message, "DeprecationWarning");
} else {
const deprecationError = new Error(message);
deprecationError.name = "DeprecationWarning";
console.warn(new Error(message));
}
}
colNumber = Math.max(colNumber, 0);
const location = {
start: {
column: colNumber,
line: lineNumber
}
};
return codeFrameColumns(rawLines, location, opts);
}

59
frontend/node_modules/@babel/code-frame/package.json generated vendored Normal file
View file

@ -0,0 +1,59 @@
{
"_from": "@babel/code-frame@^7.10.4",
"_id": "@babel/code-frame@7.12.11",
"_inBundle": false,
"_integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==",
"_location": "/@babel/code-frame",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/code-frame@^7.10.4",
"name": "@babel/code-frame",
"escapedName": "@babel%2fcode-frame",
"scope": "@babel",
"rawSpec": "^7.10.4",
"saveSpec": null,
"fetchSpec": "^7.10.4"
},
"_requiredBy": [
"/@babel/core",
"/@babel/template",
"/@babel/traverse"
],
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz",
"_shasum": "f4ad435aa263db935b8f10f2c552d23fb716a63f",
"_spec": "@babel/code-frame@^7.10.4",
"_where": "/home/pengwius/Pulpit/git/wulkanowy-web/frontend/node_modules/@babel/core",
"author": {
"name": "Sebastian McKenzie",
"email": "sebmck@gmail.com"
},
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"bundleDependencies": false,
"dependencies": {
"@babel/highlight": "^7.10.4"
},
"deprecated": false,
"description": "Generate errors that contain a code frame that point to source locations.",
"devDependencies": {
"@types/chalk": "^2.0.0",
"chalk": "^2.0.0",
"strip-ansi": "^4.0.0"
},
"homepage": "https://babeljs.io/",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/code-frame",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/babel/babel.git",
"directory": "packages/babel-code-frame"
},
"version": "7.12.11"
}

22
frontend/node_modules/@babel/compat-data/LICENSE generated vendored Normal file
View file

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.

View file

@ -0,0 +1,4 @@
// Node < 13.3 doesn't support export maps in package.json.
// Use this proxy file as a fallback.
module.exports = require("./data/corejs2-built-ins.json");

View file

@ -0,0 +1,4 @@
// Node < 13.3 doesn't support export maps in package.json.
// Use this proxy file as a fallback.
module.exports = require("./data/corejs3-shipped-proposals.json");

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,5 @@
[
"esnext.global-this",
"esnext.promise.all-settled",
"esnext.string.match-all"
]

View file

@ -0,0 +1,17 @@
{
"es6.module": {
"chrome": "61",
"and_chr": "61",
"edge": "16",
"firefox": "60",
"and_ff": "60",
"node": "13.2.0",
"opera": "48",
"op_mob": "48",
"safari": "10.1",
"ios_saf": "10.3",
"samsung": "8.2",
"android": "61",
"electron": "2.0"
}
}

View file

@ -0,0 +1,18 @@
{
"transform-async-to-generator": [
"bugfix/transform-async-arrows-in-class"
],
"transform-parameters": [
"bugfix/transform-edge-default-parameters"
],
"transform-function-name": [
"bugfix/transform-edge-function-name"
],
"transform-block-scoping": [
"bugfix/transform-safari-block-shadowing",
"bugfix/transform-safari-for-shadowing"
],
"transform-template-literals": [
"bugfix/transform-tagged-template-caching"
]
}

View file

@ -0,0 +1,125 @@
{
"transform-async-to-generator": {
"chrome": "55",
"opera": "42",
"edge": "15",
"firefox": "52",
"safari": "10.1",
"node": "7.6",
"ios": "10.3",
"samsung": "6",
"electron": "1.6"
},
"bugfix/transform-async-arrows-in-class": {
"chrome": "55",
"opera": "42",
"edge": "15",
"firefox": "52",
"safari": "11",
"node": "7.6",
"ios": "11",
"samsung": "6",
"electron": "1.6"
},
"transform-parameters": {
"chrome": "49",
"opera": "36",
"edge": "15",
"firefox": "53",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"electron": "0.37"
},
"bugfix/transform-edge-default-parameters": {
"chrome": "49",
"opera": "36",
"edge": "18",
"firefox": "52",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"electron": "0.37"
},
"transform-function-name": {
"chrome": "51",
"opera": "38",
"edge": "14",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"samsung": "5",
"electron": "1.2"
},
"bugfix/transform-edge-function-name": {
"chrome": "51",
"opera": "38",
"edge": "79",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"samsung": "5",
"electron": "1.2"
},
"transform-block-scoping": {
"chrome": "49",
"opera": "36",
"edge": "14",
"firefox": "51",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"electron": "0.37"
},
"bugfix/transform-safari-block-shadowing": {
"chrome": "49",
"opera": "36",
"edge": "12",
"firefox": "44",
"safari": "11",
"node": "6",
"ie": "11",
"ios": "11",
"samsung": "5",
"electron": "0.37"
},
"bugfix/transform-safari-for-shadowing": {
"chrome": "49",
"opera": "36",
"edge": "12",
"firefox": "4",
"safari": "11",
"node": "6",
"ie": "11",
"ios": "11",
"samsung": "5",
"electron": "0.37"
},
"transform-template-literals": {
"chrome": "41",
"opera": "28",
"edge": "13",
"firefox": "34",
"safari": "9",
"node": "4",
"ios": "9",
"samsung": "3.4",
"electron": "0.21"
},
"bugfix/transform-tagged-template-caching": {
"chrome": "41",
"opera": "28",
"edge": "12",
"firefox": "34",
"safari": "13",
"node": "4",
"ios": "13",
"samsung": "3.4",
"electron": "0.21"
}
}

View file

@ -0,0 +1,442 @@
{
"proposal-class-properties": {
"chrome": "74",
"opera": "62",
"edge": "79",
"node": "12",
"samsung": "11",
"electron": "6.0"
},
"proposal-private-methods": {
"chrome": "84",
"opera": "70",
"edge": "84",
"node": "14.6",
"electron": "10.0"
},
"proposal-numeric-separator": {
"chrome": "75",
"opera": "62",
"edge": "79",
"firefox": "70",
"safari": "13",
"node": "12.5",
"ios": "13",
"samsung": "11",
"electron": "6.0"
},
"proposal-logical-assignment-operators": {
"chrome": "85",
"firefox": "79",
"safari": "14",
"node": "15",
"electron": "10.0"
},
"proposal-nullish-coalescing-operator": {
"chrome": "80",
"opera": "67",
"edge": "80",
"firefox": "72",
"safari": "13.1",
"node": "14",
"ios": "13.4",
"samsung": "13",
"electron": "8.0"
},
"proposal-optional-chaining": {
"chrome": "80",
"opera": "67",
"edge": "80",
"firefox": "74",
"safari": "13.1",
"node": "14",
"ios": "13.4",
"samsung": "13",
"electron": "8.0"
},
"proposal-json-strings": {
"chrome": "66",
"opera": "53",
"edge": "79",
"firefox": "62",
"safari": "12",
"node": "10",
"ios": "12",
"samsung": "9",
"electron": "3.0"
},
"proposal-optional-catch-binding": {
"chrome": "66",
"opera": "53",
"edge": "79",
"firefox": "58",
"safari": "11.1",
"node": "10",
"ios": "11.3",
"samsung": "9",
"electron": "3.0"
},
"transform-parameters": {
"chrome": "49",
"opera": "36",
"edge": "18",
"firefox": "53",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"electron": "0.37"
},
"proposal-async-generator-functions": {
"chrome": "63",
"opera": "50",
"edge": "79",
"firefox": "57",
"safari": "12",
"node": "10",
"ios": "12",
"samsung": "8",
"electron": "3.0"
},
"proposal-object-rest-spread": {
"chrome": "60",
"opera": "47",
"edge": "79",
"firefox": "55",
"safari": "11.1",
"node": "8.3",
"ios": "11.3",
"samsung": "8",
"electron": "2.0"
},
"transform-dotall-regex": {
"chrome": "62",
"opera": "49",
"edge": "79",
"firefox": "78",
"safari": "11.1",
"node": "8.10",
"ios": "11.3",
"samsung": "8",
"electron": "3.0"
},
"proposal-unicode-property-regex": {
"chrome": "64",
"opera": "51",
"edge": "79",
"firefox": "78",
"safari": "11.1",
"node": "10",
"ios": "11.3",
"samsung": "9",
"electron": "3.0"
},
"transform-named-capturing-groups-regex": {
"chrome": "64",
"opera": "51",
"edge": "79",
"firefox": "78",
"safari": "11.1",
"node": "10",
"ios": "11.3",
"samsung": "9",
"electron": "3.0"
},
"transform-async-to-generator": {
"chrome": "55",
"opera": "42",
"edge": "15",
"firefox": "52",
"safari": "11",
"node": "7.6",
"ios": "11",
"samsung": "6",
"electron": "1.6"
},
"transform-exponentiation-operator": {
"chrome": "52",
"opera": "39",
"edge": "14",
"firefox": "52",
"safari": "10.1",
"node": "7",
"ios": "10.3",
"samsung": "6",
"electron": "1.3"
},
"transform-template-literals": {
"chrome": "41",
"opera": "28",
"edge": "13",
"firefox": "34",
"safari": "13",
"node": "4",
"ios": "13",
"samsung": "3.4",
"electron": "0.21"
},
"transform-literals": {
"chrome": "44",
"opera": "31",
"edge": "12",
"firefox": "53",
"safari": "9",
"node": "4",
"ios": "9",
"samsung": "4",
"electron": "0.30"
},
"transform-function-name": {
"chrome": "51",
"opera": "38",
"edge": "79",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"samsung": "5",
"electron": "1.2"
},
"transform-arrow-functions": {
"chrome": "47",
"opera": "34",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"electron": "0.36"
},
"transform-block-scoped-functions": {
"chrome": "41",
"opera": "28",
"edge": "12",
"firefox": "46",
"safari": "10",
"node": "4",
"ie": "11",
"ios": "10",
"samsung": "3.4",
"electron": "0.21"
},
"transform-classes": {
"chrome": "46",
"opera": "33",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "5",
"ios": "10",
"samsung": "5",
"electron": "0.36"
},
"transform-object-super": {
"chrome": "46",
"opera": "33",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "5",
"ios": "10",
"samsung": "5",
"electron": "0.36"
},
"transform-shorthand-properties": {
"chrome": "43",
"opera": "30",
"edge": "12",
"firefox": "33",
"safari": "9",
"node": "4",
"ios": "9",
"samsung": "4",
"electron": "0.27"
},
"transform-duplicate-keys": {
"chrome": "42",
"opera": "29",
"edge": "12",
"firefox": "34",
"safari": "9",
"node": "4",
"ios": "9",
"samsung": "3.4",
"electron": "0.25"
},
"transform-computed-properties": {
"chrome": "44",
"opera": "31",
"edge": "12",
"firefox": "34",
"safari": "7.1",
"node": "4",
"ios": "8",
"samsung": "4",
"electron": "0.30"
},
"transform-for-of": {
"chrome": "51",
"opera": "38",
"edge": "15",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"samsung": "5",
"electron": "1.2"
},
"transform-sticky-regex": {
"chrome": "49",
"opera": "36",
"edge": "13",
"firefox": "3",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"electron": "0.37"
},
"transform-unicode-escapes": {
"chrome": "44",
"opera": "31",
"edge": "12",
"firefox": "53",
"safari": "9",
"node": "4",
"ios": "9",
"samsung": "4",
"electron": "0.30"
},
"transform-unicode-regex": {
"chrome": "50",
"opera": "37",
"edge": "13",
"firefox": "46",
"safari": "12",
"node": "6",
"ios": "12",
"samsung": "5",
"electron": "1.1"
},
"transform-spread": {
"chrome": "46",
"opera": "33",
"edge": "13",
"firefox": "36",
"safari": "10",
"node": "5",
"ios": "10",
"samsung": "5",
"electron": "0.36"
},
"transform-destructuring": {
"chrome": "51",
"opera": "38",
"edge": "15",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"samsung": "5",
"electron": "1.2"
},
"transform-block-scoping": {
"chrome": "49",
"opera": "36",
"edge": "14",
"firefox": "51",
"safari": "11",
"node": "6",
"ios": "11",
"samsung": "5",
"electron": "0.37"
},
"transform-typeof-symbol": {
"chrome": "38",
"opera": "25",
"edge": "12",
"firefox": "36",
"safari": "9",
"node": "0.12",
"ios": "9",
"samsung": "3",
"electron": "0.20"
},
"transform-new-target": {
"chrome": "46",
"opera": "33",
"edge": "14",
"firefox": "41",
"safari": "10",
"node": "5",
"ios": "10",
"samsung": "5",
"electron": "0.36"
},
"transform-regenerator": {
"chrome": "50",
"opera": "37",
"edge": "13",
"firefox": "53",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"electron": "1.1"
},
"transform-member-expression-literals": {
"chrome": "7",
"opera": "12",
"edge": "12",
"firefox": "2",
"safari": "5.1",
"node": "0.10",
"ie": "9",
"android": "4",
"ios": "6",
"phantom": "2",
"samsung": "1",
"electron": "0.20"
},
"transform-property-literals": {
"chrome": "7",
"opera": "12",
"edge": "12",
"firefox": "2",
"safari": "5.1",
"node": "0.10",
"ie": "9",
"android": "4",
"ios": "6",
"phantom": "2",
"samsung": "1",
"electron": "0.20"
},
"transform-reserved-words": {
"chrome": "13",
"opera": "10.50",
"edge": "12",
"firefox": "2",
"safari": "3.1",
"node": "0.10",
"ie": "9",
"android": "4.4",
"ios": "6",
"phantom": "2",
"samsung": "1",
"electron": "0.20"
},
"proposal-export-namespace-from": {
"chrome": "72",
"and_chr": "72",
"edge": "79",
"firefox": "80",
"node": "13.2",
"opera": "60",
"op_mob": "51",
"samsung": "11.0",
"android": "72",
"electron": "5.0"
}
}

View file

@ -0,0 +1,4 @@
// Node < 13.3 doesn't support export maps in package.json.
// Use this proxy file as a fallback.
module.exports = require("./data/native-modules.json");

View file

@ -0,0 +1,4 @@
// Node < 13.3 doesn't support export maps in package.json.
// Use this proxy file as a fallback.
module.exports = require("./data/overlapping-plugins.json");

70
frontend/node_modules/@babel/compat-data/package.json generated vendored Normal file
View file

@ -0,0 +1,70 @@
{
"_from": "@babel/compat-data@^7.12.7",
"_id": "@babel/compat-data@7.12.7",
"_inBundle": false,
"_integrity": "sha512-YaxPMGs/XIWtYqrdEOZOCPsVWfEoriXopnsz3/i7apYPXQ3698UFhS6dVT1KN5qOsWmVgw/FOrmQgpRaZayGsw==",
"_location": "/@babel/compat-data",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/compat-data@^7.12.7",
"name": "@babel/compat-data",
"escapedName": "@babel%2fcompat-data",
"scope": "@babel",
"rawSpec": "^7.12.7",
"saveSpec": null,
"fetchSpec": "^7.12.7"
},
"_requiredBy": [
"/@babel/helper-compilation-targets",
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.12.7.tgz",
"_shasum": "9329b4782a7d6bbd7eef57e11addf91ee3ef1e41",
"_spec": "@babel/compat-data@^7.12.7",
"_where": "/home/pengwius/Pulpit/git/wulkanowy-web/frontend/node_modules/@babel/preset-env",
"author": {
"name": "The Babel Team",
"url": "https://babeljs.io/team"
},
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "",
"devDependencies": {
"electron-to-chromium": "1.3.583",
"lodash": "^4.17.19",
"mdn-browser-compat-data": "1.0.38"
},
"exports": {
"./plugins": "./data/plugins.json",
"./native-modules": "./data/native-modules.json",
"./corejs2-built-ins": "./data/corejs2-built-ins.json",
"./corejs3-shipped-proposals": "./data/corejs3-shipped-proposals.json",
"./overlapping-plugins": "./data/overlapping-plugins.json",
"./plugin-bugfixes": "./data/plugin-bugfixes.json"
},
"homepage": "https://github.com/babel/babel#readme",
"keywords": [
"babel",
"compat-table",
"compat-data"
],
"license": "MIT",
"name": "@babel/compat-data",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/babel/babel.git",
"directory": "packages/babel-compat-data"
},
"scripts": {
"build-data": "./scripts/download-compat-table.sh && node ./scripts/build-data.js && node ./scripts/build-modules-support.js && node ./scripts/build-bugfixes-targets.js"
},
"version": "7.12.7"
}

View file

@ -0,0 +1,4 @@
// Node < 13.3 doesn't support export maps in package.json.
// Use this proxy file as a fallback.
module.exports = require("./data/plugin-bugfixes.json");

4
frontend/node_modules/@babel/compat-data/plugins.js generated vendored Normal file
View file

@ -0,0 +1,4 @@
// Node < 13.3 doesn't support export maps in package.json.
// Use this proxy file as a fallback.
module.exports = require("./data/plugins.json");

22
frontend/node_modules/@babel/core/LICENSE generated vendored Normal file
View file

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.

19
frontend/node_modules/@babel/core/README.md generated vendored Normal file
View file

@ -0,0 +1,19 @@
# @babel/core
> Babel compiler core.
See our website [@babel/core](https://babeljs.io/docs/en/babel-core) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package.
## Install
Using npm:
```sh
npm install --save-dev @babel/core
```
or using yarn:
```sh
yarn add @babel/core --dev
```

327
frontend/node_modules/@babel/core/lib/config/caching.js generated vendored Normal file
View file

@ -0,0 +1,327 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.makeWeakCache = makeWeakCache;
exports.makeWeakCacheSync = makeWeakCacheSync;
exports.makeStrongCache = makeStrongCache;
exports.makeStrongCacheSync = makeStrongCacheSync;
exports.assertSimpleType = assertSimpleType;
function _gensync() {
const data = _interopRequireDefault(require("gensync"));
_gensync = function () {
return data;
};
return data;
}
var _async = require("../gensync-utils/async");
var _util = require("./util");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const synchronize = gen => {
return (0, _gensync().default)(gen).sync;
};
function* genTrue(data) {
return true;
}
function makeWeakCache(handler) {
return makeCachedFunction(WeakMap, handler);
}
function makeWeakCacheSync(handler) {
return synchronize(makeWeakCache(handler));
}
function makeStrongCache(handler) {
return makeCachedFunction(Map, handler);
}
function makeStrongCacheSync(handler) {
return synchronize(makeStrongCache(handler));
}
function makeCachedFunction(CallCache, handler) {
const callCacheSync = new CallCache();
const callCacheAsync = new CallCache();
const futureCache = new CallCache();
return function* cachedFunction(arg, data) {
const asyncContext = yield* (0, _async.isAsync)();
const callCache = asyncContext ? callCacheAsync : callCacheSync;
const cached = yield* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data);
if (cached.valid) return cached.value;
const cache = new CacheConfigurator(data);
const handlerResult = handler(arg, cache);
let finishLock;
let value;
if ((0, _util.isIterableIterator)(handlerResult)) {
const gen = handlerResult;
value = yield* (0, _async.onFirstPause)(gen, () => {
finishLock = setupAsyncLocks(cache, futureCache, arg);
});
} else {
value = handlerResult;
}
updateFunctionCache(callCache, cache, arg, value);
if (finishLock) {
futureCache.delete(arg);
finishLock.release(value);
}
return value;
};
}
function* getCachedValue(cache, arg, data) {
const cachedValue = cache.get(arg);
if (cachedValue) {
for (const {
value,
valid
} of cachedValue) {
if (yield* valid(data)) return {
valid: true,
value
};
}
}
return {
valid: false,
value: null
};
}
function* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data) {
const cached = yield* getCachedValue(callCache, arg, data);
if (cached.valid) {
return cached;
}
if (asyncContext) {
const cached = yield* getCachedValue(futureCache, arg, data);
if (cached.valid) {
const value = yield* (0, _async.waitFor)(cached.value.promise);
return {
valid: true,
value
};
}
}
return {
valid: false,
value: null
};
}
function setupAsyncLocks(config, futureCache, arg) {
const finishLock = new Lock();
updateFunctionCache(futureCache, config, arg, finishLock);
return finishLock;
}
function updateFunctionCache(cache, config, arg, value) {
if (!config.configured()) config.forever();
let cachedValue = cache.get(arg);
config.deactivate();
switch (config.mode()) {
case "forever":
cachedValue = [{
value,
valid: genTrue
}];
cache.set(arg, cachedValue);
break;
case "invalidate":
cachedValue = [{
value,
valid: config.validator()
}];
cache.set(arg, cachedValue);
break;
case "valid":
if (cachedValue) {
cachedValue.push({
value,
valid: config.validator()
});
} else {
cachedValue = [{
value,
valid: config.validator()
}];
cache.set(arg, cachedValue);
}
}
}
class CacheConfigurator {
constructor(data) {
this._active = true;
this._never = false;
this._forever = false;
this._invalidate = false;
this._configured = false;
this._pairs = [];
this._data = void 0;
this._data = data;
}
simple() {
return makeSimpleConfigurator(this);
}
mode() {
if (this._never) return "never";
if (this._forever) return "forever";
if (this._invalidate) return "invalidate";
return "valid";
}
forever() {
if (!this._active) {
throw new Error("Cannot change caching after evaluation has completed.");
}
if (this._never) {
throw new Error("Caching has already been configured with .never()");
}
this._forever = true;
this._configured = true;
}
never() {
if (!this._active) {
throw new Error("Cannot change caching after evaluation has completed.");
}
if (this._forever) {
throw new Error("Caching has already been configured with .forever()");
}
this._never = true;
this._configured = true;
}
using(handler) {
if (!this._active) {
throw new Error("Cannot change caching after evaluation has completed.");
}
if (this._never || this._forever) {
throw new Error("Caching has already been configured with .never or .forever()");
}
this._configured = true;
const key = handler(this._data);
const fn = (0, _async.maybeAsync)(handler, `You appear to be using an async cache handler, but Babel has been called synchronously`);
if ((0, _async.isThenable)(key)) {
return key.then(key => {
this._pairs.push([key, fn]);
return key;
});
}
this._pairs.push([key, fn]);
return key;
}
invalidate(handler) {
this._invalidate = true;
return this.using(handler);
}
validator() {
const pairs = this._pairs;
return function* (data) {
for (const [key, fn] of pairs) {
if (key !== (yield* fn(data))) return false;
}
return true;
};
}
deactivate() {
this._active = false;
}
configured() {
return this._configured;
}
}
function makeSimpleConfigurator(cache) {
function cacheFn(val) {
if (typeof val === "boolean") {
if (val) cache.forever();else cache.never();
return;
}
return cache.using(() => assertSimpleType(val()));
}
cacheFn.forever = () => cache.forever();
cacheFn.never = () => cache.never();
cacheFn.using = cb => cache.using(() => assertSimpleType(cb()));
cacheFn.invalidate = cb => cache.invalidate(() => assertSimpleType(cb()));
return cacheFn;
}
function assertSimpleType(value) {
if ((0, _async.isThenable)(value)) {
throw new Error(`You appear to be using an async cache handler, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously handle your caching logic.`);
}
if (value != null && typeof value !== "string" && typeof value !== "boolean" && typeof value !== "number") {
throw new Error("Cache keys must be either string, boolean, number, null, or undefined.");
}
return value;
}
class Lock {
constructor() {
this.released = false;
this.promise = void 0;
this._resolve = void 0;
this.promise = new Promise(resolve => {
this._resolve = resolve;
});
}
release(value) {
this.released = true;
this._resolve(value);
}
}

View file

@ -0,0 +1,552 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.buildPresetChain = buildPresetChain;
exports.buildRootChain = buildRootChain;
exports.buildPresetChainWalker = void 0;
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _debug() {
const data = _interopRequireDefault(require("debug"));
_debug = function () {
return data;
};
return data;
}
var _options = require("./validation/options");
var _patternToRegex = _interopRequireDefault(require("./pattern-to-regex"));
var _printer = require("./printer");
var _files = require("./files");
var _caching = require("./caching");
var _configDescriptors = require("./config-descriptors");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const debug = (0, _debug().default)("babel:config:config-chain");
function* buildPresetChain(arg, context) {
const chain = yield* buildPresetChainWalker(arg, context);
if (!chain) return null;
return {
plugins: dedupDescriptors(chain.plugins),
presets: dedupDescriptors(chain.presets),
options: chain.options.map(o => normalizeOptions(o)),
files: new Set()
};
}
const buildPresetChainWalker = makeChainWalker({
root: preset => loadPresetDescriptors(preset),
env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName),
overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index),
overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName),
createLogger: () => () => {}
});
exports.buildPresetChainWalker = buildPresetChainWalker;
const loadPresetDescriptors = (0, _caching.makeWeakCacheSync)(preset => buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors));
const loadPresetEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName)));
const loadPresetOverridesDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index)));
const loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName))));
function* buildRootChain(opts, context) {
let configReport, babelRcReport;
const programmaticLogger = new _printer.ConfigPrinter();
const programmaticChain = yield* loadProgrammaticChain({
options: opts,
dirname: context.cwd
}, context, undefined, programmaticLogger);
if (!programmaticChain) return null;
const programmaticReport = programmaticLogger.output();
let configFile;
if (typeof opts.configFile === "string") {
configFile = yield* (0, _files.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller);
} else if (opts.configFile !== false) {
configFile = yield* (0, _files.findRootConfig)(context.root, context.envName, context.caller);
}
let {
babelrc,
babelrcRoots
} = opts;
let babelrcRootsDirectory = context.cwd;
const configFileChain = emptyChain();
const configFileLogger = new _printer.ConfigPrinter();
if (configFile) {
const validatedFile = validateConfigFile(configFile);
const result = yield* loadFileChain(validatedFile, context, undefined, configFileLogger);
if (!result) return null;
configReport = configFileLogger.output();
if (babelrc === undefined) {
babelrc = validatedFile.options.babelrc;
}
if (babelrcRoots === undefined) {
babelrcRootsDirectory = validatedFile.dirname;
babelrcRoots = validatedFile.options.babelrcRoots;
}
mergeChain(configFileChain, result);
}
const pkgData = typeof context.filename === "string" ? yield* (0, _files.findPackageData)(context.filename) : null;
let ignoreFile, babelrcFile;
let isIgnored = false;
const fileChain = emptyChain();
if ((babelrc === true || babelrc === undefined) && pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)) {
({
ignore: ignoreFile,
config: babelrcFile
} = yield* (0, _files.findRelativeConfig)(pkgData, context.envName, context.caller));
if (ignoreFile) {
fileChain.files.add(ignoreFile.filepath);
}
if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) {
isIgnored = true;
}
if (babelrcFile && !isIgnored) {
const validatedFile = validateBabelrcFile(babelrcFile);
const babelrcLogger = new _printer.ConfigPrinter();
const result = yield* loadFileChain(validatedFile, context, undefined, babelrcLogger);
if (!result) {
isIgnored = true;
} else {
babelRcReport = babelrcLogger.output();
mergeChain(fileChain, result);
}
}
if (babelrcFile && isIgnored) {
fileChain.files.add(babelrcFile.filepath);
}
}
if (context.showConfig) {
console.log(`Babel configs on "${context.filename}" (ascending priority):\n` + [configReport, babelRcReport, programmaticReport].filter(x => !!x).join("\n\n"));
return null;
}
const chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain);
return {
plugins: isIgnored ? [] : dedupDescriptors(chain.plugins),
presets: isIgnored ? [] : dedupDescriptors(chain.presets),
options: isIgnored ? [] : chain.options.map(o => normalizeOptions(o)),
fileHandling: isIgnored ? "ignored" : "transpile",
ignore: ignoreFile || undefined,
babelrc: babelrcFile || undefined,
config: configFile || undefined,
files: chain.files
};
}
function babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory) {
if (typeof babelrcRoots === "boolean") return babelrcRoots;
const absoluteRoot = context.root;
if (babelrcRoots === undefined) {
return pkgData.directories.indexOf(absoluteRoot) !== -1;
}
let babelrcPatterns = babelrcRoots;
if (!Array.isArray(babelrcPatterns)) babelrcPatterns = [babelrcPatterns];
babelrcPatterns = babelrcPatterns.map(pat => {
return typeof pat === "string" ? _path().default.resolve(babelrcRootsDirectory, pat) : pat;
});
if (babelrcPatterns.length === 1 && babelrcPatterns[0] === absoluteRoot) {
return pkgData.directories.indexOf(absoluteRoot) !== -1;
}
return babelrcPatterns.some(pat => {
if (typeof pat === "string") {
pat = (0, _patternToRegex.default)(pat, babelrcRootsDirectory);
}
return pkgData.directories.some(directory => {
return matchPattern(pat, babelrcRootsDirectory, directory, context);
});
});
}
const validateConfigFile = (0, _caching.makeWeakCacheSync)(file => ({
filepath: file.filepath,
dirname: file.dirname,
options: (0, _options.validate)("configfile", file.options)
}));
const validateBabelrcFile = (0, _caching.makeWeakCacheSync)(file => ({
filepath: file.filepath,
dirname: file.dirname,
options: (0, _options.validate)("babelrcfile", file.options)
}));
const validateExtendFile = (0, _caching.makeWeakCacheSync)(file => ({
filepath: file.filepath,
dirname: file.dirname,
options: (0, _options.validate)("extendsfile", file.options)
}));
const loadProgrammaticChain = makeChainWalker({
root: input => buildRootDescriptors(input, "base", _configDescriptors.createCachedDescriptors),
env: (input, envName) => buildEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, envName),
overrides: (input, index) => buildOverrideDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index),
overridesEnv: (input, index, envName) => buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName),
createLogger: (input, context, baseLogger) => buildProgrammaticLogger(input, context, baseLogger)
});
const loadFileChainWalker = makeChainWalker({
root: file => loadFileDescriptors(file),
env: (file, envName) => loadFileEnvDescriptors(file)(envName),
overrides: (file, index) => loadFileOverridesDescriptors(file)(index),
overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName),
createLogger: (file, context, baseLogger) => buildFileLogger(file.filepath, context, baseLogger)
});
function* loadFileChain(input, context, files, baseLogger) {
const chain = yield* loadFileChainWalker(input, context, files, baseLogger);
if (chain) {
chain.files.add(input.filepath);
}
return chain;
}
const loadFileDescriptors = (0, _caching.makeWeakCacheSync)(file => buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors));
const loadFileEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName)));
const loadFileOverridesDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index)));
const loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName))));
function buildFileLogger(filepath, context, baseLogger) {
if (!baseLogger) {
return () => {};
}
return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Config, {
filepath
});
}
function buildRootDescriptors({
dirname,
options
}, alias, descriptors) {
return descriptors(dirname, options, alias);
}
function buildProgrammaticLogger(_, context, baseLogger) {
var _context$caller;
if (!baseLogger) {
return () => {};
}
return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Programmatic, {
callerName: (_context$caller = context.caller) == null ? void 0 : _context$caller.name
});
}
function buildEnvDescriptors({
dirname,
options
}, alias, descriptors, envName) {
const opts = options.env && options.env[envName];
return opts ? descriptors(dirname, opts, `${alias}.env["${envName}"]`) : null;
}
function buildOverrideDescriptors({
dirname,
options
}, alias, descriptors, index) {
const opts = options.overrides && options.overrides[index];
if (!opts) throw new Error("Assertion failure - missing override");
return descriptors(dirname, opts, `${alias}.overrides[${index}]`);
}
function buildOverrideEnvDescriptors({
dirname,
options
}, alias, descriptors, index, envName) {
const override = options.overrides && options.overrides[index];
if (!override) throw new Error("Assertion failure - missing override");
const opts = override.env && override.env[envName];
return opts ? descriptors(dirname, opts, `${alias}.overrides[${index}].env["${envName}"]`) : null;
}
function makeChainWalker({
root,
env,
overrides,
overridesEnv,
createLogger
}) {
return function* (input, context, files = new Set(), baseLogger) {
const {
dirname
} = input;
const flattenedConfigs = [];
const rootOpts = root(input);
if (configIsApplicable(rootOpts, dirname, context)) {
flattenedConfigs.push({
config: rootOpts,
envName: undefined,
index: undefined
});
const envOpts = env(input, context.envName);
if (envOpts && configIsApplicable(envOpts, dirname, context)) {
flattenedConfigs.push({
config: envOpts,
envName: context.envName,
index: undefined
});
}
(rootOpts.options.overrides || []).forEach((_, index) => {
const overrideOps = overrides(input, index);
if (configIsApplicable(overrideOps, dirname, context)) {
flattenedConfigs.push({
config: overrideOps,
index,
envName: undefined
});
const overrideEnvOpts = overridesEnv(input, index, context.envName);
if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context)) {
flattenedConfigs.push({
config: overrideEnvOpts,
index,
envName: context.envName
});
}
}
});
}
if (flattenedConfigs.some(({
config: {
options: {
ignore,
only
}
}
}) => shouldIgnore(context, ignore, only, dirname))) {
return null;
}
const chain = emptyChain();
const logger = createLogger(input, context, baseLogger);
for (const {
config,
index,
envName
} of flattenedConfigs) {
if (!(yield* mergeExtendsChain(chain, config.options, dirname, context, files, baseLogger))) {
return null;
}
logger(config, index, envName);
mergeChainOpts(chain, config);
}
return chain;
};
}
function* mergeExtendsChain(chain, opts, dirname, context, files, baseLogger) {
if (opts.extends === undefined) return true;
const file = yield* (0, _files.loadConfig)(opts.extends, dirname, context.envName, context.caller);
if (files.has(file)) {
throw new Error(`Configuration cycle detected loading ${file.filepath}.\n` + `File already loaded following the config chain:\n` + Array.from(files, file => ` - ${file.filepath}`).join("\n"));
}
files.add(file);
const fileChain = yield* loadFileChain(validateExtendFile(file), context, files, baseLogger);
files.delete(file);
if (!fileChain) return false;
mergeChain(chain, fileChain);
return true;
}
function mergeChain(target, source) {
target.options.push(...source.options);
target.plugins.push(...source.plugins);
target.presets.push(...source.presets);
for (const file of source.files) {
target.files.add(file);
}
return target;
}
function mergeChainOpts(target, {
options,
plugins,
presets
}) {
target.options.push(options);
target.plugins.push(...plugins());
target.presets.push(...presets());
return target;
}
function emptyChain() {
return {
options: [],
presets: [],
plugins: [],
files: new Set()
};
}
function normalizeOptions(opts) {
const options = Object.assign({}, opts);
delete options.extends;
delete options.env;
delete options.overrides;
delete options.plugins;
delete options.presets;
delete options.passPerPreset;
delete options.ignore;
delete options.only;
delete options.test;
delete options.include;
delete options.exclude;
if (Object.prototype.hasOwnProperty.call(options, "sourceMap")) {
options.sourceMaps = options.sourceMap;
delete options.sourceMap;
}
return options;
}
function dedupDescriptors(items) {
const map = new Map();
const descriptors = [];
for (const item of items) {
if (typeof item.value === "function") {
const fnKey = item.value;
let nameMap = map.get(fnKey);
if (!nameMap) {
nameMap = new Map();
map.set(fnKey, nameMap);
}
let desc = nameMap.get(item.name);
if (!desc) {
desc = {
value: item
};
descriptors.push(desc);
if (!item.ownPass) nameMap.set(item.name, desc);
} else {
desc.value = item;
}
} else {
descriptors.push({
value: item
});
}
}
return descriptors.reduce((acc, desc) => {
acc.push(desc.value);
return acc;
}, []);
}
function configIsApplicable({
options
}, dirname, context) {
return (options.test === undefined || configFieldIsApplicable(context, options.test, dirname)) && (options.include === undefined || configFieldIsApplicable(context, options.include, dirname)) && (options.exclude === undefined || !configFieldIsApplicable(context, options.exclude, dirname));
}
function configFieldIsApplicable(context, test, dirname) {
const patterns = Array.isArray(test) ? test : [test];
return matchesPatterns(context, patterns, dirname);
}
function shouldIgnore(context, ignore, only, dirname) {
if (ignore && matchesPatterns(context, ignore, dirname)) {
var _context$filename;
const message = `No config is applied to "${(_context$filename = context.filename) != null ? _context$filename : "(unknown)"}" because it matches one of \`ignore: ${JSON.stringify(ignore)}\` from "${dirname}"`;
debug(message);
if (context.showConfig) {
console.log(message);
}
return true;
}
if (only && !matchesPatterns(context, only, dirname)) {
var _context$filename2;
const message = `No config is applied to "${(_context$filename2 = context.filename) != null ? _context$filename2 : "(unknown)"}" because it fails to match one of \`only: ${JSON.stringify(only)}\` from "${dirname}"`;
debug(message);
if (context.showConfig) {
console.log(message);
}
return true;
}
return false;
}
function matchesPatterns(context, patterns, dirname) {
return patterns.some(pattern => matchPattern(pattern, dirname, context.filename, context));
}
function matchPattern(pattern, dirname, pathToTest, context) {
if (typeof pattern === "function") {
return !!pattern(pathToTest, {
dirname,
envName: context.envName,
caller: context.caller
});
}
if (typeof pathToTest !== "string") {
throw new Error(`Configuration contains string/RegExp pattern, but no filename was passed to Babel`);
}
if (typeof pattern === "string") {
pattern = (0, _patternToRegex.default)(pattern, dirname);
}
return pattern.test(pathToTest);
}

View file

@ -0,0 +1,211 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCachedDescriptors = createCachedDescriptors;
exports.createUncachedDescriptors = createUncachedDescriptors;
exports.createDescriptor = createDescriptor;
var _files = require("./files");
var _item = require("./item");
var _caching = require("./caching");
function isEqualDescriptor(a, b) {
return a.name === b.name && a.value === b.value && a.options === b.options && a.dirname === b.dirname && a.alias === b.alias && a.ownPass === b.ownPass && (a.file && a.file.request) === (b.file && b.file.request) && (a.file && a.file.resolved) === (b.file && b.file.resolved);
}
function createCachedDescriptors(dirname, options, alias) {
const {
plugins,
presets,
passPerPreset
} = options;
return {
options,
plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname)(alias) : () => [],
presets: presets ? () => createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => []
};
}
function createUncachedDescriptors(dirname, options, alias) {
let plugins;
let presets;
return {
options,
plugins: () => {
if (!plugins) {
plugins = createPluginDescriptors(options.plugins || [], dirname, alias);
}
return plugins;
},
presets: () => {
if (!presets) {
presets = createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset);
}
return presets;
}
};
}
const PRESET_DESCRIPTOR_CACHE = new WeakMap();
const createCachedPresetDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
const dirname = cache.using(dir => dir);
return (0, _caching.makeStrongCacheSync)(alias => (0, _caching.makeStrongCacheSync)(passPerPreset => createPresetDescriptors(items, dirname, alias, passPerPreset).map(desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc))));
});
const PLUGIN_DESCRIPTOR_CACHE = new WeakMap();
const createCachedPluginDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
const dirname = cache.using(dir => dir);
return (0, _caching.makeStrongCacheSync)(alias => createPluginDescriptors(items, dirname, alias).map(desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc)));
});
const DEFAULT_OPTIONS = {};
function loadCachedDescriptor(cache, desc) {
const {
value,
options = DEFAULT_OPTIONS
} = desc;
if (options === false) return desc;
let cacheByOptions = cache.get(value);
if (!cacheByOptions) {
cacheByOptions = new WeakMap();
cache.set(value, cacheByOptions);
}
let possibilities = cacheByOptions.get(options);
if (!possibilities) {
possibilities = [];
cacheByOptions.set(options, possibilities);
}
if (possibilities.indexOf(desc) === -1) {
const matches = possibilities.filter(possibility => isEqualDescriptor(possibility, desc));
if (matches.length > 0) {
return matches[0];
}
possibilities.push(desc);
}
return desc;
}
function createPresetDescriptors(items, dirname, alias, passPerPreset) {
return createDescriptors("preset", items, dirname, alias, passPerPreset);
}
function createPluginDescriptors(items, dirname, alias) {
return createDescriptors("plugin", items, dirname, alias);
}
function createDescriptors(type, items, dirname, alias, ownPass) {
const descriptors = items.map((item, index) => createDescriptor(item, dirname, {
type,
alias: `${alias}$${index}`,
ownPass: !!ownPass
}));
assertNoDuplicates(descriptors);
return descriptors;
}
function createDescriptor(pair, dirname, {
type,
alias,
ownPass
}) {
const desc = (0, _item.getItemDescriptor)(pair);
if (desc) {
return desc;
}
let name;
let options;
let value = pair;
if (Array.isArray(value)) {
if (value.length === 3) {
[value, options, name] = value;
} else {
[value, options] = value;
}
}
let file = undefined;
let filepath = null;
if (typeof value === "string") {
if (typeof type !== "string") {
throw new Error("To resolve a string-based item, the type of item must be given");
}
const resolver = type === "plugin" ? _files.loadPlugin : _files.loadPreset;
const request = value;
({
filepath,
value
} = resolver(value, dirname));
file = {
request,
resolved: filepath
};
}
if (!value) {
throw new Error(`Unexpected falsy value: ${String(value)}`);
}
if (typeof value === "object" && value.__esModule) {
if (value.default) {
value = value.default;
} else {
throw new Error("Must export a default export when using ES6 modules.");
}
}
if (typeof value !== "object" && typeof value !== "function") {
throw new Error(`Unsupported format: ${typeof value}. Expected an object or a function.`);
}
if (filepath !== null && typeof value === "object" && value) {
throw new Error(`Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`);
}
return {
name,
alias: filepath || alias,
value,
options,
dirname,
ownPass,
file
};
}
function assertNoDuplicates(items) {
const map = new Map();
for (const item of items) {
if (typeof item.value !== "function") continue;
let nameMap = map.get(item.value);
if (!nameMap) {
nameMap = new Set();
map.set(item.value, nameMap);
}
if (nameMap.has(item.name)) {
const conflicts = items.filter(i => i.value === item.value);
throw new Error([`Duplicate plugin/preset detected.`, `If you'd like to use two separate instances of a plugin,`, `they need separate names, e.g.`, ``, ` plugins: [`, ` ['some-plugin', {}],`, ` ['some-plugin', {}, 'some unique name'],`, ` ]`, ``, `Duplicates detected are:`, `${JSON.stringify(conflicts, null, 2)}`].join("\n"));
}
nameMap.add(item.name);
}
}

View file

@ -0,0 +1,342 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.findConfigUpwards = findConfigUpwards;
exports.findRelativeConfig = findRelativeConfig;
exports.findRootConfig = findRootConfig;
exports.loadConfig = loadConfig;
exports.resolveShowConfigPath = resolveShowConfigPath;
exports.ROOT_CONFIG_FILENAMES = void 0;
function _debug() {
const data = _interopRequireDefault(require("debug"));
_debug = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _json() {
const data = _interopRequireDefault(require("json5"));
_json = function () {
return data;
};
return data;
}
function _gensync() {
const data = _interopRequireDefault(require("gensync"));
_gensync = function () {
return data;
};
return data;
}
var _caching = require("../caching");
var _configApi = _interopRequireDefault(require("../helpers/config-api"));
var _utils = require("./utils");
var _moduleTypes = _interopRequireDefault(require("./module-types"));
var _patternToRegex = _interopRequireDefault(require("../pattern-to-regex"));
var fs = _interopRequireWildcard(require("../../gensync-utils/fs"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const debug = (0, _debug().default)("babel:config:loading:files:configuration");
const ROOT_CONFIG_FILENAMES = ["babel.config.js", "babel.config.cjs", "babel.config.mjs", "babel.config.json"];
exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES;
const RELATIVE_CONFIG_FILENAMES = [".babelrc", ".babelrc.js", ".babelrc.cjs", ".babelrc.mjs", ".babelrc.json"];
const BABELIGNORE_FILENAME = ".babelignore";
function* findConfigUpwards(rootDir) {
let dirname = rootDir;
while (true) {
for (const filename of ROOT_CONFIG_FILENAMES) {
if (yield* fs.exists(_path().default.join(dirname, filename))) {
return dirname;
}
}
const nextDir = _path().default.dirname(dirname);
if (dirname === nextDir) break;
dirname = nextDir;
}
return null;
}
function* findRelativeConfig(packageData, envName, caller) {
let config = null;
let ignore = null;
const dirname = _path().default.dirname(packageData.filepath);
for (const loc of packageData.directories) {
if (!config) {
var _packageData$pkg;
config = yield* loadOneConfig(RELATIVE_CONFIG_FILENAMES, loc, envName, caller, ((_packageData$pkg = packageData.pkg) == null ? void 0 : _packageData$pkg.dirname) === loc ? packageToBabelConfig(packageData.pkg) : null);
}
if (!ignore) {
const ignoreLoc = _path().default.join(loc, BABELIGNORE_FILENAME);
ignore = yield* readIgnoreConfig(ignoreLoc);
if (ignore) {
debug("Found ignore %o from %o.", ignore.filepath, dirname);
}
}
}
return {
config,
ignore
};
}
function findRootConfig(dirname, envName, caller) {
return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller);
}
function* loadOneConfig(names, dirname, envName, caller, previousConfig = null) {
const configs = yield* _gensync().default.all(names.map(filename => readConfig(_path().default.join(dirname, filename), envName, caller)));
const config = configs.reduce((previousConfig, config) => {
if (config && previousConfig) {
throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().default.basename(previousConfig.filepath)}\n` + ` - ${config.filepath}\n` + `from ${dirname}`);
}
return config || previousConfig;
}, previousConfig);
if (config) {
debug("Found configuration %o from %o.", config.filepath, dirname);
}
return config;
}
function* loadConfig(name, dirname, envName, caller) {
const filepath = (parseFloat(process.versions.node) >= 8.9 ? require.resolve : (r, {
paths: [b]
}, M = require("module")) => {
let f = M._findPath(r, M._nodeModulePaths(b).concat(b));
if (f) return f;
f = new Error(`Cannot resolve module '${r}'`);
f.code = "MODULE_NOT_FOUND";
throw f;
})(name, {
paths: [dirname]
});
const conf = yield* readConfig(filepath, envName, caller);
if (!conf) {
throw new Error(`Config file ${filepath} contains no configuration data`);
}
debug("Loaded config %o from %o.", name, dirname);
return conf;
}
function readConfig(filepath, envName, caller) {
const ext = _path().default.extname(filepath);
return ext === ".js" || ext === ".cjs" || ext === ".mjs" ? readConfigJS(filepath, {
envName,
caller
}) : readConfigJSON5(filepath);
}
const LOADING_CONFIGS = new Set();
const readConfigJS = (0, _caching.makeStrongCache)(function* readConfigJS(filepath, cache) {
if (!fs.exists.sync(filepath)) {
cache.forever();
return null;
}
if (LOADING_CONFIGS.has(filepath)) {
cache.never();
debug("Auto-ignoring usage of config %o.", filepath);
return {
filepath,
dirname: _path().default.dirname(filepath),
options: {}
};
}
let options;
try {
LOADING_CONFIGS.add(filepath);
options = yield* (0, _moduleTypes.default)(filepath, "You appear to be using a native ECMAScript module configuration " + "file, which is only supported when running Babel asynchronously.");
} catch (err) {
err.message = `${filepath}: Error while loading config - ${err.message}`;
throw err;
} finally {
LOADING_CONFIGS.delete(filepath);
}
let assertCache = false;
if (typeof options === "function") {
yield* [];
options = options((0, _configApi.default)(cache));
assertCache = true;
}
if (!options || typeof options !== "object" || Array.isArray(options)) {
throw new Error(`${filepath}: Configuration should be an exported JavaScript object.`);
}
if (typeof options.then === "function") {
throw new Error(`You appear to be using an async configuration, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously return your config.`);
}
if (assertCache && !cache.configured()) throwConfigError();
return {
filepath,
dirname: _path().default.dirname(filepath),
options
};
});
const packageToBabelConfig = (0, _caching.makeWeakCacheSync)(file => {
const babel = file.options["babel"];
if (typeof babel === "undefined") return null;
if (typeof babel !== "object" || Array.isArray(babel) || babel === null) {
throw new Error(`${file.filepath}: .babel property must be an object`);
}
return {
filepath: file.filepath,
dirname: file.dirname,
options: babel
};
});
const readConfigJSON5 = (0, _utils.makeStaticFileCache)((filepath, content) => {
let options;
try {
options = _json().default.parse(content);
} catch (err) {
err.message = `${filepath}: Error while parsing config - ${err.message}`;
throw err;
}
if (!options) throw new Error(`${filepath}: No config detected`);
if (typeof options !== "object") {
throw new Error(`${filepath}: Config returned typeof ${typeof options}`);
}
if (Array.isArray(options)) {
throw new Error(`${filepath}: Expected config object but found array`);
}
return {
filepath,
dirname: _path().default.dirname(filepath),
options
};
});
const readIgnoreConfig = (0, _utils.makeStaticFileCache)((filepath, content) => {
const ignoreDir = _path().default.dirname(filepath);
const ignorePatterns = content.split("\n").map(line => line.replace(/#(.*?)$/, "").trim()).filter(line => !!line);
for (const pattern of ignorePatterns) {
if (pattern[0] === "!") {
throw new Error(`Negation of file paths is not supported.`);
}
}
return {
filepath,
dirname: _path().default.dirname(filepath),
ignore: ignorePatterns.map(pattern => (0, _patternToRegex.default)(pattern, ignoreDir))
};
});
function* resolveShowConfigPath(dirname) {
const targetPath = process.env.BABEL_SHOW_CONFIG_FOR;
if (targetPath != null) {
const absolutePath = _path().default.resolve(dirname, targetPath);
const stats = yield* fs.stat(absolutePath);
if (!stats.isFile()) {
throw new Error(`${absolutePath}: BABEL_SHOW_CONFIG_FOR must refer to a regular file, directories are not supported.`);
}
return absolutePath;
}
return null;
}
function throwConfigError() {
throw new Error(`\
Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured
for various types of caching, using the first param of their handler functions:
module.exports = function(api) {
// The API exposes the following:
// Cache the returned value forever and don't call this function again.
api.cache(true);
// Don't cache at all. Not recommended because it will be very slow.
api.cache(false);
// Cached based on the value of some function. If this function returns a value different from
// a previously-encountered value, the plugins will re-evaluate.
var env = api.cache(() => process.env.NODE_ENV);
// If testing for a specific env, we recommend specifics to avoid instantiating a plugin for
// any possible NODE_ENV value that might come up during plugin execution.
var isProd = api.cache(() => process.env.NODE_ENV === "production");
// .cache(fn) will perform a linear search though instances to find the matching plugin based
// based on previous instantiated plugins. If you want to recreate the plugin and discard the
// previous instance whenever something changes, you may use:
var isProd = api.cache.invalidate(() => process.env.NODE_ENV === "production");
// Note, we also expose the following more-verbose versions of the above examples:
api.cache.forever(); // api.cache(true)
api.cache.never(); // api.cache(false)
api.cache.using(fn); // api.cache(fn)
// Return the value that will be cached.
return { };
};`);
}

View file

@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = import_;
function import_(filepath) {
return import(filepath);
}

View file

@ -0,0 +1,68 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.findConfigUpwards = findConfigUpwards;
exports.findPackageData = findPackageData;
exports.findRelativeConfig = findRelativeConfig;
exports.findRootConfig = findRootConfig;
exports.loadConfig = loadConfig;
exports.resolveShowConfigPath = resolveShowConfigPath;
exports.resolvePlugin = resolvePlugin;
exports.resolvePreset = resolvePreset;
exports.loadPlugin = loadPlugin;
exports.loadPreset = loadPreset;
exports.ROOT_CONFIG_FILENAMES = void 0;
function* findConfigUpwards(rootDir) {
return null;
}
function* findPackageData(filepath) {
return {
filepath,
directories: [],
pkg: null,
isPackage: false
};
}
function* findRelativeConfig(pkgData, envName, caller) {
return {
pkg: null,
config: null,
ignore: null
};
}
function* findRootConfig(dirname, envName, caller) {
return null;
}
function* loadConfig(name, dirname, envName, caller) {
throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);
}
function* resolveShowConfigPath(dirname) {
return null;
}
const ROOT_CONFIG_FILENAMES = [];
exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES;
function resolvePlugin(name, dirname) {
return null;
}
function resolvePreset(name, dirname) {
return null;
}
function loadPlugin(name, dirname) {
throw new Error(`Cannot load plugin ${name} relative to ${dirname} in a browser`);
}
function loadPreset(name, dirname) {
throw new Error(`Cannot load preset ${name} relative to ${dirname} in a browser`);
}

View file

@ -0,0 +1,79 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "findPackageData", {
enumerable: true,
get: function () {
return _package.findPackageData;
}
});
Object.defineProperty(exports, "findConfigUpwards", {
enumerable: true,
get: function () {
return _configuration.findConfigUpwards;
}
});
Object.defineProperty(exports, "findRelativeConfig", {
enumerable: true,
get: function () {
return _configuration.findRelativeConfig;
}
});
Object.defineProperty(exports, "findRootConfig", {
enumerable: true,
get: function () {
return _configuration.findRootConfig;
}
});
Object.defineProperty(exports, "loadConfig", {
enumerable: true,
get: function () {
return _configuration.loadConfig;
}
});
Object.defineProperty(exports, "resolveShowConfigPath", {
enumerable: true,
get: function () {
return _configuration.resolveShowConfigPath;
}
});
Object.defineProperty(exports, "ROOT_CONFIG_FILENAMES", {
enumerable: true,
get: function () {
return _configuration.ROOT_CONFIG_FILENAMES;
}
});
Object.defineProperty(exports, "resolvePlugin", {
enumerable: true,
get: function () {
return _plugins.resolvePlugin;
}
});
Object.defineProperty(exports, "resolvePreset", {
enumerable: true,
get: function () {
return _plugins.resolvePreset;
}
});
Object.defineProperty(exports, "loadPlugin", {
enumerable: true,
get: function () {
return _plugins.loadPlugin;
}
});
Object.defineProperty(exports, "loadPreset", {
enumerable: true,
get: function () {
return _plugins.loadPreset;
}
});
var _package = require("./package");
var _configuration = require("./configuration");
var _plugins = require("./plugins");
({});

View file

@ -0,0 +1,96 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = loadCjsOrMjsDefault;
var _async = require("../../gensync-utils/async");
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _url() {
const data = require("url");
_url = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
let import_;
try {
import_ = require("./import").default;
} catch (_unused) {}
function* loadCjsOrMjsDefault(filepath, asyncError) {
switch (guessJSModuleType(filepath)) {
case "cjs":
return loadCjsDefault(filepath);
case "unknown":
try {
return loadCjsDefault(filepath);
} catch (e) {
if (e.code !== "ERR_REQUIRE_ESM") throw e;
}
case "mjs":
if (yield* (0, _async.isAsync)()) {
return yield* (0, _async.waitFor)(loadMjsDefault(filepath));
}
throw new Error(asyncError);
}
}
function guessJSModuleType(filename) {
switch (_path().default.extname(filename)) {
case ".cjs":
return "cjs";
case ".mjs":
return "mjs";
default:
return "unknown";
}
}
function loadCjsDefault(filepath) {
const module = require(filepath);
return (module == null ? void 0 : module.__esModule) ? module.default || undefined : module;
}
function loadMjsDefault(_x) {
return _loadMjsDefault.apply(this, arguments);
}
function _loadMjsDefault() {
_loadMjsDefault = _asyncToGenerator(function* (filepath) {
if (!import_) {
throw new Error("Internal error: Native ECMAScript modules aren't supported" + " by this platform.\n");
}
const module = yield import_((0, _url().pathToFileURL)(filepath));
return module.default;
});
return _loadMjsDefault.apply(this, arguments);
}

Some files were not shown because too many files have changed in this diff Show more