@elench/testkit 0.1.65 → 0.1.66
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/lib/app/browser-bridge.mjs +66 -0
- package/lib/app/configs.mjs +81 -0
- package/lib/app/configs.test.mjs +34 -0
- package/lib/cli/command-helpers.mjs +2 -10
- package/lib/cli/commands/browser/serve.mjs +3 -62
- package/lib/cli/db.mjs +3 -68
- package/lib/config/binaries.mjs +34 -0
- package/lib/config/database.mjs +9 -6
- package/lib/config/index.mjs +2 -31
- package/lib/config/runtime.mjs +24 -95
- package/lib/config/validation.mjs +18 -62
- package/lib/coverage/backend-discovery.mjs +68 -85
- package/lib/coverage/backend-discovery.test.mjs +55 -46
- package/lib/coverage/graph-builder.mjs +5 -5
- package/lib/coverage/next-ir-to-graph.mjs +0 -1
- package/lib/coverage/routing.mjs +2 -29
- package/lib/coverage/routing.test.mjs +0 -16
- package/lib/coverage/shared.mjs +22 -82
- package/lib/database/fingerprint.mjs +1 -1
- package/lib/known-failures/github-cache.mjs +159 -0
- package/lib/known-failures/github-transport.mjs +174 -0
- package/lib/known-failures/github.mjs +17 -325
- package/lib/runner/default-runtime-runner.mjs +4 -10
- package/lib/runner/execution-config.mjs +12 -83
- package/lib/runner/live-run.mjs +45 -0
- package/lib/runner/managed-processes.mjs +29 -0
- package/lib/runner/orchestrator.mjs +57 -188
- package/lib/runner/playwright-runner.mjs +4 -11
- package/lib/runner/run-finalization.mjs +132 -0
- package/lib/runner/run-guards.mjs +45 -0
- package/lib/runner/runtime-preparation.mjs +1 -1
- package/lib/runner/services.mjs +3 -4
- package/lib/runner/template-steps.mjs +8 -45
- package/lib/runner/template.mjs +7 -28
- package/lib/shared/configured-steps.mjs +178 -0
- package/lib/shared/configured-steps.test.mjs +73 -0
- package/lib/shared/execution-schema.mjs +74 -0
- package/lib/shared/execution-schema.test.mjs +26 -0
- package/node_modules/@elench/next-analysis/dist/api-routes.d.ts +7 -0
- package/node_modules/@elench/next-analysis/dist/api-routes.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/api-routes.js +66 -0
- package/node_modules/@elench/next-analysis/dist/api-routes.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/app-root.d.ts +2 -0
- package/node_modules/@elench/next-analysis/dist/app-root.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/app-root.js +7 -0
- package/node_modules/@elench/next-analysis/dist/app-root.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/backend-links.d.ts +8 -0
- package/node_modules/@elench/next-analysis/dist/backend-links.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/backend-links.js +30 -0
- package/node_modules/@elench/next-analysis/dist/backend-links.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/index.d.ts +11 -0
- package/node_modules/@elench/next-analysis/dist/index.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/index.js +10 -0
- package/node_modules/@elench/next-analysis/dist/index.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/pages.d.ts +7 -0
- package/node_modules/@elench/next-analysis/dist/pages.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/pages.js +47 -0
- package/node_modules/@elench/next-analysis/dist/pages.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/project.d.ts +3 -0
- package/node_modules/@elench/next-analysis/dist/project.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/project.js +102 -0
- package/node_modules/@elench/next-analysis/dist/project.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/route-tree.d.ts +7 -0
- package/node_modules/@elench/next-analysis/dist/route-tree.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/route-tree.js +575 -0
- package/node_modules/@elench/next-analysis/dist/route-tree.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/routes.d.ts +6 -0
- package/node_modules/@elench/next-analysis/dist/routes.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/routes.js +41 -0
- package/node_modules/@elench/next-analysis/dist/routes.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/server-actions.d.ts +7 -0
- package/node_modules/@elench/next-analysis/dist/server-actions.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/server-actions.js +37 -0
- package/node_modules/@elench/next-analysis/dist/server-actions.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/shared.d.ts +57 -0
- package/node_modules/@elench/next-analysis/dist/shared.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/shared.js +229 -0
- package/node_modules/@elench/next-analysis/dist/shared.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/swc.d.ts +53 -0
- package/node_modules/@elench/next-analysis/dist/swc.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/swc.js +387 -0
- package/node_modules/@elench/next-analysis/dist/swc.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/types.d.ts +125 -0
- package/node_modules/@elench/next-analysis/dist/types.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/types.js +2 -0
- package/node_modules/@elench/next-analysis/dist/types.js.map +1 -0
- package/node_modules/@elench/next-analysis/package.json +15 -2
- package/node_modules/@elench/testkit-bridge/dist/index.d.ts +36 -0
- package/node_modules/@elench/testkit-bridge/dist/index.d.ts.map +1 -0
- package/node_modules/@elench/testkit-bridge/dist/index.js +538 -0
- package/node_modules/@elench/testkit-bridge/dist/index.js.map +1 -0
- package/node_modules/@elench/testkit-bridge/package.json +16 -5
- package/node_modules/@elench/testkit-protocol/dist/index.d.ts +190 -0
- package/node_modules/@elench/testkit-protocol/dist/index.d.ts.map +1 -0
- package/node_modules/@elench/testkit-protocol/dist/index.js +296 -0
- package/node_modules/@elench/testkit-protocol/dist/index.js.map +1 -0
- package/node_modules/@elench/testkit-protocol/package.json +14 -7
- package/node_modules/@elench/ts-analysis/dist/callables.d.ts +8 -0
- package/node_modules/@elench/ts-analysis/dist/callables.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/callables.js +126 -0
- package/node_modules/@elench/ts-analysis/dist/callables.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/exports.d.ts +6 -0
- package/node_modules/@elench/ts-analysis/dist/exports.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/exports.js +70 -0
- package/node_modules/@elench/ts-analysis/dist/exports.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/index.d.ts +10 -0
- package/node_modules/@elench/ts-analysis/dist/index.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/{src/index.mjs → dist/index.js} +9 -14
- package/node_modules/@elench/ts-analysis/dist/index.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/jsx.d.ts +9 -0
- package/node_modules/@elench/ts-analysis/dist/jsx.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/jsx.js +68 -0
- package/node_modules/@elench/ts-analysis/dist/jsx.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/project.d.ts +5 -0
- package/node_modules/@elench/ts-analysis/dist/project.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/project.js +90 -0
- package/node_modules/@elench/ts-analysis/dist/project.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/requests.d.ts +6 -0
- package/node_modules/@elench/ts-analysis/dist/requests.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/requests.js +140 -0
- package/node_modules/@elench/ts-analysis/dist/requests.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/resolution.d.ts +4 -0
- package/node_modules/@elench/ts-analysis/dist/resolution.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/resolution.js +53 -0
- package/node_modules/@elench/ts-analysis/dist/resolution.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/shared.d.ts +6 -0
- package/node_modules/@elench/ts-analysis/dist/shared.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/shared.js +31 -0
- package/node_modules/@elench/ts-analysis/dist/shared.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/syntax.d.ts +7 -0
- package/node_modules/@elench/ts-analysis/dist/syntax.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/syntax.js +27 -0
- package/node_modules/@elench/ts-analysis/dist/syntax.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/types.d.ts +58 -0
- package/node_modules/@elench/ts-analysis/dist/types.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/types.js +2 -0
- package/node_modules/@elench/ts-analysis/dist/types.js.map +1 -0
- package/node_modules/@elench/ts-analysis/package.json +18 -2
- package/node_modules/typescript/LICENSE.txt +55 -0
- package/node_modules/typescript/README.md +50 -0
- package/node_modules/typescript/SECURITY.md +41 -0
- package/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
- package/node_modules/typescript/bin/tsc +2 -0
- package/node_modules/typescript/bin/tsserver +2 -0
- package/node_modules/typescript/lib/_tsc.js +133818 -0
- package/node_modules/typescript/lib/_tsserver.js +659 -0
- package/node_modules/typescript/lib/_typingsInstaller.js +222 -0
- package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/lib.d.ts +22 -0
- package/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
- package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
- package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
- package/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
- package/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
- package/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
- package/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
- package/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
- package/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
- package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
- package/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
- package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
- package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
- package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
- package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
- package/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
- package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
- package/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
- package/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
- package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
- package/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
- package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
- package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
- package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
- package/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
- package/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
- package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
- package/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
- package/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
- package/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
- package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
- package/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
- package/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
- package/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
- package/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
- package/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
- package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
- package/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
- package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
- package/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
- package/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
- package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
- package/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
- package/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
- package/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
- package/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
- package/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
- package/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
- package/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
- package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
- package/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
- package/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
- package/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
- package/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
- package/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
- package/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
- package/node_modules/typescript/lib/lib.es6.d.ts +23 -0
- package/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
- package/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
- package/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
- package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
- package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
- package/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
- package/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
- package/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
- package/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
- package/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
- package/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
- package/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
- package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
- package/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
- package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
- package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
- package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/tsc.js +8 -0
- package/node_modules/typescript/lib/tsserver.js +8 -0
- package/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
- package/node_modules/typescript/lib/tsserverlibrary.js +21 -0
- package/node_modules/typescript/lib/typesMap.json +497 -0
- package/node_modules/typescript/lib/typescript.d.ts +11437 -0
- package/node_modules/typescript/lib/typescript.js +200276 -0
- package/node_modules/typescript/lib/typingsInstaller.js +8 -0
- package/node_modules/typescript/lib/watchGuard.js +53 -0
- package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/package.json +120 -0
- package/package.json +12 -9
- package/lib/coverage/fs-walk.mjs +0 -64
- package/node_modules/@elench/next-analysis/src/api-routes.mjs +0 -81
- package/node_modules/@elench/next-analysis/src/api-routes.test.mjs +0 -22
- package/node_modules/@elench/next-analysis/src/app-root.mjs +0 -7
- package/node_modules/@elench/next-analysis/src/backend-links.mjs +0 -31
- package/node_modules/@elench/next-analysis/src/index.mjs +0 -21
- package/node_modules/@elench/next-analysis/src/pages.mjs +0 -68
- package/node_modules/@elench/next-analysis/src/project.mjs +0 -94
- package/node_modules/@elench/next-analysis/src/project.test.mjs +0 -35
- package/node_modules/@elench/next-analysis/src/route-tree.mjs +0 -621
- package/node_modules/@elench/next-analysis/src/routes.mjs +0 -41
- package/node_modules/@elench/next-analysis/src/routes.test.mjs +0 -25
- package/node_modules/@elench/next-analysis/src/server-actions.mjs +0 -53
- package/node_modules/@elench/next-analysis/src/server-actions.test.mjs +0 -37
- package/node_modules/@elench/next-analysis/src/shared.mjs +0 -209
- package/node_modules/@elench/next-analysis/src/swc.mjs +0 -388
- package/node_modules/@elench/testkit-bridge/src/index.mjs +0 -583
- package/node_modules/@elench/testkit-bridge/src/index.test.mjs +0 -409
- package/node_modules/@elench/testkit-protocol/src/index.d.ts +0 -231
- package/node_modules/@elench/testkit-protocol/src/index.mjs +0 -265
- package/node_modules/@elench/testkit-protocol/src/index.test.mjs +0 -242
- package/node_modules/@elench/ts-analysis/src/callables.mjs +0 -135
- package/node_modules/@elench/ts-analysis/src/callables.test.mjs +0 -55
- package/node_modules/@elench/ts-analysis/src/exports.mjs +0 -69
- package/node_modules/@elench/ts-analysis/src/exports.test.mjs +0 -50
- package/node_modules/@elench/ts-analysis/src/jsx.mjs +0 -69
- package/node_modules/@elench/ts-analysis/src/jsx.test.mjs +0 -43
- package/node_modules/@elench/ts-analysis/src/project.mjs +0 -100
- package/node_modules/@elench/ts-analysis/src/project.test.mjs +0 -54
- package/node_modules/@elench/ts-analysis/src/requests.mjs +0 -141
- package/node_modules/@elench/ts-analysis/src/requests.test.mjs +0 -35
- package/node_modules/@elench/ts-analysis/src/resolution.mjs +0 -53
- package/node_modules/@elench/ts-analysis/src/shared.mjs +0 -32
- package/node_modules/@elench/ts-analysis/src/syntax.mjs +0 -27
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "typescript",
|
|
3
|
+
"author": "Microsoft Corp.",
|
|
4
|
+
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
+
"version": "5.9.3",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"TypeScript",
|
|
10
|
+
"Microsoft",
|
|
11
|
+
"compiler",
|
|
12
|
+
"language",
|
|
13
|
+
"javascript"
|
|
14
|
+
],
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/microsoft/TypeScript/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/microsoft/TypeScript.git"
|
|
21
|
+
},
|
|
22
|
+
"main": "./lib/typescript.js",
|
|
23
|
+
"typings": "./lib/typescript.d.ts",
|
|
24
|
+
"bin": {
|
|
25
|
+
"tsc": "./bin/tsc",
|
|
26
|
+
"tsserver": "./bin/tsserver"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=14.17"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"bin",
|
|
33
|
+
"lib",
|
|
34
|
+
"!lib/enu",
|
|
35
|
+
"LICENSE.txt",
|
|
36
|
+
"README.md",
|
|
37
|
+
"SECURITY.md",
|
|
38
|
+
"ThirdPartyNoticeText.txt",
|
|
39
|
+
"!**/.gitattributes"
|
|
40
|
+
],
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@dprint/formatter": "^0.4.1",
|
|
43
|
+
"@dprint/typescript": "0.93.4",
|
|
44
|
+
"@esfx/canceltoken": "^1.0.0",
|
|
45
|
+
"@eslint/js": "^9.20.0",
|
|
46
|
+
"@octokit/rest": "^21.1.1",
|
|
47
|
+
"@types/chai": "^4.3.20",
|
|
48
|
+
"@types/diff": "^7.0.1",
|
|
49
|
+
"@types/minimist": "^1.2.5",
|
|
50
|
+
"@types/mocha": "^10.0.10",
|
|
51
|
+
"@types/ms": "^0.7.34",
|
|
52
|
+
"@types/node": "latest",
|
|
53
|
+
"@types/source-map-support": "^0.5.10",
|
|
54
|
+
"@types/which": "^3.0.4",
|
|
55
|
+
"@typescript-eslint/rule-tester": "^8.24.1",
|
|
56
|
+
"@typescript-eslint/type-utils": "^8.24.1",
|
|
57
|
+
"@typescript-eslint/utils": "^8.24.1",
|
|
58
|
+
"azure-devops-node-api": "^14.1.0",
|
|
59
|
+
"c8": "^10.1.3",
|
|
60
|
+
"chai": "^4.5.0",
|
|
61
|
+
"chokidar": "^4.0.3",
|
|
62
|
+
"diff": "^7.0.0",
|
|
63
|
+
"dprint": "^0.49.0",
|
|
64
|
+
"esbuild": "^0.25.0",
|
|
65
|
+
"eslint": "^9.20.1",
|
|
66
|
+
"eslint-formatter-autolinkable-stylish": "^1.4.0",
|
|
67
|
+
"eslint-plugin-regexp": "^2.7.0",
|
|
68
|
+
"fast-xml-parser": "^4.5.2",
|
|
69
|
+
"glob": "^10.4.5",
|
|
70
|
+
"globals": "^15.15.0",
|
|
71
|
+
"hereby": "^1.10.0",
|
|
72
|
+
"jsonc-parser": "^3.3.1",
|
|
73
|
+
"knip": "^5.44.4",
|
|
74
|
+
"minimist": "^1.2.8",
|
|
75
|
+
"mocha": "^10.8.2",
|
|
76
|
+
"mocha-fivemat-progress-reporter": "^0.1.0",
|
|
77
|
+
"monocart-coverage-reports": "^2.12.1",
|
|
78
|
+
"ms": "^2.1.3",
|
|
79
|
+
"picocolors": "^1.1.1",
|
|
80
|
+
"playwright": "^1.50.1",
|
|
81
|
+
"source-map-support": "^0.5.21",
|
|
82
|
+
"tslib": "^2.8.1",
|
|
83
|
+
"typescript": "^5.7.3",
|
|
84
|
+
"typescript-eslint": "^8.24.1",
|
|
85
|
+
"which": "^3.0.1"
|
|
86
|
+
},
|
|
87
|
+
"overrides": {
|
|
88
|
+
"typescript@*": "$typescript"
|
|
89
|
+
},
|
|
90
|
+
"scripts": {
|
|
91
|
+
"test": "hereby runtests-parallel --light=false",
|
|
92
|
+
"test:eslint-rules": "hereby run-eslint-rules-tests",
|
|
93
|
+
"build": "npm run build:compiler && npm run build:tests",
|
|
94
|
+
"build:compiler": "hereby local",
|
|
95
|
+
"build:tests": "hereby tests",
|
|
96
|
+
"build:tests:notypecheck": "hereby tests --no-typecheck",
|
|
97
|
+
"clean": "hereby clean",
|
|
98
|
+
"gulp": "hereby",
|
|
99
|
+
"lint": "hereby lint",
|
|
100
|
+
"knip": "hereby knip",
|
|
101
|
+
"format": "dprint fmt",
|
|
102
|
+
"setup-hooks": "node scripts/link-hooks.mjs"
|
|
103
|
+
},
|
|
104
|
+
"browser": {
|
|
105
|
+
"fs": false,
|
|
106
|
+
"os": false,
|
|
107
|
+
"path": false,
|
|
108
|
+
"crypto": false,
|
|
109
|
+
"buffer": false,
|
|
110
|
+
"source-map-support": false,
|
|
111
|
+
"inspector": false,
|
|
112
|
+
"perf_hooks": false
|
|
113
|
+
},
|
|
114
|
+
"packageManager": "npm@8.19.4",
|
|
115
|
+
"volta": {
|
|
116
|
+
"node": "20.1.0",
|
|
117
|
+
"npm": "8.19.4"
|
|
118
|
+
},
|
|
119
|
+
"gitHead": "c63de15a992d37f0d6cec03ac7631872838602cb"
|
|
120
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elench/testkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.66",
|
|
4
4
|
"description": "CLI for discovering and running local HTTP, DAL, and Playwright test suites",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -40,10 +40,12 @@
|
|
|
40
40
|
"topicSeparator": " "
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"test:
|
|
46
|
-
"test:
|
|
43
|
+
"build:packages": "npm --workspace packages/testkit-protocol run build && npm --workspace packages/ts-analysis run build && npm --workspace packages/next-analysis run build && npm --workspace packages/testkit-bridge run build",
|
|
44
|
+
"typecheck:packages": "npm --workspace packages/testkit-protocol run typecheck && npm --workspace packages/ts-analysis run typecheck && npm --workspace packages/next-analysis run typecheck && npm --workspace packages/testkit-bridge run typecheck && npm --workspace packages/testkit-extension run compile",
|
|
45
|
+
"test": "npm run build:packages && vitest run",
|
|
46
|
+
"test:unit": "npm run build:packages && vitest run lib packages",
|
|
47
|
+
"test:integration": "npm run build:packages && vitest run test/integration",
|
|
48
|
+
"test:system": "npm run build:packages && vitest run test/system --passWithNoTests"
|
|
47
49
|
},
|
|
48
50
|
"files": [
|
|
49
51
|
"bin/",
|
|
@@ -57,14 +59,15 @@
|
|
|
57
59
|
"@elench/testkit-protocol"
|
|
58
60
|
],
|
|
59
61
|
"devDependencies": {
|
|
62
|
+
"@types/node": "^24.9.1",
|
|
60
63
|
"@playwright/test": "^1.52.0",
|
|
61
64
|
"vitest": "^3.2.4"
|
|
62
65
|
},
|
|
63
66
|
"dependencies": {
|
|
64
|
-
"@elench/next-analysis": "0.1.
|
|
65
|
-
"@elench/ts-analysis": "0.1.
|
|
66
|
-
"@elench/testkit-bridge": "0.1.
|
|
67
|
-
"@elench/testkit-protocol": "0.1.
|
|
67
|
+
"@elench/next-analysis": "0.1.66",
|
|
68
|
+
"@elench/ts-analysis": "0.1.66",
|
|
69
|
+
"@elench/testkit-bridge": "0.1.66",
|
|
70
|
+
"@elench/testkit-protocol": "0.1.66",
|
|
68
71
|
"@babel/code-frame": "^7.29.0",
|
|
69
72
|
"@oclif/core": "^4.10.6",
|
|
70
73
|
"esbuild": "^0.25.11",
|
package/lib/coverage/fs-walk.mjs
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import {
|
|
4
|
-
normalizeDiscoveryPath,
|
|
5
|
-
shouldExcludeDiscoveryPath,
|
|
6
|
-
} from "../discovery/path-policy.mjs";
|
|
7
|
-
import { normalizePath } from "./shared.mjs";
|
|
8
|
-
import { resolveImportToSourceFile as resolveImportToSourceFileFromTsAnalysis } from "@elench/ts-analysis";
|
|
9
|
-
|
|
10
|
-
export function findNextAppRoot(serviceRoot) {
|
|
11
|
-
const candidates = [path.join(serviceRoot, "app"), path.join(serviceRoot, "src", "app")];
|
|
12
|
-
return candidates.find((candidate) => fs.existsSync(candidate) && fs.statSync(candidate).isDirectory()) || null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function resolveServiceRoot(productDir, config) {
|
|
16
|
-
const cwd = config?.local?.cwd || ".";
|
|
17
|
-
return path.resolve(productDir, cwd);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function walkFiles(rootDir, options = {}) {
|
|
21
|
-
if (!fs.existsSync(rootDir)) return [];
|
|
22
|
-
const baseDir = options.baseDir || rootDir;
|
|
23
|
-
const exclude = options.exclude || [];
|
|
24
|
-
const results = [];
|
|
25
|
-
const queue = [rootDir];
|
|
26
|
-
while (queue.length > 0) {
|
|
27
|
-
const current = queue.pop();
|
|
28
|
-
for (const entry of fs.readdirSync(current, { withFileTypes: true })) {
|
|
29
|
-
if (entry.isSymbolicLink()) continue;
|
|
30
|
-
const absolutePath = path.join(current, entry.name);
|
|
31
|
-
if (entry.isDirectory()) {
|
|
32
|
-
const relativeDirPath = normalizeDiscoveryPath(path.relative(baseDir, absolutePath));
|
|
33
|
-
if (shouldExcludeDiscoveryPath(relativeDirPath, exclude)) continue;
|
|
34
|
-
queue.push(absolutePath);
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
if (entry.isFile()) {
|
|
38
|
-
results.push(absolutePath);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return results.sort((left, right) => left.localeCompare(right));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function resolveImportToSourceFile(serviceRoot, fromFilePath, specifier) {
|
|
46
|
-
return resolveImportToSourceFileFromTsAnalysis(serviceRoot, fromFilePath, specifier);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function resolveSourceCandidate(basePath) {
|
|
50
|
-
const direct = [basePath, `${basePath}.ts`, `${basePath}.tsx`, `${basePath}.js`, `${basePath}.mjs`];
|
|
51
|
-
for (const candidate of direct) {
|
|
52
|
-
if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return candidate;
|
|
53
|
-
}
|
|
54
|
-
const indexed = [
|
|
55
|
-
path.join(basePath, "index.ts"),
|
|
56
|
-
path.join(basePath, "index.tsx"),
|
|
57
|
-
path.join(basePath, "index.js"),
|
|
58
|
-
path.join(basePath, "index.mjs"),
|
|
59
|
-
];
|
|
60
|
-
for (const candidate of indexed) {
|
|
61
|
-
if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return candidate;
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { extractBackendRefs } from "./backend-links.mjs";
|
|
4
|
-
import { routeFromApiFile } from "./routes.mjs";
|
|
5
|
-
import { HTTP_METHODS, isRouteHandlerFile, normalizePath, toApiRequestPath } from "./shared.mjs";
|
|
6
|
-
import { parseModule } from "./swc.mjs";
|
|
7
|
-
|
|
8
|
-
export function discoverApiRoutes({ rootDir, appRoot }) {
|
|
9
|
-
const apiRoot = path.join(appRoot, "api");
|
|
10
|
-
if (!fs.existsSync(apiRoot)) return [];
|
|
11
|
-
const routeFiles = walkFiles(apiRoot).filter(isRouteHandlerFile);
|
|
12
|
-
const entries = [];
|
|
13
|
-
|
|
14
|
-
for (const absolutePath of routeFiles) {
|
|
15
|
-
const filePath = normalizePath(path.relative(rootDir, absolutePath));
|
|
16
|
-
const route = routeFromApiFile(appRoot, absolutePath);
|
|
17
|
-
const requestPath = toApiRequestPath(route);
|
|
18
|
-
const content = fs.readFileSync(absolutePath, "utf8");
|
|
19
|
-
const ast = parseModule(content, filePath);
|
|
20
|
-
const backendRefs = extractBackendRefs({
|
|
21
|
-
ast,
|
|
22
|
-
rootDir,
|
|
23
|
-
filePath,
|
|
24
|
-
readSourceFile: (targetPath) => fs.existsSync(targetPath) ? fs.readFileSync(targetPath, "utf8") : null,
|
|
25
|
-
});
|
|
26
|
-
const exportedMethods = extractExportedMethods(ast);
|
|
27
|
-
|
|
28
|
-
for (const method of exportedMethods) {
|
|
29
|
-
entries.push({
|
|
30
|
-
id: `api:${method}:${requestPath}`,
|
|
31
|
-
kind: "api_route",
|
|
32
|
-
route,
|
|
33
|
-
requestPath,
|
|
34
|
-
method,
|
|
35
|
-
filePath,
|
|
36
|
-
backendRefs,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return entries.sort((left, right) => {
|
|
42
|
-
return left.requestPath.localeCompare(right.requestPath) || left.method.localeCompare(right.method);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function extractExportedMethods(ast) {
|
|
47
|
-
const methods = [];
|
|
48
|
-
for (const statement of ast.body || []) {
|
|
49
|
-
if (statement.type !== "ExportDeclaration") continue;
|
|
50
|
-
const declaration = statement.declaration;
|
|
51
|
-
if (declaration?.type === "FunctionDeclaration" && declaration.identifier) {
|
|
52
|
-
const name = declaration.identifier.value.toUpperCase();
|
|
53
|
-
if (HTTP_METHODS.includes(name)) methods.push(name);
|
|
54
|
-
} else if (declaration?.type === "VariableDeclaration") {
|
|
55
|
-
for (const declarator of declaration.declarations || []) {
|
|
56
|
-
if (declarator.id?.type !== "Identifier") continue;
|
|
57
|
-
const name = declarator.id.value.toUpperCase();
|
|
58
|
-
if (HTTP_METHODS.includes(name)) methods.push(name);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return [...new Set(methods)];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function walkFiles(rootDir) {
|
|
66
|
-
const results = [];
|
|
67
|
-
const queue = [rootDir];
|
|
68
|
-
while (queue.length > 0) {
|
|
69
|
-
const current = queue.pop();
|
|
70
|
-
for (const entry of fs.readdirSync(current, { withFileTypes: true })) {
|
|
71
|
-
if (entry.isSymbolicLink()) continue;
|
|
72
|
-
const absolutePath = path.join(current, entry.name);
|
|
73
|
-
if (entry.isDirectory()) {
|
|
74
|
-
queue.push(absolutePath);
|
|
75
|
-
} else if (entry.isFile()) {
|
|
76
|
-
results.push(absolutePath);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return results.sort((left, right) => left.localeCompare(right));
|
|
81
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { createNextAnalysisProject } from "./index.mjs";
|
|
4
|
-
|
|
5
|
-
const fixtureRoot = path.resolve(
|
|
6
|
-
"/home/georgedlr/workspace/elench/testkit/test/fixtures/integration/next-dynamic-routes-product"
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
describe("@elench/next-analysis api routes", () => {
|
|
10
|
-
it("discovers dynamic API routes with normalized request paths", () => {
|
|
11
|
-
const project = createNextAnalysisProject({ rootDir: fixtureRoot });
|
|
12
|
-
expect(project.discoverApiRoutes()).toEqual(
|
|
13
|
-
expect.arrayContaining([
|
|
14
|
-
expect.objectContaining({
|
|
15
|
-
method: "GET",
|
|
16
|
-
route: "/projects/[projectId]",
|
|
17
|
-
requestPath: "/api/projects/[projectId]",
|
|
18
|
-
}),
|
|
19
|
-
])
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { directoryExists } from "./shared.mjs";
|
|
3
|
-
|
|
4
|
-
export function findNextAppRoot(rootDir) {
|
|
5
|
-
const candidates = [path.join(rootDir, "app"), path.join(rootDir, "src", "app")];
|
|
6
|
-
return candidates.find((candidate) => directoryExists(candidate)) || null;
|
|
7
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { isBackendSpecifier, modulePathKey, normalizePath } from "./shared.mjs";
|
|
2
|
-
import { collectImports } from "./swc.mjs";
|
|
3
|
-
|
|
4
|
-
export function extractBackendRefs({ ast, rootDir, filePath, readSourceFile }) {
|
|
5
|
-
const imports = collectImports(ast, { rootDir, filePath, readSourceFile });
|
|
6
|
-
const refs = [];
|
|
7
|
-
|
|
8
|
-
for (const [localName, imported] of imports.entries()) {
|
|
9
|
-
if (!isBackendSpecifier(imported.specifier)) continue;
|
|
10
|
-
refs.push({
|
|
11
|
-
id: `server_ref:${modulePathKey(imported.resolvedFilePath || filePath)}#${imported.importedName}`,
|
|
12
|
-
kind: "server_capability",
|
|
13
|
-
importName: localName,
|
|
14
|
-
exportName: imported.importedName,
|
|
15
|
-
modulePath: normalizePath(imported.resolvedFilePath || filePath),
|
|
16
|
-
specifier: imported.specifier,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return dedupeBackendRefs(refs);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function dedupeBackendRefs(entries) {
|
|
24
|
-
const seen = new Set();
|
|
25
|
-
return entries.filter((entry) => {
|
|
26
|
-
const key = `${entry.modulePath}#${entry.exportName}`;
|
|
27
|
-
if (seen.has(key)) return false;
|
|
28
|
-
seen.add(key);
|
|
29
|
-
return true;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export { createNextAnalysisProject } from "./project.mjs";
|
|
2
|
-
export { findNextAppRoot } from "./app-root.mjs";
|
|
3
|
-
export { discoverPages } from "./pages.mjs";
|
|
4
|
-
export { discoverApiRoutes } from "./api-routes.mjs";
|
|
5
|
-
export { discoverServerActions } from "./server-actions.mjs";
|
|
6
|
-
export { analyzeRouteTree } from "./route-tree.mjs";
|
|
7
|
-
export {
|
|
8
|
-
normalizePath,
|
|
9
|
-
normalizeRoute,
|
|
10
|
-
normalizeRouteSegments,
|
|
11
|
-
pageLabelFromRoute,
|
|
12
|
-
toApiRequestPath,
|
|
13
|
-
HTTP_METHODS,
|
|
14
|
-
} from "./shared.mjs";
|
|
15
|
-
export {
|
|
16
|
-
routeFromAppFile,
|
|
17
|
-
routeFromApiFile,
|
|
18
|
-
routePatternMatches,
|
|
19
|
-
requestPathPatternFromLiteral,
|
|
20
|
-
} from "./routes.mjs";
|
|
21
|
-
export { parseModule, extractHttpRequests, extractPlaywrightVisitedRoutes } from "./swc.mjs";
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { routeFromAppFile } from "./routes.mjs";
|
|
4
|
-
import { compareByRoute, isPageFile, normalizePath, pageLabelFromRoute } from "./shared.mjs";
|
|
5
|
-
|
|
6
|
-
export function discoverPages({ rootDir, appRoot }) {
|
|
7
|
-
const pageFiles = walkFiles(appRoot).filter(isPageFile);
|
|
8
|
-
return pageFiles
|
|
9
|
-
.map((absolutePath) => {
|
|
10
|
-
const filePath = normalizePath(path.relative(rootDir, absolutePath));
|
|
11
|
-
const route = routeFromAppFile(appRoot, absolutePath);
|
|
12
|
-
const layoutFiles = collectLayoutFiles(rootDir, appRoot, absolutePath);
|
|
13
|
-
const rootFiles = [...layoutFiles, filePath];
|
|
14
|
-
return {
|
|
15
|
-
id: `page:${route}`,
|
|
16
|
-
kind: "page",
|
|
17
|
-
route,
|
|
18
|
-
label: pageLabelFromRoute(route),
|
|
19
|
-
filePath,
|
|
20
|
-
layoutFiles,
|
|
21
|
-
rootFiles,
|
|
22
|
-
};
|
|
23
|
-
})
|
|
24
|
-
.sort(compareByRoute);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function collectLayoutFiles(rootDir, appRoot, pageAbsolutePath) {
|
|
28
|
-
const rootFiles = [];
|
|
29
|
-
let currentDir = path.dirname(pageAbsolutePath);
|
|
30
|
-
const absoluteAppRoot = path.resolve(appRoot);
|
|
31
|
-
|
|
32
|
-
while (currentDir.startsWith(absoluteAppRoot)) {
|
|
33
|
-
const layoutFile = resolveRouteCompanion(currentDir, "layout");
|
|
34
|
-
if (layoutFile) rootFiles.push(normalizePath(path.relative(rootDir, layoutFile)));
|
|
35
|
-
if (currentDir === absoluteAppRoot) break;
|
|
36
|
-
currentDir = path.dirname(currentDir);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return [...new Set(rootFiles.reverse())];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function resolveRouteCompanion(directoryPath, baseName) {
|
|
43
|
-
const candidates = [
|
|
44
|
-
path.join(directoryPath, `${baseName}.tsx`),
|
|
45
|
-
path.join(directoryPath, `${baseName}.ts`),
|
|
46
|
-
path.join(directoryPath, `${baseName}.jsx`),
|
|
47
|
-
path.join(directoryPath, `${baseName}.js`),
|
|
48
|
-
];
|
|
49
|
-
return candidates.find((candidate) => fs.existsSync(candidate)) || null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function walkFiles(rootDir) {
|
|
53
|
-
const results = [];
|
|
54
|
-
const queue = [rootDir];
|
|
55
|
-
while (queue.length > 0) {
|
|
56
|
-
const current = queue.pop();
|
|
57
|
-
for (const entry of fs.readdirSync(current, { withFileTypes: true })) {
|
|
58
|
-
if (entry.isSymbolicLink()) continue;
|
|
59
|
-
const absolutePath = path.join(current, entry.name);
|
|
60
|
-
if (entry.isDirectory()) {
|
|
61
|
-
queue.push(absolutePath);
|
|
62
|
-
} else if (entry.isFile()) {
|
|
63
|
-
results.push(absolutePath);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return results.sort((left, right) => left.localeCompare(right));
|
|
68
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import nextRouting from "@next/routing";
|
|
4
|
-
import { findNextAppRoot } from "./app-root.mjs";
|
|
5
|
-
import { discoverApiRoutes } from "./api-routes.mjs";
|
|
6
|
-
import { discoverPages } from "./pages.mjs";
|
|
7
|
-
import { analyzeRouteTree } from "./route-tree.mjs";
|
|
8
|
-
import { discoverServerActions } from "./server-actions.mjs";
|
|
9
|
-
import { compareByPath, compareByRoute, createDiagnostic, normalizePath, readFileIfExists } from "./shared.mjs";
|
|
10
|
-
|
|
11
|
-
export function createNextAnalysisProject({ rootDir, buildDir = null, nextConfigPath = null } = {}) {
|
|
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
|
-
|
|
19
|
-
const project = {
|
|
20
|
-
rootDir: absoluteRoot,
|
|
21
|
-
buildDir: buildDir ? path.resolve(absoluteRoot, buildDir) : null,
|
|
22
|
-
nextConfigPath: nextConfigPath ? path.resolve(absoluteRoot, nextConfigPath) : null,
|
|
23
|
-
findAppRoot() {
|
|
24
|
-
return appRoot;
|
|
25
|
-
},
|
|
26
|
-
readSourceFile(relativeFilePath) {
|
|
27
|
-
const absolutePath = path.join(absoluteRoot, relativeFilePath);
|
|
28
|
-
return readFileIfExists(absolutePath);
|
|
29
|
-
},
|
|
30
|
-
getDiagnostics() {
|
|
31
|
-
return [...diagnostics];
|
|
32
|
-
},
|
|
33
|
-
loadModule(relativeFilePath) {
|
|
34
|
-
return moduleCache.get(relativeFilePath) || null;
|
|
35
|
-
},
|
|
36
|
-
setModule(relativeFilePath, moduleInfo) {
|
|
37
|
-
moduleCache.set(relativeFilePath, moduleInfo);
|
|
38
|
-
},
|
|
39
|
-
discoverPages() {
|
|
40
|
-
if (!appRoot) {
|
|
41
|
-
diagnostics.push(createDiagnostic({
|
|
42
|
-
level: "warn",
|
|
43
|
-
code: "missing-app-root",
|
|
44
|
-
message: `No Next app root found under "${absoluteRoot}".`,
|
|
45
|
-
}));
|
|
46
|
-
return [];
|
|
47
|
-
}
|
|
48
|
-
return discoverPages({ rootDir: absoluteRoot, appRoot }).sort(compareByRoute);
|
|
49
|
-
},
|
|
50
|
-
discoverApiRoutes() {
|
|
51
|
-
if (!appRoot) return [];
|
|
52
|
-
return discoverApiRoutes({ rootDir: absoluteRoot, appRoot }).sort((left, right) => {
|
|
53
|
-
return left.requestPath.localeCompare(right.requestPath) || left.method.localeCompare(right.method);
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
discoverServerActions() {
|
|
57
|
-
if (!appRoot) return [];
|
|
58
|
-
return discoverServerActions({ rootDir: absoluteRoot, appRoot }).sort(compareByPath);
|
|
59
|
-
},
|
|
60
|
-
analyzeRouteTree(routeOrPageFile) {
|
|
61
|
-
if (!appRoot) return null;
|
|
62
|
-
const key = normalizePath(routeOrPageFile);
|
|
63
|
-
if (routeTreeCache.has(key)) return routeTreeCache.get(key);
|
|
64
|
-
const result = analyzeRouteTree({ project, routeOrPageFile, diagnostics });
|
|
65
|
-
routeTreeCache.set(key, result);
|
|
66
|
-
return result;
|
|
67
|
-
},
|
|
68
|
-
async loadBuildRouting() {
|
|
69
|
-
if (!project.buildDir || !fs.existsSync(project.buildDir)) return null;
|
|
70
|
-
return {
|
|
71
|
-
async resolve(url, pathnames = []) {
|
|
72
|
-
return resolveRoutes({
|
|
73
|
-
url: new URL(url),
|
|
74
|
-
basePath: "",
|
|
75
|
-
requestBody: null,
|
|
76
|
-
headers: new Headers(),
|
|
77
|
-
pathnames,
|
|
78
|
-
routes: {
|
|
79
|
-
beforeMiddleware: [],
|
|
80
|
-
beforeFiles: [],
|
|
81
|
-
afterFiles: [],
|
|
82
|
-
dynamicRoutes: [],
|
|
83
|
-
onMatch: [],
|
|
84
|
-
fallback: [],
|
|
85
|
-
},
|
|
86
|
-
invokeMiddleware: async () => ({}),
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
return project;
|
|
94
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { createNextAnalysisProject } from "./index.mjs";
|
|
4
|
-
|
|
5
|
-
const fixtureRoot = path.resolve(
|
|
6
|
-
"/home/georgedlr/workspace/elench/testkit/test/fixtures/integration/next-route-tree-product"
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
describe("@elench/next-analysis project", () => {
|
|
10
|
-
it("discovers pages, api routes, and route trees from a Next fixture", () => {
|
|
11
|
-
const project = createNextAnalysisProject({ rootDir: fixtureRoot });
|
|
12
|
-
|
|
13
|
-
expect(project.findAppRoot()).toMatch(/src\/app$/u);
|
|
14
|
-
expect(project.discoverPages().map((page) => page.route)).toEqual(["/events", "/projects"]);
|
|
15
|
-
expect(project.discoverApiRoutes().map((route) => `${route.method} ${route.requestPath}`)).toEqual([
|
|
16
|
-
"GET /api/projects",
|
|
17
|
-
"POST /api/projects",
|
|
18
|
-
"GET /api/projects/[projectId]/events",
|
|
19
|
-
]);
|
|
20
|
-
|
|
21
|
-
const routeTree = project.analyzeRouteTree("/projects");
|
|
22
|
-
expect(routeTree.reachableModules).toEqual(
|
|
23
|
-
expect.arrayContaining([
|
|
24
|
-
"src/app/(dashboard)/projects/page.tsx",
|
|
25
|
-
"src/components/project-context.tsx",
|
|
26
|
-
])
|
|
27
|
-
);
|
|
28
|
-
expect(routeTree.requests).toEqual(
|
|
29
|
-
expect.arrayContaining([
|
|
30
|
-
expect.objectContaining({ ownerKind: "page", method: "GET", path: "/api/projects" }),
|
|
31
|
-
expect.objectContaining({ ownerKind: "action", method: "POST", path: "/api/projects" }),
|
|
32
|
-
])
|
|
33
|
-
);
|
|
34
|
-
});
|
|
35
|
-
});
|