@cloudbase/framework-plugin-low-code 1.0.3-beta.1 → 1.0.3-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +6 -3
- package/lib/utils/dataSource.d.ts +0 -23
- package/lib/utils/dataSource.d.ts.map +1 -1
- package/lib/utils/dataSource.js +0 -155
- package/lib/utils/index.js +5 -1
- package/lib/utils/postProcess.js +5 -1
- package/package.json +11 -32
- package/scripts/build-plugin-tar.sh +31 -0
- package/scripts/generateTemplate.js +31 -0
- package/scripts/link-packages.js +11 -0
- package/scripts/link.js +91 -0
- package/scripts/postinstall.js +47 -0
- package/scripts/preinstall.js +16 -0
- package/template/src/handlers/utils/common.js +1 -0
- package/template/html/index.html.ejs +0 -456
- package/template/package.json +0 -63
- package/template/webpack/devServer.js +0 -119
- package/template/webpack/getCSSModuleLocalIdent.js +0 -28
- package/template/webpack/web.prod.js +0 -306
|
@@ -1,456 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="zh-cn">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=9" />
|
|
6
|
-
<meta name="renderer" content="webkit|ie-stand" />
|
|
7
|
-
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,viewport-fit=cover" />
|
|
8
|
-
<meta name="format-detection" content="telephone=no" />
|
|
9
|
-
<meta name="description" content="<%= meta.desc %>" />
|
|
10
|
-
<script crossorigin="anonymous" src="https://cdn-go.cn/aegis/aegis-sdk/latest/aegis.min.js?v=1"></script>
|
|
11
|
-
<script>
|
|
12
|
-
<% if(!isAdminPortal){ %>
|
|
13
|
-
const _aegis = new Aegis({
|
|
14
|
-
id: 'lXHFsBpTjIzNADiczY', // 项目ID,即上报key
|
|
15
|
-
reportApiSpeed: true, // 接口测速
|
|
16
|
-
reportAssetSpeed: true, // 静态资源测速
|
|
17
|
-
spa: true,
|
|
18
|
-
ext1: '<%=appId%>',
|
|
19
|
-
});
|
|
20
|
-
<% } else {%>
|
|
21
|
-
const _aegis = new Aegis({
|
|
22
|
-
id: 'lXHFsBpTrKcnOMqTRQ', // 项目ID,即上报key
|
|
23
|
-
reportApiSpeed: false, // 接口测速
|
|
24
|
-
reportAssetSpeed: false, // 静态资源测速
|
|
25
|
-
spa: true,
|
|
26
|
-
ext1: '<%=appId%>',
|
|
27
|
-
});
|
|
28
|
-
<% }%>
|
|
29
|
-
window._aegis = _aegis;
|
|
30
|
-
window._aegis_inited = Date.now()
|
|
31
|
-
</script>
|
|
32
|
-
<title><%= meta.title %></title>
|
|
33
|
-
<% if(delevopment){ %>
|
|
34
|
-
<!-- <script src="https://cdn.jsdelivr.net/npm/eruda"></script>
|
|
35
|
-
<script>
|
|
36
|
-
eruda.init();
|
|
37
|
-
</script> -->
|
|
38
|
-
<% }%> <% Array.isArray(meta.jsApis) && meta.jsApis.filter(function(item){return !!item}).forEach(function(jsApi){%>
|
|
39
|
-
<script src="<%=jsApi %>"></script>
|
|
40
|
-
<% })%>
|
|
41
|
-
|
|
42
|
-
<!-- 重置浏览器样式 -->
|
|
43
|
-
<style type="text/css">
|
|
44
|
-
.clearfix::before,
|
|
45
|
-
.clearfix::after {
|
|
46
|
-
content: '';
|
|
47
|
-
display: table;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.clearfix::after {
|
|
51
|
-
clear: both;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
html {
|
|
55
|
-
-ms-text-size-adjust: 100%;
|
|
56
|
-
-webkit-text-size-adjust: 100%;
|
|
57
|
-
-webkit-tap-highlight-color: transparent;
|
|
58
|
-
height: 100%;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
body {
|
|
62
|
-
margin: 0;
|
|
63
|
-
font-size: 14px;
|
|
64
|
-
font-family: 'Helvetica Neue', Helvetica, 'Microsoft Yahei', STHeiTi, Arial, sans-serif;
|
|
65
|
-
line-height: 1.5;
|
|
66
|
-
color: #333;
|
|
67
|
-
background-color: #fff;
|
|
68
|
-
min-height: 100%;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
body > #react-body {
|
|
72
|
-
height: 100%;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.weapps-page {
|
|
76
|
-
min-height: 100%;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
article,
|
|
80
|
-
aside,
|
|
81
|
-
details,
|
|
82
|
-
figcaption,
|
|
83
|
-
figure,
|
|
84
|
-
footer,
|
|
85
|
-
header,
|
|
86
|
-
hgroup,
|
|
87
|
-
main,
|
|
88
|
-
menu,
|
|
89
|
-
nav,
|
|
90
|
-
section,
|
|
91
|
-
summary {
|
|
92
|
-
display: block;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
audio,
|
|
96
|
-
canvas,
|
|
97
|
-
progress,
|
|
98
|
-
video {
|
|
99
|
-
display: inline-block;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
audio:not([controls]) {
|
|
103
|
-
display: none;
|
|
104
|
-
height: 0;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
progress {
|
|
108
|
-
vertical-align: baseline;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
[hidden],
|
|
112
|
-
template {
|
|
113
|
-
display: none;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
a {
|
|
117
|
-
background: transparent;
|
|
118
|
-
text-decoration: none;
|
|
119
|
-
color: #08c;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
a:active {
|
|
123
|
-
outline: 0;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
abbr[title] {
|
|
127
|
-
border-bottom: 1px dotted;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
b,
|
|
131
|
-
strong {
|
|
132
|
-
font-weight: bold;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
dfn {
|
|
136
|
-
font-style: italic;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
mark {
|
|
140
|
-
background: #ff0;
|
|
141
|
-
color: #000;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
small {
|
|
145
|
-
font-size: 80%;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
sub,
|
|
149
|
-
sup {
|
|
150
|
-
font-size: 75%;
|
|
151
|
-
line-height: 0;
|
|
152
|
-
position: relative;
|
|
153
|
-
vertical-align: baseline;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
sup {
|
|
157
|
-
top: -0.5em;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
sub {
|
|
161
|
-
bottom: -0.25em;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
img {
|
|
165
|
-
border: 0;
|
|
166
|
-
vertical-align: middle;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
svg:not(:root) {
|
|
170
|
-
overflow: hidden;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
pre {
|
|
174
|
-
overflow: auto;
|
|
175
|
-
white-space: pre;
|
|
176
|
-
white-space: pre-wrap;
|
|
177
|
-
word-wrap: break-word;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
code,
|
|
181
|
-
kbd,
|
|
182
|
-
pre,
|
|
183
|
-
samp {
|
|
184
|
-
font-family: monospace, monospace;
|
|
185
|
-
font-size: 1em;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
button,
|
|
189
|
-
input,
|
|
190
|
-
optgroup,
|
|
191
|
-
select,
|
|
192
|
-
textarea {
|
|
193
|
-
color: inherit;
|
|
194
|
-
font: inherit;
|
|
195
|
-
margin: 0;
|
|
196
|
-
vertical-align: middle;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
button,
|
|
200
|
-
input,
|
|
201
|
-
select {
|
|
202
|
-
overflow: visible;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
button,
|
|
206
|
-
select {
|
|
207
|
-
text-transform: none;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
button,
|
|
211
|
-
html input[type='button'],
|
|
212
|
-
input[type='reset'],
|
|
213
|
-
input[type='submit'] {
|
|
214
|
-
-webkit-appearance: button;
|
|
215
|
-
cursor: pointer;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
[disabled] {
|
|
219
|
-
cursor: default;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
button::-moz-focus-inner,
|
|
223
|
-
input::-moz-focus-inner {
|
|
224
|
-
border: 0;
|
|
225
|
-
padding: 0;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
input {
|
|
229
|
-
line-height: normal;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
input[type='checkbox'],
|
|
233
|
-
input[type='radio'] {
|
|
234
|
-
box-sizing: border-box;
|
|
235
|
-
padding: 0;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
input[type='number']::-webkit-inner-spin-button,
|
|
239
|
-
input[type='number']::-webkit-outer-spin-button {
|
|
240
|
-
height: auto;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
input[type='search'] {
|
|
244
|
-
-webkit-appearance: textfield;
|
|
245
|
-
box-sizing: border-box;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
input[type='search']::-webkit-search-cancel-button,
|
|
249
|
-
input[type='search']::-webkit-search-decoration {
|
|
250
|
-
-webkit-appearance: none;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
fieldset {
|
|
254
|
-
border: 1px solid #c0c0c0;
|
|
255
|
-
margin: 0 2px;
|
|
256
|
-
padding: 0.35em 0.625em 0.75em;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
legend {
|
|
260
|
-
border: 0;
|
|
261
|
-
padding: 0;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
textarea {
|
|
265
|
-
overflow: auto;
|
|
266
|
-
resize: vertical;
|
|
267
|
-
vertical-align: top;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
optgroup {
|
|
271
|
-
font-weight: bold;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
input,
|
|
275
|
-
select,
|
|
276
|
-
textarea {
|
|
277
|
-
outline: 0;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
textarea,
|
|
281
|
-
input {
|
|
282
|
-
-webkit-user-modify: read-write-plaintext-only;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
input::-ms-clear,
|
|
286
|
-
input::-ms-reveal {
|
|
287
|
-
display: none;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
input::-moz-placeholder,
|
|
291
|
-
textarea::-moz-placeholder {
|
|
292
|
-
color: #999;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
input:-ms-input-placeholder,
|
|
296
|
-
textarea:-ms-input-placeholder {
|
|
297
|
-
color: #999;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
input::-webkit-input-placeholder,
|
|
301
|
-
textarea::-webkit-input-placeholder {
|
|
302
|
-
color: #999;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
.placeholder {
|
|
306
|
-
color: #999;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
table {
|
|
310
|
-
border-collapse: collapse;
|
|
311
|
-
border-spacing: 0;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
td,
|
|
315
|
-
th {
|
|
316
|
-
padding: 0;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
h1,
|
|
320
|
-
h2,
|
|
321
|
-
h3,
|
|
322
|
-
h4,
|
|
323
|
-
h5,
|
|
324
|
-
h6,
|
|
325
|
-
p,
|
|
326
|
-
figure,
|
|
327
|
-
form,
|
|
328
|
-
blockquote {
|
|
329
|
-
margin: 0;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
ul,
|
|
333
|
-
ol,
|
|
334
|
-
li,
|
|
335
|
-
dl,
|
|
336
|
-
dd {
|
|
337
|
-
margin: 0;
|
|
338
|
-
padding: 0;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
ul,
|
|
342
|
-
ol {
|
|
343
|
-
list-style: none outside none;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
h1,
|
|
347
|
-
h2,
|
|
348
|
-
h3 {
|
|
349
|
-
line-height: 2;
|
|
350
|
-
font-weight: normal;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
h1 {
|
|
354
|
-
font-size: 18px;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
h2 {
|
|
358
|
-
font-size: 16px;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
h3 {
|
|
362
|
-
font-size: 14px;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
i {
|
|
366
|
-
font-style: normal;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
* {
|
|
370
|
-
box-sizing: border-box;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
.hide {
|
|
374
|
-
display: none;
|
|
375
|
-
}
|
|
376
|
-
</style>
|
|
377
|
-
</head>
|
|
378
|
-
|
|
379
|
-
<body data-weui-theme="light">
|
|
380
|
-
<div id="react-body" class="main-wrap"></div>
|
|
381
|
-
<% if(!isAdminPortal){ %>
|
|
382
|
-
<script src="/weda-config/weda-private.js"></script>
|
|
383
|
-
<script src="//static.cloudbase.net/cloudbase-js-sdk/2.4.0-alpha.0/cloudbase.full.js?v=1"></script>
|
|
384
|
-
<% }%>
|
|
385
|
-
<script>
|
|
386
|
-
if (window.cloudbase) {
|
|
387
|
-
const _callFunction = window.cloudbase.__proto__.callFunction;
|
|
388
|
-
window.cloudbase.__proto__.callFunction = function (args) {
|
|
389
|
-
let promise = _callFunction.call(window.cloudbase, ...arguments);
|
|
390
|
-
if (promise instanceof Promise) {
|
|
391
|
-
return promise
|
|
392
|
-
.then(function (res) {
|
|
393
|
-
const { name, data = {} } = args || {};
|
|
394
|
-
try {
|
|
395
|
-
if (res.result && res.result.code) {
|
|
396
|
-
_aegis.report({
|
|
397
|
-
msg: '[' + name + ':' + data.methodName + ']: ' + (res.result.message || '函数调用失败'),
|
|
398
|
-
level: '16',
|
|
399
|
-
ext2: res.result.code,
|
|
400
|
-
ext3: res.requestId,
|
|
401
|
-
trace: 'trace',
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
} catch (e) {}
|
|
405
|
-
return res;
|
|
406
|
-
})
|
|
407
|
-
.catch(function (e) {
|
|
408
|
-
try {
|
|
409
|
-
_aegis.report({
|
|
410
|
-
msg: '[' + name + ':' + data.methodName + ']: ' + (e.message || '函数调用失败'),
|
|
411
|
-
level: '16',
|
|
412
|
-
ext2: e.code,
|
|
413
|
-
ext3: e.requestId,
|
|
414
|
-
trace: 'trace',
|
|
415
|
-
});
|
|
416
|
-
} catch (e) {}
|
|
417
|
-
throw e;
|
|
418
|
-
});
|
|
419
|
-
} else {
|
|
420
|
-
return promise;
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
</script>
|
|
425
|
-
<script
|
|
426
|
-
crossorigin
|
|
427
|
-
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/react@16.14.0/umd/react.production.min.js"
|
|
428
|
-
></script>
|
|
429
|
-
<script
|
|
430
|
-
crossorigin
|
|
431
|
-
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/react-dom@16.14.0/umd/react-dom.production.min.js"
|
|
432
|
-
></script>
|
|
433
|
-
<script
|
|
434
|
-
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/ajax/libs/mobx/5.15.7/mobx.umd.js"
|
|
435
|
-
crossorigin="anonymous"
|
|
436
|
-
></script>
|
|
437
|
-
<script
|
|
438
|
-
crossorigin="anonymous"
|
|
439
|
-
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.12/dist/h5.browser.js"
|
|
440
|
-
></script>
|
|
441
|
-
<script>
|
|
442
|
-
// zxing polifill
|
|
443
|
-
if (!this.globalThis) {
|
|
444
|
-
this.globalThis = this;
|
|
445
|
-
}
|
|
446
|
-
</script>
|
|
447
|
-
<script
|
|
448
|
-
crossorigin="anonymous"
|
|
449
|
-
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/npm/@zxing/library@0.18.6/umd/index.min.js"
|
|
450
|
-
></script>
|
|
451
|
-
<script
|
|
452
|
-
crossorigin="anonymous"
|
|
453
|
-
src="https://qbase.cdn-go.cn//lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-client@0.2.15/dist/web.browser.js"
|
|
454
|
-
></script>
|
|
455
|
-
</body>
|
|
456
|
-
</html>
|
package/template/package.json
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "lcap-<%= appId%>",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"scripts": {
|
|
5
|
-
"build-web": "webpack --config ./webpack/webpack.web.prod.js"
|
|
6
|
-
},
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"@cloudbase/js-sdk": "2.4.0-alpha.0",
|
|
9
|
-
"@cloudbase/weda-client": "0.2.12",
|
|
10
|
-
"@tcwd/weapps-core": "2.2.6",
|
|
11
|
-
"@tcwd/weapps-sdk": "1.2.10",
|
|
12
|
-
"@zxing/library": "^0.18.6",
|
|
13
|
-
"lodash": "^4.17.19",
|
|
14
|
-
"mobx": "^5.15.4",
|
|
15
|
-
"mobx-react-lite": "^2.0.7",
|
|
16
|
-
"path-to-regexp": "^1.7.0",
|
|
17
|
-
"react": "^16.12.0",
|
|
18
|
-
"react-dom": "^16.8.6",
|
|
19
|
-
"react-router-dom": "^5.1.2",
|
|
20
|
-
"regenerator-runtime": "^0.13.5"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@types/react": "^16.9.49",
|
|
24
|
-
"autoprefixer": "^9.5.1",
|
|
25
|
-
"babel-loader": "^8.1.0",
|
|
26
|
-
"@babel/core": "^7.11.6",
|
|
27
|
-
"@babel/polyfill": "^7.7.0",
|
|
28
|
-
"@babel/preset-env": "^7.4.4",
|
|
29
|
-
"@babel/preset-react": "^7.0.0",
|
|
30
|
-
"@babel/plugin-proposal-decorators": "^7.4.4",
|
|
31
|
-
"@babel/plugin-proposal-export-default-from": "^7.5.2",
|
|
32
|
-
"@babel/plugin-proposal-export-namespace-from": "^7.5.2",
|
|
33
|
-
"@babel/plugin-proposal-partial-application": "^7.4.4",
|
|
34
|
-
"@babel/plugin-proposal-pipeline-operator": "^7.5.0",
|
|
35
|
-
"@babel/plugin-transform-modules-commonjs": "^7.10.4",
|
|
36
|
-
"babel-plugin-import": "^1.13.0",
|
|
37
|
-
"base64-inline-loader": "^1.1.1",
|
|
38
|
-
"copy-webpack-plugin": "^6.2.1",
|
|
39
|
-
"css-loader": "^5",
|
|
40
|
-
"happypack": "^5.0.1",
|
|
41
|
-
"dart-sass": "^1.24.0",
|
|
42
|
-
"postcss": "^8.3.6",
|
|
43
|
-
"postcss-pxtorem": "^6.0.0",
|
|
44
|
-
"postcss-loader": "^4.0.3",
|
|
45
|
-
"postcss-css-variables": "^0.16.0",
|
|
46
|
-
"qiankun": "^2.7.0",
|
|
47
|
-
"less": "^4.0.0",
|
|
48
|
-
"less-loader": "^7.0.1",
|
|
49
|
-
"loader-utils": "^3.2.0",
|
|
50
|
-
"sass-loader": "^8.0.0",
|
|
51
|
-
"terser-webpack-plugin": "^3.0.2",
|
|
52
|
-
"mini-css-extract-plugin": "^0.8.0",
|
|
53
|
-
"hard-source-webpack-plugin": "^0.13.1",
|
|
54
|
-
"html-webpack-plugin": "^3.2.0",
|
|
55
|
-
"ts-loader": "^8.3.0",
|
|
56
|
-
"typescript": "^4.4.4",
|
|
57
|
-
"vue-loader": "14",
|
|
58
|
-
"vue-template-compiler": "^2.6.14",
|
|
59
|
-
"webpack": "^4.41.4",
|
|
60
|
-
"webpack-cli": "^4.2.0",
|
|
61
|
-
"webpack-dev-server": "^3.11.0"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
const webpackDevServer = require('webpack-dev-server')
|
|
2
|
-
const webpack = require('webpack')
|
|
3
|
-
const os = require('os')
|
|
4
|
-
const fs = require('fs')
|
|
5
|
-
const path = require('path')
|
|
6
|
-
const argv = require('yargs').argv
|
|
7
|
-
const config = require('./webpack.web.prod')
|
|
8
|
-
const { appConfig } = require('../mainAppData.json')
|
|
9
|
-
const { window = {} } = appConfig
|
|
10
|
-
const isApp = <%=isApp %>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function getDevServerConf() {
|
|
14
|
-
if (!argv.devServerConf) {
|
|
15
|
-
return {}
|
|
16
|
-
}
|
|
17
|
-
if (!argv.devServerConf.endsWith('.js')) {
|
|
18
|
-
console.error('参数请输入 --devServerConf config.js')
|
|
19
|
-
} else {
|
|
20
|
-
const devServerConfPath = path.resolve(process.cwd(), argv.devServerConf || '')
|
|
21
|
-
if (!fs.existsSync(devServerConfPath)) {
|
|
22
|
-
console.error(devServerConfPath, 'does not exists')
|
|
23
|
-
return {}
|
|
24
|
-
}
|
|
25
|
-
let conf = require(devServerConfPath)
|
|
26
|
-
if (!conf || typeof conf !== 'object') {
|
|
27
|
-
console.error(devServerConfPath, 'must have module.exports={}')
|
|
28
|
-
} else {
|
|
29
|
-
return conf
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return {}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// const openBrowser = require('open');
|
|
36
|
-
function getIPAdress() {
|
|
37
|
-
const interfaces = os.networkInterfaces()
|
|
38
|
-
for (const devName in interfaces) {
|
|
39
|
-
const iface = interfaces[devName]
|
|
40
|
-
for (let i = 0; i < iface.length; i++) {
|
|
41
|
-
const alias = iface[i]
|
|
42
|
-
if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
|
|
43
|
-
return alias.address
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const port = 8001
|
|
50
|
-
const ip = getIPAdress()
|
|
51
|
-
let basename = ''
|
|
52
|
-
let publicPath = ''
|
|
53
|
-
if (!isApp) {
|
|
54
|
-
basename = window.basename || ''
|
|
55
|
-
if (basename.startsWith('/')) {
|
|
56
|
-
basename = basename.replace('/', '')
|
|
57
|
-
}
|
|
58
|
-
publicPath = window.publicPath || ''
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
console.log('>>>>>>>>>>>>>>>>>>>>> basename is ', basename)
|
|
62
|
-
console.log('>>>>>>>>>>>>>>>>>>>>> publicPath is:', publicPath)
|
|
63
|
-
const options = {
|
|
64
|
-
hot: true,
|
|
65
|
-
host: ip,
|
|
66
|
-
hotOnly: true,
|
|
67
|
-
historyApiFallback: {
|
|
68
|
-
verbose: true,
|
|
69
|
-
rewrites: [
|
|
70
|
-
{
|
|
71
|
-
from: /^\/(.*)\.(css|js)$/,
|
|
72
|
-
to: function(context) {
|
|
73
|
-
// /^\/([^\.]*)\.(css|js)$/
|
|
74
|
-
console.log('>>>>>>>>>>>>>>>>> got in css|js!', context.parsedUrl.pathname)
|
|
75
|
-
const { assets = [] } = window
|
|
76
|
-
const isInAssets = assets.includes(context.parsedUrl.pathname)
|
|
77
|
-
return context.parsedUrl.pathname.replace(publicPath, '/')
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
from: new RegExp(`${basename}\/?(.*)$`),
|
|
82
|
-
to: function(context) {
|
|
83
|
-
console.log('>>>>>>>>>>>>>>>>> got in html!')
|
|
84
|
-
return 'index.html'
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
},
|
|
89
|
-
contentBase: [path.join(__dirname, 'assets')],
|
|
90
|
-
watchOptions: {
|
|
91
|
-
poll: 600,
|
|
92
|
-
ignored: /node_modules|preview|dist|html|webpack|gsd-kbone-react/,
|
|
93
|
-
},
|
|
94
|
-
open: {
|
|
95
|
-
app: ['Google Chrome', '--incognito', '--other-flag'],
|
|
96
|
-
},
|
|
97
|
-
openPage: basename,
|
|
98
|
-
disableHostCheck: true,
|
|
99
|
-
compress: true
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function startDevServer(conf) {
|
|
103
|
-
console.log('start startDevServer in webpack, env:', process.env.NODE_PATH)
|
|
104
|
-
let _options = Object.assign(options, conf)
|
|
105
|
-
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
|
|
106
|
-
console.log('Current webpack-dev-server config is: ')
|
|
107
|
-
console.log(_options)
|
|
108
|
-
console.log('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
|
|
109
|
-
webpackDevServer.addDevServerEntrypoints(config, _options)
|
|
110
|
-
|
|
111
|
-
const compiler = webpack(config)
|
|
112
|
-
const server = new webpackDevServer(compiler, _options)
|
|
113
|
-
|
|
114
|
-
server.listen(port, '0.0.0.0', () => {
|
|
115
|
-
console.log(`调试环境端口启动在 http://${ip}:${port}/${basename}`)
|
|
116
|
-
})
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
startDevServer(getDevServerConf())
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// Stolen from https://github.com/facebook/create-react-app/blob/cee26589ff919e946030a5651a93ccba78a93293/packages/react-dev-utils/getCSSModuleLocalIdent.js
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
'use strict';
|
|
10
|
-
|
|
11
|
-
const loaderUtils = require('loader-utils');
|
|
12
|
-
const path = require('path');
|
|
13
|
-
|
|
14
|
-
module.exports = function getLocalIdent(context, localIdentName, localName, options) {
|
|
15
|
-
// Use the filename or folder name, based on some uses the index.js / index.module.(css|scss|sass) project style
|
|
16
|
-
const fileNameOrFolder = context.resourcePath.match(/index\.module\.(css|scss|sass)$/) ? '[folder]' : '[name]';
|
|
17
|
-
// Create a hash based on a the file location and class name. Will be unique across a project, and close to globally unique.
|
|
18
|
-
const hash = loaderUtils.getHashDigest(
|
|
19
|
-
path.posix.relative(context.rootContext, context.resourcePath) + localName,
|
|
20
|
-
'md5',
|
|
21
|
-
'base64',
|
|
22
|
-
5,
|
|
23
|
-
);
|
|
24
|
-
// Use loaderUtils to find the file or folder name
|
|
25
|
-
const className = loaderUtils.interpolateName(context, fileNameOrFolder + '_' + localName + '__' + hash, options);
|
|
26
|
-
// Remove the .module that appears in every classname when based on the file and replace all "." with "_".
|
|
27
|
-
return className.replace('.module_', '_').replace(/\./g, '_');
|
|
28
|
-
};
|