@intelligentgraphics/ig.gfx.packager 3.0.21 → 3.0.23

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 (28) hide show
  1. package/build/bin.mjs +1 -1
  2. package/build/{cli-91fabb36.mjs → cli-t3HbtHpD.mjs} +40 -70
  3. package/build/cli-t3HbtHpD.mjs.map +1 -0
  4. package/build/{dependencies-7711a9db.mjs → dependencies-DevWjwri.mjs} +2 -2
  5. package/build/{dependencies-7711a9db.mjs.map → dependencies-DevWjwri.mjs.map} +1 -1
  6. package/build/{generateIndex-47c082d0.mjs → generateIndex-BtHP1bP3.mjs} +4 -4
  7. package/build/{generateIndex-47c082d0.mjs.map → generateIndex-BtHP1bP3.mjs.map} +1 -1
  8. package/build/{generateParameterType-10d124a6.mjs → generateParameterType-DyylDiF2.mjs} +3 -3
  9. package/build/{generateParameterType-10d124a6.mjs.map → generateParameterType-DyylDiF2.mjs.map} +1 -1
  10. package/build/{index-e6ead55c.mjs → index-C3Hd8xoM.mjs} +57 -42
  11. package/build/index-C3Hd8xoM.mjs.map +1 -0
  12. package/build/{index-ca04836f.mjs → index-CNupsFSp.mjs} +187 -182
  13. package/build/index-CNupsFSp.mjs.map +1 -0
  14. package/build/{postinstall-0ea76778.mjs → postinstall-D2hLZlaK.mjs} +3 -3
  15. package/build/{postinstall-0ea76778.mjs.map → postinstall-D2hLZlaK.mjs.map} +1 -1
  16. package/build/{publishNpm-aadd7dc2.mjs → publishNpm-h9T6BVws.mjs} +13 -7
  17. package/build/publishNpm-h9T6BVws.mjs.map +1 -0
  18. package/build/{scripts-7ed8dff6.mjs → scripts-EvIjiH6G.mjs} +1 -1
  19. package/build/{scripts-7ed8dff6.mjs.map → scripts-EvIjiH6G.mjs.map} +1 -1
  20. package/build/{versionFile-ad981e93.mjs → versionFile-7rrD5z3c.mjs} +7 -11
  21. package/build/{versionFile-ad981e93.mjs.map → versionFile-7rrD5z3c.mjs.map} +1 -1
  22. package/lib/lib.mjs +243 -228
  23. package/package.json +12 -12
  24. package/readme.md +28 -0
  25. package/build/cli-91fabb36.mjs.map +0 -1
  26. package/build/index-ca04836f.mjs.map +0 -1
  27. package/build/index-e6ead55c.mjs.map +0 -1
  28. package/build/publishNpm-aadd7dc2.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"dependencies-7711a9db.mjs","sources":["../../tools.core/build/publishedPackage.mjs","../../tools.core/build/dependencies.mjs"],"sourcesContent":["import * as path from 'path';\nimport * as fs from 'fs';\nimport resolve from 'resolve';\nimport { readNpmManifest } from './npmPackage.mjs';\nimport { PACKAGE_FILE, INDEX_FILE } from './package.mjs';\nimport { isErrorENOENT } from './error.mjs';\nimport { stripUtf8Bom } from './stripUtf8Bom.mjs';\n\n/**\n * Detects a published package from a path.\n *\n * Can return undefined if the package is not installed.\n *\n * @param {string} resolveBasePath\n * @param {string} name\n * @return {*} {(PublishedPackageLocation | undefined)}\n */ const detectPublishedPackageFromPath = (resolveBasePath, name)=>{\n try {\n const manifestPath = resolve.sync(name + \"/package.json\", {\n basedir: resolveBasePath\n });\n const dir = path.dirname(manifestPath);\n return {\n _kind: \"PublishedPackageLocation\",\n path: dir\n };\n } catch (err) {\n return undefined;\n }\n};\nconst readPublishedPackageNpmManifest = (location)=>{\n return readNpmManifest(location.path);\n};\nconst readPublishedPackageCreatorManifest = (location)=>{\n try {\n const packageJsonPath = path.join(location.path, PACKAGE_FILE);\n const packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, {\n encoding: \"utf8\"\n }));\n return JSON.parse(packageJson);\n } catch (err) {\n if (isErrorENOENT(err)) {\n return undefined;\n }\n throw err;\n }\n};\nconst getPublishedPackageCreatorIndexPath = (location)=>path.join(location.path, INDEX_FILE);\nconst readPublishedPackageCreatorIndex = (location)=>{\n try {\n const packageJsonPath = path.join(location.path, INDEX_FILE);\n const packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, {\n encoding: \"utf8\"\n }));\n const result = JSON.parse(packageJson);\n return result;\n } catch (err) {\n if (isErrorENOENT(err)) {\n return undefined;\n }\n throw err;\n }\n};\n\nexport { detectPublishedPackageFromPath, getPublishedPackageCreatorIndexPath, readPublishedPackageCreatorIndex, readPublishedPackageCreatorManifest, readPublishedPackageNpmManifest };\n//# sourceMappingURL=publishedPackage.mjs.map\n","import { readPublishedPackageNpmManifest, detectPublishedPackageFromPath } from './publishedPackage.mjs';\nimport { readWorkspaceNpmManifest } from './workspace.mjs';\n\n// /**\n// * Determines the implicit dependencies of a an actual data workspace package.\n// *\n// * An implicit dependency is a dependency that is installed for the workspace and has the same runtime environment (evaluator, interactor) as the package.\n// *\n// * @param {WorkspaceLocation} workspace\n// * @param {CreatorPackage} creatorPackage\n// * @returns {PublishedPackageLocation[]}\n// */\n// export const determinePackageImplicitDependencies = (\n// \tworkspace: WorkspaceLocation,\n// \tcreatorPackage: CreatorPackage,\n// ): PublishedPackageLocation[] => {\n// \tconst libraries = determineWorkspaceIGLibraries(workspace);\n// \tconst results: PublishedPackageLocation[] = [];\n// \tfor (const librarylocation of libraries) {\n// \t\tconst libraryManifest =\n// \t\t\treadPublishedPackageCreatorManifest(librarylocation);\n// \t\tif (\n// \t\t\tlibraryManifest !== undefined &&\n// \t\t\t(libraryManifest.Type === \"Mixed\" ||\n// \t\t\t\tlibraryManifest.RunTime === creatorPackage.RunTime)\n// \t\t) {\n// \t\t\tresults.push(librarylocation);\n// \t\t}\n// \t}\n// \treturn results;\n// };\n/**\n * Recursively determines all installed ig libraries for a workspace.\n *\n * @param {WorkspaceLocation} workspace\n * @returns {PublishedPackageLocation[]}\n */ const determineWorkspaceIGLibraries = (workspace)=>{\n const manifest = readWorkspaceNpmManifest(workspace);\n const libraries = collectIGLibraries(workspace, manifest);\n const results = new Map();\n for (const location of libraries){\n const manifest = readPublishedPackageNpmManifest(location);\n if (!results.has(manifest.name)) {\n results.set(manifest.name, location);\n }\n }\n return Array.from(results.values());\n};\nconst collectIGLibraries = (workspace, manifest)=>{\n if (!manifest.dependencies) {\n return [];\n }\n const runtimeDependencies = Object.getOwnPropertyNames(manifest.dependencies);\n const result = [];\n for (const runtimeDependency of runtimeDependencies){\n var _runtimeManifest_ig;\n const location = detectPublishedPackageFromPath(workspace.path, runtimeDependency);\n if (location === undefined) {\n continue;\n }\n const runtimeManifest = readPublishedPackageNpmManifest(location);\n // packages need to explicitly be marked as ig scriptingLibraries\n if ((_runtimeManifest_ig = runtimeManifest.ig) == null ? void 0 : _runtimeManifest_ig.scriptingLibrary) {\n result.push(location);\n result.push(...collectIGLibraries(workspace, runtimeManifest));\n }\n }\n return result;\n};\n\nexport { determineWorkspaceIGLibraries };\n//# sourceMappingURL=dependencies.mjs.map\n"],"names":["detectPublishedPackageFromPath","resolveBasePath","name","manifestPath","resolve","sync","basedir","dir","path","dirname","_kind","err","undefined","readPublishedPackageNpmManifest","location","readNpmManifest","readPublishedPackageCreatorManifest","packageJsonPath","join","PACKAGE_FILE","packageJson","stripUtf8Bom","fs","readFileSync","encoding","JSON","parse","isErrorENOENT","readPublishedPackageCreatorIndex","INDEX_FILE","result","determineWorkspaceIGLibraries","workspace","manifest","readWorkspaceNpmManifest","libraries","collectIGLibraries","results","Map","has","set","Array","from","values","dependencies","runtimeDependencies","Object","getOwnPropertyNames","runtimeDependency","_runtimeManifest_ig","runtimeManifest","ig","scriptingLibrary","push"],"mappings":";;;;;AAQA;;;;;;;;AAQC,IAAG,MAAMA,8BAAAA,GAAiC,CAACC,eAAAA,EAAiBC,IAAO,GAAA;IAChE,IAAI;AACA,QAAA,MAAMC,YAAeC,GAAAA,OAAAA,CAAQC,IAAI,CAACH,OAAO,eAAiB,EAAA;YACtDI,OAASL,EAAAA,eAAAA;AACb,SAAA,CAAA,CAAA;QACA,MAAMM,GAAAA,GAAMC,IAAKC,CAAAA,OAAO,CAACN,YAAAA,CAAAA,CAAAA;QACzB,OAAO;YACHO,KAAO,EAAA,0BAAA;YACPF,IAAMD,EAAAA,GAAAA;AACV,SAAA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AAMnC,QAAWd,GAAAA,8BAAAA,CAA+BgC,SAAUxB,CAAAA,IAAI,EAAEwC,iBAAAA,CAAAA,CAAAA;AAChE,QAAA,IAAIlC,aAAaF,SAAW,EAAA;YACxB,SAAS;SACZ;AACD,QAAA,MAAMsC,kBAAkBrC,+BAAgCC,CAAAA,QAAAA,CAAAA,CAAAA;;AAExD,QAAA,IAAI,CAACmC,mBAAsBC,GAAAA,eAAAA,CAAgBC,EAAC,KAAM,IAAI,GAAG,KAAK,CAAIF,GAAAA,mBAAAA,CAAoBG,gBAAgB,EAAE;AACpGtB,YAAAA,MAAAA,CAAOuB,IAAI,CAACvC,QAAAA,CAAAA,CAAAA;YACZgB,MAAOuB,CAAAA,IAAI,CAAIjB,GAAAA,kBAAAA,CAAmBJ,SAAWkB,EAAAA,eAAAA,CAAAA,CAAAA,CAAAA;SAChD;AACL,KAAA;IACA,OAAOpB,MAAAA,CAAAA;AACX,CAAA;;;;"}
1
+ {"version":3,"file":"dependencies-DevWjwri.mjs","sources":["../../tools.core/build/publishedPackage.mjs","../../tools.core/build/dependencies.mjs"],"sourcesContent":["import * as path from 'path';\nimport * as fs from 'fs';\nimport resolve from 'resolve';\nimport { readNpmManifest } from './npmPackage.mjs';\nimport { PACKAGE_FILE, INDEX_FILE } from './package.mjs';\nimport { isErrorENOENT } from './error.mjs';\nimport { stripUtf8Bom } from './stripUtf8Bom.mjs';\n\n/**\n * Detects a published package from a path.\n *\n * Can return undefined if the package is not installed.\n *\n * @param {string} resolveBasePath\n * @param {string} name\n * @return {*} {(PublishedPackageLocation | undefined)}\n */ const detectPublishedPackageFromPath = (resolveBasePath, name)=>{\n try {\n const manifestPath = resolve.sync(name + \"/package.json\", {\n basedir: resolveBasePath\n });\n const dir = path.dirname(manifestPath);\n return {\n _kind: \"PublishedPackageLocation\",\n path: dir\n };\n } catch (err) {\n return undefined;\n }\n};\nconst readPublishedPackageNpmManifest = (location)=>{\n return readNpmManifest(location.path);\n};\nconst readPublishedPackageCreatorManifest = (location)=>{\n try {\n const packageJsonPath = path.join(location.path, PACKAGE_FILE);\n const packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, {\n encoding: \"utf8\"\n }));\n return JSON.parse(packageJson);\n } catch (err) {\n if (isErrorENOENT(err)) {\n return undefined;\n }\n throw err;\n }\n};\nconst getPublishedPackageCreatorIndexPath = (location)=>path.join(location.path, INDEX_FILE);\nconst readPublishedPackageCreatorIndex = (location)=>{\n try {\n const packageJsonPath = path.join(location.path, INDEX_FILE);\n const packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, {\n encoding: \"utf8\"\n }));\n const result = JSON.parse(packageJson);\n return result;\n } catch (err) {\n if (isErrorENOENT(err)) {\n return undefined;\n }\n throw err;\n }\n};\n\nexport { detectPublishedPackageFromPath, getPublishedPackageCreatorIndexPath, readPublishedPackageCreatorIndex, readPublishedPackageCreatorManifest, readPublishedPackageNpmManifest };\n//# sourceMappingURL=publishedPackage.mjs.map\n","import { readPublishedPackageNpmManifest, detectPublishedPackageFromPath } from './publishedPackage.mjs';\nimport { readWorkspaceNpmManifest } from './workspace.mjs';\n\n// /**\n// * Determines the implicit dependencies of a an actual data workspace package.\n// *\n// * An implicit dependency is a dependency that is installed for the workspace and has the same runtime environment (evaluator, interactor) as the package.\n// *\n// * @param {WorkspaceLocation} workspace\n// * @param {CreatorPackage} creatorPackage\n// * @returns {PublishedPackageLocation[]}\n// */\n// export const determinePackageImplicitDependencies = (\n// \tworkspace: WorkspaceLocation,\n// \tcreatorPackage: CreatorPackage,\n// ): PublishedPackageLocation[] => {\n// \tconst libraries = determineWorkspaceIGLibraries(workspace);\n// \tconst results: PublishedPackageLocation[] = [];\n// \tfor (const librarylocation of libraries) {\n// \t\tconst libraryManifest =\n// \t\t\treadPublishedPackageCreatorManifest(librarylocation);\n// \t\tif (\n// \t\t\tlibraryManifest !== undefined &&\n// \t\t\t(libraryManifest.Type === \"Mixed\" ||\n// \t\t\t\tlibraryManifest.RunTime === creatorPackage.RunTime)\n// \t\t) {\n// \t\t\tresults.push(librarylocation);\n// \t\t}\n// \t}\n// \treturn results;\n// };\n/**\n * Recursively determines all installed ig libraries for a workspace.\n *\n * @param {WorkspaceLocation} workspace\n * @returns {PublishedPackageLocation[]}\n */ const determineWorkspaceIGLibraries = (workspace)=>{\n const manifest = readWorkspaceNpmManifest(workspace);\n const libraries = collectIGLibraries(workspace, manifest);\n const results = new Map();\n for (const location of libraries){\n const manifest = readPublishedPackageNpmManifest(location);\n if (!results.has(manifest.name)) {\n results.set(manifest.name, location);\n }\n }\n return Array.from(results.values());\n};\nconst collectIGLibraries = (workspace, manifest)=>{\n if (!manifest.dependencies) {\n return [];\n }\n const runtimeDependencies = Object.getOwnPropertyNames(manifest.dependencies);\n const result = [];\n for (const runtimeDependency of runtimeDependencies){\n var _runtimeManifest_ig;\n const location = detectPublishedPackageFromPath(workspace.path, runtimeDependency);\n if (location === undefined) {\n continue;\n }\n const runtimeManifest = readPublishedPackageNpmManifest(location);\n // packages need to explicitly be marked as ig scriptingLibraries\n if ((_runtimeManifest_ig = runtimeManifest.ig) == null ? void 0 : _runtimeManifest_ig.scriptingLibrary) {\n result.push(location);\n result.push(...collectIGLibraries(workspace, runtimeManifest));\n }\n }\n return result;\n};\n\nexport { determineWorkspaceIGLibraries };\n//# sourceMappingURL=dependencies.mjs.map\n"],"names":["detectPublishedPackageFromPath","resolveBasePath","name","manifestPath","resolve","sync","basedir","dir","path","dirname","_kind","err","undefined","readPublishedPackageNpmManifest","location","readNpmManifest","readPublishedPackageCreatorManifest","packageJsonPath","join","PACKAGE_FILE","packageJson","stripUtf8Bom","fs","readFileSync","encoding","JSON","parse","isErrorENOENT","readPublishedPackageCreatorIndex","INDEX_FILE","result","determineWorkspaceIGLibraries","workspace","manifest","readWorkspaceNpmManifest","libraries","collectIGLibraries","results","Map","has","set","Array","from","values","dependencies","runtimeDependencies","Object","getOwnPropertyNames","runtimeDependency","_runtimeManifest_ig","runtimeManifest","ig","scriptingLibrary","push"],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AAA;AACpC,EAAA;AACA,MAAMP,kBAAAA,GAAqB,CAACJ,SAAWC,EAAAA,QAAAA,GAAAA;IACnC,IAAI,CAACA,QAASW,CAAAA,YAAY,EAAE;AACxB,QAAA,OAAO,EAAE,CAAA;AACb,KAAA;AACA,IAAA,MAAMC,mBAAsBC,GAAAA,MAAAA,CAAOC,mBAAmB,CAACd,SAASW,YAAY,CAAA,CAAA;AAC5E,IAAA,MAAMd,SAAS,EAAE,CAAA;IACjB,KAAK,MAAMkB,qBAAqBH,mBAAoB,CAAA;QAChD,IAAII,mBAAAA,CAAAA;AACJ,QAAA,MAAMnC,QAAWd,GAAAA,8BAAAA,CAA+BgC,SAAUxB,CAAAA,IAAI,EAAEwC,iBAAAA,CAAAA,CAAAA;AAChE,QAAA,IAAIlC,aAAaF,SAAW,EAAA;AACxB,YAAA,SAAA;AACJ,SAAA;AACA,QAAA,MAAMsC,kBAAkBrC,+BAAgCC,CAAAA,QAAAA,CAAAA,CAAAA;;AAExD,QAAA,IAAI,CAACmC,mBAAsBC,GAAAA,eAAAA,CAAgBC,EAAC,KAAM,IAAA,GAAO,KAAK,CAAA,GAAIF,mBAAoBG,CAAAA,gBAAgB,EAAE;AACpGtB,YAAAA,MAAAA,CAAOuB,IAAI,CAACvC,QAAAA,CAAAA,CAAAA;YACZgB,MAAOuB,CAAAA,IAAI,CAAIjB,GAAAA,kBAAAA,CAAmBJ,SAAWkB,EAAAA,eAAAA,CAAAA,CAAAA,CAAAA;AACjD,SAAA;AACJ,KAAA;IACA,OAAOpB,MAAAA,CAAAA;AACX,CAAA;;;;"}
@@ -3,8 +3,8 @@ import 'path';
3
3
  import 'fs';
4
4
  import 'resolve';
5
5
  import 'write-pkg';
6
- import { a as readPackageCreatorIndex, k as writePackageCreatorIndex } from './cli-91fabb36.mjs';
7
- import { g as getPackageTypescriptFiles } from './scripts-7ed8dff6.mjs';
6
+ import { a as readPackageCreatorIndex, k as writePackageCreatorIndex } from './cli-t3HbtHpD.mjs';
7
+ import { g as getPackageTypescriptFiles } from './scripts-EvIjiH6G.mjs';
8
8
  import 'node:path';
9
9
  import 'node:fs';
10
10
  import 'axios';
@@ -22,7 +22,7 @@ import 'inquirer';
22
22
  * Extracts and returns script array for _Index.json from a src folder
23
23
  *
24
24
  * @param folderPath path to a src folder
25
- */ function generateIndex({ location , ignore =[] , strictOptional =false }) {
25
+ */ function generateIndex({ location, ignore = [], strictOptional = false }) {
26
26
  const files = getPackageTypescriptFiles(location);
27
27
  const filtered = files.filter((path)=>{
28
28
  return !ignore.some((suffix)=>path.endsWith(suffix));
@@ -293,4 +293,4 @@ const detectScriptingClass = (node)=>{
293
293
  };
294
294
 
295
295
  export { generateIndex };
296
- //# sourceMappingURL=generateIndex-47c082d0.mjs.map
296
+ //# sourceMappingURL=generateIndex-BtHP1bP3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateIndex-47c082d0.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 ?? name,\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 = parseParametersList(\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\nconst 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\nconst parseTypeFromName = (\n\tname: string,\n): CreatorIndexParameterType | undefined => {\n\tconst parts = name.split(\".\");\n\tconst identifier = parts[parts.length - 1];\n\n\tswitch (identifier) {\n\t\tcase \"LengthM\":\n\t\tcase \"ArcDEG\":\n\t\tcase \"Float\":\n\t\tcase \"Integer\":\n\t\t\treturn identifier;\n\t\tcase \"GeometryReference\":\n\t\t\treturn \"Geometry\";\n\t\tcase \"MaterialReference\":\n\t\t\treturn \"Material\";\n\t\tcase \"AnimationReference\":\n\t\t\treturn \"Animation\";\n\t\tcase \"InteractorReference\":\n\t\t\treturn \"Interactor\";\n\t\tcase \"EvaluatorReference\":\n\t\t\treturn \"Evaluator\";\n\t\tcase \"String\":\n\t\tcase \"string\":\n\t\t\treturn \"String\";\n\t\tcase \"number\":\n\t\tcase \"Number\":\n\t\t\treturn \"Float\";\n\t\tcase \"boolean\":\n\t\tcase \"Boolean\":\n\t\t\treturn \"Boolean\";\n\t}\n};\n\nconst parseParametersList = (\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} else {\n\t\t\t\tconst propertySignature = declaration as ts.PropertySignature;\n\t\t\t\tif (propertySignature.type !== undefined) {\n\t\t\t\t\tconst parsedType = parseTypeFromName(\n\t\t\t\t\t\tpropertySignature.type.getText(),\n\t\t\t\t\t);\n\n\t\t\t\t\tif (parsedType !== undefined) {\n\t\t\t\t\t\tparameter.Type = parsedType;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\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\nconst 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","parseParametersList","getPropertiesOfType","getStringIndexType","push","sort","a","b","localeCompare","writePackageCreatorIndex","capitalizeFirstLetter","string","charAt","toUpperCase","slice","parseDefault","value","uType","parseFloat","parseInt","replace","parseTypeFromName","parts","split","identifier","properties","i","parameter","Default","DisplayIndex","declaration","getDeclarations","documentationComment","checkLinksSymbol","links","syntheticOrigin","creatorType","propertySignature","parsedType","getText","default","kind","SyntaxKind","PropertySignature","questionToken","Required","tags","tag","tagName","member","members","isMethodDeclaration","index","parameters","isScriptingClassParameterDeclaration","isConstructorDeclaration","memberNode","parameterIndex","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,MAAM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AAA,IAAIC,YAAc,EAAA;QACjB,OAAO;AACN3G,YAAAA,IAAAA;YACAM,IAAM,EAAA,YAAA;AACP,SAAA,CAAA;KACA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"generateIndex-BtHP1bP3.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 ?? name,\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 = parseParametersList(\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\nconst 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\nconst parseTypeFromName = (\n\tname: string,\n): CreatorIndexParameterType | undefined => {\n\tconst parts = name.split(\".\");\n\tconst identifier = parts[parts.length - 1];\n\n\tswitch (identifier) {\n\t\tcase \"LengthM\":\n\t\tcase \"ArcDEG\":\n\t\tcase \"Float\":\n\t\tcase \"Integer\":\n\t\t\treturn identifier;\n\t\tcase \"GeometryReference\":\n\t\t\treturn \"Geometry\";\n\t\tcase \"MaterialReference\":\n\t\t\treturn \"Material\";\n\t\tcase \"AnimationReference\":\n\t\t\treturn \"Animation\";\n\t\tcase \"InteractorReference\":\n\t\t\treturn \"Interactor\";\n\t\tcase \"EvaluatorReference\":\n\t\t\treturn \"Evaluator\";\n\t\tcase \"String\":\n\t\tcase \"string\":\n\t\t\treturn \"String\";\n\t\tcase \"number\":\n\t\tcase \"Number\":\n\t\t\treturn \"Float\";\n\t\tcase \"boolean\":\n\t\tcase \"Boolean\":\n\t\t\treturn \"Boolean\";\n\t}\n};\n\nconst parseParametersList = (\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} else {\n\t\t\t\tconst propertySignature = declaration as ts.PropertySignature;\n\t\t\t\tif (propertySignature.type !== undefined) {\n\t\t\t\t\tconst parsedType = parseTypeFromName(\n\t\t\t\t\t\tpropertySignature.type.getText(),\n\t\t\t\t\t);\n\n\t\t\t\t\tif (parsedType !== undefined) {\n\t\t\t\t\t\tparameter.Type = parsedType;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\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\nconst 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","parseParametersList","getPropertiesOfType","getStringIndexType","push","sort","a","b","localeCompare","writePackageCreatorIndex","capitalizeFirstLetter","string","charAt","toUpperCase","slice","parseDefault","value","uType","parseFloat","parseInt","replace","parseTypeFromName","parts","split","identifier","properties","i","parameter","Default","DisplayIndex","declaration","getDeclarations","documentationComment","checkLinksSymbol","links","syntheticOrigin","creatorType","propertySignature","parsedType","getText","default","kind","SyntaxKind","PropertySignature","questionToken","Required","tags","tag","tagName","member","members","isMethodDeclaration","index","parameters","isScriptingClassParameterDeclaration","isConstructorDeclaration","memberNode","parameterIndex","Constructor","body","isModuleDeclaration","classes","child","isClassDeclaration","detectScriptingClass","isEvaluator","heritageClauses","clause","token","ExtendsKeyword","ImplementsKeyword","types","includes","isInteractor"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA;;;;IAKO,SAASA,aAAAA,CAAc,EAC7BC,QAAQ,EACRC,MAAAA,GAAS,EAAE,EACXC,cAAiB,GAAA,KAAK,EACA,EAAA;AACtB,IAAA,MAAMC,QAAQC,yBAA0BJ,CAAAA,QAAAA,CAAAA,CAAAA;AACxC,IAAA,MAAMK,QAAWF,GAAAA,KAAAA,CAAMG,MAAM,CAAC,CAACC,IAAAA,GAAAA;QAC9B,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,IAA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CA,MAAOC,CAAAA,KAAK,KAAKhH,EAAAA,CAAGsF,UAAU,CAAC2B,cAAc,IAC7CF,MAAAA,CAAOC,KAAK,KAAKhH,EAAAA,CAAGsF,UAAU,CAAC4B,iBAAiB,EAC/C;YACD,OAAO,KAAA,CAAA;AACR,SAAA;QAEA,OAAOH,MAAAA,CAAOI,KAAK,CAAC1H,IAAI,CAAC,CAACuB,IAAAA,GACzBA,IAAKmE,CAAAA,OAAO,EAAGiC,CAAAA,QAAQ,CAAC,WAAA,CAAA,CAAA,CAAA;AAE1B,KAAA,CAAA,CAAA;AAEA,IAAA,IAAIP,WAAa,EAAA;QAChB,OAAO;AACNnG,YAAAA,IAAAA;YACAM,IAAM,EAAA,WAAA;AACP,SAAA,CAAA;AACD,KAAA;IAEA,MAAMqG,YAAAA,GAAAA,CAAe3G,yBAAAA,IAAKoG,CAAAA,eAAe,qBAApBpG,sBAAsBjB,CAAAA,IAAI,CAAC,CAACsH,MAAAA,GAAAA;AAChD,QAAA,IAAIA,OAAOC,KAAK,KAAKhH,GAAGsF,UAAU,CAAC2B,cAAc,EAAE;YAClD,OAAO,KAAA,CAAA;AACR,SAAA;QAEA,OAAOF,MAAAA,CAAOI,KAAK,CAAC1H,IAAI,CAAC,CAACuB,IAAAA,GACzBA,IAAKmE,CAAAA,OAAO,EAAGiC,CAAAA,QAAQ,CAAC,YAAA,CAAA,CAAA,CAAA;AAE1B,KAAA,CAAA,CAAA;AAEA,IAAA,IAAIC,YAAc,EAAA;QACjB,OAAO;AACN3G,YAAAA,IAAAA;YACAM,IAAM,EAAA,YAAA;AACP,SAAA,CAAA;AACD,KAAA;AACD,CAAA;;;;"}
@@ -4,7 +4,7 @@ import * as path from 'path';
4
4
  import * as os from 'os';
5
5
  import 'resolve';
6
6
  import 'write-pkg';
7
- import { a as readPackageCreatorIndex, r as readPackageCreatorManifest, l as getCreatorIndexParameterPrimaryJSType } from './cli-91fabb36.mjs';
7
+ import { a as readPackageCreatorIndex, r as readPackageCreatorManifest, l as getCreatorIndexParameterPrimaryJSType } from './cli-t3HbtHpD.mjs';
8
8
  import 'glob';
9
9
  import 'node:path';
10
10
  import 'node:fs';
@@ -18,7 +18,7 @@ import 'core-js/modules/es.typed-array.set.js';
18
18
  import 'util';
19
19
  import 'inquirer';
20
20
 
21
- const generateParameterType = ({ location , name })=>{
21
+ const generateParameterType = ({ location, name })=>{
22
22
  const index = readPackageCreatorIndex(location);
23
23
  const manifest = readPackageCreatorManifest(location);
24
24
  if (index === undefined) {
@@ -72,4 +72,4 @@ const generateParameterType = ({ location , name })=>{
72
72
  };
73
73
 
74
74
  export { generateParameterType };
75
- //# sourceMappingURL=generateParameterType-10d124a6.mjs.map
75
+ //# sourceMappingURL=generateParameterType-DyylDiF2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateParameterType-10d124a6.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,GAAK;AACnC,IAAA,MAAMC,QAA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AAA,IAAI,CAAC,CAAA,CAAA;AAErEgB,IAAAA,EAAAA,CAAGC,aAAa,CACfJ,OACA,EAAA,CAAC,mCAAmC,EAAExD,SAAAA,CAAU,oIAAoI,CAAC,GACpL6D,EAAGC,CAAAA,GAAG,GACND,EAAAA,CAAGC,GAAG,GACNd,OAAAA,CAAAA,CAAAA;AAEH;;;;"}
1
+ {"version":3,"file":"generateParameterType-DyylDiF2.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":";;;;;;;;;;;;;;;;;;;;MAiBaA,qBAAwB,GAAA,CAAC,EACrCC,QAAQ,EACRC,IAAI,EAC0B,GAAA;AAC9B,IAAA,MAAMC,QAAQC,uBAAwBH,CAAAA,QAAAA,CAAAA,CAAAA;AACtC,IAAA,MAAMI,WAAWC,0BAA2BL,CAAAA,QAAAA,CAAAA,CAAAA;AAE5C,IAAA,IAAIE,UAAUI,SAAW,EAAA;AACxB,QAAA,MAAM,IAAIC,KAAAA,CAAM,CAAC,mCAAmC,CAAC,CAAA,CAAA;AACtD,KAAA;AAEA,IAAA,IAAIC,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AA;AAEH;;;;"}
@@ -4,27 +4,43 @@ import * as terser from 'terser';
4
4
  import * as fs from 'fs';
5
5
  import 'resolve';
6
6
  import 'write-pkg';
7
- import { c as readPackageAnimationList, r as readPackageCreatorManifest, i as isErrorENOENT, q as readPackageNpmManifest } from './cli-91fabb36.mjs';
7
+ import { e as readPackageAnimationList, r as readPackageCreatorManifest, i as isErrorENOENT, q as readPackageNpmManifest } from './cli-t3HbtHpD.mjs';
8
8
  import glob from 'glob';
9
9
  import 'node:path';
10
10
  import 'node:fs';
11
11
  import 'axios';
12
12
  import ts from 'typescript';
13
- import { g as getPackageTypescriptFiles } from './scripts-7ed8dff6.mjs';
13
+ import { g as getPackageTypescriptFiles } from './scripts-EvIjiH6G.mjs';
14
14
  import typedoc from 'typedoc';
15
15
  import require$$2 from 'events';
16
16
  import { SourceMapGenerator, SourceMapConsumer } from 'source-map-js';
17
17
  import Ajv from 'ajv';
18
+ import { EOL } from 'os';
18
19
 
19
- const logPackageMessage = (name, step, index, total, maxNameLength = 15)=>{
20
+ const consoleReporter = {
21
+ log (message) {
22
+ console.log(message);
23
+ },
24
+ error (message, _error) {
25
+ console.error(message);
26
+ }
27
+ };
28
+ const createPackageScopedReporter = (reporter, scope, index, total, maxNameLength = 15)=>{
20
29
  const numLength = total === undefined ? undefined : total.toString().length;
21
30
  const indexString = total === undefined || total < 2 ? "" : `${index.toString().padStart(numLength, "0")}/${total} `;
22
- const identifierString = `${indexString}${name.padEnd(maxNameLength)}`;
23
- console.log(`${identifierString} >> ${step}`);
31
+ const identifierString = `${indexString}${scope.padEnd(maxNameLength)}`;
32
+ return {
33
+ log (message) {
34
+ reporter.log(`${identifierString} >> ${message}`);
35
+ },
36
+ error (message, error) {
37
+ reporter.error(`${identifierString} >> ${message}`, error);
38
+ }
39
+ };
24
40
  };
25
41
 
26
42
  const tryReadTsConfig = (location)=>{
27
- const { config } = ts.readConfigFile(path.join(location.scriptsDir, "tsconfig.json"), (path)=>{
43
+ const { config } = ts.readConfigFile(path.join(location.scriptsDir, "tsconfig.json"), (path)=>{
28
44
  try {
29
45
  return fs.readFileSync(path, "utf8");
30
46
  } catch {
@@ -50,6 +66,7 @@ const createTSCBuildParticipant = (location, outputDir)=>(env)=>{
50
66
  }
51
67
  try {
52
68
  env.onBuildStart();
69
+ env.log("Compiling typescript files");
53
70
  const compilerOptions = getCompilerOptions(location, outputDir);
54
71
  const host = ts.createCompilerHost(compilerOptions);
55
72
  host.getCurrentDirectory = ()=>location.scriptsDir;
@@ -75,7 +92,7 @@ const createTSCBuildParticipant = (location, outputDir)=>(env)=>{
75
92
  const allDiagnostics = ts.getPreEmitDiagnostics(program);
76
93
  if (!emitResult.emitSkipped) {
77
94
  if (allDiagnostics.length > 0) {
78
- console.log(allDiagnostics.map(createErrorMessage).join("\n"));
95
+ console.log(ts.formatDiagnostics(allDiagnostics, host));
79
96
  }
80
97
  if (js === undefined || definitions === undefined) {
81
98
  throw new Error(`Unexpected: no js or definitions were created`);
@@ -89,7 +106,7 @@ const createTSCBuildParticipant = (location, outputDir)=>(env)=>{
89
106
  }
90
107
  });
91
108
  } else {
92
- const error = allDiagnostics.map(createErrorMessage).join("\n");
109
+ const error = ts.formatDiagnostics(allDiagnostics, host);
93
110
  throw new Error(error);
94
111
  }
95
112
  } catch (err) {
@@ -103,7 +120,7 @@ const createTSCBuildParticipant = (location, outputDir)=>(env)=>{
103
120
  };
104
121
  };
105
122
  const createTSCWatchBuildParticipant = (location, outputDir)=>{
106
- return ({ onBuildStart , onBuildEnd })=>{
123
+ return ({ onBuildStart, onBuildEnd })=>{
107
124
  let state = {
108
125
  diagnostics: [],
109
126
  js: undefined,
@@ -122,7 +139,7 @@ const createTSCWatchBuildParticipant = (location, outputDir)=>{
122
139
  }
123
140
  }
124
141
  };
125
- const reportDiagnostic = (diagnostic)=>{
142
+ const registerDiagnostic = (diagnostic)=>{
126
143
  switch(diagnostic.code){
127
144
  // file not found - https://github.com/microsoft/TypeScript/blob/93e6b9da0c4cb164ca90a5a1b07415e81e97f2b1/src/compiler/diagnosticMessages.json#L4640
128
145
  // probably deleted -> ignore
@@ -157,7 +174,7 @@ const createTSCWatchBuildParticipant = (location, outputDir)=>{
157
174
  sourceMap: undefined
158
175
  };
159
176
  if (emitState.diagnostics.length > 0) {
160
- const message = emitState.diagnostics.map(createErrorMessage).join("\n");
177
+ const message = ts.formatDiagnostics(emitState.diagnostics, formattingHost);
161
178
  onBuildEnd({
162
179
  type: "error",
163
180
  error: message
@@ -184,7 +201,12 @@ const createTSCWatchBuildParticipant = (location, outputDir)=>{
184
201
  break;
185
202
  }
186
203
  };
187
- const host = ts.createWatchCompilerHost(path.join(location.scriptsDir, "tsconfig.json"), getCompilerOptions(location, outputDir), customSys, ts.createSemanticDiagnosticsBuilderProgram, reportDiagnostic, reportWatchStatusChanged);
204
+ const host = ts.createWatchCompilerHost(path.join(location.scriptsDir, "tsconfig.json"), getCompilerOptions(location, outputDir), customSys, ts.createSemanticDiagnosticsBuilderProgram, registerDiagnostic, reportWatchStatusChanged);
205
+ const formattingHost = {
206
+ getCanonicalFileName: (path)=>path,
207
+ getCurrentDirectory: host.getCurrentDirectory,
208
+ getNewLine: ()=>ts.sys.newLine
209
+ };
188
210
  const watchProgram = ts.createWatchProgram(host);
189
211
  const files = getPackageTypescriptFiles(location);
190
212
  if (files.length === 0) {
@@ -204,14 +226,6 @@ const createTSCWatchBuildParticipant = (location, outputDir)=>{
204
226
  };
205
227
  };
206
228
  };
207
- const createErrorMessage = (diagnostic)=>{
208
- if (!diagnostic.file) {
209
- return `${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`;
210
- }
211
- const { line , character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
212
- const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
213
- return `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`;
214
- };
215
229
  const getCompilerOptions = (location, outputDir)=>{
216
230
  const config = tryReadTsConfig(location);
217
231
  config.compilerOptions.lib = [
@@ -289,11 +303,11 @@ const toposort = (packages)=>{
289
303
  };
290
304
 
291
305
  class BuildManager extends require$$2 {
292
- constructor(manifest, writer, logStep){
306
+ constructor(manifest, writer, reporter){
293
307
  super();
294
308
  this.manifest = manifest;
295
309
  this.writer = writer;
296
- this.logStep = logStep;
310
+ this.reporter = reporter;
297
311
  this.participants = new Map();
298
312
  this.states = new Map();
299
313
  }
@@ -328,7 +342,7 @@ class BuildManager extends require$$2 {
328
342
  this.states.set(name, result);
329
343
  this.maybeEmit();
330
344
  },
331
- log: this.logStep
345
+ log: (message)=>this.reporter.log(message)
332
346
  });
333
347
  }
334
348
  }
@@ -749,8 +763,7 @@ const createAnimationBuildParticipant = (location, manifest)=>{
749
763
  };
750
764
  };
751
765
  };
752
- const createAnimationWatchBuildParticipant = (location, manifest)=>{
753
- return (env)=>{
766
+ const createAnimationWatchBuildParticipant = (location, manifest)=>(env)=>{
754
767
  env.onBuildStart();
755
768
  bundleAnimations(location, manifest, env.log).then((result)=>{
756
769
  env.onBuildEnd({
@@ -767,7 +780,8 @@ const createAnimationWatchBuildParticipant = (location, manifest)=>{
767
780
  });
768
781
  (async ()=>{
769
782
  for await (const event of fs$1.watch(location.scriptsDir)){
770
- if (event.filename.endsWith(".animation.json")) {
783
+ var _event_filename;
784
+ if ((_event_filename = event.filename) == null ? void 0 : _event_filename.endsWith(".animation.json")) {
771
785
  env.onBuildStart();
772
786
  try {
773
787
  const result = await bundleAnimations(location, manifest, env.log);
@@ -790,7 +804,6 @@ const createAnimationWatchBuildParticipant = (location, manifest)=>{
790
804
  destroy: ()=>{}
791
805
  };
792
806
  };
793
- };
794
807
  const bundleAnimations = async (location, manifest, logStep)=>{
795
808
  const animations = new Map();
796
809
  for (const scriptFilePath of readPackageAnimationList(location)){
@@ -859,6 +872,7 @@ const buildFolders = async (options)=>{
859
872
  recursive: true
860
873
  });
861
874
  }
875
+ const baseReporter = options.reporter ?? consoleReporter;
862
876
  const workspace = options.workspace;
863
877
  const folders = options.packages;
864
878
  let sortedPackages = sortPackagesByBuildOrder(folders);
@@ -871,12 +885,12 @@ const buildFolders = async (options)=>{
871
885
  for (const location of sortedPackages){
872
886
  await ensureTsConfig(location);
873
887
  const data = manifests.get(location);
874
- const logStep = (step)=>logPackageMessage(data.Package, step, index, folders.length, maxNameLength);
888
+ const reporter = options.preparedReporter ?? createPackageScopedReporter(baseReporter, data.Package, index, folders.length, maxNameLength);
875
889
  const outputDirectory = options.outDir || location.scriptsDir;
876
890
  await fs$1.mkdir(outputDirectory, {
877
891
  recursive: true
878
892
  });
879
- const manager = new BuildManager(data, (result)=>writeBuildResult(result, data, location, workspace, outputDirectory, options.minimize, logStep), logStep);
893
+ const manager = new BuildManager(data, (result)=>writeBuildResult(result, data, location, workspace, outputDirectory, options.minimize, reporter), reporter);
880
894
  if (options.banner) {
881
895
  manager.addParticipant("banner", createBannerCommentBuildParticipant(options.banner));
882
896
  }
@@ -884,19 +898,19 @@ const buildFolders = async (options)=>{
884
898
  manager.addParticipant("animation", createAnimationBuildParticipant(location, data));
885
899
  await new Promise((resolve, reject)=>{
886
900
  manager.addListener("start", ()=>{
887
- logStep(`Build started`);
901
+ reporter.log(`Build started`);
888
902
  });
889
903
  manager.addListener("error", (error)=>{
890
904
  reject(new Error(error));
891
905
  });
892
906
  manager.addListener("build", ()=>{
893
- logStep(`Build complete`);
907
+ reporter.log(`Build complete`);
894
908
  resolve();
895
909
  });
896
910
  manager.run();
897
911
  });
898
912
  if (options.docs) {
899
- logStep("Generating typedoc documentation");
913
+ reporter.log("Generating typedoc documentation");
900
914
  await generateDocs(location, path.join(outputDirectory, `${data.Package}.d.ts`), path.join(workspace.path, "docs", data.Package), data.Package);
901
915
  }
902
916
  index++;
@@ -919,14 +933,14 @@ const buildFoldersWatch = async (options)=>{
919
933
  const maxNameLength = Array.from(manifests.values(), (manifest)=>manifest.Package.length).reduce((acc, length)=>Math.max(acc, length), 0);
920
934
  for (const location of sortedPackages){
921
935
  await ensureTsConfig(location);
936
+ const baseReporter = options.reporter ?? consoleReporter;
922
937
  const data = manifests.get(location);
923
- const currentIndex = index;
924
- const logStep = (step)=>logPackageMessage(data.Package, step, currentIndex, folders.length, maxNameLength);
938
+ const reporter = createPackageScopedReporter(baseReporter, data.Package, index, folders.length, maxNameLength);
925
939
  const outputDirectory = options.outDir || location.scriptsDir;
926
940
  await fs$1.mkdir(outputDirectory, {
927
941
  recursive: true
928
942
  });
929
- const manager = new BuildManager(data, (result)=>writeBuildResult(result, data, location, workspace, outputDirectory, options.minimize, logStep), logStep);
943
+ const manager = new BuildManager(data, (result)=>writeBuildResult(result, data, location, workspace, outputDirectory, options.minimize, reporter), reporter);
930
944
  if (options.banner) {
931
945
  manager.addParticipant("banner", createBannerCommentBuildParticipant(options.banner));
932
946
  }
@@ -934,14 +948,14 @@ const buildFoldersWatch = async (options)=>{
934
948
  manager.addParticipant("animation", createAnimationWatchBuildParticipant(location, data));
935
949
  await new Promise((resolve, reject)=>{
936
950
  manager.addListener("start", ()=>{
937
- logStep(`Build started`);
951
+ reporter.log(`Build started`);
938
952
  });
939
953
  manager.addListener("error", (error)=>{
940
- logStep(`Build failed: ${error}`);
954
+ reporter.log(`Build failed: ${EOL}${error}`);
941
955
  resolve();
942
956
  });
943
957
  manager.addListener("build", ()=>{
944
- logStep(`Build complete`);
958
+ reporter.log(`Build complete`);
945
959
  resolve();
946
960
  });
947
961
  manager.run();
@@ -950,7 +964,7 @@ const buildFoldersWatch = async (options)=>{
950
964
  }
951
965
  await new Promise(()=>{});
952
966
  };
953
- const writeBuildResult = async (buildResult, manifest, location, workspace, outputDirectory, minimize, logStep)=>{
967
+ const writeBuildResult = async (buildResult, manifest, location, workspace, outputDirectory, minimize, reporter)=>{
954
968
  let js = buildResult.js;
955
969
  if (buildResult.sourceMap) {
956
970
  js += `\n//# sourceMappingURL=${manifest.Package}.js.map`;
@@ -969,6 +983,7 @@ const writeBuildResult = async (buildResult, manifest, location, workspace, outp
969
983
  });
970
984
  }
971
985
  if (minimize) {
986
+ reporter.log("Minifying the output");
972
987
  const minifyResult = await terser.minify(js, {
973
988
  ecma: 5,
974
989
  sourceMap: {
@@ -990,7 +1005,7 @@ const writeBuildResult = async (buildResult, manifest, location, workspace, outp
990
1005
  await fs$1.mkdir(path.join(workspace.path, "lib"), {
991
1006
  recursive: true
992
1007
  });
993
- logStep("Copying basics definition file to the lib folder");
1008
+ reporter.log("Copying basics definition file to the lib folder");
994
1009
  await fs$1.writeFile(path.join(workspace.path, "lib", `${manifest.Package}.d.ts`), buildResult.definitions, {
995
1010
  encoding: "utf8"
996
1011
  });
@@ -1116,5 +1131,5 @@ var index = /*#__PURE__*/Object.freeze({
1116
1131
  buildFoldersWatch: buildFoldersWatch
1117
1132
  });
1118
1133
 
1119
- export { buildFolders as b, index as i, logPackageMessage as l };
1120
- //# sourceMappingURL=index-e6ead55c.mjs.map
1134
+ export { consoleReporter as a, buildFolders as b, createPackageScopedReporter as c, index as i };
1135
+ //# sourceMappingURL=index-C3Hd8xoM.mjs.map