@cabloy/module-glob 5.1.9 → 5.1.10

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.js CHANGED
@@ -26,7 +26,9 @@ const boxen_1 = __importDefault(require("boxen"));
26
26
  const egg_born_utils_1 = __importDefault(require("egg-born-utils"));
27
27
  const meta_js_1 = require("./meta.js");
28
28
  const module_info_1 = require("@cabloy/module-info");
29
+ const utils_1 = require("@cabloy/utils");
29
30
  __exportStar(require("./interface.js"), exports);
31
+ const SymbolModuleOrdering = Symbol('SymbolModuleOrdering');
30
32
  const boxenOptions = {
31
33
  padding: 1,
32
34
  margin: 1,
@@ -36,7 +38,7 @@ const boxenOptions = {
36
38
  };
37
39
  // type: front/backend
38
40
  async function glob(options) {
39
- const { projectPath, disabledModules, disabledSuites, log, projectMode } = options;
41
+ const { projectPath, disabledModules, disabledSuites, log, projectMode, meta } = options;
40
42
  // context
41
43
  const context = {
42
44
  options,
@@ -56,6 +58,7 @@ async function glob(options) {
56
58
  //
57
59
  disabledModules: __getDisabledModules(disabledModules),
58
60
  disabledSuites: __getDisabledSuites(disabledSuites),
61
+ meta,
59
62
  //
60
63
  pathsMeta: (0, meta_js_1.getPathsMeta)(projectMode),
61
64
  };
@@ -128,14 +131,19 @@ function __orderModules(context, modules) {
128
131
  }
129
132
  }
130
133
  function __pushModule(context, modules, moduleRelativeName) {
134
+ // module
135
+ const module = modules[moduleRelativeName];
131
136
  // check if disable
132
137
  if (context.disabledModules[moduleRelativeName])
133
138
  return false;
134
- // module
135
- const module = modules[moduleRelativeName];
136
- if (module.__ordering)
139
+ // check meta
140
+ const capabilities = module.package.zovaModule?.capabilities ?? module.package.vonaModule?.capabilities;
141
+ if (context.meta && capabilities && !(0, utils_1.checkMeta)(capabilities.meta, context.meta))
142
+ return false;
143
+ // ordering
144
+ if (module[SymbolModuleOrdering])
137
145
  return true;
138
- module.__ordering = true;
146
+ module[SymbolModuleOrdering] = true;
139
147
  // dependencies
140
148
  if (!__orderDependencies(context, modules, module, moduleRelativeName)) {
141
149
  context.disabledModules[moduleRelativeName] = true;
@@ -5,6 +5,8 @@ export interface IModuleGlobOptions {
5
5
  disabledModules?: string[] | string;
6
6
  disabledSuites?: string[] | string;
7
7
  log?: boolean;
8
+ meta?: {};
9
+ disableCheckDependencies?: boolean;
8
10
  }
9
11
  export interface IModuleGlobContext {
10
12
  options: IModuleGlobOptions;
@@ -21,6 +23,7 @@ export interface IModuleGlobContext {
21
23
  suitesVendor: Record<string, ISuite>;
22
24
  disabledModules: Record<string, boolean>;
23
25
  disabledSuites: Record<string, boolean>;
26
+ meta?: {};
24
27
  pathsMeta: IModuleGlobPathsMeta;
25
28
  }
26
29
  export interface IModuleGlobPathMetaItem {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabloy/module-glob",
3
- "version": "5.1.9",
3
+ "version": "5.1.10",
4
4
  "description": "cabloy module-glob",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -32,7 +32,8 @@
32
32
  "boxen": "^4.2.0",
33
33
  "chalk": "^3.0.0",
34
34
  "egg-born-utils": "^1.2.0",
35
- "@cabloy/module-info": "^1.2.3"
35
+ "@cabloy/module-info": "^1.2.5",
36
+ "@cabloy/utils": "^1.0.2"
36
37
  },
37
38
  "gitHead": "2d40c063c115b230fdbc89f5a78b4412ebd0dfc9",
38
39
  "scripts": {