@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
|
@@ -4,7 +4,14 @@ import path from "path";
|
|
|
4
4
|
import { build } from "esbuild";
|
|
5
5
|
import { execa, execaCommand } from "execa";
|
|
6
6
|
import { fileURLToPath } from "url";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
collectConfiguredInputs,
|
|
9
|
+
parseModuleSpecifier,
|
|
10
|
+
resolveConfiguredCwd,
|
|
11
|
+
resolveConfiguredPath,
|
|
12
|
+
summarizeConfiguredStep,
|
|
13
|
+
} from "../shared/configured-steps.mjs";
|
|
14
|
+
export { collectConfiguredInputs, parseModuleSpecifier, resolveConfiguredCwd, resolveConfiguredPath } from "../shared/configured-steps.mjs";
|
|
8
15
|
import {
|
|
9
16
|
announceResolvedToolchain,
|
|
10
17
|
applyToolchainEnv,
|
|
@@ -72,35 +79,6 @@ export async function runConfiguredSteps({
|
|
|
72
79
|
}
|
|
73
80
|
}
|
|
74
81
|
|
|
75
|
-
export function collectConfiguredInputs(productDir, { inputs = [], steps = [] } = {}) {
|
|
76
|
-
const collected = new Set();
|
|
77
|
-
for (const input of inputs) {
|
|
78
|
-
collected.add(resolveConfiguredPath(productDir, null, input));
|
|
79
|
-
}
|
|
80
|
-
for (const step of steps) {
|
|
81
|
-
if (step.kind === "sql-file") {
|
|
82
|
-
collected.add(resolveConfiguredPath(productDir, step.cwd, step.path));
|
|
83
|
-
}
|
|
84
|
-
if (step.kind === "module") {
|
|
85
|
-
collected.add(
|
|
86
|
-
resolveConfiguredPath(productDir, step.cwd, parseModuleSpecifier(step.specifier).modulePath)
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
for (const input of step.inputs || []) {
|
|
90
|
-
collected.add(resolveConfiguredPath(productDir, step.cwd, input));
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return [...collected].sort();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export function resolveConfiguredCwd(productDir, stepCwd) {
|
|
97
|
-
return resolveServiceCwd(productDir, stepCwd || ".");
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export function resolveConfiguredPath(productDir, stepCwd, targetPath) {
|
|
101
|
-
return path.resolve(resolveConfiguredCwd(productDir, stepCwd), targetPath);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
82
|
async function runConfiguredStep(config, step, env, resolvedToolchain, options = {}) {
|
|
105
83
|
const runtimeEnv = applyToolchainEnv(env, resolvedToolchain);
|
|
106
84
|
const cwd = resolveConfiguredCwd(config.productDir, step.cwd);
|
|
@@ -253,21 +231,6 @@ function resolvePackageSubpath(specifier) {
|
|
|
253
231
|
throw new Error(`Unsupported @elench/testkit import "${specifier}" while loading template step`);
|
|
254
232
|
}
|
|
255
233
|
|
|
256
|
-
function parseModuleSpecifier(specifier) {
|
|
257
|
-
const [modulePath, exportName] = String(specifier).split("#", 2);
|
|
258
|
-
return {
|
|
259
|
-
modulePath,
|
|
260
|
-
exportName: exportName || "default",
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
function summarizeConfiguredStep(step) {
|
|
265
|
-
if (step.kind === "command") return `command: ${String(step.cmd).trim()}`;
|
|
266
|
-
if (step.kind === "sql-file") return `sql: ${step.path}`;
|
|
267
|
-
if (step.kind === "module") return `module: ${step.specifier}`;
|
|
268
|
-
return step.kind;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
234
|
async function awaitCapturedProcess(child, { livePrefix = "", liveWriter = null, logRecord = null } = {}) {
|
|
272
235
|
const drains = [
|
|
273
236
|
captureProcessOutput(child.stdout, "stdout", livePrefix, liveWriter, logRecord),
|
package/lib/runner/template.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
+
import { finalizeConfiguredInputs, finalizeConfiguredSteps } from "../shared/configured-steps.mjs";
|
|
2
3
|
import { readDatabaseInfo } from "./state-io.mjs";
|
|
3
4
|
|
|
4
5
|
const PORT_STRIDE = 100;
|
|
@@ -183,22 +184,11 @@ function finalizeDatabaseTemplate(template, context) {
|
|
|
183
184
|
};
|
|
184
185
|
}
|
|
185
186
|
|
|
186
|
-
const finalizeStep = (step) => ({
|
|
187
|
-
...step,
|
|
188
|
-
...(typeof step.cmd === "string" ? { cmd: finalizeString(step.cmd, context) } : {}),
|
|
189
|
-
...(typeof step.cwd === "string" ? { cwd: finalizeString(step.cwd, context) } : {}),
|
|
190
|
-
...(typeof step.path === "string" ? { path: finalizeString(step.path, context) } : {}),
|
|
191
|
-
...(typeof step.specifier === "string"
|
|
192
|
-
? { specifier: finalizeString(step.specifier, context) }
|
|
193
|
-
: {}),
|
|
194
|
-
inputs: (step.inputs || []).map((input) => finalizeString(input, context)),
|
|
195
|
-
});
|
|
196
|
-
|
|
197
187
|
return {
|
|
198
|
-
inputs: (template.inputs || []
|
|
199
|
-
migrate: (template.migrate || [])
|
|
200
|
-
seed: (template.seed || [])
|
|
201
|
-
verify: (template.verify || [])
|
|
188
|
+
inputs: finalizeConfiguredInputs(template.inputs || [], (value) => finalizeString(value, context)),
|
|
189
|
+
migrate: finalizeConfiguredSteps(template.migrate || [], (value) => finalizeString(value, context)),
|
|
190
|
+
seed: finalizeConfiguredSteps(template.seed || [], (value) => finalizeString(value, context)),
|
|
191
|
+
verify: finalizeConfiguredSteps(template.verify || [], (value) => finalizeString(value, context)),
|
|
202
192
|
};
|
|
203
193
|
}
|
|
204
194
|
|
|
@@ -356,20 +346,9 @@ function finalizeRuntimePrepare(prepare, context) {
|
|
|
356
346
|
};
|
|
357
347
|
}
|
|
358
348
|
|
|
359
|
-
const finalizeStep = (step) => ({
|
|
360
|
-
...step,
|
|
361
|
-
...(typeof step.cmd === "string" ? { cmd: finalizeString(step.cmd, context) } : {}),
|
|
362
|
-
...(typeof step.cwd === "string" ? { cwd: finalizeString(step.cwd, context) } : {}),
|
|
363
|
-
...(typeof step.path === "string" ? { path: finalizeString(step.path, context) } : {}),
|
|
364
|
-
...(typeof step.specifier === "string"
|
|
365
|
-
? { specifier: finalizeString(step.specifier, context) }
|
|
366
|
-
: {}),
|
|
367
|
-
inputs: (step.inputs || []).map((input) => finalizeString(input, context)),
|
|
368
|
-
});
|
|
369
|
-
|
|
370
349
|
return {
|
|
371
|
-
inputs: (prepare.inputs || []
|
|
372
|
-
steps: (prepare.steps || [])
|
|
350
|
+
inputs: finalizeConfiguredInputs(prepare.inputs || [], (value) => finalizeString(value, context)),
|
|
351
|
+
steps: finalizeConfiguredSteps(prepare.steps || [], (value) => finalizeString(value, context)),
|
|
373
352
|
};
|
|
374
353
|
}
|
|
375
354
|
|
package/lib/setup/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface DatabaseTemplateConfig {
|
|
|
7
7
|
verify?: TemplateLifecycleStepConfig[];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export interface
|
|
10
|
+
export interface DatabaseTemplateOptions {
|
|
11
11
|
inputs?: string[];
|
|
12
12
|
schema?: string | TemplateSqlFileStepConfig;
|
|
13
13
|
migrate?: TemplateLifecycleStepConfig | TemplateLifecycleStepConfig[];
|
|
@@ -40,6 +40,30 @@ export type TemplateLifecycleStepConfig =
|
|
|
40
40
|
| TemplateSqlFileStepConfig
|
|
41
41
|
| TemplateModuleStepConfig;
|
|
42
42
|
|
|
43
|
+
export interface TscBuildConfig {
|
|
44
|
+
kind: "tsc";
|
|
45
|
+
cwd?: string;
|
|
46
|
+
entry?: string;
|
|
47
|
+
inputs?: string[];
|
|
48
|
+
outDir?: string;
|
|
49
|
+
tsconfig?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ScriptBuildConfig {
|
|
53
|
+
kind: "script";
|
|
54
|
+
cwd?: string;
|
|
55
|
+
inputs?: string[];
|
|
56
|
+
script: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface StepsBuildConfig {
|
|
60
|
+
kind: "steps";
|
|
61
|
+
inputs?: string[];
|
|
62
|
+
steps?: TemplateLifecycleStepConfig[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type BuildConfig = TscBuildConfig | ScriptBuildConfig | StepsBuildConfig;
|
|
66
|
+
|
|
43
67
|
export interface LocalDatabaseConfig {
|
|
44
68
|
provider: "local";
|
|
45
69
|
binding?: "shared" | "per-runtime";
|
|
@@ -66,6 +90,7 @@ export interface SkipConfig {
|
|
|
66
90
|
}
|
|
67
91
|
|
|
68
92
|
export interface RuntimeConfig {
|
|
93
|
+
build?: BuildConfig | null;
|
|
69
94
|
instances?: number;
|
|
70
95
|
maxConcurrentTasks?: number;
|
|
71
96
|
prepare?: {
|
|
@@ -126,7 +151,6 @@ export interface ServiceConfig {
|
|
|
126
151
|
databaseFrom?: string;
|
|
127
152
|
dependsOn?: string[];
|
|
128
153
|
discovery?: DiscoveryConfig;
|
|
129
|
-
env?: Record<string, string>;
|
|
130
154
|
envFile?: string;
|
|
131
155
|
envFiles?: string[];
|
|
132
156
|
browser?: BrowserServiceConfig;
|
|
@@ -144,6 +168,44 @@ export interface ServiceConfig {
|
|
|
144
168
|
skip?: SkipConfig;
|
|
145
169
|
}
|
|
146
170
|
|
|
171
|
+
export interface TestkitFileMetadata {
|
|
172
|
+
locks?: string[];
|
|
173
|
+
skip?: string | { reason: string };
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface NodeAppOptions extends Omit<ServiceConfig, "local" | "runtime"> {
|
|
177
|
+
baseUrl?: string;
|
|
178
|
+
build?: BuildConfig | null;
|
|
179
|
+
buildInputs?: string[];
|
|
180
|
+
cwd?: string;
|
|
181
|
+
entry?: string;
|
|
182
|
+
env?: Record<string, string>;
|
|
183
|
+
outDir?: string;
|
|
184
|
+
port: number;
|
|
185
|
+
readyPath?: string;
|
|
186
|
+
readyTimeoutMs?: number;
|
|
187
|
+
readyUrl?: string;
|
|
188
|
+
runtime?: Omit<RuntimeConfig, "build">;
|
|
189
|
+
start?: string;
|
|
190
|
+
toolchain?: string | NodeToolchainConfig;
|
|
191
|
+
tsconfig?: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface NextAppOptions extends Omit<ServiceConfig, "local" | "runtime"> {
|
|
195
|
+
baseUrl?: string;
|
|
196
|
+
build?: BuildConfig | null;
|
|
197
|
+
buildInputs?: string[];
|
|
198
|
+
cwd?: string;
|
|
199
|
+
env?: Record<string, string>;
|
|
200
|
+
mode?: "dev" | "start";
|
|
201
|
+
port: number;
|
|
202
|
+
readyTimeoutMs?: number;
|
|
203
|
+
readyUrl?: string;
|
|
204
|
+
runtime?: Omit<RuntimeConfig, "build">;
|
|
205
|
+
start?: string;
|
|
206
|
+
toolchain?: string | NodeToolchainConfig;
|
|
207
|
+
}
|
|
208
|
+
|
|
147
209
|
export interface TestkitSetup {
|
|
148
210
|
discovery?: DiscoveryConfig;
|
|
149
211
|
execution?: TestkitExecutionConfig;
|
|
@@ -166,8 +228,8 @@ export interface TestkitSetup {
|
|
|
166
228
|
|
|
167
229
|
export declare function defineTestkitSetup<T extends TestkitSetup>(setup: T): T;
|
|
168
230
|
export declare function defineHttpProfile<T extends HttpSuiteConfig>(profile: T): T;
|
|
169
|
-
export declare function
|
|
170
|
-
export declare function
|
|
231
|
+
export declare function defineTestkitFile<T extends TestkitFileMetadata>(metadata: T): T;
|
|
232
|
+
export declare function postgresDatabase(options?: Omit<LocalDatabaseConfig, "provider">): LocalDatabaseConfig;
|
|
171
233
|
export declare function commandStep(
|
|
172
234
|
cmd: string,
|
|
173
235
|
options?: Omit<TemplateCommandStepConfig, "kind" | "cmd">
|
|
@@ -200,24 +262,29 @@ export declare function verifyModule(
|
|
|
200
262
|
specifier: string,
|
|
201
263
|
options?: Omit<TemplateModuleStepConfig, "kind" | "specifier">
|
|
202
264
|
): TemplateModuleStepConfig;
|
|
203
|
-
export declare function
|
|
204
|
-
options?:
|
|
205
|
-
):
|
|
265
|
+
export declare function templateDatabase(
|
|
266
|
+
options?: DatabaseTemplateOptions & Omit<LocalDatabaseConfig, "provider" | "template">
|
|
267
|
+
): LocalDatabaseConfig;
|
|
268
|
+
export declare function postgresFixture(
|
|
269
|
+
options?: Omit<LocalDatabaseConfig, "provider"> & {
|
|
270
|
+
discovery?: DiscoveryConfig;
|
|
271
|
+
envFiles?: string[];
|
|
272
|
+
}
|
|
273
|
+
): ServiceConfig;
|
|
274
|
+
export declare function databaseServiceEnv(
|
|
275
|
+
prefix: string,
|
|
276
|
+
serviceName: string
|
|
277
|
+
): Record<string, string>;
|
|
206
278
|
export declare function nodeToolchain(options?: NodeToolchainConfig): NodeToolchainConfig;
|
|
207
|
-
export declare function
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
export declare function
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
export declare function tsxService(options: ServiceConfig["local"] & {
|
|
217
|
-
entry?: string;
|
|
218
|
-
envFiles?: string[];
|
|
219
|
-
readyPath?: string;
|
|
220
|
-
}): ServiceConfig;
|
|
279
|
+
export declare function tscBuild(options?: Omit<TscBuildConfig, "kind">): TscBuildConfig;
|
|
280
|
+
export declare function scriptBuild(
|
|
281
|
+
script: string,
|
|
282
|
+
options?: Omit<ScriptBuildConfig, "kind" | "script">
|
|
283
|
+
): ScriptBuildConfig;
|
|
284
|
+
export declare function stepsBuild(options?: Omit<StepsBuildConfig, "kind">): StepsBuildConfig;
|
|
285
|
+
export declare function nextBuild(options?: Omit<ScriptBuildConfig, "kind" | "script">): ScriptBuildConfig;
|
|
286
|
+
export declare function nodeApp(options: NodeAppOptions): ServiceConfig;
|
|
287
|
+
export declare function nextApp(options: NextAppOptions): ServiceConfig;
|
|
221
288
|
export declare function clerkSessionProfile(options?: {
|
|
222
289
|
apiBase?: string;
|
|
223
290
|
needsAuth?: boolean;
|
package/lib/setup/index.mjs
CHANGED
|
@@ -18,11 +18,11 @@ export function defineHttpProfile(profile) {
|
|
|
18
18
|
return profile || {};
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export function
|
|
22
|
-
return
|
|
21
|
+
export function defineTestkitFile(metadata) {
|
|
22
|
+
return metadata || {};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export function
|
|
25
|
+
export function postgresDatabase(options = {}) {
|
|
26
26
|
return {
|
|
27
27
|
provider: "local",
|
|
28
28
|
...options,
|
|
@@ -76,7 +76,7 @@ export function verifyModule(specifier, options = {}) {
|
|
|
76
76
|
return moduleStep(specifier, options);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
function buildDatabaseTemplateConfig(options = {}) {
|
|
80
80
|
const migrate = normalizeTemplateStepList(options.migrate);
|
|
81
81
|
const seed = normalizeTemplateStepList(options.seed);
|
|
82
82
|
const verify = normalizeTemplateStepList(options.verify);
|
|
@@ -90,6 +90,52 @@ export function seededDatabaseTemplate(options = {}) {
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
export function templateDatabase(options = {}) {
|
|
94
|
+
const {
|
|
95
|
+
inputs,
|
|
96
|
+
schema,
|
|
97
|
+
migrate,
|
|
98
|
+
seed,
|
|
99
|
+
verify,
|
|
100
|
+
...databaseOptions
|
|
101
|
+
} = options;
|
|
102
|
+
return postgresDatabase({
|
|
103
|
+
...databaseOptions,
|
|
104
|
+
template: buildDatabaseTemplateConfig(options.template || { inputs, schema, migrate, seed, verify }),
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function postgresFixture(options = {}) {
|
|
109
|
+
const { discovery, envFiles, ...databaseOptions } = options;
|
|
110
|
+
return {
|
|
111
|
+
discovery: discovery || {
|
|
112
|
+
roots: [".testkit-fixture"],
|
|
113
|
+
},
|
|
114
|
+
envFiles,
|
|
115
|
+
local: false,
|
|
116
|
+
database: postgresDatabase(databaseOptions),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function databaseServiceEnv(prefix, serviceName) {
|
|
121
|
+
const normalizedPrefix = String(prefix || "").trim().replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
122
|
+
if (!normalizedPrefix) {
|
|
123
|
+
throw new Error("databaseServiceEnv prefix must be a non-empty string");
|
|
124
|
+
}
|
|
125
|
+
if (!serviceName || !String(serviceName).trim()) {
|
|
126
|
+
throw new Error("databaseServiceEnv serviceName must be a non-empty string");
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
[`${normalizedPrefix}_DATABASE_HOST`]: `{dbHost:${serviceName}}`,
|
|
131
|
+
[`${normalizedPrefix}_DATABASE_PORT`]: `{dbPort:${serviceName}}`,
|
|
132
|
+
[`${normalizedPrefix}_DATABASE_NAME`]: `{dbName:${serviceName}}`,
|
|
133
|
+
[`${normalizedPrefix}_DATABASE_USER`]: `{dbUser:${serviceName}}`,
|
|
134
|
+
[`${normalizedPrefix}_DATABASE_PASSWORD`]: `{dbPassword:${serviceName}}`,
|
|
135
|
+
[`${normalizedPrefix}_DATABASE_SSL`]: "0",
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
93
139
|
export function nodeToolchain(options = {}) {
|
|
94
140
|
return {
|
|
95
141
|
kind: "node",
|
|
@@ -97,61 +143,137 @@ export function nodeToolchain(options = {}) {
|
|
|
97
143
|
};
|
|
98
144
|
}
|
|
99
145
|
|
|
100
|
-
export function
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
146
|
+
export function tscBuild(options = {}) {
|
|
147
|
+
return {
|
|
148
|
+
kind: "tsc",
|
|
149
|
+
cwd: options.cwd,
|
|
150
|
+
entry: options.entry || "src/index.ts",
|
|
151
|
+
tsconfig: options.tsconfig || "tsconfig.json",
|
|
152
|
+
outDir: options.outDir || "dist",
|
|
153
|
+
inputs: Array.isArray(options.inputs) ? [...options.inputs] : undefined,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
105
156
|
|
|
157
|
+
export function scriptBuild(script, options = {}) {
|
|
106
158
|
return {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
159
|
+
kind: "script",
|
|
160
|
+
script,
|
|
161
|
+
cwd: options.cwd,
|
|
162
|
+
inputs: Array.isArray(options.inputs) ? [...options.inputs] : undefined,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function stepsBuild(options = {}) {
|
|
167
|
+
return {
|
|
168
|
+
kind: "steps",
|
|
169
|
+
inputs: Array.isArray(options.inputs) ? [...options.inputs] : undefined,
|
|
170
|
+
steps: Array.isArray(options.steps) ? [...options.steps] : [],
|
|
117
171
|
};
|
|
118
172
|
}
|
|
119
173
|
|
|
120
|
-
export function
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
174
|
+
export function nextBuild(options = {}) {
|
|
175
|
+
return scriptBuild("./node_modules/.bin/next build", options);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function nodeApp(options = {}) {
|
|
179
|
+
const {
|
|
180
|
+
baseUrl: explicitBaseUrl,
|
|
181
|
+
build: explicitBuild,
|
|
182
|
+
buildInputs,
|
|
183
|
+
cwd = ".",
|
|
184
|
+
entry = "src/index.ts",
|
|
185
|
+
env = {},
|
|
186
|
+
envFiles,
|
|
187
|
+
outDir = "dist",
|
|
188
|
+
port,
|
|
189
|
+
readyPath = "/health",
|
|
190
|
+
readyTimeoutMs,
|
|
191
|
+
readyUrl: explicitReadyUrl,
|
|
192
|
+
runtime,
|
|
193
|
+
start: explicitStart,
|
|
194
|
+
toolchain,
|
|
195
|
+
tsconfig = "tsconfig.json",
|
|
196
|
+
...serviceConfig
|
|
197
|
+
} = options;
|
|
198
|
+
|
|
199
|
+
const normalizedPort = requiredNumber(port, "nodeApp port");
|
|
200
|
+
const baseUrl = explicitBaseUrl || "http://127.0.0.1:{port}";
|
|
201
|
+
const build = explicitBuild === undefined ? tscBuild({
|
|
202
|
+
cwd,
|
|
203
|
+
entry,
|
|
204
|
+
tsconfig,
|
|
205
|
+
outDir,
|
|
206
|
+
inputs: buildInputs,
|
|
207
|
+
}) : explicitBuild;
|
|
208
|
+
const start = explicitStart || resolveNodeAppStart(build, entry);
|
|
124
209
|
|
|
125
210
|
return {
|
|
126
|
-
...
|
|
211
|
+
...serviceConfig,
|
|
212
|
+
envFiles,
|
|
213
|
+
runtime: {
|
|
214
|
+
...(runtime || {}),
|
|
215
|
+
build,
|
|
216
|
+
toolchain: toolchain ?? runtime?.toolchain,
|
|
217
|
+
},
|
|
127
218
|
local: {
|
|
128
219
|
cwd,
|
|
129
|
-
start
|
|
130
|
-
port,
|
|
220
|
+
start,
|
|
221
|
+
port: normalizedPort,
|
|
131
222
|
baseUrl,
|
|
132
|
-
readyUrl:
|
|
133
|
-
readyTimeoutMs
|
|
134
|
-
env
|
|
223
|
+
readyUrl: explicitReadyUrl || `${baseUrl}${readyPath}`,
|
|
224
|
+
readyTimeoutMs,
|
|
225
|
+
env,
|
|
135
226
|
},
|
|
136
227
|
};
|
|
137
228
|
}
|
|
138
229
|
|
|
139
|
-
export function
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
230
|
+
export function nextApp(options = {}) {
|
|
231
|
+
const {
|
|
232
|
+
baseUrl: explicitBaseUrl,
|
|
233
|
+
browser,
|
|
234
|
+
build: explicitBuild,
|
|
235
|
+
buildInputs,
|
|
236
|
+
cwd = ".",
|
|
237
|
+
dependsOn,
|
|
238
|
+
env = {},
|
|
239
|
+
envFiles,
|
|
240
|
+
mode = "dev",
|
|
241
|
+
port,
|
|
242
|
+
readyTimeoutMs,
|
|
243
|
+
readyUrl: explicitReadyUrl,
|
|
244
|
+
runtime,
|
|
245
|
+
start: explicitStart,
|
|
246
|
+
toolchain,
|
|
247
|
+
...serviceConfig
|
|
248
|
+
} = options;
|
|
249
|
+
|
|
250
|
+
const normalizedPort = requiredNumber(port, "nextApp port");
|
|
251
|
+
const baseUrl = explicitBaseUrl || "http://127.0.0.1:{port}";
|
|
252
|
+
const build = mode === "start" ? explicitBuild || nextBuild({ cwd, inputs: buildInputs }) : explicitBuild || null;
|
|
253
|
+
const start =
|
|
254
|
+
explicitStart ||
|
|
255
|
+
(mode === "start"
|
|
256
|
+
? "./node_modules/.bin/next start --port {port}"
|
|
257
|
+
: "./node_modules/.bin/next dev -p {port}");
|
|
144
258
|
|
|
145
259
|
return {
|
|
146
|
-
...
|
|
260
|
+
...serviceConfig,
|
|
261
|
+
envFiles,
|
|
262
|
+
dependsOn: Array.isArray(dependsOn) ? [...dependsOn] : dependsOn,
|
|
263
|
+
browser,
|
|
264
|
+
runtime: {
|
|
265
|
+
...(runtime || {}),
|
|
266
|
+
build,
|
|
267
|
+
toolchain: toolchain ?? runtime?.toolchain,
|
|
268
|
+
},
|
|
147
269
|
local: {
|
|
148
270
|
cwd,
|
|
149
|
-
start
|
|
150
|
-
port,
|
|
271
|
+
start,
|
|
272
|
+
port: normalizedPort,
|
|
151
273
|
baseUrl,
|
|
152
|
-
readyUrl:
|
|
153
|
-
readyTimeoutMs
|
|
154
|
-
env
|
|
274
|
+
readyUrl: explicitReadyUrl || baseUrl,
|
|
275
|
+
readyTimeoutMs,
|
|
276
|
+
env,
|
|
155
277
|
},
|
|
156
278
|
};
|
|
157
279
|
}
|
|
@@ -235,16 +357,6 @@ export {
|
|
|
235
357
|
runtimeJson,
|
|
236
358
|
};
|
|
237
359
|
|
|
238
|
-
function defaultGoStartCommand(options) {
|
|
239
|
-
if (options.command) {
|
|
240
|
-
return `go run ${options.command}`;
|
|
241
|
-
}
|
|
242
|
-
if (options.entrypoint) {
|
|
243
|
-
return `go run ${options.entrypoint}`;
|
|
244
|
-
}
|
|
245
|
-
return "go run ./cmd/server";
|
|
246
|
-
}
|
|
247
|
-
|
|
248
360
|
function requiredNumber(value, label) {
|
|
249
361
|
if (!Number.isInteger(value) || value <= 0) {
|
|
250
362
|
throw new Error(`${label} must be a positive integer`);
|
|
@@ -252,6 +364,14 @@ function requiredNumber(value, label) {
|
|
|
252
364
|
return value;
|
|
253
365
|
}
|
|
254
366
|
|
|
367
|
+
function resolveNodeAppStart(build, entry) {
|
|
368
|
+
if (build?.kind === "tsc") {
|
|
369
|
+
const compiled = compiledEntryFromSource(entry || build.entry || "src/index.ts", build.outDir || "dist");
|
|
370
|
+
return `node {prepareDir}/${compiled}`;
|
|
371
|
+
}
|
|
372
|
+
return `./node_modules/.bin/tsx ${entry || "src/index.ts"}`;
|
|
373
|
+
}
|
|
374
|
+
|
|
255
375
|
function normalizeTemplateStepList(value) {
|
|
256
376
|
if (value == null) return [];
|
|
257
377
|
return Array.isArray(value) ? [...value] : [value];
|
|
@@ -265,6 +385,13 @@ function normalizeSchemaStep(value) {
|
|
|
265
385
|
return value;
|
|
266
386
|
}
|
|
267
387
|
|
|
388
|
+
function compiledEntryFromSource(entry, outDir) {
|
|
389
|
+
const normalized = String(entry || "src/index.ts").replaceAll("\\", "/");
|
|
390
|
+
const compiled = normalized.replace(/\.[cm]?[jt]sx?$/i, ".js");
|
|
391
|
+
const relative = compiled.startsWith("src/") ? compiled.slice(4) : compiled;
|
|
392
|
+
return `${outDir}/${relative}`.replace(/\/+/g, "/");
|
|
393
|
+
}
|
|
394
|
+
|
|
268
395
|
function envValue(name) {
|
|
269
396
|
const env = getRuntimeEnv();
|
|
270
397
|
const value = env?.rawEnv?.[name] || env?.[name];
|