@cabloy/module-info 1.1.9 → 1.2.0

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.ts CHANGED
@@ -1,8 +1,5 @@
1
- import { IModuleInfo, TypeProjectEntityType, TypeProjectMode } from './interface.js';
2
1
  export * from './interface.js';
3
- export declare function parseInfoFromPath(pathName?: string | null): IModuleInfo | undefined;
4
- export declare function parseInfo(moduleName: string | undefined): IModuleInfo | undefined;
5
- export declare function parseInfoPro(moduleName: string | undefined, projectMode: TypeProjectMode, projectEntityType: TypeProjectEntityType): IModuleInfo | undefined;
6
- export declare function parseName(moduleUrl: any): string | undefined;
7
- export declare function relativeNameToCapitalize(moduleName: string, firstCharToUpperCase: boolean): string;
2
+ export * from './utils.js';
3
+ export * from './vona.js';
4
+ export * from './zova.js';
8
5
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -14,132 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.relativeNameToCapitalize = exports.parseName = exports.parseInfoPro = exports.parseInfo = exports.parseInfoFromPath = void 0;
18
17
  __exportStar(require("./interface.js"), exports);
19
- function parseInfoFromPath(pathName) {
20
- if (!pathName)
21
- return;
22
- pathName = pathName.replace(/\\/gi, '/');
23
- const parts = pathName.split('/');
24
- for (let i = parts.length - 1; i >= 0; i--) {
25
- const part = parts[i];
26
- if (part.indexOf('-') === -1)
27
- continue;
28
- const info = parseInfo(part);
29
- if (!info)
30
- continue;
31
- return info;
32
- }
33
- }
34
- exports.parseInfoFromPath = parseInfoFromPath;
35
- const PREFIX_A = '/api/';
36
- const PREFIX_B = 'vona-module-';
37
- const PREFIX_C = './vona-module-';
38
- const PREFIX_D = './';
39
- const PREFIX_E = '/';
40
- // aa-hello aa/hello
41
- // first check / then -
42
- function parseInfo(moduleName) {
43
- if (!moduleName)
44
- return;
45
- if (moduleName.indexOf('://') > -1)
46
- return;
47
- if (moduleName.charAt(0) === '/')
48
- moduleName = moduleName.substring(1);
49
- let parts = moduleName.split('/').filter(item => item);
50
- if (parts.length < 2) {
51
- parts = moduleName.split('-').filter(item => item);
52
- if (parts.length < 2)
53
- return;
54
- if (parts.length === 4)
55
- parts = parts.slice(2);
56
- if (parts.length === 5)
57
- parts = parts.slice(3);
58
- }
59
- const info = {
60
- pid: parts[0],
61
- name: parts[1],
62
- relativeName: `${parts[0]}-${parts[1]}`,
63
- url: `${parts[0]}/${parts[1]}`,
64
- originalName: parts.join('-'),
65
- };
66
- return info;
67
- }
68
- exports.parseInfo = parseInfo;
69
- function parseInfoPro(moduleName, projectMode, projectEntityType) {
70
- const info = parseInfo(moduleName);
71
- if (!info)
72
- return info;
73
- if (['zova', 'vona'].includes(projectMode)) {
74
- info.fullName = `${projectMode}-${projectEntityType}-${info.relativeName}`;
75
- }
76
- else {
77
- info.fullName = `cabloy-${projectEntityType}-${projectMode}-${info.relativeName}`;
78
- }
79
- return info;
80
- }
81
- exports.parseInfoPro = parseInfoPro;
82
- // /api/aa/hello/home/index
83
- // vona-module-aa-hello
84
- // ./aa-hello/
85
- // ./vona-module-aa-hello/
86
- function parseName(moduleUrl) {
87
- if (!moduleUrl)
88
- return;
89
- if (moduleUrl.indexOf('/api/static/') === 0) {
90
- moduleUrl = '/api/' + moduleUrl.substring('/api/static/'.length);
91
- }
92
- if (moduleUrl.indexOf(PREFIX_A) === 0) {
93
- return _parseNameLikeUrl(moduleUrl, PREFIX_A);
94
- }
95
- else if (moduleUrl.indexOf(PREFIX_B) === 0) {
96
- return _parseName(moduleUrl, PREFIX_B);
97
- }
98
- else if (moduleUrl.indexOf(PREFIX_C) === 0) {
99
- return _parseName(moduleUrl, PREFIX_C);
100
- }
101
- else if (moduleUrl.indexOf(PREFIX_D) === 0) {
102
- return _parseName(moduleUrl, PREFIX_D);
103
- }
104
- else if (moduleUrl.indexOf(PREFIX_E) === 0) {
105
- return _parseNameLikeUrl(moduleUrl, PREFIX_E);
106
- }
107
- else {
108
- // test-home test/home
109
- return _parseName(moduleUrl.replace('/', '-'), '');
110
- }
111
- }
112
- exports.parseName = parseName;
113
- function _parseNameLikeUrl(moduleUrl, prefix) {
114
- const posA = prefix.length;
115
- const posB = moduleUrl.indexOf('/', posA) + 1;
116
- if (posB === 0)
117
- return;
118
- let posC = moduleUrl.indexOf('/', posB);
119
- if (posC === -1)
120
- posC = moduleUrl.length;
121
- return moduleUrl.substring(posA, posC).replace('/', '-');
122
- }
123
- function _parseName(moduleUrl, prefix) {
124
- const posA = prefix.length;
125
- let posB = moduleUrl.indexOf('/', posA);
126
- if (posB === -1)
127
- posB = moduleUrl.indexOf(':', posA);
128
- if (posB === -1)
129
- posB = moduleUrl.indexOf('.', posA);
130
- if (posB === -1)
131
- posB = moduleUrl.length;
132
- return moduleUrl.substring(posA, posB);
133
- }
134
- function relativeNameToCapitalize(moduleName, firstCharToUpperCase) {
135
- return moduleName
136
- .split('-')
137
- .map((name, index) => {
138
- if (index === 0 && !firstCharToUpperCase)
139
- return name;
140
- return name.charAt(0).toUpperCase() + name.substring(1);
141
- })
142
- .join('');
143
- }
144
- exports.relativeNameToCapitalize = relativeNameToCapitalize;
18
+ __exportStar(require("./utils.js"), exports);
19
+ __exportStar(require("./vona.js"), exports);
20
+ __exportStar(require("./zova.js"), exports);
145
21
  //# sourceMappingURL=index.js.map
@@ -1,11 +1,20 @@
1
+ import { VonaConfigMeta } from './vona.js';
2
+ import { ZovaConfigMeta } from './zova.js';
1
3
  export type TypeProjectMode = 'front' | 'api' | 'zova' | 'vona';
2
4
  export type TypeProjectEntityType = 'module' | 'suite';
3
5
  export interface IModuleCapabilities {
4
- monkey: boolean;
5
- sync: boolean;
6
- icon: boolean;
7
- theme: boolean;
8
- locale: boolean;
6
+ monkey?: boolean;
7
+ sync?: boolean;
8
+ icon?: boolean;
9
+ theme?: boolean;
10
+ locale?: boolean;
11
+ preload?: boolean;
12
+ }
13
+ export interface IModuleCapabilitiesZova extends IModuleCapabilities {
14
+ meta?: ZovaConfigMeta;
15
+ }
16
+ export interface IModuleCapabilitiesVona extends IModuleCapabilities {
17
+ meta?: VonaConfigMeta;
9
18
  }
10
19
  export interface IModuleInfo {
11
20
  pid: string;
@@ -35,17 +44,42 @@ export interface IBundleVendor {
35
44
  match: Array<string | RegExp>;
36
45
  output: string;
37
46
  }
47
+ export interface OnionSceneMeta {
48
+ module?: IModule;
49
+ sceneIsolate?: boolean;
50
+ hasLocal?: boolean;
51
+ optionsNone?: boolean;
52
+ optionsRoute?: boolean;
53
+ optionsArgumentPipe?: boolean;
54
+ optionsDynamic?: boolean;
55
+ optionsGlobalInterfaceName?: string;
56
+ optionsGlobalInterfaceFrom?: string;
57
+ scopeResource?: boolean;
58
+ beanLocal?: boolean;
59
+ boilerplate?: string;
60
+ metadataCustom?: string;
61
+ }
62
+ export interface OnionMetaMeta {
63
+ module?: IModule;
64
+ scopeResource?: boolean;
65
+ boilerplate?: string;
66
+ metadataCustom?: string;
67
+ }
68
+ export type OnionScenesMeta = Record<string, OnionSceneMeta>;
69
+ export type OnionMetasMeta = Record<string, OnionMetaMeta>;
38
70
  export interface IModulePackage {
39
71
  name: string;
40
72
  version: string;
41
73
  vonaModule?: {
42
- capabilities?: IModuleCapabilities;
74
+ capabilities?: IModuleCapabilitiesVona;
43
75
  fileVersion: number;
44
76
  dependencies?: Record<string, string>;
45
77
  globalDependencies?: Record<string, string | boolean>;
78
+ onions?: OnionScenesMeta;
79
+ metas?: OnionMetasMeta;
46
80
  };
47
81
  zovaModule?: {
48
- capabilities?: IModuleCapabilities;
82
+ capabilities?: IModuleCapabilitiesZova;
49
83
  dependencies?: Record<string, string>;
50
84
  globalDependencies?: Record<string, string | boolean>;
51
85
  bundle?: {
@@ -57,4 +91,26 @@ export interface IModulePackage {
57
91
  author: string;
58
92
  dependencies: Record<string, string>;
59
93
  }
94
+ export interface IGlobBeanFile {
95
+ file: string;
96
+ fileContent: string;
97
+ fileName: string;
98
+ fileNameJS: string;
99
+ fileNameJSRelative: string;
100
+ className: string;
101
+ beanName: string;
102
+ beanNameFull: string;
103
+ isIgnore: boolean;
104
+ isVirtual: boolean;
105
+ }
106
+ export interface IMetadataCustomGenerateOptions {
107
+ cli: any;
108
+ sceneName: string;
109
+ sceneNameCapitalize: string;
110
+ sceneMeta: OnionSceneMeta;
111
+ moduleName: string;
112
+ modulePath: string;
113
+ globFiles: IGlobBeanFile[];
114
+ }
115
+ export type TypeMetadataCustomGenerate = (options: IMetadataCustomGenerateOptions) => Promise<string>;
60
116
  //# sourceMappingURL=interface.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { IModuleInfo, TypeProjectEntityType, TypeProjectMode } from './interface.js';
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;
7
+ //# sourceMappingURL=utils.d.ts.map
package/dist/utils.js ADDED
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.relativeNameToCapitalize = exports.parseName = exports.parseInfoPro = exports.parseInfo = exports.parseInfoFromPath = void 0;
4
+ function parseInfoFromPath(pathName) {
5
+ if (!pathName)
6
+ return;
7
+ pathName = pathName.replace(/\\/gi, '/');
8
+ const parts = pathName.split('/');
9
+ for (let i = parts.length - 1; i >= 0; i--) {
10
+ const part = parts[i];
11
+ if (part.indexOf('-') === -1)
12
+ continue;
13
+ const info = parseInfo(part);
14
+ if (!info)
15
+ continue;
16
+ return info;
17
+ }
18
+ }
19
+ exports.parseInfoFromPath = parseInfoFromPath;
20
+ const PREFIX_A = '/api/';
21
+ const PREFIX_B = 'vona-module-';
22
+ const PREFIX_C = './vona-module-';
23
+ const PREFIX_D = './';
24
+ const PREFIX_E = '/';
25
+ // aa-hello aa/hello
26
+ // first check / then -
27
+ function parseInfo(moduleName) {
28
+ if (!moduleName)
29
+ return;
30
+ if (moduleName.indexOf('://') > -1)
31
+ return;
32
+ if (moduleName.charAt(0) === '/')
33
+ moduleName = moduleName.substring(1);
34
+ let parts = moduleName.split('/').filter(item => item);
35
+ if (parts.length < 2) {
36
+ parts = moduleName.split('-').filter(item => item);
37
+ if (parts.length < 2)
38
+ return;
39
+ if (parts.length === 4)
40
+ parts = parts.slice(2);
41
+ if (parts.length === 5)
42
+ parts = parts.slice(3);
43
+ }
44
+ const info = {
45
+ pid: parts[0],
46
+ name: parts[1],
47
+ relativeName: `${parts[0]}-${parts[1]}`,
48
+ url: `${parts[0]}/${parts[1]}`,
49
+ originalName: parts.join('-'),
50
+ };
51
+ return info;
52
+ }
53
+ exports.parseInfo = parseInfo;
54
+ function parseInfoPro(moduleName, projectMode, projectEntityType) {
55
+ const info = parseInfo(moduleName);
56
+ if (!info)
57
+ return info;
58
+ if (['zova', 'vona'].includes(projectMode)) {
59
+ info.fullName = `${projectMode}-${projectEntityType}-${info.relativeName}`;
60
+ }
61
+ else {
62
+ info.fullName = `cabloy-${projectEntityType}-${projectMode}-${info.relativeName}`;
63
+ }
64
+ return info;
65
+ }
66
+ exports.parseInfoPro = parseInfoPro;
67
+ // /api/aa/hello/home/index
68
+ // vona-module-aa-hello
69
+ // ./aa-hello/
70
+ // ./vona-module-aa-hello/
71
+ function parseName(moduleUrl) {
72
+ if (!moduleUrl)
73
+ return;
74
+ if (moduleUrl.indexOf('/api/static/') === 0) {
75
+ moduleUrl = '/api/' + moduleUrl.substring('/api/static/'.length);
76
+ }
77
+ if (moduleUrl.indexOf(PREFIX_A) === 0) {
78
+ return _parseNameLikeUrl(moduleUrl, PREFIX_A);
79
+ }
80
+ else if (moduleUrl.indexOf(PREFIX_B) === 0) {
81
+ return _parseName(moduleUrl, PREFIX_B);
82
+ }
83
+ else if (moduleUrl.indexOf(PREFIX_C) === 0) {
84
+ return _parseName(moduleUrl, PREFIX_C);
85
+ }
86
+ else if (moduleUrl.indexOf(PREFIX_D) === 0) {
87
+ return _parseName(moduleUrl, PREFIX_D);
88
+ }
89
+ else if (moduleUrl.indexOf(PREFIX_E) === 0) {
90
+ return _parseNameLikeUrl(moduleUrl, PREFIX_E);
91
+ }
92
+ else {
93
+ // test-home test/home
94
+ return _parseName(moduleUrl.replace('/', '-'), '');
95
+ }
96
+ }
97
+ exports.parseName = parseName;
98
+ function _parseNameLikeUrl(moduleUrl, prefix) {
99
+ const posA = prefix.length;
100
+ const posB = moduleUrl.indexOf('/', posA) + 1;
101
+ if (posB === 0)
102
+ return;
103
+ let posC = moduleUrl.indexOf('/', posB);
104
+ if (posC === -1)
105
+ posC = moduleUrl.length;
106
+ return moduleUrl.substring(posA, posC).replace('/', '-');
107
+ }
108
+ function _parseName(moduleUrl, prefix) {
109
+ const posA = prefix.length;
110
+ let posB = moduleUrl.indexOf('/', posA);
111
+ if (posB === -1)
112
+ posB = moduleUrl.indexOf(':', posA);
113
+ if (posB === -1)
114
+ posB = moduleUrl.indexOf('.', posA);
115
+ if (posB === -1)
116
+ posB = moduleUrl.length;
117
+ return moduleUrl.substring(posA, posB);
118
+ }
119
+ function relativeNameToCapitalize(moduleName, firstCharToUpperCase) {
120
+ return moduleName
121
+ .split('-')
122
+ .map((name, index) => {
123
+ if (index === 0 && !firstCharToUpperCase)
124
+ return name;
125
+ return name.charAt(0).toUpperCase() + name.substring(1);
126
+ })
127
+ .join('');
128
+ }
129
+ exports.relativeNameToCapitalize = relativeNameToCapitalize;
130
+ //# sourceMappingURL=utils.js.map
package/dist/vona.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export type VonaMetaFlavor = 'normal' | keyof VonaMetaFlavorExtend;
2
+ export type VonaMetaMode = 'local' | 'prod' | 'unittest';
3
+ export interface VonaConfigMeta {
4
+ flavor: VonaMetaFlavor;
5
+ mode: VonaMetaMode;
6
+ }
7
+ export interface VonaMetaFlavorExtend {
8
+ }
9
+ //# sourceMappingURL=vona.d.ts.map
package/dist/vona.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=vona.js.map
package/dist/zova.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ export type ZovaMetaFlavor = 'front' | 'admin' | 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 ZovaMetaFlavorExtend {
10
+ }
11
+ export interface ZovaMetaAppModeExtend {
12
+ }
13
+ //# sourceMappingURL=zova.d.ts.map
package/dist/zova.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=zova.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabloy/module-info",
3
- "version": "1.1.9",
3
+ "version": "1.2.0",
4
4
  "description": "cabloy module-info",
5
5
  "publishConfig": {
6
6
  "access": "public"