Files
klz-cables.com/.pnpm-store/v10/files/af/e314e1ce7ed20ff240bd4f2027a34da97c193ac7fc34162ca696a6841a8adefce5bd34bdefce8df5b4e0b3b7556a7516296f116ed7a516ad10993dc7431f66
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

88 lines
2.6 KiB
Plaintext

/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Natsu @xiaoxiaojx
*/
"use strict";
const InitFragment = require("../InitFragment");
const makeSerializable = require("../util/makeSerializable");
const NullDependency = require("./NullDependency");
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
/** @typedef {import("../Dependency")} Dependency */
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/**
* A dependency that adds an init fragment to the module
*/
class ModuleInitFragmentDependency extends NullDependency {
/**
* @param {string} initCode the initialization code
* @param {string[]} runtimeRequirements runtime requirements
* @param {string=} key unique key to avoid emitting the same initialization code twice
*/
constructor(initCode, runtimeRequirements, key) {
super();
this.initCode = initCode;
this.runtimeRequirements = runtimeRequirements;
this.key = key;
}
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.initCode);
write(this.runtimeRequirements);
write(this.key);
super.serialize(context);
}
/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.initCode = read();
this.runtimeRequirements = read();
this.key = read();
super.deserialize(context);
}
}
makeSerializable(
ModuleInitFragmentDependency,
"webpack/lib/dependencies/ModuleInitFragmentDependency"
);
ModuleInitFragmentDependency.Template = class ModuleInitFragmentDependencyTemplate extends (
NullDependency.Template
) {
/**
* @param {Dependency} dependency the dependency for which the template should be applied
* @param {ReplaceSource} source the current replace source which can be modified
* @param {DependencyTemplateContext} templateContext the context object
* @returns {void}
*/
apply(dependency, source, { initFragments, runtimeRequirements }) {
const dep = /** @type {ModuleInitFragmentDependency} */ (dependency);
for (const req of dep.runtimeRequirements) {
runtimeRequirements.add(req);
}
initFragments.push(
new InitFragment(
dep.initCode,
InitFragment.STAGE_CONSTANTS,
0,
dep.key,
undefined
)
);
}
};
module.exports = ModuleInitFragmentDependency;