@modern-js/generator-cases 0.0.0-next-0bf5ec13d2 → 0.0.0-next-b71d66058
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 +2 -2
- package/package.json +4 -4
- package/dist/js/modern/index.js +0 -188
- package/dist/js/node/index.js +0 -218
- package/dist/js/treeshaking/index.js +0 -226
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.0-next-
|
|
14
|
+
"version": "0.0.0-next-b71d66058",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/cjs/index.js",
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.18.0",
|
|
31
31
|
"covertable": "^2.2.2",
|
|
32
|
-
"@modern-js/generator-common": "0.0.0-next-
|
|
32
|
+
"@modern-js/generator-common": "0.0.0-next-b71d66058"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/jest": "^27",
|
|
36
36
|
"@types/node": "^14",
|
|
37
37
|
"typescript": "^4",
|
|
38
|
-
"@scripts/build": "0.0.0-next-0bf5ec13d2",
|
|
39
38
|
"jest": "^27",
|
|
40
|
-
"@scripts/
|
|
39
|
+
"@scripts/build": "0.0.0-next-b71d66058",
|
|
40
|
+
"@scripts/jest-config": "0.0.0-next-b71d66058"
|
|
41
41
|
},
|
|
42
42
|
"sideEffects": false,
|
|
43
43
|
"publishConfig": {
|
package/dist/js/modern/index.js
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
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 = {
|
|
42
|
-
language: LanguageValues,
|
|
43
|
-
packageManager: PackageManagerValues
|
|
44
|
-
};
|
|
45
|
-
const ModuleValueMap = {
|
|
46
|
-
language: LanguageValues,
|
|
47
|
-
packageManager: PackageManagerValues
|
|
48
|
-
};
|
|
49
|
-
const MonorepoValueMap = {
|
|
50
|
-
packageManager: PackageManagerValues.filter(
|
|
51
|
-
(packageManager) => packageManager !== "npm"
|
|
52
|
-
)
|
|
53
|
-
};
|
|
54
|
-
const getMWACases = (length) => {
|
|
55
|
-
const cases = make(MWAValueMap, {
|
|
56
|
-
length: length || Object.keys(MWAValueMap).length
|
|
57
|
-
});
|
|
58
|
-
return cases.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
59
|
-
solution: Solution.MWA
|
|
60
|
-
}));
|
|
61
|
-
};
|
|
62
|
-
const getModuleCases = (length) => {
|
|
63
|
-
const cases = make(ModuleValueMap, {
|
|
64
|
-
length: length || Object.keys(ModuleValueMap).length
|
|
65
|
-
});
|
|
66
|
-
return cases.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
67
|
-
solution: Solution.Module
|
|
68
|
-
}));
|
|
69
|
-
};
|
|
70
|
-
const getMonorepoCases = () => {
|
|
71
|
-
const cases = make(MonorepoValueMap, {
|
|
72
|
-
length: Object.keys(MonorepoValueMap).length
|
|
73
|
-
});
|
|
74
|
-
return cases.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
75
|
-
solution: Solution.Monorepo
|
|
76
|
-
}));
|
|
77
|
-
};
|
|
78
|
-
const getMWAEntryCases = (_length) => {
|
|
79
|
-
return [
|
|
80
|
-
{
|
|
81
|
-
name: "test"
|
|
82
|
-
}
|
|
83
|
-
];
|
|
84
|
-
};
|
|
85
|
-
const MWAServerValueMap = {
|
|
86
|
-
framework: FrameworkValues
|
|
87
|
-
};
|
|
88
|
-
const getMWAServerCases = () => make(MWAServerValueMap, {
|
|
89
|
-
length: Object.keys(MWAServerValueMap).length
|
|
90
|
-
});
|
|
91
|
-
const MWABFFValueMap = {
|
|
92
|
-
bffType: BFFTypeValues,
|
|
93
|
-
framework: FrameworkValues
|
|
94
|
-
};
|
|
95
|
-
const getMWABFFCases = (length) => make(MWABFFValueMap, {
|
|
96
|
-
length: length || Object.keys(MWABFFValueMap).length
|
|
97
|
-
});
|
|
98
|
-
const getMWANewCases = (length) => {
|
|
99
|
-
const cases = [];
|
|
100
|
-
MWAActionTypes.forEach((action) => {
|
|
101
|
-
const config = { actionType: action };
|
|
102
|
-
MWAActionTypesMap[action].forEach((option) => {
|
|
103
|
-
config[action] = option;
|
|
104
|
-
const currentConfig = __spreadProps(__spreadValues({}, config), { [action]: option });
|
|
105
|
-
if (option === ActionElement.Entry) {
|
|
106
|
-
const entryCases = getMWAEntryCases(length);
|
|
107
|
-
entryCases.forEach((c) => {
|
|
108
|
-
cases.push(__spreadValues(__spreadValues({}, currentConfig), c));
|
|
109
|
-
});
|
|
110
|
-
} else if (option === ActionElement.Server) {
|
|
111
|
-
const serverCases = getMWAServerCases();
|
|
112
|
-
cases.push(__spreadValues(__spreadValues({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
|
|
113
|
-
} else if (option === ActionFunction.BFF) {
|
|
114
|
-
const bffCases = getMWABFFCases(length);
|
|
115
|
-
cases.push(__spreadValues(__spreadValues({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
|
|
116
|
-
} else {
|
|
117
|
-
cases.push(currentConfig);
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
return cases;
|
|
122
|
-
};
|
|
123
|
-
const getModuleNewCases = () => {
|
|
124
|
-
const cases = [];
|
|
125
|
-
ModuleActionTypes.forEach((action) => {
|
|
126
|
-
const config = { actionType: action };
|
|
127
|
-
ModuleActionTypesMap[action].forEach((option) => {
|
|
128
|
-
const currentConfig = __spreadProps(__spreadValues({}, config), { [action]: option });
|
|
129
|
-
cases.push(currentConfig);
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
return cases;
|
|
133
|
-
};
|
|
134
|
-
const MWASubProjectValueMap = {
|
|
135
|
-
language: LanguageValues
|
|
136
|
-
};
|
|
137
|
-
const ModuleSubProjectValueMap = {
|
|
138
|
-
language: LanguageValues
|
|
139
|
-
};
|
|
140
|
-
const getMWASubProjectCases = (isTest, length) => {
|
|
141
|
-
const cases = make(MWASubProjectValueMap, {
|
|
142
|
-
length: length || Object.keys(MWASubProjectValueMap).length
|
|
143
|
-
});
|
|
144
|
-
return cases.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
145
|
-
packageName: Object.values(item).join("-"),
|
|
146
|
-
packagePath: Object.values(item).join("-"),
|
|
147
|
-
solution: isTest ? SubSolution.MWATest : SubSolution.MWA
|
|
148
|
-
}));
|
|
149
|
-
};
|
|
150
|
-
const getModuleSubProjectCases = (isInner, length) => {
|
|
151
|
-
const cases = make(ModuleSubProjectValueMap, {
|
|
152
|
-
length: length || Object.keys(ModuleSubProjectValueMap).length
|
|
153
|
-
});
|
|
154
|
-
return cases.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
155
|
-
packageName: Object.values(item).join("-"),
|
|
156
|
-
packagePath: Object.values(item).join("-"),
|
|
157
|
-
solution: isInner ? SubSolution.InnerModule : SubSolution.Module
|
|
158
|
-
}));
|
|
159
|
-
};
|
|
160
|
-
const getMonorepoNewCases = (length) => {
|
|
161
|
-
const cases = [
|
|
162
|
-
...getMWASubProjectCases(false, length),
|
|
163
|
-
...getMWASubProjectCases(true, length),
|
|
164
|
-
...getModuleSubProjectCases(false, length),
|
|
165
|
-
...getModuleSubProjectCases(true, length)
|
|
166
|
-
];
|
|
167
|
-
return cases;
|
|
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
|
-
};
|
package/dist/js/node/index.js
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
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
|
|
61
|
-
});
|
|
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);
|
|
70
|
-
const MWAValueMap = {
|
|
71
|
-
language: LanguageValues,
|
|
72
|
-
packageManager: PackageManagerValues
|
|
73
|
-
};
|
|
74
|
-
const ModuleValueMap = {
|
|
75
|
-
language: LanguageValues,
|
|
76
|
-
packageManager: PackageManagerValues
|
|
77
|
-
};
|
|
78
|
-
const MonorepoValueMap = {
|
|
79
|
-
packageManager: PackageManagerValues.filter(
|
|
80
|
-
(packageManager) => packageManager !== "npm"
|
|
81
|
-
)
|
|
82
|
-
};
|
|
83
|
-
const getMWACases = (length) => {
|
|
84
|
-
const cases = (0, import_covertable.default)(MWAValueMap, {
|
|
85
|
-
length: length || Object.keys(MWAValueMap).length
|
|
86
|
-
});
|
|
87
|
-
return cases.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
88
|
-
solution: import_generator_common.Solution.MWA
|
|
89
|
-
}));
|
|
90
|
-
};
|
|
91
|
-
const getModuleCases = (length) => {
|
|
92
|
-
const cases = (0, import_covertable.default)(ModuleValueMap, {
|
|
93
|
-
length: length || Object.keys(ModuleValueMap).length
|
|
94
|
-
});
|
|
95
|
-
return cases.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
96
|
-
solution: import_generator_common.Solution.Module
|
|
97
|
-
}));
|
|
98
|
-
};
|
|
99
|
-
const getMonorepoCases = () => {
|
|
100
|
-
const cases = (0, import_covertable.default)(MonorepoValueMap, {
|
|
101
|
-
length: Object.keys(MonorepoValueMap).length
|
|
102
|
-
});
|
|
103
|
-
return cases.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
104
|
-
solution: import_generator_common.Solution.Monorepo
|
|
105
|
-
}));
|
|
106
|
-
};
|
|
107
|
-
const getMWAEntryCases = (_length) => {
|
|
108
|
-
return [
|
|
109
|
-
{
|
|
110
|
-
name: "test"
|
|
111
|
-
}
|
|
112
|
-
];
|
|
113
|
-
};
|
|
114
|
-
const MWAServerValueMap = {
|
|
115
|
-
framework: FrameworkValues
|
|
116
|
-
};
|
|
117
|
-
const getMWAServerCases = () => (0, import_covertable.default)(MWAServerValueMap, {
|
|
118
|
-
length: Object.keys(MWAServerValueMap).length
|
|
119
|
-
});
|
|
120
|
-
const MWABFFValueMap = {
|
|
121
|
-
bffType: BFFTypeValues,
|
|
122
|
-
framework: FrameworkValues
|
|
123
|
-
};
|
|
124
|
-
const getMWABFFCases = (length) => (0, import_covertable.default)(MWABFFValueMap, {
|
|
125
|
-
length: length || Object.keys(MWABFFValueMap).length
|
|
126
|
-
});
|
|
127
|
-
const getMWANewCases = (length) => {
|
|
128
|
-
const cases = [];
|
|
129
|
-
import_generator_common.MWAActionTypes.forEach((action) => {
|
|
130
|
-
const config = { actionType: action };
|
|
131
|
-
import_generator_common.MWAActionTypesMap[action].forEach((option) => {
|
|
132
|
-
config[action] = option;
|
|
133
|
-
const currentConfig = __spreadProps(__spreadValues({}, config), { [action]: option });
|
|
134
|
-
if (option === import_generator_common.ActionElement.Entry) {
|
|
135
|
-
const entryCases = getMWAEntryCases(length);
|
|
136
|
-
entryCases.forEach((c) => {
|
|
137
|
-
cases.push(__spreadValues(__spreadValues({}, currentConfig), c));
|
|
138
|
-
});
|
|
139
|
-
} else if (option === import_generator_common.ActionElement.Server) {
|
|
140
|
-
const serverCases = getMWAServerCases();
|
|
141
|
-
cases.push(__spreadValues(__spreadValues({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
|
|
142
|
-
} else if (option === import_generator_common.ActionFunction.BFF) {
|
|
143
|
-
const bffCases = getMWABFFCases(length);
|
|
144
|
-
cases.push(__spreadValues(__spreadValues({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
|
|
145
|
-
} else {
|
|
146
|
-
cases.push(currentConfig);
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
return cases;
|
|
151
|
-
};
|
|
152
|
-
const getModuleNewCases = () => {
|
|
153
|
-
const cases = [];
|
|
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 });
|
|
158
|
-
cases.push(currentConfig);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
return cases;
|
|
162
|
-
};
|
|
163
|
-
const MWASubProjectValueMap = {
|
|
164
|
-
language: LanguageValues
|
|
165
|
-
};
|
|
166
|
-
const ModuleSubProjectValueMap = {
|
|
167
|
-
language: LanguageValues
|
|
168
|
-
};
|
|
169
|
-
const getMWASubProjectCases = (isTest, length) => {
|
|
170
|
-
const cases = (0, import_covertable.default)(MWASubProjectValueMap, {
|
|
171
|
-
length: length || Object.keys(MWASubProjectValueMap).length
|
|
172
|
-
});
|
|
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
|
|
177
|
-
}));
|
|
178
|
-
};
|
|
179
|
-
const getModuleSubProjectCases = (isInner, length) => {
|
|
180
|
-
const cases = (0, import_covertable.default)(ModuleSubProjectValueMap, {
|
|
181
|
-
length: length || Object.keys(ModuleSubProjectValueMap).length
|
|
182
|
-
});
|
|
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
|
|
187
|
-
}));
|
|
188
|
-
};
|
|
189
|
-
const getMonorepoNewCases = (length) => {
|
|
190
|
-
const cases = [
|
|
191
|
-
...getMWASubProjectCases(false, length),
|
|
192
|
-
...getMWASubProjectCases(true, length),
|
|
193
|
-
...getModuleSubProjectCases(false, length),
|
|
194
|
-
...getModuleSubProjectCases(true, length)
|
|
195
|
-
];
|
|
196
|
-
return cases;
|
|
197
|
-
};
|
|
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,226 +0,0 @@
|
|
|
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
|
|
101
|
-
});
|
|
102
|
-
return cases.map(function(item) {
|
|
103
|
-
return _objectSpreadProps(_objectSpread({}, item), {
|
|
104
|
-
solution: Solution.MWA
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
var getModuleCases = function(length) {
|
|
109
|
-
var cases = make(ModuleValueMap, {
|
|
110
|
-
length: length || Object.keys(ModuleValueMap).length
|
|
111
|
-
});
|
|
112
|
-
return cases.map(function(item) {
|
|
113
|
-
return _objectSpreadProps(_objectSpread({}, item), {
|
|
114
|
-
solution: Solution.Module
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
var getMonorepoCases = function() {
|
|
119
|
-
var cases = make(MonorepoValueMap, {
|
|
120
|
-
length: Object.keys(MonorepoValueMap).length
|
|
121
|
-
});
|
|
122
|
-
return cases.map(function(item) {
|
|
123
|
-
return _objectSpreadProps(_objectSpread({}, item), {
|
|
124
|
-
solution: Solution.Monorepo
|
|
125
|
-
});
|
|
126
|
-
});
|
|
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
|
|
141
|
-
});
|
|
142
|
-
};
|
|
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 };
|