@travetto/transformer 2.0.4 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@travetto/transformer",
3
3
  "displayName": "Transformation",
4
- "version": "2.0.4",
4
+ "version": "2.1.2",
5
5
  "description": "Functionality for AST transformations, with transformer registration, and general utils",
6
6
  "keywords": [
7
7
  "typescript",
@@ -25,7 +25,7 @@
25
25
  "directory": "module/transformer"
26
26
  },
27
27
  "dependencies": {
28
- "@travetto/base": "^2.0.2"
28
+ "@travetto/base": "^2.1.2"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"
@@ -63,9 +63,9 @@ export class DeclarationUtil {
63
63
 
64
64
  /**
65
65
  * Get accessor pair based off of passing in one in
66
- *
67
- * @param node
68
- * @returns
66
+ *
67
+ * @param node
68
+ * @returns
69
69
  */
70
70
  static getAccessorPair(node: ts.GetAccessorDeclaration | ts.SetAccessorDeclaration) {
71
71
  const acc = { getter: ts.isGetAccessorDeclaration(node) ? node : undefined, setter: ts.isSetAccessorDeclaration(node) ? node : undefined };
package/src/util/doc.ts CHANGED
@@ -26,7 +26,7 @@ export class DocUtil {
26
26
  * Read JS Docs from a `ts.Declaration`
27
27
  */
28
28
  static describeDocs(node: ts.Declaration | ts.Type) {
29
- if (!('getSourceFile' in node)) {
29
+ if (node && !('getSourceFile' in node)) {
30
30
  node = DeclarationUtil.getPrimaryDeclarationNode(node);
31
31
  }
32
32
  const out: DeclDocumentation = {
package/src/visitor.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as ts from 'typescript';
2
- import * as fs from 'fs';
2
+ import { createWriteStream } from 'fs';
3
3
 
4
4
  import { ConsoleManager } from '@travetto/base/src/console';
5
5
  import { AppCache } from '@travetto/boot';
@@ -85,7 +85,7 @@ export class VisitorFactory<S extends State = State> {
85
85
  return (context: ts.TransformationContext) => (file: ts.SourceFile): ts.SourceFile => {
86
86
  try {
87
87
  const c = new console.Console({
88
- stdout: fs.createWriteStream(AppCache.toEntryName(this.#logTarget), { flags: 'a' }),
88
+ stdout: createWriteStream(AppCache.toEntryName(this.#logTarget), { flags: 'a' }),
89
89
  inspectOptions: { depth: 4 },
90
90
  });
91
91
 
@@ -1,5 +1,5 @@
1
1
  import * as ts from 'typescript';
2
- import * as fs from 'fs';
2
+ import { readFileSync } from 'fs';
3
3
 
4
4
  import { FsUtil, ScanFs } from '@travetto/boot';
5
5
  import { Util } from '@travetto/base';
@@ -7,9 +7,9 @@ import { Util } from '@travetto/base';
7
7
  import { VisitorFactory, TransformerState, getAllTransformers } from '..';
8
8
 
9
9
  /**
10
- * Utils for testing transformerse
10
+ * Utils for testing transformers
11
11
  */
12
- export class TranformerTestUtil {
12
+ export class TransformerTestUtil {
13
13
  /**
14
14
  * Compile a single file from a folder
15
15
  */
@@ -47,7 +47,7 @@ export class TranformerTestUtil {
47
47
 
48
48
  await Util.wait('1s'); // Wait for file buffer to sync
49
49
  try {
50
- console.info(fs.readFileSync(log, 'utf8'));
50
+ console.info(readFileSync(log, 'utf8'));
51
51
  } catch { }
52
52
 
53
53
  await FsUtil.unlinkRecursive(log);