@simplysm/sd-cli 12.13.19 → 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.
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.d.ts +1 -0
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js +16 -11
- 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 -17
- package/dist/pkg-builders/client/sd-client.build-runner.js.map +1 -1
- package/dist/pkg-builders/client/sd-ng.bundler.js +105 -95
- package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -1
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js +68 -57
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js.map +1 -1
- package/dist/pkg-builders/commons/build-runner.base.d.ts +2 -1
- package/dist/pkg-builders/commons/build-runner.base.js +16 -27
- 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 +1 -0
- package/dist/pkg-builders/lib/sd-cli-db-context.file-generator.js +21 -11
- 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 +1 -0
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.js +13 -10
- 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 +11 -30
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +1 -1
- package/dist/pkg-builders/server/sd-server.bundler.js +48 -37
- package/dist/pkg-builders/server/sd-server.bundler.js.map +1 -1
- package/dist/ts-compiler/sd-ts-compiler.js +116 -222
- package/dist/ts-compiler/sd-ts-compiler.js.map +1 -1
- package/package.json +5 -5
- package/src/pkg-builders/client/sd-cli-ng-routes.file-generator.ts +18 -8
- package/src/pkg-builders/client/sd-client.build-runner.ts +8 -19
- package/src/pkg-builders/client/sd-ng.bundler.ts +139 -121
- package/src/pkg-builders/client/sd-ng.plugin-creator.ts +22 -17
- package/src/pkg-builders/commons/build-runner.base.ts +62 -75
- package/src/pkg-builders/lib/sd-cli-db-context.file-generator.ts +20 -8
- package/src/pkg-builders/lib/sd-cli-index.file-generator.ts +20 -9
- package/src/pkg-builders/lib/sd-ts-lib.build-runner.ts +11 -31
- package/src/pkg-builders/server/sd-server.bundler.ts +59 -48
- package/src/ts-compiler/sd-ts-compiler.ts +19 -160
|
@@ -30,7 +30,7 @@ export abstract class BuildRunnerBase<
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
constructor(
|
|
33
|
-
|
|
33
|
+
protected _projConf: ISdProjectConfig,
|
|
34
34
|
protected _pkgPath: TNormPath,
|
|
35
35
|
workspaceGlobs: string[],
|
|
36
36
|
protected _emitOnly: boolean,
|
|
@@ -39,12 +39,16 @@ export abstract class BuildRunnerBase<
|
|
|
39
39
|
super();
|
|
40
40
|
|
|
41
41
|
this._pkgName = path.basename(_pkgPath);
|
|
42
|
-
this._pkgConf =
|
|
42
|
+
this._pkgConf = _projConf.packages[this._pkgName] as TSdPackageConfig<T>;
|
|
43
43
|
|
|
44
44
|
const workspacePaths = workspaceGlobs
|
|
45
|
-
.
|
|
45
|
+
.mapMany((item) => [
|
|
46
|
+
PathUtils.posix(this._pkgPath, "../../", item, "src"),
|
|
47
|
+
PathUtils.posix(this._pkgPath, "../../", item, "public"),
|
|
48
|
+
PathUtils.posix(this._pkgPath, "../../", item, "public-dev"),
|
|
49
|
+
])
|
|
46
50
|
.mapMany((item) => FsUtils.glob(item));
|
|
47
|
-
const localUpdatePaths = Object.keys(
|
|
51
|
+
const localUpdatePaths = Object.keys(_projConf.localUpdates ?? {}).mapMany((key) => [
|
|
48
52
|
...FsUtils.glob(path.resolve(this._pkgPath, "../../node_modules", key, "dist")),
|
|
49
53
|
...FsUtils.glob(path.resolve(this._pkgPath, "../../node_modules", key, "src/**/*.scss")),
|
|
50
54
|
]);
|
|
@@ -94,87 +98,70 @@ export abstract class BuildRunnerBase<
|
|
|
94
98
|
this.emit("complete", res);
|
|
95
99
|
|
|
96
100
|
this._debug("WATCH...");
|
|
97
|
-
let lastWatchFileSet = result.watchFileSet;
|
|
98
|
-
SdFsWatcher.watch(this._watchScopePathSet.toArray(), {
|
|
99
|
-
ignore: (filePath) =>
|
|
100
|
-
(this._pkgConf.type === "client" &&
|
|
101
|
-
path.dirname(path.basename(filePath)) === "src" &&
|
|
102
|
-
path.basename(filePath) === `routes.ts`) ||
|
|
103
|
-
(this._pkgConf.type === "library" &&
|
|
104
|
-
this._pkgConf.dbContext != null &&
|
|
105
|
-
path.dirname(path.basename(filePath)) === "src" &&
|
|
106
|
-
path.basename(filePath) === `${this._pkgConf.dbContext}.ts`) ||
|
|
107
|
-
(this._pkgConf.type === "library" &&
|
|
108
|
-
!this._pkgConf.noGenIndex &&
|
|
109
|
-
path.dirname(path.basename(filePath)) === "src" &&
|
|
110
|
-
path.basename(filePath) === "index.ts"),
|
|
111
|
-
}).onChange({ delay: 100 }, async (changeInfos) => {
|
|
112
|
-
const modifiedFileSet = this._getModifiedFileSet(changeInfos, lastWatchFileSet);
|
|
113
|
-
|
|
114
|
-
if (modifiedFileSet.size < 1) return;
|
|
115
|
-
|
|
116
|
-
this.emit("change");
|
|
117
|
-
|
|
118
|
-
let watchResult: IBuildRunnerRunResult;
|
|
119
|
-
try {
|
|
120
|
-
watchResult = await this._runAsync(
|
|
121
|
-
!this._pkgConf.forceProductionMode,
|
|
122
|
-
this._emitOnly,
|
|
123
|
-
this._noEmit,
|
|
124
|
-
modifiedFileSet,
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
lastWatchFileSet = watchResult.watchFileSet;
|
|
128
|
-
} catch (err) {
|
|
129
|
-
watchResult = {
|
|
130
|
-
affectedFileSet: modifiedFileSet,
|
|
131
|
-
buildMessages: [
|
|
132
|
-
{
|
|
133
|
-
filePath: undefined,
|
|
134
|
-
line: undefined,
|
|
135
|
-
char: undefined,
|
|
136
|
-
code: undefined,
|
|
137
|
-
severity: "error",
|
|
138
|
-
message: `파일 변경 처리 중 오류 발생: ${err}`,
|
|
139
|
-
type: "watch",
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
emitFileSet: new Set(),
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
101
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
102
|
+
let lastWatchFileSet = result.watchFileSet;
|
|
103
|
+
SdFsWatcher.watch(this._watchScopePathSet.toArray()).onChange(
|
|
104
|
+
{ delay: 300 },
|
|
105
|
+
async (changeInfos) => {
|
|
106
|
+
const modifiedFileSet = this._getModifiedFileSet(changeInfos, lastWatchFileSet);
|
|
107
|
+
|
|
108
|
+
if (modifiedFileSet.size < 1) return;
|
|
109
|
+
|
|
110
|
+
this.emit("change");
|
|
111
|
+
|
|
112
|
+
let watchResult: IBuildRunnerRunResult;
|
|
113
|
+
try {
|
|
114
|
+
watchResult = await this._runAsync(
|
|
115
|
+
!this._pkgConf.forceProductionMode,
|
|
116
|
+
this._emitOnly,
|
|
117
|
+
this._noEmit,
|
|
118
|
+
modifiedFileSet,
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
lastWatchFileSet = watchResult.watchFileSet;
|
|
122
|
+
} catch (err) {
|
|
123
|
+
watchResult = {
|
|
124
|
+
affectedFileSet: modifiedFileSet,
|
|
125
|
+
buildMessages: [
|
|
126
|
+
{
|
|
127
|
+
filePath: undefined,
|
|
128
|
+
line: undefined,
|
|
129
|
+
char: undefined,
|
|
130
|
+
code: undefined,
|
|
131
|
+
severity: "error",
|
|
132
|
+
message: `파일 변경 처리 중 오류 발생: ${err}`,
|
|
133
|
+
type: "watch",
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
emitFileSet: new Set(),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
this.emit("complete", {
|
|
141
|
+
affectedFilePathSet: watchResult.affectedFileSet,
|
|
142
|
+
buildMessages: watchResult.buildMessages,
|
|
143
|
+
emitFileSet: watchResult.emitFileSet,
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
);
|
|
152
147
|
}
|
|
153
148
|
|
|
154
149
|
protected _getModifiedFileSet(
|
|
155
150
|
changeInfos: ISdFsWatcherChangeInfo[],
|
|
156
151
|
lastWatchFileSet?: Set<TNormPath>,
|
|
157
152
|
) {
|
|
153
|
+
let arr: TNormPath[];
|
|
158
154
|
if (!lastWatchFileSet) {
|
|
159
|
-
|
|
155
|
+
arr = changeInfos.map((item) => item.path);
|
|
160
156
|
} else {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
item.path.startsWith(path.dirname(item1)),
|
|
167
|
-
) ||
|
|
168
|
-
((this._pkgConf.type === "client" ||
|
|
169
|
-
(this._pkgConf.type === "library" && this._pkgConf.dbContext != null) ||
|
|
170
|
-
(this._pkgConf.type === "library" && this._pkgConf.noGenIndex)) &&
|
|
171
|
-
item.path.startsWith(path.resolve(this._pkgPath, "src")) &&
|
|
172
|
-
item.path.endsWith(".ts") &&
|
|
173
|
-
item.event === "add"),
|
|
174
|
-
)
|
|
175
|
-
.map((item) => item.path),
|
|
176
|
-
);
|
|
157
|
+
arr = changeInfos
|
|
158
|
+
.filter((item) =>
|
|
159
|
+
Array.from(lastWatchFileSet).some((item1) => item.path.startsWith(path.dirname(item1))),
|
|
160
|
+
)
|
|
161
|
+
.map((item) => item.path);
|
|
177
162
|
}
|
|
163
|
+
|
|
164
|
+
return new Set(arr);
|
|
178
165
|
}
|
|
179
166
|
|
|
180
167
|
protected abstract _runAsync(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FsUtils, HashUtils, PathUtils } 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";
|
|
@@ -6,16 +6,21 @@ import { INpmConfig } from "../../types/common-configs.types";
|
|
|
6
6
|
export class SdCliDbContextFileGenerator {
|
|
7
7
|
cachedHash?: string;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
watch(pkgPath: string, kebabName: string) {
|
|
10
10
|
const targetFilePath = path.resolve(pkgPath, `src/${kebabName}.ts`);
|
|
11
|
-
this.cachedHash = FsUtils.exists(targetFilePath)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
this.cachedHash = FsUtils.exists(targetFilePath)
|
|
12
|
+
? HashUtils.get(FsUtils.readFile(targetFilePath))
|
|
13
|
+
: undefined;
|
|
14
|
+
|
|
15
|
+
SdFsWatcher.watch([path.resolve(pkgPath, "src")], {
|
|
16
|
+
ignored: [targetFilePath],
|
|
17
|
+
}).onChange({ delay: 50 }, (changeInfos) => {
|
|
18
|
+
if (changeInfos.some((item) => ["add", "addDir", "unlink", "unlinkDir"].includes(item.event)))
|
|
19
|
+
this.run(pkgPath, kebabName);
|
|
15
20
|
});
|
|
16
21
|
|
|
17
22
|
this.run(pkgPath, kebabName);
|
|
18
|
-
}
|
|
23
|
+
}
|
|
19
24
|
|
|
20
25
|
run(pkgPath: string, kebabName: string): { changed: boolean; filePath: string; content: string } {
|
|
21
26
|
const npmConfig = FsUtils.readJson(path.resolve(pkgPath, "package.json")) as INpmConfig;
|
|
@@ -68,7 +73,14 @@ export class SdCliDbContextFileGenerator {
|
|
|
68
73
|
importTexts.push(`import { ${className} } from "./${requirePath}";`);
|
|
69
74
|
if (
|
|
70
75
|
useExt &&
|
|
71
|
-
[
|
|
76
|
+
[
|
|
77
|
+
"systemDataLog",
|
|
78
|
+
"systemLog",
|
|
79
|
+
"authentication",
|
|
80
|
+
"user",
|
|
81
|
+
"userConfig",
|
|
82
|
+
"userPermission",
|
|
83
|
+
].includes(varName)
|
|
72
84
|
) {
|
|
73
85
|
modelTexts.push(`override ${varName} = new Queryable(this, ${className})`);
|
|
74
86
|
} else {
|
|
@@ -1,21 +1,29 @@
|
|
|
1
|
-
import { FsUtils, HashUtils, PathUtils } 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
6
|
|
|
7
|
-
|
|
7
|
+
watch(pkgPath: string, polyfills?: string[]) {
|
|
8
8
|
const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
9
|
-
this.cachedHash = FsUtils.exists(indexFilePath)
|
|
9
|
+
this.cachedHash = FsUtils.exists(indexFilePath)
|
|
10
|
+
? HashUtils.get(FsUtils.readFile(indexFilePath))
|
|
11
|
+
: undefined;
|
|
10
12
|
|
|
11
|
-
SdFsWatcher.watch([path.resolve(pkgPath, "src")]
|
|
12
|
-
|
|
13
|
+
SdFsWatcher.watch([path.resolve(pkgPath, "src")], {
|
|
14
|
+
ignored: [indexFilePath],
|
|
15
|
+
}).onChange({ delay: 50 }, (changeInfos) => {
|
|
16
|
+
if (changeInfos.some((item) => ["add", "addDir", "unlink", "unlinkDir"].includes(item.event)))
|
|
17
|
+
this.run(pkgPath, polyfills);
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
this.run(pkgPath, polyfills);
|
|
16
|
-
}
|
|
21
|
+
}
|
|
17
22
|
|
|
18
|
-
run(
|
|
23
|
+
run(
|
|
24
|
+
pkgPath: string,
|
|
25
|
+
polyfills?: string[],
|
|
26
|
+
): { changed: boolean; filePath: string; content: string } {
|
|
19
27
|
const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
20
28
|
|
|
21
29
|
const importTexts: string[] = [];
|
|
@@ -57,11 +65,14 @@ export class SdCliIndexFileGenerator {
|
|
|
57
65
|
const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
58
66
|
|
|
59
67
|
const tsconfig = FsUtils.readJson(path.resolve(pkgPath, "tsconfig.json"));
|
|
60
|
-
const entryFilePaths: string[] =
|
|
68
|
+
const entryFilePaths: string[] =
|
|
69
|
+
tsconfig.files?.map((item) => path.resolve(pkgPath, item)) ?? [];
|
|
61
70
|
|
|
62
71
|
return FsUtils.glob(path.resolve(pkgPath, "src/**/*{.ts,.tsx}"), {
|
|
63
72
|
nodir: true,
|
|
64
73
|
ignore: tsconfig.excludes,
|
|
65
|
-
}).filter(
|
|
74
|
+
}).filter(
|
|
75
|
+
(item) => !entryFilePaths.includes(item) && item !== indexFilePath && !item.endsWith(".d.ts"),
|
|
76
|
+
);
|
|
66
77
|
}
|
|
67
78
|
}
|
|
@@ -7,41 +7,28 @@ 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", "SdTsLibBuildRunner"]);
|
|
9
9
|
|
|
10
|
-
#indexFileGenerator = new SdCliIndexFileGenerator();
|
|
11
|
-
#dbContextGenerator = new SdCliDbContextFileGenerator();
|
|
12
10
|
#builder?: SdTsLibBuilder;
|
|
13
11
|
|
|
14
|
-
#hasGenIndexError = false;
|
|
15
|
-
#hasGenDbContextError = false;
|
|
16
|
-
|
|
17
12
|
protected override async _runAsync(
|
|
18
13
|
dev: boolean,
|
|
19
14
|
emitOnly: boolean,
|
|
20
15
|
noEmit: boolean,
|
|
21
16
|
modifiedFileSet?: Set<TNormPath>,
|
|
22
17
|
): Promise<IBuildRunnerRunResult> {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
modifiedFileSet.add(PathUtils.norm(genIndexResult.filePath));
|
|
18
|
+
// 최초한번
|
|
19
|
+
if (!modifiedFileSet) {
|
|
20
|
+
if (!noEmit) {
|
|
21
|
+
// index
|
|
22
|
+
if (!this._pkgConf.noGenIndex) {
|
|
23
|
+
this._debug("GEN index.ts...");
|
|
24
|
+
new SdCliIndexFileGenerator().watch(this._pkgPath, this._pkgConf.polyfills);
|
|
31
25
|
}
|
|
32
|
-
indexFileNPath = PathUtils.norm(genIndexResult.filePath);
|
|
33
|
-
}
|
|
34
26
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this._pkgPath,
|
|
39
|
-
this._pkgConf.dbContext,
|
|
40
|
-
);
|
|
41
|
-
if (modifiedFileSet && (genDbContextResult.changed || this.#hasGenDbContextError)) {
|
|
42
|
-
modifiedFileSet.add(PathUtils.norm(genDbContextResult.filePath));
|
|
27
|
+
// db-context
|
|
28
|
+
if (this._pkgConf.dbContext != null) {
|
|
29
|
+
this._debug(`GEN ${this._pkgConf.dbContext}.ts...`);
|
|
30
|
+
new SdCliDbContextFileGenerator().watch(this._pkgPath, this._pkgConf.dbContext);
|
|
43
31
|
}
|
|
44
|
-
dbContentFileNPath = PathUtils.norm(genDbContextResult.filePath);
|
|
45
32
|
}
|
|
46
33
|
}
|
|
47
34
|
|
|
@@ -55,13 +42,6 @@ export class SdTsLibBuildRunner extends BuildRunnerBase<"library"> {
|
|
|
55
42
|
);
|
|
56
43
|
const buildResult = await this.#builder.buildAsync(modifiedFileSet ?? new Set());
|
|
57
44
|
|
|
58
|
-
this.#hasGenIndexError =
|
|
59
|
-
indexFileNPath != null &&
|
|
60
|
-
buildResult.results.map((item) => item.filePath).includes(indexFileNPath);
|
|
61
|
-
this.#hasGenDbContextError =
|
|
62
|
-
dbContentFileNPath != null &&
|
|
63
|
-
buildResult.results.map((item) => item.filePath).includes(dbContentFileNPath);
|
|
64
|
-
|
|
65
45
|
this._debug(`빌드 완료`);
|
|
66
46
|
const watchFileSet = new Set(
|
|
67
47
|
Array.from(buildResult.watchFileSet).filter((item) => this._watchScopePathSet.inScope(item)),
|
|
@@ -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
|
-
|
|
126
|
-
result = await this.#context.rebuild();
|
|
124
|
+
result = await this.#context.rebuild();
|
|
127
125
|
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
this
|
|
138
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
}
|