WXL
3 天以前 9bce51f651aad297ef9eb6df832bfdaf1de05d84
node_modules/webpack/lib/IgnorePlugin.js
@@ -7,21 +7,11 @@
const RawModule = require("./RawModule");
const EntryDependency = require("./dependencies/EntryDependency");
const createSchemaValidation = require("./util/create-schema-validation");
/** @typedef {import("../declarations/plugins/IgnorePlugin").IgnorePluginOptions} IgnorePluginOptions */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */
/** @typedef {import("./ContextModuleFactory").BeforeContextResolveData} BeforeContextResolveData */
const validate = createSchemaValidation(
   require("../schemas/plugins/IgnorePlugin.check"),
   () => require("../schemas/plugins/IgnorePlugin.json"),
   {
      name: "Ignore Plugin",
      baseDataPath: "options"
   }
);
/** @typedef {(resource: string, context: string) => boolean} CheckResourceFn */
@@ -29,10 +19,10 @@
class IgnorePlugin {
   /**
    * Creates an instance of IgnorePlugin.
    * @param {IgnorePluginOptions} options IgnorePlugin options
    */
   constructor(options) {
      validate(options);
      this.options = options;
      this.checkIgnore = this.checkIgnore.bind(this);
   }
@@ -69,11 +59,23 @@
   }
   /**
    * Apply the plugin
    * Applies the plugin by registering its hooks on the compiler.
    * @param {Compiler} compiler the compiler instance
    * @returns {void}
    */
   apply(compiler) {
      compiler.hooks.validate.tap(PLUGIN_NAME, () => {
         compiler.validate(
            require("../schemas/plugins/IgnorePlugin.json"),
            this.options,
            {
               name: "Ignore Plugin",
               baseDataPath: "options"
            },
            (options) => require("../schemas/plugins/IgnorePlugin.check")(options)
         );
      });
      compiler.hooks.normalModuleFactory.tap(PLUGIN_NAME, (nmf) => {
         nmf.hooks.beforeResolve.tap(PLUGIN_NAME, (resolveData) => {
            const result = this.checkIgnore(resolveData);