Skip to content
Browse files

Improve browserification

  • Loading branch information...
1 parent ed602dc commit 2b7b88a3f53f4dbd5541435673794e7bc11e271f @ixti ixti committed Jul 2, 2012
Showing with 22 additions and 18 deletions.
  1. +1 −1 Makefile
  2. +8 −6 demo/js/js-yaml.js
  3. +0 −2 index.browserify.js
  4. +8 −6 js-yaml.js
  5. +3 −3 js-yaml.min.js
  6. +1 −0 support/browserify/40_before.js
  7. +1 −0 support/browserify/60_after.js
View
2 Makefile
@@ -97,7 +97,7 @@ browserify:
if test ! `which browserify` ; then npm install browserify ; fi
if test ! `which uglifyjs` ; then npm install uglify-js ; fi
cp -r support/browserify/ ${TMP_PATH}
- browserify index.browserify.js -o ${TMP_PATH}/50_js-yaml.js
+ browserify -r ./index -o ${TMP_PATH}/50_js-yaml.js
cat ${TMP_PATH}/* > js-yaml.js
rm -rf ${TMP_PATH}
cp js-yaml.js demo/js/
View
14 demo/js/js-yaml.js
@@ -70,7 +70,8 @@ if (!Object.getOwnPropertyNames) {
return names;
};
}
-(function(){var require = function (file, cwd) {
+var jsyaml = window.jsyaml = (function () {
+var require = function (file, cwd) {
var resolved = require.resolve(file, cwd || '/');
var mod = require.modules[resolved];
if (!mod) throw new Error(
@@ -436,6 +437,11 @@ process.binding = function (name) {
})();
});
+require.define("/package.json",function(require,module,exports,__dirname,__filename,process){module.exports = {"main":"./index.js"}});
+
+require.define("/index.js",function(require,module,exports,__dirname,__filename,process){module.exports = require('./lib/js-yaml.js');
+});
+
require.define("/lib/js-yaml.js",function(require,module,exports,__dirname,__filename,process){'use strict';
@@ -5217,8 +5223,4 @@ module.exports.Constructor = Constructor;
// vim:ts=2:sw=2
////////////////////////////////////////////////////////////////////////////////
});
-
-require.define("/index.browserify.js",function(require,module,exports,__dirname,__filename,process){window.jsyaml = require('./lib/js-yaml.js');
-});
-require("/index.browserify.js");
-})();
+return require('./index'); }());
View
2 index.browserify.js
@@ -1,2 +0,0 @@
-/*global window*/
-window.jsyaml = require('./lib/js-yaml.js');
View
14 js-yaml.js
@@ -70,7 +70,8 @@ if (!Object.getOwnPropertyNames) {
return names;
};
}
-(function(){var require = function (file, cwd) {
+var jsyaml = window.jsyaml = (function () {
+var require = function (file, cwd) {
var resolved = require.resolve(file, cwd || '/');
var mod = require.modules[resolved];
if (!mod) throw new Error(
@@ -436,6 +437,11 @@ process.binding = function (name) {
})();
});
+require.define("/package.json",function(require,module,exports,__dirname,__filename,process){module.exports = {"main":"./index.js"}});
+
+require.define("/index.js",function(require,module,exports,__dirname,__filename,process){module.exports = require('./lib/js-yaml.js');
+});
+
require.define("/lib/js-yaml.js",function(require,module,exports,__dirname,__filename,process){'use strict';
@@ -5217,8 +5223,4 @@ module.exports.Constructor = Constructor;
// vim:ts=2:sw=2
////////////////////////////////////////////////////////////////////////////////
});
-
-require.define("/index.browserify.js",function(require,module,exports,__dirname,__filename,process){window.jsyaml = require('./lib/js-yaml.js');
-});
-require("/index.browserify.js");
-})();
+return require('./index'); }());
View
6 js-yaml.min.js
3 additions, 3 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
1 support/browserify/40_before.js
@@ -0,0 +1 @@
+var jsyaml = window.jsyaml = (function () {
View
1 support/browserify/60_after.js
@@ -0,0 +1 @@
+return require('./index'); }());

0 comments on commit 2b7b88a

Please sign in to comment.
Something went wrong with that request. Please try again.