@@ -92,6 +92,8 @@ function Depper(opts) {
9292
9393 opts = opts || { }
9494
95+ this . _inlineSource = ''
96+ this . _inlineName = genInlineName ( )
9597 this . _async = opts . async || false
9698 this . _i = 0
9799 this . _deps = [ ]
@@ -106,6 +108,10 @@ function Depper(opts) {
106108 /** @type {TransformDefinition[] } */
107109 this . _globalTransforms = [ ]
108110
111+ if ( typeof this . _cwd !== 'string' ) {
112+ throw new Error ( 'glslify-deps: cwd must be a string path' )
113+ }
114+
109115 if ( ! opts . readFile ) {
110116 throw new Error ( 'glslify-deps: readFile must be defined' )
111117 }
@@ -122,22 +128,15 @@ function Depper(opts) {
122128 throw new Error ( 'glslify-deps: transformRequire must be defined' )
123129 }
124130
131+ this . transformRequire = opts . transformRequire
132+
125133 // @ts -ignore
126134 this . _transformRequireAsync = ! ! opts . transformRequire . sync
127135
128136 if ( ! this . _async && this . _transformRequireAsync ) {
129137 throw new Error ( 'glslify-deps: transformRequire async detected \
130138 \nwhen sync context, please ensure your resolver is even with the context' )
131139 }
132-
133- this . transformRequire = opts . transformRequire
134-
135- this . _inlineSource = ''
136- this . _inlineName = genInlineName ( )
137-
138- if ( typeof this . _cwd !== 'string' ) {
139- throw new Error ( 'glslify-deps: cwd must be a string path' )
140- }
141140}
142141
143142Depper . prototype . inline = function ( source , basedir , done ) {
0 commit comments