@expo/build-tools 1.0.144 → 1.0.146
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.
|
@@ -29,25 +29,38 @@ async function runEasBuildInternalAsync({ job, logger, env, cwd, }) {
|
|
|
29
29
|
else if (githubTriggerOptions === null || githubTriggerOptions === void 0 ? void 0 : githubTriggerOptions.autoSubmit) {
|
|
30
30
|
autoSubmitArgs.push('--auto-submit');
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
32
|
+
let result;
|
|
33
|
+
try {
|
|
34
|
+
result = await (0, turtle_spawn_1.default)(cmd, [
|
|
35
|
+
...args,
|
|
36
|
+
'build:internal',
|
|
37
|
+
'--platform',
|
|
38
|
+
job.platform,
|
|
39
|
+
'--profile',
|
|
40
|
+
buildProfile,
|
|
41
|
+
...autoSubmitArgs,
|
|
42
|
+
], {
|
|
43
|
+
cwd,
|
|
44
|
+
env: {
|
|
45
|
+
...env,
|
|
46
|
+
EXPO_TOKEN: (0, nullthrows_1.default)(job.secrets, 'Secrets must be defined for non-custom builds')
|
|
47
|
+
.robotAccessToken,
|
|
48
|
+
...extraEnv,
|
|
49
|
+
},
|
|
50
|
+
logger,
|
|
51
|
+
mode: logger_1.PipeMode.STDERR_ONLY_AS_STDOUT,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
// Logging of build:internal is weird. We set mode = STDERR_ONLY_AS_STDOUT,
|
|
56
|
+
// because we don't want to pipe stdout to to the logger as it will contain
|
|
57
|
+
// the job object with its secrets. However, if the build fails, stderr alone
|
|
58
|
+
// is often not enough to debug the issue, so we also log stdout in those cases.
|
|
59
|
+
// It will look awkward (first stderr from pipe, then stdout from here), but
|
|
60
|
+
// it's better than nothing.
|
|
61
|
+
logger.error(`${err.stdout}`);
|
|
62
|
+
throw err;
|
|
63
|
+
}
|
|
51
64
|
const stdout = result.stdout.toString();
|
|
52
65
|
const parsed = JSON.parse(stdout);
|
|
53
66
|
return validateEasBuildInternalResult({
|
|
@@ -90,13 +103,12 @@ async function resolveEnvFromBuildProfileAsync(ctx, { cwd }) {
|
|
|
90
103
|
}
|
|
91
104
|
exports.resolveEnvFromBuildProfileAsync = resolveEnvFromBuildProfileAsync;
|
|
92
105
|
async function resolveEasCommandPrefixAndEnvAsync() {
|
|
93
|
-
var _a;
|
|
94
106
|
const npxArgsPrefix = (await (0, packageManager_1.isAtLeastNpm7Async)()) ? ['-y'] : [];
|
|
95
107
|
if (process.env.ENVIRONMENT === 'development') {
|
|
96
108
|
return {
|
|
97
|
-
cmd:
|
|
98
|
-
args: [],
|
|
99
|
-
extraEnv: {
|
|
109
|
+
cmd: 'npx',
|
|
110
|
+
args: [...npxArgsPrefix, `eas-cli@${EAS_CLI_STAGING_NPM_TAG}`],
|
|
111
|
+
extraEnv: {},
|
|
100
112
|
};
|
|
101
113
|
}
|
|
102
114
|
else if (process.env.ENVIRONMENT === 'staging') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"easBuildInternal.js","sourceRoot":"","sources":["../../src/common/easBuildInternal.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uDAAkG;AAClG,yCAAgD;AAChD,sEAAuC;AACvC,8CAAsB;AACtB,4DAAoC;AAIpC,4DAA6D;AAE7D,MAAM,uBAAuB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;AAEtD,MAAM,4BAA4B,GAAG,aAAG,CAAC,MAAM,CAAoC;IACjF,GAAG,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC3B,QA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gCAAgB,EAAC;QAC9B,GAAG,KAAK,CAAC,GAAG;QACZ,wDAAwD;QACxD,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;KAC1C,CAAS,CAAC;IACX,IAAA,gBAAM,EAAC,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,EAAE,6CAA6C,CAAC,CAAC;IAC3F,MAAM,WAAW,GAAG,IAAA,gCAAgB,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACjC,CAAC;AAED,SAAS,YAAY,CAAC,MAAW;IAC/B,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,aAAG,CAAC,MAAM,CAAC;QAClC,GAAG,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,aAAG,CAAC,MAAM,EAAE,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC;KACtD,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE;QAClB,YAAY,EAAE,IAAI;QAClB,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IACH,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,KAAK,CAAC;IACd,CAAC;IACD,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,CAAC;AACpB,CAAC","sourcesContent":["import assert from 'assert';\n\nimport { BuildJob, Env, Metadata, sanitizeBuildJob, sanitizeMetadata } from '@expo/eas-build-job';\nimport { PipeMode, bunyan } from '@expo/logger';\nimport spawn from '@expo/turtle-spawn';\nimport Joi from 'joi';\nimport nullthrows from 'nullthrows';\nimport { BuildStepEnv } from '@expo/steps';\n\nimport { BuildContext } from '../context';\nimport { isAtLeastNpm7Async } from '../utils/packageManager';\n\nconst EAS_CLI_STAGING_NPM_TAG = 'latest-eas-build-staging';\nconst EAS_CLI_PRODUCTION_NPM_TAG = 'latest-eas-build';\n\nconst EasBuildInternalResultSchema = Joi.object<{ job: object; metadata: object }>({\n job: Joi.object().unknown(),\n metadata: Joi.object().unknown(),\n});\n\nexport async function runEasBuildInternalAsync<TJob extends BuildJob>({\n job,\n logger,\n env,\n cwd,\n}: {\n job: TJob;\n logger: bunyan;\n env: BuildStepEnv;\n cwd: string;\n}): Promise<{\n newJob: TJob;\n newMetadata: Metadata;\n}> {\n const { cmd, args, extraEnv } = await resolveEasCommandPrefixAndEnvAsync();\n const { buildProfile, githubTriggerOptions } = job;\n assert(buildProfile, 'build profile is missing in a build from git-based integration.');\n\n const autoSubmitArgs = [];\n if (githubTriggerOptions?.submitProfile) {\n autoSubmitArgs.push('--auto-submit-with-profile');\n autoSubmitArgs.push(githubTriggerOptions.submitProfile);\n } else if (githubTriggerOptions?.autoSubmit) {\n autoSubmitArgs.push('--auto-submit');\n }\n\n const result = await spawn(\n cmd,\n [\n ...args,\n 'build:internal',\n '--platform',\n job.platform,\n '--profile',\n buildProfile,\n ...autoSubmitArgs,\n ],\n {\n cwd,\n env: {\n ...env,\n EXPO_TOKEN: nullthrows(job.secrets, 'Secrets must be defined for non-custom builds')\n .robotAccessToken,\n ...extraEnv,\n },\n logger,\n mode: PipeMode.STDERR_ONLY_AS_STDOUT,\n }\n );\n const stdout = result.stdout.toString();\n const parsed = JSON.parse(stdout);\n return validateEasBuildInternalResult({\n result: parsed,\n oldJob: job,\n });\n}\n\nexport async function resolveEnvFromBuildProfileAsync<TJob extends BuildJob>(\n ctx: BuildContext<TJob>,\n { cwd }: { cwd: string }\n): Promise<Env> {\n const { cmd, args, extraEnv } = await resolveEasCommandPrefixAndEnvAsync();\n const { buildProfile } = ctx.job;\n assert(buildProfile, 'build profile is missing in a build from git-based integration.');\n let spawnResult;\n try {\n spawnResult = await spawn(\n cmd,\n [\n ...args,\n 'config',\n '--platform',\n ctx.job.platform,\n '--profile',\n buildProfile,\n '--non-interactive',\n '--json',\n '--eas-json-only',\n ],\n {\n cwd,\n env: { ...ctx.env, ...extraEnv },\n }\n );\n } catch (err: any) {\n ctx.logger.error(`Failed to the read build profile ${buildProfile} from eas.json.`);\n ctx.logger.error(err.stderr?.toString());\n throw Error(`Failed to read the build profile ${buildProfile} from eas.json.`);\n }\n const stdout = spawnResult.stdout.toString();\n const parsed = JSON.parse(stdout);\n const env = validateEnvs(parsed.buildProfile);\n return env;\n}\n\nasync function resolveEasCommandPrefixAndEnvAsync(): Promise<{\n cmd: string;\n args: string[];\n extraEnv: Env;\n}> {\n const npxArgsPrefix = (await isAtLeastNpm7Async()) ? ['-y'] : [];\n if (process.env.ENVIRONMENT === 'development') {\n return {\n cmd: process.env.EAS_BUILD_INTERNAL_EXECUTABLE ?? `eas`,\n args: [],\n extraEnv: { EXPO_LOCAL: '1' },\n };\n } else if (process.env.ENVIRONMENT === 'staging') {\n return {\n cmd: 'npx',\n args: [...npxArgsPrefix, `eas-cli@${EAS_CLI_STAGING_NPM_TAG}`],\n extraEnv: { EXPO_STAGING: '1' },\n };\n } else {\n return {\n cmd: 'npx',\n args: [...npxArgsPrefix, `eas-cli@${EAS_CLI_PRODUCTION_NPM_TAG}`],\n extraEnv: {},\n };\n }\n}\n\nfunction validateEasBuildInternalResult<TJob extends BuildJob>({\n oldJob,\n result,\n}: {\n oldJob: TJob;\n result: any;\n}): { newJob: TJob; newMetadata: Metadata } {\n const { value, error } = EasBuildInternalResultSchema.validate(result, {\n stripUnknown: true,\n convert: true,\n abortEarly: false,\n });\n if (error) {\n throw error;\n }\n const newJob = sanitizeBuildJob({\n ...value.job,\n // We want to retain values that we have set on the job.\n appId: oldJob.appId,\n initiatingUserId: oldJob.initiatingUserId,\n }) as TJob;\n assert(newJob.platform === oldJob.platform, 'eas-cli returned a job for a wrong platform');\n const newMetadata = sanitizeMetadata(value.metadata);\n return { newJob, newMetadata };\n}\n\nfunction validateEnvs(result: any): Env {\n const { value, error } = Joi.object({\n env: Joi.object().pattern(Joi.string(), Joi.string()),\n }).validate(result, {\n stripUnknown: true,\n convert: true,\n abortEarly: false,\n });\n if (error) {\n throw error;\n }\n return value?.env;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"easBuildInternal.js","sourceRoot":"","sources":["../../src/common/easBuildInternal.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uDAAkG;AAClG,yCAAgD;AAChD,sEAAuC;AACvC,8CAAsB;AACtB,4DAAoC;AAIpC,4DAA6D;AAE7D,MAAM,uBAAuB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;AAEtD,MAAM,4BAA4B,GAAG,aAAG,CAAC,MAAM,CAAoC;IACjF,GAAG,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC3B,QAAQ,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;CACjC,CAAC,CAAC;AAEI,KAAK,UAAU,wBAAwB,CAAwB,EACpE,GAAG,EACH,MAAM,EACN,GAAG,EACH,GAAG,GAMJ;IAIC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,kCAAkC,EAAE,CAAC;IAC3E,MAAM,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,GAAG,CAAC;IACnD,IAAA,gBAAM,EAAC,YAAY,EAAE,iEAAiE,CAAC,CAAC;IAExF,MAAM,cAAc,GAAG,EAAE,CAAC;IAC1B,IAAI,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,aAAa,EAAE,CAAC;QACxC,cAAc,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAClD,cAAc,CAAC,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC1D,CAAC;SAAM,IAAI,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,UAAU,EAAE,CAAC;QAC5C,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,MAAM,CAAC;IAC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G,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,aAAG,CAAC,MAAM,EAAE,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC;KACtD,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE;QAClB,YAAY,EAAE,IAAI;QAClB,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IACH,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,KAAK,CAAC;IACd,CAAC;IACD,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,CAAC;AACpB,CAAC","sourcesContent":["import assert from 'assert';\n\nimport { BuildJob, Env, Metadata, sanitizeBuildJob, sanitizeMetadata } from '@expo/eas-build-job';\nimport { PipeMode, bunyan } from '@expo/logger';\nimport spawn from '@expo/turtle-spawn';\nimport Joi from 'joi';\nimport nullthrows from 'nullthrows';\nimport { BuildStepEnv } from '@expo/steps';\n\nimport { BuildContext } from '../context';\nimport { isAtLeastNpm7Async } from '../utils/packageManager';\n\nconst EAS_CLI_STAGING_NPM_TAG = 'latest-eas-build-staging';\nconst EAS_CLI_PRODUCTION_NPM_TAG = 'latest-eas-build';\n\nconst EasBuildInternalResultSchema = Joi.object<{ job: object; metadata: object }>({\n job: Joi.object().unknown(),\n metadata: Joi.object().unknown(),\n});\n\nexport async function runEasBuildInternalAsync<TJob extends BuildJob>({\n job,\n logger,\n env,\n cwd,\n}: {\n job: TJob;\n logger: bunyan;\n env: BuildStepEnv;\n cwd: string;\n}): Promise<{\n newJob: TJob;\n newMetadata: Metadata;\n}> {\n const { cmd, args, extraEnv } = await resolveEasCommandPrefixAndEnvAsync();\n const { buildProfile, githubTriggerOptions } = job;\n assert(buildProfile, 'build profile is missing in a build from git-based integration.');\n\n const autoSubmitArgs = [];\n if (githubTriggerOptions?.submitProfile) {\n autoSubmitArgs.push('--auto-submit-with-profile');\n autoSubmitArgs.push(githubTriggerOptions.submitProfile);\n } else if (githubTriggerOptions?.autoSubmit) {\n autoSubmitArgs.push('--auto-submit');\n }\n\n let result;\n try {\n result = await spawn(\n cmd,\n [\n ...args,\n 'build:internal',\n '--platform',\n job.platform,\n '--profile',\n buildProfile,\n ...autoSubmitArgs,\n ],\n {\n cwd,\n env: {\n ...env,\n EXPO_TOKEN: nullthrows(job.secrets, 'Secrets must be defined for non-custom builds')\n .robotAccessToken,\n ...extraEnv,\n },\n logger,\n mode: PipeMode.STDERR_ONLY_AS_STDOUT,\n }\n );\n } catch (err: any) {\n // Logging of build:internal is weird. We set mode = STDERR_ONLY_AS_STDOUT,\n // because we don't want to pipe stdout to to the logger as it will contain\n // the job object with its secrets. However, if the build fails, stderr alone\n // is often not enough to debug the issue, so we also log stdout in those cases.\n // It will look awkward (first stderr from pipe, then stdout from here), but\n // it's better than nothing.\n logger.error(`${err.stdout}`);\n throw err;\n }\n\n const stdout = result.stdout.toString();\n const parsed = JSON.parse(stdout);\n return validateEasBuildInternalResult({\n result: parsed,\n oldJob: job,\n });\n}\n\nexport async function resolveEnvFromBuildProfileAsync<TJob extends BuildJob>(\n ctx: BuildContext<TJob>,\n { cwd }: { cwd: string }\n): Promise<Env> {\n const { cmd, args, extraEnv } = await resolveEasCommandPrefixAndEnvAsync();\n const { buildProfile } = ctx.job;\n assert(buildProfile, 'build profile is missing in a build from git-based integration.');\n let spawnResult;\n try {\n spawnResult = await spawn(\n cmd,\n [\n ...args,\n 'config',\n '--platform',\n ctx.job.platform,\n '--profile',\n buildProfile,\n '--non-interactive',\n '--json',\n '--eas-json-only',\n ],\n {\n cwd,\n env: { ...ctx.env, ...extraEnv },\n }\n );\n } catch (err: any) {\n ctx.logger.error(`Failed to the read build profile ${buildProfile} from eas.json.`);\n ctx.logger.error(err.stderr?.toString());\n throw Error(`Failed to read the build profile ${buildProfile} from eas.json.`);\n }\n const stdout = spawnResult.stdout.toString();\n const parsed = JSON.parse(stdout);\n const env = validateEnvs(parsed.buildProfile);\n return env;\n}\n\nasync function resolveEasCommandPrefixAndEnvAsync(): Promise<{\n cmd: string;\n args: string[];\n extraEnv: Env;\n}> {\n const npxArgsPrefix = (await isAtLeastNpm7Async()) ? ['-y'] : [];\n if (process.env.ENVIRONMENT === 'development') {\n return {\n cmd: 'npx',\n args: [...npxArgsPrefix, `eas-cli@${EAS_CLI_STAGING_NPM_TAG}`],\n extraEnv: {},\n };\n } else if (process.env.ENVIRONMENT === 'staging') {\n return {\n cmd: 'npx',\n args: [...npxArgsPrefix, `eas-cli@${EAS_CLI_STAGING_NPM_TAG}`],\n extraEnv: { EXPO_STAGING: '1' },\n };\n } else {\n return {\n cmd: 'npx',\n args: [...npxArgsPrefix, `eas-cli@${EAS_CLI_PRODUCTION_NPM_TAG}`],\n extraEnv: {},\n };\n }\n}\n\nfunction validateEasBuildInternalResult<TJob extends BuildJob>({\n oldJob,\n result,\n}: {\n oldJob: TJob;\n result: any;\n}): { newJob: TJob; newMetadata: Metadata } {\n const { value, error } = EasBuildInternalResultSchema.validate(result, {\n stripUnknown: true,\n convert: true,\n abortEarly: false,\n });\n if (error) {\n throw error;\n }\n const newJob = sanitizeBuildJob({\n ...value.job,\n // We want to retain values that we have set on the job.\n appId: oldJob.appId,\n initiatingUserId: oldJob.initiatingUserId,\n }) as TJob;\n assert(newJob.platform === oldJob.platform, 'eas-cli returned a job for a wrong platform');\n const newMetadata = sanitizeMetadata(value.metadata);\n return { newJob, newMetadata };\n}\n\nfunction validateEnvs(result: any): Env {\n const { value, error } = Joi.object({\n env: Joi.object().pattern(Joi.string(), Joi.string()),\n }).validate(result, {\n stripUnknown: true,\n convert: true,\n abortEarly: false,\n });\n if (error) {\n throw error;\n }\n return value?.env;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DO NOT EDIT unless the same change is made in `@expo/fingerprint`
|
|
3
|
-
* The diffFingerprints function is a copy/paste from
|
|
3
|
+
* The diffFingerprints function is a copy/paste from that package.
|
|
4
4
|
*/
|
|
5
5
|
/// <reference types="node" />
|
|
6
6
|
export type FingerprintSource = HashSource & {
|
|
@@ -64,19 +64,38 @@ export interface DebugInfoContents {
|
|
|
64
64
|
hash: string;
|
|
65
65
|
}
|
|
66
66
|
export type DebugInfo = DebugInfoFile | DebugInfoDir | DebugInfoContents;
|
|
67
|
-
export
|
|
67
|
+
export type FingerprintDiffItem = {
|
|
68
68
|
/**
|
|
69
69
|
* The operation type of the diff item.
|
|
70
70
|
*/
|
|
71
|
-
op: 'added'
|
|
71
|
+
op: 'added';
|
|
72
72
|
/**
|
|
73
|
-
* The source
|
|
74
|
-
* - When type is 'added', the source is the new source.
|
|
75
|
-
* - When type is 'removed', the source is the old source.
|
|
76
|
-
* - When type is 'changed', the source is the new source.
|
|
73
|
+
* The added source.
|
|
77
74
|
*/
|
|
78
|
-
|
|
79
|
-
}
|
|
75
|
+
addedSource: FingerprintSource;
|
|
76
|
+
} | {
|
|
77
|
+
/**
|
|
78
|
+
* The operation type of the diff item.
|
|
79
|
+
*/
|
|
80
|
+
op: 'removed';
|
|
81
|
+
/**
|
|
82
|
+
* The removed source.
|
|
83
|
+
*/
|
|
84
|
+
removedSource: FingerprintSource;
|
|
85
|
+
} | {
|
|
86
|
+
/**
|
|
87
|
+
* The operation type of the diff item.
|
|
88
|
+
*/
|
|
89
|
+
op: 'changed';
|
|
90
|
+
/**
|
|
91
|
+
* The source before.
|
|
92
|
+
*/
|
|
93
|
+
beforeSource: FingerprintSource;
|
|
94
|
+
/**
|
|
95
|
+
* The source after.
|
|
96
|
+
*/
|
|
97
|
+
afterSource: FingerprintSource;
|
|
98
|
+
};
|
|
80
99
|
/**
|
|
81
100
|
* Comparator between two sources.
|
|
82
101
|
* This is useful for sorting sources in a consistent order.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* DO NOT EDIT unless the same change is made in `@expo/fingerprint`
|
|
4
|
-
* The diffFingerprints function is a copy/paste from
|
|
4
|
+
* The diffFingerprints function is a copy/paste from that package.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.stringifyFingerprintDiff = exports.diffFingerprints = exports.compareSource = void 0;
|
|
@@ -44,26 +44,26 @@ function diffFingerprints(fingerprint1, fingerprint2) {
|
|
|
44
44
|
const compareResult = compareSource(source1, source2);
|
|
45
45
|
if (compareResult === 0) {
|
|
46
46
|
if (source1.hash !== source2.hash) {
|
|
47
|
-
diff.push({ op: 'changed',
|
|
47
|
+
diff.push({ op: 'changed', beforeSource: source1, afterSource: source2 });
|
|
48
48
|
}
|
|
49
49
|
++index1;
|
|
50
50
|
++index2;
|
|
51
51
|
}
|
|
52
52
|
else if (compareResult < 0) {
|
|
53
|
-
diff.push({ op: 'removed',
|
|
53
|
+
diff.push({ op: 'removed', removedSource: source1 });
|
|
54
54
|
++index1;
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
57
|
-
diff.push({ op: 'added',
|
|
57
|
+
diff.push({ op: 'added', addedSource: source2 });
|
|
58
58
|
++index2;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
while (index1 < fingerprint1.sources.length) {
|
|
62
|
-
diff.push({ op: 'removed',
|
|
62
|
+
diff.push({ op: 'removed', removedSource: fingerprint1.sources[index1] });
|
|
63
63
|
++index1;
|
|
64
64
|
}
|
|
65
65
|
while (index2 < fingerprint2.sources.length) {
|
|
66
|
-
diff.push({ op: 'added',
|
|
66
|
+
diff.push({ op: 'added', addedSource: fingerprint2.sources[index2] });
|
|
67
67
|
++index2;
|
|
68
68
|
}
|
|
69
69
|
return diff;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fingerprint.js","sourceRoot":"","sources":["../../src/utils/fingerprint.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"fingerprint.js","sourceRoot":"","sources":["../../src/utils/fingerprint.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAiHH,MAAM,SAAS,GAAG;IAChB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O,IAAI,CAAC;AACd,CAAC;AAtCD,4CAsCC;AAED,SAAgB,wBAAwB,CAAC,eAAsC;IAC7E,OAAO,IAAI,CAAC,SAAS,CACnB,eAAe,EACf,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACb,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;YACvB,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAC/B,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,EACD,GAAG,CACJ,CAAC;AACJ,CAAC;AAhBD,4DAgBC","sourcesContent":["/**\n * DO NOT EDIT unless the same change is made in `@expo/fingerprint`\n * The diffFingerprints function is a copy/paste from that package.\n */\n\nexport type FingerprintSource = HashSource & {\n /**\n * Hash value of the `source`.\n * If the source is excluding by `Options.dirExcludes`, the value will be null.\n */\n hash: string | null;\n /**\n * Debug info from the hashing process. Differs based on source type. Designed to be consumed by humans\n * as opposed to programmatically.\n */\n debugInfo?: DebugInfo;\n};\n\nexport interface Fingerprint {\n /**\n * Sources and their hash values to generate a fingerprint\n */\n sources: FingerprintSource[];\n\n /**\n * The final hash value of the whole fingerprint\n */\n hash: string;\n}\n\nexport interface HashSourceFile {\n type: 'file';\n filePath: string;\n\n /**\n * Reasons of this source coming from\n */\n reasons: string[];\n}\n\nexport interface HashSourceDir {\n type: 'dir';\n filePath: string;\n\n /**\n * Reasons of this source coming from\n */\n reasons: string[];\n}\n\nexport interface HashSourceContents {\n type: 'contents';\n id: string;\n contents: string | Buffer;\n\n /**\n * Reasons of this source coming from\n */\n reasons: string[];\n}\n\nexport type HashSource = HashSourceFile | HashSourceDir | HashSourceContents;\n\nexport interface DebugInfoFile {\n path: string;\n hash: string;\n}\n\nexport interface DebugInfoDir {\n path: string;\n hash: string;\n children: (DebugInfoFile | DebugInfoDir | undefined)[];\n}\n\nexport interface DebugInfoContents {\n hash: string;\n}\n\nexport type DebugInfo = DebugInfoFile | DebugInfoDir | DebugInfoContents;\n\nexport type FingerprintDiffItem =\n | {\n /**\n * The operation type of the diff item.\n */\n op: 'added';\n /**\n * The added source.\n */\n addedSource: FingerprintSource;\n }\n | {\n /**\n * The operation type of the diff item.\n */\n op: 'removed';\n /**\n * The removed source.\n */\n removedSource: FingerprintSource;\n }\n | {\n /**\n * The operation type of the diff item.\n */\n op: 'changed';\n /**\n * The source before.\n */\n beforeSource: FingerprintSource;\n /**\n * The source after.\n */\n afterSource: FingerprintSource;\n };\n\nconst typeOrder = {\n file: 0,\n dir: 1,\n contents: 2,\n};\n\n/**\n * Comparator between two sources.\n * This is useful for sorting sources in a consistent order.\n * @returns:\n * == 0 if a and b are equal,\n * < 0 if a is less than b,\n * > 0 if a is greater than b.\n */\nexport function compareSource(a: HashSource, b: HashSource): number {\n const typeResult = typeOrder[a.type] - typeOrder[b.type];\n if (typeResult === 0) {\n if (a.type === 'file' && b.type === 'file') {\n return a.filePath.localeCompare(b.filePath);\n } else if (a.type === 'dir' && b.type === 'dir') {\n return a.filePath.localeCompare(b.filePath);\n } else if (a.type === 'contents' && b.type === 'contents') {\n return a.id.localeCompare(b.id);\n }\n }\n return typeResult;\n}\n\nexport function diffFingerprints(\n fingerprint1: Fingerprint,\n fingerprint2: Fingerprint\n): FingerprintDiffItem[] {\n let index1 = 0;\n let index2 = 0;\n const diff: FingerprintDiffItem[] = [];\n\n while (index1 < fingerprint1.sources.length && index2 < fingerprint2.sources.length) {\n const source1 = fingerprint1.sources[index1];\n const source2 = fingerprint2.sources[index2];\n\n const compareResult = compareSource(source1, source2);\n if (compareResult === 0) {\n if (source1.hash !== source2.hash) {\n diff.push({ op: 'changed', beforeSource: source1, afterSource: source2 });\n }\n ++index1;\n ++index2;\n } else if (compareResult < 0) {\n diff.push({ op: 'removed', removedSource: source1 });\n ++index1;\n } else {\n diff.push({ op: 'added', addedSource: source2 });\n ++index2;\n }\n }\n\n while (index1 < fingerprint1.sources.length) {\n diff.push({ op: 'removed', removedSource: fingerprint1.sources[index1] });\n ++index1;\n }\n while (index2 < fingerprint2.sources.length) {\n diff.push({ op: 'added', addedSource: fingerprint2.sources[index2] });\n ++index2;\n }\n\n return diff;\n}\n\nexport function stringifyFingerprintDiff(fingerprintDiff: FingerprintDiffItem[]): string {\n return JSON.stringify(\n fingerprintDiff,\n (key, value) => {\n if (key === 'contents') {\n try {\n const item = JSON.parse(value);\n return item;\n } catch {\n return value;\n }\n }\n return value;\n },\n ' '\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/build-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.146",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"node": "20.14.0",
|
|
71
71
|
"yarn": "1.22.21"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "8a433571b4804c2470866557553146769c8f5160"
|
|
74
74
|
}
|