@intelligentgraphics/ig.gfx.packager 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/build/bin.js +2 -1
  2. package/build/bin.js.map +1 -1
  3. package/build/{build-kkMVBBJL.js → build-C3qEWyu4.js} +1 -1
  4. package/build/{build-kkMVBBJL.js.map → build-C3qEWyu4.js.map} +1 -1
  5. package/build/{build-CMbCj7x-.js → build-C4Q_eL6j.js} +74 -26
  6. package/build/build-C4Q_eL6j.js.map +1 -0
  7. package/build/{cli-Co1DhAmx.js → cli-DRb54rk4.js} +12 -12
  8. package/build/{cli-Co1DhAmx.js.map → cli-DRb54rk4.js.map} +1 -1
  9. package/build/{docs-BkGeoYY2.js → docs-BavUNetY.js} +2 -3
  10. package/build/{docs-BkGeoYY2.js.map → docs-BavUNetY.js.map} +1 -1
  11. package/build/{generateIndex-C_DxQ2R4.js → generateIndex-2UM_uDm9.js} +4 -4
  12. package/build/generateIndex-2UM_uDm9.js.map +1 -0
  13. package/build/{generateParameterType-CdCi5BWM.js → generateParameterType-so7HPAmb.js} +2 -2
  14. package/build/{generateParameterType-CdCi5BWM.js.map → generateParameterType-so7HPAmb.js.map} +1 -1
  15. package/build/package-pKTRlkgE.js +2 -0
  16. package/build/{postinstall-DHTlEmNr.js → postinstall-CUmC5zLp.js} +4 -4
  17. package/build/{postinstall-DHTlEmNr.js.map → postinstall-CUmC5zLp.js.map} +1 -1
  18. package/build/{prompter-DONgUlzS.js → prompter-BNJwlQhM.js} +1 -1
  19. package/build/{prompter-DONgUlzS.js.map → prompter-BNJwlQhM.js.map} +1 -1
  20. package/build/{publish-E5zcQAo0.js → publish-Bd15xplt.js} +8 -9
  21. package/build/{publish-E5zcQAo0.js.map → publish-Bd15xplt.js.map} +1 -1
  22. package/build/{publishNpm-CBT1819u.js → publishNpm-C2uLIAWs.js} +6 -7
  23. package/build/{publishNpm-CBT1819u.js.map → publishNpm-C2uLIAWs.js.map} +1 -1
  24. package/build/publishedPackage-pKTRlkgE.js +2 -0
  25. package/build/{rollup-Csyght27.js → rollup-Ci1pp5NO.js} +3 -4
  26. package/build/{rollup-Csyght27.js.map → rollup-Ci1pp5NO.js.map} +1 -1
  27. package/build/{scripts-CBblHIL1.js → scripts-D5xp5cJY.js} +2 -1
  28. package/build/{scripts-CBblHIL1.js.map → scripts-D5xp5cJY.js.map} +1 -1
  29. package/build/{versionFile-DViDwgCa.js → versionFile-K8Qq2b1u.js} +3 -3
  30. package/build/{versionFile-DViDwgCa.js.map → versionFile-K8Qq2b1u.js.map} +1 -1
  31. package/build/workspace-pKTRlkgE.js +2 -0
  32. package/lib/lib.js +70 -22
  33. package/package.json +7 -5
  34. package/readme.md +7 -0
  35. package/build/build-CMbCj7x-.js.map +0 -1
  36. package/build/generateIndex-C_DxQ2R4.js.map +0 -1
  37. package/build/package-DHx2bvVO.js +0 -1
  38. package/build/publishedPackage-D-KiU0FG.js +0 -1
  39. package/build/workspace-D0XY2EMu.js +0 -1
package/build/bin.js CHANGED
@@ -1,6 +1,7 @@
1
+ #!/usr/bin/env node
1
2
  import "source-map-support/register.js";
2
3
  //#region src/bin.ts
3
- import("./cli-Co1DhAmx.js");
4
+ import("./cli-DRb54rk4.js");
4
5
  //#endregion
5
6
  export {};
6
7
 
package/build/bin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","names":[],"sources":["../src/bin.ts"],"sourcesContent":["import \"source-map-support/register.js\";\n\nimport(\"./cli\");\n"],"mappings":";;AAEA,OAAO"}
1
+ {"version":3,"file":"bin.js","names":[],"sources":["../src/bin.ts"],"sourcesContent":["import \"source-map-support/register.js\";\n\nimport(\"./cli\");\n"],"mappings":";;;AAEA,OAAO"}
@@ -405,4 +405,4 @@ const getGeometries = async (session) => {
405
405
  //#endregion
406
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
407
 
408
- //# sourceMappingURL=build-kkMVBBJL.js.map
408
+ //# sourceMappingURL=build-C3qEWyu4.js.map
@@ -1 +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,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}
1
+ {"version":3,"file":"build-C3qEWyu4.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;CAC9B,IAAI,KAAK,WAAW,CAAC,MAAM,OAAO,OAAO,KAAK,MAAM,CAAC;CACrD,OAAO;AACR;;;ACCA,MAAM,mBAAmB,cAAc;CACtC,MAAM,kBAAkB,KAAK,KAAK,WAAW,cAAc;CAC3D,MAAM,cAAc,aAAa,GAAG,aAAa,iBAAiB,EAAE,UAAU,OAAO,CAAC,CAAC;CACvF,OAAO,KAAK,MAAM,WAAW;AAC9B;AACA,MAAM,oBAAoB,WAAW,gBAAgB;CACpD,iBAAiB,KAAK,KAAK,WAAW,cAAc,GAAG,WAAW;AACnE;;;ACXA,MAAM,oBAAoB,UAAU;CACnC,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,KAAK,GAAG,OAAO,MAAM;AACxF;;;;;;AAMA,MAAM,iBAAiB,UAAU,iBAAiB,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MACV,IAAI,OAAO,SAAS,UAAU,aAAa;CAChD,IAAI,eAAe,KAAK;MACnB,WAAW,cAAc,WAAW,UAAU,WAAW,MAAM,IAAI,MAAM,WAAW,YAAY,WAAW,KAAK;CAAA;CAErH,IAAI,UAAU,KAAK;EAClB,IAAI,eAAe,KAAK,GAAG;GAC1B,IAAI,SAAS;GACb,KAAK,MAAM,OAAO,YAAY;IAC7B,UAAU,MAAM;IAChB,IAAI,OAAO,WAAW,SAAS,UAAU,UAAU,KAAK,UAAU,WAAW,MAAM,KAAK,GAAG,CAAC;SACvF,UAAU,WAAW;IAC1B,UAAU;GACX;GACA,MAAM,IAAI,MAAM,MAAM;EACvB;EACA,MAAM,IAAI,MAAM,IAAI;CACrB;CACA,OAAO;AACR;AACA,MAAM,sBAAsB,OAAO,YAAY;CAC9C,MAAM,EAAE,SAAS,MAAM,MAAM,IAAI,yBAAyB,QAAQ,aAAa;EAC9E,SAAS,QAAQ;EACjB,iBAAiB,WAAW,WAAW,OAAO,WAAW;CAC1D,CAAC,EAAE,OAAO,QAAQ;EACjB,MAAM,IAAI,MAAM,oCAAoC,IAAI,SAAS;CAClE,CAAC;CACD,OAAO;AACR;AACA,MAAM,eAAe,OAAO,YAAY;CACvC,QAAQ,MAAM,MAAM,IAAI,gBAAgB,QAAQ,aAAa,EAAE,SAAS,QAAQ,IAAI,CAAC,GAAG,KAAK;AAC9F;AACA,MAAM,gBAAgB,OAAO,YAAY;CACxC,QAAQ,MAAM,MAAM,IAAI,gBAAgB,QAAQ,aAAa,EAAE,SAAS,QAAQ,IAAI,CAAC,GAAG,KAAK;AAC9F"}
@@ -1,13 +1,15 @@
1
- import { A as isErrorENOENT, S as readPackageAnimationList, T as readPackageNpmManifest, i as createPackageScopedReporter, n as getPackageTypescriptFiles, r as consoleReporter, w as readPackageCreatorManifest } from "./build-kkMVBBJL.js";
2
- import "./package-DHx2bvVO.js";
3
- import "./workspace-D0XY2EMu.js";
4
- import { t as isScriptPackageModules } from "./scripts-CBblHIL1.js";
1
+ import { A as isErrorENOENT, S as readPackageAnimationList, T as readPackageNpmManifest, i as createPackageScopedReporter, n as getPackageTypescriptFiles, r as consoleReporter, w as readPackageCreatorManifest } from "./build-C3qEWyu4.js";
2
+ import "./package-pKTRlkgE.js";
3
+ import "./workspace-pKTRlkgE.js";
4
+ import { t as isScriptPackageModules } from "./scripts-D5xp5cJY.js";
5
5
  import * as fs$1 from "node:fs";
6
6
  import * as path from "node:path";
7
7
  import * as fs from "fs/promises";
8
8
  import * as terser from "terser";
9
9
  import { EOL } from "node:os";
10
10
  import ts from "typescript";
11
+ import { transformSync } from "@babel/core";
12
+ import babelPresetEnv from "@babel/preset-env";
11
13
  import EventEmitter from "events";
12
14
  import { SourceMapConsumer, SourceMapGenerator } from "source-map-js";
13
15
  import Ajv from "ajv";
@@ -27,7 +29,7 @@ const createTSCBuildParticipant = (location, outputDir, skipDeclarations) => (en
27
29
  try {
28
30
  env.onBuildStart();
29
31
  env.log("Compiling typescript files");
30
- const compilerOptions = getCompilerOptions(location, outputDir, skipDeclarations);
32
+ const { compilerOptions, useBabel } = getCompilerOptions(location, outputDir, skipDeclarations);
31
33
  const host = ts.createCompilerHost(compilerOptions);
32
34
  host.getCurrentDirectory = () => location.scriptsDir;
33
35
  let js;
@@ -49,12 +51,17 @@ const createTSCBuildParticipant = (location, outputDir, skipDeclarations) => (en
49
51
  if (!emitResult.emitSkipped) {
50
52
  if (allDiagnostics.length > 0) console.log(ts.formatDiagnostics(allDiagnostics, host));
51
53
  if (js === void 0 || definitions === void 0) throw new Error(`Unexpected: no js or definitions were created`);
54
+ const jsStripped = js.replace(`//# sourceMappingURL=out.js.map`, "");
55
+ const babelResult = useBabel ? applyBabelTransform(jsStripped, sourceMap) : {
56
+ js: jsStripped,
57
+ sourceMap
58
+ };
52
59
  env.onBuildEnd({
53
60
  type: "success",
54
61
  artefacts: {
55
- js: js.replace(`//# sourceMappingURL=out.js.map`, ""),
62
+ js: babelResult.js,
56
63
  declarations: getDeclarationFileReferences(location, program, outputDir) + definitions,
57
- sourceMap
64
+ sourceMap: babelResult.sourceMap
58
65
  }
59
66
  });
60
67
  } else {
@@ -71,6 +78,7 @@ const createTSCBuildParticipant = (location, outputDir, skipDeclarations) => (en
71
78
  };
72
79
  const createTSCWatchBuildParticipant = (location, outputDir, skipDeclarations) => {
73
80
  return ({ onBuildStart, onBuildEnd }) => {
81
+ const { compilerOptions, useBabel } = getCompilerOptions(location, outputDir, skipDeclarations);
74
82
  let state = {
75
83
  diagnostics: [],
76
84
  js: void 0,
@@ -124,18 +132,23 @@ const createTSCWatchBuildParticipant = (location, outputDir, skipDeclarations) =
124
132
  return;
125
133
  }
126
134
  if (!currentProgram) throw new Error(`Expected a program to exist`);
135
+ const jsStripped = emitState.js.replace(`//# sourceMappingURL=out.js.map`, "");
136
+ const babelResult = useBabel ? applyBabelTransform(jsStripped, emitState.sourceMap) : {
137
+ js: jsStripped,
138
+ sourceMap: emitState.sourceMap
139
+ };
127
140
  onBuildEnd({
128
141
  type: "success",
129
142
  artefacts: {
130
- js: emitState.js.replace(`//# sourceMappingURL=out.js.map`, ""),
143
+ js: babelResult.js,
131
144
  declarations: emitState.definitions ? getDeclarationFileReferences(location, currentProgram, outputDir) + emitState.definitions : void 0,
132
- sourceMap: emitState.sourceMap
145
+ sourceMap: babelResult.sourceMap
133
146
  }
134
147
  });
135
148
  break;
136
149
  }
137
150
  };
138
- const host = ts.createWatchCompilerHost(path.join(location.scriptsDir, "tsconfig.json"), getCompilerOptions(location, outputDir, skipDeclarations), customSys, ts.createSemanticDiagnosticsBuilderProgram, registerDiagnostic, reportWatchStatusChanged);
151
+ const host = ts.createWatchCompilerHost(path.join(location.scriptsDir, "tsconfig.json"), compilerOptions, customSys, ts.createSemanticDiagnosticsBuilderProgram, registerDiagnostic, reportWatchStatusChanged);
139
152
  const originalAfterProgramCreate = host.afterProgramCreate;
140
153
  host.afterProgramCreate = (program) => {
141
154
  currentProgram = program;
@@ -154,18 +167,44 @@ const createTSCWatchBuildParticipant = (location, outputDir, skipDeclarations) =
154
167
  };
155
168
  const getCompilerOptions = (location, outputDir, skipDeclarations) => {
156
169
  const config = tryReadTsConfig(location);
170
+ const rawTarget = config?.compilerOptions?.target;
171
+ const useBabel = !rawTarget || String(rawTarget).toLowerCase() !== "es5";
157
172
  config.compilerOptions.lib = ["es2018", "dom"];
158
173
  return {
159
- ...ts.convertCompilerOptionsFromJson(config.compilerOptions, location.scriptsDir).options,
160
- removeComments: false,
161
- declaration: !skipDeclarations,
162
- sourceMap: true,
163
- inlineSources: false,
164
- outFile: path.join(outputDir, "out.js"),
165
- target: ts.ScriptTarget.ES5,
166
- noEmitOnError: true
174
+ compilerOptions: {
175
+ ...ts.convertCompilerOptionsFromJson(config.compilerOptions, location.scriptsDir).options,
176
+ removeComments: false,
177
+ declaration: !skipDeclarations,
178
+ sourceMap: true,
179
+ inlineSources: false,
180
+ outFile: path.join(outputDir, "out.js"),
181
+ target: useBabel ? ts.ScriptTarget.ESNext : ts.ScriptTarget.ES5,
182
+ noEmitOnError: true
183
+ },
184
+ useBabel
167
185
  };
168
186
  };
187
+ function applyBabelTransform(js, sourceMap) {
188
+ const result = transformSync(js, {
189
+ presets: [[babelPresetEnv, {
190
+ targets: ["defaults", "not IE 11"],
191
+ include: [
192
+ "transform-classes",
193
+ "transform-class-properties",
194
+ "transform-private-methods",
195
+ "transform-class-static-block"
196
+ ]
197
+ }]],
198
+ sourceMaps: sourceMap !== void 0,
199
+ inputSourceMap: sourceMap !== void 0 ? JSON.parse(sourceMap) : void 0,
200
+ configFile: false,
201
+ babelrc: false
202
+ });
203
+ return {
204
+ js: result?.code ?? js,
205
+ sourceMap: result?.map ? JSON.stringify(result.map) : sourceMap
206
+ };
207
+ }
169
208
  function getDeclarationFileReferences(location, program, outputDir) {
170
209
  const references = /* @__PURE__ */ new Set();
171
210
  for (const file of program.getSourceFiles()) for (const reference of file.referencedFiles) {
@@ -202,6 +241,9 @@ const toposort = (packages) => {
202
241
  //#endregion
203
242
  //#region src/commands/build/manager.ts
204
243
  var BuildManager = class extends EventEmitter {
244
+ manifest;
245
+ writer;
246
+ reporter;
205
247
  participants = /* @__PURE__ */ new Map();
206
248
  states = /* @__PURE__ */ new Map();
207
249
  participantInstances = [];
@@ -550,6 +592,11 @@ const getAnimationJsonValidation = async () => {
550
592
  //#endregion
551
593
  //#region src/lib/packageVersion.ts
552
594
  var PackageVersion = class PackageVersion {
595
+ major;
596
+ minor;
597
+ patch;
598
+ preRelease;
599
+ buildNumber;
553
600
  static fullTextMatcher = /(\d+)(\.(\d+)(\.(\d+)(\.(\d+))?(-([^\.]+)\.(\d+))?)?)?/;
554
601
  static lineMatcher = /^(\d+)(\.(\d+)(\.(\d+)(\.(\d+))?(-([^\.]+)\.(\d+))?)?)?$/;
555
602
  static extractFromText(input, description) {
@@ -708,7 +755,7 @@ async function buildFolders(options) {
708
755
  const typescriptFiles = getPackageTypescriptFiles(location);
709
756
  if (!typescriptFiles.some((file) => path.basename(file).toLowerCase() === "version.ts")) manager.addParticipant("version", createVersionLogBuildParticipant(data));
710
757
  if (typescriptFiles.length > 0) if (isScriptPackageModules(tsConfig.options)) {
711
- const { createRollupBuildParticipant } = await import("./rollup-Csyght27.js");
758
+ const { createRollupBuildParticipant } = await import("./rollup-Ci1pp5NO.js");
712
759
  manager.addParticipant("rollup", createRollupBuildParticipant(location, data, outputDirectory, !tsConfig.options.declaration));
713
760
  } else manager.addParticipant("tsc", createTSCBuildParticipant(location, outputDirectory, tsConfig.options.declaration === false));
714
761
  manager.addParticipant("animation", createAnimationBuildParticipant(location, data));
@@ -756,7 +803,7 @@ async function buildFoldersWatch(options) {
756
803
  const typescriptFiles = getPackageTypescriptFiles(location);
757
804
  if (!typescriptFiles.some((file) => path.basename(file).toLowerCase() === "version.ts")) manager.addParticipant("version", createVersionLogBuildParticipant(data));
758
805
  if (typescriptFiles.length > 0) if (isScriptPackageModules(tsConfig.options)) {
759
- const { createRollupWatchBuildParticipant } = await import("./rollup-Csyght27.js");
806
+ const { createRollupWatchBuildParticipant } = await import("./rollup-Ci1pp5NO.js");
760
807
  manager.addParticipant("rollup", createRollupWatchBuildParticipant(location, data, outputDirectory, !tsConfig.options.declaration));
761
808
  } else manager.addParticipant("tsc", createTSCWatchBuildParticipant(location, outputDirectory, tsConfig.options.declaration === false));
762
809
  manager.addParticipant("animation", createAnimationWatchBuildParticipant(location, data));
@@ -858,16 +905,17 @@ function applyTsConfigOptions(data) {
858
905
  target: "esnext",
859
906
  lib: ["es2024", "dom"],
860
907
  module: "es2015",
861
- moduleResolution: "node"
862
- };
863
- else expectedValues = {
864
- target: "es5",
865
- lib: ["es2018", "dom"]
908
+ moduleResolution: "bundler"
866
909
  };
910
+ else expectedValues = { lib: ["es2018", "dom"] };
867
911
  data.compilerOptions = data.compilerOptions ?? {};
868
912
  data.compilerOptions.strict ??= false;
869
913
  const writeToOptions = data.compilerOptions;
870
914
  let changed = false;
915
+ if (writeToOptions.target === void 0) {
916
+ writeToOptions.target = "es5";
917
+ changed = true;
918
+ }
871
919
  for (const [key, value] of Object.entries(expectedValues)) {
872
920
  const currentValue = writeToOptions[key];
873
921
  switch (typeof value) {
@@ -942,4 +990,4 @@ ${bannerText}
942
990
  //#endregion
943
991
  export { buildFolders, buildFoldersWatch, PackageVersion as t };
944
992
 
945
- //# sourceMappingURL=build-CMbCj7x-.js.map
993
+ //# sourceMappingURL=build-C4Q_eL6j.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-C4Q_eL6j.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\";\nimport { transformSync } from \"@babel/core\";\nimport babelPresetEnv, {\n\ttype Options as PresetEnvOptions,\n} from \"@babel/preset-env\";\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, useBabel } = 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\tconst jsStripped = js.replace(\n\t\t\t\t\t`//# sourceMappingURL=out.js.map`,\n\t\t\t\t\t\"\",\n\t\t\t\t);\n\t\t\t\tconst babelResult = useBabel\n\t\t\t\t\t? applyBabelTransform(jsStripped, sourceMap)\n\t\t\t\t\t: { js: jsStripped, sourceMap };\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: babelResult.js,\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: babelResult.sourceMap,\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\tconst { compilerOptions, useBabel } = getCompilerOptions(\n\t\t\tlocation,\n\t\t\toutputDir,\n\t\t\tskipDeclarations,\n\t\t);\n\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\tconst jsStripped = emitState.js.replace(\n\t\t\t\t\t\t`//# sourceMappingURL=out.js.map`,\n\t\t\t\t\t\t\"\",\n\t\t\t\t\t);\n\t\t\t\t\tconst babelResult = useBabel\n\t\t\t\t\t\t? applyBabelTransform(jsStripped, emitState.sourceMap)\n\t\t\t\t\t\t: { js: jsStripped, sourceMap: emitState.sourceMap };\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: babelResult.js,\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: babelResult.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\tcompilerOptions,\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\tconst rawTarget = config?.compilerOptions?.target;\n\tconst useBabel =\n\t\t!rawTarget || String(rawTarget).toLowerCase() !== \"es5\";\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: useBabel ? ts.ScriptTarget.ESNext : ts.ScriptTarget.ES5,\n\t\tnoEmitOnError: true,\n\t};\n\n\treturn { compilerOptions, useBabel };\n};\n\nfunction applyBabelTransform(\n\tjs: string,\n\tsourceMap?: string,\n): { js: string; sourceMap?: string } {\n\tconst result = transformSync(js, {\n\t\tpresets: [\n\t\t\t[\n\t\t\t\tbabelPresetEnv,\n\t\t\t\t{\n\t\t\t\t\ttargets: [\"defaults\", \"not IE 11\"],\n\t\t\t\t\tinclude: [\n\t\t\t\t\t\t\"transform-classes\",\n\t\t\t\t\t\t\"transform-class-properties\",\n\t\t\t\t\t\t\"transform-private-methods\",\n\t\t\t\t\t\t\"transform-class-static-block\",\n\t\t\t\t\t],\n\t\t\t\t} satisfies PresetEnvOptions,\n\t\t\t],\n\t\t],\n\t\tsourceMaps: sourceMap !== undefined,\n\t\tinputSourceMap:\n\t\t\tsourceMap !== undefined\n\t\t\t\t? (JSON.parse(sourceMap) as NonNullable<import(\"@babel/core\").TransformOptions[\"inputSourceMap\"]>)\n\t\t\t\t: undefined,\n\t\tconfigFile: false,\n\t\tbabelrc: false,\n\t});\n\n\treturn {\n\t\tjs: result?.code ?? js,\n\t\tsourceMap: result?.map ? JSON.stringify(result.map) : sourceMap,\n\t};\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: \"bundler\",\n\t\t};\n\t} else {\n\t\texpectedValues = {\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\n\tif (writeToOptions.target === undefined) {\n\t\twriteToOptions.target = \"es5\";\n\t\tchanged = true;\n\t}\n\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":";;;;;;;;;;;;;;;;AAcA,MAAa,mBAAmB,aAA8B;CAC7D,MAAM,EAAE,WAAW,GAAG,eACrB,KAAK,KAAK,SAAS,YAAY,eAAe,IAC7C,SAAS;EACT,IAAI;GACH,OAAOA,KAAG,aAAa,MAAM,MAAM;EACpC,QAAQ;GACP;EACD;CACD,CACD;CAEA,OAAO;AAGR;AAEA,MAAa,6BAEX,UACA,WACA,sBAEA,QAA4B;CAC5B,MAAM,QAAQ,0BAA0B,QAAQ;CAEhD,IAAI;EACH,IAAI,aAAa;EAEjB,IAAI,IAAI,4BAA4B;EAEpC,MAAM,EAAE,iBAAiB,aAAa,mBACrC,UACA,WACA,gBACD;EAEA,MAAM,OAAO,GAAG,mBAAmB,eAAe;EAClD,KAAK,4BAA4B,SAAS;EAE1C,IAAI;EACJ,IAAI;EACJ,IAAI;EAEJ,KAAK,aAAa,UAAU,MAAM,uBAAuB;GACxD,IAAI,SAAS,SAAS,KAAK,GAC1B,KAAK;QACC,IAAI,SAAS,SAAS,OAAO,GACnC,cAAc;QACR,IAAI,SAAS,SAAS,SAAS,GACrC,YAAY;EAEd;EAEA,MAAM,iBAA0C;GAC/C,WAAW;GACX,SAAS;GACT;EACD;EAEA,MAAM,UAAU,GAAG,cAAc,cAAc;EAE/C,MAAM,aAAa,QAAQ,KAAK;EAChC,MAAM,iBAAiB,GAAG,sBAAsB,OAAO;EAEvD,IA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,GACA;GACC,MAAM;GACN,OAAO,EACN,MAAM,+BACP;EACD,CACD,EACD;EACA,cAAc;GACb,MAAM;GACN,sBAAsB;IACrB,MAAM;IACN,OAAO,EACN,MAAM,SACP;GACD;EACD;EACA,GAAG;GACF,MAAM;GACN,aAAa;EACd;CACD;CACA,aAAa;EACZ,MAAM;GACL,MAAM;GACN,sBAAsB;GACtB,YAAY;IACX,GAAG,EACF,OAAO,CACN,EACC,MAAM,SACP,GACA,EACC,MAAM,SACP,CACD,EACD;IACA,GAAG,EACF,OAAO,CACN,EACC,MAAM,SACP,GACA,EACC,MAAM,SACP,CACD,EACD;IACA,GAAG,EACF,OAAO,CACN,EACC,MAAM,SACP,GACA,EACC,MAAM,SACP,CACD,EACD;IACA,GAAG;KACF,MAAM;KACN,aAAa;IACd;GACD;EACD;EACA,UAAU;GACT,MAAM;GACN,sBAAsB;GACtB,YAAY;IACX,GAAG;KACF,aACC;KACD,MAAM;IACP;IACA,GAAG,EACF,OAAO,CACN,EACC,MAAM,SACP,GACA,EACC,MAAM,SACP,CACD,EACD;IACA,GAAG,EACF,OAAO,CACN,EACC,MAAM,SACP,GACA,EACC,MAAM,SACP,CACD,EACD;IACA,GAAG,EACF,OAAO,CACN,EACC,MAAM,SACP,GACA,EACC,MAAM,SACP,CACD,EACD;IACA,GAAG,EACF,OAAO,CACN,EACC,MAAM,SACP,GACA,EACC,MAAM,SACP,CACD,EACD;IACA,GAAG;KACF,MAAM;KACN,aAAa;IACd;GACD;EACD;EACA,UAAU;GACT,MAAM;GACN,aAAa;GACb,SAAS;EACV;EACA,OAAO;GACN,MAAM;GACN,SAAS;EACV;EACA,gBAAgB;GACf,MAAM;GACN,sBAAsB;GACtB,YAAY;IACX,cAAc,EACb,MAAM,SACP;IACA,QAAQ;KACP,MAAM;KACN,OAAO;MACN,MAAM;MACN,sBAAsB;MACtB,YAAY;OACX,MAAM,EACL,OAAO,CACN,EACC,MAAM,sBACP,GACA,EACC,MAAM,SACP,CACD,EACD;OACA,OAAO,EACN,OAAO,CACN,EACC,MAAM,sBACP,GACA,EACC,MAAM,yBACP,CACD,EACD;OACA,OAAO,EACN,OAAO,CACN,EACC,MAAM,sBACP,GACA,EACC,MAAM,yBACP,CACD,EACD;OACA,OAAO,EACN,OAAO,CACN,EACC,MAAM,sBACP,GACA,EACC,MAAM,yBACP,CACD,EACD;OACA,MAAM,EACL,OAAO,CACN,EACC,MAAM,sBACP,GACA,EACC,MAAM,yBACP,CACD,EACD;OACA,WAAW,EACV,MAAM,SACP;OACA,YAAY,EACX,MAAM,SACP;OACA,SAAS,EACR,MAAM,SACP;OACA,WAAW,EACV,MAAM,SACP;OACA,iBAAiB,EAChB,MAAM,yBACP;OACA,sBAAsB,EACrB,MAAM,SACP;MACD;KACD;IACD;IACA,QAAQ,EACP,OAAO;KACN,EACC,MAAM,yBACP;KACA,EACC,MAAM,sBACP;KACA;MACC,MAAM;MACN,MAAM,CAAC,SAAS;KACjB;IACD,EACD;IACA,QAAQ,EACP,OAAO,CACN,EACC,MAAM,yBACP,GACA;KACC,MAAM;KACN,MAAM,CAAC,MAAM;IACd,CACD,EACD;IACA,WAAW,EACV,MAAM,SACP;IACA,eAAe,EACd,MAAM,UACP;IACA,GAAG;KACF,MAAM;KACN,aAAa;IACd;IACA,IAAI;KACH,MAAM;KACN,aAAa;IACd;GACD;EACD;CACD;AACD;;;ACrTA,MAAa,mCACZ,UACA,aACsB;CACtB,QAAQ,QAA4B;EACnC,IAAI,aAAa;EAEjB,iBAAiB,UAAU,UAAU,IAAI,GAAG,EAC1C,MAAM,WAAW;GACjB,IAAI,WAAW;IACd,MAAM;IACN,WAAW,EACV,IAAI,QAAQ,MAAM,GACnB;GACD,CAAC;EACF,CAAC,EACA,OAAO,QAAQ;GACf,IAAI,WAAW;IACd,MAAM;IACN,OAAO,IAAI;GACZ,CAAC;EACF,CAAC;EAEF,OAAO,EACN,eAAe,CAAC,EACjB;CACD;AACD;AAEA,MAAa,wCACX,UAA2B,cAC3B,QAAQ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