@@ -1440,7 +1440,7 @@ def phase_linker_setup(options, state, newargs): # noqa: C901, PLR0912, PLR0915
14401440 if 'MODULARIZE' in user_settings :
14411441 exit_with_error ('EXPORT_ES6 requires MODULARIZE to be set' )
14421442 settings .MODULARIZE = 1
1443- if shared . target_environment_may_be ( 'node' ) and not settings .USE_ES6_IMPORT_META :
1443+ if settings . ENVIRONMENT_MAY_BE_NODE and not settings .USE_ES6_IMPORT_META :
14441444 # EXPORT_ES6 + ENVIRONMENT=*node* requires the use of import.meta.url
14451445 if 'USE_ES6_IMPORT_META' in user_settings :
14461446 exit_with_error ('EXPORT_ES6 and ENVIRONMENT=*node* requires USE_ES6_IMPORT_META to be set' )
@@ -1767,7 +1767,7 @@ def get_full_import_name(name):
17671767 if settings .NODE_CODE_CACHING :
17681768 if settings .WASM_ASYNC_COMPILATION :
17691769 exit_with_error ('NODE_CODE_CACHING requires sync compilation (WASM_ASYNC_COMPILATION=0)' )
1770- if not shared . target_environment_may_be ( 'node' ) :
1770+ if not settings . ENVIRONMENT_MAY_BE_NODE :
17711771 exit_with_error ('NODE_CODE_CACHING only works in node, but target environments do not include it' )
17721772 if settings .SINGLE_FILE :
17731773 exit_with_error ('NODE_CODE_CACHING saves a file on the side and is not compatible with SINGLE_FILE' )
@@ -2366,11 +2366,11 @@ def phase_binaryen(target, options, wasm_target):
23662366
23672367
23682368def node_es6_imports ():
2369- if not settings .EXPORT_ES6 or not shared . target_environment_may_be ( 'node' ) :
2369+ if not settings .EXPORT_ES6 or not settings . ENVIRONMENT_MAY_BE_NODE :
23702370 return ''
23712371
23722372 # Multi-environment builds uses `await import` in `shell.js`
2373- if shared . target_environment_may_be ( 'web' ) :
2373+ if settings . ENVIRONMENT_MAY_BE_WEB :
23742374 return ''
23752375
23762376 # Use static import declaration if we only target Node.js
@@ -2397,8 +2397,8 @@ def modularize():
23972397 # Multi-environment ES6 builds require an async function
23982398 async_emit = ''
23992399 if settings .EXPORT_ES6 and \
2400- shared . target_environment_may_be ( 'node' ) and \
2401- shared . target_environment_may_be ( 'web' ) :
2400+ settings . ENVIRONMENT_MAY_BE_NODE and \
2401+ settings . ENVIRONMENT_MAY_BE_WEB :
24022402 async_emit = 'async '
24032403
24042404 # TODO: Remove when https://bugs.webkit.org/show_bug.cgi?id=223533 is resolved.
@@ -2446,7 +2446,7 @@ def modularize():
24462446 script_url = 'import.meta.url'
24472447 else :
24482448 script_url = "typeof document != 'undefined' ? document.currentScript?.src : undefined"
2449- if shared . target_environment_may_be ( 'node' ) :
2449+ if settings . ENVIRONMENT_MAY_BE_NODE :
24502450 script_url_node = "if (typeof __filename != 'undefined') _scriptName = _scriptName || __filename;"
24512451 if settings .MODULARIZE == 'instance' :
24522452 src = '''%(node_imports)s
0 commit comments