Skip to content

Commit

Permalink
WebUI: Update Rollup to v3.12.0
Browse files Browse the repository at this point in the history
Bug: 1412155
Change-Id: I7862c0ada426f68ef2c524db2552664bd6245ddc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4214416
Reviewed-by: Mike Dougherty <michaeldo@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1100580}
  • Loading branch information
Rebekah Potter authored and Chromium LUCI CQ committed Feb 2, 2023
1 parent f525bc9 commit d63de44
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/resources/tools/optimize_webui.gni
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ template("optimize_webui") {
}
args += [ "--external_paths" ] + external_paths

inputs += [ "//chrome/browser/resources/tools/rollup_plugin.js" ]
inputs += [ "//chrome/browser/resources/tools/rollup_plugin.mjs" ]
args += [ "--js_module_in_files" ] + invoker.js_module_in_files

if (defined(invoker.out_manifest)) {
Expand Down
6 changes: 4 additions & 2 deletions chrome/browser/resources/tools/optimize_webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _update_dep_file(in_folder, args, out_file_path, manifest):
def _generate_rollup_config(tmp_out_dir, path_to_plugin, in_path, bundle_path,
host_url, excludes, external_paths):
rollup_config_file = os.path.join(tmp_out_dir, bundle_path,
'rollup.config.js')
'rollup.config.mjs')
config_content = r'''
import plugin from '{plugin_path}';
export default ({{
Expand Down Expand Up @@ -157,7 +157,9 @@ def _bundle_v3(tmp_out_dir, in_path, out_path, manifest_out_path, args,
if not os.path.exists(out_dir):
os.makedirs(out_dir)

path_to_plugin = os.path.join(os.path.abspath(_HERE_PATH), 'rollup_plugin.js')
path_to_plugin = os.path.join(
os.path.relpath(_HERE_PATH, os.path.join(tmp_out_dir, bundle_path)),
'rollup_plugin.mjs')
rollup_config_file = _generate_rollup_config(tmp_out_dir, path_to_plugin,
in_path, bundle_path,
args.host_url, excludes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* @fileoverview Plugin for rollup to correctly resolve resources.
*/
const path = require('path');
import * as path from 'path';

function normalizeSlashes(filepath) {
return filepath.replace(/\\/gi, '/');
Expand Down
2 changes: 1 addition & 1 deletion ios/web/public/js_messaging/optimize_js.gni
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ template("optimize_js") {
script = "//ios/web/public/js_messaging/optimize_js.py"

inputs =
[ "//ios/web/public/js_messaging/rollup_plugin_src_path_resolver.js" ]
[ "//ios/web/public/js_messaging/rollup_plugin_src_path_resolver.mjs" ]

output_js_file_name = get_path_info(invoker.primary_script, "file")
output_js_file = "$target_gen_dir/" + output_js_file_name
Expand Down
4 changes: 2 additions & 2 deletions ios/web/public/js_messaging/optimize_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def create_rollup_config(config_out_file, rollup_root_dir, path_mappings):
"""Generates a rollup config file to configure and use the path resolver
plugin which enforces import path format."""
plugin_path = os.path.join(os.path.abspath(_HERE_PATH),
'rollup_plugin_src_path_resolver.js')
'rollup_plugin_src_path_resolver.mjs')

path_mappings_json = json.dumps(path_mappings, separators=(',', ':'))

Expand Down Expand Up @@ -65,7 +65,7 @@ def optimize_js(primary_script,
with tempfile.TemporaryDirectory(dir = output_script_dir) as tmp_out_dir:

rollup_config_file = \
os.path.join(tmp_out_dir, 'rollup.config.js')
os.path.join(tmp_out_dir, 'rollup.config.mjs')
create_rollup_config(
rollup_config_file,
os.path.abspath(_SRC_PATH),
Expand Down
2 changes: 1 addition & 1 deletion third_party/node/node_modules.tar.gz.sha1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22ef661af0e85e393bdb632564e9d0583dd606a5
a4141790466cffd27ccd8c90c24f8b1ded7d3d99
17 changes: 9 additions & 8 deletions third_party/node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion third_party/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"eslint": "7.11.0",
"eslint-plugin-jsdoc": "37.5.1",
"html-minifier": "4.0.0",
"rollup": "2.58.0",
"rollup": "3.12.0",
"svgo": "2.8.0",
"terser": "5.3.3",
"typescript": "4.9.4"
Expand Down
2 changes: 1 addition & 1 deletion ui/file_manager/base/gn/files_webui_bundle/PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

def _CheckChangeOnUploadOrCommit(input_api, output_api):
results = []
webui_sources = set(['files_webui_bundle.py', 'rollup_plugin.js'])
webui_sources = set(['files_webui_bundle.py', 'rollup_plugin.mjs'])
affected = input_api.AffectedFiles()
affected_files = [input_api.os_path.basename(f.LocalPath()) for f in affected]
if webui_sources.intersection(set(affected_files)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ template("files_webui_bundle") {
args += [ "--external_paths" ] + external_paths

inputs +=
[ "//ui/file_manager/base/gn/files_webui_bundle/rollup_plugin.js" ]
[ "//ui/file_manager/base/gn/files_webui_bundle/rollup_plugin.mjs" ]
args += [ "--js_module_in_files" ] + invoker.js_module_in_files

if (defined(invoker.out_manifest)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _update_dep_file(in_folder, args, manifest):
# from the bundle.
def _generate_rollup_config(tmp_out_dir, path_to_plugin, in_path, host_url,
excludes, external_paths):
rollup_config_file = os.path.join(tmp_out_dir, 'rollup.config.js')
rollup_config_file = os.path.join(tmp_out_dir, 'rollup.config.mjs')
config_content = r'''
import plugin from '{plugin_path}';
export default ({{
Expand Down Expand Up @@ -127,7 +127,8 @@ def _bundle_v3(tmp_out_dir, in_path, out_path, manifest_out_path, args,
excludes, external_paths):
if not os.path.exists(tmp_out_dir):
os.makedirs(tmp_out_dir)
path_to_plugin = os.path.join(os.path.abspath(_HERE_PATH), 'rollup_plugin.js')
path_to_plugin = os.path.join(
os.path.abspath(_HERE_PATH), 'rollup_plugin.mjs')
rollup_config_file = _generate_rollup_config(tmp_out_dir, path_to_plugin,
in_path, args.host_url, excludes,
external_paths)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* @fileoverview Plugin for rollup to correctly resolve resources.
*/
const path = require('path');
import * as path from 'path';

function normalizeSlashes(filepath) {
return filepath.replace(/\\/gi, '/');
Expand Down

0 comments on commit d63de44

Please sign in to comment.