-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated: use compiling meta instead of options
- Loading branch information
1 parent
e99e566
commit d996073
Showing
15 changed files
with
63 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
import getLineAndColumnByPosition from './get-line-and-column-by-position' | ||
import {execute as runPreprocessor} from '../preprocessors' | ||
|
||
/** | ||
* Preprocess a riot parser node | ||
* @param { string } preprocessorType - either css, js | ||
* @param { string } preprocessorName - preprocessor id | ||
* @param { Object } options - options that will be passed to the compiler | ||
* @param { Object } meta - compilation meta information | ||
* @param { string } source - tag source code | ||
* @param { RiotParser.nodeTypes } node - css node detected by the parser | ||
* @returns { Output } code and sourcemap generated by the preprocessor | ||
*/ | ||
export default async function preprocess(preprocessorType, preprocessorName, options, source, node) { | ||
const { column } = getLineAndColumnByPosition(source, node.start) | ||
const offsetTop = '\n'.repeat(column) | ||
const code = `${offsetTop}\n${node.text}` | ||
export default async function preprocess(preprocessorType, preprocessorName, meta, source, node) { | ||
const code = node.text | ||
|
||
return await (preprocessorName ? | ||
runPreprocessor(preprocessorType, preprocessorName, options, code) : | ||
runPreprocessor(preprocessorType, preprocessorName, meta, code) : | ||
{ code } | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters