You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| All six pieces in hand at once |`new PackageURL(type, ns, name, version, qualifiers, subpath)` — positional, fastest.|
20
+
| A loop / conditional that sets fields over time |`PurlBuilder` — method chaining, field-by-field.|
21
21
| An existing PackageURL and want to tweak one field |`PurlBuilder.from(existing).name('new').build()` — creates a fresh instance since PackageURL is frozen. |
22
-
| A string from the wire |`new PackageURL(str)` or `PackageURL.fromStringResult(str)` — see `docs/hardening.md`. |
22
+
| A string from the wire |`new PackageURL(str)` or `PackageURL.fromStringResult(str)` — see `docs/hardening.md`.|
23
23
24
24
The builder is not faster than the constructor; it is easier to
25
25
read when construction is spread across code.
@@ -48,16 +48,16 @@ or a value fails its component's validator, `build()` throws.
48
48
49
49
## The setters
50
50
51
-
| Method | Sets | Notes |
52
-
|---|---|---|
53
-
|`.type(str)`| The package type (`npm`, `pypi`, `maven`, …). Required. | Lowercased. Must match a registered `PurlType`. |
54
-
|`.namespace(str)`| Namespace / scope / group (e.g. `@scope` for npm, `org.acme` for maven). Optional. | Normalization depends on type. npm lowercases; maven preserves case. |
55
-
|`.name(str)`| Package name. Required. | Same as namespace — normalization per type. |
56
-
|`.version(str)`| Version string. Optional. | Free-form; validated for injection chars but not semver-shape (ecosystems disagree). |
57
-
|`.qualifier(key, value)`| One key-value qualifier. Add many by chaining multiple calls. | See the known-qualifier list below. |
58
-
|`.qualifiers(obj)`| Set all qualifiers at once from an object. | Replaces any previously-set qualifiers. |
59
-
|`.subpath(str)`| Subpath within the package (e.g. `lib/utils`). Optional. | Leading/trailing slashes are stripped. |
|`.config/vitest.config.mts`| Normal tests. Threads, shared memory. Fast. |`*.test.mts`|
105
105
|`.config/vitest.config.isolated.mts`| Tests that mock globals via `vi.doMock`, modify `process.env`, or `process.chdir`. Forks, full isolation. |`*.isolated.test.mts`|
106
106
107
107
**Test style in this repo:** functional. Tests assert behavior via
0 commit comments