first commit

This commit is contained in:
2026-09-08 20:28:54 +08:00
commit 2ada8d3d5a
37380 changed files with 4886169 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
const path = require('path')
const isWin = /^win/.test(process.platform)
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
const removePlatformStyle = function (style) {
const PLATFORMS = global.uniPlugin.platforms || []
Object.keys(style).forEach(name => {
if (PLATFORMS.includes(name)) {
delete style[name]
}
})
return style
}
function parseWindow (style = {}) {
const windowJson = Object.create(null)
Object.assign(windowJson, style, style['mp-360'] || {})
return removePlatformStyle(windowJson)
}
function parsePage (page) {
return {
route: page.path,
window: parseWindow(page.style)
}
}
module.exports = function parseAppJson (pagesJson, manifestJson) {
const pages = []
pagesJson.pages.forEach(page => {
pages.push(parsePage(page))
})
const subPackages = pagesJson.subPackages
if (Array.isArray(subPackages)) {
subPackages.forEach(subPackage => {
const root = subPackage.root
subPackage.pages.forEach(page => {
pages.push(parsePage({
path: normalizePath(path.join(root, page.path)),
style: page.style
}))
})
})
}
return Object.assign({
sdkversion: '1.0.0'
}, manifestJson['mp-360'] || {}, {
pages,
window: parseWindow(pagesJson.globalStyle)
})
}
+56
View File
@@ -0,0 +1,56 @@
const path = require('path')
const parseAppJson = require('./parser/app-json-parser')
const css = '#seapp-custom-action-sheet{bottom: var(--window-bottom) !important;}'
module.exports = {
configureEnv () {
process.env.UNI_OUTPUT_DIR = path.join(process.env.UNI_OUTPUT_DIR, 'dist')
},
configureH5 (h5Options) {
h5Options.router.mode = 'hash'
h5Options.router.base = h5Options.publicPath = '/'
},
configurePages (pagesJson, manifestJson, loader) {
loader.emitFile('app.json', JSON.stringify(parseAppJson(pagesJson, manifestJson), null, 2))
},
copyWebpackOptions (platformOptions, vueOptions, copyOptions) {
if (copyOptions) {
const copyOption = copyOptions.find(copyOption => copyOption.from.indexOf('index.css') !== -1)
if (copyOption) {
copyOption.to = 'app.css'
copyOption.transform = function (content) {
return content + css
}
}
}
},
configureWebpack (config) {
return {
output: {
filename: (chunkData) => {
return chunkData.chunk.name === 'index' ? 'app.js' : 'static/js/[name].js'
}
},
resolve: {
alias: {
'uni-h5': path.resolve(__dirname, '../dist/index.umd.min.js')
}
},
optimization: {
splitChunks: {
cacheGroups: {
vendors: false,
common: false
}
}
}
}
},
chainWebpack (config) {
config.plugins.delete('html-index')
config.plugins.delete('preload')
config.plugins.delete('prefetch')
}
}