feat: refactoring project
This commit is contained in:
17
node_modules/webpack/lib/serialization/SerializerMiddleware.js
generated
vendored
17
node_modules/webpack/lib/serialization/SerializerMiddleware.js
generated
vendored
@@ -45,7 +45,7 @@ class SerializerMiddleware {
|
||||
* @param {any=} serializedValue serialized value
|
||||
* @returns {function(): Promise<any> | any} lazy function
|
||||
*/
|
||||
static createLazy(value, target, options = {}, serializedValue) {
|
||||
static createLazy(value, target, options = {}, serializedValue = undefined) {
|
||||
if (SerializerMiddleware.isLazy(value, target)) return value;
|
||||
const fn = typeof value === "function" ? value : () => value;
|
||||
fn[LAZY_TARGET] = target;
|
||||
@@ -62,24 +62,24 @@ class SerializerMiddleware {
|
||||
static isLazy(fn, target) {
|
||||
if (typeof fn !== "function") return false;
|
||||
const t = fn[LAZY_TARGET];
|
||||
return target ? t === target : !!t;
|
||||
return target ? t === target : Boolean(t);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {function(): Promise<any> | any} fn lazy function
|
||||
* @returns {object} options
|
||||
* @returns {object | undefined} options
|
||||
*/
|
||||
static getLazyOptions(fn) {
|
||||
if (typeof fn !== "function") return undefined;
|
||||
if (typeof fn !== "function") return;
|
||||
return /** @type {any} */ (fn).options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {function(): Promise<any> | any} fn lazy function
|
||||
* @returns {any} serialized value
|
||||
* @returns {any | undefined} serialized value
|
||||
*/
|
||||
static getLazySerializedValue(fn) {
|
||||
if (typeof fn !== "function") return undefined;
|
||||
if (typeof fn !== "function") return;
|
||||
return fn[LAZY_SERIALIZED_VALUE];
|
||||
}
|
||||
|
||||
@@ -112,9 +112,10 @@ class SerializerMiddleware {
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {function(): Promise<any> | any} lazy lazy function
|
||||
* @param {function(any): Promise<any> | any} deserialize deserialize function
|
||||
* @returns {function(): Promise<any> | any} new lazy
|
||||
* @param {function(T): Promise<T> | T} deserialize deserialize function
|
||||
* @returns {function(): Promise<T> | T} new lazy
|
||||
*/
|
||||
static deserializeLazy(lazy, deserialize) {
|
||||
const fn = memoize(() => {
|
||||
|
||||
Reference in New Issue
Block a user