WXL
4 天以前 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7
node_modules/webpack/lib/dependencies/ExternalModuleInitFragment.js
@@ -12,7 +12,9 @@
/** @typedef {import("../Generator").GenerateContext} GenerateContext */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {Map<string, Set<string>>} ImportSpecifiers */
/** @typedef {{ name: string, value?: string }[]} ArrayImportSpecifiers */
/** @typedef {Set<string>} ImportSpecifier */
/** @typedef {Map<string, ImportSpecifier>} ImportSpecifiers */
/**
 * @extends {InitFragment<GenerateContext>}
@@ -20,7 +22,7 @@
class ExternalModuleInitFragment extends InitFragment {
   /**
    * @param {string} importedModule imported module
    * @param {{ name: string, value?: string }[] | ImportSpecifiers} specifiers import specifiers
    * @param {ArrayImportSpecifiers | ImportSpecifiers} specifiers import specifiers
    * @param {string=} defaultImport default import
    */
   constructor(importedModule, specifiers, defaultImport) {
@@ -37,6 +39,7 @@
         for (const { name, value } of specifiers) {
            let specifiers = this.specifiers.get(name);
            if (!specifiers) {
               /** @type {ImportSpecifier} */
               specifiers = new Set();
               this.specifiers.set(name, specifiers);
            }
@@ -72,10 +75,12 @@
   }
   /**
    * Returns the source code that will be included as initialization code.
    * @param {GenerateContext} context context
    * @returns {string | Source | undefined} the source code that will be included as initialization code
    */
   getContent({ runtimeRequirements }) {
      /** @type {string[]} */
      const namedImports = [];
      for (const [name, specifiers] of this.specifiers) {
@@ -103,6 +108,7 @@
   }
   /**
    * Serializes this instance into the provided serializer context.
    * @param {ObjectSerializerContext} context context
    */
   serialize(context) {
@@ -114,6 +120,7 @@
   }
   /**
    * Restores this instance from the provided deserializer context.
    * @param {ObjectDeserializerContext} context context
    */
   deserialize(context) {