@teambit/webpack 0.0.973 → 0.0.975

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.
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.webpack_webpack@0.0.973/dist/webpack.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.webpack_webpack@0.0.973/dist/webpack.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.webpack_webpack@0.0.975/dist/webpack.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.webpack_webpack@0.0.975/dist/webpack.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -10,9 +10,18 @@ export interface WebpackConfigWithDevServer extends Configuration {
10
10
  export declare class WebpackDevServer implements DevServer {
11
11
  private config;
12
12
  private webpack;
13
- private webpackDevServerModulePath;
13
+ /**
14
+ * path to the webpack-dev-server module or instance of webpack-dev-server.
15
+ * this accept getting an instance for backward compatibility.
16
+ */
17
+ private webpackDevServer;
14
18
  private readonly WsDevServer;
15
- constructor(config: WebpackConfigWithDevServer, webpack: typeof webpackCompiler, webpackDevServerModulePath: string);
19
+ constructor(config: WebpackConfigWithDevServer, webpack: typeof webpackCompiler,
20
+ /**
21
+ * path to the webpack-dev-server module or instance of webpack-dev-server.
22
+ * this accept getting an instance for backward compatibility.
23
+ */
24
+ webpackDevServer: string | typeof WDS);
16
25
  private getCompiler;
17
26
  id: string;
18
27
  displayName: string;
@@ -42,23 +42,35 @@ function _webpack() {
42
42
  return data;
43
43
  }
44
44
  class WebpackDevServer {
45
- constructor(config, webpack, webpackDevServerModulePath) {
45
+ constructor(config, webpack,
46
+ /**
47
+ * path to the webpack-dev-server module or instance of webpack-dev-server.
48
+ * this accept getting an instance for backward compatibility.
49
+ */
50
+ webpackDevServer) {
46
51
  this.config = config;
47
52
  this.webpack = webpack;
48
- this.webpackDevServerModulePath = webpackDevServerModulePath;
53
+ this.webpackDevServer = webpackDevServer;
49
54
  (0, _defineProperty2().default)(this, "WsDevServer", void 0);
50
55
  (0, _defineProperty2().default)(this, "id", _webpack().WebpackAspect.id);
51
56
  (0, _defineProperty2().default)(this, "displayName", 'Webpack dev server');
52
- // eslint-disable-next-line import/no-dynamic-require, global-require
53
- this.WsDevServer = require(this.webpackDevServerModulePath);
57
+ if (typeof this.webpackDevServer === 'string') {
58
+ // eslint-disable-next-line import/no-dynamic-require, global-require
59
+ this.WsDevServer = require(this.webpackDevServer);
60
+ } else {
61
+ this.WsDevServer = this.webpackDevServer;
62
+ }
54
63
  }
55
64
  getCompiler() {
56
65
  return this.webpack(this.config);
57
66
  }
58
67
  version() {
68
+ if (typeof this.webpackDevServer !== 'string') {
69
+ return 'unknown';
70
+ }
59
71
  // Resolve version from the webpack-dev-server package.json
60
72
  try {
61
- const root = (0, _findRoot().default)(this.webpackDevServerModulePath);
73
+ const root = (0, _findRoot().default)(this.webpackDevServer);
62
74
  const packageJsonPath = (0, _path().join)(root, 'package.json');
63
75
  // eslint-disable-next-line import/no-dynamic-require, global-require
64
76
  const packageJson = require(packageJsonPath);
@@ -1 +1 @@
1
- {"version":3,"names":["WebpackDevServer","constructor","config","webpack","webpackDevServerModulePath","WebpackAspect","id","WsDevServer","require","getCompiler","version","root","findRoot","packageJsonPath","join","packageJson","err","displayConfig","inspect","depth","listen","port","devServer","Error","addSignalListener","addDevServerEntrypoints","webpackDs","start","server","process","on","exit"],"sources":["webpack.dev-server.ts"],"sourcesContent":["import { join } from 'path';\nimport type { DevServer } from '@teambit/bundler';\nimport findRoot from 'find-root';\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 favicon?: string;\n}\nexport class WebpackDevServer implements DevServer {\n private readonly WsDevServer: typeof WDS;\n constructor(\n private config: WebpackConfigWithDevServer,\n private webpack: typeof webpackCompiler,\n private webpackDevServerModulePath: string\n ) {\n // eslint-disable-next-line import/no-dynamic-require, global-require\n this.WsDevServer = require(this.webpackDevServerModulePath);\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 version(): string {\n // Resolve version from the webpack-dev-server package.json\n try {\n const root = findRoot(this.webpackDevServerModulePath);\n const packageJsonPath = join(root, 'package.json');\n // eslint-disable-next-line import/no-dynamic-require, global-require\n const packageJson = require(packageJsonPath);\n return packageJson.version;\n } catch (err) {\n return 'unknown';\n }\n }\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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AM,CAACoB,SAAS,EAAE;MAC1B,MAAM,IAAIC,KAAK,CAAC,6CAA6C,CAAC;IAChE;IACA;IACA,IAAI,CAACrB,MAAM,CAACoB,SAAS,CAACD,IAAI,GAAGA,IAAI;;IAEjC;IACA,IAAI,CAACG,iBAAiB,EAAE;;IAExB;IACA,IAAI,OAAQ,IAAI,CAACjB,WAAW,CAASkB,uBAAuB,KAAK,WAAW,EAAE;MAC5E;MACA,MAAMC,SAAS,GAAG,IAAK,IAAI,CAACnB,WAAW,CAAS,IAAI,CAACE,WAAW,EAAE,EAAE,IAAI,CAACP,MAAM,CAACoB,SAAS,CAAC;MAC1F,OAAOI,SAAS,CAACN,MAAM,CAACC,IAAI,CAAC;IAC/B;;IAEA;IACA,MAAMK,SAAc,GAAG,IAAI,IAAI,CAACnB,WAAW,CAAC,IAAI,CAACL,MAAM,CAACoB,SAAS,EAAE,IAAI,CAACb,WAAW,EAAE,CAAC;IACtF,MAAMiB,SAAS,CAACC,KAAK,EAAE;IAEvB,OAAOD,SAAS,CAACE,MAAM;EACzB;EAEQJ,iBAAiB,GAAG;IAC1BK,OAAO,CAACC,EAAE,CAAC,SAAS,EAAE,MAAM;MAC1BD,OAAO,CAACE,IAAI,EAAE;IAChB,CAAC,CAAC;IAEFF,OAAO,CAACC,EAAE,CAAC,QAAQ,EAAE,MAAM;MACzBD,OAAO,CAACE,IAAI,EAAE;IAChB,CAAC,CAAC;EACJ;AACF;AAAC"}
1
+ {"version":3,"names":["WebpackDevServer","constructor","config","webpack","webpackDevServer","WebpackAspect","id","WsDevServer","require","getCompiler","version","root","findRoot","packageJsonPath","join","packageJson","err","displayConfig","inspect","depth","listen","port","devServer","Error","addSignalListener","addDevServerEntrypoints","webpackDs","start","server","process","on","exit"],"sources":["webpack.dev-server.ts"],"sourcesContent":["import { join } from 'path';\nimport type { DevServer } from '@teambit/bundler';\nimport findRoot from 'find-root';\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 favicon?: string;\n}\nexport class WebpackDevServer implements DevServer {\n private readonly WsDevServer: typeof WDS;\n constructor(\n private config: WebpackConfigWithDevServer,\n private webpack: typeof webpackCompiler,\n /**\n * path to the webpack-dev-server module or instance of webpack-dev-server.\n * this accept getting an instance for backward compatibility.\n */\n private webpackDevServer: string | typeof WDS\n ) {\n if (typeof this.webpackDevServer === 'string'){\n // eslint-disable-next-line import/no-dynamic-require, global-require\n this.WsDevServer = require(this.webpackDevServer);\n } else {\n this.WsDevServer = this.webpackDevServer;\n }\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 version(): string {\n if (typeof this.webpackDevServer !== 'string') {\n return 'unknown';\n }\n // Resolve version from the webpack-dev-server package.json\n try {\n const root = findRoot(this.webpackDevServer);\n const packageJsonPath = join(root, 'package.json');\n // eslint-disable-next-line import/no-dynamic-require, global-require\n const packageJson = require(packageJsonPath);\n return packageJson.version;\n } catch (err) {\n return 'unknown';\n }\n }\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"],"mappings":";;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMO,MAAMA,gBAAgB,CAAsB;EAEjDC,WAAW,CACDC,MAAkC,EAClCC,OAA+B;EACvC;AACJ;AACA;AACA;EACYC,gBAAqC,EAC7C;IAAA,KAPQF,MAAkC,GAAlCA,MAAkC;IAAA,KAClCC,OAA+B,GAA/BA,OAA+B;IAAA,KAK/BC,gBAAqC,GAArCA,gBAAqC;IAAA;IAAA,4CAc1CC,wBAAa,CAACC,EAAE;IAAA,qDAEP,oBAAoB;IAdhC,IAAI,OAAO,IAAI,CAACF,gBAAgB,KAAK,QAAQ,EAAC;MAC5C;MACA,IAAI,CAACG,WAAW,GAAGC,OAAO,CAAC,IAAI,CAACJ,gBAAgB,CAAC;IACnD,CAAC,MAAM;MACL,IAAI,CAACG,WAAW,GAAG,IAAI,CAACH,gBAAgB;IAC1C;EACF;EAEQK,WAAW,GAAQ;IACzB,OAAO,IAAI,CAACN,OAAO,CAAC,IAAI,CAACD,MAAM,CAAC;EAClC;EAMAQ,OAAO,GAAW;IAChB,IAAI,OAAO,IAAI,CAACN,gBAAgB,KAAK,QAAQ,EAAE;MAC7C,OAAO,SAAS;IAClB;IACA;IACA,IAAI;MACF,MAAMO,IAAI,GAAG,IAAAC,mBAAQ,EAAC,IAAI,CAACR,gBAAgB,CAAC;MAC5C,MAAMS,eAAe,GAAG,IAAAC,YAAI,EAACH,IAAI,EAAE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AAC,CAAC;EACJ;AACF;AAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/webpack",
3
- "version": "0.0.973",
3
+ "version": "0.0.975",
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.973"
9
+ "version": "0.0.975"
10
10
  },
11
11
  "dependencies": {
12
12
  "webpack": "5.51.1",
@@ -48,11 +48,11 @@
48
48
  "@teambit/harmony": "0.4.6",
49
49
  "@teambit/webpack.modules.config-mutator": "0.0.151",
50
50
  "@teambit/bit-error": "0.0.402",
51
- "@teambit/bundler": "0.0.973",
52
- "@teambit/logger": "0.0.746",
53
- "@teambit/cli": "0.0.653",
54
- "@teambit/pubsub": "0.0.973",
55
- "@teambit/workspace": "0.0.973",
51
+ "@teambit/bundler": "0.0.975",
52
+ "@teambit/logger": "0.0.748",
53
+ "@teambit/cli": "0.0.655",
54
+ "@teambit/pubsub": "0.0.975",
55
+ "@teambit/workspace": "0.0.975",
56
56
  "@teambit/webpack.modules.generate-expose-loaders": "0.0.10",
57
57
  "@teambit/webpack.modules.generate-externals": "0.0.11",
58
58
  "@teambit/webpack.plugins.inject-head-webpack-plugin": "0.0.3"
@@ -70,7 +70,7 @@
70
70
  "@types/testing-library__jest-dom": "5.9.5"
71
71
  },
72
72
  "peerDependencies": {
73
- "@teambit/legacy": "1.0.435",
73
+ "@teambit/legacy": "1.0.437",
74
74
  "react": "^16.8.0 || ^17.0.0",
75
75
  "react-dom": "^16.8.0 || ^17.0.0"
76
76
  },