Skip to content

Commit

Permalink
show unresolved free var in snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Mar 29, 2023
1 parent 45129a1 commit 1f69e4a
Show file tree
Hide file tree
Showing 22 changed files with 713 additions and 2 deletions.
3 changes: 1 addition & 2 deletions crates/turbopack-ecmascript/src/analyzer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3182,8 +3182,7 @@ mod tests {
JsValue::call(box func, new_args),
));
}
Effect::Call { var, .. } => {
let var = resolve(&var_graph, var).await;
Effect::FreeVar { var, .. } => {
resolved.push((format!("{parent} -> {i} free var"), var));
}
Effect::MemberCall {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
0 -> 1 free var = FreeVar(require)

0 -> 2 call = require*0*((1 | `${("hello" | "world")}.js`))
- *0* require: The require method from CommonJS
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
(...) => (undefined | FreeVar(require)["resolve"](file))
)

6 -> 8 free var = FreeVar(require)

6 -> 9 member call = require*0*["resolve"](???*1*)
- *0* require: The require method from CommonJS
- *1* arguments[0]
⚠️ function calls are not analysed yet

0 -> 11 free var = FreeVar(require)

0 -> 12 member call = require*0*["resolve"](???*1*)
- *0* require: The require method from CommonJS
- *1* arguments[0]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
0 -> 3 free var = FreeVar(global)

0 -> 6 free var = FreeVar(global)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0 -> 1 free var = FreeVar(f)
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
0 -> 1 free var = FreeVar(require)

0 -> 2 call = require*0*("path")
- *0* require: The require method from CommonJS

0 -> 3 free var = FreeVar(require)

0 -> 4 call = require*0*("path")
- *0* require: The require method from CommonJS

0 -> 6 free var = FreeVar(platformKey)

0 -> 7 call = (...) => (undefined | {"pkg": pkg, "subpath": subpath})()

0 -> 9 free var = FreeVar(require)

0 -> 10 member call = require*0*["resolve"](
`${(
| undefined["pkg"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
0 -> 1 free var = FreeVar(require)

0 -> 2 call = require*0*("path")
- *0* require: The require method from CommonJS

0 -> 3 free var = FreeVar(require)

0 -> 4 call = require*0*("path")
- *0* require: The require method from CommonJS

0 -> 5 free var = FreeVar(require)

0 -> 6 call = require*0*("os")
- *0* require: The require method from CommonJS

0 -> 8 free var = FreeVar(process)

0 -> 10 member call = os*0*["arch"]()
- *0* os: The Node.js os module: https://nodejs.org/api/os.html

0 -> 12 member call = os*0*["endianness"]()
- *0* os: The Node.js os module: https://nodejs.org/api/os.html

0 -> 15 free var = FreeVar(Error)

0 -> 16 free var = FreeVar(ESBUILD_BINARY_PATH)

0 -> 17 conditional = ???*0*
- *0* FreeVar(ESBUILD_BINARY_PATH)
⚠️ unknown global

17 -> 18 free var = FreeVar(ESBUILD_BINARY_PATH)

0 -> 19 call = (...) => (undefined | {"pkg": pkg, "subpath": subpath})()

0 -> 21 free var = FreeVar(require)

0 -> 22 member call = require*0*["resolve"](
`${(undefined["pkg"] | ???*1* | ???*2* | ???*3* | "esbuild-linux-64")}/${(undefined["subpath"] | ???*4* | "esbuild.exe" | "bin/esbuild" | ???*5*)}`
)
Expand All @@ -32,6 +48,8 @@
⚠️ pattern without value
- *5* unknown mutation

0 -> 23 free var = FreeVar(downloadedBinPath)

0 -> 24 call = ???*0*(
(undefined["pkg"] | ???*1* | ???*2* | ???*3* | "esbuild-linux-64"),
(undefined["subpath"] | ???*4* | "esbuild.exe" | "bin/esbuild" | ???*5*)
Expand All @@ -47,6 +65,8 @@
⚠️ pattern without value
- *5* unknown mutation

0 -> 26 free var = FreeVar(fs)

0 -> 27 member call = ???*0*["existsSync"]((???*1* | ???*2* | ???*9*))
- *0* FreeVar(fs)
⚠️ unknown global
Expand Down Expand Up @@ -76,6 +96,8 @@
- *1* FreeVar(fs)
⚠️ unknown global

28 -> 30 free var = FreeVar(require)

28 -> 31 member call = require*0*["resolve"](
(undefined["pkg"] | ???*1* | ???*2* | ???*3* | "esbuild-linux-64")
)
Expand All @@ -86,11 +108,17 @@
⚠️ unknown global
- *3* unknown mutation

28 -> 32 free var = FreeVar(Error)

0 -> 33 free var = FreeVar(require)

0 -> 34 call = require*0*("pnpapi")
- *0* require: The require method from CommonJS

0 -> 35 conditional = (false | true)

35 -> 38 free var = FreeVar(require)

35 -> 39 member call = require*0*["resolve"]("esbuild")
- *0* require: The require method from CommonJS

Expand Down Expand Up @@ -126,6 +154,8 @@
⚠️ pattern without value
- *8* unknown mutation

35 -> 46 free var = FreeVar(fs)

35 -> 47 member call = ???*0*["existsSync"](
`"esbuild"/resolved/lib${("/" | "")}pnpapi-${(undefined["pkg"] | ???*1* | ???*2* | ???*3* | "esbuild-linux-64")}-${???*4*}`
)
Expand Down Expand Up @@ -153,6 +183,8 @@
- *1* FreeVar(fs)
⚠️ unknown global

48 -> 50 free var = FreeVar(fs)

48 -> 51 member call = ???*0*["copyFileSync"](
(???*1* | ???*2* | ???*9*),
`"esbuild"/resolved/lib${("/" | "")}pnpapi-${(undefined["pkg"] | ???*11* | ???*12* | ???*13* | "esbuild-linux-64")}-${???*14*}`
Expand Down Expand Up @@ -194,6 +226,8 @@
⚠️ pattern without value
- *18* unknown mutation

48 -> 53 free var = FreeVar(fs)

48 -> 54 member call = ???*0*["chmodSync"](
`"esbuild"/resolved/lib${("/" | "")}pnpapi-${(undefined["pkg"] | ???*1* | ???*2* | ???*3* | "esbuild-linux-64")}-${???*4*}`,
493
Expand All @@ -216,9 +250,15 @@
⚠️ pattern without value
- *8* unknown mutation

0 -> 55 free var = FreeVar(ESBUILD_BINARY_PATH)

0 -> 57 free var = FreeVar(__filename)

0 -> 58 member call = path*0*["basename"]("__filename")
- *0* path: The Node.js path module: https://nodejs.org/api/path.html

0 -> 60 free var = FreeVar(__dirname)

0 -> 61 member call = path*0*["basename"]("__dirname")
- *0* path: The Node.js path module: https://nodejs.org/api/path.html

Expand All @@ -236,8 +276,14 @@
⚠️ unsupported property on Node.js path module
- *6* path: The Node.js path module: https://nodejs.org/api/path.html

62 -> 63 free var = FreeVar(Error)

62 -> 64 free var = FreeVar(__filename)

0 -> 65 conditional = false

65 -> 67 free var = FreeVar(__dirname)

65 -> 68 member call = path*0*["join"]("__dirname", "..", "bin", "esbuild")
- *0* path: The Node.js path module: https://nodejs.org/api/path.html

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0 -> 2 free var = FreeVar(Buffer)

0 -> 3 member call = ???*0*["from"]("Hello World")
- *0* FreeVar(Buffer)
⚠️ unknown global
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0 -> 1 free var = FreeVar(require)

0 -> 2 conditional = true

2 -> 3 call = require*0*("test")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
0 -> 1 free var = FreeVar(global)

0 -> 2 free var = FreeVar(global)

0 -> 3 free var = FreeVar(global)

0 -> 4 free var = FreeVar(global)

0 -> 5 free var = FreeVar(global)

0 -> 6 free var = FreeVar(global)
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@
- *6* arguments[0]
⚠️ function calls are not analysed yet

0 -> 36 free var = FreeVar(safeAdd)

0 -> 37 free var = FreeVar(bitRotateLeft)

0 -> 38 free var = FreeVar(safeAdd)

0 -> 39 free var = FreeVar(safeAdd)

0 -> 40 call = ???*0*(???*1*, ???*2*)
- *0* FreeVar(safeAdd)
⚠️ unknown global
Expand All @@ -193,6 +201,8 @@
- *2* arguments[0]
⚠️ function calls are not analysed yet

0 -> 41 free var = FreeVar(safeAdd)

0 -> 42 call = ???*0*(???*1*, ???*2*)
- *0* FreeVar(safeAdd)
⚠️ unknown global
Expand Down Expand Up @@ -257,3 +267,7 @@
⚠️ function calls are not analysed yet
- *5* arguments[6]
⚠️ function calls are not analysed yet

0 -> 48 free var = FreeVar(module)

0 -> 49 free var = FreeVar(md5)
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
0 -> 1 conditional = (???*0* == "string")
- *0* unsupported expression

1 -> 2 free var = FreeVar(unescape)

1 -> 3 free var = FreeVar(encodeURIComponent)

1 -> 4 call = ???*0*((???*1* | ???*2*))
- *0* FreeVar(encodeURIComponent)
⚠️ unknown global
Expand All @@ -16,6 +20,8 @@
- *2* FreeVar(encodeURIComponent)
⚠️ unknown global

1 -> 6 free var = FreeVar(Array)

1 -> 11 member call = ???*0*["charCodeAt"](0)
- *0* ???*1*(FreeVar(encodeURIComponent)(bytes))
⚠️ unknown callee
Expand All @@ -33,6 +39,8 @@
0 -> 15 call = (...) => (undefined | output)(???*0*)
- *0* max number of linking steps reached

0 -> 18 free var = FreeVar(parseInt)

0 -> 20 member call = "0123456789abcdef"["charAt"](???*0*)
- *0* unsupported expression

Expand Down Expand Up @@ -830,6 +838,8 @@
- *1* max number of linking steps reached
- *2* max number of linking steps reached

0 -> 163 free var = FreeVar(undefined)

0 -> 169 call = (...) => (undefined | ???*0*)(???*1*, ???*2*)
- *0* unsupported expression
- *1* arguments[1]
Expand Down Expand Up @@ -936,3 +946,5 @@
⚠️ function calls are not analysed yet
- *5* arguments[6]
⚠️ function calls are not analysed yet

0 -> 179 free var = FreeVar(module)
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
0 -> 1 free var = FreeVar(require)

0 -> 2 call = require*0*("crypt")
- *0* require: The require method from CommonJS

0 -> 4 free var = FreeVar(require)

0 -> 5 call = require*0*("charenc")
- *0* require: The require method from CommonJS

0 -> 6 free var = FreeVar(require)

0 -> 7 call = require*0*("is-buffer")
- *0* require: The require method from CommonJS

0 -> 9 free var = FreeVar(require)

0 -> 10 call = require*0*("charenc")
- *0* require: The require method from CommonJS

0 -> 12 free var = FreeVar(String)

0 -> 13 conditional = (???*0* == ???*2*)
- *0* ???*1*["constructor"]
⚠️ unknown object
Expand Down Expand Up @@ -126,6 +136,8 @@
- *6* FreeVar(Array)
⚠️ unknown global

21 -> 25 free var = FreeVar(Array)

21 -> 26 member call = ???*0*["call"](
(
| ???*3*
Expand Down Expand Up @@ -161,6 +173,8 @@
- *11* message
⚠️ circular variable reference

21 -> 28 free var = FreeVar(Array)

21 -> 29 member call = ???*0*["isArray"](
(
| ???*1*
Expand Down Expand Up @@ -2090,6 +2104,10 @@
0 -> 178 member call = module<crypt, {}>["endian"](???*0*)
- *0* max number of linking steps reached

0 -> 186 free var = FreeVar(module)

0 -> 187 free var = FreeVar(undefined)

0 -> 188 conditional = ((???*0* === ???*1*) | (???*2* === null))
- *0* arguments[0]
⚠️ function calls are not analysed yet
Expand All @@ -2098,6 +2116,8 @@
- *2* arguments[0]
⚠️ function calls are not analysed yet

188 -> 189 free var = FreeVar(Error)

0 -> 191 call = (...) => (undefined | crypt["endian"]([a, b, c, d]))(???*0*, ???*1*)
- *0* arguments[0]
⚠️ function calls are not analysed yet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
0 -> 3 member call = [1, 2, 3]["concat"](4, 5, 6, [7, 8, 9], `hello ${(2 | ???*0*)}`)
- *0* unknown mutation

0 -> 6 free var = FreeVar(unknown)

0 -> 7 member call = ([1, 2, 3] | ???*0*)["concat"]([4, 5, 6, ???*1*])
- *0* unknown mutation
- *1* FreeVar(unknown)
⚠️ unknown global

0 -> 10 free var = FreeVar(unknown)

0 -> 11 member call = ([1, 2, 3] | ???*0*)["concat"](4, 5, 6, ???*1*)
- *0* unknown mutation
- *1* FreeVar(unknown)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0 -> 2 free var = FreeVar(global)

0 -> 3 free var = FreeVar(require)

0 -> 4 call = require*0*(
`${(???*1* | "./drivers/node-mongodb-native")}/connection`
)
Expand All @@ -7,6 +11,8 @@
- *2* FreeVar(global)
⚠️ unknown global

0 -> 5 free var = FreeVar(require)

0 -> 6 call = require*0*(
`${(???*1* | "./drivers/node-mongodb-native")}/collection`
)
Expand Down
Loading

0 comments on commit 1f69e4a

Please sign in to comment.