web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.4 KiB

  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.worker = worker;
  6. function _exit() {
  7. const data = _interopRequireDefault(require('exit'));
  8. _exit = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. function fs() {
  14. const data = _interopRequireWildcard(require('graceful-fs'));
  15. fs = function () {
  16. return data;
  17. };
  18. return data;
  19. }
  20. var _generateEmptyCoverage = _interopRequireDefault(
  21. require('./generateEmptyCoverage')
  22. );
  23. function _getRequireWildcardCache() {
  24. if (typeof WeakMap !== 'function') return null;
  25. var cache = new WeakMap();
  26. _getRequireWildcardCache = function () {
  27. return cache;
  28. };
  29. return cache;
  30. }
  31. function _interopRequireWildcard(obj) {
  32. if (obj && obj.__esModule) {
  33. return obj;
  34. }
  35. if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
  36. return {default: obj};
  37. }
  38. var cache = _getRequireWildcardCache();
  39. if (cache && cache.has(obj)) {
  40. return cache.get(obj);
  41. }
  42. var newObj = {};
  43. var hasPropertyDescriptor =
  44. Object.defineProperty && Object.getOwnPropertyDescriptor;
  45. for (var key in obj) {
  46. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  47. var desc = hasPropertyDescriptor
  48. ? Object.getOwnPropertyDescriptor(obj, key)
  49. : null;
  50. if (desc && (desc.get || desc.set)) {
  51. Object.defineProperty(newObj, key, desc);
  52. } else {
  53. newObj[key] = obj[key];
  54. }
  55. }
  56. }
  57. newObj.default = obj;
  58. if (cache) {
  59. cache.set(obj, newObj);
  60. }
  61. return newObj;
  62. }
  63. function _interopRequireDefault(obj) {
  64. return obj && obj.__esModule ? obj : {default: obj};
  65. }
  66. /**
  67. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  68. *
  69. * This source code is licensed under the MIT license found in the
  70. * LICENSE file in the root directory of this source tree.
  71. */
  72. // Make sure uncaught errors are logged before we exit.
  73. process.on('uncaughtException', err => {
  74. console.error(err.stack);
  75. (0, _exit().default)(1);
  76. });
  77. function worker({config, globalConfig, path, options}) {
  78. return (0, _generateEmptyCoverage.default)(
  79. fs().readFileSync(path, 'utf8'),
  80. path,
  81. globalConfig,
  82. config,
  83. (options === null || options === void 0 ? void 0 : options.changedFiles) &&
  84. new Set(options.changedFiles),
  85. (options === null || options === void 0
  86. ? void 0
  87. : options.sourcesRelatedToTestsInChangedFiles) &&
  88. new Set(options.sourcesRelatedToTestsInChangedFiles)
  89. );
  90. }