skuba 14.0.0-esmify-skuba-20251105034821 → 14.0.0-hacky-hack-lang-json-20260108235938
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/config/eslint.js +1 -1
- package/config/jest.js +1 -0
- package/config/prettier.d.ts +4 -8
- package/config/prettier.js +2 -10
- package/jest/moduleNameMapper.js +64 -0
- package/jest/transform.js +62 -0
- package/jest/tsConfig.js +26 -0
- package/jest-preset.js +37 -0
- package/lib/api/jest/index.d.ts +15 -0
- package/lib/api/jest/index.js +59 -0
- package/lib/api/jest/index.js.map +7 -0
- package/lib/cli/adapter/eslint.js +45 -11
- package/lib/cli/adapter/eslint.js.map +3 -3
- package/lib/cli/adapter/prettier.js +67 -39
- package/lib/cli/adapter/prettier.js.map +2 -2
- package/lib/cli/build/args.js +42 -8
- package/lib/cli/build/args.js.map +2 -2
- package/lib/cli/build/assets.d.ts +3 -2
- package/lib/cli/build/assets.js +60 -28
- package/lib/cli/build/assets.js.map +3 -3
- package/lib/cli/build/esbuild.d.ts +4 -2
- package/lib/cli/build/esbuild.js +64 -23
- package/lib/cli/build/esbuild.js.map +2 -2
- package/lib/cli/build/index.js +53 -21
- package/lib/cli/build/index.js.map +2 -2
- package/lib/cli/build/tsc.js +60 -24
- package/lib/cli/build/tsc.js.map +3 -3
- package/lib/cli/buildPackage/index.js +32 -8
- package/lib/cli/buildPackage/index.js.map +1 -1
- package/lib/cli/configure/analyseConfiguration.js +50 -16
- package/lib/cli/configure/analyseConfiguration.js.map +2 -2
- package/lib/cli/configure/analyseDependencies.d.ts +1 -1
- package/lib/cli/configure/analyseDependencies.js +59 -25
- package/lib/cli/configure/analyseDependencies.js.map +3 -3
- package/lib/cli/configure/analysis/diff.js +29 -5
- package/lib/cli/configure/analysis/diff.js.map +2 -2
- package/lib/cli/configure/analysis/files.js +42 -8
- package/lib/cli/configure/analysis/files.js.map +2 -2
- package/lib/cli/configure/analysis/git.js +46 -12
- package/lib/cli/configure/analysis/git.js.map +2 -2
- package/lib/cli/configure/analysis/package.d.ts +3 -2
- package/lib/cli/configure/analysis/package.js +45 -10
- package/lib/cli/configure/analysis/package.js.map +3 -3
- package/lib/cli/configure/analysis/project.js +50 -18
- package/lib/cli/configure/analysis/project.js.map +2 -2
- package/lib/cli/configure/dependencies/index.js +35 -7
- package/lib/cli/configure/dependencies/index.js.map +1 -1
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +28 -4
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
- package/lib/cli/configure/dependencies/seekKoala.js +28 -4
- package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
- package/lib/cli/configure/dependencies/skuba.js +28 -4
- package/lib/cli/configure/dependencies/skuba.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDeps.js +26 -2
- package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDive.js +29 -4
- package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.d.ts +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.js +63 -32
- package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
- package/lib/cli/configure/getEntryPoint.d.ts +2 -2
- package/lib/cli/configure/getEntryPoint.js +51 -19
- package/lib/cli/configure/getEntryPoint.js.map +3 -3
- package/lib/cli/configure/getProjectType.d.ts +1 -1
- package/lib/cli/configure/getProjectType.js +36 -17
- package/lib/cli/configure/getProjectType.js.map +2 -2
- package/lib/cli/configure/index.js +91 -56
- package/lib/cli/configure/index.js.map +3 -3
- package/lib/cli/configure/modules/eslint.js +34 -10
- package/lib/cli/configure/modules/eslint.js.map +1 -1
- package/lib/cli/configure/modules/ignore.js +32 -8
- package/lib/cli/configure/modules/ignore.js.map +1 -1
- package/lib/cli/configure/modules/index.js +44 -18
- package/lib/cli/configure/modules/index.js.map +2 -2
- package/lib/cli/configure/modules/jest.d.ts +2 -0
- package/lib/cli/configure/modules/jest.js +86 -0
- package/lib/cli/configure/modules/jest.js.map +7 -0
- package/lib/cli/configure/modules/nodemon.js +28 -4
- package/lib/cli/configure/modules/nodemon.js.map +1 -1
- package/lib/cli/configure/modules/package.js +34 -10
- package/lib/cli/configure/modules/package.js.map +1 -1
- package/lib/cli/configure/modules/prettier.js +35 -11
- package/lib/cli/configure/modules/prettier.js.map +1 -1
- package/lib/cli/configure/modules/renovate.js +40 -17
- package/lib/cli/configure/modules/renovate.js.map +2 -2
- package/lib/cli/configure/modules/serverless.js +26 -2
- package/lib/cli/configure/modules/serverless.js.map +1 -1
- package/lib/cli/configure/modules/tslint.js +28 -4
- package/lib/cli/configure/modules/tslint.js.map +1 -1
- package/lib/cli/configure/processing/configFile.js +39 -3
- package/lib/cli/configure/processing/configFile.js.map +1 -1
- package/lib/cli/configure/processing/deleteFiles.js +26 -2
- package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
- package/lib/cli/configure/processing/javascript.js +27 -2
- package/lib/cli/configure/processing/javascript.js.map +1 -1
- package/lib/cli/configure/processing/json.js +31 -6
- package/lib/cli/configure/processing/json.js.map +1 -1
- package/lib/cli/configure/processing/loadFiles.js +26 -2
- package/lib/cli/configure/processing/loadFiles.js.map +1 -1
- package/lib/cli/configure/processing/module.js +28 -4
- package/lib/cli/configure/processing/module.js.map +1 -1
- package/lib/cli/configure/processing/package.d.ts +67 -1
- package/lib/cli/configure/processing/package.js +45 -8
- package/lib/cli/configure/processing/package.js.map +3 -3
- package/lib/cli/configure/processing/prettier.js +38 -4
- package/lib/cli/configure/processing/prettier.js.map +2 -2
- package/lib/cli/configure/processing/record.js +41 -5
- package/lib/cli/configure/processing/record.js.map +2 -2
- package/lib/cli/configure/processing/typescript.js +63 -26
- package/lib/cli/configure/processing/typescript.js.map +2 -2
- package/lib/cli/configure/types.d.ts +4 -15
- package/lib/cli/configure/types.js +16 -0
- package/lib/cli/configure/types.js.map +3 -3
- package/lib/cli/format/index.js +44 -20
- package/lib/cli/format/index.js.map +2 -2
- package/lib/cli/help/index.js +30 -6
- package/lib/cli/help/index.js.map +1 -1
- package/lib/cli/init/getConfig.d.ts +2 -2
- package/lib/cli/init/getConfig.js +121 -102
- package/lib/cli/init/getConfig.js.map +3 -3
- package/lib/cli/init/git.js +51 -16
- package/lib/cli/init/git.js.map +2 -2
- package/lib/cli/init/index.js +98 -67
- package/lib/cli/init/index.js.map +2 -2
- package/lib/cli/init/prompts.d.ts +13 -10
- package/lib/cli/init/prompts.js +56 -35
- package/lib/cli/init/prompts.js.map +2 -2
- package/lib/cli/init/types.d.ts +1 -1
- package/lib/cli/init/types.js +41 -7
- package/lib/cli/init/types.js.map +1 -1
- package/lib/cli/init/validation.js +30 -2
- package/lib/cli/init/validation.js.map +1 -1
- package/lib/cli/init/writePackageJson.js +42 -8
- package/lib/cli/init/writePackageJson.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/eslint.js +37 -3
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/index.js +45 -11
- package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/internal.js +37 -3
- package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +37 -3
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +37 -3
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
- package/lib/cli/lint/annotate/github/eslint.js +26 -2
- package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/github/index.js +45 -11
- package/lib/cli/lint/annotate/github/index.js.map +1 -1
- package/lib/cli/lint/annotate/github/internal.js +26 -2
- package/lib/cli/lint/annotate/github/internal.js.map +1 -1
- package/lib/cli/lint/annotate/github/prettier.js +26 -2
- package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/github/tsc.js +28 -4
- package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
- package/lib/cli/lint/annotate/index.js +30 -6
- package/lib/cli/lint/annotate/index.js.map +1 -1
- package/lib/cli/lint/autofix.d.ts +5 -0
- package/lib/cli/lint/autofix.js +80 -40
- package/lib/cli/lint/autofix.js.map +2 -2
- package/lib/cli/lint/eslint.js +51 -16
- package/lib/cli/lint/eslint.js.map +3 -3
- package/lib/cli/lint/external.js +51 -19
- package/lib/cli/lint/external.js.map +2 -2
- package/lib/cli/lint/index.js +50 -28
- package/lib/cli/lint/index.js.map +2 -2
- package/lib/cli/lint/internal.js +44 -18
- package/lib/cli/lint/internal.js.map +2 -2
- package/lib/cli/lint/internalLints/detectBadCodeowners.js +33 -8
- package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +46 -14
- package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +3 -3
- package/lib/cli/lint/internalLints/patchRenovateConfig.js +55 -21
- package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +64 -35
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/index.d.ts +2 -2
- package/lib/cli/lint/internalLints/upgrade/index.js +105 -41
- package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +28 -4
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +45 -11
- package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +30 -6
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +65 -34
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +46 -11
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +28 -4
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +59 -23
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js +28 -4
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +46 -11
- package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +30 -6
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +46 -11
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +46 -11
- package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +28 -4
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +46 -11
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +67 -29
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js +34 -10
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +45 -11
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +63 -17
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +50 -15
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js +40 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.d.ts +3 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js +149 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js +55 -0
- package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +51 -17
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +34 -10
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +44 -10
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +46 -12
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +28 -4
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +49 -15
- package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +45 -11
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +34 -10
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +45 -11
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +45 -11
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +47 -13
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +28 -4
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +45 -11
- package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
- package/lib/cli/lint/prettier.js +50 -15
- package/lib/cli/lint/prettier.js.map +3 -3
- package/lib/cli/lint/tsc.js +28 -4
- package/lib/cli/lint/tsc.js.map +1 -1
- package/lib/cli/lint/types.js +16 -0
- package/lib/cli/lint/types.js.map +3 -3
- package/lib/cli/migrate/index.d.ts +5 -0
- package/lib/cli/migrate/index.js +79 -15
- package/lib/cli/migrate/index.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/checks.d.ts +1 -14
- package/lib/cli/migrate/nodeVersion/checks.js +51 -120
- package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
- package/lib/cli/migrate/nodeVersion/index.d.ts +8 -2
- package/lib/cli/migrate/nodeVersion/index.js +239 -65
- package/lib/cli/migrate/nodeVersion/index.js.map +3 -3
- package/lib/cli/migrate/nodeVersion/upgrade.d.ts +8 -0
- package/lib/cli/migrate/nodeVersion/upgrade.js +179 -0
- package/lib/cli/migrate/nodeVersion/upgrade.js.map +7 -0
- package/lib/cli/node/index.js +57 -20
- package/lib/cli/node/index.js.map +3 -3
- package/lib/cli/release/index.js +28 -4
- package/lib/cli/release/index.js.map +1 -1
- package/lib/cli/start/index.js +50 -16
- package/lib/cli/start/index.js.map +3 -3
- package/lib/cli/test/index.js +44 -4
- package/lib/cli/test/index.js.map +2 -2
- package/lib/cli/test/reporters/github/annotations.d.ts +9 -0
- package/lib/cli/test/reporters/github/annotations.js +102 -0
- package/lib/cli/test/reporters/github/annotations.js.map +7 -0
- package/lib/cli/test/reporters/github/index.d.ts +5 -0
- package/lib/cli/test/reporters/github/index.js +74 -0
- package/lib/cli/test/reporters/github/index.js.map +7 -0
- package/lib/cli/version/index.js +30 -6
- package/lib/cli/version/index.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +46 -6
- package/lib/index.js.map +2 -2
- package/lib/skuba.js +45 -26
- package/lib/skuba.js.map +3 -3
- package/lib/utils/args.js +43 -6
- package/lib/utils/args.js.map +2 -2
- package/lib/utils/command.js +42 -4
- package/lib/utils/command.js.map +3 -3
- package/lib/utils/copy.js +57 -20
- package/lib/utils/copy.js.map +2 -2
- package/lib/utils/dir.js +72 -32
- package/lib/utils/dir.js.map +2 -2
- package/lib/utils/env.js +26 -2
- package/lib/utils/env.js.map +1 -1
- package/lib/utils/error.js +47 -10
- package/lib/utils/error.js.map +1 -1
- package/lib/utils/exec.d.ts +3 -2
- package/lib/utils/exec.js +62 -24
- package/lib/utils/exec.js.map +3 -3
- package/lib/utils/fs.js +40 -6
- package/lib/utils/fs.js.map +2 -2
- package/lib/utils/help.js +30 -6
- package/lib/utils/help.js.map +1 -1
- package/lib/utils/logging.d.ts +9 -10
- package/lib/utils/logging.js +38 -11
- package/lib/utils/logging.js.map +2 -2
- package/lib/utils/logo.js +52 -25
- package/lib/utils/logo.js.map +2 -2
- package/lib/utils/manifest.d.ts +2 -3
- package/lib/utils/manifest.js +48 -8
- package/lib/utils/manifest.js.map +3 -3
- package/lib/utils/npmrc.js +26 -2
- package/lib/utils/npmrc.js.map +1 -1
- package/lib/utils/packageManager.js +49 -12
- package/lib/utils/packageManager.js.map +2 -2
- package/lib/utils/port.js +39 -4
- package/lib/utils/port.js.map +2 -2
- package/lib/utils/sleep.js +26 -2
- package/lib/utils/sleep.js.map +1 -1
- package/lib/utils/template.js +55 -18
- package/lib/utils/template.js.map +3 -3
- package/lib/utils/validation.js +31 -2
- package/lib/utils/validation.js.map +1 -1
- package/lib/utils/version.js +46 -9
- package/lib/utils/version.js.map +2 -2
- package/lib/utils/wait.js +32 -7
- package/lib/utils/wait.js.map +1 -1
- package/lib/utils/worker.d.ts +3 -3
- package/lib/utils/worker.js +35 -10
- package/lib/utils/worker.js.map +1 -1
- package/lib/wrapper/function-arguments.d.js +1 -0
- package/lib/wrapper/functionHandler.js +49 -18
- package/lib/wrapper/functionHandler.js.map +2 -2
- package/lib/wrapper/http.js +43 -8
- package/lib/wrapper/http.js.map +2 -2
- package/lib/wrapper/index.js +7 -6
- package/lib/wrapper/index.js.map +1 -1
- package/lib/wrapper/main.js +42 -8
- package/lib/wrapper/main.js.map +3 -3
- package/lib/wrapper/requestListener.js +47 -13
- package/lib/wrapper/requestListener.js.map +2 -2
- package/lib/wrapper/server.js +28 -4
- package/lib/wrapper/server.js.map +2 -2
- package/package.json +43 -45
- package/template/base/_.prettierrc.js +1 -1
- package/template/base/_eslint.config.js +1 -1
- package/template/base/_pnpm-workspace.yaml +4 -3
- package/template/base/jest.config.ts +19 -0
- package/template/base/jest.setup.ts +3 -0
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/.nvmrc +1 -1
- package/template/express-rest-api/package.json +8 -9
- package/template/express-rest-api/skuba.template.js +1 -1
- package/template/express-rest-api/src/app.test.ts +0 -1
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/greeter/.nvmrc +1 -1
- package/template/greeter/package.json +4 -5
- package/template/greeter/skuba.template.js +1 -1
- package/template/greeter/src/app.test.ts +1 -3
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/.nvmrc +1 -1
- package/template/koa-rest-api/package.json +9 -11
- package/template/koa-rest-api/skuba.template.js +1 -1
- package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +0 -2
- package/template/koa-rest-api/src/api/jobs/postJob.test.ts +0 -2
- package/template/koa-rest-api/src/app.test.ts +0 -2
- package/template/koa-rest-api/src/framework/server.test.ts +2 -2
- package/template/koa-rest-api/src/framework/validation.test.ts +0 -2
- package/template/koa-rest-api/src/testing/metrics.ts +0 -2
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
- package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +7 -21
- package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +9 -11
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -3
- package/template/lambda-sqs-worker-cdk/infra/config.ts +2 -4
- package/template/lambda-sqs-worker-cdk/package.json +9 -9
- package/template/lambda-sqs-worker-cdk/skuba.template.js +13 -1
- package/template/lambda-sqs-worker-cdk/src/app.test.ts +13 -22
- package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +0 -1
- package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +31 -33
- package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +2 -8
- package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +2 -3
- package/template/lambda-sqs-worker-cdk/src/testing/services.ts +3 -4
- package/template/oss-npm-package/.github/workflows/release.yml +1 -1
- package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
- package/template/oss-npm-package/.nvmrc +1 -1
- package/template/oss-npm-package/_package.json +0 -1
- package/template/oss-npm-package/skuba.template.js +1 -1
- package/template/oss-npm-package/src/index.test.ts +0 -2
- package/template/private-npm-package/.nvmrc +1 -1
- package/template/private-npm-package/_package.json +1 -2
- package/template/private-npm-package/skuba.template.js +2 -2
- package/template/private-npm-package/src/index.test.ts +0 -2
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +0 -11
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +0 -7
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +0 -34
- package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +0 -7
- package/lib/enquirer.d.js +0 -1
- package/lib/enquirer.d.js.map +0 -7
- package/lib/eslint.d.js +0 -1
- package/lib/eslint.d.js.map +0 -7
- package/template/base/vitest.config.ts +0 -25
- /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/index.d.ts +0 -0
- /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/upgradeNode.d.ts +0 -0
package/lib/utils/port.js
CHANGED
|
@@ -1,13 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var port_exports = {};
|
|
30
|
+
__export(port_exports, {
|
|
31
|
+
getRandomPort: () => getRandomPort,
|
|
32
|
+
randomIntBetween: () => randomIntBetween
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(port_exports);
|
|
35
|
+
var import_get_port = __toESM(require("get-port"));
|
|
2
36
|
const MIN_PORT = 1e4;
|
|
3
37
|
const MAX_PORT = 49151;
|
|
4
38
|
const randomIntBetween = (min, max) => min + Math.floor(Math.random() * (1 + max - min));
|
|
5
39
|
const getRandomPort = () => {
|
|
6
40
|
const preferredPorts = new Array(10).fill(null).map(() => randomIntBetween(MIN_PORT, MAX_PORT));
|
|
7
|
-
return
|
|
41
|
+
return (0, import_get_port.default)({ port: preferredPorts });
|
|
8
42
|
};
|
|
9
|
-
export
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
10
45
|
getRandomPort,
|
|
11
46
|
randomIntBetween
|
|
12
|
-
};
|
|
47
|
+
});
|
|
13
48
|
//# sourceMappingURL=port.js.map
|
package/lib/utils/port.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/port.ts"],
|
|
4
4
|
"sourcesContent": ["import getPort from 'get-port';\n\n/* Smallest 5-digit port; these are less common than 4-digit ports. */\nconst MIN_PORT = 10000;\n\n/** Largest port in the IANA user port range. */\nconst MAX_PORT = 49151;\n\nexport const randomIntBetween = (min: number, max: number) =>\n min + Math.floor(Math.random() * (1 + max - min));\n\nexport const getRandomPort = () => {\n // Seed some random ports to use, if available.\n // get-port falls back to the private port range.\n const preferredPorts = new Array(10)\n .fill(null)\n .map(() => randomIntBetween(MIN_PORT, MAX_PORT));\n\n return getPort({ port: preferredPorts });\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAoB;AAGpB,MAAM,WAAW;AAGjB,MAAM,WAAW;AAEV,MAAM,mBAAmB,CAAC,KAAa,QAC5C,MAAM,KAAK,MAAM,KAAK,OAAO,KAAK,IAAI,MAAM,IAAI;AAE3C,MAAM,gBAAgB,MAAM;AAGjC,QAAM,iBAAiB,IAAI,MAAM,EAAE,EAChC,KAAK,IAAI,EACT,IAAI,MAAM,iBAAiB,UAAU,QAAQ,CAAC;AAEjD,aAAO,gBAAAA,SAAQ,EAAE,MAAM,eAAe,CAAC;AACzC;",
|
|
6
|
+
"names": ["getPort"]
|
|
7
7
|
}
|
package/lib/utils/sleep.js
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var sleep_exports = {};
|
|
20
|
+
__export(sleep_exports, {
|
|
21
|
+
sleep: () => sleep
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(sleep_exports);
|
|
1
24
|
const sleep = (ms) => {
|
|
2
25
|
let timeout;
|
|
3
26
|
return Object.assign(
|
|
@@ -5,7 +28,8 @@ const sleep = (ms) => {
|
|
|
5
28
|
{ clear: () => clearTimeout(timeout) }
|
|
6
29
|
);
|
|
7
30
|
};
|
|
8
|
-
export
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
9
33
|
sleep
|
|
10
|
-
};
|
|
34
|
+
});
|
|
11
35
|
//# sourceMappingURL=sleep.js.map
|
package/lib/utils/sleep.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/sleep.ts"],
|
|
4
4
|
"sourcesContent": ["interface Timeout extends PromiseLike<void> {\n clear?: () => void;\n}\n\nexport const sleep = (ms: number): Timeout => {\n let timeout: NodeJS.Timeout;\n\n return Object.assign(\n new Promise<void>((resolve) => (timeout = setTimeout(resolve, ms))),\n { clear: () => clearTimeout(timeout) },\n );\n};\n"],
|
|
5
|
-
"mappings": "AAIO,MAAM,QAAQ,CAAC,OAAwB;AAC5C,MAAI;AAEJ,SAAO,OAAO;AAAA,IACZ,IAAI,QAAc,CAAC,YAAa,UAAU,WAAW,SAAS,EAAE,CAAE;AAAA,IAClE,EAAE,OAAO,MAAM,aAAa,OAAO,EAAE;AAAA,EACvC;AACF;",
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,MAAM,QAAQ,CAAC,OAAwB;AAC5C,MAAI;AAEJ,SAAO,OAAO;AAAA,IACZ,IAAI,QAAc,CAAC,YAAa,UAAU,WAAW,SAAS,EAAE,CAAE;AAAA,IAClE,EAAE,OAAO,MAAM,aAAa,OAAO,EAAE;AAAA,EACvC;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/template.js
CHANGED
|
@@ -1,8 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var template_exports = {};
|
|
30
|
+
__export(template_exports, {
|
|
31
|
+
BASE_TEMPLATE_DIR: () => BASE_TEMPLATE_DIR,
|
|
32
|
+
TEMPLATE_CONFIG_FILENAME: () => TEMPLATE_CONFIG_FILENAME,
|
|
33
|
+
TEMPLATE_DIR: () => TEMPLATE_DIR,
|
|
34
|
+
TEMPLATE_DOCUMENTATION_CONFIG: () => TEMPLATE_DOCUMENTATION_CONFIG,
|
|
35
|
+
TEMPLATE_NAMES: () => TEMPLATE_NAMES,
|
|
36
|
+
TEMPLATE_NAMES_WITH_BYO: () => TEMPLATE_NAMES_WITH_BYO,
|
|
37
|
+
ensureTemplateConfigDeletion: () => ensureTemplateConfigDeletion,
|
|
38
|
+
readBaseTemplateFile: () => readBaseTemplateFile,
|
|
39
|
+
templateConfigSchema: () => templateConfigSchema
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(template_exports);
|
|
42
|
+
var import_path = __toESM(require("path"));
|
|
43
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
44
|
+
var z = __toESM(require("zod/v4"));
|
|
45
|
+
var import_manifest = require("./manifest.js");
|
|
46
|
+
var import_packageManager = require("./packageManager.js");
|
|
6
47
|
const TEMPLATE_NAMES = [
|
|
7
48
|
"express-rest-api",
|
|
8
49
|
"greeter",
|
|
@@ -61,20 +102,16 @@ const templateConfigSchema = z.object({
|
|
|
61
102
|
),
|
|
62
103
|
entryPoint: z.string().optional(),
|
|
63
104
|
noSkip: z.boolean().optional(),
|
|
64
|
-
packageManager: packageManagerSchema,
|
|
65
|
-
type: projectTypeSchema.optional()
|
|
105
|
+
packageManager: import_packageManager.packageManagerSchema,
|
|
106
|
+
type: import_manifest.projectTypeSchema.optional()
|
|
66
107
|
});
|
|
67
108
|
const TEMPLATE_CONFIG_FILENAME = "skuba.template.js";
|
|
68
|
-
const TEMPLATE_DIR =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const BASE_TEMPLATE_DIR = path.join(TEMPLATE_DIR, "base");
|
|
75
|
-
const ensureTemplateConfigDeletion = (dir) => fs.promises.rm(path.join(dir, TEMPLATE_CONFIG_FILENAME));
|
|
76
|
-
const readBaseTemplateFile = (src) => fs.promises.readFile(path.join(BASE_TEMPLATE_DIR, src), "utf8");
|
|
77
|
-
export {
|
|
109
|
+
const TEMPLATE_DIR = import_path.default.join(__dirname, "..", "..", "template");
|
|
110
|
+
const BASE_TEMPLATE_DIR = import_path.default.join(TEMPLATE_DIR, "base");
|
|
111
|
+
const ensureTemplateConfigDeletion = (dir) => import_fs_extra.default.promises.rm(import_path.default.join(dir, TEMPLATE_CONFIG_FILENAME));
|
|
112
|
+
const readBaseTemplateFile = (src) => import_fs_extra.default.promises.readFile(import_path.default.join(BASE_TEMPLATE_DIR, src), "utf8");
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
78
115
|
BASE_TEMPLATE_DIR,
|
|
79
116
|
TEMPLATE_CONFIG_FILENAME,
|
|
80
117
|
TEMPLATE_DIR,
|
|
@@ -84,5 +121,5 @@ export {
|
|
|
84
121
|
ensureTemplateConfigDeletion,
|
|
85
122
|
readBaseTemplateFile,
|
|
86
123
|
templateConfigSchema
|
|
87
|
-
};
|
|
124
|
+
});
|
|
88
125
|
//# sourceMappingURL=template.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/template.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport * as z from 'zod/v4';\n\nimport { projectTypeSchema } from './manifest.js';\nimport { packageManagerSchema } from './packageManager.js';\n\nexport const TEMPLATE_NAMES = [\n 'express-rest-api',\n 'greeter',\n 'koa-rest-api',\n 'lambda-sqs-worker-cdk',\n 'oss-npm-package',\n 'private-npm-package',\n] as const;\n\nexport type TemplateName = (typeof TEMPLATE_NAMES)[number];\n\nexport const TEMPLATE_NAMES_WITH_BYO = [...TEMPLATE_NAMES, 'github \u2192'] as const;\n\ninterface TemplateDocumentationConfig {\n /**\n * The semantic version in which the template was first added.\n *\n * This is used to filter out historical changelogs.\n */\n added: string;\n\n /**\n * The Markdown file for the template in our `/docs`.\n *\n * This is used to compile per-template changelogs for our documentation site.\n */\n filename: string;\n}\n\nexport const TEMPLATE_DOCUMENTATION_CONFIG: Record<\n TemplateName,\n TemplateDocumentationConfig\n> = {\n 'express-rest-api': {\n added: '3.8.0',\n filename: 'api.md',\n },\n greeter: {\n added: '3.4.1',\n filename: 'barebones.md',\n },\n 'koa-rest-api': {\n added: '3.4.1',\n filename: 'api.md',\n },\n 'lambda-sqs-worker-cdk': {\n added: '3.13.0',\n filename: 'worker.md',\n },\n 'oss-npm-package': {\n added: '3.7.0',\n filename: 'package.md',\n },\n 'private-npm-package': {\n added: '3.6.0',\n filename: 'package.md',\n },\n};\n\nexport type TemplateConfig = z.infer<typeof templateConfigSchema>;\n\n// https://github.com/colinhacks/zod/issues/4143#issuecomment-2845134912\n// https://github.com/colinhacks/zod/issues/4143#issuecomment-2931729793\nconst functionSchema = <T extends z.core.$ZodFunction>(schema: T) =>\n z.custom<Parameters<T['implement']>[0]>().transform((arg, ctx) => {\n if (typeof arg !== 'function') {\n ctx.addIssue('Must be function');\n return z.NEVER;\n }\n return schema.implement(arg);\n });\n\nexport const templateConfigSchema = z.object({\n fields: z.array(\n z.object({\n name: z.string(),\n message: z.string(),\n initial: z.string(),\n validate: functionSchema(\n z.function({\n input: [z.string()],\n output: z.union([z.boolean(), z.string()]),\n }),\n ).optional(),\n }),\n ),\n entryPoint: z.string().optional(),\n noSkip: z.boolean().optional(),\n packageManager: packageManagerSchema,\n type: projectTypeSchema.optional(),\n});\n\nexport const TEMPLATE_CONFIG_FILENAME = 'skuba.template.js';\n\nexport const TEMPLATE_DIR = path.join(
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport * as z from 'zod/v4';\n\nimport { projectTypeSchema } from './manifest.js';\nimport { packageManagerSchema } from './packageManager.js';\n\nexport const TEMPLATE_NAMES = [\n 'express-rest-api',\n 'greeter',\n 'koa-rest-api',\n 'lambda-sqs-worker-cdk',\n 'oss-npm-package',\n 'private-npm-package',\n] as const;\n\nexport type TemplateName = (typeof TEMPLATE_NAMES)[number];\n\nexport const TEMPLATE_NAMES_WITH_BYO = [...TEMPLATE_NAMES, 'github \u2192'] as const;\n\ninterface TemplateDocumentationConfig {\n /**\n * The semantic version in which the template was first added.\n *\n * This is used to filter out historical changelogs.\n */\n added: string;\n\n /**\n * The Markdown file for the template in our `/docs`.\n *\n * This is used to compile per-template changelogs for our documentation site.\n */\n filename: string;\n}\n\nexport const TEMPLATE_DOCUMENTATION_CONFIG: Record<\n TemplateName,\n TemplateDocumentationConfig\n> = {\n 'express-rest-api': {\n added: '3.8.0',\n filename: 'api.md',\n },\n greeter: {\n added: '3.4.1',\n filename: 'barebones.md',\n },\n 'koa-rest-api': {\n added: '3.4.1',\n filename: 'api.md',\n },\n 'lambda-sqs-worker-cdk': {\n added: '3.13.0',\n filename: 'worker.md',\n },\n 'oss-npm-package': {\n added: '3.7.0',\n filename: 'package.md',\n },\n 'private-npm-package': {\n added: '3.6.0',\n filename: 'package.md',\n },\n};\n\nexport type TemplateConfig = z.infer<typeof templateConfigSchema>;\n\n// https://github.com/colinhacks/zod/issues/4143#issuecomment-2845134912\n// https://github.com/colinhacks/zod/issues/4143#issuecomment-2931729793\nconst functionSchema = <T extends z.core.$ZodFunction>(schema: T) =>\n z.custom<Parameters<T['implement']>[0]>().transform((arg, ctx) => {\n if (typeof arg !== 'function') {\n ctx.addIssue('Must be function');\n return z.NEVER;\n }\n return schema.implement(arg);\n });\n\nexport const templateConfigSchema = z.object({\n fields: z.array(\n z.object({\n name: z.string(),\n message: z.string(),\n initial: z.string(),\n validate: functionSchema(\n z.function({\n input: [z.string()],\n output: z.union([z.boolean(), z.string()]),\n }),\n ).optional(),\n }),\n ),\n entryPoint: z.string().optional(),\n noSkip: z.boolean().optional(),\n packageManager: packageManagerSchema,\n type: projectTypeSchema.optional(),\n});\n\nexport const TEMPLATE_CONFIG_FILENAME = 'skuba.template.js';\n\nexport const TEMPLATE_DIR = path.join(__dirname, '..', '..', 'template');\n\nexport const BASE_TEMPLATE_DIR = path.join(TEMPLATE_DIR, 'base');\n\nexport const ensureTemplateConfigDeletion = (dir: string): Promise<void> =>\n fs.promises.rm(path.join(dir, TEMPLATE_CONFIG_FILENAME));\n\nexport const readBaseTemplateFile = (src: string): Promise<string> =>\n fs.promises.readFile(path.join(BASE_TEMPLATE_DIR, src), 'utf8');\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AACf,QAAmB;AAEnB,sBAAkC;AAClC,4BAAqC;AAE9B,MAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,MAAM,0BAA0B,CAAC,GAAG,gBAAgB,eAAU;AAkB9D,MAAM,gCAGT;AAAA,EACF,oBAAoB;AAAA,IAClB,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,SAAS;AAAA,IACP,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,gBAAgB;AAAA,IACd,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,yBAAyB;AAAA,IACvB,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,mBAAmB;AAAA,IACjB,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA,EACA,uBAAuB;AAAA,IACrB,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AACF;AAMA,MAAM,iBAAiB,CAAgC,WACrD,EAAE,OAAsC,EAAE,UAAU,CAAC,KAAK,QAAQ;AAChE,MAAI,OAAO,QAAQ,YAAY;AAC7B,QAAI,SAAS,kBAAkB;AAC/B,WAAO,EAAE;AAAA,EACX;AACA,SAAO,OAAO,UAAU,GAAG;AAC7B,CAAC;AAEI,MAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,QAAQ,EAAE;AAAA,IACR,EAAE,OAAO;AAAA,MACP,MAAM,EAAE,OAAO;AAAA,MACf,SAAS,EAAE,OAAO;AAAA,MAClB,SAAS,EAAE,OAAO;AAAA,MAClB,UAAU;AAAA,QACR,EAAE,SAAS;AAAA,UACT,OAAO,CAAC,EAAE,OAAO,CAAC;AAAA,UAClB,QAAQ,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,EAAE,OAAO,CAAC,CAAC;AAAA,QAC3C,CAAC;AAAA,MACH,EAAE,SAAS;AAAA,IACb,CAAC;AAAA,EACH;AAAA,EACA,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7B,gBAAgB;AAAA,EAChB,MAAM,kCAAkB,SAAS;AACnC,CAAC;AAEM,MAAM,2BAA2B;AAEjC,MAAM,eAAe,YAAAA,QAAK,KAAK,WAAW,MAAM,MAAM,UAAU;AAEhE,MAAM,oBAAoB,YAAAA,QAAK,KAAK,cAAc,MAAM;AAExD,MAAM,+BAA+B,CAAC,QAC3C,gBAAAC,QAAG,SAAS,GAAG,YAAAD,QAAK,KAAK,KAAK,wBAAwB,CAAC;AAElD,MAAM,uBAAuB,CAAC,QACnC,gBAAAC,QAAG,SAAS,SAAS,YAAAD,QAAK,KAAK,mBAAmB,GAAG,GAAG,MAAM;",
|
|
6
|
+
"names": ["path", "fs"]
|
|
7
7
|
}
|
package/lib/utils/validation.js
CHANGED
|
@@ -1,15 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var validation_exports = {};
|
|
20
|
+
__export(validation_exports, {
|
|
21
|
+
hasNumberProp: () => hasNumberProp,
|
|
22
|
+
hasProp: () => hasProp,
|
|
23
|
+
hasStringProp: () => hasStringProp,
|
|
24
|
+
isFunction: () => isFunction,
|
|
25
|
+
isIpPort: () => isIpPort,
|
|
26
|
+
isObject: () => isObject
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(validation_exports);
|
|
1
29
|
const isFunction = (data) => typeof data === "function";
|
|
2
30
|
const isIpPort = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0 && value <= 65535;
|
|
3
31
|
const isObject = (value) => typeof value === "object" && value !== null;
|
|
4
32
|
const hasProp = (value, prop) => isObject(value) && value.hasOwnProperty(prop);
|
|
5
33
|
const hasNumberProp = (value, prop) => isObject(value) && typeof value[prop] === "number";
|
|
6
34
|
const hasStringProp = (value, prop) => isObject(value) && typeof value[prop] === "string";
|
|
7
|
-
export
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
8
37
|
hasNumberProp,
|
|
9
38
|
hasProp,
|
|
10
39
|
hasStringProp,
|
|
11
40
|
isFunction,
|
|
12
41
|
isIpPort,
|
|
13
42
|
isObject
|
|
14
|
-
};
|
|
43
|
+
});
|
|
15
44
|
//# sourceMappingURL=validation.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/validation.ts"],
|
|
4
4
|
"sourcesContent": ["export const isFunction = (\n data: unknown,\n): data is (...args: unknown[]) => Promise<unknown> =>\n typeof data === 'function';\n\nexport const isIpPort = (value: unknown): value is number =>\n typeof value === 'number' &&\n Number.isSafeInteger(value) &&\n value >= 0 &&\n value <= 65535;\n\nexport const isObject = (\n value: unknown,\n): value is Record<PropertyKey, unknown> =>\n typeof value === 'object' && value !== null;\n\nexport const hasProp = <P extends PropertyKey, V = unknown>(\n value: unknown,\n prop: P,\n): value is Record<P, V> => isObject(value) && value.hasOwnProperty(prop);\n\nexport const hasNumberProp = <P extends PropertyKey>(\n value: unknown,\n prop: P,\n): value is Record<P, number> =>\n isObject(value) && typeof value[prop] === 'number';\n\nexport const hasStringProp = <P extends PropertyKey>(\n value: unknown,\n prop: P,\n): value is Record<P, string> =>\n isObject(value) && typeof value[prop] === 'string';\n"],
|
|
5
|
-
"mappings": "AAAO,MAAM,aAAa,CACxB,SAEA,OAAO,SAAS;AAEX,MAAM,WAAW,CAAC,UACvB,OAAO,UAAU,YACjB,OAAO,cAAc,KAAK,KAC1B,SAAS,KACT,SAAS;AAEJ,MAAM,WAAW,CACtB,UAEA,OAAO,UAAU,YAAY,UAAU;AAElC,MAAM,UAAU,CACrB,OACA,SAC0B,SAAS,KAAK,KAAK,MAAM,eAAe,IAAI;AAEjE,MAAM,gBAAgB,CAC3B,OACA,SAEA,SAAS,KAAK,KAAK,OAAO,MAAM,IAAI,MAAM;AAErC,MAAM,gBAAgB,CAC3B,OACA,SAEA,SAAS,KAAK,KAAK,OAAO,MAAM,IAAI,MAAM;",
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,aAAa,CACxB,SAEA,OAAO,SAAS;AAEX,MAAM,WAAW,CAAC,UACvB,OAAO,UAAU,YACjB,OAAO,cAAc,KAAK,KAC1B,SAAS,KACT,SAAS;AAEJ,MAAM,WAAW,CACtB,UAEA,OAAO,UAAU,YAAY,UAAU;AAElC,MAAM,UAAU,CACrB,OACA,SAC0B,SAAS,KAAK,KAAK,MAAM,eAAe,IAAI;AAEjE,MAAM,gBAAgB,CAC3B,OACA,SAEA,SAAS,KAAK,KAAK,OAAO,MAAM,IAAI,MAAM;AAErC,MAAM,gBAAgB,CAC3B,OACA,SAEA,SAAS,KAAK,KAAK,OAAO,MAAM,IAAI,MAAM;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/version.js
CHANGED
|
@@ -1,7 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var version_exports = {};
|
|
30
|
+
__export(version_exports, {
|
|
31
|
+
getLatestNpmVersion: () => getLatestNpmVersion,
|
|
32
|
+
getNpmVersions: () => getNpmVersions,
|
|
33
|
+
getSkubaVersion: () => getSkubaVersion,
|
|
34
|
+
getSkubaVersionInfo: () => getSkubaVersionInfo
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(version_exports);
|
|
37
|
+
var import_npm_registry_fetch = __toESM(require("npm-registry-fetch"));
|
|
38
|
+
var z = __toESM(require("zod/v4"));
|
|
39
|
+
var import_manifest = require("./manifest.js");
|
|
40
|
+
var import_wait = require("./wait.js");
|
|
5
41
|
const NpmVersions = z.record(
|
|
6
42
|
z.string(),
|
|
7
43
|
z.object({
|
|
@@ -16,7 +52,7 @@ const PackageResponse = z.object({
|
|
|
16
52
|
});
|
|
17
53
|
const getNpmPackage = async (packageName) => {
|
|
18
54
|
try {
|
|
19
|
-
const response = await
|
|
55
|
+
const response = await import_npm_registry_fetch.default.json(packageName, {
|
|
20
56
|
headers: {
|
|
21
57
|
Accept: "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"
|
|
22
58
|
}
|
|
@@ -45,14 +81,14 @@ const getLatestNpmVersion = async (packageName) => {
|
|
|
45
81
|
};
|
|
46
82
|
const latestSkubaVersion = async () => {
|
|
47
83
|
try {
|
|
48
|
-
const result = await withTimeout(getLatestNpmVersion("skuba"), { s: 2 });
|
|
84
|
+
const result = await (0, import_wait.withTimeout)(getLatestNpmVersion("skuba"), { s: 2 });
|
|
49
85
|
return result.ok ? result.value : null;
|
|
50
86
|
} catch {
|
|
51
87
|
return null;
|
|
52
88
|
}
|
|
53
89
|
};
|
|
54
90
|
const getSkubaVersion = async () => {
|
|
55
|
-
const { version } = await getSkubaManifest();
|
|
91
|
+
const { version } = await (0, import_manifest.getSkubaManifest)();
|
|
56
92
|
return version;
|
|
57
93
|
};
|
|
58
94
|
const getSkubaVersionInfo = async () => {
|
|
@@ -73,10 +109,11 @@ const getSkubaVersionInfo = async () => {
|
|
|
73
109
|
latest
|
|
74
110
|
};
|
|
75
111
|
};
|
|
76
|
-
export
|
|
112
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
113
|
+
0 && (module.exports = {
|
|
77
114
|
getLatestNpmVersion,
|
|
78
115
|
getNpmVersions,
|
|
79
116
|
getSkubaVersion,
|
|
80
117
|
getSkubaVersionInfo
|
|
81
|
-
};
|
|
118
|
+
});
|
|
82
119
|
//# sourceMappingURL=version.js.map
|
package/lib/utils/version.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/version.ts"],
|
|
4
4
|
"sourcesContent": ["import npmFetch from 'npm-registry-fetch';\nimport * as z from 'zod/v4';\n\nimport { getSkubaManifest } from './manifest.js';\nimport { withTimeout } from './wait.js';\n\nconst NpmVersions = z.record(\n z.string(),\n z.object({\n name: z.string(),\n version: z.string(),\n deprecated: z.string().optional(),\n }),\n);\n\nexport type NpmVersions = z.infer<typeof NpmVersions>;\n\nconst PackageResponse = z.object({\n 'dist-tags': z.record(z.string(), z.string()).optional(),\n versions: NpmVersions,\n});\n\nconst getNpmPackage = async (packageName: string) => {\n try {\n const response = await npmFetch.json(packageName, {\n headers: {\n Accept:\n 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*',\n },\n });\n\n const parsedResponse = PackageResponse.safeParse(response);\n if (!parsedResponse.success) {\n throw new Error(\n `Failed to parse package response from npm for package ${packageName}`,\n );\n }\n\n return parsedResponse.data;\n } catch (error) {\n if (\n error instanceof Error &&\n 'statusCode' in error &&\n error.statusCode === 404\n ) {\n return null;\n }\n throw error;\n }\n};\n\nexport const getNpmVersions = async (\n packageName: string,\n): Promise<NpmVersions | null> => {\n const response = await getNpmPackage(packageName);\n return response?.versions ?? null;\n};\n\nexport const getLatestNpmVersion = async (\n packageName: string,\n): Promise<string | null> => {\n const response = await getNpmPackage(packageName);\n return response?.['dist-tags']?.latest ?? null;\n};\n\nconst latestSkubaVersion = async (): Promise<string | null> => {\n try {\n const result = await withTimeout(getLatestNpmVersion('skuba'), { s: 2 });\n\n return result.ok ? result.value : null;\n } catch {\n return null;\n }\n};\n\nexport const getSkubaVersion = async (): Promise<string> => {\n const { version } = await getSkubaManifest();\n\n return version;\n};\n\ntype SkubaVersionInfo =\n | {\n isStale: true;\n\n local: string;\n latest: string;\n }\n | {\n isStale: false;\n\n local: string;\n latest: string | null;\n };\n\nexport const getSkubaVersionInfo = async (): Promise<SkubaVersionInfo> => {\n const [local, latest] = await Promise.all([\n getSkubaVersion(),\n latestSkubaVersion(),\n ]);\n\n if (latest === null) {\n // Assume we're up to date if we can't reach the npm registry\n return {\n isStale: false,\n local,\n latest,\n };\n }\n\n return {\n isStale: latest !== local,\n local,\n latest,\n };\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAqB;AACrB,QAAmB;AAEnB,sBAAiC;AACjC,kBAA4B;AAE5B,MAAM,cAAc,EAAE;AAAA,EACpB,EAAE,OAAO;AAAA,EACT,EAAE,OAAO;AAAA,IACP,MAAM,EAAE,OAAO;AAAA,IACf,SAAS,EAAE,OAAO;AAAA,IAClB,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA,EAClC,CAAC;AACH;AAIA,MAAM,kBAAkB,EAAE,OAAO;AAAA,EAC/B,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACvD,UAAU;AACZ,CAAC;AAED,MAAM,gBAAgB,OAAO,gBAAwB;AACnD,MAAI;AACF,UAAM,WAAW,MAAM,0BAAAA,QAAS,KAAK,aAAa;AAAA,MAChD,SAAS;AAAA,QACP,QACE;AAAA,MACJ;AAAA,IACF,CAAC;AAED,UAAM,iBAAiB,gBAAgB,UAAU,QAAQ;AACzD,QAAI,CAAC,eAAe,SAAS;AAC3B,YAAM,IAAI;AAAA,QACR,yDAAyD,WAAW;AAAA,MACtE;AAAA,IACF;AAEA,WAAO,eAAe;AAAA,EACxB,SAAS,OAAO;AACd,QACE,iBAAiB,SACjB,gBAAgB,SAChB,MAAM,eAAe,KACrB;AACA,aAAO;AAAA,IACT;AACA,UAAM;AAAA,EACR;AACF;AAEO,MAAM,iBAAiB,OAC5B,gBACgC;AAChC,QAAM,WAAW,MAAM,cAAc,WAAW;AAChD,SAAO,UAAU,YAAY;AAC/B;AAEO,MAAM,sBAAsB,OACjC,gBAC2B;AAC3B,QAAM,WAAW,MAAM,cAAc,WAAW;AAChD,SAAO,WAAW,WAAW,GAAG,UAAU;AAC5C;AAEA,MAAM,qBAAqB,YAAoC;AAC7D,MAAI;AACF,UAAM,SAAS,UAAM,yBAAY,oBAAoB,OAAO,GAAG,EAAE,GAAG,EAAE,CAAC;AAEvE,WAAO,OAAO,KAAK,OAAO,QAAQ;AAAA,EACpC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,MAAM,kBAAkB,YAA6B;AAC1D,QAAM,EAAE,QAAQ,IAAI,UAAM,kCAAiB;AAE3C,SAAO;AACT;AAgBO,MAAM,sBAAsB,YAAuC;AACxE,QAAM,CAAC,OAAO,MAAM,IAAI,MAAM,QAAQ,IAAI;AAAA,IACxC,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,EACrB,CAAC;AAED,MAAI,WAAW,MAAM;AAEnB,WAAO;AAAA,MACL,SAAS;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,SAAS,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["npmFetch"]
|
|
7
7
|
}
|
package/lib/utils/wait.js
CHANGED
|
@@ -1,15 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var wait_exports = {};
|
|
20
|
+
__export(wait_exports, {
|
|
21
|
+
throwOnTimeout: () => throwOnTimeout,
|
|
22
|
+
withTimeout: () => withTimeout
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(wait_exports);
|
|
25
|
+
var import_error = require("./error.js");
|
|
26
|
+
var import_logging = require("./logging.js");
|
|
27
|
+
var import_sleep = require("./sleep.js");
|
|
4
28
|
const throwOnTimeout = async (promise, { s }) => {
|
|
5
29
|
const result = await withTimeout(promise, { s });
|
|
6
30
|
if (!result.ok) {
|
|
7
|
-
throw createTerseError(`Timed out after ${pluralise(s, "second")}`);
|
|
31
|
+
throw (0, import_error.createTerseError)(`Timed out after ${(0, import_logging.pluralise)(s, "second")}`);
|
|
8
32
|
}
|
|
9
33
|
return result.value;
|
|
10
34
|
};
|
|
11
35
|
const withTimeout = async (promise, { s }) => {
|
|
12
|
-
const timeout = sleep(s * 1e3);
|
|
36
|
+
const timeout = (0, import_sleep.sleep)(s * 1e3);
|
|
13
37
|
try {
|
|
14
38
|
return await Promise.race([
|
|
15
39
|
Promise.resolve(promise).then((value) => ({ ok: true, value })),
|
|
@@ -19,8 +43,9 @@ const withTimeout = async (promise, { s }) => {
|
|
|
19
43
|
timeout.clear?.();
|
|
20
44
|
}
|
|
21
45
|
};
|
|
22
|
-
export
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
23
48
|
throwOnTimeout,
|
|
24
49
|
withTimeout
|
|
25
|
-
};
|
|
50
|
+
});
|
|
26
51
|
//# sourceMappingURL=wait.js.map
|
package/lib/utils/wait.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/wait.ts"],
|
|
4
4
|
"sourcesContent": ["import { createTerseError } from './error.js';\nimport { pluralise } from './logging.js';\nimport { sleep } from './sleep.js';\n\nexport const throwOnTimeout = async <T>(\n promise: PromiseLike<T>,\n { s }: { s: number },\n): Promise<T> => {\n const result = await withTimeout(promise, { s });\n\n if (!result.ok) {\n throw createTerseError(`Timed out after ${pluralise(s, 'second')}`);\n }\n\n return result.value;\n};\n\ntype TimeoutResult<T> = { ok: true; value: T } | { ok: false };\n\nexport const withTimeout = async <T>(\n promise: T | PromiseLike<T>,\n { s }: { s: number },\n): Promise<TimeoutResult<T>> => {\n const timeout = sleep(s * 1_000);\n\n try {\n return await Promise.race<TimeoutResult<T>>([\n Promise.resolve(promise).then((value) => ({ ok: true, value })),\n timeout.then(() => ({ ok: false })),\n ]);\n } finally {\n timeout.clear?.();\n }\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AACjC,qBAA0B;AAC1B,mBAAsB;AAEf,MAAM,iBAAiB,OAC5B,SACA,EAAE,EAAE,MACW;AACf,QAAM,SAAS,MAAM,YAAY,SAAS,EAAE,EAAE,CAAC;AAE/C,MAAI,CAAC,OAAO,IAAI;AACd,cAAM,+BAAiB,uBAAmB,0BAAU,GAAG,QAAQ,CAAC,EAAE;AAAA,EACpE;AAEA,SAAO,OAAO;AAChB;AAIO,MAAM,cAAc,OACzB,SACA,EAAE,EAAE,MAC0B;AAC9B,QAAM,cAAU,oBAAM,IAAI,GAAK;AAE/B,MAAI;AACF,WAAO,MAAM,QAAQ,KAAuB;AAAA,MAC1C,QAAQ,QAAQ,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,MAAM,MAAM,EAAE;AAAA,MAC9D,QAAQ,KAAK,OAAO,EAAE,IAAI,MAAM,EAAE;AAAA,IACpC,CAAC;AAAA,EACH,UAAE;AACA,YAAQ,QAAQ;AAAA,EAClB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/worker.d.ts
CHANGED
|
@@ -12,9 +12,9 @@ export declare const postWorkerOutput: <Input, Output>(fn: (input: Input) => Pro
|
|
|
12
12
|
prefixes: unknown[];
|
|
13
13
|
suffixes: unknown[];
|
|
14
14
|
};
|
|
15
|
-
bold:
|
|
16
|
-
dim:
|
|
17
|
-
formatSubtle:
|
|
15
|
+
bold: (text: string) => string;
|
|
16
|
+
dim: (text: string) => string;
|
|
17
|
+
formatSubtle: (text: string) => string;
|
|
18
18
|
timing: (start: bigint, end: bigint) => string;
|
|
19
19
|
debug: (...message: unknown[]) => void;
|
|
20
20
|
subtle: (...message: unknown[]) => void;
|
package/lib/utils/worker.js
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var worker_exports = {};
|
|
20
|
+
__export(worker_exports, {
|
|
21
|
+
execWorkerThread: () => execWorkerThread,
|
|
22
|
+
postWorkerOutput: () => postWorkerOutput
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(worker_exports);
|
|
25
|
+
var import_util = require("util");
|
|
26
|
+
var import_worker_threads = require("worker_threads");
|
|
27
|
+
var import_logging = require("./logging.js");
|
|
4
28
|
const execWorkerThread = async (filepath, input) => {
|
|
5
29
|
let output;
|
|
6
30
|
let messageReceived = false;
|
|
7
31
|
return new Promise(
|
|
8
|
-
(resolve, reject) => new Worker(filepath, {
|
|
32
|
+
(resolve, reject) => new import_worker_threads.Worker(filepath, {
|
|
9
33
|
workerData: input
|
|
10
34
|
}).on("error", reject).on(
|
|
11
35
|
"exit",
|
|
@@ -20,19 +44,20 @@ const execWorkerThread = async (filepath, input) => {
|
|
|
20
44
|
}).on("messageerror", (err) => reject(err))
|
|
21
45
|
);
|
|
22
46
|
};
|
|
23
|
-
const postWorkerOutput = (fn, logger = log) => {
|
|
24
|
-
const port = parentPort;
|
|
47
|
+
const postWorkerOutput = (fn, logger = import_logging.log) => {
|
|
48
|
+
const port = import_worker_threads.parentPort;
|
|
25
49
|
if (!port) {
|
|
26
50
|
logger.err("`postWorkerOutput` called outside of a worker thread context");
|
|
27
51
|
process.exit(1);
|
|
28
52
|
}
|
|
29
|
-
fn(workerData).then((output) => port.postMessage(output)).catch((err) => {
|
|
30
|
-
logger.err(inspect(err));
|
|
53
|
+
fn(import_worker_threads.workerData).then((output) => port.postMessage(output)).catch((err) => {
|
|
54
|
+
logger.err((0, import_util.inspect)(err));
|
|
31
55
|
process.exit(1);
|
|
32
56
|
});
|
|
33
57
|
};
|
|
34
|
-
export
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
35
60
|
execWorkerThread,
|
|
36
61
|
postWorkerOutput
|
|
37
|
-
};
|
|
62
|
+
});
|
|
38
63
|
//# sourceMappingURL=worker.js.map
|
package/lib/utils/worker.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/worker.ts"],
|
|
4
4
|
"sourcesContent": ["import { inspect } from 'util';\nimport { Worker, parentPort, workerData } from 'worker_threads';\n\nimport { log } from './logging.js';\n\n/**\n * Executes a script at `filepath` in a Node.js worker thread.\n */\nexport const execWorkerThread = async <Input, Output>(\n filepath: string,\n input: Input,\n) => {\n let output: Output;\n let messageReceived = false;\n\n return new Promise<Output>((resolve, reject) =>\n new Worker(filepath, {\n workerData: input,\n })\n .on('error', reject)\n .on('exit', (code) =>\n messageReceived\n ? resolve(output)\n : reject(\n new Error(\n code\n ? `Worker thread failed with exit code ${code}`\n : 'Worker thread exited without posting a message',\n ),\n ),\n )\n .on('message', (message: Output) => {\n // Defer promise resolution to `exit` so stdio can settle.\n output = message;\n messageReceived = true;\n })\n .on('messageerror', (err) => reject(err)),\n );\n};\n\n/**\n * Runs a function in a Node.js worker thread context, forwarding the result\n * to the parent thread.\n */\nexport const postWorkerOutput = <Input, Output>(\n fn: (input: Input) => Promise<Output>,\n logger = log,\n) => {\n const port = parentPort;\n\n if (!port) {\n logger.err('`postWorkerOutput` called outside of a worker thread context');\n\n process.exit(1);\n }\n\n fn(workerData as Input)\n .then((output) => port.postMessage(output))\n .catch((err) => {\n logger.err(inspect(err));\n\n process.exit(1);\n });\n};\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AACxB,4BAA+C;AAE/C,qBAAoB;AAKb,MAAM,mBAAmB,OAC9B,UACA,UACG;AACH,MAAI;AACJ,MAAI,kBAAkB;AAEtB,SAAO,IAAI;AAAA,IAAgB,CAAC,SAAS,WACnC,IAAI,6BAAO,UAAU;AAAA,MACnB,YAAY;AAAA,IACd,CAAC,EACE,GAAG,SAAS,MAAM,EAClB;AAAA,MAAG;AAAA,MAAQ,CAAC,SACX,kBACI,QAAQ,MAAM,IACd;AAAA,QACE,IAAI;AAAA,UACF,OACI,uCAAuC,IAAI,KAC3C;AAAA,QACN;AAAA,MACF;AAAA,IACN,EACC,GAAG,WAAW,CAAC,YAAoB;AAElC,eAAS;AACT,wBAAkB;AAAA,IACpB,CAAC,EACA,GAAG,gBAAgB,CAAC,QAAQ,OAAO,GAAG,CAAC;AAAA,EAC5C;AACF;AAMO,MAAM,mBAAmB,CAC9B,IACA,SAAS,uBACN;AACH,QAAM,OAAO;AAEb,MAAI,CAAC,MAAM;AACT,WAAO,IAAI,8DAA8D;AAEzE,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,KAAG,gCAAmB,EACnB,KAAK,CAAC,WAAW,KAAK,YAAY,MAAM,CAAC,EACzC,MAAM,CAAC,QAAQ;AACd,WAAO,QAAI,qBAAQ,GAAG,CAAC;AAEvB,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACL;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|