@ray-js/build-plugin-router 1.3.1 → 1.3.2

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.
Files changed (2) hide show
  1. package/lib/index.js +12 -6
  2. package/package.json +4 -4
package/lib/index.js CHANGED
@@ -245,13 +245,19 @@ function PluginRouter(api) {
245
245
  const subPkgs = (_d = subPackages !== null && subPackages !== void 0 ? subPackages : subpackages) !== null && _d !== void 0 ? _d : [];
246
246
  const pages = lodash_1.default.uniq(_routes.map((r) => r.path.replace(/^\//, '')));
247
247
  const tabBar = normalizeTabBarConfig(_tabBar, _routes, standardAppConfigFieldMap);
248
- let workers = otherConfig.workers;
249
- if (workers && typeof workers !== 'string') {
250
- workers = workers.root;
251
- }
248
+ const { workers = [], root: workerRoot } = otherConfig.workers || {};
252
249
  const config = Object.assign(Object.assign(Object.assign({}, g), otherConfig), { pages, tabBar });
253
- if (workers) {
254
- config.workers = workers;
250
+ if (workerRoot) {
251
+ config.workers =
252
+ target !== 'thing'
253
+ ? workerRoot
254
+ : workers.map((w) => {
255
+ const ext = path_1.default.extname(w);
256
+ if (ext) {
257
+ w = w.replace(new RegExp(`${ext}$`), '');
258
+ }
259
+ return `${workerRoot}/${w}.js`;
260
+ });
255
261
  }
256
262
  if (subPkgs && subPkgs.length) {
257
263
  config.subpackages = subPkgs.map((pkg) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/build-plugin-router",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Ray build plugin for router",
5
5
  "keywords": [
6
6
  "ray"
@@ -21,7 +21,7 @@
21
21
  "watch": "tsc -p ./tsconfig.build.json --watch"
22
22
  },
23
23
  "dependencies": {
24
- "@ray-js/shared": "^1.3.1",
24
+ "@ray-js/shared": "^1.3.2",
25
25
  "chokidar": "^3.5.2",
26
26
  "colors": "1.4.0",
27
27
  "ejs": "^3.1.6",
@@ -30,7 +30,7 @@
30
30
  "url": "^0.11.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@ray-js/types": "^1.3.1"
33
+ "@ray-js/types": "^1.3.2"
34
34
  },
35
35
  "maintainers": [
36
36
  {
@@ -38,6 +38,6 @@
38
38
  "email": "tuyafe@tuya.com"
39
39
  }
40
40
  ],
41
- "gitHead": "4844c0f03bb434999b2e93196dba1cd53b9b6c56",
41
+ "gitHead": "a6af0026d8770839d9c1209a9e933b23ed77bf4a",
42
42
  "repository": {}
43
43
  }