composer and npm

This commit is contained in:
Henry Whitaker
2020-08-25 00:59:44 +01:00
parent 6726d93cc6
commit c8f853dc84
2504 changed files with 88530 additions and 41367 deletions

View File

@@ -109,6 +109,7 @@ module.exports = function() {
_declinedDependencies: {},
_selfAccepted: false,
_selfDeclined: false,
_selfInvalidated: false,
_disposeHandlers: [],
_main: hotCurrentChildModule !== moduleId,
@@ -139,6 +140,29 @@ module.exports = function() {
var idx = hot._disposeHandlers.indexOf(callback);
if (idx >= 0) hot._disposeHandlers.splice(idx, 1);
},
invalidate: function() {
this._selfInvalidated = true;
switch (hotStatus) {
case "idle":
hotUpdate = {};
hotUpdate[moduleId] = modules[moduleId];
hotSetStatus("ready");
break;
case "ready":
hotApplyInvalidatedModule(moduleId);
break;
case "prepare":
case "check":
case "dispose":
case "apply":
(hotQueuedInvalidatedModules =
hotQueuedInvalidatedModules || []).push(moduleId);
break;
default:
// ignore requests in error states
break;
}
},
// Management API
check: hotCheck,
@@ -180,7 +204,7 @@ module.exports = function() {
var hotDeferred;
// The update info
var hotUpdate, hotUpdateNewHash;
var hotUpdate, hotUpdateNewHash, hotQueuedInvalidatedModules;
function toModuleId(id) {
var isNumber = +id + "" === id;
@@ -195,7 +219,7 @@ module.exports = function() {
hotSetStatus("check");
return hotDownloadManifest(hotRequestTimeout).then(function(update) {
if (!update) {
hotSetStatus("idle");
hotSetStatus(hotApplyInvalidatedModules() ? "ready" : "idle");
return null;
}
hotRequestedFilesMap = {};
@@ -288,6 +312,11 @@ module.exports = function() {
if (hotStatus !== "ready")
throw new Error("apply() is only allowed in ready status");
options = options || {};
return hotApplyInternal(options);
}
function hotApplyInternal(options) {
hotApplyInvalidatedModules();
var cb;
var i;
@@ -310,7 +339,11 @@ module.exports = function() {
var moduleId = queueItem.id;
var chain = queueItem.chain;
module = installedModules[moduleId];
if (!module || module.hot._selfAccepted) continue;
if (
!module ||
(module.hot._selfAccepted && !module.hot._selfInvalidated)
)
continue;
if (module.hot._selfDeclined) {
return {
type: "self-declined",
@@ -478,10 +511,13 @@ module.exports = function() {
installedModules[moduleId] &&
installedModules[moduleId].hot._selfAccepted &&
// removed self-accepted modules should not be required
appliedUpdate[moduleId] !== warnUnexpectedRequire
appliedUpdate[moduleId] !== warnUnexpectedRequire &&
// when called invalidate self-accepting is not possible
!installedModules[moduleId].hot._selfInvalidated
) {
outdatedSelfAcceptedModules.push({
module: moduleId,
parents: installedModules[moduleId].parents.slice(),
errorHandler: installedModules[moduleId].hot._selfAccepted
});
}
@@ -554,7 +590,11 @@ module.exports = function() {
// Now in "apply" phase
hotSetStatus("apply");
hotCurrentHash = hotUpdateNewHash;
if (hotUpdateNewHash !== undefined) {
hotCurrentHash = hotUpdateNewHash;
hotUpdateNewHash = undefined;
}
hotUpdate = undefined;
// insert new code
for (moduleId in appliedUpdate) {
@@ -607,7 +647,8 @@ module.exports = function() {
for (i = 0; i < outdatedSelfAcceptedModules.length; i++) {
var item = outdatedSelfAcceptedModules[i];
moduleId = item.module;
hotCurrentParents = [moduleId];
hotCurrentParents = item.parents;
hotCurrentChildModule = moduleId;
try {
$require$(moduleId);
} catch (err) {
@@ -649,9 +690,32 @@ module.exports = function() {
return Promise.reject(error);
}
if (hotQueuedInvalidatedModules) {
return hotApplyInternal(options).then(function(list) {
outdatedModules.forEach(function(moduleId) {
if (list.indexOf(moduleId) < 0) list.push(moduleId);
});
return list;
});
}
hotSetStatus("idle");
return new Promise(function(resolve) {
resolve(outdatedModules);
});
}
function hotApplyInvalidatedModules() {
if (hotQueuedInvalidatedModules) {
if (!hotUpdate) hotUpdate = {};
hotQueuedInvalidatedModules.forEach(hotApplyInvalidatedModule);
hotQueuedInvalidatedModules = undefined;
return true;
}
}
function hotApplyInvalidatedModule(moduleId) {
if (!Object.prototype.hasOwnProperty.call(hotUpdate, moduleId))
hotUpdate[moduleId] = modules[moduleId];
}
};