@genesislcap/ts-builder 14.483.3-alpha-7a2e689.0 → 14.484.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-wrapper-generator.d.ts","sourceRoot":"","sources":["../src/react-wrapper-generator.ts"],"names":[],"mappings":"AAyCA,KAAK,cAAc,GAAG;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,SAAS,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"react-wrapper-generator.d.ts","sourceRoot":"","sources":["../src/react-wrapper-generator.ts"],"names":[],"mappings":"AAyCA,KAAK,cAAc,GAAG;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,SAAS,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AA0jC/F,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAgDhF"}
|
|
@@ -855,6 +855,16 @@ function getWorkspacePackageDirectoryByName(workspaceRoot, packageName) {
|
|
|
855
855
|
return undefined;
|
|
856
856
|
});
|
|
857
857
|
}
|
|
858
|
+
function enrichFromPackageDistMetadata(distDir, state) {
|
|
859
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
860
|
+
const refState = createTypeImportState();
|
|
861
|
+
const { apiJsonFiles, dtsFiles } = yield collectTypeMetadataFiles(distDir);
|
|
862
|
+
yield parseApiJsonFiles(apiJsonFiles, refState);
|
|
863
|
+
yield parseDtsFiles(dtsFiles, refState);
|
|
864
|
+
mergeTypeImportStateInto(state, refState);
|
|
865
|
+
return refState;
|
|
866
|
+
});
|
|
867
|
+
}
|
|
858
868
|
function enrichFromWorkspaceWildcardExports(cwd, state) {
|
|
859
869
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
860
870
|
const workspaceRoot = yield findWorkspaceRoot(cwd);
|
|
@@ -869,14 +879,8 @@ function enrichFromWorkspaceWildcardExports(cwd, state) {
|
|
|
869
879
|
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
870
880
|
if (!(yield fileExists(distDir)))
|
|
871
881
|
continue;
|
|
872
|
-
const refState = createTypeImportState();
|
|
873
882
|
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
874
|
-
const
|
|
875
|
-
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
876
|
-
yield parseApiJsonFiles(apiJsonFiles, refState);
|
|
877
|
-
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
878
|
-
yield parseDtsFiles(dtsFiles, refState);
|
|
879
|
-
mergeTypeImportStateInto(state, refState);
|
|
883
|
+
const refState = yield enrichFromPackageDistMetadata(distDir, state);
|
|
880
884
|
for (const mod of refState.wildcardExportModules) {
|
|
881
885
|
if (mod.startsWith('@genesislcap/'))
|
|
882
886
|
pending.add(mod);
|
|
@@ -884,6 +888,40 @@ function enrichFromWorkspaceWildcardExports(cwd, state) {
|
|
|
884
888
|
}
|
|
885
889
|
});
|
|
886
890
|
}
|
|
891
|
+
/**
|
|
892
|
+
* Elements inheriting from another `@genesislcap/*` package merge that package's CEM events
|
|
893
|
+
* (see mergeFoundationInheritanceFromManifest), so their event descriptions may reference
|
|
894
|
+
* detail types exported by the superclass package. Register that package's type metadata so
|
|
895
|
+
* those identifiers resolve instead of silently degrading to `unknown`.
|
|
896
|
+
*/
|
|
897
|
+
function enrichFromInheritedSuperclassPackages(cwd, entries, state) {
|
|
898
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
899
|
+
const superclassPackages = new Set(entries
|
|
900
|
+
.map((e) => { var _a; return (_a = e.declaration.superclass) === null || _a === void 0 ? void 0 : _a.package; })
|
|
901
|
+
.filter((p) => !!p && p.startsWith('@genesislcap/')));
|
|
902
|
+
if (!superclassPackages.size)
|
|
903
|
+
return;
|
|
904
|
+
const workspaceRoot = yield findWorkspaceRoot(cwd);
|
|
905
|
+
for (const packageName of superclassPackages) {
|
|
906
|
+
// Consumer repos resolve the superclass package from node_modules; inside this
|
|
907
|
+
// monorepo it is a workspace package.
|
|
908
|
+
let distDir = (0, node_path_1.resolve)(cwd, 'node_modules', packageName, 'dist');
|
|
909
|
+
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
910
|
+
if (!(yield fileExists(distDir))) {
|
|
911
|
+
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
912
|
+
const pkgDir = yield getWorkspacePackageDirectoryByName(workspaceRoot, packageName);
|
|
913
|
+
if (!pkgDir)
|
|
914
|
+
continue;
|
|
915
|
+
distDir = (0, node_path_1.resolve)(pkgDir, 'dist');
|
|
916
|
+
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
917
|
+
if (!(yield fileExists(distDir)))
|
|
918
|
+
continue;
|
|
919
|
+
}
|
|
920
|
+
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
921
|
+
yield enrichFromPackageDistMetadata(distDir, state);
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
}
|
|
887
925
|
function buildTypeImportState(cwd) {
|
|
888
926
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
889
927
|
const state = createTypeImportState();
|
|
@@ -927,6 +965,7 @@ function generateReactWrappers(cwd) {
|
|
|
927
965
|
const dtsRoot = (0, node_path_1.resolve)(cwd, 'dist/dts');
|
|
928
966
|
yield (0, promises_1.mkdir)(dtsRoot, { recursive: true });
|
|
929
967
|
const typeImportState = yield buildTypeImportState(cwd);
|
|
968
|
+
yield enrichFromInheritedSuperclassPackages(cwd, entries, typeImportState);
|
|
930
969
|
const reactDtsPath = (0, node_path_1.resolve)(dtsRoot, 'react.d.ts');
|
|
931
970
|
yield Promise.all([
|
|
932
971
|
(0, promises_1.writeFile)((0, node_path_1.resolve)(cwd, 'dist/react.mjs'), generateReactWrapperJs(entries, 'esm'), 'utf8'),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/ts-builder",
|
|
3
3
|
"description": "Typescript builder",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.484.0",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@custom-elements-manifest/analyzer": "^0.8.2",
|
|
20
|
-
"@genesislcap/build-kit": "14.
|
|
20
|
+
"@genesislcap/build-kit": "14.484.0",
|
|
21
21
|
"consola": "^3.0.2",
|
|
22
22
|
"copyfiles": "^2.4.1",
|
|
23
23
|
"pkg-types": "^1.0.2"
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "1ec7b2318e2447c2cd3ad877666b6fd1f3b87c05"
|
|
34
34
|
}
|
|
@@ -1027,6 +1027,18 @@ async function getWorkspacePackageDirectoryByName(
|
|
|
1027
1027
|
return undefined;
|
|
1028
1028
|
}
|
|
1029
1029
|
|
|
1030
|
+
async function enrichFromPackageDistMetadata(
|
|
1031
|
+
distDir: string,
|
|
1032
|
+
state: TypeImportState,
|
|
1033
|
+
): Promise<TypeImportState> {
|
|
1034
|
+
const refState = createTypeImportState();
|
|
1035
|
+
const { apiJsonFiles, dtsFiles } = await collectTypeMetadataFiles(distDir);
|
|
1036
|
+
await parseApiJsonFiles(apiJsonFiles, refState);
|
|
1037
|
+
await parseDtsFiles(dtsFiles, refState);
|
|
1038
|
+
mergeTypeImportStateInto(state, refState);
|
|
1039
|
+
return refState;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1030
1042
|
async function enrichFromWorkspaceWildcardExports(
|
|
1031
1043
|
cwd: string,
|
|
1032
1044
|
state: TypeImportState,
|
|
@@ -1046,14 +1058,8 @@ async function enrichFromWorkspaceWildcardExports(
|
|
|
1046
1058
|
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
1047
1059
|
if (!(await fileExists(distDir))) continue;
|
|
1048
1060
|
|
|
1049
|
-
const refState = createTypeImportState();
|
|
1050
|
-
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
1051
|
-
const { apiJsonFiles, dtsFiles } = await collectTypeMetadataFiles(distDir);
|
|
1052
|
-
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
1053
|
-
await parseApiJsonFiles(apiJsonFiles, refState);
|
|
1054
1061
|
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
1055
|
-
await
|
|
1056
|
-
mergeTypeImportStateInto(state, refState);
|
|
1062
|
+
const refState = await enrichFromPackageDistMetadata(distDir, state);
|
|
1057
1063
|
|
|
1058
1064
|
for (const mod of refState.wildcardExportModules) {
|
|
1059
1065
|
if (mod.startsWith('@genesislcap/')) pending.add(mod);
|
|
@@ -1061,6 +1067,45 @@ async function enrichFromWorkspaceWildcardExports(
|
|
|
1061
1067
|
}
|
|
1062
1068
|
}
|
|
1063
1069
|
|
|
1070
|
+
/**
|
|
1071
|
+
* Elements inheriting from another `@genesislcap/*` package merge that package's CEM events
|
|
1072
|
+
* (see mergeFoundationInheritanceFromManifest), so their event descriptions may reference
|
|
1073
|
+
* detail types exported by the superclass package. Register that package's type metadata so
|
|
1074
|
+
* those identifiers resolve instead of silently degrading to `unknown`.
|
|
1075
|
+
*/
|
|
1076
|
+
async function enrichFromInheritedSuperclassPackages(
|
|
1077
|
+
cwd: string,
|
|
1078
|
+
entries: CEMElementEntry[],
|
|
1079
|
+
state: TypeImportState,
|
|
1080
|
+
): Promise<void> {
|
|
1081
|
+
const superclassPackages = new Set(
|
|
1082
|
+
entries
|
|
1083
|
+
.map((e) => e.declaration.superclass?.package)
|
|
1084
|
+
.filter((p): p is string => !!p && p.startsWith('@genesislcap/')),
|
|
1085
|
+
);
|
|
1086
|
+
if (!superclassPackages.size) return;
|
|
1087
|
+
|
|
1088
|
+
const workspaceRoot = await findWorkspaceRoot(cwd);
|
|
1089
|
+
|
|
1090
|
+
for (const packageName of superclassPackages) {
|
|
1091
|
+
// Consumer repos resolve the superclass package from node_modules; inside this
|
|
1092
|
+
// monorepo it is a workspace package.
|
|
1093
|
+
let distDir = resolve(cwd, 'node_modules', packageName, 'dist');
|
|
1094
|
+
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
1095
|
+
if (!(await fileExists(distDir))) {
|
|
1096
|
+
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
1097
|
+
const pkgDir = await getWorkspacePackageDirectoryByName(workspaceRoot, packageName);
|
|
1098
|
+
if (!pkgDir) continue;
|
|
1099
|
+
distDir = resolve(pkgDir, 'dist');
|
|
1100
|
+
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
1101
|
+
if (!(await fileExists(distDir))) continue;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
// oxlint-disable-next-line no-await-in-loop -- sequential per-package processing is intentional
|
|
1105
|
+
await enrichFromPackageDistMetadata(distDir, state);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1064
1109
|
async function buildTypeImportState(cwd: string): Promise<TypeImportState> {
|
|
1065
1110
|
const state = createTypeImportState();
|
|
1066
1111
|
const distDir = resolve(cwd, 'dist');
|
|
@@ -1114,6 +1159,7 @@ export async function generateReactWrappers(cwd: string): Promise<GenerateResult
|
|
|
1114
1159
|
await mkdir(dtsRoot, { recursive: true });
|
|
1115
1160
|
|
|
1116
1161
|
const typeImportState = await buildTypeImportState(cwd);
|
|
1162
|
+
await enrichFromInheritedSuperclassPackages(cwd, entries, typeImportState);
|
|
1117
1163
|
const reactDtsPath = resolve(dtsRoot, 'react.d.ts');
|
|
1118
1164
|
|
|
1119
1165
|
await Promise.all([
|