@adonisjs/assembler 8.0.0-next.29 → 8.0.0-next.30

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/build/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as loadHooks, c as readTsConfig, d as runNode, f as throttle, m as debug_default, n as copyFiles, o as memoize, p as watch, r as getPort, s as parseConfig, t as VirtualFileSystem, u as run } from "./virtual_file_system-bGeoWsK-.js";
2
- import { n as FileBuffer, t as IndexGenerator } from "./main-XUXlmlEy.js";
2
+ import { n as FileBuffer, t as IndexGenerator } from "./main-CknPN3rJ.js";
3
3
  import { t as RoutesScanner } from "./main-BeV45LeF.js";
4
4
  import "./helpers-DDurYRsZ.js";
5
5
  import { t as CodemodException } from "./codemod_exception-vyN1VXuX.js";
@@ -10,6 +10,7 @@ import { fileURLToPath } from "node:url";
10
10
  import string from "@poppinss/utils/string";
11
11
  import { join, relative } from "node:path/posix";
12
12
  import { detectPackageManager } from "@antfu/install-pkg";
13
+ import getRandomPort from "get-port";
13
14
  import picomatch from "picomatch";
14
15
  import prettyHrtime from "pretty-hrtime";
15
16
  import { RuntimeException } from "@poppinss/utils/exception";
@@ -355,6 +356,7 @@ var DevServer = class DevServer {
355
356
  #onError;
356
357
  #onClose;
357
358
  #stickyPort;
359
+ #stickyHmrPort;
358
360
  #mode = "static";
359
361
  #watcher;
360
362
  #httpServer;
@@ -370,7 +372,7 @@ var DevServer = class DevServer {
370
372
  this.#httpServer.removeAllListeners();
371
373
  this.#httpServer.kill("SIGKILL");
372
374
  }
373
- await this.#startHTTPServer(this.#stickyPort);
375
+ await this.#startHTTPServer(this.#stickyPort, this.#stickyHmrPort);
374
376
  }, "restartHTTPServer");
375
377
  #setupKeyboardShortcuts() {
376
378
  this.#shortcutsManager = new ShortcutsManager({
@@ -554,6 +556,7 @@ var DevServer = class DevServer {
554
556
  this.ui.logger.info(`starting server in ${this.#mode} mode...`);
555
557
  this.#indexGenerator = new IndexGenerator(this.cwdPath, this.ui.logger);
556
558
  this.#stickyPort = String(await getPort(this.cwd));
559
+ this.#stickyHmrPort = String(getRandomPort({ port: 24678 }));
557
560
  this.#fileSystem = new FileSystem(this.cwdPath, tsConfig, this.options);
558
561
  this.ui.logger.info("loading hooks...");
559
562
  this.#hooks = await loadHooks(this.options.hooks, [
@@ -575,7 +578,7 @@ var DevServer = class DevServer {
575
578
  await this.#indexGenerator.generate();
576
579
  return true;
577
580
  }
578
- async #startHTTPServer(port) {
581
+ async #startHTTPServer(port, hmrPort) {
579
582
  await this.#hooks.runner("devServerStarting").run(this);
580
583
  debug_default("starting http server using \"%s\" file, options %O", this.scriptFile, this.options);
581
584
  return new Promise((resolve) => {
@@ -583,6 +586,8 @@ var DevServer = class DevServer {
583
586
  script: this.scriptFile,
584
587
  env: {
585
588
  PORT: port,
589
+ VITE_HMR_PORT: hmrPort,
590
+ DEV_MODE: "true",
586
591
  ...this.options.env
587
592
  },
588
593
  nodeArgs: this.options.nodeArgs,
@@ -650,7 +655,7 @@ var DevServer = class DevServer {
650
655
  };
651
656
  }
652
657
  this.ui.logger.info("starting HTTP server...");
653
- await this.#startHTTPServer(this.#stickyPort);
658
+ await this.#startHTTPServer(this.#stickyPort, this.#stickyHmrPort);
654
659
  if (this.#mode !== "hmr") return;
655
660
  this.#watcher = this.#createWatcher();
656
661
  this.#watcher.on("add", (filePath) => {
@@ -678,7 +683,7 @@ var DevServer = class DevServer {
678
683
  async startAndWatch(options) {
679
684
  if (!await this.#init("watch")) return;
680
685
  this.ui.logger.info("starting HTTP server...");
681
- await this.#startHTTPServer(this.#stickyPort);
686
+ await this.#startHTTPServer(this.#stickyPort, this.#stickyHmrPort);
682
687
  this.#watcher = this.#createWatcher({ poll: options?.poll });
683
688
  this.#watcher.on("add", (filePath) => {
684
689
  const relativePath = string.toUnixSlash(filePath);
@@ -701,6 +706,7 @@ var TestRunner = class {
701
706
  #onError;
702
707
  #onClose;
703
708
  #stickyPort;
709
+ #stickyHmrPort;
704
710
  #watcher;
705
711
  #testsProcess;
706
712
  #fileSystem;
@@ -712,7 +718,7 @@ var TestRunner = class {
712
718
  this.#testsProcess.removeAllListeners();
713
719
  this.#testsProcess.kill("SIGKILL");
714
720
  }
715
- await this.#runTests(this.#stickyPort, filters);
721
+ await this.#runTests(this.#stickyPort, this.#stickyHmrPort, filters);
716
722
  }, "reRunTests");
717
723
  scriptFile = "bin/test.ts";
718
724
  cwd;
@@ -764,7 +770,7 @@ var TestRunner = class {
764
770
  #clearScreen() {
765
771
  if (this.options.clearScreen) process.stdout.write("\x1Bc");
766
772
  }
767
- async #runTests(port, filters) {
773
+ async #runTests(port, hmrPort, filters) {
768
774
  await this.#hooks.runner("testsStarting").run(this);
769
775
  debug_default("running tests using \"%s\" file, options %O", this.scriptFile, this.options);
770
776
  return new Promise(async (resolve) => {
@@ -782,6 +788,7 @@ var TestRunner = class {
782
788
  reject: true,
783
789
  env: {
784
790
  PORT: port,
791
+ VITE_HMR_PORT: hmrPort,
785
792
  ...this.options.env
786
793
  },
787
794
  nodeArgs: this.options.nodeArgs,
@@ -848,6 +855,7 @@ var TestRunner = class {
848
855
  }
849
856
  async run() {
850
857
  this.#stickyPort = String(await getPort(this.cwd));
858
+ this.#stickyHmrPort = String(getRandomPort({ port: 24678 }));
851
859
  this.#indexGenerator = new IndexGenerator(this.cwdPath, this.ui.logger);
852
860
  this.#clearScreen();
853
861
  this.ui.logger.info("loading hooks...");
@@ -861,7 +869,7 @@ var TestRunner = class {
861
869
  this.ui.logger.info("generating indexes...");
862
870
  await this.#indexGenerator.generate();
863
871
  this.ui.logger.info("booting application to run tests...");
864
- await this.#runTests(this.#stickyPort);
872
+ await this.#runTests(this.#stickyPort, this.#stickyHmrPort);
865
873
  }
866
874
  async runAndWatch(options) {
867
875
  const tsConfig = readTsConfig(this.cwdPath);
@@ -870,6 +878,7 @@ var TestRunner = class {
870
878
  return;
871
879
  }
872
880
  this.#stickyPort = String(await getPort(this.cwd));
881
+ this.#stickyHmrPort = String(getRandomPort({ port: 24678 }));
873
882
  this.#indexGenerator = new IndexGenerator(this.cwdPath, this.ui.logger);
874
883
  this.#fileSystem = new FileSystem(this.cwdPath, tsConfig, {
875
884
  ...this.options,
@@ -894,7 +903,7 @@ var TestRunner = class {
894
903
  this.ui.logger.info("generating indexes...");
895
904
  await this.#indexGenerator.generate();
896
905
  this.ui.logger.info("booting application to run tests...");
897
- await this.#runTests(this.#stickyPort);
906
+ await this.#runTests(this.#stickyPort, this.#stickyHmrPort);
898
907
  this.#watcher = watch({
899
908
  usePolling: options?.poll ?? false,
900
909
  cwd: this.cwdPath,
@@ -154,10 +154,9 @@ var IndexGeneratorSource = class {
154
154
  }
155
155
  }
156
156
  async generate() {
157
- const startTime = process.hrtime();
157
+ debug_default("generating \"%s\" index", this.name);
158
158
  await this.#vfs.scan();
159
159
  await this.#generateOutput();
160
- this.#logCreation(startTime);
161
160
  }
162
161
  };
163
162
  var IndexGenerator = class {
@@ -183,6 +182,7 @@ var IndexGenerator = class {
183
182
  async generate() {
184
183
  const sources = Object.values(this.#sources);
185
184
  for (let source of sources) await source.generate();
185
+ if (sources.length) this.#cliLogger.info(`codegen: created ${sources.length} file(s)`);
186
186
  }
187
187
  };
188
188
  export { FileBuffer as n, IndexGenerator as t };
@@ -1,3 +1,3 @@
1
1
  import "../../virtual_file_system-bGeoWsK-.js";
2
- import { t as IndexGenerator } from "../../main-XUXlmlEy.js";
2
+ import { t as IndexGenerator } from "../../main-CknPN3rJ.js";
3
3
  export { IndexGenerator };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adonisjs/assembler",
3
3
  "description": "Provides utilities to run AdonisJS development server and build project for production",
4
- "version": "8.0.0-next.29",
4
+ "version": "8.0.0-next.30",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },
@@ -46,7 +46,7 @@
46
46
  "@japa/snapshot": "^2.0.10",
47
47
  "@poppinss/ts-exec": "^1.4.1",
48
48
  "@release-it/conventional-changelog": "^10.0.4",
49
- "@types/node": "^25.0.3",
49
+ "@types/node": "^25.0.5",
50
50
  "@types/picomatch": "^4.0.2",
51
51
  "@types/pretty-hrtime": "^1.0.3",
52
52
  "c8": "^10.1.3",
@@ -56,15 +56,15 @@
56
56
  "hot-hook": "^0.4.1-next.2",
57
57
  "p-event": "^7.0.2",
58
58
  "prettier": "^3.7.4",
59
- "release-it": "^19.2.2",
60
- "tsdown": "^0.18.4",
59
+ "release-it": "^19.2.3",
60
+ "tsdown": "^0.19.0",
61
61
  "typedoc": "^0.28.15",
62
62
  "typescript": "^5.9.3"
63
63
  },
64
64
  "dependencies": {
65
65
  "@adonisjs/env": "^7.0.0-next.3",
66
66
  "@antfu/install-pkg": "^1.1.0",
67
- "@ast-grep/napi": "^0.40.3",
67
+ "@ast-grep/napi": "^0.40.4",
68
68
  "@poppinss/cliui": "^6.6.0",
69
69
  "@poppinss/hooks": "^7.3.0",
70
70
  "@poppinss/utils": "^7.0.0-next.5",