@cocojs/cli 0.0.1-alpha.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/LICENSE +21 -0
- package/bin/coco.js +5 -0
- package/dist/build-dot-coco-process/index.js +788 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +535 -0
- package/dist/webpack-process/index.js +563 -0
- package/package.json +54 -0
- package/runtime-config/tsconfig.json +17 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var child_process = require('child_process');
|
|
4
|
+
var path = require('path');
|
|
5
|
+
var process$1 = require('node:process');
|
|
6
|
+
var path$1 = require('node:path');
|
|
7
|
+
var rollup = require('rollup');
|
|
8
|
+
var typescript = require('@rollup/plugin-typescript');
|
|
9
|
+
var babel = require('@rollup/plugin-babel');
|
|
10
|
+
var cocojs = require('@cocojs/rollup-plugin-mvc');
|
|
11
|
+
|
|
12
|
+
function _arrayLikeToArray(r, a) {
|
|
13
|
+
(null == a || a > r.length) && (a = r.length);
|
|
14
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
15
|
+
return n;
|
|
16
|
+
}
|
|
17
|
+
function _arrayWithHoles(r) {
|
|
18
|
+
if (Array.isArray(r)) return r;
|
|
19
|
+
}
|
|
20
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
21
|
+
try {
|
|
22
|
+
var i = n[a](c),
|
|
23
|
+
u = i.value;
|
|
24
|
+
} catch (n) {
|
|
25
|
+
return void e(n);
|
|
26
|
+
}
|
|
27
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
28
|
+
}
|
|
29
|
+
function _asyncToGenerator(n) {
|
|
30
|
+
return function () {
|
|
31
|
+
var t = this,
|
|
32
|
+
e = arguments;
|
|
33
|
+
return new Promise(function (r, o) {
|
|
34
|
+
var a = n.apply(t, e);
|
|
35
|
+
function _next(n) {
|
|
36
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
37
|
+
}
|
|
38
|
+
function _throw(n) {
|
|
39
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
40
|
+
}
|
|
41
|
+
_next(void 0);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function _classCallCheck(a, n) {
|
|
46
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
47
|
+
}
|
|
48
|
+
function _defineProperties(e, r) {
|
|
49
|
+
for (var t = 0; t < r.length; t++) {
|
|
50
|
+
var o = r[t];
|
|
51
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function _createClass(e, r, t) {
|
|
55
|
+
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
|
|
56
|
+
writable: false
|
|
57
|
+
}), e;
|
|
58
|
+
}
|
|
59
|
+
function _defineProperty(e, r, t) {
|
|
60
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
61
|
+
value: t,
|
|
62
|
+
enumerable: true,
|
|
63
|
+
configurable: true,
|
|
64
|
+
writable: true
|
|
65
|
+
}) : e[r] = t, e;
|
|
66
|
+
}
|
|
67
|
+
function _iterableToArrayLimit(r, l) {
|
|
68
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
69
|
+
if (null != t) {
|
|
70
|
+
var e,
|
|
71
|
+
n,
|
|
72
|
+
i,
|
|
73
|
+
u,
|
|
74
|
+
a = [],
|
|
75
|
+
f = true,
|
|
76
|
+
o = false;
|
|
77
|
+
try {
|
|
78
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
79
|
+
} catch (r) {
|
|
80
|
+
o = true, n = r;
|
|
81
|
+
} finally {
|
|
82
|
+
try {
|
|
83
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
84
|
+
} finally {
|
|
85
|
+
if (o) throw n;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return a;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function _nonIterableRest() {
|
|
92
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
93
|
+
}
|
|
94
|
+
function _regenerator() {
|
|
95
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
96
|
+
var e,
|
|
97
|
+
t,
|
|
98
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
99
|
+
n = r.iterator || "@@iterator",
|
|
100
|
+
o = r.toStringTag || "@@toStringTag";
|
|
101
|
+
function i(r, n, o, i) {
|
|
102
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
103
|
+
u = Object.create(c.prototype);
|
|
104
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
105
|
+
var i,
|
|
106
|
+
c,
|
|
107
|
+
u,
|
|
108
|
+
f = 0,
|
|
109
|
+
p = o || [],
|
|
110
|
+
y = false,
|
|
111
|
+
G = {
|
|
112
|
+
p: 0,
|
|
113
|
+
n: 0,
|
|
114
|
+
v: e,
|
|
115
|
+
a: d,
|
|
116
|
+
f: d.bind(e, 4),
|
|
117
|
+
d: function (t, r) {
|
|
118
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
function d(r, n) {
|
|
122
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
123
|
+
var o,
|
|
124
|
+
i = p[t],
|
|
125
|
+
d = G.p,
|
|
126
|
+
l = i[2];
|
|
127
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
128
|
+
}
|
|
129
|
+
if (o || r > 1) return a;
|
|
130
|
+
throw y = true, n;
|
|
131
|
+
}
|
|
132
|
+
return function (o, p, l) {
|
|
133
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
134
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
135
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
136
|
+
try {
|
|
137
|
+
if (f = 2, i) {
|
|
138
|
+
if (c || (o = "next"), t = i[o]) {
|
|
139
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
140
|
+
if (!t.done) return t;
|
|
141
|
+
u = t.value, c < 2 && (c = 0);
|
|
142
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
143
|
+
i = e;
|
|
144
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
145
|
+
} catch (t) {
|
|
146
|
+
i = e, c = 1, u = t;
|
|
147
|
+
} finally {
|
|
148
|
+
f = 1;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
value: t,
|
|
153
|
+
done: y
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
}(r, o, i), true), u;
|
|
157
|
+
}
|
|
158
|
+
var a = {};
|
|
159
|
+
function Generator() {}
|
|
160
|
+
function GeneratorFunction() {}
|
|
161
|
+
function GeneratorFunctionPrototype() {}
|
|
162
|
+
t = Object.getPrototypeOf;
|
|
163
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
164
|
+
return this;
|
|
165
|
+
}), t),
|
|
166
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
167
|
+
function f(e) {
|
|
168
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
169
|
+
}
|
|
170
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
171
|
+
return this;
|
|
172
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
173
|
+
return "[object Generator]";
|
|
174
|
+
}), (_regenerator = function () {
|
|
175
|
+
return {
|
|
176
|
+
w: i,
|
|
177
|
+
m: f
|
|
178
|
+
};
|
|
179
|
+
})();
|
|
180
|
+
}
|
|
181
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
182
|
+
var i = Object.defineProperty;
|
|
183
|
+
try {
|
|
184
|
+
i({}, "", {});
|
|
185
|
+
} catch (e) {
|
|
186
|
+
i = 0;
|
|
187
|
+
}
|
|
188
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
189
|
+
function o(r, n) {
|
|
190
|
+
_regeneratorDefine(e, r, function (e) {
|
|
191
|
+
return this._invoke(r, n, e);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
r ? i ? i(e, r, {
|
|
195
|
+
value: n,
|
|
196
|
+
enumerable: !t,
|
|
197
|
+
configurable: !t,
|
|
198
|
+
writable: !t
|
|
199
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
200
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
201
|
+
}
|
|
202
|
+
function _slicedToArray(r, e) {
|
|
203
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
204
|
+
}
|
|
205
|
+
function _toPrimitive(t, r) {
|
|
206
|
+
if ("object" != typeof t || !t) return t;
|
|
207
|
+
var e = t[Symbol.toPrimitive];
|
|
208
|
+
if (void 0 !== e) {
|
|
209
|
+
var i = e.call(t, r);
|
|
210
|
+
if ("object" != typeof i) return i;
|
|
211
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
212
|
+
}
|
|
213
|
+
return (String )(t);
|
|
214
|
+
}
|
|
215
|
+
function _toPropertyKey(t) {
|
|
216
|
+
var i = _toPrimitive(t, "string");
|
|
217
|
+
return "symbol" == typeof i ? i : i + "";
|
|
218
|
+
}
|
|
219
|
+
function _unsupportedIterableToArray(r, a) {
|
|
220
|
+
if (r) {
|
|
221
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
222
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
223
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
var WorkFlow = /*#__PURE__*/function () {
|
|
228
|
+
function WorkFlow() {
|
|
229
|
+
_classCallCheck(this, WorkFlow);
|
|
230
|
+
_defineProperty(this, "webpackProcess", void 0);
|
|
231
|
+
_defineProperty(this, "buildDotCocoProcess", void 0);
|
|
232
|
+
_defineProperty(this, "processingTask", void 0);
|
|
233
|
+
_defineProperty(this, "resolve", void 0);
|
|
234
|
+
_defineProperty(this, "reject", void 0);
|
|
235
|
+
this.init();
|
|
236
|
+
}
|
|
237
|
+
return _createClass(WorkFlow, [{
|
|
238
|
+
key: "init",
|
|
239
|
+
value: function init() {
|
|
240
|
+
var _this = this;
|
|
241
|
+
process$1.on('exit', function () {
|
|
242
|
+
_this.terminate();
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}, {
|
|
246
|
+
key: "forkAll",
|
|
247
|
+
value: function forkAll() {
|
|
248
|
+
this.webpackProcess = this.startProcess(path.join(__dirname, './webpack-process/index.js'));
|
|
249
|
+
this.webpackProcess.on('message', this.webpackMessageCb.bind(this));
|
|
250
|
+
this.buildDotCocoProcess = this.startProcess(path.join(__dirname, './build-dot-coco-process/index.js'));
|
|
251
|
+
this.buildDotCocoProcess.on('message', this.buildDotCocoMessageCb.bind(this));
|
|
252
|
+
}
|
|
253
|
+
}, {
|
|
254
|
+
key: "startProcess",
|
|
255
|
+
value: function startProcess(entry) {
|
|
256
|
+
var _this2 = this;
|
|
257
|
+
var cp = child_process.fork(entry, ['run-as-process']);
|
|
258
|
+
cp.on('exit', function (code) {
|
|
259
|
+
_this2.terminate();
|
|
260
|
+
});
|
|
261
|
+
return cp;
|
|
262
|
+
}
|
|
263
|
+
}, {
|
|
264
|
+
key: "buildDotCocoMessageCb",
|
|
265
|
+
value: function buildDotCocoMessageCb(msg) {
|
|
266
|
+
switch (msg) {
|
|
267
|
+
case 'build-success':
|
|
268
|
+
if (!this.webpackProcess.killed) {
|
|
269
|
+
this.webpackProcess.send('build-once');
|
|
270
|
+
}
|
|
271
|
+
break;
|
|
272
|
+
case 'init-build-success':
|
|
273
|
+
if (!this.webpackProcess.killed) {
|
|
274
|
+
this.webpackProcess.send('start-server');
|
|
275
|
+
}
|
|
276
|
+
break;
|
|
277
|
+
default:
|
|
278
|
+
console.info('rcv msg from buildDotCoco process', msg);
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}, {
|
|
283
|
+
key: "webpackMessageCb",
|
|
284
|
+
value: function webpackMessageCb(msg) {
|
|
285
|
+
var _this$resolve;
|
|
286
|
+
switch (msg) {
|
|
287
|
+
case 'build-success':
|
|
288
|
+
(_this$resolve = this.resolve) === null || _this$resolve === void 0 || _this$resolve.call(this);
|
|
289
|
+
break;
|
|
290
|
+
default:
|
|
291
|
+
console.info('rcv msg from webpack process', msg);
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}, {
|
|
296
|
+
key: "build",
|
|
297
|
+
value: function () {
|
|
298
|
+
var _build = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
299
|
+
return _regenerator().w(function (_context) {
|
|
300
|
+
while (1) switch (_context.n) {
|
|
301
|
+
case 0:
|
|
302
|
+
return _context.a(2, this.run('build-once'));
|
|
303
|
+
}
|
|
304
|
+
}, _callee, this);
|
|
305
|
+
}));
|
|
306
|
+
function build() {
|
|
307
|
+
return _build.apply(this, arguments);
|
|
308
|
+
}
|
|
309
|
+
return build;
|
|
310
|
+
}()
|
|
311
|
+
}, {
|
|
312
|
+
key: "dev",
|
|
313
|
+
value: function () {
|
|
314
|
+
var _dev = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
315
|
+
return _regenerator().w(function (_context2) {
|
|
316
|
+
while (1) switch (_context2.n) {
|
|
317
|
+
case 0:
|
|
318
|
+
return _context2.a(2, this.run('build-and-watch'));
|
|
319
|
+
}
|
|
320
|
+
}, _callee2, this);
|
|
321
|
+
}));
|
|
322
|
+
function dev() {
|
|
323
|
+
return _dev.apply(this, arguments);
|
|
324
|
+
}
|
|
325
|
+
return dev;
|
|
326
|
+
}()
|
|
327
|
+
}, {
|
|
328
|
+
key: "run",
|
|
329
|
+
value: function () {
|
|
330
|
+
var _run = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(task) {
|
|
331
|
+
var _this3 = this;
|
|
332
|
+
return _regenerator().w(function (_context3) {
|
|
333
|
+
while (1) switch (_context3.n) {
|
|
334
|
+
case 0:
|
|
335
|
+
if (!this.processingTask) {
|
|
336
|
+
_context3.n = 1;
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
throw new Error('已经存在一个任务');
|
|
340
|
+
case 1:
|
|
341
|
+
this.buildDotCocoProcess.send(task);
|
|
342
|
+
this.processingTask = new Promise(function (resolve, reject) {
|
|
343
|
+
_this3.resolve = resolve;
|
|
344
|
+
_this3.reject = reject;
|
|
345
|
+
});
|
|
346
|
+
return _context3.a(2, this.processingTask);
|
|
347
|
+
}
|
|
348
|
+
}, _callee3, this);
|
|
349
|
+
}));
|
|
350
|
+
function run(_x) {
|
|
351
|
+
return _run.apply(this, arguments);
|
|
352
|
+
}
|
|
353
|
+
return run;
|
|
354
|
+
}()
|
|
355
|
+
}, {
|
|
356
|
+
key: "terminate",
|
|
357
|
+
value: function terminate() {
|
|
358
|
+
if (this.webpackProcess && !this.webpackProcess.killed) {
|
|
359
|
+
this.webpackProcess.kill();
|
|
360
|
+
}
|
|
361
|
+
if (this.buildDotCocoProcess && !this.buildDotCocoProcess.killed) {
|
|
362
|
+
this.buildDotCocoProcess.kill();
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}]);
|
|
366
|
+
}();
|
|
367
|
+
|
|
368
|
+
function devApp() {
|
|
369
|
+
return _devApp.apply(this, arguments);
|
|
370
|
+
}
|
|
371
|
+
function _devApp() {
|
|
372
|
+
_devApp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
373
|
+
var workflow;
|
|
374
|
+
return _regenerator().w(function (_context) {
|
|
375
|
+
while (1) switch (_context.n) {
|
|
376
|
+
case 0:
|
|
377
|
+
workflow = new WorkFlow();
|
|
378
|
+
workflow.forkAll();
|
|
379
|
+
_context.n = 1;
|
|
380
|
+
return workflow.dev();
|
|
381
|
+
case 1:
|
|
382
|
+
return _context.a(2);
|
|
383
|
+
}
|
|
384
|
+
}, _callee);
|
|
385
|
+
}));
|
|
386
|
+
return _devApp.apply(this, arguments);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
function buildApp() {
|
|
390
|
+
return _buildApp.apply(this, arguments);
|
|
391
|
+
}
|
|
392
|
+
function _buildApp() {
|
|
393
|
+
_buildApp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
394
|
+
var workFlow;
|
|
395
|
+
return _regenerator().w(function (_context) {
|
|
396
|
+
while (1) switch (_context.n) {
|
|
397
|
+
case 0:
|
|
398
|
+
workFlow = new WorkFlow();
|
|
399
|
+
workFlow.forkAll();
|
|
400
|
+
_context.n = 1;
|
|
401
|
+
return workFlow.build();
|
|
402
|
+
case 1:
|
|
403
|
+
process.exit(0);
|
|
404
|
+
case 2:
|
|
405
|
+
return _context.a(2);
|
|
406
|
+
}
|
|
407
|
+
}, _callee);
|
|
408
|
+
}));
|
|
409
|
+
return _buildApp.apply(this, arguments);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
var build = /*#__PURE__*/function () {
|
|
413
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
414
|
+
var result;
|
|
415
|
+
return _regenerator().w(function (_context) {
|
|
416
|
+
while (1) switch (_context.n) {
|
|
417
|
+
case 0:
|
|
418
|
+
_context.n = 1;
|
|
419
|
+
return rollup.rollup({
|
|
420
|
+
input: path$1.join(process$1.cwd(), './src/index.ts'),
|
|
421
|
+
plugins: [cocojs(), typescript({
|
|
422
|
+
compilerOptions: {
|
|
423
|
+
target: 'ESNext',
|
|
424
|
+
lib: ['dom', 'esnext'],
|
|
425
|
+
declaration: true,
|
|
426
|
+
declarationDir: './dist/types',
|
|
427
|
+
jsx: 'preserve',
|
|
428
|
+
resolveJsonModule: true,
|
|
429
|
+
plugins: [{
|
|
430
|
+
transform: '@cocojs/type-extractor',
|
|
431
|
+
transformProgram: true
|
|
432
|
+
}]
|
|
433
|
+
}
|
|
434
|
+
}), babel({
|
|
435
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
436
|
+
plugins: [[require.resolve('@babel/plugin-proposal-decorators'), {
|
|
437
|
+
version: '2023-11'
|
|
438
|
+
}], [require.resolve('@babel/plugin-transform-react-jsx', {
|
|
439
|
+
paths: [path$1.resolve(__dirname, '..', '../node_modules')]
|
|
440
|
+
}), {
|
|
441
|
+
runtime: 'automatic',
|
|
442
|
+
importSource: '@cocojs/mvc'
|
|
443
|
+
}]]
|
|
444
|
+
})]
|
|
445
|
+
});
|
|
446
|
+
case 1:
|
|
447
|
+
result = _context.v;
|
|
448
|
+
_context.n = 2;
|
|
449
|
+
return result.write({
|
|
450
|
+
file: path$1.join(process$1.cwd(), './dist/index.esm.js'),
|
|
451
|
+
format: 'es'
|
|
452
|
+
});
|
|
453
|
+
case 2:
|
|
454
|
+
return _context.a(2);
|
|
455
|
+
}
|
|
456
|
+
}, _callee);
|
|
457
|
+
}));
|
|
458
|
+
return function build() {
|
|
459
|
+
return _ref.apply(this, arguments);
|
|
460
|
+
};
|
|
461
|
+
}();
|
|
462
|
+
|
|
463
|
+
var _test_helper;
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* 应用项目命令
|
|
467
|
+
* coco app build 构建
|
|
468
|
+
* coco app dev 开发
|
|
469
|
+
*/
|
|
470
|
+
function execAppCmd(action) {
|
|
471
|
+
switch (action) {
|
|
472
|
+
case 'build':
|
|
473
|
+
{
|
|
474
|
+
buildApp();
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
case 'dev':
|
|
478
|
+
{
|
|
479
|
+
devApp();
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
default:
|
|
483
|
+
{
|
|
484
|
+
console.log("Unknown app action: ".concat(action));
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* 组件库项目命令
|
|
491
|
+
* coco lib build 构建
|
|
492
|
+
*/
|
|
493
|
+
function execLibCmd(action) {
|
|
494
|
+
switch (action) {
|
|
495
|
+
case 'build':
|
|
496
|
+
{
|
|
497
|
+
build();
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
case 'dev':
|
|
501
|
+
{
|
|
502
|
+
devApp();
|
|
503
|
+
break;
|
|
504
|
+
}
|
|
505
|
+
default:
|
|
506
|
+
{
|
|
507
|
+
console.log("Unknown lib action: ".concat(action));
|
|
508
|
+
break;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
function cli(command, domain, rest) {
|
|
513
|
+
var _rest = _slicedToArray(rest, 1),
|
|
514
|
+
action = _rest[0];
|
|
515
|
+
switch (domain) {
|
|
516
|
+
case 'app':
|
|
517
|
+
{
|
|
518
|
+
execAppCmd(action);
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
case 'lib':
|
|
522
|
+
{
|
|
523
|
+
execLibCmd(action);
|
|
524
|
+
break;
|
|
525
|
+
}
|
|
526
|
+
default:
|
|
527
|
+
{
|
|
528
|
+
console.log("Unknown domain: ".concat(domain));
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
exports._test_helper = _test_helper;
|
|
535
|
+
exports.cli = cli;
|