Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running the packager on Windows #781

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packager/blacklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
var path = require('path');

// Don't forget to everything listed here to `testConfig.json`
// modulePathIgnorePatterns.
Expand All @@ -31,7 +32,8 @@ var iosBlacklist = [
];

function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
var escaped = str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
return escaped.replace(/\//g,"\\"+path.sep);
}

function blacklist(isWeb, additionalBlacklist) {
Expand Down
2 changes: 1 addition & 1 deletion packager/packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if (options.projectRoots) {
options.projectRoots = options.projectRoots.split(',');
}
} else {
if (__dirname.match(/node_modules\/react-native\/packager$/)) {
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]packager$/)) {
// packager is running from node_modules of another project
options.projectRoots = [path.resolve(__dirname, '../../..')];
} else {
Expand Down
6 changes: 3 additions & 3 deletions packager/react-packager/src/DependencyResolver/haste/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,18 @@ HasteDependencyResolver.prototype.wrapModule = function(module, code) {
var relativizeCode = function(codeMatch, pre, quot, depName, post) {
var depId = resolvedDeps[depName];
if (depId) {
return pre + quot + depId + post;
return pre + quot + depId.replace(/\\/g,'/') + post;
} else {
return codeMatch;
}
};

return DEFINE_MODULE_CODE.replace(DEFINE_MODULE_REPLACE_RE, function(key) {
return {
'_moduleName_': module.id,
'_moduleName_': module.id.replace(/\\/g, '/'),
'_code_': code.replace(replacePatterns.IMPORT_RE, relativizeCode)
.replace(replacePatterns.REQUIRE_RE, relativizeCode),
'_deps_': JSON.stringify(resolvedDepsArr),
'_deps_': JSON.stringify(resolvedDepsArr.map(function (i) { return i.replace(/\\/g,'/'); })),
}[key];
});
};
Expand Down
2 changes: 1 addition & 1 deletion packager/react-packager/src/FileWatcher/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var detectingWatcherClass = new Promise(function(resolve) {

module.exports = FileWatcher;

var MAX_WAIT_TIME = 3000;
var MAX_WAIT_TIME = 6000;

// Singleton
var fileWatcher = null;
Expand Down
2 changes: 1 addition & 1 deletion packager/react-packager/src/Packager/Package.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Package.prototype.addModule = function(
Package.prototype.finalize = function(options) {
options = options || {};
if (options.runMainModule) {
var runCode = ';require("' + this._mainModuleId + '");';
var runCode = ';require("' + this._mainModuleId.replace(/\\/g,"/") + '");';
this.addModule(
runCode,
runCode,
Expand Down