@@ -95,11 +95,16 @@ export interface IPackageOptions {
95
95
* `target` is set. For example, if `target` is `linux-x64` and there are
96
96
* folders named `win32-x64`, `darwin-arm64` or `web`, the files inside
97
97
* those folders will be ignored.
98
- *
98
+ *
99
99
* @default false
100
100
*/
101
101
readonly ignoreOtherTargetFolders ?: boolean ;
102
102
103
+ /**
104
+ * Recurse into symlinked directories instead of treating them as files.
105
+ */
106
+ readonly followSymlinks ?: boolean ;
107
+
103
108
readonly commitMessage ?: string ;
104
109
readonly gitTagVersion ?: boolean ;
105
110
readonly updatePackageJson ?: boolean ;
@@ -1613,11 +1618,12 @@ const defaultIgnore = [
1613
1618
async function collectAllFiles (
1614
1619
cwd : string ,
1615
1620
dependencies : 'npm' | 'yarn' | 'none' | undefined ,
1616
- dependencyEntryPoints ?: string [ ]
1621
+ dependencyEntryPoints ?: string [ ] ,
1622
+ followSymlinks :boolean = true
1617
1623
) : Promise < string [ ] > {
1618
1624
const deps = await getDependencies ( cwd , dependencies , dependencyEntryPoints ) ;
1619
1625
const promises = deps . map ( dep =>
1620
- glob ( '**' , { cwd : dep , nodir : true , follow : true , dot : true , ignore : 'node_modules/**' } ) . then ( files =>
1626
+ glob ( '**' , { cwd : dep , nodir : true , follow : followSymlinks , dot : true , ignore : 'node_modules/**' } ) . then ( files =>
1621
1627
files . map ( f => path . relative ( cwd , path . join ( dep , f ) ) ) . map ( f => f . replace ( / \\ / g, '/' ) )
1622
1628
)
1623
1629
) ;
@@ -1647,11 +1653,12 @@ function collectFiles(
1647
1653
ignoreFile ?: string ,
1648
1654
manifestFileIncludes ?: string [ ] ,
1649
1655
readmePath ?: string ,
1656
+ followSymlinks :boolean = false
1650
1657
) : Promise < string [ ] > {
1651
1658
readmePath = readmePath ?? 'README.md' ;
1652
1659
const notIgnored = [ '!package.json' , `!${ readmePath } ` ] ;
1653
1660
1654
- return collectAllFiles ( cwd , dependencies , dependencyEntryPoints ) . then ( files => {
1661
+ return collectAllFiles ( cwd , dependencies , dependencyEntryPoints , followSymlinks ) . then ( files => {
1655
1662
files = files . filter ( f => ! / \r $ / m. test ( f ) ) ;
1656
1663
1657
1664
return (
@@ -1666,7 +1673,7 @@ function collectFiles(
1666
1673
manifestFileIncludes ?
1667
1674
// include all files in manifestFileIncludes and ignore the rest
1668
1675
Promise . resolve ( manifestFileIncludes . map ( file => `!${ file } ` ) . concat ( [ '**' ] ) . join ( '\n\r' ) ) :
1669
- // "files" property not used in package.json
1676
+ // "files" property not used in package.json
1670
1677
Promise . resolve ( '' )
1671
1678
)
1672
1679
@@ -1758,7 +1765,7 @@ export function collect(manifest: ManifestPackage, options: IPackageOptions = {}
1758
1765
const ignoreFile = options . ignoreFile || undefined ;
1759
1766
const processors = createDefaultProcessors ( manifest , options ) ;
1760
1767
1761
- return collectFiles ( cwd , getDependenciesOption ( options ) , packagedDependencies , ignoreFile , manifest . files , options . readmePath ) . then ( fileNames => {
1768
+ return collectFiles ( cwd , getDependenciesOption ( options ) , packagedDependencies , ignoreFile , manifest . files , options . readmePath , options . followSymlinks ) . then ( fileNames => {
1762
1769
const files = fileNames . map ( f => ( { path : util . filePathToVsixPath ( f ) , localPath : path . join ( cwd , f ) } ) ) ;
1763
1770
1764
1771
return processFiles ( processors , files ) ;
@@ -1931,6 +1938,7 @@ export interface IListFilesOptions {
1931
1938
readonly dependencies ?: boolean ;
1932
1939
readonly prepublish ?: boolean ;
1933
1940
readonly readmePath ?: string ;
1941
+ readonly followSymlinks ?: boolean ;
1934
1942
}
1935
1943
1936
1944
/**
@@ -1944,7 +1952,7 @@ export async function listFiles(options: IListFilesOptions = {}): Promise<string
1944
1952
await prepublish ( cwd , manifest , options . useYarn ) ;
1945
1953
}
1946
1954
1947
- return await collectFiles ( cwd , getDependenciesOption ( options ) , options . packagedDependencies , options . ignoreFile , manifest . files , options . readmePath ) ;
1955
+ return await collectFiles ( cwd , getDependenciesOption ( options ) , options . packagedDependencies , options . ignoreFile , manifest . files , options . readmePath , options . followSymlinks ) ;
1948
1956
}
1949
1957
1950
1958
interface ILSOptions {
@@ -1954,6 +1962,7 @@ interface ILSOptions {
1954
1962
readonly ignoreFile ?: string ;
1955
1963
readonly dependencies ?: boolean ;
1956
1964
readonly readmePath ?: string ;
1965
+ readonly followSymlinks ?: boolean ;
1957
1966
}
1958
1967
1959
1968
/**
@@ -2008,7 +2017,7 @@ export async function printAndValidatePackagedFiles(files: IFile[], cwd: string,
2008
2017
util . log . error ( message ) ;
2009
2018
process . exit ( 1 ) ;
2010
2019
}
2011
- // Throw an error if the extension uses the files property in package.json and
2020
+ // Throw an error if the extension uses the files property in package.json and
2012
2021
// the package does not include at least one file for each include pattern
2013
2022
else if ( manifest . files !== undefined && manifest . files . length > 0 && ! options . allowUnusedFilesPattern ) {
2014
2023
const localPaths = ( files . filter ( f => ! isInMemoryFile ( f ) ) as ILocalFile [ ] ) . map ( f => util . normalize ( f . localPath ) ) ;
0 commit comments