-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat(core): add shutdown lifecycle hook to node executor" (#2…
…7794) Reverts #27354 This patch is causing issues that are more serious than what it fixes. (cherry picked from commit e71e2f3)
- Loading branch information
1 parent
1ff0c6c
commit bb7d9c9
Showing
4 changed files
with
23 additions
and
58 deletions.
There are no files selected for viewing
26 changes: 20 additions & 6 deletions
26
packages/js/src/executors/node/node-with-require-overrides.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
const Module = require('module'); | ||
const url = require('node:url'); | ||
const { patchSigint } = require('./patch-sigint'); | ||
const { patchRequire } = require('./patch-require'); | ||
|
||
patchSigint(); | ||
patchRequire(); | ||
const originalLoader = Module._load; | ||
|
||
const dynamicImport = new Function('specifier', 'return import(specifier)'); | ||
dynamicImport(url.pathToFileURL(process.env.NX_FILE_TO_RUN)); | ||
|
||
const mappings = JSON.parse(process.env.NX_MAPPINGS); | ||
const keys = Object.keys(mappings); | ||
const fileToRun = url.pathToFileURL(process.env.NX_FILE_TO_RUN); | ||
|
||
Module._load = function (request, parent) { | ||
if (!parent) return originalLoader.apply(this, arguments); | ||
const match = keys.find((k) => request === k); | ||
if (match) { | ||
const newArguments = [...arguments]; | ||
newArguments[0] = mappings[match]; | ||
return originalLoader.apply(this, newArguments); | ||
} else { | ||
return originalLoader.apply(this, arguments); | ||
} | ||
}; | ||
|
||
dynamicImport(fileToRun); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.