@simplysm/sd-cli 11.1.46 → 11.1.51

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 (40) hide show
  1. package/dist/build-tools/SdLibBundler.d.ts +13 -0
  2. package/dist/build-tools/SdLibBundler.js +51 -0
  3. package/dist/build-tools/SdLibBundler.js.map +1 -0
  4. package/dist/build-tools/SdLinter.js +4 -4
  5. package/dist/build-tools/SdLinter.js.map +1 -1
  6. package/dist/build-tools/SdNgBundler.d.ts +10 -19
  7. package/dist/build-tools/SdNgBundler.js +103 -99
  8. package/dist/build-tools/SdNgBundler.js.map +1 -1
  9. package/dist/build-tools/SdTsCompiler.d.ts +23 -10
  10. package/dist/build-tools/SdTsCompiler.js +250 -220
  11. package/dist/build-tools/SdTsCompiler.js.map +1 -1
  12. package/dist/builders/SdCliTsLibBuilder.d.ts +2 -6
  13. package/dist/builders/SdCliTsLibBuilder.js +26 -21
  14. package/dist/builders/SdCliTsLibBuilder.js.map +1 -1
  15. package/dist/bundle-plugins/sdNgPlugin.js +2 -2
  16. package/dist/bundle-plugins/sdNgPlugin.js.map +1 -1
  17. package/dist/bundle-plugins/sdServerPlugin.js +2 -2
  18. package/dist/bundle-plugins/sdServerPlugin.js.map +1 -1
  19. package/dist/entry/SdCliProject.js +3 -1
  20. package/dist/entry/SdCliProject.js.map +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/sd-cli.d.ts +1 -1
  25. package/dist/sd-cli.js +1 -1
  26. package/package.json +5 -5
  27. package/src/build-tools/SdLibBundler.ts +70 -0
  28. package/src/build-tools/SdLinter.ts +4 -4
  29. package/src/build-tools/SdNgBundler.ts +114 -109
  30. package/src/build-tools/SdTsCompiler.ts +355 -214
  31. package/src/builders/SdCliTsLibBuilder.ts +29 -22
  32. package/src/bundle-plugins/sdNgPlugin.ts +2 -2
  33. package/src/bundle-plugins/sdServerPlugin.ts +2 -2
  34. package/src/entry/SdCliProject.ts +3 -1
  35. package/src/index.ts +1 -1
  36. package/src/sd-cli.ts +1 -1
  37. package/dist/build-tools2/SdTsCompiler2.d.ts +0 -26
  38. package/dist/build-tools2/SdTsCompiler2.js +0 -280
  39. package/dist/build-tools2/SdTsCompiler2.js.map +0 -1
  40. package/src/build-tools2/SdTsCompiler2.ts +0 -427
@@ -43,47 +43,43 @@ import ts from "typescript";
43
43
 
44
44
  export class SdNgBundler {
45
45
  // private readonly _sourceFileCache = new SourceFileCache(
46
- // path.resolve(this._opt.pkgPath, ".cache")
46
+ // path.resolve(this.#opt.pkgPath, ".cache")
47
47
  // );
48
48
 
49
- #modifiedFileSet = new Set<string>();
50
- #ngResultCache: INgPluginResultCache = {
49
+ readonly #modifiedFileSet = new Set<string>();
50
+ readonly #ngResultCache: INgPluginResultCache = {
51
51
  affectedFileSet: new Set<string>(),
52
52
  watchFileSet: new Set<string>()
53
53
  };
54
- #styleLoadResultCache = new MemoryLoadResultCache();
54
+ readonly #styleLoadResultCache = new MemoryLoadResultCache();
55
55
 
56
- private _contexts: SdNgBundlerContext[] | undefined;
56
+ #contexts: SdNgBundlerContext[] | undefined;
57
57
 
58
- private readonly _outputCache = new Map<string, string | number>();
58
+ readonly #outputCache = new Map<string, string | number>();
59
59
 
60
- private readonly _pkgNpmConf: INpmConfig;
61
- private readonly _mainFilePath: string;
62
- private readonly _tsConfigFilePath: string;
63
- private readonly _swConfFilePath: string;
64
- private readonly _browserTarget: string[];
65
- private readonly _indexHtmlFilePath: string;
66
- private readonly _pkgName: string;
67
- private readonly _baseHref: string;
60
+ readonly #opt: IOptions;
61
+
62
+ readonly #pkgNpmConf: INpmConfig;
63
+ readonly #mainFilePath: string;
64
+ readonly #tsConfigFilePath: string;
65
+ readonly #swConfFilePath: string;
66
+ readonly #browserTarget: string[];
67
+ readonly #indexHtmlFilePath: string;
68
+ readonly #pkgName: string;
69
+ readonly #baseHref: string;
68
70
 
69
71
  // #loadFilePathSet = new Set<string>();
70
72
 
71
- public constructor(private readonly _opt: {
72
- dev: boolean;
73
- outputPath: string;
74
- pkgPath: string;
75
- builderType: string;
76
- env: Record<string, string> | undefined;
77
- cordovaConfig: ISdCliClientBuilderCordovaConfig | undefined;
78
- }) {
79
- this._pkgNpmConf = FsUtil.readJson(path.resolve(this._opt.pkgPath, "package.json"));
80
- this._mainFilePath = path.resolve(this._opt.pkgPath, "src/main.ts");
81
- this._tsConfigFilePath = path.resolve(this._opt.pkgPath, "tsconfig.json");
82
- this._swConfFilePath = path.resolve(this._opt.pkgPath, "ngsw-config.json");
83
- this._browserTarget = transformSupportedBrowsersToTargets(browserslist("defaults and fully supports es6-module"));
84
- this._indexHtmlFilePath = path.resolve(this._opt.pkgPath, "src/index.html");
85
- this._pkgName = path.basename(this._opt.pkgPath);
86
- this._baseHref = this._opt.builderType === "web" ? `/${this._pkgName}/` : this._opt.dev ? `/${this._pkgName}/${this._opt.builderType}/` : ``;
73
+ public constructor(opt: IOptions) {
74
+ this.#opt = opt;
75
+ this.#pkgNpmConf = FsUtil.readJson(path.resolve(opt.pkgPath, "package.json"));
76
+ this.#mainFilePath = path.resolve(opt.pkgPath, "src/main.ts");
77
+ this.#tsConfigFilePath = path.resolve(opt.pkgPath, "tsconfig.json");
78
+ this.#swConfFilePath = path.resolve(opt.pkgPath, "ngsw-config.json");
79
+ this.#browserTarget = transformSupportedBrowsersToTargets(browserslist("defaults and fully supports es6-module"));
80
+ this.#indexHtmlFilePath = path.resolve(opt.pkgPath, "src/index.html");
81
+ this.#pkgName = path.basename(opt.pkgPath);
82
+ this.#baseHref = opt.builderType === "web" ? `/${this.#pkgName}/` : opt.dev ? `/${this.#pkgName}/${opt.builderType}/` : ``;
87
83
  }
88
84
 
89
85
  public markForChanges(filePaths: string[]): void {
@@ -102,18 +98,18 @@ export class SdNgBundler {
102
98
  }> {
103
99
  const logger = Logger.get(["simplysm", "sd-cli", "SdNgBundler", "bundleAsync"]);
104
100
 
105
- if (!this._contexts) {
106
- this._contexts = [
101
+ if (!this.#contexts) {
102
+ this.#contexts = [
107
103
  await this._getAppContextAsync(),
108
104
  this._getStyleContext(),
109
- ...this._opt.builderType === "electron" ? [
105
+ ...this.#opt.builderType === "electron" ? [
110
106
  this._getElectronMainContext()
111
107
  ] : []
112
108
  ];
113
109
  }
114
110
 
115
111
  //-- build
116
- const bundlingResults = await this._contexts.mapAsync(async ctx => await ctx.bundleAsync());
112
+ const bundlingResults = await this.#contexts.mapAsync(async ctx => await ctx.bundleAsync());
117
113
 
118
114
  //-- results
119
115
  const results = bundlingResults.mapMany(bundlingResult => bundlingResult.results);
@@ -136,7 +132,7 @@ export class SdNgBundler {
136
132
  const assetFiles: { source: string; destination: string }[] = [];
137
133
 
138
134
  //-- cordova empty
139
- if (this._opt.builderType === "cordova" && this._opt.cordovaConfig?.plugins) {
135
+ if (this.#opt.builderType === "cordova" && this.#opt.cordovaConfig?.plugins) {
140
136
  outputFiles.push(createOutputFileFromText("cordova-empty.js", "export default {};", BuildOutputFileType.Root));
141
137
  }
142
138
 
@@ -171,12 +167,12 @@ export class SdNgBundler {
171
167
  assetFiles.push(...(await this._copyAssetsAsync()));
172
168
 
173
169
  //-- extract 3rdpartylicenses
174
- if (!this._opt.dev) {
175
- outputFiles.push(createOutputFileFromText('3rdpartylicenses.txt', await extractLicenses(metafile, this._opt.pkgPath), BuildOutputFileType.Root));
170
+ if (!this.#opt.dev) {
171
+ outputFiles.push(createOutputFileFromText('3rdpartylicenses.txt', await extractLicenses(metafile, this.#opt.pkgPath), BuildOutputFileType.Root));
176
172
  }
177
173
 
178
174
  //-- service worker
179
- if (FsUtil.exists(this._swConfFilePath)) {
175
+ if (FsUtil.exists(this.#swConfFilePath)) {
180
176
  try {
181
177
  const serviceWorkerResult = await this._genServiceWorkerAsync(outputFiles, assetFiles);
182
178
  outputFiles.push(createOutputFileFromText('ngsw.json', serviceWorkerResult.manifest, BuildOutputFileType.Root));
@@ -197,23 +193,23 @@ export class SdNgBundler {
197
193
 
198
194
  //-- write
199
195
  for (const outputFile of outputFiles) {
200
- const distFilePath = path.resolve(this._opt.outputPath, outputFile.path);
201
- const prev = this._outputCache.get(distFilePath);
196
+ const distFilePath = path.resolve(this.#opt.outputPath, outputFile.path);
197
+ const prev = this.#outputCache.get(distFilePath);
202
198
  if (prev !== Buffer.from(outputFile.contents).toString("base64")) {
203
199
  await FsUtil.writeFileAsync(distFilePath, outputFile.contents);
204
- this._outputCache.set(distFilePath, Buffer.from(outputFile.contents).toString("base64"));
200
+ this.#outputCache.set(distFilePath, Buffer.from(outputFile.contents).toString("base64"));
205
201
  }
206
202
  }
207
203
  for (const assetFile of assetFiles) {
208
- const prev = this._outputCache.get(assetFile.source);
204
+ const prev = this.#outputCache.get(assetFile.source);
209
205
  const curr = FsUtil.lstat(assetFile.source).mtime.getTime();
210
206
  if (prev !== curr) {
211
- await FsUtil.copyAsync(assetFile.source, path.resolve(this._opt.outputPath, assetFile.destination));
212
- this._outputCache.set(assetFile.source, curr);
207
+ await FsUtil.copyAsync(assetFile.source, path.resolve(this.#opt.outputPath, assetFile.destination));
208
+ this.#outputCache.set(assetFile.source, curr);
213
209
  }
214
210
  }
215
211
 
216
- logger.debug(`[${path.basename(this._opt.pkgPath)}] 번들링중 영향받은 파일`, Array.from(this.#ngResultCache.affectedFileSet!));
212
+ logger.debug(`[${path.basename(this.#opt.pkgPath)}] 번들링중 영향받은 파일`, Array.from(this.#ngResultCache.affectedFileSet!));
217
213
 
218
214
  return {
219
215
  program: this.#ngResultCache.program,
@@ -241,22 +237,22 @@ export class SdNgBundler {
241
237
  };
242
238
 
243
239
  const indexHtmlGenerator = new IndexHtmlGenerator({
244
- indexPath: this._indexHtmlFilePath,
240
+ indexPath: this.#indexHtmlFilePath,
245
241
  entrypoints: [
246
242
  ['runtime', true],
247
243
  ['polyfills', true],
248
244
  ['styles', false],
249
245
  ['vendor', true],
250
246
  ['main', true],
251
- ...this._opt.builderType === "cordova" ? [
247
+ ...this.#opt.builderType === "cordova" ? [
252
248
  ["cordova-entry", true] as Entrypoint
253
249
  ] : []
254
250
  ],
255
251
  optimization: {
256
- scripts: !this._opt.dev,
257
- fonts: {inline: !this._opt.dev},
252
+ scripts: !this.#opt.dev,
253
+ fonts: {inline: !this.#opt.dev},
258
254
  styles: {
259
- minify: !this._opt.dev,
255
+ minify: !this.#opt.dev,
260
256
  inlineCritical: false
261
257
  },
262
258
  },
@@ -265,7 +261,7 @@ export class SdNgBundler {
265
261
  indexHtmlGenerator.readAsset = readAsset;
266
262
 
267
263
  const hints: { url: string; mode: HintMode; as?: string; }[] = [];
268
- if (!this._opt.dev) {
264
+ if (!this.#opt.dev) {
269
265
  for (const [key, value] of initialFiles) {
270
266
  if (value.entrypoint) {
271
267
  continue;
@@ -281,7 +277,7 @@ export class SdNgBundler {
281
277
  }
282
278
 
283
279
  const transformResult = await indexHtmlGenerator.process({
284
- baseHref: this._baseHref,
280
+ baseHref: this.#baseHref,
285
281
  lang: undefined,
286
282
  outputPath: "/",
287
283
  files: [...initialFiles].map(([file, record]) => ({
@@ -292,7 +288,7 @@ export class SdNgBundler {
292
288
  hints,
293
289
  });
294
290
 
295
- if (this._opt.dev) {
291
+ if (this.#opt.dev) {
296
292
  return transformResult;
297
293
  }
298
294
  else {
@@ -321,7 +317,7 @@ export class SdNgBundler {
321
317
  {input: 'src', glob: 'favicon.ico', output: ''},
322
318
  {input: 'src', glob: 'manifest.webmanifest', output: ''},
323
319
  {input: 'src/assets', glob: '**/*', output: 'assets'},
324
- ...this._opt.dev && this._opt.builderType === "cordova" ? Object.keys(this._opt.cordovaConfig?.platform ?? {browser: {}}).mapMany((platform) => [
320
+ ...this.#opt.dev && this.#opt.builderType === "cordova" ? Object.keys(this.#opt.cordovaConfig?.platform ?? {browser: {}}).mapMany((platform) => [
325
321
  {
326
322
  input: `.cordova/platforms/${platform}/platform_www/plugins`,
327
323
  glob: '**/*',
@@ -343,7 +339,7 @@ export class SdNgBundler {
343
339
  output: `cordova-${platform}`
344
340
  },
345
341
  ]) : []
346
- ], [], this._opt.pkgPath);
342
+ ], [], this.#opt.pkgPath);
347
343
  }
348
344
 
349
345
  private async _genServiceWorkerAsync(
@@ -360,9 +356,9 @@ export class SdNgBundler {
360
356
  }[];
361
357
  }> {
362
358
  return await augmentAppWithServiceWorkerEsbuild(
363
- this._opt.pkgPath,
364
- this._swConfFilePath,
365
- this._baseHref,
359
+ this.#opt.pkgPath,
360
+ this.#swConfFilePath,
361
+ this.#baseHref,
366
362
  "index.html",
367
363
  outputFiles,
368
364
  assetFiles
@@ -370,8 +366,8 @@ export class SdNgBundler {
370
366
  }
371
367
 
372
368
  private async _getAppContextAsync(): Promise<SdNgBundlerContext> {
373
- return new SdNgBundlerContext(this._opt.pkgPath, {
374
- absWorkingDir: this._opt.pkgPath,
369
+ return new SdNgBundlerContext(this.#opt.pkgPath, {
370
+ absWorkingDir: this.#opt.pkgPath,
375
371
  bundle: true,
376
372
  keepNames: true,
377
373
  format: 'esm',
@@ -379,45 +375,45 @@ export class SdNgBundler {
379
375
  conditions: ['es2020', 'es2015', 'module'],
380
376
  resolveExtensions: ['.ts', '.tsx', '.mjs', '.js'],
381
377
  metafile: true,
382
- legalComments: this._opt.dev ? 'eof' : 'none',
378
+ legalComments: this.#opt.dev ? 'eof' : 'none',
383
379
  logLevel: 'silent',
384
- minifyIdentifiers: !this._opt.dev,
385
- minifySyntax: !this._opt.dev,
386
- minifyWhitespace: !this._opt.dev,
380
+ minifyIdentifiers: !this.#opt.dev,
381
+ minifySyntax: !this.#opt.dev,
382
+ minifyWhitespace: !this.#opt.dev,
387
383
  pure: ['forwardRef'],
388
- outdir: this._opt.pkgPath,
384
+ outdir: this.#opt.pkgPath,
389
385
  outExtension: undefined,
390
- sourcemap: true, //this._opt.dev,
386
+ sourcemap: true, //this.#opt.dev,
391
387
  splitting: true,
392
388
  chunkNames: 'chunk-[hash]',
393
- tsconfig: this._tsConfigFilePath,
389
+ tsconfig: this.#tsConfigFilePath,
394
390
  write: false,
395
391
  preserveSymlinks: false,
396
392
  define: {
397
- ...!this._opt.dev ? {ngDevMode: 'false'} : {},
393
+ ...!this.#opt.dev ? {ngDevMode: 'false'} : {},
398
394
  ngJitMode: 'false',
399
395
  global: 'global',
400
396
  process: 'process',
401
397
  Buffer: 'Buffer',
402
- 'process.env.SD_VERSION': JSON.stringify(this._pkgNpmConf.version),
403
- "process.env.NODE_ENV": JSON.stringify(this._opt.dev ? "development" : "production"),
404
- ...this._opt.env ? Object.keys(this._opt.env).toObject(
398
+ 'process.env.SD_VERSION': JSON.stringify(this.#pkgNpmConf.version),
399
+ "process.env.NODE_ENV": JSON.stringify(this.#opt.dev ? "development" : "production"),
400
+ ...this.#opt.env ? Object.keys(this.#opt.env).toObject(
405
401
  key => `process.env.${key}`,
406
- key => JSON.stringify(this._opt.env![key])
402
+ key => JSON.stringify(this.#opt.env![key])
407
403
  ) : {}
408
404
  },
409
405
  platform: 'browser',
410
406
  mainFields: ['es2020', 'es2015', 'browser', 'module', 'main'],
411
407
  entryNames: '[name]',
412
408
  entryPoints: {
413
- main: this._mainFilePath,
409
+ main: this.#mainFilePath,
414
410
  // polyfills: 'angular:polyfills',
415
- polyfills: path.resolve(this._opt.pkgPath, "src/polyfills.ts"),
416
- ...this._opt.builderType === "cordova" ? {
411
+ polyfills: path.resolve(this.#opt.pkgPath, "src/polyfills.ts"),
412
+ ...this.#opt.builderType === "cordova" ? {
417
413
  "cordova-entry": path.resolve(path.dirname(fileURLToPath(import.meta.url)), `../../lib/cordova-entry.js`)
418
414
  } : {}
419
415
  },
420
- target: this._browserTarget,
416
+ target: this.#browserTarget,
421
417
  supported: {'async-await': false, 'object-rest-spread': false},
422
418
  loader: {
423
419
  ".png": "file",
@@ -445,10 +441,10 @@ export class SdNgBundler {
445
441
  },
446
442
  inject: [PathUtil.posix(fileURLToPath(await import.meta.resolve!("node-stdlib-browser/helpers/esbuild/shim")))],
447
443
  plugins: [
448
- ...this._opt.builderType === "cordova" && this._opt.cordovaConfig?.plugins ? [{
444
+ ...this.#opt.builderType === "cordova" && this.#opt.cordovaConfig?.plugins ? [{
449
445
  name: "cordova:plugin-empty",
450
446
  setup: ({onResolve}) => {
451
- onResolve({filter: new RegExp("(" + this._opt.cordovaConfig!.plugins!.join("|") + ")")}, () => {
447
+ onResolve({filter: new RegExp("(" + this.#opt.cordovaConfig!.plugins!.join("|") + ")")}, () => {
452
448
  return {
453
449
  path: `./cordova-empty.js`,
454
450
  external: true
@@ -461,18 +457,18 @@ export class SdNgBundler {
461
457
  // loadContent: () => ({
462
458
  // contents: `import "./src/polyfills.ts";`,
463
459
  // loader: 'js',
464
- // resolveDir: this._opt.pkgPath
460
+ // resolveDir: this.#opt.pkgPath
465
461
  // })
466
462
  // }) as esbuild.Plugin,
467
463
  createSourcemapIgnorelistPlugin(),
468
464
  sdNgPlugin({
469
465
  modifiedFileSet: this.#modifiedFileSet,
470
- dev: this._opt.dev,
471
- pkgPath: this._opt.pkgPath,
466
+ dev: this.#opt.dev,
467
+ pkgPath: this.#opt.pkgPath,
472
468
  result: this.#ngResultCache
473
469
  }),
474
470
  // createCompilerPlugin({
475
- // sourcemap: this._opt.dev,
471
+ // sourcemap: this.#opt.dev,
476
472
  // tsconfig: this._tsConfigFilePath,
477
473
  // jit: false,
478
474
  // advancedOptimizations: true,
@@ -480,11 +476,11 @@ export class SdNgBundler {
480
476
  // fileReplacements: undefined,
481
477
  // sourceFileCache: this._sourceFileCache,
482
478
  // loadResultCache: this._sourceFileCache.loadResultCache,
483
- // incremental: this._opt.dev
479
+ // incremental: this.#opt.dev
484
480
  // }, {
485
- // workspaceRoot: this._opt.pkgPath,
486
- // optimization: !this._opt.dev,
487
- // sourcemap: this._opt.dev ? 'inline' : false,
481
+ // workspaceRoot: this.#opt.pkgPath,
482
+ // optimization: !this.#opt.dev,
483
+ // sourcemap: this.#opt.dev ? 'inline' : false,
488
484
  // outputNames: {bundles: '[name]', media: 'media/[name]'},
489
485
  // includePaths: [],
490
486
  // externalDependencies: [],
@@ -510,33 +506,33 @@ export class SdNgBundler {
510
506
  private _getStyleContext(): SdNgBundlerContext {
511
507
  const pluginFactory = new StylesheetPluginFactory(
512
508
  {
513
- sourcemap: true, //this._opt.dev,
509
+ sourcemap: true, //this.#opt.dev,
514
510
  includePaths: []
515
511
  },
516
512
  this.#styleLoadResultCache,
517
513
  );
518
514
 
519
- return new SdNgBundlerContext(this._opt.pkgPath, {
520
- absWorkingDir: this._opt.pkgPath,
515
+ return new SdNgBundlerContext(this.#opt.pkgPath, {
516
+ absWorkingDir: this.#opt.pkgPath,
521
517
  bundle: true,
522
518
  entryNames: '[name]',
523
519
  assetNames: 'media/[name]',
524
520
  logLevel: 'silent',
525
- minify: !this._opt.dev,
521
+ minify: !this.#opt.dev,
526
522
  metafile: true,
527
- sourcemap: true, //this._opt.dev,
528
- outdir: this._opt.pkgPath,
523
+ sourcemap: true, //this.#opt.dev,
524
+ outdir: this.#opt.pkgPath,
529
525
  write: false,
530
526
  platform: 'browser',
531
- target: this._browserTarget,
527
+ target: this.#browserTarget,
532
528
  preserveSymlinks: false,
533
529
  external: [],
534
530
  conditions: ['style', 'sass'],
535
531
  mainFields: ['style', 'sass'],
536
- legalComments: !this._opt.dev ? "none" : "eof",
532
+ legalComments: !this.#opt.dev ? "none" : "eof",
537
533
  entryPoints: {
538
534
  // styles: 'angular:styles/global;styles'
539
- styles: path.resolve(this._opt.pkgPath, "src/styles.scss")
535
+ styles: path.resolve(this.#opt.pkgPath, "src/styles.scss")
540
536
  },
541
537
  plugins: [
542
538
  // createVirtualModulePlugin({
@@ -545,7 +541,7 @@ export class SdNgBundler {
545
541
  // loadContent: () => ({
546
542
  // contents: `@import 'src/styles.scss';`,
547
543
  // loader: 'css',
548
- // resolveDir: this._opt.pkgPath
544
+ // resolveDir: this.#opt.pkgPath
549
545
  // }),
550
546
  // }) as esbuild.Plugin,
551
547
  pluginFactory.create(SassStylesheetLanguage) as esbuild.Plugin,
@@ -556,36 +552,45 @@ export class SdNgBundler {
556
552
  }
557
553
 
558
554
  private _getElectronMainContext() {
559
- return new SdNgBundlerContext(this._opt.pkgPath, {
560
- absWorkingDir: this._opt.pkgPath,
555
+ return new SdNgBundlerContext(this.#opt.pkgPath, {
556
+ absWorkingDir: this.#opt.pkgPath,
561
557
  bundle: true,
562
558
  entryNames: '[name]',
563
559
  assetNames: 'media/[name]',
564
560
  conditions: ['es2020', 'es2015', 'module'],
565
561
  resolveExtensions: ['.ts', '.tsx', '.mjs', '.js'],
566
562
  metafile: true,
567
- legalComments: this._opt.dev ? 'eof' : 'none',
563
+ legalComments: this.#opt.dev ? 'eof' : 'none',
568
564
  logLevel: 'silent',
569
- minify: !this._opt.dev,
570
- outdir: this._opt.pkgPath,
571
- sourcemap: true, //this._opt.dev,
572
- tsconfig: this._tsConfigFilePath,
565
+ minify: !this.#opt.dev,
566
+ outdir: this.#opt.pkgPath,
567
+ sourcemap: true, //this.#opt.dev,
568
+ tsconfig: this.#tsConfigFilePath,
573
569
  write: false,
574
570
  preserveSymlinks: false,
575
571
  external: ["electron"],
576
572
  define: {
577
- ...!this._opt.dev ? {ngDevMode: 'false'} : {},
578
- 'process.env.SD_VERSION': JSON.stringify(this._pkgNpmConf.version),
579
- "process.env.NODE_ENV": JSON.stringify(this._opt.dev ? "development" : "production"),
580
- ...this._opt.env ? Object.keys(this._opt.env).toObject(
573
+ ...!this.#opt.dev ? {ngDevMode: 'false'} : {},
574
+ 'process.env.SD_VERSION': JSON.stringify(this.#pkgNpmConf.version),
575
+ "process.env.NODE_ENV": JSON.stringify(this.#opt.dev ? "development" : "production"),
576
+ ...this.#opt.env ? Object.keys(this.#opt.env).toObject(
581
577
  key => `process.env.${key}`,
582
- key => JSON.stringify(this._opt.env![key])
578
+ key => JSON.stringify(this.#opt.env![key])
583
579
  ) : {}
584
580
  },
585
581
  platform: 'node',
586
582
  entryPoints: {
587
- "electron-main": path.resolve(this._opt.pkgPath, "src/electron-main.ts"),
583
+ "electron-main": path.resolve(this.#opt.pkgPath, "src/electron-main.ts"),
588
584
  }
589
585
  });
590
586
  }
587
+ }
588
+
589
+ interface IOptions {
590
+ dev: boolean;
591
+ outputPath: string;
592
+ pkgPath: string;
593
+ builderType: string;
594
+ env: Record<string, string> | undefined;
595
+ cordovaConfig: ISdCliClientBuilderCordovaConfig | undefined;
591
596
  }