@simplysm/sd-cli 7.0.263 → 7.0.266

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.
Files changed (78) hide show
  1. package/README.md +69 -22
  2. package/{src/entry-points/file/assets → assets/client-files}/assets/icons/icon-128x128.png +0 -0
  3. package/{src/entry-points/file/assets → assets/client-files}/assets/icons/icon-144x144.png +0 -0
  4. package/{src/entry-points/file/assets → assets/client-files}/assets/icons/icon-152x152.png +0 -0
  5. package/{src/entry-points/file/assets → assets/client-files}/assets/icons/icon-192x192.png +0 -0
  6. package/{src/entry-points/file/assets → assets/client-files}/assets/icons/icon-384x384.png +0 -0
  7. package/{src/entry-points/file/assets → assets/client-files}/assets/icons/icon-512x512.png +0 -0
  8. package/{src/entry-points/file/assets → assets/client-files}/assets/icons/icon-72x72.png +0 -0
  9. package/{src/entry-points/file/assets → assets/client-files}/assets/icons/icon-96x96.png +0 -0
  10. package/{src/entry-points/file/assets → assets/client-files}/favicon.ico +0 -0
  11. package/dist/bin/sd-cli.mjs +44 -5
  12. package/dist/build-tool/SdCliCordova.mjs +3 -3
  13. package/dist/build-tool/SdCliIndexFileGenerator.mjs +2 -3
  14. package/dist/builder/SdCliClientBuilder.d.ts +2 -0
  15. package/dist/builder/SdCliClientBuilder.mjs +45 -12
  16. package/dist/builder/SdCliServerBuilder.d.ts +2 -0
  17. package/dist/builder/SdCliServerBuilder.mjs +27 -13
  18. package/dist/entry-points/SdCliPrepare.mjs +34 -34
  19. package/dist/entry-points/SdCliProjectGenerator.d.ts +7 -0
  20. package/dist/entry-points/SdCliProjectGenerator.mjs +65 -33
  21. package/dist/entry-points/file/base/fc_package_eslintrc.mjs +11 -11
  22. package/dist/entry-points/file/base/fc_package_tsconfig.d.ts +1 -0
  23. package/dist/entry-points/file/base/fc_package_tsconfig.mjs +3 -2
  24. package/dist/entry-points/file/client/fc_package_AppModule.mjs +1 -1
  25. package/dist/entry-points/file/client/fc_package_AppPage.mjs +2 -22
  26. package/dist/entry-points/file/client/fc_package_Page.d.ts +4 -0
  27. package/dist/entry-points/file/client/fc_package_Page.mjs +19 -0
  28. package/dist/entry-points/file/project/fc_project_gitignore.mjs +1 -1
  29. package/dist/entry-points/file/project/fc_project_readme.mjs +3 -2
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.mjs +2 -2
  32. package/dist/ng-tools/SdCliNgModuleGenerator.mjs +35 -36
  33. package/dist/packages/SdCliPackage.mjs +2 -2
  34. package/docs/client-add-page.md +8 -0
  35. package/docs/client-router.md +85 -0
  36. package/docs/client-sw.md +101 -0
  37. package/docs/conf-orm.md +81 -0
  38. package/docs/conf-usage.md +5 -0
  39. package/docs/lib-local-update.md +50 -0
  40. package/docs/lib-ts-paths.md +25 -0
  41. package/package.json +6 -6
  42. package/src/SdCliBuildResultError.ts +9 -9
  43. package/src/bin/sd-cli.ts +48 -5
  44. package/src/build-tool/SdCliCacheCompilerHost.ts +77 -77
  45. package/src/build-tool/SdCliCordova.ts +2 -2
  46. package/src/build-tool/SdCliGithubApi.ts +110 -110
  47. package/src/build-tool/SdCliIndexFileGenerator.ts +79 -80
  48. package/src/build-tool/SdCliNgCacheCompilerHost.ts +58 -58
  49. package/src/build-tool/SdCliPackageLinter.ts +74 -74
  50. package/src/builder/SdCliClientBuilder.ts +58 -13
  51. package/src/builder/SdCliServerBuilder.ts +34 -14
  52. package/src/entry-points/SdCliFileCrypto.ts +87 -87
  53. package/src/entry-points/SdCliPrepare.ts +55 -55
  54. package/src/entry-points/SdCliProjectGenerator.ts +80 -38
  55. package/src/entry-points/file/base/fc_package_eslintrc.ts +10 -10
  56. package/src/entry-points/file/base/fc_package_tsconfig.ts +3 -2
  57. package/src/entry-points/file/client/fc_package_AppModule.ts +1 -1
  58. package/src/entry-points/file/client/fc_package_AppPage.ts +1 -21
  59. package/src/entry-points/file/client/fc_package_Page.ts +19 -0
  60. package/src/entry-points/file/project/fc_project_gitignore.ts +1 -1
  61. package/src/entry-points/file/project/fc_project_readme.ts +2 -1
  62. package/src/index.ts +55 -55
  63. package/src/ng-tools/SdCliNgModuleGenerator.ts +639 -640
  64. package/src/ng-tools/babel/SdCliBbFileMetadata.ts +568 -568
  65. package/src/ng-tools/babel/SdCliBbRootMetadata.ts +239 -239
  66. package/src/ng-tools/babel/SdCliBbUtil.ts +15 -15
  67. package/src/ng-tools/babel/TSdCliBbNgMetadata.ts +234 -234
  68. package/src/ng-tools/babel/TSdCliBbTypeMetadata.ts +177 -177
  69. package/src/ng-tools/commons.ts +3 -3
  70. package/src/ng-tools/typescript/SdCliTsFileMetadata.ts +384 -384
  71. package/src/ng-tools/typescript/SdCliTsRootMetadata.ts +32 -32
  72. package/src/ng-tools/typescript/SdCliTsUtil.ts +29 -29
  73. package/src/packages/SdCliPackage.ts +1 -1
  74. package/src/utils/SdCliConfigUtil.ts +94 -94
  75. package/src/utils/SdCliNpmConfigUtil.ts +16 -16
  76. package/dist/entry-points/file/client/fc_package_appicons.d.ts +0 -1
  77. package/dist/entry-points/file/client/fc_package_appicons.mjs +0 -6
  78. package/src/entry-points/file/client/fc_package_appicons.ts +0 -5
@@ -1,239 +1,239 @@
1
- import { SdCliBbFileMetadata } from "./SdCliBbFileMetadata";
2
- import path from "path";
3
- import { INpmConfig } from "../../commons";
4
- import { SdCliNpmConfigUtil } from "../../utils/SdCliNpmConfigUtil";
5
- import { NeverEntryError, StringUtil } from "@simplysm/sd-core-common";
6
- import { FsUtil, PathUtil } from "@simplysm/sd-core-node";
7
- import { TSdCliBbTypeMetadata } from "./TSdCliBbTypeMetadata";
8
- import { TSdCliMetaRef } from "../commons";
9
-
10
- export class SdCliBbRootMetadata {
11
- private readonly _entryMap: Map<string, string>;
12
- private readonly _fileMetaCache = new Map<string, SdCliBbFileMetadata>();
13
-
14
- public constructor(packagePath: string) {
15
- const allDepPaths = this._getAllDepPaths(packagePath);
16
- this._entryMap = this._getEntryMap(allDepPaths);
17
- // const ngDepPaths = this._getNgDepPaths(allDepPaths);
18
- // this._entryMap = this._getEntryMap(ngDepPaths);
19
- }
20
-
21
- public removeCaches(filePaths: string[]): void {
22
- for (const filePath of filePaths) {
23
- this._fileMetaCache.delete(filePath);
24
- }
25
- }
26
-
27
- public getEntryFileMetaRecord(): Record<string, SdCliBbFileMetadata> {
28
- const result: Record<string, SdCliBbFileMetadata> = {};
29
- for (const moduleName of this._entryMap.keys()) {
30
- const entryFilePath = this._entryMap.get(moduleName)!;
31
- result[moduleName] = this._fileMetaCache.getOrCreate(entryFilePath, () => new SdCliBbFileMetadata(entryFilePath))!;
32
- }
33
- return result;
34
- }
35
-
36
- public findMeta(ref: TSdCliMetaRef): TSdCliBbMetadata | TSdCliBbMetadata[] {
37
- const filePath = "moduleName" in ref ? this._entryMap.get(ref.moduleName) : ref.filePath;
38
- if (filePath === undefined) {
39
- throw new NeverEntryError();
40
- }
41
- const fileMeta = this._fileMetaCache.getOrCreate(filePath, () => new SdCliBbFileMetadata(filePath));
42
- if (ref.name === "*") {
43
- const result: TSdCliBbMetadata[] = [];
44
- for (const exp of fileMeta.exports) {
45
- const meta = exp.target;
46
- if (typeof meta !== "string" && "__TSdCliMetaRef__" in meta) {
47
- const resultMeta = this.findMeta(meta);
48
- if (resultMeta instanceof Array) {
49
- result.push(...resultMeta);
50
- }
51
- else {
52
- result.push(resultMeta);
53
- }
54
- }
55
- else {
56
- result.push(meta);
57
- }
58
- }
59
- return result;
60
- }
61
- else {
62
- const meta = fileMeta.findMetaFromOutside(ref.name);
63
- if (meta === undefined) {
64
- throw new NeverEntryError();
65
- }
66
-
67
- if (typeof meta !== "string" && "__TSdCliMetaRef__" in meta) {
68
- return this.findMeta(meta);
69
- }
70
- return meta;
71
- }
72
- }
73
-
74
- public findExportRef(localRef: { filePath: string; name: string }): { moduleName: string; name: string } | undefined {
75
- const record = this.getEntryFileMetaRecord();
76
- for (const moduleName of Object.keys(record)) {
77
- const entryFileMeta = record[moduleName];
78
- for (const exp of entryFileMeta.exports) {
79
- if (
80
- typeof exp.target !== "string" &&
81
- "filePath" in exp.target &&
82
- exp.target.filePath === localRef.filePath
83
- ) {
84
- if (exp.target.name === "*") {
85
- return { moduleName, name: localRef.name };
86
- }
87
- else if (exp.target.name === localRef.name) {
88
- return { moduleName, name: exp.exportedName };
89
- }
90
- }
91
- }
92
- }
93
-
94
- return undefined;
95
- }
96
-
97
- private _getAllDepPaths(packagePath: string): string[] {
98
- const loadedModuleNames: string[] = [];
99
- const results: string[] = [];
100
-
101
- const fn = (currPath: string): void => {
102
- const npmConfig = FsUtil.readJson(path.resolve(currPath, "package.json")) as INpmConfig;
103
-
104
- const deps = SdCliNpmConfigUtil.getDependencies(npmConfig);
105
-
106
- for (const moduleName of deps.defaults) {
107
- if (loadedModuleNames.includes(moduleName)) continue;
108
- loadedModuleNames.push(moduleName);
109
-
110
- const modulePath = FsUtil.findAllParentChildDirPaths("node_modules/" + moduleName, currPath, process.cwd()).first();
111
- if (StringUtil.isNullOrEmpty(modulePath)) {
112
- continue;
113
- }
114
-
115
- results.push(modulePath);
116
-
117
- fn(modulePath);
118
- }
119
- };
120
-
121
- fn(packagePath);
122
-
123
- return results;
124
- }
125
-
126
- // private _getNgDepPaths(allDepPaths: string[]): string[] {
127
- // const results: string[] = [];
128
- //
129
- // for (const depPath of allDepPaths) {
130
- // const npmConfig = FsUtil.readJson(path.resolve(depPath, "package.json")) as INpmConfig;
131
- // const defaultDeps = SdCliNpmConfigUtil.getDependencies(npmConfig).defaults;
132
- // if (npmConfig.name === "@angular/core" || defaultDeps.includes("@angular/core")) {
133
- // results.push(depPath);
134
- // }
135
- // }
136
- //
137
- // return results;
138
- // }
139
-
140
- private _getEntryMap(ngDepPaths: string[]): Map<string, string> {
141
- const entryMap = new Map<string, string>();
142
- for (const ngDepPath of ngDepPaths) {
143
- const npmConfig = FsUtil.readJson(path.resolve(ngDepPath, "package.json")) as INpmConfig;
144
-
145
- const entryFilePath = npmConfig["es2015"] ?? npmConfig["browser"] ?? npmConfig["module"] ?? npmConfig["main"] ?? npmConfig["default"];
146
- if (typeof entryFilePath === "string") {
147
- const realPath = this._getRealFilePath(path.resolve(ngDepPath, entryFilePath));
148
- if (realPath != null) {
149
- entryMap.set(npmConfig.name, realPath);
150
- }
151
- }
152
-
153
- if (npmConfig.exports) {
154
- const exportKeys = Object.keys(npmConfig.exports);
155
- for (const exportKey of exportKeys) {
156
- if (
157
- exportKey.includes("/locales") ||
158
- exportKey.endsWith(".json") ||
159
- exportKey.endsWith("/testing") ||
160
- exportKey.endsWith("/upgrade")
161
- ) {
162
- continue;
163
- }
164
-
165
- const expEntryFilePath = npmConfig.exports[exportKey]["es2015"] ??
166
- npmConfig.exports[exportKey]["browser"] ??
167
- npmConfig.exports[exportKey]["module"] ??
168
- npmConfig.exports[exportKey]["main"] ??
169
- npmConfig.exports[exportKey]["default"];
170
- if (typeof expEntryFilePath === "string") {
171
- const exportPath = path.resolve(ngDepPath, expEntryFilePath);
172
- const exportResult = this._getGlobExportResult(PathUtil.posix(npmConfig.name, exportKey), exportPath);
173
- for (const exportResultItem of exportResult) {
174
- const realPath = this._getRealFilePath(exportResultItem.target);
175
- if (realPath != null) {
176
- entryMap.set(exportResultItem.name, realPath);
177
- }
178
- }
179
- }
180
- }
181
- }
182
- }
183
-
184
- return entryMap;
185
- }
186
-
187
- private _getRealFilePath(itemPath: string): string | undefined {
188
- if (!FsUtil.exists(itemPath)) {
189
- for (const ext of [".mjs", ".cjs", ".js"]) {
190
- if (FsUtil.exists(itemPath + ext)) {
191
- return itemPath + ext;
192
- }
193
- }
194
- }
195
- else if (FsUtil.stat(itemPath).isFile()) {
196
- return itemPath;
197
- }
198
- else {
199
- for (const fileName of ["index.mjs", "index.cjs", "index.js"]) {
200
- if (FsUtil.exists(path.resolve(itemPath, fileName))) {
201
- return path.resolve(itemPath, fileName);
202
- }
203
- }
204
- }
205
-
206
- return undefined;
207
- }
208
-
209
- private _getGlobExportResult(globName: string, globTarget: string): { name: string; target: string }[] {
210
- if (globName.includes("*") && globTarget.includes("*")) {
211
- const result: { name: string; target: string }[] = [];
212
-
213
- const regexpText = globTarget.replace(/[\\/.*]/g, (item) => (
214
- item === "/" || item === "\\" ? "[\\\\/]"
215
- : item === "." ? "\\."
216
- : item === "*" ? "(.*)"
217
- : item
218
- ));
219
-
220
- const targets = FsUtil.glob(globTarget);
221
- for (const target of targets) {
222
- const targetNameMatch = new RegExp(regexpText).exec(target);
223
- if (!targetNameMatch || typeof targetNameMatch[1] === "undefined") {
224
- throw new NeverEntryError();
225
- }
226
- const targetName = targetNameMatch[1];
227
- const name = globName.replace("*", targetName);
228
- result.push({ name, target });
229
- }
230
-
231
- return result;
232
- }
233
- else {
234
- return [{ name: globName, target: globTarget }];
235
- }
236
- }
237
- }
238
-
239
- export type TSdCliBbMetadata = TSdCliBbTypeMetadata | TSdCliMetaRef | string;
1
+ import { SdCliBbFileMetadata } from "./SdCliBbFileMetadata";
2
+ import path from "path";
3
+ import { INpmConfig } from "../../commons";
4
+ import { SdCliNpmConfigUtil } from "../../utils/SdCliNpmConfigUtil";
5
+ import { NeverEntryError, StringUtil } from "@simplysm/sd-core-common";
6
+ import { FsUtil, PathUtil } from "@simplysm/sd-core-node";
7
+ import { TSdCliBbTypeMetadata } from "./TSdCliBbTypeMetadata";
8
+ import { TSdCliMetaRef } from "../commons";
9
+
10
+ export class SdCliBbRootMetadata {
11
+ private readonly _entryMap: Map<string, string>;
12
+ private readonly _fileMetaCache = new Map<string, SdCliBbFileMetadata>();
13
+
14
+ public constructor(packagePath: string) {
15
+ const allDepPaths = this._getAllDepPaths(packagePath);
16
+ this._entryMap = this._getEntryMap(allDepPaths);
17
+ // const ngDepPaths = this._getNgDepPaths(allDepPaths);
18
+ // this._entryMap = this._getEntryMap(ngDepPaths);
19
+ }
20
+
21
+ public removeCaches(filePaths: string[]): void {
22
+ for (const filePath of filePaths) {
23
+ this._fileMetaCache.delete(filePath);
24
+ }
25
+ }
26
+
27
+ public getEntryFileMetaRecord(): Record<string, SdCliBbFileMetadata> {
28
+ const result: Record<string, SdCliBbFileMetadata> = {};
29
+ for (const moduleName of this._entryMap.keys()) {
30
+ const entryFilePath = this._entryMap.get(moduleName)!;
31
+ result[moduleName] = this._fileMetaCache.getOrCreate(entryFilePath, () => new SdCliBbFileMetadata(entryFilePath))!;
32
+ }
33
+ return result;
34
+ }
35
+
36
+ public findMeta(ref: TSdCliMetaRef): TSdCliBbMetadata | TSdCliBbMetadata[] {
37
+ const filePath = "moduleName" in ref ? this._entryMap.get(ref.moduleName) : ref.filePath;
38
+ if (filePath === undefined) {
39
+ throw new NeverEntryError();
40
+ }
41
+ const fileMeta = this._fileMetaCache.getOrCreate(filePath, () => new SdCliBbFileMetadata(filePath));
42
+ if (ref.name === "*") {
43
+ const result: TSdCliBbMetadata[] = [];
44
+ for (const exp of fileMeta.exports) {
45
+ const meta = exp.target;
46
+ if (typeof meta !== "string" && "__TSdCliMetaRef__" in meta) {
47
+ const resultMeta = this.findMeta(meta);
48
+ if (resultMeta instanceof Array) {
49
+ result.push(...resultMeta);
50
+ }
51
+ else {
52
+ result.push(resultMeta);
53
+ }
54
+ }
55
+ else {
56
+ result.push(meta);
57
+ }
58
+ }
59
+ return result;
60
+ }
61
+ else {
62
+ const meta = fileMeta.findMetaFromOutside(ref.name);
63
+ if (meta === undefined) {
64
+ throw new NeverEntryError();
65
+ }
66
+
67
+ if (typeof meta !== "string" && "__TSdCliMetaRef__" in meta) {
68
+ return this.findMeta(meta);
69
+ }
70
+ return meta;
71
+ }
72
+ }
73
+
74
+ public findExportRef(localRef: { filePath: string; name: string }): { moduleName: string; name: string } | undefined {
75
+ const record = this.getEntryFileMetaRecord();
76
+ for (const moduleName of Object.keys(record)) {
77
+ const entryFileMeta = record[moduleName];
78
+ for (const exp of entryFileMeta.exports) {
79
+ if (
80
+ typeof exp.target !== "string" &&
81
+ "filePath" in exp.target &&
82
+ exp.target.filePath === localRef.filePath
83
+ ) {
84
+ if (exp.target.name === "*") {
85
+ return { moduleName, name: localRef.name };
86
+ }
87
+ else if (exp.target.name === localRef.name) {
88
+ return { moduleName, name: exp.exportedName };
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ return undefined;
95
+ }
96
+
97
+ private _getAllDepPaths(packagePath: string): string[] {
98
+ const loadedModuleNames: string[] = [];
99
+ const results: string[] = [];
100
+
101
+ const fn = (currPath: string): void => {
102
+ const npmConfig = FsUtil.readJson(path.resolve(currPath, "package.json")) as INpmConfig;
103
+
104
+ const deps = SdCliNpmConfigUtil.getDependencies(npmConfig);
105
+
106
+ for (const moduleName of deps.defaults) {
107
+ if (loadedModuleNames.includes(moduleName)) continue;
108
+ loadedModuleNames.push(moduleName);
109
+
110
+ const modulePath = FsUtil.findAllParentChildDirPaths("node_modules/" + moduleName, currPath, process.cwd()).first();
111
+ if (StringUtil.isNullOrEmpty(modulePath)) {
112
+ continue;
113
+ }
114
+
115
+ results.push(modulePath);
116
+
117
+ fn(modulePath);
118
+ }
119
+ };
120
+
121
+ fn(packagePath);
122
+
123
+ return results;
124
+ }
125
+
126
+ // private _getNgDepPaths(allDepPaths: string[]): string[] {
127
+ // const results: string[] = [];
128
+ //
129
+ // for (const depPath of allDepPaths) {
130
+ // const npmConfig = FsUtil.readJson(path.resolve(depPath, "package.json")) as INpmConfig;
131
+ // const defaultDeps = SdCliNpmConfigUtil.getDependencies(npmConfig).defaults;
132
+ // if (npmConfig.name === "@angular/core" || defaultDeps.includes("@angular/core")) {
133
+ // results.push(depPath);
134
+ // }
135
+ // }
136
+ //
137
+ // return results;
138
+ // }
139
+
140
+ private _getEntryMap(ngDepPaths: string[]): Map<string, string> {
141
+ const entryMap = new Map<string, string>();
142
+ for (const ngDepPath of ngDepPaths) {
143
+ const npmConfig = FsUtil.readJson(path.resolve(ngDepPath, "package.json")) as INpmConfig;
144
+
145
+ const entryFilePath = npmConfig["es2015"] ?? npmConfig["browser"] ?? npmConfig["module"] ?? npmConfig["main"] ?? npmConfig["default"];
146
+ if (typeof entryFilePath === "string") {
147
+ const realPath = this._getRealFilePath(path.resolve(ngDepPath, entryFilePath));
148
+ if (realPath != null) {
149
+ entryMap.set(npmConfig.name, realPath);
150
+ }
151
+ }
152
+
153
+ if (npmConfig.exports) {
154
+ const exportKeys = Object.keys(npmConfig.exports);
155
+ for (const exportKey of exportKeys) {
156
+ if (
157
+ exportKey.includes("/locales") ||
158
+ exportKey.endsWith(".json") ||
159
+ exportKey.endsWith("/testing") ||
160
+ exportKey.endsWith("/upgrade")
161
+ ) {
162
+ continue;
163
+ }
164
+
165
+ const expEntryFilePath = npmConfig.exports[exportKey]["es2015"] ??
166
+ npmConfig.exports[exportKey]["browser"] ??
167
+ npmConfig.exports[exportKey]["module"] ??
168
+ npmConfig.exports[exportKey]["main"] ??
169
+ npmConfig.exports[exportKey]["default"];
170
+ if (typeof expEntryFilePath === "string") {
171
+ const exportPath = path.resolve(ngDepPath, expEntryFilePath);
172
+ const exportResult = this._getGlobExportResult(PathUtil.posix(npmConfig.name, exportKey), exportPath);
173
+ for (const exportResultItem of exportResult) {
174
+ const realPath = this._getRealFilePath(exportResultItem.target);
175
+ if (realPath != null) {
176
+ entryMap.set(exportResultItem.name, realPath);
177
+ }
178
+ }
179
+ }
180
+ }
181
+ }
182
+ }
183
+
184
+ return entryMap;
185
+ }
186
+
187
+ private _getRealFilePath(itemPath: string): string | undefined {
188
+ if (!FsUtil.exists(itemPath)) {
189
+ for (const ext of [".mjs", ".cjs", ".js"]) {
190
+ if (FsUtil.exists(itemPath + ext)) {
191
+ return itemPath + ext;
192
+ }
193
+ }
194
+ }
195
+ else if (FsUtil.stat(itemPath).isFile()) {
196
+ return itemPath;
197
+ }
198
+ else {
199
+ for (const fileName of ["index.mjs", "index.cjs", "index.js"]) {
200
+ if (FsUtil.exists(path.resolve(itemPath, fileName))) {
201
+ return path.resolve(itemPath, fileName);
202
+ }
203
+ }
204
+ }
205
+
206
+ return undefined;
207
+ }
208
+
209
+ private _getGlobExportResult(globName: string, globTarget: string): { name: string; target: string }[] {
210
+ if (globName.includes("*") && globTarget.includes("*")) {
211
+ const result: { name: string; target: string }[] = [];
212
+
213
+ const regexpText = globTarget.replace(/[\\/.*]/g, (item) => (
214
+ item === "/" || item === "\\" ? "[\\\\/]"
215
+ : item === "." ? "\\."
216
+ : item === "*" ? "(.*)"
217
+ : item
218
+ ));
219
+
220
+ const targets = FsUtil.glob(globTarget);
221
+ for (const target of targets) {
222
+ const targetNameMatch = new RegExp(regexpText).exec(target);
223
+ if (!targetNameMatch || typeof targetNameMatch[1] === "undefined") {
224
+ throw new NeverEntryError();
225
+ }
226
+ const targetName = targetNameMatch[1];
227
+ const name = globName.replace("*", targetName);
228
+ result.push({ name, target });
229
+ }
230
+
231
+ return result;
232
+ }
233
+ else {
234
+ return [{ name: globName, target: globTarget }];
235
+ }
236
+ }
237
+ }
238
+
239
+ export type TSdCliBbMetadata = TSdCliBbTypeMetadata | TSdCliMetaRef | string;
@@ -1,15 +1,15 @@
1
- import { Node } from "@babel/types";
2
- import { SdCliBuildResultError } from "../../SdCliBuildResultError";
3
-
4
- export class SdCliBbUtil {
5
- public static error(message: string, filePath?: string, meta?: Node): SdCliBuildResultError {
6
- return new SdCliBuildResultError({
7
- filePath,
8
- line: meta?.loc?.start.line,
9
- char: meta?.loc?.start.column,
10
- code: undefined,
11
- severity: "error",
12
- message: message
13
- });
14
- }
15
- }
1
+ import { Node } from "@babel/types";
2
+ import { SdCliBuildResultError } from "../../SdCliBuildResultError";
3
+
4
+ export class SdCliBbUtil {
5
+ public static error(message: string, filePath?: string, meta?: Node): SdCliBuildResultError {
6
+ return new SdCliBuildResultError({
7
+ filePath,
8
+ line: meta?.loc?.start.line,
9
+ char: meta?.loc?.start.column,
10
+ code: undefined,
11
+ severity: "error",
12
+ message: message
13
+ });
14
+ }
15
+ }