ek9_exclude_transitive_dependency

Answers with the edit that adds an excludeDeps entry (module -> viaModule) to a 'defines package' block, blocking a transitive dependency a parent pulls in.

Category: Editor · Compare: maven exclusions / npm overrides

When to use it

'Block the transitive ekopen.bad.pack that ekopen.util pulls in' is one call with file:'package.ek9', module:'ekopen.bad.pack' and viaModule:'ekopen.util'.

When not to use it

Details

The excludeDeps Dict is created when absent; module is the KEY and viaModule the VALUE (the parent it arrives through, never a version), so there is at most one exclusion per transitive - to re-route via a different parent, ek9_remove_transitive_exclusion then re-add. Never returns would-fail: the dry run skips the scratch compile because exclusion validity is a resolver concern. Edits the source only - chain ek9_resolve_dependencies (it cleans the cache) to purge the cached transitive.

Arguments

ArgumentTypeRequiredWhat it is
filestringyesThe .ek9 file holding the 'defines package' block, workspace-relative (typically 'package.ek9'); an absolute path inside the workspace is accepted.
modulestringyesThe transitive module to block, e.g. 'ekopen.some.bad.dependency.pack' - the excludeDeps Dict key.
viaModulestringyesThe parent module whose dependency on 'module' is blocked, e.g. 'ekopen.org.supertools.util' - the excludeDeps Dict value (a module name, not a version).

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. 3 of the 4 recorded are shown.

Exclude transitive dependency apply

Request

{
  "file" : "package.ek9",
  "module" : "ekopen.legacy.crufty.lib",
  "viaModule" : "ekopen.net.handy.tools"
}

Response

{
  "conflicts" : [ ],
  "edits" : [ {
    "after" : "      \"ekopen.legacy.crufty.lib\" : \"ekopen.net.handy.tools\",",
    "endLine" : 15,
    "file" : "package.ek9",
    "startLine" : 15,
    "type" : "insert"
  } ],
  "meta" : {
    "serverMs" : "<timing>"
  },
  "risk" : {
    "crossesModuleBoundary" : false,
    "estimatedSeverity" : "trivial",
    "fileCount" : 1,
    "lineCount" : 1,
    "touchesPublicApi" : false,
    "touchesTests" : false
  },
  "status" : "applied",
  "summary" : "Excluded transitive ekopen.legacy.crufty.lib (via ekopen.net.handy.tools)",
  "workspaceHash" : "<workspace-hash>",
  "wouldBeDiagnostics" : [ ],
...

Cut short here: 2 more lines. The whole recorded call.

Exclude transitive dependency creates bucket

Request

{
  "file" : "package.ek9",
  "module" : "ekopen.some.bad.dependency.pack",
  "viaModule" : "ekopen.network.support.utils"
}

Response

{
  "conflicts" : [ ],
  "edits" : [ {
    "after" : "\n    excludeDeps <- {\n      \"ekopen.some.bad.dependency.pack\" : \"ekopen.network.support.utils\"\n    }",
    "endLine" : 13,
    "file" : "package.ek9",
    "startLine" : 13,
    "type" : "insert"
  } ],
  "meta" : {
    "serverMs" : "<timing>"
  },
  "risk" : {
    "crossesModuleBoundary" : false,
    "estimatedSeverity" : "trivial",
    "fileCount" : 1,
    "lineCount" : 1,
    "touchesPublicApi" : false,
    "touchesTests" : false
  },
  "status" : "applied",
  "summary" : "Created excludeDeps with ekopen.some.bad.dependency.pack=ekopen.network.support.utils",
  "workspaceHash" : "<workspace-hash>",
  "wouldBeDiagnostics" : [ ],
...

Cut short here: 2 more lines. The whole recorded call.

Exclude transitive dependency direct escalation

Request

{
  "file" : "package.ek9",
  "module" : "ekopen.net.handy.tools",
  "viaModule" : "ekopen.network.support.utils"
}

Response

{
  "conflicts" : [ {
    "description" : "ekopen.net.handy.tools is a direct 'deps' dependency, not a transitive; drop it with ek9_remove_dependency rather than excluding it",
    "file" : "package.ek9",
    "kind" : "direct-dependency-cannot-be-excluded-as-transitive"
  } ],
  "edits" : [ ],
  "meta" : {
    "serverMs" : "<timing>"
  },
  "risk" : {
    "crossesModuleBoundary" : false,
    "estimatedSeverity" : "trivial",
    "fileCount" : 0,
    "lineCount" : 0,
    "touchesPublicApi" : false,
    "touchesTests" : false
  },
  "status" : "conflicts",
  "summary" : "ekopen.net.handy.tools is a direct 'deps' dependency, not a transitive; drop it with ek9_remove_dependency rather than excluding it",
  "workspaceHash" : "<workspace-hash>",
  "wouldBeDiagnostics" : [ ],
  "written" : false
}