@cabloy/module-info 1.3.34 → 1.3.36
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/index.d.mts +182 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +126 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +3 -3
- package/LICENSE +0 -21
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -151
- package/dist/interface.d.ts +0 -137
- package/dist/onionScenesMeta.d.ts +0 -5
- package/dist/utils.d.ts +0 -6
- package/dist/vona.d.ts +0 -12
- package/dist/zova.d.ts +0 -17
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
//#region src/vona.d.ts
|
|
2
|
+
type VonaMetaFlavor = 'normal' | 'play' | 'demo' | 'docker' | 'ci' | keyof VonaMetaFlavorExtend;
|
|
3
|
+
type VonaMetaMode = 'test' | 'dev' | 'prod';
|
|
4
|
+
interface VonaConfigMeta {
|
|
5
|
+
flavor: VonaMetaFlavor;
|
|
6
|
+
mode: VonaMetaMode;
|
|
7
|
+
}
|
|
8
|
+
interface VonaOnionOptionsMeta {
|
|
9
|
+
flavor?: VonaMetaFlavor | VonaMetaFlavor[];
|
|
10
|
+
mode?: VonaMetaMode | VonaMetaMode[];
|
|
11
|
+
}
|
|
12
|
+
interface VonaMetaFlavorExtend {}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/zova.d.ts
|
|
15
|
+
type ZovaMetaFlavor = 'front' | 'admin' | 'vonaHome' | 'vonaCabloy' | keyof ZovaMetaFlavorExtend;
|
|
16
|
+
type ZovaMetaMode = 'development' | 'production';
|
|
17
|
+
type ZovaMetaAppMode = 'spa' | 'ssr' | 'pwa' | 'cordova' | 'capacitor' | 'electron' | 'bex' | keyof ZovaMetaAppModeExtend;
|
|
18
|
+
interface ZovaConfigMeta {
|
|
19
|
+
flavor: ZovaMetaFlavor;
|
|
20
|
+
mode: ZovaMetaMode;
|
|
21
|
+
appMode: ZovaMetaAppMode;
|
|
22
|
+
}
|
|
23
|
+
interface ZovaOnionOptionsMeta {
|
|
24
|
+
flavor?: ZovaMetaFlavor | ZovaMetaFlavor[];
|
|
25
|
+
mode?: ZovaMetaMode | ZovaMetaMode[];
|
|
26
|
+
appMode?: ZovaMetaAppMode | ZovaMetaAppMode[];
|
|
27
|
+
}
|
|
28
|
+
interface ZovaMetaFlavorExtend {}
|
|
29
|
+
interface ZovaMetaAppModeExtend {}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/interface.d.ts
|
|
32
|
+
type TypeProjectMode = 'front' | 'api' | 'zova' | 'vona';
|
|
33
|
+
type TypeProjectEntityType = 'module' | 'suite';
|
|
34
|
+
type TypeBrandName = 'zova' | 'vona';
|
|
35
|
+
interface IOnionsConfigItem {
|
|
36
|
+
enable?: boolean;
|
|
37
|
+
meta?: ZovaOnionOptionsMeta;
|
|
38
|
+
match?: string | string[];
|
|
39
|
+
ignore?: string | string[];
|
|
40
|
+
dependencies?: string | string[];
|
|
41
|
+
dependents?: string | string[];
|
|
42
|
+
}
|
|
43
|
+
type TypeOnionsConfigItems = Record<string, IOnionsConfigItem>;
|
|
44
|
+
type TypeOnionsConfig = Record<string, TypeOnionsConfigItems>;
|
|
45
|
+
interface IModuleCapabilities {
|
|
46
|
+
monkey?: boolean;
|
|
47
|
+
sync?: boolean;
|
|
48
|
+
icon?: boolean;
|
|
49
|
+
theme?: boolean;
|
|
50
|
+
locale?: boolean;
|
|
51
|
+
preload?: boolean;
|
|
52
|
+
}
|
|
53
|
+
interface IModuleCapabilitiesZova extends IModuleCapabilities {
|
|
54
|
+
meta?: ZovaOnionOptionsMeta;
|
|
55
|
+
server?: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface IModuleCapabilitiesVona extends IModuleCapabilities {
|
|
58
|
+
meta?: VonaOnionOptionsMeta;
|
|
59
|
+
}
|
|
60
|
+
interface IModuleInfo {
|
|
61
|
+
pid: string;
|
|
62
|
+
name: string;
|
|
63
|
+
fullName: string;
|
|
64
|
+
relativeName: string;
|
|
65
|
+
url: string;
|
|
66
|
+
vendor?: boolean;
|
|
67
|
+
node_modules?: boolean;
|
|
68
|
+
originalName: string;
|
|
69
|
+
capabilities?: IModuleCapabilities;
|
|
70
|
+
onionsMeta?: {
|
|
71
|
+
onions?: OnionScenesMeta;
|
|
72
|
+
metas?: OnionMetasMeta;
|
|
73
|
+
onionsConfig?: TypeOnionsConfig;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
interface ISuiteModuleBase {
|
|
77
|
+
name: string;
|
|
78
|
+
info: IModuleInfo;
|
|
79
|
+
root: string;
|
|
80
|
+
pkg: string;
|
|
81
|
+
package: IModulePackage;
|
|
82
|
+
}
|
|
83
|
+
interface ISuite extends ISuiteModuleBase {
|
|
84
|
+
modules: string[];
|
|
85
|
+
}
|
|
86
|
+
interface IModule extends ISuiteModuleBase {
|
|
87
|
+
suite?: string;
|
|
88
|
+
}
|
|
89
|
+
interface IBundleVendor {
|
|
90
|
+
match: Array<string | RegExp>;
|
|
91
|
+
output: string;
|
|
92
|
+
}
|
|
93
|
+
interface OnionSceneMeta {
|
|
94
|
+
module?: IModule;
|
|
95
|
+
sceneIsolate?: boolean;
|
|
96
|
+
hasLocal?: boolean;
|
|
97
|
+
optionsNone?: boolean;
|
|
98
|
+
optionsRoute?: boolean;
|
|
99
|
+
optionsArgumentPipe?: boolean;
|
|
100
|
+
optionsDynamic?: boolean;
|
|
101
|
+
optionsPackage?: boolean;
|
|
102
|
+
optionsCustomInterfaceTemplate?: string;
|
|
103
|
+
optionsGlobalInterfaceName?: string;
|
|
104
|
+
optionsGlobalInterfaceFrom?: string;
|
|
105
|
+
scopeResource?: boolean;
|
|
106
|
+
scopeResourceTypeTemplate?: string;
|
|
107
|
+
beanGeneral?: boolean;
|
|
108
|
+
snippets?: string;
|
|
109
|
+
boilerplate?: string;
|
|
110
|
+
metadataCustom?: string;
|
|
111
|
+
}
|
|
112
|
+
interface OnionMetaMeta {
|
|
113
|
+
module?: IModule;
|
|
114
|
+
scopeResource?: boolean;
|
|
115
|
+
snippets?: string;
|
|
116
|
+
boilerplate?: string;
|
|
117
|
+
metadataCustom?: string;
|
|
118
|
+
}
|
|
119
|
+
type OnionScenesMeta = Record<string, OnionSceneMeta>;
|
|
120
|
+
type OnionMetasMeta = Record<string, OnionMetaMeta>;
|
|
121
|
+
interface IModulePackage {
|
|
122
|
+
name: string;
|
|
123
|
+
version: string;
|
|
124
|
+
vonaModule?: {
|
|
125
|
+
capabilities?: IModuleCapabilitiesVona;
|
|
126
|
+
fileVersion: number;
|
|
127
|
+
dependencies?: Record<string, string>;
|
|
128
|
+
globalDependencies?: Record<string, string | boolean>;
|
|
129
|
+
globalDependenciesDev?: Record<string, string | boolean>;
|
|
130
|
+
onions?: OnionScenesMeta;
|
|
131
|
+
metas?: OnionMetasMeta;
|
|
132
|
+
};
|
|
133
|
+
zovaModule?: {
|
|
134
|
+
capabilities?: IModuleCapabilitiesZova;
|
|
135
|
+
dependencies?: Record<string, string>;
|
|
136
|
+
globalDependencies?: Record<string, string | boolean>;
|
|
137
|
+
globalDependenciesDev?: Record<string, string | boolean>;
|
|
138
|
+
onions?: OnionScenesMeta;
|
|
139
|
+
metas?: OnionMetasMeta;
|
|
140
|
+
onionsConfig?: TypeOnionsConfig;
|
|
141
|
+
bundle?: {
|
|
142
|
+
vendors?: Array<IBundleVendor>;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
title: string;
|
|
146
|
+
description: string;
|
|
147
|
+
author: string;
|
|
148
|
+
files: string[];
|
|
149
|
+
dependencies: Record<string, string>;
|
|
150
|
+
devDependencies: Record<string, string>;
|
|
151
|
+
}
|
|
152
|
+
interface IGlobBeanFile {
|
|
153
|
+
sceneName: string;
|
|
154
|
+
sceneNameCapitalize: string;
|
|
155
|
+
file: string;
|
|
156
|
+
fileContent: string;
|
|
157
|
+
fileName: string;
|
|
158
|
+
fileNameJS: string;
|
|
159
|
+
fileNameJSRelative: string;
|
|
160
|
+
className: string;
|
|
161
|
+
beanName: string;
|
|
162
|
+
beanNameFull: string;
|
|
163
|
+
beanNameCapitalize: string;
|
|
164
|
+
isIgnore: boolean;
|
|
165
|
+
isVirtual: boolean;
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/onionScenesMeta.d.ts
|
|
169
|
+
declare function getOnionScenesMeta(modules: Record<string, IModule>): OnionScenesMeta;
|
|
170
|
+
declare function getOnionMetasMeta(modules: Record<string, IModule>): OnionMetasMeta;
|
|
171
|
+
declare function _getOnionScenesMeta(modules: Record<string, IModule>): {};
|
|
172
|
+
declare function _getOnionMetasMeta(modules: Record<string, IModule>): {};
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/utils.d.ts
|
|
175
|
+
declare function parseInfoFromPath(pathName?: string | null): IModuleInfo | undefined;
|
|
176
|
+
declare function parseInfo(moduleName: string | undefined): IModuleInfo | undefined;
|
|
177
|
+
declare function parseInfoPro(moduleName: string | undefined, projectMode: TypeProjectMode, projectEntityType: TypeProjectEntityType): IModuleInfo | undefined;
|
|
178
|
+
declare function parseName(moduleUrl: any): string | undefined;
|
|
179
|
+
declare function relativeNameToCapitalize(moduleName: string, firstCharToUpperCase: boolean): string;
|
|
180
|
+
//#endregion
|
|
181
|
+
export { IBundleVendor, IGlobBeanFile, IModule, IModuleCapabilities, IModuleCapabilitiesVona, IModuleCapabilitiesZova, IModuleInfo, IModulePackage, IOnionsConfigItem, ISuite, ISuiteModuleBase, OnionMetaMeta, OnionMetasMeta, OnionSceneMeta, OnionScenesMeta, TypeBrandName, TypeOnionsConfig, TypeOnionsConfigItems, TypeProjectEntityType, TypeProjectMode, VonaConfigMeta, VonaMetaFlavor, VonaMetaFlavorExtend, VonaMetaMode, VonaOnionOptionsMeta, ZovaConfigMeta, ZovaMetaAppMode, ZovaMetaAppModeExtend, ZovaMetaFlavor, ZovaMetaFlavorExtend, ZovaMetaMode, ZovaOnionOptionsMeta, _getOnionMetasMeta, _getOnionScenesMeta, getOnionMetasMeta, getOnionScenesMeta, parseInfo, parseInfoFromPath, parseInfoPro, parseName, relativeNameToCapitalize };
|
|
182
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/vona.ts","../src/zova.ts","../src/interface.ts","../src/onionScenesMeta.ts","../src/utils.ts"],"sourcesContent":[],"mappings":";KAAY,cAAA,wDAAsE;AAAtE,KACA,YAAA,GADc,MAAwD,GAAA,KAAA,GAAA,MAAA;AACtE,UACK,cAAA,CADO;EACP,MAAA,EACP,cADqB;EAKd,IAAA,EAHT,YAGS;;AACW,UADX,oBAAA,CACW;EACnB,MAAA,CAAA,EADE,cACF,GADmB,cACnB,EAAA;EAAe,IAAA,CAAA,EAAf,YAAe,GAAA,YAAA,EAAA;;AAGP,UAAA,oBAAA,CAAoB;;;KCZzB,cAAA,yDAAuE;ADAvE,KCCA,YAAA,GDDc,aAAwD,GAAA,YAAoB;AAC1F,KCCA,eAAA,GDDY,KAAA,GAAA,KAAA,GAAA,KAAA,GAAA,SAAA,GAAA,WAAA,GAAA,UAAA,GAAA,KAAA,GAAA,MCShB,qBDTgB;AACP,UCUA,cAAA,CDVc;EAKd,MAAA,ECMP,cDNO;EACN,IAAA,ECMH,YDNG;EAAiB,OAAA,ECOjB,eDPiB;;AACJ,UCSP,oBAAA,CDTO;EAAY,MAAA,CAAA,ECUzB,cDVyB,GCUR,cDVQ,EAAA;EAGnB,IAAA,CAAA,ECQR,YDRQ,GCQO,YDRa,EAAA;YCSzB,kBAAkB;;UAGb,oBAAA,EAxBjB;AACY,UAwBK,qBAAA,CAxBO,CACxB;;;ADDY,KEEA,eAAA,GFFY,OAAA,GAAA,KAAA,GAAA,MAAA,GAAA,MAAA;AACP,KEEL,qBAAA,GFDF,QAAA,GAAA,OACF;AAGS,KEFL,aAAA,GFEyB,MAAA,GAAA,MAAA;AAC1B,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,MAAA,EAAA,oBAAA,EAAA,OAAA,CAAA,EAAA,MAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
//#region src/onionScenesMeta.ts
|
|
2
|
+
let __onionScenesMeta;
|
|
3
|
+
function getOnionScenesMeta(modules) {
|
|
4
|
+
if (!__onionScenesMeta) __onionScenesMeta = _getOnionScenesMeta(modules);
|
|
5
|
+
return __onionScenesMeta;
|
|
6
|
+
}
|
|
7
|
+
let __onionMetasMeta;
|
|
8
|
+
function getOnionMetasMeta(modules) {
|
|
9
|
+
if (!__onionMetasMeta) __onionMetasMeta = _getOnionMetasMeta(modules);
|
|
10
|
+
return __onionMetasMeta;
|
|
11
|
+
}
|
|
12
|
+
function _getOnionScenesMeta(modules) {
|
|
13
|
+
const result = {};
|
|
14
|
+
for (const moduleName in modules) {
|
|
15
|
+
const module = modules[moduleName];
|
|
16
|
+
const onions = module.info.onionsMeta?.onions;
|
|
17
|
+
if (!onions) continue;
|
|
18
|
+
for (const sceneName in onions) result[sceneName] = {
|
|
19
|
+
...onions[sceneName],
|
|
20
|
+
module
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
function _getOnionMetasMeta(modules) {
|
|
26
|
+
const result = {};
|
|
27
|
+
for (const moduleName in modules) {
|
|
28
|
+
const module = modules[moduleName];
|
|
29
|
+
const metas = module.info.onionsMeta?.metas;
|
|
30
|
+
if (!metas) continue;
|
|
31
|
+
for (const sceneName in metas) result[sceneName] = {
|
|
32
|
+
...metas[sceneName],
|
|
33
|
+
module
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/utils.ts
|
|
41
|
+
function parseInfoFromPath(pathName) {
|
|
42
|
+
if (!pathName) return;
|
|
43
|
+
pathName = pathName.replace(/\\/g, "/");
|
|
44
|
+
const parts = pathName.split("/");
|
|
45
|
+
for (let i = parts.length - 1; i >= 0; i--) {
|
|
46
|
+
const part = parts[i];
|
|
47
|
+
if (!part.includes("-")) continue;
|
|
48
|
+
const info = parseInfo(part);
|
|
49
|
+
if (!info) continue;
|
|
50
|
+
return info;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const PREFIX_A = "/api/";
|
|
54
|
+
const PREFIX_B = "vona-module-";
|
|
55
|
+
const PREFIX_C = "./vona-module-";
|
|
56
|
+
const PREFIX_D = "./";
|
|
57
|
+
const PREFIX_E = "/";
|
|
58
|
+
function parseInfo(moduleName) {
|
|
59
|
+
if (!moduleName) return;
|
|
60
|
+
if (moduleName.includes("://")) return;
|
|
61
|
+
if (moduleName.charAt(0) === "/") moduleName = moduleName.substring(1);
|
|
62
|
+
let parts = moduleName.split("/").filter((item) => item);
|
|
63
|
+
if (parts.length < 2) {
|
|
64
|
+
parts = moduleName.split("-").filter((item) => item);
|
|
65
|
+
if (parts.length < 2) return;
|
|
66
|
+
if (parts.length === 4) parts = parts.slice(2);
|
|
67
|
+
if (parts.length === 5) parts = parts.slice(3);
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
pid: parts[0],
|
|
71
|
+
name: parts[1],
|
|
72
|
+
relativeName: `${parts[0]}-${parts[1]}`,
|
|
73
|
+
url: `${parts[0]}/${parts[1]}`,
|
|
74
|
+
originalName: parts.join("-")
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function parseInfoPro(moduleName, projectMode, projectEntityType) {
|
|
78
|
+
const info = parseInfo(moduleName);
|
|
79
|
+
if (!info) return info;
|
|
80
|
+
if (["zova", "vona"].includes(projectMode)) info.fullName = `${projectMode}-${projectEntityType}-${info.relativeName}`;
|
|
81
|
+
else info.fullName = `cabloy-${projectEntityType}-${projectMode}-${info.relativeName}`;
|
|
82
|
+
return info;
|
|
83
|
+
}
|
|
84
|
+
function parseName(moduleUrl) {
|
|
85
|
+
const moduleName = _parseNameInner(moduleUrl);
|
|
86
|
+
if (!moduleName) return;
|
|
87
|
+
const [a, b] = moduleName.split("-");
|
|
88
|
+
if (!a || !b) return;
|
|
89
|
+
return moduleName;
|
|
90
|
+
}
|
|
91
|
+
function _parseNameInner(moduleUrl) {
|
|
92
|
+
if (!moduleUrl) return;
|
|
93
|
+
if (moduleUrl.indexOf("/api/static/") === 0) moduleUrl = `/api/${moduleUrl.substring(12)}`;
|
|
94
|
+
if (moduleUrl.indexOf(PREFIX_A) === 0) return _parseNameLikeUrl(moduleUrl, PREFIX_A);
|
|
95
|
+
else if (moduleUrl.indexOf(PREFIX_B) === 0) return _parseName(moduleUrl, PREFIX_B);
|
|
96
|
+
else if (moduleUrl.indexOf(PREFIX_C) === 0) return _parseName(moduleUrl, PREFIX_C);
|
|
97
|
+
else if (moduleUrl.indexOf(PREFIX_D) === 0) return _parseName(moduleUrl, PREFIX_D);
|
|
98
|
+
else if (moduleUrl.indexOf(PREFIX_E) === 0) return _parseNameLikeUrl(moduleUrl, PREFIX_E);
|
|
99
|
+
else return _parseName(moduleUrl.replace("/", "-"), "");
|
|
100
|
+
}
|
|
101
|
+
function _parseNameLikeUrl(moduleUrl, prefix) {
|
|
102
|
+
const posA = prefix.length;
|
|
103
|
+
const posB = moduleUrl.indexOf("/", posA) + 1;
|
|
104
|
+
if (posB === 0) return;
|
|
105
|
+
let posC = moduleUrl.indexOf("/", posB);
|
|
106
|
+
if (posC === -1) posC = moduleUrl.length;
|
|
107
|
+
return moduleUrl.substring(posA, posC).replace("/", "-");
|
|
108
|
+
}
|
|
109
|
+
function _parseName(moduleUrl, prefix) {
|
|
110
|
+
const posA = prefix.length;
|
|
111
|
+
let posB = moduleUrl.indexOf("/", posA);
|
|
112
|
+
if (posB === -1) posB = moduleUrl.indexOf(":", posA);
|
|
113
|
+
if (posB === -1) posB = moduleUrl.indexOf(".", posA);
|
|
114
|
+
if (posB === -1) posB = moduleUrl.length;
|
|
115
|
+
return moduleUrl.substring(posA, posB);
|
|
116
|
+
}
|
|
117
|
+
function relativeNameToCapitalize(moduleName, firstCharToUpperCase) {
|
|
118
|
+
return moduleName.split("-").map((name, index) => {
|
|
119
|
+
if (index === 0 && !firstCharToUpperCase) return name;
|
|
120
|
+
return name.charAt(0).toUpperCase() + name.substring(1);
|
|
121
|
+
}).join("");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//#endregion
|
|
125
|
+
export { _getOnionMetasMeta, _getOnionScenesMeta, getOnionMetasMeta, getOnionScenesMeta, parseInfo, parseInfoFromPath, parseInfoPro, parseName, relativeNameToCapitalize };
|
|
126
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["__onionScenesMeta: OnionScenesMeta","__onionMetasMeta: OnionMetasMeta"],"sources":["../src/onionScenesMeta.ts","../src/utils.ts"],"sourcesContent":["import type { IModule, OnionMetasMeta, OnionScenesMeta } from './interface.ts';\n\nlet __onionScenesMeta: OnionScenesMeta;\nexport function getOnionScenesMeta(modules: Record<string, IModule>) {\n if (!__onionScenesMeta) {\n __onionScenesMeta = _getOnionScenesMeta(modules);\n }\n return __onionScenesMeta;\n}\n\nlet __onionMetasMeta: OnionMetasMeta;\nexport function getOnionMetasMeta(modules: Record<string, IModule>) {\n if (!__onionMetasMeta) {\n __onionMetasMeta = _getOnionMetasMeta(modules);\n }\n return __onionMetasMeta;\n}\n\nexport function _getOnionScenesMeta(modules: Record<string, IModule>) {\n const result = {};\n for (const moduleName in modules) {\n const module = modules[moduleName];\n const onions = module.info.onionsMeta?.onions;\n if (!onions) continue;\n for (const sceneName in onions) {\n result[sceneName] = { ...onions[sceneName], module };\n }\n }\n return result;\n}\n\nexport function _getOnionMetasMeta(modules: Record<string, IModule>) {\n const result = {};\n for (const moduleName in modules) {\n const module = modules[moduleName];\n const metas = module.info.onionsMeta?.metas;\n if (!metas) continue;\n for (const sceneName in metas) {\n result[sceneName] = { ...metas[sceneName], module };\n }\n }\n return result;\n}\n","import type { IModuleInfo, TypeProjectEntityType, TypeProjectMode } from './interface.ts';\n\nexport function parseInfoFromPath(pathName?: string | null): IModuleInfo | undefined {\n if (!pathName) return;\n pathName = pathName.replace(/\\\\/g, '/');\n const parts = pathName.split('/');\n for (let i = parts.length - 1; i >= 0; i--) {\n const part = parts[i];\n if (!part.includes('-')) continue;\n const info = parseInfo(part);\n if (!info) continue;\n return info;\n }\n}\n\nconst PREFIX_A = '/api/';\nconst PREFIX_B = 'vona-module-';\nconst PREFIX_C = './vona-module-';\nconst PREFIX_D = './';\nconst PREFIX_E = '/';\n\n// aa-hello aa/hello\n// first check / then -\nexport function parseInfo(moduleName: string | undefined): IModuleInfo | undefined {\n if (!moduleName) return;\n if (moduleName.includes('://')) return;\n if (moduleName.charAt(0) === '/') moduleName = moduleName.substring(1);\n let parts = moduleName.split('/').filter(item => item);\n if (parts.length < 2) {\n parts = moduleName.split('-').filter(item => item);\n if (parts.length < 2) return;\n if (parts.length === 4) parts = parts.slice(2);\n if (parts.length === 5) parts = parts.slice(3);\n }\n const info = {\n pid: parts[0],\n name: parts[1],\n relativeName: `${parts[0]}-${parts[1]}`,\n url: `${parts[0]}/${parts[1]}`,\n originalName: parts.join('-'),\n } as IModuleInfo;\n return info;\n}\n\nexport function parseInfoPro(\n moduleName: string | undefined,\n projectMode: TypeProjectMode,\n projectEntityType: TypeProjectEntityType,\n): IModuleInfo | undefined {\n const info = parseInfo(moduleName);\n if (!info) return info;\n if (['zova', 'vona'].includes(projectMode)) {\n info.fullName = `${projectMode}-${projectEntityType}-${info.relativeName}`;\n } else {\n info.fullName = `cabloy-${projectEntityType}-${projectMode}-${info.relativeName}`;\n }\n return info;\n}\n\n// /api/aa/hello/home/index\n// vona-module-aa-hello\n// ./aa-hello/\n// ./vona-module-aa-hello/\nexport function parseName(moduleUrl): string | undefined {\n const moduleName = _parseNameInner(moduleUrl);\n if (!moduleName) return;\n const [a, b] = moduleName.split('-');\n if (!a || !b) return;\n return moduleName;\n}\n\nfunction _parseNameInner(moduleUrl): string | undefined {\n if (!moduleUrl) return;\n if (moduleUrl.indexOf('/api/static/') === 0) {\n moduleUrl = `/api/${moduleUrl.substring('/api/static/'.length)}`;\n }\n if (moduleUrl.indexOf(PREFIX_A) === 0) {\n return _parseNameLikeUrl(moduleUrl, PREFIX_A);\n } else if (moduleUrl.indexOf(PREFIX_B) === 0) {\n return _parseName(moduleUrl, PREFIX_B);\n } else if (moduleUrl.indexOf(PREFIX_C) === 0) {\n return _parseName(moduleUrl, PREFIX_C);\n } else if (moduleUrl.indexOf(PREFIX_D) === 0) {\n return _parseName(moduleUrl, PREFIX_D);\n } else if (moduleUrl.indexOf(PREFIX_E) === 0) {\n return _parseNameLikeUrl(moduleUrl, PREFIX_E);\n } else {\n // test-home test/home\n return _parseName(moduleUrl.replace('/', '-'), '');\n }\n}\n\nfunction _parseNameLikeUrl(moduleUrl, prefix): string | undefined {\n const posA = prefix.length;\n const posB = moduleUrl.indexOf('/', posA) + 1;\n if (posB === 0) return;\n let posC = moduleUrl.indexOf('/', posB);\n if (posC === -1) posC = moduleUrl.length;\n return moduleUrl.substring(posA, posC).replace('/', '-');\n}\n\nfunction _parseName(moduleUrl, prefix) {\n const posA = prefix.length;\n let posB = moduleUrl.indexOf('/', posA);\n if (posB === -1) posB = moduleUrl.indexOf(':', posA);\n if (posB === -1) posB = moduleUrl.indexOf('.', posA);\n if (posB === -1) posB = moduleUrl.length;\n return moduleUrl.substring(posA, posB);\n}\n\nexport function relativeNameToCapitalize(moduleName: string, firstCharToUpperCase: boolean): string {\n return moduleName\n .split('-')\n .map((name, index) => {\n if (index === 0 && !firstCharToUpperCase) return name;\n return name.charAt(0).toUpperCase() + name.substring(1);\n })\n .join('');\n}\n"],"mappings":";AAEA,IAAIA;AACJ,SAAgB,mBAAmB,SAAkC;AACnE,KAAI,CAAC,kBACH,qBAAoB,oBAAoB,QAAQ;AAElD,QAAO;;AAGT,IAAIC;AACJ,SAAgB,kBAAkB,SAAkC;AAClE,KAAI,C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AAK,EACzC,QAAO,kBAAkB,WAAW,SAAS;KAG7C,QAAO,WAAW,UAAU,QAAQ,KAAK,IAAI,EAAE,GAAG;;AAItD,SAAS,kBAAkB,WAAW,QAA4B;CAChE,MAAM,OAAO,OAAO;CACpB,MAAM,OAAO,UAAU,QAAQ,KAAK,KAAK,GAAG;AAC5C,KAAI,SAAS,EAAG;CAChB,IAAI,OAAO,UAAU,QAAQ,KAAK,KAAK;AACvC,KAAI,SAAS,GAAI,QAAO,UAAU;AAClC,QAAO,UAAU,UAAU,MAAM,KAAK,CAAC,QAAQ,KAAK,IAAI;;AAG1D,SAAS,WAAW,WAAW,QAAQ;CACrC,MAAM,OAAO,OAAO;CACpB,IAAI,OAAO,UAAU,QAAQ,KAAK,KAAK;AACvC,KAAI,SAAS,GAAI,QAAO,UAAU,QAAQ,KAAK,KAAK;AACpD,KAAI,SAAS,GAAI,QAAO,UAAU,QAAQ,KAAK,KAAK;AACpD,KAAI,SAAS,GAAI,QAAO,UAAU;AAClC,QAAO,UAAU,UAAU,MAAM,KAAK;;AAGxC,SAAgB,yBAAyB,YAAoB,sBAAuC;AAClG,QAAO,WACJ,MAAM,IAAI,CACV,KAAK,MAAM,UAAU;AACpB,MAAI,UAAU,KAAK,CAAC,qBAAsB,QAAO;AACjD,SAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,UAAU,EAAE;GACvD,CACD,KAAK,GAAG"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cabloy/module-info",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.36",
|
|
5
5
|
"description": "cabloy module-info",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"files": [
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
|
-
"gitHead": "0eab9dc4a5622caffe89e7b1b3f02c08ccbc4c4b",
|
|
28
27
|
"scripts": {
|
|
28
|
+
"build": "tsdown",
|
|
29
29
|
"clean": "rimraf dist tsconfig.tsbuildinfo",
|
|
30
|
-
"tsc:publish": "npm run clean &&
|
|
30
|
+
"tsc:publish": "npm run clean && npm run build"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2016-present Vona
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
let __onionScenesMeta;
|
|
2
|
-
function getOnionScenesMeta(modules) {
|
|
3
|
-
if (!__onionScenesMeta) {
|
|
4
|
-
__onionScenesMeta = _getOnionScenesMeta(modules);
|
|
5
|
-
}
|
|
6
|
-
return __onionScenesMeta;
|
|
7
|
-
}
|
|
8
|
-
let __onionMetasMeta;
|
|
9
|
-
function getOnionMetasMeta(modules) {
|
|
10
|
-
if (!__onionMetasMeta) {
|
|
11
|
-
__onionMetasMeta = _getOnionMetasMeta(modules);
|
|
12
|
-
}
|
|
13
|
-
return __onionMetasMeta;
|
|
14
|
-
}
|
|
15
|
-
function _getOnionScenesMeta(modules) {
|
|
16
|
-
const result = {};
|
|
17
|
-
for (const moduleName in modules) {
|
|
18
|
-
const module = modules[moduleName];
|
|
19
|
-
const onions = module.info.onionsMeta?.onions;
|
|
20
|
-
if (!onions) continue;
|
|
21
|
-
for (const sceneName in onions) {
|
|
22
|
-
result[sceneName] = {
|
|
23
|
-
...onions[sceneName],
|
|
24
|
-
module
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
30
|
-
function _getOnionMetasMeta(modules) {
|
|
31
|
-
const result = {};
|
|
32
|
-
for (const moduleName in modules) {
|
|
33
|
-
const module = modules[moduleName];
|
|
34
|
-
const metas = module.info.onionsMeta?.metas;
|
|
35
|
-
if (!metas) continue;
|
|
36
|
-
for (const sceneName in metas) {
|
|
37
|
-
result[sceneName] = {
|
|
38
|
-
...metas[sceneName],
|
|
39
|
-
module
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return result;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function parseInfoFromPath(pathName) {
|
|
47
|
-
if (!pathName) return;
|
|
48
|
-
pathName = pathName.replace(/\\/g, '/');
|
|
49
|
-
const parts = pathName.split('/');
|
|
50
|
-
for (let i = parts.length - 1; i >= 0; i--) {
|
|
51
|
-
const part = parts[i];
|
|
52
|
-
if (!part.includes('-')) continue;
|
|
53
|
-
const info = parseInfo(part);
|
|
54
|
-
if (!info) continue;
|
|
55
|
-
return info;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
const PREFIX_A = '/api/';
|
|
59
|
-
const PREFIX_B = 'vona-module-';
|
|
60
|
-
const PREFIX_C = './vona-module-';
|
|
61
|
-
const PREFIX_D = './';
|
|
62
|
-
const PREFIX_E = '/';
|
|
63
|
-
|
|
64
|
-
// aa-hello aa/hello
|
|
65
|
-
// first check / then -
|
|
66
|
-
function parseInfo(moduleName) {
|
|
67
|
-
if (!moduleName) return;
|
|
68
|
-
if (moduleName.includes('://')) return;
|
|
69
|
-
if (moduleName.charAt(0) === '/') moduleName = moduleName.substring(1);
|
|
70
|
-
let parts = moduleName.split('/').filter(item => item);
|
|
71
|
-
if (parts.length < 2) {
|
|
72
|
-
parts = moduleName.split('-').filter(item => item);
|
|
73
|
-
if (parts.length < 2) return;
|
|
74
|
-
if (parts.length === 4) parts = parts.slice(2);
|
|
75
|
-
if (parts.length === 5) parts = parts.slice(3);
|
|
76
|
-
}
|
|
77
|
-
const info = {
|
|
78
|
-
pid: parts[0],
|
|
79
|
-
name: parts[1],
|
|
80
|
-
relativeName: `${parts[0]}-${parts[1]}`,
|
|
81
|
-
url: `${parts[0]}/${parts[1]}`,
|
|
82
|
-
originalName: parts.join('-')
|
|
83
|
-
};
|
|
84
|
-
return info;
|
|
85
|
-
}
|
|
86
|
-
function parseInfoPro(moduleName, projectMode, projectEntityType) {
|
|
87
|
-
const info = parseInfo(moduleName);
|
|
88
|
-
if (!info) return info;
|
|
89
|
-
if (['zova', 'vona'].includes(projectMode)) {
|
|
90
|
-
info.fullName = `${projectMode}-${projectEntityType}-${info.relativeName}`;
|
|
91
|
-
} else {
|
|
92
|
-
info.fullName = `cabloy-${projectEntityType}-${projectMode}-${info.relativeName}`;
|
|
93
|
-
}
|
|
94
|
-
return info;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// /api/aa/hello/home/index
|
|
98
|
-
// vona-module-aa-hello
|
|
99
|
-
// ./aa-hello/
|
|
100
|
-
// ./vona-module-aa-hello/
|
|
101
|
-
function parseName(moduleUrl) {
|
|
102
|
-
const moduleName = _parseNameInner(moduleUrl);
|
|
103
|
-
if (!moduleName) return;
|
|
104
|
-
const [a, b] = moduleName.split('-');
|
|
105
|
-
if (!a || !b) return;
|
|
106
|
-
return moduleName;
|
|
107
|
-
}
|
|
108
|
-
function _parseNameInner(moduleUrl) {
|
|
109
|
-
if (!moduleUrl) return;
|
|
110
|
-
if (moduleUrl.indexOf('/api/static/') === 0) {
|
|
111
|
-
moduleUrl = `/api/${moduleUrl.substring('/api/static/'.length)}`;
|
|
112
|
-
}
|
|
113
|
-
if (moduleUrl.indexOf(PREFIX_A) === 0) {
|
|
114
|
-
return _parseNameLikeUrl(moduleUrl, PREFIX_A);
|
|
115
|
-
} else if (moduleUrl.indexOf(PREFIX_B) === 0) {
|
|
116
|
-
return _parseName(moduleUrl, PREFIX_B);
|
|
117
|
-
} else if (moduleUrl.indexOf(PREFIX_C) === 0) {
|
|
118
|
-
return _parseName(moduleUrl, PREFIX_C);
|
|
119
|
-
} else if (moduleUrl.indexOf(PREFIX_D) === 0) {
|
|
120
|
-
return _parseName(moduleUrl, PREFIX_D);
|
|
121
|
-
} else if (moduleUrl.indexOf(PREFIX_E) === 0) {
|
|
122
|
-
return _parseNameLikeUrl(moduleUrl, PREFIX_E);
|
|
123
|
-
} else {
|
|
124
|
-
// test-home test/home
|
|
125
|
-
return _parseName(moduleUrl.replace('/', '-'), '');
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
function _parseNameLikeUrl(moduleUrl, prefix) {
|
|
129
|
-
const posA = prefix.length;
|
|
130
|
-
const posB = moduleUrl.indexOf('/', posA) + 1;
|
|
131
|
-
if (posB === 0) return;
|
|
132
|
-
let posC = moduleUrl.indexOf('/', posB);
|
|
133
|
-
if (posC === -1) posC = moduleUrl.length;
|
|
134
|
-
return moduleUrl.substring(posA, posC).replace('/', '-');
|
|
135
|
-
}
|
|
136
|
-
function _parseName(moduleUrl, prefix) {
|
|
137
|
-
const posA = prefix.length;
|
|
138
|
-
let posB = moduleUrl.indexOf('/', posA);
|
|
139
|
-
if (posB === -1) posB = moduleUrl.indexOf(':', posA);
|
|
140
|
-
if (posB === -1) posB = moduleUrl.indexOf('.', posA);
|
|
141
|
-
if (posB === -1) posB = moduleUrl.length;
|
|
142
|
-
return moduleUrl.substring(posA, posB);
|
|
143
|
-
}
|
|
144
|
-
function relativeNameToCapitalize(moduleName, firstCharToUpperCase) {
|
|
145
|
-
return moduleName.split('-').map((name, index) => {
|
|
146
|
-
if (index === 0 && !firstCharToUpperCase) return name;
|
|
147
|
-
return name.charAt(0).toUpperCase() + name.substring(1);
|
|
148
|
-
}).join('');
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export { _getOnionMetasMeta, _getOnionScenesMeta, getOnionMetasMeta, getOnionScenesMeta, parseInfo, parseInfoFromPath, parseInfoPro, parseName, relativeNameToCapitalize };
|
package/dist/interface.d.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import type { VonaOnionOptionsMeta } from './vona.ts';
|
|
2
|
-
import type { ZovaOnionOptionsMeta } from './zova.ts';
|
|
3
|
-
export type TypeProjectMode = 'front' | 'api' | 'zova' | 'vona';
|
|
4
|
-
export type TypeProjectEntityType = 'module' | 'suite';
|
|
5
|
-
export type TypeBrandName = 'zova' | 'vona';
|
|
6
|
-
export interface IOnionsConfigItem {
|
|
7
|
-
enable?: boolean;
|
|
8
|
-
meta?: ZovaOnionOptionsMeta;
|
|
9
|
-
match?: string | string[];
|
|
10
|
-
ignore?: string | string[];
|
|
11
|
-
dependencies?: string | string[];
|
|
12
|
-
dependents?: string | string[];
|
|
13
|
-
}
|
|
14
|
-
export type TypeOnionsConfigItems = Record<string, IOnionsConfigItem>;
|
|
15
|
-
export type TypeOnionsConfig = Record<string, TypeOnionsConfigItems>;
|
|
16
|
-
export interface IModuleCapabilities {
|
|
17
|
-
monkey?: boolean;
|
|
18
|
-
sync?: boolean;
|
|
19
|
-
icon?: boolean;
|
|
20
|
-
theme?: boolean;
|
|
21
|
-
locale?: boolean;
|
|
22
|
-
preload?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export interface IModuleCapabilitiesZova extends IModuleCapabilities {
|
|
25
|
-
meta?: ZovaOnionOptionsMeta;
|
|
26
|
-
server?: boolean;
|
|
27
|
-
}
|
|
28
|
-
export interface IModuleCapabilitiesVona extends IModuleCapabilities {
|
|
29
|
-
meta?: VonaOnionOptionsMeta;
|
|
30
|
-
}
|
|
31
|
-
export interface IModuleInfo {
|
|
32
|
-
pid: string;
|
|
33
|
-
name: string;
|
|
34
|
-
fullName: string;
|
|
35
|
-
relativeName: string;
|
|
36
|
-
url: string;
|
|
37
|
-
vendor?: boolean;
|
|
38
|
-
node_modules?: boolean;
|
|
39
|
-
originalName: string;
|
|
40
|
-
capabilities?: IModuleCapabilities;
|
|
41
|
-
onionsMeta?: {
|
|
42
|
-
onions?: OnionScenesMeta;
|
|
43
|
-
metas?: OnionMetasMeta;
|
|
44
|
-
onionsConfig?: TypeOnionsConfig;
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
export interface ISuiteModuleBase {
|
|
48
|
-
name: string;
|
|
49
|
-
info: IModuleInfo;
|
|
50
|
-
root: string;
|
|
51
|
-
pkg: string;
|
|
52
|
-
package: IModulePackage;
|
|
53
|
-
}
|
|
54
|
-
export interface ISuite extends ISuiteModuleBase {
|
|
55
|
-
modules: string[];
|
|
56
|
-
}
|
|
57
|
-
export interface IModule extends ISuiteModuleBase {
|
|
58
|
-
suite?: string;
|
|
59
|
-
}
|
|
60
|
-
export interface IBundleVendor {
|
|
61
|
-
match: Array<string | RegExp>;
|
|
62
|
-
output: string;
|
|
63
|
-
}
|
|
64
|
-
export interface OnionSceneMeta {
|
|
65
|
-
module?: IModule;
|
|
66
|
-
sceneIsolate?: boolean;
|
|
67
|
-
hasLocal?: boolean;
|
|
68
|
-
optionsNone?: boolean;
|
|
69
|
-
optionsRoute?: boolean;
|
|
70
|
-
optionsArgumentPipe?: boolean;
|
|
71
|
-
optionsDynamic?: boolean;
|
|
72
|
-
optionsPackage?: boolean;
|
|
73
|
-
optionsCustomInterfaceTemplate?: string;
|
|
74
|
-
optionsGlobalInterfaceName?: string;
|
|
75
|
-
optionsGlobalInterfaceFrom?: string;
|
|
76
|
-
scopeResource?: boolean;
|
|
77
|
-
scopeResourceTypeTemplate?: string;
|
|
78
|
-
beanGeneral?: boolean;
|
|
79
|
-
snippets?: string;
|
|
80
|
-
boilerplate?: string;
|
|
81
|
-
metadataCustom?: string;
|
|
82
|
-
}
|
|
83
|
-
export interface OnionMetaMeta {
|
|
84
|
-
module?: IModule;
|
|
85
|
-
scopeResource?: boolean;
|
|
86
|
-
snippets?: string;
|
|
87
|
-
boilerplate?: string;
|
|
88
|
-
metadataCustom?: string;
|
|
89
|
-
}
|
|
90
|
-
export type OnionScenesMeta = Record<string, OnionSceneMeta>;
|
|
91
|
-
export type OnionMetasMeta = Record<string, OnionMetaMeta>;
|
|
92
|
-
export interface IModulePackage {
|
|
93
|
-
name: string;
|
|
94
|
-
version: string;
|
|
95
|
-
vonaModule?: {
|
|
96
|
-
capabilities?: IModuleCapabilitiesVona;
|
|
97
|
-
fileVersion: number;
|
|
98
|
-
dependencies?: Record<string, string>;
|
|
99
|
-
globalDependencies?: Record<string, string | boolean>;
|
|
100
|
-
globalDependenciesDev?: Record<string, string | boolean>;
|
|
101
|
-
onions?: OnionScenesMeta;
|
|
102
|
-
metas?: OnionMetasMeta;
|
|
103
|
-
};
|
|
104
|
-
zovaModule?: {
|
|
105
|
-
capabilities?: IModuleCapabilitiesZova;
|
|
106
|
-
dependencies?: Record<string, string>;
|
|
107
|
-
globalDependencies?: Record<string, string | boolean>;
|
|
108
|
-
globalDependenciesDev?: Record<string, string | boolean>;
|
|
109
|
-
onions?: OnionScenesMeta;
|
|
110
|
-
metas?: OnionMetasMeta;
|
|
111
|
-
onionsConfig?: TypeOnionsConfig;
|
|
112
|
-
bundle?: {
|
|
113
|
-
vendors?: Array<IBundleVendor>;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
title: string;
|
|
117
|
-
description: string;
|
|
118
|
-
author: string;
|
|
119
|
-
files: string[];
|
|
120
|
-
dependencies: Record<string, string>;
|
|
121
|
-
devDependencies: Record<string, string>;
|
|
122
|
-
}
|
|
123
|
-
export interface IGlobBeanFile {
|
|
124
|
-
sceneName: string;
|
|
125
|
-
sceneNameCapitalize: string;
|
|
126
|
-
file: string;
|
|
127
|
-
fileContent: string;
|
|
128
|
-
fileName: string;
|
|
129
|
-
fileNameJS: string;
|
|
130
|
-
fileNameJSRelative: string;
|
|
131
|
-
className: string;
|
|
132
|
-
beanName: string;
|
|
133
|
-
beanNameFull: string;
|
|
134
|
-
beanNameCapitalize: string;
|
|
135
|
-
isIgnore: boolean;
|
|
136
|
-
isVirtual: boolean;
|
|
137
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { IModule, OnionMetasMeta, OnionScenesMeta } from './interface.ts';
|
|
2
|
-
export declare function getOnionScenesMeta(modules: Record<string, IModule>): OnionScenesMeta;
|
|
3
|
-
export declare function getOnionMetasMeta(modules: Record<string, IModule>): OnionMetasMeta;
|
|
4
|
-
export declare function _getOnionScenesMeta(modules: Record<string, IModule>): {};
|
|
5
|
-
export declare function _getOnionMetasMeta(modules: Record<string, IModule>): {};
|
package/dist/utils.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { IModuleInfo, TypeProjectEntityType, TypeProjectMode } from './interface.ts';
|
|
2
|
-
export declare function parseInfoFromPath(pathName?: string | null): IModuleInfo | undefined;
|
|
3
|
-
export declare function parseInfo(moduleName: string | undefined): IModuleInfo | undefined;
|
|
4
|
-
export declare function parseInfoPro(moduleName: string | undefined, projectMode: TypeProjectMode, projectEntityType: TypeProjectEntityType): IModuleInfo | undefined;
|
|
5
|
-
export declare function parseName(moduleUrl: any): string | undefined;
|
|
6
|
-
export declare function relativeNameToCapitalize(moduleName: string, firstCharToUpperCase: boolean): string;
|
package/dist/vona.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type VonaMetaFlavor = 'normal' | 'play' | 'demo' | 'docker' | 'ci' | keyof VonaMetaFlavorExtend;
|
|
2
|
-
export type VonaMetaMode = 'test' | 'dev' | 'prod';
|
|
3
|
-
export interface VonaConfigMeta {
|
|
4
|
-
flavor: VonaMetaFlavor;
|
|
5
|
-
mode: VonaMetaMode;
|
|
6
|
-
}
|
|
7
|
-
export interface VonaOnionOptionsMeta {
|
|
8
|
-
flavor?: VonaMetaFlavor | VonaMetaFlavor[];
|
|
9
|
-
mode?: VonaMetaMode | VonaMetaMode[];
|
|
10
|
-
}
|
|
11
|
-
export interface VonaMetaFlavorExtend {
|
|
12
|
-
}
|
package/dist/zova.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type ZovaMetaFlavor = 'front' | 'admin' | 'vonaHome' | 'vonaCabloy' | keyof ZovaMetaFlavorExtend;
|
|
2
|
-
export type ZovaMetaMode = 'development' | 'production';
|
|
3
|
-
export type ZovaMetaAppMode = 'spa' | 'ssr' | 'pwa' | 'cordova' | 'capacitor' | 'electron' | 'bex' | keyof ZovaMetaAppModeExtend;
|
|
4
|
-
export interface ZovaConfigMeta {
|
|
5
|
-
flavor: ZovaMetaFlavor;
|
|
6
|
-
mode: ZovaMetaMode;
|
|
7
|
-
appMode: ZovaMetaAppMode;
|
|
8
|
-
}
|
|
9
|
-
export interface ZovaOnionOptionsMeta {
|
|
10
|
-
flavor?: ZovaMetaFlavor | ZovaMetaFlavor[];
|
|
11
|
-
mode?: ZovaMetaMode | ZovaMetaMode[];
|
|
12
|
-
appMode?: ZovaMetaAppMode | ZovaMetaAppMode[];
|
|
13
|
-
}
|
|
14
|
-
export interface ZovaMetaFlavorExtend {
|
|
15
|
-
}
|
|
16
|
-
export interface ZovaMetaAppModeExtend {
|
|
17
|
-
}
|