@platforma-sdk/tengo-builder 2.4.13 → 2.4.15

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 (123) hide show
  1. package/README.md +4 -4
  2. package/bin/run.js +5 -5
  3. package/dist/commands/build.cjs +36 -36
  4. package/dist/commands/build.cjs.map +1 -1
  5. package/dist/commands/build.d.ts +5 -5
  6. package/dist/commands/build.js +36 -36
  7. package/dist/commands/build.js.map +1 -1
  8. package/dist/commands/check.cjs +5 -5
  9. package/dist/commands/check.cjs.map +1 -1
  10. package/dist/commands/check.d.ts +2 -2
  11. package/dist/commands/check.d.ts.map +1 -1
  12. package/dist/commands/check.js +5 -5
  13. package/dist/commands/check.js.map +1 -1
  14. package/dist/commands/dump/artifacts.cjs +4 -6
  15. package/dist/commands/dump/artifacts.cjs.map +1 -1
  16. package/dist/commands/dump/artifacts.d.ts +2 -2
  17. package/dist/commands/dump/artifacts.d.ts.map +1 -1
  18. package/dist/commands/dump/artifacts.js +4 -6
  19. package/dist/commands/dump/artifacts.js.map +1 -1
  20. package/dist/commands/dump/software.cjs +3 -5
  21. package/dist/commands/dump/software.cjs.map +1 -1
  22. package/dist/commands/dump/software.d.ts +2 -2
  23. package/dist/commands/dump/software.d.ts.map +1 -1
  24. package/dist/commands/dump/software.js +3 -5
  25. package/dist/commands/dump/software.js.map +1 -1
  26. package/dist/commands/test.cjs +5 -5
  27. package/dist/commands/test.cjs.map +1 -1
  28. package/dist/commands/test.d.ts +2 -2
  29. package/dist/commands/test.d.ts.map +1 -1
  30. package/dist/commands/test.js +5 -5
  31. package/dist/commands/test.js.map +1 -1
  32. package/dist/compiler/artifactset.cjs +2 -2
  33. package/dist/compiler/artifactset.cjs.map +1 -1
  34. package/dist/compiler/artifactset.d.ts +1 -1
  35. package/dist/compiler/artifactset.d.ts.map +1 -1
  36. package/dist/compiler/artifactset.js +2 -2
  37. package/dist/compiler/artifactset.js.map +1 -1
  38. package/dist/compiler/compiler.cjs +37 -34
  39. package/dist/compiler/compiler.cjs.map +1 -1
  40. package/dist/compiler/compiler.d.ts +3 -3
  41. package/dist/compiler/compiler.d.ts.map +1 -1
  42. package/dist/compiler/compiler.js +37 -34
  43. package/dist/compiler/compiler.js.map +1 -1
  44. package/dist/compiler/compileroptions.cjs +12 -12
  45. package/dist/compiler/compileroptions.cjs.map +1 -1
  46. package/dist/compiler/compileroptions.d.ts +2 -2
  47. package/dist/compiler/compileroptions.js +12 -12
  48. package/dist/compiler/compileroptions.js.map +1 -1
  49. package/dist/compiler/main.cjs +58 -58
  50. package/dist/compiler/main.cjs.map +1 -1
  51. package/dist/compiler/main.d.ts +6 -6
  52. package/dist/compiler/main.d.ts.map +1 -1
  53. package/dist/compiler/main.js +58 -58
  54. package/dist/compiler/main.js.map +1 -1
  55. package/dist/compiler/package.cjs +5 -2
  56. package/dist/compiler/package.cjs.map +1 -1
  57. package/dist/compiler/package.d.ts +6 -6
  58. package/dist/compiler/package.d.ts.map +1 -1
  59. package/dist/compiler/package.js +5 -2
  60. package/dist/compiler/package.js.map +1 -1
  61. package/dist/compiler/source.cjs +50 -52
  62. package/dist/compiler/source.cjs.map +1 -1
  63. package/dist/compiler/source.d.ts +2 -2
  64. package/dist/compiler/source.d.ts.map +1 -1
  65. package/dist/compiler/source.js +50 -52
  66. package/dist/compiler/source.js.map +1 -1
  67. package/dist/compiler/template.cjs +7 -7
  68. package/dist/compiler/template.cjs.map +1 -1
  69. package/dist/compiler/template.d.ts +2 -2
  70. package/dist/compiler/template.d.ts.map +1 -1
  71. package/dist/compiler/template.js +7 -7
  72. package/dist/compiler/template.js.map +1 -1
  73. package/dist/compiler/test.artifacts.d.ts +1 -1
  74. package/dist/compiler/test.artifacts.d.ts.map +1 -1
  75. package/dist/compiler/util.cjs +12 -12
  76. package/dist/compiler/util.cjs.map +1 -1
  77. package/dist/compiler/util.d.ts +2 -2
  78. package/dist/compiler/util.js +12 -12
  79. package/dist/compiler/util.js.map +1 -1
  80. package/dist/index.cjs +5 -5
  81. package/dist/index.cjs.map +1 -1
  82. package/dist/index.d.ts +7 -7
  83. package/dist/index.js +5 -5
  84. package/dist/index.js.map +1 -1
  85. package/dist/shared/basecmd.cjs +15 -15
  86. package/dist/shared/basecmd.cjs.map +1 -1
  87. package/dist/shared/basecmd.d.ts +4 -4
  88. package/dist/shared/basecmd.js +15 -15
  89. package/dist/shared/basecmd.js.map +1 -1
  90. package/dist/shared/dump.cjs +28 -28
  91. package/dist/shared/dump.cjs.map +1 -1
  92. package/dist/shared/dump.d.ts +2 -2
  93. package/dist/shared/dump.d.ts.map +1 -1
  94. package/dist/shared/dump.js +28 -28
  95. package/dist/shared/dump.js.map +1 -1
  96. package/dist/shared/proc.cjs +5 -5
  97. package/dist/shared/proc.cjs.map +1 -1
  98. package/dist/shared/proc.d.ts +2 -2
  99. package/dist/shared/proc.js +5 -5
  100. package/dist/shared/proc.js.map +1 -1
  101. package/package.json +21 -19
  102. package/src/commands/build.ts +57 -55
  103. package/src/commands/check.ts +15 -12
  104. package/src/commands/dump/artifacts.ts +11 -15
  105. package/src/commands/dump/software.ts +9 -10
  106. package/src/commands/test.ts +15 -12
  107. package/src/compiler/artifactset.ts +7 -9
  108. package/src/compiler/compiler.test.ts +134 -137
  109. package/src/compiler/compiler.ts +62 -62
  110. package/src/compiler/compileroptions.ts +15 -15
  111. package/src/compiler/main.test.ts +23 -23
  112. package/src/compiler/main.ts +83 -100
  113. package/src/compiler/package.ts +14 -12
  114. package/src/compiler/source.test.ts +191 -183
  115. package/src/compiler/source.ts +106 -79
  116. package/src/compiler/template.test.ts +50 -49
  117. package/src/compiler/template.ts +11 -21
  118. package/src/compiler/test.artifacts.ts +47 -47
  119. package/src/compiler/util.ts +17 -17
  120. package/src/index.ts +10 -10
  121. package/src/shared/basecmd.ts +16 -16
  122. package/src/shared/dump.ts +49 -70
  123. package/src/shared/proc.ts +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","sources":["../../src/compiler/package.ts"],"sourcesContent":["/*\n Package \"@milaboratory/current-tengo-package\".\n\n Structure:\n\n src/\n local-template.pl.tengo <- this one will be compiled and put into ./dist/tengo/tpl/local-template.pl.pkg\n local-library.tengo <- this one will be normalized and put into ./dist/tengo/lib/local-library.tengo\n main.tpl.tengo <- this one will be compiled into ./dist/tengo/tpl/main.pl.pkg and published by external tool\n\n Code of \"main.tpl.tengo\":\n\n plapi := import(\"plapi\")\n\n plapi.getTemplateId(\"@milaboratory/some-tengo-template\") // -> getTemplateId(\"@milaboratory/some-tengo-template:main\")\n import(\"@milaboratory/some-tengo-library\") // -> import(\"@milaboratory/some-tengo-library:main\")\n\n */\n\nexport type CompileMode = 'dist';\n\nexport type CompilerOption = {\n /** Option name, like 'hash_override' */\n name: string; // we can't use strict literals typing here as we will break compatibility of the code through the lifetime of the compiler.\n\n /** Arguments of the option. Everything that follows option name */\n args: string[];\n};\n\nexport type ArtifactType = 'library' | 'template' | 'test' | 'software' | 'asset';\n\n/** Artifact Name including package version */\nexport interface FullArtifactName {\n /** Dependency type */\n type: ArtifactType;\n\n /** Fully qualified package */\n pkg: string;\n\n /** Id of the artifact inside the package */\n id: string;\n\n /** Package version */\n version: string;\n}\n\nexport type FullArtifactNameWithoutType = Omit<FullArtifactName, 'type'>;\n\nexport type TypedArtifactName = Pick<FullArtifactName, 'type' | 'pkg' | 'id'>;\n\nexport type PackageName = Pick<FullArtifactName, 'pkg' | 'version'>;\n\nexport type ArtifactName = Pick<FullArtifactName, 'pkg' | 'id'>;\n\nexport function artifactKey(name: TypedArtifactName): string {\n return `${name.type}||${name.pkg}||${name.id}`;\n}\n\nexport function fullNameToString(name: FullArtifactName): string {\n return `${name.type}:${name.pkg}:${name.id}:${name.version}`;\n}\n\n/** used for exceptions */\nexport function typedArtifactNameToString(name: TypedArtifactName): string {\n return `${name.type}:${name.pkg}:${name.id}`;\n}\n\nexport function typedArtifactNamesEquals(\n name1: TypedArtifactName,\n name2: TypedArtifactName,\n): boolean {\n return name1.type == name2.type && name1.pkg == name2.pkg && name1.id == name2.id;\n}\n\nexport function fullNameEquals(\n name1: FullArtifactName,\n name2: FullArtifactName,\n): boolean {\n return name1.type == name2.type && name1.pkg == name2.pkg && name1.id == name2.id && name1.version == name2.version;\n}\n\n/** used to format artefact name while generating output files */\nexport function artifactNameToString(name: ArtifactName): string {\n return `${name.pkg}:${name.id}`;\n}\n\n/** used to format artefact name and version while generating output files */\nexport function formatArtefactNameAndVersion(name: FullArtifactName): {\n name: string;\n version: string;\n} {\n return { name: artifactNameToString(name), version: name.version };\n}\n\n/** used to format artefact name and version while generating output files */\nexport function parseArtefactNameAndVersion(nameAndVersion: {\n name: string;\n version: string;\n}): FullArtifactNameWithoutType {\n const match = nameAndVersion.name.match(/^(?<pkg>[^:]*):(?<id>[^:]*)$/);\n if (!match) throw new Error(`malformed artifact name: ${nameAndVersion.name}`);\n return { pkg: match.groups!['pkg'], id: match.groups!['id'], version: nameAndVersion.version };\n}\n\nexport function fullNameWithoutTypeToString(name: FullArtifactNameWithoutType): string {\n return `${name.pkg}:${name.id}:${name.version}`;\n}\n\nexport function fullNameWithoutType(name: FullArtifactName): FullArtifactNameWithoutType {\n return { pkg: name.pkg, id: name.id, version: name.version };\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;AAiBG;AAqCG,SAAU,WAAW,CAAC,IAAuB,EAAA;AACjD,IAAA,OAAO,CAAA,EAAG,IAAI,CAAC,IAAI,CAAA,EAAA,EAAK,IAAI,CAAC,GAAG,CAAA,EAAA,EAAK,IAAI,CAAC,EAAE,EAAE;AAChD;AAEM,SAAU,gBAAgB,CAAC,IAAsB,EAAA;AACrD,IAAA,OAAO,GAAG,IAAI,CAAC,IAAI,CAAA,CAAA,EAAI,IAAI,CAAC,GAAG,CAAA,CAAA,EAAI,IAAI,CAAC,EAAE,CAAA,CAAA,EAAI,IAAI,CAAC,OAAO,EAAE;AAC9D;AAEA;AACM,SAAU,yBAAyB,CAAC,IAAuB,EAAA;AAC/D,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AI,CAAC,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE;AAChG;AAEM,SAAU,2BAA2B,CAAC,IAAiC,EAAA;AAC3E,IAAA,OAAO,CAAA,EAAG,IAAI,CAAC,GAAG,CAAA,CAAA,EAAI,IAAI,CAAC,EAAE,CAAA,CAAA,EAAI,IAAI,CAAC,OAAO,EAAE;AACjD;;;;"}
1
+ {"version":3,"file":"package.js","sources":["../../src/compiler/package.ts"],"sourcesContent":["/*\n Package \"@milaboratory/current-tengo-package\".\n\n Structure:\n\n src/\n local-template.pl.tengo <- this one will be compiled and put into ./dist/tengo/tpl/local-template.pl.pkg\n local-library.tengo <- this one will be normalized and put into ./dist/tengo/lib/local-library.tengo\n main.tpl.tengo <- this one will be compiled into ./dist/tengo/tpl/main.pl.pkg and published by external tool\n\n Code of \"main.tpl.tengo\":\n\n plapi := import(\"plapi\")\n\n plapi.getTemplateId(\"@milaboratory/some-tengo-template\") // -> getTemplateId(\"@milaboratory/some-tengo-template:main\")\n import(\"@milaboratory/some-tengo-library\") // -> import(\"@milaboratory/some-tengo-library:main\")\n\n */\n\nexport type CompileMode = \"dist\";\n\nexport type CompilerOption = {\n /** Option name, like 'hash_override' */\n name: string; // we can't use strict literals typing here as we will break compatibility of the code through the lifetime of the compiler.\n\n /** Arguments of the option. Everything that follows option name */\n args: string[];\n};\n\nexport type ArtifactType = \"library\" | \"template\" | \"test\" | \"software\" | \"asset\";\n\n/** Artifact Name including package version */\nexport interface FullArtifactName {\n /** Dependency type */\n type: ArtifactType;\n\n /** Fully qualified package */\n pkg: string;\n\n /** Id of the artifact inside the package */\n id: string;\n\n /** Package version */\n version: string;\n}\n\nexport type FullArtifactNameWithoutType = Omit<FullArtifactName, \"type\">;\n\nexport type TypedArtifactName = Pick<FullArtifactName, \"type\" | \"pkg\" | \"id\">;\n\nexport type PackageName = Pick<FullArtifactName, \"pkg\" | \"version\">;\n\nexport type ArtifactName = Pick<FullArtifactName, \"pkg\" | \"id\">;\n\nexport function artifactKey(name: TypedArtifactName): string {\n return `${name.type}||${name.pkg}||${name.id}`;\n}\n\nexport function fullNameToString(name: FullArtifactName): string {\n return `${name.type}:${name.pkg}:${name.id}:${name.version}`;\n}\n\n/** used for exceptions */\nexport function typedArtifactNameToString(name: TypedArtifactName): string {\n return `${name.type}:${name.pkg}:${name.id}`;\n}\n\nexport function typedArtifactNamesEquals(\n name1: TypedArtifactName,\n name2: TypedArtifactName,\n): boolean {\n return name1.type == name2.type && name1.pkg == name2.pkg && name1.id == name2.id;\n}\n\nexport function fullNameEquals(name1: FullArtifactName, name2: FullArtifactName): boolean {\n return (\n name1.type == name2.type &&\n name1.pkg == name2.pkg &&\n name1.id == name2.id &&\n name1.version == name2.version\n );\n}\n\n/** used to format artefact name while generating output files */\nexport function artifactNameToString(name: ArtifactName): string {\n return `${name.pkg}:${name.id}`;\n}\n\n/** used to format artefact name and version while generating output files */\nexport function formatArtefactNameAndVersion(name: FullArtifactName): {\n name: string;\n version: string;\n} {\n return { name: artifactNameToString(name), version: name.version };\n}\n\n/** used to format artefact name and version while generating output files */\nexport function parseArtefactNameAndVersion(nameAndVersion: {\n name: string;\n version: string;\n}): FullArtifactNameWithoutType {\n const match = nameAndVersion.name.match(/^(?<pkg>[^:]*):(?<id>[^:]*)$/);\n if (!match) throw new Error(`malformed artifact name: ${nameAndVersion.name}`);\n return { pkg: match.groups![\"pkg\"], id: match.groups![\"id\"], version: nameAndVersion.version };\n}\n\nexport function fullNameWithoutTypeToString(name: FullArtifactNameWithoutType): string {\n return `${name.pkg}:${name.id}:${name.version}`;\n}\n\nexport function fullNameWithoutType(name: FullArtifactName): FullArtifactNameWithoutType {\n return { pkg: name.pkg, id: name.id, version: name.version };\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;AAiBG;AAqCG,SAAU,WAAW,CAAC,IAAuB,EAAA;AACjD,IAAA,OAAO,CAAA,EAAG,IAAI,CAAC,IAAI,CAAA,EAAA,EAAK,IAAI,CAAC,GAA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CAAC,cAG3C,EAAA;IACC,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC;AACvE,IAAA,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,cAAc,CAAC,IAAI,CAAA,CAAE,CAAC;IAC9E,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,MAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,MAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE;AAChG;AAEM,SAAU,2BAA2B,CAAC,IAAiC,EAAA;AAC3E,IAAA,OAAO,CAAA,EAAG,IAAI,CAAC,GAAG,CAAA,CAAA,EAAI,IAAI,CAAC,EAAE,CAAA,CAAA,EAAI,IAAI,CAAC,OAAO,EAAE;AACjD;;;;"}
@@ -6,25 +6,23 @@ var artifactset = require('./artifactset.cjs');
6
6
  var node_crypto = require('node:crypto');
7
7
 
8
8
  // matches any valid name in tengo. Don't forget to use '\b' when needed to limit the boundaries!
9
- const namePattern = '[_a-zA-Z][_a-zA-Z0-9]*';
9
+ const namePattern = "[_a-zA-Z][_a-zA-Z0-9]*";
10
10
  const functionCallRE = (moduleName, fnName) => {
11
- return new RegExp(`\\b${moduleName}\\.(?<fnCall>(?<fnName>`
12
- + fnName
13
- + `)\\s*\\(\\s*"(?<templateName>[^"]+)"\\s*\\))`, 'g');
11
+ return new RegExp(`\\b${moduleName}\\.(?<fnCall>(?<fnName>` +
12
+ fnName +
13
+ `)\\s*\\(\\s*"(?<templateName>[^"]+)"\\s*\\))`, "g");
14
14
  };
15
15
  const functionCallLikeRE = (moduleName, fnName) => {
16
- return new RegExp(`\\b${moduleName}\\.(?<fnName>`
17
- + fnName
18
- + `)\\s*\\(`, 'g');
16
+ return new RegExp(`\\b${moduleName}\\.(?<fnName>` + fnName + `)\\s*\\(`, "g");
19
17
  };
20
- const newGetTemplateIdRE = (moduleName) => functionCallRE(moduleName, 'getTemplateId');
21
- const newGetSoftwareInfoRE = (moduleName) => functionCallRE(moduleName, 'getSoftwareInfo');
22
- const newImportTemplateRE = (moduleName) => functionCallRE(moduleName, 'importTemplate');
23
- const newImportTemplateDetector = (moduleName) => functionCallLikeRE(moduleName, 'importTemplate');
24
- const newImportSoftwareRE = (moduleName) => functionCallRE(moduleName, 'importSoftware');
25
- const newImportSoftwareDetector = (moduleName) => functionCallLikeRE(moduleName, 'importSoftware');
26
- const newImportAssetRE = (moduleName) => functionCallRE(moduleName, 'importAsset');
27
- const newImportAssetDetector = (moduleName) => functionCallLikeRE(moduleName, 'importAsset');
18
+ const newGetTemplateIdRE = (moduleName) => functionCallRE(moduleName, "getTemplateId");
19
+ const newGetSoftwareInfoRE = (moduleName) => functionCallRE(moduleName, "getSoftwareInfo");
20
+ const newImportTemplateRE = (moduleName) => functionCallRE(moduleName, "importTemplate");
21
+ const newImportTemplateDetector = (moduleName) => functionCallLikeRE(moduleName, "importTemplate");
22
+ const newImportSoftwareRE = (moduleName) => functionCallRE(moduleName, "importSoftware");
23
+ const newImportSoftwareDetector = (moduleName) => functionCallLikeRE(moduleName, "importSoftware");
24
+ const newImportAssetRE = (moduleName) => functionCallRE(moduleName, "importAsset");
25
+ const newImportAssetDetector = (moduleName) => functionCallLikeRE(moduleName, "importAsset");
28
26
  const emptyLineRE = /^\s*$/;
29
27
  const compilerOptionRE = /^\/\/tengo:[\w]/;
30
28
  const wrongCompilerOptionRE = /^\s*\/\/\s*tengo:\s*./;
@@ -47,10 +45,10 @@ const dependencyRE = /(?<pkgName>[^"]+)?:(?<depID>[^"]+)/; // use it to parse <m
47
45
  * //tengo:<option name> [<option arg1> [<option arg 2> [...]]]
48
46
  */
49
47
  const parseComplierOption = (opt) => {
50
- const parts = opt.split(' ');
51
- const namePart = parts[0].split(':');
48
+ const parts = opt.split(" ");
49
+ const namePart = parts[0].split(":");
52
50
  if (namePart.length != 2) {
53
- throw new Error('compiler option format is wrong: expect to have option name after \'tengo:\' prefix, like \'tengo:MyOption\'');
51
+ throw new Error("compiler option format is wrong: expect to have option name after 'tengo:' prefix, like 'tengo:MyOption'");
54
52
  }
55
53
  const optName = namePart[1];
56
54
  return {
@@ -106,7 +104,7 @@ function parseSourceData(logger, src, fullSourceName, globalizeImports) {
106
104
  const dependencySet = artifactset.createArtifactNameSet();
107
105
  const optionList = [];
108
106
  // iterating over lines
109
- const lines = src.split('\n');
107
+ const lines = src.split("\n");
110
108
  // processedLines keep all the original lines from <src>.
111
109
  // If <globalizeImport>==true, the parser modifies 'import' and 'getTemplateId' lines
112
110
  // with Platforma Tengo lib and template usages, resolving local names (":<item>") to
@@ -117,13 +115,13 @@ function parseSourceData(logger, src, fullSourceName, globalizeImports) {
117
115
  canDetectOptions: true,
118
116
  artifactImportREs: new Map(),
119
117
  importLikeREs: new Map(),
120
- multilineStatement: '',
118
+ multilineStatement: "",
121
119
  lineNo: 0,
122
120
  };
123
121
  for (const line of lines) {
124
122
  parserContext.lineNo++;
125
123
  try {
126
- const { line: processedLine, context: newContext, artifacts, option } = parseSingleSourceLine(logger, line, parserContext, fullSourceName.pkg, globalizeImports);
124
+ const { line: processedLine, context: newContext, artifacts, option, } = parseSingleSourceLine(logger, line, parserContext, fullSourceName.pkg, globalizeImports);
127
125
  processedLines.push(processedLine);
128
126
  parserContext = newContext;
129
127
  for (const artifact of artifacts ?? []) {
@@ -139,7 +137,7 @@ function parseSourceData(logger, src, fullSourceName, globalizeImports) {
139
137
  }
140
138
  }
141
139
  return {
142
- normalized: processedLines.join('\n'),
140
+ normalized: processedLines.join("\n"),
143
141
  deps: dependencySet,
144
142
  opts: optionList,
145
143
  };
@@ -149,12 +147,12 @@ function parseSingleSourceLine(logger, line, context, localPackageName, globaliz
149
147
  if (multilineCommentEndRE.exec(line)) {
150
148
  context.isInCommentBlock = false;
151
149
  }
152
- return { line: '', context, artifacts: [], option: undefined };
150
+ return { line: "", context, artifacts: [], option: undefined };
153
151
  }
154
152
  if (compilerOptionRE.exec(line)) {
155
153
  if (!context.canDetectOptions) {
156
154
  logger.error(`[line ${context.lineNo}]: compiler option '//tengo:' was detected, but it cannot be applied as compiler options can be set only at the file header, before any code line'`);
157
- throw new Error('tengo compiler options (\'//tengo:\' comments) can be set only in file header');
155
+ throw new Error("tengo compiler options ('//tengo:' comments) can be set only in file header");
158
156
  }
159
157
  return { line, context, artifacts: [], option: parseComplierOption(line) };
160
158
  }
@@ -163,15 +161,15 @@ function parseSingleSourceLine(logger, line, context, localPackageName, globaliz
163
161
  return { line, context, artifacts: [], option: undefined };
164
162
  }
165
163
  if (singlelineCommentRE.test(line) || singlelineTerminatedCommentRE.test(line)) {
166
- return { line: '', context, artifacts: [], option: undefined };
164
+ return { line: "", context, artifacts: [], option: undefined };
167
165
  }
168
- const canBeInlinedComment = line.includes('*/');
166
+ const canBeInlinedComment = line.includes("*/");
169
167
  if (multilineCommentStartRE.exec(line) && !canBeInlinedComment) {
170
168
  context.isInCommentBlock = true;
171
- return { line: '', context, artifacts: [], option: undefined };
169
+ return { line: "", context, artifacts: [], option: undefined };
172
170
  }
173
171
  const statement = context.multilineStatement + line.trim();
174
- const mayContainAComment = line.includes('//') || line.includes('/*');
172
+ const mayContainAComment = line.includes("//") || line.includes("/*");
175
173
  if (multilineStatementRE.test(line) && !mayContainAComment) {
176
174
  // We accumulate multiline statements into single line before analyzing them.
177
175
  // This dramatically simplifies parsing logic: things like
@@ -199,7 +197,7 @@ function parseSingleSourceLine(logger, line, context, localPackageName, globaliz
199
197
  context.multilineStatement += result.line.trim(); // accumulate the line after imports globalization.
200
198
  return result;
201
199
  }
202
- context.multilineStatement = ''; // reset accumulated multiline statement parts once we reach statement end.
200
+ context.multilineStatement = ""; // reset accumulated multiline statement parts once we reach statement end.
203
201
  if (emptyLineRE.exec(statement)) {
204
202
  return { line, context, artifacts: [], option: undefined };
205
203
  }
@@ -211,46 +209,46 @@ function processModuleImport(importInstruction, originalLine, statement, context
211
209
  const iInfo = parseImport(statement);
212
210
  // If we have plapi, ll or assets, then try to parse
213
211
  // getTemplateId, getSoftwareInfo, getSoftware and getAsset calls.
214
- if (iInfo.module === 'plapi') {
212
+ if (iInfo.module === "plapi") {
215
213
  if (!context.artifactImportREs.has(iInfo.module)) {
216
214
  context.artifactImportREs.set(iInfo.module, [
217
- ['template', newGetTemplateIdRE(iInfo.alias)],
218
- ['software', newGetSoftwareInfoRE(iInfo.alias)],
215
+ ["template", newGetTemplateIdRE(iInfo.alias)],
216
+ ["software", newGetSoftwareInfoRE(iInfo.alias)],
219
217
  ]);
220
218
  }
221
219
  return { line: originalLine, context, artifacts: [], option: undefined };
222
220
  }
223
- if (iInfo.module === '@milaboratory/tengo-sdk:ll'
224
- || iInfo.module === '@platforma-sdk/workflow-tengo:ll'
225
- || ((localPackageName === '@milaboratory/tengo-sdk'
226
- || localPackageName === '@platforma-sdk/workflow-tengo')
227
- && iInfo.module === ':ll')) {
221
+ if (iInfo.module === "@milaboratory/tengo-sdk:ll" ||
222
+ iInfo.module === "@platforma-sdk/workflow-tengo:ll" ||
223
+ ((localPackageName === "@milaboratory/tengo-sdk" ||
224
+ localPackageName === "@platforma-sdk/workflow-tengo") &&
225
+ iInfo.module === ":ll")) {
228
226
  if (!context.artifactImportREs.has(iInfo.module)) {
229
227
  context.artifactImportREs.set(iInfo.module, [
230
- ['template', newImportTemplateRE(iInfo.alias)],
231
- ['software', newImportSoftwareRE(iInfo.alias)],
228
+ ["template", newImportTemplateRE(iInfo.alias)],
229
+ ["software", newImportSoftwareRE(iInfo.alias)],
232
230
  ]);
233
231
  }
234
232
  }
235
- if (iInfo.module === '@milaboratory/tengo-sdk:assets'
236
- || iInfo.module === '@platforma-sdk/workflow-tengo:assets'
237
- || ((localPackageName === '@milaboratory/tengo-sdk'
238
- || localPackageName === '@platforma-sdk/workflow-tengo')
239
- && iInfo.module === ':assets')) {
233
+ if (iInfo.module === "@milaboratory/tengo-sdk:assets" ||
234
+ iInfo.module === "@platforma-sdk/workflow-tengo:assets" ||
235
+ ((localPackageName === "@milaboratory/tengo-sdk" ||
236
+ localPackageName === "@platforma-sdk/workflow-tengo") &&
237
+ iInfo.module === ":assets")) {
240
238
  if (!context.artifactImportREs.has(iInfo.module)) {
241
239
  context.artifactImportREs.set(iInfo.module, [
242
- ['template', newImportTemplateRE(iInfo.alias)],
243
- ['software', newImportSoftwareRE(iInfo.alias)],
244
- ['asset', newImportAssetRE(iInfo.alias)],
240
+ ["template", newImportTemplateRE(iInfo.alias)],
241
+ ["software", newImportSoftwareRE(iInfo.alias)],
242
+ ["asset", newImportAssetRE(iInfo.alias)],
245
243
  ]);
246
244
  context.importLikeREs.set(iInfo.module, [
247
- ['template', newImportTemplateDetector(iInfo.alias)],
248
- ['software', newImportSoftwareDetector(iInfo.alias)],
249
- ['asset', newImportAssetDetector(iInfo.alias)],
245
+ ["template", newImportTemplateDetector(iInfo.alias)],
246
+ ["software", newImportSoftwareDetector(iInfo.alias)],
247
+ ["asset", newImportAssetDetector(iInfo.alias)],
250
248
  ]);
251
249
  }
252
250
  }
253
- const artifact = parseArtifactName(iInfo.module, 'library', localPackageName);
251
+ const artifact = parseArtifactName(iInfo.module, "library", localPackageName);
254
252
  if (!artifact) {
255
253
  // not a Platforma Tengo library import
256
254
  return { line: originalLine, context, artifacts: [], option: undefined };
@@ -344,7 +342,7 @@ function parseArtifactName(moduleName, aType, localPackageName) {
344
342
  return { type: aType, pkg: pkgName ?? localPackageName, id: depID };
345
343
  }
346
344
  function getSha256(source) {
347
- return node_crypto.createHash('sha256').update(source).digest('hex');
345
+ return node_crypto.createHash("sha256").update(source).digest("hex");
348
346
  }
349
347
 
350
348
  exports.ArtifactSource = ArtifactSource;
@@ -1 +1 @@
1
- {"version":3,"file":"source.cjs","sources":["../../src/compiler/source.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport {\n type TypedArtifactName,\n type FullArtifactName,\n type ArtifactType,\n type CompileMode,\n type CompilerOption,\n fullNameToString,\n} from './package';\nimport type { ArtifactMap } from './artifactset';\nimport { createArtifactNameSet } from './artifactset';\nimport { createHash } from 'node:crypto';\nimport type { MiLogger } from '@milaboratories/ts-helpers';\n\n// matches any valid name in tengo. Don't forget to use '\\b' when needed to limit the boundaries!\nconst namePattern = '[_a-zA-Z][_a-zA-Z0-9]*';\n\nconst functionCallRE = (moduleName: string, fnName: string) => {\n return new RegExp(\n `\\\\b${moduleName}\\\\.(?<fnCall>(?<fnName>`\n + fnName\n + `)\\\\s*\\\\(\\\\s*\"(?<templateName>[^\"]+)\"\\\\s*\\\\))`,\n 'g',\n );\n};\n\nconst functionCallLikeRE = (moduleName: string, fnName: string) => {\n return new RegExp(\n `\\\\b${moduleName}\\\\.(?<fnName>`\n + fnName\n + `)\\\\s*\\\\(`,\n 'g',\n );\n};\n\nexport const newGetTemplateIdRE = (moduleName: string) => functionCallRE(moduleName, 'getTemplateId');\nexport const newGetSoftwareInfoRE = (moduleName: string) => functionCallRE(moduleName, 'getSoftwareInfo');\n\nconst newImportTemplateRE = (moduleName: string) => functionCallRE(moduleName, 'importTemplate');\nconst newImportTemplateDetector = (moduleName: string) => functionCallLikeRE(moduleName, 'importTemplate');\nconst newImportSoftwareRE = (moduleName: string) => functionCallRE(moduleName, 'importSoftware');\nconst newImportSoftwareDetector = (moduleName: string) => functionCallLikeRE(moduleName, 'importSoftware');\nconst newImportAssetRE = (moduleName: string) => functionCallRE(moduleName, 'importAsset');\nconst newImportAssetDetector = (moduleName: string) => functionCallLikeRE(moduleName, 'importAsset');\n\nconst emptyLineRE = /^\\s*$/;\nconst compilerOptionRE = /^\\/\\/tengo:[\\w]/;\nconst wrongCompilerOptionRE = /^\\s*\\/\\/\\s*tengo:\\s*./;\nconst singlelineCommentRE = /^\\s*(\\/\\/)/;\nconst singlelineTerminatedCommentRE = /^\\s*\\/\\*.*\\*\\/\\s*$/; // matches '^/* ... */$' comment lines as a special case of singleline comments.\nconst multilineCommentStartRE = /^\\s*\\/\\*/;\nconst multilineCommentEndRE = /\\*\\//;\nconst multilineStatementRE = /[.,]\\s*$/; // it is hard to consistently treat (\\n\"a\"\\n) multiline statements, we forbid them for now.\n\n// import could only be an assignment in a statement,\n// other ways could break a compilation.\nconst importRE = /\\s*:=\\s*import\\s*\\(\\s*\"(?<moduleName>[^\"]+)\"\\s*\\)/;\nconst importNameRE = new RegExp(\n `\\\\b(?<importName>${namePattern}(\\\\.${namePattern})*)${importRE.source}`,\n);\nconst dependencyRE = /(?<pkgName>[^\"]+)?:(?<depID>[^\"]+)/; // use it to parse <moduleName> from importPattern or <templateName> from getTemplateID\n\n/**\n * Parse compiler option string representation\n * Compiler option line is a comment starting with '//tengo:', say\n * //tengo:hash_override tralala\n *\n * The common compiler option syntax is:\n * //tengo:<option name> [<option arg1> [<option arg 2> [...]]]\n */\nconst parseComplierOption = (opt: string): CompilerOption => {\n const parts = opt.split(' ');\n const namePart = parts[0].split(':');\n if (namePart.length != 2) {\n throw new Error(\n 'compiler option format is wrong: expect to have option name after \\'tengo:\\' prefix, like \\'tengo:MyOption\\'',\n );\n }\n const optName = namePart[1];\n\n return {\n name: optName,\n args: parts.slice(1),\n };\n};\n\nexport class ArtifactSource {\n constructor(\n /** The mode this artifact was built (dev or dist) */\n public readonly compileMode: CompileMode,\n /** Full artifact id, including package version */\n public readonly fullName: FullArtifactName,\n /** Hash of the source code */\n public readonly sourceHash: string,\n /** Normalized source code */\n public readonly src: string,\n /** Path to source file where artifact came from */\n public readonly srcName: string,\n /** List of dependencies */\n public readonly dependencies: TypedArtifactName[],\n /** Additional compiler options detected in source code */\n public readonly compilerOptions: CompilerOption[],\n ) {}\n}\n\nexport function parseSourceFile(\n logger: MiLogger,\n mode: CompileMode,\n srcFile: string,\n fullSourceName: FullArtifactName,\n normalize: boolean,\n): ArtifactSource {\n const src = readFileSync(srcFile).toString();\n const { deps, normalized, opts } = parseSourceData(logger, src, fullSourceName, normalize);\n\n return new ArtifactSource(\n mode,\n fullSourceName,\n getSha256(normalized),\n normalized,\n srcFile,\n deps.array,\n opts,\n );\n}\n\nexport function parseSource(\n logger: MiLogger,\n mode: CompileMode,\n src: string,\n fullSourceName: FullArtifactName,\n normalize: boolean,\n): ArtifactSource {\n const { deps, normalized, opts } = parseSourceData(logger, src, fullSourceName, normalize);\n\n return new ArtifactSource(mode, fullSourceName, getSha256(normalized), normalized, '', deps.array, opts);\n}\n\n/**\n * Reads src\n * returns normalized source code,\n * gets dependencies from imports,\n * maps imports to global names if globalizeImports is true,\n * and collects compiler options like hashOverride.\n */\nfunction parseSourceData(\n logger: MiLogger,\n src: string,\n fullSourceName: FullArtifactName,\n globalizeImports: boolean,\n): {\n normalized: string;\n deps: ArtifactMap<TypedArtifactName>;\n opts: CompilerOption[];\n } {\n const dependencySet = createArtifactNameSet();\n const optionList: CompilerOption[] = [];\n\n // iterating over lines\n const lines = src.split('\\n');\n\n // processedLines keep all the original lines from <src>.\n // If <globalizeImport>==true, the parser modifies 'import' and 'getTemplateId' lines\n // with Platforma Tengo lib and template usages, resolving local names (\":<item>\") to\n // global (\"@milaboratory/pkg:<item>\")\n const processedLines: string[] = [];\n let parserContext: sourceParserContext = {\n isInCommentBlock: false,\n canDetectOptions: true,\n artifactImportREs: new Map<string, [ArtifactType, RegExp][]>(),\n importLikeREs: new Map<string, [ArtifactType, RegExp][]>(),\n multilineStatement: '',\n lineNo: 0,\n };\n\n for (const line of lines) {\n parserContext.lineNo++;\n\n try {\n const { line: processedLine, context: newContext, artifacts, option } = parseSingleSourceLine(\n logger,\n line,\n parserContext,\n fullSourceName.pkg,\n globalizeImports,\n );\n processedLines.push(processedLine);\n parserContext = newContext;\n\n for (const artifact of artifacts ?? []) {\n dependencySet.add(artifact);\n }\n if (option) {\n optionList.push(option);\n }\n } catch (error: unknown) {\n const err = error as Error;\n throw new Error(`[line ${parserContext.lineNo} in ${fullNameToString(fullSourceName)}]: ${err.message}\\n\\t${line}`, { cause: err });\n }\n }\n\n return {\n normalized: processedLines.join('\\n'),\n deps: dependencySet,\n opts: optionList,\n };\n}\n\nexport type sourceParserContext = {\n isInCommentBlock: boolean;\n canDetectOptions: boolean;\n artifactImportREs: Map<string, [ArtifactType, RegExp][]>;\n importLikeREs: Map<string, [ArtifactType, RegExp][]>;\n multilineStatement: string;\n lineNo: number;\n};\n\nexport type lineProcessingResult = {\n line: string;\n context: sourceParserContext;\n artifacts: TypedArtifactName[];\n option: CompilerOption | undefined;\n};\n\nexport function parseSingleSourceLine(\n logger: MiLogger,\n line: string,\n context: sourceParserContext,\n localPackageName: string,\n globalizeImports?: boolean,\n): lineProcessingResult {\n if (context.isInCommentBlock) {\n if (multilineCommentEndRE.exec(line)) {\n context.isInCommentBlock = false;\n }\n return { line: '', context, artifacts: [], option: undefined };\n }\n\n if (compilerOptionRE.exec(line)) {\n if (!context.canDetectOptions) {\n logger.error(\n `[line ${context.lineNo}]: compiler option '//tengo:' was detected, but it cannot be applied as compiler options can be set only at the file header, before any code line'`,\n );\n throw new Error('tengo compiler options (\\'//tengo:\\' comments) can be set only in file header');\n }\n return { line, context, artifacts: [], option: parseComplierOption(line) };\n }\n\n if (wrongCompilerOptionRE.exec(line) && context.canDetectOptions) {\n logger.warn(\n `[line ${context.lineNo}]: text simillar to compiler option ('//tengo:...') was detected, but it has wrong format. Leave it as is, if you did not mean to use a line as compiler option. Or format it to '//tengo:<option>' otherwise (no spaces between '//' and 'tengo', no spaces between ':' and option name)`,\n );\n return { line, context, artifacts: [], option: undefined };\n }\n\n if (singlelineCommentRE.test(line) || singlelineTerminatedCommentRE.test(line)) {\n return { line: '', context, artifacts: [], option: undefined };\n }\n\n const canBeInlinedComment = line.includes('*/');\n if (multilineCommentStartRE.exec(line) && !canBeInlinedComment) {\n context.isInCommentBlock = true;\n return { line: '', context, artifacts: [], option: undefined };\n }\n\n const statement = context.multilineStatement + line.trim();\n\n const mayContainAComment = line.includes('//') || line.includes('/*');\n if (multilineStatementRE.test(line) && !mayContainAComment) {\n // We accumulate multiline statements into single line before analyzing them.\n // This dramatically simplifies parsing logic: things like\n //\n // assets.\n // importSoftware(\"a:b\");\n //\n // become simple 'assets.importSoftware(\"a:b\");' for parser checks.\n //\n // For safety reasons, we never consider anything that 'may look like a comment'\n // as a part of multiline statement to prevent joining things like\n //\n // someFnCall() // looks like multiline statement because of dot in the end of a comment.\n //\n // This problem also appears in multiline string literals, but I hope this will not\n // cause problems in real life.\n\n // We still try to process each line to globalize imports in case of complex constructions, when\n // statements are stacked one into another:\n // a.\n // use(assets.importSoftware(\":soft1\")).\n // use(assets.importSoftware(\":soft2\")).\n // run()\n // It is multiline, and it still requires import globalization mid-way, not just for the last line of statement\n const result = processAssetImport(line, statement, context, localPackageName, globalizeImports);\n context.multilineStatement += result.line.trim(); // accumulate the line after imports globalization.\n return result;\n }\n\n context.multilineStatement = ''; // reset accumulated multiline statement parts once we reach statement end.\n\n if (emptyLineRE.exec(statement)) {\n return { line, context, artifacts: [], option: undefined };\n }\n\n // options could be only at the top of the file.\n context.canDetectOptions = false;\n\n return processAssetImport(line, statement, context, localPackageName, globalizeImports);\n}\n\nfunction processModuleImport(\n importInstruction: RegExpExecArray,\n originalLine: string,\n statement: string,\n context: sourceParserContext,\n localPackageName: string,\n globalizeImports?: boolean,\n): lineProcessingResult {\n const iInfo = parseImport(statement);\n\n // If we have plapi, ll or assets, then try to parse\n // getTemplateId, getSoftwareInfo, getSoftware and getAsset calls.\n\n if (iInfo.module === 'plapi') {\n if (!context.artifactImportREs.has(iInfo.module)) {\n context.artifactImportREs.set(iInfo.module, [\n ['template', newGetTemplateIdRE(iInfo.alias)],\n ['software', newGetSoftwareInfoRE(iInfo.alias)],\n ]);\n }\n return { line: originalLine, context, artifacts: [], option: undefined };\n }\n\n if (\n iInfo.module === '@milaboratory/tengo-sdk:ll'\n || iInfo.module === '@platforma-sdk/workflow-tengo:ll'\n || ((localPackageName === '@milaboratory/tengo-sdk'\n || localPackageName === '@platforma-sdk/workflow-tengo')\n && iInfo.module === ':ll')\n ) {\n if (!context.artifactImportREs.has(iInfo.module)) {\n context.artifactImportREs.set(iInfo.module, [\n ['template', newImportTemplateRE(iInfo.alias)],\n ['software', newImportSoftwareRE(iInfo.alias)],\n ]);\n }\n }\n\n if (\n iInfo.module === '@milaboratory/tengo-sdk:assets'\n || iInfo.module === '@platforma-sdk/workflow-tengo:assets'\n || ((localPackageName === '@milaboratory/tengo-sdk'\n || localPackageName === '@platforma-sdk/workflow-tengo')\n && iInfo.module === ':assets')\n ) {\n if (!context.artifactImportREs.has(iInfo.module)) {\n context.artifactImportREs.set(iInfo.module, [\n ['template', newImportTemplateRE(iInfo.alias)],\n ['software', newImportSoftwareRE(iInfo.alias)],\n ['asset', newImportAssetRE(iInfo.alias)],\n ]);\n context.importLikeREs.set(iInfo.module, [\n ['template', newImportTemplateDetector(iInfo.alias)],\n ['software', newImportSoftwareDetector(iInfo.alias)],\n ['asset', newImportAssetDetector(iInfo.alias)],\n ]);\n }\n }\n\n const artifact = parseArtifactName(iInfo.module, 'library', localPackageName);\n if (!artifact) {\n // not a Platforma Tengo library import\n return { line: originalLine, context, artifacts: [], option: undefined };\n }\n\n if (globalizeImports) {\n originalLine = originalLine.replace(importInstruction[0], ` := import(\"${artifact.pkg}:${artifact.id}\")`);\n }\n\n return { line: originalLine, context, artifacts: [artifact], option: undefined };\n}\n\nfunction processAssetImport(\n originalLine: string,\n statement: string,\n context: sourceParserContext,\n localPackageName: string,\n globalizeImports?: boolean,\n): lineProcessingResult {\n if (emptyLineRE.exec(statement)) {\n return { line: originalLine, context, artifacts: [], option: undefined };\n }\n\n // options could be only at the top of the file.\n context.canDetectOptions = false;\n\n const importInstruction = importRE.exec(statement);\n\n if (importInstruction) {\n return processModuleImport(importInstruction, originalLine, statement, context, localPackageName, globalizeImports);\n }\n\n if (context.artifactImportREs.size > 0) {\n for (const [_, artifactRE] of context.artifactImportREs) {\n for (const [artifactType, re] of artifactRE) {\n // Find all matches in the statement\n const matches = Array.from(statement.matchAll(re));\n if (matches.length === 0) {\n continue;\n }\n\n const artifacts: TypedArtifactName[] = [];\n for (let i = matches.length - 1; i >= 0; i--) {\n const match = matches[i];\n if (!match || !match.groups) {\n continue;\n }\n\n const { fnCall, templateName, fnName } = match.groups;\n\n if (!fnCall || !templateName || !fnName) {\n throw Error(`failed to parse template import statement`);\n }\n\n const artifact = parseArtifactName(templateName, artifactType, localPackageName);\n if (!artifact) {\n throw Error(`failed to parse artifact name in ${fnName} import statement`);\n }\n artifacts.push(artifact);\n\n if (globalizeImports) {\n // Replace all occurrences of this fnCall in originalLine\n originalLine = originalLine.replaceAll(fnCall, `${fnName}(\"${artifact.pkg}:${artifact.id}\")`);\n }\n }\n\n return { line: originalLine, context, artifacts, option: undefined };\n }\n }\n }\n\n if (context.importLikeREs.size > 0) {\n for (const [_, artifactRE] of context.importLikeREs) {\n for (const [artifactType, re] of artifactRE) {\n const match = re.exec(statement);\n if (!match || !match.groups) {\n continue;\n }\n\n throw Error(`incorrect '${artifactType}' import statement: use string literal as ID (variables are not allowed) in the same line with brackets (i.e. 'importSoftware(\"sw:main\")').`);\n }\n }\n }\n\n return { line: originalLine, context, artifacts: [], option: undefined };\n}\n\ninterface ImportInfo {\n module: string; // the module name without wrapping quotes: import(\"<module>\")\n alias: string; // the name of variable that keeps imported module: <alias> := import(\"<module>\")\n}\n\nfunction parseImport(line: string): ImportInfo {\n const match = importNameRE.exec(line);\n\n if (!match || !match.groups) {\n throw Error(`failed to parse 'import' statement`);\n }\n\n const { importName, moduleName } = match.groups;\n if (!importName || !moduleName) {\n throw Error(`failed to parse 'import' statement`);\n }\n\n return {\n module: moduleName, // the module name without wrapping quotes: import(\"<module>\")\n alias: importName, // the name of variable that keeps imported module: <alias> := import(\"<module>\")\n };\n}\n\nfunction parseArtifactName(\n moduleName: string,\n aType: ArtifactType,\n localPackageName: string,\n): TypedArtifactName | undefined {\n const depInfo = dependencyRE.exec(moduleName);\n if (!depInfo) {\n return;\n }\n\n if (!depInfo.groups) {\n throw Error(\n `failed to parse dependency name inside 'import' statement. The dependency name should have format '<package>:<templateName>'`,\n );\n }\n\n const { pkgName, depID } = depInfo.groups;\n if (!depID) {\n throw Error(\n `failed to parse dependency name inside 'import' statement. The dependency name should have format '<package>:<templateName>'`,\n );\n }\n\n return { type: aType, pkg: pkgName ?? localPackageName, id: depID };\n}\n\nexport function getSha256(source: string): string {\n return createHash('sha256').update(source).digest('hex');\n}\n"],"names":["readFileSync","createArtifactNameSet","fullNameToString","createHash"],"mappings":";;;;;;;AAcA;AACA,MAAM,WAAW,GAAG,wBAAwB;AAE5C,MAAM,cAAc,GAAG,CAAC,UAAkB,EAAE,MAAc,KAAI;AAC5D,IAAA,OAAO,IAAI,MAAM,CACf,CAAA,GAAA,EAAM,UAAU,CAAA,uBAAA;UACd;UACA,CAAA,4CAAA,CAA8C,EAChD,GAAG,CACJ;AACH,CAAC;AAED,MAAM,kBAAkB,GAAG,CAAC,UAAkB,EAAE,MAAc,KAAI;AAChE,IAAA,OAAO,IAAI,MAAM,CACf,CAAA,GAAA,EAAM,UAAU,CAAA,aAAA;UACd;UACA,CAAA,QAAA,CAAU,EACZ,GAAG,CACJ;AACH,CAAC;AAEM,MAAM,kBAAkB,GAAG,CAAC,UAAkB,KAAK,cAAc,CAAC,UAAU,EAAE,eAAe;AAC7F,MAAM,oBAAoB,GAAG,CAAC,UAAkB,KAAK,cAAc,CAAC,UAAU,EAAE,iBAAiB;AAExG,MAAM,mBAAmB,GAAG,CAAC,UAAkB,KAAK,cAAc,CAAC,UAAU,EAAE,gBAAgB,CAAC;AAChG,MAAM,yBAAyB,GAAG,CAAC,UAAkB,KAAK,kBAAkB,CAAC,UAAU,EAAE,gBAAgB,CAAC;AAC1G,MAAM,mBAAmB,GAAG,CAAC,UAAkB,KAAK,cAAc,CAAC,UAAU,EAAE,gBAAgB,CAAC;AAChG,MAAM,yBAAyB,GAAG,CAAC,UAAkB,KAAK,kBAAkB,CAAC,UAAU,EAAE,gBAAgB,CAAC;AAC1G,MAAM,gBAAgB,GAAG,CAAC,UAAkB,KAAK,c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../src/compiler/source.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport {\n type TypedArtifactName,\n type FullArtifactName,\n type ArtifactType,\n type CompileMode,\n type CompilerOption,\n fullNameToString,\n} from \"./package\";\nimport type { ArtifactMap } from \"./artifactset\";\nimport { createArtifactNameSet } from \"./artifactset\";\nimport { createHash } from \"node:crypto\";\nimport type { MiLogger } from \"@milaboratories/ts-helpers\";\n\n// matches any valid name in tengo. Don't forget to use '\\b' when needed to limit the boundaries!\nconst namePattern = \"[_a-zA-Z][_a-zA-Z0-9]*\";\n\nconst functionCallRE = (moduleName: string, fnName: string) => {\n return new RegExp(\n `\\\\b${moduleName}\\\\.(?<fnCall>(?<fnName>` +\n fnName +\n `)\\\\s*\\\\(\\\\s*\"(?<templateName>[^\"]+)\"\\\\s*\\\\))`,\n \"g\",\n );\n};\n\nconst functionCallLikeRE = (moduleName: string, fnName: string) => {\n return new RegExp(`\\\\b${moduleName}\\\\.(?<fnName>` + fnName + `)\\\\s*\\\\(`, \"g\");\n};\n\nexport const newGetTemplateIdRE = (moduleName: string) =>\n functionCallRE(moduleName, \"getTemplateId\");\nexport const newGetSoftwareInfoRE = (moduleName: string) =>\n functionCallRE(moduleName, \"getSoftwareInfo\");\n\nconst newImportTemplateRE = (moduleName: string) => functionCallRE(moduleName, \"importTemplate\");\nconst newImportTemplateDetector = (moduleName: string) =>\n functionCallLikeRE(moduleName, \"importTemplate\");\nconst newImportSoftwareRE = (moduleName: string) => functionCallRE(moduleName, \"importSoftware\");\nconst newImportSoftwareDetector = (moduleName: string) =>\n functionCallLikeRE(moduleName, \"importSoftware\");\nconst newImportAssetRE = (moduleName: string) => functionCallRE(moduleName, \"importAsset\");\nconst newImportAssetDetector = (moduleName: string) =>\n functionCallLikeRE(moduleName, \"importAsset\");\n\nconst emptyLineRE = /^\\s*$/;\nconst compilerOptionRE = /^\\/\\/tengo:[\\w]/;\nconst wrongCompilerOptionRE = /^\\s*\\/\\/\\s*tengo:\\s*./;\nconst singlelineCommentRE = /^\\s*(\\/\\/)/;\nconst singlelineTerminatedCommentRE = /^\\s*\\/\\*.*\\*\\/\\s*$/; // matches '^/* ... */$' comment lines as a special case of singleline comments.\nconst multilineCommentStartRE = /^\\s*\\/\\*/;\nconst multilineCommentEndRE = /\\*\\//;\nconst multilineStatementRE = /[.,]\\s*$/; // it is hard to consistently treat (\\n\"a\"\\n) multiline statements, we forbid them for now.\n\n// import could only be an assignment in a statement,\n// other ways could break a compilation.\nconst importRE = /\\s*:=\\s*import\\s*\\(\\s*\"(?<moduleName>[^\"]+)\"\\s*\\)/;\nconst importNameRE = new RegExp(\n `\\\\b(?<importName>${namePattern}(\\\\.${namePattern})*)${importRE.source}`,\n);\nconst dependencyRE = /(?<pkgName>[^\"]+)?:(?<depID>[^\"]+)/; // use it to parse <moduleName> from importPattern or <templateName> from getTemplateID\n\n/**\n * Parse compiler option string representation\n * Compiler option line is a comment starting with '//tengo:', say\n * //tengo:hash_override tralala\n *\n * The common compiler option syntax is:\n * //tengo:<option name> [<option arg1> [<option arg 2> [...]]]\n */\nconst parseComplierOption = (opt: string): CompilerOption => {\n const parts = opt.split(\" \");\n const namePart = parts[0].split(\":\");\n if (namePart.length != 2) {\n throw new Error(\n \"compiler option format is wrong: expect to have option name after 'tengo:' prefix, like 'tengo:MyOption'\",\n );\n }\n const optName = namePart[1];\n\n return {\n name: optName,\n args: parts.slice(1),\n };\n};\n\nexport class ArtifactSource {\n constructor(\n /** The mode this artifact was built (dev or dist) */\n public readonly compileMode: CompileMode,\n /** Full artifact id, including package version */\n public readonly fullName: FullArtifactName,\n /** Hash of the source code */\n public readonly sourceHash: string,\n /** Normalized source code */\n public readonly src: string,\n /** Path to source file where artifact came from */\n public readonly srcName: string,\n /** List of dependencies */\n public readonly dependencies: TypedArtifactName[],\n /** Additional compiler options detected in source code */\n public readonly compilerOptions: CompilerOption[],\n ) {}\n}\n\nexport function parseSourceFile(\n logger: MiLogger,\n mode: CompileMode,\n srcFile: string,\n fullSourceName: FullArtifactName,\n normalize: boolean,\n): ArtifactSource {\n const src = readFileSync(srcFile).toString();\n const { deps, normalized, opts } = parseSourceData(logger, src, fullSourceName, normalize);\n\n return new ArtifactSource(\n mode,\n fullSourceName,\n getSha256(normalized),\n normalized,\n srcFile,\n deps.array,\n opts,\n );\n}\n\nexport function parseSource(\n logger: MiLogger,\n mode: CompileMode,\n src: string,\n fullSourceName: FullArtifactName,\n normalize: boolean,\n): ArtifactSource {\n const { deps, normalized, opts } = parseSourceData(logger, src, fullSourceName, normalize);\n\n return new ArtifactSource(\n mode,\n fullSourceName,\n getSha256(normalized),\n normalized,\n \"\",\n deps.array,\n opts,\n );\n}\n\n/**\n * Reads src\n * returns normalized source code,\n * gets dependencies from imports,\n * maps imports to global names if globalizeImports is true,\n * and collects compiler options like hashOverride.\n */\nfunction parseSourceData(\n logger: MiLogger,\n src: string,\n fullSourceName: FullArtifactName,\n globalizeImports: boolean,\n): {\n normalized: string;\n deps: ArtifactMap<TypedArtifactName>;\n opts: CompilerOption[];\n} {\n const dependencySet = createArtifactNameSet();\n const optionList: CompilerOption[] = [];\n\n // iterating over lines\n const lines = src.split(\"\\n\");\n\n // processedLines keep all the original lines from <src>.\n // If <globalizeImport>==true, the parser modifies 'import' and 'getTemplateId' lines\n // with Platforma Tengo lib and template usages, resolving local names (\":<item>\") to\n // global (\"@milaboratory/pkg:<item>\")\n const processedLines: string[] = [];\n let parserContext: sourceParserContext = {\n isInCommentBlock: false,\n canDetectOptions: true,\n artifactImportREs: new Map<string, [ArtifactType, RegExp][]>(),\n importLikeREs: new Map<string, [ArtifactType, RegExp][]>(),\n multilineStatement: \"\",\n lineNo: 0,\n };\n\n for (const line of lines) {\n parserContext.lineNo++;\n\n try {\n const {\n line: processedLine,\n context: newContext,\n artifacts,\n option,\n } = parseSingleSourceLine(logger, line, parserContext, fullSourceName.pkg, globalizeImports);\n processedLines.push(processedLine);\n parserContext = newContext;\n\n for (const artifact of artifacts ?? []) {\n dependencySet.add(artifact);\n }\n if (option) {\n optionList.push(option);\n }\n } catch (error: unknown) {\n const err = error as Error;\n throw new Error(\n `[line ${parserContext.lineNo} in ${fullNameToString(fullSourceName)}]: ${err.message}\\n\\t${line}`,\n { cause: err },\n );\n }\n }\n\n return {\n normalized: processedLines.join(\"\\n\"),\n deps: dependencySet,\n opts: optionList,\n };\n}\n\nexport type sourceParserContext = {\n isInCommentBlock: boolean;\n canDetectOptions: boolean;\n artifactImportREs: Map<string, [ArtifactType, RegExp][]>;\n importLikeREs: Map<string, [ArtifactType, RegExp][]>;\n multilineStatement: string;\n lineNo: number;\n};\n\nexport type lineProcessingResult = {\n line: string;\n context: sourceParserContext;\n artifacts: TypedArtifactName[];\n option: CompilerOption | undefined;\n};\n\nexport function parseSingleSourceLine(\n logger: MiLogger,\n line: string,\n context: sourceParserContext,\n localPackageName: string,\n globalizeImports?: boolean,\n): lineProcessingResult {\n if (context.isInCommentBlock) {\n if (multilineCommentEndRE.exec(line)) {\n context.isInCommentBlock = false;\n }\n return { line: \"\", context, artifacts: [], option: undefined };\n }\n\n if (compilerOptionRE.exec(line)) {\n if (!context.canDetectOptions) {\n logger.error(\n `[line ${context.lineNo}]: compiler option '//tengo:' was detected, but it cannot be applied as compiler options can be set only at the file header, before any code line'`,\n );\n throw new Error(\n \"tengo compiler options ('//tengo:' comments) can be set only in file header\",\n );\n }\n return { line, context, artifacts: [], option: parseComplierOption(line) };\n }\n\n if (wrongCompilerOptionRE.exec(line) && context.canDetectOptions) {\n logger.warn(\n `[line ${context.lineNo}]: text simillar to compiler option ('//tengo:...') was detected, but it has wrong format. Leave it as is, if you did not mean to use a line as compiler option. Or format it to '//tengo:<option>' otherwise (no spaces between '//' and 'tengo', no spaces between ':' and option name)`,\n );\n return { line, context, artifacts: [], option: undefined };\n }\n\n if (singlelineCommentRE.test(line) || singlelineTerminatedCommentRE.test(line)) {\n return { line: \"\", context, artifacts: [], option: undefined };\n }\n\n const canBeInlinedComment = line.includes(\"*/\");\n if (multilineCommentStartRE.exec(line) && !canBeInlinedComment) {\n context.isInCommentBlock = true;\n return { line: \"\", context, artifacts: [], option: undefined };\n }\n\n const statement = context.multilineStatement + line.trim();\n\n const mayContainAComment = line.includes(\"//\") || line.includes(\"/*\");\n if (multilineStatementRE.test(line) && !mayContainAComment) {\n // We accumulate multiline statements into single line before analyzing them.\n // This dramatically simplifies parsing logic: things like\n //\n // assets.\n // importSoftware(\"a:b\");\n //\n // become simple 'assets.importSoftware(\"a:b\");' for parser checks.\n //\n // For safety reasons, we never consider anything that 'may look like a comment'\n // as a part of multiline statement to prevent joining things like\n //\n // someFnCall() // looks like multiline statement because of dot in the end of a comment.\n //\n // This problem also appears in multiline string literals, but I hope this will not\n // cause problems in real life.\n\n // We still try to process each line to globalize imports in case of complex constructions, when\n // statements are stacked one into another:\n // a.\n // use(assets.importSoftware(\":soft1\")).\n // use(assets.importSoftware(\":soft2\")).\n // run()\n // It is multiline, and it still requires import globalization mid-way, not just for the last line of statement\n const result = processAssetImport(line, statement, context, localPackageName, globalizeImports);\n context.multilineStatement += result.line.trim(); // accumulate the line after imports globalization.\n return result;\n }\n\n context.multilineStatement = \"\"; // reset accumulated multiline statement parts once we reach statement end.\n\n if (emptyLineRE.exec(statement)) {\n return { line, context, artifacts: [], option: undefined };\n }\n\n // options could be only at the top of the file.\n context.canDetectOptions = false;\n\n return processAssetImport(line, statement, context, localPackageName, globalizeImports);\n}\n\nfunction processModuleImport(\n importInstruction: RegExpExecArray,\n originalLine: string,\n statement: string,\n context: sourceParserContext,\n localPackageName: string,\n globalizeImports?: boolean,\n): lineProcessingResult {\n const iInfo = parseImport(statement);\n\n // If we have plapi, ll or assets, then try to parse\n // getTemplateId, getSoftwareInfo, getSoftware and getAsset calls.\n\n if (iInfo.module === \"plapi\") {\n if (!context.artifactImportREs.has(iInfo.module)) {\n context.artifactImportREs.set(iInfo.module, [\n [\"template\", newGetTemplateIdRE(iInfo.alias)],\n [\"software\", newGetSoftwareInfoRE(iInfo.alias)],\n ]);\n }\n return { line: originalLine, context, artifacts: [], option: undefined };\n }\n\n if (\n iInfo.module === \"@milaboratory/tengo-sdk:ll\" ||\n iInfo.module === \"@platforma-sdk/workflow-tengo:ll\" ||\n ((localPackageName === \"@milaboratory/tengo-sdk\" ||\n localPackageName === \"@platforma-sdk/workflow-tengo\") &&\n iInfo.module === \":ll\")\n ) {\n if (!context.artifactImportREs.has(iInfo.module)) {\n context.artifactImportREs.set(iInfo.module, [\n [\"template\", newImportTemplateRE(iInfo.alias)],\n [\"software\", newImportSoftwareRE(iInfo.alias)],\n ]);\n }\n }\n\n if (\n iInfo.module === \"@milaboratory/tengo-sdk:assets\" ||\n iInfo.module === \"@platforma-sdk/workflow-tengo:assets\" ||\n ((localPackageName === \"@milaboratory/tengo-sdk\" ||\n localPackageName === \"@platforma-sdk/workflow-tengo\") &&\n iInfo.module === \":assets\")\n ) {\n if (!context.artifactImportREs.has(iInfo.module)) {\n context.artifactImportREs.set(iInfo.module, [\n [\"template\", newImportTemplateRE(iInfo.alias)],\n [\"software\", newImportSoftwareRE(iInfo.alias)],\n [\"asset\", newImportAssetRE(iInfo.alias)],\n ]);\n context.importLikeREs.set(iInfo.module, [\n [\"template\", newImportTemplateDetector(iInfo.alias)],\n [\"software\", newImportSoftwareDetector(iInfo.alias)],\n [\"asset\", newImportAssetDetector(iInfo.alias)],\n ]);\n }\n }\n\n const artifact = parseArtifactName(iInfo.module, \"library\", localPackageName);\n if (!artifact) {\n // not a Platforma Tengo library import\n return { line: originalLine, context, artifacts: [], option: undefined };\n }\n\n if (globalizeImports) {\n originalLine = originalLine.replace(\n importInstruction[0],\n ` := import(\"${artifact.pkg}:${artifact.id}\")`,\n );\n }\n\n return { line: originalLine, context, artifacts: [artifact], option: undefined };\n}\n\nfunction processAssetImport(\n originalLine: string,\n statement: string,\n context: sourceParserContext,\n localPackageName: string,\n globalizeImports?: boolean,\n): lineProcessingResult {\n if (emptyLineRE.exec(statement)) {\n return { line: originalLine, context, artifacts: [], option: undefined };\n }\n\n // options could be only at the top of the file.\n context.canDetectOptions = false;\n\n const importInstruction = importRE.exec(statement);\n\n if (importInstruction) {\n return processModuleImport(\n importInstruction,\n originalLine,\n statement,\n context,\n localPackageName,\n globalizeImports,\n );\n }\n\n if (context.artifactImportREs.size > 0) {\n for (const [_, artifactRE] of context.artifactImportREs) {\n for (const [artifactType, re] of artifactRE) {\n // Find all matches in the statement\n const matches = Array.from(statement.matchAll(re));\n if (matches.length === 0) {\n continue;\n }\n\n const artifacts: TypedArtifactName[] = [];\n for (let i = matches.length - 1; i >= 0; i--) {\n const match = matches[i];\n if (!match || !match.groups) {\n continue;\n }\n\n const { fnCall, templateName, fnName } = match.groups;\n\n if (!fnCall || !templateName || !fnName) {\n throw Error(`failed to parse template import statement`);\n }\n\n const artifact = parseArtifactName(templateName, artifactType, localPackageName);\n if (!artifact) {\n throw Error(`failed to parse artifact name in ${fnName} import statement`);\n }\n artifacts.push(artifact);\n\n if (globalizeImports) {\n // Replace all occurrences of this fnCall in originalLine\n originalLine = originalLine.replaceAll(\n fnCall,\n `${fnName}(\"${artifact.pkg}:${artifact.id}\")`,\n );\n }\n }\n\n return { line: originalLine, context, artifacts, option: undefined };\n }\n }\n }\n\n if (context.importLikeREs.size > 0) {\n for (const [_, artifactRE] of context.importLikeREs) {\n for (const [artifactType, re] of artifactRE) {\n const match = re.exec(statement);\n if (!match || !match.groups) {\n continue;\n }\n\n throw Error(\n `incorrect '${artifactType}' import statement: use string literal as ID (variables are not allowed) in the same line with brackets (i.e. 'importSoftware(\"sw:main\")').`,\n );\n }\n }\n }\n\n return { line: originalLine, context, artifacts: [], option: undefined };\n}\n\ninterface ImportInfo {\n module: string; // the module name without wrapping quotes: import(\"<module>\")\n alias: string; // the name of variable that keeps imported module: <alias> := import(\"<module>\")\n}\n\nfunction parseImport(line: string): ImportInfo {\n const match = importNameRE.exec(line);\n\n if (!match || !match.groups) {\n throw Error(`failed to parse 'import' statement`);\n }\n\n const { importName, moduleName } = match.groups;\n if (!importName || !moduleName) {\n throw Error(`failed to parse 'import' statement`);\n }\n\n return {\n module: moduleName, // the module name without wrapping quotes: import(\"<module>\")\n alias: importName, // the name of variable that keeps imported module: <alias> := import(\"<module>\")\n };\n}\n\nfunction parseArtifactName(\n moduleName: string,\n aType: ArtifactType,\n localPackageName: string,\n): TypedArtifactName | undefined {\n const depInfo = dependencyRE.exec(moduleName);\n if (!depInfo) {\n return;\n }\n\n if (!depInfo.groups) {\n throw Error(\n `failed to parse dependency name inside 'import' statement. The dependency name should have format '<package>:<templateName>'`,\n );\n }\n\n const { pkgName, depID } = depInfo.groups;\n if (!depID) {\n throw Error(\n `failed to parse dependency name inside 'import' statement. The dependency name should have format '<package>:<templateName>'`,\n );\n }\n\n return { type: aType, pkg: pkgName ?? localPackageName, id: depID };\n}\n\nexport function getSha256(source: string): string {\n return createHash(\"sha256\").update(source).digest(\"hex\");\n}\n"],"names":["readFileSync","createArtifactNameSet","fullNameToString","createHash"],"mappings":";;;;;;;AAcA;AACA,MAAM,WAAW,GAAG,wBAAwB;AAE5C,MAAM,cAAc,GAAG,CAAC,UAAkB,EAAE,MAAc,KAAI;AAC5D,IAAA,OAAO,IAAI,MAAM,CACf,CAAA,GAAA,EAAM,UAAU,CAAA,uBAAA,CAAyB;QACvC,MAAM;QACN,CAAA,4CAAA,CAA8C,EAChD,GAAG,CACJ;AACH,CAAC;AAED,MAAM,kBAAkB,GAAG,CAAC,UAAkB,EAAE,MAAc,KAAI;AAChE,IAAA,OAAO,IAAI,MAAM,CAAC,CAAA,GAAA,EAAM,UAAU,CAAA,aAAA,CAAe,GAAG,MAAM,GAAG,CAAA,QAAA,CAAU,EAAE,GAAG,CAAC;AAC/E,CAAC;AAEM,MAAM,kBAAkB,GAAG,CAAC,UAAkB,KACnD,cAAc,CAAC,UAAU,EAAE,eAAe;AACrC,MAAM,oBAAoB,GAAG,CAAC,UAAkB,KACrD,cAAc,CAAC,UAAU,EAAE,iBAAiB;AAE9C,MAAM,mBAAmB,G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AC,MAAM;IACzC,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,MAAM,KAAK,CACT,CAAA,4HAAA,CAA8H,CAC/H;IACH;AAEA,IAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,IAAI,gBAAgB,EAAE,EAAE,EAAE,KAAK,EAAE;AACrE;AAEM,SAAU,SAAS,CAAC,MAAc,EAAA;AACtC,IAAA,OAAOC,sBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;AAC1D;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
- import { type TypedArtifactName, type FullArtifactName, type ArtifactType, type CompileMode, type CompilerOption } from './package';
2
- import type { MiLogger } from '@milaboratories/ts-helpers';
1
+ import { type TypedArtifactName, type FullArtifactName, type ArtifactType, type CompileMode, type CompilerOption } from "./package";
2
+ import type { MiLogger } from "@milaboratories/ts-helpers";
3
3
  export declare const newGetTemplateIdRE: (moduleName: string) => RegExp;
4
4
  export declare const newGetSoftwareInfoRE: (moduleName: string) => RegExp;
5
5
  export declare class ArtifactSource {
@@ -1 +1 @@
1
- {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/compiler/source.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,cAAc,EAEpB,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAuB3D,eAAO,MAAM,kBAAkB,eAAgB,MAAM,WAAgD,CAAC;AACtG,eAAO,MAAM,oBAAoB,eAAgB,MAAM,WAAkD,CAAC;AAkD1G,qBAAa,cAAc;IAEvB,qDAAqD;aACrC,WAAW,EAAE,WAAW;IACxC,kDAAkD;aAClC,QAAQ,EAAE,gBAAgB;IAC1C,8BAA8B;aACd,UAAU,EAAE,MAAM;IA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