@intelligentgraphics/ig.gfx.packager 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin.js +2 -1
- package/build/bin.js.map +1 -1
- package/build/{build-kkMVBBJL.js → build-C3qEWyu4.js} +1 -1
- package/build/{build-kkMVBBJL.js.map → build-C3qEWyu4.js.map} +1 -1
- package/build/{build-CMbCj7x-.js → build-C4Q_eL6j.js} +74 -26
- package/build/build-C4Q_eL6j.js.map +1 -0
- package/build/{cli-Co1DhAmx.js → cli-DRb54rk4.js} +12 -12
- package/build/{cli-Co1DhAmx.js.map → cli-DRb54rk4.js.map} +1 -1
- package/build/{docs-BkGeoYY2.js → docs-BavUNetY.js} +2 -3
- package/build/{docs-BkGeoYY2.js.map → docs-BavUNetY.js.map} +1 -1
- package/build/{generateIndex-C_DxQ2R4.js → generateIndex-2UM_uDm9.js} +4 -4
- package/build/generateIndex-2UM_uDm9.js.map +1 -0
- package/build/{generateParameterType-CdCi5BWM.js → generateParameterType-so7HPAmb.js} +2 -2
- package/build/{generateParameterType-CdCi5BWM.js.map → generateParameterType-so7HPAmb.js.map} +1 -1
- package/build/package-pKTRlkgE.js +2 -0
- package/build/{postinstall-DHTlEmNr.js → postinstall-CUmC5zLp.js} +4 -4
- package/build/{postinstall-DHTlEmNr.js.map → postinstall-CUmC5zLp.js.map} +1 -1
- package/build/{prompter-DONgUlzS.js → prompter-BNJwlQhM.js} +1 -1
- package/build/{prompter-DONgUlzS.js.map → prompter-BNJwlQhM.js.map} +1 -1
- package/build/{publish-E5zcQAo0.js → publish-Bd15xplt.js} +8 -9
- package/build/{publish-E5zcQAo0.js.map → publish-Bd15xplt.js.map} +1 -1
- package/build/{publishNpm-CBT1819u.js → publishNpm-C2uLIAWs.js} +6 -7
- package/build/{publishNpm-CBT1819u.js.map → publishNpm-C2uLIAWs.js.map} +1 -1
- package/build/publishedPackage-pKTRlkgE.js +2 -0
- package/build/{rollup-Csyght27.js → rollup-Ci1pp5NO.js} +3 -4
- package/build/{rollup-Csyght27.js.map → rollup-Ci1pp5NO.js.map} +1 -1
- package/build/{scripts-CBblHIL1.js → scripts-D5xp5cJY.js} +2 -1
- package/build/{scripts-CBblHIL1.js.map → scripts-D5xp5cJY.js.map} +1 -1
- package/build/{versionFile-DViDwgCa.js → versionFile-K8Qq2b1u.js} +3 -3
- package/build/{versionFile-DViDwgCa.js.map → versionFile-K8Qq2b1u.js.map} +1 -1
- package/build/workspace-pKTRlkgE.js +2 -0
- package/lib/lib.js +70 -22
- package/package.json +7 -5
- package/readme.md +7 -0
- package/build/build-CMbCj7x-.js.map +0 -1
- package/build/generateIndex-C_DxQ2R4.js.map +0 -1
- package/build/package-DHx2bvVO.js +0 -1
- package/build/publishedPackage-D-KiU0FG.js +0 -1
- package/build/workspace-D0XY2EMu.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-CMbCj7x-.js","names":["fs","animationSchema"],"sources":["../src/commands/build/tsc.ts","../src/lib/toposort.ts","../src/commands/build/manager.ts","../src/commands/build/animation.schema.ts","../src/commands/build/animations.ts","../src/lib/packageVersion.ts","../src/commands/build/index.ts"],"sourcesContent":["import ts from \"typescript\";\nimport * as path from \"node:path\";\nimport * as fs from \"node:fs\";\nimport { EOL } from \"node:os\";\n\nimport type { PackageLocation } from \"../../lib/package\";\n\nimport { getPackageTypescriptFiles } from \"../../lib/scripts\";\nimport type { BuildParticipant, BuilderEnvironment } from \"./types\";\n\nexport const tryReadTsConfig = (location: PackageLocation) => {\n\tconst { config } = ts.readConfigFile(\n\t\tpath.join(location.scriptsDir, \"tsconfig.json\"),\n\t\t(path) => {\n\t\t\ttry {\n\t\t\t\treturn fs.readFileSync(path, \"utf8\");\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t);\n\n\treturn config as {\n\t\tcompilerOptions: ts.CompilerOptions;\n\t};\n};\n\nexport const createTSCBuildParticipant =\n\t(\n\t\tlocation: PackageLocation,\n\t\toutputDir: string,\n\t\tskipDeclarations: boolean,\n\t): BuildParticipant =>\n\t(env: BuilderEnvironment) => {\n\t\tconst files = getPackageTypescriptFiles(location);\n\n\t\ttry {\n\t\t\tenv.onBuildStart();\n\n\t\t\tenv.log(\"Compiling typescript files\");\n\n\t\t\tconst compilerOptions = getCompilerOptions(\n\t\t\t\tlocation,\n\t\t\t\toutputDir,\n\t\t\t\tskipDeclarations,\n\t\t\t);\n\n\t\t\tconst host = ts.createCompilerHost(compilerOptions);\n\t\t\thost.getCurrentDirectory = () => location.scriptsDir;\n\n\t\t\tlet js: string | undefined;\n\t\t\tlet definitions: string | undefined;\n\t\t\tlet sourceMap: string | undefined;\n\n\t\t\thost.writeFile = (fileName, data, writeByteOrderMark) => {\n\t\t\t\tif (fileName.endsWith(\".js\")) {\n\t\t\t\t\tjs = data;\n\t\t\t\t} else if (fileName.endsWith(\".d.ts\")) {\n\t\t\t\t\tdefinitions = data;\n\t\t\t\t} else if (fileName.endsWith(\".js.map\")) {\n\t\t\t\t\tsourceMap = data;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst programOptions: ts.CreateProgramOptions = {\n\t\t\t\trootNames: files,\n\t\t\t\toptions: compilerOptions,\n\t\t\t\thost,\n\t\t\t};\n\n\t\t\tconst program = ts.createProgram(programOptions);\n\n\t\t\tconst emitResult = program.emit();\n\t\t\tconst allDiagnostics = ts.getPreEmitDiagnostics(program);\n\n\t\t\tif (!emitResult.emitSkipped) {\n\t\t\t\tif (allDiagnostics.length > 0) {\n\t\t\t\t\tconsole.log(ts.formatDiagnostics(allDiagnostics, host));\n\t\t\t\t}\n\n\t\t\t\tif (js === undefined || definitions === undefined) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Unexpected: no js or definitions were created`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\ttype: \"success\",\n\t\t\t\t\tartefacts: {\n\t\t\t\t\t\tjs: js.replace(`//# sourceMappingURL=out.js.map`, \"\"),\n\t\t\t\t\t\tdeclarations:\n\t\t\t\t\t\t\tgetDeclarationFileReferences(\n\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\tprogram,\n\t\t\t\t\t\t\t\toutputDir,\n\t\t\t\t\t\t\t) + definitions,\n\t\t\t\t\t\tsourceMap,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst error = ts.formatDiagnostics(allDiagnostics, host);\n\n\t\t\t\tthrow new Error(error);\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tenv.onBuildEnd({\n\t\t\t\ttype: \"error\",\n\t\t\t\terror: err instanceof Error ? err : new Error(String(err)),\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\tdestroy: () => {},\n\t\t};\n\t};\n\nexport const createTSCWatchBuildParticipant = (\n\tlocation: PackageLocation,\n\toutputDir: string,\n\tskipDeclarations: boolean,\n): BuildParticipant => {\n\treturn ({ onBuildStart, onBuildEnd }: BuilderEnvironment) => {\n\t\ttype State = {\n\t\t\tjs: string | undefined;\n\t\t\tdefinitions: string | undefined;\n\t\t\tdiagnostics: ts.Diagnostic[];\n\t\t\tsourceMap: string | undefined;\n\t\t};\n\n\t\tlet state: State = {\n\t\t\tdiagnostics: [],\n\t\t\tjs: undefined,\n\t\t\tdefinitions: undefined,\n\t\t\tsourceMap: undefined,\n\t\t};\n\n\t\tconst customSys: ts.System = {\n\t\t\t...ts.sys,\n\t\t\twriteFile: (fileName, data, writeByteOrderMark) => {\n\t\t\t\tif (fileName.endsWith(\".js\")) {\n\t\t\t\t\tstate.js = data;\n\t\t\t\t} else if (fileName.endsWith(\".d.ts\")) {\n\t\t\t\t\tstate.definitions = data;\n\t\t\t\t} else if (fileName.endsWith(\".js.map\")) {\n\t\t\t\t\tstate.sourceMap = data;\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\n\t\tconst registerDiagnostic = (diagnostic: ts.Diagnostic) => {\n\t\t\tswitch (diagnostic.code) {\n\t\t\t\t// file not found - https://github.com/microsoft/TypeScript/blob/93e6b9da0c4cb164ca90a5a1b07415e81e97f2b1/src/compiler/diagnosticMessages.json#L4640\n\t\t\t\t// probably deleted -> ignore\n\t\t\t\tcase 6053:\n\t\t\t\t\treturn;\n\n\t\t\t\t// no inputs were found - https://github.com/microsoft/TypeScript/blob/93e6b9da0c4cb164ca90a5a1b07415e81e97f2b1/src/compiler/diagnosticMessages.json#L6838\n\t\t\t\t// we don't care about this error. a user might have temporarily deleted the last ts file and will readd one later.\n\t\t\t\tcase 18003:\n\t\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tstate.diagnostics.push(diagnostic);\n\t\t};\n\n\t\tlet currentProgram: Pick<ts.Program, \"getSourceFiles\"> | undefined;\n\n\t\tconst reportWatchStatusChanged = (diagnostic: ts.Diagnostic) => {\n\t\t\tswitch (diagnostic.code) {\n\t\t\t\t// regular watch mode - https://github.com/microsoft/TypeScript/blob/93e6b9da0c4cb164ca90a5a1b07415e81e97f2b1/src/compiler/diagnosticMessages.json#L4567\n\t\t\t\tcase 6031:\n\t\t\t\t// incremental watch mode - https://github.com/microsoft/TypeScript/blob/93e6b9da0c4cb164ca90a5a1b07415e81e97f2b1/src/compiler/diagnosticMessages.json#L4571\n\t\t\t\tcase 6032:\n\t\t\t\t\t// build start\n\t\t\t\t\tonBuildStart();\n\t\t\t\t\tbreak;\n\n\t\t\t\t// found one error - https://github.com/microsoft/TypeScript/blob/93e6b9da0c4cb164ca90a5a1b07415e81e97f2b1/src/compiler/diagnosticMessages.json#L5119\n\t\t\t\tcase 6193:\n\t\t\t\t// found n or 0 errors - https://github.com/microsoft/TypeScript/blob/93e6b9da0c4cb164ca90a5a1b07415e81e97f2b1/src/compiler/diagnosticMessages.json#L5123\n\t\t\t\tcase 6194:\n\t\t\t\t\t// build end\n\t\t\t\t\tconst emitState = state;\n\t\t\t\t\tstate = {\n\t\t\t\t\t\tdiagnostics: [],\n\t\t\t\t\t\tjs: undefined,\n\t\t\t\t\t\tdefinitions: undefined,\n\t\t\t\t\t\tsourceMap: undefined,\n\t\t\t\t\t};\n\n\t\t\t\t\tif (emitState.diagnostics.length > 0) {\n\t\t\t\t\t\tconst message = ts.formatDiagnostics(\n\t\t\t\t\t\t\temitState.diagnostics,\n\t\t\t\t\t\t\tformattingHost,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tonBuildEnd({\n\t\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\t\terror: new Error(message),\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (emitState.js === undefined) {\n\t\t\t\t\t\tonBuildEnd({\n\t\t\t\t\t\t\ttype: \"success\",\n\t\t\t\t\t\t\tartefacts: {\n\t\t\t\t\t\t\t\tjs: \"\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!currentProgram) {\n\t\t\t\t\t\tthrow new Error(`Expected a program to exist`);\n\t\t\t\t\t}\n\n\t\t\t\t\tonBuildEnd({\n\t\t\t\t\t\ttype: \"success\",\n\t\t\t\t\t\tartefacts: {\n\t\t\t\t\t\t\tjs: emitState.js.replace(\n\t\t\t\t\t\t\t\t`//# sourceMappingURL=out.js.map`,\n\t\t\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tdeclarations: emitState.definitions\n\t\t\t\t\t\t\t\t? getDeclarationFileReferences(\n\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\tcurrentProgram,\n\t\t\t\t\t\t\t\t\t\toutputDir,\n\t\t\t\t\t\t\t\t\t) + emitState.definitions\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\tsourceMap: emitState.sourceMap,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t};\n\n\t\tconst host = ts.createWatchCompilerHost(\n\t\t\tpath.join(location.scriptsDir, \"tsconfig.json\"),\n\t\t\tgetCompilerOptions(location, outputDir, skipDeclarations),\n\t\t\tcustomSys,\n\t\t\tts.createSemanticDiagnosticsBuilderProgram,\n\t\t\tregisterDiagnostic,\n\t\t\treportWatchStatusChanged,\n\t\t);\n\t\tconst originalAfterProgramCreate = host.afterProgramCreate;\n\t\thost.afterProgramCreate = (program) => {\n\t\t\tcurrentProgram = program;\n\t\t\toriginalAfterProgramCreate?.(program);\n\t\t};\n\n\t\tconst formattingHost: ts.FormatDiagnosticsHost = {\n\t\t\tgetCanonicalFileName: (path) => path,\n\t\t\tgetCurrentDirectory: host.getCurrentDirectory,\n\t\t\tgetNewLine: () => ts.sys.newLine,\n\t\t};\n\n\t\tconst watchProgram = ts.createWatchProgram(host);\n\n\t\treturn {\n\t\t\tdestroy: () => {\n\t\t\t\twatchProgram.close();\n\t\t\t},\n\t\t};\n\t};\n};\n\nconst getCompilerOptions = (\n\tlocation: PackageLocation,\n\toutputDir: string,\n\tskipDeclarations: boolean,\n) => {\n\tconst config = tryReadTsConfig(location);\n\n\tconfig.compilerOptions.lib = [\"es2018\", \"dom\"];\n\n\tconst result = ts.convertCompilerOptionsFromJson(\n\t\tconfig.compilerOptions,\n\t\tlocation.scriptsDir,\n\t);\n\n\tconst compilerOptions: ts.CompilerOptions = {\n\t\t...result.options,\n\t\tremoveComments: false,\n\t\tdeclaration: !skipDeclarations,\n\t\tsourceMap: true,\n\t\tinlineSources: false,\n\t\t// We don't use tsc to actually emit the files, but we still need to set the correct\n\t\t// output directory so the compiler can rewrite the `reference path` directives.\n\t\toutFile: path.join(outputDir, \"out.js\"),\n\t\ttarget: ts.ScriptTarget.ES5,\n\t\tnoEmitOnError: true,\n\t};\n\n\treturn compilerOptions;\n};\n\nfunction getDeclarationFileReferences(\n\tlocation: PackageLocation,\n\tprogram: Pick<ts.Program, \"getSourceFiles\">,\n\toutputDir: string,\n): string {\n\tconst references = new Set<string>();\n\n\tfor (const file of program.getSourceFiles()) {\n\t\tfor (const reference of file.referencedFiles) {\n\t\t\tif (reference.preserve) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst dir = path.dirname(file.fileName);\n\t\t\tconst absolute = path.resolve(dir, reference.fileName);\n\t\t\tif (!absolute.startsWith(location.scriptsDir)) {\n\t\t\t\treferences.add(absolute);\n\t\t\t}\n\t\t}\n\t}\n\n\tlet referenceString = Array.from(references, (reference) => {\n\t\t// replace window separators with unix ones for the reference path\n\n\t\tconst relativeNormalized = path\n\t\t\t.relative(outputDir, reference)\n\t\t\t.replaceAll(path.sep, \"/\");\n\n\t\treturn `/// <reference path=\"${relativeNormalized}\" />`;\n\t}).join(EOL);\n\n\tif (referenceString) {\n\t\treferenceString += EOL;\n\t}\n\n\treturn referenceString;\n}\n","// Stolen from ig.tools.core\n\nexport const toposort = (packages: Record<string, string[]>) => {\n\tconst queue = Object.getOwnPropertyNames(packages);\n\tconst result: string[] = [];\n\n\tlet index = 0;\n\n\twhile (queue.length > 0) {\n\t\tif (index >= queue.length) {\n\t\t\tthrow new Error(\"Packages can not have cyclic dependencies\");\n\t\t}\n\n\t\tconst queueEntry = queue[index];\n\n\t\tconst dependencies = packages[queueEntry];\n\t\tconst dependencyQueued = dependencies.some((dependency) =>\n\t\t\tqueue.includes(dependency),\n\t\t);\n\n\t\tif (dependencyQueued) {\n\t\t\tindex++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tqueue.splice(index, 1);\n\t\tindex = 0;\n\t\tresult.push(queueEntry);\n\t}\n\n\treturn result;\n};\n","import type {\n\tCreatorPackage,\n\tReporter,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\nimport type {\n\tBuildArtefacts,\n\tBuildParticipant,\n\tBuildResult,\n\tBuildSuccessResult,\n} from \"./types\";\nimport EventEmitter from \"events\";\nimport { SourceMapConsumer, SourceMapGenerator } from \"source-map-js\";\n\ntype State =\n\t| {\n\t\t\ttype: \"busy\";\n\t }\n\t| BuildResult;\n\nexport class BuildManager extends EventEmitter {\n\tprivate readonly participants = new Map<string, BuildParticipant>();\n\tprivate readonly states = new Map<string, State>();\n\tprivate readonly participantInstances: { destroy(): void }[] = [];\n\n\tconstructor(\n\t\tprivate readonly manifest: CreatorPackage,\n\t\tprivate readonly writer: (result: BuildArtefacts) => Promise<void>,\n\t\tprivate readonly reporter: Reporter,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic addParticipant(name: string, participant: BuildParticipant) {\n\t\tthis.participants.set(name, participant);\n\t}\n\n\tpublic run() {\n\t\tfor (const [name] of this.participants) {\n\t\t\tthis.states.set(name, { type: \"busy\" });\n\t\t}\n\n\t\tthis.emit(\"start\");\n\n\t\tfor (const [name, participant] of this.participants) {\n\t\t\tconst instance = participant({\n\t\t\t\tonBuildStart: () => {\n\t\t\t\t\tlet alreadyBusy = false;\n\n\t\t\t\t\tfor (const [name, state] of this.states) {\n\t\t\t\t\t\tif (state.type === \"busy\") {\n\t\t\t\t\t\t\talreadyBusy = true;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.states.set(name, { type: \"busy\" });\n\n\t\t\t\t\tif (!alreadyBusy) {\n\t\t\t\t\t\tthis.emit(\"start\");\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tonBuildEnd: (result) => {\n\t\t\t\t\tthis.states.set(name, result);\n\n\t\t\t\t\tthis.maybeEmit();\n\t\t\t\t},\n\t\t\t\tlog: (message) => this.reporter.log(message),\n\t\t\t});\n\n\t\t\tthis.participantInstances.push(instance);\n\t\t}\n\t}\n\n\tpublic destroy() {\n\t\tfor (const instance of this.participantInstances) {\n\t\t\tinstance.destroy();\n\t\t}\n\t}\n\n\tprivate maybeEmit() {\n\t\tconst errors: Error[] = [];\n\t\tconst results: BuildSuccessResult[] = [];\n\n\t\tfor (const [_, state] of this.states) {\n\t\t\tif (state.type === \"busy\") {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (state.type === \"success\") {\n\t\t\t\tresults.push(state);\n\t\t\t} else if (state.type === \"error\") {\n\t\t\t\terrors.push(state.error);\n\t\t\t}\n\t\t}\n\n\t\tif (errors.length > 0) {\n\t\t\tthis.emit(\n\t\t\t\t\"error\",\n\t\t\t\terrors.length === 1 ? errors[0] : new AggregateError(errors),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst completeResult: BuildArtefacts = {\n\t\t\tjs: \"\",\n\t\t};\n\n\t\tconst sourceMapGenerator = new SourceMapGenerator();\n\n\t\tfor (const result of results) {\n\t\t\tif (result.artefacts.js) {\n\t\t\t\tif (completeResult.js) {\n\t\t\t\t\tcompleteResult.js += \"\\n\";\n\t\t\t\t}\n\n\t\t\t\tif (result.artefacts.sourceMap) {\n\t\t\t\t\tconst lines = completeResult.js.split(\"\\n\").length - 1;\n\t\t\t\t\tconst sourceMap = new SourceMapConsumer(\n\t\t\t\t\t\tJSON.parse(result.artefacts.sourceMap),\n\t\t\t\t\t);\n\n\t\t\t\t\tconst sources = new Set<string>();\n\t\t\t\t\tsourceMap.eachMapping((mapping) => {\n\t\t\t\t\t\tsourceMapGenerator.addMapping({\n\t\t\t\t\t\t\tgenerated: {\n\t\t\t\t\t\t\t\tline: lines + mapping.generatedLine,\n\t\t\t\t\t\t\t\tcolumn: mapping.generatedColumn,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\toriginal:\n\t\t\t\t\t\t\t\tmapping.originalLine !== null &&\n\t\t\t\t\t\t\t\tmapping.originalColumn !== null\n\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\tline: mapping.originalLine,\n\t\t\t\t\t\t\t\t\t\t\tcolumn: mapping.originalColumn,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\tsource: mapping.source,\n\t\t\t\t\t\t\tname: mapping.name,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif (mapping.source !== null) {\n\t\t\t\t\t\t\tsources.add(mapping.source);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tfor (const source of sources) {\n\t\t\t\t\t\tconst content = sourceMap.sourceContentFor(source);\n\n\t\t\t\t\t\tif (content !== null) {\n\t\t\t\t\t\t\tsourceMapGenerator.setSourceContent(\n\t\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\t\tcontent,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcompleteResult.js += result.artefacts.js;\n\t\t\t}\n\n\t\t\tif (result.artefacts.declarations) {\n\t\t\t\tif (completeResult.declarations) {\n\t\t\t\t\tcompleteResult.declarations += \"\\n\";\n\t\t\t\t} else {\n\t\t\t\t\tcompleteResult.declarations = \"\";\n\t\t\t\t}\n\n\t\t\t\tcompleteResult.declarations += result.artefacts.declarations;\n\t\t\t}\n\t\t}\n\n\t\tcompleteResult.sourceMap = sourceMapGenerator.toString();\n\n\t\tthis.writer(completeResult).then(() => {\n\t\t\tthis.emit(\"build\");\n\t\t});\n\t}\n}\n","export default {\n\t$schema: \"http://json-schema.org/draft-07/schema\",\n\t$id: \"https://archive.intelligentgraphics.biz/schemas/gfx/animation.json\",\n\t$comment: \"Version 2023-02-17, Source: ig.data.gfx/Specs/animation.json\",\n\ttitle: \"Animation description format\",\n\tadditionalProperties: false,\n\ttype: \"object\",\n\tproperties: {\n\t\t$schema: {\n\t\t\ttype: \"string\",\n\t\t},\n\t\tId: {\n\t\t\ttype: \"string\",\n\t\t\tdescription:\n\t\t\t\t\"Animation id, to be unique in the project scope. Needs to be a valid JavaScript identifier.\",\n\t\t},\n\t\tAnimations: {\n\t\t\ttype: \"array\",\n\t\t\tdescription: \"Declaration of animation states for gfx objects\",\n\t\t\titems: {\n\t\t\t\ttype: \"object\",\n\t\t\t\tadditionalProperties: false,\n\t\t\t\tproperties: {\n\t\t\t\t\t_: {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescription: \"Comment\",\n\t\t\t\t\t},\n\t\t\t\t\tPath: {\n\t\t\t\t\t\t$ref: \"#/definitions/igxcPath\",\n\t\t\t\t\t},\n\t\t\t\t\tStates: {\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\tadditionalProperties: {\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tPosition: {\n\t\t\t\t\t\t\t\t\t$ref: \"#/definitions/vec3\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tRotation: {\n\t\t\t\t\t\t\t\t\t$ref: \"#/definitions/rotation\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tScaling: {\n\t\t\t\t\t\t\t\t\t$ref: \"#/definitions/vec3\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tVisibility: {\n\t\t\t\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tDeformation: {\n\t\t\t\t\t\t\t\t\tanyOf: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tKinematics: {\n\t\t\toneOf: [\n\t\t\t\t{\n\t\t\t\t\t$ref: \"#/definitions/kinematicChain\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"array\",\n\t\t\t\t\titems: {\n\t\t\t\t\t\t$ref: \"#/definitions/kinematicChain\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tLinkedPoints: {\n\t\t\ttype: \"object\",\n\t\t\tadditionalProperties: {\n\t\t\t\ttype: \"array\",\n\t\t\t\titems: {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t_: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Comment\",\n\t\t},\n\t},\n\tdefinitions: {\n\t\tvec3: {\n\t\t\ttype: \"object\",\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tX: {\n\t\t\t\t\tanyOf: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tY: {\n\t\t\t\t\tanyOf: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tZ: {\n\t\t\t\t\tanyOf: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t_: {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tdescription: \"Comment\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\trotation: {\n\t\t\ttype: \"object\",\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tQ: {\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"If true, the rotation is considered to be a Quaternion. Otherwise, it's interpreted as Euler arcs and W will be ignored.\",\n\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t},\n\t\t\t\tX: {\n\t\t\t\t\tanyOf: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tY: {\n\t\t\t\t\tanyOf: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tZ: {\n\t\t\t\t\tanyOf: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tW: {\n\t\t\t\t\tanyOf: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t_: {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tdescription: \"Comment\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tigxcPath: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Relative path of the target object\",\n\t\t\tpattern: \"^((o|e)\\\\d+(\\\\.(o|e)\\\\d+)*|\\\\.)$\",\n\t\t},\n\t\tparam: {\n\t\t\ttype: \"string\",\n\t\t\tpattern: \"^Param\\\\d+$\",\n\t\t},\n\t\tkinematicChain: {\n\t\t\ttype: \"object\",\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tGeometryBase: {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t},\n\t\t\t\tJoints: {\n\t\t\t\t\ttype: \"array\",\n\t\t\t\t\titems: {\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tName: {\n\t\t\t\t\t\t\t\toneOf: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$ref: \"#/definitions/param\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tHeadX: {\n\t\t\t\t\t\t\t\toneOf: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$ref: \"#/definitions/param\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$ref: \"#/definitions/igxcPath\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tHeadY: {\n\t\t\t\t\t\t\t\toneOf: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$ref: \"#/definitions/param\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$ref: \"#/definitions/igxcPath\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tHeadZ: {\n\t\t\t\t\t\t\t\toneOf: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$ref: \"#/definitions/param\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$ref: \"#/definitions/igxcPath\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tTail: {\n\t\t\t\t\t\t\t\toneOf: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$ref: \"#/definitions/param\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$ref: \"#/definitions/igxcPath\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tLimitLeft: {\n\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tLimitRight: {\n\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tLimitUp: {\n\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tLimitDown: {\n\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tFollowJointNode: {\n\t\t\t\t\t\t\t\t$ref: \"#/definitions/igxcPath\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t_TargetNodeForFollow: {\n\t\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tTarget: {\n\t\t\t\t\toneOf: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$ref: \"#/definitions/igxcPath\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$ref: \"#/definitions/param\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\tenum: [\"subbase\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tParent: {\n\t\t\t\t\toneOf: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$ref: \"#/definitions/igxcPath\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\t\tenum: [\"root\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tTolerance: {\n\t\t\t\t\ttype: \"number\",\n\t\t\t\t},\n\t\t\t\tMaxIterations: {\n\t\t\t\t\ttype: \"integer\",\n\t\t\t\t},\n\t\t\t\t_: {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tdescription: \"Comment\",\n\t\t\t\t},\n\t\t\t\t__: {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tdescription: \"Super Comment\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n};\n","import * as path from \"node:path\";\nimport * as fs from \"fs/promises\";\n\nimport {\n\ttype PackageLocation,\n\ttype CreatorPackage,\n\treadPackageAnimationList,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nimport type { BuildParticipant, BuilderEnvironment } from \"./types\";\nimport Ajv, { type ValidateFunction } from \"ajv\";\nimport animationSchema from \"./animation.schema\";\n\nexport const createAnimationBuildParticipant = (\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n): BuildParticipant => {\n\treturn (env: BuilderEnvironment) => {\n\t\tenv.onBuildStart();\n\n\t\tbundleAnimations(location, manifest, env.log)\n\t\t\t.then((result) => {\n\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\ttype: \"success\",\n\t\t\t\t\tartefacts: {\n\t\t\t\t\t\tjs: result?.js ?? \"\",\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t})\n\t\t\t.catch((err) => {\n\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terror: err.message,\n\t\t\t\t});\n\t\t\t});\n\n\t\treturn {\n\t\t\tdestroy: () => {},\n\t\t};\n\t};\n};\n\nexport const createAnimationWatchBuildParticipant =\n\t(location: PackageLocation, manifest: CreatorPackage): BuildParticipant =>\n\t(env) => {\n\t\tenv.onBuildStart();\n\n\t\tbundleAnimations(location, manifest, env.log)\n\t\t\t.then((result) => {\n\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\ttype: \"success\",\n\t\t\t\t\tartefacts: {\n\t\t\t\t\t\tjs: result?.js ?? \"\",\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t})\n\t\t\t.catch((err) => {\n\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terror: err.message,\n\t\t\t\t});\n\t\t\t});\n\n\t\t(async () => {\n\t\t\tfor await (const event of fs.watch(location.scriptsDir)) {\n\t\t\t\tif (event.filename?.endsWith(\".animation.json\")) {\n\t\t\t\t\tenv.onBuildStart();\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await bundleAnimations(\n\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\tmanifest,\n\t\t\t\t\t\t\tenv.log,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\t\t\ttype: \"success\",\n\t\t\t\t\t\t\tartefacts: {\n\t\t\t\t\t\t\t\tjs: result?.js ?? \"\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\t\terror:\n\t\t\t\t\t\t\t\terr instanceof Error\n\t\t\t\t\t\t\t\t\t? err\n\t\t\t\t\t\t\t\t\t: new Error(String(err)),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t})();\n\n\t\treturn {\n\t\t\tdestroy: () => {},\n\t\t};\n\t};\n\nconst bundleAnimations = async (\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n\tlogStep: (message: string) => void,\n) => {\n\tconst animations = new Map<string, string>();\n\n\tfor (const scriptFilePath of readPackageAnimationList(location)) {\n\t\tconst content = await fs.readFile(scriptFilePath, {\n\t\t\tencoding: \"utf8\",\n\t\t})!;\n\n\t\tlet data: { Id: string; $schema?: string };\n\n\t\ttry {\n\t\t\tdata = JSON.parse(content);\n\t\t} catch (err) {\n\t\t\tconst relativePath = path.relative(location.path, scriptFilePath);\n\n\t\t\tif (err instanceof SyntaxError) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Encountered invalid syntax in file \"${relativePath}\": ${String(\n\t\t\t\t\t\terr,\n\t\t\t\t\t)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow new Error(\n\t\t\t\t`Encountered an unexpected error while parsing animation json file at path \"${relativePath}\"`,\n\t\t\t\t{\n\t\t\t\t\tcause: err,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\tif (!data.Id) {\n\t\t\tconst fileName = path.basename(scriptFilePath, \".animation.json\");\n\t\t\tdata.Id = fileName;\n\t\t}\n\n\t\t(await getAnimationJsonValidation())(data);\n\t\tdelete data.$schema;\n\t\tanimations.set(data.Id, JSON.stringify(data));\n\t}\n\n\tif (animations.size > 0) {\n\t\tconst scope = manifest.Scope ?? manifest.Package;\n\t\tconst scopeParts = scope.split(\".\");\n\n\t\tlet js = createNamespace(scopeParts);\n\n\t\tfor (const [name, content] of animations) {\n\t\t\tjs += `${scope}[\"${name}\"] = ` + content + \";\";\n\t\t\tlogStep(`Adding animation ${scope}.${name}`);\n\t\t}\n\n\t\treturn {\n\t\t\tjs,\n\t\t};\n\t}\n\n\treturn undefined;\n};\n\nconst createNamespace = (parts: string[]) => {\n\tlet code = `var ${parts[0]};`;\n\n\tfor (let index = 0; index < parts.length; index++) {\n\t\tconst path = parts.slice(0, index + 1).join(\".\");\n\n\t\tcode += `\\n(${path} = ${path} || {});`;\n\t}\n\n\treturn code;\n};\n\nlet validateAnimationJson: ValidateFunction | undefined;\n\nconst getAnimationJsonValidation = async () => {\n\tif (validateAnimationJson === undefined) {\n\t\tvalidateAnimationJson = new Ajv({\n\t\t\tcoerceTypes: true,\n\t\t\tallErrors: true,\n\t\t\tremoveAdditional: true,\n\t\t\tuseDefaults: \"empty\",\n\t\t\tvalidateSchema: \"log\",\n\t\t}).compile(animationSchema);\n\t}\n\n\treturn validateAnimationJson!;\n};\n","// Stolen from ig.tools.core\n\nexport interface PackageVersionToVersionStringParams {\n\tbuildNumber?: boolean;\n}\n\nexport class PackageVersion {\n\t// https://regex101.com/r/90PEY9/1\n\tpublic static fullTextMatcher =\n\t\t/(\\d+)(\\.(\\d+)(\\.(\\d+)(\\.(\\d+))?(-([^\\.]+)\\.(\\d+))?)?)?/;\n\tpublic static lineMatcher =\n\t\t/^(\\d+)(\\.(\\d+)(\\.(\\d+)(\\.(\\d+))?(-([^\\.]+)\\.(\\d+))?)?)?$/;\n\n\tpublic static extractFromText(input: string, description?: string) {\n\t\tif (input === undefined) {\n\t\t\tthrow new Error(`Can not parse version from undefined`);\n\t\t}\n\n\t\tconst match = input.match(PackageVersion.fullTextMatcher);\n\n\t\tif (!match) {\n\t\t\tthrow new Error(`Could not extract a version from input: ${input}`);\n\t\t}\n\n\t\treturn PackageVersion.fromMatch(match, description);\n\t}\n\n\tpublic static extractFromLine(input: string, description?: string) {\n\t\tif (input === undefined) {\n\t\t\tthrow new Error(`Can not parse version from undefined`);\n\t\t}\n\n\t\tconst match = input.match(PackageVersion.lineMatcher);\n\n\t\tif (!match) {\n\t\t\tthrow new Error(`Could not parse version from input: ${input}`);\n\t\t}\n\n\t\treturn PackageVersion.fromMatch(match, description);\n\t}\n\n\tpublic static equals(\n\t\ta: PackageVersion,\n\t\tb: PackageVersion,\n\t\tcheckPrerelease = false,\n\t) {\n\t\tif (a.major !== b.major || a.minor !== b.minor || a.patch !== b.patch) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (checkPrerelease === false) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (a.preRelease === b.preRelease) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (a.preRelease === undefined || b.preRelease === undefined) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn (\n\t\t\ta.preRelease.type === b.preRelease.type &&\n\t\t\ta.preRelease.version === b.preRelease.version\n\t\t);\n\t}\n\n\tprivate static fromMatch(\n\t\t[\n\t\t\t,\n\t\t\tmajor,\n\t\t\t,\n\t\t\tminor = \"0\",\n\t\t\t,\n\t\t\tpatch = \"0\",\n\t\t\t,\n\t\t\tbuild,\n\t\t\t,\n\t\t\tpreReleaseType,\n\t\t\tpreReleaseNumber,\n\t\t]: RegExpMatchArray,\n\t\tdescription?: string,\n\t) {\n\t\tlet preRelease: PackageVersion[\"preRelease\"] = undefined;\n\t\tlet buildNumber = 100;\n\n\t\tif (preReleaseType && preReleaseNumber) {\n\t\t\tpreRelease = {\n\t\t\t\ttype: preReleaseType,\n\t\t\t\tversion: parseInt(preReleaseNumber),\n\t\t\t};\n\t\t}\n\n\t\tif (build) {\n\t\t\tbuildNumber = Number(build);\n\t\t} else if (description) {\n\t\t\tconst descriptionMatch = description.match(/(\\d+)\\)$/);\n\n\t\t\tif (descriptionMatch) {\n\t\t\t\tbuildNumber = parseInt(descriptionMatch[1]);\n\t\t\t}\n\t\t}\n\n\t\treturn new PackageVersion(\n\t\t\tparseInt(major),\n\t\t\tparseInt(minor),\n\t\t\tparseInt(patch),\n\t\t\tpreRelease,\n\t\t\tbuildNumber,\n\t\t);\n\t}\n\n\tpublic static sort(\n\t\ta: PackageVersion,\n\t\tb: PackageVersion,\n\t\tascending: boolean = true,\n\t) {\n\t\tconst createSortResult = (a: number, b: number) =>\n\t\t\tascending ? a - b : b - a;\n\n\t\tif (a.major !== b.major) {\n\t\t\treturn createSortResult(a.major, b.major);\n\t\t}\n\n\t\tif (a.minor !== b.minor) {\n\t\t\treturn createSortResult(a.minor, b.minor);\n\t\t}\n\n\t\tif (a.patch !== b.patch) {\n\t\t\treturn createSortResult(a.patch, b.patch);\n\t\t}\n\n\t\treturn createSortResult(\n\t\t\ta.preRelease ? a.preRelease.version : 0,\n\t\t\tb.preRelease ? b.preRelease.version : 0,\n\t\t);\n\t}\n\n\tprivate static toNumber(version: PackageVersion) {\n\t\treturn (\n\t\t\t((version.major * 1000 + version.minor) * 1000 + version.patch) *\n\t\t\t\t1000 +\n\t\t\tversion.buildNumber\n\t\t);\n\t}\n\n\tconstructor(\n\t\tpublic major: number,\n\t\tpublic minor: number,\n\t\tpublic patch: number,\n\t\tpublic preRelease: { type: string; version: number } | undefined,\n\t\tpublic buildNumber: number,\n\t) {}\n\n\tpublic isPreRelease() {\n\t\treturn this.preRelease !== undefined;\n\t}\n\n\tpublic clone() {\n\t\treturn new PackageVersion(\n\t\t\tthis.major,\n\t\t\tthis.minor,\n\t\t\tthis.patch,\n\t\t\tthis.preRelease ? { ...this.preRelease } : undefined,\n\t\t\tthis.buildNumber,\n\t\t);\n\t}\n\n\tpublic incrementMajor() {\n\t\tthis.preRelease = undefined;\n\t\tthis.patch = 0;\n\t\tthis.minor = 0;\n\t\tthis.major++;\n\t}\n\n\tpublic incrementMinor() {\n\t\tthis.preRelease = undefined;\n\t\tthis.patch = 0;\n\t\tthis.minor++;\n\t}\n\n\tpublic incrementPatch() {\n\t\tthis.preRelease = undefined;\n\t\tthis.patch++;\n\t}\n\n\tpublic createPreRelease(type: string) {\n\t\tif (!this.preRelease) {\n\t\t\tthis.buildNumber = 1;\n\t\t} else {\n\t\t\tthis.buildNumber++;\n\t\t}\n\n\t\tif (this.preRelease && type === this.preRelease.type) {\n\t\t\tthis.preRelease.version++;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.preRelease = {\n\t\t\tversion: 0,\n\t\t\ttype,\n\t\t};\n\t}\n\n\tpublic createRelease() {\n\t\tthis.preRelease = undefined;\n\t\tthis.buildNumber = 100;\n\t}\n\n\tpublic toVersionString({\n\t\tbuildNumber,\n\t}: PackageVersionToVersionStringParams = {}) {\n\t\tlet version = [this.major, this.minor, this.patch].join(\".\");\n\n\t\tif (buildNumber) {\n\t\t\tversion += \".\" + this.buildNumber;\n\t\t}\n\n\t\tif (this.preRelease) {\n\t\t\tversion += `-${this.preRelease.type}.${this.preRelease.version}`;\n\t\t}\n\n\t\treturn version;\n\t}\n\n\tpublic toDescriptionString(packageName: string) {\n\t\tconst base = [this.major, this.minor, this.patch].join(\".\");\n\t\tconst parts: (number | string)[] = [packageName, base];\n\n\t\tif (this.preRelease) {\n\t\t\tparts.push(upperCaseFirst(this.preRelease.type));\n\t\t\tparts.push(this.preRelease.version);\n\t\t}\n\n\t\tparts.push(`(${base}.${this.buildNumber})`);\n\n\t\treturn parts.join(\" \");\n\t}\n\n\t/**\n\t * Determines wether the version is lesser than the input version\n\t *\n\t * @param {PackageVersion} version\n\t * @returns\n\t */\n\tpublic isLesserThan(version: PackageVersion) {\n\t\treturn PackageVersion.toNumber(this) < PackageVersion.toNumber(version);\n\t}\n\n\t/**\n\t * Determines wether the version is greater than the input version\n\t *\n\t * @param {PackageVersion} version\n\t * @returns\n\t */\n\tpublic isGreaterThan(version: PackageVersion) {\n\t\treturn PackageVersion.toNumber(this) > PackageVersion.toNumber(version);\n\t}\n}\n\nconst upperCaseFirst = (input: string) => {\n\treturn input.slice(0, 1).toUpperCase() + input.slice(1);\n};\n","import * as path from \"node:path\";\nimport * as fs from \"fs/promises\";\nimport * as terser from \"terser\";\nimport { EOL } from \"node:os\";\nimport ts from \"typescript\";\n\nimport {\n\tconsoleReporter,\n\tcreatePackageScopedReporter,\n\tgetPackageTypescriptFiles,\n\tisErrorENOENT,\n\ttype Reporter,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nimport {\n\tcreateTSCBuildParticipant,\n\tcreateTSCWatchBuildParticipant,\n} from \"./tsc\";\nimport {\n\ttype CreatorPackage,\n\ttype PackageLocation,\n\treadPackageCreatorManifest,\n\treadPackageNpmManifest,\n} from \"../../lib/package\";\nimport { type WorkspaceLocation } from \"../../lib/workspace\";\nimport { toposort } from \"../../lib/toposort\";\nimport type { PackageJSON } from \"../../lib/packageJSON\";\nimport type { BuildArtefacts, BuildParticipant } from \"./types\";\nimport { BuildManager } from \"./manager\";\nimport {\n\tcreateAnimationBuildParticipant,\n\tcreateAnimationWatchBuildParticipant,\n} from \"./animations\";\nimport { isScriptPackageModules } from \"../../lib/scripts\";\nimport { PackageVersion } from \"../../lib/packageVersion\";\n\nexport interface BannerOptions {\n\ttext: string | undefined;\n\tversion: string | undefined;\n\tcommit: string | undefined;\n\tcommitDirty: boolean | undefined;\n\tdate: Date | undefined;\n}\n\nexport interface BuildFoldersOptions {\n\tworkspace: WorkspaceLocation;\n\tpackages: PackageLocation[];\n\toutDir?: string;\n\tminimize: boolean;\n\tbanner?: BannerOptions;\n\tclean?: boolean;\n\tdocs?: boolean;\n\treporter?: Reporter;\n\tpreparedReporter?: Reporter;\n\tdocsHandler?(\n\t\tlocation: PackageLocation,\n\t\tdeclarationFile: string,\n\t\toutFolder: string,\n\t\tname: string,\n\t): Promise<void>;\n}\n\nexport interface BuildFolderOptions extends BuildFoldersOptions {\n\toutFile: string;\n}\n\nexport interface FolderBuilderResult {\n\tjs: string;\n\tdefinitions: string;\n}\n\nexport type FolderBuilder = (\n\tlocation: PackageLocation,\n\toutputDir: string,\n) => Promise<FolderBuilderResult>;\n\ntype FolderData = {\n\tlocation: PackageLocation;\n\tdata?: PackageJSON;\n};\n\nexport async function buildFolders(options: BuildFoldersOptions) {\n\tif (options.outDir !== undefined && options.clean) {\n\t\tawait fs.rm(options.outDir, { recursive: true });\n\t}\n\n\tconst baseReporter = options.reporter ?? consoleReporter;\n\tconst workspace = options.workspace;\n\tconst folders = options.packages;\n\n\tlet sortedPackages = sortPackagesByBuildOrder(folders);\n\n\tlet index = 1;\n\n\tconst manifests = new Map(\n\t\tsortedPackages.map(\n\t\t\t(location) =>\n\t\t\t\t[location, readPackageCreatorManifest(location)] as const,\n\t\t),\n\t);\n\n\tconst maxNameLength = Array.from(\n\t\tmanifests.values(),\n\t\t(manifest) => manifest.Package.length,\n\t).reduce((acc, length) => Math.max(acc, length), 0);\n\n\tconst managers: BuildManager[] = [];\n\n\tfor (const location of sortedPackages) {\n\t\tconst tsConfig = await ensureTsConfig(location);\n\n\t\tconst data = manifests.get(location)!;\n\n\t\tconst reporter =\n\t\t\toptions.preparedReporter ??\n\t\t\tcreatePackageScopedReporter(\n\t\t\t\tbaseReporter,\n\t\t\t\tdata.Package,\n\t\t\t\tindex,\n\t\t\t\tfolders.length,\n\t\t\t\tmaxNameLength,\n\t\t\t);\n\n\t\tconst outputDirectory = options.outDir || location.scriptsDir;\n\t\tawait fs.mkdir(outputDirectory, { recursive: true });\n\n\t\tconst manager = new BuildManager(\n\t\t\tdata,\n\t\t\t(result) =>\n\t\t\t\twriteBuildResult(\n\t\t\t\t\tresult,\n\t\t\t\t\tdata,\n\t\t\t\t\tlocation,\n\t\t\t\t\tworkspace,\n\t\t\t\t\toutputDirectory,\n\t\t\t\t\toptions.minimize,\n\t\t\t\t\treporter,\n\t\t\t\t),\n\t\t\treporter,\n\t\t);\n\n\t\tif (options.banner) {\n\t\t\tmanager.addParticipant(\n\t\t\t\t\"banner\",\n\t\t\t\tcreateBannerCommentBuildParticipant(options.banner),\n\t\t\t);\n\t\t}\n\n\t\tconst typescriptFiles = getPackageTypescriptFiles(location);\n\n\t\tif (\n\t\t\t!typescriptFiles.some(\n\t\t\t\t(file) => path.basename(file).toLowerCase() === \"version.ts\",\n\t\t\t)\n\t\t) {\n\t\t\tmanager.addParticipant(\n\t\t\t\t\"version\",\n\t\t\t\tcreateVersionLogBuildParticipant(data),\n\t\t\t);\n\t\t}\n\n\t\tif (typescriptFiles.length > 0) {\n\t\t\tif (isScriptPackageModules(tsConfig.options)) {\n\t\t\t\tconst { createRollupBuildParticipant } =\n\t\t\t\t\tawait import(\"./rollup\");\n\n\t\t\t\tmanager.addParticipant(\n\t\t\t\t\t\"rollup\",\n\t\t\t\t\tcreateRollupBuildParticipant(\n\t\t\t\t\t\tlocation,\n\t\t\t\t\t\tdata,\n\t\t\t\t\t\toutputDirectory,\n\t\t\t\t\t\t!tsConfig.options.declaration,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tmanager.addParticipant(\n\t\t\t\t\t\"tsc\",\n\t\t\t\t\tcreateTSCBuildParticipant(\n\t\t\t\t\t\tlocation,\n\t\t\t\t\t\toutputDirectory,\n\t\t\t\t\t\t// in the past we always created declaration files,\n\t\t\t\t\t\t// so we'll use it as the default for legacy modules\n\t\t\t\t\t\ttsConfig.options.declaration === false,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tmanager.addParticipant(\n\t\t\t\"animation\",\n\t\t\tcreateAnimationBuildParticipant(location, data),\n\t\t);\n\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tmanager.addListener(\"start\", () => {\n\t\t\t\treporter.log(`Build started`);\n\t\t\t});\n\t\t\tmanager.addListener(\"error\", (error: Error) => {\n\t\t\t\treject(error);\n\t\t\t});\n\t\t\tmanager.addListener(\"build\", () => {\n\t\t\t\treporter.log(`Build complete`);\n\t\t\t\tresolve();\n\t\t\t});\n\t\t\tmanager.run();\n\t\t});\n\n\t\tmanagers.push(manager);\n\n\t\tif (options.docs) {\n\t\t\tif (!options.docsHandler) {\n\t\t\t\tthrow new Error(\"Handler for typescript docs not available\");\n\t\t\t}\n\n\t\t\treporter.log(\"Generating typedoc documentation\");\n\t\t\tawait options.docsHandler(\n\t\t\t\tlocation,\n\t\t\t\tpath.join(outputDirectory, `${data.Package}.d.ts`),\n\t\t\t\tpath.join(workspace.path, \"docs\", data.Package),\n\t\t\t\tdata.Package,\n\t\t\t);\n\t\t}\n\n\t\tindex++;\n\t}\n}\n\nexport async function buildFoldersWatch(options: BuildFoldersOptions) {\n\tif (options.outDir !== undefined && options.clean) {\n\t\tawait fs.rm(options.outDir, { recursive: true });\n\t}\n\n\tconst workspace = options.workspace;\n\tconst folders = options.packages;\n\tconst baseReporter = options.reporter ?? consoleReporter;\n\n\tlet sortedPackages = sortPackagesByBuildOrder(folders);\n\n\tlet index = 1;\n\n\tconst manifests = new Map(\n\t\tsortedPackages.map(\n\t\t\t(location) =>\n\t\t\t\t[location, readPackageCreatorManifest(location)] as const,\n\t\t),\n\t);\n\n\tconst maxNameLength = Array.from(\n\t\tmanifests.values(),\n\t\t(manifest) => manifest.Package.length,\n\t).reduce((acc, length) => Math.max(acc, length), 0);\n\n\tconst managers: BuildManager[] = [];\n\n\tfor (const location of sortedPackages) {\n\t\tconst tsConfig = await ensureTsConfig(location);\n\n\t\tconst baseReporter = options.reporter ?? consoleReporter;\n\n\t\tconst data = manifests.get(location)!;\n\n\t\tconst reporter =\n\t\t\toptions.preparedReporter ??\n\t\t\tcreatePackageScopedReporter(\n\t\t\t\tbaseReporter,\n\t\t\t\tdata.Package,\n\t\t\t\tindex,\n\t\t\t\tfolders.length,\n\t\t\t\tmaxNameLength,\n\t\t\t);\n\n\t\tconst outputDirectory = options.outDir || location.scriptsDir;\n\t\tawait fs.mkdir(outputDirectory, { recursive: true });\n\n\t\tconst manager = new BuildManager(\n\t\t\tdata,\n\t\t\t(result) =>\n\t\t\t\twriteBuildResult(\n\t\t\t\t\tresult,\n\t\t\t\t\tdata,\n\t\t\t\t\tlocation,\n\t\t\t\t\tworkspace,\n\t\t\t\t\toutputDirectory,\n\t\t\t\t\toptions.minimize,\n\t\t\t\t\treporter,\n\t\t\t\t),\n\t\t\treporter,\n\t\t);\n\n\t\tif (options.banner) {\n\t\t\tmanager.addParticipant(\n\t\t\t\t\"banner\",\n\t\t\t\tcreateBannerCommentBuildParticipant(options.banner),\n\t\t\t);\n\t\t}\n\n\t\tconst typescriptFiles = getPackageTypescriptFiles(location);\n\n\t\tif (\n\t\t\t!typescriptFiles.some(\n\t\t\t\t(file) => path.basename(file).toLowerCase() === \"version.ts\",\n\t\t\t)\n\t\t) {\n\t\t\tmanager.addParticipant(\n\t\t\t\t\"version\",\n\t\t\t\tcreateVersionLogBuildParticipant(data),\n\t\t\t);\n\t\t}\n\n\t\tif (typescriptFiles.length > 0) {\n\t\t\tif (isScriptPackageModules(tsConfig.options)) {\n\t\t\t\tconst { createRollupWatchBuildParticipant } =\n\t\t\t\t\tawait import(\"./rollup\");\n\n\t\t\t\tmanager.addParticipant(\n\t\t\t\t\t\"rollup\",\n\t\t\t\t\tcreateRollupWatchBuildParticipant(\n\t\t\t\t\t\tlocation,\n\t\t\t\t\t\tdata,\n\t\t\t\t\t\toutputDirectory,\n\t\t\t\t\t\t!tsConfig.options.declaration,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tmanager.addParticipant(\n\t\t\t\t\t\"tsc\",\n\t\t\t\t\tcreateTSCWatchBuildParticipant(\n\t\t\t\t\t\tlocation,\n\t\t\t\t\t\toutputDirectory,\n\t\t\t\t\t\t// in the past we always created declaration files,\n\t\t\t\t\t\t// so we'll use it as the default for legacy modules\n\t\t\t\t\t\ttsConfig.options.declaration === false,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tmanager.addParticipant(\n\t\t\t\"animation\",\n\t\t\tcreateAnimationWatchBuildParticipant(location, data),\n\t\t);\n\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tmanager.addListener(\"start\", () => {\n\t\t\t\treporter.log(`Build started`);\n\t\t\t});\n\t\t\tmanager.addListener(\"error\", (error: string) => {\n\t\t\t\treporter.log(`Build failed: ${EOL}${error}`);\n\t\t\t\tresolve();\n\t\t\t});\n\t\t\tmanager.addListener(\"build\", () => {\n\t\t\t\treporter.log(`Build complete`);\n\t\t\t\tresolve();\n\t\t\t});\n\t\t\tmanager.run();\n\t\t});\n\n\t\tmanagers.push(manager);\n\n\t\tindex++;\n\t}\n\n\treturn {\n\t\tdestroy: () => {\n\t\t\tfor (const manager of managers) {\n\t\t\t\tmanager.destroy();\n\t\t\t}\n\t\t},\n\t};\n}\n\nasync function writeBuildResult(\n\tbuildResult: BuildArtefacts,\n\tmanifest: CreatorPackage,\n\tlocation: PackageLocation,\n\tworkspace: WorkspaceLocation,\n\toutputDirectory: string,\n\tminimize: boolean,\n\treporter: Reporter,\n) {\n\tlet js = buildResult.js;\n\n\tif (buildResult.sourceMap) {\n\t\tjs += `\\n//# sourceMappingURL=${manifest.Package}.js.map`;\n\t}\n\n\tawait fs.writeFile(\n\t\tpath.join(outputDirectory, `${manifest.Package}.js`),\n\t\tjs,\n\t\t{ encoding: \"utf8\" },\n\t);\n\tif (buildResult.declarations !== undefined) {\n\t\tawait fs.writeFile(\n\t\t\tpath.join(outputDirectory, `${manifest.Package}.d.ts`),\n\t\t\tbuildResult.declarations,\n\t\t\t{ encoding: \"utf8\" },\n\t\t);\n\t}\n\tif (buildResult.sourceMap !== undefined) {\n\t\tawait fs.writeFile(\n\t\t\tpath.join(outputDirectory, `${manifest.Package}.js.map`),\n\t\t\tbuildResult.sourceMap,\n\t\t\t{ encoding: \"utf8\" },\n\t\t);\n\t}\n\n\tif (minimize) {\n\t\treporter.log(\"Minifying the output\");\n\n\t\tconst minifyResult = await terser.minify(js, {\n\t\t\tecma: 5,\n\t\t\tsourceMap: {\n\t\t\t\tcontent: buildResult.sourceMap,\n\t\t\t\tincludeSources: false,\n\t\t\t},\n\t\t});\n\n\t\tconst minifiedPath = path.join(\n\t\t\toutputDirectory,\n\t\t\t`${manifest.Package}.min.js`,\n\t\t);\n\n\t\tlet code = minifyResult.code!;\n\n\t\tif (minifyResult.map) {\n\t\t\tcode += `\\n//# sourceMappingURL=${manifest.Package}.min.js.map`;\n\t\t}\n\n\t\tawait fs.writeFile(minifiedPath, code, {\n\t\t\tencoding: \"utf8\",\n\t\t});\n\t\tif (minifyResult.map !== undefined) {\n\t\t\tawait fs.writeFile(\n\t\t\t\tminifiedPath + \".map\",\n\t\t\t\ttypeof minifyResult.map === \"string\"\n\t\t\t\t\t? minifyResult.map\n\t\t\t\t\t: JSON.stringify(minifyResult.map),\n\t\t\t\t{ encoding: \"utf8\" },\n\t\t\t);\n\t\t}\n\t}\n\n\tif (\n\t\tlocation.path.includes(\"Basics\") &&\n\t\tbuildResult.declarations !== undefined\n\t) {\n\t\tawait fs.mkdir(path.join(workspace.path, \"lib\"), {\n\t\t\trecursive: true,\n\t\t});\n\n\t\treporter.log(\"Copying basics definition file to the lib folder\");\n\t\tawait fs.writeFile(\n\t\t\tpath.join(workspace.path, \"lib\", `${manifest.Package}.d.ts`),\n\t\t\tbuildResult.declarations,\n\t\t\t{ encoding: \"utf8\" },\n\t\t);\n\t}\n}\n\nfunction createVersionLogBuildParticipant(\n\tmanifest: CreatorPackage,\n): BuildParticipant {\n\treturn (env) => {\n\t\tenv.onBuildStart();\n\n\t\tconst parsedVersion =\n\t\t\tmanifest.Version !== undefined\n\t\t\t\t? PackageVersion.extractFromLine(manifest.Version)\n\t\t\t\t: undefined;\n\n\t\tlet logText: string;\n\n\t\tif (parsedVersion !== undefined) {\n\t\t\tlogText = parsedVersion.toDescriptionString(manifest.Package);\n\t\t} else {\n\t\t\tlogText = manifest.Package;\n\t\t}\n\n\t\tlogText += \".\";\n\n\t\tif (manifest.Copyright !== undefined) {\n\t\t\tlogText += \" \" + manifest.Copyright;\n\t\t}\n\n\t\tenv.onBuildEnd({\n\t\t\ttype: \"success\",\n\t\t\tartefacts: {\n\t\t\t\tjs: `console.log(${JSON.stringify(logText)})`,\n\t\t\t},\n\t\t});\n\n\t\treturn {\n\t\t\tdestroy: () => {},\n\t\t};\n\t};\n}\n\nfunction createBannerCommentBuildParticipant(\n\toptions: BannerOptions,\n): BuildParticipant {\n\treturn (env) => {\n\t\tenv.onBuildStart();\n\n\t\tconst banner = createBannerComment(options);\n\n\t\tenv.onBuildEnd({\n\t\t\ttype: \"success\",\n\t\t\tartefacts: {\n\t\t\t\tjs: banner ?? \"\",\n\t\t\t\tdeclarations: banner ?? \"\",\n\t\t\t},\n\t\t});\n\n\t\treturn {\n\t\t\tdestroy: () => {},\n\t\t};\n\t};\n}\n\nasync function ensureTsConfig(location: PackageLocation) {\n\tconst tsconfigPath = path.join(location.scriptsDir, \"tsconfig.json\");\n\n\ttry {\n\t\tconst content = JSON.parse(await fs.readFile(tsconfigPath, \"utf8\"));\n\n\t\tif (applyTsConfigOptions(content)) {\n\t\t\tawait fs.writeFile(\n\t\t\t\ttsconfigPath,\n\t\t\t\tJSON.stringify(content, undefined, \"\\t\"),\n\t\t\t\t\"utf8\",\n\t\t\t);\n\t\t}\n\n\t\treturn ts.parseJsonConfigFileContent(\n\t\t\tcontent,\n\t\t\tts.sys,\n\t\t\tlocation.scriptsDir,\n\t\t);\n\t} catch (err) {\n\t\tif (!isErrorENOENT(err)) {\n\t\t\tthrow err;\n\t\t}\n\n\t\tconst content = {};\n\n\t\tapplyTsConfigOptions(content);\n\t\tawait fs.writeFile(\n\t\t\ttsconfigPath,\n\t\t\tJSON.stringify(content, undefined, \"\\t\"),\n\t\t\t\"utf8\",\n\t\t);\n\n\t\treturn ts.parseJsonConfigFileContent(\n\t\t\tcontent,\n\t\t\tts.sys,\n\t\t\tlocation.scriptsDir,\n\t\t);\n\t}\n}\n\nfunction applyTsConfigOptions(data: {\n\tcompilerOptions?: {\n\t\ttarget?: string;\n\t\tlib?: string[];\n\t\tmodule?: string;\n\t\tmoduleResolution?: string;\n\t\tstrict?: boolean;\n\t};\n}) {\n\tlet expectedValues: (typeof data)[\"compilerOptions\"];\n\n\tif (data.compilerOptions?.module?.toLowerCase().startsWith(\"es\")) {\n\t\texpectedValues = {\n\t\t\ttarget: \"esnext\",\n\t\t\tlib: [\"es2024\", \"dom\"],\n\t\t\tmodule: \"es2015\",\n\t\t\tmoduleResolution: \"node\",\n\t\t};\n\t} else {\n\t\texpectedValues = {\n\t\t\ttarget: \"es5\",\n\t\t\tlib: [\"es2018\", \"dom\"],\n\t\t};\n\t}\n\n\tdata.compilerOptions = data.compilerOptions ?? {};\n\tdata.compilerOptions.strict ??= false;\n\n\tconst writeToOptions = data.compilerOptions as Record<string, any>;\n\n\tlet changed = false;\n\tfor (const [key, value] of Object.entries(expectedValues)) {\n\t\tconst currentValue: unknown = writeToOptions[key];\n\n\t\tswitch (typeof value) {\n\t\t\tcase \"string\":\n\t\t\tcase \"number\":\n\t\t\tcase \"boolean\":\n\t\t\t\tif (value !== currentValue) {\n\t\t\t\t\tchanged = true;\n\t\t\t\t\twriteToOptions[key] = value;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"object\":\n\t\t\t\tif (\n\t\t\t\t\tArray.isArray(value) &&\n\t\t\t\t\t(!Array.isArray(currentValue) ||\n\t\t\t\t\t\tvalue.length !== currentValue.length ||\n\t\t\t\t\t\tvalue.some(\n\t\t\t\t\t\t\t(item, index) => item !== currentValue[index],\n\t\t\t\t\t\t))\n\t\t\t\t) {\n\t\t\t\t\tchanged = true;\n\t\t\t\t\twriteToOptions[key] = value;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn changed;\n}\n\nfunction sortPackagesByBuildOrder(\n\tfolders: PackageLocation[],\n): PackageLocation[] {\n\tconst packages = Array.from(folders).reduce(\n\t\t(\n\t\t\tacc: Record<string, FolderData>,\n\t\t\tlocation,\n\t\t): Record<string, FolderData> => {\n\t\t\tconst data = readPackageNpmManifest(location);\n\n\t\t\tif (data !== undefined) {\n\t\t\t\tacc[data.name] = {\n\t\t\t\t\tdata,\n\t\t\t\t\tlocation,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tacc[location.path] = {\n\t\t\t\t\tdata: undefined,\n\t\t\t\t\tlocation,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn acc;\n\t\t},\n\t\t{},\n\t);\n\n\tconst packageDependencies = Object.getOwnPropertyNames(packages).reduce(\n\t\t(acc, packageName) => {\n\t\t\tconst packageData = packages[packageName];\n\n\t\t\tif (packageData.data === undefined) {\n\t\t\t\tacc[packageName] = [];\n\t\t\t} else {\n\t\t\t\tacc[packageName] = Object.getOwnPropertyNames({\n\t\t\t\t\t...packageData.data.devDependencies,\n\t\t\t\t\t...packageData.data.dependencies,\n\t\t\t\t\t...packageData.data.peerDependencies,\n\t\t\t\t}).filter((packageName) => packages[packageName] !== undefined);\n\t\t\t}\n\n\t\t\treturn acc;\n\t\t},\n\t\t{} as Record<string, string[]>,\n\t);\n\n\tconst sortedPackages = toposort(packageDependencies);\n\tconst result: PackageLocation[] = [];\n\n\tfor (const packageName of sortedPackages) {\n\t\tconst location = packages[packageName].location;\n\n\t\tif (readPackageCreatorManifest(location).Package.endsWith(\".Basics\")) {\n\t\t\tresult.unshift(location);\n\t\t} else {\n\t\t\tresult.push(location);\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction createBannerComment(banner: BannerOptions) {\n\tconst bannerParts: string[] = [];\n\n\tif (banner.text) {\n\t\tbannerParts.push(\" * \" + banner.text);\n\t}\n\n\t{\n\t\tconst details: string[] = [];\n\n\t\tif (banner.version) {\n\t\t\tdetails.push(`Version: ${banner.version}`);\n\t\t}\n\t\tif (banner.commit) {\n\t\t\tif (banner.commitDirty) {\n\t\t\t\tdetails.push(`Commit: ${banner.commit} (dirty)`);\n\t\t\t} else {\n\t\t\t\tdetails.push(`Commit: ${banner.commit}`);\n\t\t\t}\n\t\t}\n\t\tif (banner.date) {\n\t\t\tdetails.push(`Date: ${banner.date.toISOString()}`);\n\t\t}\n\n\t\tconst detailsText = details.map((line) => ` * ${line}`).join(\"\\n\");\n\t\tif (detailsText) {\n\t\t\tbannerParts.push(detailsText);\n\t\t}\n\t}\n\n\tconst bannerText = bannerParts.join(\"\\n\\n\");\n\n\tif (bannerText) {\n\t\treturn `/*\n${bannerText}\n*\n* @preserve\t\t\t\n*/`;\n\t}\n\n\treturn undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;AAUA,MAAa,mBAAmB,aAA8B;CAC7D,MAAM,EAAE,WAAW,GAAG,eACrB,KAAK,KA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G,EACF,OAAO,CACN,EACC,MAAM,UACN,EACD,EACC,MAAM,UACN,CACD,EACD;IACD,GAAG,EACF,OAAO,CACN,EACC,MAAM,UACN,EACD,EACC,MAAM,UACN,CACD,EACD;IACD,GAAG,EACF,OAAO,CACN,EACC,MAAM,UACN,EACD,EACC,MAAM,UACN,CACD,EACD;IACD,GAAG;KACF,MAAM;KACN,aAAa;KACb;IACD;GACD;EACD,UAAU;GACT,MAAM;GACN,sBAAsB;GACtB,YAAY;IACX,GAAG;KACF,aACC;KACD,MAAM;KACN;IACD,GAAG,EACF,OAAO,CACN,EACC,MAAM,UACN,EACD,EACC,MAAM,UACN,CACD,EACD;IACD,GAAG,EACF,OAAO,CACN,EACC,MAAM,UACN,EACD,EACC,MAAM,UACN,CACD,EACD;IACD,GAAG,EACF,OAAO,CACN,EACC,MAAM,UACN,EACD,EACC,MAAM,UACN,CACD,EACD;IACD,GAAG,EACF,OAAO,CACN,EACC,MAAM,UACN,EACD,EACC,MAAM,UACN,CACD,EACD;IACD,GAAG;KACF,MAAM;KACN,aAAa;KACb;IACD;GACD;EACD,UAAU;GACT,MAAM;GACN,aAAa;GACb,SAAS;GACT;EACD,OAAO;GACN,MAAM;GACN,SAAS;GACT;EACD,gBAAgB;GACf,MAAM;GACN,sBAAsB;GACtB,YAAY;IACX,cAAc,EACb,MAAM,UACN;IACD,QAAQ;KACP,MAAM;KACN,OAAO;MACN,MAAM;MACN,sBAAsB;MACtB,YAAY;OACX,MAAM,EACL,OAAO,CACN,EACC,MAAM,uBACN,EACD,EACC,MAAM,UACN,CACD,EACD;OACD,OAAO,EACN,OAAO,CACN,EACC,MAAM,uBACN,EACD,EACC,MAAM,0BACN,CACD,EACD;OACD,OAAO,EACN,OAAO,CACN,EACC,MAAM,uBACN,EACD,EACC,MAAM,0BACN,CACD,EACD;OACD,OAAO,EACN,OAAO,CACN,EACC,MAAM,uBACN,EACD,EACC,MAAM,0BACN,CACD,EACD;OACD,MAAM,EACL,OAAO,CACN,EACC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AAM,OAAO,CAAC,KAAK,KAAK;AAClE,MAAI,YACH,aAAY,KAAK,YAAY;;CAI/B,MAAM,aAAa,YAAY,KAAK,OAAO;AAE3C,KAAI,WACH,QAAO;EACP,WAAW"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateIndex-C_DxQ2R4.js","names":[],"sources":["../src/commands/generateIndex.ts"],"sourcesContent":["import ts from \"typescript\";\n\nimport {\n\tresolveNamespaceFullName,\n\tresolveNamespaces,\n\ttype Namespace,\n\tfindNamespaceByMemberSourceFile,\n} from \"@intelligentgraphics/declarationbundler\";\n\nimport {\n\ttype PackageLocation,\n\twritePackageCreatorIndex,\n\treadPackageCreatorIndex,\n\treadPackageCreatorManifest,\n} from \"../lib/package\";\nimport {\n\tgetPackageTypescriptFiles,\n\treadScriptPackageTSConfig,\n\tresolveScriptPackageEntryModule,\n} from \"../lib/scripts\";\nimport type {\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,\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\tif (strictOptional === undefined) {\n\t\tstrictOptional =\n\t\t\tcompilerOptions.strict === true ||\n\t\t\tcompilerOptions.strictNullChecks === true;\n\t}\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 rootNamespace: Namespace | undefined;\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\trootNamespace = resolveNamespaces(\n\t\t\tentryFile,\n\t\t\tprogram,\n\t\t\thost,\n\t\t\tprogram.getTypeChecker(),\n\t\t\tmanifest.Scope ?? manifest.Package,\n\t\t);\n\t} else {\n\t\tprogram = ts.createProgram(files, { allowJs: true });\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\n\t\tif (sourceFile === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst namespace =\n\t\t\trootNamespace === undefined\n\t\t\t\t? undefined\n\t\t\t\t: findNamespaceByMemberSourceFile(rootNamespace, sourceFile);\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\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\t| {\n\t\t\t\t\t\tmappedType?: ts.Type;\n\t\t\t\t\t\tsyntheticOrigin?: ts.Symbol;\n\t\t\t\t }\n\t\t\t\t| undefined = (\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 as keyof IDocTags] = tag.comment as string;\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"],"mappings":";;;;;;;;;;;AA2CA,SAAgB,cAAc,EAC7B,UACA,SAAS,EAAE,EACX,kBACwB;CACxB,MAAM,MAA2B,EAAE;CAEnC,MAAM,gBAAgB,wBAAwB,SAAS,IAAI,EAAE;CAC7D,MAAM,WAAW,2BAA2B,SAAS;CAErD,MAAM,kBAAkB,0BAA0B,SAAS,CAAC;CAE5D,MAAM,WACL,gBAAgB,WAAW,GAAG,WAAW,UACzC,gBAAgB,WAAW,GAAG,WAAW;AAE1C,KAAI,mBAAmB,KAAA,EACtB,kBAC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