chore: add basic-export build work
This commit is contained in:
parent
8f5f0ef141
commit
001664e3bc
16 changed files with 356 additions and 187 deletions
|
@ -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) {
|
||||
|
|
|
@ -922,8 +922,9 @@ export default async function getBaseWebpackConfig(
|
|||
context,
|
||||
request,
|
||||
dependencyType,
|
||||
contextInfo.issuerLayer as WebpackLayerName,
|
||||
contextInfo?.issuerLayer as WebpackLayerName,
|
||||
(options) => {
|
||||
return true
|
||||
const resolveFunction = getResolve(options)
|
||||
return (resolveContext: string, requestToResolve: string) =>
|
||||
new Promise((resolve, reject) => {
|
||||
|
@ -1037,7 +1038,6 @@ export default async function getBaseWebpackConfig(
|
|||
}): boolean {
|
||||
return (
|
||||
!module.type?.startsWith('css') &&
|
||||
module.size() > 160000 &&
|
||||
/node_modules[/\\]/.test(module.nameForCondition() || '')
|
||||
)
|
||||
},
|
||||
|
@ -1104,35 +1104,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 +1740,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 +1757,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 +1788,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 +1823,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) {
|
||||
|
@ -1876,11 +1876,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 +2266,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)
|
||||
|
|
|
@ -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/')
|
||||
)
|
||||
)
|
||||
|
|
|
@ -29,6 +29,7 @@ export class CssChunkingPlugin {
|
|||
}
|
||||
|
||||
public apply(compiler: Compiler) {
|
||||
return
|
||||
const strict = this.strict
|
||||
const summary = !!process.env.CSS_CHUNKING_SUMMARY
|
||||
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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,27 @@ 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()
|
||||
},
|
||||
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 +253,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 +264,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 +365,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()
|
||||
|
|
|
@ -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'))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ export async function requirePage(
|
|||
|
||||
export function requireFontManifest(distDir: string) {
|
||||
const serverBuildPath = path.join(distDir, SERVER_DIRECTORY)
|
||||
return {}
|
||||
const fontManifest = loadManifest(
|
||||
path.join(serverBuildPath, AUTOMATIC_FONT_OPTIMIZATION_MANIFEST)
|
||||
) as FontManifest
|
||||
|
|
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