Add a fake `require` to go with the fake `exports`.
This commit is contained in:
parent
fc68a25b21
commit
da95016228
|
@ -303,8 +303,11 @@ function tarCode(filesInOrder, files, write) {
|
||||||
|
|
||||||
// Wrap the following code in a self executing function and assign exports to
|
// 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.
|
// 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) {
|
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)
|
function compressJS(values)
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
<link href="../static/custom/pad.css" rel="stylesheet">
|
<link href="../static/custom/pad.css" rel="stylesheet">
|
||||||
<script src="../static/custom/pad.js"></script>
|
<script src="../static/custom/pad.js"></script>
|
||||||
<style type="text/css" title="dynamicsyntax"></style>
|
<style type="text/css" title="dynamicsyntax"></style>
|
||||||
|
<script type="application/javascript">
|
||||||
|
var require = (function (path) {return (function () {return this}())});
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
var clientVars = {};
|
var clientVars = {};
|
||||||
|
|
||||||
|
var require = (function (path) {return (function () {return this}())});
|
||||||
|
|
||||||
function createCookie(name,value,days)
|
function createCookie(name,value,days)
|
||||||
{
|
{
|
||||||
if (days) {
|
if (days) {
|
||||||
|
|
Loading…
Reference in New Issue