Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
821 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | /*
|
---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
| 3 | Author Yuta Hiroto @hiroppy
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | "use strict";
|
---|
| 7 |
|
---|
| 8 | const Parser = require("../Parser");
|
---|
| 9 |
|
---|
| 10 | /** @typedef {import("../Parser").ParserState} ParserState */
|
---|
| 11 | /** @typedef {import("../Parser").PreparsedAst} PreparsedAst */
|
---|
| 12 |
|
---|
| 13 | class AssetSourceParser extends Parser {
|
---|
| 14 | /**
|
---|
| 15 | * @param {string | Buffer | PreparsedAst} source the source to parse
|
---|
| 16 | * @param {ParserState} state the parser state
|
---|
| 17 | * @returns {ParserState} the parser state
|
---|
| 18 | */
|
---|
| 19 | parse(source, state) {
|
---|
| 20 | if (typeof source === "object" && !Buffer.isBuffer(source)) {
|
---|
| 21 | throw new Error("AssetSourceParser doesn't accept preparsed AST");
|
---|
| 22 | }
|
---|
| 23 | const { module } = state;
|
---|
| 24 | module.buildInfo.strict = true;
|
---|
| 25 | module.buildMeta.exportsType = "default";
|
---|
| 26 |
|
---|
| 27 | return state;
|
---|
| 28 | }
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | module.exports = AssetSourceParser;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.