|
|
@ -6,7 +6,7 @@ import { trimStart, trimEnd } from '../utils/trim';
|
|
|
|
import getCodeFrame from '../utils/getCodeFrame';
|
|
|
|
import getCodeFrame from '../utils/getCodeFrame';
|
|
|
|
import reservedNames from '../utils/reservedNames';
|
|
|
|
import reservedNames from '../utils/reservedNames';
|
|
|
|
import fullCharCodeAt from '../utils/fullCharCodeAt';
|
|
|
|
import fullCharCodeAt from '../utils/fullCharCodeAt';
|
|
|
|
import hash from './utils/hash';
|
|
|
|
import hash from '../utils/hash';
|
|
|
|
import { Node, Parsed } from '../interfaces';
|
|
|
|
import { Node, Parsed } from '../interfaces';
|
|
|
|
import CompileError from '../utils/CompileError';
|
|
|
|
import CompileError from '../utils/CompileError';
|
|
|
|
|
|
|
|
|
|
|
@ -202,20 +202,13 @@ export class Parser {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getHashSource (parser: Parser, options: ParserOptions) {
|
|
|
|
|
|
|
|
if (options.css === false || !parser.css) {
|
|
|
|
|
|
|
|
return parser.template;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return parser.css.content.styles;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default function parse(
|
|
|
|
export default function parse(
|
|
|
|
template: string,
|
|
|
|
template: string,
|
|
|
|
options: ParserOptions = {}
|
|
|
|
options: ParserOptions = {}
|
|
|
|
): Parsed {
|
|
|
|
): Parsed {
|
|
|
|
const parser = new Parser(template, options);
|
|
|
|
const parser = new Parser(template, options);
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
hash: hash(getHashSource(parser, options)),
|
|
|
|
hash: hash(parser.template),
|
|
|
|
html: parser.html,
|
|
|
|
html: parser.html,
|
|
|
|
css: parser.css,
|
|
|
|
css: parser.css,
|
|
|
|
js: parser.js,
|
|
|
|
js: parser.js,
|
|
|
|