3296bed6433a390964039d6a817bd7728fa4fe6cca4f4b73127a90eaf322063800e8e6b9bcdf276e0535426904462c53f511ef0116105a3bcc87a0e9dfa334 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = normalizeOptions;
  6. function _path() {
  7. const data = require("path");
  8. _path = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. function normalizeOptions(config) {
  14. const {
  15. filename,
  16. cwd,
  17. filenameRelative = typeof filename === "string" ? _path().relative(cwd, filename) : "unknown",
  18. sourceType = "module",
  19. inputSourceMap,
  20. sourceMaps = !!inputSourceMap,
  21. sourceRoot = config.options.moduleRoot,
  22. sourceFileName = _path().basename(filenameRelative),
  23. comments = true,
  24. compact = "auto"
  25. } = config.options;
  26. const opts = config.options;
  27. const options = Object.assign({}, opts, {
  28. parserOpts: Object.assign({
  29. sourceType: _path().extname(filenameRelative) === ".mjs" ? "module" : sourceType,
  30. sourceFileName: filename,
  31. plugins: []
  32. }, opts.parserOpts),
  33. generatorOpts: Object.assign({
  34. filename,
  35. auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
  36. auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
  37. retainLines: opts.retainLines,
  38. comments,
  39. shouldPrintComment: opts.shouldPrintComment,
  40. compact,
  41. minified: opts.minified,
  42. sourceMaps,
  43. sourceRoot,
  44. sourceFileName
  45. }, opts.generatorOpts)
  46. });
  47. for (const plugins of config.passes) {
  48. for (const plugin of plugins) {
  49. if (plugin.manipulateOptions) {
  50. plugin.manipulateOptions(options, options.parserOpts);
  51. }
  52. }
  53. }
  54. return options;
  55. }
  56. 0 && 0;
  57. //# sourceMappingURL=normalize-opts.js.map