fix grunt.file.expandMapping related issue

This commit is contained in:
San Chen
2014-01-15 17:54:56 +08:00
parent 7a44f44079
commit 7581e03ad7
3 changed files with 19 additions and 11 deletions
+4
View File
@@ -57,4 +57,8 @@ exports = (grunt: IGrunt) => {
asyncedTwoArgs(2, "values", (result: string) => {
console.log(result);
});
var fileMaps = grunt.file.expandMapping([''], '', { ext: '.js' });
fileMaps.length;
fileMaps[0].src.length;
fileMaps[0].dest;
};
+14 -10
View File
@@ -450,7 +450,7 @@ declare module grunt {
* @see FileModule.expand method documentation for an explanation of how the patterns
* and options arguments may be specified.
*/
expandMapping(patterns: string[], dest: string, options: IExpandedFilesConfig): IFilesMap
expandMapping(patterns: string[], dest: string, options: IExpandedFilesConfig): Array<IFileMap>
/**
* Match one or more globbing patterns against one or more file paths.
@@ -558,7 +558,7 @@ declare module grunt {
/**
* Pattern(s) to match, relative to the {@link IExpandedFilesConfig.cwd}.
*/
src: string[]
src?: string[]
/**
* Destination path prefix.
@@ -599,7 +599,7 @@ declare module grunt {
/**
* Enables the following options
*/
expand: boolean // = true
expand?: boolean // = true
/**
* All {@link IExpandedFilesConfig.src} matches are relative to (but don't include) this path.
@@ -609,7 +609,7 @@ declare module grunt {
/**
* Replace any existing extension with this value in generated {@link IExpandedFilesConfig.dest} paths.
*/
ext?: boolean
ext?: string
/**
* Remove all path parts from generated {@link IExpandedFilesConfig.dest} paths.
@@ -622,17 +622,21 @@ declare module grunt {
* and this function must return a new dest value.
* If the same dest is returned more than once, each src which used it will be added to an array of sources for it.
*/
rename?: boolean
rename?: Function
}
/**
* @see {@link http://gruntjs.com/configuring-tasks#files-object-format}
* @see {@link http://gruntjs.com/configuring-tasks#files-array-format}
*/
interface IFilesMap {
interface IFileMap {
/**
* A map of sources to a destination.
* source filenames.
*/
[dest: string]: string[]
src: string[]
/**
* destination filename.
*/
dest: string
}
}
@@ -804,7 +808,7 @@ declare module grunt {
* Normalizes a task target configuration object into an array of src-dest file mappings.
* This method is used internally by the multi task system this.files / grunt.task.current.files property.
*/
normalizeMultiTaskFiles(data: grunt.config.IProjectConfig, targetname?: string): grunt.file.IFilesMap
normalizeMultiTaskFiles(data: grunt.config.IProjectConfig, targetname?: string): Array<grunt.file.IFileMap>
}
interface AsyncResultCatcher {