source: imaps-frontend/node_modules/enhanced-resolve/lib/createInnerContext.js@ 79a0317

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

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.0 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("./Resolver").ResolveContext} ResolveContext */
9
10/**
11 * @param {ResolveContext} options options for inner context
12 * @param {null|string} message message to log
13 * @returns {ResolveContext} inner context
14 */
15module.exports = function createInnerContext(options, message) {
16 let messageReported = false;
17 let innerLog = undefined;
18 if (options.log) {
19 if (message) {
20 /**
21 * @param {string} msg message
22 */
23 innerLog = msg => {
24 if (!messageReported) {
25 /** @type {(function(string): void)} */
26 (options.log)(message);
27 messageReported = true;
28 }
29
30 /** @type {(function(string): void)} */
31 (options.log)(" " + msg);
32 };
33 } else {
34 innerLog = options.log;
35 }
36 }
37
38 return {
39 log: innerLog,
40 yield: options.yield,
41 fileDependencies: options.fileDependencies,
42 contextDependencies: options.contextDependencies,
43 missingDependencies: options.missingDependencies,
44 stack: options.stack
45 };
46};
Note: See TracBrowser for help on using the repository browser.