Explorar el Código

moved from "lib" to "extension/lib" code related to web extensions

Former-commit-id: f87ff5aca2214c6e8c64f653aad62780e35388fe
Gildas hace 6 años
padre
commit
f2c47e7fce

+ 2 - 0
cli/back-ends/jsdom.js

@@ -33,6 +33,7 @@ const request = require("request-promise-native");
 
 const SCRIPTS = [
 	"../../index.js",
+	"../../lib/index.js",
 	"../../lib/hooks/content/content-hooks.js",
 	"../../lib/frame-tree/content/content-frame-tree.js",
 	"../../lib/single-file/single-file-util.js",
@@ -51,6 +52,7 @@ const SCRIPTS = [
 	"../../lib/single-file/modules/html-images-alt-minifier.js",
 	"../../lib/single-file/modules/html-serializer.js",
 	"../../lib/single-file/single-file-core.js",
+	"../../extension/index.js",
 	"../../extension/core/common/infobar.js"
 ];
 

+ 2 - 0
cli/back-ends/puppeteer.js

@@ -29,6 +29,7 @@ const puppeteer = require("puppeteer-core");
 
 const SCRIPTS = [
 	"../../index.js",
+	"../../lib/index.js",
 	"../../lib/hooks/content/content-hooks.js",
 	"../../lib/hooks/content/content-hooks-frames.js",
 	"../../lib/frame-tree/content/content-frame-tree.js",
@@ -50,6 +51,7 @@ const SCRIPTS = [
 	"../../lib/single-file/modules/html-serializer.js",
 	"../../lib/single-file/single-file-core.js",
 	"../../lib/single-file/single-file.js",
+	"../../extension/index.js",
 	"../../extension/core/common/infobar.js"
 ];
 

+ 2 - 0
cli/back-ends/webdriver-chromium.js

@@ -31,6 +31,7 @@ const { Builder } = require("selenium-webdriver");
 
 const SCRIPTS = [
 	"../../index.js",
+	"../../lib/index.js",
 	"../../lib/hooks/content/content-hooks.js",
 	"../../lib/hooks/content/content-hooks-frames.js",
 	"../../lib/frame-tree/content/content-frame-tree.js",
@@ -52,6 +53,7 @@ const SCRIPTS = [
 	"../../lib/single-file/modules/html-serializer.js",
 	"../../lib/single-file/single-file-core.js",
 	"../../lib/single-file/single-file.js",
+	"../../extension/index.js",
 	"../../extension/core/common/infobar.js"
 ];
 

+ 2 - 0
cli/back-ends/webdriver-gecko.js

@@ -31,6 +31,7 @@ const { Builder, By, Key } = require("selenium-webdriver");
 
 const SCRIPTS = [
 	"../../index.js",
+	"../../lib/index.js",
 	"../../lib/hooks/content/content-hooks.js",
 	"../../lib/hooks/content/content-hooks-frames.js",
 	"../../lib/frame-tree/content/content-frame-tree.js",
@@ -52,6 +53,7 @@ const SCRIPTS = [
 	"../../lib/single-file/modules/html-serializer.js",
 	"../../lib/single-file/single-file-core.js",
 	"../../lib/single-file/single-file.js",
+	"../../extension/index.js",
 	"../../extension/core/common/infobar.js"
 ];
 

+ 9 - 5
extension/core/bg/business.js

@@ -29,15 +29,17 @@ singlefile.extension.core.bg.business = (() => {
 
 	const contentScriptFiles = [
 		"/index.js",
+		"/lib/index.js",
 		"/lib/hooks/content/content-hooks.js",
-		"/lib/browser-polyfill/chrome-browser-polyfill.js",
 		"/lib/single-file/vendor/css-tree.js",
 		"/lib/single-file/vendor/html-srcset-parser.js",
 		"/lib/single-file/single-file-util.js",
 		"/lib/single-file/single-file-helper.js",
-		"/lib/fetch/content/content-fetch-resources.js",
 		"/lib/single-file/single-file-core.js",
 		"/lib/single-file/single-file.js",
+		"/extension/index.js",
+		"/extension/lib/browser-polyfill/chrome-browser-polyfill.js",
+		"/extension/lib/fetch/content/content-fetch-resources.js",
 		"/extension/ui/content/content-ui-main.js",
 		"/extension/core/common/infobar.js",
 		"/extension/core/content/content-main.js"
@@ -45,11 +47,13 @@ singlefile.extension.core.bg.business = (() => {
 
 	const frameScriptFiles = [
 		"/index.js",
+		"/lib/index.js",
 		"/lib/hooks/content/content-hooks-frames.js",
-		"/lib/browser-polyfill/chrome-browser-polyfill.js",
 		"/lib/single-file/single-file-helper.js",
-		"/lib/fetch/content/content-fetch-resources.js",
-		"/lib/frame-tree/content/content-frame-tree.js"
+		"/lib/frame-tree/content/content-frame-tree.js",
+		"/extension/index.js",
+		"/extension/lib/browser-polyfill/chrome-browser-polyfill.js",
+		"/extension/lib/fetch/content/content-fetch-resources.js"
 	];
 
 	const modulesScriptFiles = [

+ 45 - 0
extension/index.js

@@ -0,0 +1,45 @@
+/*
+ * Copyright 2010-2019 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.
+ */
+
+this.singlefile.extension = this.singlefile.extension || {
+	core: {
+		common: {},
+		bg: {},
+		content: {}
+	},
+	ui: {
+		bg: {},
+		content: {}
+	},
+	lib: {
+		fetch: {
+			bg: {}
+		},
+		frameTree: {
+			bg: {}
+		},
+		lazy: {
+			bg: {}
+		},
+	}
+};

+ 0 - 0
lib/browser-polyfill/chrome-browser-polyfill.js → extension/lib/browser-polyfill/chrome-browser-polyfill.js


+ 1 - 1
lib/fetch/bg/fetch-resources.js → extension/lib/fetch/bg/fetch-resources.js

@@ -23,7 +23,7 @@
 
 /* global singlefile, browser, XMLHttpRequest */
 
-singlefile.lib.fetch.bg.resources = (() => {
+singlefile.extension.lib.fetch.bg.resources = (() => {
 
 	const responses = new Map();
 

+ 0 - 0
lib/fetch/content/content-fetch-resources.js → extension/lib/fetch/content/content-fetch-resources.js


+ 1 - 1
lib/frame-tree/bg/frame-tree.js → extension/lib/frame-tree/bg/frame-tree.js

@@ -23,7 +23,7 @@
 
 /* global singlefile, browser */
 
-singlefile.lib.frameTree.bg.main = (() => {
+singlefile.extension.lib.frameTree.bg.main = (() => {
 
 	"use strict";
 

+ 1 - 1
lib/lazy/bg/lazy-timeout.js → extension/lib/lazy/bg/lazy-timeout.js

@@ -23,7 +23,7 @@
 
 /* global singlefile, browser, setTimeout, clearTimeout */
 
-singlefile.lib.lazy.bg.main = (() => {
+singlefile.extension.lib.lazy.bg.main = (() => {
 
 	"use strict";
 

+ 1 - 1
extension/ui/devtools/devtools.html

@@ -6,7 +6,7 @@
 </head>
 
 <body>
-    <script type="text/javascript" src="/lib/browser-polyfill/chrome-browser-polyfill.js"></script>
+    <script type="text/javascript" src="/extension/lib/browser-polyfill/chrome-browser-polyfill.js"></script>
     <script src="devtools.js"></script>
 </body>
 

+ 1 - 1
extension/ui/pages/options.html

@@ -302,7 +302,7 @@
 			</form>
 		</div>
 	</main>
-	<script type="text/javascript" src="/lib/browser-polyfill/chrome-browser-polyfill.js"></script>
+	<script type="text/javascript" src="/extension/lib/browser-polyfill/chrome-browser-polyfill.js"></script>
 	<script type="text/javascript" src="../bg/ui-options.js"></script>
 </body>
 

+ 1 - 32
index.js

@@ -21,35 +21,4 @@
  *   Source.
  */
 
-this.singlefile = this.singlefile || {
-	extension: {
-		core: {
-			common: {},
-			bg: {},
-			content: {}
-		},
-		ui: {
-			bg: {},
-			content: {}
-		}
-	},
-	lib: {
-		fetch: {
-			bg: {},
-			content: {}
-		},
-		frameTree: {
-			bg: {},
-			content: {}
-		},
-		hooks: {
-			content: {}
-		},
-		lazy: {
-			bg: {},
-			content: {}
-		},
-		vendor: {},
-		modules: {}
-	}
-};
+this.singlefile = this.singlefile || {};

+ 39 - 0
lib/index.js

@@ -0,0 +1,39 @@
+/*
+ * Copyright 2010-2019 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.
+ */
+
+this.singlefile.lib = this.singlefile.lib || {
+	fetch: {
+		content: {}
+	},
+	frameTree: {
+		content: {}
+	},
+	hooks: {
+		content: {}
+	},
+	lazy: {
+		content: {}
+	},
+	vendor: {},
+	modules: {}
+};

+ 27 - 20
manifest.json

@@ -18,7 +18,9 @@
 			"run_at": "document_start",
 			"js": [
 				"index.js",
-				"lib/browser-polyfill/chrome-browser-polyfill.js",
+				"extension/index.js",
+				"extension/lib/browser-polyfill/chrome-browser-polyfill.js",
+				"lib/index.js",
 				"lib/hooks/content/content-hooks-frames.js",
 				"lib/single-file/single-file-helper.js",
 				"lib/frame-tree/content/content-frame-tree.js"
@@ -32,6 +34,7 @@
 			],
 			"js": [
 				"index.js",
+				"extension/index.js",
 				"extension/ui/content/content-ui-infobar.js"
 			]
 		},
@@ -42,7 +45,9 @@
 			"run_at": "document_start",
 			"js": [
 				"index.js",
+				"lib/index.js",
 				"lib/hooks/content/content-hooks.js",
+				"extension/index.js",
 				"extension/core/content/content-bootstrap.js"
 			]
 		}
@@ -50,24 +55,7 @@
 	"background": {
 		"scripts": [
 			"index.js",
-			"lib/browser-polyfill/chrome-browser-polyfill.js",
-			"lib/fetch/bg/fetch-resources.js",
-			"lib/fetch/content/content-fetch-resources.js",
-			"lib/frame-tree/bg/frame-tree.js",
-			"extension/core/bg/config.js",
-			"extension/core/bg/tabs-data.js",
-			"extension/core/bg/business.js",
-			"extension/core/bg/messages.js",
-			"extension/core/bg/tabs.js",
-			"extension/core/bg/downloads.js",
-			"extension/core/bg/autosave.js",
-			"extension/core/common/infobar.js",
-			"extension/core/bg/devtools.js",
-			"extension/ui/bg/ui-main.js",
-			"extension/ui/bg/ui-menus.js",
-			"extension/ui/bg/ui-commands.js",
-			"extension/ui/bg/ui-button.js",
-			"lib/lazy/bg/lazy-timeout.js",
+			"lib/index.js",
 			"lib/single-file/vendor/css-minifier.js",
 			"lib/single-file/vendor/css-tree.js",
 			"lib/single-file/vendor/css-media-query-parser.js",
@@ -84,7 +72,26 @@
 			"lib/single-file/modules/html-serializer.js",
 			"lib/single-file/modules/html-images-alt-minifier.js",
 			"lib/single-file/single-file-core.js",
-			"lib/single-file/single-file.js"
+			"lib/single-file/single-file.js",
+			"extension/index.js",
+			"extension/lib/browser-polyfill/chrome-browser-polyfill.js",
+			"extension/lib/fetch/content/content-fetch-resources.js",
+			"extension/lib/fetch/bg/fetch-resources.js",
+			"extension/lib/frame-tree/bg/frame-tree.js",
+			"extension/lib/lazy/bg/lazy-timeout.js",
+			"extension/core/bg/config.js",
+			"extension/core/bg/tabs-data.js",
+			"extension/core/bg/business.js",
+			"extension/core/bg/messages.js",
+			"extension/core/bg/tabs.js",
+			"extension/core/bg/downloads.js",
+			"extension/core/bg/autosave.js",
+			"extension/core/common/infobar.js",
+			"extension/core/bg/devtools.js",
+			"extension/ui/bg/ui-main.js",
+			"extension/ui/bg/ui-menus.js",
+			"extension/ui/bg/ui-commands.js",
+			"extension/ui/bg/ui-button.js"
 		],
 		"persistent": false
 	},