Geth the JSPM baseURL from package.json
976678
function () {
        var pkgJson = grunt.file.readJSON("package.json");

        if (pkgJson.jspm && pkgJson.jspm.directories && pkgJson.jspm.directories.baseURL) {
            return pkgJson.jspm.directories.baseURL;
        }

        return "";
    }
699136
function generate(spec) {
  createProjectDirectory();
  spec = addHttpEndpointNames(spec);
  spec = addSocketEndpointFlag(spec);
  spec = addSocketEmitTypeFlag(spec);
  spec = isProxyEndpointAvailable(spec);
  writeFileSync('server.mustache', spec, 'server.js');
  writeFileSync('package.mustache', spec, 'package.json');
}
652377
function(repo, version, hash, meta, outDir) {

    var url, tempRepoDir, packageJSONData, self = this;

    if (meta.vPrefix) {
      version = 'v' + version;
    }

    // Automatically track and cleanup files at exit
    temp.track();

    url = createGitUrl(self.options.baseurl, repo, self.options.reposuffix, self.auth);

    return createTempDir().then(function(tempDir) {
      tempRepoDir = tempDir;
      return exportGitRepo(tempRepoDir, version, url, self.execOpt, self.options.shallowclone);
    }).then(function() {
      return readPackageJSON(tempRepoDir);
    }).then(function(data) {
      packageJSONData = data;
      return moveRepoToOutDir(tempRepoDir, outDir);
    }).then(function() {
      return packageJSONData;
    });
  }
181956
static function packageJson($project_directory, $app_engine_project, $app_engine_service, $package_json_defaults = []) {
        $package_json_location = $project_directory . DIRECTORY_SEPARATOR . "package.json";
        $package_json_content = Files::getJson($package_json_location, []);
        $package_json_content = array_merge([
            "name" => null,
            "project" => null,
            "private" => null,
        ], $package_json_content);
        $project_name = $app_engine_project . '-' . $app_engine_service;
        $package_json_defaults["private"] = true;
        $package_json_content["name"] = $project_name;
        $package_json_content["project"] = $app_engine_project;
        foreach ($package_json_defaults as $key => $val) {
            $package_json_content[$key] = $val;
        }
        if ($app_engine_service == "default") {
            $package_json_content["scripts"]["deploy"] = 'gcloud app deploy app.yaml queue.yaml --project $npm_package_project --promote --quiet';
        } else {
            $package_json_content["scripts"]["deploy"] = 'gcloud app deploy app.yaml --project $npm_package_project --promote --quiet';
        }
        $gaeutil_json = Files::getJson(Conf::getGaeUtilJsonPath($project_directory), []);

        $project_key_name = $gaeutil_json[Secrets::CONF_PROJECT_KEY_NAME];
        $project_key = Secrets::reverseKmsKey($project_key_name);
        $crypt_params = [
            "ciphertext-file" => "config/secrets.cipher",
            "plaintext-file" => "secrets.json",
            "project" => $project_key["project"],
            "location" => $project_key["location"],
            "keyring" => $project_key["keyRing"],
            "key" => $project_key["cryptoKey"]
        ];
        $package_json_content["scripts"]["encrypt"] = self::commandMaker("gcloud kms encrypt", $crypt_params);
        $package_json_content["scripts"]["decrypt"] = self::commandMaker("gcloud kms decrypt", $crypt_params);
        $package_json_content["scripts"]["devserve"] = 'dev_appserver.py --port=5000 . -A $npm_package_project';
        if (Files::putJson($package_json_location, $package_json_content)) {
            Util::cmdline("Updated package.json in $project_name");
        }

    }
856071
function(location) {
  var found = false;

  while(!found) {
    if (exists(location + '/package.json')) {
      found = location;
    } else if (location !== '/') {
      location = path.dirname(location);
    } else {
      return false;
    }
  }

  return location;
}
1203567
function parseBrowserPackOutput(buf) {
  const m = /\n\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,([^\s]+)\n?$/.exec(buf)
  if (!m) throw new Error('browser-pack did not insert source-map data URL in output: ' + buf.toString('utf-8'))
  const javascript = buf.slice(0, m.index)
  const sourceMap = JSON.parse(Buffer.from(m[1], 'base64'))
  return {
    javascript: javascript,
    sourceMap: sourceMap
  }
}
204860
function readPackageJSON () {
	var pkg = JSON.parse(require('fs').readFileSync('./package.json'));
	var dependencies = pkg.dependencies ? Object.keys(pkg.dependencies) : [];
	var peerDependencies = pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [];

	return {
		name: pkg.name,
		deps: dependencies.concat(peerDependencies),
		aliasify: pkg.aliasify
	};
}
952774
function parseSshGitUrl(gitUrl){
		try {
			/* try ssh:// protocol */
			var url = new URL(gitUrl);
			return {
				host : url.hostname,
				port : url.port
			};
					
		} catch(e){
			/* try scp-like uri */
			try {
				/* [user@]host.xz:path/to/repo.git/ */
				var scp = gitUrl.split(":"); //$NON-NLS-0$
				var hostPart = scp[0].split("@"); //$NON-NLS-0$
				var host = hostPart.length > 1 ? hostPart[1] : hostPart[0];
				return {
					host : host,
					port : 22
				};
				
			} catch(ex){
				/* admit failure */
				return {
					host : "",
					port : ""
				};
			}
		}
	}
82912
function importRequest(endpointSchema, id, parentId) {
  const name = endpointSchema.summary || `${endpointSchema.method} ${endpointSchema.path}`;
  return {
    _type: 'request',
    _id: id,
    parentId: parentId,
    name,
    method: endpointSchema.method.toUpperCase(),
    url: '{{ base_url }}' + pathWithParamsAsVariables(endpointSchema.path),
    body: prepareBody(endpointSchema),
    headers: prepareHeaders(endpointSchema),
    parameters: prepareQueryParams(endpointSchema),
  };
}
1172864
function loadJspmConfig(opts) {
  sh.echo('Loading jspm config...');

  return new Promise(resolve => {
    const loader = new jspm.Loader();

    opts.config(loader);
    resolve(loader);
  });
}
1253123
def base_url(self):
        """"""

        if self.doc.package_url:
            return self.doc.package_url

        return self.doc._ref
856464
function getRearEnv () {
  // Instead of using 'dotenv.config()' to automatically load
  // the local .env file content, we read and parse the file manually to avoid
  // polluting 'process.env'.
  if (!dotenvEnv && fs.existsSync(dotenvFile)) {
    dotenvEnv = dotenv.parse(fs.readFileSync(dotenvFile));
  }

  // read local 'package.json' once and flatten its content
  // into a key/value dictionary
  if (!packageJsonEnv) {
    packageJsonEnv = toDictionary(
      require('./get-package-json')()
    );
  }

  const mergedEnv = Object.assign({}, process.env, packageJsonEnv, dotenvEnv);
  // filters rear-only environment variables
  // from 'process.env', '.env' and 'package.json'
  // (NODE_ENV is also carried over)
  return Object.keys(mergedEnv)
    .filter(key => REAR_ENV.test(key))
    .reduce((env, key) => {
      env[key] = mergedEnv[key];
      return env;
    }, {
      // Useful for determining the environment we're running in.
      NODE_ENV: process.env.NODE_ENV || 'development',
    });
}
934646
function ()
		{
			var nmPath = this.modulePath + 'node_modules/';
			var pkgJson;
			var pkgName;
			var pkgInfo;
			var packageList = {};
			var validScript = /[\w|\W]+\.[js|coffee]+$/;
			if (fs.existsSync(nmPath))
			{
				this.e.log&&this.e.log('Importing packages...','system');
				var packages = fs.readdirSync(nmPath);
				for (p in packages)
				{
					try {
						if (packages[p].indexOf('wns')!==-1 &&
							(packages[p].indexOf('pkg') !== -1 || packages[p].indexOf('package') !== -1))
						{
							pkgName = packages[p];
							pkgDir = nmPath + pkgName;
							pkgJson = pkgDir + '/package.json';
							if (fs.existsSync(pkgJson))
							{
								pkgInfo = JSON.parse(fs.readFileSync(pkgJson));
								pkgInfo.require = pkgInfo.require||{};
								Object.defineProperty(pkgInfo,'classes',{ value: {}, enumerable: false })
								var files = fs.readdirSync(pkgDir);
								for (f in files)
								{
									var fileName = files[f].split('/').pop();
									if (validScript.test(fileName))
									{
										var className = fileName.split('.');
										className.splice(-1);
										pkgInfo.classes[className] = pkgDir+'/'+fileName;
									}
								}
								packageList[pkgInfo.name]=pkgInfo;
							}
						}
					} catch (e)
					{
						console.error('Error on loading package `'+pkgName+"`.")
						throw e;
					}
				}
			}

			this.removeInvalidPackages(packageList);
			this.loadPackages(packageList);
		}
1193028
function getClosestPackage(modulePath) {
  let root;
  let pkg;

  // Catch findRoot or require errors
  try {
    root = findRoot(modulePath);
    pkg = require(path.join(root, "package.json"));
  } catch (e) {
    return null;
  }

  // If the package.json does not have a name property, try again from
  // one level higher.
  // https://github.com/jsdnxx/find-root/issues/2
  // https://github.com/date-fns/date-fns/issues/264#issuecomment-265128399
  if (!pkg.name) {
    return getClosestPackage(path.resolve(root, ".."));
  }

  return {
    package: pkg,
    path: root
  };
}
92975
function loadModules(rootDir, paths) {
        var serverModules = {};
        var me = this;

        // return empty object if no rootDir or paths
        if (!rootDir || !paths) { return serverModules; }

        // loop through paths and load all modules in those directories
        _.each(paths, function (relativePath) {
            var fullPath = path.normalize(rootDir + delim + relativePath);

            // if the directory doesn't exist, then skip to the next loop iteration
            if (fs.existsSync(fullPath)) {

                _.each(fs.readdirSync(fullPath), function (fileName) {

                    // if it is a javascript file and it DOES NOT end in .service.js, then save the mapping
                    if (utils.isJavaScript(fileName) && !fileName.match(/^.*\.service\.js$/)) {
                        var nameLower = utils.getCamelCase(fileName).toLowerCase();
                        var fullFilePath = path.normalize(fullPath + '/' + fileName);

                        // there are 2 diff potential aliases for any given server module
                        serverModules[nameLower + 'fromplugin'] = serverModules[nameLower] = require(fullFilePath);
                    }

                    // else if we are dealing   with a directory, recurse down into the folder
                    else if (fs.lstatSync(path.join(fullPath, fileName)).isDirectory()) {
                        _.extend(serverModules, me.loadModules(rootDir, [relativePath + '/' + fileName]));
                    }

                });
            }
        });

        return serverModules;
    }
1136380
function(context, pkg, source) {
		source = source || "{}";
		var packageJSON = JSON.parse(source);
		utils.extend(pkg, packageJSON);
		context.packages.push(pkg);
		return pkg;
	}
478821
def package_url(self):
        """"""

        if self.resource_file == DEFAULT_METATAB_FILE or self.target_format in ('txt','ipynb'):
            u = self.inner.clone().clear_fragment()
            u.path = dirname(self.path) + '/'
            u.scheme_extension = 'metapack'
        else:
            u = self

        return MetapackPackageUrl(str(u.clear_fragment()), downloader=self._downloader)