在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 运行流程的更多相关文章

  1. React Native 项目运行在 Web 浏览器上面

    React Native 的出现,让前端工程师拥有了使用 JavaScript 编写原生 APP 的能力.相比之前的 Web app 来说,对于性能和用户体验提升了非常多. 但是 React Nati ...

  2. [转] 三步将你的 React Native 项目运行在 Web 浏览器上面

    React Native 的出现,让前端工程师拥有了使用 JavaScript 编写原生 APP 的能力.相比之前的 Web app 来说,对于性能和用户体验提升了非常多. 但是 React Nati ...

  3. windows安装React Native开发运行环境

    React Native是什么 React Native是facebook开源的一个用于开发app的框架.React Native的设计理念:既拥有Native (原生) 的用户体验.又保留React ...

  4. 解决升级到Xcode10,react native项目运行报错问题

    今天刚升级到Xcode10,就遇到两个报错问题 错误一:Xcode 10: Build input file double-conversion cannot be found error: Buil ...

  5. React Native 启动流程简析

    导读:本文以 react-native-cli 创建的示例工程(安卓部分)为例,分析 React Native 的启动流程. 工程创建步骤可以参考官网.本文所分析 React Native 版本为 v ...

  6. React Native 从入门到原理

    React Native 是最近非常火的一个话题,介绍如何利用 React Native 进行开发的文章和书籍多如牛毛,但面向入门水平并介绍它工作原理的文章却寥寥无几. 本文分为两个部分:上半部分用通 ...

  7. 关于React Native 火热的话题,从入门到原理

    本文授权转载,作者:bestswifter(简书) React Native 是最近非常火的一个话题,介绍如何利用 React Native 进行开发的文章和书籍多如牛毛,但面向入门水平并介绍它工作原 ...

  8. React Native 从入门到原理一

    React Native 从入门到原理一 React Native 是最近非常火的一个话题,介绍如何利用 React Native 进行开发的文章和书籍多如牛毛,但面向入门水平并介绍它工作原理的文章却 ...

  9. React Native 入门到原理(详解)

    抛砖引玉(帮你更好的去理解怎么产生的 能做什么) 砖一.动态配置 由于 AppStore 审核周期的限制,如何动态的更改 app 成为了永恒的话题.无论采用何种方式,我们的流程总是可以归结为以下三部曲 ...

  10. React Native 在 Airbnb(译文)

    在Android,iOS,Web和跨平台框架的横向对比中,React Native本身是一个相对较新且快速开发移动的平台.两年后,我们可以肯定地说React Native在很多方面都是革命性的.这是移 ...

随机推荐

  1. Hibernate学习笔记(二)

    2016/4/22 23:19:44 Hibernate学习笔记(二) 1.1 Hibernate的持久化类状态 1.1.1 Hibernate的持久化类状态 持久化:就是一个实体类与数据库表建立了映 ...

  2. Java集合常用类特点整理

    集合的结构如下图所示: 集合的两个顶级接口分别为:Collection和Map Collection下有两个比较常用的接口分别是List(列表)和Set(集),其中List可以存储重复元素,元素是有序 ...

  3. Unity3d外包(北京)公司(长年承接U3D外包)

    我们制作各类型严肃游戏,虚拟现实,增强现实项目! 品质保证,售后完备. 联系请加QQ:372900288  电话:13911652504 我们团队成立于2011年10月,是一个专业从事严肃游戏研发的团 ...

  4. Nginx基础知识之————RTMP模块中的中HLS专题(翻译文档)

    一.在Nginx配置文件的RTMP模块中配置hls hls_key_path /tmp/hlskeys; 提示错误信息: nginx: [emerg] the same path name " ...

  5. Java多线程同步 synchronized 关键字的使用

    代表这个方法加锁,相当于不管哪一个线程A每次运行到这个方法时,都要检查有没有其它正在用这个方法的线程B(或者C D等),有的话要等正在使用这个方法的线程B(或者C D)运行完这个方法后再运行此线程A, ...

  6. CentOS 配置防火墙操作实例(启、停、开、闭端口):

    CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service   iptables status< ...

  7. 转:使用DBUnit测试时违反外键约束的解决办法

    DBUnit是一个基于junit扩展的数据库测试框架.它提供了大量的类对与数据库相关的操作进行了抽象和封装.它会把数据库表里的数据和一个xml文件关联起来,也就是说它可以让数据在XML文件和数据库之间 ...

  8. loadrunner json

    Action(){ web_custom_request("JRPT_WriteLog", //VuGen中树形视图中显示的名称 "Url=url", //请求 ...

  9. linux rpm -ivh MySQL-server-5.5.31-2.el6.i686.rpm

    linux rpm 安装mysql异常: [root@localhost upload]# rpm -ivh MySQL-server-5.5.31-2.el6.i686.rpmerror: Fail ...

  10. HTML/CSS总结1

    1.定义网页背景颜色 <body bgcolor="背景色"> 颜色可以用2种方式表示:1. 直接指定颜色名称,如blue.2.使用十六进制数据表示如#RRGGBB,分 ...