Skip to content

Commit

Permalink
depper sort option assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
rubeniskov committed Nov 16, 2020
1 parent 79d2c89 commit f43322a
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions depper.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ function Depper(opts) {

opts = opts || {}

this._inlineSource = ''
this._inlineName = genInlineName()
this._async = opts.async || false
this._i = 0
this._deps = []
Expand All @@ -106,6 +108,10 @@ function Depper(opts) {
/** @type {TransformDefinition[]} */
this._globalTransforms = []

if (typeof this._cwd !== 'string') {
throw new Error('glslify-deps: cwd must be a string path')
}

if (!opts.readFile) {
throw new Error('glslify-deps: readFile must be defined')
}
Expand All @@ -122,22 +128,15 @@ function Depper(opts) {
throw new Error('glslify-deps: transformRequire must be defined')
}

this.transformRequire = opts.transformRequire

// @ts-ignore
this._transformRequireAsync = !!opts.transformRequire.sync

if (!this._async && this._transformRequireAsync) {
throw new Error('glslify-deps: transformRequire async detected \
\nwhen sync context, please ensure your resolver is even with the context')
}

this.transformRequire = opts.transformRequire

this._inlineSource = ''
this._inlineName = genInlineName()

if (typeof this._cwd !== 'string') {
throw new Error('glslify-deps: cwd must be a string path')
}
}

Depper.prototype.inline = function(source, basedir, done) {
Expand Down

0 comments on commit f43322a

Please sign in to comment.