@intelligentgraphics/ig.gfx.packager 3.0.28 → 3.1.0-alpha.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 (34) hide show
  1. package/build/bin.mjs +1 -1
  2. package/build/{cli-RWjcRDQ7.mjs → cli-CuiqZ39_.mjs} +16 -22
  3. package/build/{cli-RWjcRDQ7.mjs.map → cli-CuiqZ39_.mjs.map} +1 -1
  4. package/build/{dependencies-_6rsdwHk.mjs → dependencies-BiYItaVS.mjs} +2 -2
  5. package/build/{dependencies-_6rsdwHk.mjs.map → dependencies-BiYItaVS.mjs.map} +1 -1
  6. package/build/{generateIndex-Dy12utjI.mjs → generateIndex-hg6jRXQv.mjs} +96 -83
  7. package/build/generateIndex-hg6jRXQv.mjs.map +1 -0
  8. package/build/{generateParameterType-DKwRLh1m.mjs → generateParameterType-CDjqLM4J.mjs} +2 -3
  9. package/build/{generateParameterType-DKwRLh1m.mjs.map → generateParameterType-CDjqLM4J.mjs.map} +1 -1
  10. package/build/{index-B9e-vtmM.mjs → index-B2kXo6K7.mjs} +298 -84
  11. package/build/index-B2kXo6K7.mjs.map +1 -0
  12. package/build/{index-CLoWLYI6.mjs → index-BoGrZubW.mjs} +14 -14
  13. package/build/index-BoGrZubW.mjs.map +1 -0
  14. package/build/{postinstall-DlYP6BrQ.mjs → postinstall-CbMUz2zy.mjs} +3 -4
  15. package/build/{postinstall-DlYP6BrQ.mjs.map → postinstall-CbMUz2zy.mjs.map} +1 -1
  16. package/build/{publishNpm-CEhZI6-O.mjs → publishNpm-CrnuTwss.mjs} +11 -10
  17. package/build/publishNpm-CrnuTwss.mjs.map +1 -0
  18. package/build/rollup-UR3DADp8.mjs +198 -0
  19. package/build/rollup-UR3DADp8.mjs.map +1 -0
  20. package/build/scripts-Bfojy_uD.mjs +48 -0
  21. package/build/scripts-Bfojy_uD.mjs.map +1 -0
  22. package/build/versionFile-DSqOw-XB.mjs +208 -0
  23. package/build/versionFile-DSqOw-XB.mjs.map +1 -0
  24. package/lib/lib.mjs +421 -331
  25. package/package.json +13 -8
  26. package/readme.md +87 -10
  27. package/build/generateIndex-Dy12utjI.mjs.map +0 -1
  28. package/build/index-B9e-vtmM.mjs.map +0 -1
  29. package/build/index-CLoWLYI6.mjs.map +0 -1
  30. package/build/publishNpm-CEhZI6-O.mjs.map +0 -1
  31. package/build/scripts-EvIjiH6G.mjs +0 -10
  32. package/build/scripts-EvIjiH6G.mjs.map +0 -1
  33. package/build/versionFile-C7xf8PjZ.mjs +0 -380
  34. package/build/versionFile-C7xf8PjZ.mjs.map +0 -1
@@ -1,21 +1,21 @@
1
1
  import * as path from 'path';
2
2
  import * as fs$1 from 'fs/promises';
3
3
  import * as terser from 'terser';
4
+ import { EOL } from 'os';
5
+ import ts from 'typescript';
4
6
  import * as fs from 'fs';
5
7
  import 'resolve';
6
8
  import 'write-pkg';
7
- import { e as readPackageAnimationList, r as readPackageCreatorManifest, i as isErrorENOENT, q as readPackageNpmManifest } from './cli-RWjcRDQ7.mjs';
8
- import glob from 'glob';
9
+ import { e as readPackageAnimationList, r as readPackageCreatorManifest, q as readPackageNpmManifest, i as isErrorENOENT } from './cli-CuiqZ39_.mjs';
10
+ import { g as getPackageTypescriptFiles, i as isScriptPackageModules } from './scripts-Bfojy_uD.mjs';
9
11
  import 'node:path';
10
12
  import 'node:fs';
11
13
  import 'axios';
12
- import ts from 'typescript';
13
- import { g as getPackageTypescriptFiles } from './scripts-EvIjiH6G.mjs';
14
14
  import typedoc from 'typedoc';
15
+ import glob from 'glob';
15
16
  import require$$2 from 'events';
16
17
  import { SourceMapGenerator, SourceMapConsumer } from 'source-map-js';
17
18
  import Ajv from 'ajv';
18
- import { EOL } from 'os';
19
19
 
20
20
  const consoleReporter = {
21
21
  log (message) {
@@ -51,19 +51,6 @@ const tryReadTsConfig = (location)=>{
51
51
  };
52
52
  const createTSCBuildParticipant = (location, outputDir)=>(env)=>{
53
53
  const files = getPackageTypescriptFiles(location);
54
- if (files.length === 0) {
55
- env.onBuildStart();
56
- env.onBuildEnd({
57
- type: "success",
58
- artefacts: {
59
- js: "",
60
- definitions: ""
61
- }
62
- });
63
- return {
64
- destroy: ()=>{}
65
- };
66
- }
67
54
  try {
68
55
  env.onBuildStart();
69
56
  env.log("Compiling typescript files");
@@ -101,7 +88,7 @@ const createTSCBuildParticipant = (location, outputDir)=>(env)=>{
101
88
  type: "success",
102
89
  artefacts: {
103
90
  js: js.replace(`//# sourceMappingURL=out.js.map`, ""),
104
- definitions,
91
+ declarations: definitions,
105
92
  sourceMap
106
93
  }
107
94
  });
@@ -194,7 +181,7 @@ const createTSCWatchBuildParticipant = (location, outputDir)=>{
194
181
  type: "success",
195
182
  artefacts: {
196
183
  js: emitState.js.replace(`//# sourceMappingURL=out.js.map`, ""),
197
- definitions: emitState.definitions,
184
+ declarations: emitState.definitions,
198
185
  sourceMap: emitState.sourceMap
199
186
  }
200
187
  });
@@ -208,17 +195,6 @@ const createTSCWatchBuildParticipant = (location, outputDir)=>{
208
195
  getNewLine: ()=>ts.sys.newLine
209
196
  };
210
197
  const watchProgram = ts.createWatchProgram(host);
211
- const files = getPackageTypescriptFiles(location);
212
- if (files.length === 0) {
213
- onBuildStart();
214
- onBuildEnd({
215
- type: "success",
216
- artefacts: {
217
- js: "",
218
- definitions: ""
219
- }
220
- });
221
- }
222
198
  return {
223
199
  destroy: ()=>{
224
200
  watchProgram.close();
@@ -304,12 +280,7 @@ const toposort = (packages)=>{
304
280
 
305
281
  class BuildManager extends require$$2 {
306
282
  constructor(manifest, writer, reporter){
307
- super();
308
- this.manifest = manifest;
309
- this.writer = writer;
310
- this.reporter = reporter;
311
- this.participants = new Map();
312
- this.states = new Map();
283
+ super(), this.manifest = manifest, this.writer = writer, this.reporter = reporter, this.participants = new Map(), this.states = new Map();
313
284
  }
314
285
  addParticipant(name, participant) {
315
286
  this.participants.set(name, participant);
@@ -382,14 +353,16 @@ class BuildManager extends require$$2 {
382
353
  line: lines + mapping.generatedLine,
383
354
  column: mapping.generatedColumn
384
355
  },
385
- original: {
356
+ original: mapping.originalLine !== null && mapping.originalColumn !== null ? {
386
357
  line: mapping.originalLine,
387
358
  column: mapping.originalColumn
388
- },
359
+ } : undefined,
389
360
  source: mapping.source,
390
361
  name: mapping.name
391
362
  });
392
- sources.add(mapping.source);
363
+ if (mapping.source !== null) {
364
+ sources.add(mapping.source);
365
+ }
393
366
  });
394
367
  for (const source of sources){
395
368
  const content = sourceMap.sourceContentFor(source);
@@ -400,13 +373,13 @@ class BuildManager extends require$$2 {
400
373
  }
401
374
  completeResult.js += result.artefacts.js;
402
375
  }
403
- if (result.artefacts.definitions) {
404
- if (completeResult.definitions) {
405
- completeResult.definitions += "\n";
376
+ if (result.artefacts.declarations) {
377
+ if (completeResult.declarations) {
378
+ completeResult.declarations += "\n";
406
379
  } else {
407
- completeResult.definitions = "";
380
+ completeResult.declarations = "";
408
381
  }
409
- completeResult.definitions += result.artefacts.definitions;
382
+ completeResult.declarations += result.artefacts.declarations;
410
383
  }
411
384
  }
412
385
  completeResult.sourceMap = sourceMapGenerator.toString();
@@ -749,7 +722,7 @@ const createAnimationBuildParticipant = (location, manifest)=>{
749
722
  env.onBuildEnd({
750
723
  type: "success",
751
724
  artefacts: {
752
- js: (result == null ? void 0 : result.js) ?? ""
725
+ js: result?.js ?? ""
753
726
  }
754
727
  });
755
728
  }).catch((err)=>{
@@ -769,7 +742,7 @@ const createAnimationWatchBuildParticipant = (location, manifest)=>(env)=>{
769
742
  env.onBuildEnd({
770
743
  type: "success",
771
744
  artefacts: {
772
- js: (result == null ? void 0 : result.js) ?? ""
745
+ js: result?.js ?? ""
773
746
  }
774
747
  });
775
748
  }).catch((err)=>{
@@ -780,15 +753,14 @@ const createAnimationWatchBuildParticipant = (location, manifest)=>(env)=>{
780
753
  });
781
754
  (async ()=>{
782
755
  for await (const event of fs$1.watch(location.scriptsDir)){
783
- var _event_filename;
784
- if ((_event_filename = event.filename) == null ? void 0 : _event_filename.endsWith(".animation.json")) {
756
+ if (event.filename?.endsWith(".animation.json")) {
785
757
  env.onBuildStart();
786
758
  try {
787
759
  const result = await bundleAnimations(location, manifest, env.log);
788
760
  env.onBuildEnd({
789
761
  type: "success",
790
762
  artefacts: {
791
- js: (result == null ? void 0 : result.js) ?? ""
763
+ js: result?.js ?? ""
792
764
  }
793
765
  });
794
766
  } catch (err) {
@@ -866,7 +838,187 @@ const getAnimationJsonValidation = async ()=>{
866
838
  return validateAnimationJson;
867
839
  };
868
840
 
869
- const buildFolders = async (options)=>{
841
+ // Stolen from ig.tools.core
842
+ class PackageVersion {
843
+ static{
844
+ // https://regex101.com/r/90PEY9/1
845
+ this.fullTextMatcher = /(\d+)(\.(\d+)(\.(\d+)(\.(\d+))?(-([^\.]+)\.(\d+))?)?)?/;
846
+ }
847
+ static{
848
+ this.lineMatcher = /^(\d+)(\.(\d+)(\.(\d+)(\.(\d+))?(-([^\.]+)\.(\d+))?)?)?$/;
849
+ }
850
+ static extractFromText(input, description) {
851
+ if (input === undefined) {
852
+ throw new Error(`Can not parse version from undefined`);
853
+ }
854
+ const match = input.match(PackageVersion.fullTextMatcher);
855
+ if (!match) {
856
+ throw new Error(`Could not extract a version from input: ${input}`);
857
+ }
858
+ return PackageVersion.fromMatch(match, description);
859
+ }
860
+ static extractFromLine(input, description) {
861
+ if (input === undefined) {
862
+ throw new Error(`Can not parse version from undefined`);
863
+ }
864
+ const match = input.match(PackageVersion.lineMatcher);
865
+ if (!match) {
866
+ throw new Error(`Could not parse version from input: ${input}`);
867
+ }
868
+ return PackageVersion.fromMatch(match, description);
869
+ }
870
+ static equals(a, b, checkPrerelease = false) {
871
+ if (a.major !== b.major || a.minor !== b.minor || a.patch !== b.patch) {
872
+ return false;
873
+ }
874
+ if (checkPrerelease === false) {
875
+ return true;
876
+ }
877
+ if (a.preRelease === b.preRelease) {
878
+ return true;
879
+ }
880
+ if (a.preRelease === undefined || b.preRelease === undefined) {
881
+ return false;
882
+ }
883
+ return a.preRelease.type === b.preRelease.type && a.preRelease.version === b.preRelease.version;
884
+ }
885
+ static fromMatch([, major, , minor = "0", , patch = "0", , build, , preReleaseType, preReleaseNumber], description) {
886
+ let preRelease = undefined;
887
+ let buildNumber = 100;
888
+ if (preReleaseType && preReleaseNumber) {
889
+ preRelease = {
890
+ type: preReleaseType,
891
+ version: parseInt(preReleaseNumber)
892
+ };
893
+ }
894
+ if (build) {
895
+ buildNumber = Number(build);
896
+ } else if (description) {
897
+ const descriptionMatch = description.match(/(\d+)\)$/);
898
+ if (descriptionMatch) {
899
+ buildNumber = parseInt(descriptionMatch[1]);
900
+ }
901
+ }
902
+ return new PackageVersion(parseInt(major), parseInt(minor), parseInt(patch), preRelease, buildNumber);
903
+ }
904
+ static sort(a, b, ascending = true) {
905
+ const createSortResult = (a, b)=>ascending ? a - b : b - a;
906
+ if (a.major !== b.major) {
907
+ return createSortResult(a.major, b.major);
908
+ }
909
+ if (a.minor !== b.minor) {
910
+ return createSortResult(a.minor, b.minor);
911
+ }
912
+ if (a.patch !== b.patch) {
913
+ return createSortResult(a.patch, b.patch);
914
+ }
915
+ return createSortResult(a.preRelease ? a.preRelease.version : 0, b.preRelease ? b.preRelease.version : 0);
916
+ }
917
+ static toNumber(version) {
918
+ return ((version.major * 1000 + version.minor) * 1000 + version.patch) * 1000 + version.buildNumber;
919
+ }
920
+ constructor(major, minor, patch, preRelease, buildNumber){
921
+ this.major = major;
922
+ this.minor = minor;
923
+ this.patch = patch;
924
+ this.preRelease = preRelease;
925
+ this.buildNumber = buildNumber;
926
+ }
927
+ isPreRelease() {
928
+ return this.preRelease !== undefined;
929
+ }
930
+ clone() {
931
+ return new PackageVersion(this.major, this.minor, this.patch, this.preRelease ? {
932
+ ...this.preRelease
933
+ } : undefined, this.buildNumber);
934
+ }
935
+ incrementMajor() {
936
+ this.preRelease = undefined;
937
+ this.patch = 0;
938
+ this.minor = 0;
939
+ this.major++;
940
+ }
941
+ incrementMinor() {
942
+ this.preRelease = undefined;
943
+ this.patch = 0;
944
+ this.minor++;
945
+ }
946
+ incrementPatch() {
947
+ this.preRelease = undefined;
948
+ this.patch++;
949
+ }
950
+ createPreRelease(type) {
951
+ if (!this.preRelease) {
952
+ this.buildNumber = 1;
953
+ } else {
954
+ this.buildNumber++;
955
+ }
956
+ if (this.preRelease && type === this.preRelease.type) {
957
+ this.preRelease.version++;
958
+ return;
959
+ }
960
+ this.preRelease = {
961
+ version: 0,
962
+ type
963
+ };
964
+ }
965
+ createRelease() {
966
+ this.preRelease = undefined;
967
+ this.buildNumber = 100;
968
+ }
969
+ toVersionString({ buildNumber } = {}) {
970
+ let version = [
971
+ this.major,
972
+ this.minor,
973
+ this.patch
974
+ ].join(".");
975
+ if (buildNumber) {
976
+ version += "." + this.buildNumber;
977
+ }
978
+ if (this.preRelease) {
979
+ version += `-${this.preRelease.type}.${this.preRelease.version}`;
980
+ }
981
+ return version;
982
+ }
983
+ toDescriptionString(packageName) {
984
+ const base = [
985
+ this.major,
986
+ this.minor,
987
+ this.patch
988
+ ].join(".");
989
+ const parts = [
990
+ packageName,
991
+ base
992
+ ];
993
+ if (this.preRelease) {
994
+ parts.push(upperCaseFirst(this.preRelease.type));
995
+ parts.push(this.preRelease.version);
996
+ }
997
+ parts.push(`(${base}.${this.buildNumber})`);
998
+ return parts.join(" ");
999
+ }
1000
+ /**
1001
+ * Determines wether the version is lesser than the input version
1002
+ *
1003
+ * @param {PackageVersion} version
1004
+ * @returns
1005
+ */ isLesserThan(version) {
1006
+ return PackageVersion.toNumber(this) < PackageVersion.toNumber(version);
1007
+ }
1008
+ /**
1009
+ * Determines wether the version is greater than the input version
1010
+ *
1011
+ * @param {PackageVersion} version
1012
+ * @returns
1013
+ */ isGreaterThan(version) {
1014
+ return PackageVersion.toNumber(this) > PackageVersion.toNumber(version);
1015
+ }
1016
+ }
1017
+ const upperCaseFirst = (input)=>{
1018
+ return input.slice(0, 1).toUpperCase() + input.slice(1);
1019
+ };
1020
+
1021
+ async function buildFolders(options) {
870
1022
  if (options.outDir !== undefined && options.clean) {
871
1023
  await fs$1.rm(options.outDir, {
872
1024
  recursive: true
@@ -883,7 +1035,7 @@ const buildFolders = async (options)=>{
883
1035
  ]));
884
1036
  const maxNameLength = Array.from(manifests.values(), (manifest)=>manifest.Package.length).reduce((acc, length)=>Math.max(acc, length), 0);
885
1037
  for (const location of sortedPackages){
886
- await ensureTsConfig(location);
1038
+ const tsConfig = await ensureTsConfig(location);
887
1039
  const data = manifests.get(location);
888
1040
  const reporter = options.preparedReporter ?? createPackageScopedReporter(baseReporter, data.Package, index, folders.length, maxNameLength);
889
1041
  const outputDirectory = options.outDir || location.scriptsDir;
@@ -894,7 +1046,18 @@ const buildFolders = async (options)=>{
894
1046
  if (options.banner) {
895
1047
  manager.addParticipant("banner", createBannerCommentBuildParticipant(options.banner));
896
1048
  }
897
- manager.addParticipant("tsc", createTSCBuildParticipant(location, outputDirectory));
1049
+ const typescriptFiles = getPackageTypescriptFiles(location);
1050
+ if (!typescriptFiles.some((file)=>path.basename(file).toLowerCase() === "version.ts")) {
1051
+ manager.addParticipant("version", createVersionLogBuildParticipant(data));
1052
+ }
1053
+ if (typescriptFiles.length > 0) {
1054
+ if (isScriptPackageModules(tsConfig.options)) {
1055
+ const { createRollupBuildParticipant } = await import('./rollup-UR3DADp8.mjs');
1056
+ manager.addParticipant("rollup", createRollupBuildParticipant(location, data, outputDirectory));
1057
+ } else {
1058
+ manager.addParticipant("tsc", createTSCBuildParticipant(location, outputDirectory));
1059
+ }
1060
+ }
898
1061
  manager.addParticipant("animation", createAnimationBuildParticipant(location, data));
899
1062
  await new Promise((resolve, reject)=>{
900
1063
  manager.addListener("start", ()=>{
@@ -915,8 +1078,8 @@ const buildFolders = async (options)=>{
915
1078
  }
916
1079
  index++;
917
1080
  }
918
- };
919
- const buildFoldersWatch = async (options)=>{
1081
+ }
1082
+ async function buildFoldersWatch(options) {
920
1083
  if (options.outDir !== undefined && options.clean) {
921
1084
  await fs$1.rm(options.outDir, {
922
1085
  recursive: true
@@ -932,7 +1095,7 @@ const buildFoldersWatch = async (options)=>{
932
1095
  ]));
933
1096
  const maxNameLength = Array.from(manifests.values(), (manifest)=>manifest.Package.length).reduce((acc, length)=>Math.max(acc, length), 0);
934
1097
  for (const location of sortedPackages){
935
- await ensureTsConfig(location);
1098
+ const tsConfig = await ensureTsConfig(location);
936
1099
  const baseReporter = options.reporter ?? consoleReporter;
937
1100
  const data = manifests.get(location);
938
1101
  const reporter = createPackageScopedReporter(baseReporter, data.Package, index, folders.length, maxNameLength);
@@ -944,7 +1107,18 @@ const buildFoldersWatch = async (options)=>{
944
1107
  if (options.banner) {
945
1108
  manager.addParticipant("banner", createBannerCommentBuildParticipant(options.banner));
946
1109
  }
947
- manager.addParticipant("tsc", createTSCWatchBuildParticipant(location, outputDirectory));
1110
+ const typescriptFiles = getPackageTypescriptFiles(location);
1111
+ if (!typescriptFiles.some((file)=>path.basename(file).toLowerCase() === "version.ts")) {
1112
+ manager.addParticipant("version", createVersionLogBuildParticipant(data));
1113
+ }
1114
+ if (typescriptFiles.length > 0) {
1115
+ if (isScriptPackageModules(tsConfig.options)) {
1116
+ const { createRollupWatchBuildParticipant } = await import('./rollup-UR3DADp8.mjs');
1117
+ manager.addParticipant("rollup", createRollupWatchBuildParticipant(location, data, outputDirectory));
1118
+ } else {
1119
+ manager.addParticipant("tsc", createTSCWatchBuildParticipant(location, outputDirectory));
1120
+ }
1121
+ }
948
1122
  manager.addParticipant("animation", createAnimationWatchBuildParticipant(location, data));
949
1123
  await new Promise((resolve, reject)=>{
950
1124
  manager.addListener("start", ()=>{
@@ -963,8 +1137,8 @@ const buildFoldersWatch = async (options)=>{
963
1137
  index++;
964
1138
  }
965
1139
  await new Promise(()=>{});
966
- };
967
- const writeBuildResult = async (buildResult, manifest, location, workspace, outputDirectory, minimize, reporter)=>{
1140
+ }
1141
+ async function writeBuildResult(buildResult, manifest, location, workspace, outputDirectory, minimize, reporter) {
968
1142
  let js = buildResult.js;
969
1143
  if (buildResult.sourceMap) {
970
1144
  js += `\n//# sourceMappingURL=${manifest.Package}.js.map`;
@@ -972,8 +1146,8 @@ const writeBuildResult = async (buildResult, manifest, location, workspace, outp
972
1146
  await fs$1.writeFile(path.join(outputDirectory, `${manifest.Package}.js`), js, {
973
1147
  encoding: "utf8"
974
1148
  });
975
- if (buildResult.definitions !== undefined) {
976
- await fs$1.writeFile(path.join(outputDirectory, `${manifest.Package}.d.ts`), buildResult.definitions, {
1149
+ if (buildResult.declarations !== undefined) {
1150
+ await fs$1.writeFile(path.join(outputDirectory, `${manifest.Package}.d.ts`), buildResult.declarations, {
977
1151
  encoding: "utf8"
978
1152
  });
979
1153
  }
@@ -1001,54 +1175,94 @@ const writeBuildResult = async (buildResult, manifest, location, workspace, outp
1001
1175
  });
1002
1176
  }
1003
1177
  }
1004
- if (location.path.includes("Basics") && buildResult.definitions !== undefined) {
1178
+ if (location.path.includes("Basics") && buildResult.declarations !== undefined) {
1005
1179
  await fs$1.mkdir(path.join(workspace.path, "lib"), {
1006
1180
  recursive: true
1007
1181
  });
1008
1182
  reporter.log("Copying basics definition file to the lib folder");
1009
- await fs$1.writeFile(path.join(workspace.path, "lib", `${manifest.Package}.d.ts`), buildResult.definitions, {
1183
+ await fs$1.writeFile(path.join(workspace.path, "lib", `${manifest.Package}.d.ts`), buildResult.declarations, {
1010
1184
  encoding: "utf8"
1011
1185
  });
1012
1186
  }
1013
- };
1014
- const createBannerCommentBuildParticipant = (options)=>(env)=>{
1187
+ }
1188
+ function createVersionLogBuildParticipant(manifest) {
1189
+ return (env)=>{
1190
+ env.onBuildStart();
1191
+ const parsedVersion = manifest.Version !== undefined ? PackageVersion.extractFromLine(manifest.Version) : undefined;
1192
+ let logText;
1193
+ if (parsedVersion !== undefined) {
1194
+ logText = parsedVersion.toDescriptionString(manifest.Package);
1195
+ } else {
1196
+ logText = manifest.Package;
1197
+ }
1198
+ logText += ".";
1199
+ if (manifest.Copyright !== undefined) {
1200
+ logText += " " + manifest.Copyright;
1201
+ }
1202
+ env.onBuildEnd({
1203
+ type: "success",
1204
+ artefacts: {
1205
+ js: `console.log(${JSON.stringify(logText)})`
1206
+ }
1207
+ });
1208
+ return {
1209
+ destroy: ()=>{}
1210
+ };
1211
+ };
1212
+ }
1213
+ function createBannerCommentBuildParticipant(options) {
1214
+ return (env)=>{
1015
1215
  env.onBuildStart();
1016
1216
  const banner = createBannerComment(options);
1017
1217
  env.onBuildEnd({
1018
1218
  type: "success",
1019
1219
  artefacts: {
1020
1220
  js: banner ?? "",
1021
- definitions: banner ?? ""
1221
+ declarations: banner ?? ""
1022
1222
  }
1023
1223
  });
1024
1224
  return {
1025
1225
  destroy: ()=>{}
1026
1226
  };
1027
1227
  };
1028
- const ensureTsConfig = async (location)=>{
1228
+ }
1229
+ async function ensureTsConfig(location) {
1029
1230
  const tsconfigPath = path.join(location.scriptsDir, "tsconfig.json");
1030
1231
  try {
1031
1232
  const content = JSON.parse(await fs$1.readFile(tsconfigPath, "utf8"));
1032
- applyTsConfigOption(content);
1233
+ applyTsConfigOptions(content);
1033
1234
  await fs$1.writeFile(tsconfigPath, JSON.stringify(content, undefined, "\t"), "utf8");
1235
+ return ts.parseJsonConfigFileContent(content, ts.sys, location.scriptsDir);
1034
1236
  } catch (err) {
1035
1237
  if (!isErrorENOENT(err)) {
1036
1238
  throw err;
1037
1239
  }
1038
1240
  const content = {};
1039
- applyTsConfigOption(content);
1241
+ applyTsConfigOptions(content);
1040
1242
  await fs$1.writeFile(tsconfigPath, JSON.stringify(content, undefined, "\t"), "utf8");
1243
+ return ts.parseJsonConfigFileContent(content, ts.sys, location.scriptsDir);
1041
1244
  }
1042
- };
1043
- const applyTsConfigOption = (data)=>{
1044
- data.compilerOptions = data.compilerOptions ?? {};
1045
- data.compilerOptions.target = "es5";
1046
- data.compilerOptions.lib = [
1047
- "es5",
1048
- "dom"
1049
- ];
1050
- };
1051
- const sortPackagesByBuildOrder = (folders)=>{
1245
+ }
1246
+ function applyTsConfigOptions(data) {
1247
+ if (data.compilerOptions?.module?.toLowerCase().startsWith("es")) {
1248
+ data.compilerOptions = data.compilerOptions ?? {};
1249
+ data.compilerOptions.target = "esnext";
1250
+ data.compilerOptions.lib = [
1251
+ "esnext",
1252
+ "dom"
1253
+ ];
1254
+ data.compilerOptions.module = "es2015";
1255
+ data.compilerOptions.moduleResolution = "node";
1256
+ } else {
1257
+ data.compilerOptions = data.compilerOptions ?? {};
1258
+ data.compilerOptions.target = "es5";
1259
+ data.compilerOptions.lib = [
1260
+ "es5",
1261
+ "dom"
1262
+ ];
1263
+ }
1264
+ }
1265
+ function sortPackagesByBuildOrder(folders) {
1052
1266
  const packages = Array.from(folders).reduce((acc, location)=>{
1053
1267
  const data = readPackageNpmManifest(location);
1054
1268
  if (data !== undefined) {
@@ -1088,8 +1302,8 @@ const sortPackagesByBuildOrder = (folders)=>{
1088
1302
  }
1089
1303
  }
1090
1304
  return result;
1091
- };
1092
- const createBannerComment = (banner)=>{
1305
+ }
1306
+ function createBannerComment(banner) {
1093
1307
  const bannerParts = [];
1094
1308
  if (banner.text) {
1095
1309
  bannerParts.push(" * " + banner.text);
@@ -1123,7 +1337,7 @@ ${bannerText}
1123
1337
  */`;
1124
1338
  }
1125
1339
  return undefined;
1126
- };
1340
+ }
1127
1341
 
1128
1342
  var index = /*#__PURE__*/Object.freeze({
1129
1343
  __proto__: null,
@@ -1131,5 +1345,5 @@ var index = /*#__PURE__*/Object.freeze({
1131
1345
  buildFoldersWatch: buildFoldersWatch
1132
1346
  });
1133
1347
 
1134
- export { consoleReporter as a, buildFolders as b, createPackageScopedReporter as c, index as i };
1135
- //# sourceMappingURL=index-B9e-vtmM.mjs.map
1348
+ export { PackageVersion as P, consoleReporter as a, buildFolders as b, createPackageScopedReporter as c, index as i };
1349
+ //# sourceMappingURL=index-B2kXo6K7.mjs.map