@pi-r/babel 0.6.5 → 0.6.7
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/index.js +8 -9
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const path = require("path");
|
|
3
|
-
function transform(context, value, options) {
|
|
3
|
+
module.exports = function transform(context, value, options) {
|
|
4
|
+
var _a, _b;
|
|
4
5
|
context = options.upgrade(context, __dirname);
|
|
5
6
|
const { sourceMap, supplementChunks } = options;
|
|
6
7
|
const baseConfig = options.toBaseConfig();
|
|
@@ -21,15 +22,15 @@ function transform(context, value, options) {
|
|
|
21
22
|
baseConfig.sourceType || (baseConfig.sourceType = options.imported ? 'module' : 'script');
|
|
22
23
|
if (!baseConfig.cwd) {
|
|
23
24
|
const esmData = options.getMainFile(value);
|
|
24
|
-
if (esmData
|
|
25
|
+
if (esmData === null || esmData === void 0 ? void 0 : esmData.code) {
|
|
25
26
|
value = esmData.code;
|
|
26
27
|
}
|
|
27
|
-
baseConfig.cwd = esmData
|
|
28
|
+
baseConfig.cwd = (esmData === null || esmData === void 0 ? void 0 : esmData.sourcesRelativeTo) || options.sourcesRelativeTo;
|
|
28
29
|
}
|
|
29
30
|
for (const chunk of supplementChunks) {
|
|
30
31
|
const chunkConfig = { ...baseConfig };
|
|
31
32
|
if (chunkConfig.sourceMaps) {
|
|
32
|
-
chunkConfig.inputSourceMap = chunk.sourceMap
|
|
33
|
+
chunkConfig.inputSourceMap = (_a = chunk.sourceMap) === null || _a === void 0 ? void 0 : _a.map;
|
|
33
34
|
chunkConfig.sourceFileName = chunk.filename;
|
|
34
35
|
}
|
|
35
36
|
chunkConfig.filename = chunk.filename;
|
|
@@ -42,20 +43,18 @@ function transform(context, value, options) {
|
|
|
42
43
|
(chunk.sourceMap || (chunk.sourceMap = options.createSourceMap(code))).nextMap('babel', code, map);
|
|
43
44
|
}
|
|
44
45
|
else {
|
|
45
|
-
chunk.sourceMap
|
|
46
|
+
(_b = chunk.sourceMap) === null || _b === void 0 ? void 0 : _b.reset();
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
options.out.ignoreCache = baseConfig.sourceType === 'module' || baseConfig.sourceType === 'unambiguous';
|
|
51
52
|
const result = context.transform(value, baseConfig);
|
|
52
|
-
const code = result
|
|
53
|
+
const code = result === null || result === void 0 ? void 0 : result.code;
|
|
53
54
|
if (code) {
|
|
54
55
|
if (result.map) {
|
|
55
56
|
sourceMap.nextMap('babel', code, result.map, url);
|
|
56
57
|
}
|
|
57
58
|
return code;
|
|
58
59
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
module.exports = transform;
|
|
60
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/babel",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"description": "@babel/core transform function for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@babel/core": "^7.24.
|
|
23
|
+
"@babel/core": "^7.24.3"
|
|
24
24
|
}
|
|
25
25
|
}
|