@simplysm/sd-cli 12.5.11 → 12.5.13
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/build-tools/SdNgBundler.js +2 -0
- package/dist/build-tools/SdNgBundler.js.map +1 -1
- package/dist/build-tools/SdTsCompiler.js +1 -1
- package/dist/build-tools/SdTsCompiler.js.map +1 -1
- package/dist/builders/SdCliClientBuilder.js +19 -41
- package/dist/builders/SdCliClientBuilder.js.map +1 -1
- package/dist/commons.d.ts +1 -0
- package/dist/entry/SdCliProject.js +1 -1
- package/dist/entry/SdCliProject.js.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/package.json +15 -20
- package/src/build-tools/SdNgBundler.ts +2 -0
- package/src/build-tools/SdTsCompiler.ts +1 -1
- package/src/builders/SdCliClientBuilder.ts +24 -49
- package/src/commons.ts +12 -8
- package/src/entry/SdCliProject.ts +1 -1
- package/src/index.ts +0 -3
- package/dist/build-tools/SdReactBundler.d.ts +0 -24
- package/dist/build-tools/SdReactBundler.js +0 -267
- package/dist/build-tools/SdReactBundler.js.map +0 -1
- package/dist/build-tools/SdReactBundlerContext.d.ts +0 -14
- package/dist/build-tools/SdReactBundlerContext.js +0 -59
- package/dist/build-tools/SdReactBundlerContext.js.map +0 -1
- package/dist/bundle-plugins/sdReactPlugin.d.ts +0 -15
- package/dist/bundle-plugins/sdReactPlugin.js +0 -111
- package/dist/bundle-plugins/sdReactPlugin.js.map +0 -1
- package/src/build-tools/SdReactBundler.ts +0 -339
- package/src/build-tools/SdReactBundlerContext.ts +0 -71
- package/src/bundle-plugins/sdReactPlugin.ts +0 -157
|
@@ -14,7 +14,6 @@ import { SdCliCordova } from "../build-tools/SdCliCordova";
|
|
|
14
14
|
import { SdCliNgRoutesFileGenerator } from "../build-tools/SdCliNgRoutesFileGenerator";
|
|
15
15
|
import { SdLinter } from "../build-tools/SdLinter";
|
|
16
16
|
import { SdCliElectron } from "../entry/SdCliElectron";
|
|
17
|
-
import { SdReactBundler } from "../build-tools/SdReactBundler";
|
|
18
17
|
|
|
19
18
|
// import ts from "typescript";
|
|
20
19
|
|
|
@@ -22,7 +21,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
22
21
|
private readonly _logger = Logger.get(["simplysm", "sd-cli", "SdCliClientBuilder"]);
|
|
23
22
|
private readonly _pkgConf: ISdCliClientPackageConfig;
|
|
24
23
|
private readonly _npmConf: INpmConfig;
|
|
25
|
-
private _builders?:
|
|
24
|
+
private _builders?: SdNgBundler[];
|
|
26
25
|
private _cordova?: SdCliCordova;
|
|
27
26
|
|
|
28
27
|
// #program?: ts.Program;
|
|
@@ -78,7 +77,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
78
77
|
const confDistPath = path.resolve(this._pkgPath, "dist/.config.json");
|
|
79
78
|
await FsUtil.writeFileAsync(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
|
|
80
79
|
|
|
81
|
-
const result = await this._runAsync({ dev:
|
|
80
|
+
const result = await this._runAsync({ dev: !this._pkgConf.forceProductionMode });
|
|
82
81
|
this.emit("complete", {
|
|
83
82
|
affectedFilePaths: Array.from(result.affectedFileSet),
|
|
84
83
|
buildResults: result.buildResults,
|
|
@@ -101,7 +100,7 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
101
100
|
builder.markForChanges(currChangeFiles);
|
|
102
101
|
}
|
|
103
102
|
|
|
104
|
-
const watchResult = await this._runAsync({ dev:
|
|
103
|
+
const watchResult = await this._runAsync({ dev: !this._pkgConf.forceProductionMode });
|
|
105
104
|
this.emit("complete", {
|
|
106
105
|
affectedFilePaths: Array.from(watchResult.affectedFileSet),
|
|
107
106
|
buildResults: watchResult.buildResults,
|
|
@@ -130,51 +129,27 @@ export class SdCliClientBuilder extends EventEmitter {
|
|
|
130
129
|
if (!this._builders) {
|
|
131
130
|
this._debug(`BUILD 준비...`);
|
|
132
131
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
env
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
);
|
|
155
|
-
} else {
|
|
156
|
-
this._builders = builderTypes.map(
|
|
157
|
-
(builderType) =>
|
|
158
|
-
new SdNgBundler({
|
|
159
|
-
dev: opt.dev,
|
|
160
|
-
builderType: builderType,
|
|
161
|
-
pkgPath: this._pkgPath,
|
|
162
|
-
outputPath:
|
|
163
|
-
builderType === "web"
|
|
164
|
-
? path.resolve(this._pkgPath, "dist")
|
|
165
|
-
: builderType === "electron" && !opt.dev
|
|
166
|
-
? path.resolve(this._pkgPath, ".electron/src")
|
|
167
|
-
: builderType === "cordova" && !opt.dev
|
|
168
|
-
? path.resolve(this._pkgPath, ".cordova/www")
|
|
169
|
-
: path.resolve(this._pkgPath, "dist", builderType),
|
|
170
|
-
env: {
|
|
171
|
-
...this._pkgConf.env,
|
|
172
|
-
...this._pkgConf.builder?.[builderType]?.env,
|
|
173
|
-
},
|
|
174
|
-
cordovaConfig: builderType === "cordova" ? this._pkgConf.builder!.cordova : undefined,
|
|
175
|
-
}),
|
|
176
|
-
);
|
|
177
|
-
}
|
|
132
|
+
this._builders = builderTypes.map(
|
|
133
|
+
(builderType) =>
|
|
134
|
+
new SdNgBundler({
|
|
135
|
+
dev: opt.dev,
|
|
136
|
+
builderType: builderType,
|
|
137
|
+
pkgPath: this._pkgPath,
|
|
138
|
+
outputPath:
|
|
139
|
+
builderType === "web"
|
|
140
|
+
? path.resolve(this._pkgPath, "dist")
|
|
141
|
+
: builderType === "electron" && !opt.dev
|
|
142
|
+
? path.resolve(this._pkgPath, ".electron/src")
|
|
143
|
+
: builderType === "cordova" && !opt.dev
|
|
144
|
+
? path.resolve(this._pkgPath, ".cordova/www")
|
|
145
|
+
: path.resolve(this._pkgPath, "dist", builderType),
|
|
146
|
+
env: {
|
|
147
|
+
...this._pkgConf.env,
|
|
148
|
+
...this._pkgConf.builder?.[builderType]?.env,
|
|
149
|
+
},
|
|
150
|
+
cordovaConfig: builderType === "cordova" ? this._pkgConf.builder!.cordova : undefined,
|
|
151
|
+
}),
|
|
152
|
+
);
|
|
178
153
|
}
|
|
179
154
|
|
|
180
155
|
this._debug(`BUILD & CHECK...`);
|
package/src/commons.ts
CHANGED
|
@@ -8,9 +8,12 @@ export interface INpmConfig {
|
|
|
8
8
|
optionalDependencies?: Record<string, string>;
|
|
9
9
|
devDependencies?: Record<string, string>;
|
|
10
10
|
peerDependencies?: Record<string, string>;
|
|
11
|
-
peerDependenciesMeta?: Record<
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
peerDependenciesMeta?: Record<
|
|
12
|
+
string,
|
|
13
|
+
{
|
|
14
|
+
optional?: boolean;
|
|
15
|
+
}
|
|
16
|
+
>;
|
|
14
17
|
|
|
15
18
|
resolutions?: Record<string, string>;
|
|
16
19
|
|
|
@@ -18,7 +21,7 @@ export interface INpmConfig {
|
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export interface ITsConfig {
|
|
21
|
-
files?: string[]
|
|
24
|
+
files?: string[];
|
|
22
25
|
compilerOptions: { lib: string[] };
|
|
23
26
|
angularCompilerOptions?: {};
|
|
24
27
|
}
|
|
@@ -83,7 +86,7 @@ export interface ISdCliServerPackageConfig {
|
|
|
83
86
|
};
|
|
84
87
|
iis?: {
|
|
85
88
|
nodeExeFilePath?: string;
|
|
86
|
-
}
|
|
89
|
+
};
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
export interface ISdCliClientPackageConfig {
|
|
@@ -93,12 +96,13 @@ export interface ISdCliClientPackageConfig {
|
|
|
93
96
|
env?: Record<string, string>;
|
|
94
97
|
configs?: Record<string, any>;
|
|
95
98
|
noLazyRoute?: boolean;
|
|
99
|
+
forceProductionMode?: boolean;
|
|
96
100
|
|
|
97
101
|
builder?: {
|
|
98
102
|
web?: ISdCliClientBuilderWebConfig;
|
|
99
103
|
electron?: ISdCliClientBuilderElectronConfig;
|
|
100
104
|
cordova?: ISdCliClientBuilderCordovaConfig;
|
|
101
|
-
}
|
|
105
|
+
};
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
export interface ISdCliLocalDirectoryPublishConfig {
|
|
@@ -153,7 +157,7 @@ export interface ISdCliClientBuilderCordovaConfig {
|
|
|
153
157
|
name: string;
|
|
154
158
|
maxSdkVersion?: number;
|
|
155
159
|
}[];
|
|
156
|
-
}
|
|
160
|
+
};
|
|
157
161
|
};
|
|
158
162
|
env?: Record<string, string>;
|
|
159
163
|
browserslist?: string[];
|
|
@@ -164,4 +168,4 @@ export type TSdCliPostPublishConfig = ISdCliPostPublishScriptConfig;
|
|
|
164
168
|
export interface ISdCliPostPublishScriptConfig {
|
|
165
169
|
type: "script";
|
|
166
170
|
script: string;
|
|
167
|
-
}
|
|
171
|
+
}
|
|
@@ -530,7 +530,7 @@ export class SdCliProject {
|
|
|
530
530
|
logger.info("모든 빌드가 완료되었습니다.");
|
|
531
531
|
}
|
|
532
532
|
|
|
533
|
-
//
|
|
533
|
+
// piscina 사용시 ts파일을 못찾으므로 그냥 이렇게..
|
|
534
534
|
private static async _prepareClusterAsync(): Promise<cp.ChildProcess> {
|
|
535
535
|
const logger = Logger.get(["simplysm", "sd-cli", "SdCliProject", "_runBuildClusterAsync"]);
|
|
536
536
|
return await new Promise<cp.ChildProcess>((resolve, reject) => {
|
package/src/index.ts
CHANGED
|
@@ -4,8 +4,6 @@ export * from "./build-tools/SdCliNgRoutesFileGenerator";
|
|
|
4
4
|
export * from "./build-tools/SdLinter";
|
|
5
5
|
export * from "./build-tools/SdNgBundler";
|
|
6
6
|
export * from "./build-tools/SdNgBundlerContext";
|
|
7
|
-
export * from "./build-tools/SdReactBundler";
|
|
8
|
-
export * from "./build-tools/SdReactBundlerContext";
|
|
9
7
|
export * from "./build-tools/SdServerBundler";
|
|
10
8
|
export * from "./build-tools/SdTsCompiler";
|
|
11
9
|
export * from "./build-tools/SdTsLibBundler";
|
|
@@ -15,7 +13,6 @@ export * from "./builders/SdCliServerBuilder";
|
|
|
15
13
|
export * from "./builders/SdCliTsLibBuilder";
|
|
16
14
|
export * from "./bundle-plugins/KeysTransformer";
|
|
17
15
|
export * from "./bundle-plugins/sdNgPlugin";
|
|
18
|
-
export * from "./bundle-plugins/sdReactPlugin";
|
|
19
16
|
export * from "./bundle-plugins/sdServerPlugin";
|
|
20
17
|
export * from "./commons";
|
|
21
18
|
export * from "./entry/SdCliElectron";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ISdCliClientBuilderCordovaConfig, ISdCliPackageBuildResult } from "../commons";
|
|
2
|
-
import ts from "typescript";
|
|
3
|
-
export declare class SdReactBundler {
|
|
4
|
-
#private;
|
|
5
|
-
constructor(opt: IOptions);
|
|
6
|
-
markForChanges(filePaths: string[]): void;
|
|
7
|
-
bundleAsync(): Promise<{
|
|
8
|
-
program?: ts.Program;
|
|
9
|
-
watchFileSet: Set<string>;
|
|
10
|
-
affectedFileSet: Set<string>;
|
|
11
|
-
results: ISdCliPackageBuildResult[];
|
|
12
|
-
}>;
|
|
13
|
-
private _getAppContext;
|
|
14
|
-
private _getElectronMainContext;
|
|
15
|
-
}
|
|
16
|
-
interface IOptions {
|
|
17
|
-
dev: boolean;
|
|
18
|
-
outputPath: string;
|
|
19
|
-
pkgPath: string;
|
|
20
|
-
builderType: string;
|
|
21
|
-
env: Record<string, string> | undefined;
|
|
22
|
-
cordovaConfig: ISdCliClientBuilderCordovaConfig | undefined;
|
|
23
|
-
}
|
|
24
|
-
export {};
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { FsUtil, Logger, PathUtil } from "@simplysm/sd-core-node";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import nodeStdLibBrowser from "node-stdlib-browser";
|
|
5
|
-
import nodeStdLibBrowserPlugin from "node-stdlib-browser/helpers/esbuild/plugin";
|
|
6
|
-
import { SdReactBundlerContext } from "./SdReactBundlerContext";
|
|
7
|
-
import { sdReactPlugin } from "../bundle-plugins/sdReactPlugin";
|
|
8
|
-
import { transformSupportedBrowsersToTargets } from "@angular/build/src/tools/esbuild/utils";
|
|
9
|
-
import browserslist from "browserslist";
|
|
10
|
-
import { glob } from "glob";
|
|
11
|
-
import { generateSW } from "workbox-build";
|
|
12
|
-
export class SdReactBundler {
|
|
13
|
-
#logger = Logger.get(["simplysm", "sd-cli", "SdNgBundler"]);
|
|
14
|
-
#modifiedFileSet = new Set();
|
|
15
|
-
#compileResultCache = {
|
|
16
|
-
affectedFileSet: new Set(),
|
|
17
|
-
watchFileSet: new Set(),
|
|
18
|
-
};
|
|
19
|
-
#contexts;
|
|
20
|
-
#outputCache = new Map();
|
|
21
|
-
#opt;
|
|
22
|
-
#pkgNpmConf;
|
|
23
|
-
#indexFilePath;
|
|
24
|
-
#tsConfigFilePath;
|
|
25
|
-
#browserTarget;
|
|
26
|
-
constructor(opt) {
|
|
27
|
-
this.#opt = opt;
|
|
28
|
-
this.#pkgNpmConf = FsUtil.readJson(path.resolve(opt.pkgPath, "package.json"));
|
|
29
|
-
this.#indexFilePath = path.resolve(opt.pkgPath, "src/index.tsx");
|
|
30
|
-
this.#tsConfigFilePath = path.resolve(opt.pkgPath, "tsconfig.json");
|
|
31
|
-
this.#browserTarget = transformSupportedBrowsersToTargets(browserslist(["Chrome > 78"]));
|
|
32
|
-
}
|
|
33
|
-
markForChanges(filePaths) {
|
|
34
|
-
for (const filePath of filePaths) {
|
|
35
|
-
this.#modifiedFileSet.add(path.normalize(filePath));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
async bundleAsync() {
|
|
39
|
-
this.#debug(`get contexts...`);
|
|
40
|
-
if (!this.#contexts) {
|
|
41
|
-
this.#contexts = [
|
|
42
|
-
this._getAppContext(),
|
|
43
|
-
...(this.#opt.builderType === "electron" ? [this._getElectronMainContext()] : []),
|
|
44
|
-
];
|
|
45
|
-
}
|
|
46
|
-
this.#debug(`build...`);
|
|
47
|
-
const bundlingResults = await this.#contexts.mapAsync(async (ctx, i) => await ctx.bundleAsync());
|
|
48
|
-
//-- results
|
|
49
|
-
const results = bundlingResults.mapMany((bundlingResult) => bundlingResult.results);
|
|
50
|
-
this.#debug(`convert result...`);
|
|
51
|
-
const outputFiles = bundlingResults
|
|
52
|
-
.mapMany((item) => item.outputFiles ?? [])
|
|
53
|
-
.map((item) => ({
|
|
54
|
-
relPath: path.relative(this.#opt.pkgPath, item.path),
|
|
55
|
-
contents: item.contents,
|
|
56
|
-
}));
|
|
57
|
-
// cordova empty
|
|
58
|
-
if (this.#opt.builderType === "cordova" && this.#opt.cordovaConfig?.plugins) {
|
|
59
|
-
outputFiles.push({ relPath: "cordova-empty.js", contents: "export default {};" });
|
|
60
|
-
}
|
|
61
|
-
// index.html
|
|
62
|
-
let indexHtml = await FsUtil.readFileAsync(path.resolve(this.#opt.pkgPath, "src/index.html"));
|
|
63
|
-
indexHtml = indexHtml.replace(/<\/head>/, '<script type="module" src="index.js"></script></head>');
|
|
64
|
-
if (this.#opt.builderType === "cordova") {
|
|
65
|
-
indexHtml = indexHtml.replace(/(.*)<\/head>/, '<script type="module" src="cordova-entry.js"></script>\n$1</head>');
|
|
66
|
-
}
|
|
67
|
-
if (outputFiles.some((item) => item.relPath === "index.css")) {
|
|
68
|
-
indexHtml = indexHtml.replace(/(.*)<\/head>/, '<link rel="stylesheet" href="index.css">\n$1</head>');
|
|
69
|
-
}
|
|
70
|
-
outputFiles.push({
|
|
71
|
-
relPath: "index.html",
|
|
72
|
-
contents: indexHtml,
|
|
73
|
-
});
|
|
74
|
-
// copy assets
|
|
75
|
-
outputFiles.push(...this.#copyAssets("src", "favicon.ico"), ...this.#copyAssets("src", "manifest.webmanifest"), ...this.#copyAssets("src/assets", "**/*", "assets"), ...(this.#opt.dev && this.#opt.builderType === "cordova"
|
|
76
|
-
? Object.keys(this.#opt.cordovaConfig?.platform ?? { browser: {} }).mapMany((platform) => [
|
|
77
|
-
...this.#copyAssets(`.cordova/platforms/${platform}/platform_www/plugins`, "**/*", `cordova-${platform}/plugins`),
|
|
78
|
-
...this.#copyAssets(`.cordova/platforms/${platform}/platform_www`, "cordova.js", `cordova-${platform}`),
|
|
79
|
-
...this.#copyAssets(`.cordova/platforms/${platform}/platform_www`, "cordova_plugins.js", `cordova-${platform}`),
|
|
80
|
-
...this.#copyAssets(`.cordova/platforms/${platform}/www`, "config.xml", `cordova-${platform}`),
|
|
81
|
-
])
|
|
82
|
-
: []));
|
|
83
|
-
// TODO: extract 3rdpartylicenses
|
|
84
|
-
//-- write
|
|
85
|
-
this.#debug(`write output files...(${outputFiles.length})`);
|
|
86
|
-
for (const outputFile of outputFiles) {
|
|
87
|
-
const distFilePath = path.resolve(this.#opt.outputPath, outputFile.relPath);
|
|
88
|
-
const prev = this.#outputCache.get(distFilePath);
|
|
89
|
-
if (prev !== Buffer.from(outputFile.contents).toString("base64")) {
|
|
90
|
-
await FsUtil.writeFileAsync(distFilePath, outputFile.contents);
|
|
91
|
-
this.#outputCache.set(distFilePath, Buffer.from(outputFile.contents).toString("base64"));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// TODO: service worker
|
|
95
|
-
const swResult = await generateSW({
|
|
96
|
-
globDirectory: path.resolve(this.#opt.pkgPath, "dist"),
|
|
97
|
-
swDest: path.resolve(this.#opt.pkgPath, "dist", "sw.js"),
|
|
98
|
-
});
|
|
99
|
-
swResult.warnings.map((msg) => {
|
|
100
|
-
results.push({
|
|
101
|
-
filePath: undefined,
|
|
102
|
-
line: undefined,
|
|
103
|
-
char: undefined,
|
|
104
|
-
code: undefined,
|
|
105
|
-
severity: "warning",
|
|
106
|
-
message: `(gen-sw) ${msg}`,
|
|
107
|
-
type: "build",
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
this.#debug(`번들링중 영향받은 파일`, Array.from(this.#compileResultCache.affectedFileSet));
|
|
111
|
-
return {
|
|
112
|
-
program: this.#compileResultCache.program,
|
|
113
|
-
watchFileSet: new Set(this.#compileResultCache.watchFileSet),
|
|
114
|
-
affectedFileSet: this.#compileResultCache.affectedFileSet,
|
|
115
|
-
results,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
#copyAssets(srcDir, globPath, distDir) {
|
|
119
|
-
const result = [];
|
|
120
|
-
const srcGlobPath = path.resolve(this.#opt.pkgPath, srcDir, globPath);
|
|
121
|
-
const srcPaths = glob.sync(srcGlobPath);
|
|
122
|
-
for (const srcPath of srcPaths) {
|
|
123
|
-
if (!FsUtil.exists(srcPath))
|
|
124
|
-
continue;
|
|
125
|
-
result.push({
|
|
126
|
-
relPath: path.join(...[distDir, path.relative(path.resolve(this.#opt.pkgPath, srcDir), srcPath)].filterExists()),
|
|
127
|
-
contents: FsUtil.readFile(srcPath),
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
return result;
|
|
131
|
-
}
|
|
132
|
-
_getAppContext() {
|
|
133
|
-
return new SdReactBundlerContext(this.#opt.pkgPath, {
|
|
134
|
-
absWorkingDir: this.#opt.pkgPath,
|
|
135
|
-
bundle: true,
|
|
136
|
-
keepNames: true,
|
|
137
|
-
format: "esm",
|
|
138
|
-
assetNames: "media/[name]",
|
|
139
|
-
conditions: ["es2020", "es2015", "module"],
|
|
140
|
-
resolveExtensions: [".js", ".mjs", ".cjs", ".ts", ".tsx"],
|
|
141
|
-
metafile: true,
|
|
142
|
-
legalComments: this.#opt.dev ? "eof" : "none",
|
|
143
|
-
logLevel: "silent",
|
|
144
|
-
minifyIdentifiers: !this.#opt.dev,
|
|
145
|
-
minifySyntax: !this.#opt.dev,
|
|
146
|
-
minifyWhitespace: !this.#opt.dev,
|
|
147
|
-
pure: ["forwardRef"],
|
|
148
|
-
outdir: this.#opt.pkgPath,
|
|
149
|
-
outExtension: undefined,
|
|
150
|
-
sourcemap: true, //this.#opt.dev,
|
|
151
|
-
splitting: true,
|
|
152
|
-
chunkNames: "[name]-[hash]",
|
|
153
|
-
tsconfig: this.#tsConfigFilePath,
|
|
154
|
-
write: false,
|
|
155
|
-
preserveSymlinks: false,
|
|
156
|
-
define: {
|
|
157
|
-
...(!this.#opt.dev ? { ngDevMode: "false" } : {}),
|
|
158
|
-
"ngJitMode": "false",
|
|
159
|
-
"global": "global",
|
|
160
|
-
"process": "process",
|
|
161
|
-
"Buffer": "Buffer",
|
|
162
|
-
"process.env.SD_VERSION": JSON.stringify(this.#pkgNpmConf.version),
|
|
163
|
-
"process.env.NODE_ENV": JSON.stringify(this.#opt.dev ? "development" : "production"),
|
|
164
|
-
...(this.#opt.env
|
|
165
|
-
? Object.keys(this.#opt.env).toObject((key) => `process.env.${key}`, (key) => JSON.stringify(this.#opt.env[key]))
|
|
166
|
-
: {}),
|
|
167
|
-
},
|
|
168
|
-
platform: "browser",
|
|
169
|
-
mainFields: ["es2020", "es2015", "browser", "module", "main"],
|
|
170
|
-
entryNames: "[name]",
|
|
171
|
-
entryPoints: {
|
|
172
|
-
index: this.#indexFilePath,
|
|
173
|
-
},
|
|
174
|
-
external: ["electron"],
|
|
175
|
-
target: this.#browserTarget,
|
|
176
|
-
supported: { "async-await": false, "object-rest-spread": false },
|
|
177
|
-
loader: {
|
|
178
|
-
".png": "file",
|
|
179
|
-
".jpeg": "file",
|
|
180
|
-
".jpg": "file",
|
|
181
|
-
".jfif": "file",
|
|
182
|
-
".gif": "file",
|
|
183
|
-
".svg": "file",
|
|
184
|
-
".woff": "file",
|
|
185
|
-
".woff2": "file",
|
|
186
|
-
".ttf": "file",
|
|
187
|
-
".ttc": "file",
|
|
188
|
-
".eot": "file",
|
|
189
|
-
".ico": "file",
|
|
190
|
-
".otf": "file",
|
|
191
|
-
".csv": "file",
|
|
192
|
-
".xlsx": "file",
|
|
193
|
-
".xls": "file",
|
|
194
|
-
".pptx": "file",
|
|
195
|
-
".ppt": "file",
|
|
196
|
-
".docx": "file",
|
|
197
|
-
".doc": "file",
|
|
198
|
-
".zip": "file",
|
|
199
|
-
".pfx": "file",
|
|
200
|
-
".pkl": "file",
|
|
201
|
-
".mp3": "file",
|
|
202
|
-
".ogg": "file",
|
|
203
|
-
},
|
|
204
|
-
inject: [PathUtil.posix(fileURLToPath(import.meta.resolve("node-stdlib-browser/helpers/esbuild/shim")))],
|
|
205
|
-
plugins: [
|
|
206
|
-
...(this.#opt.builderType === "cordova" && this.#opt.cordovaConfig?.plugins
|
|
207
|
-
? [
|
|
208
|
-
{
|
|
209
|
-
name: "cordova:plugin-empty",
|
|
210
|
-
setup: ({ onResolve }) => {
|
|
211
|
-
onResolve({ filter: new RegExp("(" + this.#opt.cordovaConfig.plugins.join("|") + ")") }, () => {
|
|
212
|
-
return {
|
|
213
|
-
path: `./cordova-empty.js`,
|
|
214
|
-
external: true,
|
|
215
|
-
};
|
|
216
|
-
});
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
]
|
|
220
|
-
: []),
|
|
221
|
-
sdReactPlugin({
|
|
222
|
-
modifiedFileSet: this.#modifiedFileSet,
|
|
223
|
-
dev: this.#opt.dev,
|
|
224
|
-
pkgPath: this.#opt.pkgPath,
|
|
225
|
-
result: this.#compileResultCache,
|
|
226
|
-
}),
|
|
227
|
-
nodeStdLibBrowserPlugin(nodeStdLibBrowser),
|
|
228
|
-
],
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
_getElectronMainContext() {
|
|
232
|
-
return new SdReactBundlerContext(this.#opt.pkgPath, {
|
|
233
|
-
absWorkingDir: this.#opt.pkgPath,
|
|
234
|
-
bundle: true,
|
|
235
|
-
entryNames: "[name]",
|
|
236
|
-
assetNames: "media/[name]",
|
|
237
|
-
conditions: ["es2020", "es2015", "module"],
|
|
238
|
-
resolveExtensions: [".js", ".mjs", ".cjs", ".ts"],
|
|
239
|
-
metafile: true,
|
|
240
|
-
legalComments: this.#opt.dev ? "eof" : "none",
|
|
241
|
-
logLevel: "silent",
|
|
242
|
-
minify: !this.#opt.dev,
|
|
243
|
-
outdir: this.#opt.pkgPath,
|
|
244
|
-
sourcemap: true, //this.#opt.dev,
|
|
245
|
-
tsconfig: this.#tsConfigFilePath,
|
|
246
|
-
write: false,
|
|
247
|
-
preserveSymlinks: false,
|
|
248
|
-
external: ["electron"],
|
|
249
|
-
define: {
|
|
250
|
-
...(!this.#opt.dev ? { ngDevMode: "false" } : {}),
|
|
251
|
-
"process.env.SD_VERSION": JSON.stringify(this.#pkgNpmConf.version),
|
|
252
|
-
"process.env.NODE_ENV": JSON.stringify(this.#opt.dev ? "development" : "production"),
|
|
253
|
-
...(this.#opt.env
|
|
254
|
-
? Object.keys(this.#opt.env).toObject((key) => `process.env.${key}`, (key) => JSON.stringify(this.#opt.env[key]))
|
|
255
|
-
: {}),
|
|
256
|
-
},
|
|
257
|
-
platform: "node",
|
|
258
|
-
entryPoints: {
|
|
259
|
-
"electron-main": path.resolve(this.#opt.pkgPath, "src/electron-main.ts"),
|
|
260
|
-
},
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
#debug(...msg) {
|
|
264
|
-
this.#logger.debug(`[${path.basename(this.#opt.pkgPath)}]`, ...msg);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
//# sourceMappingURL=SdReactBundler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SdReactBundler.js","sourceRoot":"","sources":["../../src/build-tools/SdReactBundler.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,uBAAuB,MAAM,4CAA4C,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C,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC;IACtE,CAAC;CACF"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
import { ISdCliPackageBuildResult } from "../commons";
|
|
3
|
-
export declare class SdReactBundlerContext {
|
|
4
|
-
#private;
|
|
5
|
-
private readonly _pkgPath;
|
|
6
|
-
private readonly _esbuildOptions;
|
|
7
|
-
private _context?;
|
|
8
|
-
constructor(_pkgPath: string, _esbuildOptions: esbuild.BuildOptions);
|
|
9
|
-
bundleAsync(): Promise<{
|
|
10
|
-
results: ISdCliPackageBuildResult[];
|
|
11
|
-
outputFiles: esbuild.OutputFile[] | undefined;
|
|
12
|
-
metafile: esbuild.Metafile | undefined;
|
|
13
|
-
}>;
|
|
14
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { Logger } from "@simplysm/sd-core-node";
|
|
4
|
-
export class SdReactBundlerContext {
|
|
5
|
-
#logger = Logger.get(["simplysm", "sd-cli", "SdReactBundlerContext"]);
|
|
6
|
-
constructor(_pkgPath, _esbuildOptions) {
|
|
7
|
-
this._pkgPath = _pkgPath;
|
|
8
|
-
this._esbuildOptions = _esbuildOptions;
|
|
9
|
-
}
|
|
10
|
-
async bundleAsync() {
|
|
11
|
-
if (this._context == null) {
|
|
12
|
-
this._context = await esbuild.context(this._esbuildOptions);
|
|
13
|
-
}
|
|
14
|
-
let buildResult;
|
|
15
|
-
try {
|
|
16
|
-
this.#debug(`rebuild...`);
|
|
17
|
-
buildResult = await this._context.rebuild();
|
|
18
|
-
this.#debug(`rebuild completed`);
|
|
19
|
-
}
|
|
20
|
-
catch (err) {
|
|
21
|
-
if ("warnings" in err || "errors" in err) {
|
|
22
|
-
buildResult = err;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
throw err;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
this.#debug(`convert results...`);
|
|
29
|
-
const results = [
|
|
30
|
-
...buildResult.warnings.map((warn) => ({
|
|
31
|
-
filePath: warn.location?.file !== undefined ? path.resolve(this._pkgPath, warn.location.file) : undefined,
|
|
32
|
-
line: warn.location?.line,
|
|
33
|
-
char: warn.location?.column,
|
|
34
|
-
code: warn.text.slice(0, warn.text.indexOf(":")),
|
|
35
|
-
severity: "warning",
|
|
36
|
-
message: `${warn.pluginName ? `(${warn.pluginName}) ` : ""} ${warn.text.slice(warn.text.indexOf(":") + 1)}`,
|
|
37
|
-
type: "build",
|
|
38
|
-
})),
|
|
39
|
-
...buildResult.errors.map((err) => ({
|
|
40
|
-
filePath: err.location?.file !== undefined ? path.resolve(this._pkgPath, err.location.file) : undefined,
|
|
41
|
-
line: err.location?.line,
|
|
42
|
-
char: err.location?.column !== undefined ? err.location.column + 1 : undefined,
|
|
43
|
-
code: err.text.slice(0, err.text.indexOf(":")),
|
|
44
|
-
severity: "error",
|
|
45
|
-
message: `${err.pluginName ? `(${err.pluginName}) ` : ""} ${err.text.slice(err.text.indexOf(":") + 1)}`,
|
|
46
|
-
type: "build",
|
|
47
|
-
})),
|
|
48
|
-
];
|
|
49
|
-
return {
|
|
50
|
-
results,
|
|
51
|
-
outputFiles: buildResult.outputFiles,
|
|
52
|
-
metafile: buildResult.metafile,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
#debug(...msg) {
|
|
56
|
-
this.#logger.debug(`[${path.basename(this._pkgPath)}] (${Object.keys(this._esbuildOptions.entryPoints).join(", ")})`, ...msg);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=SdReactBundlerContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SdReactBundlerContext.js","sourceRoot":"","sources":["../../src/build-tools/SdReactBundlerContext.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC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AAG,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE;gBACvG,IAAI,EAAE,OAAO;aACd,CAAC,CAAC;SAC0B,CAAC;QAEhC,OAAO;YACL,OAAO;YACP,WAAW,EAAE,WAAW,CAAC,WAAW;YACpC,QAAQ,EAAE,WAAW,CAAC,QAAQ;SAC/B,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,GAAG,GAAU;QAClB,IAAI,CAAC,OAAO,CAAC,KAAK,CAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,WAAkC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EACxH,GAAG,GAAG,CACP,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
import ts from "typescript";
|
|
3
|
-
export declare function sdReactPlugin(conf: {
|
|
4
|
-
pkgPath: string;
|
|
5
|
-
dev: boolean;
|
|
6
|
-
modifiedFileSet: Set<string>;
|
|
7
|
-
result: IReactPluginResultCache;
|
|
8
|
-
}): esbuild.Plugin;
|
|
9
|
-
export interface IReactPluginResultCache {
|
|
10
|
-
watchFileSet?: Set<string>;
|
|
11
|
-
affectedFileSet?: Set<string>;
|
|
12
|
-
program?: ts.Program;
|
|
13
|
-
outputFiles?: esbuild.OutputFile[];
|
|
14
|
-
metafile?: esbuild.Metafile;
|
|
15
|
-
}
|