@@ -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 ;
@@ -1630,11 +1635,12 @@ const defaultIgnore = [
1630
1635
async function collectAllFiles (
1631
1636
cwd : string ,
1632
1637
dependencies : 'npm' | 'yarn' | 'none' | undefined ,
1633
- dependencyEntryPoints ?: string [ ]
1638
+ dependencyEntryPoints ?: string [ ] ,
1639
+ followSymlinks :boolean = true
1634
1640
) : Promise < string [ ] > {
1635
1641
const deps = await getDependencies ( cwd , dependencies , dependencyEntryPoints ) ;
1636
1642
const promises = deps . map ( dep =>
1637
- glob ( '**' , { cwd : dep , nodir : true , dot : true , ignore : 'node_modules/**' } ) . then ( files =>
1643
+ glob ( '**' , { cwd : dep , nodir : true , follow : followSymlinks , dot : true , ignore : 'node_modules/**' } ) . then ( files =>
1638
1644
files . map ( f => path . relative ( cwd , path . join ( dep , f ) ) ) . map ( f => f . replace ( / \\ / g, '/' ) )
1639
1645
)
1640
1646
) ;
@@ -1664,11 +1670,12 @@ function collectFiles(
1664
1670
ignoreFile ?: string ,
1665
1671
manifestFileIncludes ?: string [ ] ,
1666
1672
readmePath ?: string ,
1673
+ followSymlinks :boolean = false
1667
1674
) : Promise < string [ ] > {
1668
1675
readmePath = readmePath ?? 'README.md' ;
1669
1676
const notIgnored = [ '!package.json' , `!${ readmePath } ` ] ;
1670
1677
1671
- return collectAllFiles ( cwd , dependencies , dependencyEntryPoints ) . then ( files => {
1678
+ return collectAllFiles ( cwd , dependencies , dependencyEntryPoints , followSymlinks ) . then ( files => {
1672
1679
files = files . filter ( f => ! / \r $ / m. test ( f ) ) ;
1673
1680
1674
1681
return (
@@ -1683,7 +1690,7 @@ function collectFiles(
1683
1690
manifestFileIncludes ?
1684
1691
// include all files in manifestFileIncludes and ignore the rest
1685
1692
Promise . resolve ( manifestFileIncludes . map ( file => `!${ file } ` ) . concat ( [ '**' ] ) . join ( '\n\r' ) ) :
1686
- // "files" property not used in package.json
1693
+ // "files" property not used in package.json
1687
1694
Promise . resolve ( '' )
1688
1695
)
1689
1696
@@ -1775,7 +1782,7 @@ export function collect(manifest: ManifestPackage, options: IPackageOptions = {}
1775
1782
const ignoreFile = options . ignoreFile || undefined ;
1776
1783
const processors = createDefaultProcessors ( manifest , options ) ;
1777
1784
1778
- return collectFiles ( cwd , getDependenciesOption ( options ) , packagedDependencies , ignoreFile , manifest . files , options . readmePath ) . then ( fileNames => {
1785
+ return collectFiles ( cwd , getDependenciesOption ( options ) , packagedDependencies , ignoreFile , manifest . files , options . readmePath , options . followSymlinks ) . then ( fileNames => {
1779
1786
const files = fileNames . map ( f => ( { path : util . filePathToVsixPath ( f ) , localPath : path . join ( cwd , f ) } ) ) ;
1780
1787
1781
1788
return processFiles ( processors , files ) ;
@@ -1948,6 +1955,7 @@ export interface IListFilesOptions {
1948
1955
readonly dependencies ?: boolean ;
1949
1956
readonly prepublish ?: boolean ;
1950
1957
readonly readmePath ?: string ;
1958
+ readonly followSymlinks ?: boolean ;
1951
1959
}
1952
1960
1953
1961
/**
@@ -1961,7 +1969,7 @@ export async function listFiles(options: IListFilesOptions = {}): Promise<string
1961
1969
await prepublish ( cwd , manifest , options . useYarn ) ;
1962
1970
}
1963
1971
1964
- return await collectFiles ( cwd , getDependenciesOption ( options ) , options . packagedDependencies , options . ignoreFile , manifest . files , options . readmePath ) ;
1972
+ return await collectFiles ( cwd , getDependenciesOption ( options ) , options . packagedDependencies , options . ignoreFile , manifest . files , options . readmePath , options . followSymlinks ) ;
1965
1973
}
1966
1974
1967
1975
interface ILSOptions {
@@ -1971,6 +1979,7 @@ interface ILSOptions {
1971
1979
readonly ignoreFile ?: string ;
1972
1980
readonly dependencies ?: boolean ;
1973
1981
readonly readmePath ?: string ;
1982
+ readonly followSymlinks ?: boolean ;
1974
1983
}
1975
1984
1976
1985
/**
@@ -2025,7 +2034,7 @@ export async function printAndValidatePackagedFiles(files: IFile[], cwd: string,
2025
2034
util . log . error ( message ) ;
2026
2035
process . exit ( 1 ) ;
2027
2036
}
2028
- // Throw an error if the extension uses the files property in package.json and
2037
+ // Throw an error if the extension uses the files property in package.json and
2029
2038
// the package does not include at least one file for each include pattern
2030
2039
else if ( manifest . files !== undefined && manifest . files . length > 0 && ! options . allowUnusedFilesPattern ) {
2031
2040
const localPaths = ( files . filter ( f => ! isInMemoryFile ( f ) ) as ILocalFile [ ] ) . map ( f => util . normalize ( f . localPath ) ) ;
0 commit comments