@@ -1087,7 +1087,7 @@ _isImports_, _conditions_)
1087
1087
> 1. If _packageType_ is not **null**, then
1088
1088
> 1. Return _packageType_.
1089
1089
> 2. If ` -- experimental- detect- module ` is enabled and the result of
1090
- > **CONTAINS \_ MODULE\_ SYNTAX**(_source_) is true, then
1090
+ > **DETECT \_ MODULE\_ SYNTAX**(_source_) is true, then
1091
1091
> 1. Return _"module"_.
1092
1092
> 3. Return _"commonjs"_.
1093
1093
> 11. If _url_ does not have any extension, then
@@ -1124,20 +1124,16 @@ _isImports_, _conditions_)
1124
1124
> 1. Throw an _Invalid Package Configuration_ error.
1125
1125
> 4. Return the parsed JSON source of the file at _pjsonURL_.
1126
1126
1127
- **CONTAINS\_ MODULE\_ SYNTAX**(_source_)
1128
-
1129
- > 1. Parse _source_ as a CommonJS module.
1130
- > 2. If the parse is successful, return **false**.
1131
- > 3. Else inspect the error message thrown. Return **true** if it is a syntax
1132
- > error thrown by any of the following:
1133
- > * ` import ` statement (static only, _not_ dynamic ` import()` )
1134
- > * ` export` statement
1135
- > * ` import.meta`
1136
- > * ` await` at the top level
1137
- > * A lexical redeclaration of any of the CommonJS wrapper variables
1138
- > (` require` , ` exports` , ` module` , ` __filename` , ` __dirname` ) at the top
1139
- > level
1140
- > 4. Else return **false**.
1127
+ **DETECT\_ MODULE\_ SYNTAX**(_source_)
1128
+
1129
+ > 1. Parse _source_ as an ECMAScript module.
1130
+ > 2. If the parse is successful, then
1131
+ > 1. If _source_ contains top-level ` await ` , static ` import ` or ` export`
1132
+ > statements, or ` import.meta` , return **true**.
1133
+ > 2. If _source_ contains a top-level lexical declaration (` const` , ` let` ,
1134
+ > or ` class` ) of any of the CommonJS wrapper variables (` require` ,
1135
+ > ` exports` , ` module` , ` __filename` , or ` __dirname` ) then return **true**.
1136
+ > 3. Else return **false**.
1141
1137
1142
1138
### Customizing ESM specifier resolution algorithm
1143
1139
0 commit comments