@abaplint/transpiler-cli 2.14.0 → 2.14.1
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/README.md +28 -1
- package/build/bundle.js +11 -2
- package/build/types.d.ts +2 -0
- package/package.json +2 -2
- package/schema.json +46 -1
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ output/
|
|
|
51
51
|
Names must be valid single directory names on Windows and POSIX. Names are
|
|
52
52
|
unique without regard to case, and `project` is reserved. A conflicting derived
|
|
53
53
|
name needs an explicit `libs[].name`. Duplicate ABAP objects across libraries
|
|
54
|
-
are rejected; a project object replaces a library object of the same type/name.
|
|
54
|
+
are rejected by default; a project object replaces a library object of the same type/name.
|
|
55
55
|
|
|
56
56
|
Class locals, test classes, function groups, MIME data, and
|
|
57
57
|
source maps follow their owning object. Source maps include ABAP source content,
|
|
@@ -68,3 +68,30 @@ files automatically.
|
|
|
68
68
|
The transpiler library retains flat output unless its caller supplies an output
|
|
69
69
|
folder map as the third argument to `Transpiler.run()`. This layout is enabled
|
|
70
70
|
automatically by the CLI.
|
|
71
|
+
|
|
72
|
+
## Duplicate dependencies
|
|
73
|
+
|
|
74
|
+
By default, two libraries defining the same ABAP object (type and name) cause
|
|
75
|
+
an `Ambiguous dependency object` error. To keep existing dependency repositories
|
|
76
|
+
and skip later copies, set this top-level option in `abap_transpile.json`:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"skip_duplicate_dependencies": true
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The first library in `libs` containing an object wins. Every file of that
|
|
85
|
+
object in later libraries is skipped, including metadata, class locals, and
|
|
86
|
+
binary assets. The CLI warns once per skipped object per library, naming the
|
|
87
|
+
selected library. Imports, output folders, and source maps use the selected
|
|
88
|
+
copy. Project objects still take precedence over dependencies, and shared
|
|
89
|
+
`package.devc.xml` metadata keeps its existing behavior.
|
|
90
|
+
|
|
91
|
+
Library order now affects generated output. Different definitions can change
|
|
92
|
+
DDIC types, available methods, and runtime behavior, or cause syntax errors in
|
|
93
|
+
code expecting the skipped version. This option does not check that copies are
|
|
94
|
+
equivalent or suppress syntax checking. Put the intended provider first and
|
|
95
|
+
run your application's tests. For selective control, use `libs[].exclude_filter`
|
|
96
|
+
to exclude only the unwanted object's files instead. Use a clean generated
|
|
97
|
+
output directory when changing providers, since old output is not removed.
|
package/build/bundle.js
CHANGED
|
@@ -340,7 +340,7 @@ async function build(config, files) {
|
|
|
340
340
|
options.ignoreSourceMap = true;
|
|
341
341
|
}
|
|
342
342
|
const t = new Transpiler.Transpiler(options);
|
|
343
|
-
const { reg, folders, sources } = (0, libraries_1.libraryRegistry)(files, libraries);
|
|
343
|
+
const { reg, folders, sources } = (0, libraries_1.libraryRegistry)(files, libraries, config.skip_duplicate_dependencies);
|
|
344
344
|
const output = await t.run(reg, new Progress(), folders);
|
|
345
345
|
return { output, sources };
|
|
346
346
|
}
|
|
@@ -559,13 +559,14 @@ async function loadLibraries(config) {
|
|
|
559
559
|
}
|
|
560
560
|
return result;
|
|
561
561
|
}
|
|
562
|
-
function libraryRegistry(files, libraries) {
|
|
562
|
+
function libraryRegistry(files, libraries, skipDuplicateDependencies = false) {
|
|
563
563
|
const reg = new abaplint.Registry();
|
|
564
564
|
const folders = new Map();
|
|
565
565
|
const objects = new Map();
|
|
566
566
|
const sources = new Map();
|
|
567
567
|
// Libraries first: addFile() then replaces a dependency object with the project's object.
|
|
568
568
|
for (const lib of libraries) {
|
|
569
|
+
const skipped = new Set();
|
|
569
570
|
for (const file of lib.files) {
|
|
570
571
|
const memory = new abaplint.MemoryFile(file.filename, file.contents);
|
|
571
572
|
const type = memory.getObjectType()?.toUpperCase();
|
|
@@ -576,6 +577,14 @@ function libraryRegistry(files, libraries) {
|
|
|
576
577
|
const owner = objects.get(key);
|
|
577
578
|
// abapGit repeats package.devc.xml across repositories; the registry keeps the last copy.
|
|
578
579
|
if (key !== "DEVC:PACKAGE" && owner !== undefined && owner !== lib.name) {
|
|
580
|
+
if (skipDuplicateDependencies === true) {
|
|
581
|
+
if (!skipped.has(key)) {
|
|
582
|
+
console.warn("Skipping duplicate dependency object " + key + " in " + lib.name + "; using " + owner);
|
|
583
|
+
skipped.add(key);
|
|
584
|
+
}
|
|
585
|
+
// Skip every file of the losing object, including locals, metadata, and binary assets.
|
|
586
|
+
continue;
|
|
587
|
+
}
|
|
579
588
|
throw new Error("Ambiguous dependency object " + key + " in " + owner + " and " + lib.name);
|
|
580
589
|
}
|
|
581
590
|
objects.set(key, lib.name);
|
package/build/types.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export interface ITranspilerConfig {
|
|
|
33
33
|
*/
|
|
34
34
|
exclude_filter?: string[];
|
|
35
35
|
}[];
|
|
36
|
+
/** skip duplicate dependency objects after the first library in libs, with a warning; defaults to false */
|
|
37
|
+
skip_duplicate_dependencies?: boolean;
|
|
36
38
|
write_unit_tests?: boolean;
|
|
37
39
|
write_source_map?: boolean;
|
|
38
40
|
options: ITranspilerOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/transpiler-cli",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.1",
|
|
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.120.71",
|
|
31
|
-
"@abaplint/transpiler": "^2.14.
|
|
31
|
+
"@abaplint/transpiler": "^2.14.1",
|
|
32
32
|
"@types/glob": "^9.0.0",
|
|
33
33
|
"@types/node": "^26.6.2",
|
|
34
34
|
"@types/progress": "^2.0.7",
|
package/schema.json
CHANGED
|
@@ -5,6 +5,35 @@
|
|
|
5
5
|
"ITranspilerConfig": {
|
|
6
6
|
"additionalProperties": false,
|
|
7
7
|
"properties": {
|
|
8
|
+
"converter": {
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"description": "experimental",
|
|
11
|
+
"properties": {
|
|
12
|
+
"input_folder": {
|
|
13
|
+
"anyOf": [
|
|
14
|
+
{
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"items": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"type": "array"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"uniqueItems": true
|
|
25
|
+
},
|
|
26
|
+
"output_folder": {
|
|
27
|
+
"minLength": 1,
|
|
28
|
+
"type": "string"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": [
|
|
32
|
+
"input_folder",
|
|
33
|
+
"output_folder"
|
|
34
|
+
],
|
|
35
|
+
"type": "object"
|
|
36
|
+
},
|
|
8
37
|
"exclude_filter": {
|
|
9
38
|
"description": "list of regex, case insensitive",
|
|
10
39
|
"items": {
|
|
@@ -13,6 +42,10 @@
|
|
|
13
42
|
"type": "array",
|
|
14
43
|
"uniqueItems": true
|
|
15
44
|
},
|
|
45
|
+
"incremental_output": {
|
|
46
|
+
"description": "Skip unchanged generated files and remove tracked obsolete output",
|
|
47
|
+
"type": "boolean"
|
|
48
|
+
},
|
|
16
49
|
"input_filter": {
|
|
17
50
|
"description": "list of regex, case insensitive, empty gives all files, positive list",
|
|
18
51
|
"items": {
|
|
@@ -32,7 +65,8 @@
|
|
|
32
65
|
},
|
|
33
66
|
"type": "array"
|
|
34
67
|
}
|
|
35
|
-
]
|
|
68
|
+
],
|
|
69
|
+
"uniqueItems": true
|
|
36
70
|
},
|
|
37
71
|
"libs": {
|
|
38
72
|
"items": {
|
|
@@ -60,6 +94,12 @@
|
|
|
60
94
|
]
|
|
61
95
|
},
|
|
62
96
|
"folder": {
|
|
97
|
+
"description": "relative to the current working directory",
|
|
98
|
+
"type": "string"
|
|
99
|
+
},
|
|
100
|
+
"name": {
|
|
101
|
+
"description": "output directory name; defaults to the repository or local folder name",
|
|
102
|
+
"minLength": 1,
|
|
63
103
|
"type": "string"
|
|
64
104
|
},
|
|
65
105
|
"url": {
|
|
@@ -74,8 +114,13 @@
|
|
|
74
114
|
"$ref": "#/definitions/ITranspilerOptions"
|
|
75
115
|
},
|
|
76
116
|
"output_folder": {
|
|
117
|
+
"minLength": 1,
|
|
77
118
|
"type": "string"
|
|
78
119
|
},
|
|
120
|
+
"skip_duplicate_dependencies": {
|
|
121
|
+
"description": "skip duplicate dependency objects after the first library in libs, with a warning; defaults to false",
|
|
122
|
+
"type": "boolean"
|
|
123
|
+
},
|
|
79
124
|
"write_source_map": {
|
|
80
125
|
"type": "boolean"
|
|
81
126
|
},
|