@weapp-vite/web 1.3.28 → 1.3.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.mjs +0 -8
- package/dist/compiler/wxml/attributes.mjs +0 -8
- package/dist/compiler/wxml/attributes.mjs.map +1 -1
- package/dist/compiler/wxml/compile.mjs +0 -8
- package/dist/compiler/wxml/compile.mjs.map +1 -1
- package/dist/compiler/wxml/dependency.mjs +0 -8
- package/dist/compiler/wxml/dependency.mjs.map +1 -1
- package/dist/compiler/wxml/interpolation.mjs +0 -8
- package/dist/compiler/wxml/interpolation.mjs.map +1 -1
- package/dist/compiler/wxml/navigation.mjs +0 -8
- package/dist/compiler/wxml/navigation.mjs.map +1 -1
- package/dist/compiler/wxml/parser.mjs +0 -8
- package/dist/compiler/wxml/parser.mjs.map +1 -1
- package/dist/compiler/wxml/renderer.mjs +0 -8
- package/dist/compiler/wxml/renderer.mjs.map +1 -1
- package/dist/compiler/wxml/specialNodes.mjs +0 -8
- package/dist/compiler/wxml/specialNodes.mjs.map +1 -1
- package/dist/compiler/wxs.mjs +0 -8
- package/dist/compiler/wxs.mjs.map +1 -1
- package/dist/css/wxss.d.mts +0 -2
- package/dist/css/wxss.mjs +0 -8
- package/dist/css/wxss.mjs.map +1 -1
- package/dist/index.d.mts +0 -2
- package/dist/index.mjs +0 -8
- package/dist/plugin/constants.mjs +0 -8
- package/dist/plugin/constants.mjs.map +1 -1
- package/dist/plugin/entry.mjs +0 -8
- package/dist/plugin/entry.mjs.map +1 -1
- package/dist/plugin/files.mjs +0 -8
- package/dist/plugin/files.mjs.map +1 -1
- package/dist/plugin/index.d.mts +0 -2
- package/dist/plugin/index.mjs +0 -8
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/plugin/navigation.mjs +0 -8
- package/dist/plugin/navigation.mjs.map +1 -1
- package/dist/plugin/path.mjs +0 -8
- package/dist/plugin/path.mjs.map +1 -1
- package/dist/plugin/register.mjs +0 -8
- package/dist/plugin/register.mjs.map +1 -1
- package/dist/plugin/scan.mjs +0 -8
- package/dist/plugin/scan.mjs.map +1 -1
- package/dist/plugin/scanConfig.mjs +0 -8
- package/dist/plugin/scanConfig.mjs.map +1 -1
- package/dist/plugin/state.mjs +0 -8
- package/dist/plugin/state.mjs.map +1 -1
- package/dist/plugin/types.d.mts +0 -2
- package/dist/plugin.d.mts +0 -2
- package/dist/plugin.mjs +0 -8
- package/dist/runtime/button/helpers.mjs +0 -8
- package/dist/runtime/button/helpers.mjs.map +1 -1
- package/dist/runtime/button/index.d.mts +0 -2
- package/dist/runtime/button/index.mjs +0 -8
- package/dist/runtime/button/index.mjs.map +1 -1
- package/dist/runtime/button/style.mjs +0 -8
- package/dist/runtime/button/style.mjs.map +1 -1
- package/dist/runtime/component/behavior.mjs +0 -8
- package/dist/runtime/component/behavior.mjs.map +1 -1
- package/dist/runtime/component/constants.mjs +0 -8
- package/dist/runtime/component/constants.mjs.map +1 -1
- package/dist/runtime/component/dom.mjs +0 -8
- package/dist/runtime/component/dom.mjs.map +1 -1
- package/dist/runtime/component/element.mjs +0 -8
- package/dist/runtime/component/element.mjs.map +1 -1
- package/dist/runtime/component/events.mjs +0 -8
- package/dist/runtime/component/events.mjs.map +1 -1
- package/dist/runtime/component/index.d.mts +0 -2
- package/dist/runtime/component/index.mjs +0 -8
- package/dist/runtime/component/index.mjs.map +1 -1
- package/dist/runtime/component/state.mjs +0 -8
- package/dist/runtime/component/state.mjs.map +1 -1
- package/dist/runtime/component/types.d.mts +0 -2
- package/dist/runtime/component/utils.mjs +0 -8
- package/dist/runtime/component/utils.mjs.map +1 -1
- package/dist/runtime/execution.d.mts +0 -2
- package/dist/runtime/execution.mjs +0 -8
- package/dist/runtime/execution.mjs.map +1 -1
- package/dist/runtime/index.d.mts +0 -2
- package/dist/runtime/index.mjs +0 -8
- package/dist/runtime/legacyTemplate/dom.mjs +0 -8
- package/dist/runtime/legacyTemplate/dom.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/expression.mjs +0 -8
- package/dist/runtime/legacyTemplate/expression.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/index.d.mts +0 -2
- package/dist/runtime/legacyTemplate/index.mjs +0 -8
- package/dist/runtime/legacyTemplate/index.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/types.d.mts +0 -2
- package/dist/runtime/navigationBar/index.d.mts +0 -2
- package/dist/runtime/navigationBar/index.mjs +0 -8
- package/dist/runtime/navigationBar/index.mjs.map +1 -1
- package/dist/runtime/navigationBar/style.mjs +0 -8
- package/dist/runtime/navigationBar/style.mjs.map +1 -1
- package/dist/runtime/polyfill/ad.mjs +0 -8
- package/dist/runtime/polyfill/ad.mjs.map +1 -1
- package/dist/runtime/polyfill/appState.mjs +0 -8
- package/dist/runtime/polyfill/appState.mjs.map +1 -1
- package/dist/runtime/polyfill/async.mjs +0 -8
- package/dist/runtime/polyfill/async.mjs.map +1 -1
- package/dist/runtime/polyfill/auth.mjs +0 -8
- package/dist/runtime/polyfill/auth.mjs.map +1 -1
- package/dist/runtime/polyfill/authApi.mjs +0 -8
- package/dist/runtime/polyfill/authApi.mjs.map +1 -1
- package/dist/runtime/polyfill/background.mjs +0 -8
- package/dist/runtime/polyfill/background.mjs.map +1 -1
- package/dist/runtime/polyfill/canvasContext.mjs +0 -8
- package/dist/runtime/polyfill/canvasContext.mjs.map +1 -1
- package/dist/runtime/polyfill/capability.mjs +0 -8
- package/dist/runtime/polyfill/capability.mjs.map +1 -1
- package/dist/runtime/polyfill/cloud.mjs +0 -8
- package/dist/runtime/polyfill/cloud.mjs.map +1 -1
- package/dist/runtime/polyfill/device.mjs +0 -8
- package/dist/runtime/polyfill/device.mjs.map +1 -1
- package/dist/runtime/polyfill/deviceApi.mjs +0 -8
- package/dist/runtime/polyfill/deviceApi.mjs.map +1 -1
- package/dist/runtime/polyfill/deviceAuthSystemApi.d.mts +0 -2
- package/dist/runtime/polyfill/deviceAuthSystemApi.mjs +0 -8
- package/dist/runtime/polyfill/deviceAuthSystemApi.mjs.map +1 -1
- package/dist/runtime/polyfill/filePicker.mjs +0 -8
- package/dist/runtime/polyfill/filePicker.mjs.map +1 -1
- package/dist/runtime/polyfill/fileSystemManager.mjs +0 -8
- package/dist/runtime/polyfill/fileSystemManager.mjs.map +1 -1
- package/dist/runtime/polyfill/files.mjs +0 -8
- package/dist/runtime/polyfill/files.mjs.map +1 -1
- package/dist/runtime/polyfill/index.d.mts +0 -2
- package/dist/runtime/polyfill/index.mjs +0 -8
- package/dist/runtime/polyfill/index.mjs.map +1 -1
- package/dist/runtime/polyfill/interaction.mjs +0 -8
- package/dist/runtime/polyfill/interaction.mjs.map +1 -1
- package/dist/runtime/polyfill/interactionApi.mjs +0 -8
- package/dist/runtime/polyfill/interactionApi.mjs.map +1 -1
- package/dist/runtime/polyfill/location.mjs +0 -8
- package/dist/runtime/polyfill/location.mjs.map +1 -1
- package/dist/runtime/polyfill/locationApi.mjs +0 -8
- package/dist/runtime/polyfill/locationApi.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaActions.mjs +0 -8
- package/dist/runtime/polyfill/mediaActions.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/file.mjs +0 -8
- package/dist/runtime/polyfill/mediaApi/file.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/info.mjs +0 -8
- package/dist/runtime/polyfill/mediaApi/info.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/picker.mjs +0 -8
- package/dist/runtime/polyfill/mediaApi/picker.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/preview.mjs +0 -8
- package/dist/runtime/polyfill/mediaApi/preview.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/process.mjs +0 -8
- package/dist/runtime/polyfill/mediaApi/process.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaInfo.mjs +0 -8
- package/dist/runtime/polyfill/mediaInfo.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaPicker.mjs +0 -8
- package/dist/runtime/polyfill/mediaPicker.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaProcess.mjs +0 -8
- package/dist/runtime/polyfill/mediaProcess.mjs.map +1 -1
- package/dist/runtime/polyfill/menuApi.mjs +0 -8
- package/dist/runtime/polyfill/menuApi.mjs.map +1 -1
- package/dist/runtime/polyfill/navigationBarRuntime.mjs +0 -8
- package/dist/runtime/polyfill/navigationBarRuntime.mjs.map +1 -1
- package/dist/runtime/polyfill/network/request.mjs +0 -8
- package/dist/runtime/polyfill/network/request.mjs.map +1 -1
- package/dist/runtime/polyfill/network/requestBridge.mjs +0 -8
- package/dist/runtime/polyfill/network/requestBridge.mjs.map +1 -1
- package/dist/runtime/polyfill/network/status.mjs +0 -8
- package/dist/runtime/polyfill/network/status.mjs.map +1 -1
- package/dist/runtime/polyfill/platformApi.mjs +0 -8
- package/dist/runtime/polyfill/platformApi.mjs.map +1 -1
- package/dist/runtime/polyfill/platformRuntime.mjs +0 -8
- package/dist/runtime/polyfill/platformRuntime.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/dom.mjs +0 -8
- package/dist/runtime/polyfill/routeRuntime/dom.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs +0 -8
- package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/options.d.mts +0 -2
- package/dist/runtime/polyfill/routeRuntime/options.mjs +0 -8
- package/dist/runtime/polyfill/routeRuntime/options.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/url.mjs +0 -8
- package/dist/runtime/polyfill/routeRuntime/url.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime.d.mts +0 -2
- package/dist/runtime/polyfill/routeRuntime.mjs +0 -8
- package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeCapabilityApi.mjs +0 -8
- package/dist/runtime/polyfill/runtimeCapabilityApi.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeDataApi.d.mts +0 -2
- package/dist/runtime/polyfill/runtimeDataApi.mjs +0 -8
- package/dist/runtime/polyfill/runtimeDataApi.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeInfra.mjs +0 -8
- package/dist/runtime/polyfill/runtimeInfra.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeOps.mjs +0 -8
- package/dist/runtime/polyfill/runtimeOps.mjs.map +1 -1
- package/dist/runtime/polyfill/selectorQuery.mjs +0 -8
- package/dist/runtime/polyfill/selectorQuery.mjs.map +1 -1
- package/dist/runtime/polyfill/storage.mjs +0 -8
- package/dist/runtime/polyfill/storage.mjs.map +1 -1
- package/dist/runtime/polyfill/storageAsync.mjs +0 -8
- package/dist/runtime/polyfill/storageAsync.mjs.map +1 -1
- package/dist/runtime/polyfill/subscribe.mjs +0 -8
- package/dist/runtime/polyfill/subscribe.mjs.map +1 -1
- package/dist/runtime/polyfill/system.mjs +0 -8
- package/dist/runtime/polyfill/system.mjs.map +1 -1
- package/dist/runtime/polyfill/systemApi.mjs +0 -8
- package/dist/runtime/polyfill/systemApi.mjs.map +1 -1
- package/dist/runtime/polyfill/types/base.d.mts +0 -2
- package/dist/runtime/polyfill/types/common.d.mts +0 -2
- package/dist/runtime/polyfill/types/locationRuntime.d.mts +0 -2
- package/dist/runtime/polyfill/types/mediaAuth.d.mts +0 -2
- package/dist/runtime/polyfill/types/platformRuntime.d.mts +0 -2
- package/dist/runtime/polyfill/types/systemAuth.d.mts +0 -2
- package/dist/runtime/polyfill/ui.mjs +0 -8
- package/dist/runtime/polyfill/ui.mjs.map +1 -1
- package/dist/runtime/polyfill/uiFeedback.mjs +0 -8
- package/dist/runtime/polyfill/uiFeedback.mjs.map +1 -1
- package/dist/runtime/polyfill/uiMediaApi.d.mts +0 -2
- package/dist/runtime/polyfill/uiMediaApi.mjs +0 -8
- package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -1
- package/dist/runtime/polyfill/videoContext.mjs +0 -8
- package/dist/runtime/polyfill/videoContext.mjs.map +1 -1
- package/dist/runtime/polyfill/vkSession.mjs +0 -8
- package/dist/runtime/polyfill/vkSession.mjs.map +1 -1
- package/dist/runtime/polyfill/windowResize.mjs +0 -8
- package/dist/runtime/polyfill/windowResize.mjs.map +1 -1
- package/dist/runtime/polyfill/worker.mjs +0 -8
- package/dist/runtime/polyfill/worker.mjs.map +1 -1
- package/dist/runtime/polyfill.d.mts +0 -2
- package/dist/runtime/renderContext.d.mts +0 -2
- package/dist/runtime/renderContext.mjs +0 -8
- package/dist/runtime/renderContext.mjs.map +1 -1
- package/dist/runtime/rpx.d.mts +0 -2
- package/dist/runtime/rpx.mjs +0 -8
- package/dist/runtime/rpx.mjs.map +1 -1
- package/dist/runtime/style.d.mts +0 -2
- package/dist/runtime/style.mjs +0 -8
- package/dist/runtime/style.mjs.map +1 -1
- package/dist/runtime/template.d.mts +0 -2
- package/dist/runtime/utils/object.mjs +0 -8
- package/dist/runtime/utils/object.mjs.map +1 -1
- package/dist/runtime/warning.d.mts +0 -2
- package/dist/runtime/warning.mjs +0 -8
- package/dist/runtime/warning.mjs.map +1 -1
- package/dist/shared/slugify.mjs +0 -8
- package/dist/shared/slugify.mjs.map +1 -1
- package/dist/shared/wxml.mjs +0 -8
- package/dist/shared/wxml.mjs.map +1 -1
- package/package.json +3 -2
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
import { callMiniProgramAsyncSuccess, normalizeDuration } from "./async.mjs";
|
|
10
2
|
import { getLoadingElement, getToastElement, hideToastElement, resolveToastPrefix, setLoadingVisible, setToastVisible } from "./ui.mjs";
|
|
11
3
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uiFeedback.mjs","names":[],"sources":["../../../src/runtime/polyfill/uiFeedback.ts"],"sourcesContent":["import {\n callMiniProgramAsyncSuccess,\n normalizeDuration,\n} from './async'\nimport {\n getLoadingElement,\n getToastElement,\n hideToastElement,\n resolveToastPrefix,\n setLoadingVisible,\n setToastVisible,\n} from './ui'\n\nlet toastHideTimer: ReturnType<typeof setTimeout> | undefined\n\nexport function showToastBridge(options?: any): Promise<any> {\n const toast = getToastElement()\n const content = `${resolveToastPrefix(options?.icon)}${options?.title ?? ''}`.trim()\n if (toast) {\n toast.textContent = content\n setToastVisible(toast, true)\n if (toastHideTimer) {\n clearTimeout(toastHideTimer)\n }\n const duration = normalizeDuration(options?.duration, 1500)\n toastHideTimer = setTimeout(() => {\n hideToastElement()\n toastHideTimer = undefined\n }, duration)\n }\n const result = callMiniProgramAsyncSuccess(options, { errMsg: 'showToast:ok' })\n return Promise.resolve(result)\n}\n\nexport function showLoadingBridge(options?: any): Promise<any> {\n const loading = getLoadingElement()\n if (loading) {\n setLoadingVisible(\n loading,\n true,\n options?.title?.trim() || '加载中',\n Boolean(options?.mask),\n )\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'showLoading:ok' }))\n}\n\nexport function hideLoadingBridge(options?: any): Promise<any> {\n const loading = getLoadingElement()\n if (loading) {\n setLoadingVisible(loading, false, loading.textContent ?? '', false)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'hideLoading:ok' }))\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"uiFeedback.mjs","names":[],"sources":["../../../src/runtime/polyfill/uiFeedback.ts"],"sourcesContent":["import {\n callMiniProgramAsyncSuccess,\n normalizeDuration,\n} from './async'\nimport {\n getLoadingElement,\n getToastElement,\n hideToastElement,\n resolveToastPrefix,\n setLoadingVisible,\n setToastVisible,\n} from './ui'\n\nlet toastHideTimer: ReturnType<typeof setTimeout> | undefined\n\nexport function showToastBridge(options?: any): Promise<any> {\n const toast = getToastElement()\n const content = `${resolveToastPrefix(options?.icon)}${options?.title ?? ''}`.trim()\n if (toast) {\n toast.textContent = content\n setToastVisible(toast, true)\n if (toastHideTimer) {\n clearTimeout(toastHideTimer)\n }\n const duration = normalizeDuration(options?.duration, 1500)\n toastHideTimer = setTimeout(() => {\n hideToastElement()\n toastHideTimer = undefined\n }, duration)\n }\n const result = callMiniProgramAsyncSuccess(options, { errMsg: 'showToast:ok' })\n return Promise.resolve(result)\n}\n\nexport function showLoadingBridge(options?: any): Promise<any> {\n const loading = getLoadingElement()\n if (loading) {\n setLoadingVisible(\n loading,\n true,\n options?.title?.trim() || '加载中',\n Boolean(options?.mask),\n )\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'showLoading:ok' }))\n}\n\nexport function hideLoadingBridge(options?: any): Promise<any> {\n const loading = getLoadingElement()\n if (loading) {\n setLoadingVisible(loading, false, loading.textContent ?? '', false)\n }\n return Promise.resolve(callMiniProgramAsyncSuccess(options, { errMsg: 'hideLoading:ok' }))\n}\n"],"mappings":";;;;AAaA,IAAI;AAEJ,SAAgB,gBAAgB,SAA6B;CAC3D,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,UAAU,GAAG,mBAAmB,SAAS,IAAI,IAAI,SAAS,SAAS,KAAK,KAAK;CACnF,IAAI,OAAO;EACT,MAAM,cAAc;EACpB,gBAAgB,OAAO,IAAI;EAC3B,IAAI,gBACF,aAAa,cAAc;EAE7B,MAAM,WAAW,kBAAkB,SAAS,UAAU,IAAI;EAC1D,iBAAiB,iBAAiB;GAChC,iBAAiB;GACjB,iBAAiB;EACnB,GAAG,QAAQ;CACb;CACA,MAAM,SAAS,4BAA4B,SAAS,EAAE,QAAQ,eAAe,CAAC;CAC9E,OAAO,QAAQ,QAAQ,MAAM;AAC/B;AAEA,SAAgB,kBAAkB,SAA6B;CAC7D,MAAM,UAAU,kBAAkB;CAClC,IAAI,SACF,kBACE,SACA,MACA,SAAS,OAAO,KAAK,KAAK,OAC1B,QAAQ,SAAS,IAAI,CACvB;CAEF,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,iBAAiB,CAAC,CAAC;AAC3F;AAEA,SAAgB,kBAAkB,SAA6B;CAC7D,MAAM,UAAU,kBAAkB;CAClC,IAAI,SACF,kBAAkB,SAAS,OAAO,QAAQ,eAAe,IAAI,KAAK;CAEpE,OAAO,QAAQ,QAAQ,4BAA4B,SAAS,EAAE,QAAQ,iBAAiB,CAAC,CAAC;AAC3F"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
1
|
import { MiniProgramAsyncOptions, MiniProgramBaseResult } from "./types/base.mjs";
|
|
4
2
|
import { ChooseImageOptions, GetClipboardDataOptions, PreviewImageOptions, SetClipboardDataOptions, ShowToastOptions } from "./types/common.mjs";
|
|
5
3
|
import { ChooseAddressOptions, ChooseLocationOptions, GetImageInfoOptions, MakePhoneCallOptions, OpenCustomerServiceChatOptions, OpenLocationOptions, RequestPaymentOptions, RequestSubscribeMessageOptions, RequestSubscribeMessageSuccessResult, ShareMenuOptions, ShowLoadingOptions, TabBarOptions } from "./types/locationRuntime.mjs";
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
|
|
10
2
|
import { chooseAddressBridge, chooseLocationBridge, makePhoneCallBridge, openLocationBridge } from "./locationApi.mjs";
|
|
11
3
|
import { hideTabBarBridge, requestPaymentBridge, requestSubscribeMessageBridge, showActionSheetBridge, showModalBridge, showShareMenuBridge, showTabBarBridge, updateShareMenuBridge } from "./menuApi.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uiMediaApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/uiMediaApi.ts"],"sourcesContent":["import type {\n ChooseAddressOptions,\n ChooseFileOptions,\n ChooseImageOptions,\n ChooseLocationOptions,\n ChooseMediaOptions,\n ChooseMessageFileOptions,\n ChooseVideoOptions,\n CompressImageOptions,\n CompressVideoOptions,\n GetClipboardDataOptions,\n GetImageInfoOptions,\n GetVideoInfoOptions,\n MakePhoneCallOptions,\n MiniProgramAsyncOptions,\n MiniProgramBaseResult,\n OpenCustomerServiceChatOptions,\n OpenDocumentOptions,\n OpenLocationOptions,\n OpenVideoEditorOptions,\n PreviewImageOptions,\n PreviewMediaOptions,\n RequestPaymentOptions,\n RequestSubscribeMessageOptions,\n RequestSubscribeMessageSuccessResult,\n SaveFileOptions,\n SaveFileToDiskOptions,\n SaveImageToPhotosAlbumOptions,\n SaveVideoToPhotosAlbumOptions,\n ScanCodeOptions,\n SetClipboardDataOptions,\n ShareMenuOptions,\n ShowActionSheetOptions,\n ShowLoadingOptions,\n ShowModalOptions,\n ShowToastOptions,\n TabBarOptions,\n} from './types'\nimport {\n getClipboardDataBridge,\n openCustomerServiceChatBridge,\n scanCodeBridge,\n setClipboardDataBridge,\n} from './interactionApi'\nimport {\n chooseAddressBridge,\n chooseLocationBridge,\n makePhoneCallBridge,\n openLocationBridge,\n} from './locationApi'\nimport {\n chooseFileBridge,\n chooseImageBridge,\n chooseMediaBridge,\n chooseMessageFileBridge,\n chooseVideoBridge,\n compressImageBridge,\n compressVideoBridge,\n getImageInfoBridge,\n getVideoInfoBridge,\n openDocumentBridge,\n openVideoEditorBridge,\n previewImageBridge,\n previewMediaBridge,\n saveFileBridge,\n saveFileToDiskBridge,\n saveImageToPhotosAlbumBridge,\n saveVideoToPhotosAlbumBridge,\n} from './mediaApi'\nimport {\n hideTabBarBridge,\n requestPaymentBridge,\n requestSubscribeMessageBridge,\n showActionSheetBridge,\n showModalBridge,\n showShareMenuBridge,\n showTabBarBridge,\n updateShareMenuBridge,\n} from './menuApi'\nimport {\n hideLoadingBridge,\n showLoadingBridge,\n showToastBridge,\n} from './uiFeedback'\n\nexport function showToast(options?: ShowToastOptions) {\n return showToastBridge(options)\n}\n\nexport function showLoading(options?: ShowLoadingOptions) {\n return showLoadingBridge(options)\n}\n\nexport function hideLoading(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>) {\n return hideLoadingBridge(options)\n}\n\nexport function showShareMenu(options?: ShareMenuOptions) {\n return showShareMenuBridge(options)\n}\n\nexport function updateShareMenu(options?: ShareMenuOptions) {\n return updateShareMenuBridge(options)\n}\n\nexport function openCustomerServiceChat(options?: OpenCustomerServiceChatOptions) {\n return openCustomerServiceChatBridge(options)\n}\n\nexport function makePhoneCall(options?: MakePhoneCallOptions) {\n return makePhoneCallBridge(options)\n}\n\nexport function chooseAddress(options?: ChooseAddressOptions) {\n return chooseAddressBridge(options)\n}\n\nexport function chooseLocation(options?: ChooseLocationOptions) {\n return chooseLocationBridge(options)\n}\n\nexport function openLocation(options?: OpenLocationOptions) {\n return openLocationBridge(options)\n}\n\nexport function getImageInfo(options?: GetImageInfoOptions) {\n return getImageInfoBridge(options)\n}\n\nexport function getVideoInfo(options?: GetVideoInfoOptions) {\n return getVideoInfoBridge(options)\n}\n\nexport function showTabBar(options?: TabBarOptions) {\n return showTabBarBridge(options)\n}\n\nexport function hideTabBar(options?: TabBarOptions) {\n return hideTabBarBridge(options)\n}\n\nexport function requestPayment(options?: RequestPaymentOptions) {\n return requestPaymentBridge(options)\n}\n\nexport function requestSubscribeMessage(options?: RequestSubscribeMessageOptions): Promise<RequestSubscribeMessageSuccessResult> {\n return requestSubscribeMessageBridge(options)\n}\n\nexport function showModal(options?: ShowModalOptions) {\n return showModalBridge(options)\n}\n\nexport function showActionSheet(options?: ShowActionSheetOptions) {\n return showActionSheetBridge(options)\n}\n\nexport async function chooseImage(options?: ChooseImageOptions) {\n return chooseImageBridge(options)\n}\n\nexport async function chooseMedia(options?: ChooseMediaOptions) {\n return chooseMediaBridge(options)\n}\n\nexport async function compressImage(options?: CompressImageOptions) {\n return compressImageBridge(options)\n}\n\nexport function compressVideo(options?: CompressVideoOptions) {\n return compressVideoBridge(options)\n}\n\nexport async function chooseVideo(options?: ChooseVideoOptions) {\n return chooseVideoBridge(options)\n}\n\nexport async function chooseMessageFile(options?: ChooseMessageFileOptions) {\n return chooseMessageFileBridge(options)\n}\n\nexport async function chooseFile(options?: ChooseFileOptions) {\n return chooseFileBridge(options)\n}\n\nexport function previewImage(options?: PreviewImageOptions) {\n return previewImageBridge(options)\n}\n\nexport function previewMedia(options?: PreviewMediaOptions) {\n return previewMediaBridge(options)\n}\n\nexport function openVideoEditor(options?: OpenVideoEditorOptions) {\n return openVideoEditorBridge(options)\n}\n\nexport function saveImageToPhotosAlbum(options?: SaveImageToPhotosAlbumOptions) {\n return saveImageToPhotosAlbumBridge(options)\n}\n\nexport function saveVideoToPhotosAlbum(options?: SaveVideoToPhotosAlbumOptions) {\n return saveVideoToPhotosAlbumBridge(options)\n}\n\nexport function saveFile(options?: SaveFileOptions) {\n return saveFileBridge(options)\n}\n\nexport function saveFileToDisk(options?: SaveFileToDiskOptions) {\n return saveFileToDiskBridge(options)\n}\n\nexport function openDocument(options?: OpenDocumentOptions) {\n return openDocumentBridge(options)\n}\n\nexport function scanCode(options?: ScanCodeOptions) {\n return scanCodeBridge(options)\n}\n\nexport async function setClipboardData(options?: SetClipboardDataOptions) {\n return setClipboardDataBridge(options)\n}\n\nexport async function getClipboardData(options?: GetClipboardDataOptions) {\n return getClipboardDataBridge(options)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"uiMediaApi.mjs","names":[],"sources":["../../../src/runtime/polyfill/uiMediaApi.ts"],"sourcesContent":["import type {\n ChooseAddressOptions,\n ChooseFileOptions,\n ChooseImageOptions,\n ChooseLocationOptions,\n ChooseMediaOptions,\n ChooseMessageFileOptions,\n ChooseVideoOptions,\n CompressImageOptions,\n CompressVideoOptions,\n GetClipboardDataOptions,\n GetImageInfoOptions,\n GetVideoInfoOptions,\n MakePhoneCallOptions,\n MiniProgramAsyncOptions,\n MiniProgramBaseResult,\n OpenCustomerServiceChatOptions,\n OpenDocumentOptions,\n OpenLocationOptions,\n OpenVideoEditorOptions,\n PreviewImageOptions,\n PreviewMediaOptions,\n RequestPaymentOptions,\n RequestSubscribeMessageOptions,\n RequestSubscribeMessageSuccessResult,\n SaveFileOptions,\n SaveFileToDiskOptions,\n SaveImageToPhotosAlbumOptions,\n SaveVideoToPhotosAlbumOptions,\n ScanCodeOptions,\n SetClipboardDataOptions,\n ShareMenuOptions,\n ShowActionSheetOptions,\n ShowLoadingOptions,\n ShowModalOptions,\n ShowToastOptions,\n TabBarOptions,\n} from './types'\nimport {\n getClipboardDataBridge,\n openCustomerServiceChatBridge,\n scanCodeBridge,\n setClipboardDataBridge,\n} from './interactionApi'\nimport {\n chooseAddressBridge,\n chooseLocationBridge,\n makePhoneCallBridge,\n openLocationBridge,\n} from './locationApi'\nimport {\n chooseFileBridge,\n chooseImageBridge,\n chooseMediaBridge,\n chooseMessageFileBridge,\n chooseVideoBridge,\n compressImageBridge,\n compressVideoBridge,\n getImageInfoBridge,\n getVideoInfoBridge,\n openDocumentBridge,\n openVideoEditorBridge,\n previewImageBridge,\n previewMediaBridge,\n saveFileBridge,\n saveFileToDiskBridge,\n saveImageToPhotosAlbumBridge,\n saveVideoToPhotosAlbumBridge,\n} from './mediaApi'\nimport {\n hideTabBarBridge,\n requestPaymentBridge,\n requestSubscribeMessageBridge,\n showActionSheetBridge,\n showModalBridge,\n showShareMenuBridge,\n showTabBarBridge,\n updateShareMenuBridge,\n} from './menuApi'\nimport {\n hideLoadingBridge,\n showLoadingBridge,\n showToastBridge,\n} from './uiFeedback'\n\nexport function showToast(options?: ShowToastOptions) {\n return showToastBridge(options)\n}\n\nexport function showLoading(options?: ShowLoadingOptions) {\n return showLoadingBridge(options)\n}\n\nexport function hideLoading(options?: MiniProgramAsyncOptions<MiniProgramBaseResult>) {\n return hideLoadingBridge(options)\n}\n\nexport function showShareMenu(options?: ShareMenuOptions) {\n return showShareMenuBridge(options)\n}\n\nexport function updateShareMenu(options?: ShareMenuOptions) {\n return updateShareMenuBridge(options)\n}\n\nexport function openCustomerServiceChat(options?: OpenCustomerServiceChatOptions) {\n return openCustomerServiceChatBridge(options)\n}\n\nexport function makePhoneCall(options?: MakePhoneCallOptions) {\n return makePhoneCallBridge(options)\n}\n\nexport function chooseAddress(options?: ChooseAddressOptions) {\n return chooseAddressBridge(options)\n}\n\nexport function chooseLocation(options?: ChooseLocationOptions) {\n return chooseLocationBridge(options)\n}\n\nexport function openLocation(options?: OpenLocationOptions) {\n return openLocationBridge(options)\n}\n\nexport function getImageInfo(options?: GetImageInfoOptions) {\n return getImageInfoBridge(options)\n}\n\nexport function getVideoInfo(options?: GetVideoInfoOptions) {\n return getVideoInfoBridge(options)\n}\n\nexport function showTabBar(options?: TabBarOptions) {\n return showTabBarBridge(options)\n}\n\nexport function hideTabBar(options?: TabBarOptions) {\n return hideTabBarBridge(options)\n}\n\nexport function requestPayment(options?: RequestPaymentOptions) {\n return requestPaymentBridge(options)\n}\n\nexport function requestSubscribeMessage(options?: RequestSubscribeMessageOptions): Promise<RequestSubscribeMessageSuccessResult> {\n return requestSubscribeMessageBridge(options)\n}\n\nexport function showModal(options?: ShowModalOptions) {\n return showModalBridge(options)\n}\n\nexport function showActionSheet(options?: ShowActionSheetOptions) {\n return showActionSheetBridge(options)\n}\n\nexport async function chooseImage(options?: ChooseImageOptions) {\n return chooseImageBridge(options)\n}\n\nexport async function chooseMedia(options?: ChooseMediaOptions) {\n return chooseMediaBridge(options)\n}\n\nexport async function compressImage(options?: CompressImageOptions) {\n return compressImageBridge(options)\n}\n\nexport function compressVideo(options?: CompressVideoOptions) {\n return compressVideoBridge(options)\n}\n\nexport async function chooseVideo(options?: ChooseVideoOptions) {\n return chooseVideoBridge(options)\n}\n\nexport async function chooseMessageFile(options?: ChooseMessageFileOptions) {\n return chooseMessageFileBridge(options)\n}\n\nexport async function chooseFile(options?: ChooseFileOptions) {\n return chooseFileBridge(options)\n}\n\nexport function previewImage(options?: PreviewImageOptions) {\n return previewImageBridge(options)\n}\n\nexport function previewMedia(options?: PreviewMediaOptions) {\n return previewMediaBridge(options)\n}\n\nexport function openVideoEditor(options?: OpenVideoEditorOptions) {\n return openVideoEditorBridge(options)\n}\n\nexport function saveImageToPhotosAlbum(options?: SaveImageToPhotosAlbumOptions) {\n return saveImageToPhotosAlbumBridge(options)\n}\n\nexport function saveVideoToPhotosAlbum(options?: SaveVideoToPhotosAlbumOptions) {\n return saveVideoToPhotosAlbumBridge(options)\n}\n\nexport function saveFile(options?: SaveFileOptions) {\n return saveFileBridge(options)\n}\n\nexport function saveFileToDisk(options?: SaveFileToDiskOptions) {\n return saveFileToDiskBridge(options)\n}\n\nexport function openDocument(options?: OpenDocumentOptions) {\n return openDocumentBridge(options)\n}\n\nexport function scanCode(options?: ScanCodeOptions) {\n return scanCodeBridge(options)\n}\n\nexport async function setClipboardData(options?: SetClipboardDataOptions) {\n return setClipboardDataBridge(options)\n}\n\nexport async function getClipboardData(options?: GetClipboardDataOptions) {\n return getClipboardDataBridge(options)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,SAAgB,UAAU,SAA4B;CACpD,OAAO,gBAAgB,OAAO;AAChC;AAEA,SAAgB,YAAY,SAA8B;CACxD,OAAO,kBAAkB,OAAO;AAClC;AAEA,SAAgB,YAAY,SAA0D;CACpF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C;AAEA,eAAsB,kBAAkB,SAAoC;CAC1E,OAAO,wBAAwB,OAAO;AACxC;AAEA,eAAsB,WAAW,SAA6B;CAC5D,OAAO,iBAAiB,OAAO;AACjC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,gBAAgB,SAAkC;CAChE,OAAO,sBAAsB,OAAO;AACtC;AAEA,SAAgB,uBAAuB,SAAyC;CAC9E,OAAO,6BAA6B,OAAO;AAC7C;AAEA,SAAgB,uBAAuB,SAAyC;CAC9E,OAAO,6BAA6B,OAAO;AAC7C;AAEA,SAAgB,SAAS,SAA2B;CAClD,OAAO,eAAe,OAAO;AAC/B;AAEA,SAAgB,eAAe,SAAiC;CAC9D,OAAO,qBAAqB,OAAO;AACrC;AAEA,SAAgB,aAAa,SAA+B;CAC1D,OAAO,mBAAmB,OAAO;AACnC;AAEA,SAAgB,SAAS,SAA2B;CAClD,OAAO,eAAe,OAAO;AAC/B;AAEA,eAAsB,iBAAiB,SAAmC;CACxE,OAAO,uBAAuB,OAAO;AACvC;AAEA,eAAsB,iBAAiB,SAAmC;CACxE,OAAO,uBAAuB,OAAO;AACvC"}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
//#region src/runtime/polyfill/videoContext.ts
|
|
10
2
|
function resolveVideoElementById(videoId) {
|
|
11
3
|
if (typeof document === "undefined") return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"videoContext.mjs","names":[],"sources":["../../../src/runtime/polyfill/videoContext.ts"],"sourcesContent":["import type { VideoContext } from './types/platformRuntime'\n\nfunction resolveVideoElementById(videoId: string) {\n if (typeof document === 'undefined') {\n return undefined\n }\n const normalized = String(videoId ?? '').trim()\n if (!normalized) {\n return undefined\n }\n const fromId = document.getElementById(normalized)\n if (fromId && 'play' in fromId && 'pause' in fromId) {\n return fromId as unknown as HTMLVideoElement\n }\n const escaped = typeof CSS !== 'undefined' && typeof CSS.escape === 'function'\n ? CSS.escape(normalized)\n : normalized.replace(/\"/g, '\\\\\"')\n const fromQuery = document.querySelector(`video#${escaped}`)\n if (fromQuery && 'play' in fromQuery && 'pause' in fromQuery) {\n return fromQuery as HTMLVideoElement\n }\n return undefined\n}\n\nexport function createVideoContextBridge(videoId: string): VideoContext {\n const getVideo = () => resolveVideoElementById(videoId)\n return {\n play() {\n getVideo()?.play?.()\n },\n pause() {\n getVideo()?.pause?.()\n },\n stop() {\n const video = getVideo()\n if (!video) {\n return\n }\n video.pause?.()\n try {\n video.currentTime = 0\n }\n catch {\n // ignore browsers that block currentTime mutation\n }\n },\n seek(position: number) {\n if (!Number.isFinite(position)) {\n return\n }\n const video = getVideo()\n if (!video) {\n return\n }\n try {\n video.currentTime = Math.max(0, position)\n }\n catch {\n // ignore browsers that block currentTime mutation\n }\n },\n playbackRate(rate: number) {\n if (!Number.isFinite(rate) || rate <= 0) {\n return\n }\n const video = getVideo()\n if (!video) {\n return\n }\n try {\n video.playbackRate = rate\n }\n catch {\n // ignore unsupported playbackRate mutation\n }\n },\n requestFullScreen() {\n const video = getVideo() as (HTMLVideoElement & { requestFullscreen?: () => Promise<void> | void }) | undefined\n video?.requestFullscreen?.()\n },\n exitFullScreen() {\n const runtimeDocument = document as { exitFullscreen?: () => Promise<void> | void }\n runtimeDocument.exitFullscreen?.()\n },\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"videoContext.mjs","names":[],"sources":["../../../src/runtime/polyfill/videoContext.ts"],"sourcesContent":["import type { VideoContext } from './types/platformRuntime'\n\nfunction resolveVideoElementById(videoId: string) {\n if (typeof document === 'undefined') {\n return undefined\n }\n const normalized = String(videoId ?? '').trim()\n if (!normalized) {\n return undefined\n }\n const fromId = document.getElementById(normalized)\n if (fromId && 'play' in fromId && 'pause' in fromId) {\n return fromId as unknown as HTMLVideoElement\n }\n const escaped = typeof CSS !== 'undefined' && typeof CSS.escape === 'function'\n ? CSS.escape(normalized)\n : normalized.replace(/\"/g, '\\\\\"')\n const fromQuery = document.querySelector(`video#${escaped}`)\n if (fromQuery && 'play' in fromQuery && 'pause' in fromQuery) {\n return fromQuery as HTMLVideoElement\n }\n return undefined\n}\n\nexport function createVideoContextBridge(videoId: string): VideoContext {\n const getVideo = () => resolveVideoElementById(videoId)\n return {\n play() {\n getVideo()?.play?.()\n },\n pause() {\n getVideo()?.pause?.()\n },\n stop() {\n const video = getVideo()\n if (!video) {\n return\n }\n video.pause?.()\n try {\n video.currentTime = 0\n }\n catch {\n // ignore browsers that block currentTime mutation\n }\n },\n seek(position: number) {\n if (!Number.isFinite(position)) {\n return\n }\n const video = getVideo()\n if (!video) {\n return\n }\n try {\n video.currentTime = Math.max(0, position)\n }\n catch {\n // ignore browsers that block currentTime mutation\n }\n },\n playbackRate(rate: number) {\n if (!Number.isFinite(rate) || rate <= 0) {\n return\n }\n const video = getVideo()\n if (!video) {\n return\n }\n try {\n video.playbackRate = rate\n }\n catch {\n // ignore unsupported playbackRate mutation\n }\n },\n requestFullScreen() {\n const video = getVideo() as (HTMLVideoElement & { requestFullscreen?: () => Promise<void> | void }) | undefined\n video?.requestFullscreen?.()\n },\n exitFullScreen() {\n const runtimeDocument = document as { exitFullscreen?: () => Promise<void> | void }\n runtimeDocument.exitFullscreen?.()\n },\n }\n}\n"],"mappings":";AAEA,SAAS,wBAAwB,SAAiB;CAChD,IAAI,OAAO,aAAa,aACtB;CAEF,MAAM,aAAa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
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
//#region src/runtime/polyfill/vkSession.ts
|
|
10
2
|
function createVkSessionBridge() {
|
|
11
3
|
let destroyed = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vkSession.mjs","names":[],"sources":["../../../src/runtime/polyfill/vkSession.ts"],"sourcesContent":["interface VkSession {\n start: () => Promise<{ errMsg: string }>\n stop: () => Promise<{ errMsg: string }>\n destroy: () => void\n on: (eventName: string, callback: (payload: unknown) => void) => void\n off: (eventName?: string, callback?: (payload: unknown) => void) => void\n}\n\nexport function createVkSessionBridge(): VkSession {\n let destroyed = false\n const listeners = new Map<string, Set<(payload: unknown) => void>>()\n\n const ensureAvailable = (action: string) => {\n if (destroyed) {\n throw new TypeError(`createVKSession:fail session is destroyed (${action})`)\n }\n }\n\n return {\n start() {\n try {\n ensureAvailable('start')\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return Promise.reject(new TypeError(message))\n }\n return Promise.resolve({ errMsg: 'vkSession.start:ok' })\n },\n stop() {\n try {\n ensureAvailable('stop')\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return Promise.reject(new TypeError(message))\n }\n return Promise.resolve({ errMsg: 'vkSession.stop:ok' })\n },\n destroy() {\n destroyed = true\n listeners.clear()\n },\n on(eventName: string, callback: (payload: unknown) => void) {\n if (typeof eventName !== 'string' || typeof callback !== 'function') {\n return\n }\n const key = eventName.trim()\n if (!key) {\n return\n }\n const list = listeners.get(key) ?? new Set<(payload: unknown) => void>()\n list.add(callback)\n listeners.set(key, list)\n },\n off(eventName?: string, callback?: (payload: unknown) => void) {\n if (typeof eventName !== 'string' || !eventName.trim()) {\n listeners.clear()\n return\n }\n const list = listeners.get(eventName.trim())\n if (!list) {\n return\n }\n if (typeof callback !== 'function') {\n listeners.delete(eventName.trim())\n return\n }\n list.delete(callback)\n if (list.size === 0) {\n listeners.delete(eventName.trim())\n }\n },\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"vkSession.mjs","names":[],"sources":["../../../src/runtime/polyfill/vkSession.ts"],"sourcesContent":["interface VkSession {\n start: () => Promise<{ errMsg: string }>\n stop: () => Promise<{ errMsg: string }>\n destroy: () => void\n on: (eventName: string, callback: (payload: unknown) => void) => void\n off: (eventName?: string, callback?: (payload: unknown) => void) => void\n}\n\nexport function createVkSessionBridge(): VkSession {\n let destroyed = false\n const listeners = new Map<string, Set<(payload: unknown) => void>>()\n\n const ensureAvailable = (action: string) => {\n if (destroyed) {\n throw new TypeError(`createVKSession:fail session is destroyed (${action})`)\n }\n }\n\n return {\n start() {\n try {\n ensureAvailable('start')\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return Promise.reject(new TypeError(message))\n }\n return Promise.resolve({ errMsg: 'vkSession.start:ok' })\n },\n stop() {\n try {\n ensureAvailable('stop')\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return Promise.reject(new TypeError(message))\n }\n return Promise.resolve({ errMsg: 'vkSession.stop:ok' })\n },\n destroy() {\n destroyed = true\n listeners.clear()\n },\n on(eventName: string, callback: (payload: unknown) => void) {\n if (typeof eventName !== 'string' || typeof callback !== 'function') {\n return\n }\n const key = eventName.trim()\n if (!key) {\n return\n }\n const list = listeners.get(key) ?? new Set<(payload: unknown) => void>()\n list.add(callback)\n listeners.set(key, list)\n },\n off(eventName?: string, callback?: (payload: unknown) => void) {\n if (typeof eventName !== 'string' || !eventName.trim()) {\n listeners.clear()\n return\n }\n const list = listeners.get(eventName.trim())\n if (!list) {\n return\n }\n if (typeof callback !== 'function') {\n listeners.delete(eventName.trim())\n return\n }\n list.delete(callback)\n if (list.size === 0) {\n listeners.delete(eventName.trim())\n }\n },\n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ACpB,IAAI,KAAK,SAAS,GAChB,UAAU,OAAO,UAAU,KAAK,CAAC;EAErC;CACF;AACF"}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
//#region src/runtime/polyfill/windowResize.ts
|
|
10
2
|
const windowResizeCallbacks = /* @__PURE__ */ new Set();
|
|
11
3
|
let windowResizeBridgeBound = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windowResize.mjs","names":[],"sources":["../../../src/runtime/polyfill/windowResize.ts"],"sourcesContent":["interface WindowResizeSnapshot {\n size: {\n windowWidth: number\n windowHeight: number\n }\n windowWidth: number\n windowHeight: number\n}\n\nconst windowResizeCallbacks = new Set<(result: WindowResizeSnapshot) => void>()\nlet windowResizeBridgeBound = false\n\nfunction readWindowResizeResult(getWindowInfo: () => { windowWidth: number, windowHeight: number }) {\n const windowInfo = getWindowInfo()\n return {\n size: {\n windowWidth: windowInfo.windowWidth,\n windowHeight: windowInfo.windowHeight,\n },\n windowWidth: windowInfo.windowWidth,\n windowHeight: windowInfo.windowHeight,\n }\n}\n\nfunction notifyWindowResize(getWindowInfo: () => { windowWidth: number, windowHeight: number }) {\n if (windowResizeCallbacks.size === 0) {\n return\n }\n const result = readWindowResizeResult(getWindowInfo)\n for (const callback of windowResizeCallbacks) {\n callback(result)\n }\n}\n\nfunction bindWindowResizeBridge(getWindowInfo: () => { windowWidth: number, windowHeight: number }) {\n if (windowResizeBridgeBound) {\n return\n }\n windowResizeBridgeBound = true\n const runtimeTarget = (typeof window !== 'undefined'\n ? window\n : globalThis) as {\n addEventListener?: (type: string, listener: () => void) => void\n }\n runtimeTarget.addEventListener?.('resize', () => notifyWindowResize(getWindowInfo))\n}\n\nexport function addWindowResizeCallback(\n callback: (result: WindowResizeSnapshot) => void,\n getWindowInfo: () => { windowWidth: number, windowHeight: number },\n) {\n bindWindowResizeBridge(getWindowInfo)\n windowResizeCallbacks.add(callback)\n}\n\nexport function removeWindowResizeCallback(callback?: (result: WindowResizeSnapshot) => void) {\n if (typeof callback !== 'function') {\n windowResizeCallbacks.clear()\n return\n }\n windowResizeCallbacks.delete(callback)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"windowResize.mjs","names":[],"sources":["../../../src/runtime/polyfill/windowResize.ts"],"sourcesContent":["interface WindowResizeSnapshot {\n size: {\n windowWidth: number\n windowHeight: number\n }\n windowWidth: number\n windowHeight: number\n}\n\nconst windowResizeCallbacks = new Set<(result: WindowResizeSnapshot) => void>()\nlet windowResizeBridgeBound = false\n\nfunction readWindowResizeResult(getWindowInfo: () => { windowWidth: number, windowHeight: number }) {\n const windowInfo = getWindowInfo()\n return {\n size: {\n windowWidth: windowInfo.windowWidth,\n windowHeight: windowInfo.windowHeight,\n },\n windowWidth: windowInfo.windowWidth,\n windowHeight: windowInfo.windowHeight,\n }\n}\n\nfunction notifyWindowResize(getWindowInfo: () => { windowWidth: number, windowHeight: number }) {\n if (windowResizeCallbacks.size === 0) {\n return\n }\n const result = readWindowResizeResult(getWindowInfo)\n for (const callback of windowResizeCallbacks) {\n callback(result)\n }\n}\n\nfunction bindWindowResizeBridge(getWindowInfo: () => { windowWidth: number, windowHeight: number }) {\n if (windowResizeBridgeBound) {\n return\n }\n windowResizeBridgeBound = true\n const runtimeTarget = (typeof window !== 'undefined'\n ? window\n : globalThis) as {\n addEventListener?: (type: string, listener: () => void) => void\n }\n runtimeTarget.addEventListener?.('resize', () => notifyWindowResize(getWindowInfo))\n}\n\nexport function addWindowResizeCallback(\n callback: (result: WindowResizeSnapshot) => void,\n getWindowInfo: () => { windowWidth: number, windowHeight: number },\n) {\n bindWindowResizeBridge(getWindowInfo)\n windowResizeCallbacks.add(callback)\n}\n\nexport function removeWindowResizeCallback(callback?: (result: WindowResizeSnapshot) => void) {\n if (typeof callback !== 'function') {\n windowResizeCallbacks.clear()\n return\n }\n windowResizeCallbacks.delete(callback)\n}\n"],"mappings":";AASA,MAAM,wCAAwB,IAAI,IAA4C;AAC9E,IAAI,0BAA0B;AAE9B,SAAS,uBAAuB,eAAoE;CAClG,MAAM,aAAa,cAAc;CACjC,OAAO;EACL,MAAM;GACJ,aAAa,WAAW;GACxB,cAAc,WAAW;EAC3B;EACA,aAAa,WAAW;EACxB,cAAc,WAAW;CAC3B;AACF;AAEA,SAAS,mBAAmB,eAAoE;CAC9F,IAAI,sBAAsB,SAAS,GACjC;CAEF,MAAM,SAAS,uBAAuB,aAAa;CACnD,KAAK,MAAM,YAAY,uBACrB,SAAS,MAAM;AAEnB;AAEA,SAAS,uBAAuB,eAAoE;CAClG,IAAI,yBACF;CAEF,0BAA0B;CAM1B,CALuB,OAAO,WAAW,cACrC,SACA,YAGU,mBAAmB,gBAAgB,mBAAmB,aAAa,CAAC;AACpF;AAEA,SAAgB,wBACd,UACA,eACA;CACA,uBAAuB,aAAa;CACpC,sBAAsB,IAAI,QAAQ;AACpC;AAEA,SAAgB,2BAA2B,UAAmD;CAC5F,IAAI,OAAO,aAAa,YAAY;EAClC,sBAAsB,MAAM;EAC5B;CACF;CACA,sBAAsB,OAAO,QAAQ;AACvC"}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
//#region src/runtime/polyfill/worker.ts
|
|
10
2
|
function resolveWorkerPath(path) {
|
|
11
3
|
const normalized = typeof path === "string" ? path.trim() : "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.mjs","names":[],"sources":["../../../src/runtime/polyfill/worker.ts"],"sourcesContent":["type WorkerMessageCallback = (result: { data: unknown }) => void\ntype WorkerErrorCallback = (error: {\n message: string\n filename?: string\n lineno?: number\n colno?: number\n}) => void\n\nfunction resolveWorkerPath(path: unknown) {\n const normalized = typeof path === 'string' ? path.trim() : ''\n if (!normalized) {\n throw new TypeError('createWorker:fail invalid scriptPath')\n }\n try {\n const runtimeLocation = (typeof location !== 'undefined' ? location : undefined) as { href?: string } | undefined\n const base = runtimeLocation?.href\n if (base) {\n return new URL(normalized, base).toString()\n }\n }\n catch {\n // fallback to raw path\n }\n return normalized\n}\n\nexport function createWorkerBridge(path: string) {\n const WorkerCtor = (globalThis as { Worker?: typeof Worker }).Worker\n if (typeof WorkerCtor !== 'function') {\n throw new TypeError('createWorker:fail Worker is unavailable')\n }\n const scriptPath = resolveWorkerPath(path)\n\n let nativeWorker: Worker\n try {\n nativeWorker = new WorkerCtor(scriptPath)\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n throw new TypeError(`createWorker:fail ${message}`)\n }\n\n const messageCallbacks = new Set<WorkerMessageCallback>()\n const errorCallbacks = new Set<WorkerErrorCallback>()\n\n const handleMessage = (event: MessageEvent<unknown>) => {\n for (const callback of messageCallbacks) {\n callback({ data: event?.data })\n }\n }\n const handleError = (event: ErrorEvent) => {\n const payload = {\n message: event?.message ?? 'unknown error',\n filename: event?.filename,\n lineno: event?.lineno,\n colno: event?.colno,\n }\n for (const callback of errorCallbacks) {\n callback(payload)\n }\n }\n\n if (typeof nativeWorker.addEventListener === 'function') {\n nativeWorker.addEventListener('message', handleMessage as EventListener)\n nativeWorker.addEventListener('error', handleError as EventListener)\n }\n else {\n nativeWorker.onmessage = handleMessage as ((this: AbstractWorker, ev: MessageEvent) => any)\n nativeWorker.onerror = handleError as ((this: AbstractWorker, ev: ErrorEvent) => any)\n }\n\n return {\n postMessage(data: unknown) {\n nativeWorker.postMessage(data)\n },\n terminate() {\n nativeWorker.terminate()\n messageCallbacks.clear()\n errorCallbacks.clear()\n },\n onMessage(callback: WorkerMessageCallback) {\n if (typeof callback === 'function') {\n messageCallbacks.add(callback)\n }\n },\n offMessage(callback?: WorkerMessageCallback) {\n if (typeof callback !== 'function') {\n messageCallbacks.clear()\n return\n }\n messageCallbacks.delete(callback)\n },\n onError(callback: WorkerErrorCallback) {\n if (typeof callback === 'function') {\n errorCallbacks.add(callback)\n }\n },\n offError(callback?: WorkerErrorCallback) {\n if (typeof callback !== 'function') {\n errorCallbacks.clear()\n return\n }\n errorCallbacks.delete(callback)\n },\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"worker.mjs","names":[],"sources":["../../../src/runtime/polyfill/worker.ts"],"sourcesContent":["type WorkerMessageCallback = (result: { data: unknown }) => void\ntype WorkerErrorCallback = (error: {\n message: string\n filename?: string\n lineno?: number\n colno?: number\n}) => void\n\nfunction resolveWorkerPath(path: unknown) {\n const normalized = typeof path === 'string' ? path.trim() : ''\n if (!normalized) {\n throw new TypeError('createWorker:fail invalid scriptPath')\n }\n try {\n const runtimeLocation = (typeof location !== 'undefined' ? location : undefined) as { href?: string } | undefined\n const base = runtimeLocation?.href\n if (base) {\n return new URL(normalized, base).toString()\n }\n }\n catch {\n // fallback to raw path\n }\n return normalized\n}\n\nexport function createWorkerBridge(path: string) {\n const WorkerCtor = (globalThis as { Worker?: typeof Worker }).Worker\n if (typeof WorkerCtor !== 'function') {\n throw new TypeError('createWorker:fail Worker is unavailable')\n }\n const scriptPath = resolveWorkerPath(path)\n\n let nativeWorker: Worker\n try {\n nativeWorker = new WorkerCtor(scriptPath)\n }\n catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n throw new TypeError(`createWorker:fail ${message}`)\n }\n\n const messageCallbacks = new Set<WorkerMessageCallback>()\n const errorCallbacks = new Set<WorkerErrorCallback>()\n\n const handleMessage = (event: MessageEvent<unknown>) => {\n for (const callback of messageCallbacks) {\n callback({ data: event?.data })\n }\n }\n const handleError = (event: ErrorEvent) => {\n const payload = {\n message: event?.message ?? 'unknown error',\n filename: event?.filename,\n lineno: event?.lineno,\n colno: event?.colno,\n }\n for (const callback of errorCallbacks) {\n callback(payload)\n }\n }\n\n if (typeof nativeWorker.addEventListener === 'function') {\n nativeWorker.addEventListener('message', handleMessage as EventListener)\n nativeWorker.addEventListener('error', handleError as EventListener)\n }\n else {\n nativeWorker.onmessage = handleMessage as ((this: AbstractWorker, ev: MessageEvent) => any)\n nativeWorker.onerror = handleError as ((this: AbstractWorker, ev: ErrorEvent) => any)\n }\n\n return {\n postMessage(data: unknown) {\n nativeWorker.postMessage(data)\n },\n terminate() {\n nativeWorker.terminate()\n messageCallbacks.clear()\n errorCallbacks.clear()\n },\n onMessage(callback: WorkerMessageCallback) {\n if (typeof callback === 'function') {\n messageCallbacks.add(callback)\n }\n },\n offMessage(callback?: WorkerMessageCallback) {\n if (typeof callback !== 'function') {\n messageCallbacks.clear()\n return\n }\n messageCallbacks.delete(callback)\n },\n onError(callback: WorkerErrorCallback) {\n if (typeof callback === 'function') {\n errorCallbacks.add(callback)\n }\n },\n offError(callback?: WorkerErrorCallback) {\n if (typeof callback !== 'function') {\n errorCallbacks.clear()\n return\n }\n errorCallbacks.delete(callback)\n },\n }\n}\n"],"mappings":";AAQA,SAAS,kBAAkB,MAAe;CACxC,MAAM,aAAa,OAAO,SAAS,WAAW,KAAK,KAAK,IAAI;CAC5D,IAAI,CAAC,YACH,MAAM,IAAI,UAAU,sCAAsC;CAE5D,IAAI;EAEF,MAAM,QADmB,OAAO,aAAa,cAAc,WAAW,SACxC;EAC9B,IAAI,MACF,OAAO,IAAI,IAAI,YAAY,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O,aAAa,YACtB,eAAe,IAAI,QAAQ;EAE/B;EACA,SAAS,UAAgC;GACvC,IAAI,OAAO,aAAa,YAAY;IAClC,eAAe,MAAM;IACrB;GACF;GACA,eAAe,OAAO,QAAQ;EAChC;CACF;AACF"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
1
|
import { authorize, checkSession, getAccountInfoSync, getAppAuthorizeSetting, getAppBaseInfo, getBatteryInfo, getBatteryInfoSync, getDeviceInfo, getFuzzyLocation, getLocation, getMenuButtonBoundingClientRect, getNetworkType, getSetting, getSystemInfo, getSystemInfoSync, getSystemSetting, getUserInfo, getUserProfile, getWindowInfo, login, offNetworkStatusChange, offWindowResize, onNetworkStatusChange, onWindowResize, openAppAuthorizeSetting, openSetting, vibrateShort } from "./polyfill/deviceAuthSystemApi.mjs";
|
|
4
2
|
import { getEnterOptionsSync, getLaunchOptionsSync, initializePageRoutes, navigateBack, navigateTo, reLaunch, redirectTo, registerApp, registerComponent, registerPage, switchTab } from "./polyfill/routeRuntime.mjs";
|
|
5
3
|
import { clearStorage, clearStorageSync, createCanvasContext, createSelectorQuery, createVKSession, createVideoContext, createWorker, downloadFile, exitMiniProgram, getFileSystemManager, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, hideKeyboard, loadSubPackage, navigateToMiniProgram, nextTick, pageScrollTo, preloadSubpackage, removeStorage, removeStorageSync, request, setStorage, setStorageSync, startPullDownRefresh, stopPullDownRefresh, uploadFile } from "./polyfill/runtimeDataApi.mjs";
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
import { emitRuntimeWarning } from "./warning.mjs";
|
|
10
2
|
import { getRuntimeExecutionMode, warnRuntimeExecutionOnce } from "./execution.mjs";
|
|
11
3
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderContext.mjs","names":[],"sources":["../../src/runtime/renderContext.ts"],"sourcesContent":["import type { ComponentPublicInstance } from './component'\nimport type { TemplateScope } from './template'\nimport { getRuntimeExecutionMode, warnRuntimeExecutionOnce } from './execution'\nimport { emitRuntimeWarning } from './warning'\n\nexport interface RenderContext {\n instance: ComponentPublicInstance\n eval: (expression: string, scope: TemplateScope, wxs?: Record<string, any>) => any\n createScope: (parent: TemplateScope, locals?: Record<string, any>) => TemplateScope\n mergeScope: (parent: TemplateScope, data?: any) => TemplateScope\n normalizeList: (value: any) => any[]\n key: (rawKey: string, item: any, index: number, scope: TemplateScope, wxs?: Record<string, any>) => any\n renderTemplate: (templates: Record<string, any>, name: any, scope: TemplateScope, ctx: RenderContext) => any\n event: (eventName: string, handlerName: any, scope: TemplateScope, wxs?: Record<string, any>, flags?: { catch?: boolean, capture?: boolean }) => (event: Event) => void\n createWxsModule: (code: string, id: string, requireMap?: Record<string, any>) => Record<string, any>\n}\n\nconst expressionCache = new Map<string, (scope: TemplateScope) => any>()\nconst MUSTACHE_PREFIX_RE = /^\\{\\{\\s*/\nconst MUSTACHE_SUFFIX_RE = /\\s*\\}\\}$/\nconst SIMPLE_KEY_PATH_RE = /[.[()]/\n\nfunction createScope(initial?: TemplateScope): TemplateScope {\n return Object.assign(Object.create(null), initial ?? {})\n}\n\nfunction createChildScope(parent: TemplateScope, locals?: Record<string, any>): TemplateScope {\n return Object.assign(Object.create(parent), locals ?? {})\n}\n\nfunction evaluateExpression(expression: string, scope: TemplateScope): any {\n if (!expression) {\n return undefined\n }\n const trimmed = expression.trim()\n if (!trimmed) {\n return undefined\n }\n let evaluator = expressionCache.get(trimmed)\n if (!evaluator) {\n try {\n // eslint-disable-next-line no-new-func -- dynamic expressions are required for template evaluation\n evaluator = new Function('scope', `with(scope){ return (${trimmed}); }`) as (scope: TemplateScope) => any\n }\n catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n const mode = getRuntimeExecutionMode()\n if (mode === 'safe') {\n warnRuntimeExecutionOnce(\n `safe-expression-parse:${trimmed}`,\n `[@weapp-vite/web] safe 模式下忽略表达式解析错误 \"${trimmed}\": ${reason}`,\n )\n evaluator = () => undefined\n }\n else {\n throw new SyntaxError(`[@weapp-vite/web] 无法解析表达式 \"${trimmed}\": ${reason}`)\n }\n }\n if (evaluator) {\n expressionCache.set(trimmed, evaluator)\n }\n }\n try {\n return evaluator?.(scope)\n }\n catch (error) {\n const mode = getRuntimeExecutionMode()\n if (mode === 'strict') {\n const reason = error instanceof Error ? error.message : String(error)\n throw new Error(`[@weapp-vite/web] strict 模式下表达式执行失败 \"${trimmed}\": ${reason}`)\n }\n if (mode === 'safe') {\n const reason = error instanceof Error ? error.message : String(error)\n warnRuntimeExecutionOnce(\n `safe-expression-runtime:${trimmed}`,\n `[@weapp-vite/web] safe 模式下忽略表达式执行错误 \"${trimmed}\": ${reason}`,\n )\n }\n return undefined\n }\n}\n\nfunction normalizeList(value: any): any[] {\n if (Array.isArray(value)) {\n return value\n }\n if (value == null) {\n return []\n }\n if (typeof value === 'number' && Number.isFinite(value)) {\n const length = Math.max(0, Math.floor(value))\n return Array.from({ length }, (_, index) => index)\n }\n if (typeof value === 'object') {\n return Object.values(value)\n }\n return []\n}\n\nfunction normalizeKey(rawKey: string, item: any, index: number, scope: TemplateScope): any {\n const key = rawKey?.trim()\n if (!key) {\n if (item != null && (typeof item === 'string' || typeof item === 'number' || typeof item === 'boolean')) {\n return item\n }\n return index\n }\n if (key === '*this') {\n return item\n }\n if (key.includes('{{') && key.includes('}}')) {\n const expr = key.replace(MUSTACHE_PREFIX_RE, '').replace(MUSTACHE_SUFFIX_RE, '')\n return evaluateExpression(expr, scope)\n }\n if (!SIMPLE_KEY_PATH_RE.test(key) && item && typeof item === 'object' && key in item) {\n return (item as Record<string, any>)[key]\n }\n return evaluateExpression(key, scope)\n}\n\nfunction createEventHandler(\n instance: ComponentPublicInstance,\n methods: Record<string, (event: any) => any>,\n eventName: string,\n handlerRef: string | ((event: any) => any),\n flags?: { catch?: boolean },\n) {\n const handler = typeof handlerRef === 'function'\n ? handlerRef\n : methods[handlerRef] ?? (instance as Record<string, any>)[handlerRef]\n if (typeof handler !== 'function') {\n return () => {}\n }\n return (nativeEvent: Event) => {\n if (flags?.catch) {\n nativeEvent.stopPropagation()\n }\n const target = nativeEvent.target as HTMLElement | null\n const currentTarget = nativeEvent.currentTarget as HTMLElement | null\n const dataset = currentTarget?.dataset ?? {}\n const syntheticEvent = {\n type: eventName,\n timeStamp: nativeEvent.timeStamp,\n detail: (nativeEvent as CustomEvent).detail ?? (nativeEvent as InputEvent).data ?? undefined,\n target: {\n dataset: target?.dataset ?? dataset,\n },\n currentTarget: {\n dataset,\n },\n originalEvent: nativeEvent,\n }\n handler.call(instance, syntheticEvent)\n }\n}\n\nfunction createWxsModule(code: string, id: string, requireMap?: Record<string, any>) {\n const module = { exports: {} as Record<string, any> }\n const exports = module.exports\n const getRegExp = (pattern: string, flags?: string) => new RegExp(pattern, flags)\n const getDate = (value?: string | number | Date) => (value == null ? new Date() : new Date(value))\n const require = (request: string) => requireMap?.[request]\n try {\n // eslint-disable-next-line no-new-func -- run in isolated module scope\n const runner = new Function('module', 'exports', 'require', 'getRegExp', 'getDate', code)\n runner(module, exports, require, getRegExp, getDate)\n }\n catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n const mode = getRuntimeExecutionMode()\n if (mode === 'safe') {\n warnRuntimeExecutionOnce(\n `safe-wxs-runtime:${id}`,\n `[@weapp-vite/web] safe 模式下忽略 WXS 执行错误: ${id} ${reason}`,\n )\n return {}\n }\n throw new Error(`[@weapp-vite/web] WXS 执行失败: ${id} ${reason}`)\n }\n return module.exports\n}\n\nexport function createRenderContext(\n instance: ComponentPublicInstance,\n methods: Record<string, (event: any) => any>,\n): RenderContext {\n const warnMissingTemplate = (name: string) => {\n emitRuntimeWarning(`[@weapp-vite/web] 未找到模板: ${name}`, {\n key: `template-missing:${name}`,\n context: 'runtime:template',\n })\n }\n\n return {\n instance,\n eval: (expression, scope, wxs) => {\n const baseScope = scope ?? createScope()\n const renderScope = wxs ? createChildScope(baseScope, wxs) : baseScope\n return evaluateExpression(expression, renderScope)\n },\n createScope: (parent, locals) => createChildScope(parent, locals),\n mergeScope: (parent, data) => {\n const baseScope = parent ?? createScope()\n if (!data || typeof data !== 'object') {\n return baseScope\n }\n return createChildScope(baseScope, data as Record<string, any>)\n },\n normalizeList,\n key: (rawKey, item, index, scope, wxs) => {\n const baseScope = scope ?? createScope()\n const renderScope = wxs ? createChildScope(baseScope, wxs) : baseScope\n return normalizeKey(rawKey, item, index, renderScope)\n },\n renderTemplate: (templates, name, scope, ctx) => {\n const resolvedName = typeof name === 'string' ? name : String(name)\n const template = templates?.[resolvedName]\n if (typeof template !== 'function') {\n warnMissingTemplate(resolvedName)\n return ''\n }\n return template(scope, ctx)\n },\n event: (eventName, handlerName, _scope, _wxs, flags) => {\n if (typeof handlerName === 'function') {\n return createEventHandler(instance, methods, eventName, handlerName, flags)\n }\n const resolvedHandler = String(handlerName ?? '')\n return createEventHandler(instance, methods, eventName, resolvedHandler, flags)\n },\n createWxsModule,\n }\n}\n\nexport { createChildScope, createScope, evaluateExpression }\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,kCAAkB,IAAI,IAA2C;AACvE,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAE3B,SAAS,YAAY,SAAwC;CAC3D,OAAO,OAAO,OAAO,OAAO,OAAO,IAAI,GAAG,WAAW,CAAC,CAAC;AACzD;AAEA,SAAS,iBAAiB,QAAuB,QAA6C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;GAClE,MAAM,WAAW,YAAY;GAC7B,IAAI,OAAO,aAAa,YAAY;IAClC,oBAAoB,YAAY;IAChC,OAAO;GACT;GACA,OAAO,SAAS,OAAO,GAAG;EAC5B;EACA,QAAQ,WAAW,aAAa,QAAQ,MAAM,UAAU;GACtD,IAAI,OAAO,gBAAgB,YACzB,OAAO,mBAAmB,UAAU,SAAS,WAAW,aAAa,KAAK;GAG5E,OAAO,mBAAmB,UAAU,SAAS,WADrB,OAAO,eAAe,EACwB,GAAG,KAAK;EAChF;EACA;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"renderContext.mjs","names":[],"sources":["../../src/runtime/renderContext.ts"],"sourcesContent":["import type { ComponentPublicInstance } from './component'\nimport type { TemplateScope } from './template'\nimport { getRuntimeExecutionMode, warnRuntimeExecutionOnce } from './execution'\nimport { emitRuntimeWarning } from './warning'\n\nexport interface RenderContext {\n instance: ComponentPublicInstance\n eval: (expression: string, scope: TemplateScope, wxs?: Record<string, any>) => any\n createScope: (parent: TemplateScope, locals?: Record<string, any>) => TemplateScope\n mergeScope: (parent: TemplateScope, data?: any) => TemplateScope\n normalizeList: (value: any) => any[]\n key: (rawKey: string, item: any, index: number, scope: TemplateScope, wxs?: Record<string, any>) => any\n renderTemplate: (templates: Record<string, any>, name: any, scope: TemplateScope, ctx: RenderContext) => any\n event: (eventName: string, handlerName: any, scope: TemplateScope, wxs?: Record<string, any>, flags?: { catch?: boolean, capture?: boolean }) => (event: Event) => void\n createWxsModule: (code: string, id: string, requireMap?: Record<string, any>) => Record<string, any>\n}\n\nconst expressionCache = new Map<string, (scope: TemplateScope) => any>()\nconst MUSTACHE_PREFIX_RE = /^\\{\\{\\s*/\nconst MUSTACHE_SUFFIX_RE = /\\s*\\}\\}$/\nconst SIMPLE_KEY_PATH_RE = /[.[()]/\n\nfunction createScope(initial?: TemplateScope): TemplateScope {\n return Object.assign(Object.create(null), initial ?? {})\n}\n\nfunction createChildScope(parent: TemplateScope, locals?: Record<string, any>): TemplateScope {\n return Object.assign(Object.create(parent), locals ?? {})\n}\n\nfunction evaluateExpression(expression: string, scope: TemplateScope): any {\n if (!expression) {\n return undefined\n }\n const trimmed = expression.trim()\n if (!trimmed) {\n return undefined\n }\n let evaluator = expressionCache.get(trimmed)\n if (!evaluator) {\n try {\n // eslint-disable-next-line no-new-func -- dynamic expressions are required for template evaluation\n evaluator = new Function('scope', `with(scope){ return (${trimmed}); }`) as (scope: TemplateScope) => any\n }\n catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n const mode = getRuntimeExecutionMode()\n if (mode === 'safe') {\n warnRuntimeExecutionOnce(\n `safe-expression-parse:${trimmed}`,\n `[@weapp-vite/web] safe 模式下忽略表达式解析错误 \"${trimmed}\": ${reason}`,\n )\n evaluator = () => undefined\n }\n else {\n throw new SyntaxError(`[@weapp-vite/web] 无法解析表达式 \"${trimmed}\": ${reason}`)\n }\n }\n if (evaluator) {\n expressionCache.set(trimmed, evaluator)\n }\n }\n try {\n return evaluator?.(scope)\n }\n catch (error) {\n const mode = getRuntimeExecutionMode()\n if (mode === 'strict') {\n const reason = error instanceof Error ? error.message : String(error)\n throw new Error(`[@weapp-vite/web] strict 模式下表达式执行失败 \"${trimmed}\": ${reason}`)\n }\n if (mode === 'safe') {\n const reason = error instanceof Error ? error.message : String(error)\n warnRuntimeExecutionOnce(\n `safe-expression-runtime:${trimmed}`,\n `[@weapp-vite/web] safe 模式下忽略表达式执行错误 \"${trimmed}\": ${reason}`,\n )\n }\n return undefined\n }\n}\n\nfunction normalizeList(value: any): any[] {\n if (Array.isArray(value)) {\n return value\n }\n if (value == null) {\n return []\n }\n if (typeof value === 'number' && Number.isFinite(value)) {\n const length = Math.max(0, Math.floor(value))\n return Array.from({ length }, (_, index) => index)\n }\n if (typeof value === 'object') {\n return Object.values(value)\n }\n return []\n}\n\nfunction normalizeKey(rawKey: string, item: any, index: number, scope: TemplateScope): any {\n const key = rawKey?.trim()\n if (!key) {\n if (item != null && (typeof item === 'string' || typeof item === 'number' || typeof item === 'boolean')) {\n return item\n }\n return index\n }\n if (key === '*this') {\n return item\n }\n if (key.includes('{{') && key.includes('}}')) {\n const expr = key.replace(MUSTACHE_PREFIX_RE, '').replace(MUSTACHE_SUFFIX_RE, '')\n return evaluateExpression(expr, scope)\n }\n if (!SIMPLE_KEY_PATH_RE.test(key) && item && typeof item === 'object' && key in item) {\n return (item as Record<string, any>)[key]\n }\n return evaluateExpression(key, scope)\n}\n\nfunction createEventHandler(\n instance: ComponentPublicInstance,\n methods: Record<string, (event: any) => any>,\n eventName: string,\n handlerRef: string | ((event: any) => any),\n flags?: { catch?: boolean },\n) {\n const handler = typeof handlerRef === 'function'\n ? handlerRef\n : methods[handlerRef] ?? (instance as Record<string, any>)[handlerRef]\n if (typeof handler !== 'function') {\n return () => {}\n }\n return (nativeEvent: Event) => {\n if (flags?.catch) {\n nativeEvent.stopPropagation()\n }\n const target = nativeEvent.target as HTMLElement | null\n const currentTarget = nativeEvent.currentTarget as HTMLElement | null\n const dataset = currentTarget?.dataset ?? {}\n const syntheticEvent = {\n type: eventName,\n timeStamp: nativeEvent.timeStamp,\n detail: (nativeEvent as CustomEvent).detail ?? (nativeEvent as InputEvent).data ?? undefined,\n target: {\n dataset: target?.dataset ?? dataset,\n },\n currentTarget: {\n dataset,\n },\n originalEvent: nativeEvent,\n }\n handler.call(instance, syntheticEvent)\n }\n}\n\nfunction createWxsModule(code: string, id: string, requireMap?: Record<string, any>) {\n const module = { exports: {} as Record<string, any> }\n const exports = module.exports\n const getRegExp = (pattern: string, flags?: string) => new RegExp(pattern, flags)\n const getDate = (value?: string | number | Date) => (value == null ? new Date() : new Date(value))\n const require = (request: string) => requireMap?.[request]\n try {\n // eslint-disable-next-line no-new-func -- run in isolated module scope\n const runner = new Function('module', 'exports', 'require', 'getRegExp', 'getDate', code)\n runner(module, exports, require, getRegExp, getDate)\n }\n catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n const mode = getRuntimeExecutionMode()\n if (mode === 'safe') {\n warnRuntimeExecutionOnce(\n `safe-wxs-runtime:${id}`,\n `[@weapp-vite/web] safe 模式下忽略 WXS 执行错误: ${id} ${reason}`,\n )\n return {}\n }\n throw new Error(`[@weapp-vite/web] WXS 执行失败: ${id} ${reason}`)\n }\n return module.exports\n}\n\nexport function createRenderContext(\n instance: ComponentPublicInstance,\n methods: Record<string, (event: any) => any>,\n): RenderContext {\n const warnMissingTemplate = (name: string) => {\n emitRuntimeWarning(`[@weapp-vite/web] 未找到模板: ${name}`, {\n key: `template-missing:${name}`,\n context: 'runtime:template',\n })\n }\n\n return {\n instance,\n eval: (expression, scope, wxs) => {\n const baseScope = scope ?? createScope()\n const renderScope = wxs ? createChildScope(baseScope, wxs) : baseScope\n return evaluateExpression(expression, renderScope)\n },\n createScope: (parent, locals) => createChildScope(parent, locals),\n mergeScope: (parent, data) => {\n const baseScope = parent ?? createScope()\n if (!data || typeof data !== 'object') {\n return baseScope\n }\n return createChildScope(baseScope, data as Record<string, any>)\n },\n normalizeList,\n key: (rawKey, item, index, scope, wxs) => {\n const baseScope = scope ?? createScope()\n const renderScope = wxs ? createChildScope(baseScope, wxs) : baseScope\n return normalizeKey(rawKey, item, index, renderScope)\n },\n renderTemplate: (templates, name, scope, ctx) => {\n const resolvedName = typeof name === 'string' ? name : String(name)\n const template = templates?.[resolvedName]\n if (typeof template !== 'function') {\n warnMissingTemplate(resolvedName)\n return ''\n }\n return template(scope, ctx)\n },\n event: (eventName, handlerName, _scope, _wxs, flags) => {\n if (typeof handlerName === 'function') {\n return createEventHandler(instance, methods, eventName, handlerName, flags)\n }\n const resolvedHandler = String(handlerName ?? '')\n return createEventHandler(instance, methods, eventName, resolvedHandler, flags)\n },\n createWxsModule,\n }\n}\n\nexport { createChildScope, createScope, evaluateExpression }\n"],"mappings":";;;;AAiBA,MAAM,kCAAkB,IAAI,IAA2C;AACvE,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAE3B,SAAS,YAAY,SA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G,IAAI,SACT;EACtD;EACA,iBAAiB,WAAW,MAAM,OAAO,QAAQ;GAC/C,MAAM,eAAe,OAAO,SAAS,WAAW,OAAO,OAAO,IAAI;GAClE,MAAM,WAAW,YAAY;GAC7B,IAAI,OAAO,aAAa,YAAY;IAClC,oBAAoB,YAAY;IAChC,OAAO;GACT;GACA,OAAO,SAAS,OAAO,GAAG;EAC5B;EACA,QAAQ,WAAW,aAAa,QAAQ,MAAM,UAAU;GACtD,IAAI,OAAO,gBAAgB,YACzB,OAAO,mBAAmB,UAAU,SAAS,WAAW,aAAa,KAAK;GAG5E,OAAO,mBAAmB,UAAU,SAAS,WADrB,OAAO,eAAe,EACwB,GAAG,KAAK;EAChF;EACA;CACF;AACF"}
|
package/dist/runtime/rpx.d.mts
CHANGED
package/dist/runtime/rpx.mjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
//#region src/runtime/rpx.ts
|
|
10
2
|
const DEFAULT_DESIGN_WIDTH = 750;
|
|
11
3
|
const DEFAULT_VAR_NAME = "--rpx";
|
package/dist/runtime/rpx.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpx.mjs","names":[],"sources":["../../src/runtime/rpx.ts"],"sourcesContent":["export interface RpxConfig {\n designWidth?: number\n varName?: string\n}\n\nconst DEFAULT_DESIGN_WIDTH = 750\nconst DEFAULT_VAR_NAME = '--rpx'\nlet initialized = false\n\nfunction computeRpx(designWidth: number) {\n if (typeof window === 'undefined') {\n return 0\n }\n const width = document.documentElement?.clientWidth ?? window.innerWidth\n return width / designWidth\n}\n\nexport function setupRpx(config?: RpxConfig) {\n if (typeof document === 'undefined') {\n return\n }\n const designWidth = config?.designWidth ?? DEFAULT_DESIGN_WIDTH\n const varName = config?.varName ?? DEFAULT_VAR_NAME\n const root = document.documentElement\n const apply = () => {\n const value = computeRpx(designWidth)\n root.style.setProperty(varName, `${value}px`)\n }\n apply()\n if (!initialized) {\n initialized = true\n window.addEventListener('resize', apply)\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rpx.mjs","names":[],"sources":["../../src/runtime/rpx.ts"],"sourcesContent":["export interface RpxConfig {\n designWidth?: number\n varName?: string\n}\n\nconst DEFAULT_DESIGN_WIDTH = 750\nconst DEFAULT_VAR_NAME = '--rpx'\nlet initialized = false\n\nfunction computeRpx(designWidth: number) {\n if (typeof window === 'undefined') {\n return 0\n }\n const width = document.documentElement?.clientWidth ?? window.innerWidth\n return width / designWidth\n}\n\nexport function setupRpx(config?: RpxConfig) {\n if (typeof document === 'undefined') {\n return\n }\n const designWidth = config?.designWidth ?? DEFAULT_DESIGN_WIDTH\n const varName = config?.varName ?? DEFAULT_VAR_NAME\n const root = document.documentElement\n const apply = () => {\n const value = computeRpx(designWidth)\n root.style.setProperty(varName, `${value}px`)\n }\n apply()\n if (!initialized) {\n initialized = true\n window.addEventListener('resize', apply)\n }\n}\n"],"mappings":";AAKA,MAAM,uBAAuB;AAC7B,MAAM,mBAAmB;AACzB,IAAI,cAAc;AAElB,SAAS,WAAW,aAAqB;CACvC,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,QADc,SAAS,iBAAiB,eAAe,OAAO,cAC/C;AACjB;AAEA,SAAgB,SAAS,QAAoB;CAC3C,IAAI,OAAO,aAAa,aACtB;CAEF,MAAM,cAAc,QAAQ,eAAe;CAC3C,MAAM,UAAU,QAAQ,WAAW;CACnC,MAAM,OAAO,SAAS;CACtB,MAAM,cAAc;EAClB,MAAM,QAAQ,WAAW,WAAW;EACpC,KAAK,MAAM,YAAY,SAAS,GAAG,MAAM,GAAG;CAC9C;CACA,MAAM;CACN,IAAI,CAAC,aAAa;EAChB,cAAc;EACd,OAAO,iBAAiB,UAAU,KAAK;CACzC;AACF"}
|
package/dist/runtime/style.d.mts
CHANGED
package/dist/runtime/style.mjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
//#region src/runtime/style.ts
|
|
10
2
|
const injected = /* @__PURE__ */ new Map();
|
|
11
3
|
function createStyleId(css) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.mjs","names":[],"sources":["../../src/runtime/style.ts"],"sourcesContent":["const injected = new Map<string, HTMLStyleElement>()\n\nfunction createStyleId(css: string) {\n let hash = 2166136261\n for (let i = 0; i < css.length; i++) {\n hash ^= css.charCodeAt(i)\n hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24)\n }\n return `weapp-web-style-${(hash >>> 0).toString(36)}`\n}\n\nexport function removeStyle(id: string) {\n if (typeof document === 'undefined') {\n return\n }\n const style = injected.get(id)\n if (style) {\n style.remove()\n injected.delete(id)\n }\n}\n\nexport function injectStyle(css: string, id?: string) {\n if (typeof document === 'undefined') {\n return () => {}\n }\n const styleId = id ?? createStyleId(css)\n const existing = injected.get(styleId)\n if (existing) {\n existing.textContent = css\n return () => removeStyle(styleId)\n }\n const style = document.createElement('style')\n style.id = styleId\n style.textContent = css\n document.head.append(style)\n injected.set(styleId, style)\n return () => removeStyle(styleId)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"style.mjs","names":[],"sources":["../../src/runtime/style.ts"],"sourcesContent":["const injected = new Map<string, HTMLStyleElement>()\n\nfunction createStyleId(css: string) {\n let hash = 2166136261\n for (let i = 0; i < css.length; i++) {\n hash ^= css.charCodeAt(i)\n hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24)\n }\n return `weapp-web-style-${(hash >>> 0).toString(36)}`\n}\n\nexport function removeStyle(id: string) {\n if (typeof document === 'undefined') {\n return\n }\n const style = injected.get(id)\n if (style) {\n style.remove()\n injected.delete(id)\n }\n}\n\nexport function injectStyle(css: string, id?: string) {\n if (typeof document === 'undefined') {\n return () => {}\n }\n const styleId = id ?? createStyleId(css)\n const existing = injected.get(styleId)\n if (existing) {\n existing.textContent = css\n return () => removeStyle(styleId)\n }\n const style = document.createElement('style')\n style.id = styleId\n style.textContent = css\n document.head.append(style)\n injected.set(styleId, style)\n return () => removeStyle(styleId)\n}\n"],"mappings":";AAAA,MAAM,2BAAW,IAAI,IAA8B;AAEnD,SAAS,cAAc,KAAa;CAClC,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;EACnC,QAAQ,IAAI,WAAW,CAAC;EACxB,SAAS,QAAQ,MAAM,QAAQ,MAAM,QAAQ,MAAM,QAAQ,MAAM,QAAQ;CAC3E;CACA,OAAO,oBAAoB,SAAS,GAAG,SAAS,EAAE;AACpD;AAEA,SAAgB,YAAY,IAAY;CACtC,IAAI,OAAO,aAAa,aACtB;CAEF,MAAM,QAAQ,SAAS,IAAI,EAAE;CAC7B,IAAI,OAAO;EACT,MAAM,OAAO;EACb,SAAS,OAAO,EAAE;CACpB;AACF;AAEA,SAAgB,YAAY,KAAa,IAAa;CACpD,IAAI,OAAO,aAAa,aACtB,aAAa,CAAC;CAEhB,MAAM,UAAU,MAAM,cAAc,GAAG;CACvC,MAAM,WAAW,SAAS,IAAI,OAAO;CACrC,IAAI,UAAU;EACZ,SAAS,cAAc;EACvB,aAAa,YAAY,OAAO;CAClC;CACA,MAAM,QAAQ,SAAS,cAAc,OAAO;CAC5C,MAAM,KAAK;CACX,MAAM,cAAc;CACpB,SAAS,KAAK,OAAO,KAAK;CAC1B,SAAS,IAAI,SAAS,KAAK;CAC3B,aAAa,YAAY,OAAO;AAClC"}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
//#region src/runtime/utils/object.ts
|
|
10
2
|
function hasOwn(source, key) {
|
|
11
3
|
return Object.prototype.hasOwnProperty.call(source, key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.mjs","names":[],"sources":["../../../src/runtime/utils/object.ts"],"sourcesContent":["export function hasOwn(source: object, key: PropertyKey) {\n return Object.prototype.hasOwnProperty.call(source, key)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"object.mjs","names":[],"sources":["../../../src/runtime/utils/object.ts"],"sourcesContent":["export function hasOwn(source: object, key: PropertyKey) {\n return Object.prototype.hasOwnProperty.call(source, key)\n}\n"],"mappings":";AAAA,SAAgB,OAAO,QAAgB,KAAkB;CACvD,OAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,GAAG;AACzD"}
|
package/dist/runtime/warning.mjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
//#region src/runtime/warning.ts
|
|
10
2
|
const defaultWarningOptions = {
|
|
11
3
|
level: "warn",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warning.mjs","names":[],"sources":["../../src/runtime/warning.ts"],"sourcesContent":["export type RuntimeWarningLevel = 'off' | 'warn' | 'error'\n\nexport interface RuntimeWarningOptions {\n level?: RuntimeWarningLevel\n dedupe?: boolean\n}\n\ninterface RuntimeWarningEmitOptions {\n key?: string\n context?: string\n level?: RuntimeWarningLevel\n}\n\nconst defaultWarningOptions: Required<RuntimeWarningOptions> = {\n level: 'warn',\n dedupe: true,\n}\n\nlet runtimeWarningOptions: Required<RuntimeWarningOptions> = {\n ...defaultWarningOptions,\n}\n\nconst warnedKeys = new Set<string>()\n\nfunction withContext(message: string, context?: string): string {\n if (!context) {\n return message\n }\n if (message.startsWith('[@weapp-vite/web]')) {\n return message.replace('[@weapp-vite/web]', `[@weapp-vite/web][${context}]`)\n }\n return `[@weapp-vite/web][${context}] ${message}`\n}\n\nfunction getConsole(): Console | undefined {\n return (globalThis as { console?: Console }).console\n}\n\nexport function setRuntimeWarningOptions(options?: RuntimeWarningOptions): void {\n runtimeWarningOptions = {\n ...defaultWarningOptions,\n ...(options ?? {}),\n }\n warnedKeys.clear()\n}\n\nexport function emitRuntimeWarning(message: string, options: RuntimeWarningEmitOptions = {}): void {\n const level = options.level ?? runtimeWarningOptions.level\n if (level === 'off') {\n return\n }\n\n const key = options.key\n if (runtimeWarningOptions.dedupe && key) {\n if (warnedKeys.has(key)) {\n return\n }\n warnedKeys.add(key)\n }\n\n const logger = getConsole()\n if (!logger) {\n return\n }\n const normalized = withContext(message, options.context)\n if (level === 'error' && typeof logger.error === 'function') {\n logger.error(normalized)\n return\n }\n if (typeof logger.warn === 'function') {\n logger.warn(normalized)\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"warning.mjs","names":[],"sources":["../../src/runtime/warning.ts"],"sourcesContent":["export type RuntimeWarningLevel = 'off' | 'warn' | 'error'\n\nexport interface RuntimeWarningOptions {\n level?: RuntimeWarningLevel\n dedupe?: boolean\n}\n\ninterface RuntimeWarningEmitOptions {\n key?: string\n context?: string\n level?: RuntimeWarningLevel\n}\n\nconst defaultWarningOptions: Required<RuntimeWarningOptions> = {\n level: 'warn',\n dedupe: true,\n}\n\nlet runtimeWarningOptions: Required<RuntimeWarningOptions> = {\n ...defaultWarningOptions,\n}\n\nconst warnedKeys = new Set<string>()\n\nfunction withContext(message: string, context?: string): string {\n if (!context) {\n return message\n }\n if (message.startsWith('[@weapp-vite/web]')) {\n return message.replace('[@weapp-vite/web]', `[@weapp-vite/web][${context}]`)\n }\n return `[@weapp-vite/web][${context}] ${message}`\n}\n\nfunction getConsole(): Console | undefined {\n return (globalThis as { console?: Console }).console\n}\n\nexport function setRuntimeWarningOptions(options?: RuntimeWarningOptions): void {\n runtimeWarningOptions = {\n ...defaultWarningOptions,\n ...(options ?? {}),\n }\n warnedKeys.clear()\n}\n\nexport function emitRuntimeWarning(message: string, options: RuntimeWarningEmitOptions = {}): void {\n const level = options.level ?? runtimeWarningOptions.level\n if (level === 'off') {\n return\n }\n\n const key = options.key\n if (runtimeWarningOptions.dedupe && key) {\n if (warnedKeys.has(key)) {\n return\n }\n warnedKeys.add(key)\n }\n\n const logger = getConsole()\n if (!logger) {\n return\n }\n const normalized = withContext(message, options.context)\n if (level === 'error' && typeof logger.error === 'function') {\n logger.error(normalized)\n return\n }\n if (typeof logger.warn === 'function') {\n logger.warn(normalized)\n }\n}\n"],"mappings":";AAaA,MAAM,wBAAyD;CAC7D,OAAO;CACP,QAAQ;AACV;AAEA,IAAI,wBAAyD,EAC3D,GAAG,sBACL;AAEA,MAAM,6BAAa,IAAI,IAAY;AAEnC,SAAS,YAAY,SAAiB,SAA0B;CAC9D,IAAI,CAAC,SACH,OAAO;CAET,IAAI,QAAQ,WAAW,mBAAmB,GACxC,OAAO,QAAQ,QAAQ,qBAAqB,qBAAqB,QAAQ,EAAE;CAE7E,OAAO,qBAAqB,QAAQ,IAAI;AAC1C;AAEA,SAAS,aAAkC;CACzC,OAAQ,WAAqC;AAC/C;AAEA,SAAgB,yBAAyB,SAAuC;CAC9E,wBAAwB;EACtB,GAAG;EACH,GAAI,WAAW,CAAC;CAClB;CACA,WAAW,MAAM;AACnB;AAEA,SAAgB,mBAAmB,SAAiB,UAAqC,CAAC,GAAS;CACjG,MAAM,QAAQ,QAAQ,SAAS,sBAAsB;CACrD,IAAI,UAAU,OACZ;CAGF,MAAM,MAAM,QAAQ;CACpB,IAAI,sBAAsB,UAAU,KAAK;EACvC,IAAI,WAAW,IAAI,GAAG,GACpB;EAEF,WAAW,IAAI,GAAG;CACpB;CAEA,MAAM,SAAS,WAAW;CAC1B,IAAI,CAAC,QACH;CAEF,MAAM,aAAa,YAAY,SAAS,QAAQ,OAAO;CACvD,IAAI,UAAU,WAAW,OAAO,OAAO,UAAU,YAAY;EAC3D,OAAO,MAAM,UAAU;EACvB;CACF;CACA,IAAI,OAAO,OAAO,SAAS,YACzB,OAAO,KAAK,UAAU;AAE1B"}
|
package/dist/shared/slugify.mjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
//#region src/shared/slugify.ts
|
|
10
2
|
function slugify(id, prefix) {
|
|
11
3
|
return `${prefix}-${id.replace(/[^a-z0-9]+/gi, "-").replace(/^-+|-+$/g, "").toLowerCase() || "index"}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slugify.mjs","names":[],"sources":["../../src/shared/slugify.ts"],"sourcesContent":["export function slugify(id: string, prefix: string) {\n const normalized = id.replace(/[^a-z0-9]+/gi, '-').replace(/^-+|-+$/g, '').toLowerCase()\n return `${prefix}-${normalized || 'index'}`\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"slugify.mjs","names":[],"sources":["../../src/shared/slugify.ts"],"sourcesContent":["export function slugify(id: string, prefix: string) {\n const normalized = id.replace(/[^a-z0-9]+/gi, '-').replace(/^-+|-+$/g, '').toLowerCase()\n return `${prefix}-${normalized || 'index'}`\n}\n"],"mappings":";AAAA,SAAgB,QAAQ,IAAY,QAAgB;CAElD,OAAO,GAAG,OAAO,GADE,GAAG,QAAQ,gBAAgB,GAAG,EAAE,QAAQ,YAAY,EAAE,EAAE,YAC9C,KAAK;AACpC"}
|
package/dist/shared/wxml.mjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
import { getMiniProgramDirectivePrefix, getSupportedMiniProgramPlatforms } from "@weapp-core/shared";
|
|
10
2
|
|
|
11
3
|
//#region src/shared/wxml.ts
|
package/dist/shared/wxml.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wxml.mjs","names":[],"sources":["../../src/shared/wxml.ts"],"sourcesContent":["import { getMiniProgramDirectivePrefix, getSupportedMiniProgramPlatforms } from '@weapp-core/shared'\n\nconst CONTROL_ATTR_SUFFIXES = [\n 'if',\n 'elif',\n 'else',\n 'for',\n 'for-item',\n 'for-index',\n 'key',\n] as const\n\nexport type ControlAttrSuffix = typeof CONTROL_ATTR_SUFFIXES[number]\n\nexport const CONTROL_ATTR_PREFIXES = Array.from(new Set(\n getSupportedMiniProgramPlatforms().map(platform => getMiniProgramDirectivePrefix(platform)),\n))\n\nexport const TEMPLATE_IMPORT_TAG_NAMES = Array.from(new Set([\n 'import',\n ...CONTROL_ATTR_PREFIXES.map(prefix => `${prefix}-import`),\n]))\n\nexport const TEMPLATE_INCLUDE_TAG_NAMES = Array.from(new Set([\n 'include',\n ...CONTROL_ATTR_PREFIXES.map(prefix => `${prefix}-include`),\n]))\n\nexport const CONTROL_ATTRS = new Set([\n ...CONTROL_ATTR_PREFIXES.flatMap(prefix => CONTROL_ATTR_SUFFIXES.map(suffix => `${prefix}:${suffix}`)),\n])\n\nexport const EVENT_PREFIX_RE = /^(?:bind|catch|mut-bind|capture-bind|capture-catch)([\\w-]+)$/\nexport const EVENT_KIND_ALIAS: Record<string, string> = {\n tap: 'click',\n}\n\nexport const SELF_CLOSING_TAGS = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'image',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n])\n\nexport function resolveControlAttributeName(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): string | undefined {\n for (const prefix of CONTROL_ATTR_PREFIXES) {\n const name = `${prefix}:${suffix}`\n if (name in attribs) {\n return name\n }\n }\n return undefined\n}\n\nexport function resolveControlAttributeValue(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): string | undefined {\n const name = resolveControlAttributeName(attribs, suffix)\n return name ? attribs[name] : undefined\n}\n\nexport function hasControlAttribute(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): boolean {\n return resolveControlAttributeName(attribs, suffix) !== undefined\n}\n\nexport function normalizeTagName(name: string) {\n switch (name) {\n case 'view':\n case 'cover-view':\n case 'navigator':\n case 'scroll-view':\n case 'swiper':\n case 'swiper-item':\n case 'movable-area':\n case 'movable-view':\n case 'cover-image':\n return 'div'\n case 'text':\n case 'icon':\n return 'span'\n case 'image':\n return 'img'\n case 'button':\n return 'weapp-button'\n case 'input':\n return 'input'\n case 'textarea':\n return 'textarea'\n case 'form':\n return 'form'\n case 'label':\n return 'label'\n case 'picker':\n case 'picker-view':\n return 'select'\n case 'block':\n return '#fragment'\n case 'slot':\n return 'slot'\n default:\n return name || 'div'\n }\n}\n\nexport function normalizeAttributeName(name: string) {\n if (name === 'class' || name === 'style' || name.startsWith('data-')) {\n return name\n }\n if (name === 'hover-class') {\n return 'data-hover-class'\n }\n return name.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"wxml.mjs","names":[],"sources":["../../src/shared/wxml.ts"],"sourcesContent":["import { getMiniProgramDirectivePrefix, getSupportedMiniProgramPlatforms } from '@weapp-core/shared'\n\nconst CONTROL_ATTR_SUFFIXES = [\n 'if',\n 'elif',\n 'else',\n 'for',\n 'for-item',\n 'for-index',\n 'key',\n] as const\n\nexport type ControlAttrSuffix = typeof CONTROL_ATTR_SUFFIXES[number]\n\nexport const CONTROL_ATTR_PREFIXES = Array.from(new Set(\n getSupportedMiniProgramPlatforms().map(platform => getMiniProgramDirectivePrefix(platform)),\n))\n\nexport const TEMPLATE_IMPORT_TAG_NAMES = Array.from(new Set([\n 'import',\n ...CONTROL_ATTR_PREFIXES.map(prefix => `${prefix}-import`),\n]))\n\nexport const TEMPLATE_INCLUDE_TAG_NAMES = Array.from(new Set([\n 'include',\n ...CONTROL_ATTR_PREFIXES.map(prefix => `${prefix}-include`),\n]))\n\nexport const CONTROL_ATTRS = new Set([\n ...CONTROL_ATTR_PREFIXES.flatMap(prefix => CONTROL_ATTR_SUFFIXES.map(suffix => `${prefix}:${suffix}`)),\n])\n\nexport const EVENT_PREFIX_RE = /^(?:bind|catch|mut-bind|capture-bind|capture-catch)([\\w-]+)$/\nexport const EVENT_KIND_ALIAS: Record<string, string> = {\n tap: 'click',\n}\n\nexport const SELF_CLOSING_TAGS = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'image',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n])\n\nexport function resolveControlAttributeName(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): string | undefined {\n for (const prefix of CONTROL_ATTR_PREFIXES) {\n const name = `${prefix}:${suffix}`\n if (name in attribs) {\n return name\n }\n }\n return undefined\n}\n\nexport function resolveControlAttributeValue(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): string | undefined {\n const name = resolveControlAttributeName(attribs, suffix)\n return name ? attribs[name] : undefined\n}\n\nexport function hasControlAttribute(\n attribs: Record<string, string>,\n suffix: ControlAttrSuffix,\n): boolean {\n return resolveControlAttributeName(attribs, suffix) !== undefined\n}\n\nexport function normalizeTagName(name: string) {\n switch (name) {\n case 'view':\n case 'cover-view':\n case 'navigator':\n case 'scroll-view':\n case 'swiper':\n case 'swiper-item':\n case 'movable-area':\n case 'movable-view':\n case 'cover-image':\n return 'div'\n case 'text':\n case 'icon':\n return 'span'\n case 'image':\n return 'img'\n case 'button':\n return 'weapp-button'\n case 'input':\n return 'input'\n case 'textarea':\n return 'textarea'\n case 'form':\n return 'form'\n case 'label':\n return 'label'\n case 'picker':\n case 'picker-view':\n return 'select'\n case 'block':\n return '#fragment'\n case 'slot':\n return 'slot'\n default:\n return name || 'div'\n }\n}\n\nexport function normalizeAttributeName(name: string) {\n if (name === 'class' || name === 'style' || name.startsWith('data-')) {\n return name\n }\n if (name === 'hover-class') {\n return 'data-hover-class'\n }\n return name.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)\n}\n"],"mappings":";;;AAEA,MAAM,wBAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAIA,MAAa,wBAAwB,MAAM,KAAK,IAAI,IAClD,iCAAiC,EAAE,KAAI,aAAY,8BAA8B,QAAQ,CAAC,CAC5F,CAAC;AAED,MAAa,4BAA4B,MAAM,KAAK,IAAI,IAAI,CAC1D,UACA,GAAG,sBAAsB,KAAI,WAAU,GAAG,OAAO,QAAQ,CAC3D,CAAC,CAAC;AAEF,MAAa,6BAA6B,MAAM,KAAK,IAAI,IAAI,CAC3D,WACA,GAAG,sBAAsB,KAAI,WAAU,GAAG,OAAO,SAAS,CAC5D,CAAC,CAAC;AAEF,MAAa,gBAAgB,IAAI,IAAI,CACnC,GAAG,sBAAsB,SAAQ,WAAU,sBAAsB,KAAI,WAAU,GAAG,OAAO,GAAG,QAAQ,CAAC,CACvG,CAAC;AAED,MAAa,kBAAkB;AAC/B,MAAa,mBAA2C,EACtD,KAAK,QACP;AAEA,MAAa,oBAAoB,IAAI,IAAI;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAgB,4BACd,SACA,QACoB;CACpB,KAAK,MAAM,UAAU,uBAAuB;EAC1C,MAAM,OAAO,GAAG,OAAO,GAAG;EAC1B,IAAI,QAAQ,SACV,OAAO;CAEX;AAEF;AAEA,SAAgB,6BACd,SACA,QACoB;CACpB,MAAM,OAAO,4BAA4B,SAAS,MAAM;CACxD,OAAO,OAAO,QAAQ,QAAQ;AAChC;AAEA,SAAgB,oBACd,SACA,QACS;CACT,OAAO,4BAA4B,SAAS,MAAM,MAAM;AAC1D;AAEA,SAAgB,iBAAiB,MAAc;CAC7C,QAAQ,MAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,eACH,OAAO;EACT,KAAK;EACL,KAAK,QACH,OAAO;EACT,KAAK,SACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,KAAK,SACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,KAAK,QACH,OAAO;EACT,KAAK,SACH,OAAO;EACT,KAAK;EACL,KAAK,eACH,OAAO;EACT,KAAK,SACH,OAAO;EACT,KAAK,QACH,OAAO;EACT,SACE,OAAO,QAAQ;CACnB;AACF;AAEA,SAAgB,uBAAuB,MAAc;CACnD,IAAI,SAAS,WAAW,SAAS,WAAW,KAAK,WAAW,OAAO,GACjE,OAAO;CAET,IAAI,SAAS,eACX,OAAO;CAET,OAAO,KAAK,QAAQ,WAAU,UAAS,IAAI,MAAM,YAAY,GAAG;AAClE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-vite/web",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.30",
|
|
5
5
|
"description": "Experimental web runtime for weapp-vite templates",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
"lit": "^3.3.3",
|
|
57
57
|
"magic-string": "^0.30.21",
|
|
58
58
|
"pathe": "^2.0.3",
|
|
59
|
-
"
|
|
59
|
+
"rolldown": "1.0.3",
|
|
60
|
+
"@weapp-core/constants": "0.1.12",
|
|
60
61
|
"@weapp-core/shared": "3.0.4",
|
|
61
62
|
"rolldown-require": "2.0.18"
|
|
62
63
|
},
|