@simplysm/sd-cli 11.0.40 → 11.1.2
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-cluster.d.ts +1 -1
- package/dist/build-cluster.js +181 -181
- package/dist/build-tools/SdCliCordova.d.ts +21 -21
- package/dist/build-tools/SdCliCordova.js +217 -217
- package/dist/build-tools/SdCliIndexFileGenerator.d.ts +5 -5
- package/dist/build-tools/SdCliIndexFileGenerator.js +50 -50
- package/dist/build-tools/SdCliNgRoutesFileGenerator.d.ts +4 -4
- package/dist/build-tools/SdCliNgRoutesFileGenerator.js +57 -57
- package/dist/build-tools/SdLinter.d.ts +5 -5
- package/dist/build-tools/SdLinter.js +54 -54
- package/dist/build-tools/SdNgBundler.d.ts +34 -35
- package/dist/build-tools/SdNgBundler.js +534 -533
- package/dist/build-tools/SdNgBundler.js.map +1 -1
- package/dist/build-tools/SdNgBundlerContext.d.ts +15 -16
- package/dist/build-tools/SdNgBundlerContext.js +97 -97
- package/dist/build-tools/SdNgBundlerContext.js.map +1 -1
- package/dist/build-tools/SdTsBundler.d.ts +15 -15
- package/dist/build-tools/SdTsBundler.js +87 -87
- package/dist/build-tools/SdTsCompiler.d.ts +29 -29
- package/dist/build-tools/SdTsCompiler.js +227 -227
- package/dist/builders/SdCliClientBuilder.d.ts +18 -18
- package/dist/builders/SdCliClientBuilder.js +129 -129
- package/dist/builders/SdCliJsLibLinter.d.ts +14 -14
- package/dist/builders/SdCliJsLibLinter.js +59 -59
- package/dist/builders/SdCliServerBuilder.d.ts +20 -20
- package/dist/builders/SdCliServerBuilder.js +215 -215
- package/dist/builders/SdCliTsLibBuilder.d.ts +17 -17
- package/dist/builders/SdCliTsLibBuilder.js +79 -79
- package/dist/commons.d.ts +132 -132
- package/dist/commons.js +1 -1
- package/dist/entry/SdCliElectron.d.ts +12 -12
- package/dist/entry/SdCliElectron.js +99 -99
- package/dist/entry/SdCliLocalUpdate.d.ts +12 -12
- package/dist/entry/SdCliLocalUpdate.js +90 -90
- package/dist/entry/SdCliProject.d.ts +26 -26
- package/dist/entry/SdCliProject.js +477 -477
- package/dist/index.d.ts +19 -19
- package/dist/index.js +19 -19
- package/dist/sd-cli.d.ts +2 -2
- package/dist/sd-cli.js +210 -210
- package/dist/server-worker.d.ts +1 -1
- package/dist/server-worker.js +38 -38
- package/dist/utils/SdCliBuildResultUtil.d.ts +6 -6
- package/dist/utils/SdCliBuildResultUtil.js +37 -37
- package/dist/utils/SdMemoryLoadResultCache.d.ts +10 -9
- package/dist/utils/SdMemoryLoadResultCache.js +36 -34
- package/dist/utils/SdMemoryLoadResultCache.js.map +1 -1
- package/dist/utils/SdSourceFileCache.d.ts +6 -6
- package/dist/utils/SdSourceFileCache.js +21 -14
- package/dist/utils/SdSourceFileCache.js.map +1 -1
- package/package.json +18 -18
- package/src/build-tools/SdNgBundler.ts +30 -36
- package/src/build-tools/SdNgBundlerContext.ts +11 -11
- package/src/utils/SdMemoryLoadResultCache.ts +4 -1
- package/src/utils/SdSourceFileCache.ts +10 -3
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { FsUtil, PathUtil, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
3
|
-
import { StringUtil } from "@simplysm/sd-core-common";
|
|
4
|
-
export class SdCliNgRoutesFileGenerator {
|
|
5
|
-
static async watchAsync(pkgPath) {
|
|
6
|
-
const routesFilePath = path.resolve(pkgPath, "src/routes.ts");
|
|
7
|
-
let cache = FsUtil.exists(routesFilePath) ? FsUtil.readFile(routesFilePath) : undefined;
|
|
8
|
-
SdFsWatcher
|
|
9
|
-
.watch([path.resolve(pkgPath, "src")])
|
|
10
|
-
.onChange({}, async () => {
|
|
11
|
-
cache = await this.runAsync(pkgPath, cache);
|
|
12
|
-
});
|
|
13
|
-
cache = await this.runAsync(pkgPath, cache);
|
|
14
|
-
}
|
|
15
|
-
static async runAsync(pkgPath, cache) {
|
|
16
|
-
const appDirPath = path.resolve(pkgPath, "src/app");
|
|
17
|
-
const routesFilePath = path.resolve(pkgPath, "src/routes.ts");
|
|
18
|
-
// 내부 파일들 import
|
|
19
|
-
const result = new Map();
|
|
20
|
-
const filePaths = await FsUtil.globAsync(path.resolve(appDirPath, "**/*Page.ts"));
|
|
21
|
-
for (const filePath of filePaths.orderBy()) {
|
|
22
|
-
const relModulePath = PathUtil.posix(path.relative(appDirPath, filePath)).slice(0, -3);
|
|
23
|
-
const codes = relModulePath.slice(0, -4).split("/").map(item => StringUtil.toKebabCase(item));
|
|
24
|
-
let cursorItem;
|
|
25
|
-
let cursor = result;
|
|
26
|
-
for (const code of codes) {
|
|
27
|
-
cursorItem = cursor.getOrCreate(code, { children: new Map() });
|
|
28
|
-
cursor = cursorItem.children;
|
|
29
|
-
}
|
|
30
|
-
cursorItem.relModulePath = relModulePath;
|
|
31
|
-
}
|
|
32
|
-
const fn = (currInfo, indent) => {
|
|
33
|
-
const indentStr = new Array(indent).fill(" ").join("");
|
|
34
|
-
let cont = "";
|
|
35
|
-
for (const [key, val] of currInfo) {
|
|
36
|
-
cont += indentStr + "{\n";
|
|
37
|
-
cont += indentStr + ` path: "${key}",\n`;
|
|
38
|
-
if (val.relModulePath != null) {
|
|
39
|
-
cont += indentStr + ` loadComponent: () => import("./app/${val.relModulePath}").then((m) => m.${path.basename(val.relModulePath)}),\n`;
|
|
40
|
-
cont += indentStr + ` canDeactivate: [sdCanDeactivateGuard],\n`;
|
|
41
|
-
}
|
|
42
|
-
if (val.children.size > 0) {
|
|
43
|
-
cont += indentStr + ` children: [\n`;
|
|
44
|
-
cont += fn(val.children, indent + 4) + "\n";
|
|
45
|
-
cont += indentStr + ` ]\n`;
|
|
46
|
-
}
|
|
47
|
-
cont += indentStr + "},\n";
|
|
48
|
-
}
|
|
49
|
-
return cont.trimEnd();
|
|
50
|
-
};
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { FsUtil, PathUtil, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
3
|
+
import { StringUtil } from "@simplysm/sd-core-common";
|
|
4
|
+
export class SdCliNgRoutesFileGenerator {
|
|
5
|
+
static async watchAsync(pkgPath) {
|
|
6
|
+
const routesFilePath = path.resolve(pkgPath, "src/routes.ts");
|
|
7
|
+
let cache = FsUtil.exists(routesFilePath) ? FsUtil.readFile(routesFilePath) : undefined;
|
|
8
|
+
SdFsWatcher
|
|
9
|
+
.watch([path.resolve(pkgPath, "src")])
|
|
10
|
+
.onChange({}, async () => {
|
|
11
|
+
cache = await this.runAsync(pkgPath, cache);
|
|
12
|
+
});
|
|
13
|
+
cache = await this.runAsync(pkgPath, cache);
|
|
14
|
+
}
|
|
15
|
+
static async runAsync(pkgPath, cache) {
|
|
16
|
+
const appDirPath = path.resolve(pkgPath, "src/app");
|
|
17
|
+
const routesFilePath = path.resolve(pkgPath, "src/routes.ts");
|
|
18
|
+
// 내부 파일들 import
|
|
19
|
+
const result = new Map();
|
|
20
|
+
const filePaths = await FsUtil.globAsync(path.resolve(appDirPath, "**/*Page.ts"));
|
|
21
|
+
for (const filePath of filePaths.orderBy()) {
|
|
22
|
+
const relModulePath = PathUtil.posix(path.relative(appDirPath, filePath)).slice(0, -3);
|
|
23
|
+
const codes = relModulePath.slice(0, -4).split("/").map(item => StringUtil.toKebabCase(item));
|
|
24
|
+
let cursorItem;
|
|
25
|
+
let cursor = result;
|
|
26
|
+
for (const code of codes) {
|
|
27
|
+
cursorItem = cursor.getOrCreate(code, { children: new Map() });
|
|
28
|
+
cursor = cursorItem.children;
|
|
29
|
+
}
|
|
30
|
+
cursorItem.relModulePath = relModulePath;
|
|
31
|
+
}
|
|
32
|
+
const fn = (currInfo, indent) => {
|
|
33
|
+
const indentStr = new Array(indent).fill(" ").join("");
|
|
34
|
+
let cont = "";
|
|
35
|
+
for (const [key, val] of currInfo) {
|
|
36
|
+
cont += indentStr + "{\n";
|
|
37
|
+
cont += indentStr + ` path: "${key}",\n`;
|
|
38
|
+
if (val.relModulePath != null) {
|
|
39
|
+
cont += indentStr + ` loadComponent: () => import("./app/${val.relModulePath}").then((m) => m.${path.basename(val.relModulePath)}),\n`;
|
|
40
|
+
cont += indentStr + ` canDeactivate: [sdCanDeactivateGuard],\n`;
|
|
41
|
+
}
|
|
42
|
+
if (val.children.size > 0) {
|
|
43
|
+
cont += indentStr + ` children: [\n`;
|
|
44
|
+
cont += fn(val.children, indent + 4) + "\n";
|
|
45
|
+
cont += indentStr + ` ]\n`;
|
|
46
|
+
}
|
|
47
|
+
cont += indentStr + "},\n";
|
|
48
|
+
}
|
|
49
|
+
return cont.trimEnd();
|
|
50
|
+
};
|
|
51
51
|
const content = `
|
|
52
52
|
import {sdCanDeactivateGuard} from "@simplysm/sd-angular";
|
|
53
53
|
import {Routes} from "@angular/router";
|
|
54
54
|
|
|
55
55
|
export const routes: Routes = [
|
|
56
56
|
${fn(result, 2)}
|
|
57
|
-
];`.trim();
|
|
58
|
-
if (content.trim() !== cache?.trim()) {
|
|
59
|
-
await FsUtil.writeFileAsync(routesFilePath, content);
|
|
60
|
-
}
|
|
61
|
-
return content;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
57
|
+
];`.trim();
|
|
58
|
+
if (content.trim() !== cache?.trim()) {
|
|
59
|
+
await FsUtil.writeFileAsync(routesFilePath, content);
|
|
60
|
+
}
|
|
61
|
+
return content;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
64
|
//# sourceMappingURL=SdCliNgRoutesFileGenerator.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ISdCliPackageBuildResult } from "../commons";
|
|
2
|
-
import ts from "typescript";
|
|
3
|
-
export declare class SdLinter {
|
|
4
|
-
static lintAsync(filePaths: string[], programOrPkgPath?: ts.Program | string): Promise<ISdCliPackageBuildResult[]>;
|
|
5
|
-
}
|
|
1
|
+
import { ISdCliPackageBuildResult } from "../commons";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
export declare class SdLinter {
|
|
4
|
+
static lintAsync(filePaths: string[], programOrPkgPath?: ts.Program | string): Promise<ISdCliPackageBuildResult[]>;
|
|
5
|
+
}
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { ESLint } from "eslint";
|
|
2
|
-
import path from "path";
|
|
3
|
-
export class SdLinter {
|
|
4
|
-
static async lintAsync(filePaths, programOrPkgPath) {
|
|
5
|
-
const sourceFilePaths = filePaths.filter((item) => (!item.endsWith(".d.ts") && item.endsWith(".ts")) ||
|
|
6
|
-
item.endsWith(".js") ||
|
|
7
|
-
item.endsWith(".cjs") ||
|
|
8
|
-
item.endsWith(".mjs"));
|
|
9
|
-
if (sourceFilePaths.length === 0) {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
const linter = new ESLint(programOrPkgPath !== null ? {
|
|
13
|
-
overrideConfig: {
|
|
14
|
-
overrides: [
|
|
15
|
-
{
|
|
16
|
-
files: ["*.ts", "*.tsx"],
|
|
17
|
-
parserOptions: {
|
|
18
|
-
...typeof programOrPkgPath === "string" ? {
|
|
19
|
-
tsconfigRootDir: programOrPkgPath,
|
|
20
|
-
project: "tsconfig.json"
|
|
21
|
-
} : {
|
|
22
|
-
programs: [programOrPkgPath],
|
|
23
|
-
tsconfigRootDir: null,
|
|
24
|
-
project: null
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
settings: {
|
|
28
|
-
"import/resolver": {
|
|
29
|
-
"typescript": {
|
|
30
|
-
...typeof programOrPkgPath === "string" ? {
|
|
31
|
-
project: path.resolve(programOrPkgPath, "tsconfig.json")
|
|
32
|
-
} : {
|
|
33
|
-
programs: [programOrPkgPath],
|
|
34
|
-
project: null
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
} : undefined);
|
|
43
|
-
const lintResults = await linter.lintFiles(sourceFilePaths);
|
|
44
|
-
return lintResults.mapMany((lintResult) => lintResult.messages.map((msg) => ({
|
|
45
|
-
filePath: lintResult.filePath,
|
|
46
|
-
line: msg.line,
|
|
47
|
-
char: msg.column,
|
|
48
|
-
code: msg.messageId,
|
|
49
|
-
severity: msg.severity === 1 ? "warning" : "error",
|
|
50
|
-
message: msg.message + (msg.ruleId != null ? ` (${msg.ruleId})` : ``),
|
|
51
|
-
type: "lint"
|
|
52
|
-
})));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
import { ESLint } from "eslint";
|
|
2
|
+
import path from "path";
|
|
3
|
+
export class SdLinter {
|
|
4
|
+
static async lintAsync(filePaths, programOrPkgPath) {
|
|
5
|
+
const sourceFilePaths = filePaths.filter((item) => (!item.endsWith(".d.ts") && item.endsWith(".ts")) ||
|
|
6
|
+
item.endsWith(".js") ||
|
|
7
|
+
item.endsWith(".cjs") ||
|
|
8
|
+
item.endsWith(".mjs"));
|
|
9
|
+
if (sourceFilePaths.length === 0) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
const linter = new ESLint(programOrPkgPath !== null ? {
|
|
13
|
+
overrideConfig: {
|
|
14
|
+
overrides: [
|
|
15
|
+
{
|
|
16
|
+
files: ["*.ts", "*.tsx"],
|
|
17
|
+
parserOptions: {
|
|
18
|
+
...typeof programOrPkgPath === "string" ? {
|
|
19
|
+
tsconfigRootDir: programOrPkgPath,
|
|
20
|
+
project: "tsconfig.json"
|
|
21
|
+
} : {
|
|
22
|
+
programs: [programOrPkgPath],
|
|
23
|
+
tsconfigRootDir: null,
|
|
24
|
+
project: null
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
settings: {
|
|
28
|
+
"import/resolver": {
|
|
29
|
+
"typescript": {
|
|
30
|
+
...typeof programOrPkgPath === "string" ? {
|
|
31
|
+
project: path.resolve(programOrPkgPath, "tsconfig.json")
|
|
32
|
+
} : {
|
|
33
|
+
programs: [programOrPkgPath],
|
|
34
|
+
project: null
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
} : undefined);
|
|
43
|
+
const lintResults = await linter.lintFiles(sourceFilePaths);
|
|
44
|
+
return lintResults.mapMany((lintResult) => lintResult.messages.map((msg) => ({
|
|
45
|
+
filePath: lintResult.filePath,
|
|
46
|
+
line: msg.line,
|
|
47
|
+
char: msg.column,
|
|
48
|
+
code: msg.messageId,
|
|
49
|
+
severity: msg.severity === 1 ? "warning" : "error",
|
|
50
|
+
message: msg.message + (msg.ruleId != null ? ` (${msg.ruleId})` : ``),
|
|
51
|
+
type: "lint"
|
|
52
|
+
})));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
55
|
//# sourceMappingURL=SdLinter.js.map
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import { ISdCliClientBuilderCordovaConfig, ISdCliPackageBuildResult } from "../commons";
|
|
2
|
-
export declare class SdNgBundler {
|
|
3
|
-
private readonly _opt;
|
|
4
|
-
private readonly _sourceFileCache;
|
|
5
|
-
private _contexts;
|
|
6
|
-
private readonly _outputCache;
|
|
7
|
-
private readonly
|
|
8
|
-
private readonly
|
|
9
|
-
private readonly
|
|
10
|
-
private readonly
|
|
11
|
-
private readonly
|
|
12
|
-
private readonly
|
|
13
|
-
private readonly
|
|
14
|
-
private readonly
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
private
|
|
31
|
-
private
|
|
32
|
-
private
|
|
33
|
-
private
|
|
34
|
-
|
|
35
|
-
}
|
|
1
|
+
import { ISdCliClientBuilderCordovaConfig, ISdCliPackageBuildResult } from "../commons";
|
|
2
|
+
export declare class SdNgBundler {
|
|
3
|
+
private readonly _opt;
|
|
4
|
+
private readonly _sourceFileCache;
|
|
5
|
+
private _contexts;
|
|
6
|
+
private readonly _outputCache;
|
|
7
|
+
private readonly _pkgNpmConf;
|
|
8
|
+
private readonly _mainFilePath;
|
|
9
|
+
private readonly _tsConfigFilePath;
|
|
10
|
+
private readonly _swConfFilePath;
|
|
11
|
+
private readonly _browserTarget;
|
|
12
|
+
private readonly _indexHtmlFilePath;
|
|
13
|
+
private readonly _pkgName;
|
|
14
|
+
private readonly _baseHref;
|
|
15
|
+
constructor(_opt: {
|
|
16
|
+
dev: boolean;
|
|
17
|
+
outputPath: string;
|
|
18
|
+
pkgPath: string;
|
|
19
|
+
builderType: string;
|
|
20
|
+
env: Record<string, string> | undefined;
|
|
21
|
+
cordovaConfig: ISdCliClientBuilderCordovaConfig | undefined;
|
|
22
|
+
});
|
|
23
|
+
removeCache(filePaths: string[]): void;
|
|
24
|
+
bundleAsync(): Promise<{
|
|
25
|
+
filePaths: string[];
|
|
26
|
+
affectedFilePaths: string[];
|
|
27
|
+
results: ISdCliPackageBuildResult[];
|
|
28
|
+
}>;
|
|
29
|
+
private _genIndexHtmlAsync;
|
|
30
|
+
private _copyAssetsAsync;
|
|
31
|
+
private _genServiceWorkerAsync;
|
|
32
|
+
private _getAppContextAsync;
|
|
33
|
+
private _getStyleContext;
|
|
34
|
+
}
|