@abaplint/transpiler-cli 2.10.51 → 2.10.53

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.
package/build/bundle.js CHANGED
@@ -80864,16 +80864,16 @@ class Initialization {
80864
80864
  let ret = "";
80865
80865
  if (useImport === true) {
80866
80866
  ret = `/* eslint-disable import/newline-after-import */
80867
- import "./_top.mjs";\n`;
80867
+ import "./_top.mjs";\n`;
80868
80868
  }
80869
80869
  else {
80870
80870
  ret = `/* eslint-disable import/newline-after-import */
80871
- import runtime from "@abaplint/runtime";
80872
- globalThis.abap = new runtime.ABAP();\n`;
80871
+ import runtime from "@abaplint/runtime";
80872
+ globalThis.abap = new runtime.ABAP();\n`;
80873
80873
  }
80874
80874
  ret += `${this.buildImports(reg, useImport)}
80875
80875
 
80876
- export async function initializeABAP() {\n`;
80876
+ export async function initializeABAP() {\n`;
80877
80877
  ret += ` const sqlite = [];\n`;
80878
80878
  for (const i of dbSetup.schemas.sqlite) {
80879
80879
  ret += ` sqlite.push(\`${i}\`);\n`;
@@ -80931,21 +80931,21 @@ class Initialization {
80931
80931
  }
80932
80932
  }
80933
80933
  for (const obj of reg.getObjects()) {
80934
- if (obj instanceof abaplint.Objects.FunctionGroup) {
80935
- list.push(imp(`${escapeNamespaceFilename(obj.getName().toLowerCase())}.fugr`));
80936
- }
80937
- else if (obj instanceof abaplint.Objects.Class) {
80938
- if (obj.getName().toUpperCase() !== "CL_ABAP_CHAR_UTILITIES"
80939
- && this.hasClassConstructor(reg, obj)) {
80940
- // this will not solve all problems with class constors 100%, but probably good enough
80941
- late.push(imp(`${escapeNamespaceFilename(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
80942
- }
80943
- else {
80944
- list.push(imp(`${escapeNamespaceFilename(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
80945
- }
80934
+ const name = imp(`${escapeNamespaceFilename(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`);
80935
+ if (obj instanceof abaplint.Objects.Class
80936
+ && obj.getName().toUpperCase() !== "CL_ABAP_CHAR_UTILITIES"
80937
+ && this.hasClassConstructor(reg, obj)) {
80938
+ // this will not solve all problems with class constructors 100%, but probably good enough
80939
+ late.push(name);
80940
+ }
80941
+ else if (obj instanceof abaplint.Objects.Program && obj.isInclude() === true) {
80942
+ continue;
80946
80943
  }
80947
- else if (obj instanceof abaplint.Objects.Interface) {
80948
- list.push(imp(`${escapeNamespaceFilename(obj.getName().toLowerCase())}.${obj.getType().toLowerCase()}`));
80944
+ else if (obj instanceof abaplint.Objects.Interface
80945
+ || obj instanceof abaplint.Objects.FunctionGroup
80946
+ || obj instanceof abaplint.Objects.Program
80947
+ || obj instanceof abaplint.Objects.Class) {
80948
+ list.push(name);
80949
80949
  }
80950
80950
  }
80951
80951
  return [...list.sort(), ...late].join("\n");
@@ -100512,7 +100512,8 @@ function loadLib(config) {
100512
100512
  }
100513
100513
  return files;
100514
100514
  }
100515
- function writeObjects(objects, writeSourceMaps, outputFolder, files) {
100515
+ function writeObjects(objects, config, outputFolder, files) {
100516
+ const writeSourceMaps = config.write_source_map || false;
100516
100517
  for (const o of objects) {
100517
100518
  let contents = o.chunk.getCode();
100518
100519
  if (writeSourceMaps === true
@@ -100538,7 +100539,7 @@ function writeObjects(objects, writeSourceMaps, outputFolder, files) {
100538
100539
  }
100539
100540
  fs.writeFileSync(outputFolder + path.sep + name, map);
100540
100541
  }
100541
- if (o.object.type.toUpperCase() === "PROG") {
100542
+ if (o.object.type.toUpperCase() === "PROG" && config.no_top_level_prog !== true) {
100542
100543
  // hmm, will this work for INCLUDEs ?
100543
100544
  contents = `await import("./_init.mjs");\n` + contents;
100544
100545
  }
@@ -100566,7 +100567,7 @@ async function run() {
100566
100567
  if (!fs.existsSync(outputFolder)) {
100567
100568
  fs.mkdirSync(outputFolder);
100568
100569
  }
100569
- writeObjects(output.objects, config.write_source_map || false, outputFolder, files);
100570
+ writeObjects(output.objects, config, outputFolder, files);
100570
100571
  console.log(output.objects.length + " objects written to disk");
100571
100572
  if (config.write_unit_tests === true) {
100572
100573
  // breaking change? rename this output file,
package/build/types.d.ts CHANGED
@@ -15,5 +15,6 @@ export interface ITranspilerConfig {
15
15
  }[];
16
16
  write_unit_tests?: boolean;
17
17
  write_source_map?: boolean;
18
+ no_top_level_prog?: boolean;
18
19
  options: ITranspilerOptions;
19
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.10.51",
3
+ "version": "2.10.53",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -28,7 +28,7 @@
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
30
  "@abaplint/core": "^2.113.114",
31
- "@abaplint/transpiler": "^2.10.51",
31
+ "@abaplint/transpiler": "^2.10.53",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^22.15.18",
34
34
  "@types/progress": "^2.0.7",