babel-plugin-transform-modules-ui5 7.2.1 → 7.2.3
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/CHANGELOG.md +22 -0
- package/dist/index.js +1 -0
- package/dist/modules/helpers/wrapper.js +19 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [7.2.3](https://github.com/ui5-community/babel-plugin-transform-modules-ui5/compare/v7.2.2...v7.2.3) (2023-07-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* copyright comment must be appended as leading comment to file ([#108](https://github.com/ui5-community/babel-plugin-transform-modules-ui5/issues/108)) ([8194671](https://github.com/ui5-community/babel-plugin-transform-modules-ui5/commit/81946714f1d48c82a6609ec3fc1c820e5fff9e51))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [7.2.2](https://github.com/ui5-community/babel-plugin-transform-modules-ui5/compare/v7.2.1...v7.2.2) (2023-07-18)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* ensure copyright to be kept after typescript processing ([#107](https://github.com/ui5-community/babel-plugin-transform-modules-ui5/issues/107)) ([da9aa69](https://github.com/ui5-community/babel-plugin-transform-modules-ui5/commit/da9aa69c94017e085d7f5a22abde04b123d9307d))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [7.2.1](https://github.com/ui5-community/babel-plugin-transform-modules-ui5/compare/v7.2.0...v7.2.1) (2023-06-13)
|
|
7
29
|
|
|
8
30
|
|
package/dist/index.js
CHANGED
|
@@ -27,13 +27,27 @@ function wrap(visitor, programNode, opts) {
|
|
|
27
27
|
body
|
|
28
28
|
} = programNode;
|
|
29
29
|
|
|
30
|
-
// find the copyright comment from the original program body
|
|
31
|
-
|
|
30
|
+
// find the copyright comment from the original program body and remove it there
|
|
31
|
+
// since it need to be put around the new program body (which is sap.ui.define)
|
|
32
|
+
let copyright = (_body = body) === null || _body === void 0 ? void 0 : (_body$ = _body[0]) === null || _body$ === void 0 ? void 0 : (_body$$leadingComment = _body$.leadingComments) === null || _body$$leadingComment === void 0 ? void 0 : _body$$leadingComment.find((comment, idx, arr) => {
|
|
32
33
|
if (comment.value.startsWith("!")) {
|
|
33
34
|
arr.splice(idx, 1);
|
|
34
35
|
return true;
|
|
35
36
|
}
|
|
36
37
|
});
|
|
38
|
+
|
|
39
|
+
// in case of TypeScript transpiling taking place upfront, the copyright comment
|
|
40
|
+
// is associcated with the program and not the program body, so we need to find it
|
|
41
|
+
// and move it to the new program body (which is sap.ui.define)
|
|
42
|
+
if (!copyright) {
|
|
43
|
+
var _visitor$parent, _visitor$parent$comme;
|
|
44
|
+
copyright = (_visitor$parent = visitor.parent) === null || _visitor$parent === void 0 ? void 0 : (_visitor$parent$comme = _visitor$parent.comments) === null || _visitor$parent$comme === void 0 ? void 0 : _visitor$parent$comme.find((comment, idx, arr) => {
|
|
45
|
+
if (comment.value.startsWith("!")) {
|
|
46
|
+
arr.splice(idx, 1);
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
37
51
|
let allExportHelperAdded = false;
|
|
38
52
|
let extendAdded = false;
|
|
39
53
|
opts.collapse = !opts.noExportCollapse;
|
|
@@ -119,8 +133,9 @@ function wrap(visitor, programNode, opts) {
|
|
|
119
133
|
programNode.body = [...preDefine, generateDefine(body, imports, exportGlobal || opts.exportAllGlobal)];
|
|
120
134
|
|
|
121
135
|
// if a copyright comment is present we append it to the new program node
|
|
122
|
-
if (copyright) {
|
|
123
|
-
|
|
136
|
+
if (copyright && visitor.parent) {
|
|
137
|
+
visitor.parent.leadingComments = visitor.parent.leadingComments || [];
|
|
138
|
+
visitor.parent.leadingComments.unshift(copyright);
|
|
124
139
|
}
|
|
125
140
|
}
|
|
126
141
|
function hasUseStrict(node) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-transform-modules-ui5",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.3",
|
|
4
4
|
"description": "An unofficial babel plugin for SAP UI5.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"prettier": "^2.8.8",
|
|
95
95
|
"rimraf": "^5.0.1"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "bfdb0979de1cbaeff7c4d373761f261de469d376"
|
|
98
98
|
}
|