add dependencyType to externals function data

This commit is contained in:
Tobias Koppers 2021-06-24 16:45:14 +02:00
parent 629f9f031c
commit 35a399e81a
4 changed files with 15 additions and 1 deletions

View File

@ -2743,6 +2743,10 @@ export interface ExternalItemFunctionData {
* Contextual information. * Contextual information.
*/ */
contextInfo?: import("../lib/ModuleFactory").ModuleFactoryCreateDataContextInfo; contextInfo?: import("../lib/ModuleFactory").ModuleFactoryCreateDataContextInfo;
/**
* The category of the referencing dependencies.
*/
dependencyType?: string;
/** /**
* Get a resolve function with the current resolver options. * Get a resolve function with the current resolver options.
*/ */

View File

@ -172,13 +172,14 @@ class ExternalModuleFactoryPlugin {
cb cb
); );
} else { } else {
const dependencyType = dependency.category || "";
const promise = externals( const promise = externals(
{ {
context, context,
request: dependency.request, request: dependency.request,
dependencyType,
contextInfo, contextInfo,
getResolve: options => (context, request, callback) => { getResolve: options => (context, request, callback) => {
const dependencyType = dependency.category || "";
const resolveContext = { const resolveContext = {
fileDependencies: data.fileDependencies, fileDependencies: data.fileDependencies,
missingDependencies: data.missingDependencies, missingDependencies: data.missingDependencies,

View File

@ -807,6 +807,10 @@
"type": "object", "type": "object",
"tsType": "import('../lib/ModuleFactory').ModuleFactoryCreateDataContextInfo" "tsType": "import('../lib/ModuleFactory').ModuleFactoryCreateDataContextInfo"
}, },
"dependencyType": {
"description": "The category of the referencing dependencies.",
"type": "string"
},
"getResolve": { "getResolve": {
"description": "Get a resolve function with the current resolver options.", "description": "Get a resolve function with the current resolver options.",
"instanceof": "Function", "instanceof": "Function",

5
types.d.ts vendored
View File

@ -3617,6 +3617,11 @@ declare interface ExternalItemFunctionData {
*/ */
contextInfo?: ModuleFactoryCreateDataContextInfo; contextInfo?: ModuleFactoryCreateDataContextInfo;
/**
* The category of the referencing dependencies.
*/
dependencyType?: string;
/** /**
* Get a resolve function with the current resolver options. * Get a resolve function with the current resolver options.
*/ */