11ty / 11ty/webc

Different expectations for paths provided to `defineComponents` and `setInputPath`

Open
#92 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

for-discussion
Dominant language
JavaScript
Stars
1.4k
Forks
46
Avg merge
10m
Merged PRs (30d)
2

Description

⚠️Disclaimer: I am a JS Noob

defineComponents passes the glob path directly to fast-glob which expects normalized unixy path
setInputPath accepts windows paths just fine (it normalizes internally)

Both seem to be accepting paths which are relative to the current working directory and not relative to the script file where WebC().functionName() is being invoked. Not sure what the standards are in the JS ecosystem regarding this. I am writing code like the following to get my code to work.

// src/server/page-renderer-webc.js
import * as url from 'url'
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));

let pageInputPath = path.resolve(__dirname, 'page.webc') // = "full/path/to/src/server/page.webc"
let webC = new WebC({file: pageInputPath})

Is this normal?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the defineComponents and setInputPath entry points and comparing how each handles relative and Windows paths before passing paths to fast-glob. Determine the intended path base and normalization behavior, then verify that both APIs handle equivalent inputs consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.