source: trip-planner-front/node_modules/webpack/lib/dependencies/DynamicExports.js@ 84d0fbb

Last change on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.8 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>} */
11const parserStateExportsState = new WeakMap();
12
13/**
14 * @param {ParserState} parserState parser state
15 * @returns {void}
16 */
17exports.bailout = parserState => {
18 const value = parserStateExportsState.get(parserState);
19 parserStateExportsState.set(parserState, false);
20 if (value === true) {
21 parserState.module.buildMeta.exportsType = undefined;
22 parserState.module.buildMeta.defaultObject = false;
23 }
24};
25
26/**
27 * @param {ParserState} parserState parser state
28 * @returns {void}
29 */
30exports.enable = parserState => {
31 const value = parserStateExportsState.get(parserState);
32 if (value === false) return;
33 parserStateExportsState.set(parserState, true);
34 if (value !== true) {
35 parserState.module.buildMeta.exportsType = "default";
36 parserState.module.buildMeta.defaultObject = "redirect";
37 }
38};
39
40/**
41 * @param {ParserState} parserState parser state
42 * @returns {void}
43 */
44exports.setFlagged = parserState => {
45 const value = parserStateExportsState.get(parserState);
46 if (value !== true) return;
47 const buildMeta = parserState.module.buildMeta;
48 if (buildMeta.exportsType === "dynamic") return;
49 buildMeta.exportsType = "flagged";
50};
51
52/**
53 * @param {ParserState} parserState parser state
54 * @returns {void}
55 */
56exports.setDynamic = parserState => {
57 const value = parserStateExportsState.get(parserState);
58 if (value !== true) return;
59 parserState.module.buildMeta.exportsType = "dynamic";
60};
61
62/**
63 * @param {ParserState} parserState parser state
64 * @returns {boolean} true, when enabled
65 */
66exports.isEnabled = parserState => {
67 const value = parserStateExportsState.get(parserState);
68 return value === true;
69};
Note: See TracBrowser for help on using the repository browser.