Skip to content

Commit 3d014e0

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
Use ESM for some build scripts
The last few files I managed to find before having to resort to the whole `cts` extension thingy. Bug: 411053158 Change-Id: I4a745c0a28ff2e6244ed7ff9d196d51539c1fa46 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7223974 Commit-Queue: Simon Zünd <[email protected]> Reviewed-by: Simon Zünd <[email protected]>
1 parent d5256c3 commit 3d014e0

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

inspector_overlay/loadCSS.rollup.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
// WARNING: don't use this rollup plugin outside of inspector_overlay.
66
// See README for special constraints the overlay has.
77

8-
module.exports = function loadCSS() {
8+
// eslint-disable-next-line import/no-default-export
9+
export default function loadCSS() {
910
return {
1011
name: 'loadCSS',
1112
/**
@@ -20,10 +21,10 @@ module.exports = function loadCSS() {
2021
style.replaceSync(${JSON.stringify(code)});
2122
export default style;
2223
`,
23-
map: null
24+
map: null,
2425
};
2526
}
2627
return;
27-
}
28+
},
2829
};
29-
};
30+
}

test/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ checkout_root = rebase_path("//", target_gen_dir)
3737
build_root = rebase_path(root_build_dir, target_gen_dir)
3838
write_file(
3939
"$target_gen_dir/build.js",
40-
"module.exports = {SOURCE_ROOT: '$source_root', CHECKOUT_ROOT: '$checkout_root', BUILD_ROOT: '$build_root', BUILD_WITH_CHROMIUM: $build_with_chromium};")
40+
"export default {SOURCE_ROOT: '$source_root', CHECKOUT_ROOT: '$checkout_root', BUILD_ROOT: '$build_root', BUILD_WITH_CHROMIUM: $build_with_chromium};")

test/conductor/karma-resultsdb-reporter.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44

55
/* eslint-disable @typescript-eslint/no-explicit-any */
66

7+
// TODO: Fix this as they are extraneous dependencies
8+
// The type that get resolve are wrong, so keep the required
9+
import chalkImport from 'chalk';
10+
// @ts-expect-error
11+
import * as diffImport from 'diff';
12+
713
import * as ResultsDb from './resultsdb.js';
814
import {ScreenshotError} from './screenshot-error.js';
915

10-
const chalk = require('chalk');
11-
const diff = require('diff');
16+
const chalk: any = chalkImport;
17+
const diff: any = diffImport;
1218

1319
type DiffCallback = (line: string) => string;
1420
function*

test/conductor/paths.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
import * as os from 'node:os';
66
import * as path from 'node:path';
77

8-
const build = require('../build.js');
8+
// @ts-expect-error created at test/BUILD.gn
9+
import build from '../build.js';
10+
911
export const SOURCE_ROOT = path.join(__dirname, '..', build.SOURCE_ROOT);
1012
export const CHECKOUT_ROOT = path.join(__dirname, '..', build.CHECKOUT_ROOT);
1113
export const BUILD_ROOT = path.join(__dirname, '..', build.BUILD_ROOT);

0 commit comments

Comments
 (0)