Skip to content

Commit

Permalink
style: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Jun 11, 2024
1 parent 1954237 commit de6d4b2
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 43 deletions.
22 changes: 11 additions & 11 deletions lib/RuntimeTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class RuntimeTemplate {
? `var [${items.join(", ")}] = ${value};`
: Template.asString(
items.map((item, i) => `var ${item} = ${value}[${i}];`)
);
);
}

/**
Expand All @@ -284,7 +284,7 @@ class RuntimeTemplate {
? `var {${items.join(", ")}} = ${value};`
: Template.asString(
items.map(item => `var ${item} = ${value}${propertyAccess([item])};`)
);
);
}

/**
Expand All @@ -307,7 +307,7 @@ class RuntimeTemplate {
? `for(const ${variable} of ${array}) {\n${Template.indent(body)}\n}`
: `${array}.forEach(function(${variable}) {\n${Template.indent(
body
)}\n});`;
)}\n});`;
}

/**
Expand Down Expand Up @@ -408,10 +408,10 @@ class RuntimeTemplate {
moduleId === null
? JSON.stringify("Module is not available (weak dependency)")
: idExpr
? `"Module '" + ${idExpr} + "' is not available (weak dependency)"`
: JSON.stringify(
`Module '${moduleId}' is not available (weak dependency)`
);
? `"Module '" + ${idExpr} + "' is not available (weak dependency)"`
: JSON.stringify(
`Module '${moduleId}' is not available (weak dependency)`
);
const comment = request ? Template.toNormalComment(request) + " " : "";
const errorStatements =
`var e = new Error(${errorMessage}); ` +
Expand Down Expand Up @@ -911,8 +911,8 @@ class RuntimeTemplate {
return asiSafe
? `(${importVar}_default()${propertyAccess(exportName, 1)})`
: asiSafe === false
? `;(${importVar}_default()${propertyAccess(exportName, 1)})`
: `${importVar}_default.a${propertyAccess(exportName, 1)}`;
? `;(${importVar}_default()${propertyAccess(exportName, 1)})`
: `${importVar}_default.a${propertyAccess(exportName, 1)}`;
}
case "default-only":
case "default-with-named":
Expand Down Expand Up @@ -969,8 +969,8 @@ class RuntimeTemplate {
return asiSafe
? `(0,${access})`
: asiSafe === false
? `;(0,${access})`
: `/*#__PURE__*/Object(${access})`;
? `;(0,${access})`
: `/*#__PURE__*/Object(${access})`;
}
return access;
} else {
Expand Down
6 changes: 3 additions & 3 deletions lib/cache/PackFileCacheStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ class Pack {
map.set(identifier, content.content.get(identifier));
}
return new PackContentItems(map);
})
})
: undefined;
}
}
Expand Down Expand Up @@ -1079,8 +1079,8 @@ class PackFileCacheStrategy {
compression === "brotli"
? ".pack.br"
: compression === "gzip"
? ".pack.gz"
: ".pack";
? ".pack.gz"
: ".pack";
this.snapshot = snapshot;
/** @type {BuildDependencies} */
this.buildDependencies = new Set();
Expand Down
4 changes: 2 additions & 2 deletions lib/cache/ResolverCachePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class ResolverCachePlugin {
yields = undefined;
callbacks = false;
}
}
}
: (err, result) => {
if (callbacks === undefined) {
callback(err, result);
Expand All @@ -281,7 +281,7 @@ class ResolverCachePlugin {
activeRequests.delete(identifier);
callbacks = false;
}
};
};
/**
* @param {Error=} err error if any
* @param {CacheEntry=} cacheEntry cache entry
Expand Down
2 changes: 1 addition & 1 deletion lib/schemes/HttpUriPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class Lockfile {
: {
resolved: key,
...entry
}
}
);
}
return lockfile;
Expand Down
8 changes: 4 additions & 4 deletions lib/serialization/FileMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@ const DECOMPRESSION_CHUNK_SIZE = 100 * 1024 * 1024;
const writeUInt64LE = Buffer.prototype.writeBigUInt64LE
? (buf, value, offset) => {
buf.writeBigUInt64LE(BigInt(value), offset);
}
}
: (buf, value, offset) => {
const low = value % 0x100000000;
const high = (value - low) / 0x100000000;
buf.writeUInt32LE(low, offset);
buf.writeUInt32LE(high, offset + 4);
};
};

const readUInt64LE = Buffer.prototype.readBigUInt64LE
? (buf, offset) => {
return Number(buf.readBigUInt64LE(offset));
}
}
: (buf, offset) => {
const low = buf.readUInt32LE(offset);
const high = buf.readUInt32LE(offset + 4);
return high * 0x100000000 + low;
};
};

/**
* @typedef {object} SerializeResult
Expand Down
8 changes: 4 additions & 4 deletions lib/util/cleverMerge.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@ const mergeSingleValue = (a, b, internalCaching) => {
return aType !== VALUE_TYPE_OBJECT
? b
: internalCaching
? cachedCleverMerge(a, b)
: cleverMerge(a, b);
? cachedCleverMerge(a, b)
: cleverMerge(a, b);
}
case VALUE_TYPE_UNDEFINED:
return a;
Expand All @@ -467,8 +467,8 @@ const mergeSingleValue = (a, b, internalCaching) => {
aType !== VALUE_TYPE_ATOM
? aType
: Array.isArray(a)
? VALUE_TYPE_ARRAY_EXTEND
: VALUE_TYPE_OBJECT
? VALUE_TYPE_ARRAY_EXTEND
: VALUE_TYPE_OBJECT
) {
case VALUE_TYPE_UNDEFINED:
return b;
Expand Down
4 changes: 2 additions & 2 deletions lib/util/identifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,6 @@ exports.getUndoPath = (filename, outputPath, enforceRelative) => {
return depth > 0
? `${"../".repeat(depth)}${append}`
: enforceRelative
? `./${append}`
: append;
? `./${append}`
: append;
};
2 changes: 1 addition & 1 deletion lib/util/smartGrouping.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const smartGrouping = (items, groupConfigs) => {
(totalSize * 2) / targetGroupCount +
itemsWithGroups.size -
items.size
);
);
if (
sizeValue > bestGroupSize ||
(force && (!bestGroupOptions || !bestGroupOptions.force))
Expand Down
4 changes: 2 additions & 2 deletions lib/wasm-sync/WasmChunkLoadingRuntimeModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
"importObject"
)});`
])
])
])
: Template.asString([
"if(importObject && typeof importObject.then === 'function') {",
Template.indent([
Expand All @@ -381,7 +381,7 @@ class WasmChunkLoadingRuntimeModule extends RuntimeModule {
]),
"});"
])
]),
]),
"} else {",
Template.indent([
"var bytesPromise = req.then(function(x) { return x.arrayBuffer(); });",
Expand Down
26 changes: 13 additions & 13 deletions lib/web/JsonpChunkLoadingRuntimeModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,16 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
"}"
]),
"}"
])
])
: Template.indent(["installedChunks[chunkId] = 0;"])
)};`
])
])
: "// no chunk on demand loading",
"",
withPrefetch && hasJsMatcher !== false
? `${
RuntimeGlobals.prefetchChunkHandlers
}.j = ${runtimeTemplate.basicFunction("chunkId", [
}.j = ${runtimeTemplate.basicFunction("chunkId", [
`if((!${
RuntimeGlobals.hasOwnProperty
}(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${
Expand All @@ -233,7 +233,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
crossOriginLoading
? `link.crossOrigin = ${JSON.stringify(
crossOriginLoading
)};`
)};`
: "",
`if (${RuntimeGlobals.scriptNonce}) {`,
Template.indent(
Expand All @@ -249,13 +249,13 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
"document.head.appendChild(link);"
]),
"}"
])};`
])};`
: "// no prefetching",
"",
withPreload && hasJsMatcher !== false
? `${
RuntimeGlobals.preloadChunkHandlers
}.j = ${runtimeTemplate.basicFunction("chunkId", [
}.j = ${runtimeTemplate.basicFunction("chunkId", [
`if((!${
RuntimeGlobals.hasOwnProperty
}(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && ${
Expand Down Expand Up @@ -291,15 +291,15 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
)};`
),
"}"
])
])
: ""
]),
chunk
),
"document.head.appendChild(link);"
]),
"}"
])};`
])};`
: "// no preloaded",
"",
withHmr
Expand Down Expand Up @@ -384,7 +384,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
/\$hmrInvalidateModuleHandlers\$/g,
RuntimeGlobals.hmrInvalidateModuleHandlers
)
])
])
: "// no HMR",
"",
withHmrManifest
Expand All @@ -401,16 +401,16 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
"return response.json();"
])});`
])};`
])
])
: "// no HMR manifest",
"",
withOnChunkLoad
? `${
RuntimeGlobals.onChunksLoaded
}.j = ${runtimeTemplate.returningFunction(
}.j = ${runtimeTemplate.returningFunction(
"installedChunks[chunkId] === 0",
"chunkId"
)};`
)};`
: "// no on chunks loaded",
"",
withCallback || withLoading
Expand Down Expand Up @@ -462,7 +462,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
`var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`,
"chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));",
"chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));"
])
])
: "// no jsonp function"
]);
}
Expand Down

0 comments on commit de6d4b2

Please sign in to comment.