{"name":"ts-morph","version":"15.0.0","description":"TypeScript compiler wrapper for static analysis and code manipulation.","main":"dist/ts-morph.js","typings":"lib/ts-morph.d.ts","scripts":{"dopublish":"npm run type-check-docs && npm run package && npm run publish-code-verification && echo \"Run: npm publish --otp\"","build":"npm run build:declarations && npm run build:deno && npm run build:node","build:node":"rimraf dist && rollup -c ","build:deno":"rimraf dist-deno && rollup -c --environment BUILD:deno && deno run -A scripts/buildDeno.ts","build:declarations":"deno run -A scripts/generation/main.ts create-declaration-file","test":"cross-env TS_NODE_TRANSPILE_ONLY=\"true\" mocha","test:debug":"npm run test --inspect-brk","test:watch":"npm run test --watch-extensions ts --watch","test:ci":"npm run test","test:ts-versions":"deno run -A scripts/test/testTypeScriptVersions.ts","type-check":"deno run -A scripts/typeCheckLibrary.ts","code-generate":"deno run -A scripts/generation/main.ts","output-wrapped-nodes":"deno run -A scripts/generation/outputWrappedNodesInfo.ts","package":"npm run build","publish-code-verification":"npm run code-verification && npm run ensure-no-declaration-file-errors","code-verification":"deno run -A scripts/verification/main.ts ensure-structures-match-classes ensure-overload-structures-match ensure-array-inputs-readonly ensure-classes-implement-structure-methods ensure-mixin-not-applied-multiple-times validate-public-api-class-member-names validate-compiler-node-to-wrapped-type validate-code-fences","ensure-structures-match-classes":"deno run -A scripts/verification/main.ts ensure-structures-match-classes","ensure-overload-structures-match":"deno run -A scripts/verification/main.ts ensure-overload-structures-match","ensure-no-project-compile-errors":"deno run -A scripts/verification/ensureNoProjectCompileErrors.ts","ensure-no-declaration-file-errors":"deno run -A scripts/verification/ensureNoDeclarationFileErrors.ts","ensure-array-inputs-readonly":"deno run -A scripts/verification/main ensure-array-inputs-readonly.ts","ensure-or-throw-exists":"deno run -A scripts/verification/main ensure-or-throw-exists.ts","type-check-docs":"deno run -A scripts/typeCheckDocumentation.ts"},"repository":{"type":"git","url":"git+https://github.com/dsherret/ts-morph.git"},"keywords":["typescript","ast","static analysis","code generation","code refactor"],"author":{"name":"David Sherret"},"license":"MIT","bugs":{"url":"https://github.com/dsherret/ts-morph/issues"},"homepage":"https://github.com/dsherret/ts-morph#readme","dependencies":{"@ts-morph/common":"~0.15.0","code-block-writer":"^11.0.0"},"devDependencies":{"@types/chai":"^4.3.0","@types/diff":"^5.0.2","@types/mocha":"^9.1.0","@types/node":"^16.11.7","chai":"^4.3.6","conditional-type-checks":"^1.0.5","cross-env":"^7.0.3","diff":"^5.0.0","mocha":"9.2.1","rimraf":"^3.0.2","rollup":"^2.69.0","rollup-plugin-typescript2":"^0.31.2","ts-node":"10.6.0","typescript":"~4.6.2"},"standard-version":{"tagPrefix":"","skip":{"tag":true,"commit":true}},"browser":{"fs":false,"os":false,"fs.realpath":false,"mkdirp":false,"dir-glob":false,"graceful-fs":false,"fast-glob":false,"source-map-support":false,"glob-parent":false,"glob":false},"gitHead":"698cf80cc98e0715878975d6d050918492b0f2be","_id":"ts-morph@15.0.0","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-OZkg0TI1h6FVe8DZXyBo6p7NfCN9EZZkkA736f243KzQ3cypYWtaLc9eyNn/JH/fWYfQ4d6wIA4oM0vElRTGcQ==","shasum":"927a85d22909b95fa81e399c94fea655d98be514","tarball":"http://registry-npm.ywwl.com/ts-morph/download/ts-morph-15.0.0.tgz","fileCount":5,"unpackedSize":1400722,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD7YYXpzv5qCij5kFTWj/MZYcWruF7TFJOgS9u4fK5d0QIhAPyOHtq9/kirH2Pryq7NSFs3xXRwZJpuh1OIGyeMhFxO"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJijV8FACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp/XA/9Fk1nvjBNLaZpwGJrxRqtzUlff9jwR+nza9/ahGssdVAVsHiK\r\n0BYzjAo7BeSXuRep20+xeFrHC+X/o0F11hMSfPIek68RWUo8IKljpsAs8MS9\r\nLjref+wEHBAB/vGBW940AKKns/KjbeJyXgs9e95KtwtPjVfsv5xScN3j768H\r\n+rtgUK0CRfWDhpZlI5SvppWxQsL8vDvogDKPLhSSj1bSG59xaXytV/xG1cQk\r\n9LmYY7tvFi3aAdw+WN8RCjUunAjmWZJFF/ikZGY8ky6D87o9TFCe3ZVfhPVw\r\natcvu8Oj9LF6P+mCVR1gcim0yv2qlN/Yd4laVaZsa0VmwYRQz9PzkE8azmWJ\r\nD5HjHHfDSNK7wG+L6KJVMOTwu8dTMVgM5vwW6XdR8vSTeE3kdzPLOWolmh76\r\nNjfpJGmoD3+1cInFm5wFodR8aRQ8cjjUcFknnXWZdz4QA59EYWNmSLG0KNRP\r\nif3EtL9h7vSii3YTfjLi0bZPzycHzv9q5DfOs1mHRhoBOpc9PLW+4f2415Ua\r\n5iRYCIm4ipGhvRnEsEOU6GY5ouGy7LmoQd05u7f7LtxyllWSkjSwHXALu/1V\r\nA9yFWi7/+rN/2I4YGkTEcn7rZgFeu3X6NtlATWZJOW8GZJcOsnw23Zy+PUrc\r\nrgJpSlIbm+T7B/ktakOAVRdGhvjNZE5SJEM=\r\n=9KdQ\r\n-----END PGP SIGNATURE-----\r\n","size":193080,"noattachment":false,"key":"/ts-morph/-/ts-morph-15.0.0.tgz"},"_npmUser":{"name":"dsherret","email":"dsherret@gmail.com"},"directories":{},"maintainers":[{"name":"dsherret","email":"dsherret@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-morph_15.0.0_1653432068939_0.42317742669406133"},"_hasShrinkwrap":false,"readme":"﻿# ts-morph\n\n[![npm version](https://badge.fury.io/js/ts-morph.svg)](https://badge.fury.io/js/ts-morph)\n[![CI](https://github.com/dsherret/ts-morph/workflows/CI/badge.svg)](https://github.com/dsherret/ts-morph/actions?query=workflow%3ACI)\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\n[TypeScript](https://github.com/Microsoft/TypeScript) Compiler API wrapper. Provides an easier way to programmatically navigate and manipulate TypeScript and JavaScript code.\n\nFormerly `ts-simple-ast`.\n\n## Overview\n\n- [Documentation](https://ts-morph.com/)\n- [Declaration file](https://github.com/dsherret/ts-morph/blob/latest/packages/ts-morph/lib/ts-morph.d.ts)\n\n## Main Features\n\n1. Wraps the compiler API objects to provide helper methods for getting information and programmatically changing files.\n2. Allows falling back to the compiler API objects if necessary (ex. `classDeclaration.compilerNode` or `typeChecker.compilerObject`).\n3. All changes are kept in memory (including file and directory moves) until specifying to save to the underlying file system.\n4. Changes are made to the text and wrapped nodes can be held on to between manipulations.\n\n## Getting Started\n\n1. [Installing](https://ts-morph.com/)\n2. [Instantiating](https://ts-morph.com/setup/)\n3. [Adding source files](https://ts-morph.com/setup/adding-source-files)\n4. [Getting source files](https://ts-morph.com/navigation/getting-source-files)\n5. [Navigating](https://ts-morph.com/navigation/example)\n6. [Manipulating](https://ts-morph.com/manipulation/)\n\n## Library Progress\n\nThis library is still under active development. Most common code manipulation/generation use cases are implemented, but there's still a lot of work to do. Please open an issue if you find a feature missing, bug, or question that isn't in the issue tracker.\n\n- [Breaking changes](https://github.com/dsherret/ts-morph/blob/latest/packages/ts-morph/breaking-changes.md)\n- [Change log](https://github.com/dsherret/ts-morph/blob/latest/packages/ts-morph/CHANGELOG.md)\n- [Wrapped nodes progress report](https://github.com/dsherret/ts-morph/blob/latest/packages/ts-morph/wrapped-nodes.md)\n\n## Example\n\n<!-- dprint-ignore -->\n```ts\nimport { Project, StructureKind } from \"ts-morph\";\n\n// initialize\nconst project = new Project({\n    // Optionally specify compiler options, tsconfig.json, in-memory file system, and more here.\n    // If you initialize with a tsconfig.json, then it will automatically populate the project\n    // with the associated source files.\n    // Read more: https://ts-morph.com/setup/\n});\n\n// add source files\nproject.addSourceFilesAtPaths(\"src/**/*.ts\");\nconst myClassFile = project.createSourceFile(\"src/MyClass.ts\", \"export class MyClass {}\");\nconst myEnumFile = project.createSourceFile(\"src/MyEnum.ts\", {\n    statements: [{\n        kind: StructureKind.Enum,\n        name: \"MyEnum\",\n        isExported: true,\n        members: [{ name: \"member\" }],\n    }],\n});\n\n// get information\nconst myClass = myClassFile.getClassOrThrow(\"MyClass\");\nmyClass.getName();          // returns: \"MyClass\"\nmyClass.hasExportKeyword(); // returns: true\nmyClass.isDefaultExport();  // returns: false\n\n// manipulate\nconst myInterface = myClassFile.addInterface({\n    name: \"IMyInterface\",\n    isExported: true,\n    properties: [{\n        name: \"myProp\",\n        type: \"number\",\n    }],\n});\n\nmyClass.rename(\"NewName\");\nmyClass.addImplements(myInterface.getName());\nmyClass.addProperty({\n    name: \"myProp\",\n    initializer: \"5\",\n});\n\nproject.getSourceFileOrThrow(\"src/ExistingFile.ts\").delete();\n\n// asynchronously save all the changes above\nawait project.save();\n\n// get underlying compiler node from the typescript AST from any node\nconst compilerNode = myClassFile.compilerNode;\n```\n\nOr navigate existing compiler nodes created with the TypeScript compiler (the `ts` named export is the TypeScript compiler):\n\n```ts ignore-error: 1109\nimport { createWrappedNode, ClassDeclaration, ts } from \"ts-morph\";\n\n// some code that creates a class declaration using the ts object\nconst classNode: ts.ClassDeclaration = ...;\n\n// create and use a wrapped node\nconst classDec = createWrappedNode(classNode) as ClassDeclaration;\nconst firstProperty = classDec.getProperties()[0];\n\n// ... do more stuff here ...\n```\n","publish_time":1653432069183,"_cnpm_publish_time":1653432069183,"dist-tags":{"latest":"28.0.0","rc":"2.0.4-rc"}}