From e4566cbfc15637e31930a90a9bcaa75b8d25421e Mon Sep 17 00:00:00 2001 From: Mike Hill Date: Wed, 15 Mar 2017 11:30:49 -0500 Subject: [PATCH 1/3] Webpack: Add DllPlugin and DllReferencePlugin classes and properties --- webpack/index.d.ts | 78 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/webpack/index.d.ts b/webpack/index.d.ts index 28d1b33b40..ed706a7868 100644 --- a/webpack/index.d.ts +++ b/webpack/index.d.ts @@ -689,6 +689,84 @@ declare namespace webpack { constructor(definitions: {[key: string]: any}); } + class DllPlugin extends Plugin { + constructor(options: DllPlugin.Options | DllPlugin.Options[]); + } + + namespace DllPlugin { + interface Options { + /** + * The absolute path to the manifest json file (output). + */ + path: string, + + /** + * The name of the exposed DLL function (keep consistent with `output.library`). + */ + name: string, + + /** + * The context of requests in the manifest file. + * + * Defaults to the webpack context. + */ + context?: string + } + } + + class DllReferencePlugin extends Plugin { + constructor(options: DllReferencePlugin.Options); + } + + namespace DllReferencePlugin { + interface Options { + /** + * The context of requests in the manifest (or content property). + * + * This is an absolute path. + */ + context: string, + + /** + * An object containing `content` and `name`. + */ + manifest: { + content: string, + name: string + }, + + /** + * The prefix which is used for accessing the content of the DLL. + */ + scope?: string, + + /** + * The name where the DLL is exposed. + * + * Defaults to `manifest.name`. + * + * See also `externals`. + */ + name?: string, + + /** + * The type how the DLL is exposed. + * + * Defaults to `"var"`. + * + * See also `externals`. + */ + sourceType?: string, + + /** + * The mappings from the request to module ID. + * + * Defaults to `manifest.content`. + */ + content?: any + } + } + class EvalSourceMapDevToolPlugin extends Plugin { constructor(options?: false | string | EvalSourceMapDevToolPlugin.Options); } From bc0ac9ada3adb303cf02ac2df32e2c546ac40987 Mon Sep 17 00:00:00 2001 From: Mike Hill Date: Mon, 20 Mar 2017 11:06:59 -0500 Subject: [PATCH 2/3] Webpack: Reformat Dll(Reference)Plugin params --- webpack/index.d.ts | 57 ++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/webpack/index.d.ts b/webpack/index.d.ts index ed706a7868..ee9ebd8be2 100644 --- a/webpack/index.d.ts +++ b/webpack/index.d.ts @@ -695,22 +695,22 @@ declare namespace webpack { namespace DllPlugin { interface Options { - /** - * The absolute path to the manifest json file (output). - */ - path: string, - - /** - * The name of the exposed DLL function (keep consistent with `output.library`). - */ - name: string, - /** * The context of requests in the manifest file. * * Defaults to the webpack context. */ - context?: string + context?: string; + + /** + * The name of the exposed DLL function (keep consistent with `output.library`). + */ + name: string; + + /** + * The absolute path to the manifest json file (output). + */ + path: string; } } @@ -720,25 +720,24 @@ declare namespace webpack { namespace DllReferencePlugin { interface Options { + /** + * The mappings from the request to module ID. + * + * Defaults to `manifest.content`. + */ + content?: any; + /** * The context of requests in the manifest (or content property). * * This is an absolute path. */ - context: string, + context: string; /** * An object containing `content` and `name`. */ - manifest: { - content: string, - name: string - }, - - /** - * The prefix which is used for accessing the content of the DLL. - */ - scope?: string, + manifest: { content: string, name: string }; /** * The name where the DLL is exposed. @@ -747,7 +746,12 @@ declare namespace webpack { * * See also `externals`. */ - name?: string, + name?: string; + + /** + * The prefix which is used for accessing the content of the DLL. + */ + scope?: string; /** * The type how the DLL is exposed. @@ -756,14 +760,7 @@ declare namespace webpack { * * See also `externals`. */ - sourceType?: string, - - /** - * The mappings from the request to module ID. - * - * Defaults to `manifest.content`. - */ - content?: any + sourceType?: string; } } From cb2cbebe94f4264da072934364747396f0600e9e Mon Sep 17 00:00:00 2001 From: Mike Hill Date: Mon, 20 Mar 2017 11:07:28 -0500 Subject: [PATCH 3/3] Webpack: Add Dll(Reference)Plugin tests --- webpack/webpack-tests.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/webpack/webpack-tests.ts b/webpack/webpack-tests.ts index ce9d42d71b..aeb17e5d4c 100644 --- a/webpack/webpack-tests.ts +++ b/webpack/webpack-tests.ts @@ -278,6 +278,27 @@ plugin = new webpack.ContextReplacementPlugin( resourceRegExp, newContentResource); plugin = new webpack.ContextReplacementPlugin(resourceRegExp); +plugin = new webpack.DllPlugin({ + context: 'dir-context', + name: 'dll-name', + path: 'manifest-path' +}); +plugin = new webpack.DllPlugin([{ + context: 'dir-context', + name: 'dll-name', + path: 'manifest-path' +}]); +plugin = new webpack.DllReferencePlugin({ + content: 'dll content', + context: 'dir-context', + manifest: { + content: 'dll content', + name: 'dll name' + }, + name: 'dll name', + scope: 'dll prefix', + sourceType: 'var' +}); plugin = new webpack.IgnorePlugin(requestRegExp); plugin = new webpack.IgnorePlugin(requestRegExp, contextRegExp);