strip source mapping from vendor js

This commit is contained in:
tophf 2022-03-31 13:56:51 +03:00
parent ea388ea9a7
commit 2efb6c5cd1
17 changed files with 3752 additions and 22 deletions

View File

@ -179,7 +179,7 @@ const syncMan = (() => {
//#region Utils //#region Utils
async function initController() { async function initController() {
await require(['/vendor/db-to-cloud/db-to-cloud.min']); /* global dbToCloud */ await require(['/vendor/db-to-cloud/db-to-cloud']); /* global dbToCloud */
ctrl = dbToCloud.dbToCloud({ ctrl = dbToCloud.dbToCloud({
onGet: styleUtil.uuid2style, onGet: styleUtil.uuid2style,
async onPut(doc) { async onPut(doc) {

View File

@ -144,7 +144,7 @@ const tokenMan = (() => {
} }
async function authUser(keys, name, interactive = false, hooks = null) { async function authUser(keys, name, interactive = false, hooks = null) {
await require(['/vendor/webext-launch-web-auth-flow/webext-launch-web-auth-flow.min']); await require(['/vendor/webext-launch-web-auth-flow/webext-launch-web-auth-flow']);
/* global webextLaunchWebAuthFlow */ /* global webextLaunchWebAuthFlow */
const provider = AUTH[name]; const provider = AUTH[name];
const state = Math.random().toFixed(8).slice(2); const state = Math.random().toFixed(8).slice(2);

View File

@ -2,7 +2,7 @@
/* exported metaParser */ /* exported metaParser */
const metaParser = (() => { const metaParser = (() => {
require(['/vendor/usercss-meta/usercss-meta.min']); /* global usercssMeta */ require(['/vendor/usercss-meta/usercss-meta']); /* global usercssMeta */
const {createParser, ParseError} = usercssMeta; const {createParser, ParseError} = usercssMeta;
const PREPROCESSORS = new Set(['default', 'uso', 'stylus', 'less']); const PREPROCESSORS = new Set(['default', 'uso', 'stylus', 'less']);
const options = { const options = {

View File

@ -63,7 +63,7 @@ newUI.renderClass();
router.makeToggle('stylus-options', toggleEmbeddedOptions); router.makeToggle('stylus-options', toggleEmbeddedOptions);
$('#injection-order-button').onclick = $('#injection-order-button').onclick =
router.makeToggle('injection-order', (...args) => InjectionOrder(...args), [ router.makeToggle('injection-order', (...args) => InjectionOrder(...args), [
'/vendor/draggable-list/draggable-list.iife.min.js', '/vendor/draggable-list/draggable-list.iife',
'/injection-order/injection-order.css', '/injection-order/injection-order.css',
'/injection-order/injection-order', /* global InjectionOrder */ '/injection-order/injection-order', /* global InjectionOrder */
]); ]);

View File

@ -53,16 +53,16 @@ const files = {
'dist/stylus-renderer.min.js', 'dist/stylus-renderer.min.js',
], ],
'usercss-meta': [ 'usercss-meta': [
'dist/usercss-meta.min.js', 'dist/usercss-meta.js',
], ],
'db-to-cloud': [ 'db-to-cloud': [
'dist/db-to-cloud.min.js', 'dist/db-to-cloud.js',
], ],
'webext-launch-web-auth-flow': [ 'webext-launch-web-auth-flow': [
'dist/webext-launch-web-auth-flow.min.js', 'dist/webext-launch-web-auth-flow.js',
], ],
'@eight04/draggable-list': [ '@eight04/draggable-list': [
'dist/draggable-list.iife.min.js', 'dist/draggable-list.iife.js',
], ],
}; };
@ -101,10 +101,18 @@ async function buildFiles(pkg, flatPkg, patterns) {
throw new Error(`Pattern ${src} matches no files`); throw new Error(`Pattern ${src} matches no files`);
} }
for (const file of files) { for (const file of files) {
fse.copySync(file, dest const destPath = dest
? `vendor/${flatPkg}/${dest}` ? `vendor/${flatPkg}/${dest}`
: `vendor/${path.relative('node_modules', file).replace(pkg + '/', flatPkg + '/')}`); : `vendor/${path.relative('node_modules', file).replace(pkg + '/', flatPkg + '/')}`;
copied += `* ${reportFile(pkg, file, dest)}\n`; const txt = file.endsWith('.js') && fs.readFileSync(file, 'utf8');
const txt2 = txt && txt.replace(/\n\/\/# sourceMappingURL=.*\s*$/, '\n');
const hasSM = txt && txt !== txt2;
if (hasSM) {
fse.outputFileSync(destPath, txt2);
} else {
fse.copySync(file, destPath);
}
copied += `* ${reportFile(pkg, file, dest)}${hasSM ? ' (removed sourceMappingURL)' : ''}\n`;
} }
} }
} }

View File

@ -1,4 +1,4 @@
## db-to-cloud v0.7.0 ## db-to-cloud v0.7.0
Files copied from NPM (node_modules): Files copied from NPM (node_modules):
* db-to-cloud.min.js: dist/* * db-to-cloud.js: dist/* (removed sourceMappingURL)

2262
vendor/db-to-cloud/db-to-cloud.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
## @eight04/draggable-list v0.3.0 ## @eight04/draggable-list v0.3.0
Files copied from NPM (node_modules): Files copied from NPM (node_modules):
* draggable-list.iife.min.js: dist/* * draggable-list.iife.js: dist/*

View File

@ -0,0 +1,166 @@
var DraggableList = (function () {
'use strict';
/* eslint-env browser */
const CLS_TRANSFORMED = 'draggable-list-transformed';
function posToIndex(rects, startIndex, y, bound) {
if (y < rects[0].top && bound) return startIndex;
for (let i = 0; i < startIndex; i++) {
if (rects[i].bottom < y) continue;
return i;
}
if (y > rects[rects.length - 1].bottom && bound) return startIndex;
for (let i = rects.length - 1; i > startIndex; i--) {
if (rects[i].top > y) continue;
return i;
}
return startIndex;
}
function applyTransform(list, startIndex, oldIndex, newIndex, len) {
if (newIndex > oldIndex) {
transform(false, oldIndex, Math.min(startIndex - 1, newIndex - 1));
if (startIndex < list.length - 1) {
transform(true, Math.max(oldIndex + 1, startIndex + 1), newIndex, "translateY(".concat(-len, "px)"));
}
} else {
transform(false, Math.max(startIndex + 1, newIndex + 1), oldIndex);
if (startIndex > 0) {
transform(true, newIndex, Math.min(oldIndex - 1, startIndex - 1), "translateY(".concat(len, "px)"));
}
}
function transform(state, p, q, style) {
for (let i = p; i <= q; i++) {
if (state && !list[i].classList.contains(CLS_TRANSFORMED)) {
list[i].classList.add(CLS_TRANSFORMED);
list[i].style.transform = style;
} else if (!state && list[i].classList.contains(CLS_TRANSFORMED)) {
list[i].classList.remove(CLS_TRANSFORMED);
list[i].style = '';
}
}
}
}
function DraggableList(el, {
bound,
scrollContainer
} = {}) {
for (const c of el.children) {
c.draggable = true;
}
new MutationObserver(records => {
for (const r of records) {
for (const n of r.addedNodes) {
n.draggable = true;
}
}
}).observe(el, {
childList: true
});
let startPos = null;
let startIndex = 0;
let dragOverIndex = 0;
let dragOverPos = null;
let rects = [];
let dragTarget = null;
let dropped = false;
let itemSize = 0;
el.addEventListener('dragstart', e => {
if (e.target.parentNode !== el) return;
dragTarget = e.target;
dropped = false;
const scrollLeft = scrollContainer ? scrollContainer.scrollLeft : 0;
const scrollTop = scrollContainer ? scrollContainer.scrollTop : 0;
startPos = {
x: e.pageX + scrollLeft,
y: e.pageY + scrollTop
};
startIndex = [...el.children].indexOf(e.target);
dragOverIndex = startIndex;
dragOverPos = startPos;
rects = [...el.children].map(el => {
const r = el.getBoundingClientRect();
return {
top: r.top + window.scrollY + scrollTop,
bottom: r.bottom + window.scrollY + scrollTop
};
});
itemSize = startIndex + 1 < rects.length ? rects[startIndex + 1].top - rects[startIndex].top : startIndex > 0 ? rects[startIndex].bottom - rects[startIndex - 1].bottom : 0;
dragTarget.classList.add('draggable-list-target');
el.classList.add('draggable-list-dragging');
dispatch(e, 'd:dragstart');
});
el.addEventListener('dragenter', e => {
if (dragTarget) {
e.preventDefault();
dispatch(e, 'd:dragmove');
}
});
el.addEventListener('dragover', e => {
if (!dragTarget) return;
e.preventDefault();
const scrollLeft = scrollContainer ? scrollContainer.scrollLeft : 0;
const scrollTop = scrollContainer ? scrollContainer.scrollTop : 0;
const newPos = {
x: e.pageX + scrollLeft,
y: e.pageY + scrollTop
};
const newIndex = posToIndex(rects, startIndex, newPos.y, bound);
applyTransform(el.children, startIndex, dragOverIndex, newIndex, itemSize);
dragOverIndex = newIndex;
dragOverPos = newPos;
dispatch(e, 'd:dragmove');
});
document.addEventListener('dragend', e => {
if (!dragTarget) return;
for (const c of el.children) {
c.classList.remove(CLS_TRANSFORMED);
c.style = '';
}
dragTarget.classList.remove('draggable-list-target');
el.classList.remove('draggable-list-dragging');
dispatch(e, 'd:dragend', {
originalIndex: startIndex,
spliceIndex: dragOverIndex,
insertBefore: dragOverIndex < startIndex ? el.children[dragOverIndex] : el.children[dragOverIndex + 1],
dropped
});
dragTarget = null;
});
el.addEventListener('drop', e => {
if (dragTarget) {
dropped = true;
e.preventDefault();
}
});
function dispatch(e, name, props) {
const detail = {
origin: e,
startPos,
currentPos: dragOverPos,
dragTarget
};
if (props) {
Object.assign(detail, props);
}
el.dispatchEvent(new CustomEvent(name, {
detail
}));
}
}
return DraggableList;
})();

View File

@ -1 +0,0 @@
var DraggableList=function(){"use strict";const t="draggable-list-transformed";return function(e,{bound:r,scrollContainer:n}={}){for(const t of e.children)t.draggable=!0;new MutationObserver((t=>{for(const e of t)for(const t of e.addedNodes)t.draggable=!0})).observe(e,{childList:!0});let a=null,o=0,s=0,l=null,d=[],i=null,c=!1,g=0;function f(t,r,n){const o={origin:t,startPos:a,currentPos:l,dragTarget:i};n&&Object.assign(o,n),e.dispatchEvent(new CustomEvent(r,{detail:o}))}e.addEventListener("dragstart",(t=>{if(t.target.parentNode!==e)return;i=t.target,c=!1;const r=n?n.scrollLeft:0,u=n?n.scrollTop:0;a={x:t.pageX+r,y:t.pageY+u},o=[...e.children].indexOf(t.target),s=o,l=a,d=[...e.children].map((t=>{const e=t.getBoundingClientRect();return{top:e.top+window.scrollY+u,bottom:e.bottom+window.scrollY+u}})),g=o+1<d.length?d[o+1].top-d[o].top:o>0?d[o].bottom-d[o-1].bottom:0,i.classList.add("draggable-list-target"),e.classList.add("draggable-list-dragging"),f(t,"d:dragstart")})),e.addEventListener("dragenter",(t=>{i&&(t.preventDefault(),f(t,"d:dragmove"))})),e.addEventListener("dragover",(a=>{if(!i)return;a.preventDefault();const c=n?n.scrollLeft:0,u=n?n.scrollTop:0,p={x:a.pageX+c,y:a.pageY+u},m=function(t,e,r,n){if(r<t[0].top&&n)return e;for(let n=0;n<e;n++)if(!(t[n].bottom<r))return n;if(r>t[t.length-1].bottom&&n)return e;for(let n=t.length-1;n>e;n--)if(!(t[n].top>r))return n;return e}(d,o,p.y,r);!function(e,r,n,a,o){function s(r,n,a,o){for(let s=n;s<=a;s++)r&&!e[s].classList.contains(t)?(e[s].classList.add(t),e[s].style.transform=o):!r&&e[s].classList.contains(t)&&(e[s].classList.remove(t),e[s].style="")}a>n?(s(!1,n,Math.min(r-1,a-1)),r<e.length-1&&s(!0,Math.max(n+1,r+1),a,"translateY(".concat(-o,"px)"))):(s(!1,Math.max(r+1,a+1),n),r>0&&s(!0,a,Math.min(n-1,r-1),"translateY(".concat(o,"px)")))}(e.children,o,s,m,g),s=m,l=p,f(a,"d:dragmove")})),document.addEventListener("dragend",(r=>{if(i){for(const r of e.children)r.classList.remove(t),r.style="";i.classList.remove("draggable-list-target"),e.classList.remove("draggable-list-dragging"),f(r,"d:dragend",{originalIndex:o,spliceIndex:s,insertBefore:s<o?e.children[s]:e.children[s+1],dropped:c}),i=null}})),e.addEventListener("drop",(t=>{i&&(c=!0,t.preventDefault())}))}}();

View File

@ -1,4 +1,4 @@
## usercss-meta v0.12.0 ## usercss-meta v0.12.0
Files copied from NPM (node_modules): Files copied from NPM (node_modules):
* usercss-meta.min.js: dist/* * usercss-meta.js: dist/* (removed sourceMappingURL)

1067
vendor/usercss-meta/usercss-meta.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
## webext-launch-web-auth-flow v0.1.1 ## webext-launch-web-auth-flow v0.1.1
Files copied from NPM (node_modules): Files copied from NPM (node_modules):
* webext-launch-web-auth-flow.min.js: dist/* * webext-launch-web-auth-flow.js: dist/* (removed sourceMappingURL)

View File

@ -0,0 +1,234 @@
var webextLaunchWebAuthFlow = (function () {
'use strict';
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);
});
};
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
/* eslint-env webextensions */
function createWindow(_x, _x2) {
return _createWindow.apply(this, arguments);
}
function _createWindow() {
_createWindow = _asyncToGenerator(function* (options, useTab) {
if (browser.windows && !useTab) {
return yield browser.windows.create(options);
}
const tabOptions = {
active: options.state !== "minimized",
url: options.url
};
const tab = yield browser.tabs.create(tabOptions);
return {
tabs: [tab]
};
});
return _createWindow.apply(this, arguments);
}
function updateWindow(_x3, _x4, _x5) {
return _updateWindow.apply(this, arguments);
}
function _updateWindow() {
_updateWindow = _asyncToGenerator(function* (windowId, tabId, options) {
if (windowId) {
return yield browser.windows.update(windowId, options);
}
return yield browser.tabs.update(tabId, {
active: options.focused
});
});
return _updateWindow.apply(this, arguments);
}
function closeWindow(_x6, _x7) {
return _closeWindow.apply(this, arguments);
}
function _closeWindow() {
_closeWindow = _asyncToGenerator(function* (windowId, tabId) {
if (windowId) {
return yield browser.windows.remove(windowId);
}
return yield browser.tabs.remove(tabId);
});
return _closeWindow.apply(this, arguments);
}
function defer() {
const o = {};
o.promise = new Promise((resolve, reject) => {
o.resolve = resolve;
o.reject = reject;
});
return o;
}
function launchWebAuthFlow(_x8) {
return _launchWebAuthFlow.apply(this, arguments);
}
function _launchWebAuthFlow() {
_launchWebAuthFlow = _asyncToGenerator(function* ({
url,
redirect_uri,
interactive = false,
alwaysUseTab = false,
windowOptions
}) {
const wInfo = yield createWindow(_objectSpread2({
type: "popup",
url,
state: "minimized"
}, windowOptions), alwaysUseTab);
const windowId = wInfo.id;
const tabId = wInfo.tabs[0].id;
const _defer = defer(),
promise = _defer.promise,
resolve = _defer.resolve,
reject = _defer.reject;
browser.webRequest.onBeforeRequest.addListener(onBeforeRequest, {
urls: ["*://*/*"],
tabId,
types: ["main_frame"]
}, ["blocking"]);
browser.webNavigation.onDOMContentLoaded.addListener(onDOMContentLoaded);
browser.tabs.onRemoved.addListener(onTabRemoved);
try {
return yield promise;
} finally {
cleanup();
}
function onBeforeRequest(details) {
if (details.frameId || details.tabId !== tabId) return;
if (!details.url.startsWith(redirect_uri)) return;
resolve(details.url);
return {
cancel: true
};
}
function onDOMContentLoaded(details) {
if (details.frameId || details.tabId !== tabId) return;
if (interactive) {
updateWindow(windowId, tabId, {
focused: true,
state: "normal"
}).catch(err => console.error(err));
} else {
reject(new Error("User interaction required"));
}
browser.webNavigation.onDOMContentLoaded.removeListener(onDOMContentLoaded);
}
function onTabRemoved(removedTabId) {
if (removedTabId === tabId) {
reject(new Error("Canceled by user"));
}
}
function cleanup() {
browser.webRequest.onBeforeRequest.removeListener(onBeforeRequest);
browser.webNavigation.onDOMContentLoaded.removeListener(onDOMContentLoaded);
browser.tabs.onRemoved.removeListener(onTabRemoved);
closeWindow(windowId, tabId).catch(err => console.error(err));
}
});
return _launchWebAuthFlow.apply(this, arguments);
}
return launchWebAuthFlow;
}());

View File

@ -1,2 +0,0 @@
var webextLaunchWebAuthFlow=function(){"use strict";function e(e,r,t,n,o,i,s){try{var u=e[i](s),c=u.value}catch(e){return void t(e)}u.done?r(c):Promise.resolve(c).then(n,o)}function r(r){return function(){var t=this,n=arguments;return new Promise((function(o,i){var s=r.apply(t,n);function u(r){e(s,o,i,u,c,"next",r)}function c(r){e(s,o,i,u,c,"throw",r)}u(void 0)}))}}function t(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach((function(r){t(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function i(e,r){return s.apply(this,arguments)}function s(){return(s=r((function*(e,r){if(browser.windows&&!r)return yield browser.windows.create(e);const t={active:"minimized"!==e.state,url:e.url};return{tabs:[yield browser.tabs.create(t)]}}))).apply(this,arguments)}function u(e,r,t){return c.apply(this,arguments)}function c(){return(c=r((function*(e,r,t){return e?yield browser.windows.update(e,t):yield browser.tabs.update(r,{active:t.focused})}))).apply(this,arguments)}function a(e,r){return b.apply(this,arguments)}function b(){return(b=r((function*(e,r){return e?yield browser.windows.remove(e):yield browser.tabs.remove(r)}))).apply(this,arguments)}function l(){const e={};return e.promise=new Promise((r,t)=>{e.resolve=r,e.reject=t}),e}function d(){return(d=r((function*({url:e,redirect_uri:r,interactive:t=!1,alwaysUseTab:n=!1,windowOptions:s}){const c=yield i(o({type:"popup",url:e,state:"minimized"},s),n),b=c.id,d=c.tabs[0].id,f=l(),p=f.promise,w=f.resolve,y=f.reject;browser.webRequest.onBeforeRequest.addListener(v,{urls:["*://*/*"],tabId:d,types:["main_frame"]},["blocking"]),browser.webNavigation.onDOMContentLoaded.addListener(m),browser.tabs.onRemoved.addListener(O);try{return yield p}finally{browser.webRequest.onBeforeRequest.removeListener(v),browser.webNavigation.onDOMContentLoaded.removeListener(m),browser.tabs.onRemoved.removeListener(O),a(b,d).catch(e=>console.error(e))}function v(e){if(!e.frameId&&e.tabId===d&&e.url.startsWith(r))return w(e.url),{cancel:!0}}function m(e){e.frameId||e.tabId!==d||(t?u(b,d,{focused:!0,state:"normal"}).catch(e=>console.error(e)):y(new Error("User interaction required")),browser.webNavigation.onDOMContentLoaded.removeListener(m))}function O(e){e===d&&y(new Error("Canceled by user"))}}))).apply(this,arguments)}return function(e){return d.apply(this,arguments)}}();
//# sourceMappingURL=webext-launch-web-auth-flow.min.js.map