@cabloy/module-info 1.0.11 → 1.0.13

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
@@ -3,5 +3,5 @@ export * from './interface.js';
3
3
  export declare function parseInfoFromPath(pathName?: string | null): IModuleInfo | undefined;
4
4
  export declare function parseInfo(moduleName: string | undefined): IModuleInfo | undefined;
5
5
  export declare function parseInfoPro(moduleName: string | undefined, projectMode: TypeProjectMode, projectEntityType: TypeProjectEntityType): IModuleInfo | undefined;
6
- export declare function parseName(moduleUrl: any): any;
6
+ export declare function parseName(moduleUrl: any): string | undefined;
7
7
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -36,6 +36,7 @@ const PREFIX_A = '/api/';
36
36
  const PREFIX_B = 'cabloy-module-api-';
37
37
  const PREFIX_C = './cabloy-module-api-';
38
38
  const PREFIX_D = './';
39
+ const PREFIX_E = '/';
39
40
  // aa-hello aa/hello
40
41
  // first check / then -
41
42
  function parseInfo(moduleName) {
@@ -60,10 +61,6 @@ function parseInfo(moduleName) {
60
61
  url: `${parts[0]}/${parts[1]}`,
61
62
  originalName: parts.join('-'),
62
63
  };
63
- if (parts[2] === 'sync')
64
- info.sync = true;
65
- if (parts[2] === 'monkey')
66
- info.monkey = true;
67
64
  return info;
68
65
  }
69
66
  exports.parseInfo = parseInfo;
@@ -71,12 +68,7 @@ function parseInfoPro(moduleName, projectMode, projectEntityType) {
71
68
  const info = parseInfo(moduleName);
72
69
  if (!info)
73
70
  return info;
74
- let fullName = `cabloy-${projectEntityType}-${projectMode}-${info.relativeName}`;
75
- if (info.sync)
76
- fullName = `${fullName}-sync`;
77
- if (info.monkey)
78
- fullName = `${fullName}-monkey`;
79
- info.fullName = fullName;
71
+ info.fullName = `cabloy-${projectEntityType}-${projectMode}-${info.relativeName}`;
80
72
  return info;
81
73
  }
82
74
  exports.parseInfoPro = parseInfoPro;
@@ -86,19 +78,12 @@ exports.parseInfoPro = parseInfoPro;
86
78
  // ./cabloy-module-api-aa-hello/
87
79
  function parseName(moduleUrl) {
88
80
  if (!moduleUrl)
89
- return null;
81
+ return;
90
82
  if (moduleUrl.indexOf('/api/static/') === 0) {
91
83
  moduleUrl = '/api/' + moduleUrl.substring('/api/static/'.length);
92
84
  }
93
85
  if (moduleUrl.indexOf(PREFIX_A) === 0) {
94
- const posA = PREFIX_A.length;
95
- const posB = moduleUrl.indexOf('/', posA) + 1;
96
- if (posB === -1)
97
- return null;
98
- const posC = moduleUrl.indexOf('/', posB);
99
- if (posC === -1)
100
- return null;
101
- return moduleUrl.substring(posA, posC);
86
+ return _parseNameLikeUrl(moduleUrl, PREFIX_A);
102
87
  }
103
88
  else if (moduleUrl.indexOf(PREFIX_B) === 0) {
104
89
  return _parseName(moduleUrl, PREFIX_B);
@@ -109,12 +94,32 @@ function parseName(moduleUrl) {
109
94
  else if (moduleUrl.indexOf(PREFIX_D) === 0) {
110
95
  return _parseName(moduleUrl, PREFIX_D);
111
96
  }
112
- return null;
97
+ else if (moduleUrl.indexOf(PREFIX_E) === 0) {
98
+ return _parseNameLikeUrl(moduleUrl, PREFIX_E);
99
+ }
100
+ else {
101
+ // test-home test/home
102
+ return _parseName(moduleUrl.replace('/', '-'), '');
103
+ }
113
104
  }
114
105
  exports.parseName = parseName;
106
+ function _parseNameLikeUrl(moduleUrl, prefix) {
107
+ const posA = prefix.length;
108
+ const posB = moduleUrl.indexOf('/', posA) + 1;
109
+ if (posB === -1)
110
+ return;
111
+ const posC = moduleUrl.indexOf('/', posB);
112
+ if (posC === -1)
113
+ return;
114
+ return moduleUrl.substring(posA, posC).replace('/', '-');
115
+ }
115
116
  function _parseName(moduleUrl, prefix) {
116
117
  const posA = prefix.length;
117
118
  let posB = moduleUrl.indexOf('/', posA);
119
+ if (posB === -1)
120
+ posB = moduleUrl.indexOf(':', posA);
121
+ if (posB === -1)
122
+ posB = moduleUrl.indexOf('.', posA);
118
123
  if (posB === -1)
119
124
  posB = moduleUrl.length;
120
125
  return moduleUrl.substring(posA, posB);
@@ -8,6 +8,7 @@ export interface IModuleInfo {
8
8
  url: string;
9
9
  sync?: boolean;
10
10
  monkey?: boolean;
11
+ icon?: boolean;
11
12
  vendor?: boolean;
12
13
  node_modules?: boolean;
13
14
  originalName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabloy/module-info",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "cabloy module-info",
5
5
  "publishConfig": {
6
6
  "access": "public"