@tramvai/cli 4.34.4 → 4.36.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/lib/builder/webpack/tokens.d.ts +3 -0
- package/lib/builder/webpack/tokens.d.ts.map +1 -1
- package/lib/commands/static/application.js +1 -1
- package/lib/commands/static/application.js.map +1 -1
- package/lib/commands/static/command.d.ts +2 -0
- package/lib/commands/static/command.d.ts.map +1 -1
- package/lib/commands/static/command.js +10 -0
- package/lib/commands/static/command.js.map +1 -1
- package/lib/commands/static/generate.d.ts +2 -1
- package/lib/commands/static/generate.d.ts.map +1 -1
- package/lib/commands/static/generate.js +10 -3
- package/lib/commands/static/generate.js.map +1 -1
- package/lib/commands/static/static.d.ts +2 -1
- package/lib/commands/static/static.d.ts.map +1 -1
- package/lib/commands/static/static.js.map +1 -1
- package/lib/di/tokens/config.d.ts +1 -0
- package/lib/di/tokens/config.d.ts.map +1 -1
- package/lib/library/babel/index.d.ts +1 -1
- package/lib/library/babel/index.d.ts.map +1 -1
- package/lib/library/babel/index.js +3 -1
- package/lib/library/babel/index.js.map +1 -1
- package/lib/library/babel/plugins/fill-declare-action-name.d.ts +6 -0
- package/lib/library/babel/plugins/fill-declare-action-name.d.ts.map +1 -0
- package/lib/library/babel/plugins/fill-declare-action-name.js +95 -0
- package/lib/library/babel/plugins/fill-declare-action-name.js.map +1 -0
- package/lib/library/babel/plugins/types.h.d.ts +2 -2
- package/lib/library/babel/plugins/types.h.d.ts.map +1 -1
- package/lib/library/webpack/utils/transpiler.d.ts +1 -0
- package/lib/library/webpack/utils/transpiler.d.ts.map +1 -1
- package/lib/library/webpack/utils/transpiler.js +3 -3
- package/lib/library/webpack/utils/transpiler.js.map +1 -1
- package/lib/schema/autogeneratedSchema.json +30 -15
- package/lib/typings/configEntry/cli.d.ts +5 -0
- package/lib/typings/configEntry/cli.d.ts.map +1 -1
- package/lib/utils/dev-app/request.d.ts +2 -1
- package/lib/utils/dev-app/request.d.ts.map +1 -1
- package/lib/utils/dev-app/request.js +8 -4
- package/lib/utils/dev-app/request.js.map +1 -1
- package/package.json +3 -2
- package/schema.json +30 -15
- package/src/commands/static/application.ts +1 -1
- package/src/commands/static/command.ts +12 -0
- package/src/commands/static/generate.ts +13 -2
- package/src/commands/static/static.ts +2 -1
- package/src/library/babel/index.ts +3 -0
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/import-mixed.ts +17 -0
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/import-with-name.ts +28 -0
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/import-without-name.ts +25 -0
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/require-with-name.ts +21 -0
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/require-without-name.ts +19 -0
- package/src/library/babel/plugins/__snapshots__/fill-declare-action-name.spec.ts.snap +266 -0
- package/src/library/babel/plugins/fill-declare-action-name.spec.ts +37 -0
- package/src/library/babel/plugins/fill-declare-action-name.ts +110 -0
- package/src/library/babel/plugins/types.h.ts +2 -2
- package/src/library/webpack/utils/transpiler.ts +9 -1
- package/src/models/config.spec.ts +4 -0
- package/src/schema/autogeneratedSchema.json +30 -15
- package/src/schema/tramvai.spec.ts +2 -0
- package/src/typings/configEntry/cli.ts +5 -0
- package/src/utils/dev-app/request.ts +9 -4
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`fill-declare-action-name import: do nothing: import: do nothing 1`] = `
|
|
4
|
+
|
|
5
|
+
import { declareAction } from '@tramvai/core';
|
|
6
|
+
|
|
7
|
+
const action = declareAction({
|
|
8
|
+
name: 'action',
|
|
9
|
+
fn: () => {
|
|
10
|
+
console.log('action');
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const secondAction = declareAction({
|
|
15
|
+
name: 'secondAction',
|
|
16
|
+
fn: () => {
|
|
17
|
+
console.log('second action');
|
|
18
|
+
},
|
|
19
|
+
conditions: {
|
|
20
|
+
onlyBrowser: true,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default declareAction({
|
|
25
|
+
name: 'anonymousAction',
|
|
26
|
+
fn: () => {
|
|
27
|
+
console.log('anonymous action');
|
|
28
|
+
},
|
|
29
|
+
conditions: {
|
|
30
|
+
onlyBrowser: true,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
↓ ↓ ↓ ↓ ↓ ↓
|
|
35
|
+
|
|
36
|
+
import { declareAction } from '@tramvai/core';
|
|
37
|
+
var action = declareAction({
|
|
38
|
+
name: 'action',
|
|
39
|
+
fn: function fn() {
|
|
40
|
+
console.log('action');
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
var secondAction = declareAction({
|
|
44
|
+
name: 'secondAction',
|
|
45
|
+
fn: function fn() {
|
|
46
|
+
console.log('second action');
|
|
47
|
+
},
|
|
48
|
+
conditions: {
|
|
49
|
+
onlyBrowser: true,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
export default declareAction({
|
|
53
|
+
name: 'anonymousAction',
|
|
54
|
+
fn: function fn() {
|
|
55
|
+
console.log('anonymous action');
|
|
56
|
+
},
|
|
57
|
+
conditions: {
|
|
58
|
+
onlyBrowser: true,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
exports[`fill-declare-action-name import: fill absent name: import: fill absent name 1`] = `
|
|
66
|
+
|
|
67
|
+
import { declareAction } from '@tramvai/core';
|
|
68
|
+
|
|
69
|
+
const action = declareAction({
|
|
70
|
+
name: 'action',
|
|
71
|
+
fn: () => {
|
|
72
|
+
console.log('action');
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const secondAction = declareAction({
|
|
77
|
+
fn: () => {
|
|
78
|
+
console.log('second action');
|
|
79
|
+
},
|
|
80
|
+
conditions: {
|
|
81
|
+
onlyBrowser: true,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
↓ ↓ ↓ ↓ ↓ ↓
|
|
86
|
+
|
|
87
|
+
import { declareAction } from '@tramvai/core';
|
|
88
|
+
var action = declareAction({
|
|
89
|
+
name: 'action',
|
|
90
|
+
fn: function fn() {
|
|
91
|
+
console.log('action');
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
var secondAction = declareAction({
|
|
95
|
+
name: 'secondAction__-5f0ssw',
|
|
96
|
+
fn: function fn() {
|
|
97
|
+
console.log('second action');
|
|
98
|
+
},
|
|
99
|
+
conditions: {
|
|
100
|
+
onlyBrowser: true,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
`;
|
|
106
|
+
|
|
107
|
+
exports[`fill-declare-action-name import: fill all actions: import: fill all actions 1`] = `
|
|
108
|
+
|
|
109
|
+
import { declareAction } from '@tramvai/core';
|
|
110
|
+
|
|
111
|
+
const action = declareAction({
|
|
112
|
+
fn: () => {
|
|
113
|
+
console.log('action');
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const secondAction = declareAction({
|
|
118
|
+
fn: () => {
|
|
119
|
+
console.log('second action');
|
|
120
|
+
},
|
|
121
|
+
conditions: {
|
|
122
|
+
onlyBrowser: true,
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
export default declareAction({
|
|
127
|
+
fn: () => {
|
|
128
|
+
console.log('anonymous action');
|
|
129
|
+
},
|
|
130
|
+
conditions: {
|
|
131
|
+
onlyBrowser: true,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
↓ ↓ ↓ ↓ ↓ ↓
|
|
136
|
+
|
|
137
|
+
import { declareAction } from '@tramvai/core';
|
|
138
|
+
var action = declareAction({
|
|
139
|
+
name: 'action__n5c5ae',
|
|
140
|
+
fn: function fn() {
|
|
141
|
+
console.log('action');
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
var secondAction = declareAction({
|
|
145
|
+
name: 'secondAction__n5fz8b',
|
|
146
|
+
fn: function fn() {
|
|
147
|
+
console.log('second action');
|
|
148
|
+
},
|
|
149
|
+
conditions: {
|
|
150
|
+
onlyBrowser: true,
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
export default declareAction({
|
|
154
|
+
name: 'import-without-name.ts__797bng',
|
|
155
|
+
fn: function fn() {
|
|
156
|
+
console.log('anonymous action');
|
|
157
|
+
},
|
|
158
|
+
conditions: {
|
|
159
|
+
onlyBrowser: true,
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
`;
|
|
165
|
+
|
|
166
|
+
exports[`fill-declare-action-name require: do nothing: require: do nothing 1`] = `
|
|
167
|
+
|
|
168
|
+
// @ts-ignore
|
|
169
|
+
const { declareAction } = require('@tramvai/core');
|
|
170
|
+
|
|
171
|
+
// @ts-ignore
|
|
172
|
+
const action = declareAction({
|
|
173
|
+
name: 'action',
|
|
174
|
+
fn: () => {
|
|
175
|
+
console.log('action');
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// @ts-ignore
|
|
180
|
+
const secondAction = declareAction({
|
|
181
|
+
name: 'secondAction',
|
|
182
|
+
fn: () => {
|
|
183
|
+
console.log('second action');
|
|
184
|
+
},
|
|
185
|
+
conditions: {
|
|
186
|
+
onlyBrowser: true,
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
↓ ↓ ↓ ↓ ↓ ↓
|
|
191
|
+
|
|
192
|
+
// @ts-ignore
|
|
193
|
+
var _require = require('@tramvai/core'),
|
|
194
|
+
declareAction = _require.declareAction;
|
|
195
|
+
|
|
196
|
+
// @ts-ignore
|
|
197
|
+
var action = declareAction({
|
|
198
|
+
name: 'action',
|
|
199
|
+
fn: function fn() {
|
|
200
|
+
console.log('action');
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// @ts-ignore
|
|
205
|
+
var secondAction = declareAction({
|
|
206
|
+
name: 'secondAction',
|
|
207
|
+
fn: function fn() {
|
|
208
|
+
console.log('second action');
|
|
209
|
+
},
|
|
210
|
+
conditions: {
|
|
211
|
+
onlyBrowser: true,
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
`;
|
|
217
|
+
|
|
218
|
+
exports[`fill-declare-action-name require: fill all actions: require: fill all actions 1`] = `
|
|
219
|
+
|
|
220
|
+
// @ts-ignore
|
|
221
|
+
const { declareAction } = require('@tramvai/core');
|
|
222
|
+
|
|
223
|
+
// @ts-ignore
|
|
224
|
+
const action = declareAction({
|
|
225
|
+
fn: () => {
|
|
226
|
+
console.log('action');
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// @ts-ignore
|
|
231
|
+
const secondAction = declareAction({
|
|
232
|
+
fn: () => {
|
|
233
|
+
console.log('second action');
|
|
234
|
+
},
|
|
235
|
+
conditions: {
|
|
236
|
+
onlyBrowser: true,
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
↓ ↓ ↓ ↓ ↓ ↓
|
|
241
|
+
|
|
242
|
+
// @ts-ignore
|
|
243
|
+
var _require = require('@tramvai/core'),
|
|
244
|
+
declareAction = _require.declareAction;
|
|
245
|
+
|
|
246
|
+
// @ts-ignore
|
|
247
|
+
var action = declareAction({
|
|
248
|
+
name: 'action__l6frq0',
|
|
249
|
+
fn: function fn() {
|
|
250
|
+
console.log('action');
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// @ts-ignore
|
|
255
|
+
var secondAction = declareAction({
|
|
256
|
+
name: 'secondAction__h789zd',
|
|
257
|
+
fn: function fn() {
|
|
258
|
+
console.log('second action');
|
|
259
|
+
},
|
|
260
|
+
conditions: {
|
|
261
|
+
onlyBrowser: true,
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
`;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import pluginTester from 'babel-plugin-tester';
|
|
3
|
+
import babelConfig from '../index';
|
|
4
|
+
|
|
5
|
+
pluginTester({
|
|
6
|
+
plugin: {}, // плагин уже есть в основном конфиге, если подключить ещё тут то babel упадёт
|
|
7
|
+
pluginName: 'fill-declare-action-name',
|
|
8
|
+
filename: path.join(__dirname, '__fixtures__', 'fill-declare-action-name', 'test'),
|
|
9
|
+
babelOptions: babelConfig({
|
|
10
|
+
typescript: true,
|
|
11
|
+
generateDataQaTag: false,
|
|
12
|
+
loader: false,
|
|
13
|
+
enableFillDeclareActionNamePlugin: true,
|
|
14
|
+
}),
|
|
15
|
+
tests: {
|
|
16
|
+
'import: fill absent name': {
|
|
17
|
+
fixture: 'import-mixed.ts',
|
|
18
|
+
snapshot: true,
|
|
19
|
+
},
|
|
20
|
+
'import: do nothing': {
|
|
21
|
+
fixture: 'import-with-name.ts',
|
|
22
|
+
snapshot: true,
|
|
23
|
+
},
|
|
24
|
+
'import: fill all actions': {
|
|
25
|
+
fixture: 'import-without-name.ts',
|
|
26
|
+
snapshot: true,
|
|
27
|
+
},
|
|
28
|
+
'require: do nothing': {
|
|
29
|
+
fixture: 'require-with-name.ts',
|
|
30
|
+
snapshot: true,
|
|
31
|
+
},
|
|
32
|
+
'require: fill all actions': {
|
|
33
|
+
fixture: 'require-without-name.ts',
|
|
34
|
+
snapshot: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { Plugin } from './types.h';
|
|
2
|
+
|
|
3
|
+
function hashCode(s: string) {
|
|
4
|
+
let h = 0;
|
|
5
|
+
let i = 0;
|
|
6
|
+
// eslint-disable-next-line no-bitwise
|
|
7
|
+
if (s.length > 0) while (i < s.length) h = ((h << 5) - h + s.charCodeAt(i++)) | 0;
|
|
8
|
+
return h.toString(36);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const fillDeclareActionName: Plugin<{ declareActionName: string | null }> = (babel) => {
|
|
12
|
+
const { types: t } = babel;
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
pre() {
|
|
16
|
+
this.declareActionName = null;
|
|
17
|
+
},
|
|
18
|
+
visitor: {
|
|
19
|
+
Program: {
|
|
20
|
+
enter(enterPath) {
|
|
21
|
+
enterPath.traverse({
|
|
22
|
+
ImportDeclaration: (path) => {
|
|
23
|
+
if (this.declareActionName) return; // нет смысла идти дальше
|
|
24
|
+
if (path.node.source.value !== '@tramvai/core') return;
|
|
25
|
+
|
|
26
|
+
const specifier = path.node.specifiers.find(
|
|
27
|
+
(s) =>
|
|
28
|
+
t.isImportSpecifier(s) &&
|
|
29
|
+
'name' in s.imported &&
|
|
30
|
+
s.imported.name === 'declareAction'
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
if (specifier) {
|
|
34
|
+
this.declareActionName = specifier.local.name;
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
// тут смотрим на const {declareAction} = require('@tramvai/core')
|
|
38
|
+
VariableDeclarator: (path) => {
|
|
39
|
+
if (this.declareActionName) return; // нет смысла идти дальше
|
|
40
|
+
|
|
41
|
+
if (
|
|
42
|
+
!t.isCallExpression(path.node.init) ||
|
|
43
|
+
!t.isIdentifier(path.node.init.callee) ||
|
|
44
|
+
path.node.init.callee.name !== 'require'
|
|
45
|
+
) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const [argument] = path.node.init.arguments;
|
|
50
|
+
|
|
51
|
+
if (!argument || ('value' in argument && argument.value !== '@tramvai/core')) return;
|
|
52
|
+
if (!t.isObjectPattern(path.node.id)) return;
|
|
53
|
+
|
|
54
|
+
const declareActionNameProperty = path.node.id.properties.find(
|
|
55
|
+
(p) => 'key' in p && 'name' in p.key && p.key.name === 'declareAction'
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
if (
|
|
59
|
+
declareActionNameProperty &&
|
|
60
|
+
'value' in declareActionNameProperty &&
|
|
61
|
+
'name' in declareActionNameProperty.value
|
|
62
|
+
) {
|
|
63
|
+
this.declareActionName = declareActionNameProperty.value.name;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
CallExpression(path) {
|
|
70
|
+
if (!this.declareActionName) return;
|
|
71
|
+
if ('name' in path.node.callee && path.node.callee.name !== this.declareActionName) return;
|
|
72
|
+
|
|
73
|
+
const args = path.node.arguments;
|
|
74
|
+
|
|
75
|
+
if (args.length !== 1) return;
|
|
76
|
+
if (!t.isObjectExpression(args[0])) return;
|
|
77
|
+
|
|
78
|
+
const nameProperty = args[0].properties.find(
|
|
79
|
+
(p) => 'key' in p && 'name' in p.key && p.key.name === 'name'
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
if (nameProperty) return;
|
|
83
|
+
|
|
84
|
+
let additionalDebugName: string;
|
|
85
|
+
|
|
86
|
+
// @ts-expect-error easier to write this rather than adding if statements and type assertions
|
|
87
|
+
const potentialVariableName = path.parentPath.node.id?.name as string | undefined;
|
|
88
|
+
|
|
89
|
+
if (!potentialVariableName) {
|
|
90
|
+
additionalDebugName = this.file.opts.generatorOpts.sourceFileName ?? '';
|
|
91
|
+
} else {
|
|
92
|
+
additionalDebugName = potentialVariableName;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const filePath = this.file.opts.filename;
|
|
96
|
+
const cwd = this.file.opts.cwd ?? '';
|
|
97
|
+
const projectFilePath = filePath.replace(cwd, '');
|
|
98
|
+
const { line, column } = path.node.loc.start;
|
|
99
|
+
|
|
100
|
+
const sid = hashCode(`${projectFilePath}:${line}:${column}`);
|
|
101
|
+
|
|
102
|
+
const name = `${additionalDebugName}__${sid}`;
|
|
103
|
+
|
|
104
|
+
args[0].properties.unshift(t.objectProperty(t.identifier('name'), t.stringLiteral(name)));
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export default fillDeclareActionName;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { PluginObj, template, types } from '@babel/core';
|
|
1
|
+
import type { PluginObj, PluginPass, template, types } from '@babel/core';
|
|
2
2
|
|
|
3
3
|
export interface Babel {
|
|
4
4
|
types: typeof types;
|
|
5
5
|
template: typeof template;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export type Plugin<PluginOptions = void> = (babel: Babel) => PluginObj<PluginOptions>;
|
|
8
|
+
export type Plugin<PluginOptions = void> = (babel: Babel) => PluginObj<PluginPass & PluginOptions>;
|
|
@@ -14,6 +14,7 @@ export type TranspilerConfig = {
|
|
|
14
14
|
isServer: boolean;
|
|
15
15
|
generateDataQaTag: boolean;
|
|
16
16
|
enableFillActionNamePlugin: boolean;
|
|
17
|
+
enableFillDeclareActionNamePlugin: boolean;
|
|
17
18
|
typescript: boolean;
|
|
18
19
|
modules: 'es6' | 'commonjs' | false;
|
|
19
20
|
loader: boolean;
|
|
@@ -50,7 +51,13 @@ export const getTranspilerConfig = (
|
|
|
50
51
|
configManager: ConfigManager<CliConfigEntry>,
|
|
51
52
|
overrideOptions: Partial<TranspilerConfig> = {}
|
|
52
53
|
): TranspilerConfig => {
|
|
53
|
-
const {
|
|
54
|
+
const {
|
|
55
|
+
generateDataQaTag,
|
|
56
|
+
alias,
|
|
57
|
+
enableFillActionNamePlugin,
|
|
58
|
+
excludesPresetEnv,
|
|
59
|
+
experiments: { enableFillDeclareActionNamePlugin },
|
|
60
|
+
} = configManager;
|
|
54
61
|
const { env, modern } = configManager;
|
|
55
62
|
|
|
56
63
|
if (alias) {
|
|
@@ -74,5 +81,6 @@ Just check or add configuration to your tsconfig file and remove alias from tram
|
|
|
74
81
|
modules: false,
|
|
75
82
|
typescript: false,
|
|
76
83
|
...overrideOptions,
|
|
84
|
+
enableFillDeclareActionNamePlugin,
|
|
77
85
|
};
|
|
78
86
|
};
|
|
@@ -39,6 +39,7 @@ it('should populate defaults for config', () => {
|
|
|
39
39
|
"enableFillActionNamePlugin": false,
|
|
40
40
|
"experiments": {
|
|
41
41
|
"autoResolveSharedRequiredVersions": false,
|
|
42
|
+
"enableFillDeclareActionNamePlugin": false,
|
|
42
43
|
"minicss": {
|
|
43
44
|
"useImportModule": true,
|
|
44
45
|
},
|
|
@@ -140,6 +141,7 @@ it('should populate defaults for config', () => {
|
|
|
140
141
|
"enableFillActionNamePlugin": false,
|
|
141
142
|
"experiments": {
|
|
142
143
|
"autoResolveSharedRequiredVersions": false,
|
|
144
|
+
"enableFillDeclareActionNamePlugin": false,
|
|
143
145
|
"minicss": {
|
|
144
146
|
"useImportModule": true,
|
|
145
147
|
},
|
|
@@ -280,6 +282,7 @@ it('should populate defaults for overridable options', () => {
|
|
|
280
282
|
"enableFillActionNamePlugin": false,
|
|
281
283
|
"experiments": {
|
|
282
284
|
"autoResolveSharedRequiredVersions": false,
|
|
285
|
+
"enableFillDeclareActionNamePlugin": false,
|
|
283
286
|
"minicss": {
|
|
284
287
|
"useImportModule": true,
|
|
285
288
|
},
|
|
@@ -399,6 +402,7 @@ it('should populate defaults for overridable options', () => {
|
|
|
399
402
|
"enableFillActionNamePlugin": false,
|
|
400
403
|
"experiments": {
|
|
401
404
|
"autoResolveSharedRequiredVersions": false,
|
|
405
|
+
"enableFillDeclareActionNamePlugin": false,
|
|
402
406
|
"minicss": {
|
|
403
407
|
"useImportModule": true,
|
|
404
408
|
},
|
|
@@ -935,6 +935,11 @@
|
|
|
935
935
|
"title": "automatically resolve [requiredVersion](https://webpack.js.org/plugins/module-federation-plugin/#requiredversion) for shared dependencies",
|
|
936
936
|
"default": false,
|
|
937
937
|
"type": "boolean"
|
|
938
|
+
},
|
|
939
|
+
"enableFillDeclareActionNamePlugin": {
|
|
940
|
+
"title": "Включает использование плагина fill-declare-action-name",
|
|
941
|
+
"default": false,
|
|
942
|
+
"type": "boolean"
|
|
938
943
|
}
|
|
939
944
|
},
|
|
940
945
|
"additionalProperties": false
|
|
@@ -1183,23 +1188,23 @@
|
|
|
1183
1188
|
"dotAll": {
|
|
1184
1189
|
"type": "boolean"
|
|
1185
1190
|
},
|
|
1186
|
-
"__@match@
|
|
1191
|
+
"__@match@7211": {
|
|
1187
1192
|
"type": "object",
|
|
1188
1193
|
"additionalProperties": false
|
|
1189
1194
|
},
|
|
1190
|
-
"__@replace@
|
|
1195
|
+
"__@replace@7213": {
|
|
1191
1196
|
"type": "object",
|
|
1192
1197
|
"additionalProperties": false
|
|
1193
1198
|
},
|
|
1194
|
-
"__@search@
|
|
1199
|
+
"__@search@7216": {
|
|
1195
1200
|
"type": "object",
|
|
1196
1201
|
"additionalProperties": false
|
|
1197
1202
|
},
|
|
1198
|
-
"__@split@
|
|
1203
|
+
"__@split@7218": {
|
|
1199
1204
|
"type": "object",
|
|
1200
1205
|
"additionalProperties": false
|
|
1201
1206
|
},
|
|
1202
|
-
"__@matchAll@
|
|
1207
|
+
"__@matchAll@7220": {
|
|
1203
1208
|
"type": "object",
|
|
1204
1209
|
"additionalProperties": false
|
|
1205
1210
|
}
|
|
@@ -1705,6 +1710,11 @@
|
|
|
1705
1710
|
"title": "automatically resolve [requiredVersion](https://webpack.js.org/plugins/module-federation-plugin/#requiredversion) for shared dependencies",
|
|
1706
1711
|
"default": false,
|
|
1707
1712
|
"type": "boolean"
|
|
1713
|
+
},
|
|
1714
|
+
"enableFillDeclareActionNamePlugin": {
|
|
1715
|
+
"title": "Включает использование плагина fill-declare-action-name",
|
|
1716
|
+
"default": false,
|
|
1717
|
+
"type": "boolean"
|
|
1708
1718
|
}
|
|
1709
1719
|
},
|
|
1710
1720
|
"additionalProperties": false
|
|
@@ -1891,23 +1901,23 @@
|
|
|
1891
1901
|
"dotAll": {
|
|
1892
1902
|
"type": "boolean"
|
|
1893
1903
|
},
|
|
1894
|
-
"__@match@
|
|
1904
|
+
"__@match@7211": {
|
|
1895
1905
|
"type": "object",
|
|
1896
1906
|
"additionalProperties": false
|
|
1897
1907
|
},
|
|
1898
|
-
"__@replace@
|
|
1908
|
+
"__@replace@7213": {
|
|
1899
1909
|
"type": "object",
|
|
1900
1910
|
"additionalProperties": false
|
|
1901
1911
|
},
|
|
1902
|
-
"__@search@
|
|
1912
|
+
"__@search@7216": {
|
|
1903
1913
|
"type": "object",
|
|
1904
1914
|
"additionalProperties": false
|
|
1905
1915
|
},
|
|
1906
|
-
"__@split@
|
|
1916
|
+
"__@split@7218": {
|
|
1907
1917
|
"type": "object",
|
|
1908
1918
|
"additionalProperties": false
|
|
1909
1919
|
},
|
|
1910
|
-
"__@matchAll@
|
|
1920
|
+
"__@matchAll@7220": {
|
|
1911
1921
|
"type": "object",
|
|
1912
1922
|
"additionalProperties": false
|
|
1913
1923
|
}
|
|
@@ -2413,6 +2423,11 @@
|
|
|
2413
2423
|
"title": "automatically resolve [requiredVersion](https://webpack.js.org/plugins/module-federation-plugin/#requiredversion) for shared dependencies",
|
|
2414
2424
|
"default": false,
|
|
2415
2425
|
"type": "boolean"
|
|
2426
|
+
},
|
|
2427
|
+
"enableFillDeclareActionNamePlugin": {
|
|
2428
|
+
"title": "Включает использование плагина fill-declare-action-name",
|
|
2429
|
+
"default": false,
|
|
2430
|
+
"type": "boolean"
|
|
2416
2431
|
}
|
|
2417
2432
|
},
|
|
2418
2433
|
"additionalProperties": false
|
|
@@ -2599,23 +2614,23 @@
|
|
|
2599
2614
|
"dotAll": {
|
|
2600
2615
|
"type": "boolean"
|
|
2601
2616
|
},
|
|
2602
|
-
"__@match@
|
|
2617
|
+
"__@match@7211": {
|
|
2603
2618
|
"type": "object",
|
|
2604
2619
|
"additionalProperties": false
|
|
2605
2620
|
},
|
|
2606
|
-
"__@replace@
|
|
2621
|
+
"__@replace@7213": {
|
|
2607
2622
|
"type": "object",
|
|
2608
2623
|
"additionalProperties": false
|
|
2609
2624
|
},
|
|
2610
|
-
"__@search@
|
|
2625
|
+
"__@search@7216": {
|
|
2611
2626
|
"type": "object",
|
|
2612
2627
|
"additionalProperties": false
|
|
2613
2628
|
},
|
|
2614
|
-
"__@split@
|
|
2629
|
+
"__@split@7218": {
|
|
2615
2630
|
"type": "object",
|
|
2616
2631
|
"additionalProperties": false
|
|
2617
2632
|
},
|
|
2618
|
-
"__@matchAll@
|
|
2633
|
+
"__@matchAll@7220": {
|
|
2619
2634
|
"type": "object",
|
|
2620
2635
|
"additionalProperties": false
|
|
2621
2636
|
}
|
|
@@ -68,6 +68,7 @@ describe('JSON schema для tramvai.json', () => {
|
|
|
68
68
|
"enableFillActionNamePlugin": false,
|
|
69
69
|
"experiments": {
|
|
70
70
|
"autoResolveSharedRequiredVersions": false,
|
|
71
|
+
"enableFillDeclareActionNamePlugin": false,
|
|
71
72
|
"minicss": {
|
|
72
73
|
"useImportModule": true,
|
|
73
74
|
},
|
|
@@ -169,6 +170,7 @@ describe('JSON schema для tramvai.json', () => {
|
|
|
169
170
|
"enableFillActionNamePlugin": false,
|
|
170
171
|
"experiments": {
|
|
171
172
|
"autoResolveSharedRequiredVersions": false,
|
|
173
|
+
"enableFillDeclareActionNamePlugin": false,
|
|
172
174
|
"minicss": {
|
|
173
175
|
"useImportModule": true,
|
|
174
176
|
},
|
|
@@ -80,6 +80,11 @@ export interface Experiments {
|
|
|
80
80
|
* @default false
|
|
81
81
|
*/
|
|
82
82
|
autoResolveSharedRequiredVersions: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* @title Включает использование плагина fill-declare-action-name
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
enableFillDeclareActionNamePlugin: boolean;
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
/**
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import propOr from '@tinkoff/utils/object/propOr';
|
|
2
|
+
import type { Request } from '@tinkoff/request-core';
|
|
2
3
|
import createRequest from '@tinkoff/request-core';
|
|
3
4
|
import http from '@tinkoff/request-plugin-protocol-http';
|
|
5
|
+
import retry from '@tinkoff/request-plugin-retry';
|
|
4
6
|
import type { ConfigManager } from '../../config/configManager';
|
|
5
7
|
|
|
6
|
-
const request = createRequest([http()]);
|
|
8
|
+
const request = createRequest([retry(), http()]);
|
|
7
9
|
|
|
8
|
-
export const appRequest = <T>(configManager: ConfigManager, path: string) => {
|
|
10
|
+
export const appRequest = <T>(configManager: ConfigManager, path: string, options?: Request) => {
|
|
9
11
|
const { host, port } = configManager;
|
|
10
12
|
const serverPath = `http://${host}:${port}`;
|
|
11
13
|
|
|
12
|
-
return request<T>({ url: `${serverPath}${path}
|
|
14
|
+
return request<T>({ url: `${serverPath}${path}`, ...options });
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
interface BundleInfoResponse {
|
|
@@ -20,7 +22,10 @@ interface BundleInfoResponse {
|
|
|
20
22
|
export const appBundleInfo = async (configManager: ConfigManager) => {
|
|
21
23
|
const { name } = configManager;
|
|
22
24
|
|
|
23
|
-
const response = await appRequest<BundleInfoResponse>(configManager, `/${name}/papi/bundleInfo
|
|
25
|
+
const response = await appRequest<BundleInfoResponse>(configManager, `/${name}/papi/bundleInfo`, {
|
|
26
|
+
timeout: 5000,
|
|
27
|
+
retry: 3,
|
|
28
|
+
});
|
|
24
29
|
|
|
25
30
|
return propOr('payload', [], response);
|
|
26
31
|
};
|