在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. footer绝对定位但是不在页面最下边解决方案

    方案一 html { height: 100%; } body { position: relative; min-height: 100%; box-sizing: border-box; padd ...

  2. U盘修复

    方法一: 1.点开始-运行-输入cmd-format f: /fs: FAT32 (这里f:是指U盘所在盘符) 2.打开控制面板-管理工具-计算机管理-磁盘管理-找到U盘的所在的盘符--点右键--删除 ...

  3. [地图SkyLine二次开发]框架(4)

    继续上一节... 1.Extjs5.0版Menu. -将Extjs包引入MenuPage.html页. 2.前段用Extjs的MVC框架 -在根目录下创建app文件夹,文件夹下分别创建controll ...

  4. 【Hector slam】A Flexible and Scalable SLAM System with Full 3D Motion Estimation

    作者总结了SLAM前端和后端的区别 While SLAM frontends are used to estimate robot movement online in real-time, the ...

  5. 阿里im即时通讯 h5 demo

    适合不想装后台环境的同学,用nodejs搭建服务器. 以下是官网提供的node 请求示例: 找到了一个ali-top-sdk 代替topClient 于是请求示例代码如下: TopClient = r ...

  6. java打印Jni层log

    在eclipse上新建jni工程可以参考:http://www.cnblogs.com/ashitaka/p/5953708.html 要在java层打印c的log必须引入这个头文件的宏定义: #if ...

  7. 使用Memcache缓存mysql数据库操作的原理和缓存过程浅析

    转载自脚本之家 http://www.jb51.net/article/51831.htm  作者:忙碌的松鼠 对于大型网站如facebook,ebay等网站,如果没有Memcache做为中间缓存层, ...

  8. RedHat下apache\ftp\mysql 4.0 的安装方法

    RedHat下安装这三个服务的方法大同小异 Apache服务: 找到Apache安装包: rpm -ivh httpd-2.0.40-21.i386.rpm 等待安装完成即可 检查安装结果: rpm ...

  9. java中使用sql的like关键字

    String sql = "select * from userinfo where nickname like ?"; PreparedStatement ps = conn.p ...

  10. Sort Colors [LeetCode]

    Given an array with n objects colored red, white or blue, sort them so that objects of the same colo ...