@simplysm/sd-cli 12.13.52 → 12.13.53
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/SdCliProject.js +4 -1
- package/dist/entry/SdCliProject.js.map +1 -1
- package/dist/pkg-builders/SdProjectBuildRunner.d.ts +2 -0
- package/dist/pkg-builders/SdProjectBuildRunner.js +8 -7
- package/dist/pkg-builders/SdProjectBuildRunner.js.map +1 -1
- package/dist/pkg-builders/client/SdNgBundler.js +1 -1
- package/dist/pkg-builders/client/SdNgBundler.js.map +1 -1
- package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.d.ts +2 -2
- package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.js +15 -11
- package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.js.map +1 -1
- package/dist/pkg-builders/server/SdServerBundler.js +92 -65
- package/dist/pkg-builders/server/SdServerBundler.js.map +1 -1
- package/dist/ts-compiler/SdDepCache.js +11 -11
- package/dist/ts-compiler/SdDepCache.js.map +1 -1
- package/dist/ts-compiler/SdTsCompiler.js.map +1 -1
- package/package.json +5 -5
- package/src/entry/SdCliProject.ts +4 -1
- package/src/pkg-builders/SdProjectBuildRunner.ts +17 -13
- package/src/pkg-builders/client/SdNgBundler.ts +2 -1
- package/src/pkg-builders/lib/SdCliDbContextFileGenerator.ts +25 -13
- package/src/pkg-builders/server/SdServerBundler.ts +92 -68
- package/src/ts-compiler/SdDepCache.ts +11 -11
- package/src/ts-compiler/SdTsCompiler.ts +0 -1
|
@@ -23,72 +23,66 @@ export class SdServerBundler {
|
|
|
23
23
|
|
|
24
24
|
#outputHashCache = new Map<TNormPath, string>();
|
|
25
25
|
|
|
26
|
+
#esbuildOptions: esbuild.BuildOptions;
|
|
27
|
+
|
|
26
28
|
constructor(
|
|
27
29
|
private readonly _opt: ISdTsCompilerOptions,
|
|
28
30
|
private readonly _conf: { external: string[] },
|
|
29
|
-
) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
".mp3": "file",
|
|
85
|
-
".ogg": "file",
|
|
86
|
-
},
|
|
87
|
-
platform: "node",
|
|
88
|
-
logLevel: "silent",
|
|
89
|
-
external: this._conf.external,
|
|
90
|
-
banner: {
|
|
91
|
-
js: `
|
|
31
|
+
) {
|
|
32
|
+
this.#esbuildOptions = {
|
|
33
|
+
entryPoints: [
|
|
34
|
+
path.resolve(this._opt.pkgPath, "src/main.ts"),
|
|
35
|
+
...FsUtils.glob(path.resolve(this._opt.pkgPath, "src/workers/*.ts")),
|
|
36
|
+
],
|
|
37
|
+
keepNames: true,
|
|
38
|
+
bundle: true,
|
|
39
|
+
sourcemap: !!this._opt.watch?.dev,
|
|
40
|
+
target: "node18",
|
|
41
|
+
mainFields: ["es2020", "es2015", "module", "main"],
|
|
42
|
+
conditions: ["es2020", "es2015", "module"],
|
|
43
|
+
tsconfig: path.resolve(this._opt.pkgPath, "tsconfig.json"),
|
|
44
|
+
write: false,
|
|
45
|
+
metafile: true,
|
|
46
|
+
legalComments: this._opt.watch?.dev ? "eof" : "none",
|
|
47
|
+
minifyIdentifiers: !this._opt.watch?.dev,
|
|
48
|
+
minifySyntax: !this._opt.watch?.dev,
|
|
49
|
+
minifyWhitespace: !this._opt.watch?.dev,
|
|
50
|
+
outdir: path.resolve(this._opt.pkgPath, "dist"),
|
|
51
|
+
format: "esm",
|
|
52
|
+
resolveExtensions: [".js", ".mjs", ".cjs", ".ts"],
|
|
53
|
+
preserveSymlinks: false,
|
|
54
|
+
loader: {
|
|
55
|
+
".png": "file",
|
|
56
|
+
".jpeg": "file",
|
|
57
|
+
".jpg": "file",
|
|
58
|
+
".jfif": "file",
|
|
59
|
+
".gif": "file",
|
|
60
|
+
".svg": "file",
|
|
61
|
+
".woff": "file",
|
|
62
|
+
".woff2": "file",
|
|
63
|
+
".ttf": "file",
|
|
64
|
+
".ttc": "file",
|
|
65
|
+
".eot": "file",
|
|
66
|
+
".ico": "file",
|
|
67
|
+
".otf": "file",
|
|
68
|
+
".csv": "file",
|
|
69
|
+
".xlsx": "file",
|
|
70
|
+
".xls": "file",
|
|
71
|
+
".pptx": "file",
|
|
72
|
+
".ppt": "file",
|
|
73
|
+
".docx": "file",
|
|
74
|
+
".doc": "file",
|
|
75
|
+
".zip": "file",
|
|
76
|
+
".pfx": "file",
|
|
77
|
+
".pkl": "file",
|
|
78
|
+
".mp3": "file",
|
|
79
|
+
".ogg": "file",
|
|
80
|
+
},
|
|
81
|
+
platform: "node",
|
|
82
|
+
logLevel: "silent",
|
|
83
|
+
external: this._conf.external,
|
|
84
|
+
banner: {
|
|
85
|
+
js: `
|
|
92
86
|
import __path__ from 'path';
|
|
93
87
|
import { fileURLToPath as __fileURLToPath__ } from 'url';
|
|
94
88
|
import { createRequire as __createRequire__ } from 'module';
|
|
@@ -96,13 +90,43 @@ import { createRequire as __createRequire__ } from 'module';
|
|
|
96
90
|
const require = __createRequire__(import.meta.url);
|
|
97
91
|
const __filename = __fileURLToPath__(import.meta.url);
|
|
98
92
|
const __dirname = __path__.dirname(__filename);`.trim(),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
},
|
|
94
|
+
plugins: [createSdServerPlugin(this._opt, this.#modifiedFileSet, this.#resultCache)],
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async bundleAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
99
|
+
this.#modifiedFileSet.clear();
|
|
100
|
+
if (modifiedFileSet) {
|
|
101
|
+
this.#modifiedFileSet.adds(...modifiedFileSet);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
let esbuildResult: esbuild.BuildResult
|
|
105
|
-
|
|
104
|
+
let esbuildResult: esbuild.BuildResult;
|
|
105
|
+
if (this._opt.watch) {
|
|
106
|
+
if (this.#context == null) {
|
|
107
|
+
this.#context = await esbuild.context(this.#esbuildOptions);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
esbuildResult = await this.#context.rebuild();
|
|
112
|
+
} catch (err) {
|
|
113
|
+
if ("warnings" in err || "errors" in err) {
|
|
114
|
+
esbuildResult = err;
|
|
115
|
+
} else {
|
|
116
|
+
throw err;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
try {
|
|
121
|
+
esbuildResult = await esbuild.build(this.#esbuildOptions);
|
|
122
|
+
} catch (err) {
|
|
123
|
+
if ("warnings" in err || "errors" in err) {
|
|
124
|
+
esbuildResult = err;
|
|
125
|
+
} else {
|
|
126
|
+
throw err;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
106
130
|
|
|
107
131
|
if (this._opt.watch?.noEmit) {
|
|
108
132
|
return {
|
|
@@ -183,14 +183,14 @@ export class SdDepCache {
|
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
185
|
|
|
186
|
-
for (const
|
|
187
|
-
result.add(
|
|
188
|
-
const exportSymbols = this.#getExportSymbols(
|
|
186
|
+
for (const relatedNPath of this.#getRelatedNPaths(modifiedNPath)) {
|
|
187
|
+
result.add(relatedNPath);
|
|
188
|
+
const exportSymbols = this.#getExportSymbols(relatedNPath);
|
|
189
189
|
if (exportSymbols.size === 0) {
|
|
190
|
-
enqueue(
|
|
190
|
+
enqueue(relatedNPath, undefined);
|
|
191
191
|
} else {
|
|
192
192
|
for (const symbol of exportSymbols) {
|
|
193
|
-
enqueue(
|
|
193
|
+
enqueue(relatedNPath, symbol);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
}
|
|
@@ -228,7 +228,7 @@ export class SdDepCache {
|
|
|
228
228
|
* 주어진 파일들 및 그 영향 범위에 해당하는 모든 캐시를 무효화
|
|
229
229
|
*/
|
|
230
230
|
invalidates(fileNPathSet: Set<TNormPath>) {
|
|
231
|
-
const revDepCacheChanged = new Set<TNormPath>();
|
|
231
|
+
// const revDepCacheChanged = new Set<TNormPath>();
|
|
232
232
|
|
|
233
233
|
for (const fileNPath of fileNPathSet) {
|
|
234
234
|
this.#exportCache.delete(fileNPath);
|
|
@@ -237,17 +237,17 @@ export class SdDepCache {
|
|
|
237
237
|
this.#exportSymbolCache.delete(fileNPath);
|
|
238
238
|
this.#collectedCache.delete(fileNPath);
|
|
239
239
|
|
|
240
|
-
if (this.#revDepCache.has(fileNPath)) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
240
|
+
// if (this.#revDepCache.has(fileNPath)) {
|
|
241
|
+
// this.#revDepCache.delete(fileNPath); // 자신이 key인 경우
|
|
242
|
+
// revDepCacheChanged.add(fileNPath);
|
|
243
|
+
// }
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
for (const [targetNPath, infoMap] of this.#revDepCache) {
|
|
247
247
|
for (const fileNPath of fileNPathSet) {
|
|
248
248
|
if (infoMap.has(fileNPath)) {
|
|
249
249
|
infoMap.delete(fileNPath);
|
|
250
|
-
revDepCacheChanged.add(targetNPath);
|
|
250
|
+
// revDepCacheChanged.add(targetNPath);
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
if (infoMap.size === 0) {
|
|
@@ -53,7 +53,6 @@ export class SdTsCompiler {
|
|
|
53
53
|
private readonly _forBundle: boolean,
|
|
54
54
|
) {
|
|
55
55
|
this.#debug("초기화 중...");
|
|
56
|
-
|
|
57
56
|
const tsconfigPath = path.resolve(this._opt.pkgPath, "tsconfig.json");
|
|
58
57
|
const tsconfig = FsUtils.readJson(tsconfigPath);
|
|
59
58
|
this.#isForAngular = Boolean(tsconfig.angularCompilerOptions);
|