Last change
on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /*
|
---|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
3 | Author Tobias Koppers @sokra
|
---|
4 | */
|
---|
5 |
|
---|
6 | "use strict";
|
---|
7 |
|
---|
8 | /** @typedef {import("../Parser").ParserState} ParserState */
|
---|
9 |
|
---|
10 | /** @type {WeakMap<ParserState, boolean>} */
|
---|
11 | const parserStateExportsState = new WeakMap();
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * @param {ParserState} parserState parser state
|
---|
15 | * @param {boolean} isStrictHarmony strict harmony mode should be enabled
|
---|
16 | * @returns {void}
|
---|
17 | */
|
---|
18 | exports.enable = (parserState, isStrictHarmony) => {
|
---|
19 | const value = parserStateExportsState.get(parserState);
|
---|
20 | if (value === false) return;
|
---|
21 | parserStateExportsState.set(parserState, true);
|
---|
22 | if (value !== true) {
|
---|
23 | parserState.module.buildMeta.exportsType = "namespace";
|
---|
24 | parserState.module.buildInfo.strict = true;
|
---|
25 | parserState.module.buildInfo.exportsArgument = "__webpack_exports__";
|
---|
26 | if (isStrictHarmony) {
|
---|
27 | parserState.module.buildMeta.strictHarmonyModule = true;
|
---|
28 | parserState.module.buildInfo.moduleArgument = "__webpack_module__";
|
---|
29 | }
|
---|
30 | }
|
---|
31 | };
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * @param {ParserState} parserState parser state
|
---|
35 | * @returns {boolean} true, when enabled
|
---|
36 | */
|
---|
37 | exports.isEnabled = parserState => {
|
---|
38 | const value = parserStateExportsState.get(parserState);
|
---|
39 | return value === true;
|
---|
40 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.