+13
-3
| { | ||
| "name": "esrap", | ||
| "version": "2.2.4", | ||
| "version": "2.2.5", | ||
| "description": "Parse in reverse", | ||
@@ -32,2 +32,4 @@ "repository": { | ||
| "@sveltejs/acorn-typescript": "^1.0.5", | ||
| "@types/estree": "^1.0.8", | ||
| "@typescript-eslint/types": "^8.2.0", | ||
| "@vitest/ui": "^2.1.1", | ||
@@ -44,5 +46,12 @@ "acorn": "^8.15.0", | ||
| "dependencies": { | ||
| "@jridgewell/sourcemap-codec": "^1.4.15", | ||
| "@jridgewell/sourcemap-codec": "^1.4.15" | ||
| }, | ||
| "peerDependencies": { | ||
| "@typescript-eslint/types": "^8.2.0" | ||
| }, | ||
| "peerDependenciesMeta": { | ||
| "@typescript-eslint/types": { | ||
| "optional": true | ||
| } | ||
| }, | ||
| "publishConfig": { | ||
@@ -54,3 +63,4 @@ "access": "public" | ||
| "changeset:publish": "changeset publish", | ||
| "check": "tsc", | ||
| "gen": "dts-buddy -m esrap:./src/public.d.ts -m esrap/languages/ts:./src/languages/ts/public.d.ts -m esrap/languages/tsx:./src/languages/tsx/public.d.ts", | ||
| "check": "pnpm gen && tsc", | ||
| "sandbox": "node test/sandbox/index.js", | ||
@@ -57,0 +67,0 @@ "test": "vitest --run", |
@@ -1,2 +0,7 @@ | ||
| export * from './index'; | ||
| export type { BaseComment, Comment } from '../types'; | ||
| import type { Visitors, BaseNode } from '../../types'; | ||
| import type { TSOptions, BaseComment, Comment } from '../types'; | ||
| export type { BaseComment, Comment }; | ||
| export type Node = BaseNode; | ||
| export default function ts(options?: TSOptions): Visitors<BaseNode>; | ||
| // was Record<TSESTree.Expression['type'] | 'Super' | 'RestElement', number> | ||
| export declare const EXPRESSIONS_PRECEDENCE: Record<string, number>; |
@@ -1,2 +0,5 @@ | ||
| export * from './index'; | ||
| export type { BaseComment, Comment } from '../types'; | ||
| import type { Visitors, BaseNode } from '../../types'; | ||
| import type { TSOptions, BaseComment, Comment } from '../types'; | ||
| export type { BaseComment, Comment }; | ||
| export type Node = BaseNode; | ||
| export default function tsx(options?: TSOptions): Visitors<BaseNode>; |
+31
-31
@@ -72,7 +72,26 @@ declare module 'esrap' { | ||
| declare module 'esrap/languages/ts' { | ||
| import type { TSESTree } from '@typescript-eslint/types'; | ||
| import type { Context } from 'esrap'; | ||
| export const EXPRESSIONS_PRECEDENCE: Record<TSESTree.Expression["type"] | "Super" | "RestElement", number>; | ||
| export default function _default(options?: TSOptions): Visitors<TSESTree.Node>; | ||
| export type Node = TSESTree.Node; | ||
| export type Node = BaseNode; | ||
| export default function ts(options?: TSOptions): Visitors<BaseNode>; | ||
| // was Record<TSESTree.Expression['type'] | 'Super' | 'RestElement', number> | ||
| export const EXPRESSIONS_PRECEDENCE: Record<string, number>; | ||
| type BaseNode = { | ||
| type: string; | ||
| loc?: null | { | ||
| start: { line: number; column: number }; | ||
| end: { line: number; column: number }; | ||
| }; | ||
| }; | ||
| type NodeOf<T extends string, X> = X extends { type: T } ? X : never; | ||
| type SpecialisedVisitors<T extends BaseNode> = { | ||
| [K in T['type']]?: Visitor<NodeOf<K, T>>; | ||
| }; | ||
| type Visitor<T> = (node: T, context: Context) => void; | ||
| type Visitors<T extends BaseNode = BaseNode> = T['type'] extends '_' | ||
| ? never | ||
| : SpecialisedVisitors<T> & { _?: (node: T, context: Context, visit: (node: T) => void) => void }; | ||
| type TSOptions = { | ||
@@ -105,2 +124,10 @@ quotes?: 'double' | 'single'; | ||
| } | ||
| export {}; | ||
| } | ||
| declare module 'esrap/languages/tsx' { | ||
| import type { Context } from 'esrap'; | ||
| export type Node = BaseNode; | ||
| export default function tsx(options?: TSOptions): Visitors<BaseNode>; | ||
| type BaseNode = { | ||
@@ -125,10 +152,2 @@ type: string; | ||
| : SpecialisedVisitors<T> & { _?: (node: T, context: Context, visit: (node: T) => void) => void }; | ||
| export {}; | ||
| } | ||
| declare module 'esrap/languages/tsx' { | ||
| import type { TSESTree } from '@typescript-eslint/types'; | ||
| import type { Context } from 'esrap'; | ||
| export default function _default(options?: TSOptions): Visitors<TSESTree.Node>; | ||
| type TSOptions = { | ||
@@ -161,22 +180,3 @@ quotes?: 'double' | 'single'; | ||
| } | ||
| type BaseNode = { | ||
| type: string; | ||
| loc?: null | { | ||
| start: { line: number; column: number }; | ||
| end: { line: number; column: number }; | ||
| }; | ||
| }; | ||
| type NodeOf<T extends string, X> = X extends { type: T } ? X : never; | ||
| type SpecialisedVisitors<T extends BaseNode> = { | ||
| [K in T['type']]?: Visitor<NodeOf<K, T>>; | ||
| }; | ||
| type Visitor<T> = (node: T, context: Context) => void; | ||
| type Visitors<T extends BaseNode = BaseNode> = T['type'] extends '_' | ||
| ? never | ||
| : SpecialisedVisitors<T> & { _?: (node: T, context: Context, visit: (node: T) => void) => void }; | ||
| export {}; | ||
@@ -183,0 +183,0 @@ } |
@@ -15,8 +15,10 @@ { | ||
| "Context", | ||
| "Node", | ||
| "ts", | ||
| "EXPRESSIONS_PRECEDENCE", | ||
| "Node", | ||
| "TSOptions", | ||
| "Position", | ||
| "BaseComment", | ||
| "Comment" | ||
| "Comment", | ||
| "tsx" | ||
| ], | ||
@@ -27,4 +29,5 @@ "sources": [ | ||
| "../src/context.js", | ||
| "../src/languages/ts/index.js", | ||
| "../src/languages/types.d.ts" | ||
| "../src/languages/ts/public.d.ts", | ||
| "../src/languages/types.d.ts", | ||
| "../src/languages/tsx/public.d.ts" | ||
| ], | ||
@@ -36,6 +39,7 @@ "sourcesContent": [ | ||
| null, | ||
| null, | ||
| null | ||
| ], | ||
| "mappings": ";MAEYA,QAAQA;;;;;;;;MAQfC,MAAMA;;MAENC,mBAAmBA;;;;MAIZC,OAAOA;;aAEPC,QAAQA;;;;WAWHC,QAAQA;;;;;;MAWbC,OAAOA;;kBAEFC,YAAYA;;;;;;;;;iBCWbC,KAAKA;;;;cC7CRC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCAPC,sBAAsBA;;aAHZC,IAAIA;MCHfC,SAASA;;;;;;;WAOXC,QAAQA;;;;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