66Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
77exports . getExtensionStream = getExtensionStream ;
88exports . getBuiltInExtensions = getBuiltInExtensions ;
9- const fs_1 = require ( "fs" ) ;
10- const path_1 = require ( "path" ) ;
9+ const fs = require ( "fs" ) ;
10+ const path = require ( "path" ) ;
1111const os_1 = require ( "os" ) ;
1212const rimraf_1 = require ( "rimraf" ) ;
1313const event_stream_1 = require ( "event-stream" ) ;
@@ -16,26 +16,26 @@ const vinyl_fs_1 = require("vinyl-fs");
1616const ext = require ( "./extensions" ) ;
1717const fancy_log_1 = require ( "fancy-log" ) ;
1818const ansi_colors_1 = require ( "ansi-colors" ) ;
19- const root = path_1 . default . dirname ( path_1 . default . dirname ( __dirname ) ) ;
20- const productjson = JSON . parse ( fs_1 . default . readFileSync ( path_1 . default . join ( __dirname , '../../product.json' ) , 'utf8' ) ) ;
19+ const root = path . dirname ( path . dirname ( __dirname ) ) ;
20+ const productjson = JSON . parse ( fs . readFileSync ( path . join ( __dirname , '../../product.json' ) , 'utf8' ) ) ;
2121const builtInExtensions = productjson . builtInExtensions || [ ] ;
2222const webBuiltInExtensions = productjson . webBuiltInExtensions || [ ] ;
23- const controlFilePath = path_1 . default . join ( os_1 . default . homedir ( ) , '.vscode-oss-dev' , 'extensions' , 'control.json' ) ;
23+ const controlFilePath = path . join ( os_1 . default . homedir ( ) , '.vscode-oss-dev' , 'extensions' , 'control.json' ) ;
2424const ENABLE_LOGGING = ! process . env [ 'VSCODE_BUILD_BUILTIN_EXTENSIONS_SILENCE_PLEASE' ] ;
2525function log ( ...messages ) {
2626 if ( ENABLE_LOGGING ) {
2727 ( 0 , fancy_log_1 . default ) ( ...messages ) ;
2828 }
2929}
3030function getExtensionPath ( extension ) {
31- return path_1 . default . join ( root , '.build' , 'builtInExtensions' , extension . name ) ;
31+ return path . join ( root , '.build' , 'builtInExtensions' , extension . name ) ;
3232}
3333function isUpToDate ( extension ) {
34- const packagePath = path_1 . default . join ( getExtensionPath ( extension ) , 'package.json' ) ;
35- if ( ! fs_1 . default . existsSync ( packagePath ) ) {
34+ const packagePath = path . join ( getExtensionPath ( extension ) , 'package.json' ) ;
35+ if ( ! fs . existsSync ( packagePath ) ) {
3636 return false ;
3737 }
38- const packageContents = fs_1 . default . readFileSync ( packagePath , { encoding : 'utf8' } ) ;
38+ const packageContents = fs . readFileSync ( packagePath , { encoding : 'utf8' } ) ;
3939 try {
4040 const diskVersion = JSON . parse ( packageContents ) . version ;
4141 return ( diskVersion === extension . version ) ;
@@ -47,7 +47,7 @@ function isUpToDate(extension) {
4747function getExtensionDownloadStream ( extension ) {
4848 let input ;
4949 if ( extension . vsix ) {
50- input = ext . fromVsix ( path_1 . default . join ( root , extension . vsix ) , extension ) ;
50+ input = ext . fromVsix ( path . join ( root , extension . vsix ) , extension ) ;
5151 }
5252 else if ( productjson . extensionsGallery ?. serviceUrl ) {
5353 input = ext . fromMarketplace ( productjson . extensionsGallery . serviceUrl , extension ) ;
@@ -61,7 +61,7 @@ function getExtensionStream(extension) {
6161 // if the extension exists on disk, use those files instead of downloading anew
6262 if ( isUpToDate ( extension ) ) {
6363 log ( '[extensions]' , `${ extension . name } @${ extension . version } up to date` , ansi_colors_1 . default . green ( '✔︎' ) ) ;
64- return vinyl_fs_1 . default . src ( [ '**' ] , { cwd : getExtensionPath ( extension ) , dot : true } )
64+ return vinyl_fs . src ( [ '**' ] , { cwd : getExtensionPath ( extension ) , dot : true } )
6565 . pipe ( ( 0 , gulp_rename_1 . default ) ( p => p . dirname = `${ extension . name } /${ p . dirname } ` ) ) ;
6666 }
6767 return getExtensionDownloadStream ( extension ) ;
@@ -75,7 +75,7 @@ function syncMarketplaceExtension(extension) {
7575 }
7676 rimraf_1 . default . sync ( getExtensionPath ( extension ) ) ;
7777 return getExtensionDownloadStream ( extension )
78- . pipe ( vinyl_fs_1 . default . dest ( '.build/builtInExtensions' ) )
78+ . pipe ( vinyl_fs . dest ( '.build/builtInExtensions' ) )
7979 . on ( 'end' , ( ) => log ( source , extension . name , ansi_colors_1 . default . green ( '✔︎' ) ) ) ;
8080}
8181function syncExtension ( extension , controlState ) {
@@ -93,11 +93,11 @@ function syncExtension(extension, controlState) {
9393 case 'marketplace' :
9494 return syncMarketplaceExtension ( extension ) ;
9595 default :
96- if ( ! fs_1 . default . existsSync ( controlState ) ) {
96+ if ( ! fs . existsSync ( controlState ) ) {
9797 log ( ansi_colors_1 . default . red ( `Error: Built-in extension '${ extension . name } ' is configured to run from '${ controlState } ' but that path does not exist.` ) ) ;
9898 return event_stream_1 . default . readArray ( [ ] ) ;
9999 }
100- else if ( ! fs_1 . default . existsSync ( path_1 . default . join ( controlState , 'package.json' ) ) ) {
100+ else if ( ! fs . existsSync ( path . join ( controlState , 'package.json' ) ) ) {
101101 log ( ansi_colors_1 . default . red ( `Error: Built-in extension '${ extension . name } ' is configured to run from '${ controlState } ' but there is no 'package.json' file in that directory.` ) ) ;
102102 return event_stream_1 . default . readArray ( [ ] ) ;
103103 }
@@ -107,15 +107,15 @@ function syncExtension(extension, controlState) {
107107}
108108function readControlFile ( ) {
109109 try {
110- return JSON . parse ( fs_1 . default . readFileSync ( controlFilePath , 'utf8' ) ) ;
110+ return JSON . parse ( fs . readFileSync ( controlFilePath , 'utf8' ) ) ;
111111 }
112112 catch ( err ) {
113113 return { } ;
114114 }
115115}
116116function writeControlFile ( control ) {
117- fs_1 . default . mkdirSync ( path_1 . default . dirname ( controlFilePath ) , { recursive : true } ) ;
118- fs_1 . default . writeFileSync ( controlFilePath , JSON . stringify ( control , null , 2 ) ) ;
117+ fs . mkdirSync ( path . dirname ( controlFilePath ) , { recursive : true } ) ;
118+ fs . writeFileSync ( controlFilePath , JSON . stringify ( control , null , 2 ) ) ;
119119}
120120function getBuiltInExtensions ( ) {
121121 log ( 'Synchronizing built-in extensions...' ) ;
0 commit comments