@simplysm/sd-cli 12.11.8 → 12.11.10
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/pkg-builders/client/sd-cli-ng-routes.file-generator.d.ts +3 -2
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js +12 -10
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js.map +1 -1
- package/dist/pkg-builders/client/sd-client.build-runner.js +7 -5
- package/dist/pkg-builders/client/sd-client.build-runner.js.map +1 -1
- package/dist/pkg-builders/client/sd-ng.bundler.js +1 -1
- package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -1
- package/dist/pkg-builders/commons/build-runner.base.js +4 -5
- package/dist/pkg-builders/commons/build-runner.base.js.map +1 -1
- package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.d.ts +3 -2
- package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.js +10 -9
- package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.js.map +1 -1
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.d.ts +3 -2
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.js +14 -9
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.js.map +1 -1
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js +8 -4
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +1 -1
- package/dist/pkg-builders/lib/sd-ts-lib.builder.js +19 -10
- package/dist/pkg-builders/lib/sd-ts-lib.builder.js.map +1 -1
- package/dist/pkg-builders/server/sd-server.build-runner.js +1 -1
- package/dist/pkg-builders/server/sd-server.bundler.js +1 -1
- package/dist/pkg-builders/server/sd-server.bundler.js.map +1 -1
- package/dist/ts-compiler/sd-dependency-cache.d.ts +56 -0
- package/dist/ts-compiler/sd-dependency-cache.js +183 -118
- package/dist/ts-compiler/sd-dependency-cache.js.map +1 -1
- package/package.json +5 -5
- package/src/pkg-builders/client/sd-cli-ng-routes.file-generator.ts +20 -15
- package/src/pkg-builders/client/sd-client.build-runner.ts +15 -10
- package/src/pkg-builders/client/sd-ng.bundler.ts +1 -1
- package/src/pkg-builders/commons/build-runner.base.ts +19 -16
- package/src/pkg-builders/lib/sd-cli-db-context.file-generator.ts +12 -9
- package/src/pkg-builders/lib/sd-cli-index.file-generator.ts +18 -10
- package/src/pkg-builders/lib/sd-ts-lib.build-runner.ts +7 -6
- package/src/pkg-builders/lib/sd-ts-lib.builder.ts +22 -12
- package/src/pkg-builders/server/sd-server.build-runner.ts +1 -1
- package/src/pkg-builders/server/sd-server.bundler.ts +11 -11
- package/src/ts-compiler/sd-dependency-cache.ts +208 -171
- package/tests/deps/sd-dependency-cache.spec.ts +12 -0
|
@@ -10,6 +10,7 @@ import { INpmConfig } from "../../types/common-configs.types";
|
|
|
10
10
|
export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
|
|
11
11
|
protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdClientBuildRunner"]);
|
|
12
12
|
|
|
13
|
+
#routeGenerator = new SdCliNgRoutesFileGenerator();
|
|
13
14
|
#ngBundlers?: SdNgBundler[];
|
|
14
15
|
#cordova?: SdCliCordova;
|
|
15
16
|
|
|
@@ -17,6 +18,7 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
|
|
|
17
18
|
dev: boolean,
|
|
18
19
|
modifiedFileSet?: Set<TNormPath>,
|
|
19
20
|
): Promise<IBuildRunnerRunResult> {
|
|
21
|
+
// 최초
|
|
20
22
|
if (!modifiedFileSet) {
|
|
21
23
|
this._debug("GEN .config...");
|
|
22
24
|
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
@@ -27,14 +29,14 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
|
|
|
27
29
|
if ("@angular/router" in (npmConf.dependencies ?? {})) {
|
|
28
30
|
if (!dev) {
|
|
29
31
|
this._debug(`GEN routes.ts...`);
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
32
|
+
this.#routeGenerator.run(this._pkgPath, this._pkgConf.noLazyRoute);
|
|
33
|
+
} else {
|
|
33
34
|
this._debug(`Watch for GEN routes.ts...`);
|
|
34
|
-
|
|
35
|
+
this.#routeGenerator.watch(this._pkgPath, this._pkgConf.noLazyRoute);
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
}
|
|
39
|
+
// watch
|
|
38
40
|
else {
|
|
39
41
|
for (const ngBundler of this.#ngBundlers!) {
|
|
40
42
|
ngBundler.markForChanges(Array.from(modifiedFileSet));
|
|
@@ -45,7 +47,7 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
|
|
|
45
47
|
| "web"
|
|
46
48
|
| "electron"
|
|
47
49
|
| "cordova"
|
|
48
|
-
|
|
50
|
+
)[];
|
|
49
51
|
if (this._pkgConf.builder?.cordova && !this.#cordova) {
|
|
50
52
|
this._debug("CORDOVA 준비...");
|
|
51
53
|
this.#cordova = new SdCliCordova({
|
|
@@ -80,18 +82,21 @@ export class SdClientBuildRunner extends BuildRunnerBase<"client"> {
|
|
|
80
82
|
ngBundlerBuilderType === "electron"
|
|
81
83
|
? (this._pkgConf.builder?.electron?.reinstallDependencies ?? [])
|
|
82
84
|
: [],
|
|
83
|
-
cordovaConfig:
|
|
84
|
-
? this._pkgConf.builder!.cordova
|
|
85
|
-
: undefined,
|
|
85
|
+
cordovaConfig:
|
|
86
|
+
ngBundlerBuilderType === "cordova" ? this._pkgConf.builder!.cordova : undefined,
|
|
86
87
|
watchScopePathSet: this._watchScopePathSet,
|
|
87
88
|
}),
|
|
88
89
|
);
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
this._debug(`BUILD...`);
|
|
92
|
-
const buildResults = await Promise.all(
|
|
93
|
+
const buildResults = await Promise.all(
|
|
94
|
+
this.#ngBundlers.map((builder) => builder.bundleAsync()),
|
|
95
|
+
);
|
|
93
96
|
const watchFileSet = new Set(buildResults.mapMany((item) => Array.from(item.watchFileSet)));
|
|
94
|
-
const affectedFileSet = new Set(
|
|
97
|
+
const affectedFileSet = new Set(
|
|
98
|
+
buildResults.mapMany((item) => Array.from(item.affectedFileSet)),
|
|
99
|
+
);
|
|
95
100
|
const emitFileSet = new Set(buildResults.mapMany((item) => Array.from(item.emitFileSet)));
|
|
96
101
|
const results = buildResults.mapMany((item) => item.results).distinct();
|
|
97
102
|
|
|
@@ -253,7 +253,7 @@ export class SdNgBundler {
|
|
|
253
253
|
}
|
|
254
254
|
for (const assetFile of assetFiles) {
|
|
255
255
|
const prevHash = this.#outputHashCache.get(PathUtils.norm(assetFile.source));
|
|
256
|
-
const currHash = FsUtils.
|
|
256
|
+
const currHash = HashUtils.get(FsUtils.readFileBuffer(assetFile.source));
|
|
257
257
|
if (prevHash !== currHash) {
|
|
258
258
|
FsUtils.copy(assetFile.source, path.resolve(this._opt.outputPath, assetFile.destination));
|
|
259
259
|
this.#outputHashCache.set(PathUtils.norm(assetFile.source), currHash);
|
|
@@ -12,7 +12,9 @@ import { ISdBuildMessage, ISdBuildRunnerResult } from "../../types/build.types";
|
|
|
12
12
|
import path from "path";
|
|
13
13
|
import { ScopePathSet } from "./scope-path";
|
|
14
14
|
|
|
15
|
-
export abstract class BuildRunnerBase<
|
|
15
|
+
export abstract class BuildRunnerBase<
|
|
16
|
+
T extends "server" | "library" | "client",
|
|
17
|
+
> extends EventEmitter {
|
|
16
18
|
protected abstract _logger: SdLogger;
|
|
17
19
|
|
|
18
20
|
protected _pkgName: string;
|
|
@@ -38,8 +40,8 @@ export abstract class BuildRunnerBase<T extends "server" | "library" | "client">
|
|
|
38
40
|
this._pkgConf = projConf.packages[this._pkgName] as TSdPackageConfig<T>;
|
|
39
41
|
|
|
40
42
|
const workspacePaths = workspaceGlobs
|
|
41
|
-
.map(item => PathUtils.posix(this._pkgPath, "../../", item))
|
|
42
|
-
.mapMany(item => FsUtils.glob(item));
|
|
43
|
+
.map((item) => PathUtils.posix(this._pkgPath, "../../", item))
|
|
44
|
+
.mapMany((item) => FsUtils.glob(item));
|
|
43
45
|
const localUpdatePaths = Object.keys(projConf.localUpdates ?? {}).mapMany((key) =>
|
|
44
46
|
FsUtils.glob(path.resolve(this._pkgPath, "../../node_modules", key)),
|
|
45
47
|
);
|
|
@@ -81,10 +83,12 @@ export abstract class BuildRunnerBase<T extends "server" | "library" | "client">
|
|
|
81
83
|
this.emit("complete", res);
|
|
82
84
|
|
|
83
85
|
this._debug("WATCH...");
|
|
84
|
-
let lastWatchFileSet = result.watchFileSet
|
|
85
|
-
SdFsWatcher.watch(this._watchScopePathSet.toArray())
|
|
86
|
-
|
|
86
|
+
let lastWatchFileSet = result.watchFileSet!;
|
|
87
|
+
SdFsWatcher.watch(this._watchScopePathSet.toArray()).onChange(
|
|
88
|
+
{ delay: 100 },
|
|
89
|
+
async (changeInfos) => {
|
|
87
90
|
const modifiedFileSet = this._getModifiedFileSet(changeInfos, lastWatchFileSet);
|
|
91
|
+
|
|
88
92
|
if (modifiedFileSet.size < 1) return;
|
|
89
93
|
|
|
90
94
|
this.emit("change");
|
|
@@ -93,9 +97,8 @@ export abstract class BuildRunnerBase<T extends "server" | "library" | "client">
|
|
|
93
97
|
try {
|
|
94
98
|
watchResult = await this._runAsync(!this._pkgConf.forceProductionMode, modifiedFileSet);
|
|
95
99
|
|
|
96
|
-
lastWatchFileSet = watchResult.watchFileSet
|
|
97
|
-
}
|
|
98
|
-
catch (err) {
|
|
100
|
+
lastWatchFileSet = watchResult.watchFileSet!;
|
|
101
|
+
} catch (err) {
|
|
99
102
|
watchResult = {
|
|
100
103
|
affectedFileSet: modifiedFileSet,
|
|
101
104
|
buildMessages: [
|
|
@@ -119,7 +122,8 @@ export abstract class BuildRunnerBase<T extends "server" | "library" | "client">
|
|
|
119
122
|
buildMessages: watchResult.buildMessages,
|
|
120
123
|
emitFileSet: watchResult.emitFileSet,
|
|
121
124
|
});
|
|
122
|
-
}
|
|
125
|
+
},
|
|
126
|
+
);
|
|
123
127
|
}
|
|
124
128
|
|
|
125
129
|
protected _getModifiedFileSet(
|
|
@@ -127,11 +131,10 @@ export abstract class BuildRunnerBase<T extends "server" | "library" | "client">
|
|
|
127
131
|
lastWatchFileSet?: Set<TNormPath>,
|
|
128
132
|
) {
|
|
129
133
|
return new Set(
|
|
130
|
-
(
|
|
131
|
-
lastWatchFileSet
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
).map(item => item.path),
|
|
134
|
+
(lastWatchFileSet
|
|
135
|
+
? changeInfos.filter((item) => lastWatchFileSet.has(item.path))
|
|
136
|
+
: changeInfos
|
|
137
|
+
).map((item) => item.path),
|
|
135
138
|
);
|
|
136
139
|
}
|
|
137
140
|
|
|
@@ -150,4 +153,4 @@ export interface IBuildRunnerRunResult {
|
|
|
150
153
|
affectedFileSet: Set<TNormPath>;
|
|
151
154
|
buildMessages: ISdBuildMessage[];
|
|
152
155
|
emitFileSet: Set<TNormPath>;
|
|
153
|
-
}
|
|
156
|
+
}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { FsUtils, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
1
|
+
import { FsUtils, HashUtils, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { StringUtils } from "@simplysm/sd-core-common";
|
|
4
4
|
import { INpmConfig } from "../../types/common-configs.types";
|
|
5
5
|
|
|
6
6
|
export class SdCliDbContextFileGenerator {
|
|
7
|
-
|
|
7
|
+
cachedHash?: string;
|
|
8
|
+
|
|
9
|
+
watch(pkgPath: string, kebabName: string) {
|
|
8
10
|
const targetFilePath = path.resolve(pkgPath, `src/${kebabName}.ts`);
|
|
9
|
-
|
|
11
|
+
this.cachedHash = FsUtils.exists(targetFilePath) ? HashUtils.get(FsUtils.readFile(targetFilePath)) : undefined;
|
|
10
12
|
|
|
11
13
|
SdFsWatcher.watch([path.resolve(pkgPath, "src")]).onChange({ delay: 50 }, () => {
|
|
12
|
-
|
|
14
|
+
this.run(pkgPath, kebabName);
|
|
13
15
|
});
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
this.run(pkgPath, kebabName);
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
run(pkgPath: string, kebabName: string) {
|
|
19
21
|
const npmConfig = FsUtils.readJson(path.resolve(pkgPath, "package.json")) as INpmConfig;
|
|
20
22
|
const useExt = npmConfig.dependencies?.["@simplysm/sd-orm-common-ext"] != null;
|
|
21
23
|
|
|
@@ -68,7 +70,7 @@ export class SdCliDbContextFileGenerator {
|
|
|
68
70
|
useExt &&
|
|
69
71
|
[
|
|
70
72
|
"systemDataLog",
|
|
71
|
-
"
|
|
73
|
+
"systemLog",
|
|
72
74
|
"authentication",
|
|
73
75
|
"user",
|
|
74
76
|
"userConfig",
|
|
@@ -145,9 +147,10 @@ ${viewTexts.length > 0 ? "\n // Views\n" + viewTexts.map((item) => " " + item)
|
|
|
145
147
|
${spTexts.length > 0 ? "\n // StoredProcedures\n" + spTexts.map((item) => " " + item).join("\n") : ""}
|
|
146
148
|
}
|
|
147
149
|
`.trim();
|
|
148
|
-
|
|
150
|
+
const currHash = HashUtils.get(content);
|
|
151
|
+
if (currHash !== this.cachedHash) {
|
|
149
152
|
FsUtils.writeFile(targetFilePath, content);
|
|
153
|
+
this.cachedHash = currHash;
|
|
150
154
|
}
|
|
151
|
-
return content;
|
|
152
155
|
}
|
|
153
156
|
}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { FsUtils, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
1
|
+
import { FsUtils, HashUtils, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
2
|
import path from "path";
|
|
3
3
|
|
|
4
4
|
export class SdCliIndexFileGenerator {
|
|
5
|
-
|
|
5
|
+
cachedHash?: string;
|
|
6
|
+
|
|
7
|
+
watch(pkgPath: string, polyfills?: string[]) {
|
|
6
8
|
const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
7
|
-
|
|
9
|
+
this.cachedHash = FsUtils.exists(indexFilePath) ? FsUtils.readFile(indexFilePath) : undefined;
|
|
8
10
|
|
|
9
11
|
SdFsWatcher.watch([path.resolve(pkgPath, "src")]).onChange({ delay: 50 }, () => {
|
|
10
|
-
|
|
12
|
+
this.run(pkgPath, polyfills);
|
|
11
13
|
});
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
this.run(pkgPath, polyfills);
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
run(pkgPath: string, polyfills?: string[]): string {
|
|
17
19
|
const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
18
20
|
|
|
19
21
|
const importTexts: string[] = [];
|
|
@@ -41,19 +43,25 @@ export class SdCliIndexFileGenerator {
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
const content = importTexts.join("\n") + "\n";
|
|
44
|
-
|
|
46
|
+
const currHash = HashUtils.get(content);
|
|
47
|
+
if (currHash !== this.cachedHash) {
|
|
45
48
|
FsUtils.writeFile(indexFilePath, content);
|
|
49
|
+
this.cachedHash = currHash;
|
|
46
50
|
}
|
|
47
51
|
return content;
|
|
48
52
|
}
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
#getFilePaths(pkgPath: string): string[] {
|
|
51
55
|
const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
52
56
|
|
|
53
57
|
const tsconfig = FsUtils.readJson(path.resolve(pkgPath, "tsconfig.json"));
|
|
54
|
-
const entryFilePaths: string[] =
|
|
58
|
+
const entryFilePaths: string[] =
|
|
59
|
+
tsconfig.files?.map((item) => path.resolve(pkgPath, item)) ?? [];
|
|
55
60
|
|
|
56
|
-
return FsUtils.glob(path.resolve(pkgPath, "src/**/*{.ts,.tsx}"), {
|
|
61
|
+
return FsUtils.glob(path.resolve(pkgPath, "src/**/*{.ts,.tsx}"), {
|
|
62
|
+
nodir: true,
|
|
63
|
+
ignore: tsconfig.excludes,
|
|
64
|
+
}).filter(
|
|
57
65
|
(item) => !entryFilePaths.includes(item) && item !== indexFilePath && !item.endsWith(".d.ts"),
|
|
58
66
|
);
|
|
59
67
|
}
|
|
@@ -7,6 +7,8 @@ import { SdCliDbContextFileGenerator } from "./sd-cli-db-context.file-generator"
|
|
|
7
7
|
export class SdTsLibBuildRunner extends BuildRunnerBase<"library"> {
|
|
8
8
|
protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdCliTsLibBuilder"]);
|
|
9
9
|
|
|
10
|
+
#indexFileGenerator = new SdCliIndexFileGenerator();
|
|
11
|
+
#dbContextGenerator = new SdCliDbContextFileGenerator();
|
|
10
12
|
#builder?: SdTsLibBuilder;
|
|
11
13
|
|
|
12
14
|
protected override async _runAsync(
|
|
@@ -17,23 +19,22 @@ export class SdTsLibBuildRunner extends BuildRunnerBase<"library"> {
|
|
|
17
19
|
if (!dev) {
|
|
18
20
|
if (!this._pkgConf.noGenIndex) {
|
|
19
21
|
this._debug("GEN index.ts...");
|
|
20
|
-
|
|
22
|
+
this.#indexFileGenerator.run(this._pkgPath, this._pkgConf.polyfills);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
if (this._pkgConf.dbContext != null) {
|
|
24
26
|
this._debug(`GEN ${this._pkgConf.dbContext}.ts...`);
|
|
25
|
-
|
|
27
|
+
this.#dbContextGenerator.run(this._pkgPath, this._pkgConf.dbContext);
|
|
26
28
|
}
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
+
} else {
|
|
29
30
|
if (!this._pkgConf.noGenIndex) {
|
|
30
31
|
this._debug("Watch for GEN index.ts...");
|
|
31
|
-
|
|
32
|
+
this.#indexFileGenerator.watch(this._pkgPath, this._pkgConf.polyfills);
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
if (this._pkgConf.dbContext != null) {
|
|
35
36
|
this._debug(`Watch for GEN ${this._pkgConf.dbContext}.ts...`);
|
|
36
|
-
|
|
37
|
+
this.#dbContextGenerator.watch(this._pkgPath, this._pkgConf.dbContext);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
3
|
-
import { FsUtils, PathUtils, TNormPath } from "@simplysm/sd-core-node";
|
|
3
|
+
import { FsUtils, HashUtils, PathUtils, TNormPath } from "@simplysm/sd-core-node";
|
|
4
4
|
import { ISdBuildMessage } from "../../types/build.types";
|
|
5
5
|
import { SdTsCompiler } from "../../ts-compiler/sd-ts-compiler";
|
|
6
6
|
import { ScopePathSet } from "../commons/scope-path";
|
|
7
7
|
|
|
8
8
|
export class SdTsLibBuilder {
|
|
9
9
|
#tsCompiler: SdTsCompiler;
|
|
10
|
+
#outputHashCache = new Map<TNormPath, string>();
|
|
10
11
|
|
|
11
12
|
constructor(
|
|
12
13
|
private readonly _pkgPath: TNormPath,
|
|
@@ -37,15 +38,20 @@ export class SdTsLibBuilder {
|
|
|
37
38
|
if (emitFileInfos) {
|
|
38
39
|
for (const emitFileInfo of emitFileInfos) {
|
|
39
40
|
if (emitFileInfo.outAbsPath != null) {
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
const emitFilePath = PathUtils.norm(emitFileInfo.outAbsPath);
|
|
42
|
+
const prevHash = this.#outputHashCache.get(emitFilePath);
|
|
43
|
+
const currHash = HashUtils.get(Buffer.from(emitFileInfo.text));
|
|
44
|
+
if (prevHash !== currHash) {
|
|
45
|
+
FsUtils.writeFile(emitFilePath, emitFileInfo.text);
|
|
46
|
+
this.#outputHashCache.set(emitFilePath, currHash);
|
|
47
|
+
emitFileSet.add(emitFilePath);
|
|
48
|
+
}
|
|
42
49
|
}
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
const globalStylesheetBundlingResult =
|
|
47
|
-
.stylesheetBundlingResultMap
|
|
48
|
-
.get(emitFile);
|
|
53
|
+
const globalStylesheetBundlingResult =
|
|
54
|
+
tsCompileResult.stylesheetBundlingResultMap.get(emitFile);
|
|
49
55
|
if (globalStylesheetBundlingResult && "outputFiles" in globalStylesheetBundlingResult) {
|
|
50
56
|
for (const outputFile of globalStylesheetBundlingResult.outputFiles) {
|
|
51
57
|
const distPath = PathUtils.norm(
|
|
@@ -54,17 +60,21 @@ export class SdTsLibBuilder {
|
|
|
54
60
|
path.relative(this._pkgPath, outputFile.path),
|
|
55
61
|
);
|
|
56
62
|
if (PathUtils.isChildPath(distPath, path.resolve(this._pkgPath, "dist"))) {
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
const prevHash = this.#outputHashCache.get(distPath);
|
|
64
|
+
const currHash = HashUtils.get(Buffer.from(outputFile.text));
|
|
65
|
+
if (prevHash !== currHash) {
|
|
66
|
+
FsUtils.writeFile(distPath, outputFile.text);
|
|
67
|
+
this.#outputHashCache.set(distPath, currHash);
|
|
68
|
+
emitFileSet.add(distPath);
|
|
69
|
+
}
|
|
59
70
|
}
|
|
60
71
|
}
|
|
61
72
|
}
|
|
62
73
|
}
|
|
63
74
|
|
|
64
|
-
const styleResults = Array.from(tsCompileResult.stylesheetBundlingResultMap.values())
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
);
|
|
75
|
+
const styleResults = Array.from(tsCompileResult.stylesheetBundlingResultMap.values()).mapMany(
|
|
76
|
+
(item) => SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(item, this._pkgPath),
|
|
77
|
+
);
|
|
68
78
|
|
|
69
79
|
return {
|
|
70
80
|
watchFileSet: tsCompileResult.watchFileSet,
|
|
@@ -149,7 +149,7 @@ Options = UnsafeLegacyRenegotiation`.trim(),
|
|
|
149
149
|
const env = ${JSON.stringify(this._pkgConf.env)};
|
|
150
150
|
|
|
151
151
|
module.exports = {
|
|
152
|
-
name: pm2Conf.name ?? npmConf.name.replace(
|
|
152
|
+
name: pm2Conf.name ?? npmConf.name.replace(/@/g, "").replace(/[\\\/]/g, "-"),
|
|
153
153
|
script: "main.js",
|
|
154
154
|
watch: true,
|
|
155
155
|
watch_delay: 2000,
|
|
@@ -23,14 +23,15 @@ export class SdServerBundler {
|
|
|
23
23
|
|
|
24
24
|
#outputHashCache = new Map<TNormPath, string>();
|
|
25
25
|
|
|
26
|
-
constructor(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
constructor(
|
|
27
|
+
private readonly _opt: {
|
|
28
|
+
dev: boolean;
|
|
29
|
+
pkgPath: TNormPath;
|
|
30
|
+
entryPoints: string[];
|
|
31
|
+
external?: string[];
|
|
32
|
+
watchScopePathSet: ScopePathSet;
|
|
33
|
+
},
|
|
34
|
+
) {}
|
|
34
35
|
|
|
35
36
|
async bundleAsync(modifiedFileSet?: Set<TNormPath>): Promise<{
|
|
36
37
|
watchFileSet: Set<TNormPath>;
|
|
@@ -145,7 +146,7 @@ const __dirname = __path__.dirname(__filename);`.trim(),
|
|
|
145
146
|
|
|
146
147
|
for (const assetFile of assetFiles) {
|
|
147
148
|
const prevHash = this.#outputHashCache.get(PathUtils.norm(assetFile.source));
|
|
148
|
-
const currHash = FsUtils.
|
|
149
|
+
const currHash = HashUtils.get(FsUtils.readFileBuffer(assetFile.source));
|
|
149
150
|
if (prevHash !== currHash) {
|
|
150
151
|
FsUtils.copy(
|
|
151
152
|
assetFile.source,
|
|
@@ -155,8 +156,7 @@ const __dirname = __path__.dirname(__filename);`.trim(),
|
|
|
155
156
|
emitFileSet.add(PathUtils.norm(assetFile.destination));
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
|
-
}
|
|
159
|
-
catch (err) {
|
|
159
|
+
} catch (err) {
|
|
160
160
|
result = err;
|
|
161
161
|
for (const e of err.errors) {
|
|
162
162
|
if (e.detail != null) {
|