@atls/webpack-start-server-plugin 1.0.0 → 1.0.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+
2
+
3
+ ## 1.0.2 (2025-01-30)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+
9
+ * **common:** yarn check ([#485](https://github.com/atls/raijin/issues/485)) ([b0c3cfa](https://github.com/atls/raijin/commit/b0c3cfad8f559c55691ca733c7a3a7b3cd00c4d8))
10
+ * **plugin-service:** build and dev commands ([e4af7f4](https://github.com/atls/raijin/commit/e4af7f441c1b1e8c5bc6779c83b2ed44b21894c9))
11
+ * typecheck ([27ccb0e](https://github.com/atls/raijin/commit/27ccb0ef63898afd00b830952914e060b8dd5593))
12
+
13
+ ### Features
14
+
15
+
16
+ * **common:** bump to minor ([775c630](https://github.com/atls/raijin/commit/775c630061f91970a65e34afabeea8d029e02176))
17
+ * **common:** finalize cli & webpack, update yarn workspace ([0f2736c](https://github.com/atls/raijin/commit/0f2736c6d37f8141a1a50c352bf80d7ffb2f4ea7))
18
+ * init code-runtime, WIP for yrnpkg 3v downgrading ([587d7dc](https://github.com/atls/raijin/commit/587d7dc75c6b08c2a4b0a0b4bf380939de83a6c3))
19
+ * remove @atls/builder, init cli-ui-schematics ([9a89280](https://github.com/atls/raijin/commit/9a892802fc3571f5ca46da67dcd10dcdc016e476))
20
+ * remove repository field, add cli & webpack utilities ([f47613e](https://github.com/atls/raijin/commit/f47613e9784e9eea86ed98e712198b000ca5766d))
21
+ * update common deps ([b5098e8](https://github.com/atls/raijin/commit/b5098e843c0153a476c16ae8607ba2b598accb60))
22
+ * update deps ([de29dbf](https://github.com/atls/raijin/commit/de29dbffcc0c1b9cf081825987e733352b1761a7))
23
+ * webpack ([5aa84f0](https://github.com/atls/raijin/commit/5aa84f00d53a91cf591afeba1176439fabe023ff))
24
+ * webpack to ecma modules, bump types/node ([fc27beb](https://github.com/atls/raijin/commit/fc27beb5ea6ad5431fa335c294191e933392b6d6))
25
+ * **webpack:** add localtunnel & server starter plugin ([400a7d3](https://github.com/atls/raijin/commit/400a7d373261e12f6cd134ac5254b840af66351e))
26
+ * **webpack:** bump, andd proto loader ([#463](https://github.com/atls/raijin/issues/463)) ([d2ab540](https://github.com/atls/raijin/commit/d2ab540602c9009f42d15c7e9f0d48ce049d8ac1))
27
+ * yarn tests utils ([3e5d057](https://github.com/atls/raijin/commit/3e5d057d79b1967e20f51fec5a8ff650f2d7037b))
28
+ * **yarn:** essentials, renderer, tools, types, ui ([e683746](https://github.com/atls/raijin/commit/e683746e203e1d8486c1f4d92d9d9d8f785f84ee))
29
+ * **yarn:** workspace utils ([ffc200d](https://github.com/atls/raijin/commit/ffc200d0f0cf6444fe9053a7f046a5d039f79177))
30
+
31
+
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import type { Writable } from 'node:stream';
3
2
  export interface StartServerLoggerOptions {
4
3
  stdout?: Writable;
@@ -1,4 +1,5 @@
1
1
  export class StartServerLogger {
2
+ options;
2
3
  constructor(options = {}) {
3
4
  this.options = options;
4
5
  }
@@ -1,5 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
1
  import type { ChildProcess } from 'node:child_process';
4
2
  import type { Writable } from 'node:stream';
5
3
  import type webpack from 'webpack';
@@ -15,7 +13,7 @@ export declare class StartServerPlugin {
15
13
  initialized: boolean;
16
14
  logger: StartServerLogger;
17
15
  constructor(options?: Partial<StartServerPluginOptions>);
18
- apply: (compiler: webpack.Compiler) => void;
16
+ apply(compiler: webpack.Compiler): void;
19
17
  private afterEmit;
20
18
  private startServer;
21
19
  private runWorker;
@@ -2,36 +2,41 @@ import { fork } from 'node:child_process';
2
2
  import { join } from 'node:path';
3
3
  import { StartServerLogger } from './start-server.logger.js';
4
4
  export class StartServerPlugin {
5
+ options;
6
+ entryFile = null;
7
+ worker = null;
8
+ initialized = false;
9
+ logger;
5
10
  constructor(options = {}) {
6
- this.entryFile = null;
7
- this.worker = null;
8
- this.initialized = false;
9
- this.apply = (compiler) => {
10
- compiler.hooks.afterEmit.tapAsync({ name: 'StartServerPlugin' }, this.afterEmit);
11
- };
12
- this.afterEmit = (compilation, callback) => {
13
- if (!this.initialized) {
14
- this.initialized = true;
15
- callback();
16
- }
17
- else {
18
- if (this.worker?.connected && this.worker.pid) {
19
- process.kill(this.worker.pid);
20
- }
21
- this.startServer(compilation, callback);
11
+ this.logger = new StartServerLogger(options);
12
+ this.options = options;
13
+ }
14
+ apply(compiler) {
15
+ compiler.hooks.afterEmit.tapAsync({ name: 'StartServerPlugin' }, this.afterEmit);
16
+ }
17
+ afterEmit = (compilation, callback) => {
18
+ if (!this.initialized) {
19
+ this.initialized = true;
20
+ callback();
21
+ }
22
+ else {
23
+ if (this.worker?.connected && this.worker.pid) {
24
+ process.kill(this.worker.pid);
22
25
  }
23
- };
24
- this.startServer = (compilation, callback) => {
25
- this.logger.info('Starting server...');
26
- this.entryFile = join(compilation.compiler.options.output.path, 'index.js');
26
+ this.startServer(compilation, callback);
27
+ }
28
+ };
29
+ startServer = (compilation, callback) => {
30
+ this.logger.info('Starting server...');
31
+ const { path } = compilation.compiler.options.output;
32
+ if (path) {
33
+ this.entryFile = join(path, 'index.js');
27
34
  this.runWorker(this.entryFile, (worker) => {
28
35
  this.worker = worker;
29
36
  callback();
30
37
  });
31
- };
32
- this.logger = new StartServerLogger(options);
33
- this.options = options;
34
- }
38
+ }
39
+ };
35
40
  runWorker(entryFile, callback) {
36
41
  const worker = fork(entryFile, [], {
37
42
  silent: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atls/webpack-start-server-plugin",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "license": "BSD-3-Clause",
5
5
  "type": "module",
6
6
  "exports": {
@@ -21,10 +21,10 @@
21
21
  "postpack": "rm -rf dist"
22
22
  },
23
23
  "dependencies": {
24
- "webpack": "^5.88.1"
24
+ "webpack": "5.97.1"
25
25
  },
26
26
  "devDependencies": {
27
- "@types/node": "^20.14.9"
27
+ "@types/node": "22.9.0"
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public",