@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
@@ -1,9 +1,8 @@
1
- import { C as readPackageCreatorIndex, D as writePackageCreatorManifest, O as writePackageNpmManifest, T as readPackageNpmManifest, _ as PACKAGE_FILE, d as readWorkspaceNpmManifest, g as INDEX_FILE, i as createPackageScopedReporter, l as getWorkspaceOutputPath, r as consoleReporter, u as iterateWorkspacePackages, w as readPackageCreatorManifest } from "./build-kkMVBBJL.js";
2
- import "./package-DHx2bvVO.js";
3
- import "./workspace-D0XY2EMu.js";
4
- import "./scripts-CBblHIL1.js";
5
- import { buildFolders } from "./build-CMbCj7x-.js";
6
- import { a as getVersionInformationFromGit, i as getWorkspaceBannerText, r as parseVersionFromString, t as getVersionFileHandler } from "./versionFile-DViDwgCa.js";
1
+ import { C as readPackageCreatorIndex, D as writePackageCreatorManifest, O as writePackageNpmManifest, T as readPackageNpmManifest, _ as PACKAGE_FILE, d as readWorkspaceNpmManifest, g as INDEX_FILE, i as createPackageScopedReporter, l as getWorkspaceOutputPath, r as consoleReporter, u as iterateWorkspacePackages, w as readPackageCreatorManifest } from "./build-C3qEWyu4.js";
2
+ import "./package-pKTRlkgE.js";
3
+ import "./workspace-pKTRlkgE.js";
4
+ import { buildFolders } from "./build-C4Q_eL6j.js";
5
+ import { a as getVersionInformationFromGit, i as getWorkspaceBannerText, r as parseVersionFromString, t as getVersionFileHandler } from "./versionFile-K8Qq2b1u.js";
7
6
  import * as fs from "node:fs";
8
7
  import * as path from "node:path";
9
8
  import { execSync } from "node:child_process";
@@ -112,4 +111,4 @@ const copyImagesDirectory = (source, target) => {
112
111
  //#endregion
113
112
  export { publishToNpm };
114
113
 
115
- //# sourceMappingURL=publishNpm-CBT1819u.js.map
114
+ //# sourceMappingURL=publishNpm-C2uLIAWs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"publishNpm-CBT1819u.js","names":[],"sources":["../src/commands/publishNpm.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport * as fs from \"node:fs\";\nimport { execSync } from \"node:child_process\";\n\nimport {\n\tconsoleReporter,\n\tcreatePackageScopedReporter,\n\ttype Reporter,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nimport { PackageVersion } from \"../lib/packageVersion\";\nimport {\n\tINDEX_FILE,\n\ttype PackageLocation,\n\tPACKAGE_FILE,\n\treadPackageCreatorIndex,\n\treadPackageCreatorManifest,\n\treadPackageNpmManifest,\n\twritePackageNpmManifest,\n\twritePackageCreatorManifest,\n} from \"../lib/package\";\nimport {\n\tgetWorkspaceOutputPath,\n\titerateWorkspacePackages,\n\treadWorkspaceNpmManifest,\n\ttype WorkspaceLocation,\n} from \"../lib/workspace\";\nimport { getVersionInformationFromGit } from \"../lib/git\";\nimport { getWorkspaceBannerText } from \"../lib/banner\";\nimport { parseVersionFromString } from \"../lib/parseVersion\";\nimport { getVersionFileHandler } from \"../lib/versionFile\";\n\nimport { buildFolders } from \"./build\";\n\nexport interface PublishToNpmSettings {\n\tworkspace: WorkspaceLocation;\n\tlocation: PackageLocation;\n\tversion: string;\n\tdryRun?: boolean;\n\treporter?: Reporter;\n}\n\nexport const publishToNpm = async ({\n\tworkspace,\n\tlocation,\n\tversion: providedVersion,\n\tdryRun,\n\treporter: providedReporter,\n}: PublishToNpmSettings) => {\n\tlet newVersion: PackageVersion;\n\ttry {\n\t\tnewVersion = parseVersionFromString(providedVersion);\n\t} catch (err) {\n\t\tthrow new Error(`Please enter a version in this format 1.0.0.100`);\n\t}\n\n\tif (newVersion.buildNumber < 100) {\n\t\tnewVersion.preRelease = {\n\t\t\ttype: \"beta\",\n\t\t\tversion: newVersion.buildNumber,\n\t\t};\n\t} else if (newVersion.buildNumber === 100) {\n\t\tnewVersion.preRelease = undefined;\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Refusing to publish a package with a build version larger than 100.`,\n\t\t);\n\t}\n\n\tconst workspaceManifest = readWorkspaceNpmManifest(workspace);\n\tconst workspaceOutputPath = getWorkspaceOutputPath(workspace);\n\tconst creatorPackage = readPackageCreatorManifest(location);\n\n\tconst reporter =\n\t\tprovidedReporter ??\n\t\tcreatePackageScopedReporter(consoleReporter, creatorPackage.Package);\n\n\tlet packageJson = readPackageNpmManifest(location);\n\n\tif (packageJson === undefined) {\n\t\tpackageJson = {\n\t\t\tname:\n\t\t\t\t\"@intelligentgraphics/3d\" +\n\t\t\t\tcreatorPackage.Package.toLowerCase(),\n\t\t\tversion: \"1.0.0\",\n\t\t\tdescription: creatorPackage.Package,\n\t\t};\n\t}\n\n\tpackageJson.version = newVersion.toVersionString({\n\t\tbuildNumber: false,\n\t});\n\tpackageJson.description = newVersion.toDescriptionString(\n\t\tcreatorPackage.Package,\n\t);\n\tpackageJson.main = `${creatorPackage.Package}.js`;\n\tpackageJson.types = `${creatorPackage.Package}.d.ts`;\n\tpackageJson.publishConfig ??= {};\n\tpackageJson.publishConfig.acccess = \"public\";\n\tpackageJson.ig = {\n\t\tscriptingLibrary: true,\n\t};\n\tpackageJson.files = undefined;\n\n\tconst publishDir = path.join(\n\t\tworkspaceOutputPath,\n\t\t\"publish\",\n\t\tcreatorPackage.Package,\n\t);\n\tfs.rmSync(publishDir, { recursive: true, force: true });\n\tfs.mkdirSync(publishDir, { recursive: true });\n\n\twritePackageNpmManifest(location, packageJson);\n\tcreatorPackage.Version = newVersion.toVersionString({ buildNumber: true });\n\twritePackageCreatorManifest(location, creatorPackage);\n\n\tconst versionFile = getVersionFileHandler(location);\n\tif (versionFile.exists) {\n\t\tversionFile.write(creatorPackage.Package, newVersion);\n\t}\n\n\tconst gitVersionInformation = await getVersionInformationFromGit(\n\t\tworkspace,\n\t\tlocation,\n\t);\n\n\tconst bannerText = getWorkspaceBannerText(workspaceManifest);\n\n\tawait buildFolders({\n\t\tworkspace,\n\t\tpackages: [location],\n\t\tminimize: true,\n\t\toutDir: getWorkspaceOutputPath(workspace),\n\t\tbanner: {\n\t\t\ttext: bannerText,\n\t\t\tcommit: gitVersionInformation.commit,\n\t\t\tcommitDirty: gitVersionInformation.dirty,\n\t\t\tversion: newVersion.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t}),\n\t\t\tdate: new Date(Date.now()),\n\t\t},\n\t});\n\n\tfs.copyFileSync(\n\t\tpath.join(\n\t\t\tgetWorkspaceOutputPath(workspace),\n\t\t\t`${creatorPackage.Package}.d.ts`,\n\t\t),\n\t\tpath.join(publishDir, `${creatorPackage.Package}.d.ts`),\n\t);\n\tfs.copyFileSync(\n\t\tpath.join(\n\t\t\tgetWorkspaceOutputPath(workspace),\n\t\t\t`${creatorPackage.Package}.min.js`,\n\t\t),\n\t\tpath.join(publishDir, `${creatorPackage.Package}.js`),\n\t);\n\n\tfs.copyFileSync(\n\t\tpath.join(location.manifestDir, \"package.json\"),\n\t\tpath.join(publishDir, \"package.json\"),\n\t);\n\n\tfs.writeFileSync(\n\t\tpath.join(publishDir, PACKAGE_FILE),\n\t\tJSON.stringify(creatorPackage, null, 2),\n\t);\n\n\tconst index = readPackageCreatorIndex(location);\n\n\tif (index !== undefined) {\n\t\tfs.writeFileSync(\n\t\t\tpath.join(publishDir, INDEX_FILE),\n\t\t\tJSON.stringify(index),\n\t\t);\n\t}\n\n\tconst readmeName = fs\n\t\t.readdirSync(location.path)\n\t\t.find((name) => name.toLowerCase() === \"readme.md\");\n\n\tif (readmeName !== undefined) {\n\t\tfs.copyFileSync(\n\t\t\tpath.join(location.path, readmeName),\n\t\t\tpath.join(publishDir, readmeName),\n\t\t);\n\t}\n\n\tif (creatorPackage.Package === \"IG.GFX.Standard\") {\n\t\tconst source = path.join(location.path, \"Images\");\n\t\tconst target = path.join(publishDir, \"Images\");\n\t\tcopyImagesDirectory(source, target);\n\t}\n\n\tconst npmPublishArgs: string[] = [];\n\n\tif (dryRun) {\n\t\tnpmPublishArgs.push(\"--dry-run\");\n\t}\n\n\tif (newVersion.preRelease) {\n\t\tnpmPublishArgs.push(\"--tag\", \"next\");\n\t}\n\n\treporter.log(\n\t\t`Publishing to npm with version ${packageJson.version} using tag ${\n\t\t\tnewVersion.preRelease ? \"next\" : \"latest\"\n\t\t}`,\n\t);\n\n\texecSync([\"npm\", \"publish\", ...npmPublishArgs].join(\" \"), {\n\t\tstdio: \"inherit\",\n\t\tencoding: \"utf8\",\n\t\tcwd: publishDir,\n\t});\n\n\tfor (const packageLocation of iterateWorkspacePackages(workspace)) {\n\t\tconst manifest = readPackageNpmManifest(packageLocation);\n\n\t\tif (manifest?.dependencies?.[packageJson.name] !== undefined) {\n\t\t\tmanifest.dependencies[packageJson.name] = \"^\" + packageJson.version;\n\t\t\twritePackageNpmManifest(packageLocation, manifest);\n\t\t}\n\t}\n};\n\nconst copyImagesDirectory = (source: string, target: string) => {\n\tfs.mkdirSync(target, { recursive: true });\n\n\tfor (const name of fs.readdirSync(source)) {\n\t\tconst sourcePath = path.join(source, name);\n\t\tconst targetPath = path.join(target, name);\n\n\t\tif (fs.statSync(sourcePath).isDirectory()) {\n\t\t\tcopyImagesDirectory(sourcePath, targetPath);\n\t\t} else {\n\t\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AK,SAAS,MAAM,WAAW,EACpC,KAAK,KAAK,YAAY,WAAW,CACjC;AAGF,KAAI,eAAe,YAAY,kBAG9B,qBAFe,KAAK,KAAK,SAAS,MAAM,SAAS,EAClC,KAAK,KAAK,YAAY,SAAS,CACX;CAGpC,MAAM,iBAA2B,EAAE;AAEnC,KAAI,OACH,gBAAe,KAAK,YAAY;AAGjC,KAAI,WAAW,WACd,gBAAe,KAAK,SAAS,OAAO;AAGrC,UAAS,IACR,kCAAkC,YAAY,QAAQ,aACrD,WAAW,aAAa,SAAS,WAElC;AAED,UAAS;EAAC;EAAO;EAAW,GAAG;EAAe,CAAC,KAAK,IAAI,EAAE;EACzD,OAAO;EACP,UAAU;EACV,KAAK;EACL,CAAC;AAEF,MAAK,MAAM,mBAAmB,yBAAyB,UAAU,EAAE;EAClE,MAAM,WAAW,uBAAuB,gBAAgB;AAExD,MAAI,UAAU,eAAe,YAAY,UAAU,KAAA,GAAW;AAC7D,YAAS,aAAa,YAAY,QAAQ,MAAM,YAAY;AAC5D,2BAAwB,iBAAiB,SAAS;;;;AAKrD,MAAM,uBAAuB,QAAgB,WAAmB;AAC/D,IAAG,UAAU,QAAQ,EAAE,WAAW,MAAM,CAAC;AAEzC,MAAK,MAAM,QAAQ,GAAG,YAAY,OAAO,EAAE;EAC1C,MAAM,aAAa,KAAK,KAAK,QAAQ,KAAK;EAC1C,MAAM,aAAa,KAAK,KAAK,QAAQ,KAAK;AAE1C,MAAI,GAAG,SAAS,WAAW,CAAC,aAAa,CACxC,qBAAoB,YAAY,WAAW;WAG1C;GAAC;GAAQ;GAAQ;GAAS;GAAO,CAAC,SAAS,KAAK,QAAQ,KAAK,CAAC,CAE9D,IAAG,aAAa,YAAY,WAAW"}
1
+ {"version":3,"file":"publishNpm-C2uLIAWs.js","names":[],"sources":["../src/commands/publishNpm.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport * as fs from \"node:fs\";\nimport { execSync } from \"node:child_process\";\n\nimport {\n\tconsoleReporter,\n\tcreatePackageScopedReporter,\n\ttype Reporter,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nimport { PackageVersion } from \"../lib/packageVersion\";\nimport {\n\tINDEX_FILE,\n\ttype PackageLocation,\n\tPACKAGE_FILE,\n\treadPackageCreatorIndex,\n\treadPackageCreatorManifest,\n\treadPackageNpmManifest,\n\twritePackageNpmManifest,\n\twritePackageCreatorManifest,\n} from \"../lib/package\";\nimport {\n\tgetWorkspaceOutputPath,\n\titerateWorkspacePackages,\n\treadWorkspaceNpmManifest,\n\ttype WorkspaceLocation,\n} from \"../lib/workspace\";\nimport { getVersionInformationFromGit } from \"../lib/git\";\nimport { getWorkspaceBannerText } from \"../lib/banner\";\nimport { parseVersionFromString } from \"../lib/parseVersion\";\nimport { getVersionFileHandler } from \"../lib/versionFile\";\n\nimport { buildFolders } from \"./build\";\n\nexport interface PublishToNpmSettings {\n\tworkspace: WorkspaceLocation;\n\tlocation: PackageLocation;\n\tversion: string;\n\tdryRun?: boolean;\n\treporter?: Reporter;\n}\n\nexport const publishToNpm = async ({\n\tworkspace,\n\tlocation,\n\tversion: providedVersion,\n\tdryRun,\n\treporter: providedReporter,\n}: PublishToNpmSettings) => {\n\tlet newVersion: PackageVersion;\n\ttry {\n\t\tnewVersion = parseVersionFromString(providedVersion);\n\t} catch (err) {\n\t\tthrow new Error(`Please enter a version in this format 1.0.0.100`);\n\t}\n\n\tif (newVersion.buildNumber < 100) {\n\t\tnewVersion.preRelease = {\n\t\t\ttype: \"beta\",\n\t\t\tversion: newVersion.buildNumber,\n\t\t};\n\t} else if (newVersion.buildNumber === 100) {\n\t\tnewVersion.preRelease = undefined;\n\t} else {\n\t\tthrow new Error(\n\t\t\t`Refusing to publish a package with a build version larger than 100.`,\n\t\t);\n\t}\n\n\tconst workspaceManifest = readWorkspaceNpmManifest(workspace);\n\tconst workspaceOutputPath = getWorkspaceOutputPath(workspace);\n\tconst creatorPackage = readPackageCreatorManifest(location);\n\n\tconst reporter =\n\t\tprovidedReporter ??\n\t\tcreatePackageScopedReporter(consoleReporter, creatorPackage.Package);\n\n\tlet packageJson = readPackageNpmManifest(location);\n\n\tif (packageJson === undefined) {\n\t\tpackageJson = {\n\t\t\tname:\n\t\t\t\t\"@intelligentgraphics/3d\" +\n\t\t\t\tcreatorPackage.Package.toLowerCase(),\n\t\t\tversion: \"1.0.0\",\n\t\t\tdescription: creatorPackage.Package,\n\t\t};\n\t}\n\n\tpackageJson.version = newVersion.toVersionString({\n\t\tbuildNumber: false,\n\t});\n\tpackageJson.description = newVersion.toDescriptionString(\n\t\tcreatorPackage.Package,\n\t);\n\tpackageJson.main = `${creatorPackage.Package}.js`;\n\tpackageJson.types = `${creatorPackage.Package}.d.ts`;\n\tpackageJson.publishConfig ??= {};\n\tpackageJson.publishConfig.acccess = \"public\";\n\tpackageJson.ig = {\n\t\tscriptingLibrary: true,\n\t};\n\tpackageJson.files = undefined;\n\n\tconst publishDir = path.join(\n\t\tworkspaceOutputPath,\n\t\t\"publish\",\n\t\tcreatorPackage.Package,\n\t);\n\tfs.rmSync(publishDir, { recursive: true, force: true });\n\tfs.mkdirSync(publishDir, { recursive: true });\n\n\twritePackageNpmManifest(location, packageJson);\n\tcreatorPackage.Version = newVersion.toVersionString({ buildNumber: true });\n\twritePackageCreatorManifest(location, creatorPackage);\n\n\tconst versionFile = getVersionFileHandler(location);\n\tif (versionFile.exists) {\n\t\tversionFile.write(creatorPackage.Package, newVersion);\n\t}\n\n\tconst gitVersionInformation = await getVersionInformationFromGit(\n\t\tworkspace,\n\t\tlocation,\n\t);\n\n\tconst bannerText = getWorkspaceBannerText(workspaceManifest);\n\n\tawait buildFolders({\n\t\tworkspace,\n\t\tpackages: [location],\n\t\tminimize: true,\n\t\toutDir: getWorkspaceOutputPath(workspace),\n\t\tbanner: {\n\t\t\ttext: bannerText,\n\t\t\tcommit: gitVersionInformation.commit,\n\t\t\tcommitDirty: gitVersionInformation.dirty,\n\t\t\tversion: newVersion.toVersionString({\n\t\t\t\tbuildNumber: true,\n\t\t\t}),\n\t\t\tdate: new Date(Date.now()),\n\t\t},\n\t});\n\n\tfs.copyFileSync(\n\t\tpath.join(\n\t\t\tgetWorkspaceOutputPath(workspace),\n\t\t\t`${creatorPackage.Package}.d.ts`,\n\t\t),\n\t\tpath.join(publishDir, `${creatorPackage.Package}.d.ts`),\n\t);\n\tfs.copyFileSync(\n\t\tpath.join(\n\t\t\tgetWorkspaceOutputPath(workspace),\n\t\t\t`${creatorPackage.Package}.min.js`,\n\t\t),\n\t\tpath.join(publishDir, `${creatorPackage.Package}.js`),\n\t);\n\n\tfs.copyFileSync(\n\t\tpath.join(location.manifestDir, \"package.json\"),\n\t\tpath.join(publishDir, \"package.json\"),\n\t);\n\n\tfs.writeFileSync(\n\t\tpath.join(publishDir, PACKAGE_FILE),\n\t\tJSON.stringify(creatorPackage, null, 2),\n\t);\n\n\tconst index = readPackageCreatorIndex(location);\n\n\tif (index !== undefined) {\n\t\tfs.writeFileSync(\n\t\t\tpath.join(publishDir, INDEX_FILE),\n\t\t\tJSON.stringify(index),\n\t\t);\n\t}\n\n\tconst readmeName = fs\n\t\t.readdirSync(location.path)\n\t\t.find((name) => name.toLowerCase() === \"readme.md\");\n\n\tif (readmeName !== undefined) {\n\t\tfs.copyFileSync(\n\t\t\tpath.join(location.path, readmeName),\n\t\t\tpath.join(publishDir, readmeName),\n\t\t);\n\t}\n\n\tif (creatorPackage.Package === \"IG.GFX.Standard\") {\n\t\tconst source = path.join(location.path, \"Images\");\n\t\tconst target = path.join(publishDir, \"Images\");\n\t\tcopyImagesDirectory(source, target);\n\t}\n\n\tconst npmPublishArgs: string[] = [];\n\n\tif (dryRun) {\n\t\tnpmPublishArgs.push(\"--dry-run\");\n\t}\n\n\tif (newVersion.preRelease) {\n\t\tnpmPublishArgs.push(\"--tag\", \"next\");\n\t}\n\n\treporter.log(\n\t\t`Publishing to npm with version ${packageJson.version} using tag ${\n\t\t\tnewVersion.preRelease ? \"next\" : \"latest\"\n\t\t}`,\n\t);\n\n\texecSync([\"npm\", \"publish\", ...npmPublishArgs].join(\" \"), {\n\t\tstdio: \"inherit\",\n\t\tencoding: \"utf8\",\n\t\tcwd: publishDir,\n\t});\n\n\tfor (const packageLocation of iterateWorkspacePackages(workspace)) {\n\t\tconst manifest = readPackageNpmManifest(packageLocation);\n\n\t\tif (manifest?.dependencies?.[packageJson.name] !== undefined) {\n\t\t\tmanifest.dependencies[packageJson.name] = \"^\" + packageJson.version;\n\t\t\twritePackageNpmManifest(packageLocation, manifest);\n\t\t}\n\t}\n};\n\nconst copyImagesDirectory = (source: string, target: string) => {\n\tfs.mkdirSync(target, { recursive: true });\n\n\tfor (const name of fs.readdirSync(source)) {\n\t\tconst sourcePath = path.join(source, name);\n\t\tconst targetPath = path.join(target, name);\n\n\t\tif (fs.statSync(sourcePath).isDirectory()) {\n\t\t\tcopyImagesDirectory(sourcePath, targetPath);\n\t\t} else {\n\t\t\tif (\n\t\t\t\t[\".png\", \".jpg\", \".jpeg\", \".gif\"].includes(path.extname(name))\n\t\t\t) {\n\t\t\t\tfs.copyFileSync(sourcePath, targetPath);\n\t\t\t}\n\t\t}\n\t}\n};\n"],"mappings":";;;;;;;;;AA0CA,MAAa,eAAe,OAAO,EAClC,WACA,UACA,SAAS,iBACT,QACA,UAAU,uBACiB;CAC3B,IAAI;CACJ,IAAI;EACH,aAAa,uBAAuB,eAAe;CACpD,SAAS,KAAK;EACb,MAAM,IAAI,MAAM,iDAAiD;CAClE;CAEA,IAAI,WAAW,cAAc,KAC5B,WAAW,aAAa;EACvB,MAAM;EACN,SAAS,WAAW;CACrB;MACM,IAAI,WAAW,gBAAgB,KACrC,WAAW,aAAa,KAAA;MAExB,MAAM,IAAI,MACT,qEACD;CAGD,MAAM,oBAAoB,yBAAyB,SAAS;CAC5D,MAAM,sBAAsB,uBAAuB,SAAS;CAC5D,MAAM,iBAAiB,2BAA2B,QAAQ;CAE1D,MAAM,WACL,oBACA,4BAA4B,iBAAiB,eAAe,OAAO;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BAAwB,iBAAiB,QAAQ;EAClD;CACD;AACD;AAEA,MAAM,uBAAuB,QAAgB,WAAmB;CAC/D,GAAG,UAAU,QAAQ,EAAE,WAAW,KAAK,CAAC;CAExC,KAAK,MAAM,QAAQ,GAAG,YAAY,MAAM,GAAG;EAC1C,MAAM,aAAa,KAAK,KAAK,QAAQ,IAAI;EACzC,MAAM,aAAa,KAAK,KAAK,QAAQ,IAAI;EAEzC,IAAI,GAAG,SAAS,UAAU,EAAE,YAAY,GACvC,oBAAoB,YAAY,UAAU;OAE1C,IACC;GAAC;GAAQ;GAAQ;GAAS;EAAM,EAAE,SAAS,KAAK,QAAQ,IAAI,CAAC,GAE7D,GAAG,aAAa,YAAY,UAAU;CAGzC;AACD"}
@@ -0,0 +1,2 @@
1
+ import "./build-C3qEWyu4.js";
2
+ export {};
@@ -1,9 +1,9 @@
1
- import "./build-kkMVBBJL.js";
2
- import { r as resolveScriptPackageEntryModule } from "./scripts-CBblHIL1.js";
1
+ import { r as resolveScriptPackageEntryModule } from "./scripts-D5xp5cJY.js";
3
2
  import * as path from "node:path";
4
3
  import resolve from "resolve";
5
4
  import * as os from "node:os";
6
5
  import ts from "typescript";
6
+ import babelPresetEnv from "@babel/preset-env";
7
7
  import { rollup, watch } from "rollup";
8
8
  import rollupPluginNodeResolve from "@rollup/plugin-node-resolve";
9
9
  import rollupPluginTypescript from "@rollup/plugin-typescript";
@@ -11,7 +11,6 @@ import rollupPluginBabel from "@rollup/plugin-babel";
11
11
  import rollupPluginCommonJs from "@rollup/plugin-commonjs";
12
12
  import rollupPluginJson from "@rollup/plugin-json";
13
13
  import rollupPluginAlias from "@rollup/plugin-alias";
14
- import babelPresetEnv from "@babel/preset-env";
15
14
  import { bundleFromEntryFile } from "@intelligentgraphics/declarationbundler";
16
15
  //#region src/commands/build/rollup.ts
17
16
  function createRollupBuildParticipant(location, manifest, outDir, skipDeclarations) {
@@ -176,4 +175,4 @@ function bundleTSDeclarations(files, entryFileName, namespace) {
176
175
  //#endregion
177
176
  export { createRollupBuildParticipant, createRollupWatchBuildParticipant };
178
177
 
179
- //# sourceMappingURL=rollup-Csyght27.js.map
178
+ //# sourceMappingURL=rollup-Ci1pp5NO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-Csyght27.js","names":[],"sources":["../src/commands/build/rollup.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport ts from \"typescript\";\nimport * as os from \"node:os\";\nimport resolve from \"resolve\";\nimport { rollup, watch, type RollupOutput, type RollupOptions } from \"rollup\";\nimport rollupPluginNodeResolve from \"@rollup/plugin-node-resolve\";\nimport rollupPluginTypescript from \"@rollup/plugin-typescript\";\nimport rollupPluginBabel from \"@rollup/plugin-babel\";\nimport rollupPluginCommonJs from \"@rollup/plugin-commonjs\";\nimport rollupPluginJson from \"@rollup/plugin-json\";\nimport rollupPluginAlias from \"@rollup/plugin-alias\";\nimport babelPresetEnv, {\n\ttype Options as PresetEnvOptions,\n} from \"@babel/preset-env\";\n\nimport { bundleFromEntryFile } from \"@intelligentgraphics/declarationbundler\";\n\nimport type { CreatorPackage, PackageLocation } from \"../../lib/package\";\nimport type {\n\tBuildArtefacts,\n\tBuilderEnvironment,\n\tBuildParticipant,\n} from \"./types\";\nimport { resolveScriptPackageEntryModule } from \"../../lib/scripts\";\n\nexport function createRollupBuildParticipant(\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n\toutDir: string,\n\tskipDeclarations: boolean,\n): BuildParticipant {\n\treturn (env: BuilderEnvironment) => {\n\t\tenv.onBuildStart();\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tconst rollupConfig = getRollupConfig(\n\t\t\t\t\tlocation,\n\t\t\t\t\tmanifest,\n\t\t\t\t\toutDir,\n\t\t\t\t\tskipDeclarations,\n\t\t\t\t\tenv,\n\t\t\t\t);\n\n\t\t\t\tconst build = await rollup(rollupConfig);\n\n\t\t\t\tconst output = await build.generate(rollupConfig.output);\n\n\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\ttype: \"success\",\n\t\t\t\t\tartefacts: processRollupOutput(\n\t\t\t\t\t\toutput,\n\t\t\t\t\t\tlocation,\n\t\t\t\t\t\tmanifest,\n\t\t\t\t\t\trollupConfig.input,\n\t\t\t\t\t\tskipDeclarations,\n\t\t\t\t\t),\n\t\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 instanceof Error ? err : new Error(String(err)),\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}\n\nexport function createRollupWatchBuildParticipant(\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n\toutDir: string,\n\tskipDeclarations: boolean,\n): BuildParticipant {\n\treturn (env: BuilderEnvironment) => {\n\t\tenv.onBuildStart();\n\n\t\tconst rollupConfig = getRollupConfig(\n\t\t\tlocation,\n\t\t\tmanifest,\n\t\t\toutDir,\n\t\t\tskipDeclarations,\n\t\t\tenv,\n\t\t);\n\n\t\tconst watcher = watch({\n\t\t\t...rollupConfig,\n\t\t\twatch: {\n\t\t\t\tskipWrite: true,\n\t\t\t},\n\t\t});\n\n\t\twatcher.on(\"event\", async (event) => {\n\t\t\tswitch (event.code) {\n\t\t\t\tcase \"BUNDLE_START\":\n\t\t\t\t\tenv.onBuildStart();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"BUNDLE_END\":\n\t\t\t\t\tconst output = await event.result.generate(\n\t\t\t\t\t\trollupConfig.output!,\n\t\t\t\t\t);\n\t\t\t\t\ttry {\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: processRollupOutput(\n\t\t\t\t\t\t\t\toutput,\n\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\tmanifest,\n\t\t\t\t\t\t\t\trollupConfig.input,\n\t\t\t\t\t\t\t\tskipDeclarations,\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\n\t\t\t\t\tevent.result.close();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"ERROR\":\n\t\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\terror: Object.assign(\n\t\t\t\t\t\t\tnew Error(event.error.message),\n\t\t\t\t\t\t\tevent.error,\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\treturn {\n\t\t\tdestroy: () => watcher.close(),\n\t\t};\n\t};\n}\n\nfunction getRollupConfig(\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n\toutDir: string,\n\tskipDeclarations: boolean,\n\tenv: BuilderEnvironment,\n) {\n\tconst entryModule = resolveScriptPackageEntryModule(location, manifest);\n\n\tif (entryModule === undefined) {\n\t\tthrow new Error(`Could not find an entry module`);\n\t}\n\n\treturn {\n\t\tinput: entryModule,\n\t\tplugins: [\n\t\t\trollupPluginNodeResolve(),\n\t\t\trollupPluginCommonJs(),\n\t\t\trollupPluginJson(),\n\t\t\trollupPluginAlias({\n\t\t\t\tentries: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfind: /^core-js(.*)/,\n\t\t\t\t\t\treplacement: path.join(\n\t\t\t\t\t\t\tpath.dirname(\n\t\t\t\t\t\t\t\tresolve.sync(\"core-js\", {\n\t\t\t\t\t\t\t\t\tbasedir: import.meta.dirname,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\"/$1\",\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\trollupPluginTypescript({\n\t\t\t\tcompilerOptions: {\n\t\t\t\t\trootDir: skipDeclarations ? undefined : location.scriptsDir,\n\t\t\t\t\tdeclaration: !skipDeclarations,\n\t\t\t\t\tdeclarationDir: skipDeclarations ? undefined : outDir,\n\t\t\t\t\tmodule: \"esnext\",\n\t\t\t\t\ttarget: \"esnext\",\n\t\t\t\t},\n\t\t\t\ttsconfig: path.join(location.scriptsDir, \"tsconfig.json\"),\n\t\t\t\tremoveComments: false,\n\t\t\t\tfilterRoot: skipDeclarations ? false : undefined,\n\t\t\t\tincremental: false,\n\t\t\t\tnoEmitOnError: false,\n\t\t\t}),\n\t\t\trollupPluginBabel({\n\t\t\t\tpresets: [\n\t\t\t\t\t[\n\t\t\t\t\t\tbabelPresetEnv,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcorejs: \"3\",\n\t\t\t\t\t\t\tinclude: [\n\t\t\t\t\t\t\t\t\"transform-classes\",\n\t\t\t\t\t\t\t\t\"transform-class-properties\",\n\t\t\t\t\t\t\t\t\"transform-private-methods\",\n\t\t\t\t\t\t\t\t\"transform-class-static-block\",\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t} satisfies PresetEnvOptions,\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t\ttargets: [\"defaults\", \"not IE 11\"],\n\t\t\t\tbabelHelpers: \"bundled\",\n\t\t\t\textensions: [\".ts\", \".js\"],\n\t\t\t\tsourceMaps: true,\n\t\t\t\texclude: /core-js/,\n\t\t\t}),\n\t\t],\n\t\toutput: {\n\t\t\tformat: \"iife\",\n\t\t\tname: manifest.Scope ?? manifest.Package,\n\t\t\tdir: outDir,\n\t\t\tsourcemap: \"hidden\",\n\t\t\textend: true,\n\t\t},\n\t\tonLog: createLogger(env),\n\t} satisfies RollupOptions;\n}\n\nfunction createLogger(env: BuilderEnvironment): RollupOptions[\"onLog\"] {\n\treturn (level, log, _handler) => {\n\t\tenv.log(log.message);\n\t};\n}\n\nfunction processRollupOutput(\n\toutput: RollupOutput,\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n\tentryModulePath: string,\n\tskipDeclarations: boolean,\n): BuildArtefacts {\n\tconst [primaryChunk, ...otherOutputs] = output.output;\n\n\tconst assets = otherOutputs.filter((chunk) => chunk.type === \"asset\");\n\n\tconst sourceMap = assets.find((asset) =>\n\t\tasset.fileName.endsWith(\".js.map\"),\n\t);\n\n\tlet declarations: string | undefined;\n\n\tif (!skipDeclarations) {\n\t\tconst declarationFileMap = new Map(\n\t\t\tassets\n\t\t\t\t.filter((asset) => asset.fileName.endsWith(\".d.ts\"))\n\t\t\t\t.map((asset) => {\n\t\t\t\t\treturn [\n\t\t\t\t\t\tpath\n\t\t\t\t\t\t\t.resolve(location.scriptsDir, asset.fileName)\n\t\t\t\t\t\t\t.replaceAll(\"\\\\\", \"/\"),\n\t\t\t\t\t\tasset.source as string,\n\t\t\t\t\t];\n\t\t\t\t}),\n\t\t);\n\n\t\tconst entryModulePathWithDts = path.join(\n\t\t\tpath.dirname(entryModulePath),\n\t\t\tpath.basename(entryModulePath, path.extname(entryModulePath)) +\n\t\t\t\t\".d.ts\",\n\t\t);\n\n\t\tdeclarations = bundleTSDeclarations(\n\t\t\tdeclarationFileMap,\n\t\t\tentryModulePathWithDts,\n\t\t\tmanifest.Scope ?? manifest.Package,\n\t\t);\n\t}\n\n\treturn {\n\t\tjs: primaryChunk.code,\n\t\tdeclarations,\n\t\tsourceMap: sourceMap?.source as string,\n\t};\n}\n\nconst referenceRegex = /(\\/\\/\\/ ?<reference .+\\/>$)/;\n\nfunction bundleTSDeclarations(\n\tfiles: Map<string, string>,\n\tentryFileName: string,\n\tnamespace: string,\n) {\n\tconst references: string[] = [];\n\n\tfor (const [_fileName, content] of files) {\n\t\tif (content.indexOf(\"reference\") === -1) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst lines = content.split(os.EOL);\n\n\t\tfor (let index = 0; index < lines.length; index++) {\n\t\t\tconst line = lines[index];\n\t\t\tconst match = line.match(referenceRegex);\n\n\t\t\tif (match === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!references.includes(match[1])) {\n\t\t\t\treferences.push(match[1]);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst compilerOptions: ts.CompilerOptions = {\n\t\tremoveComments: false,\n\t};\n\n\tconst host = ts.createCompilerHost(compilerOptions, true);\n\thost.fileExists = (fileName) => files.has(fileName);\n\thost.readFile = (fileName) => files.get(fileName);\n\n\tconst program = ts.createProgram({\n\t\thost,\n\t\toptions: compilerOptions,\n\t\trootNames: [entryFileName],\n\t});\n\n\tconst mainFile = program.getSourceFile(entryFileName);\n\n\tif (mainFile === undefined) {\n\t\tthrow new Error(\n\t\t\t`Unexpected: Failed to find compiled declaration entry module`,\n\t\t);\n\t}\n\n\tconst result = bundleFromEntryFile(\n\t\tnamespace,\n\t\tmainFile,\n\t\tprogram,\n\t\thost,\n\t\tprogram.getTypeChecker(),\n\t\tcompilerOptions,\n\t);\n\treturn [...references, result].join(os.EOL);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,SAAgB,6BACf,UACA,UACA,QACA,kBACmB;AACnB,SAAQ,QAA4B;AACnC,MAAI,cAAc;AAElB,GAAC,YAAY;AACZ,OAAI;IACH,MAAM,eAAe,gBACpB,UACA,UACA,QACA,kBACA,IACA;IAID,MAAM,SAAS,OAFD,MAAM,OAAO,aAAa,EAEb,SAAS,aAAa,OAAO;AAExD,QAAI,WAAW;KACd,MAAM;KACN,WAAW,oBACV,QACA,UACA,UACA,aAAa,OACb,iBACA;KACD,CAAC;YACM,KAAK;AACb,QAAI,WAAW;KACd,MAAM;KACN,OAAO,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,IAAI,CAAC;KAC1D,CAAC;;MAEA;AAEJ,SAAO,EACN,eAAe,IACf;;;AAIH,SAAgB,kCACf,UACA,UACA,QACA,kBACmB;AACnB,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ACtB;;AAGF,MAAM,iBAAiB;AAEvB,SAAS,qBACR,OACA,eACA,WACC;CACD,MAAM,aAAuB,EAAE;AAE/B,MAAK,MAAM,CAAC,WAAW,YAAY,OAAO;AACzC,MAAI,QAAQ,QAAQ,YAAY,KAAK,GACpC;EAGD,MAAM,QAAQ,QAAQ,MAAM,GAAG,IAAI;AAEnC,OAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;GAElD,MAAM,QADO,MAAM,OACA,MAAM,eAAe;AAExC,OAAI,UAAU,KACb;AAGD,OAAI,CAAC,WAAW,SAAS,MAAM,GAAG,CACjC,YAAW,KAAK,MAAM,GAAG;;;CAK5B,MAAM,kBAAsC,EAC3C,gBAAgB,OAChB;CAED,MAAM,OAAO,GAAG,mBAAmB,iBAAiB,KAAK;AACzD,MAAK,cAAc,aAAa,MAAM,IAAI,SAAS;AACnD,MAAK,YAAY,aAAa,MAAM,IAAI,SAAS;CAEjD,MAAM,UAAU,GAAG,cAAc;EAChC;EACA,SAAS;EACT,WAAW,CAAC,cAAc;EAC1B,CAAC;CAEF,MAAM,WAAW,QAAQ,cAAc,cAAc;AAErD,KAAI,aAAa,KAAA,EAChB,OAAM,IAAI,MACT,+DACA;CAGF,MAAM,SAAS,oBACd,WACA,UACA,SACA,MACA,QAAQ,gBAAgB,EACxB,gBACA;AACD,QAAO,CAAC,GAAG,YAAY,OAAO,CAAC,KAAK,GAAG,IAAI"}
1
+ {"version":3,"file":"rollup-Ci1pp5NO.js","names":[],"sources":["../src/commands/build/rollup.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport ts from \"typescript\";\nimport * as os from \"node:os\";\nimport resolve from \"resolve\";\nimport { rollup, watch, type RollupOutput, type RollupOptions } from \"rollup\";\nimport rollupPluginNodeResolve from \"@rollup/plugin-node-resolve\";\nimport rollupPluginTypescript from \"@rollup/plugin-typescript\";\nimport rollupPluginBabel from \"@rollup/plugin-babel\";\nimport rollupPluginCommonJs from \"@rollup/plugin-commonjs\";\nimport rollupPluginJson from \"@rollup/plugin-json\";\nimport rollupPluginAlias from \"@rollup/plugin-alias\";\nimport babelPresetEnv, {\n\ttype Options as PresetEnvOptions,\n} from \"@babel/preset-env\";\n\nimport { bundleFromEntryFile } from \"@intelligentgraphics/declarationbundler\";\n\nimport type { CreatorPackage, PackageLocation } from \"../../lib/package\";\nimport type {\n\tBuildArtefacts,\n\tBuilderEnvironment,\n\tBuildParticipant,\n} from \"./types\";\nimport { resolveScriptPackageEntryModule } from \"../../lib/scripts\";\n\nexport function createRollupBuildParticipant(\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n\toutDir: string,\n\tskipDeclarations: boolean,\n): BuildParticipant {\n\treturn (env: BuilderEnvironment) => {\n\t\tenv.onBuildStart();\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tconst rollupConfig = getRollupConfig(\n\t\t\t\t\tlocation,\n\t\t\t\t\tmanifest,\n\t\t\t\t\toutDir,\n\t\t\t\t\tskipDeclarations,\n\t\t\t\t\tenv,\n\t\t\t\t);\n\n\t\t\t\tconst build = await rollup(rollupConfig);\n\n\t\t\t\tconst output = await build.generate(rollupConfig.output);\n\n\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\ttype: \"success\",\n\t\t\t\t\tartefacts: processRollupOutput(\n\t\t\t\t\t\toutput,\n\t\t\t\t\t\tlocation,\n\t\t\t\t\t\tmanifest,\n\t\t\t\t\t\trollupConfig.input,\n\t\t\t\t\t\tskipDeclarations,\n\t\t\t\t\t),\n\t\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 instanceof Error ? err : new Error(String(err)),\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}\n\nexport function createRollupWatchBuildParticipant(\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n\toutDir: string,\n\tskipDeclarations: boolean,\n): BuildParticipant {\n\treturn (env: BuilderEnvironment) => {\n\t\tenv.onBuildStart();\n\n\t\tconst rollupConfig = getRollupConfig(\n\t\t\tlocation,\n\t\t\tmanifest,\n\t\t\toutDir,\n\t\t\tskipDeclarations,\n\t\t\tenv,\n\t\t);\n\n\t\tconst watcher = watch({\n\t\t\t...rollupConfig,\n\t\t\twatch: {\n\t\t\t\tskipWrite: true,\n\t\t\t},\n\t\t});\n\n\t\twatcher.on(\"event\", async (event) => {\n\t\t\tswitch (event.code) {\n\t\t\t\tcase \"BUNDLE_START\":\n\t\t\t\t\tenv.onBuildStart();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"BUNDLE_END\":\n\t\t\t\t\tconst output = await event.result.generate(\n\t\t\t\t\t\trollupConfig.output!,\n\t\t\t\t\t);\n\t\t\t\t\ttry {\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: processRollupOutput(\n\t\t\t\t\t\t\t\toutput,\n\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\tmanifest,\n\t\t\t\t\t\t\t\trollupConfig.input,\n\t\t\t\t\t\t\t\tskipDeclarations,\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\n\t\t\t\t\tevent.result.close();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"ERROR\":\n\t\t\t\t\tenv.onBuildEnd({\n\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\terror: Object.assign(\n\t\t\t\t\t\t\tnew Error(event.error.message),\n\t\t\t\t\t\t\tevent.error,\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\treturn {\n\t\t\tdestroy: () => watcher.close(),\n\t\t};\n\t};\n}\n\nfunction getRollupConfig(\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n\toutDir: string,\n\tskipDeclarations: boolean,\n\tenv: BuilderEnvironment,\n) {\n\tconst entryModule = resolveScriptPackageEntryModule(location, manifest);\n\n\tif (entryModule === undefined) {\n\t\tthrow new Error(`Could not find an entry module`);\n\t}\n\n\treturn {\n\t\tinput: entryModule,\n\t\tplugins: [\n\t\t\trollupPluginNodeResolve(),\n\t\t\trollupPluginCommonJs(),\n\t\t\trollupPluginJson(),\n\t\t\trollupPluginAlias({\n\t\t\t\tentries: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfind: /^core-js(.*)/,\n\t\t\t\t\t\treplacement: path.join(\n\t\t\t\t\t\t\tpath.dirname(\n\t\t\t\t\t\t\t\tresolve.sync(\"core-js\", {\n\t\t\t\t\t\t\t\t\tbasedir: import.meta.dirname,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\"/$1\",\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\trollupPluginTypescript({\n\t\t\t\tcompilerOptions: {\n\t\t\t\t\trootDir: skipDeclarations ? undefined : location.scriptsDir,\n\t\t\t\t\tdeclaration: !skipDeclarations,\n\t\t\t\t\tdeclarationDir: skipDeclarations ? undefined : outDir,\n\t\t\t\t\tmodule: \"esnext\",\n\t\t\t\t\ttarget: \"esnext\",\n\t\t\t\t},\n\t\t\t\ttsconfig: path.join(location.scriptsDir, \"tsconfig.json\"),\n\t\t\t\tremoveComments: false,\n\t\t\t\tfilterRoot: skipDeclarations ? false : undefined,\n\t\t\t\tincremental: false,\n\t\t\t\tnoEmitOnError: false,\n\t\t\t}),\n\t\t\trollupPluginBabel({\n\t\t\t\tpresets: [\n\t\t\t\t\t[\n\t\t\t\t\t\tbabelPresetEnv,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcorejs: \"3\",\n\t\t\t\t\t\t\tinclude: [\n\t\t\t\t\t\t\t\t\"transform-classes\",\n\t\t\t\t\t\t\t\t\"transform-class-properties\",\n\t\t\t\t\t\t\t\t\"transform-private-methods\",\n\t\t\t\t\t\t\t\t\"transform-class-static-block\",\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t} satisfies PresetEnvOptions,\n\t\t\t\t\t],\n\t\t\t\t],\n\t\t\t\ttargets: [\"defaults\", \"not IE 11\"],\n\t\t\t\tbabelHelpers: \"bundled\",\n\t\t\t\textensions: [\".ts\", \".js\"],\n\t\t\t\tsourceMaps: true,\n\t\t\t\texclude: /core-js/,\n\t\t\t}),\n\t\t],\n\t\toutput: {\n\t\t\tformat: \"iife\",\n\t\t\tname: manifest.Scope ?? manifest.Package,\n\t\t\tdir: outDir,\n\t\t\tsourcemap: \"hidden\",\n\t\t\textend: true,\n\t\t},\n\t\tonLog: createLogger(env),\n\t} satisfies RollupOptions;\n}\n\nfunction createLogger(env: BuilderEnvironment): RollupOptions[\"onLog\"] {\n\treturn (level, log, _handler) => {\n\t\tenv.log(log.message);\n\t};\n}\n\nfunction processRollupOutput(\n\toutput: RollupOutput,\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n\tentryModulePath: string,\n\tskipDeclarations: boolean,\n): BuildArtefacts {\n\tconst [primaryChunk, ...otherOutputs] = output.output;\n\n\tconst assets = otherOutputs.filter((chunk) => chunk.type === \"asset\");\n\n\tconst sourceMap = assets.find((asset) =>\n\t\tasset.fileName.endsWith(\".js.map\"),\n\t);\n\n\tlet declarations: string | undefined;\n\n\tif (!skipDeclarations) {\n\t\tconst declarationFileMap = new Map(\n\t\t\tassets\n\t\t\t\t.filter((asset) => asset.fileName.endsWith(\".d.ts\"))\n\t\t\t\t.map((asset) => {\n\t\t\t\t\treturn [\n\t\t\t\t\t\tpath\n\t\t\t\t\t\t\t.resolve(location.scriptsDir, asset.fileName)\n\t\t\t\t\t\t\t.replaceAll(\"\\\\\", \"/\"),\n\t\t\t\t\t\tasset.source as string,\n\t\t\t\t\t];\n\t\t\t\t}),\n\t\t);\n\n\t\tconst entryModulePathWithDts = path.join(\n\t\t\tpath.dirname(entryModulePath),\n\t\t\tpath.basename(entryModulePath, path.extname(entryModulePath)) +\n\t\t\t\t\".d.ts\",\n\t\t);\n\n\t\tdeclarations = bundleTSDeclarations(\n\t\t\tdeclarationFileMap,\n\t\t\tentryModulePathWithDts,\n\t\t\tmanifest.Scope ?? manifest.Package,\n\t\t);\n\t}\n\n\treturn {\n\t\tjs: primaryChunk.code,\n\t\tdeclarations,\n\t\tsourceMap: sourceMap?.source as string,\n\t};\n}\n\nconst referenceRegex = /(\\/\\/\\/ ?<reference .+\\/>$)/;\n\nfunction bundleTSDeclarations(\n\tfiles: Map<string, string>,\n\tentryFileName: string,\n\tnamespace: string,\n) {\n\tconst references: string[] = [];\n\n\tfor (const [_fileName, content] of files) {\n\t\tif (content.indexOf(\"reference\") === -1) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst lines = content.split(os.EOL);\n\n\t\tfor (let index = 0; index < lines.length; index++) {\n\t\t\tconst line = lines[index];\n\t\t\tconst match = line.match(referenceRegex);\n\n\t\t\tif (match === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!references.includes(match[1])) {\n\t\t\t\treferences.push(match[1]);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst compilerOptions: ts.CompilerOptions = {\n\t\tremoveComments: false,\n\t};\n\n\tconst host = ts.createCompilerHost(compilerOptions, true);\n\thost.fileExists = (fileName) => files.has(fileName);\n\thost.readFile = (fileName) => files.get(fileName);\n\n\tconst program = ts.createProgram({\n\t\thost,\n\t\toptions: compilerOptions,\n\t\trootNames: [entryFileName],\n\t});\n\n\tconst mainFile = program.getSourceFile(entryFileName);\n\n\tif (mainFile === undefined) {\n\t\tthrow new Error(\n\t\t\t`Unexpected: Failed to find compiled declaration entry module`,\n\t\t);\n\t}\n\n\tconst result = bundleFromEntryFile(\n\t\tnamespace,\n\t\tmainFile,\n\t\tprogram,\n\t\thost,\n\t\tprogram.getTypeChecker(),\n\t\tcompilerOptions,\n\t);\n\treturn [...references, result].join(os.EOL);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyBA,SAAgB,6BACf,UACA,UACA,QACA,kBACmB;CACnB,QAAQ,QAA4B;EACnC,IAAI,aAAa;EAEjB,CAAC,YAAY;GACZ,IAAI;IACH,MAAM,eAAe,gBACpB,UACA,UACA,QACA,kBACA,GACD;IAIA,MAAM,SAAS,OAAM,MAFD,OAAO,YAAY,GAEZ,SAAS,aAAa,MAAM;IAEvD,IAAI,WAAW;KACd,MAAM;KACN,WAAW,oBACV,QACA,UACA,UACA,aAAa,OACb,gBACD;IACD,CAAC;GACF,SAAS,KAAK;IACb,IAAI,WAAW;KACd,MAAM;KACN,OAAO,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;IAC1D,CAAC;GACF;EACD,GAAG;EAEH,OAAO,EACN,eAAe,CAAC,EACjB;CACD;AACD;AAEA,SAAgB,kCACf,UACA,UACA,QACA,kBACmB;CACnB,QAAQ,QAA4B;EACnC,IAAI,aAAa;EAEjB,MAAM,eAAe,gBACpB,UACA,UACA,QACA,kBACA,GACD;EAEA,MAAM,UAAU,MAAM;GACrB,GAAG;GACH,OAAO,EACN,WAAW,KACZ;EACD,CAAC;EAED,QAAQ,GAAG,SAAS,OAAO,UAAU;GACpC,QAAQ,MAAM,MAAd;IACC,KAAK;KACJ,IAAI,aAAa;KACjB;IACD,KAAK;KACJ,MAAM,SAAS,MAAM,MAAM,OAAO,SACjC,aAAa,MACd;KACA,IAAI;MACH,IAAI,WAAW;OACd,MAAM;OACN,WAAW,oBACV,QACA,UACA,UACA,aAAa,OACb,gBACD;MACD,CAAC;KACF,SAAS,KAAK;MACb,IAAI,W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,EAAE;EAE1B;CACD;CAEA,MAAM,kBAAsC,EAC3C,gBAAgB,MACjB;CAEA,MAAM,OAAO,GAAG,mBAAmB,iBAAiB,IAAI;CACxD,KAAK,cAAc,aAAa,MAAM,IAAI,QAAQ;CAClD,KAAK,YAAY,aAAa,MAAM,IAAI,QAAQ;CAEhD,MAAM,UAAU,GAAG,cAAc;EAChC;EACA,SAAS;EACT,WAAW,CAAC,aAAa;CAC1B,CAAC;CAED,MAAM,WAAW,QAAQ,cAAc,aAAa;CAEpD,IAAI,aAAa,KAAA,GAChB,MAAM,IAAI,MACT,8DACD;CAGD,MAAM,SAAS,oBACd,WACA,UACA,SACA,MACA,QAAQ,eAAe,GACvB,eACD;CACA,OAAO,CAAC,GAAG,YAAY,MAAM,EAAE,KAAK,GAAG,GAAG;AAC3C"}
@@ -1,3 +1,4 @@
1
+ import "./build-C3qEWyu4.js";
1
2
  import * as fs from "node:fs";
2
3
  import * as path from "node:path";
3
4
  import ts from "typescript";
@@ -26,4 +27,4 @@ function isScriptPackageModules(options) {
26
27
  //#endregion
27
28
  export { readScriptPackageTSConfig as n, resolveScriptPackageEntryModule as r, isScriptPackageModules as t };
28
29
 
29
- //# sourceMappingURL=scripts-CBblHIL1.js.map
30
+ //# sourceMappingURL=scripts-D5xp5cJY.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scripts-CBblHIL1.js","names":[],"sources":["../src/lib/scripts.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport ts from \"typescript\";\n\nimport type {\n\tCreatorPackage,\n\tPackageLocation,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nexport { getPackageTypescriptFiles } from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nexport function resolveScriptPackageEntryModule(\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n) {\n\tlet candidates = [\"index.ts\"];\n\n\tif (manifest.Type === \"Context\") {\n\t\tcandidates.push(\"Context.ts\");\n\t}\n\n\tfor (const candidate of candidates) {\n\t\tconst candidatePath = path.join(location.scriptsDir, candidate);\n\n\t\tif (fs.existsSync(candidatePath)) {\n\t\t\treturn candidatePath;\n\t\t}\n\t}\n}\n\nexport function readScriptPackageTSConfig(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\tconst parsedTsConfig = ts.parseJsonConfigFileContent(\n\t\tconfig,\n\t\tts.sys,\n\t\tlocation.scriptsDir,\n\t);\n\n\treturn parsedTsConfig;\n}\n\nexport function isScriptPackageModules(options: ts.CompilerOptions) {\n\treturn options.module === ts.ModuleKind.ES2015;\n}\n"],"mappings":";;;;AAWA,SAAgB,gCACf,UACA,UACC;CACD,IAAI,aAAa,CAAC,WAAW;AAE7B,KAAI,SAAS,SAAS,UACrB,YAAW,KAAK,aAAa;AAG9B,MAAK,MAAM,aAAa,YAAY;EACnC,MAAM,gBAAgB,KAAK,KAAK,SAAS,YAAY,UAAU;AAE/D,MAAI,GAAG,WAAW,cAAc,CAC/B,QAAO;;;AAKV,SAAgB,0BAA0B,UAA2B;CACpE,MAAM,EAAE,WAAW,GAAG,eACrB,KAAK,KAAK,SAAS,YAAY,gBAAgB,GAC9C,SAAS;AACT,MAAI;AACH,UAAO,GAAG,aAAa,MAAM,OAAO;UAC7B;AACP;;GAGF;AAQD,QANuB,GAAG,2BACzB,QACA,GAAG,KACH,SAAS,WACT;;AAKF,SAAgB,uBAAuB,SAA6B;AACnE,QAAO,QAAQ,WAAW,GAAG,WAAW"}
1
+ {"version":3,"file":"scripts-D5xp5cJY.js","names":[],"sources":["../src/lib/scripts.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport ts from \"typescript\";\n\nimport type {\n\tCreatorPackage,\n\tPackageLocation,\n} from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nexport { getPackageTypescriptFiles } from \"@intelligentgraphics/ig.gfx.tools.core\";\n\nexport function resolveScriptPackageEntryModule(\n\tlocation: PackageLocation,\n\tmanifest: CreatorPackage,\n) {\n\tlet candidates = [\"index.ts\"];\n\n\tif (manifest.Type === \"Context\") {\n\t\tcandidates.push(\"Context.ts\");\n\t}\n\n\tfor (const candidate of candidates) {\n\t\tconst candidatePath = path.join(location.scriptsDir, candidate);\n\n\t\tif (fs.existsSync(candidatePath)) {\n\t\t\treturn candidatePath;\n\t\t}\n\t}\n}\n\nexport function readScriptPackageTSConfig(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\tconst parsedTsConfig = ts.parseJsonConfigFileContent(\n\t\tconfig,\n\t\tts.sys,\n\t\tlocation.scriptsDir,\n\t);\n\n\treturn parsedTsConfig;\n}\n\nexport function isScriptPackageModules(options: ts.CompilerOptions) {\n\treturn options.module === ts.ModuleKind.ES2015;\n}\n"],"mappings":";;;;;AAWA,SAAgB,gCACf,UACA,UACC;CACD,IAAI,aAAa,CAAC,UAAU;CAE5B,IAAI,SAAS,SAAS,WACrB,WAAW,KAAK,YAAY;CAG7B,KAAK,MAAM,aAAa,YAAY;EACnC,MAAM,gBAAgB,KAAK,KAAK,SAAS,YAAY,SAAS;EAE9D,IAAI,GAAG,WAAW,aAAa,GAC9B,OAAO;CAET;AACD;AAEA,SAAgB,0BAA0B,UAA2B;CACpE,MAAM,EAAE,WAAW,GAAG,eACrB,KAAK,KAAK,SAAS,YAAY,eAAe,IAC7C,SAAS;EACT,IAAI;GACH,OAAO,GAAG,aAAa,MAAM,MAAM;EACpC,QAAQ;GACP;EACD;CACD,CACD;CAQA,OANuB,GAAG,2BACzB,QACA,GAAG,KACH,SAAS,UAGU;AACrB;AAEA,SAAgB,uBAAuB,SAA6B;CACnE,OAAO,QAAQ,WAAW,GAAG,WAAW;AACzC"}
@@ -1,5 +1,5 @@
1
- import { A as isErrorENOENT, a as readStringFromFileOrUndefined } from "./build-kkMVBBJL.js";
2
- import { t as PackageVersion } from "./build-CMbCj7x-.js";
1
+ import { A as isErrorENOENT, a as readStringFromFileOrUndefined } from "./build-C3qEWyu4.js";
2
+ import { t as PackageVersion } from "./build-C4Q_eL6j.js";
3
3
  import * as fs from "node:fs";
4
4
  import * as path from "node:path";
5
5
  import simpleGit from "simple-git";
@@ -120,4 +120,4 @@ const createYearString = (years) => {
120
120
  //#endregion
121
121
  export { getVersionInformationFromGit as a, getWorkspaceBannerText as i, parseVersionFromNumericVersion as n, parseVersionFromString as r, getVersionFileHandler as t };
122
122
 
123
- //# sourceMappingURL=versionFile-DViDwgCa.js.map
123
+ //# sourceMappingURL=versionFile-K8Qq2b1u.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"versionFile-DViDwgCa.js","names":[],"sources":["../src/lib/git.ts","../src/lib/banner.ts","../src/lib/parseVersion.ts","../src/lib/versionFile.ts"],"sourcesContent":["import simpleGit from \"simple-git\";\nimport * as path from \"node:path\";\n\nimport type { WorkspaceLocation } from \"./workspace\";\nimport type { PackageLocation } from \"./package\";\n\nexport const getVersionInformationFromGit = async (\n\tworkspaceLocation: WorkspaceLocation,\n\tpackageLocation: PackageLocation,\n) => {\n\ttry {\n\t\tconst git = simpleGit({\n\t\t\tbaseDir: workspaceLocation.path,\n\t\t});\n\n\t\t// check wether the files for a folder are changed\n\t\t// if so, mark as dirty\n\t\tconst diff = await git.diffSummary();\n\n\t\tconst dirty = diff.files.some((file) => {\n\t\t\tif (\n\t\t\t\tfile.file.toLowerCase().includes(\"releases\") ||\n\t\t\t\tfile.file.toLowerCase().endsWith(\"version.ts\") ||\n\t\t\t\tfile.file.toLowerCase().endsWith(\"package.json\")\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst fullPath = path.resolve(workspaceLocation.path, file.file);\n\t\t\tconst relativePath = path.relative(packageLocation.path, fullPath);\n\n\t\t\treturn !relativePath.startsWith(\"..\");\n\t\t});\n\n\t\tconst log = await git.log({ maxCount: 1 });\n\t\tconst commit = !log.latest?.hash\n\t\t\t? undefined\n\t\t\t: log.latest.hash.substring(0, 7);\n\n\t\treturn {\n\t\t\tcommit,\n\t\t\tdirty,\n\t\t\tcommitDate: log.latest?.date,\n\t\t};\n\t} catch (err) {\n\t\treturn {};\n\t}\n};\n","import type{ WorkspacePackageJSON } from \"./workspace\";\n\nexport const getWorkspaceBannerText = (manifest: WorkspacePackageJSON) => {\n\tlet bannerText = manifest?.packager?.banner;\n\n\tif (bannerText) {\n\t\tconst match = bannerText.match(/Copyright \\(C\\) (\\d+)( ?- ?(\\d+))?/);\n\n\t\tif (match !== null) {\n\t\t\tconst startYear = parseInt(match[1]);\n\t\t\tconst endYear = new Date().getFullYear();\n\n\t\t\tif (startYear !== endYear) {\n\t\t\t\tbannerText = bannerText.replace(\n\t\t\t\t\tmatch[0],\n\t\t\t\t\t`Copyright (C) ${startYear} - ${endYear}`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbannerText = bannerText.replace(\n\t\t\t\t\tmatch[0],\n\t\t\t\t\t`Copyright (C) ${startYear}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn bannerText;\n};\n","import { PackageVersion } from \"./packageVersion\";\n\nexport const parseVersionFromString = (input: string) => {\n\tif (input === undefined) {\n\t\tthrow new Error(`Can not parse version from undefined`);\n\t}\n\n\tlet match: RegExpMatchArray | null;\n\n\tlet major!: string;\n\tlet minor!: string;\n\tlet patch!: string;\n\tlet build: string | undefined;\n\tlet preReleaseType: string | undefined;\n\tlet preReleaseNumber: string | undefined;\n\n\tif (\n\t\t// first try to find a full match with build number\n\t\t(match = input.match(\n\t\t\t/(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)(-([^\\.]+)\\.(\\d+))?/,\n\t\t)) !== null\n\t) {\n\t\t[, major, minor, patch, build, preReleaseType, preReleaseNumber] =\n\t\t\tmatch;\n\t} else if (\n\t\t(match = input.match(/(\\d+)\\.(\\d+)\\.(\\d+)(-([^\\.]+)\\.(\\d+))?/)) !== null\n\t) {\n\t\t[, major, minor, patch, , preReleaseType, preReleaseNumber] = match;\n\t}\n\n\tif (match === null) {\n\t\tthrow new Error(`Could not parse version from input: ${input}`);\n\t}\n\n\tlet preRelease: PackageVersion[\"preRelease\"] = undefined;\n\tlet buildNumber = 100;\n\n\tif (preReleaseType && preReleaseNumber) {\n\t\tpreRelease = {\n\t\t\ttype: preReleaseType,\n\t\t\tversion: parseInt(preReleaseNumber),\n\t\t};\n\t}\n\n\tif (build) {\n\t\tbuildNumber = Number(build);\n\t} else if (input) {\n\t\tconst descriptionMatch = input.match(/(\\d+)\\)$/);\n\n\t\tif (descriptionMatch) {\n\t\t\tbuildNumber = parseInt(descriptionMatch[1]);\n\t\t}\n\t}\n\n\treturn new PackageVersion(\n\t\tparseInt(major),\n\t\tparseInt(minor),\n\t\tparseInt(patch),\n\t\tpreRelease,\n\t\tbuildNumber,\n\t);\n};\n\n// 1000001001 -> 1.0.1.1\n// 1002017001 -> 1.2.17.1\nexport const parseVersionFromNumericVersion = (\n\tversion: number,\n): PackageVersion => {\n\tconst major = Math.floor(version / 1000000000);\n\tconst minor = Math.floor((version % 1000000000) / 1000000);\n\tconst patch = Math.floor((version % 1000000) / 1000);\n\tconst buildNumber = version % 1000;\n\n\treturn new PackageVersion(major, minor, patch, undefined, buildNumber);\n};\n","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nimport { isErrorENOENT } from \"./error\";\nimport { readStringFromFileOrUndefined } from \"./fs\";\nimport type { PackageLocation } from \"./package\";\nimport { PackageVersion } from \"./packageVersion\";\n\n// https://regex101.com/r/LtGAu5/1\nconst logRegex =\n\t/console\\.log\\(\\s*\"([\\w\\s\\.\\(\\)]+)\\ *Copyright[\\w\\s\\(\\)\\.]+(\\d{4}|\\d{4} - \\d{4})([\\w\\s\\(\\)\\.]+)?\",?\\s*\\)/i;\nconst currentYear = new Date(Date.now()).getFullYear();\n\nexport function getVersionFileHandler(location: PackageLocation) {\n\tconst filePath = path.join(location.scriptsDir, \"Version.ts\");\n\n\tfunction invalidVersionFile(\n\t\tversionFile: string | undefined,\n\t\texists: boolean,\n\t) {\n\t\treturn {\n\t\t\texists,\n\t\t\twrite: (name: string, newVersion: PackageVersion) => {\n\t\t\t\tconst scriptsContent = fs.readdirSync(location.scriptsDir);\n\t\t\t\tconst tsFiles = scriptsContent.filter((file) =>\n\t\t\t\t\tfile.endsWith(\".ts\"),\n\t\t\t\t);\n\n\t\t\t\tif (tsFiles.length > 0) {\n\t\t\t\t\treturn createVersionFileWriter([currentYear], \"\")(\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tnewVersion,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\treset: () => {\n\t\t\t\tif (versionFile !== undefined) {\n\t\t\t\t\tfs.writeFileSync(filePath, versionFile, {\n\t\t\t\t\t\tencoding: \"utf8\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfs.rmSync(filePath);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tif (!isErrorENOENT(err)) {\n\t\t\t\t\t\t\tthrow 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\t}\n\n\ttype CopyrightRange = [number, number?];\n\n\tfunction createVersionFileWriter(\n\t\tcopyright: CopyrightRange = [currentYear],\n\t\tcopyrightStuff: string = \"\",\n\t) {\n\t\treturn (name: string, newVersion: PackageVersion) => {\n\t\t\tconst descriptionText = newVersion.toDescriptionString(name);\n\t\t\tconst copyrightText = createYearString(copyright);\n\n\t\t\tconst result = `console.log(\"${descriptionText}. Copyright (C) ${copyrightText}${copyrightStuff}\");`;\n\n\t\t\tfs.writeFileSync(filePath, result, { encoding: \"utf-8\" });\n\t\t};\n\t}\n\n\tlet rawVersionFile = readStringFromFileOrUndefined(filePath);\n\n\tif (rawVersionFile === undefined) {\n\t\treturn invalidVersionFile(rawVersionFile, false);\n\t}\n\n\tconst versionFile = rawVersionFile.replace(/\\n/g, \"\");\n\n\tconst match = versionFile.match(logRegex);\n\n\tif (!match) {\n\t\treturn invalidVersionFile(versionFile, true);\n\t}\n\n\tconst [_full, _description, copyright, copyrightStuff] = match as [\n\t\tstring,\n\t\tstring,\n\t\tstring,\n\t\tstring?,\n\t];\n\n\tconst copyrightYears = copyright.match(/^(\\d+)( ?- ?(\\d+))?$/);\n\n\tlet years: [number, number?];\n\n\tif (copyrightYears === null) {\n\t\tyears = [currentYear];\n\t} else {\n\t\tyears = [Number(copyrightYears[1]), currentYear];\n\t}\n\n\treturn {\n\t\texists: true,\n\t\twrite: createVersionFileWriter(years, copyrightStuff),\n\t\treset: () => {\n\t\t\tfs.writeFileSync(filePath, versionFile, { encoding: \"utf8\" });\n\t\t},\n\t};\n}\n\nconst createYearString = (years: [number, number?]) => {\n\tif (years[1] === undefined || years[0] === years[1]) {\n\t\treturn years[0].toString();\n\t}\n\n\treturn `${years[0]} - ${years[1]}`;\n};\n"],"mappings":";;;;;;AAMA,MAAa,+BAA+B,OAC3C,mBACA,oBACI;AACJ,KAAI;EACH,MAAM,MAAM,UAAU,EACrB,SAAS,kBAAkB,MAC3B,CAAC;EAMF,MAAM,SAFO,MAAM,IAAI,aAAa,EAEjB,MAAM,MAAM,SAAS;AACvC,OACC,KAAK,KAAK,aAAa,CAAC,SAAS,WAAW,IAC5C,KAAK,KAAK,aAAa,CAAC,SAAS,aAAa,IAC9C,KAAK,KAAK,aAAa,CAAC,SAAS,eAAe,CAEhD,QAAO;GAGR,MAAM,WAAW,KAAK,QAAQ,kBAAkB,MAAM,KAAK,KAAK;AAGhE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ACtB,QAAO,mBAAmB,gBAAgB,MAAM;CAGjD,MAAM,cAAc,eAAe,QAAQ,OAAO,GAAG;CAErD,MAAM,QAAQ,YAAY,MAAM,SAAS;AAEzC,KAAI,CAAC,MACJ,QAAO,mBAAmB,aAAa,KAAK;CAG7C,MAAM,CAAC,OAAO,cAAc,WAAW,kBAAkB;CAOzD,MAAM,iBAAiB,UAAU,MAAM,uBAAuB;CAE9D,IAAI;AAEJ,KAAI,mBAAmB,KACtB,SAAQ,CAAC,YAAY;KAErB,SAAQ,CAAC,OAAO,eAAe,GAAG,EAAE,YAAY;AAGjD,QAAO;EACN,QAAQ;EACR,OAAO,wBAAwB,OAAO,eAAe;EACrD,aAAa;AACZ,MAAG,cAAc,UAAU,aAAa,EAAE,UAAU,QAAQ,CAAC;;EAE9D;;AAGF,MAAM,oBAAoB,UAA6B;AACtD,KAAI,MAAM,OAAO,KAAA,KAAa,MAAM,OAAO,MAAM,GAChD,QAAO,MAAM,GAAG,UAAU;AAG3B,QAAO,GAAG,MAAM,GAAG,KAAK,MAAM"}
1
+ {"version":3,"file":"versionFile-K8Qq2b1u.js","names":[],"sources":["../src/lib/git.ts","../src/lib/banner.ts","../src/lib/parseVersion.ts","../src/lib/versionFile.ts"],"sourcesContent":["import simpleGit from \"simple-git\";\nimport * as path from \"node:path\";\n\nimport type { WorkspaceLocation } from \"./workspace\";\nimport type { PackageLocation } from \"./package\";\n\nexport const getVersionInformationFromGit = async (\n\tworkspaceLocation: WorkspaceLocation,\n\tpackageLocation: PackageLocation,\n) => {\n\ttry {\n\t\tconst git = simpleGit({\n\t\t\tbaseDir: workspaceLocation.path,\n\t\t});\n\n\t\t// check wether the files for a folder are changed\n\t\t// if so, mark as dirty\n\t\tconst diff = await git.diffSummary();\n\n\t\tconst dirty = diff.files.some((file) => {\n\t\t\tif (\n\t\t\t\tfile.file.toLowerCase().includes(\"releases\") ||\n\t\t\t\tfile.file.toLowerCase().endsWith(\"version.ts\") ||\n\t\t\t\tfile.file.toLowerCase().endsWith(\"package.json\")\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst fullPath = path.resolve(workspaceLocation.path, file.file);\n\t\t\tconst relativePath = path.relative(packageLocation.path, fullPath);\n\n\t\t\treturn !relativePath.startsWith(\"..\");\n\t\t});\n\n\t\tconst log = await git.log({ maxCount: 1 });\n\t\tconst commit = !log.latest?.hash\n\t\t\t? undefined\n\t\t\t: log.latest.hash.substring(0, 7);\n\n\t\treturn {\n\t\t\tcommit,\n\t\t\tdirty,\n\t\t\tcommitDate: log.latest?.date,\n\t\t};\n\t} catch (err) {\n\t\treturn {};\n\t}\n};\n","import type{ WorkspacePackageJSON } from \"./workspace\";\n\nexport const getWorkspaceBannerText = (manifest: WorkspacePackageJSON) => {\n\tlet bannerText = manifest?.packager?.banner;\n\n\tif (bannerText) {\n\t\tconst match = bannerText.match(/Copyright \\(C\\) (\\d+)( ?- ?(\\d+))?/);\n\n\t\tif (match !== null) {\n\t\t\tconst startYear = parseInt(match[1]);\n\t\t\tconst endYear = new Date().getFullYear();\n\n\t\t\tif (startYear !== endYear) {\n\t\t\t\tbannerText = bannerText.replace(\n\t\t\t\t\tmatch[0],\n\t\t\t\t\t`Copyright (C) ${startYear} - ${endYear}`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbannerText = bannerText.replace(\n\t\t\t\t\tmatch[0],\n\t\t\t\t\t`Copyright (C) ${startYear}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn bannerText;\n};\n","import { PackageVersion } from \"./packageVersion\";\n\nexport const parseVersionFromString = (input: string) => {\n\tif (input === undefined) {\n\t\tthrow new Error(`Can not parse version from undefined`);\n\t}\n\n\tlet match: RegExpMatchArray | null;\n\n\tlet major!: string;\n\tlet minor!: string;\n\tlet patch!: string;\n\tlet build: string | undefined;\n\tlet preReleaseType: string | undefined;\n\tlet preReleaseNumber: string | undefined;\n\n\tif (\n\t\t// first try to find a full match with build number\n\t\t(match = input.match(\n\t\t\t/(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)(-([^\\.]+)\\.(\\d+))?/,\n\t\t)) !== null\n\t) {\n\t\t[, major, minor, patch, build, preReleaseType, preReleaseNumber] =\n\t\t\tmatch;\n\t} else if (\n\t\t(match = input.match(/(\\d+)\\.(\\d+)\\.(\\d+)(-([^\\.]+)\\.(\\d+))?/)) !== null\n\t) {\n\t\t[, major, minor, patch, , preReleaseType, preReleaseNumber] = match;\n\t}\n\n\tif (match === null) {\n\t\tthrow new Error(`Could not parse version from input: ${input}`);\n\t}\n\n\tlet preRelease: PackageVersion[\"preRelease\"] = undefined;\n\tlet buildNumber = 100;\n\n\tif (preReleaseType && preReleaseNumber) {\n\t\tpreRelease = {\n\t\t\ttype: preReleaseType,\n\t\t\tversion: parseInt(preReleaseNumber),\n\t\t};\n\t}\n\n\tif (build) {\n\t\tbuildNumber = Number(build);\n\t} else if (input) {\n\t\tconst descriptionMatch = input.match(/(\\d+)\\)$/);\n\n\t\tif (descriptionMatch) {\n\t\t\tbuildNumber = parseInt(descriptionMatch[1]);\n\t\t}\n\t}\n\n\treturn new PackageVersion(\n\t\tparseInt(major),\n\t\tparseInt(minor),\n\t\tparseInt(patch),\n\t\tpreRelease,\n\t\tbuildNumber,\n\t);\n};\n\n// 1000001001 -> 1.0.1.1\n// 1002017001 -> 1.2.17.1\nexport const parseVersionFromNumericVersion = (\n\tversion: number,\n): PackageVersion => {\n\tconst major = Math.floor(version / 1000000000);\n\tconst minor = Math.floor((version % 1000000000) / 1000000);\n\tconst patch = Math.floor((version % 1000000) / 1000);\n\tconst buildNumber = version % 1000;\n\n\treturn new PackageVersion(major, minor, patch, undefined, buildNumber);\n};\n","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nimport { isErrorENOENT } from \"./error\";\nimport { readStringFromFileOrUndefined } from \"./fs\";\nimport type { PackageLocation } from \"./package\";\nimport { PackageVersion } from \"./packageVersion\";\n\n// https://regex101.com/r/LtGAu5/1\nconst logRegex =\n\t/console\\.log\\(\\s*\"([\\w\\s\\.\\(\\)]+)\\ *Copyright[\\w\\s\\(\\)\\.]+(\\d{4}|\\d{4} - \\d{4})([\\w\\s\\(\\)\\.]+)?\",?\\s*\\)/i;\nconst currentYear = new Date(Date.now()).getFullYear();\n\nexport function getVersionFileHandler(location: PackageLocation) {\n\tconst filePath = path.join(location.scriptsDir, \"Version.ts\");\n\n\tfunction invalidVersionFile(\n\t\tversionFile: string | undefined,\n\t\texists: boolean,\n\t) {\n\t\treturn {\n\t\t\texists,\n\t\t\twrite: (name: string, newVersion: PackageVersion) => {\n\t\t\t\tconst scriptsContent = fs.readdirSync(location.scriptsDir);\n\t\t\t\tconst tsFiles = scriptsContent.filter((file) =>\n\t\t\t\t\tfile.endsWith(\".ts\"),\n\t\t\t\t);\n\n\t\t\t\tif (tsFiles.length > 0) {\n\t\t\t\t\treturn createVersionFileWriter([currentYear], \"\")(\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tnewVersion,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\treset: () => {\n\t\t\t\tif (versionFile !== undefined) {\n\t\t\t\t\tfs.writeFileSync(filePath, versionFile, {\n\t\t\t\t\t\tencoding: \"utf8\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfs.rmSync(filePath);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tif (!isErrorENOENT(err)) {\n\t\t\t\t\t\t\tthrow 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\t}\n\n\ttype CopyrightRange = [number, number?];\n\n\tfunction createVersionFileWriter(\n\t\tcopyright: CopyrightRange = [currentYear],\n\t\tcopyrightStuff: string = \"\",\n\t) {\n\t\treturn (name: string, newVersion: PackageVersion) => {\n\t\t\tconst descriptionText = newVersion.toDescriptionString(name);\n\t\t\tconst copyrightText = createYearString(copyright);\n\n\t\t\tconst result = `console.log(\"${descriptionText}. Copyright (C) ${copyrightText}${copyrightStuff}\");`;\n\n\t\t\tfs.writeFileSync(filePath, result, { encoding: \"utf-8\" });\n\t\t};\n\t}\n\n\tlet rawVersionFile = readStringFromFileOrUndefined(filePath);\n\n\tif (rawVersionFile === undefined) {\n\t\treturn invalidVersionFile(rawVersionFile, false);\n\t}\n\n\tconst versionFile = rawVersionFile.replace(/\\n/g, \"\");\n\n\tconst match = versionFile.match(logRegex);\n\n\tif (!match) {\n\t\treturn invalidVersionFile(versionFile, true);\n\t}\n\n\tconst [_full, _description, copyright, copyrightStuff] = match as [\n\t\tstring,\n\t\tstring,\n\t\tstring,\n\t\tstring?,\n\t];\n\n\tconst copyrightYears = copyright.match(/^(\\d+)( ?- ?(\\d+))?$/);\n\n\tlet years: [number, number?];\n\n\tif (copyrightYears === null) {\n\t\tyears = [currentYear];\n\t} else {\n\t\tyears = [Number(copyrightYears[1]), currentYear];\n\t}\n\n\treturn {\n\t\texists: true,\n\t\twrite: createVersionFileWriter(years, copyrightStuff),\n\t\treset: () => {\n\t\t\tfs.writeFileSync(filePath, versionFile, { encoding: \"utf8\" });\n\t\t},\n\t};\n}\n\nconst createYearString = (years: [number, number?]) => {\n\tif (years[1] === undefined || years[0] === years[1]) {\n\t\treturn years[0].toString();\n\t}\n\n\treturn `${years[0]} - ${years[1]}`;\n};\n"],"mappings":";;;;;;AAMA,MAAa,+BAA+B,OAC3C,mBACA,oBACI;CACJ,IAAI;EACH,MAAM,MAAM,UAAU,EACrB,SAAS,kBAAkB,KAC5B,CAAC;EAMD,MAAM,SAAQ,MAFK,IAAI,YAAY,GAEhB,MAAM,MAAM,SAAS;GACvC,IACC,KAAK,KAAK,YAAY,EAAE,SAAS,UAAU,KAC3C,KAAK,KAAK,YAAY,EAAE,SAAS,YAAY,KAC7C,KAAK,KAAK,YAAY,EAAE,SAAS,cAAc,GAE/C,OAAO;GAGR,MAAM,WAAW,KAAK,QAAQ,kBAAkB,MAAM,KAA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E,UAAU,QAAQ,CAAC;EACzD;CACD;CAEA,IAAI,iBAAiB,8BAA8B,QAAQ;CAE3D,IAAI,mBAAmB,KAAA,GACtB,OAAO,mBAAmB,gBAAgB,KAAK;CAGhD,MAAM,cAAc,eAAe,QAAQ,OAAO,EAAE;CAEpD,MAAM,QAAQ,YAAY,MAAM,QAAQ;CAExC,IAAI,CAAC,OACJ,OAAO,mBAAmB,aAAa,IAAI;CAG5C,MAAM,CAAC,OAAO,cAAc,WAAW,kBAAkB;CAOzD,MAAM,iBAAiB,UAAU,MAAM,sBAAsB;CAE7D,IAAI;CAEJ,IAAI,mBAAmB,MACtB,QAAQ,CAAC,WAAW;MAEpB,QAAQ,CAAC,OAAO,eAAe,EAAE,GAAG,WAAW;CAGhD,OAAO;EACN,QAAQ;EACR,OAAO,wBAAwB,OAAO,cAAc;EACpD,aAAa;GACZ,GAAG,cAAc,UAAU,aAAa,EAAE,UAAU,OAAO,CAAC;EAC7D;CACD;AACD;AAEA,MAAM,oBAAoB,UAA6B;CACtD,IAAI,MAAM,OAAO,KAAA,KAAa,MAAM,OAAO,MAAM,IAChD,OAAO,MAAM,GAAG,SAAS;CAG1B,OAAO,GAAG,MAAM,GAAG,KAAK,MAAM;AAC/B"}
@@ -0,0 +1,2 @@
1
+ import "./build-C3qEWyu4.js";
2
+ export {};
package/lib/lib.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as writePackageCreatorIndex, D as isErrorEPERM, E as isErrorENOENT, S as readPackageNpmManifest, T as isErrorEACCES, _ as getPackageReleasesDirectory, a as getPackageTypescriptFiles, b as readPackageCreatorIndex, c as readStringFromFileOrUndefined, d as readWorkspaceNpmManifest, f as readPublishedPackageCreatorIndex, g as PACKAGE_FILE, h as INDEX_FILE, i as assetService_exports, l as determineWorkspaceIGLibraries, m as readPublishedPackageNpmManifest, n as readScriptPackageTSConfig, o as consoleReporter, p as readPublishedPackageCreatorManifest, r as resolveScriptPackageEntryModule, s as createPackageScopedReporter, t as isScriptPackageModules, u as getWorkspaceOutputPath, v as parseCreatorPackageName, w as writePackageCreatorManifest, x as readPackageCreatorManifest, y as readPackageAnimationList } from "./scripts-B1CadgeN.js";
1
+ import { C as writePackageCreatorIndex, D as isErrorEPERM, E as isErrorENOENT, S as readPackageNpmManifest, T as isErrorEACCES, _ as getPackageReleasesDirectory, a as getPackageTypescriptFiles, b as readPackageCreatorIndex, c as readStringFromFileOrUndefined, d as readWorkspaceNpmManifest, f as readPublishedPackageCreatorIndex, g as PACKAGE_FILE, h as INDEX_FILE, i as assetService_exports, l as determineWorkspaceIGLibraries, m as readPublishedPackageNpmManifest, n as readScriptPackageTSConfig, o as consoleReporter, p as readPublishedPackageCreatorManifest, r as resolveScriptPackageEntryModule, s as createPackageScopedReporter, t as isScriptPackageModules, u as getWorkspaceOutputPath, v as parseCreatorPackageName, w as writePackageCreatorManifest, x as readPackageCreatorManifest, y as readPackageAnimationList } from "./scripts-BwwJ-rYO.js";
2
2
  import * as path from "node:path";
3
3
  import * as fs from "fs/promises";
4
4
  import * as terser from "terser";
@@ -6,6 +6,8 @@ import { EOL } from "node:os";
6
6
  import ts from "typescript";
7
7
  import * as fs$1 from "node:fs";
8
8
  import { createReadStream, createWriteStream } from "node:fs";
9
+ import { transformSync } from "@babel/core";
10
+ import babelPresetEnv from "@babel/preset-env";
9
11
  import EventEmitter from "events";
10
12
  import { SourceMapConsumer, SourceMapGenerator } from "source-map-js";
11
13
  import Ajv from "ajv";
@@ -33,7 +35,7 @@ const createTSCBuildParticipant = (location, outputDir, skipDeclarations) => (en
33
35
  try {
34
36
  env.onBuildStart();
35
37
  env.log("Compiling typescript files");
36
- const compilerOptions = getCompilerOptions(location, outputDir, skipDeclarations);
38
+ const { compilerOptions, useBabel } = getCompilerOptions(location, outputDir, skipDeclarations);
37
39
  const host = ts.createCompilerHost(compilerOptions);
38
40
  host.getCurrentDirectory = () => location.scriptsDir;
39
41
  let js;
@@ -55,12 +57,17 @@ const createTSCBuildParticipant = (location, outputDir, skipDeclarations) => (en
55
57
  if (!emitResult.emitSkipped) {
56
58
  if (allDiagnostics.length > 0) console.log(ts.formatDiagnostics(allDiagnostics, host));
57
59
  if (js === void 0 || definitions === void 0) throw new Error(`Unexpected: no js or definitions were created`);
60
+ const jsStripped = js.replace(`//# sourceMappingURL=out.js.map`, "");
61
+ const babelResult = useBabel ? applyBabelTransform(jsStripped, sourceMap) : {
62
+ js: jsStripped,
63
+ sourceMap
64
+ };
58
65
  env.onBuildEnd({
59
66
  type: "success",
60
67
  artefacts: {
61
- js: js.replace(`//# sourceMappingURL=out.js.map`, ""),
68
+ js: babelResult.js,
62
69
  declarations: getDeclarationFileReferences(location, program, outputDir) + definitions,
63
- sourceMap
70
+ sourceMap: babelResult.sourceMap
64
71
  }
65
72
  });
66
73
  } else {
@@ -77,6 +84,7 @@ const createTSCBuildParticipant = (location, outputDir, skipDeclarations) => (en
77
84
  };
78
85
  const createTSCWatchBuildParticipant = (location, outputDir, skipDeclarations) => {
79
86
  return ({ onBuildStart, onBuildEnd }) => {
87
+ const { compilerOptions, useBabel } = getCompilerOptions(location, outputDir, skipDeclarations);
80
88
  let state = {
81
89
  diagnostics: [],
82
90
  js: void 0,
@@ -130,18 +138,23 @@ const createTSCWatchBuildParticipant = (location, outputDir, skipDeclarations) =
130
138
  return;
131
139
  }
132
140
  if (!currentProgram) throw new Error(`Expected a program to exist`);
141
+ const jsStripped = emitState.js.replace(`//# sourceMappingURL=out.js.map`, "");
142
+ const babelResult = useBabel ? applyBabelTransform(jsStripped, emitState.sourceMap) : {
143
+ js: jsStripped,
144
+ sourceMap: emitState.sourceMap
145
+ };
133
146
  onBuildEnd({
134
147
  type: "success",
135
148
  artefacts: {
136
- js: emitState.js.replace(`//# sourceMappingURL=out.js.map`, ""),
149
+ js: babelResult.js,
137
150
  declarations: emitState.definitions ? getDeclarationFileReferences(location, currentProgram, outputDir) + emitState.definitions : void 0,
138
- sourceMap: emitState.sourceMap
151
+ sourceMap: babelResult.sourceMap
139
152
  }
140
153
  });
141
154
  break;
142
155
  }
143
156
  };
144
- const host = ts.createWatchCompilerHost(path.join(location.scriptsDir, "tsconfig.json"), getCompilerOptions(location, outputDir, skipDeclarations), customSys, ts.createSemanticDiagnosticsBuilderProgram, registerDiagnostic, reportWatchStatusChanged);
157
+ const host = ts.createWatchCompilerHost(path.join(location.scriptsDir, "tsconfig.json"), compilerOptions, customSys, ts.createSemanticDiagnosticsBuilderProgram, registerDiagnostic, reportWatchStatusChanged);
145
158
  const originalAfterProgramCreate = host.afterProgramCreate;
146
159
  host.afterProgramCreate = (program) => {
147
160
  currentProgram = program;
@@ -160,18 +173,44 @@ const createTSCWatchBuildParticipant = (location, outputDir, skipDeclarations) =
160
173
  };
161
174
  const getCompilerOptions = (location, outputDir, skipDeclarations) => {
162
175
  const config = tryReadTsConfig(location);
176
+ const rawTarget = config?.compilerOptions?.target;
177
+ const useBabel = !rawTarget || String(rawTarget).toLowerCase() !== "es5";
163
178
  config.compilerOptions.lib = ["es2018", "dom"];
164
179
  return {
165
- ...ts.convertCompilerOptionsFromJson(config.compilerOptions, location.scriptsDir).options,
166
- removeComments: false,
167
- declaration: !skipDeclarations,
168
- sourceMap: true,
169
- inlineSources: false,
170
- outFile: path.join(outputDir, "out.js"),
171
- target: ts.ScriptTarget.ES5,
172
- noEmitOnError: true
180
+ compilerOptions: {
181
+ ...ts.convertCompilerOptionsFromJson(config.compilerOptions, location.scriptsDir).options,
182
+ removeComments: false,
183
+ declaration: !skipDeclarations,
184
+ sourceMap: true,
185
+ inlineSources: false,
186
+ outFile: path.join(outputDir, "out.js"),
187
+ target: useBabel ? ts.ScriptTarget.ESNext : ts.ScriptTarget.ES5,
188
+ noEmitOnError: true
189
+ },
190
+ useBabel
173
191
  };
174
192
  };
193
+ function applyBabelTransform(js, sourceMap) {
194
+ const result = transformSync(js, {
195
+ presets: [[babelPresetEnv, {
196
+ targets: ["defaults", "not IE 11"],
197
+ include: [
198
+ "transform-classes",
199
+ "transform-class-properties",
200
+ "transform-private-methods",
201
+ "transform-class-static-block"
202
+ ]
203
+ }]],
204
+ sourceMaps: sourceMap !== void 0,
205
+ inputSourceMap: sourceMap !== void 0 ? JSON.parse(sourceMap) : void 0,
206
+ configFile: false,
207
+ babelrc: false
208
+ });
209
+ return {
210
+ js: result?.code ?? js,
211
+ sourceMap: result?.map ? JSON.stringify(result.map) : sourceMap
212
+ };
213
+ }
175
214
  function getDeclarationFileReferences(location, program, outputDir) {
176
215
  const references = /* @__PURE__ */ new Set();
177
216
  for (const file of program.getSourceFiles()) for (const reference of file.referencedFiles) {
@@ -208,6 +247,9 @@ const toposort = (packages) => {
208
247
  //#endregion
209
248
  //#region src/commands/build/manager.ts
210
249
  var BuildManager = class extends EventEmitter {
250
+ manifest;
251
+ writer;
252
+ reporter;
211
253
  participants = /* @__PURE__ */ new Map();
212
254
  states = /* @__PURE__ */ new Map();
213
255
  participantInstances = [];
@@ -556,6 +598,11 @@ const getAnimationJsonValidation = async () => {
556
598
  //#endregion
557
599
  //#region src/lib/packageVersion.ts
558
600
  var PackageVersion = class PackageVersion {
601
+ major;
602
+ minor;
603
+ patch;
604
+ preRelease;
605
+ buildNumber;
559
606
  static fullTextMatcher = /(\d+)(\.(\d+)(\.(\d+)(\.(\d+))?(-([^\.]+)\.(\d+))?)?)?/;
560
607
  static lineMatcher = /^(\d+)(\.(\d+)(\.(\d+)(\.(\d+))?(-([^\.]+)\.(\d+))?)?)?$/;
561
608
  static extractFromText(input, description) {
@@ -714,7 +761,7 @@ async function buildFolders(options) {
714
761
  const typescriptFiles = getPackageTypescriptFiles(location);
715
762
  if (!typescriptFiles.some((file) => path.basename(file).toLowerCase() === "version.ts")) manager.addParticipant("version", createVersionLogBuildParticipant(data));
716
763
  if (typescriptFiles.length > 0) if (isScriptPackageModules(tsConfig.options)) {
717
- const { createRollupBuildParticipant } = await import("./rollup-DZ2wdbmd.js");
764
+ const { createRollupBuildParticipant } = await import("./rollup-CC5tZS5U.js");
718
765
  manager.addParticipant("rollup", createRollupBuildParticipant(location, data, outputDirectory, !tsConfig.options.declaration));
719
766
  } else manager.addParticipant("tsc", createTSCBuildParticipant(location, outputDirectory, tsConfig.options.declaration === false));
720
767
  manager.addParticipant("animation", createAnimationBuildParticipant(location, data));
@@ -762,7 +809,7 @@ async function buildFoldersWatch(options) {
762
809
  const typescriptFiles = getPackageTypescriptFiles(location);
763
810
  if (!typescriptFiles.some((file) => path.basename(file).toLowerCase() === "version.ts")) manager.addParticipant("version", createVersionLogBuildParticipant(data));
764
811
  if (typescriptFiles.length > 0) if (isScriptPackageModules(tsConfig.options)) {
765
- const { createRollupWatchBuildParticipant } = await import("./rollup-DZ2wdbmd.js");
812
+ const { createRollupWatchBuildParticipant } = await import("./rollup-CC5tZS5U.js");
766
813
  manager.addParticipant("rollup", createRollupWatchBuildParticipant(location, data, outputDirectory, !tsConfig.options.declaration));
767
814
  } else manager.addParticipant("tsc", createTSCWatchBuildParticipant(location, outputDirectory, tsConfig.options.declaration === false));
768
815
  manager.addParticipant("animation", createAnimationWatchBuildParticipant(location, data));
@@ -864,16 +911,17 @@ function applyTsConfigOptions(data) {
864
911
  target: "esnext",
865
912
  lib: ["es2024", "dom"],
866
913
  module: "es2015",
867
- moduleResolution: "node"
868
- };
869
- else expectedValues = {
870
- target: "es5",
871
- lib: ["es2018", "dom"]
914
+ moduleResolution: "bundler"
872
915
  };
916
+ else expectedValues = { lib: ["es2018", "dom"] };
873
917
  data.compilerOptions = data.compilerOptions ?? {};
874
918
  data.compilerOptions.strict ??= false;
875
919
  const writeToOptions = data.compilerOptions;
876
920
  let changed = false;
921
+ if (writeToOptions.target === void 0) {
922
+ writeToOptions.target = "es5";
923
+ changed = true;
924
+ }
877
925
  for (const [key, value] of Object.entries(expectedValues)) {
878
926
  const currentValue = writeToOptions[key];
879
927
  switch (typeof value) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@intelligentgraphics/ig.gfx.packager",
3
- "version": "3.2.0",
4
- "description": "IG.GFX.Packager 3.2.0 (3.2.0.100)",
3
+ "version": "3.3.0",
4
+ "description": "IG.GFX.Packager 3.3.0 (3.3.0.100)",
5
5
  "author": "Michael Beier <mb@intelligentgraphics.biz>",
6
6
  "main": "lib/lib.js",
7
7
  "types": "lib/lib.d.ts",
@@ -30,6 +30,7 @@
30
30
  "format": "prettier --write \"**/*.{ts,tsx,json}\""
31
31
  },
32
32
  "dependencies": {
33
+ "@babel/core": "^7.29.0",
33
34
  "@babel/preset-env": "^7.29.2",
34
35
  "@inquirer/prompts": "^8.4.2",
35
36
  "@intelligentgraphics/declarationbundler": "^0.4.5",
@@ -59,13 +60,14 @@
59
60
  },
60
61
  "devDependencies": {
61
62
  "@intelligentgraphics/ig.gfx.tools.core": "^1.0.0",
63
+ "@types/babel__core": "^7",
62
64
  "@types/babel__preset-env": "^7",
63
65
  "@types/node": "^25.6.0",
64
66
  "@types/update-notifier": "^6.0.8",
65
67
  "@types/yargs": "^17.0.35",
66
68
  "prettier": "^3.8.3",
67
- "rolldown": "^1.0.0-rc.17",
68
- "rolldown-plugin-dts": "^0.23.2",
69
- "vitest": "^4.1.5"
69
+ "rolldown": "^1.0.3",
70
+ "rolldown-plugin-dts": "^0.25.2",
71
+ "vitest": "^4.1.7"
70
72
  }
71
73
  }
package/readme.md CHANGED
@@ -612,6 +612,13 @@ Afterwards you may need to reload your editor in order for the installed files t
612
612
 
613
613
  ## History
614
614
 
615
+ **IG.GFX.Packager 3.3.0**
616
+
617
+ - switch module resolution to bundler for module bundling
618
+ - support all es5+ tsconfig build targets
619
+
620
+ **IG.GFX.Packager 3.2.1**
621
+
615
622
  **IG.GFX.Packager 3.2.0**
616
623
 
617
624
  - enable ecma features up to es2018