@@ -35,6 +35,7 @@ var fs = require("fs");
3535var path = require ( "path" ) ;
3636var copy = require ( 'architect-build/copy' ) ;
3737var build = require ( 'architect-build/build' ) ;
38+ var { updateDeclarationModuleNames, generateDeclaration} = require ( './tool/ace_declaration_generator' ) ;
3839
3940var ACE_HOME = __dirname ;
4041var BUILD_DIR = ACE_HOME + "/build" ;
@@ -176,20 +177,18 @@ function ace() {
176177
177178function buildTypes ( ) {
178179 var aceCodeModeDefinitions = '/// <reference path="./ace-modes.d.ts" />' ;
179- var aceCodeExtensionDefinitions = '/// <reference path="./ace-extensions.d.ts" />' ;
180180 // ace-builds package has different structure and can't use mode types defined for the ace-code.
181181 // ace-builds modes are declared along with other modules in the ace-modules.d.ts file below.
182- var definitions = fs . readFileSync ( ACE_HOME + '/ace.d.ts' , 'utf8' ) . replace ( aceCodeModeDefinitions , '' ) . replace ( aceCodeExtensionDefinitions , '' ) ;
183182 var paths = fs . readdirSync ( BUILD_DIR + '/src-noconflict' ) ;
184- var moduleRef = '/// <reference path="./ace-modules.d.ts" />' ;
185183
186184 fs . readdirSync ( BUILD_DIR + '/src-noconflict/snippets' ) . forEach ( function ( path ) {
187185 paths . push ( "snippets/" + path ) ;
188186 } ) ;
189187
190188 var moduleNameRegex = / ^ ( m o d e | t h e m e | e x t | k e y b i n d i n g ) - | ^ s n i p p e t s \/ / ;
191189
192- var pathModules = [
190+ //TODO:
191+ /* var pathModules = [
193192 "declare module 'ace-builds/webpack-resolver';",
194193 "declare module 'ace-builds/esm-resolver';",
195194 "declare module 'ace-builds/src-noconflict/ace';"
@@ -198,10 +197,15 @@ function buildTypes() {
198197 var moduleName = path.split('.')[0];
199198 return "declare module 'ace-builds/src-noconflict/" + moduleName + "';";
200199 }
201- } ) . filter ( Boolean ) ) . join ( "\n" ) + "\n" ;
202-
203- fs . writeFileSync ( BUILD_DIR + '/ace.d.ts' , moduleRef + '\n' + definitions ) ;
204- fs . writeFileSync ( BUILD_DIR + '/ace-modules.d.ts' , pathModules ) ;
200+ }).filter(Boolean)).join("\n") + "\n";*/
201+
202+ //TODO:
203+ fs . copyFileSync ( ACE_HOME + '/ace.d.ts' , BUILD_DIR + '/ace.d.ts' ) ;
204+ generateDeclaration ( BUILD_DIR + '/ace.d.ts' ) ;
205+ var definitions = fs . readFileSync ( BUILD_DIR + '/ace.d.ts' , 'utf8' ) ;
206+ var newDefinitions = updateDeclarationModuleNames ( definitions ) ;
207+ fs . writeFileSync ( BUILD_DIR + '/ace.d.ts' , newDefinitions ) ;
208+ //
205209 var esmUrls = [ ] ;
206210
207211 var loader = paths . map ( function ( path ) {
0 commit comments