ek9_remove_dependency
Answers with the edit that deletes one entry from the deps or devDeps Dict of a 'defines package' block (the whole Dict when it was the last entry).
When to use it
'Drop the dependency on ekopen.net.handy.tools' is one call with file:'package.ek9', bucket:'deps' (or 'devDeps') and module:'ekopen.net.handy.tools'.
When not to use it
- Adding a dependency - use
ek9_add_dependency. - Lifting a transitive EXCLUSION - use
ek9_remove_transitive_exclusion. - Removing a capability declaration - use
ek9_remove_capability. - The module is a transitive, not a direct deps/devDeps entry - use
ek9_exclude_transitive_dependencyto stop the pull-in.
Details
An emptied bucket's whole 'bucket <- { ... }' declaration is removed (EK9 forbids an empty Dict) and the summary says so - there is no flag either way. Only the multi-line Dict form is edited (a single-line bucket is error 'single-line-bucket-unsupported'); an unknown module conflicts with 'dependency-not-declared' listing the bucket's keys. Edits the source only - chain ek9_resolve_dependencies to clean the local cache; the dry run performs no scratch compile, so a reference-breaking removal is caught by the post-apply verify.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
bucket | string: deps | devDeps | yes | Which Dict to remove from: 'deps' (runtime, deployed) or 'devDeps' (dev/test only, not deployed). |
file | string | yes | The .ek9 file holding the 'defines package' block, workspace-relative (typically 'package.ek9'); an absolute path inside the workspace is accepted. |
module | string | yes | The dependency's module name to remove, e.g. 'ekopen.network.support.utils' - matched against the Dict key. |
It also takes the arguments every tool takes.
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
Remove dependency not declared
Request
{
"bucket" : "deps",
"file" : "package.ek9",
"module" : "ekopen.never.declared.here"
}
Response
{
"conflicts" : [ {
"description" : "ekopen.never.declared.here is not declared in deps; existing keys: [ekopen.network.support.utils, ekopen.net.handy.tools]",
"file" : "package.ek9",
"kind" : "dependency-not-declared"
} ],
"edits" : [ ],
"meta" : {
"serverMs" : "<timing>"
},
"risk" : {
"crossesModuleBoundary" : false,
"estimatedSeverity" : "trivial",
"fileCount" : 0,
"lineCount" : 0,
"touchesPublicApi" : false,
"touchesTests" : false
},
"status" : "conflicts",
"summary" : "ekopen.never.declared.here is not declared in deps; existing keys: [ekopen.network.support.utils, ekopen.net.handy.tools]",
"workspaceHash" : "<workspace-hash>",
"wouldBeDiagnostics" : [ ],
"written" : false
}
Remove dependency apply
Request
{
"bucket" : "deps",
"file" : "package.ek9",
"module" : "ekopen.net.handy.tools"
}
Response
{
"conflicts" : [ ],
"edits" : [ {
"before" : " \"ekopen.net.handy.tools\": \"3.2.1-0\"",
"endLine" : 11,
"file" : "package.ek9",
"startLine" : 11,
"type" : "delete"
}, {
"after" : " \"ekopen.network.support.utils\": \"1.6.1-9\"",
"before" : " \"ekopen.network.support.utils\": \"1.6.1-9\",",
"endLine" : 10,
"file" : "package.ek9",
"startLine" : 10,
"type" : "replace"
} ],
"meta" : {
"serverMs" : "<timing>"
},
"risk" : {
"crossesModuleBoundary" : false,
"estimatedSeverity" : "trivial",
"fileCount" : 1,
"lineCount" : 2,
...
Cut short here: 9 more lines. The whole recorded call.