@simplysm/sd-cli 11.1.20 → 11.1.22

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 (54) hide show
  1. package/dist/build-tools/SdLinter.d.ts +1 -1
  2. package/dist/build-tools/SdLinter.js +2 -2
  3. package/dist/build-tools/SdLinter.js.map +1 -1
  4. package/dist/build-tools/SdNgBundler.d.ts +2 -2
  5. package/dist/build-tools/SdNgBundler.js +2 -2
  6. package/dist/build-tools/SdNgBundler.js.map +1 -1
  7. package/dist/build-tools/{SdTsBundler.d.ts → SdServerBundler.d.ts} +6 -2
  8. package/dist/build-tools/{SdTsBundler.js → SdServerBundler.js} +18 -14
  9. package/dist/build-tools/SdServerBundler.js.map +1 -0
  10. package/dist/build-tools/SdTsCompiler.d.ts +2 -2
  11. package/dist/build-tools/SdTsCompiler.js +10 -12
  12. package/dist/build-tools/SdTsCompiler.js.map +1 -1
  13. package/dist/builders/SdCliClientBuilder.js +22 -12
  14. package/dist/builders/SdCliClientBuilder.js.map +1 -1
  15. package/dist/builders/SdCliServerBuilder.js +31 -31
  16. package/dist/builders/SdCliServerBuilder.js.map +1 -1
  17. package/dist/builders/SdCliTsLibBuilder.js +22 -12
  18. package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
  19. package/dist/bundle-plugins/sdNgPlugin.js +1 -1
  20. package/dist/bundle-plugins/sdNgPlugin.js.map +1 -1
  21. package/dist/bundle-plugins/sdServerPlugin.d.ts +15 -0
  22. package/dist/bundle-plugins/sdServerPlugin.js +132 -0
  23. package/dist/bundle-plugins/sdServerPlugin.js.map +1 -0
  24. package/dist/commons.d.ts +0 -1
  25. package/dist/entry/SdCliLocalUpdate.js +2 -2
  26. package/dist/entry/SdCliLocalUpdate.js.map +1 -1
  27. package/dist/entry/SdCliProject.js +1 -1
  28. package/dist/entry/SdCliProject.js.map +1 -1
  29. package/dist/index.d.ts +2 -3
  30. package/dist/index.js +2 -3
  31. package/dist/index.js.map +1 -1
  32. package/package.json +12 -12
  33. package/src/build-tools/SdLinter.ts +2 -2
  34. package/src/build-tools/SdNgBundler.ts +4 -4
  35. package/src/build-tools/{SdTsBundler.ts → SdServerBundler.ts} +22 -18
  36. package/src/build-tools/SdTsCompiler.ts +12 -14
  37. package/src/builders/SdCliClientBuilder.ts +24 -14
  38. package/src/builders/SdCliServerBuilder.ts +38 -39
  39. package/src/builders/SdCliTsLibBuilder.ts +24 -14
  40. package/src/bundle-plugins/sdNgPlugin.ts +1 -1
  41. package/src/bundle-plugins/sdServerPlugin.ts +211 -0
  42. package/src/commons.ts +0 -1
  43. package/src/entry/SdCliLocalUpdate.ts +3 -8
  44. package/src/entry/SdCliProject.ts +1 -1
  45. package/src/index.ts +2 -3
  46. package/dist/build-tools/SdTsBundler.js.map +0 -1
  47. package/dist/bundle-plugins/sdLoadedFilesPlugin.d.ts +0 -4
  48. package/dist/bundle-plugins/sdLoadedFilesPlugin.js +0 -15
  49. package/dist/bundle-plugins/sdLoadedFilesPlugin.js.map +0 -1
  50. package/dist/bundle-plugins/sdTscPlugin.d.ts +0 -5
  51. package/dist/bundle-plugins/sdTscPlugin.js +0 -21
  52. package/dist/bundle-plugins/sdTscPlugin.js.map +0 -1
  53. package/src/bundle-plugins/sdLoadedFilesPlugin.ts +0 -19
  54. package/src/bundle-plugins/sdTscPlugin.ts +0 -25
@@ -0,0 +1,211 @@
1
+ import esbuild from "esbuild";
2
+ import {FsUtil} from "@simplysm/sd-core-node";
3
+ import ts from "typescript";
4
+ import path from "path";
5
+ import {convertTypeScriptDiagnostic} from "@angular-devkit/build-angular/src/tools/esbuild/angular/diagnostics";
6
+
7
+ export function sdServerPlugin(conf: {
8
+ pkgPath: string;
9
+ dev: boolean;
10
+ modifiedFileSet: Set<string>;
11
+ result: IServerBundlerResultCache;
12
+ }): esbuild.Plugin {
13
+ const tsConfigPath = path.resolve(conf.pkgPath, "tsconfig.json");
14
+ const tsConfig = FsUtil.readJson(tsConfigPath);
15
+ const parsedTsConfig = ts.parseJsonConfigFileContent(tsConfig, ts.sys, conf.pkgPath, {
16
+ declaration: false
17
+ });
18
+
19
+ const sourceFileCache = new Map<string, ts.SourceFile>();
20
+ const referencingMap = new Map<string, Set<string>>();
21
+
22
+ let program: ts.Program | undefined;
23
+ let builder: ts.EmitAndSemanticDiagnosticsBuilderProgram | undefined;
24
+
25
+ let resultCache: IResultCache = {
26
+ watchFileSet: new Set<string>(),
27
+ affectedFileSet: new Set<string>()
28
+ };
29
+ const tscPrepareMap = new Map<string, string>();
30
+
31
+ function createCompilerHost() {
32
+ const compilerHost = ts.createIncrementalCompilerHost(parsedTsConfig.options);
33
+ const baseGetSourceFile = compilerHost.getSourceFile;
34
+ compilerHost.getSourceFile = (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile, ...args) => {
35
+ if (!shouldCreateNewSourceFile && sourceFileCache.has(path.normalize(fileName))) {
36
+ return sourceFileCache.get(path.normalize(fileName));
37
+ }
38
+
39
+ const file = baseGetSourceFile.call(
40
+ compilerHost,
41
+ fileName,
42
+ languageVersionOrOptions,
43
+ onError,
44
+ true,
45
+ ...args,
46
+ );
47
+
48
+ if (file) {
49
+ sourceFileCache.set(path.normalize(fileName), file);
50
+ }
51
+
52
+ return file;
53
+ };
54
+
55
+ return compilerHost;
56
+ }
57
+
58
+ function findAffectedFileSet() {
59
+ const affectedFileSet = new Set<string>();
60
+
61
+ while (true) {
62
+ const result = builder!.getSemanticDiagnosticsOfNextAffectedFile();
63
+ if (!result) {
64
+ break;
65
+ }
66
+ affectedFileSet.add(path.normalize((result.affected as ts.SourceFile).fileName));
67
+ }
68
+
69
+ return affectedFileSet;
70
+ }
71
+
72
+ return {
73
+ name: "sd-server-compiler",
74
+ setup: (build: esbuild.PluginBuild) => {
75
+ //-- compilerHost
76
+ const compilerHost = createCompilerHost();
77
+
78
+ build.onStart(() => {
79
+ //-- modified
80
+ for (const modifiedFile of conf.modifiedFileSet) {
81
+ sourceFileCache.delete(modifiedFile);
82
+
83
+ if (referencingMap.has(modifiedFile)) {
84
+ for (const referencingFile of referencingMap.get(modifiedFile)!) {
85
+ sourceFileCache.delete(referencingFile);
86
+ }
87
+ }
88
+ }
89
+ referencingMap.clear();
90
+
91
+ //-- init resultCache
92
+
93
+ resultCache = {
94
+ watchFileSet: new Set<string>(),
95
+ affectedFileSet: new Set<string>(),
96
+ };
97
+
98
+ program = ts.createProgram(
99
+ parsedTsConfig.fileNames,
100
+ parsedTsConfig.options,
101
+ compilerHost,
102
+ program
103
+ );
104
+ builder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(
105
+ program,
106
+ compilerHost,
107
+ builder
108
+ );
109
+
110
+ //-- affectedFilePathSet
111
+ resultCache.affectedFileSet.adds(...findAffectedFileSet());
112
+
113
+ // Deps -> refMap
114
+ builder.getSourceFiles().forEach(sf => {
115
+ resultCache.watchFileSet.add(path.normalize(sf.fileName));
116
+
117
+ const deps = builder!.getAllDependencies(sf);
118
+ for (const dep of deps) {
119
+ const ref = referencingMap.getOrCreate(dep, new Set<string>());
120
+ ref.add(dep);
121
+
122
+ resultCache.watchFileSet.add(path.normalize(dep));
123
+ }
124
+ });
125
+
126
+ // refMap, modFile -> affectedFileSet
127
+ for (const modifiedFile of conf.modifiedFileSet) {
128
+ resultCache.affectedFileSet.adds(...referencingMap.get(modifiedFile) ?? []);
129
+ }
130
+
131
+ //-- diagnostics / build
132
+
133
+ const diagnostics: ts.Diagnostic[] = [];
134
+
135
+ diagnostics.push(
136
+ ...builder.getConfigFileParsingDiagnostics(),
137
+ ...builder.getOptionsDiagnostics(),
138
+ ...builder.getGlobalDiagnostics()
139
+ );
140
+
141
+ for (const affectedFile of resultCache.affectedFileSet) {
142
+ const affectedSourceFile = sourceFileCache.get(path.normalize(affectedFile));
143
+ if (!affectedSourceFile) {
144
+ continue;
145
+ }
146
+
147
+ diagnostics.push(
148
+ ...builder.getSyntacticDiagnostics(affectedSourceFile),
149
+ ...builder.getSemanticDiagnostics(affectedSourceFile)
150
+ );
151
+ }
152
+
153
+ //-- prepare emit cache
154
+ while (true) {
155
+ const affectedFileResult = builder.emitNextAffectedFile((fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
156
+ if (!sourceFiles || sourceFiles.length === 0) {
157
+ compilerHost.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
158
+ return;
159
+ }
160
+
161
+ const sourceFile = ts.getOriginalNode(sourceFiles[0], ts.isSourceFile);
162
+ tscPrepareMap.set(path.normalize(sourceFile.fileName), text);
163
+ });
164
+
165
+ if (!affectedFileResult) {
166
+ break;
167
+ }
168
+
169
+ diagnostics.push(...affectedFileResult.result.diagnostics);
170
+ }
171
+
172
+ //-- return err/warn
173
+
174
+ return {
175
+ errors: diagnostics.filter(item => item.category === ts.DiagnosticCategory.Error).map(item => convertTypeScriptDiagnostic(ts, item)),
176
+ warnings: diagnostics.filter(item => item.category !== ts.DiagnosticCategory.Error).map(item => convertTypeScriptDiagnostic(ts, item)),
177
+ };
178
+ });
179
+
180
+
181
+ build.onLoad({filter: /\.ts$/}, (args) => {
182
+ resultCache.watchFileSet.add(path.normalize(args.path));
183
+ const contents = tscPrepareMap.get(path.normalize(args.path));
184
+ return {contents, loader: "js"};
185
+ });
186
+
187
+ build.onEnd((result) => {
188
+ conf.result.watchFileSet = resultCache.watchFileSet;
189
+ conf.result.affectedFileSet = resultCache.affectedFileSet;
190
+ conf.result.outputFiles = result.outputFiles;
191
+ conf.result.metafile = result.metafile;
192
+ conf.result.program = program;
193
+
194
+ conf.modifiedFileSet.clear();
195
+ });
196
+ }
197
+ };
198
+ }
199
+
200
+ export interface IServerBundlerResultCache {
201
+ watchFileSet?: Set<string>;
202
+ affectedFileSet?: Set<string>;
203
+ outputFiles?: esbuild.OutputFile[];
204
+ metafile?: esbuild.Metafile;
205
+ program?: ts.Program;
206
+ }
207
+
208
+ interface IResultCache {
209
+ watchFileSet: Set<string>;
210
+ affectedFileSet: Set<string>;
211
+ }
package/src/commons.ts CHANGED
@@ -37,7 +37,6 @@ export interface ISdCliBuildClusterResMessage {
37
37
  }
38
38
 
39
39
  export interface ISdCliBuilderResult {
40
- port?: number;
41
40
  affectedFilePaths: string[];
42
41
  buildResults: ISdCliPackageBuildResult[];
43
42
  }
@@ -70,8 +70,8 @@ export class SdCliLocalUpdate {
70
70
  }
71
71
  }
72
72
 
73
- const watchWatchPaths = (await updatePathInfos.mapManyAsync(async (item) => await this._getWatchPathsAsync(item.source))).distinct();
74
- watcher.add(watchWatchPaths);
73
+ const watchFileSet = new Set(await updatePathInfos.mapManyAsync(async (item) => await this._getWatchPathsAsync(item.source)));
74
+ watcher.add(watchFileSet);
75
75
 
76
76
  logger.info("로컬 라이브러리 복사 완료");
77
77
  });
@@ -112,12 +112,7 @@ export class SdCliLocalUpdate {
112
112
  }
113
113
 
114
114
  private static async _getWatchPathsAsync(sourcePath: string): Promise<string[]> {
115
- return await FsUtil.globAsync(path.resolve(sourcePath, "**"), /*{
116
- ignore: [
117
- "**!/node_modules/!**",
118
- "**!/package.json"
119
- ]
120
- }*/);
115
+ return await FsUtil.globAsync(path.resolve(sourcePath, "**"));
121
116
  }
122
117
  }
123
118
 
@@ -128,7 +128,7 @@ export class SdCliProject {
128
128
  pathProxy: {},
129
129
  // changeFilePaths: []
130
130
  });
131
- serverInfo.port = message.result!.port;
131
+ // serverInfo.port = message.result!.port;
132
132
  // serverInfo.changeFilePaths.push(...message.result!.affectedFilePaths);
133
133
 
134
134
  serverInfo.hasClientChanges = true;
package/src/index.ts CHANGED
@@ -4,15 +4,14 @@ export * from "./build-tools/SdCliNgRoutesFileGenerator";
4
4
  export * from "./build-tools/SdLinter";
5
5
  export * from "./build-tools/SdNgBundler";
6
6
  export * from "./build-tools/SdNgBundlerContext";
7
- export * from "./build-tools/SdTsBundler";
7
+ export * from "./build-tools/SdServerBundler";
8
8
  export * from "./build-tools/SdTsCompiler";
9
9
  export * from "./builders/SdCliClientBuilder";
10
10
  export * from "./builders/SdCliJsLibLinter";
11
11
  export * from "./builders/SdCliServerBuilder";
12
12
  export * from "./builders/SdCliTsLibBuilder";
13
- export * from "./bundle-plugins/sdLoadedFilesPlugin";
14
13
  export * from "./bundle-plugins/sdNgPlugin";
15
- export * from "./bundle-plugins/sdTscPlugin";
14
+ export * from "./bundle-plugins/sdServerPlugin";
16
15
  export * from "./commons";
17
16
  export * from "./entry/SdCliElectron";
18
17
  export * from "./entry/SdCliLocalUpdate";
@@ -1 +0,0 @@
1
- {"version":3,"file":"SdTsBundler.js","sourceRoot":"","sources":["../../src/build-tools/SdTsBundler.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAC,MAAM,EAAC,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAE1D,MAAM,OAAO,WAAW;IACtB,QAAQ,CAAwB;IAEhC,YAA6B,IAK5B;QAL4B,SAAI,GAAJ,IAAI,CAKhC;IACD,CAAC;IAED,KAAK,CAAC,WAAW;QAIf,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;QAE1C,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC;gBACpC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW;gBAClC,SAAS,EAAE,IAAI;gBACf,MAAM,EAAE,IAAI;gBACZ,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG;gBACxB,MAAM,EAAE,QAAQ;gBAChB,UAAU,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC;gBAClD,UAAU,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;gBAC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C,GAAG,CAAC,CAAC,EAAE;iBAC/E,CAAC,CAAC;gBACH,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;oBAC7B,IAAI,EAAE,OAAgB;oBACtB,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;oBACxF,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI;oBACxB,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;oBAC9E,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;oBAC9C,QAAQ,EAAE,OAAgB;oBAC1B,OAAO,EAAE,IAAI,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE;iBAC5E,CAAC,CAAC;aACJ;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -1,4 +0,0 @@
1
- import esbuild from "esbuild";
2
- export declare function sdLoadedFilesPlugin(conf: {
3
- loadedFileSet: Set<string>;
4
- }): esbuild.Plugin;
@@ -1,15 +0,0 @@
1
- export function sdLoadedFilesPlugin(conf) {
2
- return {
3
- name: "sd-loaded-files",
4
- setup: (build) => {
5
- build.onStart(() => {
6
- conf.loadedFileSet.clear();
7
- });
8
- build.onLoad({ filter: /.*/ }, (args) => {
9
- conf.loadedFileSet.add(args.path);
10
- return null;
11
- });
12
- }
13
- };
14
- }
15
- //# sourceMappingURL=sdLoadedFilesPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdLoadedFilesPlugin.js","sourceRoot":"","sources":["../../src/bundle-plugins/sdLoadedFilesPlugin.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,mBAAmB,CAAC,IAEnC;IACC,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,CAAC,KAA0B,EAAE,EAAE;YACpC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;gBACjB,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;YAC7B,CAAC,CAAC,CAAC;YAEH,KAAK,CAAC,MAAM,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,EAAE,CAAC,IAAI,EAAE,EAAE;gBACpC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAClC,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,5 +0,0 @@
1
- import esbuild from "esbuild";
2
- import ts from "typescript";
3
- export declare function sdTscPlugin(conf: {
4
- parsedTsconfig: ts.ParsedCommandLine;
5
- }): esbuild.Plugin;
@@ -1,21 +0,0 @@
1
- import { FsUtil } from "@simplysm/sd-core-node";
2
- import ts from "typescript";
3
- import path from "path";
4
- export function sdTscPlugin(conf) {
5
- return {
6
- name: "sd-tsc",
7
- setup: (build) => {
8
- if (conf.parsedTsconfig.options.emitDecoratorMetadata) {
9
- build.onLoad({ filter: /\.ts$/ }, async (args) => {
10
- const fileContent = await FsUtil.readFileAsync(args.path);
11
- const program = ts.transpileModule(fileContent, {
12
- compilerOptions: conf.parsedTsconfig.options,
13
- fileName: path.basename(args.path),
14
- });
15
- return { contents: program.outputText };
16
- });
17
- }
18
- }
19
- };
20
- }
21
- //# sourceMappingURL=sdTscPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdTscPlugin.js","sourceRoot":"","sources":["../../src/bundle-plugins/sdTscPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,UAAU,WAAW,CAAC,IAE3B;IACC,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,CAAC,KAA0B,EAAE,EAAE;YACpC,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,qBAAqB,EAAE;gBACrD,KAAK,CAAC,MAAM,CAAC,EAAC,MAAM,EAAE,OAAO,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;oBAE7C,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAC1D,MAAM,OAAO,GAAG,EAAE,CAAC,eAAe,CAAC,WAAW,EAAE;wBAC9C,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO;wBAC5C,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;qBACnC,CAAC,CAAC;oBACH,OAAO,EAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAC,CAAC;gBACxC,CAAC,CAAC,CAAC;aACJ;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,19 +0,0 @@
1
- import esbuild from "esbuild";
2
-
3
- export function sdLoadedFilesPlugin(conf: {
4
- loadedFileSet: Set<string>;
5
- }): esbuild.Plugin {
6
- return {
7
- name: "sd-loaded-files",
8
- setup: (build: esbuild.PluginBuild) => {
9
- build.onStart(() => {
10
- conf.loadedFileSet.clear();
11
- });
12
-
13
- build.onLoad({filter: /.*/}, (args) => {
14
- conf.loadedFileSet.add(args.path);
15
- return null;
16
- });
17
- }
18
- };
19
- }
@@ -1,25 +0,0 @@
1
- import esbuild from "esbuild";
2
- import {FsUtil} from "@simplysm/sd-core-node";
3
- import ts from "typescript";
4
- import path from "path";
5
-
6
- export function sdTscPlugin(conf: {
7
- parsedTsconfig: ts.ParsedCommandLine;
8
- }): esbuild.Plugin {
9
- return {
10
- name: "sd-tsc",
11
- setup: (build: esbuild.PluginBuild) => {
12
- if (conf.parsedTsconfig.options.emitDecoratorMetadata) {
13
- build.onLoad({filter: /\.ts$/}, async (args) => {
14
-
15
- const fileContent = await FsUtil.readFileAsync(args.path);
16
- const program = ts.transpileModule(fileContent, {
17
- compilerOptions: conf.parsedTsconfig.options,
18
- fileName: path.basename(args.path),
19
- });
20
- return {contents: program.outputText};
21
- });
22
- }
23
- }
24
- };
25
- }