File tree Expand file tree Collapse file tree 3 files changed +8
-12
lines changed
Expand file tree Collapse file tree 3 files changed +8
-12
lines changed Original file line number Diff line number Diff line change 11var inherits = require ( 'inherits' )
22var NodeDepper = require ( './node' )
3- var transformRequire = require ( './transform-require' )
43
54/**
65 * Creates a new instance of glslify-deps. Generally, you'll
@@ -16,8 +15,6 @@ function DepperAsync(opts) {
1615 if ( ! ( this instanceof DepperAsync ) ) return new DepperAsync ( opts )
1716 opts = ( typeof opts === 'string' ? { cwd : opts } : opts ) || { }
1817 opts . async = true
19- // keeps the initial behaviour of transform resolution
20- opts . transformRequire = opts . transformRequire || transformRequire . sync
2118 NodeDepper . call ( this , opts ) ;
2219}
2320
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ var map = require('map-limit')
55var inherits = require ( 'inherits' )
66var fs = require ( 'graceful-fs' )
77var glslResolve = require ( 'glsl-resolve' )
8+ var transformRequire = require ( './transform-require' )
89
910var {
1011 getImportName,
@@ -31,9 +32,11 @@ function createDefaultRead() {
3132 */
3233function NodeDepper ( opts ) {
3334 if ( ! ( this instanceof NodeDepper ) ) return new NodeDepper ( opts )
34- opts = opts || { }
35- opts . resolve = mix ( glslResolve . sync , glslResolve )
36- opts . readFile = createDefaultRead ( )
35+ opts = ( typeof opts === 'string' ? { cwd : opts } : opts ) || { }
36+ opts . resolve = opts . resolve || mix ( glslResolve . sync , glslResolve )
37+ // keeps the original behaviour of transform resolution
38+ opts . transformRequire = opts . transformRequire || transformRequire . sync
39+ opts . readFile = opts . readFile || createDefaultRead ( )
3740 Depper . call ( this , opts )
3841}
3942
Original file line number Diff line number Diff line change 11var inherits = require ( 'inherits' )
22var NodeDepper = require ( './node' )
3- var transformRequire = require ( './transform-require' )
43
54/**
65 * Creates a new instance of glslify-deps. Generally, you'll
76 * want to use one instance per bundle.
87 *
98 * @class
109 * @param {String|({
11- * cwd: String,
12- * transformRequire: Function
13- * })} opts The root directory of your shader. Defaults to process.cwd()
10+ * cwd: String,
11+ * })} opts The root directory of your shader. Defaults to process.cwd()
1412 */
1513function DepperSync ( opts ) {
1614 if ( ! ( this instanceof DepperSync ) ) return new DepperSync ( opts )
17- opts = ( typeof opts === 'string' ? { cwd : opts } : opts ) || { }
18- opts . transformRequire = opts . transformRequire || transformRequire . sync
1915 NodeDepper . call ( this , opts )
2016}
2117
You can’t perform that action at this time.
0 commit comments