@tarojs/rn-runner 3.5.7-alpha.9 → 3.5.8
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/__tests__/__snapshots__/components.spec.ts.snap +3 -3
- package/__tests__/build.spec.ts +17 -0
- package/__tests__/config.spec.ts +35 -0
- package/dist/config/conditional-file-store.js +57 -0
- package/dist/config/conditional-file-store.js.map +1 -0
- package/dist/config/config-holder.js +76 -0
- package/dist/config/config-holder.js.map +1 -0
- package/dist/config/index.js +57 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/preview.js +102 -0
- package/dist/config/preview.js.map +1 -0
- package/dist/config/terminal-reporter.js +103 -0
- package/dist/config/terminal-reporter.js.map +1 -0
- package/dist/index.js +184 -81
- package/dist/index.js.map +1 -1
- package/dist/utils.js +29 -0
- package/dist/utils.js.map +1 -0
- package/package.json +24 -11
- package/src/config/conditional-file-store.ts +47 -0
- package/src/config/config-holder.ts +70 -0
- package/src/config/index.ts +76 -0
- package/src/config/preview.ts +114 -0
- package/src/config/terminal-reporter.ts +96 -0
- package/src/index.ts +206 -80
- package/src/utils.ts +27 -0
- package/templates/index.js +0 -1
- package/templates/metro.config.js +0 -8
|
@@ -207,7 +207,7 @@ export { Navbar as default };
|
|
|
207
207
|
|
|
208
208
|
exports[`build_components named export 1`] = `
|
|
209
209
|
Array [
|
|
210
|
-
"import { Platform as Platform$1,
|
|
210
|
+
"import { Platform as Platform$1, NativeEventEmitter } from 'react-native';
|
|
211
211
|
import 'react-native/Libraries/EventEmitter/RCTDeviceEventEmitter';
|
|
212
212
|
import 'react';
|
|
213
213
|
import require$$0 from 'crypto';
|
|
@@ -236,7 +236,7 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof win
|
|
|
236
236
|
|
|
237
237
|
var invariant=function(condition,format,a,b,c,d,e,f){if(!condition){var error;if(format===undefined){error=new Error('Minified exception occurred; use the non-minified dev environment '+'for the full error message and additional helpful warnings.');}else {var args=[a,b,c,d,e,f];var argIndex=0;error=new Error(format.replace(/%s/g,function(){return args[argIndex++];}));error.name='Invariant Violation';}error.framesToPop=1;throw error;}};var invariant_1=invariant;
|
|
238
238
|
|
|
239
|
-
var nativeEmitterSubscriptionKey='@@nativeEmitterSubscription@@';var EventEmitter=function(){function EventEmitter(nativeModule){_classCallCheck(this,EventEmitter);this._listenerCount=0;
|
|
239
|
+
var nativeEmitterSubscriptionKey='@@nativeEmitterSubscription@@';var EventEmitter=function(){function EventEmitter(nativeModule){_classCallCheck(this,EventEmitter);this._listenerCount=0;this._nativeModule=nativeModule;this._eventEmitter=new NativeEventEmitter(nativeModule);}_createClass(EventEmitter,[{key:\\"addListener\\",value:function addListener(eventName,listener){var _this=this,_subscription;if(!this._listenerCount&&Platform$1.OS!=='ios'&&this._nativeModule.startObserving){this._nativeModule.startObserving();}this._listenerCount++;var nativeEmitterSubscription=this._eventEmitter.addListener(eventName,listener);var subscription=(_subscription={},_defineProperty(_subscription,nativeEmitterSubscriptionKey,nativeEmitterSubscription),_defineProperty(_subscription,\\"remove\\",function remove(){_this.removeSubscription(subscription);}),_subscription);return subscription;}},{key:\\"removeAllListeners\\",value:function removeAllListeners(eventName){var removedListenerCount=this._eventEmitter.listenerCount?this._eventEmitter.listenerCount(eventName):this._eventEmitter.listeners(eventName).length;this._eventEmitter.removeAllListeners(eventName);this._listenerCount-=removedListenerCount;invariant_1(this._listenerCount>=0,\\"EventEmitter must have a non-negative number of listeners\\");if(!this._listenerCount&&Platform$1.OS!=='ios'&&this._nativeModule.stopObserving){this._nativeModule.stopObserving();}}},{key:\\"removeSubscription\\",value:function removeSubscription(subscription){var nativeEmitterSubscription=subscription[nativeEmitterSubscriptionKey];if(!nativeEmitterSubscription){return;}if('remove'in nativeEmitterSubscription){nativeEmitterSubscription.remove();}else if('removeSubscription'in this._eventEmitter){this._eventEmitter.removeSubscription(nativeEmitterSubscription);}this._listenerCount--;delete subscription[nativeEmitterSubscriptionKey];subscription.remove=function(){};if(!this._listenerCount&&Platform$1.OS!=='ios'&&this._nativeModule.stopObserving){this._nativeModule.stopObserving();}}},{key:\\"emit\\",value:function emit(eventName){var _this$_eventEmitter;for(var _len=arguments.length,params=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){params[_key-1]=arguments[_key];}(_this$_eventEmitter=this._eventEmitter).emit.apply(_this$_eventEmitter,[eventName].concat(params));}}]);return EventEmitter;}();
|
|
240
240
|
|
|
241
241
|
var NativeModulesProxy = {};
|
|
242
242
|
|
|
@@ -258,7 +258,7 @@ function _createSuper$1(Derived){var hasNativeReflectConstruct=_isNativeReflectC
|
|
|
258
258
|
|
|
259
259
|
var NativeErrorManager = NativeModulesProxy.ExpoModulesCoreErrorManager;
|
|
260
260
|
|
|
261
|
-
if(__DEV__&&Platform.OS==='android'&&NativeErrorManager){var eventEmitter=new EventEmitter(NativeErrorManager);eventEmitter.addListener('ExpoModulesCoreErrorManager.onNewException',function(_ref){var message=_ref.message;console.error(message);});}
|
|
261
|
+
if(__DEV__&&Platform.OS==='android'&&NativeErrorManager){var eventEmitter=new EventEmitter(NativeErrorManager);eventEmitter.addListener('ExpoModulesCoreErrorManager.onNewException',function(_ref){var message=_ref.message;console.error(message);});}
|
|
262
262
|
|
|
263
263
|
var compareVersions = {exports: {}};
|
|
264
264
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import build from '../src/index'
|
|
2
|
+
import { appPath, config, configNoWatch } from './mock/build_testdata'
|
|
3
|
+
|
|
4
|
+
const outputBundle = require('metro/src/shared/output/bundle')
|
|
5
|
+
|
|
6
|
+
describe('init', () => {
|
|
7
|
+
jest.spyOn(outputBundle, 'build').mockImplementation(() => {
|
|
8
|
+
return 'ok'
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
it('build', async () => {
|
|
12
|
+
await build(appPath, config)
|
|
13
|
+
})
|
|
14
|
+
it('build_noWatch', async () => {
|
|
15
|
+
await build(appPath, configNoWatch)
|
|
16
|
+
})
|
|
17
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { getRNConfigBabelPlugin, getRNConfigEntry, getRNConfigOutput, getRNConfigTransformer } from '../src/config/config-holder'
|
|
2
|
+
|
|
3
|
+
const path = require('path')
|
|
4
|
+
|
|
5
|
+
describe('init', () => {
|
|
6
|
+
const spy = jest.spyOn(process, 'cwd')
|
|
7
|
+
spy.mockReturnValue(path.resolve(__dirname, '', 'mock'))
|
|
8
|
+
process.env = {
|
|
9
|
+
NODE_ENV: 'development'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
it('getRNConfigOutput', () => {
|
|
13
|
+
expect(getRNConfigOutput('ios')).toEqual('iosbundle/main.bundle')
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('getRNConfigEntry', () => {
|
|
17
|
+
expect(getRNConfigEntry()).toEqual('app')
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('getRNConfigTransformer', () => {
|
|
21
|
+
expect(getRNConfigTransformer()).toEqual([
|
|
22
|
+
'metro/transformer'
|
|
23
|
+
])
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('getRNConfigBabelPlugin', () => {
|
|
27
|
+
const babelPlugin = [
|
|
28
|
+
'/absulute/path/plugin/filename',
|
|
29
|
+
'@tarojs/plugin-mock',
|
|
30
|
+
['@tarojs/plugin-mock'],
|
|
31
|
+
['@tarojs/plugin-mock', {}]
|
|
32
|
+
]
|
|
33
|
+
expect(getRNConfigBabelPlugin()).toEqual(babelPlugin)
|
|
34
|
+
})
|
|
35
|
+
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const FileStore = require("metro-cache/src/stores/FileStore");
|
|
13
|
+
class ConditionalFileStore {
|
|
14
|
+
constructor(options, entryName) {
|
|
15
|
+
this.ignoreEntryFileCache = false;
|
|
16
|
+
this._fileStore = new FileStore(options);
|
|
17
|
+
this.entryName = entryName || 'app';
|
|
18
|
+
}
|
|
19
|
+
isEntryCache(cacheItem) {
|
|
20
|
+
if (!cacheItem)
|
|
21
|
+
return false;
|
|
22
|
+
const { dependencies } = cacheItem;
|
|
23
|
+
if (!dependencies || !dependencies.length) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
for (const d of dependencies) {
|
|
27
|
+
if (d.name.includes(`${this.entryName}.config`)) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
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;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
set(key, value) {
|
|
43
|
+
var _a, _b, _c, _d, _e;
|
|
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);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
clear() {
|
|
53
|
+
this._fileStore.clear();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.default = ConditionalFileStore;
|
|
57
|
+
//# sourceMappingURL=conditional-file-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,UAAU,GAAG,IAAI,SAAS,CAAI,OAAO,CAAC,CAAA;QAC3C,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,KAAK,CAAA;IACrC,CAAC;IAED,YAAY,CAAE,SAAS;QACrB,IAAI,CAAC,SAAS;YAAE,OAAO,KAAK,CAAA;QAC5B,MAAM,EAAE,YAAY,EAAE,GAAG,SAAS,CAAA;QAClC,IAAI,CAAC,YAAY,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;YACzC,OAAO,KAAK,CAAA;SACb;QAED,KAAK,MAAM,CAAC,IAAI,YAAY,EAAE;YAC5B,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,SAAS,SAAS,CAAC,EAAE;gBAC/C,OAAO,IAAI,CAAA;aACZ;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,GAAG,CAAE,GAAW;;YACpB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YAC7C,IAAI,MAAM,IAAI,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;gBACpE,OAAO,IAAI,CAAA;aACZ;YACD,OAAO,MAAM,CAAA;QACf,CAAC;KAAA;IAEK,GAAG,CAAE,GAAW,EAAE,KAAU;;;YAChC,gBAAgB;YAChB,IAAI,CAAA,MAAA,MAAA,MAAA,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,0CAAG,CAAC,CAAC,0CAAE,IAAI,0CAAE,WAAW,0CAAE,KAAK,0CAAE,OAAO,CAAC,sBAAsB,CAAC,IAAG,CAAC,CAAC,EAAE;gBACtF,OAAM;aACP;YACD,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;;KAC7C;IAED,KAAK;QACH,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;IACzB,CAAC;CACF;AA5CD,uCA4CC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRNConfigTransformer = exports.getRNConfigOutput = exports.getRNConfigEntry = exports.getRNConfigBabelPlugin = exports.getRNConfig = exports.getConfig = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
let config;
|
|
7
|
+
let rnConfig;
|
|
8
|
+
const getConfig = () => {
|
|
9
|
+
if (config)
|
|
10
|
+
return config;
|
|
11
|
+
const fileName = `${process.cwd()}/config/index.js`;
|
|
12
|
+
if (fs.existsSync(fileName)) {
|
|
13
|
+
config = require(`${process.cwd()}/config/index`)(lodash_1.merge);
|
|
14
|
+
return config;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
console.warn('缺少项目基本配置');
|
|
18
|
+
config = {};
|
|
19
|
+
return config;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.getConfig = getConfig;
|
|
23
|
+
const getRNConfig = () => {
|
|
24
|
+
getConfig();
|
|
25
|
+
if (rnConfig)
|
|
26
|
+
return rnConfig;
|
|
27
|
+
if (config.rn) {
|
|
28
|
+
rnConfig = config.rn;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
rnConfig = {};
|
|
32
|
+
}
|
|
33
|
+
return rnConfig;
|
|
34
|
+
};
|
|
35
|
+
exports.getRNConfig = getRNConfig;
|
|
36
|
+
const getRNConfigEntry = () => {
|
|
37
|
+
getRNConfig();
|
|
38
|
+
return rnConfig.entry || 'app';
|
|
39
|
+
};
|
|
40
|
+
exports.getRNConfigEntry = getRNConfigEntry;
|
|
41
|
+
const getRNConfigOutput = (p) => {
|
|
42
|
+
getRNConfig();
|
|
43
|
+
if (rnConfig.output) {
|
|
44
|
+
if (p === 'ios') {
|
|
45
|
+
return rnConfig.output.ios;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return rnConfig.output.android;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
exports.getRNConfigOutput = getRNConfigOutput;
|
|
56
|
+
const getRNConfigTransformer = () => {
|
|
57
|
+
getRNConfig();
|
|
58
|
+
if (rnConfig.transformer) {
|
|
59
|
+
return rnConfig.transformer;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
exports.getRNConfigTransformer = getRNConfigTransformer;
|
|
66
|
+
const getRNConfigBabelPlugin = () => {
|
|
67
|
+
getRNConfig();
|
|
68
|
+
if (rnConfig.babelPlugin) {
|
|
69
|
+
return rnConfig.babelPlugin;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.getRNConfigBabelPlugin = getRNConfigBabelPlugin;
|
|
76
|
+
//# sourceMappingURL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IAAI,QAAQ,CAAC,MAAM,EAAE;QACnB,IAAI,CAAC,KAAK,KAAK,EAAE;YACf,OAAO,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAA;SAC3B;aAAM;YACL,OAAO,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAA;SAC/B;KACF;SAAM;QACL,OAAO,IAAI,CAAA;KACZ;AACH,CAAC,CAAA;AAoB0E,8CAAiB;AAlB5F,MAAM,sBAAsB,GAAG,GAAG,EAAE;IAClC,WAAW,EAAE,CAAA;IACb,IAAI,QAAQ,CAAC,WAAW,EAAE;QACxB,OAAO,QAAQ,CAAC,WAAW,CAAA;KAC5B;SAAM;QACL,OAAO,IAAI,CAAA;KACZ;AACH,CAAC,CAAA;AAW6F,wDAAsB;AATpH,MAAM,sBAAsB,GAAG,GAAG,EAAE;IAClC,WAAW,EAAE,CAAA;IACb,IAAI,QAAQ,CAAC,WAAW,EAAE;QACxB,OAAO,QAAQ,CAAC,WAAW,CAAA;KAC5B;SAAM;QACL,OAAO,IAAI,CAAA;KACZ;AACH,CAAC,CAAA;AAEgC,wDAAsB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.defaultConfig = void 0;
|
|
13
|
+
const resolveReactNativePath_1 = require("@react-native-community/cli-config/build/resolveReactNativePath");
|
|
14
|
+
const cli_tools_1 = require("@react-native-community/cli-tools");
|
|
15
|
+
const rn_supporter_1 = require("@tarojs/rn-supporter");
|
|
16
|
+
const Metro = require("metro");
|
|
17
|
+
const os = require("os");
|
|
18
|
+
const path = require("path");
|
|
19
|
+
const conditional_file_store_1 = require("./conditional-file-store");
|
|
20
|
+
const reactNativePath = (0, resolveReactNativePath_1.default)((0, cli_tools_1.findProjectRoot)());
|
|
21
|
+
const defaultConfig = getDefaultConfig();
|
|
22
|
+
exports.defaultConfig = defaultConfig;
|
|
23
|
+
function getDefaultConfig() {
|
|
24
|
+
const supporter = new rn_supporter_1.Supporter({ fromRunner: true });
|
|
25
|
+
const taroMetroConfig = supporter.getMetroConfig();
|
|
26
|
+
const metroConfig = {
|
|
27
|
+
transformer: taroMetroConfig.transformer,
|
|
28
|
+
resolver: taroMetroConfig.resolver,
|
|
29
|
+
serializer: {
|
|
30
|
+
// We can include multiple copies of InitializeCore here because metro will
|
|
31
|
+
// only add ones that are already part of the bundle
|
|
32
|
+
getModulesRunBeforeMainModule: () => [
|
|
33
|
+
require.resolve(path.join(reactNativePath, 'Libraries/Core/InitializeCore'))
|
|
34
|
+
],
|
|
35
|
+
getPolyfills: () => require(path.join(reactNativePath, 'rn-get-polyfills'))()
|
|
36
|
+
},
|
|
37
|
+
cacheStores: [new conditional_file_store_1.default({
|
|
38
|
+
root: path.join(os.tmpdir(), 'metro-cache')
|
|
39
|
+
})],
|
|
40
|
+
server: {
|
|
41
|
+
port: 8081
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return metroConfig;
|
|
45
|
+
}
|
|
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
|
+
});
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4GAAoG;AACpG,iEAAmE;AACnE,uDAAgD;AAChD,+BAA8B;AAC9B,yBAAwB;AACxB,6BAA4B;AAE5B,qEAA2D;AAE3D,MAAM,eAAe,GAAW,IAAA,gCAAsB,EAAC,IAAA,2BAAe,GAAE,CAAC,CAAA;AAyBzE,MAAM,aAAa,GAAgB,gBAAgB,EAAE,CAAA;AAyC5C,sCAAa;AAvCtB,SAAS,gBAAgB;IACvB,MAAM,SAAS,GAAG,IAAI,wBAAS,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IACrD,MAAM,eAAe,GAAG,SAAS,CAAC,cAAc,EAAE,CAAA;IAClD,MAAM,WAAW,GAAgB;QAC/B,WAAW,EAAE,eAAe,CAAC,WAAW;QACxC,QAAQ,EAAE,eAAe,CAAC,QAAQ;QAClC,UAAU,EAAE;YACV,2EAA2E;YAC3E,oDAAoD;YACpD,6BAA6B,EAAE,GAAG,EAAE,CAAC;gBACnC,OAAO,CAAC,OAAO,CACb,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,+BAA+B,CAAC,CAC5D;aACF;YACD,YAAY,EAAE,GAAG,EAAE,CACjB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC,EAAE;SAC5D;QACD,WAAW,EAAE,CAAC,IAAI,gCAAoB,CAAM;gBAC1C,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,aAAa,CAAC;aAC5C,CAAC,CAAC;QACH,MAAM,EAAE;YACN,IAAI,EAAE,IAAI;SACX;KACF,CAAA;IACD,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,kBAAe,CAAO,MAAW,EAAE,EAAE;IACnC,MAAM,WAAW,GAAG,gBAAgB,EAAE,CAAA;IACtC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,EAAE,EAAE,WAAW,CAAC,CAAA;IACnD,IAAI,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,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"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fs_1 = require("fs");
|
|
4
|
+
const http_1 = require("http");
|
|
5
|
+
const mime = require("mime-types");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const qr = require("qrcode-terminal");
|
|
8
|
+
const url_1 = require("url");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
|
+
const drawableFileTypes = new Set([
|
|
11
|
+
'gif',
|
|
12
|
+
'jpeg',
|
|
13
|
+
'jpg',
|
|
14
|
+
'png',
|
|
15
|
+
'webp',
|
|
16
|
+
'xml'
|
|
17
|
+
]);
|
|
18
|
+
function getAndroidAssetSuffix(scale) {
|
|
19
|
+
switch (scale) {
|
|
20
|
+
case 0.75:
|
|
21
|
+
return 'ldpi';
|
|
22
|
+
case 1:
|
|
23
|
+
return 'mdpi';
|
|
24
|
+
case 1.5:
|
|
25
|
+
return 'hdpi';
|
|
26
|
+
case 2:
|
|
27
|
+
return 'xhdpi';
|
|
28
|
+
case 3:
|
|
29
|
+
return 'xxhdpi';
|
|
30
|
+
case 4:
|
|
31
|
+
return 'xxxhdpi';
|
|
32
|
+
default:
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function getAndroidResourceFolderName(pathname) {
|
|
37
|
+
const ext = (0, path_1.extname)(pathname).replace(/^./, '').toLowerCase();
|
|
38
|
+
if (!drawableFileTypes.has(ext)) {
|
|
39
|
+
return 'raw';
|
|
40
|
+
}
|
|
41
|
+
const suffix = getAndroidAssetSuffix(1); // TODO: auto scale
|
|
42
|
+
const androidFolder = `drawable-${suffix}`;
|
|
43
|
+
return androidFolder;
|
|
44
|
+
}
|
|
45
|
+
function getAndroidResourceIdentifier(pathname) {
|
|
46
|
+
if (pathname[0] === '/') {
|
|
47
|
+
pathname = pathname.substr(1);
|
|
48
|
+
}
|
|
49
|
+
const ext = (0, path_1.extname)(pathname).toLowerCase();
|
|
50
|
+
const extReg = new RegExp(ext + '$');
|
|
51
|
+
return pathname
|
|
52
|
+
.replace(extReg, '')
|
|
53
|
+
.toLowerCase()
|
|
54
|
+
.replace(/\//g, '_')
|
|
55
|
+
.replace(/([^a-z0-9_])/g, '')
|
|
56
|
+
.replace(/^assets_/, '') + ext;
|
|
57
|
+
}
|
|
58
|
+
exports.default = (opt) => {
|
|
59
|
+
const port = process.env.PORT || 8079;
|
|
60
|
+
const host = `http://${(0, utils_1.getOpenHost)()}:${port}`;
|
|
61
|
+
(0, http_1.createServer)(function (request, response) {
|
|
62
|
+
const url = new url_1.URL(request.url || '', host);
|
|
63
|
+
console.log(`${request.method} ${request.url}`);
|
|
64
|
+
if (url.pathname === '/inspector/device') {
|
|
65
|
+
response.writeHead(404);
|
|
66
|
+
response.end('404', 'utf-8');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
let filePath;
|
|
70
|
+
const contentType = mime.lookup(url.pathname);
|
|
71
|
+
if (url.pathname === '/index.js') {
|
|
72
|
+
filePath = opt.out;
|
|
73
|
+
}
|
|
74
|
+
else if (opt.platform === 'ios') {
|
|
75
|
+
filePath = (0, path_1.join)(opt.assetsDest || '', url.pathname);
|
|
76
|
+
}
|
|
77
|
+
else if (opt.platform === 'android') {
|
|
78
|
+
filePath = (0, path_1.join)(opt.assetsDest || '', getAndroidResourceFolderName(url.pathname), getAndroidResourceIdentifier(url.pathname));
|
|
79
|
+
}
|
|
80
|
+
(0, fs_1.readFile)(filePath, function (error, content) {
|
|
81
|
+
if (error) {
|
|
82
|
+
if (error.code === 'ENOENT') {
|
|
83
|
+
response.writeHead(404);
|
|
84
|
+
response.end('404', 'utf-8');
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
response.writeHead(500);
|
|
88
|
+
response.end('500', 'utf-8');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
response.writeHead(200, { 'Content-Type': contentType });
|
|
93
|
+
response.end(content, 'utf-8');
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}).listen(port);
|
|
97
|
+
const url = `${host}/index.js`;
|
|
98
|
+
console.log(utils_1.PLAYGROUNDINFO);
|
|
99
|
+
console.log(`print qrcode of ${opt.platform} bundle '${url}':`);
|
|
100
|
+
qr.generate(url, { small: !utils_1.isWin });
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/config/preview.ts"],"names":[],"mappings":";;AAAA,2BAA6B;AAC7B,+BAAmC;AACnC,mCAAkC;AAClC,+BAAoC;AACpC,sCAAqC;AACrC,6BAAyB;AAEzB,oCAA6D;AAQ7D,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS;IACxC,KAAK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E,4BAA4B,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,4BAA4B,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAA;SAC9H;QAED,IAAA,aAAQ,EAAC,QAAQ,EAAE,UAAU,KAAK,EAAE,OAAO;YACzC,IAAI,KAAK,EAAE;gBACT,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;oBAC3B,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;oBACvB,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;iBAC7B;qBAAM;oBACL,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;oBACvB,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;iBAC7B;aACF;iBAAM;gBACL,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC,CAAA;gBACxD,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;aAC/B;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAEf,MAAM,GAAG,GAAG,GAAG,IAAI,WAAW,CAAA;IAC9B,OAAO,CAAC,GAAG,CAAC,sBAAc,CAAC,CAAA;IAC3B,OAAO,CAAC,GAAG,CAAC,mBAAmB,GAAG,CAAC,QAAQ,YAAY,GAAG,IAAI,CAAC,CAAA;IAC/D,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,aAAK,EAAE,CAAC,CAAA;AACrC,CAAC,CAAA"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TerminalReporter = void 0;
|
|
13
|
+
const rn_supporter_1 = require("@tarojs/rn-supporter");
|
|
14
|
+
const MetroTerminalReporter = require("metro/src/lib/TerminalReporter");
|
|
15
|
+
const metro_core_1 = require("metro-core");
|
|
16
|
+
class TerminalReporter {
|
|
17
|
+
constructor(entry, sourceRoot, conditionalFileStore, metroServerInstance) {
|
|
18
|
+
this._reporter = new MetroTerminalReporter(new metro_core_1.Terminal(process.stdout));
|
|
19
|
+
this._conditionalFileStore = conditionalFileStore;
|
|
20
|
+
this.metroServerInstance = metroServerInstance;
|
|
21
|
+
this._initialized = false;
|
|
22
|
+
this._entry = entry;
|
|
23
|
+
this._sourceRoot = sourceRoot;
|
|
24
|
+
}
|
|
25
|
+
update(args) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
// 当依赖图加载之后,检测app和页面配置文件的变化
|
|
28
|
+
switch (args.type) {
|
|
29
|
+
case 'initialize_started':
|
|
30
|
+
this._reporter.terminal.log(`
|
|
31
|
+
##### ## ##### #### ##### ###### ## #### ##### # # ## ##### # # # ######
|
|
32
|
+
# # # # # # # # # # # # # # # ## # # # # # # # #
|
|
33
|
+
# # # # # # # # # ##### # # # # # # # # # # # # # #####
|
|
34
|
+
# ###### ##### # # ##### # ###### # # # # # ###### # # # # #
|
|
35
|
+
# # # # # # # # # # # # # # # # ## # # # # # # #
|
|
36
|
+
# # # # # #### # # ###### # # #### # # # # # # # ## ######
|
|
37
|
+
`);
|
|
38
|
+
break;
|
|
39
|
+
case 'bundle_build_started':
|
|
40
|
+
args.bundleDetails.entryFile = './index';
|
|
41
|
+
this._reporter.update(args);
|
|
42
|
+
break;
|
|
43
|
+
case 'bundle_build_done':
|
|
44
|
+
{
|
|
45
|
+
this._reporter.update(args);
|
|
46
|
+
const realEntryPath = require.resolve(rn_supporter_1.emptyModulePath);
|
|
47
|
+
if (this._initialized) {
|
|
48
|
+
// 恢复入口页面的缓存
|
|
49
|
+
this._reporter.ignoreEntryFileCache = false;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
this._initialized = true;
|
|
53
|
+
if (!this.metroServerInstance) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const incrementalBundler = this.metroServerInstance.getBundler();
|
|
57
|
+
const deltaBundler = incrementalBundler.getDeltaBundler();
|
|
58
|
+
const bundler = incrementalBundler.getBundler();
|
|
59
|
+
const findEntryGraphId = keys => {
|
|
60
|
+
for (const k of keys) {
|
|
61
|
+
if (JSON.parse(k).entryFile === realEntryPath) {
|
|
62
|
+
return k;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
};
|
|
67
|
+
// 获取入口文件的graph
|
|
68
|
+
const entryGraphId = findEntryGraphId(incrementalBundler._revisionsByGraphId.keys());
|
|
69
|
+
const entryGraphVersion = yield incrementalBundler.getRevisionByGraphId(entryGraphId);
|
|
70
|
+
// 监听DeltaCalculator的change事件,把入口文件也加入到_modifiedFiles集合中
|
|
71
|
+
bundler.getDependencyGraph().then(dependencyGraph => {
|
|
72
|
+
dependencyGraph.getWatcher().on('change', ({ eventsQueue }) => {
|
|
73
|
+
const changedFiles = eventsQueue.map(item => item.filePath);
|
|
74
|
+
// 如果配置文件修改之后,把入口文件添加到修改列表中
|
|
75
|
+
const deltaCalculator = deltaBundler._deltaCalculators.get(entryGraphVersion.graph);
|
|
76
|
+
const isConfigurationModified = keys => {
|
|
77
|
+
for (const k of keys) {
|
|
78
|
+
if (k.includes('.config') && k.includes(this._sourceRoot)) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
};
|
|
84
|
+
if (isConfigurationModified(changedFiles)) {
|
|
85
|
+
// 忽略入口文件的转译结果缓存
|
|
86
|
+
this._conditionalFileStore.ignoreEntryFileCache = true;
|
|
87
|
+
deltaCalculator._modifiedFiles.add(realEntryPath);
|
|
88
|
+
this._reporter.terminal.flush();
|
|
89
|
+
console.log('\nConfiguration(s) are changed.');
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
default:
|
|
96
|
+
this._reporter.update(args);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.TerminalReporter = TerminalReporter;
|
|
103
|
+
//# sourceMappingURL=terminal-reporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-reporter.js","sourceRoot":"","sources":["../../src/config/terminal-reporter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAsD;AACtD,wEAAuE;AACvE,2CAAqC;AAErC,MAAa,gBAAgB;IAQ3B,YAAa,KAAa,EAAE,UAAkB,EAAE,oBAAyB,EAAE,mBAAyB;QAClG,IAAI,CAAC,SAAS,GAAG,IAAI,qBAAqB,CAAC,IAAI,qBAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;QACxE,IAAI,CAAC,qBAAqB,GAAG,oBAAoB,CAAA;QACjD,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAA;QAC9C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAA;QACzB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;QACnB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAA;IAC/B,CAAC;IAEK,MAAM,CAAE,IAAI;;YAChB,2BAA2B;YAC3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