@intelligentgraphics/ig.gfx.packager 3.1.4 → 3.2.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.
Files changed (61) hide show
  1. package/build/bin.js +7 -0
  2. package/build/bin.js.map +1 -0
  3. package/build/build-CMbCj7x-.js +945 -0
  4. package/build/build-CMbCj7x-.js.map +1 -0
  5. package/build/build-kkMVBBJL.js +408 -0
  6. package/build/build-kkMVBBJL.js.map +1 -0
  7. package/build/cli-Co1DhAmx.js +405 -0
  8. package/build/cli-Co1DhAmx.js.map +1 -0
  9. package/build/docs-BkGeoYY2.js +30 -0
  10. package/build/docs-BkGeoYY2.js.map +1 -0
  11. package/build/generateIndex-C_DxQ2R4.js +209 -0
  12. package/build/generateIndex-C_DxQ2R4.js.map +1 -0
  13. package/build/generateParameterType-CdCi5BWM.js +46 -0
  14. package/build/generateParameterType-CdCi5BWM.js.map +1 -0
  15. package/build/package-DHx2bvVO.js +1 -0
  16. package/build/postinstall-DHTlEmNr.js +35 -0
  17. package/build/postinstall-DHTlEmNr.js.map +1 -0
  18. package/build/prompter-DONgUlzS.js +20 -0
  19. package/build/prompter-DONgUlzS.js.map +1 -0
  20. package/build/publish-E5zcQAo0.js +348 -0
  21. package/build/publish-E5zcQAo0.js.map +1 -0
  22. package/build/publishNpm-CBT1819u.js +115 -0
  23. package/build/publishNpm-CBT1819u.js.map +1 -0
  24. package/build/publishedPackage-D-KiU0FG.js +1 -0
  25. package/build/rollup-Csyght27.js +179 -0
  26. package/build/rollup-Csyght27.js.map +1 -0
  27. package/build/scripts-CBblHIL1.js +29 -0
  28. package/build/scripts-CBblHIL1.js.map +1 -0
  29. package/build/versionFile-DViDwgCa.js +123 -0
  30. package/build/versionFile-DViDwgCa.js.map +1 -0
  31. package/build/workspace-D0XY2EMu.js +1 -0
  32. package/lib/lib.js +1595 -0
  33. package/package.json +30 -30
  34. package/readme.md +5 -0
  35. package/build/bin.mjs +0 -5
  36. package/build/bin.mjs.map +0 -1
  37. package/build/cli-CTqQeYIu.mjs +0 -768
  38. package/build/cli-CTqQeYIu.mjs.map +0 -1
  39. package/build/dependencies-CCIr5dgH.mjs +0 -129
  40. package/build/dependencies-CCIr5dgH.mjs.map +0 -1
  41. package/build/docs-DvFV9WXA.mjs +0 -37
  42. package/build/docs-DvFV9WXA.mjs.map +0 -1
  43. package/build/generateIndex-COnAgsMM.mjs +0 -306
  44. package/build/generateIndex-COnAgsMM.mjs.map +0 -1
  45. package/build/generateParameterType-BFVUv72F.mjs +0 -71
  46. package/build/generateParameterType-BFVUv72F.mjs.map +0 -1
  47. package/build/index-Ck4_b8Wk.mjs +0 -1400
  48. package/build/index-Ck4_b8Wk.mjs.map +0 -1
  49. package/build/index-DHSUlJia.mjs +0 -477
  50. package/build/index-DHSUlJia.mjs.map +0 -1
  51. package/build/postinstall-BTuIhY_F.mjs +0 -61
  52. package/build/postinstall-BTuIhY_F.mjs.map +0 -1
  53. package/build/publishNpm-A02qW1UY.mjs +0 -167
  54. package/build/publishNpm-A02qW1UY.mjs.map +0 -1
  55. package/build/rollup-BeQ0dM8U.mjs +0 -221
  56. package/build/rollup-BeQ0dM8U.mjs.map +0 -1
  57. package/build/scripts-B3noxiX3.mjs +0 -45
  58. package/build/scripts-B3noxiX3.mjs.map +0 -1
  59. package/build/versionFile-B9z_qwQL.mjs +0 -206
  60. package/build/versionFile-B9z_qwQL.mjs.map +0 -1
  61. package/lib/lib.mjs +0 -2706
@@ -0,0 +1 @@
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,KAAK,SAAS,YAAY,gBAAgB,GAC9C,SAAS;AACT,MAAI;AACH,UAAOA,KAAG,aAAa,MAAM,OAAO;UAC7B;AACP;;GAGF;AAED,QAAO;;AAKR,MAAa,6BAEX,UACA,WACA,sBAEA,QAA4B;CAC5B,MAAM,QAAQ,0BAA0B,SAAS;AAEjD,KAAI;AACH,MAAI,cAAc;AAElB,MAAI,IAAI,6BAA6B;EAErC,MAAM,kBAAkB,mBACvB,UACA,WACA,iBACA;EAED,MAAM,OAAO,GAAG,mBAAmB,gBAAgB;AACnD,OAAK,4BAA4B,SAAS;EAE1C,IAAI;EACJ,IAAI;EACJ,IAAI;AAEJ,OAAK,aAAa,UAAU,MAAM,uBAAuB;AACxD,OAAI,SAAS,SAAS,MAAM,CAC3B,MAAK;YACK,SAAS,SAAS,QAAQ,CACpC,eAAc;YACJ,SAAS,SAAS,UAAU,CACtC,aAAY;;EAId,MAAM,iBAA0C;GAC/C,WAAW;GACX,SAAS;GACT;GACA;EAED,MAAM,UAAU,GAAG,cAAc,eAAe;EAEhD,MAAM,aAAa,QAAQ,MAAM;EACjC,MAAM,iBAAiB,GAAG,sBAAsB,QAAQ;AAExD,MAAI,CAAC,WAAW,aAAa;AAC5B,OAAI,eAAe,SAAS,EAC3B,SAAQ,IAAI,GAAG,kBAAkB,gBAAgB,KAAK,CAAC;AAGxD,OAAI,OAAO,KAAA,KAAa,gBAAgB,KAAA,EACv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ACN,EACD,EACC,MAAM,UACN,CACD,EACD;QACD;OACD;MACD;KACD;IACD;GACD;EACD,YAAY,EACX,OAAO,CACN,EACC,MAAM,gCACN,EACD;GACC,MAAM;GACN,OAAO,EACN,MAAM,gCACN;GACD,CACD,EACD;EACD,cAAc;GACb,MAAM;GACN,sBAAsB;IACrB,MAAM;IACN,OAAO,EACN,MAAM,UACN;IACD;GACD;EACD,GAAG;GACF,MAAM;GACN,aAAa;GACb;EACD;CACD,aAAa;EACZ,MAAM;GACL,MAAM;GACN,sBAAsB;GACtB,YAAY;IACX,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,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,MAAM,uBACN,EACD,EACC,MAAM,0BACN,CACD,EACD;OACD,WAAW,EACV,MAAM,UACN;OACD,YAAY,EACX,MAAM,UACN;OACD,SAAS,EACR,MAAM,UACN;OACD,WAAW,EACV,MAAM,UACN;OACD,iBAAiB,EAChB,MAAM,0BACN;OACD,sBAAsB,EACrB,MAAM,UACN;OACD;MACD;KACD;IACD,QAAQ,EACP,OAAO;KACN,EACC,MAAM,0BACN;KACD,EACC,MAAM,uBACN;KACD;MACC,MAAM;MACN,MAAM,CAAC,UAAU;MACjB;KACD,EACD;IACD,QAAQ,EACP,OAAO,CACN,EACC,MAAM,0BACN,EACD;KACC,MAAM;KACN,MAAM,CAAC,OAAO;KACd,CACD,EACD;IACD,WAAW,EACV,MAAM,UACN;IACD,eAAe,EACd,MAAM,WACN;IACD,GAAG;KACF,MAAM;KACN,aAAa;KACb;IACD,IAAI;KACH,MAAM;KACN,aAAa;KACb;IACD;GACD;EACD;CACD;;;ACrTD,MAAa,mCACZ,UACA,aACsB;AACtB,SAAQ,QAA4B;AACnC,MAAI,cAAc;AAElB,mBAAiB,UAAU,UAAU,IAAI,IAAI,CAC3C,MAAM,WAAW;AACjB,OAAI,WAAW;IACd,MAAM;IACN,WAAW,EACV,IAAI,QAAQ,MAAM,IAClB;IACD,CAAC;IACD,CACD,OAAO,QAAQ;AACf,OAAI,WAAW;IACd,MAAM;IACN,OAAO,IAAI;IACX,CA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AI,OAAO,KACV,aAAY,KAAK,QAAQ,OAAO,KAAK;CAGtC;EACC,MAAM,UAAoB,EAAE;AAE5B,MAAI,OAAO,QACV,SAAQ,KAAK,YAAY,OAAO,UAAU;AAE3C,MAAI,OAAO,OACV,KAAI,OAAO,YACV,SAAQ,KAAK,WAAW,OAAO,OAAO,UAAU;MAEhD,SAAQ,KAAK,WAAW,OAAO,SAAS;AAG1C,MAAI,OAAO,KACV,SAAQ,KAAK,SAAS,OAAO,KAAK,aAAa,GAAG;EAGnD,MAAM,cAAc,QAAQ,KAAK,SAAS,MAAM,OAAO,CAAC,KAAK,KAAK;AAClE,MAAI,YACH,aAAY,KAAK,YAAY;;CAI/B,MAAM,aAAa,YAAY,KAAK,OAAO;AAE3C,KAAI,WACH,QAAO;EACP,WAAW"}
@@ -0,0 +1,408 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import * as glob from "glob";
4
+ import { writePackageSync } from "write-package";
5
+ import resolve from "resolve";
6
+ import axios, { AxiosError } from "axios";
7
+ //#region ../tools.core/build/stripUtf8Bom.mjs
8
+ const stripUtf8Bom = (text) => {
9
+ if (text.charCodeAt(0) === 65279) return text.slice(1);
10
+ return text;
11
+ };
12
+ //#endregion
13
+ //#region ../tools.core/build/npmPackage.mjs
14
+ const readNpmManifest = (directory) => {
15
+ const packageJsonPath = path.join(directory, "package.json");
16
+ const packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, { encoding: "utf8" }));
17
+ return JSON.parse(packageJson);
18
+ };
19
+ const writeNpmManifest = (directory, packageJson) => {
20
+ writePackageSync(path.join(directory, "package.json"), packageJson);
21
+ };
22
+ //#endregion
23
+ //#region ../tools.core/build/error.mjs
24
+ const getNodeErrorCode = (error) => {
25
+ if (error !== null && typeof error === "object" && error.code !== void 0) return error.code;
26
+ };
27
+ /**
28
+ * Permission denied: An attempt was made to access a file in a way forbidden by its file access permissions.
29
+ *
30
+ * @param {unknown} error
31
+ */
32
+ const isErrorEACCES = (error) => getNodeErrorCode(error) === "EACCES";
33
+ /**
34
+ * No such file or directory: Commonly raised by fs operations to indicate that a component of the specified pathname does not exist. No entity (file or directory) could be found by the given path.
35
+ *
36
+ * @param {unknown} error
37
+ */
38
+ const isErrorENOENT = (error) => getNodeErrorCode(error) === "ENOENT";
39
+ const isErrorEPERM = (error) => getNodeErrorCode(error) === "EPERM";
40
+ //#endregion
41
+ //#region ../tools.core/build/package.mjs
42
+ const PACKAGE_FILE = "_Package.json";
43
+ const INDEX_FILE = "_Index.json";
44
+ const ANIMATION_FILE_SUFFIX = ".animation.json";
45
+ const getCreatorIndexParameterPrimaryJSType = (type) => {
46
+ switch (type) {
47
+ case "LengthM":
48
+ case "ArcDEG":
49
+ case "Integer":
50
+ case "Int":
51
+ case "Float": return "number";
52
+ case "Boolean":
53
+ case "Bool": return "boolean";
54
+ default: return "string";
55
+ }
56
+ };
57
+ function parseCreatorPackageName(manifest) {
58
+ const [domain, subdomain] = manifest.Package.split(".");
59
+ if (subdomain === void 0) throw new Error(`Expected "Package" field of the _Package.json file to contain a value in the form of Domain.SubDomain`);
60
+ return {
61
+ domain,
62
+ subdomain
63
+ };
64
+ }
65
+ /**
66
+ * Detects the package at the given directory.
67
+ *
68
+ * @param {string} directory
69
+ * @returns {PackageLocation}
70
+ */
71
+ const detectPackage = (workspace, directory) => {
72
+ directory = path.resolve(workspace.path, directory);
73
+ const scriptsPath = path.join(directory, "Scripts");
74
+ const tsPath = path.join(directory, "ts");
75
+ let location;
76
+ if (fs.existsSync(scriptsPath)) location = {
77
+ _kind: "PackageLocation",
78
+ path: directory,
79
+ scriptsDir: scriptsPath,
80
+ manifestDir: scriptsPath
81
+ };
82
+ else if (fs.existsSync(tsPath)) location = {
83
+ _kind: "PackageLocation",
84
+ path: directory,
85
+ scriptsDir: tsPath,
86
+ manifestDir: directory
87
+ };
88
+ else location = {
89
+ _kind: "PackageLocation",
90
+ path: directory,
91
+ scriptsDir: directory,
92
+ manifestDir: directory
93
+ };
94
+ try {
95
+ readPackageCreatorManifest(location);
96
+ } catch (err) {
97
+ if (isErrorENOENT(err)) throw new Error(`No _Package.json found in ${location.manifestDir}`);
98
+ throw err;
99
+ }
100
+ return location;
101
+ };
102
+ const readPackageCreatorManifest = (location) => {
103
+ const packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);
104
+ const packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, { encoding: "utf8" }));
105
+ return JSON.parse(packageJson);
106
+ };
107
+ const writePackageCreatorManifest = (location, creatorPackage) => {
108
+ const packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);
109
+ fs.writeFileSync(packageJsonPath, JSON.stringify(creatorPackage, null, " ") + "\n");
110
+ };
111
+ const getPackageCreatorIndexPath = (location) => path.join(location.manifestDir, INDEX_FILE);
112
+ const readPackageCreatorIndex = (location) => {
113
+ try {
114
+ const indexPath = getPackageCreatorIndexPath(location);
115
+ const index = stripUtf8Bom(fs.readFileSync(indexPath, { encoding: "utf8" }));
116
+ return JSON.parse(index);
117
+ } catch (err) {
118
+ if (isErrorENOENT(err)) return;
119
+ throw err;
120
+ }
121
+ };
122
+ const writePackageCreatorIndex = (location, index) => {
123
+ const indexPath = getPackageCreatorIndexPath(location);
124
+ fs.writeFileSync(indexPath, JSON.stringify(index, null, " ") + "\n");
125
+ };
126
+ const readPackageNpmManifest = (location) => {
127
+ try {
128
+ return readNpmManifest(location.manifestDir);
129
+ } catch (err) {
130
+ if (isErrorENOENT(err)) return;
131
+ throw err;
132
+ }
133
+ };
134
+ const writePackageNpmManifest = (location, packageJson) => {
135
+ writeNpmManifest(location.manifestDir, packageJson);
136
+ };
137
+ const readPackageAnimationList = (location) => {
138
+ const directoryContent = fs.readdirSync(location.manifestDir);
139
+ const animationPathList = [];
140
+ for (const entry of directoryContent) if (entry.endsWith(ANIMATION_FILE_SUFFIX)) {
141
+ const animationPath = path.join(location.manifestDir, entry);
142
+ animationPathList.push(animationPath);
143
+ }
144
+ return animationPathList;
145
+ };
146
+ const getPackageReleasesDirectory = (location) => path.join(location.path, "Releases");
147
+ //#endregion
148
+ //#region ../tools.core/build/publishedPackage.mjs
149
+ /**
150
+ * Detects a published package from a path.
151
+ *
152
+ * Can return undefined if the package is not installed.
153
+ *
154
+ * @param {string} resolveBasePath
155
+ * @param {string} name
156
+ * @return {*} {(PublishedPackageLocation | undefined)}
157
+ */
158
+ const detectPublishedPackageFromPath = (resolveBasePath, name) => {
159
+ try {
160
+ const manifestPath = resolve.sync(name + "/package.json", { basedir: resolveBasePath });
161
+ return {
162
+ _kind: "PublishedPackageLocation",
163
+ path: path.dirname(manifestPath)
164
+ };
165
+ } catch (err) {
166
+ return;
167
+ }
168
+ };
169
+ const readPublishedPackageNpmManifest = (location) => {
170
+ return readNpmManifest(location.path);
171
+ };
172
+ const readPublishedPackageCreatorManifest = (location) => {
173
+ try {
174
+ const packageJsonPath = path.join(location.path, PACKAGE_FILE);
175
+ const packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, { encoding: "utf8" }));
176
+ return JSON.parse(packageJson);
177
+ } catch (err) {
178
+ if (isErrorENOENT(err)) return;
179
+ throw err;
180
+ }
181
+ };
182
+ const readPublishedPackageCreatorIndex = (location) => {
183
+ try {
184
+ const packageJsonPath = path.join(location.path, INDEX_FILE);
185
+ const packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, { encoding: "utf8" }));
186
+ return JSON.parse(packageJson);
187
+ } catch (err) {
188
+ if (isErrorENOENT(err)) return;
189
+ throw err;
190
+ }
191
+ };
192
+ //#endregion
193
+ //#region ../tools.core/build/workspace.mjs
194
+ const detectWorkspace = (directory) => {
195
+ directory = path.resolve(process.cwd(), directory);
196
+ return {
197
+ _kind: "WorkspaceLocation",
198
+ path: directory
199
+ };
200
+ };
201
+ const readWorkspaceNpmManifest = (workspace) => {
202
+ try {
203
+ return readNpmManifest(workspace.path);
204
+ } catch (err) {
205
+ if (isErrorENOENT(err)) throw new Error(`Expected a package.json file to exist in ${workspace.path}. See packager readme for instructions on how to create the package.json.`);
206
+ throw err;
207
+ }
208
+ };
209
+ const writeWorkspaceNpmManifest = (workspace, packageJson) => writeNpmManifest(workspace.path, packageJson);
210
+ const getWorkspaceOutputPath = (workspace) => path.join(workspace.path, "bin");
211
+ const getWorkspaceLibPath = (workspace) => path.join(workspace.path, "lib");
212
+ function* iterateWorkspacePackages(workspace) {
213
+ const entries = fs.readdirSync(workspace.path, { withFileTypes: true });
214
+ for (const entry of entries) {
215
+ if (!entry.isDirectory()) continue;
216
+ try {
217
+ yield detectPackage(workspace, entry.name);
218
+ } catch {}
219
+ }
220
+ }
221
+ //#endregion
222
+ //#region ../tools.core/build/dependencies.mjs
223
+ /**
224
+ * Recursively determines all installed ig libraries for a workspace.
225
+ *
226
+ * @param {WorkspaceLocation} workspace
227
+ * @returns {PublishedPackageLocation[]}
228
+ */
229
+ const determineWorkspaceIGLibraries = (workspace) => {
230
+ const libraries = collectIGLibraries(workspace, readWorkspaceNpmManifest(workspace));
231
+ const results = /* @__PURE__ */ new Map();
232
+ for (const location of libraries) {
233
+ const manifest = readPublishedPackageNpmManifest(location);
234
+ if (!results.has(manifest.name)) results.set(manifest.name, location);
235
+ }
236
+ return Array.from(results.values());
237
+ };
238
+ const collectIGLibraries = (workspace, manifest) => {
239
+ if (!manifest.dependencies) return [];
240
+ const runtimeDependencies = Object.getOwnPropertyNames(manifest.dependencies);
241
+ const result = [];
242
+ for (const runtimeDependency of runtimeDependencies) {
243
+ const location = detectPublishedPackageFromPath(workspace.path, runtimeDependency);
244
+ if (location === void 0) continue;
245
+ const runtimeManifest = readPublishedPackageNpmManifest(location);
246
+ if (runtimeManifest.ig?.scriptingLibrary) {
247
+ result.push(location);
248
+ result.push(...collectIGLibraries(workspace, runtimeManifest));
249
+ }
250
+ }
251
+ return result;
252
+ };
253
+ //#endregion
254
+ //#region ../tools.core/build/fs.mjs
255
+ const readStringFromFile = (filePath) => fs.readFileSync(filePath, { encoding: "utf8" });
256
+ const readStringFromFileOrUndefined = (filePath) => {
257
+ try {
258
+ return readStringFromFile(filePath);
259
+ } catch (err) {
260
+ if (!isErrorENOENT(err)) throw err;
261
+ return;
262
+ }
263
+ };
264
+ //#endregion
265
+ //#region ../tools.core/build/log.mjs
266
+ const consoleReporter = {
267
+ log(message) {
268
+ console.log(message);
269
+ },
270
+ error(message, _error) {
271
+ console.error(message);
272
+ }
273
+ };
274
+ const createPackageScopedReporter = (reporter, scope, index, total, maxNameLength = 15) => {
275
+ const numLength = total === void 0 ? void 0 : total.toString().length;
276
+ const identifierString = `${total === void 0 || total < 2 ? "" : `${index.toString().padStart(numLength, "0")}/${total} `}${scope.padEnd(maxNameLength)}`;
277
+ return {
278
+ log(message) {
279
+ reporter.log(`${identifierString} >> ${message}`);
280
+ },
281
+ error(message, error) {
282
+ reporter.error(`${identifierString} >> ${message}`, error);
283
+ }
284
+ };
285
+ };
286
+ //#endregion
287
+ //#region ../tools.core/build/scripts.mjs
288
+ const getPackageTypescriptFiles = (location) => glob.sync("**/*.ts", {
289
+ absolute: true,
290
+ cwd: location.scriptsDir,
291
+ ignore: "node_modules/**/*"
292
+ });
293
+ //#endregion
294
+ //#region ../tools.core/build/_virtual/_rolldown/runtime.mjs
295
+ var __defProp = Object.defineProperty;
296
+ var __exportAll = (all, no_symbols) => {
297
+ let target = {};
298
+ for (var name in all) __defProp(target, name, {
299
+ get: all[name],
300
+ enumerable: true
301
+ });
302
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
303
+ return target;
304
+ };
305
+ //#endregion
306
+ //#region ../tools.core/build/assetService.mjs
307
+ var assetService_exports = /* @__PURE__ */ __exportAll({
308
+ closeSession: () => closeSession,
309
+ getExistingPackages: () => getExistingPackages,
310
+ getGeometries: () => getGeometries,
311
+ getMaterials: () => getMaterials,
312
+ startSession: () => startSession,
313
+ uploadPackageFromBuffer: () => uploadPackageFromBuffer
314
+ });
315
+ const PLUGIN_ID = "0feba3a0-b6d1-11e6-9598-0800200c9a66";
316
+ /**
317
+ * Starts an IG.Asset.Server session and returns the sessionId
318
+ *
319
+ * @param {SessionStartParams} params
320
+ * @returns
321
+ */
322
+ const startSession = async ({ url, authentication, ...params }) => {
323
+ const payload = {
324
+ ...params,
325
+ user: void 0,
326
+ password: void 0,
327
+ license: void 0,
328
+ plugin: PLUGIN_ID
329
+ };
330
+ if (authentication.type === "credentials") {
331
+ payload.user = authentication.username;
332
+ payload.password = authentication.password;
333
+ } else if (authentication.type === "license") payload.license = authentication.license;
334
+ const { data: { session: sessionId, state, response } } = await axios.post(`Session/Start2`, JSON.stringify(payload), { baseURL: url });
335
+ if (state !== "SUCCESS") {
336
+ let message = `Could not start session. IG.Asset.Server responded with ${state}`;
337
+ if (response) message += `: ${response}`;
338
+ throw new Error(message);
339
+ }
340
+ return {
341
+ _kind: "AssetService",
342
+ url,
343
+ sessionId,
344
+ domain: params.domain,
345
+ subDomain: params.subDomain
346
+ };
347
+ };
348
+ const closeSession = async (session) => {
349
+ await axios.get(`Session/Close/${session.sessionId}`, { baseURL: session.url });
350
+ };
351
+ const uploadPackageFromBuffer = async (session, { name, version }, buffer) => {
352
+ try {
353
+ await uploadPackageToUrl(session.url, `UploadPackage/${session.sessionId}/${name}_${version}`, buffer);
354
+ } catch (err) {
355
+ if (err instanceof AxiosError) {
356
+ if (err.response?.status === 404) {
357
+ await uploadPackageToUrl(session.url, `UploadPackage/${session.sessionId}/${name}_${version}/`, buffer);
358
+ return;
359
+ }
360
+ throw new Error(`Failed to upload package: ${err.message}`);
361
+ }
362
+ throw err;
363
+ }
364
+ };
365
+ const uploadPackageToUrl = async (url, path, buffer) => {
366
+ const { data, status } = await axios.post(path, buffer, { baseURL: url });
367
+ let objectBody;
368
+ if (typeof data === "string") try {
369
+ objectBody = JSON.parse(data);
370
+ } catch (err) {}
371
+ else if (typeof data === "object") objectBody = data;
372
+ if (objectBody !== void 0) {
373
+ if ("state" in objectBody && objectBody.state !== "SUCCESS") throw new Error(objectBody.response ?? objectBody.state);
374
+ }
375
+ if (status >= 400) {
376
+ if (objectBody !== void 0) {
377
+ let text_1 = "";
378
+ for (const key in objectBody) {
379
+ text_1 += key + ": \n";
380
+ if (typeof objectBody[key] === "object") text_1 += JSON.stringify(objectBody[key], void 0, 2);
381
+ else text_1 += objectBody[key];
382
+ text_1 += "\n\n";
383
+ }
384
+ throw new Error(text_1);
385
+ }
386
+ throw new Error(data);
387
+ }
388
+ return data;
389
+ };
390
+ const getExistingPackages = async (session) => {
391
+ const { data } = await axios.get(`Script/GetInformation/${session.sessionId}`, {
392
+ baseURL: session.url,
393
+ validateStatus: (status) => status === 404 || status === 200
394
+ }).catch((err) => {
395
+ throw new Error(`Failed to get existing packages: ${err.message}`);
396
+ });
397
+ return data;
398
+ };
399
+ const getMaterials = async (session) => {
400
+ return (await axios.get(`Material/Get/${session.sessionId}`, { baseURL: session.url })).data.materials;
401
+ };
402
+ const getGeometries = async (session) => {
403
+ return (await axios.get(`Geometry/Get/${session.sessionId}`, { baseURL: session.url })).data.geometries;
404
+ };
405
+ //#endregion
406
+ export { isErrorENOENT as A, readPackageCreatorIndex as C, writePackageCreatorManifest as D, writePackageCreatorIndex as E, writePackageNpmManifest as O, readPackageAnimationList as S, readPackageNpmManifest as T, PACKAGE_FILE as _, readStringFromFileOrUndefined as a, getPackageReleasesDirectory as b, getWorkspaceLibPath as c, readWorkspaceNpmManifest as d, writeWorkspaceNpmManifest as f, INDEX_FILE as g, readPublishedPackageNpmManifest as h, createPackageScopedReporter as i, isErrorEPERM as j, isErrorEACCES as k, getWorkspaceOutputPath as l, readPublishedPackageCreatorManifest as m, getPackageTypescriptFiles as n, determineWorkspaceIGLibraries as o, readPublishedPackageCreatorIndex as p, consoleReporter as r, detectWorkspace as s, assetService_exports as t, iterateWorkspacePackages as u, detectPackage as v, readPackageCreatorManifest as w, parseCreatorPackageName as x, getCreatorIndexParameterPrimaryJSType as y };
407
+
408
+ //# sourceMappingURL=build-kkMVBBJL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-kkMVBBJL.js","names":[],"sources":["../../tools.core/build/stripUtf8Bom.mjs","../../tools.core/build/npmPackage.mjs","../../tools.core/build/error.mjs","../../tools.core/build/package.mjs","../../tools.core/build/publishedPackage.mjs","../../tools.core/build/workspace.mjs","../../tools.core/build/dependencies.mjs","../../tools.core/build/fs.mjs","../../tools.core/build/log.mjs","../../tools.core/build/scripts.mjs","../../tools.core/build/_virtual/_rolldown/runtime.mjs","../../tools.core/build/assetService.mjs"],"sourcesContent":["//#region src/stripUtf8Bom.ts\nconst stripUtf8Bom = (text) => {\n\tif (text.charCodeAt(0) === 65279) return text.slice(1);\n\treturn text;\n};\n//#endregion\nexport { stripUtf8Bom };\n\n//# sourceMappingURL=stripUtf8Bom.mjs.map","import { stripUtf8Bom } from \"./stripUtf8Bom.mjs\";\nimport * as path from \"node:path\";\nimport * as fs from \"node:fs\";\nimport { writePackageSync } from \"write-package\";\n//#region src/npmPackage.ts\nconst readNpmManifest = (directory) => {\n\tconst packageJsonPath = path.join(directory, \"package.json\");\n\tconst packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, { encoding: \"utf8\" }));\n\treturn JSON.parse(packageJson);\n};\nconst writeNpmManifest = (directory, packageJson) => {\n\twritePackageSync(path.join(directory, \"package.json\"), packageJson);\n};\n//#endregion\nexport { readNpmManifest, writeNpmManifest };\n\n//# sourceMappingURL=npmPackage.mjs.map","//#region src/error.ts\nconst getNodeErrorCode = (error) => {\n\tif (error !== null && typeof error === \"object\" && error.code !== void 0) return error.code;\n};\n/**\n* Permission denied: An attempt was made to access a file in a way forbidden by its file access permissions.\n*\n* @param {unknown} error\n*/\nconst isErrorEACCES = (error) => getNodeErrorCode(error) === \"EACCES\";\n/**\n* No such file or directory: Commonly raised by fs operations to indicate that a component of the specified pathname does not exist. No entity (file or directory) could be found by the given path.\n*\n* @param {unknown} error\n*/\nconst isErrorENOENT = (error) => getNodeErrorCode(error) === \"ENOENT\";\nconst isErrorEPERM = (error) => getNodeErrorCode(error) === \"EPERM\";\n//#endregion\nexport { getNodeErrorCode, isErrorEACCES, isErrorENOENT, isErrorEPERM };\n\n//# sourceMappingURL=error.mjs.map","import { stripUtf8Bom } from \"./stripUtf8Bom.mjs\";\nimport { readNpmManifest, writeNpmManifest } from \"./npmPackage.mjs\";\nimport { isErrorENOENT } from \"./error.mjs\";\nimport * as path from \"node:path\";\nimport * as fs from \"node:fs\";\n//#region src/package.ts\nconst PACKAGE_FILE = \"_Package.json\";\nconst INDEX_FILE = \"_Index.json\";\nconst ANIMATION_FILE_SUFFIX = \".animation.json\";\nconst getCreatorIndexParameterPrimaryJSType = (type) => {\n\tswitch (type) {\n\t\tcase \"LengthM\":\n\t\tcase \"ArcDEG\":\n\t\tcase \"Integer\":\n\t\tcase \"Int\":\n\t\tcase \"Float\": return \"number\";\n\t\tcase \"Boolean\":\n\t\tcase \"Bool\": return \"boolean\";\n\t\tdefault: return \"string\";\n\t}\n};\nfunction parseCreatorPackageName(manifest) {\n\tconst [domain, subdomain] = manifest.Package.split(\".\");\n\tif (subdomain === void 0) throw new Error(`Expected \"Package\" field of the _Package.json file to contain a value in the form of Domain.SubDomain`);\n\treturn {\n\t\tdomain,\n\t\tsubdomain\n\t};\n}\n/**\n* Detects the package at the given directory.\n*\n* @param {string} directory\n* @returns {PackageLocation}\n*/\nconst detectPackage = (workspace, directory) => {\n\tdirectory = path.resolve(workspace.path, directory);\n\tconst scriptsPath = path.join(directory, \"Scripts\");\n\tconst tsPath = path.join(directory, \"ts\");\n\tlet location;\n\tif (fs.existsSync(scriptsPath)) location = {\n\t\t_kind: \"PackageLocation\",\n\t\tpath: directory,\n\t\tscriptsDir: scriptsPath,\n\t\tmanifestDir: scriptsPath\n\t};\n\telse if (fs.existsSync(tsPath)) location = {\n\t\t_kind: \"PackageLocation\",\n\t\tpath: directory,\n\t\tscriptsDir: tsPath,\n\t\tmanifestDir: directory\n\t};\n\telse location = {\n\t\t_kind: \"PackageLocation\",\n\t\tpath: directory,\n\t\tscriptsDir: directory,\n\t\tmanifestDir: directory\n\t};\n\ttry {\n\t\treadPackageCreatorManifest(location);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) throw new Error(`No _Package.json found in ${location.manifestDir}`);\n\t\tthrow err;\n\t}\n\treturn location;\n};\nconst detectPackageLocationFromCreatorWorkspaceLocation = (location) => {\n\tconst packageLocation = {\n\t\t_kind: \"PackageLocation\",\n\t\tpath: location.path,\n\t\tscriptsDir: path.join(location.path, \"Scripts\"),\n\t\tmanifestDir: path.join(location.path, \"Scripts\")\n\t};\n\ttry {\n\t\treadPackageCreatorManifest(packageLocation);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) throw new Error(`No _Package.json found in ${packageLocation.manifestDir}`);\n\t\tthrow err;\n\t}\n\treturn packageLocation;\n};\nconst detectPackageAsParentDirectory = (directory) => {\n\tlet directoryToCheck = directory;\n\twhile (directoryToCheck !== path.dirname(directoryToCheck)) {\n\t\tif (fs.existsSync(path.join(directoryToCheck, \"Scripts\"))) return {\n\t\t\t_kind: \"PackageLocation\",\n\t\t\tpath: directoryToCheck,\n\t\t\tscriptsDir: path.join(directoryToCheck, \"Scripts\"),\n\t\t\tmanifestDir: path.join(directoryToCheck, \"Scripts\")\n\t\t};\n\t\tdirectoryToCheck = path.dirname(directoryToCheck);\n\t}\n};\nconst readPackageCreatorManifest = (location) => {\n\tconst packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);\n\tconst packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, { encoding: \"utf8\" }));\n\treturn JSON.parse(packageJson);\n};\nconst writePackageCreatorManifest = (location, creatorPackage) => {\n\tconst packageJsonPath = path.join(location.manifestDir, PACKAGE_FILE);\n\tfs.writeFileSync(packageJsonPath, JSON.stringify(creatorPackage, null, \"\t\") + \"\\n\");\n};\nconst getPackageCreatorIndexPath = (location) => path.join(location.manifestDir, INDEX_FILE);\nconst readPackageCreatorIndex = (location) => {\n\ttry {\n\t\tconst indexPath = getPackageCreatorIndexPath(location);\n\t\tconst index = stripUtf8Bom(fs.readFileSync(indexPath, { encoding: \"utf8\" }));\n\t\treturn JSON.parse(index);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) return;\n\t\tthrow err;\n\t}\n};\nconst writePackageCreatorIndex = (location, index) => {\n\tconst indexPath = getPackageCreatorIndexPath(location);\n\tfs.writeFileSync(indexPath, JSON.stringify(index, null, \"\t\") + \"\\n\");\n};\nconst readPackageNpmManifest = (location) => {\n\ttry {\n\t\treturn readNpmManifest(location.manifestDir);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) return;\n\t\tthrow err;\n\t}\n};\nconst writePackageNpmManifest = (location, packageJson) => {\n\twriteNpmManifest(location.manifestDir, packageJson);\n};\nconst readPackageAnimationList = (location) => {\n\tconst directoryContent = fs.readdirSync(location.manifestDir);\n\tconst animationPathList = [];\n\tfor (const entry of directoryContent) if (entry.endsWith(ANIMATION_FILE_SUFFIX)) {\n\t\tconst animationPath = path.join(location.manifestDir, entry);\n\t\tanimationPathList.push(animationPath);\n\t}\n\treturn animationPathList;\n};\nconst getPackageReleasesDirectory = (location) => path.join(location.path, \"Releases\");\nconst arePackageLocationsEqual = (a, b) => a.path === b.path;\n//#endregion\nexport { INDEX_FILE, PACKAGE_FILE, arePackageLocationsEqual, detectPackage, detectPackageAsParentDirectory, detectPackageLocationFromCreatorWorkspaceLocation, getCreatorIndexParameterPrimaryJSType, getPackageCreatorIndexPath, getPackageReleasesDirectory, parseCreatorPackageName, readPackageAnimationList, readPackageCreatorIndex, readPackageCreatorManifest, readPackageNpmManifest, writePackageCreatorIndex, writePackageCreatorManifest, writePackageNpmManifest };\n\n//# sourceMappingURL=package.mjs.map","import { stripUtf8Bom } from \"./stripUtf8Bom.mjs\";\nimport { readNpmManifest } from \"./npmPackage.mjs\";\nimport { isErrorENOENT } from \"./error.mjs\";\nimport { INDEX_FILE, PACKAGE_FILE } from \"./package.mjs\";\nimport * as path from \"node:path\";\nimport * as fs from \"node:fs\";\nimport resolve from \"resolve\";\n//#region src/publishedPackage.ts\n/**\n* Detects a published package from a path.\n*\n* Can return undefined if the package is not installed.\n*\n* @param {string} resolveBasePath\n* @param {string} name\n* @return {*} {(PublishedPackageLocation | undefined)}\n*/\nconst detectPublishedPackageFromPath = (resolveBasePath, name) => {\n\ttry {\n\t\tconst manifestPath = resolve.sync(name + \"/package.json\", { basedir: resolveBasePath });\n\t\treturn {\n\t\t\t_kind: \"PublishedPackageLocation\",\n\t\t\tpath: path.dirname(manifestPath)\n\t\t};\n\t} catch (err) {\n\t\treturn;\n\t}\n};\nconst readPublishedPackageNpmManifest = (location) => {\n\treturn readNpmManifest(location.path);\n};\nconst readPublishedPackageCreatorManifest = (location) => {\n\ttry {\n\t\tconst packageJsonPath = path.join(location.path, PACKAGE_FILE);\n\t\tconst packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, { encoding: \"utf8\" }));\n\t\treturn JSON.parse(packageJson);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) return;\n\t\tthrow err;\n\t}\n};\nconst getPublishedPackageCreatorIndexPath = (location) => path.join(location.path, INDEX_FILE);\nconst readPublishedPackageCreatorIndex = (location) => {\n\ttry {\n\t\tconst packageJsonPath = path.join(location.path, INDEX_FILE);\n\t\tconst packageJson = stripUtf8Bom(fs.readFileSync(packageJsonPath, { encoding: \"utf8\" }));\n\t\treturn JSON.parse(packageJson);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) return;\n\t\tthrow err;\n\t}\n};\n//#endregion\nexport { detectPublishedPackageFromPath, getPublishedPackageCreatorIndexPath, readPublishedPackageCreatorIndex, readPublishedPackageCreatorManifest, readPublishedPackageNpmManifest };\n\n//# sourceMappingURL=publishedPackage.mjs.map","import { readNpmManifest, writeNpmManifest } from \"./npmPackage.mjs\";\nimport { isErrorENOENT } from \"./error.mjs\";\nimport { detectPackage } from \"./package.mjs\";\nimport { detectCreatorWorkspaceAsParentDirectory } from \"./creatorWorkspace.mjs\";\nimport * as path from \"node:path\";\nimport * as fs from \"node:fs\";\n//#region src/workspace.ts\nconst detectWorkspace = (directory) => {\n\tdirectory = path.resolve(process.cwd(), directory);\n\treturn {\n\t\t_kind: \"WorkspaceLocation\",\n\t\tpath: directory\n\t};\n};\nconst detectWorkspaceByPackageJsonLocation = (directory) => {\n\twhile (directory !== path.dirname(directory)) {\n\t\tif (fs.existsSync(path.join(directory, \"package.json\"))) return detectWorkspace(directory);\n\t\tdirectory = path.dirname(directory);\n\t}\n};\nconst readWorkspaceNpmManifest = (workspace) => {\n\ttry {\n\t\treturn readNpmManifest(workspace.path);\n\t} catch (err) {\n\t\tif (isErrorENOENT(err)) throw new Error(`Expected a package.json file to exist in ${workspace.path}. See packager readme for instructions on how to create the package.json.`);\n\t\tthrow err;\n\t}\n};\nconst writeWorkspaceNpmManifest = (workspace, packageJson) => writeNpmManifest(workspace.path, packageJson);\nconst getWorkspaceOutputPath = (workspace) => path.join(workspace.path, \"bin\");\nconst getWorkspaceLibPath = (workspace) => path.join(workspace.path, \"lib\");\nfunction* iterateWorkspacePackages(workspace) {\n\tconst entries = fs.readdirSync(workspace.path, { withFileTypes: true });\n\tfor (const entry of entries) {\n\t\tif (!entry.isDirectory()) continue;\n\t\ttry {\n\t\t\tyield detectPackage(workspace, entry.name);\n\t\t} catch {}\n\t}\n}\nfunction* iterateWorkspaceCreatorWorkspaces(workspace) {\n\tconst entries = fs.readdirSync(workspace.path, { withFileTypes: true });\n\tfor (const entry of entries) {\n\t\tif (!entry.isDirectory()) continue;\n\t\tconst detected = detectCreatorWorkspaceAsParentDirectory(path.join(workspace.path, entry.name));\n\t\tif (detected !== void 0) yield detected;\n\t}\n}\n//#endregion\nexport { detectWorkspace, detectWorkspaceByPackageJsonLocation, getWorkspaceLibPath, getWorkspaceOutputPath, iterateWorkspaceCreatorWorkspaces, iterateWorkspacePackages, readWorkspaceNpmManifest, writeWorkspaceNpmManifest };\n\n//# sourceMappingURL=workspace.mjs.map","import { detectPublishedPackageFromPath, readPublishedPackageNpmManifest } from \"./publishedPackage.mjs\";\nimport { readWorkspaceNpmManifest } from \"./workspace.mjs\";\n//#region src/dependencies.ts\n/**\n* Recursively determines all installed ig libraries for a workspace.\n*\n* @param {WorkspaceLocation} workspace\n* @returns {PublishedPackageLocation[]}\n*/\nconst determineWorkspaceIGLibraries = (workspace) => {\n\tconst libraries = collectIGLibraries(workspace, readWorkspaceNpmManifest(workspace));\n\tconst results = /* @__PURE__ */ new Map();\n\tfor (const location of libraries) {\n\t\tconst manifest = readPublishedPackageNpmManifest(location);\n\t\tif (!results.has(manifest.name)) results.set(manifest.name, location);\n\t}\n\treturn Array.from(results.values());\n};\nconst collectIGLibraries = (workspace, manifest) => {\n\tif (!manifest.dependencies) return [];\n\tconst runtimeDependencies = Object.getOwnPropertyNames(manifest.dependencies);\n\tconst result = [];\n\tfor (const runtimeDependency of runtimeDependencies) {\n\t\tconst location = detectPublishedPackageFromPath(workspace.path, runtimeDependency);\n\t\tif (location === void 0) continue;\n\t\tconst runtimeManifest = readPublishedPackageNpmManifest(location);\n\t\tif (runtimeManifest.ig?.scriptingLibrary) {\n\t\t\tresult.push(location);\n\t\t\tresult.push(...collectIGLibraries(workspace, runtimeManifest));\n\t\t}\n\t}\n\treturn result;\n};\n//#endregion\nexport { determineWorkspaceIGLibraries };\n\n//# sourceMappingURL=dependencies.mjs.map","import { isErrorENOENT } from \"./error.mjs\";\nimport * as fs from \"node:fs\";\n//#region src/fs.ts\nconst readStringFromFile = (filePath) => fs.readFileSync(filePath, { encoding: \"utf8\" });\nconst readStringFromFileOrUndefined = (filePath) => {\n\ttry {\n\t\treturn readStringFromFile(filePath);\n\t} catch (err) {\n\t\tif (!isErrorENOENT(err)) throw err;\n\t\treturn;\n\t}\n};\n//#endregion\nexport { readStringFromFile, readStringFromFileOrUndefined };\n\n//# sourceMappingURL=fs.mjs.map","//#region src/log.ts\nconst consoleReporter = {\n\tlog(message) {\n\t\tconsole.log(message);\n\t},\n\terror(message, _error) {\n\t\tconsole.error(message);\n\t}\n};\nconst createPackageScopedReporter = (reporter, scope, index, total, maxNameLength = 15) => {\n\tconst numLength = total === void 0 ? void 0 : total.toString().length;\n\tconst identifierString = `${total === void 0 || total < 2 ? \"\" : `${index.toString().padStart(numLength, \"0\")}/${total} `}${scope.padEnd(maxNameLength)}`;\n\treturn {\n\t\tlog(message) {\n\t\t\treporter.log(`${identifierString} >> ${message}`);\n\t\t},\n\t\terror(message, error) {\n\t\t\treporter.error(`${identifierString} >> ${message}`, error);\n\t\t}\n\t};\n};\n//#endregion\nexport { consoleReporter, createPackageScopedReporter };\n\n//# sourceMappingURL=log.mjs.map","import * as glob from \"glob\";\n//#region src/scripts.ts\nconst getPackageTypescriptFiles = (location) => glob.sync(\"**/*.ts\", {\n\tabsolute: true,\n\tcwd: location.scriptsDir,\n\tignore: \"node_modules/**/*\"\n});\n//#endregion\nexport { getPackageTypescriptFiles };\n\n//# sourceMappingURL=scripts.mjs.map","//#region \\0rolldown/runtime.js\nvar __defProp = Object.defineProperty;\nvar __exportAll = (all, no_symbols) => {\n\tlet target = {};\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n\tif (!no_symbols) __defProp(target, Symbol.toStringTag, { value: \"Module\" });\n\treturn target;\n};\n//#endregion\nexport { __exportAll };\n","import { __exportAll } from \"./_virtual/_rolldown/runtime.mjs\";\nimport axios, { AxiosError } from \"axios\";\n//#region src/assetService.ts\nvar assetService_exports = /* @__PURE__ */ __exportAll({\n\tcloseSession: () => closeSession,\n\tgetExistingPackages: () => getExistingPackages,\n\tgetGeometries: () => getGeometries,\n\tgetMaterials: () => getMaterials,\n\tstartSession: () => startSession,\n\tuploadPackageFromBuffer: () => uploadPackageFromBuffer\n});\nconst PLUGIN_ID = \"0feba3a0-b6d1-11e6-9598-0800200c9a66\";\n/**\n* Starts an IG.Asset.Server session and returns the sessionId\n*\n* @param {SessionStartParams} params\n* @returns\n*/\nconst startSession = async ({ url, authentication, ...params }) => {\n\tconst payload = {\n\t\t...params,\n\t\tuser: void 0,\n\t\tpassword: void 0,\n\t\tlicense: void 0,\n\t\tplugin: PLUGIN_ID\n\t};\n\tif (authentication.type === \"credentials\") {\n\t\tpayload.user = authentication.username;\n\t\tpayload.password = authentication.password;\n\t} else if (authentication.type === \"license\") payload.license = authentication.license;\n\tconst { data: { session: sessionId, state, response } } = await axios.post(`Session/Start2`, JSON.stringify(payload), { baseURL: url });\n\tif (state !== \"SUCCESS\") {\n\t\tlet message = `Could not start session. IG.Asset.Server responded with ${state}`;\n\t\tif (response) message += `: ${response}`;\n\t\tthrow new Error(message);\n\t}\n\treturn {\n\t\t_kind: \"AssetService\",\n\t\turl,\n\t\tsessionId,\n\t\tdomain: params.domain,\n\t\tsubDomain: params.subDomain\n\t};\n};\nconst closeSession = async (session) => {\n\tawait axios.get(`Session/Close/${session.sessionId}`, { baseURL: session.url });\n};\nconst uploadPackageFromBuffer = async (session, { name, version }, buffer) => {\n\ttry {\n\t\tawait uploadPackageToUrl(session.url, `UploadPackage/${session.sessionId}/${name}_${version}`, buffer);\n\t} catch (err) {\n\t\tif (err instanceof AxiosError) {\n\t\t\tif (err.response?.status === 404) {\n\t\t\t\tawait uploadPackageToUrl(session.url, `UploadPackage/${session.sessionId}/${name}_${version}/`, buffer);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthrow new Error(`Failed to upload package: ${err.message}`);\n\t\t}\n\t\tthrow err;\n\t}\n};\nconst uploadPackageToUrl = async (url, path, buffer) => {\n\tconst { data, status } = await axios.post(path, buffer, { baseURL: url });\n\tlet objectBody;\n\tif (typeof data === \"string\") try {\n\t\tobjectBody = JSON.parse(data);\n\t} catch (err) {}\n\telse if (typeof data === \"object\") objectBody = data;\n\tif (objectBody !== void 0) {\n\t\tif (\"state\" in objectBody && objectBody.state !== \"SUCCESS\") throw new Error(objectBody.response ?? objectBody.state);\n\t}\n\tif (status >= 400) {\n\t\tif (objectBody !== void 0) {\n\t\t\tlet text_1 = \"\";\n\t\t\tfor (const key in objectBody) {\n\t\t\t\ttext_1 += key + \": \\n\";\n\t\t\t\tif (typeof objectBody[key] === \"object\") text_1 += JSON.stringify(objectBody[key], void 0, 2);\n\t\t\t\telse text_1 += objectBody[key];\n\t\t\t\ttext_1 += \"\\n\\n\";\n\t\t\t}\n\t\t\tthrow new Error(text_1);\n\t\t}\n\t\tthrow new Error(data);\n\t}\n\treturn data;\n};\nconst getExistingPackages = async (session) => {\n\tconst { data } = await axios.get(`Script/GetInformation/${session.sessionId}`, {\n\t\tbaseURL: session.url,\n\t\tvalidateStatus: (status) => status === 404 || status === 200\n\t}).catch((err) => {\n\t\tthrow new Error(`Failed to get existing packages: ${err.message}`);\n\t});\n\treturn data;\n};\nconst getMaterials = async (session) => {\n\treturn (await axios.get(`Material/Get/${session.sessionId}`, { baseURL: session.url })).data.materials;\n};\nconst getGeometries = async (session) => {\n\treturn (await axios.get(`Geometry/Get/${session.sessionId}`, { baseURL: session.url })).data.geometries;\n};\n//#endregion\nexport { assetService_exports };\n\n//# sourceMappingURL=assetService.mjs.map"],"mappings":";;;;;;;AACA,MAAM,gBAAgB,SAAS;AAC9B,KAAI,KAAK,WAAW,EAAE,KAAK,MAAO,QAAO,KAAK,MAAM,EAAE;AACtD,QAAO;;;;ACER,MAAM,mBAAmB,cAAc;CACtC,MAAM,kBAAkB,KAAK,KAAK,WAAW,eAAe;CAC5D,MAAM,cAAc,aAAa,GAAG,aAAa,iBAAiB,EAAE,UAAU,QAAQ,CAAC,CAAC;AACxF,QAAO,KAAK,MAAM,YAAY;;AAE/B,MAAM,oBAAoB,WAAW,gBAAgB;AACpD,kBAAiB,KAAK,KAAK,WAAW,eAAe,EAAE,YAAY;;;;ACVpE,MAAM,oBAAoB,UAAU;AACnC,KAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,KAAK,EAAG,QAAO,MAAM;;;;;;;AAOxF,MAAM,iBAAiB,UAAU,iBAAiB,MAAM,KAAK;;;;;;AAM7D,MAAM,i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