From 021c7dbf4dde98b1c9e6babcf5d0068d621fd31f Mon Sep 17 00:00:00 2001 From: Tarik02 Date: Sat, 30 Jul 2022 10:36:26 +0300 Subject: [PATCH 1/2] Fix typings --- index.d.ts | 94 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/index.d.ts b/index.d.ts index 01da7c9..e5f9e37 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,57 +1,59 @@ import {MergeExclusive} from 'type-fest'; import {Compiler} from 'webpack'; -export type Alias = - | 'Buffer' - | 'console' - | 'process' - | 'assert' - | 'buffer' - | 'console' - | 'constants' - | 'crypto' - | 'domain' - | 'events' - | 'http' - | 'https' - | 'os' - | 'path' - | 'punycode' - | 'process' - | 'querystring' - | 'stream' - | '_stream_duplex' - | '_stream_passthrough' - | '_stream_readable' - | '_stream_transform' - | '_stream_writable' - | 'string_decoder' - | 'sys' - | 'timers' - | 'tty' - | 'url' - | 'util' - | 'vm' - | 'zlib'; +declare namespace NodePolyfillPlugin { + export type Alias = + | 'Buffer' + | 'console' + | 'process' + | 'assert' + | 'buffer' + | 'console' + | 'constants' + | 'crypto' + | 'domain' + | 'events' + | 'http' + | 'https' + | 'os' + | 'path' + | 'punycode' + | 'process' + | 'querystring' + | 'stream' + | '_stream_duplex' + | '_stream_passthrough' + | '_stream_readable' + | '_stream_transform' + | '_stream_writable' + | 'string_decoder' + | 'sys' + | 'timers' + | 'tty' + | 'url' + | 'util' + | 'vm' + | 'zlib'; -interface IncludeOptions { - /** - By default, the modules that were polyfilled in Webpack 4 are mirrored over. However, you can choose to only include certain aliases. For example, you can only have `console` polyfilled. - */ - includeAliases?: readonly Alias[]; -} + interface IncludeOptions { + /** + By default, the modules that were polyfilled in Webpack 4 are mirrored over. However, you can choose to only include certain aliases. For example, you can only have `console` polyfilled. + */ + includeAliases?: readonly Alias[]; + } -interface ExcludeOptions { - /** - By default, the modules that were polyfilled in Webpack 4 are mirrored over. However, if you don't want a module like `console` to be polyfilled you can specify alises to be skipped here. - */ - excludeAliases?: readonly Alias[]; -} + interface ExcludeOptions { + /** + By default, the modules that were polyfilled in Webpack 4 are mirrored over. However, if you don't want a module like `console` to be polyfilled you can specify alises to be skipped here. + */ + excludeAliases?: readonly Alias[]; + } -export type Options = MergeExclusive; + export type Options = MergeExclusive; +} declare class NodePolyfillPlugin { - constructor(options?: Options); + constructor(options?: NodePolyfillPlugin.Options); apply(compiler: InstanceType): void; } From 4964c81759b9295fba6c2915f18ec3621590b23a Mon Sep 17 00:00:00 2001 From: Richie Bendall Date: Sat, 30 Jul 2022 19:43:40 +1200 Subject: [PATCH 2/2] Update index.d.ts --- index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index e5f9e37..191e064 100644 --- a/index.d.ts +++ b/index.d.ts @@ -35,14 +35,14 @@ declare namespace NodePolyfillPlugin { | 'vm' | 'zlib'; - interface IncludeOptions { + export interface IncludeOptions { /** By default, the modules that were polyfilled in Webpack 4 are mirrored over. However, you can choose to only include certain aliases. For example, you can only have `console` polyfilled. */ includeAliases?: readonly Alias[]; } - interface ExcludeOptions { + export interface ExcludeOptions { /** By default, the modules that were polyfilled in Webpack 4 are mirrored over. However, if you don't want a module like `console` to be polyfilled you can specify alises to be skipped here. */