Sha256: e8dad81cee136d7fe2ff9a89b9965227d30bf0cbd854164471b93b8f0186d3ee

Contents?: true

Size: 1.51 KB

Versions: 7

Compression:

Stored size: 1.51 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = normalizeOptions;

function _path() {
  const data = require("path");

  _path = function () {
    return data;
  };

  return data;
}

function normalizeOptions(config) {
  const {
    filename,
    cwd,
    filenameRelative = typeof filename === "string" ? _path().relative(cwd, filename) : "unknown",
    sourceType = "module",
    inputSourceMap,
    sourceMaps = !!inputSourceMap,
    sourceRoot = config.options.moduleRoot,
    sourceFileName = _path().basename(filenameRelative),
    comments = true,
    compact = "auto"
  } = config.options;
  const opts = config.options;
  const options = Object.assign({}, opts, {
    parserOpts: Object.assign({
      sourceType: _path().extname(filenameRelative) === ".mjs" ? "module" : sourceType,
      sourceFileName: filename,
      plugins: []
    }, opts.parserOpts),
    generatorOpts: Object.assign({
      filename,
      auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
      auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
      retainLines: opts.retainLines,
      comments,
      shouldPrintComment: opts.shouldPrintComment,
      compact,
      minified: opts.minified,
      sourceMaps,
      sourceRoot,
      sourceFileName
    }, opts.generatorOpts)
  });

  for (const plugins of config.passes) {
    for (const plugin of plugins) {
      if (plugin.manipulateOptions) {
        plugin.manipulateOptions(options, options.parserOpts);
      }
    }
  }

  return options;
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
disco_app-0.16.1 test/dummy/node_modules/@babel/core/lib/transformation/normalize-opts.js
disco_app-0.15.2 test/dummy/node_modules/@babel/core/lib/transformation/normalize-opts.js
disco_app-0.18.4 test/dummy/node_modules/@babel/core/lib/transformation/normalize-opts.js
disco_app-0.18.1 test/dummy/node_modules/@babel/core/lib/transformation/normalize-opts.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/@babel/core/lib/transformation/normalize-opts.js
disco_app-0.14.0 test/dummy/node_modules/@babel/core/lib/transformation/normalize-opts.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/@babel/core/lib/transformation/normalize-opts.js