@elench/next-analysis 0.1.109

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.
Files changed (49) hide show
  1. package/dist/api-routes.d.ts +7 -0
  2. package/dist/api-routes.d.ts.map +1 -0
  3. package/dist/api-routes.js +66 -0
  4. package/dist/api-routes.js.map +1 -0
  5. package/dist/app-root.d.ts +2 -0
  6. package/dist/app-root.d.ts.map +1 -0
  7. package/dist/app-root.js +7 -0
  8. package/dist/app-root.js.map +1 -0
  9. package/dist/backend-links.d.ts +8 -0
  10. package/dist/backend-links.d.ts.map +1 -0
  11. package/dist/backend-links.js +30 -0
  12. package/dist/backend-links.js.map +1 -0
  13. package/dist/index.d.ts +11 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +10 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/pages.d.ts +7 -0
  18. package/dist/pages.d.ts.map +1 -0
  19. package/dist/pages.js +47 -0
  20. package/dist/pages.js.map +1 -0
  21. package/dist/project.d.ts +4 -0
  22. package/dist/project.d.ts.map +1 -0
  23. package/dist/project.js +188 -0
  24. package/dist/project.js.map +1 -0
  25. package/dist/route-tree.d.ts +7 -0
  26. package/dist/route-tree.d.ts.map +1 -0
  27. package/dist/route-tree.js +575 -0
  28. package/dist/route-tree.js.map +1 -0
  29. package/dist/routes.d.ts +6 -0
  30. package/dist/routes.d.ts.map +1 -0
  31. package/dist/routes.js +41 -0
  32. package/dist/routes.js.map +1 -0
  33. package/dist/server-actions.d.ts +7 -0
  34. package/dist/server-actions.d.ts.map +1 -0
  35. package/dist/server-actions.js +37 -0
  36. package/dist/server-actions.js.map +1 -0
  37. package/dist/shared.d.ts +57 -0
  38. package/dist/shared.d.ts.map +1 -0
  39. package/dist/shared.js +229 -0
  40. package/dist/shared.js.map +1 -0
  41. package/dist/swc.d.ts +53 -0
  42. package/dist/swc.d.ts.map +1 -0
  43. package/dist/swc.js +387 -0
  44. package/dist/swc.js.map +1 -0
  45. package/dist/types.d.ts +132 -0
  46. package/dist/types.d.ts.map +1 -0
  47. package/dist/types.js +2 -0
  48. package/dist/types.js.map +1 -0
  49. package/package.json +27 -0
@@ -0,0 +1,7 @@
1
+ import type { NextApiRouteEntry } from "./types.js";
2
+ export declare function discoverApiRoutes({ rootDir, appRoot, exclude }: {
3
+ rootDir: string;
4
+ appRoot: string;
5
+ exclude?: string[];
6
+ }): NextApiRouteEntry[];
7
+ //# sourceMappingURL=api-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-routes.d.ts","sourceRoot":"","sources":["../src/api-routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAcpD,wBAAgB,iBAAiB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAY,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,iBAAiB,EAAE,CAqCnJ"}
@@ -0,0 +1,66 @@
1
+ import * as path from "node:path";
2
+ import { extractBackendRefs } from "./backend-links.js";
3
+ import { routeFromApiFile } from "./routes.js";
4
+ import { directoryExists, HTTP_METHODS, isRouteHandlerFile, normalizePath, readFileIfExists, toApiRequestPath, walkFiles, } from "./shared.js";
5
+ import { parseModule } from "./swc.js";
6
+ export function discoverApiRoutes({ rootDir, appRoot, exclude = [] }) {
7
+ const apiRoot = path.join(appRoot, "api");
8
+ if (!directoryExists(apiRoot))
9
+ return [];
10
+ const routeFiles = walkFiles(apiRoot, { baseDir: rootDir, exclude }).filter(isRouteHandlerFile);
11
+ const entries = [];
12
+ for (const absolutePath of routeFiles) {
13
+ const filePath = normalizePath(path.relative(rootDir, absolutePath));
14
+ const route = routeFromApiFile(appRoot, absolutePath);
15
+ const requestPath = toApiRequestPath(route);
16
+ const content = readFileIfExists(absolutePath);
17
+ if (!content)
18
+ continue;
19
+ const ast = parseModule(content, filePath);
20
+ const backendRefs = extractBackendRefs({
21
+ ast,
22
+ rootDir,
23
+ filePath,
24
+ readSourceFile: (targetPath) => readFileIfExists(targetPath),
25
+ });
26
+ const exportedMethods = extractExportedMethods(ast);
27
+ for (const method of exportedMethods) {
28
+ entries.push({
29
+ id: `api:${method}:${requestPath}`,
30
+ kind: "api_route",
31
+ route,
32
+ requestPath,
33
+ method,
34
+ filePath,
35
+ backendRefs,
36
+ });
37
+ }
38
+ }
39
+ return entries.sort((left, right) => {
40
+ return left.requestPath.localeCompare(right.requestPath) || left.method.localeCompare(right.method);
41
+ });
42
+ }
43
+ function extractExportedMethods(ast) {
44
+ const methods = [];
45
+ for (const statement of ast.body || []) {
46
+ if (statement.type !== "ExportDeclaration")
47
+ continue;
48
+ const declaration = statement.declaration;
49
+ if (declaration?.type === "FunctionDeclaration" && declaration.identifier) {
50
+ const name = declaration.identifier.value.toUpperCase();
51
+ if (HTTP_METHODS.includes(name))
52
+ methods.push(name);
53
+ }
54
+ else if (declaration?.type === "VariableDeclaration") {
55
+ for (const declarator of declaration.declarations || []) {
56
+ if (declarator.id?.type !== "Identifier")
57
+ continue;
58
+ const name = declarator.id.value.toUpperCase();
59
+ if (HTTP_METHODS.includes(name))
60
+ methods.push(name);
61
+ }
62
+ }
63
+ }
64
+ return [...new Set(methods)];
65
+ }
66
+ //# sourceMappingURL=api-routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-routes.js","sourceRoot":"","sources":["../src/api-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,GACV,MAAM,aAAa,CAAC;A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AC;oBAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function findNextAppRoot(rootDir: string): string | null;
2
+ //# sourceMappingURL=app-root.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-root.d.ts","sourceRoot":"","sources":["../src/app-root.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG9D"}
@@ -0,0 +1,7 @@
1
+ import * as path from "node:path";
2
+ import { directoryExists } from "./shared.js";
3
+ export function findNextAppRoot(rootDir) {
4
+ const candidates = [path.join(rootDir, "app"), path.join(rootDir, "src", "app")];
5
+ return candidates.find((candidate) => directoryExists(candidate)) || null;
6
+ }
7
+ //# sourceMappingURL=app-root.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-root.js","sourceRoot":"","sources":["../src/app-root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IACjF,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { BackendRef } from "./types.js";
2
+ export declare function extractBackendRefs({ ast, rootDir, filePath, readSourceFile, }: {
3
+ ast: any;
4
+ rootDir: string;
5
+ filePath: string;
6
+ readSourceFile: (filePath: string) => string | null;
7
+ }): BackendRef[];
8
+ //# sourceMappingURL=backend-links.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-links.d.ts","sourceRoot":"","sources":["../src/backend-links.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C,wBAAgB,kBAAkB,CAAC,EACjC,GAAG,EACH,OAAO,EACP,QAAQ,EACR,cAAc,GACf,EAAE;IACD,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACrD,GAAG,UAAU,EAAE,CAiBf"}
@@ -0,0 +1,30 @@
1
+ import { isBackendSpecifier, modulePathKey, normalizePath } from "./shared.js";
2
+ import { collectImports } from "./swc.js";
3
+ export function extractBackendRefs({ ast, rootDir, filePath, readSourceFile, }) {
4
+ const imports = collectImports(ast, { rootDir, filePath, readSourceFile });
5
+ const refs = [];
6
+ for (const [localName, imported] of imports.entries()) {
7
+ if (!isBackendSpecifier(imported.specifier))
8
+ continue;
9
+ refs.push({
10
+ id: `server_ref:${modulePathKey(imported.resolvedFilePath || filePath)}#${imported.importedName}`,
11
+ kind: "server_capability",
12
+ importName: localName,
13
+ exportName: imported.importedName,
14
+ modulePath: normalizePath(imported.resolvedFilePath || filePath),
15
+ specifier: imported.specifier,
16
+ });
17
+ }
18
+ return dedupeBackendRefs(refs);
19
+ }
20
+ function dedupeBackendRefs(entries) {
21
+ const seen = new Set();
22
+ return entries.filter((entry) => {
23
+ const key = `${entry.modulePath}#${entry.exportName}`;
24
+ if (seen.has(key))
25
+ return false;
26
+ seen.add(key);
27
+ return true;
28
+ });
29
+ }
30
+ //# sourceMappingURL=backend-links.js.map
@@ -0,0 +1 @@
1
+ {"version":3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I,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,11 @@
1
+ export type { BackendRef, BuildRouting, NextActionEntry, NextAnalysisProject, NextAnalysisProjectOptions, NextApiRouteEntry, NextDiagnostic, NextVersionInfo, NextPageEntry, NextRequestEntry, NextRouteTree, NextServerActionEntry, NextServerActionRef, NextSurfaceEntry, TargetHint, } from "./types.js";
2
+ export { createNextAnalysisProject } from "./project.js";
3
+ export { findNextAppRoot } from "./app-root.js";
4
+ export { discoverPages } from "./pages.js";
5
+ export { discoverApiRoutes } from "./api-routes.js";
6
+ export { discoverServerActions } from "./server-actions.js";
7
+ export { analyzeRouteTree } from "./route-tree.js";
8
+ export { normalizePath, normalizeRoute, normalizeRouteSegments, pageLabelFromRoute, toApiRequestPath, HTTP_METHODS, DYNAMIC_SEGMENT_TOKEN, isBackendSpecifier, isDataSpecifier, modulePathKey, shouldExcludePath, walkFiles, } from "./shared.js";
9
+ export { routeFromAppFile, routeFromApiFile, routePatternMatches, requestPathPatternFromLiteral, } from "./routes.js";
10
+ export { parseModule, extractHttpRequests, extractPlaywrightVisitedRoutes } from "./swc.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EACL,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export { createNextAnalysisProject } from "./project.js";
2
+ export { findNextAppRoot } from "./app-root.js";
3
+ export { discoverPages } from "./pages.js";
4
+ export { discoverApiRoutes } from "./api-routes.js";
5
+ export { discoverServerActions } from "./server-actions.js";
6
+ export { analyzeRouteTree } from "./route-tree.js";
7
+ export { normalizePath, normalizeRoute, normalizeRouteSegments, pageLabelFromRoute, toApiRequestPath, HTTP_METHODS, DYNAMIC_SEGMENT_TOKEN, isBackendSpecifier, isDataSpecifier, modulePathKey, shouldExcludePath, walkFiles, } from "./shared.js";
8
+ export { routeFromAppFile, routeFromApiFile, routePatternMatches, requestPathPatternFromLiteral, } from "./routes.js";
9
+ export { parseModule, extractHttpRequests, extractPlaywrightVisitedRoutes } from "./swc.js";
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EACL,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { NextPageEntry } from "./types.js";
2
+ export declare function discoverPages({ rootDir, appRoot, exclude }: {
3
+ rootDir: string;
4
+ appRoot: string;
5
+ exclude?: string[];
6
+ }): NextPageEntry[];
7
+ //# sourceMappingURL=pages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../src/pages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAWhD,wBAAgB,aAAa,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAY,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,aAAa,EAAE,CAmB3I"}
package/dist/pages.js ADDED
@@ -0,0 +1,47 @@
1
+ import * as path from "node:path";
2
+ import { compareByRoute, fileExists, isPageFile, normalizePath, pageLabelFromRoute, walkFiles, } from "./shared.js";
3
+ import { routeFromAppFile } from "./routes.js";
4
+ export function discoverPages({ rootDir, appRoot, exclude = [] }) {
5
+ const pageFiles = walkFiles(appRoot, { baseDir: rootDir, exclude }).filter(isPageFile);
6
+ return pageFiles
7
+ .map((absolutePath) => {
8
+ const filePath = normalizePath(path.relative(rootDir, absolutePath));
9
+ const route = routeFromAppFile(appRoot, absolutePath);
10
+ const layoutFiles = collectLayoutFiles(rootDir, appRoot, absolutePath);
11
+ const rootFiles = [...layoutFiles, filePath];
12
+ return {
13
+ id: `page:${route}`,
14
+ kind: "page",
15
+ route,
16
+ label: pageLabelFromRoute(route),
17
+ filePath,
18
+ layoutFiles,
19
+ rootFiles,
20
+ };
21
+ })
22
+ .sort(compareByRoute);
23
+ }
24
+ function collectLayoutFiles(rootDir, appRoot, pageAbsolutePath) {
25
+ const rootFiles = [];
26
+ let currentDir = path.dirname(pageAbsolutePath);
27
+ const absoluteAppRoot = path.resolve(appRoot);
28
+ while (currentDir.startsWith(absoluteAppRoot)) {
29
+ const layoutFile = resolveRouteCompanion(currentDir, "layout");
30
+ if (layoutFile)
31
+ rootFiles.push(normalizePath(path.relative(rootDir, layoutFile)));
32
+ if (currentDir === absoluteAppRoot)
33
+ break;
34
+ currentDir = path.dirname(currentDir);
35
+ }
36
+ return [...new Set(rootFiles.reverse())];
37
+ }
38
+ function resolveRouteCompanion(directoryPath, baseName) {
39
+ const candidates = [
40
+ path.join(directoryPath, `${baseName}.tsx`),
41
+ path.join(directoryPath, `${baseName}.ts`),
42
+ path.join(directoryPath, `${baseName}.jsx`),
43
+ path.join(directoryPath, `${baseName}.js`),
44
+ ];
45
+ return candidates.find((candidate) => fileExists(candidate)) || null;
46
+ }
47
+ //# sourceMappingURL=pages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pages.js","sourceRoot":"","sources":["../src/pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,I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C,CAAC;IAE9C,OAAO,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QAC9C,MAAM,UAAU,GAAG,qBAAqB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC/D,IAAI,UAAU;YAAE,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;QAClF,IAAI,UAAU,KAAK,eAAe;YAAE,MAAM;QAC1C,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,qBAAqB,CAAC,aAAqB,EAAE,QAAgB;IACpE,MAAM,UAAU,GAAG;QACjB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,QAAQ,MAAM,CAAC;QAC3C,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,QAAQ,KAAK,CAAC;QAC1C,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,QAAQ,MAAM,CAAC;QAC3C,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,QAAQ,KAAK,CAAC;KAC3C,CAAC;IACF,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC;AACvE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { NextAnalysisProject, NextAnalysisProjectOptions } from "./types.js";
2
+ export declare const SUPPORTED_NEXT_VERSION_RANGE = ">=16.0.0 <17.0.0";
3
+ export declare function createNextAnalysisProject({ rootDir, buildDir, nextConfigPath, exclude, }?: NextAnalysisProjectOptions): NextAnalysisProject;
4
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,mBAAmB,EACnB,0BAA0B,EAM3B,MAAM,YAAY,CAAC;AAgBpB,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAE/D,wBAAgB,yBAAyB,CAAC,EACxC,OAAO,EACP,QAAe,EACf,cAAqB,EACrB,OAAY,GACb,GAAE,0BAA+B,GAAG,mBAAmB,CAyGvD"}
@@ -0,0 +1,188 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import nextRouting from "@next/routing";
4
+ import { findNextAppRoot } from "./app-root.js";
5
+ import { discoverApiRoutes } from "./api-routes.js";
6
+ import { discoverPages } from "./pages.js";
7
+ import { analyzeRouteTree } from "./route-tree.js";
8
+ import { discoverServerActions } from "./server-actions.js";
9
+ import { compareByPath, compareByRoute, createDiagnostic, normalizeExcludePaths, normalizePath, readFileIfExists, shouldExcludePath, } from "./shared.js";
10
+ export const SUPPORTED_NEXT_VERSION_RANGE = ">=16.0.0 <17.0.0";
11
+ export function createNextAnalysisProject({ rootDir, buildDir = null, nextConfigPath = null, exclude = [], } = {}) {
12
+ const { resolveRoutes } = nextRouting;
13
+ const absoluteRoot = path.resolve(rootDir || process.cwd());
14
+ const diagnostics = [];
15
+ const moduleCache = new Map();
16
+ const routeTreeCache = new Map();
17
+ const appRoot = findNextAppRoot(absoluteRoot);
18
+ const normalizedExclude = normalizeExcludePaths(exclude);
19
+ const nextVersion = resolveNextVersionInfo(absoluteRoot);
20
+ if (appRoot && nextVersion.source === "missing") {
21
+ diagnostics.push(createDiagnostic({
22
+ level: "info",
23
+ code: "next-version-missing",
24
+ message: `No Next.js package version was found under "${absoluteRoot}". Analysis is using the bundled Next route parser and may be incomplete for unsupported host apps.`,
25
+ }));
26
+ }
27
+ else if (appRoot && !nextVersion.supported) {
28
+ const versionLabel = nextVersion.version || "unknown";
29
+ diagnostics.push(createDiagnostic({
30
+ level: "warn",
31
+ code: "unsupported-next-version",
32
+ message: `Next.js version ${versionLabel} from ${nextVersion.source} is outside testkit's supported analysis range ${SUPPORTED_NEXT_VERSION_RANGE}. Coverage graph analysis may be incomplete.`,
33
+ }));
34
+ }
35
+ const project = {
36
+ rootDir: absoluteRoot,
37
+ buildDir: buildDir ? path.resolve(absoluteRoot, buildDir) : null,
38
+ nextConfigPath: nextConfigPath ? path.resolve(absoluteRoot, nextConfigPath) : null,
39
+ exclude: normalizedExclude,
40
+ nextVersion,
41
+ findAppRoot() {
42
+ return appRoot;
43
+ },
44
+ readSourceFile(relativeFilePath) {
45
+ const absolutePath = path.join(absoluteRoot, relativeFilePath);
46
+ return readFileIfExists(absolutePath);
47
+ },
48
+ getDiagnostics() {
49
+ return [...diagnostics];
50
+ },
51
+ loadModule(relativeFilePath) {
52
+ return moduleCache.get(relativeFilePath) || null;
53
+ },
54
+ isExcluded(relativeFilePath) {
55
+ return shouldExcludePath(relativeFilePath, normalizedExclude);
56
+ },
57
+ setModule(relativeFilePath, moduleInfo) {
58
+ moduleCache.set(relativeFilePath, moduleInfo);
59
+ },
60
+ discoverPages() {
61
+ if (!appRoot) {
62
+ diagnostics.push(createDiagnostic({
63
+ level: "warn",
64
+ code: "missing-app-root",
65
+ message: `No Next app root found under "${absoluteRoot}".`,
66
+ }));
67
+ return [];
68
+ }
69
+ return discoverPages({ rootDir: absoluteRoot, appRoot, exclude: normalizedExclude }).sort(compareByRoute);
70
+ },
71
+ discoverApiRoutes() {
72
+ if (!appRoot)
73
+ return [];
74
+ return discoverApiRoutes({ rootDir: absoluteRoot, appRoot, exclude: normalizedExclude }).sort((left, right) => {
75
+ return left.requestPath.localeCompare(right.requestPath) || left.method.localeCompare(right.method);
76
+ });
77
+ },
78
+ discoverServerActions() {
79
+ if (!appRoot)
80
+ return [];
81
+ return discoverServerActions({ rootDir: absoluteRoot, appRoot, exclude: normalizedExclude }).sort(compareByPath);
82
+ },
83
+ analyzeRouteTree(routeOrPageFile) {
84
+ if (!appRoot)
85
+ return null;
86
+ const key = normalizePath(routeOrPageFile);
87
+ if (routeTreeCache.has(key))
88
+ return routeTreeCache.get(key) || null;
89
+ const result = analyzeRouteTree({ project, routeOrPageFile, diagnostics });
90
+ routeTreeCache.set(key, result);
91
+ return result;
92
+ },
93
+ async loadBuildRouting() {
94
+ if (!project.buildDir || !fs.existsSync(project.buildDir))
95
+ return null;
96
+ return {
97
+ async resolve(url, pathnames = []) {
98
+ return resolveRoutes({
99
+ url: new URL(url),
100
+ basePath: "",
101
+ requestBody: null,
102
+ headers: new Headers(),
103
+ pathnames,
104
+ routes: {
105
+ beforeMiddleware: [],
106
+ beforeFiles: [],
107
+ afterFiles: [],
108
+ dynamicRoutes: [],
109
+ onMatch: [],
110
+ fallback: [],
111
+ },
112
+ invokeMiddleware: async () => ({}),
113
+ });
114
+ },
115
+ };
116
+ },
117
+ };
118
+ return project;
119
+ }
120
+ function resolveNextVersionInfo(rootDir) {
121
+ const installedVersion = readInstalledPackageVersion(rootDir, "next");
122
+ if (installedVersion) {
123
+ return {
124
+ version: installedVersion,
125
+ source: "installed",
126
+ supportedRange: SUPPORTED_NEXT_VERSION_RANGE,
127
+ supported: isSupportedNextVersion(installedVersion),
128
+ };
129
+ }
130
+ const declaredVersion = readDeclaredPackageVersion(rootDir, "next");
131
+ if (declaredVersion) {
132
+ return {
133
+ version: declaredVersion,
134
+ source: "package-json",
135
+ supportedRange: SUPPORTED_NEXT_VERSION_RANGE,
136
+ supported: isSupportedNextVersion(declaredVersion),
137
+ };
138
+ }
139
+ return {
140
+ version: null,
141
+ source: "missing",
142
+ supportedRange: SUPPORTED_NEXT_VERSION_RANGE,
143
+ supported: false,
144
+ };
145
+ }
146
+ function readInstalledPackageVersion(rootDir, packageName) {
147
+ const packagePath = path.join(rootDir, "node_modules", packageName, "package.json");
148
+ return readPackageVersion(packagePath);
149
+ }
150
+ function readDeclaredPackageVersion(rootDir, packageName) {
151
+ const packagePath = path.join(rootDir, "package.json");
152
+ if (!fs.existsSync(packagePath))
153
+ return null;
154
+ try {
155
+ const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf8"));
156
+ return (packageJson.dependencies?.[packageName] ||
157
+ packageJson.devDependencies?.[packageName] ||
158
+ packageJson.peerDependencies?.[packageName] ||
159
+ null);
160
+ }
161
+ catch {
162
+ return null;
163
+ }
164
+ }
165
+ function readPackageVersion(packagePath) {
166
+ if (!fs.existsSync(packagePath))
167
+ return null;
168
+ try {
169
+ const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf8"));
170
+ return typeof packageJson.version === "string" ? packageJson.version : null;
171
+ }
172
+ catch {
173
+ return null;
174
+ }
175
+ }
176
+ function isSupportedNextVersion(versionOrSpec) {
177
+ const candidates = String(versionOrSpec)
178
+ .split("||")
179
+ .map((part) => part.trim())
180
+ .filter(Boolean);
181
+ return candidates.some((candidate) => {
182
+ const version = candidate.match(/(?:^|[^\d])(\d+)(?:\.(\d+))?(?:\.(\d+))?/);
183
+ if (!version)
184
+ return false;
185
+ return Number.parseInt(version[1], 10) === 16;
186
+ });
187
+ }
188
+ //# sourceMappingURL=project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,WAAW,MAAM,eAAe,CAAC;AAWxC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EACL,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,gBAAgB,EACh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CAAC;IAC9E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,sBAAsB,CAAC,aAAqB;IACnD,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,CAAC;SACrC,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,MAAM,CAAC,OAAO,CAAC,CAAC;IAEnB,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;QACnC,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC5E,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAC3B,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { NextAnalysisProject, NextDiagnostic, NextRouteTree } from "./types.js";
2
+ export declare function analyzeRouteTree({ project, routeOrPageFile, diagnostics, }: {
3
+ project: NextAnalysisProject;
4
+ routeOrPageFile: string;
5
+ diagnostics?: NextDiagnostic[];
6
+ }): NextRouteTree | null;
7
+ //# sourceMappingURL=route-tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-tree.d.ts","sourceRoot":"","sources":["../src/route-tree.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,mBAAmB,EACnB,cAAc,EAEd,aAAa,EAId,MAAM,YAAY,CAAC;AAwDpB,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,eAAe,EACf,WAAgB,GACjB,EAAE;IACD,OAAO,EAAE,mBAAmB,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;CAChC,GAAG,aAAa,GAAG,IAAI,CA0CvB"}