@hybridly/vite 0.7.2 → 0.7.4
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 +12 -9
- package/dist/index.mjs +13 -10
- package/package.json +7 -7
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');
|
|
@@ -317,7 +318,7 @@ function generateTsConfig(options, config) {
|
|
|
317
318
|
"../app/**/*",
|
|
318
319
|
"../src/**/*",
|
|
319
320
|
"./php-types.d.ts",
|
|
320
|
-
"./global-
|
|
321
|
+
"./global-properties.d.ts",
|
|
321
322
|
"./routes.d.ts",
|
|
322
323
|
"./components.d.ts",
|
|
323
324
|
"./auto-imports.d.ts",
|
|
@@ -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
|
|
408
|
-
const
|
|
409
|
-
|
|
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
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
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 {
|
|
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';
|
|
@@ -298,7 +299,7 @@ function generateTsConfig(options, config) {
|
|
|
298
299
|
"../app/**/*",
|
|
299
300
|
"../src/**/*",
|
|
300
301
|
"./php-types.d.ts",
|
|
301
|
-
"./global-
|
|
302
|
+
"./global-properties.d.ts",
|
|
302
303
|
"./routes.d.ts",
|
|
303
304
|
"./components.d.ts",
|
|
304
305
|
"./auto-imports.d.ts",
|
|
@@ -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
|
|
389
|
-
const
|
|
390
|
-
|
|
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
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "Vite plugin for Hybridly",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hybridly",
|
|
@@ -48,20 +48,20 @@
|
|
|
48
48
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
49
49
|
"fast-glob": "^3.3.2",
|
|
50
50
|
"local-pkg": "^0.5.0",
|
|
51
|
-
"magic-string": "^0.30.
|
|
51
|
+
"magic-string": "^0.30.10",
|
|
52
52
|
"picocolors": "^1.0.0",
|
|
53
53
|
"throttle-debounce": "^5.0.0",
|
|
54
54
|
"unplugin-auto-import": "^0.17.5",
|
|
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.
|
|
58
|
+
"@hybridly/core": "0.7.4"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@iconify/json": "^2.2.
|
|
62
|
-
"rollup": "^4.
|
|
63
|
-
"vite": "^5.
|
|
64
|
-
"vue": "^3.4.
|
|
61
|
+
"@iconify/json": "^2.2.203",
|
|
62
|
+
"rollup": "^4.16.1",
|
|
63
|
+
"vite": "^5.2.10",
|
|
64
|
+
"vue": "^3.4.23"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|