source: frontend/node_modules/webpack/lib/dependencies/HarmonyExports.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.5 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
8const RuntimeGlobals = require("../RuntimeGlobals");
9
10/** @typedef {import("../Module").BuildInfo} BuildInfo */
11/** @typedef {import("../Module").BuildMeta} BuildMeta */
12/** @typedef {import("../javascript/JavascriptParser").JavascriptParserState} JavascriptParserState */
13
14/** @type {WeakMap<JavascriptParserState, boolean>} */
15const parserStateExportsState = new WeakMap();
16
17/**
18 * Processes the provided parser state.
19 * @param {JavascriptParserState} parserState parser state
20 * @param {boolean} isStrictHarmony strict harmony mode should be enabled
21 * @returns {void}
22 */
23module.exports.enable = (parserState, isStrictHarmony) => {
24 const value = parserStateExportsState.get(parserState);
25 if (value === false) return;
26 parserStateExportsState.set(parserState, true);
27 if (value !== true) {
28 const buildMeta = /** @type {BuildMeta} */ (parserState.module.buildMeta);
29 buildMeta.exportsType = "namespace";
30 const buildInfo = /** @type {BuildInfo} */ (parserState.module.buildInfo);
31 buildInfo.strict = true;
32 buildInfo.exportsArgument = RuntimeGlobals.exports;
33 if (isStrictHarmony) {
34 buildMeta.strictHarmonyModule = true;
35 buildInfo.moduleArgument = "__webpack_module__";
36 }
37 }
38};
39
40/**
41 * Returns true, when enabled.
42 * @param {JavascriptParserState} parserState parser state
43 * @returns {boolean} true, when enabled
44 */
45module.exports.isEnabled = (parserState) => {
46 const value = parserStateExportsState.get(parserState);
47 return value === true;
48};
Note: See TracBrowser for help on using the repository browser.