Compare commits
2 commits
canary
...
rspack-prg
Author | SHA1 | Date | |
---|---|---|---|
|
8e1cb7f982 | ||
|
6a772c3c4e |
19 changed files with 408 additions and 136 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next",
|
||||
"dev": "RSPACK_CONFIG_VALIDATE=loose-silent next",
|
||||
"build": "next build",
|
||||
"start": "next start"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
|
@ -18,8 +22,16 @@
|
|||
"name": "next"
|
||||
}
|
||||
],
|
||||
"strictNullChecks": true
|
||||
"strictNullChecks": true,
|
||||
"target": "ES2017"
|
||||
},
|
||||
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
".next/types/**/*.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next",
|
||||
"build": "next build",
|
||||
"dev": "RSPACK_CONFIG_VALIDATE=loose-silent next",
|
||||
"build": "RSPACK_CONFIG_VALIDATE=loose-silent next build",
|
||||
"start": "serve out"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -99,6 +99,7 @@
|
|||
"caniuse-lite": "^1.0.30001579",
|
||||
"graceful-fs": "^4.2.11",
|
||||
"postcss": "8.4.31",
|
||||
"source-map-support": "0.5.21",
|
||||
"styled-jsx": "5.1.6"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
@ -163,6 +164,7 @@
|
|||
"@next/swc": "15.0.0-canary.56",
|
||||
"@opentelemetry/api": "1.6.0",
|
||||
"@playwright/test": "1.41.2",
|
||||
"@rspack/core": "alpha",
|
||||
"@swc/core": "1.6.6",
|
||||
"@swc/types": "0.1.7",
|
||||
"@taskr/clear": "1.1.0",
|
||||
|
|
|
@ -51,6 +51,7 @@ export function runCompiler(
|
|||
]
|
||||
> {
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log(config);
|
||||
const compiler = webpack(config)
|
||||
// Ensure we use the previous inputFileSystem
|
||||
if (inputFileSystem) {
|
||||
|
|
|
@ -104,6 +104,7 @@ export async function webpackBuildImpl(
|
|||
})
|
||||
)
|
||||
|
||||
console.log(entrypoints);
|
||||
const commonWebpackOptions = {
|
||||
isServer: false,
|
||||
buildId: NextBuildContext.buildId!,
|
||||
|
|
|
@ -363,6 +363,7 @@ export default async function getBaseWebpackConfig(
|
|||
? '-experimental'
|
||||
: ''
|
||||
|
||||
|
||||
const babelConfigFile = getBabelConfigFile(dir)
|
||||
|
||||
if (!dev && hasCustomExportOutput(config)) {
|
||||
|
@ -1104,35 +1105,35 @@ export default async function getBaseWebpackConfig(
|
|||
const {
|
||||
TerserPlugin,
|
||||
} = require('./webpack/plugins/terser-webpack-plugin/src/index.js')
|
||||
new TerserPlugin({
|
||||
terserOptions: {
|
||||
...terserOptions,
|
||||
compress: {
|
||||
...terserOptions.compress,
|
||||
},
|
||||
mangle: {
|
||||
...terserOptions.mangle,
|
||||
},
|
||||
},
|
||||
}).apply(compiler)
|
||||
// new TerserPlugin({
|
||||
// terserOptions: {
|
||||
// ...terserOptions,
|
||||
// compress: {
|
||||
// ...terserOptions.compress,
|
||||
// },
|
||||
// mangle: {
|
||||
// ...terserOptions.mangle,
|
||||
// },
|
||||
// },
|
||||
// }).apply(compiler)
|
||||
},
|
||||
// Minify CSS
|
||||
(compiler: webpack.Compiler) => {
|
||||
const {
|
||||
CssMinimizerPlugin,
|
||||
} = require('./webpack/plugins/css-minimizer-plugin')
|
||||
new CssMinimizerPlugin({
|
||||
postcssOptions: {
|
||||
map: {
|
||||
// `inline: false` generates the source map in a separate file.
|
||||
// Otherwise, the CSS file is needlessly large.
|
||||
inline: false,
|
||||
// `annotation: false` skips appending the `sourceMappingURL`
|
||||
// to the end of the CSS file. Webpack already handles this.
|
||||
annotation: false,
|
||||
},
|
||||
},
|
||||
}).apply(compiler)
|
||||
// new CssMinimizerPlugin({
|
||||
// postcssOptions: {
|
||||
// map: {
|
||||
// // `inline: false` generates the source map in a separate file.
|
||||
// // Otherwise, the CSS file is needlessly large.
|
||||
// inline: false,
|
||||
// // `annotation: false` skips appending the `sourceMappingURL`
|
||||
// // to the end of the CSS file. Webpack already handles this.
|
||||
// annotation: false,
|
||||
// },
|
||||
// },
|
||||
// }).apply(compiler)
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -1229,12 +1230,12 @@ export default async function getBaseWebpackConfig(
|
|||
rules: [
|
||||
// Alias server-only and client-only to proper exports based on bundling layers
|
||||
{
|
||||
issuerLayer: {
|
||||
or: [
|
||||
...WEBPACK_LAYERS.GROUP.serverOnly,
|
||||
...WEBPACK_LAYERS.GROUP.neutralTarget,
|
||||
],
|
||||
},
|
||||
// issuerLayer: {
|
||||
// or: [
|
||||
// ...WEBPACK_LAYERS.GROUP.serverOnly,
|
||||
// ...WEBPACK_LAYERS.GROUP.neutralTarget,
|
||||
// ],
|
||||
// },
|
||||
resolve: {
|
||||
// Error on client-only but allow server-only
|
||||
alias: createServerOnlyClientOnlyAliases(true),
|
||||
|
@ -1740,7 +1741,7 @@ export default async function getBaseWebpackConfig(
|
|||
resource.request,
|
||||
'.shared-runtime'
|
||||
)
|
||||
const layer = resource.contextInfo.issuerLayer
|
||||
const layer = 'pages' as string;
|
||||
let runtime
|
||||
|
||||
switch (layer) {
|
||||
|
@ -1757,7 +1758,7 @@ export default async function getBaseWebpackConfig(
|
|||
}
|
||||
),
|
||||
dev && new MemoryWithGcCachePlugin({ maxGenerations: 5 }),
|
||||
dev && isClient && new ReactRefreshWebpackPlugin(webpack),
|
||||
// dev && isClient && new ReactRefreshWebpackPlugin(webpack),
|
||||
// Makes sure `Buffer` and `process` are polyfilled in client and flight bundles (same behavior as webpack 4)
|
||||
(isClient || isEdgeServer) &&
|
||||
new webpack.ProvidePlugin({
|
||||
|
@ -1788,7 +1789,7 @@ export default async function getBaseWebpackConfig(
|
|||
runtimeAsset: `server/${MIDDLEWARE_REACT_LOADABLE_MANIFEST}.js`,
|
||||
dev,
|
||||
}),
|
||||
(isClient || isEdgeServer) && new DropClientPage(),
|
||||
// (isClient || isEdgeServer) && new DropClientPage(),
|
||||
isNodeServer &&
|
||||
!dev &&
|
||||
new (require('./webpack/plugins/next-trace-entrypoints-plugin')
|
||||
|
@ -1823,9 +1824,9 @@ export default async function getBaseWebpackConfig(
|
|||
const { NextJsRequireCacheHotReloader } =
|
||||
require('./webpack/plugins/nextjs-require-cache-hot-reloader') as typeof import('./webpack/plugins/nextjs-require-cache-hot-reloader')
|
||||
const devPlugins: any[] = [
|
||||
new NextJsRequireCacheHotReloader({
|
||||
serverComponents: hasAppDir,
|
||||
}),
|
||||
// new NextJsRequireCacheHotReloader({
|
||||
// serverComponents: hasAppDir,
|
||||
// }),
|
||||
]
|
||||
|
||||
if (isClient || isEdgeServer) {
|
||||
|
@ -1867,7 +1868,7 @@ export default async function getBaseWebpackConfig(
|
|||
isDevFallback,
|
||||
appDirEnabled: hasAppDir,
|
||||
}),
|
||||
new ProfilingPlugin({ runWebpackSpan, rootDir: dir }),
|
||||
// new ProfilingPlugin({ runWebpackSpan, rootDir: dir }),
|
||||
config.optimizeFonts &&
|
||||
!dev &&
|
||||
isNodeServer &&
|
||||
|
@ -1876,11 +1877,11 @@ export default async function getBaseWebpackConfig(
|
|||
require('./webpack/plugins/font-stylesheet-gathering-plugin') as {
|
||||
FontStylesheetGatheringPlugin: typeof import('./webpack/plugins/font-stylesheet-gathering-plugin').FontStylesheetGatheringPlugin
|
||||
}
|
||||
return new FontStylesheetGatheringPlugin({
|
||||
adjustFontFallbacks: config.experimental.adjustFontFallbacks,
|
||||
adjustFontFallbacksWithSizeAdjust:
|
||||
config.experimental.adjustFontFallbacksWithSizeAdjust,
|
||||
})
|
||||
// return new FontStylesheetGatheringPlugin({
|
||||
// adjustFontFallbacks: config.experimental.adjustFontFallbacks,
|
||||
// adjustFontFallbacksWithSizeAdjust:
|
||||
// config.experimental.adjustFontFallbacksWithSizeAdjust,
|
||||
// })
|
||||
})(),
|
||||
new WellKnownErrorsPlugin(),
|
||||
isClient &&
|
||||
|
@ -2266,22 +2267,22 @@ export default async function getBaseWebpackConfig(
|
|||
const webpack5Config = webpackConfig as webpack.Configuration
|
||||
|
||||
// disable lazy compilation of entries as next.js has it's own method here
|
||||
if (webpack5Config.experiments?.lazyCompilation === true) {
|
||||
webpack5Config.experiments.lazyCompilation = {
|
||||
entries: false,
|
||||
}
|
||||
} else if (
|
||||
typeof webpack5Config.experiments?.lazyCompilation === 'object' &&
|
||||
webpack5Config.experiments.lazyCompilation.entries !== false
|
||||
) {
|
||||
webpack5Config.experiments.lazyCompilation.entries = false
|
||||
}
|
||||
// if (webpack5Config.experiments?.lazyCompilation === true) {
|
||||
// webpack5Config.experiments.lazyCompilation = {
|
||||
// entries: false,
|
||||
// }
|
||||
// } else if (
|
||||
// typeof webpack5Config.experiments?.lazyCompilation === 'object' &&
|
||||
// webpack5Config.experiments.lazyCompilation.entries !== false
|
||||
// ) {
|
||||
// webpack5Config.experiments.lazyCompilation.entries = false
|
||||
// }
|
||||
|
||||
if (typeof (webpackConfig as any).then === 'function') {
|
||||
console.warn(
|
||||
'> Promise returned in next config. https://nextjs.org/docs/messages/promise-in-next-config'
|
||||
)
|
||||
}
|
||||
// if (typeof (webpackConfig as any).then === 'function') {
|
||||
// console.warn(
|
||||
// '> Promise returned in next config. https://nextjs.org/docs/messages/promise-in-next-config'
|
||||
// )
|
||||
// }
|
||||
}
|
||||
|
||||
const rules = webpackConfig.module?.rules || []
|
||||
|
|
|
@ -588,47 +588,47 @@ export const css = curry(async function css(
|
|||
}
|
||||
|
||||
// Enable full mini-css-extract-plugin hmr for prod mode pages or app dir
|
||||
if (ctx.isClient && (ctx.isProduction || ctx.hasAppDir)) {
|
||||
// Extract CSS as CSS file(s) in the client-side production bundle.
|
||||
const MiniCssExtractPlugin =
|
||||
require('../../../plugins/mini-css-extract-plugin').default
|
||||
fns.push(
|
||||
plugin(
|
||||
// @ts-ignore webpack 5 compat
|
||||
new MiniCssExtractPlugin({
|
||||
filename: ctx.isProduction
|
||||
? 'static/css/[contenthash].css'
|
||||
: 'static/css/[name].css',
|
||||
chunkFilename: ctx.isProduction
|
||||
? 'static/css/[contenthash].css'
|
||||
: 'static/css/[name].css',
|
||||
// Next.js guarantees that CSS order "doesn't matter", due to imposed
|
||||
// restrictions:
|
||||
// 1. Global CSS can only be defined in a single entrypoint (_app)
|
||||
// 2. CSS Modules generate scoped class names by default and cannot
|
||||
// include Global CSS (:global() selector).
|
||||
//
|
||||
// While not a perfect guarantee (e.g. liberal use of `:global()`
|
||||
// selector), this assumption is required to code-split CSS.
|
||||
//
|
||||
// If this warning were to trigger, it'd be unactionable by the user,
|
||||
// but likely not valid -- so we disable it.
|
||||
ignoreOrder: true,
|
||||
insert: function (linkTag: HTMLLinkElement) {
|
||||
if (typeof _N_E_STYLE_LOAD === 'function') {
|
||||
const { href, onload, onerror } = linkTag
|
||||
_N_E_STYLE_LOAD(new URL(href).pathname).then(
|
||||
() => onload?.call(linkTag, { type: 'load' } as Event),
|
||||
() => onerror?.call(linkTag, {} as Event)
|
||||
)
|
||||
} else {
|
||||
document.head.appendChild(linkTag)
|
||||
}
|
||||
},
|
||||
})
|
||||
)
|
||||
)
|
||||
}
|
||||
// if (ctx.isClient && (ctx.isProduction || ctx.hasAppDir)) {
|
||||
// // Extract CSS as CSS file(s) in the client-side production bundle.
|
||||
// const MiniCssExtractPlugin =
|
||||
// require('../../../plugins/mini-css-extract-plugin').default
|
||||
// fns.push(
|
||||
// plugin(
|
||||
// // @ts-ignore webpack 5 compat
|
||||
// new MiniCssExtractPlugin({
|
||||
// filename: ctx.isProduction
|
||||
// ? 'static/css/[contenthash].css'
|
||||
// : 'static/css/[name].css',
|
||||
// chunkFilename: ctx.isProduction
|
||||
// ? 'static/css/[contenthash].css'
|
||||
// : 'static/css/[name].css',
|
||||
// // Next.js guarantees that CSS order "doesn't matter", due to imposed
|
||||
// // restrictions:
|
||||
// // 1. Global CSS can only be defined in a single entrypoint (_app)
|
||||
// // 2. CSS Modules generate scoped class names by default and cannot
|
||||
// // include Global CSS (:global() selector).
|
||||
// //
|
||||
// // While not a perfect guarantee (e.g. liberal use of `:global()`
|
||||
// // selector), this assumption is required to code-split CSS.
|
||||
// //
|
||||
// // If this warning were to trigger, it'd be unactionable by the user,
|
||||
// // but likely not valid -- so we disable it.
|
||||
// ignoreOrder: true,
|
||||
// insert: function (linkTag: HTMLLinkElement) {
|
||||
// if (typeof _N_E_STYLE_LOAD === 'function') {
|
||||
// const { href, onload, onerror } = linkTag
|
||||
// _N_E_STYLE_LOAD(new URL(href).pathname).then(
|
||||
// () => onload?.call(linkTag, { type: 'load' } as Event),
|
||||
// () => onerror?.call(linkTag, {} as Event)
|
||||
// )
|
||||
// } else {
|
||||
// document.head.appendChild(linkTag)
|
||||
// }
|
||||
// },
|
||||
// })
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
|
||||
const fn = pipe(...fns)
|
||||
return fn(config)
|
||||
|
|
|
@ -7,16 +7,9 @@ export type ClientPagesLoaderOptions = {
|
|||
|
||||
// this parameter: https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters
|
||||
function nextClientPagesLoader(this: any) {
|
||||
const pagesLoaderSpan = this.currentTraceSpan.traceChild(
|
||||
'next-client-pages-loader'
|
||||
)
|
||||
|
||||
return pagesLoaderSpan.traceFn(() => {
|
||||
const { absolutePagePath, page } =
|
||||
this.getOptions() as ClientPagesLoaderOptions
|
||||
|
||||
pagesLoaderSpan.setAttribute('absolutePagePath', absolutePagePath)
|
||||
|
||||
const stringifiedPageRequest = stringifyRequest(this, absolutePagePath)
|
||||
const stringifiedPage = JSON.stringify(page)
|
||||
|
||||
|
@ -33,7 +26,6 @@ function nextClientPagesLoader(this: any) {
|
|||
});
|
||||
}
|
||||
`
|
||||
})
|
||||
}
|
||||
|
||||
export default nextClientPagesLoader
|
||||
|
|
|
@ -33,7 +33,7 @@ export function isCSSMod(mod: {
|
|||
mod.loaders?.some(
|
||||
({ loader }) =>
|
||||
loader.includes('next-style-loader/index.js') ||
|
||||
loader.includes('mini-css-extract-plugin/loader.js') ||
|
||||
// loader.includes('mini-css-extract-plugin/loader.js') ||
|
||||
loader.includes('@vanilla-extract/webpack-plugin/loader/')
|
||||
)
|
||||
)
|
||||
|
|
|
@ -772,6 +772,7 @@ export default class MiddlewarePlugin {
|
|||
}
|
||||
|
||||
public apply(compiler: webpack.Compiler) {
|
||||
return;
|
||||
compiler.hooks.compilation.tap(NAME, (compilation, params) => {
|
||||
const { hooks } = params.normalModuleFactory
|
||||
/**
|
||||
|
|
|
@ -677,6 +677,7 @@ export class TraceEntryPointsPlugin implements webpack.WebpackPluginInstance {
|
|||
}
|
||||
|
||||
apply(compiler: webpack.Compiler) {
|
||||
return;
|
||||
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
||||
const readlink = async (path: string): Promise<string | null> => {
|
||||
try {
|
||||
|
|
|
@ -169,20 +169,21 @@ export class ReactLoadablePlugin {
|
|||
const projectSrcDir = this.pagesOrAppDir
|
||||
? path.dirname(this.pagesOrAppDir)
|
||||
: undefined
|
||||
const manifest = buildManifest(
|
||||
compiler,
|
||||
compilation,
|
||||
projectSrcDir,
|
||||
this.dev
|
||||
)
|
||||
|
||||
assets[this.filename] = new sources.RawSource(
|
||||
JSON.stringify(manifest, null, 2)
|
||||
)
|
||||
// const manifest = buildManifest(
|
||||
// compiler,
|
||||
// compilation,
|
||||
// projectSrcDir,
|
||||
// this.dev
|
||||
// )
|
||||
//
|
||||
// assets[this.filename] = new sources.RawSource(
|
||||
// JSON.stringify(manifest, null, 2)
|
||||
// )
|
||||
if (this.runtimeAsset) {
|
||||
assets[this.runtimeAsset] = new sources.RawSource(
|
||||
`self.__REACT_LOADABLE_MANIFEST=${JSON.stringify(
|
||||
JSON.stringify(manifest)
|
||||
JSON.stringify({ })
|
||||
)}`
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,113 @@
|
|||
exports.__esModule = true
|
||||
|
||||
exports.default = undefined
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
|
||||
/**
|
||||
* StringXor class provides methods for performing
|
||||
* [XOR operations](https://en.wikipedia.org/wiki/Exclusive_or) on strings. In this context
|
||||
* we operating on the character codes of two strings, which are represented as
|
||||
* [Buffer](https://nodejs.org/api/buffer.html) objects.
|
||||
*
|
||||
* We use [StringXor in webpack](https://github.com/webpack/webpack/commit/41a8e2ea483a544c4ccd3e6217bdfb80daffca39)
|
||||
* to create a hash of the current state of the compilation. By XOR'ing the Module hashes, it
|
||||
* doesn't matter if the Module hashes are sorted or not. This is useful because it allows us to avoid sorting the
|
||||
* Module hashes.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const xor = new StringXor();
|
||||
* xor.add('hello');
|
||||
* xor.add('world');
|
||||
* console.log(xor.toString());
|
||||
* ```
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const xor = new StringXor();
|
||||
* xor.add('foo');
|
||||
* xor.add('bar');
|
||||
* const hash = createHash('sha256');
|
||||
* hash.update(xor.toString());
|
||||
* console.log(hash.digest('hex'));
|
||||
* ```
|
||||
*/
|
||||
class StringXor {
|
||||
constructor() {
|
||||
/** @type {Buffer|undefined} */
|
||||
this._value = undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a string to the current StringXor object.
|
||||
*
|
||||
* @param {string} str string
|
||||
* @returns {void}
|
||||
*/
|
||||
add(str) {
|
||||
const len = str.length;
|
||||
const value = this._value;
|
||||
if (value === undefined) {
|
||||
/**
|
||||
* We are choosing to use Buffer.allocUnsafe() because it is often faster than Buffer.alloc() because
|
||||
* it allocates a new buffer of the specified size without initializing the memory.
|
||||
*/
|
||||
const newValue = (this._value = Buffer.allocUnsafe(len));
|
||||
for (let i = 0; i < len; i++) {
|
||||
newValue[i] = str.charCodeAt(i);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const valueLen = value.length;
|
||||
if (valueLen < len) {
|
||||
const newValue = (this._value = Buffer.allocUnsafe(len));
|
||||
let i;
|
||||
for (i = 0; i < valueLen; i++) {
|
||||
newValue[i] = value[i] ^ str.charCodeAt(i);
|
||||
}
|
||||
for (; i < len; i++) {
|
||||
newValue[i] = str.charCodeAt(i);
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < len; i++) {
|
||||
value[i] = value[i] ^ str.charCodeAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string that represents the current state of the StringXor object. We chose to use "latin1" encoding
|
||||
* here because "latin1" encoding is a single-byte encoding that can represent all characters in the
|
||||
* [ISO-8859-1 character set](https://en.wikipedia.org/wiki/ISO/IEC_8859-1). This is useful when working
|
||||
* with binary data that needs to be represented as a string.
|
||||
*
|
||||
* @returns {string} Returns a string that represents the current state of the StringXor object.
|
||||
*/
|
||||
toString() {
|
||||
const value = this._value;
|
||||
return value === undefined ? "" : value.toString("latin1");
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the hash with the current state of the StringXor object.
|
||||
*
|
||||
* @param {Hash} hash Hash instance
|
||||
*/
|
||||
updateHash(hash) {
|
||||
const value = this._value;
|
||||
if (value !== undefined) hash.update(value);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = StringXor;
|
||||
|
||||
|
||||
exports.init = function () {
|
||||
if (process.env.NEXT_PRIVATE_LOCAL_WEBPACK) {
|
||||
|
@ -12,7 +119,7 @@ exports.init = function () {
|
|||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
NodeTargetPlugin: require('webpack/lib/node/NodeTargetPlugin'),
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
StringXor: require('webpack/lib/util/StringXor'),
|
||||
StringXor,
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
NormalModule: require('webpack/lib/NormalModule'),
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env node
|
||||
require('source-map-support').install();
|
||||
|
||||
import '../server/lib/cpu-profile'
|
||||
import { existsSync } from 'fs'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env node
|
||||
require('source-map-support').install();
|
||||
|
||||
import '../server/lib/cpu-profile'
|
||||
import type { StartServerOptions } from '../server/lib/start-server'
|
||||
|
|
|
@ -21,6 +21,7 @@ exports.init = function () {
|
|||
webpack: require('webpack'),
|
||||
})
|
||||
} else {
|
||||
Object.assign(exports, require('./bundle5')())
|
||||
console.log('load rspack');
|
||||
Object.assign(exports, require('@rspack/core'))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import type { UrlObject } from 'url'
|
|||
import type { RouteDefinition } from '../route-definitions/route-definition'
|
||||
|
||||
import { webpack, StringXor } from 'next/dist/compiled/webpack/webpack'
|
||||
import {util} from "@rspack/core"
|
||||
import { getOverlayMiddleware } from '../../client/components/react-dev-overlay/server/middleware'
|
||||
import { WebpackHotMiddleware } from './hot-middleware'
|
||||
import { join, relative, isAbsolute, posix } from 'path'
|
||||
|
@ -768,7 +769,6 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface {
|
|||
Object.keys(entries).map(async (entryKey) => {
|
||||
const entryData = entries[entryKey]
|
||||
const { bundlePath, dispose } = entryData
|
||||
|
||||
const result =
|
||||
/^(client|server|edge-server)@(app|pages|root)@(.*)/g.exec(
|
||||
entryKey
|
||||
|
@ -1130,8 +1130,8 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface {
|
|||
stats.chunkGraph.getChunkModulesIterable(chunk)
|
||||
|
||||
let hasCSSModuleChanges = false
|
||||
let chunksHash = new StringXor()
|
||||
let chunksHashServerLayer = new StringXor()
|
||||
let chunksHash = util.createHash('md4')
|
||||
let chunksHashServerLayer = util.createHash('md4');
|
||||
|
||||
modsIterable.forEach((mod: any) => {
|
||||
if (
|
||||
|
|
166
pnpm-lock.yaml
166
pnpm-lock.yaml
|
@ -868,6 +868,9 @@ importers:
|
|||
sass:
|
||||
specifier: ^1.3.0
|
||||
version: 1.77.6
|
||||
source-map-support:
|
||||
specifier: 0.5.21
|
||||
version: 0.5.21
|
||||
styled-jsx:
|
||||
specifier: 5.1.6
|
||||
version: 5.1.6(@babel/core@7.22.5)(babel-plugin-macros@3.1.0)(react@19.0.0-rc-6230622a1a-20240610)
|
||||
|
@ -984,6 +987,9 @@ importers:
|
|||
'@playwright/test':
|
||||
specifier: 1.41.2
|
||||
version: 1.41.2
|
||||
'@rspack/core':
|
||||
specifier: alpha
|
||||
version: 1.0.0-alpha.1(@swc/helpers@0.5.11)
|
||||
'@swc/core':
|
||||
specifier: 1.6.6
|
||||
version: 1.6.6(@swc/helpers@0.5.11)
|
||||
|
@ -3943,6 +3949,18 @@ packages:
|
|||
peerDependencies:
|
||||
react: 19.0.0-rc-6230622a1a-20240610
|
||||
|
||||
'@module-federation/runtime-tools@0.2.3':
|
||||
resolution: {integrity: sha512-capN8CVTCEqNAjnl102girrkevczoQfnQYyiYC4WuyKsg7+LUqfirIe1Eiyv6VSE2UgvOTZDnqvervA6rBOlmg==}
|
||||
|
||||
'@module-federation/runtime@0.2.3':
|
||||
resolution: {integrity: sha512-N+ZxBUb1mkmfO9XT1BwgYQgShtUTlijHbukqQ4afFka5lRAT+ayC7RKfHJLz0HbuexKPCmPBDfdmCnErR5WyTQ==}
|
||||
|
||||
'@module-federation/sdk@0.2.3':
|
||||
resolution: {integrity: sha512-W9zrPchLocyCBc/B8CW21akcfJXLl++9xBe1L1EtgxZGfj/xwHt0GcBWE/y+QGvYTL2a1iZjwscbftbUhxgxXg==}
|
||||
|
||||
'@module-federation/webpack-bundler-runtime@0.2.3':
|
||||
resolution: {integrity: sha512-L/jt2uJ+8dwYiyn9GxryzDR6tr/Wk8rpgvelM2EBeLIhu7YxCHSmSjQYhw3BTux9zZIr47d1K9fGjBFsVRd/SQ==}
|
||||
|
||||
'@mswjs/cookies@1.1.0':
|
||||
resolution: {integrity: sha512-0ZcCVQxifZmhwNBoQIrystCb+2sWBY2Zw8lpfJBPCHGCA/HWqehITeCRVIv4VMy8MPlaHo2w2pTHFV2pFfqKPw==}
|
||||
engines: {node: '>=18'}
|
||||
|
@ -4378,6 +4396,67 @@ packages:
|
|||
resolution: {integrity: sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==}
|
||||
engines: {node: '>= 8.0.0'}
|
||||
|
||||
'@rspack/binding-darwin-arm64@1.0.0-alpha.1':
|
||||
resolution: {integrity: sha512-6ZbxlS5+29bvYqsEoPMvCnn6NxZPq8CucuDDSwuP/w0UH81DD2yf9Mtn7IYDBhjiS7wv9pF4NYr7oDpGfOksHA==}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@rspack/binding-darwin-x64@1.0.0-alpha.1':
|
||||
resolution: {integrity: sha512-4Y9xfwaTHJBTrq5uav/tOWvCMLcBG72SEi+XgVjsZOC2ZS2WNqg4z0QCRzmt+agdmlWuXTOMB2LpYxRLxBj9sg==}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@rspack/binding-linux-arm64-gnu@1.0.0-alpha.1':
|
||||
resolution: {integrity: sha512-cew/WxOILZkTN1I+oWrt1BSnm3iK4/8DqX/6XxiUwCAmgfStZXB5NQS+SDIDBzFJ4I+NibLRMiJy5T9uCtOWzQ==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@rspack/binding-linux-arm64-musl@1.0.0-alpha.1':
|
||||
resolution: {integrity: sha512-+yLjjl8nkWRseQwwovaaLMshTKTep/5PSFN3nHtXPo/TsL1itDgUtM9XntTdeTdaIEgVyNGcb1dRARDoAq/vKw==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@rspack/binding-linux-x64-gnu@1.0.0-alpha.1':
|
||||
resolution: {integrity: sha512-QQfGCTrn76d6fVoWnn6tm2eYTSJe78wc3X4H92Js+ZhjcHVn5XSTeyqyb0Oq4+TRKmwAi39/wUgPsbSxQj9g5A==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@rspack/binding-linux-x64-musl@1.0.0-alpha.1':
|
||||
resolution: {integrity: sha512-ZpVTXPjG5SLwKUYiwLR6XIlo/G4ZQHA6TBKFbPG3p9kZ0DYurGjt8bcjeiu9xP050XmTA0Hj5vS6zEdYtgE6bA==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@rspack/binding-win32-arm64-msvc@1.0.0-alpha.1':
|
||||
resolution: {integrity: sha512-8wTNt1MgJgUMRJ2ySAToUZoeBJabOV/lqH2o1ypHdmirZ0aMno+C05XOmbrLhgZL2qKBROVt4VVa7+IlmvJ7yQ==}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@rspack/binding-win32-ia32-msvc@1.0.0-alpha.1':
|
||||
resolution: {integrity: sha512-hfujEyp1+0yfAzShQJZUezdiHQ7KvTwC0T817/dQi4CdwoXWOuPnnYrb5JG5TAcagNttQNX2NFhVbeYQgj5c8Q==}
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
|
||||
'@rspack/binding-win32-x64-msvc@1.0.0-alpha.1':
|
||||
resolution: {integrity: sha512-KMIosN4wdXVFb3RIBX7fEXBv5jfinK0PkYSv8aQcIAdyhm2mSI95aCpAFE8xhgGCeSwaZ2PCO0zBgO0ZldAc7Q==}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@rspack/binding@1.0.0-alpha.1':
|
||||
resolution: {integrity: sha512-3q3cN5kZZdaAnIrjVhkW2f2RbLpxgSp8ATs4P6fzUoKvuunU1v+KXbhPir/tKaKBXLgYH2h3i13tPDcuL3kA+A==}
|
||||
|
||||
'@rspack/core@1.0.0-alpha.1':
|
||||
resolution: {integrity: sha512-UN6oAWnDJpouldf6UDuZZIc1GSgEgSAeeIQlpCwob9v+uuZ/NjJHvG7HCjxeHtkh1g9Oly8clOZA7gKOWtE4CA==}
|
||||
engines: {node: '>=16.0.0'}
|
||||
peerDependencies:
|
||||
'@swc/helpers': '>=0.5.1'
|
||||
peerDependenciesMeta:
|
||||
'@swc/helpers':
|
||||
optional: true
|
||||
|
||||
'@rspack/lite-tapable@1.0.0-alpha.1':
|
||||
resolution: {integrity: sha512-vgY3jauZk+Pd6u6I5d4Rs9Q7hUtl5mClKG2Hn/FucFL4WK+1m6kssu/576WEY6HP5ptBPWlqcBbamzodai1q1g==}
|
||||
engines: {node: '>=16.0.0'}
|
||||
|
||||
'@rushstack/eslint-patch@1.3.3':
|
||||
resolution: {integrity: sha512-0xd7qez0AQ+MbHatZTlI1gu5vkG8r7MYRUJAHPAHJBmGLs16zpkrpAVLvjQKQOqaXPDUBwOiJzNc00znHSCVBw==}
|
||||
|
||||
|
@ -13255,6 +13334,9 @@ packages:
|
|||
source-map-support@0.5.20:
|
||||
resolution: {integrity: sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==}
|
||||
|
||||
source-map-support@0.5.21:
|
||||
resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==}
|
||||
|
||||
source-map-url@0.4.0:
|
||||
resolution: {integrity: sha512-liJwHPI9x9d9w5WSIjM58MqGmmb7XzNqwdUA3kSBQ4lmDngexlKwawGzK3J1mKXi6+sysoMDlpVyZh9sv5vRfw==}
|
||||
deprecated: See https://github.com/lydell/source-map-url#deprecated
|
||||
|
@ -18189,6 +18271,22 @@ snapshots:
|
|||
'@types/react': types-react@19.0.0-rc.0
|
||||
react: 19.0.0-rc-6230622a1a-20240610
|
||||
|
||||
'@module-federation/runtime-tools@0.2.3':
|
||||
dependencies:
|
||||
'@module-federation/runtime': 0.2.3
|
||||
'@module-federation/webpack-bundler-runtime': 0.2.3
|
||||
|
||||
'@module-federation/runtime@0.2.3':
|
||||
dependencies:
|
||||
'@module-federation/sdk': 0.2.3
|
||||
|
||||
'@module-federation/sdk@0.2.3': {}
|
||||
|
||||
'@module-federation/webpack-bundler-runtime@0.2.3':
|
||||
dependencies:
|
||||
'@module-federation/runtime': 0.2.3
|
||||
'@module-federation/sdk': 0.2.3
|
||||
|
||||
'@mswjs/cookies@1.1.0': {}
|
||||
|
||||
'@mswjs/interceptors@0.23.0':
|
||||
|
@ -18751,6 +18849,56 @@ snapshots:
|
|||
estree-walker: 2.0.2
|
||||
picomatch: 2.3.1
|
||||
|
||||
'@rspack/binding-darwin-arm64@1.0.0-alpha.1':
|
||||
optional: true
|
||||
|
||||
'@rspack/binding-darwin-x64@1.0.0-alpha.1':
|
||||
optional: true
|
||||
|
||||
'@rspack/binding-linux-arm64-gnu@1.0.0-alpha.1':
|
||||
optional: true
|
||||
|
||||
'@rspack/binding-linux-arm64-musl@1.0.0-alpha.1':
|
||||
optional: true
|
||||
|
||||
'@rspack/binding-linux-x64-gnu@1.0.0-alpha.1':
|
||||
optional: true
|
||||
|
||||
'@rspack/binding-linux-x64-musl@1.0.0-alpha.1':
|
||||
optional: true
|
||||
|
||||
'@rspack/binding-win32-arm64-msvc@1.0.0-alpha.1':
|
||||
optional: true
|
||||
|
||||
'@rspack/binding-win32-ia32-msvc@1.0.0-alpha.1':
|
||||
optional: true
|
||||
|
||||
'@rspack/binding-win32-x64-msvc@1.0.0-alpha.1':
|
||||
optional: true
|
||||
|
||||
'@rspack/binding@1.0.0-alpha.1':
|
||||
optionalDependencies:
|
||||
'@rspack/binding-darwin-arm64': 1.0.0-alpha.1
|
||||
'@rspack/binding-darwin-x64': 1.0.0-alpha.1
|
||||
'@rspack/binding-linux-arm64-gnu': 1.0.0-alpha.1
|
||||
'@rspack/binding-linux-arm64-musl': 1.0.0-alpha.1
|
||||
'@rspack/binding-linux-x64-gnu': 1.0.0-alpha.1
|
||||
'@rspack/binding-linux-x64-musl': 1.0.0-alpha.1
|
||||
'@rspack/binding-win32-arm64-msvc': 1.0.0-alpha.1
|
||||
'@rspack/binding-win32-ia32-msvc': 1.0.0-alpha.1
|
||||
'@rspack/binding-win32-x64-msvc': 1.0.0-alpha.1
|
||||
|
||||
'@rspack/core@1.0.0-alpha.1(@swc/helpers@0.5.11)':
|
||||
dependencies:
|
||||
'@module-federation/runtime-tools': 0.2.3
|
||||
'@rspack/binding': 1.0.0-alpha.1
|
||||
'@rspack/lite-tapable': 1.0.0-alpha.1
|
||||
caniuse-lite: 1.0.30001579
|
||||
optionalDependencies:
|
||||
'@swc/helpers': 0.5.11
|
||||
|
||||
'@rspack/lite-tapable@1.0.0-alpha.1': {}
|
||||
|
||||
'@rushstack/eslint-patch@1.3.3': {}
|
||||
|
||||
'@shuding/opentype.js@1.4.0-beta.0':
|
||||
|
@ -20403,7 +20551,6 @@ snapshots:
|
|||
braces@3.0.3:
|
||||
dependencies:
|
||||
fill-range: 7.1.1
|
||||
optional: true
|
||||
|
||||
brorand@1.1.0: {}
|
||||
|
||||
|
@ -20779,7 +20926,6 @@ snapshots:
|
|||
readdirp: 3.6.0
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.3
|
||||
optional: true
|
||||
|
||||
chownr@1.1.3: {}
|
||||
|
||||
|
@ -23125,7 +23271,6 @@ snapshots:
|
|||
fill-range@7.1.1:
|
||||
dependencies:
|
||||
to-regex-range: 5.0.1
|
||||
optional: true
|
||||
|
||||
finalhandler@1.1.2:
|
||||
dependencies:
|
||||
|
@ -29374,7 +29519,7 @@ snapshots:
|
|||
|
||||
sass@1.77.6:
|
||||
dependencies:
|
||||
chokidar: 3.5.3
|
||||
chokidar: 3.6.0
|
||||
immutable: 4.1.0
|
||||
source-map-js: 1.0.2
|
||||
|
||||
|
@ -29714,12 +29859,17 @@ snapshots:
|
|||
|
||||
source-map-support@0.5.13:
|
||||
dependencies:
|
||||
buffer-from: 1.1.1
|
||||
buffer-from: 1.1.2
|
||||
source-map: 0.6.1
|
||||
|
||||
source-map-support@0.5.20:
|
||||
dependencies:
|
||||
buffer-from: 1.1.1
|
||||
buffer-from: 1.1.2
|
||||
source-map: 0.6.1
|
||||
|
||||
source-map-support@0.5.21:
|
||||
dependencies:
|
||||
buffer-from: 1.1.2
|
||||
source-map: 0.6.1
|
||||
|
||||
source-map-url@0.4.0: {}
|
||||
|
@ -30319,14 +30469,14 @@ snapshots:
|
|||
'@jridgewell/source-map': 0.3.3
|
||||
acorn: 8.11.3
|
||||
commander: 2.20.0
|
||||
source-map-support: 0.5.20
|
||||
source-map-support: 0.5.21
|
||||
|
||||
terser@5.5.1:
|
||||
dependencies:
|
||||
acorn: 8.11.3
|
||||
commander: 2.20.0
|
||||
source-map: 0.7.4
|
||||
source-map-support: 0.5.20
|
||||
source-map-support: 0.5.21
|
||||
|
||||
test-exclude@6.0.0:
|
||||
dependencies:
|
||||
|
|
Loading…
Reference in a new issue