Skip to content

glaze:inspect: accept a module inside an installed package, as tasty:styles --setup does #117

Closed

Description

@tenphi

In short

  • glaze:inspect reads its <theme> argument only as a file path from the current folder.
  • tasty:styles --setup also takes a module inside an installed package, such as @acme/ui/harness/theme.mjs. glaze:inspect cannot, so a library that ships its users' theme must give them a node_modules/... path that depends on the install layout.
  • Seen on 3.1.0 (harness/dev.harnesspm/scripts/inspect.mjs, load()).

Where we met it

@tenphi/cookbook ships harness/dev.harnesspm/theme.mjs. It loads a site's docs.config.ts and exports the site's palette as one Glaze theme, so glaze:inspect shows a Cookbook site's colors. Its patch of glaze:rules/colors has to tell agents:

npx -y @tenphi/harnesspm run glaze:inspect node_modules/@tenphi/cookbook/harness/dev.harnesspm/theme.mjs

That path is wrong in a monorepo that installs packages at the root, and in any layout where the package is not in ./node_modules. The Tasty patch can use --setup @tenphi/cookbook/harness/dev.harnesspm/theme.mjs from any folder.

Proposal

When the argument is not an existing file, resolve it as a package path, as tasty:styles does in resolveSetup(): createRequire(<cwd>/noop.js).resolve(spec), then a walk up the node_modules folders for a file the package's exports do not list. Keep #exportName working after a package path.

Also

The theme header prints the seed unrounded, for example theme (hue 186.39135859888918, saturation 93.43600947902323), when a theme's hue comes from a resolved color. Rounding to one decimal would read better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions