@teambit/webpack 0.0.525 → 0.0.526

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,7 +66,14 @@ class WebpackDevServer {
66
66
 
67
67
  this.config.devServer.port = port; // Adding signal listeners to make sure we immediately close the process on sigint / sigterm (otherwise webpack dev server closing will take time)
68
68
 
69
- this.addSignalListener(); // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler
69
+ this.addSignalListener(); // Compatibility check for Webpack dev server v3 (e.g. for Angular v8)
70
+
71
+ if (typeof this.WsDevServer.addDevServerEntrypoints !== 'undefined') {
72
+ // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler
73
+ const webpackDs = new this.WsDevServer(this.getCompiler(), this.config.devServer);
74
+ return webpackDs.listen(port);
75
+ } // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler
76
+
70
77
 
71
78
  const webpackDs = new this.WsDevServer(this.config.devServer, this.getCompiler());
72
79
  await webpackDs.start();
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack.dev-server.ts"],"names":["WebpackDevServer","constructor","config","webpack","WsDevServer","WebpackAspect","id","getCompiler","displayConfig","depth","listen","port","devServer","Error","addSignalListener","webpackDs","start","server","process","on","exit"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAIA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAKO,MAAMA,gBAAN,CAA4C;AACjDC,EAAAA,WAAW,CACDC,MADC,EAEDC,OAFC,EAGDC,WAHC,EAIT;AAAA,SAHQF,MAGR,GAHQA,MAGR;AAAA,SAFQC,OAER,GAFQA,OAER;AAAA,SADQC,WACR,GADQA,WACR;AAAA,gDAMGC,yBAAcC,EANjB;AAAA,yDAQY,oBARZ;AAAE;;AAEIC,EAAAA,WAAW,GAAQ;AACzB,WAAO,KAAKJ,OAAL,CAAa,KAAKD,MAAlB,CAAP;AACD;;AAMDM,EAAAA,aAAa,GAAW;AACtB,WAAO,qBAAQ,KAAKN,MAAb,EAAqB;AAAEO,MAAAA,KAAK,EAAE;AAAT,KAArB,CAAP;AACD;;AAEW,QAANC,MAAM,CAACC,IAAD,EAAgC;AAC1C,QAAI,CAAC,KAAKT,MAAL,CAAYU,SAAjB,EAA4B;AAC1B,YAAM,IAAIC,KAAJ,CAAU,6CAAV,CAAN;AACD,KAHyC,CAI1C;;;AACA,SAAKX,MAAL,CAAYU,SAAZ,CAAsBD,IAAtB,GAA6BA,IAA7B,CAL0C,CAO1C;;AACA,SAAKG,iBAAL,GAR0C,CAS1C;;AACA,UAAMC,SAAc,GAAG,IAAI,KAAKX,WAAT,CAAqB,KAAKF,MAAL,CAAYU,SAAjC,EAA4C,KAAKL,WAAL,EAA5C,CAAvB;AACA,UAAMQ,SAAS,CAACC,KAAV,EAAN;AAEA,WAAOD,SAAS,CAACE,MAAjB;AACD;;AAEOH,EAAAA,iBAAiB,GAAG;AAC1BI,IAAAA,OAAO,CAACC,EAAR,CAAW,SAAX,EAAsB,MAAM;AAC1BD,MAAAA,OAAO,CAACE,IAAR;AACD,KAFD;AAIAF,IAAAA,OAAO,CAACC,EAAR,CAAW,QAAX,EAAqB,MAAM;AACzBD,MAAAA,OAAO,CAACE,IAAR;AACD,KAFD;AAGD;;AA3CgD","sourcesContent":["import type { DevServer } from '@teambit/bundler';\nimport type { Server } from 'http';\nimport type { webpack as webpackCompiler, Configuration } from 'webpack';\nimport type * as WDS from 'webpack-dev-server';\nimport { inspect } from 'util';\nimport { WebpackAspect } from './webpack.aspect';\n\nexport interface WebpackConfigWithDevServer extends Configuration {\n devServer: WDS.Configuration;\n}\nexport class WebpackDevServer implements DevServer {\n constructor(\n private config: WebpackConfigWithDevServer,\n private webpack: typeof webpackCompiler,\n private WsDevServer: WDS\n ) {}\n\n private getCompiler(): any {\n return this.webpack(this.config);\n }\n\n id = WebpackAspect.id;\n\n displayName = 'Webpack dev server';\n\n displayConfig(): string {\n return inspect(this.config, { depth: 10 });\n }\n\n async listen(port: number): Promise<Server> {\n if (!this.config.devServer) {\n throw new Error('Missing devServer configuration for webpack');\n }\n // Prevent different port between the config port and the listen arg port\n this.config.devServer.port = port;\n\n // Adding signal listeners to make sure we immediately close the process on sigint / sigterm (otherwise webpack dev server closing will take time)\n this.addSignalListener();\n // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler\n const webpackDs: WDS = new this.WsDevServer(this.config.devServer, this.getCompiler());\n await webpackDs.start();\n\n return webpackDs.server;\n }\n\n private addSignalListener() {\n process.on('SIGTERM', () => {\n process.exit();\n });\n\n process.on('SIGINT', () => {\n process.exit();\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["webpack.dev-server.ts"],"names":["WebpackDevServer","constructor","config","webpack","WsDevServer","WebpackAspect","id","getCompiler","displayConfig","depth","listen","port","devServer","Error","addSignalListener","addDevServerEntrypoints","webpackDs","start","server","process","on","exit"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAIA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAKO,MAAMA,gBAAN,CAA4C;AACjDC,EAAAA,WAAW,CACDC,MADC,EAEDC,OAFC,EAGDC,WAHC,EAIT;AAAA,SAHQF,MAGR,GAHQA,MAGR;AAAA,SAFQC,OAER,GAFQA,OAER;AAAA,SADQC,WACR,GADQA,WACR;AAAA,gDAMGC,yBAAcC,EANjB;AAAA,yDAQY,oBARZ;AAAE;;AAEIC,EAAAA,WAAW,GAAQ;AACzB,WAAO,KAAKJ,OAAL,CAAa,KAAKD,MAAlB,CAAP;AACD;;AAMDM,EAAAA,aAAa,GAAW;AACtB,WAAO,qBAAQ,KAAKN,MAAb,EAAqB;AAAEO,MAAAA,KAAK,EAAE;AAAT,KAArB,CAAP;AACD;;AAEW,QAANC,MAAM,CAACC,IAAD,EAAgC;AAC1C,QAAI,CAAC,KAAKT,MAAL,CAAYU,SAAjB,EAA4B;AAC1B,YAAM,IAAIC,KAAJ,CAAU,6CAAV,CAAN;AACD,KAHyC,CAI1C;;;AACA,SAAKX,MAAL,CAAYU,SAAZ,CAAsBD,IAAtB,GAA6BA,IAA7B,CAL0C,CAO1C;;AACA,SAAKG,iBAAL,GAR0C,CAU1C;;AACA,QAAI,OAAQ,KAAKV,WAAN,CAA0BW,uBAAjC,KAA6D,WAAjE,EAA8E;AAC5E;AACA,YAAMC,SAAS,GAAG,IAAK,KAAKZ,WAAV,CAA8B,KAAKG,WAAL,EAA9B,EAAkD,KAAKL,MAAL,CAAYU,SAA9D,CAAlB;AACA,aAAOI,SAAS,CAACN,MAAV,CAAiBC,IAAjB,CAAP;AACD,KAfyC,CAiB1C;;;AACA,UAAMK,SAAc,GAAG,IAAI,KAAKZ,WAAT,CAAqB,KAAKF,MAAL,CAAYU,SAAjC,EAA4C,KAAKL,WAAL,EAA5C,CAAvB;AACA,UAAMS,SAAS,CAACC,KAAV,EAAN;AAEA,WAAOD,SAAS,CAACE,MAAjB;AACD;;AAEOJ,EAAAA,iBAAiB,GAAG;AAC1BK,IAAAA,OAAO,CAACC,EAAR,CAAW,SAAX,EAAsB,MAAM;AAC1BD,MAAAA,OAAO,CAACE,IAAR;AACD,KAFD;AAIAF,IAAAA,OAAO,CAACC,EAAR,CAAW,QAAX,EAAqB,MAAM;AACzBD,MAAAA,OAAO,CAACE,IAAR;AACD,KAFD;AAGD;;AAnDgD","sourcesContent":["import type { DevServer } from '@teambit/bundler';\nimport type { Server } from 'http';\nimport type { webpack as webpackCompiler, Configuration } from 'webpack';\nimport type * as WDS from 'webpack-dev-server';\nimport { inspect } from 'util';\nimport { WebpackAspect } from './webpack.aspect';\n\nexport interface WebpackConfigWithDevServer extends Configuration {\n devServer: WDS.Configuration;\n}\nexport class WebpackDevServer implements DevServer {\n constructor(\n private config: WebpackConfigWithDevServer,\n private webpack: typeof webpackCompiler,\n private WsDevServer: WDS\n ) {}\n\n private getCompiler(): any {\n return this.webpack(this.config);\n }\n\n id = WebpackAspect.id;\n\n displayName = 'Webpack dev server';\n\n displayConfig(): string {\n return inspect(this.config, { depth: 10 });\n }\n\n async listen(port: number): Promise<Server> {\n if (!this.config.devServer) {\n throw new Error('Missing devServer configuration for webpack');\n }\n // Prevent different port between the config port and the listen arg port\n this.config.devServer.port = port;\n\n // Adding signal listeners to make sure we immediately close the process on sigint / sigterm (otherwise webpack dev server closing will take time)\n this.addSignalListener();\n\n // Compatibility check for Webpack dev server v3 (e.g. for Angular v8)\n if (typeof (this.WsDevServer as any).addDevServerEntrypoints !== 'undefined') {\n // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler\n const webpackDs = new (this.WsDevServer as any)(this.getCompiler(), this.config.devServer);\n return webpackDs.listen(port);\n }\n\n // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler\n const webpackDs: WDS = new this.WsDevServer(this.config.devServer, this.getCompiler());\n await webpackDs.start();\n\n return webpackDs.server;\n }\n\n private addSignalListener() {\n process.on('SIGTERM', () => {\n process.exit();\n });\n\n process.on('SIGINT', () => {\n process.exit();\n });\n }\n}\n"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/webpack",
3
- "version": "0.0.525",
3
+ "version": "0.0.526",
4
4
  "homepage": "https://bit.dev/teambit/webpack/webpack",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.webpack",
8
8
  "name": "webpack",
9
- "version": "0.0.525"
9
+ "version": "0.0.526"
10
10
  },
11
11
  "dependencies": {
12
12
  "webpack": "5.51.1",
@@ -40,11 +40,11 @@
40
40
  "core-js": "^3.0.0",
41
41
  "@teambit/webpack.modules.config-mutator": "0.0.96",
42
42
  "@teambit/bit-error": "0.0.366",
43
- "@teambit/bundler": "0.0.525",
44
- "@teambit/logger": "0.0.451",
43
+ "@teambit/bundler": "0.0.526",
44
+ "@teambit/logger": "0.0.452",
45
45
  "@teambit/cli": "0.0.380",
46
- "@teambit/pubsub": "0.0.525",
47
- "@teambit/workspace": "0.0.525"
46
+ "@teambit/pubsub": "0.0.526",
47
+ "@teambit/workspace": "0.0.526"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/webpack": "5.28.0",
@@ -36,6 +36,14 @@ export class WebpackDevServer implements DevServer {
36
36
 
37
37
  // Adding signal listeners to make sure we immediately close the process on sigint / sigterm (otherwise webpack dev server closing will take time)
38
38
  this.addSignalListener();
39
+
40
+ // Compatibility check for Webpack dev server v3 (e.g. for Angular v8)
41
+ if (typeof (this.WsDevServer as any).addDevServerEntrypoints !== 'undefined') {
42
+ // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler
43
+ const webpackDs = new (this.WsDevServer as any)(this.getCompiler(), this.config.devServer);
44
+ return webpackDs.listen(port);
45
+ }
46
+
39
47
  // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler
40
48
  const webpackDs: WDS = new this.WsDevServer(this.config.devServer, this.getCompiler());
41
49
  await webpackDs.start();