@jay-framework/stack-route-scanner 0.13.0 → 0.14.0

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.
@@ -1,8 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const fs = require("fs");
4
- const path = require("path");
5
- const logger = require("@jay-framework/logger");
1
+ import { promises } from "fs";
2
+ import path from "path";
3
+ import { getLogger } from "@jay-framework/logger";
6
4
  var JayRouteParamType = /* @__PURE__ */ ((JayRouteParamType2) => {
7
5
  JayRouteParamType2[JayRouteParamType2["single"] = 0] = "single";
8
6
  JayRouteParamType2[JayRouteParamType2["catchAll"] = 1] = "catchAll";
@@ -30,7 +28,7 @@ function convertToRoutePath(BASE_DIR, jayHtmlPath, { jayHtmlFilename, compFilena
30
28
  }
31
29
  async function scanDirectory(BASE_DIR, directory, options) {
32
30
  let routes = [];
33
- const items = await fs.promises.readdir(directory, { withFileTypes: true });
31
+ const items = await promises.readdir(directory, { withFileTypes: true });
34
32
  for (const item of items) {
35
33
  const fullPath = path.join(directory, item.name);
36
34
  if (item.isDirectory()) {
@@ -137,9 +135,9 @@ async function scanRoutes(baseDir, options) {
137
135
  const sortedRoutes = sortRoutesByPriority(routes);
138
136
  const { routes: enrichedRoutes, inferenceLog } = inferParamsForStaticRoutes(sortedRoutes);
139
137
  if (inferenceLog.length > 0) {
140
- logger.getLogger().info("[route-scanner] Inferred params for static override routes:");
138
+ getLogger().info("[route-scanner] Inferred params for static override routes:");
141
139
  for (const entry of inferenceLog) {
142
- logger.getLogger().info(
140
+ getLogger().info(
143
141
  ` ${entry.staticRoute} → params from ${entry.dynamicRoute}: ${JSON.stringify(entry.inferredParams)}`
144
142
  );
145
143
  }
@@ -160,8 +158,10 @@ function routeToExpressRoute(route) {
160
158
  }
161
159
  }).join("/");
162
160
  }
163
- exports.JayRouteParamType = JayRouteParamType;
164
- exports.inferParamsForStaticRoutes = inferParamsForStaticRoutes;
165
- exports.routeToExpressRoute = routeToExpressRoute;
166
- exports.scanRoutes = scanRoutes;
167
- exports.sortRoutesByPriority = sortRoutesByPriority;
161
+ export {
162
+ JayRouteParamType,
163
+ inferParamsForStaticRoutes,
164
+ routeToExpressRoute,
165
+ scanRoutes,
166
+ sortRoutesByPriority
167
+ };
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@jay-framework/stack-route-scanner",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "license": "Apache-2.0",
5
- "main": "dist/index.js",
5
+ "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.mts",
7
7
  "files": [
8
8
  "dist",
9
9
  "readme.md"
10
10
  ],
11
11
  "dependencies": {
12
- "@jay-framework/logger": "^0.13.0"
12
+ "@jay-framework/logger": "^0.14.0"
13
13
  },
14
14
  "scripts": {
15
15
  "build": "npm run build:js && npm run build:types",
@@ -23,7 +23,7 @@
23
23
  "test:watch": "vitest"
24
24
  },
25
25
  "devDependencies": {
26
- "@jay-framework/dev-environment": "^0.13.0",
26
+ "@jay-framework/dev-environment": "^0.14.0",
27
27
  "@types/node": "^20.11.5",
28
28
  "nodemon": "^3.0.3",
29
29
  "replace-in-file": "^7.1.0",