@simplysm/sd-cli 12.7.4 → 12.7.6
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/sd-cli-ai-command.d.ts +3 -0
- package/dist/entry/{SdAiCommand.js → sd-cli-ai-command.js} +14 -9
- package/dist/entry/sd-cli-ai-command.js.map +1 -0
- package/dist/entry/{SdCliCordova.d.ts → sd-cli-cordova.d.ts} +1 -1
- package/dist/entry/{SdCliCordova.js → sd-cli-cordova.js} +33 -31
- package/dist/entry/sd-cli-cordova.js.map +1 -0
- package/dist/entry/{SdCliElectron.d.ts → sd-cli-electron.d.ts} +1 -1
- package/dist/entry/{SdCliElectron.js → sd-cli-electron.js} +18 -16
- package/dist/entry/sd-cli-electron.js.map +1 -0
- package/dist/entry/{SdCliLocalUpdate.js → sd-cli-local-update.js} +12 -11
- package/dist/entry/sd-cli-local-update.js.map +1 -0
- package/dist/entry/{SdCliProject.js → sd-cli-project.js} +36 -33
- package/dist/entry/sd-cli-project.js.map +1 -0
- package/dist/index.d.ts +30 -30
- package/dist/index.js +30 -30
- package/dist/index.js.map +1 -1
- package/dist/pkg-builders/client/{SdCliNgRoutesFileGenerator.js → sd-cli-ng-routes.file-generator.js} +13 -12
- package/dist/pkg-builders/client/sd-cli-ng-routes.file-generator.js.map +1 -0
- package/dist/pkg-builders/client/{SdClientBuildRunner.d.ts → sd-client.build-runner.d.ts} +3 -3
- package/dist/pkg-builders/client/{SdClientBuildRunner.js → sd-client.build-runner.js} +34 -24
- package/dist/pkg-builders/client/sd-client.build-runner.js.map +1 -0
- package/dist/pkg-builders/client/{SdNgBundlerContext.js → sd-ng.bundler-context.js} +5 -5
- package/dist/pkg-builders/client/sd-ng.bundler-context.js.map +1 -0
- package/dist/pkg-builders/client/{SdNgBundler.d.ts → sd-ng.bundler.d.ts} +3 -3
- package/dist/pkg-builders/client/{SdNgBundler.js → sd-ng.bundler.js} +55 -96
- package/dist/pkg-builders/client/sd-ng.bundler.js.map +1 -0
- package/dist/pkg-builders/client/{createSdNgPlugin.d.ts → sd-ng.plugin-creator.d.ts} +2 -2
- package/dist/pkg-builders/client/{createSdNgPlugin.js → sd-ng.plugin-creator.js} +18 -15
- package/dist/pkg-builders/client/sd-ng.plugin-creator.js.map +1 -0
- package/dist/pkg-builders/lib/{SdCliIndexFileGenerator.js → sd-cli-index.file-generator.js} +8 -8
- package/dist/pkg-builders/lib/sd-cli-index.file-generator.js.map +1 -0
- package/dist/pkg-builders/lib/{SdJsLibBuildRunner.d.ts → sd-js-lib.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/lib/{SdJsLibBuildRunner.js → sd-js-lib.build-runner.js} +18 -15
- package/dist/pkg-builders/lib/sd-js-lib.build-runner.js.map +1 -0
- package/dist/pkg-builders/lib/{SdTsLibBuildRunner.d.ts → sd-ts-lib.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/lib/{SdTsLibBuildRunner.js → sd-ts-lib.build-runner.js} +17 -15
- package/dist/pkg-builders/lib/sd-ts-lib.build-runner.js.map +1 -0
- package/dist/pkg-builders/lib/{SdTsLibBuilder.d.ts → sd-ts-lib.builder.d.ts} +2 -2
- package/dist/pkg-builders/lib/{SdTsLibBuilder.js → sd-ts-lib.builder.js} +11 -10
- package/dist/pkg-builders/lib/sd-ts-lib.builder.js.map +1 -0
- package/dist/pkg-builders/{SdMultiBuildRunner.d.ts → sd-multi.build-runner.d.ts} +2 -2
- package/dist/pkg-builders/{SdMultiBuildRunner.js → sd-multi.build-runner.js} +13 -8
- package/dist/pkg-builders/sd-multi.build-runner.js.map +1 -0
- package/dist/pkg-builders/server/{SdServerBuildRunner.d.ts → sd-server.build-runner.d.ts} +3 -3
- package/dist/pkg-builders/server/{SdServerBuildRunner.js → sd-server.build-runner.js} +35 -32
- package/dist/pkg-builders/server/sd-server.build-runner.js.map +1 -0
- package/dist/pkg-builders/server/{SdServerBundler.d.ts → sd-server.bundler.d.ts} +2 -2
- package/dist/pkg-builders/server/{SdServerBundler.js → sd-server.bundler.js} +15 -13
- package/dist/pkg-builders/server/sd-server.bundler.js.map +1 -0
- package/dist/pkg-builders/server/{createSdServerPlugin.d.ts → sd-server.plugin-creator.d.ts} +2 -2
- package/dist/pkg-builders/server/{createSdServerPlugin.js → sd-server.plugin-creator.js} +11 -8
- package/dist/pkg-builders/server/sd-server.plugin-creator.js.map +1 -0
- package/dist/sd-cli.js +10 -10
- package/dist/sd-cli.js.map +1 -1
- package/dist/{ts-builder/SdTsCompiler.d.ts → ts-compiler/sd-ts-compiler.d.ts} +2 -2
- package/dist/{ts-builder/SdTsCompiler.js → ts-compiler/sd-ts-compiler.js} +72 -65
- package/dist/ts-compiler/sd-ts-compiler.js.map +1 -0
- package/dist/types/{build-plugin.type.d.ts → build-plugin.types.d.ts} +1 -1
- package/dist/types/build-plugin.types.js +3 -0
- package/dist/types/build-plugin.types.js.map +1 -0
- package/dist/types/{build-runner.type.d.ts → build-runner.types.d.ts} +2 -2
- package/dist/types/build-runner.types.js +3 -0
- package/dist/types/build-runner.types.js.map +1 -0
- package/dist/types/{build.type.d.ts → build.types.d.ts} +1 -1
- package/dist/types/build.types.js +2 -0
- package/dist/types/build.types.js.map +1 -0
- package/dist/types/common-configs.types.js +2 -0
- package/dist/types/common-configs.types.js.map +1 -0
- package/dist/types/config.types.js +2 -0
- package/dist/types/config.types.js.map +1 -0
- package/dist/types/{ts-compiler.type.d.ts → ts-compiler.types.d.ts} +3 -3
- package/dist/types/ts-compiler.types.js +5 -0
- package/dist/types/ts-compiler.types.js.map +1 -0
- package/dist/types/{workers.type.d.ts → worker.types.d.ts} +2 -2
- package/dist/types/worker.types.js +3 -0
- package/dist/types/worker.types.js.map +1 -0
- package/dist/utils/{SdCliConvertMessageUtil.d.ts → sd-cli-convert-message.utils.d.ts} +3 -3
- package/dist/utils/{SdCliConvertMessageUtil.js → sd-cli-convert-message.utils.js} +9 -6
- package/dist/utils/sd-cli-convert-message.utils.js.map +1 -0
- package/dist/utils/{SdCliPerformanceTime.js → sd-cli-performance-time.js} +1 -1
- package/dist/utils/sd-cli-performance-time.js.map +1 -0
- package/dist/workers/{build-runner-worker.js → build-runner.worker.js} +13 -10
- package/dist/workers/build-runner.worker.js.map +1 -0
- package/dist/workers/{server-worker.js → server.worker.js} +6 -5
- package/dist/workers/server.worker.js.map +1 -0
- package/package.json +7 -7
- package/src/entry/{SdAiCommand.ts → sd-cli-ai-command.ts} +18 -8
- package/src/entry/{SdCliCordova.ts → sd-cli-cordova.ts} +32 -32
- package/src/entry/{SdCliElectron.ts → sd-cli-electron.ts} +17 -17
- package/src/entry/{SdCliLocalUpdate.ts → sd-cli-local-update.ts} +11 -11
- package/src/entry/{SdCliProject.ts → sd-cli-project.ts} +36 -36
- package/src/index.ts +30 -30
- package/src/pkg-builders/client/{SdCliNgRoutesFileGenerator.ts → sd-cli-ng-routes.file-generator.ts} +14 -12
- package/src/pkg-builders/client/{SdClientBuildRunner.ts → sd-client.build-runner.ts} +52 -45
- package/src/pkg-builders/client/{SdNgBundlerContext.ts → sd-ng.bundler-context.ts} +4 -4
- package/src/pkg-builders/client/{SdNgBundler.ts → sd-ng.bundler.ts} +98 -130
- package/src/pkg-builders/client/{createSdNgPlugin.ts → sd-ng.plugin-creator.ts} +16 -16
- package/src/pkg-builders/lib/{SdCliIndexFileGenerator.ts → sd-cli-index.file-generator.ts} +7 -7
- package/src/pkg-builders/lib/{SdJsLibBuildRunner.ts → sd-js-lib.build-runner.ts} +16 -16
- package/src/pkg-builders/lib/{SdTsLibBuildRunner.ts → sd-ts-lib.build-runner.ts} +17 -17
- package/src/pkg-builders/lib/{SdTsLibBuilder.ts → sd-ts-lib.builder.ts} +10 -10
- package/src/pkg-builders/{SdMultiBuildRunner.ts → sd-multi.build-runner.ts} +12 -12
- package/src/pkg-builders/server/{SdServerBuildRunner.ts → sd-server.build-runner.ts} +34 -34
- package/src/pkg-builders/server/{SdServerBundler.ts → sd-server.bundler.ts} +15 -15
- package/src/pkg-builders/server/{createSdServerPlugin.ts → sd-server.plugin-creator.ts} +9 -9
- package/src/sd-cli.ts +10 -10
- package/src/{ts-builder/SdTsCompiler.ts → ts-compiler/sd-ts-compiler.ts} +146 -78
- package/src/types/{build-plugin.type.ts → build-plugin.types.ts} +1 -1
- package/src/types/{build-runner.type.ts → build-runner.types.ts} +2 -2
- package/src/types/{build.type.ts → build.types.ts} +1 -1
- package/src/types/{ts-compiler.type.ts → ts-compiler.types.ts} +3 -3
- package/src/types/{workers.type.ts → worker.types.ts} +2 -2
- package/src/utils/{SdCliConvertMessageUtil.ts → sd-cli-convert-message.utils.ts} +7 -7
- package/src/workers/{build-runner-worker.ts → build-runner.worker.ts} +12 -12
- package/src/workers/{server-worker.ts → server.worker.ts} +5 -5
- package/tsconfig.json +2 -1
- package/dist/entry/SdAiCommand.d.ts +0 -3
- package/dist/entry/SdAiCommand.js.map +0 -1
- package/dist/entry/SdCliCordova.js.map +0 -1
- package/dist/entry/SdCliElectron.js.map +0 -1
- package/dist/entry/SdCliLocalUpdate.js.map +0 -1
- package/dist/entry/SdCliProject.js.map +0 -1
- package/dist/pkg-builders/SdMultiBuildRunner.js.map +0 -1
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js.map +0 -1
- package/dist/pkg-builders/client/SdClientBuildRunner.js.map +0 -1
- package/dist/pkg-builders/client/SdNgBundler.js.map +0 -1
- package/dist/pkg-builders/client/SdNgBundlerContext.js.map +0 -1
- package/dist/pkg-builders/client/createSdNgPlugin.js.map +0 -1
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js.map +0 -1
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js.map +0 -1
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js.map +0 -1
- package/dist/pkg-builders/lib/SdTsLibBuilder.js.map +0 -1
- package/dist/pkg-builders/server/SdServerBuildRunner.js.map +0 -1
- package/dist/pkg-builders/server/SdServerBundler.js.map +0 -1
- package/dist/pkg-builders/server/createSdServerPlugin.js.map +0 -1
- package/dist/ts-builder/SdTsCompiler.js.map +0 -1
- package/dist/types/build-plugin.type.js +0 -2
- package/dist/types/build-plugin.type.js.map +0 -1
- package/dist/types/build-runner.type.js +0 -2
- package/dist/types/build-runner.type.js.map +0 -1
- package/dist/types/build.type.js +0 -2
- package/dist/types/build.type.js.map +0 -1
- package/dist/types/common-configs.type.js +0 -2
- package/dist/types/common-configs.type.js.map +0 -1
- package/dist/types/sd-configs.type.js +0 -2
- package/dist/types/sd-configs.type.js.map +0 -1
- package/dist/types/ts-compiler.type.js +0 -2
- package/dist/types/ts-compiler.type.js.map +0 -1
- package/dist/types/workers.type.js +0 -2
- package/dist/types/workers.type.js.map +0 -1
- package/dist/utils/SdCliConvertMessageUtil.js.map +0 -1
- package/dist/utils/SdCliPerformanceTime.js.map +0 -1
- package/dist/workers/build-runner-worker.js.map +0 -1
- package/dist/workers/server-worker.js.map +0 -1
- /package/dist/entry/{SdCliLocalUpdate.d.ts → sd-cli-local-update.d.ts} +0 -0
- /package/dist/entry/{SdCliProject.d.ts → sd-cli-project.d.ts} +0 -0
- /package/dist/pkg-builders/client/{SdCliNgRoutesFileGenerator.d.ts → sd-cli-ng-routes.file-generator.d.ts} +0 -0
- /package/dist/pkg-builders/client/{SdNgBundlerContext.d.ts → sd-ng.bundler-context.d.ts} +0 -0
- /package/dist/pkg-builders/lib/{SdCliIndexFileGenerator.d.ts → sd-cli-index.file-generator.d.ts} +0 -0
- /package/dist/types/{common-configs.type.d.ts → common-configs.types.d.ts} +0 -0
- /package/dist/types/{sd-configs.type.d.ts → config.types.d.ts} +0 -0
- /package/dist/utils/{SdCliPerformanceTime.d.ts → sd-cli-performance-time.d.ts} +0 -0
- /package/dist/workers/{build-runner-worker.d.ts → build-runner.worker.d.ts} +0 -0
- /package/dist/workers/{server-worker.d.ts → server.worker.d.ts} +0 -0
- /package/src/types/{common-configs.type.ts → common-configs.types.ts} +0 -0
- /package/src/types/{sd-configs.type.ts → config.types.ts} +0 -0
- /package/src/utils/{SdCliPerformanceTime.ts → sd-cli-performance-time.ts} +0 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import esbuild from "esbuild";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { FsUtils, SdLogger, PathUtils } from "@simplysm/sd-core-node";
|
|
4
|
+
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
5
|
+
import {} from "../../types/build-plugin.types";
|
|
6
|
+
import {} from "../../types/build.types";
|
|
7
|
+
import { createSdServerPlugin } from "./sd-server.plugin-creator";
|
|
6
8
|
import { BuildOutputFileType } from "@angular/build/src/tools/esbuild/bundler-context";
|
|
7
9
|
import { convertOutputFile } from "@angular/build/src/tools/esbuild/utils";
|
|
8
10
|
import { resolveAssets } from "@angular/build/src/utils/resolve-assets";
|
|
9
11
|
export class SdServerBundler {
|
|
10
|
-
#logger =
|
|
12
|
+
#logger = SdLogger.get(["simplysm", "sd-cli", "SdServerBundler"]);
|
|
11
13
|
#context;
|
|
12
14
|
#modifiedFileSet = new Set();
|
|
13
15
|
#resultCache = {};
|
|
@@ -97,10 +99,10 @@ const __dirname = __path__.dirname(__filename);`.trim(),
|
|
|
97
99
|
result = await this.#context.rebuild();
|
|
98
100
|
const outputFiles = result.outputFiles?.map((file) => convertOutputFile(file, BuildOutputFileType.Root)) ?? [];
|
|
99
101
|
for (const outputFile of outputFiles) {
|
|
100
|
-
const distFilePath =
|
|
102
|
+
const distFilePath = PathUtils.norm(this._opt.pkgPath, outputFile.path);
|
|
101
103
|
const prev = this.#outputCache.get(distFilePath);
|
|
102
104
|
if (prev !== Buffer.from(outputFile.contents).toString("base64")) {
|
|
103
|
-
|
|
105
|
+
FsUtils.writeFile(distFilePath, outputFile.contents);
|
|
104
106
|
this.#outputCache.set(distFilePath, Buffer.from(outputFile.contents).toString("base64"));
|
|
105
107
|
emitFileSet.add(distFilePath);
|
|
106
108
|
}
|
|
@@ -111,12 +113,12 @@ const __dirname = __path__.dirname(__filename);`.trim(),
|
|
|
111
113
|
...(this._opt.dev ? [{ input: "public-dev", glob: "**/*", output: "." }] : []),
|
|
112
114
|
], this._opt.pkgPath);
|
|
113
115
|
for (const assetFile of assetFiles) {
|
|
114
|
-
const prev = this.#outputCache.get(
|
|
115
|
-
const curr =
|
|
116
|
+
const prev = this.#outputCache.get(PathUtils.norm(assetFile.source));
|
|
117
|
+
const curr = FsUtils.lstat(assetFile.source).mtime.getTime();
|
|
116
118
|
if (prev !== curr) {
|
|
117
|
-
|
|
118
|
-
this.#outputCache.set(
|
|
119
|
-
emitFileSet.add(
|
|
119
|
+
FsUtils.copy(assetFile.source, path.resolve(this._opt.pkgPath, "dist", assetFile.destination));
|
|
120
|
+
this.#outputCache.set(PathUtils.norm(assetFile.source), curr);
|
|
121
|
+
emitFileSet.add(PathUtils.norm(assetFile.destination));
|
|
120
122
|
}
|
|
121
123
|
}
|
|
122
124
|
}
|
|
@@ -131,9 +133,9 @@ const __dirname = __path__.dirname(__filename);`.trim(),
|
|
|
131
133
|
return {
|
|
132
134
|
watchFileSet: this.#resultCache.watchFileSet,
|
|
133
135
|
affectedFileSet: this.#resultCache.affectedFileSet,
|
|
134
|
-
results:
|
|
136
|
+
results: SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(result, this._opt.pkgPath),
|
|
135
137
|
emitFileSet: emitFileSet,
|
|
136
138
|
};
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
|
-
//# sourceMappingURL=
|
|
141
|
+
//# sourceMappingURL=sd-server.bundler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sd-server.bundler.js","sourceRoot":"","sources":["../../../src/pkg-builders/server/sd-server.bundler.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAkB,MAA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,CAAC,CAAC;oBAC/F,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;oBAC9D,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,GAAG,GAAG,CAAC;YACb,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;gBAC3B,IAAI,CAAC,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;oBACrB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;gBAC/B,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO;YACL,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,YAAa;YAC7C,eAAe,EAAE,IAAI,CAAC,YAAY,CAAC,eAAgB;YACnD,OAAO,EAAE,wBAAwB,CAAC,iCAAiC,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;YAC9F,WAAW,EAAE,WAAW;SACzB,CAAC;IACJ,CAAC;CACF"}
|
package/dist/pkg-builders/server/{createSdServerPlugin.d.ts → sd-server.plugin-creator.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import esbuild from "esbuild";
|
|
2
|
-
import { ISdCliServerPluginResultCache } from "../../types/build-plugin.
|
|
3
|
-
import { TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
+
import { type ISdCliServerPluginResultCache } from "../../types/build-plugin.types";
|
|
3
|
+
import { type TNormPath } from "@simplysm/sd-core-node";
|
|
4
4
|
export declare function createSdServerPlugin(conf: {
|
|
5
5
|
pkgPath: TNormPath;
|
|
6
6
|
dev: boolean;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import esbuild from "esbuild";
|
|
2
|
+
import { SdCliConvertMessageUtils } from "../../utils/sd-cli-convert-message.utils";
|
|
3
|
+
import {} from "../../types/build-plugin.types";
|
|
4
|
+
import { PathUtils } from "@simplysm/sd-core-node";
|
|
5
|
+
import {} from "../../types/ts-compiler.types";
|
|
6
|
+
import { SdTsCompiler } from "../../ts-compiler/sd-ts-compiler";
|
|
4
7
|
export function createSdServerPlugin(conf) {
|
|
5
8
|
return {
|
|
6
9
|
name: "sd-server-compile",
|
|
@@ -18,10 +21,10 @@ export function createSdServerPlugin(conf) {
|
|
|
18
21
|
conf.result.watchFileSet = tsCompileResult.watchFileSet;
|
|
19
22
|
conf.result.affectedFileSet = tsCompileResult.affectedFileSet;
|
|
20
23
|
//-- return err/warn
|
|
21
|
-
return
|
|
24
|
+
return SdCliConvertMessageUtils.convertToEsbuildFromBuildMessages(tsCompileResult.messages, conf.pkgPath);
|
|
22
25
|
});
|
|
23
26
|
build.onLoad({ filter: /\.ts$/ }, (args) => {
|
|
24
|
-
const emittedJsFile = tsCompileResult.emittedFilesCacheMap.get(
|
|
27
|
+
const emittedJsFile = tsCompileResult.emittedFilesCacheMap.get(PathUtils.norm(args.path))?.last();
|
|
25
28
|
if (!emittedJsFile) {
|
|
26
29
|
return {
|
|
27
30
|
errors: [
|
|
@@ -35,7 +38,7 @@ export function createSdServerPlugin(conf) {
|
|
|
35
38
|
return { contents, loader: "js" };
|
|
36
39
|
});
|
|
37
40
|
build.onLoad({ filter: /\.[cm]?js$/ }, (args) => {
|
|
38
|
-
conf.result.watchFileSet.add(
|
|
41
|
+
conf.result.watchFileSet.add(PathUtils.norm(args.path));
|
|
39
42
|
return null;
|
|
40
43
|
});
|
|
41
44
|
build.onLoad({
|
|
@@ -45,7 +48,7 @@ export function createSdServerPlugin(conf) {
|
|
|
45
48
|
.join("|") +
|
|
46
49
|
")$"),
|
|
47
50
|
}, (args) => {
|
|
48
|
-
conf.result.watchFileSet.add(
|
|
51
|
+
conf.result.watchFileSet.add(PathUtils.norm(args.path));
|
|
49
52
|
return null;
|
|
50
53
|
});
|
|
51
54
|
build.onEnd((result) => {
|
|
@@ -56,4 +59,4 @@ export function createSdServerPlugin(conf) {
|
|
|
56
59
|
},
|
|
57
60
|
};
|
|
58
61
|
}
|
|
59
|
-
//# sourceMappingURL=
|
|
62
|
+
//# sourceMappingURL=sd-server.plugin-creator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sd-server.plugin-creator.js","sourceRoot":"","sources":["../../../src/pkg-builders/server/sd-server.plugin-creator.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAsC,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAE,SAAS,EAAkB,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAA4B,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,MAAM,UAAU,oBAAoB,CAAC,IAMpC;IACC,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,CAAC,KAA0B,EAAE,EAAE;YACpC,MAAM,UAAU,GAAG,IAAI,YAAY,CAAC;gBAClC,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,iBAAiB,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;gBACzC,SAAS,EAAE,IAAI,CAAC,GAAG;gBACnB,WAAW,EAAE,IAAI;gBACjB,eAAe,EAAE,IAAI,CAAC,eAAe;aACtC,CAAC,CAAC;YAEH,IAAI,eAAoC,CAAC;YAEzC,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;gBACvB,eAAe,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;gBAEtE,IAAI,CAAC,MAAM,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G,IAAI,CAAC;yBAC1B,IAAI,CAAC,GAAG,CAAC;oBACZ,IAAI,CACP;aACF,EACD,CAAC,IAAI,EAAE,EAAE;gBACP,IAAI,CAAC,MAAM,CAAC,YAAa,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBACzD,OAAO,IAAI,CAAC;YACd,CAAC,CACF,CAAC;YAEF,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;gBACrB,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;gBAC7C,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;gBAEvC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;YAC/B,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/sd-cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node --import=specifier-resolution-node/register
|
|
2
2
|
import yargs from "yargs";
|
|
3
3
|
import { hideBin } from "yargs/helpers";
|
|
4
|
-
import { SdCliProject } from "./entry/
|
|
5
|
-
import {
|
|
4
|
+
import { SdCliProject } from "./entry/sd-cli-project";
|
|
5
|
+
import { SdLogger, SdLoggerSeverity } from "@simplysm/sd-core-node";
|
|
6
6
|
import { EventEmitter } from "events";
|
|
7
|
-
import { SdCliElectron } from "./entry/
|
|
8
|
-
import { SdCliLocalUpdate } from "./entry/
|
|
9
|
-
import { SdCliCordova } from "./entry/
|
|
10
|
-
import {
|
|
7
|
+
import { SdCliElectron } from "./entry/sd-cli-electron";
|
|
8
|
+
import { SdCliLocalUpdate } from "./entry/sd-cli-local-update";
|
|
9
|
+
import { SdCliCordova } from "./entry/sd-cli-cordova";
|
|
10
|
+
import { SdCliAiCommand } from "./entry/sd-cli-ai-command";
|
|
11
11
|
Error.stackTraceLimit = Infinity;
|
|
12
12
|
EventEmitter.defaultMaxListeners = 0;
|
|
13
13
|
const argv = (await yargs(hideBin(process.argv))
|
|
@@ -159,14 +159,14 @@ const argv = (await yargs(hideBin(process.argv))
|
|
|
159
159
|
.parseAsync());
|
|
160
160
|
if (Boolean(argv.debug)) {
|
|
161
161
|
process.env["SD_DEBUG"] = "true";
|
|
162
|
-
|
|
162
|
+
SdLogger.setConfig({
|
|
163
163
|
console: {
|
|
164
|
-
level:
|
|
164
|
+
level: SdLoggerSeverity.debug,
|
|
165
165
|
},
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
else {
|
|
169
|
-
|
|
169
|
+
SdLogger.setConfig({
|
|
170
170
|
dot: true,
|
|
171
171
|
});
|
|
172
172
|
}
|
|
@@ -221,7 +221,7 @@ else if (argv._[0] === "run-cordova") {
|
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
223
|
else if (argv._[0] === "commit") {
|
|
224
|
-
await
|
|
224
|
+
await SdCliAiCommand.commitAsync();
|
|
225
225
|
}
|
|
226
226
|
else {
|
|
227
227
|
throw new Error(`명령어가 잘못 되었습니다.\n\t${argv._[0]}\n`);
|
package/dist/sd-cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-cli.js","sourceRoot":"","sources":["../src/sd-cli.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"sd-cli.js","sourceRoot":"","sources":["../src/sd-cli.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC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O;QACrB,GAAG,EAAE,IAAI,CAAC,GAAG;KACd,CAAC,CAAC;AACL,CAAC;KACI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;IAChC,MAAM,cAAc,CAAC,WAAW,EAAE,CAAC;AACrC,CAAC;KACI,CAAC;IACJ,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
-
import { ISdTsCompilerResult, SdTsCompilerOptions } from "../types/ts-compiler.
|
|
1
|
+
import { type TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
+
import { type ISdTsCompilerResult, type SdTsCompilerOptions } from "../types/ts-compiler.types";
|
|
3
3
|
export declare class SdTsCompiler {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(opt: SdTsCompilerOptions);
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { FsUtils, SdLogger, PathUtils } from "@simplysm/sd-core-node";
|
|
4
|
+
import { StringUtils } from "@simplysm/sd-core-common";
|
|
5
5
|
import { NgtscProgram, OptimizeFor } from "@angular/compiler-cli";
|
|
6
|
-
import { ComponentStylesheetBundler } from "@angular/build/src/tools/esbuild/angular/component-stylesheets";
|
|
6
|
+
import { ComponentStylesheetBundler, } from "@angular/build/src/tools/esbuild/angular/component-stylesheets";
|
|
7
|
+
import {} from "@angular/build/src/tools/angular/angular-host";
|
|
7
8
|
import { transformSupportedBrowsersToTargets } from "@angular/build/src/tools/esbuild/utils";
|
|
8
9
|
import browserslist from "browserslist";
|
|
9
|
-
import { replaceBootstrap } from "@angular/build/src/tools/angular/transformers/jit-bootstrap-transformer";
|
|
10
|
-
import { SdCliPerformanceTimer } from "../utils/
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { replaceBootstrap, } from "@angular/build/src/tools/angular/transformers/jit-bootstrap-transformer";
|
|
11
|
+
import { SdCliPerformanceTimer } from "../utils/sd-cli-performance-time";
|
|
12
|
+
import { SdCliConvertMessageUtils } from "../utils/sd-cli-convert-message.utils";
|
|
13
|
+
import {} from "../types/ts-compiler.types";
|
|
14
|
+
import {} from "../types/build.types";
|
|
15
|
+
import { createWorkerTransformer, } from "@angular/build/src/tools/angular/transformers/web-worker-transformer";
|
|
13
16
|
import { ESLint } from "eslint";
|
|
14
17
|
export class SdTsCompiler {
|
|
15
|
-
#logger =
|
|
18
|
+
#logger = SdLogger.get(["simplysm", "sd-cli", "SdTsCompiler"]);
|
|
16
19
|
#parsedTsconfig;
|
|
17
20
|
#isForAngular;
|
|
18
21
|
// readonly #workerRevDependencyCacheMap = new Map<TNormPath, Set<TNormPath>>();
|
|
@@ -45,32 +48,32 @@ export class SdTsCompiler {
|
|
|
45
48
|
this.#debug("초기화...");
|
|
46
49
|
//-- isForAngular / parsedTsConfig
|
|
47
50
|
const tsconfigPath = path.resolve(opt.pkgPath, "tsconfig.json");
|
|
48
|
-
const tsconfig =
|
|
51
|
+
const tsconfig = FsUtils.readJson(tsconfigPath);
|
|
49
52
|
this.#isForAngular = Boolean(tsconfig.angularCompilerOptions);
|
|
50
53
|
this.#parsedTsconfig = ts.parseJsonConfigFileContent(tsconfig, ts.sys, opt.pkgPath, {
|
|
51
54
|
...tsconfig.angularCompilerOptions,
|
|
52
55
|
...opt.additionalOptions,
|
|
53
56
|
});
|
|
54
|
-
this.#distPath =
|
|
57
|
+
this.#distPath = PathUtils.norm(this.#parsedTsconfig.options.outDir ?? path.resolve(opt.pkgPath, "dist"));
|
|
55
58
|
//-- compilerHost
|
|
56
59
|
this.#compilerHost = ts.createCompilerHost(this.#parsedTsconfig.options);
|
|
57
60
|
const baseGetSourceFile = this.#compilerHost.getSourceFile;
|
|
58
61
|
this.#compilerHost.getSourceFile = (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile, ...args) => {
|
|
59
|
-
if (!shouldCreateNewSourceFile && this.#sourceFileCacheMap.has(
|
|
60
|
-
return this.#sourceFileCacheMap.get(
|
|
62
|
+
if (!shouldCreateNewSourceFile && this.#sourceFileCacheMap.has(PathUtils.norm(fileName))) {
|
|
63
|
+
return this.#sourceFileCacheMap.get(PathUtils.norm(fileName));
|
|
61
64
|
}
|
|
62
65
|
const sf = baseGetSourceFile.call(this.#compilerHost, fileName, languageVersionOrOptions, onError, true, ...args);
|
|
63
66
|
if (sf) {
|
|
64
|
-
this.#sourceFileCacheMap.set(
|
|
67
|
+
this.#sourceFileCacheMap.set(PathUtils.norm(fileName), sf);
|
|
65
68
|
}
|
|
66
69
|
else {
|
|
67
|
-
this.#sourceFileCacheMap.delete(
|
|
70
|
+
this.#sourceFileCacheMap.delete(PathUtils.norm(fileName));
|
|
68
71
|
}
|
|
69
72
|
return sf;
|
|
70
73
|
};
|
|
71
74
|
const baseReadFile = this.#compilerHost.readFile;
|
|
72
75
|
this.#compilerHost.readFile = (fileName) => {
|
|
73
|
-
this.#watchFileSet.add(
|
|
76
|
+
this.#watchFileSet.add(PathUtils.norm(fileName));
|
|
74
77
|
return baseReadFile.call(this.#compilerHost, fileName);
|
|
75
78
|
};
|
|
76
79
|
if (this.#isForAngular) {
|
|
@@ -105,11 +108,11 @@ export class SdTsCompiler {
|
|
|
105
108
|
if (context.type !== "style") {
|
|
106
109
|
return null;
|
|
107
110
|
}
|
|
108
|
-
const contents = await this.#bundleStylesheetAsync(data,
|
|
109
|
-
return
|
|
111
|
+
const contents = await this.#bundleStylesheetAsync(data, PathUtils.norm(context.containingFile), context.resourceFile != null ? PathUtils.norm(context.resourceFile) : undefined);
|
|
112
|
+
return StringUtils.isNullOrEmpty(contents) ? null : { content: contents };
|
|
110
113
|
};
|
|
111
114
|
this.#compilerHost.getModifiedResourceFiles = () => {
|
|
112
|
-
return new Set(Array.from(this.#modifiedFileSet).map((item) =>
|
|
115
|
+
return new Set(Array.from(this.#modifiedFileSet).map((item) => PathUtils.posix(item)));
|
|
113
116
|
};
|
|
114
117
|
}
|
|
115
118
|
}
|
|
@@ -124,12 +127,13 @@ export class SdTsCompiler {
|
|
|
124
127
|
: await this.#stylesheetBundler.bundleInline(data, containingFile, "scss");
|
|
125
128
|
if (stylesheetResult.referencedFiles) {
|
|
126
129
|
for (const referencedFile of stylesheetResult.referencedFiles) {
|
|
127
|
-
const depCacheSet = this.#resourceDependencyCacheMap.getOrCreate(
|
|
130
|
+
const depCacheSet = this.#resourceDependencyCacheMap.getOrCreate(PathUtils.norm(referencedFile), new Set());
|
|
128
131
|
depCacheSet.add(resourceFile ?? containingFile);
|
|
129
132
|
}
|
|
130
|
-
this.#watchFileSet.adds(...Array.from(stylesheetResult.referencedFiles.values())
|
|
133
|
+
this.#watchFileSet.adds(...Array.from(stylesheetResult.referencedFiles.values())
|
|
134
|
+
.map((item) => PathUtils.norm(item)));
|
|
131
135
|
}
|
|
132
|
-
this.#stylesheetBundlingResultMap.set(
|
|
136
|
+
this.#stylesheetBundlingResultMap.set(PathUtils.norm(resourceFile ?? containingFile), {
|
|
133
137
|
outputFiles: stylesheetResult.errors == null ? stylesheetResult.outputFiles : undefined,
|
|
134
138
|
metafile: stylesheetResult.errors == null ? stylesheetResult.metafile : undefined,
|
|
135
139
|
errors: stylesheetResult.errors,
|
|
@@ -156,8 +160,8 @@ export class SdTsCompiler {
|
|
|
156
160
|
return {
|
|
157
161
|
messages: [
|
|
158
162
|
...prepareResult.messages,
|
|
159
|
-
...
|
|
160
|
-
...
|
|
163
|
+
...SdCliConvertMessageUtils.convertToBuildMessagesFromTsDiag(buildResult.diagnostics),
|
|
164
|
+
...SdCliConvertMessageUtils.convertToBuildMessagesFromEslint(lintResults),
|
|
161
165
|
],
|
|
162
166
|
watchFileSet: this.#watchFileSet,
|
|
163
167
|
affectedFileSet: this.#affectedFileSet,
|
|
@@ -174,13 +178,13 @@ export class SdTsCompiler {
|
|
|
174
178
|
this.#affectedFileSet.add(modifiedFile);
|
|
175
179
|
this.#affectedFileSet.adds(...(this.#revDependencyCacheMap.get(modifiedFile) ?? []));
|
|
176
180
|
this.#affectedFileSet.adds(...(this.#resourceDependencyCacheMap.get(modifiedFile) ?? []));
|
|
177
|
-
this.#emittedFilesCacheMap.delete(modifiedFile);
|
|
178
181
|
}
|
|
179
182
|
});
|
|
180
183
|
this.#debug(`invalidate & clear cache...`);
|
|
181
184
|
this.#perf.run("invalidate & clear cache", () => {
|
|
182
|
-
this.#stylesheetBundler?.invalidate(this.#
|
|
185
|
+
this.#stylesheetBundler?.invalidate(this.#affectedFileSet);
|
|
183
186
|
for (const affectedFile of this.#affectedFileSet) {
|
|
187
|
+
this.#emittedFilesCacheMap.delete(affectedFile);
|
|
184
188
|
this.#sourceFileCacheMap.delete(affectedFile);
|
|
185
189
|
this.#stylesheetBundlingResultMap.delete(affectedFile);
|
|
186
190
|
this.#watchFileSet.delete(affectedFile);
|
|
@@ -219,14 +223,14 @@ export class SdTsCompiler {
|
|
|
219
223
|
this.#perf.run("get new deps", () => {
|
|
220
224
|
const depMap = new Map();
|
|
221
225
|
for (const sf of sourceFileSet) {
|
|
222
|
-
if (!this.#watchScopePaths.some((scopePath) =>
|
|
226
|
+
if (!this.#watchScopePaths.some((scopePath) => PathUtils.isChildPath(sf.fileName, scopePath))) {
|
|
223
227
|
continue;
|
|
224
228
|
}
|
|
225
229
|
const refs = this.#findDeps(sf);
|
|
226
230
|
messages.push(...refs.filter((item) => "severity" in item));
|
|
227
|
-
depMap.set(
|
|
231
|
+
depMap.set(PathUtils.norm(sf.fileName), refs
|
|
228
232
|
.filter((item) => "fileName" in item)
|
|
229
|
-
.filter((item) => this.#watchScopePaths.some((scopePath) =>
|
|
233
|
+
.filter((item) => this.#watchScopePaths.some((scopePath) => PathUtils.isChildPath(item.fileName, scopePath))));
|
|
230
234
|
}
|
|
231
235
|
const allDepMap = new Map();
|
|
232
236
|
const getAllDeps = (fileName, prevSet) => {
|
|
@@ -247,7 +251,8 @@ export class SdTsCompiler {
|
|
|
247
251
|
}
|
|
248
252
|
}
|
|
249
253
|
else {
|
|
250
|
-
for (const targetRefItem of targetDeps.filter((item) => item.exportName
|
|
254
|
+
for (const targetRefItem of targetDeps.filter((item) => item.exportName
|
|
255
|
+
=== dep.importName)) {
|
|
251
256
|
if (prevSet?.has(targetRefItem.fileName))
|
|
252
257
|
continue;
|
|
253
258
|
result.add(targetRefItem.fileName);
|
|
@@ -258,19 +263,19 @@ export class SdTsCompiler {
|
|
|
258
263
|
return result;
|
|
259
264
|
};
|
|
260
265
|
for (const sf of sourceFileSet) {
|
|
261
|
-
const deps = getAllDeps(
|
|
262
|
-
allDepMap.set(
|
|
263
|
-
for (const dep of getAllDeps(
|
|
266
|
+
const deps = getAllDeps(PathUtils.norm(sf.fileName));
|
|
267
|
+
allDepMap.set(PathUtils.norm(sf.fileName), deps);
|
|
268
|
+
for (const dep of getAllDeps(PathUtils.norm(sf.fileName))) {
|
|
264
269
|
const depCache = this.#revDependencyCacheMap.getOrCreate(dep, new Set());
|
|
265
|
-
depCache.add(
|
|
270
|
+
depCache.add(PathUtils.norm(sf.fileName));
|
|
266
271
|
}
|
|
267
272
|
if (this.#ngProgram) {
|
|
268
273
|
if (this.#ngProgram.compiler.ignoreForEmit.has(sf)) {
|
|
269
274
|
continue;
|
|
270
275
|
}
|
|
271
276
|
for (const dep of this.#ngProgram.compiler.getResourceDependencies(sf)) {
|
|
272
|
-
const ref = this.#resourceDependencyCacheMap.getOrCreate(
|
|
273
|
-
ref.add(
|
|
277
|
+
const ref = this.#resourceDependencyCacheMap.getOrCreate(PathUtils.norm(dep), new Set());
|
|
278
|
+
ref.add(PathUtils.norm(sf.fileName));
|
|
274
279
|
}
|
|
275
280
|
}
|
|
276
281
|
}
|
|
@@ -279,10 +284,10 @@ export class SdTsCompiler {
|
|
|
279
284
|
this.#debug(`get affected (init)...`);
|
|
280
285
|
this.#perf.run("get affected (init)", () => {
|
|
281
286
|
for (const sf of sourceFileSet) {
|
|
282
|
-
if (!this.#watchScopePaths.some((scopePath) =>
|
|
287
|
+
if (!this.#watchScopePaths.some((scopePath) => PathUtils.isChildPath(sf.fileName, scopePath))) {
|
|
283
288
|
continue;
|
|
284
289
|
}
|
|
285
|
-
this.#affectedFileSet.add(
|
|
290
|
+
this.#affectedFileSet.add(PathUtils.norm(sf.fileName));
|
|
286
291
|
}
|
|
287
292
|
});
|
|
288
293
|
}
|
|
@@ -291,7 +296,7 @@ export class SdTsCompiler {
|
|
|
291
296
|
this.#affectedFileSet.adds(...Array.from(this.#revDependencyCacheMap.get(dep)).mapMany((item) => [
|
|
292
297
|
item,
|
|
293
298
|
// .d.ts면 .js파일도 affected에 추가
|
|
294
|
-
item.endsWith(".d.ts") ?
|
|
299
|
+
item.endsWith(".d.ts") ? PathUtils.norm(item.replace(/\.d\.ts$/, ".js")) : undefined,
|
|
295
300
|
].filterExists()));
|
|
296
301
|
}
|
|
297
302
|
// dep이 emit된적이 없으면 affected에 추가해야함.
|
|
@@ -318,10 +323,10 @@ export class SdTsCompiler {
|
|
|
318
323
|
}
|
|
319
324
|
async #lintAsync() {
|
|
320
325
|
const lintFilePaths = Array.from(this.#affectedFileSet)
|
|
321
|
-
.filter((item) =>
|
|
326
|
+
.filter((item) => PathUtils.isChildPath(item, this.#pkgPath))
|
|
322
327
|
.filter((item) => ((!item.endsWith(".d.ts") && item.endsWith(".ts")) ||
|
|
323
328
|
item.endsWith(".js")))
|
|
324
|
-
.filter((item) =>
|
|
329
|
+
.filter((item) => FsUtils.exists(item));
|
|
325
330
|
if (lintFilePaths.length === 0) {
|
|
326
331
|
return [];
|
|
327
332
|
}
|
|
@@ -358,7 +363,7 @@ export class SdTsCompiler {
|
|
|
358
363
|
});
|
|
359
364
|
this.#debug(`get diagnostics of files...`);
|
|
360
365
|
for (const affectedFile of this.#affectedFileSet) {
|
|
361
|
-
if (!
|
|
366
|
+
if (!PathUtils.isChildPath(affectedFile, this.#pkgPath)) {
|
|
362
367
|
continue;
|
|
363
368
|
}
|
|
364
369
|
const affectedSourceFile = this.#program.getSourceFile(affectedFile);
|
|
@@ -418,7 +423,7 @@ export class SdTsCompiler {
|
|
|
418
423
|
}
|
|
419
424
|
// esbuild를 통해 bundle로 묶어야 하는놈들은 모든 output이 있어야 함.
|
|
420
425
|
if (!this.#isForBundle) {
|
|
421
|
-
if (!
|
|
426
|
+
if (!PathUtils.isChildPath(sf.fileName, this.#pkgPath)) {
|
|
422
427
|
continue;
|
|
423
428
|
}
|
|
424
429
|
}
|
|
@@ -434,12 +439,12 @@ export class SdTsCompiler {
|
|
|
434
439
|
}
|
|
435
440
|
this.#ngProgram.compiler.incrementalCompilation.recordSuccessfulEmit(sourceFile);
|
|
436
441
|
}
|
|
437
|
-
const emitFileInfoCaches = this.#emittedFilesCacheMap.getOrCreate(
|
|
438
|
-
if (
|
|
439
|
-
let realFilePath =
|
|
442
|
+
const emitFileInfoCaches = this.#emittedFilesCacheMap.getOrCreate(PathUtils.norm(sourceFile.fileName), []);
|
|
443
|
+
if (PathUtils.isChildPath(sourceFile.fileName, this.#pkgPath)) {
|
|
444
|
+
let realFilePath = PathUtils.norm(fileName);
|
|
440
445
|
let realText = text;
|
|
441
|
-
if (
|
|
442
|
-
realFilePath =
|
|
446
|
+
if (PathUtils.isChildPath(realFilePath, path.resolve(this.#distPath, path.basename(this.#pkgPath), "src"))) {
|
|
447
|
+
realFilePath = PathUtils.norm(this.#distPath, path.relative(path.resolve(this.#distPath, path.basename(this.#pkgPath), "src"), realFilePath));
|
|
443
448
|
if (fileName.endsWith(".js.map")) {
|
|
444
449
|
const sourceMapContents = JSON.parse(realText);
|
|
445
450
|
// remove "../../"
|
|
@@ -455,21 +460,22 @@ export class SdTsCompiler {
|
|
|
455
460
|
else {
|
|
456
461
|
emitFileInfoCaches.push({ text });
|
|
457
462
|
}
|
|
458
|
-
emitFileSet.add(
|
|
463
|
+
emitFileSet.add(PathUtils.norm(sourceFile.fileName));
|
|
459
464
|
}, undefined, undefined, transformers);
|
|
460
465
|
}
|
|
461
466
|
});
|
|
462
467
|
//-- global style
|
|
463
468
|
if (this.#globalStyleFilePath != null &&
|
|
464
|
-
|
|
469
|
+
FsUtils.exists(this.#globalStyleFilePath) &&
|
|
465
470
|
!this.#emittedFilesCacheMap.has(this.#globalStyleFilePath)) {
|
|
466
471
|
this.#debug(`bundle global style...`);
|
|
467
472
|
await this.#perf.run("bundle global style", async () => {
|
|
468
|
-
const data =
|
|
473
|
+
const data = FsUtils.readFile(this.#globalStyleFilePath);
|
|
469
474
|
const contents = await this.#bundleStylesheetAsync(data, this.#globalStyleFilePath, this.#globalStyleFilePath);
|
|
470
475
|
const emitFileInfos = this.#emittedFilesCacheMap.getOrCreate(this.#globalStyleFilePath, []);
|
|
471
476
|
emitFileInfos.push({
|
|
472
|
-
outAbsPath:
|
|
477
|
+
outAbsPath: PathUtils.norm(this.#pkgPath, path.relative(path.resolve(this.#pkgPath, "src"), this.#globalStyleFilePath)
|
|
478
|
+
.replace(/\.scss$/, ".css")),
|
|
473
479
|
text: contents,
|
|
474
480
|
});
|
|
475
481
|
emitFileSet.add(this.#globalStyleFilePath);
|
|
@@ -493,7 +499,7 @@ export class SdTsCompiler {
|
|
|
493
499
|
if (!moduleSymbol) {
|
|
494
500
|
const pos = ts.getLineAndCharacterOfPosition(sf, node.getStart());
|
|
495
501
|
deps.push({
|
|
496
|
-
filePath:
|
|
502
|
+
filePath: PathUtils.norm(sf.fileName),
|
|
497
503
|
line: pos.line,
|
|
498
504
|
char: pos.character,
|
|
499
505
|
code: undefined,
|
|
@@ -507,7 +513,7 @@ export class SdTsCompiler {
|
|
|
507
513
|
if (!decls) {
|
|
508
514
|
const pos = ts.getLineAndCharacterOfPosition(sf, node.getStart());
|
|
509
515
|
deps.push({
|
|
510
|
-
filePath:
|
|
516
|
+
filePath: PathUtils.norm(sf.fileName),
|
|
511
517
|
line: pos.line,
|
|
512
518
|
char: pos.character,
|
|
513
519
|
code: undefined,
|
|
@@ -522,7 +528,7 @@ export class SdTsCompiler {
|
|
|
522
528
|
for (const el of namedBindings.elements) {
|
|
523
529
|
for (const decl of decls) {
|
|
524
530
|
deps.push({
|
|
525
|
-
fileName:
|
|
531
|
+
fileName: PathUtils.norm(decl.getSourceFile().fileName),
|
|
526
532
|
importName: el.name.text,
|
|
527
533
|
exportName: el.propertyName?.text ?? el.name.text,
|
|
528
534
|
});
|
|
@@ -533,7 +539,7 @@ export class SdTsCompiler {
|
|
|
533
539
|
if (!moduleSymbol.exports) {
|
|
534
540
|
const pos = ts.getLineAndCharacterOfPosition(sf, node.getStart());
|
|
535
541
|
deps.push({
|
|
536
|
-
filePath:
|
|
542
|
+
filePath: PathUtils.norm(sf.fileName),
|
|
537
543
|
line: pos.line,
|
|
538
544
|
char: pos.character,
|
|
539
545
|
code: undefined,
|
|
@@ -546,7 +552,7 @@ export class SdTsCompiler {
|
|
|
546
552
|
for (const decl of decls) {
|
|
547
553
|
for (const key of moduleSymbol.exports.keys()) {
|
|
548
554
|
deps.push({
|
|
549
|
-
fileName:
|
|
555
|
+
fileName: PathUtils.norm(decl.getSourceFile().fileName),
|
|
550
556
|
importName: key.toString(),
|
|
551
557
|
exportName: key.toString(),
|
|
552
558
|
});
|
|
@@ -558,9 +564,10 @@ export class SdTsCompiler {
|
|
|
558
564
|
else if (ts.isImportDeclaration(node)) {
|
|
559
565
|
const moduleSymbol = tc.getSymbolAtLocation(node.moduleSpecifier);
|
|
560
566
|
if (!moduleSymbol) {
|
|
561
|
-
if (ts.isStringLiteral(node.moduleSpecifier)
|
|
567
|
+
if (ts.isStringLiteral(node.moduleSpecifier)
|
|
568
|
+
&& node.moduleSpecifier.text.startsWith("./")) {
|
|
562
569
|
deps.push({
|
|
563
|
-
fileName:
|
|
570
|
+
fileName: PathUtils.norm(path.resolve(path.dirname(sf.fileName), node.moduleSpecifier.text + ".ts")),
|
|
564
571
|
importName: "*",
|
|
565
572
|
});
|
|
566
573
|
// const pos = ts.getLineAndCharacterOfPosition(sf, node.getStart());
|
|
@@ -584,7 +591,7 @@ export class SdTsCompiler {
|
|
|
584
591
|
if (!decls) {
|
|
585
592
|
const pos = ts.getLineAndCharacterOfPosition(sf, node.getStart());
|
|
586
593
|
deps.push({
|
|
587
|
-
filePath:
|
|
594
|
+
filePath: PathUtils.norm(sf.fileName),
|
|
588
595
|
line: pos.line,
|
|
589
596
|
char: pos.character,
|
|
590
597
|
code: undefined,
|
|
@@ -599,7 +606,7 @@ export class SdTsCompiler {
|
|
|
599
606
|
for (const el of namedBindings.elements) {
|
|
600
607
|
for (const decl of decls) {
|
|
601
608
|
deps.push({
|
|
602
|
-
fileName:
|
|
609
|
+
fileName: PathUtils.norm(decl.getSourceFile().fileName),
|
|
603
610
|
importName: el.name.text,
|
|
604
611
|
});
|
|
605
612
|
}
|
|
@@ -608,7 +615,7 @@ export class SdTsCompiler {
|
|
|
608
615
|
else {
|
|
609
616
|
for (const decl of decls) {
|
|
610
617
|
deps.push({
|
|
611
|
-
fileName:
|
|
618
|
+
fileName: PathUtils.norm(decl.getSourceFile().fileName),
|
|
612
619
|
importName: "*",
|
|
613
620
|
});
|
|
614
621
|
}
|
|
@@ -620,7 +627,7 @@ export class SdTsCompiler {
|
|
|
620
627
|
const moduleSymbol = tc.getSymbolAtLocation(node.arguments[0]);
|
|
621
628
|
if (!moduleSymbol) {
|
|
622
629
|
deps.push({
|
|
623
|
-
fileName:
|
|
630
|
+
fileName: PathUtils.norm(path.resolve(path.dirname(sf.fileName), node.arguments[0].text + ".ts")),
|
|
624
631
|
importName: "*",
|
|
625
632
|
});
|
|
626
633
|
// const pos = ts.getLineAndCharacterOfPosition(sf, node.getStart());
|
|
@@ -640,7 +647,7 @@ export class SdTsCompiler {
|
|
|
640
647
|
if (!decls) {
|
|
641
648
|
const pos = ts.getLineAndCharacterOfPosition(sf, node.getStart());
|
|
642
649
|
deps.push({
|
|
643
|
-
filePath:
|
|
650
|
+
filePath: PathUtils.norm(sf.fileName),
|
|
644
651
|
line: pos.line,
|
|
645
652
|
char: pos.character,
|
|
646
653
|
code: undefined,
|
|
@@ -652,7 +659,7 @@ export class SdTsCompiler {
|
|
|
652
659
|
}
|
|
653
660
|
for (const decl of decls) {
|
|
654
661
|
deps.push({
|
|
655
|
-
fileName:
|
|
662
|
+
fileName: PathUtils.norm(decl.getSourceFile().fileName),
|
|
656
663
|
importName: "*",
|
|
657
664
|
});
|
|
658
665
|
}
|
|
@@ -665,4 +672,4 @@ export class SdTsCompiler {
|
|
|
665
672
|
return deps;
|
|
666
673
|
}
|
|
667
674
|
}
|
|
668
|
-
//# sourceMappingURL=
|
|
675
|
+
//# sourceMappingURL=sd-ts-compiler.js.map
|