extension-develop 2.0.0-rc.24 → 2.0.0-rc.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/add-hmr-accept-code.js +60 -15
- package/dist/deprecated-shadow-root.js +62 -18
- package/dist/ensure-hmr-for-scripts.js +71 -28
- package/dist/inject-chromium-client-loader.js +50 -17
- package/dist/inject-firefox-client-loader.js +64 -21
- package/dist/minimum-chromium-file.js +5 -0
- package/dist/minimum-content-file.js +5 -0
- package/dist/minimum-firefox-file.js +5 -0
- package/dist/minimum-script-file.js +5 -0
- package/dist/module.js +660 -750
- package/package.json +3 -3
- package/dist/958.js +0 -157742
- package/dist/958.js.LICENSE.txt +0 -14
- package/dist/dirname.d.ts +0 -1
|
@@ -1,11 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
default: ()=>add_hmr_accept_code
|
|
37
|
+
});
|
|
38
|
+
const external_fs_namespaceObject = require("fs");
|
|
39
|
+
var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
|
|
40
|
+
const external_path_namespaceObject = require("path");
|
|
41
|
+
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
42
|
+
const external_loader_utils_namespaceObject = require("loader-utils");
|
|
43
|
+
const external_schema_utils_namespaceObject = require("schema-utils");
|
|
5
44
|
function isUsingJSFramework(projectPath) {
|
|
6
|
-
const packageJsonPath =
|
|
7
|
-
if (!
|
|
8
|
-
const packageJson = JSON.parse(
|
|
45
|
+
const packageJsonPath = external_path_default().join(projectPath, 'package.json');
|
|
46
|
+
if (!external_fs_default().existsSync(packageJsonPath)) return false;
|
|
47
|
+
const packageJson = JSON.parse(external_fs_default().readFileSync(packageJsonPath, 'utf-8'));
|
|
9
48
|
const frameworks = [
|
|
10
49
|
'react',
|
|
11
50
|
'vue',
|
|
@@ -36,35 +75,41 @@ const schema = {
|
|
|
36
75
|
function add_hmr_accept_code(source) {
|
|
37
76
|
const options = this.getOptions();
|
|
38
77
|
const manifestPath = options.manifestPath;
|
|
39
|
-
const projectPath =
|
|
40
|
-
const manifest = JSON.parse(
|
|
41
|
-
(0,
|
|
78
|
+
const projectPath = external_path_default().dirname(manifestPath);
|
|
79
|
+
const manifest = JSON.parse(external_fs_default().readFileSync(manifestPath, 'utf-8'));
|
|
80
|
+
(0, external_schema_utils_namespaceObject.validate)(schema, options, {
|
|
42
81
|
name: "scripts:add-hmr-accept-code",
|
|
43
82
|
baseDataPath: 'options'
|
|
44
83
|
});
|
|
45
|
-
const url = (0,
|
|
84
|
+
const url = (0, external_loader_utils_namespaceObject.urlToRequest)(this.resourcePath);
|
|
46
85
|
const reloadCode = `
|
|
47
86
|
// TODO: cezaraugusto re-visit this
|
|
48
87
|
// if (import.meta.webpackHot) { import.meta.webpackHot.accept() };
|
|
49
88
|
`;
|
|
50
89
|
if (manifest.background) {
|
|
51
90
|
if (manifest.background.scripts) for (const bgScript of manifest.background.scripts){
|
|
52
|
-
const absoluteUrl =
|
|
91
|
+
const absoluteUrl = external_path_default().resolve(projectPath, bgScript);
|
|
53
92
|
if (url.includes(absoluteUrl)) return `${reloadCode}${source}`;
|
|
54
93
|
}
|
|
55
94
|
}
|
|
56
95
|
if (manifest.content_scripts) {
|
|
57
96
|
if (!isUsingJSFramework(projectPath)) {
|
|
58
97
|
for (const contentScript of manifest.content_scripts)if (contentScript.js) for (const js of contentScript.js){
|
|
59
|
-
const absoluteUrl =
|
|
98
|
+
const absoluteUrl = external_path_default().resolve(projectPath, js);
|
|
60
99
|
if (url.includes(absoluteUrl)) return `${reloadCode}${source}`;
|
|
61
100
|
}
|
|
62
101
|
}
|
|
63
102
|
}
|
|
64
103
|
if (manifest.user_scripts) for (const userScript of manifest.user_scripts){
|
|
65
|
-
const absoluteUrl =
|
|
104
|
+
const absoluteUrl = external_path_default().resolve(projectPath, userScript);
|
|
66
105
|
if (url.includes(absoluteUrl)) return `${reloadCode}${source}`;
|
|
67
106
|
}
|
|
68
107
|
return source;
|
|
69
108
|
}
|
|
70
|
-
|
|
109
|
+
exports["default"] = __webpack_exports__["default"];
|
|
110
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
111
|
+
"default"
|
|
112
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
113
|
+
Object.defineProperty(exports, '__esModule', {
|
|
114
|
+
value: true
|
|
115
|
+
});
|
|
@@ -1,10 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
default: ()=>deprecated_shadow_root
|
|
37
|
+
});
|
|
38
|
+
const external_path_namespaceObject = require("path");
|
|
39
|
+
const external_fs_namespaceObject = require("fs");
|
|
40
|
+
const external_loader_utils_namespaceObject = require("loader-utils");
|
|
41
|
+
const external_schema_utils_namespaceObject = require("schema-utils");
|
|
42
|
+
const external_chalk_namespaceObject = require("chalk");
|
|
43
|
+
var external_chalk_default = /*#__PURE__*/ __webpack_require__.n(external_chalk_namespaceObject);
|
|
44
|
+
external_path_namespaceObject.join(process.cwd(), 'node_modules/extension-develop/dist/certs');
|
|
8
45
|
const CHROMIUM_BASED_BROWSERS = [
|
|
9
46
|
'chrome',
|
|
10
47
|
'edge'
|
|
@@ -16,14 +53,15 @@ const GECKO_BASED_BROWSERS = [
|
|
|
16
53
|
...CHROMIUM_BASED_BROWSERS,
|
|
17
54
|
...GECKO_BASED_BROWSERS
|
|
18
55
|
];
|
|
56
|
+
require("console");
|
|
19
57
|
function getLoggingPrefix(feature, type) {
|
|
20
|
-
if ('error' === type) return `${
|
|
21
|
-
if ('warn' === type) return `${feature} ${
|
|
22
|
-
const arrow = 'info' === type ?
|
|
23
|
-
return `${arrow} ${
|
|
58
|
+
if ('error' === type) return `${external_chalk_default().bold(external_chalk_default().red('ERROR'))} in ${feature} ${external_chalk_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
59
|
+
if ('warn' === type) return `${feature} ${external_chalk_default().yellow("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
60
|
+
const arrow = 'info' === type ? external_chalk_default().cyan("\u25BA\u25BA\u25BA") : external_chalk_default().green("\u25BA\u25BA\u25BA");
|
|
61
|
+
return `${arrow} ${external_chalk_default().cyan(feature)}`;
|
|
24
62
|
}
|
|
25
63
|
function deprecatedShadowRoot() {
|
|
26
|
-
return `${getLoggingPrefix('DEPRECATION', 'warn')} Using ${
|
|
64
|
+
return `${getLoggingPrefix('DEPRECATION', 'warn')} Using ${external_chalk_default().yellow('window.__EXTENSION_SHADOW_ROOT__')} in content_scripts is deprecated\nand will be removed in a future version of Extension.js. To use content_scripts with\nthe shadow DOM, see one of the many examples at:\nhttps://github.com/extension-js/extension.js/tree/main/examples\n\nIf you really need to use the shadow DOM as-is, the latest version of Extension.js\nto support it is extension@2.0.0-beta.9.\n`;
|
|
27
65
|
}
|
|
28
66
|
const schema = {
|
|
29
67
|
type: 'object',
|
|
@@ -39,13 +77,13 @@ const schema = {
|
|
|
39
77
|
function deprecated_shadow_root(source) {
|
|
40
78
|
const options = this.getOptions();
|
|
41
79
|
const manifestPath = options.manifestPath;
|
|
42
|
-
const projectPath =
|
|
43
|
-
const manifest = JSON.parse(
|
|
44
|
-
(0,
|
|
80
|
+
const projectPath = external_path_namespaceObject.dirname(manifestPath);
|
|
81
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf8'));
|
|
82
|
+
(0, external_schema_utils_namespaceObject.validate)(schema, options, {
|
|
45
83
|
name: "scripts:deprecated-shadow-root",
|
|
46
84
|
baseDataPath: 'options'
|
|
47
85
|
});
|
|
48
|
-
const url = (0,
|
|
86
|
+
const url = (0, external_loader_utils_namespaceObject.urlToRequest)(this.resourcePath);
|
|
49
87
|
const patchCssTag = `
|
|
50
88
|
;const appendStyleElementForLegacyShadowRoot = (legacyShadowRoot, stylesheets) => {
|
|
51
89
|
if (typeof chrome !== 'undefined' || typeof browser !== 'undefined') {
|
|
@@ -77,7 +115,7 @@ function injectStyles() {
|
|
|
77
115
|
};injectStyles();`;
|
|
78
116
|
if (manifest.content_scripts) {
|
|
79
117
|
for (const contentScript of manifest.content_scripts)if (contentScript.js) for (const js of contentScript.js){
|
|
80
|
-
const absoluteUrl =
|
|
118
|
+
const absoluteUrl = external_path_namespaceObject.resolve(projectPath, js);
|
|
81
119
|
if (url.includes(absoluteUrl)) {
|
|
82
120
|
if (source.includes('__EXTENSION_SHADOW_ROOT__')) {
|
|
83
121
|
console.warn(deprecatedShadowRoot());
|
|
@@ -89,4 +127,10 @@ function injectStyles() {
|
|
|
89
127
|
}
|
|
90
128
|
return source;
|
|
91
129
|
}
|
|
92
|
-
|
|
130
|
+
exports["default"] = __webpack_exports__["default"];
|
|
131
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
132
|
+
"default"
|
|
133
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
134
|
+
Object.defineProperty(exports, '__esModule', {
|
|
135
|
+
value: true
|
|
136
|
+
});
|
|
@@ -1,13 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
default: ()=>ensureHMRForScripts
|
|
37
|
+
});
|
|
38
|
+
const external_path_namespaceObject = require("path");
|
|
39
|
+
const external_fs_namespaceObject = require("fs");
|
|
40
|
+
const external_loader_utils_namespaceObject = require("loader-utils");
|
|
41
|
+
const external_schema_utils_namespaceObject = require("schema-utils");
|
|
42
|
+
const external_parse5_utils_namespaceObject = require("parse5-utils");
|
|
43
|
+
var external_parse5_utils_default = /*#__PURE__*/ __webpack_require__.n(external_parse5_utils_namespaceObject);
|
|
11
44
|
function isUrl(src) {
|
|
12
45
|
try {
|
|
13
46
|
new URL(src);
|
|
@@ -19,7 +52,7 @@ function isUrl(src) {
|
|
|
19
52
|
function parseHtml(node, onResourceFound) {
|
|
20
53
|
const { childNodes = [] } = node;
|
|
21
54
|
for (const childNode of childNodes)if ("script" === childNode.nodeName) {
|
|
22
|
-
const src =
|
|
55
|
+
const src = external_parse5_utils_default().getAttribute(childNode, 'src');
|
|
23
56
|
if (!src) continue;
|
|
24
57
|
if (isUrl(src)) continue;
|
|
25
58
|
onResourceFound({
|
|
@@ -28,8 +61,8 @@ function parseHtml(node, onResourceFound) {
|
|
|
28
61
|
assetType: "script"
|
|
29
62
|
});
|
|
30
63
|
} else if ('link' === childNode.nodeName) {
|
|
31
|
-
const href =
|
|
32
|
-
const rel =
|
|
64
|
+
const href = external_parse5_utils_default().getAttribute(childNode, 'href');
|
|
65
|
+
const rel = external_parse5_utils_default().getAttribute(childNode, 'rel');
|
|
33
66
|
if (!href) continue;
|
|
34
67
|
if (isUrl(href)) continue;
|
|
35
68
|
onResourceFound('dns-prefetch' === rel || 'icon' === rel || 'manifest' === rel || 'modulepreload' === rel || 'preconnect' === rel || 'prefetch' === rel || 'preload' === rel || 'prerender' === rel ? {
|
|
@@ -42,7 +75,7 @@ function parseHtml(node, onResourceFound) {
|
|
|
42
75
|
assetType: 'css'
|
|
43
76
|
});
|
|
44
77
|
} else if ('a' === childNode.nodeName || 'area' === childNode.nodeName) {
|
|
45
|
-
const href =
|
|
78
|
+
const href = external_parse5_utils_default().getAttribute(childNode, 'href');
|
|
46
79
|
if (!href) continue;
|
|
47
80
|
if (isUrl(href)) continue;
|
|
48
81
|
onResourceFound({
|
|
@@ -51,7 +84,7 @@ function parseHtml(node, onResourceFound) {
|
|
|
51
84
|
assetType: 'staticHref'
|
|
52
85
|
});
|
|
53
86
|
} else if ('audio' === childNode.nodeName || 'embed' === childNode.nodeName || 'iframe' === childNode.nodeName || 'img' === childNode.nodeName || 'input' === childNode.nodeName || 'source' === childNode.nodeName || 'track' === childNode.nodeName || 'video' === childNode.nodeName) {
|
|
54
|
-
const src =
|
|
87
|
+
const src = external_parse5_utils_default().getAttribute(childNode, 'src');
|
|
55
88
|
if (!src) continue;
|
|
56
89
|
if (isUrl(src)) continue;
|
|
57
90
|
onResourceFound({
|
|
@@ -68,11 +101,11 @@ function getAssetsFromHtml(htmlFilePath, htmlContent) {
|
|
|
68
101
|
static: []
|
|
69
102
|
};
|
|
70
103
|
if (!htmlFilePath) return assets;
|
|
71
|
-
const htmlString = htmlContent ||
|
|
104
|
+
const htmlString = htmlContent || external_fs_namespaceObject.readFileSync(htmlFilePath, {
|
|
72
105
|
encoding: 'utf8'
|
|
73
106
|
});
|
|
74
|
-
const htmlDocument =
|
|
75
|
-
const getAbsolutePath = (htmlFilePath, filePath)=>
|
|
107
|
+
const htmlDocument = external_parse5_utils_default().parse(htmlString);
|
|
108
|
+
const getAbsolutePath = (htmlFilePath, filePath)=>external_path_namespaceObject.join(external_path_namespaceObject.dirname(htmlFilePath), filePath.startsWith('/') ? external_path_namespaceObject.relative(external_path_namespaceObject.dirname(htmlFilePath), filePath) : filePath);
|
|
76
109
|
for (const node of htmlDocument.childNodes)if ('html' === node.nodeName) {
|
|
77
110
|
for (const childNode of node.childNodes)if ('head' === childNode.nodeName || 'body' === childNode.nodeName) parseHtml(childNode, ({ filePath, assetType })=>{
|
|
78
111
|
const fileAbsolutePath = getAbsolutePath(htmlFilePath, filePath);
|
|
@@ -102,7 +135,10 @@ function getAssetsFromHtml(htmlFilePath, htmlContent) {
|
|
|
102
135
|
};
|
|
103
136
|
}
|
|
104
137
|
}
|
|
105
|
-
|
|
138
|
+
require("child_process");
|
|
139
|
+
require("package-manager-detector");
|
|
140
|
+
require("chalk");
|
|
141
|
+
external_path_namespaceObject.join(process.cwd(), 'node_modules/extension-develop/dist/certs');
|
|
106
142
|
const constants_CHROMIUM_BASED_BROWSERS = [
|
|
107
143
|
'chrome',
|
|
108
144
|
'edge'
|
|
@@ -114,10 +150,11 @@ const GECKO_BASED_BROWSERS = [
|
|
|
114
150
|
...constants_CHROMIUM_BASED_BROWSERS,
|
|
115
151
|
...GECKO_BASED_BROWSERS
|
|
116
152
|
];
|
|
153
|
+
require("console");
|
|
117
154
|
function isUsingJSFramework(projectPath) {
|
|
118
|
-
const packageJsonPath =
|
|
119
|
-
if (!
|
|
120
|
-
const packageJson = JSON.parse(
|
|
155
|
+
const packageJsonPath = external_path_namespaceObject.join(projectPath, 'package.json');
|
|
156
|
+
if (!external_fs_namespaceObject.existsSync(packageJsonPath)) return false;
|
|
157
|
+
const packageJson = JSON.parse(external_fs_namespaceObject.readFileSync(packageJsonPath, 'utf-8'));
|
|
121
158
|
const frameworks = [
|
|
122
159
|
'react',
|
|
123
160
|
'vue',
|
|
@@ -151,12 +188,12 @@ const schema = {
|
|
|
151
188
|
function ensureHMRForScripts(source) {
|
|
152
189
|
const options = this.getOptions();
|
|
153
190
|
const manifestPath = options.manifestPath;
|
|
154
|
-
const projectPath =
|
|
155
|
-
(0,
|
|
191
|
+
const projectPath = external_path_namespaceObject.dirname(manifestPath);
|
|
192
|
+
(0, external_schema_utils_namespaceObject.validate)(schema, options, {
|
|
156
193
|
name: "html:ensure-hmr-for-scripts",
|
|
157
194
|
baseDataPath: 'options'
|
|
158
195
|
});
|
|
159
|
-
const url = (0,
|
|
196
|
+
const url = (0, external_loader_utils_namespaceObject.urlToRequest)(this.resourcePath);
|
|
160
197
|
const reloadCode = `
|
|
161
198
|
// TODO: cezaraugusto re-visit this
|
|
162
199
|
if (import.meta.webpackHot) { import.meta.webpackHot.accept() };
|
|
@@ -166,15 +203,21 @@ if (import.meta.webpackHot) { import.meta.webpackHot.accept() };
|
|
|
166
203
|
for (const field of Object.entries(allEntries)){
|
|
167
204
|
const [, resource] = field;
|
|
168
205
|
if (resource) {
|
|
169
|
-
if (!
|
|
206
|
+
if (!external_fs_namespaceObject.existsSync(resource)) return;
|
|
170
207
|
const htmlAssets = getAssetsFromHtml(resource);
|
|
171
208
|
const fileAssets = (null == htmlAssets ? void 0 : htmlAssets.js) || [];
|
|
172
209
|
for (const asset of fileAssets){
|
|
173
|
-
const absoluteUrl =
|
|
210
|
+
const absoluteUrl = external_path_namespaceObject.resolve(projectPath, asset);
|
|
174
211
|
if (url.includes(absoluteUrl)) return `${reloadCode}${source}`;
|
|
175
212
|
}
|
|
176
213
|
}
|
|
177
214
|
}
|
|
178
215
|
return source;
|
|
179
216
|
}
|
|
180
|
-
|
|
217
|
+
exports["default"] = __webpack_exports__["default"];
|
|
218
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
219
|
+
"default"
|
|
220
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
221
|
+
Object.defineProperty(exports, '__esModule', {
|
|
222
|
+
value: true
|
|
223
|
+
});
|
|
@@ -1,13 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
default: ()=>inject_chromium_client_loader
|
|
28
|
+
});
|
|
29
|
+
const external_path_namespaceObject = require("path");
|
|
30
|
+
const external_fs_namespaceObject = require("fs");
|
|
31
|
+
const external_loader_utils_namespaceObject = require("loader-utils");
|
|
32
|
+
const external_schema_utils_namespaceObject = require("schema-utils");
|
|
33
|
+
require("child_process");
|
|
34
|
+
require("package-manager-detector");
|
|
35
|
+
require("chalk");
|
|
36
|
+
external_path_namespaceObject.join(process.cwd(), 'node_modules/extension-develop/dist/certs');
|
|
11
37
|
const CHROMIUM_BASED_BROWSERS = [
|
|
12
38
|
'chrome',
|
|
13
39
|
'edge'
|
|
@@ -19,6 +45,7 @@ const GECKO_BASED_BROWSERS = [
|
|
|
19
45
|
...CHROMIUM_BASED_BROWSERS,
|
|
20
46
|
...GECKO_BASED_BROWSERS
|
|
21
47
|
];
|
|
48
|
+
require("console");
|
|
22
49
|
function filterKeysForThisBrowser(manifest, browser) {
|
|
23
50
|
const patchedManifest = JSON.parse(JSON.stringify(manifest), function(key, value) {
|
|
24
51
|
const indexOfColon = key.indexOf(':');
|
|
@@ -43,14 +70,14 @@ function inject_chromium_client_loader(source) {
|
|
|
43
70
|
const options = this.getOptions();
|
|
44
71
|
const manifestPath = options.manifestPath;
|
|
45
72
|
const browser = options.browser;
|
|
46
|
-
const projectPath =
|
|
47
|
-
const manifest = JSON.parse(
|
|
73
|
+
const projectPath = external_path_namespaceObject.dirname(manifestPath);
|
|
74
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf-8'));
|
|
48
75
|
const patchedManifest = filterKeysForThisBrowser(manifest, browser);
|
|
49
|
-
(0,
|
|
76
|
+
(0, external_schema_utils_namespaceObject.validate)(schema, options, {
|
|
50
77
|
name: 'reload:inject-background-client',
|
|
51
78
|
baseDataPath: 'options'
|
|
52
79
|
});
|
|
53
|
-
const url = (0,
|
|
80
|
+
const url = (0, external_loader_utils_namespaceObject.urlToRequest)(this.resourcePath);
|
|
54
81
|
const generalReloadCode = `
|
|
55
82
|
;chrome.runtime.onMessageExternal.addListener(
|
|
56
83
|
async (request, _sender, sendResponse) => {
|
|
@@ -94,18 +121,24 @@ function inject_chromium_client_loader(source) {
|
|
|
94
121
|
if (2 === patchedManifest.manifest_version) for (const bgScript of [
|
|
95
122
|
backgroundScripts[0]
|
|
96
123
|
]){
|
|
97
|
-
const absoluteUrl =
|
|
124
|
+
const absoluteUrl = external_path_namespaceObject.resolve(projectPath, bgScript);
|
|
98
125
|
if (url.includes(absoluteUrl)) return `${generalReloadCode}${source}`;
|
|
99
126
|
}
|
|
100
127
|
}
|
|
101
128
|
const serviceWorker = null == manifestBg ? void 0 : manifestBg.service_worker;
|
|
102
129
|
if (serviceWorker) {
|
|
103
130
|
if (3 === patchedManifest.manifest_version) {
|
|
104
|
-
const absoluteUrl =
|
|
131
|
+
const absoluteUrl = external_path_namespaceObject.resolve(projectPath, serviceWorker);
|
|
105
132
|
if (url.includes(absoluteUrl)) return `${generalReloadCode}${source}`;
|
|
106
133
|
}
|
|
107
134
|
}
|
|
108
135
|
}
|
|
109
136
|
return source;
|
|
110
137
|
}
|
|
111
|
-
|
|
138
|
+
exports["default"] = __webpack_exports__["default"];
|
|
139
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
140
|
+
"default"
|
|
141
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
142
|
+
Object.defineProperty(exports, '__esModule', {
|
|
143
|
+
value: true
|
|
144
|
+
});
|
|
@@ -1,13 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
default: ()=>inject_firefox_client_loader
|
|
37
|
+
});
|
|
38
|
+
const external_path_namespaceObject = require("path");
|
|
39
|
+
const external_fs_namespaceObject = require("fs");
|
|
40
|
+
const external_loader_utils_namespaceObject = require("loader-utils");
|
|
41
|
+
const external_schema_utils_namespaceObject = require("schema-utils");
|
|
42
|
+
require("child_process");
|
|
43
|
+
require("package-manager-detector");
|
|
44
|
+
const external_chalk_namespaceObject = require("chalk");
|
|
45
|
+
var external_chalk_default = /*#__PURE__*/ __webpack_require__.n(external_chalk_namespaceObject);
|
|
46
|
+
external_path_namespaceObject.join(process.cwd(), 'node_modules/extension-develop/dist/certs');
|
|
11
47
|
const CHROMIUM_BASED_BROWSERS = [
|
|
12
48
|
'chrome',
|
|
13
49
|
'edge'
|
|
@@ -19,14 +55,15 @@ const GECKO_BASED_BROWSERS = [
|
|
|
19
55
|
...CHROMIUM_BASED_BROWSERS,
|
|
20
56
|
...GECKO_BASED_BROWSERS
|
|
21
57
|
];
|
|
58
|
+
require("console");
|
|
22
59
|
function getLoggingPrefix(feature, type) {
|
|
23
|
-
if ('error' === type) return `${
|
|
24
|
-
if ('warn' === type) return `${feature} ${
|
|
25
|
-
const arrow = 'info' === type ?
|
|
26
|
-
return `${arrow} ${
|
|
60
|
+
if ('error' === type) return `${external_chalk_default().bold(external_chalk_default().red('ERROR'))} in ${feature} ${external_chalk_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
61
|
+
if ('warn' === type) return `${feature} ${external_chalk_default().yellow("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
62
|
+
const arrow = 'info' === type ? external_chalk_default().cyan("\u25BA\u25BA\u25BA") : external_chalk_default().green("\u25BA\u25BA\u25BA");
|
|
63
|
+
return `${arrow} ${external_chalk_default().cyan(feature)}`;
|
|
27
64
|
}
|
|
28
65
|
function firefoxServiceWorkerError() {
|
|
29
|
-
return `${getLoggingPrefix('Firefox runner', 'error')} No Service Worker Support\n\nFirefox does not support the ${
|
|
66
|
+
return `${getLoggingPrefix('Firefox runner', 'error')} No Service Worker Support\n\nFirefox does not support the ${external_chalk_default().yellow('background.service_worker')} field yet.\nUpdate your manifest.json file to use ${external_chalk_default().yellow("background.scripts")} instead.\nIf you really need to keep the ${external_chalk_default().yellow('service_worker')} field, prefix it with\n${external_chalk_default().yellow('chromium:')} so it can target only Chromium-based browsers.\n\nMozilla bug: ${external_chalk_default().underline('https://bugzilla.mozilla.org/show_bug.cgi?id=1573659')}.`;
|
|
30
67
|
}
|
|
31
68
|
function filterKeysForThisBrowser(manifest, browser) {
|
|
32
69
|
const patchedManifest = JSON.parse(JSON.stringify(manifest), function(key, value) {
|
|
@@ -52,14 +89,14 @@ function inject_firefox_client_loader(source) {
|
|
|
52
89
|
const options = this.getOptions();
|
|
53
90
|
const manifestPath = options.manifestPath;
|
|
54
91
|
const browser = options.browser;
|
|
55
|
-
const projectPath =
|
|
56
|
-
const manifest = JSON.parse(
|
|
92
|
+
const projectPath = external_path_namespaceObject.dirname(manifestPath);
|
|
93
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf-8'));
|
|
57
94
|
const patchedManifest = filterKeysForThisBrowser(manifest, browser);
|
|
58
|
-
(0,
|
|
95
|
+
(0, external_schema_utils_namespaceObject.validate)(schema, options, {
|
|
59
96
|
name: 'reload:inject-background-client',
|
|
60
97
|
baseDataPath: 'options'
|
|
61
98
|
});
|
|
62
|
-
const url = (0,
|
|
99
|
+
const url = (0, external_loader_utils_namespaceObject.urlToRequest)(this.resourcePath);
|
|
63
100
|
const generalReloadCode = `
|
|
64
101
|
;browser.runtime.onMessageExternal.addListener(async (request, _sender) => {
|
|
65
102
|
const managementInfo = await browser.management.getSelf()
|
|
@@ -99,10 +136,16 @@ function inject_firefox_client_loader(source) {
|
|
|
99
136
|
if (backgroundScripts) for (const bgScript of [
|
|
100
137
|
backgroundScripts[0]
|
|
101
138
|
]){
|
|
102
|
-
const absoluteUrl =
|
|
139
|
+
const absoluteUrl = external_path_namespaceObject.resolve(projectPath, bgScript);
|
|
103
140
|
if (url.includes(absoluteUrl)) return `${generalReloadCode}${source}`;
|
|
104
141
|
}
|
|
105
142
|
}
|
|
106
143
|
return source;
|
|
107
144
|
}
|
|
108
|
-
|
|
145
|
+
exports["default"] = __webpack_exports__["default"];
|
|
146
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
147
|
+
"default"
|
|
148
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
149
|
+
Object.defineProperty(exports, '__esModule', {
|
|
150
|
+
value: true
|
|
151
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var __webpack_exports__ = {};
|
|
1
2
|
chrome.runtime.onMessageExternal.addListener(async (request, _sender, sendResponse)=>{
|
|
2
3
|
const managementInfo = await new Promise((resolve)=>{
|
|
3
4
|
chrome.management.getSelf(resolve);
|
|
@@ -18,3 +19,7 @@ chrome.runtime.onMessageExternal.addListener(async (request, _sender, sendRespon
|
|
|
18
19
|
}
|
|
19
20
|
return true;
|
|
20
21
|
});
|
|
22
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
23
|
+
Object.defineProperty(exports, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|