@simplysm/sd-cli 12.13.20 → 12.13.21

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 (29) hide show
  1. package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.d.ts +1 -0
  2. package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js +16 -11
  3. package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js.map +1 -1
  4. package/dist/pkg-builders/client/sd-client.build-runner.js +7 -17
  5. package/dist/pkg-builders/client/sd-client.build-runner.js.map +1 -1
  6. package/dist/pkg-builders/client/sd-ng.bundler.js +105 -95
  7. package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -1
  8. package/dist/pkg-builders/commons/build-runner.base.d.ts +2 -1
  9. package/dist/pkg-builders/commons/build-runner.base.js +16 -27
  10. package/dist/pkg-builders/commons/build-runner.base.js.map +1 -1
  11. package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.d.ts +1 -0
  12. package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.js +21 -11
  13. package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.js.map +1 -1
  14. package/dist/pkg-builders/lib/sd-cli-index.file-generator.d.ts +1 -0
  15. package/dist/pkg-builders/lib/sd-cli-index.file-generator.js +13 -10
  16. package/dist/pkg-builders/lib/sd-cli-index.file-generator.js.map +1 -1
  17. package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js +11 -30
  18. package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +1 -1
  19. package/dist/pkg-builders/server/sd-server.bundler.js +48 -37
  20. package/dist/pkg-builders/server/sd-server.bundler.js.map +1 -1
  21. package/package.json +5 -5
  22. package/src/pkg-builders/client/sd-cli-ng-routes.file-generator.ts +18 -8
  23. package/src/pkg-builders/client/sd-client.build-runner.ts +8 -19
  24. package/src/pkg-builders/client/sd-ng.bundler.ts +139 -121
  25. package/src/pkg-builders/commons/build-runner.base.ts +62 -75
  26. package/src/pkg-builders/lib/sd-cli-db-context.file-generator.ts +20 -8
  27. package/src/pkg-builders/lib/sd-cli-index.file-generator.ts +20 -9
  28. package/src/pkg-builders/lib/sd-ts-lib.build-runner.ts +11 -31
  29. package/src/pkg-builders/server/sd-server.bundler.ts +59 -48
@@ -120,63 +120,74 @@ const __dirname = __path__.dirname(__filename);`.trim(),
120
120
  });
121
121
  }
122
122
 
123
- const emitFileSet = new Set<TNormPath>();
124
123
  let result: esbuild.BuildResult | esbuild.BuildFailure;
125
- try {
126
- result = await this.#context.rebuild();
124
+ result = await this.#context.rebuild();
127
125
 
128
- const outputFiles: BuildOutputFile[] =
129
- result.outputFiles?.map((file) => convertOutputFile(file, BuildOutputFileType.Root)) ?? [];
126
+ if (this._opt.noEmit) {
127
+ return {
128
+ watchFileSet: this.#resultCache.watchFileSet!,
129
+ affectedFileSet: this.#resultCache.affectedFileSet!,
130
+ results: [],
131
+ emitFileSet: new Set<TNormPath>(),
132
+ };
133
+ } else {
134
+ const emitFileSet = new Set<TNormPath>();
130
135
 
131
- for (const outputFile of outputFiles) {
132
- const distFilePath = PathUtils.norm(this._opt.pkgPath, outputFile.path);
133
- const prevHash = this.#outputHashCache.get(distFilePath);
134
- const currHash = HashUtils.get(Buffer.from(outputFile.contents));
135
- if (prevHash !== currHash) {
136
- FsUtils.writeFile(distFilePath, outputFile.contents);
137
- this.#outputHashCache.set(distFilePath, currHash);
138
- emitFileSet.add(distFilePath);
136
+ try {
137
+ const outputFiles: BuildOutputFile[] =
138
+ result.outputFiles?.map((file) => convertOutputFile(file, BuildOutputFileType.Root)) ??
139
+ [];
140
+
141
+ for (const outputFile of outputFiles) {
142
+ const distFilePath = PathUtils.norm(this._opt.pkgPath, outputFile.path);
143
+ const prevHash = this.#outputHashCache.get(distFilePath);
144
+ const currHash = HashUtils.get(Buffer.from(outputFile.contents));
145
+ if (prevHash !== currHash) {
146
+ FsUtils.writeFile(distFilePath, outputFile.contents);
147
+ this.#outputHashCache.set(distFilePath, currHash);
148
+ emitFileSet.add(distFilePath);
149
+ }
139
150
  }
140
- }
141
151
 
142
- //-- copy assets
143
- const assetFiles = await resolveAssets(
144
- [
145
- { input: "public", glob: "**/*", output: "." },
146
- ...(this._opt.dev ? [{ input: "public-dev", glob: "**/*", output: "." }] : []),
147
- ],
148
- this._opt.pkgPath,
149
- );
152
+ //-- copy assets
153
+ const assetFiles = await resolveAssets(
154
+ [
155
+ { input: "public", glob: "**/*", output: "." },
156
+ ...(this._opt.dev ? [{ input: "public-dev", glob: "**/*", output: "." }] : []),
157
+ ],
158
+ this._opt.pkgPath,
159
+ );
150
160
 
151
- for (const assetFile of assetFiles) {
152
- const prevHash = this.#outputHashCache.get(PathUtils.norm(assetFile.source));
153
- const currHash = HashUtils.get(FsUtils.readFileBuffer(assetFile.source));
154
- if (prevHash !== currHash) {
155
- FsUtils.copy(
156
- assetFile.source,
157
- path.resolve(this._opt.pkgPath, "dist", assetFile.destination),
158
- );
159
- this.#outputHashCache.set(PathUtils.norm(assetFile.source), currHash);
160
- emitFileSet.add(PathUtils.norm(this._opt.pkgPath, "dist", assetFile.destination));
161
+ for (const assetFile of assetFiles) {
162
+ const prevHash = this.#outputHashCache.get(PathUtils.norm(assetFile.source));
163
+ const currHash = HashUtils.get(FsUtils.readFileBuffer(assetFile.source));
164
+ if (prevHash !== currHash) {
165
+ FsUtils.copy(
166
+ assetFile.source,
167
+ path.resolve(this._opt.pkgPath, "dist", assetFile.destination),
168
+ );
169
+ this.#outputHashCache.set(PathUtils.norm(assetFile.source), currHash);
170
+ emitFileSet.add(PathUtils.norm(this._opt.pkgPath, "dist", assetFile.destination));
171
+ }
161
172
  }
162
- }
163
- } catch (err) {
164
- result = err;
165
- for (const e of err.errors) {
166
- if (e.detail != null) {
167
- this.#logger.error(e.detail);
173
+ } catch (err) {
174
+ result = err;
175
+ for (const e of err.errors) {
176
+ if (e.detail != null) {
177
+ this.#logger.error(e.detail);
178
+ }
168
179
  }
169
180
  }
170
- }
171
181
 
172
- return {
173
- watchFileSet: this.#resultCache.watchFileSet!,
174
- affectedFileSet: this.#resultCache.affectedFileSet!,
175
- results: SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(
176
- result,
177
- this._opt.pkgPath,
178
- ),
179
- emitFileSet: emitFileSet,
180
- };
182
+ return {
183
+ watchFileSet: this.#resultCache.watchFileSet!,
184
+ affectedFileSet: this.#resultCache.affectedFileSet!,
185
+ results: SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(
186
+ result,
187
+ this._opt.pkgPath,
188
+ ),
189
+ emitFileSet: emitFileSet,
190
+ };
191
+ }
181
192
  }
182
193
  }