UNPKG

@module-federation/enhanced

Version:

This package provides enhanced features for module federation.

74 lines (72 loc) 3.03 kB
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } }); const require_runtime = require('../../_virtual/_rolldown/runtime.js'); let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path"); //#region src/lib/sharing/ProvideSharedDependency.ts const makeSerializable = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/makeSerializable")); const { Dependency } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack")); var ProvideSharedDependency = class ProvideSharedDependency extends Dependency { /** * @param {string|string[]} shareScope share scope * @param {string} name module name * @param {string | false} version version * @param {string} request request * @param {boolean} eager true, if this is an eager dependency * @param {boolean} requiredVersion version requirement * @param {boolean} strictVersion don't use shared version even if version isn't valid * @param {boolean} singleton use single global version * @param {string} [layer] layer information */ constructor(shareScope, name, version, request, eager, requiredVersion, strictVersion, singleton, layer, treeShakingMode) { super(); this.shareScope = shareScope; this.name = name; this.version = version; this.request = request; this.eager = eager; this.requiredVersion = requiredVersion; this.strictVersion = strictVersion; this.singleton = singleton; this.layer = layer; this.treeShakingMode = treeShakingMode; } get type() { return "provide shared module"; } /** * @returns {string | null} an identifier to merge equal requests */ getResourceIdentifier() { return `provide module (${Array.isArray(this.shareScope) ? this.shareScope.join("|") : this.shareScope})${this.layer ? ` (${this.layer})` : ""} ${this.request} as ${this.name} @ ${this.version}${this.eager ? " (eager)" : ""}`; } /** * @param {ObjectSerializerContext} context context */ serialize(context) { context.write(this.shareScope); context.write(this.name); context.write(this.version); context.write(this.request); context.write(this.eager); context.write(this.requiredVersion); context.write(this.strictVersion); context.write(this.singleton); context.write(this.layer); context.write(this.treeShakingMode); super.serialize(context); } /** * @param {ObjectDeserializerContext} context context * @returns {ProvideSharedDependency} deserialize fallback dependency */ static deserialize(context) { const { read } = context; const obj = new ProvideSharedDependency(read(), read(), read(), read(), read(), read(), read(), read(), read(), read()); this.shareScope = context.read(); obj.deserialize(context); return obj; } }; makeSerializable(ProvideSharedDependency, "enhanced/lib/sharing/ProvideSharedDependency"); //#endregion exports.default = ProvideSharedDependency; //# sourceMappingURL=ProvideSharedDependency.js.map