执行过npm install命令的vue-element-admin源码
康凯
2022-05-20 aa4c235a8ca67ea8b731f90c951a465e92c0a865
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
'use strict';
 
Object.defineProperty(exports, '__esModule', {
  value: true
});
exports.default = _default;
 
function _istanbulLibInstrument() {
  const data = require('istanbul-lib-instrument');
 
  _istanbulLibInstrument = function _istanbulLibInstrument() {
    return data;
  };
 
  return data;
}
 
function _istanbulLibCoverage() {
  const data = require('istanbul-lib-coverage');
 
  _istanbulLibCoverage = function _istanbulLibCoverage() {
    return data;
  };
 
  return data;
}
 
function _transform() {
  const data = require('@jest/transform');
 
  _transform = function _transform() {
    return data;
  };
 
  return data;
}
 
/**
 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
function _default(source, filename, globalConfig, config, changedFiles) {
  const coverageOptions = {
    changedFiles,
    collectCoverage: globalConfig.collectCoverage,
    collectCoverageFrom: globalConfig.collectCoverageFrom,
    collectCoverageOnlyFrom: globalConfig.collectCoverageOnlyFrom
  };
  let coverageWorkerResult = null;
 
  if ((0, _transform().shouldInstrument)(filename, coverageOptions, config)) {
    // Transform file with instrumentation to make sure initial coverage data is well mapped to original code.
    const _transformSource = new (_transform()).ScriptTransformer(
        config
      ).transformSource(filename, source, true),
      code = _transformSource.code,
      mapCoverage = _transformSource.mapCoverage,
      sourceMapPath = _transformSource.sourceMapPath;
 
    const extracted = (0, _istanbulLibInstrument().readInitialCoverage)(code); // Check extracted initial coverage is not null, this can happen when using /* istanbul ignore file */
 
    if (extracted) {
      coverageWorkerResult = {
        coverage: (0, _istanbulLibCoverage().createFileCoverage)(
          extracted.coverageData
        ),
        sourceMapPath: mapCoverage ? sourceMapPath : null
      };
    }
  }
 
  return coverageWorkerResult;
}