@samchon/ts-patch 3.2.2-dev.20241204

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 (150) hide show
  1. package/CHANGELOG.md +268 -0
  2. package/LICENSE.md +13 -0
  3. package/README.md +348 -0
  4. package/actions/check.d.ts +11 -0
  5. package/actions/check.js +45 -0
  6. package/actions/check.js.map +1 -0
  7. package/actions/index.d.ts +5 -0
  8. package/actions/index.js +22 -0
  9. package/actions/index.js.map +1 -0
  10. package/actions/install.d.ts +5 -0
  11. package/actions/install.js +25 -0
  12. package/actions/install.js.map +1 -0
  13. package/actions/patch.d.ts +6 -0
  14. package/actions/patch.js +82 -0
  15. package/actions/patch.js.map +1 -0
  16. package/actions/uninstall.d.ts +5 -0
  17. package/actions/uninstall.js +26 -0
  18. package/actions/uninstall.js.map +1 -0
  19. package/actions/unpatch.d.ts +3 -0
  20. package/actions/unpatch.js +82 -0
  21. package/actions/unpatch.js.map +1 -0
  22. package/bin/ts-patch.d.ts +1 -0
  23. package/bin/ts-patch.js +33 -0
  24. package/bin/ts-patch.js.map +1 -0
  25. package/bin/tspc.d.ts +0 -0
  26. package/bin/tspc.js +14 -0
  27. package/bin/tspc.js.map +1 -0
  28. package/cli/cli.d.ts +14 -0
  29. package/cli/cli.js +96 -0
  30. package/cli/cli.js.map +1 -0
  31. package/cli/commands.d.ts +5 -0
  32. package/cli/commands.js +49 -0
  33. package/cli/commands.js.map +1 -0
  34. package/cli/help-menu.d.ts +1 -0
  35. package/cli/help-menu.js +43 -0
  36. package/cli/help-menu.js.map +1 -0
  37. package/cli/options.d.ts +14 -0
  38. package/cli/options.js +63 -0
  39. package/cli/options.js.map +1 -0
  40. package/compiler/package.json +4 -0
  41. package/compiler/tsc.js +19 -0
  42. package/compiler/tsserver.js +19 -0
  43. package/compiler/tsserverlibrary.js +19 -0
  44. package/compiler/typescript.js +19 -0
  45. package/config.d.ts +18 -0
  46. package/config.js +50 -0
  47. package/config.js.map +1 -0
  48. package/index.d.ts +4 -0
  49. package/index.js +29 -0
  50. package/index.js.map +1 -0
  51. package/module/get-live-module.d.ts +5 -0
  52. package/module/get-live-module.js +25 -0
  53. package/module/get-live-module.js.map +1 -0
  54. package/module/index.d.ts +4 -0
  55. package/module/index.js +21 -0
  56. package/module/index.js.map +1 -0
  57. package/module/module-file.d.ts +9 -0
  58. package/module/module-file.js +97 -0
  59. package/module/module-file.js.map +1 -0
  60. package/module/module-source.d.ts +15 -0
  61. package/module/module-source.js +35 -0
  62. package/module/module-source.js.map +1 -0
  63. package/module/source-section.d.ts +20 -0
  64. package/module/source-section.js +73 -0
  65. package/module/source-section.js.map +1 -0
  66. package/module/ts-module.d.ts +35 -0
  67. package/module/ts-module.js +100 -0
  68. package/module/ts-module.js.map +1 -0
  69. package/options.d.ts +19 -0
  70. package/options.js +32 -0
  71. package/options.js.map +1 -0
  72. package/package.json +107 -0
  73. package/patch/get-patched-source.d.ts +12 -0
  74. package/patch/get-patched-source.js +69 -0
  75. package/patch/get-patched-source.js.map +1 -0
  76. package/patch/patch-detail.d.ts +36 -0
  77. package/patch/patch-detail.js +67 -0
  78. package/patch/patch-detail.js.map +1 -0
  79. package/patch/patch-module.d.ts +5 -0
  80. package/patch/patch-module.js +182 -0
  81. package/patch/patch-module.js.map +1 -0
  82. package/patch/transformers/add-original-create-program.d.ts +3 -0
  83. package/patch/transformers/add-original-create-program.js +71 -0
  84. package/patch/transformers/add-original-create-program.js.map +1 -0
  85. package/patch/transformers/fix-ts-early-return.d.ts +2 -0
  86. package/patch/transformers/fix-ts-early-return.js +51 -0
  87. package/patch/transformers/fix-ts-early-return.js.map +1 -0
  88. package/patch/transformers/hook-tsc-exec.d.ts +2 -0
  89. package/patch/transformers/hook-tsc-exec.js +32 -0
  90. package/patch/transformers/hook-tsc-exec.js.map +1 -0
  91. package/patch/transformers/index.d.ts +6 -0
  92. package/patch/transformers/index.js +23 -0
  93. package/patch/transformers/index.js.map +1 -0
  94. package/patch/transformers/merge-statements.d.ts +2 -0
  95. package/patch/transformers/merge-statements.js +60 -0
  96. package/patch/transformers/merge-statements.js.map +1 -0
  97. package/patch/transformers/patch-create-program.d.ts +2 -0
  98. package/patch/transformers/patch-create-program.js +36 -0
  99. package/patch/transformers/patch-create-program.js.map +1 -0
  100. package/patch/transformers/patch-emitter.d.ts +2 -0
  101. package/patch/transformers/patch-emitter.js +44 -0
  102. package/patch/transformers/patch-emitter.js.map +1 -0
  103. package/plugin-types.d.ts +95 -0
  104. package/plugin-types.js +4 -0
  105. package/plugin-types.js.map +1 -0
  106. package/resources/module-patch.d.ts +50 -0
  107. package/resources/module-patch.js +609 -0
  108. package/slice/module-slice.d.ts +19 -0
  109. package/slice/module-slice.js +37 -0
  110. package/slice/module-slice.js.map +1 -0
  111. package/slice/ts54.d.ts +6 -0
  112. package/slice/ts54.js +70 -0
  113. package/slice/ts54.js.map +1 -0
  114. package/slice/ts55.d.ts +6 -0
  115. package/slice/ts55.js +70 -0
  116. package/slice/ts55.js.map +1 -0
  117. package/slice/ts552.d.ts +6 -0
  118. package/slice/ts552.js +70 -0
  119. package/slice/ts552.js.map +1 -0
  120. package/system/cache.d.ts +3 -0
  121. package/system/cache.js +69 -0
  122. package/system/cache.js.map +1 -0
  123. package/system/errors.d.ts +35 -0
  124. package/system/errors.js +82 -0
  125. package/system/errors.js.map +1 -0
  126. package/system/index.d.ts +4 -0
  127. package/system/index.js +21 -0
  128. package/system/index.js.map +1 -0
  129. package/system/logger.d.ts +7 -0
  130. package/system/logger.js +48 -0
  131. package/system/logger.js.map +1 -0
  132. package/system/types.d.ts +4 -0
  133. package/system/types.js +7 -0
  134. package/system/types.js.map +1 -0
  135. package/ts-package.d.ts +18 -0
  136. package/ts-package.js +73 -0
  137. package/ts-package.js.map +1 -0
  138. package/tsconfig.tsbuildinfo +1 -0
  139. package/utils/file-utils.d.ts +9 -0
  140. package/utils/file-utils.js +98 -0
  141. package/utils/file-utils.js.map +1 -0
  142. package/utils/find-cache-dir.d.ts +23 -0
  143. package/utils/find-cache-dir.js +93 -0
  144. package/utils/find-cache-dir.js.map +1 -0
  145. package/utils/general.d.ts +5 -0
  146. package/utils/general.js +16 -0
  147. package/utils/general.js.map +1 -0
  148. package/utils/index.d.ts +3 -0
  149. package/utils/index.js +20 -0
  150. package/utils/index.js.map +1 -0
@@ -0,0 +1,95 @@
1
+ /**
2
+ * NOTE: This file is used during the build process for patch as well
3
+ */
4
+ import type * as ts from 'typescript';
5
+ export interface PluginConfig {
6
+ [x: string]: any;
7
+ /**
8
+ * Language Server TypeScript Plugin name
9
+ */
10
+ name?: string;
11
+ /**
12
+ * Path to transformer or transformer module name
13
+ */
14
+ transform?: string;
15
+ /**
16
+ * Resolve Path Aliases?
17
+ */
18
+ resolvePathAliases?: boolean;
19
+ /**
20
+ * tsconfig.json file (for transformer)
21
+ */
22
+ tsConfig?: string;
23
+ /**
24
+ * The optional name of the exported transform plugin in the transform module.
25
+ */
26
+ import?: string;
27
+ /**
28
+ * Is the transformer an ES Module
29
+ */
30
+ isEsm?: boolean;
31
+ /**
32
+ * Plugin entry point format type, default is program
33
+ */
34
+ type?: 'ls' | 'program' | 'config' | 'checker' | 'raw' | 'compilerOptions';
35
+ /**
36
+ * Apply transformer after internal TypeScript transformers
37
+ */
38
+ after?: boolean;
39
+ /**
40
+ * Apply transformer on d.ts files
41
+ */
42
+ afterDeclarations?: boolean;
43
+ /**
44
+ * Transform *Program* instance (alters during createProgram()) (`type`, `after`, & `afterDeclarations` settings will
45
+ * not apply) Entry point must be (program: Program, host?: CompilerHost) => Program
46
+ */
47
+ transformProgram?: boolean;
48
+ }
49
+ export type TransformerList = Required<ts.CustomTransformers>;
50
+ export type TransformerPlugin = TransformerBasePlugin | TsTransformerFactory;
51
+ export type TsTransformerFactory = ts.TransformerFactory<ts.SourceFile>;
52
+ export type PluginFactory = LSPattern | ProgramPattern | ConfigPattern | CompilerOptionsPattern | TypeCheckerPattern | RawPattern;
53
+ export interface TransformerBasePlugin {
54
+ before?: ts.TransformerFactory<ts.SourceFile> | ts.TransformerFactory<ts.SourceFile>[];
55
+ after?: ts.TransformerFactory<ts.SourceFile> | ts.TransformerFactory<ts.SourceFile>[];
56
+ afterDeclarations?: ts.TransformerFactory<ts.SourceFile | ts.Bundle> | ts.TransformerFactory<ts.SourceFile | ts.Bundle>[];
57
+ }
58
+ export type DiagnosticMap = WeakMap<ts.Program, ts.Diagnostic[]>;
59
+ export type TransformerExtras = {
60
+ /**
61
+ * Originating TypeScript instance
62
+ */
63
+ ts: typeof ts;
64
+ /**
65
+ * TypeScript library file event was triggered in (ie. 'tsserverlibrary' or 'typescript')
66
+ */
67
+ library: string;
68
+ addDiagnostic: (diag: ts.Diagnostic) => number;
69
+ removeDiagnostic: (index: number) => void;
70
+ diagnostics: readonly ts.Diagnostic[];
71
+ };
72
+ export type ProgramTransformerExtras = {
73
+ /**
74
+ * Originating TypeScript instance
75
+ */
76
+ ts: typeof ts;
77
+ };
78
+ export type ProgramTransformer = (program: ts.Program, host: ts.CompilerHost | undefined, config: PluginConfig, extras: ProgramTransformerExtras) => ts.Program;
79
+ export type LSPattern = (ls: ts.LanguageService, config: {}) => TransformerPlugin;
80
+ export type CompilerOptionsPattern = (compilerOpts: ts.CompilerOptions, config: {}) => TransformerPlugin;
81
+ export type ConfigPattern = (config: {}) => TransformerPlugin;
82
+ export type TypeCheckerPattern = (checker: ts.TypeChecker, config: {}) => TransformerPlugin;
83
+ export type ProgramPattern = (program: ts.Program, config: {}, extras: TransformerExtras) => TransformerPlugin;
84
+ export type RawPattern = (context: ts.TransformationContext, program: ts.Program, config: {}) => ts.Transformer<ts.SourceFile>;
85
+ export interface PluginPackageConfig {
86
+ tscOptions?: {
87
+ /**
88
+ * Sets the JSDocParsingMode to ParseAll
89
+ *
90
+ * @see https://devblogs.microsoft.com/typescript/announcing-typescript-5-3/#optimizations-by-skipping-jsdoc-parsing
91
+ * @default false
92
+ */
93
+ parseAllJsDoc?: boolean;
94
+ };
95
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // endregion
4
+ //# sourceMappingURL=plugin-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-types.js","sourceRoot":"","sources":["../../projects/core/shared/plugin-types.ts"],"names":[],"mappings":";;AA8JA,YAAY"}
@@ -0,0 +1,50 @@
1
+ declare namespace ts {
2
+ interface PluginConfig {
3
+ [x: string]: any;
4
+ name?: string;
5
+ transform?: string;
6
+ resolvePathAliases?: boolean;
7
+ tsConfig?: string;
8
+ import?: string;
9
+ isEsm?: boolean;
10
+ type?: 'ls' | 'program' | 'config' | 'checker' | 'raw' | 'compilerOptions';
11
+ after?: boolean;
12
+ afterDeclarations?: boolean;
13
+ transformProgram?: boolean;
14
+ }
15
+ type TransformerList = Required<ts.CustomTransformers>;
16
+ type TransformerPlugin = TransformerBasePlugin | TsTransformerFactory;
17
+ type TsTransformerFactory = ts.TransformerFactory<ts.SourceFile>;
18
+ type PluginFactory = LSPattern | ProgramPattern | ConfigPattern | CompilerOptionsPattern | TypeCheckerPattern | RawPattern;
19
+ interface TransformerBasePlugin {
20
+ before?: ts.TransformerFactory<ts.SourceFile> | ts.TransformerFactory<ts.SourceFile>[];
21
+ after?: ts.TransformerFactory<ts.SourceFile> | ts.TransformerFactory<ts.SourceFile>[];
22
+ afterDeclarations?: ts.TransformerFactory<ts.SourceFile | ts.Bundle> | ts.TransformerFactory<ts.SourceFile | ts.Bundle>[];
23
+ }
24
+ type DiagnosticMap = WeakMap<ts.Program, ts.Diagnostic[]>;
25
+ type TransformerExtras = {
26
+ ts: typeof ts;
27
+ library: string;
28
+ addDiagnostic: (diag: ts.Diagnostic) => number;
29
+ removeDiagnostic: (index: number) => void;
30
+ diagnostics: readonly ts.Diagnostic[];
31
+ };
32
+ type ProgramTransformerExtras = {
33
+ ts: typeof ts;
34
+ };
35
+ type ProgramTransformer = (program: ts.Program, host: ts.CompilerHost | undefined, config: PluginConfig, extras: ProgramTransformerExtras) => ts.Program;
36
+ type LSPattern = (ls: ts.LanguageService, config: {}) => TransformerPlugin;
37
+ type CompilerOptionsPattern = (compilerOpts: ts.CompilerOptions, config: {}) => TransformerPlugin;
38
+ type ConfigPattern = (config: {}) => TransformerPlugin;
39
+ type TypeCheckerPattern = (checker: ts.TypeChecker, config: {}) => TransformerPlugin;
40
+ type ProgramPattern = (program: ts.Program, config: {}, extras: TransformerExtras) => TransformerPlugin;
41
+ type RawPattern = (context: ts.TransformationContext, program: ts.Program, config: {}) => ts.Transformer<ts.SourceFile>;
42
+ interface PluginPackageConfig {
43
+ tscOptions?: {
44
+ parseAllJsDoc?: boolean;
45
+ };
46
+ }
47
+ }
48
+ declare namespace ts {
49
+ const originalCreateProgram: typeof ts.createProgram;
50
+ }