skuba 5.1.1 → 5.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/git/commit.js +4 -0
- package/lib/api/git/commit.js.map +1 -1
- package/lib/api/git/commitAllChanges.js +4 -0
- package/lib/api/git/commitAllChanges.js.map +1 -1
- package/lib/api/git/currentBranch.js +4 -0
- package/lib/api/git/currentBranch.js.map +1 -1
- package/lib/api/git/getChangedFiles.js +4 -0
- package/lib/api/git/getChangedFiles.js.map +1 -1
- package/lib/api/git/log.js +4 -0
- package/lib/api/git/log.js.map +1 -1
- package/lib/api/git/pull.js +4 -0
- package/lib/api/git/pull.js.map +1 -1
- package/lib/api/git/push.js +4 -0
- package/lib/api/git/push.js.map +1 -1
- package/lib/api/git/remote.js +4 -0
- package/lib/api/git/remote.js.map +1 -1
- package/lib/api/git/reset.js +4 -0
- package/lib/api/git/reset.js.map +1 -1
- package/lib/api/github/checkRun.js +4 -0
- package/lib/api/github/checkRun.js.map +1 -1
- package/lib/api/github/environment.js +5 -1
- package/lib/api/github/environment.js.map +1 -1
- package/lib/api/github/issueComment.js +4 -0
- package/lib/api/github/issueComment.js.map +1 -1
- package/lib/api/github/pullRequest.js +4 -0
- package/lib/api/github/pullRequest.js.map +1 -1
- package/lib/api/github/push.js +4 -0
- package/lib/api/github/push.js.map +1 -1
- package/lib/api/jest/index.d.ts +1 -1
- package/lib/api/jest/index.js +4 -0
- package/lib/api/jest/index.js.map +1 -1
- package/lib/api/net/socket.js +4 -0
- package/lib/api/net/socket.js.map +1 -1
- package/lib/cli/adapter/eslint.js +11 -2
- package/lib/cli/adapter/eslint.js.map +2 -2
- package/lib/cli/adapter/prettier.js +4 -0
- package/lib/cli/adapter/prettier.js.map +1 -1
- package/lib/cli/build/args.js +4 -0
- package/lib/cli/build/args.js.map +1 -1
- package/lib/cli/build/esbuild.js +5 -0
- package/lib/cli/build/esbuild.js.map +1 -1
- package/lib/cli/build/index.js +4 -0
- package/lib/cli/build/index.js.map +1 -1
- package/lib/cli/configure/addEmptyExports.d.ts +1 -0
- package/lib/cli/configure/addEmptyExports.js +12 -3
- package/lib/cli/configure/addEmptyExports.js.map +2 -2
- package/lib/cli/configure/analyseConfiguration.js +4 -0
- package/lib/cli/configure/analyseConfiguration.js.map +1 -1
- package/lib/cli/configure/analyseDependencies.js +4 -0
- package/lib/cli/configure/analyseDependencies.js.map +1 -1
- package/lib/cli/configure/analysis/diff.js +4 -0
- package/lib/cli/configure/analysis/diff.js.map +1 -1
- package/lib/cli/configure/analysis/files.js +4 -0
- package/lib/cli/configure/analysis/files.js.map +1 -1
- package/lib/cli/configure/analysis/git.js +4 -0
- package/lib/cli/configure/analysis/git.js.map +1 -1
- package/lib/cli/configure/analysis/package.js +4 -0
- package/lib/cli/configure/analysis/package.js.map +1 -1
- package/lib/cli/configure/analysis/project.js +4 -0
- package/lib/cli/configure/analysis/project.js.map +1 -1
- package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
- package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
- package/lib/cli/configure/dependencies/skuba.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDeps.js +2 -0
- package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
- package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
- package/lib/cli/configure/ensureTemplateCompletion.js +4 -0
- package/lib/cli/configure/ensureTemplateCompletion.js.map +1 -1
- package/lib/cli/configure/getEntryPoint.js +4 -0
- package/lib/cli/configure/getEntryPoint.js.map +1 -1
- package/lib/cli/configure/getProjectType.js.map +1 -1
- package/lib/cli/configure/index.js +4 -0
- package/lib/cli/configure/index.js.map +1 -1
- package/lib/cli/configure/modules/eslint.js +1 -0
- package/lib/cli/configure/modules/eslint.js.map +1 -1
- package/lib/cli/configure/modules/jest.js.map +1 -1
- package/lib/cli/configure/modules/package.js.map +1 -1
- package/lib/cli/configure/modules/prettier.js +1 -0
- package/lib/cli/configure/modules/prettier.js.map +1 -1
- package/lib/cli/configure/modules/renovate.js +6 -0
- package/lib/cli/configure/modules/renovate.js.map +1 -1
- package/lib/cli/configure/modules/skubaDive.js +4 -0
- package/lib/cli/configure/modules/skubaDive.js.map +1 -1
- package/lib/cli/configure/modules/tsconfig.js.map +1 -1
- package/lib/cli/configure/processing/package.js +4 -0
- package/lib/cli/configure/processing/package.js.map +1 -1
- package/lib/cli/configure/processing/prettier.js +4 -0
- package/lib/cli/configure/processing/prettier.js.map +1 -1
- package/lib/cli/configure/processing/record.js +4 -0
- package/lib/cli/configure/processing/record.js.map +1 -1
- package/lib/cli/configure/processing/typescript.js +4 -3
- package/lib/cli/configure/processing/typescript.js.map +2 -2
- package/lib/cli/configure/refreshIgnoreFiles.d.ts +1 -0
- package/lib/cli/configure/refreshIgnoreFiles.js +12 -5
- package/lib/cli/configure/refreshIgnoreFiles.js.map +2 -2
- package/lib/cli/format.js +4 -0
- package/lib/cli/format.js.map +1 -1
- package/lib/cli/init/getConfig.js +7 -0
- package/lib/cli/init/getConfig.js.map +1 -1
- package/lib/cli/init/git.js +5 -0
- package/lib/cli/init/git.js.map +1 -1
- package/lib/cli/init/index.js +6 -0
- package/lib/cli/init/index.js.map +1 -1
- package/lib/cli/init/prompts.d.ts +1 -1
- package/lib/cli/init/prompts.js.map +2 -2
- package/lib/cli/init/types.js +6 -0
- package/lib/cli/init/types.js.map +1 -1
- package/lib/cli/init/validation.d.ts +1 -1
- package/lib/cli/init/validation.js.map +1 -1
- package/lib/cli/init/writePackageJson.js +4 -0
- package/lib/cli/init/writePackageJson.js.map +1 -1
- package/lib/cli/lint/annotate/buildkite/eslint.d.ts +1 -1
- package/lib/cli/lint/annotate/buildkite/eslint.js +4 -0
- package/lib/cli/lint/annotate/buildkite/eslint.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/index.d.ts +3 -3
- package/lib/cli/lint/annotate/buildkite/index.js +4 -0
- package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/prettier.d.ts +1 -1
- package/lib/cli/lint/annotate/buildkite/prettier.js +4 -0
- package/lib/cli/lint/annotate/buildkite/prettier.js.map +2 -2
- package/lib/cli/lint/annotate/buildkite/tsc.d.ts +1 -1
- package/lib/cli/lint/annotate/buildkite/tsc.js +4 -0
- package/lib/cli/lint/annotate/buildkite/tsc.js.map +2 -2
- package/lib/cli/lint/annotate/github/eslint.d.ts +1 -1
- package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
- package/lib/cli/lint/annotate/github/index.d.ts +3 -3
- package/lib/cli/lint/annotate/github/index.js +4 -0
- package/lib/cli/lint/annotate/github/index.js.map +2 -2
- package/lib/cli/lint/annotate/github/prettier.d.ts +1 -1
- package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
- package/lib/cli/lint/annotate/github/tsc.d.ts +1 -1
- package/lib/cli/lint/annotate/github/tsc.js +4 -0
- package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
- package/lib/cli/lint/autofix.js +54 -11
- package/lib/cli/lint/autofix.js.map +3 -3
- package/lib/cli/lint/eslint.js +4 -0
- package/lib/cli/lint/eslint.js.map +1 -1
- package/lib/cli/lint/external.js +4 -0
- package/lib/cli/lint/external.js.map +1 -1
- package/lib/cli/lint/internal.js +4 -0
- package/lib/cli/lint/internal.js.map +1 -1
- package/lib/cli/lint/prettier.js +4 -0
- package/lib/cli/lint/prettier.js.map +1 -1
- package/lib/cli/node.js +6 -0
- package/lib/cli/node.js.map +1 -1
- package/lib/cli/start.js +4 -0
- package/lib/cli/start.js.map +1 -1
- package/lib/cli/test/reporters/github/annotations.js +4 -0
- package/lib/cli/test/reporters/github/annotations.js.map +1 -1
- package/lib/cli/test/reporters/github/index.js +4 -0
- package/lib/cli/test/reporters/github/index.js.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/skuba.js +4 -0
- package/lib/skuba.js.map +1 -1
- package/lib/utils/args.js +6 -0
- package/lib/utils/args.js.map +1 -1
- package/lib/utils/command.d.ts +1 -1
- package/lib/utils/command.js +4 -0
- package/lib/utils/command.js.map +2 -2
- package/lib/utils/copy.js +4 -0
- package/lib/utils/copy.js.map +1 -1
- package/lib/utils/dir.js +4 -0
- package/lib/utils/dir.js.map +1 -1
- package/lib/utils/error.js +4 -0
- package/lib/utils/error.js.map +1 -1
- package/lib/utils/exec.js +7 -1
- package/lib/utils/exec.js.map +1 -1
- package/lib/utils/logging.js +4 -0
- package/lib/utils/logging.js.map +1 -1
- package/lib/utils/logo.js +4 -0
- package/lib/utils/logo.js.map +1 -1
- package/lib/utils/manifest.js +4 -0
- package/lib/utils/manifest.js.map +1 -1
- package/lib/utils/port.js +4 -0
- package/lib/utils/port.js.map +1 -1
- package/lib/utils/template.d.ts +1 -1
- package/lib/utils/template.js +4 -0
- package/lib/utils/template.js.map +2 -2
- package/lib/utils/validation.js.map +1 -1
- package/lib/utils/version.js +4 -0
- package/lib/utils/version.js.map +1 -1
- package/lib/wrapper/functionHandler.js +4 -0
- package/lib/wrapper/functionHandler.js.map +1 -1
- package/lib/wrapper/http.d.ts +6 -0
- package/lib/wrapper/http.js +15 -8
- package/lib/wrapper/http.js.map +2 -2
- package/lib/wrapper/index.js.map +1 -1
- package/lib/wrapper/main.js +4 -0
- package/lib/wrapper/main.js.map +1 -1
- package/lib/wrapper/requestListener.js +19 -5
- package/lib/wrapper/requestListener.js.map +3 -3
- package/package.json +12 -11
- package/template/express-rest-api/src/config.ts +1 -1
- package/template/koa-rest-api/package.json +4 -4
- package/template/koa-rest-api/src/config.ts +1 -1
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +1 -1
- package/template/lambda-sqs-worker/package.json +4 -3
- package/template/lambda-sqs-worker/src/config.ts +1 -1
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +1 -1
package/lib/utils/template.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as t from 'runtypes';
|
|
2
2
|
export declare const TEMPLATE_NAMES: readonly ["express-rest-api", "greeter", "koa-rest-api", "lambda-sqs-worker", "lambda-sqs-worker-cdk", "oss-npm-package", "private-npm-package"];
|
|
3
|
-
export type TemplateName = typeof TEMPLATE_NAMES[number];
|
|
3
|
+
export type TemplateName = (typeof TEMPLATE_NAMES)[number];
|
|
4
4
|
export declare const TEMPLATE_NAMES_WITH_BYO: readonly ["express-rest-api", "greeter", "koa-rest-api", "lambda-sqs-worker", "lambda-sqs-worker-cdk", "oss-npm-package", "private-npm-package", "github →"];
|
|
5
5
|
interface TemplateDocumentationConfig {
|
|
6
6
|
/**
|
package/lib/utils/template.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
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.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/template.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable new-cap */\n\nimport path from 'path';\n\nimport fs from 'fs-extra';\nimport * as t from 'runtypes';\n\nimport { ProjectType } from './manifest';\n\nexport const TEMPLATE_NAMES = [\n 'express-rest-api',\n 'greeter',\n 'koa-rest-api',\n 'lambda-sqs-worker',\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': {\n added: '3.4.1',\n filename: 'worker.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 = t.Static<typeof TemplateConfig>;\n\nexport const TemplateConfig = t.Record({\n fields: t.Array(\n t.Record({\n name: t.String,\n message: t.String,\n initial: t.String,\n validate: t.Function.optional(),\n }),\n ),\n entryPoint: t.String.optional(),\n noSkip: t.Boolean.optional(),\n type: ProjectType.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": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable new-cap */\n\nimport path from 'path';\n\nimport fs from 'fs-extra';\nimport * as t from 'runtypes';\n\nimport { ProjectType } from './manifest';\n\nexport const TEMPLATE_NAMES = [\n 'express-rest-api',\n 'greeter',\n 'koa-rest-api',\n 'lambda-sqs-worker',\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': {\n added: '3.4.1',\n filename: 'worker.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 = t.Static<typeof TemplateConfig>;\n\nexport const TemplateConfig = t.Record({\n fields: t.Array(\n t.Record({\n name: t.String,\n message: t.String,\n initial: t.String,\n validate: t.Function.optional(),\n }),\n ),\n entryPoint: t.String.optional(),\n noSkip: t.Boolean.optional(),\n type: ProjectType.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;AAEA,kBAAiB;AAEjB,sBAAe;AACf,QAAmB;AAEnB,sBAA4B;AAErB,MAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;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,qBAAqB;AAAA,IACnB,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;AAIO,MAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EAAE;AAAA,IACR,EAAE,OAAO;AAAA,MACP,MAAM,EAAE;AAAA,MACR,SAAS,EAAE;AAAA,MACX,SAAS,EAAE;AAAA,MACX,UAAU,EAAE,SAAS,SAAS;AAAA,IAChC,CAAC;AAAA,EACH;AAAA,EACA,YAAY,EAAE,OAAO,SAAS;AAAA,EAC9B,QAAQ,EAAE,QAAQ,SAAS;AAAA,EAC3B,MAAM,4BAAY,SAAS;AAC7B,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
6
|
"names": ["path", "fs"]
|
|
7
7
|
}
|
|
@@ -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[]) => 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>(\n value: unknown,\n prop: P,\n): value is Record<P, unknown> => isObject(value) && value.hasOwnProperty(prop);\n\nexport const hasNumberProp = <P extends PropertyKey>(\n value: unknown,\n prop: P,\n): value is Record<P, string> =>\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": ";;;;;;;;;;;;;;;;;;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,SACgC,SAAS,KAAK,KAAK,MAAM,eAAe,IAAI;AAEvE,MAAM,gBAAgB,CAC3B,OACA,SAEA,SAAS,KAAK,KAAK,OAAO,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,SACgC,SAAS,KAAK,KAAK,MAAM,eAAe,IAAI;AAEvE,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
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
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.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
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 searchNpm from 'libnpmsearch';\nimport validatePackageName from 'validate-npm-package-name';\n\nimport { getSkubaManifest } from './manifest';\nimport { withTimeout } from './wait';\n\nexport const latestNpmVersion = async (\n packageName: string,\n): Promise<string> => {\n const { validForNewPackages } = validatePackageName(packageName);\n\n if (!validForNewPackages) {\n throw new Error(`Package \"${packageName}\" does not have a valid name`);\n }\n\n const [result] = await searchNpm(packageName, { limit: 1, timeout: 5_000 });\n\n if (result?.name !== packageName) {\n throw new Error(\n `Package \"${packageName}\" does not exist on the npm registry`,\n );\n }\n\n return result.version;\n};\n\nconst latestSkubaVersion = async (): Promise<string | null> => {\n try {\n const result = await withTimeout(latestNpmVersion('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": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAsB;AACtB,uCAAgC;AAEhC,sBAAiC;AACjC,kBAA4B;AAErB,MAAM,mBAAmB,OAC9B,gBACoB;AACpB,QAAM,EAAE,oBAAoB,QAAI,iCAAAA,SAAoB,WAAW;AAE/D,MAAI,CAAC,qBAAqB;AACxB,UAAM,IAAI,MAAM,YAAY,yCAAyC;AAAA,EACvE;AAEA,QAAM,CAAC,MAAM,IAAI,UAAM,oBAAAC,SAAU,aAAa,EAAE,OAAO,GAAG,SAAS,IAAM,CAAC;AAE1E,MAAI,QAAQ,SAAS,aAAa;AAChC,UAAM,IAAI;AAAA,MACR,YAAY;AAAA,IACd;AAAA,EACF;AAEA,SAAO,OAAO;AAChB;AAEA,MAAM,qBAAqB,YAAoC;AAC7D,MAAI;AACF,UAAM,SAAS,UAAM,yBAAY,iBAAiB,OAAO,GAAG,EAAE,GAAG,EAAE,CAAC;AAEpE,WAAO,OAAO,KAAK,OAAO,QAAQ;AAAA,EACpC,QAAE;AACA,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
6
|
"names": ["validatePackageName", "searchNpm"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
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.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/wrapper/functionHandler.ts"],
|
|
4
4
|
"sourcesContent": ["import fnArgs from 'function-arguments';\n\nimport { log } from '../utils/logging';\nimport { isFunction, isObject } from '../utils/validation';\n\nimport {\n createRequestListenerFromFunction,\n serveRequestListener,\n} from './http';\n\ninterface Args {\n availablePort?: number;\n entryPoint: unknown;\n functionName: string;\n}\n\n/**\n * Create an HTTP server that calls into an exported function.\n */\nexport const runFunctionHandler = async ({\n availablePort,\n entryPoint,\n functionName,\n}: Args): Promise<void> => {\n if (!isObject(entryPoint)) {\n log.subtle(log.bold(functionName), 'is not exported');\n return;\n }\n\n const fn = entryPoint[functionName];\n\n if (!isFunction(fn)) {\n log.subtle(log.bold(functionName), 'is not a function');\n return;\n }\n\n log.warn(\n log.bold(functionName),\n `(${fnArgs(fn)\n // Add a `?` placeholder for unnamed arguments.\n .map((arg) => arg || '?')\n .join(', ')})`,\n );\n\n const requestListener = createRequestListenerFromFunction(fn);\n\n return serveRequestListener(requestListener, availablePort);\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAmB;AAEnB,qBAAoB;AACpB,wBAAqC;AAErC,kBAGO;AAWA,MAAM,qBAAqB,OAAO;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF,MAA2B;AACzB,MAAI,KAAC,4BAAS,UAAU,GAAG;AACzB,uBAAI,OAAO,mBAAI,KAAK,YAAY,GAAG,iBAAiB;AACpD;AAAA,EACF;AAEA,QAAM,KAAK,WAAW,YAAY;AAElC,MAAI,KAAC,8BAAW,EAAE,GAAG;AACnB,uBAAI,OAAO,mBAAI,KAAK,YAAY,GAAG,mBAAmB;AACtD;AAAA,EACF;AAEA,qBAAI;AAAA,IACF,mBAAI,KAAK,YAAY;AAAA,IACrB,QAAI,0BAAAA,SAAO,EAAE,EAEV,IAAI,CAAC,QAAQ,OAAO,GAAG,EACvB,KAAK,IAAI;AAAA,EACd;AAEA,QAAM,sBAAkB,+CAAkC,EAAE;AAE5D,aAAO,kCAAqB,iBAAiB,aAAa;AAC5D;",
|
|
6
6
|
"names": ["fnArgs"]
|
|
7
7
|
}
|
package/lib/wrapper/http.d.ts
CHANGED
|
@@ -12,3 +12,9 @@ export declare const createRequestListenerFromFunction: (fn: (...args: unknown[]
|
|
|
12
12
|
* This function resolves when the server is closed.
|
|
13
13
|
*/
|
|
14
14
|
export declare const serveRequestListener: (requestListener: http.RequestListener, port?: number) => Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns a HTTP server wrapped in a promise
|
|
17
|
+
*
|
|
18
|
+
* This function resolves when the server is closed.
|
|
19
|
+
*/
|
|
20
|
+
export declare const startServer: (server: http.Server, port?: number) => Promise<void>;
|
package/lib/wrapper/http.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
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.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -25,7 +29,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
25
29
|
var http_exports = {};
|
|
26
30
|
__export(http_exports, {
|
|
27
31
|
createRequestListenerFromFunction: () => createRequestListenerFromFunction,
|
|
28
|
-
serveRequestListener: () => serveRequestListener
|
|
32
|
+
serveRequestListener: () => serveRequestListener,
|
|
33
|
+
startServer: () => startServer
|
|
29
34
|
});
|
|
30
35
|
module.exports = __toCommonJS(http_exports);
|
|
31
36
|
var import_http = __toESM(require("http"));
|
|
@@ -57,16 +62,18 @@ const createRequestListenerFromFunction = (fn) => async (req, res) => {
|
|
|
57
62
|
};
|
|
58
63
|
const serveRequestListener = (requestListener, port) => {
|
|
59
64
|
const server = import_http.default.createServer(requestListener);
|
|
60
|
-
return
|
|
61
|
-
(resolve, reject) => server.listen(port).on("close", resolve).on("error", reject).on("listening", () => {
|
|
62
|
-
const address = server.address();
|
|
63
|
-
import_logging.log.ok("listening on port", import_logging.log.bold(address.port));
|
|
64
|
-
})
|
|
65
|
-
);
|
|
65
|
+
return startServer(server, port);
|
|
66
66
|
};
|
|
67
|
+
const startServer = (server, port) => new Promise(
|
|
68
|
+
(resolve, reject) => server.listen(port).on("close", resolve).on("error", reject).on("listening", () => {
|
|
69
|
+
const address = server.address();
|
|
70
|
+
import_logging.log.ok("listening on port", import_logging.log.bold(address.port));
|
|
71
|
+
})
|
|
72
|
+
);
|
|
67
73
|
// Annotate the CommonJS export names for ESM import in node:
|
|
68
74
|
0 && (module.exports = {
|
|
69
75
|
createRequestListenerFromFunction,
|
|
70
|
-
serveRequestListener
|
|
76
|
+
serveRequestListener,
|
|
77
|
+
startServer
|
|
71
78
|
});
|
|
72
79
|
//# sourceMappingURL=http.js.map
|
package/lib/wrapper/http.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/wrapper/http.ts"],
|
|
4
|
-
"sourcesContent": ["import http from 'http';\nimport type { AddressInfo } from 'net';\n\nimport { serializeError } from 'serialize-error';\n\nimport { log } from '../utils/logging';\n\n/**\n * Create an HTTP request listener based on the supplied function.\n *\n * - The request body is JSON parsed and passed into the function as parameters.\n * - The function's return value is JSON stringified into the response body.\n */\nexport const createRequestListenerFromFunction =\n (\n fn: (...args: unknown[]) => unknown | Promise<unknown>,\n ): http.RequestListener =>\n async (req, res) => {\n const writeJsonResponse = (statusCode: number, jsonResponse: unknown) => {\n res.writeHead(statusCode, { 'Content-Type': 'application/json' });\n\n return new Promise<void>((resolve, reject) =>\n jsonResponse === undefined\n ? res.end(resolve)\n : res.write(JSON.stringify(jsonResponse, null, 2), 'utf8', (err) =>\n err ? reject(err) : res.end(resolve),\n ),\n );\n };\n\n try {\n const requestBody = await new Promise<string>((resolve, reject) => {\n const data: Buffer[] = [];\n\n req\n .on('data', (chunk: Buffer) => data.push(chunk))\n .on('end', () => resolve(Buffer.concat(data).toString()))\n .on('error', (err) => reject(err));\n });\n\n // Treat an empty body as no arguments\n const jsonRequest: unknown = requestBody ? JSON.parse(requestBody) : [];\n\n // Pass a non-array request body as the first parameter\n const args: unknown[] = Array.isArray(jsonRequest)\n ? jsonRequest\n : [jsonRequest];\n\n const response: unknown = await fn(...args);\n\n await writeJsonResponse(200, response);\n } catch (err) {\n await writeJsonResponse(500, serializeError(err));\n }\n };\n\n/**\n * Create a HTTP server based on the supplied `http.RequestListener`.\n *\n * This function resolves when the server is closed.\n */\nexport const serveRequestListener = (\n requestListener: http.RequestListener,\n port?: number,\n) => {\n const server = http.createServer(requestListener);\n\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import http from 'http';\nimport type { AddressInfo } from 'net';\n\nimport { serializeError } from 'serialize-error';\n\nimport { log } from '../utils/logging';\n\n/**\n * Create an HTTP request listener based on the supplied function.\n *\n * - The request body is JSON parsed and passed into the function as parameters.\n * - The function's return value is JSON stringified into the response body.\n */\nexport const createRequestListenerFromFunction =\n (\n fn: (...args: unknown[]) => unknown | Promise<unknown>,\n ): http.RequestListener =>\n async (req, res) => {\n const writeJsonResponse = (statusCode: number, jsonResponse: unknown) => {\n res.writeHead(statusCode, { 'Content-Type': 'application/json' });\n\n return new Promise<void>((resolve, reject) =>\n jsonResponse === undefined\n ? res.end(resolve)\n : res.write(JSON.stringify(jsonResponse, null, 2), 'utf8', (err) =>\n err ? reject(err) : res.end(resolve),\n ),\n );\n };\n\n try {\n const requestBody = await new Promise<string>((resolve, reject) => {\n const data: Buffer[] = [];\n\n req\n .on('data', (chunk: Buffer) => data.push(chunk))\n .on('end', () => resolve(Buffer.concat(data).toString()))\n .on('error', (err) => reject(err));\n });\n\n // Treat an empty body as no arguments\n const jsonRequest: unknown = requestBody ? JSON.parse(requestBody) : [];\n\n // Pass a non-array request body as the first parameter\n const args: unknown[] = Array.isArray(jsonRequest)\n ? jsonRequest\n : [jsonRequest];\n\n const response: unknown = await fn(...args);\n\n await writeJsonResponse(200, response);\n } catch (err) {\n await writeJsonResponse(500, serializeError(err));\n }\n };\n\n/**\n * Create a HTTP server based on the supplied `http.RequestListener`.\n *\n * This function resolves when the server is closed.\n */\nexport const serveRequestListener = (\n requestListener: http.RequestListener,\n port?: number,\n) => {\n const server = http.createServer(requestListener);\n return startServer(server, port);\n};\n\n/**\n * Returns a HTTP server wrapped in a promise\n *\n * This function resolves when the server is closed.\n */\nexport const startServer = (server: http.Server, port?: number) =>\n new Promise<void>((resolve, reject) =>\n server\n .listen(port)\n .on('close', resolve)\n .on('error', reject)\n .on('listening', () => {\n const address = server.address() as AddressInfo;\n\n log.ok('listening on port', log.bold(address.port));\n }),\n );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAGjB,6BAA+B;AAE/B,qBAAoB;AAQb,MAAM,oCACX,CACE,OAEF,OAAO,KAAK,QAAQ;AAClB,QAAM,oBAAoB,CAAC,YAAoB,iBAA0B;AACvE,QAAI,UAAU,YAAY,EAAE,gBAAgB,mBAAmB,CAAC;AAEhE,WAAO,IAAI;AAAA,MAAc,CAAC,SAAS,WACjC,iBAAiB,SACb,IAAI,IAAI,OAAO,IACf,IAAI;AAAA,QAAM,KAAK,UAAU,cAAc,MAAM,CAAC;AAAA,QAAG;AAAA,QAAQ,CAAC,QACxD,MAAM,OAAO,GAAG,IAAI,IAAI,IAAI,OAAO;AAAA,MACrC;AAAA,IACN;AAAA,EACF;AAEA,MAAI;AACF,UAAM,cAAc,MAAM,IAAI,QAAgB,CAAC,SAAS,WAAW;AACjE,YAAM,OAAiB,CAAC;AAExB,UACG,GAAG,QAAQ,CAAC,UAAkB,KAAK,KAAK,KAAK,CAAC,EAC9C,GAAG,OAAO,MAAM,QAAQ,OAAO,OAAO,IAAI,EAAE,SAAS,CAAC,CAAC,EACvD,GAAG,SAAS,CAAC,QAAQ,OAAO,GAAG,CAAC;AAAA,IACrC,CAAC;AAGD,UAAM,cAAuB,cAAc,KAAK,MAAM,WAAW,IAAI,CAAC;AAGtE,UAAM,OAAkB,MAAM,QAAQ,WAAW,IAC7C,cACA,CAAC,WAAW;AAEhB,UAAM,WAAoB,MAAM,GAAG,GAAG,IAAI;AAE1C,UAAM,kBAAkB,KAAK,QAAQ;AAAA,EACvC,SAAS,KAAP;AACA,UAAM,kBAAkB,SAAK,uCAAe,GAAG,CAAC;AAAA,EAClD;AACF;AAOK,MAAM,uBAAuB,CAClC,iBACA,SACG;AACH,QAAM,SAAS,YAAAA,QAAK,aAAa,eAAe;AAChD,SAAO,YAAY,QAAQ,IAAI;AACjC;AAOO,MAAM,cAAc,CAAC,QAAqB,SAC/C,IAAI;AAAA,EAAc,CAAC,SAAS,WAC1B,OACG,OAAO,IAAI,EACX,GAAG,SAAS,OAAO,EACnB,GAAG,SAAS,MAAM,EAClB,GAAG,aAAa,MAAM;AACrB,UAAM,UAAU,OAAO,QAAQ;AAE/B,uBAAI,GAAG,qBAAqB,mBAAI,KAAK,QAAQ,IAAI,CAAC;AAAA,EACpD,CAAC;AACL;",
|
|
6
6
|
"names": ["http"]
|
|
7
7
|
}
|
package/lib/wrapper/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/wrapper/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Wrapper around an entry point provided to `skuba node` or `skuba start`.\n *\n * Beyond simply loading the entry point, it supports the following features:\n *\n * - If you set the entry point to an exported function like `src/app#handler`,\n * it will spin up a local HTTP server that calls into the function.\n *\n * - If you `export =` or `export default` an Express or Koa application,\n * it will spin up a local HTTP server based on the request listener.\n */\n\nimport { handleCliError } from '../utils/error';\nimport { log } from '../utils/logging';\n\nimport { main } from './main';\n\nconst ENTRY_POINT_VAR = '__SKUBA_ENTRY_POINT';\nconst PORT_VAR = '__SKUBA_PORT';\n\nconst rawEntryPoint = process.env[ENTRY_POINT_VAR];\nif (!rawEntryPoint) {\n throw new Error(`Missing environment variable: ${log.bold(ENTRY_POINT_VAR)}`);\n}\n\nconst rawPort = process.env[PORT_VAR];\nif (!rawPort) {\n throw new Error(`Missing environment variable: ${log.bold(PORT_VAR)}`);\n}\n\nmain(rawEntryPoint, rawPort).catch(handleCliError);\n"],
|
|
5
|
-
"mappings": ";AAYA,mBAA+B;AAC/B,qBAAoB;AAEpB,kBAAqB;AAErB,MAAM,kBAAkB;AACxB,MAAM,WAAW;AAEjB,MAAM,gBAAgB,QAAQ,IAAI;
|
|
5
|
+
"mappings": ";AAYA,mBAA+B;AAC/B,qBAAoB;AAEpB,kBAAqB;AAErB,MAAM,kBAAkB;AACxB,MAAM,WAAW;AAEjB,MAAM,gBAAgB,QAAQ,IAAI,eAAe;AACjD,IAAI,CAAC,eAAe;AAClB,QAAM,IAAI,MAAM,iCAAiC,mBAAI,KAAK,eAAe,GAAG;AAC9E;AAEA,MAAM,UAAU,QAAQ,IAAI,QAAQ;AACpC,IAAI,CAAC,SAAS;AACZ,QAAM,IAAI,MAAM,iCAAiC,mBAAI,KAAK,QAAQ,GAAG;AACvE;AAAA,IAEA,kBAAK,eAAe,OAAO,EAAE,MAAM,2BAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/wrapper/main.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
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.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
package/lib/wrapper/main.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/wrapper/main.ts"],
|
|
4
4
|
"sourcesContent": ["import path from 'path';\n\nimport { runFunctionHandler } from './functionHandler';\nimport { runRequestListener } from './requestListener';\n\nexport const main = async (rawEntryPoint: string, rawPort: string) => {\n const availablePort = Number(rawPort) || undefined;\n\n // Support exported function targeting, e.g. `src/module.ts#callMeMaybe`\n const [modulePath, functionName] = path\n .join(process.cwd(), rawEntryPoint)\n .split('#', 2);\n\n // Load entry point as module\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const entryPoint = require(modulePath) as unknown;\n\n return functionName\n ? runFunctionHandler({ availablePort, entryPoint, functionName })\n : runRequestListener({ availablePort, entryPoint });\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,6BAAmC;AACnC,6BAAmC;AAE5B,MAAM,OAAO,OAAO,eAAuB,YAAoB;AACpE,QAAM,gBAAgB,OAAO,OAAO,KAAK;AAGzC,QAAM,CAAC,YAAY,YAAY,IAAI,YAAAA,QAChC,KAAK,QAAQ,IAAI,GAAG,aAAa,EACjC,MAAM,KAAK,CAAC;AAIf,QAAM,aAAa,QAAQ,UAAU;AAErC,SAAO,mBACH,2CAAmB,EAAE,eAAe,YAAY,aAAa,CAAC,QAC9D,2CAAmB,EAAE,eAAe,WAAW,CAAC;AACtD;",
|
|
6
6
|
"names": ["path"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,14 +17,23 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
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
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var requestListener_exports = {};
|
|
20
30
|
__export(requestListener_exports, {
|
|
21
31
|
runRequestListener: () => runRequestListener
|
|
22
32
|
});
|
|
23
33
|
module.exports = __toCommonJS(requestListener_exports);
|
|
34
|
+
var import_http = __toESM(require("http"));
|
|
24
35
|
var import_validation = require("../utils/validation");
|
|
25
|
-
var
|
|
36
|
+
var import_http2 = require("./http");
|
|
26
37
|
const isConfig = (data) => (0, import_validation.isFunction)(data) || (0, import_validation.isObject)(data);
|
|
27
38
|
const runRequestListener = async ({
|
|
28
39
|
availablePort,
|
|
@@ -31,19 +42,22 @@ const runRequestListener = async ({
|
|
|
31
42
|
if (!isConfig(entryPoint)) {
|
|
32
43
|
return;
|
|
33
44
|
}
|
|
34
|
-
let config = entryPoint;
|
|
45
|
+
let config = await entryPoint;
|
|
35
46
|
if (typeof config === "object" && isConfig(config.default)) {
|
|
36
|
-
config = config.default;
|
|
47
|
+
config = await config.default;
|
|
37
48
|
}
|
|
38
49
|
if (Object.keys(config).length === 0) {
|
|
39
50
|
return;
|
|
40
51
|
}
|
|
52
|
+
const port = (0, import_validation.isIpPort)(config.port) ? config.port : availablePort;
|
|
53
|
+
if (typeof config !== "function" && config.server && config.server instanceof import_http.default.Server) {
|
|
54
|
+
return (0, import_http2.startServer)(config.server, port);
|
|
55
|
+
}
|
|
41
56
|
const requestListener = typeof config === "function" ? config : config.requestListener ?? config.callback?.();
|
|
42
57
|
if (typeof requestListener !== "function") {
|
|
43
58
|
return;
|
|
44
59
|
}
|
|
45
|
-
|
|
46
|
-
return (0, import_http.serveRequestListener)(requestListener, port);
|
|
60
|
+
return (0, import_http2.serveRequestListener)(requestListener, port);
|
|
47
61
|
};
|
|
48
62
|
// Annotate the CommonJS export names for ESM import in node:
|
|
49
63
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/wrapper/requestListener.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import http from 'http';\n\nimport { isFunction, isIpPort, isObject } from '../utils/validation';\n\nimport { serveRequestListener, startServer } from './http';\n\n// Express compatibility\ninterface FunctionConfig extends http.RequestListener {\n port?: number;\n}\n\ninterface ObjectConfig {\n // Koa compatibility\n callback?: () => http.RequestListener;\n\n requestListener?: http.RequestListener;\n\n // Fastify compatibility\n server?: http.Server;\n\n default?: Promise<unknown>;\n port?: unknown;\n}\n\nconst isConfig = (\n data: unknown,\n): data is Promise<FunctionConfig> | Promise<ObjectConfig> =>\n isFunction(data) || isObject(data);\n\ninterface Args {\n availablePort?: number;\n entryPoint: unknown;\n}\n\n/**\n * Create an HTTP server that calls into an exported `http.RequestListener`.\n *\n * This supports Express and Koa applications out of the box.\n */\nexport const runRequestListener = async ({\n availablePort,\n entryPoint,\n}: Args): Promise<void> => {\n if (!isConfig(entryPoint)) {\n // Assume an executable script with weird exports\n return;\n }\n\n let config: FunctionConfig | ObjectConfig = await entryPoint;\n\n if (typeof config === 'object' && isConfig(config.default)) {\n // Prefer `export default` over `export =`\n config = await config.default;\n }\n\n if (Object.keys(config).length === 0) {\n // Assume an executable script with no exports\n return;\n }\n\n const port = isIpPort(config.port) ? config.port : availablePort;\n\n // Fastify workaround\n if (\n typeof config !== 'function' &&\n config.server &&\n config.server instanceof http.Server\n ) {\n return startServer(config.server, port);\n }\n\n const requestListener =\n typeof config === 'function'\n ? config\n : config.requestListener ?? config.callback?.();\n\n if (typeof requestListener !== 'function') {\n // Assume an executable script with non-request listener exports\n return;\n }\n\n return serveRequestListener(requestListener, port);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,wBAA+C;AAE/C,IAAAA,eAAkD;AAoBlD,MAAM,WAAW,CACf,aAEA,8BAAW,IAAI,SAAK,4BAAS,IAAI;AAY5B,MAAM,qBAAqB,OAAO;AAAA,EACvC;AAAA,EACA;AACF,MAA2B;AACzB,MAAI,CAAC,SAAS,UAAU,GAAG;AAEzB;AAAA,EACF;AAEA,MAAI,SAAwC,MAAM;AAElD,MAAI,OAAO,WAAW,YAAY,SAAS,OAAO,OAAO,GAAG;AAE1D,aAAS,MAAM,OAAO;AAAA,EACxB;AAEA,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AAEpC;AAAA,EACF;AAEA,QAAM,WAAO,4BAAS,OAAO,IAAI,IAAI,OAAO,OAAO;AAGnD,MACE,OAAO,WAAW,cAClB,OAAO,UACP,OAAO,kBAAkB,YAAAC,QAAK,QAC9B;AACA,eAAO,0BAAY,OAAO,QAAQ,IAAI;AAAA,EACxC;AAEA,QAAM,kBACJ,OAAO,WAAW,aACd,SACA,OAAO,mBAAmB,OAAO,WAAW;AAElD,MAAI,OAAO,oBAAoB,YAAY;AAEzC;AAAA,EACF;AAEA,aAAO,mCAAqB,iBAAiB,IAAI;AACnD;",
|
|
6
|
+
"names": ["import_http", "http"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skuba",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0-beta.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "SEEK development toolkit for backend applications and packages",
|
|
6
6
|
"homepage": "https://github.com/seek-oss/skuba#readme",
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"**/@types/node": ">=14.18"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@esbuild-plugins/tsconfig-paths": "^0.0
|
|
71
|
+
"@esbuild-plugins/tsconfig-paths": "^0.1.0",
|
|
72
72
|
"@jest/types": "^29.0.0",
|
|
73
73
|
"@octokit/graphql": "^5.0.0",
|
|
74
|
-
"@octokit/graphql-schema": "^
|
|
74
|
+
"@octokit/graphql-schema": "^13.0.0",
|
|
75
75
|
"@octokit/rest": "^19.0.0",
|
|
76
|
-
"@octokit/types": "^
|
|
76
|
+
"@octokit/types": "^9.0.0",
|
|
77
77
|
"@types/jest": "^29.0.0",
|
|
78
78
|
"@types/node": ">=14.18",
|
|
79
79
|
"chalk": "^4.1.0",
|
|
@@ -81,11 +81,11 @@
|
|
|
81
81
|
"dotenv": "^16.0.0",
|
|
82
82
|
"ejs": "^3.1.6",
|
|
83
83
|
"enquirer": "^2.3.6",
|
|
84
|
-
"esbuild": "~0.
|
|
84
|
+
"esbuild": "~0.17.0",
|
|
85
85
|
"eslint": "^8.11.0",
|
|
86
|
-
"eslint-config-skuba": "1.
|
|
86
|
+
"eslint-config-skuba": "1.3.0",
|
|
87
87
|
"execa": "^5.0.0",
|
|
88
|
-
"fdir": "^
|
|
88
|
+
"fdir": "^6.0.0",
|
|
89
89
|
"fs-extra": "^11.0.0",
|
|
90
90
|
"function-arguments": "^1.0.9",
|
|
91
91
|
"get-port": "^5.1.1",
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
"devDependencies": {
|
|
122
122
|
"@changesets/cli": "2.26.0",
|
|
123
123
|
"@changesets/get-github-info": "0.5.2",
|
|
124
|
-
"@jest/reporters": "29.
|
|
124
|
+
"@jest/reporters": "29.4.1",
|
|
125
125
|
"@types/ejs": "3.1.1",
|
|
126
|
-
"@types/express": "4.17.
|
|
127
|
-
"@types/fs-extra": "
|
|
126
|
+
"@types/express": "4.17.16",
|
|
127
|
+
"@types/fs-extra": "11.0.1",
|
|
128
128
|
"@types/koa": "2.13.5",
|
|
129
129
|
"@types/libnpmsearch": "2.0.3",
|
|
130
130
|
"@types/lodash.mergewith": "4.6.7",
|
|
@@ -135,9 +135,10 @@
|
|
|
135
135
|
"@types/validate-npm-package-name": "4.0.0",
|
|
136
136
|
"enhanced-resolve": "5.12.0",
|
|
137
137
|
"express": "4.18.2",
|
|
138
|
+
"fastify": "4.12.0",
|
|
138
139
|
"jsonfile": "6.1.0",
|
|
139
140
|
"koa": "2.14.1",
|
|
140
|
-
"memfs": "3.4.
|
|
141
|
+
"memfs": "3.4.13",
|
|
141
142
|
"remark-cli": "11.0.0",
|
|
142
143
|
"remark-preset-lint-recommended": "6.1.2",
|
|
143
144
|
"semver": "7.3.8",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"@koa/router": "^12.0.0",
|
|
16
16
|
"@opentelemetry/api": "^1.1.0",
|
|
17
17
|
"@opentelemetry/exporter-collector-grpc": "^0.25.0",
|
|
18
|
-
"@opentelemetry/instrumentation-aws-sdk": "^0.
|
|
19
|
-
"@opentelemetry/instrumentation-http": "^0.
|
|
20
|
-
"@opentelemetry/sdk-node": "^0.
|
|
18
|
+
"@opentelemetry/instrumentation-aws-sdk": "^0.34.0",
|
|
19
|
+
"@opentelemetry/instrumentation-http": "^0.35.0",
|
|
20
|
+
"@opentelemetry/sdk-node": "^0.35.0",
|
|
21
21
|
"@seek/logger": "^5.0.1",
|
|
22
22
|
"aws-sdk": "^2.1039.0",
|
|
23
|
-
"hot-shots": "^
|
|
23
|
+
"hot-shots": "^10.0.0",
|
|
24
24
|
"koa": "^2.13.4",
|
|
25
25
|
"koa-bodyparser": "^4.3.0",
|
|
26
26
|
"koa-compose": "^4.2.0",
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
"test:watch": "skuba test --watch"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@aws-sdk/client-codedeploy": "^3.
|
|
18
|
-
"@aws-sdk/client-lambda": "^3.
|
|
19
|
-
"@aws-sdk/client-sns": "^3.
|
|
17
|
+
"@aws-sdk/client-codedeploy": "^3.259.0",
|
|
18
|
+
"@aws-sdk/client-lambda": "^3.259.0",
|
|
19
|
+
"@aws-sdk/client-sns": "^3.259.0",
|
|
20
|
+
"@aws-sdk/util-utf8-node": "^3.259.0",
|
|
20
21
|
"@seek/logger": "^5.0.1",
|
|
21
22
|
"datadog-lambda-js": "^6.83.0",
|
|
22
23
|
"dd-trace": "^3.8.0",
|