@dotcom-tool-kit/webpack 4.3.3 → 4.4.0

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,4 +1,5 @@
1
1
  import { Task, TaskRunContext } from '@dotcom-tool-kit/base';
2
+ import { ChildProcess } from 'child_process';
2
3
  import * as z from 'zod';
3
4
  declare const WebpackSchema: z.ZodObject<{
4
5
  configPath: z.ZodOptional<z.ZodString>;
@@ -17,6 +18,8 @@ export { WebpackSchema as schema };
17
18
  export default class Webpack extends Task<{
18
19
  task: typeof WebpackSchema;
19
20
  }> {
21
+ child?: ChildProcess;
20
22
  run({ cwd }: TaskRunContext): Promise<void>;
23
+ stop(): Promise<void>;
21
24
  }
22
25
  //# sourceMappingURL=webpack.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../src/tasks/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAG5D,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAIxB,QAAA,MAAM,aAAa;;;;;;;;;;;;EAWuB,CAAA;AAC1C,OAAO,EAAE,aAAa,IAAI,MAAM,EAAE,CAAA;AAElC,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,IAAI,CAAC;IAAE,IAAI,EAAE,OAAO,aAAa,CAAA;CAAE,CAAC;IACjE,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAuBlD"}
1
+ {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../src/tasks/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAQ,MAAM,eAAe,CAAA;AAClD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAIxB,QAAA,MAAM,aAAa;;;;;;;;;;;;EAWuB,CAAA;AAC1C,OAAO,EAAE,aAAa,IAAI,MAAM,EAAE,CAAA;AAElC,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,IAAI,CAAC;IAAE,IAAI,EAAE,OAAO,aAAa,CAAA;CAAE,CAAC;IACvE,KAAK,CAAC,EAAE,YAAY,CAAA;IAEd,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB3C,IAAI;CAMX"}
@@ -21,6 +21,7 @@ const WebpackSchema = z
21
21
  .describe('Bundle code with `webpack`.');
22
22
  exports.schema = WebpackSchema;
23
23
  class Webpack extends base_1.Task {
24
+ child;
24
25
  async run({ cwd }) {
25
26
  this.logger.info('starting Webpack...');
26
27
  const args = ['build', '--color', `--mode=${this.options.envName}`];
@@ -36,9 +37,15 @@ class Webpack extends base_1.Task {
36
37
  // default in OpenSSL 3: https://github.com/webpack/webpack/issues/14532
37
38
  execArgv = [...execArgv, '--openssl-legacy-provider'];
38
39
  }
39
- const child = (0, child_process_1.fork)(webpackCLIPath, args, { silent: true, execArgv, cwd });
40
- (0, logger_1.hookFork)(this.logger, 'webpack', child);
41
- return (0, logger_1.waitOnExit)('webpack', child);
40
+ this.child = (0, child_process_1.fork)(webpackCLIPath, args, { silent: true, execArgv, cwd });
41
+ (0, logger_1.hookFork)(this.logger, 'webpack', this.child);
42
+ return (0, logger_1.waitOnExit)('webpack', this.child);
43
+ }
44
+ async stop() {
45
+ if (this.child && (this.child.exitCode === null || !this.child.killed)) {
46
+ // SIGINT instead of SIGKILL so the process gets chance to exit gracefully
47
+ this.child.kill('SIGINT');
48
+ }
42
49
  }
43
50
  }
44
51
  exports.default = Webpack;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcom-tool-kit/webpack",
3
- "version": "4.3.3",
3
+ "version": "4.4.0",
4
4
  "main": "lib",
5
5
  "description": "",
6
6
  "author": "FT.com Platforms Team <platforms-team.customer-products@ft.com>",
@@ -17,22 +17,21 @@
17
17
  "test": "cd ../../ ; npx jest --silent --projects plugins/webpack"
18
18
  },
19
19
  "dependencies": {
20
- "@dotcom-tool-kit/base": "^1.2.2",
20
+ "@dotcom-tool-kit/base": "^1.3.0",
21
21
  "@dotcom-tool-kit/error": "^4.1.1",
22
- "@dotcom-tool-kit/logger": "^4.2.1",
22
+ "@dotcom-tool-kit/logger": "^4.2.2",
23
23
  "tslib": "^2.8.1",
24
24
  "webpack-cli": "^4.6.0",
25
- "zod": "^3.24.3"
25
+ "zod": "^3.24.4"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "dotcom-tool-kit": "4.x",
29
29
  "webpack": "4.x.x || 5.x.x"
30
30
  },
31
31
  "devDependencies": {
32
- "@jest/globals": "^27.4.6",
33
- "ts-node": "^10.0.0",
34
- "webpack": "^5.99.5",
35
- "winston": "^3.5.1"
32
+ "@jest/globals": "^29.7.0",
33
+ "webpack": "^5.99.9",
34
+ "winston": "^3.17.0"
36
35
  },
37
36
  "files": [
38
37
  "/lib",