@ray-js/builder-mp 1.4.0-alpha.3 → 1.4.0-alpha.5
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.5",
|
4
4
|
"description": "Ray builder for mini program",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -23,40 +23,40 @@
|
|
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.
|
29
|
-
"@ray-core/babel-preset-remax": "^0.3.
|
30
|
-
"@ray-core/build-store": "^0.3.
|
31
|
-
"@ray-core/cli": "^0.3.
|
32
|
-
"@ray-core/ray": "^0.3.
|
33
|
-
"@ray-js/adapter": "^1.4.0-alpha.
|
26
|
+
"@babel/template": "^7.22.5",
|
27
|
+
"@babel/traverse": "^7.22.10",
|
28
|
+
"@babel/types": "^7.22.10",
|
29
|
+
"@ray-core/babel-preset-remax": "^0.3.6",
|
30
|
+
"@ray-core/build-store": "^0.3.6",
|
31
|
+
"@ray-core/cli": "^0.3.6",
|
32
|
+
"@ray-core/ray": "^0.3.6",
|
33
|
+
"@ray-js/adapter": "^1.4.0-alpha.5",
|
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.
|
37
|
-
"babel-loader": "^8.
|
38
|
-
"babel-plugin-minify-dead-code-elimination": "^0.5.
|
35
|
+
"@ray-js/shared": "^1.4.0-alpha.5",
|
36
|
+
"@ray-js/types": "^1.4.0-alpha.5",
|
37
|
+
"babel-loader": "^8.3.0",
|
38
|
+
"babel-plugin-minify-dead-code-elimination": "^0.5.2",
|
39
39
|
"babel-plugin-transform-prune-unused-imports": "^1.0.1",
|
40
40
|
"change-case": "^4.1.2",
|
41
41
|
"colors": "1.4.0",
|
42
|
-
"fs-extra": "^10.
|
42
|
+
"fs-extra": "^10.1.0",
|
43
43
|
"hash-replace": "^1.0.5",
|
44
44
|
"postcss-units-transform": "^1.1.0",
|
45
45
|
"pretty-bytes": "^5.6.0",
|
46
46
|
"react": "^17.0.2",
|
47
47
|
"slash": "^3.0.0",
|
48
|
-
"webpack": "^5.
|
48
|
+
"webpack": "^5.88.2",
|
49
49
|
"webpack-chain": "^6.5.1",
|
50
|
-
"webpack-virtual-modules": "^0.4.
|
50
|
+
"webpack-virtual-modules": "^0.4.6"
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
53
|
-
"@ray-core/types": "^0.3.
|
54
|
-
"@types/jest": "^27.
|
55
|
-
"@types/node": "^
|
53
|
+
"@ray-core/types": "^0.3.6",
|
54
|
+
"@types/jest": "^27.5.2",
|
55
|
+
"@types/node": "^20.5.0",
|
56
56
|
"babel-plugin-tester": "^10.1.0",
|
57
|
-
"jest": "^27.
|
58
|
-
"ts-jest": "^27.
|
59
|
-
"typescript": "^4.
|
57
|
+
"jest": "^27.5.1",
|
58
|
+
"ts-jest": "^27.1.5",
|
59
|
+
"typescript": "^4.9.5"
|
60
60
|
},
|
61
61
|
"maintainers": [
|
62
62
|
{
|
@@ -64,6 +64,6 @@
|
|
64
64
|
"email": "tuyafe@tuya.com"
|
65
65
|
}
|
66
66
|
],
|
67
|
-
"gitHead": "
|
67
|
+
"gitHead": "14cb935df10f020e714b44bb41d4899646db751c",
|
68
68
|
"repository": {}
|
69
69
|
}
|
package/LICENSE.md
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
Copyright © 2014-2022 Tuya.inc
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
-
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
-
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|