@@ -3,7 +3,6 @@ const exorcist = require("exorcist");
33const rollup = require ( "rollup" ) ;
44const dts = require ( "rollup-plugin-dts" ) . default ;
55const commonjs = require ( "@rollup/plugin-commonjs" ) ;
6- const { Extractor, ExtractorConfig } = require ( "@microsoft/api-extractor" ) ;
76const fs = require ( "node:fs" ) ;
87const path = require ( "node:path" ) ;
98const { minify } = require ( "terser" ) ;
@@ -124,22 +123,6 @@ async function buildRollup() {
124123 } ) ;
125124}
126125
127- function runApiExtractor ( ) {
128- const extractorConfigPath = path . resolve ( baseDir , "api-extractor.json" ) ;
129- const extractorConfig = ExtractorConfig . loadFileAndPrepare ( extractorConfigPath ) ;
130-
131- const { succeeded, errors, warnings } = Extractor . invoke ( extractorConfig , {
132- localBuild : true ,
133- showVerboseMessages : true ,
134- } ) ;
135-
136- if ( succeeded ) {
137- console . log ( "✨ API Extractor completed successfully!" ) ;
138- } else {
139- throw new Error ( "💥API Extractor failed." ) ;
140- }
141- }
142-
143126function fixDtsOutputFlexible ( filePath , log = false ) {
144127 let code = fs . readFileSync ( filePath , "utf8" ) ;
145128
@@ -159,6 +142,13 @@ function fixDtsOutputFlexible(filePath, log = false) {
159142 return `${ b } ${ d } ` ;
160143 } ,
161144 ] ,
145+ [
146+ `([A-Za-z][A-Za-z0-9]*)_forceRep` ,
147+ ( a , b ) => {
148+ if ( log ) console . log ( `┃┃ ${ b } : ${ CL . cyan ( "強制変更" ) } ` ) ;
149+ return b ;
150+ } ,
151+ ] ,
162152 ] ;
163153
164154 for ( const [ reg , rep ] of regList ) {
@@ -206,14 +196,13 @@ function fixDtsOutputFlexible(filePath, log = false) {
206196 console . log ( `┃⛳ ${ CL . brightWhite ( "rollup用entrypoint作成" ) } ` ) ;
207197 createEntryEndpoint ( entryTypesPath ) ;
208198 console . log ( "┃📦 .d.ts を rollup中..." ) ;
209- //await buildRollup();
210- runApiExtractor ( ) ;
199+ await buildRollup ( ) ;
211200 console . log ( `┃┗✅ ${ CL . brightWhite ( "rollup完了" ) } : ${ getRelativePath ( typesPath ) } ` ) ;
212201 console . log ( `┃🗑️ ${ CL . brightWhite ( "types仮フォルダcleanup" ) } ` ) ;
213- // prepareDir(typesTmpDir);
214- console . log ( `┃🌵 ${ CL . brightWhite ( "予測候補問題を解決 " ) } ` ) ;
202+ prepareDir ( typesTmpDir ) ;
203+ console . log ( `┃🌵 ${ CL . brightWhite ( "予測候補・コンパイル問題を解決 " ) } ` ) ;
215204 fixDtsOutputFlexible ( typesPath , logView ) ;
216- console . log ( `┃┗✅ ${ CL . brightWhite ( "予測候補問題 修正完了" ) } : ${ getRelativePath ( typesPath ) } ` ) ;
205+ console . log ( `┃┗✅ ${ CL . brightWhite ( "予測候補・コンパイル問題 修正完了" ) } : ${ getRelativePath ( typesPath ) } ` ) ;
217206 showFileSize ( typesPath ) ;
218207 }
219208
0 commit comments