diff --git a/docs/projectgraph.md b/docs/projectgraph.md
index 301dfcb7..3c4c40b7 100644
--- a/docs/projectgraph.md
+++ b/docs/projectgraph.md
@@ -1,1102 +1,323 @@
# Project graph
-The project graph is the call graph of a whole project, across its files
-and into the code of its dependencies. It answers one question: does code
-that runs reach an external symbol, as `yaml//load`? The answer is `found`,
-`not-found` or `uncertain`, and the library never gives `not-found` when it
+The project graph is the call graph of a whole project, across its files and
+into the code of its dependencies. It answers one question. Does code that runs
+reach an external symbol, as `yaml//load`? The answer is `found`, `not-found`,
+`uncertain` or `no-such-target`. The library never gives `not-found` when it
does not know.
-Five calls make the graph. Each one reads only the output of the one
-before it, so a job can run them at different times and keep the output of
-each in a store.
+This guide tells a caller what to call, what each call gives and what the
+answers mean. The code, its comments and the cases under
+`test/projectgraph/cases` record each rule. The `description` of each
+`expect.yaml` tells in prose what its case pins.
+
+## Steps
+
+Each step reads only the output of the step before it. A job can run the steps
+at different times and keep the output of each step in a store.
| Step | Call | Reads | Gives |
| --- | --- | --- | --- |
-| Index | `indexer.New` and `Indexer.Run` | The source files, with tree-sitter | One `fileindex.Index` per file |
+| Index | `indexer.New`, `Indexer.Run` | The source files, with tree-sitter | One `fileindex.Index` per file |
| Link | `projectgraph.Build` | The indexes and the manifests | A `projectgraph.Graph` |
-| Roots | `rootmatch.Find` | The indexes and the manifests | The roots of the graph. `Build` calls it |
+| Roots | `rootmatch.Find` | The indexes and the manifests | The roots of the graph. `Build` calls it, so a caller does not |
| Reach | `reach.Reach` | The graph | One `reach.Result` per target |
-| Summary | `summary.Build` | The indexes of one package | A `summary.Summary` of the package |
-
-The index step is the only one that parses source. It needs CGO. The other
-steps read records and build with `CGO_ENABLED=0`.
-
-An [overlay](#overlay) is an optional step between the link step and the
-reach query. It merges edges that a model proposed for the call sites
-that the link step could not resolve.
+| Summary | `summary.Build` | The indexes of one package | A `summary.Result` that holds the `summary.Summary` of the package |
-`examples/projectgraph` runs all five from the command line.
+Only the index step parses source, and only the index step needs CGO. The other
+steps build with `CGO_ENABLED=0`. An [overlay](#overlay) is an optional step
+between the link step and the reach query. It merges edges that a model
+proposed for the call sites that the link step did not resolve.
+`examples/projectgraph` runs all the steps from the command line.
## Index
```go
-ix, err := indexer.New(indexer.Options{
- Languages: languages,
- Store: store,
- Workers: 4,
+languages, err := lang.AllLanguages()
+fsys, err := fs.NewLocalFileSystem(fs.LocalFileSystemConfig{
+ AppDirectories: []string{root},
+ ImportDirectories: []string{lodashDir},
+ ImportUnits: map[string]string{lodashDir: "npm:lodash@4.17.21"},
})
+ix, err := indexer.New(indexer.Options{Languages: languages, Store: memstore.New(), Imports: true})
indexed, err := ix.Run(ctx, fsys)
```
-`New` validates the options: a run needs a language, two languages
-cannot share a file extension, and a size limit or a number of workers
-cannot be negative. `Run` walks the file system, reads each file once and gives the tree of the
-file to the index plugin. The index of a file holds what the link step
-needs: the imports, the exports, the definitions, the classes with their
-bases, the calls with their resolved targets, the references, the
-unresolved call sites and the dynamic flags. It holds no tree-sitter node
-and no source text past a short call text.
-
-`indexer.Options` has these fields.
-
-| Field | Meaning |
+| `indexer.Options` field | Meaning |
| --- | --- |
| `Languages` | The languages to index. The run reads only the files that one of them parses |
| `Store` | A `store.Store` that keeps the indexes between runs. A nil store parses every file |
| `Plugins` | Extra plugins that run on the tree of each file |
-| `MaxFileBytes` | The size limit of a file. A larger file fails. Zero selects 4 MiB |
-| `Workers` | The number of files to parse at once. Zero selects the number of CPUs. The result does not depend on it |
-| `Imports` | Index the files of the import directories too. Each one needs a package unit, as `npm:lodash@4.17.21` |
-
-`indexer.Result` holds the indexes in path order, the status of each file
-(`indexed`, `cached`, `missing`, `failed`, `truncated`), the same for the
-files of dependency code, and the report of the run. `Result.Unit` returns
-the indexes and the files of one unit of dependency code.
-
-A generated Go file of a unit, with a `// Code generated ... DO NOT EDIT.`
-line or a name that starts with `tables`, can hit a limit of the index,
-as a table of thousands of entries. Its index then comes from the file
-with each top-level var value that holds only data blanked. Function bodies
-and values with a call or a function literal stay, so the calls of a
-generated file, as a `.pb.go` file, stay in the graph. A var value that
-names a function stays too, as a map of handlers, because a call of a
-function value finds the function only through that reference. The index keeps the
-hash of the file. If the skeleton still hits a limit, the file stays
-truncated, and reach counts it as budget.
-
-The JavaScript language reads `.jsx` files with its grammar, which parses
-JSX. It also reads the component files of Vue, Svelte and Astro (`.vue`,
-`.svelte`, `.astro`). The parse reads only the `
+
+
{digest('x')}
diff --git a/test/projectgraph/cases/go/svelte-node-builtin/project/web/src/hash.js b/test/projectgraph/cases/go/svelte-node-builtin/project/web/src/hash.js
new file mode 100644
index 00000000..a85dbc55
--- /dev/null
+++ b/test/projectgraph/cases/go/svelte-node-builtin/project/web/src/hash.js
@@ -0,0 +1,5 @@
+import crypto from 'crypto';
+
+export function digest(text) {
+ return crypto.createHash('sha256').update(text).digest('hex');
+}
diff --git a/test/projectgraph/cases/go/typed-local-shadow/expect.yaml b/test/projectgraph/cases/go/typed-local-shadow/expect.yaml
new file mode 100644
index 00000000..4efe94c9
--- /dev/null
+++ b/test/projectgraph/cases/go/typed-local-shadow/expect.yaml
@@ -0,0 +1,369 @@
+source: safedep:hand
+description: >-
+ main declares x as a local, and an inner block declares x again as a remote. The call x.run() in the block runs
+ remote.run, which calls os/exec.LookPath. The index records the typed locals of a function with no extent, and the
+ link step reads the type of the first one. So the index checks that the binding of x in scope at the call is the
+ binding whose type the link step reads. Here it is not. The method value x.stop is an unknown-receiver record with
+ the method name stop, which gets a name edge to remote.stop. Without the rule, a type of the first x gives not-found
+ for os/exec.LookPath. The call x.run() before the block keeps its member edge to local.run. pick binds r once and
+ types it by the assignment r = &remote{}, and named types its named result l by an assignment. Each function binds
+ the name once, so the assignment types that variable, and the call keeps its member edge. Without the rule, a record
+ there gives a name edge to the run of the other type, and a target behind it reads found. The binding of x in the
+ block of main has a type of its own, so the index gives the call the target of that binding under an alias, and the
+ call gets a member edge to remote.run. siblings does the same in each of two blocks. viaLit calls run on the
+ parameter x of a function literal, which no type of the index names, so the call is a record. pickIface types r by
+ an assignment, but r holds the interface runner from the field r, so the writes do not agree and the call is a
+ record too. Without the rule, a type of local for each of the two gives not-found for os/exec.LookPath. In idiom.go,
+ parse declares url from url.Parse, and the local binds no name at the call, so the call keeps its edge to the
+ import. viaParam and viaRange bind log, which shadows the import of log, so the index takes no target of the import.
+ The parameter of the type logger and the range variable over ls []logger each give a member edge to logger.Println.
+ In shadowedParam of main.go a local o shadows the parameter o, so the field r of the parameter type does not type x,
+ and the call x.run() is a record. pool.get declares call from an element of the field calls map[string]*remote, in
+ the form call, dup := p.calls[key], and fromSlice declares r from an element of a parameter []*remote. The declared
+ element type of the map and of the slice gives the write its type, so each write gives remote, and each call keeps
+ its member edge to remote.run. Without the rule, a write of no known type there makes the call a record with a name
+ edge to local.run. loopThenVar calls run on a range variable over rs []*remote and declares r *local after the loop.
+ The range clause gives r the element type remote, so the call keeps its member edge to remote.run. Without the type,
+ the call is a record with a name edge to local.run.
+roots:
+ - key: idiom.go
+ kind: main
+ rule: go.main
+ - key: main.go
+ kind: main
+ rule: go.main
+ - key: main.go//main
+ kind: main
+ rule: go.main
+edges:
+ - from: main.go//main
+ to: main.go//local//run
+ kind: member
+ confidence: high
+ site: main.go:20
+ - from: main.go//main
+ to: main.go//remote//run
+ kind: member
+ confidence: high
+ site: main.go:23
+ - from: main.go//siblings
+ to: main.go//remote//run
+ kind: member
+ confidence: high
+ site: main.go:72
+ - from: main.go//local//viaLit
+ to: main.go//remote//run
+ kind: name
+ confidence: low
+ site: main.go:49
+ - from: main.go//pickIface
+ to: main.go//remote//run
+ kind: name
+ confidence: low
+ site: main.go:62
+ - from: main.go//main
+ to: main.go//remote//stop
+ kind: name
+ confidence: low
+ site: main.go:24
+ - from: main.go//pick
+ to: main.go//remote//run
+ kind: member
+ confidence: high
+ site: main.go:38
+ - from: main.go//named
+ to: main.go//local//run
+ kind: member
+ confidence: high
+ site: main.go:43
+ - from: main.go//pool//get
+ to: main.go//remote//run
+ kind: member
+ confidence: high
+ site: main.go:95
+ - from: main.go//fromSlice
+ to: main.go//remote//run
+ kind: member
+ confidence: high
+ site: main.go:103
+ - from: main.go//loopThenVar
+ to: main.go//remote//run
+ kind: member
+ confidence: high
+ site: main.go:108
+no_edges:
+ - from: main.go//loopThenVar
+ to: main.go//local//run
+ - from: main.go//pool//get
+ to: main.go//local//run
+ - from: main.go//fromSlice
+ to: main.go//local//run
+ - from: main.go//local//run
+ to: os//exec//LookPath
+ - from: main.go//pick
+ to: main.go//local//run
+ - from: main.go//named
+ to: main.go//remote//run
+unresolved:
+ - caller: log//Println
+ reason: no-dependency-source
+ callback: true
+ - caller: main.go//local//viaLit
+ reason: no-dependency-source
+ callback: true
+ - caller: main.go//main
+ reason: no-dependency-source
+ callback: true
+ - caller: main.go//pickIface
+ reason: no-dependency-source
+ callback: true
+ - caller: main.go//shadowedParam
+ reason: no-dependency-source
+ callback: true
+ - caller: net//url//Parse
+ reason: no-dependency-source
+ callback: true
+ - caller: os//Getwd
+ reason: no-dependency-source
+ callback: true
+ - caller: os//Mkdir
+ reason: no-dependency-source
+ callback: true
+ - caller: os//Remove
+ reason: no-dependency-source
+ callback: true
+ - caller: os//exec//LookPath
+ reason: no-dependency-source
+ callback: true
+ - caller: idiom.go//parse
+ site: idiom.go:14
+ reason: no-dependency-source
+ method: Host
+ - caller: main.go//main
+ site: main.go:24
+ reason: unknown-receiver
+ method: stop
+ - caller: main.go//main
+ site: main.go:25
+ reason: function-value
+ - caller: main.go//main
+ site: main.go:25
+ reason: unknown-receiver
+ method: f
+ - caller: main.go//local//viaLit
+ site: main.go:49
+ reason: unknown-receiver
+ method: run
+ - caller: main.go//pickIface
+ site: main.go:62
+ reason: unknown-receiver
+ method: run
+ - caller: main.go//shadowedParam
+ site: main.go:79
+ reason: unknown-receiver
+ method: r
+ - caller: main.go//shadowedParam
+ site: main.go:81
+ reason: unknown-receiver
+ method: run
+results:
+ - target: os//Getwd
+ status: found
+ path:
+ - key: main.go//main
+ - key: main.go//local//run
+ site: main.go:20
+ kind: member
+ confidence: high
+ - key: os//Getwd
+ site: main.go:10
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: main.go//local//run
+ site: main.go:10
+ reached: true
+ - target: os//exec//LookPath
+ status: found
+ path:
+ - key: main.go//main
+ - key: main.go//remote//run
+ site: main.go:23
+ kind: member
+ confidence: high
+ - key: os//exec//LookPath
+ site: main.go:14
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: main.go//remote//run
+ site: main.go:14
+ reached: true
+ - target: os//Remove
+ status: found
+ path:
+ - key: main.go//main
+ - key: main.go//remote//stop
+ site: main.go:24
+ kind: name
+ confidence: low
+ - key: os//Remove
+ site: main.go:16
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: main.go//remote//stop
+ site: main.go:16
+ reached: true
+ - target: os//Getwd
+ sources: [main.go//pick]
+ sources_only: true
+ status: not-found
+ call_sites:
+ - caller: main.go//local//run
+ site: main.go:10
+ reached: false
+ - target: os//exec//LookPath
+ sources: [main.go//named]
+ sources_only: true
+ status: not-found
+ call_sites:
+ - caller: main.go//remote//run
+ site: main.go:14
+ reached: false
+ - target: os//exec//LookPath
+ sources: [main.go//local//viaLit]
+ sources_only: true
+ status: found
+ path:
+ - key: main.go//local//viaLit
+ - key: main.go//remote//run
+ site: main.go:49
+ kind: name
+ confidence: low
+ - key: os//exec//LookPath
+ site: main.go:14
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: main.go//remote//run
+ site: main.go:14
+ reached: true
+ - target: os//exec//LookPath
+ sources: [main.go//pickIface]
+ sources_only: true
+ status: found
+ path:
+ - key: main.go//pickIface
+ - key: main.go//remote//run
+ site: main.go:62
+ kind: name
+ confidence: low
+ - key: os//exec//LookPath
+ site: main.go:14
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: main.go//remote//run
+ site: main.go:14
+ reached: true
+ - target: net//url//Parse
+ sources: [idiom.go//parse]
+ sources_only: true
+ status: found
+ path:
+ - key: idiom.go//parse
+ - key: net//url//Parse
+ site: idiom.go:10
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: idiom.go//parse
+ site: idiom.go:10
+ reached: true
+ - target: os//Mkdir
+ sources: [idiom.go//viaParam]
+ sources_only: true
+ status: found
+ path:
+ - key: idiom.go//viaParam
+ - key: idiom.go//logger//Println
+ site: idiom.go:28
+ kind: member
+ confidence: high
+ - key: os//Mkdir
+ site: idiom.go:19
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: idiom.go//logger//Println
+ site: idiom.go:19
+ reached: true
+ - target: log//Println
+ sources: [idiom.go//viaParam]
+ sources_only: true
+ status: not-found
+ call_sites:
+ - caller: idiom.go//keepLog
+ site: idiom.go:31
+ reached: false
+ - target: os//Mkdir
+ sources: [idiom.go//viaRange]
+ sources_only: true
+ status: found
+ path:
+ - key: idiom.go//viaRange
+ - key: idiom.go//logger//Println
+ site: idiom.go:23
+ kind: member
+ confidence: high
+ - key: os//Mkdir
+ site: idiom.go:19
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: idiom.go//logger//Println
+ site: idiom.go:19
+ reached: true
+ - target: os//Getwd
+ sources: [main.go//shadowedParam]
+ sources_only: true
+ status: found
+ path:
+ - key: main.go//shadowedParam
+ - key: main.go//local//run
+ site: main.go:81
+ kind: name
+ confidence: low
+ - key: os//Getwd
+ site: main.go:10
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: main.go//local//run
+ site: main.go:10
+ reached: true
+ - target: os//Getwd
+ sources: [main.go//pool//get]
+ sources_only: true
+ status: not-found
+ call_sites:
+ - caller: main.go//local//run
+ site: main.go:10
+ reached: false
+ - target: os//Getwd
+ sources: [main.go//fromSlice]
+ sources_only: true
+ status: not-found
+ call_sites:
+ - caller: main.go//local//run
+ site: main.go:10
+ reached: false
+ - target: os//Getwd
+ sources: [main.go//loopThenVar]
+ sources_only: true
+ status: not-found
+ call_sites:
+ - caller: main.go//local//run
+ site: main.go:10
+ reached: false
diff --git a/test/projectgraph/cases/go/typed-local-shadow/project/go.mod b/test/projectgraph/cases/go/typed-local-shadow/project/go.mod
new file mode 100644
index 00000000..925d4b78
--- /dev/null
+++ b/test/projectgraph/cases/go/typed-local-shadow/project/go.mod
@@ -0,0 +1,3 @@
+module example.com/app
+
+go 1.22
diff --git a/test/projectgraph/cases/go/typed-local-shadow/project/idiom.go b/test/projectgraph/cases/go/typed-local-shadow/project/idiom.go
new file mode 100644
index 00000000..dbceda54
--- /dev/null
+++ b/test/projectgraph/cases/go/typed-local-shadow/project/idiom.go
@@ -0,0 +1,31 @@
+package main
+
+import (
+ "log"
+ "net/url"
+ "os"
+)
+
+func parse(raw string) string {
+ url, err := url.Parse(raw)
+ if err != nil {
+ return ""
+ }
+ return url.Host
+}
+
+type logger struct{}
+
+func (logger) Println() { os.Mkdir("d", 0o755) }
+
+func viaRange(ls []logger) {
+ for _, log := range ls {
+ log.Println()
+ }
+}
+
+func viaParam(log logger) {
+ log.Println()
+}
+
+func keepLog() { log.Println("x") }
diff --git a/test/projectgraph/cases/go/typed-local-shadow/project/main.go b/test/projectgraph/cases/go/typed-local-shadow/project/main.go
new file mode 100644
index 00000000..9cdb9452
--- /dev/null
+++ b/test/projectgraph/cases/go/typed-local-shadow/project/main.go
@@ -0,0 +1,112 @@
+package main
+
+import (
+ "os"
+ "os/exec"
+)
+
+type local struct{}
+
+func (local) run() { os.Getwd() }
+
+type remote struct{}
+
+func (remote) run() { exec.LookPath("ls") }
+
+func (remote) stop() { os.Remove("x") }
+
+func main() {
+ x := local{}
+ x.run()
+ {
+ x := remote{}
+ x.run()
+ f := x.stop
+ f()
+ }
+ pick(opts{})
+ named()
+}
+
+type opts struct{ r *remote }
+
+func pick(o opts) {
+ r := o.r
+ if r == nil {
+ r = &remote{}
+ }
+ r.run()
+}
+
+func named() (l *local) {
+ l = &local{}
+ l.run()
+ return
+}
+
+func (x local) viaLit(r remote) {
+ go func(x remote) {
+ x.run()
+ }(r)
+}
+
+type runner interface{ run() }
+
+type optsIface struct{ r runner }
+
+func pickIface(o optsIface) {
+ r := o.r
+ if r == nil {
+ r = &local{}
+ }
+ r.run()
+}
+
+func siblings() {
+ {
+ x := local{}
+ x.run()
+ }
+ {
+ x := remote{}
+ x.run()
+ }
+}
+
+func shadowedParam(o opts, rs []runner) {
+ {
+ o := struct{ r runner }{rs[0]}
+ x := o.r
+ x = &remote{}
+ x.run()
+ }
+}
+
+type pool struct {
+ calls map[string]*remote
+}
+
+func (p *pool) get(key string) {
+ call, dup := p.calls[key]
+ if !dup {
+ call = &remote{}
+ p.calls[key] = call
+ }
+ call.run()
+}
+
+func fromSlice(rs []*remote, i int) {
+ r := rs[i]
+ if r == nil {
+ r = &remote{}
+ }
+ r.run()
+}
+
+func loopThenVar(rs []*remote) {
+ for _, r := range rs {
+ r.run()
+ }
+ var r *local
+ _ = r
+}
diff --git a/test/projectgraph/cases/javascript/astro-markup/expect.yaml b/test/projectgraph/cases/javascript/astro-markup/expect.yaml
index 166ed1f0..0f7d34a6 100644
--- a/test/projectgraph/cases/javascript/astro-markup/expect.yaml
+++ b/test/projectgraph/cases/javascript/astro-markup/expect.yaml
@@ -1,6 +1,9 @@
source: safedep:hand
description: An expression in the body of Page.astro calls adanger, which its fence imports. The index does not parse the body, so the file has a markup record, and adanger reads uncertain, not no-such-target.
roots:
+ - key: src/Page.astro
+ kind: framework
+ rule: node.component
- key: src/main.js
kind: manifest
rule: node.package-json
@@ -24,11 +27,7 @@ results:
- target: plug//asetup
status: found
path:
- - key: src/main.js
- key: src/Page.astro
- site: src/main.js:1
- kind: import
- confidence: high
- key: plug//asetup
site: src/Page.astro:3
kind: direct
diff --git a/test/projectgraph/cases/javascript/astro-pages/expect.yaml b/test/projectgraph/cases/javascript/astro-pages/expect.yaml
new file mode 100644
index 00000000..a4be8854
--- /dev/null
+++ b/test/projectgraph/cases/javascript/astro-pages/expect.yaml
@@ -0,0 +1,142 @@
+source: safedep:hand
+description: >-
+ Astro loads each file of src/pages by its path, and no file imports it. Each component file is a root
+ of the rule node.component. The rule node.astro.page marks each file of src/pages with its exports, the
+ actions, the content config and astro.config.mjs. So danger of index.astro, store of the endpoint GET of
+ api/data.ts, act of an action, collect of the content config and integrate of the config are found.
+roots:
+ - key: astro.config.mjs
+ kind: framework
+ rule: node.astro.page
+ - key: server.js
+ kind: manifest
+ rule: node.package-json
+ - key: src/actions/index.ts
+ kind: framework
+ rule: node.astro.page
+ - key: src/actions/index.ts//server
+ kind: framework
+ rule: node.astro.page
+ - key: src/actions/index.ts//server//go//handler
+ kind: framework
+ rule: node.astro.page
+ - key: src/content/config.ts
+ kind: framework
+ rule: node.astro.page
+ - key: src/content/config.ts//collections
+ kind: framework
+ rule: node.astro.page
+ - key: src/pages/api/data.ts
+ kind: framework
+ rule: node.astro.page
+ - key: src/pages/api/data.ts//GET
+ kind: framework
+ rule: node.astro.page
+ - key: src/pages/index.astro
+ kind: framework
+ rule: node.astro.page
+ - key: src/pages/index.astro
+ kind: framework
+ rule: node.component
+exact_edges: true
+edges:
+ - from: astro.config.mjs
+ to: plug//integrate
+ kind: direct
+ confidence: high
+ site: astro.config.mjs:3
+ - from: server.js
+ to: plug//listen
+ kind: direct
+ confidence: high
+ site: server.js:3
+ - from: src/actions/index.ts//server//go//handler
+ to: plug//act
+ kind: direct
+ confidence: high
+ site: src/actions/index.ts:3
+ - from: src/content/config.ts
+ to: plug//collect
+ kind: direct
+ confidence: high
+ site: src/content/config.ts:3
+ - from: src/pages/api/data.ts//GET
+ to: plug//store
+ kind: direct
+ confidence: high
+ site: src/pages/api/data.ts:4
+ - from: src/pages/index.astro
+ to: plug//danger
+ kind: direct
+ confidence: high
+ site: src/pages/index.astro:3
+unresolved:
+ - caller: src/pages/index.astro
+ site: src/pages/index.astro:1
+ reason: markup
+results:
+ - target: plug//danger
+ status: found
+ path:
+ - key: src/pages/index.astro
+ root: framework
+ - key: plug//danger
+ site: src/pages/index.astro:3
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/pages/index.astro
+ site: src/pages/index.astro:3
+ reached: true
+ - target: plug//store
+ status: found
+ path:
+ - key: src/pages/api/data.ts//GET
+ root: framework
+ - key: plug//store
+ site: src/pages/api/data.ts:4
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/pages/api/data.ts//GET
+ site: src/pages/api/data.ts:4
+ reached: true
+ - target: plug//integrate
+ status: found
+ path:
+ - key: astro.config.mjs
+ root: framework
+ - key: plug//integrate
+ site: astro.config.mjs:3
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: astro.config.mjs
+ site: astro.config.mjs:3
+ reached: true
+ - target: plug//collect
+ status: found
+ path:
+ - key: src/content/config.ts
+ root: framework
+ - key: plug//collect
+ site: src/content/config.ts:3
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/content/config.ts
+ site: src/content/config.ts:3
+ reached: true
+ - target: plug//act
+ status: found
+ path:
+ - key: src/actions/index.ts//server//go//handler
+ root: framework
+ - key: plug//act
+ site: src/actions/index.ts:3
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/actions/index.ts//server//go//handler
+ site: src/actions/index.ts:3
+ reached: true
diff --git a/test/projectgraph/cases/javascript/astro-pages/project/astro.config.mjs b/test/projectgraph/cases/javascript/astro-pages/project/astro.config.mjs
new file mode 100644
index 00000000..ab5551ed
--- /dev/null
+++ b/test/projectgraph/cases/javascript/astro-pages/project/astro.config.mjs
@@ -0,0 +1,3 @@
+import { integrate } from 'plug';
+
+export default { integrations: [integrate()] };
diff --git a/test/projectgraph/cases/javascript/astro-pages/project/package.json b/test/projectgraph/cases/javascript/astro-pages/project/package.json
new file mode 100644
index 00000000..7c47ca78
--- /dev/null
+++ b/test/projectgraph/cases/javascript/astro-pages/project/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "astro-pages",
+ "main": "server.js",
+ "dependencies": { "astro": "^4.5.0" }
+}
diff --git a/test/projectgraph/cases/javascript/astro-pages/project/server.js b/test/projectgraph/cases/javascript/astro-pages/project/server.js
new file mode 100644
index 00000000..fc1cd6f8
--- /dev/null
+++ b/test/projectgraph/cases/javascript/astro-pages/project/server.js
@@ -0,0 +1,3 @@
+import { listen } from 'plug';
+
+listen(3000);
diff --git a/test/projectgraph/cases/javascript/astro-pages/project/src/actions/index.ts b/test/projectgraph/cases/javascript/astro-pages/project/src/actions/index.ts
new file mode 100644
index 00000000..5dfe8073
--- /dev/null
+++ b/test/projectgraph/cases/javascript/astro-pages/project/src/actions/index.ts
@@ -0,0 +1,3 @@
+import { act } from 'plug';
+
+export const server = { go: { handler: async () => act() } };
diff --git a/test/projectgraph/cases/javascript/astro-pages/project/src/content/config.ts b/test/projectgraph/cases/javascript/astro-pages/project/src/content/config.ts
new file mode 100644
index 00000000..2ff173a2
--- /dev/null
+++ b/test/projectgraph/cases/javascript/astro-pages/project/src/content/config.ts
@@ -0,0 +1,3 @@
+import { collect } from 'plug';
+
+export const collections = { blog: collect() };
diff --git a/test/projectgraph/cases/javascript/astro-pages/project/src/pages/api/data.ts b/test/projectgraph/cases/javascript/astro-pages/project/src/pages/api/data.ts
new file mode 100644
index 00000000..b218695a
--- /dev/null
+++ b/test/projectgraph/cases/javascript/astro-pages/project/src/pages/api/data.ts
@@ -0,0 +1,5 @@
+import { store } from 'plug';
+
+export function GET() {
+ return store();
+}
diff --git a/test/projectgraph/cases/javascript/astro-pages/project/src/pages/index.astro b/test/projectgraph/cases/javascript/astro-pages/project/src/pages/index.astro
new file mode 100644
index 00000000..81fdf4a9
--- /dev/null
+++ b/test/projectgraph/cases/javascript/astro-pages/project/src/pages/index.astro
@@ -0,0 +1,5 @@
+---
+import { danger } from 'plug';
+danger();
+---
+
home
diff --git a/test/projectgraph/cases/javascript/builtin-chain/summaries/npm_plug_1.0.0.json b/test/projectgraph/cases/javascript/builtin-chain/summaries/npm_plug_1.0.0.json
index c4c68898..3591fcec 100644
--- a/test/projectgraph/cases/javascript/builtin-chain/summaries/npm_plug_1.0.0.json
+++ b/test/projectgraph/cases/javascript/builtin-chain/summaries/npm_plug_1.0.0.json
@@ -1,7 +1,7 @@
{
"version": "3",
- "index_version": "16",
- "link_version": "19",
+ "index_version": "17",
+ "link_version": "20",
"unit": "npm:plug@1.0.0",
"symbols": [
{
diff --git a/test/projectgraph/cases/javascript/component-reexport-star/expect.yaml b/test/projectgraph/cases/javascript/component-reexport-star/expect.yaml
new file mode 100644
index 00000000..2e8d7f86
--- /dev/null
+++ b/test/projectgraph/cases/javascript/component-reexport-star/expect.yaml
@@ -0,0 +1,70 @@
+source: safedep:hand
+description: >-
+ The template of App.vue calls api.t5, and api is the module reexport.js, which gives on each name of
+ plug. Only the Python test calls plug.t5 by an edge. A file of the JavaScript family gives on the module
+ plug, so the markup record concerns plug.t5, and it reads uncertain and not not-found.
+test_paths: [tests]
+roots:
+ - key: src/App.vue
+ kind: framework
+ rule: node.component
+ - key: src/main.js
+ kind: manifest
+ rule: node.package-json
+ - key: tests/test_api.py
+ kind: test
+ rule: test.files
+ - key: tests/test_api.py//test_t5
+ kind: test
+ rule: test.files
+exact_edges: true
+edges:
+ - from: src/App.vue
+ to: src/reexport.js
+ kind: import
+ confidence: high
+ site: src/App.vue:2
+ - from: src/main.js
+ to: src/App.vue
+ kind: import
+ confidence: high
+ site: src/main.js:2
+ - from: src/main.js
+ to: vue//createApp
+ kind: direct
+ confidence: high
+ site: src/main.js:4
+ - from: src/main.js
+ to: vue//createApp//mount
+ kind: direct
+ confidence: high
+ site: src/main.js:4
+ - from: tests/test_api.py//test_t5
+ to: plug//t5
+ kind: direct
+ confidence: high
+ site: tests/test_api.py:5
+unresolved:
+ - caller: src/App.vue
+ site: src/App.vue:1
+ reason: markup
+ - caller: src/main.js
+ site: src/main.js:4
+ reason: no-dependency-source
+ method: mount
+results:
+ - target: plug//t5
+ status: uncertain
+ test_path:
+ - key: tests/test_api.py//test_t5
+ - key: plug//t5
+ site: tests/test_api.py:5
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: tests/test_api.py//test_t5
+ site: tests/test_api.py:5
+ reached: false
+ uncertainties:
+ - kind: unresolved-call
+ site: src/App.vue:1
diff --git a/test/projectgraph/cases/javascript/component-reexport-star/project/package.json b/test/projectgraph/cases/javascript/component-reexport-star/project/package.json
new file mode 100644
index 00000000..7044e959
--- /dev/null
+++ b/test/projectgraph/cases/javascript/component-reexport-star/project/package.json
@@ -0,0 +1 @@
+{ "name": "component-reexport-star", "main": "src/main.js", "dependencies": { "vue": "^3.4.0" } }
diff --git a/test/projectgraph/cases/javascript/component-reexport-star/project/src/App.vue b/test/projectgraph/cases/javascript/component-reexport-star/project/src/App.vue
new file mode 100644
index 00000000..30f23b41
--- /dev/null
+++ b/test/projectgraph/cases/javascript/component-reexport-star/project/src/App.vue
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/test/projectgraph/cases/javascript/component-reexport-star/project/src/main.js b/test/projectgraph/cases/javascript/component-reexport-star/project/src/main.js
new file mode 100644
index 00000000..684d0421
--- /dev/null
+++ b/test/projectgraph/cases/javascript/component-reexport-star/project/src/main.js
@@ -0,0 +1,4 @@
+import { createApp } from 'vue';
+import App from './App.vue';
+
+createApp(App).mount('#app');
diff --git a/test/projectgraph/cases/javascript/component-reexport-star/project/src/reexport.js b/test/projectgraph/cases/javascript/component-reexport-star/project/src/reexport.js
new file mode 100644
index 00000000..ded11f0d
--- /dev/null
+++ b/test/projectgraph/cases/javascript/component-reexport-star/project/src/reexport.js
@@ -0,0 +1 @@
+export * from 'plug';
diff --git a/test/projectgraph/cases/javascript/component-reexport-star/project/tests/test_api.py b/test/projectgraph/cases/javascript/component-reexport-star/project/tests/test_api.py
new file mode 100644
index 00000000..de124d17
--- /dev/null
+++ b/test/projectgraph/cases/javascript/component-reexport-star/project/tests/test_api.py
@@ -0,0 +1,5 @@
+import plug
+
+
+def test_t5():
+ plug.t5()
diff --git a/test/projectgraph/cases/javascript/component-test-path/expect.yaml b/test/projectgraph/cases/javascript/component-test-path/expect.yaml
new file mode 100644
index 00000000..cf1bd8dc
--- /dev/null
+++ b/test/projectgraph/cases/javascript/component-test-path/expect.yaml
@@ -0,0 +1,54 @@
+source: safedep:hand
+description: >-
+ tests/fixtures/T.vue is a component under a test path, so it runs only under a test. The rule
+ node.component skips a test file, so fixture is not-found in the program and found only on a test path.
+ The directory weird.vue holds a plain module that no file imports. The rule matches the name of a file
+ and not of a directory, so helper is not-found.
+test_paths: [tests]
+roots:
+ - key: server.js
+ kind: manifest
+ rule: node.package-json
+ - key: tests/fixtures/T.vue
+ kind: test
+ rule: test.files
+exact_edges: true
+edges:
+ - from: server.js
+ to: plug//listen
+ kind: direct
+ confidence: high
+ site: server.js:3
+ - from: tests/fixtures/T.vue
+ to: plug//fixture
+ kind: direct
+ confidence: high
+ site: tests/fixtures/T.vue:4
+ - from: weird.vue/helper.js
+ to: plug//helper
+ kind: direct
+ confidence: high
+ site: weird.vue/helper.js:3
+unresolved:
+ - caller: tests/fixtures/T.vue
+ site: tests/fixtures/T.vue:1
+ reason: markup
+results:
+ - target: plug//fixture
+ status: not-found
+ test_path:
+ - key: tests/fixtures/T.vue
+ - key: plug//fixture
+ site: tests/fixtures/T.vue:4
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: tests/fixtures/T.vue
+ site: tests/fixtures/T.vue:4
+ reached: false
+ - target: plug//helper
+ status: not-found
+ call_sites:
+ - caller: weird.vue/helper.js
+ site: weird.vue/helper.js:3
+ reached: false
diff --git a/test/projectgraph/cases/javascript/component-test-path/project/package.json b/test/projectgraph/cases/javascript/component-test-path/project/package.json
new file mode 100644
index 00000000..bc2c5d36
--- /dev/null
+++ b/test/projectgraph/cases/javascript/component-test-path/project/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "component-test-path",
+ "main": "server.js",
+ "dependencies": { "vue": "^3.4.0" }
+}
diff --git a/test/projectgraph/cases/javascript/component-test-path/project/server.js b/test/projectgraph/cases/javascript/component-test-path/project/server.js
new file mode 100644
index 00000000..fc1cd6f8
--- /dev/null
+++ b/test/projectgraph/cases/javascript/component-test-path/project/server.js
@@ -0,0 +1,3 @@
+import { listen } from 'plug';
+
+listen(3000);
diff --git a/test/projectgraph/cases/javascript/component-test-path/project/tests/fixtures/T.vue b/test/projectgraph/cases/javascript/component-test-path/project/tests/fixtures/T.vue
new file mode 100644
index 00000000..7edffc79
--- /dev/null
+++ b/test/projectgraph/cases/javascript/component-test-path/project/tests/fixtures/T.vue
@@ -0,0 +1,9 @@
+
+
+
+
t
+
diff --git a/test/projectgraph/cases/javascript/component-test-path/project/weird.vue/helper.js b/test/projectgraph/cases/javascript/component-test-path/project/weird.vue/helper.js
new file mode 100644
index 00000000..14496ca9
--- /dev/null
+++ b/test/projectgraph/cases/javascript/component-test-path/project/weird.vue/helper.js
@@ -0,0 +1,3 @@
+import { helper } from 'plug';
+
+helper();
diff --git a/test/projectgraph/cases/javascript/dependency-candidates/summaries/npm_store-kit_1.0.0.json b/test/projectgraph/cases/javascript/dependency-candidates/summaries/npm_store-kit_1.0.0.json
index a52e9868..48500be2 100644
--- a/test/projectgraph/cases/javascript/dependency-candidates/summaries/npm_store-kit_1.0.0.json
+++ b/test/projectgraph/cases/javascript/dependency-candidates/summaries/npm_store-kit_1.0.0.json
@@ -1,7 +1,7 @@
{
"version": "3",
- "index_version": "16",
- "link_version": "19",
+ "index_version": "17",
+ "link_version": "20",
"unit": "npm:store-kit@1.0.0",
"symbols": [
{
diff --git a/test/projectgraph/cases/javascript/dependency-exports-import/summaries/npm_kit_1.0.0.json b/test/projectgraph/cases/javascript/dependency-exports-import/summaries/npm_kit_1.0.0.json
index c59cf4f8..ef44014e 100644
--- a/test/projectgraph/cases/javascript/dependency-exports-import/summaries/npm_kit_1.0.0.json
+++ b/test/projectgraph/cases/javascript/dependency-exports-import/summaries/npm_kit_1.0.0.json
@@ -1,7 +1,7 @@
{
"version": "3",
- "index_version": "16",
- "link_version": "19",
+ "index_version": "17",
+ "link_version": "20",
"unit": "npm:kit@1.0.0",
"symbols": [
{
diff --git a/test/projectgraph/cases/javascript/dependency-exports-require/summaries/npm_kit_1.0.0.json b/test/projectgraph/cases/javascript/dependency-exports-require/summaries/npm_kit_1.0.0.json
index c59cf4f8..ef44014e 100644
--- a/test/projectgraph/cases/javascript/dependency-exports-require/summaries/npm_kit_1.0.0.json
+++ b/test/projectgraph/cases/javascript/dependency-exports-require/summaries/npm_kit_1.0.0.json
@@ -1,7 +1,7 @@
{
"version": "3",
- "index_version": "16",
- "link_version": "19",
+ "index_version": "17",
+ "link_version": "20",
"unit": "npm:kit@1.0.0",
"symbols": [
{
diff --git a/test/projectgraph/cases/javascript/dependency-method-name/summaries/npm_plug_1.0.0.json b/test/projectgraph/cases/javascript/dependency-method-name/summaries/npm_plug_1.0.0.json
index a14fade4..44fbae9f 100644
--- a/test/projectgraph/cases/javascript/dependency-method-name/summaries/npm_plug_1.0.0.json
+++ b/test/projectgraph/cases/javascript/dependency-method-name/summaries/npm_plug_1.0.0.json
@@ -1,7 +1,7 @@
{
"version": "3",
- "index_version": "16",
- "link_version": "19",
+ "index_version": "17",
+ "link_version": "20",
"unit": "npm:plug@1.0.0",
"symbols": [
{
diff --git a/test/projectgraph/cases/javascript/dependency-same-path/summaries/npm_util-kit_1.0.0.json b/test/projectgraph/cases/javascript/dependency-same-path/summaries/npm_util-kit_1.0.0.json
index 2e8d0346..f4bb7739 100644
--- a/test/projectgraph/cases/javascript/dependency-same-path/summaries/npm_util-kit_1.0.0.json
+++ b/test/projectgraph/cases/javascript/dependency-same-path/summaries/npm_util-kit_1.0.0.json
@@ -1,7 +1,7 @@
{
"version": "3",
- "index_version": "16",
- "link_version": "19",
+ "index_version": "17",
+ "link_version": "20",
"unit": "npm:util-kit@1.0.0",
"symbols": [
{
diff --git a/test/projectgraph/cases/javascript/dependency-transitive/summaries/npm_lodash._reinterpolate_3.0.0.json b/test/projectgraph/cases/javascript/dependency-transitive/summaries/npm_lodash._reinterpolate_3.0.0.json
index f3b26e6c..d2ad08c7 100644
--- a/test/projectgraph/cases/javascript/dependency-transitive/summaries/npm_lodash._reinterpolate_3.0.0.json
+++ b/test/projectgraph/cases/javascript/dependency-transitive/summaries/npm_lodash._reinterpolate_3.0.0.json
@@ -1,7 +1,7 @@
{
"version": "3",
- "index_version": "16",
- "link_version": "19",
+ "index_version": "17",
+ "link_version": "20",
"unit": "npm:lodash._reinterpolate@3.0.0",
"symbols": [
{
diff --git a/test/projectgraph/cases/javascript/dependency-transitive/summaries/npm_lodash_4.17.21.json b/test/projectgraph/cases/javascript/dependency-transitive/summaries/npm_lodash_4.17.21.json
index 584208a0..7df354d3 100644
--- a/test/projectgraph/cases/javascript/dependency-transitive/summaries/npm_lodash_4.17.21.json
+++ b/test/projectgraph/cases/javascript/dependency-transitive/summaries/npm_lodash_4.17.21.json
@@ -1,7 +1,7 @@
{
"version": "3",
- "index_version": "16",
- "link_version": "19",
+ "index_version": "17",
+ "link_version": "20",
"unit": "npm:lodash@4.17.21",
"symbols": [
{
diff --git a/test/projectgraph/cases/javascript/library-opaque-export/expect.yaml b/test/projectgraph/cases/javascript/library-opaque-export/expect.yaml
new file mode 100644
index 00000000..9413c513
--- /dev/null
+++ b/test/projectgraph/cases/javascript/library-opaque-export/expect.yaml
@@ -0,0 +1,38 @@
+source: safedep:hand
+description: >-
+ The entry of the library exports api, which holds the result of the call makeApi. A user of the library
+ calls the functions of api, and no edge names them. So the manifest rule gives the export a
+ computed-name record of the JavaScript family, and a5 reads uncertain and not not-found.
+roots:
+ - key: src/index.js
+ kind: manifest
+ rule: node.package-json
+ - key: src/index.js//api
+ kind: manifest
+ rule: node.package-json
+exact_edges: true
+edges:
+ - from: src/index.js
+ to: src/index.js//makeApi
+ kind: direct
+ confidence: high
+ site: src/index.js:7
+ - from: src/index.js//makeApi//get
+ to: plug//a5
+ kind: direct
+ confidence: high
+ site: src/index.js:4
+unresolved:
+ - caller: src/index.js
+ site: src/index.js:9
+ reason: computed-name
+results:
+ - target: plug//a5
+ status: uncertain
+ call_sites:
+ - caller: src/index.js//makeApi//get
+ site: src/index.js:4
+ reached: false
+ uncertainties:
+ - kind: unresolved-call
+ site: src/index.js:9
diff --git a/test/projectgraph/cases/javascript/library-opaque-export/project/package.json b/test/projectgraph/cases/javascript/library-opaque-export/project/package.json
new file mode 100644
index 00000000..624bc881
--- /dev/null
+++ b/test/projectgraph/cases/javascript/library-opaque-export/project/package.json
@@ -0,0 +1 @@
+{ "name": "library-opaque-export", "main": "src/index.js" }
diff --git a/test/projectgraph/cases/javascript/library-opaque-export/project/src/index.js b/test/projectgraph/cases/javascript/library-opaque-export/project/src/index.js
new file mode 100644
index 00000000..3ebbf0dd
--- /dev/null
+++ b/test/projectgraph/cases/javascript/library-opaque-export/project/src/index.js
@@ -0,0 +1,9 @@
+import { a5 } from 'plug';
+
+function makeApi() {
+ return { get() { a5(); } };
+}
+
+const api = makeApi();
+
+export { api };
diff --git a/test/projectgraph/cases/javascript/nuxt-pages/expect.yaml b/test/projectgraph/cases/javascript/nuxt-pages/expect.yaml
new file mode 100644
index 00000000..bf72ed4f
--- /dev/null
+++ b/test/projectgraph/cases/javascript/nuxt-pages/expect.yaml
@@ -0,0 +1,65 @@
+source: safedep:hand
+description: >-
+ Nuxt loads pages/index.vue and layouts/default.vue by their paths, and no file imports them. Each
+ component file is a root of the rule node.component, so the calls in their scripts are found.
+roots:
+ - key: layouts/default.vue
+ kind: framework
+ rule: node.component
+ - key: pages/index.vue
+ kind: framework
+ rule: node.component
+ - key: server.js
+ kind: manifest
+ rule: node.package-json
+exact_edges: true
+edges:
+ - from: layouts/default.vue
+ to: plug//frame
+ kind: direct
+ confidence: high
+ site: layouts/default.vue:4
+ - from: pages/index.vue
+ to: plug//danger
+ kind: direct
+ confidence: high
+ site: pages/index.vue:4
+ - from: server.js
+ to: plug//listen
+ kind: direct
+ confidence: high
+ site: server.js:3
+unresolved:
+ - caller: layouts/default.vue
+ site: layouts/default.vue:1
+ reason: markup
+ - caller: pages/index.vue
+ site: pages/index.vue:1
+ reason: markup
+results:
+ - target: plug//danger
+ status: found
+ path:
+ - key: pages/index.vue
+ root: framework
+ - key: plug//danger
+ site: pages/index.vue:4
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: pages/index.vue
+ site: pages/index.vue:4
+ reached: true
+ - target: plug//frame
+ status: found
+ path:
+ - key: layouts/default.vue
+ root: framework
+ - key: plug//frame
+ site: layouts/default.vue:4
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: layouts/default.vue
+ site: layouts/default.vue:4
+ reached: true
diff --git a/test/projectgraph/cases/javascript/nuxt-pages/project/layouts/default.vue b/test/projectgraph/cases/javascript/nuxt-pages/project/layouts/default.vue
new file mode 100644
index 00000000..62892847
--- /dev/null
+++ b/test/projectgraph/cases/javascript/nuxt-pages/project/layouts/default.vue
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/test/projectgraph/cases/javascript/nuxt-pages/project/package.json b/test/projectgraph/cases/javascript/nuxt-pages/project/package.json
new file mode 100644
index 00000000..d6b28003
--- /dev/null
+++ b/test/projectgraph/cases/javascript/nuxt-pages/project/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "nuxt-pages",
+ "main": "server.js",
+ "dependencies": { "nuxt": "^3.11.0" }
+}
diff --git a/test/projectgraph/cases/javascript/nuxt-pages/project/pages/index.vue b/test/projectgraph/cases/javascript/nuxt-pages/project/pages/index.vue
new file mode 100644
index 00000000..bce26238
--- /dev/null
+++ b/test/projectgraph/cases/javascript/nuxt-pages/project/pages/index.vue
@@ -0,0 +1,9 @@
+
+
+
+
index
+
diff --git a/test/projectgraph/cases/javascript/nuxt-pages/project/server.js b/test/projectgraph/cases/javascript/nuxt-pages/project/server.js
new file mode 100644
index 00000000..fc1cd6f8
--- /dev/null
+++ b/test/projectgraph/cases/javascript/nuxt-pages/project/server.js
@@ -0,0 +1,3 @@
+import { listen } from 'plug';
+
+listen(3000);
diff --git a/test/projectgraph/cases/javascript/svelte-markup/expect.yaml b/test/projectgraph/cases/javascript/svelte-markup/expect.yaml
index dbc823b2..47a63079 100644
--- a/test/projectgraph/cases/javascript/svelte-markup/expect.yaml
+++ b/test/projectgraph/cases/javascript/svelte-markup/expect.yaml
@@ -1,6 +1,9 @@
source: safedep:hand
description: An event handler in the markup of Other.svelte calls sdanger, which its script imports. The index does not parse the markup, so the file has a markup record, and sdanger reads uncertain, not no-such-target.
roots:
+ - key: src/Other.svelte
+ kind: framework
+ rule: node.component
- key: src/main.js
kind: manifest
rule: node.package-json
@@ -29,11 +32,7 @@ results:
- target: plug//ssetup
status: found
path:
- - key: src/main.js
- key: src/Other.svelte
- site: src/main.js:2
- kind: import
- confidence: high
- key: plug//ssetup
site: src/Other.svelte:3
kind: direct
diff --git a/test/projectgraph/cases/javascript/sveltekit-actions-lib/expect.yaml b/test/projectgraph/cases/javascript/sveltekit-actions-lib/expect.yaml
new file mode 100644
index 00000000..8dc1d321
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-actions-lib/expect.yaml
@@ -0,0 +1,147 @@
+source: safedep:hand
+description: >-
+ SvelteKit calls each function of the exported object actions of a +page.server.ts by its name, and no
+ call of the graph names them. The rule node.sveltekit.route marks each function under an exported object
+ of a route file, so a1 and a2 are found. The API route imports helper by the alias $lib, which SvelteKit
+ maps to src/lib of the package that depends on @sveltejs/kit, so the call of helper reaches c1. The
+ object actions of items/+page.server.ts has a satisfies type, and its functions keep their names under
+ actions, so a6 is found. The function unused inside save is a helper of save, not a member of actions.
+ No code calls it, so a7 is not-found. Without the rule that skips such a helper, unused is a root and
+ a7 reads found.
+roots:
+ - key: server.js
+ kind: manifest
+ rule: node.package-json
+ - key: src/routes/api/+server.js
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/api/+server.js//POST
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/form/+page.server.ts
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/form/+page.server.ts//actions
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/form/+page.server.ts//actions//default
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/form/+page.server.ts//actions//save
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/items/+page.server.ts
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/items/+page.server.ts//actions
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/items/+page.server.ts//actions//default
+ kind: framework
+ rule: node.sveltekit.route
+exact_edges: true
+edges:
+ - from: src/routes/form/+page.server.ts//actions//save//unused
+ to: plug//a7
+ kind: direct
+ confidence: high
+ site: src/routes/form/+page.server.ts:9
+ - from: server.js
+ to: plug//listen
+ kind: direct
+ confidence: high
+ site: server.js:3
+ - from: src/lib/helper.js//helper
+ to: plug//c1
+ kind: direct
+ confidence: high
+ site: src/lib/helper.js:4
+ - from: src/routes/api/+server.js
+ to: src/lib/helper.js
+ kind: import
+ confidence: high
+ site: src/routes/api/+server.js:1
+ - from: src/routes/api/+server.js//POST
+ to: src/lib/helper.js//helper
+ kind: direct
+ confidence: high
+ site: src/routes/api/+server.js:4
+ - from: src/routes/form/+page.server.ts//actions//default
+ to: plug//a1
+ kind: direct
+ confidence: high
+ site: src/routes/form/+page.server.ts:5
+ - from: src/routes/form/+page.server.ts//actions//save
+ to: plug//a2
+ kind: direct
+ confidence: high
+ site: src/routes/form/+page.server.ts:11
+ - from: src/routes/items/+page.server.ts//actions//default
+ to: plug//a6
+ kind: direct
+ confidence: high
+ site: src/routes/items/+page.server.ts:6
+unresolved: []
+results:
+ - target: plug//a1
+ status: found
+ path:
+ - key: src/routes/form/+page.server.ts//actions//default
+ root: framework
+ - key: plug//a1
+ site: src/routes/form/+page.server.ts:5
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/form/+page.server.ts//actions//default
+ site: src/routes/form/+page.server.ts:5
+ reached: true
+ - target: plug//a2
+ status: found
+ path:
+ - key: src/routes/form/+page.server.ts//actions//save
+ root: framework
+ - key: plug//a2
+ site: src/routes/form/+page.server.ts:11
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/form/+page.server.ts//actions//save
+ site: src/routes/form/+page.server.ts:11
+ reached: true
+ - target: plug//c1
+ status: found
+ path:
+ - key: src/routes/api/+server.js//POST
+ root: framework
+ - key: src/lib/helper.js//helper
+ site: src/routes/api/+server.js:4
+ kind: direct
+ confidence: high
+ - key: plug//c1
+ site: src/lib/helper.js:4
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/lib/helper.js//helper
+ site: src/lib/helper.js:4
+ reached: true
+ - target: plug//a6
+ status: found
+ path:
+ - key: src/routes/items/+page.server.ts//actions//default
+ root: framework
+ - key: plug//a6
+ site: src/routes/items/+page.server.ts:6
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/items/+page.server.ts//actions//default
+ site: src/routes/items/+page.server.ts:6
+ reached: true
+ - target: plug//a7
+ status: not-found
+ call_sites:
+ - caller: src/routes/form/+page.server.ts//actions//save//unused
+ site: src/routes/form/+page.server.ts:9
+ reached: false
diff --git a/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/package.json b/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/package.json
new file mode 100644
index 00000000..455a2c4b
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "sveltekit-actions-lib",
+ "main": "server.js",
+ "devDependencies": { "@sveltejs/kit": "^2.5.0" }
+}
diff --git a/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/server.js b/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/server.js
new file mode 100644
index 00000000..fc1cd6f8
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/server.js
@@ -0,0 +1,3 @@
+import { listen } from 'plug';
+
+listen(3000);
diff --git a/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/src/lib/helper.js b/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/src/lib/helper.js
new file mode 100644
index 00000000..099b4c6b
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/src/lib/helper.js
@@ -0,0 +1,5 @@
+import { c1 } from 'plug';
+
+export function helper() {
+ return c1();
+}
diff --git a/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/src/routes/api/+server.js b/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/src/routes/api/+server.js
new file mode 100644
index 00000000..50167b76
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/src/routes/api/+server.js
@@ -0,0 +1,5 @@
+import { helper } from '$lib/helper';
+
+export function POST() {
+ return helper();
+}
diff --git a/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/src/routes/form/+page.server.ts b/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/src/routes/form/+page.server.ts
new file mode 100644
index 00000000..a313b363
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/src/routes/form/+page.server.ts
@@ -0,0 +1,13 @@
+import { a1, a2, a7 } from 'plug';
+
+export const actions = {
+ default: async ({ request }) => {
+ a1(request);
+ },
+ save({ request }) {
+ function unused() {
+ a7();
+ }
+ a2(request);
+ },
+};
diff --git a/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/src/routes/items/+page.server.ts b/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/src/routes/items/+page.server.ts
new file mode 100644
index 00000000..e0e18dd3
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-actions-lib/project/src/routes/items/+page.server.ts
@@ -0,0 +1,8 @@
+import type { Actions } from './$types';
+import { a6 } from 'plug';
+
+export const actions = {
+ default: async () => {
+ a6();
+ },
+} satisfies Actions;
diff --git a/test/projectgraph/cases/javascript/sveltekit-destructured-export/expect.yaml b/test/projectgraph/cases/javascript/sveltekit-destructured-export/expect.yaml
new file mode 100644
index 00000000..2a647d36
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-destructured-export/expect.yaml
@@ -0,0 +1,107 @@
+source: safedep:hand
+description: >-
+ The route file exports GET, PUT and POST by a destructuring declaration from the object handlers, and
+ fallback from the array fallbacks. The index gives each name an export record whose target is the member
+ that it takes, as handlers//rest//PUT for PUT in { rest: { PUT } }, and POST for the rename post: POST.
+ A name of an array pattern takes the array. So the rule node.sveltekit.route marks each function, and
+ a1, a2 and a3 are found. The function of fallbacks runs its call in the module top level, so a4 is found.
+roots:
+ - key: server.js
+ kind: manifest
+ rule: node.package-json
+ - key: src/routes/api/+server.ts
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/api/+server.ts//fallbacks
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/api/+server.ts//handlers//GET
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/api/+server.ts//handlers//post
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/api/+server.ts//handlers//rest//PUT
+ kind: framework
+ rule: node.sveltekit.route
+exact_edges: true
+edges:
+ - from: server.js
+ to: plug//listen
+ kind: direct
+ confidence: high
+ site: server.js:3
+ - from: src/routes/api/+server.ts
+ to: plug//a4
+ kind: direct
+ confidence: high
+ site: src/routes/api/+server.ts:10
+ - from: src/routes/api/+server.ts//handlers//GET
+ to: plug//a1
+ kind: direct
+ confidence: high
+ site: src/routes/api/+server.ts:4
+ - from: src/routes/api/+server.ts//handlers//post
+ to: plug//a3
+ kind: direct
+ confidence: high
+ site: src/routes/api/+server.ts:7
+ - from: src/routes/api/+server.ts//handlers//rest//PUT
+ to: plug//a2
+ kind: direct
+ confidence: high
+ site: src/routes/api/+server.ts:5
+unresolved: []
+results:
+ - target: plug//a1
+ status: found
+ path:
+ - key: src/routes/api/+server.ts//handlers//GET
+ root: framework
+ - key: plug//a1
+ site: src/routes/api/+server.ts:4
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/api/+server.ts//handlers//GET
+ site: src/routes/api/+server.ts:4
+ reached: true
+ - target: plug//a2
+ status: found
+ path:
+ - key: src/routes/api/+server.ts//handlers//rest//PUT
+ root: framework
+ - key: plug//a2
+ site: src/routes/api/+server.ts:5
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/api/+server.ts//handlers//rest//PUT
+ site: src/routes/api/+server.ts:5
+ reached: true
+ - target: plug//a3
+ status: found
+ path:
+ - key: src/routes/api/+server.ts//handlers//post
+ root: framework
+ - key: plug//a3
+ site: src/routes/api/+server.ts:7
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/api/+server.ts//handlers//post
+ site: src/routes/api/+server.ts:7
+ reached: true
+ - target: plug//a4
+ status: found
+ path:
+ - key: src/routes/api/+server.ts
+ root: framework
+ - key: plug//a4
+ site: src/routes/api/+server.ts:10
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/api/+server.ts
+ site: src/routes/api/+server.ts:10
+ reached: true
diff --git a/test/projectgraph/cases/javascript/sveltekit-destructured-export/project/package.json b/test/projectgraph/cases/javascript/sveltekit-destructured-export/project/package.json
new file mode 100644
index 00000000..068b7a75
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-destructured-export/project/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "sveltekit-destructured-export",
+ "main": "server.js",
+ "devDependencies": { "@sveltejs/kit": "^2.5.0" }
+}
diff --git a/test/projectgraph/cases/javascript/sveltekit-destructured-export/project/server.js b/test/projectgraph/cases/javascript/sveltekit-destructured-export/project/server.js
new file mode 100644
index 00000000..fc1cd6f8
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-destructured-export/project/server.js
@@ -0,0 +1,3 @@
+import { listen } from 'plug';
+
+listen(3000);
diff --git a/test/projectgraph/cases/javascript/sveltekit-destructured-export/project/src/routes/api/+server.ts b/test/projectgraph/cases/javascript/sveltekit-destructured-export/project/src/routes/api/+server.ts
new file mode 100644
index 00000000..c8eccbe1
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-destructured-export/project/src/routes/api/+server.ts
@@ -0,0 +1,13 @@
+import { a1, a2, a3, a4 } from 'plug';
+
+const handlers = {
+ GET: async () => a1(),
+ rest: { PUT: async () => a2() },
+ post() {
+ a3();
+ },
+};
+const fallbacks = [async () => a4()];
+
+export const { GET, rest: { PUT }, post: POST } = handlers;
+export const [fallback] = fallbacks;
diff --git a/test/projectgraph/cases/javascript/sveltekit-lib-moved/expect.yaml b/test/projectgraph/cases/javascript/sveltekit-lib-moved/expect.yaml
new file mode 100644
index 00000000..dbd11fe4
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-lib-moved/expect.yaml
@@ -0,0 +1,46 @@
+source: safedep:hand
+description: >-
+ svelte.config.js moves the library directory of SvelteKit to src/library, and the resolver does not read
+ it. So $lib/helper names no file. The alias $lib names a directory of the project, so the import is a
+ record with the reason no-definition and not an external key, and c1 reads uncertain and not not-found.
+roots:
+ - key: server.js
+ kind: manifest
+ rule: node.package-json
+ - key: src/routes/api/+server.js
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/api/+server.js//POST
+ kind: framework
+ rule: node.sveltekit.route
+exact_edges: true
+edges:
+ - from: server.js
+ to: plug//listen
+ kind: direct
+ confidence: high
+ site: server.js:3
+ - from: src/library/helper.js//helper
+ to: plug//c1
+ kind: direct
+ confidence: high
+ site: src/library/helper.js:4
+ - from: src/routes/api/+server.js//POST
+ to: $lib//helper//helper
+ kind: direct
+ confidence: high
+ site: src/routes/api/+server.js:4
+unresolved:
+ - caller: src/routes/api/+server.js
+ site: src/routes/api/+server.js:1
+ reason: no-definition
+results:
+ - target: plug//c1
+ status: uncertain
+ call_sites:
+ - caller: src/library/helper.js//helper
+ site: src/library/helper.js:4
+ reached: false
+ uncertainties:
+ - kind: unresolved-call
+ site: src/routes/api/+server.js:1
diff --git a/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/package.json b/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/package.json
new file mode 100644
index 00000000..444b1f88
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "sveltekit-lib-moved",
+ "main": "server.js",
+ "devDependencies": { "@sveltejs/kit": "^2.5.0" }
+}
diff --git a/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/server.js b/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/server.js
new file mode 100644
index 00000000..fc1cd6f8
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/server.js
@@ -0,0 +1,3 @@
+import { listen } from 'plug';
+
+listen(3000);
diff --git a/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/src/library/helper.js b/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/src/library/helper.js
new file mode 100644
index 00000000..099b4c6b
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/src/library/helper.js
@@ -0,0 +1,5 @@
+import { c1 } from 'plug';
+
+export function helper() {
+ return c1();
+}
diff --git a/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/src/routes/api/+server.js b/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/src/routes/api/+server.js
new file mode 100644
index 00000000..50167b76
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/src/routes/api/+server.js
@@ -0,0 +1,5 @@
+import { helper } from '$lib/helper';
+
+export function POST() {
+ return helper();
+}
diff --git a/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/svelte.config.js b/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/svelte.config.js
new file mode 100644
index 00000000..43fcf186
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-lib-moved/project/svelte.config.js
@@ -0,0 +1 @@
+export default { kit: { files: { lib: 'src/library' } } };
diff --git a/test/projectgraph/cases/javascript/sveltekit-opaque-exports/expect.yaml b/test/projectgraph/cases/javascript/sveltekit-opaque-exports/expect.yaml
new file mode 100644
index 00000000..bae1ff91
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-opaque-exports/expect.yaml
@@ -0,0 +1,207 @@
+source: safedep:hand
+description: >-
+ The route files export values that are no object literal. handle is the result of sequence, and the
+ index records the arguments first and second of the call in the export statement as references, so
+ h1 and h2 are found. other names the variable named, which holds table, so the export reaches table and
+ the rule marks save. PUT takes the default fallback, because handlers has no PUT. GET and actions are
+ results of calls, and the functions that the framework calls on them are no definition that an edge
+ names. So each of the two exports gets a computed-name record in place of a root, and a1 and a4 read
+ uncertain and not not-found.
+roots:
+ - key: server.js
+ kind: manifest
+ rule: node.package-json
+ - key: src/hooks.server.ts
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/hooks.server.ts//handle
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/a/+server.ts
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/a/+server.ts//fallback
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/b/+page.server.ts
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/b/+page.server.ts//actions
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/b/+page.server.ts//named
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/b/+page.server.ts//table
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/b/+page.server.ts//table//save
+ kind: framework
+ rule: node.sveltekit.route
+exact_edges: true
+edges:
+ - from: server.js
+ to: plug//listen
+ kind: direct
+ confidence: high
+ site: server.js:3
+ - from: src/hooks.server.ts
+ to: "@sveltejs//kit//hooks//sequence"
+ kind: direct
+ confidence: high
+ site: src/hooks.server.ts:14
+ - from: src/hooks.server.ts
+ to: src/hooks.server.ts//first
+ kind: reference
+ confidence: low
+ site: src/hooks.server.ts:14
+ - from: src/hooks.server.ts
+ to: src/hooks.server.ts//second
+ kind: reference
+ confidence: low
+ site: src/hooks.server.ts:14
+ - from: src/hooks.server.ts//first
+ to: plug//h1
+ kind: direct
+ confidence: high
+ site: src/hooks.server.ts:5
+ - from: src/hooks.server.ts//second
+ to: plug//h2
+ kind: direct
+ confidence: high
+ site: src/hooks.server.ts:10
+ - from: src/routes/a/+server.ts
+ to: src/routes/a/+server.ts//make
+ kind: direct
+ confidence: high
+ site: src/routes/a/+server.ts:7
+ - from: src/routes/a/+server.ts//fallback
+ to: plug//a3
+ kind: direct
+ confidence: high
+ site: src/routes/a/+server.ts:9
+ - from: src/routes/a/+server.ts//make//GET
+ to: plug//a1
+ kind: direct
+ confidence: high
+ site: src/routes/a/+server.ts:4
+ - from: src/routes/b/+page.server.ts
+ to: src/routes/b/+page.server.ts//makeActions
+ kind: direct
+ confidence: high
+ site: src/routes/b/+page.server.ts:7
+ - from: src/routes/b/+page.server.ts//makeActions//default
+ to: plug//a4
+ kind: direct
+ confidence: high
+ site: src/routes/b/+page.server.ts:4
+ - from: src/routes/b/+page.server.ts//table//save
+ to: plug//a5
+ kind: direct
+ confidence: high
+ site: src/routes/b/+page.server.ts:9
+unresolved:
+ - caller: src/hooks.server.ts//first
+ site: src/hooks.server.ts:6
+ reason: unknown-receiver
+ method: resolve
+ - caller: src/hooks.server.ts//second
+ site: src/hooks.server.ts:11
+ reason: unknown-receiver
+ method: resolve
+ - caller: src/hooks.server.ts
+ site: src/hooks.server.ts:14
+ reason: computed-name
+ - caller: src/routes/a/+server.ts
+ site: src/routes/a/+server.ts:7
+ reason: computed-name
+ - caller: src/routes/b/+page.server.ts
+ site: src/routes/b/+page.server.ts:7
+ reason: computed-name
+results:
+ - target: plug//h1
+ status: found
+ path:
+ - key: src/hooks.server.ts
+ root: framework
+ - key: src/hooks.server.ts//first
+ site: src/hooks.server.ts:14
+ kind: reference
+ confidence: low
+ - key: plug//h1
+ site: src/hooks.server.ts:5
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/hooks.server.ts//first
+ site: src/hooks.server.ts:5
+ reached: true
+ - target: plug//h2
+ status: found
+ path:
+ - key: src/hooks.server.ts
+ root: framework
+ - key: src/hooks.server.ts//second
+ site: src/hooks.server.ts:14
+ kind: reference
+ confidence: low
+ - key: plug//h2
+ site: src/hooks.server.ts:10
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/hooks.server.ts//second
+ site: src/hooks.server.ts:10
+ reached: true
+ - target: plug//a1
+ status: uncertain
+ call_sites:
+ - caller: src/routes/a/+server.ts//make//GET
+ site: src/routes/a/+server.ts:4
+ reached: false
+ uncertainties:
+ - kind: unresolved-call
+ site: src/hooks.server.ts:14
+ - kind: unresolved-call
+ site: src/routes/a/+server.ts:7
+ - kind: unresolved-call
+ site: src/routes/b/+page.server.ts:7
+ - target: plug//a3
+ status: found
+ path:
+ - key: src/routes/a/+server.ts//fallback
+ root: framework
+ - key: plug//a3
+ site: src/routes/a/+server.ts:9
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/a/+server.ts//fallback
+ site: src/routes/a/+server.ts:9
+ reached: true
+ - target: plug//a4
+ status: uncertain
+ call_sites:
+ - caller: src/routes/b/+page.server.ts//makeActions//default
+ site: src/routes/b/+page.server.ts:4
+ reached: false
+ uncertainties:
+ - kind: unresolved-call
+ site: src/hooks.server.ts:14
+ - kind: unresolved-call
+ site: src/routes/a/+server.ts:7
+ - kind: unresolved-call
+ site: src/routes/b/+page.server.ts:7
+ - target: plug//a5
+ status: found
+ path:
+ - key: src/routes/b/+page.server.ts//table//save
+ root: framework
+ - key: plug//a5
+ site: src/routes/b/+page.server.ts:9
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/b/+page.server.ts//table//save
+ site: src/routes/b/+page.server.ts:9
+ reached: true
diff --git a/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/package.json b/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/package.json
new file mode 100644
index 00000000..6d911bbb
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "sveltekit-opaque-exports",
+ "main": "server.js",
+ "devDependencies": { "@sveltejs/kit": "^2.5.0" }
+}
diff --git a/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/server.js b/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/server.js
new file mode 100644
index 00000000..fc1cd6f8
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/server.js
@@ -0,0 +1,3 @@
+import { listen } from 'plug';
+
+listen(3000);
diff --git a/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/src/hooks.server.ts b/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/src/hooks.server.ts
new file mode 100644
index 00000000..37132cb0
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/src/hooks.server.ts
@@ -0,0 +1,14 @@
+import { sequence } from '@sveltejs/kit/hooks';
+import { h1, h2 } from 'plug';
+
+const first = async ({ event, resolve }) => {
+ h1();
+ return resolve(event);
+};
+
+async function second({ event, resolve }) {
+ h2();
+ return resolve(event);
+}
+
+export const handle = sequence(first, second);
diff --git a/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/src/routes/a/+server.ts b/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/src/routes/a/+server.ts
new file mode 100644
index 00000000..46e7b0cc
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/src/routes/a/+server.ts
@@ -0,0 +1,12 @@
+import { a1, a3 } from 'plug';
+
+function make() {
+ return { GET() { a1(); } };
+}
+
+export const { GET } = make();
+
+const fallback = () => a3();
+const handlers = {};
+
+export const { PUT = fallback } = handlers;
diff --git a/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/src/routes/b/+page.server.ts b/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/src/routes/b/+page.server.ts
new file mode 100644
index 00000000..fbffba0a
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-opaque-exports/project/src/routes/b/+page.server.ts
@@ -0,0 +1,12 @@
+import { a4, a5 } from 'plug';
+
+function makeActions() {
+ return { default: async () => a4() };
+}
+
+export const actions = makeActions();
+
+const table = { save: async () => a5() };
+const named = table;
+
+export { named as other };
diff --git a/test/projectgraph/cases/javascript/sveltekit-routes/expect.yaml b/test/projectgraph/cases/javascript/sveltekit-routes/expect.yaml
new file mode 100644
index 00000000..5b5997b6
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-routes/expect.yaml
@@ -0,0 +1,121 @@
+source: safedep:hand
+description: >-
+ SvelteKit loads the files of src/routes by their names, and no file imports them. Each component file
+ is a root of the rule node.component. The rule node.sveltekit.route marks each route file and its
+ exports, so load of +page.ts and POST of +server.ts are roots too, and store and fetchData are found
+ and not only uncertain by the markup records.
+roots:
+ - key: server.js
+ kind: manifest
+ rule: node.package-json
+ - key: src/routes/+layout.svelte
+ kind: framework
+ rule: node.component
+ - key: src/routes/+layout.svelte
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/+page.svelte
+ kind: framework
+ rule: node.component
+ - key: src/routes/+page.svelte
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/+page.ts
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/+page.ts//load
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/api/+server.ts
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/api/+server.ts//POST
+ kind: framework
+ rule: node.sveltekit.route
+exact_edges: true
+edges:
+ - from: server.js
+ to: plug//listen
+ kind: direct
+ confidence: high
+ site: server.js:3
+ - from: src/routes/+layout.svelte
+ to: plug//frame
+ kind: direct
+ confidence: high
+ site: src/routes/+layout.svelte:3
+ - from: src/routes/+page.svelte
+ to: plug//danger
+ kind: direct
+ confidence: high
+ site: src/routes/+page.svelte:3
+ - from: src/routes/+page.ts//load
+ to: plug//fetchData
+ kind: direct
+ confidence: high
+ site: src/routes/+page.ts:4
+ - from: src/routes/api/+server.ts//POST
+ to: plug//store
+ kind: direct
+ confidence: high
+ site: src/routes/api/+server.ts:4
+unresolved:
+ - caller: src/routes/+layout.svelte
+ site: src/routes/+layout.svelte:1
+ reason: markup
+ - caller: src/routes/+page.svelte
+ site: src/routes/+page.svelte:1
+ reason: markup
+results:
+ - target: plug//danger
+ status: found
+ path:
+ - key: src/routes/+page.svelte
+ root: framework
+ - key: plug//danger
+ site: src/routes/+page.svelte:3
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/+page.svelte
+ site: src/routes/+page.svelte:3
+ reached: true
+ - target: plug//frame
+ status: found
+ path:
+ - key: src/routes/+layout.svelte
+ root: framework
+ - key: plug//frame
+ site: src/routes/+layout.svelte:3
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/+layout.svelte
+ site: src/routes/+layout.svelte:3
+ reached: true
+ - target: plug//fetchData
+ status: found
+ path:
+ - key: src/routes/+page.ts//load
+ root: framework
+ - key: plug//fetchData
+ site: src/routes/+page.ts:4
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/+page.ts//load
+ site: src/routes/+page.ts:4
+ reached: true
+ - target: plug//store
+ status: found
+ path:
+ - key: src/routes/api/+server.ts//POST
+ root: framework
+ - key: plug//store
+ site: src/routes/api/+server.ts:4
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/api/+server.ts//POST
+ site: src/routes/api/+server.ts:4
+ reached: true
diff --git a/test/projectgraph/cases/javascript/sveltekit-routes/project/package.json b/test/projectgraph/cases/javascript/sveltekit-routes/project/package.json
new file mode 100644
index 00000000..da1b56d0
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-routes/project/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "sveltekit-routes",
+ "main": "server.js",
+ "devDependencies": { "@sveltejs/kit": "^2.5.0", "svelte": "^4.2.0" }
+}
diff --git a/test/projectgraph/cases/javascript/sveltekit-routes/project/server.js b/test/projectgraph/cases/javascript/sveltekit-routes/project/server.js
new file mode 100644
index 00000000..fc1cd6f8
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-routes/project/server.js
@@ -0,0 +1,3 @@
+import { listen } from 'plug';
+
+listen(3000);
diff --git a/test/projectgraph/cases/javascript/sveltekit-routes/project/src/routes/+layout.svelte b/test/projectgraph/cases/javascript/sveltekit-routes/project/src/routes/+layout.svelte
new file mode 100644
index 00000000..a5974fc3
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-routes/project/src/routes/+layout.svelte
@@ -0,0 +1,6 @@
+
+
+
diff --git a/test/projectgraph/cases/javascript/sveltekit-routes/project/src/routes/+page.svelte b/test/projectgraph/cases/javascript/sveltekit-routes/project/src/routes/+page.svelte
new file mode 100644
index 00000000..bdb3e7fa
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-routes/project/src/routes/+page.svelte
@@ -0,0 +1,6 @@
+
+
+
home
diff --git a/test/projectgraph/cases/javascript/sveltekit-routes/project/src/routes/+page.ts b/test/projectgraph/cases/javascript/sveltekit-routes/project/src/routes/+page.ts
new file mode 100644
index 00000000..1cea69c2
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-routes/project/src/routes/+page.ts
@@ -0,0 +1,5 @@
+import { fetchData } from 'plug';
+
+export function load() {
+ return fetchData();
+}
diff --git a/test/projectgraph/cases/javascript/sveltekit-routes/project/src/routes/api/+server.ts b/test/projectgraph/cases/javascript/sveltekit-routes/project/src/routes/api/+server.ts
new file mode 100644
index 00000000..5b0d767b
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-routes/project/src/routes/api/+server.ts
@@ -0,0 +1,5 @@
+import { store } from 'plug';
+
+export function POST() {
+ return store();
+}
diff --git a/test/projectgraph/cases/javascript/sveltekit-test-dir/expect.yaml b/test/projectgraph/cases/javascript/sveltekit-test-dir/expect.yaml
new file mode 100644
index 00000000..0dc2b80e
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-test-dir/expect.yaml
@@ -0,0 +1,76 @@
+source: safedep:hand
+description: >-
+ A route of the app has a path under a test path, as src/routes/api/test or src/routes/tests. The
+ route rule names its files by their path in the app, so it marks them although they are test files,
+ and probe and render are found. Only the rule node.component skips a file of a test path.
+test_paths: [test, tests, spec]
+roots:
+ - key: server.js
+ kind: manifest
+ rule: node.package-json
+ - key: src/routes/api/test/+server.ts
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/api/test/+server.ts
+ kind: test
+ rule: test.files
+ - key: src/routes/api/test/+server.ts//GET
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/api/test/+server.ts//GET
+ kind: test
+ rule: test.files
+ - key: src/routes/tests/+page.svelte
+ kind: framework
+ rule: node.sveltekit.route
+ - key: src/routes/tests/+page.svelte
+ kind: test
+ rule: test.files
+exact_edges: true
+edges:
+ - from: server.js
+ to: plug//listen
+ kind: direct
+ confidence: high
+ site: server.js:3
+ - from: src/routes/api/test/+server.ts//GET
+ to: plug//probe
+ kind: direct
+ confidence: high
+ site: src/routes/api/test/+server.ts:4
+ - from: src/routes/tests/+page.svelte
+ to: plug//render
+ kind: direct
+ confidence: high
+ site: src/routes/tests/+page.svelte:3
+unresolved:
+ - caller: src/routes/tests/+page.svelte
+ site: src/routes/tests/+page.svelte:1
+ reason: markup
+results:
+ - target: plug//probe
+ status: found
+ path:
+ - key: src/routes/api/test/+server.ts//GET
+ root: framework
+ - key: plug//probe
+ site: src/routes/api/test/+server.ts:4
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/api/test/+server.ts//GET
+ site: src/routes/api/test/+server.ts:4
+ reached: true
+ - target: plug//render
+ status: found
+ path:
+ - key: src/routes/tests/+page.svelte
+ root: framework
+ - key: plug//render
+ site: src/routes/tests/+page.svelte:3
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/routes/tests/+page.svelte
+ site: src/routes/tests/+page.svelte:3
+ reached: true
diff --git a/test/projectgraph/cases/javascript/sveltekit-test-dir/project/package.json b/test/projectgraph/cases/javascript/sveltekit-test-dir/project/package.json
new file mode 100644
index 00000000..8a00bac4
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-test-dir/project/package.json
@@ -0,0 +1 @@
+{ "name": "sveltekit-test-dir", "main": "server.js", "devDependencies": { "@sveltejs/kit": "^2.5.0" } }
diff --git a/test/projectgraph/cases/javascript/sveltekit-test-dir/project/server.js b/test/projectgraph/cases/javascript/sveltekit-test-dir/project/server.js
new file mode 100644
index 00000000..fc1cd6f8
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-test-dir/project/server.js
@@ -0,0 +1,3 @@
+import { listen } from 'plug';
+
+listen(3000);
diff --git a/test/projectgraph/cases/javascript/sveltekit-test-dir/project/src/routes/api/test/+server.ts b/test/projectgraph/cases/javascript/sveltekit-test-dir/project/src/routes/api/test/+server.ts
new file mode 100644
index 00000000..4dd9311e
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-test-dir/project/src/routes/api/test/+server.ts
@@ -0,0 +1,5 @@
+import { probe } from 'plug';
+
+export function GET() {
+ return probe();
+}
diff --git a/test/projectgraph/cases/javascript/sveltekit-test-dir/project/src/routes/tests/+page.svelte b/test/projectgraph/cases/javascript/sveltekit-test-dir/project/src/routes/tests/+page.svelte
new file mode 100644
index 00000000..875bb221
--- /dev/null
+++ b/test/projectgraph/cases/javascript/sveltekit-test-dir/project/src/routes/tests/+page.svelte
@@ -0,0 +1,6 @@
+
+
+
tests
diff --git a/test/projectgraph/cases/javascript/vue-alias-import/expect.yaml b/test/projectgraph/cases/javascript/vue-alias-import/expect.yaml
new file mode 100644
index 00000000..44e1159f
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-alias-import/expect.yaml
@@ -0,0 +1,56 @@
+source: safedep:hand
+description: >-
+ main.js imports Panel.vue by the alias @/ of the bundler, and the project has no tsconfig paths, so the
+ import names an external key and no path leads to Panel.vue. Each component file is a root of the rule
+ node.component, so the call of danger in the script of Panel.vue is found.
+roots:
+ - key: src/components/Panel.vue
+ kind: framework
+ rule: node.component
+ - key: src/main.js
+ kind: manifest
+ rule: node.package-json
+exact_edges: true
+edges:
+ - from: src/components/Panel.vue
+ to: plug//danger
+ kind: direct
+ confidence: high
+ site: src/components/Panel.vue:4
+ - from: src/main.js
+ to: vue//createApp
+ kind: direct
+ confidence: high
+ site: src/main.js:4
+ - from: src/main.js
+ to: vue//createApp//mount
+ kind: direct
+ confidence: high
+ site: src/main.js:4
+ - from: src/main.js
+ to: "@//components//Panel.vue"
+ kind: reference
+ confidence: low
+ site: src/main.js:4
+unresolved:
+ - caller: src/components/Panel.vue
+ site: src/components/Panel.vue:1
+ reason: markup
+ - caller: src/main.js
+ site: src/main.js:4
+ reason: no-dependency-source
+ method: mount
+results:
+ - target: plug//danger
+ status: found
+ path:
+ - key: src/components/Panel.vue
+ root: framework
+ - key: plug//danger
+ site: src/components/Panel.vue:4
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/components/Panel.vue
+ site: src/components/Panel.vue:4
+ reached: true
diff --git a/test/projectgraph/cases/javascript/vue-alias-import/project/package.json b/test/projectgraph/cases/javascript/vue-alias-import/project/package.json
new file mode 100644
index 00000000..e9d60369
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-alias-import/project/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "vue-alias-import",
+ "main": "src/main.js",
+ "dependencies": { "vue": "^3.4.0" }
+}
diff --git a/test/projectgraph/cases/javascript/vue-alias-import/project/src/components/Panel.vue b/test/projectgraph/cases/javascript/vue-alias-import/project/src/components/Panel.vue
new file mode 100644
index 00000000..87537a4f
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-alias-import/project/src/components/Panel.vue
@@ -0,0 +1,9 @@
+
+
+
+
panel
+
diff --git a/test/projectgraph/cases/javascript/vue-alias-import/project/src/main.js b/test/projectgraph/cases/javascript/vue-alias-import/project/src/main.js
new file mode 100644
index 00000000..000dc0df
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-alias-import/project/src/main.js
@@ -0,0 +1,4 @@
+import { createApp } from 'vue';
+import Panel from '@/components/Panel.vue';
+
+createApp(Panel).mount('#app');
diff --git a/test/projectgraph/cases/javascript/vue-import-meta-glob/expect.yaml b/test/projectgraph/cases/javascript/vue-import-meta-glob/expect.yaml
new file mode 100644
index 00000000..99876d8a
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-import-meta-glob/expect.yaml
@@ -0,0 +1,66 @@
+source: safedep:hand
+description: >-
+ main.js loads each page of src/pages by import.meta.glob, which the index does not read, so no path
+ leads to About.vue. Each component file is a root of the rule node.component, so the call of danger in
+ the script of About.vue is found.
+roots:
+ - key: src/main.js
+ kind: manifest
+ rule: node.package-json
+ - key: src/pages/About.vue
+ kind: framework
+ rule: node.component
+exact_edges: true
+edges:
+ - from: src/main.js
+ to: vue//createApp
+ kind: direct
+ confidence: high
+ site: src/main.js:4
+ - from: src/main.js
+ to: Object//entries
+ kind: direct
+ confidence: high
+ site: src/main.js:5
+ - from: src/main.js
+ to: vue//createApp//component
+ kind: direct
+ confidence: high
+ site: src/main.js:6
+ - from: src/main.js
+ to: vue//defineAsyncComponent
+ kind: direct
+ confidence: high
+ site: src/main.js:6
+ - from: src/main.js
+ to: vue//createApp//mount
+ kind: direct
+ confidence: high
+ site: src/main.js:8
+ - from: src/pages/About.vue
+ to: plug//danger
+ kind: direct
+ confidence: high
+ site: src/pages/About.vue:4
+unresolved:
+ - caller: src/main.js
+ site: src/main.js:3
+ reason: unknown-receiver
+ method: glob
+ - caller: src/pages/About.vue
+ site: src/pages/About.vue:1
+ reason: markup
+results:
+ - target: plug//danger
+ status: found
+ path:
+ - key: src/pages/About.vue
+ root: framework
+ - key: plug//danger
+ site: src/pages/About.vue:4
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/pages/About.vue
+ site: src/pages/About.vue:4
+ reached: true
diff --git a/test/projectgraph/cases/javascript/vue-import-meta-glob/project/package.json b/test/projectgraph/cases/javascript/vue-import-meta-glob/project/package.json
new file mode 100644
index 00000000..55893cc5
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-import-meta-glob/project/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "vue-import-meta-glob",
+ "main": "src/main.js",
+ "dependencies": { "vue": "^3.4.0" }
+}
diff --git a/test/projectgraph/cases/javascript/vue-import-meta-glob/project/src/main.js b/test/projectgraph/cases/javascript/vue-import-meta-glob/project/src/main.js
new file mode 100644
index 00000000..d2ec149b
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-import-meta-glob/project/src/main.js
@@ -0,0 +1,8 @@
+import { createApp, defineAsyncComponent } from 'vue';
+
+const pages = import.meta.glob('./pages/*.vue');
+const app = createApp({});
+for (const [path, load] of Object.entries(pages)) {
+ app.component(path, defineAsyncComponent(load));
+}
+app.mount('#app');
diff --git a/test/projectgraph/cases/javascript/vue-import-meta-glob/project/src/pages/About.vue b/test/projectgraph/cases/javascript/vue-import-meta-glob/project/src/pages/About.vue
new file mode 100644
index 00000000..220168de
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-import-meta-glob/project/src/pages/About.vue
@@ -0,0 +1,9 @@
+
+
+
+
about
+
diff --git a/test/projectgraph/cases/javascript/vue-options-api/expect.yaml b/test/projectgraph/cases/javascript/vue-options-api/expect.yaml
index 3ff5fd4a..cbe23b23 100644
--- a/test/projectgraph/cases/javascript/vue-options-api/expect.yaml
+++ b/test/projectgraph/cases/javascript/vue-options-api/expect.yaml
@@ -1,6 +1,12 @@
source: safedep:hand
description: Vue calls the methods and the hooks of the options object of a component. No code of the project calls go of Opt.vue or mounted of Hooks.vue. Hooks.vue has no template, and it still has a markup record, so hdanger reads uncertain and not not-found.
roots:
+ - key: src/Hooks.vue
+ kind: framework
+ rule: node.component
+ - key: src/Opt.vue
+ kind: framework
+ rule: node.component
- key: src/main.js
kind: manifest
rule: node.package-json
@@ -51,10 +57,10 @@ results:
site: src/Opt.vue:11
reached: false
uncertainties:
- - kind: unresolved-call
- site: src/Opt.vue:1
- kind: unresolved-call
site: src/Hooks.vue:1
+ - kind: unresolved-call
+ site: src/Opt.vue:1
- target: plug//hdanger
status: uncertain
call_sites:
@@ -62,7 +68,7 @@ results:
site: src/Hooks.vue:6
reached: false
uncertainties:
- - kind: unresolved-call
- site: src/Opt.vue:1
- kind: unresolved-call
site: src/Hooks.vue:1
+ - kind: unresolved-call
+ site: src/Opt.vue:1
diff --git a/test/projectgraph/cases/javascript/vue-route-dynamic-import/expect.yaml b/test/projectgraph/cases/javascript/vue-route-dynamic-import/expect.yaml
new file mode 100644
index 00000000..da290c03
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-route-dynamic-import/expect.yaml
@@ -0,0 +1,90 @@
+source: safedep:hand
+description: >-
+ The route table of router.js loads Home.vue by a dynamic import in an arrow function that vue-router
+ calls. No code of the graph calls the arrow function, so no path leads to Home.vue. Each component file
+ is a root of the rule node.component, so the call of danger in the script of Home.vue is found.
+roots:
+ - key: src/main.js
+ kind: manifest
+ rule: node.package-json
+ - key: src/views/Home.vue
+ kind: framework
+ rule: node.component
+exact_edges: true
+edges:
+ - from: src/main.js
+ to: src/router.js
+ kind: import
+ confidence: high
+ site: src/main.js:3
+ - from: src/main.js
+ to: vue//createApp
+ kind: direct
+ confidence: high
+ site: src/main.js:5
+ - from: src/main.js
+ to: vue//createApp//use
+ kind: direct
+ confidence: high
+ site: src/main.js:5
+ - from: src/main.js
+ to: vue//createApp//use//mount
+ kind: direct
+ confidence: high
+ site: src/main.js:5
+ - from: src/main.js//render
+ to: vue//h
+ kind: direct
+ confidence: high
+ site: src/main.js:5
+ - from: src/main.js//render
+ to: vue-router//RouterView
+ kind: reference
+ confidence: low
+ site: src/main.js:5
+ - from: src/router.js
+ to: vue-router//createRouter
+ kind: direct
+ confidence: high
+ site: src/router.js:7
+ - from: src/router.js
+ to: vue-router//createWebHistory
+ kind: direct
+ confidence: high
+ site: src/router.js:7
+ - from: src/router.js//component
+ to: src/views/Home.vue
+ kind: import
+ confidence: high
+ site: src/router.js:4
+ - from: src/views/Home.vue
+ to: plug//danger
+ kind: direct
+ confidence: high
+ site: src/views/Home.vue:4
+unresolved:
+ - caller: src/main.js
+ site: src/main.js:5
+ reason: no-dependency-source
+ method: use
+ - caller: src/main.js
+ site: src/main.js:5
+ reason: no-dependency-source
+ method: mount
+ - caller: src/views/Home.vue
+ site: src/views/Home.vue:1
+ reason: markup
+results:
+ - target: plug//danger
+ status: found
+ path:
+ - key: src/views/Home.vue
+ root: framework
+ - key: plug//danger
+ site: src/views/Home.vue:4
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/views/Home.vue
+ site: src/views/Home.vue:4
+ reached: true
diff --git a/test/projectgraph/cases/javascript/vue-route-dynamic-import/project/package.json b/test/projectgraph/cases/javascript/vue-route-dynamic-import/project/package.json
new file mode 100644
index 00000000..030f19ba
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-route-dynamic-import/project/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "vue-route-dynamic-import",
+ "main": "src/main.js",
+ "dependencies": { "vue": "^3.4.0", "vue-router": "^4.3.0" }
+}
diff --git a/test/projectgraph/cases/javascript/vue-route-dynamic-import/project/src/main.js b/test/projectgraph/cases/javascript/vue-route-dynamic-import/project/src/main.js
new file mode 100644
index 00000000..39085b95
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-route-dynamic-import/project/src/main.js
@@ -0,0 +1,5 @@
+import { createApp, h } from 'vue';
+import { RouterView } from 'vue-router';
+import { router } from './router.js';
+
+createApp({ render: () => h(RouterView) }).use(router).mount('#app');
diff --git a/test/projectgraph/cases/javascript/vue-route-dynamic-import/project/src/router.js b/test/projectgraph/cases/javascript/vue-route-dynamic-import/project/src/router.js
new file mode 100644
index 00000000..e6268f17
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-route-dynamic-import/project/src/router.js
@@ -0,0 +1,7 @@
+import { createRouter, createWebHistory } from 'vue-router';
+
+const routes = [
+ { path: '/', component: () => import('./views/Home.vue') },
+];
+
+export const router = createRouter({ history: createWebHistory(), routes });
diff --git a/test/projectgraph/cases/javascript/vue-route-dynamic-import/project/src/views/Home.vue b/test/projectgraph/cases/javascript/vue-route-dynamic-import/project/src/views/Home.vue
new file mode 100644
index 00000000..05dab581
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-route-dynamic-import/project/src/views/Home.vue
@@ -0,0 +1,9 @@
+
+
+
+
home
+
diff --git a/test/projectgraph/cases/javascript/vue-script-src/expect.yaml b/test/projectgraph/cases/javascript/vue-script-src/expect.yaml
index 29f39ff6..ea07141b 100644
--- a/test/projectgraph/cases/javascript/vue-script-src/expect.yaml
+++ b/test/projectgraph/cases/javascript/vue-script-src/expect.yaml
@@ -1,6 +1,9 @@
source: safedep:hand
description: The script element of Ext.vue loads logic.js by its src attribute. The element is an import of logic.js, so the search reaches edanger through it.
roots:
+ - key: src/Ext.vue
+ kind: framework
+ rule: node.component
- key: src/main.js
kind: manifest
rule: node.package-json
@@ -34,11 +37,7 @@ results:
- target: plug//edanger
status: found
path:
- - key: src/main.js
- key: src/Ext.vue
- site: src/main.js:2
- kind: import
- confidence: high
- key: src/logic.js
site: src/Ext.vue:2
kind: import
diff --git a/test/projectgraph/cases/javascript/vue-setup-handler/expect.yaml b/test/projectgraph/cases/javascript/vue-setup-handler/expect.yaml
index e0c011bc..f419a488 100644
--- a/test/projectgraph/cases/javascript/vue-setup-handler/expect.yaml
+++ b/test/projectgraph/cases/javascript/vue-setup-handler/expect.yaml
@@ -1,6 +1,9 @@
source: safedep:hand
description: The template of App.vue names onClick as a click handler. No code of the script calls onClick, so only the markup record makes danger, which onClick calls, read uncertain and not not-found.
roots:
+ - key: src/App.vue
+ kind: framework
+ rule: node.component
- key: src/main.js
kind: manifest
rule: node.package-json
diff --git a/test/projectgraph/cases/javascript/vue-template-markup/expect.yaml b/test/projectgraph/cases/javascript/vue-template-markup/expect.yaml
index 41d80d3a..4363352f 100644
--- a/test/projectgraph/cases/javascript/vue-template-markup/expect.yaml
+++ b/test/projectgraph/cases/javascript/vue-template-markup/expect.yaml
@@ -1,6 +1,9 @@
source: safedep:hand
description: The template of App.vue calls danger and render, which its script imports. The index does not parse the template, so the file has a markup record, and each target reads uncertain, not no-such-target. setup runs in the script and is found.
roots:
+ - key: src/App.vue
+ kind: framework
+ rule: node.component
- key: src/main.js
kind: manifest
rule: node.package-json
@@ -29,11 +32,7 @@ results:
- target: plug//setup
status: found
path:
- - key: src/main.js
- key: src/App.vue
- site: src/main.js:2
- kind: import
- confidence: high
- key: plug//setup
site: src/App.vue:8
kind: direct
diff --git a/test/projectgraph/cases/javascript/vue-vite-fallback/expect.yaml b/test/projectgraph/cases/javascript/vue-vite-fallback/expect.yaml
new file mode 100644
index 00000000..a7f79c79
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-vite-fallback/expect.yaml
@@ -0,0 +1,81 @@
+source: safedep:hand
+description: >-
+ Vite loads src/main.js from index.html, which no rule reads, and package.json names no entry. So the
+ roots fall back to the library surface. App.vue is a root of the rule node.component, and that rule
+ keeps the fallback on, so init, which only main.js calls, stays found.
+roots:
+ - key: src/App.vue
+ kind: framework
+ rule: node.component
+ - key: src/App.vue
+ kind: library-surface
+ rule: library-surface
+ - key: src/main.js
+ kind: library-surface
+ rule: library-surface
+exact_edges: true
+edges:
+ - from: src/App.vue
+ to: plug//danger
+ kind: direct
+ confidence: high
+ site: src/App.vue:4
+ - from: src/main.js
+ to: src/App.vue
+ kind: import
+ confidence: high
+ site: src/main.js:3
+ - from: src/main.js
+ to: plug//init
+ kind: direct
+ confidence: high
+ site: src/main.js:5
+ - from: src/main.js
+ to: vue//createApp
+ kind: direct
+ confidence: high
+ site: src/main.js:6
+ - from: src/main.js
+ to: vue//createApp//mount
+ kind: direct
+ confidence: high
+ site: src/main.js:6
+unresolved:
+ - caller: src/App.vue
+ site: src/App.vue:1
+ reason: markup
+ - caller: src/main.js
+ site: src/main.js:6
+ reason: no-dependency-source
+ method: mount
+results:
+ - target: plug//init
+ status: found
+ path:
+ - key: src/main.js
+ root: library-surface
+ - key: plug//init
+ site: src/main.js:5
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/main.js
+ site: src/main.js:5
+ reached: true
+ uncertainties:
+ - kind: root-fallback
+ - target: plug//danger
+ status: found
+ path:
+ - key: src/App.vue
+ root: framework
+ - key: plug//danger
+ site: src/App.vue:4
+ kind: direct
+ confidence: high
+ call_sites:
+ - caller: src/App.vue
+ site: src/App.vue:4
+ reached: true
+ uncertainties:
+ - kind: root-fallback
diff --git a/test/projectgraph/cases/javascript/vue-vite-fallback/project/index.html b/test/projectgraph/cases/javascript/vue-vite-fallback/project/index.html
new file mode 100644
index 00000000..74acba4f
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-vite-fallback/project/index.html
@@ -0,0 +1,2 @@
+
+
diff --git a/test/projectgraph/cases/javascript/vue-vite-fallback/project/package.json b/test/projectgraph/cases/javascript/vue-vite-fallback/project/package.json
new file mode 100644
index 00000000..b5cd7dd7
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-vite-fallback/project/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "vue-vite-fallback",
+ "private": true,
+ "dependencies": { "vue": "^3.4.0" }
+}
diff --git a/test/projectgraph/cases/javascript/vue-vite-fallback/project/src/App.vue b/test/projectgraph/cases/javascript/vue-vite-fallback/project/src/App.vue
new file mode 100644
index 00000000..db48f660
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-vite-fallback/project/src/App.vue
@@ -0,0 +1,9 @@
+
+
+
+
app
+
diff --git a/test/projectgraph/cases/javascript/vue-vite-fallback/project/src/main.js b/test/projectgraph/cases/javascript/vue-vite-fallback/project/src/main.js
new file mode 100644
index 00000000..58df0d7e
--- /dev/null
+++ b/test/projectgraph/cases/javascript/vue-vite-fallback/project/src/main.js
@@ -0,0 +1,6 @@
+import { createApp } from 'vue';
+import { init } from 'plug';
+import App from './App.vue';
+
+init();
+createApp(App).mount('#app');
diff --git a/test/projectgraph/cases/python/component-in-frontend/expect.yaml b/test/projectgraph/cases/python/component-in-frontend/expect.yaml
new file mode 100644
index 00000000..0b02b9a0
--- /dev/null
+++ b/test/projectgraph/cases/python/component-in-frontend/expect.yaml
@@ -0,0 +1,71 @@
+source: safedep:hand
+description: >-
+ A Python service ships a Vue frontend. App.vue is a root of the rule node.component, and its markup
+ record runs only JavaScript code. So the record concerns the targets that code of the JavaScript family
+ calls, and os.remove, which only dead Python code calls, stays not-found. plug.other has no node, so no
+ edge tells who calls it, and the record keeps it uncertain. Only dead Python code calls
+ jsonschema.validate, but App.vue imports validate from jsonschema and its template calls it, so the
+ record keeps jsonschema.validate uncertain.
+ The frontend has no entry of its own, as main of a package.json, so its files get the library-surface
+ roots, and each result carries the root-fallback uncertainty.
+roots:
+ - key: frontend/src/App.vue
+ kind: framework
+ rule: node.component
+ - key: frontend/src/App.vue
+ kind: library-surface
+ rule: library-surface
+ - key: main.py
+ kind: manifest
+ rule: procfile
+exact_edges: true
+edges:
+ - from: frontend/src/App.vue
+ to: plug//render
+ kind: direct
+ confidence: high
+ site: frontend/src/App.vue:5
+ - from: main.py
+ to: shutil//rmtree
+ kind: direct
+ confidence: high
+ site: main.py:12
+ - from: main.py//unused
+ to: os//remove
+ kind: direct
+ confidence: high
+ site: main.py:8
+ - from: main.py//unused
+ to: jsonschema//validate
+ kind: direct
+ confidence: high
+ site: main.py:9
+unresolved:
+ - caller: frontend/src/App.vue
+ site: frontend/src/App.vue:1
+ reason: markup
+results:
+ - target: os//remove
+ status: not-found
+ call_sites:
+ - caller: main.py//unused
+ site: main.py:8
+ reached: false
+ uncertainties:
+ - kind: root-fallback
+ - target: plug//other
+ status: uncertain
+ uncertainties:
+ - kind: unresolved-call
+ site: frontend/src/App.vue:1
+ - kind: root-fallback
+ - target: jsonschema//validate
+ status: uncertain
+ call_sites:
+ - caller: main.py//unused
+ site: main.py:9
+ reached: false
+ uncertainties:
+ - kind: unresolved-call
+ site: frontend/src/App.vue:1
+ - kind: root-fallback
diff --git a/test/projectgraph/cases/python/component-in-frontend/project/Procfile b/test/projectgraph/cases/python/component-in-frontend/project/Procfile
new file mode 100644
index 00000000..629b83ad
--- /dev/null
+++ b/test/projectgraph/cases/python/component-in-frontend/project/Procfile
@@ -0,0 +1 @@
+web: python main.py
diff --git a/test/projectgraph/cases/python/component-in-frontend/project/frontend/package.json b/test/projectgraph/cases/python/component-in-frontend/project/frontend/package.json
new file mode 100644
index 00000000..be960f5a
--- /dev/null
+++ b/test/projectgraph/cases/python/component-in-frontend/project/frontend/package.json
@@ -0,0 +1 @@
+{ "name": "frontend", "dependencies": { "vue": "^3.4.0" } }
diff --git a/test/projectgraph/cases/python/component-in-frontend/project/frontend/src/App.vue b/test/projectgraph/cases/python/component-in-frontend/project/frontend/src/App.vue
new file mode 100644
index 00000000..55a127b8
--- /dev/null
+++ b/test/projectgraph/cases/python/component-in-frontend/project/frontend/src/App.vue
@@ -0,0 +1,10 @@
+
+
+
+