@intelligentgraphics/ig.gfx.packager 3.1.0-alpha.1 → 3.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin.mjs +1 -1
- package/build/{cli-fec9c069.mjs → cli-DANmLXRa.mjs} +89 -79
- package/build/cli-DANmLXRa.mjs.map +1 -0
- package/build/{dependencies-d870016d.mjs → dependencies-DusLuN7Y.mjs} +2 -2
- package/build/{dependencies-d870016d.mjs.map → dependencies-DusLuN7Y.mjs.map} +1 -1
- package/build/{generateIndex-dd0b4563.mjs → generateIndex-DWjOe92Q.mjs} +96 -83
- package/build/generateIndex-DWjOe92Q.mjs.map +1 -0
- package/build/{generateParameterType-9a671e36.mjs → generateParameterType-BQ1F7eAV.mjs} +3 -4
- package/build/{generateParameterType-9a671e36.mjs.map → generateParameterType-BQ1F7eAV.mjs.map} +1 -1
- package/build/{index-7fa42d48.mjs → index-BEREgVJP.mjs} +201 -188
- package/build/index-BEREgVJP.mjs.map +1 -0
- package/build/{index-0caf1a6e.mjs → index-CqUHGUfc.mjs} +351 -127
- package/build/index-CqUHGUfc.mjs.map +1 -0
- package/build/{postinstall-81b6f0b0.mjs → postinstall-Da3ZBnje.mjs} +3 -4
- package/build/{postinstall-81b6f0b0.mjs.map → postinstall-Da3ZBnje.mjs.map} +1 -1
- package/build/{publishNpm-c985bd6e.mjs → publishNpm-B6bEiSNV.mjs} +14 -11
- package/build/publishNpm-B6bEiSNV.mjs.map +1 -0
- package/build/rollup-BEli071h.mjs +221 -0
- package/build/rollup-BEli071h.mjs.map +1 -0
- package/build/scripts-DI0Xj5Yb.mjs +48 -0
- package/build/scripts-DI0Xj5Yb.mjs.map +1 -0
- package/build/versionFile-tyKtTvcM.mjs +208 -0
- package/build/versionFile-tyKtTvcM.mjs.map +1 -0
- package/lib/lib.mjs +2649 -18
- package/package.json +21 -15
- package/readme.md +131 -13
- package/build/cli-fec9c069.mjs.map +0 -1
- package/build/generateIndex-dd0b4563.mjs.map +0 -1
- package/build/index-0caf1a6e.mjs.map +0 -1
- package/build/index-7fa42d48.mjs.map +0 -1
- package/build/publishNpm-c985bd6e.mjs.map +0 -1
- package/build/scripts-7ed8dff6.mjs +0 -10
- package/build/scripts-7ed8dff6.mjs.map +0 -1
- package/build/swc-9ed0f3ce.mjs +0 -60
- package/build/swc-9ed0f3ce.mjs.map +0 -1
- package/build/versionFile-cbfd3f4a.mjs +0 -380
- package/build/versionFile-cbfd3f4a.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateIndex-DWjOe92Q.mjs","sources":["../src/commands/generateIndex.ts"],"sourcesContent":["import ts from \"typescript\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\n\nimport {\n\tresolveNamespaceFullName,\n\tresolveNamespaces,\n\tNamespace,\n} from \"@intelligentgraphics/declarationbundler\";\n\nimport {\n\tPackageLocation,\n\twritePackageCreatorIndex,\n\treadPackageCreatorIndex,\n\treadPackageCreatorManifest,\n} from \"../lib/package\";\nimport {\n\tgetPackageTypescriptFiles,\n\treadScriptPackageTSConfig,\n\tresolveScriptPackageEntryModule,\n} 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 arr: CreatorIndexEntry[] = [];\n\n\tconst existingIndex = readPackageCreatorIndex(location) ?? [];\n\tconst manifest = readPackageCreatorManifest(location);\n\n\tconst compilerOptions = readScriptPackageTSConfig(location).options;\n\n\tconst isModule =\n\t\tcompilerOptions.module === ts.ModuleKind.ES2015 ||\n\t\tcompilerOptions.module === ts.ModuleKind.ESNext;\n\n\tconst files = getPackageTypescriptFiles(location).filter(\n\t\t(path) => !ignore.some((suffix) => path.endsWith(suffix)),\n\t);\n\n\tlet program: ts.Program;\n\tlet namespaces: Namespace[];\n\n\tif (isModule) {\n\t\tconst entryFilePath = resolveScriptPackageEntryModule(\n\t\t\tlocation,\n\t\t\tmanifest,\n\t\t);\n\n\t\tif (entryFilePath === undefined) {\n\t\t\tthrow new Error(`Could not resolve entry module`);\n\t\t}\n\n\t\tconst host = ts.createCompilerHost({}, true);\n\t\tprogram = ts.createProgram(\n\t\t\t[entryFilePath],\n\t\t\t{ allowJs: true, ...compilerOptions },\n\t\t\thost,\n\t\t);\n\n\t\tconst entryFile = program.getSourceFile(entryFilePath);\n\n\t\tif (entryFile === undefined) {\n\t\t\tthrow new Error(`Failed to find entry module`);\n\t\t}\n\n\t\tnamespaces = resolveNamespaces(\n\t\t\tentryFile,\n\t\t\tprogram,\n\t\t\thost,\n\t\t\tmanifest.Scope ?? manifest.Package,\n\t\t);\n\t} else {\n\t\tprogram = ts.createProgram(files, { allowJs: true });\n\t\tnamespaces = [];\n\t}\n\n\tconst typeChecker = program.getTypeChecker();\n\n\tfiles.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\t\tconst namespace = namespaces.find((namespace) =>\n\t\t\tnamespace.files.includes(sourceFile),\n\t\t);\n\n\t\t// Loop through the root AST nodes of the file\n\n\t\tfor (const scriptingClass of findScriptingClasses(sourceFile)) {\n\t\t\tif (scriptingClass.node.name === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Expected ${scriptingClass.type} class to have a name`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tlet name: string;\n\n\t\t\tif (isModule && namespace !== undefined) {\n\t\t\t\tconst moduleNamespace = resolveNamespaceFullName(namespace);\n\t\t\t\tname = `${moduleNamespace}.${scriptingClass.node.name.text}`;\n\t\t\t} else {\n\t\t\t\tname = typeChecker.getFullyQualifiedName(\n\t\t\t\t\ttypeChecker.getSymbolAtLocation(scriptingClass.node.name)!,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (name.length > 45) {\n\t\t\t\tthrow new Error(`Package name length >45 '${name}'`);\n\t\t\t}\n\n\t\t\tconst parameterDeclaration =\n\t\t\t\tgetScriptingClassParameterdeclaration(scriptingClass);\n\n\t\t\tconst parametersType =\n\t\t\t\tparameterDeclaration === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: typeChecker.getTypeAtLocation(parameterDeclaration);\n\n\t\t\tif (parametersType === undefined) {\n\t\t\t\tconsole.log(\n\t\t\t\t\t`Failed to find parameters type declaration for ${scriptingClass.type} ${name}. Skipping parameter list generation`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst existingIndexEntry = existingIndex.find(\n\t\t\t\t(entry) => entry.Name === name,\n\t\t\t);\n\n\t\t\tconst obj: CreatorIndexEntry = {\n\t\t\t\tName: name,\n\t\t\t\tDescription: existingIndexEntry?.Description ?? name,\n\t\t\t\tType:\n\t\t\t\t\tscriptingClass.type === \"evaluator\"\n\t\t\t\t\t\t? \"Evaluator\"\n\t\t\t\t\t\t: \"Interactor\",\n\t\t\t\tParameters: [],\n\t\t\t};\n\n\t\t\tconst rawDocTags = ts.getJSDocTags(scriptingClass.node);\n\n\t\t\tconst dict = getTagDict(rawDocTags);\n\t\t\tif (dict.summary) {\n\t\t\t\tobj.Description = dict.summary;\n\t\t\t} else {\n\t\t\t\tconst comment = typeChecker\n\t\t\t\t\t.getTypeAtLocation(scriptingClass.node)\n\t\t\t\t\t.symbol.getDocumentationComment(typeChecker)\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\tobj.Description = comment;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (parametersType !== undefined) {\n\t\t\t\tobj.Parameters = parseParametersList(\n\t\t\t\t\ttypeChecker.getPropertiesOfType(parametersType),\n\t\t\t\t\tstrictOptional,\n\t\t\t\t);\n\n\t\t\t\tif (\n\t\t\t\t\tobj.Parameters.length === 0 &&\n\t\t\t\t\tparametersType.getStringIndexType() !== undefined\n\t\t\t\t) {\n\t\t\t\t\tobj.Parameters = existingIndexEntry?.Parameters ?? [];\n\t\t\t\t}\n\t\t\t} else if (existingIndexEntry !== undefined) {\n\t\t\t\tobj.Parameters = existingIndexEntry.Parameters;\n\t\t\t}\n\n\t\t\tarr.push(obj);\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 */\nfunction* findScriptingClasses(\n\tnode: ts.Node,\n): Generator<ScriptingClass, void, void> {\n\tfor (const child of node.getChildren()) {\n\t\tif (!ts.isClassDeclaration(child)) {\n\t\t\tyield* findScriptingClasses(child);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst scriptingClass = detectScriptingClass(child);\n\n\t\tif (scriptingClass !== undefined) {\n\t\t\tyield scriptingClass;\n\t\t}\n\t}\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","arr","existingIndex","readPackageCreatorIndex","manifest","readPackageCreatorManifest","compilerOptions","readScriptPackageTSConfig","options","isModule","module","ts","ModuleKind","ES2015","ESNext","files","getPackageTypescriptFiles","filter","path","some","suffix","endsWith","program","namespaces","entryFilePath","resolveScriptPackageEntryModule","undefined","Error","host","createCompilerHost","createProgram","allowJs","entryFile","getSourceFile","resolveNamespaces","Scope","Package","typeChecker","getTypeChecker","forEach","file","sourceFile","namespace","find","includes","scriptingClass","findScriptingClasses","node","name","type","moduleNamespace","resolveNamespaceFullName","text","getFullyQualifiedName","getSymbolAtLocation","length","parameterDeclaration","getScriptingClassParameterdeclaration","parametersType","getTypeAtLocation","console","log","existingIndexEntry","entry","Name","obj","Description","Type","Parameters","rawDocTags","getJSDocTags","dict","getTagDict","summary","comment","symbol","getDocumentationComment","map","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","child","getChildren","isClassDeclaration","detectScriptingClass","isEvaluator","heritageClauses","clause","token","ExtendsKeyword","ImplementsKeyword","types","isInteractor"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuCA;;;;IAKO,SAASA,aAAAA,CAAc,EAC7BC,QAAQ,EACRC,MAAAA,GAAS,EAAE,EACXC,cAAAA,GAAiB,KAAK,EACA,EAAA;AACtB,IAAA,MAAMC,MAA2B,EAAE;IAEnC,MAAMC,aAAAA,GAAgBC,uBAAAA,CAAwBL,QAAAA,CAAAA,IAAa,EAAE;AAC7D,IAAA,MAAMM,WAAWC,0BAAAA,CAA2BP,QAAAA,CAAAA;IAE5C,MAAMQ,eAAAA,GAAkBC,yBAAAA,CAA0BT,QAAAA,CAAAA,CAAUU,OAAO;AAEnE,IAAA,MAAMC,QAAAA,GACLH,eAAAA,CAAgBI,MAAM,KAAKC,GAAGC,UAAU,CAACC,MAAM,IAC/CP,gBAAgBI,MAAM,KAAKC,EAAAA,CAAGC,UAAU,CAACE,MAAM;AAEhD,IAAA,MAAMC,KAAAA,GAAQC,yBAAAA,CAA0BlB,QAAAA,CAAAA,CAAUmB,MAAM,CACvD,CAACC,IAAAA,GAAS,CAACn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AChB,OAAO;AACN9F,YAAAA,IAAAA;YACAE,IAAAA,EAAM;AACP,SAAA;AACD,IAAA;AAEA,IAAA,MAAMmG,YAAAA,GAAerG,IAAAA,CAAK+F,eAAe,EAAE3H,KAAK,CAAC4H,MAAAA,GAAAA;AAChD,QAAA,IAAIA,OAAOC,KAAK,KAAKrI,GAAG6G,UAAU,CAACyB,cAAc,EAAE;YAClD,OAAO,KAAA;AACR,QAAA;QAEA,OAAOF,MAAAA,CAAOI,KAAK,CAAChI,IAAI,CAAC,CAAC8B,IAAAA,GACzBA,IAAAA,CAAKoE,OAAO,EAAA,CAAGzE,QAAQ,CAAC,YAAA,CAAA,CAAA;AAE1B,IAAA,CAAA,CAAA;AAEA,IAAA,IAAIwG,YAAAA,EAAc;QACjB,OAAO;AACNrG,YAAAA,IAAAA;YACAE,IAAAA,EAAM;AACP,SAAA;AACD,IAAA;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-
|
|
7
|
+
import { a as readPackageCreatorIndex, r as readPackageCreatorManifest, l as getCreatorIndexParameterPrimaryJSType } from './cli-DANmLXRa.mjs';
|
|
8
8
|
import 'glob';
|
|
9
9
|
import 'node:path';
|
|
10
10
|
import 'node:fs';
|
|
@@ -14,7 +14,6 @@ import 'yargs/yargs';
|
|
|
14
14
|
import 'url';
|
|
15
15
|
import 'assert';
|
|
16
16
|
import 'events';
|
|
17
|
-
import 'core-js/modules/es.typed-array.set.js';
|
|
18
17
|
import 'util';
|
|
19
18
|
import 'inquirer';
|
|
20
19
|
|
|
@@ -66,10 +65,10 @@ const generateParameterType = ({ location, name })=>{
|
|
|
66
65
|
let interfaceDeclaration = ts.factory.createInterfaceDeclaration(undefined, interfaceName, undefined, undefined, members);
|
|
67
66
|
interfaceDeclaration = ts.addSyntheticLeadingComment(interfaceDeclaration, ts.SyntaxKind.MultiLineCommentTrivia, `*\n * Parameters for the ${className} class\n `, true);
|
|
68
67
|
const printer = ts.createPrinter();
|
|
69
|
-
const content = printer.printNode(ts.EmitHint.Unspecified, interfaceDeclaration, ts.createSourceFile("index.ts", "", ts.ScriptTarget.Latest)).replace(/ /g, "
|
|
68
|
+
const content = printer.printNode(ts.EmitHint.Unspecified, interfaceDeclaration, ts.createSourceFile("index.ts", "", ts.ScriptTarget.Latest)).replace(/ /g, "\t");
|
|
70
69
|
const outFile = path.join(location.scriptsDir, `${interfaceName}.txt`);
|
|
71
70
|
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
71
|
};
|
|
73
72
|
|
|
74
73
|
export { generateParameterType };
|
|
75
|
-
//# sourceMappingURL=generateParameterType-
|
|
74
|
+
//# sourceMappingURL=generateParameterType-BQ1F7eAV.mjs.map
|
package/build/{generateParameterType-9a671e36.mjs.map → generateParameterType-BQ1F7eAV.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateParameterType-
|
|
1
|
+
{"version":3,"file":"generateParameterType-BQ1F7eAV.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,qBAAAA,GAAwB,CAAC,EACrCC,QAAQ,EACRC,IAAI,EAC0B,GAAA;AAC9B,IAAA,MAAMC,QAAQC,uBAAAA,CAAwBH,QAAAA,CAAAA;AACtC,IAAA,MAAMI,WAAWC,0BAAAA,CAA2BL,QAAAA,CAAAA;AAE5C,IAAA,IAAIE,UAAUI,SAAAA,EAAW;AACxB,QAAA,MAAM,IAAIC,KAAAA,CAAM,CAAC,mCAAmC,CAAC,CAAA;AACtD,IAAA;AAEA,IAAA,IAAIC,aAAAA,GAAgBP,IAAAA;AACpB,IAAA,IAAIQ,SAAAA,GAAYR,IAAAA;AAEhB,IAAA,MAAMS,KAAAA,GAAQN,QAAAA,CAASO,KAAK,IAAIP,SAASQ,OAAO;IAEhD,IAAIX,IAAAA,CAAKY,UAAU,CAACH,KAAAA,CAAAA,EAAQ;AAC3BD,QAAAA,SAAAA,GAAYR,IAAAA,CAAKa,KAAK,CAACJ,KAAAA,CAAMK,MAAM,GAAG,CAAA,CAAA;IACvC,CAAA,MAAO;AACNP,QAAAA,aAAAA,GAAgB,CAAA,EAAGE,KAAAA,CAAM,CAAC,EAAET,IAAAA,CAAAA,CAAM;AACnC,IAAA;IAEA,MAAMe,YAAAA,GAAed,MAAMe,IAAI,CAAC,CAACC,IAAAA,GAASA,IAAAA,CAAKC,IAAI,KAAKX,aAAAA,CAAAA;AAExD,IAAA,IAAIQ,iBAAiBV,SAAAA,EAAW;AAC/B,QAAA,MAAM,IAAIC,KAAAA,CAAM,CAAC,kCAAkC,EAAEN,IAAAA,CAAAA,CAAM,CAAA;AAC5D,IAAA;AAEA,IAAA,MAAMmB,UAA4B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