react-native start 运行流程
在CMD下键入
C:\Node_JS\MyAwesomeProject>react-native start
运行流程:
C:\Users\Grart\AppData\Roaming\npm\react-native.cmd
C:\Users\Grart\AppData\Roaming\npm\node_modules\react-native-cli\index.js
cli.run();
C:\Node_JS\MyAwesomeProject\node_modules\react-native\cli.js
module.exports = require('./local-cli/cli.js');
C:\Node_JS\MyAwesomeProject\node_modules\react-native\local-cli\cli.js
module.exports = {
run: run,
init: init,
};

C:\Node_JS\MyAwesomeProject\node_modules\react-native\private-cli\src\server\server.js
C:\Node_JS\MyAwesomeProject\node_modules\react-native\private-cli\src\server\runServer.js
function getAppMiddleware(args, config) {
………………………...
return ReactPackager.middleware({
nonPersistent: args.nonPersistent,
projectRoots: args.projectRoots,
blacklistRE: config.getBlacklistRE(),
cacheVersion: '3',
transformModulePath: transformerPath,
assetRoots: args.assetRoots,
assetExts: ['png', 'jpeg', 'jpg'],
resetCache: args.resetCache || args['reset-cache'],
polyfillModuleNames: [
require.resolve(
'../../../Libraries/JavaScriptAppEngine/polyfills/document.js'
),
],
verbose: args.verbose,
});
}
C:\Node_JS\MyAwesomeProject\node_modules\react-native\packager\react-packager\index.js
function createServer(options) {
// the debug module is configured globally, we need to enable debugging
// *before* requiring any packages that use `debug` for logging
if (options.verbose) {
enableDebug();
}
startSocketInterface();
var Server = require('./src/Server');
return new Server(omit(options, ['verbose']));
}
C:\Node_JS\MyAwesomeProject\node_modules\react-native\packager\react-packager\src\Server\index.js
function processRequest(req, res, next) {
…………
const building = this._bundles[optionsJson] || this.buildBundle(options);
this._bundles[optionsJson] = building;
building.then(……
)
…………
}
C:\Node_JS\MyAwesomeProject\node_modules\react-native\packager\react-packager\src\Bundler\index.js
function bundle(main, runModule, sourceMapUrl, isDev, platform) {
const bundle = new Bundle(sourceMapUrl);
const findEventId = Activity.startEvent('find dependencies');
let transformEventId;
return this.getDependencies(main, isDev, platform)
.then(………………
.………………..
}
function getDependencies(main, isDev, platform) {
return this._resolver.getDependencies(main, { dev: isDev, platform });
}
C:\Node_JS\MyAwesomeProject\node_modules\react-native\packager\react-packager\src\DependencyResolver\index.js
HasteDependencyResolver.prototype.getDependencies = function(main, options) {
var opts = getDependenciesValidateOpts(options);
return this._depGraph.getDependencies(main, opts.platform)
.then(
resolutionResponse => {
this._getPolyfillDependencies(opts.dev).reverse().forEach(
polyfill => resolutionResponse.prependDependency(polyfill)
);
return resolutionResponse.finalize();
}
);
};
C:\Node_JS\MyAwesomeProject\node_modules\react-native\packager\react-packager\src\DependencyResolver\DependencyGraph\index
getDependencies(entryPath, platform) {
console.log('call DependencyGraph entryPath='+entryPath);
return this.load()
.then(
() => {
platform = this._getRequestPlatform(entryPath, platform);
const absPath = this._getAbsolutePath(entryPath);
const req = new ResolutionRequest({
platform,
entryPath: absPath,
deprecatedAssetMap: this._deprecatedAssetMap,
hasteMap: this._hasteMap,
helpers: this._helpers,
moduleCache: this._moduleCache,
fastfs: this._fastfs,
});
const response = new ResolutionResponse();
console.log('call ResolutionRequest');
return Promise.all([
req.getOrderedDependencies(response),
req.getAsyncDependencies(response),
]).then(() => response);
}
);
}
C:\Node_JS\MyAwesomeProject\node_modules\react-native\packager\react-packager\src\DependencyResolver\DependencyGraph\ResolutionRequest.js
getOrderedDependencies(response) {….
resolveDependency(fromModule, toModuleName) {….
_resolveNodeDependency(fromModule, toModuleName) {….
_loadAsFile(potentialModulePath, fromModule, toModule) {….
this._fastfs.fileExists(potentialModulePath)
react-native start 运行流程的更多相关文章
- React Native 项目运行在 Web 浏览器上面
React Native 的出现,让前端工程师拥有了使用 JavaScript 编写原生 APP 的能力.相比之前的 Web app 来说,对于性能和用户体验提升了非常多. 但是 React Nati ...
- [转] 三步将你的 React Native 项目运行在 Web 浏览器上面
React Native 的出现,让前端工程师拥有了使用 JavaScript 编写原生 APP 的能力.相比之前的 Web app 来说,对于性能和用户体验提升了非常多. 但是 React Nati ...
- windows安装React Native开发运行环境
React Native是什么 React Native是facebook开源的一个用于开发app的框架.React Native的设计理念:既拥有Native (原生) 的用户体验.又保留React ...
- 解决升级到Xcode10,react native项目运行报错问题
今天刚升级到Xcode10,就遇到两个报错问题 错误一:Xcode 10: Build input file double-conversion cannot be found error: Buil ...
- React Native 启动流程简析
导读:本文以 react-native-cli 创建的示例工程(安卓部分)为例,分析 React Native 的启动流程. 工程创建步骤可以参考官网.本文所分析 React Native 版本为 v ...
- React Native 从入门到原理
React Native 是最近非常火的一个话题,介绍如何利用 React Native 进行开发的文章和书籍多如牛毛,但面向入门水平并介绍它工作原理的文章却寥寥无几. 本文分为两个部分:上半部分用通 ...
- 关于React Native 火热的话题,从入门到原理
本文授权转载,作者:bestswifter(简书) React Native 是最近非常火的一个话题,介绍如何利用 React Native 进行开发的文章和书籍多如牛毛,但面向入门水平并介绍它工作原 ...
- React Native 从入门到原理一
React Native 从入门到原理一 React Native 是最近非常火的一个话题,介绍如何利用 React Native 进行开发的文章和书籍多如牛毛,但面向入门水平并介绍它工作原理的文章却 ...
- React Native 入门到原理(详解)
抛砖引玉(帮你更好的去理解怎么产生的 能做什么) 砖一.动态配置 由于 AppStore 审核周期的限制,如何动态的更改 app 成为了永恒的话题.无论采用何种方式,我们的流程总是可以归结为以下三部曲 ...
- React Native 在 Airbnb(译文)
在Android,iOS,Web和跨平台框架的横向对比中,React Native本身是一个相对较新且快速开发移动的平台.两年后,我们可以肯定地说React Native在很多方面都是革命性的.这是移 ...
随机推荐
- my.cnf
skip-external-locking skip-name-resolve back_log= key_buffer_size=384M max_allowed_packet=4M thread_ ...
- Javascript学习笔记:闭包题解(2)
代码: var name='The Window'; var object={ name:'My Object', getNameFunc:function(){ return function(){ ...
- 使用idea15搭建基于maven的springmvc-mybatis框架
我这边使用的是intellij idea15 1.new maven webapp project 2.添加groupId和artifactId 3.选择maven路径和maven仓库路径 最后确定之 ...
- 在ionic/cordova中使用Form模型验证(w5cValidator)
在构建ionic项目过程中,当我们创建一个类似表单提交的页面时,可能会对用户的输入内容做某些规则验证,通过后再执行提交处理. 在验证的过程中,为了提供较好的用户体验,可能希望有类似于jquery Va ...
- Jmeter学习(一)
最近测了一个导出功能,感觉应该学习下Jmeter,WEB系统的性能系统还是需要有一定累积. 选择Jmeter而不是LR,很简单的原因是QTP和LR不能装一台机器上. 也有很多测试人员推荐Jmeter, ...
- java中观察者模式Observable和Observer
25.java中观察者模式Observable和Observer 如果想要实现观察者模式,则必须依靠java.util包中提供的Observable类和Observer接口 观察者设计模式 现在很多的 ...
- ssh启动报错:org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect
ssh项目启动报错: org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection t ...
- [android]判断位置服务是否打开
public boolean isLocationEnabled() { int locationMode = 0; String locationProviders; if (Build.VERSI ...
- Socket.io和Redis写Realtime App 之express初试
第一步:用npm下载express前端框架 注意事项:首先要确保已经安装了node.js和 npm 然后在项目中创建一个package.json文件,不能完全为空不写,至少要有两个大括号,不然怎么证明 ...
- javascript中this指针
看完此片文章豁然开朗,非常感谢.javascript技术难点(三)之this.new.apply和call详解 下面说一说自己的理解: this指针总是指向调用他的对象,其实我更愿意理解为:this指 ...