ts-morph-helpers
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -5,2 +5,3 @@ export * from './findJsxIdentifiersInJsxExpressions'; | ||
export * from './getReferencedSourceFiles'; | ||
export * from './hasSymbol'; | ||
export * from './isBarrel'; |
@@ -21,2 +21,3 @@ "use strict"; | ||
__exportStar(require("./getReferencedSourceFiles"), exports); | ||
__exportStar(require("./hasSymbol"), exports); | ||
__exportStar(require("./isBarrel"), exports); |
@@ -0,1 +1,2 @@ | ||
export * from './findDuplicateExportedNames'; | ||
export * from './findExportDeclarationByIdentifier'; | ||
@@ -2,0 +3,0 @@ export * from './findExportDeclarationByName'; |
@@ -17,2 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./findDuplicateExportedNames"), exports); | ||
__exportStar(require("./findExportDeclarationByIdentifier"), exports); | ||
@@ -19,0 +20,0 @@ __exportStar(require("./findExportDeclarationByName"), exports); |
{ | ||
"name": "ts-morph-helpers", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Helpers for ts-morph", | ||
@@ -8,4 +8,5 @@ "main": "dist/index.js", | ||
"test": "node --loader tsx --test src/**/*.spec.ts", | ||
"build": "rm -r dist && tsc", | ||
"barrel": "barrel-maintainer --includeRootDir --singleQuotes --ts ./src", | ||
"watch": "tsc --watch & npm run barrel", | ||
"build": "rm -rf dist && tsc", | ||
"barrel": "barrel-maintainer --singleQuotes --ts ./src", | ||
"prepublishOnly": "npm test && npm run build", | ||
@@ -12,0 +13,0 @@ "release": "release-it" |
@@ -12,2 +12,3 @@ # Helpers for ts-morph | ||
experimental/getReferencedSourceFiles | ||
experimental/hasSymbol | ||
experimental/isBarrel | ||
@@ -21,2 +22,3 @@ expressions/findCallExpressionsByName | ||
jsx/isJsx | ||
module/findDuplicateExportedNames | ||
module/findExportDeclarationByIdentifier | ||
@@ -35,1 +37,44 @@ module/findExportDeclarationByName | ||
``` | ||
## Naming Is Hard | ||
### Terminology | ||
When looking at this example code... | ||
```ts | ||
import { a } from './a'; | ||
import { b } from 'b'; | ||
const c = a + b; | ||
const d = b(c); | ||
export { c }; | ||
``` | ||
...we can apply the following (incomplete) list of terms: | ||
| Name | Description | Example | | ||
| ------------------ | ------------------------------------------------------- | -------------------------------------------- | | ||
| Symbol | Named declaration, connects declaration nodes. | `a`, `b`, `c`, `d` | | ||
| Identifier | Node, references a symbol | `a` (2x), `b` (3x), `c` (2x), `d` (1x) | | ||
| Specifier | More specific classification of identifier | `ImportSpecifier` `a`, `ExportSpecifier` `c` | | ||
| Call expression | Function call with arguments | `b(c)` | | ||
| Import declaration | An import declaration with named and/or default imports | `import { b } from 'b'` | | ||
| Export declaration | An export declaration with named (not default) exports | `export { b } from 'b'` | | ||
Here is the | ||
[example code in the TypeScript AST Viewer](https://ts-ast-viewer.com/#code/JYWwDg9gTgLgBAbzgQzgXzgMyhEcDkAdAPTL4DcAUKJLInAEbpY574MWUDGEAdgM7wucALwo4AakZUeA+ABNRjABRcAlFQCmAD1rwkwtFSA) | ||
to see the nodes as described. | ||
### Additional terminology | ||
- SourceFile: The AST of a given source file | ||
- Program: Collection of source files, and its main entry | ||
### Conventions | ||
The following conventions are used to name the helper functions: | ||
- To `get` something means the thing is a reference expected to be there (upwards and/or linked). | ||
- To `find` something means to query for things from a certain starting point (downwards). | ||
- To get things `For` something expresses an `AncestorForDescendant` hierarchy. | ||
- To get things `Of` something means the opposite: `descendantOfAncestor`. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39547
72
651
78