@expo/steps 1.0.25 → 1.0.29

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.
Files changed (71) hide show
  1. package/dist_commonjs/BuildConfig.cjs +6 -2
  2. package/dist_commonjs/BuildConfig.d.ts +4 -3
  3. package/dist_commonjs/BuildConfig.js.map +1 -1
  4. package/dist_commonjs/BuildConfigParser.cjs +16 -6
  5. package/dist_commonjs/BuildConfigParser.d.ts +1 -3
  6. package/dist_commonjs/BuildConfigParser.js.map +1 -1
  7. package/dist_commonjs/BuildFunction.cjs +10 -4
  8. package/dist_commonjs/BuildFunction.d.ts +5 -3
  9. package/dist_commonjs/BuildFunction.js.map +1 -1
  10. package/dist_commonjs/BuildStep.cjs +60 -12
  11. package/dist_commonjs/BuildStep.d.ts +21 -4
  12. package/dist_commonjs/BuildStep.js.map +1 -1
  13. package/dist_commonjs/BuildStepContext.cjs +50 -1
  14. package/dist_commonjs/BuildStepContext.d.ts +29 -4
  15. package/dist_commonjs/BuildStepContext.js.map +1 -1
  16. package/dist_commonjs/BuildStepInput.cjs +27 -1
  17. package/dist_commonjs/BuildStepInput.d.ts +31 -17
  18. package/dist_commonjs/BuildStepInput.js.map +1 -1
  19. package/dist_commonjs/BuildStepOutput.cjs +21 -1
  20. package/dist_commonjs/BuildStepOutput.d.ts +18 -8
  21. package/dist_commonjs/BuildStepOutput.js.map +1 -1
  22. package/dist_commonjs/BuildWorkflowValidator.cjs +25 -1
  23. package/dist_commonjs/BuildWorkflowValidator.d.ts +2 -1
  24. package/dist_commonjs/BuildWorkflowValidator.js.map +1 -1
  25. package/dist_commonjs/cli/cli.cjs +2 -2
  26. package/dist_commonjs/cli/cli.js.map +1 -1
  27. package/dist_commonjs/index.cjs +5 -3
  28. package/dist_commonjs/index.d.ts +1 -0
  29. package/dist_commonjs/index.js.map +1 -1
  30. package/dist_commonjs/scripts/runCustomFunction.cjs +106 -0
  31. package/dist_commonjs/scripts/runCustomFunction.d.ts +1 -0
  32. package/dist_commonjs/scripts/runCustomFunction.js.map +1 -0
  33. package/dist_commonjs/utils/customFunction.cjs +32 -0
  34. package/dist_commonjs/utils/customFunction.d.ts +13 -0
  35. package/dist_commonjs/utils/customFunction.js.map +1 -0
  36. package/dist_esm/BuildConfig.d.ts +4 -3
  37. package/dist_esm/BuildConfig.js +7 -3
  38. package/dist_esm/BuildConfig.js.map +1 -1
  39. package/dist_esm/BuildConfigParser.d.ts +1 -3
  40. package/dist_esm/BuildConfigParser.js +16 -6
  41. package/dist_esm/BuildConfigParser.js.map +1 -1
  42. package/dist_esm/BuildFunction.d.ts +5 -3
  43. package/dist_esm/BuildFunction.js +10 -4
  44. package/dist_esm/BuildFunction.js.map +1 -1
  45. package/dist_esm/BuildStep.d.ts +21 -4
  46. package/dist_esm/BuildStep.js +59 -12
  47. package/dist_esm/BuildStep.js.map +1 -1
  48. package/dist_esm/BuildStepContext.d.ts +29 -4
  49. package/dist_esm/BuildStepContext.js +50 -1
  50. package/dist_esm/BuildStepContext.js.map +1 -1
  51. package/dist_esm/BuildStepInput.d.ts +31 -17
  52. package/dist_esm/BuildStepInput.js +27 -1
  53. package/dist_esm/BuildStepInput.js.map +1 -1
  54. package/dist_esm/BuildStepOutput.d.ts +18 -8
  55. package/dist_esm/BuildStepOutput.js +21 -1
  56. package/dist_esm/BuildStepOutput.js.map +1 -1
  57. package/dist_esm/BuildWorkflowValidator.d.ts +2 -1
  58. package/dist_esm/BuildWorkflowValidator.js +22 -1
  59. package/dist_esm/BuildWorkflowValidator.js.map +1 -1
  60. package/dist_esm/cli/cli.js +2 -2
  61. package/dist_esm/cli/cli.js.map +1 -1
  62. package/dist_esm/index.d.ts +1 -0
  63. package/dist_esm/index.js +1 -0
  64. package/dist_esm/index.js.map +1 -1
  65. package/dist_esm/scripts/runCustomFunction.d.ts +1 -0
  66. package/dist_esm/scripts/runCustomFunction.js +101 -0
  67. package/dist_esm/scripts/runCustomFunction.js.map +1 -0
  68. package/dist_esm/utils/customFunction.d.ts +13 -0
  69. package/dist_esm/utils/customFunction.js +25 -0
  70. package/dist_esm/utils/customFunction.js.map +1 -0
  71. package/package.json +5 -2
@@ -1,12 +1,14 @@
1
1
  import os from 'os';
2
2
  import path from 'path';
3
3
  import { v4 as uuidv4 } from 'uuid';
4
+ import { BuildStepOutputAccessor, } from './BuildStep.js';
4
5
  import { getObjectValueForInterpolation, interpolateWithGlobalContext, parseOutputPath, } from './utils/template.js';
5
6
  import { BuildStepRuntimeError } from './errors.js';
6
7
  export class BuildStepGlobalContext {
7
- constructor(provider, skipCleanup) {
8
+ constructor(provider, skipCleanup, configPath) {
8
9
  this.provider = provider;
9
10
  this.skipCleanup = skipCleanup;
11
+ this.configPath = configPath;
10
12
  this.stepById = {};
11
13
  this.stepsInternalBuildDirectory = path.join(os.tmpdir(), 'eas-build', uuidv4());
12
14
  this.runtimePlatform = provider.runtimePlatform;
@@ -54,6 +56,40 @@ export class BuildStepGlobalContext {
54
56
  stepCtx(options) {
55
57
  return new BuildStepContext(this, options);
56
58
  }
59
+ serialize() {
60
+ return {
61
+ stepsInternalBuildDirectory: this.stepsInternalBuildDirectory,
62
+ stepById: Object.fromEntries(Object.entries(this.stepById).map(([id, step]) => [id, step.serialize()])),
63
+ provider: {
64
+ projectSourceDirectory: this.provider.projectSourceDirectory,
65
+ projectTargetDirectory: this.provider.projectTargetDirectory,
66
+ defaultWorkingDirectory: this.provider.defaultWorkingDirectory,
67
+ runtimePlatform: this.provider.runtimePlatform,
68
+ staticContext: this.provider.staticContext(),
69
+ env: this.provider.env,
70
+ },
71
+ skipCleanup: this.skipCleanup,
72
+ configPath: this.configPath,
73
+ };
74
+ }
75
+ static deserialize(serialized, logger) {
76
+ const deserializedProvider = {
77
+ projectSourceDirectory: serialized.provider.projectSourceDirectory,
78
+ projectTargetDirectory: serialized.provider.projectTargetDirectory,
79
+ defaultWorkingDirectory: serialized.provider.defaultWorkingDirectory,
80
+ runtimePlatform: serialized.provider.runtimePlatform,
81
+ logger,
82
+ staticContext: () => serialized.provider.staticContext,
83
+ env: serialized.provider.env,
84
+ updateEnv: () => { },
85
+ };
86
+ const ctx = new BuildStepGlobalContext(deserializedProvider, serialized.skipCleanup, serialized.configPath);
87
+ for (const [id, stepOutputAccessor] of Object.entries(serialized.stepById)) {
88
+ ctx.stepById[id] = BuildStepOutputAccessor.deserialize(stepOutputAccessor);
89
+ }
90
+ ctx.stepsInternalBuildDirectory = serialized.stepsInternalBuildDirectory;
91
+ return ctx;
92
+ }
57
93
  }
58
94
  export class BuildStepContext {
59
95
  constructor(ctx, { logger, workingDirectory, }) {
@@ -64,5 +100,18 @@ export class BuildStepContext {
64
100
  get global() {
65
101
  return this.ctx;
66
102
  }
103
+ serialize() {
104
+ return {
105
+ workingDirectory: this.workingDirectory,
106
+ global: this.ctx.serialize(),
107
+ };
108
+ }
109
+ static deserialize(serialized, logger) {
110
+ const deserializedGlobal = BuildStepGlobalContext.deserialize(serialized.global, logger);
111
+ return new BuildStepContext(deserializedGlobal, {
112
+ logger,
113
+ workingDirectory: serialized.workingDirectory,
114
+ });
115
+ }
67
116
  }
68
117
  //# sourceMappingURL=BuildStepContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BuildStepContext.js","sourceRoot":"","sources":["../src/BuildStepContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAGpC,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAiBpD,MAAM,OAAO,sBAAsB;IAOjC,YACmB,QAAsC,EACvC,WAAoB;QADnB,aAAQ,GAAR,QAAQ,CAA8B;QACvC,gBAAW,GAAX,WAAW,CAAS;QAJ9B,aAAQ,GAA8B,E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AEM,WAAW,CAAC,KAAa;QAC9B,OAAO,4BAA4B,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;;YAClD,OAAO,CACL,MAAA,MAAA,8BAA8B,CAAC,IAAI,EAAE;gBACnC,GAAG,EAAE;oBACH,eAAe,EAAE,IAAI,CAAC,eAAe;oBACrC,GAAG,IAAI,CAAC,aAAa;iBACtB;aACF,CAAC,0CAAE,QAAQ,EAAE,mCAAI,EAAE,CACrB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,OAAO,CAAC,OAAqD;QAClE,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,OAAO,gBAAgB;IAI3B,YACmB,GAA2B,EAC5C,EACE,MAAM,EACN,gBAAgB,GAIjB;QAPgB,QAAG,GAAH,GAAG,CAAwB;QAS5C,IAAI,CAAC,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,GAAG,CAAC,UAAU,CAAC;QACvC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,GAAG,CAAC,uBAAuB,CAAC;IAC1E,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;CACF","sourcesContent":["import os from 'os';\nimport path from 'path';\n\nimport { bunyan } from '@expo/logger';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { BuildStep } from './BuildStep.js';\nimport {\n getObjectValueForInterpolation,\n interpolateWithGlobalContext,\n parseOutputPath,\n} from './utils/template.js';\nimport { BuildStepRuntimeError } from './errors.js';\nimport { BuildRuntimePlatform } from './BuildRuntimePlatform.js';\nimport { BuildStepEnv } from './BuildStepEnv.js';\n\nexport interface ExternalBuildContextProvider {\n readonly projectSourceDirectory: string;\n readonly projectTargetDirectory: string;\n readonly defaultWorkingDirectory: string;\n readonly runtimePlatform: BuildRuntimePlatform;\n readonly logger: bunyan;\n\n readonly staticContext: any;\n\n readonly env: BuildStepEnv;\n updateEnv(env: BuildStepEnv): void;\n}\n\nexport class BuildStepGlobalContext {\n public readonly stepsInternalBuildDirectory: string;\n public readonly runtimePlatform: BuildRuntimePlatform;\n public readonly baseLogger: bunyan;\n\n private stepById: Record<string, BuildStep> = {};\n\n constructor(\n private readonly provider: ExternalBuildContextProvider,\n public readonly skipCleanup: boolean\n ) {\n this.stepsInternalBuildDirectory = path.join(os.tmpdir(), 'eas-build', uuidv4());\n this.runtimePlatform = provider.runtimePlatform;\n this.baseLogger = provider.logger;\n }\n\n public get projectSourceDirectory(): string {\n return this.provider.projectSourceDirectory;\n }\n\n public get projectTargetDirectory(): string {\n return this.provider.projectTargetDirectory;\n }\n\n public get defaultWorkingDirectory(): string {\n return this.provider.defaultWorkingDirectory;\n }\n\n public get env(): BuildStepEnv {\n return this.provider.env;\n }\n\n public get staticContext(): Record<string, any> {\n return this.provider.staticContext();\n }\n\n public updateEnv(updatedEnv: BuildStepEnv): void {\n this.provider.updateEnv(updatedEnv);\n }\n\n public registerStep(step: BuildStep): void {\n this.stepById[step.id] = step;\n }\n\n public getStepOutputValue(path: string): string | undefined {\n const { stepId, outputId } = parseOutputPath(path);\n if (!(stepId in this.stepById)) {\n throw new BuildStepRuntimeError(`Step \"${stepId}\" does not exist.`);\n }\n return this.stepById[stepId].getOutputValueByName(outputId);\n }\n\n public interpolate(value: string): string {\n return interpolateWithGlobalContext(value, (path) => {\n return (\n getObjectValueForInterpolation(path, {\n eas: {\n runtimePlatform: this.runtimePlatform,\n ...this.staticContext,\n },\n })?.toString() ?? ''\n );\n });\n }\n\n public stepCtx(options: { logger: bunyan; workingDirectory: string }): BuildStepContext {\n return new BuildStepContext(this, options);\n }\n}\n\nexport class BuildStepContext {\n public readonly logger: bunyan;\n public readonly workingDirectory: string;\n\n constructor(\n private readonly ctx: BuildStepGlobalContext,\n {\n logger,\n workingDirectory,\n }: {\n logger: bunyan;\n workingDirectory: string;\n }\n ) {\n this.logger = logger ?? ctx.baseLogger;\n this.workingDirectory = workingDirectory ?? ctx.defaultWorkingDirectory;\n }\n\n public get global(): BuildStepGlobalContext {\n return this.ctx;\n }\n}\n"]}
1
+ {"version":3,"file":"BuildStepContext.js","sourceRoot":"","sources":["../src/BuildStepContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAEL,uBAAuB,GAExB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAkCpD,MAAM,OAAO,sBAAsB;IAOjC,YACmB,QAAsC,EACvC,WAAoB,EACpB,UAAkB;QAFjB,aAAQ,GAAR,QAAQ,CAA8B;QACvC,gBAAW,GAAX,WAAW,CAAS;QACpB,eAAU,GAAV,UAAU,CAAQ;QAL5B,aAAQ,GAA4C,EAAE,CAAC;QAO7D,IAAI,CAAC,2BAA2B,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC;QACjF,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC;QAChD,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;IACpC,CAAC;IAED,IAAW,sBAAsB;QAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IAC9C,CAAC;IAED,IAAW,sBAAsB;QAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IAC9C,CAAC;IAED,IAAW,uBAAuB;QAChC,OAAO,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IAC/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nimport {\n BuildStep,\n BuildStepOutputAccessor,\n SerializedBuildStepOutputAccessor,\n} from './BuildStep.js';\nimport {\n getObjectValueForInterpolation,\n interpolateWithGlobalContext,\n parseOutputPath,\n} from './utils/template.js';\nimport { BuildStepRuntimeError } from './errors.js';\nimport { BuildRuntimePlatform } from './BuildRuntimePlatform.js';\nimport { BuildStepEnv } from './BuildStepEnv.js';\n\ninterface SerializedExternalBuildContextProvider {\n projectSourceDirectory: string;\n projectTargetDirectory: string;\n defaultWorkingDirectory: string;\n runtimePlatform: BuildRuntimePlatform;\n staticContext: Record<string, any>;\n env: BuildStepEnv;\n}\n\nexport interface ExternalBuildContextProvider {\n readonly projectSourceDirectory: string;\n readonly projectTargetDirectory: string;\n readonly defaultWorkingDirectory: string;\n readonly runtimePlatform: BuildRuntimePlatform;\n readonly logger: bunyan;\n\n readonly staticContext: () => Record<string, any>;\n\n readonly env: BuildStepEnv;\n updateEnv(env: BuildStepEnv): void;\n}\n\nexport interface SerializedBuildStepGlobalContext {\n stepsInternalBuildDirectory: string;\n stepById: Record<string, SerializedBuildStepOutputAccessor>;\n provider: SerializedExternalBuildContextProvider;\n skipCleanup: boolean;\n configPath: string;\n}\n\nexport class BuildStepGlobalContext {\n public stepsInternalBuildDirectory: string;\n public readonly runtimePlatform: BuildRuntimePlatform;\n public readonly baseLogger: bunyan;\n\n private stepById: Record<string, BuildStepOutputAccessor> = {};\n\n constructor(\n private readonly provider: ExternalBuildContextProvider,\n public readonly skipCleanup: boolean,\n public readonly configPath: string\n ) {\n this.stepsInternalBuildDirectory = path.join(os.tmpdir(), 'eas-build', uuidv4());\n this.runtimePlatform = provider.runtimePlatform;\n this.baseLogger = provider.logger;\n }\n\n public get projectSourceDirectory(): string {\n return this.provider.projectSourceDirectory;\n }\n\n public get projectTargetDirectory(): string {\n return this.provider.projectTargetDirectory;\n }\n\n public get defaultWorkingDirectory(): string {\n return this.provider.defaultWorkingDirectory;\n }\n\n public get env(): BuildStepEnv {\n return this.provider.env;\n }\n\n public get staticContext(): Record<string, any> {\n return this.provider.staticContext();\n }\n\n public updateEnv(updatedEnv: BuildStepEnv): void {\n this.provider.updateEnv(updatedEnv);\n }\n\n public registerStep(step: BuildStep): void {\n this.stepById[step.id] = step;\n }\n\n public getStepOutputValue(path: string): string | undefined {\n const { stepId, outputId } = parseOutputPath(path);\n if (!(stepId in this.stepById)) {\n throw new BuildStepRuntimeError(`Step \"${stepId}\" does not exist.`);\n }\n return this.stepById[stepId].getOutputValueByName(outputId);\n }\n\n public interpolate(value: string): string {\n return interpolateWithGlobalContext(value, (path) => {\n return (\n getObjectValueForInterpolation(path, {\n eas: {\n runtimePlatform: this.runtimePlatform,\n ...this.staticContext,\n },\n })?.toString() ?? ''\n );\n });\n }\n\n public stepCtx(options: { logger: bunyan; workingDirectory: string }): BuildStepContext {\n return new BuildStepContext(this, options);\n }\n\n public serialize(): SerializedBuildStepGlobalContext {\n return {\n stepsInternalBuildDirectory: this.stepsInternalBuildDirectory,\n stepById: Object.fromEntries(\n Object.entries(this.stepById).map(([id, step]) => [id, step.serialize()])\n ),\n provider: {\n projectSourceDirectory: this.provider.projectSourceDirectory,\n projectTargetDirectory: this.provider.projectTargetDirectory,\n defaultWorkingDirectory: this.provider.defaultWorkingDirectory,\n runtimePlatform: this.provider.runtimePlatform,\n staticContext: this.provider.staticContext(),\n env: this.provider.env,\n },\n skipCleanup: this.skipCleanup,\n configPath: this.configPath,\n };\n }\n\n public static deserialize(\n serialized: SerializedBuildStepGlobalContext,\n logger: bunyan\n ): BuildStepGlobalContext {\n const deserializedProvider: ExternalBuildContextProvider = {\n projectSourceDirectory: serialized.provider.projectSourceDirectory,\n projectTargetDirectory: serialized.provider.projectTargetDirectory,\n defaultWorkingDirectory: serialized.provider.defaultWorkingDirectory,\n runtimePlatform: serialized.provider.runtimePlatform,\n logger,\n staticContext: () => serialized.provider.staticContext,\n env: serialized.provider.env,\n updateEnv: () => {},\n };\n const ctx = new BuildStepGlobalContext(\n deserializedProvider,\n serialized.skipCleanup,\n serialized.configPath\n );\n for (const [id, stepOutputAccessor] of Object.entries(serialized.stepById)) {\n ctx.stepById[id] = BuildStepOutputAccessor.deserialize(stepOutputAccessor);\n }\n ctx.stepsInternalBuildDirectory = serialized.stepsInternalBuildDirectory;\n\n return ctx;\n }\n}\n\nexport interface SerializedBuildStepContext {\n workingDirectory: string;\n global: SerializedBuildStepGlobalContext;\n}\n\nexport class BuildStepContext {\n public readonly logger: bunyan;\n public readonly workingDirectory: string;\n\n constructor(\n private readonly ctx: BuildStepGlobalContext,\n {\n logger,\n workingDirectory,\n }: {\n logger: bunyan;\n workingDirectory: string;\n }\n ) {\n this.logger = logger ?? ctx.baseLogger;\n this.workingDirectory = workingDirectory ?? ctx.defaultWorkingDirectory;\n }\n\n public get global(): BuildStepGlobalContext {\n return this.ctx;\n }\n\n public serialize(): SerializedBuildStepContext {\n return {\n workingDirectory: this.workingDirectory,\n global: this.ctx.serialize(),\n };\n }\n\n public static deserialize(\n serialized: SerializedBuildStepContext,\n logger: bunyan\n ): BuildStepContext {\n const deserializedGlobal = BuildStepGlobalContext.deserialize(serialized.global, logger);\n return new BuildStepContext(deserializedGlobal, {\n logger,\n workingDirectory: serialized.workingDirectory,\n });\n }\n}\n"]}
@@ -1,39 +1,53 @@
1
- import { BuildStepGlobalContext } from './BuildStepContext.js';
1
+ import { bunyan } from '@expo/logger';
2
+ import { BuildStepGlobalContext, SerializedBuildStepGlobalContext } from './BuildStepContext.js';
2
3
  export declare enum BuildStepInputValueTypeName {
3
4
  STRING = "string",
4
5
  BOOLEAN = "boolean",
5
6
  NUMBER = "number",
6
7
  JSON = "json"
7
8
  }
8
- export type BuildStepInputValueType = string | boolean | number | Record<string, any>;
9
+ export type BuildStepInputValueType<T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName> = T extends BuildStepInputValueTypeName.STRING ? string : T extends BuildStepInputValueTypeName.BOOLEAN ? boolean : T extends BuildStepInputValueTypeName.NUMBER ? number : Record<string, any>;
10
+ export type BuildStepInputValueTypeWithRequired<T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName, R extends boolean = boolean> = R extends true ? BuildStepInputValueType<T> : BuildStepInputValueType<T> | undefined;
9
11
  export type BuildStepInputById = Record<string, BuildStepInput>;
10
12
  export type BuildStepInputProvider = (ctx: BuildStepGlobalContext, stepId: string) => BuildStepInput;
11
- interface BuildStepInputProviderParams {
13
+ interface BuildStepInputProviderParams<T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName, R extends boolean = boolean> {
12
14
  id: string;
13
- allowedValues?: BuildStepInputValueType[];
14
- defaultValue?: BuildStepInputValueType;
15
- required?: boolean;
16
- allowedValueTypeName?: BuildStepInputValueTypeName;
15
+ allowedValues?: BuildStepInputValueType<T>[];
16
+ defaultValue?: BuildStepInputValueType<T>;
17
+ required: R;
18
+ allowedValueTypeName: T;
17
19
  }
18
- interface BuildStepInputParams extends BuildStepInputProviderParams {
20
+ interface BuildStepInputParams<T extends BuildStepInputValueTypeName, R extends boolean> extends BuildStepInputProviderParams<T, R> {
19
21
  stepDisplayName: string;
20
22
  }
21
- export declare class BuildStepInput {
23
+ export interface SerializedBuildStepInput<T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName, R extends boolean = boolean> {
24
+ id: string;
25
+ stepDisplayName: string;
26
+ defaultValue?: BuildStepInputValueType<T>;
27
+ allowedValues?: BuildStepInputValueType<T>[];
28
+ allowedValueTypeName: BuildStepInputValueTypeName;
29
+ required: R;
30
+ value?: BuildStepInputValueType<T>;
31
+ ctx: SerializedBuildStepGlobalContext;
32
+ }
33
+ export declare class BuildStepInput<T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName, R extends boolean = boolean> {
22
34
  private readonly ctx;
23
35
  readonly id: string;
24
36
  readonly stepDisplayName: string;
25
- readonly defaultValue?: BuildStepInputValueType;
26
- readonly allowedValues?: BuildStepInputValueType[];
27
- readonly allowedValueTypeName: BuildStepInputValueTypeName;
28
- readonly required: boolean;
37
+ readonly defaultValue?: BuildStepInputValueType<T>;
38
+ readonly allowedValues?: BuildStepInputValueType<T>[];
39
+ readonly allowedValueTypeName: T;
40
+ readonly required: R;
29
41
  private _value?;
30
42
  static createProvider(params: BuildStepInputProviderParams): BuildStepInputProvider;
31
- constructor(ctx: BuildStepGlobalContext, { id, stepDisplayName, allowedValues, defaultValue, required, allowedValueTypeName, }: BuildStepInputParams);
32
- get value(): BuildStepInputValueType | undefined;
33
- get rawValue(): BuildStepInputValueType | undefined;
34
- set(value: BuildStepInputValueType | undefined): BuildStepInput;
43
+ constructor(ctx: BuildStepGlobalContext, { id, stepDisplayName, allowedValues, defaultValue, required, allowedValueTypeName, }: BuildStepInputParams<T, R>);
44
+ get value(): BuildStepInputValueTypeWithRequired<T, R>;
45
+ get rawValue(): BuildStepInputValueType<T> | undefined;
46
+ set(value: BuildStepInputValueType<T> | undefined): BuildStepInput;
35
47
  isValueOneOfAllowedValues(): boolean;
36
48
  isRawValueStepOrContextReference(): boolean;
49
+ serialize(): SerializedBuildStepInput<T, R>;
50
+ static deserialize(serializedInput: SerializedBuildStepInput, logger: bunyan): BuildStepInput;
37
51
  private parseInputValueToAllowedType;
38
52
  private parseInputValueToNumber;
39
53
  private parseInputValueToBoolean;
@@ -1,3 +1,4 @@
1
+ import { BuildStepGlobalContext } from './BuildStepContext.js';
1
2
  import { BuildStepRuntimeError } from './errors.js';
2
3
  import { BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX, interpolateWithOutputs, } from './utils/template.js';
3
4
  export var BuildStepInputValueTypeName;
@@ -11,7 +12,7 @@ export class BuildStepInput {
11
12
  static createProvider(params) {
12
13
  return (ctx, stepDisplayName) => new BuildStepInput(ctx, { ...params, stepDisplayName });
13
14
  }
14
- constructor(ctx, { id, stepDisplayName, allowedValues, defaultValue, required = true, allowedValueTypeName = BuildStepInputValueTypeName.STRING, }) {
15
+ constructor(ctx, { id, stepDisplayName, allowedValues, defaultValue, required, allowedValueTypeName, }) {
15
16
  this.ctx = ctx;
16
17
  this.id = id;
17
18
  this.stepDisplayName = stepDisplayName;
@@ -66,6 +67,31 @@ export class BuildStepInput {
66
67
  return (typeof this.rawValue === 'string' &&
67
68
  !!BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX.exec(this.rawValue));
68
69
  }
70
+ serialize() {
71
+ return {
72
+ id: this.id,
73
+ stepDisplayName: this.stepDisplayName,
74
+ defaultValue: this.defaultValue,
75
+ allowedValues: this.allowedValues,
76
+ allowedValueTypeName: this.allowedValueTypeName,
77
+ required: this.required,
78
+ value: this._value,
79
+ ctx: this.ctx.serialize(),
80
+ };
81
+ }
82
+ static deserialize(serializedInput, logger) {
83
+ const deserializedContext = BuildStepGlobalContext.deserialize(serializedInput.ctx, logger);
84
+ const input = new BuildStepInput(deserializedContext, {
85
+ id: serializedInput.id,
86
+ stepDisplayName: serializedInput.stepDisplayName,
87
+ defaultValue: serializedInput.defaultValue,
88
+ allowedValues: serializedInput.allowedValues,
89
+ allowedValueTypeName: serializedInput.allowedValueTypeName,
90
+ required: serializedInput.required,
91
+ });
92
+ input._value = serializedInput.value;
93
+ return input;
94
+ }
69
95
  parseInputValueToAllowedType(value) {
70
96
  if (this.allowedValueTypeName === BuildStepInputValueTypeName.STRING) {
71
97
  return value;
@@ -1 +1 @@
1
- {"version":3,"file":"BuildStepInput.js","sourceRoot":"","sources":["../src/BuildStepInput.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,kDAAkD,EAClD,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAN,IAAY,2BAKX;AALD,WAAY,2BAA2B;IACrC,gDAAiB,CAAA;IACjB,kDAAmB,CAAA;IACnB,gDAAiB,CAAA;IACjB,4CAAa,CAAA;AACf,CAAC,EALW,2BAA2B,KAA3B,2BAA2B,QAKtC;AAqBD,MAAM,OAAO,cAAc;IAUlB,MAAM,CAAC,cAAc,C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AI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1B;QAAC,OAAO,CAAM,EAAE;YACf,MAAM,IAAI,qBAAqB,CAC7B,oBAAoB,IAAI,CAAC,EAAE,eAAe,IAAI,CAAC,eAAe,sBAAsB,IAAI,CAAC,oBAAoB,IAAI,EACjH;gBACE,KAAK,EAAE,CAAC;aACT,CACF,CAAC;SACH;IACH,CAAC;CACF;AAED,MAAM,UAAU,yBAAyB,CAAC,MAAyB;IACjE,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,OAAO,EAAE,CAAC;KACX;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAClC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;QACtB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAwB,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import { BuildStepGlobalContext } from './BuildStepContext.js';\nimport { BuildStepRuntimeError } from './errors.js';\nimport {\n BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX,\n interpolateWithOutputs,\n} from './utils/template.js';\n\nexport enum BuildStepInputValueTypeName {\n STRING = 'string',\n BOOLEAN = 'boolean',\n NUMBER = 'number',\n JSON = 'json',\n}\nexport type BuildStepInputValueType = string | boolean | number | Record<string, any>;\n\nexport type BuildStepInputById = Record<string, BuildStepInput>;\nexport type BuildStepInputProvider = (\n ctx: BuildStepGlobalContext,\n stepId: string\n) => BuildStepInput;\n\ninterface BuildStepInputProviderParams {\n id: string;\n allowedValues?: BuildStepInputValueType[];\n defaultValue?: BuildStepInputValueType;\n required?: boolean;\n allowedValueTypeName?: BuildStepInputValueTypeName;\n}\n\ninterface BuildStepInputParams extends BuildStepInputProviderParams {\n stepDisplayName: string;\n}\n\nexport class BuildStepInput {\n public readonly id: string;\n public readonly stepDisplayName: string;\n public readonly defaultValue?: BuildStepInputValueType;\n public readonly allowedValues?: BuildStepInputValueType[];\n public readonly allowedValueTypeName: BuildStepInputValueTypeName;\n public readonly required: boolean;\n\n private _value?: BuildStepInputValueType;\n\n public static createProvider(params: BuildStepInputProviderParams): BuildStepInputProvider {\n return (ctx, stepDisplayName) => new BuildStepInput(ctx, { ...params, stepDisplayName });\n }\n\n constructor(\n private readonly ctx: BuildStepGlobalContext,\n {\n id,\n stepDisplayName,\n allowedValues,\n defaultValue,\n required = true,\n allowedValueTypeName = BuildStepInputValueTypeName.STRING,\n }: BuildStepInputParams\n ) {\n this.id = id;\n this.stepDisplayName = stepDisplayName;\n this.allowedValues = allowedValues;\n this.defaultValue = defaultValue;\n this.required = required;\n this.allowedValueTypeName = allowedValueTypeName;\n }\n\n public get value(): BuildStepInputValueType | undefined {\n const rawValue = this._value ?? this.defaultValue;\n if (this.required && rawValue === undefined) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required but it was not set.`\n );\n }\n\n const valueDoesNotRequireInterpolation =\n rawValue === undefined ||\n typeof rawValue === 'boolean' ||\n typeof rawValue === 'number' ||\n typeof rawValue === 'object';\n if (valueDoesNotRequireInterpolation) {\n const currentTypeName =\n typeof rawValue === 'object' ? BuildStepInputValueTypeName.JSON : typeof rawValue;\n if (currentTypeName !== this.allowedValueTypeName && rawValue !== undefined) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" must be of type \"${this.allowedValueTypeName}\".`\n );\n }\n return rawValue;\n } else {\n const valueInterpolatedWithGlobalContext = this.ctx.interpolate(rawValue);\n const valueInterpolatedWithOutputsAndGlobalContext = interpolateWithOutputs(\n valueInterpolatedWithGlobalContext,\n (path) => this.ctx.getStepOutputValue(path) ?? ''\n );\n return this.parseInputValueToAllowedType(valueInterpolatedWithOutputsAndGlobalContext);\n }\n }\n\n public get rawValue(): BuildStepInputValueType | undefined {\n return this._value ?? this.defaultValue;\n }\n\n public set(value: BuildStepInputValueType | undefined): BuildStepInput {\n if (this.required && value === undefined) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required.`\n );\n }\n\n this._value = value;\n return this;\n }\n\n public isValueOneOfAllowedValues(): boolean {\n const value = this._value ?? this.defaultValue;\n if (this.allowedValues === undefined || value === undefined) {\n return true;\n }\n return this.allowedValues.includes(value);\n }\n\n public isRawValueStepOrContextReference(): boolean {\n return (\n typeof this.rawValue === 'string' &&\n !!BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX.exec(this.rawValue)\n );\n }\n\n private parseInputValueToAllowedType(value: string): BuildStepInputValueType {\n if (this.allowedValueTypeName === BuildStepInputValueTypeName.STRING) {\n return value;\n } else if (this.allowedValueTypeName === BuildStepInputValueTypeName.NUMBER) {\n return this.parseInputValueToNumber(value);\n } else if (this.allowedValueTypeName === BuildStepInputValueTypeName.BOOLEAN) {\n return this.parseInputValueToBoolean(value);\n } else {\n return this.parseInputValueToObject(value);\n }\n }\n\n private parseInputValueToNumber(value: string): number {\n const numberValue = Number(value);\n if (Number.isNaN(numberValue)) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" must be of type \"${this.allowedValueTypeName}\".`\n );\n }\n return numberValue;\n }\n\n private parseInputValueToBoolean(value: string): boolean {\n if (value === 'true') {\n return true;\n } else if (value === 'false') {\n return false;\n } else {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" must be of type \"${this.allowedValueTypeName}\".`\n );\n }\n }\n\n private parseInputValueToObject(value: string): Record<string, any> {\n try {\n return JSON.parse(value);\n } catch (e: any) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" must be of type \"${this.allowedValueTypeName}\".`,\n {\n cause: e,\n }\n );\n }\n }\n}\n\nexport function makeBuildStepInputByIdMap(inputs?: BuildStepInput[]): BuildStepInputById {\n if (inputs === undefined) {\n return {};\n }\n return inputs.reduce((acc, input) => {\n acc[input.id] = input;\n return acc;\n }, {} as BuildStepInputById);\n}\n"]}
1
+ {"version":3,"file":"BuildStepInput.js","sourceRoot":"","sources":["../src/BuildStepInput.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAoC,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,kDAAkD,EAClD,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAN,IAAY,2BAKX;AALD,WAAY,2BAA2B;IACrC,gDAAiB,CAAA;IACjB,kDAAmB,CAAA;IACnB,gDAAiB,CAAA;IACjB,4CAAa,CAAA;AACf,CAAC,EALW,2BAA2B,KAA3B,2BAA2B,QAKtC;AAqDD,MAAM,OAAO,cAAc;IAalB,MAAM,CAAC,cAAc,CAAC,MAAoC;QAC/D,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,EAAE,CAAC,IAAI,cAAc,CAAC,GAAG,EAAE,EAAE,GAAG,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED,YACmB,GAA2B,EAC5C,EACE,EAAE,EACF,eAAe,EACf,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,oBAAoB,GACO;QARZ,QAAG,GAAH,GAAG,CAAwB;QAU5C,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;IAED,IAAW,KAAK;;QACd,MAAM,QAAQ,GAAG,MAAA,IAAI,CAAC,MAAM,mCAAI,IAAI,CAAC,YAAY,CAAC;QAClD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K,CAAC;SACd;aAAM;YACL,MAAM,IAAI,qBAAqB,CAC7B,oBAAoB,IAAI,CAAC,EAAE,eAAe,IAAI,CAAC,eAAe,sBAAsB,IAAI,CAAC,oBAAoB,IAAI,CAClH,CAAC;SACH;IACH,CAAC;IAEO,uBAAuB,CAAC,KAAa;QAC3C,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1B;QAAC,OAAO,CAAM,EAAE;YACf,MAAM,IAAI,qBAAqB,CAC7B,oBAAoB,IAAI,CAAC,EAAE,eAAe,IAAI,CAAC,eAAe,sBAAsB,IAAI,CAAC,oBAAoB,IAAI,EACjH;gBACE,KAAK,EAAE,CAAC;aACT,CACF,CAAC;SACH;IACH,CAAC;CACF;AAED,MAAM,UAAU,yBAAyB,CAAC,MAAyB;IACjE,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,OAAO,EAAE,CAAC;KACX;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAClC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;QACtB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAwB,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import { bunyan } from '@expo/logger';\n\nimport { BuildStepGlobalContext, SerializedBuildStepGlobalContext } from './BuildStepContext.js';\nimport { BuildStepRuntimeError } from './errors.js';\nimport {\n BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX,\n interpolateWithOutputs,\n} from './utils/template.js';\n\nexport enum BuildStepInputValueTypeName {\n STRING = 'string',\n BOOLEAN = 'boolean',\n NUMBER = 'number',\n JSON = 'json',\n}\n\nexport type BuildStepInputValueType<\n T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName\n> = T extends BuildStepInputValueTypeName.STRING\n ? string\n : T extends BuildStepInputValueTypeName.BOOLEAN\n ? boolean\n : T extends BuildStepInputValueTypeName.NUMBER\n ? number\n : Record<string, any>;\n\nexport type BuildStepInputValueTypeWithRequired<\n T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName,\n R extends boolean = boolean\n> = R extends true ? BuildStepInputValueType<T> : BuildStepInputValueType<T> | undefined;\n\nexport type BuildStepInputById = Record<string, BuildStepInput>;\nexport type BuildStepInputProvider = (\n ctx: BuildStepGlobalContext,\n stepId: string\n) => BuildStepInput;\n\ninterface BuildStepInputProviderParams<\n T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName,\n R extends boolean = boolean\n> {\n id: string;\n allowedValues?: BuildStepInputValueType<T>[];\n defaultValue?: BuildStepInputValueType<T>;\n required: R;\n allowedValueTypeName: T;\n}\n\ninterface BuildStepInputParams<T extends BuildStepInputValueTypeName, R extends boolean>\n extends BuildStepInputProviderParams<T, R> {\n stepDisplayName: string;\n}\n\nexport interface SerializedBuildStepInput<\n T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName,\n R extends boolean = boolean\n> {\n id: string;\n stepDisplayName: string;\n defaultValue?: BuildStepInputValueType<T>;\n allowedValues?: BuildStepInputValueType<T>[];\n allowedValueTypeName: BuildStepInputValueTypeName;\n required: R;\n value?: BuildStepInputValueType<T>;\n ctx: SerializedBuildStepGlobalContext;\n}\n\nexport class BuildStepInput<\n T extends BuildStepInputValueTypeName = BuildStepInputValueTypeName,\n R extends boolean = boolean\n> {\n public readonly id: string;\n public readonly stepDisplayName: string;\n public readonly defaultValue?: BuildStepInputValueType<T>;\n public readonly allowedValues?: BuildStepInputValueType<T>[];\n public readonly allowedValueTypeName: T;\n public readonly required: R;\n\n private _value?: BuildStepInputValueType<T>;\n\n public static createProvider(params: BuildStepInputProviderParams): BuildStepInputProvider {\n return (ctx, stepDisplayName) => new BuildStepInput(ctx, { ...params, stepDisplayName });\n }\n\n constructor(\n private readonly ctx: BuildStepGlobalContext,\n {\n id,\n stepDisplayName,\n allowedValues,\n defaultValue,\n required,\n allowedValueTypeName,\n }: BuildStepInputParams<T, R>\n ) {\n this.id = id;\n this.stepDisplayName = stepDisplayName;\n this.allowedValues = allowedValues;\n this.defaultValue = defaultValue;\n this.required = required;\n this.allowedValueTypeName = allowedValueTypeName;\n }\n\n public get value(): BuildStepInputValueTypeWithRequired<T, R> {\n const rawValue = this._value ?? this.defaultValue;\n if (this.required && rawValue === undefined) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required but it was not set.`\n );\n }\n\n const valueDoesNotRequireInterpolation =\n rawValue === undefined ||\n typeof rawValue === 'boolean' ||\n typeof rawValue === 'number' ||\n typeof rawValue === 'object';\n if (valueDoesNotRequireInterpolation) {\n const currentTypeName =\n typeof rawValue === 'object' ? BuildStepInputValueTypeName.JSON : typeof rawValue;\n if (currentTypeName !== this.allowedValueTypeName && rawValue !== undefined) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" must be of type \"${this.allowedValueTypeName}\".`\n );\n }\n return rawValue as BuildStepInputValueTypeWithRequired<T, R>;\n } else {\n const valueInterpolatedWithGlobalContext = this.ctx.interpolate(rawValue);\n const valueInterpolatedWithOutputsAndGlobalContext = interpolateWithOutputs(\n valueInterpolatedWithGlobalContext,\n (path) => this.ctx.getStepOutputValue(path) ?? ''\n );\n return this.parseInputValueToAllowedType(valueInterpolatedWithOutputsAndGlobalContext);\n }\n }\n\n public get rawValue(): BuildStepInputValueType<T> | undefined {\n return this._value ?? this.defaultValue;\n }\n\n public set(value: BuildStepInputValueType<T> | undefined): BuildStepInput {\n if (this.required && value === undefined) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required.`\n );\n }\n\n this._value = value;\n return this;\n }\n\n public isValueOneOfAllowedValues(): boolean {\n const value = this._value ?? this.defaultValue;\n if (this.allowedValues === undefined || value === undefined) {\n return true;\n }\n return this.allowedValues.includes(value);\n }\n\n public isRawValueStepOrContextReference(): boolean {\n return (\n typeof this.rawValue === 'string' &&\n !!BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX.exec(this.rawValue)\n );\n }\n\n public serialize(): SerializedBuildStepInput<T, R> {\n return {\n id: this.id,\n stepDisplayName: this.stepDisplayName,\n defaultValue: this.defaultValue,\n allowedValues: this.allowedValues,\n allowedValueTypeName: this.allowedValueTypeName,\n required: this.required,\n value: this._value,\n ctx: this.ctx.serialize(),\n };\n }\n\n public static deserialize(\n serializedInput: SerializedBuildStepInput,\n logger: bunyan\n ): BuildStepInput {\n const deserializedContext = BuildStepGlobalContext.deserialize(serializedInput.ctx, logger);\n const input = new BuildStepInput(deserializedContext, {\n id: serializedInput.id,\n stepDisplayName: serializedInput.stepDisplayName,\n defaultValue: serializedInput.defaultValue,\n allowedValues: serializedInput.allowedValues,\n allowedValueTypeName: serializedInput.allowedValueTypeName,\n required: serializedInput.required,\n });\n input._value = serializedInput.value;\n return input;\n }\n\n private parseInputValueToAllowedType(value: string): BuildStepInputValueTypeWithRequired<T, R> {\n if (this.allowedValueTypeName === BuildStepInputValueTypeName.STRING) {\n return value as BuildStepInputValueTypeWithRequired<T, R>;\n } else if (this.allowedValueTypeName === BuildStepInputValueTypeName.NUMBER) {\n return this.parseInputValueToNumber(value) as BuildStepInputValueTypeWithRequired<T, R>;\n } else if (this.allowedValueTypeName === BuildStepInputValueTypeName.BOOLEAN) {\n return this.parseInputValueToBoolean(value) as BuildStepInputValueTypeWithRequired<T, R>;\n } else {\n return this.parseInputValueToObject(value) as BuildStepInputValueTypeWithRequired<T, R>;\n }\n }\n\n private parseInputValueToNumber(value: string): number {\n const numberValue = Number(value);\n if (Number.isNaN(numberValue)) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" must be of type \"${this.allowedValueTypeName}\".`\n );\n }\n return numberValue;\n }\n\n private parseInputValueToBoolean(value: string): boolean {\n if (value === 'true') {\n return true;\n } else if (value === 'false') {\n return false;\n } else {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" must be of type \"${this.allowedValueTypeName}\".`\n );\n }\n }\n\n private parseInputValueToObject(value: string): Record<string, any> {\n try {\n return JSON.parse(value);\n } catch (e: any) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" must be of type \"${this.allowedValueTypeName}\".`,\n {\n cause: e,\n }\n );\n }\n }\n}\n\nexport function makeBuildStepInputByIdMap(inputs?: BuildStepInput[]): BuildStepInputById {\n if (inputs === undefined) {\n return {};\n }\n return inputs.reduce((acc, input) => {\n acc[input.id] = input;\n return acc;\n }, {} as BuildStepInputById);\n}\n"]}
@@ -1,23 +1,33 @@
1
1
  import { BuildStepGlobalContext } from './BuildStepContext.js';
2
2
  export type BuildStepOutputById = Record<string, BuildStepOutput>;
3
3
  export type BuildStepOutputProvider = (ctx: BuildStepGlobalContext, stepDisplayName: string) => BuildStepOutput;
4
- interface BuildStepOutputProviderParams {
4
+ interface BuildStepOutputProviderParams<R extends boolean = boolean> {
5
5
  id: string;
6
- required?: boolean;
6
+ required: R;
7
7
  }
8
- interface BuildStepOutputParams extends BuildStepOutputProviderParams {
8
+ interface BuildStepOutputParams<R extends boolean = boolean> extends BuildStepOutputProviderParams<R> {
9
9
  stepDisplayName: string;
10
10
  }
11
- export declare class BuildStepOutput {
11
+ type BuildStepOutputValueType<R extends boolean = boolean> = R extends true ? string : string | undefined;
12
+ export interface SerializedBuildStepOutput<R extends boolean = boolean> {
13
+ id: string;
14
+ stepDisplayName: string;
15
+ required: R;
16
+ value?: string;
17
+ }
18
+ export declare class BuildStepOutput<R extends boolean = boolean> {
12
19
  private readonly ctx;
13
20
  readonly id: string;
14
21
  readonly stepDisplayName: string;
15
- readonly required: boolean;
22
+ readonly required: R;
16
23
  private _value?;
17
24
  static createProvider(params: BuildStepOutputProviderParams): BuildStepOutputProvider;
18
- constructor(ctx: BuildStepGlobalContext, { id, stepDisplayName, required }: BuildStepOutputParams);
19
- get value(): string | undefined;
20
- set(value: string | undefined): BuildStepOutput;
25
+ constructor(ctx: BuildStepGlobalContext | undefined, { id, stepDisplayName, required }: BuildStepOutputParams<R>);
26
+ get rawValue(): string | undefined;
27
+ get value(): BuildStepOutputValueType<R>;
28
+ set(value: BuildStepOutputValueType<R>): BuildStepOutput;
29
+ serialize(): SerializedBuildStepOutput;
30
+ static deserialize(serialized: SerializedBuildStepOutput): BuildStepOutput;
21
31
  }
22
32
  export declare function makeBuildStepOutputByIdMap(outputs?: BuildStepOutput[]): BuildStepOutputById;
23
33
  export {};
@@ -5,12 +5,15 @@ export class BuildStepOutput {
5
5
  }
6
6
  constructor(
7
7
  // @ts-expect-error ctx is not used in this class but let's keep it here for consistency
8
- ctx, { id, stepDisplayName, required = true }) {
8
+ ctx, { id, stepDisplayName, required }) {
9
9
  this.ctx = ctx;
10
10
  this.id = id;
11
11
  this.stepDisplayName = stepDisplayName;
12
12
  this.required = required;
13
13
  }
14
+ get rawValue() {
15
+ return this._value;
16
+ }
14
17
  get value() {
15
18
  if (this.required && this._value === undefined) {
16
19
  throw new BuildStepRuntimeError(`Output parameter "${this.id}" for step "${this.stepDisplayName}" is required but it was not set.`);
@@ -24,6 +27,23 @@ export class BuildStepOutput {
24
27
  this._value = value;
25
28
  return this;
26
29
  }
30
+ serialize() {
31
+ return {
32
+ id: this.id,
33
+ stepDisplayName: this.stepDisplayName,
34
+ required: this.required,
35
+ value: this._value,
36
+ };
37
+ }
38
+ static deserialize(serialized) {
39
+ const deserialized = new BuildStepOutput(undefined, {
40
+ id: serialized.id,
41
+ stepDisplayName: serialized.stepDisplayName,
42
+ required: serialized.required,
43
+ });
44
+ deserialized._value = serialized.value;
45
+ return deserialized;
46
+ }
27
47
  }
28
48
  export function makeBuildStepOutputByIdMap(outputs) {
29
49
  if (outputs === undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"BuildStepOutput.js","sourceRoot":"","sources":["../src/BuildStepOutput.ts"],"names":[],"mappings":"A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GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;QACxB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAyB,CAAC,CAAC;AAChC,CAAC","sourcesContent":["import { BuildStepGlobalContext } from './BuildStepContext.js';\nimport { BuildStepRuntimeError } from './errors.js';\n\nexport type BuildStepOutputById = Record<string, BuildStepOutput>;\nexport type BuildStepOutputProvider = (\n ctx: BuildStepGlobalContext,\n stepDisplayName: string\n) => BuildStepOutput;\n\ninterface BuildStepOutputProviderParams {\n id: string;\n required?: boolean;\n}\n\ninterface BuildStepOutputParams extends BuildStepOutputProviderParams {\n stepDisplayName: string;\n}\n\nexport class BuildStepOutput {\n public readonly id: string;\n public readonly stepDisplayName: string;\n public readonly required: boolean;\n\n private _value?: string;\n\n public static createProvider(params: BuildStepOutputProviderParams): BuildStepOutputProvider {\n return (ctx, stepDisplayName) => new BuildStepOutput(ctx, { ...params, stepDisplayName });\n }\n\n constructor(\n // @ts-expect-error ctx is not used in this class but let's keep it here for consistency\n private readonly ctx: BuildStepGlobalContext,\n { id, stepDisplayName, required = true }: BuildStepOutputParams\n ) {\n this.id = id;\n this.stepDisplayName = stepDisplayName;\n this.required = required;\n }\n\n public get value(): string | undefined {\n if (this.required && this._value === undefined) {\n throw new BuildStepRuntimeError(\n `Output parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required but it was not set.`\n );\n }\n return this._value;\n }\n\n public set(value: string | undefined): BuildStepOutput {\n if (this.required && value === undefined) {\n throw new BuildStepRuntimeError(\n `Output parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required.`\n );\n }\n this._value = value;\n return this;\n }\n}\n\nexport function makeBuildStepOutputByIdMap(outputs?: BuildStepOutput[]): BuildStepOutputById {\n if (outputs === undefined) {\n return {};\n }\n return outputs.reduce((acc, output) => {\n acc[output.id] = output;\n return acc;\n }, {} as BuildStepOutputById);\n}\n"]}
1
+ {"version":3,"file":"BuildStepOutput.js","sourceRoot":"","sources":["../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,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,MAAM;SACnB,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,UAAqC;QAC7D,MAAM,YAAY,GAAG,IAAI,eAAe,CAAC,SAAS,EAAE;YAClD,EAAE,EAAE,UAAU,CAAC,EAAE;YACjB,eAAe,EAAE,UAAU,CAAC,eAAe;YAC3C,QAAQ,EAAE,UAAU,CAAC,QAAQ;SAC9B,CAAC,CAAC;QACH,YAAY,CAAC,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC;QACvC,OAAO,YAAY,CAAC;IACtB,CAAC;CACF;AAED,MAAM,UAAU,0BAA0B,CAAC,OAA2B;IACpE,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,OAAO,EAAE,CAAC;KACX;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACpC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;QACxB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAyB,CAAC,CAAC;AAChC,CAAC","sourcesContent":["import { BuildStepGlobalContext } from './BuildStepContext.js';\nimport { BuildStepRuntimeError } from './errors.js';\n\nexport type BuildStepOutputById = Record<string, BuildStepOutput>;\nexport type BuildStepOutputProvider = (\n ctx: BuildStepGlobalContext,\n stepDisplayName: string\n) => BuildStepOutput;\n\ninterface BuildStepOutputProviderParams<R extends boolean = boolean> {\n id: string;\n required: R;\n}\n\ninterface BuildStepOutputParams<R extends boolean = boolean>\n extends BuildStepOutputProviderParams<R> {\n stepDisplayName: string;\n}\n\ntype BuildStepOutputValueType<R extends boolean = boolean> = R extends true\n ? string\n : string | undefined;\n\nexport interface SerializedBuildStepOutput<R extends boolean = boolean> {\n id: string;\n stepDisplayName: string;\n required: R;\n value?: string;\n}\n\nexport class BuildStepOutput<R extends boolean = boolean> {\n public readonly id: string;\n public readonly stepDisplayName: string;\n public readonly required: R;\n\n private _value?: string;\n\n public static createProvider(params: BuildStepOutputProviderParams): BuildStepOutputProvider {\n return (ctx, stepDisplayName) => new BuildStepOutput(ctx, { ...params, stepDisplayName });\n }\n\n constructor(\n // @ts-expect-error ctx is not used in this class but let's keep it here for consistency\n private readonly ctx: BuildStepGlobalContext | undefined,\n { id, stepDisplayName, required }: BuildStepOutputParams<R>\n ) {\n this.id = id;\n this.stepDisplayName = stepDisplayName;\n this.required = required;\n }\n\n public get rawValue(): string | undefined {\n return this._value;\n }\n\n public get value(): BuildStepOutputValueType<R> {\n if (this.required && this._value === undefined) {\n throw new BuildStepRuntimeError(\n `Output parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required but it was not set.`\n );\n }\n return this._value as BuildStepOutputValueType<R>;\n }\n\n public set(value: BuildStepOutputValueType<R>): BuildStepOutput {\n if (this.required && value === undefined) {\n throw new BuildStepRuntimeError(\n `Output parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required.`\n );\n }\n this._value = value;\n return this;\n }\n\n public serialize(): SerializedBuildStepOutput {\n return {\n id: this.id,\n stepDisplayName: this.stepDisplayName,\n required: this.required,\n value: this._value,\n };\n }\n\n public static deserialize(serialized: SerializedBuildStepOutput): BuildStepOutput {\n const deserialized = new BuildStepOutput(undefined, {\n id: serialized.id,\n stepDisplayName: serialized.stepDisplayName,\n required: serialized.required,\n });\n deserialized._value = serialized.value;\n return deserialized;\n }\n}\n\nexport function makeBuildStepOutputByIdMap(outputs?: BuildStepOutput[]): BuildStepOutputById {\n if (outputs === undefined) {\n return {};\n }\n return outputs.reduce((acc, output) => {\n acc[output.id] = output;\n return acc;\n }, {} as BuildStepOutputById);\n}\n"]}
@@ -2,8 +2,9 @@ import { BuildWorkflow } from './BuildWorkflow.js';
2
2
  export declare class BuildWorkflowValidator {
3
3
  private readonly workflow;
4
4
  constructor(workflow: BuildWorkflow);
5
- validate(): void;
5
+ validateAsync(): Promise<void>;
6
6
  private validateUniqueStepIds;
7
7
  private validateInputs;
8
8
  private validateAllowedPlatforms;
9
+ private validateCustomFunctionModulesAsync;
9
10
  }
@@ -1,3 +1,5 @@
1
+ import path from 'path';
2
+ import fs from 'fs-extra';
1
3
  import { BuildStepInputValueTypeName } from './BuildStepInput.js';
2
4
  import { BuildConfigError, BuildWorkflowError } from './errors.js';
3
5
  import { duplicates } from './utils/expodash/duplicates.js';
@@ -7,11 +9,12 @@ export class BuildWorkflowValidator {
7
9
  constructor(workflow) {
8
10
  this.workflow = workflow;
9
11
  }
10
- validate() {
12
+ async validateAsync() {
11
13
  const errors = [];
12
14
  errors.push(...this.validateUniqueStepIds());
13
15
  errors.push(...this.validateInputs());
14
16
  errors.push(...this.validateAllowedPlatforms());
17
+ errors.push(...(await this.validateCustomFunctionModulesAsync()));
15
18
  if (errors.length !== 0) {
16
19
  throw new BuildWorkflowError('Build workflow is invalid.', errors);
17
20
  }
@@ -96,5 +99,23 @@ export class BuildWorkflowValidator {
96
99
  }
97
100
  return errors;
98
101
  }
102
+ async validateCustomFunctionModulesAsync() {
103
+ const errors = [];
104
+ for (const buildFunction of Object.values(this.workflow.buildFunctions)) {
105
+ if (!buildFunction.customFunctionModulePath) {
106
+ continue;
107
+ }
108
+ if (!(await fs.exists(buildFunction.customFunctionModulePath))) {
109
+ const error = new BuildConfigError(`Custom function module path "${buildFunction.customFunctionModulePath}" for function "${buildFunction.id}" does not exist.`);
110
+ errors.push(error);
111
+ continue;
112
+ }
113
+ if (!(await fs.exists(path.join(buildFunction.customFunctionModulePath, 'package.json')))) {
114
+ const error = new BuildConfigError(`Custom function module path "${buildFunction.customFunctionModulePath}" for function "${buildFunction.id}" does not contain a package.json file.`);
115
+ errors.push(error);
116
+ }
117
+ }
118
+ return errors;
119
+ }
99
120
  }
100
121
  //# sourceMappingURL=BuildWorkflowValidator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BuildWorkflowValidator.js","sourceRoot":"","sources":["../src/BuildWorkflowValidator.ts"],"names":[],"mappings":"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AC,EAAE,eAAe,WAAW,CAAC,WAAW,sFAAsF,gBAAgB,IAAI,CACxL,CAAC;4BACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;yBACpB;qBACF;yBAAM;wBACL,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,EAAE;4BACrF,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAChC,oBAAoB,gBAAgB,CAAC,EAAE,eAAe,WAAW,CAAC,WAAW,uEAAuE,sBAAsB,gBAAgB,gBAAgB,IAAI,CAC/M,CAAC;4BACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;yBACpB;qBACF;iBACF;aACF;YACD,mBAAmB,CAAC,WAAW,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC;SACnD;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,wBAAwB;QAC9B,MAAM,MAAM,GAAuB,EAAE,CAAC;QACtC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE;YAC3C,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAE;gBACrC,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAChC,SAAS,IAAI,CAAC,WAAW,iCACvB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,eAClB,2CAA2C,UAAU,CACnD,IAAI,CAAC,yBAAyB,EAC9B,uFAAuF,CACxF;qBACE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;qBACpB,IAAI,CAAC,IAAI,CAAC,GAAG,CACjB,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { BuildStep } from './BuildStep.js';\nimport { BuildStepInputValueTypeName } from './BuildStepInput.js';\nimport { BuildWorkflow } from './BuildWorkflow.js';\nimport { BuildConfigError, BuildWorkflowError } from './errors.js';\nimport { duplicates } from './utils/expodash/duplicates.js';\nimport { nullthrows } from './utils/nullthrows.js';\nimport { findOutputPaths } from './utils/template.js';\n\nexport class BuildWorkflowValidator {\n constructor(private readonly workflow: BuildWorkflow) {}\n\n public validate(): void {\n const errors: BuildConfigError[] = [];\n errors.push(...this.validateUniqueStepIds());\n errors.push(...this.validateInputs());\n errors.push(...this.validateAllowedPlatforms());\n if (errors.length !== 0) {\n throw new BuildWorkflowError('Build workflow is invalid.', errors);\n }\n }\n\n private validateUniqueStepIds(): BuildConfigError[] {\n const stepIds = this.workflow.buildSteps.map(({ id }) => id);\n const duplicatedStepIds = duplicates(stepIds);\n if (duplicatedStepIds.length === 0) {\n return [];\n } else {\n const error = new BuildConfigError(\n `Duplicated step IDs: ${duplicatedStepIds.map((i) => `\"${i}\"`).join(', ')}`\n );\n return [error];\n }\n }\n\n private validateInputs(): BuildConfigError[] {\n const errors: BuildConfigError[] = [];\n\n const allStepIds = new Set(this.workflow.buildSteps.map((s) => s.id));\n const visitedStepByStepId: Record<string, BuildStep> = {};\n for (const currentStep of this.workflow.buildSteps) {\n for (const currentStepInput of currentStep.inputs ?? []) {\n if (currentStepInput.required && currentStepInput.rawValue === undefined) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" is required but it was not set.`\n );\n errors.push(error);\n }\n\n const currentType =\n typeof currentStepInput.rawValue === 'object'\n ? BuildStepInputValueTypeName.JSON\n : typeof currentStepInput.rawValue;\n if (\n currentStepInput.rawValue !== undefined &&\n !currentStepInput.isRawValueStepOrContextReference() &&\n currentType !== currentStepInput.allowedValueTypeName\n ) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${\n currentStep.displayName\n }\" is set to \"${\n typeof currentStepInput.rawValue === 'object'\n ? JSON.stringify(currentStepInput.rawValue)\n : currentStepInput.rawValue\n }\" which is not of type \"${\n currentStepInput.allowedValueTypeName\n }\" or is not step or context reference.`\n );\n errors.push(error);\n }\n\n if (currentStepInput.defaultValue === undefined) {\n continue;\n }\n if (!currentStepInput.isValueOneOfAllowedValues()) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${\n currentStep.displayName\n }\" is set to \"${\n currentStepInput.value\n }\" which is not one of the allowed values: ${nullthrows(currentStepInput.allowedValues)\n .map((i) => `\"${i}\"`)\n .join(', ')}.`\n );\n errors.push(error);\n }\n const paths =\n typeof currentStepInput.defaultValue === 'string'\n ? findOutputPaths(currentStepInput.defaultValue)\n : [];\n for (const { stepId: referencedStepId, outputId: referencedStepOutputId } of paths) {\n if (!(referencedStepId in visitedStepByStepId)) {\n if (allStepIds.has(referencedStepId)) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" uses an expression that references an output parameter from the future step \"${referencedStepId}\".`\n );\n errors.push(error);\n } else {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" uses an expression that references an output parameter from a non-existent step \"${referencedStepId}\".`\n );\n errors.push(error);\n }\n } else {\n if (!visitedStepByStepId[referencedStepId].hasOutputParameter(referencedStepOutputId)) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" uses an expression that references an undefined output parameter \"${referencedStepOutputId}\" from step \"${referencedStepId}\".`\n );\n errors.push(error);\n }\n }\n }\n }\n visitedStepByStepId[currentStep.id] = currentStep;\n }\n\n return errors;\n }\n\n private validateAllowedPlatforms(): BuildConfigError[] {\n const errors: BuildConfigError[] = [];\n for (const step of this.workflow.buildSteps) {\n if (!step.canBeRunOnRuntimePlatform()) {\n const error = new BuildConfigError(\n `Step \"${step.displayName}\" is not allowed on platform \"${\n step.ctx.global.runtimePlatform\n }\". Allowed platforms for this step are: ${nullthrows(\n step.supportedRuntimePlatforms,\n `step.supportedRuntimePlatforms can't be falsy if canBeRunOnRuntimePlatform() is false`\n )\n .map((p) => `\"${p}\"`)\n .join(', ')}.`\n );\n errors.push(error);\n }\n }\n return errors;\n }\n}\n"]}
1
+ {"version":3,"file":"BuildWorkflowValidator.js","sourceRoot":"","sources":["../src/BuildWorkflowValidator.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,MAAM,UAAU,CAAC;AAG1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,OAAO,sBAAsB;IACjC,YAA6B,QAAuB;QAAvB,aAAQ,GAAR,QAAQ,CAAe;IAAG,CAAC;IAEjD,KAAK,CAAC,aAAa;QACxB,MAAM,MAAM,GAAuB,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,wBAAwB,EAAE,CAAC,CAAC;QAChD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,kCAAkC,EAAE,CAAC,CAAC,CAAC;QAClE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,MAAM,IAAI,kBAAkB,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;SACpE;IACH,CAAC;IAEO,qBAAqB;QAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,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FAAuF,CACxF;qBACE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;qBACpB,IAAI,CAAC,IAAI,CAAC,GAAG,CACjB,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,KAAK,CAAC,kCAAkC;QAC9C,MAAM,MAAM,GAAuB,EAAE,CAAC;QACtC,KAAK,MAAM,aAAa,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;YACvE,IAAI,CAAC,aAAa,CAAC,wBAAwB,EAAE;gBAC3C,SAAS;aACV;YAED,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAC,EAAE;gBAC9D,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAChC,gCAAgC,aAAa,CAAC,wBAAwB,mBAAmB,aAAa,CAAC,EAAE,mBAAmB,CAC7H,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACnB,SAAS;aACV;YAED,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE;gBACzF,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAChC,gCAAgC,aAAa,CAAC,wBAAwB,mBAAmB,aAAa,CAAC,EAAE,yCAAyC,CACnJ,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import path from 'path';\n\nimport fs from 'fs-extra';\n\nimport { BuildStep } from './BuildStep.js';\nimport { BuildStepInputValueTypeName } from './BuildStepInput.js';\nimport { BuildWorkflow } from './BuildWorkflow.js';\nimport { BuildConfigError, BuildWorkflowError } from './errors.js';\nimport { duplicates } from './utils/expodash/duplicates.js';\nimport { nullthrows } from './utils/nullthrows.js';\nimport { findOutputPaths } from './utils/template.js';\n\nexport class BuildWorkflowValidator {\n constructor(private readonly workflow: BuildWorkflow) {}\n\n public async validateAsync(): Promise<void> {\n const errors: BuildConfigError[] = [];\n errors.push(...this.validateUniqueStepIds());\n errors.push(...this.validateInputs());\n errors.push(...this.validateAllowedPlatforms());\n errors.push(...(await this.validateCustomFunctionModulesAsync()));\n if (errors.length !== 0) {\n throw new BuildWorkflowError('Build workflow is invalid.', errors);\n }\n }\n\n private validateUniqueStepIds(): BuildConfigError[] {\n const stepIds = this.workflow.buildSteps.map(({ id }) => id);\n const duplicatedStepIds = duplicates(stepIds);\n if (duplicatedStepIds.length === 0) {\n return [];\n } else {\n const error = new BuildConfigError(\n `Duplicated step IDs: ${duplicatedStepIds.map((i) => `\"${i}\"`).join(', ')}`\n );\n return [error];\n }\n }\n\n private validateInputs(): BuildConfigError[] {\n const errors: BuildConfigError[] = [];\n\n const allStepIds = new Set(this.workflow.buildSteps.map((s) => s.id));\n const visitedStepByStepId: Record<string, BuildStep> = {};\n for (const currentStep of this.workflow.buildSteps) {\n for (const currentStepInput of currentStep.inputs ?? []) {\n if (currentStepInput.required && currentStepInput.rawValue === undefined) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" is required but it was not set.`\n );\n errors.push(error);\n }\n\n const currentType =\n typeof currentStepInput.rawValue === 'object'\n ? BuildStepInputValueTypeName.JSON\n : typeof currentStepInput.rawValue;\n if (\n currentStepInput.rawValue !== undefined &&\n !currentStepInput.isRawValueStepOrContextReference() &&\n currentType !== currentStepInput.allowedValueTypeName\n ) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${\n currentStep.displayName\n }\" is set to \"${\n typeof currentStepInput.rawValue === 'object'\n ? JSON.stringify(currentStepInput.rawValue)\n : currentStepInput.rawValue\n }\" which is not of type \"${\n currentStepInput.allowedValueTypeName\n }\" or is not step or context reference.`\n );\n errors.push(error);\n }\n\n if (currentStepInput.defaultValue === undefined) {\n continue;\n }\n if (!currentStepInput.isValueOneOfAllowedValues()) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${\n currentStep.displayName\n }\" is set to \"${\n currentStepInput.value\n }\" which is not one of the allowed values: ${nullthrows(currentStepInput.allowedValues)\n .map((i) => `\"${i}\"`)\n .join(', ')}.`\n );\n errors.push(error);\n }\n const paths =\n typeof currentStepInput.defaultValue === 'string'\n ? findOutputPaths(currentStepInput.defaultValue)\n : [];\n for (const { stepId: referencedStepId, outputId: referencedStepOutputId } of paths) {\n if (!(referencedStepId in visitedStepByStepId)) {\n if (allStepIds.has(referencedStepId)) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" uses an expression that references an output parameter from the future step \"${referencedStepId}\".`\n );\n errors.push(error);\n } else {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" uses an expression that references an output parameter from a non-existent step \"${referencedStepId}\".`\n );\n errors.push(error);\n }\n } else {\n if (!visitedStepByStepId[referencedStepId].hasOutputParameter(referencedStepOutputId)) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" uses an expression that references an undefined output parameter \"${referencedStepOutputId}\" from step \"${referencedStepId}\".`\n );\n errors.push(error);\n }\n }\n }\n }\n visitedStepByStepId[currentStep.id] = currentStep;\n }\n\n return errors;\n }\n\n private validateAllowedPlatforms(): BuildConfigError[] {\n const errors: BuildConfigError[] = [];\n for (const step of this.workflow.buildSteps) {\n if (!step.canBeRunOnRuntimePlatform()) {\n const error = new BuildConfigError(\n `Step \"${step.displayName}\" is not allowed on platform \"${\n step.ctx.global.runtimePlatform\n }\". Allowed platforms for this step are: ${nullthrows(\n step.supportedRuntimePlatforms,\n `step.supportedRuntimePlatforms can't be falsy if canBeRunOnRuntimePlatform() is false`\n )\n .map((p) => `\"${p}\"`)\n .join(', ')}.`\n );\n errors.push(error);\n }\n }\n return errors;\n }\n\n private async validateCustomFunctionModulesAsync(): Promise<BuildConfigError[]> {\n const errors: BuildConfigError[] = [];\n for (const buildFunction of Object.values(this.workflow.buildFunctions)) {\n if (!buildFunction.customFunctionModulePath) {\n continue;\n }\n\n if (!(await fs.exists(buildFunction.customFunctionModulePath))) {\n const error = new BuildConfigError(\n `Custom function module path \"${buildFunction.customFunctionModulePath}\" for function \"${buildFunction.id}\" does not exist.`\n );\n errors.push(error);\n continue;\n }\n\n if (!(await fs.exists(path.join(buildFunction.customFunctionModulePath, 'package.json')))) {\n const error = new BuildConfigError(\n `Custom function module path \"${buildFunction.customFunctionModulePath}\" for function \"${buildFunction.id}\" does not contain a package.json file.`\n );\n errors.push(error);\n }\n }\n return errors;\n }\n}\n"]}
@@ -28,8 +28,8 @@ export class CliContextProvider {
28
28
  }
29
29
  }
30
30
  async function runAsync(configPath, relativeProjectDirectory, runtimePlatform) {
31
- const ctx = new BuildStepGlobalContext(new CliContextProvider(logger, runtimePlatform, relativeProjectDirectory, relativeProjectDirectory, relativeProjectDirectory), false);
32
- const parser = new BuildConfigParser(ctx, { configPath });
31
+ const ctx = new BuildStepGlobalContext(new CliContextProvider(logger, runtimePlatform, relativeProjectDirectory, relativeProjectDirectory, relativeProjectDirectory), false, configPath);
32
+ const parser = new BuildConfigParser(ctx, {});
33
33
  const workflow = await parser.parseAsync();
34
34
  await workflow.executeAsync();
35
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAU,YAAY,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAgC,sBAAsB,EAAE,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AI,CAAC,CAAC,CAAC,CAAC;AACrD,MAAM,QAAQ,GAAyB,CAAC,MAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,mCACrD,OAAO,CAAC,QAAQ,CAAyB,CAAC;AAE5C,IAAI,CAAC,kBAAkB,IAAI,CAAC,4BAA4B,EAAE;IACxD,OAAO,CAAC,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACrF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kBAAkB,CAAC,CAAC;AACnE,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,4BAA4B,CAAC,CAAC;AAEnF,QAAQ,CAAC,UAAU,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAC7D,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;IACtC,IAAI,GAAG,YAAY,kBAAkB,EAAE;QACrC,MAAM,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAC9D,KAAK,MAAM,WAAW,IAAI,GAAG,CAAC,MAAM,EAAE;YACpC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;SACpC;KACF;AACH,CAAC,CAAC,CAAC","sourcesContent":["import path from 'path';\n\nimport { bunyan, createLogger } from '@expo/logger';\n\nimport { BuildConfigParser } from '../BuildConfigParser.js';\nimport { ExternalBuildContextProvider, BuildStepGlobalContext } from '../BuildStepContext.js';\nimport { BuildWorkflowError } from '../errors.js';\nimport { BuildRuntimePlatform } from '../BuildRuntimePlatform.js';\nimport { BuildStepEnv } from '../BuildStepEnv.js';\n\nconst logger = createLogger({\n name: 'steps-cli',\n level: 'info',\n});\n\nexport class CliContextProvider implements ExternalBuildContextProvider {\n private _env: BuildStepEnv = {};\n\n constructor(\n public readonly logger: bunyan,\n public readonly runtimePlatform: BuildRuntimePlatform,\n public readonly projectSourceDirectory: string,\n public readonly projectTargetDirectory: string,\n public readonly defaultWorkingDirectory: string\n ) {}\n public get env(): BuildStepEnv {\n return this._env;\n }\n public staticContext(): any {\n return {};\n }\n public updateEnv(env: BuildStepEnv): void {\n this._env = env;\n }\n}\n\nasync function runAsync(\n configPath: string,\n relativeProjectDirectory: string,\n runtimePlatform: BuildRuntimePlatform\n): Promise<void> {\n const ctx = new BuildStepGlobalContext(\n new CliContextProvider(\n logger,\n runtimePlatform,\n relativeProjectDirectory,\n relativeProjectDirectory,\n relativeProjectDirectory\n ),\n false\n );\n const parser = new BuildConfigParser(ctx, { configPath });\n const workflow = await parser.parseAsync();\n await workflow.executeAsync();\n}\n\nconst relativeConfigPath = process.argv[2];\nconst relativeProjectDirectoryPath = process.argv[3];\nconst platform: BuildRuntimePlatform = (process.argv[4] ??\n process.platform) as BuildRuntimePlatform;\n\nif (!relativeConfigPath || !relativeProjectDirectoryPath) {\n console.error('Usage: yarn cli config.yml path/to/project/directory [darwin|linux]');\n process.exit(1);\n}\n\nconst configPath = path.resolve(process.cwd(), relativeConfigPath);\nconst workingDirectory = path.resolve(process.cwd(), relativeProjectDirectoryPath);\n\nrunAsync(configPath, workingDirectory, platform).catch((err) => {\n logger.error({ err }, 'Build failed');\n if (err instanceof BuildWorkflowError) {\n logger.error('Failed to parse the custom build config file.');\n for (const detailedErr of err.errors) {\n logger.error({ err: detailedErr });\n }\n }\n});\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAU,YAAY,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAgC,sBAAsB,EAAE,MAAM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AC,CAAC,CAAC,CAAC;AACrD,MAAM,QAAQ,GAAyB,CAAC,MAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,mCACrD,OAAO,CAAC,QAAQ,CAAyB,CAAC;AAE5C,IAAI,CAAC,kBAAkB,IAAI,CAAC,4BAA4B,EAAE;IACxD,OAAO,CAAC,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACrF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kBAAkB,CAAC,CAAC;AACnE,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,4BAA4B,CAAC,CAAC;AAEnF,QAAQ,CAAC,UAAU,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAC7D,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;IACtC,IAAI,GAAG,YAAY,kBAAkB,EAAE;QACrC,MAAM,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAC9D,KAAK,MAAM,WAAW,IAAI,GAAG,CAAC,MAAM,EAAE;YACpC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;SACpC;KACF;AACH,CAAC,CAAC,CAAC","sourcesContent":["import path from 'path';\n\nimport { bunyan, createLogger } from '@expo/logger';\n\nimport { BuildConfigParser } from '../BuildConfigParser.js';\nimport { ExternalBuildContextProvider, BuildStepGlobalContext } from '../BuildStepContext.js';\nimport { BuildWorkflowError } from '../errors.js';\nimport { BuildRuntimePlatform } from '../BuildRuntimePlatform.js';\nimport { BuildStepEnv } from '../BuildStepEnv.js';\n\nconst logger = createLogger({\n name: 'steps-cli',\n level: 'info',\n});\n\nexport class CliContextProvider implements ExternalBuildContextProvider {\n private _env: BuildStepEnv = {};\n\n constructor(\n public readonly logger: bunyan,\n public readonly runtimePlatform: BuildRuntimePlatform,\n public readonly projectSourceDirectory: string,\n public readonly projectTargetDirectory: string,\n public readonly defaultWorkingDirectory: string\n ) {}\n public get env(): BuildStepEnv {\n return this._env;\n }\n public staticContext(): any {\n return {};\n }\n public updateEnv(env: BuildStepEnv): void {\n this._env = env;\n }\n}\n\nasync function runAsync(\n configPath: string,\n relativeProjectDirectory: string,\n runtimePlatform: BuildRuntimePlatform\n): Promise<void> {\n const ctx = new BuildStepGlobalContext(\n new CliContextProvider(\n logger,\n runtimePlatform,\n relativeProjectDirectory,\n relativeProjectDirectory,\n relativeProjectDirectory\n ),\n false,\n configPath\n );\n const parser = new BuildConfigParser(ctx, {});\n const workflow = await parser.parseAsync();\n await workflow.executeAsync();\n}\n\nconst relativeConfigPath = process.argv[2];\nconst relativeProjectDirectoryPath = process.argv[3];\nconst platform: BuildRuntimePlatform = (process.argv[4] ??\n process.platform) as BuildRuntimePlatform;\n\nif (!relativeConfigPath || !relativeProjectDirectoryPath) {\n console.error('Usage: yarn cli config.yml path/to/project/directory [darwin|linux]');\n process.exit(1);\n}\n\nconst configPath = path.resolve(process.cwd(), relativeConfigPath);\nconst workingDirectory = path.resolve(process.cwd(), relativeProjectDirectoryPath);\n\nrunAsync(configPath, workingDirectory, platform).catch((err) => {\n logger.error({ err }, 'Build failed');\n if (err instanceof BuildWorkflowError) {\n logger.error('Failed to parse the custom build config file.');\n for (const detailedErr of err.errors) {\n logger.error({ err: detailedErr });\n }\n }\n});\n"]}
@@ -1,3 +1,4 @@
1
+ export { BuildStepContext } from './BuildStepContext.js';
1
2
  export { readAndValidateBuildConfigAsync } from './BuildConfig.js';
2
3
  export { BuildConfigParser } from './BuildConfigParser.js';
3
4
  export { BuildFunction } from './BuildFunction.js';
package/dist_esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { BuildStepContext } from './BuildStepContext.js';
1
2
  export { readAndValidateBuildConfigAsync } from './BuildConfig.js';
2
3
  export { BuildConfigParser } from './BuildConfigParser.js';
3
4
  export { BuildFunction } from './BuildFunction.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAgC,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC","sourcesContent":["export { readAndValidateBuildConfigAsync } from './BuildConfig.js';\nexport { BuildConfigParser } from './BuildConfigParser.js';\nexport { BuildFunction } from './BuildFunction.js';\nexport { BuildRuntimePlatform } from './BuildRuntimePlatform.js';\nexport { BuildStepInput, BuildStepInputValueTypeName } from './BuildStepInput.js';\nexport { BuildStepOutput } from './BuildStepOutput.js';\nexport { BuildStepGlobalContext, ExternalBuildContextProvider } from './BuildStepContext.js';\nexport { BuildWorkflow } from './BuildWorkflow.js';\nexport { BuildStepEnv } from './BuildStepEnv.js';\nexport * as errors from './errors.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,+BAA+B,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAgC,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC","sourcesContent":["export { BuildStepContext } from './BuildStepContext.js';\nexport { readAndValidateBuildConfigAsync } from './BuildConfig.js';\nexport { BuildConfigParser } from './BuildConfigParser.js';\nexport { BuildFunction } from './BuildFunction.js';\nexport { BuildRuntimePlatform } from './BuildRuntimePlatform.js';\nexport { BuildStepInput, BuildStepInputValueTypeName } from './BuildStepInput.js';\nexport { BuildStepOutput } from './BuildStepOutput.js';\nexport { BuildStepGlobalContext, ExternalBuildContextProvider } from './BuildStepContext.js';\nexport { BuildWorkflow } from './BuildWorkflow.js';\nexport { BuildStepEnv } from './BuildStepEnv.js';\nexport * as errors from './errors.js';\n"]}
@@ -0,0 +1 @@
1
+ export {};