MCPcopy
hub / github.com/webpack/webpack / applyModuleDefaults

Function applyModuleDefaults

lib/config/defaults.js:877–1412  ·  view source on GitHub ↗
(
	module,
	{
		hashSalt,
		hashFunction,
		cache,
		syncWebAssembly,
		asyncWebAssembly,
		css,
		html,
		typescript,
		futureDefaults,
		isNode,
		uniqueName,
		targetProperties,
		mode,
		deferImport,
		sourceImport,
		outputModule,
		library
	}
)

Source from the content-addressed store, hash-verified

875 * @returns {void}
876 */
877const applyModuleDefaults = (
878 module,
879 {
880 hashSalt,
881 hashFunction,
882 cache,
883 syncWebAssembly,
884 asyncWebAssembly,
885 css,
886 html,
887 typescript,
888 futureDefaults,
889 isNode,
890 uniqueName,
891 targetProperties,
892 mode,
893 deferImport,
894 sourceImport,
895 outputModule,
896 library
897 }
898) => {
899 if (cache) {
900 D(
901 module,
902 "unsafeCache",
903 /**
904 * Handles the callback logic for this hook.
905 * @param {Module} module module
906 * @returns {boolean} true, if we want to cache the module
907 */
908 (module) => {
909 const name = module.nameForCondition();
910 if (!name) {
911 return false;
912 }
913 return NODE_MODULES_REGEXP.test(name);
914 }
915 );
916 } else {
917 D(module, "unsafeCache", false);
918 }
919
920 F(module.parser, ASSET_MODULE_TYPE, () => ({}));
921 F(
922 /** @type {NonNullable<ParserOptionsByModuleTypeKnown[ASSET_MODULE_TYPE]>} */
923 (module.parser[ASSET_MODULE_TYPE]),
924 "dataUrlCondition",
925 () => ({})
926 );
927 if (
928 typeof (
929 /** @type {NonNullable<ParserOptionsByModuleTypeKnown[ASSET_MODULE_TYPE]>} */
930 (module.parser[ASSET_MODULE_TYPE]).dataUrlCondition
931 ) === "object"
932 ) {
933 D(
934 /** @type {NonNullable<ParserOptionsByModuleTypeKnown[ASSET_MODULE_TYPE]>} */

Callers 1

Calls 9

DFunction · 0.70
FFunction · 0.70
AFunction · 0.70
nameForConditionMethod · 0.45
testMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected