77
88const { RawSource } = require ( "webpack-sources" ) ;
99const Module = require ( "../Module" ) ;
10- const { REMOTE_AND_SHARE_INIT_TYPES } = require ( "../ModuleSourceTypeConstants" ) ;
10+ const {
11+ JAVASCRIPT_TYPES ,
12+ REMOTE_AND_SHARE_INIT_TYPES
13+ } = require ( "../ModuleSourceTypeConstants" ) ;
1114const { WEBPACK_MODULE_TYPE_REMOTE } = require ( "../ModuleTypeConstants" ) ;
1215const RuntimeGlobals = require ( "../RuntimeGlobals" ) ;
1316const makeSerializable = require ( "../util/makeSerializable" ) ;
@@ -34,6 +37,7 @@ const RemoteToExternalDependency = require("./RemoteToExternalDependency");
3437/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext } ObjectDeserializerContext */
3538/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext } ObjectSerializerContext */
3639/** @typedef {import("../util/fs").InputFileSystem } InputFileSystem */
40+ /** @typedef {import("../Module").BasicSourceTypes } BasicSourceTypes */
3741
3842const RUNTIME_REQUIREMENTS = new Set ( [ RuntimeGlobals . module ] ) ;
3943
@@ -137,6 +141,19 @@ class RemoteModule extends Module {
137141 return REMOTE_AND_SHARE_INIT_TYPES ;
138142 }
139143
144+ /**
145+ * Basic source types are high-level categories like javascript, css, webassembly, etc.
146+ * We only have built-in knowledge about the javascript basic type here; other basic types may be
147+ * added or changed over time by generators and do not need to be handled or detected here.
148+ *
149+ * Some modules, e.g. RemoteModule, may return non-basic source types like "remote" and "share-init"
150+ * from getSourceTypes(), but their generated output is still JavaScript, i.e. their basic type is JS.
151+ * @returns {BasicSourceTypes } types available (do not mutate)
152+ */
153+ getSourceBasicTypes ( ) {
154+ return JAVASCRIPT_TYPES ;
155+ }
156+
140157 /**
141158 * @param {ModuleGraph } moduleGraph the module graph
142159 * @param {boolean | undefined } strict the importing module is strict
0 commit comments