@expo/steps 1.0.265 → 1.0.271
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/{dist_commonjs → dist}/AbstractConfigParser.d.ts +5 -5
- package/{dist_commonjs/AbstractConfigParser.cjs → dist/AbstractConfigParser.js} +13 -13
- package/dist/AbstractConfigParser.js.map +1 -0
- package/{dist_commonjs → dist}/BuildConfig.d.ts +3 -3
- package/{dist_commonjs/BuildConfig.cjs → dist/BuildConfig.js} +22 -22
- package/dist/BuildConfig.js.map +1 -0
- package/{dist_esm → dist}/BuildConfigParser.d.ts +5 -5
- package/{dist_commonjs/BuildConfigParser.cjs → dist/BuildConfigParser.js} +31 -31
- package/dist/BuildConfigParser.js.map +1 -0
- package/{dist_esm → dist}/BuildFunction.d.ts +6 -6
- package/{dist_commonjs/BuildFunction.cjs → dist/BuildFunction.js} +6 -6
- package/dist/BuildFunction.js.map +1 -0
- package/{dist_commonjs → dist}/BuildFunctionGroup.d.ts +4 -4
- package/{dist_commonjs/BuildFunctionGroup.cjs → dist/BuildFunctionGroup.js} +4 -4
- package/dist/BuildFunctionGroup.js.map +1 -0
- package/{dist_esm → dist}/BuildStep.d.ts +5 -5
- package/{dist_commonjs/BuildStep.cjs → dist/BuildStep.js} +29 -29
- package/dist/BuildStep.js.map +1 -0
- package/{dist_commonjs → dist}/BuildStepContext.d.ts +4 -4
- package/{dist_commonjs/BuildStepContext.cjs → dist/BuildStepContext.js} +10 -10
- package/dist/BuildStepContext.js.map +1 -0
- package/{dist_esm → dist}/BuildStepInput.d.ts +1 -1
- package/{dist_commonjs/BuildStepInput.cjs → dist/BuildStepInput.js} +12 -12
- package/dist/BuildStepInput.js.map +1 -0
- package/{dist_commonjs → dist}/BuildStepOutput.d.ts +1 -1
- package/{dist_commonjs/BuildStepOutput.cjs → dist/BuildStepOutput.js} +3 -3
- package/dist/BuildStepOutput.js.map +1 -0
- package/{dist_commonjs → dist}/BuildTemporaryFiles.d.ts +1 -1
- package/{dist_commonjs → dist}/BuildTemporaryFiles.js.map +1 -1
- package/{dist_commonjs → dist}/BuildWorkflow.d.ts +3 -3
- package/dist/BuildWorkflow.js.map +1 -0
- package/{dist_commonjs → dist}/BuildWorkflowValidator.d.ts +1 -1
- package/{dist_commonjs/BuildWorkflowValidator.cjs → dist/BuildWorkflowValidator.js} +19 -19
- package/dist/BuildWorkflowValidator.js.map +1 -0
- package/{dist_commonjs → dist}/StepsConfigParser.d.ts +5 -5
- package/{dist_commonjs/StepsConfigParser.cjs → dist/StepsConfigParser.js} +13 -13
- package/dist/StepsConfigParser.js.map +1 -0
- package/{dist_esm → dist}/cli/cli.d.ts +3 -3
- package/{dist_commonjs/cli/cli.cjs → dist/cli/cli.js} +6 -6
- package/dist/cli/cli.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/{dist_commonjs/index.cjs → dist/index.js} +30 -30
- package/dist/index.js.map +1 -0
- package/{dist_commonjs/interpolation.cjs → dist/interpolation.js} +3 -3
- package/dist/interpolation.js.map +1 -0
- package/{dist_commonjs/scripts/runCustomFunction.cjs → dist/scripts/runCustomFunction.js} +9 -9
- package/dist/scripts/runCustomFunction.js.map +1 -0
- package/{dist_commonjs → dist}/utils/customFunction.d.ts +4 -4
- package/{dist_commonjs/utils/customFunction.cjs → dist/utils/customFunction.js} +4 -6
- package/dist/utils/customFunction.js.map +1 -0
- package/{dist_commonjs/utils/shell/bin.cjs → dist/utils/shell/bin.js} +1 -3
- package/dist/utils/shell/bin.js.map +1 -0
- package/{dist_commonjs/utils/template.cjs → dist/utils/template.js} +7 -7
- package/dist/utils/template.js.map +1 -0
- package/package.json +11 -23
- package/dist_commonjs/AbstractConfigParser.js.map +0 -1
- package/dist_commonjs/BuildConfig.js.map +0 -1
- package/dist_commonjs/BuildConfigParser.d.ts +0 -33
- package/dist_commonjs/BuildConfigParser.js.map +0 -1
- package/dist_commonjs/BuildFunction.d.ts +0 -45
- package/dist_commonjs/BuildFunction.js.map +0 -1
- package/dist_commonjs/BuildFunctionGroup.js.map +0 -1
- package/dist_commonjs/BuildStep.d.ts +0 -100
- package/dist_commonjs/BuildStep.js.map +0 -1
- package/dist_commonjs/BuildStepContext.js.map +0 -1
- package/dist_commonjs/BuildStepInput.d.ts +0 -47
- package/dist_commonjs/BuildStepInput.js.map +0 -1
- package/dist_commonjs/BuildStepOutput.js.map +0 -1
- package/dist_commonjs/BuildWorkflow.js.map +0 -1
- package/dist_commonjs/BuildWorkflowValidator.js.map +0 -1
- package/dist_commonjs/StepsConfigParser.js.map +0 -1
- package/dist_commonjs/cli/cli.d.ts +0 -18
- package/dist_commonjs/cli/cli.js.map +0 -1
- package/dist_commonjs/index.d.ts +0 -19
- package/dist_commonjs/index.js.map +0 -1
- package/dist_commonjs/interpolation.js.map +0 -1
- package/dist_commonjs/scripts/runCustomFunction.js.map +0 -1
- package/dist_commonjs/utils/customFunction.js.map +0 -1
- package/dist_commonjs/utils/shell/bin.js.map +0 -1
- package/dist_commonjs/utils/template.js.map +0 -1
- package/dist_esm/AbstractConfigParser.d.ts +0 -23
- package/dist_esm/AbstractConfigParser.js +0 -61
- package/dist_esm/AbstractConfigParser.js.map +0 -1
- package/dist_esm/BuildConfig.d.ts +0 -80
- package/dist_esm/BuildConfig.js +0 -281
- package/dist_esm/BuildConfig.js.map +0 -1
- package/dist_esm/BuildConfigParser.js +0 -233
- package/dist_esm/BuildConfigParser.js.map +0 -1
- package/dist_esm/BuildFunction.js +0 -62
- package/dist_esm/BuildFunction.js.map +0 -1
- package/dist_esm/BuildFunctionGroup.d.ts +0 -23
- package/dist_esm/BuildFunctionGroup.js +0 -36
- package/dist_esm/BuildFunctionGroup.js.map +0 -1
- package/dist_esm/BuildRuntimePlatform.d.ts +0 -4
- package/dist_esm/BuildRuntimePlatform.js +0 -6
- package/dist_esm/BuildRuntimePlatform.js.map +0 -1
- package/dist_esm/BuildStep.js +0 -354
- package/dist_esm/BuildStep.js.map +0 -1
- package/dist_esm/BuildStepContext.d.ts +0 -86
- package/dist_esm/BuildStepContext.js +0 -207
- package/dist_esm/BuildStepContext.js.map +0 -1
- package/dist_esm/BuildStepEnv.d.ts +0 -1
- package/dist_esm/BuildStepEnv.js +0 -2
- package/dist_esm/BuildStepEnv.js.map +0 -1
- package/dist_esm/BuildStepInput.js +0 -150
- package/dist_esm/BuildStepInput.js.map +0 -1
- package/dist_esm/BuildStepOutput.d.ts +0 -33
- package/dist_esm/BuildStepOutput.js +0 -57
- package/dist_esm/BuildStepOutput.js.map +0 -1
- package/dist_esm/BuildTemporaryFiles.d.ts +0 -5
- package/dist_esm/BuildTemporaryFiles.js +0 -31
- package/dist_esm/BuildTemporaryFiles.js.map +0 -1
- package/dist_esm/BuildWorkflow.d.ts +0 -14
- package/dist_esm/BuildWorkflow.js +0 -55
- package/dist_esm/BuildWorkflow.js.map +0 -1
- package/dist_esm/BuildWorkflowValidator.d.ts +0 -10
- package/dist_esm/BuildWorkflowValidator.js +0 -121
- package/dist_esm/BuildWorkflowValidator.js.map +0 -1
- package/dist_esm/StepMetrics.d.ts +0 -10
- package/dist_esm/StepMetrics.js +0 -2
- package/dist_esm/StepMetrics.js.map +0 -1
- package/dist_esm/StepsConfigParser.d.ts +0 -24
- package/dist_esm/StepsConfigParser.js +0 -133
- package/dist_esm/StepsConfigParser.js.map +0 -1
- package/dist_esm/cli/cli.js +0 -61
- package/dist_esm/cli/cli.js.map +0 -1
- package/dist_esm/errors.d.ts +0 -24
- package/dist_esm/errors.js +0 -24
- package/dist_esm/errors.js.map +0 -1
- package/dist_esm/index.d.ts +0 -19
- package/dist_esm/index.js +0 -18
- package/dist_esm/index.js.map +0 -1
- package/dist_esm/interpolation.d.ts +0 -5
- package/dist_esm/interpolation.js +0 -26
- package/dist_esm/interpolation.js.map +0 -1
- package/dist_esm/scripts/runCustomFunction.d.ts +0 -1
- package/dist_esm/scripts/runCustomFunction.js +0 -100
- package/dist_esm/scripts/runCustomFunction.js.map +0 -1
- package/dist_esm/utils/customFunction.d.ts +0 -18
- package/dist_esm/utils/customFunction.js +0 -49
- package/dist_esm/utils/customFunction.js.map +0 -1
- package/dist_esm/utils/expodash/duplicates.d.ts +0 -1
- package/dist_esm/utils/expodash/duplicates.js +0 -14
- package/dist_esm/utils/expodash/duplicates.js.map +0 -1
- package/dist_esm/utils/expodash/uniq.d.ts +0 -1
- package/dist_esm/utils/expodash/uniq.js +0 -5
- package/dist_esm/utils/expodash/uniq.js.map +0 -1
- package/dist_esm/utils/hashFiles.d.ts +0 -6
- package/dist_esm/utils/hashFiles.js +0 -31
- package/dist_esm/utils/hashFiles.js.map +0 -1
- package/dist_esm/utils/jsepEval.d.ts +0 -1
- package/dist_esm/utils/jsepEval.js +0 -169
- package/dist_esm/utils/jsepEval.js.map +0 -1
- package/dist_esm/utils/nullthrows.d.ts +0 -1
- package/dist_esm/utils/nullthrows.js +0 -7
- package/dist_esm/utils/nullthrows.js.map +0 -1
- package/dist_esm/utils/shell/bin.d.ts +0 -1
- package/dist_esm/utils/shell/bin.js +0 -5
- package/dist_esm/utils/shell/bin.js.map +0 -1
- package/dist_esm/utils/shell/command.d.ts +0 -4
- package/dist_esm/utils/shell/command.js +0 -13
- package/dist_esm/utils/shell/command.js.map +0 -1
- package/dist_esm/utils/shell/spawn.d.ts +0 -15
- package/dist_esm/utils/shell/spawn.js +0 -16
- package/dist_esm/utils/shell/spawn.js.map +0 -1
- package/dist_esm/utils/template.d.ts +0 -19
- package/dist_esm/utils/template.js +0 -106
- package/dist_esm/utils/template.js.map +0 -1
- /package/{dist_commonjs → dist}/BuildRuntimePlatform.d.ts +0 -0
- /package/{dist_commonjs/BuildRuntimePlatform.cjs → dist/BuildRuntimePlatform.js} +0 -0
- /package/{dist_commonjs → dist}/BuildRuntimePlatform.js.map +0 -0
- /package/{dist_commonjs → dist}/BuildStepEnv.d.ts +0 -0
- /package/{dist_commonjs/BuildStepEnv.cjs → dist/BuildStepEnv.js} +0 -0
- /package/{dist_commonjs → dist}/BuildStepEnv.js.map +0 -0
- /package/{dist_commonjs/BuildTemporaryFiles.cjs → dist/BuildTemporaryFiles.js} +0 -0
- /package/{dist_commonjs/BuildWorkflow.cjs → dist/BuildWorkflow.js} +0 -0
- /package/{dist_commonjs → dist}/StepMetrics.d.ts +0 -0
- /package/{dist_commonjs/StepMetrics.cjs → dist/StepMetrics.js} +0 -0
- /package/{dist_commonjs → dist}/StepMetrics.js.map +0 -0
- /package/{dist_commonjs → dist}/errors.d.ts +0 -0
- /package/{dist_commonjs/errors.cjs → dist/errors.js} +0 -0
- /package/{dist_commonjs → dist}/errors.js.map +0 -0
- /package/{dist_commonjs → dist}/interpolation.d.ts +0 -0
- /package/{dist_commonjs → dist}/scripts/runCustomFunction.d.ts +0 -0
- /package/{dist_commonjs → dist}/utils/expodash/duplicates.d.ts +0 -0
- /package/{dist_commonjs/utils/expodash/duplicates.cjs → dist/utils/expodash/duplicates.js} +0 -0
- /package/{dist_commonjs → dist}/utils/expodash/duplicates.js.map +0 -0
- /package/{dist_commonjs → dist}/utils/expodash/uniq.d.ts +0 -0
- /package/{dist_commonjs/utils/expodash/uniq.cjs → dist/utils/expodash/uniq.js} +0 -0
- /package/{dist_commonjs → dist}/utils/expodash/uniq.js.map +0 -0
- /package/{dist_commonjs → dist}/utils/hashFiles.d.ts +0 -0
- /package/{dist_commonjs/utils/hashFiles.cjs → dist/utils/hashFiles.js} +0 -0
- /package/{dist_commonjs → dist}/utils/hashFiles.js.map +0 -0
- /package/{dist_commonjs → dist}/utils/jsepEval.d.ts +0 -0
- /package/{dist_commonjs/utils/jsepEval.cjs → dist/utils/jsepEval.js} +0 -0
- /package/{dist_commonjs → dist}/utils/jsepEval.js.map +0 -0
- /package/{dist_commonjs → dist}/utils/nullthrows.d.ts +0 -0
- /package/{dist_commonjs/utils/nullthrows.cjs → dist/utils/nullthrows.js} +0 -0
- /package/{dist_commonjs → dist}/utils/nullthrows.js.map +0 -0
- /package/{dist_commonjs → dist}/utils/shell/bin.d.ts +0 -0
- /package/{dist_commonjs → dist}/utils/shell/command.d.ts +0 -0
- /package/{dist_commonjs/utils/shell/command.cjs → dist/utils/shell/command.js} +0 -0
- /package/{dist_commonjs → dist}/utils/shell/command.js.map +0 -0
- /package/{dist_commonjs → dist}/utils/shell/spawn.d.ts +0 -0
- /package/{dist_commonjs/utils/shell/spawn.cjs → dist/utils/shell/spawn.js} +0 -0
- /package/{dist_commonjs → dist}/utils/shell/spawn.js.map +0 -0
- /package/{dist_commonjs → dist}/utils/template.d.ts +0 -0
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function getShellCommandAndArgs(shell, script) {
|
|
2
|
-
const splits = shell.split(' ');
|
|
3
|
-
const command = splits[0];
|
|
4
|
-
const args = [...splits.slice(1)];
|
|
5
|
-
if (script) {
|
|
6
|
-
args.push(script);
|
|
7
|
-
}
|
|
8
|
-
return {
|
|
9
|
-
command,
|
|
10
|
-
args,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=command.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/utils/shell/command.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,sBAAsB,CACpC,KAAa,EACb,MAAe;IAEf,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,IAAI,MAAM,EAAE,CAAC;QACX,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpB,CAAC;IACD,OAAO;QACL,OAAO;QACP,IAAI;KACL,CAAC;AACJ,CAAC","sourcesContent":["export function getShellCommandAndArgs(\n shell: string,\n script?: string\n): { command: string; args?: string[] } {\n const splits = shell.split(' ');\n const command = splits[0];\n const args = [...splits.slice(1)];\n if (script) {\n args.push(script);\n }\n return {\n command,\n args,\n };\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IOType } from 'child_process';
|
|
2
|
-
import { bunyan, PipeMode } from '@expo/logger';
|
|
3
|
-
import { SpawnResult, SpawnPromise, SpawnOptions as SpawnOptionsOriginal } from '@expo/spawn-async';
|
|
4
|
-
type SpawnOptions = Omit<SpawnOptionsOriginal, 'stdio' | 'ignoreStdio'> & {
|
|
5
|
-
lineTransformer?: (line: string) => string | null;
|
|
6
|
-
mode?: PipeMode;
|
|
7
|
-
} & ({
|
|
8
|
-
logger: bunyan;
|
|
9
|
-
stdio: 'pipe' | [IOType, 'pipe', 'pipe', ...IOType[]];
|
|
10
|
-
} | {
|
|
11
|
-
logger?: never;
|
|
12
|
-
stdio?: SpawnOptionsOriginal['stdio'];
|
|
13
|
-
});
|
|
14
|
-
export declare function spawnAsync(command: string, args: string[], allOptions?: SpawnOptions): SpawnPromise<SpawnResult>;
|
|
15
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { pipeSpawnOutput } from '@expo/logger';
|
|
2
|
-
import spawnAsyncOriginal from '@expo/spawn-async';
|
|
3
|
-
// If
|
|
4
|
-
// eslint-disable-next-line async-protect/async-suffix
|
|
5
|
-
export function spawnAsync(command, args, allOptions = {
|
|
6
|
-
stdio: 'inherit',
|
|
7
|
-
cwd: process.cwd(),
|
|
8
|
-
}) {
|
|
9
|
-
const { logger, ...options } = allOptions;
|
|
10
|
-
const promise = spawnAsyncOriginal(command, args, options);
|
|
11
|
-
if (logger && promise.child) {
|
|
12
|
-
pipeSpawnOutput(logger, promise.child, options);
|
|
13
|
-
}
|
|
14
|
-
return promise;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=spawn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.js","sourceRoot":"","sources":["../../../src/utils/shell/spawn.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AACjE,OAAO,kBAIN,MAAM,mBAAmB,CAAC;AAoB3B,KAAK;AAEL,sDAAsD;AACtD,MAAM,UAAU,UAAU,CACxB,OAAe,EACf,IAAc,EACd,aAA2B;IACzB,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;CACnB;IAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,UAAU,CAAC;IAC1C,MAAM,OAAO,GAAG,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,IAAI,MAAM,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAC5B,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { IOType } from 'child_process';\n\nimport { pipeSpawnOutput, bunyan, PipeMode } from '@expo/logger';\nimport spawnAsyncOriginal, {\n SpawnResult,\n SpawnPromise,\n SpawnOptions as SpawnOptionsOriginal,\n} from '@expo/spawn-async';\n\n// We omit 'ignoreStdio' to simplify logic -- only 'stdio' governs stdio.\n// We omit 'stdio' here to add further down in a logger-based union.\ntype SpawnOptions = Omit<SpawnOptionsOriginal, 'stdio' | 'ignoreStdio'> & {\n lineTransformer?: (line: string) => string | null;\n mode?: PipeMode;\n} & (\n | {\n // If logger is passed, we require stdio to be pipe.\n logger: bunyan;\n stdio: 'pipe' | [IOType, 'pipe', 'pipe', ...IOType[]];\n }\n | {\n // If logger is not passed, stdio can be anything.\n // Defaults to inherit.\n logger?: never;\n stdio?: SpawnOptionsOriginal['stdio'];\n }\n );\n// If\n\n// eslint-disable-next-line async-protect/async-suffix\nexport function spawnAsync(\n command: string,\n args: string[],\n allOptions: SpawnOptions = {\n stdio: 'inherit',\n cwd: process.cwd(),\n }\n): SpawnPromise<SpawnResult> {\n const { logger, ...options } = allOptions;\n const promise = spawnAsyncOriginal(command, args, options);\n if (logger && promise.child) {\n pipeSpawnOutput(logger, promise.child, options);\n }\n return promise;\n}\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const BUILD_STEP_INPUT_EXPRESSION_REGEXP: RegExp;
|
|
2
|
-
export declare const BUILD_STEP_OUTPUT_EXPRESSION_REGEXP: RegExp;
|
|
3
|
-
export declare const BUILD_GLOBAL_CONTEXT_EXPRESSION_REGEXP: RegExp;
|
|
4
|
-
export declare const BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX: RegExp;
|
|
5
|
-
export declare function interpolateWithInputs(templateString: string, inputs: Record<string, string>): string;
|
|
6
|
-
export declare function interpolateWithOutputs<InterpolableType extends string | object>(interpolableValue: InterpolableType, fn: (path: string) => string): InterpolableType;
|
|
7
|
-
export declare function interpolateStringWithOutputs(templateString: string, fn: (path: string) => string): string;
|
|
8
|
-
export declare function interpolateObjectWithOutputs(interpolableObject: object, fn: (path: string) => string): object;
|
|
9
|
-
export declare function getObjectValueForInterpolation(path: string, obj: Record<string, unknown>): string | number | boolean | null;
|
|
10
|
-
export declare function interpolateWithGlobalContext<InterpolableType extends string | object>(interpolableValue: InterpolableType, fn: (path: string) => string): InterpolableType;
|
|
11
|
-
export declare function interpolateStringWithGlobalContext(templateString: string, fn: (path: string) => string): string;
|
|
12
|
-
export declare function interpolateObjectWithGlobalContext(templateObject: object, fn: (path: string) => string): object;
|
|
13
|
-
interface BuildOutputPath {
|
|
14
|
-
stepId: string;
|
|
15
|
-
outputId: string;
|
|
16
|
-
}
|
|
17
|
-
export declare function findOutputPaths(templateString: string): BuildOutputPath[];
|
|
18
|
-
export declare function parseOutputPath(outputPathWithObjectName: string): BuildOutputPath;
|
|
19
|
-
export {};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import get from 'lodash.get';
|
|
2
|
-
import cloneDeep from 'lodash.clonedeep';
|
|
3
|
-
import { BuildStepInputValueTypeName } from '../BuildStepInput.js';
|
|
4
|
-
import { BuildConfigError, BuildStepRuntimeError } from '../errors.js';
|
|
5
|
-
import { nullthrows } from './nullthrows.js';
|
|
6
|
-
export const BUILD_STEP_INPUT_EXPRESSION_REGEXP = /\${\s*(inputs\.[\S]+)\s*}/;
|
|
7
|
-
export const BUILD_STEP_OUTPUT_EXPRESSION_REGEXP = /\${\s*(steps\.[\S]+)\s*}/;
|
|
8
|
-
export const BUILD_GLOBAL_CONTEXT_EXPRESSION_REGEXP = /\${\s*(eas\.[\S]+)\s*}/;
|
|
9
|
-
export const BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX = /\${\s*((steps|eas)\.[\S]+)\s*}/;
|
|
10
|
-
export function interpolateWithInputs(templateString, inputs) {
|
|
11
|
-
return interpolate(templateString, BUILD_STEP_INPUT_EXPRESSION_REGEXP, inputs);
|
|
12
|
-
}
|
|
13
|
-
export function interpolateWithOutputs(interpolableValue, fn) {
|
|
14
|
-
if (typeof interpolableValue === 'string') {
|
|
15
|
-
return interpolateStringWithOutputs(interpolableValue, fn);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
return interpolateObjectWithOutputs(interpolableValue, fn);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export function interpolateStringWithOutputs(templateString, fn) {
|
|
22
|
-
return interpolate(templateString, BUILD_STEP_OUTPUT_EXPRESSION_REGEXP, fn);
|
|
23
|
-
}
|
|
24
|
-
export function interpolateObjectWithOutputs(interpolableObject, fn) {
|
|
25
|
-
const interpolableObjectCopy = cloneDeep(interpolableObject);
|
|
26
|
-
Object.keys(interpolableObject).forEach((property) => {
|
|
27
|
-
const propertyValue = interpolableObject[property];
|
|
28
|
-
if (['string', 'object'].includes(typeof propertyValue)) {
|
|
29
|
-
interpolableObjectCopy[property] =
|
|
30
|
-
interpolateWithOutputs(propertyValue, fn);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
return interpolableObjectCopy;
|
|
34
|
-
}
|
|
35
|
-
export function getObjectValueForInterpolation(path, obj) {
|
|
36
|
-
const value = get(obj, path);
|
|
37
|
-
if (value === undefined) {
|
|
38
|
-
throw new BuildStepRuntimeError(`Object field "${path}" does not exist. Ensure you are using the correct field name.`);
|
|
39
|
-
}
|
|
40
|
-
if (!isAllowedValueTypeForObjectInterpolation(value)) {
|
|
41
|
-
throw new BuildStepRuntimeError(`EAS context field "${path}" is not of type ${Object.values(BuildStepInputValueTypeName).join(', ')}, or undefined. It is of type "${typeof value}". We currently only support accessing string or undefined values from the EAS context.`);
|
|
42
|
-
}
|
|
43
|
-
if (value !== null && typeof value === 'object') {
|
|
44
|
-
return JSON.stringify(value);
|
|
45
|
-
}
|
|
46
|
-
return value;
|
|
47
|
-
}
|
|
48
|
-
export function interpolateWithGlobalContext(interpolableValue, fn) {
|
|
49
|
-
if (typeof interpolableValue === 'string') {
|
|
50
|
-
return interpolateStringWithGlobalContext(interpolableValue, fn);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
return interpolateObjectWithGlobalContext(interpolableValue, fn);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
export function interpolateStringWithGlobalContext(templateString, fn) {
|
|
57
|
-
return interpolate(templateString, BUILD_GLOBAL_CONTEXT_EXPRESSION_REGEXP, fn);
|
|
58
|
-
}
|
|
59
|
-
export function interpolateObjectWithGlobalContext(templateObject, fn) {
|
|
60
|
-
const templateObjectCopy = cloneDeep(templateObject);
|
|
61
|
-
Object.keys(templateObject).forEach((property) => {
|
|
62
|
-
const propertyValue = templateObject[property];
|
|
63
|
-
if (['string', 'object'].includes(typeof propertyValue)) {
|
|
64
|
-
templateObjectCopy[property] =
|
|
65
|
-
interpolateWithGlobalContext(propertyValue, fn);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
return templateObjectCopy;
|
|
69
|
-
}
|
|
70
|
-
function interpolate(templateString, regex, varsOrFn) {
|
|
71
|
-
const matched = templateString.match(new RegExp(regex, 'g'));
|
|
72
|
-
if (!matched) {
|
|
73
|
-
return templateString;
|
|
74
|
-
}
|
|
75
|
-
let result = templateString;
|
|
76
|
-
for (const match of matched) {
|
|
77
|
-
const [, path] = nullthrows(match.match(regex));
|
|
78
|
-
const value = typeof varsOrFn === 'function' ? varsOrFn(path) : varsOrFn[path.split('.')[1]];
|
|
79
|
-
result = result.replace(match, value);
|
|
80
|
-
}
|
|
81
|
-
return result;
|
|
82
|
-
}
|
|
83
|
-
function isAllowedValueTypeForObjectInterpolation(value) {
|
|
84
|
-
return (typeof value === 'string' ||
|
|
85
|
-
typeof value === 'number' ||
|
|
86
|
-
typeof value === 'boolean' ||
|
|
87
|
-
typeof value === 'object' ||
|
|
88
|
-
value === null);
|
|
89
|
-
}
|
|
90
|
-
export function findOutputPaths(templateString) {
|
|
91
|
-
const result = [];
|
|
92
|
-
const matches = templateString.matchAll(new RegExp(BUILD_STEP_OUTPUT_EXPRESSION_REGEXP, 'g'));
|
|
93
|
-
for (const match of matches) {
|
|
94
|
-
result.push(parseOutputPath(match[1]));
|
|
95
|
-
}
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
|
-
export function parseOutputPath(outputPathWithObjectName) {
|
|
99
|
-
const splits = outputPathWithObjectName.split('.').slice(1);
|
|
100
|
-
if (splits.length !== 2) {
|
|
101
|
-
throw new BuildConfigError(`Step output path must consist of two components joined with a dot, where first is the step ID, and second is the output name, e.g. "step3.output1". Passed: "${outputPathWithObjectName}"`);
|
|
102
|
-
}
|
|
103
|
-
const [stepId, outputId] = splits;
|
|
104
|
-
return { stepId, outputId };
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/utils/template.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,YAAY,CAAC;AAC7B,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,2BAA2B,EA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;AAChB,CAAC;AAED,SAAS,wCAAwC,CAC/C,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI,CACf,CAAC;AACJ,CAAC;AAOD,MAAM,UAAU,eAAe,CAAC,cAAsB;IACpD,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,mCAAmC,EAAE,GAAG,CAAC,CAAC,CAAC;IAC9F,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,wBAAgC;IAC9D,MAAM,MAAM,GAAG,wBAAwB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,gBAAgB,CACxB,gKAAgK,wBAAwB,GAAG,CAC5L,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,CAAC;IAClC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["import get from 'lodash.get';\nimport cloneDeep from 'lodash.clonedeep';\n\nimport { BuildStepInputValueTypeName } from '../BuildStepInput.js';\nimport { BuildConfigError, BuildStepRuntimeError } from '../errors.js';\n\nimport { nullthrows } from './nullthrows.js';\n\nexport const BUILD_STEP_INPUT_EXPRESSION_REGEXP = /\\${\\s*(inputs\\.[\\S]+)\\s*}/;\nexport const BUILD_STEP_OUTPUT_EXPRESSION_REGEXP = /\\${\\s*(steps\\.[\\S]+)\\s*}/;\nexport const BUILD_GLOBAL_CONTEXT_EXPRESSION_REGEXP = /\\${\\s*(eas\\.[\\S]+)\\s*}/;\nexport const BUILD_STEP_OR_BUILD_GLOBAL_CONTEXT_REFERENCE_REGEX = /\\${\\s*((steps|eas)\\.[\\S]+)\\s*}/;\n\nexport function interpolateWithInputs(\n templateString: string,\n inputs: Record<string, string>\n): string {\n return interpolate(templateString, BUILD_STEP_INPUT_EXPRESSION_REGEXP, inputs);\n}\n\nexport function interpolateWithOutputs<InterpolableType extends string | object>(\n interpolableValue: InterpolableType,\n fn: (path: string) => string\n): InterpolableType {\n if (typeof interpolableValue === 'string') {\n return interpolateStringWithOutputs(interpolableValue, fn) as InterpolableType;\n } else {\n return interpolateObjectWithOutputs(interpolableValue, fn) as InterpolableType;\n }\n}\n\nexport function interpolateStringWithOutputs(\n templateString: string,\n fn: (path: string) => string\n): string {\n return interpolate(templateString, BUILD_STEP_OUTPUT_EXPRESSION_REGEXP, fn);\n}\n\nexport function interpolateObjectWithOutputs(\n interpolableObject: object,\n fn: (path: string) => string\n): object {\n const interpolableObjectCopy = cloneDeep(interpolableObject);\n Object.keys(interpolableObject).forEach((property) => {\n const propertyValue = interpolableObject[property as keyof typeof interpolableObject];\n if (['string', 'object'].includes(typeof propertyValue)) {\n interpolableObjectCopy[property as keyof typeof interpolableObjectCopy] =\n interpolateWithOutputs(propertyValue, fn);\n }\n });\n return interpolableObjectCopy;\n}\n\nexport function getObjectValueForInterpolation(\n path: string,\n obj: Record<string, unknown>\n): string | number | boolean | null {\n const value = get(obj, path);\n\n if (value === undefined) {\n throw new BuildStepRuntimeError(\n `Object field \"${path}\" does not exist. Ensure you are using the correct field name.`\n );\n }\n\n if (!isAllowedValueTypeForObjectInterpolation(value)) {\n throw new BuildStepRuntimeError(\n `EAS context field \"${path}\" is not of type ${Object.values(BuildStepInputValueTypeName).join(\n ', '\n )}, or undefined. It is of type \"${typeof value}\". We currently only support accessing string or undefined values from the EAS context.`\n );\n }\n\n if (value !== null && typeof value === 'object') {\n return JSON.stringify(value);\n }\n\n return value;\n}\n\nexport function interpolateWithGlobalContext<InterpolableType extends string | object>(\n interpolableValue: InterpolableType,\n fn: (path: string) => string\n): InterpolableType {\n if (typeof interpolableValue === 'string') {\n return interpolateStringWithGlobalContext(interpolableValue, fn) as InterpolableType;\n } else {\n return interpolateObjectWithGlobalContext(interpolableValue, fn) as InterpolableType;\n }\n}\n\nexport function interpolateStringWithGlobalContext(\n templateString: string,\n fn: (path: string) => string\n): string {\n return interpolate(templateString, BUILD_GLOBAL_CONTEXT_EXPRESSION_REGEXP, fn);\n}\n\nexport function interpolateObjectWithGlobalContext(\n templateObject: object,\n fn: (path: string) => string\n): object {\n const templateObjectCopy = cloneDeep(templateObject);\n Object.keys(templateObject).forEach((property) => {\n const propertyValue = templateObject[property as keyof typeof templateObject];\n if (['string', 'object'].includes(typeof propertyValue)) {\n templateObjectCopy[property as keyof typeof templateObjectCopy] =\n interpolateWithGlobalContext(propertyValue, fn);\n }\n });\n return templateObjectCopy;\n}\n\nfunction interpolate(\n templateString: string,\n regex: RegExp,\n varsOrFn: Record<string, string> | ((key: string) => string)\n): string {\n const matched = templateString.match(new RegExp(regex, 'g'));\n if (!matched) {\n return templateString;\n }\n let result = templateString;\n for (const match of matched) {\n const [, path] = nullthrows(match.match(regex));\n const value = typeof varsOrFn === 'function' ? varsOrFn(path) : varsOrFn[path.split('.')[1]];\n result = result.replace(match, value);\n }\n return result;\n}\n\nfunction isAllowedValueTypeForObjectInterpolation(\n value: unknown\n): value is string | number | boolean | object | null {\n return (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n typeof value === 'object' ||\n value === null\n );\n}\n\ninterface BuildOutputPath {\n stepId: string;\n outputId: string;\n}\n\nexport function findOutputPaths(templateString: string): BuildOutputPath[] {\n const result: BuildOutputPath[] = [];\n const matches = templateString.matchAll(new RegExp(BUILD_STEP_OUTPUT_EXPRESSION_REGEXP, 'g'));\n for (const match of matches) {\n result.push(parseOutputPath(match[1]));\n }\n return result;\n}\n\nexport function parseOutputPath(outputPathWithObjectName: string): BuildOutputPath {\n const splits = outputPathWithObjectName.split('.').slice(1);\n if (splits.length !== 2) {\n throw new BuildConfigError(\n `Step output path must consist of two components joined with a dot, where first is the step ID, and second is the output name, e.g. \"step3.output1\". Passed: \"${outputPathWithObjectName}\"`\n );\n }\n const [stepId, outputId] = splits;\n return { stepId, outputId };\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|