Skip to content

Commit

Permalink
esm: remove support for deprecated hooks
Browse files Browse the repository at this point in the history
Those have been deprecated for a while, it's time.

PR-URL: nodejs/node#47580
Backport-PR-URL: nodejs/node#50669
Reviewed-By: Jacob Smith <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
sercher committed Apr 24, 2024
1 parent 562a477 commit f2c34c1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 87 deletions.
37 changes: 0 additions & 37 deletions graal-nodejs/lib/internal/modules/esm/hooks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const {
ArrayPrototypeJoin,
ArrayPrototypePush,
FunctionPrototypeCall,
Int32Array,
Expand Down Expand Up @@ -658,45 +657,9 @@ function pluckHooks({
globalPreload,
resolve,
load,
// obsolete hooks:
dynamicInstantiate,
getFormat,
getGlobalPreloadCode,
getSource,
transformSource,
}) {
const obsoleteHooks = [];
const acceptedHooks = { __proto__: null };

if (getGlobalPreloadCode) {
globalPreload ??= getGlobalPreloadCode;

process.emitWarning(
'Loader hook "getGlobalPreloadCode" has been renamed to "globalPreload"',
);
}
if (dynamicInstantiate) {
ArrayPrototypePush(obsoleteHooks, 'dynamicInstantiate');
}
if (getFormat) {
ArrayPrototypePush(obsoleteHooks, 'getFormat');
}
if (getSource) {
ArrayPrototypePush(obsoleteHooks, 'getSource');
}
if (transformSource) {
ArrayPrototypePush(obsoleteHooks, 'transformSource');
}

if (obsoleteHooks.length) {
process.emitWarning(
`Obsolete loader hook(s) supplied and will be ignored: ${
ArrayPrototypeJoin(obsoleteHooks, ', ')
}`,
'DeprecationWarning',
);
}

if (globalPreload) {
acceptedHooks.globalPreload = globalPreload;
}
Expand Down
28 changes: 0 additions & 28 deletions graal-nodejs/test/es-module/test-esm-loader-obsolete-hooks.mjs

This file was deleted.

22 changes: 0 additions & 22 deletions graal-nodejs/test/fixtures/es-module-loaders/hooks-obsolete.mjs

This file was deleted.

0 comments on commit f2c34c1

Please sign in to comment.