Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16896 from webpack/thelarkinn/module-type-constants
refactor(moduletypes): introduce module type constants for plugins
- Loading branch information
Showing
3 changed files
with
89 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Sean Larkin @TheLarkInn | ||
*/ | ||
|
||
"use strict"; | ||
|
||
/** | ||
* @type {Readonly<"javascript/auto">} | ||
*/ | ||
const JAVASCRIPT_MODULE_TYPE_AUTO = "javascript/auto"; | ||
/** | ||
* @type {Readonly<"javascript/dynamic">} | ||
*/ | ||
const JAVASCRIPT_MODULE_TYPE_DYNAMIC = "javascript/dynamic"; | ||
/** | ||
* @type {Readonly<"javascript/esm">} | ||
* This is the module type used for _strict_ ES Module syntax. This means that all legacy formats | ||
* that webpack supports (CommonJS, AMD, SystemJS) are not supported. | ||
*/ | ||
const JAVASCRIPT_MODULE_TYPE_ESM = "javascript/esm"; | ||
|
||
/** | ||
* @type {Readonly<"json">} | ||
* This is the module type used for JSON files. JSON files are always parsed as ES Module. | ||
*/ | ||
const JSON_MODULE_TYPE = "json"; | ||
|
||
exports.JAVASCRIPT_MODULE_TYPE_AUTO = JAVASCRIPT_MODULE_TYPE_AUTO; | ||
exports.JAVASCRIPT_MODULE_TYPE_DYNAMIC = JAVASCRIPT_MODULE_TYPE_DYNAMIC; | ||
exports.JAVASCRIPT_MODULE_TYPE_ESM = JAVASCRIPT_MODULE_TYPE_ESM; | ||
exports.JSON_MODULE_TYPE = JSON_MODULE_TYPE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters