reffy 20.0.0 → 20.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reffy",
3
- "version": "20.0.0",
3
+ "version": "20.0.2",
4
4
  "description": "W3C/WHATWG spec dependencies exploration companion. Features a short set of tools to study spec references as well as WebIDL term definitions and references found in W3C specifications.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,17 +35,17 @@
35
35
  "dependencies": {
36
36
  "ajv": "8.17.1",
37
37
  "ajv-formats": "3.0.1",
38
- "commander": "14.0.1",
38
+ "commander": "14.0.2",
39
39
  "fetch-filecache-for-crawling": "5.1.1",
40
- "puppeteer": "24.25.0",
40
+ "puppeteer": "24.30.0",
41
41
  "semver": "^7.3.5",
42
- "web-specs": "3.68.0",
42
+ "web-specs": "3.71.0",
43
43
  "webidl2": "24.5.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "respec": "35.6.0",
47
47
  "respec-hljs": "2.1.1",
48
- "rollup": "4.52.4",
48
+ "rollup": "4.53.2",
49
49
  "undici": "^7.0.0"
50
50
  },
51
51
  "overrides": {
@@ -56,6 +56,45 @@ const extractCategories = [
56
56
  'values'
57
57
  ];
58
58
 
59
+
60
+ /**
61
+ * Helper function to recursively copy scoped functions and types defined for
62
+ * another construct to the root level with a `for` key that links back to the
63
+ * scoping feature.
64
+ *
65
+ * Note: for descriptors, the function actually moves the inner descriptors to
66
+ * the root level.
67
+ */
68
+ function copyScopedValuesToRootLevel(feature, categorized) {
69
+ if (feature.values) {
70
+ const values = feature.values
71
+ .filter(v => ['function', 'type'].includes(v.type))
72
+ .map(v => Object.assign({ for: feature.name }, v));
73
+ categorized.functions.push(
74
+ ...values.filter(v => v.type === 'function'));
75
+ categorized.types.push(
76
+ ...values.filter(v => v.type === 'type'));
77
+ // A scoped function may have scoped values, let's recurse
78
+ for (const value of values) {
79
+ copyScopedValuesToRootLevel(value, categorized);
80
+ }
81
+ }
82
+ if (feature.descriptors) {
83
+ // Note: at-rule descriptors already have a "for" attribute but
84
+ // nested at-rules typically don't have "descriptors" themselves
85
+ // while schema requires the property for consistency
86
+ const atrules = feature.descriptors
87
+ .filter(v => v.type === 'at-rule')
88
+ .map(v => Object.assign({ descriptors: [] }, v));
89
+ categorized.atrules.push(...atrules);
90
+ feature.descriptors = feature.descriptors
91
+ .filter(d => d.type !== 'at-rule');
92
+ for (const descriptor of feature.descriptors) {
93
+ copyScopedValuesToRootLevel(descriptor, categorized);
94
+ }
95
+ }
96
+ }
97
+
59
98
  export default {
60
99
  dependsOn: ['css'],
61
100
  input: 'crawl',
@@ -93,25 +132,9 @@ export default {
93
132
  categorized.functions.push(...data.values.filter(v => v.type === 'function'));
94
133
  categorized.types.push(...data.values.filter(v => v.type === 'type'));
95
134
 
96
- // Copy scoped functions and types to the root level with a `for` key
97
- // to link back to the scoping feature
98
135
  for (const category of extractCategories) {
99
136
  for (const feature of data[category]) {
100
- if (feature.values) {
101
- const values = feature.values
102
- .map(v => Object.assign({ for: feature.name }, v));
103
- categorized.functions.push(
104
- ...values.filter(v => v.type === 'function'));
105
- categorized.types.push(
106
- ...values.filter(v => v.type === 'type'));
107
- }
108
- if (feature.descriptors) {
109
- // Note: at-rule descriptors already have a "for" attribute
110
- categorized.atrules.push(
111
- ...feature.descriptors.filter(v => v.type === 'at-rule'));
112
- feature.descriptors = feature.descriptors
113
- .filter(d => d.type !== 'at-rule');
114
- }
137
+ copyScopedValuesToRootLevel(feature, categorized);
115
138
  }
116
139
  }
117
140
  }