@atls/webpack-start-server-plugin 0.0.3 → 0.0.6

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.
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.StartServerPlugin = void 0;
7
- const child_process_1 = require("child_process");
8
7
  const path_1 = __importDefault(require("path"));
9
- const webpack_1 = __importDefault(require("webpack"));
8
+ const webpack_1 = require("webpack");
9
+ const child_process_1 = require("child_process");
10
10
  class StartServerPlugin {
11
11
  constructor(options = {}) {
12
12
  this.entryFile = null;
@@ -63,13 +63,17 @@ class StartServerPlugin {
63
63
  this.apply = (compiler) => {
64
64
  const plugin = { name: 'StartServerPlugin' };
65
65
  compiler.hooks.make.tap(plugin, (compilation) => {
66
- compilation.addEntry(compilation.compiler.context, webpack_1.default.EntryPlugin.createDependency(this.getMonitor(), {
66
+ compilation.addEntry(compilation.compiler.context, webpack_1.EntryPlugin.createDependency(this.getMonitor(), {
67
67
  name: this.options.entryName,
68
68
  }), this.options.entryName, () => { });
69
69
  });
70
70
  compiler.hooks.afterEmit.tapAsync(plugin, this.afterEmit);
71
71
  };
72
- this.options = Object.assign({ verbose: true, entryName: 'index' }, options);
72
+ this.options = {
73
+ verbose: true,
74
+ entryName: 'index',
75
+ ...options,
76
+ };
73
77
  }
74
78
  getEntryFile(compilation) {
75
79
  const { entryName } = this.options;
@@ -80,7 +84,7 @@ class StartServerPlugin {
80
84
  ? entrypoints.keys()
81
85
  : Object.keys(entrypoints)).join(' ')}`);
82
86
  }
83
- const entryScript = webpack_1.default.EntryPlugin
87
+ const entryScript = webpack_1.EntryPlugin
84
88
  ? entry._runtimeChunk.files.values().next().value
85
89
  : entry.chunks[0].files[0];
86
90
  if (!entryScript) {
@@ -91,7 +95,6 @@ class StartServerPlugin {
91
95
  return path_1.default.resolve(path, entryScript);
92
96
  }
93
97
  runWorker(entryFile, callback) {
94
- var _a, _b;
95
98
  if (this.worker)
96
99
  return;
97
100
  if (this.options.verbose) {
@@ -104,10 +107,10 @@ class StartServerPlugin {
104
107
  worker.once('error', this.handleWorkerError);
105
108
  worker.on('message', this.handleWorkerMessage);
106
109
  if (this.options.stdout) {
107
- (_a = worker.stdout) === null || _a === void 0 ? void 0 : _a.pipe(this.options.stdout, { end: false });
110
+ worker.stdout?.pipe(this.options.stdout, { end: false });
108
111
  }
109
112
  if (this.options.stderr) {
110
- (_b = worker.stderr) === null || _b === void 0 ? void 0 : _b.pipe(this.options.stderr, { end: false });
113
+ worker.stderr?.pipe(this.options.stderr, { end: false });
111
114
  }
112
115
  this.worker = worker;
113
116
  if (this.options.onWorkerStart) {
@@ -117,8 +120,7 @@ class StartServerPlugin {
117
120
  callback();
118
121
  }
119
122
  hmrWorker(compilation, callback) {
120
- var _a;
121
- if ((_a = this.worker) === null || _a === void 0 ? void 0 : _a.send) {
123
+ if (this.worker?.send) {
122
124
  this.worker.send('SSWP_HMR');
123
125
  }
124
126
  else {
package/package.json CHANGED
@@ -1,22 +1,21 @@
1
1
  {
2
2
  "name": "@atls/webpack-start-server-plugin",
3
- "version": "0.0.3",
3
+ "version": "0.0.6",
4
4
  "license": "BSD-3-Clause",
5
5
  "main": "dist/index.js",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
9
9
  "scripts": {
10
- "build": "builder build library",
11
- "postpack": "rm -rf dist",
12
- "prepack": "yarn run build"
13
- },
14
- "devDependencies": {
15
- "@atls/tools-builder": "0.0.0",
16
- "@types/node": "^16.7.10"
10
+ "build": "yarn library build",
11
+ "prepack": "yarn run build",
12
+ "postpack": "rm -rf dist"
17
13
  },
18
14
  "dependencies": {
19
- "webpack": "^5.51.1"
15
+ "webpack": "^5.73.0"
16
+ },
17
+ "devDependencies": {
18
+ "@types/node": "^17.0.38"
20
19
  },
21
20
  "publishConfig": {
22
21
  "access": "public",