@intelligentgraphics/ig.gfx.packager 3.0.11 → 3.0.13

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 (28) hide show
  1. package/build/bin.mjs +1 -1
  2. package/build/{cli-381989cc.mjs → cli-b2b70181.mjs} +10 -19
  3. package/build/cli-b2b70181.mjs.map +1 -0
  4. package/build/{dependencies-1f665204.mjs → dependencies-dc3442f0.mjs} +2 -2
  5. package/build/{dependencies-1f665204.mjs.map → dependencies-dc3442f0.mjs.map} +1 -1
  6. package/build/{generateIndex-074f4aa1.mjs → generateIndex-173ba231.mjs} +48 -9
  7. package/build/generateIndex-173ba231.mjs.map +1 -0
  8. package/build/{generateParameterType-4c9e95a5.mjs → generateParameterType-bb1df689.mjs} +2 -2
  9. package/build/{generateParameterType-4c9e95a5.mjs.map → generateParameterType-bb1df689.mjs.map} +1 -1
  10. package/build/{index-cc42a478.mjs → index-3acafba8.mjs} +76 -13
  11. package/build/index-3acafba8.mjs.map +1 -0
  12. package/build/{index-06ac2c4c.mjs → index-5985bddb.mjs} +9 -67
  13. package/build/index-5985bddb.mjs.map +1 -0
  14. package/build/{postinstall-c38d9b55.mjs → postinstall-3681bf5f.mjs} +3 -3
  15. package/build/{postinstall-c38d9b55.mjs.map → postinstall-3681bf5f.mjs.map} +1 -1
  16. package/build/{publishNpm-8ec1b871.mjs → publishNpm-3fb5df2a.mjs} +6 -4
  17. package/build/{publishNpm-8ec1b871.mjs.map → publishNpm-3fb5df2a.mjs.map} +1 -1
  18. package/build/scripts-7ed8dff6.mjs +10 -0
  19. package/build/scripts-7ed8dff6.mjs.map +1 -0
  20. package/build/{versionFile-aa8b6b7a.mjs → versionFile-e0d6dba2.mjs} +2 -2
  21. package/build/{versionFile-aa8b6b7a.mjs.map → versionFile-e0d6dba2.mjs.map} +1 -1
  22. package/lib/lib.mjs +352 -72
  23. package/package.json +4 -4
  24. package/readme.md +11 -0
  25. package/build/cli-381989cc.mjs.map +0 -1
  26. package/build/generateIndex-074f4aa1.mjs.map +0 -1
  27. package/build/index-06ac2c4c.mjs.map +0 -1
  28. package/build/index-cc42a478.mjs.map +0 -1
package/lib/lib.mjs CHANGED
@@ -8,10 +8,10 @@ import 'write-json-file';
8
8
  import axios from 'axios';
9
9
  import ts from 'typescript';
10
10
  import typedoc from 'typedoc';
11
+ import Ajv from 'ajv';
11
12
  import { pipeline } from 'stream/promises';
12
13
  import { execSync } from 'child_process';
13
14
  import simpleGit from 'simple-git';
14
- import Ajv from 'ajv';
15
15
  import JSZip from 'jszip';
16
16
 
17
17
  const stripUtf8Bom = (text)=>{
@@ -79,6 +79,10 @@ const readPackageCreatorIndex = (location)=>{
79
79
  throw err;
80
80
  }
81
81
  };
82
+ const writePackageCreatorIndex = (location, index)=>{
83
+ const indexPath = getPackageCreatorIndexPath(location);
84
+ fs.writeFileSync(indexPath, JSON.stringify(index, null, "\t") + "\n");
85
+ };
82
86
  const readPackageNpmManifest = (location)=>{
83
87
  try {
84
88
  return readNpmManifest(location.manifestDir);
@@ -495,6 +499,19 @@ const toposort = (packages)=>{
495
499
  return result;
496
500
  };
497
501
 
502
+ let validateAnimationJson;
503
+ const getAnimationJsonValidation = async ()=>{
504
+ if (validateAnimationJson === undefined) {
505
+ validateAnimationJson = await axios.get("https://archive.intelligentgraphics.biz/schemas/gfx/animation.json").then(({ data })=>new Ajv({
506
+ coerceTypes: true,
507
+ allErrors: true,
508
+ removeAdditional: true,
509
+ useDefaults: "empty",
510
+ validateSchema: "log"
511
+ }).compile(data));
512
+ }
513
+ return validateAnimationJson;
514
+ };
498
515
  const buildFolders = async (options)=>{
499
516
  if (options.outDir !== undefined && options.clean) {
500
517
  fs.rmSync(options.outDir, {
@@ -504,31 +521,71 @@ const buildFolders = async (options)=>{
504
521
  const workspace = options.workspace;
505
522
  const folders = options.packages;
506
523
  let sortedPackages = sortPackagesByBuildOrder(folders);
507
- if (options.skipPackagesWithoutTsFiles) {
508
- sortedPackages = sortedPackages.filter((location)=>getPackageTypescriptFiles(location).length > 0);
509
- }
510
524
  let index = 1;
511
525
  for (const location of sortedPackages){
526
+ const hasTypescript = getPackageTypescriptFiles(location).length > 0;
512
527
  ensureTsConfig(location);
513
528
  const data = readPackageCreatorManifest(location);
514
529
  const logStep = (step)=>logPackageMessage(data.Package, step, index, folders.length);
515
- logStep("Compiling typescript to javascript");
516
530
  const outputDirectory = options.outDir || location.scriptsDir;
517
531
  fs.mkdirSync(outputDirectory, {
518
532
  recursive: true
519
533
  });
520
- const buildResult = await build(location, outputDirectory);
534
+ let buildResult;
535
+ if (hasTypescript) {
536
+ logStep("Compiling typescript to javascript");
537
+ buildResult = await build(location, outputDirectory);
538
+ } else {
539
+ buildResult = {
540
+ js: ""
541
+ };
542
+ }
521
543
  const banner = options.banner ? createBannerComment(options.banner) : undefined;
522
544
  if (banner) {
523
545
  buildResult.js = banner + "\n" + buildResult.js;
524
- buildResult.definitions = banner + "\n" + buildResult.definitions;
546
+ if (buildResult.definitions !== undefined) {
547
+ buildResult.definitions = banner + "\n" + buildResult.definitions;
548
+ }
549
+ }
550
+ const animations = new Map();
551
+ for (const scriptFilePath of readPackageAnimationList(location)){
552
+ const content = fs.readFileSync(scriptFilePath, {
553
+ encoding: "utf8"
554
+ });
555
+ let data;
556
+ try {
557
+ data = JSON.parse(content);
558
+ } catch (err) {
559
+ const relativePath = path.relative(options.workspace.path, scriptFilePath);
560
+ if (err instanceof SyntaxError) {
561
+ throw new Error(`Encountered invalid syntax in file "${relativePath}": ${String(err)}`);
562
+ }
563
+ throw new Error(`Encountered an unexpected error while parsing animation json file at path "${relativePath}"`, {
564
+ cause: err
565
+ });
566
+ }
567
+ (await getAnimationJsonValidation())(data);
568
+ animations.set(data.Id, JSON.stringify(data));
569
+ }
570
+ if (animations.size > 0) {
571
+ const scope = data.Scope ?? data.Package;
572
+ const scopeParts = scope.split(".");
573
+ buildResult.js += createNamespace(scopeParts);
574
+ for (const [name, content] of animations){
575
+ buildResult.js += `${scope}["${name}"] = ` + content + ";";
576
+ logPackageMessage(data.Package, `Adding animation ${scope}.${name}`);
577
+ }
578
+ } else if (!hasTypescript) {
579
+ throw new Error(`Expected package to have a least one ts file or one animation.json file`);
525
580
  }
526
581
  fs.writeFileSync(path.join(outputDirectory, `${data.Package}.js`), buildResult.js, {
527
582
  encoding: "utf8"
528
583
  });
529
- fs.writeFileSync(path.join(outputDirectory, `${data.Package}.d.ts`), buildResult.definitions, {
530
- encoding: "utf8"
531
- });
584
+ if (buildResult.definitions !== undefined) {
585
+ fs.writeFileSync(path.join(outputDirectory, `${data.Package}.d.ts`), buildResult.definitions, {
586
+ encoding: "utf8"
587
+ });
588
+ }
532
589
  if (options.minimize) {
533
590
  const minifyResult = await terser.minify(buildResult.js, {
534
591
  ecma: 5
@@ -538,7 +595,7 @@ const buildFolders = async (options)=>{
538
595
  encoding: "utf8"
539
596
  });
540
597
  }
541
- if (location.path.includes("Basics")) {
598
+ if (location.path.includes("Basics") && buildResult.definitions !== undefined) {
542
599
  fs.mkdirSync(path.join(workspace.path, "lib"), {
543
600
  recursive: true
544
601
  });
@@ -554,6 +611,14 @@ const buildFolders = async (options)=>{
554
611
  index++;
555
612
  }
556
613
  };
614
+ const createNamespace = (parts)=>{
615
+ let code = `var ${parts[0]};`;
616
+ for(let index = 0; index < parts.length; index++){
617
+ const path = parts.slice(0, index + 1).join(".");
618
+ code += `\n(${path} = ${path} || {});`;
619
+ }
620
+ return code;
621
+ };
557
622
  const ensureTsConfig = (location)=>{
558
623
  const tsconfigPath = path.join(location.scriptsDir, "tsconfig.json");
559
624
  if (!fs.existsSync(tsconfigPath)) {
@@ -1018,7 +1083,6 @@ const buildArchiveFromPublishedPackage = (location, manifest, creatorPackage)=>{
1018
1083
  archive.file(manifest.main, fs.createReadStream(path.join(location.path, manifest.main)));
1019
1084
  return archive;
1020
1085
  };
1021
- let validateSchema;
1022
1086
  const runtimeScripts = [
1023
1087
  "Interactor",
1024
1088
  "Core",
@@ -1031,15 +1095,6 @@ const notRuntimeScripts = [
1031
1095
  const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data)=>{
1032
1096
  const { domain , subdomain } = parseCreatorPackageName(data);
1033
1097
  const logStep = (step)=>logPackageMessage(data.Package, step);
1034
- if (validateSchema === undefined) {
1035
- validateSchema = await axios.get("https://archive.intelligentgraphics.biz/schemas/gfx/animation.json").then(({ data })=>new Ajv({
1036
- coerceTypes: true,
1037
- allErrors: true,
1038
- removeAdditional: true,
1039
- useDefaults: "empty",
1040
- validateSchema: "log"
1041
- }).compile(data));
1042
- }
1043
1098
  const libFilePath = path.join(getWorkspaceOutputPath(workspaceLocation), `${data.Package}.min.js`);
1044
1099
  const scriptDirectories = [
1045
1100
  packageLocation.path,
@@ -1065,31 +1120,6 @@ const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data)
1065
1120
  });
1066
1121
  }
1067
1122
  }
1068
- // if (index === undefined) {
1069
- // throw new Error(
1070
- // `Could not find an "${INDEX_FILE}" file in "${primaryScriptDir}"`,
1071
- // );
1072
- // }
1073
- const animations = new Map();
1074
- for (const scriptFilePath of readPackageAnimationList(packageLocation)){
1075
- const content = fs.readFileSync(scriptFilePath, {
1076
- encoding: "utf8"
1077
- });
1078
- let data;
1079
- try {
1080
- data = JSON.parse(content);
1081
- } catch (err) {
1082
- const relativePath = path.relative(workspaceLocation.path, scriptFilePath);
1083
- if (err instanceof SyntaxError) {
1084
- throw new Error(`Encountered invalid syntax in file "${relativePath}": ${String(err)}`);
1085
- }
1086
- throw new Error(`Encountered an unexpected error while parsing animation json file at path "${relativePath}"`, {
1087
- cause: err
1088
- });
1089
- }
1090
- validateSchema(data);
1091
- animations.set(data.Id, JSON.stringify(data));
1092
- }
1093
1123
  let libFile;
1094
1124
  try {
1095
1125
  libFile = fs.readFileSync(libFilePath, {
@@ -1100,12 +1130,6 @@ const buildArchiveFromPackage = async (workspaceLocation, packageLocation, data)
1100
1130
  throw err;
1101
1131
  }
1102
1132
  }
1103
- if (libFile === undefined) {
1104
- if (animations.size === 0) {
1105
- throw new Error(`Could not find a javascript file at "${libFilePath}".
1106
- Packaging without a javascript file is only allowed when animation json files are available`);
1107
- }
1108
- }
1109
1133
  const archive = new JSZip();
1110
1134
  let library = "";
1111
1135
  if (libFile) {
@@ -1116,15 +1140,6 @@ Packaging without a javascript file is only allowed when animation json files ar
1116
1140
  library = `/* This file is part of the ${domain} Data Packages.
1117
1141
  * Copyright (C) ${date.getFullYear()} intelligentgraphics. All Rights Reserved. */`;
1118
1142
  }
1119
- if (animations.size > 0) {
1120
- const scope = data.Scope ?? data.Package;
1121
- const scopeParts = scope.split(".");
1122
- library += createNamespace(scopeParts);
1123
- for (const [name, data] of animations){
1124
- library += `${scope}.${name} = ` + data + ";";
1125
- logPackageMessage(manifest.Package, `Added animation ${scope}.${name}`);
1126
- }
1127
- }
1128
1143
  const minifyResult = await terser.minify(library, {
1129
1144
  ecma: 5
1130
1145
  });
@@ -1154,14 +1169,6 @@ Packaging without a javascript file is only allowed when animation json files ar
1154
1169
  }
1155
1170
  return archive;
1156
1171
  };
1157
- const createNamespace = (parts)=>{
1158
- let code = `var ${parts[0]};`;
1159
- for(let index = 0; index < parts.length; index++){
1160
- const path = parts.slice(0, index + 1).join(".");
1161
- code += `\n(${path} = ${path} || {});`;
1162
- }
1163
- return code;
1164
- };
1165
1172
 
1166
1173
  const releaseFolder = async (options)=>{
1167
1174
  const workspace = options.workspace;
@@ -1234,7 +1241,6 @@ const releaseFolder = async (options)=>{
1234
1241
  packages: [
1235
1242
  location
1236
1243
  ],
1237
- skipPackagesWithoutTsFiles: true,
1238
1244
  banner: options.banner ? {
1239
1245
  text: bannerText,
1240
1246
  commit: gitVersionInformation.commit,
@@ -1257,7 +1263,7 @@ const releaseFolder = async (options)=>{
1257
1263
  var _workspaceManifest_dependencies;
1258
1264
  const workspaceManifest = readWorkspaceNpmManifest(workspace);
1259
1265
  if (!((_workspaceManifest_dependencies = workspaceManifest.dependencies) == null ? void 0 : _workspaceManifest_dependencies["@intelligentgraphics/3d.ig.gfx.standard"])) {
1260
- const install = await options.prompter.confirm(`Animation.json files require the library 'IG.GFX.Standard' to be available, but it is not registered as a dependency. Do you want to install it now?`);
1266
+ const install = await options.prompter.confirm(`Animation.json files expect the library 'IG.GFX.Standard' to be available, but it is not registered as a dependency. Do you want it to be added now?`);
1261
1267
  if (install) {
1262
1268
  execSync(`npm install @intelligentgraphics/3d.ig.gfx.standard`, {
1263
1269
  encoding: "utf-8",
@@ -1472,5 +1478,279 @@ const createSessionManager = async (params)=>{
1472
1478
  };
1473
1479
  };
1474
1480
 
1475
- export { buildFolders, releaseFolder };
1481
+ /**
1482
+ * Extracts and returns script array for _Index.json from a src folder
1483
+ *
1484
+ * @param folderPath path to a src folder
1485
+ */ function generateIndex({ location , ignore =[] , strictOptional =false }) {
1486
+ const files = getPackageTypescriptFiles(location);
1487
+ const filtered = files.filter((path)=>{
1488
+ return !ignore.some((suffix)=>path.endsWith(suffix));
1489
+ });
1490
+ const arr = [];
1491
+ const existingIndex = readPackageCreatorIndex(location) ?? [];
1492
+ const program = ts.createProgram(filtered, {
1493
+ allowJs: true
1494
+ });
1495
+ const typeChecker = program.getTypeChecker();
1496
+ filtered.forEach((file)=>{
1497
+ // Create a Program to represent the project, then pull out the
1498
+ // source file to parse its AST.
1499
+ const sourceFile = program.getSourceFile(file);
1500
+ // Loop through the root AST nodes of the file
1501
+ ts.forEachChild(sourceFile, (node)=>{
1502
+ for (const scriptingClass of findScriptingClasses(node)){
1503
+ if (scriptingClass.node.name === undefined) {
1504
+ throw new Error(`Expected ${scriptingClass.type} class to have a name`);
1505
+ }
1506
+ const name = typeChecker.getFullyQualifiedName(typeChecker.getSymbolAtLocation(scriptingClass.node.name));
1507
+ if (name.length > 45) {
1508
+ throw new Error(`Package name length >45 '${name}'`);
1509
+ }
1510
+ const parameterDeclaration = getScriptingClassParameterdeclaration(scriptingClass);
1511
+ const parametersType = parameterDeclaration === undefined ? undefined : typeChecker.getTypeAtLocation(parameterDeclaration);
1512
+ if (parametersType === undefined) {
1513
+ console.log(`Failed to find parameters type declaration for ${scriptingClass.type} ${name}. Skipping parameter list generation`);
1514
+ }
1515
+ const existingIndexEntry = existingIndex.find((entry)=>entry.Name === name);
1516
+ const obj = {
1517
+ Name: name,
1518
+ Description: (existingIndexEntry == null ? void 0 : existingIndexEntry.Description) ?? name,
1519
+ Type: scriptingClass.type === "evaluator" ? "Evaluator" : "Interactor",
1520
+ Parameters: []
1521
+ };
1522
+ const rawDocTags = ts.getJSDocTags(scriptingClass.node);
1523
+ const dict = getTagDict(rawDocTags);
1524
+ if (dict.summary) {
1525
+ obj.Description = dict.summary;
1526
+ } else {
1527
+ const comment = typeChecker.getTypeAtLocation(scriptingClass.node).symbol.getDocumentationComment(typeChecker).map((comment)=>comment.text).join(" ");
1528
+ if (comment) {
1529
+ obj.Description = comment;
1530
+ }
1531
+ }
1532
+ if (parametersType !== undefined) {
1533
+ obj.Parameters = parseParametersList(typeChecker.getPropertiesOfType(parametersType), strictOptional);
1534
+ if (obj.Parameters.length === 0 && parametersType.getStringIndexType() !== undefined) {
1535
+ obj.Parameters = (existingIndexEntry == null ? void 0 : existingIndexEntry.Parameters) ?? [];
1536
+ }
1537
+ } else if (existingIndexEntry !== undefined) {
1538
+ obj.Parameters = existingIndexEntry.Parameters;
1539
+ }
1540
+ arr.push(obj);
1541
+ }
1542
+ });
1543
+ });
1544
+ arr.sort((a, b)=>a.Name.localeCompare(b.Name));
1545
+ writePackageCreatorIndex(location, arr);
1546
+ }
1547
+ function capitalizeFirstLetter(string) {
1548
+ return (string == null ? void 0 : string.charAt(0).toUpperCase()) + (string == null ? void 0 : string.slice(1));
1549
+ }
1550
+ const parseDefault = (value, type)=>{
1551
+ const uType = capitalizeFirstLetter(type);
1552
+ if (value === "null") return null;
1553
+ switch(uType){
1554
+ case "LengthM":
1555
+ case "ArcDEG":
1556
+ case "Float":
1557
+ return parseFloat(value);
1558
+ case "Integer":
1559
+ case "Int":
1560
+ return parseInt(value);
1561
+ case "Boolean":
1562
+ case "Bool":
1563
+ return value === "true";
1564
+ case "Material":
1565
+ case "String":
1566
+ case "Geometry":
1567
+ default:
1568
+ return value.replace(/^"/, "").replace(/"$/, "");
1569
+ }
1570
+ };
1571
+ const parseTypeFromName = (name)=>{
1572
+ const parts = name.split(".");
1573
+ const identifier = parts[parts.length - 1];
1574
+ switch(identifier){
1575
+ case "LengthM":
1576
+ case "ArcDEG":
1577
+ case "Float":
1578
+ case "Integer":
1579
+ return identifier;
1580
+ case "GeometryReference":
1581
+ return "Geometry";
1582
+ case "MaterialReference":
1583
+ return "Material";
1584
+ case "AnimationReference":
1585
+ return "Animation";
1586
+ case "InteractorReference":
1587
+ return "Interactor";
1588
+ case "EvaluatorReference":
1589
+ return "Evaluator";
1590
+ case "String":
1591
+ case "string":
1592
+ return "String";
1593
+ case "number":
1594
+ case "Number":
1595
+ return "Float";
1596
+ case "boolean":
1597
+ case "Boolean":
1598
+ return "Boolean";
1599
+ }
1600
+ };
1601
+ const parseParametersList = (properties, strictOptional)=>{
1602
+ return properties.map((symbol, i)=>{
1603
+ var _symbol_getDeclarations;
1604
+ const parameter = {
1605
+ Name: symbol.name,
1606
+ Description: undefined,
1607
+ Type: "String",
1608
+ Default: undefined,
1609
+ DisplayIndex: i + 1
1610
+ };
1611
+ if (parameter.Name.length > 45) {
1612
+ throw new Error(`Parameter name length >45 '${parameter.Name}'`);
1613
+ }
1614
+ let declaration = (_symbol_getDeclarations = symbol.getDeclarations()) == null ? void 0 : _symbol_getDeclarations[0];
1615
+ let documentationComment = symbol.getDocumentationComment(undefined);
1616
+ let checkLinksSymbol = symbol;
1617
+ while(checkLinksSymbol !== undefined && declaration === undefined){
1618
+ const links = checkLinksSymbol.links;
1619
+ if (links == null ? void 0 : links.syntheticOrigin) {
1620
+ var _links_syntheticOrigin_getDeclarations;
1621
+ declaration = (_links_syntheticOrigin_getDeclarations = links.syntheticOrigin.getDeclarations()) == null ? void 0 : _links_syntheticOrigin_getDeclarations[0];
1622
+ if (documentationComment.length === 0) {
1623
+ documentationComment = links.syntheticOrigin.getDocumentationComment(undefined);
1624
+ }
1625
+ checkLinksSymbol = links.syntheticOrigin;
1626
+ }
1627
+ }
1628
+ if (declaration !== undefined) {
1629
+ const rawDocTags = ts.getJSDocTags(declaration);
1630
+ const dict = getTagDict(rawDocTags);
1631
+ if (dict.summary) {
1632
+ parameter.Description = dict.summary;
1633
+ } else {
1634
+ const comment = documentationComment.map((comment)=>comment.text).join(" ");
1635
+ if (comment) {
1636
+ parameter.Description = comment;
1637
+ }
1638
+ }
1639
+ if (dict.creatorType) {
1640
+ parameter.Type = dict.creatorType;
1641
+ } else {
1642
+ const propertySignature = declaration;
1643
+ if (propertySignature.type !== undefined) {
1644
+ const parsedType = parseTypeFromName(propertySignature.type.getText());
1645
+ if (parsedType !== undefined) {
1646
+ parameter.Type = parsedType;
1647
+ }
1648
+ }
1649
+ }
1650
+ if (dict.default) {
1651
+ parameter.Default = parseDefault(dict.default, parameter.Type);
1652
+ }
1653
+ if (strictOptional && declaration.kind === ts.SyntaxKind.PropertySignature) {
1654
+ const propertySignature = declaration;
1655
+ if (propertySignature.questionToken === undefined) {
1656
+ parameter.Required = true;
1657
+ }
1658
+ }
1659
+ }
1660
+ return parameter;
1661
+ });
1662
+ };
1663
+ function getTagDict(tags) {
1664
+ const dict = {};
1665
+ for (const tag of tags){
1666
+ dict[tag.tagName.text] = tag.comment;
1667
+ }
1668
+ return dict;
1669
+ }
1670
+ const getScriptingClassParameterdeclaration = (scriptingClass)=>{
1671
+ for (const member of scriptingClass.node.members){
1672
+ if (ts.isMethodDeclaration(member)) {
1673
+ for(let index = 0; index < member.parameters.length; index++){
1674
+ const parameter = member.parameters[index];
1675
+ if (isScriptingClassParameterDeclaration(scriptingClass, member, index)) {
1676
+ return parameter;
1677
+ }
1678
+ }
1679
+ }
1680
+ if (ts.isConstructorDeclaration(member)) {
1681
+ for(let index = 0; index < member.parameters.length; index++){
1682
+ const parameter = member.parameters[index];
1683
+ if (isScriptingClassParameterDeclaration(scriptingClass, member, index)) {
1684
+ return parameter;
1685
+ }
1686
+ }
1687
+ }
1688
+ }
1689
+ };
1690
+ const isScriptingClassParameterDeclaration = (scriptingClass, memberNode, parameterIndex)=>{
1691
+ if (scriptingClass.type === "evaluator") {
1692
+ var _memberNode_name;
1693
+ return (memberNode == null ? void 0 : (_memberNode_name = memberNode.name) == null ? void 0 : _memberNode_name.getText()) == "Create" && parameterIndex === 2;
1694
+ }
1695
+ if (scriptingClass.type === "interactor") {
1696
+ return memberNode.kind === ts.SyntaxKind.Constructor && parameterIndex === 0;
1697
+ }
1698
+ return false;
1699
+ };
1700
+ /**
1701
+ * Finds interactors and evaluators within a script file
1702
+ *
1703
+ * @param {ts.Node} node
1704
+ * @return {*}
1705
+ */ const findScriptingClasses = (node)=>{
1706
+ let body;
1707
+ if (ts.isModuleDeclaration(node)) {
1708
+ body = node.body;
1709
+ }
1710
+ if (body !== undefined && ts.isModuleDeclaration(body)) {
1711
+ body = body.body;
1712
+ }
1713
+ const classes = [];
1714
+ if (body !== undefined) {
1715
+ ts.forEachChild(body, (child)=>{
1716
+ if (!ts.isClassDeclaration(child)) {
1717
+ return;
1718
+ }
1719
+ const scriptingClass = detectScriptingClass(child);
1720
+ if (scriptingClass !== undefined) {
1721
+ classes.push(scriptingClass);
1722
+ }
1723
+ });
1724
+ }
1725
+ return classes;
1726
+ };
1727
+ const detectScriptingClass = (node)=>{
1728
+ var _node_heritageClauses, _node_heritageClauses1;
1729
+ const isEvaluator = (_node_heritageClauses = node.heritageClauses) == null ? void 0 : _node_heritageClauses.some((clause)=>{
1730
+ if (clause.token !== ts.SyntaxKind.ExtendsKeyword && clause.token !== ts.SyntaxKind.ImplementsKeyword) {
1731
+ return false;
1732
+ }
1733
+ return clause.types.some((type)=>type.getText().includes("Evaluator"));
1734
+ });
1735
+ if (isEvaluator) {
1736
+ return {
1737
+ node,
1738
+ type: "evaluator"
1739
+ };
1740
+ }
1741
+ const isInteractor = (_node_heritageClauses1 = node.heritageClauses) == null ? void 0 : _node_heritageClauses1.some((clause)=>{
1742
+ if (clause.token !== ts.SyntaxKind.ExtendsKeyword) {
1743
+ return false;
1744
+ }
1745
+ return clause.types.some((type)=>type.getText().includes("Interactor"));
1746
+ });
1747
+ if (isInteractor) {
1748
+ return {
1749
+ node,
1750
+ type: "interactor"
1751
+ };
1752
+ }
1753
+ };
1754
+
1755
+ export { buildFolders, generateIndex, releaseFolder };
1476
1756
  //# sourceMappingURL=lib.mjs.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@intelligentgraphics/ig.gfx.packager",
3
- "version": "3.0.11",
4
- "description": "IG.GFX.Packager 3.0.11 (3.0.11.100)",
3
+ "version": "3.0.13",
4
+ "description": "IG.GFX.Packager 3.0.13 (3.0.13.100)",
5
5
  "author": "Michael Beier <mb@intelligentgraphics.biz>",
6
6
  "main": "lib/lib.mjs",
7
7
  "types": "lib/lib.d.ts",
@@ -42,8 +42,8 @@
42
42
  "simple-git": "^3.16.0",
43
43
  "source-map-support": "^0.5.21",
44
44
  "terser": "^5.16.1",
45
- "typedoc": "~0.23.2",
46
- "typescript": "~5.0.2",
45
+ "typedoc": "^0.24.8",
46
+ "typescript": "^5.1.6",
47
47
  "update-notifier": "^6.0.2",
48
48
  "v8-compile-cache": "^2.3.0",
49
49
  "write-pkg": "^5.1.0",
package/readme.md CHANGED
@@ -470,6 +470,17 @@ Afterwards you may need to reload your editor in order for the installed files t
470
470
 
471
471
  ## History
472
472
 
473
+ **IG.GFX.Packager 3.0.13**
474
+
475
+ - update typescript and typedoc
476
+ - refactor to bundle animations as part of build
477
+
478
+ **IG.GFX.Packager 3.0.12**
479
+
480
+ - handle animation json ids that are not valid js identifiers
481
+ - default creator index entry description to name
482
+ - update typescript
483
+
473
484
  **IG.GFX.Packager 3.0.11**
474
485
 
475
486
  - add library distribution