Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

web-tree-sitter

Package Overview
Dependencies
Maintainers
8
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web-tree-sitter - npm Package Compare versions

Comparing version 0.21.0 to 0.22.0

2

package.json
{
"name": "web-tree-sitter",
"version": "0.21.0",
"version": "0.22.0",
"description": "Tree-sitter bindings for the web",

@@ -5,0 +5,0 @@ "main": "tree-sitter.js",

declare module 'web-tree-sitter' {
class Parser {
/**
*
*
* @param moduleOptions Optional emscripten module-object, see https://emscripten.org/docs/api_reference/module.html

@@ -9,10 +9,11 @@ */

delete(): void;
parse(input: string | Parser.Input, previousTree?: Parser.Tree, options?: Parser.Options): Parser.Tree;
parse(input: string | Parser.Input, oldTree?: Parser.Tree, options?: Parser.Options): Parser.Tree;
getIncludedRanges(): Parser.Range[];
getTimeoutMicros(): number;
setTimeoutMicros(timeout: number): void;
reset(): void;
getLanguage(): Parser.Language;
setLanguage(language?: Parser.Language | undefined | null): void;
setLanguage(language?: Parser.Language | null): void;
getLogger(): Parser.Logger;
setLogger(logFunc?: Parser.Logger | undefined | null): void;
setTimeoutMicros(value: number): void;
getTimeoutMicros(): number;
setLogger(logFunc?: Parser.Logger | false | null): void;
}

@@ -31,6 +32,6 @@

export type Range = {
startPosition: Point;
endPosition: Point;
startIndex: number;
endIndex: number;
startIndex: number,
endIndex: number,
startPosition: Point,
endPosition: Point
};

@@ -53,14 +54,19 @@

export type Input = (
startIndex: number,
startPoint?: Point,
endIndex?: number,
) => string | null;
export interface Input {
(index: number, position?: Point): string | null;
}
export interface SyntaxNode {
tree: Tree;
id: number;
typeId: number;
grammarId: number;
tree: Tree;
type: string;
grammarType: string;
isNamed: boolean;
isMissing: boolean;
isExtra: boolean;
hasChanges: boolean;
hasError: boolean;
isError: boolean;
text: string;

@@ -86,18 +92,18 @@ parseState: number;

previousNamedSibling: SyntaxNode | null;
descendantCount: number;
hasChanges(): boolean;
hasError(): boolean;
equals(other: SyntaxNode): boolean;
isError(): boolean;
isMissing(): boolean;
isNamed(): boolean;
toString(): string;
child(index: number): SyntaxNode | null;
namedChild(index: number): SyntaxNode | null;
childForFieldName(fieldName: string): SyntaxNode | null;
childForFieldId(fieldId: number): SyntaxNode | null;
childForFieldName(fieldName: string): SyntaxNode | null;
fieldNameForChild(childIndex: number): string | null;
childrenForFieldName(fieldName: string, cursor: TreeCursor): Array<SyntaxNode>;
childrenForFieldId(fieldId: number, cursor: TreeCursor): Array<SyntaxNode>;
firstChildForIndex(index: number): SyntaxNode | null;
firstNamedChildForIndex(index: number): SyntaxNode | null;
descendantForIndex(index: number): SyntaxNode;
descendantForIndex(startIndex: number, endIndex: number): SyntaxNode;
descendantsOfType(type: string | Array<string>, startPosition?: Point, endPosition?: Point): Array<SyntaxNode>;
namedDescendantForIndex(index: number): SyntaxNode;

@@ -109,2 +115,3 @@ namedDescendantForIndex(startIndex: number, endIndex: number): SyntaxNode;

namedDescendantForPosition(startPosition: Point, endPosition: Point): SyntaxNode;
descendantsOfType(types: String | Array<String>, startPosition?: Point, endPosition?: Point): Array<SyntaxNode>;

@@ -126,2 +133,7 @@ walk(): TreeCursor;

endIndex: number;
readonly currentNode: SyntaxNode;
readonly currentFieldName: string;
readonly currentFieldId: number;
readonly currentDepth: number;
readonly currentDescendantIndex: number;

@@ -131,11 +143,10 @@ reset(node: SyntaxNode): void;

delete(): void;
currentNode(): SyntaxNode;
currentFieldId(): number;
currentFieldName(): string;
gotoParent(): boolean;
gotoFirstChild(): boolean;
gotoLastChild(): boolean;
gotoFirstChildForIndex(index: number): boolean;
gotoFirstChildForIndex(goalIndex: number): boolean;
gotoFirstChildForPosition(goalPosition: Point): boolean;
gotoNextSibling(): boolean;
gotoPreviousSibling(): boolean;
gotoDescendant(goalDescendantIndex: number): void;
}

@@ -146,2 +157,3 @@

rootNodeWithOffset(offsetBytes: number, offsetExtent: Point): SyntaxNode;
copy(): Tree;

@@ -152,2 +164,3 @@ delete(): void;

getChangedRanges(other: Tree): Range[];
getIncludedRanges(): Range[];
getEditedRange(other: Tree): Range;

@@ -157,2 +170,51 @@ getLanguage(): Language;

export interface QueryCapture {
name: string;
text?: string;
node: SyntaxNode;
setProperties?: { [prop: string]: string | null };
assertedProperties?: { [prop: string]: string | null };
refutedProperties?: { [prop: string]: string | null };
}
export interface QueryMatch {
pattern: number;
captures: QueryCapture[];
}
export type QueryOptions = {
startPosition?: Point;
endPosition?: Point;
startIndex?: number;
endIndex?: number;
matchLimit?: number;
maxStartDepth?: number;
};
export interface PredicateResult {
operator: string;
operands: { name: string; type: string }[];
}
export class Query {
captureNames: string[];
readonly predicates: { [name: string]: Function }[];
readonly setProperties: any[];
readonly assertedProperties: any[];
readonly refutedProperties: any[];
readonly matchLimit: number;
delete(): void;
captures(node: SyntaxNode, options?: QueryOptions): QueryCapture[];
matches(node: SyntaxNode, options?: QueryOptions): QueryMatch[];
predicatesForPattern(patternIndex: number): PredicateResult[];
disableCapture(captureName: string): void;
disablePattern(patternIndex: number): void;
isPatternGuaranteedAtStep(byteOffset: number): boolean;
isPatternRooted(patternIndex: number): boolean;
isPatternNonLocal(patternIndex: number): boolean;
startIndexForPattern(patternIndex: number): number;
didExceedMatchLimit(): boolean;
}
class Language {

@@ -177,3 +239,3 @@ static load(input: string | Uint8Array): Promise<Language>;

class LookaheadIterable {
export class LookaheadIterable {
readonly language: Language;

@@ -184,30 +246,6 @@ readonly currentTypeId: number;

delete(): void;
reset(language: Language, stateId: number): boolean;
resetState(stateId: number): boolean;
reset(language: Language, stateId: number): boolean;
[Symbol.iterator](): Iterator<string>;
}
interface QueryCapture {
name: string;
node: SyntaxNode;
}
interface QueryMatch {
pattern: number;
captures: QueryCapture[];
}
interface PredicateResult {
operator: string;
operands: { name: string; type: string }[];
}
class Query {
captureNames: string[];
delete(): void;
matches(node: SyntaxNode, startPosition?: Point, endPosition?: Point): QueryMatch[];
captures(node: SyntaxNode, startPosition?: Point, endPosition?: Point): QueryCapture[];
predicatesForPattern(patternIndex: number): PredicateResult[];
}
}

@@ -214,0 +252,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc