MCPcopy Index your code
hub / github.com/ampproject/amphtml / getEnvironmentHash

Function getEnvironmentHash

build-system/tasks/css/jsify-css.js:53–66  ·  view source on GitHub ↗

@return {Promise }

()

Source from the content-addressed store, hash-verified

51
52/** @return {Promise<string>} */
53function getEnvironmentHash() {
54 if (environmentHash) {
55 return environmentHash;
56 }
57
58 // We want to set environmentHash to a promise synchronously s.t.
59 // we never end up with multiple calculations at the same time.
60 environmentHash = Promise.resolve().then(async () => {
61 const packageJsonHash = md5(await fs.promises.readFile(packageJsonPath));
62 const cssOptions = JSON.stringify({cssNanoDefaultOptions, browsersList});
63 return md5(packageJsonHash, cssOptions);
64 });
65 return environmentHash;
66}
67
68/**
69 * @typedef {{css: string, warnings: string[]}}:

Callers 1

jsifyCssAsyncFunction · 0.85

Calls 4

md5Function · 0.85
resolveMethod · 0.80
stringifyMethod · 0.80
thenMethod · 0.45

Tested by

no test coverage detected