@simplysm/sd-cli 12.7.5 → 12.7.6
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/dist/entry/{SdAiCommand.d.ts → sd-cli-ai-command.d.ts} +1 -1
- package/dist/entry/{SdAiCommand.js → sd-cli-ai-command.js} +5 -5
- package/dist/entry/sd-cli-ai-command.js.map +1 -0
- package/dist/entry/{SdCliCordova.d.ts → sd-cli-cordova.d.ts} +1 -1
- package/dist/entry/{SdCliCordova.js → sd-cli-cordova.js} +33 -33
- package/dist/entry/sd-cli-cordova.js.map +1 -0
- package/dist/entry/{SdCliElectron.d.ts → sd-cli-electron.d.ts} +1 -1
- package/dist/entry/{SdCliElectron.js → sd-cli-electron.js} +18 -18
- package/dist/entry/sd-cli-electron.js.map +1 -0
- package/dist/entry/{SdCliLocalUpdate.js → sd-cli-local-update.js} +12 -12
- package/dist/entry/sd-cli-local-update.js.map +1 -0
- package/dist/entry/{SdCliProject.js → sd-cli-project.js} +36 -36
- package/dist/entry/sd-cli-project.js.map +1 -0
- package/dist/index.d.ts +30 -30
- package/dist/index.js +30 -30
- package/dist/index.js.map +1 -1
- package/dist/pkg-builders/client/{SdCliNgRoutesFileGenerator.js → sd-cli-ng-routes.file-generator.js} +12 -12
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js.map +1 -0
- package/dist/pkg-builders/client/{SdClientBuildRunner.d.ts → sd-client.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/client/{SdClientBuildRunner.js → sd-client.build-runner.js} +34 -27
- package/dist/pkg-builders/client/sd-client.build-runner.js.map +1 -0
- package/dist/pkg-builders/client/{SdNgBundlerContext.js → sd-ng.bundler-context.js} +5 -5
- package/dist/pkg-builders/client/sd-ng.bundler-context.js.map +1 -0
- package/dist/pkg-builders/client/{SdNgBundler.d.ts → sd-ng.bundler.d.ts} +2 -2
- package/dist/pkg-builders/client/{SdNgBundler.js → sd-ng.bundler.js} +55 -37
- package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -0
- package/dist/pkg-builders/client/{createSdNgPlugin.d.ts → sd-ng.plugin-creator.d.ts} +1 -1
- package/dist/pkg-builders/client/{createSdNgPlugin.js → sd-ng.plugin-creator.js} +17 -17
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js.map +1 -0
- package/dist/pkg-builders/lib/{SdCliIndexFileGenerator.js → sd-cli-index.file-generator.js} +8 -8
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.js.map +1 -0
- package/dist/pkg-builders/lib/{SdJsLibBuildRunner.d.ts → sd-js-lib.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/lib/{SdJsLibBuildRunner.js → sd-js-lib.build-runner.js} +17 -17
- package/dist/pkg-builders/lib/sd-js-lib.build-runner.js.map +1 -0
- package/dist/pkg-builders/lib/{SdTsLibBuildRunner.d.ts → sd-ts-lib.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/lib/{SdTsLibBuildRunner.js → sd-ts-lib.build-runner.js} +17 -17
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +1 -0
- package/dist/pkg-builders/lib/{SdTsLibBuilder.d.ts → sd-ts-lib.builder.d.ts} +1 -1
- package/dist/pkg-builders/lib/{SdTsLibBuilder.js → sd-ts-lib.builder.js} +11 -11
- package/dist/pkg-builders/lib/sd-ts-lib.builder.js.map +1 -0
- package/dist/pkg-builders/{SdMultiBuildRunner.d.ts → sd-multi.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/{SdMultiBuildRunner.js → sd-multi.build-runner.js} +13 -13
- package/dist/pkg-builders/sd-multi.build-runner.js.map +1 -0
- package/dist/pkg-builders/server/{SdServerBuildRunner.d.ts → sd-server.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/server/{SdServerBuildRunner.js → sd-server.build-runner.js} +35 -35
- package/dist/pkg-builders/server/sd-server.build-runner.js.map +1 -0
- package/dist/pkg-builders/server/{SdServerBundler.d.ts → sd-server.bundler.d.ts} +1 -1
- package/dist/pkg-builders/server/{SdServerBundler.js → sd-server.bundler.js} +15 -15
- package/dist/pkg-builders/server/sd-server.bundler.js.map +1 -0
- package/dist/pkg-builders/server/{createSdServerPlugin.d.ts → sd-server.plugin-creator.d.ts} +1 -1
- package/dist/pkg-builders/server/{createSdServerPlugin.js → sd-server.plugin-creator.js} +10 -10
- package/dist/pkg-builders/server/sd-server.plugin-creator.js.map +1 -0
- package/dist/sd-cli.js +10 -10
- package/dist/sd-cli.js.map +1 -1
- package/dist/{ts-builder/SdTsCompiler.d.ts → ts-compiler/sd-ts-compiler.d.ts} +1 -1
- package/dist/{ts-builder/SdTsCompiler.js → ts-compiler/sd-ts-compiler.js} +60 -60
- package/dist/ts-compiler/sd-ts-compiler.js.map +1 -0
- package/dist/types/{build-plugin.type.js → build-plugin.types.js} +1 -1
- package/dist/types/build-plugin.types.js.map +1 -0
- package/dist/types/{build-runner.type.d.ts → build-runner.types.d.ts} +1 -1
- package/dist/types/build-runner.types.js +3 -0
- package/dist/types/build-runner.types.js.map +1 -0
- package/dist/types/{build.type.js → build.types.js} +1 -1
- package/dist/types/build.types.js.map +1 -0
- package/dist/types/common-configs.types.js +2 -0
- package/dist/types/common-configs.types.js.map +1 -0
- package/dist/types/config.types.js +2 -0
- package/dist/types/config.types.js.map +1 -0
- package/dist/types/{ts-compiler.type.d.ts → ts-compiler.types.d.ts} +1 -1
- package/dist/types/{ts-compiler.type.js → ts-compiler.types.js} +2 -2
- package/dist/types/ts-compiler.types.js.map +1 -0
- package/dist/types/{workers.type.d.ts → worker.types.d.ts} +2 -2
- package/dist/types/worker.types.js +3 -0
- package/dist/types/worker.types.js.map +1 -0
- package/dist/utils/{SdCliConvertMessageUtil.d.ts → sd-cli-convert-message.utils.d.ts} +2 -2
- package/dist/utils/{SdCliConvertMessageUtil.js → sd-cli-convert-message.utils.js} +7 -7
- package/dist/utils/sd-cli-convert-message.utils.js.map +1 -0
- package/dist/utils/{SdCliPerformanceTime.js → sd-cli-performance-time.js} +1 -1
- package/dist/utils/sd-cli-performance-time.js.map +1 -0
- package/dist/workers/{build-runner-worker.js → build-runner.worker.js} +13 -13
- package/dist/workers/build-runner.worker.js.map +1 -0
- package/dist/workers/{server-worker.js → server.worker.js} +6 -6
- package/dist/workers/server.worker.js.map +1 -0
- package/package.json +5 -5
- package/src/entry/{SdAiCommand.ts → sd-cli-ai-command.ts} +4 -4
- package/src/entry/{SdCliCordova.ts → sd-cli-cordova.ts} +32 -32
- package/src/entry/{SdCliElectron.ts → sd-cli-electron.ts} +17 -17
- package/src/entry/{SdCliLocalUpdate.ts → sd-cli-local-update.ts} +11 -11
- package/src/entry/{SdCliProject.ts → sd-cli-project.ts} +36 -36
- package/src/index.ts +30 -30
- package/src/pkg-builders/client/{SdCliNgRoutesFileGenerator.ts → sd-cli-ng-routes.file-generator.ts} +11 -11
- package/src/pkg-builders/client/{SdClientBuildRunner.ts → sd-client.build-runner.ts} +52 -45
- package/src/pkg-builders/client/{SdNgBundlerContext.ts → sd-ng.bundler-context.ts} +4 -4
- package/src/pkg-builders/client/{SdNgBundler.ts → sd-ng.bundler.ts} +94 -61
- package/src/pkg-builders/client/{createSdNgPlugin.ts → sd-ng.plugin-creator.ts} +16 -16
- package/src/pkg-builders/lib/{SdCliIndexFileGenerator.ts → sd-cli-index.file-generator.ts} +7 -7
- package/src/pkg-builders/lib/{SdJsLibBuildRunner.ts → sd-js-lib.build-runner.ts} +16 -16
- package/src/pkg-builders/lib/{SdTsLibBuildRunner.ts → sd-ts-lib.build-runner.ts} +17 -17
- package/src/pkg-builders/lib/{SdTsLibBuilder.ts → sd-ts-lib.builder.ts} +10 -10
- package/src/pkg-builders/{SdMultiBuildRunner.ts → sd-multi.build-runner.ts} +12 -12
- package/src/pkg-builders/server/{SdServerBuildRunner.ts → sd-server.build-runner.ts} +34 -34
- package/src/pkg-builders/server/{SdServerBundler.ts → sd-server.bundler.ts} +14 -14
- package/src/pkg-builders/server/{createSdServerPlugin.ts → sd-server.plugin-creator.ts} +9 -9
- package/src/sd-cli.ts +10 -10
- package/src/{ts-builder/SdTsCompiler.ts → ts-compiler/sd-ts-compiler.ts} +60 -60
- package/src/types/{build-runner.type.ts → build-runner.types.ts} +1 -1
- package/src/types/{ts-compiler.type.ts → ts-compiler.types.ts} +1 -1
- package/src/types/{workers.type.ts → worker.types.ts} +2 -2
- package/src/utils/{SdCliConvertMessageUtil.ts → sd-cli-convert-message.utils.ts} +6 -6
- package/src/workers/{build-runner-worker.ts → build-runner.worker.ts} +12 -12
- package/src/workers/{server-worker.ts → server.worker.ts} +5 -5
- package/dist/entry/SdAiCommand.js.map +0 -1
- package/dist/entry/SdCliCordova.js.map +0 -1
- package/dist/entry/SdCliElectron.js.map +0 -1
- package/dist/entry/SdCliLocalUpdate.js.map +0 -1
- package/dist/entry/SdCliProject.js.map +0 -1
- package/dist/pkg-builders/SdMultiBuildRunner.js.map +0 -1
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js.map +0 -1
- package/dist/pkg-builders/client/SdClientBuildRunner.js.map +0 -1
- package/dist/pkg-builders/client/SdNgBundler.js.map +0 -1
- package/dist/pkg-builders/client/SdNgBundlerContext.js.map +0 -1
- package/dist/pkg-builders/client/createSdNgPlugin.js.map +0 -1
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js.map +0 -1
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js.map +0 -1
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +0 -1
- package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +0 -1
- package/dist/pkg-builders/server/SdServerBuildRunner.js.map +0 -1
- package/dist/pkg-builders/server/SdServerBundler.js.map +0 -1
- package/dist/pkg-builders/server/createSdServerPlugin.js.map +0 -1
- package/dist/ts-builder/SdTsCompiler.js.map +0 -1
- package/dist/types/build-plugin.type.js.map +0 -1
- package/dist/types/build-runner.type.js +0 -3
- package/dist/types/build-runner.type.js.map +0 -1
- package/dist/types/build.type.js.map +0 -1
- package/dist/types/common-configs.type.js +0 -2
- package/dist/types/common-configs.type.js.map +0 -1
- package/dist/types/sd-configs.type.js +0 -2
- package/dist/types/sd-configs.type.js.map +0 -1
- package/dist/types/ts-compiler.type.js.map +0 -1
- package/dist/types/workers.type.js +0 -3
- package/dist/types/workers.type.js.map +0 -1
- package/dist/utils/SdCliConvertMessageUtil.js.map +0 -1
- package/dist/utils/SdCliPerformanceTime.js.map +0 -1
- package/dist/workers/build-runner-worker.js.map +0 -1
- package/dist/workers/server-worker.js.map +0 -1
- /package/dist/entry/{SdCliLocalUpdate.d.ts → sd-cli-local-update.d.ts} +0 -0
- /package/dist/entry/{SdCliProject.d.ts → sd-cli-project.d.ts} +0 -0
- /package/dist/pkg-builders/client/{SdCliNgRoutesFileGenerator.d.ts → sd-cli-ng-routes.file-generator.d.ts} +0 -0
- /package/dist/pkg-builders/client/{SdNgBundlerContext.d.ts → sd-ng.bundler-context.d.ts} +0 -0
- /package/dist/pkg-builders/lib/{SdCliIndexFileGenerator.d.ts → sd-cli-index.file-generator.d.ts} +0 -0
- /package/dist/types/{build-plugin.type.d.ts → build-plugin.types.d.ts} +0 -0
- /package/dist/types/{build.type.d.ts → build.types.d.ts} +0 -0
- /package/dist/types/{common-configs.type.d.ts → common-configs.types.d.ts} +0 -0
- /package/dist/types/{sd-configs.type.d.ts → config.types.d.ts} +0 -0
- /package/dist/utils/{SdCliPerformanceTime.d.ts → sd-cli-performance-time.d.ts} +0 -0
- /package/dist/workers/{build-runner-worker.d.ts → build-runner.worker.d.ts} +0 -0
- /package/dist/workers/{server-worker.d.ts → server.worker.d.ts} +0 -0
- /package/src/types/{build-plugin.type.ts → build-plugin.types.ts} +0 -0
- /package/src/types/{build.type.ts → build.types.ts} +0 -0
- /package/src/types/{common-configs.type.ts → common-configs.types.ts} +0 -0
- /package/src/types/{sd-configs.type.ts → config.types.ts} +0 -0
- /package/src/utils/{SdCliPerformanceTime.ts → sd-cli-performance-time.ts} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import esbuild, { type Metafile } from "esbuild";
|
|
3
|
-
import {
|
|
3
|
+
import { FsUtils, PathUtils, SdLogger, type TNormPath } from "@simplysm/sd-core-node";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
import nodeStdLibBrowser from "node-stdlib-browser";
|
|
6
6
|
import nodeStdLibBrowserPlugin from "node-stdlib-browser/helpers/esbuild/plugin";
|
|
7
7
|
import browserslist from "browserslist";
|
|
8
|
-
import { SdNgBundlerContext } from "./
|
|
8
|
+
import { SdNgBundlerContext } from "./sd-ng.bundler-context";
|
|
9
9
|
import { MemoryLoadResultCache } from "@angular/build/src/tools/esbuild/load-result-cache";
|
|
10
10
|
import {
|
|
11
11
|
convertOutputFile,
|
|
@@ -26,22 +26,28 @@ import {
|
|
|
26
26
|
import { type Entrypoint } from "@angular/build/src/utils/index-file/augment-index-html";
|
|
27
27
|
import { CrossOrigin } from "@angular/build/src/builders/application/schema";
|
|
28
28
|
import { augmentAppWithServiceWorkerEsbuild } from "@angular/build/src/utils/service-worker";
|
|
29
|
-
import {
|
|
30
|
-
|
|
29
|
+
import {
|
|
30
|
+
createSourcemapIgnorelistPlugin,
|
|
31
|
+
} from "@angular/build/src/tools/esbuild/sourcemap-ignorelist-plugin";
|
|
32
|
+
import {
|
|
33
|
+
StylesheetPluginFactory,
|
|
34
|
+
} from "@angular/build/src/tools/esbuild/stylesheets/stylesheet-plugin-factory";
|
|
31
35
|
import { SassStylesheetLanguage } from "@angular/build/src/tools/esbuild/stylesheets/sass-language";
|
|
32
36
|
import { CssStylesheetLanguage } from "@angular/build/src/tools/esbuild/stylesheets/css-language";
|
|
33
|
-
import {
|
|
37
|
+
import {
|
|
38
|
+
createCssResourcePlugin,
|
|
39
|
+
} from "@angular/build/src/tools/esbuild/stylesheets/css-resource-plugin";
|
|
34
40
|
import { resolveAssets } from "@angular/build/src/utils/resolve-assets";
|
|
35
|
-
import { createSdNgPlugin } from "./
|
|
36
|
-
import { SdCliPerformanceTimer } from "../../utils/
|
|
37
|
-
import { type INpmConfig } from "../../types/common-configs.
|
|
38
|
-
import { type ISdClientBuilderCordovaConfig } from "../../types/
|
|
39
|
-
import { type ISdCliNgPluginResultCache } from "../../types/build-plugin.
|
|
40
|
-
import { type ISdBuildMessage } from "../../types/build.
|
|
41
|
+
import { createSdNgPlugin } from "./sd-ng.plugin-creator";
|
|
42
|
+
import { SdCliPerformanceTimer } from "../../utils/sd-cli-performance-time";
|
|
43
|
+
import { type INpmConfig } from "../../types/common-configs.types";
|
|
44
|
+
import { type ISdClientBuilderCordovaConfig } from "../../types/config.types";
|
|
45
|
+
import { type ISdCliNgPluginResultCache } from "../../types/build-plugin.types";
|
|
46
|
+
import { type ISdBuildMessage } from "../../types/build.types";
|
|
41
47
|
import nodeModule from "node:module";
|
|
42
48
|
|
|
43
49
|
export class SdNgBundler {
|
|
44
|
-
readonly #logger =
|
|
50
|
+
readonly #logger = SdLogger.get(["simplysm", "sd-cli", "SdNgBundler"]);
|
|
45
51
|
|
|
46
52
|
readonly #modifiedFileSet = new Set<TNormPath>();
|
|
47
53
|
readonly #ngResultCache: ISdCliNgPluginResultCache = {
|
|
@@ -75,7 +81,7 @@ export class SdNgBundler {
|
|
|
75
81
|
watchScopePaths: TNormPath[];
|
|
76
82
|
},
|
|
77
83
|
) {
|
|
78
|
-
this.#pkgNpmConf =
|
|
84
|
+
this.#pkgNpmConf = FsUtils.readJson(path.resolve(this._opt.pkgPath, "package.json"));
|
|
79
85
|
this.#mainFilePath = path.resolve(this._opt.pkgPath, "src/main.ts");
|
|
80
86
|
this.#tsConfigFilePath = path.resolve(this._opt.pkgPath, "tsconfig.json");
|
|
81
87
|
this.#swConfFilePath = path.resolve(this._opt.pkgPath, "ngsw-config.json");
|
|
@@ -92,8 +98,8 @@ export class SdNgBundler {
|
|
|
92
98
|
|
|
93
99
|
public markForChanges(filePaths: string[]): void {
|
|
94
100
|
for (const filePath of filePaths) {
|
|
95
|
-
this.#modifiedFileSet.add(
|
|
96
|
-
this.#styleLoadResultCache.invalidate(
|
|
101
|
+
this.#modifiedFileSet.add(PathUtils.norm(filePath));
|
|
102
|
+
this.#styleLoadResultCache.invalidate(PathUtils.norm(filePath));
|
|
97
103
|
}
|
|
98
104
|
// this._sourceFileCache.invalidate(filePaths);
|
|
99
105
|
}
|
|
@@ -128,7 +134,8 @@ export class SdNgBundler {
|
|
|
128
134
|
this.#debug(`convert result...`);
|
|
129
135
|
|
|
130
136
|
const outputFiles: BuildOutputFile[] = bundlingResults.mapMany(
|
|
131
|
-
(item) => item.outputFiles?.map((file) => convertOutputFile(file, BuildOutputFileType.Root))
|
|
137
|
+
(item) => item.outputFiles?.map((file) => convertOutputFile(file, BuildOutputFileType.Root))
|
|
138
|
+
?? [],
|
|
132
139
|
);
|
|
133
140
|
const initialFiles = new Map<string, InitialFileRecord>();
|
|
134
141
|
const metafile: {
|
|
@@ -175,7 +182,11 @@ export class SdNgBundler {
|
|
|
175
182
|
type: "gen-index",
|
|
176
183
|
});
|
|
177
184
|
}
|
|
178
|
-
outputFiles.push(createOutputFile(
|
|
185
|
+
outputFiles.push(createOutputFile(
|
|
186
|
+
"index.html",
|
|
187
|
+
genIndexHtmlResult.csrContent,
|
|
188
|
+
BuildOutputFileType.Root,
|
|
189
|
+
));
|
|
179
190
|
});
|
|
180
191
|
|
|
181
192
|
await perf.run("assets", async () => {
|
|
@@ -195,13 +206,17 @@ export class SdNgBundler {
|
|
|
195
206
|
});
|
|
196
207
|
|
|
197
208
|
//-- service worker
|
|
198
|
-
if (
|
|
209
|
+
if (FsUtils.exists(this.#swConfFilePath)) {
|
|
199
210
|
this.#debug(`prepare service worker...`);
|
|
200
211
|
|
|
201
212
|
await perf.run("prepare service worker", async () => {
|
|
202
213
|
try {
|
|
203
214
|
const serviceWorkerResult = await this._genServiceWorkerAsync(outputFiles, assetFiles);
|
|
204
|
-
outputFiles.push(createOutputFile(
|
|
215
|
+
outputFiles.push(createOutputFile(
|
|
216
|
+
"ngsw.json",
|
|
217
|
+
serviceWorkerResult.manifest,
|
|
218
|
+
BuildOutputFileType.Root,
|
|
219
|
+
));
|
|
205
220
|
assetFiles.push(...serviceWorkerResult.assetFiles);
|
|
206
221
|
}
|
|
207
222
|
catch (err) {
|
|
@@ -224,21 +239,21 @@ export class SdNgBundler {
|
|
|
224
239
|
const emitFileSet = new Set<TNormPath>();
|
|
225
240
|
perf.run("write output file", () => {
|
|
226
241
|
for (const outputFile of outputFiles) {
|
|
227
|
-
const distFilePath =
|
|
242
|
+
const distFilePath = PathUtils.norm(this._opt.outputPath, outputFile.path);
|
|
228
243
|
const prev = this.#outputCache.get(distFilePath);
|
|
229
244
|
if (prev !== Buffer.from(outputFile.contents).toString("base64")) {
|
|
230
|
-
|
|
245
|
+
FsUtils.writeFile(distFilePath, outputFile.contents);
|
|
231
246
|
this.#outputCache.set(distFilePath, Buffer.from(outputFile.contents).toString("base64"));
|
|
232
|
-
emitFileSet.add(
|
|
247
|
+
emitFileSet.add(PathUtils.norm(outputFile.path));
|
|
233
248
|
}
|
|
234
249
|
}
|
|
235
250
|
for (const assetFile of assetFiles) {
|
|
236
|
-
const prev = this.#outputCache.get(
|
|
237
|
-
const curr =
|
|
251
|
+
const prev = this.#outputCache.get(PathUtils.norm(assetFile.source));
|
|
252
|
+
const curr = FsUtils.lstat(assetFile.source).mtime.getTime();
|
|
238
253
|
if (prev !== curr) {
|
|
239
|
-
|
|
240
|
-
this.#outputCache.set(
|
|
241
|
-
emitFileSet.add(
|
|
254
|
+
FsUtils.copy(assetFile.source, path.resolve(this._opt.outputPath, assetFile.destination));
|
|
255
|
+
this.#outputCache.set(PathUtils.norm(assetFile.source), curr);
|
|
256
|
+
emitFileSet.add(PathUtils.norm(assetFile.destination));
|
|
242
257
|
}
|
|
243
258
|
}
|
|
244
259
|
});
|
|
@@ -248,9 +263,9 @@ export class SdNgBundler {
|
|
|
248
263
|
return {
|
|
249
264
|
watchFileSet: new Set([
|
|
250
265
|
...this.#ngResultCache.watchFileSet!,
|
|
251
|
-
...this.#styleLoadResultCache.watchFiles.map((item) =>
|
|
252
|
-
...assetFiles.map((item) =>
|
|
253
|
-
|
|
266
|
+
...this.#styleLoadResultCache.watchFiles.map((item) => PathUtils.norm(item)),
|
|
267
|
+
...assetFiles.map((item) => PathUtils.norm(item.source)),
|
|
268
|
+
PathUtils.norm(this.#indexHtmlFilePath),
|
|
254
269
|
]),
|
|
255
270
|
affectedFileSet: this.#ngResultCache.affectedFileSet!,
|
|
256
271
|
results,
|
|
@@ -339,28 +354,29 @@ export class SdNgBundler {
|
|
|
339
354
|
{ input: "public", glob: "**/*", output: "." },
|
|
340
355
|
...(this._opt.dev ? [{ input: "public-dev", glob: "**/*", output: "." }] : []),
|
|
341
356
|
...(this._opt.dev && this._opt.builderType === "cordova"
|
|
342
|
-
? Object.keys(this._opt.cordovaConfig?.platform ?? { browser: {} })
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
357
|
+
? Object.keys(this._opt.cordovaConfig?.platform ?? { browser: {} })
|
|
358
|
+
.mapMany((platform) => [
|
|
359
|
+
{
|
|
360
|
+
input: `.cordova/platforms/${platform}/platform_www/plugins`,
|
|
361
|
+
glob: "**/*",
|
|
362
|
+
output: `cordova-${platform}/plugins`,
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
input: `.cordova/platforms/${platform}/platform_www`,
|
|
366
|
+
glob: "cordova.js",
|
|
367
|
+
output: `cordova-${platform}`,
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
input: `.cordova/platforms/${platform}/platform_www`,
|
|
371
|
+
glob: "cordova_plugins.js",
|
|
372
|
+
output: `cordova-${platform}`,
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
input: `.cordova/platforms/${platform}/www`,
|
|
376
|
+
glob: "config.xml",
|
|
377
|
+
output: `cordova-${platform}`,
|
|
378
|
+
},
|
|
379
|
+
])
|
|
364
380
|
: []),
|
|
365
381
|
],
|
|
366
382
|
this._opt.pkgPath,
|
|
@@ -391,9 +407,10 @@ export class SdNgBundler {
|
|
|
391
407
|
}
|
|
392
408
|
|
|
393
409
|
private _getAppContext() {
|
|
394
|
-
const workerEntries =
|
|
395
|
-
|
|
396
|
-
|
|
410
|
+
const workerEntries = FsUtils.glob(path.resolve(this._opt.pkgPath, "src/workers/*.ts"))
|
|
411
|
+
.toObject(
|
|
412
|
+
(p) => "workers/" + path.basename(p, path.extname(p)),
|
|
413
|
+
);
|
|
397
414
|
|
|
398
415
|
return new SdNgBundlerContext(this._opt.pkgPath, {
|
|
399
416
|
absWorkingDir: this._opt.pkgPath,
|
|
@@ -411,7 +428,7 @@ export class SdNgBundler {
|
|
|
411
428
|
pure: ["forwardRef"],
|
|
412
429
|
outdir: this._opt.pkgPath,
|
|
413
430
|
outExtension: undefined,
|
|
414
|
-
sourcemap: this._opt.dev,
|
|
431
|
+
sourcemap: false, //this._opt.dev,
|
|
415
432
|
chunkNames: "[name]-[hash]",
|
|
416
433
|
tsconfig: this.#tsConfigFilePath,
|
|
417
434
|
write: false,
|
|
@@ -488,7 +505,10 @@ export class SdNgBundler {
|
|
|
488
505
|
target: this.#browserTarget,
|
|
489
506
|
format: "esm",
|
|
490
507
|
splitting: true,
|
|
491
|
-
inject: [
|
|
508
|
+
inject: [
|
|
509
|
+
PathUtils.posix(fileURLToPath(import.meta.resolve(
|
|
510
|
+
"node-stdlib-browser/helpers/esbuild/shim"))),
|
|
511
|
+
],
|
|
492
512
|
}),
|
|
493
513
|
plugins: [
|
|
494
514
|
createSourcemapIgnorelistPlugin(),
|
|
@@ -499,7 +519,20 @@ export class SdNgBundler {
|
|
|
499
519
|
result: this.#ngResultCache,
|
|
500
520
|
watchScopePaths: this._opt.watchScopePaths,
|
|
501
521
|
}),
|
|
502
|
-
...(this._opt.builderType === "electron"
|
|
522
|
+
...(this._opt.builderType === "electron"
|
|
523
|
+
? []
|
|
524
|
+
: [nodeStdLibBrowserPlugin(nodeStdLibBrowser)]),
|
|
525
|
+
// {
|
|
526
|
+
// name: "log-circular",
|
|
527
|
+
// setup(build) {
|
|
528
|
+
// build.onEnd(result => {
|
|
529
|
+
// if (result.metafile) {
|
|
530
|
+
// const analysis = esbuild.analyzeMetafile(result.metafile);
|
|
531
|
+
// console.log(analysis);
|
|
532
|
+
// }
|
|
533
|
+
// });
|
|
534
|
+
// },
|
|
535
|
+
// },
|
|
503
536
|
],
|
|
504
537
|
});
|
|
505
538
|
}
|
|
@@ -507,7 +540,7 @@ export class SdNgBundler {
|
|
|
507
540
|
private _getStyleContext(): SdNgBundlerContext {
|
|
508
541
|
const pluginFactory = new StylesheetPluginFactory(
|
|
509
542
|
{
|
|
510
|
-
sourcemap: this._opt.dev,
|
|
543
|
+
sourcemap: false,//this._opt.dev,
|
|
511
544
|
includePaths: [],
|
|
512
545
|
},
|
|
513
546
|
this.#styleLoadResultCache,
|
|
@@ -521,7 +554,7 @@ export class SdNgBundler {
|
|
|
521
554
|
logLevel: "silent",
|
|
522
555
|
minify: !this._opt.dev,
|
|
523
556
|
metafile: true,
|
|
524
|
-
sourcemap: this._opt.dev,
|
|
557
|
+
sourcemap: false,//this._opt.dev,
|
|
525
558
|
outdir: this._opt.pkgPath,
|
|
526
559
|
write: false,
|
|
527
560
|
platform: "browser",
|
|
@@ -555,7 +588,7 @@ export class SdNgBundler {
|
|
|
555
588
|
logLevel: "silent",
|
|
556
589
|
minify: !this._opt.dev,
|
|
557
590
|
outdir: this._opt.pkgPath,
|
|
558
|
-
sourcemap: this._opt.dev,
|
|
591
|
+
sourcemap: false,//this._opt.dev,
|
|
559
592
|
tsconfig: this.#tsConfigFilePath,
|
|
560
593
|
write: false,
|
|
561
594
|
preserveSymlinks: false,
|
|
@@ -2,12 +2,12 @@ import esbuild from "esbuild";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import os from "os";
|
|
4
4
|
import { JavaScriptTransformer } from "@angular/build/src/tools/esbuild/javascript-transformer";
|
|
5
|
-
import {
|
|
6
|
-
import { SdCliPerformanceTimer } from "../../utils/
|
|
7
|
-
import {
|
|
8
|
-
import { type ISdCliNgPluginResultCache } from "../../types/build-plugin.
|
|
9
|
-
import { type ISdTsCompilerResult } from "../../types/ts-compiler.
|
|
10
|
-
import { SdTsCompiler } from "../../ts-
|
|
5
|
+
import { SdLogger, PathUtils, type TNormPath } from "@simplysm/sd-core-node";
|
|
6
|
+
import { SdCliPerformanceTimer } from "../../utils/sd-cli-performance-time";
|
|
7
|
+
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
8
|
+
import { type ISdCliNgPluginResultCache } from "../../types/build-plugin.types";
|
|
9
|
+
import { type ISdTsCompilerResult } from "../../types/ts-compiler.types";
|
|
10
|
+
import { SdTsCompiler } from "../../ts-compiler/sd-ts-compiler";
|
|
11
11
|
|
|
12
12
|
export function createSdNgPlugin(conf: {
|
|
13
13
|
pkgPath: TNormPath;
|
|
@@ -29,7 +29,7 @@ export function createSdNgPlugin(conf: {
|
|
|
29
29
|
// let workerRevDepMap = new Map<TNormPath, Set<TNormPath>>();
|
|
30
30
|
|
|
31
31
|
let perf: SdCliPerformanceTimer;
|
|
32
|
-
const logger =
|
|
32
|
+
const logger = SdLogger.get(["simplysm", "sd-cli", "createSdNgPlugin"]);
|
|
33
33
|
|
|
34
34
|
function debug(...msg: any[]): void {
|
|
35
35
|
logger.debug(`[${path.basename(conf.pkgPath)}]`, ...msg);
|
|
@@ -106,7 +106,7 @@ export function createSdNgPlugin(conf: {
|
|
|
106
106
|
const javascriptTransformer = new JavaScriptTransformer(
|
|
107
107
|
{
|
|
108
108
|
thirdPartySourcemaps: conf.dev,
|
|
109
|
-
sourcemap: conf.dev,
|
|
109
|
+
sourcemap: false,//conf.dev,
|
|
110
110
|
jit: false,
|
|
111
111
|
advancedOptimizations: true,
|
|
112
112
|
},
|
|
@@ -136,7 +136,7 @@ export function createSdNgPlugin(conf: {
|
|
|
136
136
|
conf.result.watchFileSet = tsCompileResult.watchFileSet;
|
|
137
137
|
conf.result.affectedFileSet = tsCompileResult.affectedFileSet;
|
|
138
138
|
|
|
139
|
-
const tsEsbuildResult =
|
|
139
|
+
const tsEsbuildResult = SdCliConvertMessageUtils.convertToEsbuildFromBuildMessages(
|
|
140
140
|
tsCompileResult.messages,
|
|
141
141
|
conf.pkgPath,
|
|
142
142
|
);
|
|
@@ -168,12 +168,12 @@ export function createSdNgPlugin(conf: {
|
|
|
168
168
|
});
|
|
169
169
|
|
|
170
170
|
build.onLoad({ filter: /\.ts$/ }, async (args) => {
|
|
171
|
-
const output = outputContentsCacheMap.get(
|
|
171
|
+
const output = outputContentsCacheMap.get(PathUtils.norm(args.path));
|
|
172
172
|
if (output != null) {
|
|
173
173
|
return { contents: output, loader: "js" };
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
const emittedJsFile = tsCompileResult.emittedFilesCacheMap.get(
|
|
176
|
+
const emittedJsFile = tsCompileResult.emittedFilesCacheMap.get(PathUtils.norm(args.path))?.last();
|
|
177
177
|
if (!emittedJsFile) {
|
|
178
178
|
return {
|
|
179
179
|
errors: [
|
|
@@ -193,15 +193,15 @@ export function createSdNgPlugin(conf: {
|
|
|
193
193
|
|
|
194
194
|
const newContents = await javascriptTransformer.transformData(args.path, contents, true, sideEffects);
|
|
195
195
|
|
|
196
|
-
outputContentsCacheMap.set(
|
|
196
|
+
outputContentsCacheMap.set(PathUtils.norm(args.path), newContents);
|
|
197
197
|
|
|
198
198
|
return { contents: newContents, loader: "js" };
|
|
199
199
|
});
|
|
200
200
|
|
|
201
201
|
build.onLoad({ filter: /\.[cm]?js$/ }, async (args) => {
|
|
202
|
-
conf.result.watchFileSet!.add(
|
|
202
|
+
conf.result.watchFileSet!.add(PathUtils.norm(args.path));
|
|
203
203
|
|
|
204
|
-
const output = outputContentsCacheMap.get(
|
|
204
|
+
const output = outputContentsCacheMap.get(PathUtils.norm(args.path));
|
|
205
205
|
if (output != null) {
|
|
206
206
|
return { contents: output, loader: "js" };
|
|
207
207
|
}
|
|
@@ -213,7 +213,7 @@ export function createSdNgPlugin(conf: {
|
|
|
213
213
|
|
|
214
214
|
const newContents = await javascriptTransformer.transformFile(args.path, false, sideEffects);
|
|
215
215
|
|
|
216
|
-
outputContentsCacheMap.set(
|
|
216
|
+
outputContentsCacheMap.set(PathUtils.norm(args.path), newContents);
|
|
217
217
|
|
|
218
218
|
return {
|
|
219
219
|
contents: newContents,
|
|
@@ -232,7 +232,7 @@ export function createSdNgPlugin(conf: {
|
|
|
232
232
|
),
|
|
233
233
|
},
|
|
234
234
|
(args) => {
|
|
235
|
-
conf.result.watchFileSet!.add(
|
|
235
|
+
conf.result.watchFileSet!.add(PathUtils.norm(args.path));
|
|
236
236
|
return null;
|
|
237
237
|
},
|
|
238
238
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FsUtils, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
|
|
4
4
|
export class SdCliIndexFileGenerator {
|
|
5
5
|
static watch(pkgPath: string, polyfills?: string[]) {
|
|
6
6
|
const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
7
|
-
let cache =
|
|
7
|
+
let cache = FsUtils.exists(indexFilePath) ? FsUtils.readFile(indexFilePath) : undefined;
|
|
8
8
|
|
|
9
9
|
SdFsWatcher.watch([path.resolve(pkgPath, "src")]).onChange({ delay: 50 }, () => {
|
|
10
10
|
cache = this.run(pkgPath, polyfills, cache);
|
|
@@ -28,11 +28,11 @@ export class SdCliIndexFileGenerator {
|
|
|
28
28
|
// 내부 파일들 import
|
|
29
29
|
const filePaths = this.#getFilePaths(pkgPath);
|
|
30
30
|
for (const filePath of filePaths.orderBy()) {
|
|
31
|
-
const requirePath =
|
|
31
|
+
const requirePath = PathUtils.posix(path.relative(path.dirname(indexFilePath), filePath))
|
|
32
32
|
.replace(/\.tsx?$/, "")
|
|
33
33
|
.replace(/\/index$/, "");
|
|
34
34
|
|
|
35
|
-
const sourceTsFileContent =
|
|
35
|
+
const sourceTsFileContent = FsUtils.readFile(filePath);
|
|
36
36
|
if (sourceTsFileContent.split("\n").some((line) => line.startsWith("export "))) {
|
|
37
37
|
importTexts.push(`export * from "./${requirePath}";`);
|
|
38
38
|
} else {
|
|
@@ -42,7 +42,7 @@ export class SdCliIndexFileGenerator {
|
|
|
42
42
|
|
|
43
43
|
const content = importTexts.join("\n") + "\n";
|
|
44
44
|
if (content.trim() !== cache?.trim()) {
|
|
45
|
-
|
|
45
|
+
FsUtils.writeFile(indexFilePath, content);
|
|
46
46
|
}
|
|
47
47
|
return content;
|
|
48
48
|
}
|
|
@@ -50,10 +50,10 @@ export class SdCliIndexFileGenerator {
|
|
|
50
50
|
static #getFilePaths(pkgPath: string): string[] {
|
|
51
51
|
const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
52
52
|
|
|
53
|
-
const tsconfig =
|
|
53
|
+
const tsconfig = FsUtils.readJson(path.resolve(pkgPath, "tsconfig.json"));
|
|
54
54
|
const entryFilePaths: string[] = tsconfig.files?.map((item) => path.resolve(pkgPath, item)) ?? [];
|
|
55
55
|
|
|
56
|
-
return
|
|
56
|
+
return FsUtils.glob(path.resolve(pkgPath, "src/**/*{.ts,.tsx}"), { nodir: true, ignore: tsconfig.excludes }).filter(
|
|
57
57
|
(item) => !entryFilePaths.includes(item) && item !== indexFilePath && !item.endsWith(".d.ts"),
|
|
58
58
|
);
|
|
59
59
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FsUtils, SdLogger, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { EventEmitter } from "events";
|
|
4
|
-
import {
|
|
4
|
+
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
5
5
|
// import { TSdLintWorkerType } from "../../types/workers.type";
|
|
6
|
-
import { type ISdProjectConfig } from "../../types/
|
|
7
|
-
import { type ISdBuildRunnerResult } from "../../types/build.
|
|
6
|
+
import { type ISdProjectConfig } from "../../types/config.types";
|
|
7
|
+
import { type ISdBuildRunnerResult } from "../../types/build.types";
|
|
8
8
|
import { ESLint } from "eslint";
|
|
9
9
|
|
|
10
10
|
export class SdJsLibBuildRunner extends EventEmitter {
|
|
11
|
-
private readonly _logger =
|
|
11
|
+
private readonly _logger = SdLogger.get(["simplysm", "sd-cli", "SdJsLibBuildRunner"]);
|
|
12
12
|
private readonly _pkgName: string;
|
|
13
13
|
|
|
14
14
|
// private readonly _lintWorker: SdWorker<TSdLintWorkerType>;
|
|
@@ -33,14 +33,14 @@ export class SdJsLibBuildRunner extends EventEmitter {
|
|
|
33
33
|
public async buildAsync(): Promise<ISdBuildRunnerResult> {
|
|
34
34
|
this._debug("LINT...");
|
|
35
35
|
const srcGlobPath = path.resolve(this._pkgPath, "src/**/*.js");
|
|
36
|
-
const srcFilePaths =
|
|
36
|
+
const srcFilePaths = FsUtils.glob(srcGlobPath);
|
|
37
37
|
|
|
38
38
|
const lintResults = await this.#lintAsync(new Set(srcFilePaths));
|
|
39
|
-
const messages =
|
|
39
|
+
const messages = SdCliConvertMessageUtils.convertToBuildMessagesFromEslint(lintResults);
|
|
40
40
|
|
|
41
41
|
this._debug(`LINT 완료`);
|
|
42
42
|
return {
|
|
43
|
-
affectedFilePathSet: new Set(srcFilePaths.map((item) =>
|
|
43
|
+
affectedFilePathSet: new Set(srcFilePaths.map((item) => PathUtils.norm(item))),
|
|
44
44
|
buildMessages: messages,
|
|
45
45
|
emitFileSet: new Set(),
|
|
46
46
|
};
|
|
@@ -50,21 +50,21 @@ export class SdJsLibBuildRunner extends EventEmitter {
|
|
|
50
50
|
this.emit("change");
|
|
51
51
|
this._debug("LINT...");
|
|
52
52
|
const srcGlobPath = path.resolve(this._pkgPath, "src/**/*.js");
|
|
53
|
-
const srcFilePaths =
|
|
53
|
+
const srcFilePaths = FsUtils.glob(srcGlobPath);
|
|
54
54
|
|
|
55
55
|
const lintResults = await this.#lintAsync(new Set(srcFilePaths));
|
|
56
|
-
const messages =
|
|
56
|
+
const messages = SdCliConvertMessageUtils.convertToBuildMessagesFromEslint(lintResults);
|
|
57
57
|
|
|
58
58
|
this._debug(`LINT 완료`);
|
|
59
59
|
const res: ISdBuildRunnerResult = {
|
|
60
|
-
affectedFilePathSet: new Set(srcFilePaths.map((item) =>
|
|
60
|
+
affectedFilePathSet: new Set(srcFilePaths.map((item) => PathUtils.norm(item))),
|
|
61
61
|
buildMessages: messages,
|
|
62
62
|
emitFileSet: new Set(),
|
|
63
63
|
};
|
|
64
64
|
this.emit("complete", res);
|
|
65
65
|
|
|
66
66
|
SdFsWatcher.watch([srcGlobPath]).onChange({ delay: 100 }, async (changeInfos) => {
|
|
67
|
-
const watchFilePaths = changeInfos.filter((item) =>
|
|
67
|
+
const watchFilePaths = changeInfos.filter((item) => FsUtils.exists(item.path)).map((item) => item.path);
|
|
68
68
|
if (watchFilePaths.length < 1) return;
|
|
69
69
|
|
|
70
70
|
this.emit("change");
|
|
@@ -72,12 +72,12 @@ export class SdJsLibBuildRunner extends EventEmitter {
|
|
|
72
72
|
this._debug("LINT...");
|
|
73
73
|
|
|
74
74
|
const watchLintResults = await this.#lintAsync(new Set(watchFilePaths));
|
|
75
|
-
const watchMessages =
|
|
75
|
+
const watchMessages = SdCliConvertMessageUtils.convertToBuildMessagesFromEslint(watchLintResults);
|
|
76
76
|
|
|
77
77
|
this._debug(`LINT 완료`);
|
|
78
78
|
|
|
79
79
|
const watchRes: ISdBuildRunnerResult = {
|
|
80
|
-
affectedFilePathSet: new Set(changeInfos.map((item) =>
|
|
80
|
+
affectedFilePathSet: new Set(changeInfos.map((item) => PathUtils.norm(item.path))),
|
|
81
81
|
buildMessages: watchMessages,
|
|
82
82
|
emitFileSet: new Set(),
|
|
83
83
|
};
|
|
@@ -88,9 +88,9 @@ export class SdJsLibBuildRunner extends EventEmitter {
|
|
|
88
88
|
|
|
89
89
|
async #lintAsync(fileSet: Set<string>) {
|
|
90
90
|
const lintFilePaths = Array.from(fileSet)
|
|
91
|
-
.filter((item) =>
|
|
91
|
+
.filter((item) => PathUtils.isChildPath(item, this._pkgPath))
|
|
92
92
|
.filter((item) => item.endsWith(".js"))
|
|
93
|
-
.filter((item) =>
|
|
93
|
+
.filter((item) => FsUtils.exists(item));
|
|
94
94
|
|
|
95
95
|
if (lintFilePaths.length === 0) {
|
|
96
96
|
return [];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FsUtils, SdLogger, PathUtils, SdFsWatcher, type TNormPath } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { EventEmitter } from "events";
|
|
4
|
-
import { SdCliIndexFileGenerator } from "./
|
|
5
|
-
import { SdTsLibBuilder } from "./
|
|
6
|
-
import { type ISdLibPackageConfig, type ISdProjectConfig } from "../../types/
|
|
7
|
-
import { type ISdBuildMessage, type ISdBuildRunnerResult } from "../../types/build.
|
|
4
|
+
import { SdCliIndexFileGenerator } from "./sd-cli-index.file-generator";
|
|
5
|
+
import { SdTsLibBuilder } from "./sd-ts-lib.builder";
|
|
6
|
+
import { type ISdLibPackageConfig, type ISdProjectConfig } from "../../types/config.types";
|
|
7
|
+
import { type ISdBuildMessage, type ISdBuildRunnerResult } from "../../types/build.types";
|
|
8
8
|
|
|
9
9
|
export class SdTsLibBuildRunner extends EventEmitter {
|
|
10
|
-
private _logger =
|
|
10
|
+
private _logger = SdLogger.get(["simplysm", "sd-cli", "SdCliTsLibBuilder"]);
|
|
11
11
|
|
|
12
12
|
private _projConf: ISdProjectConfig;
|
|
13
13
|
private _pkgPath: string;
|
|
@@ -24,10 +24,10 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
24
24
|
this._pkgConf = projConf.packages[path.basename(pkgPath)] as ISdLibPackageConfig;
|
|
25
25
|
|
|
26
26
|
const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {}).mapMany((key) =>
|
|
27
|
-
|
|
27
|
+
FsUtils.glob(path.resolve(this._pkgPath, "../../node_modules", key)),
|
|
28
28
|
);
|
|
29
29
|
this._watchScopePathSet = new Set(
|
|
30
|
-
[path.resolve(this._pkgPath, "../"), ...localUpdatePaths].map((item) =>
|
|
30
|
+
[path.resolve(this._pkgPath, "../"), ...localUpdatePaths].map((item) => PathUtils.norm(item)),
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -40,7 +40,7 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
40
40
|
|
|
41
41
|
public async buildAsync(): Promise<ISdBuildRunnerResult> {
|
|
42
42
|
this._debug("dist 초기화...");
|
|
43
|
-
|
|
43
|
+
FsUtils.remove(path.resolve(this._pkgPath, "dist"));
|
|
44
44
|
|
|
45
45
|
if (!this._pkgConf.noGenIndex) {
|
|
46
46
|
this._debug("GEN index.ts...");
|
|
@@ -59,7 +59,7 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
59
59
|
this.emit("change");
|
|
60
60
|
|
|
61
61
|
this._debug("dist 초기화...");
|
|
62
|
-
|
|
62
|
+
FsUtils.remove(path.resolve(this._pkgPath, "dist"));
|
|
63
63
|
|
|
64
64
|
if (!this._pkgConf.noGenIndex) {
|
|
65
65
|
this._debug("WATCH GEN index.ts...");
|
|
@@ -82,7 +82,7 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
82
82
|
|
|
83
83
|
this.emit("change");
|
|
84
84
|
|
|
85
|
-
const changeFileSet = new Set(currentChangeInfos.map((item) =>
|
|
85
|
+
const changeFileSet = new Set(currentChangeInfos.map((item) => PathUtils.norm(item.path)));
|
|
86
86
|
|
|
87
87
|
const watchResult = await this._runAsync(true, changeFileSet);
|
|
88
88
|
const watchRes: ISdBuildRunnerResult = {
|
|
@@ -107,14 +107,14 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
107
107
|
emitFileSet: Set<TNormPath>;
|
|
108
108
|
}> {
|
|
109
109
|
const localUpdatePaths = Object.keys(this._projConf.localUpdates ?? {})
|
|
110
|
-
.mapMany((key) =>
|
|
111
|
-
.map((item) =>
|
|
110
|
+
.mapMany((key) => FsUtils.glob(path.resolve(this._pkgPath, "../../node_modules", key)))
|
|
111
|
+
.map((item) => PathUtils.norm(item));
|
|
112
112
|
|
|
113
113
|
this._debug(`BUILD...`);
|
|
114
114
|
this._builder ??= new SdTsLibBuilder(
|
|
115
|
-
|
|
115
|
+
PathUtils.norm(this._pkgPath),
|
|
116
116
|
dev,
|
|
117
|
-
[
|
|
117
|
+
[PathUtils.norm(this._pkgPath, "../"), ...localUpdatePaths].map((item) => PathUtils.norm(item)),
|
|
118
118
|
);
|
|
119
119
|
const buildResult = await this._builder.buildAsync(modifiedFileSet);
|
|
120
120
|
|
|
@@ -122,8 +122,8 @@ export class SdTsLibBuildRunner extends EventEmitter {
|
|
|
122
122
|
const watchFileSet = new Set(
|
|
123
123
|
Array.from(buildResult.watchFileSet).filter(
|
|
124
124
|
(item) =>
|
|
125
|
-
|
|
126
|
-
localUpdatePaths.some((lu) =>
|
|
125
|
+
PathUtils.isChildPath(item, path.resolve(this._pkgPath, "../")) ||
|
|
126
|
+
localUpdatePaths.some((lu) => PathUtils.isChildPath(item, lu)),
|
|
127
127
|
),
|
|
128
128
|
);
|
|
129
129
|
|