-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add column, line, and method check to integrity check (#25094)
- Loading branch information
1 parent
2062670
commit 8888cd9
Showing
8 changed files
with
195 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Bump this version to force CI to re-create the cache from scratch. | ||
|
||
12-05-22 | ||
12-12-22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
diff --git a/node_modules/bytenode/lib/cli.js b/node_modules/bytenode/lib/cli.js | ||
index 9f57493..3ba173e 100755 | ||
--- a/node_modules/bytenode/lib/cli.js | ||
+++ b/node_modules/bytenode/lib/cli.js | ||
@@ -2,11 +2,15 @@ | ||
|
||
'use strict'; | ||
|
||
-const fs = require('fs'); | ||
-const path = require('path'); | ||
-const wrap = require('module').wrap; | ||
-const spawnSync = require('child_process').spawnSync; | ||
-const bytenode = require('./index.js'); | ||
+import fs from 'fs'; | ||
+import path from 'path'; | ||
+import * as mod from 'module'; | ||
+import { spawnSync } from 'child_process'; | ||
+import * as bytenode from './index.js'; | ||
+import * as url from 'url'; | ||
+ | ||
+const __filename = url.fileURLToPath(import.meta.url); | ||
+const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); | ||
|
||
const args = process.argv.slice(2); | ||
|
||
@@ -100,7 +104,7 @@ if (program.flags.includes('--compile')) { | ||
if (program.flags.includes('--no-module')) { | ||
process.stdout.write(bytenode.compileCode(script)); | ||
} else { | ||
- process.stdout.write(bytenode.compileCode(wrap(script))); | ||
+ process.stdout.write(bytenode.compileCode(mod.wrap(script))); | ||
} | ||
} catch (error) { | ||
console.error(error); | ||
@@ -136,13 +140,6 @@ if (program.flags.includes('--compile')) { | ||
$ echo 'console.log("Hello");' | bytenode --compile - > hello.jsc | ||
compile from stdin and save to \`hello.jsc\` | ||
`); | ||
-} else if (program.flags.includes('--version') && program.flags.length === 1 && program.files.length === 0) { | ||
- const pkg = require('../package.json'); | ||
- console.log(pkg.name, pkg.version); | ||
- console.log('Node', process.versions.node); | ||
- if (process.versions.electron) { | ||
- console.log('Electron', process.versions.electron); | ||
- } | ||
} else { | ||
try { | ||
spawnSync(program.nodeBin, [ | ||
diff --git a/node_modules/bytenode/lib/index.js b/node_modules/bytenode/lib/index.js | ||
index cdd98cc..635bc27 100644 | ||
--- a/node_modules/bytenode/lib/index.js | ||
+++ b/node_modules/bytenode/lib/index.js | ||
@@ -1,11 +1,13 @@ | ||
'use strict'; | ||
|
||
-const fs = require('fs'); | ||
-const vm = require('vm'); | ||
-const v8 = require('v8'); | ||
-const path = require('path'); | ||
-const Module = require('module'); | ||
-const fork = require('child_process').fork; | ||
+import fs from 'fs'; | ||
+import vm from 'vm'; | ||
+import v8 from 'v8'; | ||
+import path from 'path'; | ||
+import Module from 'module'; | ||
+import { fork } from 'child_process'; | ||
+import { createRequire } from 'module'; | ||
+import * as url from 'url'; | ||
|
||
v8.setFlagsFromString('--no-lazy'); | ||
|
||
@@ -46,10 +48,12 @@ const compileElectronCode = function (javascriptCode) { | ||
return new Promise((resolve, reject) => { | ||
let data = Buffer.from([]); | ||
|
||
+ const require = createRequire(import.meta.url) | ||
const electronPath = path.join(path.dirname(require.resolve('electron')), 'cli.js'); | ||
if (!fs.existsSync(electronPath)) { | ||
throw new Error('Electron not installed'); | ||
} | ||
+ const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); | ||
const bytenodePath = path.join(__dirname, 'cli.js'); | ||
|
||
// create a subprocess in which we run Electron as our Node and V8 engine | ||
@@ -249,7 +253,7 @@ const runBytecodeFile = function (filename) { | ||
return runBytecode(bytecodeBuffer); | ||
}; | ||
|
||
-Module._extensions[COMPILED_EXTNAME] = function (fileModule, filename) { | ||
+const runBytecodeAsModule = function (fileModule, filename) { | ||
const bytecodeBuffer = fs.readFileSync(filename); | ||
|
||
fixBytecode(bytecodeBuffer); | ||
@@ -333,14 +337,13 @@ const loaderCode = function (targetPath) { | ||
`; | ||
}; | ||
|
||
-global.bytenode = { | ||
+export { | ||
compileCode, | ||
compileFile, | ||
compileElectronCode, | ||
runBytecode, | ||
runBytecodeFile, | ||
addLoaderFile, | ||
- loaderCode | ||
+ loaderCode, | ||
+ runBytecodeAsModule, | ||
}; | ||
- | ||
-module.exports = global.bytenode; | ||
diff --git a/node_modules/bytenode/package.json b/node_modules/bytenode/package.json | ||
index 6caff7c..72e2c46 100644 | ||
--- a/node_modules/bytenode/package.json | ||
+++ b/node_modules/bytenode/package.json | ||
@@ -3,6 +3,7 @@ | ||
"version": "1.3.7", | ||
"description": "A minimalist bytecode compiler for Node.js", | ||
"main": "lib/index.js", | ||
+ "type": "module", | ||
"bin": "lib/cli.js", | ||
"types": "lib/index.d.ts", | ||
"files": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8888cd9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux arm64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
8888cd9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
8888cd9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
8888cd9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
win32 x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
8888cd9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin arm64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally: