@joystick.js/cli-canary 0.0.0-canary.61 → 0.0.0-canary.63

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.
@@ -426,12 +426,13 @@ const dev = async (options, { resolve, reject }) => {
426
426
  handleServerProcessSTDIO();
427
427
  handleServerProcessMessages();
428
428
  }
429
- console.log(process.serverProcess);
430
429
  let hmrProcess;
431
430
  if (options?.environment !== "test") {
432
- hmrProcess = await startHMR();
431
+ hmrProcess = await startHMR({
432
+ nodeMajorVersion,
433
+ __dirname
434
+ });
433
435
  }
434
- console.log(process.hmrProcess);
435
436
  handleSignalEvents(
436
437
  [serverProcess.pid, hmrProcess.pid],
437
438
  nodeMajorVersion,
@@ -1,6 +1,6 @@
1
1
  import child_process from "child_process";
2
2
  import path from "path";
3
- const handleStartHMRProcess = (execArgv = {}) => {
3
+ const handleStartHMRProcess = (execArgv = {}, __dirname = "") => {
4
4
  try {
5
5
  return child_process.fork(
6
6
  path.resolve(`${__dirname}/hmrServer.js`),
@@ -33,8 +33,6 @@ const validateOptions = (options) => {
33
33
  throw new Error("options object is required.");
34
34
  if (!options.nodeMajorVersion)
35
35
  throw new Error("options.nodeMajorVersion is required.");
36
- if (!options.port)
37
- throw new Error("options.port is required.");
38
36
  } catch (exception) {
39
37
  throw new Error(`[startHMR.validateOptions] ${exception.message}`);
40
38
  }
@@ -43,7 +41,7 @@ const startHMR = (options, { resolve, reject }) => {
43
41
  try {
44
42
  validateOptions(options);
45
43
  const execArgv = getExecArgs(options?.nodeMajorVersion);
46
- const hmrProcess = handleStartHMRProcess(execArgv);
44
+ const hmrProcess = handleStartHMRProcess(execArgv, options?.__dirname);
47
45
  return resolve(hmrProcess);
48
46
  } catch (exception) {
49
47
  reject(`[startHMR] ${exception.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joystick.js/cli-canary",
3
- "version": "0.0.0-canary.61",
3
+ "version": "0.0.0-canary.63",
4
4
  "type": "module",
5
5
  "description": "CLI for the Joystick JavaScript framework.",
6
6
  "main": "development.js",
@@ -510,17 +510,16 @@ const dev = async (options, { resolve, reject }) => {
510
510
  handleServerProcessMessages();
511
511
  }
512
512
 
513
- console.log(process.serverProcess);
514
-
515
513
  // NOTE: Scope this out here so we can reference the processId below.
516
514
  let hmrProcess;
517
515
 
518
516
  if (options?.environment !== 'test') {
519
- hmrProcess = await startHMR();
517
+ hmrProcess = await startHMR({
518
+ nodeMajorVersion,
519
+ __dirname,
520
+ });
520
521
  }
521
522
 
522
- console.log(process.hmrProcess);
523
-
524
523
  handleSignalEvents(
525
524
  [serverProcess.pid, hmrProcess.pid],
526
525
  nodeMajorVersion,
@@ -1,7 +1,7 @@
1
1
  import child_process from "child_process";
2
2
  import path from "path";
3
3
 
4
- const handleStartHMRProcess = (execArgv = {}) => {
4
+ const handleStartHMRProcess = (execArgv = {}, __dirname = '') => {
5
5
  try {
6
6
  // NOTE: Port is automatically pulled via process.env.PORT
7
7
  // in the hmrServer.js script.
@@ -38,7 +38,6 @@ const validateOptions = (options) => {
38
38
  try {
39
39
  if (!options) throw new Error('options object is required.');
40
40
  if (!options.nodeMajorVersion) throw new Error('options.nodeMajorVersion is required.');
41
- if (!options.port) throw new Error('options.port is required.');
42
41
  } catch (exception) {
43
42
  throw new Error(`[startHMR.validateOptions] ${exception.message}`);
44
43
  }
@@ -49,7 +48,7 @@ const startHMR = (options, { resolve, reject }) => {
49
48
  validateOptions(options);
50
49
 
51
50
  const execArgv = getExecArgs(options?.nodeMajorVersion);
52
- const hmrProcess = handleStartHMRProcess(execArgv);
51
+ const hmrProcess = handleStartHMRProcess(execArgv, options?.__dirname);
53
52
 
54
53
  return resolve(hmrProcess);
55
54
  } catch (exception) {