@tarojs/rn-runner 3.4.2 → 3.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/conditional-file-store.js +28 -91
- package/dist/config/conditional-file-store.js.map +1 -1
- package/dist/config/config-holder.js +12 -12
- package/dist/config/config-holder.js.map +1 -1
- package/dist/config/index.js +26 -63
- package/dist/config/index.js.map +1 -1
- package/dist/config/preview.js +23 -23
- package/dist/config/preview.js.map +1 -1
- package/dist/config/terminal-reporter.js +57 -125
- package/dist/config/terminal-reporter.js.map +1 -1
- package/dist/index.js +162 -224
- package/dist/index.js.map +1 -1
- package/dist/utils.js +6 -6
- package/dist/utils.js.map +1 -1
- package/jest.config.js +1 -1
- package/package.json +8 -8
- package/src/index.ts +3 -3
- package/tsconfig.json +11 -26
package/dist/index.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -19,79 +8,52 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
9
|
});
|
|
21
10
|
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
12
|
+
const Metro = require("metro");
|
|
13
|
+
const config_1 = require("./config");
|
|
14
|
+
const config_holder_1 = require("./config/config-holder");
|
|
15
|
+
const utils_1 = require("./utils");
|
|
16
|
+
const preview_1 = require("./config/preview");
|
|
17
|
+
const helper_1 = require("@tarojs/helper");
|
|
18
|
+
const path = require("path");
|
|
19
|
+
const fse = require("fs-extra");
|
|
20
|
+
const url = require("url");
|
|
21
|
+
const qrcode_terminal_1 = require("qrcode-terminal");
|
|
22
|
+
const readline = require("readline");
|
|
23
|
+
const cli_server_api_1 = require("@react-native-community/cli-server-api");
|
|
24
|
+
const terminal_reporter_1 = require("./config/terminal-reporter");
|
|
25
|
+
const transformHelpers_1 = require("metro/src/lib/transformHelpers");
|
|
26
|
+
const Server = require("metro/src/Server");
|
|
27
|
+
const saveAssets_1 = require("@react-native-community/cli-plugin-metro/build/commands/bundle/saveAssets");
|
|
28
|
+
const outputBundle = require("metro/src/shared/output/bundle");
|
|
67
29
|
function concatOutputFileName(config) {
|
|
68
30
|
// 优先级:--bundle-output > config.output > config.outputRoot
|
|
69
|
-
|
|
31
|
+
let output = path.join(config.outputRoot, 'index.bundle');
|
|
70
32
|
if (config.output) {
|
|
71
|
-
|
|
33
|
+
const outputType = typeof config.output;
|
|
72
34
|
if (outputType === 'string') {
|
|
73
35
|
output = config.output;
|
|
74
36
|
}
|
|
75
37
|
else if (outputType === 'object') {
|
|
76
38
|
output = config.output[config.deviceType];
|
|
77
39
|
if (!output) {
|
|
78
|
-
console.error(
|
|
40
|
+
console.error(`lack value for 'rn.output' configuration with platform '${config.deviceType}': ${JSON.stringify(config.output)}`);
|
|
79
41
|
}
|
|
80
42
|
}
|
|
81
43
|
else {
|
|
82
|
-
console.error(
|
|
44
|
+
console.error(`invalid value for 'rn.output' configuration: ${JSON.stringify(config.output)}`);
|
|
83
45
|
}
|
|
84
46
|
}
|
|
85
47
|
if (config.bundleOutput) {
|
|
86
48
|
output = config.bundleOutput;
|
|
87
49
|
}
|
|
88
|
-
|
|
50
|
+
const res = path.isAbsolute(output) ? output : path.join('.', output);
|
|
89
51
|
fse.ensureDirSync(path.dirname(res));
|
|
90
52
|
return res;
|
|
91
53
|
}
|
|
92
54
|
function concatOutputAssetsDest(config) {
|
|
93
55
|
// 优先级:--assets-dest > config.output > config.outputRoot
|
|
94
|
-
|
|
56
|
+
let assetDest;
|
|
95
57
|
if (!(config === null || config === void 0 ? void 0 : config.deviceType) || !(config === null || config === void 0 ? void 0 : config.output)) {
|
|
96
58
|
assetDest = config.outputRoot;
|
|
97
59
|
}
|
|
@@ -103,7 +65,7 @@ function concatOutputAssetsDest(config) {
|
|
|
103
65
|
}
|
|
104
66
|
if (!assetDest)
|
|
105
67
|
return undefined;
|
|
106
|
-
|
|
68
|
+
const res = path.isAbsolute(assetDest) ? assetDest : path.join('.', assetDest);
|
|
107
69
|
fse.ensureDirSync(path.dirname(res));
|
|
108
70
|
return res;
|
|
109
71
|
}
|
|
@@ -112,181 +74,157 @@ function getOutputSourceMapOption(config) {
|
|
|
112
74
|
if (!(config === null || config === void 0 ? void 0 : config.deviceType)) {
|
|
113
75
|
return {};
|
|
114
76
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
77
|
+
const isIos = config.deviceType === 'ios';
|
|
78
|
+
const sourceMapUrl = config.sourceMapUrl || (isIos ? (_a = config === null || config === void 0 ? void 0 : config.output) === null || _a === void 0 ? void 0 : _a.iosSourceMapUrl : (_b = config === null || config === void 0 ? void 0 : config.output) === null || _b === void 0 ? void 0 : _b.androidSourceMapUrl);
|
|
79
|
+
const sourcemapOutput = config.sourcemapOutput || (isIos ? (_c = config === null || config === void 0 ? void 0 : config.output) === null || _c === void 0 ? void 0 : _c.iosSourcemapOutput : (_d = config === null || config === void 0 ? void 0 : config.output) === null || _d === void 0 ? void 0 : _d.androidSourcemapOutput);
|
|
80
|
+
const sourcemapSourcesRoot = config.sourcemapSourcesRoot || (isIos ? (_e = config === null || config === void 0 ? void 0 : config.output) === null || _e === void 0 ? void 0 : _e.iosSourcemapSourcesRoot : (_f = config === null || config === void 0 ? void 0 : config.output) === null || _f === void 0 ? void 0 : _f.androidSourcemapSourcesRoot);
|
|
119
81
|
sourcemapOutput && fse.ensureDirSync(path.dirname(sourcemapOutput));
|
|
120
82
|
return {
|
|
121
|
-
sourceMapUrl
|
|
122
|
-
sourcemapOutput
|
|
123
|
-
sourcemapSourcesRoot
|
|
83
|
+
sourceMapUrl,
|
|
84
|
+
sourcemapOutput,
|
|
85
|
+
sourcemapSourcesRoot
|
|
124
86
|
};
|
|
125
87
|
}
|
|
126
88
|
// TODO: 返回值
|
|
127
89
|
// HttpServer | {code: string, map: string}
|
|
128
90
|
// IBuildConfig
|
|
129
|
-
function build(
|
|
130
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
91
|
+
function build(_appPath, config) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
process.env.TARO_ENV = helper_1.PLATFORMS.RN;
|
|
94
|
+
// TODO:新增环境变量是否可以在metro构建过程中可以访问到?
|
|
95
|
+
const entry = config_holder_1.getRNConfigEntry();
|
|
96
|
+
config.entry = entry;
|
|
97
|
+
const metroConfig = yield config_1.default(config);
|
|
98
|
+
const sourceRoot = config.sourceRoot || 'src';
|
|
99
|
+
const commonOptions = {
|
|
100
|
+
platform: config.deviceType,
|
|
101
|
+
minify: process.env.NODE_ENV === 'production' || !config.isWatch,
|
|
102
|
+
dev: config.isWatch
|
|
103
|
+
};
|
|
104
|
+
if (config.resetCache) {
|
|
105
|
+
metroConfig.resetCache = config.resetCache;
|
|
106
|
+
}
|
|
107
|
+
if (config.publicPath) {
|
|
108
|
+
metroConfig.transformer.publicPath = config.publicPath;
|
|
109
|
+
}
|
|
110
|
+
metroConfig.reporter = new terminal_reporter_1.TerminalReporter(entry, sourceRoot, metroConfig.cacheStores[0]);
|
|
111
|
+
const onFinish = function (error) {
|
|
112
|
+
if (typeof config.onBuildFinish === 'function') {
|
|
113
|
+
config.onBuildFinish({
|
|
114
|
+
error,
|
|
115
|
+
isWatch: config.isWatch
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
if (error instanceof Error)
|
|
119
|
+
throw error;
|
|
120
|
+
};
|
|
121
|
+
if (config.isWatch) {
|
|
122
|
+
if (!metroConfig.server || (metroConfig.server.useGlobalHotkey === undefined)) {
|
|
123
|
+
if (!metroConfig.server) {
|
|
124
|
+
metroConfig.server = {};
|
|
125
|
+
}
|
|
126
|
+
metroConfig.server.useGlobalHotkey = true;
|
|
127
|
+
}
|
|
128
|
+
if (config.port) {
|
|
129
|
+
metroConfig.server.port = config.port;
|
|
130
|
+
}
|
|
131
|
+
const { middleware, attachToServer } = cli_server_api_1.createDevServerMiddleware({
|
|
132
|
+
port: metroConfig.server.port,
|
|
133
|
+
watchFolders: metroConfig.watchFolders
|
|
134
|
+
});
|
|
135
|
+
metroConfig.server.enhanceMiddleware = (metroMiddleware, metroServer) => {
|
|
136
|
+
metroConfig.reporter.metroServerInstance = metroServer;
|
|
137
|
+
// bundle路由只识别/index.bundle
|
|
138
|
+
return middleware.use((req, res, next) => {
|
|
139
|
+
// eslint-disable-next-line node/no-deprecated-api
|
|
140
|
+
const urlObj = url.parse(req.url);
|
|
141
|
+
if (/\/[^]+.bundle/.test(urlObj.pathname || '') && (urlObj.pathname || '').toLowerCase() !== '/index.bundle') {
|
|
142
|
+
res.writeHead(400);
|
|
143
|
+
res.end('Please access /index.bundle for entry bundling.');
|
|
150
144
|
}
|
|
151
|
-
if (
|
|
152
|
-
|
|
145
|
+
else if (/^\/debugger-ui\//.test(urlObj.pathname || '')) {
|
|
146
|
+
next();
|
|
153
147
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (typeof config.onBuildFinish === 'function') {
|
|
157
|
-
config.onBuildFinish({
|
|
158
|
-
error: error,
|
|
159
|
-
isWatch: config.isWatch
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
if (error instanceof Error)
|
|
163
|
-
throw error;
|
|
164
|
-
};
|
|
165
|
-
if (!config.isWatch) return [3 /*break*/, 2];
|
|
166
|
-
if (!metroConfig.server || (metroConfig.server.useGlobalHotkey === undefined)) {
|
|
167
|
-
if (!metroConfig.server) {
|
|
168
|
-
metroConfig.server = {};
|
|
169
|
-
}
|
|
170
|
-
metroConfig.server.useGlobalHotkey = true;
|
|
148
|
+
else {
|
|
149
|
+
metroMiddleware(req, res, next);
|
|
171
150
|
}
|
|
172
|
-
|
|
173
|
-
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
// 支持host
|
|
154
|
+
return Metro.runServer(metroConfig, Object.assign(Object.assign({}, commonOptions), { hmrEnabled: true })).then(server => {
|
|
155
|
+
console.log(`React-Native Dev server is running on port: ${metroConfig.server.port}`);
|
|
156
|
+
console.log('\n\nTo reload the app press "r"\nTo open developer menu press "d"\n');
|
|
157
|
+
const { messageSocket } = attachToServer(server);
|
|
158
|
+
readline.emitKeypressEvents(process.stdin);
|
|
159
|
+
process.stdin.setRawMode && process.stdin.setRawMode(true);
|
|
160
|
+
process.stdin.on('keypress', (_key, data) => {
|
|
161
|
+
const { ctrl, name } = data;
|
|
162
|
+
if (name === 'r') {
|
|
163
|
+
messageSocket.broadcast('reload');
|
|
164
|
+
console.log('Reloading app...');
|
|
174
165
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
console.log('print qrcode error: host not found.');
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
onFinish(null);
|
|
231
|
-
return server;
|
|
232
|
-
}).catch(function (e) {
|
|
233
|
-
onFinish(e);
|
|
234
|
-
})];
|
|
235
|
-
case 2:
|
|
236
|
-
options_1 = __assign(__assign({}, commonOptions), { entry: './index', out: concatOutputFileName(config) });
|
|
237
|
-
savedBuildFunc_1 = outputBundle.build;
|
|
238
|
-
outputBundle.build = function (packagerClient, requestOptions) { return __awaiter(_this, void 0, void 0, function () {
|
|
239
|
-
var resolutionFn;
|
|
240
|
-
return __generator(this, function (_a) {
|
|
241
|
-
switch (_a.label) {
|
|
242
|
-
case 0: return [4 /*yield*/, transformHelpers_1.getResolveDependencyFn(packagerClient.getBundler().getBundler(), requestOptions.platform)];
|
|
243
|
-
case 1:
|
|
244
|
-
resolutionFn = _a.sent();
|
|
245
|
-
requestOptions.entryFile = resolutionFn(metroConfig.projectRoot, requestOptions.entryFile);
|
|
246
|
-
return [2 /*return*/, savedBuildFunc_1(packagerClient, requestOptions)];
|
|
247
|
-
}
|
|
166
|
+
else if (name === 'd') {
|
|
167
|
+
messageSocket.broadcast('devMenu');
|
|
168
|
+
console.log('Opening developer menu...');
|
|
169
|
+
}
|
|
170
|
+
else if (ctrl && (name === 'c')) {
|
|
171
|
+
process.exit();
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
if (config.qr) {
|
|
175
|
+
const host = utils_1.getOpenHost();
|
|
176
|
+
if (host) {
|
|
177
|
+
const url = `taro://${host}:${metroConfig.server.port}`;
|
|
178
|
+
console.log(utils_1.PLAYGROUNDINFO);
|
|
179
|
+
console.log(`print qrcode of '${url}':`);
|
|
180
|
+
qrcode_terminal_1.generate(url, { small: true });
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
console.log('print qrcode error: host not found.');
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
onFinish(null);
|
|
187
|
+
return server;
|
|
188
|
+
}).catch(e => {
|
|
189
|
+
onFinish(e);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
const options = Object.assign(Object.assign({}, commonOptions), { entry: './index', out: concatOutputFileName(config) });
|
|
194
|
+
const savedBuildFunc = outputBundle.build;
|
|
195
|
+
outputBundle.build = (packagerClient, requestOptions) => __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
const resolutionFn = yield transformHelpers_1.getResolveDependencyFn(packagerClient.getBundler().getBundler(), requestOptions.platform);
|
|
197
|
+
requestOptions.entryFile = resolutionFn(metroConfig.projectRoot, requestOptions.entryFile);
|
|
198
|
+
return savedBuildFunc(packagerClient, requestOptions);
|
|
199
|
+
});
|
|
200
|
+
const server = new Server(metroConfig);
|
|
201
|
+
const sourceMapOption = getOutputSourceMapOption(config);
|
|
202
|
+
try {
|
|
203
|
+
const requestOptions = Object.assign(Object.assign(Object.assign({}, commonOptions), sourceMapOption), { entryFile: options.entry, inlineSourceMap: false, createModuleIdFactory: metroConfig.serializer.createModuleIdFactory });
|
|
204
|
+
const bundle = yield outputBundle.build(server, requestOptions);
|
|
205
|
+
const outputOptions = Object.assign(Object.assign(Object.assign({}, commonOptions), sourceMapOption), { bundleOutput: options.out });
|
|
206
|
+
yield outputBundle.save(bundle, outputOptions, console.log);
|
|
207
|
+
// Save the assets of the bundle
|
|
208
|
+
const outputAssets = yield server.getAssets(Object.assign(Object.assign({}, Server.DEFAULT_BUNDLE_OPTIONS), requestOptions));
|
|
209
|
+
const assetsDest = concatOutputAssetsDest(config);
|
|
210
|
+
return yield saveAssets_1.default(outputAssets, options.platform, assetsDest).then(() => {
|
|
211
|
+
if (config.qr) {
|
|
212
|
+
preview_1.default({
|
|
213
|
+
out: options.out,
|
|
214
|
+
assetsDest,
|
|
215
|
+
platform: options.platform
|
|
248
216
|
});
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
requestOptions = __assign(__assign(__assign({}, commonOptions), sourceMapOption), { entryFile: options_1.entry, inlineSourceMap: false, createModuleIdFactory: metroConfig.serializer.createModuleIdFactory });
|
|
256
|
-
return [4 /*yield*/, outputBundle.build(server, requestOptions)];
|
|
257
|
-
case 4:
|
|
258
|
-
bundle = _b.sent();
|
|
259
|
-
outputOptions = __assign(__assign(__assign({}, commonOptions), sourceMapOption), { bundleOutput: options_1.out });
|
|
260
|
-
return [4 /*yield*/, outputBundle.save(bundle, outputOptions, console.log)
|
|
261
|
-
// Save the assets of the bundle
|
|
262
|
-
];
|
|
263
|
-
case 5:
|
|
264
|
-
_b.sent();
|
|
265
|
-
return [4 /*yield*/, server.getAssets(__assign(__assign({}, Server.DEFAULT_BUNDLE_OPTIONS), requestOptions))];
|
|
266
|
-
case 6:
|
|
267
|
-
outputAssets = _b.sent();
|
|
268
|
-
assetsDest_1 = concatOutputAssetsDest(config);
|
|
269
|
-
return [4 /*yield*/, saveAssets_1.default(outputAssets, options_1.platform, assetsDest_1).then(function () {
|
|
270
|
-
if (config.qr) {
|
|
271
|
-
preview_1.default({
|
|
272
|
-
out: options_1.out,
|
|
273
|
-
assetsDest: assetsDest_1,
|
|
274
|
-
platform: options_1.platform
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
onFinish(null);
|
|
278
|
-
})];
|
|
279
|
-
case 7: return [2 /*return*/, _b.sent()];
|
|
280
|
-
case 8:
|
|
281
|
-
e_1 = _b.sent();
|
|
282
|
-
onFinish(e_1);
|
|
283
|
-
return [3 /*break*/, 10];
|
|
284
|
-
case 9:
|
|
285
|
-
server.end();
|
|
286
|
-
return [7 /*endfinally*/];
|
|
287
|
-
case 10: return [2 /*return*/];
|
|
217
|
+
}
|
|
218
|
+
onFinish(null);
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
catch (e) {
|
|
222
|
+
onFinish(e);
|
|
288
223
|
}
|
|
289
|
-
|
|
224
|
+
finally {
|
|
225
|
+
server.end();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
290
228
|
});
|
|
291
229
|
}
|
|
292
230
|
exports.default = build;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+BAA8B;AAC9B,qCAAqC;AACrC,0DAAyD;AACzD,mCAAqD;AACrD,8CAAsC;AAEtC,2CAA0C;AAC1C,6BAA4B;AAC5B,gCAA+B;AAC/B,2BAA0B;AAC1B,qDAA0C;AAE1C,qCAAoC;AACpC,2EAAkF;AAClF,kEAA6D;AAC7D,qEAAuE;AACvE,2CAA0C;AAC1C,0GAAkG;AAClG,+DAA8D;AAE9D,SAAS,oBAAoB,CAAE,MAAW;IACxC,0DAA0D;IAC1D,IAAI,MAAM,GAAG,IA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EAAE,EAAE;wBACb,iBAAO,CAAC;4BACN,GAAG,EAAE,OAAO,CAAC,GAAG;4BAChB,UAAU;4BACV,QAAQ,EAAE,OAAO,CAAC,QAAQ;yBAC3B,CAAC,CAAA;qBACH;oBACD,QAAQ,CAAC,IAAI,CAAC,CAAA;gBAChB,CAAC,CAAC,CAAA;aACH;YAAC,OAAO,CAAC,EAAE;gBACV,QAAQ,CAAC,CAAC,CAAC,CAAA;aACZ;oBAAS;gBACR,MAAM,CAAC,GAAG,EAAE,CAAA;aACb;SACF;IACH,CAAC;CAAA;AAhKD,wBAgKC"}
|
package/dist/utils.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PLAYGROUNDINFO = exports.PLAYGROUNDREPO = exports.getOpenHost = void 0;
|
|
4
|
-
|
|
4
|
+
const os_1 = require("os");
|
|
5
5
|
function getOpenHost() {
|
|
6
6
|
var _a;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
for (
|
|
10
|
-
|
|
7
|
+
let result;
|
|
8
|
+
const interfaces = os_1.networkInterfaces();
|
|
9
|
+
for (const devName in interfaces) {
|
|
10
|
+
const isEnd = (_a = interfaces[devName]) === null || _a === void 0 ? void 0 : _a.some(item => {
|
|
11
11
|
// 取IPv4, 不为127.0.0.1的内网ip
|
|
12
12
|
if (item.family === 'IPv4' && item.address !== '127.0.0.1' && !item.internal) {
|
|
13
13
|
result = item.address;
|
|
@@ -24,5 +24,5 @@ function getOpenHost() {
|
|
|
24
24
|
}
|
|
25
25
|
exports.getOpenHost = getOpenHost;
|
|
26
26
|
exports.PLAYGROUNDREPO = 'https://github.com/wuba/taro-playground';
|
|
27
|
-
exports.PLAYGROUNDINFO =
|
|
27
|
+
exports.PLAYGROUNDINFO = `use [Taro Playground App](${exports.PLAYGROUNDREPO}) to scan`;
|
|
28
28
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,2BAAsC;AAEtC,SAAgB,WAAW;;IACzB,IAAI,MAAM,CAAA;IACV,MAAM,UAAU,GAAG,sBAAiB,EAAE,CAAA;IACtC,KAAK,MAAM,OAAO,IAAI,UAAU,EAAE;QAChC,MAAM,KAAK,GAAG,MAAA,UAAU,CAAC,OAAO,CAAC,0CAAE,IAAI,CAAC,IAAI,CAAC,EAAE;YAC7C,0BAA0B;YAC1B,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,IAAI,IAAI,CAAC,OAAO,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAC5E,MAAM,GAAG,IAAI,CAAC,OAAO,CAAA;gBACrB,OAAO,IAAI,CAAA;aACZ;YACD,OAAO,KAAK,CAAA;QACd,CAAC,CAAC,CAAA;QACF,eAAe;QACf,IAAI,KAAK,EAAE;YACT,MAAK;SACN;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAlBD,kCAkBC;AAEY,QAAA,cAAc,GAAG,yCAAyC,CAAA;AAE1D,QAAA,cAAc,GAAG,6BAA6B,sBAAc,WAAW,CAAA"}
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/rn-runner",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.5",
|
|
4
4
|
"description": "ReactNative build tool for taro",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"npm": ">=6.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@react-native-community/cli": "^
|
|
34
|
-
"@react-native-community/cli-server-api": "^
|
|
35
|
-
"@tarojs/helper": "3.4.
|
|
36
|
-
"@tarojs/rn-style-transformer": "3.4.
|
|
37
|
-
"@tarojs/rn-supporter": "3.4.
|
|
38
|
-
"@tarojs/rn-transformer": "3.4.
|
|
33
|
+
"@react-native-community/cli-plugin-metro": "^6.0.0",
|
|
34
|
+
"@react-native-community/cli-server-api": "^6.0.0",
|
|
35
|
+
"@tarojs/helper": "3.4.5",
|
|
36
|
+
"@tarojs/rn-style-transformer": "3.4.5",
|
|
37
|
+
"@tarojs/rn-supporter": "3.4.5",
|
|
38
|
+
"@tarojs/rn-transformer": "3.4.5",
|
|
39
39
|
"fs-extra": "^8.0.1",
|
|
40
40
|
"lodash": "^4.17.21",
|
|
41
41
|
"metro": "^0.66.2",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"mime-types": "^2.1.27",
|
|
48
48
|
"qrcode-terminal": "^0.12.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "789e873f7b9477124b44a900cd4f6a2810e4e06a"
|
|
51
51
|
}
|
package/src/index.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { createDevServerMiddleware } from '@react-native-community/cli-server-ap
|
|
|
15
15
|
import { TerminalReporter } from './config/terminal-reporter'
|
|
16
16
|
import { getResolveDependencyFn } from 'metro/src/lib/transformHelpers'
|
|
17
17
|
import * as Server from 'metro/src/Server'
|
|
18
|
-
import saveAssets from '@react-native-community/cli/build/commands/bundle/saveAssets'
|
|
18
|
+
import saveAssets from '@react-native-community/cli-plugin-metro/build/commands/bundle/saveAssets'
|
|
19
19
|
import * as outputBundle from 'metro/src/shared/output/bundle'
|
|
20
20
|
|
|
21
21
|
function concatOutputFileName (config: any): string {
|
|
@@ -78,7 +78,7 @@ function getOutputSourceMapOption (config: any): Record<string, any> {
|
|
|
78
78
|
// TODO: 返回值
|
|
79
79
|
// HttpServer | {code: string, map: string}
|
|
80
80
|
// IBuildConfig
|
|
81
|
-
export default async function build (
|
|
81
|
+
export default async function build (_appPath: string, config: any): Promise<any> {
|
|
82
82
|
process.env.TARO_ENV = PLATFORMS.RN
|
|
83
83
|
// TODO:新增环境变量是否可以在metro构建过程中可以访问到?
|
|
84
84
|
const entry = getRNConfigEntry()
|
|
@@ -154,7 +154,7 @@ export default async function build (appPath: string, config: any): Promise<any>
|
|
|
154
154
|
|
|
155
155
|
readline.emitKeypressEvents(process.stdin)
|
|
156
156
|
process.stdin.setRawMode && process.stdin.setRawMode(true)
|
|
157
|
-
process.stdin.on('keypress', (
|
|
157
|
+
process.stdin.on('keypress', (_key, data) => {
|
|
158
158
|
const { ctrl, name } = data
|
|
159
159
|
if (name === 'r') {
|
|
160
160
|
messageSocket.broadcast('reload')
|