Skip to content

Commit ac35106

Browse files
kooogetargos
authored andcommitted
sea: suppress builtin warning with disableExperimentalSEAWarning option
Signed-off-by: koooge <koooooge@gmail.com> PR-URL: #57086 Refs: nodejs/single-executable#107 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent fec2d50 commit ac35106

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎lib/internal/main/embedding.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const { codes: {
3030
prepareMainThreadExecution(false,true);
3131

3232
constisLoadingSea=isSea();
33+
constisBuiltinWarningNeeded=isLoadingSea&&isExperimentalSeaWarningNeeded();
3334
if(isExperimentalSeaWarningNeeded()){
3435
emitExperimentalWarning('Single executable application');
3536
}
@@ -98,7 +99,7 @@ let warnedAboutBuiltins = false;
9899
functionembedderRequire(id){
99100
constnormalizedId=normalizeRequirableId(id);
100101
if(!normalizedId){
101-
if(isLoadingSea&&!warnedAboutBuiltins){
102+
if(isBuiltinWarningNeeded&&!warnedAboutBuiltins){
102103
emitWarningSync(
103104
'Currently the require() provided to the main script embedded into '+
104105
'single-executable applications only supports loading built-in modules.\n'+

‎test/fixtures/sea.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ const builtinWarning =
1010
To load a module from disk after the single executable application is launched, use require("module").createRequire().
1111
Support for bundled module loading or virtual file systems are under discussions in https://github.com/nodejs/single-executable`;
1212

13-
expectWarning('Warning',builtinWarning);// Triggered by require() calls below.
1413
// This additionally makes sure that no unexpected warnings are emitted.
1514
if(!createdRequire('./sea-config.json').disableExperimentalSEAWarning){
15+
expectWarning('Warning',builtinWarning);// Triggered by require() calls below.
1616
expectWarning('ExperimentalWarning',
1717
'Single executable application is an experimental feature and '+
1818
'might change at any time');

0 commit comments

Comments
 (0)