diff --git a/src/packagedcode/build.py b/src/packagedcode/build.py index c29988d872c..49d6afb7276 100644 --- a/src/packagedcode/build.py +++ b/src/packagedcode/build.py @@ -177,6 +177,8 @@ def parse(cls, location): @classmethod def assign_package_to_resources(cls, package, resource, codebase, skip_name=None): package_uid = package.package_uid + if not package_uid: + return parent = resource.parent(codebase) for res in walk_build(resource=parent, codebase=codebase, skip_name=skip_name): res.for_packages.append(package_uid) diff --git a/src/packagedcode/debian.py b/src/packagedcode/debian.py index 5590a0161bf..77e7cc006be 100644 --- a/src/packagedcode/debian.py +++ b/src/packagedcode/debian.py @@ -397,20 +397,21 @@ def assemble(cls, package_data, resource, codebase): assemblable_paths = ( f'usr/share/doc/{package_name}/copyright', ) - for res in root_resource.walk(codebase): - if not res.path.endswith(assemblable_paths): - continue - - for pkgdt in res.package_data: - package.update( - package_data=pkgdt, - datafile_path=res.path, - ) - - res.for_packages.append(package_uid) - res.save(codebase) - - yield res + if package_uid: + for res in root_resource.walk(codebase): + if not res.path.endswith(assemblable_paths): + continue + + for pkgdt in res.package_data: + package.update( + package_data=pkgdt, + datafile_path=res.path, + ) + + res.for_packages.append(package_uid) + res.save(codebase) + + yield res yield package diff --git a/src/packagedcode/models.py b/src/packagedcode/models.py index 1c6a2c498f9..a815a49f006 100644 --- a/src/packagedcode/models.py +++ b/src/packagedcode/models.py @@ -970,7 +970,7 @@ def assign_package_to_resources(cls, package, resource, codebase): # NOTE: we do not attach files to the Package level. Instead we # update `for_packages` of a codebase resource. package_uid = package.package_uid - if resource: + if resource and package_uid: resource.for_packages.append(package_uid) resource.save(codebase) for res in resource.walk(codebase): @@ -1030,8 +1030,9 @@ def assemble_from_many(cls, pkgdata_resources, codebase,): datafile_path=resource.path, ) package_uid = package.package_uid - resource.for_packages.append(package_uid) - resource.save(codebase) + if package_uid: + resource.for_packages.append(package_uid) + resource.save(codebase) else: # FIXME: What is the package_data is NOT for the same package as package? # FIXME: What if the update did not do anything? (it does return True or False) @@ -1040,8 +1041,9 @@ def assemble_from_many(cls, pkgdata_resources, codebase,): package_data=package_data, datafile_path=resource.path, ) - resource.for_packages.append(package_uid) - resource.save(codebase) + if package_uid: + resource.for_packages.append(package_uid) + resource.save(codebase) # in all cases yield possible dependencies dependent_packages = package_data.dependencies @@ -1057,9 +1059,10 @@ def assemble_from_many(cls, pkgdata_resources, codebase,): yield resource # the whole parent subtree of the base_resource is for this package - for res in base_resource.walk(codebase): - res.for_packages.append(package_uid) - res.save(codebase) + if package_uid: + for res in base_resource.walk(codebase): + res.for_packages.append(package_uid) + res.save(codebase) if package: if not package.license_expression: @@ -1336,9 +1339,10 @@ def get_packages_files(self, codebase): Yield all the Resource of this package found in codebase. """ package_uid = self.package_uid - for resource in codebase.walk(): - if package_uid in resource.for_packages: - yield resource + if package_uid: + for resource in codebase.walk(): + if package_uid in resource.for_packages: + yield resource @attr.attributes(slots=True) diff --git a/src/packagedcode/npm.py b/src/packagedcode/npm.py index d8b3b24a352..515b5d44358 100644 --- a/src/packagedcode/npm.py +++ b/src/packagedcode/npm.py @@ -95,12 +95,12 @@ def assemble(cls, package_data, resource, codebase): root = package_resource.parent(codebase) if root: for npm_res in cls.walk_npm(resource=root, codebase=codebase): - if package_uid not in npm_res.for_packages: + if package_uid and package_uid not in npm_res.for_packages: npm_res.for_packages.append(package_uid) npm_res.save(codebase) yield npm_res elif codebase.has_single_resource: - if package_uid not in package_resource.for_packages: + if package_uid and package_uid not in package_resource.for_packages: package_resource.for_packages.append(package_uid) package_resource.save(codebase) yield package_resource @@ -119,7 +119,7 @@ def assemble(cls, package_data, resource, codebase): if lock_file.name in lockfile_names: yield from yield_dependencies_from_package_resource(lock_file, package_uid) - if package_uid not in lock_file.for_packages: + if package_uid and package_uid not in lock_file.for_packages: lock_file.for_packages.append(package_uid) lock_file.save(codebase) yield lock_file @@ -226,8 +226,7 @@ def parse(cls, location): if not package.download_url: # Only add a synthetic download URL if there is none from the dist mapping. - dnl_url = npm_download_url(package.namespace, package.name, package.version) - package.download_url = dnl_url.strip() + package.download_url = npm_download_url(package.namespace, package.name, package.version) # licenses are a tad special with many different data structures lic = package_data.get('license') @@ -781,12 +780,15 @@ def npm_homepage_url(namespace, name, registry='https://www.npmjs.com/package'): >>> expected = 'https://yarnpkg.com/en/package/@ang/angular' >>> assert npm_homepage_url('@ang', 'angular', 'https://yarnpkg.com/en/package') == expected + + >>> assert not npm_homepage_url(None, None) """ - if namespace: - ns_name = f'{namespace}/{name}' - else: - ns_name = name - return f'{registry}/{ns_name}' + if name: + if namespace: + ns_name = f'{namespace}/{name}' + else: + ns_name = name + return f'{registry}/{ns_name}' def npm_download_url(namespace, name, version, registry='https://registry.npmjs.org'): @@ -803,13 +805,15 @@ def npm_download_url(namespace, name, version, registry='https://registry.npmjs. >>> expected = 'https://registry.npmjs.org/angular/-/angular-1.6.6.tgz' >>> assert npm_download_url(None, 'angular', '1.6.6') == expected - """ - if namespace: - ns_name = f'{namespace}/{name}' - else: - ns_name = name - return f'{registry}/{ns_name}/-/{name}-{version}.tgz' + >>> assert not npm_download_url(None, None, None) + """ + if name and version: + if namespace: + ns_name = f'{namespace}/{name}' + else: + ns_name = name + return f'{registry}/{ns_name}/-/{name}-{version}.tgz' def npm_api_url(namespace, name, version=None, registry='https://registry.npmjs.org'): @@ -827,20 +831,25 @@ def npm_api_url(namespace, name, version=None, registry='https://registry.npmjs. >>> assert result == 'https://registry.yarnpkg.com/@invisionag%2feslint-config-ivx' >>> assert npm_api_url(None, 'angular', '1.6.6') == 'https://registry.npmjs.org/angular/1.6.6' + + >>> assert not npm_api_url(None, None, None) """ - version = version or '' - if namespace: - # this is a legacy wart: older registries used to always encode this / - # FIXME: do NOT encode and use plain / instead - ns_name = '%2f'.join([namespace, name]) - # there is no version-specific URL for scoped packages - version = '' - else: - ns_name = name + if name: + if namespace: + # this is a legacy wart: older registries used to always encode this / + # FIXME: do NOT encode and use plain / instead + ns_name = '%2f'.join([namespace, name]) + # there is no version-specific URL for scoped packages + version = '' + else: + ns_name = name + + if version: + version = f'/{version}' + else: + version = '' - if version: - version = f'/{version}' - return f'{registry}/{ns_name}{version}' + return f'{registry}/{ns_name}{version}' def is_scoped_package(name): diff --git a/src/packagedcode/pypi.py b/src/packagedcode/pypi.py index c0a9365446d..e1c6a04492b 100644 --- a/src/packagedcode/pypi.py +++ b/src/packagedcode/pypi.py @@ -212,12 +212,12 @@ def assemble(cls, package_data, resource, codebase): for py_res in cls.walk_pypi(resource=root, codebase=codebase): if py_res.is_dir: continue - if package_uid not in py_res.for_packages: + if package_uid and package_uid not in py_res.for_packages: py_res.for_packages.append(package_uid) py_res.save(codebase) yield py_res elif codebase.has_single_resource: - if package_uid not in package_resource.for_packages: + if package_uid and package_uid not in package_resource.for_packages: package_resource.for_packages.append(package_uid) package_resource.save(codebase) @@ -320,9 +320,10 @@ def assign_package_to_resources(cls, package, resource, codebase): package_uid = package.package_uid - # save thyself! - resource.for_packages.append(package_uid) - resource.save(codebase) + if package_uid: + # save thyself! + resource.for_packages.append(package_uid) + resource.save(codebase) # collect actual paths based on the file references for file_ref in package_data.file_references: @@ -342,15 +343,16 @@ def assign_package_to_resources(cls, package, resource, codebase): # TODO:w e should log these kind of things continue else: - ref_resource.for_packages.append(package_uid) - ref_resource.save(codebase) + if package_uid: + ref_resource.for_packages.append(package_uid) + ref_resource.save(codebase) else: ref_resource = get_resource_for_path( path=path_ref, root=site_packages, codebase=codebase, ) - if ref_resource: + if ref_resource and package_uid: ref_resource.for_packages.append(package_uid) ref_resource.save(codebase) diff --git a/src/packagedcode/rpm.py b/src/packagedcode/rpm.py index 2cee8be7018..4fbb345bff9 100644 --- a/src/packagedcode/rpm.py +++ b/src/packagedcode/rpm.py @@ -210,10 +210,11 @@ def assemble(cls, package_data, resource, codebase): if not res: missing_file_references.append(ref) else: - # path is found and processed: remove it, so we can check if we - # found all of them - res.for_packages.append(package_uid) - res.save(codebase) + if package_uid: + # path is found and processed: remove it, so we can check if we + # found all of them + res.for_packages.append(package_uid) + res.save(codebase) # if we have left over file references, add these to extra data if missing_file_references: diff --git a/src/packagedcode/win_reg.py b/src/packagedcode/win_reg.py index 0f974d76b49..1761482a72a 100644 --- a/src/packagedcode/win_reg.py +++ b/src/packagedcode/win_reg.py @@ -380,8 +380,9 @@ def get_root_resource(cls, resource, codebase): @classmethod def assign_package_to_resources(cls, package, resource, codebase): package_uid = package.package_uid - resource.for_packages.append(package_uid) - resource.save(codebase) + if package_uid: + resource.for_packages.append(package_uid) + resource.save(codebase) refs = package.file_references if not refs: @@ -406,11 +407,12 @@ def assign_package_to_resources(cls, package, resource, codebase): if not ref: continue - # path is found and processed: remove it, so we can check if we - # found all of them - del refs_by_path[res.path] - res.for_packages.append(package_uid) - res.save(codebase) + if package_uid: + # path is found and processed: remove it, so we can check if we + # found all of them + del refs_by_path[res.path] + res.for_packages.append(package_uid) + res.save(codebase) # if we have left over file references, add these to extra data if refs_by_path: diff --git a/tests/packagedcode/data/npm/private-and-yarn/scan.expected.json b/tests/packagedcode/data/npm/private-and-yarn/scan.expected.json new file mode 100644 index 00000000000..03d58bb99be --- /dev/null +++ b/tests/packagedcode/data/npm/private-and-yarn/scan.expected.json @@ -0,0 +1,1582 @@ +{ + "dependencies": [ + { + "purl": "pkg:npm/lerna", + "extracted_requirement": "3.13.0", + "scope": "devDependencies", + "is_runtime": false, + "is_optional": true, + "is_resolved": false, + "resolved_package": {}, + "dependency_uid": "pkg:npm/lerna?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": null, + "datafile_path": "theia/package.json", + "datasource_id": "npm_package_json" + }, + { + "purl": "pkg:npm/%40babel/runtime@7.2.0", + "extracted_requirement": "^7.1.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@babel", + "name": "runtime", + "version": "7.2.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.2.0.tgz", + "size": null, + "sha1": "b03e42eeddf5898e00646e4c840fa07ba8dcad7f", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/regenerator-runtime", + "extracted_requirement": "^0.12.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@babel/runtime", + "repository_download_url": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.2.0.tgz", + "api_data_url": "https://registry.npmjs.org/@babel%2fruntime", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40babel/runtime@7.2.0" + }, + "dependency_uid": "pkg:npm/%40babel/runtime@7.2.0?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": null, + "datafile_path": "theia/yarn.lock", + "datasource_id": "yarn_lock_v1" + }, + { + "purl": "pkg:npm/%40ballerina/api-designer@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "api-designer", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/api-designer/-/api-designer-0.99.0-RC3.tgz", + "size": null, + "sha1": "ef2a9a81173f76bbdf87b23fe369896271f5b5e6", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/%22%40types/swagger-parser%22", + "extracted_requirement": "^4.0.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/js-yaml", + "extracted_requirement": "^3.12.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/react-markdown", + "extracted_requirement": "^4.0.4", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/semantic-ui-css", + "extracted_requirement": "^2.4.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/semantic-ui-react", + "extracted_requirement": "^0.83.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/swagger-parser", + "extracted_requirement": "^5.0.5", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/swagger-schema-official", + "extracted_requirement": "^2.0.0-bab6bed", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/api-designer", + "repository_download_url": "https://registry.npmjs.org/@ballerina/api-designer/-/api-designer-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2fapi-designer", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/api-designer@0.99.0-RC3" + }, + "dependency_uid": "pkg:npm/%40ballerina/api-designer@0.99.0-RC3?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": null, + "datafile_path": "theia/yarn.lock", + "datasource_id": "yarn_lock_v1" + }, + { + "purl": "pkg:npm/%40ballerina/ast-model@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "ast-model", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/ast-model/-/ast-model-0.99.0-RC3.tgz", + "size": null, + "sha1": "07d8a25b809668dd687d74acd58b0071b7849aa8", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/%22%40ballerina/lang-service%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/glob", + "extracted_requirement": "^7.1.3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/lodash", + "extracted_requirement": "^4.17.11", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/prettier", + "extracted_requirement": "^1.5.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/prettier-tslint", + "extracted_requirement": "^0.4.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/vscode-uri", + "extracted_requirement": "^1.0.6", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/ast-model", + "repository_download_url": "https://registry.npmjs.org/@ballerina/ast-model/-/ast-model-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2fast-model", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/ast-model@0.99.0-RC3" + }, + "dependency_uid": "pkg:npm/%40ballerina/ast-model@0.99.0-RC3?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": null, + "datafile_path": "theia/yarn.lock", + "datasource_id": "yarn_lock_v1" + }, + { + "purl": "pkg:npm/%40ballerina/ballerina-by-examples@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "ballerina-by-examples", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/ballerina-by-examples/-/ballerina-by-examples-0.99.0-RC3.tgz", + "size": null, + "sha1": "470c7ae2f24cfebd267fd109be5a4395135b20aa", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/lodash", + "extracted_requirement": "^4.17.11", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/ballerina-by-examples", + "repository_download_url": "https://registry.npmjs.org/@ballerina/ballerina-by-examples/-/ballerina-by-examples-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2fballerina-by-examples", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/ballerina-by-examples@0.99.0-RC3" + }, + "dependency_uid": "pkg:npm/%40ballerina/ballerina-by-examples@0.99.0-RC3?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": null, + "datafile_path": "theia/yarn.lock", + "datasource_id": "yarn_lock_v1" + }, + { + "purl": "pkg:npm/%40ballerina/diagram@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "diagram", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/diagram/-/diagram-0.99.0-RC3.tgz", + "size": null, + "sha1": "fb7953f1ce520d9b2f1d568bb4d88172bb5b4fec", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/%22%40ballerina/ast-model%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/font%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/lang-service%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/theme%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/lodash", + "extracted_requirement": "^4.17.11", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/lodash.debounce", + "extracted_requirement": "^4.0.8", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/log4javascript", + "extracted_requirement": "^1.4.15", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/diagram", + "repository_download_url": "https://registry.npmjs.org/@ballerina/diagram/-/diagram-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2fdiagram", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/diagram@0.99.0-RC3" + }, + "dependency_uid": "pkg:npm/%40ballerina/diagram@0.99.0-RC3?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": null, + "datafile_path": "theia/yarn.lock", + "datasource_id": "yarn_lock_v1" + }, + { + "purl": "pkg:npm/%40ballerina/distribution@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "distribution", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/distribution/-/distribution-0.99.0-RC3.tgz", + "size": null, + "sha1": "b0d37b143a46ef8bc25111fa5ca052fac83e87bf", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/%22%40ballerina/api-designer%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/ballerina-by-examples%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/diagram%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/documentation%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/theme%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/tracing%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/distribution", + "repository_download_url": "https://registry.npmjs.org/@ballerina/distribution/-/distribution-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2fdistribution", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/distribution@0.99.0-RC3" + }, + "dependency_uid": "pkg:npm/%40ballerina/distribution@0.99.0-RC3?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": null, + "datafile_path": "theia/yarn.lock", + "datasource_id": "yarn_lock_v1" + }, + { + "purl": "pkg:npm/%40ballerina/documentation@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "documentation", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/documentation/-/documentation-0.99.0-RC3.tgz", + "size": null, + "sha1": "6041e6f9e76111c309801ebee2a3775387627f58", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/%22%40ballerina/ast-model%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/diff", + "extracted_requirement": "^3.5.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/escape-html", + "extracted_requirement": "^1.0.3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/react-markdown", + "extracted_requirement": "^4.0.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/documentation", + "repository_download_url": "https://registry.npmjs.org/@ballerina/documentation/-/documentation-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2fdocumentation", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/documentation@0.99.0-RC3" + }, + "dependency_uid": "pkg:npm/%40ballerina/documentation@0.99.0-RC3?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": null, + "datafile_path": "theia/yarn.lock", + "datasource_id": "yarn_lock_v1" + }, + { + "purl": "pkg:npm/%40ballerina/font@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "font", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/font/-/font-0.99.0-RC3.tgz", + "size": null, + "sha1": "89721bfc045655addb34acd2ac49f0f5895d2292", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/font", + "repository_download_url": "https://registry.npmjs.org/@ballerina/font/-/font-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2ffont", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/font@0.99.0-RC3" + }, + "dependency_uid": "pkg:npm/%40ballerina/font@0.99.0-RC3?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": null, + "datafile_path": "theia/yarn.lock", + "datasource_id": "yarn_lock_v1" + }, + { + "purl": "pkg:npm/zip-dir@1.0.2", + "extracted_requirement": "^1.0.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "", + "name": "zip-dir", + "version": "1.0.2", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/zip-dir/-/zip-dir-1.0.2.tgz", + "size": null, + "sha1": "253f907aead62a21acd8721d8b88032b2411c051", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/async", + "extracted_requirement": "^1.5.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/jszip", + "extracted_requirement": "^2.4.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/zip-dir", + "repository_download_url": "https://registry.npmjs.org/zip-dir/-/zip-dir-1.0.2.tgz", + "api_data_url": "https://registry.npmjs.org/zip-dir/1.0.2", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/zip-dir@1.0.2" + }, + "dependency_uid": "pkg:npm/zip-dir@1.0.2?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": null, + "datafile_path": "theia/yarn.lock", + "datasource_id": "yarn_lock_v1" + } + ], + "packages": [], + "files": [ + { + "path": "theia", + "type": "directory", + "package_data": [], + "for_packages": [], + "scan_errors": [] + }, + { + "path": "theia/package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": [], + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/lerna", + "extracted_requirement": "3.13.0", + "scope": "devDependencies", + "is_runtime": false, + "is_optional": true, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "npm_package_json", + "purl": null + } + ], + "for_packages": [], + "scan_errors": [] + }, + { + "path": "theia/yarn.lock", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/%40babel/runtime@7.2.0", + "extracted_requirement": "^7.1.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@babel", + "name": "runtime", + "version": "7.2.0", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.2.0.tgz", + "size": null, + "sha1": "b03e42eeddf5898e00646e4c840fa07ba8dcad7f", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/regenerator-runtime", + "extracted_requirement": "^0.12.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@babel/runtime", + "repository_download_url": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.2.0.tgz", + "api_data_url": "https://registry.npmjs.org/@babel%2fruntime", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40babel/runtime@7.2.0" + } + }, + { + "purl": "pkg:npm/%40ballerina/api-designer@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "api-designer", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/api-designer/-/api-designer-0.99.0-RC3.tgz", + "size": null, + "sha1": "ef2a9a81173f76bbdf87b23fe369896271f5b5e6", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/%22%40types/swagger-parser%22", + "extracted_requirement": "^4.0.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/js-yaml", + "extracted_requirement": "^3.12.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/react-markdown", + "extracted_requirement": "^4.0.4", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/semantic-ui-css", + "extracted_requirement": "^2.4.1", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/semantic-ui-react", + "extracted_requirement": "^0.83.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/swagger-parser", + "extracted_requirement": "^5.0.5", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/swagger-schema-official", + "extracted_requirement": "^2.0.0-bab6bed", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/api-designer", + "repository_download_url": "https://registry.npmjs.org/@ballerina/api-designer/-/api-designer-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2fapi-designer", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/api-designer@0.99.0-RC3" + } + }, + { + "purl": "pkg:npm/%40ballerina/ast-model@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "ast-model", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/ast-model/-/ast-model-0.99.0-RC3.tgz", + "size": null, + "sha1": "07d8a25b809668dd687d74acd58b0071b7849aa8", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/%22%40ballerina/lang-service%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/glob", + "extracted_requirement": "^7.1.3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/lodash", + "extracted_requirement": "^4.17.11", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/prettier", + "extracted_requirement": "^1.5.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/prettier-tslint", + "extracted_requirement": "^0.4.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/vscode-uri", + "extracted_requirement": "^1.0.6", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/ast-model", + "repository_download_url": "https://registry.npmjs.org/@ballerina/ast-model/-/ast-model-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2fast-model", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/ast-model@0.99.0-RC3" + } + }, + { + "purl": "pkg:npm/%40ballerina/ballerina-by-examples@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "ballerina-by-examples", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/ballerina-by-examples/-/ballerina-by-examples-0.99.0-RC3.tgz", + "size": null, + "sha1": "470c7ae2f24cfebd267fd109be5a4395135b20aa", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/lodash", + "extracted_requirement": "^4.17.11", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/ballerina-by-examples", + "repository_download_url": "https://registry.npmjs.org/@ballerina/ballerina-by-examples/-/ballerina-by-examples-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2fballerina-by-examples", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/ballerina-by-examples@0.99.0-RC3" + } + }, + { + "purl": "pkg:npm/%40ballerina/diagram@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "diagram", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/diagram/-/diagram-0.99.0-RC3.tgz", + "size": null, + "sha1": "fb7953f1ce520d9b2f1d568bb4d88172bb5b4fec", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/%22%40ballerina/ast-model%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/font%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/lang-service%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/theme%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/lodash", + "extracted_requirement": "^4.17.11", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/lodash.debounce", + "extracted_requirement": "^4.0.8", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/log4javascript", + "extracted_requirement": "^1.4.15", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/diagram", + "repository_download_url": "https://registry.npmjs.org/@ballerina/diagram/-/diagram-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2fdiagram", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/diagram@0.99.0-RC3" + } + }, + { + "purl": "pkg:npm/%40ballerina/distribution@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "distribution", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/distribution/-/distribution-0.99.0-RC3.tgz", + "size": null, + "sha1": "b0d37b143a46ef8bc25111fa5ca052fac83e87bf", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/%22%40ballerina/api-designer%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/ballerina-by-examples%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/diagram%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/documentation%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/theme%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/%22%40ballerina/tracing%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/distribution", + "repository_download_url": "https://registry.npmjs.org/@ballerina/distribution/-/distribution-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2fdistribution", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/distribution@0.99.0-RC3" + } + }, + { + "purl": "pkg:npm/%40ballerina/documentation@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "documentation", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/documentation/-/documentation-0.99.0-RC3.tgz", + "size": null, + "sha1": "6041e6f9e76111c309801ebee2a3775387627f58", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/%22%40ballerina/ast-model%22", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/diff", + "extracted_requirement": "^3.5.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/escape-html", + "extracted_requirement": "^1.0.3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/react-markdown", + "extracted_requirement": "^4.0.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/documentation", + "repository_download_url": "https://registry.npmjs.org/@ballerina/documentation/-/documentation-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2fdocumentation", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/documentation@0.99.0-RC3" + } + }, + { + "purl": "pkg:npm/%40ballerina/font@0.99.0-RC3", + "extracted_requirement": "^0.99.0-RC3", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "@ballerina", + "name": "font", + "version": "0.99.0-RC3", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/@ballerina/font/-/font-0.99.0-RC3.tgz", + "size": null, + "sha1": "89721bfc045655addb34acd2ac49f0f5895d2292", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": "https://www.npmjs.com/package/@ballerina/font", + "repository_download_url": "https://registry.npmjs.org/@ballerina/font/-/font-0.99.0-RC3.tgz", + "api_data_url": "https://registry.npmjs.org/@ballerina%2ffont", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/%40ballerina/font@0.99.0-RC3" + } + }, + { + "purl": "pkg:npm/zip-dir@1.0.2", + "extracted_requirement": "^1.0.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": true, + "resolved_package": { + "type": "npm", + "namespace": "", + "name": "zip-dir", + "version": "1.0.2", + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": "https://registry.yarnpkg.com/zip-dir/-/zip-dir-1.0.2.tgz", + "size": null, + "sha1": "253f907aead62a21acd8721d8b88032b2411c051", + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/async", + "extracted_requirement": "^1.5.2", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + }, + { + "purl": "pkg:npm/jszip", + "extracted_requirement": "^2.4.0", + "scope": "dependencies", + "is_runtime": true, + "is_optional": false, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": "https://www.npmjs.com/package/zip-dir", + "repository_download_url": "https://registry.npmjs.org/zip-dir/-/zip-dir-1.0.2.tgz", + "api_data_url": "https://registry.npmjs.org/zip-dir/1.0.2", + "datasource_id": "yarn_lock_v1", + "purl": "pkg:npm/zip-dir@1.0.2" + } + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "yarn_lock_v1", + "purl": null + } + ], + "for_packages": [], + "scan_errors": [] + } + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/npm/private-and-yarn/theia/package.json b/tests/packagedcode/data/npm/private-and-yarn/theia/package.json new file mode 100644 index 00000000000..90d9ca7a42b --- /dev/null +++ b/tests/packagedcode/data/npm/private-and-yarn/theia/package.json @@ -0,0 +1,14 @@ +{ + "private": true, + "scripts": { + "prepare": "lerna run prepare", + "rebuild:browser": "theia rebuild:browser", + "rebuild:electron": "theia rebuild:electron" + }, + "devDependencies": { + "lerna": "3.13.0" + }, + "workspaces": [ + "ballerina-extension", "browser-app", "electron-app" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/npm/private-and-yarn/theia/yarn.lock b/tests/packagedcode/data/npm/private-and-yarn/theia/yarn.lock new file mode 100644 index 00000000000..abb6af68bf6 --- /dev/null +++ b/tests/packagedcode/data/npm/private-and-yarn/theia/yarn.lock @@ -0,0 +1,81 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/runtime@^7.1.2": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.2.0.tgz#b03e42eeddf5898e00646e4c840fa07ba8dcad7f" + dependencies: + regenerator-runtime "^0.12.0" + +"@ballerina/api-designer@^0.99.0-RC3": + version "0.99.0-RC3" + resolved "https://registry.yarnpkg.com/@ballerina/api-designer/-/api-designer-0.99.0-RC3.tgz#ef2a9a81173f76bbdf87b23fe369896271f5b5e6" + dependencies: + "@types/swagger-parser" "^4.0.2" + js-yaml "^3.12.0" + react-markdown "^4.0.4" + semantic-ui-css "^2.4.1" + semantic-ui-react "^0.83.0" + swagger-parser "^5.0.5" + swagger-schema-official "^2.0.0-bab6bed" + +"@ballerina/ast-model@^0.99.0-RC3": + version "0.99.0-RC3" + resolved "https://registry.yarnpkg.com/@ballerina/ast-model/-/ast-model-0.99.0-RC3.tgz#07d8a25b809668dd687d74acd58b0071b7849aa8" + dependencies: + "@ballerina/lang-service" "^0.99.0-RC3" + glob "^7.1.3" + lodash "^4.17.11" + prettier "^1.5.2" + prettier-tslint "^0.4.0" + vscode-uri "^1.0.6" + +"@ballerina/ballerina-by-examples@^0.99.0-RC3": + version "0.99.0-RC3" + resolved "https://registry.yarnpkg.com/@ballerina/ballerina-by-examples/-/ballerina-by-examples-0.99.0-RC3.tgz#470c7ae2f24cfebd267fd109be5a4395135b20aa" + dependencies: + lodash "^4.17.11" + +"@ballerina/diagram@^0.99.0-RC3": + version "0.99.0-RC3" + resolved "https://registry.yarnpkg.com/@ballerina/diagram/-/diagram-0.99.0-RC3.tgz#fb7953f1ce520d9b2f1d568bb4d88172bb5b4fec" + dependencies: + "@ballerina/ast-model" "^0.99.0-RC3" + "@ballerina/font" "^0.99.0-RC3" + "@ballerina/lang-service" "^0.99.0-RC3" + "@ballerina/theme" "^0.99.0-RC3" + lodash "^4.17.11" + lodash.debounce "^4.0.8" + log4javascript "^1.4.15" + +"@ballerina/distribution@^0.99.0-RC3": + version "0.99.0-RC3" + resolved "https://registry.yarnpkg.com/@ballerina/distribution/-/distribution-0.99.0-RC3.tgz#b0d37b143a46ef8bc25111fa5ca052fac83e87bf" + dependencies: + "@ballerina/api-designer" "^0.99.0-RC3" + "@ballerina/ballerina-by-examples" "^0.99.0-RC3" + "@ballerina/diagram" "^0.99.0-RC3" + "@ballerina/documentation" "^0.99.0-RC3" + "@ballerina/theme" "^0.99.0-RC3" + "@ballerina/tracing" "^0.99.0-RC3" + +"@ballerina/documentation@^0.99.0-RC3": + version "0.99.0-RC3" + resolved "https://registry.yarnpkg.com/@ballerina/documentation/-/documentation-0.99.0-RC3.tgz#6041e6f9e76111c309801ebee2a3775387627f58" + dependencies: + "@ballerina/ast-model" "^0.99.0-RC3" + diff "^3.5.0" + escape-html "^1.0.3" + react-markdown "^4.0.0" + +"@ballerina/font@^0.99.0-RC3": + version "0.99.0-RC3" + resolved "https://registry.yarnpkg.com/@ballerina/font/-/font-0.99.0-RC3.tgz#89721bfc045655addb34acd2ac49f0f5895d2292" + +zip-dir@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/zip-dir/-/zip-dir-1.0.2.tgz#253f907aead62a21acd8721d8b88032b2411c051" + dependencies: + async "^1.5.2" + jszip "^2.4.0" diff --git a/tests/packagedcode/data/npm/private/package.json b/tests/packagedcode/data/npm/private/package.json new file mode 100644 index 00000000000..90d9ca7a42b --- /dev/null +++ b/tests/packagedcode/data/npm/private/package.json @@ -0,0 +1,14 @@ +{ + "private": true, + "scripts": { + "prepare": "lerna run prepare", + "rebuild:browser": "theia rebuild:browser", + "rebuild:electron": "theia rebuild:electron" + }, + "devDependencies": { + "lerna": "3.13.0" + }, + "workspaces": [ + "ballerina-extension", "browser-app", "electron-app" + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/npm/private/scan.expected.json b/tests/packagedcode/data/npm/private/scan.expected.json new file mode 100644 index 00000000000..5d32123fdc0 --- /dev/null +++ b/tests/packagedcode/data/npm/private/scan.expected.json @@ -0,0 +1,74 @@ +{ + "dependencies": [ + { + "purl": "pkg:npm/lerna", + "extracted_requirement": "3.13.0", + "scope": "devDependencies", + "is_runtime": false, + "is_optional": true, + "is_resolved": false, + "resolved_package": {}, + "dependency_uid": "pkg:npm/lerna?uuid=fixed-uid-done-for-testing-5642512d1758", + "for_package_uid": null, + "datafile_path": "package.json", + "datasource_id": "npm_package_json" + } + ], + "packages": [], + "files": [ + { + "path": "package.json", + "type": "file", + "package_data": [ + { + "type": "npm", + "namespace": null, + "name": null, + "version": null, + "qualifiers": {}, + "subpath": null, + "primary_language": "JavaScript", + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "license_expression": null, + "declared_license": [], + "notice_text": null, + "source_packages": [], + "file_references": [], + "extra_data": {}, + "dependencies": [ + { + "purl": "pkg:npm/lerna", + "extracted_requirement": "3.13.0", + "scope": "devDependencies", + "is_runtime": false, + "is_optional": true, + "is_resolved": false, + "resolved_package": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "npm_package_json", + "purl": null + } + ], + "for_packages": [], + "scan_errors": [] + } + ] +} \ No newline at end of file diff --git a/tests/packagedcode/data/npm/with_name/package.json.expected b/tests/packagedcode/data/npm/with_name/package.json.expected index 7fccf7fe3f5..7fee980e749 100644 --- a/tests/packagedcode/data/npm/with_name/package.json.expected +++ b/tests/packagedcode/data/npm/with_name/package.json.expected @@ -12,7 +12,7 @@ "parties": [], "keywords": [], "homepage_url": null, - "download_url": "https://registry.npmjs.org/bson/-/bson-None.tgz", + "download_url": null, "size": null, "sha1": null, "md5": null, @@ -35,7 +35,7 @@ "extra_data": {}, "dependencies": [], "repository_homepage_url": "https://www.npmjs.com/package/bson", - "repository_download_url": "https://registry.npmjs.org/bson/-/bson-None.tgz", + "repository_download_url": null, "api_data_url": "https://registry.npmjs.org/bson", "datasource_id": "npm_package_json", "purl": "pkg:npm/bson" diff --git a/tests/packagedcode/test_npm.py b/tests/packagedcode/test_npm.py index 0e61c51e7a7..61321a438fd 100644 --- a/tests/packagedcode/test_npm.py +++ b/tests/packagedcode/test_npm.py @@ -372,6 +372,24 @@ def test_npm_electron_scan(self): expected_file, result_file, remove_uuid=True, regen=REGEN_TEST_FIXTURES ) + def test_npm_scan_with_private_package_json(self): + test_file = self.get_test_loc('npm/private/package.json') + expected_file = self.get_test_loc('npm/private/scan.expected.json', must_exist=False) + result_file = self.get_temp_file('results.json') + run_scan_click(['--package', test_file, '--json', result_file]) + check_json_scan( + expected_file, result_file, remove_uuid=True, regen=REGEN_TEST_FIXTURES + ) + + def test_npm_scan_with_private_package_json_and_yarn_lock(self): + test_file = self.get_test_loc('npm/private-and-yarn/theia/') + expected_file = self.get_test_loc('npm/private-and-yarn/scan.expected.json', must_exist=False) + result_file = self.get_temp_file('results.json') + run_scan_click(['--package', test_file, '--json', result_file]) + check_json_scan( + expected_file, result_file, remove_uuid=True, regen=REGEN_TEST_FIXTURES + ) + test_data = [ (['MIT'], 'mit'),