21 lines
434 B
JavaScript
21 lines
434 B
JavaScript
"use strict";
|
|
|
|
function preprocess(ast, options) {
|
|
switch (options.parser) {
|
|
case "json":
|
|
case "json5":
|
|
case "json-stringify":
|
|
case "__js_expression":
|
|
case "__vue_expression":
|
|
return Object.assign({}, ast, {
|
|
type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot",
|
|
node: ast,
|
|
comments: []
|
|
});
|
|
default:
|
|
return ast;
|
|
}
|
|
}
|
|
|
|
module.exports = preprocess;
|