| Index: third_party/WebKit/Source/devtools/scripts/extract_module/extract_module.js
|
| diff --git a/third_party/WebKit/Source/devtools/scripts/extract_module/extract_module.js b/third_party/WebKit/Source/devtools/scripts/extract_module/extract_module.js
|
| index 0bef616fa57c4da07182d3025c9237caf623debf..76934f8358998a949b9aebf6e9f0db5ebad4803f 100644
|
| --- a/third_party/WebKit/Source/devtools/scripts/extract_module/extract_module.js
|
| +++ b/third_party/WebKit/Source/devtools/scripts/extract_module/extract_module.js
|
| @@ -13,68 +13,33 @@ const SPECIAL_CASE_NAMESPACES_PATH = path.resolve(__dirname, '..', 'special_case
|
|
|
| const APPLICATION_DESCRIPTORS = [
|
| 'inspector.json',
|
| + 'toolbox.json',
|
| 'unit_test_runner.json',
|
| + 'formatter_worker.json',
|
| + 'heap_snapshot_worker.json',
|
| + 'utility_shared_worker.json',
|
| ];
|
|
|
| // Replace based on specified transformation
|
| -const MODULES_TO_REMOVE = ['components_lazy', 'ui_lazy'];
|
| +const MODULES_TO_REMOVE = [];
|
|
|
| const JS_FILES_MAPPING = [
|
| - {file: 'components_lazy/CookiesTable.js', new: 'cookie_table'},
|
| - {file: 'ui/BezierEditor.js', new: 'inline_editor'},
|
| - {file: 'ui/BezierUI.js', new: 'inline_editor'},
|
| - {file: 'ui/ColorSwatch.js', new: 'inline_editor'},
|
| - {file: 'ui/CSSShadowEditor.js', new: 'inline_editor'},
|
| - {file: 'ui/SwatchPopoverHelper.js', new: 'inline_editor'},
|
| - {file: 'components/Spectrum.js', new: 'color_picker'},
|
| -
|
| - // Cannot extract dom_ui because of cyclic dependency with components
|
| - // {file: 'components/DOMPresentationUtils.js', new: 'dom_ui'},
|
| - {file: 'components/ExecutionContextSelector.js', existing: 'main'},
|
| - {file: 'components_lazy/FilmStripModel.js', existing: 'sdk'},
|
| - {file: 'components_lazy/FilmStripView.js', existing: 'perf_ui'},
|
| - {file: 'components/ShortcutsScreen.js', existing: 'ui'},
|
| - {file: 'ui_lazy/DataGrid.js', new: 'data_grid'},
|
| - {file: 'ui_lazy/ViewportDataGrid.js', new: 'data_grid'},
|
| - {file: 'ui_lazy/SortableDataGrid.js', new: 'data_grid'},
|
| - {file: 'ui_lazy/ShowMoreDataGridNode.js', new: 'data_grid'},
|
| - {file: 'ui_lazy/ChartViewport.js', existing: 'perf_ui'},
|
| - {file: 'ui_lazy/FlameChart.js', existing: 'perf_ui'},
|
| - {file: 'ui_lazy/OverviewGrid.js', existing: 'perf_ui'},
|
| - {file: 'ui_lazy/PieChart.js', existing: 'perf_ui'},
|
| - {file: 'ui_lazy/TimelineGrid.js', existing: 'perf_ui'},
|
| - {file: 'ui_lazy/TimelineOverviewPane.js', existing: 'perf_ui'},
|
| + {file: 'common/CSSShadowModel.js', existing: 'inline_editor'},
|
| + {file: 'common/Geometry.js', existing: 'ui'},
|
| + // {file: 'module/file.js', existing: 'module'}
|
| ];
|
|
|
| const MODULE_MAPPING = {
|
| - cookie_table: {
|
| - dependencies: ['ui', 'sdk', 'data_grid'],
|
| - dependents: ['resources', 'network'],
|
| - applications: ['inspector.json'],
|
| - autostart: false,
|
| - },
|
| - inline_editor: {
|
| - dependencies: ['ui'],
|
| - dependents: ['sources', 'elements', 'resources'],
|
| - applications: ['inspector.json', 'unit_test_runner.json'],
|
| - autostart: false,
|
| - },
|
| - color_picker: {
|
| - dependencies: ['ui', 'sdk'],
|
| - dependents: ['sources', 'elements'],
|
| - applications: ['inspector.json'],
|
| - autostart: false,
|
| - },
|
| - data_grid: {
|
| - dependencies: ['ui'],
|
| - dependents: ['network', 'profiler', 'resources', 'console', 'timeline'],
|
| - applications: ['inspector.json', 'unit_test_runner.json'],
|
| - autostart: false,
|
| - },
|
| + // heap_snapshot_model: {
|
| + // dependencies: [],
|
| + // dependents: ['heap_snapshot_worker', 'profiler'],
|
| + // applications: ['inspector.json'], // need to manually add to heap snapshot worker b/c it's autostart
|
| + // autostart: false,
|
| + // },
|
| };
|
|
|
| const NEW_DEPENDENCIES_BY_EXISTING_MODULES = {
|
| - resources: ['components'],
|
| + // resources: ['components'],
|
| };
|
|
|
| const REMOVE_DEPENDENCIES_BY_EXISTING_MODULES = {
|
| @@ -112,6 +77,7 @@ function extractModule() {
|
| const cssFilesMapping = findCSSFiles();
|
| const identifiersByFile = calculateIdentifiers();
|
| const identifierMap = mapIdentifiers(identifiersByFile, cssFilesMapping);
|
| + console.log('identifierMap', identifierMap);
|
| const extensionMap = removeFromExistingModuleDescriptors(modules, identifierMap, cssFilesMapping);
|
|
|
| // Find out which files are moving extensions
|
| @@ -201,10 +167,16 @@ function calculateIdentifiers() {
|
| let name = match[1];
|
|
|
| var currentModule = fileObj.file.split('/')[0];
|
| - if (name.split('.')[0] !== mapModuleToNamespace(currentModule))
|
| + if (name.split('.')[0] !== mapModuleToNamespace(currentModule)) {
|
| console.log(`POSSIBLE ISSUE: identifier: ${name} found in ${currentModule}`);
|
| - else
|
| + // one-off
|
| + if (name.includes('UI.')) {
|
| + console.log(`including ${name} anyways`);
|
| + identifiers.push(name)
|
| + }
|
| + } else {
|
| identifiers.push(name);
|
| + }
|
| }
|
| return identifiers;
|
| }
|
| @@ -269,7 +241,7 @@ function updateBuildGNFile(cssFilesMapping, newModuleSet) {
|
| content: newContent,
|
| startLine: 'all_devtools_files = [',
|
| endLine: ']',
|
| - linesToInsert: newSourcesToAdd,
|
| + linesToInsert: newSourcesToAdd.concat([...newModuleSet].map(module => `"front_end/${module}/module.json",`)),
|
| });
|
|
|
| fs.writeFileSync(BUILD_GN_PATH, newContent);
|
| @@ -298,6 +270,8 @@ function updateBuildGNFile(cssFilesMapping, newModuleSet) {
|
| }
|
|
|
| function addContentToLinesInSortedOrder({content, startLine, endLine, linesToInsert}) {
|
| + if (linesToInsert.length === 0)
|
| + return content;
|
| let lines = content.split('\n');
|
| let seenStartLine = false;
|
| let contentStack = linesToInsert.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())).reverse();
|
| @@ -395,15 +369,6 @@ function renameIdentifiers(identifierMap) {
|
| let newIdentifier = identifierMap.get(key);
|
| newContent = newContent.replaceAll(originalIdentifier, newIdentifier);
|
| }
|
| - // one-off
|
| - if (filePath.includes('LayoutTests/http/tests/inspector-unit/filtered-item-selection-dialog-filtering.js'))
|
| - newContent = newContent.replaceAll('ui_lazy', 'quick_open');
|
| - if (filePath.includes('LayoutTests/inspector/components/cookies-table.html'))
|
| - newContent = newContent.replaceAll('components_lazy', 'cookie_table');
|
| - if (filePath.includes('LayoutTests/inspector/components/datagrid-autosize.html'))
|
| - newContent = newContent.replaceAll('ui_lazy', 'data_grid');
|
| - if (filePath.includes('LayoutTests/inspector/components/datagrid-test.js'))
|
| - newContent = newContent.replaceAll('ui_lazy', 'data_grid');
|
|
|
| if (content !== newContent)
|
| fs.writeFileSync(filePath, newContent);
|
| @@ -655,6 +620,8 @@ function addDependenciesToDescriptors() {
|
| function updateApplicationDescriptor(descriptorFileName, newModuleSet) {
|
| let descriptorPath = path.join(FRONTEND_PATH, descriptorFileName);
|
| let newModules = [...newModuleSet].filter(m => APPLICATIONS_BY_MODULE[m].includes(descriptorFileName));
|
| + if (newModules.length === 0)
|
| + return;
|
| let includeNewModules = (acc, line) => {
|
| if (line.includes('{') && line.endsWith('}')) {
|
| line += ',';
|
|
|