chrome-devtools-frontend 1.0.945884 → 1.0.948295

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.
Files changed (259) hide show
  1. package/.eslintrc.js +1 -0
  2. package/config/gni/all_devtools_files.gni +1 -20
  3. package/config/gni/devtools_grd_files.gni +9 -48
  4. package/config/gni/devtools_image_files.gni +1 -0
  5. package/front_end/.eslintrc.js +6 -1
  6. package/front_end/Images/src/circled_backslash_icon.svg +3 -0
  7. package/front_end/core/host/InspectorFrontendHost.ts +0 -3
  8. package/front_end/core/host/InspectorFrontendHostAPI.ts +0 -1
  9. package/front_end/core/host/UserMetrics.ts +1 -23
  10. package/front_end/core/i18n/locales/en-US.json +41 -41
  11. package/front_end/core/i18n/locales/en-XL.json +41 -41
  12. package/front_end/core/platform/platform.ts +0 -2
  13. package/front_end/core/platform/string-utilities.ts +14 -1
  14. package/front_end/core/platform/utilities.ts +0 -29
  15. package/front_end/core/root/Runtime.ts +4 -212
  16. package/front_end/core/sdk/AccessibilityModel.ts +0 -2
  17. package/front_end/core/sdk/CSSProperty.ts +16 -11
  18. package/front_end/core/sdk/CSSRule.ts +0 -2
  19. package/front_end/core/sdk/Cookie.ts +0 -25
  20. package/front_end/core/sdk/EmulationModel.ts +0 -2
  21. package/front_end/core/sdk/HeapProfilerModel.ts +0 -2
  22. package/front_end/core/sdk/NetworkManager.ts +0 -3
  23. package/front_end/core/sdk/Resource.ts +0 -3
  24. package/front_end/core/sdk/ResourceTreeModel.ts +0 -3
  25. package/front_end/core/sdk/ServiceWorkerManager.ts +0 -2
  26. package/front_end/core/sdk/sdk-legacy.ts +0 -3
  27. package/front_end/devtools_compatibility.js +1 -8
  28. package/front_end/entrypoints/devtools_app/{devtools_app-meta-files.ts → devtools_app.ts} +9 -2
  29. package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +1 -3
  30. package/front_end/entrypoints/formatter_worker/FormatterActions.ts +0 -2
  31. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +0 -120
  32. package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +1 -11
  33. package/front_end/entrypoints/formatter_worker/formatter_worker.ts +5 -0
  34. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +2 -1
  35. package/front_end/entrypoints/inspector/{inspector.js → inspector.ts} +0 -3
  36. package/front_end/entrypoints/js_app/{JsMain.ts → js_app.ts} +5 -1
  37. package/front_end/entrypoints/main/MainImpl.ts +0 -7
  38. package/front_end/entrypoints/ndb_app/{ndb_app.js → ndb_app.ts} +3 -2
  39. package/front_end/entrypoints/{node_main → node_app}/NodeConnectionsPanel.ts +1 -1
  40. package/front_end/entrypoints/{node_main → node_app}/NodeMain.ts +2 -4
  41. package/front_end/entrypoints/{node_main → node_app}/nodeConnectionsPanel.css +0 -0
  42. package/front_end/entrypoints/node_app/node_app.ts +79 -0
  43. package/front_end/entrypoints/shell/{shell-meta-files.ts → shell.ts} +7 -1
  44. package/front_end/entrypoints/worker_app/{worker_app.js → worker_app.ts} +6 -2
  45. package/front_end/generated/InspectorBackendCommands.js +5 -1
  46. package/front_end/generated/protocol.d.ts +12 -0
  47. package/front_end/legacy/legacy-defs.d.ts +0 -4
  48. package/front_end/legacy_test_runner/sources_test_runner/sources_test_runner.js +0 -1
  49. package/front_end/legacy_test_runner/test_runner/TestRunner.js +35 -59
  50. package/front_end/models/bindings/CompilerScriptMapping.ts +0 -1
  51. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +4 -11
  52. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +1 -1
  53. package/front_end/models/bindings/ResourceMapping.ts +1 -1
  54. package/front_end/models/bindings/SASSSourceMapping.ts +0 -1
  55. package/front_end/models/emulation/DeviceModeModel.ts +0 -2
  56. package/front_end/models/formatter/FormatterWorkerPool.ts +0 -18
  57. package/front_end/models/issues_manager/CorsIssue.ts +17 -9
  58. package/front_end/models/issues_manager/descriptions/{corsInsecurePrivateNetworkPreflight.md → corsPreflightAllowPrivateNetworkError.md} +1 -1
  59. package/front_end/models/text_utils/CodeMirrorUtils.ts +6 -51
  60. package/front_end/models/text_utils/TextUtils.ts +1 -2
  61. package/front_end/models/text_utils/text_utils-legacy.ts +0 -5
  62. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +3 -1
  63. package/front_end/panels/animation/AnimationTimeline.ts +0 -2
  64. package/front_end/panels/animation/AnimationUI.ts +0 -2
  65. package/front_end/panels/application/ApplicationPanelSidebar.ts +2 -4
  66. package/front_end/panels/application/BackForwardCacheStrings.ts +2 -5
  67. package/front_end/panels/application/BackForwardCacheView.ts +150 -58
  68. package/front_end/panels/application/ResourcesPanel.ts +0 -42
  69. package/front_end/panels/application/application-legacy.ts +0 -3
  70. package/front_end/panels/application/application-meta.ts +0 -13
  71. package/front_end/panels/application/backForwardCacheView.css +44 -6
  72. package/front_end/panels/application/components/FrameDetailsView.ts +3 -3
  73. package/front_end/panels/application/components/OriginTrialTreeView.ts +3 -3
  74. package/front_end/panels/application/components/StackTrace.ts +1 -1
  75. package/front_end/panels/coverage/CoverageView.ts +1 -1
  76. package/front_end/panels/css_overview/CSSOverviewModel.ts +0 -2
  77. package/front_end/panels/css_overview/CSSOverviewPanel.ts +0 -7
  78. package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +0 -2
  79. package/front_end/panels/css_overview/components/cssOverviewStartView.css +1 -0
  80. package/front_end/panels/css_overview/cssOverviewCompletedView.css +1 -1
  81. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +2 -1
  82. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +0 -11
  83. package/front_end/panels/elements/ElementsPanel.ts +9 -1
  84. package/front_end/panels/elements/ElementsTreeElement.ts +1 -1
  85. package/front_end/panels/elements/StylesSidebarPane.ts +0 -1
  86. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +1 -1
  87. package/front_end/panels/elements/elementsTreeOutline.css +0 -13
  88. package/front_end/panels/emulation/DeviceModeToolbar.ts +0 -16
  89. package/front_end/panels/issues/CorsIssueDetailsView.ts +18 -2
  90. package/front_end/panels/lighthouse/lighthouse-meta.ts +0 -3
  91. package/front_end/panels/network/NetworkConfigView.ts +10 -0
  92. package/front_end/panels/network/NetworkItemView.ts +3 -0
  93. package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -0
  94. package/front_end/panels/network/networkConfigView.css +5 -0
  95. package/front_end/panels/profiler/CPUProfileFlameChart.ts +3 -1
  96. package/front_end/panels/profiler/ProfileDataGrid.ts +2 -1
  97. package/front_end/panels/profiler/profilesPanel.css +1 -1
  98. package/front_end/panels/search/SearchView.ts +24 -4
  99. package/front_end/panels/settings/components/SyncSection.ts +2 -2
  100. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +52 -50
  101. package/front_end/panels/settings/emulation/components/userAgentClientHintsForm.css +0 -12
  102. package/front_end/panels/sources/CSSPlugin.ts +3 -0
  103. package/front_end/panels/sources/CoveragePlugin.ts +2 -0
  104. package/front_end/panels/sources/DebuggerPlugin.ts +35 -7
  105. package/front_end/panels/sources/JavaScriptCompilerPlugin.ts +3 -0
  106. package/front_end/panels/sources/ProfilePlugin.ts +3 -0
  107. package/front_end/panels/sources/UISourceCodeFrame.ts +11 -2
  108. package/front_end/panels/sources/sourcesView.css +0 -130
  109. package/front_end/panels/timeline/TimelineTreeView.ts +3 -1
  110. package/front_end/third_party/codemirror/codemirror-tsconfig.json +1 -25
  111. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  112. package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -2
  113. package/front_end/third_party/codemirror.next/chunk/java.js +1 -2
  114. package/front_end/third_party/codemirror.next/chunk/json.js +1 -2
  115. package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -2
  116. package/front_end/third_party/codemirror.next/chunk/php.js +1 -2
  117. package/front_end/third_party/codemirror.next/chunk/python.js +1 -2
  118. package/front_end/third_party/codemirror.next/chunk/wast.js +1 -2
  119. package/front_end/third_party/codemirror.next/chunk/xml.js +1 -2
  120. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +1486 -1423
  121. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -2
  122. package/front_end/third_party/codemirror.next/package.json +10 -9
  123. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +168 -164
  124. package/front_end/third_party/lighthouse/locales/ar-XB.json +0 -3
  125. package/front_end/third_party/lighthouse/locales/ar.json +0 -3
  126. package/front_end/third_party/lighthouse/locales/bg.json +17 -20
  127. package/front_end/third_party/lighthouse/locales/ca.json +0 -3
  128. package/front_end/third_party/lighthouse/locales/cs.json +0 -3
  129. package/front_end/third_party/lighthouse/locales/da.json +16 -19
  130. package/front_end/third_party/lighthouse/locales/de.json +0 -3
  131. package/front_end/third_party/lighthouse/locales/el.json +0 -3
  132. package/front_end/third_party/lighthouse/locales/en-GB.json +19 -22
  133. package/front_end/third_party/lighthouse/locales/en-US.json +33 -3
  134. package/front_end/third_party/lighthouse/locales/en-XA.json +0 -3
  135. package/front_end/third_party/lighthouse/locales/en-XL.json +33 -3
  136. package/front_end/third_party/lighthouse/locales/es-419.json +17 -20
  137. package/front_end/third_party/lighthouse/locales/es.json +0 -3
  138. package/front_end/third_party/lighthouse/locales/fi.json +16 -19
  139. package/front_end/third_party/lighthouse/locales/fil.json +33 -36
  140. package/front_end/third_party/lighthouse/locales/fr.json +16 -19
  141. package/front_end/third_party/lighthouse/locales/he.json +16 -19
  142. package/front_end/third_party/lighthouse/locales/hi.json +0 -3
  143. package/front_end/third_party/lighthouse/locales/hr.json +16 -19
  144. package/front_end/third_party/lighthouse/locales/hu.json +16 -19
  145. package/front_end/third_party/lighthouse/locales/id.json +16 -19
  146. package/front_end/third_party/lighthouse/locales/it.json +37 -40
  147. package/front_end/third_party/lighthouse/locales/ja.json +16 -19
  148. package/front_end/third_party/lighthouse/locales/ko.json +16 -19
  149. package/front_end/third_party/lighthouse/locales/lt.json +17 -20
  150. package/front_end/third_party/lighthouse/locales/lv.json +0 -3
  151. package/front_end/third_party/lighthouse/locales/nl.json +16 -19
  152. package/front_end/third_party/lighthouse/locales/no.json +17 -20
  153. package/front_end/third_party/lighthouse/locales/pl.json +16 -19
  154. package/front_end/third_party/lighthouse/locales/pt-PT.json +37 -40
  155. package/front_end/third_party/lighthouse/locales/pt.json +16 -19
  156. package/front_end/third_party/lighthouse/locales/ro.json +0 -3
  157. package/front_end/third_party/lighthouse/locales/ru.json +16 -19
  158. package/front_end/third_party/lighthouse/locales/sk.json +0 -3
  159. package/front_end/third_party/lighthouse/locales/sl.json +0 -3
  160. package/front_end/third_party/lighthouse/locales/sr-Latn.json +16 -19
  161. package/front_end/third_party/lighthouse/locales/sr.json +16 -19
  162. package/front_end/third_party/lighthouse/locales/sv.json +17 -20
  163. package/front_end/third_party/lighthouse/locales/ta.json +0 -3
  164. package/front_end/third_party/lighthouse/locales/te.json +0 -3
  165. package/front_end/third_party/lighthouse/locales/th.json +0 -3
  166. package/front_end/third_party/lighthouse/locales/tr.json +0 -3
  167. package/front_end/third_party/lighthouse/locales/uk.json +17 -20
  168. package/front_end/third_party/lighthouse/locales/vi.json +0 -3
  169. package/front_end/third_party/lighthouse/locales/zh-HK.json +0 -3
  170. package/front_end/third_party/lighthouse/locales/zh-TW.json +0 -3
  171. package/front_end/third_party/lighthouse/locales/zh.json +0 -3
  172. package/front_end/third_party/lighthouse/report/bundle.d.ts +63 -61
  173. package/front_end/third_party/lighthouse/report/bundle.js +36 -7
  174. package/front_end/third_party/lighthouse/report-assets/report-generator.js +205 -192
  175. package/front_end/ui/components/diff_view/DiffView.ts +4 -4
  176. package/front_end/ui/components/helpers/component-server-setup.ts +1 -12
  177. package/front_end/ui/components/helpers/helpers.ts +0 -2
  178. package/front_end/ui/components/icon_button/IconButton.ts +1 -1
  179. package/front_end/ui/components/issue_counter/IssueCounter.ts +2 -2
  180. package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +3 -3
  181. package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
  182. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +98 -0
  183. package/front_end/ui/components/panel_feedback/panel_feedback.ts +1 -0
  184. package/front_end/ui/components/panel_feedback/previewToggle.css +24 -0
  185. package/front_end/ui/components/report_view/ReportView.ts +22 -0
  186. package/front_end/ui/components/report_view/reportSection.css +20 -0
  187. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -1
  188. package/front_end/ui/components/settings/SettingCheckbox.ts +2 -2
  189. package/front_end/ui/components/text_editor/config.ts +11 -9
  190. package/front_end/ui/components/text_editor/javascript.ts +34 -12
  191. package/front_end/ui/components/text_editor/theme.ts +1 -0
  192. package/front_end/ui/components/text_prompt/TextPrompt.ts +2 -2
  193. package/front_end/ui/legacy/GlassPane.ts +1 -1
  194. package/front_end/ui/legacy/InspectorView.ts +10 -0
  195. package/front_end/ui/legacy/SearchableView.ts +2 -1
  196. package/front_end/ui/legacy/Treeoutline.ts +1 -1
  197. package/front_end/ui/legacy/Widget.ts +1 -1
  198. package/front_end/ui/legacy/XWidget.ts +0 -5
  199. package/front_end/ui/legacy/components/inline_editor/CSSVarSwatch.ts +2 -2
  200. package/front_end/ui/legacy/components/inline_editor/ColorSwatch.ts +1 -1
  201. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -3
  202. package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +0 -1
  203. package/front_end/ui/legacy/components/object_ui/object_ui-legacy.ts +0 -8
  204. package/front_end/ui/legacy/components/object_ui/object_ui.ts +0 -4
  205. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +40 -29
  206. package/front_end/ui/legacy/inspectorSyntaxHighlight.css +0 -211
  207. package/front_end/ui/legacy/legacy-legacy.ts +0 -6
  208. package/front_end/ui/legacy/legacy.ts +0 -2
  209. package/front_end/ui/legacy/tabbedPane.css +1 -1
  210. package/front_end/ui/legacy/themeColors.css +1 -1
  211. package/front_end/ui/legacy/utils/append-style.ts +2 -13
  212. package/front_end/ui/legacy/utils/create-shadow-root-with-core-styles.ts +7 -5
  213. package/package.json +2 -4
  214. package/scripts/build/build_inspector_overlay.py +15 -1
  215. package/scripts/build/rjsmin.py +84 -115
  216. package/scripts/eslint_rules/lib/l10n_filename_matches.js +4 -4
  217. package/scripts/eslint_rules/lib/lit_html_no_attribute_quotes.js +101 -0
  218. package/scripts/eslint_rules/lib/no_only_eslint_tests.js +53 -0
  219. package/scripts/eslint_rules/tests/.eslintrc.js +14 -0
  220. package/scripts/eslint_rules/tests/l10n_filename_matches_test.js +4 -0
  221. package/scripts/eslint_rules/tests/lit_html_no_attribute_quotes_test.js +45 -0
  222. package/scripts/eslint_rules/tests/no_only_eslint_tests_test.js +94 -0
  223. package/scripts/hosted_mode/server.js +17 -2
  224. package/front_end/entrypoints/devtools_app/devtools_app.js +0 -8
  225. package/front_end/entrypoints/devtools_app/devtools_app.json +0 -6
  226. package/front_end/entrypoints/inspector/inspector.json +0 -4
  227. package/front_end/entrypoints/js_app/js_app.js +0 -9
  228. package/front_end/entrypoints/js_app/js_app.json +0 -4
  229. package/front_end/entrypoints/ndb_app/ndb_app.json +0 -5
  230. package/front_end/entrypoints/node_app/node_app-meta.ts +0 -43
  231. package/front_end/entrypoints/node_app/node_app.js +0 -13
  232. package/front_end/entrypoints/node_app/node_app.json +0 -4
  233. package/front_end/entrypoints/node_main/node_main-meta.ts +0 -48
  234. package/front_end/entrypoints/node_main/node_main.ts +0 -11
  235. package/front_end/entrypoints/shell/shell.js +0 -13
  236. package/front_end/entrypoints/shell/shell.json +0 -5
  237. package/front_end/entrypoints/startup/RuntimeInstantiator.ts +0 -95
  238. package/front_end/entrypoints/startup/startup.ts +0 -9
  239. package/front_end/entrypoints/worker_app/worker_app.json +0 -4
  240. package/front_end/panels/lighthouse/module.json +0 -6
  241. package/front_end/third_party/lighthouse/report-assets/report.d.ts +0 -1
  242. package/front_end/third_party/lighthouse/report-assets/report.js +0 -233
  243. package/front_end/third_party/lighthouse/report-assets/standalone-template.html +0 -38
  244. package/front_end/ui/components/helpers/get-stylesheet.ts +0 -45
  245. package/front_end/ui/legacy/TextEditor.ts +0 -82
  246. package/front_end/ui/legacy/components/object_ui/JavaScriptAutocomplete.ts +0 -836
  247. package/front_end/ui/legacy/components/text_editor/CodeMirrorTextEditor.ts +0 -1676
  248. package/front_end/ui/legacy/components/text_editor/TextEditorAutocompleteController.ts +0 -586
  249. package/front_end/ui/legacy/components/text_editor/autocompleteTooltip.css +0 -20
  250. package/front_end/ui/legacy/components/text_editor/cm_modes.ts +0 -23
  251. package/front_end/ui/legacy/components/text_editor/cmdevtools.css +0 -995
  252. package/front_end/ui/legacy/components/text_editor/module.json +0 -7
  253. package/front_end/ui/legacy/components/text_editor/text_editor-legacy.ts +0 -33
  254. package/front_end/ui/legacy/components/text_editor/text_editor.ts +0 -13
  255. package/scripts/build/build_release_applications.py +0 -216
  256. package/scripts/build/modular_build.py +0 -184
  257. package/scripts/check_gn.js +0 -119
  258. package/scripts/json_validator/module.schema.json +0 -19
  259. package/scripts/json_validator/validate_module_json.js +0 -44
@@ -1,7 +0,0 @@
1
- {
2
- "resources": [
3
- "../../../../third_party/codemirror/codemirror.css",
4
- "autocompleteTooltip.css",
5
- "cmdevtools.css"
6
- ]
7
- }
@@ -1,33 +0,0 @@
1
- // Copyright 2019 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
- // @ts-nocheck
6
-
7
- import * as TextEditorModule from './text_editor.js';
8
-
9
- self.TextEditor = self.TextEditor || {};
10
- TextEditor = TextEditor || {};
11
-
12
- /** @constructor */
13
- TextEditor.CodeMirrorTextEditor = TextEditorModule.CodeMirrorTextEditor.CodeMirrorTextEditor;
14
-
15
- /** @constructor */
16
- TextEditor.CodeMirrorTextEditor.SelectNextOccurrenceController =
17
- TextEditorModule.CodeMirrorTextEditor.SelectNextOccurrenceController;
18
-
19
- /** @interface */
20
- TextEditor.TextEditorPositionHandle = TextEditorModule.CodeMirrorTextEditor.TextEditorPositionHandle;
21
-
22
- /** @constructor */
23
- TextEditor.CodeMirrorPositionHandle = TextEditorModule.CodeMirrorTextEditor.CodeMirrorPositionHandle;
24
-
25
- /** @constructor */
26
- TextEditor.TextEditorBookMark = TextEditorModule.CodeMirrorTextEditor.TextEditorBookMark;
27
-
28
- /** @constructor */
29
- TextEditor.CodeMirrorTextEditorFactory = TextEditorModule.CodeMirrorTextEditor.CodeMirrorTextEditorFactory;
30
-
31
- /** @constructor */
32
- TextEditor.TextEditorAutocompleteController =
33
- TextEditorModule.TextEditorAutocompleteController.TextEditorAutocompleteController;
@@ -1,13 +0,0 @@
1
- // Copyright 2019 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
- import './cm_modes.js';
6
-
7
- import * as CodeMirrorTextEditor from './CodeMirrorTextEditor.js';
8
- import * as TextEditorAutocompleteController from './TextEditorAutocompleteController.js';
9
-
10
- export {
11
- CodeMirrorTextEditor,
12
- TextEditorAutocompleteController,
13
- };
@@ -1,216 +0,0 @@
1
- #!/usr/bin/env vpython
2
- # -*- coding: utf-8 -*-
3
- #
4
- # Copyright 2016 The Chromium Authors. All rights reserved.
5
- # Use of this source code is governed by a BSD-style license that can be
6
- # found in the LICENSE file.
7
- """
8
- Builds applications in release mode:
9
- - Concatenates autostart modules, application modules' module.json descriptors,
10
- and the application loader into a single script.
11
- """
12
-
13
- from io import StringIO
14
- from os import path
15
- from os.path import join
16
- import copy
17
- import os
18
- import re
19
- import shutil
20
- import sys
21
- import subprocess
22
-
23
- from modular_build import read_file, write_file, bail_error
24
- import modular_build
25
- import rjsmin
26
-
27
- try:
28
- import simplejson as json
29
- except ImportError:
30
- import json
31
-
32
- try:
33
- original_sys_path = sys.path
34
- sys.path = sys.path + [path.join(os.path.dirname(os.path.realpath(__file__)), '..')]
35
- import devtools_paths
36
- finally:
37
- sys.path = original_sys_path
38
-
39
- FRONT_END_DIRECTORY = path.join(os.path.dirname(path.abspath(__file__)), '..', '..', 'front_end')
40
-
41
-
42
- def main(argv):
43
- try:
44
- input_path_flag_index = argv.index('--input_path')
45
- input_path = argv[input_path_flag_index + 1]
46
- output_path_gen_flag_index = argv.index('--output_path_gen')
47
- output_path_gen = argv[output_path_gen_flag_index + 1]
48
- application_names = argv[1:input_path_flag_index]
49
- use_rollup = '--rollup' in argv
50
- except:
51
- print('Usage: %s app_1 app_2 ... app_N --input_path <input_path> --output_path <output_path> --rollup true' % argv[0])
52
- raise
53
-
54
- loader = modular_build.DescriptorLoader(input_path)
55
- for app in application_names:
56
- descriptors = loader.load_application(app)
57
- builder = ReleaseBuilder(app, descriptors, input_path, output_path_gen,
58
- use_rollup)
59
- builder.build_app()
60
-
61
-
62
- def resource_source_url(url):
63
- return '\n/*# sourceURL=' + url + ' */'
64
-
65
-
66
- def minify_js(javascript):
67
- return rjsmin.jsmin(javascript)
68
-
69
-
70
- def concatenated_module_filename(module_name, output_dir):
71
- return join(output_dir,
72
- module_name + '/' + path.basename(module_name) + '_module.js')
73
-
74
-
75
- # Outputs:
76
- # <app_name>.js
77
- # <module_name>_module.js
78
- class ReleaseBuilder(object):
79
-
80
- def __init__(self, application_name, descriptors, application_dir,
81
- output_path_gen_dir, use_rollup):
82
- self.application_name = application_name
83
- self.descriptors = descriptors
84
- self.application_dir = application_dir
85
- self.output_path_gen_dir = output_path_gen_dir
86
- self.use_rollup = use_rollup
87
-
88
- def app_file(self, extension):
89
- return path.join('entrypoints', self.application_name,
90
- self.application_name + '.' + extension)
91
-
92
- def autorun_resource_names(self):
93
- result = []
94
- for module in self.descriptors.sorted_modules():
95
- if self.descriptors.application[module].get('type') != 'autostart':
96
- continue
97
-
98
- resources = self.descriptors.modules[module].get('resources')
99
- if not resources:
100
- continue
101
- for resource_name in resources:
102
- result.append(path.join(module, resource_name))
103
- return result
104
-
105
- def build_app(self):
106
- self._build_app_script()
107
- for module in filter(lambda desc: (not desc.get('type')),
108
- self.descriptors.application.values()):
109
- self._concatenate_dynamic_module(module['name'])
110
-
111
- def _build_app_script(self):
112
- script_name = self.app_file('js')
113
- output = StringIO()
114
- self._concatenate_application_script(output)
115
- minified_content = minify_js(output.getvalue())
116
- write_file(join(self.output_path_gen_dir, script_name),
117
- minified_content)
118
- output.close()
119
-
120
- def _release_module_descriptors(self):
121
- module_descriptors = self.descriptors.modules
122
- result = []
123
- for name in module_descriptors:
124
- module = copy.copy(module_descriptors[name])
125
- module_type = self.descriptors.application[name].get('type')
126
- resources = module.get('resources', None)
127
- if resources:
128
- # Resources are already baked into _module.
129
- del module['resources']
130
- if not module_type == 'autostart':
131
- # We load the entrypoint of a module no matter what.
132
- # Therefore, we don't need to declare any files for
133
- # the default case. However, if a module still has
134
- # a legacy file, the Runtime performs an array
135
- # contains check and will load that instead.
136
- module_files_to_load = []
137
- declared_module_files = module.get('modules', [])
138
- legacyFileName = path.basename(name) + '-legacy.js'
139
- if legacyFileName in declared_module_files:
140
- module_files_to_load += [legacyFileName]
141
- # Non-autostart modules are vulcanized.
142
- module['modules'] = [path.basename(name) + '_module.js'
143
- ] + module_files_to_load
144
- result.append(module)
145
- return json.dumps(result)
146
-
147
- def _write_module_resources(self, resource_names, output):
148
- for resource_name in resource_names:
149
- resource_name = path.normpath(resource_name).replace('\\', '/')
150
- output.write('RootModule.Runtime.cachedResources.set("%s", "' %
151
- resource_name)
152
- resource_content = read_file(path.join(self.application_dir, resource_name))
153
- if not (resource_name.endswith('.html')
154
- or resource_name.endswith('md')):
155
- resource_content += resource_source_url(resource_name)
156
- resource_content = resource_content.replace('\\', '\\\\')
157
- resource_content = resource_content.replace('\n', '\\n')
158
- resource_content = resource_content.replace('"', '\\"')
159
- output.write(resource_content)
160
- output.write('");\n')
161
-
162
- def _concatenate_autostart_modules(self, output):
163
- non_autostart = set()
164
- sorted_module_names = self.descriptors.sorted_modules()
165
- for name in sorted_module_names:
166
- desc = self.descriptors.modules[name]
167
- name = desc['name']
168
- type = self.descriptors.application[name].get('type')
169
- if type == 'autostart':
170
- deps = set(desc.get('dependencies', []))
171
- non_autostart_deps = deps & non_autostart
172
- if len(non_autostart_deps):
173
- bail_error(
174
- 'Non-autostart dependencies specified for the autostarted module "%s": %s' % (name, non_autostart_deps))
175
- else:
176
- non_autostart.add(name)
177
-
178
- def _concatenate_application_script(self, output):
179
- output.write('Root.allDescriptors.push(...%s);' % self._release_module_descriptors())
180
- if self.descriptors.extends:
181
- output.write(
182
- 'Root.applicationDescriptor.modules.push(...%s);' %
183
- json.dumps(list(self.descriptors.application.values())))
184
- else:
185
- output.write('Root.applicationDescriptor = %s;' % self.descriptors.application_json())
186
-
187
- output.write("import * as RootModule from '../../core/root/root.js';")
188
- self._write_module_resources(self.autorun_resource_names(), output)
189
-
190
- output.write(minify_js(read_file(join(self.application_dir, self.app_file('js')))))
191
- self._concatenate_autostart_modules(output)
192
-
193
- def _concatenate_dynamic_module(self, module_name):
194
- module = self.descriptors.modules[module_name]
195
- modules = module.get('modules')
196
- resources = self.descriptors.module_resources(module_name)
197
- module_dir = join(self.application_dir, module_name)
198
- output = StringIO()
199
- if resources:
200
- relative_file_name = '../core/root/root.js'
201
- if "/" in module_name:
202
- relative_file_name = (
203
- '../' * module_name.count('/')) + relative_file_name
204
- output.write("import * as RootModule from '%s';" %
205
- relative_file_name)
206
- self._write_module_resources(resources, output)
207
- minified_content = minify_js(output.getvalue())
208
- write_file(
209
- concatenated_module_filename(module_name,
210
- self.output_path_gen_dir),
211
- minified_content)
212
- output.close()
213
-
214
-
215
- if __name__ == '__main__':
216
- sys.exit(main(sys.argv))
@@ -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
@@ -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 ['inspector', 'devtools_app', 'js_app', 'node_app', 'shell', 'worker_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);