@intelligentgraphics/ig.gfx.packager 3.0.9 → 3.0.11

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.
Files changed (43) hide show
  1. package/build/bin.mjs +6 -0
  2. package/build/bin.mjs.map +1 -0
  3. package/build/cli-381989cc.mjs +1389 -0
  4. package/build/cli-381989cc.mjs.map +1 -0
  5. package/build/dependencies-1f665204.mjs +129 -0
  6. package/build/dependencies-1f665204.mjs.map +1 -0
  7. package/build/generateIndex-074f4aa1.mjs +257 -0
  8. package/build/generateIndex-074f4aa1.mjs.map +1 -0
  9. package/build/generateParameterType-4c9e95a5.mjs +75 -0
  10. package/build/generateParameterType-4c9e95a5.mjs.map +1 -0
  11. package/build/index-06ac2c4c.mjs +495 -0
  12. package/build/index-06ac2c4c.mjs.map +1 -0
  13. package/build/index-cc42a478.mjs +312 -0
  14. package/build/index-cc42a478.mjs.map +1 -0
  15. package/build/postinstall-c38d9b55.mjs +67 -0
  16. package/build/postinstall-c38d9b55.mjs.map +1 -0
  17. package/build/publishNpm-8ec1b871.mjs +134 -0
  18. package/build/publishNpm-8ec1b871.mjs.map +1 -0
  19. package/build/versionFile-aa8b6b7a.mjs +384 -0
  20. package/build/versionFile-aa8b6b7a.mjs.map +1 -0
  21. package/lib/lib.mjs +1476 -0
  22. package/package.json +13 -9
  23. package/readme.md +86 -2
  24. package/build/cli-17d957b0.js +0 -2531
  25. package/build/cli-17d957b0.js.map +0 -1
  26. package/build/dependencies-51916db0.js +0 -149
  27. package/build/dependencies-51916db0.js.map +0 -1
  28. package/build/generateIndex-59993f0f.js +0 -266
  29. package/build/generateIndex-59993f0f.js.map +0 -1
  30. package/build/generateParameterType-d3ab08fd.js +0 -74
  31. package/build/generateParameterType-d3ab08fd.js.map +0 -1
  32. package/build/index-a48c5d0a.js +0 -480
  33. package/build/index-a48c5d0a.js.map +0 -1
  34. package/build/index-ac2cd050.js +0 -308
  35. package/build/index-ac2cd050.js.map +0 -1
  36. package/build/index.mjs +0 -6
  37. package/build/index.mjs.map +0 -1
  38. package/build/postinstall-9990fb31.js +0 -64
  39. package/build/postinstall-9990fb31.js.map +0 -1
  40. package/build/publishNpm-74a96626.js +0 -133
  41. package/build/publishNpm-74a96626.js.map +0 -1
  42. package/build/versionFile-68e35b54.js +0 -370
  43. package/build/versionFile-68e35b54.js.map +0 -1
@@ -0,0 +1,257 @@
1
+ import ts from 'typescript';
2
+ import 'path';
3
+ import 'fs';
4
+ import 'resolve';
5
+ import 'write-pkg';
6
+ import { h as getPackageTypescriptFiles, b as readPackageCreatorIndex, j as writePackageCreatorIndex } from './cli-381989cc.mjs';
7
+ import 'node:path';
8
+ import 'node:fs';
9
+ import 'axios';
10
+ import 'update-notifier';
11
+ import 'yargs/yargs';
12
+ import 'url';
13
+ import 'glob';
14
+ import 'assert';
15
+ import 'events';
16
+ import 'core-js/modules/es.typed-array.set.js';
17
+ import 'util';
18
+ import 'inquirer';
19
+
20
+ /**
21
+ * Extracts and returns script array for _Index.json from a src folder
22
+ *
23
+ * @param folderPath path to a src folder
24
+ */ function generateIndex({ location , ignore =[] , strictOptional =false }) {
25
+ const files = getPackageTypescriptFiles(location);
26
+ const filtered = files.filter((path)=>{
27
+ return !ignore.some((suffix)=>path.endsWith(suffix));
28
+ });
29
+ const arr = [];
30
+ const existingIndex = readPackageCreatorIndex(location) ?? [];
31
+ const program = ts.createProgram(filtered, {
32
+ allowJs: true
33
+ });
34
+ const typeChecker = program.getTypeChecker();
35
+ filtered.forEach((file)=>{
36
+ // Create a Program to represent the project, then pull out the
37
+ // source file to parse its AST.
38
+ const sourceFile = program.getSourceFile(file);
39
+ // Loop through the root AST nodes of the file
40
+ ts.forEachChild(sourceFile, (node)=>{
41
+ for (const scriptingClass of findScriptingClasses(node)){
42
+ if (scriptingClass.node.name === undefined) {
43
+ throw new Error(`Expected ${scriptingClass.type} class to have a name`);
44
+ }
45
+ const name = typeChecker.getFullyQualifiedName(typeChecker.getSymbolAtLocation(scriptingClass.node.name));
46
+ if (name.length > 45) {
47
+ throw new Error(`Package name length >45 '${name}'`);
48
+ }
49
+ const parameterDeclaration = getScriptingClassParameterdeclaration(scriptingClass);
50
+ const parametersType = parameterDeclaration === undefined ? undefined : typeChecker.getTypeAtLocation(parameterDeclaration);
51
+ if (parametersType === undefined) {
52
+ console.log(`Failed to find parameters type declaration for ${scriptingClass.type} ${name}. Skipping parameter list generation`);
53
+ }
54
+ const existingIndexEntry = existingIndex.find((entry)=>entry.Name === name);
55
+ const obj = {
56
+ Name: name,
57
+ Description: existingIndexEntry == null ? void 0 : existingIndexEntry.Description,
58
+ Type: scriptingClass.type === "evaluator" ? "Evaluator" : "Interactor",
59
+ Parameters: []
60
+ };
61
+ const rawDocTags = ts.getJSDocTags(scriptingClass.node);
62
+ const dict = getTagDict(rawDocTags);
63
+ if (dict.summary) {
64
+ obj.Description = dict.summary;
65
+ } else {
66
+ const comment = typeChecker.getTypeAtLocation(scriptingClass.node).symbol.getDocumentationComment(typeChecker).map((comment)=>comment.text).join(" ");
67
+ if (comment) {
68
+ obj.Description = comment;
69
+ }
70
+ }
71
+ if (parametersType !== undefined) {
72
+ obj.Parameters = genParameters(typeChecker.getPropertiesOfType(parametersType), strictOptional);
73
+ if (obj.Parameters.length === 0 && parametersType.getStringIndexType() !== undefined) {
74
+ obj.Parameters = (existingIndexEntry == null ? void 0 : existingIndexEntry.Parameters) ?? [];
75
+ }
76
+ } else if (existingIndexEntry !== undefined) {
77
+ obj.Parameters = existingIndexEntry.Parameters;
78
+ }
79
+ arr.push(obj);
80
+ }
81
+ });
82
+ });
83
+ arr.sort((a, b)=>a.Name.localeCompare(b.Name));
84
+ writePackageCreatorIndex(location, arr);
85
+ }
86
+ function capitalizeFirstLetter(string) {
87
+ return (string == null ? void 0 : string.charAt(0).toUpperCase()) + (string == null ? void 0 : string.slice(1));
88
+ }
89
+ function parseDefault(value, type) {
90
+ const uType = capitalizeFirstLetter(type);
91
+ if (value === "null") return null;
92
+ switch(uType){
93
+ case "LengthM":
94
+ case "ArcDEG":
95
+ case "Float":
96
+ return parseFloat(value);
97
+ case "Integer":
98
+ case "Int":
99
+ return parseInt(value);
100
+ case "Boolean":
101
+ case "Bool":
102
+ return value === "true";
103
+ case "Material":
104
+ case "String":
105
+ case "Geometry":
106
+ default:
107
+ return value.replace(/^"/, "").replace(/"$/, "");
108
+ }
109
+ }
110
+ function genParameters(properties, strictOptional) {
111
+ return properties.map((symbol, i)=>{
112
+ var _symbol_getDeclarations;
113
+ const parameter = {
114
+ Name: symbol.name,
115
+ Description: undefined,
116
+ Type: "String",
117
+ Default: undefined,
118
+ DisplayIndex: i + 1
119
+ };
120
+ if (parameter.Name.length > 45) {
121
+ throw new Error(`Parameter name length >45 '${parameter.Name}'`);
122
+ }
123
+ let declaration = (_symbol_getDeclarations = symbol.getDeclarations()) == null ? void 0 : _symbol_getDeclarations[0];
124
+ let documentationComment = symbol.getDocumentationComment(undefined);
125
+ let checkLinksSymbol = symbol;
126
+ while(checkLinksSymbol !== undefined && declaration === undefined){
127
+ const links = checkLinksSymbol.links;
128
+ if (links == null ? void 0 : links.syntheticOrigin) {
129
+ var _links_syntheticOrigin_getDeclarations;
130
+ declaration = (_links_syntheticOrigin_getDeclarations = links.syntheticOrigin.getDeclarations()) == null ? void 0 : _links_syntheticOrigin_getDeclarations[0];
131
+ if (documentationComment.length === 0) {
132
+ documentationComment = links.syntheticOrigin.getDocumentationComment(undefined);
133
+ }
134
+ checkLinksSymbol = links.syntheticOrigin;
135
+ }
136
+ }
137
+ if (declaration !== undefined) {
138
+ const rawDocTags = ts.getJSDocTags(declaration);
139
+ const dict = getTagDict(rawDocTags);
140
+ if (dict.summary) {
141
+ parameter.Description = dict.summary;
142
+ } else {
143
+ const comment = documentationComment.map((comment)=>comment.text).join(" ");
144
+ if (comment) {
145
+ parameter.Description = comment;
146
+ }
147
+ }
148
+ if (dict.creatorType) {
149
+ parameter.Type = dict.creatorType;
150
+ }
151
+ if (dict.default) {
152
+ parameter.Default = parseDefault(dict.default, parameter.Type);
153
+ }
154
+ if (strictOptional && declaration.kind === ts.SyntaxKind.PropertySignature) {
155
+ const propertySignature = declaration;
156
+ if (propertySignature.questionToken === undefined) {
157
+ parameter.Required = true;
158
+ }
159
+ }
160
+ }
161
+ return parameter;
162
+ });
163
+ }
164
+ function getTagDict(tags) {
165
+ const dict = {};
166
+ for (const tag of tags){
167
+ dict[tag.tagName.text] = tag.comment;
168
+ }
169
+ return dict;
170
+ }
171
+ const getScriptingClassParameterdeclaration = (scriptingClass)=>{
172
+ for (const member of scriptingClass.node.members){
173
+ if (ts.isMethodDeclaration(member)) {
174
+ for(let index = 0; index < member.parameters.length; index++){
175
+ const parameter = member.parameters[index];
176
+ if (isScriptingClassParameterDeclaration(scriptingClass, member, index)) {
177
+ return parameter;
178
+ }
179
+ }
180
+ }
181
+ if (ts.isConstructorDeclaration(member)) {
182
+ for(let index = 0; index < member.parameters.length; index++){
183
+ const parameter = member.parameters[index];
184
+ if (isScriptingClassParameterDeclaration(scriptingClass, member, index)) {
185
+ return parameter;
186
+ }
187
+ }
188
+ }
189
+ }
190
+ };
191
+ const isScriptingClassParameterDeclaration = (scriptingClass, memberNode, parameterIndex)=>{
192
+ if (scriptingClass.type === "evaluator") {
193
+ var _memberNode_name;
194
+ return (memberNode == null ? void 0 : (_memberNode_name = memberNode.name) == null ? void 0 : _memberNode_name.getText()) == "Create" && parameterIndex === 2;
195
+ }
196
+ if (scriptingClass.type === "interactor") {
197
+ return memberNode.kind === ts.SyntaxKind.Constructor && parameterIndex === 0;
198
+ }
199
+ return false;
200
+ };
201
+ /**
202
+ * Finds interactors and evaluators within a script file
203
+ *
204
+ * @param {ts.Node} node
205
+ * @return {*}
206
+ */ const findScriptingClasses = (node)=>{
207
+ let body;
208
+ if (ts.isModuleDeclaration(node)) {
209
+ body = node.body;
210
+ }
211
+ if (body !== undefined && ts.isModuleDeclaration(body)) {
212
+ body = body.body;
213
+ }
214
+ const classes = [];
215
+ if (body !== undefined) {
216
+ ts.forEachChild(body, (child)=>{
217
+ if (!ts.isClassDeclaration(child)) {
218
+ return;
219
+ }
220
+ const scriptingClass = detectScriptingClass(child);
221
+ if (scriptingClass !== undefined) {
222
+ classes.push(scriptingClass);
223
+ }
224
+ });
225
+ }
226
+ return classes;
227
+ };
228
+ const detectScriptingClass = (node)=>{
229
+ var _node_heritageClauses, _node_heritageClauses1;
230
+ const isEvaluator = (_node_heritageClauses = node.heritageClauses) == null ? void 0 : _node_heritageClauses.some((clause)=>{
231
+ if (clause.token !== ts.SyntaxKind.ExtendsKeyword && clause.token !== ts.SyntaxKind.ImplementsKeyword) {
232
+ return false;
233
+ }
234
+ return clause.types.some((type)=>type.getText().includes("Evaluator"));
235
+ });
236
+ if (isEvaluator) {
237
+ return {
238
+ node,
239
+ type: "evaluator"
240
+ };
241
+ }
242
+ const isInteractor = (_node_heritageClauses1 = node.heritageClauses) == null ? void 0 : _node_heritageClauses1.some((clause)=>{
243
+ if (clause.token !== ts.SyntaxKind.ExtendsKeyword) {
244
+ return false;
245
+ }
246
+ return clause.types.some((type)=>type.getText().includes("Interactor"));
247
+ });
248
+ if (isInteractor) {
249
+ return {
250
+ node,
251
+ type: "interactor"
252
+ };
253
+ }
254
+ };
255
+
256
+ export { generateIndex, isScriptingClassParameterDeclaration };
257
+ //# sourceMappingURL=generateIndex-074f4aa1.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateIndex-074f4aa1.mjs","sources":["../src/commands/generateIndex.ts"],"sourcesContent":["import ts from \"typescript\";\n\nimport {\n\tPackageLocation,\n\twritePackageCreatorIndex,\n\treadPackageCreatorIndex,\n} from \"../lib/package\";\nimport { getPackageTypescriptFiles } from \"../lib/scripts\";\nimport {\n\tCreatorIndexEntry,\n\tCreatorIndexParameter,\n\tCreatorIndexParameterType,\n} from \"../lib/package\";\n\nexport interface GenerateIndexOptions {\n\tignore?: string[];\n\tlocation: PackageLocation;\n\n\t/**\n\t * Marks non optional parameter object properties as required in the generated index\n\t *\n\t * @type {boolean}\n\t */\n\tstrictOptional?: boolean;\n}\n\n/**\n * Extracts and returns script array for _Index.json from a src folder\n *\n * @param folderPath path to a src folder\n */\nexport function generateIndex({\n\tlocation,\n\tignore = [],\n\tstrictOptional = false,\n}: GenerateIndexOptions) {\n\tconst files = getPackageTypescriptFiles(location);\n\tconst filtered = files.filter((path) => {\n\t\treturn !ignore.some((suffix) => path.endsWith(suffix));\n\t});\n\tconst arr: CreatorIndexEntry[] = [];\n\n\tconst existingIndex = readPackageCreatorIndex(location) ?? [];\n\n\tconst program = ts.createProgram(filtered, { allowJs: true });\n\tconst typeChecker = program.getTypeChecker();\n\tfiltered.forEach((file) => {\n\t\t// Create a Program to represent the project, then pull out the\n\t\t// source file to parse its AST.\n\t\tconst sourceFile = program.getSourceFile(file);\n\n\t\t// Loop through the root AST nodes of the file\n\t\tts.forEachChild(sourceFile!, (node) => {\n\t\t\tfor (const scriptingClass of findScriptingClasses(node)) {\n\t\t\t\tif (scriptingClass.node.name === undefined) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Expected ${scriptingClass.type} class to have a name`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst name = typeChecker.getFullyQualifiedName(\n\t\t\t\t\ttypeChecker.getSymbolAtLocation(scriptingClass.node.name)!,\n\t\t\t\t);\n\n\t\t\t\tif (name.length > 45) {\n\t\t\t\t\tthrow new Error(`Package name length >45 '${name}'`);\n\t\t\t\t}\n\n\t\t\t\tconst parameterDeclaration =\n\t\t\t\t\tgetScriptingClassParameterdeclaration(scriptingClass);\n\n\t\t\t\tconst parametersType =\n\t\t\t\t\tparameterDeclaration === undefined\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: typeChecker.getTypeAtLocation(parameterDeclaration);\n\n\t\t\t\tif (parametersType === undefined) {\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t`Failed to find parameters type declaration for ${scriptingClass.type} ${name}. Skipping parameter list generation`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst existingIndexEntry = existingIndex.find(\n\t\t\t\t\t(entry) => entry.Name === name,\n\t\t\t\t);\n\n\t\t\t\tconst obj: CreatorIndexEntry = {\n\t\t\t\t\tName: name,\n\t\t\t\t\tDescription: existingIndexEntry?.Description,\n\t\t\t\t\tType:\n\t\t\t\t\t\tscriptingClass.type === \"evaluator\"\n\t\t\t\t\t\t\t? \"Evaluator\"\n\t\t\t\t\t\t\t: \"Interactor\",\n\t\t\t\t\tParameters: [],\n\t\t\t\t};\n\n\t\t\t\tconst rawDocTags = ts.getJSDocTags(scriptingClass.node);\n\n\t\t\t\tconst dict = getTagDict(rawDocTags);\n\t\t\t\tif (dict.summary) {\n\t\t\t\t\tobj.Description = dict.summary;\n\t\t\t\t} else {\n\t\t\t\t\tconst comment = typeChecker\n\t\t\t\t\t\t.getTypeAtLocation(scriptingClass.node)\n\t\t\t\t\t\t.symbol.getDocumentationComment(typeChecker)\n\t\t\t\t\t\t.map((comment) => comment.text)\n\t\t\t\t\t\t.join(\" \");\n\n\t\t\t\t\tif (comment) {\n\t\t\t\t\t\tobj.Description = comment;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (parametersType !== undefined) {\n\t\t\t\t\tobj.Parameters = genParameters(\n\t\t\t\t\t\ttypeChecker.getPropertiesOfType(parametersType),\n\t\t\t\t\t\tstrictOptional,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tobj.Parameters.length === 0 &&\n\t\t\t\t\t\tparametersType.getStringIndexType() !== undefined\n\t\t\t\t\t) {\n\t\t\t\t\t\tobj.Parameters = existingIndexEntry?.Parameters ?? [];\n\t\t\t\t\t}\n\t\t\t\t} else if (existingIndexEntry !== undefined) {\n\t\t\t\t\tobj.Parameters = existingIndexEntry.Parameters;\n\t\t\t\t}\n\n\t\t\t\tarr.push(obj);\n\t\t\t}\n\t\t});\n\t});\n\n\tarr.sort((a, b) => a.Name.localeCompare(b.Name));\n\n\twritePackageCreatorIndex(location, arr);\n}\n\nfunction capitalizeFirstLetter(string: string) {\n\treturn string?.charAt(0).toUpperCase() + string?.slice(1);\n}\n\nfunction parseDefault(value: string, type: string) {\n\tconst uType: CreatorIndexParameterType = capitalizeFirstLetter(\n\t\ttype,\n\t) as CreatorIndexParameterType;\n\tif (value === \"null\") return null;\n\tswitch (uType) {\n\t\tcase \"LengthM\":\n\t\tcase \"ArcDEG\":\n\t\tcase \"Float\":\n\t\t\treturn parseFloat(value);\n\t\tcase \"Integer\":\n\t\tcase \"Int\":\n\t\t\treturn parseInt(value);\n\t\tcase \"Boolean\":\n\t\tcase \"Bool\":\n\t\t\treturn value === \"true\";\n\t\tcase \"Material\":\n\t\tcase \"String\":\n\t\tcase \"Geometry\":\n\t\tdefault:\n\t\t\treturn value.replace(/^\"/, \"\").replace(/\"$/, \"\");\n\t}\n}\n\nfunction genParameters(\n\tproperties: ts.Symbol[],\n\tstrictOptional: boolean,\n): CreatorIndexParameter[] {\n\treturn properties.map((symbol, i) => {\n\t\tconst parameter: CreatorIndexParameter = {\n\t\t\tName: symbol.name,\n\t\t\tDescription: undefined,\n\t\t\tType: \"String\",\n\t\t\tDefault: undefined,\n\t\t\tDisplayIndex: i + 1,\n\t\t};\n\n\t\tif (parameter.Name.length > 45) {\n\t\t\tthrow new Error(`Parameter name length >45 '${parameter.Name}'`);\n\t\t}\n\n\t\tlet declaration: ts.Declaration | undefined =\n\t\t\tsymbol.getDeclarations()?.[0];\n\t\tlet documentationComment = symbol.getDocumentationComment(undefined);\n\n\t\tlet checkLinksSymbol: ts.Symbol | undefined = symbol;\n\n\t\twhile (checkLinksSymbol !== undefined && declaration === undefined) {\n\t\t\tconst links = (\n\t\t\t\tcheckLinksSymbol as {\n\t\t\t\t\tlinks?: {\n\t\t\t\t\t\tmappedType?: ts.Type;\n\t\t\t\t\t\tsyntheticOrigin?: ts.Symbol;\n\t\t\t\t\t};\n\t\t\t\t} & ts.Symbol\n\t\t\t).links;\n\n\t\t\tif (links?.syntheticOrigin) {\n\t\t\t\tdeclaration = links.syntheticOrigin.getDeclarations()?.[0];\n\n\t\t\t\tif (documentationComment.length === 0) {\n\t\t\t\t\tdocumentationComment =\n\t\t\t\t\t\tlinks.syntheticOrigin.getDocumentationComment(\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tcheckLinksSymbol = links.syntheticOrigin;\n\t\t\t}\n\t\t}\n\n\t\tif (declaration !== undefined) {\n\t\t\tconst rawDocTags = ts.getJSDocTags(declaration);\n\n\t\t\tconst dict = getTagDict(rawDocTags);\n\n\t\t\tif (dict.summary) {\n\t\t\t\tparameter.Description = dict.summary;\n\t\t\t} else {\n\t\t\t\tconst comment = documentationComment\n\t\t\t\t\t.map((comment) => comment.text)\n\t\t\t\t\t.join(\" \");\n\n\t\t\t\tif (comment) {\n\t\t\t\t\tparameter.Description = comment;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (dict.creatorType) {\n\t\t\t\tparameter.Type = dict.creatorType as CreatorIndexParameterType;\n\t\t\t}\n\t\t\tif (dict.default) {\n\t\t\t\tparameter.Default = parseDefault(dict.default, parameter.Type);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tstrictOptional &&\n\t\t\t\tdeclaration.kind === ts.SyntaxKind.PropertySignature\n\t\t\t) {\n\t\t\t\tconst propertySignature = declaration as ts.PropertySignature;\n\t\t\t\tif (propertySignature.questionToken === undefined) {\n\t\t\t\t\tparameter.Required = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn parameter;\n\t});\n}\n\ninterface IDocTags {\n\tdefault?: string;\n\tcreatorType?: string;\n\tsummary?: string;\n}\n\nfunction getTagDict(tags: readonly ts.JSDocTag[]): IDocTags {\n\tconst dict: IDocTags = {};\n\n\tfor (const tag of tags) {\n\t\tdict[tag.tagName.text] = tag.comment;\n\t}\n\n\treturn dict;\n}\n\nconst getScriptingClassParameterdeclaration = (\n\tscriptingClass: ScriptingClass,\n) => {\n\tfor (const member of scriptingClass.node.members) {\n\t\tif (ts.isMethodDeclaration(member)) {\n\t\t\tfor (let index = 0; index < member.parameters.length; index++) {\n\t\t\t\tconst parameter = member.parameters[index];\n\t\t\t\tif (\n\t\t\t\t\tisScriptingClassParameterDeclaration(\n\t\t\t\t\t\tscriptingClass,\n\t\t\t\t\t\tmember,\n\t\t\t\t\t\tindex,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn parameter;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (ts.isConstructorDeclaration(member)) {\n\t\t\tfor (let index = 0; index < member.parameters.length; index++) {\n\t\t\t\tconst parameter = member.parameters[index];\n\t\t\t\tif (\n\t\t\t\t\tisScriptingClassParameterDeclaration(\n\t\t\t\t\t\tscriptingClass,\n\t\t\t\t\t\tmember,\n\t\t\t\t\t\tindex,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn parameter;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport const isScriptingClassParameterDeclaration = (\n\tscriptingClass: ScriptingClass,\n\tmemberNode: ts.ClassElement,\n\tparameterIndex: number,\n) => {\n\tif (scriptingClass.type === \"evaluator\") {\n\t\treturn memberNode?.name?.getText() == \"Create\" && parameterIndex === 2;\n\t}\n\tif (scriptingClass.type === \"interactor\") {\n\t\treturn (\n\t\t\tmemberNode.kind === ts.SyntaxKind.Constructor &&\n\t\t\tparameterIndex === 0\n\t\t);\n\t}\n\treturn false;\n};\n\ninterface ScriptingClass {\n\tnode: ts.ClassDeclaration;\n\ttype: \"interactor\" | \"evaluator\";\n}\n\n/**\n * Finds interactors and evaluators within a script file\n *\n * @param {ts.Node} node\n * @return {*}\n */\nconst findScriptingClasses = (node: ts.Node) => {\n\tlet body: ts.NamespaceBody | ts.JSDocNamespaceBody | undefined;\n\n\tif (ts.isModuleDeclaration(node)) {\n\t\tbody = node.body;\n\t}\n\tif (body !== undefined && ts.isModuleDeclaration(body)) {\n\t\tbody = body.body;\n\t}\n\n\tconst classes: ScriptingClass[] = [];\n\n\tif (body !== undefined) {\n\t\tts.forEachChild(body, (child) => {\n\t\t\tif (!ts.isClassDeclaration(child)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst scriptingClass = detectScriptingClass(child);\n\n\t\t\tif (scriptingClass !== undefined) {\n\t\t\t\tclasses.push(scriptingClass);\n\t\t\t}\n\t\t});\n\t}\n\n\treturn classes;\n};\n\nconst detectScriptingClass = (\n\tnode: ts.ClassDeclaration,\n): ScriptingClass | undefined => {\n\tconst isEvaluator = node.heritageClauses?.some((clause) => {\n\t\tif (\n\t\t\tclause.token !== ts.SyntaxKind.ExtendsKeyword &&\n\t\t\tclause.token !== ts.SyntaxKind.ImplementsKeyword\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn clause.types.some((type) =>\n\t\t\ttype.getText().includes(\"Evaluator\"),\n\t\t);\n\t});\n\n\tif (isEvaluator) {\n\t\treturn {\n\t\t\tnode,\n\t\t\ttype: \"evaluator\",\n\t\t};\n\t}\n\n\tconst isInteractor = node.heritageClauses?.some((clause) => {\n\t\tif (clause.token !== ts.SyntaxKind.ExtendsKeyword) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn clause.types.some((type) =>\n\t\t\ttype.getText().includes(\"Interactor\"),\n\t\t);\n\t});\n\n\tif (isInteractor) {\n\t\treturn {\n\t\t\tnode,\n\t\t\ttype: \"interactor\",\n\t\t};\n\t}\n};\n"],"names":["generateIndex","location","ignore","strictOptional","files","getPackageTypescriptFiles","filtered","filter","path","some","suffix","endsWith","arr","existingIndex","readPackageCreatorIndex","program","ts","createProgram","allowJs","typeChecker","getTypeChecker","forEach","file","sourceFile","getSourceFile","forEachChild","node","scriptingClass","findScriptingClasses","name","undefined","Error","type","getFullyQualifiedName","getSymbolAtLocation","length","parameterDeclaration","getScriptingClassParameterdeclaration","parametersType","getTypeAtLocation","console","log","existingIndexEntry","find","entry","Name","obj","Description","Type","Parameters","rawDocTags","getJSDocTags","dict","getTagDict","summary","comment","symbol","getDocumentationComment","map","text","join","genParameters","getPropertiesOfType","getStringIndexType","push","sort","a","b","localeCompare","writePackageCreatorIndex","capitalizeFirstLetter","string","charAt","toUpperCase","slice","parseDefault","value","uType","parseFloat","parseInt","replace","properties","i","parameter","Default","DisplayIndex","declaration","getDeclarations","documentationComment","checkLinksSymbol","links","syntheticOrigin","creatorType","default","kind","SyntaxKind","PropertySignature","propertySignature","questionToken","Required","tags","tag","tagName","member","members","isMethodDeclaration","index","parameters","isScriptingClassParameterDeclaration","isConstructorDeclaration","memberNode","parameterIndex","getText","Constructor","body","isModuleDeclaration","classes","child","isClassDeclaration","detectScriptingClass","isEvaluator","heritageClauses","clause","token","ExtendsKeyword","ImplementsKeyword","types","includes","isInteractor"],"mappings":";;;;;;;;;;;;;;;;;;;AA0BA;;;;AAIC,IACM,SAASA,aAAc,CAAA,EAC7BC,WACAC,MAAAA,EAAS,EAAE,GACXC,cAAAA,EAAiB,KAAK,GACA,EAAE;AACxB,IAAA,MAAMC,QAAQC,yBAA0BJ,CAAAA,QAAAA,CAAAA,CAAAA;AACxC,IAAA,MAAMK,QAAWF,GAAAA,KAAAA,CAAMG,MAAM,CAAC,CAACC,IAAS,GAAA;QACvC,OAAO,CAACN,OAAOO,IAAI,CAAC,CAACC,MAAWF,GAAAA,IAAAA,CAAKG,QAAQ,CAACD,MAAAA,CAAAA,CAAAA,CAAAA;AAC/C,KAAA,CAAA,CAAA;AACA,IAAA,MAAME,MAA2B,EAAE,CAAA;IAEnC,MAAMC,aAAAA,GAAgBC,uBAAwBb,CAAAA,QAAAA,CAAAA,IAAa,EAAE,CAAA;AAE7D,IAAA,MAAMc,OAAUC,GAAAA,EAAAA,CAAGC,aAAa,CAACX,QAAU,EAAA;AAAEY,QAAAA,OAAAA,EAAS,IAAI;AAAC,KAAA,CAAA,CAAA;IAC3D,MAAMC,WAAAA,GAAcJ,QA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CAAOI,KAAK,CAACrH,IAAI,CAAC,CAACuB,IAAAA,GACzBA,IAAKgF,CAAAA,OAAO,EAAGe,CAAAA,QAAQ,CAAC,WAAA,CAAA,CAAA,CAAA;AAE1B,KAAA,CAAA,CAAA;AAEA,IAAA,IAAIP,WAAa,EAAA;QAChB,OAAO;AACN9F,YAAAA,IAAAA;YACAM,IAAM,EAAA,WAAA;AACP,SAAA,CAAA;KACA;IAED,MAAMgG,YAAAA,GAAetG,CAAAA,sBAAAA,GAAAA,IAAK+F,CAAAA,eAAe,KAApB/F,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,sBAAAA,CAAsBjB,IAAK,CAAA,CAACiH,MAAW,GAAA;AAC3D,QAAA,IAAIA,OAAOC,KAAK,KAAK3G,GAAG+E,UAAU,CAAC6B,cAAc,EAAE;AAClD,YAAA,OAAO,KAAK,CAAA;SACZ;QAED,OAAOF,MAAAA,CAAOI,KAAK,CAACrH,IAAI,CAAC,CAACuB,IAAAA,GACzBA,IAAKgF,CAAAA,OAAO,EAAGe,CAAAA,QAAQ,CAAC,YAAA,CAAA,CAAA,CAAA;AAE1B,KAAA,CAAA,CAAA;AAEA,IAAA,IAAIC,YAAc,EAAA;QACjB,OAAO;AACNtG,YAAAA,IAAAA;YACAM,IAAM,EAAA,YAAA;AACP,SAAA,CAAA;KACA;AACF,CAAA;;;;"}
@@ -0,0 +1,75 @@
1
+ import ts from 'typescript';
2
+ import * as fs from 'fs';
3
+ import * as path from 'path';
4
+ import * as os from 'os';
5
+ import 'resolve';
6
+ import 'write-pkg';
7
+ import { b as readPackageCreatorIndex, r as readPackageCreatorManifest, k as getCreatorIndexParameterPrimaryJSType } from './cli-381989cc.mjs';
8
+ import 'glob';
9
+ import 'node:path';
10
+ import 'node:fs';
11
+ import 'axios';
12
+ import 'update-notifier';
13
+ import 'yargs/yargs';
14
+ import 'url';
15
+ import 'assert';
16
+ import 'events';
17
+ import 'core-js/modules/es.typed-array.set.js';
18
+ import 'util';
19
+ import 'inquirer';
20
+
21
+ const generateParameterType = ({ location , name })=>{
22
+ const index = readPackageCreatorIndex(location);
23
+ const manifest = readPackageCreatorManifest(location);
24
+ if (index === undefined) {
25
+ throw new Error(`Could not find the _Index.json file`);
26
+ }
27
+ let qualifiedName = name;
28
+ let className = name;
29
+ const scope = manifest.Scope ?? manifest.Package;
30
+ if (name.startsWith(scope)) {
31
+ className = name.slice(scope.length + 1);
32
+ } else {
33
+ qualifiedName = `${scope}.${name}`;
34
+ }
35
+ const informations = index.find((item)=>item.Name === qualifiedName);
36
+ if (informations === undefined) {
37
+ throw new Error(`Could not find an index entry for ${name}`);
38
+ }
39
+ const members = [];
40
+ if (informations.Parameters !== undefined) {
41
+ const sortedList = informations.Parameters.slice();
42
+ sortedList.sort((a, b)=>a.DisplayIndex - b.DisplayIndex);
43
+ for (const parameter of sortedList){
44
+ const jsType = getCreatorIndexParameterPrimaryJSType(parameter.Type);
45
+ const type = jsType === "string" ? ts.factory.createTypeReferenceNode("string") : ts.factory.createUnionTypeNode([
46
+ ts.factory.createTypeReferenceNode(jsType),
47
+ ts.factory.createTypeReferenceNode("string")
48
+ ]);
49
+ let propertySignature = ts.factory.createPropertySignature(undefined, parameter.Name, parameter.Required ? undefined : ts.factory.createToken(ts.SyntaxKind.QuestionToken), type);
50
+ const jsdocParts = [];
51
+ if (parameter.Description !== undefined) {
52
+ jsdocParts.push(parameter.Description, "");
53
+ }
54
+ jsdocParts.push(`@creatorType ${parameter.Type}`);
55
+ if (jsType === "string") {
56
+ jsdocParts.push(`@default "${parameter.Default}"`);
57
+ } else {
58
+ jsdocParts.push(`@default ${parameter.Default}`);
59
+ }
60
+ const jsdocContent = jsdocParts.map((part)=>`* ${part}`).join("\n ");
61
+ propertySignature = ts.addSyntheticLeadingComment(propertySignature, ts.SyntaxKind.MultiLineCommentTrivia, `*\n ${jsdocContent}\n `, true);
62
+ members.push(propertySignature);
63
+ }
64
+ }
65
+ const interfaceName = `${className}Params`;
66
+ let interfaceDeclaration = ts.factory.createInterfaceDeclaration(undefined, interfaceName, undefined, undefined, members);
67
+ interfaceDeclaration = ts.addSyntheticLeadingComment(interfaceDeclaration, ts.SyntaxKind.MultiLineCommentTrivia, `*\n * Parameters for the ${className} class\n `, true);
68
+ const printer = ts.createPrinter();
69
+ const content = printer.printNode(ts.EmitHint.Unspecified, interfaceDeclaration, ts.createSourceFile("index.ts", "", ts.ScriptTarget.Latest)).replace(/ /g, "\t");
70
+ const outFile = path.join(location.scriptsDir, `${interfaceName}.txt`);
71
+ fs.writeFileSync(outFile, `Generated parameters interface for ${className}. Insert the interface declaration next to the class and use it as the type for the parameters. Afterwards you can delete this file.` + os.EOL + os.EOL + content);
72
+ };
73
+
74
+ export { generateParameterType };
75
+ //# sourceMappingURL=generateParameterType-4c9e95a5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateParameterType-4c9e95a5.mjs","sources":["../src/commands/generateParameterType.ts"],"sourcesContent":["import ts from \"typescript\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport * as os from \"os\";\n\nimport {\n\tPackageLocation,\n\tgetCreatorIndexParameterPrimaryJSType,\n\treadPackageCreatorIndex,\n\treadPackageCreatorManifest,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nexport interface GenerateParameterTypeOptions {\n\tlocation: PackageLocation;\n\tname: string;\n}\n\nexport const generateParameterType = ({\n\tlocation,\n\tname,\n}: GenerateParameterTypeOptions) => {\n\tconst index = readPackageCreatorIndex(location);\n\tconst manifest = readPackageCreatorManifest(location);\n\n\tif (index === undefined) {\n\t\tthrow new Error(`Could not find the _Index.json file`);\n\t}\n\n\tlet qualifiedName = name;\n\tlet className = name;\n\n\tconst scope = manifest.Scope ?? manifest.Package;\n\n\tif (name.startsWith(scope)) {\n\t\tclassName = name.slice(scope.length + 1);\n\t} else {\n\t\tqualifiedName = `${scope}.${name}`;\n\t}\n\n\tconst informations = index.find((item) => item.Name === qualifiedName);\n\n\tif (informations === undefined) {\n\t\tthrow new Error(`Could not find an index entry for ${name}`);\n\t}\n\n\tconst members: ts.TypeElement[] = [];\n\n\tif (informations.Parameters !== undefined) {\n\t\tconst sortedList = informations.Parameters.slice();\n\t\tsortedList.sort((a, b) => a.DisplayIndex - b.DisplayIndex);\n\n\t\tfor (const parameter of sortedList) {\n\t\t\tconst jsType = getCreatorIndexParameterPrimaryJSType(\n\t\t\t\tparameter.Type,\n\t\t\t);\n\n\t\t\tconst type =\n\t\t\t\tjsType === \"string\"\n\t\t\t\t\t? ts.factory.createTypeReferenceNode(\"string\")\n\t\t\t\t\t: ts.factory.createUnionTypeNode([\n\t\t\t\t\t\t\tts.factory.createTypeReferenceNode(jsType),\n\t\t\t\t\t\t\tts.factory.createTypeReferenceNode(\"string\"),\n\t\t\t\t\t ]);\n\n\t\t\tlet propertySignature = ts.factory.createPropertySignature(\n\t\t\t\tundefined,\n\t\t\t\tparameter.Name,\n\t\t\t\tparameter.Required\n\t\t\t\t\t? undefined\n\t\t\t\t\t: ts.factory.createToken(ts.SyntaxKind.QuestionToken),\n\t\t\t\ttype,\n\t\t\t);\n\n\t\t\tconst jsdocParts: string[] = [];\n\n\t\t\tif (parameter.Description !== undefined) {\n\t\t\t\tjsdocParts.push(parameter.Description, \"\");\n\t\t\t}\n\n\t\t\tjsdocParts.push(`@creatorType ${parameter.Type}`);\n\n\t\t\tif (jsType === \"string\") {\n\t\t\t\tjsdocParts.push(`@default \"${parameter.Default}\"`);\n\t\t\t} else {\n\t\t\t\tjsdocParts.push(`@default ${parameter.Default}`);\n\t\t\t}\n\n\t\t\tconst jsdocContent = jsdocParts\n\t\t\t\t.map((part) => `* ${part}`)\n\t\t\t\t.join(\"\\n \");\n\t\t\tpropertySignature = ts.addSyntheticLeadingComment(\n\t\t\t\tpropertySignature,\n\t\t\t\tts.SyntaxKind.MultiLineCommentTrivia,\n\t\t\t\t`*\\n ${jsdocContent}\\n `,\n\t\t\t\ttrue,\n\t\t\t);\n\n\t\t\tmembers.push(propertySignature);\n\t\t}\n\t}\n\n\tconst interfaceName = `${className}Params`;\n\n\tlet interfaceDeclaration = ts.factory.createInterfaceDeclaration(\n\t\tundefined,\n\t\tinterfaceName,\n\t\tundefined,\n\t\tundefined,\n\t\tmembers,\n\t);\n\n\tinterfaceDeclaration = ts.addSyntheticLeadingComment(\n\t\tinterfaceDeclaration,\n\t\tts.SyntaxKind.MultiLineCommentTrivia,\n\t\t`*\\n * Parameters for the ${className} class\\n `,\n\t\ttrue,\n\t);\n\n\tconst printer = ts.createPrinter();\n\tconst content = printer\n\t\t.printNode(\n\t\t\tts.EmitHint.Unspecified,\n\t\t\tinterfaceDeclaration,\n\t\t\tts.createSourceFile(\"index.ts\", \"\", ts.ScriptTarget.Latest),\n\t\t)\n\t\t.replace(/ /g, \"\\t\");\n\n\tconst outFile = path.join(location.scriptsDir, `${interfaceName}.txt`);\n\n\tfs.writeFileSync(\n\t\toutFile,\n\t\t`Generated parameters interface for ${className}. Insert the interface declaration next to the class and use it as the type for the parameters. Afterwards you can delete this file.` +\n\t\t\tos.EOL +\n\t\t\tos.EOL +\n\t\t\tcontent,\n\t);\n};\n"],"names":["generateParameterType","location","name","index","readPackageCreatorIndex","manifest","readPackageCreatorManifest","undefined","Error","qualifiedName","className","scope","Scope","Package","startsWith","slice","length","informations","find","item","Name","members","Parameters","sortedList","sort","a","b","DisplayIndex","parameter","jsType","getCreatorIndexParameterPrimaryJSType","Type","type","ts","factory","createTypeReferenceNode","createUnionTypeNode","propertySignature","createPropertySignature","Required","createToken","SyntaxKind","QuestionToken","jsdocParts","Description","push","Default","jsdocContent","map","part","join","addSyntheticLeadingComment","MultiLineCommentTrivia","interfaceName","interfaceDeclaration","createInterfaceDeclaration","printer","createPrinter","content","printNode","EmitHint","Unspecified","createSourceFile","ScriptTarget","Latest","replace","outFile","path","scriptsDir","fs","writeFileSync","os","EOL"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiBO,MAAMA,wBAAwB,CAAC,EACrCC,WACAC,IAAAA,GAC8B,G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