Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added c compiler code

  • Loading branch information...
commit d1c8c8f35992ab5b2ca4e0d14f6c78eae47c338a 1 parent 07d5b8b
@davglass authored
View
15 compiler/Makefile
@@ -0,0 +1,15 @@
+all: files source
+
+source:
+ node-waf configure build
+
+files: clean
+ ./scripts/fetch_source.js
+ make sync
+
+sync:
+ cat ../lib/* >> ./src/lib/nodejs_yui3.js
+ cp ./src/yui.js ./src/lib/
+
+clean:
+ ./scripts/clean.sh
View
15 compiler/scripts/clean.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+if [ -d ./build ]; then
+ rm -r ./build
+fi
+
+if [ -d ./src ]; then
+ rm -r ./src
+ mkdir ./src
+fi
+
+if [ -d .lock-wscript ]; then
+ rm -r .lock-wscript
+fi
+
View
81 compiler/scripts/custom_source.js
@@ -0,0 +1,81 @@
+#!/usr/bin/env node
+
+var yui3 = require('yui3'),
+ fs = require('fs'),
+ path = require('path'),
+ cli = require('cli'),
+ start = (new Date()).getTime();
+
+ post = path.join(__dirname, '../src/lib');
+
+if (!path.existsSync(post)) {
+ fs.mkdirSync(post, 0777);
+}
+
+
+cli.enable('status', 'help');
+cli.parse({
+ modules: ['m', 'Required: Comma seperated list of modules to pass to YUI().use()', 'string'],
+ filter: ['f', 'The file type to produce: debug, raw, min', 'string', 'min'],
+ version: ['v', 'The YUI version to use', 'string', '3.3.0'],
+ gversion: ['gv', 'The Gallery version to use', 'string'],
+ yui2: ['yui2', 'The YUI2 version to use', 'string', '2.8.0']
+});
+
+var parseUse = function(u) {
+ u = u.replace(/ /g, '').split(',');
+ return u;
+}
+
+cli.main(function() {
+ if (!this.options.modules) {
+ cli.getUsage();
+ return;
+ }
+
+ var opts = this.options;
+ //Hack to make sure loader is in the queue
+ var o = opts.modules.split(',');
+ o.push('loader');
+ opts.modules = o.join(',');
+ var config = {
+ m: opts.modules,
+ v: opts.version,
+ parse: true,
+ filt: opts.filter,
+ '2in3v': opts.yui2
+ };
+ config.env = 'get';
+
+ if (opts.gversion) {
+ config.gv = opts.gversion;
+ }
+ yui3.rls(config, function(err, data) {
+ var size = 0;
+ var d = [],
+ pre = [],
+ count = 0;
+ console.log(data.js);
+ for (var k in data.d) {
+ size += data.d[k].length;
+ if (count < 2) {
+ pre.push(data.d[k]);
+ } else {
+ //d.push(data.d[k]);
+ var parts = k.split('/');
+ //Only test against minned files. all others will be loaded from disk
+ var name = (parts[parts.length - 1]).replace(/-/g, '_').replace('_min.js', '');
+
+ fs.writeFileSync(path.join(post, name + '.js'), data.d[k], encoding='utf8');
+ }
+
+ count++;
+ };
+ fs.writeFileSync(path.join(__dirname, '../src/yui.js'), pre.join('\n'), encoding='utf8');
+
+ console.log('Files: ', d.length);
+ console.log('Build Time: %sms', (new Date()).getTime() - start);
+ });
+
+});
+
View
67 compiler/scripts/fetch_source.js
@@ -0,0 +1,67 @@
+#!/usr/bin/env node
+
+var yui3 = require('yui3-core@3.3.0').path(),
+ fs = require('fs'),
+ path = require('path'),
+ util = require('util'),
+ noop = function() {},
+ copyFile = function(src, dest, cb) {
+ var is = fs.createReadStream(src);
+ var os = fs.createWriteStream(dest, { flags: 'a+' });
+ util.pump(is, os, cb);
+ },
+ yui3_base = path.join(yui3, 'build'),
+ pre = path.join(__dirname, '../src/yui.js'),
+ post = path.join(__dirname, '../src/lib');
+
+if (!path.existsSync(post)) {
+ fs.mkdirSync(post, 0777);
+}
+
+console.log('Reading Main Directory');
+var dirs = fs.readdirSync(yui3_base);
+
+var preFiles = [];
+var finalFiles = [];
+
+dirs.forEach(function(d) {
+ if (d.indexOf('.') === 0) {
+ return;
+ }
+ files = fs.readdirSync(path.join(yui3_base, d));
+ files.forEach(function(file) {
+ switch (file) {
+ case 'text-data-accentfold-min.js':
+ case 'text-min.js':
+ case 'text-data-wordbreak-min.js':
+ //Non-Ascii Characters, need to fix this in the C file
+ return;
+ }
+ if (d === 'yui' || d === 'loader' || d === 'io') {
+ if (file.indexOf(d + '-min.js') === 0) {
+ preFiles.push(path.join(yui3_base, d, file));
+ }
+ return;
+ } else {
+ if (file.indexOf('-min.js') > 0) {
+ finalFiles.push({ file: path.join(yui3_base, d, file), name: file.replace(/-/g, '_').replace('_min.js', '.js') });
+ }
+ }
+ });
+});
+
+preFiles = preFiles.reverse(); //YUI needs to come first ;)
+
+copyFile(preFiles[0], pre, function() {
+ copyFile(preFiles[1], pre, noop);
+});
+
+var copy = function() {
+ if (finalFiles.length) {
+ var i = finalFiles.pop();
+ copyFile(i.file, path.join(post, i.name), copy);
+ }
+}
+console.log('Copying', finalFiles.length, 'files');
+copy();
+
View
23 compiler/test/load-js.js
@@ -0,0 +1,23 @@
+#!/usr/bin/env node
+
+var startTime = (new Date()).getTime(),
+ times = [],
+ max = 500;
+
+for (var i = 0; i < max; i++) {
+ var start = (new Date()).getTime();
+ var YUI = require('yui3').YUI;
+ YUI({debug: false}).useSync('yql');
+ var end = (new Date()).getTime();
+ times.push((end - start));
+}
+
+var endTime = (new Date()).getTime(),
+ t = 0;
+times.forEach(function(v) {
+ t += v;
+});
+
+console.log('Test time: ', ((endTime - startTime) / 1000), 'sec');
+console.log('Average Time: ', ((t / max) / 1000), 'sec');
+
View
44 compiler/test/load.js
@@ -0,0 +1,44 @@
+#!/usr/bin/env node
+var util = require('util'),
+ assert = require('assert'),
+ i, start, end, times, startTime, endTime, t,
+ max = 10500;
+
+console.log('Starting C++ Load test with', max, 'requires');
+
+var print = function(i) {
+ var per = Math.round(Math.max((i / max) * 100)),
+ bar = '', o;
+ for (o = 0; o < 50; o++) {
+ if ((o*2) <= per) {
+ bar += '#';
+ }
+ }
+ util.print('\r(' + i + ') ' + per + '% ' + bar);
+}
+
+startTime = (new Date()).getTime();
+times = [];
+
+for (var i = 0; i <= max; i++) {
+ start = (new Date()).getTime();
+ var yui3 = require('../yui');
+ var YUI = yui3.YUI;
+ var Y = YUI({debug: false}).useSync('yql');
+ //assert.ok(Y.YQL);
+ end = (new Date()).getTime();
+ times.push((end - start));
+ print(i);
+}
+
+endTime = (new Date()).getTime();
+t = 0;
+
+times.forEach(function(v) {
+ t += v;
+});
+
+util.print('\r\n');
+console.log('Test time: ', ((endTime - startTime) / 1000), 'sec');
+console.log('Average Time: ', ((t / max) / 1000), 'sec');
+
View
47 compiler/test/rls.js
@@ -0,0 +1,47 @@
+#!/usr/bin/env node
+var start = (new Date()).getTime();
+var yui3 = require('yui3-compiled');
+var path = require('path');
+yui3.rls({
+ //m: 'yui,loader,dd,widget,autocomplete,gallery-yql,yui2-datatable,gallery-aui-toolbar',
+ //m: 'yui,loader,dd',
+ //m: 'dd',
+ m: 'loader,dd,widget,autocomplete,gallery-yql,yui2-datatable',
+ //m: 'yui',
+ //env: 'yui',
+ //m: 'dd,widget,autocomplete,gallery-yql,yui2-datatable',
+ //env: 'node,attribute',
+ //v: 'yui3-core@3.2.0',
+ //v: '3.2.0',
+ //gv: '2010.09.22',
+ //parse: true //This parses the file content and returns it as the last arg
+ //gmeta: __dirname + '/gallery-meta.js',
+ //yui2meta: __dirname + '/2in3-meta.js',
+ //filt: 'debug',
+ //'2in3v': '2.8.0',
+ GlobalConfig: {
+ loaderPath: path.join(__dirname, '..', 'tests', 'extras', '/loader-min.js'),
+ debug: true
+ }
+}, function(err, data) {
+ var end = (new Date()).getTime() - start;
+ console.log('Callback..');
+ console.log(data.js);
+ console.log(data.css);
+ var size = 0;
+ for (var i in data.d) {
+ if (data.d[i]) {
+ size += data.d[i].length;
+ console.log('i: ', i, (data.d[i].length));
+ }
+ }
+ console.log('Total: ', [].concat(data.js, data.css).length);
+ console.log('Total JS: ', data.js.length);
+ console.log('Total CSS: ', data.css.length);
+ console.log('Data: ', Object.keys(data.d).length);
+ console.log('Size: (bytes)', size);
+ console.log('Time: %sms', end);
+
+});
+
+
View
367 compiler/tools/js2c.py
@@ -0,0 +1,367 @@
+#!/usr/bin/env python
+#
+# Copyright 2006-2008 the V8 project authors. All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# This is a utility for converting JavaScript source code into C-style
+# char arrays. It is used for embedded JavaScript code in the V8
+# library.
+
+import os
+from os.path import dirname
+import re
+import sys
+import string
+
+sys.path.append(dirname(__file__) + "/../deps/v8/tools");
+import jsmin
+
+
+def ToCArray(filename, lines):
+ result = []
+ row = 1
+ col = 0
+ for chr in lines:
+ col += 1
+ if chr == "\n" or chr == "\r":
+ row += 1
+ col = 0
+
+ value = ord(chr)
+
+ if value > 128:
+ print 'non-ascii value ' + filename + ':' + str(row) + ':' + str(col)
+ sys.exit(1);
+
+ result.append(str(value))
+ result.append("0")
+ return ", ".join(result)
+
+
+def CompressScript(lines, do_jsmin):
+ # If we're not expecting this code to be user visible, we can run it through
+ # a more aggressive minifier.
+ if do_jsmin:
+ minifier = JavaScriptMinifier()
+ return minifier.JSMinify(lines)
+
+ # Remove stuff from the source that we don't want to appear when
+ # people print the source code using Function.prototype.toString().
+ # Note that we could easily compress the scripts mode but don't
+ # since we want it to remain readable.
+ #lines = re.sub('//.*\n', '\n', lines) # end-of-line comments
+ #lines = re.sub(re.compile(r'/\*.*?\*/', re.DOTALL), '', lines) # comments.
+ #lines = re.sub('\s+\n+', '\n', lines) # trailing whitespace
+ return lines
+
+
+def ReadFile(filename):
+ file = open(filename, "rt")
+ try:
+ lines = file.read()
+ finally:
+ file.close()
+ return lines
+
+
+def ReadLines(filename):
+ result = []
+ for line in open(filename, "rt"):
+ if '#' in line:
+ line = line[:line.index('#')]
+ line = line.strip()
+ if len(line) > 0:
+ result.append(line)
+ return result
+
+
+def LoadConfigFrom(name):
+ import ConfigParser
+ config = ConfigParser.ConfigParser()
+ config.read(name)
+ return config
+
+
+def ParseValue(string):
+ string = string.strip()
+ if string.startswith('[') and string.endswith(']'):
+ return string.lstrip('[').rstrip(']').split()
+ else:
+ return string
+
+
+def ExpandConstants(lines, constants):
+ for key, value in constants.items():
+ lines = lines.replace(key, str(value))
+ return lines
+
+
+def ExpandMacros(lines, macros):
+ for name, macro in macros.items():
+ start = lines.find(name + '(', 0)
+ while start != -1:
+ # Scan over the arguments
+ assert lines[start + len(name)] == '('
+ height = 1
+ end = start + len(name) + 1
+ last_match = end
+ arg_index = 0
+ mapping = { }
+ def add_arg(str):
+ # Remember to expand recursively in the arguments
+ replacement = ExpandMacros(str.strip(), macros)
+ mapping[macro.args[arg_index]] = replacement
+ while end < len(lines) and height > 0:
+ # We don't count commas at higher nesting levels.
+ if lines[end] == ',' and height == 1:
+ add_arg(lines[last_match:end])
+ last_match = end + 1
+ elif lines[end] in ['(', '{', '[']:
+ height = height + 1
+ elif lines[end] in [')', '}', ']']:
+ height = height - 1
+ end = end + 1
+ # Remember to add the last match.
+ add_arg(lines[last_match:end-1])
+ result = macro.expand(mapping)
+ # Replace the occurrence of the macro with the expansion
+ lines = lines[:start] + result + lines[end:]
+ start = lines.find(name + '(', end)
+ return lines
+
+class TextMacro:
+ def __init__(self, args, body):
+ self.args = args
+ self.body = body
+ def expand(self, mapping):
+ result = self.body
+ for key, value in mapping.items():
+ result = result.replace(key, value)
+ return result
+
+class PythonMacro:
+ def __init__(self, args, fun):
+ self.args = args
+ self.fun = fun
+ def expand(self, mapping):
+ args = []
+ for arg in self.args:
+ args.append(mapping[arg])
+ return str(self.fun(*args))
+
+CONST_PATTERN = re.compile('^const\s+([a-zA-Z0-9_]+)\s*=\s*([^;]*);$')
+MACRO_PATTERN = re.compile('^macro\s+([a-zA-Z0-9_]+)\s*\(([^)]*)\)\s*=\s*([^;]*);$')
+PYTHON_MACRO_PATTERN = re.compile('^python\s+macro\s+([a-zA-Z0-9_]+)\s*\(([^)]*)\)\s*=\s*([^;]*);$')
+
+def ReadMacros(lines):
+ constants = { }
+ macros = { }
+ for line in lines:
+ hash = line.find('#')
+ if hash != -1: line = line[:hash]
+ line = line.strip()
+ if len(line) is 0: continue
+ const_match = CONST_PATTERN.match(line)
+ if const_match:
+ name = const_match.group(1)
+ value = const_match.group(2).strip()
+ constants[name] = value
+ else:
+ macro_match = MACRO_PATTERN.match(line)
+ if macro_match:
+ name = macro_match.group(1)
+ args = map(string.strip, macro_match.group(2).split(','))
+ body = macro_match.group(3).strip()
+ macros[name] = TextMacro(args, body)
+ else:
+ python_match = PYTHON_MACRO_PATTERN.match(line)
+ if python_match:
+ name = python_match.group(1)
+ args = map(string.strip, python_match.group(2).split(','))
+ body = python_match.group(3).strip()
+ fun = eval("lambda " + ",".join(args) + ': ' + body)
+ macros[name] = PythonMacro(args, fun)
+ else:
+ raise ("Illegal line: " + line)
+ return (constants, macros)
+
+
+HEADER_TEMPLATE = """\
+#ifndef node_natives_h
+#define node_natives_h
+namespace node {
+
+%(source_lines)s\
+
+struct _native {
+ const char* name;
+ const char* source;
+};
+
+static const struct _native natives[] = {
+
+%(native_lines)s\
+
+ { NULL, NULL } /* sentinel */
+
+};
+
+}
+#endif
+"""
+
+
+NATIVE_DECLARATION = """\
+ { "%(id)s", %(id)s_native },
+"""
+
+SOURCE_DECLARATION = """\
+ const char %(id)s_native[] = { %(data)s };
+"""
+
+
+GET_DELAY_INDEX_CASE = """\
+ if (strcmp(name, "%(id)s") == 0) return %(i)i;
+"""
+
+
+GET_DELAY_SCRIPT_SOURCE_CASE = """\
+ if (index == %(i)i) return Vector<const char>(%(id)s, %(length)i);
+"""
+
+
+GET_DELAY_SCRIPT_NAME_CASE = """\
+ if (index == %(i)i) return Vector<const char>("%(name)s", %(length)i);
+"""
+
+def JS2C(source, target):
+ ids = []
+ delay_ids = []
+ modules = []
+ # Locate the macros file name.
+ consts = {}
+ macros = {}
+
+ for s in source:
+ if 'macros.py' == (os.path.split(str(s))[1]):
+ (consts, macros) = ReadMacros(ReadLines(str(s)))
+ else:
+ modules.append(s)
+
+ # Build source code lines
+ source_lines = [ ]
+ source_lines_empty = []
+
+ native_lines = []
+
+ for s in modules:
+ delay = str(s).endswith('-delay.js')
+ lines = ReadFile(str(s))
+ do_jsmin = lines.find('// jsminify this file, js2c: jsmin') != -1
+
+ lines = ExpandConstants(lines, consts)
+ lines = ExpandMacros(lines, macros)
+ lines = CompressScript(lines, do_jsmin)
+ data = ToCArray(s, lines)
+ id = (os.path.split(str(s))[1])[:-3]
+ if delay: id = id[:-6]
+ if delay:
+ delay_ids.append((id, len(lines)))
+ else:
+ ids.append((id, len(lines)))
+ source_lines.append(SOURCE_DECLARATION % { 'id': id, 'data': data })
+ source_lines_empty.append(SOURCE_DECLARATION % { 'id': id, 'data': 0 })
+ native_lines.append(NATIVE_DECLARATION % { 'id': id })
+
+ # Build delay support functions
+ get_index_cases = [ ]
+ get_script_source_cases = [ ]
+ get_script_name_cases = [ ]
+
+ i = 0
+ for (id, length) in delay_ids:
+ native_name = "native %s.js" % id
+ get_index_cases.append(GET_DELAY_INDEX_CASE % { 'id': id, 'i': i })
+ get_script_source_cases.append(GET_DELAY_SCRIPT_SOURCE_CASE % {
+ 'id': id,
+ 'length': length,
+ 'i': i
+ })
+ get_script_name_cases.append(GET_DELAY_SCRIPT_NAME_CASE % {
+ 'name': native_name,
+ 'length': len(native_name),
+ 'i': i
+ });
+ i = i + 1
+
+ for (id, length) in ids:
+ native_name = "native %s.js" % id
+ get_index_cases.append(GET_DELAY_INDEX_CASE % { 'id': id, 'i': i })
+ get_script_source_cases.append(GET_DELAY_SCRIPT_SOURCE_CASE % {
+ 'id': id,
+ 'length': length,
+ 'i': i
+ })
+ get_script_name_cases.append(GET_DELAY_SCRIPT_NAME_CASE % {
+ 'name': native_name,
+ 'length': len(native_name),
+ 'i': i
+ });
+ i = i + 1
+
+ # Emit result
+ output = open(str(target[0]), "w")
+ output.write(HEADER_TEMPLATE % {
+ 'builtin_count': len(ids) + len(delay_ids),
+ 'delay_count': len(delay_ids),
+ 'source_lines': "\n".join(source_lines),
+ 'native_lines': "\n".join(native_lines),
+ 'get_index_cases': "".join(get_index_cases),
+ 'get_script_source_cases': "".join(get_script_source_cases),
+ 'get_script_name_cases': "".join(get_script_name_cases)
+ })
+ output.close()
+
+ if len(target) > 1:
+ output = open(str(target[1]), "w")
+ output.write(HEADER_TEMPLATE % {
+ 'builtin_count': len(ids) + len(delay_ids),
+ 'delay_count': len(delay_ids),
+ 'source_lines': "\n".join(source_lines_empty),
+ 'get_index_cases': "".join(get_index_cases),
+ 'get_script_source_cases': "".join(get_script_source_cases),
+ 'get_script_name_cases': "".join(get_script_name_cases)
+ })
+ output.close()
+
+def main():
+ natives = sys.argv[1]
+ source_files = sys.argv[2:]
+ JS2C(source_files, [natives])
+
+if __name__ == "__main__":
+ main()
View
48 compiler/wscript
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+import re
+import Options
+import sys, os, shutil, glob
+import Utils
+from Utils import cmd_output
+from os.path import join, dirname, abspath, normpath
+from logging import fatal
+
+
+srcdir = "."
+blddir = "build"
+VERSION = "0.1.0"
+
+sys.path.append('./tools');
+import js2c
+
+def set_options(opt):
+ opt.tool_options("compiler_cxx")
+
+def configure(conf):
+ conf.check_tool("compiler_cxx")
+ conf.check_tool("node_addon")
+
+def build(bld):
+ print "Preparing to Build YUI3"
+ obj = bld.new_task_gen("cxx", "shlib", "node_addon")
+ obj.target = "yui3-compiled"
+ obj.source = "yui.cc"
+
+ def javascript_in_c(task):
+ print "Compiling YUI Source Files into C files, this may take a little bit \m/"
+ env = task.env
+ source = map(lambda x: x.srcpath(env), task.inputs)
+ targets = map(lambda x: x.srcpath(env), task.outputs)
+ #source.append(macros_loc_default)
+ js2c.JS2C(source, targets)
+
+ native_cc = bld.new_task_gen(
+ source=bld.path.ant_glob('src/lib/*.js'),
+ target="yui_natives.h",
+ before="cxx",
+ install_path=None
+ )
+
+ native_cc.rule = javascript_in_c
+
View
25 compiler/yui.cc
@@ -0,0 +1,25 @@
+#include <v8.h>
+#include <node.h>
+#include "build/default/yui_natives.h"
+#include <string.h>
+#include <strings.h>
+
+using namespace v8;
+
+namespace node {
+
+ const char* MainSource() {
+ return yui_native;
+ }
+
+ extern "C" void init(Handle<Object> target) {
+ HandleScope scope;
+
+ for (int i = 0; natives[i].name; i++) {
+ Local<String> name = String::New(natives[i].name);
+ Local<String> source = String::New(natives[i].source);
+ target->Set(name, source);
+ }
+ }
+
+}
View
9 compiler/yui.h
@@ -0,0 +1,9 @@
+#include <v8.h>
+
+namespace node {
+
+void DefineJavaScript(v8::Handle<v8::Object> target);
+const char* MainSource();
+
+} // namespace node
+
View
26 compiler/yui.js
@@ -0,0 +1,26 @@
+var path = require('path');
+var start = (new Date()).getTime();
+var yui = require(path.join(__dirname, 'build/default/yui3-compiled'));
+
+var vm = require('vm');
+
+var script = vm.createScript(yui.yui + yui.nodejs_yui3, 'yui.js');
+
+var sandbox = {
+ process: process,
+ require: require,
+ module: module,
+ __filename: __filename,
+ __dirname: __dirname,
+ exports: {}
+};
+
+script.runInNewContext(sandbox);
+
+for (var i in yui) {
+ sandbox.module.exports.execCache[i] = {
+ data: yui[i]
+ };
+}
+
+module.exports = sandbox.module.exports;
Please sign in to comment.
Something went wrong with that request. Please try again.