@flighthq/requirement-codegen 0.5.1-next.1692.64cda40 → 0.5.1-next.1700.cefb2f9
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/README.md +2 -2
- package/dist/requirementCodegen.js +31 -1
- package/dist/requirementCodegen.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/requirement-codegen`
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/requirement-codegen@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/requirement-codegen@0.5.1-next.1700.cefb2f9](https://github.com/flighthq/flight/tree/cefb2f9914270340afd4cc39e407f1202bcf8fc5/packages/requirement-codegen)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/cefb2f9914270340afd4cc39e407f1202bcf8fc5/LICENSE.md)
|
|
@@ -11,7 +11,7 @@ export function initializeRequirementCodegenPlan(out, catalog, requirements, bac
|
|
|
11
11
|
const entries = [];
|
|
12
12
|
const unresolved = [];
|
|
13
13
|
const seen = new Set();
|
|
14
|
-
for (const requirement of requirements.requirements) {
|
|
14
|
+
for (const requirement of expandRequirements(catalog, requirements.requirements)) {
|
|
15
15
|
const identity = requirementIdentity(requirement);
|
|
16
16
|
if (seen.has(identity))
|
|
17
17
|
continue;
|
|
@@ -28,6 +28,36 @@ export function initializeRequirementCodegenPlan(out, catalog, requirements, bac
|
|
|
28
28
|
out.entries = entries;
|
|
29
29
|
out.unresolved = unresolved;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Adds the render requirements a format requirement implies, so one pass resolves both halves.
|
|
33
|
+
*
|
|
34
|
+
* A `document.format` requirement names a TAG and a renderer is keyed by a NODE KIND, so without this
|
|
35
|
+
* a render backend resolves nothing and every fragment comes back empty while the parser fragment
|
|
36
|
+
* fills — which is exactly what the per-file manifest is supposed to prevent. Expansion is ADDITIVE:
|
|
37
|
+
* the original requirement stays, because the parser backend still has to resolve it.
|
|
38
|
+
*
|
|
39
|
+
* Two match shapes, both exact-string: a translation keyed on the full key applies to that requirement,
|
|
40
|
+
* and one keyed on a bare format namespace applies to every requirement in it. The namespace form is
|
|
41
|
+
* what carries the kinds a document produces regardless of its tags — a SWF's `MovieClip` root exists
|
|
42
|
+
* even in a file whose only tag is `SetBackgroundColor`, which no per-tag row could state.
|
|
43
|
+
*/
|
|
44
|
+
function expandRequirements(catalog, requirements) {
|
|
45
|
+
const translations = catalog.translations;
|
|
46
|
+
if (translations === undefined || translations.length === 0)
|
|
47
|
+
return requirements;
|
|
48
|
+
const expanded = [...requirements];
|
|
49
|
+
for (const requirement of requirements) {
|
|
50
|
+
const namespace = requirement.key.includes('.') ? requirement.key.slice(0, requirement.key.indexOf('.')) : null;
|
|
51
|
+
for (const translation of translations) {
|
|
52
|
+
if (translation.from.facet !== requirement.facet)
|
|
53
|
+
continue;
|
|
54
|
+
const matches = translation.from.key === requirement.key || (namespace !== null && translation.from.key === namespace);
|
|
55
|
+
if (matches)
|
|
56
|
+
expanded.push(...translation.to);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return expanded;
|
|
60
|
+
}
|
|
31
61
|
function requirementIdentity(requirement) {
|
|
32
62
|
return `${requirement.facet}\0${requirement.key}`;
|
|
33
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requirementCodegen.js","sourceRoot":"","sources":["../src/requirementCodegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAWvF,MAAM,UAAU,4BAA4B,CAC1C,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AAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChH,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;YACvC,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC,KAAK;gBAAE,SAAS;YAC3D,MAAM,OAAO,GACX,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,WAAW,CAAC,GAAG,IAAI,CAAC,SAAS,KAAK,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC;YACzG,IAAI,OAAO;gBAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,mBAAmB,CAAC,WAAkC;IAC7D,OAAO,GAAG,WAAW,CAAC,KAAK,KAAK,WAAW,CAAC,GAAG,EAAE,CAAC;AACpD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/requirement-codegen",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.1700.cefb2f9",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/requirement-catalog": "0.5.1-next.
|
|
43
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.1700.cefb2f9",
|
|
42
|
+
"@flighthq/requirement-catalog": "0.5.1-next.1700.cefb2f9",
|
|
43
|
+
"@flighthq/types": "0.5.1-next.1700.cefb2f9"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.3.0"
|