@ray-js/builder-mp 1.4.0-alpha.2 → 1.4.0-alpha.4
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.
@@ -30,6 +30,7 @@ const t = __importStar(require("@babel/types"));
|
|
30
30
|
function insertImport(program, imports, moduleName) {
|
31
31
|
const specifiers = imports.map((i) => t.importSpecifier(t.identifier(i), t.identifier(i)));
|
32
32
|
const importDeclaration = t.importDeclaration(specifiers, t.stringLiteral(moduleName));
|
33
|
+
// @ts-ignore
|
33
34
|
program.unshiftContainer('body', importDeclaration);
|
34
35
|
}
|
35
36
|
/**
|
@@ -44,7 +45,9 @@ function RayHooks() {
|
|
44
45
|
const { node } = path;
|
45
46
|
const name = node.local.name;
|
46
47
|
if (['usePageEvent', 'useAppEvent'].includes(name) &&
|
48
|
+
// @ts-ignore
|
47
49
|
t.isImportDeclaration(path.parentPath)) {
|
50
|
+
// @ts-ignore
|
48
51
|
const { node } = path.parentPath;
|
49
52
|
if (node.source.value === 'ray') {
|
50
53
|
if (node.specifiers.length > 1) {
|
@@ -37,6 +37,7 @@ const builder_1 = require("../../../builder");
|
|
37
37
|
function insertSpecifierImport(program, imports, moduleName) {
|
38
38
|
const specifiers = imports.map((i) => t.importSpecifier(t.identifier(i), t.identifier(i)));
|
39
39
|
const importDeclaration = t.importDeclaration(specifiers, t.stringLiteral(moduleName));
|
40
|
+
// @ts-ignore
|
40
41
|
program.unshiftContainer('body', importDeclaration);
|
41
42
|
}
|
42
43
|
const contextTemplate = (0, template_1.default)(`const id = forwardRef((props, ref) => {
|
@@ -96,7 +97,10 @@ function insertPageConfig(program, filename) {
|
|
96
97
|
program.unshiftContainer('body', ast);
|
97
98
|
}
|
98
99
|
else {
|
99
|
-
|
100
|
+
// @ts-ignore
|
101
|
+
program.unshiftContainer('body',
|
102
|
+
// @ts-ignore
|
103
|
+
t.variableDeclaration('const', [
|
100
104
|
t.variableDeclarator(t.identifier('__pageConfigData'), t.objectExpression([])),
|
101
105
|
]));
|
102
106
|
}
|
@@ -117,7 +121,9 @@ function insertAppConfig(program, filename) {
|
|
117
121
|
program.unshiftContainer('body', ast);
|
118
122
|
}
|
119
123
|
else {
|
120
|
-
program.unshiftContainer('body',
|
124
|
+
program.unshiftContainer('body',
|
125
|
+
// @ts-ignore
|
126
|
+
t.variableDeclaration('const', [
|
121
127
|
t.variableDeclarator(t.identifier('__appConfigData'), t.objectExpression([])),
|
122
128
|
]));
|
123
129
|
}
|
@@ -192,24 +198,31 @@ function ContextAndHoc() {
|
|
192
198
|
pageCompName = path.scope.generateUid((0, change_case_1.pascalCase)(n));
|
193
199
|
}
|
194
200
|
const pageFn = t.functionExpression(t.identifier(pageCompName), node.declaration.params, node.declaration.body);
|
195
|
-
path.replaceWith(
|
201
|
+
path.replaceWith(
|
202
|
+
// @ts-ignore
|
203
|
+
t.variableDeclaration('const', [
|
196
204
|
t.variableDeclarator(t.identifier(pageCompName), pageFn),
|
197
205
|
]));
|
198
206
|
}
|
199
207
|
else if (t.isClassDeclaration(node.declaration)) {
|
200
208
|
if (node.declaration.id) {
|
201
209
|
pageCompName = node.declaration.id.name;
|
210
|
+
// @ts-ignore
|
202
211
|
path.replaceWith(node.declaration);
|
203
212
|
}
|
204
213
|
else {
|
205
214
|
const [_, n] = importer.split(P.sep).reverse();
|
206
215
|
pageCompName = path.scope.generateUid((0, change_case_1.pascalCase)(n));
|
207
|
-
path.replaceWith(
|
216
|
+
path.replaceWith(
|
217
|
+
// @ts-ignore
|
218
|
+
t.classDeclaration(t.identifier(pageCompName), node.declaration.superClass, node.declaration.body, node.declaration.decorators));
|
208
219
|
}
|
209
220
|
}
|
210
221
|
else {
|
211
222
|
pageCompName = path.scope.generateUid(pageCompName);
|
212
|
-
path.replaceWith(
|
223
|
+
path.replaceWith(
|
224
|
+
// @ts-ignore
|
225
|
+
t.variableDeclaration('const', [
|
213
226
|
// @ts-ignore
|
214
227
|
t.variableDeclarator(t.identifier(pageCompName), node.declaration),
|
215
228
|
]));
|
@@ -264,7 +277,9 @@ function ContextAndHoc() {
|
|
264
277
|
});
|
265
278
|
}
|
266
279
|
}
|
267
|
-
program.pushContainer('body',
|
280
|
+
program.pushContainer('body',
|
281
|
+
// @ts-ignore
|
282
|
+
t.exportDefaultDeclaration(t.identifier(exportDefaultDeclarationName)));
|
268
283
|
}
|
269
284
|
},
|
270
285
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/builder-mp",
|
3
|
-
"version": "1.4.0-alpha.
|
3
|
+
"version": "1.4.0-alpha.4",
|
4
4
|
"description": "Ray builder for mini program",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -23,17 +23,17 @@
|
|
23
23
|
"dependencies": {
|
24
24
|
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
25
25
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
26
|
-
"@babel/template": "^7.
|
27
|
-
"@babel/traverse": "^7.
|
28
|
-
"@babel/types": "^7.
|
26
|
+
"@babel/template": "^7.22.5",
|
27
|
+
"@babel/traverse": "^7.22.10",
|
28
|
+
"@babel/types": "^7.22.10",
|
29
29
|
"@ray-core/babel-preset-remax": "^0.3.5",
|
30
30
|
"@ray-core/build-store": "^0.3.5",
|
31
31
|
"@ray-core/cli": "^0.3.5",
|
32
32
|
"@ray-core/ray": "^0.3.5",
|
33
|
-
"@ray-js/adapter": "^1.4.0-alpha.
|
33
|
+
"@ray-js/adapter": "^1.4.0-alpha.4",
|
34
34
|
"@ray-js/rjs-for-wechat": "^0.0.3",
|
35
|
-
"@ray-js/shared": "^1.4.0-alpha.
|
36
|
-
"@ray-js/types": "^1.4.0-alpha.
|
35
|
+
"@ray-js/shared": "^1.4.0-alpha.4",
|
36
|
+
"@ray-js/types": "^1.4.0-alpha.4",
|
37
37
|
"babel-loader": "^8.2.3",
|
38
38
|
"babel-plugin-minify-dead-code-elimination": "^0.5.1",
|
39
39
|
"babel-plugin-transform-prune-unused-imports": "^1.0.1",
|
@@ -51,8 +51,8 @@
|
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
53
53
|
"@ray-core/types": "^0.3.5",
|
54
|
-
"@types/jest": "^27.
|
55
|
-
"@types/node": "^
|
54
|
+
"@types/jest": "^27.5.2",
|
55
|
+
"@types/node": "^20.5.0",
|
56
56
|
"babel-plugin-tester": "^10.1.0",
|
57
57
|
"jest": "^27.2.2",
|
58
58
|
"ts-jest": "^27.0.5",
|
@@ -64,6 +64,6 @@
|
|
64
64
|
"email": "tuyafe@tuya.com"
|
65
65
|
}
|
66
66
|
],
|
67
|
-
"gitHead": "
|
67
|
+
"gitHead": "ae3621a47944287771e18e926c76ea92d0516097",
|
68
68
|
"repository": {}
|
69
69
|
}
|