This commit is contained in:
2025-11-14 11:39:33 +08:00
parent 6e5d892992
commit 1ba633ba45
7143 changed files with 922330 additions and 0 deletions

3
node_modules/@dcloudio/uni-h5/lib/h5/extends-api.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import 'uni-sub-platform/service/index'
import * as api from 'uni-platform/service/api/index'
export default api

66
node_modules/@dcloudio/uni-h5/lib/h5/main.js generated vendored Normal file
View File

@@ -0,0 +1,66 @@
/**
* 1.导出全局对象(UniViewJSBridge,UniServiceJSBridge,uni,getApp,getCurrentPages)
* 2.引入 Vue 插件(uniVueServicePlugin,uniVueServicePlugin)
* 3.引入 Vue 组件
*/
import Vue from 'vue'
// import 'uni-platform/view/index.css'
import initVue from 'uni-core/vue'
class UniApp {
constructor () {
this._init()
}
_init () {
global.UniViewJSBridge = {
subscribe: UniViewJSBridge.subscribe,
publishHandler: UniViewJSBridge.publishHandler,
subscribeHandler: UniViewJSBridge.subscribeHandler
}
global.UniServiceJSBridge = {
subscribe: UniServiceJSBridge.subscribe,
publishHandler: UniServiceJSBridge.publishHandler,
subscribeHandler: UniServiceJSBridge.subscribeHandler
}
const {
default: uni,
getApp,
getCurrentPages
} = require('uni-platform/service/index')
// 与微信JS-SDK同名的方法
// const sameNameApis = ['setClipboardData', 'getClipboardData', 'onUserCaptureScreen', 'openBluetoothAdapter', 'startBluetoothDevicesDiscovery', 'onBluetoothDeviceFound', 'stopBluetoothDevicesDiscovery', 'onBluetoothAdapterStateChange', 'getConnectedBluetoothDevices', 'getBluetoothDevices', 'getBluetoothAdapterState', 'closeBluetoothAdapter', 'writeBLECharacteristicValue', 'readBLECharacteristicValue', 'onBLEConnectionStateChange', 'onBLECharacteristicValueChange', 'notifyBLECharacteristicValueChange', 'getBLEDeviceServices', 'getBLEDeviceCharacteristics', 'createBLEConnection', 'closeBLEConnection', 'onBeaconServiceChange', 'onBeaconUpdate', 'getBeacons', 'startBeaconDiscovery', 'stopBeaconDiscovery', 'chooseImage', 'previewImage', 'getNetworkType', 'onNetworkStatusChange', 'openLocation', 'getLocation']
// 默认会被iOS企业微信替换的方法
const sameNameApis = ['chooseImage']
sameNameApis.forEach(item => {
Object.defineProperty(uni, item, {
writable: false,
configurable: false
})
})
global.uni = uni
global.wx = global.uni
global.getApp = getApp
global.getCurrentPages = getCurrentPages
Vue.use(require('uni-service/plugins').default, {
routes: __uniRoutes
})
Vue.use(require('uni-view/plugins').default, {
routes: __uniRoutes
})
initVue(Vue)
require('uni-platform/components')
require('uni-components')
}
}
global.UniApp = UniApp
global.__uniConfig && new UniApp()

27
node_modules/@dcloudio/uni-h5/lib/h5/ui-api.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import {
canIUse
} from 'uni-core/service/api/base/can-i-use'
import {
upx2px
} from 'uni-core/service/api/base/upx2px'
import {
getLocation
} from 'uni-platform/service/api/location/get-location'
import {
onCompassChange,
stopCompass
} from 'uni-platform/service/api/device/compass'
import {
getSystemInfoSync
} from 'uni-platform/service/api/device/get-system-info'
// TODO route
export default {
canIUse,
upx2px,
getLocation,
onCompassChange,
stopCompass,
getSystemInfoSync
}

54
node_modules/@dcloudio/uni-h5/lib/h5/ui.js generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import Vue from 'vue'
// 使用白名单过滤(前期有一批自定义组件使用了 uni-
import tags from 'uni-helpers/tags'
import 'uni-core/view/index.css'
import uni from './ui-api.js'
import {
processEvent
} from 'uni-core/view/plugins/events'
const oldIsReservedTag = Vue.config.isReservedTag
global.uni = uni
Vue.config.isReservedTag = function (tag) {
return tags.indexOf(tag) !== -1 || oldIsReservedTag(tag)
}
Vue.config.ignoredElements = tags
const oldGetTagNamespace = Vue.config.getTagNamespace
const conflictTags = ['switch', 'image', 'text', 'view']
Vue.config.getTagNamespace = function (tag) {
if (~conflictTags.indexOf(tag)) { // svg 部分标签名称与 uni 标签冲突
return false
}
return oldGetTagNamespace(tag) || false
}
const findUniTarget = function ($event, $el) {
let target = $event.target
for (; target && target !== $el; target = target.parentNode) {
if (target.tagName && target.tagName.indexOf('UNI-') === 0) {
break
}
}
return target
}
Vue.prototype.$handleEvent = function ($event) {
if ($event instanceof Event) { // 未处理的 event 对象 需要对 target 校正及包装
// 查找 uniTarget
const target = findUniTarget($event, this.$el)
$event = processEvent.call(this, $event.type, $event, {}, target || $event.target, $event.currentTarget)
}
return $event
}
require('uni-components')

View File

@@ -0,0 +1 @@
"use strict";var e=require("debug"),t=require("postcss-selector-parser"),o=require("fs");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=a(e),n=a(t),s=a(o);const i=r.default("automator:devtool");function c(e){e.walk((e=>{if("tag"===e.type){const t=e.value;e.value="page"===t?"uni-page-body":"uni-"+t}}))}const l=["Page.getElement","Page.getElements","Element.getElement","Element.getElements"];function p(e){try{return require(e)}catch(t){return require(require.resolve(e,{paths:[process.cwd()]}))}}/^win/.test(process.platform);const u=["chromium","firefox","webkit"];let w=!1;try{w=!!p("playwright")}catch(e){}const d=new Map;function f(e="chromium"){const t=e&&u.includes(e)?e:u[0];let o=d.get(t);return o||(o=function(e){if("webkit"===e)return h("webkit");if("firefox"===e)return h("firefox");if(w)return h("chromium");throw new Error("Playwright dependency not found, please install playwright!")}(t),d.set(t,o)),o}function h(e){const t=p("playwright");let o,a;return{type:e,provider:"playwright",async open(r,n,s){o=await t[e].launch(n.options),"firefox"===e&&(n.contextOptions.isMobile=!1),i(`browser.newContext ${JSON.stringify(n.contextOptions)}`);const c=await o.newContext(n.contextOptions);a=await c.newPage(),a.on("console",(e=>{s.emit("App.logAdded",{type:e.type(),args:[e.text()]})})),a.on("pageerror",(e=>{s.emit("App.exceptionThrown",e)})),await a.goto(n.url||r),await a.waitForTimeout(1e3)},close:()=>o.close(),screenshot(e=!1){let t={fullPage:e};return"true"===process.env.UNI_AUTOMATOR_WEB_SCREENSHOT_NO_NAVIGATION_BAR&&(t={fullPage:e,clip:{x:0,y:44,width:Number.MAX_VALUE,height:Number.MAX_VALUE}}),a.screenshot(t).then((e=>e.toString("base64")))},swipe:e=>new Promise((async t=>{const{startPoint:o,endPoint:r}=e;await a.evaluate((([e,t])=>{window.scrollBy({left:e.x-t.x,top:e.y-t.y,behavior:"smooth"})}),[o,r]),t("swipe success")})),tap:e=>new Promise((async t=>{const{x:o,y:r,duration:n}=e;await a.mouse.move(o,r),await a.mouse.down(),await a.waitForTimeout(n||0),await a.mouse.up(),t("tap success")})),keyboardInput:e=>new Promise((async t=>{await a.keyboard.type(e.text),t("keyboardInput success")}))}}let y;const m={"Tool.close":{reflect:async()=>{await y.close()}},"App.start":{reflect:async()=>{}},"App.exit":{reflect:async()=>{}},"App.enableLog":{reflect:()=>Promise.resolve()},"App.captureScreenshot":{reflect:async(e,t)=>{const o=await y.screenshot(!!t.fullPage);return i(`App.captureScreenshot ${o.length}`),{data:o}}},"App.swipe":{reflect:async(e,t)=>{const o=await y.swipe(t);return i(`App.swipe ${o.length}`),{data:o}}},"App.tap":{reflect:async(e,t)=>{const o=await y.tap(t);return i(`App.tap ${o.length}`),{data:o}}},"App.keyboardInput":{reflect:async(e,t)=>{const o=await y.keyboardInput(t);return i(`App.keyboardInput ${o.length}`),{data:o}}}};!function(e){l.forEach((t=>{e[t]=function(e){return{reflect:async(t,o)=>t(e,o,!1),params:e=>(e.selector&&(e.selector=n.default(c).processSync(e.selector)),e)}}(t)}))}(m);const g={devtools:{name:"browser",paths:[],validate:async function(e){var t;return e.options=e.options||{},e.executablePath&&!e.options.executablePath&&(e.options.executablePath=e.executablePath),e.contextOptions={viewport:Object.assign({width:375,height:667},e.options.defaultViewport||{}),hasTouch:!0,isMobile:!0,deviceScaleFactor:(null===(t=e.options.defaultViewport)||void 0===t?void 0:t.deviceScaleFactor)||2},e.options.defaultViewport=Object.assign({width:375,height:667,deviceScaleFactor:2,hasTouch:!0,isMobile:!0},e.options.defaultViewport||{}),e.teardown||(e.teardown=!1===e.options.headless?"disconnect":"close"),e},create:async function(e,t,o){t.executablePath?await new Promise(((o,a)=>{const{exec:r}=require("node:child_process");if(/^win/.test(process.platform)){const a="C:\\Users\\Public\\AppData\\Local\\chrome";s.default.existsSync(a)||s.default.mkdirSync(a,{recursive:!0}),r(`start ${t.executablePath} --user-data-dir=${a} ${e}`,(e=>{if(e)throw console.error(`open ${t.executablePath} fail, ${e}`),Error(e)})),setTimeout((()=>{o(null)}),1e3)}else r(`open -a "${t.executablePath}" ${e}`,(e=>{e&&(console.error(`open ${t.executablePath} fail, ${e}`),a(e)),o(null)}))})):(y=f(process.env.BROWSER),i("createDevtools "+(y.provider+" "+y.type+" "+JSON.stringify(t))),await y.open(e,t,o))}},shouldCompile:(e,t)=>!t.url,adapter:m};module.exports=g;

65
node_modules/@dcloudio/uni-h5/lib/h5/uni.config.js generated vendored Normal file
View File

@@ -0,0 +1,65 @@
const fs = require('fs')
const path = require('path')
function getTemplatePath (template) {
if (template) {
const userTemplate = path.resolve(process.env.UNI_INPUT_DIR, template)
if (fs.existsSync(userTemplate)) { return userTemplate }
}
return path.resolve(process.env.UNI_CLI_CONTEXT, 'public/index.html')
}
function transform (content, platformOptions) {
if (platformOptions.darkmode === true) {
// darkmode
try {
content += fs.readFileSync(require.resolve('@dcloudio/uni-h5/dist/index.dark.css'))
} catch (error) { }
}
if (process.env.NODE_ENV === 'production') {
return content + // shadow
'body::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)}}'
}
return content
}
function getIndexCssPath (assetsDir, template, hashKey) {
const CopyWebpackPluginVersion = Number(require('copy-webpack-plugin/package.json').version.split('.')[0])
const VUE_APP_INDEX_CSS_HASH = process.env[hashKey]
if (VUE_APP_INDEX_CSS_HASH) {
try {
const templateContent = fs.readFileSync(getTemplatePath(template))
if (new RegExp('\\b' + hashKey + '\\b').test(templateContent)) {
return path.join(assetsDir, `[name].${VUE_APP_INDEX_CSS_HASH}${CopyWebpackPluginVersion > 7 ? '' : '.'}[ext]`)
}
} catch (e) { }
}
return assetsDir
}
module.exports = {
options: {
cssVars: {
'--status-bar-height': '0px'
},
filterTag: 'wxs',
vue: '@dcloudio/vue-cli-plugin-uni/packages/h5-vue'
},
copyWebpackOptions (platformOptions, vueOptions) {
const copyOptions = [
{
from: require.resolve('@dcloudio/uni-h5/dist/index.css'),
to: getIndexCssPath(vueOptions.assetsDir, platformOptions.template, 'VUE_APP_INDEX_CSS_HASH'),
transform (content) {
return transform(content, platformOptions)
}
},
'hybrid/html'
]
global.uniModules.forEach(module => {
copyOptions.push('uni_modules/' + module + '/hybrid/html')
})
return copyOptions
}
}