Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ export default function loader(source) {
this.cacheable();
}

const query = loaderUtils.parseQuery(this.query);
const cacheParserResults = !!query.cache;
const optimizeParser = query.optimize || 'speed';
const trace = !!query.trace;
const dependencies = JSON.parse(query.dependencies || '{}');
const allowedStartRules = extractAllowedStartRules(query);
const options =
this.query && this.query.startsWith && this.query.startsWith("?")
? loaderUtils.parseQuery(this.query)
: loaderUtils.getOptions(this) || {};
const cacheParserResults = !!options.cache;
const optimizeParser = options.optimize || 'speed';
const trace = !!options.trace;
const dependencies = JSON.parse(options.dependencies || '{}');
const allowedStartRules = extractAllowedStartRules(options);

// Description of PEG.js options: https://github.com/pegjs/pegjs#javascript-api
const pegOptions = {
Expand Down