WXL
4 天以前 3bd962a6d7f61239c020e2dbbeb7341e5b842dd1
node_modules/webpack/lib/dependencies/HarmonyExportDependencyParserPlugin.js
@@ -21,6 +21,7 @@
const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency");
const { ImportPhaseUtils, createGetImportPhase } = require("./ImportPhase");
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("../javascript/JavascriptParser").ClassDeclaration} ClassDeclaration */
@@ -35,27 +36,28 @@
module.exports = class HarmonyExportDependencyParserPlugin {
   /**
    * @param {import("../../declarations/WebpackOptions").JavascriptParserOptions} options options
    * Creates an instance of HarmonyExportDependencyParserPlugin.
    * @param {JavascriptParserOptions} options options
    */
   constructor(options) {
      this.options = options;
      this.exportPresenceMode =
         options.reexportExportsPresence !== undefined
            ? ExportPresenceModes.fromUserOption(options.reexportExportsPresence)
            : options.exportsPresence !== undefined
               ? ExportPresenceModes.fromUserOption(options.exportsPresence)
               : options.strictExportPresence
                  ? ExportPresenceModes.ERROR
                  : ExportPresenceModes.AUTO;
      this.exportPresenceMode = ExportPresenceModes.resolveFromOptions(
         options.reexportExportsPresence,
         options
      );
   }
   /**
    * Applies the plugin by registering its hooks on the compiler.
    * @param {JavascriptParser} parser the parser
    * @returns {void}
    */
   apply(parser) {
      const { exportPresenceMode } = this;
      const getImportPhase = createGetImportPhase(this.options.deferImport);
      const getImportPhase = createGetImportPhase(
         this.options.deferImport,
         false
      );
      parser.hooks.export.tap(PLUGIN_NAME, (statement) => {
         const dep = new HarmonyExportHeaderDependency(
@@ -141,6 +143,13 @@
                     }
                  : undefined
         );
         dep.isAnonymousDefault =
            node.type === "ArrowFunctionExpression" ||
            ((node.type === "FunctionDeclaration" ||
               node.type === "FunctionExpression" ||
               node.type === "ClassDeclaration" ||
               node.type === "ClassExpression") &&
               !node.id);
         dep.loc = Object.create(
            /** @type {DependencyLocation} */ (statement.loc)
         );
@@ -224,7 +233,8 @@
            const dep = new HarmonyExportImportedSpecifierDependency(
               /** @type {string} */
               (source),
               parser.state.lastHarmonyImportOrder,
               /** @type {number} */
               (parser.state.lastHarmonyImportOrder),
               id ? [id] : [],
               name,
               harmonyNamedExports,