@weapp-vite/web 1.3.37 → 1.4.1
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/README.md +144 -5
- package/dist/_virtual/_rolldown/runtime.mjs +19 -1
- package/dist/compiler/wxml/attributes.mjs +1 -1
- package/dist/compiler/wxml/attributes.mjs.map +1 -1
- package/dist/compiler/wxml/compile.mjs +6 -3
- package/dist/compiler/wxml/compile.mjs.map +1 -1
- package/dist/compiler/wxml/interpolation.mjs +1 -2
- package/dist/compiler/wxml/interpolation.mjs.map +1 -1
- package/dist/compiler/wxml/navigation.mjs +5 -7
- package/dist/compiler/wxml/navigation.mjs.map +1 -1
- package/dist/compiler/wxml/parser.mjs +5 -5
- package/dist/compiler/wxml/parser.mjs.map +1 -1
- package/dist/compiler/wxml/renderer.mjs +16 -12
- package/dist/compiler/wxml/renderer.mjs.map +1 -1
- package/dist/compiler/wxml/specialNodes.mjs +8 -2
- package/dist/compiler/wxml/specialNodes.mjs.map +1 -1
- package/dist/compiler/wxml/types.d.mts +12 -0
- package/dist/compiler/wxs.mjs +5 -5
- package/dist/compiler/wxs.mjs.map +1 -1
- package/dist/css/wxss.d.mts +1 -0
- package/dist/css/wxss.mjs +110 -9
- package/dist/css/wxss.mjs.map +1 -1
- package/dist/index.d.mts +24 -6
- package/dist/index.mjs +21 -4
- package/dist/plugin/assets.d.mts +7 -0
- package/dist/plugin/assets.mjs +122 -0
- package/dist/plugin/assets.mjs.map +1 -0
- package/dist/plugin/constants.mjs +10 -1
- package/dist/plugin/constants.mjs.map +1 -1
- package/dist/plugin/dependencyScan.mjs +41 -0
- package/dist/plugin/dependencyScan.mjs.map +1 -0
- package/dist/plugin/entry.mjs +55 -6
- package/dist/plugin/entry.mjs.map +1 -1
- package/dist/plugin/files.mjs +1 -1
- package/dist/plugin/files.mjs.map +1 -1
- package/dist/plugin/index.d.mts +37 -3
- package/dist/plugin/index.mjs +244 -73
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/plugin/layout.mjs +24 -0
- package/dist/plugin/layout.mjs.map +1 -0
- package/dist/plugin/path.mjs +6 -2
- package/dist/plugin/path.mjs.map +1 -1
- package/dist/plugin/register.mjs +45 -33
- package/dist/plugin/register.mjs.map +1 -1
- package/dist/plugin/scan.mjs +211 -92
- package/dist/plugin/scan.mjs.map +1 -1
- package/dist/plugin/scanSfc.mjs +65 -0
- package/dist/plugin/scanSfc.mjs.map +1 -0
- package/dist/plugin/state.mjs +3 -2
- package/dist/plugin/state.mjs.map +1 -1
- package/dist/plugin/styleModule.mjs +52 -0
- package/dist/plugin/styleModule.mjs.map +1 -0
- package/dist/plugin/types.d.mts +37 -1
- package/dist/plugin/vueSfc.mjs +150 -0
- package/dist/plugin/vueSfc.mjs.map +1 -0
- package/dist/runtime/appShell/container.mjs +25 -0
- package/dist/runtime/appShell/container.mjs.map +1 -0
- package/dist/runtime/appShell/tabBar/index.mjs +192 -0
- package/dist/runtime/appShell/tabBar/index.mjs.map +1 -0
- package/dist/runtime/appShell/tabBar/style.mjs +127 -0
- package/dist/runtime/appShell/tabBar/style.mjs.map +1 -0
- package/dist/runtime/button/helpers.mjs +1 -58
- package/dist/runtime/button/helpers.mjs.map +1 -1
- package/dist/runtime/button/index.d.mts +4 -5
- package/dist/runtime/button/index.mjs +6 -28
- package/dist/runtime/button/index.mjs.map +1 -1
- package/dist/runtime/button/style.mjs +53 -28
- package/dist/runtime/button/style.mjs.map +1 -1
- package/dist/runtime/component/behavior.mjs +26 -2
- package/dist/runtime/component/behavior.mjs.map +1 -1
- package/dist/runtime/component/element.mjs +107 -31
- package/dist/runtime/component/element.mjs.map +1 -1
- package/dist/runtime/component/observers.mjs +36 -0
- package/dist/runtime/component/observers.mjs.map +1 -0
- package/dist/runtime/component/publicInstance.mjs +48 -0
- package/dist/runtime/component/publicInstance.mjs.map +1 -0
- package/dist/runtime/component/relations.mjs +36 -0
- package/dist/runtime/component/relations.mjs.map +1 -0
- package/dist/runtime/component/slots.mjs +24 -0
- package/dist/runtime/component/slots.mjs.map +1 -0
- package/dist/runtime/component/state.mjs +13 -3
- package/dist/runtime/component/state.mjs.map +1 -1
- package/dist/runtime/component/types.d.mts +29 -4
- package/dist/runtime/component/virtualHost.mjs +83 -0
- package/dist/runtime/component/virtualHost.mjs.map +1 -0
- package/dist/runtime/host/index.d.mts +13 -0
- package/dist/runtime/host/index.mjs +47 -0
- package/dist/runtime/host/index.mjs.map +1 -0
- package/dist/runtime/host/types.d.mts +28 -0
- package/dist/runtime/hostGlobals.d.mts +9 -0
- package/dist/runtime/hostGlobals.mjs +39 -0
- package/dist/runtime/hostGlobals.mjs.map +1 -0
- package/dist/runtime/index.d.mts +21 -3
- package/dist/runtime/index.mjs +26 -4
- package/dist/runtime/index.mjs.map +1 -0
- package/dist/runtime/legacyTemplate/dom.mjs +3 -3
- package/dist/runtime/legacyTemplate/dom.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/expression.mjs +9 -9
- package/dist/runtime/legacyTemplate/expression.mjs.map +1 -1
- package/dist/runtime/legacyTemplate/index.mjs +6 -6
- package/dist/runtime/legacyTemplate/index.mjs.map +1 -1
- package/dist/runtime/nativeComponents/canvas/index.mjs +53 -0
- package/dist/runtime/nativeComponents/canvas/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/checkbox.mjs +137 -0
- package/dist/runtime/nativeComponents/checkbox.mjs.map +1 -0
- package/dist/runtime/nativeComponents/cover/index.mjs +23 -0
- package/dist/runtime/nativeComponents/cover/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/form.d.mts +7 -0
- package/dist/runtime/nativeComponents/form.mjs +50 -0
- package/dist/runtime/nativeComponents/form.mjs.map +1 -0
- package/dist/runtime/nativeComponents/formControl.mjs +61 -0
- package/dist/runtime/nativeComponents/formControl.mjs.map +1 -0
- package/dist/runtime/nativeComponents/helpers.mjs +25 -0
- package/dist/runtime/nativeComponents/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/icon/helpers.mjs +42 -0
- package/dist/runtime/nativeComponents/icon/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/icon/index.mjs +45 -0
- package/dist/runtime/nativeComponents/icon/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/icon/style.mjs +176 -0
- package/dist/runtime/nativeComponents/icon/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/image.d.mts +8 -0
- package/dist/runtime/nativeComponents/image.mjs +121 -0
- package/dist/runtime/nativeComponents/image.mjs.map +1 -0
- package/dist/runtime/nativeComponents/index.d.mts +11 -0
- package/dist/runtime/nativeComponents/index.mjs +83 -0
- package/dist/runtime/nativeComponents/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/input.d.mts +8 -0
- package/dist/runtime/nativeComponents/input.mjs +131 -0
- package/dist/runtime/nativeComponents/input.mjs.map +1 -0
- package/dist/runtime/nativeComponents/label.mjs +36 -0
- package/dist/runtime/nativeComponents/label.mjs.map +1 -0
- package/dist/runtime/nativeComponents/mediaRegistry.mjs +47 -0
- package/dist/runtime/nativeComponents/mediaRegistry.mjs.map +1 -0
- package/dist/runtime/nativeComponents/movable/helpers.mjs +23 -0
- package/dist/runtime/nativeComponents/movable/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/movable/index.mjs +117 -0
- package/dist/runtime/nativeComponents/movable/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/navigator.mjs +200 -0
- package/dist/runtime/nativeComponents/navigator.mjs.map +1 -0
- package/dist/runtime/nativeComponents/picker/editors.mjs +74 -0
- package/dist/runtime/nativeComponents/picker/editors.mjs.map +1 -0
- package/dist/runtime/nativeComponents/picker/helpers.mjs +57 -0
- package/dist/runtime/nativeComponents/picker/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/picker/index.mjs +210 -0
- package/dist/runtime/nativeComponents/picker/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/picker/style.mjs +71 -0
- package/dist/runtime/nativeComponents/picker/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/pickerView/column.mjs +134 -0
- package/dist/runtime/nativeComponents/pickerView/column.mjs.map +1 -0
- package/dist/runtime/nativeComponents/pickerView/helpers.mjs +17 -0
- package/dist/runtime/nativeComponents/pickerView/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/pickerView/index.mjs +128 -0
- package/dist/runtime/nativeComponents/pickerView/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/pickerView/style.mjs +58 -0
- package/dist/runtime/nativeComponents/pickerView/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/primitives.mjs +16 -0
- package/dist/runtime/nativeComponents/primitives.mjs.map +1 -0
- package/dist/runtime/nativeComponents/progress/helpers.mjs +29 -0
- package/dist/runtime/nativeComponents/progress/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/progress/index.mjs +130 -0
- package/dist/runtime/nativeComponents/progress/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/progress/style.mjs +40 -0
- package/dist/runtime/nativeComponents/progress/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/radio.mjs +147 -0
- package/dist/runtime/nativeComponents/radio.mjs.map +1 -0
- package/dist/runtime/nativeComponents/richText/helpers.mjs +230 -0
- package/dist/runtime/nativeComponents/richText/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/richText/index.mjs +74 -0
- package/dist/runtime/nativeComponents/richText/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/scrollView.d.mts +15 -0
- package/dist/runtime/nativeComponents/scrollView.mjs +79 -0
- package/dist/runtime/nativeComponents/scrollView.mjs.map +1 -0
- package/dist/runtime/nativeComponents/slider/helpers.mjs +28 -0
- package/dist/runtime/nativeComponents/slider/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/slider/index.mjs +120 -0
- package/dist/runtime/nativeComponents/slider/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/slider/style.mjs +60 -0
- package/dist/runtime/nativeComponents/slider/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/style.mjs +41 -0
- package/dist/runtime/nativeComponents/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/swiper/helpers.mjs +52 -0
- package/dist/runtime/nativeComponents/swiper/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/swiper/index.mjs +235 -0
- package/dist/runtime/nativeComponents/swiper/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/swiper/item.mjs +14 -0
- package/dist/runtime/nativeComponents/swiper/item.mjs.map +1 -0
- package/dist/runtime/nativeComponents/swiper/style.mjs +20 -0
- package/dist/runtime/nativeComponents/swiper/style.mjs.map +1 -0
- package/dist/runtime/nativeComponents/switch.d.mts +7 -0
- package/dist/runtime/nativeComponents/switch.mjs +132 -0
- package/dist/runtime/nativeComponents/switch.mjs.map +1 -0
- package/dist/runtime/nativeComponents/textarea.d.mts +9 -0
- package/dist/runtime/nativeComponents/textarea.mjs +144 -0
- package/dist/runtime/nativeComponents/textarea.mjs.map +1 -0
- package/dist/runtime/nativeComponents/video/helpers.d.mts +12 -0
- package/dist/runtime/nativeComponents/video/helpers.mjs +21 -0
- package/dist/runtime/nativeComponents/video/helpers.mjs.map +1 -0
- package/dist/runtime/nativeComponents/video/index.mjs +124 -0
- package/dist/runtime/nativeComponents/video/index.mjs.map +1 -0
- package/dist/runtime/nativeComponents/video/style.mjs +14 -0
- package/dist/runtime/nativeComponents/video/style.mjs.map +1 -0
- package/dist/runtime/navigationBar/index.mjs +1 -3
- package/dist/runtime/navigationBar/index.mjs.map +1 -1
- package/dist/runtime/pageLayout.d.mts +9 -0
- package/dist/runtime/pageLayout.mjs +16 -0
- package/dist/runtime/pageLayout.mjs.map +1 -0
- package/dist/runtime/polyfill/animation.mjs +120 -0
- package/dist/runtime/polyfill/animation.mjs.map +1 -0
- package/dist/runtime/polyfill/appState.mjs +1 -1
- package/dist/runtime/polyfill/appState.mjs.map +1 -1
- package/dist/runtime/polyfill/async.d.mts +7 -0
- package/dist/runtime/polyfill/async.mjs.map +1 -1
- package/dist/runtime/polyfill/canvasContext.mjs +41 -0
- package/dist/runtime/polyfill/canvasContext.mjs.map +1 -1
- package/dist/runtime/polyfill/device.mjs +1 -1
- package/dist/runtime/polyfill/device.mjs.map +1 -1
- package/dist/runtime/polyfill/deviceApi.mjs +6 -3
- package/dist/runtime/polyfill/deviceApi.mjs.map +1 -1
- package/dist/runtime/polyfill/deviceAuthSystemApi.mjs +8 -2
- package/dist/runtime/polyfill/deviceAuthSystemApi.mjs.map +1 -1
- package/dist/runtime/polyfill/eventBus.mjs +56 -0
- package/dist/runtime/polyfill/eventBus.mjs.map +1 -0
- package/dist/runtime/polyfill/fileSystemManager.mjs +5 -2
- package/dist/runtime/polyfill/fileSystemManager.mjs.map +1 -1
- package/dist/runtime/polyfill/files.mjs +10 -10
- package/dist/runtime/polyfill/files.mjs.map +1 -1
- package/dist/runtime/polyfill/font.mjs +33 -0
- package/dist/runtime/polyfill/font.mjs.map +1 -0
- package/dist/runtime/polyfill/index.d.mts +2 -2
- package/dist/runtime/polyfill/index.mjs +49 -45
- package/dist/runtime/polyfill/index.mjs.map +1 -1
- package/dist/runtime/polyfill/interaction.mjs +7 -6
- package/dist/runtime/polyfill/interaction.mjs.map +1 -1
- package/dist/runtime/polyfill/interactionApi.mjs +9 -5
- package/dist/runtime/polyfill/interactionApi.mjs.map +1 -1
- package/dist/runtime/polyfill/intersectionObserver.mjs +106 -0
- package/dist/runtime/polyfill/intersectionObserver.mjs.map +1 -0
- package/dist/runtime/polyfill/locale.mjs +14 -0
- package/dist/runtime/polyfill/locale.mjs.map +1 -0
- package/dist/runtime/polyfill/locationApi.mjs +11 -6
- package/dist/runtime/polyfill/locationApi.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaActions.mjs +2 -2
- package/dist/runtime/polyfill/mediaActions.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/file.mjs +3 -2
- package/dist/runtime/polyfill/mediaApi/file.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/info.mjs +6 -4
- package/dist/runtime/polyfill/mediaApi/info.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/picker.mjs +16 -8
- package/dist/runtime/polyfill/mediaApi/picker.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/preview.mjs +4 -2
- package/dist/runtime/polyfill/mediaApi/preview.mjs.map +1 -1
- package/dist/runtime/polyfill/mediaApi/process.mjs +4 -2
- package/dist/runtime/polyfill/mediaApi/process.mjs.map +1 -1
- package/dist/runtime/polyfill/menuApi.mjs +39 -4
- package/dist/runtime/polyfill/menuApi.mjs.map +1 -1
- package/dist/runtime/polyfill/navigationBarRuntime.mjs +6 -1
- package/dist/runtime/polyfill/navigationBarRuntime.mjs.map +1 -1
- package/dist/runtime/polyfill/network/request.mjs +2 -2
- package/dist/runtime/polyfill/network/request.mjs.map +1 -1
- package/dist/runtime/polyfill/platformApi.mjs +3 -2
- package/dist/runtime/polyfill/platformApi.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs +88 -0
- package/dist/runtime/polyfill/routeRuntime/appLifecycle.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime/dom.mjs +44 -15
- package/dist/runtime/polyfill/routeRuntime/dom.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/history.d.mts +30 -0
- package/dist/runtime/polyfill/routeRuntime/history.mjs +148 -0
- package/dist/runtime/polyfill/routeRuntime/history.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs +39 -8
- package/dist/runtime/polyfill/routeRuntime/lifecycle.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/options.d.mts +11 -1
- package/dist/runtime/polyfill/routeRuntime/options.mjs +0 -1
- package/dist/runtime/polyfill/routeRuntime/options.mjs.map +1 -1
- package/dist/runtime/polyfill/routeRuntime/result.mjs +12 -0
- package/dist/runtime/polyfill/routeRuntime/result.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime/scroll.mjs +39 -0
- package/dist/runtime/polyfill/routeRuntime/scroll.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime/stack.mjs +122 -0
- package/dist/runtime/polyfill/routeRuntime/stack.mjs.map +1 -0
- package/dist/runtime/polyfill/routeRuntime.d.mts +26 -17
- package/dist/runtime/polyfill/routeRuntime.mjs +121 -96
- package/dist/runtime/polyfill/routeRuntime.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeDataApi.mjs +8 -3
- package/dist/runtime/polyfill/runtimeDataApi.mjs.map +1 -1
- package/dist/runtime/polyfill/runtimeOps.mjs +10 -6
- package/dist/runtime/polyfill/runtimeOps.mjs.map +1 -1
- package/dist/runtime/polyfill/selectorQuery.mjs +70 -14
- package/dist/runtime/polyfill/selectorQuery.mjs.map +1 -1
- package/dist/runtime/polyfill/storage.mjs +5 -2
- package/dist/runtime/polyfill/storage.mjs.map +1 -1
- package/dist/runtime/polyfill/storageAsync.mjs +4 -2
- package/dist/runtime/polyfill/storageAsync.mjs.map +1 -1
- package/dist/runtime/polyfill/system.mjs +31 -4
- package/dist/runtime/polyfill/system.mjs.map +1 -1
- package/dist/runtime/polyfill/systemApi.mjs +2 -1
- package/dist/runtime/polyfill/systemApi.mjs.map +1 -1
- package/dist/runtime/polyfill/types/locationRuntime.d.mts +1 -4
- package/dist/runtime/polyfill/types/platformRuntime.d.mts +9 -0
- package/dist/runtime/polyfill/types/systemAuth.d.mts +20 -9
- package/dist/runtime/polyfill/types/tabBarRuntime.d.mts +25 -0
- package/dist/runtime/polyfill/ui.mjs +2 -6
- package/dist/runtime/polyfill/ui.mjs.map +1 -1
- package/dist/runtime/polyfill/uiMediaApi.d.mts +11 -10
- package/dist/runtime/polyfill/uiMediaApi.mjs +26 -2
- package/dist/runtime/polyfill/uiMediaApi.mjs.map +1 -1
- package/dist/runtime/polyfill/videoContext.mjs +4 -0
- package/dist/runtime/polyfill/videoContext.mjs.map +1 -1
- package/dist/runtime/polyfill/vkSession.mjs +4 -14
- package/dist/runtime/polyfill/vkSession.mjs.map +1 -1
- package/dist/runtime/polyfill.d.mts +2 -2
- package/dist/runtime/renderContext.mjs +1 -1
- package/dist/runtime/renderContext.mjs.map +1 -1
- package/dist/runtime/rpx.mjs +17 -8
- package/dist/runtime/rpx.mjs.map +1 -1
- package/dist/runtime/seo/index.d.mts +31 -0
- package/dist/runtime/seo/index.mjs +94 -0
- package/dist/runtime/seo/index.mjs.map +1 -0
- package/dist/runtime/viewport/index.d.mts +12 -0
- package/dist/runtime/viewport/index.mjs +44 -0
- package/dist/runtime/viewport/index.mjs.map +1 -0
- package/dist/runtime/viewport/style.mjs +62 -0
- package/dist/runtime/viewport/style.mjs.map +1 -0
- package/dist/runtime/viewport/types.d.mts +14 -0
- package/dist/runtime/wevu.d.mts +20 -0
- package/dist/runtime/wevu.mjs +73 -0
- package/dist/runtime/wevu.mjs.map +1 -0
- package/dist/shared/nativeComponents.mjs +401 -0
- package/dist/shared/nativeComponents.mjs.map +1 -0
- package/dist/shared/tabBar.d.mts +19 -0
- package/dist/shared/tabBar.mjs +37 -0
- package/dist/shared/tabBar.mjs.map +1 -0
- package/dist/shared/wxml.mjs +3 -20
- package/dist/shared/wxml.mjs.map +1 -1
- package/package.json +14 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.mjs","names":[],"sources":["../../src/plugin/assets.ts"],"sourcesContent":["import type { IncomingMessage, ServerResponse } from 'node:http'\nimport { createReadStream } from 'node:fs'\nimport { readdir, readFile, stat } from 'node:fs/promises'\nimport { extname, relative, resolve } from 'pathe'\nimport { normalizePath } from './path'\n\nconst WEB_ASSET_EXTENSIONS = new Set([\n '.aac',\n '.avif',\n '.br',\n '.cer',\n '.cert',\n '.gif',\n '.jpeg',\n '.jpg',\n '.m4a',\n '.mp3',\n '.mp4',\n '.ogg',\n '.otf',\n '.png',\n '.silk',\n '.svg',\n '.ttf',\n '.wasm',\n '.wav',\n '.webm',\n '.webp',\n '.woff',\n '.woff2',\n])\n\nconst WEB_ASSET_CONTENT_TYPES: Record<string, string> = {\n '.aac': 'audio/aac',\n '.avif': 'image/avif',\n '.gif': 'image/gif',\n '.jpeg': 'image/jpeg',\n '.jpg': 'image/jpeg',\n '.m4a': 'audio/mp4',\n '.mp3': 'audio/mpeg',\n '.mp4': 'video/mp4',\n '.ogg': 'audio/ogg',\n '.otf': 'font/otf',\n '.png': 'image/png',\n '.svg': 'image/svg+xml',\n '.ttf': 'font/ttf',\n '.wasm': 'application/wasm',\n '.wav': 'audio/wav',\n '.webm': 'video/webm',\n '.webp': 'image/webp',\n '.woff': 'font/woff',\n '.woff2': 'font/woff2',\n}\n\ninterface WebAssetPluginContext {\n addWatchFile?: (id: string) => void\n emitFile?: (asset: { type: 'asset', fileName: string, source: Uint8Array }) => void\n}\n\ntype WebAssetNext = (error?: unknown) => void\n\nfunction isWebAssetFile(filename: string) {\n return WEB_ASSET_EXTENSIONS.has(extname(filename).toLowerCase())\n}\n\nfunction isInsideRoot(root: string, filename: string) {\n const relativePath = normalizePath(relative(root, filename))\n return relativePath !== '..'\n && !relativePath.startsWith('../')\n && !relativePath.startsWith('/')\n}\n\nexport function resolveWebAssetRequest(srcRoot: string, requestUrl?: string) {\n if (!requestUrl) {\n return undefined\n }\n let pathname: string\n try {\n const rawPath = decodeURIComponent(requestUrl.split(/[?#]/, 1)[0]!)\n if (rawPath.split('/').includes('..')) {\n return undefined\n }\n pathname = decodeURIComponent(new URL(requestUrl, 'http://weapp-vite.local').pathname)\n }\n catch {\n return undefined\n }\n const relativePath = pathname.replace(/^\\/+/, '')\n if (!relativePath || !isWebAssetFile(relativePath)) {\n return undefined\n }\n const filename = resolve(srcRoot, relativePath)\n return isInsideRoot(srcRoot, filename) ? filename : undefined\n}\n\nasync function collectWebAssetFiles(directory: string): Promise<string[]> {\n const entries = await readdir(directory, { withFileTypes: true })\n const files: string[] = []\n for (const entry of entries) {\n const filename = resolve(directory, entry.name)\n if (entry.isDirectory()) {\n files.push(...await collectWebAssetFiles(filename))\n }\n else if (entry.isFile() && isWebAssetFile(filename)) {\n files.push(filename)\n }\n }\n return files\n}\n\nexport async function emitWebAssets(context: WebAssetPluginContext, srcRoot: string) {\n if (!context.emitFile) {\n return\n }\n const files = await collectWebAssetFiles(srcRoot)\n for (const filename of files) {\n const fileName = normalizePath(relative(srcRoot, filename))\n context.addWatchFile?.(filename)\n context.emitFile({\n type: 'asset',\n fileName,\n source: await readFile(filename),\n })\n }\n}\n\nexport function createWebAssetMiddleware(srcRoot: string) {\n return (request: IncomingMessage, response: ServerResponse, next: WebAssetNext) => {\n const filename = resolveWebAssetRequest(srcRoot, request.url)\n if (!filename) {\n next()\n return\n }\n void stat(filename).then((fileStat) => {\n if (!fileStat.isFile()) {\n next()\n return\n }\n const extension = extname(filename).toLowerCase()\n response.statusCode = 200\n response.setHeader('Content-Length', String(fileStat.size))\n response.setHeader('Content-Type', WEB_ASSET_CONTENT_TYPES[extension] ?? 'application/octet-stream')\n const stream = createReadStream(filename)\n stream.on('error', next)\n stream.pipe(response)\n }).catch(() => next())\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
//#region src/plugin/constants.ts
|
|
2
2
|
const SCRIPT_EXTS = [
|
|
3
|
+
".vue",
|
|
3
4
|
".ts",
|
|
4
5
|
".tsx",
|
|
5
6
|
".js",
|
|
@@ -37,7 +38,15 @@ const WXS_RESOLVE_EXTS = [
|
|
|
37
38
|
".js"
|
|
38
39
|
];
|
|
39
40
|
const ENTRY_ID = "\0@weapp-vite/web/entry";
|
|
41
|
+
const AUTO_ROUTES_ID = "weapp-vite/auto-routes";
|
|
42
|
+
const RESOLVED_AUTO_ROUTES_ID = "\0@weapp-vite/web/auto-routes";
|
|
43
|
+
const TEMPLATE_QUERY = "weapp-web-template";
|
|
44
|
+
const STYLE_QUERY = "weapp-web-style";
|
|
45
|
+
const SFC_TEMPLATE_QUERY = "weapp-web-sfc-template";
|
|
46
|
+
const SFC_STYLE_QUERY = "weapp-web-sfc-style";
|
|
47
|
+
const WEB_COMPONENT_PREFIX = "/@weapp-vite/web/component/";
|
|
48
|
+
const WEB_COMPONENT_QUERY = "weapp-web-component";
|
|
40
49
|
|
|
41
50
|
//#endregion
|
|
42
|
-
export { ENTRY_ID, SCRIPT_EXTS, STYLE_EXTS, TEMPLATE_EXTS, TRANSFORM_STYLE_EXTS, WXS_EXTS, WXS_RESOLVE_EXTS };
|
|
51
|
+
export { AUTO_ROUTES_ID, ENTRY_ID, RESOLVED_AUTO_ROUTES_ID, SCRIPT_EXTS, SFC_STYLE_QUERY, SFC_TEMPLATE_QUERY, STYLE_EXTS, STYLE_QUERY, TEMPLATE_EXTS, TEMPLATE_QUERY, TRANSFORM_STYLE_EXTS, WEB_COMPONENT_PREFIX, WEB_COMPONENT_QUERY, WXS_EXTS, WXS_RESOLVE_EXTS };
|
|
43
52
|
//# sourceMappingURL=constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","names":[],"sources":["../../src/plugin/constants.ts"],"sourcesContent":["export const SCRIPT_EXTS = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs']\nexport const STYLE_EXTS = ['.wxss', '.scss', '.less', '.css']\nexport const TRANSFORM_STYLE_EXTS = ['.wxss']\nexport const TEMPLATE_EXTS = ['.wxml', '.axml', '.swan', '.ttml', '.qml', '.ksml', '.xhsml', '.html']\nexport const WXS_EXTS = ['.wxs', '.wxs.ts', '.wxs.js']\nexport const WXS_RESOLVE_EXTS = ['.wxs', '.wxs.ts', '.wxs.js', '.ts', '.js']\n\nexport const ENTRY_ID = '\\0@weapp-vite/web/entry'\n"],"mappings":";AAAA,MAAa,cAAc;CAAC;CAAO;CAAQ;CAAO;CAAQ;CAAQ;AAAM;
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../../src/plugin/constants.ts"],"sourcesContent":["export const SCRIPT_EXTS = ['.vue', '.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs']\nexport const STYLE_EXTS = ['.wxss', '.scss', '.less', '.css']\nexport const TRANSFORM_STYLE_EXTS = ['.wxss']\nexport const TEMPLATE_EXTS = ['.wxml', '.axml', '.swan', '.ttml', '.qml', '.ksml', '.xhsml', '.html']\nexport const WXS_EXTS = ['.wxs', '.wxs.ts', '.wxs.js']\nexport const WXS_RESOLVE_EXTS = ['.wxs', '.wxs.ts', '.wxs.js', '.ts', '.js']\n\nexport const ENTRY_ID = '\\0@weapp-vite/web/entry'\nexport const AUTO_ROUTES_ID = 'weapp-vite/auto-routes'\nexport const RESOLVED_AUTO_ROUTES_ID = '\\0@weapp-vite/web/auto-routes'\nexport const TEMPLATE_QUERY = 'weapp-web-template'\nexport const STYLE_QUERY = 'weapp-web-style'\nexport const SFC_TEMPLATE_QUERY = 'weapp-web-sfc-template'\nexport const SFC_STYLE_QUERY = 'weapp-web-sfc-style'\nexport const WEB_COMPONENT_PREFIX = '/@weapp-vite/web/component/'\nexport const WEB_COMPONENT_QUERY = 'weapp-web-component'\n"],"mappings":";AAAA,MAAa,cAAc;CAAC;CAAQ;CAAO;CAAQ;CAAO;CAAQ;CAAQ;AAAM;AAChF,MAAa,aAAa;CAAC;CAAS;CAAS;CAAS;AAAM;AAC5D,MAAa,uBAAuB,CAAC,OAAO;AAC5C,MAAa,gBAAgB;CAAC;CAAS;CAAS;CAAS;CAAS;CAAQ;CAAS;CAAU;AAAO;AACpG,MAAa,WAAW;CAAC;CAAQ;CAAW;AAAS;AACrD,MAAa,mBAAmB;CAAC;CAAQ;CAAW;CAAW;CAAO;AAAK;AAE3E,MAAa,WAAW;AACxB,MAAa,iBAAiB;AAC9B,MAAa,0BAA0B;AACvC,MAAa,iBAAiB;AAC9B,MAAa,cAAc;AAC3B,MAAa,qBAAqB;AAClC,MAAa,kBAAkB;AAC/B,MAAa,uBAAuB;AACpC,MAAa,sBAAsB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { extname } from "pathe";
|
|
2
|
+
import { build } from "esbuild";
|
|
3
|
+
|
|
4
|
+
//#region src/plugin/dependencyScan.ts
|
|
5
|
+
const SCRIPT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
6
|
+
".cjs",
|
|
7
|
+
".js",
|
|
8
|
+
".jsx",
|
|
9
|
+
".mjs",
|
|
10
|
+
".ts",
|
|
11
|
+
".tsx"
|
|
12
|
+
]);
|
|
13
|
+
function isBareModuleId(id) {
|
|
14
|
+
return Boolean(id) && !id.startsWith(".") && !id.startsWith("/") && !id.startsWith("#");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 收集外部原生组件脚本递归依赖的裸模块,交由 Vite 预构建处理。
|
|
18
|
+
*/
|
|
19
|
+
async function collectExternalComponentOptimizeDeps(components) {
|
|
20
|
+
const entryPoints = Array.from(new Set(components.filter((component) => component.importId && SCRIPT_EXTENSIONS.has(extname(component.script))).map((component) => component.script)));
|
|
21
|
+
if (entryPoints.length === 0) return [];
|
|
22
|
+
const result = await build({
|
|
23
|
+
entryPoints,
|
|
24
|
+
bundle: true,
|
|
25
|
+
format: "esm",
|
|
26
|
+
logLevel: "silent",
|
|
27
|
+
metafile: true,
|
|
28
|
+
outdir: "weapp-web-dependency-scan",
|
|
29
|
+
packages: "external",
|
|
30
|
+
platform: "browser",
|
|
31
|
+
write: false
|
|
32
|
+
});
|
|
33
|
+
const componentImportIds = new Set(components.map((component) => component.importId));
|
|
34
|
+
const dependencies = /* @__PURE__ */ new Set();
|
|
35
|
+
for (const input of Object.values(result.metafile.inputs)) for (const dependency of input.imports) if (dependency.external && isBareModuleId(dependency.path) && !componentImportIds.has(dependency.path)) dependencies.add(dependency.path);
|
|
36
|
+
return Array.from(dependencies).sort();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { collectExternalComponentOptimizeDeps };
|
|
41
|
+
//# sourceMappingURL=dependencyScan.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencyScan.mjs","names":[],"sources":["../../src/plugin/dependencyScan.ts"],"sourcesContent":["import type { ComponentEntry } from './types'\nimport { build } from 'esbuild'\nimport { extname } from 'pathe'\n\nconst SCRIPT_EXTENSIONS = new Set(['.cjs', '.js', '.jsx', '.mjs', '.ts', '.tsx'])\n\nfunction isBareModuleId(id: string) {\n return Boolean(id)\n && !id.startsWith('.')\n && !id.startsWith('/')\n && !id.startsWith('#')\n}\n\n/**\n * 收集外部原生组件脚本递归依赖的裸模块,交由 Vite 预构建处理。\n */\nexport async function collectExternalComponentOptimizeDeps(components: ComponentEntry[]) {\n const entryPoints = Array.from(new Set(\n components\n .filter(component => component.importId && SCRIPT_EXTENSIONS.has(extname(component.script)))\n .map(component => component.script),\n ))\n if (entryPoints.length === 0) {\n return []\n }\n\n const result = await build({\n entryPoints,\n bundle: true,\n format: 'esm',\n logLevel: 'silent',\n metafile: true,\n outdir: 'weapp-web-dependency-scan',\n packages: 'external',\n platform: 'browser',\n write: false,\n })\n const componentImportIds = new Set(components.map(component => component.importId))\n const dependencies = new Set<string>()\n for (const input of Object.values(result.metafile.inputs)) {\n for (const dependency of input.imports) {\n if (dependency.external\n && isBareModuleId(dependency.path)\n && !componentImportIds.has(dependency.path)) {\n dependencies.add(dependency.path)\n }\n }\n }\n return Array.from(dependencies).sort()\n}\n"],"mappings":";;;;AAIA,MAAM,oCAAoB,IAAI,IAAI;CAAC;CAAQ;CAAO;CAAQ;CAAQ;CAAO;AAAM,CAAC;AAEhF,SAAS,eAAe,IAAY;CAClC,OAAO,QAAQ,EAAE,KACZ,CAAC,GAAG,WAAW,GAAG,KAClB,CAAC,GAAG,WAAW,GAAG,KAClB,CAAC,GAAG,WAAW,GAAG;AACzB;;;;AAKA,eAAsB,qCAAqC,YAA8B;CACvF,MAAM,cAAc,MAAM,KAAK,IAAI,IACjC,WACG,QAAO,cAAa,UAAU,YAAY,kBAAkB,IAAI,QAAQ,UAAU,MAAM,CAAC,CAAC,CAAC,CAC3F,KAAI,cAAa,UAAU,MAAM,CACtC,CAAC;CACD,IAAI,YAAY,WAAW,GACzB,OAAO,CAAC;CAGV,MAAM,SAAS,MAAM,MAAM;EACzB;EACA,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,UAAU;EACV,QAAQ;EACR,UAAU;EACV,UAAU;EACV,OAAO;CACT,CAAC;CACD,MAAM,qBAAqB,IAAI,IAAI,WAAW,KAAI,cAAa,UAAU,QAAQ,CAAC;CAClF,MAAM,+BAAe,IAAI,IAAY;CACrC,KAAK,MAAM,SAAS,OAAO,OAAO,OAAO,SAAS,MAAM,GACtD,KAAK,MAAM,cAAc,MAAM,SAC7B,IAAI,WAAW,YACV,eAAe,WAAW,IAAI,KAC9B,CAAC,mBAAmB,IAAI,WAAW,IAAI,GAC1C,aAAa,IAAI,WAAW,IAAI;CAItC,OAAO,MAAM,KAAK,YAAY,CAAC,CAAC,KAAK;AACvC"}
|
package/dist/plugin/entry.mjs
CHANGED
|
@@ -1,23 +1,72 @@
|
|
|
1
|
+
import { WEB_COMPONENT_PREFIX } from "./constants.mjs";
|
|
1
2
|
import { relativeModuleId, resolveRuntimePolyfillPath, toViteFsImport } from "./path.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/plugin/entry.ts
|
|
5
|
+
function generateAutoRoutesModule(result) {
|
|
6
|
+
const pages = result.pages.map((page) => page.id);
|
|
7
|
+
const subPackageMap = /* @__PURE__ */ new Map();
|
|
8
|
+
for (const id of pages) {
|
|
9
|
+
const pagesSegment = id.indexOf("/pages/");
|
|
10
|
+
if (pagesSegment <= 0) continue;
|
|
11
|
+
const root = id.slice(0, pagesSegment);
|
|
12
|
+
const route = id.slice(pagesSegment + 1);
|
|
13
|
+
const routes = subPackageMap.get(root) ?? [];
|
|
14
|
+
routes.push(route);
|
|
15
|
+
subPackageMap.set(root, routes);
|
|
16
|
+
}
|
|
17
|
+
const mainPages = pages.filter((id) => !id.includes("/pages/"));
|
|
18
|
+
const subPackages = [...subPackageMap].map(([root, routes]) => ({
|
|
19
|
+
root,
|
|
20
|
+
pages: routes
|
|
21
|
+
}));
|
|
22
|
+
return [
|
|
23
|
+
`const routes = ${JSON.stringify({
|
|
24
|
+
pages: mainPages,
|
|
25
|
+
entries: pages,
|
|
26
|
+
subPackages
|
|
27
|
+
})}`,
|
|
28
|
+
`const call = (name, options) => globalThis.wx?.[name]?.(options)`,
|
|
29
|
+
`export const pages = routes.pages`,
|
|
30
|
+
`export const entries = routes.entries`,
|
|
31
|
+
`export const subPackages = routes.subPackages`,
|
|
32
|
+
`export const miniProgramRouter = {`,
|
|
33
|
+
` switchTab: options => call('switchTab', options),`,
|
|
34
|
+
` reLaunch: options => call('reLaunch', options),`,
|
|
35
|
+
` redirectTo: options => call('redirectTo', options),`,
|
|
36
|
+
` navigateTo: options => call('navigateTo', options),`,
|
|
37
|
+
` navigateBack: options => call('navigateBack', options),`,
|
|
38
|
+
`}`,
|
|
39
|
+
`export const wxRouter = miniProgramRouter`,
|
|
40
|
+
`export { routes }`,
|
|
41
|
+
`export default routes`
|
|
42
|
+
].join("\n");
|
|
43
|
+
}
|
|
4
44
|
function generateEntryModule(result, root, wxssOptions, pluginOptions) {
|
|
5
45
|
const importLines = [`import { initializePageRoutes } from '${pluginOptions?.__runtimeProvider?.moduleId ?? toViteFsImport(resolveRuntimePolyfillPath())}'`];
|
|
6
46
|
const bodyLines = [];
|
|
7
|
-
for (const page of result.pages) importLines.push(`import '${relativeModuleId(root, page.script)}'`);
|
|
8
|
-
for (const component of result.components) importLines.push(`import '${relativeModuleId(root, component.script)}'`);
|
|
9
47
|
if (result.app) importLines.push(`import '${relativeModuleId(root, result.app)}'`);
|
|
48
|
+
for (const page of result.pages) importLines.push(`import '${relativeModuleId(root, page.script)}'`);
|
|
49
|
+
for (const component of result.components) {
|
|
50
|
+
const componentImportId = component.importId ? `${WEB_COMPONENT_PREFIX}${encodeURIComponent(component.importId)}` : relativeModuleId(root, component.script);
|
|
51
|
+
importLines.push(`import '${componentImportId}'`);
|
|
52
|
+
}
|
|
53
|
+
for (const layout of result.layouts) importLines.push(`import '${relativeModuleId(root, layout.script)}'`);
|
|
10
54
|
const pageOrder = result.pages.map((page) => page.id);
|
|
11
|
-
const rpxConfig = wxssOptions?.designWidth ? {
|
|
12
|
-
designWidth: wxssOptions
|
|
13
|
-
varName: wxssOptions
|
|
55
|
+
const rpxConfig = wxssOptions?.pxPerRpx === void 0 || typeof wxssOptions.designWidth === "number" && Number.isFinite(wxssOptions.designWidth) ? {
|
|
56
|
+
designWidth: wxssOptions?.designWidth ?? 750,
|
|
57
|
+
varName: wxssOptions?.rpxVar
|
|
14
58
|
} : void 0;
|
|
15
59
|
const initOptions = {};
|
|
60
|
+
if (result.tabBar) initOptions.tabBar = result.tabBar;
|
|
16
61
|
if (rpxConfig) initOptions.rpx = rpxConfig;
|
|
17
62
|
if (pluginOptions?.form?.preventDefault !== void 0) initOptions.form = { preventDefault: pluginOptions.form.preventDefault };
|
|
18
63
|
const runtimeOptions = {};
|
|
19
64
|
if (pluginOptions?.runtime?.executionMode) runtimeOptions.executionMode = pluginOptions.runtime.executionMode;
|
|
20
65
|
if (pluginOptions?.runtime?.warnings) runtimeOptions.warnings = pluginOptions.runtime.warnings;
|
|
66
|
+
if (pluginOptions?.runtime?.viewport) runtimeOptions.viewport = pluginOptions.runtime.viewport;
|
|
67
|
+
if (pluginOptions?.runtime?.routing) runtimeOptions.routing = pluginOptions.runtime.routing;
|
|
68
|
+
if (pluginOptions?.runtime?.seo) runtimeOptions.seo = pluginOptions.runtime.seo;
|
|
69
|
+
if (pluginOptions?.runtime?.resourceHints) runtimeOptions.resourceHints = pluginOptions.runtime.resourceHints;
|
|
21
70
|
if (Object.keys(runtimeOptions).length > 0) initOptions.runtime = runtimeOptions;
|
|
22
71
|
const initOptionsCode = Object.keys(initOptions).length > 0 ? `, ${JSON.stringify(initOptions)}` : "";
|
|
23
72
|
bodyLines.push(`initializePageRoutes(${JSON.stringify(pageOrder)}${initOptionsCode})`);
|
|
@@ -25,5 +74,5 @@ function generateEntryModule(result, root, wxssOptions, pluginOptions) {
|
|
|
25
74
|
}
|
|
26
75
|
|
|
27
76
|
//#endregion
|
|
28
|
-
export { generateEntryModule };
|
|
77
|
+
export { generateAutoRoutesModule, generateEntryModule };
|
|
29
78
|
//# sourceMappingURL=entry.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.mjs","names":[],"sources":["../../src/plugin/entry.ts"],"sourcesContent":["import type { WxssTransformOptions } from '../css/wxss'\n\nimport type { ScanResult, WeappWebPluginOptions } from './types'\nimport { relativeModuleId, resolveRuntimePolyfillPath, toViteFsImport } from './path'\n\nexport function generateEntryModule(\n result: ScanResult,\n root: string,\n wxssOptions?: WxssTransformOptions,\n pluginOptions?: WeappWebPluginOptions,\n) {\n const runtimePolyfillId = pluginOptions?.__runtimeProvider?.moduleId\n ?? toViteFsImport(resolveRuntimePolyfillPath())\n const importLines: string[] = [`import { initializePageRoutes } from '${runtimePolyfillId}'`]\n const bodyLines: string[] = []\n\n for (const page of result.pages) {\n importLines.push(`import '${relativeModuleId(root, page.script)}'`)\n }\n for (const component of result.components) {\n
|
|
1
|
+
{"version":3,"file":"entry.mjs","names":[],"sources":["../../src/plugin/entry.ts"],"sourcesContent":["import type { WxssTransformOptions } from '../css/wxss'\n\nimport type { ScanResult, WeappWebPluginOptions } from './types'\nimport { WEB_COMPONENT_PREFIX } from './constants'\nimport { relativeModuleId, resolveRuntimePolyfillPath, toViteFsImport } from './path'\n\nexport function generateAutoRoutesModule(result: ScanResult) {\n const pages = result.pages.map(page => page.id)\n const subPackageMap = new Map<string, string[]>()\n for (const id of pages) {\n const pagesSegment = id.indexOf('/pages/')\n if (pagesSegment <= 0) {\n continue\n }\n const root = id.slice(0, pagesSegment)\n const route = id.slice(pagesSegment + 1)\n const routes = subPackageMap.get(root) ?? []\n routes.push(route)\n subPackageMap.set(root, routes)\n }\n const mainPages = pages.filter(id => !id.includes('/pages/'))\n const subPackages = [...subPackageMap].map(([root, routes]) => ({ root, pages: routes }))\n const snapshot = JSON.stringify({ pages: mainPages, entries: pages, subPackages })\n return [\n `const routes = ${snapshot}`,\n `const call = (name, options) => globalThis.wx?.[name]?.(options)`,\n `export const pages = routes.pages`,\n `export const entries = routes.entries`,\n `export const subPackages = routes.subPackages`,\n `export const miniProgramRouter = {`,\n ` switchTab: options => call('switchTab', options),`,\n ` reLaunch: options => call('reLaunch', options),`,\n ` redirectTo: options => call('redirectTo', options),`,\n ` navigateTo: options => call('navigateTo', options),`,\n ` navigateBack: options => call('navigateBack', options),`,\n `}`,\n `export const wxRouter = miniProgramRouter`,\n `export { routes }`,\n `export default routes`,\n ].join('\\n')\n}\n\nexport function generateEntryModule(\n result: ScanResult,\n root: string,\n wxssOptions?: WxssTransformOptions,\n pluginOptions?: WeappWebPluginOptions,\n) {\n const runtimePolyfillId = pluginOptions?.__runtimeProvider?.moduleId\n ?? toViteFsImport(resolveRuntimePolyfillPath())\n const importLines: string[] = [`import { initializePageRoutes } from '${runtimePolyfillId}'`]\n const bodyLines: string[] = []\n\n if (result.app) {\n importLines.push(`import '${relativeModuleId(root, result.app)}'`)\n }\n for (const page of result.pages) {\n importLines.push(`import '${relativeModuleId(root, page.script)}'`)\n }\n for (const component of result.components) {\n const componentImportId = component.importId\n ? `${WEB_COMPONENT_PREFIX}${encodeURIComponent(component.importId)}`\n : relativeModuleId(root, component.script)\n importLines.push(`import '${componentImportId}'`)\n }\n for (const layout of result.layouts) {\n importLines.push(`import '${relativeModuleId(root, layout.script)}'`)\n }\n\n const pageOrder = result.pages.map(page => page.id)\n const useRuntimeRpx = wxssOptions?.pxPerRpx === undefined\n || (typeof wxssOptions.designWidth === 'number' && Number.isFinite(wxssOptions.designWidth))\n const rpxConfig = useRuntimeRpx\n ? { designWidth: wxssOptions?.designWidth ?? 750, varName: wxssOptions?.rpxVar }\n : undefined\n\n const initOptions: Record<string, any> = {}\n if (result.tabBar) {\n initOptions.tabBar = result.tabBar\n }\n if (rpxConfig) {\n initOptions.rpx = rpxConfig\n }\n if (pluginOptions?.form?.preventDefault !== undefined) {\n initOptions.form = { preventDefault: pluginOptions.form.preventDefault }\n }\n\n const runtimeOptions: Record<string, any> = {}\n if (pluginOptions?.runtime?.executionMode) {\n runtimeOptions.executionMode = pluginOptions.runtime.executionMode\n }\n if (pluginOptions?.runtime?.warnings) {\n runtimeOptions.warnings = pluginOptions.runtime.warnings\n }\n if (pluginOptions?.runtime?.viewport) {\n runtimeOptions.viewport = pluginOptions.runtime.viewport\n }\n if (pluginOptions?.runtime?.routing) {\n runtimeOptions.routing = pluginOptions.runtime.routing\n }\n if (pluginOptions?.runtime?.seo) {\n runtimeOptions.seo = pluginOptions.runtime.seo\n }\n if (pluginOptions?.runtime?.resourceHints) {\n runtimeOptions.resourceHints = pluginOptions.runtime.resourceHints\n }\n if (Object.keys(runtimeOptions).length > 0) {\n initOptions.runtime = runtimeOptions\n }\n\n const initOptionsCode = Object.keys(initOptions).length > 0 ? `, ${JSON.stringify(initOptions)}` : ''\n bodyLines.push(`initializePageRoutes(${JSON.stringify(pageOrder)}${initOptionsCode})`)\n return [...importLines, ...bodyLines].join('\\n')\n}\n"],"mappings":"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"}
|
package/dist/plugin/files.mjs
CHANGED
|
@@ -21,7 +21,7 @@ async function readJsonFile(pathname) {
|
|
|
21
21
|
filepath: candidate,
|
|
22
22
|
preserveTemporaryFile: true
|
|
23
23
|
});
|
|
24
|
-
const resolved = typeof mod
|
|
24
|
+
const resolved = typeof mod === "function" ? await mod() : mod;
|
|
25
25
|
if (!isRecord(resolved)) return;
|
|
26
26
|
return resolved;
|
|
27
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.mjs","names":[],"sources":["../../src/plugin/files.ts"],"sourcesContent":["import { fs } from '@weapp-core/shared/fs'\nimport { extname } from 'pathe'\nimport { bundleRequire } from 'rolldown-require'\n\nimport { SCRIPT_EXTS, STYLE_EXTS, TEMPLATE_EXTS } from './constants'\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nexport async function readJsonFile(pathname: string) {\n const candidates = [pathname]\n if (pathname.endsWith('.json')) {\n candidates.push(`${pathname}.ts`, `${pathname}.js`)\n }\n\n for (const candidate of candidates) {\n if (!(await fs.pathExists(candidate))) {\n continue\n }\n if (candidate.endsWith('.json')) {\n const json = await fs.readJson(candidate).catch(() => undefined)\n if (!isRecord(json)) {\n return undefined\n }\n return json\n }\n const { mod } = await bundleRequire({\n filepath: candidate,\n preserveTemporaryFile: true,\n })\n const resolved = typeof mod
|
|
1
|
+
{"version":3,"file":"files.mjs","names":[],"sources":["../../src/plugin/files.ts"],"sourcesContent":["import { fs } from '@weapp-core/shared/fs'\nimport { extname } from 'pathe'\nimport { bundleRequire } from 'rolldown-require'\n\nimport { SCRIPT_EXTS, STYLE_EXTS, TEMPLATE_EXTS } from './constants'\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nexport async function readJsonFile(pathname: string) {\n const candidates = [pathname]\n if (pathname.endsWith('.json')) {\n candidates.push(`${pathname}.ts`, `${pathname}.js`)\n }\n\n for (const candidate of candidates) {\n if (!(await fs.pathExists(candidate))) {\n continue\n }\n if (candidate.endsWith('.json')) {\n const json = await fs.readJson(candidate).catch(() => undefined)\n if (!isRecord(json)) {\n return undefined\n }\n return json\n }\n const { mod } = await bundleRequire({\n filepath: candidate,\n preserveTemporaryFile: true,\n })\n const resolved = typeof mod === 'function'\n ? await mod()\n : mod\n if (!isRecord(resolved)) {\n return undefined\n }\n return resolved\n }\n\n return undefined\n}\n\nexport async function resolveJsonPath(basePath: string) {\n const candidates = [basePath]\n if (basePath.endsWith('.json')) {\n candidates.push(`${basePath}.ts`, `${basePath}.js`)\n }\n for (const candidate of candidates) {\n if (await fs.pathExists(candidate)) {\n return candidate\n }\n }\n return undefined\n}\n\nexport async function resolveScriptFile(basePath: string) {\n const ext = extname(basePath)\n if (ext && (await fs.pathExists(basePath))) {\n return basePath\n }\n for (const candidateExt of SCRIPT_EXTS) {\n const candidate = `${basePath}${candidateExt}`\n if (await fs.pathExists(candidate)) {\n return candidate\n }\n }\n return undefined\n}\n\nexport async function resolveStyleFile(scriptPath: string) {\n const base = scriptPath.replace(new RegExp(`${extname(scriptPath)}$`), '')\n for (const ext of STYLE_EXTS) {\n const candidate = `${base}${ext}`\n if (await fs.pathExists(candidate)) {\n return candidate\n }\n }\n return undefined\n}\n\nexport async function resolveTemplateFile(scriptPath: string) {\n const base = scriptPath.replace(new RegExp(`${extname(scriptPath)}$`), '')\n for (const ext of TEMPLATE_EXTS) {\n const candidate = `${base}${ext}`\n if (await fs.pathExists(candidate)) {\n return candidate\n }\n }\n return undefined\n}\n"],"mappings":";;;;;;AAMA,SAAgB,SAAS,OAAkD;CACzE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,eAAsB,aAAa,UAAkB;CACnD,MAAM,aAAa,CAAC,QAAQ;CAC5B,IAAI,SAAS,SAAS,OAAO,GAC3B,WAAW,KAAK,GAAG,SAAS,MAAM,GAAG,SAAS,IAAI;CAGpD,KAAK,MAAM,aAAa,YAAY;EAClC,IAAI,CAAE,MAAM,GAAG,WAAW,SAAS,GACjC;EAEF,IAAI,UAAU,SAAS,OAAO,GAAG;GAC/B,MAAM,OAAO,MAAM,GAAG,SAAS,SAAS,CAAC,CAAC,YAAY,MAAS;GAC/D,IAAI,CAAC,SAAS,IAAI,GAChB;GAEF,OAAO;EACT;EACA,MAAM,EAAE,QAAQ,MAAM,cAAc;GAClC,UAAU;GACV,uBAAuB;EACzB,CAAC;EACD,MAAM,WAAW,OAAO,QAAQ,aAC5B,MAAM,IAAI,IACV;EACJ,IAAI,CAAC,SAAS,QAAQ,GACpB;EAEF,OAAO;CACT;AAGF;AAEA,eAAsB,gBAAgB,UAAkB;CACtD,MAAM,aAAa,CAAC,QAAQ;CAC5B,IAAI,SAAS,SAAS,OAAO,GAC3B,WAAW,KAAK,GAAG,SAAS,MAAM,GAAG,SAAS,IAAI;CAEpD,KAAK,MAAM,aAAa,YACtB,IAAI,MAAM,GAAG,WAAW,SAAS,GAC/B,OAAO;AAIb;AAEA,eAAsB,kBAAkB,UAAkB;CAExD,IADY,QAAQ,QACd,KAAM,MAAM,GAAG,WAAW,QAAQ,GACtC,OAAO;CAET,KAAK,MAAM,gBAAgB,aAAa;EACtC,MAAM,YAAY,GAAG,WAAW;EAChC,IAAI,MAAM,GAAG,WAAW,SAAS,GAC/B,OAAO;CAEX;AAEF;AAEA,eAAsB,iBAAiB,YAAoB;CACzD,MAAM,OAAO,WAAW,QAAQ,IAAI,OAAO,GAAG,QAAQ,UAAU,EAAE,EAAE,GAAG,EAAE;CACzE,KAAK,MAAM,OAAO,YAAY;EAC5B,MAAM,YAAY,GAAG,OAAO;EAC5B,IAAI,MAAM,GAAG,WAAW,SAAS,GAC/B,OAAO;CAEX;AAEF;AAEA,eAAsB,oBAAoB,YAAoB;CAC5D,MAAM,OAAO,WAAW,QAAQ,IAAI,OAAO,GAAG,QAAQ,UAAU,EAAE,EAAE,GAAG,EAAE;CACzE,KAAK,MAAM,OAAO,eAAe;EAC/B,MAAM,YAAY,GAAG,OAAO;EAC5B,IAAI,MAAM,GAAG,WAAW,SAAS,GAC/B,OAAO;CAEX;AAEF"}
|
package/dist/plugin/index.d.mts
CHANGED
|
@@ -1,27 +1,61 @@
|
|
|
1
|
-
import { WeappWebPluginOptions } from "./types.mjs";
|
|
1
|
+
import { ResolveWebModuleId, WeappWebPluginOptions } from "./types.mjs";
|
|
2
|
+
import { createWebAssetMiddleware } from "./assets.mjs";
|
|
2
3
|
import { SourceMap } from "magic-string";
|
|
3
4
|
//#region src/plugin/index.d.ts
|
|
4
5
|
interface WebPluginContext {
|
|
5
6
|
warn?: (message: string) => void;
|
|
6
7
|
addWatchFile?: (id: string) => void;
|
|
8
|
+
emitFile?: (asset: {
|
|
9
|
+
type: 'asset';
|
|
10
|
+
fileName: string;
|
|
11
|
+
source: Uint8Array;
|
|
12
|
+
}) => void;
|
|
13
|
+
resolve?: (source: string, importer?: string, options?: {
|
|
14
|
+
skipSelf?: boolean;
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
} | null>;
|
|
7
18
|
}
|
|
8
19
|
type WebTransformResult = {
|
|
9
20
|
code: string;
|
|
10
21
|
map: SourceMap | null;
|
|
11
22
|
} | null;
|
|
12
|
-
interface
|
|
23
|
+
interface WebPostcssConfig {
|
|
24
|
+
plugins?: Array<{
|
|
25
|
+
postcssPlugin?: string;
|
|
26
|
+
}>;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
interface WebUserConfig {
|
|
30
|
+
css?: {
|
|
31
|
+
postcss?: string | WebPostcssConfig;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
interface WebResolvedConfig extends WebUserConfig {
|
|
13
35
|
root: string;
|
|
14
36
|
command: string;
|
|
37
|
+
createResolver?: () => ResolveWebModuleId;
|
|
38
|
+
optimizeDeps?: {
|
|
39
|
+
exclude?: string[];
|
|
40
|
+
include?: string[];
|
|
41
|
+
};
|
|
15
42
|
}
|
|
16
43
|
interface WebHmrContext {
|
|
17
44
|
file: string;
|
|
18
45
|
}
|
|
46
|
+
interface WebDevServer {
|
|
47
|
+
middlewares: {
|
|
48
|
+
use: (middleware: ReturnType<typeof createWebAssetMiddleware>) => void;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
19
51
|
interface WeappWebVitePlugin {
|
|
20
52
|
name: string;
|
|
21
53
|
enforce?: 'pre' | 'post';
|
|
54
|
+
config?: (this: WebPluginContext, config: WebUserConfig) => WebUserConfig | void;
|
|
22
55
|
configResolved?: (this: WebPluginContext, config: WebResolvedConfig) => void | Promise<void>;
|
|
56
|
+
configureServer?: (server: WebDevServer) => void;
|
|
23
57
|
buildStart?: (this: WebPluginContext) => void | Promise<void>;
|
|
24
|
-
resolveId?: (id: string) => string | null | Promise<string | null>;
|
|
58
|
+
resolveId?: (id: string, importer?: string) => string | null | Promise<string | null>;
|
|
25
59
|
load?: (id: string) => string | null | Promise<string | null>;
|
|
26
60
|
handleHotUpdate?: (this: WebPluginContext, ctx: WebHmrContext) => void | Promise<void>;
|
|
27
61
|
transform?: (this: WebPluginContext, code: string, id: string) => WebTransformResult | Promise<WebTransformResult>;
|