@dcloudio/uni-cli-shared
Advanced tools
Comparing version 0.2.983 to 0.2.984
@@ -89,2 +89,6 @@ const fs = require('fs') | ||
function isValidPage (page, root = '') { | ||
if (typeof page === 'string') { // 不合法的配置 | ||
console.warn(`${page} 配置错误, 已被忽略, 查看文档: https://uniapp.dcloud.io/collocation/pages?id=pages`) | ||
return false | ||
} | ||
let pagePath = page.path | ||
@@ -91,0 +95,0 @@ |
@@ -21,2 +21,22 @@ const fs = require('fs') | ||
function getShadowCss () { | ||
let tagName = 'page' | ||
if (process.env.UNI_PLATFORM === 'h5') { | ||
tagName = 'body' | ||
} | ||
return `${tagName}::after{position:fixed;content:'';left:-1000px;top:-1000px;-webkit-animation:shadow-preload .1s;-webkit-animation-delay:3s;animation:shadow-preload .1s;animation-delay:3s}@-webkit-keyframes shadow-preload{0%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}100%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}}@keyframes shadow-preload{0%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}100%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}}` | ||
} | ||
function getNormalCopy (files) { | ||
return files.map(file => { | ||
const from = path.resolve(process.env.UNI_INPUT_DIR, file) | ||
if (fs.existsSync(from)) { | ||
return { | ||
from, | ||
to: path.resolve(process.env.UNI_OUTPUT_DIR, file) | ||
} | ||
} | ||
}).filter(item => item) | ||
} | ||
const PLATFORMS = { | ||
@@ -32,2 +52,14 @@ 'h5': { | ||
'--status-bar-height': '0px' | ||
}, | ||
copyWebpackOptions (assetsDir) { | ||
return [{ | ||
from: require.resolve('@dcloudio/uni-h5/dist/index.css'), | ||
to: assetsDir, | ||
transform (content) { | ||
if (process.env.NODE_ENV === 'production') { | ||
return content + getShadowCss() | ||
} | ||
return content | ||
} | ||
}, ...getNormalCopy(['hybrid/html'])] | ||
} | ||
@@ -48,2 +80,9 @@ }, | ||
'--window-bottom': '0px' | ||
}, | ||
copyWebpackOptions (assetsDir) { | ||
const options = [...getNormalCopy(['hybrid/html'])] | ||
if (!process.env.UNI_USING_NATIVE) { | ||
options.push(...getNormalCopy(['wxcomponents'])) | ||
} | ||
return options | ||
} | ||
@@ -66,3 +105,6 @@ }, | ||
}, | ||
project: 'project.config.json' | ||
project: 'project.config.json', | ||
copyWebpackOptions (assetsDir) { | ||
return getNormalCopy(['wxcomponents']) | ||
} | ||
}, | ||
@@ -84,3 +126,15 @@ 'mp-weixin': { | ||
}, | ||
project: 'project.config.json' | ||
project: 'project.config.json', | ||
copyWebpackOptions (assetsDir, manifestPlatformOptions) { | ||
const files = [ | ||
'sitemap.json', | ||
'ext.json', | ||
'custom-tab-bar', | ||
'wxcomponents' | ||
] | ||
if (manifestPlatformOptions.workers) { | ||
files.push(manifestPlatformOptions.workers) | ||
} | ||
return getNormalCopy(files) | ||
} | ||
}, | ||
@@ -102,3 +156,6 @@ 'mp-baidu': { | ||
}, | ||
project: 'project.swan.json' | ||
project: 'project.swan.json', | ||
copyWebpackOptions (assetsDir) { | ||
return getNormalCopy(['swancomponents']) | ||
} | ||
}, | ||
@@ -119,2 +176,5 @@ 'mp-alipay': { | ||
'--window-bottom': '0px' | ||
}, | ||
copyWebpackOptions (assetsDir) { | ||
return getNormalCopy(['mycomponents']) | ||
} | ||
@@ -137,3 +197,6 @@ }, | ||
}, | ||
project: 'project.tt.json' | ||
project: 'project.tt.json', | ||
copyWebpackOptions (assetsDir) { | ||
return getNormalCopy(['ttcomponents']) | ||
} | ||
} | ||
@@ -311,2 +374,5 @@ } | ||
}, | ||
getPlatformCopy () { | ||
return platform.copyWebpackOptions | ||
}, | ||
getPlatformGlobal () { | ||
@@ -350,9 +416,3 @@ return platform.global | ||
}, | ||
getShadowCss () { | ||
let tagName = 'page' | ||
if (process.env.UNI_PLATFORM === 'h5') { | ||
tagName = 'body' | ||
} | ||
return `${tagName}::after{position:fixed;content:'';left:-1000px;top:-1000px;-webkit-animation:shadow-preload .1s;-webkit-animation-delay:3s;animation:shadow-preload .1s;animation-delay:3s}@-webkit-keyframes shadow-preload{0%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}100%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}}@keyframes shadow-preload{0%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}100%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}}` | ||
}, | ||
getShadowCss, | ||
getShadowTemplate (colorType = 'grey') { | ||
@@ -359,0 +419,0 @@ let tagName = 'cover-image' |
{ | ||
"name": "@dcloudio/uni-cli-shared", | ||
"version": "0.2.983", | ||
"version": "0.2.984", | ||
"description": "uni-cli-shared", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
50518
1311
49