Substitute v8-profiler with v8-profiler-node8 (#2525)

Summary:
This commit addresses issue #2520. In brief, `v8-profiler` fails to build on recent node versions.
Pull Request resolved: https://github.com/facebook/prepack/pull/2525

Reviewed By: hermanventer

Differential Revision: D9689106

Pulled By: NTillmann

fbshipit-source-id: 9169321bdc23dfbfdf24b50fe7885dab36c5322e
This commit is contained in:
kdex 2018-09-07 16:33:08 -07:00 committed by Facebook Github Bot
parent 59c7677b8c
commit eef69b9463
6 changed files with 135 additions and 119 deletions

View File

@ -0,0 +1,109 @@
// flow-typed signature: 157088d679e8cd26f71af29e6bfa3ccc
// flow-typed version: <<STUB>>/v8-profiler-node8_v6.0.1/flow_v0.79.1
/**
* This is an autogenerated libdef stub for:
*
* 'v8-profiler-node8'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'v8-profiler-node8' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'v8-profiler-node8/tools/annotate-tag' {
declare module.exports: any;
}
declare module 'v8-profiler-node8/tools/commit-changes' {
declare module.exports: any;
}
declare module 'v8-profiler-node8/tools/exec' {
declare module.exports: any;
}
declare module 'v8-profiler-node8/tools/history' {
declare module.exports: any;
}
declare module 'v8-profiler-node8/tools/NODE_NEXT' {
declare module.exports: any;
}
declare module 'v8-profiler-node8/tools/prepublish-to-npm' {
declare module.exports: any;
}
declare module 'v8-profiler-node8/tools/publish-to-npm' {
declare module.exports: any;
}
declare module 'v8-profiler-node8/tools/push-to-githab' {
declare module.exports: any;
}
declare module 'v8-profiler-node8/tools/release' {
declare module.exports: any;
}
declare module 'v8-profiler-node8/tools/update-changelog' {
declare module.exports: any;
}
declare module 'v8-profiler-node8/tools/update-npm-version' {
declare module.exports: any;
}
declare module 'v8-profiler-node8/v8-profiler' {
declare module.exports: any;
}
// Filename aliases
declare module 'v8-profiler-node8/tools/annotate-tag.js' {
declare module.exports: $Exports<'v8-profiler-node8/tools/annotate-tag'>;
}
declare module 'v8-profiler-node8/tools/commit-changes.js' {
declare module.exports: $Exports<'v8-profiler-node8/tools/commit-changes'>;
}
declare module 'v8-profiler-node8/tools/exec.js' {
declare module.exports: $Exports<'v8-profiler-node8/tools/exec'>;
}
declare module 'v8-profiler-node8/tools/history.js' {
declare module.exports: $Exports<'v8-profiler-node8/tools/history'>;
}
declare module 'v8-profiler-node8/tools/NODE_NEXT.js' {
declare module.exports: $Exports<'v8-profiler-node8/tools/NODE_NEXT'>;
}
declare module 'v8-profiler-node8/tools/prepublish-to-npm.js' {
declare module.exports: $Exports<'v8-profiler-node8/tools/prepublish-to-npm'>;
}
declare module 'v8-profiler-node8/tools/publish-to-npm.js' {
declare module.exports: $Exports<'v8-profiler-node8/tools/publish-to-npm'>;
}
declare module 'v8-profiler-node8/tools/push-to-githab.js' {
declare module.exports: $Exports<'v8-profiler-node8/tools/push-to-githab'>;
}
declare module 'v8-profiler-node8/tools/release.js' {
declare module.exports: $Exports<'v8-profiler-node8/tools/release'>;
}
declare module 'v8-profiler-node8/tools/update-changelog.js' {
declare module.exports: $Exports<'v8-profiler-node8/tools/update-changelog'>;
}
declare module 'v8-profiler-node8/tools/update-npm-version.js' {
declare module.exports: $Exports<'v8-profiler-node8/tools/update-npm-version'>;
}
declare module 'v8-profiler-node8/v8-profiler.js' {
declare module.exports: $Exports<'v8-profiler-node8/v8-profiler'>;
}

View File

@ -1,109 +0,0 @@
// flow-typed signature: f0996c4a08f76e6b3408912bda3f3ece
// flow-typed version: <<STUB>>/v8-profiler_v5.7.0/flow_v0.68.0
/**
* This is an autogenerated libdef stub for:
*
* 'v8-profiler'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'v8-profiler' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'v8-profiler/tools/annotate-tag' {
declare module.exports: any;
}
declare module 'v8-profiler/tools/commit-changes' {
declare module.exports: any;
}
declare module 'v8-profiler/tools/exec' {
declare module.exports: any;
}
declare module 'v8-profiler/tools/history' {
declare module.exports: any;
}
declare module 'v8-profiler/tools/NODE_NEXT' {
declare module.exports: any;
}
declare module 'v8-profiler/tools/prepublish-to-npm' {
declare module.exports: any;
}
declare module 'v8-profiler/tools/publish-to-npm' {
declare module.exports: any;
}
declare module 'v8-profiler/tools/push-to-githab' {
declare module.exports: any;
}
declare module 'v8-profiler/tools/release' {
declare module.exports: any;
}
declare module 'v8-profiler/tools/update-changelog' {
declare module.exports: any;
}
declare module 'v8-profiler/tools/update-npm-version' {
declare module.exports: any;
}
declare module 'v8-profiler/v8-profiler' {
declare module.exports: any;
}
// Filename aliases
declare module 'v8-profiler/tools/annotate-tag.js' {
declare module.exports: $Exports<'v8-profiler/tools/annotate-tag'>;
}
declare module 'v8-profiler/tools/commit-changes.js' {
declare module.exports: $Exports<'v8-profiler/tools/commit-changes'>;
}
declare module 'v8-profiler/tools/exec.js' {
declare module.exports: $Exports<'v8-profiler/tools/exec'>;
}
declare module 'v8-profiler/tools/history.js' {
declare module.exports: $Exports<'v8-profiler/tools/history'>;
}
declare module 'v8-profiler/tools/NODE_NEXT.js' {
declare module.exports: $Exports<'v8-profiler/tools/NODE_NEXT'>;
}
declare module 'v8-profiler/tools/prepublish-to-npm.js' {
declare module.exports: $Exports<'v8-profiler/tools/prepublish-to-npm'>;
}
declare module 'v8-profiler/tools/publish-to-npm.js' {
declare module.exports: $Exports<'v8-profiler/tools/publish-to-npm'>;
}
declare module 'v8-profiler/tools/push-to-githab.js' {
declare module.exports: $Exports<'v8-profiler/tools/push-to-githab'>;
}
declare module 'v8-profiler/tools/release.js' {
declare module.exports: $Exports<'v8-profiler/tools/release'>;
}
declare module 'v8-profiler/tools/update-changelog.js' {
declare module.exports: $Exports<'v8-profiler/tools/update-changelog'>;
}
declare module 'v8-profiler/tools/update-npm-version.js' {
declare module.exports: $Exports<'v8-profiler/tools/update-npm-version'>;
}
declare module 'v8-profiler/v8-profiler.js' {
declare module.exports: $Exports<'v8-profiler/v8-profiler'>;
}

View File

@ -132,7 +132,7 @@
"webpack-cli": "^3.0.8"
},
"optionalDependencies": {
"v8-profiler": "^5.7.0"
"v8-profiler-node8": "^6.0.1"
},
"engines": {
"node": ">=6.1.0"

View File

@ -726,10 +726,10 @@ function prepareReplExternalSepc(procPath) {
function runWithCpuProfiler(args) {
let profiler;
try {
profiler = require("v8-profiler");
profiler = require("v8-profiler-node8");
} catch (e) {
// Profiler optional dependency failed
console.error("v8-profiler doesn't work correctly on Windows, see issue #1695");
console.error("v8-profiler-node8 doesn't work correctly on Windows, see issue #1695");
throw e;
}
profiler.setSamplingInterval(100); // default is 1000us

View File

@ -508,10 +508,10 @@ function run(
try {
if (cpuprofilePath !== undefined) {
try {
profiler = require("v8-profiler");
profiler = require("v8-profiler-node8");
} catch (e) {
// Profiler optional dependency failed
console.error("v8-profiler doesn't work correctly on Windows, see issue #1695");
console.error("v8-profiler-node8 doesn't work correctly on Windows, see issue #1695");
throw e;
}
profiler.setSamplingInterval(100); // default is 1000us

View File

@ -6690,7 +6690,23 @@ node-pre-gyp@^0.10.0:
semver "^5.3.0"
tar "^4"
node-pre-gyp@^0.6.34, node-pre-gyp@^0.6.36:
node-pre-gyp@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz#db1f33215272f692cd38f03238e3e9b47c5dd054"
integrity sha512-TwWAOZb0j7e9eGaf9esRx3ZcLaE5tQ2lvYy1pb5IAaG1a2e2Kv5Lms1Y4hpj+ciXJRofIxxlt5haeQ/2ANeE0Q==
dependencies:
detect-libc "^1.0.2"
mkdirp "^0.5.1"
needle "^2.2.1"
nopt "^4.0.1"
npm-packlist "^1.1.6"
npmlog "^4.0.2"
rc "^1.2.7"
rimraf "^2.6.1"
semver "^5.3.0"
tar "^4"
node-pre-gyp@^0.6.36:
version "0.6.39"
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.39.tgz#c00e96860b23c0e1420ac7befc5044e1d78d8649"
dependencies:
@ -9071,12 +9087,12 @@ v8-compile-cache@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.0.0.tgz#526492e35fc616864284700b7043e01baee09f0a"
v8-profiler@^5.7.0:
version "5.7.0"
resolved "https://registry.yarnpkg.com/v8-profiler/-/v8-profiler-5.7.0.tgz#e8381cbebb5b5fd0ca8d2b09f6a0181a158db34d"
v8-profiler-node8@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/v8-profiler-node8/-/v8-profiler-node8-6.0.1.tgz#2558f5dab7622f2305213e6ccb4dde1f66cc631f"
dependencies:
nan "^2.5.1"
node-pre-gyp "^0.6.34"
node-pre-gyp "^0.11.0"
v8flags@^3.1.1:
version "3.1.1"