mirror of https://github.com/actions/setup-node
Update memoization to lodash implementation
This commit is contained in:
parent
5e21ff4d9b
commit
d5f102c3e3
|
@ -6,8 +6,7 @@ import {
|
||||||
PackageManagerInfo,
|
PackageManagerInfo,
|
||||||
isCacheFeatureAvailable,
|
isCacheFeatureAvailable,
|
||||||
supportedPackageManagers,
|
supportedPackageManagers,
|
||||||
getCommandOutput,
|
getProjectDirectoriesFromCacheDependencyPath
|
||||||
resetProjectDirectoriesMemoized
|
|
||||||
} from '../src/cache-utils';
|
} from '../src/cache-utils';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import * as cacheUtils from '../src/cache-utils';
|
import * as cacheUtils from '../src/cache-utils';
|
||||||
|
@ -123,7 +122,7 @@ describe('cache-utils', () => {
|
||||||
MockGlobber.create(['/foo', '/bar'])
|
MockGlobber.create(['/foo', '/bar'])
|
||||||
);
|
);
|
||||||
|
|
||||||
resetProjectDirectoriesMemoized();
|
getProjectDirectoriesFromCacheDependencyPath.cache.clear?.();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
|
|
@ -46782,6 +46782,689 @@ DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 4538:
|
||||||
|
/***/ ((module) => {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* lodash (Custom Build) <https://lodash.com/>
|
||||||
|
* Build: `lodash modularize exports="npm" -o ./`
|
||||||
|
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||||
|
* Released under MIT license <https://lodash.com/license>
|
||||||
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||||
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Used as the `TypeError` message for "Functions" methods. */
|
||||||
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||||
|
|
||||||
|
/** Used to stand-in for `undefined` hash values. */
|
||||||
|
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
||||||
|
|
||||||
|
/** `Object#toString` result references. */
|
||||||
|
var funcTag = '[object Function]',
|
||||||
|
genTag = '[object GeneratorFunction]';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to match `RegExp`
|
||||||
|
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
||||||
|
*/
|
||||||
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
||||||
|
|
||||||
|
/** Used to detect host constructors (Safari). */
|
||||||
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
||||||
|
|
||||||
|
/** Detect free variable `global` from Node.js. */
|
||||||
|
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
||||||
|
|
||||||
|
/** Detect free variable `self`. */
|
||||||
|
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
||||||
|
|
||||||
|
/** Used as a reference to the global object. */
|
||||||
|
var root = freeGlobal || freeSelf || Function('return this')();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value at `key` of `object`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} [object] The object to query.
|
||||||
|
* @param {string} key The key of the property to get.
|
||||||
|
* @returns {*} Returns the property value.
|
||||||
|
*/
|
||||||
|
function getValue(object, key) {
|
||||||
|
return object == null ? undefined : object[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if `value` is a host object in IE < 9.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to check.
|
||||||
|
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
||||||
|
*/
|
||||||
|
function isHostObject(value) {
|
||||||
|
// Many host objects are `Object` objects that can coerce to strings
|
||||||
|
// despite having improperly defined `toString` methods.
|
||||||
|
var result = false;
|
||||||
|
if (value != null && typeof value.toString != 'function') {
|
||||||
|
try {
|
||||||
|
result = !!(value + '');
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Used for built-in method references. */
|
||||||
|
var arrayProto = Array.prototype,
|
||||||
|
funcProto = Function.prototype,
|
||||||
|
objectProto = Object.prototype;
|
||||||
|
|
||||||
|
/** Used to detect overreaching core-js shims. */
|
||||||
|
var coreJsData = root['__core-js_shared__'];
|
||||||
|
|
||||||
|
/** Used to detect methods masquerading as native. */
|
||||||
|
var maskSrcKey = (function() {
|
||||||
|
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
||||||
|
return uid ? ('Symbol(src)_1.' + uid) : '';
|
||||||
|
}());
|
||||||
|
|
||||||
|
/** Used to resolve the decompiled source of functions. */
|
||||||
|
var funcToString = funcProto.toString;
|
||||||
|
|
||||||
|
/** Used to check objects for own properties. */
|
||||||
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to resolve the
|
||||||
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||||
|
* of values.
|
||||||
|
*/
|
||||||
|
var objectToString = objectProto.toString;
|
||||||
|
|
||||||
|
/** Used to detect if a method is native. */
|
||||||
|
var reIsNative = RegExp('^' +
|
||||||
|
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
||||||
|
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Built-in value references. */
|
||||||
|
var splice = arrayProto.splice;
|
||||||
|
|
||||||
|
/* Built-in method references that are verified to be native. */
|
||||||
|
var Map = getNative(root, 'Map'),
|
||||||
|
nativeCreate = getNative(Object, 'create');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a hash object.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @constructor
|
||||||
|
* @param {Array} [entries] The key-value pairs to cache.
|
||||||
|
*/
|
||||||
|
function Hash(entries) {
|
||||||
|
var index = -1,
|
||||||
|
length = entries ? entries.length : 0;
|
||||||
|
|
||||||
|
this.clear();
|
||||||
|
while (++index < length) {
|
||||||
|
var entry = entries[index];
|
||||||
|
this.set(entry[0], entry[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all key-value entries from the hash.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name clear
|
||||||
|
* @memberOf Hash
|
||||||
|
*/
|
||||||
|
function hashClear() {
|
||||||
|
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes `key` and its value from the hash.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name delete
|
||||||
|
* @memberOf Hash
|
||||||
|
* @param {Object} hash The hash to modify.
|
||||||
|
* @param {string} key The key of the value to remove.
|
||||||
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||||||
|
*/
|
||||||
|
function hashDelete(key) {
|
||||||
|
return this.has(key) && delete this.__data__[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the hash value for `key`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name get
|
||||||
|
* @memberOf Hash
|
||||||
|
* @param {string} key The key of the value to get.
|
||||||
|
* @returns {*} Returns the entry value.
|
||||||
|
*/
|
||||||
|
function hashGet(key) {
|
||||||
|
var data = this.__data__;
|
||||||
|
if (nativeCreate) {
|
||||||
|
var result = data[key];
|
||||||
|
return result === HASH_UNDEFINED ? undefined : result;
|
||||||
|
}
|
||||||
|
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a hash value for `key` exists.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name has
|
||||||
|
* @memberOf Hash
|
||||||
|
* @param {string} key The key of the entry to check.
|
||||||
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||||||
|
*/
|
||||||
|
function hashHas(key) {
|
||||||
|
var data = this.__data__;
|
||||||
|
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the hash `key` to `value`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name set
|
||||||
|
* @memberOf Hash
|
||||||
|
* @param {string} key The key of the value to set.
|
||||||
|
* @param {*} value The value to set.
|
||||||
|
* @returns {Object} Returns the hash instance.
|
||||||
|
*/
|
||||||
|
function hashSet(key, value) {
|
||||||
|
var data = this.__data__;
|
||||||
|
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add methods to `Hash`.
|
||||||
|
Hash.prototype.clear = hashClear;
|
||||||
|
Hash.prototype['delete'] = hashDelete;
|
||||||
|
Hash.prototype.get = hashGet;
|
||||||
|
Hash.prototype.has = hashHas;
|
||||||
|
Hash.prototype.set = hashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an list cache object.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @constructor
|
||||||
|
* @param {Array} [entries] The key-value pairs to cache.
|
||||||
|
*/
|
||||||
|
function ListCache(entries) {
|
||||||
|
var index = -1,
|
||||||
|
length = entries ? entries.length : 0;
|
||||||
|
|
||||||
|
this.clear();
|
||||||
|
while (++index < length) {
|
||||||
|
var entry = entries[index];
|
||||||
|
this.set(entry[0], entry[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all key-value entries from the list cache.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name clear
|
||||||
|
* @memberOf ListCache
|
||||||
|
*/
|
||||||
|
function listCacheClear() {
|
||||||
|
this.__data__ = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes `key` and its value from the list cache.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name delete
|
||||||
|
* @memberOf ListCache
|
||||||
|
* @param {string} key The key of the value to remove.
|
||||||
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||||||
|
*/
|
||||||
|
function listCacheDelete(key) {
|
||||||
|
var data = this.__data__,
|
||||||
|
index = assocIndexOf(data, key);
|
||||||
|
|
||||||
|
if (index < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var lastIndex = data.length - 1;
|
||||||
|
if (index == lastIndex) {
|
||||||
|
data.pop();
|
||||||
|
} else {
|
||||||
|
splice.call(data, index, 1);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list cache value for `key`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name get
|
||||||
|
* @memberOf ListCache
|
||||||
|
* @param {string} key The key of the value to get.
|
||||||
|
* @returns {*} Returns the entry value.
|
||||||
|
*/
|
||||||
|
function listCacheGet(key) {
|
||||||
|
var data = this.__data__,
|
||||||
|
index = assocIndexOf(data, key);
|
||||||
|
|
||||||
|
return index < 0 ? undefined : data[index][1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a list cache value for `key` exists.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name has
|
||||||
|
* @memberOf ListCache
|
||||||
|
* @param {string} key The key of the entry to check.
|
||||||
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||||||
|
*/
|
||||||
|
function listCacheHas(key) {
|
||||||
|
return assocIndexOf(this.__data__, key) > -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the list cache `key` to `value`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name set
|
||||||
|
* @memberOf ListCache
|
||||||
|
* @param {string} key The key of the value to set.
|
||||||
|
* @param {*} value The value to set.
|
||||||
|
* @returns {Object} Returns the list cache instance.
|
||||||
|
*/
|
||||||
|
function listCacheSet(key, value) {
|
||||||
|
var data = this.__data__,
|
||||||
|
index = assocIndexOf(data, key);
|
||||||
|
|
||||||
|
if (index < 0) {
|
||||||
|
data.push([key, value]);
|
||||||
|
} else {
|
||||||
|
data[index][1] = value;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add methods to `ListCache`.
|
||||||
|
ListCache.prototype.clear = listCacheClear;
|
||||||
|
ListCache.prototype['delete'] = listCacheDelete;
|
||||||
|
ListCache.prototype.get = listCacheGet;
|
||||||
|
ListCache.prototype.has = listCacheHas;
|
||||||
|
ListCache.prototype.set = listCacheSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a map cache object to store key-value pairs.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @constructor
|
||||||
|
* @param {Array} [entries] The key-value pairs to cache.
|
||||||
|
*/
|
||||||
|
function MapCache(entries) {
|
||||||
|
var index = -1,
|
||||||
|
length = entries ? entries.length : 0;
|
||||||
|
|
||||||
|
this.clear();
|
||||||
|
while (++index < length) {
|
||||||
|
var entry = entries[index];
|
||||||
|
this.set(entry[0], entry[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all key-value entries from the map.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name clear
|
||||||
|
* @memberOf MapCache
|
||||||
|
*/
|
||||||
|
function mapCacheClear() {
|
||||||
|
this.__data__ = {
|
||||||
|
'hash': new Hash,
|
||||||
|
'map': new (Map || ListCache),
|
||||||
|
'string': new Hash
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes `key` and its value from the map.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name delete
|
||||||
|
* @memberOf MapCache
|
||||||
|
* @param {string} key The key of the value to remove.
|
||||||
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||||||
|
*/
|
||||||
|
function mapCacheDelete(key) {
|
||||||
|
return getMapData(this, key)['delete'](key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the map value for `key`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name get
|
||||||
|
* @memberOf MapCache
|
||||||
|
* @param {string} key The key of the value to get.
|
||||||
|
* @returns {*} Returns the entry value.
|
||||||
|
*/
|
||||||
|
function mapCacheGet(key) {
|
||||||
|
return getMapData(this, key).get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a map value for `key` exists.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name has
|
||||||
|
* @memberOf MapCache
|
||||||
|
* @param {string} key The key of the entry to check.
|
||||||
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||||||
|
*/
|
||||||
|
function mapCacheHas(key) {
|
||||||
|
return getMapData(this, key).has(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the map `key` to `value`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name set
|
||||||
|
* @memberOf MapCache
|
||||||
|
* @param {string} key The key of the value to set.
|
||||||
|
* @param {*} value The value to set.
|
||||||
|
* @returns {Object} Returns the map cache instance.
|
||||||
|
*/
|
||||||
|
function mapCacheSet(key, value) {
|
||||||
|
getMapData(this, key).set(key, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add methods to `MapCache`.
|
||||||
|
MapCache.prototype.clear = mapCacheClear;
|
||||||
|
MapCache.prototype['delete'] = mapCacheDelete;
|
||||||
|
MapCache.prototype.get = mapCacheGet;
|
||||||
|
MapCache.prototype.has = mapCacheHas;
|
||||||
|
MapCache.prototype.set = mapCacheSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Array} array The array to inspect.
|
||||||
|
* @param {*} key The key to search for.
|
||||||
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||||
|
*/
|
||||||
|
function assocIndexOf(array, key) {
|
||||||
|
var length = array.length;
|
||||||
|
while (length--) {
|
||||||
|
if (eq(array[length][0], key)) {
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.isNative` without bad shim checks.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to check.
|
||||||
|
* @returns {boolean} Returns `true` if `value` is a native function,
|
||||||
|
* else `false`.
|
||||||
|
*/
|
||||||
|
function baseIsNative(value) {
|
||||||
|
if (!isObject(value) || isMasked(value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
||||||
|
return pattern.test(toSource(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the data for `map`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} map The map to query.
|
||||||
|
* @param {string} key The reference key.
|
||||||
|
* @returns {*} Returns the map data.
|
||||||
|
*/
|
||||||
|
function getMapData(map, key) {
|
||||||
|
var data = map.__data__;
|
||||||
|
return isKeyable(key)
|
||||||
|
? data[typeof key == 'string' ? 'string' : 'hash']
|
||||||
|
: data.map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the native function at `key` of `object`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} object The object to query.
|
||||||
|
* @param {string} key The key of the method to get.
|
||||||
|
* @returns {*} Returns the function if it's native, else `undefined`.
|
||||||
|
*/
|
||||||
|
function getNative(object, key) {
|
||||||
|
var value = getValue(object, key);
|
||||||
|
return baseIsNative(value) ? value : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if `value` is suitable for use as unique object key.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to check.
|
||||||
|
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
||||||
|
*/
|
||||||
|
function isKeyable(value) {
|
||||||
|
var type = typeof value;
|
||||||
|
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
||||||
|
? (value !== '__proto__')
|
||||||
|
: (value === null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if `func` has its source masked.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Function} func The function to check.
|
||||||
|
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
||||||
|
*/
|
||||||
|
function isMasked(func) {
|
||||||
|
return !!maskSrcKey && (maskSrcKey in func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts `func` to its source code.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Function} func The function to process.
|
||||||
|
* @returns {string} Returns the source code.
|
||||||
|
*/
|
||||||
|
function toSource(func) {
|
||||||
|
if (func != null) {
|
||||||
|
try {
|
||||||
|
return funcToString.call(func);
|
||||||
|
} catch (e) {}
|
||||||
|
try {
|
||||||
|
return (func + '');
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a function that memoizes the result of `func`. If `resolver` is
|
||||||
|
* provided, it determines the cache key for storing the result based on the
|
||||||
|
* arguments provided to the memoized function. By default, the first argument
|
||||||
|
* provided to the memoized function is used as the map cache key. The `func`
|
||||||
|
* is invoked with the `this` binding of the memoized function.
|
||||||
|
*
|
||||||
|
* **Note:** The cache is exposed as the `cache` property on the memoized
|
||||||
|
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
||||||
|
* constructor with one whose instances implement the
|
||||||
|
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
||||||
|
* method interface of `delete`, `get`, `has`, and `set`.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @memberOf _
|
||||||
|
* @since 0.1.0
|
||||||
|
* @category Function
|
||||||
|
* @param {Function} func The function to have its output memoized.
|
||||||
|
* @param {Function} [resolver] The function to resolve the cache key.
|
||||||
|
* @returns {Function} Returns the new memoized function.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var object = { 'a': 1, 'b': 2 };
|
||||||
|
* var other = { 'c': 3, 'd': 4 };
|
||||||
|
*
|
||||||
|
* var values = _.memoize(_.values);
|
||||||
|
* values(object);
|
||||||
|
* // => [1, 2]
|
||||||
|
*
|
||||||
|
* values(other);
|
||||||
|
* // => [3, 4]
|
||||||
|
*
|
||||||
|
* object.a = 2;
|
||||||
|
* values(object);
|
||||||
|
* // => [1, 2]
|
||||||
|
*
|
||||||
|
* // Modify the result cache.
|
||||||
|
* values.cache.set(object, ['a', 'b']);
|
||||||
|
* values(object);
|
||||||
|
* // => ['a', 'b']
|
||||||
|
*
|
||||||
|
* // Replace `_.memoize.Cache`.
|
||||||
|
* _.memoize.Cache = WeakMap;
|
||||||
|
*/
|
||||||
|
function memoize(func, resolver) {
|
||||||
|
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
|
||||||
|
throw new TypeError(FUNC_ERROR_TEXT);
|
||||||
|
}
|
||||||
|
var memoized = function() {
|
||||||
|
var args = arguments,
|
||||||
|
key = resolver ? resolver.apply(this, args) : args[0],
|
||||||
|
cache = memoized.cache;
|
||||||
|
|
||||||
|
if (cache.has(key)) {
|
||||||
|
return cache.get(key);
|
||||||
|
}
|
||||||
|
var result = func.apply(this, args);
|
||||||
|
memoized.cache = cache.set(key, result);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
memoized.cache = new (memoize.Cache || MapCache);
|
||||||
|
return memoized;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assign cache to `_.memoize`.
|
||||||
|
memoize.Cache = MapCache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a
|
||||||
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||||
|
* comparison between two values to determine if they are equivalent.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @memberOf _
|
||||||
|
* @since 4.0.0
|
||||||
|
* @category Lang
|
||||||
|
* @param {*} value The value to compare.
|
||||||
|
* @param {*} other The other value to compare.
|
||||||
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var object = { 'a': 1 };
|
||||||
|
* var other = { 'a': 1 };
|
||||||
|
*
|
||||||
|
* _.eq(object, object);
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* _.eq(object, other);
|
||||||
|
* // => false
|
||||||
|
*
|
||||||
|
* _.eq('a', 'a');
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* _.eq('a', Object('a'));
|
||||||
|
* // => false
|
||||||
|
*
|
||||||
|
* _.eq(NaN, NaN);
|
||||||
|
* // => true
|
||||||
|
*/
|
||||||
|
function eq(value, other) {
|
||||||
|
return value === other || (value !== value && other !== other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if `value` is classified as a `Function` object.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @memberOf _
|
||||||
|
* @since 0.1.0
|
||||||
|
* @category Lang
|
||||||
|
* @param {*} value The value to check.
|
||||||
|
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* _.isFunction(_);
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* _.isFunction(/abc/);
|
||||||
|
* // => false
|
||||||
|
*/
|
||||||
|
function isFunction(value) {
|
||||||
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
||||||
|
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
||||||
|
var tag = isObject(value) ? objectToString.call(value) : '';
|
||||||
|
return tag == funcTag || tag == genTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if `value` is the
|
||||||
|
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
||||||
|
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @memberOf _
|
||||||
|
* @since 0.1.0
|
||||||
|
* @category Lang
|
||||||
|
* @param {*} value The value to check.
|
||||||
|
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* _.isObject({});
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* _.isObject([1, 2, 3]);
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* _.isObject(_.noop);
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* _.isObject(null);
|
||||||
|
* // => false
|
||||||
|
*/
|
||||||
|
function isObject(value) {
|
||||||
|
var type = typeof value;
|
||||||
|
return !!value && (type == 'object' || type == 'function');
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = memoize;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 7426:
|
/***/ 7426:
|
||||||
|
@ -60453,11 +61136,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.isCacheFeatureAvailable = exports.isGhes = exports.repoHasYarnBerryManagedDependencies = exports.getCacheDirectories = exports.resetProjectDirectoriesMemoized = exports.getPackageManagerInfo = exports.getCommandOutputNotEmpty = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
|
exports.isCacheFeatureAvailable = exports.isGhes = exports.repoHasYarnBerryManagedDependencies = exports.getCacheDirectories = exports.getProjectDirectoriesFromCacheDependencyPath = exports.getPackageManagerInfo = exports.getCommandOutputNotEmpty = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const exec = __importStar(__nccwpck_require__(1514));
|
const exec = __importStar(__nccwpck_require__(1514));
|
||||||
const cache = __importStar(__nccwpck_require__(7799));
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
const glob = __importStar(__nccwpck_require__(8090));
|
const glob = __importStar(__nccwpck_require__(8090));
|
||||||
|
const lodash_memoize_1 = __importDefault(__nccwpck_require__(4538));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
const util_1 = __nccwpck_require__(2629);
|
const util_1 = __nccwpck_require__(2629);
|
||||||
|
@ -60523,29 +61207,20 @@ const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void
|
||||||
});
|
});
|
||||||
exports.getPackageManagerInfo = getPackageManagerInfo;
|
exports.getPackageManagerInfo = getPackageManagerInfo;
|
||||||
/**
|
/**
|
||||||
|
* Expands (converts) the string input `cache-dependency-path` to list of directories that
|
||||||
|
* may be project roots
|
||||||
|
*
|
||||||
* getProjectDirectoriesFromCacheDependencyPath is called twice during `restoreCache`
|
* getProjectDirectoriesFromCacheDependencyPath is called twice during `restoreCache`
|
||||||
* - first through `getCacheDirectories`
|
* - first through `getCacheDirectories`
|
||||||
* - second from `repoHasYarn3ManagedCache`
|
* - second from `repoHasYarn3ManagedCache`
|
||||||
*
|
*
|
||||||
* it contains expensive IO operation and thus should be memoized
|
* it contains expensive IO operation and thus should be memoized
|
||||||
*/
|
*
|
||||||
let projectDirectoriesMemoized = null;
|
|
||||||
/**
|
|
||||||
* unit test must reset memoized variables
|
|
||||||
*/
|
|
||||||
const resetProjectDirectoriesMemoized = () => (projectDirectoriesMemoized = null);
|
|
||||||
exports.resetProjectDirectoriesMemoized = resetProjectDirectoriesMemoized;
|
|
||||||
/**
|
|
||||||
* Expands (converts) the string input `cache-dependency-path` to list of directories that
|
|
||||||
* may be project roots
|
|
||||||
* @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
|
* @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
|
||||||
* expected to be the result of `core.getInput('cache-dependency-path')`
|
* expected to be the result of `core.getInput('cache-dependency-path')`
|
||||||
* @return list of directories and possible
|
* @return list of directories and possible
|
||||||
*/
|
*/
|
||||||
const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getProjectDirectoriesFromCacheDependencyPath = lodash_memoize_1.default((cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
if (projectDirectoriesMemoized !== null) {
|
|
||||||
return projectDirectoriesMemoized;
|
|
||||||
}
|
|
||||||
const globber = yield glob.create(cacheDependencyPath);
|
const globber = yield glob.create(cacheDependencyPath);
|
||||||
const cacheDependenciesPaths = yield globber.glob();
|
const cacheDependenciesPaths = yield globber.glob();
|
||||||
const existingDirectories = cacheDependenciesPaths
|
const existingDirectories = cacheDependenciesPaths
|
||||||
|
@ -60555,9 +61230,8 @@ const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __
|
||||||
.filter(directory => fs_1.default.lstatSync(directory).isDirectory());
|
.filter(directory => fs_1.default.lstatSync(directory).isDirectory());
|
||||||
if (!existingDirectories.length)
|
if (!existingDirectories.length)
|
||||||
core.warning(`No existing directories found containing cache-dependency-path="${cacheDependencyPath}"`);
|
core.warning(`No existing directories found containing cache-dependency-path="${cacheDependencyPath}"`);
|
||||||
projectDirectoriesMemoized = existingDirectories;
|
|
||||||
return existingDirectories;
|
return existingDirectories;
|
||||||
});
|
}));
|
||||||
/**
|
/**
|
||||||
* Finds the cache directories configured for the repo if cache-dependency-path is not empty
|
* Finds the cache directories configured for the repo if cache-dependency-path is not empty
|
||||||
* @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM
|
* @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM
|
||||||
|
@ -60566,7 +61240,7 @@ const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __
|
||||||
* @return list of files on which the cache depends
|
* @return list of files on which the cache depends
|
||||||
*/
|
*/
|
||||||
const getCacheDirectoriesFromCacheDependencyPath = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
const getCacheDirectoriesFromCacheDependencyPath = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const projectDirectories = yield getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath);
|
const projectDirectories = yield exports.getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath);
|
||||||
const cacheFoldersPaths = yield Promise.all(projectDirectories.map((projectDirectory) => __awaiter(void 0, void 0, void 0, function* () {
|
const cacheFoldersPaths = yield Promise.all(projectDirectories.map((projectDirectory) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const cacheFolderPath = yield packageManagerInfo.getCacheFolderPath(projectDirectory);
|
const cacheFolderPath = yield packageManagerInfo.getCacheFolderPath(projectDirectory);
|
||||||
core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the directory "${projectDirectory}"`);
|
core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the directory "${projectDirectory}"`);
|
||||||
|
@ -60646,7 +61320,7 @@ const repoHasYarnBerryManagedDependencies = (packageManagerInfo, cacheDependency
|
||||||
if (packageManagerInfo.name !== 'yarn')
|
if (packageManagerInfo.name !== 'yarn')
|
||||||
return false;
|
return false;
|
||||||
const yarnDirs = cacheDependencyPath
|
const yarnDirs = cacheDependencyPath
|
||||||
? yield getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath)
|
? yield exports.getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath)
|
||||||
: [''];
|
: [''];
|
||||||
const isManagedList = yield Promise.all(yarnDirs.map(projectHasYarnBerryManagedDependencies));
|
const isManagedList = yield Promise.all(yarnDirs.map(projectHasYarnBerryManagedDependencies));
|
||||||
return isManagedList.every(Boolean);
|
return isManagedList.every(Boolean);
|
||||||
|
|
|
@ -54380,6 +54380,689 @@ function get(object, path, defaultValue) {
|
||||||
module.exports = get;
|
module.exports = get;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 4538:
|
||||||
|
/***/ ((module) => {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* lodash (Custom Build) <https://lodash.com/>
|
||||||
|
* Build: `lodash modularize exports="npm" -o ./`
|
||||||
|
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||||
|
* Released under MIT license <https://lodash.com/license>
|
||||||
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||||
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Used as the `TypeError` message for "Functions" methods. */
|
||||||
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||||
|
|
||||||
|
/** Used to stand-in for `undefined` hash values. */
|
||||||
|
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
||||||
|
|
||||||
|
/** `Object#toString` result references. */
|
||||||
|
var funcTag = '[object Function]',
|
||||||
|
genTag = '[object GeneratorFunction]';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to match `RegExp`
|
||||||
|
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
||||||
|
*/
|
||||||
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
||||||
|
|
||||||
|
/** Used to detect host constructors (Safari). */
|
||||||
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
||||||
|
|
||||||
|
/** Detect free variable `global` from Node.js. */
|
||||||
|
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
||||||
|
|
||||||
|
/** Detect free variable `self`. */
|
||||||
|
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
||||||
|
|
||||||
|
/** Used as a reference to the global object. */
|
||||||
|
var root = freeGlobal || freeSelf || Function('return this')();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value at `key` of `object`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} [object] The object to query.
|
||||||
|
* @param {string} key The key of the property to get.
|
||||||
|
* @returns {*} Returns the property value.
|
||||||
|
*/
|
||||||
|
function getValue(object, key) {
|
||||||
|
return object == null ? undefined : object[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if `value` is a host object in IE < 9.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to check.
|
||||||
|
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
||||||
|
*/
|
||||||
|
function isHostObject(value) {
|
||||||
|
// Many host objects are `Object` objects that can coerce to strings
|
||||||
|
// despite having improperly defined `toString` methods.
|
||||||
|
var result = false;
|
||||||
|
if (value != null && typeof value.toString != 'function') {
|
||||||
|
try {
|
||||||
|
result = !!(value + '');
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Used for built-in method references. */
|
||||||
|
var arrayProto = Array.prototype,
|
||||||
|
funcProto = Function.prototype,
|
||||||
|
objectProto = Object.prototype;
|
||||||
|
|
||||||
|
/** Used to detect overreaching core-js shims. */
|
||||||
|
var coreJsData = root['__core-js_shared__'];
|
||||||
|
|
||||||
|
/** Used to detect methods masquerading as native. */
|
||||||
|
var maskSrcKey = (function() {
|
||||||
|
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
||||||
|
return uid ? ('Symbol(src)_1.' + uid) : '';
|
||||||
|
}());
|
||||||
|
|
||||||
|
/** Used to resolve the decompiled source of functions. */
|
||||||
|
var funcToString = funcProto.toString;
|
||||||
|
|
||||||
|
/** Used to check objects for own properties. */
|
||||||
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to resolve the
|
||||||
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||||
|
* of values.
|
||||||
|
*/
|
||||||
|
var objectToString = objectProto.toString;
|
||||||
|
|
||||||
|
/** Used to detect if a method is native. */
|
||||||
|
var reIsNative = RegExp('^' +
|
||||||
|
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
||||||
|
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Built-in value references. */
|
||||||
|
var splice = arrayProto.splice;
|
||||||
|
|
||||||
|
/* Built-in method references that are verified to be native. */
|
||||||
|
var Map = getNative(root, 'Map'),
|
||||||
|
nativeCreate = getNative(Object, 'create');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a hash object.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @constructor
|
||||||
|
* @param {Array} [entries] The key-value pairs to cache.
|
||||||
|
*/
|
||||||
|
function Hash(entries) {
|
||||||
|
var index = -1,
|
||||||
|
length = entries ? entries.length : 0;
|
||||||
|
|
||||||
|
this.clear();
|
||||||
|
while (++index < length) {
|
||||||
|
var entry = entries[index];
|
||||||
|
this.set(entry[0], entry[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all key-value entries from the hash.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name clear
|
||||||
|
* @memberOf Hash
|
||||||
|
*/
|
||||||
|
function hashClear() {
|
||||||
|
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes `key` and its value from the hash.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name delete
|
||||||
|
* @memberOf Hash
|
||||||
|
* @param {Object} hash The hash to modify.
|
||||||
|
* @param {string} key The key of the value to remove.
|
||||||
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||||||
|
*/
|
||||||
|
function hashDelete(key) {
|
||||||
|
return this.has(key) && delete this.__data__[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the hash value for `key`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name get
|
||||||
|
* @memberOf Hash
|
||||||
|
* @param {string} key The key of the value to get.
|
||||||
|
* @returns {*} Returns the entry value.
|
||||||
|
*/
|
||||||
|
function hashGet(key) {
|
||||||
|
var data = this.__data__;
|
||||||
|
if (nativeCreate) {
|
||||||
|
var result = data[key];
|
||||||
|
return result === HASH_UNDEFINED ? undefined : result;
|
||||||
|
}
|
||||||
|
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a hash value for `key` exists.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name has
|
||||||
|
* @memberOf Hash
|
||||||
|
* @param {string} key The key of the entry to check.
|
||||||
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||||||
|
*/
|
||||||
|
function hashHas(key) {
|
||||||
|
var data = this.__data__;
|
||||||
|
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the hash `key` to `value`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name set
|
||||||
|
* @memberOf Hash
|
||||||
|
* @param {string} key The key of the value to set.
|
||||||
|
* @param {*} value The value to set.
|
||||||
|
* @returns {Object} Returns the hash instance.
|
||||||
|
*/
|
||||||
|
function hashSet(key, value) {
|
||||||
|
var data = this.__data__;
|
||||||
|
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add methods to `Hash`.
|
||||||
|
Hash.prototype.clear = hashClear;
|
||||||
|
Hash.prototype['delete'] = hashDelete;
|
||||||
|
Hash.prototype.get = hashGet;
|
||||||
|
Hash.prototype.has = hashHas;
|
||||||
|
Hash.prototype.set = hashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an list cache object.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @constructor
|
||||||
|
* @param {Array} [entries] The key-value pairs to cache.
|
||||||
|
*/
|
||||||
|
function ListCache(entries) {
|
||||||
|
var index = -1,
|
||||||
|
length = entries ? entries.length : 0;
|
||||||
|
|
||||||
|
this.clear();
|
||||||
|
while (++index < length) {
|
||||||
|
var entry = entries[index];
|
||||||
|
this.set(entry[0], entry[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all key-value entries from the list cache.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name clear
|
||||||
|
* @memberOf ListCache
|
||||||
|
*/
|
||||||
|
function listCacheClear() {
|
||||||
|
this.__data__ = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes `key` and its value from the list cache.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name delete
|
||||||
|
* @memberOf ListCache
|
||||||
|
* @param {string} key The key of the value to remove.
|
||||||
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||||||
|
*/
|
||||||
|
function listCacheDelete(key) {
|
||||||
|
var data = this.__data__,
|
||||||
|
index = assocIndexOf(data, key);
|
||||||
|
|
||||||
|
if (index < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var lastIndex = data.length - 1;
|
||||||
|
if (index == lastIndex) {
|
||||||
|
data.pop();
|
||||||
|
} else {
|
||||||
|
splice.call(data, index, 1);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list cache value for `key`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name get
|
||||||
|
* @memberOf ListCache
|
||||||
|
* @param {string} key The key of the value to get.
|
||||||
|
* @returns {*} Returns the entry value.
|
||||||
|
*/
|
||||||
|
function listCacheGet(key) {
|
||||||
|
var data = this.__data__,
|
||||||
|
index = assocIndexOf(data, key);
|
||||||
|
|
||||||
|
return index < 0 ? undefined : data[index][1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a list cache value for `key` exists.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name has
|
||||||
|
* @memberOf ListCache
|
||||||
|
* @param {string} key The key of the entry to check.
|
||||||
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||||||
|
*/
|
||||||
|
function listCacheHas(key) {
|
||||||
|
return assocIndexOf(this.__data__, key) > -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the list cache `key` to `value`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name set
|
||||||
|
* @memberOf ListCache
|
||||||
|
* @param {string} key The key of the value to set.
|
||||||
|
* @param {*} value The value to set.
|
||||||
|
* @returns {Object} Returns the list cache instance.
|
||||||
|
*/
|
||||||
|
function listCacheSet(key, value) {
|
||||||
|
var data = this.__data__,
|
||||||
|
index = assocIndexOf(data, key);
|
||||||
|
|
||||||
|
if (index < 0) {
|
||||||
|
data.push([key, value]);
|
||||||
|
} else {
|
||||||
|
data[index][1] = value;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add methods to `ListCache`.
|
||||||
|
ListCache.prototype.clear = listCacheClear;
|
||||||
|
ListCache.prototype['delete'] = listCacheDelete;
|
||||||
|
ListCache.prototype.get = listCacheGet;
|
||||||
|
ListCache.prototype.has = listCacheHas;
|
||||||
|
ListCache.prototype.set = listCacheSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a map cache object to store key-value pairs.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @constructor
|
||||||
|
* @param {Array} [entries] The key-value pairs to cache.
|
||||||
|
*/
|
||||||
|
function MapCache(entries) {
|
||||||
|
var index = -1,
|
||||||
|
length = entries ? entries.length : 0;
|
||||||
|
|
||||||
|
this.clear();
|
||||||
|
while (++index < length) {
|
||||||
|
var entry = entries[index];
|
||||||
|
this.set(entry[0], entry[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all key-value entries from the map.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name clear
|
||||||
|
* @memberOf MapCache
|
||||||
|
*/
|
||||||
|
function mapCacheClear() {
|
||||||
|
this.__data__ = {
|
||||||
|
'hash': new Hash,
|
||||||
|
'map': new (Map || ListCache),
|
||||||
|
'string': new Hash
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes `key` and its value from the map.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name delete
|
||||||
|
* @memberOf MapCache
|
||||||
|
* @param {string} key The key of the value to remove.
|
||||||
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||||||
|
*/
|
||||||
|
function mapCacheDelete(key) {
|
||||||
|
return getMapData(this, key)['delete'](key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the map value for `key`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name get
|
||||||
|
* @memberOf MapCache
|
||||||
|
* @param {string} key The key of the value to get.
|
||||||
|
* @returns {*} Returns the entry value.
|
||||||
|
*/
|
||||||
|
function mapCacheGet(key) {
|
||||||
|
return getMapData(this, key).get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a map value for `key` exists.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name has
|
||||||
|
* @memberOf MapCache
|
||||||
|
* @param {string} key The key of the entry to check.
|
||||||
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||||||
|
*/
|
||||||
|
function mapCacheHas(key) {
|
||||||
|
return getMapData(this, key).has(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the map `key` to `value`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @name set
|
||||||
|
* @memberOf MapCache
|
||||||
|
* @param {string} key The key of the value to set.
|
||||||
|
* @param {*} value The value to set.
|
||||||
|
* @returns {Object} Returns the map cache instance.
|
||||||
|
*/
|
||||||
|
function mapCacheSet(key, value) {
|
||||||
|
getMapData(this, key).set(key, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add methods to `MapCache`.
|
||||||
|
MapCache.prototype.clear = mapCacheClear;
|
||||||
|
MapCache.prototype['delete'] = mapCacheDelete;
|
||||||
|
MapCache.prototype.get = mapCacheGet;
|
||||||
|
MapCache.prototype.has = mapCacheHas;
|
||||||
|
MapCache.prototype.set = mapCacheSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Array} array The array to inspect.
|
||||||
|
* @param {*} key The key to search for.
|
||||||
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||||
|
*/
|
||||||
|
function assocIndexOf(array, key) {
|
||||||
|
var length = array.length;
|
||||||
|
while (length--) {
|
||||||
|
if (eq(array[length][0], key)) {
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.isNative` without bad shim checks.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to check.
|
||||||
|
* @returns {boolean} Returns `true` if `value` is a native function,
|
||||||
|
* else `false`.
|
||||||
|
*/
|
||||||
|
function baseIsNative(value) {
|
||||||
|
if (!isObject(value) || isMasked(value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
||||||
|
return pattern.test(toSource(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the data for `map`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} map The map to query.
|
||||||
|
* @param {string} key The reference key.
|
||||||
|
* @returns {*} Returns the map data.
|
||||||
|
*/
|
||||||
|
function getMapData(map, key) {
|
||||||
|
var data = map.__data__;
|
||||||
|
return isKeyable(key)
|
||||||
|
? data[typeof key == 'string' ? 'string' : 'hash']
|
||||||
|
: data.map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the native function at `key` of `object`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} object The object to query.
|
||||||
|
* @param {string} key The key of the method to get.
|
||||||
|
* @returns {*} Returns the function if it's native, else `undefined`.
|
||||||
|
*/
|
||||||
|
function getNative(object, key) {
|
||||||
|
var value = getValue(object, key);
|
||||||
|
return baseIsNative(value) ? value : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if `value` is suitable for use as unique object key.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to check.
|
||||||
|
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
||||||
|
*/
|
||||||
|
function isKeyable(value) {
|
||||||
|
var type = typeof value;
|
||||||
|
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
||||||
|
? (value !== '__proto__')
|
||||||
|
: (value === null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if `func` has its source masked.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Function} func The function to check.
|
||||||
|
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
||||||
|
*/
|
||||||
|
function isMasked(func) {
|
||||||
|
return !!maskSrcKey && (maskSrcKey in func);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts `func` to its source code.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Function} func The function to process.
|
||||||
|
* @returns {string} Returns the source code.
|
||||||
|
*/
|
||||||
|
function toSource(func) {
|
||||||
|
if (func != null) {
|
||||||
|
try {
|
||||||
|
return funcToString.call(func);
|
||||||
|
} catch (e) {}
|
||||||
|
try {
|
||||||
|
return (func + '');
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a function that memoizes the result of `func`. If `resolver` is
|
||||||
|
* provided, it determines the cache key for storing the result based on the
|
||||||
|
* arguments provided to the memoized function. By default, the first argument
|
||||||
|
* provided to the memoized function is used as the map cache key. The `func`
|
||||||
|
* is invoked with the `this` binding of the memoized function.
|
||||||
|
*
|
||||||
|
* **Note:** The cache is exposed as the `cache` property on the memoized
|
||||||
|
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
||||||
|
* constructor with one whose instances implement the
|
||||||
|
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
||||||
|
* method interface of `delete`, `get`, `has`, and `set`.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @memberOf _
|
||||||
|
* @since 0.1.0
|
||||||
|
* @category Function
|
||||||
|
* @param {Function} func The function to have its output memoized.
|
||||||
|
* @param {Function} [resolver] The function to resolve the cache key.
|
||||||
|
* @returns {Function} Returns the new memoized function.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var object = { 'a': 1, 'b': 2 };
|
||||||
|
* var other = { 'c': 3, 'd': 4 };
|
||||||
|
*
|
||||||
|
* var values = _.memoize(_.values);
|
||||||
|
* values(object);
|
||||||
|
* // => [1, 2]
|
||||||
|
*
|
||||||
|
* values(other);
|
||||||
|
* // => [3, 4]
|
||||||
|
*
|
||||||
|
* object.a = 2;
|
||||||
|
* values(object);
|
||||||
|
* // => [1, 2]
|
||||||
|
*
|
||||||
|
* // Modify the result cache.
|
||||||
|
* values.cache.set(object, ['a', 'b']);
|
||||||
|
* values(object);
|
||||||
|
* // => ['a', 'b']
|
||||||
|
*
|
||||||
|
* // Replace `_.memoize.Cache`.
|
||||||
|
* _.memoize.Cache = WeakMap;
|
||||||
|
*/
|
||||||
|
function memoize(func, resolver) {
|
||||||
|
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
|
||||||
|
throw new TypeError(FUNC_ERROR_TEXT);
|
||||||
|
}
|
||||||
|
var memoized = function() {
|
||||||
|
var args = arguments,
|
||||||
|
key = resolver ? resolver.apply(this, args) : args[0],
|
||||||
|
cache = memoized.cache;
|
||||||
|
|
||||||
|
if (cache.has(key)) {
|
||||||
|
return cache.get(key);
|
||||||
|
}
|
||||||
|
var result = func.apply(this, args);
|
||||||
|
memoized.cache = cache.set(key, result);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
memoized.cache = new (memoize.Cache || MapCache);
|
||||||
|
return memoized;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assign cache to `_.memoize`.
|
||||||
|
memoize.Cache = MapCache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a
|
||||||
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||||
|
* comparison between two values to determine if they are equivalent.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @memberOf _
|
||||||
|
* @since 4.0.0
|
||||||
|
* @category Lang
|
||||||
|
* @param {*} value The value to compare.
|
||||||
|
* @param {*} other The other value to compare.
|
||||||
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var object = { 'a': 1 };
|
||||||
|
* var other = { 'a': 1 };
|
||||||
|
*
|
||||||
|
* _.eq(object, object);
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* _.eq(object, other);
|
||||||
|
* // => false
|
||||||
|
*
|
||||||
|
* _.eq('a', 'a');
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* _.eq('a', Object('a'));
|
||||||
|
* // => false
|
||||||
|
*
|
||||||
|
* _.eq(NaN, NaN);
|
||||||
|
* // => true
|
||||||
|
*/
|
||||||
|
function eq(value, other) {
|
||||||
|
return value === other || (value !== value && other !== other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if `value` is classified as a `Function` object.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @memberOf _
|
||||||
|
* @since 0.1.0
|
||||||
|
* @category Lang
|
||||||
|
* @param {*} value The value to check.
|
||||||
|
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* _.isFunction(_);
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* _.isFunction(/abc/);
|
||||||
|
* // => false
|
||||||
|
*/
|
||||||
|
function isFunction(value) {
|
||||||
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
||||||
|
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
||||||
|
var tag = isObject(value) ? objectToString.call(value) : '';
|
||||||
|
return tag == funcTag || tag == genTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if `value` is the
|
||||||
|
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
||||||
|
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @memberOf _
|
||||||
|
* @since 0.1.0
|
||||||
|
* @category Lang
|
||||||
|
* @param {*} value The value to check.
|
||||||
|
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* _.isObject({});
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* _.isObject([1, 2, 3]);
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* _.isObject(_.noop);
|
||||||
|
* // => true
|
||||||
|
*
|
||||||
|
* _.isObject(null);
|
||||||
|
* // => false
|
||||||
|
*/
|
||||||
|
function isObject(value) {
|
||||||
|
var type = typeof value;
|
||||||
|
return !!value && (type == 'object' || type == 'function');
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = memoize;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 1552:
|
/***/ 1552:
|
||||||
|
@ -71245,11 +71928,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.isCacheFeatureAvailable = exports.isGhes = exports.repoHasYarnBerryManagedDependencies = exports.getCacheDirectories = exports.resetProjectDirectoriesMemoized = exports.getPackageManagerInfo = exports.getCommandOutputNotEmpty = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
|
exports.isCacheFeatureAvailable = exports.isGhes = exports.repoHasYarnBerryManagedDependencies = exports.getCacheDirectories = exports.getProjectDirectoriesFromCacheDependencyPath = exports.getPackageManagerInfo = exports.getCommandOutputNotEmpty = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const exec = __importStar(__nccwpck_require__(1514));
|
const exec = __importStar(__nccwpck_require__(1514));
|
||||||
const cache = __importStar(__nccwpck_require__(7799));
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
const glob = __importStar(__nccwpck_require__(8090));
|
const glob = __importStar(__nccwpck_require__(8090));
|
||||||
|
const lodash_memoize_1 = __importDefault(__nccwpck_require__(4538));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
const util_1 = __nccwpck_require__(2629);
|
const util_1 = __nccwpck_require__(2629);
|
||||||
|
@ -71315,29 +71999,20 @@ const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void
|
||||||
});
|
});
|
||||||
exports.getPackageManagerInfo = getPackageManagerInfo;
|
exports.getPackageManagerInfo = getPackageManagerInfo;
|
||||||
/**
|
/**
|
||||||
|
* Expands (converts) the string input `cache-dependency-path` to list of directories that
|
||||||
|
* may be project roots
|
||||||
|
*
|
||||||
* getProjectDirectoriesFromCacheDependencyPath is called twice during `restoreCache`
|
* getProjectDirectoriesFromCacheDependencyPath is called twice during `restoreCache`
|
||||||
* - first through `getCacheDirectories`
|
* - first through `getCacheDirectories`
|
||||||
* - second from `repoHasYarn3ManagedCache`
|
* - second from `repoHasYarn3ManagedCache`
|
||||||
*
|
*
|
||||||
* it contains expensive IO operation and thus should be memoized
|
* it contains expensive IO operation and thus should be memoized
|
||||||
*/
|
*
|
||||||
let projectDirectoriesMemoized = null;
|
|
||||||
/**
|
|
||||||
* unit test must reset memoized variables
|
|
||||||
*/
|
|
||||||
const resetProjectDirectoriesMemoized = () => (projectDirectoriesMemoized = null);
|
|
||||||
exports.resetProjectDirectoriesMemoized = resetProjectDirectoriesMemoized;
|
|
||||||
/**
|
|
||||||
* Expands (converts) the string input `cache-dependency-path` to list of directories that
|
|
||||||
* may be project roots
|
|
||||||
* @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
|
* @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
|
||||||
* expected to be the result of `core.getInput('cache-dependency-path')`
|
* expected to be the result of `core.getInput('cache-dependency-path')`
|
||||||
* @return list of directories and possible
|
* @return list of directories and possible
|
||||||
*/
|
*/
|
||||||
const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getProjectDirectoriesFromCacheDependencyPath = lodash_memoize_1.default((cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
if (projectDirectoriesMemoized !== null) {
|
|
||||||
return projectDirectoriesMemoized;
|
|
||||||
}
|
|
||||||
const globber = yield glob.create(cacheDependencyPath);
|
const globber = yield glob.create(cacheDependencyPath);
|
||||||
const cacheDependenciesPaths = yield globber.glob();
|
const cacheDependenciesPaths = yield globber.glob();
|
||||||
const existingDirectories = cacheDependenciesPaths
|
const existingDirectories = cacheDependenciesPaths
|
||||||
|
@ -71347,9 +72022,8 @@ const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __
|
||||||
.filter(directory => fs_1.default.lstatSync(directory).isDirectory());
|
.filter(directory => fs_1.default.lstatSync(directory).isDirectory());
|
||||||
if (!existingDirectories.length)
|
if (!existingDirectories.length)
|
||||||
core.warning(`No existing directories found containing cache-dependency-path="${cacheDependencyPath}"`);
|
core.warning(`No existing directories found containing cache-dependency-path="${cacheDependencyPath}"`);
|
||||||
projectDirectoriesMemoized = existingDirectories;
|
|
||||||
return existingDirectories;
|
return existingDirectories;
|
||||||
});
|
}));
|
||||||
/**
|
/**
|
||||||
* Finds the cache directories configured for the repo if cache-dependency-path is not empty
|
* Finds the cache directories configured for the repo if cache-dependency-path is not empty
|
||||||
* @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM
|
* @param packageManagerInfo - an object having getCacheFolderPath method specific to given PM
|
||||||
|
@ -71358,7 +72032,7 @@ const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __
|
||||||
* @return list of files on which the cache depends
|
* @return list of files on which the cache depends
|
||||||
*/
|
*/
|
||||||
const getCacheDirectoriesFromCacheDependencyPath = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
const getCacheDirectoriesFromCacheDependencyPath = (packageManagerInfo, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const projectDirectories = yield getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath);
|
const projectDirectories = yield exports.getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath);
|
||||||
const cacheFoldersPaths = yield Promise.all(projectDirectories.map((projectDirectory) => __awaiter(void 0, void 0, void 0, function* () {
|
const cacheFoldersPaths = yield Promise.all(projectDirectories.map((projectDirectory) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const cacheFolderPath = yield packageManagerInfo.getCacheFolderPath(projectDirectory);
|
const cacheFolderPath = yield packageManagerInfo.getCacheFolderPath(projectDirectory);
|
||||||
core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the directory "${projectDirectory}"`);
|
core.debug(`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the directory "${projectDirectory}"`);
|
||||||
|
@ -71438,7 +72112,7 @@ const repoHasYarnBerryManagedDependencies = (packageManagerInfo, cacheDependency
|
||||||
if (packageManagerInfo.name !== 'yarn')
|
if (packageManagerInfo.name !== 'yarn')
|
||||||
return false;
|
return false;
|
||||||
const yarnDirs = cacheDependencyPath
|
const yarnDirs = cacheDependencyPath
|
||||||
? yield getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath)
|
? yield exports.getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath)
|
||||||
: [''];
|
: [''];
|
||||||
const isManagedList = yield Promise.all(yarnDirs.map(projectHasYarnBerryManagedDependencies));
|
const isManagedList = yield Promise.all(yarnDirs.map(projectHasYarnBerryManagedDependencies));
|
||||||
return isManagedList.every(Boolean);
|
return isManagedList.every(Boolean);
|
||||||
|
|
|
@ -17,10 +17,12 @@
|
||||||
"@actions/http-client": "^1.0.11",
|
"@actions/http-client": "^1.0.11",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
"@actions/tool-cache": "^1.5.4",
|
"@actions/tool-cache": "^1.5.4",
|
||||||
|
"lodash.memoize": "^4.1.2",
|
||||||
"semver": "^6.3.1"
|
"semver": "^6.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^27.0.2",
|
||||||
|
"@types/lodash.memoize": "^4.1.7",
|
||||||
"@types/node": "^16.11.25",
|
"@types/node": "^16.11.25",
|
||||||
"@types/semver": "^6.0.0",
|
"@types/semver": "^6.0.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
||||||
|
@ -1648,6 +1650,21 @@
|
||||||
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
|
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/lodash": {
|
||||||
|
"version": "4.14.197",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.197.tgz",
|
||||||
|
"integrity": "sha512-BMVOiWs0uNxHVlHBgzTIqJYmj+PgCo4euloGF+5m4okL3rEYzM2EEv78mw8zWSMM57dM7kVIgJ2QDvwHSoCI5g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/@types/lodash.memoize": {
|
||||||
|
"version": "4.1.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/lodash.memoize/-/lodash.memoize-4.1.7.tgz",
|
||||||
|
"integrity": "sha512-lGN7WeO4vO6sICVpf041Q7BX/9k1Y24Zo3FY0aUezr1QlKznpjzsDk3T3wvH8ofYzoK0QupN9TWcFAFZlyPwQQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/lodash": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "16.11.25",
|
"version": "16.11.25",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.25.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.25.tgz",
|
||||||
|
@ -4972,6 +4989,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
||||||
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
|
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
|
||||||
},
|
},
|
||||||
|
"node_modules/lodash.memoize": {
|
||||||
|
"version": "4.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
|
||||||
|
"integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag=="
|
||||||
|
},
|
||||||
"node_modules/lodash.merge": {
|
"node_modules/lodash.merge": {
|
||||||
"version": "4.6.2",
|
"version": "4.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||||
|
@ -7780,6 +7802,21 @@
|
||||||
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
|
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/lodash": {
|
||||||
|
"version": "4.14.197",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.197.tgz",
|
||||||
|
"integrity": "sha512-BMVOiWs0uNxHVlHBgzTIqJYmj+PgCo4euloGF+5m4okL3rEYzM2EEv78mw8zWSMM57dM7kVIgJ2QDvwHSoCI5g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@types/lodash.memoize": {
|
||||||
|
"version": "4.1.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/lodash.memoize/-/lodash.memoize-4.1.7.tgz",
|
||||||
|
"integrity": "sha512-lGN7WeO4vO6sICVpf041Q7BX/9k1Y24Zo3FY0aUezr1QlKznpjzsDk3T3wvH8ofYzoK0QupN9TWcFAFZlyPwQQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/lodash": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "16.11.25",
|
"version": "16.11.25",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.25.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.25.tgz",
|
||||||
|
@ -10244,6 +10281,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
||||||
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
|
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
|
||||||
},
|
},
|
||||||
|
"lodash.memoize": {
|
||||||
|
"version": "4.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
|
||||||
|
"integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag=="
|
||||||
|
},
|
||||||
"lodash.merge": {
|
"lodash.merge": {
|
||||||
"version": "4.6.2",
|
"version": "4.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||||
|
|
|
@ -33,10 +33,12 @@
|
||||||
"@actions/http-client": "^1.0.11",
|
"@actions/http-client": "^1.0.11",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
"@actions/tool-cache": "^1.5.4",
|
"@actions/tool-cache": "^1.5.4",
|
||||||
|
"lodash.memoize": "^4.1.2",
|
||||||
"semver": "^6.3.1"
|
"semver": "^6.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^27.0.2",
|
||||||
|
"@types/lodash.memoize": "^4.1.7",
|
||||||
"@types/node": "^16.11.25",
|
"@types/node": "^16.11.25",
|
||||||
"@types/semver": "^6.0.0",
|
"@types/semver": "^6.0.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
||||||
|
|
|
@ -2,6 +2,7 @@ import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import * as cache from '@actions/cache';
|
import * as cache from '@actions/cache';
|
||||||
import * as glob from '@actions/glob';
|
import * as glob from '@actions/glob';
|
||||||
|
import memoize from 'lodash.memoize';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import {unique} from './util';
|
import {unique} from './util';
|
||||||
|
@ -111,33 +112,21 @@ export const getPackageManagerInfo = async (packageManager: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Expands (converts) the string input `cache-dependency-path` to list of directories that
|
||||||
|
* may be project roots
|
||||||
|
*
|
||||||
* getProjectDirectoriesFromCacheDependencyPath is called twice during `restoreCache`
|
* getProjectDirectoriesFromCacheDependencyPath is called twice during `restoreCache`
|
||||||
* - first through `getCacheDirectories`
|
* - first through `getCacheDirectories`
|
||||||
* - second from `repoHasYarn3ManagedCache`
|
* - second from `repoHasYarn3ManagedCache`
|
||||||
*
|
*
|
||||||
* it contains expensive IO operation and thus should be memoized
|
* it contains expensive IO operation and thus should be memoized
|
||||||
*/
|
*
|
||||||
|
|
||||||
let projectDirectoriesMemoized: string[] | null = null;
|
|
||||||
/**
|
|
||||||
* unit test must reset memoized variables
|
|
||||||
*/
|
|
||||||
export const resetProjectDirectoriesMemoized = () =>
|
|
||||||
(projectDirectoriesMemoized = null);
|
|
||||||
/**
|
|
||||||
* Expands (converts) the string input `cache-dependency-path` to list of directories that
|
|
||||||
* may be project roots
|
|
||||||
* @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
|
* @param cacheDependencyPath - either a single string or multiline string with possible glob patterns
|
||||||
* expected to be the result of `core.getInput('cache-dependency-path')`
|
* expected to be the result of `core.getInput('cache-dependency-path')`
|
||||||
* @return list of directories and possible
|
* @return list of directories and possible
|
||||||
*/
|
*/
|
||||||
const getProjectDirectoriesFromCacheDependencyPath = async (
|
export const getProjectDirectoriesFromCacheDependencyPath = memoize(
|
||||||
cacheDependencyPath: string
|
async (cacheDependencyPath: string): Promise<string[]> => {
|
||||||
): Promise<string[]> => {
|
|
||||||
if (projectDirectoriesMemoized !== null) {
|
|
||||||
return projectDirectoriesMemoized;
|
|
||||||
}
|
|
||||||
|
|
||||||
const globber = await glob.create(cacheDependencyPath);
|
const globber = await glob.create(cacheDependencyPath);
|
||||||
const cacheDependenciesPaths = await globber.glob();
|
const cacheDependenciesPaths = await globber.glob();
|
||||||
|
|
||||||
|
@ -152,9 +141,9 @@ const getProjectDirectoriesFromCacheDependencyPath = async (
|
||||||
`No existing directories found containing cache-dependency-path="${cacheDependencyPath}"`
|
`No existing directories found containing cache-dependency-path="${cacheDependencyPath}"`
|
||||||
);
|
);
|
||||||
|
|
||||||
projectDirectoriesMemoized = existingDirectories;
|
|
||||||
return existingDirectories;
|
return existingDirectories;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the cache directories configured for the repo if cache-dependency-path is not empty
|
* Finds the cache directories configured for the repo if cache-dependency-path is not empty
|
||||||
|
|
Loading…
Reference in New Issue