@ray-js/builder-component 0.6.23 → 0.6.26
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.
@@ -14,9 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
exports.legacyTarget = void 0;
|
16
16
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
17
|
-
const path_1 = __importDefault(require("path"));
|
18
17
|
const core_1 = require("@babel/core");
|
19
|
-
const env_loader_1 = require("@ray-js/env-loader");
|
20
18
|
/**
|
21
19
|
* 因匿名化需要将 tuya => thing
|
22
20
|
* 但历史项目仍需要支持
|
@@ -27,11 +25,9 @@ function babelTransform(file, options) {
|
|
27
25
|
return __awaiter(this, void 0, void 0, function* () {
|
28
26
|
options = Object.assign({ modules: 'auto' }, options);
|
29
27
|
let babelPlugin = [];
|
30
|
-
|
31
|
-
const
|
32
|
-
|
33
|
-
if (options.target) {
|
34
|
-
const { target } = options;
|
28
|
+
const code = fs_extra_1.default.readFileSync(file).toString();
|
29
|
+
const { target, modules } = options;
|
30
|
+
if (target) {
|
35
31
|
babelPlugin = [
|
36
32
|
[
|
37
33
|
require.resolve('../babel/import-replacement'),
|
@@ -61,13 +57,6 @@ function babelTransform(file, options) {
|
|
61
57
|
'@ray-core/wechat',
|
62
58
|
],
|
63
59
|
];
|
64
|
-
const { code: removeEnvCode, map } = yield (0, env_loader_1.traverseImport)({ platform: options.target }, source, {
|
65
|
-
sourceMaps: true,
|
66
|
-
sourceMapTarget: path_1.default.basename(file),
|
67
|
-
sourceFileName: file,
|
68
|
-
});
|
69
|
-
code = removeEnvCode;
|
70
|
-
codeMap = map;
|
71
60
|
}
|
72
61
|
return yield (0, core_1.transformAsync)(code, {
|
73
62
|
babelrc: false,
|
@@ -77,17 +66,16 @@ function babelTransform(file, options) {
|
|
77
66
|
[
|
78
67
|
require.resolve('@ray-js/babel-preset-standard'),
|
79
68
|
{
|
80
|
-
modules
|
69
|
+
modules,
|
81
70
|
jsx: 'react',
|
82
|
-
platform:
|
71
|
+
platform: target,
|
83
72
|
macro: false,
|
84
73
|
// native 不需要 polyfill
|
85
|
-
useBuiltIns: ['native', 'ios', 'android'].includes(
|
74
|
+
useBuiltIns: ['native', 'ios', 'android'].includes(target) ? false : undefined,
|
86
75
|
},
|
87
76
|
],
|
88
77
|
],
|
89
78
|
plugins: babelPlugin,
|
90
|
-
inputSourceMap: codeMap,
|
91
79
|
filename: file,
|
92
80
|
});
|
93
81
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/builder-component",
|
3
|
-
"version": "0.6.
|
3
|
+
"version": "0.6.26",
|
4
4
|
"description": "Ray builder for component",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -24,10 +24,9 @@
|
|
24
24
|
"@babel/helper-plugin-utils": "^7.14.5",
|
25
25
|
"@babel/traverse": "^7.16.3",
|
26
26
|
"@babel/types": "^7.16.0",
|
27
|
-
"@ray-js/babel-preset-standard": "^0.6.
|
28
|
-
"@ray-js/
|
29
|
-
"@ray-js/
|
30
|
-
"@ray-js/types": "^0.6.23",
|
27
|
+
"@ray-js/babel-preset-standard": "^0.6.26",
|
28
|
+
"@ray-js/shared": "^0.6.26",
|
29
|
+
"@ray-js/types": "^0.6.26",
|
31
30
|
"babel-plugin-import": "^1.13.3",
|
32
31
|
"chokidar": "^3.5.2",
|
33
32
|
"colors": "1.4.0",
|
@@ -44,6 +43,6 @@
|
|
44
43
|
"email": "tuyafe@tuya.com"
|
45
44
|
}
|
46
45
|
],
|
47
|
-
"gitHead": "
|
46
|
+
"gitHead": "219e20327347ffc4fe9444d7b9f864341774432d",
|
48
47
|
"repository": {}
|
49
48
|
}
|