@simplysm/sd-cli 7.0.26 → 7.0.40
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/.eslintrc.cjs +2 -2
- package/dist/bin/sd-cli.mjs +3 -1
- package/dist/build-tool/SdCliNgCacheCompilerHost.mjs +3 -3
- package/dist/builder/SdCliClientBuilder.d.ts +20 -0
- package/dist/builder/SdCliClientBuilder.mjs +419 -0
- package/dist/builder/SdCliJsLibBuilder.mjs +2 -2
- package/dist/builder/SdCliServerBuilder.d.ts +6 -4
- package/dist/builder/SdCliServerBuilder.mjs +175 -98
- package/dist/builder/SdCliTsLibBuilder.d.ts +5 -3
- package/dist/builder/SdCliTsLibBuilder.mjs +20 -21
- package/dist/commons.d.ts +10 -1
- package/dist/entry-points/SdCliLocalUpdate.mjs +15 -9
- package/dist/entry-points/SdCliNpm.mjs +8 -4
- package/dist/entry-points/SdCliPrepare.mjs +3 -2
- package/dist/entry-points/SdCliWorkspace.d.ts +1 -0
- package/dist/entry-points/SdCliWorkspace.mjs +57 -24
- package/dist/packages/SdCliPackage.d.ts +4 -4
- package/dist/packages/SdCliPackage.mjs +17 -17
- package/dist/utils/SdCliBuildResultUtil.mjs +4 -4
- package/dist/utils/SdCliNpmConfigUtil.d.ts +7 -0
- package/dist/utils/SdCliNpmConfigUtil.mjs +15 -0
- package/package.json +19 -7
- package/src/bin/sd-cli.ts +2 -0
- package/src/build-tool/SdCliNgCacheCompilerHost.ts +3 -3
- package/src/builder/SdCliClientBuilder.ts +453 -0
- package/src/builder/SdCliJsLibBuilder.ts +2 -2
- package/src/builder/SdCliServerBuilder.ts +195 -98
- package/src/builder/SdCliTsLibBuilder.ts +29 -24
- package/src/commons.ts +9 -1
- package/src/entry-points/SdCliLocalUpdate.ts +14 -8
- package/src/entry-points/SdCliNpm.ts +7 -3
- package/src/entry-points/SdCliPrepare.ts +2 -1
- package/src/entry-points/SdCliWorkspace.ts +65 -26
- package/src/packages/SdCliPackage.ts +18 -18
- package/src/utils/SdCliBuildResultUtil.ts +3 -3
- package/src/utils/SdCliNpmConfigUtil.ts +16 -0
- package/tsconfig.json +1 -1
package/src/bin/sd-cli.ts
CHANGED
|
@@ -145,6 +145,7 @@ const logger = Logger.get(["simplysm", "sd-cli", "bin", "sd-cli"]);
|
|
|
145
145
|
confFileRelPath: argv.config ?? "simplysm.json",
|
|
146
146
|
optNames: argv.options ?? []
|
|
147
147
|
});
|
|
148
|
+
process.exit(0);
|
|
148
149
|
}
|
|
149
150
|
else if (argv._[0] === "publish") {
|
|
150
151
|
await new SdCliWorkspace(process.cwd())
|
|
@@ -159,4 +160,5 @@ const logger = Logger.get(["simplysm", "sd-cli", "bin", "sd-cli"]);
|
|
|
159
160
|
}
|
|
160
161
|
})().catch((err) => {
|
|
161
162
|
logger.error(err);
|
|
163
|
+
process.exit(1);
|
|
162
164
|
});
|
|
@@ -17,7 +17,7 @@ export class SdCliNgCacheCompilerHost {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
cacheCompilerHost["transformResource"] = async (data, context) => {
|
|
20
|
-
if (context.resourceFile || context.type !== "style") {
|
|
20
|
+
if (context.resourceFile != null || context.type !== "style") {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -25,10 +25,10 @@ export class SdCliNgCacheCompilerHost {
|
|
|
25
25
|
if (cache.styleContent === undefined) {
|
|
26
26
|
cache.styleContent = (
|
|
27
27
|
await sass.compileStringAsync(data, {
|
|
28
|
-
url: new URL(context.containingFile + ".sd.scss"),
|
|
28
|
+
url: new URL((context.containingFile as string) + ".sd.scss"),
|
|
29
29
|
importer: {
|
|
30
30
|
findFileUrl: (url) => {
|
|
31
|
-
if (!url.startsWith("~")) return
|
|
31
|
+
if (!url.startsWith("~")) return pathToFileURL(url);
|
|
32
32
|
return new URL(url.substring(1), pathToFileURL("node_modules"));
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
import { INpmConfig, ISdCliClientPackageConfig, ISdCliPackageBuildResult } from "../commons";
|
|
2
|
+
import { EventEmitter } from "events";
|
|
3
|
+
import { FsUtil, Logger, PathUtil } from "@simplysm/sd-core-node";
|
|
4
|
+
import webpack from "webpack";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import ts from "typescript";
|
|
7
|
+
import { SdCliBuildResultUtil } from "../utils/SdCliBuildResultUtil";
|
|
8
|
+
import { NamedChunksPlugin } from "@angular-devkit/build-angular/src/webpack/plugins/named-chunks-plugin";
|
|
9
|
+
import {
|
|
10
|
+
AnyComponentStyleBudgetChecker,
|
|
11
|
+
CommonJsUsageWarnPlugin,
|
|
12
|
+
DedupeModuleResolvePlugin,
|
|
13
|
+
SuppressExtractedTextChunksWebpackPlugin
|
|
14
|
+
} from "@angular-devkit/build-angular/src/webpack/plugins";
|
|
15
|
+
import CopyWebpackPlugin from "copy-webpack-plugin";
|
|
16
|
+
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
17
|
+
import { AngularWebpackPlugin } from "@ngtools/webpack";
|
|
18
|
+
import { IndexHtmlWebpackPlugin } from "@angular-devkit/build-angular/src/webpack/plugins/index-html-webpack-plugin";
|
|
19
|
+
import { createHash } from "crypto";
|
|
20
|
+
import { SassWorkerImplementation } from "@angular-devkit/build-angular/src/sass/sass-service";
|
|
21
|
+
import { HmrLoader } from "@angular-devkit/build-angular/src/webpack/plugins/hmr/hmr-loader";
|
|
22
|
+
import wdm from "webpack-dev-middleware";
|
|
23
|
+
import whm from "webpack-hot-middleware";
|
|
24
|
+
import { NextHandleFunction } from "connect";
|
|
25
|
+
import { LicenseWebpackPlugin } from "license-webpack-plugin";
|
|
26
|
+
import { Type } from "@angular-devkit/build-angular";
|
|
27
|
+
import NodePolyfillPlugin from "node-polyfill-webpack-plugin";
|
|
28
|
+
|
|
29
|
+
export class SdCliClientBuilder extends EventEmitter {
|
|
30
|
+
private readonly _logger = Logger.get(["simplysm", "sd-cli", this.constructor.name]);
|
|
31
|
+
|
|
32
|
+
private readonly _tsconfigFilePath: string;
|
|
33
|
+
private readonly _parsedTsconfig: ts.ParsedCommandLine;
|
|
34
|
+
private readonly _npmConfigMap = new Map<string, INpmConfig>();
|
|
35
|
+
|
|
36
|
+
public constructor(private readonly _rootPath: string,
|
|
37
|
+
private readonly _config: ISdCliClientPackageConfig,
|
|
38
|
+
private readonly _workspaceRootPath: string) {
|
|
39
|
+
super();
|
|
40
|
+
|
|
41
|
+
// tsconfig
|
|
42
|
+
this._tsconfigFilePath = path.resolve(this._rootPath, "tsconfig-build.json");
|
|
43
|
+
const tsconfig = FsUtil.readJson(this._tsconfigFilePath);
|
|
44
|
+
this._parsedTsconfig = ts.parseJsonConfigFileContent(tsconfig, ts.sys, this._rootPath);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public override on(event: "change", listener: () => void): this;
|
|
48
|
+
public override on(event: "complete", listener: (results: ISdCliPackageBuildResult[]) => void): this;
|
|
49
|
+
public override on(event: string | symbol, listener: (...args: any[]) => void): this {
|
|
50
|
+
return super.on(event, listener);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public async watchAsync(): Promise<NextHandleFunction[]> {
|
|
54
|
+
// DIST 비우기
|
|
55
|
+
await FsUtil.removeAsync(this._parsedTsconfig.options.outDir!);
|
|
56
|
+
|
|
57
|
+
// 빌드 준비
|
|
58
|
+
const webpackConfig = this._getWebpackConfig(true);
|
|
59
|
+
const compiler = webpack(webpackConfig);
|
|
60
|
+
return await new Promise<NextHandleFunction[]>((resolve, reject) => {
|
|
61
|
+
compiler.hooks.watchRun.tapAsync(this.constructor.name, (args, callback) => {
|
|
62
|
+
this.emit("change");
|
|
63
|
+
callback();
|
|
64
|
+
|
|
65
|
+
this._logger.debug("Webpack 빌드 수행...");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
compiler.hooks.failed.tap(this.constructor.name, (err) => {
|
|
69
|
+
reject(err);
|
|
70
|
+
return;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
compiler.hooks.done.tap(this.constructor.name, (stats) => {
|
|
74
|
+
// 결과 반환
|
|
75
|
+
const results = SdCliBuildResultUtil.convertFromWebpackStats(stats);
|
|
76
|
+
this.emit("complete", results);
|
|
77
|
+
|
|
78
|
+
// 마무리
|
|
79
|
+
this._logger.debug("Webpack 빌드 완료");
|
|
80
|
+
resolve([devMiddleware, hotMiddleware]);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const devMiddleware = wdm(compiler, {
|
|
84
|
+
publicPath: webpackConfig.output!.publicPath as string,
|
|
85
|
+
index: "index.html",
|
|
86
|
+
stats: false
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const hotMiddleware = whm(compiler, {
|
|
90
|
+
path: `${webpackConfig.output!.publicPath as string}__webpack_hmr`,
|
|
91
|
+
log: false
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
public async buildAsync(): Promise<ISdCliPackageBuildResult[]> {
|
|
97
|
+
// DIST 비우기
|
|
98
|
+
await FsUtil.removeAsync(this._parsedTsconfig.options.outDir!);
|
|
99
|
+
|
|
100
|
+
// 빌드
|
|
101
|
+
this._logger.debug("Webpack 빌드 수행...");
|
|
102
|
+
const webpackConfig = this._getWebpackConfig(false);
|
|
103
|
+
const compiler = webpack(webpackConfig);
|
|
104
|
+
const buildResults = await new Promise<ISdCliPackageBuildResult[]>((resolve, reject) => {
|
|
105
|
+
compiler.run((err, stats) => {
|
|
106
|
+
if (err != null || stats == null) {
|
|
107
|
+
reject(err);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// 결과 반환
|
|
112
|
+
const results = SdCliBuildResultUtil.convertFromWebpackStats(stats);
|
|
113
|
+
resolve(results);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// 마무리
|
|
118
|
+
this._logger.debug("Webpack 빌드 완료");
|
|
119
|
+
return buildResults;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private _getWebpackConfig(watch: boolean): webpack.Configuration {
|
|
123
|
+
const npmConfig = this._getNpmConfig(this._rootPath)!;
|
|
124
|
+
const pkgVersion = npmConfig.version;
|
|
125
|
+
|
|
126
|
+
const pkgKey = npmConfig.name.split("/").last()!;
|
|
127
|
+
const publicPath = `/${pkgKey}/`;
|
|
128
|
+
|
|
129
|
+
const cacheBasePath = path.resolve(this._rootPath, ".angular");
|
|
130
|
+
const cachePath = path.resolve(cacheBasePath, pkgVersion);
|
|
131
|
+
|
|
132
|
+
const distPath = this._parsedTsconfig.options.outDir;
|
|
133
|
+
|
|
134
|
+
const sassImplementation = new SassWorkerImplementation();
|
|
135
|
+
|
|
136
|
+
const mainFilePath = path.resolve(this._rootPath, "src/main.ts");
|
|
137
|
+
const polyfillsFilePath = path.resolve(this._rootPath, "src/polyfills.ts");
|
|
138
|
+
const stylesFilePath = path.resolve(this._rootPath, "src/styles.scss");
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
mode: watch ? "development" : "production",
|
|
142
|
+
devtool: false,
|
|
143
|
+
target: ["web", "es2015"],
|
|
144
|
+
profile: false,
|
|
145
|
+
resolve: {
|
|
146
|
+
roots: [this._rootPath],
|
|
147
|
+
extensions: [".ts", ".tsx", ".mjs", ".js"],
|
|
148
|
+
symlinks: true,
|
|
149
|
+
modules: [this._workspaceRootPath, "node_modules"],
|
|
150
|
+
mainFields: ["es2015", "browser", "module", "main"],
|
|
151
|
+
conditionNames: ["es2015", "..."]
|
|
152
|
+
},
|
|
153
|
+
resolveLoader: {
|
|
154
|
+
symlinks: true
|
|
155
|
+
},
|
|
156
|
+
context: this._workspaceRootPath,
|
|
157
|
+
entry: {
|
|
158
|
+
main: [
|
|
159
|
+
...watch ? [
|
|
160
|
+
`webpack-hot-middleware/client?path=${publicPath}__webpack_hmr&timeout=20000&reload=true&overlay=true`
|
|
161
|
+
] : [],
|
|
162
|
+
mainFilePath
|
|
163
|
+
],
|
|
164
|
+
...FsUtil.exists(polyfillsFilePath) ? { polyfills: polyfillsFilePath } : {},
|
|
165
|
+
...FsUtil.exists(stylesFilePath) ? { styles: stylesFilePath } : {}
|
|
166
|
+
},
|
|
167
|
+
output: {
|
|
168
|
+
uniqueName: pkgKey,
|
|
169
|
+
hashFunction: "xxhash64",
|
|
170
|
+
clean: true,
|
|
171
|
+
path: distPath,
|
|
172
|
+
publicPath,
|
|
173
|
+
filename: "[name].js",
|
|
174
|
+
chunkFilename: "[name].js",
|
|
175
|
+
libraryTarget: undefined,
|
|
176
|
+
crossOriginLoading: false,
|
|
177
|
+
trustedTypes: "angular#bundler",
|
|
178
|
+
scriptType: "module"
|
|
179
|
+
},
|
|
180
|
+
watch: false,
|
|
181
|
+
watchOptions: { poll: undefined, ignored: undefined },
|
|
182
|
+
performance: { hints: false },
|
|
183
|
+
ignoreWarnings: [
|
|
184
|
+
/Failed to parse source map from/,
|
|
185
|
+
/Add postcss as project dependency/,
|
|
186
|
+
/"@charset" must be the first rule in the file/
|
|
187
|
+
],
|
|
188
|
+
experiments: { backCompat: false, syncWebAssembly: true, asyncWebAssembly: true },
|
|
189
|
+
infrastructureLogging: { level: "error" },
|
|
190
|
+
stats: "errors-warnings",
|
|
191
|
+
cache: {
|
|
192
|
+
type: "filesystem",
|
|
193
|
+
profile: watch ? undefined : false,
|
|
194
|
+
cacheDirectory: path.resolve(cachePath, "angular-webpack"),
|
|
195
|
+
maxMemoryGenerations: 1,
|
|
196
|
+
name: createHash("sha1").update(pkgVersion).digest("hex")
|
|
197
|
+
},
|
|
198
|
+
node: false,
|
|
199
|
+
optimization: {
|
|
200
|
+
minimizer: [],
|
|
201
|
+
moduleIds: "deterministic",
|
|
202
|
+
chunkIds: watch ? "named" : "deterministic",
|
|
203
|
+
emitOnErrors: watch,
|
|
204
|
+
runtimeChunk: "single",
|
|
205
|
+
splitChunks: {
|
|
206
|
+
maxAsyncRequests: Infinity,
|
|
207
|
+
cacheGroups: {
|
|
208
|
+
default: {
|
|
209
|
+
chunks: "async",
|
|
210
|
+
minChunks: 2,
|
|
211
|
+
priority: 10
|
|
212
|
+
},
|
|
213
|
+
common: {
|
|
214
|
+
name: "common",
|
|
215
|
+
chunks: "async",
|
|
216
|
+
minChunks: 2,
|
|
217
|
+
enforce: true,
|
|
218
|
+
priority: 5
|
|
219
|
+
},
|
|
220
|
+
vendors: false,
|
|
221
|
+
defaultVendors: watch ? {
|
|
222
|
+
name: "vendor",
|
|
223
|
+
chunks: (chunk) => chunk.name === "main",
|
|
224
|
+
enforce: true,
|
|
225
|
+
test: /[\\/]node_modules[\\/]/
|
|
226
|
+
} : false
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
plugins: [
|
|
231
|
+
new NodePolyfillPlugin(),
|
|
232
|
+
new NamedChunksPlugin(),
|
|
233
|
+
new DedupeModuleResolvePlugin(),
|
|
234
|
+
/*new webpack.ProgressPlugin({
|
|
235
|
+
handler: (per: number, msg: string, ...args: string[]) => {
|
|
236
|
+
const phaseText = msg ? ` - phase: ${msg}` : "";
|
|
237
|
+
const argsText = args.length > 0 ? ` - args: [${args.join(", ")}]` : "";
|
|
238
|
+
this._logger.debug(`Webpack 빌드 수행중...(${Math.round(per * 100)}%)${phaseText}${argsText}`);
|
|
239
|
+
}
|
|
240
|
+
}),*/
|
|
241
|
+
new CommonJsUsageWarnPlugin(),
|
|
242
|
+
...watch ? [] : [
|
|
243
|
+
new LicenseWebpackPlugin({
|
|
244
|
+
stats: { warnings: false, errors: false },
|
|
245
|
+
perChunkOutput: false,
|
|
246
|
+
outputFilename: "3rdpartylicenses.txt",
|
|
247
|
+
skipChildCompilers: true
|
|
248
|
+
})
|
|
249
|
+
],
|
|
250
|
+
new CopyWebpackPlugin({
|
|
251
|
+
patterns: [
|
|
252
|
+
...["favicon.ico", "assets/", "manifest.webmanifest"].map((item) => ({
|
|
253
|
+
context: this._rootPath,
|
|
254
|
+
to: item,
|
|
255
|
+
from: `src/${item}`,
|
|
256
|
+
noErrorOnMissing: true,
|
|
257
|
+
force: true,
|
|
258
|
+
globOptions: {
|
|
259
|
+
dot: true,
|
|
260
|
+
followSymbolicLinks: false,
|
|
261
|
+
ignore: [
|
|
262
|
+
".gitkeep",
|
|
263
|
+
"**/.DS_Store",
|
|
264
|
+
"**/Thumbs.db"
|
|
265
|
+
].map((i) => PathUtil.posix(this._rootPath, i))
|
|
266
|
+
},
|
|
267
|
+
priority: 0
|
|
268
|
+
}))
|
|
269
|
+
]
|
|
270
|
+
}),
|
|
271
|
+
...watch ? [
|
|
272
|
+
new webpack.SourceMapDevToolPlugin({
|
|
273
|
+
filename: "[file].map",
|
|
274
|
+
include: [/js$/, /css$/],
|
|
275
|
+
sourceRoot: "webpack:///",
|
|
276
|
+
moduleFilenameTemplate: "[resource-path]",
|
|
277
|
+
append: undefined
|
|
278
|
+
})
|
|
279
|
+
] : [],
|
|
280
|
+
new AngularWebpackPlugin({
|
|
281
|
+
tsconfig: this._tsconfigFilePath,
|
|
282
|
+
compilerOptions: {
|
|
283
|
+
sourceMap: watch,
|
|
284
|
+
declaration: false,
|
|
285
|
+
declarationMap: false,
|
|
286
|
+
preserveSymlinks: false
|
|
287
|
+
},
|
|
288
|
+
jitMode: false,
|
|
289
|
+
emitNgModuleScope: watch,
|
|
290
|
+
inlineStyleFileExtension: "scss"
|
|
291
|
+
}),
|
|
292
|
+
new AnyComponentStyleBudgetChecker(watch ? [] : [
|
|
293
|
+
{ type: Type.AnyComponentStyle, maximumWarning: "2kb", maximumError: "4kb" }
|
|
294
|
+
]),
|
|
295
|
+
{
|
|
296
|
+
apply: (compiler: webpack.Compiler) => {
|
|
297
|
+
compiler.hooks.shutdown.tap("sass-worker", () => {
|
|
298
|
+
sassImplementation.close();
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
new MiniCssExtractPlugin({ filename: "[name].css" }),
|
|
303
|
+
new SuppressExtractedTextChunksWebpackPlugin(),
|
|
304
|
+
// NgBuildAnalyticsPlugin,
|
|
305
|
+
new IndexHtmlWebpackPlugin({
|
|
306
|
+
indexPath: path.resolve(this._rootPath, "src/index.html"),
|
|
307
|
+
outputPath: "index.html",
|
|
308
|
+
baseHref: publicPath,
|
|
309
|
+
entrypoints: [
|
|
310
|
+
["runtime", true],
|
|
311
|
+
["polyfills", true],
|
|
312
|
+
["styles", false],
|
|
313
|
+
["vendor", true],
|
|
314
|
+
["main", true]
|
|
315
|
+
],
|
|
316
|
+
deployUrl: undefined,
|
|
317
|
+
sri: false,
|
|
318
|
+
cache: {
|
|
319
|
+
enabled: true,
|
|
320
|
+
basePath: cacheBasePath,
|
|
321
|
+
path: cachePath
|
|
322
|
+
},
|
|
323
|
+
postTransform: undefined,
|
|
324
|
+
optimization: {
|
|
325
|
+
scripts: !watch,
|
|
326
|
+
styles: { minify: !watch, inlineCritical: !watch },
|
|
327
|
+
fonts: { inline: !watch }
|
|
328
|
+
},
|
|
329
|
+
crossOrigin: "none",
|
|
330
|
+
lang: undefined
|
|
331
|
+
}),
|
|
332
|
+
...watch ? [
|
|
333
|
+
new webpack.HotModuleReplacementPlugin()
|
|
334
|
+
] : []
|
|
335
|
+
] as any[],
|
|
336
|
+
module: {
|
|
337
|
+
strictExportPresence: true,
|
|
338
|
+
parser: { javascript: { url: false, worker: false } },
|
|
339
|
+
rules: [
|
|
340
|
+
{
|
|
341
|
+
test: /\.?(svg|html)$/,
|
|
342
|
+
resourceQuery: /\?ngResource/,
|
|
343
|
+
type: "asset/source"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
test: /[/\\]rxjs[/\\]add[/\\].+\.js$/,
|
|
347
|
+
sideEffects: true
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
test: /\.[cm]?[tj]sx?$/,
|
|
351
|
+
resolve: { fullySpecified: false },
|
|
352
|
+
exclude: [/[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill)[/\\]/],
|
|
353
|
+
use: [
|
|
354
|
+
{
|
|
355
|
+
loader: "@angular-devkit/build-angular/src/babel/webpack-loader",
|
|
356
|
+
options: {
|
|
357
|
+
cacheDirectory: path.resolve(cachePath, "babel-webpack"),
|
|
358
|
+
scriptTarget: ts.ScriptTarget.ES2017,
|
|
359
|
+
aot: true,
|
|
360
|
+
optimize: !watch,
|
|
361
|
+
instrumentCode: undefined
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
]
|
|
365
|
+
},
|
|
366
|
+
...watch ? [
|
|
367
|
+
{
|
|
368
|
+
test: /\.[cm]?jsx?$/,
|
|
369
|
+
enforce: "pre" as const,
|
|
370
|
+
loader: "source-map-loader",
|
|
371
|
+
options: {
|
|
372
|
+
filterSourceMappingUrl: (mapUri: string, resourcePath: string) => {
|
|
373
|
+
return !resourcePath.includes("node_modules") || (/@simplysm[\\/]sd/).test(resourcePath);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
] : [],
|
|
378
|
+
{
|
|
379
|
+
test: /\.[cm]?tsx?$/,
|
|
380
|
+
loader: "@ngtools/webpack",
|
|
381
|
+
exclude: [/[/\\](?:css-loader|mini-css-extract-plugin|webpack-dev-server|webpack)[/\\]/]
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
test: /\.css$/i,
|
|
385
|
+
type: "asset/source"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
test: /\.scss$/i,
|
|
389
|
+
rules: [
|
|
390
|
+
{
|
|
391
|
+
oneOf: [
|
|
392
|
+
{
|
|
393
|
+
use: [
|
|
394
|
+
{
|
|
395
|
+
loader: MiniCssExtractPlugin.loader
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
loader: "css-loader",
|
|
399
|
+
options: { url: false, sourceMap: watch }
|
|
400
|
+
}
|
|
401
|
+
],
|
|
402
|
+
include: [stylesFilePath],
|
|
403
|
+
resourceQuery: { not: [/\?ngResource/] }
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
type: "asset/source",
|
|
407
|
+
resourceQuery: /\?ngResource/
|
|
408
|
+
}
|
|
409
|
+
]
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
use: [
|
|
413
|
+
{
|
|
414
|
+
loader: "resolve-url-loader",
|
|
415
|
+
options: { sourceMap: watch }
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
loader: "sass-loader",
|
|
419
|
+
options: {
|
|
420
|
+
implementation: sassImplementation,
|
|
421
|
+
sourceMap: true,
|
|
422
|
+
sassOptions: {
|
|
423
|
+
fiber: false,
|
|
424
|
+
precision: 8,
|
|
425
|
+
includePaths: [],
|
|
426
|
+
outputStyle: "expanded",
|
|
427
|
+
quietDeps: true,
|
|
428
|
+
verbose: watch ? undefined : false
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
]
|
|
433
|
+
}
|
|
434
|
+
]
|
|
435
|
+
},
|
|
436
|
+
...watch ? [
|
|
437
|
+
{
|
|
438
|
+
loader: HmrLoader,
|
|
439
|
+
include: [mainFilePath]
|
|
440
|
+
}
|
|
441
|
+
] : []
|
|
442
|
+
]
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
private _getNpmConfig(pkgPath: string): INpmConfig | undefined {
|
|
448
|
+
if (!this._npmConfigMap.has(pkgPath)) {
|
|
449
|
+
this._npmConfigMap.set(pkgPath, FsUtil.readJson(path.resolve(pkgPath, "package.json")));
|
|
450
|
+
}
|
|
451
|
+
return this._npmConfigMap.get(pkgPath);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
@@ -25,9 +25,9 @@ export class SdCliJsLibBuilder extends EventEmitter {
|
|
|
25
25
|
|
|
26
26
|
const relatedPaths = await this.getRelatedPathsAsync();
|
|
27
27
|
const watcher = SdFsWatcher.watch(relatedPaths);
|
|
28
|
-
watcher.onChange(async (changeInfos) => {
|
|
28
|
+
watcher.onChange({}, async (changeInfos) => {
|
|
29
29
|
const changeFilePaths = changeInfos.filter((item) => ["add", "change", "unlink"].includes(item.event)).map((item) => item.path);
|
|
30
|
-
if(changeFilePaths.length === 0) return;
|
|
30
|
+
if (changeFilePaths.length === 0) return;
|
|
31
31
|
|
|
32
32
|
this._logger.debug("파일 변경 감지", changeInfos);
|
|
33
33
|
this.emit("change");
|