@hybridly/vite 0.0.1-alpha.6 → 0.0.1-alpha.7
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 +10 -7
- package/dist/index.mjs +10 -7
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -86,17 +86,20 @@ function getClientCode(routes) {
|
|
|
86
86
|
|
|
87
87
|
const shell = node_util.promisify(node_child_process.exec);
|
|
88
88
|
async function fetchRoutesFromArtisan(options) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
try {
|
|
90
|
+
const php = options.php ?? "php";
|
|
91
|
+
const result = await shell(`${php} artisan hybridly:routes`);
|
|
92
|
+
const routes = JSON.parse(result.stdout);
|
|
93
|
+
write(options, routes);
|
|
94
|
+
return routes;
|
|
95
|
+
} catch {
|
|
96
|
+
}
|
|
94
97
|
}
|
|
95
98
|
|
|
96
99
|
const write = throttleDebounce.debounce(1e3, writeDefinitions, { atBegin: true });
|
|
97
100
|
async function writeDefinitions(options, collection) {
|
|
98
101
|
collection ?? (collection = await fetchRoutesFromArtisan(options));
|
|
99
|
-
if (options.dts === false) {
|
|
102
|
+
if (options.dts === false || !collection) {
|
|
100
103
|
return;
|
|
101
104
|
}
|
|
102
105
|
debug.router("Writing types for route collection:", collection);
|
|
@@ -149,7 +152,7 @@ const router = (options = {}) => {
|
|
|
149
152
|
return;
|
|
150
153
|
}
|
|
151
154
|
const routes = await fetchRoutesFromArtisan(resolved);
|
|
152
|
-
if (JSON.stringify(routes) !== JSON.stringify(previousRoutes)) {
|
|
155
|
+
if (routes && JSON.stringify(routes) !== JSON.stringify(previousRoutes)) {
|
|
153
156
|
debug.router("Updating routes via HMR:", routes);
|
|
154
157
|
server.ws.send({
|
|
155
158
|
type: "custom",
|
package/dist/index.mjs
CHANGED
|
@@ -76,17 +76,20 @@ function getClientCode(routes) {
|
|
|
76
76
|
|
|
77
77
|
const shell = promisify(exec);
|
|
78
78
|
async function fetchRoutesFromArtisan(options) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
try {
|
|
80
|
+
const php = options.php ?? "php";
|
|
81
|
+
const result = await shell(`${php} artisan hybridly:routes`);
|
|
82
|
+
const routes = JSON.parse(result.stdout);
|
|
83
|
+
write(options, routes);
|
|
84
|
+
return routes;
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
const write = debounce(1e3, writeDefinitions, { atBegin: true });
|
|
87
90
|
async function writeDefinitions(options, collection) {
|
|
88
91
|
collection ?? (collection = await fetchRoutesFromArtisan(options));
|
|
89
|
-
if (options.dts === false) {
|
|
92
|
+
if (options.dts === false || !collection) {
|
|
90
93
|
return;
|
|
91
94
|
}
|
|
92
95
|
debug.router("Writing types for route collection:", collection);
|
|
@@ -139,7 +142,7 @@ const router = (options = {}) => {
|
|
|
139
142
|
return;
|
|
140
143
|
}
|
|
141
144
|
const routes = await fetchRoutesFromArtisan(resolved);
|
|
142
|
-
if (JSON.stringify(routes) !== JSON.stringify(previousRoutes)) {
|
|
145
|
+
if (routes && JSON.stringify(routes) !== JSON.stringify(previousRoutes)) {
|
|
143
146
|
debug.router("Updating routes via HMR:", routes);
|
|
144
147
|
server.ws.send({
|
|
145
148
|
type: "custom",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hybridly/vite",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.7",
|
|
4
4
|
"description": "A solution to develop server-driven, client-rendered applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hybridly",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"vue": "^3.2.33"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@hybridly/core": "0.0.1-alpha.
|
|
42
|
+
"@hybridly/core": "0.0.1-alpha.7",
|
|
43
43
|
"throttle-debounce": "^5.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|