Skip to content

Commit

Permalink
Uprgade webpack to 5.86.0
Browse files Browse the repository at this point in the history
upgrade deps

fix pnpm lock

fix resolution

clean

update precompiled
  • Loading branch information
huozhi committed Jun 8, 2023
1 parent f2cbfe3 commit a679cee
Show file tree
Hide file tree
Showing 18 changed files with 289 additions and 129 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,16 @@
"typescript": "5.1.3",
"unfetch": "4.2.0",
"wait-port": "0.2.2",
"webpack": "5.74.0",
"webpack": "5.86.0",
"webpack-bundle-analyzer": "4.7.0",
"whatwg-fetch": "3.0.0",
"ws": "8.2.3"
},
"resolutions": {
"webpack": "5.86.0",
"browserslist": "4.20.2",
"caniuse-lite": "1.0.30001406",
"@types/node": "20.2.5",
"@babel/core": "7.18.0",
"@babel/parser": "7.18.0",
"@babel/types": "7.18.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
"vm-browserify": "1.1.2",
"watchpack": "2.4.0",
"web-vitals": "3.0.0",
"webpack": "5.74.0",
"webpack": "5.86.0",
"webpack-sources1": "npm:webpack-sources@1.4.3",
"webpack-sources3": "npm:webpack-sources@3.2.3",
"ws": "8.2.3"
Expand Down
6 changes: 3 additions & 3 deletions packages/next/src/build/webpack/loaders/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const imageRegex = new RegExp(`\\.(${imageExtensions.join('|')})$`)

export function isClientComponentEntryModule(mod: {
resource: string
buildInfo: any
buildInfo?: any
}) {
const rscInfo = mod.buildInfo.rsc
const hasClientDirective = rscInfo?.isClientRef
Expand Down Expand Up @@ -40,9 +40,9 @@ export function isCSSMod(mod: {

export function getActions(mod: {
resource: string
buildInfo: any
buildInfo?: any
}): undefined | string[] {
return mod.buildInfo.rsc?.actions
return mod.buildInfo?.rsc?.actions
}

export function generateActionId(filePath: string, exportName: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ export class ClientReferenceManifestPlugin {

// Collect client requests
function collectClientRequest(mod: webpack.NormalModule) {
if (mod.resource === '' && mod.buildInfo.rsc) {
const { requests = [] } = mod.buildInfo.rsc
if (mod.resource === '' && mod.buildInfo?.rsc) {
const { requests = [] } = mod.buildInfo?.rsc
requests.forEach((r: string) => {
clientRequestsSet.add(r)
})
Expand All @@ -150,7 +150,7 @@ export class ClientReferenceManifestPlugin {
function getAppPathRequiredChunks() {
return chunkGroup.chunks
.map((requiredChunk: webpack.Chunk) => {
if (SYSTEM_ENTRYPOINTS.has(requiredChunk.name)) {
if (SYSTEM_ENTRYPOINTS.has(requiredChunk.name || '')) {
return null
}

Expand Down Expand Up @@ -265,7 +265,7 @@ export class ClientReferenceManifestPlugin {
}
return null
}),
...(mod.buildInfo.rsc?.clientRefs || []),
...(mod.buildInfo?.rsc?.clientRefs || []),
]
.filter(Boolean)
.flat()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
"use strict";

var urlBase = decodeURIComponent(__resourceQuery.slice(1));

/**
* @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
* @returns {() => void} function to destroy response
*/
exports.keepAlive = function (options) {
var data = options.data;
var onError = options.onError;
var active = options.active;
var module = options.module;
/** @type {import("http").IncomingMessage} */
var response;
var request = (
urlBase.startsWith("https") ? require("https") : require("http")
Expand All @@ -27,6 +33,10 @@ exports.keepAlive = function (options) {
}
}
);

/**
* @param {Error} err error
*/
function errorHandler(err) {
err.message =
"Problem communicating active modules to the server: " + err.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if (typeof EventSource !== "function") {
}

var urlBase = decodeURIComponent(__resourceQuery.slice(1));
/** @type {EventSource | undefined} */
var activeEventSource;
var activeKeys = new Map();
var errorHandlers = new Set();
Expand All @@ -19,6 +20,10 @@ var updateEventSource = function updateEventSource() {
activeEventSource = new EventSource(
urlBase + Array.from(activeKeys.keys()).join("@")
);
/**
* @this {EventSource}
* @param {Event & { message?: string, filename?: string, lineno?: number, colno?: number, error?: Error }} event event
*/
activeEventSource.onerror = function (event) {
errorHandlers.forEach(function (onError) {
onError(
Expand All @@ -42,6 +47,10 @@ var updateEventSource = function updateEventSource() {
}
};

/**
* @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
* @returns {() => void} function to destroy response
*/
exports.keepAlive = function (options) {
var data = options.data;
var onError = options.onError;
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/compiled/babel/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/next/src/compiled/mini-css-extract-plugin/cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Loading

0 comments on commit a679cee

Please sign in to comment.