Skip to content

Commit ca20f59

Browse files
aduh95targos
authored andcommitted
esm: remove support for deprecated hooks
Those have been deprecated for a while, it's time. PR-URL: #47580 Backport-PR-URL: #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]>
1 parent 5de37a1 commit ca20f59

File tree

3 files changed

+0
-87
lines changed

3 files changed

+0
-87
lines changed

lib/internal/modules/esm/hooks.js

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
const {
4-
ArrayPrototypeJoin,
54
ArrayPrototypePush,
65
FunctionPrototypeCall,
76
Int32Array,
@@ -658,45 +657,9 @@ function pluckHooks({
658657
globalPreload,
659658
resolve,
660659
load,
661-
// obsolete hooks:
662-
dynamicInstantiate,
663-
getFormat,
664-
getGlobalPreloadCode,
665-
getSource,
666-
transformSource,
667660
}) {
668-
const obsoleteHooks = [];
669661
const acceptedHooks = { __proto__: null };
670662

671-
if (getGlobalPreloadCode) {
672-
globalPreload ??= getGlobalPreloadCode;
673-
674-
process.emitWarning(
675-
'Loader hook "getGlobalPreloadCode" has been renamed to "globalPreload"',
676-
);
677-
}
678-
if (dynamicInstantiate) {
679-
ArrayPrototypePush(obsoleteHooks, 'dynamicInstantiate');
680-
}
681-
if (getFormat) {
682-
ArrayPrototypePush(obsoleteHooks, 'getFormat');
683-
}
684-
if (getSource) {
685-
ArrayPrototypePush(obsoleteHooks, 'getSource');
686-
}
687-
if (transformSource) {
688-
ArrayPrototypePush(obsoleteHooks, 'transformSource');
689-
}
690-
691-
if (obsoleteHooks.length) {
692-
process.emitWarning(
693-
`Obsolete loader hook(s) supplied and will be ignored: ${
694-
ArrayPrototypeJoin(obsoleteHooks, ', ')
695-
}`,
696-
'DeprecationWarning',
697-
);
698-
}
699-
700663
if (globalPreload) {
701664
acceptedHooks.globalPreload = globalPreload;
702665
}

test/es-module/test-esm-loader-obsolete-hooks.mjs

Lines changed: 0 additions & 28 deletions
This file was deleted.

test/fixtures/es-module-loaders/hooks-obsolete.mjs

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)