Add a fake require to go with the fake exports.

This commit is contained in:
Chad Weider 2012-01-15 19:46:50 -08:00
parent fc68a25b21
commit da95016228
3 changed files with 9 additions and 1 deletions

View file

@ -303,8 +303,11 @@ function tarCode(filesInOrder, files, write) {
// Wrap the following code in a self executing function and assign exports to
// global. This is a first step towards removing symbols from the global scope.
// exports is global and require is a function that returns global.
function isolateJS(code) {
return '(function (exports) {'+code+'\n}(function () {return this}()));\n';
return '(function (exports, require) {'
+ code + '\n'
+ '}(function () {return this}(), (function (path) {return (function () {return this}())})));\n';
}
function compressJS(values)

View file

@ -18,6 +18,9 @@
<link href="../static/custom/pad.css" rel="stylesheet">
<script src="../static/custom/pad.js"></script>
<style type="text/css" title="dynamicsyntax"></style>
<script type="application/javascript">
var require = (function (path) {return (function () {return this}())});
</script>
</head>
<body>

View file

@ -19,6 +19,8 @@
// <![CDATA[
var clientVars = {};
var require = (function (path) {return (function () {return this}())});
function createCookie(name,value,days)
{
if (days) {