chrome-devtools-frontend 1.0.952284 → 1.0.952403

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 (52) hide show
  1. package/config/gni/devtools_grd_files.gni +3 -0
  2. package/front_end/.eslintrc.js +1 -1
  3. package/front_end/core/host/UserMetrics.ts +2 -1
  4. package/front_end/core/i18n/locales/en-US.json +3 -0
  5. package/front_end/core/i18n/locales/en-XL.json +3 -0
  6. package/front_end/core/root/Runtime.ts +4 -12
  7. package/front_end/core/sdk/PageResourceLoader.ts +2 -1
  8. package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +3 -3
  9. package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +2 -2
  10. package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +9 -9
  11. package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +11 -11
  12. package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +40 -40
  13. package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +14 -14
  14. package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +15 -15
  15. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +2 -0
  16. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +29 -29
  17. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +2 -2
  18. package/front_end/entrypoints/inspector_main/InspectorMain.ts +12 -12
  19. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +25 -25
  20. package/front_end/entrypoints/main/ExecutionContextSelector.ts +26 -29
  21. package/front_end/entrypoints/main/MainImpl.ts +38 -38
  22. package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +10 -10
  23. package/front_end/entrypoints/node_app/NodeMain.ts +3 -3
  24. package/front_end/legacy/legacy-defs.d.ts +0 -21
  25. package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +1 -1
  26. package/front_end/models/issues_manager/ClientHintIssue.ts +95 -0
  27. package/front_end/models/issues_manager/IssuesManager.ts +5 -0
  28. package/front_end/models/issues_manager/descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
  29. package/front_end/models/issues_manager/descriptions/clientHintMetaTagModifiedHTML.md +4 -0
  30. package/front_end/models/issues_manager/issues_manager.ts +2 -0
  31. package/front_end/panels/console/ConsoleView.ts +1 -1
  32. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +86 -25
  33. package/front_end/panels/performance_monitor/performanceMonitor.css +32 -0
  34. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -2
  35. package/front_end/panels/timeline/TimelineFlameChartView.ts +1 -1
  36. package/front_end/panels/timeline/TimelineTreeView.ts +1 -1
  37. package/front_end/third_party/diff/DiffWrapper.ts +7 -0
  38. package/front_end/ui/components/data_grid/DataGrid.ts +2 -2
  39. package/front_end/ui/components/data_grid/DataGridUtils.ts +3 -0
  40. package/front_end/ui/legacy/SearchableView.ts +13 -4
  41. package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -1
  42. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +13 -12
  43. package/front_end/ui/legacy/components/source_frame/XMLView.ts +2 -2
  44. package/front_end/ui/legacy/theme_support/theme_support_impl.ts +22 -7
  45. package/package.json +1 -1
  46. package/config/gni/all_devtools_files.gni +0 -255
  47. package/scripts/build/devtools_file_hashes.py +0 -82
  48. package/scripts/devtools_run/devtools_run_cli +0 -49
  49. package/scripts/devtools_run/package.json +0 -13
  50. package/scripts/unzip.py +0 -20
  51. package/scripts/visualize_deps/jquery_svg.html +0 -57
  52. package/scripts/visualize_deps/run_visualize.js +0 -119
@@ -281,6 +281,8 @@ grd_files_release_sources = [
281
281
  "front_end/models/issues_manager/descriptions/arInvalidTriggerPriority.md",
282
282
  "front_end/models/issues_manager/descriptions/arMissingAttributionData.md",
283
283
  "front_end/models/issues_manager/descriptions/arPermissionPolicyDisabled.md",
284
+ "front_end/models/issues_manager/descriptions/clientHintMetaTagAllowListInvalidOrigin.md",
285
+ "front_end/models/issues_manager/descriptions/clientHintMetaTagModifiedHTML.md",
284
286
  "front_end/models/issues_manager/descriptions/corsAllowCredentialsRequired.md",
285
287
  "front_end/models/issues_manager/descriptions/corsDisabledScheme.md",
286
288
  "front_end/models/issues_manager/descriptions/corsDisallowedByMode.md",
@@ -692,6 +694,7 @@ grd_files_debug_sources = [
692
694
  "front_end/models/har/Writer.js",
693
695
  "front_end/models/heap_snapshot_model/HeapSnapshotModel.js",
694
696
  "front_end/models/issues_manager/AttributionReportingIssue.js",
697
+ "front_end/models/issues_manager/ClientHintIssue.js",
695
698
  "front_end/models/issues_manager/ContentSecurityPolicyIssue.js",
696
699
  "front_end/models/issues_manager/ContrastCheckTrigger.js",
697
700
  "front_end/models/issues_manager/CorsIssue.js",
@@ -141,7 +141,7 @@ module.exports = {
141
141
  }
142
142
  },
143
143
  {
144
- 'files': ['panels/**/components/*.ts', 'ui/components/**/*.ts'],
144
+ 'files': ['panels/**/components/*.ts', 'ui/components/**/*.ts', 'entrypoints/**/*.ts'],
145
145
  'rules': {
146
146
  'rulesdir/use_private_class_members': 2,
147
147
  }
@@ -677,7 +677,8 @@ export const IssueCreated: {
677
677
  'QuirksModeIssue::QuirksMode': 58,
678
678
  'QuirksModeIssue::LimitedQuirksMode': 59,
679
679
  DeprecationIssue: 60,
680
- 'CorsIssue::PreflightAllowPrivateNetworkError': 61,
680
+ 'ClientHintIssue::MetaTagAllowListInvalidOrigin': 61,
681
+ 'ClientHintIssue::MetaTagModifiedHTML': 62,
681
682
  };
682
683
 
683
684
  // TODO(crbug.com/1167717): Make this a const enum again
@@ -1322,6 +1322,9 @@
1322
1322
  "models/har/Writer.ts | writingFile": {
1323
1323
  "message": "Writing file…"
1324
1324
  },
1325
+ "models/issues_manager/ClientHintIssue.ts | clientHintsInfrastructure": {
1326
+ "message": "Client Hints Infrastructure"
1327
+ },
1325
1328
  "models/issues_manager/ContentSecurityPolicyIssue.ts | contentSecurityPolicyEval": {
1326
1329
  "message": "Content Security Policy - Eval"
1327
1330
  },
@@ -1322,6 +1322,9 @@
1322
1322
  "models/har/Writer.ts | writingFile": {
1323
1323
  "message": "Ŵŕît́îńĝ f́îĺê…"
1324
1324
  },
1325
+ "models/issues_manager/ClientHintIssue.ts | clientHintsInfrastructure": {
1326
+ "message": "Ĉĺîén̂t́ Ĥín̂t́ŝ Ín̂f́r̂áŝt́r̂úĉt́ûŕê"
1327
+ },
1325
1328
  "models/issues_manager/ContentSecurityPolicyIssue.ts | contentSecurityPolicyEval": {
1326
1329
  "message": "Ĉón̂t́êńt̂ Śêćûŕît́ŷ Ṕôĺîćŷ - Év̂ál̂"
1327
1330
  },
@@ -2,8 +2,7 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- const originalConsole = console;
6
- const originalAssert = console.assert;
5
+ import * as Platform from '../platform/platform.js';
7
6
 
8
7
  const queryParamsObject = new URLSearchParams(location.search);
9
8
 
@@ -100,13 +99,6 @@ export class Runtime {
100
99
  }
101
100
  }
102
101
 
103
- static assert(value: boolean|undefined, message: string): void {
104
- if (value) {
105
- return;
106
- }
107
- originalAssert.call(originalConsole, value, message + ' ' + new Error().stack);
108
- }
109
-
110
102
  static setPlatform(platform: string): void {
111
103
  runtimePlatform = platform;
112
104
  }
@@ -197,8 +189,8 @@ export class ExperimentsSupport {
197
189
  }
198
190
 
199
191
  register(experimentName: string, experimentTitle: string, unstable?: boolean, docLink?: string): void {
200
- Runtime.assert(
201
- !this.#experimentNames.has(experimentName), 'Duplicate registration of experiment ' + experimentName);
192
+ Platform.DCHECK(
193
+ () => !this.#experimentNames.has(experimentName), 'Duplicate registration of experiment ' + experimentName);
202
194
  this.#experimentNames.add(experimentName);
203
195
  this.#experiments.push(new Experiment(this, experimentName, experimentTitle, Boolean(unstable), docLink ?? ''));
204
196
  }
@@ -278,7 +270,7 @@ export class ExperimentsSupport {
278
270
  }
279
271
 
280
272
  private checkExperiment(experimentName: string): void {
281
- Runtime.assert(this.#experimentNames.has(experimentName), 'Unknown experiment ' + experimentName);
273
+ Platform.DCHECK(() => this.#experimentNames.has(experimentName), 'Unknown experiment ' + experimentName);
282
274
  }
283
275
  }
284
276
 
@@ -219,7 +219,8 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
219
219
  return this.#loadOverride(url);
220
220
  }
221
221
  const parsedURL = new Common.ParsedURL.ParsedURL(url);
222
- const eligibleForLoadFromTarget = getLoadThroughTargetSetting().get() && parsedURL && parsedURL.isHttpOrHttps();
222
+ const eligibleForLoadFromTarget =
223
+ getLoadThroughTargetSetting().get() && parsedURL && parsedURL.scheme !== 'file' && parsedURL.scheme !== 'data';
223
224
  Host.userMetrics.developerResourceScheme(this.getDeveloperResourceScheme(parsedURL));
224
225
  if (eligibleForLoadFromTarget) {
225
226
  try {
@@ -66,7 +66,7 @@ export class AcornTokenizer {
66
66
  // we see the comment itself. In that case, we should proceed and
67
67
  // initialize `bufferedToken` as normal, to allow us to fix the reordering.
68
68
  if (this.#comments.length === 0) {
69
- this.nextTokenInternal();
69
+ this.#nextTokenInternal();
70
70
  }
71
71
  }
72
72
 
@@ -94,7 +94,7 @@ export class AcornTokenizer {
94
94
  return token.type === 'Block';
95
95
  }
96
96
 
97
- private nextTokenInternal(): TokenOrComment|undefined {
97
+ #nextTokenInternal(): TokenOrComment|undefined {
98
98
  if (this.#comments.length) {
99
99
  const nextComment = this.#comments.shift();
100
100
  // If this was the last comment to process, we need to make
@@ -113,7 +113,7 @@ export class AcornTokenizer {
113
113
  }
114
114
 
115
115
  nextToken(): TokenOrComment|null {
116
- const token = this.nextTokenInternal();
116
+ const token = this.#nextTokenInternal();
117
117
  if (!token || token.type === Acorn.tokTypes.eof) {
118
118
  return null;
119
119
  }
@@ -75,11 +75,11 @@ export class CSSFormatter {
75
75
  this.#lastLine = -1;
76
76
  const tokenize = createTokenizer('text/css');
77
77
  const oldEnforce = this.#builder.setEnforceSpaceBetweenWords(false);
78
- tokenize(text.substring(this.#fromOffset, this.#toOffset), this.tokenCallback.bind(this));
78
+ tokenize(text.substring(this.#fromOffset, this.#toOffset), this.#tokenCallback.bind(this));
79
79
  this.#builder.setEnforceSpaceBetweenWords(oldEnforce);
80
80
  }
81
81
 
82
- private tokenCallback(token: string, type: string|null, startPosition: number): void {
82
+ #tokenCallback(token: string, type: string|null, startPosition: number): void {
83
83
  startPosition += this.#fromOffset;
84
84
  const startLine = Platform.ArrayUtilities.lowerBound(
85
85
  this.#lineEndings, startPosition, Platform.ArrayUtilities.DEFAULT_COMPARATOR);
@@ -30,10 +30,10 @@ export class ESTreeWalker {
30
30
  }
31
31
 
32
32
  walk(ast: Acorn.ESTree.Node): void {
33
- this.innerWalk(ast, null);
33
+ this.#innerWalk(ast, null);
34
34
  }
35
35
 
36
- private innerWalk(node: Acorn.ESTree.Node, parent: Acorn.ESTree.Node|null): void {
36
+ #innerWalk(node: Acorn.ESTree.Node, parent: Acorn.ESTree.Node|null): void {
37
37
  if (!node && parent && this.#walkNulls) {
38
38
  const result = ({raw: 'null', value: null, parent: null} as Acorn.ESTree.SimpleLiteral);
39
39
  // Otherwise Closure can't handle the definition
@@ -62,10 +62,10 @@ export class ESTreeWalker {
62
62
  const templateLiteral = (node as Acorn.ESTree.TemplateLiteral);
63
63
  const expressionsLength = templateLiteral.expressions.length;
64
64
  for (let i = 0; i < expressionsLength; ++i) {
65
- this.innerWalk(templateLiteral.quasis[i], templateLiteral);
66
- this.innerWalk(templateLiteral.expressions[i], templateLiteral);
65
+ this.#innerWalk(templateLiteral.quasis[i], templateLiteral);
66
+ this.#innerWalk(templateLiteral.expressions[i], templateLiteral);
67
67
  }
68
- this.innerWalk(templateLiteral.quasis[expressionsLength], templateLiteral);
68
+ this.#innerWalk(templateLiteral.quasis[expressionsLength], templateLiteral);
69
69
  } else {
70
70
  for (let i = 0; i < walkOrder.length; ++i) {
71
71
  // @ts-ignore We are doing type traversal here, but the strings
@@ -75,9 +75,9 @@ export class ESTreeWalker {
75
75
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
76
  const entity = (node[walkOrder[i]] as any);
77
77
  if (Array.isArray(entity)) {
78
- this.walkArray((entity as Acorn.ESTree.Node[]), node);
78
+ this.#walkArray((entity as Acorn.ESTree.Node[]), node);
79
79
  } else {
80
- this.innerWalk((entity as Acorn.ESTree.Node), node);
80
+ this.#innerWalk((entity as Acorn.ESTree.Node), node);
81
81
  }
82
82
  }
83
83
  }
@@ -85,9 +85,9 @@ export class ESTreeWalker {
85
85
  this.#afterVisit.call(null, node);
86
86
  }
87
87
 
88
- private walkArray(nodeArray: Acorn.ESTree.Node[], parentNode: Acorn.ESTree.Node|null): void {
88
+ #walkArray(nodeArray: Acorn.ESTree.Node[], parentNode: Acorn.ESTree.Node|null): void {
89
89
  for (let i = 0; i < nodeArray.length; ++i) {
90
- this.innerWalk(nodeArray[i], parentNode);
90
+ this.#innerWalk(nodeArray[i], parentNode);
91
91
  }
92
92
  }
93
93
  }
@@ -31,11 +31,11 @@ export class FormattedContentBuilder {
31
31
  this.addSoftSpace();
32
32
  }
33
33
 
34
- this.appendFormatting();
34
+ this.#appendFormatting();
35
35
 
36
36
  // Insert token.
37
- this.addMappingIfNeeded(offset);
38
- this.addText(token);
37
+ this.#addMappingIfNeeded(offset);
38
+ this.#addText(token);
39
39
  }
40
40
 
41
41
  addSoftSpace(): void {
@@ -75,18 +75,18 @@ export class FormattedContentBuilder {
75
75
  return this.#formattedContent.join('') + (this.#newLines ? '\n' : '');
76
76
  }
77
77
 
78
- private appendFormatting(): void {
78
+ #appendFormatting(): void {
79
79
  if (this.#newLines) {
80
80
  for (let i = 0; i < this.#newLines; ++i) {
81
- this.addText('\n');
81
+ this.#addText('\n');
82
82
  }
83
- this.addText(this.indent());
83
+ this.#addText(this.#indent());
84
84
  } else if (this.#softSpace) {
85
- this.addText(' ');
85
+ this.#addText(' ');
86
86
  }
87
87
  if (this.#hardSpaces) {
88
88
  for (let i = 0; i < this.#hardSpaces; ++i) {
89
- this.addText(' ');
89
+ this.#addText(' ');
90
90
  }
91
91
  }
92
92
  this.#newLines = 0;
@@ -94,7 +94,7 @@ export class FormattedContentBuilder {
94
94
  this.#hardSpaces = 0;
95
95
  }
96
96
 
97
- private indent(): string {
97
+ #indent(): string {
98
98
  const cachedValue = this.#cachedIndents.get(this.#nestingLevel);
99
99
  if (cachedValue) {
100
100
  return cachedValue;
@@ -112,12 +112,12 @@ export class FormattedContentBuilder {
112
112
  return fullIndent;
113
113
  }
114
114
 
115
- private addText(text: string): void {
115
+ #addText(text: string): void {
116
116
  this.#formattedContent.push(text);
117
117
  this.#formattedContentLength += text.length;
118
118
  }
119
119
 
120
- private addMappingIfNeeded(originalPosition: number): void {
120
+ #addMappingIfNeeded(originalPosition: number): void {
121
121
  if (originalPosition - this.#lastOriginalPosition === this.#formattedContentLength - this.#lastFormattedPosition) {
122
122
  return;
123
123
  }
@@ -27,10 +27,10 @@ export class HTMLFormatter {
27
27
  this.#text = text;
28
28
  this.#lineEndings = lineEndings;
29
29
  this.#model = new HTMLModel(text);
30
- this.walk(this.#model.document());
30
+ this.#walk(this.#model.document());
31
31
  }
32
32
 
33
- private formatTokensTill(element: FormatterElement, offset: number): void {
33
+ #formatTokensTill(element: FormatterElement, offset: number): void {
34
34
  if (!this.#model) {
35
35
  return;
36
36
  }
@@ -38,33 +38,33 @@ export class HTMLFormatter {
38
38
  let nextToken = this.#model.peekToken();
39
39
  while (nextToken && nextToken.startOffset < offset) {
40
40
  const token = (this.#model.nextToken() as Token);
41
- this.formatToken(element, token);
41
+ this.#formatToken(element, token);
42
42
  nextToken = this.#model.peekToken();
43
43
  }
44
44
  }
45
45
 
46
- private walk(element: FormatterElement): void {
46
+ #walk(element: FormatterElement): void {
47
47
  if (!element.openTag || !element.closeTag) {
48
48
  throw new Error('Element is missing open or close tag');
49
49
  }
50
50
 
51
51
  if (element.parent) {
52
- this.formatTokensTill(element.parent, element.openTag.startOffset);
52
+ this.#formatTokensTill(element.parent, element.openTag.startOffset);
53
53
  }
54
- this.beforeOpenTag(element);
55
- this.formatTokensTill(element, element.openTag.endOffset);
56
- this.afterOpenTag(element);
54
+ this.#beforeOpenTag(element);
55
+ this.#formatTokensTill(element, element.openTag.endOffset);
56
+ this.#afterOpenTag(element);
57
57
  for (let i = 0; i < element.children.length; ++i) {
58
- this.walk(element.children[i]);
58
+ this.#walk(element.children[i]);
59
59
  }
60
60
 
61
- this.formatTokensTill(element, element.closeTag.startOffset);
62
- this.beforeCloseTag(element);
63
- this.formatTokensTill(element, element.closeTag.endOffset);
64
- this.afterCloseTag(element);
61
+ this.#formatTokensTill(element, element.closeTag.startOffset);
62
+ this.#beforeCloseTag(element);
63
+ this.#formatTokensTill(element, element.closeTag.endOffset);
64
+ this.#afterCloseTag(element);
65
65
  }
66
66
 
67
- private beforeOpenTag(element: FormatterElement): void {
67
+ #beforeOpenTag(element: FormatterElement): void {
68
68
  if (!this.#model) {
69
69
  return;
70
70
  }
@@ -75,7 +75,7 @@ export class HTMLFormatter {
75
75
  this.#builder.addNewLine();
76
76
  }
77
77
 
78
- private afterOpenTag(element: FormatterElement): void {
78
+ #afterOpenTag(element: FormatterElement): void {
79
79
  if (!this.#model) {
80
80
  return;
81
81
  }
@@ -87,7 +87,7 @@ export class HTMLFormatter {
87
87
  this.#builder.addNewLine();
88
88
  }
89
89
 
90
- private beforeCloseTag(element: FormatterElement): void {
90
+ #beforeCloseTag(element: FormatterElement): void {
91
91
  if (!this.#model) {
92
92
  return;
93
93
  }
@@ -99,11 +99,11 @@ export class HTMLFormatter {
99
99
  this.#builder.addNewLine();
100
100
  }
101
101
 
102
- private afterCloseTag(_element: FormatterElement): void {
102
+ #afterCloseTag(_element: FormatterElement): void {
103
103
  this.#builder.addNewLine();
104
104
  }
105
105
 
106
- private formatToken(element: FormatterElement, token: Token): void {
106
+ #formatToken(element: FormatterElement, token: Token): void {
107
107
  if (Platform.StringUtilities.isWhitespace(token.value)) {
108
108
  return;
109
109
  }
@@ -130,7 +130,7 @@ export class HTMLFormatter {
130
130
  if (isBodyToken && element.name === 'script') {
131
131
  this.#builder.addNewLine();
132
132
  this.#builder.increaseNestingLevel();
133
- if (this.scriptTagIsJavaScript(element)) {
133
+ if (this.#scriptTagIsJavaScript(element)) {
134
134
  this.#jsFormatter.format(this.#text || '', this.#lineEndings || [], token.startOffset, token.endOffset);
135
135
  } else {
136
136
  this.#builder.addToken(token.value, token.startOffset);
@@ -147,7 +147,7 @@ export class HTMLFormatter {
147
147
  this.#builder.addToken(token.value, token.startOffset);
148
148
  }
149
149
 
150
- private scriptTagIsJavaScript(element: FormatterElement): boolean {
150
+ #scriptTagIsJavaScript(element: FormatterElement): boolean {
151
151
  if (!element.openTag) {
152
152
  return true;
153
153
  }
@@ -222,7 +222,7 @@ export class HTMLModel {
222
222
 
223
223
  this.#tokens = [];
224
224
  this.#tokenIndex = 0;
225
- this.build(text);
225
+ this.#build(text);
226
226
 
227
227
  this.#attributes = new Map();
228
228
  this.#attributeName = '';
@@ -230,7 +230,7 @@ export class HTMLModel {
230
230
  this.#isOpenTag = false;
231
231
  }
232
232
 
233
- private build(text: string): void {
233
+ #build(text: string): void {
234
234
  const tokenizer = createTokenizer('text/html');
235
235
  let lastOffset = 0;
236
236
  const lowerCaseText = text.toLowerCase();
@@ -266,7 +266,7 @@ export class HTMLModel {
266
266
  break;
267
267
  }
268
268
 
269
- this.popElement(new Tag(element.name, text.length, text.length, new Map(), false, false));
269
+ this.#popElement(new Tag(element.name, text.length, text.length, new Map(), false, false));
270
270
  }
271
271
 
272
272
  function processToken(
@@ -279,7 +279,7 @@ export class HTMLModel {
279
279
  const tokenType = type ? new Set<string>(type.split(' ')) : new Set<string>();
280
280
  const token = new Token(tokenValue, tokenType, tokenStart, tokenEnd);
281
281
  this.#tokens.push(token);
282
- this.updateDOM(token);
282
+ this.#updateDOM(token);
283
283
 
284
284
  const element = this.#stack[this.#stack.length - 1];
285
285
  if (element && (element.name === 'script' || element.name === 'style') && element.openTag &&
@@ -291,13 +291,13 @@ export class HTMLModel {
291
291
  }
292
292
  }
293
293
 
294
- private updateDOM(token: Token): void {
294
+ #updateDOM(token: Token): void {
295
295
  const value = token.value;
296
296
  const type = token.type;
297
297
  switch (this.#state) {
298
298
  case ParseState.Initial:
299
299
  if (hasTokenInSet(type, 'bracket') && (value === '<' || value === '</')) {
300
- this.onStartTag(token);
300
+ this.#onStartTag(token);
301
301
  this.#state = ParseState.Tag;
302
302
  }
303
303
  return;
@@ -309,7 +309,7 @@ export class HTMLModel {
309
309
  this.#attributes.set(this.#attributeName, '');
310
310
  this.#state = ParseState.AttributeName;
311
311
  } else if (hasTokenInSet(type, 'bracket') && (value === '>' || value === '/>')) {
312
- this.onEndTag(token);
312
+ this.#onEndTag(token);
313
313
  this.#state = ParseState.Initial;
314
314
  }
315
315
  return;
@@ -317,7 +317,7 @@ export class HTMLModel {
317
317
  if (!type.size && value === '=') {
318
318
  this.#state = ParseState.AttributeValue;
319
319
  } else if (hasTokenInSet(type, 'bracket') && (value === '>' || value === '/>')) {
320
- this.onEndTag(token);
320
+ this.#onEndTag(token);
321
321
  this.#state = ParseState.Initial;
322
322
  }
323
323
  return;
@@ -326,14 +326,14 @@ export class HTMLModel {
326
326
  this.#attributes.set(this.#attributeName, value);
327
327
  this.#state = ParseState.Tag;
328
328
  } else if (hasTokenInSet(type, 'bracket') && (value === '>' || value === '/>')) {
329
- this.onEndTag(token);
329
+ this.#onEndTag(token);
330
330
  this.#state = ParseState.Initial;
331
331
  }
332
332
  return;
333
333
  }
334
334
  }
335
335
 
336
- private onStartTag(token: Token): void {
336
+ #onStartTag(token: Token): void {
337
337
  this.#tagName = '';
338
338
  this.#tagStartOffset = token.startOffset;
339
339
  this.#tagEndOffset = null;
@@ -342,46 +342,46 @@ export class HTMLModel {
342
342
  this.#isOpenTag = token.value === '<';
343
343
  }
344
344
 
345
- private onEndTag(token: Token): void {
345
+ #onEndTag(token: Token): void {
346
346
  this.#tagEndOffset = token.endOffset;
347
347
  const selfClosingTag = token.value === '/>' || SelfClosingTags.has(this.#tagName);
348
348
  const tag = new Tag(
349
349
  this.#tagName, this.#tagStartOffset || 0, this.#tagEndOffset, this.#attributes, this.#isOpenTag,
350
350
  selfClosingTag);
351
- this.onTagComplete(tag);
351
+ this.#onTagComplete(tag);
352
352
  }
353
353
 
354
- private onTagComplete(tag: Tag): void {
354
+ #onTagComplete(tag: Tag): void {
355
355
  if (tag.isOpenTag) {
356
356
  const topElement = this.#stack[this.#stack.length - 1];
357
357
  if (topElement) {
358
358
  const tagSet = AutoClosingTags.get(topElement.name);
359
359
  if (topElement !== this.#documentInternal && topElement.openTag && topElement.openTag.selfClosingTag) {
360
- this.popElement(autocloseTag(topElement, topElement.openTag.endOffset));
360
+ this.#popElement(autocloseTag(topElement, topElement.openTag.endOffset));
361
361
  } else if (tagSet && tagSet.has(tag.name)) {
362
- this.popElement(autocloseTag(topElement, tag.startOffset));
362
+ this.#popElement(autocloseTag(topElement, tag.startOffset));
363
363
  }
364
- this.pushElement(tag);
364
+ this.#pushElement(tag);
365
365
  }
366
366
  return;
367
367
  }
368
368
 
369
369
  let lastTag = this.#stack[this.#stack.length - 1];
370
370
  while (this.#stack.length > 1 && lastTag && lastTag.name !== tag.name) {
371
- this.popElement(autocloseTag(lastTag, tag.startOffset));
371
+ this.#popElement(autocloseTag(lastTag, tag.startOffset));
372
372
  lastTag = this.#stack[this.#stack.length - 1];
373
373
  }
374
374
  if (this.#stack.length === 1) {
375
375
  return;
376
376
  }
377
- this.popElement(tag);
377
+ this.#popElement(tag);
378
378
 
379
379
  function autocloseTag(element: FormatterElement, offset: number): Tag {
380
380
  return new Tag(element.name, offset, offset, new Map(), false, false);
381
381
  }
382
382
  }
383
383
 
384
- private popElement(closeTag: Tag): void {
384
+ #popElement(closeTag: Tag): void {
385
385
  const element = this.#stack.pop();
386
386
  if (!element) {
387
387
  return;
@@ -389,7 +389,7 @@ export class HTMLModel {
389
389
  element.closeTag = closeTag;
390
390
  }
391
391
 
392
- private pushElement(openTag: Tag): void {
392
+ #pushElement(openTag: Tag): void {
393
393
  const topElement = this.#stack[this.#stack.length - 1];
394
394
  const newElement = new FormatterElement(openTag.name);
395
395
  if (topElement) {
@@ -59,7 +59,7 @@ export class JavaScriptFormatter {
59
59
  ecmaVersion: ECMA_VERSION,
60
60
  allowHashBang: true,
61
61
  });
62
- const walker = new ESTreeWalker(this.beforeVisit.bind(this), this.afterVisit.bind(this));
62
+ const walker = new ESTreeWalker(this.#beforeVisit.bind(this), this.#afterVisit.bind(this));
63
63
  // @ts-ignore Technically, the acorn Node type is a subclass of Acorn.ESTree.Node.
64
64
  // However, the acorn package currently exports its type without specifying
65
65
  // this relationship. So while this is allowed on runtime, we can't properly
@@ -67,7 +67,7 @@ export class JavaScriptFormatter {
67
67
  walker.walk(ast);
68
68
  }
69
69
 
70
- private push(token: Acorn.Token|Acorn.Comment|null, format: string): void {
70
+ #push(token: Acorn.Token|Acorn.Comment|null, format: string): void {
71
71
  for (let i = 0; i < format.length; ++i) {
72
72
  if (format[i] === 's') {
73
73
  this.#builder.addSoftSpace();
@@ -91,7 +91,7 @@ export class JavaScriptFormatter {
91
91
  }
92
92
  }
93
93
 
94
- private beforeVisit(node: Acorn.ESTree.Node): undefined {
94
+ #beforeVisit(node: Acorn.ESTree.Node): undefined {
95
95
  if (!node.parent) {
96
96
  return;
97
97
  }
@@ -99,23 +99,23 @@ export class JavaScriptFormatter {
99
99
  while ((token = this.#tokenizer.peekToken()) && token.start < node.start) {
100
100
  const token = (this.#tokenizer.nextToken() as TokenOrComment);
101
101
  // @ts-ignore Same reason as above about Acorn types and ESTree types
102
- const format = this.formatToken(node.parent, token);
103
- this.push(token, format);
102
+ const format = this.#formatToken(node.parent, token);
103
+ this.#push(token, format);
104
104
  }
105
105
  return;
106
106
  }
107
107
 
108
- private afterVisit(node: Acorn.ESTree.Node): void {
108
+ #afterVisit(node: Acorn.ESTree.Node): void {
109
109
  let token;
110
110
  while ((token = this.#tokenizer.peekToken()) && token.start < node.end) {
111
111
  const token = (this.#tokenizer.nextToken() as TokenOrComment);
112
- const format = this.formatToken(node, token);
113
- this.push(token, format);
112
+ const format = this.#formatToken(node, token);
113
+ this.#push(token, format);
114
114
  }
115
- this.push(null, this.finishNode(node));
115
+ this.#push(null, this.#finishNode(node));
116
116
  }
117
117
 
118
- private inForLoopHeader(node: Acorn.ESTree.Node): boolean {
118
+ #inForLoopHeader(node: Acorn.ESTree.Node): boolean {
119
119
  const parent = node.parent;
120
120
  if (!parent) {
121
121
  return false;
@@ -131,7 +131,7 @@ export class JavaScriptFormatter {
131
131
  return false;
132
132
  }
133
133
 
134
- private formatToken(node: Acorn.ESTree.Node, tokenOrComment: TokenOrComment): string {
134
+ #formatToken(node: Acorn.ESTree.Node, tokenOrComment: TokenOrComment): string {
135
135
  const AT = AcornTokenizer;
136
136
  if (AT.lineComment(tokenOrComment)) {
137
137
  return 'tn';
@@ -241,7 +241,7 @@ export class JavaScriptFormatter {
241
241
  // it exists. We can't fix that, unless we use proper typechecking
242
242
  allVariablesInitialized = allVariablesInitialized && Boolean(declarations[i].init);
243
243
  }
244
- return !this.inForLoopHeader(node) && allVariablesInitialized ? 'nSSts' : 'ts';
244
+ return !this.#inForLoopHeader(node) && allVariablesInitialized ? 'nSSts' : 'ts';
245
245
  }
246
246
  } else if (node.type === 'PropertyDefinition') {
247
247
  if (AT.punctuator(token, '=')) {
@@ -356,13 +356,13 @@ export class JavaScriptFormatter {
356
356
  return AT.keyword(token) && !AT.keyword(token, 'this') ? 'ts' : 't';
357
357
  }
358
358
 
359
- private finishNode(node: Acorn.ESTree.Node): string {
359
+ #finishNode(node: Acorn.ESTree.Node): string {
360
360
  if (node.type === 'WithStatement') {
361
361
  if (node.body && node.body.type !== 'BlockStatement') {
362
362
  return 'n<';
363
363
  }
364
364
  } else if (node.type === 'VariableDeclaration') {
365
- if (!this.inForLoopHeader(node)) {
365
+ if (!this.#inForLoopHeader(node)) {
366
366
  return 'n';
367
367
  }
368
368
  } else if (node.type === 'ForStatement' || node.type === 'ForOfStatement' || node.type === 'ForInStatement') {