mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
deps: update corepack to 0.16.0
PR-URL: https://github.com/nodejs/node/pull/46710 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
This commit is contained in:
1 parent
2ed3875eee
commit
6c997035fc
5 files changed
+44730
-58732
No files matched your search
Vendored
+13
@@ -1,5 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
## [0.16.0](https://github.com/nodejs/corepack/compare/v0.15.3...v0.16.0) (2023-02-17)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* update package manager versions ([#228](https://github.com/nodejs/corepack/issues/228)) ([bb000f9](https://github.com/nodejs/corepack/commit/bb000f9c10a1fbd85f2c15a90218d90b42473130))
|
||||
* build: migrate to ESBuild ([#229](https://github.com/nodejs/corepack/pull/229)) ([15ceb83](https://github.com/nodejs/corepack/commit/15ceb832a34a223efbe3d3f9cb792d9101a7022a))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* npm registry override ([#219](https://github.com/nodejs/corepack/issues/219)) ([1b35362](https://github.com/nodejs/corepack/commit/1b353624e644874d9ef6c9acaf6d1254bff3015a))
|
||||
|
||||
## [0.15.3](https://github.com/nodejs/corepack/compare/v0.15.2...v0.15.3) (2022-12-30)
|
||||
|
||||
|
||||
|
||||
Vendored
+44708
-17018
File diff suppressed because it is too large.
Load diff
Vendored
-424
@@ -1,424 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
/* eslint-disable */
|
||||
/******/ (() => { // webpackBootstrap
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ "../../../.yarn/berry/cache/v8-compile-cache-npm-2.3.0-961375f150-9.zip/node_modules/v8-compile-cache/v8-compile-cache.js":
|
||||
/*!********************************************************************************************************************************!*\
|
||||
!*** ../../../.yarn/berry/cache/v8-compile-cache-npm-2.3.0-961375f150-9.zip/node_modules/v8-compile-cache/v8-compile-cache.js ***!
|
||||
\********************************************************************************************************************************/
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
'use strict';
|
||||
|
||||
const Module = require('module');
|
||||
const crypto = require('crypto');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const vm = require('vm');
|
||||
const os = require('os');
|
||||
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FileSystemBlobStore
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class FileSystemBlobStore {
|
||||
constructor(directory, prefix) {
|
||||
const name = prefix ? slashEscape(prefix + '.') : '';
|
||||
this._blobFilename = path.join(directory, name + 'BLOB');
|
||||
this._mapFilename = path.join(directory, name + 'MAP');
|
||||
this._lockFilename = path.join(directory, name + 'LOCK');
|
||||
this._directory = directory;
|
||||
this._load();
|
||||
}
|
||||
|
||||
has(key, invalidationKey) {
|
||||
if (hasOwnProperty.call(this._memoryBlobs, key)) {
|
||||
return this._invalidationKeys[key] === invalidationKey;
|
||||
} else if (hasOwnProperty.call(this._storedMap, key)) {
|
||||
return this._storedMap[key][0] === invalidationKey;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
get(key, invalidationKey) {
|
||||
if (hasOwnProperty.call(this._memoryBlobs, key)) {
|
||||
if (this._invalidationKeys[key] === invalidationKey) {
|
||||
return this._memoryBlobs[key];
|
||||
}
|
||||
} else if (hasOwnProperty.call(this._storedMap, key)) {
|
||||
const mapping = this._storedMap[key];
|
||||
if (mapping[0] === invalidationKey) {
|
||||
return this._storedBlob.slice(mapping[1], mapping[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set(key, invalidationKey, buffer) {
|
||||
this._invalidationKeys[key] = invalidationKey;
|
||||
this._memoryBlobs[key] = buffer;
|
||||
this._dirty = true;
|
||||
}
|
||||
|
||||
delete(key) {
|
||||
if (hasOwnProperty.call(this._memoryBlobs, key)) {
|
||||
this._dirty = true;
|
||||
delete this._memoryBlobs[key];
|
||||
}
|
||||
if (hasOwnProperty.call(this._invalidationKeys, key)) {
|
||||
this._dirty = true;
|
||||
delete this._invalidationKeys[key];
|
||||
}
|
||||
if (hasOwnProperty.call(this._storedMap, key)) {
|
||||
this._dirty = true;
|
||||
delete this._storedMap[key];
|
||||
}
|
||||
}
|
||||
|
||||
isDirty() {
|
||||
return this._dirty;
|
||||
}
|
||||
|
||||
save() {
|
||||
const dump = this._getDump();
|
||||
const blobToStore = Buffer.concat(dump[0]);
|
||||
const mapToStore = JSON.stringify(dump[1]);
|
||||
|
||||
try {
|
||||
mkdirpSync(this._directory);
|
||||
fs.writeFileSync(this._lockFilename, 'LOCK', {flag: 'wx'});
|
||||
} catch (error) {
|
||||
// Swallow the exception if we fail to acquire the lock.
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
fs.writeFileSync(this._blobFilename, blobToStore);
|
||||
fs.writeFileSync(this._mapFilename, mapToStore);
|
||||
} finally {
|
||||
fs.unlinkSync(this._lockFilename);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_load() {
|
||||
try {
|
||||
this._storedBlob = fs.readFileSync(this._blobFilename);
|
||||
this._storedMap = JSON.parse(fs.readFileSync(this._mapFilename));
|
||||
} catch (e) {
|
||||
this._storedBlob = Buffer.alloc(0);
|
||||
this._storedMap = {};
|
||||
}
|
||||
this._dirty = false;
|
||||
this._memoryBlobs = {};
|
||||
this._invalidationKeys = {};
|
||||
}
|
||||
|
||||
_getDump() {
|
||||
const buffers = [];
|
||||
const newMap = {};
|
||||
let offset = 0;
|
||||
|
||||
function push(key, invalidationKey, buffer) {
|
||||
buffers.push(buffer);
|
||||
newMap[key] = [invalidationKey, offset, offset + buffer.length];
|
||||
offset += buffer.length;
|
||||
}
|
||||
|
||||
for (const key of Object.keys(this._memoryBlobs)) {
|
||||
const buffer = this._memoryBlobs[key];
|
||||
const invalidationKey = this._invalidationKeys[key];
|
||||
push(key, invalidationKey, buffer);
|
||||
}
|
||||
|
||||
for (const key of Object.keys(this._storedMap)) {
|
||||
if (hasOwnProperty.call(newMap, key)) continue;
|
||||
const mapping = this._storedMap[key];
|
||||
const buffer = this._storedBlob.slice(mapping[1], mapping[2]);
|
||||
push(key, mapping[0], buffer);
|
||||
}
|
||||
|
||||
return [buffers, newMap];
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// NativeCompileCache
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class NativeCompileCache {
|
||||
constructor() {
|
||||
this._cacheStore = null;
|
||||
this._previousModuleCompile = null;
|
||||
}
|
||||
|
||||
setCacheStore(cacheStore) {
|
||||
this._cacheStore = cacheStore;
|
||||
}
|
||||
|
||||
install() {
|
||||
const self = this;
|
||||
const hasRequireResolvePaths = typeof require.resolve.paths === 'function';
|
||||
this._previousModuleCompile = Module.prototype._compile;
|
||||
Module.prototype._compile = function(content, filename) {
|
||||
const mod = this;
|
||||
|
||||
function require(id) {
|
||||
return mod.require(id);
|
||||
}
|
||||
|
||||
// https://github.com/nodejs/node/blob/v10.15.3/lib/internal/modules/cjs/helpers.js#L28
|
||||
function resolve(request, options) {
|
||||
return Module._resolveFilename(request, mod, false, options);
|
||||
}
|
||||
require.resolve = resolve;
|
||||
|
||||
// https://github.com/nodejs/node/blob/v10.15.3/lib/internal/modules/cjs/helpers.js#L37
|
||||
// resolve.resolve.paths was added in v8.9.0
|
||||
if (hasRequireResolvePaths) {
|
||||
resolve.paths = function paths(request) {
|
||||
return Module._resolveLookupPaths(request, mod, true);
|
||||
};
|
||||
}
|
||||
|
||||
require.main = process.mainModule;
|
||||
|
||||
// Enable support to add extra extension types
|
||||
require.extensions = Module._extensions;
|
||||
require.cache = Module._cache;
|
||||
|
||||
const dirname = path.dirname(filename);
|
||||
|
||||
const compiledWrapper = self._moduleCompile(filename, content);
|
||||
|
||||
// We skip the debugger setup because by the time we run, node has already
|
||||
// done that itself.
|
||||
|
||||
// `Buffer` is included for Electron.
|
||||
// See https://github.com/zertosh/v8-compile-cache/pull/10#issuecomment-518042543
|
||||
const args = [mod.exports, require, mod, filename, dirname, process, global, Buffer];
|
||||
return compiledWrapper.apply(mod.exports, args);
|
||||
};
|
||||
}
|
||||
|
||||
uninstall() {
|
||||
Module.prototype._compile = this._previousModuleCompile;
|
||||
}
|
||||
|
||||
_moduleCompile(filename, content) {
|
||||
// https://github.com/nodejs/node/blob/v7.5.0/lib/module.js#L511
|
||||
|
||||
// Remove shebang
|
||||
var contLen = content.length;
|
||||
if (contLen >= 2) {
|
||||
if (content.charCodeAt(0) === 35/*#*/ &&
|
||||
content.charCodeAt(1) === 33/*!*/) {
|
||||
if (contLen === 2) {
|
||||
// Exact match
|
||||
content = '';
|
||||
} else {
|
||||
// Find end of shebang line and slice it off
|
||||
var i = 2;
|
||||
for (; i < contLen; ++i) {
|
||||
var code = content.charCodeAt(i);
|
||||
if (code === 10/*\n*/ || code === 13/*\r*/) break;
|
||||
}
|
||||
if (i === contLen) {
|
||||
content = '';
|
||||
} else {
|
||||
// Note that this actually includes the newline character(s) in the
|
||||
// new output. This duplicates the behavior of the regular
|
||||
// expression that was previously used to replace the shebang line
|
||||
content = content.slice(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create wrapper function
|
||||
var wrapper = Module.wrap(content);
|
||||
|
||||
var invalidationKey = crypto
|
||||
.createHash('sha1')
|
||||
.update(content, 'utf8')
|
||||
.digest('hex');
|
||||
|
||||
var buffer = this._cacheStore.get(filename, invalidationKey);
|
||||
|
||||
var script = new vm.Script(wrapper, {
|
||||
filename: filename,
|
||||
lineOffset: 0,
|
||||
displayErrors: true,
|
||||
cachedData: buffer,
|
||||
produceCachedData: true,
|
||||
});
|
||||
|
||||
if (script.cachedDataProduced) {
|
||||
this._cacheStore.set(filename, invalidationKey, script.cachedData);
|
||||
} else if (script.cachedDataRejected) {
|
||||
this._cacheStore.delete(filename);
|
||||
}
|
||||
|
||||
var compiledWrapper = script.runInThisContext({
|
||||
filename: filename,
|
||||
lineOffset: 0,
|
||||
columnOffset: 0,
|
||||
displayErrors: true,
|
||||
});
|
||||
|
||||
return compiledWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// utilities
|
||||
//
|
||||
// https://github.com/substack/node-mkdirp/blob/f2003bb/index.js#L55-L98
|
||||
// https://github.com/zertosh/slash-escape/blob/e7ebb99/slash-escape.js
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function mkdirpSync(p_) {
|
||||
_mkdirpSync(path.resolve(p_), 0o777);
|
||||
}
|
||||
|
||||
function _mkdirpSync(p, mode) {
|
||||
try {
|
||||
fs.mkdirSync(p, mode);
|
||||
} catch (err0) {
|
||||
if (err0.code === 'ENOENT') {
|
||||
_mkdirpSync(path.dirname(p));
|
||||
_mkdirpSync(p);
|
||||
} else {
|
||||
try {
|
||||
const stat = fs.statSync(p);
|
||||
if (!stat.isDirectory()) { throw err0; }
|
||||
} catch (err1) {
|
||||
throw err0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function slashEscape(str) {
|
||||
const ESCAPE_LOOKUP = {
|
||||
'\\': 'zB',
|
||||
':': 'zC',
|
||||
'/': 'zS',
|
||||
'\x00': 'z0',
|
||||
'z': 'zZ',
|
||||
};
|
||||
const ESCAPE_REGEX = /[\\:/\x00z]/g; // eslint-disable-line no-control-regex
|
||||
return str.replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]);
|
||||
}
|
||||
|
||||
function supportsCachedData() {
|
||||
const script = new vm.Script('""', {produceCachedData: true});
|
||||
// chakracore, as of v1.7.1.0, returns `false`.
|
||||
return script.cachedDataProduced === true;
|
||||
}
|
||||
|
||||
function getCacheDir() {
|
||||
const v8_compile_cache_cache_dir = process.env.V8_COMPILE_CACHE_CACHE_DIR;
|
||||
if (v8_compile_cache_cache_dir) {
|
||||
return v8_compile_cache_cache_dir;
|
||||
}
|
||||
|
||||
// Avoid cache ownership issues on POSIX systems.
|
||||
const dirname = typeof process.getuid === 'function'
|
||||
? 'v8-compile-cache-' + process.getuid()
|
||||
: 'v8-compile-cache';
|
||||
const version = typeof process.versions.v8 === 'string'
|
||||
? process.versions.v8
|
||||
: typeof process.versions.chakracore === 'string'
|
||||
? 'chakracore-' + process.versions.chakracore
|
||||
: 'node-' + process.version;
|
||||
const cacheDir = path.join(os.tmpdir(), dirname, version);
|
||||
return cacheDir;
|
||||
}
|
||||
|
||||
function getMainName() {
|
||||
// `require.main.filename` is undefined or null when:
|
||||
// * node -e 'require("v8-compile-cache")'
|
||||
// * node -r 'v8-compile-cache'
|
||||
// * Or, requiring from the REPL.
|
||||
const mainName = require.main && typeof require.main.filename === 'string'
|
||||
? require.main.filename
|
||||
: process.cwd();
|
||||
return mainName;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// main
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
if (!process.env.DISABLE_V8_COMPILE_CACHE && supportsCachedData()) {
|
||||
const cacheDir = getCacheDir();
|
||||
const prefix = getMainName();
|
||||
const blobStore = new FileSystemBlobStore(cacheDir, prefix);
|
||||
|
||||
const nativeCompileCache = new NativeCompileCache();
|
||||
nativeCompileCache.setCacheStore(blobStore);
|
||||
nativeCompileCache.install();
|
||||
|
||||
process.once('exit', () => {
|
||||
if (blobStore.isDirty()) {
|
||||
blobStore.save();
|
||||
}
|
||||
nativeCompileCache.uninstall();
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.__TEST__ = {
|
||||
FileSystemBlobStore,
|
||||
NativeCompileCache,
|
||||
mkdirpSync,
|
||||
slashEscape,
|
||||
supportsCachedData,
|
||||
getCacheDir,
|
||||
getMainName,
|
||||
};
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
/************************************************************************/
|
||||
/******/ // The module cache
|
||||
/******/ var __webpack_module_cache__ = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/ // Check if module is in cache
|
||||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||||
/******/ if (cachedModule !== undefined) {
|
||||
/******/ return cachedModule.exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||||
/******/ // no module.id needed
|
||||
/******/ // no module.loaded needed
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/
|
||||
/******/ // startup
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ // This entry module doesn't tell about it's top-level declarations so it can't be inlined
|
||||
/******/ var __webpack_exports__ = __webpack_require__("../../../.yarn/berry/cache/v8-compile-cache-npm-2.3.0-961375f150-9.zip/node_modules/v8-compile-cache/v8-compile-cache.js");
|
||||
/******/ var __webpack_export_target__ = exports;
|
||||
/******/ for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i];
|
||||
/******/ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
|
||||
/******/
|
||||
/******/ })()
|
||||
;
|
||||
-41282
File diff suppressed because it is too large.
Load diff
Vendored
+9
-8
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "corepack",
|
||||
"version": "0.15.3",
|
||||
"version": "0.16.0",
|
||||
"homepage": "https://github.com/nodejs/corepack#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/nodejs/corepack/issues"
|
||||
@@ -9,6 +9,9 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/nodejs/corepack.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.14.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"packageManager": "yarn@4.0.0-rc.15+sha224.7fa5c1d1875b041cea8fcbf9a364667e398825364bf5c5c8cd5f6601",
|
||||
"devDependencies": {
|
||||
@@ -29,6 +32,7 @@
|
||||
"babel-plugin-dynamic-import-node": "^2.3.3",
|
||||
"clipanion": "^3.0.1",
|
||||
"debug": "^4.1.1",
|
||||
"esbuild": "0.16.15",
|
||||
"eslint": "^8.0.0",
|
||||
"eslint-plugin-arca": "^0.15.0",
|
||||
"jest": "^29.0.0",
|
||||
@@ -37,23 +41,20 @@
|
||||
"semver": "^7.1.3",
|
||||
"supports-color": "^9.0.0",
|
||||
"tar": "^6.0.1",
|
||||
"terser-webpack-plugin": "^5.1.2",
|
||||
"ts-loader": "^9.0.0",
|
||||
"ts-node": "^10.0.0",
|
||||
"typescript": "^4.3.2",
|
||||
"v8-compile-cache": "^2.3.0",
|
||||
"webpack": "^5.38.1",
|
||||
"webpack-cli": "^4.0.0",
|
||||
"which": "^2.0.2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rm -rf dist shims && webpack && ts-node ./mkshims.ts",
|
||||
"build": "rm -rf dist shims && run build:bundle && ts-node ./mkshims.ts",
|
||||
"build:bundle": "esbuild ./sources/_entryPoint.ts --bundle --platform=node --target=node14.14.0 --external:corepack --outfile='./dist/corepack.js' --resolve-extensions='.ts,.mjs,.js'",
|
||||
"corepack": "ts-node ./sources/_entryPoint.ts",
|
||||
"lint": "yarn eslint",
|
||||
"lint": "eslint .",
|
||||
"prepack": "yarn build",
|
||||
"postpack": "rm -rf dist shims",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"test": "yarn jest"
|
||||
"test": "jest"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
Reference in new issue
Block a user