From 9c883f88aa163abcc4cbb562ef3cbacc4bc8ab80 Mon Sep 17 00:00:00 2001 From: Matt Mackay Date: Sun, 18 Oct 2020 08:34:34 -0400 Subject: [PATCH 1/2] feat(builtin): flip the default of the strict_visibility flag on the npm and yarn install rules to True --- e2e/concatjs_devserver/package.json | 1 + e2e/jasmine/package.json | 3 +- e2e/jasmine/yarn.lock | 5 +++ examples/angular/package.json | 6 +++ examples/angular_view_engine/package.json | 3 ++ examples/app/package.json | 1 + examples/app/yarn.lock | 5 +++ examples/create-react-app/package.json | 1 + examples/cypress/package.json | 1 + examples/cypress/yarn.lock | 7 ++++ examples/nestjs/package.json | 4 +- examples/protocol_buffers/package.json | 3 ++ examples/react_webpack/package.json | 1 + examples/web_testing/package.json | 2 + examples/web_testing/yarn.lock | 5 +++ internal/npm_install/generate_build_file.ts | 2 +- internal/npm_install/index.js | 2 +- internal/npm_install/npm_install.bzl | 4 +- .../test/golden/BUILD.bazel.golden | 38 +++++++++++++++++++ .../test/golden/jasmine/BUILD.bazel.golden | 22 ++++++++++- package.json | 3 ++ packages/cypress/test/package.json | 1 + packages/cypress/test/yarn.lock | 7 ++++ tools/fine_grained_deps_npm/package.json | 1 + tools/fine_grained_deps_yarn/package.json | 1 + tools/fine_grained_deps_yarn/yarn.lock | 2 +- tools/fine_grained_goldens/package.json | 1 + tools/fine_grained_goldens/yarn.lock | 5 +++ yarn.lock | 21 +++++++++- 29 files changed, 148 insertions(+), 10 deletions(-) diff --git a/e2e/concatjs_devserver/package.json b/e2e/concatjs_devserver/package.json index 8b8a9aacf0..504dd6041d 100644 --- a/e2e/concatjs_devserver/package.json +++ b/e2e/concatjs_devserver/package.json @@ -10,6 +10,7 @@ "jasmine": "2.8.0", "protractor": "^5.4.2", "rxjs": "^6.5.2", + "tslib": "^1.9.0", "typeorm": "^0.2.17", "typescript": "2.7.x" }, diff --git a/e2e/jasmine/package.json b/e2e/jasmine/package.json index 918feaa96f..04e0b7f074 100644 --- a/e2e/jasmine/package.json +++ b/e2e/jasmine/package.json @@ -9,6 +9,7 @@ "test": "bazel test ..." }, "devDependencies": { - "jasmine": "2.99.0" + "jasmine": "2.99.0", + "jasmine-core": "2.99.0" } } diff --git a/e2e/jasmine/yarn.lock b/e2e/jasmine/yarn.lock index 03cb69da0d..19c32aeb66 100644 --- a/e2e/jasmine/yarn.lock +++ b/e2e/jasmine/yarn.lock @@ -260,6 +260,11 @@ istanbul-reports@^3.0.2: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" +jasmine-core@2.99.0: + version "2.99.0" + resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.99.0.tgz#c105ab5222da45f1b0a10580383f5adbbff56d2c" + integrity sha1-wQWrUiLaRfGwoQWAOD9a27/1bSw= + jasmine-core@~2.99.0: version "2.99.1" resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.99.1.tgz#e6400df1e6b56e130b61c4bcd093daa7f6e8ca15" diff --git a/examples/angular/package.json b/examples/angular/package.json index cbdef77fab..19c9655090 100644 --- a/examples/angular/package.json +++ b/examples/angular/package.json @@ -22,6 +22,8 @@ "@ngrx/store": "9.2.0", "@nguniversal/express-engine": "^9.0.0", "date-fns": "1.30.1", + "domino": "^2.1.2", + "reflect-metadata": "^0.1.2", "rxjs": "6.5.3", "systemjs": "6.1.2", "tslib": "2.0.0", @@ -50,9 +52,12 @@ "@types/jasmine": "3.4.0", "@types/node": "6.14.6", "core-js": "2.6.9", + "express": "^4.14.0", "firebase-tools": "7.1.0", "history-server": "^1.3.1", "html-insert-assets": "^0.6.0", + "jasmine": "2.8.0", + "jasmine-core": "2.8.0", "karma": "~4.1.0", "karma-chrome-launcher": "2.2.0", "karma-firefox-launcher": "1.1.0", @@ -63,6 +68,7 @@ "requirejs": "2.3.6", "rollup": "^2.3.4", "terser": "4.3.1", + "tmp": "0.1.0", "typescript": "^3.9.0" }, "scripts": { diff --git a/examples/angular_view_engine/package.json b/examples/angular_view_engine/package.json index cd53887a3e..70c3a9af71 100644 --- a/examples/angular_view_engine/package.json +++ b/examples/angular_view_engine/package.json @@ -50,6 +50,8 @@ "firebase-tools": "7.1.0", "history-server": "^1.3.1", "html-insert-assets": "^0.6.0", + "jasmine": "2.8.0", + "jasmine-core": "2.8.0", "karma": "~4.1.0", "karma-chrome-launcher": "2.2.0", "karma-firefox-launcher": "1.1.0", @@ -63,6 +65,7 @@ "rollup-plugin-amd": "^4.0.0", "rollup-plugin-re": "^1.0.7", "terser": "4.3.1", + "tmp": "0.1.0", "typescript": "3.4.5" }, "scripts": { diff --git a/examples/app/package.json b/examples/app/package.json index 4e5c139c5d..e3106d748b 100644 --- a/examples/app/package.json +++ b/examples/app/package.json @@ -6,6 +6,7 @@ "@bazel/terser": "^2.2.2", "@bazel/typescript": "^2.2.2", "@types/jasmine": "3.3.15", + "@types/node": "^12.12.2", "html-insert-assets": "^0.6.0", "http-server": "^0.11.1", "less": "^3.10.3", diff --git a/examples/app/yarn.lock b/examples/app/yarn.lock index 1cb9c27e2b..962d2a083b 100644 --- a/examples/app/yarn.lock +++ b/examples/app/yarn.lock @@ -100,6 +100,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.21.tgz#4a9db7ef1d1671c0015e632c5fa3d46c86c58c1e" integrity sha512-nuFlRdBiqbF+PJIEVxm2jLFcQWN7q7iWEJGsBV4n7v1dbI9qXB8im2pMMKMCUZe092sQb5SQft2DHfuQGK5hqQ== +"@types/node@^12.12.2": + version "12.12.68" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.68.tgz#dd5acf4a52a458ff1d9ef4fd66406fba0afbbb33" + integrity sha512-3RW2s24ewB7F9dAHvgb9FRvNHn6nO9IK6Eaknbz7HTOe2a5GVne5XbUh5+YA+kcCn67glyHhClUUdFP73LWrgQ== + "@types/node@^12.7.2": version "12.7.8" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.8.tgz#cb1bf6800238898bc2ff6ffa5702c3cadd350708" diff --git a/examples/create-react-app/package.json b/examples/create-react-app/package.json index ff9832af66..94580b3b0e 100644 --- a/examples/create-react-app/package.json +++ b/examples/create-react-app/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { + "@testing-library/dom": "^6.15.0", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", diff --git a/examples/cypress/package.json b/examples/cypress/package.json index 1a102ed7c6..c750e75262 100644 --- a/examples/cypress/package.json +++ b/examples/cypress/package.json @@ -12,6 +12,7 @@ "@cypress/browserify-preprocessor": "^3.0.0", "@types/node": "14.0.13", "cypress": "^4.8.0", + "rxjs": "^6.5.2", "typescript": "3.9.5" }, "scripts": { diff --git a/examples/cypress/yarn.lock b/examples/cypress/yarn.lock index de49d0ba18..1c62b57d3a 100644 --- a/examples/cypress/yarn.lock +++ b/examples/cypress/yarn.lock @@ -3856,6 +3856,13 @@ rxjs@^6.3.3: dependencies: tslib "^1.9.0" +rxjs@^6.5.2: + version "6.6.3" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.3.tgz#8ca84635c4daa900c0d3967a6ee7ac60271ee552" + integrity sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ== + dependencies: + tslib "^1.9.0" + safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" diff --git a/examples/nestjs/package.json b/examples/nestjs/package.json index ac6edd3267..3a2f7f28f9 100644 --- a/examples/nestjs/package.json +++ b/examples/nestjs/package.json @@ -14,11 +14,13 @@ "minimist": "1.2.0", "reflect-metadata": "0.1.13", "rxjs": "6.5.2", - "supertest": "^4.0.2" + "supertest": "^4.0.2", + "superagent": "~3.8.3" }, "devDependencies": { "@bazel/typescript": "^2.2.2", "@types/node": "12.6.3", + "tslib": "^1.9.0", "typescript": "3.5.3" }, "scripts": { diff --git a/examples/protocol_buffers/package.json b/examples/protocol_buffers/package.json index 2d0a307d1a..0566796a8d 100644 --- a/examples/protocol_buffers/package.json +++ b/examples/protocol_buffers/package.json @@ -15,6 +15,8 @@ "google-protobuf": "3.11.4", "grpc-web": "1.1.0", "http-server": "^0.11.1", + "jasmine": "2.8.0", + "jasmine-core": "2.8.0", "karma": "~4.1.0", "karma-chrome-launcher": "2.2.0", "karma-firefox-launcher": "1.1.0", @@ -27,6 +29,7 @@ "requirejs": "2.3.6", "rollup": "2.3.4", "terser": "4.3.1", + "tmp": "0.1.0", "typescript": "^3.3.1" }, "scripts": { diff --git a/examples/react_webpack/package.json b/examples/react_webpack/package.json index 2f575cf369..8ef2641991 100644 --- a/examples/react_webpack/package.json +++ b/examples/react_webpack/package.json @@ -8,6 +8,7 @@ "@types/react": "^16.9.5", "@types/react-dom": "^16.9.1", "css-loader": "^3.2.0", + "csstype": "^2.2.0", "http-server": "^0.11.1", "react": "^16.10.2", "react-dom": "^16.10.2", diff --git a/examples/web_testing/package.json b/examples/web_testing/package.json index 0a5edc64ec..dc40dd0233 100644 --- a/examples/web_testing/package.json +++ b/examples/web_testing/package.json @@ -4,6 +4,7 @@ "@bazel/typescript": "^2.2.2", "@types/jasmine": "2.8.2", "@types/node": "11.11.1", + "jasmine-core": "^3.3.0", "karma": "~4.1.0", "karma-chrome-launcher": "2.2.0", "karma-firefox-launcher": "1.1.0", @@ -12,6 +13,7 @@ "karma-requirejs": "1.1.0", "karma-sourcemap-loader": "0.3.7", "requirejs": "2.3.6", + "tmp": "0.1.0", "typescript": "^3.3.1" }, "scripts": { diff --git a/examples/web_testing/yarn.lock b/examples/web_testing/yarn.lock index cff9f5ed84..30104c5da1 100644 --- a/examples/web_testing/yarn.lock +++ b/examples/web_testing/yarn.lock @@ -1064,6 +1064,11 @@ jasmine-core@^3.3: resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.5.0.tgz#132c23e645af96d85c8bca13c8758b18429fc1e4" integrity sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA== +jasmine-core@^3.3.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.6.0.tgz#491f3bb23941799c353ceb7a45b38a950ebc5a20" + integrity sha512-8uQYa7zJN8hq9z+g8z1bqCfdC8eoDAeVnM5sfqs7KHv9/ifoJ500m018fpFc7RDaO6SWCLCXwo/wPSNcdYTgcw== + jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" diff --git a/internal/npm_install/generate_build_file.ts b/internal/npm_install/generate_build_file.ts index 8dd0e5080f..e81991f07a 100644 --- a/internal/npm_install/generate_build_file.ts +++ b/internal/npm_install/generate_build_file.ts @@ -596,7 +596,7 @@ export function parsePackage(p: string, dependencies: Set = new Set()): // set if this is a direct dependency of the root package.json file // which is later used to determine the generated rules visibility - pkg._directDependency = dependencies.has(pkg._moduleName); + pkg._directDependency = dependencies.has(pkg._moduleName) || dependencies.has(pkg._name); return pkg; } diff --git a/internal/npm_install/index.js b/internal/npm_install/index.js index 40c0bd121f..c0a025b923 100644 --- a/internal/npm_install/index.js +++ b/internal/npm_install/index.js @@ -356,7 +356,7 @@ function parsePackage(p, dependencies = new Set()) { pkg._files = listFiles(p); pkg._runfiles = pkg._files.filter((f) => !/[^\x21-\x7E]/.test(f)); pkg._dependencies = []; - pkg._directDependency = dependencies.has(pkg._moduleName); + pkg._directDependency = dependencies.has(pkg._moduleName) || dependencies.has(pkg._name); return pkg; } exports.parsePackage = parsePackage; diff --git a/internal/npm_install/npm_install.bzl b/internal/npm_install/npm_install.bzl index 17d21b7c53..c74b9533e7 100644 --- a/internal/npm_install/npm_install.bzl +++ b/internal/npm_install/npm_install.bzl @@ -84,14 +84,12 @@ fine grained npm dependencies. doc = "If stdout and stderr should be printed to the terminal.", ), "strict_visibility": attr.bool( - default = False, + default = True, doc = """Turn on stricter visibility for generated BUILD.bazel files When enabled, only dependencies within the given `package.json` file are given public visibility. All transitive dependencies are given limited visibility, enforcing that all direct dependencies are listed in the `package.json` file. - -Currently the default is set `False`, but will likely be flipped `True` in rules_nodejs 3.0.0 """, ), "symlink_node_modules": attr.bool( diff --git a/internal/npm_install/test/golden/BUILD.bazel.golden b/internal/npm_install/test/golden/BUILD.bazel.golden index 566c195d0c..8890846b38 100644 --- a/internal/npm_install/test/golden/BUILD.bazel.golden +++ b/internal/npm_install/test/golden/BUILD.bazel.golden @@ -195,6 +195,44 @@ exports_files([ "node_modules/jasmine/lib/jasmine.js", "node_modules/jasmine/lib/reporters/completion_reporter.js", "node_modules/jasmine/lib/reporters/console_reporter.js", + "node_modules/jasmine/node_modules/jasmine-core/.editorconfig", + "node_modules/jasmine/node_modules/jasmine-core/.github/CONTRIBUTING.md", + "node_modules/jasmine/node_modules/jasmine-core/.github/ISSUE_TEMPLATE.md", + "node_modules/jasmine/node_modules/jasmine-core/.github/PULL_REQUEST_TEMPLATE.md", + "node_modules/jasmine/node_modules/jasmine-core/.ruby-version", + "node_modules/jasmine/node_modules/jasmine-core/CODE_OF_CONDUCT.md", + "node_modules/jasmine/node_modules/jasmine-core/MANIFEST.in", + "node_modules/jasmine/node_modules/jasmine-core/MIT.LICENSE", + "node_modules/jasmine/node_modules/jasmine-core/README.md", + "node_modules/jasmine/node_modules/jasmine-core/RELEASE.md", + "node_modules/jasmine/node_modules/jasmine-core/bower.json", + "node_modules/jasmine/node_modules/jasmine-core/images/__init__.pyc", + "node_modules/jasmine/node_modules/jasmine-core/images/__pycache__/__init__.cpython-36.pyc", + "node_modules/jasmine/node_modules/jasmine-core/images/jasmine-horizontal.png", + "node_modules/jasmine/node_modules/jasmine-core/images/jasmine-horizontal.svg", + "node_modules/jasmine/node_modules/jasmine-core/images/jasmine_favicon.png", + "node_modules/jasmine/node_modules/jasmine-core/jasmine_core.egg-info/PKG-INFO", + "node_modules/jasmine/node_modules/jasmine-core/jasmine_core.egg-info/SOURCES.txt", + "node_modules/jasmine/node_modules/jasmine-core/jasmine_core.egg-info/dependency_links.txt", + "node_modules/jasmine/node_modules/jasmine-core/jasmine_core.egg-info/requires.txt", + "node_modules/jasmine/node_modules/jasmine-core/jasmine_core.egg-info/top_level.txt", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core.js", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/boot.js", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/node_example/lib/jasmine_examples/Player.js", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/node_example/lib/jasmine_examples/Song.js", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/node_example/spec/helpers/jasmine_examples/SpecHelper.js", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/node_example/spec/jasmine_examples/PlayerSpec.js", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/spec/PlayerSpec.js", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/spec/SpecHelper.js", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/src/Player.js", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/src/Song.js", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.css", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/json2.js", + "node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/node_boot.js", + "node_modules/jasmine/node_modules/jasmine-core/package.json", + "node_modules/jasmine/node_modules/jasmine-core/requirements.txt", "node_modules/jasmine/package.json", "node_modules/jasmine/tasks/jasmine.js", "node_modules/jasmine-core/.editorconfig", diff --git a/internal/npm_install/test/golden/jasmine/BUILD.bazel.golden b/internal/npm_install/test/golden/jasmine/BUILD.bazel.golden index 5e4336ee80..9ac5603486 100644 --- a/internal/npm_install/test/golden/jasmine/BUILD.bazel.golden +++ b/internal/npm_install/test/golden/jasmine/BUILD.bazel.golden @@ -19,6 +19,27 @@ filegroup( ) filegroup( name = "jasmine__nested_node_modules", + srcs = [ + "//:node_modules/jasmine/node_modules/jasmine-core/.editorconfig", + "//:node_modules/jasmine/node_modules/jasmine-core/.ruby-version", + "//:node_modules/jasmine/node_modules/jasmine-core/bower.json", + "//:node_modules/jasmine/node_modules/jasmine-core/jasmine_core.egg-info/PKG-INFO", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core.js", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/boot.js", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/node_example/lib/jasmine_examples/Player.js", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/node_example/lib/jasmine_examples/Song.js", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/node_example/spec/helpers/jasmine_examples/SpecHelper.js", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/node_example/spec/jasmine_examples/PlayerSpec.js", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/spec/PlayerSpec.js", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/spec/SpecHelper.js", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/src/Player.js", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/example/src/Song.js", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/json2.js", + "//:node_modules/jasmine/node_modules/jasmine-core/lib/jasmine-core/node_boot.js", + "//:node_modules/jasmine/node_modules/jasmine-core/package.json", + ], visibility = ["//:__subpackages__"], ) filegroup( @@ -50,7 +71,6 @@ js_library( "//balanced-match:balanced-match__contents", "//concat-map:concat-map__contents", "//path-is-absolute:path-is-absolute__contents", - "//jasmine-core:jasmine-core__contents", ], ) js_library( diff --git a/package.json b/package.json index 856a1ac3bd..4fc3799d65 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,8 @@ "@babel/cli": "^7.6.2", "@babel/core": "^7.6.2", "@babel/preset-env": "^7.6.2", + "@babel/parser": "^7.6.2", + "@babel/types": "^7.6.2", "@bazel/bazelisk": "^1.5.0", "@bazel/buildifier": "^3.2.0", "@bazel/buildozer": "^3.2.0", @@ -51,6 +53,7 @@ "jasmine-core": "~3.4.0", "jasmine-reporters": "~2.3.2", "jest": "~25.3.0", + "jest-cli": "~25.3.0", "jest-websocket-mock": "~2.0.2", "karma": "~4.1.0", "karma-chrome-launcher": "2.2.0", diff --git a/packages/cypress/test/package.json b/packages/cypress/test/package.json index f8fcf686b5..b193703388 100644 --- a/packages/cypress/test/package.json +++ b/packages/cypress/test/package.json @@ -6,6 +6,7 @@ "cypress": "^4.8.0", "@cypress/browserify-preprocessor": "^3.0.0", "@types/node": "14.0.14", + "rxjs": "^6.5.2", "typescript": "3.9.5" } } \ No newline at end of file diff --git a/packages/cypress/test/yarn.lock b/packages/cypress/test/yarn.lock index 10757a242c..51e911dddb 100644 --- a/packages/cypress/test/yarn.lock +++ b/packages/cypress/test/yarn.lock @@ -3696,6 +3696,13 @@ rxjs@^6.3.3: dependencies: tslib "^1.9.0" +rxjs@^6.5.2: + version "6.6.3" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.3.tgz#8ca84635c4daa900c0d3967a6ee7ac60271ee552" + integrity sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ== + dependencies: + tslib "^1.9.0" + safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" diff --git a/tools/fine_grained_deps_npm/package.json b/tools/fine_grained_deps_npm/package.json index a57c6deba8..756fce271b 100644 --- a/tools/fine_grained_deps_npm/package.json +++ b/tools/fine_grained_deps_npm/package.json @@ -2,6 +2,7 @@ "description": "runtime dependencies fine_grained_deps e2e test", "devDependencies": { "jasmine": "3.3.0", + "jasmine-core": "3.3.0", "typescript": "3.0.3" }, "dependencies": { diff --git a/tools/fine_grained_deps_yarn/package.json b/tools/fine_grained_deps_yarn/package.json index a57c6deba8..756fce271b 100644 --- a/tools/fine_grained_deps_yarn/package.json +++ b/tools/fine_grained_deps_yarn/package.json @@ -2,6 +2,7 @@ "description": "runtime dependencies fine_grained_deps e2e test", "devDependencies": { "jasmine": "3.3.0", + "jasmine-core": "3.3.0", "typescript": "3.0.3" }, "dependencies": { diff --git a/tools/fine_grained_deps_yarn/yarn.lock b/tools/fine_grained_deps_yarn/yarn.lock index d5a1aafe31..babc1065b2 100644 --- a/tools/fine_grained_deps_yarn/yarn.lock +++ b/tools/fine_grained_deps_yarn/yarn.lock @@ -702,7 +702,7 @@ isobject@^3.0.0, isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= -jasmine-core@~3.3.0: +jasmine-core@3.3.0, jasmine-core@~3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.3.0.tgz#dea1cdc634bc93c7e0d4ad27185df30fa971b10e" integrity sha512-3/xSmG/d35hf80BEN66Y6g9Ca5l/Isdeg/j6zvbTYlTzeKinzmaTM4p9am5kYqOmE05D7s1t8FGjzdSnbUbceA== diff --git a/tools/fine_grained_goldens/package.json b/tools/fine_grained_goldens/package.json index ab44cbe043..03f833aaa5 100644 --- a/tools/fine_grained_goldens/package.json +++ b/tools/fine_grained_goldens/package.json @@ -7,6 +7,7 @@ "@gregmagolan/test-b": "0.0.2", "ajv": "5.5.2", "jasmine": "3.2.0", + "jasmine-core": "3.3.0", "rxjs": "6.5.0", "unidiff": "0.0.4", "zone.js": "^0.9.0" diff --git a/tools/fine_grained_goldens/yarn.lock b/tools/fine_grained_goldens/yarn.lock index ccd836ca4d..d0e81245e4 100644 --- a/tools/fine_grained_goldens/yarn.lock +++ b/tools/fine_grained_goldens/yarn.lock @@ -103,6 +103,11 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= +jasmine-core@3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.3.0.tgz#dea1cdc634bc93c7e0d4ad27185df30fa971b10e" + integrity sha512-3/xSmG/d35hf80BEN66Y6g9Ca5l/Isdeg/j6zvbTYlTzeKinzmaTM4p9am5kYqOmE05D7s1t8FGjzdSnbUbceA== + jasmine-core@~3.2.0: version "3.2.1" resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.2.1.tgz#8e4ff5b861603ee83343f2b49eee6a0ffe9650ce" diff --git a/yarn.lock b/yarn.lock index c9b4d42f80..7364805089 100644 --- a/yarn.lock +++ b/yarn.lock @@ -353,6 +353,11 @@ dependencies: "@babel/types" "^7.8.3" +"@babel/helper-validator-identifier@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" + integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== + "@babel/helper-validator-identifier@^7.9.0", "@babel/helper-validator-identifier@^7.9.5": version "7.9.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz#90977a8e6fbf6b431a7dc31752eee233bf052d80" @@ -937,6 +942,15 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@babel/types@^7.6.2": + version "7.12.1" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.1.tgz#e109d9ab99a8de735be287ee3d6a9947a190c4ae" + integrity sha512-BzSY3NJBKM4kyatSOWh3D/JJ2O3CVzBybHWxtgxnggaxEuaSTTDqeiSb/xk9lrkw2Tbqyivw5ZU4rT+EfznQsA== + dependencies: + "@babel/helper-validator-identifier" "^7.10.4" + lodash "^4.17.19" + to-fast-properties "^2.0.0" + "@bazel/bazelisk@^1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@bazel/bazelisk/-/bazelisk-1.5.0.tgz#61f583ed93be138b47be7180403938ea4057f54b" @@ -5478,7 +5492,7 @@ jest-changed-files@^25.3.0: execa "^3.2.0" throat "^5.0.0" -jest-cli@^25.3.0: +jest-cli@^25.3.0, jest-cli@~25.3.0: version "25.3.0" resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-25.3.0.tgz#d9e11f5700cc5946583cf0d01a9bdebceed448d2" integrity sha512-XpNQPlW1tzpP7RGG8dxpkRegYDuLjzSiENu92+CYM87nEbmEPb3b4+yo8xcsHOnj0AG7DUt9b3uG8LuHI3MDzw== @@ -6463,6 +6477,11 @@ lodash@^4.14.14, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17 resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== +lodash@^4.17.19: + version "4.17.20" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" + integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== + log4js@^4.0.0: version "4.5.1" resolved "https://registry.yarnpkg.com/log4js/-/log4js-4.5.1.tgz#e543625e97d9e6f3e6e7c9fc196dd6ab2cae30b5" From 9bef60edf76bdb36d0fbd88698b41284efde48b9 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Mon, 26 Oct 2020 22:13:54 -0700 Subject: [PATCH 2/2] chore(karma): remove dependency on tmp --- examples/angular/package.json | 1 - examples/angular_view_engine/package.json | 1 - examples/protocol_buffers/package.json | 1 - examples/web_testing/package.json | 1 - packages/karma/BUILD.bazel | 2 -- packages/karma/index.ts | 9 ++++----- packages/karma/karma.conf.js | 10 +++++----- packages/karma/karma_web_test.bzl | 1 - packages/karma/package.json | 3 --- 9 files changed, 9 insertions(+), 20 deletions(-) diff --git a/examples/angular/package.json b/examples/angular/package.json index 19c9655090..54239c1a2e 100644 --- a/examples/angular/package.json +++ b/examples/angular/package.json @@ -68,7 +68,6 @@ "requirejs": "2.3.6", "rollup": "^2.3.4", "terser": "4.3.1", - "tmp": "0.1.0", "typescript": "^3.9.0" }, "scripts": { diff --git a/examples/angular_view_engine/package.json b/examples/angular_view_engine/package.json index 70c3a9af71..f1f8019abc 100644 --- a/examples/angular_view_engine/package.json +++ b/examples/angular_view_engine/package.json @@ -65,7 +65,6 @@ "rollup-plugin-amd": "^4.0.0", "rollup-plugin-re": "^1.0.7", "terser": "4.3.1", - "tmp": "0.1.0", "typescript": "3.4.5" }, "scripts": { diff --git a/examples/protocol_buffers/package.json b/examples/protocol_buffers/package.json index 0566796a8d..9cf5fd9f96 100644 --- a/examples/protocol_buffers/package.json +++ b/examples/protocol_buffers/package.json @@ -29,7 +29,6 @@ "requirejs": "2.3.6", "rollup": "2.3.4", "terser": "4.3.1", - "tmp": "0.1.0", "typescript": "^3.3.1" }, "scripts": { diff --git a/examples/web_testing/package.json b/examples/web_testing/package.json index dc40dd0233..4a82962cb7 100644 --- a/examples/web_testing/package.json +++ b/examples/web_testing/package.json @@ -13,7 +13,6 @@ "karma-requirejs": "1.1.0", "karma-sourcemap-loader": "0.3.7", "requirejs": "2.3.6", - "tmp": "0.1.0", "typescript": "^3.3.1" }, "scripts": { diff --git a/packages/karma/BUILD.bazel b/packages/karma/BUILD.bazel index bd81678031..e47e07a08f 100644 --- a/packages/karma/BUILD.bazel +++ b/packages/karma/BUILD.bazel @@ -30,7 +30,6 @@ ts_library( tsconfig = ":tsconfig.json", deps = [ "@npm//@types/node", - "@npm//tmp", ], ) @@ -46,7 +45,6 @@ nodejs_binary( "@npm//karma-requirejs", "@npm//karma-sourcemap-loader", "@npm//requirejs", - "@npm//tmp", ], entry_point = "@npm//:node_modules/karma/bin/karma", ) diff --git a/packages/karma/index.ts b/packages/karma/index.ts index e14e74f812..31308ab358 100644 --- a/packages/karma/index.ts +++ b/packages/karma/index.ts @@ -6,7 +6,6 @@ import * as fs from 'fs'; import * as path from 'path'; import * as process from 'process'; import {createInterface} from 'readline'; -import * as tmp from 'tmp'; /// /** @@ -24,14 +23,14 @@ function sha1(data) { function initConcatJs(logger, emitter, basePath, hostname, port) { const log = logger.create('framework.concat_js'); - // Create a tmp file for the concat bundle that is automatically cleaned up on - // exit. - const tmpFile = tmp.fileSync({keep: false, dir: process.env['TEST_TMPDIR']}); + // Create a tmp file for the concat bundle, rely on Bazel to clean the TMPDIR + const tmpFile = + path.join(process.env['TEST_TMPDIR'], crypto.randomBytes(6).readUIntLE(0, 6).toString(36)); emitter.on('file_list_modified', files => { const bundleFile = { path: '/concatjs_bundle.js', - contentPath: tmpFile.name, + contentPath: tmpFile, isUrl: false, content: '', encodings: {}, diff --git a/packages/karma/karma.conf.js b/packages/karma/karma.conf.js index ccc78da5db..de39889783 100644 --- a/packages/karma/karma.conf.js +++ b/packages/karma/karma.conf.js @@ -1,9 +1,9 @@ // Karma configuration // GENERATED BY Bazel try { + const crypto = require('crypto'); const fs = require('fs'); const path = require('path'); - const tmp = require('tmp'); const child_process = require('child_process'); const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']); @@ -272,10 +272,10 @@ try { })(); `; - const requireConfigFile = - tmp.fileSync({keep: false, postfix: '.js', dir: process.env['TEST_TMPDIR']}); - fs.writeFileSync(requireConfigFile.name, requireConfigContent); - conf.files.push(requireConfigFile.name); + const requireConfigFile = path.join( + process.env['TEST_TMPDIR'], crypto.randomBytes(6).readUIntLE(0, 6).toString(36) + '.js'); + fs.writeFileSync(requireConfigFile, requireConfigContent); + conf.files.push(requireConfigFile); } /** diff --git a/packages/karma/karma_web_test.bzl b/packages/karma/karma_web_test.bzl index 58c2f1a0c4..3c2faf10e4 100644 --- a/packages/karma/karma_web_test.bzl +++ b/packages/karma/karma_web_test.bzl @@ -29,7 +29,6 @@ KARMA_PEER_DEPS = [ "@npm//karma-requirejs", "@npm//karma-sourcemap-loader", "@npm//requirejs", - "@npm//tmp", ] KARMA_WEB_TEST_ATTRS = { diff --git a/packages/karma/package.json b/packages/karma/package.json index 3823307b3d..e7892640c7 100644 --- a/packages/karma/package.json +++ b/packages/karma/package.json @@ -17,9 +17,6 @@ ], "main": "./index.js", "typings": "./index.d.ts", - "dependencies": { - "tmp": "0.1.0" - }, "peerDependencies": { "jasmine-core": ">=2.0.0", "karma": ">=4.0.0",