mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[assets-webpack-plugin] Add type definitions (#18650)
This commit is contained in:
parent
2fc13d9e70
commit
01427d69a6
25
types/assets-webpack-plugin/assets-webpack-plugin-tests.ts
Normal file
25
types/assets-webpack-plugin/assets-webpack-plugin-tests.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import * as webpack from 'webpack';
|
||||
import * as AssetsPlugin from 'assets-webpack-plugin';
|
||||
|
||||
const config: webpack.Configuration = {
|
||||
plugins: [
|
||||
new AssetsPlugin(),
|
||||
new AssetsPlugin({
|
||||
filename: 'assets.json'
|
||||
}),
|
||||
new AssetsPlugin({
|
||||
filename: 'assets.json',
|
||||
fullPath: false,
|
||||
includeManifest: true,
|
||||
path: '/foo/bar',
|
||||
prettyPrint: true,
|
||||
processOutput: (assets) => (
|
||||
'window.assets = ' + JSON.stringify(assets)
|
||||
),
|
||||
update: true,
|
||||
metadata: {
|
||||
meta: 'data'
|
||||
},
|
||||
})
|
||||
]
|
||||
};
|
||||
76
types/assets-webpack-plugin/index.d.ts
vendored
Normal file
76
types/assets-webpack-plugin/index.d.ts
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
// Type definitions for assets-webpack-plugin 3.5
|
||||
// Project: https://github.com/sporto/assets-webpack-plugin
|
||||
// Definitions by: Michael Strobel <https://github.com/kryops>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import * as webpack from 'webpack';
|
||||
|
||||
declare namespace AssetsWebpackPlugin {
|
||||
interface Assets {
|
||||
[name: string]: {
|
||||
[ext: string]: string;
|
||||
};
|
||||
}
|
||||
|
||||
type ProcessOutputFn = (assets: Assets) => string;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Name for the created json file.
|
||||
* "webpack-assets.json" by default
|
||||
*/
|
||||
filename?: string;
|
||||
|
||||
/**
|
||||
* If false the output will not include the full path of the generated file.
|
||||
* true by default
|
||||
*/
|
||||
fullPath?: boolean;
|
||||
|
||||
/**
|
||||
* Inserts the manifest javascript as a text property in your assets.
|
||||
* Accepts the name of your manifest chunk.
|
||||
* A manifest is the last CommonChunk that only contains the webpack bootstrap code.
|
||||
* This is useful for production use when you want to inline the manifest
|
||||
* in your HTML skeleton for long-term caching.
|
||||
* false by default
|
||||
*/
|
||||
includeManifest?: boolean;
|
||||
|
||||
/**
|
||||
* Inject metadata into the output file. All values will be injected into the key "metadata"
|
||||
*/
|
||||
metadata?: object;
|
||||
|
||||
/**
|
||||
* Path where to save the created JSON file.
|
||||
* Defaults to the current directory
|
||||
*/
|
||||
path?: string;
|
||||
|
||||
/**
|
||||
* Whether to format the JSON output for readability.
|
||||
* false by default
|
||||
*/
|
||||
prettyPrint?: boolean;
|
||||
|
||||
/**
|
||||
* Formats the assets output.
|
||||
* Defaults to JSON.stringify
|
||||
*/
|
||||
processOutput?: ProcessOutputFn;
|
||||
|
||||
/**
|
||||
* When set to true, the output JSON file will be updated instead of overwritten.
|
||||
* false by default
|
||||
*/
|
||||
update?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare class AssetsWebpackPlugin extends webpack.Plugin {
|
||||
constructor(options?: AssetsWebpackPlugin.Options);
|
||||
}
|
||||
|
||||
export = AssetsWebpackPlugin;
|
||||
22
types/assets-webpack-plugin/tsconfig.json
Normal file
22
types/assets-webpack-plugin/tsconfig.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"assets-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/assets-webpack-plugin/tslint.json
Normal file
1
types/assets-webpack-plugin/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user