@rightcapital/phpdoc-parser 0.4.41--.652.1.0 → 0.4.42--.655.1.0

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.
@@ -1,12 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderTsSourceFileToString = exports.renderTsNodeToString = exports.createEnumNode = exports.createCommentNode = exports.createInterfaceNode = exports.createExportDeclarationNode = exports.createImportDeclarationNode = exports.addStatementsToNode = exports.createSourceFileRoot = void 0;
3
+ exports.createSourceFileRoot = createSourceFileRoot;
4
+ exports.addStatementsToNode = addStatementsToNode;
5
+ exports.createImportDeclarationNode = createImportDeclarationNode;
6
+ exports.createExportDeclarationNode = createExportDeclarationNode;
7
+ exports.createInterfaceNode = createInterfaceNode;
8
+ exports.createCommentNode = createCommentNode;
9
+ exports.createEnumNode = createEnumNode;
10
+ exports.renderTsNodeToString = renderTsNodeToString;
11
+ exports.renderTsSourceFileToString = renderTsSourceFileToString;
4
12
  const typescript_1 = require("typescript");
5
13
  function createSourceFileRoot(fileName, sourceText = '', scriptTarget = typescript_1.ScriptTarget.Latest, scriptKind = typescript_1.ScriptKind.TS) {
6
14
  const sourceFile = (0, typescript_1.createSourceFile)(fileName, sourceText, scriptTarget, true, scriptKind);
7
15
  return sourceFile;
8
16
  }
9
- exports.createSourceFileRoot = createSourceFileRoot;
10
17
  function addStatementsToNode(sourceFile, newStatements) {
11
18
  const updatedStatements = typescript_1.factory.createNodeArray([
12
19
  ...sourceFile.statements,
@@ -14,14 +21,12 @@ function addStatementsToNode(sourceFile, newStatements) {
14
21
  ]);
15
22
  return typescript_1.factory.updateSourceFile(sourceFile, updatedStatements);
16
23
  }
17
- exports.addStatementsToNode = addStatementsToNode;
18
24
  function createImportDeclarationNode(symbols, filePath) {
19
25
  const importClause = typescript_1.factory.createImportClause(true, undefined, typescript_1.factory.createNamedImports(symbols.map((symbol) => typescript_1.factory.createImportSpecifier(false, undefined, typescript_1.factory.createIdentifier(symbol)))));
20
26
  const moduleSpecifier = typescript_1.factory.createStringLiteral(filePath);
21
27
  const importDeclaration = typescript_1.factory.createImportDeclaration(undefined, importClause, moduleSpecifier);
22
28
  return importDeclaration;
23
29
  }
24
- exports.createImportDeclarationNode = createImportDeclarationNode;
25
30
  function createExportDeclarationNode(symbols, moduleSpecifierString) {
26
31
  const exportSpecifiers = symbols.map((symbol) => typescript_1.factory.createExportSpecifier(false, undefined, typescript_1.factory.createIdentifier(symbol)));
27
32
  const namedExports = typescript_1.factory.createNamedExports(exportSpecifiers);
@@ -31,12 +36,10 @@ function createExportDeclarationNode(symbols, moduleSpecifierString) {
31
36
  const exportDeclaration = typescript_1.factory.createExportDeclaration(undefined, false, namedExports, moduleSpecifier);
32
37
  return exportDeclaration;
33
38
  }
34
- exports.createExportDeclarationNode = createExportDeclarationNode;
35
39
  function createInterfaceNode(interfaceName, members = [], typeParameters = [], heritageClauses = []) {
36
40
  const interfaceDeclaration = typescript_1.factory.createInterfaceDeclaration([typescript_1.factory.createModifier(typescript_1.SyntaxKind.ExportKeyword)], typescript_1.factory.createIdentifier(interfaceName), typeParameters, heritageClauses, members);
37
41
  return interfaceDeclaration;
38
42
  }
39
- exports.createInterfaceNode = createInterfaceNode;
40
43
  function createCommentNode(commentText, isMultiLine = true, hasTrailingNewLine = true) {
41
44
  const emptyStatement = typescript_1.factory.createEmptyStatement();
42
45
  let formattedCommentText;
@@ -51,7 +54,6 @@ function createCommentNode(commentText, isMultiLine = true, hasTrailingNewLine =
51
54
  : typescript_1.SyntaxKind.SingleLineCommentTrivia, formattedCommentText, hasTrailingNewLine);
52
55
  return emptyStatementWithComment;
53
56
  }
54
- exports.createCommentNode = createCommentNode;
55
57
  function createEnumNode(enumName, members, modifiers) {
56
58
  const memberNodes = members.map(([key, value]) => typescript_1.factory.createEnumMember(key, typeof value === 'number'
57
59
  ? typescript_1.factory.createNumericLiteral(value)
@@ -59,16 +61,13 @@ function createEnumNode(enumName, members, modifiers) {
59
61
  const enumDeclaration = typescript_1.factory.createEnumDeclaration(modifiers.map((modifier) => typescript_1.factory.createToken(modifier)), typescript_1.factory.createIdentifier(enumName), memberNodes);
60
62
  return enumDeclaration;
61
63
  }
62
- exports.createEnumNode = createEnumNode;
63
64
  function renderTsNodeToString(tsNode) {
64
65
  const printer = (0, typescript_1.createPrinter)({ newLine: typescript_1.NewLineKind.LineFeed });
65
66
  const resultFile = createSourceFileRoot('temp.ts');
66
67
  return printer.printNode(typescript_1.EmitHint.Unspecified, tsNode, resultFile);
67
68
  }
68
- exports.renderTsNodeToString = renderTsNodeToString;
69
69
  function renderTsSourceFileToString(sourceFile) {
70
70
  const printer = (0, typescript_1.createPrinter)({ newLine: typescript_1.NewLineKind.LineFeed });
71
71
  const sourceFileContent = printer.printFile(sourceFile);
72
72
  return sourceFileContent;
73
73
  }
74
- exports.renderTsSourceFileToString = renderTsSourceFileToString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightcapital/phpdoc-parser",
3
- "version": "0.4.41-.652.1.0",
3
+ "version": "0.4.42-.655.1.0",
4
4
  "keywords": [
5
5
  "PHP",
6
6
  "PHPDoc",
@@ -48,7 +48,7 @@
48
48
  "dependencies": {
49
49
  "@types/node": "20.14.6",
50
50
  "lodash": "4.17.21",
51
- "typescript": "5.4.5"
51
+ "typescript": "5.5.2"
52
52
  },
53
53
  "config": {
54
54
  "commitizen": {