chrome-devtools-frontend 1.0.972865 → 1.0.973645

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.
@@ -5641,6 +5641,30 @@ constructor is no longer provided.) Values of `null` are ignored.
5641
5641
  */
5642
5642
  declare const showPanel: Facet<PanelConstructor | null, readonly (PanelConstructor | null)[]>;
5643
5643
 
5644
+ declare type HighlightOptions = {
5645
+ /**
5646
+ Determines whether, when nothing is selected, the word around
5647
+ the cursor is matched instead. Defaults to false.
5648
+ */
5649
+ highlightWordAroundCursor?: boolean;
5650
+ /**
5651
+ The minimum length of the selection before it is highlighted.
5652
+ Defaults to 1 (always highlight non-cursor selections).
5653
+ */
5654
+ minSelectionLength?: number;
5655
+ /**
5656
+ The amount of matches (in the viewport) at which to disable
5657
+ highlighting. Defaults to 100.
5658
+ */
5659
+ maxMatches?: number;
5660
+ };
5661
+ /**
5662
+ This extension highlights text that matches the selection. It uses
5663
+ the `"cm-selectionMatch"` class for the highlighting. When
5664
+ `highlightWordAroundCursor` is enabled, the word at the cursor
5665
+ itself will be highlighted with `"cm-selectionMatch-main"`.
5666
+ */
5667
+ declare function highlightSelectionMatches(options?: HighlightOptions): Extension;
5644
5668
  /**
5645
5669
  Select next occurrence of the current selection.
5646
5670
  Expand selection to the word when selection range is empty.
@@ -5788,4 +5812,4 @@ declare function shell(): Promise<StreamLanguage<unknown>>;
5788
5812
  declare function wast(): Promise<typeof _codemirror_lang_wast>;
5789
5813
  declare function xml(): Promise<typeof _codemirror_lang_xml>;
5790
5814
 
5791
- export { Annotation, AnnotationType, ChangeDesc, ChangeSet, ChangeSpec, Command, Compartment, Completion, CompletionContext, CompletionResult, CompletionSource, Decoration, DecorationSet, EditorSelection, EditorState, EditorStateConfig, EditorView, Extension, Facet, GutterMarker, HighlightStyle, KeyBinding, LRParser, Language, LanguageSupport, Line$1 as Line, MapMode, MatchDecorator, NodeProp, NodeSet, NodeType, Panel, Parser, Prec, Range, RangeSet, RangeSetBuilder, SelectionRange, StateEffect, StateEffectType, StateField, StreamLanguage, StreamParser, StringStream, StyleModule, SyntaxNode, Tag, TagStyle, Text, TextIterator, Tooltip, TooltipView, Transaction, TransactionSpec, Tree, TreeCursor, ViewPlugin, ViewUpdate, WidgetType, acceptCompletion, autocompletion, bracketMatching, clojure, closeBrackets, closeBracketsKeymap, closeCompletion, codeFolding, coffeescript, completeAnyWord, cpp, index_d$2 as css, currentCompletions, cursorMatchingBracket, cursorSubwordBackward, cursorSubwordForward, drawSelection, ensureSyntaxTree, foldGutter, foldKeymap, gutter, gutters, highlightSpecialChars, highlightTree, history, historyKeymap, index_d$1 as html, ifNotIn, indentLess, indentMore, indentOnInput, indentUnit, insertNewlineAndIndent, java, index_d as javascript, json, keymap, lineNumberMarkers, lineNumbers, markdown, php, placeholder, python, redo, redoSelection, repositionTooltips, scrollPastEnd, selectMatchingBracket, selectNextOccurrence, selectSubwordBackward, selectSubwordForward, selectedCompletion, shell, showPanel, showTooltip, standardKeymap, startCompletion, syntaxTree, tags, toggleComment, tooltips, undo, undoSelection, wast, xml };
5815
+ export { Annotation, AnnotationType, ChangeDesc, ChangeSet, ChangeSpec, Command, Compartment, Completion, CompletionContext, CompletionResult, CompletionSource, Decoration, DecorationSet, EditorSelection, EditorState, EditorStateConfig, EditorView, Extension, Facet, GutterMarker, HighlightStyle, KeyBinding, LRParser, Language, LanguageSupport, Line$1 as Line, MapMode, MatchDecorator, NodeProp, NodeSet, NodeType, Panel, Parser, Prec, Range, RangeSet, RangeSetBuilder, SelectionRange, StateEffect, StateEffectType, StateField, StreamLanguage, StreamParser, StringStream, StyleModule, SyntaxNode, Tag, TagStyle, Text, TextIterator, Tooltip, TooltipView, Transaction, TransactionSpec, Tree, TreeCursor, ViewPlugin, ViewUpdate, WidgetType, acceptCompletion, autocompletion, bracketMatching, clojure, closeBrackets, closeBracketsKeymap, closeCompletion, codeFolding, coffeescript, completeAnyWord, cpp, index_d$2 as css, currentCompletions, cursorMatchingBracket, cursorSubwordBackward, cursorSubwordForward, drawSelection, ensureSyntaxTree, foldGutter, foldKeymap, gutter, gutters, highlightSelectionMatches, highlightSpecialChars, highlightTree, history, historyKeymap, index_d$1 as html, ifNotIn, indentLess, indentMore, indentOnInput, indentUnit, insertNewlineAndIndent, java, index_d as javascript, json, keymap, lineNumberMarkers, lineNumbers, markdown, php, placeholder, python, redo, redoSelection, repositionTooltips, scrollPastEnd, selectMatchingBracket, selectNextOccurrence, selectSubwordBackward, selectSubwordForward, selectedCompletion, shell, showPanel, showTooltip, standardKeymap, startCompletion, syntaxTree, tags, toggleComment, tooltips, undo, undoSelection, wast, xml };
@@ -1,2 +1,2 @@
1
- export{$ as cursorSubwordForward,_ as cursorSubwordBackward,A as java,a$ as scrollPastEnd,a0 as indentLess,a1 as indentMore,a2 as insertNewlineAndIndent,a3 as selectMatchingBracket,a4 as selectSubwordBackward,a5 as selectSubwordForward,a6 as standardKeymap,a7 as toggleComment,a8 as codeFolding,a9 as foldGutter,a_ as placeholder,aa as foldKeymap,aA as selectNextOccurrence,aB as Annotation,ab as gutter,aC as AnnotationType,ac as GutterMarker,aD as ChangeDesc,ad as gutters,aE as ChangeSet,ae as lineNumberMarkers,aF as Compartment,af as lineNumbers,aG as EditorState,ag as HighlightStyle,aH as Facet,ah as highlightTree,aI as MapMode,ai as Tag,aJ as SelectionRange,aj as history,aK as StateEffect,ak as historyKeymap,aL as StateEffectType,al as redo,aM as StateField,am as redoSelection,aN as Transaction,an as undo,aO as StreamLanguage,ao as undoSelection,aP as StringStream,ap as css,aQ as Line,aq as html,aR as Text,ar as javascript,as as ensureSyntaxTree,aS as repositionTooltips,at as indentOnInput,aT as showTooltip,au as indentUnit,aU as tooltips,aV as Decoration,av as bracketMatching,aW as drawSelection,aw as showPanel,aX as EditorView,ax as Range,ay as RangeSet,aY as highlightSpecialChars,aZ as MatchDecorator,az as RangeSetBuilder,B as json,b0 as ViewPlugin,b1 as ViewUpdate,b2 as WidgetType,b3 as TreeCursor,b4 as StyleModule,D as markdown,e as LanguageSupport,F as php,g as NodeType,G as python,h as NodeSet,H as shell,I as wast,j as Language,J as xml,K as acceptCompletion,k as syntaxTree,L as LRParser,m as EditorSelection,M as autocompletion,N as NodeProp,n as Prec,O as closeCompletion,o as keymap,P as Parser,Q as completeAnyWord,R as CompletionContext,S as currentCompletions,T as Tree,t as tags,U as ifNotIn,V as selectedCompletion,W as startCompletion,x as clojure,X as closeBrackets,Y as closeBracketsKeymap,y as coffeescript,z as cpp,Z as cursorMatchingBracket}from"./chunk/codemirror.js";
1
+ export{$ as cursorSubwordForward,_ as cursorSubwordBackward,A as java,a$ as placeholder,a0 as indentLess,a1 as indentMore,a2 as insertNewlineAndIndent,a3 as selectMatchingBracket,a4 as selectSubwordBackward,a5 as selectSubwordForward,a6 as standardKeymap,a7 as toggleComment,a8 as codeFolding,a9 as foldGutter,a_ as MatchDecorator,aa as foldKeymap,aA as selectNextOccurrence,ab as gutter,aB as highlightSelectionMatches,aC as Annotation,ac as GutterMarker,aD as AnnotationType,ad as gutters,aE as ChangeDesc,ae as lineNumberMarkers,aF as ChangeSet,af as lineNumbers,aG as Compartment,ag as HighlightStyle,aH as EditorState,ah as highlightTree,aI as Facet,ai as Tag,aJ as MapMode,aj as history,aK as SelectionRange,ak as historyKeymap,aL as StateEffect,al as redo,aM as StateEffectType,am as redoSelection,aN as StateField,an as undo,aO as Transaction,ao as undoSelection,aP as StreamLanguage,ap as css,aQ as StringStream,aq as html,aR as Line,ar as javascript,aS as Text,as as ensureSyntaxTree,at as indentOnInput,aT as repositionTooltips,au as indentUnit,aU as showTooltip,av as bracketMatching,aV as tooltips,aW as Decoration,aw as showPanel,ax as Range,aX as drawSelection,aY as EditorView,ay as RangeSet,az as RangeSetBuilder,aZ as highlightSpecialChars,B as json,b0 as scrollPastEnd,b1 as ViewPlugin,b2 as ViewUpdate,b3 as WidgetType,b4 as TreeCursor,b5 as StyleModule,D as markdown,e as LanguageSupport,F as php,g as NodeType,G as python,h as NodeSet,H as shell,I as wast,j as Language,J as xml,K as acceptCompletion,k as syntaxTree,L as LRParser,m as EditorSelection,M as autocompletion,N as NodeProp,n as Prec,O as closeCompletion,o as keymap,P as Parser,Q as completeAnyWord,R as CompletionContext,S as currentCompletions,T as Tree,t as tags,U as ifNotIn,V as selectedCompletion,W as startCompletion,x as clojure,X as closeBrackets,Y as closeBracketsKeymap,y as coffeescript,z as cpp,Z as cursorMatchingBracket}from"./chunk/codemirror.js";
2
2
 
@@ -3,7 +3,7 @@
3
3
  "version": "0.0.1",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@codemirror/autocomplete": "0.19.12",
6
+ "@codemirror/autocomplete": "0.19.13",
7
7
  "@codemirror/closebrackets": "0.19.0",
8
8
  "@codemirror/commands": "0.19.8",
9
9
  "@codemirror/comment": "0.19.1",
@@ -17,7 +17,7 @@ div {
17
17
 
18
18
  .arrow-icon {
19
19
  display: inline-block;
20
- -webkit-mask-image: url("Images/treeoutlineTriangles.svg");
20
+ -webkit-mask-image: var(--image-file-treeoutlineTriangles);
21
21
  -webkit-mask-size: 32px 24px;
22
22
  -webkit-mask-position: 0 0;
23
23
  background-color: var(--color-text-primary);
@@ -224,6 +224,7 @@ export function baseConfiguration(text: string): CM.Extension {
224
224
  return [
225
225
  theme(),
226
226
  CM.highlightSpecialChars(),
227
+ CM.highlightSelectionMatches(),
227
228
  CM.history(),
228
229
  CM.drawSelection(),
229
230
  CM.EditorState.allowMultipleSelections.of(true),
@@ -4,11 +4,12 @@
4
4
 
5
5
  import * as CodeMirror from '../../../third_party/codemirror.next/codemirror.next.js';
6
6
 
7
+ export const closeTooltip = CodeMirror.StateEffect.define<null>();
8
+
7
9
  export function cursorTooltip(
8
10
  source: (state: CodeMirror.EditorState, pos: number) => Promise<(() => CodeMirror.TooltipView)|null>,
9
11
  ): CodeMirror.Extension {
10
12
  const openTooltip = CodeMirror.StateEffect.define<() => CodeMirror.TooltipView>();
11
- const closeTooltip = CodeMirror.StateEffect.define<null>();
12
13
 
13
14
  const state = CodeMirror.StateField.define<null|CodeMirror.Tooltip>({
14
15
  create() {
@@ -41,18 +42,18 @@ export function cursorTooltip(
41
42
  update(update: CodeMirror.ViewUpdate): void {
42
43
  this.updateID++;
43
44
  if (update.transactions.some(tr => tr.selection) && update.state.selection.main.empty) {
44
- this.scheduleUpdate(update.view);
45
+ this.#scheduleUpdate(update.view);
45
46
  }
46
47
  }
47
48
 
48
- scheduleUpdate(view: CodeMirror.EditorView): void {
49
+ #scheduleUpdate(view: CodeMirror.EditorView): void {
49
50
  if (this.pending > -1) {
50
51
  clearTimeout(this.pending);
51
52
  }
52
- this.pending = window.setTimeout(() => this.startUpdate(view), 50) as unknown as number;
53
+ this.pending = window.setTimeout(() => this.#startUpdate(view), 50) as unknown as number;
53
54
  }
54
55
 
55
- startUpdate(view: CodeMirror.EditorView): void {
56
+ #startUpdate(view: CodeMirror.EditorView): void {
56
57
  this.pending = -1;
57
58
  const {main} = view.state.selection;
58
59
  if (main.empty) {
@@ -60,7 +61,7 @@ export function cursorTooltip(
60
61
  void source(view.state, main.from).then(tooltip => {
61
62
  if (this.updateID !== updateID) {
62
63
  if (this.pending < 0) {
63
- this.scheduleUpdate(view);
64
+ this.#scheduleUpdate(view);
64
65
  }
65
66
  } else if (tooltip) {
66
67
  view.dispatch({effects: openTooltip.of(tooltip)});
@@ -7,7 +7,8 @@ import * as Formatter from '../../../models/formatter/formatter.js';
7
7
  import * as JavaScriptMetaData from '../../../models/javascript_metadata/javascript_metadata.js';
8
8
  import * as CodeMirror from '../../../third_party/codemirror.next/codemirror.next.js';
9
9
  import * as UI from '../../legacy/legacy.js';
10
- import {cursorTooltip} from './cursor_tooltip.js';
10
+
11
+ import {closeTooltip, cursorTooltip} from './cursor_tooltip.js';
11
12
 
12
13
  export function completion(): CodeMirror.Extension {
13
14
  return CodeMirror.javascript.javascriptLanguage.data.of({
@@ -225,6 +226,7 @@ async function evaluateExpression(
225
226
 
226
227
  const primitivePrototypes = new Map<string, string>([
227
228
  ['string', 'String'],
229
+ ['symbol', 'Symbol'],
228
230
  ['number', 'Number'],
229
231
  ['boolean', 'Boolean'],
230
232
  ['bigint', 'BigInt'],
@@ -319,9 +321,7 @@ async function completePropertiesInner(
319
321
  object = innerObject as SDK.RemoteObject.RemoteObject;
320
322
  }
321
323
 
322
- const toPrototype = object.subtype === 'array' ?
323
- 'Array' :
324
- object.subtype === 'typedarray' ? 'Uint8Array' : primitivePrototypes.get(object.type);
324
+ const toPrototype = primitivePrototypes.get(object.type);
325
325
  if (toPrototype) {
326
326
  object = await evaluateExpression(context, toPrototype + '.prototype', 'completion');
327
327
  }
@@ -329,7 +329,8 @@ async function completePropertiesInner(
329
329
  const functionType = expression === 'globalThis' ? 'function' : 'method';
330
330
  const otherType = expression === 'globalThis' ? 'variable' : 'property';
331
331
  if (object && (object.type === 'object' || object.type === 'function')) {
332
- const properties = await object.getAllProperties(false, false);
332
+ const properties = await object.getAllProperties(
333
+ /* accessorPropertiesOnly */ false, /* generatePreview */ false, /* nonIndexedPropertiesOnly */ true);
333
334
  const isFunction = object.type === 'function';
334
335
  for (const prop of properties.properties || []) {
335
336
  if (!prop.symbol && !(isFunction && (prop.name === 'arguments' || prop.name === 'caller')) &&
@@ -424,6 +425,10 @@ export function argumentHints(): CodeMirror.Extension {
424
425
  return cursorTooltip(getArgumentHints);
425
426
  }
426
427
 
428
+ export function closeArgumentsHintsTooltip(view: CodeMirror.EditorView): void {
429
+ view.dispatch({effects: closeTooltip.of(null)});
430
+ }
431
+
427
432
  async function getArgumentHints(
428
433
  state: CodeMirror.EditorState, pos: number): Promise<(() => CodeMirror.TooltipView)|null> {
429
434
  const node = CodeMirror.syntaxTree(state).resolveInner(pos).enterUnfinishedNodesBefore(pos);
package/package.json CHANGED
@@ -54,5 +54,5 @@
54
54
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
55
55
  "watch": "third_party/node/node.py --output scripts/watch_build.js"
56
56
  },
57
- "version": "1.0.972865"
57
+ "version": "1.0.973645"
58
58
  }
@@ -3,6 +3,17 @@
3
3
  The DevTools build system contains several templates to integrate files in the build system.
4
4
  Below you can find an overview of which template/combination of templates you need to use and when.
5
5
 
6
+ ## General guidance
7
+
8
+ Whenever you are implementing a template, take into account that GN expects the source folder structure to be [mirrored](https://chromium.googlesource.com/chromium/src/+/HEAD/build/docs/writing_gn_templates.md#where-to-place-outputs) in the out-directory.
9
+ Historically, DevTools used the location-agnostic [`out/Default/resources/inspector`](https://groups.google.com/a/chromium.org/g/devtools-dev/c/BENZ8ZTW0Ls/m/W7BhAvOzBAAJ) folder, but we have since adopted the GN guidelines for mirroring our source folder.
10
+ Primary motivations are the instability of the separate folder, as well as required hacks to compute "relative" sub-folders in GN.
11
+ Since GN has no notion of a "root" folder for DevTools, computation of sub-folders can only be done based on heuristics, which will fail sooner rather than later.
12
+
13
+ Additionally, GN is a [timestamp-based build system](https://gn.googlesource.com/gn/+/master/docs/reference.md#target-declarations-action_declare-a-target-that-runs-a-script-a-single-time-outputs) when checking for correctness.
14
+ This means that you want to avoid writing to the file system if the content stays the same.
15
+ For Node scripts, use the `writeIfChanged` function from [write-if-changed.js](./write-if-changed.js) to integrate nicely with GN.
16
+
6
17
  ## Entrypoints and modules
7
18
 
8
19
  The buildsystem has a concept of "entrypoints" and "modules".
@@ -57,46 +68,6 @@ devtools_entrypoint("bundle") {
57
68
 
58
69
  > Rule: `devtools_entrypoints` is named "bundle", as in a release build it bundles with Rollup
59
70
 
60
- ### Legacy: Non-TypeScript entrypoints
61
-
62
- Not all modules are currently typechecked only by TypeScript.
63
- There are two other options, related to the legacy Closure Compiler.
64
-
65
- #### Typescriptified modules (e.g. TypeScript + Closure Compiler)
66
-
67
- Any module that is fully typescriptified (e.g. a JavaScript file that is typechecked by both TypeScript and Compiler Compiler) can be imported from both TypeScript modules and Closure Compile-checked modules.
68
-
69
- > Rule: Any typescriptified module can never contain an entrypoint or source file in their implementation that is TypeScript-authored. In practice this rule comes down to: you can only have a TypeScript-authored implementation file if the corresponding entrypoint is also TypeScript-authored.
70
-
71
- As such, the following layout is used for TypeScriptified modules:
72
-
73
- ```python
74
- import("../../scripts/build/ninja/devtools_entrypoint.gni")
75
- import("../../scripts/build/ninja/devtools_module.gni")
76
-
77
- devtools_module("my_module") {
78
- sources = [
79
- "implementation_detail.js",
80
- "some_other_file.js",
81
- ]
82
-
83
- deps = [
84
- "../other_dependency:bundle",
85
- ]
86
- }
87
-
88
- devtools_entrypoint("bundle") {
89
- entrypoint = "my_module.js"
90
-
91
- deps = [
92
- ":my_module",
93
- ]
94
- }
95
- ```
96
-
97
- Here, both the entrypoint and the sources of the module are all JavaScript files.
98
- All of these files are typechecked by Closure Compiler and TypeScript.
99
-
100
71
  ## GRD file generation
101
72
 
102
73
  To make sure that files are loaded in Chromium, DevTools generates a GRD file that includes all files that are allowed to be loaded by the backend.