main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[79a0317] | 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("../Module").BuildInfo} BuildInfo */
|
---|
| 11 | /** @typedef {import("../Module").BuildMeta} BuildMeta */
|
---|
| 12 | /** @typedef {import("../Parser").ParserState} ParserState */
|
---|
| 13 | /** @typedef {import("../Parser").PreparsedAst} PreparsedAst */
|
---|
| 14 |
|
---|
| 15 | class AssetSourceParser extends Parser {
|
---|
| 16 | /**
|
---|
| 17 | * @param {string | Buffer | PreparsedAst} source the source to parse
|
---|
| 18 | * @param {ParserState} state the parser state
|
---|
| 19 | * @returns {ParserState} the parser state
|
---|
| 20 | */
|
---|
| 21 | parse(source, state) {
|
---|
| 22 | if (typeof source === "object" && !Buffer.isBuffer(source)) {
|
---|
| 23 | throw new Error("AssetSourceParser doesn't accept preparsed AST");
|
---|
| 24 | }
|
---|
| 25 | const { module } = state;
|
---|
| 26 | /** @type {BuildInfo} */
|
---|
| 27 | (module.buildInfo).strict = true;
|
---|
| 28 | /** @type {BuildMeta} */
|
---|
| 29 | (module.buildMeta).exportsType = "default";
|
---|
| 30 | /** @type {BuildMeta} */
|
---|
| 31 | (state.module.buildMeta).defaultObject = false;
|
---|
| 32 |
|
---|
| 33 | return state;
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | module.exports = AssetSourceParser;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.