repo
stringlengths
7
64
file_url
stringlengths
81
338
file_path
stringlengths
5
257
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:25:31
2026-01-05 01:50:38
truncated
bool
2 classes
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/indentDebug.ts
src/compileMatcher/indentDebug.ts
import { Debugger } from '../types' export default function indentDebug(debug: Debugger, amount: number): Debugger { const indent = ' '.repeat(amount) const result = (format: string, ...args: any[]) => debug.enabled ? debug(indent + format, ...args) : undefined const prototype = Object.create(debug) Objec...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/RelativeSource.ts
src/compileMatcher/RelativeSource.ts
import { CompiledMatcher, CompileOptions, MatchOptions, MatchResult } from '.' import { NodePath } from '../types' import Path from 'path' export function compileRelativeSourceMatcher( pattern: NodePath<any, any>, compileOptions: CompileOptions ): CompiledMatcher | void { const source = pattern.value const { g...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/TSTypeReference.ts
src/compileMatcher/TSTypeReference.ts
import { TSTypeReference, NodePath } from '../types' import { CompiledMatcher, CompileOptions } from '.' import compilePlaceholderMatcher from './Placeholder' import compileSpecialMatcher from './SpecialMatcher' export default function compileTSTypeReferenceMatcher( path: NodePath<TSTypeReference, TSTypeReference>, ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/ClassProperty.ts
src/compileMatcher/ClassProperty.ts
import { ClassProperty, NodePath } from '../types' import { CompiledMatcher, CompileOptions } from '.' import compilePlaceholderMatcher from './Placeholder' export default function compileClassPropertyMatcher( path: NodePath<ClassProperty, ClassProperty>, compileOptions: CompileOptions ): CompiledMatcher | void { ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/JSXAttribute.ts
src/compileMatcher/JSXAttribute.ts
import { JSXAttribute, NodePath } from '../types' import { CompiledMatcher, CompileOptions } from '.' import compilePlaceholderMatcher from './Placeholder' export default function compileJSXAttributeMatcher( path: NodePath<JSXAttribute, JSXAttribute>, compileOptions: CompileOptions ): CompiledMatcher | void { co...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/ImportSpecifier.ts
src/compileMatcher/ImportSpecifier.ts
import { ImportSpecifier, NodePath } from '../types' import { CompiledMatcher, CompileOptions, MatchResult } from '.' import compilePlaceholderMatcher from './Placeholder' import compileGenericNodeMatcher from './GenericNodeMatcher' export default function compileImportSpecifierMatcher( path: NodePath<ImportSpecifie...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/Placeholder.ts
src/compileMatcher/Placeholder.ts
import { CompileOptions, MatchResult, mergeCaptures, CompiledMatcher } from '.' import { Node, NodePath, NodeType } from '../types' import convertToJSXIdentifierName from '../convertReplacement/convertToJSXIdentifierName' import { Backend } from '../backend/Backend' export function unescapeIdentifier(identifier: strin...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/TypeParameter.ts
src/compileMatcher/TypeParameter.ts
import { TypeParameter, NodePath, setAstxMatchInfo } from '../types' import { CompiledMatcher, CompileOptions, MatchOptions, MatchResult } from '.' import compilePlaceholderMatcher from './Placeholder' import compileGenericNodeMatcher from './GenericNodeMatcher' export default function compileTypeParameterMatcher( p...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/TSExpressionWithTypeArguments.ts
src/compileMatcher/TSExpressionWithTypeArguments.ts
import { TSExpressionWithTypeArguments, NodePath } from '../types' import { CompiledMatcher, CompileOptions } from '.' import compilePlaceholderMatcher from './Placeholder' export default function compileTSExpressionWithTypeArgumentsMatcher( path: NodePath<TSExpressionWithTypeArguments, TSExpressionWithTypeArguments...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/Optional.ts
src/compileMatcher/Optional.ts
import { NodePath } from '../types' import { CompiledMatcher, CompileOptions, MatchOptions } from '.' import compileMatcher, { MatchResult } from '.' export default function compileOptionalMatcher( path: NodePath, subpath: NodePath<any>, compileOptions: CompileOptions ): CompiledMatcher | void { const matcher ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/index.ts
src/compileMatcher/index.ts
import { NodeType, NodePath, Node, Debugger } from '../types' import * as t from 'ast-types' import __debug from 'debug' import { Backend } from '../backend/Backend' import AssignmentPattern from './AssignmentPattern' import BooleanLiteral from './BooleanLiteral' import CallExpression from './CallExpression' import Cla...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/TSTypeParameter.ts
src/compileMatcher/TSTypeParameter.ts
import { TSTypeParameter, NodePath, setAstxMatchInfo } from '../types' import { CompiledMatcher, CompileOptions, MatchOptions, MatchResult } from '.' import compilePlaceholderMatcher from './Placeholder' import compileGenericNodeMatcher from './GenericNodeMatcher' export default function compileTSTypeParameterMatcher(...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/SpecialMatcher.ts
src/compileMatcher/SpecialMatcher.ts
import { Node, NodePath } from '../types' import { CompiledMatcher, CompileOptions } from '.' import compileOptionalMatcher from './Optional' import compileOrMatcher from './Or' import compileAndMatcher from './And' import CompilePathError from '../util/CompilePathError' export default function compileSpecialMatcher( ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/ClassImplements.ts
src/compileMatcher/ClassImplements.ts
import { NodePath, ClassImplements } from '../types' import { CompiledMatcher, CompileOptions } from '.' import compilePlaceholderMatcher from './Placeholder' export default function compileClassImplementsMatcher( path: NodePath<ClassImplements, ClassImplements>, compileOptions: CompileOptions ): CompiledMatcher |...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/compileMatcher/AssignmentPattern.ts
src/compileMatcher/AssignmentPattern.ts
import { NodePath, AssignmentPattern, pathIs } from '../types' import compileMatcher, { CompiledMatcher, CompileOptions, MatchOptions, MatchResult, } from '.' import indentDebug from './indentDebug' import compileGenericNodeMatcher from './GenericNodeMatcher' export default function compileAssignmentPatternMat...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/cli/transform.ts
src/cli/transform.ts
import { Arguments, Argv, CommandModule } from 'yargs' import path from 'path' import chalk from 'chalk' import formatDiff from '../util/formatDiff' import { isEmpty, once } from 'lodash' import inquirer from 'inquirer' import fs from 'fs-extra' import dedent from 'dedent-js' import CodeFrameError from '../util/CodeFra...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/cli/init.ts
src/cli/init.ts
import { Arguments, Argv, CommandModule } from 'yargs' import fs from 'fs-extra' import dedent from 'dedent-js' import inquirer from 'inquirer' /* eslint-disable no-console */ type Options = { file?: string style?: string } const init: CommandModule<Options> = { command: 'init [file]', describe: 'create a tr...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/cli/index.ts
src/cli/index.ts
#!/usr/bin/env node /* eslint-disable no-console */ import yargs from 'yargs' import { hideBin } from 'yargs/helpers' import transform from './transform' import init from './init' yargs(hideBin(process.argv)).command(transform).command(init).argv
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/cli/spinner.ts
src/cli/spinner.ts
import chalk from 'chalk' const frames = [ chalk`{bold } ASTX `, chalk`{bold ▰} ASTX `, chalk`{bold ▰▰} ASTX `, chalk`{bold ▰▰▰} ASTX `, chalk` {bold ▰▰▰} ASTX `, chalk` {bold ▰▰▰}ASTX `, chalk` {bold ▰▰A}STX `, chalk` {bold ▰AS}TX `, chalk` {bold A...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertImportSpecifierReplacement.ts
src/convertReplacement/convertImportSpecifierReplacement.ts
import { Node } from '../types' import * as t from '@babel/types' import { ReplacementConverter } from './' import convertToIdentifierPair from './convertToIdentifierPair' export default function convertImportSpecifierReplacement(): ReplacementConverter { const convert = (node: Node): Node | Node[] => { switch (...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertToJSXIdentifierName.ts
src/convertReplacement/convertToJSXIdentifierName.ts
import { Node } from '../types' function isValidJSXIdentifier(s: string) { return /^[_$a-z][-_$a-z0-9]*$/i.test(s) } export default function convertToJSXIdentifierName(node: Node): string | void { switch (node.type) { case 'ObjectProperty': if (node.shorthand) return convertToJSXIdentifierName(node.key)...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertToIdentifierName.ts
src/convertReplacement/convertToIdentifierName.ts
import { Node } from '../types' import convertToJSXIdentifierName from './convertToJSXIdentifierName' export default function convertToIdentifierName(node: Node): string | void { const name = convertToJSXIdentifierName(node) return name && name.indexOf('-') < 0 ? name : undefined }
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertJSXChildReplacement.ts
src/convertReplacement/convertJSXChildReplacement.ts
import { Node } from '../types' import * as t from '@babel/types' import convertExpressionReplacement from './convertExpressionReplacement' export default function convertJSXChildReplacement(node: Node): Node { switch (node.type) { case 'JSXElement': case 'JSXEmptyExpression': case 'JSXFragment': cas...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/Identifier.ts
src/convertReplacement/Identifier.ts
import { Node, Identifier } from '../types' import * as t from '@babel/types' import convertToIdentifierName from './convertToIdentifierName' export default function convertToIdentifier(node: Node): Identifier | void { const name = convertToIdentifierName(node) if (name) return t.identifier(name) }
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertPropertyReplacement.ts
src/convertReplacement/convertPropertyReplacement.ts
import { Node } from '../types' import * as t from '@babel/types' import convertToIdentifierExpressionPair from './convertToIdentifierExpressionPair' import convertToExpression from './convertToExpression' export default function convertPropertyReplacement(node: Node): Node { switch (node.type) { case 'SpreadEle...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertToJSXIdentifierNamePair.ts
src/convertReplacement/convertToJSXIdentifierNamePair.ts
import { Node } from '../types' import convertToJSXIdentifierName from './convertToIdentifierName' export default function convertToJSXIdentifierNamePair( node: Node ): [string, string] | void { switch (node.type) { case 'ObjectProperty': case 'ObjectTypeProperty': case 'Property': { const key = ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertToIdentifierNamePair.ts
src/convertReplacement/convertToIdentifierNamePair.ts
import { Node } from '../types' import convertToJSXIdentifierNamePair from './convertToJSXIdentifierNamePair' export default function convertToIdentifierNamePair( node: Node ): [string, string] | void { const result = convertToJSXIdentifierNamePair(node) if (result && result[0].indexOf('-') < 0 && result[1].inde...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertTSTypeParameterReplacement.ts
src/convertReplacement/convertTSTypeParameterReplacement.ts
import { Node } from '../types' import * as t from '@babel/types' import { ReplacementConverter } from './index' import convertToIdentifierName from './convertToIdentifierName' export default function convertToTSTypeParameter(): ReplacementConverter { return (node: Node): Node => { if (node.type !== 'TSTypeParam...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertToExpression.ts
src/convertReplacement/convertToExpression.ts
import { Node, Expression } from '../types' import * as t from '@babel/types' import convertToIdentifierName from './convertToIdentifierName' export default function convertToExpression(value: Node): Expression | void { switch (value.type) { case 'ClassDeclaration': return { ...value, type: 'ClassExpressio...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertExpressionReplacement.ts
src/convertReplacement/convertExpressionReplacement.ts
import { Node } from '../types' import convertToExpression from './convertToExpression' export default function convertExpressionReplacement(node: Node): Node { return convertToExpression(node) || node }
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertJSXAttributeValueReplacement.ts
src/convertReplacement/convertJSXAttributeValueReplacement.ts
import { Node } from '../types' import * as t from '@babel/types' import convertToExpression from './convertToExpression' export default function convertJSXAttributeValueReplacement(node: Node): Node { switch (node.type) { case 'Literal': if (typeof node.value === 'string') return t.jsxText(node.value) ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertToIdentifierExpressionPair.ts
src/convertReplacement/convertToIdentifierExpressionPair.ts
import { Node, Identifier, Expression } from '../types' import * as t from '@babel/types' import convertToJSXIdentifierNameExpressionPair from './convertToJSXIdentifierNameExpressionPair' export default function convertToIdentifierExpressionPair( node: Node ): [Identifier, Expression] | void { const result = conve...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertTSTypeReplacement.ts
src/convertReplacement/convertTSTypeReplacement.ts
import { Node } from '../types' import * as t from '@babel/types' import convertToIdentifier from './Identifier' export default function convertTSTypeReplacement(node: Node): Node { switch (node.type) { case 'TypeAnnotation': return node.typeAnnotation } // @ts-expect-error @babel/types and ast-types a...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertFlowTypeReplacement.ts
src/convertReplacement/convertFlowTypeReplacement.ts
import { Node } from '../types' import * as t from '@babel/types' import convertToIdentifier from './Identifier' export default function convertFlowTypeReplacement(node: Node): Node { switch (node.type) { case 'TypeAnnotation': return node.typeAnnotation } // @ts-expect-error @babel/types and ast-types...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertTypeParameterReplacement.ts
src/convertReplacement/convertTypeParameterReplacement.ts
import { Node } from '../types' import * as t from '@babel/types' import { ReplacementConverter } from './index' import convertToIdentifierName from './convertToIdentifierName' export default function convertToTypeParameter(): ReplacementConverter { return (node: Node): Node => { if (node.type !== 'TypeParameter...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertToIdentifierPair.ts
src/convertReplacement/convertToIdentifierPair.ts
import { Node, Identifier } from '../types' import * as t from '@babel/types' import convertToJSXIdentifierNamePair from './convertToJSXIdentifierNamePair' export default function convertToIdentifierPair( node: Node ): [Identifier, Identifier] | void { const result = convertToJSXIdentifierNamePair(node) if (resu...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertJSXAttributeReplacement.ts
src/convertReplacement/convertJSXAttributeReplacement.ts
import { Node } from '../types' import * as t from '@babel/types' import convertToJSXIdentifierNameExpressionPair from './convertToJSXIdentifierNameExpressionPair' import { ReplacementConverter } from '.' export default function convertJSXAttributeReplacement(): ReplacementConverter { const convert = (node: Node): N...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertStatementReplacement.ts
src/convertReplacement/convertStatementReplacement.ts
import { Node, ClassDeclaration } from '../types' import * as t from '@babel/types' import convertToExpression from './convertToExpression' export default function convertStatementReplacement(value: Node): Node { switch (value.type) { case 'ClassExpression': return { ...value, type: 'ClassDeclaration' } a...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertArrayElementReplacement.ts
src/convertReplacement/convertArrayElementReplacement.ts
import { Node } from '../types' import * as t from '@babel/types' import convertToExpression from './convertToExpression' export default function convertArrayElementReplacement(node: Node): Node { switch (node.type) { case 'SpreadElement': return node case 'TSRestType': case 'ObjectTypeSpreadProper...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertToJSXIdentifierNameExpressionPair.ts
src/convertReplacement/convertToJSXIdentifierNameExpressionPair.ts
import { Node, Expression } from '../types' import * as t from '@babel/types' import convertToJSXIdentifierName from './convertToIdentifierName' import convertToExpression from './convertToExpression' export default function convertToJSXIdentifierNameExpressionPair( node: Node ): [string, Expression] | void { swit...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/index.ts
src/convertReplacement/index.ts
import { Node, NodePath } from '../types' import convertJSXChildReplacement from './convertJSXChildReplacement' import convertJSXAttributeReplacement from './convertJSXAttributeReplacement' import convertJSXAttributeValueReplacement from './convertJSXAttributeValueReplacement' import TypeParameter from './convertTypePa...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/convertReplacement/convertToIdentifierNameExpressionPair.ts
src/convertReplacement/convertToIdentifierNameExpressionPair.ts
import { Node, Expression } from '../types' import convertToJSXIdentifierNameExpressionPair from './convertToJSXIdentifierNameExpressionPair' export default function convertToIdentifierNameExpressionPair( node: Node ): [string, Expression] | void { const result = convertToJSXIdentifierNameExpressionPair(node) if...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/recast/RecastBackend.ts
src/recast/RecastBackend.ts
import { File, Statement, Expression, Location, Comment } from '../types' import { Backend } from '../backend/Backend' import * as defaultRecast from 'recast' import * as AstTypes from 'ast-types' import * as k from 'ast-types/gen/kinds' type Node = k.NodeKind export default class RecastBackend extends Backend<Node> ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/recast/getRecastBackend.ts
src/recast/getRecastBackend.ts
import { GetBackend } from '../backend/Backend' import RecastBackend from './RecastBackend' export default function getRecastBackend(getWrapped: GetBackend): GetBackend { return async function getRecastBackend( file: string, options?: { [k in string]?: any } ): Promise<RecastBackend> { return new Recas...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/babel/BabelBackend.ts
src/babel/BabelBackend.ts
import { Node, File, Statement, Expression } from '@babel/types' import { Backend } from '../backend/Backend' import { ParserOptions } from '@babel/parser' import * as defaultParser from '@babel/parser' import * as defaultTypes from '@babel/types' import * as defaultGenerator from '@babel/generator' import type * as As...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/babel/babelInterop.ts
src/babel/babelInterop.ts
export default function babelInterop<T>(module: T): T { return (module as any).default instanceof Object && Object.getPrototypeOf(module) == null ? (module as any).default : module }
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/babel/getBabelAutoBackend.ts
src/babel/getBabelAutoBackend.ts
import path from 'path' import _resolve from 'resolve' import BabelBackend from './BabelBackend' import * as defaultTypes from '@babel/types' import * as defaultGenerator from '@babel/generator' import { getParserAsync } from 'babel-parse-wild-code' import { promisify } from 'util' import babelInterop from './babelInte...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/babel/getBabelBackend.ts
src/babel/getBabelBackend.ts
import BabelBackend from './BabelBackend' import { jsParser } from 'babel-parse-wild-code' export default async function getBabelDefaultsBackend( file: string, { preserveFormat, ...options }: { [k in string]?: any } = {} ): Promise<BabelBackend> { const parser = options ? jsParser.bindParserOpts(options) : jsPar...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/babel/reprint.ts
src/babel/reprint.ts
import { CodeGenerator, default as generate } from '@babel/generator' import { Comment, Node } from '../types' import { original, rangeWithWhitespace, source } from '../util/symbols' const excludedNodeTypes = new Set([ // @babel/generator prints ` ${ and } around TemplateElement // even though their range doesn't ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/src/babel/babelAstTypes.ts
src/babel/babelAstTypes.ts
import _typesPlugin from 'ast-types/lib/types' const typesPlugin: typeof _typesPlugin = (_typesPlugin as any)['default'] || _typesPlugin import * as defaultTypes from '@babel/types' import { memoize, omit, mapValues } from 'lodash' import fork from 'ast-types/fork' import { Fork } from 'ast-types/types' const babelA...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/configure.ts
test/configure.ts
import chai from 'chai' import chaiSubset from 'chai-subset' import chaiAsPromised from 'chai-as-promised' chai.use(chaiSubset) chai.use(chaiAsPromised)
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/parseTestcase.ts
test/parseTestcase.ts
import { describe, it } from 'mocha' import { expect } from 'chai' import { jsParser, tsParser } from 'babel-parse-wild-code' import { ParserOptions } from '@babel/parser' import RecastBackend from '../src/recast/RecastBackend' import BabelBackend from '../src/babel/BabelBackend' import { Backend } from '../src/backend...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/omitBlankLineChanges.test.ts
test/omitBlankLineChanges.test.ts
import { describe, it } from 'mocha' import { expect } from 'chai' import omitBlankLineChanges from '../src/util/omitBlankLineChanges' describe(`omitBlankLineChanges`, function () { it(`works`, function () { expect(omitBlankLineChanges('foo\n\nbar\nqux', 'foo\nbar\n\nbaz')).to.equal( 'foo\n\nbar\nbaz' ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplaceTestcase.ts
test/findReplaceTestcase.ts
import { describe, it } from 'mocha' import { expect } from 'chai' import find, { FindOptions, Match } from '../src/find' import { replaceAll } from '../src/replace' import { Node, NodePath, getAstxMatchInfo } from '../src/types' import { mapValues } from 'lodash' import prettier from 'prettier' import Path from 'path'...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/makeWhitespaceMap.test.ts
test/makeWhitespaceMap.test.ts
import { describe, it } from 'mocha' import { makeWhitespaceMap } from '../src/util/makeWhitespaceMap' import { expect } from 'chai' describe(`makeWhitespaceMap`, function () { it(`works`, function () { expect(makeWhitespaceMap(' abc def g ')).to.deep.equal({ starts: [0, 0, 2, 3, 4, 4, 4, 4, 8, 9, 10, 10...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/Astx.test.ts
test/Astx.test.ts
import { describe, it } from 'mocha' import { expect } from 'chai' import Astx from '../src/Astx' import { extractMatchSource as _extractMatchSource } from './findReplaceTestcase' import RecastBackend from '../src/recast/RecastBackend' import BabelBackend from '../src/babel/BabelBackend' import prettier from 'prettier'...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/extractSource.ts
test/extractSource.ts
import { Backend } from '../src/backend/Backend' import { Node, NodePath, getAstxMatchInfo } from '../src/types' export function extractSource( path: NodePath<Node, any>, source: string, backend: Backend ): string export function extractSource( path: NodePath<Node, any>[], source: string, backend: Backend ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/astxTestcase.ts
test/astxTestcase.ts
import { describe, it } from 'mocha' import { expect } from 'chai' import { Astx, Match, TransformFunction, TransformOptions } from '../src' import Path from 'path' import { jsParser, tsParser } from 'babel-parse-wild-code' import { ParserOptions } from '@babel/parser' import RecastBackend from '../src/recast/RecastBac...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/parse/jsxClosingElement.ts
test/parse/jsxClosingElement.ts
import { parseTestcase } from '../parseTestcase' export const input = ` (<X>{a}{/**/} </X>/**/) ` export const expected = `</X>` parseTestcase({ file: __filename, input, expected, })
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/parse/variableDeclaratorId.ts
test/parse/variableDeclaratorId.ts
import { parseTestcase } from '../parseTestcase' export const input = ` let /**/x: number/**/ = 1 ` export const expected = `x: number` parseTestcase({ file: __filename, input, expected, })
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/parse/variableDeclarator.ts
test/parse/variableDeclarator.ts
import { parseTestcase } from '../parseTestcase' export const input = ` let /**/x = 1/**/ ` export const expected = `x = 1` parseTestcase({ file: __filename, input, expected, })
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/parse/betweenTwoComments.ts
test/parse/betweenTwoComments.ts
import { parseTestcase } from '../parseTestcase' export const input = ` (<X>{/**/}{a}{/**/}</X>) ` export const expected = `{a}` parseTestcase({ file: __filename, input, expected, })
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/callExpression.ts
test/findReplace/callExpression.ts
export const input = ` foo(a, {b: 3, c: 4}, c, d, [1, 2, 3]) ` export const find = `$1($$a, d, $c)` export const expectedFind = [ { node: `foo(a, {b: 3, c: 4}, c, d, [1, 2, 3])`, captures: { $1: 'foo', $c: '[1, 2, 3]', }, arrayCaptures: { $$a: ['a', '{b: 3, c: 4}', 'c'], }, }...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/qualifiedTypeIdentifier.ts
test/findReplace/qualifiedTypeIdentifier.ts
export const input = ` type Foo = A.B.$C ` export const find = ` type X = /**/ $A.$B.$_C ` export const expectedFind = [ { node: 'A.B.$C', captures: { $A: 'A', $B: 'B', }, }, ] export const replace = ` type X = /**/ $B.$A.$_C ` export const expectedReplace = ` type Foo = B.A.$C ` import ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/arrayMatchingForceUnorderedMissing.ts
test/findReplace/arrayMatchingForceUnorderedMissing.ts
export const input = ` [1, 2, 3, 4, 5] ` export const find = `[$Unordered, 1, 2, 3, 4]` export const expectedFind = [] import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ file: __filename, input, find, expectedFind, })
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/orType.ts
test/findReplace/orType.ts
export const input = ` const a: number = 1 const b: {foo: number} = {foo: 3} const c: string = 'hello' ` export const find = ` const $a: $Or<number, {foo: $value}> = $b ` export const expectedFind: ExpectedMatch[] = [ { captures: { $a: 'a', $b: '1', }, node: 'const a: number = 1', }, { ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/importTypeDefaultReplacement.ts
test/findReplace/importTypeDefaultReplacement.ts
export const input = ` import foo from 'foo' ` export const find = ` import $x from '$y' ` export const replace = ` import type $x from '$y' import $_x from 'y' ` export const expectedReplace = ` import type foo from 'foo' import $x from 'y' ` import { findReplaceTestcase } from '../findReplaceTestcase' findReplace...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/maybeSuperClass.ts
test/findReplace/maybeSuperClass.ts
export const input = ` class Cls { } ` export const find = ` class $A extends $Maybe<$C> { } ` export const expectedFind = [ { arrayCaptures: { $$B: ['A'], }, captures: { $A: 'Cls', $C: 'Base', }, node: 'class Cls<A> extends Base {\n}', }, ] export const skip = true import ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/functionTypeParamWithTypeParams.ts
test/findReplace/functionTypeParamWithTypeParams.ts
export const input = ` type Foo = (bar: A<B>) => void ` export const find = ` type Foo = (bar: $a<$b>) => void ` export const expectedFind = [ { node: input.trim(), captures: { $a: 'A', $b: 'B', }, }, ] import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ f...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/templateLiteralEscape.ts
test/findReplace/templateLiteralEscape.ts
export const input = ` const x = \`$foo\` ` export const find = `\`$_foo\`` export const expectedFind = [{ node: '`$foo`' }] export const replace = `\`$_bar\`` export const expectedReplace = ` const x = \`$bar\` ` import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ file: __filename...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/bugs_templateStringReplacement.ts
test/findReplace/bugs_templateStringReplacement.ts
export const input = ` deviceTagNode().child('foo').child('bar').child('baz') ` export const find = ` deviceTagNode().child('$a').child('$b').child('$c') ` // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export const replace = ({ stringCaptures: { $a, $b, $c } = {}, }: Match): string =...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/spreadElementCaptureAs.ts
test/findReplace/spreadElementCaptureAs.ts
export const input = ` const a = {...foo} const b = {a, ...foo} ` export const find = '{...$b}' export const expectedFind = [ { node: '{...foo}', captures: { $b: 'foo', }, }, ] import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ file: __filename, input, find...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/arrayMatchingForceUnorderedMatch.ts
test/findReplace/arrayMatchingForceUnorderedMatch.ts
export const input = ` [1, 2, 3, 4, 5] ` export const find = `[$Unordered, 1, 2, 3, 5, 4]` export const expectedFind = [ { node: '[1, 2, 3, 4, 5]', }, ] import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ file: __filename, input, find, expectedFind, })
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/importSpecifierRestMatching2.ts
test/findReplace/importSpecifierRestMatching2.ts
export const input = ` import x, {a, b, c, d, e} from 'f' ` export const find = `import {$$$b, b, d, q} from 'f'` export const expectedFind = [] import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ file: __filename, input, find, expectedFind, })
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/tsTypeParameterDeclaration.ts
test/findReplace/tsTypeParameterDeclaration.ts
export const parsers = ['babel/tsx', 'recast/babel/tsx'] export const input = ` type Foo<W, X, Y, Z extends {foo: 1}> = [W, X, Y, Z] type Bar<A, B, C> = [A, B, C] ` export const find = `type Foo<$a, $$b, Z extends {foo: $foo}> = $c` export const expectedFind = [ { node: 'type Foo<W, X, Y, Z extends {foo: 1}> =...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/importSpecifierCapture.ts
test/findReplace/importSpecifierCapture.ts
export const input = ` import A, {B, C} from 'a' import * as D from 'c' x = 5 foo(bar) ` export const find = ` import { /**/ $a } from 'a' ` export const expectedFind = ['A', 'B', 'C', '* as D'].map((node) => ({ node, captures: { $a: node }, })) import { findReplaceTestcase } from '../findReplaceTestcase' findR...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/importSpecifiersForceOrderedMatch.ts
test/findReplace/importSpecifiersForceOrderedMatch.ts
export const input = ` import A, {B, C, D, E} from 'foo' ` export const find = `import A, {$Ordered, B, C, D, E} from 'foo'` export const expectedFind = [ { node: `import A, {B, C, D, E} from 'foo'`, }, ] import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ file: __filename, ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/spreadElementEscape.ts
test/findReplace/spreadElementEscape.ts
export const input = ` const x = {...$b} ` export const find = '{...$_b}' export const expectedFind = [ { node: '{...$b}', }, ] import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ file: __filename, input, find, expectedFind, })
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/bugs_commentDuplication.ts
test/findReplace/bugs_commentDuplication.ts
export const input = ` /* eslint-disable no-console */ const testLib = require('test-lib') const funcOne = (foo) => { console.log('foo', foo) return testLib(foo) } const funcTwo = (bar) => { console.log('bar', bar) return testLib(bar) } module.exports = (on, config) => { on('event', () => { funcOne(con...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/numArgs.ts
test/findReplace/numArgs.ts
export const input = ` foo(1) foo(2, 3) ` export const find = `foo($a)` export const expectedFind = [ { node: 'foo(1)', captures: { $a: '1' }, }, ] import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ file: __filename, input, find, expectedFind, })
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/convertTaggedTemplateLiteralsToImports.ts
test/findReplace/convertTaggedTemplateLiteralsToImports.ts
export const input = ` foo\`foo\`; baz\`baz\`; qux\`qux \${stuff}\`; ` export const find = `$1\`$a\`` export const expectedFind = [ { node: 'foo`foo`', captures: { $1: 'foo', $a: '`foo`', }, stringCaptures: { $a: 'foo', }, }, { node: 'baz`baz`', captures: { $1:...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/stringCaptureLiteralTypeMismatch.ts
test/findReplace/stringCaptureLiteralTypeMismatch.ts
export const input = ` const x = 1 ` export const find = ` const x = '$a' ` export const expectedFind = [] import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ file: __filename, input, find, expectedFind, })
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/swapAdd.ts
test/findReplace/swapAdd.ts
export const input = ` 1 + 2 const foo = bar 3 + 5 ` export const find = `$a + $b` export const expectedFind = [ { node: '1 + 2', captures: { $a: '1', $b: '2' }, }, { node: '3 + 5', captures: { $a: '3', $b: '5' }, }, ] import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTe...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/blockStatement.ts
test/findReplace/blockStatement.ts
export const input = ` if (foo) { const bar = foo const baz = 3 const x = 1 } ` export const find = `if ($a) { $$b const $c = 1 }` export const expectedFind = [ { node: `if (foo) { const bar = foo const baz = 3 const x = 1 }`, captures: { $a: 'foo', $c: 'x' }, arrayCaptures: { $$b:...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/binaryExpressionReplacementLeadingComment.ts
test/findReplace/binaryExpressionReplacementLeadingComment.ts
import { findReplaceTestcase } from '../findReplaceTestcase' import dedent from 'dedent-js' findReplaceTestcase({ file: __filename, input: dedent` const a = 1 + 2 `, find: dedent` $a + $b `, replace: dedent` // this is a test $b + $a `, expectedReplace: dedent` const a = 2 + 1 // ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/useMutationBug.ts
test/findReplace/useMutationBug.ts
export const input = ` const [createFileAttachment]: [ CreateFileAttachmentMutationFunction ] = useMutation(createFileAttachmentMutation) ` export const find = `const [$a]: [$b] = useMutation($c)` export const replace = `const [$a] = useMutation<$b, any>($c)` export const expectedFind = [ { node: `const [crea...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/tupleTypeAnnotation.ts
test/findReplace/tupleTypeAnnotation.ts
export const input = ` type Foo = [W, X, Y, Z] type Bar = [A, B, C] ` export const find = `type $c = [$a, $$b, Z]` export const expectedFind = [ { node: 'type Foo = [W, X, Y, Z]', captures: { $a: 'W', $c: 'Foo', }, arrayCaptures: { $$b: ['X', 'Y'], }, }, ] export const repla...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/propsJsxAttributesConversion.ts
test/findReplace/propsJsxAttributesConversion.ts
import { findReplaceTestcase } from '../findReplaceTestcase' import dedent from 'dedent-js' findReplaceTestcase({ file: __filename, input: dedent` expect( new ReduxFormMaterialUICheckbox({ input: { name: 'myCheckbox', onChange: noop, value: true, }, })....
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/classImplementsIdCapture.ts
test/findReplace/classImplementsIdCapture.ts
export const input = ` class Foo implements Bar<Baz> { } ` export const find = ` class $A implements $B<$C> { } ` export const replace = ` class $B implements $C<$A> { } ` export const expectedReplace = ` class Bar implements Baz<Foo> { } ` import { findReplaceTestcase } from '../findReplaceTestcase' findReplac...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/relativeImportMatch2.ts
test/findReplace/relativeImportMatch2.ts
import { findReplaceTestcase } from '../findReplaceTestcase' import dedent from 'dedent-js' import path from 'path' findReplaceTestcase({ file: __filename, transformFile: path.resolve(__filename, '..', '..', 'transform.ts'), input: dedent` import a from '../foo' import b from './foo' `, find: deden...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/unionType.ts
test/findReplace/unionType.ts
export const input = ` type A = B | C | D[] | E[] | F type B = B | C | D[] | E | F ` export const find = `type $a = $$b | $c[] | F` export const expectedFind = [ { node: `type A = B | C | D[] | E[] | F`, captures: { $a: 'A', $c: 'E' }, arrayCaptures: { $$b: ['B', 'C', 'D[]'] }, }, ] export const repl...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/arrayExpressionRestMatching.ts
test/findReplace/arrayExpressionRestMatching.ts
export const input = ` [1, 2, 3, 4, 5] ` export const find = `[$$$b, 2, 5, $a]` export const expectedFind = [ { node: '[1, 2, 3, 4, 5]', captures: { $a: '1' }, arrayCaptures: { $$$b: ['3', '4'], }, }, ] export const replace = `[2, $$$b, 5]` export const expectedReplace = `[2, 3, 4, 5]` imp...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/arrayMatchingDefaultOrderedMismatch.ts
test/findReplace/arrayMatchingDefaultOrderedMismatch.ts
export const input = ` [1, 2, 3, 4, 5] ` export const find = `[1, 2, 3, 5, 4]` export const expectedFind = [] import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ file: __filename, input, find, expectedFind, })
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/nestedSwap.ts
test/findReplace/nestedSwap.ts
export const input = ` (1 + 2) * (3 + 4) ` export const find = ` $a * $b ` export const replace = ` $b * $a ` export const expectedReplace = ` (3 + 4) * (1 + 2) ` import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ file: __filename, input, find, replace, expectedReplace, })
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/nonCaptureClassProperties.ts
test/findReplace/nonCaptureClassProperties.ts
export const input = ` class Foo { +$a: number static $b [$c]: string $d = 1 $e } ` export const find = ` class Foo { +$_a: number static $_b [$_c]: string $_d = 1 $_e } ` export const parsers = ['babel', 'recast/babel'] export const expectedFind = [ { node: input.trim(), }, ] import { fi...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/renamedImportSelfMatch.ts
test/findReplace/renamedImportSelfMatch.ts
export const input = `import { Foo as Bar } from 'foo'` export const expectMatchesSelf = true import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ file: __filename, input, expectMatchesSelf, })
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/flowObjectTypeAnnotationRestCapture.ts
test/findReplace/flowObjectTypeAnnotationRestCapture.ts
export const input = ` type X = {| ...C, a?: number, b: string |} ` export const find = ` type X = /**/ {| $$$a: $ |} ` export const replace = ` type X = /**/ { $$$a: $ } ` export const expectedReplace = ` type X = { ...C, a?: number, b: string } ` import { findReplaceTestcase } from '../findReplaceTestcase' ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/typeParameterDeclaration.ts
test/findReplace/typeParameterDeclaration.ts
export const input = ` type Foo<W, X, Y, Z> = [W, X, Y, Z] type Bar<A, B, C> = [A, B, C] ` export const find = `type Foo<$a, $$b, Z> = $c` export const expectedFind = [ { node: 'type Foo<W, X, Y, Z> = [W, X, Y, Z]', captures: { $a: 'W', $c: '[W, X, Y, Z]', }, arrayCaptures: { $$b: ...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/rewriteNextAppImport.ts
test/findReplace/rewriteNextAppImport.ts
export const input = ` import App from 'next/app' ` export const find = ` import $App from 'next/app' ` export const replace = ` import { App as $App } from 'next' ` export const expectedReplace = ` import { App } from 'next' ` import { findReplaceTestcase } from '../findReplaceTestcase' findReplaceTestcase({ fil...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false
codemodsquad/astx
https://github.com/codemodsquad/astx/blob/c76c2219fd40bdbd1c75dc8aa0ac13da14a56910/test/findReplace/stringPlaceholderReplacementLeadingComment.ts
test/findReplace/stringPlaceholderReplacementLeadingComment.ts
import { findReplaceTestcase } from '../findReplaceTestcase' import dedent from 'dedent-js' findReplaceTestcase({ file: __filename, input: dedent` t.number() t.string('foo') `, find: dedent` t.string('$s') `, replace: dedent` // this is a test $s `, expectedReplace: dedent` t.n...
typescript
MIT
c76c2219fd40bdbd1c75dc8aa0ac13da14a56910
2026-01-05T05:01:15.024820Z
false