ts-codemod-lib 1.0.1

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.
Files changed (149) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +33 -0
  3. package/dist/cmd/convert-to-readonly.d.mts +3 -0
  4. package/dist/cmd/convert-to-readonly.d.mts.map +1 -0
  5. package/dist/cmd/convert-to-readonly.mjs +137 -0
  6. package/dist/cmd/convert-to-readonly.mjs.map +1 -0
  7. package/dist/entry-point.d.mts +2 -0
  8. package/dist/entry-point.d.mts.map +1 -0
  9. package/dist/entry-point.mjs +19 -0
  10. package/dist/entry-point.mjs.map +1 -0
  11. package/dist/functions/ast-transformers/convert-interface-to-type.d.mts +7 -0
  12. package/dist/functions/ast-transformers/convert-interface-to-type.d.mts.map +1 -0
  13. package/dist/functions/ast-transformers/convert-interface-to-type.mjs +83 -0
  14. package/dist/functions/ast-transformers/convert-interface-to-type.mjs.map +1 -0
  15. package/dist/functions/ast-transformers/convert-to-readonly-type.d.mts +29 -0
  16. package/dist/functions/ast-transformers/convert-to-readonly-type.d.mts.map +1 -0
  17. package/dist/functions/ast-transformers/convert-to-readonly-type.mjs +811 -0
  18. package/dist/functions/ast-transformers/convert-to-readonly-type.mjs.map +1 -0
  19. package/dist/functions/ast-transformers/index.d.mts +7 -0
  20. package/dist/functions/ast-transformers/index.d.mts.map +1 -0
  21. package/dist/functions/ast-transformers/index.mjs +9 -0
  22. package/dist/functions/ast-transformers/index.mjs.map +1 -0
  23. package/dist/functions/ast-transformers/readonly-transformer-helpers/compare-union-types.d.mts +3 -0
  24. package/dist/functions/ast-transformers/readonly-transformer-helpers/compare-union-types.d.mts.map +1 -0
  25. package/dist/functions/ast-transformers/readonly-transformer-helpers/compare-union-types.mjs +22 -0
  26. package/dist/functions/ast-transformers/readonly-transformer-helpers/compare-union-types.mjs.map +1 -0
  27. package/dist/functions/ast-transformers/readonly-transformer-helpers/constants.d.mts +2 -0
  28. package/dist/functions/ast-transformers/readonly-transformer-helpers/constants.d.mts.map +1 -0
  29. package/dist/functions/ast-transformers/readonly-transformer-helpers/constants.mjs +15 -0
  30. package/dist/functions/ast-transformers/readonly-transformer-helpers/constants.mjs.map +1 -0
  31. package/dist/functions/ast-transformers/readonly-transformer-helpers/group-union-types.d.mts +21 -0
  32. package/dist/functions/ast-transformers/readonly-transformer-helpers/group-union-types.d.mts.map +1 -0
  33. package/dist/functions/ast-transformers/readonly-transformer-helpers/group-union-types.mjs +72 -0
  34. package/dist/functions/ast-transformers/readonly-transformer-helpers/group-union-types.mjs.map +1 -0
  35. package/dist/functions/ast-transformers/readonly-transformer-helpers/index.d.mts +5 -0
  36. package/dist/functions/ast-transformers/readonly-transformer-helpers/index.d.mts.map +1 -0
  37. package/dist/functions/ast-transformers/readonly-transformer-helpers/index.mjs +5 -0
  38. package/dist/functions/ast-transformers/readonly-transformer-helpers/index.mjs.map +1 -0
  39. package/dist/functions/ast-transformers/readonly-transformer-helpers/readonly-context.d.mts +37 -0
  40. package/dist/functions/ast-transformers/readonly-transformer-helpers/readonly-context.d.mts.map +1 -0
  41. package/dist/functions/ast-transformers/readonly-transformer-helpers/readonly-context.mjs +19 -0
  42. package/dist/functions/ast-transformers/readonly-transformer-helpers/readonly-context.mjs.map +1 -0
  43. package/dist/functions/ast-transformers/replace-record-with-unknown-record.d.mts +7 -0
  44. package/dist/functions/ast-transformers/replace-record-with-unknown-record.d.mts.map +1 -0
  45. package/dist/functions/ast-transformers/replace-record-with-unknown-record.mjs +173 -0
  46. package/dist/functions/ast-transformers/replace-record-with-unknown-record.mjs.map +1 -0
  47. package/dist/functions/ast-transformers/transform-source-code.d.mts +3 -0
  48. package/dist/functions/ast-transformers/transform-source-code.d.mts.map +1 -0
  49. package/dist/functions/ast-transformers/transform-source-code.mjs +27 -0
  50. package/dist/functions/ast-transformers/transform-source-code.mjs.map +1 -0
  51. package/dist/functions/ast-transformers/types.d.mts +3 -0
  52. package/dist/functions/ast-transformers/types.d.mts.map +1 -0
  53. package/dist/functions/ast-transformers/types.mjs +2 -0
  54. package/dist/functions/ast-transformers/types.mjs.map +1 -0
  55. package/dist/functions/constants/ignore-comment-text.d.mts +3 -0
  56. package/dist/functions/constants/ignore-comment-text.d.mts.map +1 -0
  57. package/dist/functions/constants/ignore-comment-text.mjs +5 -0
  58. package/dist/functions/constants/ignore-comment-text.mjs.map +1 -0
  59. package/dist/functions/constants/index.d.mts +2 -0
  60. package/dist/functions/constants/index.d.mts.map +1 -0
  61. package/dist/functions/constants/index.mjs +2 -0
  62. package/dist/functions/constants/index.mjs.map +1 -0
  63. package/dist/functions/functions/has-disable-next-line-comment.d.mts +10 -0
  64. package/dist/functions/functions/has-disable-next-line-comment.d.mts.map +1 -0
  65. package/dist/functions/functions/has-disable-next-line-comment.mjs +47 -0
  66. package/dist/functions/functions/has-disable-next-line-comment.mjs.map +1 -0
  67. package/dist/functions/functions/index.d.mts +9 -0
  68. package/dist/functions/functions/index.d.mts.map +1 -0
  69. package/dist/functions/functions/index.mjs +9 -0
  70. package/dist/functions/functions/index.mjs.map +1 -0
  71. package/dist/functions/functions/is-as-const-node.d.mts +10 -0
  72. package/dist/functions/functions/is-as-const-node.d.mts.map +1 -0
  73. package/dist/functions/functions/is-as-const-node.mjs +30 -0
  74. package/dist/functions/functions/is-as-const-node.mjs.map +1 -0
  75. package/dist/functions/functions/is-primitive-type-node.d.mts +15 -0
  76. package/dist/functions/functions/is-primitive-type-node.d.mts.map +1 -0
  77. package/dist/functions/functions/is-primitive-type-node.mjs +46 -0
  78. package/dist/functions/functions/is-primitive-type-node.mjs.map +1 -0
  79. package/dist/functions/functions/is-readonly-node.d.mts +21 -0
  80. package/dist/functions/functions/is-readonly-node.d.mts.map +1 -0
  81. package/dist/functions/functions/is-readonly-node.mjs +30 -0
  82. package/dist/functions/functions/is-readonly-node.mjs.map +1 -0
  83. package/dist/functions/functions/is-spread-parameter-node.d.mts +4 -0
  84. package/dist/functions/functions/is-spread-parameter-node.d.mts.map +1 -0
  85. package/dist/functions/functions/is-spread-parameter-node.mjs +9 -0
  86. package/dist/functions/functions/is-spread-parameter-node.mjs.map +1 -0
  87. package/dist/functions/functions/remove-parentheses.d.mts +3 -0
  88. package/dist/functions/functions/remove-parentheses.d.mts.map +1 -0
  89. package/dist/functions/functions/remove-parentheses.mjs +9 -0
  90. package/dist/functions/functions/remove-parentheses.mjs.map +1 -0
  91. package/dist/functions/functions/unwrap-readonly.d.mts +3 -0
  92. package/dist/functions/functions/unwrap-readonly.d.mts.map +1 -0
  93. package/dist/functions/functions/unwrap-readonly.mjs +8 -0
  94. package/dist/functions/functions/unwrap-readonly.mjs.map +1 -0
  95. package/dist/functions/functions/wrap-with-parentheses.d.mts +2 -0
  96. package/dist/functions/functions/wrap-with-parentheses.d.mts.map +1 -0
  97. package/dist/functions/functions/wrap-with-parentheses.mjs +4 -0
  98. package/dist/functions/functions/wrap-with-parentheses.mjs.map +1 -0
  99. package/dist/functions/index.d.mts +5 -0
  100. package/dist/functions/index.d.mts.map +1 -0
  101. package/dist/functions/index.mjs +19 -0
  102. package/dist/functions/index.mjs.map +1 -0
  103. package/dist/functions/utils/index.d.mts +2 -0
  104. package/dist/functions/utils/index.d.mts.map +1 -0
  105. package/dist/functions/utils/index.mjs +2 -0
  106. package/dist/functions/utils/index.mjs.map +1 -0
  107. package/dist/functions/utils/replace-with-debug.d.mts +3 -0
  108. package/dist/functions/utils/replace-with-debug.d.mts.map +1 -0
  109. package/dist/functions/utils/replace-with-debug.mjs +7 -0
  110. package/dist/functions/utils/replace-with-debug.mjs.map +1 -0
  111. package/dist/globals.d.mts +1 -0
  112. package/dist/index.d.mts +2 -0
  113. package/dist/index.d.mts.map +1 -0
  114. package/dist/index.mjs +19 -0
  115. package/dist/index.mjs.map +1 -0
  116. package/dist/tsconfig.json +1 -0
  117. package/dist/types.d.mts +2 -0
  118. package/package.json +134 -0
  119. package/src/cmd/convert-to-readonly.mts +195 -0
  120. package/src/entry-point.mts +1 -0
  121. package/src/functions/ast-transformers/convert-interface-to-type.mts +119 -0
  122. package/src/functions/ast-transformers/convert-interface-to-type.test.mts +295 -0
  123. package/src/functions/ast-transformers/convert-to-readonly-type.mts +1391 -0
  124. package/src/functions/ast-transformers/convert-to-readonly-type.test.mts +3653 -0
  125. package/src/functions/ast-transformers/index.mts +6 -0
  126. package/src/functions/ast-transformers/readonly-transformer-helpers/compare-union-types.mts +24 -0
  127. package/src/functions/ast-transformers/readonly-transformer-helpers/constants.mts +12 -0
  128. package/src/functions/ast-transformers/readonly-transformer-helpers/group-union-types.mts +152 -0
  129. package/src/functions/ast-transformers/readonly-transformer-helpers/index.mts +4 -0
  130. package/src/functions/ast-transformers/readonly-transformer-helpers/readonly-context.mts +65 -0
  131. package/src/functions/ast-transformers/replace-record-with-unknown-record.mts +238 -0
  132. package/src/functions/ast-transformers/transform-source-code.mts +38 -0
  133. package/src/functions/ast-transformers/types.mts +6 -0
  134. package/src/functions/constants/ignore-comment-text.mts +3 -0
  135. package/src/functions/constants/index.mts +1 -0
  136. package/src/functions/functions/has-disable-next-line-comment.mts +56 -0
  137. package/src/functions/functions/index.mts +8 -0
  138. package/src/functions/functions/is-as-const-node.mts +47 -0
  139. package/src/functions/functions/is-primitive-type-node.mts +301 -0
  140. package/src/functions/functions/is-readonly-node.mts +247 -0
  141. package/src/functions/functions/is-spread-parameter-node.mts +13 -0
  142. package/src/functions/functions/remove-parentheses.mts +7 -0
  143. package/src/functions/functions/unwrap-readonly.mts +7 -0
  144. package/src/functions/functions/wrap-with-parentheses.mts +2 -0
  145. package/src/functions/index.mts +4 -0
  146. package/src/functions/utils/index.mts +1 -0
  147. package/src/functions/utils/replace-with-debug.mts +10 -0
  148. package/src/globals.d.mts +1 -0
  149. package/src/index.mts +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/functions/constants/index.mts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { IGNORE_FILE_COMMENT_TEXT, IGNORE_LINE_COMMENT_TEXT } from './ignore-comment-text.mjs';
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import * as tsm from 'ts-morph';
2
+ /**
3
+ * Checks if a given ts-morph Node is immediately preceded by a
4
+ * '// transformer-ignore-next-line' comment.
5
+ *
6
+ * @param node - The ts-morph Node to check.
7
+ * @returns True if the node is preceded by the ignore comment on the immediately previous line, false otherwise.
8
+ */
9
+ export declare const hasDisableNextLineComment: (node: tsm.Node) => boolean;
10
+ //# sourceMappingURL=has-disable-next-line-comment.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-disable-next-line-comment.d.mts","sourceRoot":"","sources":["../../../src/functions/functions/has-disable-next-line-comment.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAGhC;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GAAI,MAAM,GAAG,CAAC,IAAI,KAAG,OA6C1D,CAAC"}
@@ -0,0 +1,47 @@
1
+ import * as tsm from 'ts-morph';
2
+ import { IGNORE_LINE_COMMENT_TEXT } from '../constants/ignore-comment-text.mjs';
3
+
4
+ /**
5
+ * Checks if a given ts-morph Node is immediately preceded by a
6
+ * '// transformer-ignore-next-line' comment.
7
+ *
8
+ * @param node - The ts-morph Node to check.
9
+ * @returns True if the node is preceded by the ignore comment on the immediately previous line, false otherwise.
10
+ */
11
+ const hasDisableNextLineComment = (node) => {
12
+ const nodeStartLine = node.getStartLineNumber();
13
+ // Cannot be ignored if it's on the first line
14
+ if (nodeStartLine <= 1) {
15
+ return false;
16
+ }
17
+ const sourceFile = node.getSourceFile(); // Get the SourceFile
18
+ const leadingCommentRanges = node.getLeadingCommentRanges();
19
+ // Iterate backwards through comments as the closest one is most relevant
20
+ for (let mut_i = leadingCommentRanges.length - 1; mut_i >= 0; mut_i--) {
21
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
22
+ const commentRange = leadingCommentRanges[mut_i];
23
+ // Get the end position and convert it to line number
24
+ const commentEndPos = commentRange.getEnd();
25
+ const commentEndLine = sourceFile.getLineAndColumnAtPos(commentEndPos).line;
26
+ // Check if the comment is on the immediately preceding line
27
+ if (nodeStartLine === commentEndLine + 1) {
28
+ // Check if it's a single-line comment containing the specific ignore text
29
+ if (commentRange.getKind() === tsm.SyntaxKind.SingleLineCommentTrivia &&
30
+ commentRange.getText().trim().includes(IGNORE_LINE_COMMENT_TEXT)) {
31
+ return true;
32
+ }
33
+ // If we found *any* comment on the preceding line, but it wasn't
34
+ // the correct ignore comment, then the node is not ignored by
35
+ // a comment on the *immediately* preceding line. Stop checking further back.
36
+ return false;
37
+ }
38
+ // If the comment ends before the preceding line, stop checking further back.
39
+ if (commentEndLine < nodeStartLine - 1) {
40
+ break;
41
+ }
42
+ }
43
+ return false;
44
+ };
45
+
46
+ export { hasDisableNextLineComment };
47
+ //# sourceMappingURL=has-disable-next-line-comment.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-disable-next-line-comment.mjs","sources":["../../../src/functions/functions/has-disable-next-line-comment.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAGA;;;;;;AAMG;AACI,MAAM,yBAAyB,GAAG,CAAC,IAAc,KAAa;AACnE,IAAA,MAAM,aAAa,GAAG,IAAI,CAAC,kBAAkB,EAAE;;AAG/C,IAAA,IAAI,aAAa,IAAI,CAAC,EAAE;AACtB,QAAA,OAAO,KAAK;IACd;IAEA,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;AAExC,IAAA,MAAM,oBAAoB,GAAG,IAAI,CAAC,uBAAuB,EAAE;;AAG3D,IAAA,KAAK,IAAI,KAAK,GAAG,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;;AAErE,QAAA,MAAM,YAAY,GAAG,oBAAoB,CAAC,KAAK,CAAE;;AAGjD,QAAA,MAAM,aAAa,GAAG,YAAY,CAAC,MAAM,EAAE;QAE3C,MAAM,cAAc,GAAG,UAAU,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,IAAI;;AAG3E,QAAA,IAAI,aAAa,KAAK,cAAc,GAAG,CAAC,EAAE;;YAExC,IACE,YAAY,CAAC,OAAO,EAAE,KAAK,GAAG,CAAC,UAAU,CAAC,uBAAuB;AACjE,gBAAA,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EAChE;AACA,gBAAA,OAAO,IAAI;YACb;;;;AAKA,YAAA,OAAO,KAAK;QACd;;AAGA,QAAA,IAAI,cAAc,GAAG,aAAa,GAAG,CAAC,EAAE;YACtC;QACF;IACF;AAEA,IAAA,OAAO,KAAK;AACd;;;;"}
@@ -0,0 +1,9 @@
1
+ export * from './has-disable-next-line-comment.mjs';
2
+ export * from './is-as-const-node.mjs';
3
+ export * from './is-primitive-type-node.mjs';
4
+ export * from './is-readonly-node.mjs';
5
+ export * from './is-spread-parameter-node.mjs';
6
+ export * from './remove-parentheses.mjs';
7
+ export * from './unwrap-readonly.mjs';
8
+ export * from './wrap-with-parentheses.mjs';
9
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/functions/functions/index.mts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,9 @@
1
+ export { hasDisableNextLineComment } from './has-disable-next-line-comment.mjs';
2
+ export { isAsConstNode } from './is-as-const-node.mjs';
3
+ export { isPrimitiveTypeNode } from './is-primitive-type-node.mjs';
4
+ export { isReadonlyArrayTypeNode, isReadonlyTupleOrArrayTypeNode, isReadonlyTupleTypeNode, isReadonlyTypeReferenceNode, isShallowReadonlyTypeNode } from './is-readonly-node.mjs';
5
+ export { isSpreadNamedTupleMemberNode, isSpreadParameterNode } from './is-spread-parameter-node.mjs';
6
+ export { removeParentheses } from './remove-parentheses.mjs';
7
+ export { unwrapReadonlyTypeArgText } from './unwrap-readonly.mjs';
8
+ export { wrapWithParentheses } from './wrap-with-parentheses.mjs';
9
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,10 @@
1
+ import * as ts from 'ts-morph';
2
+ export declare const isAsConstNode: (node: ts.Node) => node is ts.AsExpression & Readonly<{
3
+ type: ts.TypeReferenceNode & Readonly<{
4
+ typeName: ts.Identifier & Readonly<{
5
+ text: "const";
6
+ }>;
7
+ typeArguments: undefined;
8
+ }>;
9
+ }>;
10
+ //# sourceMappingURL=is-as-const-node.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-as-const-node.d.mts","sourceRoot":"","sources":["../../../src/functions/functions/is-as-const-node.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/B,eAAO,MAAM,aAAa,GACxB,MAAM,EAAE,CAAC,IAAI,KACZ,IAAI,IAAI,EAAE,CAAC,YAAY,GACxB,QAAQ,CAAC;IACP,IAAI,EAAE,EAAE,CAAC,iBAAiB,GACxB,QAAQ,CAAC;QACP,QAAQ,EAAE,EAAE,CAAC,UAAU,GACrB,QAAQ,CAAC;YACP,IAAI,EAAE,OAAO,CAAC;SACf,CAAC,CAAC;QACL,aAAa,EAAE,SAAS,CAAC;KAC1B,CAAC,CAAC;CACN,CAgCF,CAAC"}
@@ -0,0 +1,30 @@
1
+ import * as tsm from 'ts-morph';
2
+
3
+ const isAsConstNode = (node) => {
4
+ if (!node.isKind(tsm.SyntaxKind.AsExpression)) {
5
+ return false;
6
+ }
7
+ // 2. Get the 'type' node from the AsExpression
8
+ const typeNode = node.getTypeNode();
9
+ if (typeNode === undefined) {
10
+ return false; // Should have a type node for 'as const'
11
+ }
12
+ // 3. Check if the 'type' node is a TypeReference
13
+ if (!typeNode.isKind(tsm.SyntaxKind.TypeReference)) {
14
+ return false;
15
+ }
16
+ // 4. Get the 'typeName' from the TypeReference
17
+ const typeNameNode = typeNode.getTypeName();
18
+ // 5. Check if the 'typeName' is an Identifier
19
+ if (!typeNameNode.isKind(tsm.SyntaxKind.Identifier)) {
20
+ // 'as const' uses a simple Identifier 'const', not a QualifiedName
21
+ return false;
22
+ }
23
+ // 6. Check if the Identifier's text is 'const'
24
+ // and that there are no type arguments (as const doesn't have them)
25
+ return (typeNameNode.getText() === 'const' &&
26
+ typeNode.getTypeArguments().length === 0);
27
+ };
28
+
29
+ export { isAsConstNode };
30
+ //# sourceMappingURL=is-as-const-node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-as-const-node.mjs","sources":["../../../src/functions/functions/is-as-const-node.mts"],"sourcesContent":[null],"names":["ts"],"mappings":";;AAEO,MAAM,aAAa,GAAG,CAC3B,IAAa,KAWR;AACL,IAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAACA,GAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;AAC5C,QAAA,OAAO,KAAK;IACd;;AAGA,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE;AAEnC,IAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;QAC1B,OAAO,KAAK,CAAC;IACf;;AAGA,IAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAACA,GAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;AACjD,QAAA,OAAO,KAAK;IACd;;AAGA,IAAA,MAAM,YAAY,GAAG,QAAQ,CAAC,WAAW,EAAE;;AAG3C,IAAA,IAAI,CAAC,YAAY,CAAC,MAAM,CAACA,GAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;;AAElD,QAAA,OAAO,KAAK;IACd;;;AAIA,IAAA,QACE,YAAY,CAAC,OAAO,EAAE,KAAK,OAAO;QAClC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,MAAM,KAAK,CAAC;AAE5C;;;;"}
@@ -0,0 +1,15 @@
1
+ import * as tsm from 'ts-morph';
2
+ export type PrimitiveTypeNode = tsm.Node & Readonly<tsm.LiteralTypeNode | tsm.TemplateLiteralTypeNode | (tsm.TypeNode & {
3
+ kind: tsm.SyntaxKind.StringKeyword | tsm.SyntaxKind.BooleanKeyword | tsm.SyntaxKind.NumberKeyword | tsm.SyntaxKind.BigIntKeyword | tsm.SyntaxKind.SymbolKeyword | tsm.SyntaxKind.UndefinedKeyword | tsm.SyntaxKind.VoidKeyword | tsm.SyntaxKind.AnyKeyword | tsm.SyntaxKind.UnknownKeyword | tsm.SyntaxKind.ObjectKeyword | tsm.SyntaxKind.NeverKeyword;
4
+ })>;
5
+ /**
6
+ * Checks if a given ts-morph node represents a primitive type node.
7
+ * This includes keyword types (string, number, etc.), literal types (null, "abc", 123),
8
+ * and template literal types.
9
+ *
10
+ * @param node - The ts-morph node to check.
11
+ * @returns True if the node represents a primitive type node, false otherwise.
12
+ * Acts as a type guard.
13
+ */
14
+ export declare const isPrimitiveTypeNode: (node: tsm.Node) => node is PrimitiveTypeNode;
15
+ //# sourceMappingURL=is-primitive-type-node.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-primitive-type-node.d.mts","sourceRoot":"","sources":["../../../src/functions/functions/is-primitive-type-node.mts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAiBhC,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,IAAI,GACtC,QAAQ,CACJ,GAAG,CAAC,eAAe,GACnB,GAAG,CAAC,uBAAuB,GAC3B,CAAC,GAAG,CAAC,QAAQ,GAAG;IACd,IAAI,EACA,GAAG,CAAC,UAAU,CAAC,aAAa,GAC5B,GAAG,CAAC,UAAU,CAAC,cAAc,GAC7B,GAAG,CAAC,UAAU,CAAC,aAAa,GAC5B,GAAG,CAAC,UAAU,CAAC,aAAa,GAC5B,GAAG,CAAC,UAAU,CAAC,aAAa,GAC5B,GAAG,CAAC,UAAU,CAAC,gBAAgB,GAC/B,GAAG,CAAC,UAAU,CAAC,WAAW,GAC1B,GAAG,CAAC,UAAU,CAAC,UAAU,GACzB,GAAG,CAAC,UAAU,CAAC,cAAc,GAC7B,GAAG,CAAC,UAAU,CAAC,aAAa,GAC5B,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC;CACjC,CAAC,CACL,CAAC;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAC9B,MAAM,GAAG,CAAC,IAAI,KACb,IAAI,IAAI,iBAmBV,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { ISet } from 'ts-data-forge';
2
+ import * as tsm from 'ts-morph';
3
+
4
+ // Define the set of SyntaxKinds that represent primitive type keywords
5
+ const primitiveKeywordKinds = ISet.create([
6
+ tsm.SyntaxKind.StringKeyword,
7
+ tsm.SyntaxKind.BooleanKeyword,
8
+ tsm.SyntaxKind.NumberKeyword,
9
+ tsm.SyntaxKind.BigIntKeyword,
10
+ tsm.SyntaxKind.SymbolKeyword,
11
+ tsm.SyntaxKind.UndefinedKeyword,
12
+ tsm.SyntaxKind.VoidKeyword,
13
+ tsm.SyntaxKind.AnyKeyword,
14
+ tsm.SyntaxKind.UnknownKeyword,
15
+ tsm.SyntaxKind.ObjectKeyword, // Note: 'object' is sometimes considered primitive in TS type system context
16
+ tsm.SyntaxKind.NeverKeyword,
17
+ ]);
18
+ /**
19
+ * Checks if a given ts-morph node represents a primitive type node.
20
+ * This includes keyword types (string, number, etc.), literal types (null, "abc", 123),
21
+ * and template literal types.
22
+ *
23
+ * @param node - The ts-morph node to check.
24
+ * @returns True if the node represents a primitive type node, false otherwise.
25
+ * Acts as a type guard.
26
+ */
27
+ const isPrimitiveTypeNode = (node) => {
28
+ // Check for literal types (null, "aaa", 1.23, 456n, true, false)
29
+ if (node.isKind(tsm.SyntaxKind.LiteralType)) {
30
+ return true;
31
+ }
32
+ // Check for template literal types (`abc${expr}def`)
33
+ if (node.isKind(tsm.SyntaxKind.TemplateLiteralType)) {
34
+ return true;
35
+ }
36
+ // Check if it's a TypeNode and its kind is one of the primitive keywords
37
+ // Node.isTypeNode(node) ensures we only check nodes that represent types
38
+ // if (ts.Node.isTypeNode(node) && primitiveKeywordKinds.has(node.getKind())) {
39
+ if (primitiveKeywordKinds.has(node.getKind())) {
40
+ return true;
41
+ }
42
+ return false;
43
+ };
44
+
45
+ export { isPrimitiveTypeNode };
46
+ //# sourceMappingURL=is-primitive-type-node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-primitive-type-node.mjs","sources":["../../../src/functions/functions/is-primitive-type-node.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAGA;AACA,MAAM,qBAAqB,GAAG,IAAI,CAAC,MAAM,CAAiB;IACxD,GAAG,CAAC,UAAU,CAAC,aAAa;IAC5B,GAAG,CAAC,UAAU,CAAC,cAAc;IAC7B,GAAG,CAAC,UAAU,CAAC,aAAa;IAC5B,GAAG,CAAC,UAAU,CAAC,aAAa;IAC5B,GAAG,CAAC,UAAU,CAAC,aAAa;IAC5B,GAAG,CAAC,UAAU,CAAC,gBAAgB;IAC/B,GAAG,CAAC,UAAU,CAAC,WAAW;IAC1B,GAAG,CAAC,UAAU,CAAC,UAAU;IACzB,GAAG,CAAC,UAAU,CAAC,cAAc;AAC7B,IAAA,GAAG,CAAC,UAAU,CAAC,aAAa;IAC5B,GAAG,CAAC,UAAU,CAAC,YAAY;AAC5B,CAAA,CAAC;AAsBF;;;;;;;;AAQG;AACI,MAAM,mBAAmB,GAAG,CACjC,IAAc,KACe;;IAE7B,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;AAC3C,QAAA,OAAO,IAAI;IACb;;IAGA,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE;AACnD,QAAA,OAAO,IAAI;IACb;;;;IAKA,IAAI,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE;AAC7C,QAAA,OAAO,IAAI;IACb;AAEA,IAAA,OAAO,KAAK;AACd;;;;"}
@@ -0,0 +1,21 @@
1
+ import * as tsm from 'ts-morph';
2
+ export declare const isShallowReadonlyTypeNode: (node: tsm.Node) => boolean;
3
+ export declare const isReadonlyTupleOrArrayTypeNode: (node: tsm.Node) => node is ReadonlyArrayTypeNode | ReadonlyTupleTypeNode;
4
+ export type ReadonlyArrayTypeNode = tsm.TypeNode & Omit<tsm.TypeOperatorTypeNode, 'getOperator' | 'getTypeNode'> & Readonly<{
5
+ getOperator: () => tsm.SyntaxKind.ReadonlyKeyword;
6
+ getTypeNode: () => tsm.ArrayTypeNode;
7
+ }>;
8
+ export declare const isReadonlyArrayTypeNode: (node: tsm.Node) => node is ReadonlyArrayTypeNode;
9
+ export type ReadonlyTupleTypeNode = tsm.TypeNode & Omit<tsm.TypeOperatorTypeNode, 'getOperator' | 'getTypeNode'> & Readonly<{
10
+ getOperator: () => tsm.SyntaxKind.ReadonlyKeyword;
11
+ getTypeNode: () => tsm.TupleTypeNode;
12
+ }>;
13
+ export declare const isReadonlyTupleTypeNode: (node: tsm.Node) => node is ReadonlyTupleTypeNode;
14
+ export type ReadonlyTypeReferenceNode = tsm.TypeNode & Omit<tsm.TypeReferenceNode, 'getTypeName' | 'getTypeArguments'> & Readonly<{
15
+ getTypeName: () => Omit<tsm.Identifier, 'getText'> & Readonly<{
16
+ getText: () => 'Readonly';
17
+ }>;
18
+ getTypeArguments: () => readonly [tsm.TypeNode];
19
+ }>;
20
+ export declare const isReadonlyTypeReferenceNode: (node: tsm.Node) => node is ReadonlyTypeReferenceNode;
21
+ //# sourceMappingURL=is-readonly-node.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-readonly-node.d.mts","sourceRoot":"","sources":["../../../src/functions/functions/is-readonly-node.mts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAGhC,eAAO,MAAM,yBAAyB,GAAI,MAAM,GAAG,CAAC,IAAI,KAAG,OAGhC,CAAC;AAE5B,eAAO,MAAM,8BAA8B,GACzC,MAAM,GAAG,CAAC,IAAI,KACb,IAAI,IAAI,qBAAqB,GAAG,qBAIqB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,GAAG,CAAC,QAAQ,GAC9C,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,aAAa,GAAG,aAAa,CAAC,GAC7D,QAAQ,CAAC;IACP,WAAW,EAAE,MAAM,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC;IAClD,WAAW,EAAE,MAAM,GAAG,CAAC,aAAa,CAAC;CACtC,CAAC,CAAC;AAEL,eAAO,MAAM,uBAAuB,GAClC,MAAM,GAAG,CAAC,IAAI,KACb,IAAI,IAAI,qBAG0C,CAAC;AA8DtD,MAAM,MAAM,qBAAqB,GAAG,GAAG,CAAC,QAAQ,GAC9C,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,aAAa,GAAG,aAAa,CAAC,GAC7D,QAAQ,CAAC;IACP,WAAW,EAAE,MAAM,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC;IAClD,WAAW,EAAE,MAAM,GAAG,CAAC,aAAa,CAAC;CACtC,CAAC,CAAC;AAEL,eAAO,MAAM,uBAAuB,GAClC,MAAM,GAAG,CAAC,IAAI,KACb,IAAI,IAAI,qBAG0C,CAAC;AAkDtD,MAAM,MAAM,yBAAyB,GAAG,GAAG,CAAC,QAAQ,GAClD,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,aAAa,GAAG,kBAAkB,CAAC,GAC/D,QAAQ,CAAC;IACP,WAAW,EAAE,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,GAChD,QAAQ,CAAC;QACP,OAAO,EAAE,MAAM,UAAU,CAAC;KAC3B,CAAC,CAAC;IACL,gBAAgB,EAAE,MAAM,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;CACjD,CAAC,CAAC;AAEL,eAAO,MAAM,2BAA2B,GACtC,MAAM,GAAG,CAAC,IAAI,KACb,IAAI,IAAI,yBAcV,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { Arr } from 'ts-data-forge';
2
+ import * as tsm from 'ts-morph';
3
+ import { isPrimitiveTypeNode } from './is-primitive-type-node.mjs';
4
+
5
+ const isShallowReadonlyTypeNode = (node) => isReadonlyTupleOrArrayTypeNode(node) ||
6
+ isReadonlyTypeReferenceNode(node) ||
7
+ isPrimitiveTypeNode(node);
8
+ const isReadonlyTupleOrArrayTypeNode = (node) => node.isKind(tsm.SyntaxKind.TypeOperator) &&
9
+ node.getOperator() === tsm.SyntaxKind.ReadonlyKeyword &&
10
+ (node.getTypeNode().isKind(tsm.SyntaxKind.ArrayType) || // Use optional chaining and isKind
11
+ node.getTypeNode().isKind(tsm.SyntaxKind.TupleType));
12
+ const isReadonlyArrayTypeNode = (node) => node.isKind(tsm.SyntaxKind.TypeOperator) &&
13
+ node.getOperator() === tsm.SyntaxKind.ReadonlyKeyword &&
14
+ node.getTypeNode().isKind(tsm.SyntaxKind.ArrayType);
15
+ const isReadonlyTupleTypeNode = (node) => node.isKind(tsm.SyntaxKind.TypeOperator) &&
16
+ node.getOperator() === tsm.SyntaxKind.ReadonlyKeyword &&
17
+ node.getTypeNode().isKind(tsm.SyntaxKind.TupleType);
18
+ const isReadonlyTypeReferenceNode = (node) => {
19
+ if (!node.isKind(tsm.SyntaxKind.TypeReference)) {
20
+ return false;
21
+ }
22
+ const typeName = node.getTypeName();
23
+ const typeArguments = node.getTypeArguments();
24
+ return (typeName.isKind(tsm.SyntaxKind.Identifier) &&
25
+ typeName.getText() === 'Readonly' &&
26
+ Arr.isArrayOfLength(typeArguments, 1));
27
+ };
28
+
29
+ export { isReadonlyArrayTypeNode, isReadonlyTupleOrArrayTypeNode, isReadonlyTupleTypeNode, isReadonlyTypeReferenceNode, isShallowReadonlyTypeNode };
30
+ //# sourceMappingURL=is-readonly-node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-readonly-node.mjs","sources":["../../../src/functions/functions/is-readonly-node.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAIO,MAAM,yBAAyB,GAAG,CAAC,IAAc,KACtD,8BAA8B,CAAC,IAAI,CAAC;IACpC,2BAA2B,CAAC,IAAI,CAAC;IACjC,mBAAmB,CAAC,IAAI;AAEnB,MAAM,8BAA8B,GAAG,CAC5C,IAAc,KAEd,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC;IACxC,IAAI,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,UAAU,CAAC,eAAe;AACrD,KAAC,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;AAClD,QAAA,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;AAShD,MAAM,uBAAuB,GAAG,CACrC,IAAc,KAEd,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC;IACxC,IAAI,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,UAAU,CAAC,eAAe;AACrD,IAAA,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS;AAqE7C,MAAM,uBAAuB,GAAG,CACrC,IAAc,KAEd,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC;IACxC,IAAI,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,UAAU,CAAC,eAAe;AACrD,IAAA,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS;AA4D7C,MAAM,2BAA2B,GAAG,CACzC,IAAc,KACuB;AACrC,IAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;AAC9C,QAAA,OAAO,KAAK;;AAGd,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE;AAEnC,IAAA,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,EAAE;IAE7C,QACE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC;AAC1C,QAAA,QAAQ,CAAC,OAAO,EAAE,KAAK,UAAU;QACjC,GAAG,CAAC,eAAe,CAAC,aAAa,EAAE,CAAC,CAAC;AAEzC;;;;"}
@@ -0,0 +1,4 @@
1
+ import * as tsm from 'ts-morph';
2
+ export declare const isSpreadParameterNode: (node: tsm.Node) => node is tsm.ParameterDeclaration;
3
+ export declare const isSpreadNamedTupleMemberNode: (node: tsm.Node) => node is tsm.NamedTupleMember;
4
+ //# sourceMappingURL=is-spread-parameter-node.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-spread-parameter-node.d.mts","sourceRoot":"","sources":["../../../src/functions/functions/is-spread-parameter-node.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAEhC,eAAO,MAAM,qBAAqB,GAChC,MAAM,GAAG,CAAC,IAAI,KACb,IAAI,IAAI,GAAG,CAAC,oBAEyB,CAAC;AAEzC,eAAO,MAAM,4BAA4B,GACvC,MAAM,GAAG,CAAC,IAAI,KACb,IAAI,IAAI,GAAG,CAAC,gBAEyB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import * as tsm from 'ts-morph';
2
+
3
+ const isSpreadParameterNode = (node) => node.isKind(tsm.SyntaxKind.Parameter) &&
4
+ node.getDotDotDotToken() !== undefined;
5
+ const isSpreadNamedTupleMemberNode = (node) => node.isKind(tsm.SyntaxKind.NamedTupleMember) &&
6
+ node.getDotDotDotToken() !== undefined;
7
+
8
+ export { isSpreadNamedTupleMemberNode, isSpreadParameterNode };
9
+ //# sourceMappingURL=is-spread-parameter-node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-spread-parameter-node.mjs","sources":["../../../src/functions/functions/is-spread-parameter-node.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEO,MAAM,qBAAqB,GAAG,CACnC,IAAc,KAEd,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;AACrC,IAAA,IAAI,CAAC,iBAAiB,EAAE,KAAK;AAExB,MAAM,4BAA4B,GAAG,CAC1C,IAAc,KAEd,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAC;AAC5C,IAAA,IAAI,CAAC,iBAAiB,EAAE,KAAK;;;;"}
@@ -0,0 +1,3 @@
1
+ import * as tsm from 'ts-morph';
2
+ export declare const removeParentheses: (node: tsm.TypeNode) => tsm.TypeNode;
3
+ //# sourceMappingURL=remove-parentheses.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-parentheses.d.mts","sourceRoot":"","sources":["../../../src/functions/functions/remove-parentheses.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAGhC,eAAO,MAAM,iBAAiB,GAAI,MAAM,GAAG,CAAC,QAAQ,KAAG,GAAG,CAAC,QAGjD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import * as tsm from 'ts-morph';
2
+
3
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
4
+ const removeParentheses = (node) => node.isKind(tsm.SyntaxKind.ParenthesizedType)
5
+ ? removeParentheses(node.getTypeNode())
6
+ : node;
7
+
8
+ export { removeParentheses };
9
+ //# sourceMappingURL=remove-parentheses.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-parentheses.mjs","sources":["../../../src/functions/functions/remove-parentheses.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;AACO,MAAM,iBAAiB,GAAG,CAAC,IAAkB,KAClD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,iBAAiB;AAC1C,MAAE,iBAAiB,CAAC,IAAI,CAAC,WAAW,EAAE;MACpC;;;;"}
@@ -0,0 +1,3 @@
1
+ import { type ReadonlyTypeReferenceNode } from './is-readonly-node.mjs';
2
+ export declare const unwrapReadonlyTypeArgText: (node: ReadonlyTypeReferenceNode) => string;
3
+ //# sourceMappingURL=unwrap-readonly.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwrap-readonly.d.mts","sourceRoot":"","sources":["../../../src/functions/functions/unwrap-readonly.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAGxE,eAAO,MAAM,yBAAyB,GAEpC,MAAM,yBAAyB,KAC9B,MAAuE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { wrapWithParentheses } from './wrap-with-parentheses.mjs';
2
+
3
+ const unwrapReadonlyTypeArgText = (
4
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
5
+ node) => wrapWithParentheses(node.getTypeArguments()[0].getFullText());
6
+
7
+ export { unwrapReadonlyTypeArgText };
8
+ //# sourceMappingURL=unwrap-readonly.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwrap-readonly.mjs","sources":["../../../src/functions/functions/unwrap-readonly.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAGO,MAAM,yBAAyB,GAAG;AACvC;AACA,IAA+B,KACpB,mBAAmB,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;;;;"}
@@ -0,0 +1,2 @@
1
+ export declare const wrapWithParentheses: (nodeStr: string) => string;
2
+ //# sourceMappingURL=wrap-with-parentheses.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap-with-parentheses.d.mts","sourceRoot":"","sources":["../../../src/functions/functions/wrap-with-parentheses.mts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,MAC/B,CAAC"}
@@ -0,0 +1,4 @@
1
+ const wrapWithParentheses = (nodeStr) => `(${nodeStr.trim()})`;
2
+
3
+ export { wrapWithParentheses };
4
+ //# sourceMappingURL=wrap-with-parentheses.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap-with-parentheses.mjs","sources":["../../../src/functions/functions/wrap-with-parentheses.mts"],"sourcesContent":[null],"names":[],"mappings":"AAAO,MAAM,mBAAmB,GAAG,CAAC,OAAe,KACjD,IAAI,OAAO,CAAC,IAAI,EAAE;;;;"}
@@ -0,0 +1,5 @@
1
+ export * from './ast-transformers/index.mjs';
2
+ export * from './constants/index.mjs';
3
+ export * from './functions/index.mjs';
4
+ export * from './utils/index.mjs';
5
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/functions/index.mts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,19 @@
1
+ export { convertInterfaceToTypeTransformer } from './ast-transformers/convert-interface-to-type.mjs';
2
+ export { convertToReadonlyTypeTransformer } from './ast-transformers/convert-to-readonly-type.mjs';
3
+ export { compareUnionIntersectionTypes } from './ast-transformers/readonly-transformer-helpers/compare-union-types.mjs';
4
+ export { invalidDeepReadonlyTypeName } from './ast-transformers/readonly-transformer-helpers/constants.mjs';
5
+ export { groupUnionIntersectionTypes } from './ast-transformers/readonly-transformer-helpers/group-union-types.mjs';
6
+ export { nextReadonlyContext } from './ast-transformers/readonly-transformer-helpers/readonly-context.mjs';
7
+ export { replaceRecordWithUnknownRecordTransformer } from './ast-transformers/replace-record-with-unknown-record.mjs';
8
+ export { transformSourceCode } from './ast-transformers/transform-source-code.mjs';
9
+ export { IGNORE_FILE_COMMENT_TEXT, IGNORE_LINE_COMMENT_TEXT } from './constants/ignore-comment-text.mjs';
10
+ export { hasDisableNextLineComment } from './functions/has-disable-next-line-comment.mjs';
11
+ export { isAsConstNode } from './functions/is-as-const-node.mjs';
12
+ export { isPrimitiveTypeNode } from './functions/is-primitive-type-node.mjs';
13
+ export { isReadonlyArrayTypeNode, isReadonlyTupleOrArrayTypeNode, isReadonlyTupleTypeNode, isReadonlyTypeReferenceNode, isShallowReadonlyTypeNode } from './functions/is-readonly-node.mjs';
14
+ export { isSpreadNamedTupleMemberNode, isSpreadParameterNode } from './functions/is-spread-parameter-node.mjs';
15
+ export { removeParentheses } from './functions/remove-parentheses.mjs';
16
+ export { unwrapReadonlyTypeArgText } from './functions/unwrap-readonly.mjs';
17
+ export { wrapWithParentheses } from './functions/wrap-with-parentheses.mjs';
18
+ export { replaceNodeWithDebugPrint } from './utils/replace-with-debug.mjs';
19
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export * from './replace-with-debug.mjs';
2
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/functions/utils/index.mts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { replaceNodeWithDebugPrint } from './replace-with-debug.mjs';
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import type * as tsm from 'ts-morph';
2
+ export declare const replaceNodeWithDebugPrint: (node: tsm.Node, newNodeText: string) => void;
3
+ //# sourceMappingURL=replace-with-debug.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replace-with-debug.d.mts","sourceRoot":"","sources":["../../../src/functions/utils/replace-with-debug.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,UAAU,CAAC;AAErC,eAAO,MAAM,yBAAyB,GACpC,MAAM,GAAG,CAAC,IAAI,EACd,aAAa,MAAM,KAClB,IAIF,CAAC"}
@@ -0,0 +1,7 @@
1
+ const replaceNodeWithDebugPrint = (node, newNodeText) => {
2
+ console.debug(`${node.getText()} -> ${newNodeText}`);
3
+ node.replaceWithText(newNodeText);
4
+ };
5
+
6
+ export { replaceNodeWithDebugPrint };
7
+ //# sourceMappingURL=replace-with-debug.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replace-with-debug.mjs","sources":["../../../src/functions/utils/replace-with-debug.mts"],"sourcesContent":[null],"names":[],"mappings":"MAEa,yBAAyB,GAAG,CACvC,IAAc,EACd,WAAmB,KACX;AACR,IAAA,OAAO,CAAC,KAAK,CAAC,CAAA,EAAG,IAAI,CAAC,OAAO,EAAE,CAAA,IAAA,EAAO,WAAW,CAAA,CAAE,CAAC;AAEpD,IAAA,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC;AACnC;;;;"}
@@ -0,0 +1 @@
1
+ /// <reference types="ts-type-forge" />
@@ -0,0 +1,2 @@
1
+ export * from './functions/index.mjs';
2
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
package/dist/index.mjs ADDED
@@ -0,0 +1,19 @@
1
+ export { convertInterfaceToTypeTransformer } from './functions/ast-transformers/convert-interface-to-type.mjs';
2
+ export { convertToReadonlyTypeTransformer } from './functions/ast-transformers/convert-to-readonly-type.mjs';
3
+ export { compareUnionIntersectionTypes } from './functions/ast-transformers/readonly-transformer-helpers/compare-union-types.mjs';
4
+ export { invalidDeepReadonlyTypeName } from './functions/ast-transformers/readonly-transformer-helpers/constants.mjs';
5
+ export { groupUnionIntersectionTypes } from './functions/ast-transformers/readonly-transformer-helpers/group-union-types.mjs';
6
+ export { nextReadonlyContext } from './functions/ast-transformers/readonly-transformer-helpers/readonly-context.mjs';
7
+ export { replaceRecordWithUnknownRecordTransformer } from './functions/ast-transformers/replace-record-with-unknown-record.mjs';
8
+ export { transformSourceCode } from './functions/ast-transformers/transform-source-code.mjs';
9
+ export { IGNORE_FILE_COMMENT_TEXT, IGNORE_LINE_COMMENT_TEXT } from './functions/constants/ignore-comment-text.mjs';
10
+ export { hasDisableNextLineComment } from './functions/functions/has-disable-next-line-comment.mjs';
11
+ export { isAsConstNode } from './functions/functions/is-as-const-node.mjs';
12
+ export { isPrimitiveTypeNode } from './functions/functions/is-primitive-type-node.mjs';
13
+ export { isReadonlyArrayTypeNode, isReadonlyTupleOrArrayTypeNode, isReadonlyTupleTypeNode, isReadonlyTypeReferenceNode, isShallowReadonlyTypeNode } from './functions/functions/is-readonly-node.mjs';
14
+ export { isSpreadNamedTupleMemberNode, isSpreadParameterNode } from './functions/functions/is-spread-parameter-node.mjs';
15
+ export { removeParentheses } from './functions/functions/remove-parentheses.mjs';
16
+ export { unwrapReadonlyTypeArgText } from './functions/functions/unwrap-readonly.mjs';
17
+ export { wrapWithParentheses } from './functions/functions/wrap-with-parentheses.mjs';
18
+ export { replaceNodeWithDebugPrint } from './functions/utils/replace-with-debug.mjs';
19
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
@@ -0,0 +1 @@
1
+ {"include":["."]}
@@ -0,0 +1,2 @@
1
+ import './globals.d.mts';
2
+ export * from './entry-point.mjs';