Use correct package for JavaScript natives

We never install the packages mentioned in that package json
but rely on the node_modules one, so removed.
Also update the packages and types

Bug: none
Change-Id: I0676c36621f39bff7408c5b910f5e4461f3f0158
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6394480
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
This commit is contained in:
Nikolay Vitkov
2025-03-27 00:19:13 -07:00
committed by Devtools-frontend LUCI CQ
parent d23b1aca20
commit a175b3fd0d
91 changed files with 751 additions and 1295 deletions
+16 -5
View File
@@ -1074,7 +1074,9 @@
"license": "MIT"
},
"node_modules/@types/codemirror": {
"version": "5.60.7",
"version": "5.60.15",
"resolved": "https://npm.skia.org/chrome-devtools/@types%2fcodemirror/-/codemirror-5.60.15.tgz",
"integrity": "sha512-dTOvwEQ+ouKJ/rE9LT1Ue2hmP6H1mZv5+CCnNWu2qtiOe2LQa9lCprEY20HxiDmV/Bxh+dXjywmy5aKvoGjULA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -1107,7 +1109,9 @@
"license": "MIT"
},
"node_modules/@types/filesystem": {
"version": "0.0.32",
"version": "0.0.36",
"resolved": "https://npm.skia.org/chrome-devtools/@types%2ffilesystem/-/filesystem-0.0.36.tgz",
"integrity": "sha512-vPDXOZuannb9FZdxgHnqSwAG/jvdGM8Wq+6N4D/d80z+D4HWH+bItqsZaVRQykAn6WEVeEkLm2oQigyHtgb0RA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -1207,7 +1211,9 @@
}
},
"node_modules/@types/webidl2": {
"version": "23.13.6",
"version": "24.4.3",
"resolved": "https://npm.skia.org/chrome-devtools/@types%2fwebidl2/-/webidl2-24.4.3.tgz",
"integrity": "sha512-Rn7VaRM3TmzA3nPgwSOqC8MGzzY2W8J7f0IPEf2g5Ga0e6jCsuLRHF+O0gywp3gh37IE/quCWCbNDTwAdKeFKw==",
"dev": true,
"license": "MIT"
},
@@ -9146,9 +9152,14 @@
}
},
"node_modules/webidl2": {
"version": "24.2.2",
"version": "24.4.1",
"resolved": "https://npm.skia.org/chrome-devtools/webidl2/-/webidl2-24.4.1.tgz",
"integrity": "sha512-cPToqvZlxTAlaMucZyU28XtFLJz3XPdTdIWK/r3IaP1jfkjqne3OTniJS8DZqfzee1aBUQn80d6s2vYert50kg==",
"dev": true,
"license": "W3C"
"license": "W3C",
"engines": {
"node": ">= 14"
}
},
"node_modules/which": {
"version": "1.3.1",
Generated Vendored Executable → Regular
View File
Generated Vendored Executable → Regular
+1 -2
View File
@@ -8,9 +8,8 @@ This package contains type definitions for codemirror (https://github.com/codemi
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/codemirror.
### Additional Details
* Last updated: Mon, 23 Jan 2023 16:32:34 GMT
* Last updated: Wed, 22 Nov 2023 00:24:48 GMT
* Dependencies: [@types/tern](https://npmjs.com/package/@types/tern)
* Global values: `CodeMirror`
# Credits
These definitions were written by [mihailik](https://github.com/mihailik), [nrbernard](https://github.com/nrbernard), [Pr1st0n](https://github.com/Pr1st0n), [rileymiller](https://github.com/rileymiller), [toddself](https://github.com/toddself), [ysulyma](https://github.com/ysulyma), [azoson](https://github.com/azoson), [kylesferrazza](https://github.com/kylesferrazza), [fityocsaba96](https://github.com/fityocsaba96), [koddsson](https://github.com/koddsson), and [ficristo](https://github.com/ficristo).
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface Editor {
/** Tries to uncomment the current selection, and if that fails, line-comments it. */
toggleComment(options?: CommentOptions): void;
+3 -3
View File
@@ -1,12 +1,12 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface EditorConfiguration {
/**
* if true, the editor will make the next line continue a comment when
* pressing the Enter key. If set to a string, it will continue comments
* using a custom shortcut.
*/
continueComments?: boolean | string | { key: string, continueLineComment?: boolean | undefined } | undefined;
continueComments?: boolean | string | { key: string; continueLineComment?: boolean | undefined } | undefined;
}
}
Generated Vendored Executable → Regular
+13 -5
View File
@@ -1,4 +1,4 @@
import '../../';
import "../../";
export type DialogCloseFunction = () => void;
@@ -25,11 +25,19 @@ export interface OpenNotificationOptions extends DialogOptions {
duration?: number | undefined;
}
declare module '../../' {
declare module "../../" {
interface Editor {
/** Provides a very simple way to query users for text input. */
openDialog(template: string | Node, callback: (value: string, e: Event) => void, options?: OpenDialogOptions): DialogCloseFunction;
openNotification(template: string | Node, options?: OpenNotificationOptions): DialogCloseFunction;
openConfirm(template: string | Node, callbacks: ReadonlyArray<(editor: Editor) => void>, options?: DialogOptions): DialogCloseFunction;
openDialog(
template: string | Node,
callback: (value: string, e: Event) => void,
options?: OpenDialogOptions,
): DialogCloseFunction;
openNotification(template: string | Node, options?: OpenNotificationOptions): DialogCloseFunction;
openConfirm(
template: string | Node,
callbacks: ReadonlyArray<(editor: Editor) => void>,
options?: DialogOptions,
): DialogCloseFunction;
}
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface EditorConfiguration {
// if true, it will be refreshed the first time the editor becomes visible.
// you can pass delay (msec) time as polling duration
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface EditorConfiguration {
/**
* When set to true, will make the editor full-screen (as in, taking up the whole browser window).
Generated Vendored Executable → Regular
+3 -3
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface Panel {
/** Removes the panel from the editor */
clear(): void;
@@ -16,7 +16,7 @@ declare module '../../' {
* `bottom`: Adds the panel at the very bottom.
* `before-bottom`: Adds the panel at the top of the bottom panels.
*/
position?: 'top' | 'after-top' | 'bottom' | 'before-bottom' | undefined;
position?: "top" | "after-top" | "bottom" | "before-bottom" | undefined;
/** The new panel will be added before the given panel. */
before?: Panel | undefined;
/** The new panel will be added after the given panel. */
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface EditorConfiguration {
/**
* Adds a placeholder option that can be used to make content appear in the editor when it is empty and not focused.
Generated Vendored Executable → Regular
+3 -3
View File
@@ -1,4 +1,4 @@
import '../../';
import "../../";
export interface Ruler {
column: number;
@@ -8,9 +8,9 @@ export interface Ruler {
width?: string | undefined;
}
declare module '../../' {
declare module "../../" {
interface EditorConfiguration {
/** show one or more vertical rulers in the editor. */
rulers?: false | ReadonlyArray<number | Ruler> | undefined;
rulers?: false | ReadonlyArray<number | Ruler> | undefined;
}
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface AutoCloseBrackets {
/**
* String containing pairs of matching characters.
Generated Vendored Executable → Regular
+5 -5
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface CommandActions {
closeTag(cm: Editor): void;
}
@@ -19,19 +19,19 @@ declare module '../../' {
/**
* An array of tag names that should not be autoclosed. (default is empty tags for HTML, none for XML)
*/
dontCloseTags?: ReadonlyArray<string> | undefined;
dontCloseTags?: readonly string[] | undefined;
/**
* An array of tag names that should, when opened, cause a
* blank line to be added inside the tag, and the blank line and
* closing line to be indented. (default is block tags for HTML, none for XML)
*/
indentTags?: ReadonlyArray<string> | undefined;
indentTags?: readonly string[] | undefined;
/**
* An array of XML tag names that should be autoclosed with '/>'. (default is none)
*/
emptyTags: ReadonlyArray<string>;
emptyTags: readonly string[];
}
interface EditorConfiguration {
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface CommandActions {
newlineAndIndentContinueMarkdownList(cm: Editor): void | typeof Pass;
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface MatchBrackets {
/**
* Only use the character after the start position, never the one before it.
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface CommandActions {
/**
* You can bind a key to in order to jump to the tag matching the one under the cursor.
Generated Vendored Executable → Regular
+3 -3
View File
@@ -1,8 +1,8 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface EditorConfiguration {
/** when enabled, adds the CSS class cm-trailingspace to stretches of whitespace at the end of lines. */
showTrailingSpace?: boolean | undefined;
showTrailingSpace?: boolean | undefined;
}
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import './foldcode';
import "./foldcode";
declare module './foldcode' {
declare module "./foldcode" {
interface FoldHelpers {
brace: FoldRangeFinder;
import: FoldRangeFinder;
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import './foldcode';
import "./foldcode";
declare module './foldcode' {
declare module "./foldcode" {
interface FoldHelpers {
comment: FoldRangeFinder;
}
Generated Vendored Executable → Regular
+3 -3
View File
@@ -1,6 +1,6 @@
// See docs https://codemirror.net/doc/manual.html#addon_foldcode
import * as CodeMirror from '../../';
import * as CodeMirror from "../../";
export type FoldRangeFinder = (cm: CodeMirror.Editor, pos: CodeMirror.Position) => CodeMirror.FoldRange | undefined;
@@ -9,7 +9,7 @@ export interface FoldHelpers {
auto: FoldRangeFinder;
}
declare module '../../' {
declare module "../../" {
interface Editor {
/**
* Helps with code folding. Adds a foldCode method to editor instances, which will try to do a code fold starting at the given line,
@@ -20,7 +20,7 @@ declare module '../../' {
foldCode: (
lineOrPos: number | Position,
rangeFindeOrFoldOptions?: FoldRangeFinder | FoldOptions,
force?: 'fold' | 'unfold',
force?: "fold" | "unfold",
) => void;
isFolded(pos: Position): boolean | undefined;
foldOption<K extends keyof FoldOptions>(option: K): FoldOptions[K];
Generated Vendored Executable → Regular
+13 -2
View File
@@ -1,8 +1,8 @@
// See docs https://codemirror.net/doc/manual.html#addon_foldgutter
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface EditorConfiguration {
/**
* Provides an option foldGutter, which can be used to create a gutter with markers indicating the blocks that can be folded.
@@ -10,6 +10,11 @@ declare module '../../' {
foldGutter?: boolean | FoldGutterOptions | undefined;
}
interface FoldRange {
from: Position;
to: Position;
}
interface FoldGutterOptions {
/**
* The CSS class of the gutter. Defaults to "CodeMirror-foldgutter". You will have to style this yourself to give it a width (and possibly a background).
@@ -25,5 +30,11 @@ declare module '../../' {
* A CSS class or DOM element to be used as the marker for folded blocks. Defaults to "CodeMirror-foldgutter-folded".
*/
indicatorFolded?: string | Element | undefined;
/*
* The range-finder function to use when determining whether something can be folded.
* When not given, CodeMirror.fold.auto will be used as default.
*/
rangeFinder?: (cm: Editor, pos: Position) => FoldRange | undefined;
}
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import './foldcode';
import "./foldcode";
declare module './foldcode' {
declare module "./foldcode" {
interface FoldHelpers {
indent: FoldRangeFinder;
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import './foldcode';
import "./foldcode";
declare module './foldcode' {
declare module "./foldcode" {
interface FoldHelpers {
markdown: FoldRangeFinder;
}
Generated Vendored Executable → Regular
+15 -6
View File
@@ -1,5 +1,5 @@
import * as CodeMirror from '../../';
import './foldcode';
import * as CodeMirror from "../../";
import "./foldcode";
export interface XmlTag {
from: CodeMirror.Position;
@@ -7,16 +7,25 @@ export interface XmlTag {
tag: string;
}
declare module './foldcode' {
declare module "./foldcode" {
interface FoldHelpers {
xml: FoldRangeFinder;
}
}
declare module '../../' {
function findMatchingTag(cm: Editor, pos: Position, range: Range): {open: XmlTag, close: XmlTag | null | undefined, at: 'open' | 'close'} | undefined;
declare module "../../" {
function findMatchingTag(
cm: Editor,
pos: Position,
range: Range,
): { open: XmlTag; close: XmlTag | null | undefined; at: "open" | "close" } | undefined;
function findEnclosingTag(cm: Editor, pos: Position, range: Range, tag: string): {open: XmlTag, close: XmlTag} | undefined;
function findEnclosingTag(
cm: Editor,
pos: Position,
range: Range,
tag: string,
): { open: XmlTag; close: XmlTag } | undefined;
function scanForClosingTag(cm: Editor, pos: Position, name: string, end?: Position): XmlTag | null | undefined;
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import './show-hint';
import "./show-hint";
declare module '../../' {
declare module "../../" {
interface HintHelpers {
anyword: HintFunction;
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import './show-hint';
import "./show-hint";
declare module '../../' {
declare module "../../" {
interface HintHelpers {
css: HintFunction;
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import './xml-hint';
import "./xml-hint";
declare module '../../' {
declare module "../../" {
interface HintHelpers {
html: HintFunction;
}
+2 -2
View File
@@ -1,6 +1,6 @@
import './show-hint';
import "./show-hint";
declare module '../../' {
declare module "../../" {
interface HintHelpers {
javascript: HintFunction;
coffeescript: HintFunction;
Generated Vendored Executable → Regular
+12 -5
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
/**
* Provides a framework for showing autocompletion hints. Defines editor.showHint, which takes an optional
* options object, and pops up a widget that allows the user to select a completion. Finding hints is done with
@@ -13,7 +13,11 @@ declare module '../../' {
function on<T extends keyof CompletionEventMap>(hints: Hints, eventName: T, handler: CompletionEventMap[T]): void;
function off<T extends keyof CompletionEventMap>(hints: Hints, eventName: T, handler: CompletionEventMap[T]): void;
function signal<T extends keyof CompletionEventMap>(hints: Hints, eventName: T, ...args: Parameters<CompletionEventMap[T]>): void;
function signal<T extends keyof CompletionEventMap>(
hints: Hints,
eventName: T,
...args: Parameters<CompletionEventMap[T]>
): void;
interface CompletionEventMap {
shown: () => void;
@@ -81,12 +85,15 @@ declare module '../../' {
updateOnCursorActivity?: boolean | undefined;
completeOnSingleClick?: boolean | undefined;
container?: HTMLElement | null | undefined;
customKeys?: { [key: string]: ((editor: Editor, handle: CompletionHandle) => void) | string } | null | undefined;
customKeys?:
| { [key: string]: ((editor: Editor, handle: CompletionHandle) => void) | string }
| null
| undefined;
extraKeys?: { [key: string]: ((editor: Editor, handle: CompletionHandle) => void) | string } | null | undefined;
scrollMargin?: number | undefined;
paddingForScrollbar?: boolean | undefined;
moveOnOverlap?: boolean | undefined;
words?: ReadonlyArray<string> | undefined; // used by fromList
words?: readonly string[] | undefined; // used by fromList
}
/** The Handle used to interact with the autocomplete dialog box. */
Generated Vendored Executable → Regular
+6 -3
View File
@@ -1,6 +1,6 @@
import './show-hint';
import "./show-hint";
declare module '../../' {
declare module "../../" {
interface HintHelpers {
sql: HintFunction;
}
@@ -10,7 +10,10 @@ declare module '../../' {
}
interface ShowHintOptions {
tables?: ReadonlyArray<string | { text: string, columns: string[] }> | Record<string, string[] | { columns: string[] }> | undefined;
tables?:
| ReadonlyArray<string | { text: string; columns: string[] }>
| Record<string, string[] | { columns: string[] }>
| undefined;
defaultTable?: string | undefined;
disableKeywords?: boolean | undefined;
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import './show-hint';
import "./show-hint";
declare module '../../' {
declare module "../../" {
interface HintHelpers {
xml: HintFunction;
}
+2 -2
View File
@@ -1,6 +1,6 @@
import { Linter } from './lint';
import { Linter } from "./lint";
declare module '../../' {
declare module "../../" {
namespace lint {
const coffeescript: Linter<{}>;
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import { Linter } from './lint';
import { Linter } from "./lint";
declare module '../../' {
declare module "../../" {
namespace lint {
const css: Linter<any>;
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import { Linter } from './lint';
import { Linter } from "./lint";
declare module '../../' {
declare module "../../" {
namespace lint {
const html: Linter<any>;
}
+2 -2
View File
@@ -1,6 +1,6 @@
import { Linter } from './lint';
import { Linter } from "./lint";
declare module '../../' {
declare module "../../" {
namespace lint {
const javascript: Linter<any>;
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import { Linter } from './lint';
import { Linter } from "./lint";
declare module '../../' {
declare module "../../" {
namespace lint {
const json: Linter<{}>;
}
Generated Vendored Executable → Regular
+9 -5
View File
@@ -1,4 +1,4 @@
import * as CodeMirror from '../../';
import * as CodeMirror from "../../";
export interface BaseLintStateOptions<T> {
/** debounce delay before linting onChange */
@@ -13,7 +13,11 @@ export interface BaseLintStateOptions<T> {
selfContain?: boolean | undefined;
/** callback after linter completes */
onUpdateLinting?(annotationsNotSorted: Annotation[], annotations: Annotation[], codeMirror: CodeMirror.Editor): void;
onUpdateLinting?(
annotationsNotSorted: Annotation[],
annotations: Annotation[],
codeMirror: CodeMirror.Editor,
): void;
/**
* Passing rules in `options` property prevents JSHint (and other linters) from complaining
@@ -22,7 +26,7 @@ export interface BaseLintStateOptions<T> {
options?: T | undefined;
/** controls display of lint tooltips */
tooltips?: boolean | 'gutter' | undefined;
tooltips?: boolean | "gutter" | undefined;
}
export interface SyncLintStateOptions<T> extends BaseLintStateOptions<T> {
@@ -41,7 +45,7 @@ export type LintStateOptions<T> = SyncLintStateOptions<T> | AsyncLintStateOption
/**
* A function that return errors found during the linting process.
*/
export interface Linter<T> {
export interface Linter<T> {
(content: string, options: T, codeMirror: CodeMirror.Editor):
| Annotation[]
| PromiseLike<Annotation[]>;
@@ -78,7 +82,7 @@ export interface Annotation {
to?: CodeMirror.Position | undefined;
}
declare module '../../' {
declare module "../../" {
interface Editor {
performLint: () => void;
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import { Linter } from './lint';
import { Linter } from "./lint";
declare module '../../' {
declare module "../../" {
namespace lint {
const yaml: Linter<{}>;
}
Generated Vendored Executable → Regular
+20 -13
View File
@@ -1,4 +1,4 @@
import * as CodeMirror from '../../';
import * as CodeMirror from "../../";
/**
* Tracks changes in chunks from original to new.
@@ -49,7 +49,7 @@ export interface MergeView {
}
export interface MergeViewConstructor {
new (element: HTMLElement, options?: MergeViewConfiguration): MergeView;
new(element: HTMLElement, options?: MergeViewConfiguration): MergeView;
(element: HTMLElement, options?: MergeViewConfiguration): MergeView;
}
@@ -77,7 +77,12 @@ export interface MergeViewConfiguration extends CodeMirror.EditorConfiguration {
/**
* Callback for when stretches of unchanged text are collapsed.
*/
onCollapse?(mergeView: MergeView, line: number, size: number, mark: CodeMirror.TextMarker<CodeMirror.MarkerRange>): void;
onCollapse?(
mergeView: MergeView,
line: number,
size: number,
mark: CodeMirror.TextMarker<CodeMirror.MarkerRange>,
): void;
/**
* Provides original version of the document to be shown on the right of the editor.
@@ -101,15 +106,17 @@ export interface MergeViewConfiguration extends CodeMirror.EditorConfiguration {
*/
revertButtons?: boolean | undefined;
revertChunk?: ((
mv: MergeView,
from: CodeMirror.Editor,
fromStart: CodeMirror.Position,
fromEnd: CodeMirror.Position,
to: CodeMirror.Editor,
toStart: CodeMirror.Position,
toEnd: CodeMirror.Position
) => void) | undefined;
revertChunk?:
| ((
mv: MergeView,
from: CodeMirror.Editor,
fromStart: CodeMirror.Position,
fromEnd: CodeMirror.Position,
to: CodeMirror.Editor,
toStart: CodeMirror.Position,
toEnd: CodeMirror.Position,
) => void)
| undefined;
/**
* When true, changed pieces of text are highlighted. Defaults to true.
@@ -117,7 +124,7 @@ export interface MergeViewConfiguration extends CodeMirror.EditorConfiguration {
showDifferences?: boolean | undefined;
}
declare module '../../' {
declare module "../../" {
const MergeView: MergeViewConstructor;
interface CommandActions {
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,11 +1,11 @@
import '../../';
import "../../";
export interface RequireModeOptions {
path?(mode: string): string;
loadMode?(file: string, callback: () => void): void;
}
declare module '../../' {
declare module "../../" {
let modeURL: string;
function requireMode(mode: string | { name: string }, callback: () => void, options?: RequireModeOptions): void;
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,4 +1,4 @@
import * as CodeMirror from '../../';
import * as CodeMirror from "../../";
export interface MultiplexedInnerMode {
open: string;
@@ -9,7 +9,7 @@ export interface MultiplexedInnerMode {
innerStyle?: string | undefined;
}
declare module '../../' {
declare module "../../" {
/**
* Mode combinator that can be used to easily 'multiplex' between several modes.
* When given as first argument a mode object, and as other arguments any number of
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
/**
* Mode combinator that can be used to extend a mode with an 'overlay' — a secondary mode is run over the stream,
* along with the base mode, and can color specific pieces of text without interfering with the base mode.
Generated Vendored Executable → Regular
+4 -4
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
// Based on https://codemirror.net/demo/simplemode.html
interface Rule {
regex?: string | RegExp | undefined;
@@ -21,7 +21,7 @@ declare module '../../' {
function defineSimpleMode<K extends string>(
name: string,
// eslint-disable-next-line no-unnecessary-generics
mode: { [P in K]: P extends 'meta' ? Record<string, any> : Rule[] } & { start: Rule[] },
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
mode: { [P in K]: P extends "meta" ? Record<string, any> : Rule[] } & { start: Rule[] },
): void;
}
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
/**
* Provides a convenient way to syntax-highlight code snippets in a webpage. Depends on the runmode addon (or its standalone variant).
* Can be called with an array (or other array-ish collection) of DOM nodes that represent the code snippets. By default, it'll get all pre tags.
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
/**
* Runs a CodeMirror mode over text without opening an editor instance.
*
+4 -4
View File
@@ -1,12 +1,12 @@
import * as CodeMirror from '../..';
import './searchcursor';
import * as CodeMirror from "../..";
import "./searchcursor";
export interface Annotation {
clear(): void;
/**
* Updates the ranges to be highlighted. The array must be sorted.
*/
update(annotations: Array<{ from: CodeMirror.Position, to: CodeMirror.Position }>): void;
update(annotations: Array<{ from: CodeMirror.Position; to: CodeMirror.Position }>): void;
}
export interface AnnotateScrollbarOptions {
@@ -15,7 +15,7 @@ export interface AnnotateScrollbarOptions {
listenForChanges?: boolean | undefined;
}
declare module '../../' {
declare module "../../" {
interface Editor {
annotateScrollbar(options: string | AnnotateScrollbarOptions): Annotation;
}
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface EditorConfiguration {
/**
* When the end of the file is reached it allows you to keep scrolling so that your last few lines of code are not stuck at the bottom of the editor.
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface ScrollbarModels {
simple: ScrollbarModelConstructor;
overlay: ScrollbarModelConstructor;
Generated Vendored Executable → Regular
+3 -3
View File
@@ -1,7 +1,7 @@
import '../..';
import '../dialog/dialog';
import "../..";
import "../dialog/dialog";
declare module '../../' {
declare module "../../" {
interface CommandActions {
jumpToLine(cm: Editor): void;
}
+2 -2
View File
@@ -1,8 +1,8 @@
// See docs https://codemirror.net/doc/manual.html#addon_match-highlighter
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface HighlightSelectionMatches {
/**
* Minimum amount of selected characters that triggers a highlight (default 2).
+3 -3
View File
@@ -1,11 +1,11 @@
import '../..';
import './searchcursor';
import "../..";
import "./searchcursor";
export interface SearchAnnotation {
clear(): void;
}
declare module '../../' {
declare module "../../" {
interface Editor {
showMatchesOnScrollbar(query: string | RegExp, caseFold?: boolean, className?: string): SearchAnnotation;
}
Generated Vendored Executable → Regular
+4 -4
View File
@@ -1,8 +1,8 @@
import '../../';
import './searchcursor';
import '../dialog/dialog';
import "../../";
import "./searchcursor";
import "../dialog/dialog";
declare module '../../' {
declare module "../../" {
interface CommandActions {
find(cm: Editor): void;
findPersistent(cm: Editor): void;
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface DocOrEditor {
/**
* This method can be used to implement search/replace functionality.
+2 -2
View File
@@ -1,6 +1,6 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface StyleActiveLine {
/**
* Controls whether single-line selections, or just cursor selections, are styled. Defaults to false (only cursor selections).
+3 -3
View File
@@ -1,11 +1,11 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface EditorConfiguration {
/**
* Causes the selected text to be marked with the CSS class CodeMirror-selectedtext or a custom class when the styleSelectedText option is enabled.
* Useful to change the colour of the selection (in addition to the background).
*/
styleSelectedText?: boolean | string | undefined;
styleSelectedText?: boolean | string | undefined;
}
}
+3 -3
View File
@@ -1,11 +1,11 @@
import '../../';
import "../../";
declare module '../../' {
declare module "../../" {
interface EditorConfiguration {
/**
* Controls the mouse cursor appearance when hovering over the selection. It can be set to a string, like "pointer", or to true,
* in which case the "default" (arrow) cursor will be used.
*/
selectionPointer?: boolean | string | undefined;
selectionPointer?: boolean | string | undefined;
}
}
Generated Vendored Executable → Regular
+6 -6
View File
@@ -1,10 +1,10 @@
// See docs https://codemirror.net/doc/manual.html#addon_tern and https://codemirror.net/addon/tern/tern.js (comments in the beginning of the file)
// Docs for tern itself might also be helpful: http://ternjs.net/doc/manual.html
import * as Tern from 'tern';
import '../../';
import * as Tern from "tern";
import "../../";
declare module '../../' {
declare module "../../" {
class TernServer {
constructor(options?: TernOptions);
@@ -40,10 +40,10 @@ declare module '../../' {
callback: (error?: Error, data?: Tern.QueryResult<Q>) => void,
pos?: Position,
): void;
request<Q extends Tern.Query['type']>(
request<Q extends Tern.Query["type"]>(
cm: Doc,
query: Q,
callback: (error?: Error, data?: Tern.QueryRegistry[Q]['result']) => void,
callback: (error?: Error, data?: Tern.QueryRegistry[Q]["result"]) => void,
pos?: Position,
): void;
destroy(): void;
@@ -51,7 +51,7 @@ declare module '../../' {
interface TernOptions {
/** An object mapping plugin names to configuration options. */
plugins?: Tern.ConstructorOptions['plugins'] | undefined;
plugins?: Tern.ConstructorOptions["plugins"] | undefined;
/** An array of JSON definition data structures. */
defs?: Tern.Def[] | undefined;
/**
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,4 +1,4 @@
import '../../';
import "../../";
export interface HardwrapOptions {
column?: number | undefined;
@@ -9,7 +9,7 @@ export interface HardwrapOptions {
forceBreak?: boolean | undefined;
}
declare module '../../' {
declare module "../../" {
interface CommandActions {
wrapLines(cm: Editor): void;
}
Generated Vendored Executable → Regular
+113 -69
View File
@@ -1,28 +1,15 @@
// Type definitions for codemirror 5.60
// Project: https://github.com/codemirror/CodeMirror
// Definitions by: mihailik <https://github.com/mihailik>
// nrbernard <https://github.com/nrbernard>
// Pr1st0n <https://github.com/Pr1st0n>
// rileymiller <https://github.com/rileymiller>
// toddself <https://github.com/toddself>
// ysulyma <https://github.com/ysulyma>
// azoson <https://github.com/azoson>
// kylesferrazza <https://github.com/kylesferrazza>
// fityocsaba96 <https://github.com/fityocsaba96>
// koddsson <https://github.com/koddsson>
// ficristo <https://github.com/ficristo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 5.0
export = CodeMirror;
export as namespace CodeMirror;
declare function CodeMirror(place: ParentNode | ((host: HTMLElement) => void), options?: CodeMirror.EditorConfiguration): CodeMirror.Editor;
declare function CodeMirror(
place: ParentNode | ((host: HTMLElement) => void),
options?: CodeMirror.EditorConfiguration,
): CodeMirror.Editor;
declare namespace CodeMirror {
const Doc: DocConstructor;
const Pos: PositionConstructor;
const Pass: { toString(): 'CodeMirror.PASS' };
const Pass: { toString(): "CodeMirror.PASS" };
/** Find the column position at a given string index using a given tabsize. */
function countColumn(line: string, index: number | null, tabSize: number): number;
@@ -151,16 +138,40 @@ declare namespace CodeMirror {
function on<T extends keyof DocEventMap>(doc: Doc, eventName: T, handler: DocEventMap[T]): void;
function on<T extends keyof EditorEventMap>(cm: Editor, eventName: T, handler: EditorEventMap[T]): void;
function on<T extends keyof LineHandleEventMap>(lineHandle: LineHandle, eventName: T, handler: LineHandleEventMap[T]): void;
function on<T extends keyof TextMarkerEventMap>(textMarker: TextMarker<unknown>, eventName: T, handler: TextMarkerEventMap[T]): void;
function on<T extends keyof LineWidgetEventMap>(LineWidget: LineWidget, eventName: T, handler: LineWidgetEventMap[T]): void;
function on<T extends keyof LineHandleEventMap>(
lineHandle: LineHandle,
eventName: T,
handler: LineHandleEventMap[T],
): void;
function on<T extends keyof TextMarkerEventMap>(
textMarker: TextMarker<unknown>,
eventName: T,
handler: TextMarkerEventMap[T],
): void;
function on<T extends keyof LineWidgetEventMap>(
LineWidget: LineWidget,
eventName: T,
handler: LineWidgetEventMap[T],
): void;
function on(element: any, eventName: string, handler: () => void): void;
function off<T extends keyof DocEventMap>(doc: Doc, eventName: T, handler: DocEventMap[T]): void;
function off<T extends keyof EditorEventMap>(cm: Editor, eventName: T, handler: EditorEventMap[T]): void;
function off<T extends keyof LineHandleEventMap>(lineHandle: LineHandle, eventName: T, handler: LineHandleEventMap[T]): void;
function off<T extends keyof TextMarkerEventMap>(textMarker: TextMarker<unknown>, eventName: T, handler: TextMarkerEventMap[T]): void;
function off<T extends keyof LineWidgetEventMap>(lineWidget: LineWidget, eventName: T, handler: LineWidgetEventMap[T]): void;
function off<T extends keyof LineHandleEventMap>(
lineHandle: LineHandle,
eventName: T,
handler: LineHandleEventMap[T],
): void;
function off<T extends keyof TextMarkerEventMap>(
textMarker: TextMarker<unknown>,
eventName: T,
handler: TextMarkerEventMap[T],
): void;
function off<T extends keyof LineWidgetEventMap>(
lineWidget: LineWidget,
eventName: T,
handler: LineWidgetEventMap[T],
): void;
function off(element: any, eventName: string, handler: () => void): void;
/**
@@ -169,33 +180,49 @@ declare namespace CodeMirror {
* To fire your own events, use CodeMirror.signal(target, name, args...), where target is a non-DOM-node object.
*/
function signal<T extends keyof DocEventMap>(doc: Doc, eventName: T, ...args: Parameters<DocEventMap[T]>): void;
function signal<T extends keyof EditorEventMap>(cm: Editor, eventName: T, ...args: Parameters<EditorEventMap[T]>): void;
function signal<T extends keyof LineHandleEventMap>(lineHandle: LineHandle, eventName: T, ...args: Parameters<LineHandleEventMap[T]>): void;
function signal<T extends keyof TextMarkerEventMap>(textMarker: TextMarker<unknown>, eventName: T, ...args: Parameters<TextMarkerEventMap[T]>): void;
function signal<T extends keyof LineWidgetEventMap>(lineWidget: LineWidget, eventName: T, ...args: Parameters<LineWidgetEventMap[T]>): void;
function signal<T extends keyof EditorEventMap>(
cm: Editor,
eventName: T,
...args: Parameters<EditorEventMap[T]>
): void;
function signal<T extends keyof LineHandleEventMap>(
lineHandle: LineHandle,
eventName: T,
...args: Parameters<LineHandleEventMap[T]>
): void;
function signal<T extends keyof TextMarkerEventMap>(
textMarker: TextMarker<unknown>,
eventName: T,
...args: Parameters<TextMarkerEventMap[T]>
): void;
function signal<T extends keyof LineWidgetEventMap>(
lineWidget: LineWidget,
eventName: T,
...args: Parameters<LineWidgetEventMap[T]>
): void;
function signal(target: any, name: string, ...args: any[]): void;
/** Modify a keymap to normalize modifier order and properly recognize multi-stroke bindings. */
function normalizeKeyMap(km: KeyMap): KeyMap;
type DOMEvent =
| 'mousedown'
| 'dblclick'
| 'touchstart'
| 'contextmenu'
| 'keydown'
| 'keypress'
| 'keyup'
| 'cut'
| 'copy'
| 'paste'
| 'dragstart'
| 'dragenter'
| 'dragover'
| 'dragleave'
| 'drop';
| "mousedown"
| "dblclick"
| "touchstart"
| "contextmenu"
| "keydown"
| "keypress"
| "keyup"
| "cut"
| "copy"
| "paste"
| "dragstart"
| "dragenter"
| "dragover"
| "dragleave"
| "drop";
type CoordsMode = 'window' | 'page' | 'local' | 'div';
type CoordsMode = "window" | "page" | "local" | "div";
interface Token {
/** The character(on the given line) at which the token starts. */
@@ -211,6 +238,7 @@ declare namespace CodeMirror {
}
interface KeyMap {
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
[keyName: string]: false | string | ((instance: Editor) => void | typeof Pass);
}
@@ -277,7 +305,7 @@ declare namespace CodeMirror {
* Currently, only the opaque option is recognized. This defaults to off, but can be given to allow the overlay styling, when not null,
* to override the styling of the base mode entirely, instead of the two being applied together.
*/
addOverlay(mode: any, options?: {opaque?: boolean | undefined, priority?: number | undefined}): void;
addOverlay(mode: any, options?: { opaque?: boolean | undefined; priority?: number | undefined }): void;
/** Pass this the exact argument passed for the mode parameter to addOverlay to remove an overlay again. */
removeOverlay(mode: any): void;
@@ -408,8 +436,13 @@ declare namespace CodeMirror {
* The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well.
*/
scrollIntoView(
pos: Position | null | { line: number; ch: number } | { left: number; top: number; right: number; bottom: number } | { from: Position; to: Position },
margin?: number
pos: Position | null | { line: number; ch: number } | {
left: number;
top: number;
right: number;
bottom: number;
} | { from: Position; to: Position },
margin?: number,
): void;
/**
@@ -418,7 +451,10 @@ declare namespace CodeMirror {
* If it is "page" or not given, they are relative to the top-left corner of the page.
* where specifies the position at which you want to measure. A boolean indicates either the start(true) or the end(false) of the selection.
*/
cursorCoords(where?: boolean | Position | null, mode?: CoordsMode): { left: number; top: number; bottom: number };
cursorCoords(
where?: boolean | Position | null,
mode?: CoordsMode,
): { left: number; top: number; bottom: number };
/**
* Returns the position and dimensions of an arbitrary character. pos should be a { line , ch } object.
@@ -616,7 +652,7 @@ declare namespace CodeMirror {
base?: string | undefined;
/** Below options are supported in HTML mixed mode */
tags?: {[key: string]: unknown} | undefined;
tags?: { [key: string]: unknown } | undefined;
/** Below options are supported in JavaScript mixed mode */
@@ -711,9 +747,11 @@ declare namespace CodeMirror {
alignCDATA?: boolean | undefined;
}
type ModeSpec<T> = {
[P in keyof T]: T[P];
} & { name: string };
type ModeSpec<T> =
& {
[P in keyof T]: T[P];
}
& { name: string };
interface SelectionOptions {
/**
@@ -740,7 +778,7 @@ declare namespace CodeMirror {
}
interface DocConstructor {
new (text: string, mode?: string | ModeSpec<ModeSpecOptions>, firstLineNumber?: number, lineSep?: string): Doc;
new(text: string, mode?: string | ModeSpec<ModeSpecOptions>, firstLineNumber?: number, lineSep?: string): Doc;
(text: string, mode?: string | ModeSpec<ModeSpecOptions>, firstLineNumber?: number, lineSep?: string): Doc;
}
@@ -1181,7 +1219,7 @@ declare namespace CodeMirror {
}
interface PositionConstructor {
new (line: number, ch?: number, sticky?: string): Position;
new(line: number, ch?: number, sticky?: string): Position;
(line: number, ch?: number, sticky?: string): Position;
}
@@ -1218,14 +1256,17 @@ declare namespace CodeMirror {
}
interface ScrollbarModel {
update(measure: ScrollbarMeasure): { bottom: number, right: number };
update(measure: ScrollbarMeasure): { bottom: number; right: number };
clear(): void;
setScrollLeft(pos: number): void;
setScrollTop(pos: number): void;
}
interface ScrollbarModelConstructor {
new(place: (node: Element) => void, scroll: (pos: number, axis: 'horizontal' | 'vertical') => void): ScrollbarModel;
new(
place: (node: Element) => void,
scroll: (pos: number, axis: "horizontal" | "vertical") => void,
): ScrollbarModel;
}
interface ScrollbarModels {
@@ -1235,7 +1276,7 @@ declare namespace CodeMirror {
const scrollbarModel: ScrollbarModels;
type InputStyle = 'textarea' | 'contenteditable';
type InputStyle = "textarea" | "contenteditable";
interface EditorConfiguration {
/** The starting value of the editor. Can be a string, or a document object. */
@@ -1319,11 +1360,13 @@ declare namespace CodeMirror {
extraKeys?: string | KeyMap | undefined;
/** Allows you to configure the behavior of mouse selection and dragging. The function is called when the left mouse button is pressed. */
configureMouse?: ((
cm: Editor,
repeat: 'single' | 'double' | 'triple',
event: Event,
) => MouseSelectionConfiguration) | undefined;
configureMouse?:
| ((
cm: Editor,
repeat: "single" | "double" | "triple",
event: Event,
) => MouseSelectionConfiguration)
| undefined;
/** Whether CodeMirror should scroll or wrap for long lines. Defaults to false (scroll). */
lineWrapping?: boolean | undefined;
@@ -1373,7 +1416,7 @@ declare namespace CodeMirror {
inputStyle?: InputStyle | undefined;
/** boolean|string. This disables editing of the editor content by the user. If the special value "nocursor" is given (instead of simply true), focusing of the editor is also disallowed. */
readOnly?: boolean | 'nocursor' | undefined;
readOnly?: boolean | "nocursor" | undefined;
/** This label is read by the screenreaders when CodeMirror text area is focused. This is helpful for accessibility. */
screenReaderLabel?: string | undefined;
@@ -1414,7 +1457,7 @@ declare namespace CodeMirror {
* This option determines the return value of that method. When it is null or an object that doesn't have a property named by
* the input string, that string is returned. Otherwise, the value of the property corresponding to that string is returned.
*/
phrases?: {[s: string]: unknown} | undefined;
phrases?: { [s: string]: unknown } | undefined;
/** Controls whether drag-and - drop is enabled. On by default. */
dragDrop?: boolean | undefined;
@@ -1989,11 +2032,12 @@ declare namespace CodeMirror {
* (or, on Chrome OS, meta-shift-clicks), and "single" otherwise.
*/
unit?:
| 'char'
| 'word'
| 'line'
| 'rectangle'
| ((cm: Editor, pos: Position) => { from: Position; to: Position }) | undefined;
| "char"
| "word"
| "line"
| "rectangle"
| ((cm: Editor, pos: Position) => { from: Position; to: Position })
| undefined;
/**
* Whether to extend the existing selection range or start
Generated Vendored Executable → Regular
+2 -2
View File
@@ -1,4 +1,4 @@
import '../';
import "../";
export interface ModeInfo {
name: string;
@@ -10,7 +10,7 @@ export interface ModeInfo {
alias?: string[] | undefined;
}
declare module '../' {
declare module "../" {
const modeInfo: ModeInfo[];
function findModeByMIME(mime: string): ModeInfo | undefined;
function findModeByExtension(ext: string): ModeInfo | undefined;
Generated Vendored Executable → Regular
+24 -24
View File
@@ -1,64 +1,64 @@
{
"name": "@types/codemirror",
"version": "5.60.7",
"version": "5.60.15",
"description": "TypeScript definitions for codemirror",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/codemirror",
"license": "MIT",
"contributors": [
{
"name": "mihailik",
"url": "https://github.com/mihailik",
"githubUsername": "mihailik"
"githubUsername": "mihailik",
"url": "https://github.com/mihailik"
},
{
"name": "nrbernard",
"url": "https://github.com/nrbernard",
"githubUsername": "nrbernard"
"githubUsername": "nrbernard",
"url": "https://github.com/nrbernard"
},
{
"name": "Pr1st0n",
"url": "https://github.com/Pr1st0n",
"githubUsername": "Pr1st0n"
"githubUsername": "Pr1st0n",
"url": "https://github.com/Pr1st0n"
},
{
"name": "rileymiller",
"url": "https://github.com/rileymiller",
"githubUsername": "rileymiller"
"githubUsername": "rileymiller",
"url": "https://github.com/rileymiller"
},
{
"name": "toddself",
"url": "https://github.com/toddself",
"githubUsername": "toddself"
"githubUsername": "toddself",
"url": "https://github.com/toddself"
},
{
"name": "ysulyma",
"url": "https://github.com/ysulyma",
"githubUsername": "ysulyma"
"githubUsername": "ysulyma",
"url": "https://github.com/ysulyma"
},
{
"name": "azoson",
"url": "https://github.com/azoson",
"githubUsername": "azoson"
"githubUsername": "azoson",
"url": "https://github.com/azoson"
},
{
"name": "kylesferrazza",
"url": "https://github.com/kylesferrazza",
"githubUsername": "kylesferrazza"
"githubUsername": "kylesferrazza",
"url": "https://github.com/kylesferrazza"
},
{
"name": "fityocsaba96",
"url": "https://github.com/fityocsaba96",
"githubUsername": "fityocsaba96"
"githubUsername": "fityocsaba96",
"url": "https://github.com/fityocsaba96"
},
{
"name": "koddsson",
"url": "https://github.com/koddsson",
"githubUsername": "koddsson"
"githubUsername": "koddsson",
"url": "https://github.com/koddsson"
},
{
"name": "ficristo",
"url": "https://github.com/ficristo",
"githubUsername": "ficristo"
"githubUsername": "ficristo",
"url": "https://github.com/ficristo"
}
],
"main": "",
@@ -72,6 +72,6 @@
"dependencies": {
"@types/tern": "*"
},
"typesPublisherContentHash": "f067b8804757c2f7229d13402ce33491527908c1db787878b6a86d81cdf2b814",
"typesPublisherContentHash": "54e0c0ddc3a9697697700c91f38c2b02a1b34c09f84a5c7e8795d9f5b92618c2",
"typeScriptVersion": "5.0"
}
Generated Vendored Executable → Regular
View File
Generated Vendored Executable → Regular
+2 -3
View File
@@ -2,15 +2,14 @@
> `npm install --save @types/filesystem`
# Summary
This package contains type definitions for File System API (http://www.w3.org/TR/file-system-api/).
This package contains type definitions for filesystem (http://www.w3.org/TR/file-system-api/).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/filesystem.
### Additional Details
* Last updated: Tue, 06 Jul 2021 20:32:58 GMT
* Last updated: Thu, 21 Mar 2024 19:06:57 GMT
* Dependencies: [@types/filewriter](https://npmjs.com/package/@types/filewriter)
* Global values: none
# Credits
These definitions were written by [Kon](http://phyzkit.net/).
Generated Vendored Executable → Regular
+31 -15
View File
@@ -1,12 +1,6 @@
// Type definitions for File System API
// Project: http://www.w3.org/TR/file-system-api/
// Definitions by: Kon <http://phyzkit.net/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="filewriter" />
interface LocalFileSystem {
/**
* Used for storage with no guarantee of persistence.
*/
@@ -24,7 +18,12 @@ interface LocalFileSystem {
* @param successCallback The callback that is called when the user agent provides a filesystem.
* @param errorCallback A callback that is called when errors happen, or when the request to obtain the filesystem is denied.
*/
requestFileSystem(type: number, size: number, successCallback: FileSystemCallback, errorCallback?: ErrorCallback): void;
requestFileSystem(
type: number,
size: number,
successCallback: FileSystemCallback,
errorCallback?: ErrorCallback,
): void;
/**
* Allows the user to look up the Entry for a file or directory referred to by a local URL.
@@ -37,7 +36,12 @@ interface LocalFileSystem {
/**
* see requestFileSystem.
*/
webkitRequestFileSystem(type: number, size: number, successCallback: FileSystemCallback, errorCallback?: ErrorCallback): void;
webkitRequestFileSystem(
type: number,
size: number,
successCallback: FileSystemCallback,
errorCallback?: ErrorCallback,
): void;
}
interface LocalFileSystemSync {
@@ -110,7 +114,6 @@ interface FileSystem {
}
interface FileSystemEntry {
/**
* Entry is a file.
*/
@@ -157,7 +160,12 @@ interface FileSystemEntry {
* A move of a file on top of an existing file must attempt to delete and replace that file.
* A move of a directory on top of an existing empty directory must attempt to delete and replace that directory.
*/
moveTo(parent: FileSystemDirectoryEntry, newName?: string, successCallback?: EntryCallback, errorCallback?: ErrorCallback): void;
moveTo(
parent: FileSystemDirectoryEntry,
newName?: string,
successCallback?: EntryCallback,
errorCallback?: ErrorCallback,
): void;
/**
* Copy an entry to a different location on the file system. It is an error to try to:
@@ -174,12 +182,17 @@ interface FileSystemEntry {
*
* Directory copies are always recursive--that is, they copy all contents of the directory.
*/
copyTo(parent: FileSystemDirectoryEntry, newName?: string, successCallback?: EntryCallback, errorCallback?: ErrorCallback): void;
copyTo(
parent: FileSystemDirectoryEntry,
newName?: string,
successCallback?: EntryCallback,
errorCallback?: ErrorCallback,
): void;
/**
* Returns a URL that can be used to identify this entry. Unlike the URN defined in [FILE-API-ED], it has no specific expiration; as it describes a location on disk, it should be valid at least as long as that location exists.
*/
toURL(): string;
toURL(mimeType?: string): string;
/**
* Deletes a file or directory. It is an error to attempt to delete a directory that is not empty. It is an error to attempt to delete the root directory of a filesystem.
@@ -237,9 +250,13 @@ interface FileSystemDirectoryEntry extends FileSystemEntry {
* </ul>
* @param successCallback A callback that is called to return the DirectoryEntry selected or created.
* @param errorCallback A callback that is called when errors happen.
*
*/
getDirectory(path: string, options?: Flags, successCallback?: DirectoryEntryCallback, errorCallback?: ErrorCallback): void;
getDirectory(
path: string,
options?: Flags,
successCallback?: DirectoryEntryCallback,
errorCallback?: ErrorCallback,
): void;
/**
* Deletes a directory and all of its contents, if any. In the event of an error [e.g. trying to delete a directory that contains a file that cannot be removed], some of the contents of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem.
@@ -371,7 +388,6 @@ interface ErrorCallback {
(err: Error): void;
}
/**
* This interface represents a file system.
*/
Generated Vendored Executable → Regular
+4 -4
View File
@@ -1,7 +1,7 @@
{
"name": "@types/filesystem",
"version": "0.0.32",
"description": "TypeScript definitions for File System API",
"version": "0.0.36",
"description": "TypeScript definitions for filesystem",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/filesystem",
"license": "MIT",
"contributors": [
@@ -21,6 +21,6 @@
"dependencies": {
"@types/filewriter": "*"
},
"typesPublisherContentHash": "97fb04b43b89c4d9999eff0867ecc75f6f14d0dff427000e9f45f08af02932ae",
"typeScriptVersion": "3.6"
"typesPublisherContentHash": "df13d0739a4c80f9d834170c83eb0285fdd638e7e22ab9d000be34cf7cbfa73d",
"typeScriptVersion": "4.7"
}
Generated Vendored Executable → Regular
View File
Generated Vendored Executable → Regular
+2 -3
View File
@@ -8,9 +8,8 @@ This package contains type definitions for webidl2 (https://github.com/w3c/webid
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webidl2.
### Additional Details
* Last updated: Fri, 02 Jul 2021 18:05:21 GMT
* Last updated: Tue, 07 Nov 2023 15:11:36 GMT
* Dependencies: none
* Global values: `WebIDL2`
# Credits
These definitions were written by [Kagama Sascha Rosylight](https://github.com/saschanaz), and [ExE Boss](https://github.com/ExE-Boss).
These definitions were written by [Kagama Sascha Rosylight](https://github.com/saschanaz), [ExE Boss](https://github.com/ExE-Boss), and [Vinyl Da.i'gyu-Kazotetsu](https://github.com/queengooborg).
Generated Vendored Executable → Regular
+94 -18
View File
@@ -1,13 +1,9 @@
// Type definitions for webidl2 23.13
// Project: https://github.com/w3c/webidl2.js#readme
// Definitions by: Kagama Sascha Rosylight <https://github.com/saschanaz>
// ExE Boss <https://github.com/ExE-Boss>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace WebIDL2;
export {};
export function parse(str: string, options?: ParseOptions): IDLRootType[];
export function write(ast: IDLRootType[], options?: WriteOptions): string;
export function validate(ast: IDLRootType[]): WebIDLErrorData[];
export type IDLRootType =
| CallbackType
@@ -42,7 +38,90 @@ export interface ParseOptions {
sourceName?: string | undefined;
}
export class WebIDLParseError extends Error {
export interface WriteOptions {
templates?: {
/**
* A function that receives syntax strings plus anything the templates returned.
* The items are guaranteed to be ordered.
* The returned value may be again passed to any template functions,
* or it may also be the final return value of `write()`.
* @param items
*/
wrap?(items: any[]): any;
/**
* @param t A trivia string, which includes whitespaces and comments.
*/
trivia?(t: string): string;
/**
* The identifier for a container type. For example, the `Foo` part of `interface Foo {};`.
* @param escaped The escaped raw name of the definition.
* @param data The definition with the name
* @param parent The parent of the definition, undefined if absent
*/
name?(escaped: string, { data, parent }: { data: any; parent: any }): string;
/**
* Called for each type referece, e.g. `Window`, `DOMString`, or `unsigned long`.
* @param escaped The referenced name. Typically string, but may also be the return
* value of `wrap()` if the name contains whitespace.
* @param unescaped Unescaped reference.
*/
reference?(escaped: any, unescaped: any): any;
/**
* Called for each generic-form syntax, e.g. `sequence`, `Promise`, or `maplike`.
* @param name The keyword for syntax
*/
generic?(name: string): string;
/**
* Called for each nameless members, e.g. `stringifier` for `stringifier;` and `constructor` for `constructor();`
* @param keyword The keyword for syntax
*/
nameless?(keyword: string, { data, parent }: { data: any; parent: any }): string;
/**
* Called only once for each types, e.g. `Document`, `Promise<DOMString>`, or `sequence<long>`.
* @param type The `wrap()`ed result of references and syntatic bracket strings.
*/
type?(type: any): any;
/**
* Receives the return value of `reference()`. String if it's absent.
*/
inheritance?(inh: any): any;
/**
* Called for each IDL type definition, e.g. an interface, an operation, or a typedef.
* @param content The wrapped value of everything the definition contains.
* @param data The original definition object
* @param parent The parent of the definition, undefined if absent
*/
definition?(content: any, { data, parent }: { data: any; parent: any }): any;
/**
* Called for each extended attribute annotation.
* @param content The wrapped value of everything the annotation contains.
*/
extendedAttribute?(content: any): any;
/**
* The `Foo` part of `[Foo=Whatever]`.
* @param ref The name of the referenced extended attribute name.
*/
extendedAttributeReference?(ref: any): any;
};
}
export class WebIDLError extends Error {
/** the error message */
message: string;
bareMessage: string;
/** the line at which the error occurred. */
context: string;
line: number;
sourceName: string | undefined;
/** a short peek at the text at the point where the error happened */
input: string;
/** the five tokens at the point of error, as understood by the tokeniser */
tokens: Token[];
}
export class WebIDLParseError extends WebIDLError {
constructor(options: {
message: string;
bareMessage: string;
@@ -54,20 +133,17 @@ export class WebIDLParseError extends Error {
});
name: "WebIDLParseError";
}
/** the error message */
message: string;
bareMessage: string;
export class WebIDLErrorData extends WebIDLError {
/** the level of error */
level: "error" | "warning";
context: string;
/** the line at which the error occurred. */
line: number;
sourceName: string | undefined;
/** A function to automatically fix the error */
autofix?(): void;
/** a short peek at the text at the point where the error happened */
input: string;
/** the five tokens at the point of error, as understood by the tokeniser */
tokens: Token[];
/** The name of the rule that threw the error */
ruleName: string;
}
export interface Token {
Generated Vendored Executable → Regular
+12 -7
View File
@@ -1,19 +1,24 @@
{
"name": "@types/webidl2",
"version": "23.13.6",
"version": "24.4.3",
"description": "TypeScript definitions for webidl2",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webidl2",
"license": "MIT",
"contributors": [
{
"name": "Kagama Sascha Rosylight",
"url": "https://github.com/saschanaz",
"githubUsername": "saschanaz"
"githubUsername": "saschanaz",
"url": "https://github.com/saschanaz"
},
{
"name": "ExE Boss",
"url": "https://github.com/ExE-Boss",
"githubUsername": "ExE-Boss"
"githubUsername": "ExE-Boss",
"url": "https://github.com/ExE-Boss"
},
{
"name": "Vinyl Da.i'gyu-Kazotetsu",
"githubUsername": "queengooborg",
"url": "https://github.com/queengooborg"
}
],
"main": "",
@@ -25,6 +30,6 @@
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "fe84834833de7896ee668da8f30d95d4e74b63c05ea966b5e9c2361ccab3c220",
"typeScriptVersion": "3.6"
"typesPublisherContentHash": "70d9a3cd3f1dc7aaf5f503d5cfc886eb18d28971181de12eb2822763a0956d1d",
"typeScriptVersion": "4.5"
}
+1
View File
@@ -199,6 +199,7 @@ properties:
* `no-constructible-global`: Interfaces with `[Global]` cannot have constructors.
* `renamed-legacy`: Legacy extended attributes must use their new names.
* `replace-void`: `void` type is replaced by `undefined` type.
* `migrate-allowshared`: `[AllowShared] BufferSource` is replaced by `AllowSharedBufferSource`.
* `input`: a short peek at the text at the point where the error happened
* `tokens`: the five tokens at the point of error, as understood by the tokeniser
(this is the same content as `input`, but seen from the tokeniser's point of view)
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+29 -26
View File
@@ -1,5 +1,8 @@
import { validationError } from "../error.js";
import { idlTypeIncludesDictionary } from "../validators/helpers.js";
import {
idlTypeIncludesDictionary,
idlTypeIncludesEnforceRange,
} from "../validators/helpers.js";
import { Base } from "./base.js";
import {
type_with_extended_attributes,
@@ -72,32 +75,32 @@ export class Attribute extends Base {
yield* this.extAttrs.validate(defs);
yield* this.idlType.validate(defs);
switch (this.idlType.generic) {
case "sequence":
case "record": {
const message = `Attributes cannot accept ${this.idlType.generic} types.`;
yield validationError(
this.tokens.name,
this,
"attr-invalid-type",
message
);
break;
if (["sequence", "record"].includes(this.idlType.generic)) {
const message = `Attributes cannot accept ${this.idlType.generic} types.`;
yield validationError(
this.tokens.name,
this,
"attr-invalid-type",
message
);
}
{
const { reference } = idlTypeIncludesDictionary(this.idlType, defs) || {};
if (reference) {
const targetToken = (this.idlType.union ? reference : this.idlType)
.tokens.base;
const message = "Attributes cannot accept dictionary types.";
yield validationError(targetToken, this, "attr-invalid-type", message);
}
default: {
const { reference } =
idlTypeIncludesDictionary(this.idlType, defs) || {};
if (reference) {
const targetToken = (this.idlType.union ? reference : this.idlType)
.tokens.base;
const message = "Attributes cannot accept dictionary types.";
yield validationError(
targetToken,
this,
"attr-invalid-type",
message
);
}
}
if (this.readonly) {
if (idlTypeIncludesEnforceRange(this.idlType, defs)) {
const targetToken = this.idlType.tokens.base;
const message =
"Readonly attributes cannot accept [EnforceRange] extended attribute.";
yield validationError(targetToken, this, "attr-invalid-type", message);
}
}
}
+5 -2
View File
@@ -5,8 +5,11 @@ import { Constant } from "./constant.js";
export class CallbackInterface extends Container {
/**
* @param {import("../tokeniser.js").Tokeniser} tokeniser
* @param {*} callback
* @param {object} [options]
* @param {import("./container.js").AllowedMember[]} [options.extMembers]
*/
static parse(tokeniser, callback, { partial = null } = {}) {
static parse(tokeniser, callback, { extMembers = [] } = {}) {
const tokens = { callback };
tokens.base = tokeniser.consume("interface");
if (!tokens.base) {
@@ -16,8 +19,8 @@ export class CallbackInterface extends Container {
tokeniser,
new CallbackInterface({ source: tokeniser.source, tokens }),
{
inheritable: !partial,
allowedMembers: [
...extMembers,
[Constant.parse],
[Operation.parse, { regular: true }],
],
+13
View File
@@ -16,6 +16,19 @@ function inheritance(tokeniser) {
return { colon, inheritance };
}
/**
* Parser callback.
* @callback ParserCallback
* @param {import("../tokeniser.js").Tokeniser} tokeniser
* @param {...*} args
*/
/**
* A parser callback and optional option object.
* @typedef AllowedMember
* @type {[ParserCallback, object?]}
*/
export class Container extends Base {
/**
* @param {import("../tokeniser.js").Tokeniser} tokeniser
+3 -2
View File
@@ -5,9 +5,10 @@ export class Dictionary extends Container {
/**
* @param {import("../tokeniser.js").Tokeniser} tokeniser
* @param {object} [options]
* @param {import("./container.js").AllowedMember[]} [options.extMembers]
* @param {import("../tokeniser.js").Token} [options.partial]
*/
static parse(tokeniser, { partial } = {}) {
static parse(tokeniser, { extMembers = [], partial } = {}) {
const tokens = { partial };
tokens.base = tokeniser.consume("dictionary");
if (!tokens.base) {
@@ -18,7 +19,7 @@ export class Dictionary extends Container {
new Dictionary({ source: tokeniser.source, tokens }),
{
inheritable: !partial,
allowedMembers: [[Field.parse]],
allowedMembers: [...extMembers, [Field.parse]],
}
);
}
+17
View File
@@ -0,0 +1,17 @@
export { Argument } from "./argument.js";
export { Attribute } from "./attribute.js";
export { Base } from "./base.js";
export { Constant } from "./constant.js";
export { Constructor } from "./constructor.js";
export { Container } from "./container.js";
export { Default } from "./default.js";
export {
ExtendedAttributes,
SimpleExtendedAttribute,
} from "./extended-attributes.js";
export { Field } from "./field.js";
export { IterableLike } from "./iterable.js";
export { Operation } from "./operation.js";
export { Type } from "./type.js";
export { autoParenter, argument_list, unescape } from "./helpers.js";
+6 -1
View File
@@ -34,8 +34,12 @@ function static_member(tokeniser) {
export class Interface extends Container {
/**
* @param {import("../tokeniser.js").Tokeniser} tokeniser
* @param {import("../tokeniser.js").Token} base
* @param {object} [options]
* @param {import("./container.js").AllowedMember[]} [options.extMembers]
* @param {import("../tokeniser.js").Token|null} [options.partial]
*/
static parse(tokeniser, base, { partial = null } = {}) {
static parse(tokeniser, base, { extMembers = [], partial = null } = {}) {
const tokens = { partial, base };
return Container.parse(
tokeniser,
@@ -43,6 +47,7 @@ export class Interface extends Container {
{
inheritable: !partial,
allowedMembers: [
...extMembers,
[Constant.parse],
[Constructor.parse],
[static_member],
+5 -5
View File
@@ -6,14 +6,13 @@ import { stringifier } from "./helpers.js";
export class Mixin extends Container {
/**
* @typedef {import("../tokeniser.js").Token} Token
*
* @param {import("../tokeniser.js").Tokeniser} tokeniser
* @param {Token} base
* @param {import("../tokeniser.js").Token} base
* @param {object} [options]
* @param {Token} [options.partial]
* @param {import("./container.js").AllowedMember[]} [options.extMembers]
* @param {import("../tokeniser.js").Token} [options.partial]
*/
static parse(tokeniser, base, { partial } = {}) {
static parse(tokeniser, base, { extMembers = [], partial } = {}) {
const tokens = { partial, base };
tokens.mixin = tokeniser.consume("mixin");
if (!tokens.mixin) {
@@ -24,6 +23,7 @@ export class Mixin extends Container {
new Mixin({ source: tokeniser.source, tokens }),
{
allowedMembers: [
...extMembers,
[Constant.parse],
[stringifier],
[Attribute.parse, { noInherit: true }],
+3 -1
View File
@@ -9,9 +9,10 @@ export class Namespace extends Container {
/**
* @param {import("../tokeniser.js").Tokeniser} tokeniser
* @param {object} [options]
* @param {import("./container.js").AllowedMember[]} [options.extMembers]
* @param {import("../tokeniser.js").Token} [options.partial]
*/
static parse(tokeniser, { partial } = {}) {
static parse(tokeniser, { extMembers = [], partial } = {}) {
const tokens = { partial };
tokens.base = tokeniser.consume("namespace");
if (!tokens.base) {
@@ -22,6 +23,7 @@ export class Namespace extends Container {
new Namespace({ source: tokeniser.source, tokens }),
{
allowedMembers: [
...extMembers,
[Attribute.parse, { noInherit: true, readonly: true }],
[Constant.parse],
[Operation.parse, { regular: true }],
+2 -4
View File
@@ -9,12 +9,10 @@ import { validationError } from "../error.js";
export class Operation extends Base {
/**
* @typedef {import("../tokeniser.js").Token} Token
*
* @param {import("../tokeniser.js").Tokeniser} tokeniser
* @param {object} [options]
* @param {Token} [options.special]
* @param {Token} [options.regular]
* @param {import("../tokeniser.js").Token} [options.special]
* @param {import("../tokeniser.js").Token} [options.regular]
*/
static parse(tokeniser, { special, regular } = {}) {
const tokens = { special };
+38 -1
View File
@@ -129,7 +129,7 @@ function union_type(tokeniser, type) {
ret.type = type || null;
while (true) {
const typ =
type_with_extended_attributes(tokeniser) ||
type_with_extended_attributes(tokeniser, type) ||
tokeniser.error("No type after open parenthesis or 'or' in union type");
if (typ.idlType === "any")
tokeniser.error("Type `any` cannot be included in a union type");
@@ -194,6 +194,26 @@ export class Type extends Base {
*validate(defs) {
yield* this.extAttrs.validate(defs);
if (this.idlType === "BufferSource") {
// XXX: For now this is a hack. Consider moving parents' extAttrs into types as the spec says:
// https://webidl.spec.whatwg.org/#idl-annotated-types
for (const extAttrs of [this.extAttrs, this.parent?.extAttrs]) {
for (const extAttr of extAttrs) {
if (extAttr.name !== "AllowShared") {
continue;
}
const message = `\`[AllowShared] BufferSource\` is now replaced with AllowSharedBufferSource.`;
yield validationError(
this.tokens.base,
this,
"migrate-allowshared",
message,
{ autofix: replaceAllowShared(this, extAttr, extAttrs) }
);
}
}
}
if (this.idlType === "void") {
const message = `\`void\` is now replaced by \`undefined\`. Refer to the \
[relevant GitHub issue](https://github.com/whatwg/webidl/issues/60) \
@@ -273,6 +293,23 @@ for more information.`;
}
}
/**
* @param {Type} type
* @param {import("./extended-attributes.js").SimpleExtendedAttribute} extAttr
* @param {ExtendedAttributes} extAttrs
*/
function replaceAllowShared(type, extAttr, extAttrs) {
return () => {
const index = extAttrs.indexOf(extAttr);
extAttrs.splice(index, 1);
if (!extAttrs.length && type.tokens.base.trivia.match(/^\s$/)) {
type.tokens.base.trivia = ""; // (let's not remove comments)
}
type.tokens.base.value = "AllowSharedBufferSource";
};
}
/**
* @param {Type} type
*/
+1
View File
@@ -18,6 +18,7 @@ const tokenRe = {
export const typeNameKeywords = [
"ArrayBuffer",
"SharedArrayBuffer",
"DataView",
"Int8Array",
"Int16Array",
+34 -4
View File
@@ -1,8 +1,10 @@
/**
* @typedef {import("../validator.js").Definitions} Definitions
* @typedef {import("../productions/dictionary.js").Dictionary} Dictionary
* @typedef {import("../../lib/productions/type").Type} Type
*
* @param {*} idlType
* @param {import("../validator.js").Definitions} defs
* @param {Type} idlType
* @param {Definitions} defs
* @param {object} [options]
* @param {boolean} [options.useNullableInner] use when the input idlType is nullable and you want to use its inner type
* @return {{ reference: *, dictionary: Dictionary }} the type reference that ultimately includes dictionary.
@@ -56,8 +58,8 @@ export function idlTypeIncludesDictionary(
}
/**
* @param {*} dict dictionary type
* @param {import("../validator.js").Definitions} defs
* @param {Dictionary} dict dictionary type
* @param {Definitions} defs
* @return {boolean}
*/
export function dictionaryIncludesRequiredField(dict, defs) {
@@ -80,3 +82,31 @@ export function dictionaryIncludesRequiredField(dict, defs) {
defs.cache.dictionaryIncludesRequiredField.set(dict, result);
return result;
}
/**
* For now this only checks the most frequent cases:
* 1. direct inclusion of [EnforceRange]
* 2. typedef of that
*
* More complex cases with dictionaries and records are not covered yet.
*
* @param {Type} idlType
* @param {Definitions} defs
*/
export function idlTypeIncludesEnforceRange(idlType, defs) {
if (idlType.union) {
// TODO: This should ideally be checked too
return false;
}
if (idlType.extAttrs.some((e) => e.name === "EnforceRange")) {
return true;
}
const def = defs.unique.get(idlType.idlType);
if (def?.type !== "typedef") {
return false;
}
return def.idlType.extAttrs.some((e) => e.name === "EnforceRange");
}
+40 -18
View File
@@ -12,11 +12,22 @@ import { CallbackInterface } from "./productions/callback-interface.js";
import { autoParenter } from "./productions/helpers.js";
import { Eof } from "./productions/token.js";
/** @typedef {'callbackInterface'|'dictionary'|'interface'|'mixin'|'namespace'} ExtendableInterfaces */
/** @typedef {{ extMembers?: import("./productions/container.js").AllowedMember[]}} Extension */
/** @typedef {Partial<Record<ExtendableInterfaces, Extension>>} Extensions */
/**
* Parser options.
* @typedef {Object} ParserOptions
* @property {string} [sourceName]
* @property {boolean} [concrete]
* @property {Function[]} [productions]
* @property {Extensions} [extensions]
*/
/**
* @param {Tokeniser} tokeniser
* @param {object} options
* @param {boolean} [options.concrete]
* @param {Function[]} [options.productions]
* @param {ParserOptions} options
*/
function parseByTokens(tokeniser, options) {
const source = tokeniser.source;
@@ -33,7 +44,9 @@ function parseByTokens(tokeniser, options) {
const callback = consume("callback");
if (!callback) return;
if (tokeniser.probe("interface")) {
return CallbackInterface.parse(tokeniser, callback);
return CallbackInterface.parse(tokeniser, callback, {
...options?.extensions?.callbackInterface,
});
}
return CallbackFunction.parse(tokeniser, callback);
}
@@ -41,20 +54,32 @@ function parseByTokens(tokeniser, options) {
function interface_(opts) {
const base = consume("interface");
if (!base) return;
const ret =
Mixin.parse(tokeniser, base, opts) ||
Interface.parse(tokeniser, base, opts) ||
error("Interface has no proper body");
return ret;
return (
Mixin.parse(tokeniser, base, {
...opts,
...options?.extensions?.mixin,
}) ||
Interface.parse(tokeniser, base, {
...opts,
...options?.extensions?.interface,
}) ||
error("Interface has no proper body")
);
}
function partial() {
const partial = consume("partial");
if (!partial) return;
return (
Dictionary.parse(tokeniser, { partial }) ||
Dictionary.parse(tokeniser, {
partial,
...options?.extensions?.dictionary,
}) ||
interface_({ partial }) ||
Namespace.parse(tokeniser, { partial }) ||
Namespace.parse(tokeniser, {
partial,
...options?.extensions?.namespace,
}) ||
error("Partial doesn't apply to anything")
);
}
@@ -73,11 +98,11 @@ function parseByTokens(tokeniser, options) {
callback() ||
interface_() ||
partial() ||
Dictionary.parse(tokeniser) ||
Dictionary.parse(tokeniser, options?.extensions?.dictionary) ||
Enum.parse(tokeniser) ||
Typedef.parse(tokeniser) ||
Includes.parse(tokeniser) ||
Namespace.parse(tokeniser)
Namespace.parse(tokeniser, options?.extensions?.namespace)
);
}
@@ -100,6 +125,7 @@ function parseByTokens(tokeniser, options) {
}
return defs;
}
const res = definitions();
if (tokeniser.position < source.length) error("Unrecognised tokens");
return res;
@@ -107,11 +133,7 @@ function parseByTokens(tokeniser, options) {
/**
* @param {string} str
* @param {object} [options]
* @param {*} [options.sourceName]
* @param {boolean} [options.concrete]
* @param {Function[]} [options.productions]
* @return {import("./productions/base.js").Base[]}
* @param {ParserOptions} [options]
*/
export function parse(str, options = {}) {
const tokeniser = new Tokeniser(str);
+20 -14
View File
@@ -1,27 +1,30 @@
{
"name": "webidl2",
"description": "A WebIDL Parser",
"version": "24.2.2",
"version": "24.4.1",
"contributors": [
"Robin Berjon <robin@berjon.com> (https://berjon.com)",
"Marcos Caceres <marcos@marcosc.com> (https://marcosc.com)",
"Kagami Sascha Rosylight <saschaplas@outlook.com>",
"Timothy Gu <timothygu99@gmail.com>"
],
"engines": {
"node": ">= 14"
},
"license": "W3C",
"devDependencies": {
"eslint": "^8.14.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.0.0",
"expect": "^28.0.2",
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"expect": "^29.5.0",
"jsondiffpatch": "^0.4.1",
"mocha": "^10.0.0",
"prettier": "^2.6.2",
"terser-webpack-plugin": "^5.3.1",
"typescript": "^4.6.4",
"webpack": "^5.72.0",
"webpack-cli": "^4.9.2"
"mocha": "^10.2.0",
"prettier": "^2.8.8",
"terser-webpack-plugin": "^5.3.9",
"typescript": "^5.1.3",
"webpack": "^5.86.0",
"webpack-cli": "^5.1.4"
},
"scripts": {
"eslint": "eslint lib test",
@@ -36,8 +39,11 @@
"repository": "git://github.com/w3c/webidl2.js",
"main": "dist/webidl2.js",
"exports": {
"import": "./index.js",
"require": "./dist/webidl2.js"
".": {
"import": "./index.js",
"require": "./dist/webidl2.js"
},
"./productions": "./lib/productions/index.js"
},
"type": "module",
"files": [