|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | Author Alexander Akait @alexander-akait
|
|---|
| 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 AssetBytesParser extends Parser {
|
|---|
| 16 | /**
|
|---|
| 17 | * Parses the provided source and updates the parser state.
|
|---|
| 18 | * @param {string | Buffer | PreparsedAst} source the source to parse
|
|---|
| 19 | * @param {ParserState} state the parser state
|
|---|
| 20 | * @returns {ParserState} the parser state
|
|---|
| 21 | */
|
|---|
| 22 | parse(source, state) {
|
|---|
| 23 | if (typeof source === "object" && !Buffer.isBuffer(source)) {
|
|---|
| 24 | throw new Error("AssetBytesParser doesn't accept preparsed AST");
|
|---|
| 25 | }
|
|---|
| 26 | const { module } = state;
|
|---|
| 27 | /** @type {BuildInfo} */
|
|---|
| 28 | (module.buildInfo).strict = true;
|
|---|
| 29 | /** @type {BuildMeta} */
|
|---|
| 30 | (module.buildMeta).exportsType = "default";
|
|---|
| 31 | /** @type {BuildMeta} */
|
|---|
| 32 | (state.module.buildMeta).defaultObject = false;
|
|---|
| 33 |
|
|---|
| 34 | return state;
|
|---|
| 35 | }
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | module.exports = AssetBytesParser;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.