<commit_before>const childProcess = require('child_process');
const fs = require('fs');
const path = require('path');
const electronLink = require('electron-link');
const terser = require('terser');
const CONFIG = require('../config');

module.exports = function(packagedAppPath) {
  const snapshotScriptPath = path.join(CONFIG.buildOutputPath, 'startup.js');
  const coreModules = new Set([
    'electron',
    'atom',
    'shell',
    'WNdb',
    'lapack',
    'remote'
  ]);
  const baseDirPath = path.join(CONFIG.intermediateAppPath, 'static');
  let processedFiles = 0;

  return electronLink({
    baseDirPath,
    mainPath: path.resolve(
      baseDirPath,
      '..',
      'src',
      'initialize-application-window.js'
    ),
    cachePath: path.join(CONFIG.atomHomeDirPath, 'snapshot-cache'),
    auxiliaryData: CONFIG.snapshotAuxiliaryData,
    shouldExcludeModule: ({ requiringModulePath, requiredModulePath }) => {
      if (processedFiles > 0) {
        process.stdout.write('\r');
      }
      process.stdout.write(
        `Generating snapshot script at "${snapshotScriptPath}" (${++processedFiles})`
      );

      const requiringModuleRelativePath = path.relative(
        baseDirPath,
        requiringModulePath
      );
      const requiredModuleRelativePath = path.relative(
        baseDirPath,
        requiredModulePath
      );
      return (
        requiredModulePath.endsWith('.node') ||
        coreModules.has(requiredModulePath) ||
        requiringModuleRelativePath.endsWith(
          path.join('node_modules/xregexp/xregexp-all.js')
        ) ||
        (requiredModuleRelativePath.startsWith(path.join('..', 'src')) &&
          requiredModuleRelativePath.endsWith('-element.js')) ||
        requiredModuleRelativePath.startsWith(
          path.join('..', 'node_modules', 'dugite')
        ) ||
        requiredModuleRelativePath.startsWith(
          path.join(
            '..',
            'node_modules',
            'markdown-preview',
            'node_modules',
            'yaml-front-matter'
          )
        ) ||
        requiredModuleRelativePath.startsWith(
          path.join(
            '..',
            'node_modules',
            'markdown-preview',
            'node_modules',
            'cheerio'
          )
        ) ||
        requiredModuleRelativePath.startsWith(
          path.join(
            '..',
            'node_modules',
            'markdown-preview',
            'node_modules',
            'marked'
          )
        ) ||
        requiredModuleRelativePath.startsWith(
          path.join('..', 'node_modules', 'typescript-simple')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join(
            'node_modules',
            'coffee-script',
            'lib',
            'coffee-script',
            'register.js'
          )
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'fs-extra', 'lib', 'index.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'graceful-fs', 'graceful-fs.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'htmlparser2', 'lib', 'index.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'minimatch', 'minimatch.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'request', 'index.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'request', 'request.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'superstring', 'index.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'temp', 'lib', 'temp.js')
        ) ||<commit_msg>fixed build error<commit_after>const childProcess = require('child_process');
const fs = require('fs');
const path = require('path');
const electronLink = require('electron-link');
const terser = require('terser');
const CONFIG = require('../config');

module.exports = function(packagedAppPath) {
  const snapshotScriptPath = path.join(CONFIG.buildOutputPath, 'startup.js');
  const coreModules = new Set([
    'electron',
    'atom',
    'shell',
    'WNdb',
    'lapack',
    'remote'
  ]);
  const baseDirPath = path.join(CONFIG.intermediateAppPath, 'static');
  let processedFiles = 0;

  return electronLink({
    baseDirPath,
    mainPath: path.resolve(
      baseDirPath,
      '..',
      'src',
      'initialize-application-window.js'
    ),
    cachePath: path.join(CONFIG.atomHomeDirPath, 'snapshot-cache'),
    auxiliaryData: CONFIG.snapshotAuxiliaryData,
    shouldExcludeModule: ({ requiringModulePath, requiredModulePath }) => {
      if (processedFiles > 0) {
        process.stdout.write('\r');
      }
      process.stdout.write(
        `Generating snapshot script at "${snapshotScriptPath}" (${++processedFiles})`
      );

      const requiringModuleRelativePath = path.relative(
        baseDirPath,
        requiringModulePath
      );
      const requiredModuleRelativePath = path.relative(
        baseDirPath,
        requiredModulePath
      );
      return (
        requiredModulePath.endsWith('.node') ||
        coreModules.has(requiredModulePath) ||
        requiringModuleRelativePath.endsWith(
          path.join('node_modules/xregexp/xregexp-all.js')
        ) ||
        (requiredModuleRelativePath.startsWith(path.join('..', 'src')) &&
          requiredModuleRelativePath.endsWith('-element.js')) ||
        requiredModuleRelativePath.startsWith(
          path.join('..', 'node_modules', 'dugite')
        ) ||
        requiredModuleRelativePath.startsWith(
          path.join(
            '..',
            'node_modules',
            'markdown-preview',
            'node_modules',
            'yaml-front-matter'
          )
        ) ||
        requiredModuleRelativePath.startsWith(
          path.join(
            '..',
            'node_modules',
            'markdown-preview',
            'node_modules',
            'cheerio'
          )
        ) ||
        requiredModuleRelativePath.startsWith(
          path.join(
            '..',
            'node_modules',
            'markdown-preview',
            'node_modules',
            'marked'
          )
        ) ||
        requiredModuleRelativePath.startsWith(
          path.join('..', 'node_modules', 'typescript-simple')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join(
            'node_modules',
            'coffee-script',
            'lib',
            'coffee-script',
            'register.js'
          )
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'fs-extra', 'lib', 'index.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'graceful-fs', 'graceful-fs.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'htmlparser2', 'lib', 'index.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'minimatch', 'minimatch.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'request', 'index.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'request', 'request.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'superstring', 'index.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'temp', 'lib', 'temp.js')
        ) ||
        requiredModuleRelativePath.endsWith(
          path.join('node_modules', 'parse5', 'lib', 'index.js')
        ) ||
{'fraction_non_alphanumeric': 0.13585774593833952, 'fraction_numerical': 0.0008954842011001664, 'mean_word_length': 2.1639012545528127, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1545893', 'n_tokens_mistral': 2187, 'n_tokens_neox': 2196, 'n_words': 315}