@modern-js/generator-cases 3.0.0-beta.3 → 3.0.0-beta.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @modern-js/generator-cases
2
2
 
3
+ ## 3.0.0-beta.5
4
+
5
+ ### Major Changes
6
+
7
+ - dda38c9c3e: chore: v2
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [dda38c9c3e]
12
+ - @modern-js/generator-common@3.0.0-beta.5
13
+
14
+ ## 3.0.0-beta.4
15
+
16
+ ### Major Changes
17
+
18
+ - dda38c9c3e: chore: v2
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [dda38c9c3e]
23
+ - @modern-js/generator-common@3.0.0-beta.4
24
+
3
25
  ## 3.0.0-beta.3
4
26
 
5
27
  ### Major Changes
@@ -1,90 +1,118 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- import make from 'covertable';
5
- import { Solution, PackageManager, Language, BooleanConfig, MWAActionTypes, MWAActionTypesMap, Framework, BFFType, ActionElement, ActionFunction, ModuleActionTypes, ModuleActionTypesMap, SubSolution } from '@modern-js/generator-common';
6
- export const LanguageValues = Object.values(Language);
7
- export const PackageManagerValues = Object.values(PackageManager);
8
- export const BooleanConfigValues = Object.values(BooleanConfig);
9
- export const FrameworkValues = Object.values(Framework);
10
- export const BFFTypeValues = Object.values(BFFType);
11
- export const MWAValueMap = {
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import make from "covertable";
21
+ import {
22
+ Solution,
23
+ PackageManager,
24
+ Language,
25
+ BooleanConfig,
26
+ MWAActionTypes,
27
+ MWAActionTypesMap,
28
+ Framework,
29
+ BFFType,
30
+ ActionElement,
31
+ ActionFunction,
32
+ ModuleActionTypes,
33
+ ModuleActionTypesMap,
34
+ SubSolution
35
+ } from "@modern-js/generator-common";
36
+ const LanguageValues = Object.values(Language);
37
+ const PackageManagerValues = Object.values(PackageManager);
38
+ const BooleanConfigValues = Object.values(BooleanConfig);
39
+ const FrameworkValues = Object.values(Framework);
40
+ const BFFTypeValues = Object.values(BFFType);
41
+ const MWAValueMap = {
12
42
  language: LanguageValues,
13
43
  packageManager: PackageManagerValues
14
44
  };
15
- export const ModuleValueMap = {
45
+ const ModuleValueMap = {
16
46
  language: LanguageValues,
17
47
  packageManager: PackageManagerValues
18
48
  };
19
- export const MonorepoValueMap = {
20
- packageManager: PackageManagerValues.filter(packageManager => packageManager !== 'npm')
49
+ const MonorepoValueMap = {
50
+ packageManager: PackageManagerValues.filter(
51
+ (packageManager) => packageManager !== "npm"
52
+ )
21
53
  };
22
- export const getMWACases = length => {
54
+ const getMWACases = (length) => {
23
55
  const cases = make(MWAValueMap, {
24
56
  length: length || Object.keys(MWAValueMap).length
25
57
  });
26
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
58
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
27
59
  solution: Solution.MWA
28
60
  }));
29
61
  };
30
- export const getModuleCases = length => {
62
+ const getModuleCases = (length) => {
31
63
  const cases = make(ModuleValueMap, {
32
64
  length: length || Object.keys(ModuleValueMap).length
33
65
  });
34
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
66
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
35
67
  solution: Solution.Module
36
68
  }));
37
69
  };
38
- export const getMonorepoCases = () => {
70
+ const getMonorepoCases = () => {
39
71
  const cases = make(MonorepoValueMap, {
40
72
  length: Object.keys(MonorepoValueMap).length
41
73
  });
42
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
74
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
43
75
  solution: Solution.Monorepo
44
76
  }));
45
77
  };
46
- const getMWAEntryCases = _length => {
47
- return [{
48
- name: 'test'
49
- }];
78
+ const getMWAEntryCases = (_length) => {
79
+ return [
80
+ {
81
+ name: "test"
82
+ }
83
+ ];
50
84
  };
51
- export const MWAServerValueMap = {
85
+ const MWAServerValueMap = {
52
86
  framework: FrameworkValues
53
87
  };
54
88
  const getMWAServerCases = () => make(MWAServerValueMap, {
55
89
  length: Object.keys(MWAServerValueMap).length
56
90
  });
57
- export const MWABFFValueMap = {
91
+ const MWABFFValueMap = {
58
92
  bffType: BFFTypeValues,
59
93
  framework: FrameworkValues
60
94
  };
61
- const getMWABFFCases = length => make(MWABFFValueMap, {
95
+ const getMWABFFCases = (length) => make(MWABFFValueMap, {
62
96
  length: length || Object.keys(MWABFFValueMap).length
63
97
  });
64
- export const getMWANewCases = length => {
98
+ const getMWANewCases = (length) => {
65
99
  const cases = [];
66
- MWAActionTypes.forEach(action => {
67
- const config = {
68
- actionType: action
69
- };
70
- MWAActionTypesMap[action].forEach(option => {
100
+ MWAActionTypes.forEach((action) => {
101
+ const config = { actionType: action };
102
+ MWAActionTypesMap[action].forEach((option) => {
71
103
  config[action] = option;
72
- const currentConfig = _objectSpread(_objectSpread({}, config), {}, {
73
- [action]: option
74
- });
104
+ const currentConfig = __spreadProps(__spreadValues({}, config), { [action]: option });
75
105
  if (option === ActionElement.Entry) {
76
106
  const entryCases = getMWAEntryCases(length);
77
- entryCases.forEach(c => {
78
- cases.push(_objectSpread(_objectSpread({}, currentConfig), c));
107
+ entryCases.forEach((c) => {
108
+ cases.push(__spreadValues(__spreadValues({}, currentConfig), c));
79
109
  });
80
110
  } else if (option === ActionElement.Server) {
81
- // server only can enable once
82
111
  const serverCases = getMWAServerCases();
83
- cases.push(_objectSpread(_objectSpread({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
112
+ cases.push(__spreadValues(__spreadValues({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
84
113
  } else if (option === ActionFunction.BFF) {
85
- // bff only can enable once
86
114
  const bffCases = getMWABFFCases(length);
87
- cases.push(_objectSpread(_objectSpread({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
115
+ cases.push(__spreadValues(__spreadValues({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
88
116
  } else {
89
117
  cases.push(currentConfig);
90
118
  }
@@ -92,34 +120,30 @@ export const getMWANewCases = length => {
92
120
  });
93
121
  return cases;
94
122
  };
95
- export const getModuleNewCases = () => {
123
+ const getModuleNewCases = () => {
96
124
  const cases = [];
97
- ModuleActionTypes.forEach(action => {
98
- const config = {
99
- actionType: action
100
- };
101
- ModuleActionTypesMap[action].forEach(option => {
102
- const currentConfig = _objectSpread(_objectSpread({}, config), {}, {
103
- [action]: option
104
- });
125
+ ModuleActionTypes.forEach((action) => {
126
+ const config = { actionType: action };
127
+ ModuleActionTypesMap[action].forEach((option) => {
128
+ const currentConfig = __spreadProps(__spreadValues({}, config), { [action]: option });
105
129
  cases.push(currentConfig);
106
130
  });
107
131
  });
108
132
  return cases;
109
133
  };
110
- export const MWASubProjectValueMap = {
134
+ const MWASubProjectValueMap = {
111
135
  language: LanguageValues
112
136
  };
113
- export const ModuleSubProjectValueMap = {
137
+ const ModuleSubProjectValueMap = {
114
138
  language: LanguageValues
115
139
  };
116
140
  const getMWASubProjectCases = (isTest, length) => {
117
141
  const cases = make(MWASubProjectValueMap, {
118
142
  length: length || Object.keys(MWASubProjectValueMap).length
119
143
  });
120
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
121
- packageName: Object.values(item).join('-'),
122
- packagePath: Object.values(item).join('-'),
144
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
145
+ packageName: Object.values(item).join("-"),
146
+ packagePath: Object.values(item).join("-"),
123
147
  solution: isTest ? SubSolution.MWATest : SubSolution.MWA
124
148
  }));
125
149
  };
@@ -127,13 +151,38 @@ const getModuleSubProjectCases = (isInner, length) => {
127
151
  const cases = make(ModuleSubProjectValueMap, {
128
152
  length: length || Object.keys(ModuleSubProjectValueMap).length
129
153
  });
130
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
131
- packageName: Object.values(item).join('-'),
132
- packagePath: Object.values(item).join('-'),
154
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
155
+ packageName: Object.values(item).join("-"),
156
+ packagePath: Object.values(item).join("-"),
133
157
  solution: isInner ? SubSolution.InnerModule : SubSolution.Module
134
158
  }));
135
159
  };
136
- export const getMonorepoNewCases = length => {
137
- const cases = [...getMWASubProjectCases(false, length), ...getMWASubProjectCases(true, length), ...getModuleSubProjectCases(false, length), ...getModuleSubProjectCases(true, length)];
160
+ const getMonorepoNewCases = (length) => {
161
+ const cases = [
162
+ ...getMWASubProjectCases(false, length),
163
+ ...getMWASubProjectCases(true, length),
164
+ ...getModuleSubProjectCases(false, length),
165
+ ...getModuleSubProjectCases(true, length)
166
+ ];
138
167
  return cases;
139
- };
168
+ };
169
+ export {
170
+ BFFTypeValues,
171
+ BooleanConfigValues,
172
+ FrameworkValues,
173
+ LanguageValues,
174
+ MWABFFValueMap,
175
+ MWAServerValueMap,
176
+ MWASubProjectValueMap,
177
+ MWAValueMap,
178
+ ModuleSubProjectValueMap,
179
+ ModuleValueMap,
180
+ MonorepoValueMap,
181
+ PackageManagerValues,
182
+ getMWACases,
183
+ getMWANewCases,
184
+ getModuleCases,
185
+ getModuleNewCases,
186
+ getMonorepoCases,
187
+ getMonorepoNewCases
188
+ };
@@ -1,110 +1,147 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __export = (target, all) => {
25
+ for (var name in all)
26
+ __defProp(target, name, { get: all[name], enumerable: true });
27
+ };
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
+ }
34
+ return to;
35
+ };
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
37
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
38
+ mod
39
+ ));
40
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
41
+ var src_exports = {};
42
+ __export(src_exports, {
43
+ BFFTypeValues: () => BFFTypeValues,
44
+ BooleanConfigValues: () => BooleanConfigValues,
45
+ FrameworkValues: () => FrameworkValues,
46
+ LanguageValues: () => LanguageValues,
47
+ MWABFFValueMap: () => MWABFFValueMap,
48
+ MWAServerValueMap: () => MWAServerValueMap,
49
+ MWASubProjectValueMap: () => MWASubProjectValueMap,
50
+ MWAValueMap: () => MWAValueMap,
51
+ ModuleSubProjectValueMap: () => ModuleSubProjectValueMap,
52
+ ModuleValueMap: () => ModuleValueMap,
53
+ MonorepoValueMap: () => MonorepoValueMap,
54
+ PackageManagerValues: () => PackageManagerValues,
55
+ getMWACases: () => getMWACases,
56
+ getMWANewCases: () => getMWANewCases,
57
+ getModuleCases: () => getModuleCases,
58
+ getModuleNewCases: () => getModuleNewCases,
59
+ getMonorepoCases: () => getMonorepoCases,
60
+ getMonorepoNewCases: () => getMonorepoNewCases
5
61
  });
6
- exports.getMonorepoNewCases = exports.getMonorepoCases = exports.getModuleNewCases = exports.getModuleCases = exports.getMWANewCases = exports.getMWACases = exports.PackageManagerValues = exports.MonorepoValueMap = exports.ModuleValueMap = exports.ModuleSubProjectValueMap = exports.MWAValueMap = exports.MWASubProjectValueMap = exports.MWAServerValueMap = exports.MWABFFValueMap = exports.LanguageValues = exports.FrameworkValues = exports.BooleanConfigValues = exports.BFFTypeValues = void 0;
7
- var _covertable = _interopRequireDefault(require("covertable"));
8
- var _generatorCommon = require("@modern-js/generator-common");
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
- const LanguageValues = Object.values(_generatorCommon.Language);
14
- exports.LanguageValues = LanguageValues;
15
- const PackageManagerValues = Object.values(_generatorCommon.PackageManager);
16
- exports.PackageManagerValues = PackageManagerValues;
17
- const BooleanConfigValues = Object.values(_generatorCommon.BooleanConfig);
18
- exports.BooleanConfigValues = BooleanConfigValues;
19
- const FrameworkValues = Object.values(_generatorCommon.Framework);
20
- exports.FrameworkValues = FrameworkValues;
21
- const BFFTypeValues = Object.values(_generatorCommon.BFFType);
22
- exports.BFFTypeValues = BFFTypeValues;
62
+ module.exports = __toCommonJS(src_exports);
63
+ var import_covertable = __toESM(require("covertable"));
64
+ var import_generator_common = require("@modern-js/generator-common");
65
+ const LanguageValues = Object.values(import_generator_common.Language);
66
+ const PackageManagerValues = Object.values(import_generator_common.PackageManager);
67
+ const BooleanConfigValues = Object.values(import_generator_common.BooleanConfig);
68
+ const FrameworkValues = Object.values(import_generator_common.Framework);
69
+ const BFFTypeValues = Object.values(import_generator_common.BFFType);
23
70
  const MWAValueMap = {
24
71
  language: LanguageValues,
25
72
  packageManager: PackageManagerValues
26
73
  };
27
- exports.MWAValueMap = MWAValueMap;
28
74
  const ModuleValueMap = {
29
75
  language: LanguageValues,
30
76
  packageManager: PackageManagerValues
31
77
  };
32
- exports.ModuleValueMap = ModuleValueMap;
33
78
  const MonorepoValueMap = {
34
- packageManager: PackageManagerValues.filter(packageManager => packageManager !== 'npm')
79
+ packageManager: PackageManagerValues.filter(
80
+ (packageManager) => packageManager !== "npm"
81
+ )
35
82
  };
36
- exports.MonorepoValueMap = MonorepoValueMap;
37
- const getMWACases = length => {
38
- const cases = (0, _covertable.default)(MWAValueMap, {
83
+ const getMWACases = (length) => {
84
+ const cases = (0, import_covertable.default)(MWAValueMap, {
39
85
  length: length || Object.keys(MWAValueMap).length
40
86
  });
41
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
42
- solution: _generatorCommon.Solution.MWA
87
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
88
+ solution: import_generator_common.Solution.MWA
43
89
  }));
44
90
  };
45
- exports.getMWACases = getMWACases;
46
- const getModuleCases = length => {
47
- const cases = (0, _covertable.default)(ModuleValueMap, {
91
+ const getModuleCases = (length) => {
92
+ const cases = (0, import_covertable.default)(ModuleValueMap, {
48
93
  length: length || Object.keys(ModuleValueMap).length
49
94
  });
50
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
51
- solution: _generatorCommon.Solution.Module
95
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
96
+ solution: import_generator_common.Solution.Module
52
97
  }));
53
98
  };
54
- exports.getModuleCases = getModuleCases;
55
99
  const getMonorepoCases = () => {
56
- const cases = (0, _covertable.default)(MonorepoValueMap, {
100
+ const cases = (0, import_covertable.default)(MonorepoValueMap, {
57
101
  length: Object.keys(MonorepoValueMap).length
58
102
  });
59
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
60
- solution: _generatorCommon.Solution.Monorepo
103
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
104
+ solution: import_generator_common.Solution.Monorepo
61
105
  }));
62
106
  };
63
- exports.getMonorepoCases = getMonorepoCases;
64
- const getMWAEntryCases = _length => {
65
- return [{
66
- name: 'test'
67
- }];
107
+ const getMWAEntryCases = (_length) => {
108
+ return [
109
+ {
110
+ name: "test"
111
+ }
112
+ ];
68
113
  };
69
114
  const MWAServerValueMap = {
70
115
  framework: FrameworkValues
71
116
  };
72
- exports.MWAServerValueMap = MWAServerValueMap;
73
- const getMWAServerCases = () => (0, _covertable.default)(MWAServerValueMap, {
117
+ const getMWAServerCases = () => (0, import_covertable.default)(MWAServerValueMap, {
74
118
  length: Object.keys(MWAServerValueMap).length
75
119
  });
76
120
  const MWABFFValueMap = {
77
121
  bffType: BFFTypeValues,
78
122
  framework: FrameworkValues
79
123
  };
80
- exports.MWABFFValueMap = MWABFFValueMap;
81
- const getMWABFFCases = length => (0, _covertable.default)(MWABFFValueMap, {
124
+ const getMWABFFCases = (length) => (0, import_covertable.default)(MWABFFValueMap, {
82
125
  length: length || Object.keys(MWABFFValueMap).length
83
126
  });
84
- const getMWANewCases = length => {
127
+ const getMWANewCases = (length) => {
85
128
  const cases = [];
86
- _generatorCommon.MWAActionTypes.forEach(action => {
87
- const config = {
88
- actionType: action
89
- };
90
- _generatorCommon.MWAActionTypesMap[action].forEach(option => {
129
+ import_generator_common.MWAActionTypes.forEach((action) => {
130
+ const config = { actionType: action };
131
+ import_generator_common.MWAActionTypesMap[action].forEach((option) => {
91
132
  config[action] = option;
92
- const currentConfig = _objectSpread(_objectSpread({}, config), {}, {
93
- [action]: option
94
- });
95
- if (option === _generatorCommon.ActionElement.Entry) {
133
+ const currentConfig = __spreadProps(__spreadValues({}, config), { [action]: option });
134
+ if (option === import_generator_common.ActionElement.Entry) {
96
135
  const entryCases = getMWAEntryCases(length);
97
- entryCases.forEach(c => {
98
- cases.push(_objectSpread(_objectSpread({}, currentConfig), c));
136
+ entryCases.forEach((c) => {
137
+ cases.push(__spreadValues(__spreadValues({}, currentConfig), c));
99
138
  });
100
- } else if (option === _generatorCommon.ActionElement.Server) {
101
- // server only can enable once
139
+ } else if (option === import_generator_common.ActionElement.Server) {
102
140
  const serverCases = getMWAServerCases();
103
- cases.push(_objectSpread(_objectSpread({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
104
- } else if (option === _generatorCommon.ActionFunction.BFF) {
105
- // bff only can enable once
141
+ cases.push(__spreadValues(__spreadValues({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
142
+ } else if (option === import_generator_common.ActionFunction.BFF) {
106
143
  const bffCases = getMWABFFCases(length);
107
- cases.push(_objectSpread(_objectSpread({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
144
+ cases.push(__spreadValues(__spreadValues({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
108
145
  } else {
109
146
  cases.push(currentConfig);
110
147
  }
@@ -112,53 +149,70 @@ const getMWANewCases = length => {
112
149
  });
113
150
  return cases;
114
151
  };
115
- exports.getMWANewCases = getMWANewCases;
116
152
  const getModuleNewCases = () => {
117
153
  const cases = [];
118
- _generatorCommon.ModuleActionTypes.forEach(action => {
119
- const config = {
120
- actionType: action
121
- };
122
- _generatorCommon.ModuleActionTypesMap[action].forEach(option => {
123
- const currentConfig = _objectSpread(_objectSpread({}, config), {}, {
124
- [action]: option
125
- });
154
+ import_generator_common.ModuleActionTypes.forEach((action) => {
155
+ const config = { actionType: action };
156
+ import_generator_common.ModuleActionTypesMap[action].forEach((option) => {
157
+ const currentConfig = __spreadProps(__spreadValues({}, config), { [action]: option });
126
158
  cases.push(currentConfig);
127
159
  });
128
160
  });
129
161
  return cases;
130
162
  };
131
- exports.getModuleNewCases = getModuleNewCases;
132
163
  const MWASubProjectValueMap = {
133
164
  language: LanguageValues
134
165
  };
135
- exports.MWASubProjectValueMap = MWASubProjectValueMap;
136
166
  const ModuleSubProjectValueMap = {
137
167
  language: LanguageValues
138
168
  };
139
- exports.ModuleSubProjectValueMap = ModuleSubProjectValueMap;
140
169
  const getMWASubProjectCases = (isTest, length) => {
141
- const cases = (0, _covertable.default)(MWASubProjectValueMap, {
170
+ const cases = (0, import_covertable.default)(MWASubProjectValueMap, {
142
171
  length: length || Object.keys(MWASubProjectValueMap).length
143
172
  });
144
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
145
- packageName: Object.values(item).join('-'),
146
- packagePath: Object.values(item).join('-'),
147
- solution: isTest ? _generatorCommon.SubSolution.MWATest : _generatorCommon.SubSolution.MWA
173
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
174
+ packageName: Object.values(item).join("-"),
175
+ packagePath: Object.values(item).join("-"),
176
+ solution: isTest ? import_generator_common.SubSolution.MWATest : import_generator_common.SubSolution.MWA
148
177
  }));
149
178
  };
150
179
  const getModuleSubProjectCases = (isInner, length) => {
151
- const cases = (0, _covertable.default)(ModuleSubProjectValueMap, {
180
+ const cases = (0, import_covertable.default)(ModuleSubProjectValueMap, {
152
181
  length: length || Object.keys(ModuleSubProjectValueMap).length
153
182
  });
154
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
155
- packageName: Object.values(item).join('-'),
156
- packagePath: Object.values(item).join('-'),
157
- solution: isInner ? _generatorCommon.SubSolution.InnerModule : _generatorCommon.SubSolution.Module
183
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
184
+ packageName: Object.values(item).join("-"),
185
+ packagePath: Object.values(item).join("-"),
186
+ solution: isInner ? import_generator_common.SubSolution.InnerModule : import_generator_common.SubSolution.Module
158
187
  }));
159
188
  };
160
- const getMonorepoNewCases = length => {
161
- const cases = [...getMWASubProjectCases(false, length), ...getMWASubProjectCases(true, length), ...getModuleSubProjectCases(false, length), ...getModuleSubProjectCases(true, length)];
189
+ const getMonorepoNewCases = (length) => {
190
+ const cases = [
191
+ ...getMWASubProjectCases(false, length),
192
+ ...getMWASubProjectCases(true, length),
193
+ ...getModuleSubProjectCases(false, length),
194
+ ...getModuleSubProjectCases(true, length)
195
+ ];
162
196
  return cases;
163
197
  };
164
- exports.getMonorepoNewCases = getMonorepoNewCases;
198
+ // Annotate the CommonJS export names for ESM import in node:
199
+ 0 && (module.exports = {
200
+ BFFTypeValues,
201
+ BooleanConfigValues,
202
+ FrameworkValues,
203
+ LanguageValues,
204
+ MWABFFValueMap,
205
+ MWAServerValueMap,
206
+ MWASubProjectValueMap,
207
+ MWAValueMap,
208
+ ModuleSubProjectValueMap,
209
+ ModuleValueMap,
210
+ MonorepoValueMap,
211
+ PackageManagerValues,
212
+ getMWACases,
213
+ getMWANewCases,
214
+ getModuleCases,
215
+ getModuleNewCases,
216
+ getMonorepoCases,
217
+ getMonorepoNewCases
218
+ });
@@ -1,151 +1,226 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
- import make from 'covertable';
5
- import { Solution, PackageManager, Language, BooleanConfig, MWAActionTypes, MWAActionTypesMap, Framework, BFFType, ActionElement, ActionFunction, ModuleActionTypes, ModuleActionTypesMap, SubSolution } from '@modern-js/generator-common';
6
- export var LanguageValues = Object.values(Language);
7
- export var PackageManagerValues = Object.values(PackageManager);
8
- export var BooleanConfigValues = Object.values(BooleanConfig);
9
- export var FrameworkValues = Object.values(Framework);
10
- export var BFFTypeValues = Object.values(BFFType);
11
- export var MWAValueMap = {
12
- language: LanguageValues,
13
- packageManager: PackageManagerValues
14
- };
15
- export var ModuleValueMap = {
16
- language: LanguageValues,
17
- packageManager: PackageManagerValues
18
- };
19
- export var MonorepoValueMap = {
20
- packageManager: PackageManagerValues.filter(function (packageManager) {
21
- return packageManager !== 'npm';
22
- })
23
- };
24
- export var getMWACases = function getMWACases(length) {
25
- var cases = make(MWAValueMap, {
26
- length: length || Object.keys(MWAValueMap).length
27
- });
28
- return cases.map(function (item) {
29
- return _objectSpread(_objectSpread({}, item), {}, {
30
- solution: Solution.MWA
1
+ function _arrayLikeToArray(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _arrayWithoutHoles(arr) {
7
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
8
+ }
9
+ function _defineProperty(obj, key, value) {
10
+ if (key in obj) {
11
+ Object.defineProperty(obj, key, {
12
+ value: value,
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true
16
+ });
17
+ } else {
18
+ obj[key] = value;
19
+ }
20
+ return obj;
21
+ }
22
+ function _iterableToArray(iter) {
23
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
24
+ }
25
+ function _nonIterableSpread() {
26
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
27
+ }
28
+ function _objectSpread(target) {
29
+ for(var i = 1; i < arguments.length; i++){
30
+ var source = arguments[i] != null ? arguments[i] : {};
31
+ var ownKeys = Object.keys(source);
32
+ if (typeof Object.getOwnPropertySymbols === "function") {
33
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
34
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
35
+ }));
36
+ }
37
+ ownKeys.forEach(function(key) {
38
+ _defineProperty(target, key, source[key]);
39
+ });
40
+ }
41
+ return target;
42
+ }
43
+ function ownKeys(object, enumerableOnly) {
44
+ var keys = Object.keys(object);
45
+ if (Object.getOwnPropertySymbols) {
46
+ var symbols = Object.getOwnPropertySymbols(object);
47
+ if (enumerableOnly) {
48
+ symbols = symbols.filter(function(sym) {
49
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
50
+ });
51
+ }
52
+ keys.push.apply(keys, symbols);
53
+ }
54
+ return keys;
55
+ }
56
+ function _objectSpreadProps(target, source) {
57
+ source = source != null ? source : {};
58
+ if (Object.getOwnPropertyDescriptors) {
59
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
60
+ } else {
61
+ ownKeys(Object(source)).forEach(function(key) {
62
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
63
+ });
64
+ }
65
+ return target;
66
+ }
67
+ function _toConsumableArray(arr) {
68
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
69
+ }
70
+ function _unsupportedIterableToArray(o, minLen) {
71
+ if (!o) return;
72
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
73
+ var n = Object.prototype.toString.call(o).slice(8, -1);
74
+ if (n === "Object" && o.constructor) n = o.constructor.name;
75
+ if (n === "Map" || n === "Set") return Array.from(n);
76
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
77
+ }
78
+ import make from "covertable";
79
+ import { Solution, PackageManager, Language, BooleanConfig, MWAActionTypes, MWAActionTypesMap, Framework, BFFType, ActionElement, ActionFunction, ModuleActionTypes, ModuleActionTypesMap, SubSolution } from "@modern-js/generator-common";
80
+ var LanguageValues = Object.values(Language);
81
+ var PackageManagerValues = Object.values(PackageManager);
82
+ var BooleanConfigValues = Object.values(BooleanConfig);
83
+ var FrameworkValues = Object.values(Framework);
84
+ var BFFTypeValues = Object.values(BFFType);
85
+ var MWAValueMap = {
86
+ language: LanguageValues,
87
+ packageManager: PackageManagerValues
88
+ };
89
+ var ModuleValueMap = {
90
+ language: LanguageValues,
91
+ packageManager: PackageManagerValues
92
+ };
93
+ var MonorepoValueMap = {
94
+ packageManager: PackageManagerValues.filter(function(packageManager) {
95
+ return packageManager !== "npm";
96
+ })
97
+ };
98
+ var getMWACases = function(length) {
99
+ var cases = make(MWAValueMap, {
100
+ length: length || Object.keys(MWAValueMap).length
31
101
  });
32
- });
33
- };
34
- export var getModuleCases = function getModuleCases(length) {
35
- var cases = make(ModuleValueMap, {
36
- length: length || Object.keys(ModuleValueMap).length
37
- });
38
- return cases.map(function (item) {
39
- return _objectSpread(_objectSpread({}, item), {}, {
40
- solution: Solution.Module
102
+ return cases.map(function(item) {
103
+ return _objectSpreadProps(_objectSpread({}, item), {
104
+ solution: Solution.MWA
105
+ });
41
106
  });
42
- });
43
- };
44
- export var getMonorepoCases = function getMonorepoCases() {
45
- var cases = make(MonorepoValueMap, {
46
- length: Object.keys(MonorepoValueMap).length
47
- });
48
- return cases.map(function (item) {
49
- return _objectSpread(_objectSpread({}, item), {}, {
50
- solution: Solution.Monorepo
107
+ };
108
+ var getModuleCases = function(length) {
109
+ var cases = make(ModuleValueMap, {
110
+ length: length || Object.keys(ModuleValueMap).length
51
111
  });
52
- });
53
- };
54
- var getMWAEntryCases = function getMWAEntryCases(_length) {
55
- return [{
56
- name: 'test'
57
- }];
58
- };
59
- export var MWAServerValueMap = {
60
- framework: FrameworkValues
61
- };
62
- var getMWAServerCases = function getMWAServerCases() {
63
- return make(MWAServerValueMap, {
64
- length: Object.keys(MWAServerValueMap).length
65
- });
66
- };
67
- export var MWABFFValueMap = {
68
- bffType: BFFTypeValues,
69
- framework: FrameworkValues
70
- };
71
- var getMWABFFCases = function getMWABFFCases(length) {
72
- return make(MWABFFValueMap, {
73
- length: length || Object.keys(MWABFFValueMap).length
74
- });
75
- };
76
- export var getMWANewCases = function getMWANewCases(length) {
77
- var cases = [];
78
- MWAActionTypes.forEach(function (action) {
79
- var config = {
80
- actionType: action
81
- };
82
- MWAActionTypesMap[action].forEach(function (option) {
83
- config[action] = option;
84
- var currentConfig = _objectSpread(_objectSpread({}, config), {}, _defineProperty({}, action, option));
85
- if (option === ActionElement.Entry) {
86
- var entryCases = getMWAEntryCases(length);
87
- entryCases.forEach(function (c) {
88
- cases.push(_objectSpread(_objectSpread({}, currentConfig), c));
112
+ return cases.map(function(item) {
113
+ return _objectSpreadProps(_objectSpread({}, item), {
114
+ solution: Solution.Module
89
115
  });
90
- } else if (option === ActionElement.Server) {
91
- // server only can enable once
92
- var serverCases = getMWAServerCases();
93
- cases.push(_objectSpread(_objectSpread({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
94
- } else if (option === ActionFunction.BFF) {
95
- // bff only can enable once
96
- var bffCases = getMWABFFCases(length);
97
- cases.push(_objectSpread(_objectSpread({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
98
- } else {
99
- cases.push(currentConfig);
100
- }
101
116
  });
102
- });
103
- return cases;
104
- };
105
- export var getModuleNewCases = function getModuleNewCases() {
106
- var cases = [];
107
- ModuleActionTypes.forEach(function (action) {
108
- var config = {
109
- actionType: action
110
- };
111
- ModuleActionTypesMap[action].forEach(function (option) {
112
- var currentConfig = _objectSpread(_objectSpread({}, config), {}, _defineProperty({}, action, option));
113
- cases.push(currentConfig);
117
+ };
118
+ var getMonorepoCases = function() {
119
+ var cases = make(MonorepoValueMap, {
120
+ length: Object.keys(MonorepoValueMap).length
114
121
  });
115
- });
116
- return cases;
117
- };
118
- export var MWASubProjectValueMap = {
119
- language: LanguageValues
120
- };
121
- export var ModuleSubProjectValueMap = {
122
- language: LanguageValues
123
- };
124
- var getMWASubProjectCases = function getMWASubProjectCases(isTest, length) {
125
- var cases = make(MWASubProjectValueMap, {
126
- length: length || Object.keys(MWASubProjectValueMap).length
127
- });
128
- return cases.map(function (item) {
129
- return _objectSpread(_objectSpread({}, item), {}, {
130
- packageName: Object.values(item).join('-'),
131
- packagePath: Object.values(item).join('-'),
132
- solution: isTest ? SubSolution.MWATest : SubSolution.MWA
122
+ return cases.map(function(item) {
123
+ return _objectSpreadProps(_objectSpread({}, item), {
124
+ solution: Solution.Monorepo
125
+ });
133
126
  });
134
- });
135
- };
136
- var getModuleSubProjectCases = function getModuleSubProjectCases(isInner, length) {
137
- var cases = make(ModuleSubProjectValueMap, {
138
- length: length || Object.keys(ModuleSubProjectValueMap).length
139
- });
140
- return cases.map(function (item) {
141
- return _objectSpread(_objectSpread({}, item), {}, {
142
- packageName: Object.values(item).join('-'),
143
- packagePath: Object.values(item).join('-'),
144
- solution: isInner ? SubSolution.InnerModule : SubSolution.Module
127
+ };
128
+ var getMWAEntryCases = function(_length) {
129
+ return [
130
+ {
131
+ name: "test"
132
+ }
133
+ ];
134
+ };
135
+ var MWAServerValueMap = {
136
+ framework: FrameworkValues
137
+ };
138
+ var getMWAServerCases = function() {
139
+ return make(MWAServerValueMap, {
140
+ length: Object.keys(MWAServerValueMap).length
145
141
  });
146
- });
147
142
  };
148
- export var getMonorepoNewCases = function getMonorepoNewCases(length) {
149
- var cases = [].concat(_toConsumableArray(getMWASubProjectCases(false, length)), _toConsumableArray(getMWASubProjectCases(true, length)), _toConsumableArray(getModuleSubProjectCases(false, length)), _toConsumableArray(getModuleSubProjectCases(true, length)));
150
- return cases;
151
- };
143
+ var MWABFFValueMap = {
144
+ bffType: BFFTypeValues,
145
+ framework: FrameworkValues
146
+ };
147
+ var getMWABFFCases = function(length) {
148
+ return make(MWABFFValueMap, {
149
+ length: length || Object.keys(MWABFFValueMap).length
150
+ });
151
+ };
152
+ var getMWANewCases = function(length) {
153
+ var cases = [];
154
+ MWAActionTypes.forEach(function(action) {
155
+ var config = {
156
+ actionType: action
157
+ };
158
+ MWAActionTypesMap[action].forEach(function(option) {
159
+ config[action] = option;
160
+ var currentConfig = _objectSpreadProps(_objectSpread({}, config), _defineProperty({}, action, option));
161
+ if (option === ActionElement.Entry) {
162
+ var entryCases = getMWAEntryCases(length);
163
+ entryCases.forEach(function(c) {
164
+ cases.push(_objectSpread({}, currentConfig, c));
165
+ });
166
+ } else if (option === ActionElement.Server) {
167
+ var serverCases = getMWAServerCases();
168
+ cases.push(_objectSpread({}, currentConfig, serverCases[Math.round(Math.random() * serverCases.length)]));
169
+ } else if (option === ActionFunction.BFF) {
170
+ var bffCases = getMWABFFCases(length);
171
+ cases.push(_objectSpread({}, currentConfig, bffCases[Math.round(Math.random() * bffCases.length)]));
172
+ } else {
173
+ cases.push(currentConfig);
174
+ }
175
+ });
176
+ });
177
+ return cases;
178
+ };
179
+ var getModuleNewCases = function() {
180
+ var cases = [];
181
+ ModuleActionTypes.forEach(function(action) {
182
+ var config = {
183
+ actionType: action
184
+ };
185
+ ModuleActionTypesMap[action].forEach(function(option) {
186
+ var currentConfig = _objectSpreadProps(_objectSpread({}, config), _defineProperty({}, action, option));
187
+ cases.push(currentConfig);
188
+ });
189
+ });
190
+ return cases;
191
+ };
192
+ var MWASubProjectValueMap = {
193
+ language: LanguageValues
194
+ };
195
+ var ModuleSubProjectValueMap = {
196
+ language: LanguageValues
197
+ };
198
+ var getMWASubProjectCases = function(isTest, length) {
199
+ var cases = make(MWASubProjectValueMap, {
200
+ length: length || Object.keys(MWASubProjectValueMap).length
201
+ });
202
+ return cases.map(function(item) {
203
+ return _objectSpreadProps(_objectSpread({}, item), {
204
+ packageName: Object.values(item).join("-"),
205
+ packagePath: Object.values(item).join("-"),
206
+ solution: isTest ? SubSolution.MWATest : SubSolution.MWA
207
+ });
208
+ });
209
+ };
210
+ var getModuleSubProjectCases = function(isInner, length) {
211
+ var cases = make(ModuleSubProjectValueMap, {
212
+ length: length || Object.keys(ModuleSubProjectValueMap).length
213
+ });
214
+ return cases.map(function(item) {
215
+ return _objectSpreadProps(_objectSpread({}, item), {
216
+ packageName: Object.values(item).join("-"),
217
+ packagePath: Object.values(item).join("-"),
218
+ solution: isInner ? SubSolution.InnerModule : SubSolution.Module
219
+ });
220
+ });
221
+ };
222
+ var getMonorepoNewCases = function(length) {
223
+ var cases = _toConsumableArray(getMWASubProjectCases(false, length)).concat(_toConsumableArray(getMWASubProjectCases(true, length)), _toConsumableArray(getModuleSubProjectCases(false, length)), _toConsumableArray(getModuleSubProjectCases(true, length)));
224
+ return cases;
225
+ };
226
+ export { BFFTypeValues, BooleanConfigValues, FrameworkValues, LanguageValues, MWABFFValueMap, MWAServerValueMap, MWASubProjectValueMap, MWAValueMap, ModuleSubProjectValueMap, ModuleValueMap, MonorepoValueMap, PackageManagerValues, getMWACases, getMWANewCases, getModuleCases, getModuleNewCases, getMonorepoCases, getMonorepoNewCases };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "3.0.0-beta.3",
14
+ "version": "3.0.0-beta.5",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -30,15 +30,15 @@
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.18.0",
32
32
  "covertable": "^2.2.2",
33
- "@modern-js/generator-common": "3.0.0-beta.3"
33
+ "@modern-js/generator-common": "3.0.0-beta.5"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/jest": "^27",
37
37
  "@types/node": "^14",
38
38
  "typescript": "^4",
39
39
  "jest": "^27",
40
- "@scripts/build": "2.0.0-beta.3",
41
- "@scripts/jest-config": "2.0.0-beta.3"
40
+ "@scripts/build": "2.0.0-beta.6",
41
+ "@scripts/jest-config": "2.0.0-beta.6"
42
42
  },
43
43
  "sideEffects": false,
44
44
  "publishConfig": {