@tarojs/rn-runner 3.4.0 → 3.4.3
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/package.json +6 -6
- package/src/index.ts +2 -2
- package/tsconfig.json +11 -26
|
@@ -8,113 +8,50 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __values = (this && this.__values) || function(o) {
|
|
39
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
-
if (m) return m.call(o);
|
|
41
|
-
if (o && typeof o.length === "number") return {
|
|
42
|
-
next: function () {
|
|
43
|
-
if (o && i >= o.length) o = void 0;
|
|
44
|
-
return { value: o && o[i++], done: !o };
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
-
};
|
|
49
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
12
|
+
const FileStore = require("metro-cache/src/stores/FileStore");
|
|
13
|
+
class ConditionalFileStore {
|
|
14
|
+
constructor(options, entryName) {
|
|
53
15
|
this.ignoreEntryFileCache = false;
|
|
54
16
|
this._fileStore = new FileStore(options);
|
|
55
17
|
this.entryName = entryName || 'app';
|
|
56
18
|
}
|
|
57
|
-
|
|
58
|
-
var e_1, _a;
|
|
19
|
+
isEntryCache(cacheItem) {
|
|
59
20
|
if (!cacheItem)
|
|
60
21
|
return false;
|
|
61
|
-
|
|
22
|
+
const { dependencies } = cacheItem;
|
|
62
23
|
if (!dependencies || !dependencies.length) {
|
|
63
24
|
return false;
|
|
64
25
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (d.name.includes(this.entryName + ".config")) {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
74
|
-
finally {
|
|
75
|
-
try {
|
|
76
|
-
if (dependencies_1_1 && !dependencies_1_1.done && (_a = dependencies_1.return)) _a.call(dependencies_1);
|
|
26
|
+
for (const d of dependencies) {
|
|
27
|
+
if (d.name.includes(`${this.entryName}.config`)) {
|
|
28
|
+
return true;
|
|
77
29
|
}
|
|
78
|
-
finally { if (e_1) throw e_1.error; }
|
|
79
30
|
}
|
|
80
31
|
return false;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
result = _a.sent();
|
|
90
|
-
if (result && this.ignoreEntryFileCache && this.isEntryCache(result)) {
|
|
91
|
-
return [2 /*return*/, null];
|
|
92
|
-
}
|
|
93
|
-
return [2 /*return*/, result];
|
|
94
|
-
}
|
|
95
|
-
});
|
|
32
|
+
}
|
|
33
|
+
get(key) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const result = yield this._fileStore.get(key);
|
|
36
|
+
if (result && this.ignoreEntryFileCache && this.isEntryCache(result)) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
96
40
|
});
|
|
97
|
-
}
|
|
98
|
-
|
|
41
|
+
}
|
|
42
|
+
set(key, value) {
|
|
99
43
|
var _a, _b, _c, _d, _e;
|
|
100
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return [2 /*return*/];
|
|
107
|
-
}
|
|
108
|
-
return [4 /*yield*/, this._fileStore.set(key, value)];
|
|
109
|
-
case 1: return [2 /*return*/, _f.sent()];
|
|
110
|
-
}
|
|
111
|
-
});
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
// fix: 样式文件不写缓存
|
|
46
|
+
if (((_e = (_d = (_c = (_b = (_a = value === null || value === void 0 ? void 0 : value.output) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.functionMap) === null || _d === void 0 ? void 0 : _d.names) === null || _e === void 0 ? void 0 : _e.indexOf('ignoreStyleFileCache')) > -1) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
return yield this._fileStore.set(key, value);
|
|
112
50
|
});
|
|
113
|
-
}
|
|
114
|
-
|
|
51
|
+
}
|
|
52
|
+
clear() {
|
|
115
53
|
this._fileStore.clear();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
}());
|
|
54
|
+
}
|
|
55
|
+
}
|
|
119
56
|
exports.default = ConditionalFileStore;
|
|
120
57
|
//# sourceMappingURL=conditional-file-store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditional-file-store.js","sourceRoot":"","sources":["../../src/config/conditional-file-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conditional-file-store.js","sourceRoot":"","sources":["../../src/config/conditional-file-store.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,8DAA6D;AAE7D,MAAqB,oBAAoB;IAKvC,YAAa,OAAY,EAAE,SAAkB;QAJ7C,yBAAoB,GAAG,KAAK,CAAA;QAK1B,IAAI,CAAC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;IACzB,CAAC;CACF;AA5CD,uCA4CC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getRNConfigBabelPlugin = exports.getRNConfigTransformer = exports.getRNConfigOutput = exports.getRNConfigEntry = exports.getRNConfig = exports.getConfig = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
let config;
|
|
7
|
+
let rnConfig;
|
|
8
|
+
const getConfig = () => {
|
|
9
9
|
if (config)
|
|
10
10
|
return config;
|
|
11
|
-
|
|
11
|
+
const fileName = `${process.cwd()}/config/index.js`;
|
|
12
12
|
if (fs.existsSync(fileName)) {
|
|
13
|
-
config = require(process.cwd()
|
|
13
|
+
config = require(`${process.cwd()}/config/index`)(lodash_1.merge);
|
|
14
14
|
return config;
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
@@ -20,7 +20,7 @@ var getConfig = function () {
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
exports.getConfig = getConfig;
|
|
23
|
-
|
|
23
|
+
const getRNConfig = () => {
|
|
24
24
|
getConfig();
|
|
25
25
|
if (rnConfig)
|
|
26
26
|
return rnConfig;
|
|
@@ -33,12 +33,12 @@ var getRNConfig = function () {
|
|
|
33
33
|
return rnConfig;
|
|
34
34
|
};
|
|
35
35
|
exports.getRNConfig = getRNConfig;
|
|
36
|
-
|
|
36
|
+
const getRNConfigEntry = () => {
|
|
37
37
|
getRNConfig();
|
|
38
38
|
return rnConfig.entry || 'app';
|
|
39
39
|
};
|
|
40
40
|
exports.getRNConfigEntry = getRNConfigEntry;
|
|
41
|
-
|
|
41
|
+
const getRNConfigOutput = (p) => {
|
|
42
42
|
getRNConfig();
|
|
43
43
|
if (rnConfig.output) {
|
|
44
44
|
if (p === 'ios') {
|
|
@@ -53,7 +53,7 @@ var getRNConfigOutput = function (p) {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
exports.getRNConfigOutput = getRNConfigOutput;
|
|
56
|
-
|
|
56
|
+
const getRNConfigTransformer = () => {
|
|
57
57
|
getRNConfig();
|
|
58
58
|
if (rnConfig.transformer) {
|
|
59
59
|
return rnConfig.transformer;
|
|
@@ -63,7 +63,7 @@ var getRNConfigTransformer = function () {
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
exports.getRNConfigTransformer = getRNConfigTransformer;
|
|
66
|
-
|
|
66
|
+
const getRNConfigBabelPlugin = () => {
|
|
67
67
|
getRNConfig();
|
|
68
68
|
if (rnConfig.babelPlugin) {
|
|
69
69
|
return rnConfig.babelPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-holder.js","sourceRoot":"","sources":["../../src/config/config-holder.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"config-holder.js","sourceRoot":"","sources":["../../src/config/config-holder.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAG9B,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAExB,IAAI,MAAc,CAAA;AAClB,IAAI,QAAkB,CAAA;AAEtB,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,IAAI,MAAM;QAAE,OAAO,MAAM,CAAA;IACzB,MAAM,QAAQ,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,kBAAkB,CAAA;IACnD,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC3B,MAAM,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC,cAAK,CAAC,CAAA;QACxD,OAAO,MAAM,CAAA;KACd;SAAM;QACL,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QACxB,MAAM,GAAG,EAAE,CAAA;QACX,OAAO,MAAM,CAAA;KACd;A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B"}
|
package/dist/config/index.js
CHANGED
|
@@ -8,60 +8,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.defaultConfig = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
13
|
+
const Metro = require("metro");
|
|
14
|
+
const os = require("os");
|
|
15
|
+
const path = require("path");
|
|
16
|
+
const resolveReactNativePath_1 = require("@react-native-community/cli/build/tools/config/resolveReactNativePath");
|
|
17
|
+
const findProjectRoot_1 = require("@react-native-community/cli/build/tools/config/findProjectRoot");
|
|
18
|
+
const Supporter = require("@tarojs/rn-supporter");
|
|
19
|
+
const conditional_file_store_1 = require("./conditional-file-store");
|
|
20
|
+
const reactNativePath = resolveReactNativePath_1.default(findProjectRoot_1.default());
|
|
21
|
+
const defaultConfig = getDefaultConfig();
|
|
49
22
|
exports.defaultConfig = defaultConfig;
|
|
50
23
|
function getDefaultConfig() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
24
|
+
const supporter = new Supporter({ fromRunner: true });
|
|
25
|
+
const taroMetroConfig = supporter.getMetroConfig();
|
|
26
|
+
const metroConfig = {
|
|
54
27
|
transformer: taroMetroConfig.transformer,
|
|
55
28
|
resolver: taroMetroConfig.resolver,
|
|
56
29
|
serializer: {
|
|
57
30
|
// We can include multiple copies of InitializeCore here because metro will
|
|
58
31
|
// only add ones that are already part of the bundle
|
|
59
|
-
getModulesRunBeforeMainModule:
|
|
32
|
+
getModulesRunBeforeMainModule: () => [
|
|
60
33
|
require.resolve(path.join(reactNativePath, 'Libraries/Core/InitializeCore'))
|
|
61
|
-
]
|
|
62
|
-
getPolyfills:
|
|
63
|
-
return require(path.join(reactNativePath, 'rn-get-polyfills'))();
|
|
64
|
-
}
|
|
34
|
+
],
|
|
35
|
+
getPolyfills: () => require(path.join(reactNativePath, 'rn-get-polyfills'))()
|
|
65
36
|
},
|
|
66
37
|
cacheStores: [new conditional_file_store_1.default({
|
|
67
38
|
root: path.join(os.tmpdir(), 'metro-cache')
|
|
@@ -72,23 +43,15 @@ function getDefaultConfig() {
|
|
|
72
43
|
};
|
|
73
44
|
return metroConfig;
|
|
74
45
|
}
|
|
75
|
-
exports.default = (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
if (config.entry) {
|
|
88
|
-
res.cacheStores[0].entryName = config.entry;
|
|
89
|
-
}
|
|
90
|
-
return [2 /*return*/, res];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}); });
|
|
46
|
+
exports.default = (config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
const metroConfig = getDefaultConfig();
|
|
48
|
+
const res = yield Metro.loadConfig({}, metroConfig);
|
|
49
|
+
if (!res.cacheStores || (res.cacheStores.length !== 1) || !(res.cacheStores[0] instanceof conditional_file_store_1.default)) {
|
|
50
|
+
throw new Error("cacheStores shouldn't be overridden in metro config.");
|
|
51
|
+
}
|
|
52
|
+
if (config.entry) {
|
|
53
|
+
res.cacheStores[0].entryName = config.entry;
|
|
54
|
+
}
|
|
55
|
+
return res;
|
|
56
|
+
});
|
|
94
57
|
//# sourceMappingURL=index.js.map
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA8B;AAC9B,yBAAwB;AACxB,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MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,gCAAoB,CAAC,EAAE;QAC/G,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;KACxE;IACD,IAAI,MAAM,CAAC,KAAK,EAAE;QAChB,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,MAAM,CAAC,KAAK,CAAA;KAC5C;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA,CAAA"}
|
package/dist/config/preview.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
const mime = require("mime-types");
|
|
4
|
+
const http_1 = require("http");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const qrcode_terminal_1 = require("qrcode-terminal");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const url_1 = require("url");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const drawableFileTypes = new Set([
|
|
11
11
|
'gif',
|
|
12
12
|
'jpeg',
|
|
13
13
|
'jpg',
|
|
@@ -34,20 +34,20 @@ function getAndroidAssetSuffix(scale) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function getAndroidResourceFolderName(pathname) {
|
|
37
|
-
|
|
37
|
+
const ext = path_1.extname(pathname).replace(/^./, '').toLowerCase();
|
|
38
38
|
if (!drawableFileTypes.has(ext)) {
|
|
39
39
|
return 'raw';
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const suffix = getAndroidAssetSuffix(1); // TODO: auto scale
|
|
42
|
+
const androidFolder = `drawable-${suffix}`;
|
|
43
43
|
return androidFolder;
|
|
44
44
|
}
|
|
45
45
|
function getAndroidResourceIdentifier(pathname) {
|
|
46
46
|
if (pathname[0] === '/') {
|
|
47
47
|
pathname = pathname.substr(1);
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
const ext = path_1.extname(pathname).toLowerCase();
|
|
50
|
+
const extReg = new RegExp(ext + '$');
|
|
51
51
|
return pathname
|
|
52
52
|
.replace(extReg, '')
|
|
53
53
|
.toLowerCase()
|
|
@@ -55,19 +55,19 @@ function getAndroidResourceIdentifier(pathname) {
|
|
|
55
55
|
.replace(/([^a-z0-9_])/g, '')
|
|
56
56
|
.replace(/^assets_/, '') + ext;
|
|
57
57
|
}
|
|
58
|
-
exports.default = (
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
exports.default = (opt) => {
|
|
59
|
+
const port = process.env.PORT || 8079;
|
|
60
|
+
const host = `http://${utils_1.getOpenHost()}:${port}`;
|
|
61
61
|
http_1.createServer(function (request, response) {
|
|
62
|
-
|
|
63
|
-
console.log(request.method
|
|
62
|
+
const url = new url_1.URL(request.url || '', host);
|
|
63
|
+
console.log(`${request.method} ${request.url}`);
|
|
64
64
|
if (url.pathname === '/inspector/device') {
|
|
65
65
|
response.writeHead(404);
|
|
66
66
|
response.end('404', 'utf-8');
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
let filePath;
|
|
70
|
+
const contentType = mime.lookup(url.pathname);
|
|
71
71
|
if (url.pathname === '/index.js') {
|
|
72
72
|
filePath = opt.out;
|
|
73
73
|
}
|
|
@@ -94,9 +94,9 @@ exports.default = (function (opt) {
|
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
}).listen(port);
|
|
97
|
-
|
|
97
|
+
const url = `${host}/index.js`;
|
|
98
98
|
console.log(utils_1.PLAYGROUNDINFO);
|
|
99
|
-
console.log(
|
|
99
|
+
console.log(`print qrcode of ${opt.platform} bundle '${url}':`);
|
|
100
100
|
qrcode_terminal_1.generate(url, { small: true });
|
|
101
|
-
}
|
|
101
|
+
};
|
|
102
102
|
//# sourceMappingURL=preview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/config/preview.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/config/preview.ts"],"names":[],"mappings":";;AAAA,mCAAkC;AAClC,+BAAmC;AACnC,2BAA6B;AAC7B,qDAA0C;AAC1C,oCAAsD;AACtD,6BAAyB;AACzB,+BAAoC;AAQpC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS;IACxC,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;CACN,CAAC,CAAA;AAEF,SAAS,qBAAqB,CAAE,KAAa;IAC3C,QAAQ,KAAK,EAAE;QACb,KAAK,IAAI;YACP,OAAO,MAAM,CAAA;QACf,KAAK,CAAC;YACJ,OAAO,MAAM,CAAA;QACf,KAAK,GAAG;YACN,OAAO,MAAM,CAAA;QACf,KAAK,CAAC;YACJ,OAAO,OAAO,CAAA;QAChB,KAAK,CAAC;YACJ,OAAO,QAAQ,CAAA;QACjB,KAAK,CAAC;YACJ,OAAO,SAAS,CAAA;QAClB;YACE,OAAO,EAAE,CAAA;KACZ;AACH,CAAC;AAED,SAAS,4BAA4B,CAAE,QAAe;IACpD,MAAM,GAAG,GAAG,cAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAA;IAC7D,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAA;KACb;IACD,MAAM,MAAM,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA,CAAC,mBAAmB;IAC3D,MAAM,aAAa,GAAG,YAAY,MAAM,EAAE,CAAA;IAC1C,OAAO,aAAa,CAAA;AACtB,CAAC;AAED,SAAS,4B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