Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions features/draft/vendor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Draft vendor features

This directory is for features proposed by a browser vendor, to support the
early use of web-features before there is a published web-features ID, and a
way to transition from draft to published feature IDs.

A draft vendor feature goes through these stages:

- A bot creates a `.yml` file in this directory, with enough information for a
maintainer of web-features to follow up and act on. An `explainer` or `spec`
URL and a vendor-specific URL like `chromestatus` is recommended.
- A web-features maintainer creates a real feature entry and replaces the draft
feature with a pointer to that feature.
- References to the draft feature in vendor tools or source code are updated to
point to the final features.

Write access for bots can be granted by web-features maintainers, and should
only be used to create files in this directory.
11 changes: 9 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,17 @@ function* yamlEntries(root: string): Generator<[string, any]> {
// The feature identifier/key is the filename without extension.
const { name: key } = path.parse(fp);
const pathParts = fp.split(path.sep);
const isDraft = pathParts.includes('draft');
const isSpec = isDraft && pathParts.includes('spec');
const isVendor = isDraft && pathParts.includes('vendor');

if (isVendor) {
continue;
}

// Assert ID uniqueness
for (const [pool, map] of Object.entries(uniqueIdMaps)) {
if (!pathParts.includes("spec") && pathParts.includes(pool)) {
if (!isSpec && pathParts.includes(pool)) {
const otherFile: string | undefined = map.get(key);
if (otherFile) {
throw new Error(`ID collision between ${fp} and ${otherFile}`);
Expand All @@ -68,7 +75,7 @@ function* yamlEntries(root: string): Generator<[string, any]> {
Object.assign(data, dist);
}

if (pathParts.includes('draft')) {
if (isDraft) {
data[draft] = true;
}

Expand Down
3 changes: 3 additions & 0 deletions scripts/dist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ const tagsToFeatures: Map<string, Feature[]> = (() => {
* mistakes, such as `.yaml` files.
*/
function isDistOrDistable(path: string): boolean {
if (path.startsWith("features/draft/vendor/")) {
return false;
}
if (path.endsWith(".yaml.dist") || path.endsWith(".yaml")) {
throw new Error(
`YAML files must use .yml extension; ${path} has invalid extension`,
Expand Down