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: #47580
Backport-PR-URL: #50669
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
aduh95 authored and targos committed Nov 23, 2023
1 parent 5de37a1 commit ca20f59
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 87 deletions.
37 changes: 0 additions & 37 deletions 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 test/es-module/test-esm-loader-obsolete-hooks.mjs

This file was deleted.

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

This file was deleted.

0 comments on commit ca20f59

Please sign in to comment.