File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // fix.ts
2+ import { readFileSync , writeFileSync } from "node:fs" ;
3+ import { createInterface } from "node:readline" ;
4+ var rl = createInterface ( {
5+ input : process . stdin ,
6+ terminal : false
7+ } ) ;
8+ rl . on ( "line" , ( line ) => {
9+ const filePath = line . trim ( ) ;
10+ if ( ! filePath ) return ;
11+ try {
12+ let content = readFileSync ( filePath , "utf8" ) ;
13+ let changed = false ;
14+ content = content . replace ( / \/ d i s t \/ ( [ ^ " ] + ) \. b u n d l e \. j s / g, ( match , name ) => {
15+ if ( name . endsWith ( ".entry" ) ) {
16+ return match ;
17+ }
18+ changed = true ;
19+ return `/dist/${ name } .entry.bundle.js` ;
20+ } ) ;
21+ content = content . replace ( / \/ d i s t \/ ( [ ^ " ] + ) \. b u n d l e \. c s s / g, ( match , name ) => {
22+ if ( name . endsWith ( ".entry" ) ) {
23+ return match ;
24+ }
25+ changed = true ;
26+ return `/dist/${ name } .entry.bundle.css` ;
27+ } ) ;
28+ if ( changed ) {
29+ writeFileSync ( filePath , content ) ;
30+ console . log ( `Updated: ${ filePath } ` ) ;
31+ }
32+ } catch ( err ) {
33+ console . error ( `Error processing ${ filePath } :` , err ) ;
34+ }
35+ } ) ;
You can’t perform that action at this time.
0 commit comments