Permalink
Browse files

fix uki run

  • Loading branch information...
voloko committed Jul 10, 2012
1 parent 53a55c4 commit a31e86176bbb3a598ab562ce5f9f121091b13787
Showing with 19 additions and 11 deletions.
  1. +1 −1 package.json
  2. +2 −4 tools/dev_server.js
  3. +12 −4 tools/static_require.js
  4. +4 −2 tools/tools.js
View
@@ -2,7 +2,7 @@
"name":"ukijs",
"description":"Simple client side app framework",
"keywords":["uki","ukijs","widgets","mvc","view"],
- "version":"0.4.6",
+ "version":"0.4.7",
"homepage":"http://ukijs.org/",
"author":"Vladimir Kolesnikov <voloko@gmail.com>",
"repository":{"type":"git","url":"git://github.com/voloko/uki"},
View
@@ -1,12 +1,10 @@
var express = require('express'),
sr = require('./static_require'),
- url = require('url'),
- pro = require('uglify-js').uglify,
app = express.createServer();
-exports.init = function() {
+exports.init = function(here) {
app.get('/*.js', sr.getHandler({
- searchPaths: []
+ searchPaths: [here]
}));
app.get('/*', function(req, res) {
View
@@ -118,9 +118,14 @@ function processCssIncludes (cssPath) {
}
function resolvePath (filePath) {
- var resolvedPath = mod._findPath(filePath,
- [path.dirname(state.currentPath)].concat(state.options.searchPaths));
- if (!resolvedPath) throw new Error('Path ' + filePath + ' not found.');
+ var parent = new mod.Module('tmp');
+ var seachPaths = [path.dirname(state.currentPath)]
+ .concat(state.options.searchPaths)
+ .concat(mod._nodeModulePaths(state.currentPath));
+ var resolvedPath = mod._findPath(filePath, seachPaths);
+ if (!resolvedPath) {
+ throw new Error('Path ' + filePath + ' not found. Required from ' + state.currentPath);
+ }
return fs.realpathSync(resolvedPath);
}
@@ -134,7 +139,10 @@ function addFileToAstList (filePath, wrap) {
var ast;
if (text.indexOf('@static_require noprocess') === -1) {
if (wrap) {
- text = '(function(global, module, require) {var exports = this;' + text + '})';
+ text =
+ '(function(global, module, require) {' +
+ '"' + filePath + '";' +
+ 'var exports = this;' + text + '})';
}
ast = jsp.parse(text);
ast = walker.with_walkers(walkers, function() {
View
@@ -1,4 +1,5 @@
-var cli = require('cli'),
+var cli = require('cli'),
+ fs = require('fs'),
options = cli.parse(
{
squeeze: ['s', 'Squeeze output']
@@ -31,7 +32,8 @@ if (cli.command == 'run') {
util.puts("Loaded express.js");
} catch(e) {}
- dev_server.init();
+ var here = fs.realpathSync(process.cwd());
+ dev_server.init(here);
dev_server.app.listen(port, host);
util.puts("Server at http://" + (host || "127.0.0.1") + ":" + port.toString() + "/");

0 comments on commit a31e861

Please sign in to comment.