@elench/testkit 0.1.65 → 0.1.67
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/README.md +37 -62
- 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/app/doctor.mjs +139 -0
- package/lib/app/typecheck.mjs +203 -0
- package/lib/cli/command-helpers.mjs +2 -10
- package/lib/cli/commands/browser/serve.mjs +3 -62
- package/lib/cli/commands/doctor.mjs +39 -0
- package/lib/cli/commands/typecheck.mjs +28 -0
- package/lib/cli/db.mjs +3 -68
- package/lib/cli/entrypoint.mjs +2 -0
- package/lib/config/binaries.mjs +34 -0
- package/lib/config/database.mjs +9 -6
- package/lib/config/index.mjs +13 -31
- package/lib/config/runtime.mjs +35 -96
- package/lib/config/runtime.test.mjs +26 -0
- 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/index.test.mjs +4 -2
- 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/discovery/file-metadata.mjs +122 -0
- package/lib/discovery/file-metadata.test.mjs +51 -0
- package/lib/discovery/index.mjs +10 -2
- package/lib/discovery/index.test.mjs +19 -19
- 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/planning.mjs +10 -3
- package/lib/runner/planning.test.mjs +26 -0
- 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/setup/index.d.ts +88 -21
- package/lib/setup/index.mjs +177 -50
- package/lib/setup/index.test.mjs +194 -64
- package/lib/shared/build-config.mjs +144 -0
- package/lib/shared/build-config.test.mjs +81 -0
- 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 @@
|
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEpE,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,QAAgB;IAChE,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC5F,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrC,QAAQ,CAAC,GAAG,EAAE,CAAC;IACf,OAAO,sBAAsB,CAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,QAAgB;IAChE,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClF,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACxD,IAA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,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,KAAa;IACzD,OAAO,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NextServerActionEntry } from "./types.js";
|
|
2
|
+
export declare function discoverServerActions({ rootDir, appRoot, exclude, }: {
|
|
3
|
+
rootDir: string;
|
|
4
|
+
appRoot: string;
|
|
5
|
+
exclude?: string[];
|
|
6
|
+
}): NextServerActionEntry[];
|
|
7
|
+
//# sourceMappingURL=server-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-actions.d.ts","sourceRoot":"","sources":["../src/server-actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAWxD,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,OAAO,EACP,OAAY,GACb,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,GAAG,qBAAqB,EAAE,CA6B1B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
import { extractBackendRefs } from "./backend-links.js";
|
|
3
|
+
import { isServerActionFile, isSourceModuleFile, normalizePath, readFileIfExists, walkFiles, } from "./shared.js";
|
|
4
|
+
import { collectExportedCallables, collectTopLevelFunctions, parseModule } from "./swc.js";
|
|
5
|
+
export function discoverServerActions({ rootDir, appRoot, exclude = [], }) {
|
|
6
|
+
const actionEntries = [];
|
|
7
|
+
for (const absolutePath of walkFiles(appRoot, { baseDir: rootDir, exclude })) {
|
|
8
|
+
if (!isSourceModuleFile(absolutePath))
|
|
9
|
+
continue;
|
|
10
|
+
const content = readFileIfExists(absolutePath);
|
|
11
|
+
if (!content)
|
|
12
|
+
continue;
|
|
13
|
+
if (!isServerActionFile(content))
|
|
14
|
+
continue;
|
|
15
|
+
const filePath = normalizePath(path.relative(rootDir, absolutePath));
|
|
16
|
+
const ast = parseModule(content, filePath);
|
|
17
|
+
const topLevelFunctions = collectTopLevelFunctions(ast);
|
|
18
|
+
const { exports } = collectExportedCallables(ast, topLevelFunctions);
|
|
19
|
+
const backendRefs = extractBackendRefs({
|
|
20
|
+
ast,
|
|
21
|
+
rootDir,
|
|
22
|
+
filePath,
|
|
23
|
+
readSourceFile: (targetPath) => readFileIfExists(targetPath),
|
|
24
|
+
});
|
|
25
|
+
for (const [exportName] of exports.entries()) {
|
|
26
|
+
actionEntries.push({
|
|
27
|
+
id: `server-action:${filePath}#${exportName}`,
|
|
28
|
+
kind: "server_action",
|
|
29
|
+
filePath,
|
|
30
|
+
exportName,
|
|
31
|
+
backendRefs,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return actionEntries.sort((left, right) => left.filePath.localeCompare(right.filePath) || left.exportName.localeCompare(right.exportName));
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=server-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-actions.js","sourceRoot":"","sources":["../src/server-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE3F,MAAM,UAAU,qBAAqB,CAAC,EACpC,OAAO,EACP,OAAO,EACP,OAAO,GAAG,EAAE,G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,QAAQ,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;AAC7I,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { NextDiagnostic, NextRequestEntry, NextServerActionRef } from "./types.js";
|
|
2
|
+
export declare const HTTP_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
3
|
+
export declare const HTTP_WRAPPER_METHODS: Record<string, string>;
|
|
4
|
+
export declare const DYNAMIC_SEGMENT_TOKEN = "__TESTKIT_DYNAMIC_SEGMENT__";
|
|
5
|
+
export declare const SURFACE_COMPONENT_NAMES: Set<string>;
|
|
6
|
+
export declare function normalizePath(filePath: string): string;
|
|
7
|
+
export declare function normalizeExcludePaths(exclude?: string[]): string[];
|
|
8
|
+
export declare function normalizeRoute(value: string): string;
|
|
9
|
+
export declare function normalizeRouteSegments(segments: Array<string | null | undefined>): string;
|
|
10
|
+
export declare function toApiRequestPath(route: string): string;
|
|
11
|
+
export declare function pageLabelFromRoute(route: string): string;
|
|
12
|
+
export declare function humanizeTagName(tagName: string): string;
|
|
13
|
+
export declare function dedupeById<T extends {
|
|
14
|
+
id: string;
|
|
15
|
+
}>(entries: T[]): T[];
|
|
16
|
+
export declare function dedupeRequests(requests: NextRequestEntry[]): NextRequestEntry[];
|
|
17
|
+
export declare function dedupeRefs(refs: NextServerActionRef[]): NextServerActionRef[];
|
|
18
|
+
export declare function modulePathKey(filePath: string): string;
|
|
19
|
+
export declare function isServerActionFile(content: string): boolean;
|
|
20
|
+
export declare function isBackendSpecifier(specifier: string): boolean;
|
|
21
|
+
export declare function isDataSpecifier(specifier: string): boolean;
|
|
22
|
+
export declare function isSourceModuleFile(filePath: string): boolean;
|
|
23
|
+
export declare function isPageFile(filePath: string): boolean;
|
|
24
|
+
export declare function isLayoutFile(filePath: string): boolean;
|
|
25
|
+
export declare function isRouteHandlerFile(filePath: string): boolean;
|
|
26
|
+
export declare function fileExists(filePath: string): boolean;
|
|
27
|
+
export declare function shouldExcludePath(relativePath: string, exclude?: string[]): boolean;
|
|
28
|
+
export declare function walkFiles(rootDir: string, options?: {
|
|
29
|
+
baseDir?: string;
|
|
30
|
+
exclude?: string[];
|
|
31
|
+
}): string[];
|
|
32
|
+
export declare function directoryExists(filePath: string): boolean;
|
|
33
|
+
export declare function readFileIfExists(filePath: string): string | null;
|
|
34
|
+
export declare function resolveSourceCandidate(basePath: string): string | null;
|
|
35
|
+
export declare function findLineNumber(content: string, spanStart: number | undefined): number;
|
|
36
|
+
export declare function ensureArray<T>(value: T[] | null | undefined): T[];
|
|
37
|
+
export declare function createDiagnostic({ level, code, message, filePath, line, relatedIds, }: {
|
|
38
|
+
level?: "info" | "warn";
|
|
39
|
+
code: string;
|
|
40
|
+
message: string;
|
|
41
|
+
filePath?: string | null;
|
|
42
|
+
line?: number | null;
|
|
43
|
+
relatedIds?: string[];
|
|
44
|
+
}): NextDiagnostic;
|
|
45
|
+
export declare function compareByRoute(left: {
|
|
46
|
+
route: string;
|
|
47
|
+
filePath: string;
|
|
48
|
+
}, right: {
|
|
49
|
+
route: string;
|
|
50
|
+
filePath: string;
|
|
51
|
+
}): number;
|
|
52
|
+
export declare function compareByPath(left: {
|
|
53
|
+
filePath: string;
|
|
54
|
+
}, right: {
|
|
55
|
+
filePath: string;
|
|
56
|
+
}): number;
|
|
57
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAExF,eAAO,MAAM,YAAY,oDAAqD,CAAC;AAC/E,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMvD,CAAC;AACF,eAAO,MAAM,qBAAqB,gCAAgC,CAAC;AAC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CACvB,GAAG,cAAc,CASjB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE5H;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE7F"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
export const HTTP_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
4
|
+
export const HTTP_WRAPPER_METHODS = {
|
|
5
|
+
getJson: "GET",
|
|
6
|
+
postJson: "POST",
|
|
7
|
+
putJson: "PUT",
|
|
8
|
+
patchJson: "PATCH",
|
|
9
|
+
deleteJson: "DELETE",
|
|
10
|
+
};
|
|
11
|
+
export const DYNAMIC_SEGMENT_TOKEN = "__TESTKIT_DYNAMIC_SEGMENT__";
|
|
12
|
+
export const SURFACE_COMPONENT_NAMES = new Set(["button", "Button", "form", "Form", "a", "Link", "input"]);
|
|
13
|
+
export function normalizePath(filePath) {
|
|
14
|
+
return String(filePath || "").split(path.sep).join("/");
|
|
15
|
+
}
|
|
16
|
+
export function normalizeExcludePaths(exclude = []) {
|
|
17
|
+
return [...new Set((exclude || []).map((entry) => normalizePath(entry).replace(/^\.\/+/u, "")))].filter(Boolean);
|
|
18
|
+
}
|
|
19
|
+
export function normalizeRoute(value) {
|
|
20
|
+
const trimmed = String(value || "/").trim();
|
|
21
|
+
if (!trimmed || trimmed === "/")
|
|
22
|
+
return "/";
|
|
23
|
+
const withLeadingSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
24
|
+
return withLeadingSlash.length > 1 ? withLeadingSlash.replace(/\/+$/u, "") : withLeadingSlash;
|
|
25
|
+
}
|
|
26
|
+
export function normalizeRouteSegments(segments) {
|
|
27
|
+
const normalizedSegments = [...segments]
|
|
28
|
+
.filter(Boolean)
|
|
29
|
+
.map(String)
|
|
30
|
+
.filter((segment) => !segment.startsWith("(") || !segment.endsWith(")"))
|
|
31
|
+
.filter((segment) => !segment.startsWith("@"))
|
|
32
|
+
.filter((segment) => segment !== "page" && segment !== "route" && segment !== "layout");
|
|
33
|
+
return normalizeRoute(`/${normalizedSegments.join("/")}`);
|
|
34
|
+
}
|
|
35
|
+
export function toApiRequestPath(route) {
|
|
36
|
+
return normalizeRoute(`/api${route === "/" ? "" : route}`);
|
|
37
|
+
}
|
|
38
|
+
export function pageLabelFromRoute(route) {
|
|
39
|
+
if (route === "/")
|
|
40
|
+
return "Home";
|
|
41
|
+
return route
|
|
42
|
+
.split("/")
|
|
43
|
+
.filter(Boolean)
|
|
44
|
+
.map((segment) => {
|
|
45
|
+
if (segment.startsWith("[") && segment.endsWith("]"))
|
|
46
|
+
return segment.slice(1, -1);
|
|
47
|
+
return segment;
|
|
48
|
+
})
|
|
49
|
+
.map((segment) => segment.replace(/[-_]+/gu, " "))
|
|
50
|
+
.map((segment) => segment.replace(/^\w/u, (char) => char.toUpperCase()))
|
|
51
|
+
.join(" ");
|
|
52
|
+
}
|
|
53
|
+
export function humanizeTagName(tagName) {
|
|
54
|
+
return String(tagName).replace(/([a-z])([A-Z])/gu, "$1 $2").replace(/^\w/u, (char) => char.toUpperCase());
|
|
55
|
+
}
|
|
56
|
+
export function dedupeById(entries) {
|
|
57
|
+
const seen = new Set();
|
|
58
|
+
return entries.filter((entry) => {
|
|
59
|
+
if (seen.has(entry.id))
|
|
60
|
+
return false;
|
|
61
|
+
seen.add(entry.id);
|
|
62
|
+
return true;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export function dedupeRequests(requests) {
|
|
66
|
+
const seen = new Set();
|
|
67
|
+
return requests.filter((request) => {
|
|
68
|
+
const key = `${request.ownerId}:${request.method}:${request.path}`;
|
|
69
|
+
if (seen.has(key))
|
|
70
|
+
return false;
|
|
71
|
+
seen.add(key);
|
|
72
|
+
return true;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export function dedupeRefs(refs) {
|
|
76
|
+
const seen = new Set();
|
|
77
|
+
return refs.filter((ref) => {
|
|
78
|
+
const key = `${ref.ownerId || ""}:${ref.exportKey || ""}`;
|
|
79
|
+
if (seen.has(key))
|
|
80
|
+
return false;
|
|
81
|
+
seen.add(key);
|
|
82
|
+
return true;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
export function modulePathKey(filePath) {
|
|
86
|
+
const normalized = normalizePath(filePath);
|
|
87
|
+
const ext = path.extname(normalized);
|
|
88
|
+
if (path.basename(normalized, ext) === "index") {
|
|
89
|
+
return normalizePath(path.dirname(normalized));
|
|
90
|
+
}
|
|
91
|
+
return normalized.slice(0, normalized.length - ext.length);
|
|
92
|
+
}
|
|
93
|
+
export function isServerActionFile(content) {
|
|
94
|
+
const trimmed = String(content || "").trimStart();
|
|
95
|
+
return trimmed.startsWith('"use server"') || trimmed.startsWith("'use server'");
|
|
96
|
+
}
|
|
97
|
+
export function isBackendSpecifier(specifier) {
|
|
98
|
+
return (specifier.startsWith("@/backend/server/") ||
|
|
99
|
+
specifier.includes("/backend/server/") ||
|
|
100
|
+
specifier.startsWith("./backend/server/") ||
|
|
101
|
+
specifier.startsWith("../backend/server/"));
|
|
102
|
+
}
|
|
103
|
+
export function isDataSpecifier(specifier) {
|
|
104
|
+
return (specifier.startsWith("@/backend/data/") ||
|
|
105
|
+
specifier.startsWith("@/backend/dal/") ||
|
|
106
|
+
specifier.includes("/backend/data/") ||
|
|
107
|
+
specifier.includes("/backend/dal/") ||
|
|
108
|
+
specifier.includes("/db/") ||
|
|
109
|
+
specifier.includes("/repository/") ||
|
|
110
|
+
specifier.includes("/repositories/"));
|
|
111
|
+
}
|
|
112
|
+
export function isSourceModuleFile(filePath) {
|
|
113
|
+
return /\.(?:ts|tsx|js|jsx|mjs)$/u.test(filePath);
|
|
114
|
+
}
|
|
115
|
+
export function isPageFile(filePath) {
|
|
116
|
+
return /\/page\.(?:ts|tsx|js|jsx)$/u.test(normalizePath(filePath));
|
|
117
|
+
}
|
|
118
|
+
export function isLayoutFile(filePath) {
|
|
119
|
+
return /\/layout\.(?:ts|tsx|js|jsx)$/u.test(normalizePath(filePath));
|
|
120
|
+
}
|
|
121
|
+
export function isRouteHandlerFile(filePath) {
|
|
122
|
+
return /\/route\.(?:ts|tsx|js|jsx)$/u.test(normalizePath(filePath));
|
|
123
|
+
}
|
|
124
|
+
export function fileExists(filePath) {
|
|
125
|
+
try {
|
|
126
|
+
return fs.existsSync(filePath) && fs.statSync(filePath).isFile();
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export function shouldExcludePath(relativePath, exclude = []) {
|
|
133
|
+
const normalizedPath = normalizePath(relativePath).replace(/^\.\/+/u, "");
|
|
134
|
+
if (!normalizedPath || normalizedPath === ".")
|
|
135
|
+
return false;
|
|
136
|
+
return exclude.some((pattern) => normalizedPath === pattern || normalizedPath.startsWith(`${pattern}/`));
|
|
137
|
+
}
|
|
138
|
+
export function walkFiles(rootDir, options = {}) {
|
|
139
|
+
if (!directoryExists(rootDir))
|
|
140
|
+
return [];
|
|
141
|
+
const baseDir = options.baseDir || rootDir;
|
|
142
|
+
const exclude = normalizeExcludePaths(options.exclude || []);
|
|
143
|
+
const results = [];
|
|
144
|
+
const queue = [rootDir];
|
|
145
|
+
while (queue.length > 0) {
|
|
146
|
+
const current = queue.pop();
|
|
147
|
+
if (!current)
|
|
148
|
+
continue;
|
|
149
|
+
for (const entry of fs.readdirSync(current, { withFileTypes: true })) {
|
|
150
|
+
if (entry.isSymbolicLink())
|
|
151
|
+
continue;
|
|
152
|
+
const absolutePath = path.join(current, entry.name);
|
|
153
|
+
if (entry.isDirectory()) {
|
|
154
|
+
const relativeDirPath = normalizePath(path.relative(baseDir, absolutePath));
|
|
155
|
+
if (shouldExcludePath(relativeDirPath, exclude))
|
|
156
|
+
continue;
|
|
157
|
+
queue.push(absolutePath);
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (entry.isFile()) {
|
|
161
|
+
const relativeFilePath = normalizePath(path.relative(baseDir, absolutePath));
|
|
162
|
+
if (shouldExcludePath(relativeFilePath, exclude))
|
|
163
|
+
continue;
|
|
164
|
+
results.push(absolutePath);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return results.sort((left, right) => left.localeCompare(right));
|
|
169
|
+
}
|
|
170
|
+
export function directoryExists(filePath) {
|
|
171
|
+
try {
|
|
172
|
+
return fs.existsSync(filePath) && fs.statSync(filePath).isDirectory();
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
export function readFileIfExists(filePath) {
|
|
179
|
+
return fileExists(filePath) ? fs.readFileSync(filePath, "utf8") : null;
|
|
180
|
+
}
|
|
181
|
+
export function resolveSourceCandidate(basePath) {
|
|
182
|
+
const direct = [basePath, `${basePath}.ts`, `${basePath}.tsx`, `${basePath}.js`, `${basePath}.jsx`, `${basePath}.mjs`];
|
|
183
|
+
for (const candidate of direct) {
|
|
184
|
+
if (fileExists(candidate))
|
|
185
|
+
return candidate;
|
|
186
|
+
}
|
|
187
|
+
const indexed = [
|
|
188
|
+
path.join(basePath, "index.ts"),
|
|
189
|
+
path.join(basePath, "index.tsx"),
|
|
190
|
+
path.join(basePath, "index.js"),
|
|
191
|
+
path.join(basePath, "index.jsx"),
|
|
192
|
+
path.join(basePath, "index.mjs"),
|
|
193
|
+
];
|
|
194
|
+
for (const candidate of indexed) {
|
|
195
|
+
if (fileExists(candidate))
|
|
196
|
+
return candidate;
|
|
197
|
+
}
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
export function findLineNumber(content, spanStart) {
|
|
201
|
+
const source = String(content || "");
|
|
202
|
+
const target = Math.max(0, Number(spanStart || 0) - 1);
|
|
203
|
+
let line = 1;
|
|
204
|
+
for (let index = 0; index < source.length && index < target; index += 1) {
|
|
205
|
+
if (source[index] === "\n")
|
|
206
|
+
line += 1;
|
|
207
|
+
}
|
|
208
|
+
return line;
|
|
209
|
+
}
|
|
210
|
+
export function ensureArray(value) {
|
|
211
|
+
return Array.isArray(value) ? value : [];
|
|
212
|
+
}
|
|
213
|
+
export function createDiagnostic({ level = "info", code, message, filePath = null, line = null, relatedIds = [], }) {
|
|
214
|
+
return {
|
|
215
|
+
level,
|
|
216
|
+
code,
|
|
217
|
+
message,
|
|
218
|
+
...(filePath ? { filePath } : {}),
|
|
219
|
+
...(line ? { line } : {}),
|
|
220
|
+
...(relatedIds.length > 0 ? { relatedIds } : {}),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
export function compareByRoute(left, right) {
|
|
224
|
+
return left.route.localeCompare(right.route) || left.filePath.localeCompare(right.filePath);
|
|
225
|
+
}
|
|
226
|
+
export function compareByPath(left, right) {
|
|
227
|
+
return left.filePath.localeCompare(right.filePath);
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AAC/E,MAAM,CAAC,MAAM,oBAAoB,GAA2B;IAC1D,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,MAAM;IAChB,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+
};
|
|
9
|
+
type SwcModule = {
|
|
10
|
+
body?: SwcNode[];
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
export declare function parseModule(content: string, filePath: string): SwcModule;
|
|
14
|
+
export declare function resolveImportToSourceFile(rootDir: string, fromFilePath: string, specifier: string): string | null;
|
|
15
|
+
export declare function collectImports(ast: SwcModule, { rootDir, filePath, readSourceFile }?: {
|
|
16
|
+
rootDir?: string;
|
|
17
|
+
filePath?: string;
|
|
18
|
+
readSourceFile?: (filePath: string) => string | null;
|
|
19
|
+
}): Map<string, JSImportRecord>;
|
|
20
|
+
export declare function collectTopLevelFunctions(ast: SwcModule): Map<string, SwcNode>;
|
|
21
|
+
export declare function collectExportedCallables(ast: SwcModule, topLevelFunctions: Map<string, SwcNode>): {
|
|
22
|
+
exports: Map<string, SwcNode>;
|
|
23
|
+
defaultExport: SwcNode | null;
|
|
24
|
+
};
|
|
25
|
+
export declare function collectScopeLocalFunctions(node: SwcNode): Map<string, SwcNode>;
|
|
26
|
+
export declare function collectJsxAttributes(opening: SwcNode): Record<string, {
|
|
27
|
+
stringValue: string | null;
|
|
28
|
+
expression: SwcNode | null;
|
|
29
|
+
}>;
|
|
30
|
+
export declare function flattenJsxText(children?: SwcNode[]): string;
|
|
31
|
+
export declare function extractJsxLabel(node: SwcNode, attributes: Record<string, {
|
|
32
|
+
stringValue: string | null;
|
|
33
|
+
}>): string | null;
|
|
34
|
+
export declare function walkJsx(node: SwcNode, visitor: (node: SwcNode, formContext: unknown) => unknown): void;
|
|
35
|
+
export declare function forEachChild(node: SwcNode, visitor: (child: SwcNode) => void): void;
|
|
36
|
+
export declare function extractStringLiteral(node: SwcNode | undefined | null): string | null;
|
|
37
|
+
export declare function extractRouteLiteral(node: SwcNode | undefined | null): string | null;
|
|
38
|
+
export declare function extractFetchMethod(node: SwcNode | undefined | null): string | null;
|
|
39
|
+
export declare function extractHttpRequests(rootNode: SwcNode): Array<{
|
|
40
|
+
method: string;
|
|
41
|
+
path: string;
|
|
42
|
+
confidence: "high";
|
|
43
|
+
}>;
|
|
44
|
+
export declare function resolveHttpRequestCall(callExpression: SwcNode): {
|
|
45
|
+
method: string;
|
|
46
|
+
path: string;
|
|
47
|
+
confidence: "high";
|
|
48
|
+
} | null;
|
|
49
|
+
export declare function extractPlaywrightVisitedRoutes(rootNode: SwcNode): string[];
|
|
50
|
+
export declare function walkNode(node: SwcNode, visitor: (node: SwcNode) => void): void;
|
|
51
|
+
export declare function extractLineNumber(content: string, node: SwcNode): number;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=swc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swc.d.ts","sourceRoot":"","sources":["../src/swc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAa1D,KAAK,OAAO,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAC;AAChF,KAAK,SAAS,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAC;AAE1D,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAMxE;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmBjH;AAED,wBAAgB,cAAc,CAC5B,GAAG,EAAE,SAAS,EACd,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAiC,EAAE,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAA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