@ray-js/builder-mp 1.4.0-alpha.0 → 1.4.0-alpha.10

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
- program.unshiftContainer('body', t.variableDeclaration('const', [
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', t.variableDeclaration('const', [
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(t.variableDeclaration('const', [
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(t.classDeclaration(t.identifier(pageCompName), node.declaration.superClass, node.declaration.body, node.declaration.decorators));
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(t.variableDeclaration('const', [
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', t.exportDefaultDeclaration(t.identifier(exportDefaultDeclarationName)));
280
+ program.pushContainer('body',
281
+ // @ts-ignore
282
+ t.exportDefaultDeclaration(t.identifier(exportDefaultDeclarationName)));
268
283
  }
269
284
  },
270
285
  };
@@ -45,6 +45,7 @@ const getMethods = (input, filename) => {
45
45
  configFile: false,
46
46
  sourceType: 'module',
47
47
  });
48
+ // @ts-ignore
48
49
  (0, traverse_1.default)(ast, {
49
50
  ExportNamedDeclaration(path) {
50
51
  path.traverse(visitor, collect);
package/package.json CHANGED
@@ -1,69 +1,69 @@
1
1
  {
2
2
  "name": "@ray-js/builder-mp",
3
- "version": "1.4.0-alpha.0",
3
+ "version": "1.4.0-alpha.10",
4
4
  "description": "Ray builder for mini program",
5
5
  "keywords": [
6
6
  "ray"
7
7
  ],
8
+ "repository": {},
8
9
  "license": "MIT",
10
+ "maintainers": [
11
+ {
12
+ "name": "tuyafe",
13
+ "email": "tuyafe@tuya.com"
14
+ }
15
+ ],
9
16
  "main": "lib/index.js",
10
17
  "files": [
11
18
  "lib"
12
19
  ],
13
- "publishConfig": {
14
- "access": "public",
15
- "registry": "https://registry.npmjs.org"
16
- },
17
20
  "scripts": {
18
- "clean": "rm -rf lib",
19
21
  "build": "tsc -p ./tsconfig.build.json",
20
- "watch": "tsc -p ./tsconfig.build.json --watch",
21
- "test": "jest"
22
+ "clean": "rm -rf lib",
23
+ "test": "jest",
24
+ "watch": "tsc -p ./tsconfig.build.json --watch"
22
25
  },
23
26
  "dependencies": {
24
27
  "@babel/plugin-proposal-private-methods": "^7.18.6",
25
28
  "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
26
- "@babel/template": "^7.16.0",
27
- "@babel/traverse": "^7.16.3",
28
- "@babel/types": "^7.16.0",
29
- "@ray-core/babel-preset-remax": "^0.3.5",
30
- "@ray-core/build-store": "^0.3.5",
31
- "@ray-core/cli": "^0.3.5",
32
- "@ray-core/ray": "^0.3.5",
33
- "@ray-js/adapter": "^1.4.0-alpha.0",
29
+ "@babel/template": "^7.22.5",
30
+ "@babel/traverse": "^7.22.11",
31
+ "@babel/types": "^7.22.11",
32
+ "@ray-core/babel-preset-remax": "^0.3.6",
33
+ "@ray-core/build-store": "^0.3.6",
34
+ "@ray-core/cli": "^0.3.6",
35
+ "@ray-core/ray": "^0.3.6",
36
+ "@ray-js/adapter": "^1.4.0-alpha.10",
34
37
  "@ray-js/rjs-for-wechat": "^0.0.3",
35
- "@ray-js/shared": "^1.4.0-alpha.0",
36
- "@ray-js/types": "^1.4.0-alpha.0",
37
- "babel-loader": "^8.2.3",
38
- "babel-plugin-minify-dead-code-elimination": "^0.5.1",
38
+ "@ray-js/shared": "^1.4.0-alpha.10",
39
+ "@ray-js/types": "^1.4.0-alpha.10",
40
+ "babel-loader": "^8.3.0",
41
+ "babel-plugin-minify-dead-code-elimination": "^0.5.2",
39
42
  "babel-plugin-transform-prune-unused-imports": "^1.0.1",
40
43
  "change-case": "^4.1.2",
41
44
  "colors": "1.4.0",
42
- "fs-extra": "^10.0.0",
45
+ "fs-extra": "^10.1.0",
43
46
  "hash-replace": "^1.0.5",
44
47
  "postcss-units-transform": "^1.1.0",
45
48
  "pretty-bytes": "^5.6.0",
46
49
  "react": "^17.0.2",
47
50
  "slash": "^3.0.0",
48
- "webpack": "^5.74.0",
51
+ "webpack": "^5.88.2",
49
52
  "webpack-chain": "^6.5.1",
50
- "webpack-virtual-modules": "^0.4.4"
53
+ "webpack-virtual-modules": "^0.4.6"
51
54
  },
52
55
  "devDependencies": {
53
- "@ray-core/types": "^0.3.5",
54
- "@types/jest": "^27.0.2",
55
- "@types/node": "^16.9.1",
56
+ "@ray-core/types": "^0.3.6",
57
+ "@types/jest": "^27.5.2",
58
+ "@types/node": "^20.5.9",
56
59
  "babel-plugin-tester": "^10.1.0",
57
- "jest": "^27.2.2",
58
- "ts-jest": "^27.0.5",
59
- "typescript": "^4.4.3"
60
+ "jest": "^27.5.1",
61
+ "ts-jest": "^27.1.5",
62
+ "typescript": "^4.9.5"
60
63
  },
61
- "maintainers": [
62
- {
63
- "name": "tuyafe",
64
- "email": "tuyafe@tuya.com"
65
- }
66
- ],
67
- "gitHead": "92a9834964bb74c3a3b0553438b0f0c7a77ad8d0",
68
- "repository": {}
64
+ "publishConfig": {
65
+ "access": "public",
66
+ "registry": "https://registry.npmjs.org"
67
+ },
68
+ "gitHead": "14cb935df10f020e714b44bb41d4899646db751c"
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.