npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@modyo/widget-validator

v0.3.1

Published

Validator for Modyo widgets built with Dynamic UI

Readme

@modyo/widget-validator

npm version License: Modyo

Validator for Modyo widgets built with Dynamic UI. Ships both as a CLI and as a programmatic library.

Installation

npm install --save-dev @modyo/widget-validator

Or run it without installing:

npx @modyo/widget-validator ./path/to/my-widget

CLI usage

modyo-widget-validator ./path/to/my-widget

Exit code is 0 when no errors are reported, 1 otherwise. Warnings do not affect the exit code.

Sample output for a widget created from the base template 1.4:

╔══════════════════════════════════════╗
║        Modyo Widget Validator        ║
║                v0.3.0                ║
╚══════════════════════════════════════╝

🔍 Validating widget at: /path/to/my-widget

═══════════════════════════════════════
         VALIDATION REPORT
═══════════════════════════════════════

Widget: /path/to/my-widget
Profile: domain-1.4
Score: 100%
Passed: 114/114

✅ PASSED - Widget meets all requirements

✅ All checks passed!

The Profile: line is printed only when the profile is not type-based (see Profiles).

Profiles

Widgets come in two layouts, and each gets its own rule set. The validator picks it from widget.manifest.json at the widget root:

| widget.manifest.json | Profile | Layout | |---|---|---| | absent | type-based | folders by type: src/components, src/services/{api,repositories,mocks}, src/store, src/hooks, … | | template is @dynamic-framework/[email protected] with x ≥ 4 | domain-1.4 | folders by domain: src/app, src/config, src/features/<name>/{api,model,hooks,service,ui}, src/shared/{http,ui,hooks,lib}, src/pages | | anything else | none | the report fails closed |

A manifest from the base template looks like this:

{
  "name": "my-widget",
  "version": "1.0.0",
  "dynamicUi": "2.12.1",
  "template": "@dynamic-framework/[email protected]",
  "theme": null,
  "design": []
}
  • Versions. template must end in a valid SemVer version. Prereleases are accepted.

  • Later 1.x templates. A template later than 1.4 within major 1 (for example 1.5.0) is still validated with domain-1.4. The report then adds one warning, Template version not verified by this validator release, with the version it read.

  • Failing closed. In these cases no rule runs:

    • the manifest cannot be read or is not a JSON object;
    • template is missing or not package@version;
    • template names another package, another major, or a 1.x version before 1.4.

    The report then holds a single error (category Widget Manifest, rule Profile Selection) that explains why. profile is null, the score is 0, and excludeCategories cannot remove that error.

  • Missing manifest. A widget with src/app/main.tsx and src/features/ but no manifest is validated with type-based, and gets one extra error that names the missing widget.manifest.json. With validateWidget(), the manifest has to be among the files you pass.

Programmatic usage

import { validateWidgetPath } from "@modyo/widget-validator";

const report = await validateWidgetPath("./path/to/my-widget");

console.log(`Profile: ${report.profile}`);
if (!report.passing) {
  for (const issue of report.errors) {
    console.error(`[${issue.category}] ${issue.message}`);
    if (issue.file) console.error(`  → ${issue.file}`);
    if (issue.suggestion) console.error(`  💡 ${issue.suggestion}`);
  }
}

validateWidgetPath(projectPath, options?)

Validates a widget at the given filesystem path. Returns a Promise<ValidationReport>.

validateWidget(files, options?)

Validates a widget represented as an array of VirtualFile. Useful when the widget exists in memory rather than on disk. Include widget.manifest.json among the files, since it selects the profile. See Known limitations.

ValidateOptions

interface ValidateOptions {
  /** Categories to skip (e.g. ["Accessibility"]). */
  excludeCategories?: string[];
}

Score is recalculated after exclusion, so skipped categories don't bias the result.

ValidationReport

type ValidationProfile = "type-based" | "domain-1.4";

interface ValidationReport {
  widgetPath: string;
  profile: ValidationProfile | null; // null: widget.manifest.json rejected (see Profiles)
  score: number;           // 0–100
  passing: boolean;        // true iff errors.length === 0
  totalChecks: number;
  passed: number;
  errors: Issue[];
  warnings: Issue[];
  timestamp: string;       // ISO 8601
  version: string;         // version of @modyo/widget-validator that produced the report
}

interface Issue {
  severity: "error" | "warning";
  category: string;
  rule: string;
  message: string;
  file?: string;           // path relative to widget root, when applicable
  line?: number;
  suggestion?: string;
}

Rules

Rules are grouped by category. A rule may produce several checks: "Required Files", for example, checks each file on its own. Paths are those of the active profile.

Shared by both profiles

| Category | What it checks | |---|---| | Legacy Files | No files from the previous stack (Webpack, Babel, Jest, Redux, old entry points and ESLint configs) remain | | TypeScript | tsconfig.app.json (or tsconfig.json) has strict: true, jsx: react-jsx and a target of ES2020 or later | | Vite Config | vite.config.ts includes the React plugin and Vitest config | | i18n | src/locales/en.json and src/locales/es.json exist and are non-empty | | Testing | A tests/ folder, a setup file and at least one test exist; hooks have tests; tests live in tests/, not in src/ | | UI Patterns | No container-fluid className is used (use container) | | Project Structure | Only README.md lives at the project root (no scattered .md files) | | Accessibility | <DInput> has labels, icon-only <DButton> has text or aria-label, <img> has alt |

type-based

| Category | What it checks | |---|---| | Folder Structure | src/components, src/providers, src/services/{api,repositories,mocks}, src/store, src/types, src/locales, src/config, src/hooks, src/utils and tests exist | | Required Files | Files like package.json, vite.config.ts, src/main.tsx, src/App.tsx and src/store/useUIStore.ts exist | | Naming Conventions | Repositories are PascalCaseRepository.ts, components are PascalCase.tsx, hooks are useX.ts | | Dependencies | Required dependencies (including zustand) are present, forbidden ones absent, peer deps meet minimum versions | | TanStack Query | src/providers/QueryProvider.tsx sets up QueryClient and QueryClientProvider | | Zustand Store | src/store/useUIStore.ts exists and doesn't hold server-fetched data | | Error Handling | src/utils/errorHandler.ts exists and exports; an ErrorBoundary in src/components/ is used in src/App.tsx | | Repository Pattern | At least one repository file with async methods exists in src/services/repositories | | Portal System | DContextProvider is set up in src/main.tsx; modals/offcanvas in src/components/{modals,offcanvas} require availablePortals | | Data States | TSX files using query hooks check isLoading/isPending, isError and empty states | | Widget Manifest | Only for a domain-structure widget without widget.manifest.json: one error that names the cause |

domain-1.4

| Category | What it checks | |---|---| | Widget Manifest | name and version match package.json; @dynamic-framework/ui-react is pinned to an exact version and dynamicUi matches it; theme is null or package@version; design, if present, lists { name, url } with https URLs; a warning when the template is later than 1.4 | | Folder Structure | src/app, src/config, src/shared, src/locales, src/styles and tests exist. src/features and src/pages are optional. | | Required Files | widget.manifest.json, src/app/{main,App}.tsx, src/app/providers/QueryProvider.tsx, src/config/{i18nConfig,widgetConfig}.ts, src/shared/http/client.ts, src/shared/lib/{errorHandler,liquidParser}.ts, the locales and the build config | | Naming Conventions | Components in src/features/*/ui, src/shared/ui and src/pages are PascalCase.tsx; hooks in src/features/*/hooks and src/shared/hooks are useX.ts | | Dependencies | As in type-based, without zustand | | TanStack Query | src/app/providers/QueryProvider.tsx sets up QueryClient and QueryClientProvider | | Error Handling | src/shared/lib/errorHandler.ts exists and exports; src/shared/ui/ErrorBoundary.tsx is used in src/app/App.tsx | | Required Variables | Each requireVariable('vars.my-variable', …) in src/config/widgetConfig.ts reads liquidParser.parse('{{vars.my-variable}}'), the tag of its own name. Skipped when there are no calls. | | Feature API | Each feature with api/ has an API module (not only *.dto.ts or *.mock.ts) with async exports and a *.mock.ts | | Portal System | DContextProvider is set up in src/app/main.tsx; when a feature renders DModal or DOffcanvas, availablePortals must be present (see the limitation below) | | Style Boundaries | src/ does not import Dynamic's CSS (dynamic-ui(.min).css or @dynamic-framework/ui-react/src/style, except the abstracts/+import partial); index.html has a <link rel="stylesheet"> to Dynamic's CSS with an absolute https URL for the pinned version | | Data States | As in type-based, but the loading check only applies to components that destructure data, isLoading or isPending from a hook; DDataStateWrapper counts as handling loading, error and empty states | | Testing | Each hook in src/<path>/useX.ts needs tests/<path>/useX.test.ts(x) (or .spec.) | | Build Output | Only when dist/ exists: a warning if it holds anything besides main.js, main.css and index.html. The validator does not build, so a stale dist/ can trigger it. |

Known limitations

domain-1.4: portal registration

The Portal System rule only checks that availablePortals appears in src/app/main.tsx. It does not check that each modal or offcanvas is actually registered under its portal name. The base template ships availablePortals={{}} together with a reference modal that is not registered on purpose, so availablePortals={{}} passes even when a feature opens an unregistered portal.

validateWidget and empty directories

VirtualFile[] cannot represent empty directories. validateWidget writes the files to a temporary directory and validates that directory, so an empty directory does not exist for the rules.

  • type-based: this profile requires several directories (src/hooks, src/types, …). A widget that leaves one of them empty gets a false "Missing required folder" error. Workaround: include a sentinel file in each empty directory (e.g. <dir>/.gitkeep).
  • domain-1.4: this profile only requires files, and folders that the base template always fills with files, so a widget built from the template does not hit this limitation.

License

See LICENSE.md for the Modyo license.