@ray-js/build-plugin-router 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/lib/index.js +7 -3
  2. package/package.json +7 -6
package/lib/index.js CHANGED
@@ -8,8 +8,12 @@ const colors_1 = __importDefault(require("colors"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const lodash_1 = __importDefault(require("lodash"));
10
10
  const fs_extra_1 = __importDefault(require("fs-extra"));
11
- const plugin_utils_1 = require("@ray-js/plugin-utils");
11
+ const ejs_1 = __importDefault(require("ejs"));
12
12
  const shared_1 = require("@ray-js/shared");
13
+ function ejsRender(file, data, options) {
14
+ const str = fs_extra_1.default.readFileSync(file).toString();
15
+ return ejs_1.default.render(str, data, Object.assign(Object.assign({}, options), { async: false }));
16
+ }
13
17
  colors_1.default.enable();
14
18
  const LOG_PREFIX = `build-plugin-router`;
15
19
  function normalizeRoute(route) {
@@ -154,7 +158,7 @@ function PluginRouter(api) {
154
158
  },
155
159
  generateAppConfig(data) {
156
160
  const templateFile = path_1.default.join(__dirname, '../templates/app.config.ejs');
157
- const context = (0, plugin_utils_1.ejsRender)(templateFile, { appConfig: data });
161
+ const context = ejsRender(templateFile, { appConfig: data });
158
162
  api.writeFile('src/app.config.ts', context);
159
163
  shared_1.log.verbose(LOG_PREFIX, `generate`, 'src/app.config.ts'.underline.green, `for wechat platform`);
160
164
  },
@@ -172,7 +176,7 @@ function PluginRouter(api) {
172
176
  chunkName,
173
177
  };
174
178
  });
175
- const context = (0, plugin_utils_1.ejsRender)(templateFile, { pages });
179
+ const context = ejsRender(templateFile, { pages });
176
180
  api.writeFile('.ray/router.config.ts', context);
177
181
  shared_1.log.verbose(LOG_PREFIX, `generate`, '.ray/router.config.ts'.green.underline, `for web platform`);
178
182
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/build-plugin-router",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Ray build plugin for router",
5
5
  "keywords": [
6
6
  "ray"
@@ -21,13 +21,14 @@
21
21
  "watch": "tsc -p ./tsconfig.build.json --watch"
22
22
  },
23
23
  "dependencies": {
24
- "@ray-js/plugin-utils": "^0.6.1",
25
- "@ray-js/shared": "^0.6.1",
24
+ "@ray-js/shared": "^0.6.2",
26
25
  "chokidar": "^3.5.2",
27
- "colors": "1.4.0"
26
+ "colors": "1.4.0",
27
+ "ejs": "^3.1.6",
28
+ "fs-extra": "^10.0.0"
28
29
  },
29
30
  "devDependencies": {
30
- "@ray-js/types": "^0.6.1"
31
+ "@ray-js/types": "^0.6.2"
31
32
  },
32
33
  "maintainers": [
33
34
  {
@@ -35,6 +36,6 @@
35
36
  "email": "tuyafe@tuya.com"
36
37
  }
37
38
  ],
38
- "gitHead": "da5b561dda68a1554a1d6972872558d37ca81fed",
39
+ "gitHead": "4d850d119d7add9d33320dcb7e6028cea936531a",
39
40
  "repository": {}
40
41
  }