@simplysm/sd-cli 12.8.20 → 12.8.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 (40) hide show
  1. package/dist/entry/sd-cli-cordova.d.ts +30 -0
  2. package/dist/entry/sd-cli-cordova.js +307 -246
  3. package/dist/entry/sd-cli-cordova.js.map +1 -1
  4. package/dist/entry/sd-cli-project.d.ts +1 -1
  5. package/dist/entry/sd-cli-project.js +8 -9
  6. package/dist/entry/sd-cli-project.js.map +1 -1
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +1 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/pkg-builders/client/sd-ng.bundler.d.ts +15 -1
  11. package/dist/pkg-builders/client/sd-ng.bundler.js +60 -70
  12. package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -1
  13. package/dist/pkg-builders/client/sd-ng.plugin-creator.js +49 -29
  14. package/dist/pkg-builders/client/sd-ng.plugin-creator.js.map +1 -1
  15. package/dist/pkg-builders/lib/sd-ts-lib.builder.js +7 -4
  16. package/dist/pkg-builders/lib/sd-ts-lib.builder.js.map +1 -1
  17. package/dist/pkg-builders/server/sd-server.bundler.js +11 -10
  18. package/dist/pkg-builders/server/sd-server.bundler.js.map +1 -1
  19. package/dist/ts-compiler/sd-ts-compiler.d.ts +25 -2
  20. package/dist/ts-compiler/sd-ts-compiler.js +306 -575
  21. package/dist/ts-compiler/sd-ts-compiler.js.map +1 -1
  22. package/dist/ts-compiler/sd-ts-dependency-analyzer.d.ts +6 -0
  23. package/dist/ts-compiler/sd-ts-dependency-analyzer.js +141 -0
  24. package/dist/ts-compiler/sd-ts-dependency-analyzer.js.map +1 -0
  25. package/dist/types/ts-compiler.types.d.ts +12 -7
  26. package/dist/types/worker.types.d.ts +13 -0
  27. package/dist/utils/sd-cli-performance-time.js +1 -1
  28. package/package.json +6 -8
  29. package/src/entry/sd-cli-cordova.ts +393 -280
  30. package/src/entry/sd-cli-project.ts +11 -23
  31. package/src/index.ts +1 -0
  32. package/src/pkg-builders/client/sd-ng.bundler.ts +67 -69
  33. package/src/pkg-builders/client/sd-ng.plugin-creator.ts +47 -27
  34. package/src/pkg-builders/lib/sd-ts-lib.builder.ts +14 -7
  35. package/src/pkg-builders/server/sd-server.bundler.ts +22 -12
  36. package/src/ts-compiler/sd-ts-compiler.ts +379 -704
  37. package/src/ts-compiler/sd-ts-dependency-analyzer.ts +185 -0
  38. package/src/types/ts-compiler.types.ts +11 -6
  39. package/src/types/worker.types.ts +7 -6
  40. package/src/utils/sd-cli-performance-time.ts +1 -1
@@ -1,11 +1,14 @@
1
1
  import esbuild from "esbuild";
2
2
  import path from "path";
3
- import { FsUtils, SdLogger, PathUtils, TNormPath } from "@simplysm/sd-core-node";
3
+ import { FsUtils, HashUtils, PathUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
4
4
  import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
5
5
  import { ISdCliServerPluginResultCache } from "../../types/build-plugin.types";
6
6
  import { ISdBuildMessage } from "../../types/build.types";
7
7
  import { createSdServerPlugin } from "./sd-server.plugin-creator";
8
- import { BuildOutputFile, BuildOutputFileType } from "@angular/build/src/tools/esbuild/bundler-context";
8
+ import {
9
+ BuildOutputFile,
10
+ BuildOutputFileType,
11
+ } from "@angular/build/src/tools/esbuild/bundler-context";
9
12
  import { convertOutputFile } from "@angular/build/src/tools/esbuild/utils";
10
13
  import { resolveAssets } from "@angular/build/src/utils/resolve-assets";
11
14
 
@@ -17,7 +20,7 @@ export class SdServerBundler {
17
20
  readonly #modifiedFileSet = new Set<TNormPath>();
18
21
  readonly #resultCache: ISdCliServerPluginResultCache = {};
19
22
 
20
- readonly #outputCache = new Map<TNormPath, string | number>();
23
+ readonly #outputHashCache = new Map<TNormPath, string>();
21
24
 
22
25
  constructor(
23
26
  private readonly _opt: {
@@ -123,10 +126,11 @@ const __dirname = __path__.dirname(__filename);`.trim(),
123
126
 
124
127
  for (const outputFile of outputFiles) {
125
128
  const distFilePath = PathUtils.norm(this._opt.pkgPath, outputFile.path);
126
- const prev = this.#outputCache.get(distFilePath);
127
- if (prev !== Buffer.from(outputFile.contents).toString("base64")) {
129
+ const prevHash = this.#outputHashCache.get(distFilePath);
130
+ const currHash = HashUtils.get(outputFile.contents);
131
+ if (prevHash !== currHash) {
128
132
  FsUtils.writeFile(distFilePath, outputFile.contents);
129
- this.#outputCache.set(distFilePath, Buffer.from(outputFile.contents).toString("base64"));
133
+ this.#outputHashCache.set(distFilePath, currHash);
130
134
  emitFileSet.add(distFilePath);
131
135
  }
132
136
  }
@@ -141,11 +145,14 @@ const __dirname = __path__.dirname(__filename);`.trim(),
141
145
  );
142
146
 
143
147
  for (const assetFile of assetFiles) {
144
- const prev = this.#outputCache.get(PathUtils.norm(assetFile.source));
145
- const curr = FsUtils.lstat(assetFile.source).mtime.getTime();
146
- if (prev !== curr) {
147
- FsUtils.copy(assetFile.source, path.resolve(this._opt.pkgPath, "dist", assetFile.destination));
148
- this.#outputCache.set(PathUtils.norm(assetFile.source), curr);
148
+ const prevHash = this.#outputHashCache.get(PathUtils.norm(assetFile.source));
149
+ const currHash = FsUtils.hash(assetFile.source);
150
+ if (prevHash !== currHash) {
151
+ FsUtils.copy(
152
+ assetFile.source,
153
+ path.resolve(this._opt.pkgPath, "dist", assetFile.destination),
154
+ );
155
+ this.#outputHashCache.set(PathUtils.norm(assetFile.source), currHash);
149
156
  emitFileSet.add(PathUtils.norm(assetFile.destination));
150
157
  }
151
158
  }
@@ -162,7 +169,10 @@ const __dirname = __path__.dirname(__filename);`.trim(),
162
169
  return {
163
170
  watchFileSet: this.#resultCache.watchFileSet!,
164
171
  affectedFileSet: this.#resultCache.affectedFileSet!,
165
- results: SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(result, this._opt.pkgPath),
172
+ results: SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(
173
+ result,
174
+ this._opt.pkgPath,
175
+ ),
166
176
  emitFileSet: emitFileSet,
167
177
  };
168
178
  }