@@ -7,7 +7,6 @@ import { Manifest } from './manifest';
7
7
import { ITranslations , patchNLS } from './nls' ;
8
8
import * as util from './util' ;
9
9
import * as _glob from 'glob' ;
10
- import * as minimatch from 'minimatch' ;
11
10
import * as denodeify from 'denodeify' ;
12
11
import * as markdownit from 'markdown-it' ;
13
12
import * as cheerio from 'cheerio' ;
@@ -16,6 +15,7 @@ import { lookup } from 'mime';
16
15
import * as urljoin from 'url-join' ;
17
16
import { validatePublisher , validateExtensionName , validateVersion , validateEngineCompatibility , validateVSCodeTypesCompatibility } from './validation' ;
18
17
import { getDependencies } from './npm' ;
18
+ import ignore from 'ignore'
19
19
20
20
const readFile = denodeify < string , string , string > ( fs . readFile ) ;
21
21
const unlink = denodeify < string , void > ( fs . unlink as any ) ;
@@ -27,8 +27,6 @@ const resourcesPath = path.join(path.dirname(__dirname), 'resources');
27
27
const vsixManifestTemplatePath = path . join ( resourcesPath , 'extension.vsixmanifest' ) ;
28
28
const contentTypesTemplatePath = path . join ( resourcesPath , '[Content_Types].xml' ) ;
29
29
30
- const MinimatchOptions : minimatch . IOptions = { dot : true } ;
31
-
32
30
export interface IFile {
33
31
path : string ;
34
32
contents ?: Buffer | string ;
@@ -834,21 +832,7 @@ function collectFiles(cwd: string, useYarn = false, dependencyEntryPoints?: stri
834
832
return readFile ( ignoreFile ? ignoreFile : path . join ( cwd , '.vscodeignore' ) , 'utf8' )
835
833
. catch < string > ( err => err . code !== 'ENOENT' ? Promise . reject ( err ) : ignoreFile ? Promise . reject ( err ) : Promise . resolve ( '' ) )
836
834
837
- // Parse raw ignore by splitting output into lines and filtering out empty lines and comments
838
- . then ( rawIgnore => rawIgnore . split ( / [ \n \r ] / ) . map ( s => s . trim ( ) ) . filter ( s => ! ! s ) . filter ( i => ! / ^ \s * # / . test ( i ) ) )
839
-
840
- // Add '/**' to possible folder names
841
- . then ( ignore => [ ...ignore , ...ignore . filter ( i => ! / ( ^ | \/ ) [ ^ / ] * \* [ ^ / ] * $ / . test ( i ) ) . map ( i => / \/ $ / . test ( i ) ? `${ i } **` : `${ i } /**` ) ] )
842
-
843
- // Combine with default ignore list
844
- . then ( ignore => [ ...defaultIgnore , ...ignore , '!package.json' ] )
845
-
846
- // Split into ignore and negate list
847
- . then ( ignore => _ . partition ( ignore , i => ! / ^ \s * ! / . test ( i ) ) )
848
- . then ( r => ( { ignore : r [ 0 ] , negate : r [ 1 ] } ) )
849
-
850
- // Filter out files
851
- . then ( ( { ignore, negate } ) => files . filter ( f => ! ignore . some ( i => minimatch ( f , i , MinimatchOptions ) ) || negate . some ( i => minimatch ( f , i . substr ( 1 ) , MinimatchOptions ) ) ) ) ;
835
+ . then ( rawIgnore => ignore ( ) . add ( defaultIgnore ) . add ( rawIgnore ) . filter ( files ) )
852
836
} ) ;
853
837
}
854
838
0 commit comments