@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.
- package/CHANGELOG.md +268 -0
- package/LICENSE.md +13 -0
- package/README.md +348 -0
- package/actions/check.d.ts +11 -0
- package/actions/check.js +45 -0
- package/actions/check.js.map +1 -0
- package/actions/index.d.ts +5 -0
- package/actions/index.js +22 -0
- package/actions/index.js.map +1 -0
- package/actions/install.d.ts +5 -0
- package/actions/install.js +25 -0
- package/actions/install.js.map +1 -0
- package/actions/patch.d.ts +6 -0
- package/actions/patch.js +82 -0
- package/actions/patch.js.map +1 -0
- package/actions/uninstall.d.ts +5 -0
- package/actions/uninstall.js +26 -0
- package/actions/uninstall.js.map +1 -0
- package/actions/unpatch.d.ts +3 -0
- package/actions/unpatch.js +82 -0
- package/actions/unpatch.js.map +1 -0
- package/bin/ts-patch.d.ts +1 -0
- package/bin/ts-patch.js +33 -0
- package/bin/ts-patch.js.map +1 -0
- package/bin/tspc.d.ts +0 -0
- package/bin/tspc.js +14 -0
- package/bin/tspc.js.map +1 -0
- package/cli/cli.d.ts +14 -0
- package/cli/cli.js +96 -0
- package/cli/cli.js.map +1 -0
- package/cli/commands.d.ts +5 -0
- package/cli/commands.js +49 -0
- package/cli/commands.js.map +1 -0
- package/cli/help-menu.d.ts +1 -0
- package/cli/help-menu.js +43 -0
- package/cli/help-menu.js.map +1 -0
- package/cli/options.d.ts +14 -0
- package/cli/options.js +63 -0
- package/cli/options.js.map +1 -0
- package/compiler/package.json +4 -0
- package/compiler/tsc.js +19 -0
- package/compiler/tsserver.js +19 -0
- package/compiler/tsserverlibrary.js +19 -0
- package/compiler/typescript.js +19 -0
- package/config.d.ts +18 -0
- package/config.js +50 -0
- package/config.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.js +29 -0
- package/index.js.map +1 -0
- package/module/get-live-module.d.ts +5 -0
- package/module/get-live-module.js +25 -0
- package/module/get-live-module.js.map +1 -0
- package/module/index.d.ts +4 -0
- package/module/index.js +21 -0
- package/module/index.js.map +1 -0
- package/module/module-file.d.ts +9 -0
- package/module/module-file.js +97 -0
- package/module/module-file.js.map +1 -0
- package/module/module-source.d.ts +15 -0
- package/module/module-source.js +35 -0
- package/module/module-source.js.map +1 -0
- package/module/source-section.d.ts +20 -0
- package/module/source-section.js +73 -0
- package/module/source-section.js.map +1 -0
- package/module/ts-module.d.ts +35 -0
- package/module/ts-module.js +100 -0
- package/module/ts-module.js.map +1 -0
- package/options.d.ts +19 -0
- package/options.js +32 -0
- package/options.js.map +1 -0
- package/package.json +107 -0
- package/patch/get-patched-source.d.ts +12 -0
- package/patch/get-patched-source.js +69 -0
- package/patch/get-patched-source.js.map +1 -0
- package/patch/patch-detail.d.ts +36 -0
- package/patch/patch-detail.js +67 -0
- package/patch/patch-detail.js.map +1 -0
- package/patch/patch-module.d.ts +5 -0
- package/patch/patch-module.js +182 -0
- package/patch/patch-module.js.map +1 -0
- package/patch/transformers/add-original-create-program.d.ts +3 -0
- package/patch/transformers/add-original-create-program.js +71 -0
- package/patch/transformers/add-original-create-program.js.map +1 -0
- package/patch/transformers/fix-ts-early-return.d.ts +2 -0
- package/patch/transformers/fix-ts-early-return.js +51 -0
- package/patch/transformers/fix-ts-early-return.js.map +1 -0
- package/patch/transformers/hook-tsc-exec.d.ts +2 -0
- package/patch/transformers/hook-tsc-exec.js +32 -0
- package/patch/transformers/hook-tsc-exec.js.map +1 -0
- package/patch/transformers/index.d.ts +6 -0
- package/patch/transformers/index.js +23 -0
- package/patch/transformers/index.js.map +1 -0
- package/patch/transformers/merge-statements.d.ts +2 -0
- package/patch/transformers/merge-statements.js +60 -0
- package/patch/transformers/merge-statements.js.map +1 -0
- package/patch/transformers/patch-create-program.d.ts +2 -0
- package/patch/transformers/patch-create-program.js +36 -0
- package/patch/transformers/patch-create-program.js.map +1 -0
- package/patch/transformers/patch-emitter.d.ts +2 -0
- package/patch/transformers/patch-emitter.js +44 -0
- package/patch/transformers/patch-emitter.js.map +1 -0
- package/plugin-types.d.ts +95 -0
- package/plugin-types.js +4 -0
- package/plugin-types.js.map +1 -0
- package/resources/module-patch.d.ts +50 -0
- package/resources/module-patch.js +609 -0
- package/slice/module-slice.d.ts +19 -0
- package/slice/module-slice.js +37 -0
- package/slice/module-slice.js.map +1 -0
- package/slice/ts54.d.ts +6 -0
- package/slice/ts54.js +70 -0
- package/slice/ts54.js.map +1 -0
- package/slice/ts55.d.ts +6 -0
- package/slice/ts55.js +70 -0
- package/slice/ts55.js.map +1 -0
- package/slice/ts552.d.ts +6 -0
- package/slice/ts552.js +70 -0
- package/slice/ts552.js.map +1 -0
- package/system/cache.d.ts +3 -0
- package/system/cache.js +69 -0
- package/system/cache.js.map +1 -0
- package/system/errors.d.ts +35 -0
- package/system/errors.js +82 -0
- package/system/errors.js.map +1 -0
- package/system/index.d.ts +4 -0
- package/system/index.js +21 -0
- package/system/index.js.map +1 -0
- package/system/logger.d.ts +7 -0
- package/system/logger.js +48 -0
- package/system/logger.js.map +1 -0
- package/system/types.d.ts +4 -0
- package/system/types.js +7 -0
- package/system/types.js.map +1 -0
- package/ts-package.d.ts +18 -0
- package/ts-package.js +73 -0
- package/ts-package.js.map +1 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/utils/file-utils.d.ts +9 -0
- package/utils/file-utils.js +98 -0
- package/utils/file-utils.js.map +1 -0
- package/utils/find-cache-dir.d.ts +23 -0
- package/utils/find-cache-dir.js +93 -0
- package/utils/find-cache-dir.js.map +1 -0
- package/utils/general.d.ts +5 -0
- package/utils/general.js +16 -0
- package/utils/general.js.map +1 -0
- package/utils/index.d.ts +3 -0
- package/utils/index.js +20 -0
- 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
|
+
}
|
package/plugin-types.js
ADDED
|
@@ -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
|
+
}
|