This commit is contained in:
183
node_modules/@dcloudio/uni-h5-vite/lib/api.json
generated
vendored
Normal file
183
node_modules/@dcloudio/uni-h5-vite/lib/api.json
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
[
|
||||
"$emit",
|
||||
"$off",
|
||||
"$on",
|
||||
"$once",
|
||||
"__f__",
|
||||
"addInterceptor",
|
||||
"addPhoneContact",
|
||||
"arrayBufferToBase64",
|
||||
"base64ToArrayBuffer",
|
||||
"canIUse",
|
||||
"canvasGetImageData",
|
||||
"canvasPutImageData",
|
||||
"canvasToTempFilePath",
|
||||
"chooseFile",
|
||||
"chooseImage",
|
||||
"chooseLocation",
|
||||
"chooseVideo",
|
||||
"clearStorage",
|
||||
"clearStorageSync",
|
||||
"closePreviewImage",
|
||||
"closeSocket",
|
||||
"connectSocket",
|
||||
"createAnimation",
|
||||
"createCameraContext",
|
||||
"createCanvasContext",
|
||||
"createInnerAudioContext",
|
||||
"createIntersectionObserver",
|
||||
"createLivePlayerContext",
|
||||
"createMapContext",
|
||||
"createMediaQueryObserver",
|
||||
"createSelectorQuery",
|
||||
"createVideoContext",
|
||||
"downloadFile",
|
||||
"getAppBaseInfo",
|
||||
"getClipboardData",
|
||||
"getDeviceInfo",
|
||||
"getElementById",
|
||||
"getEnterOptionsSync",
|
||||
"getFacialRecognitionMetaInfo",
|
||||
"getFileInfo",
|
||||
"getImageInfo",
|
||||
"getLaunchOptionsSync",
|
||||
"getLeftWindowStyle",
|
||||
"getLocale",
|
||||
"getLocation",
|
||||
"getNetworkType",
|
||||
"getProvider",
|
||||
"getPushClientId",
|
||||
"getRealPath",
|
||||
"getRecorderManager",
|
||||
"getRightWindowStyle",
|
||||
"getSavedFileInfo",
|
||||
"getSavedFileList",
|
||||
"getScreenBrightness",
|
||||
"getSelectedTextRange",
|
||||
"getStorage",
|
||||
"getStorageInfo",
|
||||
"getStorageInfoSync",
|
||||
"getStorageSync",
|
||||
"getSystemInfo",
|
||||
"getSystemInfoSync",
|
||||
"getTabBarPageId",
|
||||
"getTopWindowStyle",
|
||||
"getVideoInfo",
|
||||
"getWindowInfo",
|
||||
"hideActionSheet",
|
||||
"hideKeyboard",
|
||||
"hideLeftWindow",
|
||||
"hideLoading",
|
||||
"hideModal",
|
||||
"hideNavigationBarLoading",
|
||||
"hideRightWindow",
|
||||
"hideTabBar",
|
||||
"hideTabBarRedDot",
|
||||
"hideToast",
|
||||
"hideTopWindow",
|
||||
"interceptors",
|
||||
"invokePushCallback",
|
||||
"loadFontFace",
|
||||
"login",
|
||||
"makePhoneCall",
|
||||
"navigateBack",
|
||||
"navigateTo",
|
||||
"offAccelerometerChange",
|
||||
"offAppHide",
|
||||
"offAppShow",
|
||||
"offCompassChange",
|
||||
"offError",
|
||||
"offLocationChange",
|
||||
"offLocationChangeError",
|
||||
"offNetworkStatusChange",
|
||||
"offPageNotFound",
|
||||
"offPushMessage",
|
||||
"offThemeChange",
|
||||
"offUnhandledRejection",
|
||||
"offWindowResize",
|
||||
"onAccelerometerChange",
|
||||
"onAppHide",
|
||||
"onAppShow",
|
||||
"onCompassChange",
|
||||
"onCreateVueApp",
|
||||
"onError",
|
||||
"onGyroscopeChange",
|
||||
"onLocaleChange",
|
||||
"onLocationChange",
|
||||
"onLocationChangeError",
|
||||
"onMemoryWarning",
|
||||
"onNetworkStatusChange",
|
||||
"onPageNotFound",
|
||||
"onPushMessage",
|
||||
"onSocketClose",
|
||||
"onSocketError",
|
||||
"onSocketMessage",
|
||||
"onSocketOpen",
|
||||
"onTabBarMidButtonTap",
|
||||
"onThemeChange",
|
||||
"onUnhandledRejection",
|
||||
"onUserCaptureScreen",
|
||||
"onWindowResize",
|
||||
"openDocument",
|
||||
"openLocation",
|
||||
"pageScrollTo",
|
||||
"preloadPage",
|
||||
"previewImage",
|
||||
"reLaunch",
|
||||
"redirectTo",
|
||||
"removeAllPages",
|
||||
"removeInterceptor",
|
||||
"removeLastPage",
|
||||
"removeNonTabBarPages",
|
||||
"removeSavedFile",
|
||||
"removeStorage",
|
||||
"removeStorageSync",
|
||||
"removeTabBarBadge",
|
||||
"request",
|
||||
"rpx2px",
|
||||
"saveFile",
|
||||
"saveImageToPhotosAlbum",
|
||||
"saveVideoToPhotosAlbum",
|
||||
"scanCode",
|
||||
"sendSocketMessage",
|
||||
"setClipboardData",
|
||||
"setKeepScreenOn",
|
||||
"setLeftWindowStyle",
|
||||
"setLocale",
|
||||
"setNavigationBarColor",
|
||||
"setNavigationBarTitle",
|
||||
"setPageMeta",
|
||||
"setRightWindowStyle",
|
||||
"setScreenBrightness",
|
||||
"setStorage",
|
||||
"setStorageSync",
|
||||
"setTabBarBadge",
|
||||
"setTabBarItem",
|
||||
"setTabBarStyle",
|
||||
"setTopWindowStyle",
|
||||
"showActionSheet",
|
||||
"showLeftWindow",
|
||||
"showLoading",
|
||||
"showModal",
|
||||
"showNavigationBarLoading",
|
||||
"showRightWindow",
|
||||
"showTabBar",
|
||||
"showTabBarRedDot",
|
||||
"showToast",
|
||||
"showTopWindow",
|
||||
"startAccelerometer",
|
||||
"startCompass",
|
||||
"startGyroscope",
|
||||
"startLocationUpdate",
|
||||
"startPullDownRefresh",
|
||||
"stopAccelerometer",
|
||||
"stopCompass",
|
||||
"stopGyroscope",
|
||||
"stopLocationUpdate",
|
||||
"stopPullDownRefresh",
|
||||
"switchTab",
|
||||
"uploadFile",
|
||||
"upx2px",
|
||||
"vibrateLong",
|
||||
"vibrateShort"
|
||||
]
|
||||
189
node_modules/@dcloudio/uni-h5-vite/lib/api.x.json
generated
vendored
Normal file
189
node_modules/@dcloudio/uni-h5-vite/lib/api.x.json
generated
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
[
|
||||
"$emit",
|
||||
"$off",
|
||||
"$on",
|
||||
"$once",
|
||||
"__f__",
|
||||
"addInterceptor",
|
||||
"addPhoneContact",
|
||||
"arrayBufferToBase64",
|
||||
"base64ToArrayBuffer",
|
||||
"canIUse",
|
||||
"canvasGetImageData",
|
||||
"canvasPutImageData",
|
||||
"canvasToTempFilePath",
|
||||
"chooseFile",
|
||||
"chooseImage",
|
||||
"chooseLocation",
|
||||
"chooseVideo",
|
||||
"clearStorage",
|
||||
"clearStorageSync",
|
||||
"closeDialogPage",
|
||||
"closePreviewImage",
|
||||
"closeSocket",
|
||||
"connectSocket",
|
||||
"createAnimation",
|
||||
"createCameraContext",
|
||||
"createCanvasContext",
|
||||
"createCanvasContextAsync",
|
||||
"createInnerAudioContext",
|
||||
"createIntersectionObserver",
|
||||
"createLivePlayerContext",
|
||||
"createMapContext",
|
||||
"createMediaQueryObserver",
|
||||
"createSelectorQuery",
|
||||
"createVideoContext",
|
||||
"createWorker",
|
||||
"downloadFile",
|
||||
"getAppBaseInfo",
|
||||
"getClipboardData",
|
||||
"getDeviceInfo",
|
||||
"getElementById",
|
||||
"getEnterOptionsSync",
|
||||
"getFacialRecognitionMetaInfo",
|
||||
"getFileInfo",
|
||||
"getImageInfo",
|
||||
"getLaunchOptionsSync",
|
||||
"getLeftWindowStyle",
|
||||
"getLocale",
|
||||
"getLocation",
|
||||
"getNetworkType",
|
||||
"getProvider",
|
||||
"getPushClientId",
|
||||
"getRealPath",
|
||||
"getRecorderManager",
|
||||
"getRightWindowStyle",
|
||||
"getSavedFileInfo",
|
||||
"getSavedFileList",
|
||||
"getScreenBrightness",
|
||||
"getSelectedTextRange",
|
||||
"getStorage",
|
||||
"getStorageInfo",
|
||||
"getStorageInfoSync",
|
||||
"getStorageSync",
|
||||
"getSystemInfo",
|
||||
"getSystemInfoSync",
|
||||
"getTabBarPageId",
|
||||
"getTopWindowStyle",
|
||||
"getVideoInfo",
|
||||
"getWindowInfo",
|
||||
"hideActionSheet",
|
||||
"hideKeyboard",
|
||||
"hideLeftWindow",
|
||||
"hideLoading",
|
||||
"hideModal",
|
||||
"hideNavigationBarLoading",
|
||||
"hideRightWindow",
|
||||
"hideTabBar",
|
||||
"hideTabBarRedDot",
|
||||
"hideToast",
|
||||
"hideTopWindow",
|
||||
"interceptors",
|
||||
"invokePushCallback",
|
||||
"loadFontFace",
|
||||
"login",
|
||||
"makePhoneCall",
|
||||
"navigateBack",
|
||||
"navigateTo",
|
||||
"offAccelerometerChange",
|
||||
"offAppHide",
|
||||
"offAppShow",
|
||||
"offCompassChange",
|
||||
"offError",
|
||||
"offHostThemeChange",
|
||||
"offLocationChange",
|
||||
"offLocationChangeError",
|
||||
"offNetworkStatusChange",
|
||||
"offPageNotFound",
|
||||
"offPushMessage",
|
||||
"offThemeChange",
|
||||
"offUnhandledRejection",
|
||||
"offWindowResize",
|
||||
"onAccelerometerChange",
|
||||
"onAppHide",
|
||||
"onAppShow",
|
||||
"onCompassChange",
|
||||
"onCreateVueApp",
|
||||
"onError",
|
||||
"onGyroscopeChange",
|
||||
"onHostThemeChange",
|
||||
"onLocaleChange",
|
||||
"onLocationChange",
|
||||
"onLocationChangeError",
|
||||
"onMemoryWarning",
|
||||
"onNetworkStatusChange",
|
||||
"onPageNotFound",
|
||||
"onPushMessage",
|
||||
"onSocketClose",
|
||||
"onSocketError",
|
||||
"onSocketMessage",
|
||||
"onSocketOpen",
|
||||
"onTabBarMidButtonTap",
|
||||
"onThemeChange",
|
||||
"onUnhandledRejection",
|
||||
"onUserCaptureScreen",
|
||||
"onWindowResize",
|
||||
"openDialogPage",
|
||||
"openDocument",
|
||||
"openLocation",
|
||||
"pageScrollTo",
|
||||
"preloadPage",
|
||||
"previewImage",
|
||||
"reLaunch",
|
||||
"redirectTo",
|
||||
"removeAllPages",
|
||||
"removeInterceptor",
|
||||
"removeLastPage",
|
||||
"removeNonTabBarPages",
|
||||
"removeSavedFile",
|
||||
"removeStorage",
|
||||
"removeStorageSync",
|
||||
"removeTabBarBadge",
|
||||
"request",
|
||||
"rpx2px",
|
||||
"saveFile",
|
||||
"saveImageToPhotosAlbum",
|
||||
"saveVideoToPhotosAlbum",
|
||||
"scanCode",
|
||||
"sendSocketMessage",
|
||||
"setClipboardData",
|
||||
"setKeepScreenOn",
|
||||
"setLeftWindowStyle",
|
||||
"setLocale",
|
||||
"setNavigationBarColor",
|
||||
"setNavigationBarTitle",
|
||||
"setPageMeta",
|
||||
"setRightWindowStyle",
|
||||
"setScreenBrightness",
|
||||
"setStorage",
|
||||
"setStorageSync",
|
||||
"setTabBarBadge",
|
||||
"setTabBarItem",
|
||||
"setTabBarStyle",
|
||||
"setTopWindowStyle",
|
||||
"showActionSheet",
|
||||
"showLeftWindow",
|
||||
"showLoading",
|
||||
"showModal",
|
||||
"showNavigationBarLoading",
|
||||
"showRightWindow",
|
||||
"showTabBar",
|
||||
"showTabBarRedDot",
|
||||
"showToast",
|
||||
"showTopWindow",
|
||||
"startAccelerometer",
|
||||
"startCompass",
|
||||
"startGyroscope",
|
||||
"startLocationUpdate",
|
||||
"startPullDownRefresh",
|
||||
"stopAccelerometer",
|
||||
"stopCompass",
|
||||
"stopGyroscope",
|
||||
"stopLocationUpdate",
|
||||
"stopPullDownRefresh",
|
||||
"switchTab",
|
||||
"uploadFile",
|
||||
"upx2px",
|
||||
"vibrateLong",
|
||||
"vibrateShort"
|
||||
]
|
||||
25
node_modules/@dcloudio/uni-h5-vite/lib/ssr/cloudfunction.js
generated
vendored
Normal file
25
node_modules/@dcloudio/uni-h5-vite/lib/ssr/cloudfunction.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict'
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const template = fs.readFileSync(
|
||||
path.join(__dirname, './server/index.html'),
|
||||
'utf-8'
|
||||
)
|
||||
const manifest = require('./server/ssr-manifest.json')
|
||||
const render = require('./server/entry-server.js').render
|
||||
|
||||
exports.main = async (event) => {
|
||||
const [appHtml, preloadLinks, appContext] = await render(event.path, manifest)
|
||||
const html = template
|
||||
.replace(`<!--preload-links-->`, preloadLinks)
|
||||
.replace(`<!--app-html-->`, appHtml)
|
||||
.replace(`<!--app-context-->`, appContext)
|
||||
return {
|
||||
mpserverlessComposedResponse: true, // 使用阿里云返回集成响应是需要此字段为true
|
||||
statusCode: 200,
|
||||
headers: {
|
||||
'content-type': 'text/html',
|
||||
},
|
||||
body: html,
|
||||
}
|
||||
}
|
||||
27
node_modules/@dcloudio/uni-h5-vite/lib/ssr/define.js
generated
vendored
Normal file
27
node_modules/@dcloudio/uni-h5-vite/lib/ssr/define.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
!(function () {
|
||||
const defines = __DEFINES__
|
||||
Object.keys(defines).forEach((key) => {
|
||||
const segments = key.split('.')
|
||||
let target = global
|
||||
for (let i = 0; i < segments.length; i++) {
|
||||
const segment = segments[i]
|
||||
if (i === segments.length - 1) {
|
||||
target[segment] = defines[key]
|
||||
} else {
|
||||
target = target[segment] || (target[segment] = {})
|
||||
}
|
||||
}
|
||||
});
|
||||
const { createRpx2Unit } = require('@dcloudio/uni-shared')
|
||||
const rpx2unit = createRpx2Unit(__UNIT__, __UNIT_RATIO__, __UNIT_PRECISION__)
|
||||
const shared = require('@vue/shared')
|
||||
const oldStringifyStyle = shared.stringifyStyle
|
||||
shared.stringifyStyle = (styles) => rpx2unit(oldStringifyStyle(styles))
|
||||
const serverRender = require('@vue/server-renderer')
|
||||
const oldSsrRenderStyle = serverRender.ssrRenderStyle
|
||||
serverRender.ssrRenderStyle = (raw) =>
|
||||
shared.isString(raw)
|
||||
? rpx2unit(oldSsrRenderStyle(raw))
|
||||
: oldSsrRenderStyle(raw)
|
||||
|
||||
})();
|
||||
99
node_modules/@dcloudio/uni-h5-vite/lib/ssr/entry-server.js
generated
vendored
Normal file
99
node_modules/@dcloudio/uni-h5-vite/lib/ssr/entry-server.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
import { createApp } from './main'
|
||||
import { renderToString } from '@vue/server-renderer'
|
||||
import {
|
||||
UNI_SSR,
|
||||
UNI_SSR_DATA,
|
||||
UNI_SSR_STORE,
|
||||
UNI_SSR_TITLE,
|
||||
UNI_SSR_GLOBAL_DATA,
|
||||
} from '@dcloudio/uni-shared'
|
||||
import { plugin } from '@dcloudio/uni-h5'
|
||||
import { getSsrGlobalData } from '@dcloudio/uni-app'
|
||||
|
||||
export async function render(url, manifest = {}) {
|
||||
const { app, store } = createApp()
|
||||
app.use(plugin)
|
||||
const router = app.router
|
||||
|
||||
// set the router to the desired URL before rendering
|
||||
await router.push(url)
|
||||
await router.isReady()
|
||||
|
||||
// passing SSR context object which will be available via useSSRContext()
|
||||
// @vitejs/plugin-vue injects code into a component's setup() that registers
|
||||
// itself on ctx.modules. After the render, ctx.modules would contain all the
|
||||
// components that have been instantiated during this render call.
|
||||
const ctx = {}
|
||||
const appHtml = await renderToString(app, ctx)
|
||||
|
||||
// the SSR manifest generated by Vite contains module -> chunk/asset mapping
|
||||
// which we can then use to determine what files need to be preloaded for this
|
||||
// request.
|
||||
const preloadLinks = renderPreloadLinks(ctx.modules, manifest)
|
||||
// the SSR context
|
||||
const __uniSSR = ctx[UNI_SSR] || (ctx[UNI_SSR] = {})
|
||||
if (!__uniSSR[UNI_SSR_DATA]) {
|
||||
__uniSSR[UNI_SSR_DATA] = {}
|
||||
}
|
||||
__uniSSR[UNI_SSR_GLOBAL_DATA] = getSsrGlobalData()
|
||||
if (store) {
|
||||
__uniSSR[UNI_SSR_STORE] = store.state
|
||||
}
|
||||
const appContext = renderAppContext(ctx)
|
||||
const title = ctx[UNI_SSR_TITLE] || ''
|
||||
const headMeta = renderHeadMeta(ctx)
|
||||
return {
|
||||
title,
|
||||
headMeta,
|
||||
preloadLinks,
|
||||
appHtml,
|
||||
appContext,
|
||||
}
|
||||
}
|
||||
|
||||
function renderPreloadLinks(modules, manifest) {
|
||||
let links = ''
|
||||
const seen = new Set()
|
||||
modules.forEach((id) => {
|
||||
const files = manifest[id]
|
||||
if (files) {
|
||||
files.forEach((file) => {
|
||||
if (!seen.has(file)) {
|
||||
seen.add(file)
|
||||
links += renderPreloadLink(file)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
return links
|
||||
}
|
||||
|
||||
function renderPreloadLink(file) {
|
||||
if (file.endsWith('.js')) {
|
||||
return '<link rel="modulepreload" crossorigin href="' + file + '">'
|
||||
} else if (file.endsWith('.css')) {
|
||||
return '<link rel="stylesheet" href="' + file + '">'
|
||||
} else {
|
||||
// TODO
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
function renderAppContext(ctx) {
|
||||
return `<script>window.__uniSSR = ${JSON.stringify(ctx[UNI_SSR])}</script>`
|
||||
}
|
||||
|
||||
function renderHeadMeta(ctx) {
|
||||
if (!ctx.__teleportBuffers || !ctx.__teleportBuffers.head) {
|
||||
return ''
|
||||
}
|
||||
return ctx.__teleportBuffers.head
|
||||
.map((buffer) =>
|
||||
buffer
|
||||
.toString()
|
||||
.replace(/\s+data-v-[a-f0-9]{8}/gi, '')
|
||||
.replace('<!--[-->', '')
|
||||
.replace('<!--]--><!---->', '')
|
||||
)
|
||||
.join('\n')
|
||||
}
|
||||
Reference in New Issue
Block a user