waterplane 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/SECURITY.md +25 -5
- package/node_modules/@waterplane/shared/dist/agentseries/compare.d.ts +8 -0
- package/node_modules/@waterplane/shared/dist/agentseries/compare.js +103 -0
- package/node_modules/@waterplane/shared/dist/agentseries/compare.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/agentseries/markers.d.ts +17 -0
- package/node_modules/@waterplane/shared/dist/agentseries/markers.js +125 -0
- package/node_modules/@waterplane/shared/dist/agentseries/markers.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/agentseries/series.d.ts +16 -0
- package/node_modules/@waterplane/shared/dist/agentseries/series.js +93 -0
- package/node_modules/@waterplane/shared/dist/agentseries/series.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/agentseries/stats.d.ts +8 -0
- package/node_modules/@waterplane/shared/dist/agentseries/stats.js +33 -0
- package/node_modules/@waterplane/shared/dist/agentseries/stats.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/agentseries/types.d.ts +103 -0
- package/node_modules/@waterplane/shared/dist/agentseries/types.js +11 -0
- package/node_modules/@waterplane/shared/dist/agentseries/types.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/agentseries.d.ts +10 -0
- package/node_modules/@waterplane/shared/dist/agentseries.js +11 -0
- package/node_modules/@waterplane/shared/dist/agentseries.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/calday.d.ts +5 -0
- package/node_modules/@waterplane/shared/dist/calday.js +10 -0
- package/node_modules/@waterplane/shared/dist/calday.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/clihealth/healthfixture.d.ts +13 -1
- package/node_modules/@waterplane/shared/dist/clihealth/healthfixture.js +22 -4
- package/node_modules/@waterplane/shared/dist/clihealth/healthfixture.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/clihealth.d.ts +1 -1
- package/node_modules/@waterplane/shared/dist/clihealth.js +1 -1
- package/node_modules/@waterplane/shared/dist/clihealth.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/dictate.d.ts +6 -0
- package/node_modules/@waterplane/shared/dist/dictate.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/dictatemodels.d.ts +23 -0
- package/node_modules/@waterplane/shared/dist/dictatemodels.js +31 -0
- package/node_modules/@waterplane/shared/dist/dictatemodels.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/healthindex/commits.d.ts +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex/commits.js +2 -2
- package/node_modules/@waterplane/shared/dist/healthindex/commits.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex/coverage.d.ts +128 -0
- package/node_modules/@waterplane/shared/dist/healthindex/coverage.js +343 -0
- package/node_modules/@waterplane/shared/dist/healthindex/coverage.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/healthindex/readings.d.ts +9 -1
- package/node_modules/@waterplane/shared/dist/healthindex/readings.js +122 -4
- package/node_modules/@waterplane/shared/dist/healthindex/readings.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex/repoindex.d.ts +5 -0
- package/node_modules/@waterplane/shared/dist/healthindex/repoindex.js +2 -0
- package/node_modules/@waterplane/shared/dist/healthindex/repoindex.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex/score.d.ts +3 -0
- package/node_modules/@waterplane/shared/dist/healthindex/score.js +52 -16
- package/node_modules/@waterplane/shared/dist/healthindex/score.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex/types.d.ts +82 -6
- package/node_modules/@waterplane/shared/dist/healthindex/types.js +35 -2
- package/node_modules/@waterplane/shared/dist/healthindex/types.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex/words.js +65 -6
- package/node_modules/@waterplane/shared/dist/healthindex/words.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindex.d.ts +21 -7
- package/node_modules/@waterplane/shared/dist/healthindex.js +20 -7
- package/node_modules/@waterplane/shared/dist/healthindex.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthindexresponse.js +3 -2
- package/node_modules/@waterplane/shared/dist/healthindexresponse.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/healthspend.d.ts +23 -0
- package/node_modules/@waterplane/shared/dist/healthspend.js +32 -1
- package/node_modules/@waterplane/shared/dist/healthspend.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/hints.js +9 -0
- package/node_modules/@waterplane/shared/dist/hints.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/index.d.ts +9 -0
- package/node_modules/@waterplane/shared/dist/index.js +9 -0
- package/node_modules/@waterplane/shared/dist/index.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/installrow.js +10 -0
- package/node_modules/@waterplane/shared/dist/installrow.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/intent/kind.d.ts +45 -1
- package/node_modules/@waterplane/shared/dist/intent/kind.js +60 -2
- package/node_modules/@waterplane/shared/dist/intent/kind.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/intent.d.ts +1 -1
- package/node_modules/@waterplane/shared/dist/intent.js +1 -1
- package/node_modules/@waterplane/shared/dist/intent.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/itempaths.d.ts +23 -0
- package/node_modules/@waterplane/shared/dist/itempaths.js +38 -0
- package/node_modules/@waterplane/shared/dist/itempaths.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/pluginlaunch.d.ts +3 -2
- package/node_modules/@waterplane/shared/dist/pluginlaunch.js +1 -1
- package/node_modules/@waterplane/shared/dist/pluginlaunch.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/pricelist.d.ts +57 -0
- package/node_modules/@waterplane/shared/dist/pricelist.js +128 -0
- package/node_modules/@waterplane/shared/dist/pricelist.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/pricing.d.ts +86 -9
- package/node_modules/@waterplane/shared/dist/pricing.js +140 -20
- package/node_modules/@waterplane/shared/dist/pricing.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/queue/queuelanestate.d.ts +14 -0
- package/node_modules/@waterplane/shared/dist/queue/queuelanestate.js +25 -0
- package/node_modules/@waterplane/shared/dist/queue/queuelanestate.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/queue/queueplan.d.ts +4 -0
- package/node_modules/@waterplane/shared/dist/queue/queueplan.js +21 -0
- package/node_modules/@waterplane/shared/dist/queue/queueplan.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/queue/queuewords.js +2 -1
- package/node_modules/@waterplane/shared/dist/queue/queuewords.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/queue.d.ts +2 -0
- package/node_modules/@waterplane/shared/dist/queue.js +1 -0
- package/node_modules/@waterplane/shared/dist/queue.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/repohealth.d.ts +178 -0
- package/node_modules/@waterplane/shared/dist/repohealth.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/repohealthhabits.d.ts +15 -0
- package/node_modules/@waterplane/shared/dist/repohealthhabits.js +117 -0
- package/node_modules/@waterplane/shared/dist/repohealthhabits.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/repohealthnative.d.ts +10 -0
- package/node_modules/@waterplane/shared/dist/repohealthnative.js +94 -0
- package/node_modules/@waterplane/shared/dist/repohealthnative.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/repohealthread.js +23 -1
- package/node_modules/@waterplane/shared/dist/repohealthread.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/skillstate.d.ts +51 -0
- package/node_modules/@waterplane/shared/dist/skillstate.js +176 -0
- package/node_modules/@waterplane/shared/dist/skillstate.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/skillwords.d.ts +10 -0
- package/node_modules/@waterplane/shared/dist/skillwords.js +18 -0
- package/node_modules/@waterplane/shared/dist/skillwords.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/wire/agentreadings.d.ts +248 -0
- package/node_modules/@waterplane/shared/dist/wire/agentreadings.js +36 -0
- package/node_modules/@waterplane/shared/dist/wire/agentreadings.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/wire/backend.d.ts +2 -0
- package/node_modules/@waterplane/shared/dist/wire/costwindow.d.ts +4 -0
- package/node_modules/@waterplane/shared/dist/wire/dictatesetup.d.ts +42 -0
- package/node_modules/@waterplane/shared/dist/wire/dictatesetup.js +9 -0
- package/node_modules/@waterplane/shared/dist/wire/dictatesetup.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/wire/messages/hostcore.d.ts +22 -1
- package/node_modules/@waterplane/shared/dist/wire/notify.d.ts +6 -1
- package/node_modules/@waterplane/shared/dist/wire/notify.js +6 -1
- package/node_modules/@waterplane/shared/dist/wire/notify.js.map +1 -1
- package/node_modules/@waterplane/shared/dist/wire/repo.d.ts +1 -1
- package/node_modules/@waterplane/shared/dist/wire/skills.d.ts +142 -0
- package/node_modules/@waterplane/shared/dist/wire/skills.js +6 -0
- package/node_modules/@waterplane/shared/dist/wire/skills.js.map +1 -0
- package/node_modules/@waterplane/shared/dist/wire/sysstat.d.ts +17 -0
- package/node_modules/@waterplane/shared/dist/wire/telemetry.d.ts +4 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/packages/extensions/diskspace/waterplane-plugin.json +16 -0
- package/packages/extensions/links/waterplane-plugin.json +18 -0
- package/packages/host/dist/agentclass.d.ts +116 -0
- package/packages/host/dist/agentclass.js +339 -0
- package/packages/host/dist/agentclass.js.map +1 -0
- package/packages/host/dist/agentintents.d.ts +18 -0
- package/packages/host/dist/agentintents.js +40 -7
- package/packages/host/dist/agentintents.js.map +1 -1
- package/packages/host/dist/agentmarkers.d.ts +49 -0
- package/packages/host/dist/agentmarkers.js +255 -0
- package/packages/host/dist/agentmarkers.js.map +1 -0
- package/packages/host/dist/agentreadings.d.ts +68 -0
- package/packages/host/dist/agentreadings.js +336 -0
- package/packages/host/dist/agentreadings.js.map +1 -0
- package/packages/host/dist/agentscan.d.ts +8 -0
- package/packages/host/dist/agentscan.js +427 -0
- package/packages/host/dist/agentscan.js.map +1 -0
- package/packages/host/dist/archive.js +9 -3
- package/packages/host/dist/archive.js.map +1 -1
- package/packages/host/dist/artifacts.js +4 -7
- package/packages/host/dist/artifacts.js.map +1 -1
- package/packages/host/dist/askrules.js +12 -4
- package/packages/host/dist/askrules.js.map +1 -1
- package/packages/host/dist/auth.d.ts +1 -0
- package/packages/host/dist/auth.js +5 -3
- package/packages/host/dist/auth.js.map +1 -1
- package/packages/host/dist/autopull.js +4 -8
- package/packages/host/dist/autopull.js.map +1 -1
- package/packages/host/dist/backends/claude.js +1 -0
- package/packages/host/dist/backends/claude.js.map +1 -1
- package/packages/host/dist/backends/derive.js +3 -1
- package/packages/host/dist/backends/derive.js.map +1 -1
- package/packages/host/dist/binguard.js +19 -2
- package/packages/host/dist/binguard.js.map +1 -1
- package/packages/host/dist/capture.js +7 -10
- package/packages/host/dist/capture.js.map +1 -1
- package/packages/host/dist/clifixtures.d.ts +24 -4
- package/packages/host/dist/clifixtures.js +50 -10
- package/packages/host/dist/clifixtures.js.map +1 -1
- package/packages/host/dist/clihealth.d.ts +8 -2
- package/packages/host/dist/clihealth.js +11 -3
- package/packages/host/dist/clihealth.js.map +1 -1
- package/packages/host/dist/costwindow.js +4 -2
- package/packages/host/dist/costwindow.js.map +1 -1
- package/packages/host/dist/ctxlog/ctxagents.d.ts +2 -0
- package/packages/host/dist/ctxlog/ctxagents.js +5 -5
- package/packages/host/dist/ctxlog/ctxagents.js.map +1 -1
- package/packages/host/dist/ctxlog/ctxcursor.d.ts +2 -0
- package/packages/host/dist/ctxlog/ctxcursor.js +2 -2
- package/packages/host/dist/ctxlog/ctxcursor.js.map +1 -1
- package/packages/host/dist/ctxlog/ctxupdate.js +11 -6
- package/packages/host/dist/ctxlog/ctxupdate.js.map +1 -1
- package/packages/host/dist/deliver/deliverknobs.d.ts +0 -2
- package/packages/host/dist/deliver/deliverknobs.js +0 -2
- package/packages/host/dist/deliver/deliverknobs.js.map +1 -1
- package/packages/host/dist/deliver/deliverproof.d.ts +3 -2
- package/packages/host/dist/deliver/deliverproof.js +9 -8
- package/packages/host/dist/deliver/deliverproof.js.map +1 -1
- package/packages/host/dist/deliver/deliverreturn.d.ts +3 -2
- package/packages/host/dist/deliver/deliverreturn.js +13 -12
- package/packages/host/dist/deliver/deliverreturn.js.map +1 -1
- package/packages/host/dist/deliver/deliverrun.js +20 -18
- package/packages/host/dist/deliver/deliverrun.js.map +1 -1
- package/packages/host/dist/deliver/deliverscreen.d.ts +2 -1
- package/packages/host/dist/deliver/deliverscreen.js +9 -8
- package/packages/host/dist/deliver/deliverscreen.js.map +1 -1
- package/packages/host/dist/deliver/delivertypes.d.ts +4 -0
- package/packages/host/dist/deliver.js +2 -1
- package/packages/host/dist/deliver.js.map +1 -1
- package/packages/host/dist/dictate.d.ts +11 -0
- package/packages/host/dist/dictate.js +20 -10
- package/packages/host/dist/dictate.js.map +1 -1
- package/packages/host/dist/dictatesetup.d.ts +54 -0
- package/packages/host/dist/dictatesetup.js +261 -0
- package/packages/host/dist/dictatesetup.js.map +1 -0
- package/packages/host/dist/doctor.js +1 -1
- package/packages/host/dist/doctor.js.map +1 -1
- package/packages/host/dist/exposure.d.ts +10 -0
- package/packages/host/dist/exposure.js +25 -0
- package/packages/host/dist/exposure.js.map +1 -1
- package/packages/host/dist/exposurepush.js +2 -2
- package/packages/host/dist/exposurepush.js.map +1 -1
- package/packages/host/dist/extensions/diskspace/host/candidates.d.mts +180 -0
- package/packages/host/dist/extensions/diskspace/host/candidates.mjs +716 -0
- package/packages/host/dist/extensions/diskspace/host/candidates.mjs.map +1 -0
- package/packages/host/dist/extensions/diskspace/host/engine.d.mts +21 -0
- package/packages/host/dist/extensions/diskspace/host/engine.mjs +498 -0
- package/packages/host/dist/extensions/diskspace/host/engine.mjs.map +1 -0
- package/packages/host/dist/extensions/diskspace/host/index.d.mts +25 -0
- package/packages/host/dist/extensions/diskspace/host/index.mjs +135 -0
- package/packages/host/dist/extensions/diskspace/host/index.mjs.map +1 -0
- package/packages/host/dist/extensions/diskspace/host/large.d.mts +11 -0
- package/packages/host/dist/extensions/diskspace/host/large.mjs +56 -0
- package/packages/host/dist/extensions/diskspace/host/large.mjs.map +1 -0
- package/packages/host/dist/extensions/diskspace/host/run.d.mts +94 -0
- package/packages/host/dist/extensions/diskspace/host/run.mjs +200 -0
- package/packages/host/dist/extensions/diskspace/host/run.mjs.map +1 -0
- package/packages/host/dist/extensions/diskspace/shared/wire.d.mts +197 -0
- package/packages/host/dist/extensions/diskspace/shared/wire.mjs +23 -0
- package/packages/host/dist/extensions/diskspace/shared/wire.mjs.map +1 -0
- package/packages/host/dist/extensions/links/host/engine.d.mts +39 -0
- package/packages/host/dist/extensions/links/host/engine.mjs +285 -0
- package/packages/host/dist/extensions/links/host/engine.mjs.map +1 -0
- package/packages/host/dist/extensions/links/host/index.d.mts +10 -0
- package/packages/host/dist/extensions/links/host/index.mjs +72 -0
- package/packages/host/dist/extensions/links/host/index.mjs.map +1 -0
- package/packages/host/dist/extensions/links/host/parse.d.mts +61 -0
- package/packages/host/dist/extensions/links/host/parse.mjs +225 -0
- package/packages/host/dist/extensions/links/host/parse.mjs.map +1 -0
- package/packages/host/dist/extensions/links/host/run.d.mts +15 -0
- package/packages/host/dist/extensions/links/host/run.mjs +32 -0
- package/packages/host/dist/extensions/links/host/run.mjs.map +1 -0
- package/packages/host/dist/extensions/links/host/store.d.mts +11 -0
- package/packages/host/dist/extensions/links/host/store.mjs +76 -0
- package/packages/host/dist/extensions/links/host/store.mjs.map +1 -0
- package/packages/host/dist/extensions/links/shared/wire.d.mts +141 -0
- package/packages/host/dist/extensions/links/shared/wire.mjs +20 -0
- package/packages/host/dist/extensions/links/shared/wire.mjs.map +1 -0
- package/packages/host/dist/git.d.ts +5 -3
- package/packages/host/dist/git.js +16 -28
- package/packages/host/dist/git.js.map +1 -1
- package/packages/host/dist/halt.js +16 -3
- package/packages/host/dist/halt.js.map +1 -1
- package/packages/host/dist/jsonstore.d.ts +16 -4
- package/packages/host/dist/jsonstore.js +32 -8
- package/packages/host/dist/jsonstore.js.map +1 -1
- package/packages/host/dist/landedbase.d.ts +41 -0
- package/packages/host/dist/landedbase.js +59 -0
- package/packages/host/dist/landedbase.js.map +1 -0
- package/packages/host/dist/lantls.js +2 -2
- package/packages/host/dist/lantls.js.map +1 -1
- package/packages/host/dist/limitretry.js +2 -3
- package/packages/host/dist/limitretry.js.map +1 -1
- package/packages/host/dist/localledger.js +9 -12
- package/packages/host/dist/localledger.js.map +1 -1
- package/packages/host/dist/main.js +2 -0
- package/packages/host/dist/main.js.map +1 -1
- package/packages/host/dist/opendeliveries.d.ts +4 -0
- package/packages/host/dist/opendeliveries.js +27 -1
- package/packages/host/dist/opendeliveries.js.map +1 -1
- package/packages/host/dist/plugins/setupcontrib.js +3 -2
- package/packages/host/dist/plugins/setupcontrib.js.map +1 -1
- package/packages/host/dist/pricefetch.d.ts +80 -0
- package/packages/host/dist/pricefetch.js +289 -0
- package/packages/host/dist/pricefetch.js.map +1 -0
- package/packages/host/dist/pricegap.d.ts +11 -0
- package/packages/host/dist/pricegap.js +30 -0
- package/packages/host/dist/pricegap.js.map +1 -0
- package/packages/host/dist/repohealthscopes.js +16 -24
- package/packages/host/dist/repohealthscopes.js.map +1 -1
- package/packages/host/dist/repos.d.ts +4 -0
- package/packages/host/dist/repos.js +1 -1
- package/packages/host/dist/repos.js.map +1 -1
- package/packages/host/dist/reposkilltext.d.ts +2 -0
- package/packages/host/dist/reposkilltext.js +8 -2
- package/packages/host/dist/reposkilltext.js.map +1 -1
- package/packages/host/dist/routes/apiagentpoints.d.ts +5 -0
- package/packages/host/dist/routes/apiagentpoints.js +48 -0
- package/packages/host/dist/routes/apiagentpoints.js.map +1 -0
- package/packages/host/dist/routes/apidictate.d.ts +2 -0
- package/packages/host/dist/routes/apidictate.js +27 -0
- package/packages/host/dist/routes/apidictate.js.map +1 -0
- package/packages/host/dist/routes/apihost.js +3 -2
- package/packages/host/dist/routes/apihost.js.map +1 -1
- package/packages/host/dist/routes/apirepofiles.js +3 -1
- package/packages/host/dist/routes/apirepofiles.js.map +1 -1
- package/packages/host/dist/routes/apirepowork.js +14 -0
- package/packages/host/dist/routes/apirepowork.js.map +1 -1
- package/packages/host/dist/routes/apiroutes.js +4 -1
- package/packages/host/dist/routes/apiroutes.js.map +1 -1
- package/packages/host/dist/routes/apiskills.d.ts +3 -0
- package/packages/host/dist/routes/apiskills.js +81 -0
- package/packages/host/dist/routes/apiskills.js.map +1 -0
- package/packages/host/dist/routes/apistats.js +2 -2
- package/packages/host/dist/routes/apistats.js.map +1 -1
- package/packages/host/dist/routes/apisystem.js +3 -1
- package/packages/host/dist/routes/apisystem.js.map +1 -1
- package/packages/host/dist/routes/apitable.d.ts +2 -0
- package/packages/host/dist/routes/apitable.js.map +1 -1
- package/packages/host/dist/server/billingwire.js +5 -0
- package/packages/host/dist/server/billingwire.js.map +1 -1
- package/packages/host/dist/server/deliveries.d.ts +4 -1
- package/packages/host/dist/server/deliveries.js +38 -6
- package/packages/host/dist/server/deliveries.js.map +1 -1
- package/packages/host/dist/server/http.js +1 -1
- package/packages/host/dist/server/http.js.map +1 -1
- package/packages/host/dist/server/intentDeps.js +20 -6
- package/packages/host/dist/server/intentDeps.js.map +1 -1
- package/packages/host/dist/server/wsops.js +2 -1
- package/packages/host/dist/server/wsops.js.map +1 -1
- package/packages/host/dist/sessions/core.d.ts +1 -0
- package/packages/host/dist/sessions/ctxseries.js +7 -5
- package/packages/host/dist/sessions/ctxseries.js.map +1 -1
- package/packages/host/dist/sessions/drive.d.ts +6 -1
- package/packages/host/dist/sessions/drive.js +13 -10
- package/packages/host/dist/sessions/drive.js.map +1 -1
- package/packages/host/dist/sessions/record.js +16 -17
- package/packages/host/dist/sessions/record.js.map +1 -1
- package/packages/host/dist/sessions/sidechannel.js +1 -1
- package/packages/host/dist/sessions/sidechannel.js.map +1 -1
- package/packages/host/dist/sessions/tmux.js +6 -1
- package/packages/host/dist/sessions/tmux.js.map +1 -1
- package/packages/host/dist/sessions/turn.js +5 -0
- package/packages/host/dist/sessions/turn.js.map +1 -1
- package/packages/host/dist/sessions.d.ts +2 -1
- package/packages/host/dist/sessions.js +1 -1
- package/packages/host/dist/sessions.js.map +1 -1
- package/packages/host/dist/settle.d.ts +3 -2
- package/packages/host/dist/settle.js +13 -13
- package/packages/host/dist/settle.js.map +1 -1
- package/packages/host/dist/sidecar/sidecarname.d.ts +2 -0
- package/packages/host/dist/sidecar/sidecarname.js +5 -1
- package/packages/host/dist/sidecar/sidecarname.js.map +1 -1
- package/packages/host/dist/sidecar/sidecarroute.d.ts +1 -1
- package/packages/host/dist/sidecar/sidecarroute.js +5 -0
- package/packages/host/dist/sidecar/sidecarroute.js.map +1 -1
- package/packages/host/dist/sidecar.d.ts +1 -1
- package/packages/host/dist/sidecar.js +1 -1
- package/packages/host/dist/sidecar.js.map +1 -1
- package/packages/host/dist/skills/skillinventory.d.ts +23 -0
- package/packages/host/dist/skills/skillinventory.js +275 -0
- package/packages/host/dist/skills/skillinventory.js.map +1 -0
- package/packages/host/dist/skills/skilllayers.d.ts +28 -0
- package/packages/host/dist/skills/skilllayers.js +73 -0
- package/packages/host/dist/skills/skilllayers.js.map +1 -0
- package/packages/host/dist/skills/skillrecommend.d.ts +42 -0
- package/packages/host/dist/skills/skillrecommend.js +171 -0
- package/packages/host/dist/skills/skillrecommend.js.map +1 -0
- package/packages/host/dist/skills/skillrefs.d.ts +2 -0
- package/packages/host/dist/skills/skillrefs.js +50 -0
- package/packages/host/dist/skills/skillrefs.js.map +1 -0
- package/packages/host/dist/skills/skilluse.d.ts +57 -0
- package/packages/host/dist/skills/skilluse.js +242 -0
- package/packages/host/dist/skills/skilluse.js.map +1 -0
- package/packages/host/dist/skills/skillweight.d.ts +18 -0
- package/packages/host/dist/skills/skillweight.js +69 -0
- package/packages/host/dist/skills/skillweight.js.map +1 -0
- package/packages/host/dist/skills/skillwrite.d.ts +56 -0
- package/packages/host/dist/skills/skillwrite.js +183 -0
- package/packages/host/dist/skills/skillwrite.js.map +1 -0
- package/packages/host/dist/sysstat.d.ts +34 -1
- package/packages/host/dist/sysstat.js +82 -14
- package/packages/host/dist/sysstat.js.map +1 -1
- package/packages/host/dist/tokenscan.js +5 -2
- package/packages/host/dist/tokenscan.js.map +1 -1
- package/packages/host/dist/tokenstats.js +7 -4
- package/packages/host/dist/tokenstats.js.map +1 -1
- package/packages/host/dist/transcript/transcriptparse.js +2 -2
- package/packages/host/dist/transcript/transcriptparse.js.map +1 -1
- package/packages/host/dist/waitclock.d.ts +12 -0
- package/packages/host/dist/waitclock.js +23 -0
- package/packages/host/dist/waitclock.js.map +1 -0
- package/packages/host/dist/weekburn.js +7 -5
- package/packages/host/dist/weekburn.js.map +1 -1
- package/packages/host/dist/worktreeleftover.js +13 -15
- package/packages/host/dist/worktreeleftover.js.map +1 -1
- package/packages/web/dist/assets/demo-DHkwSmU5.js +26 -0
- package/packages/web/dist/assets/{icons-D8RlmSLR.js → icons-5lVTFNUU.js} +1 -1
- package/packages/web/dist/assets/index-Bh4cH6X8.js +170 -0
- package/packages/web/dist/assets/index-F7VHtsLI.css +1 -0
- package/packages/web/dist/assets/shared-BvQMg9ra.js +51 -0
- package/packages/web/dist/assets/sheets-Cwi72V02.js +257 -0
- package/packages/web/dist/assets/sheets-DjU2XiUd.css +1 -0
- package/packages/web/dist/build-id.txt +1 -1
- package/packages/web/dist/buildstamp.json +1 -1
- package/packages/web/dist/index.html +7 -7
- package/packages/web/dist/sw.js +2 -2
- package/release.json +11 -3
- package/tools/repohealth/constants.mjs +34 -1
- package/tools/repohealth/fixture.json +5374 -38
- package/tools/repohealth/git.mjs +77 -0
- package/tools/repohealth/lang/dart-analyze.mjs +181 -0
- package/tools/repohealth/lang/dart-lex.mjs +494 -0
- package/tools/repohealth/lang/dart-resolve.mjs +95 -0
- package/tools/repohealth/lang/python-ast.mjs +602 -0
- package/tools/repohealth/lang/python-resolve.mjs +228 -0
- package/tools/repohealth/metrics/habits.mjs +286 -0
- package/tools/repohealth/metrics/native.mjs +542 -0
- package/tools/repohealth/metrics/untested.mjs +20 -8
- package/tools/repohealth/metrics/workspace.mjs +256 -0
- package/tools/repohealth/own.mjs +67 -5
- package/tools/repohealth/packs/dart.mjs +153 -85
- package/tools/repohealth/packs/python.mjs +51 -14
- package/tools/repohealth/plot.mjs +143 -1
- package/tools/repohealth/reach.mjs +98 -0
- package/tools/repohealth/scope.mjs +14 -1
- package/tools/repohealth/series.mjs +5 -0
- package/tools/repohealth/types.mjs +4 -0
- package/tools/repohealth.mjs +39 -5
- package/packages/web/dist/assets/demo-ad3g3HDa.js +0 -26
- package/packages/web/dist/assets/index-Csb7jynu.js +0 -170
- package/packages/web/dist/assets/index-Cz9Haocy.css +0 -1
- package/packages/web/dist/assets/shared-DBaaGttP.js +0 -51
- package/packages/web/dist/assets/sheets-CqsP9w1V.js +0 -256
- package/packages/web/dist/assets/sheets-DoUhPGK0.css +0 -1
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Dart tokenizer and a declaration scanner, in plain JS.
|
|
3
|
+
*
|
|
4
|
+
* There is no Dart parser in this tool's reach (the SDK's analyzer is a
|
|
5
|
+
* separate install, and `git.mjs` is the only module allowed to spawn
|
|
6
|
+
* anything), and the three questions asked of Dart code need less than one:
|
|
7
|
+
*
|
|
8
|
+
* - which URIs a file imports, exports or takes as a `part` (directives);
|
|
9
|
+
* - which top-level names a library declares, and which names it uses;
|
|
10
|
+
* - where the function-like bodies are, for the clone detector.
|
|
11
|
+
*
|
|
12
|
+
* All three come off one token stream plus a bracket-matching pass, with no
|
|
13
|
+
* grammar. The scanner reads a *header* (everything up to the first `(`, `{`,
|
|
14
|
+
* `=`, `=>` or `;` at depth 0) and decides what it was from the first tokens,
|
|
15
|
+
* the way a person skimming the file does. Where it cannot tell it says
|
|
16
|
+
* nothing: a declaration it fails to name is a name never listed as an export,
|
|
17
|
+
* which can only ever remove a dead-export line, never add one.
|
|
18
|
+
*
|
|
19
|
+
* ── What the lexer gets right on purpose ────────────────────────────────────
|
|
20
|
+
*
|
|
21
|
+
* - Comments, including nested block comments, are dropped. A `// import 'x'`
|
|
22
|
+
* is not an import, and a name in a comment is not a use.
|
|
23
|
+
* - Strings: single, double, triple, raw (`r'..'`). `$name` and `${expr}` are
|
|
24
|
+
* READ, because they are real uses of the name; the string itself becomes
|
|
25
|
+
* one `str` token with its value kept when it has no interpolation (a
|
|
26
|
+
* directive's URI is such a string).
|
|
27
|
+
* - `>` is never merged with a following `>`: `List<List<int>>` must close
|
|
28
|
+
* two generics. `=>`, `==`, `<=`, `>=`, `!=` stay whole so a header scan
|
|
29
|
+
* does not mistake them for an assignment.
|
|
30
|
+
*
|
|
31
|
+
* `ok` is false when the file ended inside a comment, a string or an
|
|
32
|
+
* unbalanced bracket run the lexer could not recover from: callers treat that
|
|
33
|
+
* as "imports unknown", never as a shorter list (the graph reading would
|
|
34
|
+
* otherwise lose every edge after the spot).
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
const ID_START = /[A-Za-z_$]/;
|
|
38
|
+
const ID_PART = /[A-Za-z0-9_$]/;
|
|
39
|
+
const OP = /^(?:=>|==|!=|<=|>=|&&|\|\||\?\?=?|\?\.|\.\.\.\??|\?\.\.|\.\.|\+\+|--|[-+*\/%&|^~]=|<<=?)/;
|
|
40
|
+
const NUM = /^(?:0[xX][0-9a-fA-F_]+|(?:\d[\d_]*)?\.?\d[\d_]*(?:[eE][-+]?\d+)?)/y;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @typedef {{k: "id" | "str" | "num" | "op", s: string, p: number, e: number, plain?: boolean}} Tok
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {string} text
|
|
48
|
+
* @returns {{toks: Tok[], interp: Set<string>, ok: boolean}}
|
|
49
|
+
*/
|
|
50
|
+
export function lexDart(text) {
|
|
51
|
+
const n = text.length;
|
|
52
|
+
/** @type {Tok[]} */
|
|
53
|
+
const toks = [];
|
|
54
|
+
const interp = new Set();
|
|
55
|
+
let ok = true;
|
|
56
|
+
|
|
57
|
+
/** Lex code from `i`; stop at the `}` that closes an interpolation. Returns the index after it. */
|
|
58
|
+
function code(i, sink, untilClose) {
|
|
59
|
+
let depth = 0;
|
|
60
|
+
while (i < n) {
|
|
61
|
+
const c = text[i];
|
|
62
|
+
if (c === " " || c === "\n" || c === "\t" || c === "\r") {
|
|
63
|
+
i++;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (c === "/" && text[i + 1] === "/") {
|
|
67
|
+
while (i < n && text[i] !== "\n") i++;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (c === "/" && text[i + 1] === "*") {
|
|
71
|
+
let d = 1;
|
|
72
|
+
i += 2;
|
|
73
|
+
while (i < n && d > 0) {
|
|
74
|
+
if (text[i] === "/" && text[i + 1] === "*") {
|
|
75
|
+
d++;
|
|
76
|
+
i += 2;
|
|
77
|
+
} else if (text[i] === "*" && text[i + 1] === "/") {
|
|
78
|
+
d--;
|
|
79
|
+
i += 2;
|
|
80
|
+
} else i++;
|
|
81
|
+
}
|
|
82
|
+
if (d > 0) ok = false;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (c === "#" && text[i + 1] === "!" && i === 0) {
|
|
86
|
+
while (i < n && text[i] !== "\n") i++;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
// string, with an optional raw prefix
|
|
90
|
+
if (c === "'" || c === '"' || ((c === "r" || c === "R") && (text[i + 1] === "'" || text[i + 1] === '"'))) {
|
|
91
|
+
i = string(i, sink);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (ID_START.test(c)) {
|
|
95
|
+
let j = i + 1;
|
|
96
|
+
while (j < n && ID_PART.test(text[j])) j++;
|
|
97
|
+
sink.push({ k: "id", s: text.slice(i, j), p: i, e: j });
|
|
98
|
+
i = j;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (c >= "0" && c <= "9") {
|
|
102
|
+
NUM.lastIndex = i;
|
|
103
|
+
const m = NUM.exec(text);
|
|
104
|
+
const j = m && m[0].length ? i + m[0].length : i + 1;
|
|
105
|
+
sink.push({ k: "num", s: "N", p: i, e: j });
|
|
106
|
+
i = j;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (c === "{") depth++;
|
|
110
|
+
if (c === "}") {
|
|
111
|
+
if (untilClose && depth === 0) return i + 1;
|
|
112
|
+
depth--;
|
|
113
|
+
}
|
|
114
|
+
const m = OP.exec(text.slice(i, i + 4));
|
|
115
|
+
const len = m ? m[0].length : 1;
|
|
116
|
+
sink.push({ k: "op", s: text.slice(i, i + len), p: i, e: i + len });
|
|
117
|
+
i += len;
|
|
118
|
+
}
|
|
119
|
+
if (untilClose) ok = false;
|
|
120
|
+
return i;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Lex one string literal starting at `i`; push one `str` token. Returns the index after it. */
|
|
124
|
+
function string(i, sink) {
|
|
125
|
+
const start = i;
|
|
126
|
+
let raw = false;
|
|
127
|
+
if (text[i] === "r" || text[i] === "R") {
|
|
128
|
+
raw = true;
|
|
129
|
+
i++;
|
|
130
|
+
}
|
|
131
|
+
const q = text[i];
|
|
132
|
+
const triple = text[i + 1] === q && text[i + 2] === q;
|
|
133
|
+
i += triple ? 3 : 1;
|
|
134
|
+
let value = "";
|
|
135
|
+
let plain = true;
|
|
136
|
+
for (;;) {
|
|
137
|
+
if (i >= n) {
|
|
138
|
+
ok = false;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
const c = text[i];
|
|
142
|
+
if (triple ? c === q && text[i + 1] === q && text[i + 2] === q : c === q) {
|
|
143
|
+
i += triple ? 3 : 1;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
if (!triple && c === "\n") {
|
|
147
|
+
// A single-quoted string does not span lines: recover at the newline.
|
|
148
|
+
ok = false;
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
if (!raw && c === "\\") {
|
|
152
|
+
value += text[i + 1] ?? "";
|
|
153
|
+
i += 2;
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (!raw && c === "$") {
|
|
157
|
+
if (text[i + 1] === "{") {
|
|
158
|
+
plain = false;
|
|
159
|
+
// Its tokens are discarded, its identifiers are real uses.
|
|
160
|
+
const tmp = [];
|
|
161
|
+
i = code(i + 2, tmp, true);
|
|
162
|
+
for (const x of tmp) if (x.k === "id") interp.add(x.s);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (ID_START.test(text[i + 1] ?? "")) {
|
|
166
|
+
plain = false;
|
|
167
|
+
let j = i + 2;
|
|
168
|
+
while (j < n && ID_PART.test(text[j])) j++;
|
|
169
|
+
interp.add(text.slice(i + 1, j));
|
|
170
|
+
i = j;
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
value += c;
|
|
175
|
+
i++;
|
|
176
|
+
}
|
|
177
|
+
sink.push({ k: "str", s: plain ? value : "S", p: start, e: i, plain });
|
|
178
|
+
return i;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
code(0, toks, false);
|
|
182
|
+
return { toks, interp, ok };
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ── brackets ────────────────────────────────────────────────────────────────
|
|
186
|
+
|
|
187
|
+
const OPEN = { "(": ")", "[": "]", "{": "}" };
|
|
188
|
+
|
|
189
|
+
/** `match[i]` is the index of the bracket that closes `toks[i]`, or -1. */
|
|
190
|
+
export function matchBrackets(toks) {
|
|
191
|
+
const match = new Int32Array(toks.length).fill(-1);
|
|
192
|
+
const stack = [];
|
|
193
|
+
for (let i = 0; i < toks.length; i++) {
|
|
194
|
+
const t = toks[i];
|
|
195
|
+
if (t.k !== "op") continue;
|
|
196
|
+
if (OPEN[t.s]) stack.push(i);
|
|
197
|
+
else if (t.s === ")" || t.s === "]" || t.s === "}") {
|
|
198
|
+
// Pop to the nearest opener of the same family; stray closers are ignored.
|
|
199
|
+
for (let j = stack.length - 1; j >= 0; j--) {
|
|
200
|
+
if (OPEN[toks[stack[j]].s] === t.s) {
|
|
201
|
+
match[stack[j]] = i;
|
|
202
|
+
stack.length = j;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return match;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// ── the declaration scanner ─────────────────────────────────────────────────
|
|
212
|
+
|
|
213
|
+
const CLASS_LIKE = new Set(["class", "mixin", "enum", "extension", "typedef"]);
|
|
214
|
+
const MODIFIERS = new Set([
|
|
215
|
+
"abstract", "base", "final", "interface", "sealed", "static", "external", "const", "late", "var", "covariant", "factory", "augment",
|
|
216
|
+
]);
|
|
217
|
+
|
|
218
|
+
const isOp = (t, s) => t !== undefined && t.k === "op" && t.s === s;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Skip an annotation at `i` (`@name`, `@a.b(args)`), return the index after it
|
|
222
|
+
* and its leading name.
|
|
223
|
+
*/
|
|
224
|
+
function annotation(toks, match, i) {
|
|
225
|
+
let j = i + 1;
|
|
226
|
+
let name = "";
|
|
227
|
+
while (j < toks.length && toks[j].k === "id") {
|
|
228
|
+
name += (name ? "." : "") + toks[j].s;
|
|
229
|
+
j++;
|
|
230
|
+
if (isOp(toks[j], ".")) j++;
|
|
231
|
+
else break;
|
|
232
|
+
}
|
|
233
|
+
if (isOp(toks[j], "(") && match[j] > 0) j = match[j] + 1;
|
|
234
|
+
return { next: j, name };
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Find the end of a function-like or variable declaration whose header ended
|
|
239
|
+
* at `t` (the terminator index). Returns `{end, name}` with `end` the index of
|
|
240
|
+
* the last token, or null when the shape is not recognised.
|
|
241
|
+
*/
|
|
242
|
+
function afterHeader(toks, match, hs, t) {
|
|
243
|
+
const term = toks[t];
|
|
244
|
+
const prevId = (from) => {
|
|
245
|
+
let k = from - 1;
|
|
246
|
+
// `foo<T>(` : step back over the type arguments.
|
|
247
|
+
if (isOp(toks[k], ">")) {
|
|
248
|
+
let d = 0;
|
|
249
|
+
for (; k >= hs; k--) {
|
|
250
|
+
if (isOp(toks[k], ">")) d++;
|
|
251
|
+
else if (isOp(toks[k], "<") && --d === 0) {
|
|
252
|
+
k--;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return k >= hs && toks[k].k === "id" ? toks[k].s : null;
|
|
258
|
+
};
|
|
259
|
+
if (term.s === "(") {
|
|
260
|
+
const name = prevId(t);
|
|
261
|
+
let j = match[t];
|
|
262
|
+
if (j < 0) return null;
|
|
263
|
+
j++;
|
|
264
|
+
// Initializer list, `async`, `sync*`: walk to the body or the `;`.
|
|
265
|
+
while (j < toks.length) {
|
|
266
|
+
const x = toks[j];
|
|
267
|
+
if (x.k === "op" && (x.s === "{" || x.s === "=>" || x.s === ";")) break;
|
|
268
|
+
if (x.k === "op" && (x.s === "(" || x.s === "[") && match[j] > 0) j = match[j];
|
|
269
|
+
j++;
|
|
270
|
+
}
|
|
271
|
+
return bodyEnd(toks, match, j, name);
|
|
272
|
+
}
|
|
273
|
+
if (term.s === "{" || term.s === "=>") return bodyEnd(toks, match, t, prevId(t));
|
|
274
|
+
// `=` or `;`: a variable.
|
|
275
|
+
const name = prevId(t);
|
|
276
|
+
if (term.s === ";") return { end: t, name, names: name ? [name] : [], variable: true };
|
|
277
|
+
const names = name ? [name] : [];
|
|
278
|
+
let j = t + 1;
|
|
279
|
+
while (j < toks.length) {
|
|
280
|
+
const x = toks[j];
|
|
281
|
+
if (x.k === "op" && x.s === ";") break;
|
|
282
|
+
if (x.k === "op" && (x.s === "(" || x.s === "[" || x.s === "{") && match[j] > 0) {
|
|
283
|
+
j = match[j] + 1;
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
if (x.k === "op" && x.s === "," && toks[j + 1]?.k === "id" && toks[j + 2]?.k === "op" && (toks[j + 2].s === "=" || toks[j + 2].s === "," || toks[j + 2].s === ";")) {
|
|
287
|
+
names.push(toks[j + 1].s);
|
|
288
|
+
}
|
|
289
|
+
j++;
|
|
290
|
+
}
|
|
291
|
+
return { end: Math.min(j, toks.length - 1), name, names, variable: true, init: true };
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function bodyEnd(toks, match, j, name) {
|
|
295
|
+
const x = toks[j];
|
|
296
|
+
if (!x) return null;
|
|
297
|
+
if (x.s === ";") return { end: j, name, body: false };
|
|
298
|
+
if (x.s === "{") return match[j] > 0 ? { end: match[j], name, body: true } : null;
|
|
299
|
+
if (x.s === "=>") {
|
|
300
|
+
let k = j + 1;
|
|
301
|
+
while (k < toks.length) {
|
|
302
|
+
const y = toks[k];
|
|
303
|
+
if (y.k === "op" && y.s === ";") break;
|
|
304
|
+
if (y.k === "op" && (y.s === "(" || y.s === "[" || y.s === "{") && match[k] > 0) {
|
|
305
|
+
k = match[k] + 1;
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
k++;
|
|
309
|
+
}
|
|
310
|
+
return { end: Math.min(k, toks.length - 1), name, body: true };
|
|
311
|
+
}
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* First terminator of a header from `i`: the index of the first `(` `{` `=`
|
|
317
|
+
* `=>` `;` at depth 0, stepping over `Function(` parameter lists and `[..]`.
|
|
318
|
+
*/
|
|
319
|
+
function headerEnd(toks, match, i, stopAtBrace) {
|
|
320
|
+
for (let j = i; j < toks.length; j++) {
|
|
321
|
+
const t = toks[j];
|
|
322
|
+
if (t.k !== "op") continue;
|
|
323
|
+
if (t.s === "[" && match[j] > 0) {
|
|
324
|
+
j = match[j];
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
if (t.s === "(") {
|
|
328
|
+
if (toks[j - 1]?.k === "id" && toks[j - 1].s === "Function" && match[j] > 0) {
|
|
329
|
+
j = match[j];
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
return j;
|
|
333
|
+
}
|
|
334
|
+
if (t.s === "{" || t.s === "=" || t.s === "=>" || t.s === ";") return j;
|
|
335
|
+
if (stopAtBrace === false && t.s === "}") return -1;
|
|
336
|
+
}
|
|
337
|
+
return -1;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Scan a run of declarations in `toks[from, to)`.
|
|
342
|
+
*
|
|
343
|
+
* @param {Tok[]} toks
|
|
344
|
+
* @param {Int32Array} match
|
|
345
|
+
* @param {number} from
|
|
346
|
+
* @param {number} to
|
|
347
|
+
* @param {boolean} top Top level: directives and class-likes are read.
|
|
348
|
+
* @param {string} scope Enclosing class name, for block names.
|
|
349
|
+
* @param {{directives: object[], decls: object[]}} out
|
|
350
|
+
*/
|
|
351
|
+
function scanRun(toks, match, from, to, top, scope, out) {
|
|
352
|
+
let i = from;
|
|
353
|
+
while (i < to) {
|
|
354
|
+
const t = toks[i];
|
|
355
|
+
if (t.k === "op" && (t.s === ";" || t.s === "}" || t.s === ",")) {
|
|
356
|
+
i++;
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
// metadata
|
|
360
|
+
const notes = [];
|
|
361
|
+
while (i < to && isOp(toks[i], "@")) {
|
|
362
|
+
const a = annotation(toks, match, i);
|
|
363
|
+
notes.push(a.name);
|
|
364
|
+
i = a.next;
|
|
365
|
+
}
|
|
366
|
+
if (i >= to) break;
|
|
367
|
+
const first = toks[i];
|
|
368
|
+
const hs = i;
|
|
369
|
+
|
|
370
|
+
if (top && first.k === "id" && (first.s === "import" || first.s === "export" || first.s === "part" || first.s === "library")) {
|
|
371
|
+
let j = i + 1;
|
|
372
|
+
const uris = [];
|
|
373
|
+
let partOf = false;
|
|
374
|
+
if (first.s === "part" && toks[j]?.k === "id" && toks[j].s === "of") {
|
|
375
|
+
partOf = true;
|
|
376
|
+
j++;
|
|
377
|
+
}
|
|
378
|
+
while (j < to && !isOp(toks[j], ";")) {
|
|
379
|
+
const x = toks[j];
|
|
380
|
+
// A string after `==` is a condition's operand, not an alternative URI.
|
|
381
|
+
if (x.k === "str" && x.plain && !isOp(toks[j - 1], "==")) uris.push(x.s);
|
|
382
|
+
if (isOp(x, "(") && match[j] > 0) {
|
|
383
|
+
// Conditional-import test `if (dart.library.io)`: its own strings are skipped by the `==` rule above.
|
|
384
|
+
j++;
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
j++;
|
|
388
|
+
}
|
|
389
|
+
if (first.s !== "library") out.directives.push({ kind: partOf ? "partof" : first.s, uris, tok: i });
|
|
390
|
+
i = j + 1;
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// class-like?
|
|
395
|
+
let kw = -1;
|
|
396
|
+
for (let j = i; j < Math.min(i + 5, to); j++) {
|
|
397
|
+
const x = toks[j];
|
|
398
|
+
if (x.k !== "id") break;
|
|
399
|
+
if (CLASS_LIKE.has(x.s) && toks[j + 1] && (toks[j + 1].k === "id" || x.s === "extension")) {
|
|
400
|
+
kw = j;
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
if (!MODIFIERS.has(x.s) && x.s !== "mixin" && x.s !== "interface") break;
|
|
404
|
+
}
|
|
405
|
+
if (kw >= 0 && top) {
|
|
406
|
+
const kind = toks[kw].s;
|
|
407
|
+
let nameTok = toks[kw + 1];
|
|
408
|
+
if (kind === "extension") {
|
|
409
|
+
if (nameTok?.k === "id" && nameTok.s === "type") nameTok = toks[kw + 2];
|
|
410
|
+
if (nameTok?.k === "id" && nameTok.s === "on") nameTok = null;
|
|
411
|
+
}
|
|
412
|
+
const name = nameTok?.k === "id" ? nameTok.s : null;
|
|
413
|
+
// Header end: `{` or `;` (or `=` for a mixin application), over parens.
|
|
414
|
+
let j = kw + 1;
|
|
415
|
+
let term = -1;
|
|
416
|
+
for (; j < to; j++) {
|
|
417
|
+
const x = toks[j];
|
|
418
|
+
if (x.k !== "op") continue;
|
|
419
|
+
if ((x.s === "(" || x.s === "[") && match[j] > 0) {
|
|
420
|
+
j = match[j];
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
if (x.s === "{" || x.s === ";" || x.s === "=") {
|
|
424
|
+
term = j;
|
|
425
|
+
break;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
if (term < 0) break;
|
|
429
|
+
let end = term;
|
|
430
|
+
let body = null;
|
|
431
|
+
if (toks[term].s === "{" && match[term] > 0) {
|
|
432
|
+
end = match[term];
|
|
433
|
+
body = [term + 1, end];
|
|
434
|
+
} else if (toks[term].s === "=") {
|
|
435
|
+
while (end < to && !isOp(toks[end], ";")) end++;
|
|
436
|
+
}
|
|
437
|
+
out.decls.push({ kind, name, hs, end, notes, top: true, scope: "" });
|
|
438
|
+
if (body && (kind === "class" || kind === "mixin" || kind === "extension" || kind === "enum")) {
|
|
439
|
+
let bs = body[0];
|
|
440
|
+
if (kind === "enum") {
|
|
441
|
+
// Values come first, then `;`, then members.
|
|
442
|
+
let k = bs;
|
|
443
|
+
while (k < body[1] && !isOp(toks[k], ";")) {
|
|
444
|
+
if ((toks[k].s === "(" || toks[k].s === "{" || toks[k].s === "[") && match[k] > 0) k = match[k];
|
|
445
|
+
k++;
|
|
446
|
+
}
|
|
447
|
+
bs = k + 1;
|
|
448
|
+
}
|
|
449
|
+
if (bs < body[1]) scanRun(toks, match, bs, body[1], false, name ?? "(ext)", out);
|
|
450
|
+
}
|
|
451
|
+
i = end + 1;
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// function / method / variable
|
|
456
|
+
const t0 = headerEnd(toks, match, i, true);
|
|
457
|
+
if (t0 < 0 || t0 >= to) break;
|
|
458
|
+
const r = afterHeader(toks, match, hs, t0);
|
|
459
|
+
if (!r || r.end < i) {
|
|
460
|
+
i++;
|
|
461
|
+
continue;
|
|
462
|
+
}
|
|
463
|
+
const kind = r.variable ? "var" : "fn";
|
|
464
|
+
if (r.name || r.names?.length) {
|
|
465
|
+
const names = r.names?.length ? r.names : [r.name];
|
|
466
|
+
out.decls.push({
|
|
467
|
+
kind,
|
|
468
|
+
name: names[0],
|
|
469
|
+
extra: names.slice(1),
|
|
470
|
+
hs,
|
|
471
|
+
end: r.end,
|
|
472
|
+
notes,
|
|
473
|
+
top,
|
|
474
|
+
scope,
|
|
475
|
+
hasBody: r.body !== false && (r.body === true || r.init === true),
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
i = r.end + 1;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Everything the analyzers and the resolver read off one file, memoised by
|
|
484
|
+
* the caller.
|
|
485
|
+
*
|
|
486
|
+
* @param {string} text
|
|
487
|
+
*/
|
|
488
|
+
export function parseDart(text) {
|
|
489
|
+
const { toks, interp, ok } = lexDart(text);
|
|
490
|
+
const match = matchBrackets(toks);
|
|
491
|
+
const out = { directives: [], decls: [] };
|
|
492
|
+
if (ok) scanRun(toks, match, 0, toks.length, true, "", out);
|
|
493
|
+
return { toks, interp, ok, directives: out.directives, decls: out.decls };
|
|
494
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dart directives -> tree paths: the import graph's half of the Dart pack.
|
|
3
|
+
*
|
|
4
|
+
* A directive's URI is one of
|
|
5
|
+
* - `dart:core`, `dart:io` ... the SDK: external, no edge;
|
|
6
|
+
* - `package:NAME/p/x.dart` this project's own code when NAME is a
|
|
7
|
+
* `pubspec.yaml` `name:` found in the
|
|
8
|
+
* tree, mapped to `<that dir>/lib/p/x.dart`;
|
|
9
|
+
* any other NAME is a dependency: external;
|
|
10
|
+
* - `../a/x.dart`, `x.dart` relative to the importing file;
|
|
11
|
+
* - any other scheme (`file:`, `http:`) not code of this tree.
|
|
12
|
+
*
|
|
13
|
+
* `import`, `export` and `part` are all edges. `part of` is not: a part is the
|
|
14
|
+
* same library as the file that lists it, and an edge back would draw a cycle
|
|
15
|
+
* of length two out of every `part`/`part of` pair. The library lists its
|
|
16
|
+
* parts, so the library reaches them; a part's own directives are none (Dart
|
|
17
|
+
* forbids them), so the imports its code needs are attributed to the library.
|
|
18
|
+
*
|
|
19
|
+
* A URI ending in a generated suffix (`.g.dart`, `.freezed.dart` ...) names a
|
|
20
|
+
* file the pack excludes from the tree, so it is not an edge and not a miss.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/** Suffixes of generated Dart; the pack's `excludeSuffixes` reads this list. */
|
|
24
|
+
export const GENERATED_SUFFIXES = Object.freeze([".g.dart", ".freezed.dart", ".mocks.dart", ".gr.dart"]);
|
|
25
|
+
|
|
26
|
+
/** The pubspec `name:` of one file, or null. Top-level key only (column 0). */
|
|
27
|
+
export function pubspecName(text) {
|
|
28
|
+
const m = /^name:[ \t]*['"]?([A-Za-z0-9_]+)['"]?[ \t]*(?:#.*)?$/m.exec(text);
|
|
29
|
+
return m ? m[1] : null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The resolver's data for one tree: package name -> its directory ("" = root).
|
|
34
|
+
* @param {{path: string}[]} entries every `pubspec.yaml` of the tree
|
|
35
|
+
* @param {(e: object) => string} textOf
|
|
36
|
+
* @returns {{packages: Map<string, string>}}
|
|
37
|
+
*/
|
|
38
|
+
export function buildContext(entries, textOf) {
|
|
39
|
+
const packages = new Map();
|
|
40
|
+
for (const e of [...entries].sort((a, b) => (a.path < b.path ? -1 : 1))) {
|
|
41
|
+
const name = pubspecName(textOf(e));
|
|
42
|
+
if (!name || packages.has(name)) continue;
|
|
43
|
+
const slash = e.path.lastIndexOf("/");
|
|
44
|
+
packages.set(name, slash === -1 ? "" : e.path.slice(0, slash));
|
|
45
|
+
}
|
|
46
|
+
return { packages };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** `a/b/../c` -> `a/c`; climbing above the root clamps. */
|
|
50
|
+
function normalize(parts) {
|
|
51
|
+
const out = [];
|
|
52
|
+
for (const p of parts) {
|
|
53
|
+
if (p === "" || p === ".") continue;
|
|
54
|
+
if (p === "..") out.pop();
|
|
55
|
+
else out.push(p);
|
|
56
|
+
}
|
|
57
|
+
return out.join("/");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The tree path a URI names, or null when it names no code of this tree.
|
|
62
|
+
* @param {string} uri
|
|
63
|
+
* @param {string} from repo-relative path of the file that wrote it
|
|
64
|
+
* @param {{packages: Map<string, string>} | null} ctx
|
|
65
|
+
*/
|
|
66
|
+
export function resolveUri(uri, from, ctx) {
|
|
67
|
+
if (GENERATED_SUFFIXES.some((s) => uri.endsWith(s))) return null;
|
|
68
|
+
const pkg = /^package:([^/]+)\/(.+)$/.exec(uri);
|
|
69
|
+
if (pkg) {
|
|
70
|
+
const dir = ctx?.packages.get(pkg[1]);
|
|
71
|
+
if (dir === undefined) return null;
|
|
72
|
+
return normalize([...dir.split("/"), "lib", ...pkg[2].split("/")]);
|
|
73
|
+
}
|
|
74
|
+
if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(uri)) return null;
|
|
75
|
+
const dir = from.split("/");
|
|
76
|
+
dir.pop();
|
|
77
|
+
return normalize([...dir, ...uri.split("/")]);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Every path a file's import/export/part directives name, in order, deduplicated. */
|
|
81
|
+
export function targetsOf(directives, from, ctx) {
|
|
82
|
+
const out = [];
|
|
83
|
+
const seen = new Set();
|
|
84
|
+
for (const d of directives) {
|
|
85
|
+
if (d.kind === "partof") continue;
|
|
86
|
+
for (const uri of d.uris) {
|
|
87
|
+
const p = resolveUri(uri, from, ctx);
|
|
88
|
+
if (p && !seen.has(p)) {
|
|
89
|
+
seen.add(p);
|
|
90
|
+
out.push({ spec: uri, path: p });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|