extension-develop 2.0.0-rc.35 → 2.0.0-rc.37
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/commands/commands-lib/config-types.d.ts +1 -0
- package/dist/deprecated-shadow-root.js +7 -7
- package/dist/ensure-hmr-for-scripts.js +19 -13
- package/dist/inject-chromium-client-loader.js +1 -1
- package/dist/inject-firefox-client-loader.js +7 -7
- package/dist/module.js +154 -125
- package/dist/webpack/plugin-compilation/clean-dist.d.ts +4 -0
- package/dist/webpack/plugin-compilation/index.d.ts +4 -1
- package/dist/webpack/plugin-extension/feature-html/html-lib/parse5-utilities/rslib.config.d.ts +2 -0
- package/dist/webpack/plugin-extension/feature-html/html-lib/parse5-utilities/src/index.d.ts +124 -0
- package/dist/webpack/plugin-extension/feature-html/html-lib/parse5-utilities/tests/index.test.d.ts +1 -0
- package/dist/webpack/plugin-extension/feature-html/html-lib/parse5-utilities/vitest.config.d.ts +2 -0
- package/dist/webpack/plugin-extension/feature-html/steps/ensure-hmr-for-scripts.d.ts +1 -1
- package/dist/webpack/webpack-config.d.ts +1 -0
- package/package.json +2 -2
|
@@ -39,8 +39,8 @@ const external_path_namespaceObject = require("path");
|
|
|
39
39
|
const external_fs_namespaceObject = require("fs");
|
|
40
40
|
const external_loader_utils_namespaceObject = require("loader-utils");
|
|
41
41
|
const external_schema_utils_namespaceObject = require("schema-utils");
|
|
42
|
-
const
|
|
43
|
-
var
|
|
42
|
+
const external_pintor_namespaceObject = require("pintor");
|
|
43
|
+
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_namespaceObject);
|
|
44
44
|
external_path_namespaceObject.join(process.cwd(), 'node_modules/extension-develop/dist/certs');
|
|
45
45
|
const CHROMIUM_BASED_BROWSERS = [
|
|
46
46
|
'chrome',
|
|
@@ -55,13 +55,13 @@ const GECKO_BASED_BROWSERS = [
|
|
|
55
55
|
];
|
|
56
56
|
require("console");
|
|
57
57
|
function getLoggingPrefix(feature, type) {
|
|
58
|
-
if ('error' === type) return `${
|
|
59
|
-
if ('warn' === type) return `${feature} ${
|
|
60
|
-
const arrow = 'info' === type ?
|
|
61
|
-
return `${arrow} ${
|
|
58
|
+
if ('error' === type) return `${external_pintor_default().bold(external_pintor_default().red('ERROR'))} in ${feature} ${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
59
|
+
if ('warn' === type) return `${feature} ${external_pintor_default().yellow("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
60
|
+
const arrow = 'info' === type ? external_pintor_default().cyan("\u25BA\u25BA\u25BA") : external_pintor_default().green("\u25BA\u25BA\u25BA");
|
|
61
|
+
return `${arrow} ${external_pintor_default().cyan(feature)}`;
|
|
62
62
|
}
|
|
63
63
|
function deprecatedShadowRoot() {
|
|
64
|
-
return `${getLoggingPrefix('DEPRECATION', 'warn')} Using ${
|
|
64
|
+
return `${getLoggingPrefix('DEPRECATION', 'warn')} Using ${external_pintor_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`;
|
|
65
65
|
}
|
|
66
66
|
const schema = {
|
|
67
67
|
type: 'object',
|
|
@@ -133,7 +133,7 @@ function getAssetsFromHtml(htmlFilePath, htmlContent, publicPath = 'public') {
|
|
|
133
133
|
}
|
|
134
134
|
require("child_process");
|
|
135
135
|
require("package-manager-detector");
|
|
136
|
-
require("
|
|
136
|
+
require("pintor");
|
|
137
137
|
external_path_namespaceObject.join(process.cwd(), 'node_modules/extension-develop/dist/certs');
|
|
138
138
|
const constants_CHROMIUM_BASED_BROWSERS = [
|
|
139
139
|
'chrome',
|
|
@@ -185,10 +185,14 @@ function ensureHMRForScripts(source) {
|
|
|
185
185
|
const options = this.getOptions();
|
|
186
186
|
const manifestPath = options.manifestPath;
|
|
187
187
|
const projectPath = external_path_namespaceObject.dirname(manifestPath);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
188
|
+
try {
|
|
189
|
+
(0, external_schema_utils_namespaceObject.validate)(schema, options, {
|
|
190
|
+
name: "html:ensure-hmr-for-scripts",
|
|
191
|
+
baseDataPath: 'options'
|
|
192
|
+
});
|
|
193
|
+
} catch (error) {
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
192
196
|
const url = (0, external_loader_utils_namespaceObject.urlToRequest)(this.resourcePath);
|
|
193
197
|
const reloadCode = `
|
|
194
198
|
// TODO: cezaraugusto re-visit this
|
|
@@ -198,14 +202,16 @@ if (import.meta.webpackHot) { import.meta.webpackHot.accept() };
|
|
|
198
202
|
const allEntries = options.includeList || {};
|
|
199
203
|
for (const field of Object.entries(allEntries)){
|
|
200
204
|
const [, resource] = field;
|
|
201
|
-
if (resource)
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
if (!resource) continue;
|
|
206
|
+
if (!external_fs_namespaceObject.existsSync(resource)) break;
|
|
207
|
+
const htmlAssets = getAssetsFromHtml(resource);
|
|
208
|
+
const fileAssets = (null == htmlAssets ? void 0 : htmlAssets.js) || [];
|
|
209
|
+
for (const asset of fileAssets){
|
|
210
|
+
const cleanAsset = asset.split('#')[0].split('?')[0];
|
|
211
|
+
const cleanUrl = url.split('#')[0].split('?')[0];
|
|
212
|
+
const normalizedAsset = external_path_namespaceObject.normalize(cleanAsset);
|
|
213
|
+
const normalizedUrl = external_path_namespaceObject.normalize(cleanUrl);
|
|
214
|
+
if (normalizedAsset === normalizedUrl) return `${reloadCode}${source}`;
|
|
209
215
|
}
|
|
210
216
|
}
|
|
211
217
|
return source;
|
|
@@ -32,7 +32,7 @@ const external_loader_utils_namespaceObject = require("loader-utils");
|
|
|
32
32
|
const external_schema_utils_namespaceObject = require("schema-utils");
|
|
33
33
|
require("child_process");
|
|
34
34
|
require("package-manager-detector");
|
|
35
|
-
require("
|
|
35
|
+
require("pintor");
|
|
36
36
|
external_path_namespaceObject.join(process.cwd(), 'node_modules/extension-develop/dist/certs');
|
|
37
37
|
const CHROMIUM_BASED_BROWSERS = [
|
|
38
38
|
'chrome',
|
|
@@ -41,8 +41,8 @@ const external_loader_utils_namespaceObject = require("loader-utils");
|
|
|
41
41
|
const external_schema_utils_namespaceObject = require("schema-utils");
|
|
42
42
|
require("child_process");
|
|
43
43
|
require("package-manager-detector");
|
|
44
|
-
const
|
|
45
|
-
var
|
|
44
|
+
const external_pintor_namespaceObject = require("pintor");
|
|
45
|
+
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_namespaceObject);
|
|
46
46
|
external_path_namespaceObject.join(process.cwd(), 'node_modules/extension-develop/dist/certs');
|
|
47
47
|
const CHROMIUM_BASED_BROWSERS = [
|
|
48
48
|
'chrome',
|
|
@@ -57,13 +57,13 @@ const GECKO_BASED_BROWSERS = [
|
|
|
57
57
|
];
|
|
58
58
|
require("console");
|
|
59
59
|
function getLoggingPrefix(feature, type) {
|
|
60
|
-
if ('error' === type) return `${
|
|
61
|
-
if ('warn' === type) return `${feature} ${
|
|
62
|
-
const arrow = 'info' === type ?
|
|
63
|
-
return `${arrow} ${
|
|
60
|
+
if ('error' === type) return `${external_pintor_default().bold(external_pintor_default().red('ERROR'))} in ${feature} ${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
61
|
+
if ('warn' === type) return `${feature} ${external_pintor_default().yellow("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
62
|
+
const arrow = 'info' === type ? external_pintor_default().cyan("\u25BA\u25BA\u25BA") : external_pintor_default().green("\u25BA\u25BA\u25BA");
|
|
63
|
+
return `${arrow} ${external_pintor_default().cyan(feature)}`;
|
|
64
64
|
}
|
|
65
65
|
function firefoxServiceWorkerError() {
|
|
66
|
-
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_pintor_default().yellow('background.service_worker')} field yet.\nUpdate your manifest.json file to use ${external_pintor_default().yellow("background.scripts")} instead.\nIf you really need to keep the ${external_pintor_default().yellow('service_worker')} field, prefix it with\n${external_pintor_default().yellow('chromium:')} so it can target only Chromium-based browsers.\n\nMozilla bug: ${external_pintor_default().underline('https://bugzilla.mozilla.org/show_bug.cgi?id=1573659')}.`;
|
|
67
67
|
}
|
|
68
68
|
function filterKeysForThisBrowser(manifest, browser) {
|
|
69
69
|
const patchedManifest = JSON.parse(JSON.stringify(manifest), function(key, value) {
|
package/dist/module.js
CHANGED
|
@@ -39,6 +39,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
39
39
|
extensionStart: ()=>extensionStart
|
|
40
40
|
});
|
|
41
41
|
const external_fs_namespaceObject = require("fs");
|
|
42
|
+
var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
|
|
42
43
|
const external_path_namespaceObject = require("path");
|
|
43
44
|
const core_namespaceObject = require("@rspack/core");
|
|
44
45
|
var core_default = /*#__PURE__*/ __webpack_require__.n(core_namespaceObject);
|
|
@@ -134,11 +135,21 @@ class EnvPlugin {
|
|
|
134
135
|
this.browser = options.browser || 'chrome';
|
|
135
136
|
}
|
|
136
137
|
}
|
|
138
|
+
function clean_dist_define_property(obj, key, value) {
|
|
139
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
140
|
+
value: value,
|
|
141
|
+
enumerable: true,
|
|
142
|
+
configurable: true,
|
|
143
|
+
writable: true
|
|
144
|
+
});
|
|
145
|
+
else obj[key] = value;
|
|
146
|
+
return obj;
|
|
147
|
+
}
|
|
137
148
|
class CleanDistFolderPlugin {
|
|
138
149
|
apply(compiler) {
|
|
139
|
-
const
|
|
140
|
-
if (external_fs_namespaceObject.existsSync(
|
|
141
|
-
external_fs_namespaceObject.rmSync(
|
|
150
|
+
const distPath = external_path_namespaceObject.join(compiler.options.context, 'dist', this.options.browser);
|
|
151
|
+
if (external_fs_namespaceObject.existsSync(distPath)) try {
|
|
152
|
+
external_fs_namespaceObject.rmSync(distPath, {
|
|
142
153
|
recursive: true,
|
|
143
154
|
force: true
|
|
144
155
|
});
|
|
@@ -147,9 +158,13 @@ class CleanDistFolderPlugin {
|
|
|
147
158
|
console.error(`[CleanDistFolderPlugin] Failed to remove hot-update files: ${error.message}`);
|
|
148
159
|
}
|
|
149
160
|
}
|
|
161
|
+
constructor(options){
|
|
162
|
+
clean_dist_define_property(this, "options", void 0);
|
|
163
|
+
this.options = options;
|
|
164
|
+
}
|
|
150
165
|
}
|
|
151
|
-
const
|
|
152
|
-
var
|
|
166
|
+
const external_pintor_namespaceObject = require("pintor");
|
|
167
|
+
var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_namespaceObject);
|
|
153
168
|
const CERTIFICATE_DESTINATION_PATH = external_path_namespaceObject.join(process.cwd(), 'node_modules/extension-develop/dist/certs');
|
|
154
169
|
const CHROMIUM_BASED_BROWSERS = [
|
|
155
170
|
'chrome',
|
|
@@ -164,13 +179,13 @@ const GECKO_BASED_BROWSERS = [
|
|
|
164
179
|
];
|
|
165
180
|
const external_console_namespaceObject = require("console");
|
|
166
181
|
var package_namespaceObject = {
|
|
167
|
-
i8: "2.0.0-rc.
|
|
182
|
+
i8: "2.0.0-rc.37"
|
|
168
183
|
};
|
|
169
184
|
function getLoggingPrefix(feature, type) {
|
|
170
|
-
if ('error' === type) return `${
|
|
171
|
-
if ('warn' === type) return `${feature} ${
|
|
172
|
-
const arrow = 'info' === type ?
|
|
173
|
-
return `${arrow} ${
|
|
185
|
+
if ('error' === type) return `${external_pintor_default().bold(external_pintor_default().red('ERROR'))} in ${feature} ${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
186
|
+
if ('warn' === type) return `${feature} ${external_pintor_default().yellow("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}`;
|
|
187
|
+
const arrow = 'info' === type ? external_pintor_default().cyan("\u25BA\u25BA\u25BA") : external_pintor_default().green("\u25BA\u25BA\u25BA");
|
|
188
|
+
return `${arrow} ${external_pintor_default().cyan(feature)}`;
|
|
174
189
|
}
|
|
175
190
|
function capitalize(browser) {
|
|
176
191
|
return browser.charAt(0).toUpperCase() + browser.slice(1);
|
|
@@ -178,15 +193,15 @@ function capitalize(browser) {
|
|
|
178
193
|
function boring(manifestName, duration, stats) {
|
|
179
194
|
let didShow = false;
|
|
180
195
|
if (!didShow) {
|
|
181
|
-
const arrow = stats.hasErrors() ?
|
|
182
|
-
return `${arrow} ${
|
|
196
|
+
const arrow = stats.hasErrors() ? external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E") : external_pintor_default().green("\u25BA\u25BA\u25BA");
|
|
197
|
+
return `${arrow} ${external_pintor_default().cyan(manifestName)} compiled ${stats.hasErrors() ? external_pintor_default().red('with errors') : external_pintor_default().green('successfully')} in ${duration} ms.`;
|
|
183
198
|
}
|
|
184
199
|
}
|
|
185
200
|
function integrationNotInstalled(integration, packageManager) {
|
|
186
|
-
return `${(0, external_console_namespaceObject.info)("\u25BA\u25BA\u25BA")} Using ${
|
|
201
|
+
return `${(0, external_console_namespaceObject.info)("\u25BA\u25BA\u25BA")} Using ${external_pintor_default().magenta(integration)}. Installing required dependencies via ${external_pintor_default().yellow(packageManager)}...`;
|
|
187
202
|
}
|
|
188
203
|
function isUsingIntegration(integration) {
|
|
189
|
-
return `${
|
|
204
|
+
return `${external_pintor_default().cyan("\u25BA\u25BA\u25BA")} Using ${external_pintor_default().magenta(integration)}...`;
|
|
190
205
|
}
|
|
191
206
|
function youAreAllSet(integration) {
|
|
192
207
|
return `${getLoggingPrefix(integration, 'success')} installation completed. Run the program again and happy hacking.`;
|
|
@@ -195,10 +210,10 @@ function installingRootDependencies(integration) {
|
|
|
195
210
|
return `${getLoggingPrefix(integration, 'info')} dependencies are being installed. This only happens for core contributors...`;
|
|
196
211
|
}
|
|
197
212
|
function integrationInstalledSuccessfully(integration) {
|
|
198
|
-
return `${getLoggingPrefix(integration, 'success')} dependencies installed ${
|
|
213
|
+
return `${getLoggingPrefix(integration, 'success')} dependencies installed ${external_pintor_default().green('successfully')}.`;
|
|
199
214
|
}
|
|
200
215
|
function failedToInstallIntegration(integration, error) {
|
|
201
|
-
return `${getLoggingPrefix('Integration', 'error')} ${integration} Installation Error\n\nFailed to detect package manager or install ${integration} dependencies:\n${
|
|
216
|
+
return `${getLoggingPrefix('Integration', 'error')} ${integration} Installation Error\n\nFailed to detect package manager or install ${integration} dependencies:\n${external_pintor_default().red((null == error ? void 0 : error.toString()) || '')}`;
|
|
202
217
|
}
|
|
203
218
|
function fileNotFound(errorSourcePath, missingFilePath) {
|
|
204
219
|
if (!errorSourcePath) throw new Error('This operation is impossible. Please report a bug.');
|
|
@@ -222,28 +237,28 @@ function manifestFieldError(manifestName, manifestField, filePath) {
|
|
|
222
237
|
const contentIndex = manifestField.split('-')[1];
|
|
223
238
|
const isPage = manifestField.startsWith('pages');
|
|
224
239
|
const field = manifestName.includes("content_scripts") ? `(index ${contentIndex})\n\n` : manifestFieldName;
|
|
225
|
-
return `${getLoggingPrefix('manifest.json', 'error')} File Not Found\n\n${isPage ? `Check the ${
|
|
240
|
+
return `${getLoggingPrefix('manifest.json', 'error')} File Not Found\n\n${isPage ? `Check the ${external_pintor_default().yellow('pages')} folder in your project root directory.\n` : `Check the ${external_pintor_default().yellow(field)} field in your manifest.json file.\n`}${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(filePath)}`;
|
|
226
241
|
}
|
|
227
242
|
function entryNotFoundWarn(manifestField, filePath) {
|
|
228
|
-
return `File Not Found\n\nCheck the ${
|
|
243
|
+
return `File Not Found\n\nCheck the ${external_pintor_default().yellow(manifestField)} field in your manifest.json file.\n${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(filePath)}`;
|
|
229
244
|
}
|
|
230
245
|
function manifestNotFoundError(manifestName, manifestPath) {
|
|
231
|
-
return `${getLoggingPrefix(manifestName, 'error')} Manifest Not Found\n\nEnsure you have a manifest.json file at the root directory of your project.\n${
|
|
246
|
+
return `${getLoggingPrefix(manifestName, 'error')} Manifest Not Found\n\nEnsure you have a manifest.json file at the root directory of your project.\n${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(manifestPath)}`;
|
|
232
247
|
}
|
|
233
248
|
function manifestInvalidError(error) {
|
|
234
|
-
return `${getLoggingPrefix('manifest.json', 'error')} Invalid Manifest\n\nUpdate your manifest.json file and try again. ` +
|
|
249
|
+
return `${getLoggingPrefix('manifest.json', 'error')} Invalid Manifest\n\nUpdate your manifest.json file and try again. ` + external_pintor_default().red(error.toString());
|
|
235
250
|
}
|
|
236
251
|
function serverRestartRequiredFromManifestError(fileAdded, fileRemoved) {
|
|
237
|
-
const fileRemovedText = fileRemoved && `${
|
|
238
|
-
const fileAddedText = fileAdded && `${
|
|
239
|
-
return `$manifest.json ${
|
|
252
|
+
const fileRemovedText = fileRemoved && `${external_pintor_default().gray('PATH')} ${external_pintor_default().red('REMOVED')} ${external_pintor_default().underline(fileRemoved)}\n`;
|
|
253
|
+
const fileAddedText = fileAdded && `${external_pintor_default().gray('PATH')} ${external_pintor_default().green('ADDED')} ${external_pintor_default().underline(fileAdded)}`;
|
|
254
|
+
return `$manifest.json ${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")} Manifest Entry Point Modification\n\nChanging the path of ${external_pintor_default().yellow('HTML')} or ${external_pintor_default().yellow("script")} files in manifest.json after compilation requires a server restart.\n` + fileRemovedText + fileAddedText;
|
|
240
255
|
}
|
|
241
256
|
function serverRestartRequiredFromSpecialFolderError(addingOrRemoving, folder, typeOfAsset, pathRelative) {
|
|
242
257
|
const addOrRemove = addingOrRemoving.charAt(0).toUpperCase() + addingOrRemoving.slice(1);
|
|
243
|
-
return `${getLoggingPrefix('manifest.json', 'error')} Manifest Entry Point Modification\n\n${addOrRemove} ${
|
|
258
|
+
return `${getLoggingPrefix('manifest.json', 'error')} Manifest Entry Point Modification\n\n${addOrRemove} ${external_pintor_default().yellow(typeOfAsset)} in the ${external_pintor_default().underline(folder + '/')} folder after compilation requires a server restart.\n${external_pintor_default().gray('PATH')} ${external_pintor_default().underline(pathRelative)}`;
|
|
244
259
|
}
|
|
245
260
|
function creatingTSConfig() {
|
|
246
|
-
return `${getLoggingPrefix('TypeScript', 'info')} is being used but no config file was found. Creating ${
|
|
261
|
+
return `${getLoggingPrefix('TypeScript', 'info')} is being used but no config file was found. Creating ${external_pintor_default().yellow('tsconfig.json')}...`;
|
|
247
262
|
}
|
|
248
263
|
function runningInDevelopment(manifest, browser, message) {
|
|
249
264
|
const manifestName = manifest.name || 'Extension.js';
|
|
@@ -261,51 +276,51 @@ function runningInDevelopment(manifest, browser, message) {
|
|
|
261
276
|
default:
|
|
262
277
|
browserDevToolsUrl = '';
|
|
263
278
|
}
|
|
264
|
-
if (!message.data) return `${getLoggingPrefix(manifestName, 'error')} No Client Data Received\n\nThis error happens when the program can\'t get the data from your extension.\nThere are many reasons this might happen. To fix, ensure that:\n\n- Your extension is set as enabled in ${
|
|
279
|
+
if (!message.data) return `${getLoggingPrefix(manifestName, 'error')} No Client Data Received\n\nThis error happens when the program can\'t get the data from your extension.\nThere are many reasons this might happen. To fix, ensure that:\n\n- Your extension is set as enabled in ${external_pintor_default().underline(browserDevToolsUrl)}\n- No previous ${capitalize(browser)} browser instance is open\n\nIf that is not the case, restart both the ${external_pintor_default().cyan(manifest.name || '')} and the\n${external_pintor_default().yellow('Manager Extension')} in ${external_pintor_default().underline(browserDevToolsUrl)} and try again.\n\nIf the issue still persists, please report a bug:\n\n` + external_pintor_default().underline("https://github.com/extension-js/extension.js/issues");
|
|
265
280
|
const { id, management } = message.data;
|
|
266
281
|
if (!management) {
|
|
267
282
|
if ('development' === process.env.EXTENSION_ENV) return `${getLoggingPrefix(manifestName, 'error')} No management API info received from client. Investigate.`;
|
|
268
283
|
}
|
|
269
284
|
const { name, version } = management;
|
|
270
285
|
return `
|
|
271
|
-
\u{1F9E9} ${
|
|
272
|
-
Extension Name ${
|
|
273
|
-
Extension Version ${
|
|
274
|
-
Extension ID ${
|
|
286
|
+
\u{1F9E9} ${external_pintor_default().green('Extension.js')} ${external_pintor_default().gray(`${package_namespaceObject.i8}`)}
|
|
287
|
+
Extension Name ${external_pintor_default().gray(name)}
|
|
288
|
+
Extension Version ${external_pintor_default().gray(version)}
|
|
289
|
+
Extension ID ${external_pintor_default().gray(id)}`;
|
|
275
290
|
}
|
|
276
291
|
function isFirstRun(browser) {
|
|
277
292
|
return `This is your first run using Extension.js via ${capitalize(browser)}. Welcome! \u{1F389}
|
|
278
293
|
|
|
279
|
-
\u{1F9E9} Learn more at ${
|
|
294
|
+
\u{1F9E9} Learn more at ${external_pintor_default().underline("https://extension.js.org")}`;
|
|
280
295
|
}
|
|
281
296
|
function webSocketError(error) {
|
|
282
|
-
return `${getLoggingPrefix('WebSocket', 'error')} General WebSocket Error:\n${
|
|
297
|
+
return `${getLoggingPrefix('WebSocket', 'error')} General WebSocket Error:\n${external_pintor_default().red(error)}`;
|
|
283
298
|
}
|
|
284
299
|
function backgroundIsRequired(backgroundChunkName, filePath) {
|
|
285
|
-
return `${getLoggingPrefix('manifest.json', 'error')} File Not Found\n\nCheck the ${
|
|
300
|
+
return `${getLoggingPrefix('manifest.json', 'error')} File Not Found\n\nCheck the ${external_pintor_default().yellow(backgroundChunkName.replace('/', '.'))} field in your manifest.json file.\n${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(filePath)}`;
|
|
286
301
|
}
|
|
287
302
|
function serverRestartRequiredFromHtml(filePath) {
|
|
288
|
-
const errorMessage = `${getLoggingPrefix('HTML', 'error')} Entry Point Modification\n\nChanging the path of ${
|
|
303
|
+
const errorMessage = `${getLoggingPrefix('HTML', 'error')} Entry Point Modification\n\nChanging the path of ${external_pintor_default().yellow("<script>")} or ${external_pintor_default().yellow('<link rel="stylesheet">')} files after compilation requires a server restart.\n${external_pintor_default().gray('PATH')} ${external_pintor_default().underline(filePath)}`;
|
|
289
304
|
return errorMessage;
|
|
290
305
|
}
|
|
291
306
|
function javaScriptError(errorSourcePath, missingFilePath) {
|
|
292
|
-
return `${getLoggingPrefix('HTML', 'error')} File Not Found\n\nCheck your ${
|
|
307
|
+
return `${getLoggingPrefix('HTML', 'error')} File Not Found\n\nCheck your ${external_pintor_default().yellow("<script>")} tags in ${external_pintor_default().underline(errorSourcePath)}.\n${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(missingFilePath)}`;
|
|
293
308
|
}
|
|
294
309
|
function cssError(errorSourcePath, missingFilePath) {
|
|
295
|
-
return `${getLoggingPrefix('HTML', 'error')} File Not Found\n\nCheck your ${
|
|
310
|
+
return `${getLoggingPrefix('HTML', 'error')} File Not Found\n\nCheck your ${external_pintor_default().yellow('<link>')} tags in ${external_pintor_default().underline(errorSourcePath)}.\n${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(missingFilePath)}`;
|
|
296
311
|
}
|
|
297
312
|
function staticAssetError(errorSourcePath, missingFilePath) {
|
|
298
313
|
const extname = external_path_namespaceObject.extname(missingFilePath);
|
|
299
|
-
return `${getLoggingPrefix('HTML', 'warn')} File Not Found\n\nCheck your ${
|
|
314
|
+
return `${getLoggingPrefix('HTML', 'warn')} File Not Found\n\nCheck your ${external_pintor_default().yellow('*' + extname)} assets in ${external_pintor_default().underline(errorSourcePath)}.\n${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(missingFilePath)}`;
|
|
300
315
|
}
|
|
301
316
|
function certRequired() {
|
|
302
|
-
return `${
|
|
317
|
+
return `${external_pintor_default().yellow('Note')}: Firefox requires a secure certificate for localhost connections, needed for the reloader to work.\nBy default, your manifest.json file is not being watched. To enable this feature, run:\n\n npx -y mkcert-cli \\\n ${external_pintor_default().green('--outDir')} ${external_pintor_default().underline(CERTIFICATE_DESTINATION_PATH)} \\\n ${external_pintor_default().green('--cert')} ${external_pintor_default().yellow('localhost.cert')} \\\n ${external_pintor_default().green('--key')} ${external_pintor_default().yellow('localhost.key')}\n\nThis will enable the secure certificate needed for Firefox via ${external_pintor_default().bold('mkcert')}.\n\nLearn more about ${external_pintor_default().bold('mkcert')}: ${external_pintor_default().underline("https://github.com/FiloSottile/mkcert")}`;
|
|
303
318
|
}
|
|
304
319
|
function defaultPortInUse(port) {
|
|
305
|
-
return `${getLoggingPrefix('Port', 'error')} Selected port ${
|
|
320
|
+
return `${getLoggingPrefix('Port', 'error')} Selected port ${external_pintor_default().yellow(port.toString())} in use. Choose a new port. `;
|
|
306
321
|
}
|
|
307
322
|
function noExtensionIdError() {
|
|
308
|
-
return `${getLoggingPrefix('manifest.json', 'error')} Extension ID Not Defined\n\nFor MAIN world content_scripts, the extension ID must be specified.\nEnsure your extension have a fixed ID and that the ${
|
|
323
|
+
return `${getLoggingPrefix('manifest.json', 'error')} Extension ID Not Defined\n\nFor MAIN world content_scripts, the extension ID must be specified.\nEnsure your extension have a fixed ID and that the ${external_pintor_default().yellow('publicPath')}\nof your ${external_pintor_default().yellow('extension.config.js')} is defined as your extension URL.`;
|
|
309
324
|
}
|
|
310
325
|
function isUsingCustomLoader(file) {
|
|
311
326
|
const loaderName = file.split('.').shift() || 'custom';
|
|
@@ -329,7 +344,9 @@ class CompilationPlugin {
|
|
|
329
344
|
manifestPath: this.manifestPath,
|
|
330
345
|
browser: this.browser
|
|
331
346
|
}).apply(compiler);
|
|
332
|
-
new CleanDistFolderPlugin(
|
|
347
|
+
if (this.clean) new CleanDistFolderPlugin({
|
|
348
|
+
browser: this.browser || 'chrome'
|
|
349
|
+
}).apply(compiler);
|
|
333
350
|
compiler.hooks.done.tapAsync('develop:brand', (stats, done)=>{
|
|
334
351
|
stats.compilation.name = void 0;
|
|
335
352
|
const duration = stats.compilation.endTime - stats.compilation.startTime;
|
|
@@ -341,8 +358,10 @@ class CompilationPlugin {
|
|
|
341
358
|
constructor(options){
|
|
342
359
|
plugin_compilation_define_property(this, "manifestPath", void 0);
|
|
343
360
|
plugin_compilation_define_property(this, "browser", void 0);
|
|
361
|
+
plugin_compilation_define_property(this, "clean", void 0);
|
|
344
362
|
this.manifestPath = options.manifestPath;
|
|
345
363
|
this.browser = options.browser || 'chrome';
|
|
364
|
+
this.clean = options.clean || true;
|
|
346
365
|
}
|
|
347
366
|
}
|
|
348
367
|
plugin_compilation_define_property(CompilationPlugin, "name", 'plugin-compilation');
|
|
@@ -2417,10 +2436,11 @@ class EmitHtmlFile {
|
|
|
2417
2436
|
for (const field of htmlFields){
|
|
2418
2437
|
const [featureName, resource] = field;
|
|
2419
2438
|
if (resource) {
|
|
2439
|
+
if ('string' != typeof resource) continue;
|
|
2420
2440
|
if (!external_fs_namespaceObject.existsSync(resource)) {
|
|
2421
2441
|
const errorMessage = manifestFieldError(manifestName, featureName, resource);
|
|
2422
2442
|
compilation.warnings.push(new (core_default()).WebpackError(errorMessage));
|
|
2423
|
-
|
|
2443
|
+
continue;
|
|
2424
2444
|
}
|
|
2425
2445
|
const rawHtml = external_fs_namespaceObject.readFileSync(resource, 'utf8');
|
|
2426
2446
|
if (!shouldExclude(resource, this.excludeList)) {
|
|
@@ -2674,12 +2694,14 @@ class UpdateHtmlFile {
|
|
|
2674
2694
|
for (const field of Object.entries(htmlEntries)){
|
|
2675
2695
|
const [feature, resource] = field;
|
|
2676
2696
|
if (resource) {
|
|
2677
|
-
const updatedHtml = patchHtml(compilation, feature, resource, htmlEntries, this.excludeList || {});
|
|
2678
2697
|
if (!shouldExclude(resource, this.excludeList)) {
|
|
2679
|
-
if (
|
|
2680
|
-
const
|
|
2681
|
-
|
|
2682
|
-
|
|
2698
|
+
if (external_fs_default().existsSync(resource)) {
|
|
2699
|
+
const updatedHtml = patchHtml(compilation, feature, resource, htmlEntries, this.excludeList || {});
|
|
2700
|
+
if (updatedHtml) {
|
|
2701
|
+
const rawSource = new core_namespaceObject.sources.RawSource(updatedHtml.toString());
|
|
2702
|
+
const filepath = getFilePath(feature, '.html', false);
|
|
2703
|
+
compilation.updateAsset(filepath, rawSource);
|
|
2704
|
+
}
|
|
2683
2705
|
}
|
|
2684
2706
|
}
|
|
2685
2707
|
}
|
|
@@ -2762,21 +2784,20 @@ class throw_if_recompile_is_needed_ThrowIfRecompileIsNeeded {
|
|
|
2762
2784
|
}
|
|
2763
2785
|
storeInitialHtmlAssets(htmlFields) {
|
|
2764
2786
|
Object.entries(htmlFields).forEach(([key, resource])=>{
|
|
2787
|
+
var _getAssetsFromHtml, _getAssetsFromHtml1;
|
|
2788
|
+
if ('string' != typeof resource) return;
|
|
2765
2789
|
const htmlFile = resource;
|
|
2766
|
-
if (htmlFile) {
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
console.error(manifestFieldError(manifestName, key, htmlFile));
|
|
2773
|
-
process.exit(1);
|
|
2774
|
-
}
|
|
2775
|
-
this.initialHtmlAssets[htmlFile] = {
|
|
2776
|
-
js: (null == (_getAssetsFromHtml = getAssetsFromHtml(htmlFile)) ? void 0 : _getAssetsFromHtml.js) || [],
|
|
2777
|
-
css: (null == (_getAssetsFromHtml1 = getAssetsFromHtml(htmlFile)) ? void 0 : _getAssetsFromHtml1.css) || []
|
|
2778
|
-
};
|
|
2790
|
+
if (!external_fs_namespaceObject.existsSync(htmlFile)) {
|
|
2791
|
+
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(this.manifestPath, 'utf-8'));
|
|
2792
|
+
const patchedManifest = filterKeysForThisBrowser(manifest, 'chrome');
|
|
2793
|
+
const manifestName = patchedManifest.name || 'Extension.js';
|
|
2794
|
+
console.error(manifestFieldError(manifestName, key, htmlFile));
|
|
2795
|
+
process.exit(1);
|
|
2779
2796
|
}
|
|
2797
|
+
this.initialHtmlAssets[htmlFile] = {
|
|
2798
|
+
js: (null == (_getAssetsFromHtml = getAssetsFromHtml(htmlFile)) ? void 0 : _getAssetsFromHtml.js) || [],
|
|
2799
|
+
css: (null == (_getAssetsFromHtml1 = getAssetsFromHtml(htmlFile)) ? void 0 : _getAssetsFromHtml1.css) || []
|
|
2800
|
+
};
|
|
2780
2801
|
});
|
|
2781
2802
|
}
|
|
2782
2803
|
apply(compiler) {
|
|
@@ -4596,8 +4617,8 @@ const edgeMasterPreferences = {
|
|
|
4596
4617
|
...masterPreferences
|
|
4597
4618
|
};
|
|
4598
4619
|
function messages_getLoggingPrefix(browser, type) {
|
|
4599
|
-
const arrow = 'warn' === type ?
|
|
4600
|
-
return `${
|
|
4620
|
+
const arrow = 'warn' === type ? external_pintor_default().yellow("\u25BA\u25BA\u25BA") : 'info' === type ? external_pintor_default().cyan("\u25BA\u25BA\u25BA") : 'error' === type ? `${external_pintor_default().bold(external_pintor_default().red('ERROR'))} in ${capitalizedBrowserName(browser)} ${external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E")}` : external_pintor_default().green("\u25BA\u25BA\u25BA");
|
|
4621
|
+
return `${external_pintor_default().gray('')}${arrow}`;
|
|
4601
4622
|
}
|
|
4602
4623
|
function capitalizedBrowserName(browser) {
|
|
4603
4624
|
return browser.charAt(0).toUpperCase() + browser.slice(1);
|
|
@@ -4614,71 +4635,71 @@ function browserInstanceExited(browser) {
|
|
|
4614
4635
|
}
|
|
4615
4636
|
function stdoutData(browser, mode) {
|
|
4616
4637
|
const extensionOutput = 'firefox' === browser || 'gecko-based' === browser ? 'Add-on' : 'Extension';
|
|
4617
|
-
return `${messages_getLoggingPrefix(browser, 'success')} ${capitalizedBrowserName(browser)} ${extensionOutput} running in ${
|
|
4638
|
+
return `${messages_getLoggingPrefix(browser, 'success')} ${capitalizedBrowserName(browser)} ${extensionOutput} running in ${external_pintor_default().blue(mode || 'unknown')} mode.`;
|
|
4618
4639
|
}
|
|
4619
4640
|
function browserNotInstalledError(browser, browserBinaryLocation) {
|
|
4620
4641
|
const isUnreacheable = 'null' == browserBinaryLocation ? `Browser is not installed\n\n` : `Can\'t find the browser path\n\n`;
|
|
4621
|
-
return `${messages_getLoggingPrefix(browser, 'error')} ${isUnreacheable}Either install the missing browser or choose a different one via ${
|
|
4642
|
+
return `${messages_getLoggingPrefix(browser, 'error')} ${isUnreacheable}Either install the missing browser or choose a different one via ${external_pintor_default().yellow('--browser')} flag.\n${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(browserBinaryLocation || capitalizedBrowserName(browser) + 'BROWSER')}`;
|
|
4622
4643
|
}
|
|
4623
4644
|
function messages_firefoxServiceWorkerError(browser) {
|
|
4624
|
-
return `${messages_getLoggingPrefix(browser, 'error')} No Service Worker Support\n\nFirefox does not support the ${
|
|
4645
|
+
return `${messages_getLoggingPrefix(browser, 'error')} No Service Worker Support\n\nFirefox does not support the ${external_pintor_default().yellow('background.service_worker')} field yet.\nUpdate your manifest.json file to use ${external_pintor_default().yellow("background.scripts")} instead.\n\nRead more: ${external_pintor_default().underline('https://bugzilla.mozilla.org/show_bug.cgi?id=1573659')}.`;
|
|
4625
4646
|
}
|
|
4626
4647
|
function browserLaunchError(browser, error) {
|
|
4627
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Error launching browser:\n${
|
|
4648
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Error launching browser:\n${external_pintor_default().red(error)}`;
|
|
4628
4649
|
}
|
|
4629
4650
|
function generalBrowserError(browser, error) {
|
|
4630
|
-
return `${messages_getLoggingPrefix(browser, 'error')} ${
|
|
4651
|
+
return `${messages_getLoggingPrefix(browser, 'error')} ${external_pintor_default().red(error.stack)}`;
|
|
4631
4652
|
}
|
|
4632
4653
|
function errorConnectingToBrowser(browser) {
|
|
4633
4654
|
return `${messages_getLoggingPrefix(browser, 'error')} Unable to connect to ${capitalizedBrowserName(browser)}. Too many retries.`;
|
|
4634
4655
|
}
|
|
4635
4656
|
function addonInstallError(browser, message) {
|
|
4636
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Error while installing temporary addon:\n${
|
|
4657
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Error while installing temporary addon:\n${external_pintor_default().red(message)}`;
|
|
4637
4658
|
}
|
|
4638
4659
|
function pathIsNotDirectoryError(browser, profilePath) {
|
|
4639
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Path is not directory\n\nPlease provide a valid directory path and try again.\n${
|
|
4660
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Path is not directory\n\nPlease provide a valid directory path and try again.\n${external_pintor_default().red('NOT DIRECTORY')} ${external_pintor_default().underline(profilePath)}`;
|
|
4640
4661
|
}
|
|
4641
4662
|
function parseMessageLengthError(browser) {
|
|
4642
4663
|
return `${messages_getLoggingPrefix(browser, 'error')} Error parsing message length.`;
|
|
4643
4664
|
}
|
|
4644
4665
|
function messagingClientClosedError(browser) {
|
|
4645
|
-
return `${messages_getLoggingPrefix(browser, 'error')} ${
|
|
4666
|
+
return `${messages_getLoggingPrefix(browser, 'error')} ${external_pintor_default().magenta('MessagingClient')} connection closed.`;
|
|
4646
4667
|
}
|
|
4647
4668
|
function requestWithoutTargetActorError(browser, requestType) {
|
|
4648
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Unexpected ${
|
|
4669
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Unexpected ${external_pintor_default().magenta('MessagingClient')} request without target actor: ${external_pintor_default().yellow(requestType)}`;
|
|
4649
4670
|
}
|
|
4650
4671
|
function connectionClosedError(browser) {
|
|
4651
|
-
return `${messages_getLoggingPrefix(browser, 'error')} ${
|
|
4672
|
+
return `${messages_getLoggingPrefix(browser, 'error')} ${external_pintor_default().magenta('MessagingClient')} connection closed.`;
|
|
4652
4673
|
}
|
|
4653
4674
|
function targetActorHasActiveRequestError(browser, targetActor) {
|
|
4654
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Target actor ${
|
|
4675
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Target actor ${external_pintor_default().yellow(targetActor)} already has an active request.`;
|
|
4655
4676
|
}
|
|
4656
4677
|
function parsingPacketError(browser, error) {
|
|
4657
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Error parsing packet: ${
|
|
4678
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Error parsing packet: ${external_pintor_default().red(error)}`;
|
|
4658
4679
|
}
|
|
4659
4680
|
function messageWithoutSenderError(browser, message) {
|
|
4660
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Message received without a sender actor:\n${
|
|
4681
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Message received without a sender actor:\n${external_pintor_default().yellow(JSON.stringify(message))}`;
|
|
4661
4682
|
}
|
|
4662
4683
|
function unexpectedMessageReceivedError(browser, message) {
|
|
4663
|
-
return `${messages_getLoggingPrefix(browser, 'error')} Received unexpected message:\n${
|
|
4684
|
+
return `${messages_getLoggingPrefix(browser, 'error')} Received unexpected message:\n${external_pintor_default().red(message)}`;
|
|
4664
4685
|
}
|
|
4665
4686
|
function isUsingStartingUrl(browser, value) {
|
|
4666
|
-
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${
|
|
4687
|
+
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${external_pintor_default().magenta('starting URL')} ${external_pintor_default().underline(value)}. `;
|
|
4667
4688
|
}
|
|
4668
4689
|
function isUsingBrowserBinary(binary, binaryPath) {
|
|
4669
|
-
return `${messages_getLoggingPrefix(binary, 'info')} Using own ${
|
|
4690
|
+
return `${messages_getLoggingPrefix(binary, 'info')} Using own ${external_pintor_default().magenta(`${capitalizedBrowserName(binary)} browser binary`)} ${external_pintor_default().underline(binaryPath)}. `;
|
|
4670
4691
|
}
|
|
4671
4692
|
function isUsingProfile(browser, profilePath) {
|
|
4672
|
-
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${
|
|
4693
|
+
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${external_pintor_default().magenta('browser profile')} ${external_pintor_default().underline(profilePath)}. `;
|
|
4673
4694
|
}
|
|
4674
4695
|
function isUsingPreferences(browser) {
|
|
4675
|
-
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${
|
|
4696
|
+
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${external_pintor_default().magenta('browser preferences')}. `;
|
|
4676
4697
|
}
|
|
4677
4698
|
function isUsingBrowserFlags(browser) {
|
|
4678
|
-
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${
|
|
4699
|
+
return `${messages_getLoggingPrefix(browser, 'info')} Using own ${external_pintor_default().magenta('browser flags')}. `;
|
|
4679
4700
|
}
|
|
4680
4701
|
function isBrowserLauncherOpen(browser, isOpen) {
|
|
4681
|
-
return `${messages_getLoggingPrefix(browser, 'info')} Browser launcher is ${
|
|
4702
|
+
return `${messages_getLoggingPrefix(browser, 'info')} Browser launcher is ${external_pintor_default().yellow(isOpen ? 'enabled' : 'disabled')}. `;
|
|
4682
4703
|
}
|
|
4683
4704
|
const external_progress_namespaceObject = require("progress");
|
|
4684
4705
|
var external_progress_default = /*#__PURE__*/ __webpack_require__.n(external_progress_namespaceObject);
|
|
@@ -4908,11 +4929,11 @@ function getPreferences(customPrefs) {
|
|
|
4908
4929
|
};
|
|
4909
4930
|
}
|
|
4910
4931
|
function commands_lib_messages_getLoggingPrefix(type) {
|
|
4911
|
-
const arrow = 'warn' === type ?
|
|
4932
|
+
const arrow = 'warn' === type ? external_pintor_default().yellow("\u25BA\u25BA\u25BA") : 'info' === type ? external_pintor_default().cyan("\u25BA\u25BA\u25BA") : 'error' === type ? external_pintor_default().bold.red('ERROR') + ' in ' + external_pintor_default().red('Extension.js') + external_pintor_default().red("\u2716\uFE0E\u2716\uFE0E\u2716\uFE0E") : external_pintor_default().green("\u25BA\u25BA\u25BA");
|
|
4912
4933
|
return `${arrow}`;
|
|
4913
4934
|
}
|
|
4914
4935
|
function messages_manifestNotFoundError(manifestPath) {
|
|
4915
|
-
return `${commands_lib_messages_getLoggingPrefix('error')} Manifest file not found.\n\nEnsure the path to your extension exists and try again.\n${
|
|
4936
|
+
return `${commands_lib_messages_getLoggingPrefix('error')} Manifest file not found.\n\nEnsure the path to your extension exists and try again.\n${external_pintor_default().red('NOT FOUND')} ${external_pintor_default().underline(manifestPath)}`;
|
|
4916
4937
|
}
|
|
4917
4938
|
function runningInProduction(outputPath) {
|
|
4918
4939
|
const manifestPath = external_path_namespaceObject.join(outputPath, 'manifest.json');
|
|
@@ -4921,11 +4942,11 @@ function runningInProduction(outputPath) {
|
|
|
4921
4942
|
const hasHost = hostPermissions && hostPermissions.length;
|
|
4922
4943
|
const hasPermissions = permissions && permissions.length;
|
|
4923
4944
|
return `
|
|
4924
|
-
\u{1F9E9} ${
|
|
4925
|
-
Extension Name ${
|
|
4926
|
-
Extension Version ${
|
|
4927
|
-
Host Permissions ${
|
|
4928
|
-
Permissions ${
|
|
4945
|
+
\u{1F9E9} ${external_pintor_default().green('Extension.js')} ${external_pintor_default().gray(`${package_namespaceObject.i8}`)}
|
|
4946
|
+
Extension Name ${external_pintor_default().gray(name)}
|
|
4947
|
+
Extension Version ${external_pintor_default().gray(version)}
|
|
4948
|
+
Host Permissions ${external_pintor_default().gray(hasHost ? hostPermissions.join(', ') : 'Browser defaults')}
|
|
4949
|
+
Permissions ${external_pintor_default().gray(hasPermissions ? permissions.join(', ') : 'Browser defaults')}
|
|
4929
4950
|
`;
|
|
4930
4951
|
}
|
|
4931
4952
|
function buildWebpack(projectDir, stats, browser) {
|
|
@@ -4933,12 +4954,12 @@ function buildWebpack(projectDir, stats, browser) {
|
|
|
4933
4954
|
const manifestPath = external_path_namespaceObject.join(projectDir, 'manifest.json');
|
|
4934
4955
|
const manifest = JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf8'));
|
|
4935
4956
|
const assets = null == statsJson ? void 0 : statsJson.assets;
|
|
4936
|
-
const heading = `${commands_lib_messages_getLoggingPrefix('info')} Building ${
|
|
4957
|
+
const heading = `${commands_lib_messages_getLoggingPrefix('info')} Building ${external_pintor_default().cyan(manifest.name)} extension using ${messages_capitalizedBrowserName(browser)} defaults...\n\n`;
|
|
4937
4958
|
const buildTime = `\nBuild completed in ${(((null == statsJson ? void 0 : statsJson.time) || 0) / 1000).toFixed(2)} seconds.`;
|
|
4938
|
-
const buildTarget = `Build Target: ${
|
|
4939
|
-
const buildStatus = `Build Status: ${(null == stats ? void 0 : stats.hasErrors()) ?
|
|
4940
|
-
const version = `\nVersion: ${
|
|
4941
|
-
const size = `Size: ${
|
|
4959
|
+
const buildTarget = `Build Target: ${external_pintor_default().gray(messages_capitalizedBrowserName(browser))}\n`;
|
|
4960
|
+
const buildStatus = `Build Status: ${(null == stats ? void 0 : stats.hasErrors()) ? external_pintor_default().red('Failed') : external_pintor_default().green('Success')}\n`;
|
|
4961
|
+
const version = `\nVersion: ${external_pintor_default().gray(manifest.version)}\n`;
|
|
4962
|
+
const size = `Size: ${external_pintor_default().gray(getAssetsSize(assets))}\n`;
|
|
4942
4963
|
let output = '';
|
|
4943
4964
|
output += heading;
|
|
4944
4965
|
output += getAssetsTree(assets);
|
|
@@ -4950,55 +4971,55 @@ function buildWebpack(projectDir, stats, browser) {
|
|
|
4950
4971
|
return output;
|
|
4951
4972
|
}
|
|
4952
4973
|
function buildSuccess() {
|
|
4953
|
-
return `${commands_lib_messages_getLoggingPrefix('success')} No errors or warnings found. Your extension is ${
|
|
4974
|
+
return `${commands_lib_messages_getLoggingPrefix('success')} No errors or warnings found. Your extension is ${external_pintor_default().green('ready for deployment')}.`;
|
|
4954
4975
|
}
|
|
4955
4976
|
function fetchingProjectPath(owner, project) {
|
|
4956
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Fetching data...\n${
|
|
4977
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Fetching data...\n${external_pintor_default().gray('URL')} ${external_pintor_default().underline(`https://github.com/${owner}/${project}`)}`;
|
|
4957
4978
|
}
|
|
4958
4979
|
function downloadingProjectPath(projectName) {
|
|
4959
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Downloading ${
|
|
4980
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Downloading ${external_pintor_default().cyan(projectName)}...`;
|
|
4960
4981
|
}
|
|
4961
4982
|
function creatingProjectPath(projectPath) {
|
|
4962
|
-
return `\n${commands_lib_messages_getLoggingPrefix('info')} Creating a new browser extension...\n${
|
|
4983
|
+
return `\n${commands_lib_messages_getLoggingPrefix('info')} Creating a new browser extension...\n${external_pintor_default().gray('PATH')} ${external_pintor_default().underline(`${projectPath}`)}`;
|
|
4963
4984
|
}
|
|
4964
4985
|
function noGitIgnoreFound(projectDir) {
|
|
4965
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} No ${
|
|
4986
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} No ${external_pintor_default().yellow('.gitignore')} found, zipping all the content inside path:\n${external_pintor_default().gray('PATH')} ${external_pintor_default().underline(projectDir)}`;
|
|
4966
4987
|
}
|
|
4967
4988
|
function packagingSourceFiles(zipPath) {
|
|
4968
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Packaging source files. Files in ${
|
|
4989
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Packaging source files. Files in ${external_pintor_default().yellow('.gitignore')} will be excluded...\n${external_pintor_default().gray('PATH')} ${external_pintor_default().underline(zipPath)}.`;
|
|
4969
4990
|
}
|
|
4970
4991
|
function packagingDistributionFiles(zipPath) {
|
|
4971
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Packaging extension distribution files...\n${
|
|
4992
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Packaging extension distribution files...\n${external_pintor_default().gray('PATH')} ${external_pintor_default().underline(zipPath)}`;
|
|
4972
4993
|
}
|
|
4973
4994
|
function treeWithSourceAndDistFiles(browser, name, sourceZip, destZip) {
|
|
4974
|
-
return `\uD83D\uDCE6 Package name: ${
|
|
4995
|
+
return `\uD83D\uDCE6 Package name: ${external_pintor_default().yellow(`${name}`)}, Target Browser: ${messages_capitalizedBrowserName(browser)}\n ${external_pintor_default().gray("\u2514\u2500")} ${external_pintor_default().underline(`${sourceZip}`)} (source)\n ${external_pintor_default().gray("\u2514\u2500")} ${external_pintor_default().underline(`${destZip}`)} (distribution)`;
|
|
4975
4996
|
}
|
|
4976
4997
|
function treeWithDistFilesbrowser(name, ext, browser, zipPath) {
|
|
4977
|
-
return `\uD83D\uDCE6 Package name: ${
|
|
4998
|
+
return `\uD83D\uDCE6 Package name: ${external_pintor_default().yellow(`${name}.${ext}`)}, Target Browser: ${messages_capitalizedBrowserName(browser)}\n ${external_pintor_default().gray("\u2514\u2500")} ${external_pintor_default().underline(`${zipPath}`)} ${external_pintor_default().gray('(distribution)')}`;
|
|
4978
4999
|
}
|
|
4979
5000
|
function treeWithSourceFiles(name, ext, browser, zipPath) {
|
|
4980
|
-
return `\uD83D\uDCE6 Package name: ${
|
|
5001
|
+
return `\uD83D\uDCE6 Package name: ${external_pintor_default().yellow(`${name}-source.${ext}`)}, Target Browser: ${messages_capitalizedBrowserName(browser)}\n ${external_pintor_default().gray("\u2514\u2500")} ${external_pintor_default().underline(`${zipPath}`)} (source)`;
|
|
4981
5002
|
}
|
|
4982
5003
|
function failedToCompressError(error) {
|
|
4983
|
-
return `${commands_lib_messages_getLoggingPrefix('error')} Failed to compress extension package.\n${
|
|
5004
|
+
return `${commands_lib_messages_getLoggingPrefix('error')} Failed to compress extension package.\n${external_pintor_default().red(error)}`;
|
|
4984
5005
|
}
|
|
4985
5006
|
function writingTypeDefinitions(manifest) {
|
|
4986
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Writing type definitions for ${
|
|
5007
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Writing type definitions for ${external_pintor_default().cyan(manifest.name || '')}...`;
|
|
4987
5008
|
}
|
|
4988
5009
|
function writingTypeDefinitionsError(error) {
|
|
4989
|
-
return `${commands_lib_messages_getLoggingPrefix('error')} Failed to write the extension type definition.\n${
|
|
5010
|
+
return `${commands_lib_messages_getLoggingPrefix('error')} Failed to write the extension type definition.\n${external_pintor_default().red(error)}`;
|
|
4990
5011
|
}
|
|
4991
5012
|
function downloadingText(url) {
|
|
4992
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Downloading extension...\n${
|
|
5013
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Downloading browser extension...\n${external_pintor_default().gray('URL')} ${external_pintor_default().underline(url)}`;
|
|
4993
5014
|
}
|
|
4994
5015
|
function unpackagingExtension(zipFilePath) {
|
|
4995
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Unpackaging browser extension...\n${
|
|
5016
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Unpackaging browser extension...\n${external_pintor_default().gray('PATH')} ${external_pintor_default().underline(zipFilePath)}`;
|
|
4996
5017
|
}
|
|
4997
5018
|
function unpackagedSuccessfully() {
|
|
4998
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Browser extension unpackaged ${
|
|
5019
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Browser extension unpackaged ${external_pintor_default().green('successfully')}.`;
|
|
4999
5020
|
}
|
|
5000
5021
|
function failedToDownloadOrExtractZIPFileError(error) {
|
|
5001
|
-
return `${commands_lib_messages_getLoggingPrefix('error')} Failed to download or extract ZIP file. ${
|
|
5022
|
+
return `${commands_lib_messages_getLoggingPrefix('error')} Failed to download or extract ZIP file. ${external_pintor_default().red(error)}`;
|
|
5002
5023
|
}
|
|
5003
5024
|
function messages_capitalizedBrowserName(browser) {
|
|
5004
5025
|
return browser.charAt(0).toUpperCase() + browser.slice(1);
|
|
@@ -5019,8 +5040,8 @@ function printTree(node, prefix = '') {
|
|
|
5019
5040
|
const isLast = index === array.length - 1;
|
|
5020
5041
|
const connector = isLast ? "\u2514\u2500" : "\u251C\u2500";
|
|
5021
5042
|
const sizeInKB = node[key].size ? ` (${getFileSize(node[key].size)})` : '';
|
|
5022
|
-
output += `${
|
|
5023
|
-
if ('object' == typeof node[key] && !node[key].size) output += printTree(node[key], `${prefix}${isLast ? ' ' :
|
|
5043
|
+
output += `${external_pintor_default().gray(prefix)}${external_pintor_default().gray(connector)} ${key}${external_pintor_default().gray(sizeInKB)}\n`;
|
|
5044
|
+
if ('object' == typeof node[key] && !node[key].size) output += printTree(node[key], `${prefix}${isLast ? ' ' : external_pintor_default().gray("\u2502 ")}`);
|
|
5024
5045
|
});
|
|
5025
5046
|
return output;
|
|
5026
5047
|
}
|
|
@@ -5040,7 +5061,7 @@ function getAssetsTree(assets) {
|
|
|
5040
5061
|
return `.\n${printTree(assetTree)}`;
|
|
5041
5062
|
}
|
|
5042
5063
|
function isUsingExperimentalConfig(integration) {
|
|
5043
|
-
return `${commands_lib_messages_getLoggingPrefix('info')} Using ${
|
|
5064
|
+
return `${commands_lib_messages_getLoggingPrefix('info')} Using ${external_pintor_default().magenta(integration)}. ${external_pintor_default().yellow('This is very experimental')}.`;
|
|
5044
5065
|
}
|
|
5045
5066
|
function installingDependencies() {
|
|
5046
5067
|
return `${commands_lib_messages_getLoggingPrefix('info')} Installing project dependencies...`;
|
|
@@ -5049,10 +5070,10 @@ function installingDependenciesFailed(gitCommand, gitArgs, code) {
|
|
|
5049
5070
|
return `${commands_lib_messages_getLoggingPrefix('error')} Command ${gitCommand} ${gitArgs.join(' ')} failed with exit code ${code}`;
|
|
5050
5071
|
}
|
|
5051
5072
|
function cantInstallDependencies(error) {
|
|
5052
|
-
return `${commands_lib_messages_getLoggingPrefix('error')} Can't install project dependencies. ${
|
|
5073
|
+
return `${commands_lib_messages_getLoggingPrefix('error')} Can't install project dependencies. ${external_pintor_default().red(error.message || error.toString())}`;
|
|
5053
5074
|
}
|
|
5054
5075
|
function portInUse(requestedPort, newPort) {
|
|
5055
|
-
return `${commands_lib_messages_getLoggingPrefix('warn')} Port ${
|
|
5076
|
+
return `${commands_lib_messages_getLoggingPrefix('warn')} Port ${external_pintor_default().yellow(requestedPort.toString())} is in use. Using port ${external_pintor_default().green(newPort.toString())} instead.`;
|
|
5056
5077
|
}
|
|
5057
5078
|
async function loadConfigFile(configPath) {
|
|
5058
5079
|
const absolutePath = external_path_namespaceObject.resolve(configPath);
|
|
@@ -5666,10 +5687,11 @@ class BrowsersPlugin {
|
|
|
5666
5687
|
}
|
|
5667
5688
|
plugin_browsers_define_property(BrowsersPlugin, "name", 'plugin-browsers');
|
|
5668
5689
|
function webpackConfig(projectPath, devOptions) {
|
|
5669
|
-
var _devOptions_output;
|
|
5690
|
+
var _devOptions_output, _devOptions_output1;
|
|
5670
5691
|
const manifestPath = external_path_namespaceObject.join(projectPath, 'manifest.json');
|
|
5671
5692
|
const manifest = filterKeysForThisBrowser(JSON.parse(external_fs_namespaceObject.readFileSync(manifestPath, 'utf-8')), devOptions.browser);
|
|
5672
|
-
const userExtensionOutputPath =
|
|
5693
|
+
const userExtensionOutputPath = devOptions.output.path;
|
|
5694
|
+
const managerExtensionPath = external_path_namespaceObject.join(__dirname, 'extensions', `${devOptions.browser}-manager-extension`);
|
|
5673
5695
|
const browser = devOptions.chromiumBinary ? 'chromium-based' : devOptions.geckoBinary ? 'gecko-based' : devOptions.browser;
|
|
5674
5696
|
return {
|
|
5675
5697
|
mode: devOptions.mode || 'development',
|
|
@@ -5720,7 +5742,8 @@ function webpackConfig(projectPath, devOptions) {
|
|
|
5720
5742
|
plugins: [
|
|
5721
5743
|
new CompilationPlugin({
|
|
5722
5744
|
manifestPath,
|
|
5723
|
-
browser
|
|
5745
|
+
browser,
|
|
5746
|
+
clean: null == (_devOptions_output1 = devOptions.output) ? void 0 : _devOptions_output1.clean
|
|
5724
5747
|
}),
|
|
5725
5748
|
new StaticAssetsPlugin({
|
|
5726
5749
|
mode: devOptions.mode,
|
|
@@ -5751,7 +5774,7 @@ function webpackConfig(projectPath, devOptions) {
|
|
|
5751
5774
|
new BrowsersPlugin({
|
|
5752
5775
|
extension: [
|
|
5753
5776
|
userExtensionOutputPath,
|
|
5754
|
-
|
|
5777
|
+
'production' !== devOptions.mode ? managerExtensionPath : ''
|
|
5755
5778
|
],
|
|
5756
5779
|
browser,
|
|
5757
5780
|
open: devOptions.open,
|
|
@@ -6013,7 +6036,8 @@ async function extensionBuild(pathOrRemoteUrl, buildOptions) {
|
|
|
6013
6036
|
browser,
|
|
6014
6037
|
mode: 'production',
|
|
6015
6038
|
output: {
|
|
6016
|
-
clean: true
|
|
6039
|
+
clean: true,
|
|
6040
|
+
path: external_path_namespaceObject.join(projectPath, 'dist', browser)
|
|
6017
6041
|
}
|
|
6018
6042
|
});
|
|
6019
6043
|
const allPluginsButBrowserRunners = null == (_baseConfig_plugins = baseConfig.plugins) ? void 0 : _baseConfig_plugins.filter((plugin)=>(null == plugin ? void 0 : plugin.constructor.name) !== 'plugin-browsers' && (null == plugin ? void 0 : plugin.constructor.name) !== 'plugin-reload');
|
|
@@ -6091,7 +6115,8 @@ async function dev_server_devServer(projectPath, devOptions) {
|
|
|
6091
6115
|
...browserConfig,
|
|
6092
6116
|
mode: 'development',
|
|
6093
6117
|
output: {
|
|
6094
|
-
clean: false
|
|
6118
|
+
clean: false,
|
|
6119
|
+
path: external_path_namespaceObject.join(projectPath, 'dist', devOptions.browser)
|
|
6095
6120
|
}
|
|
6096
6121
|
});
|
|
6097
6122
|
const customWebpackConfig = await loadCustomWebpackConfig(projectPath);
|
|
@@ -6226,6 +6251,8 @@ async function extensionDev(pathOrRemoteUrl, devOptions) {
|
|
|
6226
6251
|
}
|
|
6227
6252
|
async function extensionPreview(pathOrRemoteUrl, previewOptions) {
|
|
6228
6253
|
const projectPath = await getProjectPath(pathOrRemoteUrl);
|
|
6254
|
+
const distPath = external_path_namespaceObject.join(projectPath, 'dist', previewOptions.browser);
|
|
6255
|
+
const outputPath = previewOptions.outputPath ? previewOptions.outputPath : external_fs_namespaceObject.existsSync(distPath) ? distPath : projectPath;
|
|
6229
6256
|
if (!(null == pathOrRemoteUrl ? void 0 : pathOrRemoteUrl.startsWith('http')) && !external_fs_namespaceObject.existsSync(external_path_namespaceObject.join(projectPath, 'manifest.json'))) {
|
|
6230
6257
|
console.log(messages_manifestNotFoundError(external_path_namespaceObject.join(projectPath, 'manifest.json')));
|
|
6231
6258
|
process.exit(1);
|
|
@@ -6241,7 +6268,8 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions) {
|
|
|
6241
6268
|
geckoBinary: previewOptions.geckoBinary,
|
|
6242
6269
|
startingUrl: previewOptions.startingUrl,
|
|
6243
6270
|
output: {
|
|
6244
|
-
clean: false
|
|
6271
|
+
clean: false,
|
|
6272
|
+
path: outputPath
|
|
6245
6273
|
}
|
|
6246
6274
|
});
|
|
6247
6275
|
const onlyBrowserRunners = null == (_baseConfig_plugins = baseConfig.plugins) ? void 0 : _baseConfig_plugins.filter((plugin)=>(null == plugin ? void 0 : plugin.constructor.name) === 'plugin-browsers');
|
|
@@ -6262,7 +6290,7 @@ async function extensionPreview(pathOrRemoteUrl, previewOptions) {
|
|
|
6262
6290
|
colors: true
|
|
6263
6291
|
}));
|
|
6264
6292
|
process.exit(1);
|
|
6265
|
-
} else console.log(runningInProduction(
|
|
6293
|
+
} else console.log(runningInProduction(projectPath));
|
|
6266
6294
|
});
|
|
6267
6295
|
} catch (error) {
|
|
6268
6296
|
if ('development' === process.env.EXTENSION_ENV) console.error(error);
|
|
@@ -6284,7 +6312,8 @@ async function extensionStart(pathOrRemoteUrl, startOptions) {
|
|
|
6284
6312
|
});
|
|
6285
6313
|
await extensionPreview(pathOrRemoteUrl, {
|
|
6286
6314
|
...startOptions,
|
|
6287
|
-
browser
|
|
6315
|
+
browser,
|
|
6316
|
+
outputPath: external_path_namespaceObject.join(projectPath, 'dist', browser)
|
|
6288
6317
|
});
|
|
6289
6318
|
} catch (error) {
|
|
6290
6319
|
if ('development' === process.env.EXTENSION_ENV) console.error(error);
|
|
@@ -4,6 +4,9 @@ export declare class CompilationPlugin {
|
|
|
4
4
|
static readonly name: string;
|
|
5
5
|
readonly manifestPath: string;
|
|
6
6
|
readonly browser: PluginInterface['browser'];
|
|
7
|
-
|
|
7
|
+
readonly clean: boolean;
|
|
8
|
+
constructor(options: PluginInterface & {
|
|
9
|
+
clean: boolean;
|
|
10
|
+
});
|
|
8
11
|
apply(compiler: Compiler): void;
|
|
9
12
|
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { DefaultTreeAdapterTypes } from 'parse5';
|
|
2
|
+
export interface Attribute {
|
|
3
|
+
name: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
export type ParsedNode = DefaultTreeAdapterTypes.Node;
|
|
7
|
+
/**
|
|
8
|
+
* Parses HTML string into a document or fragment
|
|
9
|
+
* @param string - HTML string to parse
|
|
10
|
+
* @param smart - If true, automatically detects if input is a document or fragment
|
|
11
|
+
* @returns Parsed document or fragment
|
|
12
|
+
*/
|
|
13
|
+
export declare const parse: (string: string, smart?: boolean) => DefaultTreeAdapterTypes.Document | DefaultTreeAdapterTypes.DocumentFragment;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a document fragment from HTML string
|
|
16
|
+
* @param string - HTML string to parse
|
|
17
|
+
* @returns Document fragment
|
|
18
|
+
*/
|
|
19
|
+
export declare const createFragment: (string: string) => DefaultTreeAdapterTypes.DocumentFragment;
|
|
20
|
+
/**
|
|
21
|
+
* Serializes a node back to HTML string
|
|
22
|
+
* @param node - Node to serialize
|
|
23
|
+
* @returns HTML string
|
|
24
|
+
*/
|
|
25
|
+
export declare const stringify: (node: ParsedNode) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Converts node attributes to a plain object
|
|
28
|
+
* @param node - Node to extract attributes from
|
|
29
|
+
* @returns Object containing attribute name-value pairs
|
|
30
|
+
*/
|
|
31
|
+
export declare const attributesOf: (node: ParsedNode) => Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Converts a plain object to an array of attributes
|
|
34
|
+
* @param obj - Object containing attribute name-value pairs
|
|
35
|
+
* @returns Array of attributes
|
|
36
|
+
*/
|
|
37
|
+
export declare const toAttrs: (obj: Record<string, string>) => Attribute[];
|
|
38
|
+
/**
|
|
39
|
+
* Sets an attribute on a node
|
|
40
|
+
* @param node - Node to set attribute on
|
|
41
|
+
* @param key - Attribute name
|
|
42
|
+
* @param value - Attribute value
|
|
43
|
+
* @returns Modified node
|
|
44
|
+
*/
|
|
45
|
+
export declare const setAttribute: (node: ParsedNode, key: string, value: string) => ParsedNode;
|
|
46
|
+
/**
|
|
47
|
+
* Gets an attribute value from a node
|
|
48
|
+
* @param node - Node to get attribute from
|
|
49
|
+
* @param key - Attribute name
|
|
50
|
+
* @returns Attribute value or undefined
|
|
51
|
+
*/
|
|
52
|
+
export declare const getAttribute: (node: ParsedNode, key: string) => string | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Removes an attribute from a node
|
|
55
|
+
* @param node - Node to remove attribute from
|
|
56
|
+
* @param key - Attribute name to remove
|
|
57
|
+
*/
|
|
58
|
+
export declare const removeAttribute: (node: ParsedNode, key: string) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Creates a new element node
|
|
61
|
+
* @param tagName - Tag name for the new element
|
|
62
|
+
* @returns New element node
|
|
63
|
+
*/
|
|
64
|
+
export declare const createNode: (tagName: string) => DefaultTreeAdapterTypes.Element;
|
|
65
|
+
/**
|
|
66
|
+
* Creates a new text node
|
|
67
|
+
* @param text - Text content
|
|
68
|
+
* @returns New text node
|
|
69
|
+
*/
|
|
70
|
+
export declare const createTextNode: (text: string) => DefaultTreeAdapterTypes.TextNode;
|
|
71
|
+
/**
|
|
72
|
+
* Prepends a node to a parent node
|
|
73
|
+
* @param parent - Parent node
|
|
74
|
+
* @param node - Node to prepend
|
|
75
|
+
* @returns Prepended node
|
|
76
|
+
*/
|
|
77
|
+
export declare const prepend: (parent: DefaultTreeAdapterTypes.ParentNode, node: DefaultTreeAdapterTypes.ChildNode) => DefaultTreeAdapterTypes.ChildNode;
|
|
78
|
+
/**
|
|
79
|
+
* Appends a node to a parent node
|
|
80
|
+
* @param parent - Parent node
|
|
81
|
+
* @param node - Node to append
|
|
82
|
+
* @returns Appended node
|
|
83
|
+
*/
|
|
84
|
+
export declare const append: (parent: DefaultTreeAdapterTypes.ParentNode, node: DefaultTreeAdapterTypes.ChildNode) => DefaultTreeAdapterTypes.ChildNode;
|
|
85
|
+
/**
|
|
86
|
+
* Replaces a node with another node
|
|
87
|
+
* @param original - Node to replace
|
|
88
|
+
* @param node - New node
|
|
89
|
+
* @returns New node
|
|
90
|
+
*/
|
|
91
|
+
export declare const replace: (original: DefaultTreeAdapterTypes.ChildNode, node: DefaultTreeAdapterTypes.ChildNode) => DefaultTreeAdapterTypes.ChildNode | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Removes a node from its parent
|
|
94
|
+
* @param node - Node to remove
|
|
95
|
+
* @returns Removed node
|
|
96
|
+
*/
|
|
97
|
+
export declare const remove: (node: DefaultTreeAdapterTypes.ChildNode) => DefaultTreeAdapterTypes.ChildNode;
|
|
98
|
+
/**
|
|
99
|
+
* Gets text content of a node
|
|
100
|
+
* @param node - Node to get text from
|
|
101
|
+
* @returns Text content
|
|
102
|
+
* @throws Error if node has multiple children or non-text children
|
|
103
|
+
*/
|
|
104
|
+
export declare const textOf: (node: DefaultTreeAdapterTypes.ParentNode) => string;
|
|
105
|
+
/**
|
|
106
|
+
* Sets text content of a node
|
|
107
|
+
* @param node - Node to set text on
|
|
108
|
+
* @param text - Text content
|
|
109
|
+
* @returns Modified node
|
|
110
|
+
*/
|
|
111
|
+
export declare const setText: (node: DefaultTreeAdapterTypes.ParentNode, text: string) => DefaultTreeAdapterTypes.ParentNode;
|
|
112
|
+
/**
|
|
113
|
+
* Checks if a string is likely a complete HTML document
|
|
114
|
+
* @param string - String to check
|
|
115
|
+
* @returns True if string appears to be a complete document
|
|
116
|
+
*/
|
|
117
|
+
export declare const isDocument: (string: string) => boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Flattens a node tree into an array
|
|
120
|
+
* @param node - Node or array of nodes to flatten
|
|
121
|
+
* @param arr - Optional array to accumulate results
|
|
122
|
+
* @returns Array of all nodes
|
|
123
|
+
*/
|
|
124
|
+
export declare const flatten: (node: ParsedNode | ParsedNode[], arr?: ParsedNode[]) => ParsedNode[];
|
package/dist/webpack/plugin-extension/feature-html/html-lib/parse5-utilities/tests/index.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { LoaderInterface } from '../../../webpack-types';
|
|
2
|
-
export default function ensureHMRForScripts(this: LoaderInterface, source: string): string
|
|
2
|
+
export default function ensureHMRForScripts(this: LoaderInterface, source: string): string;
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"name": "extension-develop",
|
|
24
|
-
"version": "2.0.0-rc.
|
|
24
|
+
"version": "2.0.0-rc.37",
|
|
25
25
|
"description": "The develop step of Extension.js",
|
|
26
26
|
"author": {
|
|
27
27
|
"name": "Cezar Augusto",
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"adm-zip": "^0.5.16",
|
|
38
38
|
"axios": "^1.9.0",
|
|
39
39
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
40
|
-
"chalk": "^5.3.0",
|
|
41
40
|
"chokidar": "^4.0.1",
|
|
42
41
|
"chrome-location2": "2.0.0",
|
|
43
42
|
"content-security-policy-parser": "^0.6.0",
|
|
@@ -56,6 +55,7 @@
|
|
|
56
55
|
"package-manager-detector": "^0.2.7",
|
|
57
56
|
"parse5": "^7.2.1",
|
|
58
57
|
"parse5-utilities": "^1.0.0",
|
|
58
|
+
"pintor": "0.3.0",
|
|
59
59
|
"postcss": "^8.4.49",
|
|
60
60
|
"preact": "^10.22.0",
|
|
61
61
|
"progress": "^2.0.3",
|