Skip to content

Commit c746a1c

Browse files
committed
Merge pull request #581 from vjeux/update1
Updates from Wed 1 Apr
2 parents 7a165db + da6766d commit c746a1c

File tree

4 files changed

+27
-19
lines changed

4 files changed

+27
-19
lines changed

React/React.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@
445445
);
446446
runOnlyForDeploymentPostprocessing = 0;
447447
shellPath = /bin/sh;
448-
shellScript = "nc -w 5 -z localhost 8081 > /dev/null 2>&1 || open $SRCROOT/../packager/launchPackager.command || echo \"Can't start packager automatically\"";
448+
shellScript = "if nc -w 5 -z localhost 8081 ; then\n if ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port 8081 already in use, packager is either not running or not running correctly\"\n exit 2\n fi\nelse\n open $SRCROOT/../packager/launchPackager.command || echo \"Can't start packager automatically\"\nfi";
449449
};
450450
/* End PBXShellScriptBuildPhase section */
451451

packager/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ React Native Packager
22
--------------------
33

44
React Native Packager is a project similar in scope to browserify or
5-
webpack; it provides a CommonJS-like module system, JavaScript
5+
webpack, it provides a CommonJS-like module system, JavaScript
66
compilation (ES6, Flow, JSX), bundling, and asset loading.
77

88
The main difference is the Packager's focus on compilation and
99
bundling speed. We aim for a sub-second edit-reload
10-
cycle. Additionally, we don't want users -- with large code bases --
10+
cycles. Additionally, we don't want users -- with large code bases --
1111
to wait more than a few seconds after starting the packager.
1212

1313
The main deviation from the node module system is the support for our
@@ -19,7 +19,7 @@ namely the node module format. We want to even go further, and let you
1919
choose your own packager and asset pipeline or even integrate into
2020
your existing infrastructure.
2121

22-
React Native users need not to understand how the packager works;
22+
React Native users need not to understand how the packager work,
2323
however, this documentation might be useful for advanced users and
2424
people who want to fix bugs or add features to the packager (patches
2525
welcome!).
@@ -45,10 +45,10 @@ Does the following in order:
4545
### /path/to/moduleName.map
4646

4747
* if the package has been previously generated via the `.bundle`
48-
endpoint, then the source map will be generated from that package
48+
endpoint then the source map will be generated from that package
4949
* if the package has not been previously asked for, this will go
50-
through the same steps outlined in the `.bundle` endpoint, then
51-
generate the source map
50+
through the same steps outlined in the `.bundle` endpoint then
51+
generate the source map.
5252

5353
Note that source map generation currently assumes that the code has
5454
been compiled with jstransform, which preserves line and column
@@ -66,15 +66,15 @@ Here are the current options the packager accepts:
6666
* `minify` boolean, defaults to false: whether to minify the bundle.
6767
* `runModule` boolean, defaults to true: whether to require your entry
6868
point module. So if you requested `moduleName`, this option will add
69-
a `require('moduleName')` to the end of your bundle.
69+
a `require('moduleName')` the end of your bundle.
7070
* `inlineSourceMap` boolean, defaults to false: whether to inline
7171
source maps.
7272

7373
### /debug
7474

75-
This is a page used for debugging; it has links to two pages:
75+
This is a page used for debugging, it has links to two pages:
7676

77-
* Cached Packages: which shows you the packages that have already been
77+
* Cached Packages: which shows you the packages that's been already
7878
generated and cached
7979
* Dependency Graph: is the in-memory graph of all the modules and
8080
their dependencies
@@ -103,8 +103,8 @@ middleware. Takes the following options:
103103
packager
104104
* `polyfillModuleName` array: Paths to polyfills you want to be
105105
included at the start of the bundle
106-
* `cacheVersion` string: Used in creating the cache file
107-
* `resetCache` boolean, defaults to false: Whether to use the cache on
106+
* `cacheVersion` string: used in creating the cache file
107+
* `resetCache` boolean, defaults to false: whether to use the cache on
108108
disk
109109
* `transformModulePath` string: Path to the module used as a
110110
JavaScript transformer
@@ -133,6 +133,6 @@ is informed by React Native needs.
133133

134134
### Why didn't you use webpack?
135135

136-
We love webpack; however, when we tried it on our codebase, it was slower
137-
than our developers wanted it to be. You find can more discussion about
138-
the subject [here](https://github.com/facebook/react-native/issues/5).
136+
We love webpack, however, when we tried on our codebase it was slower
137+
than our developers would like it to be. You find can more discussion about
138+
the subject [here](https://github.com/facebook/react-native/issues/5)

packager/packager.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,17 @@ function getDevToolsLauncher(options) {
150150
};
151151
}
152152

153+
// A status page so the React/project.pbxproj build script
154+
// can verify that packager is running on 8081 and not
155+
// another program / service.
156+
function statusPageMiddleware(req, res, next) {
157+
if (req.url === '/status') {
158+
res.end('packager-status:running');
159+
} else {
160+
next();
161+
}
162+
}
163+
153164
function getAppMiddleware(options) {
154165
return ReactPackager.middleware({
155166
projectRoots: options.projectRoots,
@@ -168,6 +179,7 @@ function runServer(
168179
.use(loadRawBody)
169180
.use(openStackFrameInEditor)
170181
.use(getDevToolsLauncher(options))
182+
.use(statusPageMiddleware)
171183
.use(getAppMiddleware(options));
172184

173185
options.projectRoots.forEach(function(root) {

packager/react-packager/src/DependencyResolver/haste/polyfills/require.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,15 +586,11 @@
586586
_register('module', 0);
587587
_register('exports', 0);
588588

589-
_register('define', define);
590589
_register('global', global);
591590
_register('require', require);
592591
_register('requireDynamic', require);
593592
_register('requireLazy', requireLazy);
594593

595-
define.amd = {};
596-
597-
global.define = define;
598594
global.require = require;
599595
global.requireDynamic = require;
600596
global.requireLazy = requireLazy;

0 commit comments

Comments
 (0)