@simplysm/sd-cli 7.0.37 → 7.0.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/sd-cli",
3
- "version": "7.0.37",
3
+ "version": "7.0.38",
4
4
  "description": "심플리즘 패키지 - CLI",
5
5
  "author": "김석래",
6
6
  "repository": {
@@ -43,17 +43,19 @@
43
43
  "webpack-dev-middleware": "^5.3.1",
44
44
  "webpack-hot-middleware": "^2.25.1",
45
45
  "css-loader": "^6.6.0",
46
- "resource-url-loader": "^1.1.5",
47
- "sass-loader": "^12.4.0"
46
+ "resolve-url-loader": "^5.0.0",
47
+ "sass-loader": "^12.4.0",
48
+ "connect": "^3.7.0"
48
49
  },
49
50
  "devDependencies": {
50
51
  "@types/semver": "^7.3.9",
51
52
  "@types/yargs": "^17.0.8",
52
- "@types/webpack-hot-middleware": "^2.25.5"
53
+ "@types/webpack-hot-middleware": "^2.25.5",
54
+ "@types/connect": "^3.4.35"
53
55
  },
54
56
  "peerDependencies": {
55
- "@simplysm/sd-core-common": "7.0.37",
56
- "@simplysm/sd-core-node": "7.0.37",
57
- "@simplysm/sd-service": "7.0.37"
57
+ "@simplysm/sd-core-common": "7.0.38",
58
+ "@simplysm/sd-core-node": "7.0.38",
59
+ "@simplysm/sd-service": "7.0.38"
58
60
  }
59
61
  }
package/src/bin/sd-cli.ts CHANGED
@@ -145,6 +145,7 @@ const logger = Logger.get(["simplysm", "sd-cli", "bin", "sd-cli"]);
145
145
  confFileRelPath: argv.config ?? "simplysm.json",
146
146
  optNames: argv.options ?? []
147
147
  });
148
+ process.exit(0);
148
149
  }
149
150
  else if (argv._[0] === "publish") {
150
151
  await new SdCliWorkspace(process.cwd())
@@ -17,7 +17,7 @@ export class SdCliNgCacheCompilerHost {
17
17
  };
18
18
 
19
19
  cacheCompilerHost["transformResource"] = async (data, context) => {
20
- if (context.resourceFile || context.type !== "style") {
20
+ if (context.resourceFile != null || context.type !== "style") {
21
21
  return null;
22
22
  }
23
23
 
@@ -1,4 +1,4 @@
1
- import { INpmConfig, ISdCliPackageBuildResult, ISdCliServerPackageConfig } from "../commons";
1
+ import { INpmConfig, ISdCliClientPackageConfig, ISdCliPackageBuildResult } from "../commons";
2
2
  import { EventEmitter } from "events";
3
3
  import { FsUtil, Logger, PathUtil } from "@simplysm/sd-core-node";
4
4
  import webpack from "webpack";
@@ -22,6 +22,8 @@ import { HmrLoader } from "@angular-devkit/build-angular/src/webpack/plugins/hmr
22
22
  import wdm from "webpack-dev-middleware";
23
23
  import whm from "webpack-hot-middleware";
24
24
  import { NextHandleFunction } from "connect";
25
+ import { LicenseWebpackPlugin } from "license-webpack-plugin";
26
+ import { Type } from "@angular-devkit/build-angular";
25
27
 
26
28
  export class SdCliClientBuilder extends EventEmitter {
27
29
  private readonly _logger = Logger.get(["simplysm", "sd-cli", this.constructor.name]);
@@ -31,7 +33,7 @@ export class SdCliClientBuilder extends EventEmitter {
31
33
  private readonly _npmConfigMap = new Map<string, INpmConfig>();
32
34
 
33
35
  public constructor(private readonly _rootPath: string,
34
- private readonly _config: ISdCliServerPackageConfig,
36
+ private readonly _config: ISdCliClientPackageConfig,
35
37
  private readonly _workspaceRootPath: string) {
36
38
  super();
37
39
 
@@ -52,7 +54,7 @@ export class SdCliClientBuilder extends EventEmitter {
52
54
  await FsUtil.removeAsync(this._parsedTsconfig.options.outDir!);
53
55
 
54
56
  // 빌드 준비
55
- const webpackConfig = this._getWebpackCommonConfig(true);
57
+ const webpackConfig = this._getWebpackConfig(true);
56
58
  const compiler = webpack(webpackConfig);
57
59
  return await new Promise<NextHandleFunction[]>((resolve, reject) => {
58
60
  compiler.hooks.watchRun.tapAsync(this.constructor.name, (args, callback) => {
@@ -96,7 +98,7 @@ export class SdCliClientBuilder extends EventEmitter {
96
98
 
97
99
  // 빌드
98
100
  this._logger.debug("Webpack 빌드 수행...");
99
- const webpackConfig = this._getWebpackCommonConfig(false);
101
+ const webpackConfig = this._getWebpackConfig(false);
100
102
  const compiler = webpack(webpackConfig);
101
103
  const buildResults = await new Promise<ISdCliPackageBuildResult[]>((resolve, reject) => {
102
104
  compiler.run((err, stats) => {
@@ -116,9 +118,7 @@ export class SdCliClientBuilder extends EventEmitter {
116
118
  return buildResults;
117
119
  }
118
120
 
119
- private _getWebpackCommonConfig(watch: boolean): webpack.Configuration {
120
- console.log(watch);
121
-
121
+ private _getWebpackConfig(watch: boolean): webpack.Configuration {
122
122
  const npmConfig = this._getNpmConfig(this._rootPath)!;
123
123
  const pkgVersion = npmConfig.version;
124
124
 
@@ -132,7 +132,100 @@ export class SdCliClientBuilder extends EventEmitter {
132
132
 
133
133
  const sassImplementation = new SassWorkerImplementation();
134
134
 
135
+ const mainFilePath = path.resolve(this._rootPath, "src/main.ts");
136
+ const polyfillsFilePath = path.resolve(this._rootPath, "src/polyfills.ts");
137
+ const stylesFilePath = path.resolve(this._rootPath, "src/styles.scss");
138
+
135
139
  return {
140
+ mode: watch ? "development" : "production",
141
+ devtool: false,
142
+ target: ["web", "es2015"],
143
+ profile: false,
144
+ resolve: {
145
+ roots: [this._rootPath],
146
+ extensions: [".ts", ".tsx", ".mjs", ".js"],
147
+ symlinks: true,
148
+ modules: [this._workspaceRootPath, "node_modules"],
149
+ mainFields: ["es2015", "browser", "module", "main"],
150
+ conditionNames: ["es2015", "..."]
151
+ },
152
+ resolveLoader: {
153
+ symlinks: true
154
+ },
155
+ context: this._workspaceRootPath,
156
+ entry: {
157
+ main: [
158
+ ...watch ? [
159
+ `webpack-hot-middleware/client?path=${publicPath}__webpack_hmr&timeout=20000&reload=true&overlay=true`,
160
+ ] : [],
161
+ mainFilePath
162
+ ],
163
+ ...FsUtil.exists(polyfillsFilePath) ? { polyfills: polyfillsFilePath } : {},
164
+ ...FsUtil.exists(stylesFilePath) ? { styles: stylesFilePath } : {}
165
+ },
166
+ output: {
167
+ uniqueName: pkgKey,
168
+ hashFunction: "xxhash64",
169
+ clean: true,
170
+ path: distPath,
171
+ publicPath,
172
+ filename: "[name].js",
173
+ chunkFilename: "[name].js",
174
+ libraryTarget: undefined,
175
+ crossOriginLoading: false,
176
+ trustedTypes: "angular#bundler",
177
+ scriptType: "module",
178
+ },
179
+ watch: false,
180
+ watchOptions: { poll: undefined, ignored: undefined },
181
+ performance: { hints: false },
182
+ ignoreWarnings: [
183
+ /Failed to parse source map from/,
184
+ /Add postcss as project dependency/,
185
+ /"@charset" must be the first rule in the file/,
186
+ ],
187
+ experiments: { backCompat: false, syncWebAssembly: true, asyncWebAssembly: true },
188
+ infrastructureLogging: { level: "error" },
189
+ stats: "errors-warnings",
190
+ cache: {
191
+ type: "filesystem",
192
+ profile: watch ? undefined : false,
193
+ cacheDirectory: path.resolve(cachePath, "angular-webpack"),
194
+ maxMemoryGenerations: 1,
195
+ name: createHash("sha1").update(pkgVersion).digest("hex")
196
+ },
197
+ node: false,
198
+ optimization: {
199
+ minimizer: [],
200
+ moduleIds: "deterministic",
201
+ chunkIds: watch ? "named" : "deterministic",
202
+ emitOnErrors: watch,
203
+ runtimeChunk: "single",
204
+ splitChunks: {
205
+ maxAsyncRequests: Infinity,
206
+ cacheGroups: {
207
+ default: {
208
+ chunks: "async",
209
+ minChunks: 2,
210
+ priority: 10
211
+ },
212
+ common: {
213
+ name: "common",
214
+ chunks: "async",
215
+ minChunks: 2,
216
+ enforce: true,
217
+ priority: 5
218
+ },
219
+ vendors: false,
220
+ defaultVendors: watch ? {
221
+ name: "vendor",
222
+ chunks: (chunk) => chunk.name === "main",
223
+ enforce: true,
224
+ test: /[\\/]node_modules[\\/]/
225
+ } : false
226
+ }
227
+ }
228
+ },
136
229
  plugins: [
137
230
  new NamedChunksPlugin(),
138
231
  new DedupeModuleResolvePlugin(),
@@ -144,6 +237,14 @@ export class SdCliClientBuilder extends EventEmitter {
144
237
  }
145
238
  }),*/
146
239
  new CommonJsUsageWarnPlugin(),
240
+ ...watch ? [] : [
241
+ new LicenseWebpackPlugin({
242
+ stats: { warnings: false, errors: false, },
243
+ perChunkOutput: false,
244
+ outputFilename: "3rdpartylicenses.txt",
245
+ skipChildCompilers: true
246
+ })
247
+ ],
147
248
  new CopyWebpackPlugin({
148
249
  patterns: [
149
250
  ...["favicon.ico", "assets/", "manifest.webmanifest"].map((item) => ({
@@ -165,26 +266,30 @@ export class SdCliClientBuilder extends EventEmitter {
165
266
  }))
166
267
  ]
167
268
  }),
168
- new webpack.SourceMapDevToolPlugin({
169
- filename: "[file].map",
170
- include: [/js$/, /css$/],
171
- sourceRoot: "webpack:///",
172
- moduleFilenameTemplate: "[resource-path]",
173
- append: undefined,
174
- }),
269
+ ...watch ? [
270
+ new webpack.SourceMapDevToolPlugin({
271
+ filename: "[file].map",
272
+ include: [/js$/, /css$/],
273
+ sourceRoot: "webpack:///",
274
+ moduleFilenameTemplate: "[resource-path]",
275
+ append: undefined,
276
+ })
277
+ ] : [],
175
278
  new AngularWebpackPlugin({
176
279
  tsconfig: this._tsconfigFilePath,
177
280
  compilerOptions: {
178
- sourceMap: true,
281
+ sourceMap: watch,
179
282
  declaration: false,
180
283
  declarationMap: false,
181
284
  preserveSymlinks: false
182
285
  },
183
286
  jitMode: false,
184
- emitNgModuleScope: true,
287
+ emitNgModuleScope: watch,
185
288
  inlineStyleFileExtension: "scss"
186
289
  }),
187
- new AnyComponentStyleBudgetChecker([]),
290
+ new AnyComponentStyleBudgetChecker(watch ? [] : [
291
+ { type: Type.AnyComponentStyle, maximumWarning: "2kb", maximumError: "4kb" }
292
+ ]),
188
293
  {
189
294
  apply: (compiler: webpack.Compiler) => {
190
295
  compiler.hooks.shutdown.tap("sass-worker", () => {
@@ -215,14 +320,16 @@ export class SdCliClientBuilder extends EventEmitter {
215
320
  },
216
321
  postTransform: undefined,
217
322
  optimization: {
218
- scripts: false,
219
- styles: { minify: false, inlineCritical: false },
220
- fonts: { inline: false }
323
+ scripts: !watch,
324
+ styles: { minify: !watch, inlineCritical: !watch },
325
+ fonts: { inline: !watch }
221
326
  },
222
327
  crossOrigin: "none",
223
328
  lang: undefined
224
329
  }),
225
- new webpack.HotModuleReplacementPlugin()
330
+ ...watch ? [
331
+ new webpack.HotModuleReplacementPlugin()
332
+ ] : []
226
333
  ] as any[],
227
334
  module: {
228
335
  strictExportPresence: true,
@@ -248,22 +355,24 @@ export class SdCliClientBuilder extends EventEmitter {
248
355
  cacheDirectory: path.resolve(cachePath, "babel-webpack"),
249
356
  scriptTarget: ts.ScriptTarget.ES2017,
250
357
  aot: true,
251
- optimize: false,
358
+ optimize: !watch,
252
359
  instrumentCode: undefined
253
360
  }
254
361
  }
255
362
  ],
256
363
  },
257
- {
258
- test: /\.[cm]?jsx?$/,
259
- enforce: "pre",
260
- loader: "source-map-loader",
261
- options: {
262
- filterSourceMappingUrl: (_mapUri: string, resourcePath: string) => {
263
- return !resourcePath.includes("node_modules") || (/@simplysm[\\/]sd/).test(resourcePath);
364
+ ...watch ? [
365
+ {
366
+ test: /\.[cm]?jsx?$/,
367
+ enforce: "pre" as const,
368
+ loader: "source-map-loader",
369
+ options: {
370
+ filterSourceMappingUrl: (_mapUri: string, resourcePath: string) => {
371
+ return !resourcePath.includes("node_modules") || (/@simplysm[\\/]sd/).test(resourcePath);
372
+ }
264
373
  }
265
374
  }
266
- },
375
+ ] : [],
267
376
  {
268
377
  test: /\.[cm]?tsx?$/,
269
378
  loader: "@ngtools/webpack",
@@ -285,22 +394,23 @@ export class SdCliClientBuilder extends EventEmitter {
285
394
  },
286
395
  {
287
396
  loader: "css-loader",
288
- options: { url: false, sourceMap: true }
397
+ options: { url: false, sourceMap: watch }
289
398
  }
290
399
  ],
291
- include: path.resolve(this._rootPath, "src/styles.scss"),
400
+ include: [stylesFilePath],
292
401
  resourceQuery: { not: [/\?ngResource/] }
293
402
  },
294
403
  {
295
- type: "asset/source"
404
+ type: "asset/source",
405
+ resourceQuery: /\?ngResource/
296
406
  }
297
407
  ]
298
408
  },
299
409
  {
300
410
  use: [
301
411
  {
302
- loader: "resource-url-loader",
303
- options: { sourceMap: true }
412
+ loader: "resolve-url-loader",
413
+ options: { sourceMap: watch }
304
414
  },
305
415
  {
306
416
  loader: "sass-loader",
@@ -313,7 +423,7 @@ export class SdCliClientBuilder extends EventEmitter {
313
423
  includePaths: [],
314
424
  outputStyle: "expanded",
315
425
  quietDeps: true,
316
- verbose: undefined
426
+ verbose: watch ? undefined : false
317
427
  }
318
428
  }
319
429
  }
@@ -321,99 +431,14 @@ export class SdCliClientBuilder extends EventEmitter {
321
431
  }
322
432
  ]
323
433
  },
324
- {
325
- loader: HmrLoader,
326
- include: [path.resolve(this._rootPath, "src/main.ts")]
327
- }
328
- ]
329
- },
330
- mode: "development",
331
- devtool: false,
332
- target: ["web", "es2015"],
333
- profile: false,
334
- resolve: {
335
- roots: [this._rootPath],
336
- extensions: [".ts", ".tsx", ".mjs", ".js"],
337
- symlinks: true,
338
- modules: [this._workspaceRootPath, "node_modules"],
339
- mainFields: ["es2015", "browser", "module", "main"],
340
- conditionNames: ["es2015", "..."]
341
- },
342
- resolveLoader: {
343
- symlinks: true
344
- },
345
- context: this._workspaceRootPath,
346
- entry: {
347
- main: [
348
- `webpack-hot-middleware/client?path=${publicPath}__webpack_hmr&timeout=20000&reload=true&overlay=true`,
349
- path.resolve(this._rootPath, "src/main.ts")
350
- ],
351
- polyfills: [path.resolve(this._rootPath, "src/polyfills.ts")],
352
- styles: [path.resolve(this._rootPath, "src/styles.scss")]
353
- },
354
- output: {
355
- uniqueName: pkgKey,
356
- hashFunction: "xxhash64",
357
- clean: true,
358
- path: distPath,
359
- publicPath,
360
- filename: "[name].js",
361
- chunkFilename: "[name].js",
362
- libraryTarget: undefined,
363
- crossOriginLoading: false,
364
- trustedTypes: "angular#bundler",
365
- scriptType: "module",
366
- },
367
- watch: false,
368
- watchOptions: { poll: undefined, ignored: undefined },
369
- performance: { hints: false },
370
- ignoreWarnings: [
371
- /Failed to parse source map from/,
372
- /Add postcss as project dependency/,
373
- /"@charset" must be the first rule in the file/,
374
- ],
375
- experiments: { backCompat: false, syncWebAssembly: true, asyncWebAssembly: true },
376
- infrastructureLogging: { level: "error" },
377
- stats: "errors-warnings",
378
- cache: {
379
- type: "filesystem",
380
- profile: undefined,
381
- cacheDirectory: path.resolve(cachePath, "angular-webpack"),
382
- maxMemoryGenerations: 1,
383
- name: createHash("sha1").update(pkgVersion).digest("hex")
384
- },
385
- optimization: {
386
- minimizer: [],
387
- moduleIds: "deterministic",
388
- chunkIds: "named",
389
- emitOnErrors: false,
390
- runtimeChunk: "single",
391
- splitChunks: {
392
- maxAsyncRequests: Infinity,
393
- cacheGroups: {
394
- default: {
395
- chunks: "async",
396
- minChunks: 2,
397
- priority: 10
398
- },
399
- common: {
400
- name: "common",
401
- chunks: "async",
402
- minChunks: 2,
403
- enforce: true,
404
- priority: 5
405
- },
406
- vendors: false,
407
- defaultVendors: {
408
- name: "vendor",
409
- chunks: (chunk) => chunk.name === "main",
410
- enforce: true,
411
- test: /[\\/]node_modules[\\/]/
434
+ ...watch ? [
435
+ {
436
+ loader: HmrLoader,
437
+ include: [mainFilePath]
412
438
  }
413
- }
414
- }
439
+ ] : []
440
+ ]
415
441
  },
416
- node: false
417
442
  };
418
443
  }
419
444
 
@@ -25,7 +25,7 @@ export class SdCliJsLibBuilder extends EventEmitter {
25
25
 
26
26
  const relatedPaths = await this.getRelatedPathsAsync();
27
27
  const watcher = SdFsWatcher.watch(relatedPaths);
28
- watcher.onChange(async (changeInfos) => {
28
+ watcher.onChange({}, async (changeInfos) => {
29
29
  const changeFilePaths = changeInfos.filter((item) => ["add", "change", "unlink"].includes(item.event)).map((item) => item.path);
30
30
  if(changeFilePaths.length === 0) return;
31
31
 
@@ -50,9 +50,8 @@ export class SdCliServerBuilder extends EventEmitter {
50
50
  await new Promise<void>((resolve, reject) => {
51
51
  compiler.hooks.watchRun.tapAsync(this.constructor.name, (args, callback) => {
52
52
  this.emit("change");
53
- callback();
54
-
55
53
  this._logger.debug("Webpack 빌드 수행...");
54
+ callback();
56
55
  });
57
56
 
58
57
  compiler.watch({}, async (err, stats) => {
@@ -65,11 +64,9 @@ export class SdCliServerBuilder extends EventEmitter {
65
64
  await this._writeDistConfigFileAsync();
66
65
 
67
66
  // 결과 반환
67
+ this._logger.debug("Webpack 빌드 완료");
68
68
  const results = SdCliBuildResultUtil.convertFromWebpackStats(stats);
69
69
  this.emit("complete", results);
70
-
71
- // 마무리
72
- this._logger.debug("Webpack 빌드 완료");
73
70
  resolve();
74
71
  });
75
72
  });
@@ -239,7 +236,9 @@ export class SdCliServerBuilder extends EventEmitter {
239
236
  outputModule: true
240
237
  },
241
238
  performance: { hints: false },
242
- node: false,
239
+ node: {
240
+ __dirname: true
241
+ },
243
242
  stats: "errors-warnings",
244
243
  externals: extModuleNames,
245
244
  ...watch ? {
@@ -66,7 +66,7 @@ export class SdCliTsLibBuilder extends EventEmitter {
66
66
 
67
67
  const relatedPaths = await this.getAllRelatedPathsAsync();
68
68
  const watcher = SdFsWatcher.watch(relatedPaths);
69
- watcher.onChange(async (changeInfos) => {
69
+ watcher.onChange({}, async (changeInfos) => {
70
70
  const changeFilePaths = changeInfos.filter((item) => ["add", "change", "unlink"].includes(item.event)).map((item) => item.path);
71
71
  if (changeFilePaths.length === 0) return;
72
72
 
package/src/commons.ts CHANGED
@@ -40,7 +40,7 @@ export interface ISdCliConfig {
40
40
  localUpdates?: Record<string, string>;
41
41
  }
42
42
 
43
- export type TSdCliPackageConfig = ISdCliLibPackageConfig | ISdCliServerPackageConfig;
43
+ export type TSdCliPackageConfig = ISdCliLibPackageConfig | ISdCliServerPackageConfig | ISdCliClientPackageConfig;
44
44
 
45
45
  export interface ISdCliLibPackageConfig {
46
46
  type: "library";
@@ -54,3 +54,8 @@ export interface ISdCliServerPackageConfig {
54
54
  pm2?: Record<string, any> | boolean;
55
55
  iis?: { serverExeFilePath?: string } | boolean;
56
56
  }
57
+
58
+ export interface ISdCliClientPackageConfig {
59
+ type: "client";
60
+ server: string;
61
+ }
@@ -40,19 +40,25 @@ export class SdCliLocalUpdate {
40
40
  const watchPaths = (await updatePathInfos.mapManyAsync(async (item) => await this._getWatchPathsAsync(item.source))).distinct();
41
41
 
42
42
  const watcher = SdFsWatcher.watch(watchPaths);
43
- watcher.onChange(async (changeInfos) => {
43
+ watcher.onChange({ delay: 1000 }, async (changeInfos) => {
44
44
  const changeFilePaths = changeInfos.filter((item) => ["add", "change", "unlink"].includes(item.event)).map((item) => item.path);
45
45
  if (changeFilePaths.length === 0) return;
46
46
 
47
47
  this._logger.log("로컬 라이브러리 변경감지...");
48
48
  for (const changedFilePath of changeFilePaths) {
49
- const currentUpdatePathInfos = updatePathInfos.filter((item) => PathUtil.isChildPath(changedFilePath, item.source));
50
- const targetFilePaths = currentUpdatePathInfos.map((item) => path.resolve(item.target, path.relative(item.source, changedFilePath)));
51
- if (FsUtil.exists(changedFilePath)) {
52
- this._logger.debug(`변경파일감지(복사): ${changedFilePath}`);
53
- for (const targetFilePath of targetFilePaths) {
54
- await FsUtil.copyAsync(changedFilePath, targetFilePath);
55
- }
49
+ if (!FsUtil.exists(changedFilePath)) continue;
50
+
51
+ for (const updatePathInfo of updatePathInfos) {
52
+ if (!PathUtil.isChildPath(changedFilePath, updatePathInfo.source)) continue;
53
+
54
+ const sourceRelPath = path.relative(updatePathInfo.source, changedFilePath);
55
+ if (sourceRelPath.includes("node_modules")) continue;
56
+ if (sourceRelPath.includes("package.json")) continue;
57
+
58
+ const targetFilePath = path.resolve(updatePathInfo.target, sourceRelPath);
59
+
60
+ this._logger.debug(`변경파일감지(복사): ${changedFilePath} => ${targetFilePath}`);
61
+ await FsUtil.copyAsync(changedFilePath, targetFilePath);
56
62
  }
57
63
  }
58
64
 
@@ -1,4 +1,5 @@
1
1
  import { FsUtil, Logger } from "@simplysm/sd-core-node";
2
+ import { fileURLToPath } from "url";
2
3
 
3
4
  export class SdCliPrepare {
4
5
  private readonly _logger = Logger.get(["simplysm", "sd-cli", this.constructor.name]);
@@ -11,7 +12,7 @@ export class SdCliPrepare {
11
12
 
12
13
  private async _modifyTypescriptCodeForTypeCheckPerformanceWarning(): Promise<boolean> {
13
14
  const fileUrl = await import.meta.resolve!("typescript");
14
- const filePath = fileUrl.replace(/^file:\/\/\//, "");
15
+ const filePath = fileURLToPath(fileUrl);
15
16
  const fileContent = await FsUtil.readFileAsync(filePath);
16
17
  const modifiedFileContent = fileContent.replace(`
17
18
  function checkSourceElement(node) {