@platforma-sdk/tengo-builder 4.1.12 → 4.1.14

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 (66) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +2 -3
  2. package/dist/cli.cjs +1 -2
  3. package/dist/cli.d.ts +0 -2
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -2
  6. package/dist/commands/build.cjs +1 -2
  7. package/dist/commands/build.cjs.map +1 -1
  8. package/dist/commands/build.js +1 -2
  9. package/dist/commands/check.cjs +3 -3
  10. package/dist/commands/check.cjs.map +1 -1
  11. package/dist/commands/check.js +3 -3
  12. package/dist/commands/check.js.map +1 -1
  13. package/dist/commands/dump/artifacts.cjs +3 -3
  14. package/dist/commands/dump/artifacts.cjs.map +1 -1
  15. package/dist/commands/dump/artifacts.js +3 -3
  16. package/dist/commands/dump/artifacts.js.map +1 -1
  17. package/dist/commands/dump/software.cjs +3 -3
  18. package/dist/commands/dump/software.cjs.map +1 -1
  19. package/dist/commands/dump/software.js +3 -3
  20. package/dist/commands/dump/software.js.map +1 -1
  21. package/dist/commands/imports.cjs +1 -2
  22. package/dist/commands/imports.js +1 -2
  23. package/dist/commands/test.cjs +3 -3
  24. package/dist/commands/test.cjs.map +1 -1
  25. package/dist/commands/test.js +3 -3
  26. package/dist/commands/test.js.map +1 -1
  27. package/dist/compiler/artifactset.cjs +1 -2
  28. package/dist/compiler/artifactset.js +1 -2
  29. package/dist/compiler/compiler.cjs +1 -2
  30. package/dist/compiler/compiler.js +1 -2
  31. package/dist/compiler/compileroptions.cjs +2 -5
  32. package/dist/compiler/compileroptions.cjs.map +1 -1
  33. package/dist/compiler/compileroptions.js +2 -5
  34. package/dist/compiler/compileroptions.js.map +1 -1
  35. package/dist/compiler/imports.cjs +1 -2
  36. package/dist/compiler/imports.js +1 -2
  37. package/dist/compiler/main.cjs +3 -3
  38. package/dist/compiler/main.cjs.map +1 -1
  39. package/dist/compiler/main.js +3 -3
  40. package/dist/compiler/main.js.map +1 -1
  41. package/dist/compiler/pack_limits.cjs +4 -5
  42. package/dist/compiler/pack_limits.cjs.map +1 -1
  43. package/dist/compiler/pack_limits.js +4 -5
  44. package/dist/compiler/pack_limits.js.map +1 -1
  45. package/dist/compiler/package.cjs +1 -2
  46. package/dist/compiler/package.js +1 -2
  47. package/dist/compiler/source.cjs +1 -2
  48. package/dist/compiler/source.cjs.map +1 -1
  49. package/dist/compiler/source.js +1 -2
  50. package/dist/compiler/source.js.map +1 -1
  51. package/dist/compiler/template.cjs +1 -2
  52. package/dist/compiler/template.cjs.map +1 -1
  53. package/dist/compiler/template.js +1 -2
  54. package/dist/compiler/util.cjs +1 -2
  55. package/dist/compiler/util.js +1 -2
  56. package/dist/index.js +1 -2
  57. package/dist/shared/basecmd.cjs +1 -2
  58. package/dist/shared/basecmd.js +1 -2
  59. package/dist/shared/dump.cjs +3 -3
  60. package/dist/shared/dump.cjs.map +1 -1
  61. package/dist/shared/dump.js +3 -3
  62. package/dist/shared/dump.js.map +1 -1
  63. package/dist/shared/proc.cjs +1 -2
  64. package/dist/shared/proc.cjs.map +1 -1
  65. package/dist/shared/proc.js +1 -2
  66. package/package.json +11 -11
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -15,9 +15,8 @@ var __copyProps = (to, from, except, desc) => {
15
15
  }
16
16
  return to;
17
17
  };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
19
19
  value: mod,
20
20
  enumerable: true
21
21
  }) : target, mod));
22
- //#endregion
23
22
  exports.__toESM = __toESM;
package/dist/cli.cjs CHANGED
@@ -5,7 +5,7 @@ const require_test = require("./commands/test.cjs");
5
5
  const require_artifacts = require("./commands/dump/artifacts.cjs");
6
6
  const require_software = require("./commands/dump/software.cjs");
7
7
  let commander = require("commander");
8
- //#region src/cli.ts
8
+ // src/cli.ts
9
9
  function buildProgram() {
10
10
  const program = new commander.Command();
11
11
  program.name("pl-tengo").description("Pl Tengo Template Builder");
@@ -22,7 +22,6 @@ function buildProgram() {
22
22
  async function run(argv = process.argv) {
23
23
  await buildProgram().parseAsync(argv);
24
24
  }
25
- //#endregion
26
25
  exports.buildProgram = buildProgram;
27
26
  exports.run = run;
28
27
 
package/dist/cli.d.ts CHANGED
@@ -1,6 +1,4 @@
1
1
  import { Command } from "commander";
2
- //#region src/cli.d.ts
3
2
  export declare function buildProgram(): Command;
4
3
  export declare function run(argv?: string[]): Promise<void>;
5
- //#endregion
6
4
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","names":[],"sources":["../src/cli.ts"],"mappings":";;wBAQgB,gBAAgB;wBAkBV,IAAI,kBAAgC"}
1
+ {"version":3,"file":"cli.d.ts","names":[],"sources":["../src/cli.ts"],"mappings":";wBAQgB,gBAAgB;wBAkBV,IAAI,kBAAgC"}
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import testCommand from "./commands/test.js";
5
5
  import dumpArtifactsCommand from "./commands/dump/artifacts.js";
6
6
  import dumpSoftwareCommand from "./commands/dump/software.js";
7
7
  import { Command } from "commander";
8
- //#region src/cli.ts
8
+ // src/cli.ts
9
9
  function buildProgram() {
10
10
  const program = new Command();
11
11
  program.name("pl-tengo").description("Pl Tengo Template Builder");
@@ -22,7 +22,6 @@ function buildProgram() {
22
22
  async function run(argv = process.argv) {
23
23
  await buildProgram().parseAsync(argv);
24
24
  }
25
- //#endregion
26
25
  export { buildProgram, run };
27
26
 
28
27
  //# sourceMappingURL=cli.js.map
@@ -8,7 +8,7 @@ let node_path = require("node:path");
8
8
  node_path = require_runtime.__toESM(node_path, 1);
9
9
  let node_fs_promises = require("node:fs/promises");
10
10
  node_fs_promises = require_runtime.__toESM(node_fs_promises, 1);
11
- //#region src/commands/build.ts
11
+ // src/commands/build.ts
12
12
  function buildCommand() {
13
13
  const cmd = new commander.Command("build").description("build tengo sources into single distributable pack file");
14
14
  require_basecmd.addOptions(cmd, require_basecmd.GlobalOptions(), require_basecmd.CtagsOptions());
@@ -110,7 +110,6 @@ function checkRunError(result, message) {
110
110
  const msg = message ?? "failed to run command";
111
111
  if (result.status !== 0) console.log(`WARN: ${msg} the build will continue as-is`);
112
112
  }
113
- //#endregion
114
113
  exports.default = buildCommand;
115
114
 
116
115
  //# sourceMappingURL=build.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.cjs","names":["Command","createLogger","getPackageInfo","compile","fsp","path","getTengoFiles"],"sources":["../../src/commands/build.ts"],"sourcesContent":["import type { SpawnSyncReturns } from \"node:child_process\";\nimport { spawnSync } from \"node:child_process\";\nimport { Command } from \"commander\";\nimport { compile, savePacks, getPackageInfo } from \"../compiler/main\";\nimport { createLogger, getTengoFiles } from \"../compiler/util\";\nimport * as opts from \"../shared/basecmd\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport type * as winston from \"winston\";\nimport type { TemplatesAndLibs } from \"../compiler/compiler\";\n\nexport default function buildCommand(): Command {\n const cmd = new Command(\"build\").description(\n \"build tengo sources into single distributable pack file\",\n );\n\n opts.addOptions(cmd, opts.GlobalOptions(), opts.CtagsOptions());\n\n cmd.action(async (o) => {\n const flags = {\n \"log-level\": o.logLevel as string,\n \"generate-tags\": o.generateTags as boolean,\n \"tags-file\": o.tagsFile as string,\n \"tags-additional-args\": o.tagsAdditionalArgs as string[],\n };\n const logger = createLogger(flags[\"log-level\"]);\n\n const packageInfo = getPackageInfo(process.cwd(), logger);\n const compiledDist = compile(logger, packageInfo, \"dist\");\n savePacks(logger, compiledDist, \"dist\");\n logger.info(\"Template Pack build done.\");\n\n // Building TS bindings for templates\n const { dts, cjs, mjs } = generateTsBinding(compiledDist);\n await fsp.writeFile(\"dist/index.d.ts\", dts);\n if (packageInfo.type === \"module\") {\n await fsp.writeFile(\"dist/index.cjs\", cjs);\n await fsp.writeFile(\"dist/index.js\", mjs);\n } else {\n await fsp.writeFile(\"dist/index.js\", cjs);\n await fsp.writeFile(\"dist/index.mjs\", mjs);\n }\n\n mergeTagsEnvs(flags);\n if (flags[\"generate-tags\"]) checkAndGenerateCtags(logger, flags);\n\n logger.info(\"Template Pack build done.\");\n });\n\n return cmd;\n}\n\nfunction generateTsBinding(compiledDist: TemplatesAndLibs) {\n let dts = `declare type TemplateFromFile = { readonly type: \"from-file\"; readonly path: string; };\\n`;\n dts += `declare type TplName = ${compiledDist.templates\n .map((tpl) => '\"' + tpl.fullName.id + '\"')\n .join(\" | \")};\\n`;\n dts += `declare const Templates: Record<TplName, TemplateFromFile>;\\n`;\n dts += `export { Templates };\\n`;\n let cjs = `module.exports = { Templates: {\\n`;\n let mjs = `import { resolve } from 'node:path';\\nexport const Templates = {\\n`;\n const recordsCjs = compiledDist.templates\n .map(\n (tpl) =>\n ` '${tpl.fullName.id}': { type: 'from-file', path: require.resolve('./tengo/tpl/${tpl.fullName.id}.plj.gz') }`,\n )\n .join(\",\\n\");\n const recordsMjs = compiledDist.templates\n .map(\n (tpl) =>\n ` '${tpl.fullName.id}': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/${tpl.fullName.id}.plj.gz') }`,\n )\n .join(\",\\n\");\n cjs += recordsCjs;\n mjs += recordsMjs;\n cjs += `\\n}};\\n`;\n mjs += `\\n};\\n`;\n\n return { dts, cjs, mjs };\n}\n\nfunction mergeTagsEnvs(flags: {\n \"generate-tags\": boolean;\n \"tags-file\": string;\n \"tags-additional-args\": string[] | string;\n}) {\n if (process.env.GENERATE_TAGS != undefined) {\n flags[\"generate-tags\"] = process.env.GENERATE_TAGS == \"true\";\n }\n\n if (process.env.TAGS_FILE != undefined) {\n flags[\"tags-file\"] = process.env.TAGS_FILE;\n }\n\n if (process.env.TAGS_ADDITIONAL_ARGS != undefined) {\n flags[\"tags-additional-args\"] = process.env.TAGS_ADDITIONAL_ARGS.split(\",\");\n }\n}\n\nfunction checkAndGenerateCtags(\n logger: winston.Logger,\n flags: {\n \"tags-file\": string;\n \"tags-additional-args\": string[];\n },\n) {\n const fileName = path.resolve(flags[\"tags-file\"]);\n const rootDir = path.dirname(fileName);\n const additionalArgs = flags[\"tags-additional-args\"];\n\n // all tengo files in dirs and subdirs\n // If we don't limit the depth, it could become unbearably slow\n // and even OOM killed node js.\n // Increase the depth if you need to.\n const tengoFiles = toRelativePath(rootDir, getTengoFiles(rootDir, 9));\n\n logger.info(\n `Generating tags for tengo autocompletion from \"${rootDir}\" \\\nin \"${fileName}\", additional arguments: \"${additionalArgs.join('\" \"')}\".\nFound ${tengoFiles.length} tengo files...`,\n );\n\n // see https://docs.ctags.io/en/latest/man/ctags-optlib.7.html#perl-pod\n const result = spawnSync(\n \"ctags\",\n [\n \"-f\",\n fileName,\n ...additionalArgs,\n \"--langdef=tengo\",\n \"--map-tengo=+.tengo\",\n \"--kinddef-tengo=f,function,function\",\n \"--regex-tengo=/^\\\\s*(.*)(:| :=| =) ?func.*/\\\\1/f/\",\n \"--kinddef-tengo=c,constant,constant\",\n '--regex-tengo=/^\\\\s*(.*) := (\"|\\\\{).*/\\\\1/c/',\n \"-R\",\n ...tengoFiles,\n ],\n {\n env: process.env,\n stdio: \"inherit\",\n cwd: rootDir,\n },\n );\n\n if (result.error?.message.includes(\"ENOENT\")) {\n console.log(`\npl-tengo can create tags for tengo autocompletion,\nbut the program should be installed\nwith \"brew install universal-ctags\" on OSX\nor \"sudo apt install universal-ctags\" on Ubuntu.\n\nFor vscode, you should also install ctags extension:\nhttps://marketplace.visualstudio.com/items?itemName=jaydenlin.ctags-support`);\n\n return;\n }\n\n checkRunError(result, \"failed to generate ctags\");\n\n logger.info(\"Generation of tags is done.\");\n}\n\nfunction toRelativePath(dir: string, files: string[]): string[] {\n // Note that VS Code extension likes only relatives paths to the root of the opened dir.\n return files.map((file) => file.replace(dir, \".\"));\n}\n\nfunction checkRunError(result: SpawnSyncReturns<Buffer>, message?: string) {\n if (result.error) {\n console.log(result.error);\n }\n\n const msg = message ?? \"failed to run command\";\n\n if (result.status !== 0) {\n console.log(`WARN: ${msg} the build will continue as-is`);\n }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"build.cjs","names":["Command","createLogger","getPackageInfo","compile","fsp","path","getTengoFiles","spawnSync"],"sources":["../../src/commands/build.ts"],"sourcesContent":["import type { SpawnSyncReturns } from \"node:child_process\";\nimport { spawnSync } from \"node:child_process\";\nimport { Command } from \"commander\";\nimport { compile, savePacks, getPackageInfo } from \"../compiler/main\";\nimport { createLogger, getTengoFiles } from \"../compiler/util\";\nimport * as opts from \"../shared/basecmd\";\nimport * as fsp from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport type * as winston from \"winston\";\nimport type { TemplatesAndLibs } from \"../compiler/compiler\";\n\nexport default function buildCommand(): Command {\n const cmd = new Command(\"build\").description(\n \"build tengo sources into single distributable pack file\",\n );\n\n opts.addOptions(cmd, opts.GlobalOptions(), opts.CtagsOptions());\n\n cmd.action(async (o) => {\n const flags = {\n \"log-level\": o.logLevel as string,\n \"generate-tags\": o.generateTags as boolean,\n \"tags-file\": o.tagsFile as string,\n \"tags-additional-args\": o.tagsAdditionalArgs as string[],\n };\n const logger = createLogger(flags[\"log-level\"]);\n\n const packageInfo = getPackageInfo(process.cwd(), logger);\n const compiledDist = compile(logger, packageInfo, \"dist\");\n savePacks(logger, compiledDist, \"dist\");\n logger.info(\"Template Pack build done.\");\n\n // Building TS bindings for templates\n const { dts, cjs, mjs } = generateTsBinding(compiledDist);\n await fsp.writeFile(\"dist/index.d.ts\", dts);\n if (packageInfo.type === \"module\") {\n await fsp.writeFile(\"dist/index.cjs\", cjs);\n await fsp.writeFile(\"dist/index.js\", mjs);\n } else {\n await fsp.writeFile(\"dist/index.js\", cjs);\n await fsp.writeFile(\"dist/index.mjs\", mjs);\n }\n\n mergeTagsEnvs(flags);\n if (flags[\"generate-tags\"]) checkAndGenerateCtags(logger, flags);\n\n logger.info(\"Template Pack build done.\");\n });\n\n return cmd;\n}\n\nfunction generateTsBinding(compiledDist: TemplatesAndLibs) {\n let dts = `declare type TemplateFromFile = { readonly type: \"from-file\"; readonly path: string; };\\n`;\n dts += `declare type TplName = ${compiledDist.templates\n .map((tpl) => '\"' + tpl.fullName.id + '\"')\n .join(\" | \")};\\n`;\n dts += `declare const Templates: Record<TplName, TemplateFromFile>;\\n`;\n dts += `export { Templates };\\n`;\n let cjs = `module.exports = { Templates: {\\n`;\n let mjs = `import { resolve } from 'node:path';\\nexport const Templates = {\\n`;\n const recordsCjs = compiledDist.templates\n .map(\n (tpl) =>\n ` '${tpl.fullName.id}': { type: 'from-file', path: require.resolve('./tengo/tpl/${tpl.fullName.id}.plj.gz') }`,\n )\n .join(\",\\n\");\n const recordsMjs = compiledDist.templates\n .map(\n (tpl) =>\n ` '${tpl.fullName.id}': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/${tpl.fullName.id}.plj.gz') }`,\n )\n .join(\",\\n\");\n cjs += recordsCjs;\n mjs += recordsMjs;\n cjs += `\\n}};\\n`;\n mjs += `\\n};\\n`;\n\n return { dts, cjs, mjs };\n}\n\nfunction mergeTagsEnvs(flags: {\n \"generate-tags\": boolean;\n \"tags-file\": string;\n \"tags-additional-args\": string[] | string;\n}) {\n if (process.env.GENERATE_TAGS != undefined) {\n flags[\"generate-tags\"] = process.env.GENERATE_TAGS == \"true\";\n }\n\n if (process.env.TAGS_FILE != undefined) {\n flags[\"tags-file\"] = process.env.TAGS_FILE;\n }\n\n if (process.env.TAGS_ADDITIONAL_ARGS != undefined) {\n flags[\"tags-additional-args\"] = process.env.TAGS_ADDITIONAL_ARGS.split(\",\");\n }\n}\n\nfunction checkAndGenerateCtags(\n logger: winston.Logger,\n flags: {\n \"tags-file\": string;\n \"tags-additional-args\": string[];\n },\n) {\n const fileName = path.resolve(flags[\"tags-file\"]);\n const rootDir = path.dirname(fileName);\n const additionalArgs = flags[\"tags-additional-args\"];\n\n // all tengo files in dirs and subdirs\n // If we don't limit the depth, it could become unbearably slow\n // and even OOM killed node js.\n // Increase the depth if you need to.\n const tengoFiles = toRelativePath(rootDir, getTengoFiles(rootDir, 9));\n\n logger.info(\n `Generating tags for tengo autocompletion from \"${rootDir}\" \\\nin \"${fileName}\", additional arguments: \"${additionalArgs.join('\" \"')}\".\nFound ${tengoFiles.length} tengo files...`,\n );\n\n // see https://docs.ctags.io/en/latest/man/ctags-optlib.7.html#perl-pod\n const result = spawnSync(\n \"ctags\",\n [\n \"-f\",\n fileName,\n ...additionalArgs,\n \"--langdef=tengo\",\n \"--map-tengo=+.tengo\",\n \"--kinddef-tengo=f,function,function\",\n \"--regex-tengo=/^\\\\s*(.*)(:| :=| =) ?func.*/\\\\1/f/\",\n \"--kinddef-tengo=c,constant,constant\",\n '--regex-tengo=/^\\\\s*(.*) := (\"|\\\\{).*/\\\\1/c/',\n \"-R\",\n ...tengoFiles,\n ],\n {\n env: process.env,\n stdio: \"inherit\",\n cwd: rootDir,\n },\n );\n\n if (result.error?.message.includes(\"ENOENT\")) {\n console.log(`\npl-tengo can create tags for tengo autocompletion,\nbut the program should be installed\nwith \"brew install universal-ctags\" on OSX\nor \"sudo apt install universal-ctags\" on Ubuntu.\n\nFor vscode, you should also install ctags extension:\nhttps://marketplace.visualstudio.com/items?itemName=jaydenlin.ctags-support`);\n\n return;\n }\n\n checkRunError(result, \"failed to generate ctags\");\n\n logger.info(\"Generation of tags is done.\");\n}\n\nfunction toRelativePath(dir: string, files: string[]): string[] {\n // Note that VS Code extension likes only relatives paths to the root of the opened dir.\n return files.map((file) => file.replace(dir, \".\"));\n}\n\nfunction checkRunError(result: SpawnSyncReturns<Buffer>, message?: string) {\n if (result.error) {\n console.log(result.error);\n }\n\n const msg = message ?? \"failed to run command\";\n\n if (result.status !== 0) {\n console.log(`WARN: ${msg} the build will continue as-is`);\n }\n}\n"],"mappings":"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"}
@@ -5,7 +5,7 @@ import { Command } from "commander";
5
5
  import { spawnSync } from "node:child_process";
6
6
  import * as path from "node:path";
7
7
  import * as fsp from "node:fs/promises";
8
- //#region src/commands/build.ts
8
+ // src/commands/build.ts
9
9
  function buildCommand() {
10
10
  const cmd = new Command("build").description("build tengo sources into single distributable pack file");
11
11
  addOptions(cmd, GlobalOptions(), CtagsOptions());
@@ -107,7 +107,6 @@ function checkRunError(result, message) {
107
107
  const msg = message ?? "failed to run command";
108
108
  if (result.status !== 0) console.log(`WARN: ${msg} the build will continue as-is`);
109
109
  }
110
- //#endregion
111
110
  export { buildCommand as default };
112
111
 
113
112
  //# sourceMappingURL=build.js.map
@@ -4,7 +4,7 @@ const require_dump = require("../shared/dump.cjs");
4
4
  const require_proc = require("../shared/proc.cjs");
5
5
  let commander = require("commander");
6
6
  let _milaboratories_tengo_tester = require("@milaboratories/tengo-tester");
7
- //#region src/commands/check.ts
7
+ // src/commands/check.ts
8
8
  function checkCommand() {
9
9
  const cmd = new commander.Command("check").description("check tengo sources for language processor an");
10
10
  cmd.argument("[paths...]", "source paths to check (defaults to ./src)");
@@ -12,7 +12,8 @@ function checkCommand() {
12
12
  cmd.action(async (paths, o) => {
13
13
  const logLevel = o.logLevel;
14
14
  const logger = require_util.createLogger(logLevel);
15
- const tester = require_proc.spawnEmbed(_milaboratories_tengo_tester.TengoTesterBinaryPath, "check", "--log-level", logLevel, "--artifacts", "-", ...paths.length == 0 ? ["./src"] : paths);
15
+ const testerArgs = paths.length == 0 ? ["./src"] : paths;
16
+ const tester = require_proc.spawnEmbed(_milaboratories_tengo_tester.TengoTesterBinaryPath, "check", "--log-level", logLevel, "--artifacts", "-", ...testerArgs);
16
17
  try {
17
18
  require_dump.dumpArtifacts(logger, tester.stdin);
18
19
  } catch (err) {
@@ -25,7 +26,6 @@ function checkCommand() {
25
26
  });
26
27
  return cmd;
27
28
  }
28
- //#endregion
29
29
  exports.default = checkCommand;
30
30
 
31
31
  //# sourceMappingURL=check.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"check.cjs","names":["Command","GlobalOptions","createLogger","spawnEmbed","TengoTesterBinaryPath","waitFor"],"sources":["../../src/commands/check.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../compiler/util\";\nimport { dumpArtifacts } from \"../shared/dump\";\nimport { addOptions, GlobalOptions } from \"../shared/basecmd\";\nimport { spawnEmbed, waitFor } from \"../shared/proc\";\nimport { TengoTesterBinaryPath } from \"@milaboratories/tengo-tester\";\n\nexport default function checkCommand(): Command {\n const cmd = new Command(\"check\").description(\"check tengo sources for language processor an\");\n\n cmd.argument(\"[paths...]\", \"source paths to check (defaults to ./src)\");\n addOptions(cmd, GlobalOptions());\n\n cmd.action(async (paths: string[], o) => {\n const logLevel = o.logLevel as string;\n const logger = createLogger(logLevel);\n\n const testerArgs: string[] = paths.length == 0 ? [\"./src\"] : paths;\n\n const tester = spawnEmbed(\n TengoTesterBinaryPath,\n \"check\",\n \"--log-level\",\n logLevel,\n \"--artifacts\",\n \"-\",\n ...testerArgs,\n );\n\n try {\n dumpArtifacts(logger, tester.stdin);\n } catch (err: unknown) {\n logger.error(err);\n } finally {\n tester.stdin.end();\n const code = await waitFor(tester);\n process.exit(code);\n }\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;;AAOA,SAAwB,eAAwB;CAC9C,MAAM,MAAM,IAAIA,UAAAA,QAAQ,OAAO,CAAC,CAAC,YAAY,+CAA+C;CAE5F,IAAI,SAAS,cAAc,2CAA2C;CACtE,gBAAA,WAAW,KAAKC,gBAAAA,cAAc,CAAC;CAE/B,IAAI,OAAO,OAAO,OAAiB,MAAM;EACvC,MAAM,WAAW,EAAE;EACnB,MAAM,SAASC,aAAAA,aAAa,QAAQ;EAIpC,MAAM,SAASC,aAAAA,WACbC,6BAAAA,uBACA,SACA,eACA,UACA,eACA,KACA,GAT2B,MAAM,UAAU,IAAI,CAAC,OAAO,IAAI,KAU7D;EAEA,IAAI;GACF,aAAA,cAAc,QAAQ,OAAO,KAAK;EACpC,SAAS,KAAc;GACrB,OAAO,MAAM,GAAG;EAClB,UAAU;GACR,OAAO,MAAM,IAAI;GACjB,MAAM,OAAO,MAAMC,aAAAA,QAAQ,MAAM;GACjC,QAAQ,KAAK,IAAI;EACnB;CACF,CAAC;CAED,OAAO;AACT"}
1
+ {"version":3,"file":"check.cjs","names":["Command","GlobalOptions","createLogger","spawnEmbed","TengoTesterBinaryPath","waitFor"],"sources":["../../src/commands/check.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../compiler/util\";\nimport { dumpArtifacts } from \"../shared/dump\";\nimport { addOptions, GlobalOptions } from \"../shared/basecmd\";\nimport { spawnEmbed, waitFor } from \"../shared/proc\";\nimport { TengoTesterBinaryPath } from \"@milaboratories/tengo-tester\";\n\nexport default function checkCommand(): Command {\n const cmd = new Command(\"check\").description(\"check tengo sources for language processor an\");\n\n cmd.argument(\"[paths...]\", \"source paths to check (defaults to ./src)\");\n addOptions(cmd, GlobalOptions());\n\n cmd.action(async (paths: string[], o) => {\n const logLevel = o.logLevel as string;\n const logger = createLogger(logLevel);\n\n const testerArgs: string[] = paths.length == 0 ? [\"./src\"] : paths;\n\n const tester = spawnEmbed(\n TengoTesterBinaryPath,\n \"check\",\n \"--log-level\",\n logLevel,\n \"--artifacts\",\n \"-\",\n ...testerArgs,\n );\n\n try {\n dumpArtifacts(logger, tester.stdin);\n } catch (err: unknown) {\n logger.error(err);\n } finally {\n tester.stdin.end();\n const code = await waitFor(tester);\n process.exit(code);\n }\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;;AAOA,SAAwB,eAAwB;CAC9C,MAAM,MAAM,IAAIA,UAAAA,QAAQ,OAAO,CAAC,CAAC,YAAY,+CAA+C;CAE5F,IAAI,SAAS,cAAc,2CAA2C;CACtE,gBAAA,WAAW,KAAKC,gBAAAA,cAAc,CAAC;CAE/B,IAAI,OAAO,OAAO,OAAiB,MAAM;EACvC,MAAM,WAAW,EAAE;EACnB,MAAM,SAASC,aAAAA,aAAa,QAAQ;EAEpC,MAAM,aAAuB,MAAM,UAAU,IAAI,CAAC,OAAO,IAAI;EAE7D,MAAM,SAASC,aAAAA,WACbC,6BAAAA,uBACA,SACA,eACA,UACA,eACA,KACA,GAAG,UACL;EAEA,IAAI;GACF,aAAA,cAAc,QAAQ,OAAO,KAAK;EACpC,SAAS,KAAc;GACrB,OAAO,MAAM,GAAG;EAClB,UAAU;GACR,OAAO,MAAM,IAAI;GACjB,MAAM,OAAO,MAAMC,aAAAA,QAAQ,MAAM;GACjC,QAAQ,KAAK,IAAI;EACnB;CACF,CAAC;CAED,OAAO;AACT"}
@@ -4,7 +4,7 @@ import { dumpArtifacts } from "../shared/dump.js";
4
4
  import { spawnEmbed, waitFor } from "../shared/proc.js";
5
5
  import { Command } from "commander";
6
6
  import { TengoTesterBinaryPath } from "@milaboratories/tengo-tester";
7
- //#region src/commands/check.ts
7
+ // src/commands/check.ts
8
8
  function checkCommand() {
9
9
  const cmd = new Command("check").description("check tengo sources for language processor an");
10
10
  cmd.argument("[paths...]", "source paths to check (defaults to ./src)");
@@ -12,7 +12,8 @@ function checkCommand() {
12
12
  cmd.action(async (paths, o) => {
13
13
  const logLevel = o.logLevel;
14
14
  const logger = createLogger(logLevel);
15
- const tester = spawnEmbed(TengoTesterBinaryPath, "check", "--log-level", logLevel, "--artifacts", "-", ...paths.length == 0 ? ["./src"] : paths);
15
+ const testerArgs = paths.length == 0 ? ["./src"] : paths;
16
+ const tester = spawnEmbed(TengoTesterBinaryPath, "check", "--log-level", logLevel, "--artifacts", "-", ...testerArgs);
16
17
  try {
17
18
  dumpArtifacts(logger, tester.stdin);
18
19
  } catch (err) {
@@ -25,7 +26,6 @@ function checkCommand() {
25
26
  });
26
27
  return cmd;
27
28
  }
28
- //#endregion
29
29
  export { checkCommand as default };
30
30
 
31
31
  //# sourceMappingURL=check.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"check.js","names":[],"sources":["../../src/commands/check.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../compiler/util\";\nimport { dumpArtifacts } from \"../shared/dump\";\nimport { addOptions, GlobalOptions } from \"../shared/basecmd\";\nimport { spawnEmbed, waitFor } from \"../shared/proc\";\nimport { TengoTesterBinaryPath } from \"@milaboratories/tengo-tester\";\n\nexport default function checkCommand(): Command {\n const cmd = new Command(\"check\").description(\"check tengo sources for language processor an\");\n\n cmd.argument(\"[paths...]\", \"source paths to check (defaults to ./src)\");\n addOptions(cmd, GlobalOptions());\n\n cmd.action(async (paths: string[], o) => {\n const logLevel = o.logLevel as string;\n const logger = createLogger(logLevel);\n\n const testerArgs: string[] = paths.length == 0 ? [\"./src\"] : paths;\n\n const tester = spawnEmbed(\n TengoTesterBinaryPath,\n \"check\",\n \"--log-level\",\n logLevel,\n \"--artifacts\",\n \"-\",\n ...testerArgs,\n );\n\n try {\n dumpArtifacts(logger, tester.stdin);\n } catch (err: unknown) {\n logger.error(err);\n } finally {\n tester.stdin.end();\n const code = await waitFor(tester);\n process.exit(code);\n }\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;;AAOA,SAAwB,eAAwB;CAC9C,MAAM,MAAM,IAAI,QAAQ,OAAO,CAAC,CAAC,YAAY,+CAA+C;CAE5F,IAAI,SAAS,cAAc,2CAA2C;CACtE,WAAW,KAAK,cAAc,CAAC;CAE/B,IAAI,OAAO,OAAO,OAAiB,MAAM;EACvC,MAAM,WAAW,EAAE;EACnB,MAAM,SAAS,aAAa,QAAQ;EAIpC,MAAM,SAAS,WACb,uBACA,SACA,eACA,UACA,eACA,KACA,GAT2B,MAAM,UAAU,IAAI,CAAC,OAAO,IAAI,KAU7D;EAEA,IAAI;GACF,cAAc,QAAQ,OAAO,KAAK;EACpC,SAAS,KAAc;GACrB,OAAO,MAAM,GAAG;EAClB,UAAU;GACR,OAAO,MAAM,IAAI;GACjB,MAAM,OAAO,MAAM,QAAQ,MAAM;GACjC,QAAQ,KAAK,IAAI;EACnB;CACF,CAAC;CAED,OAAO;AACT"}
1
+ {"version":3,"file":"check.js","names":[],"sources":["../../src/commands/check.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../compiler/util\";\nimport { dumpArtifacts } from \"../shared/dump\";\nimport { addOptions, GlobalOptions } from \"../shared/basecmd\";\nimport { spawnEmbed, waitFor } from \"../shared/proc\";\nimport { TengoTesterBinaryPath } from \"@milaboratories/tengo-tester\";\n\nexport default function checkCommand(): Command {\n const cmd = new Command(\"check\").description(\"check tengo sources for language processor an\");\n\n cmd.argument(\"[paths...]\", \"source paths to check (defaults to ./src)\");\n addOptions(cmd, GlobalOptions());\n\n cmd.action(async (paths: string[], o) => {\n const logLevel = o.logLevel as string;\n const logger = createLogger(logLevel);\n\n const testerArgs: string[] = paths.length == 0 ? [\"./src\"] : paths;\n\n const tester = spawnEmbed(\n TengoTesterBinaryPath,\n \"check\",\n \"--log-level\",\n logLevel,\n \"--artifacts\",\n \"-\",\n ...testerArgs,\n );\n\n try {\n dumpArtifacts(logger, tester.stdin);\n } catch (err: unknown) {\n logger.error(err);\n } finally {\n tester.stdin.end();\n const code = await waitFor(tester);\n process.exit(code);\n }\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;;AAOA,SAAwB,eAAwB;CAC9C,MAAM,MAAM,IAAI,QAAQ,OAAO,CAAC,CAAC,YAAY,+CAA+C;CAE5F,IAAI,SAAS,cAAc,2CAA2C;CACtE,WAAW,KAAK,cAAc,CAAC;CAE/B,IAAI,OAAO,OAAO,OAAiB,MAAM;EACvC,MAAM,WAAW,EAAE;EACnB,MAAM,SAAS,aAAa,QAAQ;EAEpC,MAAM,aAAuB,MAAM,UAAU,IAAI,CAAC,OAAO,IAAI;EAE7D,MAAM,SAAS,WACb,uBACA,SACA,eACA,UACA,eACA,KACA,GAAG,UACL;EAEA,IAAI;GACF,cAAc,QAAQ,OAAO,KAAK;EACpC,SAAS,KAAc;GACrB,OAAO,MAAM,GAAG;EAClB,UAAU;GACR,OAAO,MAAM,IAAI;GACjB,MAAM,OAAO,MAAM,QAAQ,MAAM;GACjC,QAAQ,KAAK,IAAI;EACnB;CACF,CAAC;CAED,OAAO;AACT"}
@@ -3,16 +3,16 @@ const require_basecmd = require("../../shared/basecmd.cjs");
3
3
  const require_dump = require("../../shared/dump.cjs");
4
4
  let commander = require("commander");
5
5
  let node_process = require("node:process");
6
- //#region src/commands/dump/artifacts.ts
6
+ // src/commands/dump/artifacts.ts
7
7
  function dumpArtifactsCommand() {
8
8
  const cmd = new commander.Command("artifacts").description("parse sources in current package and dump all found artifacts to stdout");
9
9
  require_basecmd.addOptions(cmd, require_basecmd.GlobalOptions(), require_basecmd.ArtifactTypeOptions());
10
10
  cmd.action(async (o) => {
11
- require_dump.dumpArtifacts(require_util.createLogger(o.logLevel), node_process.stdout, o.type == "all" ? void 0 : o.type);
11
+ const logger = require_util.createLogger(o.logLevel);
12
+ require_dump.dumpArtifacts(logger, node_process.stdout, o.type == "all" ? void 0 : o.type);
12
13
  });
13
14
  return cmd;
14
15
  }
15
- //#endregion
16
16
  exports.default = dumpArtifactsCommand;
17
17
 
18
18
  //# sourceMappingURL=artifacts.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"artifacts.cjs","names":["Command","createLogger","stdout"],"sources":["../../../src/commands/dump/artifacts.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../../compiler/util\";\nimport { dumpArtifacts } from \"../../shared/dump\";\nimport { stdout } from \"node:process\";\nimport type { ArtifactType } from \"../../compiler/package\";\nimport * as opts from \"../../shared/basecmd\";\n\nexport default function dumpArtifactsCommand(): Command {\n const cmd = new Command(\"artifacts\").description(\n \"parse sources in current package and dump all found artifacts to stdout\",\n );\n\n opts.addOptions(cmd, opts.GlobalOptions(), opts.ArtifactTypeOptions());\n\n cmd.action(async (o) => {\n const logger = createLogger(o.logLevel as string);\n dumpArtifacts(logger, stdout, o.type == \"all\" ? undefined : (o.type as ArtifactType));\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;AAOA,SAAwB,uBAAgC;CACtD,MAAM,MAAM,IAAIA,UAAAA,QAAQ,WAAW,CAAC,CAAC,YACnC,yEACF;CAEA,gBAAA,WAAgB,KAAA,gBAAA,cAAwB,GAAA,gBAAA,oBAA4B,CAAC;CAErE,IAAI,OAAO,OAAO,MAAM;EAEtB,aAAA,cADeC,aAAAA,aAAa,EAAE,QACX,GAAGC,aAAAA,QAAQ,EAAE,QAAQ,QAAQ,KAAA,IAAa,EAAE,IAAqB;CACtF,CAAC;CAED,OAAO;AACT"}
1
+ {"version":3,"file":"artifacts.cjs","names":["Command","createLogger","stdout"],"sources":["../../../src/commands/dump/artifacts.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../../compiler/util\";\nimport { dumpArtifacts } from \"../../shared/dump\";\nimport { stdout } from \"node:process\";\nimport type { ArtifactType } from \"../../compiler/package\";\nimport * as opts from \"../../shared/basecmd\";\n\nexport default function dumpArtifactsCommand(): Command {\n const cmd = new Command(\"artifacts\").description(\n \"parse sources in current package and dump all found artifacts to stdout\",\n );\n\n opts.addOptions(cmd, opts.GlobalOptions(), opts.ArtifactTypeOptions());\n\n cmd.action(async (o) => {\n const logger = createLogger(o.logLevel as string);\n dumpArtifacts(logger, stdout, o.type == \"all\" ? undefined : (o.type as ArtifactType));\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;AAOA,SAAwB,uBAAgC;CACtD,MAAM,MAAM,IAAIA,UAAAA,QAAQ,WAAW,CAAC,CAAC,YACnC,yEACF;CAEA,gBAAA,WAAgB,KAAA,gBAAA,cAAwB,GAAA,gBAAA,oBAA4B,CAAC;CAErE,IAAI,OAAO,OAAO,MAAM;EACtB,MAAM,SAASC,aAAAA,aAAa,EAAE,QAAkB;EAChD,aAAA,cAAc,QAAQC,aAAAA,QAAQ,EAAE,QAAQ,QAAQ,KAAA,IAAa,EAAE,IAAqB;CACtF,CAAC;CAED,OAAO;AACT"}
@@ -3,16 +3,16 @@ import { ArtifactTypeOptions, GlobalOptions, addOptions } from "../../shared/bas
3
3
  import { dumpArtifacts } from "../../shared/dump.js";
4
4
  import { Command } from "commander";
5
5
  import { stdout } from "node:process";
6
- //#region src/commands/dump/artifacts.ts
6
+ // src/commands/dump/artifacts.ts
7
7
  function dumpArtifactsCommand() {
8
8
  const cmd = new Command("artifacts").description("parse sources in current package and dump all found artifacts to stdout");
9
9
  addOptions(cmd, GlobalOptions(), ArtifactTypeOptions());
10
10
  cmd.action(async (o) => {
11
- dumpArtifacts(createLogger(o.logLevel), stdout, o.type == "all" ? void 0 : o.type);
11
+ const logger = createLogger(o.logLevel);
12
+ dumpArtifacts(logger, stdout, o.type == "all" ? void 0 : o.type);
12
13
  });
13
14
  return cmd;
14
15
  }
15
- //#endregion
16
16
  export { dumpArtifactsCommand as default };
17
17
 
18
18
  //# sourceMappingURL=artifacts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"artifacts.js","names":["opts.GlobalOptions","opts.ArtifactTypeOptions"],"sources":["../../../src/commands/dump/artifacts.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../../compiler/util\";\nimport { dumpArtifacts } from \"../../shared/dump\";\nimport { stdout } from \"node:process\";\nimport type { ArtifactType } from \"../../compiler/package\";\nimport * as opts from \"../../shared/basecmd\";\n\nexport default function dumpArtifactsCommand(): Command {\n const cmd = new Command(\"artifacts\").description(\n \"parse sources in current package and dump all found artifacts to stdout\",\n );\n\n opts.addOptions(cmd, opts.GlobalOptions(), opts.ArtifactTypeOptions());\n\n cmd.action(async (o) => {\n const logger = createLogger(o.logLevel as string);\n dumpArtifacts(logger, stdout, o.type == \"all\" ? undefined : (o.type as ArtifactType));\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;AAOA,SAAwB,uBAAgC;CACtD,MAAM,MAAM,IAAI,QAAQ,WAAW,CAAC,CAAC,YACnC,yEACF;CAEA,WAAgB,KAAKA,cAAmB,GAAGC,oBAAyB,CAAC;CAErE,IAAI,OAAO,OAAO,MAAM;EAEtB,cADe,aAAa,EAAE,QACX,GAAG,QAAQ,EAAE,QAAQ,QAAQ,KAAA,IAAa,EAAE,IAAqB;CACtF,CAAC;CAED,OAAO;AACT"}
1
+ {"version":3,"file":"artifacts.js","names":["opts.GlobalOptions","opts.ArtifactTypeOptions"],"sources":["../../../src/commands/dump/artifacts.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../../compiler/util\";\nimport { dumpArtifacts } from \"../../shared/dump\";\nimport { stdout } from \"node:process\";\nimport type { ArtifactType } from \"../../compiler/package\";\nimport * as opts from \"../../shared/basecmd\";\n\nexport default function dumpArtifactsCommand(): Command {\n const cmd = new Command(\"artifacts\").description(\n \"parse sources in current package and dump all found artifacts to stdout\",\n );\n\n opts.addOptions(cmd, opts.GlobalOptions(), opts.ArtifactTypeOptions());\n\n cmd.action(async (o) => {\n const logger = createLogger(o.logLevel as string);\n dumpArtifacts(logger, stdout, o.type == \"all\" ? undefined : (o.type as ArtifactType));\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;AAOA,SAAwB,uBAAgC;CACtD,MAAM,MAAM,IAAI,QAAQ,WAAW,CAAC,CAAC,YACnC,yEACF;CAEA,WAAgB,KAAKA,cAAmB,GAAGC,oBAAyB,CAAC;CAErE,IAAI,OAAO,OAAO,MAAM;EACtB,MAAM,SAAS,aAAa,EAAE,QAAkB;EAChD,cAAc,QAAQ,QAAQ,EAAE,QAAQ,QAAQ,KAAA,IAAa,EAAE,IAAqB;CACtF,CAAC;CAED,OAAO;AACT"}
@@ -3,16 +3,16 @@ const require_basecmd = require("../../shared/basecmd.cjs");
3
3
  const require_dump = require("../../shared/dump.cjs");
4
4
  let commander = require("commander");
5
5
  let node_process = require("node:process");
6
- //#region src/commands/dump/software.ts
6
+ // src/commands/dump/software.ts
7
7
  function dumpSoftwareCommand() {
8
8
  const cmd = new commander.Command("software").description("parse sources in current package and dump all software descriptors used by templates");
9
9
  require_basecmd.addOptions(cmd, require_basecmd.GlobalOptions());
10
10
  cmd.action(async (o) => {
11
- require_dump.dumpSoftware(require_util.createLogger(o.logLevel), node_process.stdout);
11
+ const logger = require_util.createLogger(o.logLevel);
12
+ require_dump.dumpSoftware(logger, node_process.stdout);
12
13
  });
13
14
  return cmd;
14
15
  }
15
- //#endregion
16
16
  exports.default = dumpSoftwareCommand;
17
17
 
18
18
  //# sourceMappingURL=software.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"software.cjs","names":["Command","createLogger","stdout"],"sources":["../../../src/commands/dump/software.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../../compiler/util\";\nimport { dumpSoftware } from \"../../shared/dump\";\nimport { stdout } from \"node:process\";\nimport * as opts from \"../../shared/basecmd\";\n\nexport default function dumpSoftwareCommand(): Command {\n const cmd = new Command(\"software\").description(\n \"parse sources in current package and dump all software descriptors used by templates\",\n );\n\n opts.addOptions(cmd, opts.GlobalOptions());\n\n cmd.action(async (o) => {\n const logger = createLogger(o.logLevel as string);\n dumpSoftware(logger, stdout);\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;AAMA,SAAwB,sBAA+B;CACrD,MAAM,MAAM,IAAIA,UAAAA,QAAQ,UAAU,CAAC,CAAC,YAClC,sFACF;CAEA,gBAAA,WAAgB,KAAA,gBAAA,cAAwB,CAAC;CAEzC,IAAI,OAAO,OAAO,MAAM;EAEtB,aAAA,aADeC,aAAAA,aAAa,EAAE,QACZ,GAAGC,aAAAA,MAAM;CAC7B,CAAC;CAED,OAAO;AACT"}
1
+ {"version":3,"file":"software.cjs","names":["Command","createLogger","stdout"],"sources":["../../../src/commands/dump/software.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../../compiler/util\";\nimport { dumpSoftware } from \"../../shared/dump\";\nimport { stdout } from \"node:process\";\nimport * as opts from \"../../shared/basecmd\";\n\nexport default function dumpSoftwareCommand(): Command {\n const cmd = new Command(\"software\").description(\n \"parse sources in current package and dump all software descriptors used by templates\",\n );\n\n opts.addOptions(cmd, opts.GlobalOptions());\n\n cmd.action(async (o) => {\n const logger = createLogger(o.logLevel as string);\n dumpSoftware(logger, stdout);\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;AAMA,SAAwB,sBAA+B;CACrD,MAAM,MAAM,IAAIA,UAAAA,QAAQ,UAAU,CAAC,CAAC,YAClC,sFACF;CAEA,gBAAA,WAAgB,KAAA,gBAAA,cAAwB,CAAC;CAEzC,IAAI,OAAO,OAAO,MAAM;EACtB,MAAM,SAASC,aAAAA,aAAa,EAAE,QAAkB;EAChD,aAAA,aAAa,QAAQC,aAAAA,MAAM;CAC7B,CAAC;CAED,OAAO;AACT"}
@@ -3,16 +3,16 @@ import { GlobalOptions, addOptions } from "../../shared/basecmd.js";
3
3
  import { dumpSoftware } from "../../shared/dump.js";
4
4
  import { Command } from "commander";
5
5
  import { stdout } from "node:process";
6
- //#region src/commands/dump/software.ts
6
+ // src/commands/dump/software.ts
7
7
  function dumpSoftwareCommand() {
8
8
  const cmd = new Command("software").description("parse sources in current package and dump all software descriptors used by templates");
9
9
  addOptions(cmd, GlobalOptions());
10
10
  cmd.action(async (o) => {
11
- dumpSoftware(createLogger(o.logLevel), stdout);
11
+ const logger = createLogger(o.logLevel);
12
+ dumpSoftware(logger, stdout);
12
13
  });
13
14
  return cmd;
14
15
  }
15
- //#endregion
16
16
  export { dumpSoftwareCommand as default };
17
17
 
18
18
  //# sourceMappingURL=software.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"software.js","names":["opts.GlobalOptions"],"sources":["../../../src/commands/dump/software.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../../compiler/util\";\nimport { dumpSoftware } from \"../../shared/dump\";\nimport { stdout } from \"node:process\";\nimport * as opts from \"../../shared/basecmd\";\n\nexport default function dumpSoftwareCommand(): Command {\n const cmd = new Command(\"software\").description(\n \"parse sources in current package and dump all software descriptors used by templates\",\n );\n\n opts.addOptions(cmd, opts.GlobalOptions());\n\n cmd.action(async (o) => {\n const logger = createLogger(o.logLevel as string);\n dumpSoftware(logger, stdout);\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;AAMA,SAAwB,sBAA+B;CACrD,MAAM,MAAM,IAAI,QAAQ,UAAU,CAAC,CAAC,YAClC,sFACF;CAEA,WAAgB,KAAKA,cAAmB,CAAC;CAEzC,IAAI,OAAO,OAAO,MAAM;EAEtB,aADe,aAAa,EAAE,QACZ,GAAG,MAAM;CAC7B,CAAC;CAED,OAAO;AACT"}
1
+ {"version":3,"file":"software.js","names":["opts.GlobalOptions"],"sources":["../../../src/commands/dump/software.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../../compiler/util\";\nimport { dumpSoftware } from \"../../shared/dump\";\nimport { stdout } from \"node:process\";\nimport * as opts from \"../../shared/basecmd\";\n\nexport default function dumpSoftwareCommand(): Command {\n const cmd = new Command(\"software\").description(\n \"parse sources in current package and dump all software descriptors used by templates\",\n );\n\n opts.addOptions(cmd, opts.GlobalOptions());\n\n cmd.action(async (o) => {\n const logger = createLogger(o.logLevel as string);\n dumpSoftware(logger, stdout);\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;AAMA,SAAwB,sBAA+B;CACrD,MAAM,MAAM,IAAI,QAAQ,UAAU,CAAC,CAAC,YAClC,sFACF;CAEA,WAAgB,KAAKA,cAAmB,CAAC;CAEzC,IAAI,OAAO,OAAO,MAAM;EACtB,MAAM,SAAS,aAAa,EAAE,QAAkB;EAChD,aAAa,QAAQ,MAAM;CAC7B,CAAC;CAED,OAAO;AACT"}
@@ -8,7 +8,7 @@ let node_path = require("node:path");
8
8
  node_path = require_runtime.__toESM(node_path, 1);
9
9
  let node_fs = require("node:fs");
10
10
  node_fs = require_runtime.__toESM(node_fs, 1);
11
- //#region src/commands/imports.ts
11
+ // src/commands/imports.ts
12
12
  const maxScanDepth = 9;
13
13
  function importsCommand() {
14
14
  const cmd = new commander.Command("imports").description("find imports tengo sources do not use");
@@ -73,7 +73,6 @@ function collectSources(roots) {
73
73
  }
74
74
  return sources;
75
75
  }
76
- //#endregion
77
76
  exports.default = importsCommand;
78
77
 
79
78
  //# sourceMappingURL=imports.cjs.map
@@ -5,7 +5,7 @@ import { dropImportLines, findUnusedImports } from "../compiler/imports.js";
5
5
  import { Command, Option } from "commander";
6
6
  import * as path from "node:path";
7
7
  import * as fs from "node:fs";
8
- //#region src/commands/imports.ts
8
+ // src/commands/imports.ts
9
9
  const maxScanDepth = 9;
10
10
  function importsCommand() {
11
11
  const cmd = new Command("imports").description("find imports tengo sources do not use");
@@ -70,7 +70,6 @@ function collectSources(roots) {
70
70
  }
71
71
  return sources;
72
72
  }
73
- //#endregion
74
73
  export { importsCommand as default };
75
74
 
76
75
  //# sourceMappingURL=imports.js.map
@@ -4,7 +4,7 @@ const require_dump = require("../shared/dump.cjs");
4
4
  const require_proc = require("../shared/proc.cjs");
5
5
  let commander = require("commander");
6
6
  let _milaboratories_tengo_tester = require("@milaboratories/tengo-tester");
7
- //#region src/commands/test.ts
7
+ // src/commands/test.ts
8
8
  function testCommand() {
9
9
  const cmd = new commander.Command("test").description("run tengo unit tests (.test.tengo)");
10
10
  cmd.argument("[paths...]", "source paths to test (defaults to ./src)");
@@ -12,7 +12,8 @@ function testCommand() {
12
12
  cmd.action(async (paths, o) => {
13
13
  const logLevel = o.logLevel;
14
14
  const logger = require_util.createLogger(logLevel);
15
- const tester = require_proc.spawnEmbed(_milaboratories_tengo_tester.TengoTesterBinaryPath, "run", "--log-level", logLevel, "--artifacts", "-", ...paths.length == 0 ? ["./src"] : paths);
15
+ const testerArgs = paths.length == 0 ? ["./src"] : paths;
16
+ const tester = require_proc.spawnEmbed(_milaboratories_tengo_tester.TengoTesterBinaryPath, "run", "--log-level", logLevel, "--artifacts", "-", ...testerArgs);
16
17
  try {
17
18
  require_dump.dumpArtifacts(logger, tester.stdin);
18
19
  } catch (err) {
@@ -25,7 +26,6 @@ function testCommand() {
25
26
  });
26
27
  return cmd;
27
28
  }
28
- //#endregion
29
29
  exports.default = testCommand;
30
30
 
31
31
  //# sourceMappingURL=test.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"test.cjs","names":["Command","GlobalOptions","createLogger","spawnEmbed","TengoTesterBinaryPath","waitFor"],"sources":["../../src/commands/test.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../compiler/util\";\nimport { dumpArtifacts } from \"../shared/dump\";\nimport { addOptions, GlobalOptions } from \"../shared/basecmd\";\nimport { spawnEmbed, waitFor } from \"../shared/proc\";\nimport { TengoTesterBinaryPath } from \"@milaboratories/tengo-tester\";\n\nexport default function testCommand(): Command {\n const cmd = new Command(\"test\").description(\"run tengo unit tests (.test.tengo)\");\n\n cmd.argument(\"[paths...]\", \"source paths to test (defaults to ./src)\");\n addOptions(cmd, GlobalOptions());\n\n cmd.action(async (paths: string[], o) => {\n const logLevel = o.logLevel as string;\n const logger = createLogger(logLevel);\n\n const testerArgs: string[] = paths.length == 0 ? [\"./src\"] : paths;\n\n const tester = spawnEmbed(\n TengoTesterBinaryPath,\n \"run\",\n \"--log-level\",\n logLevel,\n \"--artifacts\",\n \"-\",\n ...testerArgs,\n );\n\n try {\n dumpArtifacts(logger, tester.stdin);\n } catch (err: unknown) {\n logger.error(err);\n } finally {\n tester.stdin.end();\n const code = await waitFor(tester);\n process.exit(code);\n }\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;;AAOA,SAAwB,cAAuB;CAC7C,MAAM,MAAM,IAAIA,UAAAA,QAAQ,MAAM,CAAC,CAAC,YAAY,oCAAoC;CAEhF,IAAI,SAAS,cAAc,0CAA0C;CACrE,gBAAA,WAAW,KAAKC,gBAAAA,cAAc,CAAC;CAE/B,IAAI,OAAO,OAAO,OAAiB,MAAM;EACvC,MAAM,WAAW,EAAE;EACnB,MAAM,SAASC,aAAAA,aAAa,QAAQ;EAIpC,MAAM,SAASC,aAAAA,WACbC,6BAAAA,uBACA,OACA,eACA,UACA,eACA,KACA,GAT2B,MAAM,UAAU,IAAI,CAAC,OAAO,IAAI,KAU7D;EAEA,IAAI;GACF,aAAA,cAAc,QAAQ,OAAO,KAAK;EACpC,SAAS,KAAc;GACrB,OAAO,MAAM,GAAG;EAClB,UAAU;GACR,OAAO,MAAM,IAAI;GACjB,MAAM,OAAO,MAAMC,aAAAA,QAAQ,MAAM;GACjC,QAAQ,KAAK,IAAI;EACnB;CACF,CAAC;CAED,OAAO;AACT"}
1
+ {"version":3,"file":"test.cjs","names":["Command","GlobalOptions","createLogger","spawnEmbed","TengoTesterBinaryPath","waitFor"],"sources":["../../src/commands/test.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../compiler/util\";\nimport { dumpArtifacts } from \"../shared/dump\";\nimport { addOptions, GlobalOptions } from \"../shared/basecmd\";\nimport { spawnEmbed, waitFor } from \"../shared/proc\";\nimport { TengoTesterBinaryPath } from \"@milaboratories/tengo-tester\";\n\nexport default function testCommand(): Command {\n const cmd = new Command(\"test\").description(\"run tengo unit tests (.test.tengo)\");\n\n cmd.argument(\"[paths...]\", \"source paths to test (defaults to ./src)\");\n addOptions(cmd, GlobalOptions());\n\n cmd.action(async (paths: string[], o) => {\n const logLevel = o.logLevel as string;\n const logger = createLogger(logLevel);\n\n const testerArgs: string[] = paths.length == 0 ? [\"./src\"] : paths;\n\n const tester = spawnEmbed(\n TengoTesterBinaryPath,\n \"run\",\n \"--log-level\",\n logLevel,\n \"--artifacts\",\n \"-\",\n ...testerArgs,\n );\n\n try {\n dumpArtifacts(logger, tester.stdin);\n } catch (err: unknown) {\n logger.error(err);\n } finally {\n tester.stdin.end();\n const code = await waitFor(tester);\n process.exit(code);\n }\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;;AAOA,SAAwB,cAAuB;CAC7C,MAAM,MAAM,IAAIA,UAAAA,QAAQ,MAAM,CAAC,CAAC,YAAY,oCAAoC;CAEhF,IAAI,SAAS,cAAc,0CAA0C;CACrE,gBAAA,WAAW,KAAKC,gBAAAA,cAAc,CAAC;CAE/B,IAAI,OAAO,OAAO,OAAiB,MAAM;EACvC,MAAM,WAAW,EAAE;EACnB,MAAM,SAASC,aAAAA,aAAa,QAAQ;EAEpC,MAAM,aAAuB,MAAM,UAAU,IAAI,CAAC,OAAO,IAAI;EAE7D,MAAM,SAASC,aAAAA,WACbC,6BAAAA,uBACA,OACA,eACA,UACA,eACA,KACA,GAAG,UACL;EAEA,IAAI;GACF,aAAA,cAAc,QAAQ,OAAO,KAAK;EACpC,SAAS,KAAc;GACrB,OAAO,MAAM,GAAG;EAClB,UAAU;GACR,OAAO,MAAM,IAAI;GACjB,MAAM,OAAO,MAAMC,aAAAA,QAAQ,MAAM;GACjC,QAAQ,KAAK,IAAI;EACnB;CACF,CAAC;CAED,OAAO;AACT"}
@@ -4,7 +4,7 @@ import { dumpArtifacts } from "../shared/dump.js";
4
4
  import { spawnEmbed, waitFor } from "../shared/proc.js";
5
5
  import { Command } from "commander";
6
6
  import { TengoTesterBinaryPath } from "@milaboratories/tengo-tester";
7
- //#region src/commands/test.ts
7
+ // src/commands/test.ts
8
8
  function testCommand() {
9
9
  const cmd = new Command("test").description("run tengo unit tests (.test.tengo)");
10
10
  cmd.argument("[paths...]", "source paths to test (defaults to ./src)");
@@ -12,7 +12,8 @@ function testCommand() {
12
12
  cmd.action(async (paths, o) => {
13
13
  const logLevel = o.logLevel;
14
14
  const logger = createLogger(logLevel);
15
- const tester = spawnEmbed(TengoTesterBinaryPath, "run", "--log-level", logLevel, "--artifacts", "-", ...paths.length == 0 ? ["./src"] : paths);
15
+ const testerArgs = paths.length == 0 ? ["./src"] : paths;
16
+ const tester = spawnEmbed(TengoTesterBinaryPath, "run", "--log-level", logLevel, "--artifacts", "-", ...testerArgs);
16
17
  try {
17
18
  dumpArtifacts(logger, tester.stdin);
18
19
  } catch (err) {
@@ -25,7 +26,6 @@ function testCommand() {
25
26
  });
26
27
  return cmd;
27
28
  }
28
- //#endregion
29
29
  export { testCommand as default };
30
30
 
31
31
  //# sourceMappingURL=test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"test.js","names":[],"sources":["../../src/commands/test.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../compiler/util\";\nimport { dumpArtifacts } from \"../shared/dump\";\nimport { addOptions, GlobalOptions } from \"../shared/basecmd\";\nimport { spawnEmbed, waitFor } from \"../shared/proc\";\nimport { TengoTesterBinaryPath } from \"@milaboratories/tengo-tester\";\n\nexport default function testCommand(): Command {\n const cmd = new Command(\"test\").description(\"run tengo unit tests (.test.tengo)\");\n\n cmd.argument(\"[paths...]\", \"source paths to test (defaults to ./src)\");\n addOptions(cmd, GlobalOptions());\n\n cmd.action(async (paths: string[], o) => {\n const logLevel = o.logLevel as string;\n const logger = createLogger(logLevel);\n\n const testerArgs: string[] = paths.length == 0 ? [\"./src\"] : paths;\n\n const tester = spawnEmbed(\n TengoTesterBinaryPath,\n \"run\",\n \"--log-level\",\n logLevel,\n \"--artifacts\",\n \"-\",\n ...testerArgs,\n );\n\n try {\n dumpArtifacts(logger, tester.stdin);\n } catch (err: unknown) {\n logger.error(err);\n } finally {\n tester.stdin.end();\n const code = await waitFor(tester);\n process.exit(code);\n }\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;;AAOA,SAAwB,cAAuB;CAC7C,MAAM,MAAM,IAAI,QAAQ,MAAM,CAAC,CAAC,YAAY,oCAAoC;CAEhF,IAAI,SAAS,cAAc,0CAA0C;CACrE,WAAW,KAAK,cAAc,CAAC;CAE/B,IAAI,OAAO,OAAO,OAAiB,MAAM;EACvC,MAAM,WAAW,EAAE;EACnB,MAAM,SAAS,aAAa,QAAQ;EAIpC,MAAM,SAAS,WACb,uBACA,OACA,eACA,UACA,eACA,KACA,GAT2B,MAAM,UAAU,IAAI,CAAC,OAAO,IAAI,KAU7D;EAEA,IAAI;GACF,cAAc,QAAQ,OAAO,KAAK;EACpC,SAAS,KAAc;GACrB,OAAO,MAAM,GAAG;EAClB,UAAU;GACR,OAAO,MAAM,IAAI;GACjB,MAAM,OAAO,MAAM,QAAQ,MAAM;GACjC,QAAQ,KAAK,IAAI;EACnB;CACF,CAAC;CAED,OAAO;AACT"}
1
+ {"version":3,"file":"test.js","names":[],"sources":["../../src/commands/test.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { createLogger } from \"../compiler/util\";\nimport { dumpArtifacts } from \"../shared/dump\";\nimport { addOptions, GlobalOptions } from \"../shared/basecmd\";\nimport { spawnEmbed, waitFor } from \"../shared/proc\";\nimport { TengoTesterBinaryPath } from \"@milaboratories/tengo-tester\";\n\nexport default function testCommand(): Command {\n const cmd = new Command(\"test\").description(\"run tengo unit tests (.test.tengo)\");\n\n cmd.argument(\"[paths...]\", \"source paths to test (defaults to ./src)\");\n addOptions(cmd, GlobalOptions());\n\n cmd.action(async (paths: string[], o) => {\n const logLevel = o.logLevel as string;\n const logger = createLogger(logLevel);\n\n const testerArgs: string[] = paths.length == 0 ? [\"./src\"] : paths;\n\n const tester = spawnEmbed(\n TengoTesterBinaryPath,\n \"run\",\n \"--log-level\",\n logLevel,\n \"--artifacts\",\n \"-\",\n ...testerArgs,\n );\n\n try {\n dumpArtifacts(logger, tester.stdin);\n } catch (err: unknown) {\n logger.error(err);\n } finally {\n tester.stdin.end();\n const code = await waitFor(tester);\n process.exit(code);\n }\n });\n\n return cmd;\n}\n"],"mappings":";;;;;;;AAOA,SAAwB,cAAuB;CAC7C,MAAM,MAAM,IAAI,QAAQ,MAAM,CAAC,CAAC,YAAY,oCAAoC;CAEhF,IAAI,SAAS,cAAc,0CAA0C;CACrE,WAAW,KAAK,cAAc,CAAC;CAE/B,IAAI,OAAO,OAAO,OAAiB,MAAM;EACvC,MAAM,WAAW,EAAE;EACnB,MAAM,SAAS,aAAa,QAAQ;EAEpC,MAAM,aAAuB,MAAM,UAAU,IAAI,CAAC,OAAO,IAAI;EAE7D,MAAM,SAAS,WACb,uBACA,OACA,eACA,UACA,eACA,KACA,GAAG,UACL;EAEA,IAAI;GACF,cAAc,QAAQ,OAAO,KAAK;EACpC,SAAS,KAAc;GACrB,OAAO,MAAM,GAAG;EAClB,UAAU;GACR,OAAO,MAAM,IAAI;GACjB,MAAM,OAAO,MAAM,QAAQ,MAAM;GACjC,QAAQ,KAAK,IAAI;EACnB;CACF,CAAC;CAED,OAAO;AACT"}
@@ -1,6 +1,6 @@
1
1
  const require_util = require("./util.cjs");
2
2
  const require_package = require("./package.cjs");
3
- //#region src/compiler/artifactset.ts
3
+ // src/compiler/artifactset.ts
4
4
  var ArtifactMap = class {
5
5
  nameExtractor;
6
6
  map = /* @__PURE__ */ new Map();
@@ -59,7 +59,6 @@ var ArtifactStore = class {
59
59
  this.dist.forEach((obj, k) => callback(this.get(mode, k) ?? obj, k));
60
60
  }
61
61
  };
62
- //#endregion
63
62
  exports.ArtifactMap = ArtifactMap;
64
63
  exports.ArtifactStore = ArtifactStore;
65
64
  exports.createArtifactNameSet = createArtifactNameSet;
@@ -1,6 +1,6 @@
1
1
  import { assertNever } from "./util.js";
2
2
  import { artifactKey } from "./package.js";
3
- //#region src/compiler/artifactset.ts
3
+ // src/compiler/artifactset.ts
4
4
  var ArtifactMap = class {
5
5
  nameExtractor;
6
6
  map = /* @__PURE__ */ new Map();
@@ -59,7 +59,6 @@ var ArtifactStore = class {
59
59
  this.dist.forEach((obj, k) => callback(this.get(mode, k) ?? obj, k));
60
60
  }
61
61
  };
62
- //#endregion
63
62
  export { ArtifactMap, ArtifactStore, createArtifactNameSet };
64
63
 
65
64
  //# sourceMappingURL=artifactset.js.map
@@ -3,7 +3,7 @@ const require_package = require("./package.cjs");
3
3
  const require_template = require("./template.cjs");
4
4
  const require_artifactset = require("./artifactset.cjs");
5
5
  const require_compileroptions = require("./compileroptions.cjs");
6
- //#region src/compiler/compiler.ts
6
+ // src/compiler/compiler.ts
7
7
  /** Add a capability token to a template's `requiredCapabilities` list,
8
8
  * skipping duplicates. Initializes the array lazily so the field stays
9
9
  * absent for templates that need nothing. */
@@ -283,7 +283,6 @@ var TengoTemplateCompiler = class {
283
283
  return result;
284
284
  }
285
285
  };
286
- //#endregion
287
286
  exports.TengoTemplateCompiler = TengoTemplateCompiler;
288
287
 
289
288
  //# sourceMappingURL=compiler.cjs.map
@@ -3,7 +3,7 @@ import { artifactNameToString, formatArtefactNameAndVersion, fullNameEquals, ful
3
3
  import { newTemplateWithSource } from "./template.js";
4
4
  import { ArtifactStore } from "./artifactset.js";
5
5
  import { applyLibraryCompilerOptions, applyTemplateCompilerOptions } from "./compileroptions.js";
6
- //#region src/compiler/compiler.ts
6
+ // src/compiler/compiler.ts
7
7
  /** Add a capability token to a template's `requiredCapabilities` list,
8
8
  * skipping duplicates. Initializes the array lazily so the field stays
9
9
  * absent for templates that need nothing. */
@@ -283,7 +283,6 @@ var TengoTemplateCompiler = class {
283
283
  return result;
284
284
  }
285
285
  };
286
- //#endregion
287
286
  export { TengoTemplateCompiler };
288
287
 
289
288
  //# sourceMappingURL=compiler.js.map
@@ -1,10 +1,8 @@
1
1
  const require_util = require("./util.cjs");
2
- //#region src/compiler/compileroptions.ts
2
+ // src/compiler/compileroptions.ts
3
3
  function applyTemplateCompilerOptions(opts, tpl) {
4
4
  for (const opt of opts) switch (opt.name) {
5
- case "hash_override":
6
- tpl.hashOverride = hashOverride(opt.args);
7
- break;
5
+ case "hash_override": tpl.hashOverride = hashOverride(opt.args);
8
6
  }
9
7
  }
10
8
  function applyLibraryCompilerOptions(opts, _lib) {
@@ -18,7 +16,6 @@ function hashOverride(args) {
18
16
  if (!require_util.isUUID(override)) throw new Error("hash_override must contain valid UUID as an override. As hash_override affects deduplication, it becomes completely not possible to distinguish several different templates from each other on backend's side. This means, if you set hash_override to a simple value (say, letter \"a\") on two completely different templates, they will be marked as interchangeable on backend's side with unpredictable consequences. UUID looks like a safe enough tradeoff between the feature usage simplicity and duplication safety");
19
17
  return override;
20
18
  }
21
- //#endregion
22
19
  exports.applyLibraryCompilerOptions = applyLibraryCompilerOptions;
23
20
  exports.applyTemplateCompilerOptions = applyTemplateCompilerOptions;
24
21
  exports.hashOverride = hashOverride;
@@ -1 +1 @@
1
- {"version":3,"file":"compileroptions.cjs","names":[],"sources":["../../src/compiler/compileroptions.ts"],"sourcesContent":["import type { TemplateDataV3, TemplateLibDataV3 } from \"@milaboratories/pl-model-backend\";\nimport type { CompilerOption } from \"./package\";\nimport * as util from \"./util\";\n\nexport function applyTemplateCompilerOptions(opts: CompilerOption[], tpl: TemplateDataV3) {\n for (const opt of opts) {\n switch (opt.name) {\n case \"hash_override\": {\n tpl.hashOverride = hashOverride(opt.args);\n break;\n }\n }\n }\n}\n\nexport function applyLibraryCompilerOptions(opts: CompilerOption[], _lib: TemplateLibDataV3) {\n for (const opt of opts) {\n switch (opt.name) {\n case \"hash_override\": {\n throw new Error(\n `hash_override compiler option can be used ONLY on template level. Even in templates it is already dangerous enough` +\n ` to potentially break everything in Platforma Backend. In libraries with the transitive dependencies` +\n ` resolution and flattening of libraries list on template level, it becomes so unpredictibally disasterous, that` +\n ` we are doomed to never find the ends of a knot if anything goes wrong.`,\n );\n }\n }\n }\n}\n\nexport function hashOverride(args: string[]): string {\n if (args.length != 1) {\n throw new Error(\n \"hash_override compiler option expects exactly one argument: hash_override <some string>. Note, you can use only UUID as a value.\",\n );\n }\n\n const override = args[0].toLowerCase();\n\n if (!util.isUUID(override)) {\n throw new Error(\n \"hash_override must contain valid UUID as an override. As hash_override affects deduplication,\" +\n \" it becomes completely not possible to distinguish several different templates from each other on backend's side.\" +\n ' This means, if you set hash_override to a simple value (say, letter \"a\") on two completely different templates,' +\n \" they will be marked as interchangeable on backend's side with unpredictable consequences.\" +\n \" UUID looks like a safe enough tradeoff between the feature usage simplicity and duplication safety\",\n );\n }\n\n return override;\n}\n"],"mappings":";;AAIA,SAAgB,6BAA6B,MAAwB,KAAqB;CACxF,KAAK,MAAM,OAAO,MAChB,QAAQ,IAAI,MAAZ;EACE,KAAK;GACH,IAAI,eAAe,aAAa,IAAI,IAAI;GACxC;CAEJ;AAEJ;AAEA,SAAgB,4BAA4B,MAAwB,MAAyB;CAC3F,KAAK,MAAM,OAAO,MAChB,QAAQ,IAAI,MAAZ;EACE,KAAK,iBACH,MAAM,IAAI,MACR,8YAIF;CAEJ;AAEJ;AAEA,SAAgB,aAAa,MAAwB;CACnD,IAAI,KAAK,UAAU,GACjB,MAAM,IAAI,MACR,kIACF;CAGF,MAAM,WAAW,KAAK,EAAE,CAAC,YAAY;CAErC,IAAI,CAAA,aAAA,OAAa,QAAQ,GACvB,MAAM,IAAI,MACR,+fAKF;CAGF,OAAO;AACT"}
1
+ {"version":3,"file":"compileroptions.cjs","names":[],"sources":["../../src/compiler/compileroptions.ts"],"sourcesContent":["import type { TemplateDataV3, TemplateLibDataV3 } from \"@milaboratories/pl-model-backend\";\nimport type { CompilerOption } from \"./package\";\nimport * as util from \"./util\";\n\nexport function applyTemplateCompilerOptions(opts: CompilerOption[], tpl: TemplateDataV3) {\n for (const opt of opts) {\n switch (opt.name) {\n case \"hash_override\": {\n tpl.hashOverride = hashOverride(opt.args);\n break;\n }\n }\n }\n}\n\nexport function applyLibraryCompilerOptions(opts: CompilerOption[], _lib: TemplateLibDataV3) {\n for (const opt of opts) {\n switch (opt.name) {\n case \"hash_override\": {\n throw new Error(\n `hash_override compiler option can be used ONLY on template level. Even in templates it is already dangerous enough` +\n ` to potentially break everything in Platforma Backend. In libraries with the transitive dependencies` +\n ` resolution and flattening of libraries list on template level, it becomes so unpredictibally disasterous, that` +\n ` we are doomed to never find the ends of a knot if anything goes wrong.`,\n );\n }\n }\n }\n}\n\nexport function hashOverride(args: string[]): string {\n if (args.length != 1) {\n throw new Error(\n \"hash_override compiler option expects exactly one argument: hash_override <some string>. Note, you can use only UUID as a value.\",\n );\n }\n\n const override = args[0].toLowerCase();\n\n if (!util.isUUID(override)) {\n throw new Error(\n \"hash_override must contain valid UUID as an override. As hash_override affects deduplication,\" +\n \" it becomes completely not possible to distinguish several different templates from each other on backend's side.\" +\n ' This means, if you set hash_override to a simple value (say, letter \"a\") on two completely different templates,' +\n \" they will be marked as interchangeable on backend's side with unpredictable consequences.\" +\n \" UUID looks like a safe enough tradeoff between the feature usage simplicity and duplication safety\",\n );\n }\n\n return override;\n}\n"],"mappings":";;AAIA,SAAgB,6BAA6B,MAAwB,KAAqB;CACxF,KAAK,MAAM,OAAO,MAChB,QAAQ,IAAI,MAAZ;EACE,KAAK,iBACH,IAAI,eAAe,aAAa,IAAI,IAAI;CAG5C;AAEJ;AAEA,SAAgB,4BAA4B,MAAwB,MAAyB;CAC3F,KAAK,MAAM,OAAO,MAChB,QAAQ,IAAI,MAAZ;EACE,KAAK,iBACH,MAAM,IAAI,MACR,8YAIF;CAEJ;AAEJ;AAEA,SAAgB,aAAa,MAAwB;CACnD,IAAI,KAAK,UAAU,GACjB,MAAM,IAAI,MACR,kIACF;CAGF,MAAM,WAAW,KAAK,EAAE,CAAC,YAAY;CAErC,IAAI,CAAA,aAAA,OAAa,QAAQ,GACvB,MAAM,IAAI,MACR,+fAKF;CAGF,OAAO;AACT"}
@@ -1,10 +1,8 @@
1
1
  import { isUUID } from "./util.js";
2
- //#region src/compiler/compileroptions.ts
2
+ // src/compiler/compileroptions.ts
3
3
  function applyTemplateCompilerOptions(opts, tpl) {
4
4
  for (const opt of opts) switch (opt.name) {
5
- case "hash_override":
6
- tpl.hashOverride = hashOverride(opt.args);
7
- break;
5
+ case "hash_override": tpl.hashOverride = hashOverride(opt.args);
8
6
  }
9
7
  }
10
8
  function applyLibraryCompilerOptions(opts, _lib) {
@@ -18,7 +16,6 @@ function hashOverride(args) {
18
16
  if (!isUUID(override)) throw new Error("hash_override must contain valid UUID as an override. As hash_override affects deduplication, it becomes completely not possible to distinguish several different templates from each other on backend's side. This means, if you set hash_override to a simple value (say, letter \"a\") on two completely different templates, they will be marked as interchangeable on backend's side with unpredictable consequences. UUID looks like a safe enough tradeoff between the feature usage simplicity and duplication safety");
19
17
  return override;
20
18
  }
21
- //#endregion
22
19
  export { applyLibraryCompilerOptions, applyTemplateCompilerOptions, hashOverride };
23
20
 
24
21
  //# sourceMappingURL=compileroptions.js.map