chrome-devtools-frontend 1.0.947377 → 1.0.948916
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/config/gni/all_devtools_files.gni +1 -6
- package/config/gni/devtools_grd_files.gni +5 -12
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/.eslintrc.js +1 -0
- package/front_end/Images/src/circled_backslash_icon.svg +3 -0
- package/front_end/core/host/UserMetrics.ts +1 -1
- package/front_end/core/i18n/locales/en-US.json +32 -44
- package/front_end/core/i18n/locales/en-XL.json +32 -44
- package/front_end/core/platform/platform.ts +0 -2
- package/front_end/core/platform/string-utilities.ts +14 -1
- package/front_end/core/platform/utilities.ts +0 -29
- package/front_end/core/root/Runtime.ts +4 -207
- package/front_end/core/sdk/Cookie.ts +0 -21
- package/front_end/core/sdk/RemoteObject.ts +15 -1
- package/front_end/core/sdk/sdk-legacy.ts +0 -3
- package/front_end/entrypoints/devtools_app/{devtools_app-meta-files.ts → devtools_app.ts} +9 -3
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +2 -1
- package/front_end/entrypoints/js_app/{JsMain.ts → js_app.ts} +5 -1
- package/front_end/entrypoints/main/MainImpl.ts +0 -1
- package/front_end/entrypoints/ndb_app/{ndb_app.js → ndb_app.ts} +0 -2
- package/front_end/entrypoints/node_app/node_app.ts +1 -3
- package/front_end/entrypoints/shell/{shell.js → shell.ts} +0 -2
- package/front_end/entrypoints/visibility.gni +3 -1
- package/front_end/entrypoints/worker_app/worker_app.ts +1 -4
- package/front_end/generated/InspectorBackendCommands.js +8 -1
- package/front_end/generated/protocol-mapping.d.ts +4 -0
- package/front_end/generated/protocol-proxy-api.d.ts +6 -0
- package/front_end/generated/protocol.d.ts +9 -0
- package/front_end/legacy/legacy-defs.d.ts +0 -4
- package/front_end/legacy_test_runner/test_runner/TestRunner.js +35 -59
- package/front_end/models/issues_manager/AttributionReportingIssue.ts +27 -2
- package/front_end/models/issues_manager/CorsIssue.ts +15 -15
- package/front_end/models/issues_manager/descriptions/{corsInsecurePrivateNetworkPreflight.md → corsPreflightAllowPrivateNetworkError.md} +1 -1
- package/front_end/panels/accessibility/AccessibilitySidebarView.ts +3 -1
- package/front_end/panels/application/BackForwardCacheStrings.ts +1 -5
- package/front_end/panels/application/BackForwardCacheView.ts +150 -58
- package/front_end/panels/application/ResourcesPanel.ts +0 -42
- package/front_end/panels/application/application-legacy.ts +0 -3
- package/front_end/panels/application/application-meta.ts +0 -13
- package/front_end/panels/application/backForwardCacheView.css +44 -6
- package/front_end/panels/application/components/FrameDetailsView.ts +3 -3
- package/front_end/panels/application/components/OriginTrialTreeView.ts +3 -3
- package/front_end/panels/application/components/StackTrace.ts +1 -1
- package/front_end/panels/console/ConsolePrompt.ts +0 -4
- package/front_end/panels/coverage/CoverageView.ts +1 -1
- package/front_end/panels/css_overview/components/cssOverviewStartView.css +1 -0
- package/front_end/panels/css_overview/cssOverviewCompletedView.css +1 -1
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +2 -1
- package/front_end/panels/elements/AccessibilityTreeUtils.ts +1 -7
- package/front_end/panels/elements/ElementsPanel.ts +9 -1
- package/front_end/panels/elements/ElementsTreeElement.ts +1 -1
- package/front_end/panels/elements/PropertiesWidget.ts +109 -4
- package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +1 -1
- package/front_end/panels/elements/propertiesWidget.css +34 -0
- package/front_end/panels/emulation/DeviceModeToolbar.ts +5 -1
- package/front_end/panels/issues/CorsIssueDetailsView.ts +20 -8
- package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -0
- package/front_end/panels/profiler/CPUProfileFlameChart.ts +3 -1
- package/front_end/panels/profiler/ProfileDataGrid.ts +2 -1
- package/front_end/panels/settings/components/SyncSection.ts +2 -2
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +46 -46
- package/front_end/panels/timeline/TimelineTreeView.ts +2 -1
- package/front_end/ui/components/diff_view/DiffView.ts +4 -4
- package/front_end/ui/components/helpers/component-server-setup.ts +1 -12
- package/front_end/ui/components/helpers/helpers.ts +0 -2
- package/front_end/ui/components/icon_button/IconButton.ts +1 -1
- package/front_end/ui/components/issue_counter/IssueCounter.ts +2 -2
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +3 -3
- package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +98 -0
- package/front_end/ui/components/panel_feedback/panel_feedback.ts +1 -0
- package/front_end/ui/components/panel_feedback/previewToggle.css +24 -0
- package/front_end/ui/components/report_view/ReportView.ts +22 -0
- package/front_end/ui/components/report_view/reportSection.css +20 -0
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -1
- package/front_end/ui/components/settings/SettingCheckbox.ts +2 -2
- package/front_end/ui/components/text_editor/config.ts +4 -3
- package/front_end/ui/components/text_editor/javascript.ts +8 -4
- package/front_end/ui/components/text_prompt/TextPrompt.ts +2 -2
- package/front_end/ui/legacy/GlassPane.ts +1 -1
- package/front_end/ui/legacy/SearchableView.ts +2 -1
- package/front_end/ui/legacy/Treeoutline.ts +1 -1
- package/front_end/ui/legacy/Widget.ts +1 -1
- package/front_end/ui/legacy/XWidget.ts +0 -5
- package/front_end/ui/legacy/components/inline_editor/CSSVarSwatch.ts +2 -2
- package/front_end/ui/legacy/components/inline_editor/ColorSwatch.ts +1 -1
- package/front_end/ui/legacy/utils/append-style.ts +2 -13
- package/front_end/ui/legacy/utils/create-shadow-root-with-core-styles.ts +7 -5
- package/package.json +2 -4
- package/scripts/build/build_inspector_overlay.py +15 -1
- package/scripts/build/rjsmin.py +84 -115
- package/scripts/eslint_rules/lib/ban_a_tags_in_lit_html.js +2 -11
- package/scripts/eslint_rules/lib/ban_literal_devtools_component_tag_names.js +2 -11
- package/scripts/eslint_rules/lib/ban_self_closing_custom_element_tagnames.js +2 -11
- package/scripts/eslint_rules/lib/ban_style_tags_in_lit_html.js +2 -11
- package/scripts/eslint_rules/lib/lit_html_data_as_type.js +2 -11
- package/scripts/eslint_rules/lib/lit_html_no_attribute_quotes.js +89 -0
- package/scripts/eslint_rules/lib/lit_no_style_interpolation.js +2 -11
- package/scripts/eslint_rules/lib/no_only_eslint_tests.js +53 -0
- package/scripts/eslint_rules/lib/static_tag_must_be_static_property.js +2 -11
- package/scripts/eslint_rules/lib/utils.js +29 -0
- package/scripts/eslint_rules/tests/.eslintrc.js +18 -0
- package/scripts/eslint_rules/tests/lit_html_no_attribute_quotes_test.js +45 -0
- package/scripts/eslint_rules/tests/no_only_eslint_tests_test.js +94 -0
- package/scripts/eslint_rules/tests/utils_test.js +40 -0
- package/front_end/entrypoints/devtools_app/devtools_app.js +0 -11
- package/front_end/entrypoints/devtools_app/devtools_app.json +0 -4
- package/front_end/entrypoints/js_app/js_app.js +0 -12
- package/front_end/entrypoints/js_app/js_app.json +0 -3
- package/front_end/entrypoints/ndb_app/ndb_app.json +0 -4
- package/front_end/entrypoints/startup/RuntimeInstantiator.ts +0 -95
- package/front_end/entrypoints/startup/startup.ts +0 -9
- package/front_end/panels/help/HelpImpl.ts +0 -141
- package/front_end/panels/help/ReleaseNoteText.ts +0 -1496
- package/front_end/panels/help/ReleaseNoteView.ts +0 -107
- package/front_end/panels/help/help-meta.ts +0 -145
- package/front_end/panels/help/help.ts +0 -13
- package/front_end/panels/help/releaseNote.css +0 -115
- package/front_end/ui/components/helpers/get-stylesheet.ts +0 -45
- package/scripts/build/build_release_applications.py +0 -216
- package/scripts/build/modular_build.py +0 -184
- package/scripts/check_gn.js +0 -119
- package/scripts/json_validator/module.schema.json +0 -19
- package/scripts/json_validator/validate_module_json.js +0 -44
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env vpython
|
|
2
|
-
#
|
|
3
|
-
# Copyright 2014 The Chromium Authors. All rights reserved.
|
|
4
|
-
# Use of this source code is governed by a BSD-style license that can be
|
|
5
|
-
# found in the LICENSE file.
|
|
6
|
-
"""
|
|
7
|
-
Utilities for the modular DevTools build.
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
from __future__ import print_function
|
|
11
|
-
|
|
12
|
-
import collections
|
|
13
|
-
from os import path
|
|
14
|
-
import os
|
|
15
|
-
|
|
16
|
-
try:
|
|
17
|
-
import simplejson as json
|
|
18
|
-
except ImportError:
|
|
19
|
-
import json
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def read_file(filename):
|
|
23
|
-
with open(path.normpath(filename), 'rt', encoding='utf-8') as input:
|
|
24
|
-
return input.read()
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def write_file(filename, content):
|
|
28
|
-
if path.exists(filename):
|
|
29
|
-
os.remove(filename)
|
|
30
|
-
directory = path.dirname(filename)
|
|
31
|
-
if not path.exists(directory):
|
|
32
|
-
os.makedirs(directory)
|
|
33
|
-
with open(filename, 'wt', encoding='utf-8') as output:
|
|
34
|
-
output.write(content)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def bail_error(message):
|
|
38
|
-
raise Exception(message)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def load_and_parse_json(filename):
|
|
42
|
-
try:
|
|
43
|
-
return json.loads(read_file(filename))
|
|
44
|
-
except:
|
|
45
|
-
print('ERROR: Failed to parse %s' % filename)
|
|
46
|
-
raise
|
|
47
|
-
|
|
48
|
-
class Descriptors:
|
|
49
|
-
|
|
50
|
-
def __init__(self, application_name, application_dir,
|
|
51
|
-
application_descriptor, module_descriptors, extends, worker):
|
|
52
|
-
self.application_name = application_name
|
|
53
|
-
self.application_dir = application_dir
|
|
54
|
-
self.application = application_descriptor
|
|
55
|
-
self._cached_sorted_modules = None
|
|
56
|
-
self.modules = module_descriptors
|
|
57
|
-
self.extends = extends
|
|
58
|
-
self.worker = worker
|
|
59
|
-
|
|
60
|
-
def application_json(self):
|
|
61
|
-
result = dict()
|
|
62
|
-
result['modules'] = list(self.application.values())
|
|
63
|
-
return json.dumps(result)
|
|
64
|
-
|
|
65
|
-
def module_resources(self, name):
|
|
66
|
-
return [name + '/' + resource for resource in self.modules[name].get('resources', [])]
|
|
67
|
-
|
|
68
|
-
def sorted_modules(self):
|
|
69
|
-
if self._cached_sorted_modules:
|
|
70
|
-
return self._cached_sorted_modules
|
|
71
|
-
|
|
72
|
-
result = []
|
|
73
|
-
|
|
74
|
-
# Use dict instead of set for deterministic iteration order.
|
|
75
|
-
unvisited_modules = {module: None for module in self.modules}
|
|
76
|
-
|
|
77
|
-
temp_modules = set()
|
|
78
|
-
|
|
79
|
-
def visit(parent, name):
|
|
80
|
-
if name not in unvisited_modules:
|
|
81
|
-
return None
|
|
82
|
-
if name not in self.modules:
|
|
83
|
-
return (parent, name)
|
|
84
|
-
if name in temp_modules:
|
|
85
|
-
bail_error('Dependency cycle found at module "%s"' % name)
|
|
86
|
-
temp_modules.add(name)
|
|
87
|
-
deps = self.modules[name].get('dependencies')
|
|
88
|
-
if deps:
|
|
89
|
-
for dep_name in deps:
|
|
90
|
-
bad_dep = visit(name, dep_name)
|
|
91
|
-
if bad_dep:
|
|
92
|
-
return bad_dep
|
|
93
|
-
del unvisited_modules[name]
|
|
94
|
-
temp_modules.remove(name)
|
|
95
|
-
result.append(name)
|
|
96
|
-
return None
|
|
97
|
-
|
|
98
|
-
while len(unvisited_modules):
|
|
99
|
-
for next in unvisited_modules:
|
|
100
|
-
break
|
|
101
|
-
failure = visit(None, next)
|
|
102
|
-
if failure:
|
|
103
|
-
# failure[0] can never be None
|
|
104
|
-
bail_error('Unknown module "%s" encountered in dependencies of "%s"' % (failure[1], failure[0]))
|
|
105
|
-
|
|
106
|
-
self._cached_sorted_modules = result
|
|
107
|
-
return result
|
|
108
|
-
|
|
109
|
-
def sorted_dependencies_closure(self, module_name):
|
|
110
|
-
visited = set()
|
|
111
|
-
|
|
112
|
-
def sorted_deps_for_module(name):
|
|
113
|
-
result = []
|
|
114
|
-
desc = self.modules[name]
|
|
115
|
-
deps = desc.get('dependencies', [])
|
|
116
|
-
for dep in deps:
|
|
117
|
-
result += sorted_deps_for_module(dep)
|
|
118
|
-
if name not in visited:
|
|
119
|
-
result.append(name)
|
|
120
|
-
visited.add(name)
|
|
121
|
-
return result
|
|
122
|
-
|
|
123
|
-
return sorted_deps_for_module(module_name)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
class DescriptorLoader:
|
|
127
|
-
|
|
128
|
-
def __init__(self, application_dir):
|
|
129
|
-
self.application_dir = application_dir
|
|
130
|
-
|
|
131
|
-
def load_application(self, application_descriptor_name):
|
|
132
|
-
all_module_descriptors = {}
|
|
133
|
-
result = self._load_application(application_descriptor_name, all_module_descriptors)
|
|
134
|
-
return result
|
|
135
|
-
|
|
136
|
-
def load_applications(self, application_descriptor_names):
|
|
137
|
-
all_module_descriptors = {}
|
|
138
|
-
all_application_descriptors = {}
|
|
139
|
-
for application_descriptor_name in application_descriptor_names:
|
|
140
|
-
descriptors = {}
|
|
141
|
-
result = self._load_application(application_descriptor_name, descriptors)
|
|
142
|
-
for name in descriptors:
|
|
143
|
-
all_module_descriptors[name] = descriptors[name]
|
|
144
|
-
for name in result.application:
|
|
145
|
-
all_application_descriptors[name] = result.application[name]
|
|
146
|
-
return Descriptors('all', self.application_dir,
|
|
147
|
-
all_application_descriptors, all_module_descriptors,
|
|
148
|
-
None, False)
|
|
149
|
-
|
|
150
|
-
def _load_application(self, application_descriptor_name, all_module_descriptors):
|
|
151
|
-
module_descriptors = {}
|
|
152
|
-
application_descriptor_filename = path.join(
|
|
153
|
-
self.application_dir, 'entrypoints', application_descriptor_name,
|
|
154
|
-
application_descriptor_name + '.json')
|
|
155
|
-
descriptor_json = load_and_parse_json(application_descriptor_filename)
|
|
156
|
-
application_descriptor = {desc['name']: desc for desc in descriptor_json['modules']}
|
|
157
|
-
extends = descriptor_json['extends'] if 'extends' in descriptor_json else None
|
|
158
|
-
if extends:
|
|
159
|
-
extends = self._load_application(extends, all_module_descriptors)
|
|
160
|
-
worker = True if 'worker' in descriptor_json and descriptor_json['worker'] else False
|
|
161
|
-
|
|
162
|
-
for (module_name, module) in application_descriptor.items():
|
|
163
|
-
if all_module_descriptors.get(module_name):
|
|
164
|
-
bail_error('Duplicate definition of module "%s" in %s' % (module_name, application_descriptor_filename))
|
|
165
|
-
module_descriptors[module_name] = self._read_module_descriptor(module_name, application_descriptor_filename)
|
|
166
|
-
all_module_descriptors[module_name] = module_descriptors[module_name]
|
|
167
|
-
|
|
168
|
-
for module in module_descriptors.values():
|
|
169
|
-
for dep in module.get('dependencies', []):
|
|
170
|
-
if dep not in all_module_descriptors:
|
|
171
|
-
bail_error('Module "%s" (dependency of "%s") not listed in application descriptor %s' %
|
|
172
|
-
(dep, module['name'], application_descriptor_filename))
|
|
173
|
-
|
|
174
|
-
return Descriptors(application_descriptor_name, self.application_dir,
|
|
175
|
-
application_descriptor, module_descriptors, extends,
|
|
176
|
-
worker)
|
|
177
|
-
|
|
178
|
-
def _read_module_descriptor(self, module_name, application_descriptor_filename):
|
|
179
|
-
json_filename = path.join(self.application_dir, module_name, 'module.json')
|
|
180
|
-
if not path.exists(json_filename):
|
|
181
|
-
bail_error('Module descriptor %s referenced in %s is missing' % (json_filename, application_descriptor_filename))
|
|
182
|
-
module_json = load_and_parse_json(json_filename)
|
|
183
|
-
module_json['name'] = module_name
|
|
184
|
-
return module_json
|
package/scripts/check_gn.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
// Copyright 2017 The Chromium Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
|
|
9
|
-
const FRONTEND_PATH = path.resolve(__dirname, '..', 'front_end');
|
|
10
|
-
|
|
11
|
-
const manifestModules = [];
|
|
12
|
-
for (const config of ['devtools_app', 'js_app']) {
|
|
13
|
-
manifestModules.push(...require(path.resolve(FRONTEND_PATH, 'entrypoints', config, `${config}.json`)).modules);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const gnPath = path.resolve(__dirname, '..', 'BUILD.gn');
|
|
17
|
-
const gnFile = fs.readFileSync(gnPath, 'utf-8');
|
|
18
|
-
const gnLines = gnFile.split('\n');
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Ensures that all source files (according to the various module.json files) are
|
|
22
|
-
* listed in BUILD.gn.
|
|
23
|
-
*/
|
|
24
|
-
function checkAllDevToolsFiles() {
|
|
25
|
-
return checkGNVariable('all_devtools_files', 'all_devtools_files', moduleJSON => {
|
|
26
|
-
const resources = moduleJSON.resources || [];
|
|
27
|
-
return [
|
|
28
|
-
'module.json',
|
|
29
|
-
...resources,
|
|
30
|
-
];
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function checkGNVariable(fileName, gnVariable, obtainFiles, obtainRelativePath) {
|
|
35
|
-
const filePath = path.resolve(__dirname, '..', 'config', 'gni', `${fileName}.gni`);
|
|
36
|
-
const fileContent = fs.readFileSync(filePath, 'utf-8');
|
|
37
|
-
const linesToCheck = fileContent.split('\n');
|
|
38
|
-
|
|
39
|
-
const errors = [];
|
|
40
|
-
const excludedFiles =
|
|
41
|
-
['axe.js', 'entrypoints/formatter_worker/', 'third_party/lighthouse/', 'third_party/i18n/'].map(path.normalize);
|
|
42
|
-
const lines = selectGNLines(`${gnVariable} = [`, ']', linesToCheck).map(path.normalize);
|
|
43
|
-
if (!lines.length) {
|
|
44
|
-
return [
|
|
45
|
-
`Could not identify ${gnVariable} list in gn file`,
|
|
46
|
-
'Please look at: ' + __filename,
|
|
47
|
-
];
|
|
48
|
-
}
|
|
49
|
-
const gnFiles = new Set(lines);
|
|
50
|
-
let moduleFiles = [];
|
|
51
|
-
|
|
52
|
-
function addModuleFilesForDirectory(moduleJSONPath, buildGNPath, folderName) {
|
|
53
|
-
const moduleJSON = require(moduleJSONPath);
|
|
54
|
-
const files = obtainFiles(moduleJSON, folderName)
|
|
55
|
-
.map(obtainRelativePath && obtainRelativePath(buildGNPath) || relativePathFromBuildGN)
|
|
56
|
-
.filter(file => excludedFiles.every(excludedFile => !file.includes(excludedFile)));
|
|
57
|
-
moduleFiles = moduleFiles.concat(files);
|
|
58
|
-
|
|
59
|
-
function relativePathFromBuildGN(filename) {
|
|
60
|
-
const relativePath = path.normalize(`front_end/${buildGNPath}/${filename}`);
|
|
61
|
-
return `"${relativePath}",`;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function traverseDirectoriesForModuleJSONFiles(folderName, buildGNPath) {
|
|
66
|
-
if (!fs.lstatSync(folderName).isDirectory()) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const moduleJSONPath = path.join(folderName, 'module.json');
|
|
70
|
-
if (fs.existsSync(moduleJSONPath)) {
|
|
71
|
-
addModuleFilesForDirectory(moduleJSONPath, buildGNPath, path.basename(folderName));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
fs.readdirSync(folderName).forEach(nestedModuleName => {
|
|
75
|
-
traverseDirectoriesForModuleJSONFiles(
|
|
76
|
-
path.join(folderName, nestedModuleName), `${buildGNPath}/${nestedModuleName}`);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
fs.readdirSync(FRONTEND_PATH).forEach(moduleName => {
|
|
81
|
-
traverseDirectoriesForModuleJSONFiles(path.join(FRONTEND_PATH, moduleName), moduleName);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
for (const file of moduleFiles) {
|
|
85
|
-
if (!gnFiles.has(file)) {
|
|
86
|
-
errors.push(`Missing file in BUILD.gn for ${gnVariable}: ` + file);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return errors;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function selectGNLines(startLine, endLine, linesToCheck = gnLines) {
|
|
94
|
-
const lines = linesToCheck.map(line => line.trim());
|
|
95
|
-
const startIndex = lines.indexOf(startLine);
|
|
96
|
-
if (startIndex === -1) {
|
|
97
|
-
return [];
|
|
98
|
-
}
|
|
99
|
-
const endIndex = lines.indexOf(endLine, startIndex);
|
|
100
|
-
if (endIndex === -1) {
|
|
101
|
-
return [];
|
|
102
|
-
}
|
|
103
|
-
return lines.slice(startIndex + 1, endIndex);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function main() {
|
|
107
|
-
const errors = [
|
|
108
|
-
...checkAllDevToolsFiles(),
|
|
109
|
-
];
|
|
110
|
-
if (errors.length) {
|
|
111
|
-
console.log('DevTools BUILD.gn checker detected errors!');
|
|
112
|
-
console.log(`There's an issue with: ${gnPath}`);
|
|
113
|
-
console.log(errors.join('\n'));
|
|
114
|
-
process.exit(1);
|
|
115
|
-
}
|
|
116
|
-
console.log('DevTools BUILD.gn checker passed');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
main();
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
3
|
-
"type": "object",
|
|
4
|
-
"additionalProperties": false,
|
|
5
|
-
"properties": {
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"type": "array",
|
|
8
|
-
"items": {
|
|
9
|
-
"type": "string"
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"resources": {
|
|
13
|
-
"type": "array",
|
|
14
|
-
"items": {
|
|
15
|
-
"type": "string"
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// Copyright 2020 The Chromium Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
const fs = require('fs');
|
|
6
|
-
const path = require('path');
|
|
7
|
-
|
|
8
|
-
const FRONTEND_PATH = path.resolve(__dirname, '..', '..', 'front_end');
|
|
9
|
-
|
|
10
|
-
const modules = [];
|
|
11
|
-
for (const dir of fs.readdirSync(FRONTEND_PATH)) {
|
|
12
|
-
if (!fs.lstatSync(path.resolve(FRONTEND_PATH, dir)).isDirectory()) {
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
if (fs.existsSync(path.resolve(FRONTEND_PATH, dir, 'module.json'))) {
|
|
16
|
-
modules.push(dir);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const Ajv = require('ajv');
|
|
21
|
-
const ajv = new Ajv({schemaId: 'id'});
|
|
22
|
-
// This seems to be the most widely supported version of the schema.
|
|
23
|
-
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
|
|
24
|
-
|
|
25
|
-
const schema = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'module.schema.json')));
|
|
26
|
-
const validate = ajv.compile(schema);
|
|
27
|
-
|
|
28
|
-
let totalErrors = 0;
|
|
29
|
-
for (const module of modules) {
|
|
30
|
-
const moduleObject = JSON.parse(fs.readFileSync(path.resolve(FRONTEND_PATH, module, 'module.json')));
|
|
31
|
-
const valid = validate(moduleObject);
|
|
32
|
-
if (!valid) {
|
|
33
|
-
console.log('Issue with ./front_end/' + module + '/module.json:');
|
|
34
|
-
totalErrors++;
|
|
35
|
-
validate.errors.sort((a, b) => b.dataPath.length - a.dataPath.length);
|
|
36
|
-
const error = validate.errors[0];
|
|
37
|
-
console.log(' ', error.dataPath, error.message, error.params);
|
|
38
|
-
console.log('');
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (totalErrors) {
|
|
42
|
-
console.log('module.json errors:', totalErrors);
|
|
43
|
-
}
|
|
44
|
-
process.exit(totalErrors);
|