在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. Log4j源代码学习

    了解log4j的源代码来源于项目中一次需求,我们想将系统所有的warn日志统一收集到common-warn.log的日志中去,以便于系统对其进行监控处理.于是模拟自动生成的error配置完成了warn ...

  2. C# 实现HTML转换成图片的方法

    /// <summary>        /// 通过WebBrowser控件来实现从HTML到Bmp图片的生成.        /// </summary>        / ...

  3. 生成yyMMddHHmmssSS时间戳代码作为唯一主键值

    import java.sql.Time; import java.text.DateFormat; import java.text.ParseException; import java.text ...

  4. WordPress 插件推荐

    1.电商类: Woocommerce 2.幻灯片: Reslider 3.网页编写类: js_composer

  5. Redis使用及优化入门

    Redis的优势 MySQL读写慢,Redis内存数据库,读写速度快. 少量的数据要经常读写,尤其是读操作,读写速度要求高. 丰富的数据结构,Redis支持5种数据结构,MySQL字段变化,需要手动维 ...

  6. php curl 采集

    curl 采集五个步骤: 1.curl_init()初始化curl 2.curl_setopt()设置传输数据和参数 3.curl_exec()执行传输并获取返回数据 4.curl_errono()返 ...

  7. freemarker数字格式化

    1.在模板中直接加.toString()转化数字为字符串,如:${languageList.id.toString()}: 2.在freemarker配置文件freemarker.properties ...

  8. 关于layui

    之前用layer用了很长时间,感觉很好用,最近看到了layui的发布很想尝试尝试. 加入了挺多的功能,比如编辑器,上传,form表单等等.

  9. d3 scale 学习笔记

    讲解scale 的好材料 https://www.dashingd3js.com/d3js-scales

  10. SQL SERVER 2005 DBCC PAGE命令说明

    夏日福利: 小泽玛利亚的“专业摄影”性感写真集:http://947kan.com/video/player-52475-0-0.html ------------------------------ ...