Never use url.resolve as a substitute for files.pathJoin

even if it makes more sense semantically, url.resolve has a very different
behavior
This commit is contained in:
Slava Kim
2014-12-17 15:53:09 -08:00
committed by Sashko Stubailo
parent a737d47aef
commit bb032e7e1e
2 changed files with 4 additions and 6 deletions

View File

@@ -1,5 +1,4 @@
var _ = require('underscore');
var url = require('url');
var archinfo = require('./archinfo.js');
var buildmessage = require('./buildmessage.js');
@@ -318,7 +317,7 @@ var compileUnibuild = function (options) {
type: "asset",
data: contents,
path: relPath,
servePath: url.resolve(inputSourceArch.pkg.serveRoot, relPath),
servePath: files.pathJoin(inputSourceArch.pkg.serveRoot, relPath),
hash: hash
});
};
@@ -647,7 +646,7 @@ var compileUnibuild = function (options) {
type: "css",
refreshable: true,
data: new Buffer(options.data, 'utf8'),
servePath: url.resolve(inputSourceArch.pkg.serveRoot, options.path),
servePath: files.pathJoin(inputSourceArch.pkg.serveRoot, options.path),
sourceMap: options.sourceMap
});
},
@@ -685,7 +684,7 @@ var compileUnibuild = function (options) {
js.push({
source: options.data,
sourcePath: options.sourcePath,
servePath: url.resolve(inputSourceArch.pkg.serveRoot, options.path),
servePath: files.pathJoin(inputSourceArch.pkg.serveRoot, options.path),
bare: !! bare,
sourceMap: options.sourceMap,
sourceHash: options._hash

View File

@@ -1,6 +1,5 @@
var _ = require('underscore');
var sourcemap = require('source-map');
var url = require('url');
var files = require('./files.js');
var utils = require('./utils.js');
@@ -1482,7 +1481,7 @@ _.extend(PackageSource.prototype, {
});
// Serve root of the package.
self.serveRoot = url.resolve('/packages/', self.name);
self.serveRoot = files.pathJoin('/packages/', self.name);
// Name of the test.
if (hasTests) {