-
Notifications
You must be signed in to change notification settings - Fork 10
/
boot.js
51 lines (44 loc) · 1.72 KB
/
boot.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* NoScript Commons Library
* Reusable building blocks for cross-browser security/privacy WebExtensions.
* Copyright (C) 2020-2024 Giorgio Maone <https://maone.net>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
"use strict";
try {
const BASE = "";
// Execute as a node app to output the includes for Firefox's manifest.json scripts key // DEV_ONLY
globalThis.importScripts ||= (...src) => (importScripts.imported ||= []).push(...src); // DEV_ONLY
globalThis.include = src => Array.isArray(src) ? importScripts(...src) : importScripts(src);
let includeFrom = (dir, srcs) => include(srcs.map(name => `${BASE}/${dir}/${name}.js`));
includeFrom("lib", [
"browser-polyfill", "punycode",
]);
includeFrom("common", [
"UA", "uuid", "log", "locale",
"tld", "Messages",
"CSP", "CapsCSP", "NetCSP",
"RequestKey", "Sites", "Permissions", "Policy",
"Storage",
"sha256",
]);
includeFrom("service", [
"TabCache"
]);
if (importScripts.imported) console.log(JSON.stringify(importScripts.imported, null, 2)); // DEV_ONLY
} catch (e) {
console.error(e);
}