@voltro/cli 0.33.0 → 0.34.0
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 +1801 -0
- package/bin/nodeEnvironment.d.mts +30 -0
- package/bin/nodeEnvironment.mjs +158 -0
- package/bin/voltro.mjs +69 -5
- package/dist/addCommand-BNeoeSxe.js +124 -0
- package/dist/addCommand-aXSQveak.js +2 -0
- package/dist/agentsMd-BTchIZku.js +2 -0
- package/dist/agentsMd-mhQMF1bx.js +254 -0
- package/dist/apiBuild-BICVGnEC.js +2 -0
- package/dist/{apiBuild-h9VHtnlw.js → apiBuild-DZF_f0_I.js} +46 -46
- package/dist/appPort-B_HpJ_ck.js +48 -0
- package/dist/baselineCommand-C2ClWZN3.js +2 -0
- package/dist/baselineCommand-DIttzO8A.js +227 -0
- package/dist/bin.js +71 -28
- package/dist/build-CE7Ca9gm.js +711 -0
- package/dist/cacheCommand-DA4OH9xt.js +42 -0
- package/dist/capabilitiesCommand-nq_pz5xd.js +123 -0
- package/dist/checkCommand-Dv8r9tGO.js +231 -0
- package/dist/checkCommand-YZDmkAGd.js +2 -0
- package/dist/{cliArgs-qdZSElM3.js → cliArgs-D4p8n7EE.js} +12 -1
- package/dist/cliError-BmdYnghb.js +10 -0
- package/dist/cliOutput-D1tSBoRM.js +15 -0
- package/dist/{cliRuntime-Oh517vCV.js → cliRuntime-Dh7UDinH.js} +20 -20
- package/dist/cloudClient-DWL-Hw_T.js +67 -0
- package/dist/cloudCmd-Cvv5HGaZ.js +364 -0
- package/dist/clusterCmd-CNXKlcvD.js +54 -0
- package/dist/codegen-CYM3Zqrf.js +605 -0
- package/dist/codegen-ChBi_hVa.js +2 -0
- package/dist/codegenCommand-DC6w2tNZ.js +30 -0
- package/dist/codemodRunner-DRRqXR74.js +5243 -0
- package/dist/commandRunner-BLAEFLjp.js +47 -0
- package/dist/commands-gutsz-Ac.js +808 -0
- package/dist/connectionConfig-UFlIEiys.js +66 -0
- package/dist/dashboardCommand-3YG8p-UA.js +25 -0
- package/dist/dataCommand-qL0r7fPO.js +535 -0
- package/dist/dataProfile-dW-PsfLB.js +15 -0
- package/dist/{dbCommand-DTLKAfbA.js → dbCommand-B6X0FZbq.js} +551 -401
- package/dist/dbCommand-CpdKLeQq.js +2 -0
- package/dist/{dev-C_P8FLSx.js → dev-CerMd0mW.js} +3122 -3129
- package/dist/dev-CoG-ZPx8.js +3 -0
- package/dist/devActivity-Dx_3nnGv.js +100 -0
- package/dist/devActivity.js +1 -1
- package/dist/dialectDriver-CgXnDfec.js +39 -0
- package/dist/discover-C9XKJDco.js +25 -0
- package/dist/doctorCommand-BvqGBwNG.js +2 -0
- package/dist/{checkCommand-xGhRFFg2.js → doctorCommand-CnDXQxfa.js} +520 -1278
- package/dist/dormancyCommand-Dszo57d6.js +69 -0
- package/dist/e2eCmd-BRabZww-.js +147 -0
- package/dist/embeddingsCommand-C0sKVRo1.js +73 -0
- package/dist/envCommand-DPgdV1Bq.js +60 -0
- package/dist/evalCommand-6RUfPen4.js +118 -0
- package/dist/evolveCommand-DHpkgjgH.js +281 -0
- package/dist/fileTaxonomy-CJfgOllU.js +457 -0
- package/dist/frameworkTableAssembly-BGHmck-x.js +2 -0
- package/dist/{frameworkTableAssembly-BwIrO5nv.js → frameworkTableAssembly-DkkP6BgC.js} +184 -148
- package/dist/generateCommand-oibemh97.js +147 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +4 -3
- package/dist/infoCommand-BJw9nLUR.js +60 -0
- package/dist/{inspect-BUUjt773.js → inspect-CBqFtAKA.js} +82 -40
- package/dist/inspect-C_T_WGvl.js +2 -0
- package/dist/inspectCmd-Bppy-GGw.js +224 -0
- package/dist/inspectFetch-Cm8_wVvp.js +151 -0
- package/dist/inspectMetrics-CfdKLh6t.js +72 -0
- package/dist/loadEnv-D9nEOClM.js +44 -0
- package/dist/logFileSink-C_D2wRN1.js +105 -0
- package/dist/logsCmd-CCca3KRZ.js +260 -0
- package/dist/manifestBuild-ChsKAhmn.js +2 -0
- package/dist/{manifestBuild-BLrVuSlM.js → manifestBuild-sxpwdKY1.js} +1 -1
- package/dist/metaCommands-7MJfZ5cf.js +196 -0
- package/dist/migrate-CBwOt_iV.js +83 -0
- package/dist/mssqlClusterPatch-_4cE_nun.js +44 -0
- package/dist/newCommand-COWOJ1_E.js +156 -0
- package/dist/nodeEnvironment-cGFAj1J8.js +28 -0
- package/dist/packageCommand-Cug_3Ogl.js +271 -0
- package/dist/pageConvention-cEiRxdab.js +5 -0
- package/dist/privacyCommand-C-Df56U_.js +146 -0
- package/dist/projectScaffold-DmzEKHib.js +2 -0
- package/dist/projectScaffold-LMMtaavR.js +814 -0
- package/dist/renderModeScan-D7J1B7Kw.js +105 -0
- package/dist/renderProfile-1OWWAAtx.js +81 -0
- package/dist/runtimeRegistry-DMeKfTHP.js +81 -0
- package/dist/runtimeTrace-CRxalXTs.js +91 -0
- package/dist/scheduleCmd--jksTrf6.js +69 -0
- package/dist/scheduleManifestCmd-D2x0CTTY.js +249 -0
- package/dist/schemaIr-UJybUUZW.js +103 -0
- package/dist/{sdkgen-C81QIkiL.js → sdkgen-CYJscZC7.js} +111 -209
- package/dist/seedRunner-TFHHiToI.js +329 -0
- package/dist/serveCommand-B_isw7q4.js +1647 -0
- package/dist/serveCommand-DOvbgRnQ.js +2 -0
- package/dist/serveEntry.js +5 -5
- package/dist/serverlessCommand-CfJZy6dS.js +482 -0
- package/dist/start-9LiUOfES.js +1087 -0
- package/dist/start-B-9Nsp-S.js +3 -0
- package/dist/startEntry.js +2 -2
- package/dist/staticCommand-Dr2M6tpU.js +304 -0
- package/dist/storageCommand-Co6NfLqN.js +42 -0
- package/dist/templates-De8IR5-c.js +102 -0
- package/dist/test-CI6iDsYc.js +115 -0
- package/dist/tracesCmd-CkEZQrtt.js +232 -0
- package/dist/tsconfigPaths-BWXBWgcl.js +107 -0
- package/dist/tsxLoader-EuXmSJ1K.js +51 -0
- package/dist/typecheckCommand-BlsWiCNq.js +61 -0
- package/dist/updateCommand-Bkptutss.js +585 -0
- package/dist/updateCommand-us1_hdIC.js +2 -0
- package/dist/{inspectMetrics-1xzTKAFx.js → webDev-CBYvPqQr.js} +975 -1559
- package/dist/webDev-Cg-fFiyd2.js +2 -0
- package/dist/webhookDiscovery-CrGAfhIG.js +2 -0
- package/dist/webhookDiscovery-D7VaeMlz.js +51 -0
- package/dist/webhooksCommand-CID96Rga.js +267 -0
- package/dist/workflowsCmd-D1VTmLMY.js +608 -0
- package/package.json +179 -17
- package/templates/AGENTS.core.md +58 -3
- package/templates/AGENTS.md +64 -7
- package/templates/agent-docs/_index.md +6 -4
- package/templates/agent-docs/_manifest.json +22 -5
- package/templates/agent-docs/ai.md +370 -0
- package/templates/agent-docs/authentication.md +265 -31
- package/templates/agent-docs/caching.md +6 -0
- package/templates/agent-docs/cli.md +794 -50
- package/templates/agent-docs/data.md +550 -11
- package/templates/agent-docs/database/migrations.md +174 -25
- package/templates/agent-docs/database/misc.md +156 -40
- package/templates/agent-docs/database/querying.md +19 -1
- package/templates/agent-docs/database/scaling.md +60 -0
- package/templates/agent-docs/database/schema.md +1 -0
- package/templates/agent-docs/database/seedsdialects.md +208 -19
- package/templates/agent-docs/database/transactions.md +68 -0
- package/templates/agent-docs/deployment.md +69 -3
- package/templates/agent-docs/introduction.md +87 -16
- package/templates/agent-docs/local-first-mobile.md +79 -4
- package/templates/agent-docs/multi-tenancy.md +95 -20
- package/templates/agent-docs/observability.md +58 -3
- package/templates/agent-docs/plugins/ai-flows.md +161 -2
- package/templates/agent-docs/plugins/analytics-postgres.md +1 -1
- package/templates/agent-docs/plugins/audit.md +37 -1
- package/templates/agent-docs/plugins/auth-social.md +143 -0
- package/templates/agent-docs/plugins/auth-workos.md +4 -2
- package/templates/agent-docs/plugins/auth.md +131 -6
- package/templates/agent-docs/plugins/billing.md +132 -15
- package/templates/agent-docs/plugins/cdc-out.md +46 -7
- package/templates/agent-docs/plugins/clickhouse.md +1 -1
- package/templates/agent-docs/plugins/duckdb.md +1 -1
- package/templates/agent-docs/plugins/flags.md +132 -0
- package/templates/agent-docs/plugins/governance.md +105 -7
- package/templates/agent-docs/plugins/multitenancy.md +9 -4
- package/templates/agent-docs/plugins/presence.md +13 -2
- package/templates/agent-docs/plugins/ratelimit.md +9 -0
- package/templates/agent-docs/plugins/search.md +157 -6
- package/templates/agent-docs/plugins/sso-saml.md +47 -8
- package/templates/agent-docs/plugins/webhooks.md +105 -0
- package/templates/agent-docs/plugins.md +150 -18
- package/templates/agent-docs/reference.md +60 -3
- package/templates/agent-docs/releases.md +1117 -0
- package/templates/agent-docs/routing.md +43 -25
- package/templates/agent-docs/scheduling.md +10 -0
- package/templates/agent-docs/schema-driven-ui.md +92 -12
- package/templates/agent-docs/security.md +426 -0
- package/templates/agent-docs/templates/apibackends.md +87 -18
- package/templates/agent-docs/templates/appshells.md +32 -14
- package/templates/agent-docs/templates/overview.md +13 -8
- package/templates/agent-docs/testing.md +211 -14
- package/templates/agent-docs/whats-new.md +1700 -104
- package/templates/agent-docs/workflows.md +130 -14
- package/templates/apps/api-ai/actions/summarize.action.ts +11 -0
- package/templates/apps/api-ai/package.json +8 -7
- package/templates/apps/api-auth/actions/me.action.ts +13 -0
- package/templates/apps/api-auth/package.json +9 -8
- package/templates/apps/api-backend/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend/package.json +12 -8
- package/templates/apps/api-backend/queries/notes.query.ts +30 -8
- package/templates/apps/api-backend-deactivation/actions/users.get.action.ts +14 -0
- package/templates/apps/api-backend-deactivation/mutations/users.create.mutation.ts +8 -0
- package/templates/apps/api-backend-deactivation/mutations/users.deactivate.mutation.ts +10 -0
- package/templates/apps/api-backend-deactivation/package.json +8 -7
- package/templates/apps/api-backend-mail/actions/sendWelcome.action.ts +17 -0
- package/templates/apps/api-backend-mail/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend-mail/package.json +9 -8
- package/templates/apps/api-backend-mail/queries/notes.query.ts +30 -8
- package/templates/apps/api-backend-mariadb/.env.example +14 -0
- package/templates/apps/api-backend-mariadb/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend-mariadb/package.json +10 -9
- package/templates/apps/api-backend-mariadb/queries/notes.query.ts +30 -8
- package/templates/apps/api-backend-sqlite/.env.example +14 -0
- package/templates/apps/api-backend-sqlite/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend-sqlite/package.json +9 -8
- package/templates/apps/api-backend-sqlite/queries/notes.query.ts +30 -8
- package/templates/apps/api-backend-storage/actions/uploadAvatar.action.ts +13 -0
- package/templates/apps/api-backend-storage/actions/uploadDocument.action.ts +12 -0
- package/templates/apps/api-backend-storage/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend-storage/package.json +9 -8
- package/templates/apps/api-backend-storage/queries/notes.query.ts +30 -8
- package/templates/apps/api-cms/actions/content.get.action.ts +7 -0
- package/templates/apps/api-cms/actions/content.types.action.ts +6 -0
- package/templates/apps/api-cms/actions/me.action.ts +13 -0
- package/templates/apps/api-cms/app.config.ts +19 -0
- package/templates/apps/api-cms/authz.ts +63 -0
- package/templates/apps/api-cms/mutations/content.publish.mutation.ts +10 -0
- package/templates/apps/api-cms/mutations/content.saveDraft.mutation.ts +10 -0
- package/templates/apps/api-cms/mutations/content.unpublish.mutation.ts +5 -0
- package/templates/apps/api-cms/package.json +11 -10
- package/templates/apps/api-cms/queries/content.list.query.ts +23 -7
- package/templates/apps/api-cms/tests/accessDecisions.test.ts +121 -0
- package/templates/apps/api-cms/tests/content.descriptors.test.ts +8 -4
- package/templates/apps/api-collab/mutations/documents.create.mutation.ts +8 -0
- package/templates/apps/api-collab/mutations/documents.setBody.mutation.ts +13 -0
- package/templates/apps/api-collab/package.json +9 -8
- package/templates/apps/api-collab/queries/documents.query.ts +19 -7
- package/templates/apps/api-data-advanced/package.json +9 -8
- package/templates/apps/api-data-advanced/queries/authors.withBooks.query.ts +12 -0
- package/templates/apps/api-data-advanced/queries/books.search.query.ts +9 -0
- package/templates/apps/api-durable/mutations/orders.approve.mutation.ts +17 -0
- package/templates/apps/api-durable/mutations/orders.place.mutation.ts +9 -0
- package/templates/apps/api-durable/package.json +9 -8
- package/templates/apps/api-feature-flags/actions/notes.export.action.ts +16 -0
- package/templates/apps/api-feature-flags/mutations/notes.create.mutation.ts +12 -0
- package/templates/apps/api-feature-flags/package.json +10 -9
- package/templates/apps/api-governance/README.md +30 -8
- package/templates/apps/api-governance/actions/profiles.get.action.server.ts +17 -1
- package/templates/apps/api-governance/actions/profiles.get.action.ts +29 -4
- package/templates/apps/api-governance/database/schema.ts +16 -4
- package/templates/apps/api-governance/mutations/profiles.create.mutation.ts +12 -0
- package/templates/apps/api-governance/package.json +9 -8
- package/templates/apps/api-kv/actions/sync.pull.action.ts +15 -0
- package/templates/apps/api-kv/actions/sync.reset.action.ts +13 -0
- package/templates/apps/api-kv/actions/sync.status.action.ts +7 -0
- package/templates/apps/api-kv/package.json +9 -8
- package/templates/apps/api-kv/queries/events.list.query.ts +19 -8
- package/templates/apps/api-moderation/mutations/comments.create.mutation.ts +11 -0
- package/templates/apps/api-moderation/mutations/posts.create.mutation.ts +13 -0
- package/templates/apps/api-moderation/package.json +9 -8
- package/templates/apps/api-observability/mutations/notes.create.mutation.ts +8 -0
- package/templates/apps/api-observability/package.json +9 -8
- package/templates/apps/api-observability/queries/notes.list.query.ts +13 -0
- package/templates/apps/api-ratelimit/mutations/notes.create.mutation.ts +14 -0
- package/templates/apps/api-ratelimit/package.json +9 -8
- package/templates/apps/api-rbac/package.json +9 -8
- package/templates/apps/api-rest/package.json +8 -7
- package/templates/apps/api-saas/mutations/projects.create.mutation.ts +13 -0
- package/templates/apps/api-saas/package.json +12 -11
- package/templates/apps/api-saas/queries/projects.list.query.ts +11 -0
- package/templates/apps/api-saas-starter/actions/me.action.ts +13 -0
- package/templates/apps/api-saas-starter/app.config.ts +19 -0
- package/templates/apps/api-saas-starter/authz.ts +75 -0
- package/templates/apps/api-saas-starter/mutations/invites.create.mutation.ts +10 -0
- package/templates/apps/api-saas-starter/mutations/projects.create.mutation.ts +9 -0
- package/templates/apps/api-saas-starter/package.json +15 -11
- package/templates/apps/api-saas-starter/queries/invites.list.query.ts +19 -8
- package/templates/apps/api-saas-starter/queries/projects.list.query.ts +18 -7
- package/templates/apps/api-saas-starter/tests/accessDecisions.test.ts +135 -0
- package/templates/apps/api-search/mutations/articles.create.mutation.ts +14 -0
- package/templates/apps/api-search/package.json +9 -8
- package/templates/apps/api-search/queries/articles.list.query.ts +21 -8
- package/templates/apps/api-status/README.md +10 -3
- package/templates/apps/api-status/app.config.ts +8 -3
- package/templates/apps/api-status/authz.ts +5 -3
- package/templates/apps/api-status/package.json +9 -8
- package/templates/apps/api-status/queries/components.list.query.ts +14 -6
- package/templates/apps/api-status/queries/incidents.live.query.ts +23 -10
- package/templates/apps/api-status/queries/updates.list.query.ts +16 -9
- package/templates/apps/api-status/tests/status.test.ts +9 -1
- package/templates/apps/api-versioning/actions/documents.asOf.action.ts +12 -0
- package/templates/apps/api-versioning/actions/documents.history.action.ts +13 -0
- package/templates/apps/api-versioning/mutations/documents.create.mutation.ts +9 -0
- package/templates/apps/api-versioning/mutations/documents.update.mutation.ts +12 -0
- package/templates/apps/api-versioning/package.json +9 -8
- package/templates/apps/api-webhooks/mutations/orders.fulfill.mutation.ts +16 -0
- package/templates/apps/api-webhooks/package.json +10 -9
- package/templates/apps/api-webhooks/queries/orders.list.query.ts +10 -0
- package/templates/apps/changelog/package.json +8 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +10 -8
- package/templates/apps/frontend-admin/src/lib/admin.ts +20 -9
- package/templates/apps/frontend-admin/src/locales/de.ts +11 -1
- package/templates/apps/frontend-admin/src/locales/en.ts +13 -1
- package/templates/apps/frontend-admin/src/pages/admin/[entity]/page.tsx +65 -22
- package/templates/apps/frontend-admin/src/pages/admin/entity.test.tsx +130 -23
- package/templates/apps/frontend-admin/src/pages/admin/layout.tsx +3 -2
- package/templates/apps/frontend-admin/src/pages/admin/page.test.tsx +19 -2
- package/templates/apps/frontend-admin/src/pages/admin/page.tsx +9 -4
- package/templates/apps/frontend-app/app.config.ts +4 -3
- package/templates/apps/frontend-app/package.json +11 -8
- package/templates/apps/frontend-app/src/lib/api.ts +25 -0
- package/templates/apps/frontend-app/src/pages/page.test.tsx +130 -82
- package/templates/apps/frontend-app/src/pages/page.tsx +14 -18
- package/templates/apps/frontend-auth/package.json +10 -8
- package/templates/apps/frontend-blank/package.json +9 -7
- package/templates/apps/frontend-cms/package.json +11 -9
- package/templates/apps/frontend-collab/package.json +12 -9
- package/templates/apps/frontend-collab/src/pages/page.test.tsx +122 -78
- package/templates/apps/frontend-contact/package.json +9 -7
- package/templates/apps/frontend-dashboard/package.json +9 -7
- package/templates/apps/frontend-docs/package.json +9 -7
- package/templates/apps/frontend-i18n/package.json +8 -6
- package/templates/apps/frontend-landing/package.json +9 -7
- package/templates/apps/frontend-portal/package.json +10 -8
- package/templates/apps/frontend-saas/app.config.ts +10 -6
- package/templates/apps/frontend-saas/package.json +10 -8
- package/templates/apps/frontend-saas/src/lib/api.ts +27 -32
- package/templates/apps/frontend-saas/src/pages/dashboard/billing/page.tsx +7 -8
- package/templates/apps/frontend-saas/src/pages/dashboard/page.test.tsx +27 -3
- package/templates/apps/frontend-saas/src/pages/dashboard/page.tsx +4 -4
- package/templates/apps/frontend-saas/src/pages/dashboard/team/page.tsx +3 -4
- package/templates/apps/frontend-spa/package.json +9 -7
- package/templates/apps/frontend-ssr/package.json +9 -7
- package/templates/apps/frontend-ssr-api/package.json +10 -8
- package/templates/apps/frontend-static-blog/package.json +8 -6
- package/templates/apps/frontend-status/package.json +10 -8
- package/templates/apps/mobile-app/README.md +1 -0
- package/templates/apps/mobile-app/package.json +4 -2
- package/templates/apps/mobile-app/src/app/index.tsx +22 -12
- package/templates/apps/mobile-app/src/app/orders/[id].tsx +1 -1
- package/templates/apps/mobile-app/src/lib/api.ts +34 -0
- package/templates/apps/mobile-app/voltro.mobile.ts +4 -2
- package/templates/baselines/bare/.env.example +14 -0
- package/templates/baselines/bare/baseline.json +4 -4
- package/templates/baselines/compose/.env.example +14 -0
- package/templates/baselines/compose/README.md +1 -1
- package/templates/baselines/compose/baseline.json +5 -5
- package/templates/baselines/compose-mariadb/.env.example +14 -0
- package/templates/baselines/compose-mariadb/README.md +1 -1
- package/templates/baselines/compose-mariadb/baseline.json +5 -5
- package/templates/baselines/helm/.env.example +14 -0
- package/templates/baselines/helm/baseline.json +4 -4
- package/dist/apiBuild-C-x9YacA.js +0 -2
- package/dist/checkCommand-DRovTKza.js +0 -2
- package/dist/commands-CJfepbm4.js +0 -11541
- package/dist/dbCommand-b1gum4td.js +0 -2
- package/dist/dev-iiMtlkfs.js +0 -3
- package/dist/devActivity-BhIu6ncs.js +0 -159
- package/dist/frameworkTableAssembly-D-EebUQX.js +0 -2
- package/dist/inspect-mmBuRXmy.js +0 -2
- package/dist/manifestBuild-Dj8Jjoto.js +0 -2
- package/dist/seedRunner-Bqxgp7HZ.js +0 -230
- package/dist/serveCommand-DdaM4Hup.js +0 -1608
- package/dist/start-C0koT0UO.js +0 -1084
- /package/templates/apps/api-ai/actions/{summarize.action.server.tsx → summarize.action.server.ts} +0 -0
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
import { C as e, E as t, O as n, T as r, d as i, h as a, i as o, l as s, m as c, r as l, u } from "./fileConventions-Cof68_BL.js";
|
|
2
|
+
import { n as d, t as f } from "./tsconfigPaths-BWXBWgcl.js";
|
|
3
|
+
import { dirname as p, join as m, relative as h, resolve as g, sep as _ } from "node:path";
|
|
4
|
+
import { existsSync as v, readFileSync as y, readdirSync as b, statSync as x } from "node:fs";
|
|
5
|
+
import { Node as S, Project as C, SyntaxKind as w } from "ts-morph";
|
|
6
|
+
//#region src/vendoredDirs.ts
|
|
7
|
+
var T = ".voltro-vendored", E = (e, t) => {
|
|
8
|
+
let n = [], r = /* @__PURE__ */ new Set(), i = (e, t) => {
|
|
9
|
+
let i = g(e);
|
|
10
|
+
r.has(i) || !v(i) || (r.add(i), n.push({
|
|
11
|
+
dir: i,
|
|
12
|
+
source: t
|
|
13
|
+
}));
|
|
14
|
+
}, a = m(e, "components.json");
|
|
15
|
+
if (v(a)) try {
|
|
16
|
+
let t = JSON.parse(y(a, "utf8"));
|
|
17
|
+
for (let n of ["ui"]) {
|
|
18
|
+
let r = t.aliases?.[n];
|
|
19
|
+
if (typeof r != "string" || r === "") continue;
|
|
20
|
+
let a = r.replace(/^@\//, "").replace(/^~\//, "");
|
|
21
|
+
for (let t of [m(e, a), m(e, "src", a)]) if (v(t)) {
|
|
22
|
+
i(t, `components.json (aliases.${n})`);
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} catch {}
|
|
27
|
+
for (let e of t) {
|
|
28
|
+
let t = e.slice(0, e.lastIndexOf(_)), n = m(t, T);
|
|
29
|
+
if (!r.has(g(t)) && v(n)) {
|
|
30
|
+
let e = "";
|
|
31
|
+
try {
|
|
32
|
+
e = y(n, "utf8").trim().split("\n")[0] ?? "";
|
|
33
|
+
} catch {}
|
|
34
|
+
i(t, e === "" ? T : `${T}: ${e}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return n;
|
|
38
|
+
}, D = (e, t) => t.some((t) => e === t.dir || e.startsWith(`${t.dir}${_}`)), O = (e, t) => t.map((t) => `${h(e, t.dir) || "."} (${t.source})`), k = [
|
|
39
|
+
{
|
|
40
|
+
id: "component.ui",
|
|
41
|
+
re: o,
|
|
42
|
+
needsTest: !0
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "component",
|
|
46
|
+
re: l,
|
|
47
|
+
needsTest: !0
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "hook",
|
|
51
|
+
re: u,
|
|
52
|
+
needsTest: !0
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "tracking",
|
|
56
|
+
re: t,
|
|
57
|
+
needsTest: !0
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "store",
|
|
61
|
+
re: e,
|
|
62
|
+
needsTest: !0
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "internal",
|
|
66
|
+
re: i,
|
|
67
|
+
needsTest: !0
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: "fixture",
|
|
71
|
+
re: s,
|
|
72
|
+
needsTest: !1
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "types",
|
|
76
|
+
re: n,
|
|
77
|
+
needsTest: !1
|
|
78
|
+
}
|
|
79
|
+
], A = (e) => k.find((t) => t.re.test(e))?.id ?? null, j = (e) => r.test(e), M = /* @__PURE__ */ new Set([
|
|
80
|
+
"useMutation",
|
|
81
|
+
"useAction",
|
|
82
|
+
"useUpload",
|
|
83
|
+
"useUndo",
|
|
84
|
+
"useOutbox",
|
|
85
|
+
"useAgentChat",
|
|
86
|
+
"useAgentStream",
|
|
87
|
+
"useResumableAgentStream",
|
|
88
|
+
"useWorkflow"
|
|
89
|
+
]), N = /* @__PURE__ */ new Set(["defineTracking"]), P = /* @__PURE__ */ new Set([
|
|
90
|
+
"useSubscription",
|
|
91
|
+
"useWindowedSubscription",
|
|
92
|
+
"useRecord",
|
|
93
|
+
"useQuery"
|
|
94
|
+
]), F = /* @__PURE__ */ new Set([
|
|
95
|
+
"node_modules",
|
|
96
|
+
"dist",
|
|
97
|
+
"build",
|
|
98
|
+
".framework",
|
|
99
|
+
".turbo",
|
|
100
|
+
".vite",
|
|
101
|
+
".next",
|
|
102
|
+
".git",
|
|
103
|
+
"coverage",
|
|
104
|
+
".publish"
|
|
105
|
+
]), I = /\.tsx?$/, L = (e, t = [], n = 0) => {
|
|
106
|
+
if (n > 12) return t;
|
|
107
|
+
let r;
|
|
108
|
+
try {
|
|
109
|
+
r = b(e);
|
|
110
|
+
} catch {
|
|
111
|
+
return t;
|
|
112
|
+
}
|
|
113
|
+
for (let i of r) {
|
|
114
|
+
if (F.has(i)) continue;
|
|
115
|
+
let r = m(e, i), a;
|
|
116
|
+
try {
|
|
117
|
+
a = x(r);
|
|
118
|
+
} catch {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
a.isDirectory() ? L(r, t, n + 1) : a.isFile() && I.test(i) && !i.endsWith(".d.ts") && t.push(r);
|
|
122
|
+
}
|
|
123
|
+
return t;
|
|
124
|
+
}, R = /\b(?:FC|FunctionComponent|ComponentType|ForwardRefExoticComponent|MemoExoticComponent)\b/, z = /\b(?:memo|forwardRef|observer|styled)\b/, B = (e) => S.isArrowFunction(e) || S.isFunctionExpression(e) || S.isFunctionDeclaration(e) || S.isClassDeclaration(e) || S.isClassExpression(e), V = (e) => {
|
|
125
|
+
if (B(e)) return !0;
|
|
126
|
+
if (S.isExportAssignment(e) || S.isAsExpression(e) || S.isSatisfiesExpression(e) || S.isParenthesizedExpression(e)) return V(e.getExpression());
|
|
127
|
+
if (S.isVariableDeclaration(e)) {
|
|
128
|
+
let t = e.getTypeNode();
|
|
129
|
+
if (t !== void 0 && R.test(t.getText())) return !0;
|
|
130
|
+
let n = e.getInitializer();
|
|
131
|
+
return n === void 0 || V(n);
|
|
132
|
+
}
|
|
133
|
+
return S.isCallExpression(e) ? z.test(e.getExpression().getText()) ? !0 : e.getArguments().some((e) => B(e) || S.isIdentifier(e)) : S.isTaggedTemplateExpression(e) ? !0 : !(S.isObjectLiteralExpression(e) || S.isArrayLiteralExpression(e) || S.isStringLiteral(e) || S.isNoSubstitutionTemplateLiteral(e) || S.isNumericLiteral(e) || S.isTemplateExpression(e) || S.isNewExpression(e) || S.isPropertyAccessExpression(e) || e.getKind() === w.TrueKeyword || e.getKind() === w.FalseKeyword || e.getKind() === w.NullKeyword);
|
|
134
|
+
}, H = (e) => {
|
|
135
|
+
let t = [], n = [], r = [], i = /* @__PURE__ */ new Set();
|
|
136
|
+
for (let [a, o] of e.getExportedDeclarations()) {
|
|
137
|
+
let e = o[0];
|
|
138
|
+
if (e === void 0 || S.isInterfaceDeclaration(e) || S.isTypeAliasDeclaration(e) || i.has(e)) continue;
|
|
139
|
+
i.add(e);
|
|
140
|
+
let s = a === "default" ? (S.isFunctionDeclaration(e) || S.isClassDeclaration(e) || S.isVariableDeclaration(e) ? e.getName() : void 0) ?? "Default" : a;
|
|
141
|
+
if (/^use[A-Z]/.test(s)) {
|
|
142
|
+
n.push(s);
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (/^[A-Z]/.test(s) && V(e)) {
|
|
146
|
+
t.push(s);
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
r.push(s);
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
components: t,
|
|
153
|
+
hooks: n,
|
|
154
|
+
others: r,
|
|
155
|
+
hasRuntimeExport: t.length + n.length + r.length > 0
|
|
156
|
+
};
|
|
157
|
+
}, U = [], W = (e, t, n) => {
|
|
158
|
+
let r = p(e), i = [];
|
|
159
|
+
for (let e = r;; e = p(e)) {
|
|
160
|
+
let r = n.get(e);
|
|
161
|
+
if (r !== void 0) {
|
|
162
|
+
for (let e of i) n.set(e, r);
|
|
163
|
+
return r;
|
|
164
|
+
}
|
|
165
|
+
if (i.push(e), v(m(e, "tsconfig.json"))) {
|
|
166
|
+
let t = d(e);
|
|
167
|
+
if (t.length > 0) {
|
|
168
|
+
for (let e of i) n.set(e, t);
|
|
169
|
+
return t;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (e === t || p(e) === e) break;
|
|
173
|
+
}
|
|
174
|
+
for (let e of i) n.set(e, U);
|
|
175
|
+
return U;
|
|
176
|
+
}, G = (e, t, n) => {
|
|
177
|
+
let r = t.startsWith(".") ? g(p(e), t) : f(t, n);
|
|
178
|
+
if (r === void 0) return null;
|
|
179
|
+
for (let e of [
|
|
180
|
+
r,
|
|
181
|
+
`${r}.tsx`,
|
|
182
|
+
`${r}.ts`,
|
|
183
|
+
m(r, "index.tsx"),
|
|
184
|
+
m(r, "index.ts")
|
|
185
|
+
]) try {
|
|
186
|
+
if (x(e).isFile()) return e;
|
|
187
|
+
} catch {}
|
|
188
|
+
return null;
|
|
189
|
+
}, K = (e, t, n) => {
|
|
190
|
+
let r = [], i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), o = (e) => {
|
|
191
|
+
let i = G(t, e, n);
|
|
192
|
+
return i !== null && r.push(i), i;
|
|
193
|
+
};
|
|
194
|
+
for (let t of e.getImportDeclarations()) if (o(t.getModuleSpecifierValue()), !t.isTypeOnly()) for (let e of t.getNamedImports()) e.isTypeOnly() || i.add(e.getName());
|
|
195
|
+
for (let t of e.getExportDeclarations()) {
|
|
196
|
+
let e = t.getModuleSpecifierValue();
|
|
197
|
+
if (e === void 0) continue;
|
|
198
|
+
let n = o(e);
|
|
199
|
+
if (n === null || t.isTypeOnly()) continue;
|
|
200
|
+
let r = t.getNamedExports();
|
|
201
|
+
if (r.length === 0) {
|
|
202
|
+
a.set(n, "*");
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
let i = r.filter((e) => !e.isTypeOnly()).map((e) => e.getAliasNode()?.getText() ?? e.getName()), s = a.get(n);
|
|
206
|
+
a.set(n, s === "*" ? "*" : [...s ?? [], ...i]);
|
|
207
|
+
}
|
|
208
|
+
for (let t of e.getDescendantsOfKind(w.CallExpression)) {
|
|
209
|
+
if (t.getExpression().getKind() !== w.ImportKeyword) continue;
|
|
210
|
+
let e = t.getArguments()[0];
|
|
211
|
+
e !== void 0 && S.isStringLiteral(e) && o(e.getLiteralValue());
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
localTargets: r,
|
|
215
|
+
namedBindings: i,
|
|
216
|
+
reExports: a
|
|
217
|
+
};
|
|
218
|
+
}, q = (e) => {
|
|
219
|
+
let t = /* @__PURE__ */ new Map();
|
|
220
|
+
for (let n of e.getDescendantsOfKind(w.CallExpression)) {
|
|
221
|
+
let e = n.getExpression(), r = S.isPropertyAccessExpression(e) ? e.getName() : e.getText();
|
|
222
|
+
t.set(r, (t.get(r) ?? 0) + 1);
|
|
223
|
+
}
|
|
224
|
+
return t;
|
|
225
|
+
}, J = (e) => {
|
|
226
|
+
if (e.length <= 1) return e.length === 1;
|
|
227
|
+
let t = [...e].sort((e, t) => e.length - t.length)[0];
|
|
228
|
+
return e.every((e) => e.startsWith(t));
|
|
229
|
+
}, Y = (e, t) => {
|
|
230
|
+
let n = p(t);
|
|
231
|
+
return e.startsWith(`${n}${_}`) || p(e) === n;
|
|
232
|
+
}, X = (e) => {
|
|
233
|
+
let t = L(e);
|
|
234
|
+
if (t.length === 0) return {
|
|
235
|
+
findings: [],
|
|
236
|
+
declared: 0,
|
|
237
|
+
scanned: 0,
|
|
238
|
+
vendored: []
|
|
239
|
+
};
|
|
240
|
+
let n = E(e, t), r = t.filter((e) => !D(e, n));
|
|
241
|
+
if (r.length === 0) return {
|
|
242
|
+
findings: [],
|
|
243
|
+
declared: 0,
|
|
244
|
+
scanned: 0,
|
|
245
|
+
vendored: n
|
|
246
|
+
};
|
|
247
|
+
let i = new C({
|
|
248
|
+
useInMemoryFileSystem: !0,
|
|
249
|
+
skipAddingFilesFromTsConfig: !0
|
|
250
|
+
}), o = [], s = (t) => h(e, t), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
251
|
+
for (let t of r) {
|
|
252
|
+
let n;
|
|
253
|
+
try {
|
|
254
|
+
n = y(t, "utf8");
|
|
255
|
+
} catch {
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
let r;
|
|
259
|
+
try {
|
|
260
|
+
r = i.createSourceFile(t.endsWith("x") ? "/scan.tsx" : "/scan.ts", n, { overwrite: !0 });
|
|
261
|
+
} catch {
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
l.set(t, H(r)), u.set(t, K(r, t, W(t, e, f))), d.set(t, q(r));
|
|
265
|
+
}
|
|
266
|
+
let p = /* @__PURE__ */ new Map();
|
|
267
|
+
for (let [e, t] of u) for (let n of t.localTargets) {
|
|
268
|
+
let t = p.get(n) ?? [];
|
|
269
|
+
t.push(e), p.set(n, t);
|
|
270
|
+
}
|
|
271
|
+
let m = (e) => {
|
|
272
|
+
let t = l.get(e), n = /* @__PURE__ */ new Set([
|
|
273
|
+
...t?.components ?? [],
|
|
274
|
+
...t?.hooks ?? [],
|
|
275
|
+
...t?.others ?? []
|
|
276
|
+
]), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set([e]), a = (e, t) => {
|
|
277
|
+
for (let o of p.get(e) ?? []) {
|
|
278
|
+
if (i.has(o)) continue;
|
|
279
|
+
let s = u.get(o);
|
|
280
|
+
if (s === void 0) continue;
|
|
281
|
+
let c = s.reExports.get(e);
|
|
282
|
+
if (c !== void 0) {
|
|
283
|
+
i.add(o), r.add(o);
|
|
284
|
+
let e = c === "*" ? t ?? n : new Set(c), s = t === null ? e : new Set([...e].filter((e) => t.has(e)));
|
|
285
|
+
s.size > 0 && a(o, s);
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
(t === null || [...s.namedBindings].some((e) => t.has(e))) && r.add(o);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
return a(e, null), [...r];
|
|
292
|
+
}, g = 0;
|
|
293
|
+
for (let e of r) {
|
|
294
|
+
let t = A(e), n = l.get(e), r = u.get(e);
|
|
295
|
+
if (n === void 0 || r === void 0) continue;
|
|
296
|
+
let i = j(e);
|
|
297
|
+
t !== null && !i && (g += 1);
|
|
298
|
+
let f = p.get(e) ?? [];
|
|
299
|
+
if ((t === "component" || t === "component.ui") && !i) {
|
|
300
|
+
let t = J(n.components);
|
|
301
|
+
(n.components.length === 0 || !t) && o.push({
|
|
302
|
+
rule: "component/one-per-file",
|
|
303
|
+
file: s(e),
|
|
304
|
+
severity: "error",
|
|
305
|
+
detail: n.components.length === 0 ? "declares a component file but exports no component" : `exports ${n.components.length} unrelated components: ${n.components.join(", ")}`,
|
|
306
|
+
fix: "a component file exports ONE component — or one NAMESPACED family sharing its name (`Card`, `CardHeader`, `CardTitle`), which is one component with parts. Types alongside are fine. Unrelated components belong in their own files"
|
|
307
|
+
}), n.hooks.length > 0 && o.push({
|
|
308
|
+
rule: "component/no-hook-export",
|
|
309
|
+
file: s(e),
|
|
310
|
+
severity: "error",
|
|
311
|
+
detail: `also exports hook(s): ${n.hooks.join(", ")}`,
|
|
312
|
+
fix: "move the hook into its own *.hook.ts — a file exporting both is two files wearing one name, and neither can be reused without dragging the other"
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
if (t === "hook" && !i && (n.hooks.length !== 1 && o.push({
|
|
316
|
+
rule: "hook/one-per-file",
|
|
317
|
+
file: s(e),
|
|
318
|
+
severity: "error",
|
|
319
|
+
detail: n.hooks.length === 0 ? "declares a hook file but exports no use* hook" : `exports ${n.hooks.length} hooks: ${n.hooks.join(", ")}`,
|
|
320
|
+
fix: "a hook file exports exactly ONE use* hook (types alongside are fine)"
|
|
321
|
+
}), n.components.length > 0 && o.push({
|
|
322
|
+
rule: "hook/no-component-export",
|
|
323
|
+
file: s(e),
|
|
324
|
+
severity: "error",
|
|
325
|
+
detail: `also exports component(s): ${n.components.join(", ")}`,
|
|
326
|
+
fix: "move the component into its own *.component.tsx"
|
|
327
|
+
})), t === "types" && n.hasRuntimeExport && o.push({
|
|
328
|
+
rule: "types/runtime-export",
|
|
329
|
+
file: s(e),
|
|
330
|
+
severity: "error",
|
|
331
|
+
detail: `exports runtime value(s): ${[
|
|
332
|
+
...n.components,
|
|
333
|
+
...n.hooks,
|
|
334
|
+
...n.others
|
|
335
|
+
].join(", ")}`,
|
|
336
|
+
fix: "a *.types.ts has NO runtime export. That is what makes importing it provably free AND makes it impossible for it to sit in a runtime import cycle — the guarantee is the point, so move the value to a sibling module"
|
|
337
|
+
}), t === "internal") {
|
|
338
|
+
let t = f.filter((t) => !Y(t, e));
|
|
339
|
+
t.length > 0 && o.push({
|
|
340
|
+
rule: "internal/foreign-import",
|
|
341
|
+
file: s(e),
|
|
342
|
+
severity: "error",
|
|
343
|
+
detail: `imported from outside its own directory by: ${t.slice(0, 5).map(s).join(", ")}${t.length > 5 ? ` (+${t.length - 5})` : ""}`,
|
|
344
|
+
fix: "export it through the feature's public module, or move the importer inside. `.internal` is the promise that refactoring within this directory breaks nobody — a foreign import revokes it silently, which is how a feature boundary rots without a single review comment"
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
if (t === "fixture") {
|
|
348
|
+
let t = f.filter((e) => !j(e) && A(e) !== "fixture");
|
|
349
|
+
t.length > 0 && o.push({
|
|
350
|
+
rule: "fixture/production-import",
|
|
351
|
+
file: s(e),
|
|
352
|
+
severity: "error",
|
|
353
|
+
detail: `imported by non-test file(s): ${t.slice(0, 5).map(s).join(", ")}`,
|
|
354
|
+
fix: "test material must not be reachable from a production path — it ships in the bundle, and it is written to be convenient rather than correct"
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
if (t === "component.ui" && !i) {
|
|
358
|
+
let t = [...r.namedBindings].filter((e) => M.has(e)).sort();
|
|
359
|
+
t.length > 0 && o.push({
|
|
360
|
+
rule: "ui/no-write",
|
|
361
|
+
file: s(e),
|
|
362
|
+
severity: "error",
|
|
363
|
+
detail: `imports write hook(s): ${t.join(", ")}`,
|
|
364
|
+
fix: "a *.component.ui.tsx renders; it does not write. Lift the mutation into the *.component.tsx that owns it and pass a handler down. Reading (useT / useCan / usePermissions) stays allowed — threading those through props is prop-drilling, not reusability"
|
|
365
|
+
});
|
|
366
|
+
let n = m(e), i = n.filter((e) => {
|
|
367
|
+
let t = A(e);
|
|
368
|
+
return t === "component" || t === "component.ui" || c.test(e) || a.has(e.slice(e.lastIndexOf(_) + 1));
|
|
369
|
+
});
|
|
370
|
+
n.length === 0 ? o.push({
|
|
371
|
+
rule: "ui/orphaned",
|
|
372
|
+
file: s(e),
|
|
373
|
+
severity: "warn",
|
|
374
|
+
detail: "nothing imports it",
|
|
375
|
+
fix: "render it from a *.component.tsx or a page, or delete it — an unrendered presentational component is carried, reviewed and refactored forever without reaching a user"
|
|
376
|
+
}) : i.length === 0 && o.push({
|
|
377
|
+
rule: "ui/unlinked",
|
|
378
|
+
file: s(e),
|
|
379
|
+
severity: "warn",
|
|
380
|
+
detail: `reached only by: ${n.slice(0, 5).map(s).join(", ")}${n.length > 5 ? ` (+${n.length - 5})` : ""} — barrels resolved through`,
|
|
381
|
+
fix: "a presentational component should be reached from a *.component.tsx, another *.component.ui.tsx, or a page"
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
if (t === "store" && !i) {
|
|
385
|
+
let t = d.get(e)?.get("defineStore") ?? 0;
|
|
386
|
+
t !== 1 && o.push({
|
|
387
|
+
rule: "store/one-per-file",
|
|
388
|
+
file: s(e),
|
|
389
|
+
severity: "error",
|
|
390
|
+
detail: t === 0 ? "declares a store file but calls no defineStore()" : `declares ${t} stores`,
|
|
391
|
+
fix: "a store file defines exactly ONE store — the SSR seed pass and devtools address stores by name, so two in a file makes both harder to find and neither easier to reason about"
|
|
392
|
+
});
|
|
393
|
+
let n = [...d.get(e)?.keys() ?? []].filter((e) => P.has(e)).sort();
|
|
394
|
+
n.length > 0 && o.push({
|
|
395
|
+
rule: "store/mirrors-server-state",
|
|
396
|
+
file: s(e),
|
|
397
|
+
severity: "error",
|
|
398
|
+
detail: `reads server state here: ${n.join(", ")}`,
|
|
399
|
+
fix: "a store holds CLIENT state. A subscription is already live server state; copying it into a store gives you a second copy that does not live, and the page then shows the stale one — a bug that reads as \"reactivity is broken\". Read the subscription where you render it"
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
if (t !== "tracking" && !i) {
|
|
403
|
+
let t = [...d.get(e)?.keys() ?? []].filter((e) => N.has(e)).sort();
|
|
404
|
+
t.length > 0 && o.push({
|
|
405
|
+
rule: "tracking/outside-tracking-file",
|
|
406
|
+
file: s(e),
|
|
407
|
+
severity: "error",
|
|
408
|
+
detail: `calls ${t.join(", ")} outside a *.tracking.ts`,
|
|
409
|
+
fix: "move the defineTracking(...) spec into a *.tracking.ts and import it here. The event catalogue — names, property bags, the decisions about what personal data goes out — belongs in one place you can list; calling useTracking with a spec from there is fine"
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
if (k.find((e) => e.id === t)?.needsTest === !0 && !i) {
|
|
413
|
+
let t = e.replace(/\.tsx?$/, ""), n = e.endsWith("x") ? "tsx" : "ts";
|
|
414
|
+
["test", "spec"].flatMap((e) => [`${t}.${e}.ts`, `${t}.${e}.tsx`]).some((e) => {
|
|
415
|
+
try {
|
|
416
|
+
return x(e).isFile();
|
|
417
|
+
} catch {
|
|
418
|
+
return !1;
|
|
419
|
+
}
|
|
420
|
+
}) || o.push({
|
|
421
|
+
rule: "convention/missing-test",
|
|
422
|
+
file: s(e),
|
|
423
|
+
severity: "warn",
|
|
424
|
+
detail: "no test beside it",
|
|
425
|
+
fix: `add ${s(t)}.test.${n} — the name is derivable, so write it with the file. A shallow test earns its place: what it buys is that something MOUNTS the component, and a render loop, a crashing effect or a missing provider is invisible until then. One app wrote 251 of these and the first run found a render loop that made a page take 423 s and exhaust the heap — in a browser it had looked usable`
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return o.sort((e, t) => e.file === t.file ? e.rule.localeCompare(t.rule) : e.file.localeCompare(t.file)), {
|
|
430
|
+
findings: o,
|
|
431
|
+
declared: g,
|
|
432
|
+
scanned: r.length,
|
|
433
|
+
vendored: n
|
|
434
|
+
};
|
|
435
|
+
}, Z = 10, Q = (e) => {
|
|
436
|
+
let { findings: t, declared: n, scanned: r, vendored: i } = X(e);
|
|
437
|
+
console.log("");
|
|
438
|
+
for (let t of O(e, i)) console.log(`· not ours, exempt: ${t}`);
|
|
439
|
+
if (r === 0) return console.log("• file-taxonomy scan: no sources here — nothing to check."), 0;
|
|
440
|
+
if (t.length === 0) return console.log(`✓ file-taxonomy scan: ${n} declared file(s) keep their contract (${r} scanned).`), 0;
|
|
441
|
+
let a = /* @__PURE__ */ new Map();
|
|
442
|
+
for (let e of t) {
|
|
443
|
+
let t = a.get(e.rule) ?? [];
|
|
444
|
+
t.push(e), a.set(e.rule, t);
|
|
445
|
+
}
|
|
446
|
+
let o = t.filter((e) => e.severity === "error").length;
|
|
447
|
+
console.log(`• file taxonomy: ${t.length} finding(s) — ${o} error, ${t.length - o} advisory (${n} declared / ${r} scanned):`);
|
|
448
|
+
for (let [e, t] of [...a].sort()) {
|
|
449
|
+
console.log(` ${t[0].severity === "error" ? "✗" : "·"} ${e} (${t.length})`);
|
|
450
|
+
for (let e of t.slice(0, Z)) console.log(` ${e.file} — ${e.detail}`);
|
|
451
|
+
let n = t.length - Z;
|
|
452
|
+
n > 0 && console.log(` (+${n} more — \`voltro doctor --json\` prints every one.)`), console.log(` → ${t[0].fix}`);
|
|
453
|
+
}
|
|
454
|
+
return t.length;
|
|
455
|
+
};
|
|
456
|
+
//#endregion
|
|
457
|
+
export { D as a, E as i, Q as n, X as r, J as t };
|