在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. Google开源SLAM软件cartographer中使用的UKF滤波器解析

    在Google开源SLAM软件cartographer中,相对<SLAM for dummies>使用了更为复杂.性能更好的Scan匹配与UKF算法,这里简单介绍下cartographer ...

  2. ajax请求总是进入Error里

    ajax请求时找到了正确的地址,执行完返回总是进入error里,并且浏览器错误显示是找不到请求的地址. 解决办法: 查看配置文件的,把maxJsonLength值改大. <system.web. ...

  3. python连接mysql的驱动

    对于py2.7的朋友,直接可以用MySQLdb去连接,但是MySQLdb不支持python3.x.这是需要注意的~ 那应该用什么python连接mysql的驱动呢,在stackoverflow上有人解 ...

  4. [转]解决:Entity Framework + MariaDb(MySql)中文乱码

    转自:http://fenglongsheng.com/post/6640.html 今天写一MVC4+Entity Framework+Mysql的小例子时,发现中文写到数据库里是N个问号(乱码哦~ ...

  5. Treap

    treap模板 期望复杂度为O(nlogn) 带合并的treap期望复杂度为O(nlognlogn) #include <bits/stdc++.h> ; struct tree{ int ...

  6. mysql 5.6.34 二进制

    安装方法 http://dev.mysql.com/doc/refman/5.6/en/binary-installation.html shell> groupadd mysqlshell&g ...

  7. folder、source folder、package 区别与联系

    在eclipse下,package,source folder,folder都是文件夹.  它们的区别如下:  package:当你在建立一个package时,它自动建立到source folder下 ...

  8. 【UE4+Vive】学习笔记1

    16.9.10为了做房产项目,这两天开始学习Unreal Engine 4.之前一直用unity,但是视觉效果一直不满意,听说虚幻4的效果更好,就来试一试水. 1.安装UE4 参考资料一: http: ...

  9. React初识(按钮点击+输入绑定)

    简单按钮点击事件: <!DOCTYPE html><html>  <head>  <meta charset="utf-8">    ...

  10. CIDR风格

    CIDR地址中包含标准的32位IP地址和有关网络前缀位数的信息. eg: 地址:192.168.10.0/24,其中/24标示前面地址中的前24位代表网络部分,其余代表主机部分. 11000000 1 ...