@@ -6,32 +6,39 @@ import rdtPkg from './node_modules/react-devtools-core/package.json' with { type
66const bundle = await rolldown ( {
77 input : 'index.js' ,
88 platform : 'neutral' ,
9- optimization : {
10- inlineConst : true ,
11- } ,
12- experimental : {
13- strictExecutionOrder : true ,
14- } ,
159 tsconfig : './tsconfig.json' ,
1610 treeshake : true ,
17- keepNames : true ,
18- define : {
19- __RDT_VERSION : JSON . stringify ( rdtPkg . version ) ,
11+ transform : {
12+ define : {
13+ __RDT_VERSION : JSON . stringify ( rdtPkg . version ) ,
14+ } ,
2015 } ,
2116 plugins : [
2217 swcPlugin ( ) ,
2318 hermesCPlugin ( {
24- flags : [ '-O' , '-finline' , '- fno-static-require', '-Wno-direct-eval' , '-Wno-undefined-variable' ] ,
19+ flags : [ '-O' , '-fno-static-require' , '-Wno-direct-eval' , '-Wno-undefined-variable' ] ,
2520 } ) ,
2621 ] ,
2722} )
2823
2924await bundle . write ( {
3025 file : 'dist/index.js' ,
3126 format : 'iife' ,
32- intro : 'var window = globalThis, self = globalThis, console = new Proxy({}, { get: () => () => undefined })' ,
33- footer : '//# sourceURL=RevengeReactDevTools' ,
34- inlineDynamicImports : true ,
27+ intro : `
28+ function __fmt(arg) {
29+ if (typeof arg === 'string') return arg
30+ var proto = Object.getPrototypeOf(arg) ?? Object.prototype
31+ return proto.toString.call(arg)
32+ }
33+ var __mklog = (lvl) => (...args) => {
34+ if (args.length === 1) nativeLoggingHook(__fmt(args[0]), lvl)
35+ else nativeLoggingHook(args.map(__fmt).join(' '), lvl)
36+ }
37+ var window = self = globalThis, console = { log: __mklog(0), info: __mklog(1), warn: __mklog(1), error: __mklog(2) }
38+ console.log("React DevTools bundle loading...")
39+ ` ,
40+ postFooter : '//# sourceURL=ReactDevTools' ,
41+ keepNames : true ,
3542} )
3643
3744function swcPlugin ( ) {
0 commit comments