WXL
4 天以前 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7
node_modules/webpack/lib/javascript/JavascriptGenerator.js
@@ -9,7 +9,7 @@
const { RawSource, ReplaceSource } = require("webpack-sources");
const Generator = require("../Generator");
const InitFragment = require("../InitFragment");
const { JS_TYPES } = require("../ModuleSourceTypesConstants");
const { JAVASCRIPT_TYPES } = require("../ModuleSourceTypeConstants");
const HarmonyCompatibilityDependency = require("../dependencies/HarmonyCompatibilityDependency");
/** @typedef {import("webpack-sources").Source} Source */
@@ -21,6 +21,7 @@
/** @typedef {import("../Generator").GenerateContext} GenerateContext */
/** @typedef {import("../Module")} Module */
/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */
/** @typedef {import("../Module").SourceType} SourceType */
/** @typedef {import("../Module").SourceTypes} SourceTypes */
/** @typedef {import("../NormalModule")} NormalModule */
@@ -29,6 +30,7 @@
      return new RawSource("throw new Error('No source available');");
   },
   /**
    * Returns the estimated size for the requested source type.
    * @returns {number} size of the DEFAULT_SOURCE.source()
    */
   size() {
@@ -41,6 +43,7 @@
const deprecatedGetInitFragments = util.deprecate(
   /**
    * Handles the callback logic for this hook.
    * @param {DependencyTemplate} template template
    * @param {Dependency} dependency dependency
    * @param {DependencyTemplateContext} templateContext template context
@@ -55,16 +58,18 @@
class JavascriptGenerator extends Generator {
   /**
    * Returns the source types available for this module.
    * @param {NormalModule} module fresh module
    * @returns {SourceTypes} available types (do not mutate)
    */
   getTypes(module) {
      return JS_TYPES;
      return JAVASCRIPT_TYPES;
   }
   /**
    * Returns the estimated size for the requested source type.
    * @param {NormalModule} module the module
    * @param {string=} type source type
    * @param {SourceType=} type source type
    * @returns {number} estimate size of the module
    */
   getSize(module, type) {
@@ -76,6 +81,7 @@
   }
   /**
    * Returns the reason this module cannot be concatenated, when one exists.
    * @param {NormalModule} module module for which the bailout reason should be determined
    * @param {ConcatenationBailoutReasonContext} context context
    * @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated
@@ -102,6 +108,7 @@
   }
   /**
    * Processes the provided module.
    * @param {Module} module the current module
    * @param {Dependency} dependency the dependency to generate
    * @param {InitFragment<GenerateContext>[]} initFragments mutable list of init fragments
@@ -172,6 +179,7 @@
   }
   /**
    * Processes the provided module.
    * @param {Module} module the module to generate
    * @param {DependenciesBlock} block the dependencies block which will be processed
    * @param {InitFragment<GenerateContext>[]} initFragments mutable list of init fragments
@@ -202,6 +210,7 @@
   }
   /**
    * Processes the provided module.
    * @param {Module} module the module to generate
    * @param {InitFragment<GenerateContext>[]} initFragments mutable list of init fragments
    * @param {ReplaceSource} source the current replace source which can be modified
@@ -243,6 +252,7 @@
   }
   /**
    * Generates generated code for this runtime module.
    * @param {NormalModule} module module for which the code should be generated
    * @param {GenerateContext} generateContext context for generate
    * @returns {Source | null} generated code
@@ -263,6 +273,7 @@
   }
   /**
    * Generates fallback output for the provided error condition.
    * @param {Error} error the error
    * @param {NormalModule} module module for which the code should be generated
    * @param {GenerateContext} generateContext context for generate