@@ -23,13 +23,13 @@ import { naturalCompare } from '@socketsecurity/registry/lib/sorts'
2323import { spawn } from '@socketsecurity/registry/lib/spawn'
2424
2525import baseConfig , { EXTERNAL_PACKAGES } from './rollup.base.config.mjs'
26- import constants from '../scripts/constants.js '
27- import socketModifyPlugin from '../scripts/rollup/socket-modify-plugin.js '
26+ import constants from '../scripts/constants.mjs '
27+ import socketModifyPlugin from '../scripts/rollup/socket-modify-plugin.mjs '
2828import {
2929 getPackageName ,
3030 isBuiltin ,
3131 normalizeId ,
32- } from '../scripts/utils/packages.js '
32+ } from '../scripts/utils/packages.mjs '
3333
3434const {
3535 CONSTANTS ,
@@ -468,12 +468,12 @@ export default async () => {
468468 cwd : blessedContribSrcPath ,
469469 } )
470470 ) . map ( filepath => {
471- const relPath = `${ path . relative ( srcPath , filepath ) . slice ( 0 , - 4 /*.mjs*/ ) } .js`
471+ const relPath = `${ path . relative ( blessedContribSrcPath , filepath ) . slice ( 0 , - 4 /*.mjs*/ ) } .js`
472472 return {
473473 input : filepath ,
474474 output : [
475475 {
476- file : path . join ( rootPath , relPath ) ,
476+ file : path . join ( constants . blessedContribPath , relPath ) ,
477477 exports : 'auto' ,
478478 externalLiveBindings : false ,
479479 format : 'cjs' ,
@@ -500,6 +500,22 @@ export default async () => {
500500 preferBuiltins : true ,
501501 } ) ,
502502 jsonPlugin ( ) ,
503+ // Fix blessed library octal escape sequences
504+ {
505+ name : 'fix-blessed-octal' ,
506+ transform ( code , id ) {
507+ if (
508+ id . includes ( 'blessed' ) &&
509+ ( id . includes ( 'tput.js' ) || id . includes ( 'box.js' ) )
510+ ) {
511+ return code
512+ . replace ( / c h = ' \\ 2 0 0 ' ; / g, "ch = '\\x80';" )
513+ . replace ( / ' \\ 0 1 6 ' / g, "'\\x0E'" )
514+ . replace ( / ' \\ 0 1 7 ' / g, "'\\x0F'" )
515+ }
516+ return null
517+ } ,
518+ } ,
503519 commonjsPlugin ( {
504520 defaultIsModuleExports : true ,
505521 extensions : [ '.cjs' , '.js' ] ,
0 commit comments