chrome-devtools-frontend 1.0.1626840 → 1.0.1628368

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 (175) hide show
  1. package/front_end/core/common/VersionController.ts +33 -1
  2. package/front_end/core/host/UserMetrics.ts +0 -2
  3. package/front_end/core/root/ExperimentNames.ts +0 -2
  4. package/front_end/core/sdk/CSSContainerQuery.ts +3 -1
  5. package/front_end/core/sdk/CSSModel.ts +23 -0
  6. package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +2 -1
  7. package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +2 -4
  8. package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +3 -2
  9. package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +13 -0
  10. package/front_end/entrypoints/formatter_worker/Substitute.ts +1 -1
  11. package/front_end/entrypoints/main/MainImpl.ts +0 -7
  12. package/front_end/generated/InspectorBackendCommands.ts +1 -1
  13. package/front_end/generated/protocol.ts +1 -0
  14. package/front_end/models/javascript_metadata/NativeFunctions.js +4 -0
  15. package/front_end/panels/common/common.ts +1 -1
  16. package/front_end/panels/console/ConsoleView.ts +2 -2
  17. package/front_end/panels/elements/StylePropertiesSection.ts +6 -2
  18. package/front_end/panels/elements/StylesSidebarPane.ts +8 -7
  19. package/front_end/panels/emulation/DeviceModeToolbar.ts +20 -26
  20. package/front_end/panels/emulation/DeviceModeView.ts +2 -2
  21. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +9 -4
  22. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +7 -6
  23. package/front_end/panels/timeline/TimelineController.ts +1 -2
  24. package/front_end/panels/timeline/TimelinePanel.ts +1 -1
  25. package/front_end/panels/timeline/TimelineUIUtils.ts +2 -10
  26. package/front_end/panels/timeline/timeline-meta.ts +26 -0
  27. package/front_end/third_party/acorn/README.chromium +1 -1
  28. package/front_end/third_party/acorn/acorn.ts +1 -1
  29. package/front_end/third_party/acorn/package/CHANGELOG.md +128 -0
  30. package/front_end/third_party/acorn/package/README.md +42 -19
  31. package/front_end/third_party/acorn/package/dist/acorn.d.mts +883 -26
  32. package/front_end/third_party/acorn/package/dist/acorn.d.ts +859 -268
  33. package/front_end/third_party/acorn/package/dist/acorn.js +420 -115
  34. package/front_end/third_party/acorn/package/dist/acorn.mjs +420 -115
  35. package/front_end/third_party/acorn/package/dist/bin.js +1 -1
  36. package/front_end/third_party/acorn/package/package.json +3 -3
  37. package/front_end/third_party/chromium/README.chromium +1 -1
  38. package/front_end/third_party/puppeteer/README.chromium +2 -2
  39. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
  40. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js +7 -7
  41. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
  42. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.d.ts.map +1 -1
  43. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.js +4 -3
  44. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.js.map +1 -1
  45. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Frame.d.ts +15 -1
  46. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Frame.d.ts.map +1 -1
  47. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Frame.js.map +1 -1
  48. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/JSHandle.js +1 -1
  49. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/JSHandle.js.map +1 -1
  50. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +2 -2
  51. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
  52. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js +4 -3
  53. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
  54. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.d.ts +2 -2
  55. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.d.ts.map +1 -1
  56. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js.map +1 -1
  57. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ExecutionContext.d.ts.map +1 -1
  58. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ExecutionContext.js +1 -0
  59. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ExecutionContext.js.map +1 -1
  60. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Frame.d.ts +2 -5
  61. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Frame.d.ts.map +1 -1
  62. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Frame.js +4 -0
  63. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Frame.js.map +1 -1
  64. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/FrameManager.d.ts.map +1 -1
  65. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/FrameManager.js +3 -1
  66. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/FrameManager.js.map +1 -1
  67. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/IsolatedWorld.js +1 -1
  68. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/IsolatedWorld.js.map +1 -1
  69. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts +1 -0
  70. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
  71. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +3 -0
  72. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
  73. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.d.ts +4 -0
  74. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  75. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.js +2 -2
  76. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.js.map +1 -1
  77. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.d.ts +5 -0
  78. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.d.ts.map +1 -1
  79. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js +9 -1
  80. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js.map +1 -1
  81. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts +5 -1
  82. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map +1 -1
  83. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js +7 -0
  84. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js.map +1 -1
  85. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  86. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  87. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js +6 -3
  88. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js.map +1 -1
  89. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ScreenRecorder.d.ts.map +1 -1
  90. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ScreenRecorder.js +1 -0
  91. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ScreenRecorder.js.map +1 -1
  92. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +1 -1
  93. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +1 -1
  94. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  95. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  96. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  97. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +23 -2
  98. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +171 -149
  99. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
  100. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js +7 -7
  101. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
  102. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.d.ts.map +1 -1
  103. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.js +4 -3
  104. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.js.map +1 -1
  105. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Frame.d.ts +15 -1
  106. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Frame.d.ts.map +1 -1
  107. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Frame.js.map +1 -1
  108. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/JSHandle.js +1 -1
  109. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/JSHandle.js.map +1 -1
  110. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +2 -2
  111. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
  112. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js +4 -3
  113. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
  114. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.d.ts +2 -2
  115. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.d.ts.map +1 -1
  116. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js.map +1 -1
  117. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ExecutionContext.d.ts.map +1 -1
  118. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ExecutionContext.js +1 -0
  119. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ExecutionContext.js.map +1 -1
  120. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Frame.d.ts +2 -5
  121. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Frame.d.ts.map +1 -1
  122. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Frame.js +4 -0
  123. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Frame.js.map +1 -1
  124. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/FrameManager.d.ts.map +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/FrameManager.js +3 -1
  126. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/FrameManager.js.map +1 -1
  127. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/IsolatedWorld.js +1 -1
  128. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/IsolatedWorld.js.map +1 -1
  129. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts +1 -0
  130. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
  131. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +3 -0
  132. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
  133. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.d.ts +4 -0
  134. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  135. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.js +2 -2
  136. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.js.map +1 -1
  137. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.d.ts +5 -0
  138. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.d.ts.map +1 -1
  139. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js +8 -1
  140. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js.map +1 -1
  141. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.d.ts +5 -1
  142. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.d.ts.map +1 -1
  143. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.js +8 -1
  144. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.js.map +1 -1
  145. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  146. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js +6 -3
  147. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js.map +1 -1
  148. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ScreenRecorder.d.ts.map +1 -1
  149. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ScreenRecorder.js +1 -0
  150. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ScreenRecorder.js.map +1 -1
  151. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +1 -1
  152. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +1 -1
  153. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  154. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  155. package/front_end/third_party/puppeteer/package/lib/types.d.ts +23 -2
  156. package/front_end/third_party/puppeteer/package/package.json +2 -2
  157. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +6 -7
  158. package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +4 -3
  159. package/front_end/third_party/puppeteer/package/src/api/Frame.ts +21 -1
  160. package/front_end/third_party/puppeteer/package/src/api/JSHandle.ts +1 -1
  161. package/front_end/third_party/puppeteer/package/src/api/Page.ts +9 -4
  162. package/front_end/third_party/puppeteer/package/src/bidi/Frame.ts +2 -1
  163. package/front_end/third_party/puppeteer/package/src/cdp/ExecutionContext.ts +1 -0
  164. package/front_end/third_party/puppeteer/package/src/cdp/Frame.ts +9 -5
  165. package/front_end/third_party/puppeteer/package/src/cdp/FrameManager.ts +3 -1
  166. package/front_end/third_party/puppeteer/package/src/cdp/IsolatedWorld.ts +1 -1
  167. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +4 -0
  168. package/front_end/third_party/puppeteer/package/src/cdp/TargetManager.ts +2 -2
  169. package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +19 -3
  170. package/front_end/third_party/puppeteer/package/src/common/EventEmitter.ts +10 -1
  171. package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +7 -3
  172. package/front_end/third_party/puppeteer/package/src/node/ScreenRecorder.ts +1 -0
  173. package/front_end/third_party/puppeteer/package/src/revisions.ts +1 -1
  174. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  175. package/package.json +1 -1
@@ -497,16 +497,8 @@ type TimeRangeCategoryStats = Record<string, number>;
497
497
  const {SamplesIntegrator} = Trace.Helpers.SamplesIntegrator;
498
498
 
499
499
  export class TimelineUIUtils {
500
- /**
501
- * use getGetDebugModeEnabled() to query this variable.
502
- */
503
- static debugModeEnabled: boolean|undefined = undefined;
504
500
  static getGetDebugModeEnabled(): boolean {
505
- if (TimelineUIUtils.debugModeEnabled === undefined) {
506
- TimelineUIUtils.debugModeEnabled =
507
- Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.TIMELINE_DEBUG_MODE);
508
- }
509
- return TimelineUIUtils.debugModeEnabled;
501
+ return Common.Settings.Settings.instance().moduleSetting('timeline-debug-mode').get() as boolean;
510
502
  }
511
503
  static frameDisplayName(frame: Protocol.Runtime.CallFrame): string {
512
504
  const maybeResolvedData = SourceMapsResolver.SourceMapsResolver.resolvedCodeLocationForCallFrame(frame);
@@ -1527,7 +1519,7 @@ export class TimelineUIUtils {
1527
1519
  await TimelineUIUtils.generateCauses(event, contentHelper, parsedTrace);
1528
1520
  }
1529
1521
 
1530
- if (Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.TIMELINE_DEBUG_MODE)) {
1522
+ if (TimelineUIUtils.getGetDebugModeEnabled()) {
1531
1523
  TimelineUIUtils.renderEventJson(event, contentHelper);
1532
1524
  }
1533
1525
 
@@ -66,6 +66,14 @@ const UIStrings = {
66
66
  * @description Title of a setting under the Performance category in Settings
67
67
  */
68
68
  timelineShowAllEvents: 'Show all events',
69
+ /**
70
+ * @description Title of a setting under the Performance category in Settings
71
+ */
72
+ timelineDebugMode: 'Timeline debug mode (trace event details, etc.)',
73
+ /**
74
+ * @description Title of a setting under the Performance category in Settings
75
+ */
76
+ timelineInvalidationTracking: 'Invalidation tracking',
69
77
  } as const;
70
78
  const str_ = i18n.i18n.registerUIStrings('panels/timeline/timeline-meta.ts', UIStrings);
71
79
  const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
@@ -327,6 +335,24 @@ Common.Settings.registerSettingExtension({
327
335
  defaultValue: false,
328
336
  });
329
337
 
338
+ Common.Settings.registerSettingExtension({
339
+ category: Common.Settings.SettingCategory.PERFORMANCE,
340
+ storageType: Common.Settings.SettingStorageType.SYNCED,
341
+ title: i18nLazyString(UIStrings.timelineDebugMode),
342
+ settingName: 'timeline-debug-mode',
343
+ settingType: Common.Settings.SettingType.BOOLEAN,
344
+ defaultValue: false,
345
+ });
346
+
347
+ Common.Settings.registerSettingExtension({
348
+ category: Common.Settings.SettingCategory.PERFORMANCE,
349
+ storageType: Common.Settings.SettingStorageType.SYNCED,
350
+ title: i18nLazyString(UIStrings.timelineInvalidationTracking),
351
+ settingName: 'timeline-invalidation-tracking',
352
+ settingType: Common.Settings.SettingType.BOOLEAN,
353
+ defaultValue: false,
354
+ });
355
+
330
356
  // IMPORTANT: if you are updating this, you should also update the setting in
331
357
  // js_timeline-meta.
332
358
  Common.Settings.registerSettingExtension({
@@ -13,5 +13,5 @@ Description:
13
13
  A tiny, fast JavaScript parser written in JavaScript.
14
14
 
15
15
  ```bash
16
- wget -qO- https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz | tar xzf -
16
+ wget -qO- https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz | tar xzf -
17
17
  ```
@@ -7,7 +7,7 @@ import * as acorn from './package/dist/acorn.mjs';
7
7
  import type * as ESTree from './estree-legacy.js';
8
8
  export {ESTree};
9
9
 
10
- export { type Comment, defaultOptions, getLineInfo, isNewLine, lineBreak, lineBreakG, Node, SourceLocation, Token, tokTypes, tokContexts} from './package/dist/acorn.mjs';
10
+ export { type Comment, defaultOptions, getLineInfo, Node, SourceLocation, Token, tokTypes} from './package/dist/acorn.mjs';
11
11
 
12
12
  export const Parser = acorn.Parser;
13
13
  export const tokenizer = acorn.Parser.tokenizer.bind(acorn.Parser);
@@ -1,3 +1,131 @@
1
+ ## 8.16.0 (2026-02-19)
2
+
3
+ ### New features
4
+
5
+ The `sourceType` option can now be set to `"commonjs"` to have the parser treat the top level scope as a function scope.
6
+
7
+ Add support for Unicode 17.
8
+
9
+ ### Bug fixes
10
+
11
+ Don't recognize `await using` as contextual keywords when followed directly by a backslash.
12
+
13
+ Fix an issue where the parser would allow `return` statements in `static` blocks when `allowReturnOutsideFunction` was enabled.
14
+
15
+ Properly reject `using` declarations that appear directly in `switch` or `for` head scopes.
16
+
17
+ Fix some corner case issues in the recognition of `using` syntax.
18
+
19
+ ## 8.15.0 (2025-06-08)
20
+
21
+ ### New features
22
+
23
+ Support `using` and `await using` syntax.
24
+
25
+ The `AnyNode` type is now defined in such a way that plugins can extend it.
26
+
27
+ ### Bug fixes
28
+
29
+ Fix an issue where the `bigint` property of literal nodes for non-decimal bigints had the wrong format.
30
+
31
+ The `acorn` CLI tool no longer crashes when emitting a tree that contains a bigint.
32
+
33
+ ## 8.14.1 (2025-03-05)
34
+
35
+ ### Bug fixes
36
+
37
+ Fix an issue where `await` expressions in class field initializers were inappropriately allowed.
38
+
39
+ Properly allow await inside an async arrow function inside a class field initializer.
40
+
41
+ Mention the source file name in syntax error messages when given.
42
+
43
+ Properly add an empty `attributes` property to every form of `ExportNamedDeclaration`.
44
+
45
+ ## 8.14.0 (2024-10-27)
46
+
47
+ ### New features
48
+
49
+ Support ES2025 import attributes.
50
+
51
+ Support ES2025 RegExp modifiers.
52
+
53
+ ### Bug fixes
54
+
55
+ Support some missing Unicode properties.
56
+
57
+ ## 8.13.0 (2024-10-16)
58
+
59
+ ### New features
60
+
61
+ Upgrade to Unicode 16.0.
62
+
63
+ ## 8.12.1 (2024-07-03)
64
+
65
+ ### Bug fixes
66
+
67
+ Fix a regression that caused Acorn to no longer run on Node versions <8.10.
68
+
69
+ ## 8.12.0 (2024-06-14)
70
+
71
+ ### New features
72
+
73
+ Support ES2025 duplicate capture group names in regular expressions.
74
+
75
+ ### Bug fixes
76
+
77
+ Include `VariableDeclarator` in the `AnyNode` type so that walker objects can refer to it without getting a type error.
78
+
79
+ Properly raise a parse error for invalid `for`/`of` statements using `async` as binding name.
80
+
81
+ Properly recognize \"use strict\" when preceded by a string with an escaped newline.
82
+
83
+ Mark the `Parser` constructor as protected, not private, so plugins can extend it without type errors.
84
+
85
+ Fix a bug where some invalid `delete` expressions were let through when the operand was parenthesized and `preserveParens` was enabled.
86
+
87
+ Properly normalize line endings in raw strings of invalid template tokens.
88
+
89
+ Properly track line numbers for escaped newlines in strings.
90
+
91
+ Fix a bug that broke line number accounting after a template literal with invalid escape sequences.
92
+
93
+ ## 8.11.3 (2023-12-29)
94
+
95
+ ### Bug fixes
96
+
97
+ Add `Function` and `Class` to the `AggregateType` type, so that they can be used in walkers without raising a type error.
98
+
99
+ Make sure `onToken` get an `import` keyword token when parsing `import.meta`.
100
+
101
+ Fix a bug where `.loc.start` could be undefined for `new.target` `meta` nodes.
102
+
103
+ ## 8.11.2 (2023-10-27)
104
+
105
+ ### Bug fixes
106
+
107
+ Fix a bug that caused regular expressions after colon tokens to not be properly tokenized in some circumstances.
108
+
109
+ ## 8.11.1 (2023-10-26)
110
+
111
+ ### Bug fixes
112
+
113
+ Fix a regression where `onToken` would receive 'name' tokens for 'new' keyword tokens.
114
+
115
+ ## 8.11.0 (2023-10-26)
116
+
117
+ ### Bug fixes
118
+
119
+ Fix an issue where tokenizing (without parsing) an object literal with a property named `class` or `function` could, in some circumstance, put the tokenizer into an invalid state.
120
+
121
+ Fix an issue where a slash after a call to a propery named the same as some keywords would be tokenized as a regular expression.
122
+
123
+ ### New features
124
+
125
+ Upgrade to Unicode 15.1.
126
+
127
+ Use a set of new, much more precise, TypeScript types.
128
+
1
129
  ## 8.10.0 (2023-07-05)
2
130
 
3
131
  ### New features
@@ -9,9 +9,7 @@ Acorn is open source software released under an
9
9
 
10
10
  You are welcome to
11
11
  [report bugs](https://github.com/acornjs/acorn/issues) or create pull
12
- requests on [github](https://github.com/acornjs/acorn). For questions
13
- and discussion, please use the
14
- [Tern discussion forum](https://discuss.ternjs.net).
12
+ requests on [github](https://github.com/acornjs/acorn).
15
13
 
16
14
  ## Installation
17
15
 
@@ -28,6 +26,24 @@ git clone https://github.com/acornjs/acorn.git
28
26
  cd acorn
29
27
  npm install
30
28
  ```
29
+ ## Importing acorn
30
+
31
+ ESM as well as CommonJS is supported for all 3: `acorn`, `acorn-walk` and `acorn-loose`.
32
+
33
+ ESM example for `acorn`:
34
+
35
+ ```js
36
+ import * as acorn from "acorn"
37
+ ```
38
+
39
+ CommonJS example for `acorn`:
40
+
41
+ ```js
42
+ let acorn = require("acorn")
43
+ ```
44
+
45
+ ESM is preferred, as it allows better editor auto-completions by offering TypeScript support.
46
+ For this reason, following examples will use ESM imports.
31
47
 
32
48
  ## Interface
33
49
 
@@ -38,8 +54,8 @@ syntax tree object as specified by the [ESTree
38
54
  spec](https://github.com/estree/estree).
39
55
 
40
56
  ```javascript
41
- let acorn = require("acorn");
42
- console.log(acorn.parse("1 + 1", {ecmaVersion: 2020}));
57
+ import * as acorn from "acorn"
58
+ console.log(acorn.parse("1 + 1", {ecmaVersion: 2020}))
43
59
  ```
44
60
 
45
61
  When encountering a syntax error, the parser will raise a
@@ -52,23 +68,23 @@ Options are provided by in a second argument, which should be an
52
68
  object containing any of these fields (only `ecmaVersion` is
53
69
  required):
54
70
 
55
- - **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
56
- either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019),
57
- 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"` (the
58
- latest the library supports). This influences support for strict
59
- mode, the set of reserved words, and support for new syntax
60
- features.
71
+ - **ecmaVersion**: Indicates the ECMAScript version to parse. Can be a
72
+ number, either in year (`2022`) or plain version number (`6`) form,
73
+ or `"latest"` (the latest the library supports). This influences
74
+ support for strict mode, the set of reserved words, and support for
75
+ new syntax features.
61
76
 
62
77
  **NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
63
78
  implemented by Acorn. Other proposed new features must be
64
79
  implemented through plugins.
65
80
 
66
81
  - **sourceType**: Indicate the mode the code should be parsed in. Can be
67
- either `"script"` or `"module"`. This influences global strict mode
82
+ either `"script"`, `"module"` or `"commonjs"`. This influences global strict mode
68
83
  and parsing of `import` and `export` declarations.
69
84
 
70
85
  **NOTE**: If set to `"module"`, then static `import` / `export` syntax
71
- will be valid, even if `ecmaVersion` is less than 6.
86
+ will be valid, even if `ecmaVersion` is less than 6. If set to `"commonjs"`,
87
+ it is the same as `"script"` except that the top-level scope behaves like a function.
72
88
 
73
89
  - **onInsertedSemicolon**: If given a callback, that callback will be
74
90
  called whenever a missing semicolon is inserted by the parser. The
@@ -100,7 +116,7 @@ required):
100
116
  for `ecmaVersion` 2022 and later, `false` for lower versions.
101
117
  Setting this option to `true` allows to have top-level `await`
102
118
  expressions. They are still not allowed in non-`async` functions,
103
- though.
119
+ though. Setting this option to `true` is not allowed when `sourceType: "commonjs"`.
104
120
 
105
121
  - **allowSuperOutsideMethod**: By default, `super` outside a method
106
122
  raises an error. Set this to `true` to accept such code.
@@ -204,6 +220,13 @@ option is enabled). When the token's type is `tokTypes.eof`, you
204
220
  should stop calling the method, since it will keep returning that same
205
221
  token forever.
206
222
 
223
+ Note that tokenizing JavaScript without parsing it is, in modern
224
+ versions of the language, not really possible due to the way syntax is
225
+ overloaded in ways that can only be disambiguated by the parse
226
+ context. This package applies a bunch of heuristics to try and do a
227
+ reasonable job, but you are advised to use `parse` with the `onToken`
228
+ option instead of this.
229
+
207
230
  In ES6 environment, returned result can be used as any other
208
231
  protocol-compliant iterable:
209
232
 
@@ -213,7 +236,7 @@ for (let token of acorn.tokenizer(str)) {
213
236
  }
214
237
 
215
238
  // transform code to array of tokens:
216
- var tokens = [...acorn.tokenizer(str)];
239
+ var tokens = [...acorn.tokenizer(str)]
217
240
  ```
218
241
 
219
242
  **tokTypes** holds an object mapping names to the token type objects
@@ -234,10 +257,10 @@ on the extended version of the class. To extend a parser with plugins,
234
257
  you can use its static `extend` method.
235
258
 
236
259
  ```javascript
237
- var acorn = require("acorn");
238
- var jsx = require("acorn-jsx");
239
- var JSXParser = acorn.Parser.extend(jsx());
240
- JSXParser.parse("foo(<bar/>)", {ecmaVersion: 2020});
260
+ var acorn = require("acorn")
261
+ var jsx = require("acorn-jsx")
262
+ var JSXParser = acorn.Parser.extend(jsx())
263
+ JSXParser.parse("foo(<bar/>)", {ecmaVersion: 2020})
241
264
  ```
242
265
 
243
266
  The `extend` method takes any number of plugin values, and returns a