Written as method to easily not include webpacker for case when either
 webpacker not installed at all or disabled upon `jets deploy`.
559851
def use_webpacker(middleware)
      return unless Jets.webpacker? # checks for local development if webpacker installed
      # Different check for middleware because we need webpacker helpers for url helpers.
      # But we dont want to actually serve via webpacker middleware when running on AWS.
      # By this time the url helpers are serving assets out of s3.
      return if File.exist?("#{Jets.root}/config/disable-webpacker-middleware.txt") # created as part of `jets deploy`
      require "jets/controller/middleware/webpacker_setup"
      middleware.use Webpacker::DevServerProxy
    end
431229
function iif(condition, trueResult, falseResult) {
    if (trueResult === void 0) {
        trueResult = _empty__WEBPACK_IMPORTED_MODULE_1__["EMPTY"];
    }
    if (falseResult === void 0) {
        falseResult = _empty__WEBPACK_IMPORTED_MODULE_1__["EMPTY"];
    }
    return Object(_defer__WEBPACK_IMPORTED_MODULE_0__["defer"])(function () { return condition() ? trueResult : falseResult; });
}
77741
private void removeFromWebContainer() {
        if (!Thread.holdsLock(terminated)) {
            throw new IllegalStateException();
        }
        synchronized (addRemoveLock) {
            //we'll either succeed or fail at the removal, but either
            //way we want to guarantee the tracker is closed.
            closeTracker();
            if (getDeployedModuleInfo() != null) {
                //uninstall can only fail if the webcontainer has gone away..
                //so we do not need to check if it returns true/false
                //as in both cases, we wish to unregister, and declare we are
                //undeployed.
                installer.uninstallFromWebContainer(this);
                unregister();
                setState(State.UNDEPLOYED);
            }
        }
    }
1250217
def forget_importer(name):
    '''
    
    '''
    global importers
    name = name.lower()
    if name in importers:
        importers = importers.discard(name)
        delattr(load, name)
        return True
    else:
        return False
619077
def clean(context: Context, delete_dependencies: bool = False):
    
    paths = [context.app.asset_build_path, context.app.collected_assets_path, context.app.govuk_templates_path,
             'docker-compose.yml', 'package.json', 'package-lock.json', 'webpack.config.js']
    context.shell('rm -rf %s' % paths_for_shell(paths))
    context.shell('find %s -name "*.pyc" -or -name __pycache__ -delete' % context.app.django_app_name)

    if delete_dependencies:
        context.info('Cleaning app %s dependencies' % context.app.name)
        paths = ['node_modules', 'venv']
        context.shell('rm -rf %s' % paths_for_shell(paths))
21176
function unlinkIfLinked() {
  const sharedDeps = getSharedLinked(packageKeys, packageHash);
  if (sharedDeps.length) {
    unlinkPackage(sharedDeps);
  } else {
    log('No shared linked dependencies found');
  }
}
257054
function() {
      if (options.servePacked) {
        ss.bundler.forEach(function(bundler) {
          bundler.useLatestsPackedId();
        });
      }
      ss.bundler.load();
      //TODO convert options.dirs to relative paths stripping the lead '/' if present

      // Cache instances of code formatters and template engines here
      // This may change in the future as I don't like hanging system objects
      // on the 'ss' internal API object, but for now it solves a problem
      // we were having when repl.start() would erase vars cached inside a module
      ss.client.formatters = this.formatters.load();
      ss.client.templateEngines = this.templateEngine.load();
    }
147111
function browserBuild(config) {
  const compiler = webpack(config);
  return new Promise((resolve, reject) => {
    compiler.run((err, stats) => {
      if (err) {
        return reject(err);
      }
      const messages = formatWebpackMessages(stats.toJson({}, true));
      if (messages.errors.length) {
        return reject(new Error(messages.errors.join('\n\n')));
      }
      return resolve({ stats, warnings: messages.warnings });
    });
  });
}
41974
function loader(source) {

  // dust files don't have side effects, so loader results are cacheable
  if (this.cacheable) this.cacheable();

  // Set up default options & override them with other options
  const default_options = {
    root: '',
    dustAlias: 'dustjs-linkedin',
    namingFn: defaultNamingFunction,
    preserveWhitespace: false,
    wrapOutput: false,
    verbose: false,
    ignoreImages: false,
    excludeImageRegex: undefined
  };

  // webpack 4 'this.options' was deprecated in webpack 3 and removed in webpack 4
  // if you want to use global loader options, use dust-loader-complete < v4.0.0
  // var query = this.options || this.query || {};
  // var global_options = query['dust-loader-complete'] || {};

  // get user supplied loader options from `this.query`
  const loader_options = getOptions(this) || {};

  // merge user options with default options
  const options = Object.assign({}, default_options, loader_options);

  // Fix slashes & resolve root
  options.root = path.resolve(options.root.replace('/', path.sep));

  // Get the path
  const template_path = path.relative(options.root, this.resourcePath);

  // Create the template name
  const name = options.namingFn(template_path, options);

  // Log
  log(options, 'Loading DustJS module from "' + template_path + '": naming template "' + name + '"');

  // Find different styles of dependencies
  const deps = [];

  // Find regular dust partials, updating the source as needed for relatively-pathed partials
  source = findPartials(source, template_path + '/../', options, deps);

  // Find image dependencies
  if (!options.ignoreImages) {
    source = findImages(name, source, deps, options);
  }

  // Find require comments
  findRequireComments(source, template_path + '/../', options, deps);

  // Do not trim whitespace in case preserveWhitespace option is enabled
  dust.config.whitespace = options.preserveWhitespace;

  // Compile the template
  const template = dust.compile(source, name);

  // Build the returned string
  let returnedString;
  if (options.wrapOutput) {
    returnedString = "var dust = require('" + options.dustAlias + "/lib/dust'); "
      + deps.join(' ') + template
      + "var fn = " + defaultWrapperGenerator(name)
      + '; fn.templateName = "' + name + '"; '
      + "module.exports = fn;";
  } else {
    returnedString = "var dust = require('" + options.dustAlias + "'); "
      + deps.join(' ')
      + 'var template = ' + template + ';'
      + 'template.templateName = "' + name + '";'
      + "module.exports = template;";
  }

  // Return the string to be used
  return returnedString
}
1123622
function nope(options) {
  options.enabled = false;
  options.modify = modify;
  options.set = set;
  options.use = use;

  return introduce(function diagnopes() {
    return false;
  }, options);
}
1277955
function handleWarnings (warnings) {
  clearOutdatedErrors()

  var isHotUpdate = !isFirstCompilation
  isFirstCompilation = false
  hasCompileErrors = false

  function printWarnings () {
    // Print warnings to the console.
    var formatted = formatWebpackMessages({
      warnings: warnings,
      errors: [],
    })

    if (typeof console !== 'undefined' && typeof console.warn === 'function') {
      for (var i = 0; i < formatted.warnings.length; i++) {
        if (i === 5) {
          console.warn(
            'There were more warnings in other files.\n' +
              'You can find a complete log in the terminal.'
          )
          break
        }
        console.warn(stripAnsi(formatted.warnings[i]))
      }
    }
  }

  // Attempt to apply hot updates or reload.
  if (isHotUpdate) {
    tryApplyUpdates(function onSuccessfulHotUpdate () {
      // Only print warnings if we aren't refreshing the page.
      // Otherwise they'll disappear right away anyway.
      printWarnings()
      // Only dismiss it when we're sure it's a hot update.
      // Otherwise it would flicker right before the reload.
      ErrorOverlay.dismissBuildError()
    })
  } else {
    // Print initial warnings immediately.
    printWarnings()
  }
}
154803
function stopPackageFromJob(job) {
   if (!isUndefined(job.document.packageName)) {
      stopPackage(job.document.packageName, function(err) {
         if (isUndefined(err)) {
            job.succeeded({ operation: job.operation, state: 'package stopped' }, showJobsError);
         } else {
            job.failed({ operation: job.operation, errorCode: 'ERR_UNABLE_TO_STOP_PACKAGE', errorMessage: errorToString(err) }, showJobsError);
         }
      });
   } else {
      job.failed({ operation: job.operation, errorCode: 'ERR_UNNAMED_PACKAGE', errorMessage: 'no packageName property specified' }, showJobsError);
   }
}
1331753
function(){
		if(initialised)
			return isnode;
		if(package && package.name && package.version)
			console.log("\n" + package.name + " v" + package.version + "\n");

		if(config && config.loader && config.loader.startupModules && config.loader.startupModules.length > 0) {
			for (var i = 0; i < config.loader.startupModules.length; i++) {
				var startMod = "isnode-mod-"+config.loader.startupModules[i];
				loadModule(startMod);
			}
		} else {
			isnode.shutdown();
			return;
		}
		if(!modules.logger || !modules.logger.log){
			if(!modules.logger)
				modules.logger = {};
			modules.logger.log = function(level, message, data){
				var currentDate = new Date();
				currentDate = currentDate.toISOString();
				console.log(currentDate + " (" + level + ") " + message);
			}
			modules.logger.log("warning", "Logger module not loaded. Using stub method.");
		}
		isnode.on("listenForExit", function(){
			var stdin = process.openStdin();
			stdin.setRawMode(true); 
			stdin.setEncoding('utf8');
			stdin.on('data', function(chunk) {
					if(chunk == "e")
						isnode.shutdown();
			});
		});
		var started = false;
		var loadListener = function(){
			isnode.removeListener("loadDependencies", loadListener);
			loadDependencies(); 
			started = true;
		}
		isnode.on("loadDependencies", loadListener); 
		var counter = 0;
		if(config.loader.timeouts.loadDependencies)
			var timeout = config.loader.timeouts.loadDependencies;
		else
			var timeout = 5000;
		var interval = setInterval(function(){
			if(started == true){
				clearInterval(interval);
			}
			if(counter >= timeout) {
				modules.logger.log("startup","ISNode System > Timed out initiating startup. Terminating application server.");
				clearInterval(interval);
				isnode.shutdown();
			}
			counter += 500;
		}, 500);
		initialised = true;
		return isnode;
	}
632300
def remove_excluded(self):
        
        # import yaml
        # print yaml.dump({k:v.__json__() for k,v in self.sources.items()}, default_flow_style=False)
        sources = list(self.sources.values())
        for src in sources:
            if src.excluded:
                del self.sources[src.name]
            src.imports = [m for m in src.imports if not self._exclude(m)]
            src.imported_by = [m for m in src.imported_by if not self._exclude(m)]
1098438
protected void addOrRemoveGeneratedImport (boolean add)
    {
        final String IMPORT = "import javax.annotation.Generated;";

        int packageLine = -1;
        int importLine = -1;
        int lastJavaImport = -1;
        int firstNonJavaImport = -1;
        for (int ii = 0, nn = _lines.size(); ii < nn; ii++) {
            String line = _lines.get(ii);
            if (line.startsWith(IMPORT)) {
                if (add) {
                    return; // we already got one!
                }
                importLine = ii;
                break;

            } else if (line.startsWith("package ")) {
                packageLine = ii;

            } else if (line.startsWith("import java")) {
                lastJavaImport = ii;

            } else if (firstNonJavaImport == -1 && line.startsWith("import ")) {
                firstNonJavaImport = ii;
            }
        }

        if (importLine != -1) {
            // we must be removing, or we'd have already exited
            _lines.remove(importLine);

        } else if (!add) {
            return; // it's already not there!

        } else {
            importLine = (lastJavaImport != -1) ? lastJavaImport + 1
                : ((firstNonJavaImport != -1) ? firstNonJavaImport : packageLine + 1);
            _lines.add(importLine, IMPORT);
        }

        // the import line is always above these other lines, so they can be adjusted wholesale
        int adjustment = add ? 1 : -1;
        _nstart += adjustment;
        _nend += adjustment;
        _mstart += adjustment;
        _mend += adjustment;
    }
156631
function(done, packageAll) {

      // Detect any new file or modified files.
      var metadataAction = force.evaluateProjectFiles(opt, packageAll);

      // Clear the meta data output directory.
      force.deletePackageOutput(opt, false);

      // Check to see if any file changes were detected.
      if (Object.keys(metadataAction).length == 0) {
        // Silently return without an error when forcePackageContinueSilent is true
        if (opt.forcePackageContinueSilent) {
          done();
          return;
        }

        var msg = 'No new or modified files detected.';

        // Throw a gulp error to note no file changes detected.
        if (gutil !== undefined && gutil !== null)
          throw new gutil.PluginError(gulpPluginName, msg, { showProperties: false, showStack: false });

        // Return an error to gulp.
        console.log(msg);
        done(msg);

        return;
      }

      // Generate package folder structure.
      force.generatePackageStructure(opt, metadataAction);

      done();

    }
961983
def not_implemented(self, context, **response_kwargs):
        '''
        
        '''
        if settings.DEBUG:
            raise NotImplementedError(_('This export type ({})is not yet supported.'.format(self.format)))
        raise Http404