diff --git a/types/webpack-cdn-inject/index.d.ts b/types/webpack-cdn-inject/index.d.ts new file mode 100644 index 0000000000..e61d5ceb4c --- /dev/null +++ b/types/webpack-cdn-inject/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for webpack-cdn-inject 1.0 +// Project: https://github.com/drolsen/webpack-cdn-inject#readme +// Definitions by: Piotr Błażejewicz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Plugin } from 'webpack'; + +/** + * Plugin to inject CDN assets into HTML documents. + */ +declare namespace WebpackCDNInject { + interface Options { + /** + * Defines urls to be added to document head (tag type is defined by url's file extension). + */ + head?: string[]; + /** + * Defines urls to be added to document body (tag type is defined by url's file extension). + */ + body?: string[]; + } +} + +declare class WebpackCDNInject extends Plugin { + constructor(options?: WebpackCDNInject.Options); +} + +export = WebpackCDNInject; diff --git a/types/webpack-cdn-inject/tsconfig.json b/types/webpack-cdn-inject/tsconfig.json new file mode 100644 index 0000000000..caf08f6494 --- /dev/null +++ b/types/webpack-cdn-inject/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "webpack-cdn-inject-tests.ts" + ] +} diff --git a/types/webpack-cdn-inject/tslint.json b/types/webpack-cdn-inject/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/webpack-cdn-inject/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/webpack-cdn-inject/webpack-cdn-inject-tests.ts b/types/webpack-cdn-inject/webpack-cdn-inject-tests.ts new file mode 100644 index 0000000000..ac3a3dce6b --- /dev/null +++ b/types/webpack-cdn-inject/webpack-cdn-inject-tests.ts @@ -0,0 +1,19 @@ +import { Configuration } from 'webpack'; +import WebpackCDNInject = require('webpack-cdn-inject'); + +const config: Configuration = { + plugins: [ + new WebpackCDNInject(), + new WebpackCDNInject({}), + new WebpackCDNInject({ + body: ['url.js', 'url.css'], + }), + new WebpackCDNInject({ + head: ['url.css', 'url.js'], + }), + new WebpackCDNInject({ + body: ['url.js', 'url.css'], + head: ['url.css', 'url.js'], + }), + ], +};