webpack/lib/Parser.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
2025-08-20 18:50:12 +08:00
/** @typedef {import("./config/defaults").WebpackOptionsNormalizedWithDefaults} WebpackOptions */
/** @typedef {import("./Compilation")} Compilation */
/** @typedef {import("./NormalModule")} NormalModule */
/** @typedef {Record<string, EXPECTED_ANY>} PreparsedAst */
/**
2024-06-11 21:09:50 +08:00
* @typedef {object} ParserStateBase
* @property {string | Buffer} source
* @property {NormalModule} current
* @property {NormalModule} module
* @property {Compilation} compilation
2025-04-04 21:38:51 +08:00
* @property {WebpackOptions} options
*/
2025-04-04 21:38:51 +08:00
/** @typedef {Record<string, EXPECTED_ANY> & ParserStateBase} ParserState */
class Parser {
2020-04-16 15:37:11 +08:00
/* istanbul ignore next */
/**
2020-04-16 15:37:11 +08:00
* @abstract
* @param {string | Buffer | PreparsedAst} source the source to parse
* @param {ParserState} state the parser state
* @returns {ParserState} the parser state
*/
parse(source, state) {
2020-04-16 15:37:11 +08:00
const AbstractMethodError = require("./AbstractMethodError");
throw new AbstractMethodError();
}
}
module.exports = Parser;