Skip to content

Commit 26768eb

Browse files
committed
Switch to hike 1.0 API
1 parent f68efb9 commit 26768eb

File tree

7 files changed

+19
-21
lines changed

7 files changed

+19
-21
lines changed

lib/mincer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ path.sep = path.sep || (path.resolve('.')[0] === '/' ? '/' : '\\');
3838

3939
// 3rd-party
4040
var Mimoza = require('mimoza');
41-
var Trail = require('hike').Trail;
41+
var Hike = require('hike');
4242

4343

4444
// internal
@@ -219,7 +219,7 @@ prop(Mincer, 'logger', require('./mincer/logger'));
219219
// main internal properties.
220220
// each new environment clone these properties for initial states,
221221
// so they can be used to set 'defaults' for all environment instances.
222-
prop(Mincer, '__trail__', new Trail(__dirname));
222+
prop(Mincer, '__trail__', new Hike(__dirname));
223223
prop(Mincer, '__engines__', {});
224224
prop(Mincer, '__mimeTypes__', new Mimoza());
225225
prop(Mincer, '__preProcessors__', new Hash(function () { return []; }));

lib/mincer/base.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func_proxy_with_expire_index('clearPaths');
163163
//
164164

165165
func_proxy_with_expire_index('registerMimeType', function (mimeType, ext) {
166-
this.__trail__.extensions.append(ext);
166+
this.__trail__.appendExtensions(ext);
167167
});
168168

169169
//

lib/mincer/environment.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
// 3rd-party
1717
var _ = require('lodash');
18-
var Trail = require('hike').Trail;
18+
var Hike = require('hike');
1919

2020

2121
// internal
@@ -64,7 +64,7 @@ var Environment = module.exports = function Environment(root) {
6464
prop(this, 'sourceRoot', '/', { writable: true });
6565

6666
// define internal properties
67-
prop(this, '__trail__', new Trail(root || '.'));
67+
prop(this, '__trail__', new Hike(root || '.'));
6868
prop(this, '__engines__', Mincer.getEngines());
6969
prop(this, '__mimeTypes__', Mincer.registeredMimeTypes);
7070
prop(this, '__preProcessors__', Mincer.getPreProcessors());
@@ -85,7 +85,7 @@ var Environment = module.exports = function Environment(root) {
8585

8686
// register default mimeType extensions
8787
_.forEach(this.__mimeTypes__.types, function (type, ext) {
88-
this.__trail__.extensions.append(ext);
88+
this.__trail__.appendExtensions(ext);
8989
}, this);
9090

9191

lib/mincer/helpers/paths.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var getter = require('../common').getter;
3434
* To be useful set this to your applications root directory.
3535
**/
3636
getter(module.exports, 'root', function () {
37-
return this.__trail__.root;
37+
return this.__trail__.__root__;
3838
});
3939

4040

@@ -50,7 +50,7 @@ getter(module.exports, 'root', function () {
5050
* [[Paths#prependPath]], and [[Paths#clearPaths]].
5151
**/
5252
getter(module.exports, 'paths', function () {
53-
return this.__trail__.paths.toArray();
53+
return this.__trail__.paths;
5454
});
5555

5656

@@ -61,7 +61,7 @@ getter(module.exports, 'paths', function () {
6161
* Paths at the end have the least priority.
6262
**/
6363
module.exports.prependPath = function (path) {
64-
this.__trail__.paths.prepend(path);
64+
this.__trail__.prependPaths(path);
6565
};
6666

6767

@@ -72,25 +72,23 @@ module.exports.prependPath = function (path) {
7272
* Paths at the beginning have a higher priority.
7373
**/
7474
module.exports.appendPath = function (path) {
75-
this.__trail__.paths.append(path);
75+
this.__trail__.appendPaths(path);
7676
};
7777

7878

7979
/**
80-
* Paths#clearPaths() -> Void
80+
* Paths#clearPaths() -> Array
8181
*
8282
* Clear all paths and start fresh.
8383
*
8484
* There is no mechanism for reordering paths, so its best to
8585
* completely wipe the paths list and reappend them in the order
8686
* you want.
87+
*
88+
* Returns list of previously registered paths.
8789
**/
8890
module.exports.clearPaths = function () {
89-
var trail = this.__trail__;
90-
91-
this.paths.forEach(function (path) {
92-
trail.paths.remove(path);
93-
});
91+
return this.__trail__.removePaths();
9492
};
9593

9694

@@ -104,5 +102,5 @@ module.exports.clearPaths = function () {
104102
* [".js", ".css", ".coffee", ".sass", ...]
105103
**/
106104
getter(module.exports, 'extensions', function () {
107-
return this.__trail__.extensions.toArray();
105+
return [].concat(this.__trail__.__extensions__);
108106
});

lib/mincer/helpers/processing.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,12 @@ module.exports.unregisterBundleProcessor = function (mimeType, klass) {
251251
module.exports.addEngineToTrail = function (ext, klass) {
252252
var format_ext;
253253

254-
this.__trail__.extensions.append(ext);
254+
this.__trail__.appendExtensions(ext);
255255

256256
if (klass.defaultMimeType) {
257257
format_ext = this.getExtensionForMimeType(klass.defaultMimeType);
258258
if (format_ext) {
259-
this.__trail__.aliases.append(format_ext, ext);
259+
this.__trail__.aliasExtension(format_ext, ext);
260260
}
261261
}
262262
};

lib/mincer/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var Index = module.exports = function Index(environment) {
4343
prop(this, 'sourceRoot', environment.sourceRoot);
4444

4545
// some private properties
46-
prop(this, '__trail__', environment.__trail__.index);
46+
prop(this, '__trail__', environment.__trail__.cached);
4747
prop(this, '__cache__', environment.__cache__);
4848
prop(this, '__engines__', environment.getEngines());
4949
prop(this, '__mimeTypes__', environment.registeredMimeTypes);

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"dependencies" : {
1919
"argparse" : "~ 0.1.15",
2020
"fs-tools" : "~ 0.2.10",
21-
"hike" : "~ 0.1.4",
21+
"hike" : "~ 1.0.0",
2222
"lodash" : "~ 2.4.1",
2323
"mimoza" : "~ 0.3.0",
2424
"shellwords" : "~ 0.1.0",

0 commit comments

Comments
 (0)