Skip to content

Commit

Permalink
File with lightscript directive is always flagged as lightscript
Browse files Browse the repository at this point in the history
  • Loading branch information
wcjohnson committed Jul 6, 2017
1 parent 69913bd commit 610e80b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/compilerState.lsc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export getBabel() -> compilerState.babel
export getOptions() -> compilerState.opts

export getFileTypeInfo(file) ->
if not file?.opts?.filename: return { isLightScript: true, isLSX: false}
if not file?.opts?.filename: return { isLightScript: true, isLSX: false }
filename = file.opts.filename

if filename.includes(".lsx"): return { isLightScript: true, isLSX: true }
Expand Down Expand Up @@ -75,6 +75,8 @@ findFirstTokenLoc(tokens) ->
export createCompilerState(initialState) ->
now compilerState = initialState
processFilename(compilerState)
// Allow config directives to override filename processing
if initialState.file?.isLightScript: compilerState.isLightScript = true

// Get zero-location
tokens = initialState?.file?.ast?.tokens
Expand Down
2 changes: 1 addition & 1 deletion src/index.lsc
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ Lightscript(babel) ->
// Don't read as LSC
if (not fileTypeInfo.isLightScript) and (not cdOpts.isLightScript): return

file.isLightScript = true
Object.assign(pluginOpts, cdOpts)
console.dir(pluginOpts)

// Get LSC parser opts
opts.parserOpts = opts.parserOpts or {}
Expand Down

0 comments on commit 610e80b

Please sign in to comment.