New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@microprogram/plugin-router

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microprogram/plugin-router - npm Package Compare versions

Comparing version
1.0.0-beta.16
to
1.0.0-beta.29
+37
-1
index.js

@@ -12,3 +12,35 @@ 'use strict'

function plugin(jsonPath, platform) {
function rewritePrivateConfig(pages) {
const privateJsonPath = path.resolve(cwd, 'project.private.config.json')
if (fs.existsSync(privateJsonPath)) {
const privateJson = readJsonFile(privateJsonPath)
// filter non-existent paths
const pureList = privateJson.condition.miniprogram.list.filter((item) => pages.indexOf(item.pathName) !== -1)
function hasSamePath(page) {
return pureList.find(item => item.pathName === page)
}
pages.forEach((page) => {
if (!hasSamePath(page)) {
pureList.push({
"name": page.replace('pages/', '').replace('/index', ''),
"pathName": page,
"query": "",
"scene": null
})
}
})
privateJson.condition.miniprogram.list = pureList
fs.writeFileSync(privateJsonPath, JSON.stringify(privateJson, null, 2))
}
}
function plugin(jsonPath, config) {
const { platform, plugins } = config
const { autoGenPrivateConfig } = plugins.router
return through.obj(function (chunk, _, cb) {

@@ -61,2 +93,3 @@ if (chunk.isNull()) {

// rewrite app.json
var json = readJsonFile(appJsonPath) || {}

@@ -76,2 +109,5 @@ json.pages = pages

fs.writeFileSync(appJsonPath, JSON.stringify(json, null, 2))
// rewrite project.private.config.json
autoGenPrivateConfig && rewritePrivateConfig(pages)
}

@@ -78,0 +114,0 @@

+2
-2
{
"name": "@microprogram/plugin-router",
"version": "1.0.0-beta.16",
"version": "1.0.0-beta.29",
"author": "JserWang",

@@ -31,3 +31,3 @@ "files": [

},
"gitHead": "1904f773b00b2bea54b43f9bbe088e2ae2a8705e"
"gitHead": "2001822e2bf606b8f67431afa62b8f2d00e4e225"
}