@adonisjs/assembler 8.0.0-next.16 → 8.0.0-next.17
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.
|
@@ -297,7 +297,7 @@ var RoutesScanner = class {
|
|
|
297
297
|
*/
|
|
298
298
|
#processRouteWithoutController(route) {
|
|
299
299
|
if (!route.name) {
|
|
300
|
-
debug_default(`skipping route "%s" as it does not have a name`, route.
|
|
300
|
+
debug_default(`skipping route "%s" as it does not have a name`, route.pattern);
|
|
301
301
|
return;
|
|
302
302
|
}
|
|
303
303
|
const scannedRoute = {
|
|
@@ -316,7 +316,7 @@ var RoutesScanner = class {
|
|
|
316
316
|
* Scans a route that is using a controller reference
|
|
317
317
|
*/
|
|
318
318
|
async #processRouteWithController(route, vfs) {
|
|
319
|
-
if (!route.handler.importExpression) {
|
|
319
|
+
if (!route.handler || !route.handler.importExpression) {
|
|
320
320
|
return this.#processRouteWithoutController(route);
|
|
321
321
|
}
|
|
322
322
|
const controller = await this.#inspectControllerSpecifier(
|
package/build/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-YFDLKKOA.js";
|
|
5
5
|
import {
|
|
6
6
|
RoutesScanner
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RSWZKA6F.js";
|
|
8
8
|
import "./chunk-TIKQQRMX.js";
|
|
9
9
|
import {
|
|
10
10
|
VirtualFileSystem,
|
|
@@ -931,9 +931,14 @@ var DevServer = class _DevServer {
|
|
|
931
931
|
if (!this.#routesScanner) {
|
|
932
932
|
return;
|
|
933
933
|
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
934
|
+
try {
|
|
935
|
+
const invalidated = await this.#routesScanner.invalidate(filePath);
|
|
936
|
+
if (invalidated) {
|
|
937
|
+
await this.#hooks.runner("routesScanned").run(this, this.#routesScanner);
|
|
938
|
+
}
|
|
939
|
+
} catch (error) {
|
|
940
|
+
this.ui.logger.error("Unable to rescan routes because of the following error");
|
|
941
|
+
this.ui.logger.fatal(error);
|
|
937
942
|
}
|
|
938
943
|
}
|
|
939
944
|
/**
|
|
@@ -953,27 +958,32 @@ var DevServer = class _DevServer {
|
|
|
953
958
|
* })
|
|
954
959
|
*/
|
|
955
960
|
#processRoutes = throttle(async (routesFileLocation) => {
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
961
|
+
try {
|
|
962
|
+
const scanRoutes = this.#hooks.has("routesScanning") || this.#hooks.has("routesScanned");
|
|
963
|
+
const shareRoutes = this.#hooks.has("routesCommitted");
|
|
964
|
+
if (!scanRoutes && !shareRoutes) {
|
|
965
|
+
unlink(routesFileLocation).catch(() => {
|
|
966
|
+
});
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
const routesJSON = await readFile(routesFileLocation, "utf-8");
|
|
970
|
+
const routesList = JSON.parse(routesJSON);
|
|
959
971
|
unlink(routesFileLocation).catch(() => {
|
|
960
972
|
});
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
const routesJSON = await readFile(routesFileLocation, "utf-8");
|
|
964
|
-
const routesList = JSON.parse(routesJSON);
|
|
965
|
-
unlink(routesFileLocation).catch(() => {
|
|
966
|
-
});
|
|
967
|
-
if (shareRoutes) {
|
|
968
|
-
await this.#hooks.runner("routesCommitted").run(this, routesList);
|
|
969
|
-
}
|
|
970
|
-
if (scanRoutes) {
|
|
971
|
-
this.#routesScanner = new RoutesScanner(this.cwdPath, []);
|
|
972
|
-
await this.#hooks.runner("routesScanning").run(this, this.#routesScanner);
|
|
973
|
-
for (const domain of Object.keys(routesList)) {
|
|
974
|
-
await this.#routesScanner.scan(routesList[domain]);
|
|
973
|
+
if (shareRoutes) {
|
|
974
|
+
await this.#hooks.runner("routesCommitted").run(this, routesList);
|
|
975
975
|
}
|
|
976
|
-
|
|
976
|
+
if (scanRoutes) {
|
|
977
|
+
this.#routesScanner = new RoutesScanner(this.cwdPath, []);
|
|
978
|
+
await this.#hooks.runner("routesScanning").run(this, this.#routesScanner);
|
|
979
|
+
for (const domain of Object.keys(routesList)) {
|
|
980
|
+
await this.#routesScanner.scan(routesList[domain]);
|
|
981
|
+
}
|
|
982
|
+
await this.#hooks.runner("routesScanned").run(this, this.#routesScanner);
|
|
983
|
+
}
|
|
984
|
+
} catch (error) {
|
|
985
|
+
this.ui.logger.error("Unable to process and scan routes because of the following error");
|
|
986
|
+
this.ui.logger.fatal(error);
|
|
977
987
|
}
|
|
978
988
|
}, "processRoutes");
|
|
979
989
|
/**
|
package/package.json
CHANGED