ohos-router 1.1.1 → 1.1.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/package.json +1 -1
  2. package/router.ts +5 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohos-router",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "鸿蒙路由管理插件",
5
5
  "main": "main.js",
6
6
  "scripts": {
package/router.ts CHANGED
@@ -129,7 +129,7 @@ export function pluginStart(node: HvigorNode, isExecute: boolean) {
129
129
 
130
130
  try {
131
131
  let moduleJson5Path = FileUtil.pathResolve(entryModulePath + "/src/main/", "module.json5")
132
- let moduleJson5Data = FileUtil.readJson5(moduleJson5Path)
132
+ let moduleJson5Data = FileUtil.readFileSync(moduleJson5Path)
133
133
  moduleJson5JSONParse(moduleJson5Data)
134
134
  let appPath = FileUtil.pathResolve(entryModulePath + "/src/main/ets/", "App.ets")
135
135
  if (moduleSrcEntry == undefined) {
@@ -216,12 +216,12 @@ export function pluginStart(node: HvigorNode, isExecute: boolean) {
216
216
 
217
217
  let moduleSrcEntry: string
218
218
 
219
- function moduleJson5JSONParse(moduleJsonBean) {
219
+ function moduleJson5JSONParse(moduleJson5Data: string) {
220
220
  try {
221
+ let moduleJsonBean = JSON.parse(moduleJson5Data)
221
222
  let module = moduleJsonBean.module
222
223
  moduleSrcEntry = module.srcEntry
223
224
  } catch (error) {
224
- let moduleJson5Data = JSON.stringify(moduleJsonBean)
225
225
  let errorArray = error.message.split(" ")
226
226
  let position = Number(errorArray[errorArray.length - 1])
227
227
  let endString = moduleJson5Data.substring(0, position)
@@ -308,8 +308,8 @@ var buildProfilePath = ""
308
308
 
309
309
  function writeBuildProfile(childNode: HvigorNode) {
310
310
  let ohPackagePath = FileUtil.pathResolve(childNode.getNodePath(), "oh-package.json5")
311
- let ohPackageData = FileUtil.readJson5(ohPackagePath)
312
- dependenciesJSONParse(JSON.stringify(ohPackageData))
311
+ let ohPackageData = FileUtil.readFileSync(ohPackagePath)
312
+ dependenciesJSONParse(ohPackageData.toString())
313
313
  buildProfilePath = FileUtil.pathResolve(childNode.getNodePath(), "build-profile.json5")
314
314
  let buildProfileData = FileUtil.readFileSync(buildProfilePath)
315
315
  buildProfileJSONParse(buildProfileData.toString())