Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
- name: "Dependency Review"
uses: actions/dependency-review-action@v4
with:
allow-dependencies-licenses: "pkg:npm/@cspell/dict-en-common-misspellings, pkg:npm/flatted, pkg:npm/parse-imports, pkg:npm/prettier"
allow-licenses: |
0BSD,
AFL-1.1,
Expand Down
6 changes: 5 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ module.exports = [
"n/no-unsupported-features/node-builtins": [
"error",
{
ignores: ["zlib.createBrotliCompress", "zlib.createBrotliDecompress"]
ignores: [
"zlib.createBrotliCompress",
"zlib.createBrotliDecompress",
"EventSource"
]
}
],
"n/exports-style": "error"
Expand Down
32 changes: 17 additions & 15 deletions lib/Compilation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3895,28 +3895,30 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
assignDepths(modules) {
const moduleGraph = this.moduleGraph;

/** @type {Set<Module | number>} */
/** @type {Set<Module>} */
const queue = new Set(modules);
queue.add(1);
// Track these in local variables so that queue only has one data type
let nextDepthAt = queue.size;
let depth = 0;

let i = 0;
for (const module of queue) {
i++;
if (typeof module === "number") {
depth = module;
if (queue.size === i) return;
queue.add(depth + 1);
} else {
moduleGraph.setDepth(module, depth);
for (const { module: refModule } of moduleGraph.getOutgoingConnections(
module
)) {
if (refModule) {
queue.add(refModule);
}
moduleGraph.setDepth(module, depth);
// Some of these results come from cache, which speeds this up
const connections = moduleGraph.getOutgoingConnectionsByModule(module);
// connections will be undefined if there are no outgoing connections
if (connections) {
for (const refModule of connections.keys()) {
if (refModule) queue.add(refModule);
}
}
i++;
// Since this is a breadth-first search, all modules added to the queue
// while at depth N will be depth N+1
if (i >= nextDepthAt) {
depth++;
nextDepthAt = queue.size;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"toml": "^3.0.0",
"tooling": "webpack/tooling#v1.23.5",
"ts-loader": "^9.5.1",
"typescript": "^5.6.2",
"typescript": "^5.7.3",
"url-loader": "^4.1.0",
"wast-loader": "^1.12.1",
"webassembly-feature": "1.3.0",
Expand Down
16 changes: 2 additions & 14 deletions test/__snapshots__/StatsTestCases.basictest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1748,19 +1748,7 @@ webpack x.x.x compiled successfully in X ms"
`;

exports[`StatsTestCases should print correct stats for module-not-found-error 1`] = `
"ERROR in ./index.js 1:0-17
Module not found: Error: Can't resolve 'buffer' in 'Xdir/module-not-found-error'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { \\"buffer\\": require.resolve(\\"buffer/\\") }'
- install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { \\"buffer\\": false }

ERROR in ./index.js 2:0-13
"ERROR in ./index.js 2:0-13
Module not found: Error: Can't resolve 'os' in 'Xdir/module-not-found-error'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
Expand All @@ -1772,7 +1760,7 @@ If you want to include a polyfill, you need to:
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { \\"os\\": false }

webpack compiled with 2 errors"
webpack compiled with 1 error"
`;

exports[`StatsTestCases should print correct stats for module-reasons 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.module.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"lib": ["esnext", "dom"],
"lib": ["es2017", "dom"],
"allowJs": true,
"checkJs": true,
"noEmit": true,
Expand Down
74 changes: 38 additions & 36 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,20 @@ declare interface ArgumentConfig {
type: "string" | "number" | "boolean" | "path" | "enum" | "RegExp" | "reset";
values?: any[];
}
type ArrayBufferLike = ArrayBuffer | SharedArrayBuffer;
type ArrayBufferView =
| Uint8Array
| Uint8ClampedArray
| Uint16Array
| Uint32Array
| Int8Array
| Int16Array
| Int32Array
| BigUint64Array
| BigInt64Array
| Float32Array
| Float64Array
| DataView;
| Uint8Array<ArrayBufferLike>
| Uint8ClampedArray<ArrayBufferLike>
| Uint16Array<ArrayBufferLike>
| Uint32Array<ArrayBufferLike>
| Int8Array<ArrayBufferLike>
| Int16Array<ArrayBufferLike>
| Int32Array<ArrayBufferLike>
| BigUint64Array<ArrayBufferLike>
| BigInt64Array<ArrayBufferLike>
| Float32Array<ArrayBufferLike>
| Float64Array<ArrayBufferLike>
| DataView<ArrayBufferLike>;
declare interface Asset {
/**
* the filename of the asset
Expand Down Expand Up @@ -15464,6 +15465,7 @@ declare class WebpackError extends Error {
* Creates an instance of WebpackError.
*/
constructor(message?: string);
[index: number]: () => string;
details?: string;
module?: null | Module;
loc?: SyntheticDependencyLocation | RealDependencyLocation;
Expand Down Expand Up @@ -15755,37 +15757,37 @@ declare interface WriteFile {
file: PathOrFileDescriptorFs,
data:
| string
| Uint8Array
| Uint8ClampedArray
| Uint16Array
| Uint32Array
| Int8Array
| Int16Array
| Int32Array
| BigUint64Array
| BigInt64Array
| Float32Array
| Float64Array
| DataView,
| Uint8Array<ArrayBufferLike>
| Uint8ClampedArray<ArrayBufferLike>
| Uint16Array<ArrayBufferLike>
| Uint32Array<ArrayBufferLike>
| Int8Array<ArrayBufferLike>
| Int16Array<ArrayBufferLike>
| Int32Array<ArrayBufferLike>
| BigUint64Array<ArrayBufferLike>
| BigInt64Array<ArrayBufferLike>
| Float32Array<ArrayBufferLike>
| Float64Array<ArrayBufferLike>
| DataView<ArrayBufferLike>,
options: WriteFileOptions,
callback: (arg0: null | NodeJS.ErrnoException) => void
): void;
(
file: PathOrFileDescriptorFs,
data:
| string
| Uint8Array
| Uint8ClampedArray
| Uint16Array
| Uint32Array
| Int8Array
| Int16Array
| Int32Array
| BigUint64Array
| BigInt64Array
| Float32Array
| Float64Array
| DataView,
| Uint8Array<ArrayBufferLike>
| Uint8ClampedArray<ArrayBufferLike>
| Uint16Array<ArrayBufferLike>
| Uint32Array<ArrayBufferLike>
| Int8Array<ArrayBufferLike>
| Int16Array<ArrayBufferLike>
| Int32Array<ArrayBufferLike>
| BigUint64Array<ArrayBufferLike>
| BigInt64Array<ArrayBufferLike>
| Float32Array<ArrayBufferLike>
| Float64Array<ArrayBufferLike>
| DataView<ArrayBufferLike>,
callback: (arg0: null | NodeJS.ErrnoException) => void
): void;
}
Expand Down
Loading
Loading