Drop support for nonGeneratedFiles from brave_rollup_overrides.js
This made sense when Chromium's //c/b/resources/tools/rollup_plugin.js considered that source JS files could come from both the sources and the generated directories, but this is no longer the case as all those JS files are under <root_gen_dir>/ui/webui/resources/webui_preprocessed now, so we need to update Brave's code to adapt to this new scenario. Chromium change: https://chromium.googlesource.com/chromium/src/+/efc282784459e1ec69a524d901d8694cce5230c5 commit efc282784459e1ec69a524d901d8694cce5230c5 Author: rbpotter <rbpotter@chromium.org> Date: Tue Sep 1 04:37:15 2020 +0000 Web UI: Add preprocessed resources and use in rollup Preprocess all shared JS module resources into: <root_gen_dir>/ui/webui/resources/webui_preprocessed and read all these resources from this directory when bundling with rollup. Bug: 1071641
This commit is contained in:
committed by
mkarolin
parent
2aa3834414
commit
033fdeec00
@@ -1,12 +1,12 @@
|
||||
diff --git a/chrome/browser/resources/tools/rollup_plugin.js b/chrome/browser/resources/tools/rollup_plugin.js
|
||||
index b541233a644bc428257dafcea7198d2d4a529d98..2ac54a0c01a953fd8d83a3a7cb94db410ff4899d 100644
|
||||
index b541233a644bc428257dafcea7198d2d4a529d98..793639a113a26f5488279f76c748cf197ee88aa2 100644
|
||||
--- a/chrome/browser/resources/tools/rollup_plugin.js
|
||||
+++ b/chrome/browser/resources/tools/rollup_plugin.js
|
||||
@@ -71,6 +71,8 @@ export default function plugin(srcPath, genPath, rootPath, host, excludes) {
|
||||
return joinPaths(polymerSrcPath, pathFromPolymer);
|
||||
}
|
||||
|
||||
+ const resolvedByBrave = require(path.join(__dirname, '..', '..', 'brave_rollup_overrides')).braveResolveId({srcPath, genPath, excludes}, source, origin, relativePath, joinPaths, combinePaths, chromeResourcesUrl, schemeRelativeResourcesUrl, nonGeneratedFiles); if (resolvedByBrave) { return resolvedByBrave; }
|
||||
+ const resolvedByBrave = require(path.join(__dirname, '..', '..', 'brave_rollup_overrides')).braveResolveId({srcPath, genPath, excludes}, source, origin, relativePath, joinPaths, combinePaths, chromeResourcesUrl, schemeRelativeResourcesUrl); if (resolvedByBrave) { return resolvedByBrave; }
|
||||
+
|
||||
// Get path from ui/webui/resources
|
||||
let pathFromResources = '';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
braveResolveId: function (params, source, origin, relativePath, joinPaths, combinePaths, chromeResourcesUrl, schemeRelativeResourcesUrl, nonGeneratedFiles) {
|
||||
braveResolveId: function (params, source, origin, relativePath, joinPaths, combinePaths, chromeResourcesUrl, schemeRelativeResourcesUrl) {
|
||||
const {srcPath, genPath, excludes} = params;
|
||||
const resourcesSrcPath = joinPaths(srcPath, 'ui/webui/resources/');
|
||||
const resourcesGenPath = joinPaths(genPath, 'ui/webui/resources/');
|
||||
@@ -32,10 +32,6 @@ module.exports = {
|
||||
if (excludes.includes(fullPath)) {
|
||||
return {id: fullPath, external: true};
|
||||
}
|
||||
const filename = path.basename(source);
|
||||
if (nonGeneratedFiles.includes(filename)) {
|
||||
return joinPaths(resourcesSrcPath, pathFromBraveResources);
|
||||
}
|
||||
// JS compiled into gen directory
|
||||
if (pathFromBraveResources.endsWith('.js')) {
|
||||
return joinPaths(braveResourcesGenPath, pathFromBraveResources);
|
||||
|
||||
Reference in New Issue
Block a user