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AAe,EAGhD,aAAa,GAQjC,OAPA,EAAK,OAAO,OAAO,QAAQ,KAAK,IAAI,OAAO,IAAK,KAAU,MAK1D,EAAK,OAAO,QAAQ,MAAM,GAAG,MAAW,iBAAiB,IAElD,IAGgC,GAIzC,GAAI,EAAQ,cAAc,OAAS,EAAG,MAEQ,IAAlC,EAAQ,OAAO,OAAO,UAC9B,EAAQ,OAAO,OAAgB,QAAI,IAIrC,MAAM,EAAQ,EAAQ,cAAc,KAAK,KACnC,EAAM,EAAQ,OAAS,YAAe,GAGtC,EAAgB,CACpB,KAHiB,IAAI,OAAO,IAAI,KAAS,WAIzC,OAAQ,uBAGV,EAAQ,OAAO,OAAO,QAAQ,KAAK,EACrC,CAEA,OAAO,EAAQ,MACjB,CACF,CAIA,SAAS,aAAa,GACpB,OAAO,EAAI,QAAQ,sCAAuC,OAC5D,CAJA,OAAO,QAAU,CAAE,sBAAY,kBAAU","file":"/npm/react-noparse@0.0.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-noparse@0.0.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict'\n\nconst path = require('path')\n\n/**\n * @const {Object} defaults - Provide some common configuration defaults\n*/\nconst defaults = {\n  React: {\n    distPath: 'react/dist/react.js'\n  },\n  ReactDOM: {\n    distPath: 'react-dom/dist/react-dom.js',\n    importReact: true\n  },\n  ReactRouter: {\n    distPath: 'react-router/umd/ReactRouter.js',\n    importReact: true\n  }\n}\n\n/**\n * Create a minimal base webpack configuration\n * @return {Object}\n*/\nconst baseConfig = () => ({\n  module: {\n    noParse: []\n  },\n  resolve: {\n    alias: {}\n  }\n})\n\n/**\n * Returns a function that mutates a webpack configuration\n * @param {boolean|Object[]|String[]} libs - All, Path, or Array of Paths(s) to UMD builds\n * @param {string}  libs[].distPath - String of path to dist (required)\n * @param {boolean} libs[].importReact - Whether or not to expose react\n * @param {boolean} useMin - Use minified lib (default=true in `production`)\n */\nfunction noParse (libs, opts) {\n\n  // Shortcut syntax, use defaults\n  if (typeof libs === 'boolean' && libs === true) {\n    libs = [\n      defaults.React,\n      defaults.ReactDOM,\n      defaults.ReactRouter\n    ]\n  }\n\n  /**\n   * Mutates json web\n   * @param {Object}  config - JSON webpack configuration (required)\n   */\n  return function mutatorFn (config) {\n    if (Array.isArray(libs) === false) {\n      libs = [libs]\n    }\n\n    if (typeof opts === 'boolean' && opts === true) {\n      opts = { useMin: true }\n    }\n\n    if (typeof opts !== 'undefined' && typeof opts !== 'object') {\n      throw new TypeError(\n        'Expected `options` to be a boolean or object, received: ' + opts\n      )\n    }\n\n    const defaultOptions = {\n      useMin: false\n    }\n\n    const options = Object.assign({}, defaultOptions, opts)\n\n    if (process.env['NODE_ENV'] === 'production') {\n      options.useMin = true\n\n      console.warn(`\n        Warning: 'react-noparse' is not designed for use in production.\n        In a production build, external modules should use 'config.externals'\n        and load the library from a CDN in index.html.\n      `)\n    }\n\n    const initialState = {\n      config: Object.assign({}, baseConfig(), config),\n      requiresReact: []\n    }\n\n    if (typeof config.module.noParse === 'undefined') {\n      initialState.config.module['noParse'] = []\n    }\n\n    if (config.resolve && typeof config.resolve.alias === 'undefined') {\n      initialState.config.resolve['alias'] = {}\n    }\n\n    // Callback for `libs.reduce`\n    const processNext = (data, lib) => {\n      let dist\n\n      if (typeof lib === 'object' && typeof lib['distPath'] === 'undefined') {\n        throw new Error(\n          'Lib config objects must contain a `distPath` key' + lib\n        )\n      }\n\n      if (typeof lib === 'string') {\n        dist = lib\n      } else {\n        dist = lib.distPath\n      }\n\n      // Extract package name for aliasing\n      const name = dist.split(path.sep)[0]\n\n      // Flag react libs for bulding loader query\n      if (lib['importReact'] === true) {\n        data.requiresReact.push(name)\n      }\n\n      // Append `.min` to dist filename in production\n      const useMin = options['useMin']\n      const fullPath = useMin ? dist.replace(/(.*)\\.js$/g, '$1.min.js') : dist\n\n      // Tell webpack not to parse or bundle the provided libraries\n      const noParseTest = escapeRegExp(fullPath)\n      data.config.module.noParse.push(new RegExp(`\\/${name}\\/`, 'g'))\n\n      // Since webpack is skipping these paths, we need to let it know\n      // where to find the modules by creating aliases that will resolve\n      // to the distribution (note: must be a true UMD distribution)\n      data.config.resolve.alias[`${name}$`] = `/node_modules/${fullPath}`\n\n      return data\n    }\n\n    const results = libs.reduce(processNext, initialState)\n\n    // Expose React to modules that require it\n    // Note: If using react at all, always required for `react-dom`\n    if (results.requiresReact.length > 0) {\n\n      if(typeof results.config.module.loaders === 'undefined') {\n        results.config.module['loaders'] = []\n      }\n\n      // Build regex test for importsLoader\n      const names = results.requiresReact.join('|')\n      const min = options.useMin ? '(\\\\\\.min)?' : ''\n      const loaderTest = new RegExp(`(${names})${min}\\\\\\.js$`)\n\n      const importsLoader = {\n        test: loaderTest,\n        loader: 'imports?React=react'\n      }\n\n      results.config.module.loaders.push(importsLoader);\n    }\n\n    return results.config\n  }\n}\n\nmodule.exports = { baseConfig, defaults, noParse }\n\nfunction escapeRegExp(str) {\n  return str.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\");\n}\n"]}