MCPcopy
hub / github.com/webpack/webpack / applySnapshotDefaults

Function applySnapshotDefaults

lib/config/defaults.js:705–773  ·  view source on GitHub ↗
(snapshot, { production, futureDefaults })

Source from the content-addressed store, hash-verified

703 * @returns {void}
704 */
705const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => {
706 if (futureDefaults) {
707 F(snapshot, "managedPaths", () =>
708 process.versions.pnp === "3"
709 ? [
710 /^(.+?(?:[\\/]\.yarn[\\/]unplugged[\\/][^\\/]+)?[\\/]node_modules[\\/])/
711 ]
712 : [/^(.+?[\\/]node_modules[\\/])/]
713 );
714 F(snapshot, "immutablePaths", () =>
715 process.versions.pnp === "3"
716 ? [/^(.+?[\\/]cache[\\/][^\\/]+\.zip[\\/]node_modules[\\/])/]
717 : []
718 );
719 } else {
720 A(snapshot, "managedPaths", () => {
721 if (process.versions.pnp === "3") {
722 const match =
723 /^(.+?)[\\/]cache[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec(
724 require.resolve("watchpack")
725 );
726 if (match) {
727 return [path.resolve(match[1], "unplugged")];
728 }
729 } else {
730 const match = /^(.+?[\\/]node_modules[\\/])/.exec(
731 require.resolve("watchpack")
732 );
733 if (match) {
734 return [match[1]];
735 }
736 }
737 return [];
738 });
739 A(snapshot, "immutablePaths", () => {
740 if (process.versions.pnp === "1") {
741 const match =
742 /^(.+?[\\/]v4)[\\/]npm-watchpack-[^\\/]+-[\da-f]{40}[\\/]node_modules[\\/]/.exec(
743 require.resolve("watchpack")
744 );
745 if (match) {
746 return [match[1]];
747 }
748 } else if (process.versions.pnp === "3") {
749 const match =
750 /^(.+?)[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec(
751 require.resolve("watchpack")
752 );
753 if (match) {
754 return [match[1]];
755 }
756 }
757 return [];
758 });
759 }
760 F(snapshot, "unmanagedPaths", () => []);
761 F(snapshot, "resolveBuildDependencies", () => ({
762 timestamp: true,

Callers 1

Calls 4

execMethod · 0.80
FFunction · 0.70
AFunction · 0.70
resolveMethod · 0.65

Tested by

no test coverage detected