nvent 1.0.0-alpha.8 → 1.0.0-alpha.9

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/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nvent",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0-alpha.9",
4
4
  "configKey": "nvent",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
package/dist/module.mjs CHANGED
@@ -1133,6 +1133,26 @@ function mapPubSubAdapter(a) {
1133
1133
  return { name: "local" };
1134
1134
  }
1135
1135
 
1136
+ function resolveExtendedFunctionAbsPath(absPath) {
1137
+ if (existsSync(absPath)) {
1138
+ return { absPath };
1139
+ }
1140
+ if (!absPath.endsWith(".ts")) {
1141
+ return { absPath };
1142
+ }
1143
+ const base = absPath.slice(0, -3);
1144
+ for (const ext of [".js", ".mjs", ".cjs"]) {
1145
+ const candidate = `${base}${ext}`;
1146
+ if (existsSync(candidate)) {
1147
+ return {
1148
+ absPath: candidate,
1149
+ rewrittenFrom: absPath
1150
+ };
1151
+ }
1152
+ }
1153
+ return { absPath };
1154
+ }
1155
+
1136
1156
  function filePathToFunctionId(relPath) {
1137
1157
  const noExt = relPath.replace(/\.[a-zA-Z]+$/, "");
1138
1158
  return noExt.split(/[\\/]/).join("::");
@@ -1386,11 +1406,15 @@ const module$1 = defineNuxtModule({
1386
1406
  console.warn(`[nvent] skipping extended TS function '${fn.id}' (duplicate id)`);
1387
1407
  continue;
1388
1408
  }
1389
- const absPath = normalizePath(fn.absPath);
1409
+ const requestedPath = normalizePath(fn.absPath);
1410
+ const resolvedPath = resolveExtendedFunctionAbsPath(requestedPath);
1411
+ if (resolvedPath.rewrittenFrom) {
1412
+ console.warn(`[nvent] extended TS function path rewritten for '${fn.id}': ${resolvedPath.rewrittenFrom} -> ${resolvedPath.absPath}`);
1413
+ }
1390
1414
  scanned.functions.push({
1391
1415
  id: fn.id,
1392
- absPath,
1393
- relativePath: basename(absPath),
1416
+ absPath: resolvedPath.absPath,
1417
+ relativePath: basename(resolvedPath.absPath),
1394
1418
  description: fn.description
1395
1419
  });
1396
1420
  seenTs.add(fn.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nvent",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0-alpha.9",
4
4
  "description": "Event-driven workflows for Nuxt",
5
5
  "repository": "nhealthorg/nvent",
6
6
  "license": "MIT",