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

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

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