File tree Expand file tree Collapse file tree 6 files changed +28
-12
lines changed
Expand file tree Collapse file tree 6 files changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,15 @@ async function buildRollup() {
122122 } ) ;
123123}
124124
125+ function fixDtsOutputFlexible ( filePath ) {
126+ let code = fs . readFileSync ( filePath , "utf8" ) ;
127+
128+ const reg = new RegExp ( `export\s{\s${ script_name } \sas\sdefault\s};` ) ;
129+ code = code . replace ( reg , `export default ${ script_name } ;` ) ;
130+
131+ fs . writeFileSync ( filePath , code ) ;
132+ }
133+
125134( async ( ) => {
126135 const debug = true ;
127136 try {
@@ -160,6 +169,9 @@ async function buildRollup() {
160169 console . log ( `┃┗✅ ${ CL . brightWhite ( "rollup完了" ) } : ${ getRelativePath ( typesPath ) } ` ) ;
161170 console . log ( `┃🗑️ ${ CL . brightWhite ( "types仮フォルダcleanup" ) } ` ) ;
162171 prepareDir ( typesTmpDir ) ;
172+ console . log ( `┃🌵 ${ CL . brightWhite ( "export問題を解決" ) } ` ) ;
173+ fixDtsOutputFlexible ( typesPath ) ;
174+ console . log ( `┃┗✅ ${ CL . brightWhite ( "export default 生成完了" ) } : ${ getRelativePath ( typesPath ) } ` ) ;
163175 showFileSize ( typesPath ) ;
164176 }
165177
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ const fs = require("node:fs");
22const path = require ( "node:path" ) ;
33
44function generateEndpoint ( entryPath ) {
5- const inData = `import * as lib from "./index.js";
6- export default lib ;
5+ const inData = `import * as JavaLibraryScript from "./index.js";
6+ export default JavaLibraryScript ;
77` ;
88 fs . writeFileSync ( entryPath , inData , "utf8" ) ;
99}
Original file line number Diff line number Diff line change 1+ ce ( $ { script_name} ) ( \\s * { ) `) ;
2+ // code = code.replace(reg1, "$1const$2:$3");
Original file line number Diff line number Diff line change 11{
22 "name" : " javalibraryscript" ,
3- "version" : " v1.0.4.0 " ,
3+ "version" : " v1.0.4.1 " ,
44 "description" : " Javaの機能をJavaScriptに適当に再現" ,
55 "main" : " index.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change 1+ const { default : JavaLibraryScript } = require ( "../types/JavaLibraryScript" ) ;
2+
13jasc . on ( "DOMContentLoaded" , ( ) => {
24 console . log ( "JavaLibraryScript" ) ;
35 console . log ( JavaLibraryScript ) ;
@@ -19,7 +21,7 @@ function main() {
1921 console . log (
2022 map
2123 . stream ( )
22- . map ( ( [ k , v ] ) => [ k , v * 10 ] )
24+ . map ( ( [ k , v ] ) => [ k , "a" ] )
2325 . toHashMap ( String , Number )
2426 ) ;
2527}
Original file line number Diff line number Diff line change @@ -950,15 +950,15 @@ declare let util: {
950950 } ;
951951} ;
952952
953- declare const lib_base : typeof base ;
954- declare const lib_libs : typeof libs ;
955- declare const lib_util : typeof util ;
956- declare namespace lib {
953+ declare const JavaLibraryScript_base : typeof base ;
954+ declare const JavaLibraryScript_libs : typeof libs ;
955+ declare const JavaLibraryScript_util : typeof util ;
956+ declare namespace JavaLibraryScript {
957957 export {
958- lib_base as base ,
959- lib_libs as libs ,
960- lib_util as util ,
958+ JavaLibraryScript_base as base ,
959+ JavaLibraryScript_libs as libs ,
960+ JavaLibraryScript_util as util ,
961961 } ;
962962}
963963
964- export { lib as default } ;
964+ export default JavaLibraryScript ;
You can’t perform that action at this time.
0 commit comments