mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
[@wordpress/dependency-extraction-webpack-plugin] add new definitions (#36033)
* [@wordpress/dependency-extraction-webpack-plugin] add new definitions * use more appropriate "export =" syntax
This commit is contained in:
committed by
Daniel Rosenwasser
parent
d6462559f4
commit
44115af1cb
@@ -0,0 +1,20 @@
|
||||
// Type definitions for @wordpress/dependency-extraction-webpack-plugin 1.0
|
||||
// Project: https://github.com/WordPress/gutenberg/tree/master/packages/dependency-extraction-webpack-plugin/README.md
|
||||
// Definitions by: Derek Sifford <https://github.com/dsifford>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.5
|
||||
|
||||
import { Plugin } from "webpack";
|
||||
|
||||
interface Options {
|
||||
useDefaults?: boolean;
|
||||
injectPolyfill?: boolean;
|
||||
requestToExternal?(request: string): string | string[] | void;
|
||||
requestToHandle?(request: string): string | void;
|
||||
}
|
||||
|
||||
declare class DependencyExtractionWebpackPlugin extends Plugin {
|
||||
constructor(options?: Options);
|
||||
}
|
||||
|
||||
export = DependencyExtractionWebpackPlugin;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@wordpress/dependency-extraction-webpack-plugin": [
|
||||
"wordpress__dependency-extraction-webpack-plugin"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"wordpress__dependency-extraction-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
import DependencyExtractionPlugin = require('@wordpress/dependency-extraction-webpack-plugin');
|
||||
|
||||
new DependencyExtractionPlugin();
|
||||
|
||||
new DependencyExtractionPlugin({
|
||||
useDefaults: false,
|
||||
});
|
||||
|
||||
new DependencyExtractionPlugin({
|
||||
requestToExternal(request) {
|
||||
if (request === "foo-bar") {
|
||||
return "FooBar";
|
||||
}
|
||||
if (request === "baz-qux") {
|
||||
return ["baz", "qux"];
|
||||
}
|
||||
},
|
||||
requestToHandle: request => {
|
||||
if (request === "foo-bar") {
|
||||
return "FooBar";
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user