Gildas 4 недель назад
Родитель
Сommit
c061fc33d7

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
lib/single-file-extension-frames.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
lib/single-file-hooks-frames.js


+ 4 - 4
package-lock.json

@@ -9,7 +9,7 @@
 			"version": "1.2.4",
 			"license": "AGPL-3.0-or-later",
 			"dependencies": {
-				"single-file-core": "1.5.63"
+				"single-file-core": "1.5.64"
 			},
 			"devDependencies": {
 				"@rollup/plugin-node-resolve": "16.0.3",
@@ -1642,9 +1642,9 @@
 			}
 		},
 		"node_modules/single-file-core": {
-			"version": "1.5.63",
-			"resolved": "https://registry.npmjs.org/single-file-core/-/single-file-core-1.5.63.tgz",
-			"integrity": "sha512-GUxy0vQZqcFCWs0i8qb3Z/yTE9hIr0biKSNfc2lmBF+tTGOa+eY2IWZUFr4E1/gBMMXnK7eZTIGiW95JF2w8Nw==",
+			"version": "1.5.64",
+			"resolved": "https://registry.npmjs.org/single-file-core/-/single-file-core-1.5.64.tgz",
+			"integrity": "sha512-oK7d9GyLnBr77Y39Iu1vOytB1uFpE4umuwtYMlxQJZkVyF67uJQinoDo0BQSQSXKjv4Bp+CXLJlGr9H2rnKkqQ==",
 			"license": "AGPL-3.0-or-later"
 		},
 		"node_modules/smob": {

+ 1 - 1
package.json

@@ -10,7 +10,7 @@
 	},
 	"type": "module",
 	"dependencies": {
-		"single-file-core": "1.5.63"
+		"single-file-core": "1.5.64"
 	},
 	"devDependencies": {
 		"eslint": "^9.39.1",

+ 6 - 1
rollup.config.js

@@ -3,6 +3,11 @@ import terser from "@rollup/plugin-terser";
 
 const PLUGINS = [resolve({ moduleDirectories: ["node_modules"] })];
 const EXTERNAL = ["single-file-core"];
+const TERSER_HOOKS_OPTIONS = {
+	mangle: {
+		keep_fnames: true
+	}
+};
 
 export default [{
 	input: ["single-file-core/single-file.js"],
@@ -39,7 +44,7 @@ export default [{
 	output: [{
 		file: "lib/single-file-hooks-frames.js",
 		format: "iife",
-		plugins: [terser()]
+		plugins: [terser(TERSER_HOOKS_OPTIONS)]
 	}],
 	plugins: PLUGINS,
 	external: EXTERNAL

+ 0 - 1
src/core/content/content-frames.js

@@ -21,5 +21,4 @@
  *   Source.
  */
 
-import "./../../lib/single-file/core/content/content-hooks-frames-inline-injection.js";
 import "./../../lib/single-file/fetch/content/content-fetch.js";

+ 0 - 107
src/lib/single-file/core/content/content-hooks-frames-inline-injection.js

@@ -1,107 +0,0 @@
-/*
- * Copyright 2010-2020 Gildas Lormeau
- * contact : gildas.lormeau <at> gmail.com
- * 
- * This file is part of SingleFile.
- *
- *   The code in this file is free software: you can redistribute it and/or 
- *   modify it under the terms of the GNU Affero General Public License 
- *   (GNU AGPL) as published by the Free Software Foundation, either version 3
- *   of the License, or (at your option) any later version.
- * 
- *   The code in this file 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 Affero 
- *   General Public License for more details.
- *
- *   As additional permission under GNU AGPL version 3 section 7, you may 
- *   distribute UNMODIFIED VERSIONS OF THIS file without the copy of the GNU 
- *   AGPL normally required by section 4, provided you include this license 
- *   notice and a URL through which recipients can access the Corresponding 
- *   Source.
- */
-
-/* global window */
-
-const document = globalThis.document;
-const Document = globalThis.Document;
-
-if (document instanceof Document) {
-	let scriptElement = document.createElement("script");
-	scriptElement.src = "data:," + "(" + injectedScript.toString() + ")()";
-	(document.documentElement || document).appendChild(scriptElement);
-	scriptElement.remove();
-	scriptElement = document.createElement("script");
-	scriptElement.textContent = "(" + injectedScript.toString() + ")()";
-	(document.documentElement || document).appendChild(scriptElement);
-	scriptElement.remove();
-}
-
-function injectedScript() {
-	if (typeof globalThis == "undefined") {
-		window.globalThis = window;
-	}
-	const document = globalThis.document;
-	const CustomEvent = globalThis.CustomEvent;
-	const FileReader = globalThis.FileReader;
-	const Blob = globalThis.Blob;
-	const NEW_FONT_FACE_EVENT = "single-file-new-font-face";
-	const DELETE_FONT_EVENT = "single-file-delete-font";
-	const CLEAR_FONTS_EVENT = "single-file-clear-fonts";
-	const FONT_STYLE_PROPERTIES = {
-		family: "font-family",
-		style: "font-style",
-		weight: "font-weight",
-		stretch: "font-stretch",
-		unicodeRange: "unicode-range",
-		variant: "font-variant",
-		featureSettings: "font-feature-settings"
-	};
-
-	if (globalThis.FontFace) {
-		const FontFace = globalThis.FontFace;
-		globalThis.FontFace = function () {
-			getDetailObject(...arguments).then(detail => document.dispatchEvent(new CustomEvent(NEW_FONT_FACE_EVENT, { detail })));
-			return new FontFace(...arguments);
-		};
-		globalThis.FontFace.prototype = FontFace.prototype;
-		globalThis.FontFace.toString = function () { return "function FontFace() { [native code] }"; };
-		const deleteFont = document.fonts.delete;
-		document.fonts.delete = function (fontFace) {
-			getDetailObject(fontFace.family).then(detail => document.dispatchEvent(new CustomEvent(DELETE_FONT_EVENT, { detail })));
-			return deleteFont.call(document.fonts, fontFace);
-		};
-		document.fonts.delete.toString = function () { return "function delete() { [native code] }"; };
-		const clearFonts = document.fonts.clear;
-		document.fonts.clear = function () {
-			document.dispatchEvent(new CustomEvent(CLEAR_FONTS_EVENT));
-			return clearFonts.call(document.fonts);
-		};
-		document.fonts.clear.toString = function () { return "function clear() { [native code] }"; };
-	}
-
-	async function getDetailObject(fontFamily, src, descriptors) {
-		const detail = {};
-		detail["font-family"] = fontFamily;
-		detail.src = src;
-		if (descriptors) {
-			Object.keys(descriptors).forEach(descriptor => {
-				if (FONT_STYLE_PROPERTIES[descriptor]) {
-					detail[FONT_STYLE_PROPERTIES[descriptor]] = descriptors[descriptor];
-				}
-			});
-		}
-		return new Promise(resolve => {
-			if (detail.src instanceof ArrayBuffer) {
-				const reader = new FileReader();
-				reader.readAsDataURL(new Blob([detail.src]));
-				reader.addEventListener("load", () => {
-					detail.src = "url(" + reader.result + ")";
-					resolve(detail);
-				});
-			} else {
-				resolve(detail);
-			}
-		});
-	}
-}

Некоторые файлы не были показаны из-за большого количества измененных файлов