Compare commits
16 commits
Author | SHA1 | Date | |
---|---|---|---|
|
4671201414 | ||
|
d35868b6ef | ||
|
7adad563d1 | ||
|
308ebf1b44 | ||
|
012e06134b | ||
|
9aea7338c4 | ||
|
494c3e6242 | ||
|
b293872610 | ||
|
1cd3e39e10 | ||
|
3151bb58f2 | ||
|
783c32024e | ||
|
03eba8f996 | ||
|
1fa178b627 | ||
|
127fccb133 | ||
|
849568cc14 | ||
|
001664e3bc |
27 changed files with 2686 additions and 233 deletions
11
.github/workflows/build_and_deploy.yml
vendored
11
.github/workflows/build_and_deploy.yml
vendored
|
@ -118,7 +118,6 @@ jobs:
|
|||
target: ${{ needs.deploy-target.outputs.value == 'automated-preview' && 'x86_64-unknown-linux-musl' }}
|
||||
settings:
|
||||
- host:
|
||||
- 'self-hosted'
|
||||
- 'macos'
|
||||
- 'arm64'
|
||||
|
||||
|
@ -131,7 +130,6 @@ jobs:
|
|||
strip -x packages/next-swc/native/next-swc.*.node
|
||||
|
||||
- host:
|
||||
- 'self-hosted'
|
||||
- 'macos'
|
||||
- 'arm64'
|
||||
|
||||
|
@ -148,7 +146,6 @@ jobs:
|
|||
strip -x packages/next-swc/native/next-swc.*.node
|
||||
|
||||
- host:
|
||||
- 'self-hosted'
|
||||
- 'windows'
|
||||
- 'x64'
|
||||
|
||||
|
@ -161,7 +158,6 @@ jobs:
|
|||
target: 'x86_64-pc-windows-msvc'
|
||||
|
||||
- host:
|
||||
- 'self-hosted'
|
||||
- 'windows'
|
||||
- 'x64'
|
||||
|
||||
|
@ -174,7 +170,6 @@ jobs:
|
|||
target: 'i686-pc-windows-msvc'
|
||||
|
||||
- host:
|
||||
- 'self-hosted'
|
||||
- 'windows'
|
||||
- 'x64'
|
||||
|
||||
|
@ -187,7 +182,6 @@ jobs:
|
|||
turbo run build-native-no-plugin-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target aarch64-pc-windows-msvc
|
||||
|
||||
- host:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
@ -214,7 +208,6 @@ jobs:
|
|||
objdump -T native/next-swc.*.node | grep GLIBC_
|
||||
|
||||
- host:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
@ -232,7 +225,6 @@ jobs:
|
|||
strip native/next-swc.*.node
|
||||
|
||||
- host:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
@ -254,7 +246,6 @@ jobs:
|
|||
objdump -T native/next-swc.*.node | grep GLIBC_
|
||||
|
||||
- host:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
@ -395,7 +386,6 @@ jobs:
|
|||
target: [web, nodejs]
|
||||
|
||||
runs-on:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
@ -590,7 +580,6 @@ jobs:
|
|||
releaseStats:
|
||||
name: Release Stats
|
||||
runs-on:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
|
2
.github/workflows/build_reusable.yml
vendored
2
.github/workflows/build_reusable.yml
vendored
|
@ -58,7 +58,7 @@ on:
|
|||
description: 'List of runner labels'
|
||||
required: false
|
||||
type: string
|
||||
default: '["self-hosted", "linux", "x64", "metal"]'
|
||||
default: '[ "linux", "x64", "metal"]'
|
||||
|
||||
env:
|
||||
NAPI_CLI_VERSION: 2.14.7
|
||||
|
|
1
.github/workflows/pull_request_stats.yml
vendored
1
.github/workflows/pull_request_stats.yml
vendored
|
@ -34,7 +34,6 @@ jobs:
|
|||
needs: build
|
||||
timeout-minutes: 25
|
||||
runs-on:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
|
|
@ -54,7 +54,6 @@ jobs:
|
|||
# ref: https://github.com/vercel/turbo/pull/5668
|
||||
# timeout-minutes: 180
|
||||
runs-on:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
@ -100,7 +99,6 @@ jobs:
|
|||
name: Next.js integration test (Integration)
|
||||
needs: [setup_nextjs]
|
||||
runs-on:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
@ -147,7 +145,6 @@ jobs:
|
|||
needs: [test-production, test-integration-production]
|
||||
name: Next.js integration test production status report
|
||||
runs-on:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
@ -177,7 +174,6 @@ jobs:
|
|||
needs: [test-production, test-integration-production]
|
||||
name: Upload test report to datadog
|
||||
runs-on:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
|
|
@ -54,7 +54,6 @@ jobs:
|
|||
# ref: https://github.com/vercel/turbo/pull/5668
|
||||
# timeout-minutes: 180
|
||||
runs-on:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
@ -100,7 +99,6 @@ jobs:
|
|||
name: Next.js integration test (Integration)
|
||||
needs: [setup_nextjs]
|
||||
runs-on:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
@ -147,7 +145,6 @@ jobs:
|
|||
needs: [test-dev, test-integration-development]
|
||||
name: Next.js integration test development status report
|
||||
runs-on:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
@ -177,7 +174,6 @@ jobs:
|
|||
needs: [test-dev, test-integration-development]
|
||||
name: Upload test report to datadog
|
||||
runs-on:
|
||||
- 'self-hosted'
|
||||
- 'linux'
|
||||
- 'x64'
|
||||
- 'metal'
|
||||
|
|
|
@ -3,7 +3,7 @@ import css from "./hello-world.module.css";
|
|||
export default function HelloWorld() {
|
||||
return (
|
||||
<div className={css.hello}>
|
||||
Hello World, I am being styled using CSS Modules!
|
||||
Hello Rspack good, I am being styled using CSS Modules!
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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": "1.0.0-alpha.5",
|
||||
"@swc/core": "1.6.6",
|
||||
"@swc/types": "0.1.7",
|
||||
"@taskr/clear": "1.1.0",
|
||||
|
|
|
@ -51,6 +51,9 @@ export function runCompiler(
|
|||
]
|
||||
> {
|
||||
return new Promise((resolve, reject) => {
|
||||
if(config.name === 'client'){
|
||||
debugger;
|
||||
}
|
||||
const compiler = webpack(config)
|
||||
// Ensure we use the previous inputFileSystem
|
||||
if (inputFileSystem) {
|
||||
|
|
|
@ -485,7 +485,7 @@ export default async function getBaseWebpackConfig(
|
|||
rootDir: dir,
|
||||
pagesDir,
|
||||
appDir,
|
||||
hasReactRefresh: dev && isClient,
|
||||
hasReactRefresh:false,
|
||||
nextConfig: config,
|
||||
jsConfig,
|
||||
transpilePackages: finalTranspilePackages,
|
||||
|
@ -922,15 +922,17 @@ export default async function getBaseWebpackConfig(
|
|||
context,
|
||||
request,
|
||||
dependencyType,
|
||||
contextInfo.issuerLayer as WebpackLayerName,
|
||||
contextInfo?.issuerLayer as WebpackLayerName,
|
||||
(options) => {
|
||||
const resolveFunction = getResolve(options)
|
||||
const {ResolverFactory } = require("enhanced-resolve");
|
||||
const myResolver = ResolverFactory.createResolver(options);
|
||||
return (resolveContext: string, requestToResolve: string) =>
|
||||
new Promise((resolve, reject) => {
|
||||
resolveFunction(
|
||||
myResolver.resolve(
|
||||
resolveContext,
|
||||
requestToResolve,
|
||||
(err, result, resolveData) => {
|
||||
(err:any, result:any, resolveData:any) => {
|
||||
console.log('xxx:', err, result, resolveData)
|
||||
if (err) return reject(err)
|
||||
if (!result) return resolve([null, false])
|
||||
const isEsm = /\.js$/i.test(result)
|
||||
|
@ -1037,7 +1039,6 @@ export default async function getBaseWebpackConfig(
|
|||
}): boolean {
|
||||
return (
|
||||
!module.type?.startsWith('css') &&
|
||||
module.size() > 160000 &&
|
||||
/node_modules[/\\]/.test(module.nameForCondition() || '')
|
||||
)
|
||||
},
|
||||
|
@ -1051,12 +1052,12 @@ export default async function getBaseWebpackConfig(
|
|||
if (isModuleCSS(module)) {
|
||||
module.updateHash(hash)
|
||||
} else {
|
||||
if (!module.libIdent) {
|
||||
throw new Error(
|
||||
`Encountered unknown module type: ${module.type}. Please open an issue.`
|
||||
)
|
||||
}
|
||||
hash.update(module.libIdent({ context: dir }))
|
||||
// if (!module.libIdent) {
|
||||
// throw new Error(
|
||||
// `Encountered unknown module type: ${module.type}. Please open an issue.`
|
||||
// )
|
||||
// }
|
||||
// hash.update(module.libIdent({ context: dir }))
|
||||
}
|
||||
|
||||
// Ensures the name of the chunk is not the same between two modules in different layers
|
||||
|
@ -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)
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -1740,7 +1741,7 @@ export default async function getBaseWebpackConfig(
|
|||
resource.request,
|
||||
'.shared-runtime'
|
||||
)
|
||||
const layer = resource.contextInfo.issuerLayer
|
||||
const layer = resource.contextInfo.issuerLayer;
|
||||
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')
|
||||
|
@ -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 &&
|
||||
|
@ -1929,9 +1930,9 @@ export default async function getBaseWebpackConfig(
|
|||
new NextFontManifestPlugin({
|
||||
appDir,
|
||||
}),
|
||||
!dev &&
|
||||
isClient &&
|
||||
new CssChunkingPlugin(config.experimental.cssChunking === 'strict'),
|
||||
// !dev &&
|
||||
// isClient &&
|
||||
// new CssChunkingPlugin(config.experimental.cssChunking === 'strict'),
|
||||
!dev &&
|
||||
isClient &&
|
||||
new (require('./webpack/plugins/telemetry-plugin').TelemetryPlugin)(
|
||||
|
@ -2345,7 +2346,7 @@ export default async function getBaseWebpackConfig(
|
|||
const fileLoader = {
|
||||
exclude: fileLoaderExclude,
|
||||
issuer: fileLoaderExclude,
|
||||
type: 'asset/resource',
|
||||
type: 'asset/inline',
|
||||
}
|
||||
|
||||
const topRules = []
|
||||
|
|
|
@ -573,7 +573,8 @@ export const css = curry(async function css(
|
|||
issuer: regexLikeCss,
|
||||
// Exclude extensions that webpack handles by default
|
||||
exclude: [
|
||||
/\.(js|mjs|jsx|ts|tsx)$/,
|
||||
/^$/,
|
||||
/\.(js|mjs|jsx|ts|tsx)/,
|
||||
/\.html$/,
|
||||
/\.json$/,
|
||||
/\.webpack\[[^\]]+\]$/,
|
||||
|
@ -591,7 +592,7 @@ export const css = curry(async function css(
|
|||
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
|
||||
require('@rspack/core').CssExtractRspackPlugin;
|
||||
fns.push(
|
||||
plugin(
|
||||
// @ts-ignore webpack 5 compat
|
||||
|
|
|
@ -40,11 +40,8 @@ export function getClientStyleLoader({
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
const MiniCssExtractPlugin =
|
||||
require('../../../../plugins/mini-css-extract-plugin').default
|
||||
return {
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
loader: require('@rspack/core').rspack.CssExtractRspackPlugin.loader,
|
||||
options: {
|
||||
publicPath: `${assetPrefix}/_next/`,
|
||||
esModule: false,
|
||||
|
|
|
@ -11,6 +11,7 @@ function nextClientPagesLoader(this: any) {
|
|||
'next-client-pages-loader'
|
||||
)
|
||||
|
||||
|
||||
return pagesLoaderSpan.traceFn(() => {
|
||||
const { absolutePagePath, page } =
|
||||
this.getOptions() as ClientPagesLoaderOptions
|
||||
|
@ -19,7 +20,6 @@ function nextClientPagesLoader(this: any) {
|
|||
|
||||
const stringifiedPageRequest = stringifyRequest(this, absolutePagePath)
|
||||
const stringifiedPage = JSON.stringify(page)
|
||||
|
||||
return `
|
||||
(window.__NEXT_P = window.__NEXT_P || []).push([
|
||||
${stringifiedPage},
|
||||
|
|
|
@ -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('rspack.CssExtractRspackPlugin.loader') ||
|
||||
loader.includes('@vanilla-extract/webpack-plugin/loader/')
|
||||
)
|
||||
)
|
||||
|
|
|
@ -568,7 +568,7 @@ function getExtractMetadata(params: {
|
|||
metadataByEntry.clear()
|
||||
const telemetry: Telemetry | undefined = traceGlobals.get('telemetry')
|
||||
|
||||
for (const [entryName, entry] of compilation.entries) {
|
||||
for (const [entryName, entry] of compilation.entries ?? []) {
|
||||
if (entry.options.runtime !== EDGE_RUNTIME_WEBPACK) {
|
||||
// Only process edge runtime entries
|
||||
continue
|
||||
|
@ -782,9 +782,9 @@ export default class MiddlewarePlugin {
|
|||
compiler,
|
||||
compilation,
|
||||
})
|
||||
hooks.parser.for('javascript/auto').tap(NAME, codeAnalyzer)
|
||||
hooks.parser.for('javascript/dynamic').tap(NAME, codeAnalyzer)
|
||||
hooks.parser.for('javascript/esm').tap(NAME, codeAnalyzer)
|
||||
// hooks.parser.for('javascript/auto').tap(NAME, codeAnalyzer)
|
||||
// hooks.parser.for('javascript/dynamic').tap(NAME, codeAnalyzer)
|
||||
// hooks.parser.for('javascript/esm').tap(NAME, codeAnalyzer)
|
||||
|
||||
/**
|
||||
* Extract all metadata for the entry points in a Map object.
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -95,7 +95,8 @@ export class NextJsRequireCacheHotReloader implements WebpackPluginInstance {
|
|||
// since they can have a stale webpack-runtime cache
|
||||
// which needs to always be in-sync
|
||||
let hasAppEntry = false
|
||||
const entries = [...compilation.entries.keys()].filter((entry) => {
|
||||
|
||||
const entries = [...compilation.entrypoints.keys()].filter((entry) => {
|
||||
const isAppPath = entry.toString().startsWith('app/')
|
||||
if (isAppPath) hasAppEntry = true
|
||||
return entry.toString().startsWith('pages/') || isAppPath
|
||||
|
|
|
@ -63,7 +63,7 @@ export class ProfilingPlugin {
|
|||
} = {}
|
||||
) {
|
||||
let span: Span | undefined
|
||||
startHook.tap(
|
||||
startHook?.tap(
|
||||
{ name: pluginName, stage: -Infinity },
|
||||
(...params: any[]) => {
|
||||
const name = typeof spanName === 'function' ? spanName() : spanName
|
||||
|
@ -75,7 +75,7 @@ export class ProfilingPlugin {
|
|||
if (onStart) onStart(span, ...params)
|
||||
}
|
||||
)
|
||||
stopHook.tap({ name: pluginName, stage: Infinity }, (...params: any[]) => {
|
||||
stopHook?.tap({ name: pluginName, stage: Infinity }, (...params: any[]) => {
|
||||
// `stopHook` may be triggered when `startHook` has not in cases
|
||||
// where `stopHook` is used as the terminating event for more
|
||||
// than one pair of hooks.
|
||||
|
@ -149,54 +149,54 @@ export class ProfilingPlugin {
|
|||
compiler.hooks.compilation.tap(
|
||||
{ name: pluginName, stage: -Infinity },
|
||||
(compilation: any) => {
|
||||
compilation.hooks.buildModule.tap(pluginName, (module: any) => {
|
||||
const moduleType = (() => {
|
||||
const r = module.userRequest
|
||||
if (!r || r.endsWith('!')) {
|
||||
return ''
|
||||
} else {
|
||||
const resource = r.split('!').pop()
|
||||
const match = /^[^?]+\.([^?]+)$/.exec(resource)
|
||||
return match ? match[1] : ''
|
||||
}
|
||||
})()
|
||||
// compilation.hooks.buildModule.tap(pluginName, (module: any) => {
|
||||
// const moduleType = (() => {
|
||||
// const r = module.userRequest
|
||||
// if (!r || r.endsWith('!')) {
|
||||
// return ''
|
||||
// } else {
|
||||
// const resource = r.split('!').pop()
|
||||
// const match = /^[^?]+\.([^?]+)$/.exec(resource)
|
||||
// return match ? match[1] : ''
|
||||
// }
|
||||
// })()
|
||||
|
||||
const issuerModule = compilation?.moduleGraph?.getIssuer(module)
|
||||
// const issuerModule = compilation?.moduleGraph?.getIssuer(module)
|
||||
|
||||
let span: Span
|
||||
// let span: Span
|
||||
|
||||
const moduleSpans = moduleSpansByCompilation.get(compilation)
|
||||
const spanName = `build-module${moduleType ? `-${moduleType}` : ''}`
|
||||
const issuerSpan: Span | undefined =
|
||||
issuerModule && moduleSpans?.get(issuerModule)
|
||||
if (issuerSpan) {
|
||||
span = issuerSpan.traceChild(spanName)
|
||||
} else {
|
||||
let parentSpan: Span | undefined
|
||||
for (const incomingConnection of compilation.moduleGraph.getIncomingConnections(
|
||||
module
|
||||
)) {
|
||||
const entrySpan = spans.get(incomingConnection.dependency)
|
||||
if (entrySpan) {
|
||||
parentSpan = entrySpan
|
||||
break
|
||||
}
|
||||
}
|
||||
// const moduleSpans = moduleSpansByCompilation.get(compilation)
|
||||
// const spanName = `build-module${moduleType ? `-${moduleType}` : ''}`
|
||||
// const issuerSpan: Span | undefined =
|
||||
// issuerModule && moduleSpans?.get(issuerModule)
|
||||
// if (issuerSpan) {
|
||||
// span = issuerSpan.traceChild(spanName)
|
||||
// } else {
|
||||
// let parentSpan: Span | undefined
|
||||
// for (const incomingConnection of compilation.moduleGraph?.getIncomingConnections(
|
||||
// module
|
||||
// )) {
|
||||
// const entrySpan = spans.get(incomingConnection.dependency)
|
||||
// if (entrySpan) {
|
||||
// parentSpan = entrySpan
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
|
||||
if (!parentSpan) {
|
||||
const compilationSpan = spans.get(compilation)
|
||||
if (!compilationSpan) {
|
||||
return
|
||||
}
|
||||
// if (!parentSpan) {
|
||||
// const compilationSpan = spans.get(compilation)
|
||||
// if (!compilationSpan) {
|
||||
// return
|
||||
// }
|
||||
|
||||
parentSpan = compilationSpan
|
||||
}
|
||||
span = parentSpan.traceChild(spanName)
|
||||
}
|
||||
span.setAttribute('name', module.userRequest)
|
||||
span.setAttribute('layer', module.layer)
|
||||
moduleSpans!.set(module, span)
|
||||
})
|
||||
// parentSpan = compilationSpan
|
||||
// }
|
||||
// span = parentSpan.traceChild(spanName)
|
||||
// }
|
||||
// span.setAttribute('name', module.userRequest)
|
||||
// span.setAttribute('layer', module.layer)
|
||||
// moduleSpans!.set(module, span)
|
||||
// })
|
||||
|
||||
const moduleHooks = NormalModule.getCompilationHooks(compilation)
|
||||
moduleHooks.readResource.for(undefined).intercept({
|
||||
|
@ -214,17 +214,41 @@ export class ProfilingPlugin {
|
|||
moduleHooks.loader.tap(
|
||||
pluginName,
|
||||
(loaderContext: any, module: any) => {
|
||||
const moduleSpan = moduleSpansByCompilation
|
||||
.get(compilation)
|
||||
?.get(module)
|
||||
// const moduleSpan = moduleSpansByCompilation
|
||||
// .get(compilation)
|
||||
// ?.get(module)
|
||||
const moduleSpan = {
|
||||
traceChild() {
|
||||
return {
|
||||
traceFn(fn: any) {
|
||||
return fn();
|
||||
},
|
||||
traceAsyncFn(fn:any){
|
||||
return fn();
|
||||
},
|
||||
setAttribute() {},
|
||||
traceChild(){
|
||||
return {
|
||||
traceFn(fn: any) {
|
||||
return fn();
|
||||
},
|
||||
traceAsyncFn(fn:any){
|
||||
return fn();
|
||||
},
|
||||
setAttribute() {},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
loaderContext.currentTraceSpan = moduleSpan
|
||||
}
|
||||
)
|
||||
|
||||
compilation.hooks.succeedModule.tap(pluginName, (module: any) => {
|
||||
compilation.hooks.succeedModule?.tap(pluginName, (module: any) => {
|
||||
moduleSpansByCompilation?.get(compilation)?.get(module)?.stop()
|
||||
})
|
||||
compilation.hooks.failedModule.tap(pluginName, (module: any) => {
|
||||
compilation.hooks.failedModule?.tap(pluginName, (module: any) => {
|
||||
moduleSpansByCompilation?.get(compilation)?.get(module)?.stop()
|
||||
})
|
||||
|
||||
|
@ -243,7 +267,7 @@ export class ProfilingPlugin {
|
|||
}
|
||||
)
|
||||
|
||||
compilation.hooks.addEntry.tap(pluginName, (entry: any) => {
|
||||
compilation.hooks.addEntry?.tap(pluginName, (entry: any) => {
|
||||
const parentSpan =
|
||||
makeSpanByCompilation.get(compilation) || spans.get(compilation)
|
||||
if (!parentSpan) {
|
||||
|
@ -254,11 +278,11 @@ export class ProfilingPlugin {
|
|||
spans.set(entry, addEntrySpan)
|
||||
})
|
||||
|
||||
compilation.hooks.succeedEntry.tap(pluginName, (entry: any) => {
|
||||
compilation.hooks.succeedEntry?.tap(pluginName, (entry: any) => {
|
||||
spans.get(entry)?.stop()
|
||||
spans.delete(entry)
|
||||
})
|
||||
compilation.hooks.failedEntry.tap(pluginName, (entry: any) => {
|
||||
compilation.hooks.failedEntry?.tap(pluginName, (entry: any) => {
|
||||
spans.get(entry)?.stop()
|
||||
spans.delete(entry)
|
||||
})
|
||||
|
@ -355,31 +379,31 @@ export class ProfilingPlugin {
|
|||
)
|
||||
|
||||
const logs = new Map()
|
||||
const originalTime = compilation.logger.time
|
||||
const originalTimeEnd = compilation.logger.timeEnd
|
||||
const originalTime = compilation.logger?.time
|
||||
const originalTimeEnd = compilation.logger?.timeEnd
|
||||
|
||||
compilation.logger.time = (label: string) => {
|
||||
if (!inTraceLabelsSeal(label)) {
|
||||
return originalTime.call(compilation.logger, label)
|
||||
}
|
||||
const span = sealSpanByCompilation.get(compilation)
|
||||
if (span) {
|
||||
logs.set(label, span.traceChild(label.replace(/ /g, '-')))
|
||||
}
|
||||
return originalTime.call(compilation.logger, label)
|
||||
}
|
||||
compilation.logger.timeEnd = (label: string) => {
|
||||
if (!inTraceLabelsSeal(label)) {
|
||||
return originalTimeEnd.call(compilation.logger, label)
|
||||
}
|
||||
// compilation.logger.time = (label: string) => {
|
||||
// if (!inTraceLabelsSeal(label)) {
|
||||
// return originalTime.call(compilation.logger, label)
|
||||
// }
|
||||
// const span = sealSpanByCompilation.get(compilation)
|
||||
// if (span) {
|
||||
// logs.set(label, span.traceChild(label.replace(/ /g, '-')))
|
||||
// }
|
||||
// return originalTime.call(compilation.logger, label)
|
||||
// }
|
||||
// compilation.logger.timeEnd = (label: string) => {
|
||||
// if (!inTraceLabelsSeal(label)) {
|
||||
// return originalTimeEnd.call(compilation.logger, label)
|
||||
// }
|
||||
|
||||
const span = logs.get(label)
|
||||
if (span) {
|
||||
span.stop()
|
||||
logs.delete(label)
|
||||
}
|
||||
return originalTimeEnd.call(compilation.logger, label)
|
||||
}
|
||||
// const span = logs.get(label)
|
||||
// if (span) {
|
||||
// span.stop()
|
||||
// logs.delete(label)
|
||||
// }
|
||||
// return originalTimeEnd.call(compilation.logger, label)
|
||||
// }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
@ -134,9 +134,9 @@ function buildManifest(
|
|||
}
|
||||
}
|
||||
}
|
||||
for (const module of compilation.modules) {
|
||||
module.blocks.forEach(handleBlock)
|
||||
}
|
||||
// for (const module of compilation.modules) {
|
||||
// module.blocks.forEach(handleBlock)
|
||||
// }
|
||||
|
||||
manifest = Object.keys(manifest)
|
||||
.sort()
|
||||
|
|
|
@ -22,5 +22,8 @@ exports.init = function () {
|
|||
})
|
||||
} else {
|
||||
Object.assign(exports, require('./bundle5')())
|
||||
Object.assign(exports, {
|
||||
StringXor: require('webpack/lib/util/StringXor'),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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'))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1160,10 +1160,11 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface {
|
|||
chunksHash.add(hash)
|
||||
} else {
|
||||
// for non-pages we can use the module hash directly
|
||||
const hash = stats.chunkGraph.getModuleHash(
|
||||
mod,
|
||||
chunk.runtime
|
||||
)
|
||||
// const hash = stats.chunkGraph.getModuleHash(
|
||||
// mod,
|
||||
// chunk.runtime
|
||||
// )
|
||||
const hash = mod.identifier()
|
||||
|
||||
if (
|
||||
mod.layer === WEBPACK_LAYERS.reactServerComponents &&
|
||||
|
|
|
@ -791,7 +791,7 @@ export default class NextNodeServer extends BaseServer<
|
|||
}
|
||||
|
||||
protected getFontManifest(): FontManifest {
|
||||
return requireFontManifest(this.distDir)
|
||||
return requireFontManifest(this.distDir) as any;
|
||||
}
|
||||
|
||||
protected getNextFontManifest(): NextFontManifest | undefined {
|
||||
|
|
|
@ -133,6 +133,7 @@ export async function requirePage(
|
|||
|
||||
export function requireFontManifest(distDir: string) {
|
||||
const serverBuildPath = path.join(distDir, SERVER_DIRECTORY)
|
||||
return {} as FontManifest;
|
||||
const fontManifest = loadManifest(
|
||||
path.join(serverBuildPath, AUTOMATIC_FONT_OPTIMIZATION_MANIFEST)
|
||||
) as FontManifest
|
||||
|
|
|
@ -152,9 +152,7 @@ module.exports = ({ dev, turbo, bundleType, experimental }) => {
|
|||
}.runtime.${dev ? 'dev' : 'prod'}.js`,
|
||||
libraryTarget: 'commonjs2',
|
||||
},
|
||||
devtool: process.env.NEXT_SERVER_EVAL_SOURCE_MAPS
|
||||
? 'eval-source-map'
|
||||
: 'source-map',
|
||||
devtool: 'source-map',
|
||||
optimization: {
|
||||
moduleIds: 'named',
|
||||
minimize: true,
|
||||
|
|
2563
pnpm-lock.yaml
2563
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue