extension-develop 3.2.0-next.7 → 3.2.0-next.9
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/547.js +54 -46
- package/dist/module.js +12 -6
- package/package.json +1 -2
package/dist/547.js
CHANGED
|
@@ -6527,7 +6527,6 @@ Set background.noDynamicEntryWarning to true to disable this warning.
|
|
|
6527
6527
|
this.browser = options.browser || 'chrome';
|
|
6528
6528
|
}
|
|
6529
6529
|
}
|
|
6530
|
-
var external_chokidar_ = __webpack_require__("chokidar");
|
|
6531
6530
|
function serverRestartRequiredFromSpecialFolderMessageOnly(addingOrRemoving, folder, typeOfAsset) {
|
|
6532
6531
|
return `${external_pintor_default().red('ERROR')} in ${external_pintor_default().yellow('manifest.json')} entrypoint: ${addingOrRemoving} ${external_pintor_default().yellow(typeOfAsset)} in ${external_pintor_default().underline(folder + '/')} requires a dev server restart to apply changes.`;
|
|
6533
6532
|
}
|
|
@@ -6537,6 +6536,16 @@ Set background.noDynamicEntryWarning to true to disable this warning.
|
|
|
6537
6536
|
function specialFolderChangeDetected(action, folder, relativePath) {
|
|
6538
6537
|
return `Special folders change — ${action} in ${folder}/: ${relativePath}`;
|
|
6539
6538
|
}
|
|
6539
|
+
function warn_upon_folder_changes_define_property(obj, key, value) {
|
|
6540
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
6541
|
+
value: value,
|
|
6542
|
+
enumerable: true,
|
|
6543
|
+
configurable: true,
|
|
6544
|
+
writable: true
|
|
6545
|
+
});
|
|
6546
|
+
else obj[key] = value;
|
|
6547
|
+
return obj;
|
|
6548
|
+
}
|
|
6540
6549
|
class WarnUponFolderChanges {
|
|
6541
6550
|
throwCompilationError(compilation, folder, filePath, isAddition) {
|
|
6542
6551
|
const addingOrRemoving = isAddition ? 'Adding' : 'Removing';
|
|
@@ -6556,58 +6565,57 @@ Set background.noDynamicEntryWarning to true to disable this warning.
|
|
|
6556
6565
|
err.details = `Removing from ${folder}/ breaks current build. Restart the dev server to recompile.`;
|
|
6557
6566
|
compilation.errors?.push(err);
|
|
6558
6567
|
}
|
|
6568
|
+
trackChange(projectPath, folder, change, filePath) {
|
|
6569
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('add' === change ? 'add' : 'remove', folder, external_path_.relative(projectPath, filePath)));
|
|
6570
|
+
this.pendingChanges.push({
|
|
6571
|
+
type: change,
|
|
6572
|
+
folder,
|
|
6573
|
+
filePath
|
|
6574
|
+
});
|
|
6575
|
+
}
|
|
6576
|
+
collectChanges(compiler) {
|
|
6577
|
+
const projectPath = compiler.options.context || process.cwd();
|
|
6578
|
+
const pagesPath = external_path_.join(projectPath, 'pages') + external_path_.sep;
|
|
6579
|
+
const scriptsPath = external_path_.join(projectPath, "scripts") + external_path_.sep;
|
|
6580
|
+
const extensionsSupported = compiler.options.resolve?.extensions;
|
|
6581
|
+
const supportedScripts = new Set((extensionsSupported || []).map((e)=>e.toLowerCase()));
|
|
6582
|
+
const modifiedFiles = compiler.modifiedFiles || new Set();
|
|
6583
|
+
const removedFiles = compiler.removedFiles || new Set();
|
|
6584
|
+
for (const filePath of modifiedFiles){
|
|
6585
|
+
if (filePath.startsWith(pagesPath) && filePath.endsWith('.html')) this.trackChange(projectPath, 'pages', 'add', filePath);
|
|
6586
|
+
if (filePath.startsWith(scriptsPath)) {
|
|
6587
|
+
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6588
|
+
if (supportedScripts.has(ext)) this.trackChange(projectPath, "scripts", 'add', filePath);
|
|
6589
|
+
}
|
|
6590
|
+
}
|
|
6591
|
+
for (const filePath of removedFiles){
|
|
6592
|
+
if (filePath.startsWith(pagesPath) && filePath.endsWith('.html')) this.trackChange(projectPath, 'pages', 'remove', filePath);
|
|
6593
|
+
if (filePath.startsWith(scriptsPath)) {
|
|
6594
|
+
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6595
|
+
if (supportedScripts.has(ext)) this.trackChange(projectPath, "scripts", 'remove', filePath);
|
|
6596
|
+
}
|
|
6597
|
+
}
|
|
6598
|
+
}
|
|
6599
|
+
applyPendingChanges(compilation) {
|
|
6600
|
+
for (const change of this.pendingChanges)this.throwCompilationError(compilation, change.folder, change.filePath, 'add' === change.type);
|
|
6601
|
+
this.pendingChanges = [];
|
|
6602
|
+
}
|
|
6559
6603
|
apply(compiler) {
|
|
6604
|
+
compiler.hooks.watchRun.tap('special-folders:warn-upon-folder-changes', ()=>{
|
|
6605
|
+
this.collectChanges(compiler);
|
|
6606
|
+
});
|
|
6560
6607
|
compiler.hooks.thisCompilation.tap('special-folders:warn-upon-folder-changes', (compilation)=>{
|
|
6561
6608
|
const projectPath = compiler.options.context || process.cwd();
|
|
6562
6609
|
const pagesPath = external_path_.join(projectPath, 'pages');
|
|
6563
6610
|
const scriptsPath = external_path_.join(projectPath, "scripts");
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
const scriptsWatcher = external_chokidar_.watch(scriptsPath, {
|
|
6568
|
-
ignoreInitial: true
|
|
6569
|
-
});
|
|
6570
|
-
const extensionsSupported = compiler.options.resolve?.extensions;
|
|
6571
|
-
pagesWatcher.on('add', (filePath)=>{
|
|
6572
|
-
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6573
|
-
const isHtml = '.html' === ext;
|
|
6574
|
-
if (isHtml) {
|
|
6575
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('add', 'pages', external_path_.relative(projectPath, filePath)));
|
|
6576
|
-
this.throwCompilationError(compilation, 'pages', filePath, true);
|
|
6577
|
-
}
|
|
6578
|
-
});
|
|
6579
|
-
pagesWatcher.on('unlink', (filePath)=>{
|
|
6580
|
-
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6581
|
-
const isHtml = '.html' === ext;
|
|
6582
|
-
if (isHtml) {
|
|
6583
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('remove', 'pages', external_path_.relative(projectPath, filePath)));
|
|
6584
|
-
this.throwCompilationError(compilation, 'pages', filePath);
|
|
6585
|
-
}
|
|
6586
|
-
});
|
|
6587
|
-
scriptsWatcher.on('add', (filePath)=>{
|
|
6588
|
-
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6589
|
-
const supported = new Set((extensionsSupported || []).map((e)=>e.toLowerCase()));
|
|
6590
|
-
const isScript = supported.has(ext);
|
|
6591
|
-
if (isScript) {
|
|
6592
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('add', "scripts", external_path_.relative(projectPath, filePath)));
|
|
6593
|
-
this.throwCompilationError(compilation, "scripts", filePath, true);
|
|
6594
|
-
}
|
|
6595
|
-
});
|
|
6596
|
-
scriptsWatcher.on('unlink', (filePath)=>{
|
|
6597
|
-
const ext = external_path_.extname(filePath).toLowerCase();
|
|
6598
|
-
const supported = new Set((extensionsSupported || []).map((e)=>e.toLowerCase()));
|
|
6599
|
-
const isScript = supported.has(ext);
|
|
6600
|
-
if (isScript) {
|
|
6601
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(specialFolderChangeDetected('remove', "scripts", external_path_.relative(projectPath, filePath)));
|
|
6602
|
-
this.throwCompilationError(compilation, "scripts", filePath);
|
|
6603
|
-
}
|
|
6604
|
-
});
|
|
6605
|
-
compiler.hooks.watchClose.tap('WarnUponFolderChanges', ()=>{
|
|
6606
|
-
pagesWatcher.close().catch(()=>{});
|
|
6607
|
-
scriptsWatcher.close().catch(()=>{});
|
|
6608
|
-
});
|
|
6611
|
+
compilation.contextDependencies?.add(pagesPath);
|
|
6612
|
+
compilation.contextDependencies?.add(scriptsPath);
|
|
6613
|
+
this.applyPendingChanges(compilation);
|
|
6609
6614
|
});
|
|
6610
6615
|
}
|
|
6616
|
+
constructor(){
|
|
6617
|
+
warn_upon_folder_changes_define_property(this, "pendingChanges", []);
|
|
6618
|
+
}
|
|
6611
6619
|
}
|
|
6612
6620
|
function checkManifestInPublic(compilation, publicDir) {
|
|
6613
6621
|
try {
|
package/dist/module.js
CHANGED
|
@@ -132090,6 +132090,7 @@ var __webpack_modules__ = {
|
|
|
132090
132090
|
"./webpack/webpack-lib/messages.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
132091
132091
|
"use strict";
|
|
132092
132092
|
__webpack_require__.d(__webpack_exports__, {
|
|
132093
|
+
$3: ()=>buildCommandFailed,
|
|
132093
132094
|
AC: ()=>debugOutputPath,
|
|
132094
132095
|
Al: ()=>runningInProduction,
|
|
132095
132096
|
BT: ()=>treeWithSourceFiles,
|
|
@@ -132365,6 +132366,13 @@ var __webpack_modules__ = {
|
|
|
132365
132366
|
function configLoadingError(configPath, error) {
|
|
132366
132367
|
return `${pintor__rspack_import_2_default().red('ERROR')} ${pintor__rspack_import_2_default().brightBlue('config load failed')}\n${fmt.label('PATH')} ${fmt.val(configPath)}\n` + pintor__rspack_import_2_default().red(fmt.truncate(error, 1200));
|
|
132367
132368
|
}
|
|
132369
|
+
function buildCommandFailed(error) {
|
|
132370
|
+
const message = (()=>{
|
|
132371
|
+
if (error instanceof Error && error.message) return error.message;
|
|
132372
|
+
return String(error || 'Unknown error');
|
|
132373
|
+
})();
|
|
132374
|
+
return `${getLoggingPrefix('error')} Build failed.\n${pintor__rspack_import_2_default().red(fmt.truncate(message, 1200))}`;
|
|
132375
|
+
}
|
|
132368
132376
|
function managedDependencyConflict(duplicates, userPackageJsonPath) {
|
|
132369
132377
|
const list = duplicates.map((d)=>`- ${pintor__rspack_import_2_default().yellow(d)}`).join('\n');
|
|
132370
132378
|
return `${getLoggingPrefix('error')} Your project declares dependencies that are managed by ${pintor__rspack_import_2_default().blue('Extension.js')} and referenced in ${pintor__rspack_import_2_default().underline('extension.config.js')}\n${pintor__rspack_import_2_default().red('This can cause version conflicts and break the development/build process.')}\n\n${pintor__rspack_import_2_default().gray('Managed dependencies (remove these from your package.json):')}\n${list}\n\n${pintor__rspack_import_2_default().gray('PATH')} ${pintor__rspack_import_2_default().underline(userPackageJsonPath)}\nIf you need a different version, open an issue so we can consider bundling it safely.\nOperation aborted.`;
|
|
@@ -132506,10 +132514,6 @@ var __webpack_modules__ = {
|
|
|
132506
132514
|
"use strict";
|
|
132507
132515
|
module.exports = require("child_process");
|
|
132508
132516
|
},
|
|
132509
|
-
chokidar (module) {
|
|
132510
|
-
"use strict";
|
|
132511
|
-
module.exports = require("chokidar");
|
|
132512
|
-
},
|
|
132513
132517
|
"chrome-location2" (module) {
|
|
132514
132518
|
"use strict";
|
|
132515
132519
|
module.exports = require("chrome-location2");
|
|
@@ -132612,7 +132616,7 @@ var __webpack_modules__ = {
|
|
|
132612
132616
|
},
|
|
132613
132617
|
"./package.json" (module) {
|
|
132614
132618
|
"use strict";
|
|
132615
|
-
module.exports = JSON.parse('{"rE":"3.2.0-next.
|
|
132619
|
+
module.exports = JSON.parse('{"rE":"3.2.0-next.9","El":{"@rspack/core":"^1.7.2","@rspack/dev-server":"^1.1.5","@swc/core":"^1.15.8","@swc/helpers":"^0.5.18","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chrome-location2":"4.0.0","chromium-location":"2.0.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^17.2.3","edge-location":"2.2.0","firefox-location2":"3.0.0","go-git-it":"^5.0.3","ignore":"^7.0.5","loader-utils":"^3.3.1","magic-string":"^0.30.21","parse5":"^8.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.3.3","tiny-glob":"^0.2.9","unique-names-generator":"^4.7.1","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.19.0"}}');
|
|
132616
132620
|
}
|
|
132617
132621
|
};
|
|
132618
132622
|
var __webpack_module_cache__ = {};
|
|
@@ -133402,7 +133406,9 @@ var __webpack_exports__ = {};
|
|
|
133402
133406
|
});
|
|
133403
133407
|
return summary;
|
|
133404
133408
|
} catch (error) {
|
|
133405
|
-
|
|
133409
|
+
const isAuthor = 'true' === process.env.EXTENSION_AUTHOR_MODE;
|
|
133410
|
+
if (isAuthor) console.error(error);
|
|
133411
|
+
else console.error(messages.$3(error));
|
|
133406
133412
|
if (!shouldExitOnError) throw error;
|
|
133407
133413
|
process.exit(1);
|
|
133408
133414
|
}
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"name": "extension-develop",
|
|
25
|
-
"version": "3.2.0-next.
|
|
25
|
+
"version": "3.2.0-next.9",
|
|
26
26
|
"description": "Develop, build, preview, and package Extension.js projects.",
|
|
27
27
|
"author": {
|
|
28
28
|
"name": "Cezar Augusto",
|
|
@@ -77,7 +77,6 @@
|
|
|
77
77
|
"adm-zip": "^0.5.16",
|
|
78
78
|
"browser-extension-manifest-fields": "^2.2.1",
|
|
79
79
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
80
|
-
"chokidar": "^5.0.0",
|
|
81
80
|
"chrome-location2": "4.0.0",
|
|
82
81
|
"chromium-location": "2.0.0",
|
|
83
82
|
"content-security-policy-parser": "^0.6.0",
|