forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add types for webpack-files-archive-plugin (DefinitelyTyped#60220)
* add types for webpack-files-archive-plugin * fix reference and test * fix webpack version * add webpack to tsconfig path * add tapable * re fix webpack version
- Loading branch information
Showing
5 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Type definitions for webpack-files-archive-plugin 1.0 | ||
// Project: https://github.com/himanshuapril1/webpack-files-archive-plugin | ||
// Definitions by: Yusuf Ades <https://github.com/yusufades> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
|
||
/// <reference types="node" /> | ||
import type { Compiler } from 'webpack'; | ||
|
||
declare namespace WebpackFilesArchivePlugin { | ||
type Formats = 'tar' | 'zip'; | ||
|
||
interface Options { | ||
/** | ||
* Archive formats to use, can be 'tar' or 'zip' | ||
*/ | ||
format: Formats | Formats[]; | ||
/** | ||
* Directory location of files to be archived. | ||
*/ | ||
output?: string; | ||
/** | ||
* A different extension to use instead of tar.gz or zip (without leading .) | ||
*/ | ||
ext?: string; | ||
} | ||
} | ||
|
||
declare class WebpackFilesArchivePlugin { | ||
constructor(options: WebpackFilesArchivePlugin.Options); | ||
|
||
apply(compiler: Compiler): void; | ||
} | ||
|
||
export = WebpackFilesArchivePlugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"private": true, | ||
"dependencies": { | ||
"tapable": "^2.2.0", | ||
"webpack": "5.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"lib": [ | ||
"es6" | ||
], | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"strictNullChecks": true, | ||
"strictFunctionTypes": true, | ||
"baseUrl": "../", | ||
"typeRoots": [ | ||
"../" | ||
], | ||
"paths": { | ||
"tapable": [ | ||
"./node_modules/tapable" | ||
], | ||
"webpack": [ | ||
"./node_modules/webpack" | ||
] | ||
}, | ||
"types": [], | ||
"noEmit": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"files": [ | ||
"index.d.ts", | ||
"webpack-files-archive-plugin-tests.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "extends": "@definitelytyped/dtslint/dt.json" } |
26 changes: 26 additions & 0 deletions
26
types/webpack-files-archive-plugin/webpack-files-archive-plugin-tests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import FilesArchivePlugin = require('webpack-files-archive-plugin'); | ||
import { Configuration } from 'webpack'; | ||
|
||
const config: Configuration = { | ||
plugins: [ | ||
// $ExpectError | ||
new FilesArchivePlugin(), | ||
new FilesArchivePlugin({ | ||
format: ['zip', 'tar'], | ||
}), | ||
new FilesArchivePlugin({ | ||
format: 'zip', | ||
}), | ||
new FilesArchivePlugin({ | ||
format: 'tar', | ||
}), | ||
new FilesArchivePlugin({ | ||
format: 'rar', // $ExpectError | ||
}), | ||
new FilesArchivePlugin({ | ||
format: ['zip', 'tar'], | ||
output: 'build', | ||
ext: 'gz', | ||
}), | ||
], | ||
}; |