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AA,iCAAgC,CAClE,kBACA,eAgBF,OAdyB,MAArB,EAAI,gBACN,EAAA,cAAA,YAAW,EAAuB,EAAI,qBAGlC,EAAA,kBAAA,gBAAe,EAAuB,mBAAmB,GACtD,GAAG,qUASL,IAAI,oBAAoB,EAAM,EAAK,QAA6B,EAAgB,MACxF,CAEM,eAAe,UAAU,EAAyB,GACvD,MAAM,QAAqB,mBAAmB,EAAM,GAGpD,GAAkB,OAFA,EAAa,UAG7B,OAAO,KAGT,MAAM,EAAa,EAAa,aAAe,aAAe,cACxD,EAAa,KAAK,QAAQ,EAAa,WAAY,QACnD,EAAc,CAClB,GAAG,KAAc,UACjB,GAAG,KAAc,IACjB,GAAG,UACH,GAGF,IAAK,MAAM,KAAQ,EAAa,OACT,EAAA,WAAA,YAAW,KAE9B,EAAA,gBAAA,UACE,EAAA,UAAA,QAAa,CACX,KAAM,IAIb,CACD,aAAa,EAAa,WAC3B,CAED,eAAe,iBAAiB,EAAgB,GAC9C,MAAM,EAA4B,GAClC,IAAK,MAAM,IAAO,CAAC,KAAM,KAAM,MAAO,OACpC,IAAK,MAAM,IAAQ,CAAC,QAAS,OAAQ,OACnC,EAAW,KAAK,GAAG,KAAQ,KAI/B,MAAM,QAAa,EAAA,QAAA,sBAAqB,EAAY,GACpD,GAAY,MAAR,EACF,MAAM,IAAI,MAAM,0BAA0B,KAAK,SAAS,EAAY,KAAK,KAAK,EAAQ,4EAExF,OAAO,CACR,CAED,eAAe,4BAA4B,GACzC,IAAK,MAAM,IAAQ,CAAC,WAAY,oBAAqB,6BACnD,IACE,aAAc,EAAA,WAAA,UAAS,KAAK,KAAK,EAAY,eAAgB,EAAM,kBAAkB,OACtF,CACD,MAAO,GACL,GAAe,WAAX,EAAE,KACJ,MAAM,CAET,CAEJ","file":"/npm/electron-webpack@2.8.2/out/main.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/electron-webpack@2.8.2/out/main.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import * as BluebirdPromise from \"bluebird\"\nimport { config as dotEnvConfig } from \"dotenv\"\nimport dotEnvExpand from \"dotenv-expand\"\nimport { pathExists, readJson } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { validateConfig } from \"read-config-file\"\nimport { deepAssign } from \"read-config-file/out/deepAssign\"\nimport \"source-map-support/register\"\nimport { Configuration, Plugin, RuleSetRule } from \"webpack\"\nimport merge from \"webpack-merge\"\nimport { getElectronWebpackConfiguration, getPackageMetadata } from \"./config\"\nimport { configureTypescript } from \"./configurators/ts\"\nimport { configureVue } from \"./configurators/vue/vue\"\nimport { ConfigurationEnv, ConfigurationType, ElectronWebpackConfiguration, PackageMetadata, PartConfiguration } from \"./core\"\nimport { BaseTarget } from \"./targets/BaseTarget\"\nimport { MainTarget } from \"./targets/MainTarget\"\nimport { BaseRendererTarget, RendererTarget } from \"./targets/RendererTarget\"\nimport { getFirstExistingFile } from \"./util\"\n\nexport { ElectronWebpackConfiguration } from \"./core\"\n\nconst _debug = require(\"debug\")\n\n// noinspection JSUnusedGlobalSymbols\nexport function getAppConfiguration(env: ConfigurationEnv) {\n  return BluebirdPromise.filter([configure(\"main\", env), configure(\"renderer\", env)], it => it != null)\n}\n\n// noinspection JSUnusedGlobalSymbols\nexport function getMainConfiguration(env: ConfigurationEnv) {\n  return configure(\"main\", env)\n}\n\n// noinspection JSUnusedGlobalSymbols\nexport function getRendererConfiguration(env: ConfigurationEnv) {\n  return configure(\"renderer\", env)\n}\n\n// in the future, if need, isRenderer = true arg can be added\n// noinspection JSUnusedGlobalSymbols\nexport function getDllConfiguration(env: ConfigurationEnv) {\n  return configure(\"renderer-dll\", env)\n}\n\n// noinspection JSUnusedGlobalSymbols\nexport async function getTestConfiguration(env: ConfigurationEnv) {\n  const configurator = await createConfigurator(\"test\", env)\n  return await configurator.configure({\n    testComponents: path.join(process.cwd(), \"src/renderer/components/testComponents.ts\"),\n  })\n}\n\nexport class WebpackConfigurator {\n  readonly projectDir: string\n\n  private electronVersionPromise = new Lazy(() => getInstalledElectronVersion(this.projectDir))\n\n  readonly isRenderer: boolean\n  readonly isProduction: boolean\n  readonly isTest = this.type === \"test\"\n\n  readonly sourceDir: string\n  readonly staticSourceDirectory: string\n  readonly commonSourceDirectory: string\n  readonly commonDistDirectory: string\n\n  readonly rendererTemplate: string\n\n  readonly debug = _debug(`electron-webpack:${this.type}`)\n\n  private _configuration: Configuration | null = null\n\n  get config(): Configuration {\n    return this._configuration!!\n  }\n\n  readonly rules: Array<RuleSetRule> = []\n  readonly plugins: Array<Plugin> = []\n\n  // js must be first - e.g. iView has two files loading-bar.js and loading-bar.vue - when we require \"loading-bar\", js file must be resolved and not vue\n  readonly extensions: Array<string> = [\".js\", \".json\", \".node\"]\n\n  private _electronVersion: string | null = null\n\n  get electronVersion(): string {\n    return this._electronVersion!!\n  }\n\n  readonly entryFiles: Array<string> = []\n\n  // electronWebpackConfiguration expected to be resolved (use getElectronWebpackConfiguration())\n  constructor(readonly type: ConfigurationType, readonly env: ConfigurationEnv, readonly electronWebpackConfiguration: ElectronWebpackConfiguration, readonly metadata: PackageMetadata) {\n    if (metadata.dependencies == null) {\n      metadata.dependencies = {}\n    }\n    if (metadata.devDependencies == null) {\n      metadata.devDependencies = {}\n    }\n\n    this.projectDir = electronWebpackConfiguration.projectDir!!\n    this.isRenderer = type.startsWith(\"renderer\")\n    process.env.BABEL_ENV = type\n\n    this.isProduction = this.env.production == null ? process.env.NODE_ENV === \"production\" : this.env.production\n\n    this.debug(`isProduction: ${this.isProduction}`)\n\n    this.sourceDir = this.getSourceDirectory(this.type)!!\n\n    this.staticSourceDirectory = this.electronWebpackConfiguration.staticSourceDirectory!!\n    this.commonSourceDirectory = this.electronWebpackConfiguration.commonSourceDirectory!!\n    this.commonDistDirectory = this.electronWebpackConfiguration.commonDistDirectory!!\n\n    this.rendererTemplate = (this.electronWebpackConfiguration.renderer && this.electronWebpackConfiguration.renderer.template) || \"src/index.ejs\"\n  }\n\n  /**\n   * Returns null if code processing for type is disabled.\n   */\n  getSourceDirectory(type: ConfigurationType): string | null {\n    const part = this.getPartConfiguration(type)\n    if (part === null || (part != null && part.sourceDirectory === null)) {\n      // part or sourceDirectory is explicitly set to null\n      return null\n    }\n\n    const result = part == null ? null : part.sourceDirectory\n    if (result == null) {\n      return path.join(this.projectDir, \"src\", type.startsWith(\"renderer\") || type === \"test\" ? \"renderer\" : type)\n    }\n    else {\n      return path.resolve(this.projectDir, result)\n    }\n  }\n\n  getPartConfiguration(type: ConfigurationType): PartConfiguration | null | undefined {\n    if (type === \"main\") {\n      return this.electronWebpackConfiguration.main\n    }\n    else {\n      return this.electronWebpackConfiguration.renderer\n    }\n  }\n\n  hasDependency(name: string) {\n    return name in this.metadata.dependencies || this.hasDevDependency(name)\n  }\n\n  hasDevDependency(name: string) {\n    return name in this.metadata.devDependencies\n  }\n\n  /**\n   * Returns the names of devDependencies that match a given string or regex.\n   * If no matching dependencies are found, an empty array is returned.\n   *\n   * @return list of matching dependency names, e.g. `[\"@babel/preset-react\", \"@babel/preset-stage-0\"]`\n   */\n  getMatchingDevDependencies(options: GetMatchingDevDependenciesOptions = {}) {\n    const includes = options.includes || []\n    const excludes = new Set(options.excludes || [])\n    return Object.keys(this.metadata.devDependencies)\n      .filter(name => !excludes.has(name) && includes.some(prefix => name.startsWith(prefix)))\n  }\n\n  async configure(entry?: { [key: string]: any } | null) {\n    // noinspection SpellCheckingInspection\n    this._configuration = {\n      context: this.projectDir,\n      devtool: this.isProduction || this.isTest ? \"nosources-source-map\" : \"eval-source-map\",\n      externals: this.computeExternals(),\n      node: {\n        __dirname: !this.isProduction,\n        __filename: !this.isProduction,\n      },\n      output: {\n        filename: \"[name].js\",\n        chunkFilename: \"[name].bundle.js\",\n        libraryTarget: \"commonjs2\",\n        path: path.join(this.commonDistDirectory, this.type)\n      },\n      target: this.isTest ? \"node\" : `electron-${this.type === \"renderer-dll\" ? \"renderer\" : this.type}` as any,\n      resolve: {\n        alias: {\n          \"@\": this.sourceDir,\n          common: this.commonSourceDirectory,\n        },\n        extensions: this.extensions,\n      },\n      module: {\n        rules: this.rules,\n      },\n      plugins: this.plugins,\n    }\n\n    if (entry != null) {\n      this._configuration.entry = entry\n    }\n\n    // if electronVersion not specified, use latest\n    this._electronVersion = this.electronWebpackConfiguration.electronVersion || await this.electronVersionPromise.value || \"3.0.7\"\n    const target = (() => {\n      switch (this.type) {\n        case \"renderer\": return new RendererTarget()\n        case \"renderer-dll\": return new BaseRendererTarget()\n        case \"test\": return new BaseRendererTarget()\n        case \"main\": return new MainTarget()\n        default: return new BaseTarget()\n      }\n    })()\n    this.debug(`Target class: ${target.constructor.name}`)\n    target.configureRules(this)\n    await Promise.all([target.configurePlugins(this), configureTypescript(this)])\n    configureVue(this)\n\n    if (this.debug.enabled) {\n      this.debug(`\\n\\n${this.type} config:` + JSON.stringify(this._configuration, null, 2) + \"\\n\\n\")\n    }\n\n    if (this.config.entry == null) {\n      this.entryFiles.push((await computeEntryFile(this.sourceDir, this.projectDir))!!)\n      this.config.entry = {\n        [this.type]: this.entryFiles,\n      }\n\n      const mainConfiguration = this.electronWebpackConfiguration.main || {}\n      let extraEntries = mainConfiguration.extraEntries\n      if (this.type === \"main\" && extraEntries != null) {\n        if (typeof extraEntries === \"string\") {\n          extraEntries = [extraEntries]\n        }\n\n        if (Array.isArray(extraEntries)) {\n          for (const p of extraEntries) {\n            this.config.entry[path.basename(p, path.extname(p))] = p\n          }\n        }\n        else {\n          Object.assign(this.config.entry, extraEntries)\n        }\n      }\n    }\n\n    // noinspection ES6RedundantAwait\n    this._configuration = await Promise.resolve(this.applyCustomModifications(this.config))\n\n    return this.config\n  }\n\n  private applyCustomModifications(config: Configuration): Configuration {\n    const { renderer, main } = this.electronWebpackConfiguration\n\n    const applyCustom = (configPath: string) => {\n      const customModule = require(path.join(this.projectDir, configPath))\n      if (typeof customModule === \"function\") {\n        return customModule(config, this)\n      }\n      else {\n        return merge.smart(config, customModule)\n      }\n    }\n\n    if (this.type === \"renderer\" && renderer && renderer.webpackConfig) {\n      return applyCustom(renderer.webpackConfig)\n    }\n    else if (this.type === \"renderer-dll\" && renderer && renderer.webpackDllConfig) {\n      return applyCustom(renderer.webpackDllConfig)\n    }\n    else if (this.type === \"main\" && main && main.webpackConfig) {\n      return applyCustom(main.webpackConfig)\n    }\n    else {\n      return config\n    }\n  }\n\n  private computeExternals() {\n    const whiteListedModules = new Set(this.electronWebpackConfiguration.whiteListedModules || [])\n    if (this.isRenderer) {\n      whiteListedModules.add(\"react\")\n      whiteListedModules.add(\"react-dom\")\n      whiteListedModules.add(\"vue\")\n    }\n\n    const filter = (name: string) => !name.startsWith(\"@types/\") && (whiteListedModules == null || !whiteListedModules.has(name))\n    const externals: Array<string> = Object.keys(this.metadata.dependencies).filter(filter)\n    externals.push(\"electron\")\n    externals.push(\"webpack\")\n    // because electron-devtools-installer specified in the devDependencies, but required in the index.dev\n    externals.push(\"electron-devtools-installer\")\n    if (this.type === \"main\") {\n      externals.push(\"webpack/hot/log-apply-result\")\n      externals.push(\"electron-webpack/out/electron-main-hmr/HmrClient\")\n      externals.push(\"source-map-support/source-map-support.js\")\n    }\n\n    if (this.electronWebpackConfiguration.externals != null) {\n      return externals.concat(this.electronWebpackConfiguration.externals)\n    }\n\n    return externals\n  }\n}\n\nconst schemeDataPromise = new Lazy(() => readJson(path.join(__dirname, \"..\", \"scheme.json\")))\n\nexport async function createConfigurator(type: ConfigurationType, env: ConfigurationEnv | null) {\n  if (env != null) {\n    // allow to pass as `--env.autoClean=false` webpack arg\n    const _env: any = env\n    for (const name of [\"minify\", \"autoClean\", \"production\"]) {\n      if (_env[name] === \"true\") {\n        _env[name] = true\n      }\n      else if (_env[name] === \"false\") {\n        _env[name] = false\n      }\n    }\n  }\n\n  if (env == null) {\n    env = {}\n  }\n\n  const projectDir = (env.configuration || {}).projectDir || process.cwd()\n  const packageMetadata = getPackageMetadata(projectDir)\n  const electronWebpackConfig = await getElectronWebpackConfiguration({\n    packageMetadata,\n    projectDir,\n  })\n  if (env.configuration != null) {\n    deepAssign(electronWebpackConfig, env.configuration)\n  }\n\n  await validateConfig(electronWebpackConfig, schemeDataPromise, message => {\n    return `${message}\n\nHow to fix:\n1. Open https://webpack.electron.build/configuration\n2. Search the option name on the page.\n  * Not found? The option was deprecated or not exists (check spelling).\n  * Found? Check that the option in the appropriate place. e.g. \"sourceDirectory\" only in the \"main\" or \"renderer\", not in the root.\n`\n  })\n  return new WebpackConfigurator(type, env, electronWebpackConfig, await packageMetadata.value)\n}\n\nexport async function configure(type: ConfigurationType, env: ConfigurationEnv | null): Promise<Configuration | null> {\n  const configurator = await createConfigurator(type, env)\n  const sourceDir = configurator.sourceDir\n  // explicitly set to null - do not handle at all and do not show info message\n  if (sourceDir === null) {\n    return null\n  }\n\n  const processEnv = configurator.isProduction ? \"production\" : \"development\"\n  const dotEnvPath = path.resolve(configurator.projectDir, \".env\")\n  const dotenvFiles = [\n    `${dotEnvPath}.${processEnv}.local`,\n    `${dotEnvPath}.${processEnv}`,\n    `${dotEnvPath}.local`,\n    dotEnvPath,\n  ]\n\n  for (const file of dotenvFiles) {\n    const exists = await pathExists(file)\n    if (exists) {\n      dotEnvExpand(\n        dotEnvConfig({\n          path: file\n        })\n      )\n    }\n  }\n  return await configurator.configure()\n}\n\nasync function computeEntryFile(srcDir: string, projectDir: string): Promise<string | null> {\n  const candidates: Array<string> = []\n  for (const ext of [\"ts\", \"js\", \"tsx\", \"jsx\"]) {\n    for (const name of [\"index\", \"main\", \"app\"]) {\n      candidates.push(`${name}.${ext}`)\n    }\n  }\n\n  const file = await getFirstExistingFile(candidates, srcDir)\n  if (file == null) {\n    throw new Error(`Cannot find entry file ${path.relative(projectDir, path.join(srcDir, \"index.ts\"))} (or main.ts, or app.ts, or index.js, or main.js, or app.js)`)\n  }\n  return file\n}\n\nasync function getInstalledElectronVersion(projectDir: string) {\n  for (const name of [\"electron\", \"electron-prebuilt\", \"electron-prebuilt-compile\"]) {\n    try {\n      return (await readJson(path.join(projectDir, \"node_modules\", name, \"package.json\"))).version\n    }\n    catch (e) {\n      if (e.code !== \"ENOENT\") {\n        throw e\n      }\n    }\n  }\n}\n\nexport interface GetMatchingDevDependenciesOptions {\n  /**\n   * The list of prefixes to include, e.g. `[\"babel-preset-\"]`.\n   */\n  includes?: Array<string>\n  /**\n   * The list of names to exclude.\n   */\n  excludes?: Array<string>\n}\n"]}