@hybridly/vite 0.7.2 → 0.7.3

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.cjs CHANGED
@@ -11,6 +11,7 @@ const os = require('node:os');
11
11
  const makeDebugger = require('debug');
12
12
  const localPkg = require('local-pkg');
13
13
  const node_child_process = require('node:child_process');
14
+ const node_util = require('node:util');
14
15
  const MagicString = require('magic-string');
15
16
  const run = require('vite-plugin-run');
16
17
  const utils = require('@hybridly/utils');
@@ -402,11 +403,13 @@ function write(data, filename) {
402
403
  });
403
404
  }
404
405
 
406
+ const execSync = node_util.promisify(node_child_process.exec);
405
407
  async function loadConfiguration() {
406
408
  try {
407
- const php = process.env.PHP_EXECUTABLE_PATH ?? "php";
408
- const stdout = node_child_process.execSync(`${php} artisan hybridly:config`);
409
- return JSON.parse(stdout.toString("utf-8"));
409
+ const env = { ...process.env, ...vite.loadEnv("mock", process.cwd(), "") };
410
+ const php = env.PHP_EXECUTABLE_PATH ?? "php";
411
+ const { stdout } = await execSync(`${php} artisan hybridly:config`);
412
+ return JSON.parse(stdout);
410
413
  } catch (e) {
411
414
  console.error("Could not load configuration from [php artisan].");
412
415
  throw e;
@@ -467,11 +470,11 @@ const initialize = (options, config) => {
467
470
  return await forceRestart("Routing changed");
468
471
  }
469
472
  if (/.*\.vue$/.test(file)) {
470
- const updatedConfig = await loadConfiguration();
471
- const viewsOrLayoutsChanged = didViewsOrLayoutsChange(updatedConfig, config);
472
- if (viewsOrLayoutsChanged) {
473
- return await forceRestart("View or layout changed");
474
- }
473
+ loadConfiguration().then((updatedConfig) => {
474
+ if (didViewsOrLayoutsChange(updatedConfig, config)) {
475
+ forceRestart("View or layout changed");
476
+ }
477
+ });
475
478
  }
476
479
  }
477
480
  server.watcher.on("add", handleFileChange);
package/dist/index.mjs CHANGED
@@ -6,7 +6,8 @@ import 'node:url';
6
6
  import os from 'node:os';
7
7
  import makeDebugger from 'debug';
8
8
  import { isPackageExists, resolveModule, importModule } from 'local-pkg';
9
- import { execSync } from 'node:child_process';
9
+ import { exec } from 'node:child_process';
10
+ import { promisify } from 'node:util';
10
11
  import MagicString from 'magic-string';
11
12
  import run from 'vite-plugin-run';
12
13
  import { merge } from '@hybridly/utils';
@@ -383,11 +384,13 @@ function write(data, filename) {
383
384
  });
384
385
  }
385
386
 
387
+ const execSync = promisify(exec);
386
388
  async function loadConfiguration() {
387
389
  try {
388
- const php = process.env.PHP_EXECUTABLE_PATH ?? "php";
389
- const stdout = execSync(`${php} artisan hybridly:config`);
390
- return JSON.parse(stdout.toString("utf-8"));
390
+ const env = { ...process.env, ...loadEnv("mock", process.cwd(), "") };
391
+ const php = env.PHP_EXECUTABLE_PATH ?? "php";
392
+ const { stdout } = await execSync(`${php} artisan hybridly:config`);
393
+ return JSON.parse(stdout);
391
394
  } catch (e) {
392
395
  console.error("Could not load configuration from [php artisan].");
393
396
  throw e;
@@ -448,11 +451,11 @@ const initialize = (options, config) => {
448
451
  return await forceRestart("Routing changed");
449
452
  }
450
453
  if (/.*\.vue$/.test(file)) {
451
- const updatedConfig = await loadConfiguration();
452
- const viewsOrLayoutsChanged = didViewsOrLayoutsChange(updatedConfig, config);
453
- if (viewsOrLayoutsChanged) {
454
- return await forceRestart("View or layout changed");
455
- }
454
+ loadConfiguration().then((updatedConfig) => {
455
+ if (didViewsOrLayoutsChange(updatedConfig, config)) {
456
+ forceRestart("View or layout changed");
457
+ }
458
+ });
456
459
  }
457
460
  }
458
461
  server.watcher.on("add", handleFileChange);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hybridly/vite",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Vite plugin for Hybridly",
5
5
  "keywords": [
6
6
  "hybridly",
@@ -55,12 +55,12 @@
55
55
  "unplugin-icons": "^0.18.5",
56
56
  "unplugin-vue-components": "^0.26.0",
57
57
  "vite-plugin-run": "^0.5.1",
58
- "@hybridly/core": "0.7.2"
58
+ "@hybridly/core": "0.7.3"
59
59
  },
60
60
  "devDependencies": {
61
- "@iconify/json": "^2.2.191",
61
+ "@iconify/json": "^2.2.196",
62
62
  "rollup": "^4.13.0",
63
- "vite": "^5.1.6",
63
+ "vite": "^5.1.7",
64
64
  "vue": "^3.4.21"
65
65
  },
66
66
  "scripts": {